@qoder-ai/qoder-agent-sdk 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +128 -0
  2. package/dist/core/constants.d.ts +2 -2
  3. package/dist/core/deferred-transport.d.ts +23 -0
  4. package/dist/core/errors.d.ts +0 -8
  5. package/dist/core/process-transport.d.ts +3 -0
  6. package/dist/core/runtime-launch-options.d.ts +4 -1
  7. package/dist/core/transport.d.ts +2 -4
  8. package/dist/index.d.ts +10 -11
  9. package/dist/index.js +27 -22
  10. package/dist/mcp/sdk-mcp-server.d.ts +13 -1
  11. package/dist/mcp/tool-policy.d.ts +6 -0
  12. package/dist/protocol/agents.d.ts +0 -3
  13. package/dist/protocol/common.d.ts +0 -9
  14. package/dist/protocol/control.d.ts +35 -11
  15. package/dist/protocol/index.d.ts +4 -3
  16. package/dist/protocol/index.js +1 -1
  17. package/dist/protocol/mcp.d.ts +29 -0
  18. package/dist/protocol/messages.d.ts +34 -18
  19. package/dist/protocol/model-prompt-patches.d.ts +18 -0
  20. package/dist/protocol/version.d.ts +1 -1
  21. package/dist/query/query-runner.d.ts +13 -5
  22. package/dist/session/session-fork.d.ts +1 -27
  23. package/dist/session/session-import.d.ts +10 -0
  24. package/dist/session/session-manager.d.ts +3 -1
  25. package/dist/session/session-materializer.d.ts +15 -0
  26. package/dist/session/session-store.d.ts +45 -0
  27. package/dist/session/transcript-mirror.d.ts +25 -0
  28. package/dist/session/transcript-paths.d.ts +1 -2
  29. package/dist/types/common.d.ts +1 -1
  30. package/dist/types/control.d.ts +1 -1
  31. package/dist/types/hooks.d.ts +1 -1
  32. package/dist/types/index.d.ts +1 -2
  33. package/dist/types/mcp.d.ts +9 -3
  34. package/dist/types/messages.d.ts +21 -2
  35. package/dist/types/options.d.ts +44 -10
  36. package/dist/types/session.d.ts +17 -7
  37. package/dist/types/settings.d.ts +19 -232
  38. package/package.json +3 -14
  39. package/dist/bridge/bridge-api.d.ts +0 -14
  40. package/dist/bridge/bridge-session.d.ts +0 -6
  41. package/dist/bridge/ccr-client.d.ts +0 -72
  42. package/dist/bridge/index.d.ts +0 -9
  43. package/dist/bridge/index.js +0 -3
  44. package/dist/bridge/sse-transport.d.ts +0 -37
  45. package/dist/browser/browser-query.d.ts +0 -24
  46. package/dist/browser/index.d.ts +0 -14
  47. package/dist/browser/index.js +0 -9
  48. package/dist/browser/websocket-transport.d.ts +0 -40
  49. package/dist/direct-connect/direct-connect-transport.d.ts +0 -31
  50. package/dist/direct-connect/url-parser.d.ts +0 -14
  51. package/dist/embed/embed.d.ts +0 -2
  52. package/dist/embed/embed.js +0 -1
  53. package/dist/embed/extract-from-bunfs.d.ts +0 -5
  54. package/dist/types/bridge.d.ts +0 -62
  55. package/dist/types/browser.d.ts +0 -26
@@ -5,4 +5,4 @@
5
5
  * shim so existing SDK consumer imports (`'./types/common.js'` paths)
6
6
  * keep working.
7
7
  */
8
- export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, OutputFormatType, JsonSchemaOutputFormat, OutputFormat, BaseOutputFormat, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from '../protocol/index.js';
8
+ export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, ApiKeySource, ExitReason, FastModeState, ConfigScope, SettingSource, SDKAssistantMessageError, SDKStatus, EffortLevel, ThinkingAdaptive, ThinkingEnabled, ThinkingDisabled, ThinkingConfig, ModelInfo, ModelSource, ServerModelJson, ServerModelJsonValue, ModelStrategy, ModelPromotion, LocalizedModelText, ModelContextConfig, ModelContextWindowEntry, ModelEffortEntry, ModelThinkingConfig, ModelThinkingDisabled, ModelThinkingEnabled, PluginInfo, ModelUsage, SlashCommand, ToolConfig, SdkPluginConfig, } from '../protocol/index.js';
@@ -5,7 +5,7 @@
5
5
  * shim so existing SDK consumer imports keep working.
6
6
  */
7
7
  export type { QoderModelPurpose } from '../protocol/index.js';
