refactor: align control types closer to schema
This commit is contained in:
@@ -73,22 +73,31 @@ export type SDKControlRewindFilesRequest = {
|
||||
|
||||
export type SDKControlCancelAsyncMessageRequest = {
|
||||
subtype: 'cancel_async_message'
|
||||
request_id?: string
|
||||
message_uuid: string
|
||||
}
|
||||
|
||||
export type SDKControlSeedReadStateRequest = {
|
||||
subtype: 'seed_read_state'
|
||||
entries?: Array<Record<string, unknown>>
|
||||
path: string
|
||||
mtime: number
|
||||
}
|
||||
|
||||
export type SDKHookCallbackRequest = {
|
||||
subtype: 'hook_callback'
|
||||
callback_id: string
|
||||
input: Record<string, unknown>
|
||||
tool_use_id?: string
|
||||
}
|
||||
|
||||
export type SDKControlMcpMessageRequest = {
|
||||
subtype: 'mcp_message'
|
||||
message?: Record<string, unknown>
|
||||
server_name: string
|
||||
message: Record<string, unknown>
|
||||
}
|
||||
|
||||
export type SDKControlMcpSetServersRequest = {
|
||||
subtype: 'mcp_set_servers'
|
||||
servers?: Array<Record<string, unknown>>
|
||||
servers: Record<string, Record<string, unknown>>
|
||||
}
|
||||
|
||||
export type SDKControlReloadPluginsRequest = {
|
||||
@@ -97,18 +106,18 @@ export type SDKControlReloadPluginsRequest = {
|
||||
|
||||
export type SDKControlMcpReconnectRequest = {
|
||||
subtype: 'mcp_reconnect'
|
||||
server_name?: string
|
||||
serverName: string
|
||||
}
|
||||
|
||||
export type SDKControlMcpToggleRequest = {
|
||||
subtype: 'mcp_toggle'
|
||||
server_name?: string
|
||||
enabled?: boolean
|
||||
serverName: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export type SDKControlStopTaskRequest = {
|
||||
subtype: 'stop_task'
|
||||
task_id?: string
|
||||
task_id: string
|
||||
}
|
||||
|
||||
export type SDKControlApplyFlagSettingsRequest = {
|
||||
@@ -135,6 +144,7 @@ export type SDKControlRequestInner =
|
||||
| SDKControlSetMaxThinkingTokensRequest
|
||||
| SDKControlMcpStatusRequest
|
||||
| SDKControlGetContextUsageRequest
|
||||
| SDKHookCallbackRequest
|
||||
| SDKControlRewindFilesRequest
|
||||
| SDKControlCancelAsyncMessageRequest
|
||||
| SDKControlSeedReadStateRequest
|
||||
@@ -188,6 +198,30 @@ export type SDKControlMcpStatusResponse = {
|
||||
mcpServers?: Array<Record<string, unknown>>
|
||||
}
|
||||
|
||||
export type SDKControlCancelAsyncMessageResponse = {
|
||||
subtype: 'cancel_async_message'
|
||||
request_id: string
|
||||
cancelled: boolean
|
||||
}
|
||||
|
||||
export type SDKControlMcpSetServersResponse = {
|
||||
subtype: 'mcp_set_servers'
|
||||
request_id: string
|
||||
added: string[]
|
||||
removed: string[]
|
||||
errors: Record<string, string>
|
||||
}
|
||||
|
||||
export type SDKControlReloadPluginsResponse = {
|
||||
subtype: 'reload_plugins'
|
||||
request_id: string
|
||||
commands?: Array<Record<string, unknown>>
|
||||
agents?: Array<Record<string, unknown>>
|
||||
plugins?: Array<Record<string, unknown>>
|
||||
mcpServers?: Array<Record<string, unknown>>
|
||||
error_count?: number
|
||||
}
|
||||
|
||||
export type SDKControlGetContextUsageResponse = {
|
||||
subtype: 'get_context_usage'
|
||||
request_id: string
|
||||
@@ -204,13 +238,29 @@ export type SDKControlGetContextUsageResponse = {
|
||||
export type SDKControlGetSettingsResponse = {
|
||||
subtype: 'get_settings'
|
||||
request_id: string
|
||||
settings?: Record<string, unknown>
|
||||
effective: Record<string, unknown>
|
||||
sources: Array<{
|
||||
source:
|
||||
| 'userSettings'
|
||||
| 'projectSettings'
|
||||
| 'localSettings'
|
||||
| 'flagSettings'
|
||||
| 'policySettings'
|
||||
settings: Record<string, unknown>
|
||||
}>
|
||||
applied?: {
|
||||
model: string
|
||||
effort: 'low' | 'medium' | 'high' | 'max' | null
|
||||
}
|
||||
}
|
||||
|
||||
export type SDKControlElicitationResponse = {
|
||||
subtype: 'elicitation'
|
||||
request_id: string
|
||||
response?: Record<string, unknown>
|
||||
response?: {
|
||||
action?: 'accept' | 'decline' | 'cancel'
|
||||
content?: Record<string, unknown>
|
||||
}
|
||||
}
|
||||
|
||||
export type SDKControlResponseInner =
|
||||
@@ -218,6 +268,9 @@ export type SDKControlResponseInner =
|
||||
| SDKControlErrorResponse
|
||||
| SDKControlInitializeResponse
|
||||
| SDKControlMcpStatusResponse
|
||||
| SDKControlCancelAsyncMessageResponse
|
||||
| SDKControlMcpSetServersResponse
|
||||
| SDKControlReloadPluginsResponse
|
||||
| SDKControlGetContextUsageResponse
|
||||
| SDKControlGetSettingsResponse
|
||||
| SDKControlElicitationResponse
|
||||
@@ -242,6 +295,11 @@ export type KeepAliveMessage = {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export type SDKUpdateEnvironmentVariablesMessage = {
|
||||
type: 'update_environment_variables'
|
||||
variables: Record<string, string>
|
||||
}
|
||||
|
||||
export type SDKStreamlinedTextMessage = {
|
||||
type: 'streamlined_text'
|
||||
text: string
|
||||
@@ -262,5 +320,6 @@ export type StdoutMessage =
|
||||
| SDKControlResponse
|
||||
| SDKControlCancelRequest
|
||||
| KeepAliveMessage
|
||||
| SDKUpdateEnvironmentVariablesMessage
|
||||
| SDKStreamlinedTextMessage
|
||||
| SDKStreamlinedToolUseSummaryMessage
|
||||
|
||||
Reference in New Issue
Block a user