@wrongstack/acp 0.284.1 → 0.285.0

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.
Files changed (71) hide show
  1. package/dist/agent/index.d.ts +13 -0
  2. package/dist/agent/index.d.ts.map +1 -0
  3. package/dist/{wrongstack-acp-agent-nzrqmJnc.d.ts → agent/protocol-handler.d.ts} +26 -75
  4. package/dist/agent/protocol-handler.d.ts.map +1 -0
  5. package/dist/{server-agent-turn-C3U0lhA-.d.ts → agent/server-agent-turn.d.ts} +8 -63
  6. package/dist/agent/server-agent-turn.d.ts.map +1 -0
  7. package/dist/agent/session-store.d.ts +53 -0
  8. package/dist/agent/session-store.d.ts.map +1 -0
  9. package/dist/agent/stdio-transport.d.ts +82 -0
  10. package/dist/agent/stdio-transport.d.ts.map +1 -0
  11. package/dist/{tools-registry-D2xdbzN7.d.ts → agent/tools-registry.d.ts} +4 -7
  12. package/dist/agent/tools-registry.d.ts.map +1 -0
  13. package/dist/agent/wrongstack-acp-agent.d.ts +58 -0
  14. package/dist/agent/wrongstack-acp-agent.d.ts.map +1 -0
  15. package/dist/agent/ws-bridge-transport.d.ts +37 -0
  16. package/dist/agent/ws-bridge-transport.d.ts.map +1 -0
  17. package/dist/agent.d.ts +1 -45
  18. package/dist/agent.js +21 -11
  19. package/dist/agent.js.map +7 -1
  20. package/dist/client/acp-session.d.ts +349 -0
  21. package/dist/client/acp-session.d.ts.map +1 -0
  22. package/dist/client/file-server.d.ts +44 -0
  23. package/dist/client/file-server.d.ts.map +1 -0
  24. package/dist/client/index.d.ts +12 -0
  25. package/dist/client/index.d.ts.map +1 -0
  26. package/dist/client/permission.d.ts +45 -0
  27. package/dist/client/permission.d.ts.map +1 -0
  28. package/dist/client/terminal-server.d.ts +54 -0
  29. package/dist/client/terminal-server.d.ts.map +1 -0
  30. package/dist/{index-DEEYyEpu.d.ts → client/tool-translator.d.ts} +17 -8
  31. package/dist/client/tool-translator.d.ts.map +1 -0
  32. package/dist/client/websocket-transport.d.ts +40 -0
  33. package/dist/client/websocket-transport.d.ts.map +1 -0
  34. package/dist/client.d.ts +1 -5
  35. package/dist/client.js +36 -17
  36. package/dist/client.js.map +7 -1
  37. package/dist/index.d.ts +43 -457
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +126 -67
  40. package/dist/index.js.map +7 -1
  41. package/dist/integration/acp-bench.d.ts +68 -0
  42. package/dist/integration/acp-bench.d.ts.map +1 -0
  43. package/dist/integration/acp-subagent-runner.d.ts +194 -0
  44. package/dist/integration/acp-subagent-runner.d.ts.map +1 -0
  45. package/dist/integration/ensemble-runner.d.ts +147 -0
  46. package/dist/integration/ensemble-runner.d.ts.map +1 -0
  47. package/dist/integration/run-one-acp-task.d.ts +29 -0
  48. package/dist/integration/run-one-acp-task.d.ts.map +1 -0
  49. package/dist/registry/acp-registry-fetch.d.ts +86 -0
  50. package/dist/registry/acp-registry-fetch.d.ts.map +1 -0
  51. package/dist/registry/agents.catalog.d.ts +46 -0
  52. package/dist/registry/agents.catalog.d.ts.map +1 -0
  53. package/dist/registry/ensemble-registry.d.ts +104 -0
  54. package/dist/registry/ensemble-registry.d.ts.map +1 -0
  55. package/dist/sdk.d.ts +41 -12
  56. package/dist/sdk.d.ts.map +1 -0
  57. package/dist/sdk.js +142 -72
  58. package/dist/sdk.js.map +7 -1
  59. package/dist/types/acp-messages.d.ts +133 -0
  60. package/dist/types/acp-messages.d.ts.map +1 -0
  61. package/dist/types/acp-v1.d.ts +476 -0
  62. package/dist/types/acp-v1.d.ts.map +1 -0
  63. package/dist/win32-cmd.d.ts +7 -0
  64. package/dist/win32-cmd.d.ts.map +1 -0
  65. package/dist/wrongstack-acp-agent.d.ts +1 -3
  66. package/dist/wrongstack-acp-agent.js +11 -9
  67. package/dist/wrongstack-acp-agent.js.map +7 -1
  68. package/package.json +4 -4
  69. package/dist/acp-subagent-runner-BAlo23L-.d.ts +0 -644
  70. package/dist/acp-v1-BxskPsdo.d.ts +0 -520
  71. package/dist/terminal-server-P9KpMZTT.d.ts +0 -99