8
- export type { SDKControlRequest, SDKControlResponse, SDKControlCancelRequest, SDKControlInterruptRequest, SDKControlPermissionRequest, SDKControlInitializeRequest, SDKControlSetPermissionModeRequest, SDKControlSetModelRequest, SDKControlGenerateSessionTitleRequest, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesRequest, SDKControlAddDirectoriesResponse, SDKControlGetModelPolicyRequest, SDKControlGetByokConfigRequest, SDKControlGetByokConfigResponse, SDKControlValidateByokModelRequest, SDKControlValidateByokModelResponse, SDKControlSetMaxThinkingTokensRequest, SDKControlMcpStatusRequest, SDKControlGetContextUsageRequest, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAccountInfoRequest, SDKHookCallbackRequest, SDKControlMcpMessageRequest, SDKControlRewindFilesRequest, SDKControlCancelAsyncMessageRequest, SDKControlSeedReadStateRequest, SDKControlMcpSetServersRequest, SDKControlReloadPluginsRequest, SDKControlMcpReconnectRequest, SDKControlMcpToggleRequest, SDKControlApplyFlagSettingsRequest, SDKControlGetSettingsRequest, SDKControlElicitationRequest, SDKControlEndSessionRequest, SDKControlChannelEnableRequest, SDKControlMcpInjectTokenRequest, SDKControlMcpAuthenticateRequest, SDKControlMcpOAuthCallbackUrlRequest, SDKControlMcpClearAuthRequest, SDKControlRequestInner, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlReloadPluginsResponse, SDKControlListPluginsRequest, SDKControlListPluginsResponse, SDKControlMcpStatusResponse, SDKControlMcpSetServersResponse, SDKKeepAliveMessage, StdoutMessage, ControlMcpServerConfig, BYOKModelValidationInput, } from '../protocol/index.js';
8
+ export type { SDKControlRequest, SDKControlResponse, SDKControlCancelRequest, SDKControlInterruptRequest, SDKControlInterruptResponse, SDKControlPermissionRequest, SDKControlInitializeRequest, SDKControlSetPermissionModeRequest, SDKControlSetModelRequest, SDKControlGenerateSessionTitleRequest, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesRequest, SDKControlAddDirectoriesResponse, SDKControlGetModelPolicyRequest, SDKControlGetByokConfigRequest, SDKControlGetByokConfigResponse, SDKControlValidateByokModelRequest, SDKControlValidateByokModelResponse, SDKControlSetMaxThinkingTokensRequest, SDKControlMcpStatusRequest, SDKControlGetContextUsageRequest, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAccountInfoRequest, SDKHookCallbackRequest, SDKControlMcpMessageRequest, SDKControlRewindFilesRequest, SDKControlCancelAsyncMessageRequest, SDKControlSeedReadStateRequest, SDKControlMcpSetServersRequest, SDKControlReloadPluginsRequest, SDKControlMcpReconnectRequest, SDKControlMcpToggleRequest, SDKControlApplyFlagSettingsRequest, SDKControlGetSettingsRequest, SDKControlElicitationRequest, SDKControlEndSessionRequest, SDKControlChannelEnableRequest, SDKControlMcpInjectTokenRequest, SDKControlMcpAuthenticateRequest, SDKControlMcpOAuthCallbackUrlRequest, SDKControlMcpClearAuthRequest, SDKControlRequestInner, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlReloadPluginsResponse, SDKControlListPluginsRequest, SDKControlListPluginsResponse, SDKControlMcpStatusResponse, SDKControlMcpSetServersResponse, SDKKeepAliveMessage, StdoutMessage, ControlMcpServerConfig, BYOKModelValidationInput, } from '../protocol/index.js';
9
9
  /** Wire format for fetch_job_token inbound control request from CLI. */
