@code-yeongyu/senpi 2026.8.27 → 2026.8.28-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 +83 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +5 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/credential-accounts.d.ts +31 -0
- package/dist/core/credential-accounts.d.ts.map +1 -0
- package/dist/core/credential-accounts.js +135 -0
- package/dist/core/credential-accounts.js.map +1 -0
- package/dist/core/credential-pool/classify.d.ts +6 -1
- package/dist/core/credential-pool/classify.d.ts.map +1 -1
- package/dist/core/credential-pool/classify.js +22 -5
- package/dist/core/credential-pool/classify.js.map +1 -1
- package/dist/core/credential-pool/failover.d.ts +8 -0
- package/dist/core/credential-pool/failover.d.ts.map +1 -1
- package/dist/core/credential-pool/failover.js +24 -6
- package/dist/core/credential-pool/failover.js.map +1 -1
- package/dist/core/credential-pool/rotation-stream.d.ts +13 -2
- package/dist/core/credential-pool/rotation-stream.d.ts.map +1 -1
- package/dist/core/credential-pool/rotation-stream.js +97 -10
- package/dist/core/credential-pool/rotation-stream.js.map +1 -1
- package/dist/core/extensions/builtin/account/index.d.ts +9 -0
- package/dist/core/extensions/builtin/account/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/account/index.js +69 -0
- package/dist/core/extensions/builtin/account/index.js.map +1 -0
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +7 -0
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/imagegen/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/imagegen/index.js +10 -3
- package/dist/core/extensions/builtin/imagegen/index.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +4 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +13 -0
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +4 -2
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/model-config-schema.d.ts +4 -4
- 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 +74 -37
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/retry-fallback/chains.d.ts +23 -1
- package/dist/core/retry-fallback/chains.d.ts.map +1 -1
- package/dist/core/retry-fallback/chains.js +59 -3
- package/dist/core/retry-fallback/chains.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +9 -2
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +9 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/retry-fallback/validate.js +1 -1
- package/dist/core/retry-fallback/validate.js.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +31 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +22 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/server/account.d.ts.map +1 -1
- package/dist/modes/app-server/server/account.js +5 -5
- package/dist/modes/app-server/server/account.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +11 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +31 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/grok/chrome.d.ts +4 -4
- package/dist/modes/interactive/grok/chrome.d.ts.map +1 -1
- package/dist/modes/interactive/grok/chrome.js.map +1 -1
- package/dist/modes/interactive/grok/footer.d.ts +3 -3
- package/dist/modes/interactive/grok/footer.d.ts.map +1 -1
- package/dist/modes/interactive/grok/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts +16 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.js +321 -36
- package/dist/modes/interactive/interactive-host-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +295 -250
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +144 -29
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +14 -4
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +90 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +118 -23
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +164 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts +22 -0
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +153 -14
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +2 -0
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +4 -0
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +16 -0
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js +40 -3
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/docs/providers.md +48 -0
- package/docs/rpc.md +43 -4
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +13 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/inline-worker.ts +15 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/transport.ts +14 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +20 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.js +27 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +7 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.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/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.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/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.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/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.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
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
7
7
|
import type { ImageContent } from "@earendil-works/pi-ai";
|
|
8
|
-
import type { SessionStats } from "../../core/agent-session.ts";
|
|
8
|
+
import type { PromptDisposition, SessionStats } from "../../core/agent-session.ts";
|
|
9
9
|
import type { BashResult } from "../../core/bash-executor.ts";
|
|
10
10
|
import type { CompactionResult } from "../../core/compaction/index.ts";
|
|
11
11
|
import type { ServiceTier } from "../../core/extensions/builtin/service-tier.ts";
|
|
@@ -35,8 +35,20 @@ export interface ModelInfo {
|
|
|
35
35
|
reasoning: boolean;
|
|
36
36
|
supportedThinkingLevels?: ThinkingLevel[];
|
|
37
37
|
}
|
|
38
|
+
type PromptOptions = {
|
|
39
|
+
images?: ImageContent[];
|
|
40
|
+
streamingBehavior?: "steer" | "followUp";
|
|
41
|
+
thinkingLevel?: ThinkingLevel;
|
|
42
|
+
promptDisposition?: (disposition: PromptDisposition) => void;
|
|
43
|
+
preflightResult?: (success: boolean) => void;
|
|
44
|
+
expandPromptTemplates?: boolean;
|
|
45
|
+
};
|
|
38
46
|
export type RpcProviderAccountEvent = RpcAuthAccountsChangedEvent | RpcAccountFailoverEvent;
|
|
39
|
-
export type RpcClientEvent = JsonAgentSessionEvent | RpcProviderAccountEvent | RpcExtensionEvent
|
|
47
|
+
export type RpcClientEvent = JsonAgentSessionEvent | RpcProviderAccountEvent | RpcExtensionEvent | {
|
|
48
|
+
type: "bash_start";
|
|
49
|
+
} | {
|
|
50
|
+
type: "bash_end";
|
|
51
|
+
};
|
|
40
52
|
export type RpcEventListener = (event: RpcClientEvent) => void;
|
|
41
53
|
export declare class RpcClient {
|
|
42
54
|
private process;
|
|
@@ -77,6 +89,7 @@ export declare class RpcClient {
|
|
|
77
89
|
}): Promise<{
|
|
78
90
|
sessionId: string;
|
|
79
91
|
state: RpcSessionState;
|
|
92
|
+
attached?: boolean;
|
|
80
93
|
}>;
|
|
81
94
|
closeSession(sessionId?: string | undefined): Promise<void>;
|
|
82
95
|
listSessions(): Promise<Array<{
|
|
@@ -91,27 +104,70 @@ export declare class RpcClient {
|
|
|
91
104
|
* Send a prompt to the agent.
|
|
92
105
|
* Returns immediately after sending; use onEvent() to receive streaming events.
|
|
93
106
|
* Use waitForIdle() to wait for completion.
|
|
107
|
+
*
|
|
108
|
+
* The disposition/preflight callbacks mirror AgentSession's local prompt contract:
|
|
109
|
+
* they fire synchronously while the response frame is dispatched — before any
|
|
110
|
+
* queued message_start event — so optimistic-echo eligibility is settled in wire
|
|
111
|
+
* order. A success response without a disposition (older host) maps to "handled"
|
|
112
|
+
* so the echo degrades to canonical-only rendering instead of double-rendering.
|
|
94
113
|
*/
|
|
95
114
|
prompt(message: string, images?: ImageContent[]): Promise<void>;
|
|
115
|
+
prompt(message: string, options?: PromptOptions): Promise<void>;
|
|
116
|
+
appendUserMessage(content: unknown): Promise<void>;
|
|
117
|
+
appendSessionEntry(entry: import("../../core/session-manager.ts").SessionEntry): Promise<void>;
|
|
118
|
+
sendCustomMessage<T = unknown>(message: {
|
|
119
|
+
customType: string;
|
|
120
|
+
content: unknown;
|
|
121
|
+
display: boolean;
|
|
122
|
+
details?: T;
|
|
123
|
+
}, options?: {
|
|
124
|
+
triggerTurn?: boolean;
|
|
125
|
+
deliverAs?: "steer" | "followUp" | "nextTurn";
|
|
126
|
+
}): Promise<void>;
|
|
96
127
|
/**
|
|
97
128
|
* Queue a steering message to interrupt the agent mid-run.
|
|
98
129
|
*/
|
|
99
|
-
steer(message: string, images?: ImageContent[]
|
|
130
|
+
steer(message: string, images?: ImageContent[], recovery?: {
|
|
131
|
+
enqueueOrder?: number;
|
|
132
|
+
}): Promise<void>;
|
|
100
133
|
/**
|
|
101
134
|
* Queue a follow-up message to be processed after the agent finishes.
|
|
102
135
|
*/
|
|
103
|
-
followUp(message: string, images?: ImageContent[]
|
|
136
|
+
followUp(message: string, images?: ImageContent[], recovery?: {
|
|
137
|
+
enqueueOrder?: number;
|
|
138
|
+
}): Promise<void>;
|
|
104
139
|
/**
|
|
105
140
|
* Abort current operation.
|
|
106
141
|
*/
|
|
107
142
|
abort(): Promise<void>;
|
|
143
|
+
abortCompaction(): Promise<void>;
|
|
144
|
+
reload(): Promise<{
|
|
145
|
+
cancelled: boolean;
|
|
146
|
+
reason?: string;
|
|
147
|
+
}>;
|
|
148
|
+
checkReloadVeto(): Promise<{
|
|
149
|
+
cancelled: boolean;
|
|
150
|
+
reason?: string;
|
|
151
|
+
}>;
|
|
108
152
|
/**
|
|
109
153
|
* Clear queued steering and follow-up messages, returning their text.
|
|
110
154
|
*/
|
|
111
|
-
clearQueue(
|
|
155
|
+
clearQueue(options?: {
|
|
156
|
+
abortWillFollow?: boolean;
|
|
157
|
+
}): Promise<{
|
|
112
158
|
steering: string[];
|
|
113
159
|
followUp: string[];
|
|
160
|
+
ordered: Array<{
|
|
161
|
+
text: string;
|
|
162
|
+
mode: "steer" | "followUp";
|
|
163
|
+
enqueueOrder: number;
|
|
164
|
+
}>;
|
|
114
165
|
}>;
|
|
166
|
+
getSteeringMessages(): Promise<string[]>;
|
|
167
|
+
getFollowUpMessages(): Promise<string[]>;
|
|
168
|
+
abortBranchSummary(): Promise<void>;
|
|
169
|
+
recordBashResult(command: string, result: BashResult, excludeFromContext?: boolean): Promise<void>;
|
|
170
|
+
setLabel(entryId: string, label?: string): Promise<void>;
|
|
115
171
|
/**
|
|
116
172
|
* Start a new session, optionally with parent tracking.
|
|
117
173
|
* @param parentSession - Optional parent session path for lineage tracking
|
|
@@ -130,6 +186,7 @@ export declare class RpcClient {
|
|
|
130
186
|
setModel(provider: string, modelId: string): Promise<{
|
|
131
187
|
provider: string;
|
|
132
188
|
id: string;
|
|
189
|
+
systemPromptName?: string;
|
|
133
190
|
}>;
|
|
134
191
|
/**
|
|
135
192
|
* Cycle to next model.
|
|
@@ -211,7 +268,21 @@ export declare class RpcClient {
|
|
|
211
268
|
/**
|
|
212
269
|
* Execute a bash command.
|
|
213
270
|
*/
|
|
214
|
-
bash(command: string
|
|
271
|
+
bash(command: string, options?: {
|
|
272
|
+
excludeFromContext?: boolean;
|
|
273
|
+
operations?: Record<string, unknown>;
|
|
274
|
+
}): Promise<BashResult>;
|
|
275
|
+
navigateTree(targetId: string, options?: {
|
|
276
|
+
summarize?: boolean;
|
|
277
|
+
customInstructions?: string;
|
|
278
|
+
replaceInstructions?: boolean;
|
|
279
|
+
label?: string;
|
|
280
|
+
}): Promise<{
|
|
281
|
+
cancelled: boolean;
|
|
282
|
+
editorText?: string;
|
|
283
|
+
aborted?: boolean;
|
|
284
|
+
summaryEntry?: unknown;
|
|
285
|
+
}>;
|
|
215
286
|
/**
|
|
216
287
|
* Abort running bash command.
|
|
217
288
|
*/
|
|
@@ -226,18 +297,25 @@ export declare class RpcClient {
|
|
|
226
297
|
exportHtml(outputPath?: string): Promise<{
|
|
227
298
|
path: string;
|
|
228
299
|
}>;
|
|
300
|
+
exportJsonl(outputPath?: string): Promise<{
|
|
301
|
+
path: string;
|
|
302
|
+
}>;
|
|
229
303
|
/**
|
|
230
304
|
* Switch to a different session file.
|
|
231
305
|
* @returns Object with `cancelled: true` if an extension cancelled the switch
|
|
232
306
|
*/
|
|
233
|
-
switchSession(sessionPath: string
|
|
307
|
+
switchSession(sessionPath: string, options?: {
|
|
308
|
+
cwdOverride?: string;
|
|
309
|
+
}): Promise<{
|
|
234
310
|
cancelled: boolean;
|
|
235
311
|
}>;
|
|
236
312
|
/**
|
|
237
313
|
* Fork from a specific message.
|
|
238
314
|
* @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)
|
|
239
315
|
*/
|
|
240
|
-
fork(entryId: string
|
|
316
|
+
fork(entryId: string, options?: {
|
|
317
|
+
position?: "before" | "at";
|
|
318
|
+
}): Promise<{
|
|
241
319
|
text: string;
|
|
242
320
|
cancelled: boolean;
|
|
243
321
|
}>;
|
|
@@ -277,6 +355,9 @@ export declare class RpcClient {
|
|
|
277
355
|
* Set the session display name.
|
|
278
356
|
*/
|
|
279
357
|
setSessionName(name: string): Promise<void>;
|
|
358
|
+
importJsonl(inputPath: string, cwdOverride?: string): Promise<{
|
|
359
|
+
cancelled: boolean;
|
|
360
|
+
}>;
|
|
280
361
|
/**
|
|
281
362
|
* Get all messages in the session.
|
|
282
363
|
*/
|
|
@@ -312,4 +393,5 @@ export declare class RpcClient {
|
|
|
312
393
|
private send;
|
|
313
394
|
private getData;
|
|
314
395
|
}
|
|
396
|
+
export {};
|
|
315
397
|
//# sourceMappingURL=rpc-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG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AAmB,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;IA0BhE;;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,qBAAqB;YAQf,IAAI;IAiElB,OAAO,CAAC,OAAO;CAef"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import { createConnection } from "node:net";
|
|
8
|
+
import { MissingSessionCwdError } from "../../core/session-cwd.js";
|
|
8
9
|
import { attachJsonlLineReader, serializeJsonLine } from "./jsonl.js";
|
|
9
10
|
function isProviderAccountEvent(event) {
|
|
10
11
|
return event.type === "auth_accounts_changed" || event.type === "account_failover";
|
|
@@ -195,25 +196,57 @@ export class RpcClient {
|
|
|
195
196
|
const response = await this.send({ type: "list_sessions" }, false);
|
|
196
197
|
return this.getData(response).sessions;
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
async prompt(message, optionsOrImages) {
|
|
200
|
+
const options = Array.isArray(optionsOrImages)
|
|
201
|
+
? { images: optionsOrImages }
|
|
202
|
+
: (optionsOrImages ?? {});
|
|
203
|
+
const response = await this.send({
|
|
204
|
+
type: "prompt",
|
|
205
|
+
message,
|
|
206
|
+
...(options.images ? { images: options.images } : {}),
|
|
207
|
+
...(options.streamingBehavior ? { streamingBehavior: options.streamingBehavior } : {}),
|
|
208
|
+
...(options.thinkingLevel ? { thinkingLevel: options.thinkingLevel } : {}),
|
|
209
|
+
...(options.expandPromptTemplates !== undefined
|
|
210
|
+
? { expandPromptTemplates: options.expandPromptTemplates }
|
|
211
|
+
: {}),
|
|
212
|
+
}, true, {
|
|
213
|
+
onResponse: (wireResponse) => {
|
|
214
|
+
if (!wireResponse.success) {
|
|
215
|
+
options?.preflightResult?.(false);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const data = wireResponse.data;
|
|
219
|
+
options?.promptDisposition?.(data?.disposition ?? "handled");
|
|
220
|
+
options?.preflightResult?.(true);
|
|
221
|
+
},
|
|
222
|
+
onReject: () => {
|
|
223
|
+
options?.preflightResult?.(false);
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
if (!response.success) {
|
|
227
|
+
throw new Error(response.error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async appendUserMessage(content) {
|
|
231
|
+
await this.send({ type: "append_user_message", content });
|
|
232
|
+
}
|
|
233
|
+
async appendSessionEntry(entry) {
|
|
234
|
+
await this.send({ type: "append_session_entry", entry });
|
|
235
|
+
}
|
|
236
|
+
async sendCustomMessage(message, options) {
|
|
237
|
+
await this.send({ type: "send_custom_message", ...message, ...options });
|
|
205
238
|
}
|
|
206
239
|
/**
|
|
207
240
|
* Queue a steering message to interrupt the agent mid-run.
|
|
208
241
|
*/
|
|
209
|
-
async steer(message, images) {
|
|
210
|
-
await this.send({ type: "steer", message, images });
|
|
242
|
+
async steer(message, images, recovery) {
|
|
243
|
+
await this.send({ type: "steer", message, images, enqueueOrder: recovery?.enqueueOrder });
|
|
211
244
|
}
|
|
212
245
|
/**
|
|
213
246
|
* Queue a follow-up message to be processed after the agent finishes.
|
|
214
247
|
*/
|
|
215
|
-
async followUp(message, images) {
|
|
216
|
-
await this.send({ type: "follow_up", message, images });
|
|
248
|
+
async followUp(message, images, recovery) {
|
|
249
|
+
await this.send({ type: "follow_up", message, images, enqueueOrder: recovery?.enqueueOrder });
|
|
217
250
|
}
|
|
218
251
|
/**
|
|
219
252
|
* Abort current operation.
|
|
@@ -221,13 +254,41 @@ export class RpcClient {
|
|
|
221
254
|
async abort() {
|
|
222
255
|
await this.send({ type: "abort" });
|
|
223
256
|
}
|
|
257
|
+
async abortCompaction() {
|
|
258
|
+
await this.send({ type: "abort_compaction" });
|
|
259
|
+
}
|
|
260
|
+
async reload() {
|
|
261
|
+
const response = await this.send({ type: "reload" });
|
|
262
|
+
return this.getData(response);
|
|
263
|
+
}
|
|
264
|
+
async checkReloadVeto() {
|
|
265
|
+
const response = await this.send({ type: "check_reload_veto" });
|
|
266
|
+
return this.getData(response);
|
|
267
|
+
}
|
|
224
268
|
/**
|
|
225
269
|
* Clear queued steering and follow-up messages, returning their text.
|
|
226
270
|
*/
|
|
227
|
-
async clearQueue() {
|
|
228
|
-
const response = await this.send({ type: "clear_queue" });
|
|
271
|
+
async clearQueue(options) {
|
|
272
|
+
const response = await this.send({ type: "clear_queue", abortWillFollow: options?.abortWillFollow });
|
|
229
273
|
return this.getData(response);
|
|
230
274
|
}
|
|
275
|
+
async getSteeringMessages() {
|
|
276
|
+
const response = await this.send({ type: "get_steering_messages" });
|
|
277
|
+
return this.getData(response).messages;
|
|
278
|
+
}
|
|
279
|
+
async getFollowUpMessages() {
|
|
280
|
+
const response = await this.send({ type: "get_follow_up_messages" });
|
|
281
|
+
return this.getData(response).messages;
|
|
282
|
+
}
|
|
283
|
+
async abortBranchSummary() {
|
|
284
|
+
await this.send({ type: "abort_branch_summary" });
|
|
285
|
+
}
|
|
286
|
+
async recordBashResult(command, result, excludeFromContext) {
|
|
287
|
+
await this.send({ type: "record_bash_result", command, result, excludeFromContext });
|
|
288
|
+
}
|
|
289
|
+
async setLabel(entryId, label) {
|
|
290
|
+
await this.send({ type: "set_label", entryId, label });
|
|
291
|
+
}
|
|
231
292
|
/**
|
|
232
293
|
* Start a new session, optionally with parent tracking.
|
|
233
294
|
* @param parentSession - Optional parent session path for lineage tracking
|
|
@@ -348,8 +409,17 @@ export class RpcClient {
|
|
|
348
409
|
/**
|
|
349
410
|
* Execute a bash command.
|
|
350
411
|
*/
|
|
351
|
-
async bash(command) {
|
|
352
|
-
const response = await this.send({
|
|
412
|
+
async bash(command, options) {
|
|
413
|
+
const response = await this.send({
|
|
414
|
+
type: "bash",
|
|
415
|
+
command,
|
|
416
|
+
excludeFromContext: options?.excludeFromContext,
|
|
417
|
+
operations: options?.operations,
|
|
418
|
+
});
|
|
419
|
+
return this.getData(response);
|
|
420
|
+
}
|
|
421
|
+
async navigateTree(targetId, options) {
|
|
422
|
+
const response = await this.send({ type: "navigate_tree", targetId, ...options });
|
|
353
423
|
return this.getData(response);
|
|
354
424
|
}
|
|
355
425
|
/**
|
|
@@ -372,20 +442,24 @@ export class RpcClient {
|
|
|
372
442
|
const response = await this.send({ type: "export_html", outputPath });
|
|
373
443
|
return this.getData(response);
|
|
374
444
|
}
|
|
445
|
+
async exportJsonl(outputPath) {
|
|
446
|
+
const response = await this.send({ type: "export_jsonl", outputPath });
|
|
447
|
+
return this.getData(response);
|
|
448
|
+
}
|
|
375
449
|
/**
|
|
376
450
|
* Switch to a different session file.
|
|
377
451
|
* @returns Object with `cancelled: true` if an extension cancelled the switch
|
|
378
452
|
*/
|
|
379
|
-
async switchSession(sessionPath) {
|
|
380
|
-
const response = await this.send({ type: "switch_session", sessionPath });
|
|
453
|
+
async switchSession(sessionPath, options) {
|
|
454
|
+
const response = await this.send({ type: "switch_session", sessionPath, cwdOverride: options?.cwdOverride });
|
|
381
455
|
return this.getData(response);
|
|
382
456
|
}
|
|
383
457
|
/**
|
|
384
458
|
* Fork from a specific message.
|
|
385
459
|
* @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)
|
|
386
460
|
*/
|
|
387
|
-
async fork(entryId) {
|
|
388
|
-
const response = await this.send({ type: "fork", entryId });
|
|
461
|
+
async fork(entryId, options) {
|
|
462
|
+
const response = await this.send({ type: "fork", entryId, position: options?.position });
|
|
389
463
|
return this.getData(response);
|
|
390
464
|
}
|
|
391
465
|
/**
|
|
@@ -430,6 +504,10 @@ export class RpcClient {
|
|
|
430
504
|
async setSessionName(name) {
|
|
431
505
|
await this.send({ type: "set_session_name", name });
|
|
432
506
|
}
|
|
507
|
+
async importJsonl(inputPath, cwdOverride) {
|
|
508
|
+
const response = await this.send({ type: "import_jsonl", inputPath, cwdOverride });
|
|
509
|
+
return this.getData(response);
|
|
510
|
+
}
|
|
433
511
|
/**
|
|
434
512
|
* Get all messages in the session.
|
|
435
513
|
*/
|
|
@@ -499,7 +577,10 @@ export class RpcClient {
|
|
|
499
577
|
reject(new Error(`Timeout collecting events. Stderr: ${this.stderr}`));
|
|
500
578
|
}, timeout);
|
|
501
579
|
const unsubscribe = this.onEvent((event) => {
|
|
502
|
-
if (isProviderAccountEvent(event) ||
|
|
580
|
+
if (isProviderAccountEvent(event) ||
|
|
581
|
+
event.type === "extension_event" ||
|
|
582
|
+
event.type === "bash_start" ||
|
|
583
|
+
event.type === "bash_end")
|
|
503
584
|
return;
|
|
504
585
|
events.push(event);
|
|
505
586
|
if (event.type === "agent_settled") {
|
|
@@ -515,7 +596,7 @@ export class RpcClient {
|
|
|
515
596
|
*/
|
|
516
597
|
async promptAndWait(message, images, timeout = 60000) {
|
|
517
598
|
const eventsPromise = this.collectEvents(timeout);
|
|
518
|
-
await this.prompt(message, images);
|
|
599
|
+
await this.prompt(message, images ? { images } : undefined);
|
|
519
600
|
return eventsPromise;
|
|
520
601
|
}
|
|
521
602
|
// =========================================================================
|
|
@@ -528,6 +609,10 @@ export class RpcClient {
|
|
|
528
609
|
if (data.type === "response" && data.id && this.pendingRequests.has(data.id)) {
|
|
529
610
|
const pending = this.pendingRequests.get(data.id);
|
|
530
611
|
this.pendingRequests.delete(data.id);
|
|
612
|
+
// Response hooks run synchronously inside the frame dispatch so ordering-sensitive
|
|
613
|
+
// contracts (e.g. optimistic-echo disposition) settle before the NEXT frame —
|
|
614
|
+
// never through the microtask scheduled by resolve().
|
|
615
|
+
pending.onResponse?.(data);
|
|
531
616
|
pending.resolve(data);
|
|
532
617
|
return;
|
|
533
618
|
}
|
|
@@ -548,11 +633,12 @@ export class RpcClient {
|
|
|
548
633
|
}
|
|
549
634
|
rejectPendingRequests(error) {
|
|
550
635
|
for (const pending of this.pendingRequests.values()) {
|
|
636
|
+
pending.onReject?.(error);
|
|
551
637
|
pending.reject(error);
|
|
552
638
|
}
|
|
553
639
|
this.pendingRequests.clear();
|
|
554
640
|
}
|
|
555
|
-
async send(command, route = true) {
|
|
641
|
+
async send(command, route = true, hooks) {
|
|
556
642
|
const childProcess = this.process;
|
|
557
643
|
const stream = this.socket ?? childProcess?.stdin;
|
|
558
644
|
if (!stream) {
|
|
@@ -579,8 +665,11 @@ export class RpcClient {
|
|
|
579
665
|
};
|
|
580
666
|
return new Promise((resolve, reject) => {
|
|
581
667
|
const timeout = setTimeout(() => {
|
|
668
|
+
const pending = this.pendingRequests.get(id);
|
|
582
669
|
this.pendingRequests.delete(id);
|
|
583
|
-
|
|
670
|
+
const timeoutError = new Error(`Timeout waiting for response to ${command.type}. Stderr: ${this.stderr}`);
|
|
671
|
+
pending?.onReject?.(timeoutError);
|
|
672
|
+
reject(timeoutError);
|
|
584
673
|
}, 30000);
|
|
585
674
|
this.pendingRequests.set(id, {
|
|
586
675
|
resolve: (response) => {
|
|
@@ -591,6 +680,8 @@ export class RpcClient {
|
|
|
591
680
|
clearTimeout(timeout);
|
|
592
681
|
reject(error);
|
|
593
682
|
},
|
|
683
|
+
...(hooks?.onResponse ? { onResponse: hooks.onResponse } : {}),
|
|
684
|
+
...(hooks?.onReject ? { onReject: hooks.onReject } : {}),
|
|
594
685
|
});
|
|
595
686
|
try {
|
|
596
687
|
stream.write(serializeJsonLine(fullCommand));
|
|
@@ -599,6 +690,7 @@ export class RpcClient {
|
|
|
599
690
|
const writeError = error instanceof Error ? error : new Error(String(error));
|
|
600
691
|
const pending = this.pendingRequests.get(id);
|
|
601
692
|
this.pendingRequests.delete(id);
|
|
693
|
+
pending?.onReject?.(writeError);
|
|
602
694
|
pending?.reject(writeError);
|
|
603
695
|
}
|
|
604
696
|
});
|
|
@@ -606,6 +698,9 @@ export class RpcClient {
|
|
|
606
698
|
getData(response) {
|
|
607
699
|
if (!response.success) {
|
|
608
700
|
const errorResponse = response;
|
|
701
|
+
if (errorResponse.errorCode === "missing_session_cwd" && errorResponse.errorData) {
|
|
702
|
+
throw new MissingSessionCwdError(errorResponse.errorData);
|
|
703
|
+
}
|
|
609
704
|
throw new Error(errorResponse.error);
|
|
610
705
|
}
|
|
611
706
|
// Type assertion: we trust response.data matches T based on the command sent.
|