@code-yeongyu/senpi 2026.9.22-2 → 2026.9.22-3
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 +37 -17
- package/dist/bundle/chunks/{anthropic-messages-2P7APOOQ.js → anthropic-messages-V4CUY3UU.js} +1 -1
- package/dist/bundle/chunks/{app-server-command-PRNA6QQU.js → app-server-command-P5WP2YVC.js} +2 -2
- package/dist/bundle/chunks/azure-openai-responses-SBCCU4KI.js +2 -0
- package/dist/bundle/chunks/chatgpt-subscription.js +75 -0
- package/dist/bundle/chunks/chunk-2VZJTDUX.js +2 -0
- package/dist/bundle/chunks/{chunk-BOZ37BOT.js → chunk-3KLWJIXM.js} +3 -4
- package/dist/bundle/chunks/{chunk-M2HSO7MH.js → chunk-3UO3QYMZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-6OD4TT33.js → chunk-5T3V75HH.js} +113 -111
- package/dist/bundle/chunks/chunk-6KXIFAMC.js +11 -0
- package/dist/bundle/chunks/{chunk-UCPWK6TZ.js → chunk-6MIPLTQG.js} +1 -1
- package/dist/bundle/chunks/{chunk-JZ6YQU3A.js → chunk-7ZPFQY76.js} +3 -3
- package/dist/bundle/chunks/{chunk-MUYK27UR.js → chunk-AEJUOQ7U.js} +1 -1
- package/dist/bundle/chunks/{chunk-F3DXL5MX.js → chunk-AJ722VIQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-VYIJQQ5I.js → chunk-DTD3QN3S.js} +1 -1
- package/dist/bundle/chunks/chunk-DY6FUAWH.js +2 -0
- package/dist/bundle/chunks/{chunk-5XC2FNJ5.js → chunk-GLDP7LH2.js} +1 -1
- package/dist/bundle/chunks/{chunk-OPNVT7BU.js → chunk-KB3DR2ZH.js} +1 -1
- package/dist/bundle/chunks/{chunk-JR4X6ECO.js → chunk-M4NQKQUK.js} +1 -1
- package/dist/bundle/chunks/{chunk-GXUYWMN2.js → chunk-PODQ2IEB.js} +1 -1
- package/dist/bundle/chunks/{chunk-ARJJU3MS.js → chunk-PU7UDZ5F.js} +1 -1
- package/dist/bundle/chunks/{chunk-64JQFFHH.js → chunk-SSJ5OP3B.js} +2 -2
- package/dist/bundle/chunks/{chunk-X63BXA24.js → chunk-TAFYWUE4.js} +1 -1
- package/dist/bundle/chunks/{chunk-KICRBRVS.js → chunk-TU37KLCN.js} +2 -2
- package/dist/bundle/chunks/{chunk-R6LVC7SP.js → chunk-TWTHGDQS.js} +4 -4
- package/dist/bundle/chunks/chunk-WS7QGU5H.js +8 -0
- package/dist/bundle/chunks/{chunk-IPRJIKLL.js → chunk-WSQMYWLV.js} +1 -1
- package/dist/bundle/chunks/chunk-ZBHRTH5C.js +2 -0
- package/dist/bundle/chunks/cli-main-O4CFWDWV.js +3 -0
- package/dist/bundle/chunks/{google-generative-ai-Y2IYMUVC.js → google-generative-ai-UJIX64UU.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-TKBBMPHV.js → google-vertex-KJEY5SZY.js} +1 -1
- package/dist/bundle/chunks/help-fast-path-KFMAFECE.js +2 -0
- package/dist/bundle/chunks/host-command-JEBCPKMK.js +2 -0
- package/dist/bundle/chunks/host-lifecycle-FWIB56UI.js +3 -0
- package/dist/bundle/chunks/host-lifecycle.js +2 -2
- package/dist/bundle/chunks/{interactive-host-runtime-F5L4USLR.js → interactive-host-runtime-HBK4XNHJ.js} +1 -1
- package/dist/bundle/chunks/interactive-mode-WKFWOHXN.js +2 -0
- package/dist/bundle/chunks/{mistral-conversations-ZYDVFRYF.js → mistral-conversations-PNYVN6YU.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-EUTEGVLS.js → multi-session-host-DWBOLTS7.js} +2 -2
- package/dist/bundle/chunks/openai-codex-responses-TBF5EMKG.js +10 -0
- package/dist/bundle/chunks/{openai-completions-4V76L5ZJ.js → openai-completions-IJIBZB2G.js} +1 -1
- package/dist/bundle/chunks/{openai-images-4XAZQLDT.js → openai-images-JA5N5DUU.js} +1 -1
- package/dist/bundle/chunks/openai-responses-3XYO7ROE.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-Z3WQ5BDR.js → openrouter-images-T4GY3JYM.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-JPUWMUEJ.js → package-manager-cli-JUKHAT7U.js} +1 -1
- package/dist/bundle/chunks/{rotation-stream-S56Y7WMM.js → rotation-stream-67OZ4U6R.js} +1 -1
- package/dist/bundle/chunks/rpc-mode-746KEL7Z.js +2 -0
- package/dist/bundle/chunks/{session-picker-PFPJVVIC.js → session-picker-TO42QRV2.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +399 -398
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +10 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.js +8 -8
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-provider-key-migration.d.ts +27 -0
- package/dist/core/auth-provider-key-migration.d.ts.map +1 -0
- package/dist/core/auth-provider-key-migration.js +40 -0
- package/dist/core/auth-provider-key-migration.js.map +1 -0
- package/dist/core/auth-storage.d.ts +26 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +93 -20
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/credential-accounts.d.ts +1 -1
- package/dist/core/credential-accounts.d.ts.map +1 -1
- package/dist/core/credential-accounts.js +8 -5
- package/dist/core/credential-accounts.js.map +1 -1
- package/dist/core/credential-pool/env-slots.d.ts.map +1 -1
- package/dist/core/credential-pool/env-slots.js +5 -2
- package/dist/core/credential-pool/env-slots.js.map +1 -1
- package/dist/core/dynamic-prompt/build.js +1 -1
- package/dist/core/dynamic-prompt/build.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-command.d.ts +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/account-command.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-command.js +24 -24
- package/dist/core/extensions/builtin/anthropic-subscription/account-command.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/account-events.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/account-events.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-management.d.ts +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/account-management.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-management.js +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/account-management.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/accounts.d.ts +8 -8
- package/dist/core/extensions/builtin/anthropic-subscription/accounts.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/accounts.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/affinity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/affinity.js +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/affinity.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/api-id.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/api-id.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-attempt.d.ts +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/auth-attempt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/auth-attempt.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/auth-environment.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/auth-environment.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-lane.d.ts +5 -5
- package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-lane.js +10 -10
- package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/availability.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/availability.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/bounded-queue.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/bounded-queue.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/bounded-queue.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/config-dir-credentials.d.ts +18 -0
- package/dist/core/extensions/builtin/anthropic-subscription/config-dir-credentials.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/config-dir-credentials.js +81 -0
- package/dist/core/extensions/builtin/anthropic-subscription/config-dir-credentials.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/content-blocks.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/content-blocks.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/custom-tools-schema.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/custom-tools-schema.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/custom-tools.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/custom-tools.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/errors.d.ts +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/errors.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/errors.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/errors.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/executable-path-lookup.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/executable.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/executable.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/failover.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/failover.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/failover.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/guidance.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/guidance.js +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/guidance.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/index.d.ts +11 -0
- package/dist/core/extensions/builtin/anthropic-subscription/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/index.js +19 -13
- package/dist/core/extensions/builtin/anthropic-subscription/index.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/oauth-login.d.ts +3 -3
- package/dist/core/extensions/builtin/anthropic-subscription/oauth-login.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/oauth-login.js +3 -3
- package/dist/core/extensions/builtin/anthropic-subscription/oauth-login.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/options.d.ts +18 -0
- package/dist/core/extensions/builtin/anthropic-subscription/options.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/options.js +3 -3
- package/dist/core/extensions/builtin/anthropic-subscription/options.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/prompt-bridge.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/prompt-bridge.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/prompt-directive-dedupe.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/prompt-directive-dedupe.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/refusal.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/refusal.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/sdk-boundary.lazy.d.ts +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.lazy.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/sdk-boundary.lazy.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-binding-store.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-binding-store.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-binding.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-binding.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-commit-boundary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-commit-boundary.js +4 -3
- package/dist/core/extensions/builtin/anthropic-subscription/session-commit-boundary.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-continuity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-continuity.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-entry-annotations.d.ts +3 -3
- package/dist/core/extensions/builtin/anthropic-subscription/session-entry-annotations.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-entry-annotations.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-observability.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-observability.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/session-observability.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-reaper.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-reaper.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-reattach.d.ts +5 -5
- package/dist/core/extensions/builtin/anthropic-subscription/session-reattach.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-reattach.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/session-reattach.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-pump.d.ts +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-pump.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-pump.js +6 -6
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-pump.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-state.d.ts +3 -3
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-state.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-state.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-wiring.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-wiring.js +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry-wiring.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry.d.ts +12 -12
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry.js +4 -4
- package/dist/core/extensions/builtin/anthropic-subscription/session-registry.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-restored-admission.d.ts +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/session-restored-admission.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-restored-admission.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-stream.d.ts +2 -2
- package/dist/core/extensions/builtin/anthropic-subscription/session-stream.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-stream.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/session-stream.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-sync.d.ts +5 -5
- package/dist/core/extensions/builtin/anthropic-subscription/session-sync.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-sync.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-attempt.d.ts +11 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-attempt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-attempt.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-claim.d.ts +14 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-claim.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-turn-claim.js +1 -1
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-claim.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/session-turn-types.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/settings.d.ts +11 -11
- package/dist/core/extensions/builtin/anthropic-subscription/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/settings.js +9 -9
- package/dist/core/extensions/builtin/anthropic-subscription/settings.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-events.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-events.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-protocol.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream-protocol.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream.d.ts +3 -0
- package/dist/core/extensions/builtin/anthropic-subscription/stream.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream.js +5 -5
- package/dist/core/extensions/builtin/anthropic-subscription/stream.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/system-prompt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/system-prompt.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/tool-watch.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/tool-watch.js +6 -2
- package/dist/core/extensions/builtin/anthropic-subscription/tool-watch.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/tools.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-subscription/tools.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/index.js +2 -2
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/lane-policy.d.ts +5 -5
- package/dist/core/extensions/builtin/compaction/lane-policy.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/lane-policy.js +9 -9
- package/dist/core/extensions/builtin/compaction/lane-policy.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote-model.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote-model.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote-model.js +6 -6
- package/dist/core/extensions/builtin/compaction/openai-remote-model.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote.js +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative-summary.js +2 -2
- package/dist/core/extensions/builtin/compaction/speculative-summary.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js.map +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-account.js +18 -18
- package/dist/core/extensions/builtin/gpt-account.js.map +1 -1
- package/dist/core/extensions/builtin/index.js +2 -2
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/oauth-login-interaction.d.ts +2 -2
- package/dist/core/extensions/builtin/oauth-login-interaction.d.ts.map +1 -1
- package/dist/core/extensions/builtin/oauth-login-interaction.js +1 -1
- package/dist/core/extensions/builtin/oauth-login-interaction.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/file-operations.d.ts +9 -1
- package/dist/core/extensions/builtin/prompt-preset/file-operations.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js +60 -17
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js +7 -3
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js +7 -3
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js +7 -3
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js +7 -3
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/constants.d.ts +1 -1
- package/dist/core/extensions/builtin/rules/rules/constants.js +1 -1
- package/dist/core/extensions/builtin/rules/rules/constants.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +3 -3
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/model-config.d.ts +3 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +26 -3
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +10 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -1
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/retry-fallback/expansion.js +1 -1
- package/dist/core/retry-fallback/expansion.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts +1 -1
- package/dist/core/retry-fallback/settings.js +1 -1
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +16 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +68 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/app-server/server/account.d.ts +1 -1
- package/dist/modes/app-server/server/account.d.ts.map +1 -1
- package/dist/modes/app-server/server/account.js +6 -1
- package/dist/modes/app-server/server/account.js.map +1 -1
- package/dist/modes/app-server/server/server-core.js +1 -1
- package/dist/modes/app-server/server/server-core.js.map +1 -1
- package/dist/modes/interactive/components/progressive-transcript-container.d.ts +12 -0
- package/dist/modes/interactive/components/progressive-transcript-container.d.ts.map +1 -1
- package/dist/modes/interactive/components/progressive-transcript-container.js +17 -2
- package/dist/modes/interactive/components/progressive-transcript-container.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +14 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.js +3 -3
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/host-process-metrics.d.ts.map +1 -1
- package/dist/modes/rpc/host-process-metrics.js +24 -31
- package/dist/modes/rpc/host-process-metrics.js.map +1 -1
- package/dist/modes/rpc/host-process-table.d.ts +36 -0
- package/dist/modes/rpc/host-process-table.d.ts.map +1 -0
- package/dist/modes/rpc/host-process-table.js +162 -0
- package/dist/modes/rpc/host-process-table.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +30 -0
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/docs/providers.md +9 -9
- package/docs/release-guide.md +1 -1
- package/docs/rpc.md +4 -4
- package/docs/settings.md +5 -5
- package/docs/usage.md +2 -2
- package/examples/extensions/AGENTS.md +1 -1
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/{openai-codex-usage → chatgpt-subscription-usage}/codex-usage.ts +1 -1
- package/examples/extensions/{openai-codex-usage → chatgpt-subscription-usage}/index.ts +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/README.md +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.d.ts +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +5 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +10 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/{openai-codex.d.ts → chatgpt-subscription.d.ts} +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/chatgpt-subscription.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/{openai-codex.js → chatgpt-subscription.js} +35 -35
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/chatgpt-subscription.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +7 -0
- 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 +20 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.js +56 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.js +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.models.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.models.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.models.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/chatgpt-subscription.models.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/chatgpt-subscription.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/{openai-codex-auth.d.ts → chatgpt-subscription-auth.d.ts} +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/utils/chatgpt-subscription-auth.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/{openai-codex-auth.js → chatgpt-subscription-auth.js} +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/utils/chatgpt-subscription-auth.js.map +1 -0
- 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 +7 -7
- package/dist/bundle/chunks/azure-openai-responses-3AH7MJWF.js +0 -2
- package/dist/bundle/chunks/chunk-56TWFZ2C.js +0 -2
- package/dist/bundle/chunks/chunk-JEFYJDHP.js +0 -8
- package/dist/bundle/chunks/chunk-K3HEWWSS.js +0 -2
- package/dist/bundle/chunks/chunk-NK2RNX25.js +0 -11
- package/dist/bundle/chunks/chunk-NMB4C6ZZ.js +0 -2
- package/dist/bundle/chunks/cli-main-AFJNXUSL.js +0 -3
- package/dist/bundle/chunks/help-fast-path-4KYBVD2Z.js +0 -2
- package/dist/bundle/chunks/host-command-OVA6GEWC.js +0 -2
- package/dist/bundle/chunks/host-lifecycle-IDQPLYEA.js +0 -3
- package/dist/bundle/chunks/interactive-mode-UFBSCOP7.js +0 -2
- package/dist/bundle/chunks/openai-codex-responses-MEIUNROM.js +0 -10
- package/dist/bundle/chunks/openai-codex.js +0 -75
- package/dist/bundle/chunks/openai-responses-YR7WRBG3.js +0 -2
- package/dist/bundle/chunks/rpc-mode-JDVHUBZY.js +0 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-events.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-events.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-management.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/account-management.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/accounts.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/accounts.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/affinity.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/affinity.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.d.ts +0 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.js +0 -27
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/custom-tools-schema.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/custom-tools-schema.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/custom-tools.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/custom-tools.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/executable-path-lookup.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/executable-path-lookup.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/executable.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/executable.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/failover.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/failover.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts +0 -11
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/options.d.ts +0 -18
- package/dist/core/extensions/builtin/claude-sdk-oauth/options.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/options.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-directive-dedupe.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-directive-dedupe.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/refusal.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/refusal.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.lazy.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.lazy.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding-store.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding-store.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-restored-admission.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-restored-admission.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts +0 -11
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts +0 -14
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/settings.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/settings.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts +0 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tool-watch.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tool-watch.js.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts +0 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +0 -22
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +0 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +0 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/openai-codex-auth.js.map +0 -1
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-events.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/account-events.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/accounts.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/affinity.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/api-id.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/api-id.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-attempt.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-environment.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/auth-environment.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/availability.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/availability.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/bounded-queue.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/content-blocks.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/content-blocks.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/custom-tools-schema.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/custom-tools-schema.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/custom-tools.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/custom-tools.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/executable-path-lookup.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/executable-path-lookup.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/executable.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/executable.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/failover.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/guidance.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/prompt-bridge.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/prompt-bridge.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/prompt-directive-dedupe.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/prompt-directive-dedupe.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/refusal.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/refusal.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/sdk-boundary.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/sdk-boundary.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/sdk-boundary.lazy.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-binding-store.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-binding-store.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-binding.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-binding.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-commit-boundary.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-continuity.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-continuity.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-entry-annotations.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-observability.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-reaper.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-reaper.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-state.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-registry-wiring.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-restored-admission.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-sync.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-turn-attempt.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-turn-types.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/session-turn-types.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-events.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-events.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-guidance.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-guidance.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-protocol.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/stream-protocol.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/system-prompt.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/system-prompt.js +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/tool-watch.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/tools.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-sdk-oauth → anthropic-subscription}/tools.js +0 -0
- /package/examples/extensions/{openai-codex-usage → chatgpt-subscription-usage}/README.md +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8MH,iDAAiD;AACjD,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AACnE,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;AAC/E,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,mGAAmG;AACnG,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;AAC3E,uGAAuG;AACvG,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AACrE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AACzE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AACrE,mGAAmG;AACnG,gGAAgG;AAChG,8FAA8F;AAC9F,kCAAkC;AAClC,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;AACrD,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { ImageContent, Model, ThinkingSelection } from \"@earendil-works/pi-ai\";\nimport type { SessionRuntimeKind } from \"../../cli/args.ts\";\nimport type { AgentAbortSource } from \"../../core/agent-abort-provenance.ts\";\nimport type { PromptDisposition, SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { CompactionResult } from \"../../core/compaction/index.ts\";\nimport type { EngineOrdinal } from \"../../core/engine-build-identity.ts\";\nimport type { ServiceTier } from \"../../core/extensions/builtin/service-tier.ts\";\nimport type { ContextUsage, SessionKind } from \"../../core/extensions/types.ts\";\nimport type { SessionEntry, SessionMessageEntry, SessionTreeNode, UsageTotals } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { RpcSlashCommand } from \"./rpc-command-surface.ts\";\n\nexport type { SessionContext, SessionKind } from \"../../core/extensions/types.ts\";\nexport type { RpcCommandInvocationEvent } from \"./rpc-command-invocation.ts\";\nexport type { RpcCommandsChangedEvent, RpcSlashCommand } from \"./rpc-command-surface.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\ntype RpcSessionCommand =\n\t// Prompting\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"prompt\";\n\t\t\tmessage: string;\n\t\t\timages?: ImageContent[];\n\t\t\tstreamingBehavior?: \"steer\" | \"followUp\";\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\tsessionTitlePrompt?: string | false;\n\t\t\texpandPromptTemplates?: boolean;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"send_custom_message\";\n\t\t\tcustomType: string;\n\t\t\tcontent: unknown;\n\t\t\tdisplay: boolean;\n\t\t\tdetails?: unknown;\n\t\t\ttriggerTurn?: boolean;\n\t\t\tdeliverAs?: \"steer\" | \"followUp\" | \"nextTurn\";\n\t }\n\t| { id?: string; type: \"append_user_message\"; content: unknown }\n\t| { id?: string; type: \"append_session_entry\"; entry: SessionEntry }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[]; enqueueOrder?: number }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[]; enqueueOrder?: number }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"abort_compaction\" }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"check_reload_veto\" }\n\t| { id?: string; type: \"clear_queue\"; abortWillFollow?: boolean }\n\t| { id?: string; type: \"get_steering_messages\" }\n\t| { id?: string; type: \"get_follow_up_messages\" }\n\t| { id?: string; type: \"abort_branch_summary\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"set_favorite_models\"; models: RpcSessionModelEntry[] }\n\t| { id?: string; type: \"set_scoped_models\"; models: RpcSessionModelEntry[] }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel; scope?: \"turn\" }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Fast mode (OpenAI Codex priority service tier)\n\t| { id?: string; type: \"set_fast_mode\"; enabled: boolean }\n\t| { id?: string; type: \"get_fast_mode\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\"; customInstructions?: string }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"bash\";\n\t\t\tcommand: string;\n\t\t\t/** Identifies output chunks to the requesting client. */\n\t\t\tbashId?: string;\n\t\t\texcludeFromContext?: boolean;\n\t\t\texecutionId?: string;\n\t\t\toperations?: Record<string, unknown>;\n\t }\n\t| { id?: string; type: \"record_bash_result\"; command: string; result: BashResult; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\" }\n\t| { id?: string; type: \"cleanup_bash_output\"; path: string }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| ({\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\t/** Select for retry (default), or resume the exact entry as leaf with no editorText. */\n\t\t\tintent?: \"select\" | \"resume\";\n\t\t\t/** Leaf the client last observed; the navigation is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t\t\treplaceInstructions?: boolean;\n\t\t\tlabel?: string;\n\t } & (\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Entry to navigate to. Unless intent is `resume`, the host applies the `/tree`\n\t\t\t\t\t * selection rule of `docs/sessions.md`: a user/custom target selects its PARENT and\n\t\t\t\t\t * returns `editorText`; any other kind moves the leaf TO the entry with no `editorText`;\n\t\t\t\t\t * the root user message resets the leaf to an empty conversation (`leafId: null`). A\n\t\t\t\t\t * client therefore never computes a parent id. Answers `NavigateTreeResult`.\n\t\t\t\t\t */\n\t\t\t\t\tentryId: string;\n\t\t\t\t\ttargetId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Original spelling, kept for the TUI and shipped clients. By default applies the selection\n\t\t\t\t\t * rule as `entryId`: user/custom targets select their PARENT and return `editorText`,\n\t\t\t\t\t * other targets select themselves, and a root user target yields `leafId: null`.\n\t\t\t\t\t * Answers the legacy `{ cancelled, leafId, editorText? }` payload. New clients use `entryId`.\n\t\t\t\t\t */\n\t\t\t\t\ttargetId: string;\n\t\t\t\t\tentryId?: never;\n\t\t\t }\n\t ))\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string; themeName?: string }\n\t| { id?: string; type: \"export_jsonl\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string; position?: \"before\" | \"at\" }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"edit_assistant_message\";\n\t\t\tentryId: string;\n\t\t\ttext: string;\n\t\t\t/** Leaf the client last observed; the edit is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"edit_user_message\";\n\t\t\tentryId: string;\n\t\t\ttext: string;\n\t\t\t/** Leaf the client last observed; the edit is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| { id?: string; type: \"import_jsonl\"; inputPath: string; cwdOverride?: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\t/**\n\t * Fetch one media block a `media_placeholders` client received as an `image_ref`\n\t * stub. `contentIndex` indexes the toolResult's `content` array and must point at\n\t * an image block; anything else answers `media_not_found`.\n\t */\n\t| { id?: string; type: \"get_media\"; toolCallId: string; contentIndex: number }\n\n\t// Commands and loaded runtime surfaces\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_loaded_surfaces\" }\n\t| { id?: string; type: \"extension_request\"; name: string; data?: unknown }\n\n\t// Auth (task 13) is additive. get_auth_providers, login_api_key and logout\n\t// answer synchronously. login_start responds immediately (flow-started) and\n\t// completion is delivered via auth_login_url / auth_login_end EVENTS, because\n\t// an interactive OAuth round-trip cannot fit the 30s request timeout.\n\t| { id?: string; type: \"get_auth_providers\" }\n\t| { id?: string; type: \"login_start\"; provider: string }\n\t| { id?: string; type: \"login_cancel\"; provider: string }\n\t| { id?: string; type: \"login_api_key\"; provider: string; key: string }\n\t| { id?: string; type: \"logout\"; provider: string }\n\n\t// Provider accounts (task 13) are additive. The desktop consumer contract\n\t// lives in ../omo-desktop-app/packages/contracts/src/rpc.ts and is updated separately.\n\t| { id?: string; type: \"get_provider_accounts\"; provider: string }\n\t| { id?: string; type: \"account_pin\"; provider: string; name: string | null }\n\t| { id?: string; type: \"account_remove\"; provider: string; name: string }\n\t| { id?: string; type: \"set_client_info\"; width: number; capabilities?: string[] };\n\n/** Stable multi-session protocol error codes. */\nexport const RPC_ERROR_UNKNOWN_SESSION = \"unknown_session\";\nexport const RPC_ERROR_SESSION_CLOSING = \"session_closing\";\nexport const RPC_ERROR_SESSION_PATH_IN_USE = \"session_path_in_use\";\nexport const RPC_ERROR_SESSION_RESERVATION_LIMIT = \"session_reservation_limit\";\nexport const RPC_ERROR_MISSING_SESSION_ID = \"missing_session_id\";\nexport const RPC_ERROR_MULTI_SESSION_DISABLED = \"multi_session_disabled\";\nexport const RPC_ERROR_INVALID_PATH = \"invalid_path\";\nexport const RPC_ERROR_OPEN_FAILED = \"open_failed\";\nexport const RPC_ERROR_MEDIA_NOT_FOUND = \"media_not_found\";\n/** `open_session.context` broke a documented cap (key count, key syntax, value or total bytes). */\nexport const RPC_ERROR_INVALID_SESSION_CONTEXT = \"invalid_session_context\";\n/** `open_session.kind` was neither `interactive` nor `worker`; an unknown kind is never downgraded. */\nexport const RPC_ERROR_INVALID_SESSION_KIND = \"invalid_session_kind\";\n/** A launch-profile field on `open_session` (currently `auto_title`) was the wrong type. */\nexport const RPC_ERROR_INVALID_LAUNCH_PROFILE = \"invalid_launch_profile\";\n/** `open_session.durableSessionId` was not a legal session id (see `assertValidSessionId`). */\nexport const RPC_ERROR_INVALID_SESSION_ID = \"invalid_session_id\";\n/**\n * `open_session.durableSessionId` is already held by a LIVE session. Two live sessions may\n * never share one durable id: every per-session artifact a client keys by that id (goal files,\n * subagent and team attribution) would collide. Close the holder, or open with a different id.\n */\nexport const RPC_ERROR_SESSION_ID_IN_USE = \"session_id_in_use\";\n/**\n * The host is above its RSS refuse watermark and declined to create a NEW worker session;\n * `errorData { rssMb, retry_after_ms }` says when to ask again. Existing sessions, attaches\n * to a live path and interactive opens are never refused for memory.\n */\nexport const RPC_ERROR_HOST_MEMORY_PRESSURE = \"host_memory_pressure\";\n// Message-edit and tree-navigation failures (mirror AssistantEditError.code / UserEditError.code /\n// SessionStreamingError.code). Every code lives in the one shared RpcErrorCode union below: the\n// failure response is a single catch-all member, so a command's codes are a documented SUBSET\n// rather than a per-command type.\nexport const RPC_ERROR_STREAMING = \"streaming\";\nexport const RPC_ERROR_ENTRY_NOT_FOUND = \"not_found\";\nexport const RPC_ERROR_NOT_ASSISTANT = \"not_assistant\";\nexport const RPC_ERROR_NOT_USER = \"not_user\";\nexport const RPC_ERROR_EMPTY_TEXT = \"empty\";\nexport const RPC_ERROR_STALE_LEAF = \"stale_leaf\";\n\nexport type RpcErrorCode =\n\t| typeof RPC_ERROR_UNKNOWN_SESSION\n\t| typeof RPC_ERROR_SESSION_CLOSING\n\t| typeof RPC_ERROR_SESSION_PATH_IN_USE\n\t| typeof RPC_ERROR_SESSION_RESERVATION_LIMIT\n\t| typeof RPC_ERROR_MISSING_SESSION_ID\n\t| typeof RPC_ERROR_MULTI_SESSION_DISABLED\n\t| typeof RPC_ERROR_INVALID_PATH\n\t| typeof RPC_ERROR_OPEN_FAILED\n\t| typeof RPC_ERROR_MEDIA_NOT_FOUND\n\t| typeof RPC_ERROR_INVALID_SESSION_CONTEXT\n\t| typeof RPC_ERROR_INVALID_SESSION_KIND\n\t| typeof RPC_ERROR_INVALID_LAUNCH_PROFILE\n\t| typeof RPC_ERROR_INVALID_SESSION_ID\n\t| typeof RPC_ERROR_SESSION_ID_IN_USE\n\t| typeof RPC_ERROR_HOST_MEMORY_PRESSURE\n\t| typeof RPC_ERROR_STREAMING\n\t| typeof RPC_ERROR_ENTRY_NOT_FOUND\n\t| typeof RPC_ERROR_NOT_ASSISTANT\n\t| typeof RPC_ERROR_NOT_USER\n\t| typeof RPC_ERROR_EMPTY_TEXT\n\t| typeof RPC_ERROR_STALE_LEAF;\n\n/** Every established command accepts an additive routing envelope. */\nexport type RpcCommand =\n\t| (RpcSessionCommand & { sessionId?: string })\n\t| { id?: string; type: \"get_protocol_info\" }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"open_session\";\n\t\t\tsessionPath?: string;\n\t\t\tcwd?: string;\n\t\t\tprovider?: string;\n\t\t\tmodelId?: string;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\tpermissionPreset?: string;\n\t\t\t/**\n\t\t\t * Keep this session alive when its last client disconnects (default false).\n\t\t\t * The drop only releases that client's attachment: the session stays listed\n\t\t\t * with `attachments: 0`, finishes its turn, and is re-attached by a later\n\t\t\t * `open_session` for the same `sessionPath`. Requires the host capability\n\t\t\t * `retain_on_disconnect`; older hosts ignore the field and close as before.\n\t\t\t */\n\t\t\tretain_on_disconnect?: boolean;\n\t\t\t/**\n\t\t\t * Visibility class of this session (default `interactive`). A `worker` session is\n\t\t\t * machine-driven work: it is omitted from `list_sessions` unless the caller asks\n\t\t\t * for workers, and its lifecycle records reach only connections attached to it.\n\t\t\t * Requires the host capability `session_kind`.\n\t\t\t */\n\t\t\tkind?: SessionKind;\n\t\t\t/**\n\t\t\t * Opaque labels for this session, readable by its own extensions as\n\t\t\t * `pi.sessionContext` and republished on `list_sessions { include_workers: true }`.\n\t\t\t * At most 32 keys matching `^[a-z][a-z0-9_]*$`, each value at most 16 KiB, at most\n\t\t\t * 32 KiB of JSON in total; anything else is refused with `invalid_session_context`.\n\t\t\t * The host never interprets them. Requires the host capability `session_context`.\n\t\t\t */\n\t\t\tcontext?: Record<string, string>;\n\t\t\t/**\n\t\t\t * Whether THIS session auto-generates a title from its first prompt (default:\n\t\t\t * the host's `--auto-title-sessions` / appMode decision). Requires the host\n\t\t\t * capability `auto_title_per_session`. A non-boolean is refused with\n\t\t\t * `invalid_launch_profile`.\n\t\t\t */\n\t\t\tauto_title?: boolean;\n\t\t\t/**\n\t\t\t * The durable session id to CREATE this session with, so a caller that already has a\n\t\t\t * stable record id for the conversation keeps ONE identity instead of maintaining a\n\t\t\t * mapping. Requires the host capability `durable_session_id`.\n\t\t\t *\n\t\t\t * Deliberately NOT named `sessionId`: the routing envelope above carries that name on\n\t\t\t * every established command, and this value is not a routing handle.\n\t\t\t *\n\t\t\t * Applied ONLY when this open creates the session. When `sessionPath` names an existing\n\t\t\t * session file, that file's header id stays authoritative and this field is ignored -\n\t\t\t * a resume never rewrites identity. Refused with `invalid_session_id` when malformed and\n\t\t\t * with `session_id_in_use` when a live session already holds it.\n\t\t\t */\n\t\t\tdurableSessionId?: string;\n\t }\n\t| { id?: string; type: \"close_session\"; sessionId: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"list_sessions\";\n\t\t\t/**\n\t\t\t * Include `kind: \"worker\"` rows, each with its `context` (default false). A\n\t\t\t * default listing publishes interactive sessions only and carries no `context`.\n\t\t\t */\n\t\t\tinclude_workers?: boolean;\n\t };\n\n// ============================================================================\n// Auth provider info (get_auth_providers response)\n// ============================================================================\n\n/** One provider row for the /login and /logout selectors. */\nexport interface RpcAuthProvider {\n\t/** Provider id (e.g. \"anthropic\", \"openai\"). */\n\tid: string;\n\t/** Human-readable display name. */\n\tname: string;\n\t/** How this provider authenticates. */\n\tauthType: \"oauth\" | \"api_key\";\n\t/** Auth status without exposing or refreshing any credential. */\n\tstatus: RpcAuthStatus;\n}\n\n/** Auth status mirror (no credential values), from getProviderAuthStatus. */\nexport interface RpcAuthStatus {\n\tconfigured: boolean;\n\tsource?:\n\t\t| \"stored\"\n\t\t| \"runtime\"\n\t\t| \"environment\"\n\t\t| \"fallback\"\n\t\t| \"models_json_key\"\n\t\t| \"models_json_command\"\n\t\t| \"models_json_headers\"\n\t\t| \"extension_headers\";\n\tlabel?: string;\n}\n\n/** Account-slot metadata safe to send to desktop clients. */\nexport interface RpcProviderAccount {\n\t/** Immutable selector ID; render displayName (name) when metadata is present. */\n\tname: string;\n\tdisplayName?: string;\n\tsource: \"login\" | \"import\" | \"env\";\n\tblocked: boolean;\n\tpinned: boolean;\n}\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** One extension module loaded by the session resource loader. */\nexport interface RpcLoadedExtension {\n\tname: string;\n\tpath: string;\n\tsourceInfo: SourceInfo;\n\tenabled: boolean;\n}\n\nexport type RpcMcpServerStatus =\n\t| \"enabled\"\n\t| \"disabled\"\n\t| \"untrusted\"\n\t| \"idle\"\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"degraded\"\n\t| \"suspended\"\n\t| \"needs_auth\"\n\t| \"needs_client_registration\";\n\n/** Runtime MCP server state projected from the session-owned MCP service. */\nexport interface RpcLoadedMcpServer {\n\tname: string;\n\ttoolCount: number;\n\tstatus: RpcMcpServerStatus;\n\tauthStatus: \"unsupported\" | \"notLoggedIn\" | \"bearerToken\" | \"oAuth\";\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionModelEntry {\n\tmodel: Model<any>;\n\tthinkingLevel?: ThinkingLevel;\n\tthinkingSelection?: ThinkingSelection;\n\tserviceTier?: ServiceTier;\n}\n\nexport interface RpcSessionState {\n\tmodel?: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\t/**\n\t * Explicit selector provenance for `thinkingLevel`, absent for SDK-defaulted\n\t * effective levels. An attached client cannot distinguish \"the user chose high\"\n\t * from \"high is simply the effective level\" without it.\n\t */\n\tthinkingSelection?: ThinkingSelection;\n\t/**\n\t * Abort owner of the most recent aborted turn, or the in-flight one while it is\n\t * still settling. Retained after settle: the live session getter is transient, so a\n\t * client that snapshots state after the turn ends would otherwise see nothing and\n\t * fall back to generic wording instead of \"Operation aborted\".\n\t */\n\tlastAbortSource?: AgentAbortSource;\n\t/** Service tier the session resolved for the active model, if any. */\n\tserviceTier?: ServiceTier;\n\t/** True when the active model is served at the priority (\"fast\") tier. */\n\tfastMode: boolean;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tcwd: string;\n\t/** Whether project-scoped settings and resources are trusted by the host. */\n\tprojectTrusted: boolean;\n\t/** Authoritative entries for setup-only sessions whose deferred file does not exist yet. */\n\tentries?: SessionEntry[];\n\tfavoriteModels: RpcSessionModelEntry[];\n\tscopedModels: RpcSessionModelEntry[];\n\tsteering: string[];\n\tfollowUp: string[];\n\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tusageTotals: UsageTotals;\n\tcontextUsage?: ContextUsage;\n\tretryAttempt: number;\n\tisBashRunning: boolean;\n\t/** Open question prompts awaiting an answer. Absent when none are pending. */\n\tpendingQuestions?: RpcQuestionUiRequest[];\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n/**\n * What a host was launched with. `extensions` are absolute roots, deduplicated and\n * sorted, so two hosts that loaded the same set produce the same bytes regardless of\n * the order their launchers passed them.\n */\nexport interface RpcLaunchProfileCore {\n\treadonly extensions: readonly string[];\n\treadonly multi_session: boolean;\n\treadonly session_runtime: SessionRuntimeKind;\n}\n\n/** `profile_id` = sha256 of the canonical JSON of `core` (keys sorted); any client can recompute it. */\nexport interface RpcLaunchProfile {\n\treadonly profile_id: string;\n\treadonly core: RpcLaunchProfileCore;\n}\n\n/**\n * Host identity. Compatibility and upgrade decisions are made from these fields -\n * `protocolVersion`, `capabilities` and `engineOrdinal` - NEVER from `serverVersion`,\n * which is informational only.\n */\nexport interface RpcProtocolIdentity {\n\t/** UUID minted at host boot; it changes when the host process does, including on a handoff. */\n\treadonly instanceId: string;\n\t/** Generation of this host within its daemon directory; 0 when nobody ensured it. */\n\treadonly generation: number;\n\t/** Engine build text: the package version plus `+<buildEpoch>.<sha7>` when the build defined them. */\n\treadonly engineVersion: string;\n\t/** `[year, month, day, postRelease, buildEpoch]`, compared with `compareEngineOrdinal`. */\n\treadonly engineOrdinal: EngineOrdinal;\n\treadonly launch_profile: RpcLaunchProfile;\n}\n\nexport interface RpcProtocolInfo extends RpcProtocolIdentity {\n\treadonly protocolVersion: 1;\n\t/** Informational engine version. Never compare it for compatibility - use the fields above. */\n\treadonly serverVersion: string;\n\treadonly capabilities: string[];\n\treadonly mode: \"classic\" | \"multi\";\n}\n\n// Success responses with data\nexport type RpcResponse =\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_protocol_info\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcProtocolInfo;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"open_session\";\n\t\t\tsuccess: true;\n\t\t\tdata: { sessionId: string; state: RpcSessionState; attached?: boolean };\n\t }\n\t| { id?: string; type: \"response\"; command: \"close_session\"; success: true; data: Record<string, never> }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"list_sessions\";\n\t\t\tsuccess: true;\n\t\t\tdata: {\n\t\t\t\tsessions: Array<{\n\t\t\t\t\tsessionId: string;\n\t\t\t\t\tdurableSessionId?: string;\n\t\t\t\t\tsessionPath?: string;\n\t\t\t\t\tcwd: string;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t\t\t\t/** Live client attachments; `0` is a retained session with no client attached. */\n\t\t\t\t\tattachments: number;\n\t\t\t\t}>;\n\t\t\t};\n\t }\n\t// Prompting (async - events follow)\n\t// data.disposition reports how the host disposed the prompt (started/queued/handled)\n\t// so proxied optimistic-echo contracts resolve exactly like the local path; older\n\t// hosts omit it and clients must degrade to canonical-only rendering.\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true; data?: { disposition?: PromptDisposition } }\n\t| { id?: string; type: \"response\"; command: \"send_custom_message\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"append_user_message\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"append_session_entry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true; data: { cancelled: boolean; reason?: string } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"check_reload_veto\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; reason?: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: {\n\t\t\t\tsteering: string[];\n\t\t\t\tfollowUp: string[];\n\t\t\t\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\t\t\t};\n\t }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<any> & { systemPromptName?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_favorite_models\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_scoped_models\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<any>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: Array<Model<any> & { supportedThinkingLevels: ThinkingLevel[] }> };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Fast mode\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_fast_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { enabled: boolean; serviceTier: ServiceTier; provider: string; modelId: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fast_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { enabled: boolean; serviceTier: ServiceTier | null };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: CompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\t/**\n\t\t\t * `NavigateTreeResult` answers an `entryId` navigation; the shipped shape answers a\n\t\t\t * `targetId` one. Both report `leafId` - the leaf the session was left on, `null` for an\n\t\t\t * empty conversation - so a client resynchronizes in one round trip on either spelling.\n\t\t\t */\n\t\t\tdata:\n\t\t\t\t| NavigateTreeResult\n\t\t\t\t| {\n\t\t\t\t\t\tcancelled: boolean;\n\t\t\t\t\t\tleafId: string | null;\n\t\t\t\t\t\teditorText?: string;\n\t\t\t\t\t\taborted?: boolean;\n\t\t\t\t\t\tsummaryEntry?: unknown;\n\t\t\t\t };\n\t }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"export_jsonl\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"edit_assistant_message\";\n\t\t\tsuccess: true;\n\t\t\tdata: EditAssistantMessageResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"edit_user_message\";\n\t\t\tsuccess: true;\n\t\t\tdata: EditUserMessageResult;\n\t }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"import_jsonl\"; success: true; data: { cancelled: boolean } }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_media\";\n\t\t\tsuccess: true;\n\t\t\tdata: { toolCallId: string; contentIndex: number; content: ImageContent };\n\t }\n\n\t// Commands and loaded runtime surfaces\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_loaded_surfaces\";\n\t\t\tsuccess: true;\n\t\t\tdata: { extensions: RpcLoadedExtension[]; mcpServers: RpcLoadedMcpServer[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"extension_request\";\n\t\t\tsuccess: true;\n\t\t\tdata: unknown;\n\t }\n\n\t// Auth (task 13)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_auth_providers\";\n\t\t\tsuccess: true;\n\t\t\tdata: { providers: RpcAuthProvider[] };\n\t }\n\t// login_start returns immediately: success:true means the flow has started.\n\t// The URL and completion arrive as auth_login_url / auth_login_end events.\n\t| { id?: string; type: \"response\"; command: \"login_start\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"login_cancel\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"login_api_key\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"logout\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_provider_accounts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { accounts: RpcProviderAccount[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"account_pin\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"account_remove\"; success: true }\n\n\t// Error response (any command can fail)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t\t\terrorCode?: string;\n\t\t\terrorData?: unknown;\n\t };\n\n/** Success payload of `edit_assistant_message`. `leafId` is the session leaf after the call. */\nexport type EditAssistantMessageResult =\n\t| { outcome: \"edited\"; entry: SessionMessageEntry; leafId: string; summaryEntryId?: string }\n\t| { outcome: \"unchanged\"; leafId: string | null }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n/**\n * Success payload of `edit_user_message`, mirroring `EditAssistantMessageResult`. `leafId` is the\n * session leaf after the call and is reported on EVERY outcome so a client resynchronizes in one\n * round trip; it is `null` when the call left the session on an empty conversation.\n */\nexport type EditUserMessageResult =\n\t| { outcome: \"edited\"; entry: SessionMessageEntry; leafId: string; summaryEntryId?: string }\n\t| { outcome: \"unchanged\"; leafId: string | null }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n/**\n * Success payload of an `entryId`-addressed `navigate_tree`. `editorText` is present when the\n * intent is selection and the target is a user/custom message, as in the TUI editor. Resumption\n * never returns editor text. `leafId` is `null` when selection reset the session to an empty\n * conversation, which is what selecting the root user message does.\n */\nexport type NavigateTreeResult =\n\t| { outcome: \"navigated\"; leafId: string | null; editorText?: string; summaryEntryId?: string }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** One question in an RPC `question` UI request. Matches canonical QuestionRequest.questions. */\nexport type RpcQuestionSpec = {\n\tid: string;\n\theader: string;\n\tquestion: string;\n\toptions: Array<{ label: string; description?: string }>;\n\tmultiSelect: boolean;\n};\n\nexport type RpcQuestionAnswers = Record<string, { selected: string[]; text?: string }>;\n\nexport type RpcQuestionOutcome =\n\t| \"answered\"\n\t| \"comment-submitted\"\n\t| \"timed_out\"\n\t| \"cancelled\"\n\t| \"orphaned-after-restart\"\n\t| \"unavailable\";\n\n/** Outbound `extension_ui_request` body for method `question`. */\nexport type RpcQuestionUiRequest = {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"question\";\n\trequestId: string;\n\ttoolCallId: string;\n\twaitForAnswer: boolean;\n\tquestions: RpcQuestionSpec[];\n\ttimeout: number;\n\taskedAtMs: number;\n\tdeadlineAtMs: number;\n\tremainingMs: number;\n};\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setHeader\" | \"setFooter\";\n\t\t\twidgetLines: string[] | undefined;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t// Additive (task 13/14): emitted ONLY when the client advertised the\n\t// \"custom_unsupported\" capability. ctx.ui.custom cannot render a third-party\n\t// component in RPC mode, so a flagged client gets this notice before custom()\n\t// returns undefined. Default clients never see it (byte-identical behavior).\n\t| { type: \"extension_ui_request\"; id: string; method: \"custom_unsupported\"; extensionName: string }\n\t| RpcQuestionUiRequest;\n\nexport type RpcExtensionEvent = {\n\ttype: \"extension_event\";\n\tname: string;\n\tdata: unknown;\n};\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true }\n\t| { type: \"extension_ui_response\"; id: string; answers: RpcQuestionAnswers; comment?: string };\n\n/** Inbound draft updates for an open `question` request. */\nexport type RpcExtensionUIProgress = {\n\ttype: \"extension_ui_progress\";\n\tid: string;\n\tanswers?: RpcQuestionAnswers;\n\tcomment?: string;\n\tsessionId?: string;\n};\n\n/** Stdin records: session/host commands plus extension-UI replies and progress. */\nexport type RpcInboundRecord = RpcCommand | RpcExtensionUIResponse | RpcExtensionUIProgress;\n\n/** Outbound deadline refresh for an open `question` request. */\nexport type RpcQuestionUpdatedEvent = {\n\ttype: \"question_updated\";\n\tid: string;\n\tdeadlineAtMs: number;\n\tremainingMs: number;\n};\n\n/** Outbound terminal outcome for a `question` request. */\nexport type RpcQuestionResolvedEvent = {\n\ttype: \"question_resolved\";\n\tid: string;\n\trequestId: string;\n\ttoolCallId: string;\n\toutcome: RpcQuestionOutcome;\n\tanswers: RpcQuestionAnswers;\n\tcomment?: string;\n\tunanswered: string[];\n\tdeadlineAtMs?: number;\n};\n\n/** Emitted when the effective session thinking level changes. */\nexport interface RpcThinkingLevelChangedEvent {\n\ttype: \"thinking_level_changed\";\n\tlevel: ThinkingLevel;\n\t/**\n\t * Selector provenance in force after the change; absent when the level is an\n\t * SDK-defaulted effective level rather than an explicit choice. Additive: an old\n\t * client that does not know the field ignores it.\n\t */\n\tthinkingSelection?: ThinkingSelection;\n}\n\nexport interface RpcHighReasoningWarningEvent {\n\ttype: \"high_reasoning_warning\";\n\tmodelId: string;\n\tprovider: string;\n\tthinkingLevel: ThinkingLevel;\n}\n\n/** Emitted after explicit skill tokens are expanded for a user-authored request. */\nexport interface RpcSkillInvocationEvent {\n\ttype: \"skill_invocation\";\n\tskills: readonly {\n\t\tname: string;\n\t\tpath: string;\n\t\tsyntax: \"dollar\" | \"slash\";\n\t}[];\n}\n\n/** Emitted when startup or reload selects an existing settings file. */\nexport interface RpcSettingsSourceSelectedEvent {\n\ttype: \"settings_source_selected\";\n\tpath: string;\n\tformat: \"jsonc\" | \"json\";\n\treason: \"explicit-jsonc\" | \"json-only\";\n\tscope: \"global\" | \"project\";\n}\n\n/**\n * Emitted after the session's active model changed, with the thinking level in force AFTER\n * the switch (per-model memory, a favorite's pinned level, or the clamped previous level).\n *\n * Clients that tracked the model by inferring it from `entry_appended` can consume this\n * instead. Additive: an old client that does not know the type filters it out.\n */\nexport interface RpcModelChangedEvent {\n\ttype: \"model_changed\";\n\tmodel: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\t/** Why the model changed: \"set\", \"cycle\", \"restore\", \"fallback\", or \"fallback-revert\". */\n\tsource: string;\n\t/** Selector provenance for `thinkingLevel` after the switch, when one was explicit. */\n\tthinkingSelection?: ThinkingSelection;\n}\n\n/** Emitted when the effective service tier or fast-mode state of the session changes. */\nexport interface RpcServiceTierChangedEvent {\n\ttype: \"service_tier_changed\";\n\ttier?: ServiceTier;\n\tfastMode: boolean;\n}\n/**\n * Emitted after the host swapped the live session behind this connection (new session,\n * fork, or switch), carrying the new authoritative identity.\n *\n * A replacement can be initiated by ANY attached client. Without this event the other\n * attached clients keep their stale identity and keep routing replacement-dependent\n * actions at the session that no longer exists. Additive: an old client that does not\n * know the type filters it out.\n */\nexport interface RpcSessionReplacedEvent {\n\ttype: \"session_replaced\";\n\t/**\n\t * Durable session id of the session now bound to this connection.\n\t *\n\t * Deliberately NOT `sessionId`: top-level `sessionId` is reserved for the\n\t * per-connection routing handle that multi-session hosts tag every record\n\t * with, and that tag is applied last - it would overwrite this value and\n\t * leave the event carrying no identity at all.\n\t */\n\tdurableSessionId: string;\n\t/** Session file backing the new session, absent for a deferred setup-only session. */\n\tsessionFile?: string;\n\tcwd: string;\n\tsessionName?: string;\n}\n\n/**\n * Emitted when a shared host PARKS a session instead of closing it: the idle window\n * elapsed for a session opened with `retain_on_disconnect`, so the host released the\n * routing handle while the session itself stays on disk.\n *\n * It replaces `session_closed` for that handle - a parked session was not ended, and\n * `open_session { sessionPath }` reopens it (as a NEW routing handle). Additive: a\n * client that does not know the type filters it out and learns the handle is gone\n * from its next command's `unknown_session`.\n */\nexport type RpcSessionParkedEvent = {\n\ttype: \"session_parked\";\n\t/** Routing handle that was released; it never resolves again. */\n\tsessionId: string;\n\t/** Session file to reopen this session by. */\n\tsessionPath: string;\n};\n\n/**\n * Why a `session_closed` record was emitted, when the host names a reason.\n *\n * Optional on the wire and open to new members: a client that does not recognise a reason, or\n * receives a record with no `reason` field, treats it exactly as it treated a reason-less one.\n * Never required in decoders.\n *\n * - `client_close`: an attached client sent `close_session`.\n * - `idle_evicted`: the idle sweep ended a session that was not retained.\n * - `host_shutdown`: the host process is exiting (SIGTERM / idle-exit / empty-host).\n * - `replaced`: the live session behind this handle was swapped (`session_replaced` is the\n * in-place identity event; this reason is for a handle that ended because of a replacement).\n * - `handoff_parked`: a generation handoff drained this host and put the session back on disk.\n * The session was not ended - `open_session { sessionPath }` reopens it in the new generation.\n * - `error`: the session failed (worker death, output overflow) and the host sealed it.\n */\nexport type RpcSessionClosedReason =\n\t| \"client_close\"\n\t| \"idle_evicted\"\n\t| \"host_shutdown\"\n\t| \"replaced\"\n\t| \"handoff_parked\"\n\t| \"error\";\n\n/** Terminal record of a closed routing handle. `reason` is absent on older hosts and older records. */\nexport type RpcSessionClosedEvent = {\n\ttype: \"session_closed\";\n\tsessionId: string;\n\treason?: RpcSessionClosedReason;\n\t/** File released by handoff parking; reopen it on the successor. */\n\tsessionPath?: string;\n};\n\n/** Sent once to every connection before this generation starts parking for a handoff. */\nexport interface RpcHostSupersededEvent {\n\ttype: \"host_superseded\";\n\tinstanceId: string;\n\tgeneration: number;\n\t/** Public endpoint of the successor, or null for a drain without a known successor. */\n\tsuccessor: { socket: string } | null;\n}\n\nexport type RpcHostLifecycleEvent = RpcHostSupersededEvent | RpcHostStalledEvent | RpcHostMemoryPressureEvent;\n\n/** Emitted after the loaded skill, extension, or MCP inventory changes. */\nexport interface RpcLoadedSurfacesChangedEvent {\n\ttype: \"loaded_surfaces_changed\";\n}\n\n/** Emitted after an account is added, removed, pinned, or blocked by refresh failure. */\nexport interface RpcAuthAccountsChangedEvent {\n\ttype: \"auth_accounts_changed\";\n\tprovider: string;\n}\n\n/**\n * Emitted when the host's event loop was blocked long enough to stall every session it\n * serves, naming the routing handle and tool whose work held it when that can be\n * attributed. Informational: the host never aborts or refuses anything because of it.\n */\n/**\n * Sent to ONE opener the moment its `open_session` is accepted, before the open enters the\n * session loop. The in-process host serves opens one at a time, so a burst queues; without this\n * the client's only signal is a deadline it cannot explain (senpi#1844).\n *\n * `for_request` carries the opener's request id deliberately, NOT the response-id field: a client\n * settles pending requests by response id, and a queued record wearing the open's id would be\n * taken as the open's reply.\n */\nexport interface RpcOpenQueuedEvent {\n\ttype: \"queued\";\n\t/** The `open_session` request this position belongs to. */\n\tfor_request: string;\n\t/** 1-based place in the open queue at the moment of acceptance. */\n\tposition: number;\n\t/** Opens already in flight when this one arrived; `position` is this plus one. */\n\tin_flight: number;\n}\n\nexport interface RpcHostStalledEvent {\n\ttype: \"host_stalled\";\n\t/** How late the host's own 200ms timer was invoked, i.e. how long the loop was held. */\n\tdriftMs: number;\n\t/** Routing handle blamed for the stall, absent when no session work was running. */\n\tsessionId?: string;\n\t/** Tool that session was executing, when the stall happened inside one. */\n\ttool?: string;\n}\n\n/**\n * Emitted while the host process is above its RSS warning threshold. Capacity is memory,\n * never a refusal: the host reports the pressure and parks idle sessions sooner, and\n * never declines or kills a session because of it.\n */\nexport interface RpcHostMemoryPressureEvent {\n\ttype: \"host_memory_pressure\";\n\t/** Resident set size of the host process, in megabytes. */\n\trssMb: number;\n\t/** Live sessions the host is holding, including ones opening or closing. */\n\tsessions: number;\n}\n\n/** Emitted when the SDK failover engine advances to a different account slot. */\nexport interface RpcAccountFailoverEvent {\n\ttype: \"account_failover\";\n\tprovider: string;\n\tfrom: string;\n\tto: string;\n\treason: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8MH,iDAAiD;AACjD,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AACnE,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;AAC/E,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,mGAAmG;AACnG,MAAM,CAAC,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;AAC3E,uGAAuG;AACvG,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AACrE,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AACzE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AACrE,mGAAmG;AACnG,gGAAgG;AAChG,8FAA8F;AAC9F,kCAAkC;AAClC,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;AACrD,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { ImageContent, Model, ThinkingSelection } from \"@earendil-works/pi-ai\";\nimport type { SessionRuntimeKind } from \"../../cli/args.ts\";\nimport type { AgentAbortSource } from \"../../core/agent-abort-provenance.ts\";\nimport type { PromptDisposition, SessionStats } from \"../../core/agent-session.ts\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { CompactionResult } from \"../../core/compaction/index.ts\";\nimport type { EngineOrdinal } from \"../../core/engine-build-identity.ts\";\nimport type { ServiceTier } from \"../../core/extensions/builtin/service-tier.ts\";\nimport type { ContextUsage, SessionKind } from \"../../core/extensions/types.ts\";\nimport type { SessionEntry, SessionMessageEntry, SessionTreeNode, UsageTotals } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { RpcSlashCommand } from \"./rpc-command-surface.ts\";\n\nexport type { SessionContext, SessionKind } from \"../../core/extensions/types.ts\";\nexport type { RpcCommandInvocationEvent } from \"./rpc-command-invocation.ts\";\nexport type { RpcCommandsChangedEvent, RpcSlashCommand } from \"./rpc-command-surface.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\ntype RpcSessionCommand =\n\t// Prompting\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"prompt\";\n\t\t\tmessage: string;\n\t\t\timages?: ImageContent[];\n\t\t\tstreamingBehavior?: \"steer\" | \"followUp\";\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\tsessionTitlePrompt?: string | false;\n\t\t\texpandPromptTemplates?: boolean;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"send_custom_message\";\n\t\t\tcustomType: string;\n\t\t\tcontent: unknown;\n\t\t\tdisplay: boolean;\n\t\t\tdetails?: unknown;\n\t\t\ttriggerTurn?: boolean;\n\t\t\tdeliverAs?: \"steer\" | \"followUp\" | \"nextTurn\";\n\t }\n\t| { id?: string; type: \"append_user_message\"; content: unknown }\n\t| { id?: string; type: \"append_session_entry\"; entry: SessionEntry }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[]; enqueueOrder?: number }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[]; enqueueOrder?: number }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"abort_compaction\" }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"check_reload_veto\" }\n\t| { id?: string; type: \"clear_queue\"; abortWillFollow?: boolean }\n\t| { id?: string; type: \"get_steering_messages\" }\n\t| { id?: string; type: \"get_follow_up_messages\" }\n\t| { id?: string; type: \"abort_branch_summary\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"set_favorite_models\"; models: RpcSessionModelEntry[] }\n\t| { id?: string; type: \"set_scoped_models\"; models: RpcSessionModelEntry[] }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel; scope?: \"turn\" }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Fast mode (ChatGPT Subscription priority service tier)\n\t| { id?: string; type: \"set_fast_mode\"; enabled: boolean }\n\t| { id?: string; type: \"get_fast_mode\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\"; customInstructions?: string }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"bash\";\n\t\t\tcommand: string;\n\t\t\t/** Identifies output chunks to the requesting client. */\n\t\t\tbashId?: string;\n\t\t\texcludeFromContext?: boolean;\n\t\t\texecutionId?: string;\n\t\t\toperations?: Record<string, unknown>;\n\t }\n\t| { id?: string; type: \"record_bash_result\"; command: string; result: BashResult; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\" }\n\t| { id?: string; type: \"cleanup_bash_output\"; path: string }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| ({\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\t/** Select for retry (default), or resume the exact entry as leaf with no editorText. */\n\t\t\tintent?: \"select\" | \"resume\";\n\t\t\t/** Leaf the client last observed; the navigation is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t\t\treplaceInstructions?: boolean;\n\t\t\tlabel?: string;\n\t } & (\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Entry to navigate to. Unless intent is `resume`, the host applies the `/tree`\n\t\t\t\t\t * selection rule of `docs/sessions.md`: a user/custom target selects its PARENT and\n\t\t\t\t\t * returns `editorText`; any other kind moves the leaf TO the entry with no `editorText`;\n\t\t\t\t\t * the root user message resets the leaf to an empty conversation (`leafId: null`). A\n\t\t\t\t\t * client therefore never computes a parent id. Answers `NavigateTreeResult`.\n\t\t\t\t\t */\n\t\t\t\t\tentryId: string;\n\t\t\t\t\ttargetId?: never;\n\t\t\t }\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Original spelling, kept for the TUI and shipped clients. By default applies the selection\n\t\t\t\t\t * rule as `entryId`: user/custom targets select their PARENT and return `editorText`,\n\t\t\t\t\t * other targets select themselves, and a root user target yields `leafId: null`.\n\t\t\t\t\t * Answers the legacy `{ cancelled, leafId, editorText? }` payload. New clients use `entryId`.\n\t\t\t\t\t */\n\t\t\t\t\ttargetId: string;\n\t\t\t\t\tentryId?: never;\n\t\t\t }\n\t ))\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string; themeName?: string }\n\t| { id?: string; type: \"export_jsonl\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string; position?: \"before\" | \"at\" }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"edit_assistant_message\";\n\t\t\tentryId: string;\n\t\t\ttext: string;\n\t\t\t/** Leaf the client last observed; the edit is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"edit_user_message\";\n\t\t\tentryId: string;\n\t\t\ttext: string;\n\t\t\t/** Leaf the client last observed; the edit is refused with `stale_leaf` when the session moved on. */\n\t\t\texpectedLeafId?: string;\n\t\t\tsummarize?: boolean;\n\t\t\tcustomInstructions?: string;\n\t }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| { id?: string; type: \"import_jsonl\"; inputPath: string; cwdOverride?: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\t/**\n\t * Fetch one media block a `media_placeholders` client received as an `image_ref`\n\t * stub. `contentIndex` indexes the toolResult's `content` array and must point at\n\t * an image block; anything else answers `media_not_found`.\n\t */\n\t| { id?: string; type: \"get_media\"; toolCallId: string; contentIndex: number }\n\n\t// Commands and loaded runtime surfaces\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_loaded_surfaces\" }\n\t| { id?: string; type: \"extension_request\"; name: string; data?: unknown }\n\n\t// Auth (task 13) is additive. get_auth_providers, login_api_key and logout\n\t// answer synchronously. login_start responds immediately (flow-started) and\n\t// completion is delivered via auth_login_url / auth_login_end EVENTS, because\n\t// an interactive OAuth round-trip cannot fit the 30s request timeout.\n\t| { id?: string; type: \"get_auth_providers\" }\n\t| { id?: string; type: \"login_start\"; provider: string }\n\t| { id?: string; type: \"login_cancel\"; provider: string }\n\t| { id?: string; type: \"login_api_key\"; provider: string; key: string }\n\t| { id?: string; type: \"logout\"; provider: string }\n\n\t// Provider accounts (task 13) are additive. The desktop consumer contract\n\t// lives in ../omo-desktop-app/packages/contracts/src/rpc.ts and is updated separately.\n\t| { id?: string; type: \"get_provider_accounts\"; provider: string }\n\t| { id?: string; type: \"account_pin\"; provider: string; name: string | null }\n\t| { id?: string; type: \"account_remove\"; provider: string; name: string }\n\t| { id?: string; type: \"set_client_info\"; width: number; capabilities?: string[] };\n\n/** Stable multi-session protocol error codes. */\nexport const RPC_ERROR_UNKNOWN_SESSION = \"unknown_session\";\nexport const RPC_ERROR_SESSION_CLOSING = \"session_closing\";\nexport const RPC_ERROR_SESSION_PATH_IN_USE = \"session_path_in_use\";\nexport const RPC_ERROR_SESSION_RESERVATION_LIMIT = \"session_reservation_limit\";\nexport const RPC_ERROR_MISSING_SESSION_ID = \"missing_session_id\";\nexport const RPC_ERROR_MULTI_SESSION_DISABLED = \"multi_session_disabled\";\nexport const RPC_ERROR_INVALID_PATH = \"invalid_path\";\nexport const RPC_ERROR_OPEN_FAILED = \"open_failed\";\nexport const RPC_ERROR_MEDIA_NOT_FOUND = \"media_not_found\";\n/** `open_session.context` broke a documented cap (key count, key syntax, value or total bytes). */\nexport const RPC_ERROR_INVALID_SESSION_CONTEXT = \"invalid_session_context\";\n/** `open_session.kind` was neither `interactive` nor `worker`; an unknown kind is never downgraded. */\nexport const RPC_ERROR_INVALID_SESSION_KIND = \"invalid_session_kind\";\n/** A launch-profile field on `open_session` (currently `auto_title`) was the wrong type. */\nexport const RPC_ERROR_INVALID_LAUNCH_PROFILE = \"invalid_launch_profile\";\n/** `open_session.durableSessionId` was not a legal session id (see `assertValidSessionId`). */\nexport const RPC_ERROR_INVALID_SESSION_ID = \"invalid_session_id\";\n/**\n * `open_session.durableSessionId` is already held by a LIVE session. Two live sessions may\n * never share one durable id: every per-session artifact a client keys by that id (goal files,\n * subagent and team attribution) would collide. Close the holder, or open with a different id.\n */\nexport const RPC_ERROR_SESSION_ID_IN_USE = \"session_id_in_use\";\n/**\n * The host is above its RSS refuse watermark and declined to create a NEW worker session;\n * `errorData { rssMb, retry_after_ms }` says when to ask again. Existing sessions, attaches\n * to a live path and interactive opens are never refused for memory.\n */\nexport const RPC_ERROR_HOST_MEMORY_PRESSURE = \"host_memory_pressure\";\n// Message-edit and tree-navigation failures (mirror AssistantEditError.code / UserEditError.code /\n// SessionStreamingError.code). Every code lives in the one shared RpcErrorCode union below: the\n// failure response is a single catch-all member, so a command's codes are a documented SUBSET\n// rather than a per-command type.\nexport const RPC_ERROR_STREAMING = \"streaming\";\nexport const RPC_ERROR_ENTRY_NOT_FOUND = \"not_found\";\nexport const RPC_ERROR_NOT_ASSISTANT = \"not_assistant\";\nexport const RPC_ERROR_NOT_USER = \"not_user\";\nexport const RPC_ERROR_EMPTY_TEXT = \"empty\";\nexport const RPC_ERROR_STALE_LEAF = \"stale_leaf\";\n\nexport type RpcErrorCode =\n\t| typeof RPC_ERROR_UNKNOWN_SESSION\n\t| typeof RPC_ERROR_SESSION_CLOSING\n\t| typeof RPC_ERROR_SESSION_PATH_IN_USE\n\t| typeof RPC_ERROR_SESSION_RESERVATION_LIMIT\n\t| typeof RPC_ERROR_MISSING_SESSION_ID\n\t| typeof RPC_ERROR_MULTI_SESSION_DISABLED\n\t| typeof RPC_ERROR_INVALID_PATH\n\t| typeof RPC_ERROR_OPEN_FAILED\n\t| typeof RPC_ERROR_MEDIA_NOT_FOUND\n\t| typeof RPC_ERROR_INVALID_SESSION_CONTEXT\n\t| typeof RPC_ERROR_INVALID_SESSION_KIND\n\t| typeof RPC_ERROR_INVALID_LAUNCH_PROFILE\n\t| typeof RPC_ERROR_INVALID_SESSION_ID\n\t| typeof RPC_ERROR_SESSION_ID_IN_USE\n\t| typeof RPC_ERROR_HOST_MEMORY_PRESSURE\n\t| typeof RPC_ERROR_STREAMING\n\t| typeof RPC_ERROR_ENTRY_NOT_FOUND\n\t| typeof RPC_ERROR_NOT_ASSISTANT\n\t| typeof RPC_ERROR_NOT_USER\n\t| typeof RPC_ERROR_EMPTY_TEXT\n\t| typeof RPC_ERROR_STALE_LEAF;\n\n/** Every established command accepts an additive routing envelope. */\nexport type RpcCommand =\n\t| (RpcSessionCommand & { sessionId?: string })\n\t| { id?: string; type: \"get_protocol_info\" }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"open_session\";\n\t\t\tsessionPath?: string;\n\t\t\tcwd?: string;\n\t\t\tprovider?: string;\n\t\t\tmodelId?: string;\n\t\t\tthinkingLevel?: ThinkingLevel;\n\t\t\tpermissionPreset?: string;\n\t\t\t/**\n\t\t\t * Keep this session alive when its last client disconnects (default false).\n\t\t\t * The drop only releases that client's attachment: the session stays listed\n\t\t\t * with `attachments: 0`, finishes its turn, and is re-attached by a later\n\t\t\t * `open_session` for the same `sessionPath`. Requires the host capability\n\t\t\t * `retain_on_disconnect`; older hosts ignore the field and close as before.\n\t\t\t */\n\t\t\tretain_on_disconnect?: boolean;\n\t\t\t/**\n\t\t\t * Visibility class of this session (default `interactive`). A `worker` session is\n\t\t\t * machine-driven work: it is omitted from `list_sessions` unless the caller asks\n\t\t\t * for workers, and its lifecycle records reach only connections attached to it.\n\t\t\t * Requires the host capability `session_kind`.\n\t\t\t */\n\t\t\tkind?: SessionKind;\n\t\t\t/**\n\t\t\t * Opaque labels for this session, readable by its own extensions as\n\t\t\t * `pi.sessionContext` and republished on `list_sessions { include_workers: true }`.\n\t\t\t * At most 32 keys matching `^[a-z][a-z0-9_]*$`, each value at most 16 KiB, at most\n\t\t\t * 32 KiB of JSON in total; anything else is refused with `invalid_session_context`.\n\t\t\t * The host never interprets them. Requires the host capability `session_context`.\n\t\t\t */\n\t\t\tcontext?: Record<string, string>;\n\t\t\t/**\n\t\t\t * Whether THIS session auto-generates a title from its first prompt (default:\n\t\t\t * the host's `--auto-title-sessions` / appMode decision). Requires the host\n\t\t\t * capability `auto_title_per_session`. A non-boolean is refused with\n\t\t\t * `invalid_launch_profile`.\n\t\t\t */\n\t\t\tauto_title?: boolean;\n\t\t\t/**\n\t\t\t * The durable session id to CREATE this session with, so a caller that already has a\n\t\t\t * stable record id for the conversation keeps ONE identity instead of maintaining a\n\t\t\t * mapping. Requires the host capability `durable_session_id`.\n\t\t\t *\n\t\t\t * Deliberately NOT named `sessionId`: the routing envelope above carries that name on\n\t\t\t * every established command, and this value is not a routing handle.\n\t\t\t *\n\t\t\t * Applied ONLY when this open creates the session. When `sessionPath` names an existing\n\t\t\t * session file, that file's header id stays authoritative and this field is ignored -\n\t\t\t * a resume never rewrites identity. Refused with `invalid_session_id` when malformed and\n\t\t\t * with `session_id_in_use` when a live session already holds it.\n\t\t\t */\n\t\t\tdurableSessionId?: string;\n\t }\n\t| { id?: string; type: \"close_session\"; sessionId: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"list_sessions\";\n\t\t\t/**\n\t\t\t * Include `kind: \"worker\"` rows, each with its `context` (default false). A\n\t\t\t * default listing publishes interactive sessions only and carries no `context`.\n\t\t\t */\n\t\t\tinclude_workers?: boolean;\n\t };\n\n// ============================================================================\n// Auth provider info (get_auth_providers response)\n// ============================================================================\n\n/** One provider row for the /login and /logout selectors. */\nexport interface RpcAuthProvider {\n\t/** Provider id (e.g. \"anthropic\", \"openai\"). */\n\tid: string;\n\t/** Human-readable display name. */\n\tname: string;\n\t/** How this provider authenticates. */\n\tauthType: \"oauth\" | \"api_key\";\n\t/** Auth status without exposing or refreshing any credential. */\n\tstatus: RpcAuthStatus;\n}\n\n/** Auth status mirror (no credential values), from getProviderAuthStatus. */\nexport interface RpcAuthStatus {\n\tconfigured: boolean;\n\tsource?:\n\t\t| \"stored\"\n\t\t| \"runtime\"\n\t\t| \"environment\"\n\t\t| \"fallback\"\n\t\t| \"models_json_key\"\n\t\t| \"models_json_command\"\n\t\t| \"models_json_headers\"\n\t\t| \"extension_headers\";\n\tlabel?: string;\n}\n\n/** Account-slot metadata safe to send to desktop clients. */\nexport interface RpcProviderAccount {\n\t/** Immutable selector ID; render displayName (name) when metadata is present. */\n\tname: string;\n\tdisplayName?: string;\n\tsource: \"login\" | \"import\" | \"env\";\n\tblocked: boolean;\n\tpinned: boolean;\n}\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** One extension module loaded by the session resource loader. */\nexport interface RpcLoadedExtension {\n\tname: string;\n\tpath: string;\n\tsourceInfo: SourceInfo;\n\tenabled: boolean;\n}\n\nexport type RpcMcpServerStatus =\n\t| \"enabled\"\n\t| \"disabled\"\n\t| \"untrusted\"\n\t| \"idle\"\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"degraded\"\n\t| \"suspended\"\n\t| \"needs_auth\"\n\t| \"needs_client_registration\";\n\n/** Runtime MCP server state projected from the session-owned MCP service. */\nexport interface RpcLoadedMcpServer {\n\tname: string;\n\ttoolCount: number;\n\tstatus: RpcMcpServerStatus;\n\tauthStatus: \"unsupported\" | \"notLoggedIn\" | \"bearerToken\" | \"oAuth\";\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionModelEntry {\n\tmodel: Model<any>;\n\tthinkingLevel?: ThinkingLevel;\n\tthinkingSelection?: ThinkingSelection;\n\tserviceTier?: ServiceTier;\n}\n\nexport interface RpcSessionState {\n\tmodel?: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\t/**\n\t * Explicit selector provenance for `thinkingLevel`, absent for SDK-defaulted\n\t * effective levels. An attached client cannot distinguish \"the user chose high\"\n\t * from \"high is simply the effective level\" without it.\n\t */\n\tthinkingSelection?: ThinkingSelection;\n\t/**\n\t * Abort owner of the most recent aborted turn, or the in-flight one while it is\n\t * still settling. Retained after settle: the live session getter is transient, so a\n\t * client that snapshots state after the turn ends would otherwise see nothing and\n\t * fall back to generic wording instead of \"Operation aborted\".\n\t */\n\tlastAbortSource?: AgentAbortSource;\n\t/** Service tier the session resolved for the active model, if any. */\n\tserviceTier?: ServiceTier;\n\t/** True when the active model is served at the priority (\"fast\") tier. */\n\tfastMode: boolean;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tcwd: string;\n\t/** Whether project-scoped settings and resources are trusted by the host. */\n\tprojectTrusted: boolean;\n\t/** Authoritative entries for setup-only sessions whose deferred file does not exist yet. */\n\tentries?: SessionEntry[];\n\tfavoriteModels: RpcSessionModelEntry[];\n\tscopedModels: RpcSessionModelEntry[];\n\tsteering: string[];\n\tfollowUp: string[];\n\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tusageTotals: UsageTotals;\n\tcontextUsage?: ContextUsage;\n\tretryAttempt: number;\n\tisBashRunning: boolean;\n\t/** Open question prompts awaiting an answer. Absent when none are pending. */\n\tpendingQuestions?: RpcQuestionUiRequest[];\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n/**\n * What a host was launched with. `extensions` are absolute roots, deduplicated and\n * sorted, so two hosts that loaded the same set produce the same bytes regardless of\n * the order their launchers passed them.\n */\nexport interface RpcLaunchProfileCore {\n\treadonly extensions: readonly string[];\n\treadonly multi_session: boolean;\n\treadonly session_runtime: SessionRuntimeKind;\n}\n\n/** `profile_id` = sha256 of the canonical JSON of `core` (keys sorted); any client can recompute it. */\nexport interface RpcLaunchProfile {\n\treadonly profile_id: string;\n\treadonly core: RpcLaunchProfileCore;\n}\n\n/**\n * Host identity. Compatibility and upgrade decisions are made from these fields -\n * `protocolVersion`, `capabilities` and `engineOrdinal` - NEVER from `serverVersion`,\n * which is informational only.\n */\nexport interface RpcProtocolIdentity {\n\t/** UUID minted at host boot; it changes when the host process does, including on a handoff. */\n\treadonly instanceId: string;\n\t/** Generation of this host within its daemon directory; 0 when nobody ensured it. */\n\treadonly generation: number;\n\t/** Engine build text: the package version plus `+<buildEpoch>.<sha7>` when the build defined them. */\n\treadonly engineVersion: string;\n\t/** `[year, month, day, postRelease, buildEpoch]`, compared with `compareEngineOrdinal`. */\n\treadonly engineOrdinal: EngineOrdinal;\n\treadonly launch_profile: RpcLaunchProfile;\n}\n\nexport interface RpcProtocolInfo extends RpcProtocolIdentity {\n\treadonly protocolVersion: 1;\n\t/** Informational engine version. Never compare it for compatibility - use the fields above. */\n\treadonly serverVersion: string;\n\treadonly capabilities: string[];\n\treadonly mode: \"classic\" | \"multi\";\n}\n\n// Success responses with data\nexport type RpcResponse =\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_protocol_info\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcProtocolInfo;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"open_session\";\n\t\t\tsuccess: true;\n\t\t\tdata: { sessionId: string; state: RpcSessionState; attached?: boolean };\n\t }\n\t| { id?: string; type: \"response\"; command: \"close_session\"; success: true; data: Record<string, never> }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"list_sessions\";\n\t\t\tsuccess: true;\n\t\t\tdata: {\n\t\t\t\tsessions: Array<{\n\t\t\t\t\tsessionId: string;\n\t\t\t\t\tdurableSessionId?: string;\n\t\t\t\t\tsessionPath?: string;\n\t\t\t\t\tcwd: string;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t\t\t\t/** Live client attachments; `0` is a retained session with no client attached. */\n\t\t\t\t\tattachments: number;\n\t\t\t\t}>;\n\t\t\t};\n\t }\n\t// Prompting (async - events follow)\n\t// data.disposition reports how the host disposed the prompt (started/queued/handled)\n\t// so proxied optimistic-echo contracts resolve exactly like the local path; older\n\t// hosts omit it and clients must degrade to canonical-only rendering.\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true; data?: { disposition?: PromptDisposition } }\n\t| { id?: string; type: \"response\"; command: \"send_custom_message\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"append_user_message\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"append_session_entry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true; data: { cancelled: boolean; reason?: string } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"check_reload_veto\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; reason?: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: {\n\t\t\t\tsteering: string[];\n\t\t\t\tfollowUp: string[];\n\t\t\t\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\t\t\t};\n\t }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<any> & { systemPromptName?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_favorite_models\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_scoped_models\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<any>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: Array<Model<any> & { supportedThinkingLevels: ThinkingLevel[] }> };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Fast mode\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_fast_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { enabled: boolean; serviceTier: ServiceTier; provider: string; modelId: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fast_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { enabled: boolean; serviceTier: ServiceTier | null };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: CompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\t/**\n\t\t\t * `NavigateTreeResult` answers an `entryId` navigation; the shipped shape answers a\n\t\t\t * `targetId` one. Both report `leafId` - the leaf the session was left on, `null` for an\n\t\t\t * empty conversation - so a client resynchronizes in one round trip on either spelling.\n\t\t\t */\n\t\t\tdata:\n\t\t\t\t| NavigateTreeResult\n\t\t\t\t| {\n\t\t\t\t\t\tcancelled: boolean;\n\t\t\t\t\t\tleafId: string | null;\n\t\t\t\t\t\teditorText?: string;\n\t\t\t\t\t\taborted?: boolean;\n\t\t\t\t\t\tsummaryEntry?: unknown;\n\t\t\t\t };\n\t }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"export_jsonl\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"edit_assistant_message\";\n\t\t\tsuccess: true;\n\t\t\tdata: EditAssistantMessageResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"edit_user_message\";\n\t\t\tsuccess: true;\n\t\t\tdata: EditUserMessageResult;\n\t }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"import_jsonl\"; success: true; data: { cancelled: boolean } }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_media\";\n\t\t\tsuccess: true;\n\t\t\tdata: { toolCallId: string; contentIndex: number; content: ImageContent };\n\t }\n\n\t// Commands and loaded runtime surfaces\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_loaded_surfaces\";\n\t\t\tsuccess: true;\n\t\t\tdata: { extensions: RpcLoadedExtension[]; mcpServers: RpcLoadedMcpServer[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"extension_request\";\n\t\t\tsuccess: true;\n\t\t\tdata: unknown;\n\t }\n\n\t// Auth (task 13)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_auth_providers\";\n\t\t\tsuccess: true;\n\t\t\tdata: { providers: RpcAuthProvider[] };\n\t }\n\t// login_start returns immediately: success:true means the flow has started.\n\t// The URL and completion arrive as auth_login_url / auth_login_end events.\n\t| { id?: string; type: \"response\"; command: \"login_start\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"login_cancel\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"login_api_key\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"logout\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_provider_accounts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { accounts: RpcProviderAccount[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"account_pin\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"account_remove\"; success: true }\n\n\t// Error response (any command can fail)\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t\t\terrorCode?: string;\n\t\t\terrorData?: unknown;\n\t };\n\n/** Success payload of `edit_assistant_message`. `leafId` is the session leaf after the call. */\nexport type EditAssistantMessageResult =\n\t| { outcome: \"edited\"; entry: SessionMessageEntry; leafId: string; summaryEntryId?: string }\n\t| { outcome: \"unchanged\"; leafId: string | null }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n/**\n * Success payload of `edit_user_message`, mirroring `EditAssistantMessageResult`. `leafId` is the\n * session leaf after the call and is reported on EVERY outcome so a client resynchronizes in one\n * round trip; it is `null` when the call left the session on an empty conversation.\n */\nexport type EditUserMessageResult =\n\t| { outcome: \"edited\"; entry: SessionMessageEntry; leafId: string; summaryEntryId?: string }\n\t| { outcome: \"unchanged\"; leafId: string | null }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n/**\n * Success payload of an `entryId`-addressed `navigate_tree`. `editorText` is present when the\n * intent is selection and the target is a user/custom message, as in the TUI editor. Resumption\n * never returns editor text. `leafId` is `null` when selection reset the session to an empty\n * conversation, which is what selecting the root user message does.\n */\nexport type NavigateTreeResult =\n\t| { outcome: \"navigated\"; leafId: string | null; editorText?: string; summaryEntryId?: string }\n\t| { outcome: \"cancelled\"; leafId: string | null; aborted?: boolean };\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** One question in an RPC `question` UI request. Matches canonical QuestionRequest.questions. */\nexport type RpcQuestionSpec = {\n\tid: string;\n\theader: string;\n\tquestion: string;\n\toptions: Array<{ label: string; description?: string }>;\n\tmultiSelect: boolean;\n};\n\nexport type RpcQuestionAnswers = Record<string, { selected: string[]; text?: string }>;\n\nexport type RpcQuestionOutcome =\n\t| \"answered\"\n\t| \"comment-submitted\"\n\t| \"timed_out\"\n\t| \"cancelled\"\n\t| \"orphaned-after-restart\"\n\t| \"unavailable\";\n\n/** Outbound `extension_ui_request` body for method `question`. */\nexport type RpcQuestionUiRequest = {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"question\";\n\trequestId: string;\n\ttoolCallId: string;\n\twaitForAnswer: boolean;\n\tquestions: RpcQuestionSpec[];\n\ttimeout: number;\n\taskedAtMs: number;\n\tdeadlineAtMs: number;\n\tremainingMs: number;\n};\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setHeader\" | \"setFooter\";\n\t\t\twidgetLines: string[] | undefined;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t// Additive (task 13/14): emitted ONLY when the client advertised the\n\t// \"custom_unsupported\" capability. ctx.ui.custom cannot render a third-party\n\t// component in RPC mode, so a flagged client gets this notice before custom()\n\t// returns undefined. Default clients never see it (byte-identical behavior).\n\t| { type: \"extension_ui_request\"; id: string; method: \"custom_unsupported\"; extensionName: string }\n\t| RpcQuestionUiRequest;\n\nexport type RpcExtensionEvent = {\n\ttype: \"extension_event\";\n\tname: string;\n\tdata: unknown;\n};\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true }\n\t| { type: \"extension_ui_response\"; id: string; answers: RpcQuestionAnswers; comment?: string };\n\n/** Inbound draft updates for an open `question` request. */\nexport type RpcExtensionUIProgress = {\n\ttype: \"extension_ui_progress\";\n\tid: string;\n\tanswers?: RpcQuestionAnswers;\n\tcomment?: string;\n\tsessionId?: string;\n};\n\n/** Stdin records: session/host commands plus extension-UI replies and progress. */\nexport type RpcInboundRecord = RpcCommand | RpcExtensionUIResponse | RpcExtensionUIProgress;\n\n/** Outbound deadline refresh for an open `question` request. */\nexport type RpcQuestionUpdatedEvent = {\n\ttype: \"question_updated\";\n\tid: string;\n\tdeadlineAtMs: number;\n\tremainingMs: number;\n};\n\n/** Outbound terminal outcome for a `question` request. */\nexport type RpcQuestionResolvedEvent = {\n\ttype: \"question_resolved\";\n\tid: string;\n\trequestId: string;\n\ttoolCallId: string;\n\toutcome: RpcQuestionOutcome;\n\tanswers: RpcQuestionAnswers;\n\tcomment?: string;\n\tunanswered: string[];\n\tdeadlineAtMs?: number;\n};\n\n/** Emitted when the effective session thinking level changes. */\nexport interface RpcThinkingLevelChangedEvent {\n\ttype: \"thinking_level_changed\";\n\tlevel: ThinkingLevel;\n\t/**\n\t * Selector provenance in force after the change; absent when the level is an\n\t * SDK-defaulted effective level rather than an explicit choice. Additive: an old\n\t * client that does not know the field ignores it.\n\t */\n\tthinkingSelection?: ThinkingSelection;\n}\n\nexport interface RpcHighReasoningWarningEvent {\n\ttype: \"high_reasoning_warning\";\n\tmodelId: string;\n\tprovider: string;\n\tthinkingLevel: ThinkingLevel;\n}\n\n/** Emitted after explicit skill tokens are expanded for a user-authored request. */\nexport interface RpcSkillInvocationEvent {\n\ttype: \"skill_invocation\";\n\tskills: readonly {\n\t\tname: string;\n\t\tpath: string;\n\t\tsyntax: \"dollar\" | \"slash\";\n\t}[];\n}\n\n/** Emitted when startup or reload selects an existing settings file. */\nexport interface RpcSettingsSourceSelectedEvent {\n\ttype: \"settings_source_selected\";\n\tpath: string;\n\tformat: \"jsonc\" | \"json\";\n\treason: \"explicit-jsonc\" | \"json-only\";\n\tscope: \"global\" | \"project\";\n}\n\n/**\n * Emitted after the session's active model changed, with the thinking level in force AFTER\n * the switch (per-model memory, a favorite's pinned level, or the clamped previous level).\n *\n * Clients that tracked the model by inferring it from `entry_appended` can consume this\n * instead. Additive: an old client that does not know the type filters it out.\n */\nexport interface RpcModelChangedEvent {\n\ttype: \"model_changed\";\n\tmodel: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\t/** Why the model changed: \"set\", \"cycle\", \"restore\", \"fallback\", or \"fallback-revert\". */\n\tsource: string;\n\t/** Selector provenance for `thinkingLevel` after the switch, when one was explicit. */\n\tthinkingSelection?: ThinkingSelection;\n}\n\n/** Emitted when the effective service tier or fast-mode state of the session changes. */\nexport interface RpcServiceTierChangedEvent {\n\ttype: \"service_tier_changed\";\n\ttier?: ServiceTier;\n\tfastMode: boolean;\n}\n/**\n * Emitted after the host swapped the live session behind this connection (new session,\n * fork, or switch), carrying the new authoritative identity.\n *\n * A replacement can be initiated by ANY attached client. Without this event the other\n * attached clients keep their stale identity and keep routing replacement-dependent\n * actions at the session that no longer exists. Additive: an old client that does not\n * know the type filters it out.\n */\nexport interface RpcSessionReplacedEvent {\n\ttype: \"session_replaced\";\n\t/**\n\t * Durable session id of the session now bound to this connection.\n\t *\n\t * Deliberately NOT `sessionId`: top-level `sessionId` is reserved for the\n\t * per-connection routing handle that multi-session hosts tag every record\n\t * with, and that tag is applied last - it would overwrite this value and\n\t * leave the event carrying no identity at all.\n\t */\n\tdurableSessionId: string;\n\t/** Session file backing the new session, absent for a deferred setup-only session. */\n\tsessionFile?: string;\n\tcwd: string;\n\tsessionName?: string;\n}\n\n/**\n * Emitted when a shared host PARKS a session instead of closing it: the idle window\n * elapsed for a session opened with `retain_on_disconnect`, so the host released the\n * routing handle while the session itself stays on disk.\n *\n * It replaces `session_closed` for that handle - a parked session was not ended, and\n * `open_session { sessionPath }` reopens it (as a NEW routing handle). Additive: a\n * client that does not know the type filters it out and learns the handle is gone\n * from its next command's `unknown_session`.\n */\nexport type RpcSessionParkedEvent = {\n\ttype: \"session_parked\";\n\t/** Routing handle that was released; it never resolves again. */\n\tsessionId: string;\n\t/** Session file to reopen this session by. */\n\tsessionPath: string;\n};\n\n/**\n * Why a `session_closed` record was emitted, when the host names a reason.\n *\n * Optional on the wire and open to new members: a client that does not recognise a reason, or\n * receives a record with no `reason` field, treats it exactly as it treated a reason-less one.\n * Never required in decoders.\n *\n * - `client_close`: an attached client sent `close_session`.\n * - `idle_evicted`: the idle sweep ended a session that was not retained.\n * - `host_shutdown`: the host process is exiting (SIGTERM / idle-exit / empty-host).\n * - `replaced`: the live session behind this handle was swapped (`session_replaced` is the\n * in-place identity event; this reason is for a handle that ended because of a replacement).\n * - `handoff_parked`: a generation handoff drained this host and put the session back on disk.\n * The session was not ended - `open_session { sessionPath }` reopens it in the new generation.\n * - `error`: the session failed (worker death, output overflow) and the host sealed it.\n */\nexport type RpcSessionClosedReason =\n\t| \"client_close\"\n\t| \"idle_evicted\"\n\t| \"host_shutdown\"\n\t| \"replaced\"\n\t| \"handoff_parked\"\n\t| \"error\";\n\n/** Terminal record of a closed routing handle. `reason` is absent on older hosts and older records. */\nexport type RpcSessionClosedEvent = {\n\ttype: \"session_closed\";\n\tsessionId: string;\n\treason?: RpcSessionClosedReason;\n\t/** File released by handoff parking; reopen it on the successor. */\n\tsessionPath?: string;\n};\n\n/** Sent once to every connection before this generation starts parking for a handoff. */\nexport interface RpcHostSupersededEvent {\n\ttype: \"host_superseded\";\n\tinstanceId: string;\n\tgeneration: number;\n\t/** Public endpoint of the successor, or null for a drain without a known successor. */\n\tsuccessor: { socket: string } | null;\n}\n\nexport type RpcHostLifecycleEvent = RpcHostSupersededEvent | RpcHostStalledEvent | RpcHostMemoryPressureEvent;\n\n/** Emitted after the loaded skill, extension, or MCP inventory changes. */\nexport interface RpcLoadedSurfacesChangedEvent {\n\ttype: \"loaded_surfaces_changed\";\n}\n\n/** Emitted after an account is added, removed, pinned, or blocked by refresh failure. */\nexport interface RpcAuthAccountsChangedEvent {\n\ttype: \"auth_accounts_changed\";\n\tprovider: string;\n}\n\n/**\n * Emitted when the host's event loop was blocked long enough to stall every session it\n * serves, naming the routing handle and tool whose work held it when that can be\n * attributed. Informational: the host never aborts or refuses anything because of it.\n */\n/**\n * Sent to ONE opener the moment its `open_session` is accepted, before the open enters the\n * session loop. The in-process host serves opens one at a time, so a burst queues; without this\n * the client's only signal is a deadline it cannot explain (senpi#1844).\n *\n * `for_request` carries the opener's request id deliberately, NOT the response-id field: a client\n * settles pending requests by response id, and a queued record wearing the open's id would be\n * taken as the open's reply.\n */\nexport interface RpcOpenQueuedEvent {\n\ttype: \"queued\";\n\t/** The `open_session` request this position belongs to. */\n\tfor_request: string;\n\t/** 1-based place in the open queue at the moment of acceptance. */\n\tposition: number;\n\t/** Opens already in flight when this one arrived; `position` is this plus one. */\n\tin_flight: number;\n}\n\nexport interface RpcHostStalledEvent {\n\ttype: \"host_stalled\";\n\t/** How late the host's own 200ms timer was invoked, i.e. how long the loop was held. */\n\tdriftMs: number;\n\t/** Routing handle blamed for the stall, absent when no session work was running. */\n\tsessionId?: string;\n\t/** Tool that session was executing, when the stall happened inside one. */\n\ttool?: string;\n}\n\n/**\n * Emitted while the host process is above its RSS warning threshold. Capacity is memory,\n * never a refusal: the host reports the pressure and parks idle sessions sooner, and\n * never declines or kills a session because of it.\n */\nexport interface RpcHostMemoryPressureEvent {\n\ttype: \"host_memory_pressure\";\n\t/** Resident set size of the host process, in megabytes. */\n\trssMb: number;\n\t/** Live sessions the host is holding, including ones opening or closing. */\n\tsessions: number;\n}\n\n/** Emitted when the SDK failover engine advances to a different account slot. */\nexport interface RpcAccountFailoverEvent {\n\ttype: \"account_failover\";\n\tprovider: string;\n\tfrom: string;\n\tto: string;\n\treason: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-session-registry.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/worker-session-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker-session-registry.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/worker-session-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAM7D,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,aAAa,EAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,C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A;KAAE,GAAG,eAAe,CAsBjH;IAED,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnC;IAEK,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB/C;IAED,IAAI,IAAI,aAAa,EAAE,CAgBtB;IAED,mGAAmG;IACnG,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,MAAM;IAad,wFAAwF;IACxF,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,OAAO;IAQf;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAUjB,mGAAmG;IACnG,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,UAAU;CAKlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isAbsolute } from "node:path";
|
|
2
2
|
import { ProviderScope } from "@earendil-works/pi-ai/node/provider-scope";
|
|
3
|
+
import { assertValidSessionId } from "../../core/session-manager.js";
|
|
3
4
|
import { RESERVATION_DENIAL_CODES, SessionPathReservations, } from "./session-path-reservations.js";
|
|
4
5
|
import { frozenProfile, RpcSessionRegistryError, sessionIdentity, } from "./session-registry.js";
|
|
5
6
|
import { SessionWorkerClient } from "./session-worker-client.js";
|
|
@@ -26,6 +27,31 @@ export class WorkerSessionRegistry {
|
|
|
26
27
|
async openSession(profile, options) {
|
|
27
28
|
if (!isAbsolute(profile.cwd) || (profile.sessionPath !== undefined && !isAbsolute(profile.sessionPath)))
|
|
28
29
|
throw new RpcSessionRegistryError("invalid_path");
|
|
30
|
+
// Same contract as RpcSessionRegistry.openSession (#1951), on the registry the multi-session
|
|
31
|
+
// host actually instantiates (#2010). Both checks run SYNCHRONOUSLY before the first await:
|
|
32
|
+
// the format check so a bad id is refused with its own code instead of surfacing as the
|
|
33
|
+
// worker's death (`session_closing`), and the collision scan so a concurrent open naming the
|
|
34
|
+
// same durable id finds this one already recorded. Re-opening the SAME path is an attach,
|
|
35
|
+
// not a collision: the id is the file's own.
|
|
36
|
+
const requestedDurableId = profile.durableSessionId;
|
|
37
|
+
if (requestedDurableId !== undefined) {
|
|
38
|
+
try {
|
|
39
|
+
assertValidSessionId(requestedDurableId);
|
|
40
|
+
}
|
|
41
|
+
catch (cause) {
|
|
42
|
+
throw new RpcSessionRegistryError("invalid_session_id", String(cause));
|
|
43
|
+
}
|
|
44
|
+
const requestedKey = profile.sessionPath ? this.knownReservationKey(profile.sessionPath) : undefined;
|
|
45
|
+
for (const entry of this.entries.values()) {
|
|
46
|
+
if (entry.state === "closed")
|
|
47
|
+
continue;
|
|
48
|
+
if (entry.durableSessionId !== requestedDurableId)
|
|
49
|
+
continue;
|
|
50
|
+
if (requestedKey !== undefined && entry.reservationKey === requestedKey)
|
|
51
|
+
continue;
|
|
52
|
+
throw new RpcSessionRegistryError("session_id_in_use");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
29
55
|
if (profile.sessionPath) {
|
|
30
56
|
const key = this.knownReservationKey(profile.sessionPath);
|
|
31
57
|
const owner = key ? this.reservations.owner(key) : undefined;
|
|
@@ -46,6 +72,10 @@ export class WorkerSessionRegistry {
|
|
|
46
72
|
retainOnDisconnect: options?.retainOnDisconnect === true,
|
|
47
73
|
lastCommandAt: this.now(),
|
|
48
74
|
lifecycleMutex: Promise.resolve(),
|
|
75
|
+
// Recorded before the first await so the collision scan above sees an open still being
|
|
76
|
+
// built; `snapshot.state.sessionId` overwrites it with the authoritative value after
|
|
77
|
+
// commit, which on a resume is the header's id rather than the requested one.
|
|
78
|
+
...(requestedDurableId !== undefined ? { durableSessionId: requestedDurableId } : {}),
|
|
49
79
|
};
|
|
50
80
|
let workerFailure;
|
|
51
81
|
const worker = this.createWorker({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-session-registry.js","sourceRoot":"","sources":["../../../src/modes/rpc/worker-session-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,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,MAAc,EAAE,KAAsB;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC5C,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC;QAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;IACjG,CAAC;CACD","sourcesContent":["import { isAbsolute } from \"node:path\";\nimport { ProviderScope } from \"@earendil-works/pi-ai/node/provider-scope\";\nimport type { CliRuntimeConfiguration } from \"../../main.ts\";\nimport {\n\ttype LiveWorkerPaths,\n\tRESERVATION_DENIAL_CODES,\n\tSessionPathReservations,\n} from \"./session-path-reservations.ts\";\nimport {\n\tfrozenProfile,\n\ttype OpenRpcSession,\n\ttype RpcSessionEntry,\n\ttype RpcSessionLaunchProfile,\n\ttype RpcSessionOpenOptions,\n\tRpcSessionRegistryError,\n\ttype RpcSessionRow,\n\tsessionIdentity,\n} from \"./session-registry.ts\";\nimport { SessionWorkerClient } from \"./session-worker-client.ts\";\nimport { SESSION_WORKER_LIMITS, type SessionWriteGrant } from \"./session-worker-protocol.ts\";\n\ntype SessionWorkerCallbacks = ConstructorParameters<typeof SessionWorkerClient>[0];\n\nexport interface WorkerSessionRegistryOptions {\n\treadonly configuration: CliRuntimeConfiguration;\n\treadonly closeGraceMs: number;\n\treadonly now: () => number;\n\t/** Production builds the real worker; a caller may supply one to drive a lifecycle path deterministically. */\n\treadonly createWorker?: (callbacks: SessionWorkerCallbacks) => SessionWorkerClient;\n}\n\n/** Transport-side lifecycle owner. Caller paths are never inspected on this event loop. */\nexport class WorkerSessionRegistry {\n\tprivate readonly entries = new Map<string, RpcSessionEntry>();\n\tprivate readonly reservations = new SessionPathReservations();\n\tprivate serial = 0;\n\treadonly closeGraceMs: number;\n\tprivate readonly now: () => number;\n\n\tprivate readonly options: WorkerSessionRegistryOptions;\n\tprivate readonly createWorker: (callbacks: SessionWorkerCallbacks) => SessionWorkerClient;\n\n\tconstructor(options: WorkerSessionRegistryOptions) {\n\t\tthis.options = options;\n\t\tthis.closeGraceMs = options.closeGraceMs;\n\t\tthis.now = options.now;\n\t\tthis.createWorker = options.createWorker ?? ((callbacks) => new SessionWorkerClient(callbacks));\n\t}\n\n\tget size(): number {\n\t\treturn this.entries.size;\n\t}\n\n\t/**\n\t * Memory admission is the in-process registry's concern: a worker-runtime session runs in\n\t * its own isolate and this registry already bounds occupancy with `too_many_sessions`.\n\t */\n\tsetWorkerAdmission(): void {}\n\n\tasync openSession(profile: RpcSessionLaunchProfile, options?: RpcSessionOpenOptions): Promise<OpenRpcSession> {\n\t\tif (!isAbsolute(profile.cwd) || (profile.sessionPath !== undefined && !isAbsolute(profile.sessionPath)))\n\t\t\tthrow new RpcSessionRegistryError(\"invalid_path\");\n\t\tif (profile.sessionPath) {\n\t\t\tconst key = this.knownReservationKey(profile.sessionPath);\n\t\t\tconst owner = key ? this.reservations.owner(key) : undefined;\n\t\t\tif (key && owner) return this.attach(owner, key, options);\n\t\t}\n\t\tif (this.size >= SESSION_WORKER_LIMITS.workers) throw new Error(\"too_many_sessions\");\n\t\tconst handle = `rpc-${++this.serial}`;\n\t\tconst storedProfile = frozenProfile(profile);\n\t\tconst entry: RpcSessionEntry = {\n\t\t\tstate: \"opening\",\n\t\t\tscope: new ProviderScope(),\n\t\t\tprofile: storedProfile,\n\t\t\t...sessionIdentity(storedProfile),\n\t\t\tcwd: profile.cwd,\n\t\t\tattachments: 1,\n\t\t\tretainOnDisconnect: options?.retainOnDisconnect === true,\n\t\t\tlastCommandAt: this.now(),\n\t\t\tlifecycleMutex: Promise.resolve(),\n\t\t};\n\t\tlet workerFailure: string | undefined;\n\t\tconst worker = this.createWorker({\n\t\t\treserve: (path) => this.reserve(handle, path),\n\t\t\treconcile: (livePaths) => this.reconcile(handle, livePaths),\n\t\t\texit: () => {\n\t\t\t\tif (this.entries.get(handle) !== entry) return;\n\t\t\t\tentry.state = \"closed\";\n\t\t\t\tthis.entries.delete(handle);\n\t\t\t\tthis.reservations.releaseAll(handle);\n\t\t\t\tentry.closeResolve?.();\n\t\t\t},\n\t\t\tfailure: (error) => {\n\t\t\t\t// The open below only learns that its entry left `opening`, never why. Without this the\n\t\t\t\t// caller is told `session_closing` - a path whose owner is tearing down - for a worker\n\t\t\t\t// that died, and the actual reason reaches stderr alone (#1953).\n\t\t\t\tworkerFailure = error;\n\t\t\t\tentry.state = \"quarantined\";\n\t\t\t\tprocess.stderr.write(`senpi rpc session ${handle} quarantined: ${error}\\n`);\n\t\t\t},\n\t\t});\n\t\tentry.worker = worker;\n\t\tthis.entries.set(handle, entry);\n\t\ttry {\n\t\t\tconst path = await worker.prepare(this.options.configuration, profile);\n\t\t\tconst owner = this.reservations.owner(path);\n\t\t\tif (owner) {\n\t\t\t\tconst attached = this.attach(owner, path, options);\n\t\t\t\tentry.state = \"quarantined\";\n\t\t\t\tworker.quarantine();\n\t\t\t\treturn attached;\n\t\t\t}\n\t\t\tconst grant = this.reserve(handle, path);\n\t\t\tif (grant !== \"granted\") throw new RpcSessionRegistryError(RESERVATION_DENIAL_CODES[grant]);\n\t\t\tentry.reservationKey = path;\n\t\t\tentry.requestedPathKey = profile.sessionPath ? path : undefined;\n\t\t\tentry.sessionPath = path;\n\t\t\tconst snapshot = await worker.commit();\n\t\t\tif (entry.state !== \"opening\")\n\t\t\t\tthrow workerFailure === undefined\n\t\t\t\t\t? new RpcSessionRegistryError(\"session_closing\")\n\t\t\t\t\t: new RpcSessionRegistryError(\"open_failed\", workerFailure);\n\t\t\tentry.durableSessionId = snapshot.state.sessionId;\n\t\t\tentry.cwd = snapshot.state.cwd;\n\t\t\tentry.state = \"open\";\n\t\t\treturn this.openResult(handle, entry);\n\t\t} catch (cause) {\n\t\t\tentry.state = \"quarantined\";\n\t\t\tworker.quarantine();\n\t\t\tthrow cause;\n\t\t}\n\t}\n\n\tpeek(handle: string): RpcSessionEntry | undefined {\n\t\treturn this.entries.get(handle);\n\t}\n\n\tgetForCommand(handle: string, command: string): RpcSessionEntry {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (\n\t\t\tentry.state === \"quarantined\" ||\n\t\t\t(entry.state === \"closing\" &&\n\t\t\t\t![\"abort\", \"abort_bash\", \"extension_ui_response\", \"extension_ui_progress\"].includes(command))\n\t\t)\n\t\t\tthrow new RpcSessionRegistryError(\"session_closing\");\n\t\tif (entry.state !== \"open\" && entry.state !== \"closing\") throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tentry.lastCommandAt = this.now();\n\t\treturn entry;\n\t}\n\n\tbeginClose(handle: string, onRole?: (finalizer: boolean) => void, options?: { detach?: boolean }): RpcSessionEntry {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (entry.state === \"closing\" || entry.state === \"quarantined\") {\n\t\t\tonRole?.(false);\n\t\t\treturn entry;\n\t\t}\n\t\tif (entry.state !== \"open\" && entry.state !== \"opening\") throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tentry.attachments--;\n\t\tif (entry.attachments > 0) return entry;\n\t\t// A retained session answers a client's detach by staying open at zero\n\t\t// attachments; only an explicit close or eviction reaches the worker.\n\t\tif (options?.detach && entry.retainOnDisconnect) {\n\t\t\tentry.attachments = 0;\n\t\t\treturn entry;\n\t\t}\n\t\tentry.state = \"closing\";\n\t\tentry.closeCompletion = new Promise((resolve) => {\n\t\t\tentry.closeResolve = resolve;\n\t\t});\n\t\tonRole?.(true);\n\t\treturn entry;\n\t}\n\n\tclose(handle: string): Promise<void> {\n\t\tconst entry = this.beginClose(handle);\n\t\treturn entry.state === \"closing\" ? this.closeMarked(handle) : Promise.resolve();\n\t}\n\n\tasync closeMarked(handle: string): Promise<void> {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (entry?.state !== \"closing\" || !entry.worker) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (entry.closeStarted) return entry.closeCompletion;\n\t\tentry.closeStarted = true;\n\t\t// Reply on a bounded deadline, but keep entry, attachments and reservations until exit.\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tawait Promise.race([\n\t\t\tentry.worker.close(this.closeGraceMs),\n\t\t\tnew Promise<void>((resolve) => {\n\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\tif (entry.state !== \"closed\") entry.state = \"quarantined\";\n\t\t\t\t\tresolve();\n\t\t\t\t}, this.closeGraceMs);\n\t\t\t}),\n\t\t]);\n\t\tif (timer) clearTimeout(timer);\n\t}\n\n\tlist(): RpcSessionRow[] {\n\t\treturn [...this.entries].map(([sessionId, entry]) => {\n\t\t\tconst state = entry.worker?.snapshot?.state;\n\t\t\treturn {\n\t\t\t\tsessionId,\n\t\t\t\tdurableSessionId: state?.sessionId ?? entry.durableSessionId,\n\t\t\t\tsessionPath: state?.sessionFile ?? entry.sessionPath,\n\t\t\t\tcwd: state?.cwd ?? entry.cwd,\n\t\t\t\tname: state?.sessionName,\n\t\t\t\tkind: entry.kind,\n\t\t\t\tcontext: entry.context,\n\t\t\t\t// A closing entry has already released its last attachment; never publish that as negative.\n\t\t\t\tattachments: Math.max(0, entry.attachments),\n\t\t\t\tstatus: entry.state === \"quarantined\" ? \"closing\" : entry.state,\n\t\t\t};\n\t\t});\n\t}\n\n\t/** Only compare spellings already tied to a granted identity; do not inspect caller paths here. */\n\tprivate knownReservationKey(path: string): string | undefined {\n\t\tif (this.reservations.owner(path)) return path;\n\t\tfor (const entry of this.entries.values()) {\n\t\t\t// An opening spelling maps only while the key granted for it is still held: a\n\t\t\t// superseded path belongs to nobody and must open its own worker.\n\t\t\tif (\n\t\t\t\tentry.profile.sessionPath === path &&\n\t\t\t\tentry.requestedPathKey &&\n\t\t\t\tthis.reservations.owner(entry.requestedPathKey)\n\t\t\t)\n\t\t\t\treturn entry.requestedPathKey;\n\t\t\tconst snapshot = entry.worker?.snapshot;\n\t\t\tif (snapshot?.state.sessionFile === path) return snapshot.sessionPath;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate attach(owner: string, path: string, options?: RpcSessionOpenOptions): OpenRpcSession {\n\t\tconst entry = this.entries.get(owner);\n\t\tif (entry?.state !== \"open\" || !entry.worker?.bindingReady || entry.worker.snapshot?.sessionPath !== path)\n\t\t\tthrow new RpcSessionRegistryError(\"session_path_in_use\");\n\t\tconst result = this.openResult(owner, entry);\n\t\tentry.attachments++;\n\t\t// Retention is a property of the live session: any attach may ask for it, and\n\t\t// no attach may revoke it for the clients that already rely on it.\n\t\tif (options?.retainOnDisconnect) entry.retainOnDisconnect = true;\n\t\tentry.lastCommandAt = this.now();\n\t\treturn { ...result, attached: true };\n\t}\n\n\t/** Granted paths currently held by a handle; the per-worker budget is bounded by it. */\n\treservationCount(handle: string): number {\n\t\treturn this.reservations.count(handle);\n\t}\n\n\tprivate reserve(handle: string, path: string): SessionWriteGrant {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) return \"conflict\";\n\t\tif (this.reservations.owner(path) === handle) return \"granted\";\n\t\tif (entry.state !== \"opening\" && entry.state !== \"open\") return \"conflict\";\n\t\treturn this.reservations.reserve(handle, path, this.liveWorkerPaths(entry));\n\t}\n\n\t/**\n\t * Releases the grants a worker's latest snapshot no longer claims.\n\t *\n\t * Only a fully open entry reports live writers. An entry still opening, closing or\n\t * quarantined keeps every grant until its real exit, because a worker stuck in a\n\t * syscall can still be writing a path it can no longer report.\n\t */\n\tprivate reconcile(handle: string, livePaths: readonly string[]): void {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (entry?.state !== \"open\") return;\n\t\tconst sessionPath = entry.worker?.snapshot?.sessionPath;\n\t\tthis.reservations.reconcile(handle, { livePaths, sessionPath });\n\t\tif (!sessionPath) return;\n\t\tentry.reservationKey = sessionPath;\n\t\tentry.sessionPath = sessionPath;\n\t}\n\n\t/** The live view a full budget is reconciled against; absent while the entry cannot report one. */\n\tprivate liveWorkerPaths(entry: RpcSessionEntry): LiveWorkerPaths | undefined {\n\t\tconst snapshot = entry.state === \"open\" ? entry.worker?.snapshot : undefined;\n\t\tif (!snapshot) return undefined;\n\t\treturn { livePaths: snapshot.liveSessionPaths, sessionPath: snapshot.sessionPath };\n\t}\n\n\tprivate openResult(handle: string, entry: RpcSessionEntry): OpenRpcSession {\n\t\tconst state = entry.worker?.snapshot?.state;\n\t\tif (!state) throw new RpcSessionRegistryError(\"open_failed\");\n\t\treturn { sessionId: handle, durableSessionId: state.sessionId, sessionPath: state.sessionFile };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"worker-session-registry.js","sourceRoot":"","sources":["../../../src/modes/rpc/worker-session-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAEN,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,aAAa,EAKb,uBAAuB,EAEvB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAA0B,MAAM,8BAA8B,CAAC;AAY7F,2FAA2F;AAC3F,MAAM,OAAO,qBAAqB;IAUjC,YAAY,OAAqC;QAThC,YAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC7C,iBAAY,GAAG,IAAI,uBAAuB,EAAE,CAAC;QACtD,WAAM,GAAG,CAAC,CAAC;QAQlB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,G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,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,mGAAmG;IAC3F,eAAe,CAAC,KAAsB;QAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,gBAAgB,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC;IACpF,CAAC;IAEO,UAAU,CAAC,MAAc,EAAE,KAAsB;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC5C,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC;QAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;IACjG,CAAC;CACD","sourcesContent":["import { isAbsolute } from \"node:path\";\nimport { ProviderScope } from \"@earendil-works/pi-ai/node/provider-scope\";\nimport { assertValidSessionId } from \"../../core/session-manager.ts\";\nimport type { CliRuntimeConfiguration } from \"../../main.ts\";\nimport {\n\ttype LiveWorkerPaths,\n\tRESERVATION_DENIAL_CODES,\n\tSessionPathReservations,\n} from \"./session-path-reservations.ts\";\nimport {\n\tfrozenProfile,\n\ttype OpenRpcSession,\n\ttype RpcSessionEntry,\n\ttype RpcSessionLaunchProfile,\n\ttype RpcSessionOpenOptions,\n\tRpcSessionRegistryError,\n\ttype RpcSessionRow,\n\tsessionIdentity,\n} from \"./session-registry.ts\";\nimport { SessionWorkerClient } from \"./session-worker-client.ts\";\nimport { SESSION_WORKER_LIMITS, type SessionWriteGrant } from \"./session-worker-protocol.ts\";\n\ntype SessionWorkerCallbacks = ConstructorParameters<typeof SessionWorkerClient>[0];\n\nexport interface WorkerSessionRegistryOptions {\n\treadonly configuration: CliRuntimeConfiguration;\n\treadonly closeGraceMs: number;\n\treadonly now: () => number;\n\t/** Production builds the real worker; a caller may supply one to drive a lifecycle path deterministically. */\n\treadonly createWorker?: (callbacks: SessionWorkerCallbacks) => SessionWorkerClient;\n}\n\n/** Transport-side lifecycle owner. Caller paths are never inspected on this event loop. */\nexport class WorkerSessionRegistry {\n\tprivate readonly entries = new Map<string, RpcSessionEntry>();\n\tprivate readonly reservations = new SessionPathReservations();\n\tprivate serial = 0;\n\treadonly closeGraceMs: number;\n\tprivate readonly now: () => number;\n\n\tprivate readonly options: WorkerSessionRegistryOptions;\n\tprivate readonly createWorker: (callbacks: SessionWorkerCallbacks) => SessionWorkerClient;\n\n\tconstructor(options: WorkerSessionRegistryOptions) {\n\t\tthis.options = options;\n\t\tthis.closeGraceMs = options.closeGraceMs;\n\t\tthis.now = options.now;\n\t\tthis.createWorker = options.createWorker ?? ((callbacks) => new SessionWorkerClient(callbacks));\n\t}\n\n\tget size(): number {\n\t\treturn this.entries.size;\n\t}\n\n\t/**\n\t * Memory admission is the in-process registry's concern: a worker-runtime session runs in\n\t * its own isolate and this registry already bounds occupancy with `too_many_sessions`.\n\t */\n\tsetWorkerAdmission(): void {}\n\n\tasync openSession(profile: RpcSessionLaunchProfile, options?: RpcSessionOpenOptions): Promise<OpenRpcSession> {\n\t\tif (!isAbsolute(profile.cwd) || (profile.sessionPath !== undefined && !isAbsolute(profile.sessionPath)))\n\t\t\tthrow new RpcSessionRegistryError(\"invalid_path\");\n\t\t// Same contract as RpcSessionRegistry.openSession (#1951), on the registry the multi-session\n\t\t// host actually instantiates (#2010). Both checks run SYNCHRONOUSLY before the first await:\n\t\t// the format check so a bad id is refused with its own code instead of surfacing as the\n\t\t// worker's death (`session_closing`), and the collision scan so a concurrent open naming the\n\t\t// same durable id finds this one already recorded. Re-opening the SAME path is an attach,\n\t\t// not a collision: the id is the file's own.\n\t\tconst requestedDurableId = profile.durableSessionId;\n\t\tif (requestedDurableId !== undefined) {\n\t\t\ttry {\n\t\t\t\tassertValidSessionId(requestedDurableId);\n\t\t\t} catch (cause) {\n\t\t\t\tthrow new RpcSessionRegistryError(\"invalid_session_id\", String(cause));\n\t\t\t}\n\t\t\tconst requestedKey = profile.sessionPath ? this.knownReservationKey(profile.sessionPath) : undefined;\n\t\t\tfor (const entry of this.entries.values()) {\n\t\t\t\tif (entry.state === \"closed\") continue;\n\t\t\t\tif (entry.durableSessionId !== requestedDurableId) continue;\n\t\t\t\tif (requestedKey !== undefined && entry.reservationKey === requestedKey) continue;\n\t\t\t\tthrow new RpcSessionRegistryError(\"session_id_in_use\");\n\t\t\t}\n\t\t}\n\t\tif (profile.sessionPath) {\n\t\t\tconst key = this.knownReservationKey(profile.sessionPath);\n\t\t\tconst owner = key ? this.reservations.owner(key) : undefined;\n\t\t\tif (key && owner) return this.attach(owner, key, options);\n\t\t}\n\t\tif (this.size >= SESSION_WORKER_LIMITS.workers) throw new Error(\"too_many_sessions\");\n\t\tconst handle = `rpc-${++this.serial}`;\n\t\tconst storedProfile = frozenProfile(profile);\n\t\tconst entry: RpcSessionEntry = {\n\t\t\tstate: \"opening\",\n\t\t\tscope: new ProviderScope(),\n\t\t\tprofile: storedProfile,\n\t\t\t...sessionIdentity(storedProfile),\n\t\t\tcwd: profile.cwd,\n\t\t\tattachments: 1,\n\t\t\tretainOnDisconnect: options?.retainOnDisconnect === true,\n\t\t\tlastCommandAt: this.now(),\n\t\t\tlifecycleMutex: Promise.resolve(),\n\t\t\t// Recorded before the first await so the collision scan above sees an open still being\n\t\t\t// built; `snapshot.state.sessionId` overwrites it with the authoritative value after\n\t\t\t// commit, which on a resume is the header's id rather than the requested one.\n\t\t\t...(requestedDurableId !== undefined ? { durableSessionId: requestedDurableId } : {}),\n\t\t};\n\t\tlet workerFailure: string | undefined;\n\t\tconst worker = this.createWorker({\n\t\t\treserve: (path) => this.reserve(handle, path),\n\t\t\treconcile: (livePaths) => this.reconcile(handle, livePaths),\n\t\t\texit: () => {\n\t\t\t\tif (this.entries.get(handle) !== entry) return;\n\t\t\t\tentry.state = \"closed\";\n\t\t\t\tthis.entries.delete(handle);\n\t\t\t\tthis.reservations.releaseAll(handle);\n\t\t\t\tentry.closeResolve?.();\n\t\t\t},\n\t\t\tfailure: (error) => {\n\t\t\t\t// The open below only learns that its entry left `opening`, never why. Without this the\n\t\t\t\t// caller is told `session_closing` - a path whose owner is tearing down - for a worker\n\t\t\t\t// that died, and the actual reason reaches stderr alone (#1953).\n\t\t\t\tworkerFailure = error;\n\t\t\t\tentry.state = \"quarantined\";\n\t\t\t\tprocess.stderr.write(`senpi rpc session ${handle} quarantined: ${error}\\n`);\n\t\t\t},\n\t\t});\n\t\tentry.worker = worker;\n\t\tthis.entries.set(handle, entry);\n\t\ttry {\n\t\t\tconst path = await worker.prepare(this.options.configuration, profile);\n\t\t\tconst owner = this.reservations.owner(path);\n\t\t\tif (owner) {\n\t\t\t\tconst attached = this.attach(owner, path, options);\n\t\t\t\tentry.state = \"quarantined\";\n\t\t\t\tworker.quarantine();\n\t\t\t\treturn attached;\n\t\t\t}\n\t\t\tconst grant = this.reserve(handle, path);\n\t\t\tif (grant !== \"granted\") throw new RpcSessionRegistryError(RESERVATION_DENIAL_CODES[grant]);\n\t\t\tentry.reservationKey = path;\n\t\t\tentry.requestedPathKey = profile.sessionPath ? path : undefined;\n\t\t\tentry.sessionPath = path;\n\t\t\tconst snapshot = await worker.commit();\n\t\t\tif (entry.state !== \"opening\")\n\t\t\t\tthrow workerFailure === undefined\n\t\t\t\t\t? new RpcSessionRegistryError(\"session_closing\")\n\t\t\t\t\t: new RpcSessionRegistryError(\"open_failed\", workerFailure);\n\t\t\tentry.durableSessionId = snapshot.state.sessionId;\n\t\t\tentry.cwd = snapshot.state.cwd;\n\t\t\tentry.state = \"open\";\n\t\t\treturn this.openResult(handle, entry);\n\t\t} catch (cause) {\n\t\t\tentry.state = \"quarantined\";\n\t\t\tworker.quarantine();\n\t\t\tthrow cause;\n\t\t}\n\t}\n\n\tpeek(handle: string): RpcSessionEntry | undefined {\n\t\treturn this.entries.get(handle);\n\t}\n\n\tgetForCommand(handle: string, command: string): RpcSessionEntry {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (\n\t\t\tentry.state === \"quarantined\" ||\n\t\t\t(entry.state === \"closing\" &&\n\t\t\t\t![\"abort\", \"abort_bash\", \"extension_ui_response\", \"extension_ui_progress\"].includes(command))\n\t\t)\n\t\t\tthrow new RpcSessionRegistryError(\"session_closing\");\n\t\tif (entry.state !== \"open\" && entry.state !== \"closing\") throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tentry.lastCommandAt = this.now();\n\t\treturn entry;\n\t}\n\n\tbeginClose(handle: string, onRole?: (finalizer: boolean) => void, options?: { detach?: boolean }): RpcSessionEntry {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (entry.state === \"closing\" || entry.state === \"quarantined\") {\n\t\t\tonRole?.(false);\n\t\t\treturn entry;\n\t\t}\n\t\tif (entry.state !== \"open\" && entry.state !== \"opening\") throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tentry.attachments--;\n\t\tif (entry.attachments > 0) return entry;\n\t\t// A retained session answers a client's detach by staying open at zero\n\t\t// attachments; only an explicit close or eviction reaches the worker.\n\t\tif (options?.detach && entry.retainOnDisconnect) {\n\t\t\tentry.attachments = 0;\n\t\t\treturn entry;\n\t\t}\n\t\tentry.state = \"closing\";\n\t\tentry.closeCompletion = new Promise((resolve) => {\n\t\t\tentry.closeResolve = resolve;\n\t\t});\n\t\tonRole?.(true);\n\t\treturn entry;\n\t}\n\n\tclose(handle: string): Promise<void> {\n\t\tconst entry = this.beginClose(handle);\n\t\treturn entry.state === \"closing\" ? this.closeMarked(handle) : Promise.resolve();\n\t}\n\n\tasync closeMarked(handle: string): Promise<void> {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (entry?.state !== \"closing\" || !entry.worker) throw new RpcSessionRegistryError(\"unknown_session\");\n\t\tif (entry.closeStarted) return entry.closeCompletion;\n\t\tentry.closeStarted = true;\n\t\t// Reply on a bounded deadline, but keep entry, attachments and reservations until exit.\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tawait Promise.race([\n\t\t\tentry.worker.close(this.closeGraceMs),\n\t\t\tnew Promise<void>((resolve) => {\n\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\tif (entry.state !== \"closed\") entry.state = \"quarantined\";\n\t\t\t\t\tresolve();\n\t\t\t\t}, this.closeGraceMs);\n\t\t\t}),\n\t\t]);\n\t\tif (timer) clearTimeout(timer);\n\t}\n\n\tlist(): RpcSessionRow[] {\n\t\treturn [...this.entries].map(([sessionId, entry]) => {\n\t\t\tconst state = entry.worker?.snapshot?.state;\n\t\t\treturn {\n\t\t\t\tsessionId,\n\t\t\t\tdurableSessionId: state?.sessionId ?? entry.durableSessionId,\n\t\t\t\tsessionPath: state?.sessionFile ?? entry.sessionPath,\n\t\t\t\tcwd: state?.cwd ?? entry.cwd,\n\t\t\t\tname: state?.sessionName,\n\t\t\t\tkind: entry.kind,\n\t\t\t\tcontext: entry.context,\n\t\t\t\t// A closing entry has already released its last attachment; never publish that as negative.\n\t\t\t\tattachments: Math.max(0, entry.attachments),\n\t\t\t\tstatus: entry.state === \"quarantined\" ? \"closing\" : entry.state,\n\t\t\t};\n\t\t});\n\t}\n\n\t/** Only compare spellings already tied to a granted identity; do not inspect caller paths here. */\n\tprivate knownReservationKey(path: string): string | undefined {\n\t\tif (this.reservations.owner(path)) return path;\n\t\tfor (const entry of this.entries.values()) {\n\t\t\t// An opening spelling maps only while the key granted for it is still held: a\n\t\t\t// superseded path belongs to nobody and must open its own worker.\n\t\t\tif (\n\t\t\t\tentry.profile.sessionPath === path &&\n\t\t\t\tentry.requestedPathKey &&\n\t\t\t\tthis.reservations.owner(entry.requestedPathKey)\n\t\t\t)\n\t\t\t\treturn entry.requestedPathKey;\n\t\t\tconst snapshot = entry.worker?.snapshot;\n\t\t\tif (snapshot?.state.sessionFile === path) return snapshot.sessionPath;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate attach(owner: string, path: string, options?: RpcSessionOpenOptions): OpenRpcSession {\n\t\tconst entry = this.entries.get(owner);\n\t\tif (entry?.state !== \"open\" || !entry.worker?.bindingReady || entry.worker.snapshot?.sessionPath !== path)\n\t\t\tthrow new RpcSessionRegistryError(\"session_path_in_use\");\n\t\tconst result = this.openResult(owner, entry);\n\t\tentry.attachments++;\n\t\t// Retention is a property of the live session: any attach may ask for it, and\n\t\t// no attach may revoke it for the clients that already rely on it.\n\t\tif (options?.retainOnDisconnect) entry.retainOnDisconnect = true;\n\t\tentry.lastCommandAt = this.now();\n\t\treturn { ...result, attached: true };\n\t}\n\n\t/** Granted paths currently held by a handle; the per-worker budget is bounded by it. */\n\treservationCount(handle: string): number {\n\t\treturn this.reservations.count(handle);\n\t}\n\n\tprivate reserve(handle: string, path: string): SessionWriteGrant {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (!entry) return \"conflict\";\n\t\tif (this.reservations.owner(path) === handle) return \"granted\";\n\t\tif (entry.state !== \"opening\" && entry.state !== \"open\") return \"conflict\";\n\t\treturn this.reservations.reserve(handle, path, this.liveWorkerPaths(entry));\n\t}\n\n\t/**\n\t * Releases the grants a worker's latest snapshot no longer claims.\n\t *\n\t * Only a fully open entry reports live writers. An entry still opening, closing or\n\t * quarantined keeps every grant until its real exit, because a worker stuck in a\n\t * syscall can still be writing a path it can no longer report.\n\t */\n\tprivate reconcile(handle: string, livePaths: readonly string[]): void {\n\t\tconst entry = this.entries.get(handle);\n\t\tif (entry?.state !== \"open\") return;\n\t\tconst sessionPath = entry.worker?.snapshot?.sessionPath;\n\t\tthis.reservations.reconcile(handle, { livePaths, sessionPath });\n\t\tif (!sessionPath) return;\n\t\tentry.reservationKey = sessionPath;\n\t\tentry.sessionPath = sessionPath;\n\t}\n\n\t/** The live view a full budget is reconciled against; absent while the entry cannot report one. */\n\tprivate liveWorkerPaths(entry: RpcSessionEntry): LiveWorkerPaths | undefined {\n\t\tconst snapshot = entry.state === \"open\" ? entry.worker?.snapshot : undefined;\n\t\tif (!snapshot) return undefined;\n\t\treturn { livePaths: snapshot.liveSessionPaths, sessionPath: snapshot.sessionPath };\n\t}\n\n\tprivate openResult(handle: string, entry: RpcSessionEntry): OpenRpcSession {\n\t\tconst state = entry.worker?.snapshot?.state;\n\t\tif (!state) throw new RpcSessionRegistryError(\"open_failed\");\n\t\treturn { sessionId: handle, durableSessionId: state.sessionId, sessionPath: state.sessionFile };\n\t}\n}\n"]}
|
package/docs/providers.md
CHANGED
|
@@ -28,7 +28,7 @@ Use `/login` in interactive mode, then select a provider:
|
|
|
28
28
|
|
|
29
29
|
Use `/logout` to clear credentials. Tokens are stored in `~/.senpi/agent/auth.json` and auto-refresh when expired. OpenRouter instead mints a user-controlled API key that does not expire automatically.
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### ChatGPT Subscription
|
|
32
32
|
|
|
33
33
|
- Requires ChatGPT Plus or Pro subscription
|
|
34
34
|
- Officially endorsed by OpenAI: [Codex for OSS](https://developers.openai.com/community/codex-for-oss)
|
|
@@ -41,16 +41,16 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
|
|
|
41
41
|
- If the browser lands on a page saying the login belongs to a different session or an earlier attempt, that page's address was sent to another login's listener: paste the full address from the address bar into the session whose prompt is still waiting, or run the login again from that session.
|
|
42
42
|
- A login that receives neither the browser callback nor a pasted redirect URL for 10 minutes fails with a timeout and releases its port; run `/login anthropic` again.
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Anthropic Subscription
|
|
45
45
|
|
|
46
|
-
The `
|
|
46
|
+
The `anthropic-subscription` provider routes LLM calls through the official [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) - it spawns the real Claude Code engine - while senpi executes every tool itself. Subscription usage flows through Anthropic's official Claude Code surface.
|
|
47
47
|
|
|
48
|
-
- Run `/login
|
|
49
|
-
- Multiple accounts: each `/login
|
|
48
|
+
- Run `/login anthropic-subscription` to sign in with your Claude Pro/Max subscription (PKCE, same OAuth client as the Claude Code CLI). An existing Anthropic OAuth credential is offered as an import.
|
|
49
|
+
- Multiple accounts: each `/login anthropic-subscription` adds another named account. `CLAUDE_CODE_OAUTH_TOKEN` (and `_2`..`_N`) are honored as read-only env accounts. `/claude-account` lists, adds, removes, and pins accounts; `--claude-account <name>` pins one for the session; `anthropicSubscriptionProvider.pinnedAccount` pins one in settings.
|
|
50
50
|
- Session affinity: one senpi session sticks to one account (rendezvous hashing), which keeps Anthropic's prompt cache warm - accounts never rotate mid-session except on automatic failover. Rate limits and auth errors block the account (with cooldown) and retry on the next account, before any visible output; once output has started, the error surfaces instead of replaying.
|
|
51
51
|
- Default lane: **ambient** - with no `tokenInjection` setting the provider inherits the environment like the upstream extension (Claude Code CLI login or `ANTHROPIC_API_KEY`). Managed lanes (`oauth-slots`, `config-dir`) are opt-in via one settings line until the live subscription spike proves a managed default.
|
|
52
|
-
- Ambient lane is explicit opt-in: a Claude Code CLI login on the host is not consent to spend that subscription, so the ambient lane is gated by `
|
|
53
|
-
- Settings (`
|
|
52
|
+
- Ambient lane is explicit opt-in: a Claude Code CLI login on the host is not consent to spend that subscription, so the ambient lane is gated by `anthropicSubscriptionProvider.enabled` (default `false`, env override `SENPI_CLAUDE_SDK_OAUTH_ENABLED`). Before this gate existed, a logged-in Claude Code CLI made the provider available with no senpi-side action. An explicit senpi-side login is itself an opt-in: stored OAuth accounts in `auth.json` and `CLAUDE_CODE_OAUTH_TOKEN` / `CLAUDE_CODE_OAUTH_TOKEN_<n>` env accounts keep the provider available with the flag unset. Only the host-CLI-derived ambient lane requires the flag.
|
|
53
|
+
- Settings (`anthropicSubscriptionProvider`):
|
|
54
54
|
- `systemPromptMode` — controls how the system prompt is delivered. **`full`** (default) sends senpi's composed system prompt verbatim; the lane no longer rebuilds from the SDK `claude_code` preset, so all prompt regions (project rules, response-language instructions, etc.) reach the model. **`preset-append`** is the previous behaviour (deprecated, kept for one release; emits a one-time warning). **`override`** loads the system prompt from a file (`systemPromptFile`). The legacy `appendSystemPrompt` key still works: `false` → `preset-append`, `true`/unset → `full`; setting both keys makes `systemPromptMode` win and warns.
|
|
55
55
|
- In `full` and `override` modes, `settingSources` defaults to `[]` on every lane because senpi's prompt already carries project context — loading the SDK's own CLAUDE.md would double-inject it. The CLI always prepends its own `"You are a Claude agent, built on Anthropic's Claude Agent SDK."` block, which senpi cannot suppress; `full` means the prompt is delivered intact, not that it is the only system-prompt text.
|
|
56
56
|
- `settingSources` (filesystem settings load only in the ambient lane, so they cannot override your selected account), `strictMcpConfig`, `pinnedAccount`, `tokenInjection` (`oauth-slots` | `config-dir` | `ambient`), `resumeMode` (`auto` default | `off` restores per-turn sessions), `systemPromptFile`, `enabled` (default `false`; gates the ambient lane only).
|
|
@@ -92,7 +92,7 @@ ls -lt ~/.claude/projects/*/ | head
|
|
|
92
92
|
|
|
93
93
|
### Diagnosing Claude OAuth token consumption
|
|
94
94
|
|
|
95
|
-
If your Claude Pro/Max subscription usage through `
|
|
95
|
+
If your Claude Pro/Max subscription usage through `anthropic-subscription` feels unexpectedly high, check these in order:
|
|
96
96
|
|
|
97
97
|
1. **Upgrade to v2026.8.3 or later.** Resume-first session continuity (#634-637) landed on 2026-08-03. On older builds, every turn after a divergence (compaction, abort, model switch, restart, failover) re-sends the entire conversation, which is the dominant token-burn mechanism.
|
|
98
98
|
2. **Check which lane you are on.** The `ambient` lane (default) inherits the environment. `oauth-slots` and `config-dir` are managed lanes set via `SENPI_CLAUDE_SDK_OAUTH_TOKEN_INJECTION`. The `config-dir` lane keeps each account's credentials in its own `CLAUDE_CONFIG_DIR`; no official SDK API moves a transcript across roots, so account failover on that lane always flattens (re-sends the full history) — this is a declared residual, not a bug.
|
|
@@ -101,7 +101,7 @@ If your Claude Pro/Max subscription usage through `claude-sdk-oauth` feels unexp
|
|
|
101
101
|
|
|
102
102
|
| Lane | Effective TTL | Who controls it | How to override |
|
|
103
103
|
| --- | --- | --- | --- |
|
|
104
|
-
|
|
|
104
|
+
| Anthropic Subscription (subscription, `anthropic-subscription`) | 5 minutes | The Claude SDK owns `cache_control`; senpi cannot add breakpoints. senpi reports 300s for this lane so cache-aware budgets (tool waits, goal timing) size themselves correctly. | Not overridable |
|
|
105
105
|
| Direct Anthropic API (`api.anthropic.com`, API key or OAuth token) | 5 minutes | senpi follows Anthropic's default cache retention. Opting into 1h retention makes cache writes cost 2x base input vs 1.25x for 5m ([Anthropic prompt caching](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)). | Set `PI_CACHE_RETENTION=long` or `cacheRetention: "long"` |
|
|
106
106
|
| Anthropic-compatible providers (kimi-coding, fireworks, gateways) | 5 minutes | The 1h TTL is gated on the native `api.anthropic.com` base URL, so these lanes stay short. | `cacheRetention` |
|
|
107
107
|
|
package/docs/release-guide.md
CHANGED
|
@@ -257,7 +257,7 @@ bunx --cwd packages/coding-agent vitest \
|
|
|
257
257
|
test/suite/vendored-builtins.test.ts \
|
|
258
258
|
test/extensions/loader-concurrency.test.ts \
|
|
259
259
|
test/mcp/ \
|
|
260
|
-
test/suite/
|
|
260
|
+
test/suite/anthropic-subscription-extension.test.ts \
|
|
261
261
|
test/suite/terminal-extension.test.ts \
|
|
262
262
|
test/compaction/ \
|
|
263
263
|
test/ttsr/
|
package/docs/rpc.md
CHANGED
|
@@ -1338,7 +1338,7 @@ Response:
|
|
|
1338
1338
|
|
|
1339
1339
|
#### set_fast_mode
|
|
1340
1340
|
|
|
1341
|
-
Turn fast mode (the
|
|
1341
|
+
Turn fast mode (the ChatGPT Subscription `priority` service tier) on or off for the active model. The choice is remembered
|
|
1342
1342
|
per model, so a later session on the same model starts the same way; `enabled: false` records an explicit `"auto"`
|
|
1343
1343
|
so it also overrides a tier inherited from the model catalog.
|
|
1344
1344
|
|
|
@@ -1355,7 +1355,7 @@ Response:
|
|
|
1355
1355
|
"data": {
|
|
1356
1356
|
"enabled": true,
|
|
1357
1357
|
"serviceTier": "priority",
|
|
1358
|
-
"provider": "
|
|
1358
|
+
"provider": "chatgpt-subscription",
|
|
1359
1359
|
"modelId": "gpt-5.6-sol"
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
@@ -1369,7 +1369,7 @@ The command returns an error instead of a silent no-op when the request cannot b
|
|
|
1369
1369
|
|
|
1370
1370
|
| Situation | `error` |
|
|
1371
1371
|
|-----------|---------|
|
|
1372
|
-
| Active model is not
|
|
1372
|
+
| Active model is not a ChatGPT Subscription model | `Fast mode is only available for ChatGPT Subscription models.` |
|
|
1373
1373
|
| `enabled: false` while the model selection pins `:priority` | `Fast mode is fixed by the active model selection's priority tier.` |
|
|
1374
1374
|
| `enabled` is not a boolean | `set_fast_mode requires a boolean 'enabled' field.` |
|
|
1375
1375
|
|
|
@@ -2221,7 +2221,7 @@ command, a retry fallback, or a session restore.
|
|
|
2221
2221
|
```json
|
|
2222
2222
|
{
|
|
2223
2223
|
"type": "model_changed",
|
|
2224
|
-
"model": {"provider": "
|
|
2224
|
+
"model": {"provider": "chatgpt-subscription", "id": "gpt-5.6-sol", "...": "..."},
|
|
2225
2225
|
"thinkingLevel": "xhigh",
|
|
2226
2226
|
"source": "cycle"
|
|
2227
2227
|
}
|
package/docs/settings.md
CHANGED
|
@@ -363,7 +363,7 @@ When unset, senpi leaves provider payloads unchanged. This setting currently app
|
|
|
363
363
|
|
|
364
364
|
| Setting | Type | Default | Description |
|
|
365
365
|
|---------|------|---------|-------------|
|
|
366
|
-
| `
|
|
366
|
+
| `anthropicSubscriptionProvider.enabled` | boolean | `false` | Enable the ambient (host-CLI-derived) lane of `anthropic-subscription`. Env override: `SENPI_CLAUDE_SDK_OAUTH_ENABLED`. Explicit senpi-side logins (stored OAuth accounts in `auth.json`, `CLAUDE_CODE_OAUTH_TOKEN` / `CLAUDE_CODE_OAUTH_TOKEN_<n>` env accounts) keep the provider available with this unset |
|
|
367
367
|
| `cursorCliOauthProvider.enabled` | boolean | `false` | Enable the `cursor-cli-oauth` fallback lane and automatic native credential bootstrap. Env override: `SENPI_CURSOR_CLI_OAUTH_ENABLED` |
|
|
368
368
|
| `providers.<id>.maxConcurrency` | number | unlimited | Cap the streaming requests senpi keeps in flight against one provider, keyed by registry provider id (`anthropic`, `openai`, ...). `0`, a negative value, a fraction, or an absent key all mean unlimited |
|
|
369
369
|
|
|
@@ -383,7 +383,7 @@ Both ambient-auth providers are explicit opt-in: a vendor CLI being logged in on
|
|
|
383
383
|
|
|
384
384
|
```json
|
|
385
385
|
{
|
|
386
|
-
"
|
|
386
|
+
"anthropicSubscriptionProvider": {
|
|
387
387
|
"enabled": true
|
|
388
388
|
},
|
|
389
389
|
"cursorCliOauthProvider": {
|
|
@@ -560,11 +560,11 @@ Only `session_shutdown` is bounded; other extension events (including ask-user a
|
|
|
560
560
|
```json
|
|
561
561
|
{
|
|
562
562
|
"modelThinkingLevels": {
|
|
563
|
-
"
|
|
563
|
+
"chatgpt-subscription/gpt-5.6-sol": "xhigh",
|
|
564
564
|
"anthropic/claude-fable-5-1": "high"
|
|
565
565
|
},
|
|
566
566
|
"modelServiceTiers": {
|
|
567
|
-
"
|
|
567
|
+
"chatgpt-subscription/gpt-5.6-sol": "priority"
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
```
|
|
@@ -605,7 +605,7 @@ The service tier on outgoing requests is resolved as:
|
|
|
605
605
|
2. The model catalog's `compat.serviceTier`
|
|
606
606
|
3. `openai.serviceTier` (the global OpenAI setting)
|
|
607
607
|
|
|
608
|
-
The per-model `modelServiceTiers` memory is not part of that resolution: it applies to
|
|
608
|
+
The per-model `modelServiceTiers` memory is not part of that resolution: it applies to ChatGPT Subscription
|
|
609
609
|
models only, through fast mode. It acts as the session-start default for `/fast` (a remembered
|
|
610
610
|
`"priority"` starts the session fast) and as an explicit `"auto"` opt-out of a catalog-inherited
|
|
611
611
|
priority tier, which keeps `service_tier` off the wire. Under a `:priority` pin the memory has no
|