@code-yeongyu/senpi 2026.9.3 → 2026.9.4
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/CHANGELOG.md +75 -0
- package/dist/core/agent-session.d.ts +2 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +32 -29
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/dynamic-prompt/style.js +1 -1
- package/dist/core/dynamic-prompt/style.js.map +1 -1
- package/dist/core/dynamic-prompt/working-task.js +1 -1
- package/dist/core/dynamic-prompt/working-task.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js +7 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +11 -7
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +4 -8
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js +15 -18
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js +80 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts +18 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js +57 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js +13 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js +2 -23
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +2 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +30 -24
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +15 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +19 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +31 -13
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +8 -14
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js +23 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js +4 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +13 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts +11 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js +12 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -1
- package/dist/core/extensions/builtin/eval-only-routing.d.ts +10 -0
- package/dist/core/extensions/builtin/eval-only-routing.d.ts.map +1 -0
- package/dist/core/extensions/builtin/eval-only-routing.js +16 -0
- package/dist/core/extensions/builtin/eval-only-routing.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-account.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-account.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-account.js +115 -0
- package/dist/core/extensions/builtin/gpt-account.js.map +1 -0
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +2 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +1 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +1 -11
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +3 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +56 -43
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts +4 -15
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js +12 -21
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts +4 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js +16 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -5
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +1 -6
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +123 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +202 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.js +1 -2
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +60 -76
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +17 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +5 -2
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts +13 -2
- package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.js +18 -7
- package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts +34 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js +121 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts +2 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.js +6 -2
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +18 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +0 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +0 -6
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +2 -0
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +71 -12
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +5 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +5 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/login-prompts.d.ts +24 -0
- package/dist/modes/rpc/login-prompts.d.ts.map +1 -0
- package/dist/modes/rpc/login-prompts.js +44 -0
- package/dist/modes/rpc/login-prompts.js.map +1 -0
- package/dist/modes/rpc/media-placeholders.d.ts +49 -0
- package/dist/modes/rpc/media-placeholders.d.ts.map +1 -0
- package/dist/modes/rpc/media-placeholders.js +151 -0
- package/dist/modes/rpc/media-placeholders.js.map +1 -0
- package/dist/modes/rpc/multi-session-host.js +3 -0
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +11 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +23 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +1 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +2 -1
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-fanout.d.ts +13 -2
- package/dist/modes/rpc/session-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-fanout.js +36 -12
- package/dist/modes/rpc/session-event-fanout.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +3 -1
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +23 -13
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts +8 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.js +32 -9
- package/dist/modes/rpc/socket-event-fanout.js.map +1 -1
- package/docs/rpc.md +104 -0
- package/docs/settings.md +5 -27
- package/docs/windows.md +1 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.d.ts +18 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +155 -106
- package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +144 -83
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -32
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -36
- package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +2 -2
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +93 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +473 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +140 -93
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +38 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +17 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.d.ts +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.js +126 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +14 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +1 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js +40 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts +1 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +2 -16
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +16 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +40 -6
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +16 -16
|
@@ -11,7 +11,7 @@ import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
|
11
11
|
import type { UUID } from 'crypto';
|
|
12
12
|
import type { Writable } from 'stream';
|
|
13
13
|
import * as z from 'zod/v4';
|
|
14
|
-
import type { ZodRawShape } from 'zod';
|
|
14
|
+
import type { ZodRawShape } from 'zod/v3';
|
|
15
15
|
import type { ZodRawShape as ZodRawShape_2 } from 'zod/v4';
|
|
16
16
|
|
|
17
17
|
export declare class AbortError extends Error {
|
|
@@ -53,7 +53,7 @@ export declare type AgentDefinition = {
|
|
|
53
53
|
*/
|
|
54
54
|
prompt: string;
|
|
55
55
|
/**
|
|
56
|
-
* Model alias (e.g. 'fable', 'opus', 'sonnet', 'haiku') or full model ID (e.g. 'claude-fable-5').
|
|
56
|
+
* Model alias (e.g. 'fable', 'opus', 'sonnet', 'haiku') or full model ID (e.g. 'claude-fable-5'). 'inherit' uses the main model; if omitted, uses the default subagent model when one is configured, else the main model
|
|
57
57
|
*/
|
|
58
58
|
model?: string;
|
|
59
59
|
mcpServers?: AgentMcpServerSpec[];
|
|
@@ -112,7 +112,7 @@ export declare type AgentInfo = {
|
|
|
112
112
|
*/
|
|
113
113
|
description: string;
|
|
114
114
|
/**
|
|
115
|
-
* Model
|
|
115
|
+
* Model this agent uses: an alias or model ID, or 'inherit' for the parent's model. If omitted, uses the default subagent model when one is configured, else the parent's model
|
|
116
116
|
*/
|
|
117
117
|
model?: string;
|
|
118
118
|
};
|
|
@@ -395,6 +395,8 @@ declare namespace coreTypes {
|
|
|
395
395
|
PermissionUpdateDestination,
|
|
396
396
|
PermissionUpdate,
|
|
397
397
|
PostCompactHookInput,
|
|
398
|
+
PostModelSwitchHookInput,
|
|
399
|
+
PostModelSwitchHookSpecificOutput,
|
|
398
400
|
PostToolBatchHookInput,
|
|
399
401
|
PostToolBatchHookSpecificOutput,
|
|
400
402
|
PostToolBatchToolCall,
|
|
@@ -403,6 +405,8 @@ declare namespace coreTypes {
|
|
|
403
405
|
PostToolUseHookInput,
|
|
404
406
|
PostToolUseHookSpecificOutput,
|
|
405
407
|
PreCompactHookInput,
|
|
408
|
+
PreModelSwitchHookInput,
|
|
409
|
+
PreModelSwitchHookSpecificOutput,
|
|
406
410
|
PreToolUseHookInput,
|
|
407
411
|
PreToolUseHookSpecificOutput,
|
|
408
412
|
RewindFilesResult,
|
|
@@ -426,6 +430,7 @@ declare namespace coreTypes {
|
|
|
426
430
|
SDKHookStartedMessage,
|
|
427
431
|
SDKInformationalMessage,
|
|
428
432
|
SDKLocalCommandOutputMessage,
|
|
433
|
+
SDKMcpResourceLink,
|
|
429
434
|
SDKMemoryRecallMessage,
|
|
430
435
|
SDKMessageOrigin,
|
|
431
436
|
SDKMessage,
|
|
@@ -499,8 +504,9 @@ declare namespace coreTypes {
|
|
|
499
504
|
* Creates an MCP server instance that can be used with the SDK transport.
|
|
500
505
|
* This allows SDK users to define custom tools that run in the same process.
|
|
501
506
|
*
|
|
502
|
-
* Tool calls are bounded by the MCP tool-call timeout —
|
|
503
|
-
*
|
|
507
|
+
* Tool calls are bounded by the MCP tool-call timeout — `options.timeout`
|
|
508
|
+
* (ms) for this server, else the MCP_TOOL_TIMEOUT env var, effectively
|
|
509
|
+
* unbounded by default.
|
|
504
510
|
*/
|
|
505
511
|
export declare function createSdkMcpServer(_options: CreateSdkMcpServerOptions): McpSdkServerConfigWithInstance;
|
|
506
512
|
|
|
@@ -523,6 +529,15 @@ declare type CreateSdkMcpServerOptions = {
|
|
|
523
529
|
* works and is OR'd with this.
|
|
524
530
|
*/
|
|
525
531
|
alwaysLoad?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Per-server tool-call timeout in milliseconds. Overrides the
|
|
534
|
+
* MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock
|
|
535
|
+
* limit per call; progress notifications do not extend it. Values below
|
|
536
|
+
* 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default).
|
|
537
|
+
* Applies when the server is first registered; changing it for an
|
|
538
|
+
* already-registered server has no effect until it is removed and re-added.
|
|
539
|
+
*/
|
|
540
|
+
timeout?: number;
|
|
526
541
|
};
|
|
527
542
|
|
|
528
543
|
export declare type CwdChangedHookInput = BaseHookInput & {
|
|
@@ -836,7 +851,7 @@ export declare type GetSubagentMessagesOptions = {
|
|
|
836
851
|
sessionStore?: SessionStore;
|
|
837
852
|
};
|
|
838
853
|
|
|
839
|
-
export declare const HOOK_EVENTS: readonly ['PreToolUse', 'PostToolUse', 'PostToolUseFailure', 'PostToolBatch', 'Notification', 'UserPromptSubmit', 'UserPromptExpansion', 'SessionStart', 'SessionEnd', 'Stop', 'StopFailure', 'SubagentStart', 'SubagentStop', 'PreCompact', 'PostCompact', 'PermissionRequest', 'PermissionDenied', 'Setup', 'TeammateIdle', 'TaskCreated', 'TaskCompleted', 'Elicitation', 'ElicitationResult', 'ConfigChange', 'WorktreeCreate', 'WorktreeRemove', 'InstructionsLoaded', 'CwdChanged', 'FileChanged', 'DirectoryAdded', 'MessageDisplay'];
|
|
854
|
+
export declare const HOOK_EVENTS: readonly ['PreToolUse', 'PostToolUse', 'PostToolUseFailure', 'PostToolBatch', 'Notification', 'UserPromptSubmit', 'UserPromptExpansion', 'SessionStart', 'SessionEnd', 'Stop', 'StopFailure', 'SubagentStart', 'SubagentStop', 'PreCompact', 'PostCompact', 'PreModelSwitch', 'PostModelSwitch', 'PermissionRequest', 'PermissionDenied', 'Setup', 'TeammateIdle', 'TaskCreated', 'TaskCompleted', 'Elicitation', 'ElicitationResult', 'ConfigChange', 'WorktreeCreate', 'WorktreeRemove', 'InstructionsLoaded', 'CwdChanged', 'FileChanged', 'DirectoryAdded', 'MessageDisplay'];
|
|
840
855
|
|
|
841
856
|
/**
|
|
842
857
|
* Hook callback function for responding to events during execution.
|
|
@@ -855,9 +870,9 @@ export declare interface HookCallbackMatcher {
|
|
|
855
870
|
timeout?: number;
|
|
856
871
|
}
|
|
857
872
|
|
|
858
|
-
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'Notification' | 'UserPromptSubmit' | 'UserPromptExpansion' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PostCompact' | 'PermissionRequest' | 'PermissionDenied' | 'Setup' | 'TeammateIdle' | 'TaskCreated' | 'TaskCompleted' | 'Elicitation' | 'ElicitationResult' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'InstructionsLoaded' | 'CwdChanged' | 'FileChanged' | 'DirectoryAdded' | 'MessageDisplay';
|
|
873
|
+
export declare type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'Notification' | 'UserPromptSubmit' | 'UserPromptExpansion' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PostCompact' | 'PreModelSwitch' | 'PostModelSwitch' | 'PermissionRequest' | 'PermissionDenied' | 'Setup' | 'TeammateIdle' | 'TaskCreated' | 'TaskCompleted' | 'Elicitation' | 'ElicitationResult' | 'ConfigChange' | 'WorktreeCreate' | 'WorktreeRemove' | 'InstructionsLoaded' | 'CwdChanged' | 'FileChanged' | 'DirectoryAdded' | 'MessageDisplay';
|
|
859
874
|
|
|
860
|
-
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PostToolBatchHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput | DirectoryAddedHookInput | MessageDisplayHookInput;
|
|
875
|
+
export declare type HookInput = PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | PostToolBatchHookInput | PermissionDeniedHookInput | NotificationHookInput | UserPromptSubmitHookInput | UserPromptExpansionHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | StopFailureHookInput | SubagentStartHookInput | SubagentStopHookInput | PreCompactHookInput | PostCompactHookInput | PreModelSwitchHookInput | PostModelSwitchHookInput | PermissionRequestHookInput | SetupHookInput | TeammateIdleHookInput | TaskCreatedHookInput | TaskCompletedHookInput | ElicitationHookInput | ElicitationResultHookInput | ConfigChangeHookInput | InstructionsLoadedHookInput | WorktreeCreateHookInput | WorktreeRemoveHookInput | CwdChangedHookInput | FileChangedHookInput | DirectoryAddedHookInput | MessageDisplayHookInput;
|
|
861
876
|
|
|
862
877
|
export declare type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
|
|
863
878
|
|
|
@@ -1075,6 +1090,10 @@ export declare type McpHttpServerConfig = {
|
|
|
1075
1090
|
export declare type McpSdkServerConfig = {
|
|
1076
1091
|
type: 'sdk';
|
|
1077
1092
|
name: string;
|
|
1093
|
+
/**
|
|
1094
|
+
* Per-server tool-call timeout in milliseconds. Overrides the MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock limit per call; progress notifications do not extend it. Values below 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default). Applies when the server is first registered; changing it for an already-registered server has no effect until it is removed and re-added.
|
|
1095
|
+
*/
|
|
1096
|
+
timeout?: number;
|
|
1078
1097
|
};
|
|
1079
1098
|
|
|
1080
1099
|
/**
|
|
@@ -1288,6 +1307,10 @@ export declare type ModelInfo = {
|
|
|
1288
1307
|
export declare type ModelUsage = {
|
|
1289
1308
|
inputTokens: number;
|
|
1290
1309
|
outputTokens: number;
|
|
1310
|
+
/**
|
|
1311
|
+
* Thinking tokens, already counted inside outputTokens. Counts only turns run on CLI versions that record this field: absent when none did, and partial for a resumed session that began on an older version.
|
|
1312
|
+
*/
|
|
1313
|
+
thinkingTokens?: number;
|
|
1291
1314
|
cacheReadInputTokens: number;
|
|
1292
1315
|
cacheCreationInputTokens: number;
|
|
1293
1316
|
webSearchRequests: number;
|
|
@@ -1302,6 +1325,10 @@ export declare type ModelUsage = {
|
|
|
1302
1325
|
* API provider that served this model (e.g. 'firstParty', 'bedrock', 'vertex', 'foundry', 'anthropicAws', 'mantle', 'gateway').
|
|
1303
1326
|
*/
|
|
1304
1327
|
provider?: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* Which price table the most recent request for this model was priced at: Claude Code's built-in list prices ('list'), the organization's managed-settings modelPricing rates or multiplier ('managed'), or neither ('unknown' — no pricing row and no built-in price matched the model ID, so costUSD is a guess at the default model's rate). Overwritten per request like canonicalModel, so a consumer that differences the cumulative costUSD per turn gets that turn's basis. Absent until this process has priced a request for the model (e.g. right after --resume) and on builds that predate the field; treat as 'list'.
|
|
1330
|
+
*/
|
|
1331
|
+
costBasis?: 'list' | 'managed' | 'unknown';
|
|
1305
1332
|
};
|
|
1306
1333
|
|
|
1307
1334
|
export declare type NonNullableUsage = {
|
|
@@ -1623,6 +1650,26 @@ export declare type Options = {
|
|
|
1623
1650
|
* explicit declaration overrides).
|
|
1624
1651
|
*/
|
|
1625
1652
|
supportedDialogKinds?: string[];
|
|
1653
|
+
/**
|
|
1654
|
+
* Declares that this consumer renders a per-task stop control wired to
|
|
1655
|
+
* the `stop_task` control request, so the user can stop an individual
|
|
1656
|
+
* background task.
|
|
1657
|
+
*
|
|
1658
|
+
* When declared, an interrupt on an open-input (interactive
|
|
1659
|
+
* stream-json) session spares running background agents/workflows —
|
|
1660
|
+
* Stop only aborts the current turn, and tasks are stopped one at a
|
|
1661
|
+
* time through the consumer's own affordance. Closed-input exception:
|
|
1662
|
+
* on a one-shot run (the string `prompt` form and `-p`, which close
|
|
1663
|
+
* stdin), hold-back tasks are still killed when the held result is
|
|
1664
|
+
* released, regardless of this declaration — with stdin closed, a
|
|
1665
|
+
* `stop_task` control could never be delivered, so the fail-closed
|
|
1666
|
+
* kill stands. The CLI also fails closed on absence: without the
|
|
1667
|
+
* declaration, an interrupt kills background tasks, because a spared
|
|
1668
|
+
* runaway task would otherwise be unstoppable from this consumer short
|
|
1669
|
+
* of ending the session. First-attached-client
|
|
1670
|
+
* wins on multi-client sessions; later initializes do not change it.
|
|
1671
|
+
*/
|
|
1672
|
+
perTaskStopAffordance?: boolean;
|
|
1626
1673
|
/**
|
|
1627
1674
|
* When false, disables session persistence to disk. Sessions will not be
|
|
1628
1675
|
* saved to ~/.claude/projects/ and cannot be resumed later. Useful for
|
|
@@ -1801,6 +1848,15 @@ export declare type Options = {
|
|
|
1801
1848
|
* will be routed through this MCP tool instead of the default handler.
|
|
1802
1849
|
*/
|
|
1803
1850
|
permissionPromptToolName?: string;
|
|
1851
|
+
/**
|
|
1852
|
+
* Who answers permission prompts. `'host'` (default): this process, through
|
|
1853
|
+
* `canUseTool` or `permissionPromptToolName`. `'none'`: nobody — the
|
|
1854
|
+
* permission mode (including auto mode's classifier), rules and hooks still
|
|
1855
|
+
* decide, and anything that would otherwise prompt is denied immediately
|
|
1856
|
+
* with a message telling Claude the session has no approval surface;
|
|
1857
|
+
* `canUseTool` is never called.
|
|
1858
|
+
*/
|
|
1859
|
+
permissionPrompts?: 'host' | 'none';
|
|
1804
1860
|
/**
|
|
1805
1861
|
* Load plugins for this session. Plugins provide custom commands, agents,
|
|
1806
1862
|
* skills, and hooks that extend Claude Code's capabilities.
|
|
@@ -2092,7 +2148,7 @@ export declare type Options = {
|
|
|
2092
2148
|
*
|
|
2093
2149
|
* @example Custom prompt with cache boundary
|
|
2094
2150
|
* ```typescript
|
|
2095
|
-
* import { SYSTEM_PROMPT_DYNAMIC_BOUNDARY } from '@anthropic-ai/claude-
|
|
2151
|
+
* import { SYSTEM_PROMPT_DYNAMIC_BOUNDARY } from '@anthropic-ai/claude-agent-sdk'
|
|
2096
2152
|
* systemPrompt: [
|
|
2097
2153
|
* staticInstructions,
|
|
2098
2154
|
* SYSTEM_PROMPT_DYNAMIC_BOUNDARY,
|
|
@@ -2117,12 +2173,62 @@ export declare type Options = {
|
|
|
2117
2173
|
* excludeDynamicSections: true,
|
|
2118
2174
|
* }
|
|
2119
2175
|
* ```
|
|
2176
|
+
*
|
|
2177
|
+
* `snapshot` — whether the conversation's system prompt is recorded once (in
|
|
2178
|
+
* the session transcript) and reused verbatim on every later request and
|
|
2179
|
+
* `resume` / `continue`, instead of being rendered fresh each time.
|
|
2180
|
+
* **Recommended: `snapshot: true`.** A system prompt that changes
|
|
2181
|
+
* mid-conversation (a CLI upgrade between launches, a flag flip, a different
|
|
2182
|
+
* `append`) invalidates the prompt prefix and, with extended thinking,
|
|
2183
|
+
* discards the model's earlier reasoning; a recorded prompt cannot change
|
|
2184
|
+
* until the conversation is compacted. (It also keeps the API prompt-cache
|
|
2185
|
+
* prefix stable.)
|
|
2186
|
+
*
|
|
2187
|
+
* How it interacts with `append` (and a custom `prompt`):
|
|
2188
|
+
* - **Omitted (default):** passing an `append` or a custom prompt turns the
|
|
2189
|
+
* recording off, so your appended text is applied fresh on every launch —
|
|
2190
|
+
* today's behavior. Only the bare `claude_code` preset is recorded by
|
|
2191
|
+
* default.
|
|
2192
|
+
* - **`snapshot: true`:** if the conversation already has a recorded prompt,
|
|
2193
|
+
* that record is sent as-is (a different `append` or `prompt` passed on a
|
|
2194
|
+
* later launch of the same session is ignored until compaction or a new
|
|
2195
|
+
* session); otherwise Claude Code renders its prompt with your `append`
|
|
2196
|
+
* included, sends that, and records it for the rest of the conversation.
|
|
2197
|
+
* - **`snapshot: false`:** never record; render fresh every request.
|
|
2198
|
+
* A bare string / `string[]` prompt is always `false`; use
|
|
2199
|
+
* `{ type: 'custom', prompt, snapshot: true }` to opt a custom prompt in.
|
|
2200
|
+
* With a recorded prompt, a mid-session model switch or `set_settings`
|
|
2201
|
+
* agent/system-prompt change does not change the prompt either; it takes
|
|
2202
|
+
* effect at the next compaction or in a new session. System-prompt
|
|
2203
|
+
* recording is rolling out: where it is not yet enabled for the account
|
|
2204
|
+
* (and on Bedrock / Vertex / Foundry today) `snapshot` is accepted and has no
|
|
2205
|
+
* effect, so it is safe to set now.
|
|
2206
|
+
*
|
|
2207
|
+
* @example Recommended: preset with an append, recorded for the conversation
|
|
2208
|
+
* ```typescript
|
|
2209
|
+
* systemPrompt: {
|
|
2210
|
+
* type: 'preset',
|
|
2211
|
+
* preset: 'claude_code',
|
|
2212
|
+
* append: 'Always explain your reasoning.',
|
|
2213
|
+
* snapshot: true,
|
|
2214
|
+
* }
|
|
2215
|
+
* ```
|
|
2216
|
+
*
|
|
2217
|
+
* @example Custom prompt, recorded for the conversation
|
|
2218
|
+
* ```typescript
|
|
2219
|
+
* systemPrompt: { type: 'custom', prompt: 'You are a release bot.', snapshot: true }
|
|
2220
|
+
* ```
|
|
2120
2221
|
*/
|
|
2121
2222
|
systemPrompt?: string | string[] | {
|
|
2223
|
+
type: 'custom';
|
|
2224
|
+
prompt: string | string[];
|
|
2225
|
+
snapshot?: boolean;
|
|
2226
|
+
} | {
|
|
2122
2227
|
type: 'preset';
|
|
2123
2228
|
preset: 'claude_code';
|
|
2124
2229
|
append?: string;
|
|
2125
2230
|
excludeDynamicSections?: boolean;
|
|
2231
|
+
snapshot?: boolean;
|
|
2126
2232
|
};
|
|
2127
2233
|
/**
|
|
2128
2234
|
* Custom title for a new session. When provided, the session uses this title
|
|
@@ -2280,6 +2386,52 @@ export declare type PostCompactHookInput = BaseHookInput & {
|
|
|
2280
2386
|
compact_summary: string;
|
|
2281
2387
|
};
|
|
2282
2388
|
|
|
2389
|
+
export declare type PostModelSwitchHookInput = (BaseHookInput & {
|
|
2390
|
+
hook_event_name: 'PostModelSwitch';
|
|
2391
|
+
}) & {
|
|
2392
|
+
/**
|
|
2393
|
+
* Resolved model id the session was running before the switch
|
|
2394
|
+
*/
|
|
2395
|
+
from_model: string;
|
|
2396
|
+
/**
|
|
2397
|
+
* Resolved model id the session runs after the switch
|
|
2398
|
+
*/
|
|
2399
|
+
to_model: string;
|
|
2400
|
+
/**
|
|
2401
|
+
* What was asked for (alias such as "opus", a full id, or null for "default")
|
|
2402
|
+
*/
|
|
2403
|
+
requested_model: string | null;
|
|
2404
|
+
/**
|
|
2405
|
+
* command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE); auto: automatic fallback or other programmatic change; resume: model restored while resuming a session
|
|
2406
|
+
*/
|
|
2407
|
+
source: 'command' | 'picker' | 'sdk' | 'auto' | 'resume';
|
|
2408
|
+
/**
|
|
2409
|
+
* Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
2410
|
+
*/
|
|
2411
|
+
context_tokens: number;
|
|
2412
|
+
/**
|
|
2413
|
+
* Whether the current model's prompt cache is likely still warm (a switch then forfeits it)
|
|
2414
|
+
*/
|
|
2415
|
+
prompt_cache_warm: boolean;
|
|
2416
|
+
cache_ttl: '5m' | '1h';
|
|
2417
|
+
/**
|
|
2418
|
+
* Estimated cost of re-caching context_tokens on to_model at its cache-write rate — the managed modelPricing when set, otherwise list price; excludes the response
|
|
2419
|
+
*/
|
|
2420
|
+
estimated_cache_write_usd: number;
|
|
2421
|
+
/**
|
|
2422
|
+
* configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed
|
|
2423
|
+
*/
|
|
2424
|
+
pricing: 'configured' | 'catalog' | 'default';
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2427
|
+
export declare type PostModelSwitchHookSpecificOutput = {
|
|
2428
|
+
hookEventName: 'PostModelSwitch';
|
|
2429
|
+
/**
|
|
2430
|
+
* Reaches the model with the next request the new model serves
|
|
2431
|
+
*/
|
|
2432
|
+
additionalContext?: string;
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2283
2435
|
/**
|
|
2284
2436
|
* Hook input for the PostToolBatch event. Fired once after every tool call in a batch has resolved, before the next model request. PostToolUse fires per-tool and may run concurrently for parallel tool calls; PostToolBatch fires exactly once with the full batch.
|
|
2285
2437
|
*/
|
|
@@ -2353,6 +2505,53 @@ export declare type PreCompactHookInput = BaseHookInput & {
|
|
|
2353
2505
|
custom_instructions: string | null;
|
|
2354
2506
|
};
|
|
2355
2507
|
|
|
2508
|
+
export declare type PreModelSwitchHookInput = (BaseHookInput & {
|
|
2509
|
+
hook_event_name: 'PreModelSwitch';
|
|
2510
|
+
}) & {
|
|
2511
|
+
/**
|
|
2512
|
+
* Resolved model id the session was running before the switch
|
|
2513
|
+
*/
|
|
2514
|
+
from_model: string;
|
|
2515
|
+
/**
|
|
2516
|
+
* Resolved model id the session runs after the switch
|
|
2517
|
+
*/
|
|
2518
|
+
to_model: string;
|
|
2519
|
+
/**
|
|
2520
|
+
* What was asked for (alias such as "opus", a full id, or null for "default")
|
|
2521
|
+
*/
|
|
2522
|
+
requested_model: string | null;
|
|
2523
|
+
/**
|
|
2524
|
+
* command: /model <name>, the /config Model row, or enabling fast mode when that promotes the model; picker: an interactive model picker; sdk: headless set_model (SDK, Remote Control, IDE)
|
|
2525
|
+
*/
|
|
2526
|
+
source: 'command' | 'picker' | 'sdk';
|
|
2527
|
+
/**
|
|
2528
|
+
* Prompt tokens the next request re-sends: the last main-thread response's input + cache_read + cache_creation + output tokens (0 before the first response; for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
2529
|
+
*/
|
|
2530
|
+
context_tokens: number;
|
|
2531
|
+
/**
|
|
2532
|
+
* Whether the current model's prompt cache is likely still warm (a switch then forfeits it)
|
|
2533
|
+
*/
|
|
2534
|
+
prompt_cache_warm: boolean;
|
|
2535
|
+
cache_ttl: '5m' | '1h';
|
|
2536
|
+
/**
|
|
2537
|
+
* Estimated cost of re-caching context_tokens on to_model at its cache-write rate — the managed modelPricing when set, otherwise list price; excludes the response
|
|
2538
|
+
*/
|
|
2539
|
+
estimated_cache_write_usd: number;
|
|
2540
|
+
/**
|
|
2541
|
+
* configured: priced at the managed modelPricing setting; catalog: list price; default: to_model unknown, the default tier was assumed
|
|
2542
|
+
*/
|
|
2543
|
+
pricing: 'configured' | 'catalog' | 'default';
|
|
2544
|
+
};
|
|
2545
|
+
|
|
2546
|
+
export declare type PreModelSwitchHookSpecificOutput = {
|
|
2547
|
+
hookEventName: 'PreModelSwitch';
|
|
2548
|
+
/**
|
|
2549
|
+
* Same contract as PreToolUse: allow proceeds (skipping the interactive cache-miss confirm), deny cancels the switch, ask asks the user to confirm (a headless session refuses instead)
|
|
2550
|
+
*/
|
|
2551
|
+
permissionDecision?: 'allow' | 'deny' | 'ask';
|
|
2552
|
+
permissionDecisionReason?: string;
|
|
2553
|
+
};
|
|
2554
|
+
|
|
2356
2555
|
export declare type PreToolUseHookInput = BaseHookInput & {
|
|
2357
2556
|
hook_event_name: 'PreToolUse';
|
|
2358
2557
|
tool_name: string;
|
|
@@ -2481,6 +2680,17 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
2481
2680
|
applyFlagSettings(settings: {
|
|
2482
2681
|
[K in keyof Settings]?: K extends 'effortLevel' ? EffortLevel | null : Settings[K] | null;
|
|
2483
2682
|
}): Promise<void>;
|
|
2683
|
+
/**
|
|
2684
|
+
* Merge settings into a settings FILE through the CLI's own writer — the
|
|
2685
|
+
* same path /config uses (canonical store root, gitignore upkeep,
|
|
2686
|
+
* hardened write) — and live-apply them. Unlike applyFlagSettings, which
|
|
2687
|
+
* only touches the session-scoped flag layer. The handler accepts only an
|
|
2688
|
+
* explicit key allowlist (currently just outputStyle) with string values
|
|
2689
|
+
* — deletion is not supported — and refuses remote transports and
|
|
2690
|
+
* sessions whose --setting-sources exclude the target source. Rejects
|
|
2691
|
+
* with the gate's or writer's error otherwise.
|
|
2692
|
+
*/
|
|
2693
|
+
updateSettings(source: 'localSettings', settings: Record<string, unknown>): Promise<void>;
|
|
2484
2694
|
/**
|
|
2485
2695
|
* Get the full initialization result, including supported commands, models,
|
|
2486
2696
|
* account info, and output style configuration.
|
|
@@ -2542,9 +2752,15 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
2542
2752
|
* Get a breakdown of current context window usage by category
|
|
2543
2753
|
* (system prompt, tools, messages, MCP tools, memory files, etc.).
|
|
2544
2754
|
*
|
|
2755
|
+
* `detail: 'full'` counts each category with the token-count API;
|
|
2756
|
+
* `'summary'` answers from the last response's usage and local estimates
|
|
2757
|
+
* without the per-category token-count calls. Defaults to `'full'`.
|
|
2758
|
+
*
|
|
2545
2759
|
* @returns Context usage breakdown including token counts per category and total usage
|
|
2546
2760
|
*/
|
|
2547
|
-
getContextUsage(
|
|
2761
|
+
getContextUsage(opts?: {
|
|
2762
|
+
detail?: 'summary' | 'full';
|
|
2763
|
+
}): Promise<SDKControlGetContextUsageResponse>;
|
|
2548
2764
|
/**
|
|
2549
2765
|
* Get the structured data behind the `/usage` command: session cost and
|
|
2550
2766
|
* token usage totals plus claude.ai plan rate-limit utilization windows
|
|
@@ -2688,6 +2904,8 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
2688
2904
|
* @param toolUseId - Optional tool_use block id to target a single task
|
|
2689
2905
|
* @returns true when at least one task was backgrounded; false only
|
|
2690
2906
|
* when `toolUseId` was given and it matched no foreground task
|
|
2907
|
+
* @throws when background tasks are disabled for the session
|
|
2908
|
+
* (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`) — nothing is backgrounded
|
|
2691
2909
|
*/
|
|
2692
2910
|
backgroundTasks(toolUseId?: string): Promise<boolean>;
|
|
2693
2911
|
/**
|
|
@@ -2822,7 +3040,7 @@ export declare type RewindFilesResult = {
|
|
|
2822
3040
|
export declare type SandboxCredentialsConfig = NonNullable<z.infer<ReturnType<typeof SandboxCredentialsConfigSchema>>>;
|
|
2823
3041
|
|
|
2824
3042
|
declare const SandboxCredentialsConfigSchema: () => z.ZodOptional<z.ZodObject<{
|
|
2825
|
-
files: z.ZodOptional<z.ZodArray<z.
|
|
3043
|
+
files: z.ZodOptional<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
|
|
2826
3044
|
path: z.ZodString;
|
|
2827
3045
|
mode: z.ZodEnum<{
|
|
2828
3046
|
deny: "deny";
|
|
@@ -2841,7 +3059,7 @@ declare const SandboxCredentialsConfigSchema: () => z.ZodOptional<z.ZodObject<{
|
|
|
2841
3059
|
maskDuplicates: z.ZodOptional<z.ZodBoolean>;
|
|
2842
3060
|
injectHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2843
3061
|
}, z.core.$strip>>>>;
|
|
2844
|
-
envVars: z.ZodOptional<z.ZodArray<z.
|
|
3062
|
+
envVars: z.ZodOptional<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
|
|
2845
3063
|
name: z.ZodString;
|
|
2846
3064
|
mode: z.ZodEnum<{
|
|
2847
3065
|
deny: "deny";
|
|
@@ -2954,7 +3172,7 @@ declare const SandboxSettingsSchema: () => z.ZodObject<{
|
|
|
2954
3172
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
2955
3173
|
}, z.core.$strip>>;
|
|
2956
3174
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
2957
|
-
files: z.ZodOptional<z.ZodArray<z.
|
|
3175
|
+
files: z.ZodOptional<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
|
|
2958
3176
|
path: z.ZodString;
|
|
2959
3177
|
mode: z.ZodEnum<{
|
|
2960
3178
|
deny: "deny";
|
|
@@ -2973,7 +3191,7 @@ declare const SandboxSettingsSchema: () => z.ZodObject<{
|
|
|
2973
3191
|
maskDuplicates: z.ZodOptional<z.ZodBoolean>;
|
|
2974
3192
|
injectHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2975
3193
|
}, z.core.$strip>>>>;
|
|
2976
|
-
envVars: z.ZodOptional<z.ZodArray<z.
|
|
3194
|
+
envVars: z.ZodOptional<z.ZodArray<z.ZodPreprocess<z.ZodObject<{
|
|
2977
3195
|
name: z.ZodString;
|
|
2978
3196
|
mode: z.ZodEnum<{
|
|
2979
3197
|
deny: "deny";
|
|
@@ -3021,8 +3239,8 @@ declare const SandboxSettingsSchema: () => z.ZodObject<{
|
|
|
3021
3239
|
command: z.ZodString;
|
|
3022
3240
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3023
3241
|
}, z.core.$strip>>;
|
|
3024
|
-
bwrapPath: z.ZodCatch<z.ZodOptional<z.
|
|
3025
|
-
socatPath: z.ZodCatch<z.ZodOptional<z.
|
|
3242
|
+
bwrapPath: z.ZodCatch<z.ZodOptional<z.ZodPreprocess<z.ZodString>>>;
|
|
3243
|
+
socatPath: z.ZodCatch<z.ZodOptional<z.ZodPreprocess<z.ZodString>>>;
|
|
3026
3244
|
}, z.core.$loose>;
|
|
3027
3245
|
|
|
3028
3246
|
/**
|
|
@@ -3070,6 +3288,14 @@ export declare type SDKAssistantMessage = {
|
|
|
3070
3288
|
uuid: UUID;
|
|
3071
3289
|
session_id: string;
|
|
3072
3290
|
request_id?: string;
|
|
3291
|
+
/**
|
|
3292
|
+
* Client uuid of the user message that triggered this turn (submitMessage options.uuid), stamped on the turn's FIRST reply frame only — the first assistant message in complete-message mode; with --include-partial-messages the stamp normally rides the first non-ping stream event instead (see SDKPartialAssistantMessage), and a turn that produces no stream events still stamps its first assistant message — so a consumer can bind the reply to the send it answers without waiting for the result. Wrapper-level sibling — never inside `message.content` — so it is not replayed to the model. Absent on every later frame of the turn, on subagent frames (parent_tool_use_id set), on synthetic/scheduled (meta) turns, on turns without a client uuid, and from older producers.
|
|
3293
|
+
*/
|
|
3294
|
+
user_message_uuid?: string;
|
|
3295
|
+
/**
|
|
3296
|
+
* Client uuids of every user message whose prompt this turn has consumed so far, in consumption order — all members of a prompt batch the host merged into this one turn (several messages sent close together run as one turn whose user_message_uuid is the LAST member's), so a consumer that sent any of them can bind this reply to its own send by finding its uuid anywhere in the list. Always contains user_message_uuid; at most 64 entries. Present exactly when user_message_uuid is, on the same first reply frame only; absent from older producers (fall back to user_message_uuid).
|
|
3297
|
+
*/
|
|
3298
|
+
user_message_uuids?: string[];
|
|
3073
3299
|
/**
|
|
3074
3300
|
* This turn continued the preceding truncated assistant turn inside its trailing signed thinking block (max-output-tokens recovery). Its thinking signatures are cumulative over that preceding thinking-only turn, so a history replayed through the bridge must carry this flag back for the normalizer to keep the run's prefix on the wire. Wrapper-level sibling — never inside `message.content` — so it is not replayed to the model.
|
|
3075
3301
|
*/
|
|
@@ -3112,6 +3338,8 @@ export declare type SDKAssistantMessage = {
|
|
|
3112
3338
|
|
|
3113
3339
|
|
|
3114
3340
|
|
|
3341
|
+
|
|
3342
|
+
|
|
3115
3343
|
};
|
|
3116
3344
|
|
|
3117
3345
|
export declare type SDKAssistantMessageError = 'authentication_failed' | 'oauth_org_not_allowed' | 'account_on_hold' | 'billing_error' | 'rate_limit' | 'overloaded' | 'invalid_request' | 'model_not_found' | 'server_error' | 'unknown' | 'max_output_tokens';
|
|
@@ -3126,7 +3354,7 @@ export declare type SDKAuthStatusMessage = {
|
|
|
3126
3354
|
};
|
|
3127
3355
|
|
|
3128
3356
|
/**
|
|
3129
|
-
* The full set of live background tasks, emitted whenever membership changes (start, completion, kill, a foreground agent being backgrounded). A level signal, unlike the task_started/task_notification edge bookends: consumers that only need 'is background work running' should replace their set with each payload rather than pairing edges, so a missed bookend cannot wedge a stale running indicator. Ordering relative to the bookends for the same transition is unspecified (in practice the level precedes them) and the payload carries ids only, so do not correlate it with the edge stream. The level is per-process: nothing is emitted at startup, so consumers must reset to the empty set whenever the session's CLI process (re)starts and let the next membership change repopulate it. A host that re-initializes an already-running process (a repeated `initialize` control request, e.g. after reconnecting) is sent a snapshot of the current set right behind the success response to that request, even when it is empty, so it need not wait for a change; CLIs that predate this send nothing there.
|
|
3357
|
+
* The full set of live background tasks, emitted whenever membership changes (start, completion, kill, a foreground agent being backgrounded) or an entry's `ambient` flag flips. A level signal, unlike the task_started/task_notification edge bookends: consumers that only need 'is background work running' should replace their set with each payload rather than pairing edges, so a missed bookend cannot wedge a stale running indicator. Ordering relative to the bookends for the same transition is unspecified (in practice the level precedes them) and the payload carries ids only, so do not correlate it with the edge stream. The level is per-process: nothing is emitted at startup, so consumers must reset to the empty set whenever the session's CLI process (re)starts and let the next membership change repopulate it. A host that re-initializes an already-running process (a repeated `initialize` control request, e.g. after reconnecting) is sent a snapshot of the current set right behind the success response to that request, even when it is empty, so it need not wait for a change; CLIs that predate this send nothing there.
|
|
3130
3358
|
*/
|
|
3131
3359
|
export declare type SDKBackgroundTasksChangedMessage = {
|
|
3132
3360
|
type: 'system';
|
|
@@ -3138,6 +3366,10 @@ export declare type SDKBackgroundTasksChangedMessage = {
|
|
|
3138
3366
|
task_id: string;
|
|
3139
3367
|
task_type: string;
|
|
3140
3368
|
description: string;
|
|
3369
|
+
/**
|
|
3370
|
+
* True for housekeeping tasks the CLI does not surface as user work (every skip_transcript task, plus auto-started live-update watchers); hosts should exclude them from activity indicators.
|
|
3371
|
+
*/
|
|
3372
|
+
ambient?: boolean;
|
|
3141
3373
|
}[];
|
|
3142
3374
|
uuid: UUID;
|
|
3143
3375
|
session_id: string;
|
|
@@ -3355,6 +3587,10 @@ declare type SDKControlGetBinaryVersionRequest = {
|
|
|
3355
3587
|
*/
|
|
3356
3588
|
declare type SDKControlGetContextUsageRequest = {
|
|
3357
3589
|
subtype: 'get_context_usage';
|
|
3590
|
+
/**
|
|
3591
|
+
* 'full' counts each category with the token-count API; 'summary' answers from the last response's usage and local estimates without the per-category token-count calls. Defaults to 'full'.
|
|
3592
|
+
*/
|
|
3593
|
+
detail?: 'summary' | 'full';
|
|
3358
3594
|
};
|
|
3359
3595
|
|
|
3360
3596
|
/**
|
|
@@ -3693,9 +3929,22 @@ declare type SDKControlInitializeRequest = {
|
|
|
3693
3929
|
subtype: 'initialize';
|
|
3694
3930
|
hooks?: Partial<Record<coreTypes.HookEvent, SDKHookCallbackMatcher[]>>;
|
|
3695
3931
|
sdkMcpServers?: string[];
|
|
3932
|
+
/**
|
|
3933
|
+
* Settings for the SDK-hosted MCP servers named in sdkMcpServers, keyed by server name. Sent as a separate field so a CLI that predates it ignores it; entries whose name is not in sdkMcpServers, and values that do not match this shape, are ignored rather than rejected. Applied when the server is first registered.
|
|
3934
|
+
*/
|
|
3935
|
+
sdkMcpServerConfigs?: Record<string, {
|
|
3936
|
+
/**
|
|
3937
|
+
* Per-server tool-call timeout in milliseconds. Overrides the MCP_TOOL_TIMEOUT environment variable for this server. Hard wall-clock limit per call; progress notifications do not extend it. Values below 1000ms are ignored (falls through to MCP_TOOL_TIMEOUT or the default). Applies when the server is first registered; changing it for an already-registered server has no effect until it is removed and re-added.
|
|
3938
|
+
*/
|
|
3939
|
+
timeout?: number;
|
|
3940
|
+
}>;
|
|
3696
3941
|
jsonSchema?: Record<string, unknown>;
|
|
3697
3942
|
systemPrompt?: string[];
|
|
3698
3943
|
appendSystemPrompt?: string;
|
|
3944
|
+
/**
|
|
3945
|
+
* Record the conversation's system prompt once and reuse it verbatim on every later request and resume (recommended: true). Omitted: setting systemPrompt or appendSystemPrompt turns recording off so the appended text applies fresh each launch; only the bare claude_code preset is recorded. true: an existing record in the conversation is sent as-is (a later launch's different systemPrompt/appendSystemPrompt is ignored until compaction); otherwise the prompt is rendered with appendSystemPrompt included, sent, and recorded. false: never record. With a record, a mid-session model switch or set_settings agent/system-prompt change does not alter the prompt until compaction or a new session.
|
|
3946
|
+
*/
|
|
3947
|
+
systemPromptSnapshot?: boolean;
|
|
3699
3948
|
/**
|
|
3700
3949
|
* Custom workflow body for the plan-mode system reminder. Replaces the default code-implementation phases; the CLI still wraps it with the read-only enforcement preamble and the ExitPlanMode protocol footer.
|
|
3701
3950
|
*/
|
|
@@ -3726,6 +3975,10 @@ declare type SDKControlInitializeRequest = {
|
|
|
3726
3975
|
* Dialog kinds (request_user_dialog `dialog_kind` values) this consumer's onUserDialog can actually render. The CLI treats ABSENCE as 'cannot display' and fails closed: without the kind declared here, a dialog-gated flow degrades to its no-dialog behavior (for 'refusal_fallback_prompt', the classic refusal error) instead of parking a dialog the consumer may mishandle. First-attached-client-wins on multi-client sessions; later initializes do not change it.
|
|
3727
3976
|
*/
|
|
3728
3977
|
supportedDialogKinds?: string[];
|
|
3978
|
+
/**
|
|
3979
|
+
* Declares that this consumer renders a per-task stop control wired to the `stop_task` control request, so the user can stop an individual background task. When declared, an interrupt on an open-input (interactive stream-json) session spares running background agents/workflows (Stop only aborts the turn). Closed-input exception: a one-shot run (string prompt / -p closes stdin) still kills hold-back tasks at the held-result release regardless of the declaration — with stdin closed, a stop_task control could never be delivered, so the fail-closed kill stands. ABSENCE also fails closed: the interrupt kills background tasks, since the user would otherwise have no way to stop a runaway one. First-attached-client-wins on multi-client sessions; later initializes do not change it.
|
|
3980
|
+
*/
|
|
3981
|
+
perTaskStopAffordance?: boolean;
|
|
3729
3982
|
|
|
3730
3983
|
};
|
|
3731
3984
|
|
|
@@ -3760,6 +4013,9 @@ export declare type SDKControlInitializeResponse = {
|
|
|
3760
4013
|
|
|
3761
4014
|
|
|
3762
4015
|
|
|
4016
|
+
|
|
4017
|
+
|
|
4018
|
+
|
|
3763
4019
|
};
|
|
3764
4020
|
|
|
3765
4021
|
/**
|
|
@@ -3769,7 +4025,7 @@ declare type SDKControlInterruptRequest = {
|
|
|
3769
4025
|
subtype: 'interrupt';
|
|
3770
4026
|
|
|
3771
4027
|
/**
|
|
3772
|
-
* When true, the interrupt also cancels every uuid-stamped main-thread command still in the queue or already dequeued for the imminent turn but not yet reachable by the abort (the first-command prewait window) — the same set the response would otherwise list under `still_queued`. Each is closed with a terminal 'cancelled' lifecycle and listed on the response's `cancelled` field. `still_queued` is then empty, except that a client driving a hosted session lists there what it can no longer recall (a send already in flight to that session, or the first prompt the session was created with). (The isFoldInFlight guard cancel_async_message uses does not apply here: this request also aborts the running turn, so a fold-in-flight uuid is never delivered and is swept with the rest. A fold-in-flight uuid's queued_command attachment may already appear in the aborted turn's transcript if the abort landed after the fold's attachment yield — pre-existing leave-queued semantics; it never runs as its own turn.) Uuid-less commands (task notifications) still in the queue are also dequeued but cannot be listed; a uuid-less command already in the prewait window is unreachable by either leg and still runs. When false or absent, queued commands survive the interrupt and are listed under `still_queued` — the interrupt_receipt_v1 contract is unchanged. A Stop-means-stop-everything client (a remote UI's Stop button) sets this true so one round-trip halts the session; a wrapper that wants per-uuid control leaves it false and follows up with cancel_async_message. Advertised by the `interrupt_cancel_queued_v1` capability on system/init; older CLIs ignore the field and behave as if false.
|
|
4028
|
+
* When true, the interrupt also cancels every uuid-stamped main-thread command still in the queue or already dequeued for the imminent turn but not yet reachable by the abort (the first-command prewait window) — the same set the response would otherwise list under `still_queued`. Each is closed with a terminal 'cancelled' lifecycle and listed on the response's `cancelled` field. `still_queued` is then empty, except that a client driving a hosted session lists there what it can no longer recall (a send already in flight to that session, or the first prompt the session was created with) and, when the session's own sweep then cancels one of those or a send it had already delivered, follows up with a command_lifecycle 'cancelled' frame for it. (The isFoldInFlight guard cancel_async_message uses does not apply here: this request also aborts the running turn, so a fold-in-flight uuid is never delivered and is swept with the rest. A fold-in-flight uuid's queued_command attachment may already appear in the aborted turn's transcript if the abort landed after the fold's attachment yield — pre-existing leave-queued semantics; it never runs as its own turn.) Uuid-less commands (task notifications) still in the queue are also dequeued but cannot be listed; a uuid-less command already in the prewait window is unreachable by either leg and still runs. When false or absent, queued commands survive the interrupt and are listed under `still_queued` — the interrupt_receipt_v1 contract is unchanged. A Stop-means-stop-everything client (a remote UI's Stop button) sets this true so one round-trip halts the session; a wrapper that wants per-uuid control leaves it false and follows up with cancel_async_message. Advertised by the `interrupt_cancel_queued_v1` capability on system/init; older CLIs ignore the field and behave as if false.
|
|
3773
4029
|
*/
|
|
3774
4030
|
cancel_queued?: boolean;
|
|
3775
4031
|
};
|
|
@@ -3779,7 +4035,7 @@ declare type SDKControlInterruptRequest = {
|
|
|
3779
4035
|
*/
|
|
3780
4036
|
export declare type SDKControlInterruptResponse = {
|
|
3781
4037
|
/**
|
|
3782
|
-
* Uuids of async user messages that survive this interrupt: commands still in the queue, plus any batch already dequeued for the imminent turn but not yet reachable by the abort. These WILL run unless cancelled first (or unless the request set cancel_queued:true, in which case every uuid-stamped survivor this process holds is removed, emitted a terminal `cancelled` synchronously, and listed under `cancelled` instead — leaving here only what a client driving a hosted session can no longer recall: a send already in flight to that session, or the first prompt the session was created with). Cancellation granularity: uuids still in the queue are individually cancellable via cancel_async_message; once a batch is dequeued and coalesced into one turn, cancelling a NON-representative member uuid is a no-op (its content still runs), while cancelling the batch-representative uuid drops the WHOLE coalesced batch — in both cases the cancel response reports cancelled:false because the message was no longer in the queue. Coverage caveats: only uuid-STAMPED messages appear (a message enqueued without a uuid still runs but is never listed, so [] does not mean "nothing will run"); only main-thread messages are listed (subagent-addressed messages are out of scope); and the list may include internally-enqueued uuids the client never sent (cron triggers, auto-resume continuations) — ignore unknown uuids rather than treating them as an error. Ordering: on a clean interrupt this receipt is written before the interrupted turn result; a turn that crashes during interrupt handling emits its error result on a direct-write path that may precede the receipt. Snapshot is taken synchronously with abort processing — probing the queue after the interrupted result instead always loses the race against the drain loop, which starts the next queued turn immediately.
|
|
4038
|
+
* Uuids of async user messages that survive this interrupt: commands still in the queue, plus any batch already dequeued for the imminent turn but not yet reachable by the abort. These WILL run unless cancelled first (or unless the request set cancel_queued:true, in which case every uuid-stamped survivor this process holds is removed, emitted a terminal `cancelled` synchronously, and listed under `cancelled` instead — leaving here only what a client driving a hosted session can no longer recall: a send already in flight to that session, or the first prompt the session was created with; a send that client still holds on its own machine behind a send gate (today: waiting for the session to take the initial upload from that machine) has not gone out, so it is withdrawn and listed under `cancelled` like a queued one, and cancel_async_message can withdraw it too, while a plain interrupt leaves it held and lists it here). Cancellation granularity: uuids still in the queue are individually cancellable via cancel_async_message; once a batch is dequeued and coalesced into one turn, cancelling a NON-representative member uuid is a no-op (its content still runs), while cancelling the batch-representative uuid drops the WHOLE coalesced batch — in both cases the cancel response reports cancelled:false because the message was no longer in the queue. Coverage caveats: only uuid-STAMPED messages appear (a message enqueued without a uuid still runs but is never listed, so [] does not mean "nothing will run"); only main-thread messages are listed (subagent-addressed messages are out of scope); and the list may include internally-enqueued uuids the client never sent (cron triggers, auto-resume continuations) — ignore unknown uuids rather than treating them as an error. Ordering: on a clean interrupt this receipt is written before the interrupted turn result; a turn that crashes during interrupt handling emits its error result on a direct-write path that may precede the receipt. Snapshot is taken synchronously with abort processing — probing the queue after the interrupted result instead always loses the race against the drain loop, which starts the next queued turn immediately.
|
|
3783
4039
|
*/
|
|
3784
4040
|
still_queued: string[];
|
|
3785
4041
|
/**
|
|
@@ -3914,6 +4170,10 @@ declare type SDKControlPermissionRequest = {
|
|
|
3914
4170
|
* True when the dialog must not offer the persistent "don't ask again" row for this ask: accepting it would write a whole-tool allow rule broader than the ask's own verb (PermissionAskDecision.suppressAlwaysAllowRule). Hosts rendering approve options should omit any persistent-rule affordance when set.
|
|
3915
4171
|
*/
|
|
3916
4172
|
suppress_always_allow_rule?: boolean;
|
|
4173
|
+
/**
|
|
4174
|
+
* True when the ask must not be approvable by a single stray keystroke (PermissionAskDecision.defaultToNo): a terminal-style prompt opens on its decline option and takes no digit shortcut. Hosts rendering approve options should not pre-select approve when set.
|
|
4175
|
+
*/
|
|
4176
|
+
default_to_no?: boolean;
|
|
3917
4177
|
/**
|
|
3918
4178
|
* Set when a user-configured ask RULE (permissions.ask) forced this prompt but the ask carries the tool's own decision_reason — the ask-rule substitution keeps the richer tool-minted ask, so the rule rides here instead of decision_reason_type 'rule'. Hosts making policy on decision_reason_type (e.g. auto-deny safetyCheck) or running host-side auto-approval should treat asks carrying this field as rule-forced: the user's stated intent is a human prompt. Values are producer-authored but render-unsafe like decision_reason; sanitize before display.
|
|
3919
4179
|
*/
|
|
@@ -4030,7 +4290,7 @@ export declare type SDKControlRequest = {
|
|
|
4030
4290
|
request: SDKControlRequestInner;
|
|
4031
4291
|
};
|
|
4032
4292
|
|
|
4033
|
-
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlSetColorRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetSessionCostRequest | SDKControlListModelsRequest | SDKControlGetUsageRequest | SDKControlGetBinaryVersionRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlRegisterRepoRootRequest | SDKControlReloadPluginsRequest | SDKControlReloadSkillsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlStopTaskRequest | SDKControlBackgroundTasksRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
4293
|
+
declare type SDKControlRequestInner = SDKControlInterruptRequest | SDKControlPermissionRequest | SDKControlInitializeRequest | SDKControlSetPermissionModeRequest | SDKControlSetModelRequest | SDKControlSetMaxThinkingTokensRequest | SDKControlRenameSessionRequest | SDKControlSetColorRequest | SDKControlMcpStatusRequest | SDKControlGetContextUsageRequest | SDKControlGetSessionCostRequest | SDKControlListModelsRequest | SDKControlGetUsageRequest | SDKControlGetBinaryVersionRequest | SDKControlMcpCallRequest | SDKControlFileSuggestionsRequest | SDKHookCallbackRequest | SDKControlMcpMessageRequest | SDKControlRewindFilesRequest | SDKControlCancelAsyncMessageRequest | SDKControlReadFileRequest | SDKControlSeedReadStateRequest | SDKControlMcpSetServersRequest | SDKControlRegisterRepoRootRequest | SDKControlReloadPluginsRequest | SDKControlReloadSkillsRequest | SDKControlMcpReconnectRequest | SDKControlMcpToggleRequest | SDKControlStopTaskRequest | SDKControlBackgroundTasksRequest | SDKControlApplyFlagSettingsRequest | SDKControlGetSettingsRequest | SDKControlUpdateSettingsRequest | SDKControlElicitationRequest | SDKControlRequestUserDialogRequest;
|
|
4034
4294
|
|
|
4035
4295
|
/**
|
|
4036
4296
|
* Progress for a long-running client-originated control_request (currently only side_question), correlated by request_id. status 'started' means the worker accepted the request and launched the work; 'api_retry' carries the same retry counters as SDKAPIRetryMessage and is present only for that status.
|
|
@@ -4142,6 +4402,18 @@ declare type SDKControlStopTaskRequest = {
|
|
|
4142
4402
|
task_id: string;
|
|
4143
4403
|
};
|
|
4144
4404
|
|
|
4405
|
+
/**
|
|
4406
|
+
* Merges the provided settings into a settings file through the CLI's own writer (canonical store root, gitignore upkeep, hardened write) and live-applies them — the same path /config uses. Unlike apply_flag_settings, which only touches the session-scoped flag layer. The handler accepts an explicit key allowlist only (currently just outputStyle — the file feeds hook and permission-rule loading, so each key is a security decision), requires string values (key deletion is not supported), and refuses remote transports and sessions whose --setting-sources exclude the target source.
|
|
4407
|
+
*/
|
|
4408
|
+
declare type SDKControlUpdateSettingsRequest = {
|
|
4409
|
+
subtype: 'update_settings';
|
|
4410
|
+
/**
|
|
4411
|
+
* Which settings file to write. Only the project's local settings file for now — the scope host UIs need so their writes land exactly where /config's do.
|
|
4412
|
+
*/
|
|
4413
|
+
source: 'localSettings';
|
|
4414
|
+
settings: Record<string, unknown>;
|
|
4415
|
+
};
|
|
4416
|
+
|
|
4145
4417
|
/**
|
|
4146
4418
|
* Emitted by /clear, plan-mode exit, and fresh-session flows. The surface should mount a fresh transcript under new_conversation_id and reset any cached session title. From internal QueryEvent 'conversation_reset'.
|
|
4147
4419
|
*/
|
|
@@ -4289,6 +4561,16 @@ export declare type SDKLocalCommandOutputMessage = {
|
|
|
4289
4561
|
session_id: string;
|
|
4290
4562
|
};
|
|
4291
4563
|
|
|
4564
|
+
export declare type SDKMcpResourceLink = {
|
|
4565
|
+
uri: string;
|
|
4566
|
+
name: string;
|
|
4567
|
+
title?: string;
|
|
4568
|
+
description?: string;
|
|
4569
|
+
mimeType?: string;
|
|
4570
|
+
size?: number;
|
|
4571
|
+
annotations?: Record<string, unknown>;
|
|
4572
|
+
};
|
|
4573
|
+
|
|
4292
4574
|
/**
|
|
4293
4575
|
* MCP tool definition for SDK servers.
|
|
4294
4576
|
* Contains a handler function, so not serializable.
|
|
@@ -4353,7 +4635,7 @@ export declare type SDKMessageOrigin = {
|
|
|
4353
4635
|
*/
|
|
4354
4636
|
name?: string;
|
|
4355
4637
|
/**
|
|
4356
|
-
* The sender's host-openable session id (the envelope's `from-session` attribute — e.g. a desktop `local_<uuid>` or a
|
|
4638
|
+
* The sender's host-openable session id (the envelope's `from-session` attribute — e.g. a desktop `local_<uuid>` or a cloud session `session_`/`ses_` id), set by the sender's host so a receiving UI can link this message back to the sending session. Sender-asserted like `from`: a navigation target only, never authority. Absent when the sender's host provides none and on messages from older senders.
|
|
4357
4639
|
*/
|
|
4358
4640
|
fromSession?: string;
|
|
4359
4641
|
|
|
@@ -4372,7 +4654,7 @@ export declare type SDKMessageOrigin = {
|
|
|
4372
4654
|
} | {
|
|
4373
4655
|
kind: 'task-notification';
|
|
4374
4656
|
/**
|
|
4375
|
-
* Present when the delivery is the fired stored prompt of a scheduled task/routine ('scheduled-trigger', stamped from server-asserted provenance; the schedule attests storage, not authorship)
|
|
4657
|
+
* Present when the delivery is the fired stored prompt of a scheduled task/routine ('scheduled-trigger', stamped from server-asserted provenance; the schedule attests storage, not authorship) or a coordinator co-member SendMessage delivery ('peer-send-message': model-authored text from another of the same user's sessions, verified by the server-stamped receiver co-membership — task-notification for prompt authority, but distinguishable so the receive-side crossSessionInbound setting can apply to it). The harness frames a scheduled-trigger delivery as the session's assigned task instead of the generic background-notification frame. Absent on webhook, PR-steward, plugin, and background-event deliveries.
|
|
4376
4658
|
*/
|
|
4377
4659
|
subkind?: 'scheduled-trigger' | 'peer-send-message' | 'projects-relay';
|
|
4378
4660
|
} | {
|
|
@@ -4486,6 +4768,14 @@ export declare type SDKPartialAssistantMessage = {
|
|
|
4486
4768
|
uuid: UUID;
|
|
4487
4769
|
session_id: string;
|
|
4488
4770
|
ttft_ms?: number;
|
|
4771
|
+
/**
|
|
4772
|
+
* Client uuid of the user message that triggered this turn (submitMessage options.uuid), stamped on the turn's FIRST non-ping stream event only (the frame that triggers the turn's initial ack) so a consumer can bind the reply stream to the send it answers without waiting for the result. Absent on every later stream event of the turn, on synthetic/scheduled (meta) turns, on turns without a client uuid, and from older producers.
|
|
4773
|
+
*/
|
|
4774
|
+
user_message_uuid?: string;
|
|
4775
|
+
/**
|
|
4776
|
+
* Client uuids of every user message whose prompt this turn has consumed so far, in consumption order — all members of a prompt batch the host merged into this one turn (several messages sent close together run as one turn whose user_message_uuid is the LAST member's), so a consumer that sent any of them can bind this reply to its own send by finding its uuid anywhere in the list. Always contains user_message_uuid; at most 64 entries. Present exactly when user_message_uuid is, on the same first non-ping stream event only; absent from older producers (fall back to user_message_uuid).
|
|
4777
|
+
*/
|
|
4778
|
+
user_message_uuids?: string[];
|
|
4489
4779
|
};
|
|
4490
4780
|
|
|
4491
4781
|
export declare type SDKPermissionDenial = {
|
|
@@ -4584,6 +4874,7 @@ export declare type SDKRateLimitInfo = {
|
|
|
4584
4874
|
resetsAt?: number;
|
|
4585
4875
|
rateLimitType?: 'five_hour' | 'seven_day' | 'seven_day_opus' | 'seven_day_sonnet' | 'seven_day_overage_included' | 'overage';
|
|
4586
4876
|
utilization?: number;
|
|
4877
|
+
|
|
4587
4878
|
overageStatus?: 'allowed' | 'allowed_warning' | 'rejected';
|
|
4588
4879
|
overageResetsAt?: number;
|
|
4589
4880
|
overageDisabledReason?: 'overage_not_provisioned' | 'org_level_disabled' | 'org_level_disabled_until' | 'out_of_credits' | 'seat_tier_level_disabled' | 'member_level_disabled' | 'seat_tier_zero_credit_limit' | 'group_zero_credit_limit' | 'member_zero_credit_limit' | 'org_service_level_disabled' | 'no_limits_configured' | 'fetch_error' | 'unknown';
|
|
@@ -4620,7 +4911,19 @@ export declare type SDKResultError = {
|
|
|
4620
4911
|
modelUsage: Record<string, ModelUsage>;
|
|
4621
4912
|
|
|
4622
4913
|
permission_denials: SDKPermissionDenial[];
|
|
4914
|
+
/**
|
|
4915
|
+
* User-initiated sends still waiting in the command queue when this result was produced. Greater than 0 means at least one more user turn (and result) follows without further input, barring cancellation; 0 means none is pending, or the session is ending (end_session or a shutdown latched mid-turn discards the backlog). Queued sends may coalesce into fewer turns, so this counts pending sends, not remaining results. System-generated queue entries are not counted. Absent on fatal startup results and on surfaces without a command queue.
|
|
4916
|
+
*/
|
|
4917
|
+
queued_turn_count?: number;
|
|
4623
4918
|
errors: string[];
|
|
4919
|
+
/**
|
|
4920
|
+
* Client uuid of the user message that triggered this turn (submitMessage options.uuid), echoed back so a consumer can link this error result to the send it answers — the same join key the success variant echoes, carried alone (error turns have no request_sent_wall_ms to report). A delivery-failure result from the remote-session client echoes the failed send's queue key, which is client-minted when the host sent no uuid of its own. Absent on synthetic/scheduled (meta) turns, on turns without a client uuid, on session-scoped failures with no single triggering send (a crashed worker's zeroed result), and from older producers.
|
|
4921
|
+
*/
|
|
4922
|
+
user_message_uuid?: string;
|
|
4923
|
+
/**
|
|
4924
|
+
* Client uuids of every user message whose prompt this turn consumed, in consumption order — all members of a prompt batch the host merged into this one turn (several messages sent close together run as one turn whose user_message_uuid is the LAST member's), then any queued user message folded into the running turn between tool rounds, once taken off the queue — so a consumer that sent any of them can bind this result to its own send by finding its uuid anywhere in the list. Always contains user_message_uuid; at most 64 entries; can be longer than the list on the turn's first reply frame. Present when a headless turn that ran echoes user_message_uuid; absent on delivery-failure and zeroed results and from older producers (fall back to user_message_uuid).
|
|
4925
|
+
*/
|
|
4926
|
+
user_message_uuids?: string[];
|
|
4624
4927
|
terminal_reason?: TerminalReason;
|
|
4625
4928
|
fast_mode_state?: FastModeState;
|
|
4626
4929
|
fast_mode_disabled_reason?: FastModeDisabledReason;
|
|
@@ -4643,6 +4946,7 @@ export declare type SDKResultSuccess = {
|
|
|
4643
4946
|
ttft_stream_ms?: number;
|
|
4644
4947
|
time_to_request_ms?: number;
|
|
4645
4948
|
user_message_uuid?: string;
|
|
4949
|
+
user_message_uuids?: string[];
|
|
4646
4950
|
request_sent_wall_ms?: number;
|
|
4647
4951
|
time_to_request_from_spawn_ms?: number;
|
|
4648
4952
|
warm_spare_claimed?: boolean;
|
|
@@ -4666,6 +4970,10 @@ export declare type SDKResultSuccess = {
|
|
|
4666
4970
|
modelUsage: Record<string, ModelUsage>;
|
|
4667
4971
|
|
|
4668
4972
|
permission_denials: SDKPermissionDenial[];
|
|
4973
|
+
/**
|
|
4974
|
+
* User-initiated sends still waiting in the command queue when this result was produced. Greater than 0 means at least one more user turn (and result) follows without further input, barring cancellation; 0 means none is pending, or the session is ending (end_session or a shutdown latched mid-turn discards the backlog). Queued sends may coalesce into fewer turns, so this counts pending sends, not remaining results. System-generated queue entries are not counted. Absent on fatal startup results and on surfaces without a command queue.
|
|
4975
|
+
*/
|
|
4976
|
+
queued_turn_count?: number;
|
|
4669
4977
|
structured_output?: unknown;
|
|
4670
4978
|
deferred_tool_use?: SDKDeferredToolUse;
|
|
4671
4979
|
terminal_reason?: TerminalReason;
|
|
@@ -4810,12 +5118,13 @@ export declare type SDKSystemMessage = {
|
|
|
4810
5118
|
|
|
4811
5119
|
fast_mode_state?: FastModeState;
|
|
4812
5120
|
fast_mode_disabled_reason?: FastModeDisabledReason;
|
|
5121
|
+
|
|
4813
5122
|
/**
|
|
4814
5123
|
* The effort level the session will send on its next request — after env overrides, session state, org caps and model-support downgrades; the same value get_settings reports as applied.effort. null when no effort parameter will be sent (a model without effort, CLAUDE_CODE_EFFORT_LEVEL=unset, or an internal numeric budget). Present on Remote Control bridge init frames (terminal- and Desktop/VS Code-hosted sessions); absent on hosts that do not publish it and on CLIs that predate the field. Re-emitted inits carry the current value — the newest frame wins.
|
|
4815
5124
|
*/
|
|
4816
5125
|
effort?: ('low' | 'medium' | 'high' | 'xhigh' | 'max') | null;
|
|
4817
5126
|
/**
|
|
4818
|
-
* Protocol capabilities this CLI supports, so SDK consumers can feature-detect instead of version-sniffing. Open set — ignore unknown values; check each capability for exactly the behavior you use. 'interrupt_receipt_v1' = the interrupt control_response success payload carries still_queued (uuids of async user messages that survive the interrupt). 'interrupt_cancel_queued_v1' = the interrupt control_request honors cancel_queued:true (queued and pending-dispatch commands are cancelled alongside the abort, listed on the response's cancelled field; still_queued is then empty — including any uuid that was mid-fold at the interrupt instant, since this request also aborts and the fold never delivers it — except that a client driving a hosted session lists there what it can no longer recall: a send already in flight to that session, or the first prompt the session was created with). 'queued_notifications' = the CLI accepts inbound queued_notification stream messages and drains them via ReadNotifications (the
|
|
5127
|
+
* Protocol capabilities this CLI supports, so SDK consumers can feature-detect instead of version-sniffing. Open set — ignore unknown values; check each capability for exactly the behavior you use. 'interrupt_receipt_v1' = the interrupt control_response success payload carries still_queued (uuids of async user messages that survive the interrupt). 'interrupt_cancel_queued_v1' = the interrupt control_request honors cancel_queued:true (queued and pending-dispatch commands are cancelled alongside the abort, listed on the response's cancelled field; still_queued is then empty — including any uuid that was mid-fold at the interrupt instant, since this request also aborts and the fold never delivers it — except that a client driving a hosted session lists there what it can no longer recall: a send already in flight to that session, or the first prompt the session was created with). 'queued_notifications' = the CLI accepts inbound queued_notification stream messages and drains them via ReadNotifications (the cloud session backend reads this from the persisted init event to decide whether it may send them). Absent on older CLIs.
|
|
4819
5128
|
*/
|
|
4820
5129
|
capabilities?: string[];
|
|
4821
5130
|
|
|
@@ -4823,6 +5132,8 @@ export declare type SDKSystemMessage = {
|
|
|
4823
5132
|
|
|
4824
5133
|
|
|
4825
5134
|
|
|
5135
|
+
|
|
5136
|
+
|
|
4826
5137
|
uuid: UUID;
|
|
4827
5138
|
session_id: string;
|
|
4828
5139
|
};
|
|
@@ -4840,7 +5151,15 @@ export declare type SDKTaskNotificationMessage = {
|
|
|
4840
5151
|
tool_uses: number;
|
|
4841
5152
|
duration_ms: number;
|
|
4842
5153
|
};
|
|
5154
|
+
/**
|
|
5155
|
+
* CLI-owned: for a backgrounded MCP task (task_type mcp_task) that completed, the `resource_link` content blocks of its final result — the files it returned by reference — collected from the raw result before the CLI renders it as the text the model reads. A backgrounded task's tool_result is the placeholder text and its real result arrives as this notification, so this is where a host learns which files that tool call produced; join to the originating call via tool_use_id. Same fields and caps as tool_use_result.resourceLinks (at most 50 links, 64 KiB serialized), absent when the result had none or the task is any other type. Never populated from the server's _meta.
|
|
5156
|
+
*/
|
|
5157
|
+
resource_links?: SDKMcpResourceLink[];
|
|
4843
5158
|
skip_transcript?: boolean;
|
|
5159
|
+
/**
|
|
5160
|
+
* True for housekeeping tasks the CLI does not surface as user work (every skip_transcript task, plus auto-started live-update watchers); hosts should exclude them from activity indicators.
|
|
5161
|
+
*/
|
|
5162
|
+
ambient?: boolean;
|
|
4844
5163
|
uuid: UUID;
|
|
4845
5164
|
session_id: string;
|
|
4846
5165
|
};
|
|
@@ -4861,6 +5180,9 @@ export declare type SDKTaskProgressMessage = {
|
|
|
4861
5180
|
duration_ms: number;
|
|
4862
5181
|
};
|
|
4863
5182
|
last_tool_name?: string;
|
|
5183
|
+
/**
|
|
5184
|
+
* A one-line status for the task's row. For a local_agent task it is the model-generated progress summary (only when the agentProgressSummaries option is on); for a backgrounded mcp_task it is the MCP server's own bounded status message, emitted once per change without any option. Render it when present regardless of task type.
|
|
5185
|
+
*/
|
|
4864
5186
|
summary?: string;
|
|
4865
5187
|
|
|
4866
5188
|
uuid: UUID;
|
|
@@ -4895,6 +5217,10 @@ export declare type SDKTaskStartedMessage = {
|
|
|
4895
5217
|
* Ambient/housekeeping task. Consumers should hide this from the inline transcript; it may still appear in a tasks panel.
|
|
4896
5218
|
*/
|
|
4897
5219
|
skip_transcript?: boolean;
|
|
5220
|
+
/**
|
|
5221
|
+
* True for housekeeping tasks the CLI does not surface as user work (every skip_transcript task, plus auto-started live-update watchers); hosts should exclude them from activity indicators.
|
|
5222
|
+
*/
|
|
5223
|
+
ambient?: boolean;
|
|
4898
5224
|
uuid: UUID;
|
|
4899
5225
|
session_id: string;
|
|
4900
5226
|
};
|
|
@@ -5001,6 +5327,7 @@ export declare type SDKUserMessage = {
|
|
|
5001
5327
|
|
|
5002
5328
|
|
|
5003
5329
|
|
|
5330
|
+
|
|
5004
5331
|
uuid?: UUID;
|
|
5005
5332
|
session_id?: string;
|
|
5006
5333
|
/**
|
|
@@ -5051,6 +5378,7 @@ export declare type SDKUserMessageReplay = {
|
|
|
5051
5378
|
|
|
5052
5379
|
|
|
5053
5380
|
|
|
5381
|
+
|
|
5054
5382
|
uuid: UUID;
|
|
5055
5383
|
session_id: string;
|
|
5056
5384
|
isReplay: true;
|
|
@@ -5058,7 +5386,7 @@ export declare type SDKUserMessageReplay = {
|
|
|
5058
5386
|
};
|
|
5059
5387
|
|
|
5060
5388
|
/**
|
|
5061
|
-
* Emitted by the bridge on opt-in graceful worker teardown (only when the teardown caller supplied a reason), before the heartbeat stops, so remote clients can show why the worker went away instead of waiting for heartbeat timeout. Absence is NOT a dead-host signal: handoffs (/update, /teleport, respawn), auto-disable, mode transitions, and internal fatal-error paths emit nothing by design. A dead host (battery, OOM, kill -9) never reaches teardown and never sends this either. NOTE: this event lands in the durable per-session event stream — a session that is later resumed may carry historical instances mid-stream. Clients MUST treat it as a live-tail signal only (honored when no further activity follows), not a one-shot session-lifetime fact.
|
|
5389
|
+
* Emitted by the bridge on opt-in graceful worker teardown (only when the teardown caller supplied a reason), before the heartbeat stops, so remote clients can show why the worker went away instead of waiting for heartbeat timeout. Absence is NOT a dead-host signal: handoffs (/update, /teleport, respawn), auto-disable, mode transitions, and internal fatal-error paths emit nothing by design. A dead host (battery, OOM, kill -9) never reaches teardown and never sends this either. NOTE: this event lands in the durable per-session event stream — a session that is later resumed may carry historical instances mid-stream. Clients MUST treat it as a live-tail signal only (honored when no further activity follows), not a one-shot session-lifetime fact.
|
|
5062
5390
|
*/
|
|
5063
5391
|
export declare type SDKWorkerShuttingDownMessage = {
|
|
5064
5392
|
type: 'system';
|
|
@@ -5154,6 +5482,22 @@ export declare type SessionStartHookInput = BaseHookInput & {
|
|
|
5154
5482
|
agent_type?: string;
|
|
5155
5483
|
model?: string;
|
|
5156
5484
|
session_title?: string;
|
|
5485
|
+
/**
|
|
5486
|
+
* resume/fork: seconds since the resumed transcript's last assistant response
|
|
5487
|
+
*/
|
|
5488
|
+
seconds_since_last_response?: number;
|
|
5489
|
+
/**
|
|
5490
|
+
* resume/fork: the resumed transcript's last response input + cache_read + cache_creation + output tokens (for a server-side tool loop, its last iteration's window, not the summed totals)
|
|
5491
|
+
*/
|
|
5492
|
+
context_tokens?: number;
|
|
5493
|
+
/**
|
|
5494
|
+
* resume/fork: seconds_since_last_response exceeds the prompt-cache TTL, so the first request re-caches context_tokens
|
|
5495
|
+
*/
|
|
5496
|
+
prompt_cache_likely_expired?: boolean;
|
|
5497
|
+
/**
|
|
5498
|
+
* resume/fork: estimated cost of re-caching context_tokens on the session model — the managed modelPricing when set, otherwise list price; excludes the response
|
|
5499
|
+
*/
|
|
5500
|
+
estimated_cache_write_usd?: number;
|
|
5157
5501
|
};
|
|
5158
5502
|
|
|
5159
5503
|
export declare type SessionStartHookSpecificOutput = {
|
|
@@ -5386,10 +5730,18 @@ export declare interface Settings {
|
|
|
5386
5730
|
* Number of days to retain chat transcripts before automatic cleanup (default: 30). Minimum 1. Use a large value for long retention; use --no-session-persistence to disable transcript writes entirely.
|
|
5387
5731
|
*/
|
|
5388
5732
|
cleanupPeriodDays?: number;
|
|
5733
|
+
/**
|
|
5734
|
+
* Retention ceiling in days for session transcripts created or last written by a desktop-host surface (Claude Desktop, Cowork), which are otherwise exempt from the cleanupPeriodDays sweep. 0 (the default) means no ceiling: such transcripts are kept until deleted another way. Unlike cleanupPeriodDays, 0 is allowed because this setting never disables writes — it only bounds an exemption from deletion. The ceiling is a hard cap: it also bounds an active archive grace, so the grace window of a release marker never keeps files past the ceiling. Ignored when cleanupPeriodDays is managed by org policy. A ceiling at or below cleanupPeriodDays effectively disables the exemption: those transcripts age out on the regular cleanupPeriodDays schedule, so the effective retention is whichever of the two periods is longer.
|
|
5735
|
+
*/
|
|
5736
|
+
desktopSessionCleanupPeriodDays?: number;
|
|
5389
5737
|
/**
|
|
5390
5738
|
* Set to false to turn off syncing of the skills you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced skills (~/.claude/skills/synced) can no longer be run, are hidden from every session started afterwards, and are moved to ~/.claude/skills/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced skills are blocked and hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced skills are available in every session, re-synced every 10 minutes, and removed when you disable them on claude.ai. Only applies when signed in with your Claude account.
|
|
5391
5739
|
*/
|
|
5392
5740
|
syncClaudeAiSkills?: boolean;
|
|
5741
|
+
/**
|
|
5742
|
+
* Set to false to turn off syncing of the plugins you have enabled on claude.ai. In your user settings (or managed settings): nothing more is downloaded, previously synced plugins (~/.claude/plugins/synced) are hidden from every session started afterwards and moved to ~/.claude/plugins/.trash at the next launch (deleted after cleanupPeriodDays; re-downloaded, not restored, if you re-enable). In .claude/settings.local.json or --settings: downloads stop and synced plugins are hidden for sessions in that workspace or invocation only (nothing is moved). Not read from project settings (.claude/settings.json). Only false is honored — the feature is enabled server-side for your account, so setting true does not turn it on early. While it is on, synced plugins load in every session like plugins you installed yourself (a plugin you installed with the same name takes precedence), are re-synced at each launch, and are removed when you disable them on claude.ai. Only applies when signed in with your Claude account.
|
|
5743
|
+
*/
|
|
5744
|
+
syncClaudeAiPlugins?: boolean;
|
|
5393
5745
|
/**
|
|
5394
5746
|
* Per-skill description character cap in the skill listing sent to Claude (default: 1536). Descriptions longer than this are truncated. Raise to opt in to higher per-turn context cost.
|
|
5395
5747
|
*/
|
|
@@ -5458,6 +5810,10 @@ export declare interface Settings {
|
|
|
5458
5810
|
* Disable the ability to bypass permission prompts
|
|
5459
5811
|
*/
|
|
5460
5812
|
disableBypassPermissionsMode?: 'disable';
|
|
5813
|
+
/**
|
|
5814
|
+
* Refuse file-tool reads (Read, Grep, Glob, LSP) outside the working directories in every permission mode; true in any settings source wins. Also set when the user picks "block" on the one-time auto-mode prompt for a read outside the working directories.
|
|
5815
|
+
*/
|
|
5816
|
+
blockReadsOutsideWorkingDirectories?: boolean;
|
|
5461
5817
|
/**
|
|
5462
5818
|
* Additional directories to include in the permission scope
|
|
5463
5819
|
*/
|
|
@@ -5486,6 +5842,50 @@ export declare interface Settings {
|
|
|
5486
5842
|
modelOverrides?: {
|
|
5487
5843
|
[k: string]: string;
|
|
5488
5844
|
};
|
|
5845
|
+
/**
|
|
5846
|
+
* Curate the /model picker: an ordered list of models with your own labels, independent of the built-in lineup and of Claude Code releases. availableModels still applies to these rows. Honored from managed, --settings/SDK, and user settings only (not from a project checkout); the highest-precedence of those that defines modelPicker wins outright (no merging across sources). Typically set in managed settings by enterprise administrators.
|
|
5847
|
+
*/
|
|
5848
|
+
modelPicker?: {
|
|
5849
|
+
/**
|
|
5850
|
+
* Rows to show in the /model picker, in order.
|
|
5851
|
+
*/
|
|
5852
|
+
options: {
|
|
5853
|
+
/**
|
|
5854
|
+
* Model to select, taken verbatim: an alias ("opus"), an Anthropic model ID, or a provider-format ID (Vertex, Bedrock, gateway). Same values --model accepts.
|
|
5855
|
+
*/
|
|
5856
|
+
model: string;
|
|
5857
|
+
/**
|
|
5858
|
+
* Row title. Defaults to the model name.
|
|
5859
|
+
*/
|
|
5860
|
+
label?: string;
|
|
5861
|
+
/**
|
|
5862
|
+
* Row subtitle. Defaults to a generic description.
|
|
5863
|
+
*/
|
|
5864
|
+
description?: string;
|
|
5865
|
+
/**
|
|
5866
|
+
* For a model this version of Claude Code does not know: the ID of a model it does know (e.g. "claude-opus-4-8") whose client-side handling — prompt profile, capability and effort defaults — applies to it. Changes neither the row's label nor the model ID sent. Without it, a model-catalog row for a model this version does not know is not offered until Claude Code is updated.
|
|
5867
|
+
*/
|
|
5868
|
+
behavesAs?: string;
|
|
5869
|
+
}[];
|
|
5870
|
+
/**
|
|
5871
|
+
* When true, the picker shows only the Default row and these options — the built-in lineup, gateway-discovered models and ANTHROPIC_CUSTOM_MODEL_OPTION are hidden. When false or unset, these options are added after the built-in lineup.
|
|
5872
|
+
*/
|
|
5873
|
+
replaceBuiltInOptions?: boolean;
|
|
5874
|
+
};
|
|
5875
|
+
/**
|
|
5876
|
+
* Price usage at your organization's contracted rates instead of list price. Affects every spend figure Claude Code reports — /cost, the status line, the SDK total_cost_usd, --max-budget-usd, and the OpenTelemetry cost metric and events — which remain USD estimates, not an invoice (the per-Mtok price labels in /model stay at list). "overrides" maps a model ID to its USD-per-million-token rates (input, output, cacheRead, cacheWrite — all four required, each 0 to 10000; cacheWrite prices both 5-minute and 1-hour cache writes). A matching row is charged exactly as written; fast-mode and US-data-residency surcharges are not added on top. A key Claude Code itself uses for a built-in model — its ID such as "claude-sonnet-4-6", or its first-party, Bedrock (any or no region prefix), Vertex or Foundry ID — covers every dated and provider form of that model; any other key — a gateway model alias, or a spelling Claude Code does not itself use — matches that model ID only (case-insensitive), and such an exact match wins over a built-in row. On Bedrock an application inference profile is matched by its backing model. An invalid row or multiplier is reported and skipped; the rest still apply. "multiplier" in (0, 1] scales every computed cost, overridden or not (0.85 = 85% of the price). Only honored from managed settings (server-managed, MDM / OS policy, or managed-settings.json), or — when none of those sets it — when supplied by a host application that manages the model provider; ignored in user, project, local and --settings sources.
|
|
5877
|
+
*/
|
|
5878
|
+
modelPricing?: {
|
|
5879
|
+
multiplier?: number;
|
|
5880
|
+
overrides?: {
|
|
5881
|
+
[k: string]: {
|
|
5882
|
+
input: number;
|
|
5883
|
+
output: number;
|
|
5884
|
+
cacheRead: number;
|
|
5885
|
+
cacheWrite: number;
|
|
5886
|
+
};
|
|
5887
|
+
};
|
|
5888
|
+
};
|
|
5489
5889
|
/**
|
|
5490
5890
|
* Whether to automatically approve all MCP servers in the project
|
|
5491
5891
|
*/
|
|
@@ -5513,7 +5913,15 @@ export declare interface Settings {
|
|
|
5513
5913
|
*/
|
|
5514
5914
|
disableBundledSkills?: boolean;
|
|
5515
5915
|
/**
|
|
5516
|
-
*
|
|
5916
|
+
* MCP servers the organization provides to every user, keyed by server name, each with the .mcp.json entry shape; only "http" and "sse" servers are accepted (nothing that names a program to run, no ${VAR} references). Honored from managed settings only; users cannot remove them, deniedMcpServers still applies, and they need no allowedMcpServers entry. Not read in Claude Desktop's Code tab on a third-party deployment or in Cowork sessions, where Claude Desktop supplies and locks the session's MCP servers itself.
|
|
5917
|
+
*/
|
|
5918
|
+
managedMcpServers?: {
|
|
5919
|
+
[k: string]: {
|
|
5920
|
+
[k: string]: unknown;
|
|
5921
|
+
};
|
|
5922
|
+
};
|
|
5923
|
+
/**
|
|
5924
|
+
* Enterprise allowlist of the MCP servers users may use. Governs servers users add (user, project and local config, --mcp-config, agent frontmatter, plugins, claude.ai connectors); servers the organization itself delivers (managedMcpServers, and managed-mcp.json entries that use no ${VAR} expansion) are allowed without being listed; a managed-mcp.json entry that uses ${VAR} expansion is still checked against this list. If undefined, all servers are allowed. If empty array, users can use no servers of their own. Denylist takes precedence - if a server is on both lists, it is denied.
|
|
5517
5925
|
*/
|
|
5518
5926
|
allowedMcpServers?: {
|
|
5519
5927
|
/**
|
|
@@ -5605,6 +6013,7 @@ export declare interface Settings {
|
|
|
5605
6013
|
asyncRewake?: boolean;
|
|
5606
6014
|
|
|
5607
6015
|
|
|
6016
|
+
|
|
5608
6017
|
} | {
|
|
5609
6018
|
/**
|
|
5610
6019
|
* LLM prompt hook type
|
|
@@ -5702,6 +6111,7 @@ export declare interface Settings {
|
|
|
5702
6111
|
* If true, hook runs once and is removed after execution
|
|
5703
6112
|
*/
|
|
5704
6113
|
once?: boolean;
|
|
6114
|
+
|
|
5705
6115
|
} | {
|
|
5706
6116
|
/**
|
|
5707
6117
|
* MCP tool hook type
|
|
@@ -5782,11 +6192,11 @@ export declare interface Settings {
|
|
|
5782
6192
|
*/
|
|
5783
6193
|
disableWorkflows?: boolean;
|
|
5784
6194
|
/**
|
|
5785
|
-
*
|
|
6195
|
+
* Deprecated: use enableArtifact: false. Still honored — true disables the Artifact tool; false is ignored.
|
|
5786
6196
|
*/
|
|
5787
6197
|
disableArtifact?: boolean;
|
|
5788
6198
|
/**
|
|
5789
|
-
*
|
|
6199
|
+
* Turn the Artifact tool on or off. Off in any of managed, --settings, or user settings wins; project and local settings can only turn it off. Unset defaults to on once the feature is available.
|
|
5790
6200
|
*/
|
|
5791
6201
|
enableArtifact?: boolean;
|
|
5792
6202
|
/**
|
|
@@ -5826,7 +6236,7 @@ export declare interface Settings {
|
|
|
5826
6236
|
*/
|
|
5827
6237
|
httpHookAllowedEnvVars?: string[];
|
|
5828
6238
|
/**
|
|
5829
|
-
* When true (and set in managed settings),
|
|
6239
|
+
* When true (and set in managed settings), permission rules from user, project, local, and --settings files and allow rules from --allowedTools are ignored; only managed settings can add allow rules through settings. --disallowedTools and other deny and ask rules from the command line or the current session still apply.
|
|
5830
6240
|
*/
|
|
5831
6241
|
allowManagedPermissionRulesOnly?: boolean;
|
|
5832
6242
|
/**
|
|
@@ -7103,6 +7513,10 @@ export declare interface Settings {
|
|
|
7103
7513
|
* Controls whether the SDK parent tier (Options.managedSettings / --managed-settings) layers under this admin tier. "first-wins" (default): parent is dropped — admin tiers are the only policy source. "merge": parent's restrictive-only-filtered settings union under the admin winner. Has no effect when no admin tier exists (parent applies as the sole policy tier, still filtered restrictive-only).
|
|
7104
7514
|
*/
|
|
7105
7515
|
parentSettingsBehavior?: 'first-wins' | 'merge';
|
|
7516
|
+
/**
|
|
7517
|
+
* Controls how the managed settings sources compose. "first-wins" (default): the highest-priority source present (server-managed > MDM (managed plist / HKLM) > managed-settings.json) is the managed tier alone. "merge": every present source deep-merges with fixed precedence server-managed > MDM > managed-settings.json — scalars take the highest source's value and arrays union, except fallbackModel, the restriction allowlists allowedMcpServers, availableModels, strictKnownMarketplaces and allowedChannelPlugins, and sandbox.credentials.awsPairs and sandbox.ripgrep (the highest source that sets one owns it whole), managedMcpServers (server names union; a name set by two sources takes the higher source's whole entry) and the auth pins forceLoginOrgUUID, forceLoginMethod and forceLoginGatewayUrl (highest source only). Honored only from the highest-priority source present; enable it only when every lower source is admin-controlled, since lower sources then contribute entries such as permissions.allow. HKCU and --managed-settings never take part in the merge.
|
|
7518
|
+
*/
|
|
7519
|
+
managedSourcesBehavior?: 'first-wins' | 'merge';
|
|
7106
7520
|
/**
|
|
7107
7521
|
* Organization UUID to require for OAuth login. Accepts a single UUID string or an array of UUIDs (any one is permitted). When set in managed settings, login fails if the authenticated account does not belong to a listed organization.
|
|
7108
7522
|
*/
|
|
@@ -7365,11 +7779,22 @@ export declare interface Settings {
|
|
|
7365
7779
|
verbs: string[];
|
|
7366
7780
|
};
|
|
7367
7781
|
/**
|
|
7368
|
-
*
|
|
7782
|
+
* Add your organization's own tips to the spinner tip rotation. tips: strings or {id, text, cooldownSessions?, priority?} objects; tipsFile: a JSON file of the same; label: prefix shown before your tips; excludeDefault: if true, only show your tips (default: false).
|
|
7369
7783
|
*/
|
|
7370
7784
|
spinnerTipsOverride?: {
|
|
7371
7785
|
excludeDefault?: boolean;
|
|
7372
|
-
tips
|
|
7786
|
+
tips?: (string | {
|
|
7787
|
+
[k: string]: unknown;
|
|
7788
|
+
})[];
|
|
7789
|
+
/**
|
|
7790
|
+
* Absolute or ~/ local path to a JSON file holding an array of tips (same shapes as `tips`); honored from user, --settings and on-disk managed settings only. Read once per CLI process (restart to pick up edits).
|
|
7791
|
+
*/
|
|
7792
|
+
tipsFile?: string;
|
|
7793
|
+
/**
|
|
7794
|
+
* Prefix shown before your tips in the spinner (default "Tip")
|
|
7795
|
+
*/
|
|
7796
|
+
label?: string;
|
|
7797
|
+
[k: string]: unknown;
|
|
7373
7798
|
};
|
|
7374
7799
|
/**
|
|
7375
7800
|
* Whether to disable syntax highlighting in diffs
|
|
@@ -7401,6 +7826,14 @@ export declare interface Settings {
|
|
|
7401
7826
|
* Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.
|
|
7402
7827
|
*/
|
|
7403
7828
|
terminalTitleFromRename?: boolean;
|
|
7829
|
+
/**
|
|
7830
|
+
* Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): "5m" or "1h". Unset = automatic: 1 hour on a Claude subscription within its usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry. 1-hour cache writes are billed at a higher rate; the cache stays warm across longer breaks. The CLAUDE_CODE_PROMPT_CACHE_TTL environment variable takes precedence.
|
|
7831
|
+
*/
|
|
7832
|
+
promptCacheTtl?: '5m' | '1h';
|
|
7833
|
+
/**
|
|
7834
|
+
* Prompt cache TTL for everything outside the main conversation — subagents, workflows, background and helper requests: "5m" or "1h". Unset = automatic (5 minutes unless ENABLE_PROMPT_CACHING_1H=1). The CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL environment variable takes precedence.
|
|
7835
|
+
*/
|
|
7836
|
+
subagentPromptCacheTtl?: '5m' | '1h';
|
|
7404
7837
|
/**
|
|
7405
7838
|
* When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.
|
|
7406
7839
|
*/
|
|
@@ -7556,6 +7989,14 @@ export declare interface Settings {
|
|
|
7556
7989
|
* Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)
|
|
7557
7990
|
*/
|
|
7558
7991
|
prefersReducedMotion?: boolean;
|
|
7992
|
+
/**
|
|
7993
|
+
* Clock format for times shown in the UI: "auto" (default, follows the locale), "12-hour", "24-hour", "24-hour-utc" ("18:05Z"), or a strftime pattern such as "%H:%M" (any value containing "%"; other values read as "auto"). A pattern replaces the time everywhere; message timestamps show only the pattern, so include %Y-%m-%d for the date. /config offers the presets; a pattern is set here.
|
|
7994
|
+
*/
|
|
7995
|
+
timeFormat?: ('auto' | '12-hour' | '24-hour' | '24-hour-utc') | string;
|
|
7996
|
+
/**
|
|
7997
|
+
* IANA time zone for times shown in the UI, e.g. "UTC" or "Europe/Dublin". Default: the system time zone. An unknown name falls back to the system time zone.
|
|
7998
|
+
*/
|
|
7999
|
+
timeZone?: string;
|
|
7559
8000
|
|
|
7560
8001
|
|
|
7561
8002
|
|
|
@@ -7585,6 +8026,7 @@ export declare interface Settings {
|
|
|
7585
8026
|
* Disable auto mode
|
|
7586
8027
|
*/
|
|
7587
8028
|
disableAutoMode?: 'disable';
|
|
8029
|
+
|
|
7588
8030
|
/**
|
|
7589
8031
|
* SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.
|
|
7590
8032
|
*/
|
|
@@ -7975,7 +8417,7 @@ export declare type SyncHookJSONOutput = {
|
|
|
7975
8417
|
reason?: string;
|
|
7976
8418
|
|
|
7977
8419
|
|
|
7978
|
-
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PostToolBatchHookSpecificOutput | StopHookSpecificOutput | SubagentStopHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput | MessageDisplayHookSpecificOutput;
|
|
8420
|
+
hookSpecificOutput?: PreToolUseHookSpecificOutput | UserPromptSubmitHookSpecificOutput | UserPromptExpansionHookSpecificOutput | SessionStartHookSpecificOutput | SetupHookSpecificOutput | PreModelSwitchHookSpecificOutput | PostModelSwitchHookSpecificOutput | SubagentStartHookSpecificOutput | PostToolUseHookSpecificOutput | PostToolUseFailureHookSpecificOutput | PostToolBatchHookSpecificOutput | StopHookSpecificOutput | SubagentStopHookSpecificOutput | PermissionDeniedHookSpecificOutput | NotificationHookSpecificOutput | PermissionRequestHookSpecificOutput | ElicitationHookSpecificOutput | ElicitationResultHookSpecificOutput | CwdChangedHookSpecificOutput | FileChangedHookSpecificOutput | WorktreeCreateHookSpecificOutput | MessageDisplayHookSpecificOutput;
|
|
7979
8421
|
};
|
|
7980
8422
|
|
|
7981
8423
|
/**
|