@@ -0,0 +1,349 @@
1
+ /**
2
+ * ACPSession — v1-correct ACP client.
3
+ *
4
+ * Owns one child process running an ACP-supporting agent (Claude Code,
5
+ * Gemini CLI, Codex CLI, etc.) and translates the wire protocol into
6
+ * a `SubagentRunner`-shaped surface for the rest of WrongStack.
7
+ *
8
+ * Spec: https://agentclientprotocol.com/protocol/v1/overview
9
+ * Design: see ./acp-session.design.md in this directory.
10
+ */
11
+ import { type ACPClientTransport } from '../agent/stdio-transport.js';
12
+ import { type WebSocketClientTransportOptions } from './websocket-transport.js';
13
+ import { type AgentCapabilities, type AnySessionUpdate, type AuthMethod, type ContentBlock, type McpServer, type PlanEntry, type SessionId, type SessionInfo, type StopReason, type ToolCallStatus, type ToolKind, type UsageCost } from '../types/acp-v1.js';
14
+ import { type PermissionPolicy } from './permission.js';
15
+ export interface ACPSessionOptions {
16
+ command: string;
17
+ args?: readonly string[] | undefined;
18
+ env?: Record<string, string> | undefined;
19
+ cwd?: string | undefined;
20
+ role?: string | undefined;
21
+ /** Sandbox root for fs/* and terminal/* methods. */
22
+ projectRoot: string;
23
+ /** Hard timeout for one prompt turn. Default 5 minutes. */
24
+ timeoutMs?: number | undefined;
25
+ /** Override the permission policy. */
26
+ permissionPolicy?: PermissionPolicy | undefined;
27
+ /** Per-fs-call timeout, default 30s. */
28
+ fsTimeoutMs?: number | undefined;
29
+ /** Per-terminal command timeout, default 5 minutes. */
30
+ terminalTimeoutMs?: number | undefined;
31
+ /** Per-terminal output byte cap, default 1 MiB. */
32
+ terminalOutputByteLimit?: number | undefined;
33
+ /**
34
+ * MCP server configs to include in session/new, session/load, and
35
+ * session/resume. The agent will connect to these servers to provide
36
+ * additional tools.
37
+ *
38
+ * Stdio servers are always sent. HTTP/SSE servers are only sent if
39
+ * the agent advertises the corresponding mcpCapabilities.
40
+ */
41
+ mcpServers?: McpServer[] | undefined;
42
+ }
43
+ /**
44
+ * A captured file diff emitted by the agent during a turn (via a tool
45
+ * call's `diff` content). `oldText: null` means the file was created.
46
+ */
47
+ export interface ACPCapturedDiff {
48
+ path: string;
49
+ oldText: string | null;
50
+ newText: string;
51
+ }
52
+ /**
53
+ * A captured tool call the agent ran during a turn. We collapse the
54
+ * `tool_call` + subsequent `tool_call_update` notifications for the same
55
+ * `toolCallId` into one record carrying its latest status.
56
+ */
57
+ export interface ACPCapturedToolCall {
58
+ toolCallId: string;
59
+ title: string;
60
+ kind?: ToolKind | undefined;
61
+ status: ToolCallStatus;
62
+ /** Terminal/command output or text content surfaced by the tool, if any. */
63
+ rawOutput?: Record<string, unknown> | undefined;
64
+ rawInput?: Record<string, unknown> | undefined;
65
+ }
66
+ export interface ACPSessionRunResult {
67
+ text: string;
68
+ stopReason: StopReason;
69
+ hasText: boolean;
70
+ usage?: {
71
+ used: number;
72
+ size: number;
73
+ cost?: UsageCost | undefined;
74
+ } | undefined;
75
+ plan?: PlanEntry[] | undefined;
76
+ /** Tool calls the agent ran this turn (deduped by toolCallId). */
77
+ toolCalls: ACPCapturedToolCall[];
78
+ /** File diffs the agent produced this turn. */
79
+ diffs: ACPCapturedDiff[];
80
+ /** Agent "thinking" text emitted via thought_chunk, concatenated. */
81
+ thoughts: string;
82
+ }
83
+ /**
84
+ * Live progress callback. Invoked for every `session/update` notification
85
+ * the agent streams during a `prompt()` turn, in arrival order, BEFORE the
86
+ * turn resolves. Lets the host render tool activity / text deltas / diffs
87
+ * as they happen instead of waiting for the buffered final result.
88
+ *
89
+ * The raw `update` (the discriminated `session/update` payload) is passed
90
+ * through verbatim so callers can switch on `update.sessionUpdate`.
91
+ */
92
+ export type ACPProgressHandler = (event: ACPProgressEvent) => void;
93
+ export type ACPProgressEvent = {
94
+ type: 'message';
95
+ text: string;
96
+ } | {
97
+ type: 'thought';
98
+ text: string;
99
+ } | {
100
+ type: 'tool_call';
101
+ toolCall: ACPCapturedToolCall;
102
+ } | {
103
+ type: 'tool_call_update';
104
+ toolCall: ACPCapturedToolCall;
105
+ } | {
106
+ type: 'diff';
107
+ diff: ACPCapturedDiff;
108
+ } | {
109
+ type: 'plan';
110
+ entries: PlanEntry[];
111
+ } | {
112
+ type: 'usage';
113
+ usage: {
114
+ used: number;
115
+ size: number;
116
+ cost?: UsageCost | undefined;
117
+ };
118
+ } | {
119
+ type: 'raw';
120
+ update: AnySessionUpdate;
121
+ };
122
+ export type ACPSessionErrorKind = 'spawn_failed' | 'init_failed' | 'protocol_error' | 'session_create_failed' | 'prompt_failed' | 'auth_failed' | 'logout_failed' | 'aborted' | 'closed' | 'agent_died' | 'unsupported_capability';
123
+ export declare class ACPSessionError extends Error {
124
+ readonly kind: ACPSessionErrorKind;
125
+ readonly cause: unknown;
126
+ constructor(kind: ACPSessionErrorKind, message: string, cause?: unknown);
127
+ }
128
+ export declare class ACPSession {
129
+ private readonly transport;
130
+ private readonly fileServer;
131
+ private readonly terminalServer;
132
+ private readonly permissionPolicy;
133
+ private readonly timeoutMs;
134
+ private readonly opts;
135
+ private state;
136
+ private sessionId;
137
+ /** Pending outbound requests (initialize, session/new, session/prompt, etc). */
138
+ private readonly pending;
139
+ private nextId;
140
+ /** True after close() has been called. */
141
+ private closed;
142
+ private agentCapabilities;
143
+ private agentInfo;
144
+ private authMethods;
145
+ /** Protocol version negotiated with the agent during initialize. */
146
+ private negotiatedVersion;
147
+ private constructor();
148
+ /** Agent capabilities advertised during initialize. */
149
+ getCapabilities(): AgentCapabilities;
150
+ /** Authentication methods advertised by the agent. */
151
+ getAuthMethods(): AuthMethod[];
152
+ /** Agent info (name, title, version) from initialize. */
153
+ getAgentInfo(): {
154
+ name: string;
155
+ title?: string | undefined;
156
+ version: string;
157
+ } | null;
158
+ /** Whether the agent requires authentication (has auth methods). */
159
+ requiresAuth(): boolean;
160
+ /** Current session id, if one exists. */
161
+ getSessionId(): SessionId | null;
162
+ /** Protocol version negotiated during initialize. */
163
+ getNegotiatedVersion(): number;
164
+ /**
165
+ * Spawn the child, run the initialize handshake, install the
166
+ * message dispatch, and return a ready session.
167
+ */
168
+ static start(opts: ACPSessionOptions): Promise<ACPSession>;
169
+ /**
170
+ * Connect to a REMOTE ACP agent over a WebSocket instead of spawning a
171
+ * local subprocess. `opts.command` is ignored for the wire (a label is
172
+ * still useful for `role`); everything else (projectRoot sandbox for
173
+ * fs/terminal, timeouts, permission policy, MCP servers) applies the same.
174
+ */
175
+ static connectWebSocket(wsOpts: WebSocketClientTransportOptions, opts: ACPSessionOptions): Promise<ACPSession>;
176
+ /**
177
+ * Connect using a caller-supplied transport. Lets advanced callers plug
178
+ * in their own wire (SDK streams, in-process pipes, test doubles).
179
+ */
180
+ static connect(transport: ACPClientTransport, opts: ACPSessionOptions): Promise<ACPSession>;
181
+ /** Shared connect path: start the transport, install dispatch, handshake. */
182
+ private static attach;
183
+ private initialize;
184
+ /**
185
+ * Authenticate with the agent using one of the advertised auth methods.
186
+ * Call this AFTER start() and BEFORE any session/new call.
187
+ *
188
+ * Throws ACPSessionError('auth_failed') if the agent rejects the
189
+ * authentication or if the methodId is not in the advertised list.
190
+ */
191
+ authenticate(methodId: string): Promise<void>;
192
+ /**
193
+ * Log out from the current authenticated session.
194
+ * Only callable if the agent advertises `auth.logout` capability.
195
+ */
196
+ logout(): Promise<void>;
197
+ /**
198
+ * Load an existing session. The agent replays the conversation history
199
+ * via session/update notifications before responding.
200
+ *
201
+ * Only works if the agent advertises `loadSession` capability.
202
+ *
203
+ * @param sessionId - The session to load
204
+ * @param mcpServers - Optional MCP servers (defaults to options.mcpServers)
205
+ * @param cwd - Optional working directory (defaults to options.cwd or projectRoot)
206
+ */
207
+ loadSession(sessionId: SessionId, mcpServers?: McpServer[], cwd?: string): Promise<void>;
208
+ /**
209
+ * Resume an existing session without replaying history.
210
+ *
211
+ * Only works if the agent advertises `sessionCapabilities.resume`.
212
+ *
213
+ * @param sessionId - The session to resume
214
+ * @param mcpServers - Optional MCP servers (defaults to options.mcpServers)
215
+ * @param cwd - Optional working directory (defaults to options.cwd or projectRoot)
216
+ */
217
+ resumeSession(sessionId: SessionId, mcpServers?: McpServer[], cwd?: string): Promise<void>;
218
+ /**
219
+ * List existing sessions known to the agent.
220
+ *
221
+ * Only works if the agent advertises `sessionCapabilities.list`.
222
+ */
223
+ listSessions(cursor?: string, cwd?: string): Promise<{
224
+ sessions: SessionInfo[];
225
+ nextCursor?: string | undefined;
226
+ }>;
227
+ /**
228
+ * Delete a session from the agent's session list.
229
+ *
230
+ * Only works if the agent advertises `sessionCapabilities.delete`.
231
+ */
232
+ deleteSession(sessionId: SessionId): Promise<void>;
233
+ /**
234
+ * Fork a session — create a new session from an existing one.
235
+ */
236
+ forkSession(sourceSessionId: SessionId, cwd?: string, mcpServers?: McpServer[]): Promise<SessionId>;
237
+ /**
238
+ * Set the active mode for a session.
239
+ */
240
+ setMode(sessionId: SessionId, modeId: string): Promise<void>;
241
+ /**
242
+ * Set a configuration option for a session.
243
+ */
244
+ setConfigOption(sessionId: SessionId, configId: string, value: string): Promise<void>;
245
+ /**
246
+ * List available providers and the current provider.
247
+ */
248
+ listProviders(): Promise<{
249
+ providers: unknown[];
250
+ currentProviderId: string | null;
251
+ }>;
252
+ /**
253
+ * Send an MCP message to the agent for routing.
254
+ */
255
+ mcpMessage(connectionId: string, message: Record<string, unknown>): Promise<unknown>;
256
+ /**
257
+ * Set the active provider for the agent.
258
+ */
259
+ setProvider(providerId: string, config?: Record<string, unknown>): Promise<void>;
260
+ /**
261
+ * Disable the current provider.
262
+ */
263
+ disableProvider(): Promise<void>;
264
+ /**
265
+ * Run one prompt turn. Creates a session if needed, sends the
266
+ * prompt, streams session/update notifications, and resolves with
267
+ * the agent's response.
268
+ *
269
+ * @param blocks - Content blocks to send. Use `textContent()` for plain
270
+ * text, or include ImageContent/AudioContent if the agent's
271
+ * `promptCapabilities` allow it.
272
+ * @param signal - AbortSignal for cancellation.
273
+ *
274
+ * Cancellation: if `signal` aborts mid-prompt, we send
275
+ * `session/cancel` (a notification per spec) and keep accepting
276
+ * updates until the agent returns with `stopReason: 'cancelled'`.
277
+ * The result is the same shape as a normal turn, with
278
+ * `stopReason === 'cancelled'`.
279
+ */
280
+ prompt(blocks: ContentBlock[], signal: AbortSignal, onProgress?: ACPProgressHandler): Promise<ACPSessionRunResult>;
281
+ private createSession;
282
+ /**
283
+ * Close the current session gracefully (if the agent supports it).
284
+ *
285
+ * Sends `session/close` JSON-RPC request, then clears the local
286
+ * session id. Best-effort — errors are swallowed so the caller can
287
+ * always proceed to transport teardown.
288
+ */
289
+ private closeSession;
290
+ /** Tear down the session and kill the child process. */
291
+ close(): Promise<void>;
292
+ /**
293
+ * Filter MCP servers according to agent capabilities.
294
+ * - Stdio servers are always included.
295
+ * - HTTP servers are only included if agent supports mcpCapabilities.http.
296
+ * - SSE servers are only included if agent supports mcpCapabilities.sse.
297
+ */
298
+ private filterMcpServers;
299
+ private allocId;
300
+ private sendRequest;
301
+ /**
302
+ * Send a JSON-RPC 2.0 success response to an agent-initiated request.
303
+ *
304
+ * Per JSON-RPC 2.0 (and the official ACP SDK's message router) a Response
305
+ * object MUST carry `jsonrpc: "2.0"` and MUST NOT carry a `method` field —
306
+ * the SDK classifies any object with a `method` key as a Request and drops
307
+ * it as a response, so an agent's `fs/*`, `terminal/*`, or
308
+ * `session/request_permission` callback would hang forever. The legacy
309
+ * `ACPMessage` type predates v1 (requires `method`, lacks `jsonrpc`), so we
310
+ * build the correct wire object and cast at the boundary.
311
+ */
312
+ private sendResult;
313
+ /** Send a JSON-RPC 2.0 error response (no `method` field, per spec). */
314
+ private sendErrorResponse;
315
+ private handleMessage;
316
+ private handleUpdate;
317
+ /**
318
+ * Fold a `tool_call` / `tool_call_update` notification into the scratch
319
+ * tool-call map (deduped by toolCallId), extract any `diff` content into
320
+ * the diffs list, and emit live progress.
321
+ */
322
+ private captureToolCall;
323
+ private emitProgress;
324
+ /** Live progress handler installed for the duration of a `prompt()` turn. */
325
+ private progressHandler;
326
+ private scratch;
327
+ private resetScratch;
328
+ private handlePermissionRequest;
329
+ private handleFsRequest;
330
+ private handleTerminalRequest;
331
+ }
332
+ /**
333
+ * Create a text ContentBlock. Convenience helper for callers of
334
+ * `session.prompt()`.
335
+ */
336
+ export declare function textContent(text: string): ContentBlock;
337
+ /**
338
+ * Create an image ContentBlock. Only send this if the agent's
339
+ * `promptCapabilities.image` is `true` (check via
340
+ * `session.getCapabilities().promptCapabilities?.image`).
341
+ */
342
+ export declare function imageContent(mimeType: string, data: string): ContentBlock;
343
+ /**
344
+ * Create an audio ContentBlock. Only send this if the agent's
345
+ * `promptCapabilities.audio` is `true` (check via
346
+ * `session.getCapabilities().promptCapabilities?.audio`).
347
+ */
348
+ export declare function audioContent(mimeType: string, data: string): ContentBlock;
349
+ //# sourceMappingURL=acp-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-session.d.ts","sourceRoot":"","sources":["../../src/client/acp-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EAEf,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACzC,GAAG,CAAC,EAA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,OAAO;YAID,WAAW;IAmCzB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,UAAU;IAIlB,wEAAwE;IACxE,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,aAAa;IA4ErB,OAAO,CAAC,YAAY;IA6DpB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IA+CvB,OAAO,CAAC,YAAY;IASpB,6EAA6E;IAC7E,OAAO,CAAC,eAAe,CAAmC;IAG1D,OAAO,CAAC,OAAO,CAOiD;IAEhE,OAAO,CAAC,YAAY;YAIN,uBAAuB;YAqBvB,eAAe;YA8Bf,qBAAqB;CAyDpC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAEzE"}
@@ -0,0 +1,44 @@
1
+ export interface FileServerOptions {
2
+ /** Absolute path; only files under this root are accessible. */
3
+ projectRoot: string;
4
+ /** Per-call timeout, default 30s. */
5
+ timeoutMs?: number;
6
+ }
7
+ export interface ReadFileParams {
8
+ sessionId: string;
9
+ path: string;
10
+ }
11
+ export interface WriteFileParams {
12
+ sessionId: string;
13
+ path: string;
14
+ content: string;
15
+ }
16
+ export type FsErrorCode = 'ENOENT' | 'EACCES' | 'OUTSIDE_ROOT' | 'TIMEOUT' | 'INVALID_PATH';
17
+ /**
18
+ * Thrown for protocol-level rejections (path outside root, etc.).
19
+ * The session converts these into JSON-RPC error responses.
20
+ */
21
+ export declare class FsError extends Error {
22
+ readonly code: FsErrorCode;
23
+ readonly path: string;
24
+ constructor(code: FsErrorCode, path: string, message: string);
25
+ }
26
+ export declare class FileServer {
27
+ private readonly root;
28
+ private readonly timeoutMs;
29
+ constructor(opts: FileServerOptions);
30
+ /** Read a text file. Returns the content as a string. */
31
+ readTextFile(params: ReadFileParams): Promise<{
32
+ content: string;
33
+ }>;
34
+ /** Write a text file. Atomic via write-then-rename. */
35
+ writeTextFile(params: WriteFileParams): Promise<void>;
36
+ /**
37
+ * Resolve a path; throw `FsError('OUTSIDE_ROOT')` if the result is
38
+ * not under the project root. Symlinks are not followed here — we
39
+ * operate on the textual path. A future hardening pass can
40
+ * `fs.realpath` each access to catch symlink escapes.
41
+ */
42
+ private resolveInside;
43
+ }
44
+ //# sourceMappingURL=file-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-server.d.ts","sourceRoot":"","sources":["../../src/client/file-server.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,GAAG,cAAc,CAAC;AAE5F;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,KAAK;IAChC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,YAAY,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAK3D;CACF;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,YAAY,IAAI,EAAE,iBAAiB,EAGlC;IAED,yDAAyD;IACnD,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAkBvE;IAED,uDAAuD;IACjD,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB1D;IAED;;;;;OAKG;IACH,OAAO,CAAC,aAAa;CAetB"}
@@ -0,0 +1,12 @@
1
+ export { ClientTransport } from '../agent/stdio-transport.js';
2
+ export type { ClientTransportOptions, ACPChildProcess, ACPClientTransport } from '../agent/stdio-transport.js';
3
+ export { WebSocketClientTransport } from './websocket-transport.js';
4
+ export type { WebSocketClientTransportOptions } from './websocket-transport.js';
5
+ export { ToolTranslator } from './tool-translator.js';
6
+ export { ACPSession, ACPSessionError, textContent, imageContent, audioContent, } from './acp-session.js';
7
+ export type { ACPSessionOptions, ACPSessionRunResult, ACPSessionErrorKind, ACPProgressEvent, ACPProgressHandler, ACPCapturedToolCall, ACPCapturedDiff, } from './acp-session.js';
8
+ export { defaultPermissionPolicy, readOnlyPermissionPolicy, makePermissionPolicy, } from './permission.js';
9
+ export type { PermissionPolicy, PermissionRequest } from './permission.js';
10
+ export { makeACPSubagentRunner } from '../integration/acp-subagent-runner.js';
11
+ export type { ACPSubagentRunnerOptions } from '../integration/acp-subagent-runner.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,YAAY,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Permission policy for ACP v1 client sessions.
3
+ *
4
+ * ACP agents can call `session/request_permission` to ask the user
5
+ * before executing a tool call. The client is expected to surface
6
+ * the question, get a decision, and respond. This module is the seam
7
+ * where WrongStack-specific permission UI can plug in; for v1 we ship
8
+ * a minimal default that auto-approves the first `allow_once` option
9
+ * (or `allow_always` if present) and rejects on abort.
10
+ */
11
+ import type { PermissionOption, RequestPermissionOutcome, ToolCallUpdateNotification } from '../types/acp-v1.js';
12
+ /** A single permission decision request. */
13
+ export interface PermissionRequest {
14
+ toolCall: ToolCallUpdateNotification;
15
+ options: readonly PermissionOption[];
16
+ signal: AbortSignal;
17
+ }
18
+ /** A permission policy decides how to respond to a request. */
19
+ export type PermissionPolicy = (req: PermissionRequest) => Promise<RequestPermissionOutcome>;
20
+ /**
21
+ * Default policy: auto-approve the least-standing allow option.
22
+ *
23
+ * ⚠️ This auto-approves EVERY tool call, including file writes and shell
24
+ * commands. It exists so non-interactive contexts (CLI `acp spawn`,
25
+ * the Director fan-out) work without a human in the loop. Interactive
26
+ * surfaces (TUI/WebUI) MUST inject a policy that surfaces the request to
27
+ * the user — pass `permissionPolicy` to `ACPSession` / the subagent runner.
28
+ * For untrusted agents prefer {@link readOnlyPermissionPolicy}.
29
+ */
30
+ export declare const defaultPermissionPolicy: PermissionPolicy;
31
+ /**
32
+ * Safe-by-default policy: auto-approve only side-effect-free tool calls
33
+ * (read/search/fetch/think); reject anything that would write files or
34
+ * run commands. Use this when driving an untrusted external agent and no
35
+ * interactive surface is available to ask the user.
36
+ */
37
+ export declare const readOnlyPermissionPolicy: PermissionPolicy;
38
+ /**
39
+ * Build a policy from a yes/no decision function. The decider receives the
40
+ * tool call (title + kind + rawInput) and returns whether to allow it.
41
+ * This is the seam an interactive host (TUI/WebUI confirm prompt, trust
42
+ * store, exec-allowlist) plugs into.
43
+ */
44
+ export declare function makePermissionPolicy(decide: (req: PermissionRequest) => boolean | Promise<boolean>): PermissionPolicy;
45
+ //# sourceMappingURL=permission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../src/client/permission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAE5B,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,+DAA+D;AAC/D,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,iBAAiB,KACnB,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAgDvC;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAGrC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,gBAOtC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAC7D,gBAAgB,CAMlB"}
@@ -0,0 +1,54 @@
1
+ export interface TerminalServerOptions {
2
+ projectRoot: string;
3
+ /** Hard cap on per-command wall-clock. Default 5 minutes. */
4
+ commandTimeoutMs?: number;
5
+ /** Bytes of output to retain per terminal. Default 1 MiB. */
6
+ outputByteLimit?: number;
7
+ /** Optional abort signal that kills ALL active terminals. */
8
+ signal?: AbortSignal;
9
+ }
10
+ export declare class TerminalServer {
11
+ private readonly terminals;
12
+ private readonly projectRoot;
13
+ private readonly commandTimeoutMs;
14
+ private readonly outputByteLimit;
15
+ private nextId;
16
+ constructor(opts: TerminalServerOptions);
17
+ /** Spawn a new terminal. Returns the agent-facing id. */
18
+ create(params: {
19
+ sessionId: string;
20
+ command: string;
21
+ args?: string[];
22
+ env?: {
23
+ name: string;
24
+ value: string;
25
+ }[];
26
+ cwd?: string;
27
+ outputByteLimit?: number;
28
+ }): {
29
+ terminalId: string;
30
+ };
31
+ /** Return captured output and (if available) the exit status. */
32
+ output(terminalId: string): {
33
+ output: string;
34
+ truncated: boolean;
35
+ exitStatus?: {
36
+ exitCode: number | null;
37
+ signal: string | null;
38
+ };
39
+ };
40
+ /** Block until the process exits. Resolves with the exit status. */
41
+ waitForExit(terminalId: string): Promise<{
42
+ exitCode: number | null;
43
+ signal: string | null;
44
+ }>;
45
+ /** Kill the process but keep the terminal record (agent can still read output). */
46
+ kill(terminalId: string): void;
47
+ /** Kill the process if alive and remove the record. */
48
+ release(terminalId: string): void;
49
+ /** Kill all active terminals. Used on session close. */
50
+ releaseAll(): void;
51
+ private resolveCwd;
52
+ private buildEnv;
53
+ }
54
+ //# sourceMappingURL=terminal-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-server.d.ts","sourceRoot":"","sources":["../../src/client/terminal-server.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IAC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IAED,mFAAmF;IACnF,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAQ7B;IAED,uDAAuD;IACvD,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAahC;IAED,wDAAwD;IACxD,UAAU,IAAI,IAAI,CAIjB;IAED,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,QAAQ;CAuBjB"}
@@ -1,6 +1,3 @@
1
- import { b as ACPMessage, H as ACPToolCallResponse } from './acp-v1-BxskPsdo.js';
2
- import './acp-subagent-runner-BAlo23L-.js';
3
-
4
1
  /**
5
2
  * ToolTranslator — bidirectional translation between WrongStack tools and
6
3
  * ACP tool representations.
@@ -17,8 +14,9 @@ import './acp-subagent-runner-BAlo23L-.js';
17
14
  * a tool is running, then send a final result. The translator handles this
18
15
  * by polling for the final [result] notification on the transport.
19
16
  */