10
10
  export type FetchJobTokenWireRequest = {
11
11
  subtype: 'fetch_job_token';
@@ -5,7 +5,7 @@
5
5
  * `../protocol/`. The SDK-local HookEvent/HookInput contract is
6
6
  * intentionally narrowed to events supported by SDK user configuration.
7
7
  */
8
- export type { BaseHookInput, PreToolUseHookInput, PostToolUseHookInput, PostToolUseFailureHookInput, UserPromptSubmitHookInput, SessionStartHookInput, SessionEndHookInput, StopHookInput, SubagentStartHookInput, SubagentStopHookInput, PreCompactHookInput, PostCompactHookInput, PermissionRequestHookInput, InstructionsLoadedHookInput, CwdChangedHookInput, FileChangedHookInput, PostToolUseFailureHookSpecificOutput, UserPromptSubmitHookSpecificOutput, SessionStartHookSpecificOutput, SubagentStartHookSpecificOutput, PermissionRequestHookSpecificOutput, CwdChangedHookSpecificOutput, FileChangedHookSpecificOutput, } from '../protocol/index.js';
8
+ export type { BaseHookInput, PreToolUseHookInput, PostToolUseHookInput, PostToolUseFailureHookInput, UserPromptSubmitHookInput, SessionStartHookInput, SessionEndHookInput, StopHookInput, SubagentStartHookInput, SubagentStopHookInput, PreCompactHookInput, PostCompactHookInput, PermissionRequestHookInput, PermissionDeniedHookInput, InstructionsLoadedHookInput, CwdChangedHookInput, FileChangedHookInput, PostToolUseFailureHookSpecificOutput, UserPromptSubmitHookSpecificOutput, SessionStartHookSpecificOutput, SubagentStartHookSpecificOutput, PermissionRequestHookSpecificOutput, CwdChangedHookSpecificOutput, FileChangedHookSpecificOutput, } from '../protocol/index.js';
9
9
  import type { AsyncHookJSONOutput as ProtocolAsyncHookJSONOutput, CwdChangedHookSpecificOutput, FileChangedHookSpecificOutput, HookInput as ProtocolHookInput, PostToolUseHookSpecificOutput as ProtocolPostToolUseHookSpecificOutput, PostToolUseFailureHookSpecificOutput, PreToolUseHookSpecificOutput as ProtocolPreToolUseHookSpecificOutput, PermissionRequestHookSpecificOutput, SessionStartHookSpecificOutput, SubagentStartHookSpecificOutput, SyncHookJSONOutput as ProtocolSyncHookJSONOutput, UserPromptSubmitHookSpecificOutput } from '../protocol/index.js';
10
10
  import type { HookEventConst } from '../core/constants.js';
11
11
  /**
@@ -15,11 +15,10 @@ export type { HookEvent, HookPermissionDecision, HookCallback, HookCallbackMatch
15
15
  export * from './mcp.js';
16
16
  export * from './agents.js';
17
17
  export * from './session.js';
18
+ export type { SessionKey, SessionStore, SessionStoreEntry, SessionStoreFlush, } from '../session/session-store.js';
18
19
  export * from './settings.js';
19
20
  export * from './cloud-agent.js';
20
21
  export * from './control.js';
21
22
  export * from './model-policy-provider.js';
22
- export * from './bridge.js';
23
- export * from './browser.js';
24
23
  export * from './tools.js';
25
24
  export type { AccessTokenInput, AuthOptions, FetchJobToken, JobTokenAuthOptions, JobTokenRequest, JobTokenResult, } from './auth.js';
@@ -9,16 +9,22 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
9
  import type { McpStdioServerConfig as ProtocolMcpStdioServerConfig, McpSSEServerConfig as ProtocolMcpSSEServerConfig, McpHttpServerConfig as ProtocolMcpHttpServerConfig, McpSdkServerConfig as ProtocolMcpSdkServerConfig } from '../protocol/index.js';
10
10
  export type McpServerToolPolicy = {
11
11
  name: string;
12
- permission_policy: 'always_allow' | 'always_ask' | 'always_deny';
12
+ permission_policy?: 'always_allow' | 'always_ask' | 'always_deny';
13
+ exposedName?: string;
14
+ alwaysLoad?: boolean;
15
+ };
16
+ export type McpStdioServerConfig = ProtocolMcpStdioServerConfig & {
17
+ tools?: McpServerToolPolicy[];
13
18
  };
14
- export type McpStdioServerConfig = ProtocolMcpStdioServerConfig;
15
19
  export type McpSSEServerConfig = ProtocolMcpSSEServerConfig & {
16
20
  tools?: McpServerToolPolicy[];
17
21
  };
18
22
  export type McpHttpServerConfig = ProtocolMcpHttpServerConfig & {
19
23
  tools?: McpServerToolPolicy[];
20
24
  };
21
- export type McpSdkServerConfig = ProtocolMcpSdkServerConfig;
25
+ export type McpSdkServerConfig = ProtocolMcpSdkServerConfig & {
26
+ tools?: McpServerToolPolicy[];
27
+ };
22
28
  export type McpServerConfigForProcessTransport = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfig;
23
29
  export type McpServerStatusConfig = McpServerConfigForProcessTransport;
24
30
  export type { McpServerStatus, McpSetServersResult, OAuthToken, } from '../protocol/index.js';
@@ -8,14 +8,25 @@
8
8
  import type { SDKMessage as ProtocolSDKMessage, SDKStatusMessage as ProtocolSDKStatusMessage, SDKSystemMessage as ProtocolSDKSystemMessage, SDKUserMessage as ProtocolSDKUserMessage, SDKUserMessageReplay as ProtocolSDKUserMessageReplay } from '../protocol/index.js';
9
9
  import type { MessageParam, UUID } from './common.js';
10
10
  import type { PermissionMode } from './permissions.js';
11
- export type { SDKAssistantMessage, SDKResultSuccess, SDKResultError, SDKResultMessage, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKAPIRetryMessage, SDKLocalCommandOutputMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKSessionStateChangedMessage, SDKSessionTitleChangedMessage, SDKBridgeStateMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKPermissionDenial, } from '../protocol/index.js';
11
+ import type { SessionKey } from '../session/session-store.js';
12
+ export type { SDKAssistantMessage, SDKResultSuccess, SDKResultError, SDKResultMessage, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKAPIRetryMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKSessionStateChangedMessage, SDKSessionTitleChangedMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKPermissionDenial, } from '../protocol/index.js';
12
13
  export type SDKUserMessage = {
13
14
  type: 'user';
14
15
  message: MessageParam;
15
16
  parent_tool_use_id: string | null;
16
17
  isSynthetic?: boolean;
17
18
  tool_use_result?: unknown;
19
+ /**
20
+ * Delivery priority. `next` is the default; `now` interrupts the active
21
+ * turn, while `later` waits for the session to become idle.
22
+ */
18
23
  priority?: 'now' | 'next' | 'later';
24
+ /**
25
+ * When false, do not start an assistant turn while the session is idle.
26
+ * Delivery still follows `priority`: `next` can inject at a safe boundary,
27
+ * `later` waits for idle, and `now` interrupts the active turn.
28
+ */
29
+ shouldQuery?: boolean;
19
30
  timestamp?: string;
20
31
  uuid?: UUID;
21
32
  session_id?: string;
@@ -43,7 +54,15 @@ export type SDKPermissionDeniedMessage = {
43
54
  uuid: string;
44
55
  session_id: string;
45
56
  };
46
- export type SDKMessage = Exclude<ProtocolSDKMessage, ProtocolSDKSystemMessage | ProtocolSDKStatusMessage | ProtocolSDKUserMessage | ProtocolSDKUserMessageReplay> | SDKUserMessage | SDKUserMessageReplay | SDKSystemInitMessage | SDKStatusMessage | SDKPermissionDeniedMessage;
57
+ export type SDKMirrorErrorMessage = {
58
+ type: 'system';
59
+ subtype: 'mirror_error';
60
+ error: string;
61
+ key: SessionKey;
62
+ uuid: string;
63
+ session_id: string;
64
+ };
65
+ export type SDKMessage = Exclude<ProtocolSDKMessage, ProtocolSDKSystemMessage | ProtocolSDKStatusMessage | ProtocolSDKUserMessage | ProtocolSDKUserMessageReplay> | SDKUserMessage | SDKUserMessageReplay | SDKSystemInitMessage | SDKStatusMessage | SDKPermissionDeniedMessage | SDKMirrorErrorMessage;
47
66
  export type SDKSystemMessage = Extract<SDKMessage, {
48
67
  type: 'system';
49
68
  }>;
@@ -8,13 +8,15 @@ import type { HookCallbackMatcher, HookEvent } from './hooks.js';
8
8
  import type { McpServerConfig, McpServerStatus, McpSetServersResult, OAuthToken } from './mcp.js';
9
9
  import type { SDKMessage, SDKUserMessage } from './messages.js';
10
10
  import type { Settings } from './settings.js';
11
- import type { SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse, StdoutMessage } from './control.js';
11
+ import type { SDKControlInterruptResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse, StdoutMessage } from './control.js';
12
12
  import type { ModelPolicyProvider } from './model-policy-provider.js';
13
13
  import type { BYOKModelValidationInput, BYOKProviderInfo } from './byok.js';
14
14
  import type { RewindFilesResult } from './session.js';
15
15
  import type { CloudAgentOptions } from './cloud-agent.js';
16
16
  import type { QueryTransportProviderOption } from '../core/query-transport.js';
17
17
  import type { PluginDetails } from './plugins.js';
18
+ import type { SessionStore, SessionStoreFlush } from '../session/session-store.js';
19
+ import type { ModelPromptPatches } from '../protocol/model-prompt-patches.js';
18
20
  export type { CanUseTool };
19
21
  export type { AuthOptions };
20
22
  export type ElicitationRequest = {
@@ -109,9 +111,9 @@ export type Options = {
109
111
  * `name` / directory name, or `plugin:skill` for plugin-qualified skills.
110
112
  * Adds `"Skill(<name>)"` for each entry to allowedTools.
111
113
  *
112
- * This is a context filter, not a sandbox: unlisted skills are hidden from
113
- * the model's listing and rejected by the Skill tool, but their files
114
- * remain on disk and are reachable via Read/Bash.
114
+ * This is a context filter, not a security boundary: unlisted skills are
115
+ * hidden from the model's listing and rejected by the Skill tool, but their
116
+ * files remain on disk and are reachable via Read/Bash.
115
117
  */
116
118
  skills?: string[] | 'all';
117
119
  extensions?: string[];
@@ -167,11 +169,6 @@ export type Options = {
167
169
  model?: string;
168
170
  pathToQoderCLIExecutable?: string;
169
171
  permissionMode?: PermissionMode;
170
- /**
171
- * Custom workflow instructions for plan mode. When `permissionMode` is
172
- * `plan`, the CLI uses this text as the plan-mode workflow body.
173
- */
174
- planModeInstructions?: string;
175
172
  allowDangerouslySkipPermissions?: boolean;
176
173
  /**
177
174
  * MCP tool name to use for permission prompts. Mutually exclusive with
@@ -180,7 +177,21 @@ export type Options = {
180
177
  permissionPromptToolName?: string;
181
178
  plugins?: SdkPluginConfig[];
182
179
  promptSuggestions?: boolean;
180
+ /**
181
+ * Persist the local session transcript. Defaults to true.
182
+ *
183
+ * Set to false for an ephemeral query that cannot be resumed. This option
184
+ * cannot be combined with sessionStore because external mirroring consumes
185
+ * locally committed transcript entries.
186
+ */
187
+ persistSession?: boolean;
183
188
  resume?: string;
189
+ /** Mirrors locally committed transcript entries to an external store. */
190
+ sessionStore?: SessionStore;
191
+ /** `batched` flushes at result boundaries; `eager` drains every CLI frame. */
192
+ sessionStoreFlush?: SessionStoreFlush;
193
+ /** Timeout for loading a session from an external store. Defaults to 60 seconds. */
194
+ loadTimeoutMs?: number;
184
195
  sessionId?: string;
185
196
  settings?: string | Settings;
186
197
  settingSources?: SettingSource[];
@@ -191,6 +202,11 @@ export type Options = {
191
202
  preset: 'qodercli';
192
203
  append?: string;
193
204
  };
205
+ /**
206
+ * Prompt patches forwarded to the model service for model-aware system
207
+ * prompt selection. Route keys are interpreted by the service.
208
+ */
209
+ modelRequestPatches?: ModelPromptPatches;
194
210
  /**
195
211
  * Pull-mode model selection callback.
196
212
  *
@@ -263,7 +279,25 @@ export interface SpawnedProcess {
263
279
  * 配置 MCP servers 请通过 `Options.mcpServers`(启动时一次性配置)。
264
280
  */
265
281
  export interface Query extends AsyncGenerator<SDKMessage, void> {
266
- interrupt(): Promise<void>;
282
+ /**
283
+ * Request interruption of the active turn.
284
+ *
285
+ * CLIs advertising `interrupt_receipt_v1` return UUIDs of queued messages
286
+ * that survive the interrupt. Older CLIs return `undefined`.
287
+ */
288
+ interrupt(): Promise<SDKControlInterruptResponse | undefined>;
289
+ /**
290
+ * Remove a UUID-stamped async user message while it is still queued.
291
+ *
292
+ * Returns `true` only when the CLI removes that UUID from the queue.
293
+ *
294
+ * After messages have been dequeued into the in-flight coalesced batch, this
295
+ * method returns `false`. While that reservation remains active, cancelling
296
+ * the last UUID-bearing message marks the batch to be dropped; cancelling a
297
+ * non-representative UUID is a no-op. `false` alone does not prove a batch
298
+ * was dropped.
299
+ */
300
+ cancelAsyncMessage(messageUuid: string): Promise<boolean>;
267
301
  setPermissionMode(mode: PermissionMode): Promise<void>;
268
302
  setModel(model?: string): Promise<void>;
269
303
  /**
@@ -26,6 +26,11 @@ export type SessionMessage = {
26
26
  session_id: string;
27
27
  message: unknown;
28
28
  parent_tool_use_id: string | null;
29
+ /**
30
+ * Agent ID of the subagent that spawned this subagent. Null for main-session
31
+ * messages, depth-one subagents, and transcripts without this metadata.
32
+ */
33
+ parent_agent_id: string | null;
29
34
  /**
30
35
  * ISO 8601 timestamp of when this transcript entry was written to the
31
36
  * jsonl file. Mirrors the on-disk `timestamp` field. Optional because
@@ -61,16 +66,19 @@ export type SessionMessage = {
61
66
  };
62
67
  };
63
68
  };
64
- export type ListSessionsOptions = {
69
+ type SessionStoreOptions = {
70
+ sessionStore?: SessionStore;
71
+ };
72
+ export type ListSessionsOptions = SessionStoreOptions & {
65
73
  dir?: string;
66
74
  limit?: number;
67
75
  offset?: number;
68
76
  includeWorktrees?: boolean;
69
77
  };
70
- export type GetSessionInfoOptions = {
78
+ export type GetSessionInfoOptions = SessionStoreOptions & {
71
79
  dir?: string;
72
80
  };
73
- export type GetSessionMessagesOptions = {
81
+ export type GetSessionMessagesOptions = SessionStoreOptions & {
74
82
  dir?: string;
75
83
  limit?: number;
76
84
  offset?: number;
@@ -80,15 +88,15 @@ export type GetSessionMessagesOptions = {
80
88
  */
81
89
  includeSystemMessages?: boolean;
82
90
  };
83
- export type GetSubagentMessagesOptions = {
91
+ export type GetSubagentMessagesOptions = SessionStoreOptions & {
84
92
  dir?: string;
85
93
  limit?: number;
86
94
  offset?: number;
87
95
  };
88
- export type ListSubagentsOptions = {
96
+ export type ListSubagentsOptions = SessionStoreOptions & {
89
97
  dir?: string;
90
98
  };
91
- export type SessionMutationOptions = {
99
+ export type SessionMutationOptions = SessionStoreOptions & {
92
100
  dir?: string;
93
101
  };
94
102
  export type ForkSessionOptions = SessionMutationOptions & {
@@ -106,4 +114,6 @@ export type RewindFilesResult = {
106
114
  filesChanged?: string[];
107
115
  insertions?: number;
108
116
  deletions?: number;
109
- };
117
+ };
118
+ import type { SessionStore } from '../session/session-store.js';
119
+ export {};
@@ -1,137 +1,19 @@
1
1
  import type { PermissionMode } from './permissions.js';
2
- type MarketplaceSource = {
3
- source: 'url';
4
- url: string;
5
- headers?: Record<string, string>;
6
- } | {
7
- source: 'github';
8
- repo: string;
9
- ref?: string;
10
- path?: string;
11
- sparsePaths?: string[];
12
- } | {
13
- source: 'git';
14
- url: string;
15
- ref?: string;
16
- path?: string;
17
- sparsePaths?: string[];
18
- } | {
19
- source: 'npm';
20
- package: string;
21
- } | {
22
- source: 'file';
23
- path: string;
24
- } | {
25
- source: 'directory';
26
- path: string;
27
- } | {
28
- source: 'hostPattern';
29
- hostPattern: string;
30
- } | {
31
- source: 'pathPattern';
32
- pathPattern: string;
33
- } | {
34
- source: 'settings';
35
- name: string;
36
- plugins: PluginEntry[];
37
- owner?: {
38
- name: string;
39
- email?: string;
40
- url?: string;
41
- };
42
- };
43
- type PluginSourceType = string | {
44
- source: 'npm';
45
- package: string;
46
- version?: string;
47
- registry?: string;
48
- } | {
49
- source: 'pip';
50
- package: string;
51
- version?: string;
52
- registry?: string;
53
- } | {
54
- source: 'url';
55
- url: string;
56
- ref?: string;
57
- sha?: string;
58
- } | {
59
- source: 'github';
60
- repo: string;
61
- ref?: string;
62
- sha?: string;
63
- } | {
64
- source: 'git-subdir';
65
- url: string;
66
- path: string;
67
- ref?: string;
68
- sha?: string;
69
- };
70
- type PluginEntry = {
71
- name: string;
72
- source: PluginSourceType;
73
- description?: string;
74
- version?: string;
75
- strict?: boolean;
76
- };
77
- type CommandHookEntry = {
78
- type: 'command';
79
- command: string;
80
- if?: string;
81
- shell?: 'bash' | 'powershell';
82
- timeout?: number;
83
- statusMessage?: string;
84
- once?: boolean;
85
- async?: boolean;
86
- asyncRewake?: boolean;
87
- };
88
- type PromptHookEntry = {
89
- type: 'prompt';
90
- prompt: string;
91
- if?: string;
92
- timeout?: number;
93
- model?: string;
94
- statusMessage?: string;
95
- once?: boolean;
96
- };
97
- type AgentHookEntry = {
98
- type: 'agent';
99
- prompt: string;
100
- if?: string;
101
- timeout?: number;
102
- model?: string;
103
- statusMessage?: string;
104
- once?: boolean;
105
- };
106
- type HttpHookEntry = {
107
- type: 'http';
108
- url: string;
109
- if?: string;
110
- timeout?: number;
111
- headers?: Record<string, string>;
112
- allowedEnvVars?: string[];
113
- statusMessage?: string;
114
- once?: boolean;
115
- };
116
- type HookEntry = CommandHookEntry | PromptHookEntry | AgentHookEntry | HttpHookEntry;
2
+ /**
3
+ * Settings fields with a verified qodercli execution path.
4
+ *
5
+ * Unknown keys remain pass-through so callers can use settings introduced by
6
+ * a newer paired CLI, but the SDK only gives first-class types to capabilities
7
+ * that are implemented and tested.
8
+ */
117
9
  export interface Settings {
118
- apiKeyHelper?: string;
119
- awsCredentialExport?: string;
120
- awsAuthRefresh?: string;
121
- gcpAuthRefresh?: string;
122
- fileSuggestion?: {
123
- type: 'command';
124
- command: string;
125
- };
126
- respectGitignore?: boolean;
127
- cleanupPeriodDays?: number;
128
- env?: Record<string, string>;
129
- attribution?: {
130
- commit?: string;
131
- pr?: string;
10
+ general?: {
11
+ fileCheckpointing?: {
12
+ enabled?: boolean;
13
+ [k: string]: unknown;
14
+ };
15
+ [k: string]: unknown;
132
16
  };
133
- includeCoAuthoredBy?: boolean;
134
- includeGitInstructions?: boolean;
135
17
  security?: {
136
18
  disableYoloMode?: boolean;
137
19
  [k: string]: unknown;
@@ -145,113 +27,19 @@ export interface Settings {
145
27
  additionalDirectories?: string[];
146
28
  [k: string]: unknown;
147
29
  };
148
- model?: string;
149
- availableModels?: string[];
150
- modelOverrides?: Record<string, string>;
151
- enableAllProjectMcpServers?: boolean;
152
- enabledMcpjsonServers?: string[];
153
- disabledMcpjsonServers?: string[];
154
- allowedMcpServers?: {
155
- serverName?: string;
156
- serverCommand?: [string, ...string[]];
157
- serverUrl?: string;
158
- }[];
159
- deniedMcpServers?: {
160
- serverName?: string;
161
- serverCommand?: [string, ...string[]];
162
- serverUrl?: string;
163
- }[];
164
- hooks?: {
165
- [k: string]: {
166
- matcher?: string;
167
- hooks: HookEntry[];
168
- }[];
169
- };
170
- worktree?: {
171
- symlinkDirectories?: string[];
172
- sparsePaths?: string[];
30
+ mcp?: {
31
+ lazyLoad?: boolean;
32
+ [k: string]: unknown;
173
33
  };
174
- disableAllHooks?: boolean;
175
- defaultShell?: 'bash' | 'powershell';
176
- allowManagedHooksOnly?: boolean;
177
- allowedHttpHookUrls?: string[];
178
- httpHookAllowedEnvVars?: string[];
179
- allowManagedPermissionRulesOnly?: boolean;
180
- allowManagedMcpServersOnly?: boolean;
181
- strictPluginOnlyCustomization?: boolean | ('skills' | 'agents' | 'hooks' | 'mcp')[];
34
+ model?: string;
35
+ outputStyle?: string;
182
36
  skillOverrides?: Record<string, 'on' | 'name-only' | 'user-invocable-only' | 'off'>;
183
37
  skillListingMaxDescChars?: number;
184
38
  skillListingBudgetFraction?: number;
185
- statusLine?: {
186
- type: 'command';
187
- command: string;
188
- padding?: number;
189
- };
190
39
  enabledPlugins?: Record<string, string[] | boolean | Record<string, unknown>>;
191
- extraKnownMarketplaces?: Record<string, {
192
- source: MarketplaceSource;
193
- installLocation?: string;
194
- autoUpdate?: boolean;
195
- }>;
196
- strictKnownMarketplaces?: MarketplaceSource[];
197
- blockedMarketplaces?: MarketplaceSource[];
198
- forceLoginOrgUUID?: string;
199
- otelHeadersHelper?: string;
200
- outputStyle?: string;
201
- language?: string;
202
- skipWebFetchPreflight?: boolean;
203
- feedbackSurveyRate?: number;
204
- spinnerTipsEnabled?: boolean;
205
- spinnerVerbs?: {
206
- mode: 'append' | 'replace';
207
- verbs: string[];
208
- };
209
- spinnerTipsOverride?: {
210
- excludeDefault?: boolean;
211
- tips: string[];
212
- };
213
- syntaxHighlightingDisabled?: boolean;
214
- terminalTitleFromRename?: boolean;
215
- alwaysThinkingEnabled?: boolean;
216
- effortLevel?: 'low' | 'medium' | 'high';
217
- advisorModel?: string;
218
- fastMode?: boolean;
219
- fastModePerSessionOptIn?: boolean;
220
- promptSuggestionEnabled?: boolean;
221
- showClearContextOnPlanAccept?: boolean;
222
- agent?: string;
223
- companyAnnouncements?: string[];
224
40
  pluginConfigs?: Record<string, {
225
41
  mcpServers?: Record<string, Record<string, string | number | boolean | string[]>>;
226
- options?: Record<string, string | number | boolean | string[]>;
227
42
  }>;
228
- remote?: {
229
- defaultEnvironmentId?: string;
230
- };
231
- autoUpdatesChannel?: 'latest' | 'stable';
232
- minimumVersion?: string;
233
- plansDirectory?: string;
234
- channelsEnabled?: boolean;
235
- allowedChannelPlugins?: {
236
- marketplace: string;
237
- plugin: string;
238
- }[];
239
- prefersReducedMotion?: boolean;
240
- autoMemoryEnabled?: boolean;
241
- autoMemoryDirectory?: string;
242
- autoDreamEnabled?: boolean;
243
- showThinkingSummaries?: boolean;
244
- skipDangerousModePermissionPrompt?: boolean;
245
- disableAutoMode?: 'disable';
246
- sshConfigs?: {
247
- id: string;
248
- name: string;
249
- sshHost: string;
250
- sshPort?: number;
251
- sshIdentityFile?: string;
252
- startDirectory?: string;
253
- }[];
254
- pluginTrustMessage?: string;
255
43
  [k: string]: unknown;
256
44
  }
257
45
  export type ResolvedSettingsSource = {
@@ -271,5 +59,4 @@ export type ResolvedSettings = {
271
59
  * returned settings. Callers should use this before acting on resolved project
272
60
  * settings in SDK-hosted settings flows.
273
61
  */
274
- export declare function filterEscalatingDefaultMode(resolved: ResolvedSettings): Settings;
275
- export {};
62
+ export declare function filterEscalatingDefaultMode(resolved: ResolvedSettings): Settings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoder-ai/qoder-agent-sdk",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "TypeScript SDK for building Qoder-powered coding agents.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,18 +25,6 @@
25
25
  "types": "./dist/index.d.ts",
26
26
  "default": "./dist/index.js"
27
27
  },
28
- "./browser": {
29
- "types": "./dist/browser/index.d.ts",
30
- "default": "./dist/browser/index.js"
31
- },
32
- "./bridge": {
33
- "types": "./dist/bridge/index.d.ts",
34
- "default": "./dist/bridge/index.js"
35
- },
36
- "./embed": {
37
- "types": "./dist/embed/embed.d.ts",
38
- "default": "./dist/embed/embed.js"
39
- },
40
28
  "./protocol": {
41
29
  "types": "./dist/protocol/index.d.ts",
42
30
  "default": "./dist/protocol/index.js"
@@ -64,6 +52,7 @@
64
52
  "demo:image": "node examples/image-input-demo/demo.mjs",
65
53
  "demo:models": "npm run build && node examples/list-models-demo/demo.mjs",
66
54
  "demo:usage": "npm run build && node examples/usage-info-demo/demo.mjs",
55
+ "demo:steer-control": "npm run build && node examples/steer-control-demo/demo.mjs",
67
56
  "demo:chat": "npm run build && node examples/interactive-chat-demo/demo.mjs",
68
57
  "demo:mcp-oauth": "npm run build && node examples/mcp-oauth-demo/demo.mjs",
69
58
  "demo:inprocess-mcp": "npm run build && node examples/inprocess-mcp-demo/demo.mjs",
@@ -113,6 +102,6 @@
113
102
  "typescript": "^5.7.0",
114
103
  "zod": "^4.0.0"
115
104
  },
116
- "qoderCliVersion": "1.0.47",
105
+ "qoderCliVersion": "1.1.7",
117
106
  "license": "SEE LICENSE IN LICENSE"
118
107
  }
@@ -1,14 +0,0 @@
1
- /**
2
- * Bridge API — HTTP endpoints for CCR session management.
3
- */
4
- import type { RemoteCredentials } from '../types/bridge.js';
5
- /**
6
- * POST /v1/code/sessions — Create a fresh CCR session.
7
- * Returns the session ID (cse_* format) or null on failure.
8
- */
9
- export declare function createCodeSession(baseUrl: string, accessToken: string, title: string, timeoutMs: number, tags?: string[]): Promise<string | null>;
10
- /**
11
- * POST /v1/code/sessions/{id}/bridge — Mint a worker JWT.
12
- * This call IS the worker register (bumps epoch server-side).
13
- */
14
- export declare function fetchRemoteCredentials(sessionId: string, baseUrl: string, accessToken: string, timeoutMs: number, trustedDeviceToken?: string): Promise<RemoteCredentials | null>;
@@ -1,6 +0,0 @@
1
- import type { AttachBridgeSessionOptions, BridgeSessionHandle } from '../types/bridge.js';
2
- /**
3
- * Attach to an existing bridge session.
4
- * Creates the transport (SSE + CCR), wires routing, returns a session handle.
5
- */
6
- export declare function attachBridgeSession(opts: AttachBridgeSessionOptions): Promise<BridgeSessionHandle>;