@code-yeongyu/senpi 2026.8.31 → 2026.9.2
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 +32 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts +6 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/context-pipeline.js +11 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +4 -4
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +108 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +11 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +1 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/main.d.ts +4 -4
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -6
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/daemon/process.d.ts +13 -2
- package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
- package/dist/modes/app-server/daemon/process.js +58 -12
- package/dist/modes/app-server/daemon/process.js.map +1 -1
- package/dist/modes/app-server/daemon.js +62 -4
- package/dist/modes/app-server/daemon.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +35 -6
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tips/catalog/ethos-tips.js +1 -1
- package/dist/modes/interactive/tips/catalog/ethos-tips.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +8 -3
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +1 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +1 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +93 -17
- package/dist/modes/rpc/host-ensure.js.map +1 -1
- package/dist/modes/rpc/host-lifecycle.d.ts +15 -0
- package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
- package/dist/modes/rpc/host-lifecycle.js +180 -55
- package/dist/modes/rpc/host-lifecycle.js.map +1 -1
- package/dist/modes/rpc/host-watchdog.d.ts +2 -2
- package/dist/modes/rpc/host-watchdog.d.ts.map +1 -1
- package/dist/modes/rpc/host-watchdog.js +89 -21
- package/dist/modes/rpc/host-watchdog.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +94 -56
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +7 -2
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/socket-transport.d.ts +13 -0
- package/dist/modes/rpc/socket-transport.d.ts.map +1 -0
- package/dist/modes/rpc/socket-transport.js +92 -0
- package/dist/modes/rpc/socket-transport.js.map +1 -0
- package/docs/extensions.md +1 -1
- package/docs/rpc.md +5 -1
- package/docs/settings.md +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/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/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"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AAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAK5C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAK/C,uFAAuF;IACjF,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAS7E,4EAA4E;IACtE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAK1E,mFAAmF;IAC7E,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E,iFAAiF;IAC3E,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1E;;;OAGG;IACH,WAAW,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3C;;OAEG;IACH,aAAa,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA6BhE;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,SAAQ,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAUhH,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,qBAAqB;YAQf,IAAI;IAsElB,OAAO,CAAC,OAAO;CAef"}
|
|
@@ -7,6 +7,7 @@ import { spawn } from "node:child_process";
|
|
|
7
7
|
import { createConnection } from "node:net";
|
|
8
8
|
import { MissingSessionCwdError } from "../../core/session-cwd.js";
|
|
9
9
|
import { attachJsonlLineReader, serializeJsonLine } from "./jsonl.js";
|
|
10
|
+
import { readSocketSecret, resolveSocketTransportAddress, sendSocketHandshake, socketSecretPath, } from "./socket-transport.js";
|
|
10
11
|
function isProviderAccountEvent(event) {
|
|
11
12
|
return event.type === "auth_accounts_changed" || event.type === "account_failover";
|
|
12
13
|
}
|
|
@@ -70,6 +71,9 @@ export class RpcClient {
|
|
|
70
71
|
cwd: this.options.cwd,
|
|
71
72
|
env: { ...process.env, ...this.options.env },
|
|
72
73
|
stdio: ["pipe", "pipe", "pipe"],
|
|
74
|
+
// Callers may be console-less on win32 (GUI hosts, detached daemons), and a
|
|
75
|
+
// console-subsystem child would then allocate a fresh visible terminal window.
|
|
76
|
+
windowsHide: true,
|
|
73
77
|
});
|
|
74
78
|
this.process = childProcess;
|
|
75
79
|
// Collect stderr for debugging
|
|
@@ -144,7 +148,8 @@ export class RpcClient {
|
|
|
144
148
|
this.pendingRequests.clear();
|
|
145
149
|
}
|
|
146
150
|
async startSocket(path) {
|
|
147
|
-
const
|
|
151
|
+
const secret = process.platform === "win32" ? await readSocketSecret(socketSecretPath(path)) : undefined;
|
|
152
|
+
const socket = createConnection(resolveSocketTransportAddress(path, process.platform, secret));
|
|
148
153
|
this.socket = socket;
|
|
149
154
|
await new Promise((resolve, reject) => {
|
|
150
155
|
const onConnect = () => {
|
|
@@ -163,6 +168,8 @@ export class RpcClient {
|
|
|
163
168
|
socket.once("connect", onConnect);
|
|
164
169
|
socket.once("error", onError);
|
|
165
170
|
});
|
|
171
|
+
if (secret)
|
|
172
|
+
sendSocketHandshake(socket, secret);
|
|
166
173
|
this.stopReadingStdout = attachJsonlLineReader(socket, (line) => this.handleLine(line));
|
|
167
174
|
socket.once("close", () => {
|
|
168
175
|
if (this.socket !== socket)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAe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ACxD,CAAC,CAAC;YAEH,IAAI,CAAC;gBACJ,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7C,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAChC,OAAO,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC;gBAChC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,OAAO,CAAI,QAAqB;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,aAAa,GAAG,QAAoD,CAAC;YAC3E,IAAI,aAAa,CAAC,SAAS,KAAK,qBAAqB,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAClF,MAAM,IAAI,sBAAsB,CAC/B,aAAa,CAAC,SAAoE,CAClF,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,8EAA8E;QAC9E,mFAAmF;QACnF,MAAM,eAAe,GAAG,QAAkE,CAAC;QAC3F,OAAO,eAAe,CAAC,IAAS,CAAC;IAClC,CAAC;CACD","sourcesContent":["/**\n * RPC Client for programmatic access to the coding agent.\n *\n * Spawns the agent in RPC mode and provides a typed API for all operations.\n */\n\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport { createConnection, type Socket } from \"node:net\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { ImageContent } from \"@earendil-works/pi-ai\";\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 { ServiceTier } from \"../../core/extensions/builtin/service-tier.ts\";\nimport { MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.ts\";\nimport type {\n\tRpcAccountFailoverEvent,\n\tRpcAuthAccountsChangedEvent,\n\tRpcCommand,\n\tRpcExtensionEvent,\n\tRpcExtensionUIRequest,\n\tRpcExtensionUIResponse,\n\tRpcProviderAccount,\n\tRpcResponse,\n\tRpcSessionModelEntry,\n\tRpcSessionReplacedEvent,\n\tRpcSessionState,\n\tRpcSlashCommand,\n} from \"./rpc-types.ts\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Distributive Omit that works with union types */\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\n/** RpcCommand without the id field (for internal send) */\ntype RpcCommandBody = DistributiveOmit<RpcCommand, \"id\">;\n\nexport interface RpcClientOptions {\n\t/** Connect to an existing multi-session Unix socket instead of spawning a child. */\n\tsocketPath?: string;\n\t/** Called once when an established transport disconnects. */\n\tonDisconnect?: (error: RpcTransportGoneError) => void;\n\t/** Path to the CLI entry point (default: searches for dist/cli.js) */\n\tcliPath?: string;\n\t/** Working directory for the agent */\n\tcwd?: string;\n\t/** Environment variables */\n\tenv?: Record<string, string>;\n\t/** Provider to use */\n\tprovider?: string;\n\t/** Model ID to use */\n\tmodel?: string;\n\t/** Additional CLI arguments */\n\targs?: string[];\n}\n\nexport interface ModelInfo {\n\tprovider: string;\n\tid: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n\tsupportedThinkingLevels?: ThinkingLevel[];\n}\n\ntype PromptOptions = {\n\timages?: ImageContent[];\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tthinkingLevel?: ThinkingLevel;\n\tpromptDisposition?: (disposition: PromptDisposition) => void;\n\tpreflightResult?: (success: boolean) => void;\n\tsessionTitlePrompt?: string | false;\n\texpandPromptTemplates?: boolean;\n};\n\nexport type RpcProviderAccountEvent = RpcAuthAccountsChangedEvent | RpcAccountFailoverEvent;\nexport type RpcClientEvent =\n\t| JsonAgentSessionEvent\n\t| RpcProviderAccountEvent\n\t| RpcExtensionEvent\n\t| RpcExtensionUIRequest\n\t// The host swapped the live session behind this connection. Part of the public\n\t// union so a typed client can discriminate on the type and read the new\n\t// `durableSessionId` without casting: the command response carries only\n\t// `{ cancelled }`, and a replacement may be driven by another client or an\n\t// extension, so this is the only channel delivering the new identity.\n\t| RpcSessionReplacedEvent\n\t| { type: \"bash_start\" }\n\t| { type: \"bash_end\" };\nexport type RpcEventListener = (event: RpcClientEvent) => void;\n\nfunction isProviderAccountEvent(event: RpcClientEvent): event is RpcProviderAccountEvent {\n\treturn event.type === \"auth_accounts_changed\" || event.type === \"account_failover\";\n}\n\n// ============================================================================\n// RPC Client\n// ============================================================================\n\nexport class RpcTransportGoneError extends Error {\n\treadonly code = \"rpc_transport_gone\" as const;\n\n\tconstructor(message = \"Shared RPC host is unavailable\") {\n\t\tsuper(message);\n\t\tthis.name = \"RpcTransportGoneError\";\n\t}\n}\n\nexport function isTransportGoneError(error: unknown): error is RpcTransportGoneError {\n\treturn (\n\t\terror instanceof RpcTransportGoneError ||\n\t\t(error instanceof Error &&\n\t\t\t(error.message === \"Client not started\" ||\n\t\t\t\terror.message.startsWith(\"RPC transport is not writable.\") ||\n\t\t\t\terror.message === \"RPC socket closed\"))\n\t);\n}\n\nexport class RpcClient {\n\tprivate process: ChildProcess | null = null;\n\tprivate socket: Socket | null = null;\n\tprivate stopReadingStdout: (() => void) | null = null;\n\tprivate eventListeners: RpcEventListener[] = [];\n\tprivate pendingRequests: Map<\n\t\tstring,\n\t\t{\n\t\t\tresolve: (response: RpcResponse) => void;\n\t\t\treject: (error: Error) => void;\n\t\t\tonResponse?: (response: RpcResponse) => void;\n\t\t\tonReject?: (error: Error) => void;\n\t\t}\n\t> = new Map();\n\tprivate requestId = 0;\n\tprivate sessionId: string | undefined;\n\tprivate stderr = \"\";\n\tprivate exitError: Error | null = null;\n\tprivate disconnectNotified = false;\n\tprivate stopping = false;\n\tprivate options: RpcClientOptions;\n\n\tconstructor(options: RpcClientOptions = {}) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t * Start the RPC agent process.\n\t */\n\tasync start(): Promise<void> {\n\t\tif (this.process || this.socket) {\n\t\t\tthrow new Error(\"Client already started\");\n\t\t}\n\n\t\tthis.exitError = null;\n\t\tthis.stopping = false;\n\t\tthis.disconnectNotified = false;\n\t\tif (this.options.socketPath) {\n\t\t\tawait this.startSocket(this.options.socketPath);\n\t\t\treturn;\n\t\t}\n\n\t\tconst cliPath = this.options.cliPath ?? \"dist/cli.js\";\n\t\tconst args = [\"--mode\", \"rpc\"];\n\n\t\tif (this.options.provider) {\n\t\t\targs.push(\"--provider\", this.options.provider);\n\t\t}\n\t\tif (this.options.model) {\n\t\t\targs.push(\"--model\", this.options.model);\n\t\t}\n\t\tif (this.options.args) {\n\t\t\targs.push(...this.options.args);\n\t\t}\n\n\t\tconst childProcess = spawn(\"node\", [cliPath, ...args], {\n\t\t\tcwd: this.options.cwd,\n\t\t\tenv: { ...process.env, ...this.options.env },\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t});\n\t\tthis.process = childProcess;\n\n\t\t// Collect stderr for debugging\n\t\tchildProcess.stderr?.on(\"data\", (data) => {\n\t\t\tthis.stderr += data.toString();\n\t\t\tprocess.stderr.write(data);\n\t\t});\n\n\t\tchildProcess.once(\"exit\", (code, signal) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst error = this.createProcessExitError(code, signal);\n\t\t\tthis.exitError = error;\n\t\t\tthis.rejectPendingRequests(error);\n\t\t});\n\t\tchildProcess.once(\"error\", (error) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst processError = new Error(`Agent process error: ${error.message}. Stderr: ${this.stderr}`);\n\t\t\tthis.exitError = processError;\n\t\t\tthis.rejectPendingRequests(processError);\n\t\t});\n\t\tchildProcess.stdin?.on(\"error\", (error) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst stdinError =\n\t\t\t\tthis.exitError ?? new Error(`Agent process stdin error: ${error.message}. Stderr: ${this.stderr}`);\n\t\t\tthis.exitError = stdinError;\n\t\t\tthis.rejectPendingRequests(stdinError);\n\t\t});\n\n\t\t// Set up strict JSONL reader for stdout.\n\t\tthis.stopReadingStdout = attachJsonlLineReader(childProcess.stdout!, (line) => {\n\t\t\tthis.handleLine(line);\n\t\t});\n\n\t\t// Wait a moment for process to initialize\n\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\n\t\tif (this.process.exitCode !== null) {\n\t\t\tconst error = this.exitError ?? this.createProcessExitError(this.process.exitCode, this.process.signalCode);\n\t\t\tthis.exitError = error;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Stop the RPC agent process.\n\t */\n\tasync stop(): Promise<void> {\n\t\tif (this.socket) {\n\t\t\tthis.stopping = true;\n\t\t\tthis.stopReadingStdout?.();\n\t\t\tthis.stopReadingStdout = null;\n\t\t\tthis.socket.destroy();\n\t\t\tthis.socket = null;\n\t\t\tthis.sessionId = undefined;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t\treturn;\n\t\t}\n\t\tif (!this.process) return;\n\n\t\tthis.stopReadingStdout?.();\n\t\tthis.stopReadingStdout = null;\n\t\tthis.process.kill(\"SIGTERM\");\n\n\t\t// Wait for process to exit\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tthis.process?.kill(\"SIGKILL\");\n\t\t\t\tresolve();\n\t\t\t}, 1000);\n\n\t\t\tthis.process?.on(\"exit\", () => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\tthis.process = null;\n\t\tthis.pendingRequests.clear();\n\t}\n\n\tprivate async startSocket(path: string): Promise<void> {\n\t\tconst socket = createConnection(path);\n\t\tthis.socket = socket;\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst onConnect = () => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tconst onError = (error: Error) => {\n\t\t\t\tcleanup();\n\t\t\t\tthis.socket = null;\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tsocket.off(\"connect\", onConnect);\n\t\t\t\tsocket.off(\"error\", onError);\n\t\t\t};\n\t\t\tsocket.once(\"connect\", onConnect);\n\t\t\tsocket.once(\"error\", onError);\n\t\t});\n\t\tthis.stopReadingStdout = attachJsonlLineReader(socket, (line) => this.handleLine(line));\n\t\tsocket.once(\"close\", () => {\n\t\t\tif (this.socket !== socket) return;\n\t\t\tthis.socket = null;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t});\n\t\tsocket.once(\"error\", (error) => {\n\t\t\tif (this.socket !== socket) return;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t\tvoid error;\n\t\t});\n\t}\n\n\t/**\n\t * Subscribe to agent events.\n\t */\n\tonEvent(listener: RpcEventListener): () => void {\n\t\tthis.eventListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.eventListeners.indexOf(listener);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.eventListeners.splice(index, 1);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Get collected stderr output (useful for debugging).\n\t */\n\tgetStderr(): string {\n\t\treturn this.stderr;\n\t}\n\n\t// =========================================================================\n\t// Command Methods\n\t// =========================================================================\n\n\tasync setClientInfo(width: number, capabilities?: string[]): Promise<void> {\n\t\tawait this.send({ type: \"set_client_info\", width, capabilities }, this.sessionId !== undefined);\n\t}\n\n\tasync openSession(options: {\n\t\tsessionPath?: string;\n\t\tcwd?: string;\n\t\tprovider?: string;\n\t\tmodelId?: string;\n\t\tthinkingLevel?: ThinkingLevel;\n\t\tpermissionPreset?: string;\n\t}): Promise<{ sessionId: string; state: RpcSessionState; attached?: boolean }> {\n\t\tconst response = await this.send({ type: \"open_session\", ...options }, false);\n\t\tconst opened = this.getData<{ sessionId: string; state: RpcSessionState; attached?: boolean }>(response);\n\t\tthis.sessionId = opened.sessionId;\n\t\treturn opened;\n\t}\n\n\tasync sendExtensionUIResponse(response: RpcExtensionUIResponse): Promise<void> {\n\t\tawait this.send(response, true, undefined, false);\n\t}\n\n\tasync closeSession(sessionId = this.sessionId): Promise<void> {\n\t\tif (!sessionId) return;\n\t\ttry {\n\t\t\tawait this.send({ type: \"close_session\", sessionId }, false);\n\t\t} catch (error) {\n\t\t\tif (!isTransportGoneError(error)) throw error;\n\t\t}\n\t\tif (this.sessionId === sessionId) this.sessionId = undefined;\n\t}\n\n\tasync listSessions(): Promise<\n\t\tArray<{\n\t\t\tsessionId: string;\n\t\t\tdurableSessionId?: string;\n\t\t\tsessionPath?: string;\n\t\t\tcwd: string;\n\t\t\tname?: string;\n\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t}>\n\t> {\n\t\tconst response = await this.send({ type: \"list_sessions\" }, false);\n\t\treturn this.getData<{\n\t\t\tsessions: Array<{\n\t\t\t\tsessionId: string;\n\t\t\t\tdurableSessionId?: string;\n\t\t\t\tsessionPath?: string;\n\t\t\t\tcwd: string;\n\t\t\t\tname?: string;\n\t\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t\t}>;\n\t\t}>(response).sessions;\n\t}\n\n\t/**\n\t * Send a prompt to the agent.\n\t * Returns immediately after sending; use onEvent() to receive streaming events.\n\t * Use waitForIdle() to wait for completion.\n\t *\n\t * The disposition/preflight callbacks mirror AgentSession's local prompt contract:\n\t * they fire synchronously while the response frame is dispatched — before any\n\t * queued message_start event — so optimistic-echo eligibility is settled in wire\n\t * order. A success response without a disposition (older host) maps to \"handled\"\n\t * so the echo degrades to canonical-only rendering instead of double-rendering.\n\t */\n\tasync prompt(message: string, images?: ImageContent[]): Promise<void>;\n\tasync prompt(message: string, options?: PromptOptions): Promise<void>;\n\tasync prompt(message: string, optionsOrImages?: PromptOptions | ImageContent[]): Promise<void> {\n\t\tconst options: PromptOptions = Array.isArray(optionsOrImages)\n\t\t\t? { images: optionsOrImages }\n\t\t\t: (optionsOrImages ?? {});\n\t\tconst response = await this.send(\n\t\t\t{\n\t\t\t\ttype: \"prompt\",\n\t\t\t\tmessage,\n\t\t\t\t...(options.images ? { images: options.images } : {}),\n\t\t\t\t...(options.streamingBehavior ? { streamingBehavior: options.streamingBehavior } : {}),\n\t\t\t\t...(options.thinkingLevel ? { thinkingLevel: options.thinkingLevel } : {}),\n\t\t\t\t...(options.sessionTitlePrompt !== undefined ? { sessionTitlePrompt: options.sessionTitlePrompt } : {}),\n\t\t\t\t...(options.expandPromptTemplates !== undefined\n\t\t\t\t\t? { expandPromptTemplates: options.expandPromptTemplates }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t\ttrue,\n\t\t\t{\n\t\t\t\tonResponse: (wireResponse) => {\n\t\t\t\t\tif (!wireResponse.success) {\n\t\t\t\t\t\toptions?.preflightResult?.(false);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst data = (wireResponse as { data?: { disposition?: PromptDisposition } }).data;\n\t\t\t\t\toptions?.promptDisposition?.(data?.disposition ?? \"handled\");\n\t\t\t\t\toptions?.preflightResult?.(true);\n\t\t\t\t},\n\t\t\t\tonReject: () => {\n\t\t\t\t\toptions?.preflightResult?.(false);\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\tif (!response.success) {\n\t\t\tthrow new Error((response as Extract<RpcResponse, { success: false }>).error);\n\t\t}\n\t}\n\n\tasync appendUserMessage(content: unknown): Promise<void> {\n\t\tawait this.send({ type: \"append_user_message\", content });\n\t}\n\n\tasync appendSessionEntry(entry: import(\"../../core/session-manager.ts\").SessionEntry): Promise<void> {\n\t\tawait this.send({ type: \"append_session_entry\", entry });\n\t}\n\n\tasync sendCustomMessage<T = unknown>(\n\t\tmessage: { customType: string; content: unknown; display: boolean; details?: T },\n\t\toptions?: { triggerTurn?: boolean; deliverAs?: \"steer\" | \"followUp\" | \"nextTurn\" },\n\t): Promise<void> {\n\t\tawait this.send({ type: \"send_custom_message\", ...message, ...options });\n\t}\n\n\t/**\n\t * Queue a steering message to interrupt the agent mid-run.\n\t */\n\tasync steer(message: string, images?: ImageContent[], recovery?: { enqueueOrder?: number }): Promise<void> {\n\t\tawait this.send({ type: \"steer\", message, images, enqueueOrder: recovery?.enqueueOrder });\n\t}\n\n\t/**\n\t * Queue a follow-up message to be processed after the agent finishes.\n\t */\n\tasync followUp(message: string, images?: ImageContent[], recovery?: { enqueueOrder?: number }): Promise<void> {\n\t\tawait this.send({ type: \"follow_up\", message, images, enqueueOrder: recovery?.enqueueOrder });\n\t}\n\n\t/**\n\t * Abort current operation.\n\t */\n\tasync abort(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.send({ type: \"abort\" });\n\t\t} catch (error) {\n\t\t\tif (!isTransportGoneError(error)) throw error;\n\t\t}\n\t}\n\n\tasync abortCompaction(): Promise<void> {\n\t\tawait this.send({ type: \"abort_compaction\" });\n\t}\n\n\tasync reload(): Promise<{ cancelled: boolean; reason?: string }> {\n\t\tconst response = await this.send({ type: \"reload\" });\n\t\treturn this.getData(response);\n\t}\n\n\tasync checkReloadVeto(): Promise<{ cancelled: boolean; reason?: string }> {\n\t\tconst response = await this.send({ type: \"check_reload_veto\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Clear queued steering and follow-up messages, returning their text.\n\t */\n\tasync clearQueue(options?: { abortWillFollow?: boolean }): Promise<{\n\t\tsteering: string[];\n\t\tfollowUp: string[];\n\t\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\t}> {\n\t\tconst response = await this.send({ type: \"clear_queue\", abortWillFollow: options?.abortWillFollow });\n\t\treturn this.getData(response);\n\t}\n\n\tasync getSteeringMessages(): Promise<string[]> {\n\t\tconst response = await this.send({ type: \"get_steering_messages\" });\n\t\treturn this.getData<{ messages: string[] }>(response).messages;\n\t}\n\n\tasync getFollowUpMessages(): Promise<string[]> {\n\t\tconst response = await this.send({ type: \"get_follow_up_messages\" });\n\t\treturn this.getData<{ messages: string[] }>(response).messages;\n\t}\n\n\tasync abortBranchSummary(): Promise<void> {\n\t\tawait this.send({ type: \"abort_branch_summary\" });\n\t}\n\n\tasync recordBashResult(command: string, result: BashResult, excludeFromContext?: boolean): Promise<void> {\n\t\tawait this.send({ type: \"record_bash_result\", command, result, excludeFromContext });\n\t}\n\n\tasync setLabel(entryId: string, label?: string): Promise<void> {\n\t\tawait this.send({ type: \"set_label\", entryId, label });\n\t}\n\n\t/**\n\t * Start a new session, optionally with parent tracking.\n\t * @param parentSession - Optional parent session path for lineage tracking\n\t * @returns Object with `cancelled: true` if an extension cancelled the new session\n\t */\n\tasync newSession(parentSession?: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"new_session\", parentSession });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get current session state.\n\t */\n\tasync getState(): Promise<RpcSessionState> {\n\t\tconst response = await this.send({ type: \"get_state\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set model by provider and ID.\n\t */\n\tasync setModel(\n\t\tprovider: string,\n\t\tmodelId: string,\n\t): Promise<{ provider: string; id: string; systemPromptName?: string }> {\n\t\tconst response = await this.send({ type: \"set_model\", provider, modelId });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Cycle to next model.\n\t */\n\tasync setFavoriteModels(models: RpcSessionModelEntry[]): Promise<void> {\n\t\tawait this.send({ type: \"set_favorite_models\", models });\n\t}\n\n\tasync setScopedModels(models: RpcSessionModelEntry[]): Promise<void> {\n\t\tawait this.send({ type: \"set_scoped_models\", models });\n\t}\n\n\tasync cycleModel(direction: \"forward\" | \"backward\" = \"forward\"): Promise<{\n\t\tmodel: { provider: string; id: string };\n\t\tthinkingLevel: ThinkingLevel;\n\t\tisScoped: boolean;\n\t} | null> {\n\t\tconst response = await this.send({ type: \"cycle_model\", direction });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get list of available models.\n\t */\n\tasync getAvailableModels(): Promise<ModelInfo[]> {\n\t\tconst response = await this.send({ type: \"get_available_models\" });\n\t\treturn this.getData<{ models: ModelInfo[] }>(response).models;\n\t}\n\n\t/**\n\t * Set thinking level.\n\t *\n\t * `scope: \"turn\"` changes only this session's level without rewriting the model's remembered\n\t * level; it throws when the active model does not support the requested level, and the\n\t * session keeps the level it already had.\n\t */\n\tasync setThinkingLevel(level: ThinkingLevel, options?: { scope?: \"turn\" }): Promise<void> {\n\t\tconst response = await this.send({ type: \"set_thinking_level\", level, scope: options?.scope });\n\t\tif (!response.success) {\n\t\t\tthrow new Error((response as Extract<RpcResponse, { success: false }>).error);\n\t\t}\n\t}\n\n\t/**\n\t * Cycle thinking level.\n\t */\n\tasync cycleThinkingLevel(): Promise<{ level: ThinkingLevel } | null> {\n\t\tconst response = await this.send({ type: \"cycle_thinking_level\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get list of available thinking levels for the current model.\n\t */\n\tasync getAvailableThinkingLevels(): Promise<ThinkingLevel[]> {\n\t\tconst response = await this.send({ type: \"get_available_thinking_levels\" });\n\t\treturn this.getData<{ levels: ThinkingLevel[] }>(response).levels;\n\t}\n\n\t/**\n\t * Turn OpenAI Codex fast mode (the `priority` service tier) on or off for the active model.\n\t *\n\t * The choice is remembered per model, so a later session on the same model starts the same\n\t * way. Throws when the request is refused: a non-Codex model, or an active `:priority` model\n\t * pin that fast mode must not undo.\n\t */\n\tasync setFastMode(\n\t\tenabled: boolean,\n\t): Promise<{ enabled: boolean; serviceTier: ServiceTier; provider: string; modelId: string }> {\n\t\tconst response = await this.send({ type: \"set_fast_mode\", enabled });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Current fast-mode state and the service tier requests would carry. */\n\tasync getFastMode(): Promise<{ enabled: boolean; serviceTier: ServiceTier | null }> {\n\t\tconst response = await this.send({ type: \"get_fast_mode\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set steering mode.\n\t */\n\tasync setSteeringMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_steering_mode\", mode });\n\t}\n\n\t/**\n\t * Set follow-up mode.\n\t */\n\tasync setFollowUpMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_follow_up_mode\", mode });\n\t}\n\n\t/**\n\t * Compact session context.\n\t */\n\tasync compact(customInstructions?: string): Promise<CompactionResult> {\n\t\tconst response = await this.send({ type: \"compact\", customInstructions });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set auto-compaction enabled/disabled.\n\t */\n\tasync setAutoCompaction(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_compaction\", enabled });\n\t}\n\n\t/**\n\t * Set auto-retry enabled/disabled.\n\t */\n\tasync setAutoRetry(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_retry\", enabled });\n\t}\n\n\t/**\n\t * Abort in-progress retry.\n\t */\n\tasync abortRetry(): Promise<void> {\n\t\tawait this.send({ type: \"abort_retry\" });\n\t}\n\n\t/**\n\t * Execute a bash command.\n\t */\n\tasync bash(\n\t\tcommand: string,\n\t\toptions?: { excludeFromContext?: boolean; executionId?: string; operations?: Record<string, unknown> },\n\t): Promise<BashResult> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"bash\",\n\t\t\tcommand,\n\t\t\texcludeFromContext: options?.excludeFromContext,\n\t\t\texecutionId: options?.executionId,\n\t\t\toperations: options?.operations,\n\t\t});\n\t\treturn this.getData(response);\n\t}\n\n\tasync navigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ cancelled: boolean; editorText?: string; aborted?: boolean; summaryEntry?: unknown }> {\n\t\tconst response = await this.send({ type: \"navigate_tree\", targetId, ...options });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Abort running bash command.\n\t */\n\tasync abortBash(): Promise<void> {\n\t\tawait this.send({ type: \"abort_bash\" });\n\t}\n\n\tasync cleanupBashOutput(path: string): Promise<void> {\n\t\tawait this.send({ type: \"cleanup_bash_output\", path });\n\t}\n\n\t/**\n\t * Get session statistics.\n\t */\n\tasync getSessionStats(): Promise<SessionStats> {\n\t\tconst response = await this.send({ type: \"get_session_stats\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Export session to HTML.\n\t */\n\tasync exportHtml(outputPath?: string, themeName?: string): Promise<{ path: string }> {\n\t\tconst response = await this.send({ type: \"export_html\", outputPath, themeName });\n\t\treturn this.getData(response);\n\t}\n\n\tasync exportJsonl(outputPath?: string): Promise<{ path: string }> {\n\t\tconst response = await this.send({ type: \"export_jsonl\", outputPath });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Switch to a different session file.\n\t * @returns Object with `cancelled: true` if an extension cancelled the switch\n\t */\n\tasync switchSession(sessionPath: string, options?: { cwdOverride?: string }): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"switch_session\", sessionPath, cwdOverride: options?.cwdOverride });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Fork from a specific message.\n\t * @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)\n\t */\n\tasync fork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\" },\n\t): Promise<{ text: string; cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"fork\", entryId, position: options?.position });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Clone the current active branch into a new session.\n\t * @returns Object with `cancelled: true` if an extension cancelled the clone\n\t */\n\tasync clone(): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"clone\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get messages available for forking.\n\t */\n\tasync getForkMessages(): Promise<Array<{ entryId: string; text: string }>> {\n\t\tconst response = await this.send({ type: \"get_fork_messages\" });\n\t\treturn this.getData<{ messages: Array<{ entryId: string; text: string }> }>(response).messages;\n\t}\n\n\t/**\n\t * Get session entries in append order, optionally only those after the `since` entry id.\n\t */\n\tasync getEntries(since?: string): Promise<{ entries: SessionEntry[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_entries\", since });\n\t\treturn this.getData<{ entries: SessionEntry[]; leafId: string | null }>(response);\n\t}\n\n\t/**\n\t * Get the session entry tree.\n\t */\n\tasync getTree(): Promise<{ tree: SessionTreeNode[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_tree\" });\n\t\treturn this.getData<{ tree: SessionTreeNode[]; leafId: string | null }>(response);\n\t}\n\n\t/**\n\t * Get text of last assistant message.\n\t */\n\tasync getLastAssistantText(): Promise<string | null> {\n\t\tconst response = await this.send({ type: \"get_last_assistant_text\" });\n\t\treturn this.getData<{ text: string | null }>(response).text;\n\t}\n\n\t/**\n\t * Set the session display name.\n\t */\n\tasync setSessionName(name: string): Promise<void> {\n\t\tawait this.send({ type: \"set_session_name\", name });\n\t}\n\n\tasync importJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"import_jsonl\", inputPath, cwdOverride });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get all messages in the session.\n\t */\n\tasync getMessages(): Promise<AgentMessage[]> {\n\t\tconst response = await this.send({ type: \"get_messages\" });\n\t\treturn this.getData<{ messages: AgentMessage[] }>(response).messages;\n\t}\n\n\t/**\n\t * Get available commands (extension commands, prompt templates, skills).\n\t */\n\tasync getCommands(): Promise<RpcSlashCommand[]> {\n\t\tconst response = await this.send({ type: \"get_commands\" });\n\t\treturn this.getData<{ commands: RpcSlashCommand[] }>(response).commands;\n\t}\n\n\t/** Invoke one extension-owned RPC request handler and return its structured result. */\n\tasync requestExtension<T = unknown>(name: string, data?: unknown): Promise<T> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"extension_request\",\n\t\t\tname,\n\t\t\t...(data === undefined ? {} : { data }),\n\t\t});\n\t\treturn this.getData<T>(response);\n\t}\n\n\t/** List safe metadata for the named provider's configured account slots. */\n\tasync getProviderAccounts(provider: string): Promise<RpcProviderAccount[]> {\n\t\tconst response = await this.send({ type: \"get_provider_accounts\", provider });\n\t\treturn this.getData<{ accounts: RpcProviderAccount[] }>(response).accounts;\n\t}\n\n\t/** Pin a provider account for future session-affine requests, or clear the pin. */\n\tasync pinProviderAccount(provider: string, name: string | null): Promise<void> {\n\t\tawait this.send({ type: \"account_pin\", provider, name });\n\t}\n\n\t/** Remove a persisted provider account slot. Environment slots are read-only. */\n\tasync removeProviderAccount(provider: string, name: string): Promise<void> {\n\t\tawait this.send({ type: \"account_remove\", provider, name });\n\t}\n\n\t// =========================================================================\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Wait for agent to become idle (no streaming).\n\t * Resolves when agent_settled event is received.\n\t */\n\twaitForIdle(timeout = 60000): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout waiting for agent to become idle. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tif (event.type === \"agent_settled\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Collect events until agent becomes idle.\n\t */\n\tcollectEvents(timeout = 60000): Promise<JsonAgentSessionEvent[]> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst events: JsonAgentSessionEvent[] = [];\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout collecting events. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tif (\n\t\t\t\t\tisProviderAccountEvent(event) ||\n\t\t\t\t\tevent.type === \"extension_event\" ||\n\t\t\t\t\tevent.type === \"bash_start\" ||\n\t\t\t\t\tevent.type === \"bash_end\" ||\n\t\t\t\t\tevent.type === \"extension_ui_request\" ||\n\t\t\t\t\t// Connection-level, not part of the agent's event stream.\n\t\t\t\t\tevent.type === \"session_replaced\"\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tevents.push(event);\n\t\t\t\tif (event.type === \"agent_settled\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve(events);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Send prompt and wait for completion, returning all events.\n\t */\n\tasync promptAndWait(message: string, images?: ImageContent[], timeout = 60000): Promise<JsonAgentSessionEvent[]> {\n\t\tconst eventsPromise = this.collectEvents(timeout);\n\t\tawait this.prompt(message, images ? { images } : undefined);\n\t\treturn eventsPromise;\n\t}\n\n\t// =========================================================================\n\t// Internal\n\t// =========================================================================\n\n\tprivate handleLine(line: string): void {\n\t\ttry {\n\t\t\tconst data = JSON.parse(line);\n\n\t\t\t// Check if it's a response to a pending request\n\t\t\tif (data.type === \"response\" && data.id && this.pendingRequests.has(data.id)) {\n\t\t\t\tconst pending = this.pendingRequests.get(data.id)!;\n\t\t\t\tthis.pendingRequests.delete(data.id);\n\t\t\t\t// Response hooks run synchronously inside the frame dispatch so ordering-sensitive\n\t\t\t\t// contracts (e.g. optimistic-echo disposition) settle before the NEXT frame —\n\t\t\t\t// never through the microtask scheduled by resolve().\n\t\t\t\tpending.onResponse?.(data as RpcResponse);\n\t\t\t\tpending.resolve(data as RpcResponse);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise it's an event. Multi-session hosts broadcast all session\n\t\t\t// events to every connection; a routed client exposes only its lease.\n\t\t\tif (data.sessionId !== undefined && this.sessionId !== undefined && data.sessionId !== this.sessionId) return;\n\t\t\tfor (const listener of this.eventListeners) {\n\t\t\t\tlistener(data as RpcClientEvent);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore non-JSON lines\n\t\t}\n\t}\n\n\tprivate createProcessExitError(code: number | null, signal: NodeJS.Signals | null): Error {\n\t\treturn new Error(`Agent process exited (code=${code} signal=${signal}). Stderr: ${this.stderr}`);\n\t}\n\n\tprivate notifyDisconnect(error: RpcTransportGoneError): void {\n\t\tthis.rejectPendingRequests(error);\n\t\tif (!this.disconnectNotified && !this.stopping) {\n\t\t\tthis.disconnectNotified = true;\n\t\t\tthis.options.onDisconnect?.(error);\n\t\t}\n\t}\n\n\tprivate rejectPendingRequests(error: Error): void {\n\t\tfor (const pending of this.pendingRequests.values()) {\n\t\t\tpending.onReject?.(error);\n\t\t\tpending.reject(error);\n\t\t}\n\t\tthis.pendingRequests.clear();\n\t}\n\n\tprivate async send(\n\t\tcommand: RpcCommandBody | RpcExtensionUIResponse,\n\t\troute = true,\n\t\thooks?: { onResponse?: (response: RpcResponse) => void; onReject?: (error: Error) => void },\n\t\texpectResponse = true,\n\t): Promise<RpcResponse> {\n\t\tconst childProcess = this.process;\n\t\tconst stream = this.socket ?? childProcess?.stdin;\n\t\tif (!stream) {\n\t\t\tthrow new RpcTransportGoneError();\n\t\t}\n\t\tif (this.exitError) {\n\t\t\tthrow this.exitError;\n\t\t}\n\t\tif (childProcess?.exitCode !== null && childProcess?.exitCode !== undefined) {\n\t\t\tconst error = this.createProcessExitError(childProcess.exitCode, childProcess.signalCode);\n\t\t\tthis.exitError = error;\n\t\t\tthrow error;\n\t\t}\n\t\tif (stream.destroyed || !stream.writable) {\n\t\t\tconst error = new RpcTransportGoneError();\n\t\t\tthis.notifyDisconnect(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst id = \"type\" in command && command.type === \"extension_ui_response\" ? command.id : `req_${++this.requestId}`;\n\t\tconst fullCommand = {\n\t\t\t...command,\n\t\t\t...(route && this.sessionId && !(\"sessionId\" in command) ? { sessionId: this.sessionId } : {}),\n\t\t\t...(command.type === \"extension_ui_response\" ? {} : { id }),\n\t\t} as RpcCommand;\n\n\t\tif (!expectResponse) {\n\t\t\tstream.write(serializeJsonLine(fullCommand));\n\t\t\treturn Promise.resolve({ type: \"response\", command: command.type, success: true } as RpcResponse);\n\t\t}\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tconst pending = this.pendingRequests.get(id);\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\tconst timeoutError = new Error(`Timeout waiting for response to ${command.type}. Stderr: ${this.stderr}`);\n\t\t\t\tpending?.onReject?.(timeoutError);\n\t\t\t\treject(timeoutError);\n\t\t\t}, 30000);\n\n\t\t\tthis.pendingRequests.set(id, {\n\t\t\t\tresolve: (response) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\tresolve(response);\n\t\t\t\t},\n\t\t\t\treject: (error) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t\t...(hooks?.onResponse ? { onResponse: hooks.onResponse } : {}),\n\t\t\t\t...(hooks?.onReject ? { onReject: hooks.onReject } : {}),\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tstream.write(serializeJsonLine(fullCommand));\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst writeError = error instanceof Error ? error : new Error(String(error));\n\t\t\t\tconst pending = this.pendingRequests.get(id);\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\tpending?.onReject?.(writeError);\n\t\t\t\tpending?.reject(writeError);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getData<T>(response: RpcResponse): T {\n\t\tif (!response.success) {\n\t\t\tconst errorResponse = response as Extract<RpcResponse, { success: false }>;\n\t\t\tif (errorResponse.errorCode === \"missing_session_cwd\" && errorResponse.errorData) {\n\t\t\t\tthrow new MissingSessionCwdError(\n\t\t\t\t\terrorResponse.errorData as ConstructorParameters<typeof MissingSessionCwdError>[0],\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(errorResponse.error);\n\t\t}\n\t\t// Type assertion: we trust response.data matches T based on the command sent.\n\t\t// This is safe because each public method specifies the correct T for its command.\n\t\tconst successResponse = response as Extract<RpcResponse, { success: true; data: unknown }>;\n\t\treturn successResponse.data as T;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AAOzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAetE,OAAO,EACN,gBAAgB,EAChB,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,uBAAuB,CAAC;AAiE/B,SAAS,sBAAsB,CAAC,KAAqB;IACpD,OAAO,KAAK,CAAC,IAAI,KAAK,uBAAuB,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC;AACpF,CAAC;AAED,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAG/C,YAAY,OAAO,GAAG,gCAAgC;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QA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C,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7C,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAChC,OAAO,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC;gBAChC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,OAAO,CAAI,QAAqB;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,aAAa,GAAG,QAAoD,CAAC;YAC3E,IAAI,aAAa,CAAC,SAAS,KAAK,qBAAqB,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAClF,MAAM,IAAI,sBAAsB,CAC/B,aAAa,CAAC,SAAoE,CAClF,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,8EAA8E;QAC9E,mFAAmF;QACnF,MAAM,eAAe,GAAG,QAAkE,CAAC;QAC3F,OAAO,eAAe,CAAC,IAAS,CAAC;IAClC,CAAC;CACD","sourcesContent":["/**\n * RPC Client for programmatic access to the coding agent.\n *\n * Spawns the agent in RPC mode and provides a typed API for all operations.\n */\n\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport { createConnection, type Socket } from \"node:net\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { ImageContent } from \"@earendil-works/pi-ai\";\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 { ServiceTier } from \"../../core/extensions/builtin/service-tier.ts\";\nimport { MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nimport type { SessionEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport { attachJsonlLineReader, serializeJsonLine } from \"./jsonl.ts\";\nimport type {\n\tRpcAccountFailoverEvent,\n\tRpcAuthAccountsChangedEvent,\n\tRpcCommand,\n\tRpcExtensionEvent,\n\tRpcExtensionUIRequest,\n\tRpcExtensionUIResponse,\n\tRpcProviderAccount,\n\tRpcResponse,\n\tRpcSessionModelEntry,\n\tRpcSessionReplacedEvent,\n\tRpcSessionState,\n\tRpcSlashCommand,\n} from \"./rpc-types.ts\";\nimport {\n\treadSocketSecret,\n\tresolveSocketTransportAddress,\n\tsendSocketHandshake,\n\tsocketSecretPath,\n} from \"./socket-transport.ts\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Distributive Omit that works with union types */\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\n/** RpcCommand without the id field (for internal send) */\ntype RpcCommandBody = DistributiveOmit<RpcCommand, \"id\">;\n\nexport interface RpcClientOptions {\n\t/** Connect to an existing multi-session Unix socket instead of spawning a child. */\n\tsocketPath?: string;\n\t/** Called once when an established transport disconnects. */\n\tonDisconnect?: (error: RpcTransportGoneError) => void;\n\t/** Path to the CLI entry point (default: searches for dist/cli.js) */\n\tcliPath?: string;\n\t/** Working directory for the agent */\n\tcwd?: string;\n\t/** Environment variables */\n\tenv?: Record<string, string>;\n\t/** Provider to use */\n\tprovider?: string;\n\t/** Model ID to use */\n\tmodel?: string;\n\t/** Additional CLI arguments */\n\targs?: string[];\n}\n\nexport interface ModelInfo {\n\tprovider: string;\n\tid: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n\tsupportedThinkingLevels?: ThinkingLevel[];\n}\n\ntype PromptOptions = {\n\timages?: ImageContent[];\n\tstreamingBehavior?: \"steer\" | \"followUp\";\n\tthinkingLevel?: ThinkingLevel;\n\tpromptDisposition?: (disposition: PromptDisposition) => void;\n\tpreflightResult?: (success: boolean) => void;\n\tsessionTitlePrompt?: string | false;\n\texpandPromptTemplates?: boolean;\n};\n\nexport type RpcProviderAccountEvent = RpcAuthAccountsChangedEvent | RpcAccountFailoverEvent;\nexport type RpcClientEvent =\n\t| JsonAgentSessionEvent\n\t| RpcProviderAccountEvent\n\t| RpcExtensionEvent\n\t| RpcExtensionUIRequest\n\t// The host swapped the live session behind this connection. Part of the public\n\t// union so a typed client can discriminate on the type and read the new\n\t// `durableSessionId` without casting: the command response carries only\n\t// `{ cancelled }`, and a replacement may be driven by another client or an\n\t// extension, so this is the only channel delivering the new identity.\n\t| RpcSessionReplacedEvent\n\t| { type: \"bash_start\" }\n\t| { type: \"bash_end\" };\nexport type RpcEventListener = (event: RpcClientEvent) => void;\n\nfunction isProviderAccountEvent(event: RpcClientEvent): event is RpcProviderAccountEvent {\n\treturn event.type === \"auth_accounts_changed\" || event.type === \"account_failover\";\n}\n\n// ============================================================================\n// RPC Client\n// ============================================================================\n\nexport class RpcTransportGoneError extends Error {\n\treadonly code = \"rpc_transport_gone\" as const;\n\n\tconstructor(message = \"Shared RPC host is unavailable\") {\n\t\tsuper(message);\n\t\tthis.name = \"RpcTransportGoneError\";\n\t}\n}\n\nexport function isTransportGoneError(error: unknown): error is RpcTransportGoneError {\n\treturn (\n\t\terror instanceof RpcTransportGoneError ||\n\t\t(error instanceof Error &&\n\t\t\t(error.message === \"Client not started\" ||\n\t\t\t\terror.message.startsWith(\"RPC transport is not writable.\") ||\n\t\t\t\terror.message === \"RPC socket closed\"))\n\t);\n}\n\nexport class RpcClient {\n\tprivate process: ChildProcess | null = null;\n\tprivate socket: Socket | null = null;\n\tprivate stopReadingStdout: (() => void) | null = null;\n\tprivate eventListeners: RpcEventListener[] = [];\n\tprivate pendingRequests: Map<\n\t\tstring,\n\t\t{\n\t\t\tresolve: (response: RpcResponse) => void;\n\t\t\treject: (error: Error) => void;\n\t\t\tonResponse?: (response: RpcResponse) => void;\n\t\t\tonReject?: (error: Error) => void;\n\t\t}\n\t> = new Map();\n\tprivate requestId = 0;\n\tprivate sessionId: string | undefined;\n\tprivate stderr = \"\";\n\tprivate exitError: Error | null = null;\n\tprivate disconnectNotified = false;\n\tprivate stopping = false;\n\tprivate options: RpcClientOptions;\n\n\tconstructor(options: RpcClientOptions = {}) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t * Start the RPC agent process.\n\t */\n\tasync start(): Promise<void> {\n\t\tif (this.process || this.socket) {\n\t\t\tthrow new Error(\"Client already started\");\n\t\t}\n\n\t\tthis.exitError = null;\n\t\tthis.stopping = false;\n\t\tthis.disconnectNotified = false;\n\t\tif (this.options.socketPath) {\n\t\t\tawait this.startSocket(this.options.socketPath);\n\t\t\treturn;\n\t\t}\n\n\t\tconst cliPath = this.options.cliPath ?? \"dist/cli.js\";\n\t\tconst args = [\"--mode\", \"rpc\"];\n\n\t\tif (this.options.provider) {\n\t\t\targs.push(\"--provider\", this.options.provider);\n\t\t}\n\t\tif (this.options.model) {\n\t\t\targs.push(\"--model\", this.options.model);\n\t\t}\n\t\tif (this.options.args) {\n\t\t\targs.push(...this.options.args);\n\t\t}\n\n\t\tconst childProcess = spawn(\"node\", [cliPath, ...args], {\n\t\t\tcwd: this.options.cwd,\n\t\t\tenv: { ...process.env, ...this.options.env },\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t\t// Callers may be console-less on win32 (GUI hosts, detached daemons), and a\n\t\t\t// console-subsystem child would then allocate a fresh visible terminal window.\n\t\t\twindowsHide: true,\n\t\t});\n\t\tthis.process = childProcess;\n\n\t\t// Collect stderr for debugging\n\t\tchildProcess.stderr?.on(\"data\", (data) => {\n\t\t\tthis.stderr += data.toString();\n\t\t\tprocess.stderr.write(data);\n\t\t});\n\n\t\tchildProcess.once(\"exit\", (code, signal) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst error = this.createProcessExitError(code, signal);\n\t\t\tthis.exitError = error;\n\t\t\tthis.rejectPendingRequests(error);\n\t\t});\n\t\tchildProcess.once(\"error\", (error) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst processError = new Error(`Agent process error: ${error.message}. Stderr: ${this.stderr}`);\n\t\t\tthis.exitError = processError;\n\t\t\tthis.rejectPendingRequests(processError);\n\t\t});\n\t\tchildProcess.stdin?.on(\"error\", (error) => {\n\t\t\tif (this.process !== childProcess) return;\n\t\t\tconst stdinError =\n\t\t\t\tthis.exitError ?? new Error(`Agent process stdin error: ${error.message}. Stderr: ${this.stderr}`);\n\t\t\tthis.exitError = stdinError;\n\t\t\tthis.rejectPendingRequests(stdinError);\n\t\t});\n\n\t\t// Set up strict JSONL reader for stdout.\n\t\tthis.stopReadingStdout = attachJsonlLineReader(childProcess.stdout!, (line) => {\n\t\t\tthis.handleLine(line);\n\t\t});\n\n\t\t// Wait a moment for process to initialize\n\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\n\t\tif (this.process.exitCode !== null) {\n\t\t\tconst error = this.exitError ?? this.createProcessExitError(this.process.exitCode, this.process.signalCode);\n\t\t\tthis.exitError = error;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Stop the RPC agent process.\n\t */\n\tasync stop(): Promise<void> {\n\t\tif (this.socket) {\n\t\t\tthis.stopping = true;\n\t\t\tthis.stopReadingStdout?.();\n\t\t\tthis.stopReadingStdout = null;\n\t\t\tthis.socket.destroy();\n\t\t\tthis.socket = null;\n\t\t\tthis.sessionId = undefined;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t\treturn;\n\t\t}\n\t\tif (!this.process) return;\n\n\t\tthis.stopReadingStdout?.();\n\t\tthis.stopReadingStdout = null;\n\t\tthis.process.kill(\"SIGTERM\");\n\n\t\t// Wait for process to exit\n\t\tawait new Promise<void>((resolve) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tthis.process?.kill(\"SIGKILL\");\n\t\t\t\tresolve();\n\t\t\t}, 1000);\n\n\t\t\tthis.process?.on(\"exit\", () => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\tthis.process = null;\n\t\tthis.pendingRequests.clear();\n\t}\n\n\tprivate async startSocket(path: string): Promise<void> {\n\t\tconst secret = process.platform === \"win32\" ? await readSocketSecret(socketSecretPath(path)) : undefined;\n\t\tconst socket = createConnection(resolveSocketTransportAddress(path, process.platform, secret));\n\t\tthis.socket = socket;\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst onConnect = () => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tconst onError = (error: Error) => {\n\t\t\t\tcleanup();\n\t\t\t\tthis.socket = null;\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tsocket.off(\"connect\", onConnect);\n\t\t\t\tsocket.off(\"error\", onError);\n\t\t\t};\n\t\t\tsocket.once(\"connect\", onConnect);\n\t\t\tsocket.once(\"error\", onError);\n\t\t});\n\t\tif (secret) sendSocketHandshake(socket, secret);\n\t\tthis.stopReadingStdout = attachJsonlLineReader(socket, (line) => this.handleLine(line));\n\t\tsocket.once(\"close\", () => {\n\t\t\tif (this.socket !== socket) return;\n\t\t\tthis.socket = null;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t});\n\t\tsocket.once(\"error\", (error) => {\n\t\t\tif (this.socket !== socket) return;\n\t\t\tthis.notifyDisconnect(new RpcTransportGoneError());\n\t\t\tvoid error;\n\t\t});\n\t}\n\n\t/**\n\t * Subscribe to agent events.\n\t */\n\tonEvent(listener: RpcEventListener): () => void {\n\t\tthis.eventListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst index = this.eventListeners.indexOf(listener);\n\t\t\tif (index !== -1) {\n\t\t\t\tthis.eventListeners.splice(index, 1);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Get collected stderr output (useful for debugging).\n\t */\n\tgetStderr(): string {\n\t\treturn this.stderr;\n\t}\n\n\t// =========================================================================\n\t// Command Methods\n\t// =========================================================================\n\n\tasync setClientInfo(width: number, capabilities?: string[]): Promise<void> {\n\t\tawait this.send({ type: \"set_client_info\", width, capabilities }, this.sessionId !== undefined);\n\t}\n\n\tasync openSession(options: {\n\t\tsessionPath?: string;\n\t\tcwd?: string;\n\t\tprovider?: string;\n\t\tmodelId?: string;\n\t\tthinkingLevel?: ThinkingLevel;\n\t\tpermissionPreset?: string;\n\t}): Promise<{ sessionId: string; state: RpcSessionState; attached?: boolean }> {\n\t\tconst response = await this.send({ type: \"open_session\", ...options }, false);\n\t\tconst opened = this.getData<{ sessionId: string; state: RpcSessionState; attached?: boolean }>(response);\n\t\tthis.sessionId = opened.sessionId;\n\t\treturn opened;\n\t}\n\n\tasync sendExtensionUIResponse(response: RpcExtensionUIResponse): Promise<void> {\n\t\tawait this.send(response, true, undefined, false);\n\t}\n\n\tasync closeSession(sessionId = this.sessionId): Promise<void> {\n\t\tif (!sessionId) return;\n\t\ttry {\n\t\t\tawait this.send({ type: \"close_session\", sessionId }, false);\n\t\t} catch (error) {\n\t\t\tif (!isTransportGoneError(error)) throw error;\n\t\t}\n\t\tif (this.sessionId === sessionId) this.sessionId = undefined;\n\t}\n\n\tasync listSessions(): Promise<\n\t\tArray<{\n\t\t\tsessionId: string;\n\t\t\tdurableSessionId?: string;\n\t\t\tsessionPath?: string;\n\t\t\tcwd: string;\n\t\t\tname?: string;\n\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t}>\n\t> {\n\t\tconst response = await this.send({ type: \"list_sessions\" }, false);\n\t\treturn this.getData<{\n\t\t\tsessions: Array<{\n\t\t\t\tsessionId: string;\n\t\t\t\tdurableSessionId?: string;\n\t\t\t\tsessionPath?: string;\n\t\t\t\tcwd: string;\n\t\t\t\tname?: string;\n\t\t\t\tstatus: \"opening\" | \"open\" | \"closing\" | \"closed\";\n\t\t\t}>;\n\t\t}>(response).sessions;\n\t}\n\n\t/**\n\t * Send a prompt to the agent.\n\t * Returns immediately after sending; use onEvent() to receive streaming events.\n\t * Use waitForIdle() to wait for completion.\n\t *\n\t * The disposition/preflight callbacks mirror AgentSession's local prompt contract:\n\t * they fire synchronously while the response frame is dispatched — before any\n\t * queued message_start event — so optimistic-echo eligibility is settled in wire\n\t * order. A success response without a disposition (older host) maps to \"handled\"\n\t * so the echo degrades to canonical-only rendering instead of double-rendering.\n\t */\n\tasync prompt(message: string, images?: ImageContent[]): Promise<void>;\n\tasync prompt(message: string, options?: PromptOptions): Promise<void>;\n\tasync prompt(message: string, optionsOrImages?: PromptOptions | ImageContent[]): Promise<void> {\n\t\tconst options: PromptOptions = Array.isArray(optionsOrImages)\n\t\t\t? { images: optionsOrImages }\n\t\t\t: (optionsOrImages ?? {});\n\t\tconst response = await this.send(\n\t\t\t{\n\t\t\t\ttype: \"prompt\",\n\t\t\t\tmessage,\n\t\t\t\t...(options.images ? { images: options.images } : {}),\n\t\t\t\t...(options.streamingBehavior ? { streamingBehavior: options.streamingBehavior } : {}),\n\t\t\t\t...(options.thinkingLevel ? { thinkingLevel: options.thinkingLevel } : {}),\n\t\t\t\t...(options.sessionTitlePrompt !== undefined ? { sessionTitlePrompt: options.sessionTitlePrompt } : {}),\n\t\t\t\t...(options.expandPromptTemplates !== undefined\n\t\t\t\t\t? { expandPromptTemplates: options.expandPromptTemplates }\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t\ttrue,\n\t\t\t{\n\t\t\t\tonResponse: (wireResponse) => {\n\t\t\t\t\tif (!wireResponse.success) {\n\t\t\t\t\t\toptions?.preflightResult?.(false);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst data = (wireResponse as { data?: { disposition?: PromptDisposition } }).data;\n\t\t\t\t\toptions?.promptDisposition?.(data?.disposition ?? \"handled\");\n\t\t\t\t\toptions?.preflightResult?.(true);\n\t\t\t\t},\n\t\t\t\tonReject: () => {\n\t\t\t\t\toptions?.preflightResult?.(false);\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\tif (!response.success) {\n\t\t\tthrow new Error((response as Extract<RpcResponse, { success: false }>).error);\n\t\t}\n\t}\n\n\tasync appendUserMessage(content: unknown): Promise<void> {\n\t\tawait this.send({ type: \"append_user_message\", content });\n\t}\n\n\tasync appendSessionEntry(entry: import(\"../../core/session-manager.ts\").SessionEntry): Promise<void> {\n\t\tawait this.send({ type: \"append_session_entry\", entry });\n\t}\n\n\tasync sendCustomMessage<T = unknown>(\n\t\tmessage: { customType: string; content: unknown; display: boolean; details?: T },\n\t\toptions?: { triggerTurn?: boolean; deliverAs?: \"steer\" | \"followUp\" | \"nextTurn\" },\n\t): Promise<void> {\n\t\tawait this.send({ type: \"send_custom_message\", ...message, ...options });\n\t}\n\n\t/**\n\t * Queue a steering message to interrupt the agent mid-run.\n\t */\n\tasync steer(message: string, images?: ImageContent[], recovery?: { enqueueOrder?: number }): Promise<void> {\n\t\tawait this.send({ type: \"steer\", message, images, enqueueOrder: recovery?.enqueueOrder });\n\t}\n\n\t/**\n\t * Queue a follow-up message to be processed after the agent finishes.\n\t */\n\tasync followUp(message: string, images?: ImageContent[], recovery?: { enqueueOrder?: number }): Promise<void> {\n\t\tawait this.send({ type: \"follow_up\", message, images, enqueueOrder: recovery?.enqueueOrder });\n\t}\n\n\t/**\n\t * Abort current operation.\n\t */\n\tasync abort(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.send({ type: \"abort\" });\n\t\t} catch (error) {\n\t\t\tif (!isTransportGoneError(error)) throw error;\n\t\t}\n\t}\n\n\tasync abortCompaction(): Promise<void> {\n\t\tawait this.send({ type: \"abort_compaction\" });\n\t}\n\n\tasync reload(): Promise<{ cancelled: boolean; reason?: string }> {\n\t\tconst response = await this.send({ type: \"reload\" });\n\t\treturn this.getData(response);\n\t}\n\n\tasync checkReloadVeto(): Promise<{ cancelled: boolean; reason?: string }> {\n\t\tconst response = await this.send({ type: \"check_reload_veto\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Clear queued steering and follow-up messages, returning their text.\n\t */\n\tasync clearQueue(options?: { abortWillFollow?: boolean }): Promise<{\n\t\tsteering: string[];\n\t\tfollowUp: string[];\n\t\tordered: Array<{ text: string; mode: \"steer\" | \"followUp\"; enqueueOrder: number }>;\n\t}> {\n\t\tconst response = await this.send({ type: \"clear_queue\", abortWillFollow: options?.abortWillFollow });\n\t\treturn this.getData(response);\n\t}\n\n\tasync getSteeringMessages(): Promise<string[]> {\n\t\tconst response = await this.send({ type: \"get_steering_messages\" });\n\t\treturn this.getData<{ messages: string[] }>(response).messages;\n\t}\n\n\tasync getFollowUpMessages(): Promise<string[]> {\n\t\tconst response = await this.send({ type: \"get_follow_up_messages\" });\n\t\treturn this.getData<{ messages: string[] }>(response).messages;\n\t}\n\n\tasync abortBranchSummary(): Promise<void> {\n\t\tawait this.send({ type: \"abort_branch_summary\" });\n\t}\n\n\tasync recordBashResult(command: string, result: BashResult, excludeFromContext?: boolean): Promise<void> {\n\t\tawait this.send({ type: \"record_bash_result\", command, result, excludeFromContext });\n\t}\n\n\tasync setLabel(entryId: string, label?: string): Promise<void> {\n\t\tawait this.send({ type: \"set_label\", entryId, label });\n\t}\n\n\t/**\n\t * Start a new session, optionally with parent tracking.\n\t * @param parentSession - Optional parent session path for lineage tracking\n\t * @returns Object with `cancelled: true` if an extension cancelled the new session\n\t */\n\tasync newSession(parentSession?: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"new_session\", parentSession });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get current session state.\n\t */\n\tasync getState(): Promise<RpcSessionState> {\n\t\tconst response = await this.send({ type: \"get_state\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set model by provider and ID.\n\t */\n\tasync setModel(\n\t\tprovider: string,\n\t\tmodelId: string,\n\t): Promise<{ provider: string; id: string; systemPromptName?: string }> {\n\t\tconst response = await this.send({ type: \"set_model\", provider, modelId });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Cycle to next model.\n\t */\n\tasync setFavoriteModels(models: RpcSessionModelEntry[]): Promise<void> {\n\t\tawait this.send({ type: \"set_favorite_models\", models });\n\t}\n\n\tasync setScopedModels(models: RpcSessionModelEntry[]): Promise<void> {\n\t\tawait this.send({ type: \"set_scoped_models\", models });\n\t}\n\n\tasync cycleModel(direction: \"forward\" | \"backward\" = \"forward\"): Promise<{\n\t\tmodel: { provider: string; id: string };\n\t\tthinkingLevel: ThinkingLevel;\n\t\tisScoped: boolean;\n\t} | null> {\n\t\tconst response = await this.send({ type: \"cycle_model\", direction });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get list of available models.\n\t */\n\tasync getAvailableModels(): Promise<ModelInfo[]> {\n\t\tconst response = await this.send({ type: \"get_available_models\" });\n\t\treturn this.getData<{ models: ModelInfo[] }>(response).models;\n\t}\n\n\t/**\n\t * Set thinking level.\n\t *\n\t * `scope: \"turn\"` changes only this session's level without rewriting the model's remembered\n\t * level; it throws when the active model does not support the requested level, and the\n\t * session keeps the level it already had.\n\t */\n\tasync setThinkingLevel(level: ThinkingLevel, options?: { scope?: \"turn\" }): Promise<void> {\n\t\tconst response = await this.send({ type: \"set_thinking_level\", level, scope: options?.scope });\n\t\tif (!response.success) {\n\t\t\tthrow new Error((response as Extract<RpcResponse, { success: false }>).error);\n\t\t}\n\t}\n\n\t/**\n\t * Cycle thinking level.\n\t */\n\tasync cycleThinkingLevel(): Promise<{ level: ThinkingLevel } | null> {\n\t\tconst response = await this.send({ type: \"cycle_thinking_level\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get list of available thinking levels for the current model.\n\t */\n\tasync getAvailableThinkingLevels(): Promise<ThinkingLevel[]> {\n\t\tconst response = await this.send({ type: \"get_available_thinking_levels\" });\n\t\treturn this.getData<{ levels: ThinkingLevel[] }>(response).levels;\n\t}\n\n\t/**\n\t * Turn OpenAI Codex fast mode (the `priority` service tier) on or off for the active model.\n\t *\n\t * The choice is remembered per model, so a later session on the same model starts the same\n\t * way. Throws when the request is refused: a non-Codex model, or an active `:priority` model\n\t * pin that fast mode must not undo.\n\t */\n\tasync setFastMode(\n\t\tenabled: boolean,\n\t): Promise<{ enabled: boolean; serviceTier: ServiceTier; provider: string; modelId: string }> {\n\t\tconst response = await this.send({ type: \"set_fast_mode\", enabled });\n\t\treturn this.getData(response);\n\t}\n\n\t/** Current fast-mode state and the service tier requests would carry. */\n\tasync getFastMode(): Promise<{ enabled: boolean; serviceTier: ServiceTier | null }> {\n\t\tconst response = await this.send({ type: \"get_fast_mode\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set steering mode.\n\t */\n\tasync setSteeringMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_steering_mode\", mode });\n\t}\n\n\t/**\n\t * Set follow-up mode.\n\t */\n\tasync setFollowUpMode(mode: \"all\" | \"one-at-a-time\"): Promise<void> {\n\t\tawait this.send({ type: \"set_follow_up_mode\", mode });\n\t}\n\n\t/**\n\t * Compact session context.\n\t */\n\tasync compact(customInstructions?: string): Promise<CompactionResult> {\n\t\tconst response = await this.send({ type: \"compact\", customInstructions });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Set auto-compaction enabled/disabled.\n\t */\n\tasync setAutoCompaction(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_compaction\", enabled });\n\t}\n\n\t/**\n\t * Set auto-retry enabled/disabled.\n\t */\n\tasync setAutoRetry(enabled: boolean): Promise<void> {\n\t\tawait this.send({ type: \"set_auto_retry\", enabled });\n\t}\n\n\t/**\n\t * Abort in-progress retry.\n\t */\n\tasync abortRetry(): Promise<void> {\n\t\tawait this.send({ type: \"abort_retry\" });\n\t}\n\n\t/**\n\t * Execute a bash command.\n\t */\n\tasync bash(\n\t\tcommand: string,\n\t\toptions?: { excludeFromContext?: boolean; executionId?: string; operations?: Record<string, unknown> },\n\t): Promise<BashResult> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"bash\",\n\t\t\tcommand,\n\t\t\texcludeFromContext: options?.excludeFromContext,\n\t\t\texecutionId: options?.executionId,\n\t\t\toperations: options?.operations,\n\t\t});\n\t\treturn this.getData(response);\n\t}\n\n\tasync navigateTree(\n\t\ttargetId: string,\n\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string },\n\t): Promise<{ cancelled: boolean; editorText?: string; aborted?: boolean; summaryEntry?: unknown }> {\n\t\tconst response = await this.send({ type: \"navigate_tree\", targetId, ...options });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Abort running bash command.\n\t */\n\tasync abortBash(): Promise<void> {\n\t\tawait this.send({ type: \"abort_bash\" });\n\t}\n\n\tasync cleanupBashOutput(path: string): Promise<void> {\n\t\tawait this.send({ type: \"cleanup_bash_output\", path });\n\t}\n\n\t/**\n\t * Get session statistics.\n\t */\n\tasync getSessionStats(): Promise<SessionStats> {\n\t\tconst response = await this.send({ type: \"get_session_stats\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Export session to HTML.\n\t */\n\tasync exportHtml(outputPath?: string, themeName?: string): Promise<{ path: string }> {\n\t\tconst response = await this.send({ type: \"export_html\", outputPath, themeName });\n\t\treturn this.getData(response);\n\t}\n\n\tasync exportJsonl(outputPath?: string): Promise<{ path: string }> {\n\t\tconst response = await this.send({ type: \"export_jsonl\", outputPath });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Switch to a different session file.\n\t * @returns Object with `cancelled: true` if an extension cancelled the switch\n\t */\n\tasync switchSession(sessionPath: string, options?: { cwdOverride?: string }): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"switch_session\", sessionPath, cwdOverride: options?.cwdOverride });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Fork from a specific message.\n\t * @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)\n\t */\n\tasync fork(\n\t\tentryId: string,\n\t\toptions?: { position?: \"before\" | \"at\" },\n\t): Promise<{ text: string; cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"fork\", entryId, position: options?.position });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Clone the current active branch into a new session.\n\t * @returns Object with `cancelled: true` if an extension cancelled the clone\n\t */\n\tasync clone(): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"clone\" });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get messages available for forking.\n\t */\n\tasync getForkMessages(): Promise<Array<{ entryId: string; text: string }>> {\n\t\tconst response = await this.send({ type: \"get_fork_messages\" });\n\t\treturn this.getData<{ messages: Array<{ entryId: string; text: string }> }>(response).messages;\n\t}\n\n\t/**\n\t * Get session entries in append order, optionally only those after the `since` entry id.\n\t */\n\tasync getEntries(since?: string): Promise<{ entries: SessionEntry[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_entries\", since });\n\t\treturn this.getData<{ entries: SessionEntry[]; leafId: string | null }>(response);\n\t}\n\n\t/**\n\t * Get the session entry tree.\n\t */\n\tasync getTree(): Promise<{ tree: SessionTreeNode[]; leafId: string | null }> {\n\t\tconst response = await this.send({ type: \"get_tree\" });\n\t\treturn this.getData<{ tree: SessionTreeNode[]; leafId: string | null }>(response);\n\t}\n\n\t/**\n\t * Get text of last assistant message.\n\t */\n\tasync getLastAssistantText(): Promise<string | null> {\n\t\tconst response = await this.send({ type: \"get_last_assistant_text\" });\n\t\treturn this.getData<{ text: string | null }>(response).text;\n\t}\n\n\t/**\n\t * Set the session display name.\n\t */\n\tasync setSessionName(name: string): Promise<void> {\n\t\tawait this.send({ type: \"set_session_name\", name });\n\t}\n\n\tasync importJsonl(inputPath: string, cwdOverride?: string): Promise<{ cancelled: boolean }> {\n\t\tconst response = await this.send({ type: \"import_jsonl\", inputPath, cwdOverride });\n\t\treturn this.getData(response);\n\t}\n\n\t/**\n\t * Get all messages in the session.\n\t */\n\tasync getMessages(): Promise<AgentMessage[]> {\n\t\tconst response = await this.send({ type: \"get_messages\" });\n\t\treturn this.getData<{ messages: AgentMessage[] }>(response).messages;\n\t}\n\n\t/**\n\t * Get available commands (extension commands, prompt templates, skills).\n\t */\n\tasync getCommands(): Promise<RpcSlashCommand[]> {\n\t\tconst response = await this.send({ type: \"get_commands\" });\n\t\treturn this.getData<{ commands: RpcSlashCommand[] }>(response).commands;\n\t}\n\n\t/** Invoke one extension-owned RPC request handler and return its structured result. */\n\tasync requestExtension<T = unknown>(name: string, data?: unknown): Promise<T> {\n\t\tconst response = await this.send({\n\t\t\ttype: \"extension_request\",\n\t\t\tname,\n\t\t\t...(data === undefined ? {} : { data }),\n\t\t});\n\t\treturn this.getData<T>(response);\n\t}\n\n\t/** List safe metadata for the named provider's configured account slots. */\n\tasync getProviderAccounts(provider: string): Promise<RpcProviderAccount[]> {\n\t\tconst response = await this.send({ type: \"get_provider_accounts\", provider });\n\t\treturn this.getData<{ accounts: RpcProviderAccount[] }>(response).accounts;\n\t}\n\n\t/** Pin a provider account for future session-affine requests, or clear the pin. */\n\tasync pinProviderAccount(provider: string, name: string | null): Promise<void> {\n\t\tawait this.send({ type: \"account_pin\", provider, name });\n\t}\n\n\t/** Remove a persisted provider account slot. Environment slots are read-only. */\n\tasync removeProviderAccount(provider: string, name: string): Promise<void> {\n\t\tawait this.send({ type: \"account_remove\", provider, name });\n\t}\n\n\t// =========================================================================\n\t// Helpers\n\t// =========================================================================\n\n\t/**\n\t * Wait for agent to become idle (no streaming).\n\t * Resolves when agent_settled event is received.\n\t */\n\twaitForIdle(timeout = 60000): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout waiting for agent to become idle. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tif (event.type === \"agent_settled\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Collect events until agent becomes idle.\n\t */\n\tcollectEvents(timeout = 60000): Promise<JsonAgentSessionEvent[]> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst events: JsonAgentSessionEvent[] = [];\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tunsubscribe();\n\t\t\t\treject(new Error(`Timeout collecting events. Stderr: ${this.stderr}`));\n\t\t\t}, timeout);\n\n\t\t\tconst unsubscribe = this.onEvent((event) => {\n\t\t\t\tif (\n\t\t\t\t\tisProviderAccountEvent(event) ||\n\t\t\t\t\tevent.type === \"extension_event\" ||\n\t\t\t\t\tevent.type === \"bash_start\" ||\n\t\t\t\t\tevent.type === \"bash_end\" ||\n\t\t\t\t\tevent.type === \"extension_ui_request\" ||\n\t\t\t\t\t// Connection-level, not part of the agent's event stream.\n\t\t\t\t\tevent.type === \"session_replaced\"\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tevents.push(event);\n\t\t\t\tif (event.type === \"agent_settled\") {\n\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve(events);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Send prompt and wait for completion, returning all events.\n\t */\n\tasync promptAndWait(message: string, images?: ImageContent[], timeout = 60000): Promise<JsonAgentSessionEvent[]> {\n\t\tconst eventsPromise = this.collectEvents(timeout);\n\t\tawait this.prompt(message, images ? { images } : undefined);\n\t\treturn eventsPromise;\n\t}\n\n\t// =========================================================================\n\t// Internal\n\t// =========================================================================\n\n\tprivate handleLine(line: string): void {\n\t\ttry {\n\t\t\tconst data = JSON.parse(line);\n\n\t\t\t// Check if it's a response to a pending request\n\t\t\tif (data.type === \"response\" && data.id && this.pendingRequests.has(data.id)) {\n\t\t\t\tconst pending = this.pendingRequests.get(data.id)!;\n\t\t\t\tthis.pendingRequests.delete(data.id);\n\t\t\t\t// Response hooks run synchronously inside the frame dispatch so ordering-sensitive\n\t\t\t\t// contracts (e.g. optimistic-echo disposition) settle before the NEXT frame —\n\t\t\t\t// never through the microtask scheduled by resolve().\n\t\t\t\tpending.onResponse?.(data as RpcResponse);\n\t\t\t\tpending.resolve(data as RpcResponse);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise it's an event. Multi-session hosts broadcast all session\n\t\t\t// events to every connection; a routed client exposes only its lease.\n\t\t\tif (data.sessionId !== undefined && this.sessionId !== undefined && data.sessionId !== this.sessionId) return;\n\t\t\tfor (const listener of this.eventListeners) {\n\t\t\t\tlistener(data as RpcClientEvent);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore non-JSON lines\n\t\t}\n\t}\n\n\tprivate createProcessExitError(code: number | null, signal: NodeJS.Signals | null): Error {\n\t\treturn new Error(`Agent process exited (code=${code} signal=${signal}). Stderr: ${this.stderr}`);\n\t}\n\n\tprivate notifyDisconnect(error: RpcTransportGoneError): void {\n\t\tthis.rejectPendingRequests(error);\n\t\tif (!this.disconnectNotified && !this.stopping) {\n\t\t\tthis.disconnectNotified = true;\n\t\t\tthis.options.onDisconnect?.(error);\n\t\t}\n\t}\n\n\tprivate rejectPendingRequests(error: Error): void {\n\t\tfor (const pending of this.pendingRequests.values()) {\n\t\t\tpending.onReject?.(error);\n\t\t\tpending.reject(error);\n\t\t}\n\t\tthis.pendingRequests.clear();\n\t}\n\n\tprivate async send(\n\t\tcommand: RpcCommandBody | RpcExtensionUIResponse,\n\t\troute = true,\n\t\thooks?: { onResponse?: (response: RpcResponse) => void; onReject?: (error: Error) => void },\n\t\texpectResponse = true,\n\t): Promise<RpcResponse> {\n\t\tconst childProcess = this.process;\n\t\tconst stream = this.socket ?? childProcess?.stdin;\n\t\tif (!stream) {\n\t\t\tthrow new RpcTransportGoneError();\n\t\t}\n\t\tif (this.exitError) {\n\t\t\tthrow this.exitError;\n\t\t}\n\t\tif (childProcess?.exitCode !== null && childProcess?.exitCode !== undefined) {\n\t\t\tconst error = this.createProcessExitError(childProcess.exitCode, childProcess.signalCode);\n\t\t\tthis.exitError = error;\n\t\t\tthrow error;\n\t\t}\n\t\tif (stream.destroyed || !stream.writable) {\n\t\t\tconst error = new RpcTransportGoneError();\n\t\t\tthis.notifyDisconnect(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst id = \"type\" in command && command.type === \"extension_ui_response\" ? command.id : `req_${++this.requestId}`;\n\t\tconst fullCommand = {\n\t\t\t...command,\n\t\t\t...(route && this.sessionId && !(\"sessionId\" in command) ? { sessionId: this.sessionId } : {}),\n\t\t\t...(command.type === \"extension_ui_response\" ? {} : { id }),\n\t\t} as RpcCommand;\n\n\t\tif (!expectResponse) {\n\t\t\tstream.write(serializeJsonLine(fullCommand));\n\t\t\treturn Promise.resolve({ type: \"response\", command: command.type, success: true } as RpcResponse);\n\t\t}\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\tconst pending = this.pendingRequests.get(id);\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\tconst timeoutError = new Error(`Timeout waiting for response to ${command.type}. Stderr: ${this.stderr}`);\n\t\t\t\tpending?.onReject?.(timeoutError);\n\t\t\t\treject(timeoutError);\n\t\t\t}, 30000);\n\n\t\t\tthis.pendingRequests.set(id, {\n\t\t\t\tresolve: (response) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\tresolve(response);\n\t\t\t\t},\n\t\t\t\treject: (error) => {\n\t\t\t\t\tclearTimeout(timeout);\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t\t...(hooks?.onResponse ? { onResponse: hooks.onResponse } : {}),\n\t\t\t\t...(hooks?.onReject ? { onReject: hooks.onReject } : {}),\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tstream.write(serializeJsonLine(fullCommand));\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst writeError = error instanceof Error ? error : new Error(String(error));\n\t\t\t\tconst pending = this.pendingRequests.get(id);\n\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\tpending?.onReject?.(writeError);\n\t\t\t\tpending?.reject(writeError);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getData<T>(response: RpcResponse): T {\n\t\tif (!response.success) {\n\t\t\tconst errorResponse = response as Extract<RpcResponse, { success: false }>;\n\t\t\tif (errorResponse.errorCode === \"missing_session_cwd\" && errorResponse.errorData) {\n\t\t\t\tthrow new MissingSessionCwdError(\n\t\t\t\t\terrorResponse.errorData as ConstructorParameters<typeof MissingSessionCwdError>[0],\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(errorResponse.error);\n\t\t}\n\t\t// Type assertion: we trust response.data matches T based on the command sent.\n\t\t// This is safe because each public method specifies the correct T for its command.\n\t\tconst successResponse = response as Extract<RpcResponse, { success: true; data: unknown }>;\n\t\treturn successResponse.data as T;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-command-router.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/session-command-router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-command-router.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/session-command-router.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO9D,OAAO,EAAE,uBAAuB,EAA0B,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAGX,uBAAuB,EACvB,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAK/B,gGAAgG;AAChG,MAAM,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O,CAAC,UAAU,CAAqB;gBAGtC,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,KAAK,GAAG,kBAAkB,GAAG,eAAe,GAAG,sBAAsB,CAAC,EAC9G,aAAa,GAAE,OAAO,uBAAiD,EACvE,iBAAiB,GAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAM,EACrE,IAAI,CAAC,EAAE,oBAAoB;IAoBtB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAmD7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB9B;;;;;;;;;OASG;IACH,iBAAiB,IAAI,IAAI;IA4BzB;;;;;OAKG;YACW,gBAAgB;IA6B9B,4EAA4E;IAC5E,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,eAAe;YAiBT,IAAI;IA8GlB;;;;OAIG;IACG,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD5D;;;;;;;OAOG;YACW,mBAAmB;YAkBnB,KAAK;IA4CnB,OAAO,CAAC,IAAI;CAWZ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VERSION } from "../../config.js";
|
|
2
2
|
import { buildRpcSessionState } from "./connection-handler.js";
|
|
3
|
+
import { AUTO_TITLE_SESSIONS_CAPABILITY } from "./custom-capability.js";
|
|
3
4
|
import { RPC_ERROR_MISSING_SESSION_ID, RPC_ERROR_OPEN_FAILED, RPC_ERROR_SESSION_CLOSING, RPC_ERROR_UNKNOWN_SESSION, } from "./rpc-types.js";
|
|
4
5
|
import { createRpcSessionBinding } from "./session-binding.js";
|
|
5
6
|
import { RpcSessionRegistryError } from "./session-registry.js";
|
|
@@ -38,7 +39,11 @@ export class SessionCommandRouter {
|
|
|
38
39
|
}
|
|
39
40
|
async handle(command) {
|
|
40
41
|
if (command.type === "get_protocol_info") {
|
|
41
|
-
const capabilities = new Set([
|
|
42
|
+
const capabilities = new Set([
|
|
43
|
+
"multi_session",
|
|
44
|
+
AUTO_TITLE_SESSIONS_CAPABILITY,
|
|
45
|
+
...(this.connectionOptions?.capabilities ?? []),
|
|
46
|
+
]);
|
|
42
47
|
return {
|
|
43
48
|
id: command.id,
|
|
44
49
|
type: "response",
|
|
@@ -257,7 +262,7 @@ export class SessionCommandRouter {
|
|
|
257
262
|
this.bindings.set(openedSession.sessionId, await this.createBinding(openedSession.sessionId, entry, this.writer, () => void this.close({ type: "close_session", sessionId: openedSession.sessionId }), {
|
|
258
263
|
...this.connectionOptions,
|
|
259
264
|
capabilities: owner !== undefined
|
|
260
|
-
? (this.pendingCapabilities.get(owner) ?? [])
|
|
265
|
+
? (this.pendingCapabilities.get(owner) ?? this.connectionOptions?.capabilities ?? [])
|
|
261
266
|
: this.connectionOptions?.capabilities,
|
|
262
267
|
sharedWidth: {
|
|
263
268
|
getWidth: () => {
|