@qoder-ai/qoder-agent-sdk 1.0.15 → 1.0.17
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.
- package/README.md +159 -24
- package/dist/auth.d.ts +4 -1
- package/dist/core/constants.d.ts +7 -2
- package/dist/core/deferred-transport.d.ts +23 -0
- package/dist/core/errors.d.ts +0 -8
- package/dist/core/process-transport.d.ts +3 -0
- package/dist/core/runtime-launch-options.d.ts +10 -1
- package/dist/core/transport.d.ts +2 -4
- package/dist/index.d.ts +13 -13
- package/dist/index.js +27 -22
- package/dist/mcp/sdk-mcp-server.d.ts +13 -1
- package/dist/mcp/tool-policy.d.ts +6 -0
- package/dist/protocol/agents.d.ts +0 -3
- package/dist/protocol/common.d.ts +27 -9
- package/dist/protocol/control.d.ts +40 -12
- package/dist/protocol/index.d.ts +4 -3
- package/dist/protocol/index.js +1 -1
- package/dist/protocol/mcp.d.ts +29 -0
- package/dist/protocol/messages.d.ts +38 -18
- package/dist/protocol/model-prompt-patches.d.ts +18 -0
- package/dist/protocol/version.d.ts +1 -1
- package/dist/query/query-runner.d.ts +16 -6
- package/dist/session/session-fork.d.ts +1 -27
- package/dist/session/session-import.d.ts +10 -0
- package/dist/session/session-manager.d.ts +3 -1
- package/dist/session/session-materializer.d.ts +15 -0
- package/dist/session/session-store.d.ts +45 -0
- package/dist/session/transcript-mirror.d.ts +25 -0
- package/dist/session/transcript-paths.d.ts +1 -2
- package/dist/types/auth.d.ts +27 -2
- package/dist/types/common.d.ts +1 -1
- package/dist/types/control.d.ts +13 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.d.ts +2 -3
- package/dist/types/mcp.d.ts +9 -3
- package/dist/types/messages.d.ts +21 -2
- package/dist/types/options.d.ts +50 -10
- package/dist/types/session.d.ts +17 -7
- package/dist/types/settings.d.ts +19 -232
- package/package.json +4 -14
- package/dist/bridge/bridge-api.d.ts +0 -14
- package/dist/bridge/bridge-session.d.ts +0 -6
- package/dist/bridge/ccr-client.d.ts +0 -72
- package/dist/bridge/index.d.ts +0 -9
- package/dist/bridge/index.js +0 -3
- package/dist/bridge/sse-transport.d.ts +0 -37
- package/dist/browser/browser-query.d.ts +0 -24
- package/dist/browser/index.d.ts +0 -14
- package/dist/browser/index.js +0 -9
- package/dist/browser/websocket-transport.d.ts +0 -40
- package/dist/direct-connect/direct-connect-transport.d.ts +0 -31
- package/dist/direct-connect/url-parser.d.ts +0 -14
- package/dist/embed/embed.d.ts +0 -2
- package/dist/embed/embed.js +0 -1
- package/dist/embed/extract-from-bunfs.d.ts +0 -5
- package/dist/types/bridge.d.ts +0 -62
- package/dist/types/browser.d.ts +0 -26
|
@@ -46,6 +46,12 @@ export type SdkMcpToolDefinition<Schema extends AnyZodRawShape = AnyZodRawShape>
|
|
|
46
46
|
* stripped at the protocol boundary.
|
|
47
47
|
*/
|
|
48
48
|
annotations?: ToolAnnotations;
|
|
49
|
+
/** Optional model-facing name. Requires `alwaysLoad: true`. */
|
|
50
|
+
exposedName?: string;
|
|
51
|
+
/** Keep this tool directly available when MCP lazy loading is enabled. */
|
|
52
|
+
alwaysLoad?: boolean;
|
|
53
|
+
/** Optional default permission policy for this MCP tool. */
|
|
54
|
+
permissionPolicy?: 'always_allow' | 'always_ask' | 'always_deny';
|
|
49
55
|
/** Async handler invoked when the tool is called. */
|
|
50
56
|
handler: (args: InferShape<Schema>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => Promise<CallToolResult>;
|
|
51
57
|
};
|
|
@@ -65,7 +71,7 @@ export type CreateSdkMcpServerOptions = {
|
|
|
65
71
|
* SDK's `mcpServers` option.
|
|
66
72
|
*
|
|
67
73
|
* NOTE: this factory does **not** call `instance.connect(transport)` itself
|
|
68
|
-
* — that wiring lives in `query.ts
|
|
74
|
+
* — that wiring lives in `query.ts`, where the
|
|
69
75
|
* per-query SdkMcpTransport (with its `sendMcpMessage` callback bound to
|
|
70
76
|
* the query's pending-response map) is constructed. Adding a transport
|
|
71
77
|
* here would either be wrong (no callback to bind to) or would force every
|
|
@@ -92,6 +98,12 @@ export type ToolExtras = {
|
|
|
92
98
|
* `SdkMcpToolDefinition.annotations` for the full coverage matrix.
|
|
93
99
|
*/
|
|
94
100
|
annotations?: ToolAnnotations;
|
|
101
|
+
/** Optional model-facing name. Requires `alwaysLoad: true`. */
|
|
102
|
+
exposedName?: string;
|
|
103
|
+
/** Keep this tool directly available when MCP lazy loading is enabled. */
|
|
104
|
+
alwaysLoad?: boolean;
|
|
105
|
+
/** Optional default permission policy for this tool. */
|
|
106
|
+
permissionPolicy?: 'always_allow' | 'always_ask' | 'always_deny';
|
|
95
107
|
};
|
|
96
108
|
/**
|
|
97
109
|
* Helper to define a single tool for use with `createSdkMcpServer`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { McpServerConfig, McpServerConfigForProcessTransport, McpServerToolPolicy } from '../types/mcp.js';
|
|
2
|
+
import type { McpServerConfigForCliTransport, McpToolRuntimeOverride } from '../protocol/mcp.js';
|
|
3
|
+
export declare function validateMcpToolExtension(serverName: string, policy: McpServerToolPolicy): void;
|
|
4
|
+
export declare function collectMcpToolOverrides(serverName: string, policies: McpServerToolPolicy[]): Record<string, McpToolRuntimeOverride> | undefined;
|
|
5
|
+
export declare function normalizeMcpServerForCli(serverName: string, config: McpServerConfigForProcessTransport, policies?: McpServerToolPolicy[]): McpServerConfigForCliTransport;
|
|
6
|
+
export declare function normalizeRuntimeMcpServersForCli(servers: Record<string, McpServerConfig>): Record<string, McpServerConfigForCliTransport>;
|
|
@@ -17,12 +17,9 @@ export type AgentDefinition = {
|
|
|
17
17
|
prompt: string;
|
|
18
18
|
model?: string;
|
|
19
19
|
mcpServers?: AgentMcpServerSpec[];
|
|
20
|
-
criticalSystemReminder_EXPERIMENTAL?: string;
|
|
21
20
|
skills?: string[];
|
|
22
21
|
initialPrompt?: string;
|
|
23
22
|
maxTurns?: number;
|
|
24
|
-
background?: boolean;
|
|
25
|
-
memory?: 'user' | 'project' | 'local';
|
|
26
23
|
effort?: EffortLevel;
|
|
27
24
|
permissionMode?: PermissionMode;
|
|
28
25
|
};
|
|
@@ -43,6 +43,12 @@ export type BetaUsage = {
|
|
|
43
43
|
} | null;
|
|
44
44
|
service_tier?: string | null;
|
|
45
45
|
speed?: string | null;
|
|
46
|
+
/** Qoder request-level metering value after discounts. */
|
|
47
|
+
credits?: number;
|
|
48
|
+
/** Qoder request-level metering value before discounts. */
|
|
49
|
+
original_credits?: number;
|
|
50
|
+
/** Whether the request contributes to the user's billed usage. */
|
|
51
|
+
billable?: boolean;
|
|
46
52
|
};
|
|
47
53
|
export type BetaMessage = {
|
|
48
54
|
id?: string;
|
|
@@ -102,6 +108,12 @@ export type NonNullableUsage = {
|
|
|
102
108
|
request_id?: string;
|
|
103
109
|
/** Context window usage ratio for the completed turn (0~1). */
|
|
104
110
|
context_usage_ratio?: number;
|
|
111
|
+
/** Qoder request-level metering value after discounts. */
|
|
112
|
+
credits?: number;
|
|
113
|
+
/** Qoder request-level metering value before discounts. */
|
|
114
|
+
original_credits?: number;
|
|
115
|
+
/** Whether the request contributes to the user's billed usage. */
|
|
116
|
+
billable?: boolean;
|
|
105
117
|
};
|
|
106
118
|
export type AccountInfo = {
|
|
107
119
|
userId?: string;
|
|
@@ -132,6 +144,12 @@ export type UsageOrgResourcePackage = {
|
|
|
132
144
|
available?: boolean;
|
|
133
145
|
unit?: string;
|
|
134
146
|
};
|
|
147
|
+
export type SessionCreditsUsage = {
|
|
148
|
+
total_credits: number;
|
|
149
|
+
model_usage: Record<string, {
|
|
150
|
+
credits: number;
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
135
153
|
export type UsageInfo = {
|
|
136
154
|
userId?: string;
|
|
137
155
|
userType?: string;
|
|
@@ -144,6 +162,13 @@ export type UsageInfo = {
|
|
|
144
162
|
isQuotaExceeded?: boolean;
|
|
145
163
|
isPlanQuotaProrated?: boolean;
|
|
146
164
|
orgResourcePackage?: UsageOrgResourcePackage;
|
|
165
|
+
/**
|
|
166
|
+
* Credits consumed by the current CLI session.
|
|
167
|
+
*
|
|
168
|
+
* This is independent from the account quota fields above and may be present
|
|
169
|
+
* even when the account quota endpoint is unavailable.
|
|
170
|
+
*/
|
|
171
|
+
session?: SessionCreditsUsage;
|
|
147
172
|
};
|
|
148
173
|
export type ApiKeySource = 'none' | 'user' | 'project' | 'org' | 'temporary' | 'oauth';
|
|
149
174
|
export type ExitReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'other' | 'bypass_permissions_disabled';
|
|
@@ -164,15 +189,6 @@ export type ThinkingDisabled = {
|
|
|
164
189
|
type: 'disabled';
|
|
165
190
|
};
|
|
166
191
|
export type ThinkingConfig = ThinkingAdaptive | ThinkingEnabled | ThinkingDisabled;
|
|
167
|
-
export type OutputFormatType = 'json_schema';
|
|
168
|
-
export type JsonSchemaOutputFormat = {
|
|
169
|
-
type: 'json_schema';
|
|
170
|
-
schema: Record<string, unknown>;
|
|
171
|
-
};
|
|
172
|
-
export type OutputFormat = JsonSchemaOutputFormat;
|
|
173
|
-
export type BaseOutputFormat = {
|
|
174
|
-
type: OutputFormatType;
|
|
175
|
-
};
|
|
176
192
|
export type ModelContextWindowEntry = {
|
|
177
193
|
token_count: number;
|
|
178
194
|
is_default?: boolean;
|
|
@@ -345,6 +361,8 @@ export type ModelUsage = {
|
|
|
345
361
|
cacheCreationInputTokens: number;
|
|
346
362
|
webSearchRequests: number;
|
|
347
363
|
costUSD: number;
|
|
364
|
+
/** Session-cumulative Qoder credits attributed to this model. */
|
|
365
|
+
credits?: number;
|
|
348
366
|
contextWindow: number;
|
|
349
367
|
maxOutputTokens: number;
|
|
350
368
|
};
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
15
15
|
import type { HookEvent, HookInput } from './hooks.js';
|
|
16
|
-
import type { McpServerStatus, McpSetServersResult,
|
|
16
|
+
import type { McpServerStatus, McpSetServersResult, McpServerConfigForCliTransport, McpToolRuntimeOverride, OAuthToken } from './mcp.js';
|
|
17
17
|
import type { PermissionMode, PermissionUpdate } from './permissions.js';
|
|
18
18
|
import type { SDKMessage } from './messages.js';
|
|
19
19
|
import type { AgentDefinition, AgentInfo } from './agents.js';
|
|
20
|
-
import type { AccountInfo, FastModeState, ModelInfo, SlashCommand, SdkPluginConfig, UsageInfo } from './common.js';
|
|
20
|
+
import type { AccountInfo, FastModeState, ModelInfo, SessionCreditsUsage, SlashCommand, SdkPluginConfig, UsageInfo } from './common.js';
|
|
21
21
|
import type { PluginDetails } from '../types/plugins.js';
|
|
22
|
+
import type { ModelPromptPatches } from './model-prompt-patches.js';
|
|
22
23
|
export type SDKControlRequest = {
|
|
23
24
|
type: 'control_request';
|
|
24
25
|
request_id: string;
|
|
@@ -46,6 +47,23 @@ export type SDKControlCancelRequest = {
|
|
|
46
47
|
};
|
|
47
48
|
export type SDKControlInterruptRequest = {
|
|
48
49
|
type: 'interrupt';
|
|
50
|
+
/**
|
|
51
|
+
* Cancel queued main-thread commands together with the active turn.
|
|
52
|
+
*
|
|
53
|
+
* This field requires the CLI capability
|
|
54
|
+
* `interrupt_cancel_queued_v1`.
|
|
55
|
+
*/
|
|
56
|
+
cancel_queued?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type SDKControlInterruptResponse = {
|
|
59
|
+
/**
|
|
60
|
+
* UUIDs of queued messages that survive the interrupt and may still run.
|
|
61
|
+
*/
|
|
62
|
+
still_queued: string[];
|
|
63
|
+
/**
|
|
64
|
+
* UUIDs cancelled by an interrupt request with `cancel_queued: true`.
|
|
65
|
+
*/
|
|
66
|
+
cancelled?: string[];
|
|
49
67
|
};
|
|
50
68
|
export type SDKControlPermissionDecisionReasonType = 'rule' | 'mode' | 'subcommandResults' | 'permissionPromptTool' | 'hook' | 'asyncAgent' | 'workingDir' | 'safetyCheck' | 'classifier' | 'other';
|
|
51
69
|
export type SDKControlPermissionRequest = {
|
|
@@ -71,7 +89,7 @@ export type SDKControlPermissionRequest = {
|
|
|
71
89
|
* (just `{ type: 'sdk', name }`) on the wire and registers the instance
|
|
72
90
|
* locally.
|
|
73
91
|
*/
|
|
74
|
-
export type ControlMcpServerConfig =
|
|
92
|
+
export type ControlMcpServerConfig = McpServerConfigForCliTransport;
|
|
75
93
|
export type SDKControlInitializeRequest = {
|
|
76
94
|
type: 'initialize';
|
|
77
95
|
model?: string;
|
|
@@ -84,12 +102,13 @@ export type SDKControlInitializeRequest = {
|
|
|
84
102
|
plugins?: SdkPluginConfig[];
|
|
85
103
|
systemPrompt?: string;
|
|
86
104
|
appendSystemPrompt?: string;
|
|
105
|
+
modelRequestPatches?: ModelPromptPatches;
|
|
87
106
|
excludeDynamicSections?: boolean;
|
|
88
107
|
permissionMode?: PermissionMode;
|
|
89
108
|
maxThinkingTokens?: number;
|
|
90
109
|
enableFileCheckpointing?: boolean;
|
|
91
110
|
sdkMcpServers?: string[];
|
|
92
|
-
|
|
111
|
+
sdkMcpToolOverrides?: Record<string, Record<string, McpToolRuntimeOverride>>;
|
|
93
112
|
promptSuggestions?: boolean;
|
|
94
113
|
supportsCatalogReadyInitialize?: boolean;
|
|
95
114
|
initializeTimeoutMs?: number;
|
|
@@ -228,6 +247,10 @@ export type SDKControlGetUsageInfoRequest = {
|
|
|
228
247
|
};
|
|
229
248
|
export type SDKControlGetUsageInfoResponse = {
|
|
230
249
|
usage: UsageInfo | null;
|
|
250
|
+
/** Session-local credits, independent from account quota availability. */
|
|
251
|
+
session?: SessionCreditsUsage;
|
|
252
|
+
/** Account quota lookup failure; session credits may still be available. */
|
|
253
|
+
usage_error?: string;
|
|
231
254
|
};
|
|
232
255
|
export type SDKControlAccountInfoRequest = {
|
|
233
256
|
type: 'account_info';
|
|
@@ -259,8 +282,8 @@ export type SDKControlRewindFilesRequest = {
|
|
|
259
282
|
dry_run?: boolean;
|
|
260
283
|
};
|
|
261
284
|
export type SDKControlCancelAsyncMessageRequest = {
|
|
262
|
-
|
|
263
|
-
|
|
285
|
+
subtype: 'cancel_async_message';
|
|
286
|
+
message_uuid: string;
|
|
264
287
|
};
|
|
265
288
|
export type SDKControlSeedReadStateRequest = {
|
|
266
289
|
type: 'seed_read_state';
|
|
@@ -308,10 +331,6 @@ export type SDKControlElicitationRequest = {
|
|
|
308
331
|
options?: string[];
|
|
309
332
|
tool_use_id?: string;
|
|
310
333
|
};
|
|
311
|
-
export type SDKControlStopTaskRequest = {
|
|
312
|
-
type: 'stop_task';
|
|
313
|
-
task_id: string;
|
|
314
|
-
};
|
|
315
334
|
export type SDKControlEndSessionRequest = {
|
|
316
335
|
type: 'end_session';
|
|
317
336
|
reason?: string;
|
|
@@ -453,7 +472,7 @@ export type SDKControlListPluginsRequest = {
|
|
|
453
472
|
export type SDKControlListPluginsResponse = {
|
|
454
473
|
plugins: PluginDetails[];
|
|
455
474
|
};
|
|
456
|
-
export type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetProxyRequest | SDKControlGenerateSessionTitleRequest | SDKControlAddDirectoriesRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetUsageInfoRequest | SDKControlGetModelPolicyRequest | SDKControlAccountInfoRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlReloadPluginsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest |
|
|
475
|
+
export type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetProxyRequest | SDKControlGenerateSessionTitleRequest | SDKControlAddDirectoriesRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetUsageInfoRequest | SDKControlGetModelPolicyRequest | SDKControlAccountInfoRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlReloadPluginsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest | SDKControlEndSessionRequest | SDKControlChannelEnableRequest | SDKControlMcpInjectTokenRequest | SDKControlMcpAuthenticateRequest | SDKControlMcpOAuthCallbackUrlRequest | SDKControlMcpClearAuthRequest | SDKControlGetByokConfigRequest | SDKControlValidateByokModelRequest | SDKControlListPluginsRequest;
|
|
457
476
|
export type SDKControlInitializeResponse = {
|
|
458
477
|
commands: SlashCommand[];
|
|
459
478
|
agents: AgentInfo[];
|
|
@@ -579,5 +598,14 @@ export type SDKControlMcpAuthenticateResponse = {
|
|
|
579
598
|
export type SDKKeepAliveMessage = {
|
|
580
599
|
type: 'keep_alive';
|
|
581
600
|
};
|
|
582
|
-
|
|
601
|
+
/** SDK-internal post-commit transcript frame emitted by local runtimes. */
|
|
602
|
+
export type TranscriptMirrorMessage = {
|
|
603
|
+
type: 'transcript_mirror';
|
|
604
|
+
filePath: string;
|
|
605
|
+
entries: Array<{
|
|
606
|
+
type: string;
|
|
607
|
+
[key: string]: unknown;
|
|
608
|
+
}>;
|
|
609
|
+
};
|
|
610
|
+
export type StdoutMessage = SDKMessage | SDKControlResponse | SDKControlRequest | SDKControlCancelRequest | SDKKeepAliveMessage | TranscriptMirrorMessage;
|
|
583
611
|
export {};
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
* `satisfies z.ZodType<X>`.
|
|
14
14
|
*/
|
|
15
15
|
export { WIRE_PROTOCOL_VERSION, type WireProtocolVersion } from './version.js';
|
|
16
|
-
export type {
|
|
16
|
+
export type { ModelPromptPatch, ModelPromptPatches, } from './model-prompt-patches.js';
|
|
17
|
+
export type { UUID, BetaMessage, BetaRawMessageStreamEvent, BetaUsage, BetaStopReason, MessageParam, NonNullableUsage, AccountInfo, UsageAddOnQuotaBucket, UsageInfo, UsageOrgResourcePackage, UsageQuotaBucket, SessionCreditsUsage, 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 './common.js';
|
|
17
18
|
export type { AICodeTrackingLaunchOptions, QoderAgentLaunchOptions, QoderCliFlagSettings, } from './launch.js';
|
|
18
19
|
export { buildQoderCliFlagSettings, buildQoderCliFlagSettingsArgs, } from './launch.js';
|
|
19
20
|
export type { PermissionMode, PermissionBehavior, PermissionDecisionClassification, PermissionUpdateDestination, PermissionRuleValue, PermissionUpdate, PermissionResult, } from './permissions.js';
|
|
20
21
|
export type { McpStdioServerConfig, McpSSEServerConfig, McpHttpServerConfig, McpSdkServerConfig, McpServerConfigForProcessTransport, McpServerStatus, McpServerStatusConfig, McpSetServersResult, OAuthToken, } from './mcp.js';
|
|
21
|
-
export type { SDKAssistantMessage, SDKUserMessage, SDKUserMessageReplay, SDKResultSuccess, SDKResultError, SDKResultMessage, SDKFileAttachment, SDKSystemMessage, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKStatusMessage, SDKAPIRetryMessage,
|
|
22
|
+
export type { SDKAssistantMessage, SDKUserMessage, SDKUserMessageReplay, SDKResultSuccess, SDKResultError, SDKResultMessage, SDKFileAttachment, SDKSystemMessage, SDKPartialAssistantMessage, SDKCompactBoundaryMessage, SDKStatusMessage, SDKAPIRetryMessage, SDKHookStartedMessage, SDKHookProgressMessage, SDKHookResponseMessage, SDKTaskNotificationMessage, SDKTaskStartedMessage, SDKTaskProgressMessage, SDKSessionStateChangedMessage, SDKSessionTitleChangedMessage, SDKFilesPersistedEvent, SDKElicitationCompleteMessage, SDKPromptSuggestionMessage, SDKCloudAgentEventMessage, SDKPermissionDenial, SDKPermissionDeniedMessage, SDKPermissionDeniedReasonType, SDKMessage, } from './messages.js';
|
|
22
23
|
export type { BaseHookInput, PreToolUseHookInput, PostToolUseHookInput, PostToolUseFailureHookInput, UserPromptSubmitHookInput, SessionStartHookInput, SessionEndHookInput, StopHookInput, StopFailureHookInput, SubagentStartHookInput, SubagentStopHookInput, PreCompactHookInput, PostCompactHookInput, PermissionRequestHookInput, PermissionDeniedHookInput, SetupHookInput, TeammateIdleHookInput, TaskCreatedHookInput, TaskCompletedHookInput, ElicitationHookInput, ElicitationResultHookInput, ConfigChangeHookInput, WorktreeCreateHookInput, WorktreeRemoveHookInput, InstructionsLoadedHookInput, CwdChangedHookInput, FileChangedHookInput, HookInput, PreToolUseHookSpecificOutput, PostToolUseHookSpecificOutput, PostToolUseFailureHookSpecificOutput, UserPromptSubmitHookSpecificOutput, SessionStartHookSpecificOutput, SetupHookSpecificOutput, SubagentStartHookSpecificOutput, PermissionRequestHookSpecificOutput, ElicitationHookSpecificOutput, ElicitationResultHookSpecificOutput, CwdChangedHookSpecificOutput, FileChangedHookSpecificOutput, WorktreeCreateHookSpecificOutput, SyncHookJSONOutput, AsyncHookJSONOutput, HookJSONOutput, HookEvent, } from './hooks.js';
|
|
23
24
|
export type { AgentMcpServerSpec, AgentDefinition, AgentInfo, } from './agents.js';
|
|
24
25
|
export { QoderModelPurpose } from './control.js';
|
|
25
|
-
export type { SDKControlRequest, SDKControlResponse, SDKControlCancelRequest, SDKControlInterruptRequest, SDKControlPermissionRequest, SDKControlInitializeRequest, SDKControlSetPermissionModeRequest, SDKControlSetModelRequest, SDKControlGenerateSessionTitleRequest, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesRequest, SDKControlAddDirectoriesResponse, SDKControlGetModelPolicyRequest, SDKControlGetModelPolicyResponse, SDKControlSetMaxThinkingTokensRequest, SDKControlMcpStatusRequest, SDKControlGetContextUsageRequest, SDKControlGetUsageInfoRequest, SDKControlGetUsageInfoResponse, SDKControlAccountInfoRequest, SDKHookCallbackRequest, SDKControlMcpMessageRequest, SDKControlRewindFilesRequest, SDKControlCancelAsyncMessageRequest, SDKControlSeedReadStateRequest, SDKControlMcpSetServersRequest, SDKControlReloadPluginsRequest, SDKControlMcpReconnectRequest, SDKControlMcpToggleRequest, SDKControlApplyFlagSettingsRequest, SDKControlGetSettingsRequest, SDKControlElicitationRequest,
|
|
26
|
+
export type { SDKControlRequest, SDKControlResponse, SDKControlCancelRequest, SDKControlInterruptRequest, SDKControlInterruptResponse, SDKControlPermissionRequest, SDKControlInitializeRequest, SDKControlSetPermissionModeRequest, SDKControlSetModelRequest, SDKControlGenerateSessionTitleRequest, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesRequest, SDKControlAddDirectoriesResponse, SDKControlGetModelPolicyRequest, SDKControlGetModelPolicyResponse, 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, SDKControlMcpStatusResponse, SDKControlMcpSetServersResponse, SDKControlMcpAuthenticateResponse, SDKControlGetByokConfigRequest, SDKControlGetByokConfigResponse, SDKControlValidateByokModelRequest, SDKControlValidateByokModelResponse, BYOKModelValidationInput, BYOKProviderInfo, BYOKFieldInfo, BYOKModelTypeInfo, BYOKModelInfo, CustomModel, SDKControlListPluginsRequest, SDKControlListPluginsResponse, SDKKeepAliveMessage, StdoutMessage, ControlMcpServerConfig, } from './control.js';
|
package/dist/protocol/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var r="1.
|
|
1
|
+
var r="1.1.0";function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function n(e={}){let t={...e.settings??{}},o=e.aiCodeTracking?.installGitCommitHook;if(o!==void 0){let s=t.aiCodeTracking;t.aiCodeTracking={...i(s)?s:{},installGitCommitHook:o}}return t}function l(e={}){let t=n(e);return Object.keys(t).length===0?[]:["--settings",JSON.stringify(t)]}var p={Main:"main",Plan:"plan",Task:"task",Compact:"compact",Title:"title",Suggestion:"suggestion",Generate:"generate",HookPrompt:"hook_prompt",Subagent:"subagent",WebFetch:"web_fetch",ImageGen:"image_gen",Compression:"compression",Utility:"utility"};export{p as QoderModelPurpose,r as WIRE_PROTOCOL_VERSION,n as buildQoderCliFlagSettings,l as buildQoderCliFlagSettingsArgs};
|
package/dist/protocol/mcp.d.ts
CHANGED
|
@@ -15,22 +15,51 @@ export type McpStdioServerConfig = {
|
|
|
15
15
|
command: string;
|
|
16
16
|
args?: string[];
|
|
17
17
|
env?: Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Per-server tool-call timeout in milliseconds. Overrides the
|
|
20
|
+
* MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock
|
|
21
|
+
* limit per call; progress notifications do not extend it. Values below
|
|
22
|
+
* 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default).
|
|
23
|
+
*/
|
|
24
|
+
timeout?: number;
|
|
18
25
|
};
|
|
19
26
|
export type McpSSEServerConfig = {
|
|
20
27
|
type: 'sse';
|
|
21
28
|
url: string;
|
|
22
29
|
headers?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Per-server tool-call timeout in milliseconds. Overrides the
|
|
32
|
+
* MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock
|
|
33
|
+
* limit per call; progress notifications do not extend it. Values below
|
|
34
|
+
* 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default).
|
|
35
|
+
*/
|
|
36
|
+
timeout?: number;
|
|
23
37
|
};
|
|
24
38
|
export type McpHttpServerConfig = {
|
|
25
39
|
type: 'http';
|
|
26
40
|
url: string;
|
|
27
41
|
headers?: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Per-server tool-call timeout in milliseconds. Overrides the
|
|
44
|
+
* MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock
|
|
45
|
+
* limit per call; progress notifications do not extend it. Values below
|
|
46
|
+
* 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default).
|
|
47
|
+
*/
|
|
48
|
+
timeout?: number;
|
|
28
49
|
};
|
|
29
50
|
export type McpSdkServerConfig = {
|
|
30
51
|
type: 'sdk';
|
|
31
52
|
name: string;
|
|
32
53
|
};
|
|
54
|
+
export type McpToolRuntimeOverride = {
|
|
55
|
+
exposedName?: string;
|
|
56
|
+
alwaysLoad?: boolean;
|
|
57
|
+
};
|
|
33
58
|
export type McpServerConfigForProcessTransport = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfig;
|
|
59
|
+
/** Internal SDK -> CLI wire shape after public tool policies are normalized. */
|
|
60
|
+
export type McpServerConfigForCliTransport = McpServerConfigForProcessTransport & {
|
|
61
|
+
toolOverrides?: Record<string, McpToolRuntimeOverride>;
|
|
62
|
+
};
|
|
34
63
|
export type McpServerStatus = {
|
|
35
64
|
name: string;
|
|
36
65
|
status: 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled';
|
|
@@ -18,6 +18,11 @@ export type SDKAssistantMessage = {
|
|
|
18
18
|
message: BetaMessage;
|
|
19
19
|
parent_tool_use_id: string | null;
|
|
20
20
|
error?: SDKAssistantMessageError;
|
|
21
|
+
/**
|
|
22
|
+
* Present when an interrupt truncated the model stream before a stop reason
|
|
23
|
+
* arrived. The final content block may end mid-token.
|
|
24
|
+
*/
|
|
25
|
+
aborted?: true;
|
|
21
26
|
uuid: UUID;
|
|
22
27
|
session_id: string;
|
|
23
28
|
};
|
|
@@ -28,7 +33,17 @@ export type SDKUserMessage = {
|
|
|
28
33
|
file_attachments?: SDKFileAttachment[];
|
|
29
34
|
isSynthetic?: boolean;
|
|
30
35
|
tool_use_result?: unknown;
|
|
36
|
+
/**
|
|
37
|
+
* Delivery priority. `next` is the default; `now` interrupts the active
|
|
38
|
+
* turn, while `later` waits for the session to become idle.
|
|
39
|
+
*/
|
|
31
40
|
priority?: 'now' | 'next' | 'later';
|
|
41
|
+
/**
|
|
42
|
+
* When false, do not start an assistant turn while the session is idle.
|
|
43
|
+
* Delivery still follows `priority`: `next` can inject at a safe boundary,
|
|
44
|
+
* `later` waits for idle, and `now` interrupts the active turn.
|
|
45
|
+
*/
|
|
46
|
+
shouldQuery?: boolean;
|
|
32
47
|
timestamp?: string;
|
|
33
48
|
uuid?: UUID;
|
|
34
49
|
session_id?: string;
|
|
@@ -40,7 +55,17 @@ export type SDKUserMessageReplay = {
|
|
|
40
55
|
file_attachments?: SDKFileAttachment[];
|
|
41
56
|
isSynthetic?: boolean;
|
|
42
57
|
tool_use_result?: unknown;
|
|
58
|
+
/**
|
|
59
|
+
* Delivery priority. `next` is the default; `now` interrupts the active
|
|
60
|
+
* turn, while `later` waits for the session to become idle.
|
|
61
|
+
*/
|
|
43
62
|
priority?: 'now' | 'next' | 'later';
|
|
63
|
+
/**
|
|
64
|
+
* When false, do not start an assistant turn while the session is idle.
|
|
65
|
+
* Delivery still follows `priority`: `next` can inject at a safe boundary,
|
|
66
|
+
* `later` waits for idle, and `now` interrupts the active turn.
|
|
67
|
+
*/
|
|
68
|
+
shouldQuery?: boolean;
|
|
44
69
|
timestamp?: string;
|
|
45
70
|
uuid: UUID;
|
|
46
71
|
session_id: string;
|
|
@@ -56,11 +81,12 @@ export type SDKResultSuccess = {
|
|
|
56
81
|
result: string;
|
|
57
82
|
stop_reason: string | null;
|
|
58
83
|
total_cost_usd: number;
|
|
84
|
+
/** Session-cumulative Qoder credits. Added by newer CLI versions. */
|
|
85
|
+
total_credits?: number;
|
|
59
86
|
usage: NonNullableUsage;
|
|
60
87
|
modelUsage: Record<string, ModelUsage>;
|
|
61
88
|
permission_denials: SDKPermissionDenial[];
|
|
62
89
|
error_code?: number;
|
|
63
|
-
structured_output?: unknown;
|
|
64
90
|
deferred_tool_use?: unknown;
|
|
65
91
|
terminal_reason?: string | null;
|
|
66
92
|
fast_mode_state?: FastModeState;
|
|
@@ -69,13 +95,15 @@ export type SDKResultSuccess = {
|
|
|
69
95
|
};
|
|
70
96
|
export type SDKResultError = {
|
|
71
97
|
type: 'result';
|
|
72
|
-
subtype: 'error_during_execution' | 'error_max_turns' | 'error_max_budget_usd'
|
|
98
|
+
subtype: 'error_during_execution' | 'error_max_turns' | 'error_max_budget_usd';
|
|
73
99
|
duration_ms: number;
|
|
74
100
|
duration_api_ms: number;
|
|
75
101
|
is_error: boolean;
|
|
76
102
|
num_turns: number;
|
|
77
103
|
stop_reason: string | null;
|
|
78
104
|
total_cost_usd: number;
|
|
105
|
+
/** Session-cumulative Qoder credits. Added by newer CLI versions. */
|
|
106
|
+
total_credits?: number;
|
|
79
107
|
usage: NonNullableUsage;
|
|
80
108
|
modelUsage: Record<string, ModelUsage>;
|
|
81
109
|
permission_denials: SDKPermissionDenial[];
|
|
@@ -117,6 +145,13 @@ export type SDKSystemMessage = {
|
|
|
117
145
|
output_style: string;
|
|
118
146
|
skills: string[];
|
|
119
147
|
plugins: PluginInfo[];
|
|
148
|
+
/**
|
|
149
|
+
* Open protocol capability set advertised by the CLI.
|
|
150
|
+
*
|
|
151
|
+
* Consumers must check the capability required by each behavior and ignore
|
|
152
|
+
* unknown values.
|
|
153
|
+
*/
|
|
154
|
+
capabilities?: string[];
|
|
120
155
|
fast_mode_state?: FastModeState;
|
|
121
156
|
uuid: UUID;
|
|
122
157
|
session_id: string;
|
|
@@ -162,13 +197,6 @@ export type SDKAPIRetryMessage = {
|
|
|
162
197
|
uuid: UUID;
|
|
163
198
|
session_id: string;
|
|
164
199
|
};
|
|
165
|
-
export type SDKLocalCommandOutputMessage = {
|
|
166
|
-
type: 'system';
|
|
167
|
-
subtype: 'local_command_output';
|
|
168
|
-
content: string;
|
|
169
|
-
uuid: UUID;
|
|
170
|
-
session_id: string;
|
|
171
|
-
};
|
|
172
200
|
export type SDKHookStartedMessage = {
|
|
173
201
|
type: 'system';
|
|
174
202
|
subtype: 'hook_started';
|
|
@@ -268,14 +296,6 @@ export type SDKSessionTitleChangedMessage = {
|
|
|
268
296
|
uuid: UUID;
|
|
269
297
|
session_id: string;
|
|
270
298
|
};
|
|
271
|
-
export type SDKBridgeStateMessage = {
|
|
272
|
-
type: 'system';
|
|
273
|
-
subtype: 'bridge_state';
|
|
274
|
-
state: string;
|
|
275
|
-
detail?: string;
|
|
276
|
-
uuid: UUID;
|
|
277
|
-
session_id: string;
|
|
278
|
-
};
|
|
279
299
|
export type SDKFilesPersistedEvent = {
|
|
280
300
|
type: 'system';
|
|
281
301
|
subtype: 'files_persisted';
|
|
@@ -334,4 +354,4 @@ export type SDKPermissionDeniedMessage = {
|
|
|
334
354
|
decision_reason_type?: SDKPermissionDeniedReasonType;
|
|
335
355
|
decision_reason?: string;
|
|
336
356
|
};
|
|
337
|
-
export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPermissionDeniedMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKAPIRetryMessage |
|
|
357
|
+
export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPermissionDeniedMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage | SDKStatusMessage | SDKAPIRetryMessage | SDKHookStartedMessage | SDKHookProgressMessage | SDKHookResponseMessage | SDKTaskNotificationMessage | SDKTaskStartedMessage | SDKTaskProgressMessage | SDKSessionStateChangedMessage | SDKSessionTitleChangedMessage | SDKFilesPersistedEvent | SDKElicitationCompleteMessage | SDKPromptSuggestionMessage | SDKCloudAgentEventMessage;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A server-side patch applied to the system prompt after model routing.
|
|
8
|
+
*/
|
|
9
|
+
export type ModelPromptPatch = {
|
|
10
|
+
action: 'edit_system_prompt';
|
|
11
|
+
content: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Model routing key to the ordered prompt patches for that route.
|
|
15
|
+
*
|
|
16
|
+
* Route keys are opaque to the SDK and are forwarded without interpretation.
|
|
17
|
+
*/
|
|
18
|
+
export type ModelPromptPatches = Record<string, ModelPromptPatch[]>;
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* `system/init` JSONL message. The SDK validates it against the
|
|
22
22
|
* version it was built against using semver.
|
|
23
23
|
*/
|
|
24
|
-
export declare const WIRE_PROTOCOL_VERSION: "1.
|
|
24
|
+
export declare const WIRE_PROTOCOL_VERSION: "1.1.0";
|
|
25
25
|
export type WireProtocolVersion = string;
|
|
@@ -21,19 +21,22 @@
|
|
|
21
21
|
* 3. Implements all Query interface methods for the consumer.
|
|
22
22
|
*/
|
|
23
23
|
import type { DiagnosticsSink } from '../core/sdk-diagnostics.js';
|
|
24
|
+
import type { ModelPromptPatches } from '../protocol/model-prompt-patches.js';
|
|
24
25
|
import type { Transport } from '../core/transport.js';
|
|
25
26
|
import type { SDKMessage, SDKUserMessage } from '../types/messages.js';
|
|
26
27
|
import type { InternalQuery, OnElicitation } from '../types/options.js';
|
|
27
|
-
import type { FetchJobToken } from '../types/auth.js';
|
|
28
|
-
import type { SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse } from '../types/control.js';
|
|
28
|
+
import type { FetchJobToken, FetchServiceAccountToken } from '../types/auth.js';
|
|
29
|
+
import type { SDKControlInterruptResponse, SDKControlInitializeResponse, SDKControlGetContextUsageResponse, SDKControlGenerateSessionTitleResponse, SDKControlAddDirectoriesResponse, SDKControlReloadPluginsResponse } from '../types/control.js';
|
|
29
30
|
import type { PermissionMode, CanUseTool } from '../types/permissions.js';
|
|
30
31
|
import type { HookCallbackMatcher } from '../types/hooks.js';
|
|
31
32
|
import type { HookEvent as InternalHookEvent } from '../protocol/index.js';
|
|
32
33
|
import type { McpServerConfig, McpServerStatus, McpSetServersResult, OAuthToken } from '../types/mcp.js';
|
|
34
|
+
import type { McpToolRuntimeOverride } from '../protocol/mcp.js';
|
|
33
35
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
34
36
|
import type { SdkMcpTransport } from '../mcp/sdk-mcp-transport.js';
|
|
35
37
|
import { type PendingMcpResponse } from '../mcp/mcp-handler.js';
|
|
36
38
|
import type { AgentDefinition, AgentInfo } from '../types/agents.js';
|
|
39
|
+
import type { SessionStore, SessionStoreFlush } from '../session/session-store.js';
|
|
37
40
|
import type { PluginDetails } from '../types/plugins.js';
|
|
38
41
|
import type { ModelInfo, SlashCommand, AccountInfo, UsageInfo } from '../types/common.js';
|
|
39
42
|
import type { ModelPolicyProvider } from '../types/model-policy-provider.js';
|
|
@@ -42,7 +45,7 @@ import type { BYOKModelValidationInput, BYOKProviderInfo } from '../types/byok.j
|
|
|
42
45
|
type InitConfig = {
|
|
43
46
|
systemPrompt?: string;
|
|
44
47
|
appendSystemPrompt?: string;
|
|
45
|
-
|
|
48
|
+
modelRequestPatches?: ModelPromptPatches;
|
|
46
49
|
agents?: Record<string, AgentDefinition>;
|
|
47
50
|
skills?: string[];
|
|
48
51
|
promptSuggestions?: boolean;
|
|
@@ -60,18 +63,20 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
60
63
|
private readonly sdkMcpServers;
|
|
61
64
|
private readonly sdkMcpTransports;
|
|
62
65
|
private readonly pendingMcpResponses;
|
|
66
|
+
private readonly sdkMcpToolOverrides;
|
|
63
67
|
private readonly isSingleTurn;
|
|
64
68
|
private readonly canUseTool?;
|
|
65
69
|
private readonly abortController?;
|
|
66
|
-
private readonly jsonSchema?;
|
|
67
70
|
private readonly initConfig;
|
|
68
71
|
private readonly onElicitation?;
|
|
69
72
|
private readonly onAuthExpired?;
|
|
70
73
|
private readonly fetchJobToken?;
|
|
74
|
+
private readonly fetchServiceAccountToken?;
|
|
71
75
|
private readonly diagnostics?;
|
|
72
76
|
private readonly controlRequestTimeoutMs;
|
|
73
77
|
private readonly resolveModel?;
|
|
74
78
|
private readonly resolveModelTimeoutMs;
|
|
79
|
+
private readonly transcriptMirrorBatcher?;
|
|
75
80
|
private initResponse?;
|
|
76
81
|
private initializationPromise?;
|
|
77
82
|
private resultMessage?;
|
|
@@ -81,7 +86,7 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
81
86
|
private protocolHandshakeValidated;
|
|
82
87
|
private firstResultReceived;
|
|
83
88
|
private firstResultReceivedResolve?;
|
|
84
|
-
constructor(transport: Transport, isSingleTurn: boolean, canUseTool?: CanUseTool, hooks?: Partial<Record<InternalHookEvent, HookCallbackMatcher[]>>, abortController?: AbortController, sdkMcpServers?: Map<string, McpServer>,
|
|
89
|
+
constructor(transport: Transport, isSingleTurn: boolean, canUseTool?: CanUseTool, hooks?: Partial<Record<InternalHookEvent, HookCallbackMatcher[]>>, abortController?: AbortController, sdkMcpServers?: Map<string, McpServer>, initConfig?: InitConfig, onElicitation?: OnElicitation, diagnostics?: DiagnosticsSink, onAuthExpired?: () => void, controlRequestTimeoutMs?: number, sdkMcpTransports?: Map<string, SdkMcpTransport>, pendingMcpResponses?: Map<string, PendingMcpResponse>, fetchJobToken?: FetchJobToken, resolveModel?: ModelPolicyProvider, resolveModelTimeoutMs?: number, sessionStore?: SessionStore, sessionStoreFlush?: SessionStoreFlush, sdkMcpToolOverrides?: Record<string, Record<string, McpToolRuntimeOverride>>, fetchServiceAccountToken?: FetchServiceAccountToken);
|
|
85
90
|
private getRecord;
|
|
86
91
|
private normalizeLogPreview;
|
|
87
92
|
private extractMessagePreview;
|
|
@@ -103,6 +108,7 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
103
108
|
* this method finishes and signals the consumer queue.
|
|
104
109
|
*/
|
|
105
110
|
private readMessages;
|
|
111
|
+
private notifyAuthExpiredIfNeeded;
|
|
106
112
|
/**
|
|
107
113
|
* Send a control request to the CLI and wait for the response.
|
|
108
114
|
*
|
|
@@ -191,7 +197,11 @@ export declare class QueryRunner implements InternalQuery {
|
|
|
191
197
|
/**
|
|
192
198
|
* Interrupt the current operation.
|
|
193
199
|
*/
|
|
194
|
-
interrupt(): Promise<
|
|
200
|
+
interrupt(): Promise<SDKControlInterruptResponse | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* Drop a UUID-stamped async user message while it is still queued.
|
|
203
|
+
*/
|
|
204
|
+
cancelAsyncMessage(messageUuid: string): Promise<boolean>;
|
|
195
205
|
/**
|
|
196
206
|
* Set the permission mode.
|
|
197
207
|
*/
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import type { ForkSessionOptions, ForkSessionResult } from '../types/session.js';
|
|
2
2
|
/**
|
|
3
|
-
* Fork a session into a new independent session with
|
|
4
|
-
*
|
|
5
|
-
* Creates a copy of the source session's JSONL file with all UUIDs
|
|
6
|
-
* remapped to new values. This allows the forked session to diverge
|
|
7
|
-
* from the original without sharing message identifiers.
|
|
8
|
-
*
|
|
9
|
-
* Optional parameters:
|
|
10
|
-
* - `upToMessageId` — Only copy messages up to and including this message
|
|
11
|
-
* - `title` — Set a custom title on the forked session
|
|
12
|
-
* - `dir` — Restrict the session search to this working directory
|
|
13
|
-
*
|
|
14
|
-
* @param sessionId - The source session UUID to fork from
|
|
15
|
-
* @param options - Fork options
|
|
16
|
-
* @returns The new session's UUID
|
|
17
|
-
* @throws Error if the source session is not found
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* // Fork the entire session
|
|
22
|
-
* const { sessionId: newId } = await forkSession('abc-123');
|
|
23
|
-
*
|
|
24
|
-
* // Fork up to a specific message with a custom title
|
|
25
|
-
* const { sessionId } = await forkSession('abc-123', {
|
|
26
|
-
* upToMessageId: 'msg-456',
|
|
27
|
-
* title: 'Exploration branch',
|
|
28
|
-
* });
|
|
29
|
-
* ```
|
|
3
|
+
* Fork a session into a new independent session with remapped message IDs.
|
|
30
4
|
*/
|
|
31
5
|
export declare function forkSession(sessionId: string, options?: ForkSessionOptions): Promise<ForkSessionResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SessionStore } from './session-store.js';
|
|
2
|
+
export type ImportSessionToStoreOptions = {
|
|
3
|
+
dir?: string;
|
|
4
|
+
includeSubagents?: boolean;
|
|
5
|
+
batchSize?: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Replay a local transcript and its subagent files into a SessionStore.
|
|
9
|
+
*/
|
|
10
|
+
export declare function importSessionToStore(sessionId: string, store: SessionStore, options?: ImportSessionToStoreOptions): Promise<void>;
|
|
@@ -96,4 +96,6 @@ export declare function listSubagents(sessionId: string, options?: ListSubagents
|
|
|
96
96
|
* @param options.offset - Number of messages to skip
|
|
97
97
|
* @returns Array of session messages from the subagent
|
|
98
98
|
*/
|
|
99
|
-
export declare function getSubagentMessages(sessionId: string, agentId: string, options?: GetSubagentMessagesOptions): Promise<SessionMessage[]>;
|
|
99
|
+
export declare function getSubagentMessages(sessionId: string, agentId: string, options?: GetSubagentMessagesOptions): Promise<SessionMessage[]>;
|
|
100
|
+
/** Delete a session and all child transcripts from a local or external store. */
|
|
101
|
+
export declare function deleteSession(sessionId: string, options?: SessionMutationOptions): Promise<void>;
|