20
-
21
- interface ToolTranslatorOptions {
17
+ import type { ACPMessage, ACPToolDefinition, ACPToolCallResponse, ContentBlock } from '../types/acp-messages.js';
18
+ import type { TaskSpec, TaskResult } from '@wrongstack/core';
19
+ export interface ToolTranslatorOptions {
22
20
  /**
23
21
  * If true (default), wrap tool calls in an async poll loop that waits
24
22
  * for progress notifications until a final result arrives.
@@ -27,8 +25,20 @@ interface ToolTranslatorOptions {
27
25
  pollIntervalMs?: number | undefined;
28
26
  totalTimeoutMs?: number | undefined;
29
27
  }
28
+ /** Convert an ACP ACPToolDefinition → a JSON schema object recognisable by WrongStack */
29
+ export declare function acpToolToSchema(def: ACPToolDefinition): Record<string, unknown>;
30
+ /** Extract tool result text from ACP ContentBlock[] */
31
+ export declare function extractTextFromContent(blocks: ContentBlock[]): string;
32
+ /** Build a TaskSpec from an ACP task payload */
33
+ export declare function buildTaskSpec(payload: {
34
+ taskId: string;
35
+ task: string;
36
+ subagentId?: string | undefined;
37
+ }): TaskSpec;
38
+ /** Parse an ACP tools/call response → TaskResult */
39
+ export declare function parseToolResponse(taskId: string, subagentId: string, response: ACPToolCallResponse): TaskResult;
30
40
  /** ToolTranslator for DIR-1 — wraps ACP client transport, adds task semantics */
31
- declare class ToolTranslator {
41
+ export declare class ToolTranslator {
32
42
  private readonly opts;
33
43
  private readonly pending;
34
44
  constructor(opts?: ToolTranslatorOptions);
@@ -50,5 +60,4 @@ declare class ToolTranslator {
50
60
  }, name: string, args: Record<string, unknown>, callId?: string | number): Promise<ACPToolCallResponse>;
51
61
  cancelAll(): void;
52
62
  }
53
-
54
- export { ToolTranslator as T, type ToolTranslatorOptions as a };
63
+ //# sourceMappingURL=tool-translator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-translator.d.ts","sourceRoot":"","sources":["../../src/client/tool-translator.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAC,UAAU,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAC/G,OAAO,KAAK,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC3D,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAQD,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG/E;AAED,uDAAuD;AACvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAWrE;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,GAAG,QAAQ,CAMX;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,mBAAmB,GAC5B,UAAU,CAkBZ;AAED,iFAAiF;AACjF,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAInB;IAEL,YAAY,IAAI,GAAE,qBAA0B,EAE3C;IAED;;;OAGG;IACH,iBAAiB,CACf,SAAS,EAAE;QAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAAC,GAC7G,IAAI,CAqBN;IAED;;;;OAIG;IACG,QAAQ,CACZ,SAAS,EAAE;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAAC,EACrD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,GAAE,MAAM,GAAG,MAA4B,GAC5C,OAAO,CAAC,mBAAmB,CAAC,CAgB9B;IAED,SAAS,IAAI,IAAI,CAKhB;CACF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WebSocketClientTransport — remote ACP transport for `ACPSession`.
3
+ *
4
+ * Connects to a remote ACP agent over a WebSocket (cloud-hosted agents,
5
+ * separate-process agents reachable over the network). Each WebSocket
6
+ * message carries exactly one JSON-RPC 2.0 object — message boundaries
7
+ * are preserved by the WS framing, so (unlike stdio) no newline delimiter
8
+ * is needed.
9
+ *
10
+ * Uses the Node ≥ 22 built-in global `WebSocket` (undici), so there is no
11
+ * runtime dependency. Per-connection auth headers are not supported by the
12
+ * WHATWG WebSocket client; authenticate over the protocol instead
13
+ * (`ACPSession.authenticate`) or embed a token in the URL query string.
14
+ *
15
+ * Spec: https://agentclientprotocol.com/protocol/v1/overview (remote transport)
16
+ */
17
+ import type { ACPClientTransport } from '../agent/stdio-transport.js';
18
+ import type { ACPMessage } from '../types/acp-messages.js';
19
+ export interface WebSocketClientTransportOptions {
20
+ /** ws:// or wss:// URL of the remote ACP agent. */
21
+ url: string;
22
+ /** Optional WebSocket subprotocols. */
23
+ protocols?: string | string[] | undefined;
24
+ /** How long to wait for the socket to open. Default 30s. */
25
+ handshakeTimeoutMs?: number | undefined;
26
+ }
27
+ export declare class WebSocketClientTransport implements ACPClientTransport {
28
+ private ws;
29
+ private readonly handlers;
30
+ private closed;
31
+ private readonly opts;
32
+ constructor(opts: WebSocketClientTransportOptions);
33
+ start(): Promise<void>;
34
+ send(msg: ACPMessage): Promise<void>;
35
+ onMessage(handler: (msg: ACPMessage) => void): () => void;
36
+ stop(): void;
37
+ private onData;
38
+ private dispatch;
39
+ }
40
+ //# sourceMappingURL=websocket-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-transport.d.ts","sourceRoot":"","sources":["../../src/client/websocket-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,+BAA+B;IAC9C,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,4DAA4D;IAC5D,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAcD,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,OAAO,CAAC,EAAE,CAAuB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IACjE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkC;IAEvD,YAAY,IAAI,EAAE,+BAA+B,EAEhD;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAoDrB;IAED,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnC;IAED,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAGxD;IAED,IAAI,IAAI,IAAI,CAUX;IAED,OAAO,CAAC,MAAM;IA6Bd,OAAO,CAAC,QAAQ;CASjB"}
package/dist/client.d.ts CHANGED
@@ -1,5 +1 @@
1
- export { p as ACPChildProcess, A as ACPClientTransport, J as ClientTransport, K as ClientTransportOptions } from './acp-v1-BxskPsdo.js';
2
- export { A as ACPCapturedDiff, a as ACPCapturedToolCall, b as ACPProgressEvent, c as ACPProgressHandler, d as ACPSession, e as ACPSessionError, f as ACPSessionErrorKind, g as ACPSessionOptions, h as ACPSessionRunResult, i as ACPSubagentRunnerOptions, P as PermissionPolicy, m as PermissionRequest, W as WebSocketClientTransport, o as WebSocketClientTransportOptions, p as audioContent, q as defaultPermissionPolicy, r as imageContent, s as makeACPSubagentRunner, u as makePermissionPolicy, w as readOnlyPermissionPolicy, z as textContent } from './acp-subagent-runner-BAlo23L-.js';
3
- export { T as ToolTranslator } from './index-DEEYyEpu.js';
4
- import 'node:events';
5
- import '@wrongstack/core';
1
+ export * from './client/index.js';