@automatalabs/acp-agents 0.14.0 → 0.15.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.
- package/dist/acp-client.d.ts +18 -3
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +118 -7
- package/dist/client-handlers.d.ts +7 -1
- package/dist/client-handlers.d.ts.map +1 -1
- package/dist/client-handlers.js +3 -1
- package/dist/events.d.ts +24 -2
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +3 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/interactive.d.ts +7 -5
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +2 -2
- package/dist/permissions.d.ts +5 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/pool.d.ts +3 -1
- package/dist/pool.d.ts.map +1 -1
- package/dist/pool.js +2 -0
- package/dist/protocol-coverage.js +2 -2
- package/dist/runner.d.ts +7 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +10 -1
- package/package.json +1 -1
package/dist/acp-client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type ContentBlock, type AgentNotificationMethod, type AgentNotificationParamsByMethod, type AgentRequestMethod, type AgentRequestParamsByMethod, type AgentRequestResponsesByMethod, type DeleteSessionRequest, type ListSessionsRequest, type ListSessionsResponse, type PromptRequest, type PromptResponse, type RequestPermissionResponse, type SendRequestOptions, type SessionConfigOption, type SessionModeState, type SessionNotification, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@agentclientprotocol/sdk";
|
|
1
|
+
import { type CreateElicitationResponse, type ContentBlock, type AgentNotificationMethod, type AgentNotificationParamsByMethod, type AgentRequestMethod, type AgentRequestParamsByMethod, type AgentRequestResponsesByMethod, type DeleteSessionRequest, type ListSessionsRequest, type ListSessionsResponse, type PromptRequest, type PromptResponse, type RequestPermissionResponse, type SendRequestOptions, type SessionConfigOption, type SessionModeState, type SessionNotification, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { TSchema } from "typebox";
|
|
3
3
|
import { type AgentHistoryEntry, type McpServerConfig } from "@automatalabs/shared-types";
|
|
4
4
|
import type { Backend, BackendId, StructuredSource } from "./backend.js";
|
|
5
5
|
import { type NegotiatedCapabilities } from "./capabilities.js";
|
|
6
6
|
import { type AcpEventSink } from "./events.js";
|
|
7
|
-
import { type PermissionResolver, type ToolPolicy } from "./permissions.js";
|
|
7
|
+
import { type ElicitationResolver, type PermissionResolver, type ToolPolicy } from "./permissions.js";
|
|
8
8
|
import { UsageAccumulator } from "./usage.js";
|
|
9
9
|
import { type ClientHandlers } from "./client-handlers.js";
|
|
10
10
|
interface RawResultSuccess {
|
|
@@ -18,6 +18,7 @@ declare class SessionState {
|
|
|
18
18
|
readonly cwd: string;
|
|
19
19
|
readonly policy: ToolPolicy;
|
|
20
20
|
readonly permissionResolver?: PermissionResolver | undefined;
|
|
21
|
+
readonly elicitationResolver?: ElicitationResolver | undefined;
|
|
21
22
|
readonly label?: string | undefined;
|
|
22
23
|
readonly runId?: string | undefined;
|
|
23
24
|
private readonly retainSessionLog;
|
|
@@ -25,12 +26,14 @@ declare class SessionState {
|
|
|
25
26
|
readonly history: AgentHistoryEntry[];
|
|
26
27
|
readonly usage: UsageAccumulator;
|
|
27
28
|
readonly pendingPermissions: Set<(outcome: RequestPermissionResponse) => void>;
|
|
29
|
+
readonly pendingElicitations: Set<(outcome: CreateElicitationResponse) => void>;
|
|
30
|
+
readonly urlElicitationIds: Set<string>;
|
|
28
31
|
rawResultSuccess: RawResultSuccess | undefined;
|
|
29
32
|
modes: SessionModeState | null | undefined;
|
|
30
33
|
private turnStartIndex;
|
|
31
34
|
/** `label`/`runId` are carried here ONLY so the MultiplexClient can stamp them onto emitted
|
|
32
35
|
* events as context — they never affect routing or the wire request. */
|
|
33
|
-
constructor(cwd: string, policy: ToolPolicy, permissionResolver?: PermissionResolver | undefined, label?: string | undefined, runId?: string | undefined, modes?: SessionModeState | null, retainSessionLog?: boolean);
|
|
36
|
+
constructor(cwd: string, policy: ToolPolicy, permissionResolver?: PermissionResolver | undefined, elicitationResolver?: ElicitationResolver | undefined, label?: string | undefined, runId?: string | undefined, modes?: SessionModeState | null, retainSessionLog?: boolean);
|
|
34
37
|
/** Mark the start of a new turn so currentTurnText()/structured_output read only this turn.
|
|
35
38
|
* Long-lived interactive sessions can opt out of retaining old text/history because hosts
|
|
36
39
|
* stream live events and keep their own transcript; clearing here prevents dead logs from
|
|
@@ -42,6 +45,9 @@ declare class SessionState {
|
|
|
42
45
|
/** Settle every deferred permission still parked on this session. Used by release/cancel/death
|
|
43
46
|
* teardown so an interactive resolver can never strand an ACP prompt turn. */
|
|
44
47
|
settlePendingPermissions(): void;
|
|
48
|
+
/** Same teardown guarantee for elicitation/create: a parked human prompt must not survive
|
|
49
|
+
* release/cancel/death after its ACP session is gone. */
|
|
50
|
+
settlePendingElicitations(): void;
|
|
45
51
|
}
|
|
46
52
|
export interface AcpSessionOptions {
|
|
47
53
|
/** Absolute working directory for the ACP session (worktree isolation). */
|
|
@@ -52,6 +58,9 @@ export interface AcpSessionOptions {
|
|
|
52
58
|
/** Session-scoped permission resolver. When present it wins over the runner default and
|
|
53
59
|
* replaces the synchronous ToolPolicy auto-response path for this session. */
|
|
54
60
|
permissionResolver?: PermissionResolver;
|
|
61
|
+
/** Session-scoped elicitation resolver. When present it wins over the runner default for this
|
|
62
|
+
* session; initialize-time advertisement still depends on the runner-wide resolver. */
|
|
63
|
+
elicitationResolver?: ElicitationResolver;
|
|
55
64
|
signal?: AbortSignal;
|
|
56
65
|
/** Client-provided MCP servers to attach at session/new. Omitted => `[]` (the default). */
|
|
57
66
|
mcpServers?: McpServerConfig[];
|
|
@@ -83,6 +92,11 @@ export interface PooledConnectionDeps {
|
|
|
83
92
|
onEvent?: AcpEventSink;
|
|
84
93
|
/** Runner-wide permission resolver default. SessionState.permissionResolver overrides it. */
|
|
85
94
|
permissionResolver?: PermissionResolver;
|
|
95
|
+
/** Runner-wide elicitation resolver default. SessionState.elicitationResolver overrides it. */
|
|
96
|
+
elicitationResolver?: ElicitationResolver;
|
|
97
|
+
/** Initialize-time elicitation advertisement; fixed per connection, so it is driven by the
|
|
98
|
+
* runner-wide resolver rather than session-scoped responders attached later. */
|
|
99
|
+
advertiseElicitation?: boolean;
|
|
86
100
|
/** Client-side ACP fs/terminal handlers advertised once and routed by sessionId. */
|
|
87
101
|
clientHandlers?: ClientHandlers;
|
|
88
102
|
}
|
|
@@ -102,6 +116,7 @@ export declare class PooledConnection {
|
|
|
102
116
|
private readonly onDead;
|
|
103
117
|
private readonly onEvent;
|
|
104
118
|
private readonly clientHandlers;
|
|
119
|
+
private readonly advertiseElicitation;
|
|
105
120
|
/** Set true at the start of dispose() so the graceful-shutdown death is NOT reported as a crash. */
|
|
106
121
|
private disposing;
|
|
107
122
|
/** Resolves once `initialize` completed (or rejects if the process died first). */
|
package/dist/acp-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-client.d.ts","sourceRoot":"","sources":["../src/acp-client.ts"],"names":[],"mappings":"AAwBA,OAAO,
|
|
1
|
+
{"version":3,"file":"acp-client.d.ts","sourceRoot":"","sources":["../src/acp-client.ts"],"names":[],"mappings":"AAwBA,OAAO,EAYL,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAGlC,KAAK,oBAAoB,EAEzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAIzB,KAAK,aAAa,EAClB,KAAK,cAAc,EAMnB,KAAK,yBAAyB,EAG9B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EA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OAOG;YACW,mBAAmB;IAoDjC;;6EAEyE;YAC3D,iBAAiB;IAS/B,oFAAoF;IAC9E,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5C,yEAAyE;IACnE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAoB7G,2DAA2D;IAC3D,eAAe,IAAI,MAAM;IAIzB,qFAAqF;IACrF,mBAAmB,IAAI,OAAO;IAI9B,gGAAgG;IAC1F,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,6EAA6E;IACvE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAO/B"}
|
package/dist/acp-client.js
CHANGED
|
@@ -26,7 +26,7 @@ import { AGENT_METHODS, client, CLIENT_METHODS, ndJsonStream, PROTOCOL_VERSION,
|
|
|
26
26
|
import { META_KEYS, WorkflowError, WorkflowErrorCode, } from "@automatalabs/shared-types";
|
|
27
27
|
import { adaptPromptContent, describeLifecycleAdvertisement, gateCustomMeta, isSupportedProtocolVersion, negotiateCapabilities, unsupportedMcpServer, } from "./capabilities.js";
|
|
28
28
|
import { emitSessionUpdate } from "./events.js";
|
|
29
|
-
import { decidePermission } from "./permissions.js";
|
|
29
|
+
import { decidePermission, } from "./permissions.js";
|
|
30
30
|
import { UsageAccumulator } from "./usage.js";
|
|
31
31
|
import { clientCapabilitiesFor, } from "./client-handlers.js";
|
|
32
32
|
/** A benign client identity. NOT JetBrains/IntelliJ 2026.1 — that exact identity makes
|
|
@@ -57,6 +57,7 @@ class SessionState {
|
|
|
57
57
|
cwd;
|
|
58
58
|
policy;
|
|
59
59
|
permissionResolver;
|
|
60
|
+
elicitationResolver;
|
|
60
61
|
label;
|
|
61
62
|
runId;
|
|
62
63
|
retainSessionLog;
|
|
@@ -64,15 +65,18 @@ class SessionState {
|
|
|
64
65
|
history = [];
|
|
65
66
|
usage = new UsageAccumulator();
|
|
66
67
|
pendingPermissions = new Set();
|
|
68
|
+
pendingElicitations = new Set();
|
|
69
|
+
urlElicitationIds = new Set();
|
|
67
70
|
rawResultSuccess;
|
|
68
71
|
modes;
|
|
69
72
|
turnStartIndex = 0;
|
|
70
73
|
/** `label`/`runId` are carried here ONLY so the MultiplexClient can stamp them onto emitted
|
|
71
74
|
* events as context — they never affect routing or the wire request. */
|
|
72
|
-
constructor(cwd, policy, permissionResolver, label, runId, modes, retainSessionLog = true) {
|
|
75
|
+
constructor(cwd, policy, permissionResolver, elicitationResolver, label, runId, modes, retainSessionLog = true) {
|
|
73
76
|
this.cwd = cwd;
|
|
74
77
|
this.policy = policy;
|
|
75
78
|
this.permissionResolver = permissionResolver;
|
|
79
|
+
this.elicitationResolver = elicitationResolver;
|
|
76
80
|
this.label = label;
|
|
77
81
|
this.runId = runId;
|
|
78
82
|
this.retainSessionLog = retainSessionLog;
|
|
@@ -149,6 +153,12 @@ class SessionState {
|
|
|
149
153
|
for (const settle of [...this.pendingPermissions])
|
|
150
154
|
settle(cancelledPermissionResponse());
|
|
151
155
|
}
|
|
156
|
+
/** Same teardown guarantee for elicitation/create: a parked human prompt must not survive
|
|
157
|
+
* release/cancel/death after its ACP session is gone. */
|
|
158
|
+
settlePendingElicitations() {
|
|
159
|
+
for (const settle of [...this.pendingElicitations])
|
|
160
|
+
settle(cancelledElicitationResponse());
|
|
161
|
+
}
|
|
152
162
|
}
|
|
153
163
|
/** The single client-side handler set for one pooled connection (registered on the SDK's fluent
|
|
154
164
|
* client() app). It ROUTES every notification and permission request to the per-session
|
|
@@ -159,7 +169,9 @@ class MultiplexClient {
|
|
|
159
169
|
onEvent;
|
|
160
170
|
handlers;
|
|
161
171
|
permissionResolver;
|
|
172
|
+
elicitationResolver;
|
|
162
173
|
sessions = new Map();
|
|
174
|
+
urlElicitationContexts = new Map();
|
|
163
175
|
/** Recently unregistered sessions kept ONLY for the teardown window: ACP agents may
|
|
164
176
|
* legitimately release terminals (or finish fs/terminal cleanup) after this client releases
|
|
165
177
|
* the session because session/close is cancel + free resources and the Agent owns terminal
|
|
@@ -168,11 +180,12 @@ class MultiplexClient {
|
|
|
168
180
|
/** `backendId` stamps event context; `onEvent` (optional) bubbles every notification, permission
|
|
169
181
|
* request and session lifecycle change up to the runner's typed bus. `permissionResolver` is
|
|
170
182
|
* the runner-wide default; a SessionState resolver wins when present. */
|
|
171
|
-
constructor(backendId, onEvent, handlers, permissionResolver) {
|
|
183
|
+
constructor(backendId, onEvent, handlers, permissionResolver, elicitationResolver) {
|
|
172
184
|
this.backendId = backendId;
|
|
173
185
|
this.onEvent = onEvent;
|
|
174
186
|
this.handlers = handlers;
|
|
175
187
|
this.permissionResolver = permissionResolver;
|
|
188
|
+
this.elicitationResolver = elicitationResolver;
|
|
176
189
|
}
|
|
177
190
|
contextFor(sessionId, state) {
|
|
178
191
|
return { sessionId, backendId: this.backendId, label: state?.label, runId: state?.runId };
|
|
@@ -200,8 +213,11 @@ class MultiplexClient {
|
|
|
200
213
|
unregister(sessionId) {
|
|
201
214
|
const state = this.sessions.get(sessionId);
|
|
202
215
|
state?.settlePendingPermissions();
|
|
216
|
+
state?.settlePendingElicitations();
|
|
203
217
|
this.sessions.delete(sessionId);
|
|
204
218
|
if (state) {
|
|
219
|
+
for (const elicitationId of state.urlElicitationIds)
|
|
220
|
+
this.urlElicitationContexts.delete(elicitationId);
|
|
205
221
|
this.tombstones.set(sessionId, {
|
|
206
222
|
cwd: state.cwd,
|
|
207
223
|
label: state.label,
|
|
@@ -219,11 +235,19 @@ class MultiplexClient {
|
|
|
219
235
|
settlePendingPermissions(sessionId) {
|
|
220
236
|
this.sessions.get(sessionId)?.settlePendingPermissions();
|
|
221
237
|
}
|
|
238
|
+
settlePendingElicitations(sessionId) {
|
|
239
|
+
this.sessions.get(sessionId)?.settlePendingElicitations();
|
|
240
|
+
}
|
|
222
241
|
settleAllPendingPermissions() {
|
|
223
242
|
for (const state of this.sessions.values()) {
|
|
224
243
|
state.settlePendingPermissions();
|
|
225
244
|
}
|
|
226
245
|
}
|
|
246
|
+
settleAllPendingElicitations() {
|
|
247
|
+
for (const state of this.sessions.values()) {
|
|
248
|
+
state.settlePendingElicitations();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
227
251
|
requestPermission(params) {
|
|
228
252
|
const state = this.sessions.get(params.sessionId);
|
|
229
253
|
// Unknown/closed session: refuse rather than silently allow a tool we can't attribute.
|
|
@@ -271,6 +295,63 @@ class MultiplexClient {
|
|
|
271
295
|
response.catch(() => { });
|
|
272
296
|
return response;
|
|
273
297
|
}
|
|
298
|
+
requestElicitation(params) {
|
|
299
|
+
const sessionId = sessionIdFromElicitationRequest(params);
|
|
300
|
+
if (!sessionId)
|
|
301
|
+
return declinedElicitationResponse();
|
|
302
|
+
const state = this.sessions.get(sessionId);
|
|
303
|
+
const ctx = this.contextFor(sessionId, state);
|
|
304
|
+
// Unknown/closed session: decline rather than asking a human for a prompt we cannot route.
|
|
305
|
+
if (!state) {
|
|
306
|
+
const outcome = declinedElicitationResponse();
|
|
307
|
+
this.onEvent?.("elicitation_request", { ...ctx, request: params, outcome });
|
|
308
|
+
return outcome;
|
|
309
|
+
}
|
|
310
|
+
this.trackUrlElicitation(params, state, ctx);
|
|
311
|
+
const resolver = state.elicitationResolver ?? this.elicitationResolver;
|
|
312
|
+
if (resolver)
|
|
313
|
+
return this.requestElicitationViaResolver(params, state, ctx, resolver);
|
|
314
|
+
const outcome = declinedElicitationResponse();
|
|
315
|
+
this.onEvent?.("elicitation_request", { ...ctx, request: params, outcome });
|
|
316
|
+
return outcome;
|
|
317
|
+
}
|
|
318
|
+
requestElicitationViaResolver(params, state, ctx, resolver) {
|
|
319
|
+
let settled = false;
|
|
320
|
+
let settle;
|
|
321
|
+
const response = new Promise((resolve) => {
|
|
322
|
+
settle = (outcome) => {
|
|
323
|
+
if (settled)
|
|
324
|
+
return;
|
|
325
|
+
settled = true;
|
|
326
|
+
state.pendingElicitations.delete(settle);
|
|
327
|
+
this.onEvent?.("elicitation_request", { ...ctx, request: params, outcome });
|
|
328
|
+
resolve(outcome);
|
|
329
|
+
};
|
|
330
|
+
state.pendingElicitations.add(settle);
|
|
331
|
+
this.onEvent?.("elicitation_pending", { ...ctx, request: params });
|
|
332
|
+
try {
|
|
333
|
+
Promise.resolve(resolver(params, ctx)).then((outcome) => {
|
|
334
|
+
settle(outcome);
|
|
335
|
+
}, () => {
|
|
336
|
+
// Resolver failure is observable as the FINAL cancel outcome; no extra error event is
|
|
337
|
+
// needed, and the prompt turn continues instead of hanging behind a rejected promise.
|
|
338
|
+
settle(cancelledElicitationResponse());
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
settle(cancelledElicitationResponse());
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
response.catch(() => { });
|
|
346
|
+
return response;
|
|
347
|
+
}
|
|
348
|
+
trackUrlElicitation(params, state, ctx) {
|
|
349
|
+
const elicitationId = urlElicitationId(params);
|
|
350
|
+
if (!elicitationId)
|
|
351
|
+
return;
|
|
352
|
+
state.urlElicitationIds.add(elicitationId);
|
|
353
|
+
this.urlElicitationContexts.set(elicitationId, ctx);
|
|
354
|
+
}
|
|
274
355
|
readTextFile(params) {
|
|
275
356
|
return this.dispatch(params, CLIENT_METHODS.fs_read_text_file, this.handlers?.fs?.readTextFile);
|
|
276
357
|
}
|
|
@@ -317,6 +398,14 @@ class MultiplexClient {
|
|
|
317
398
|
message: rawMessage,
|
|
318
399
|
});
|
|
319
400
|
}
|
|
401
|
+
elicitationComplete(params) {
|
|
402
|
+
const ctx = this.urlElicitationContexts.get(params.elicitationId);
|
|
403
|
+
if (!ctx)
|
|
404
|
+
return;
|
|
405
|
+
this.urlElicitationContexts.delete(params.elicitationId);
|
|
406
|
+
this.sessions.get(ctx.sessionId)?.urlElicitationIds.delete(params.elicitationId);
|
|
407
|
+
this.onEvent?.("elicitation_complete", { ...ctx, notification: params });
|
|
408
|
+
}
|
|
320
409
|
}
|
|
321
410
|
function unknownSession(sessionId) {
|
|
322
411
|
return RequestError.invalidParams({ sessionId }, `unknown session: ${sessionId}`);
|
|
@@ -324,6 +413,20 @@ function unknownSession(sessionId) {
|
|
|
324
413
|
function cancelledPermissionResponse() {
|
|
325
414
|
return { outcome: { outcome: "cancelled" } };
|
|
326
415
|
}
|
|
416
|
+
function declinedElicitationResponse() {
|
|
417
|
+
return { action: "decline" };
|
|
418
|
+
}
|
|
419
|
+
function cancelledElicitationResponse() {
|
|
420
|
+
return { action: "cancel" };
|
|
421
|
+
}
|
|
422
|
+
function sessionIdFromElicitationRequest(params) {
|
|
423
|
+
return "sessionId" in params && typeof params.sessionId === "string" ? params.sessionId : undefined;
|
|
424
|
+
}
|
|
425
|
+
function urlElicitationId(params) {
|
|
426
|
+
return params.mode === "url" && "elicitationId" in params && typeof params.elicitationId === "string"
|
|
427
|
+
? params.elicitationId
|
|
428
|
+
: undefined;
|
|
429
|
+
}
|
|
327
430
|
function methodNotAdvertised(method) {
|
|
328
431
|
return new RequestError(-32601, `${method} was not advertised by this client`, { method });
|
|
329
432
|
}
|
|
@@ -411,6 +514,7 @@ export class PooledConnection {
|
|
|
411
514
|
onDead;
|
|
412
515
|
onEvent;
|
|
413
516
|
clientHandlers;
|
|
517
|
+
advertiseElicitation;
|
|
414
518
|
/** Set true at the start of dispose() so the graceful-shutdown death is NOT reported as a crash. */
|
|
415
519
|
disposing = false;
|
|
416
520
|
/** Resolves once `initialize` completed (or rejects if the process died first). */
|
|
@@ -430,7 +534,8 @@ export class PooledConnection {
|
|
|
430
534
|
this.onDead = deps.onDead;
|
|
431
535
|
this.onEvent = deps.onEvent;
|
|
432
536
|
this.clientHandlers = deps.clientHandlers;
|
|
433
|
-
this.
|
|
537
|
+
this.advertiseElicitation = deps.advertiseElicitation ?? Boolean(deps.elicitationResolver);
|
|
538
|
+
this.client = new MultiplexClient(this.backendId, this.onEvent, deps.clientHandlers, deps.permissionResolver, deps.elicitationResolver);
|
|
434
539
|
const { command, args, env } = backend.spawnConfig();
|
|
435
540
|
// NOTE: deliberately NO `cwd` here. cwd is per-SESSION (session/new), so one pooled process
|
|
436
541
|
// serves runs in different worktrees without losing isolation.
|
|
@@ -468,7 +573,9 @@ export class PooledConnection {
|
|
|
468
573
|
this.connection = client({ name: CLIENT_INFO.name })
|
|
469
574
|
.onNotification(CLIENT_METHODS.session_update, ({ params }) => this.client.sessionUpdate(params))
|
|
470
575
|
.onNotification(CLAUDE_RAW_MESSAGE_METHOD, (params) => (params ?? {}), ({ params }) => this.client.extNotification(CLAUDE_RAW_MESSAGE_METHOD, params))
|
|
576
|
+
.onNotification(CLIENT_METHODS.elicitation_complete, ({ params }) => this.client.elicitationComplete(params))
|
|
471
577
|
.onRequest(CLIENT_METHODS.session_request_permission, ({ params }) => this.client.requestPermission(params))
|
|
578
|
+
.onRequest(CLIENT_METHODS.elicitation_create, ({ params }) => this.client.requestElicitation(params))
|
|
472
579
|
.onRequest(CLIENT_METHODS.fs_read_text_file, ({ params }) => this.client.readTextFile(params))
|
|
473
580
|
.onRequest(CLIENT_METHODS.fs_write_text_file, ({ params }) => this.client.writeTextFile(params))
|
|
474
581
|
.onRequest(CLIENT_METHODS.terminal_create, ({ params }) => this.client.createTerminal(params))
|
|
@@ -550,6 +657,7 @@ export class PooledConnection {
|
|
|
550
657
|
this.deathError = error;
|
|
551
658
|
this.resolveDead();
|
|
552
659
|
this.client.settleAllPendingPermissions();
|
|
660
|
+
this.client.settleAllPendingElicitations();
|
|
553
661
|
// A crash (not a graceful dispose) is worth surfacing for observability; the engine still
|
|
554
662
|
// handles it by retrying the run on a fresh process. Best-effort, after death is recorded.
|
|
555
663
|
if (this.onEvent && !this.disposing) {
|
|
@@ -593,7 +701,9 @@ export class PooledConnection {
|
|
|
593
701
|
protocolVersion: PROTOCOL_VERSION,
|
|
594
702
|
// Truthful advertisement: computed from the consumer-provided handlers registered on
|
|
595
703
|
// this runner. Omitted flags are unsupported; false flags are never sent deliberately.
|
|
596
|
-
clientCapabilities: clientCapabilitiesFor(this.clientHandlers
|
|
704
|
+
clientCapabilities: clientCapabilitiesFor(this.clientHandlers, {
|
|
705
|
+
elicitation: this.advertiseElicitation,
|
|
706
|
+
}),
|
|
597
707
|
clientInfo: { ...CLIENT_INFO },
|
|
598
708
|
})),
|
|
599
709
|
deadline,
|
|
@@ -644,7 +754,7 @@ export class PooledConnection {
|
|
|
644
754
|
...(meta ? { _meta: meta } : {}),
|
|
645
755
|
};
|
|
646
756
|
const response = await this.race(this.connection.agent.request(AGENT_METHODS.session_new, request));
|
|
647
|
-
const state = new SessionState(opts.cwd, opts.policy, opts.permissionResolver, opts.label, opts.runId, response.modes, opts.retainSessionLog ?? true);
|
|
757
|
+
const state = new SessionState(opts.cwd, opts.policy, opts.permissionResolver, opts.elicitationResolver, opts.label, opts.runId, response.modes, opts.retainSessionLog ?? true);
|
|
648
758
|
this.client.register(response.sessionId, state);
|
|
649
759
|
return new SessionHandle(this, response.sessionId, state, response.configOptions ?? [], opts);
|
|
650
760
|
}
|
|
@@ -671,7 +781,7 @@ export class PooledConnection {
|
|
|
671
781
|
async reattachSession(method, sessionId, opts) {
|
|
672
782
|
this._activeSessions += 1;
|
|
673
783
|
let registered = false;
|
|
674
|
-
const state = new SessionState(opts.cwd, opts.policy, opts.permissionResolver, opts.label, opts.runId, undefined, opts.retainSessionLog ?? true);
|
|
784
|
+
const state = new SessionState(opts.cwd, opts.policy, opts.permissionResolver, opts.elicitationResolver, opts.label, opts.runId, undefined, opts.retainSessionLog ?? true);
|
|
675
785
|
try {
|
|
676
786
|
await this.ready;
|
|
677
787
|
this.assertLifecycleSupported(method, opts.label);
|
|
@@ -740,6 +850,7 @@ export class PooledConnection {
|
|
|
740
850
|
/** Best-effort ACP cancel for one session (wired to opts.signal). The PROCESS stays pooled. */
|
|
741
851
|
async cancelSession(sessionId) {
|
|
742
852
|
this.client.settlePendingPermissions(sessionId);
|
|
853
|
+
this.client.settlePendingElicitations(sessionId);
|
|
743
854
|
if (!this._alive)
|
|
744
855
|
return;
|
|
745
856
|
try {
|
|
@@ -20,11 +20,17 @@ export interface ClientHandlers {
|
|
|
20
20
|
fs?: FsHandlers;
|
|
21
21
|
terminal?: TerminalHandlers;
|
|
22
22
|
}
|
|
23
|
+
export interface ClientCapabilityOptions {
|
|
24
|
+
/** Advertise unstable ACP elicitation support only when this connection has a runner-wide
|
|
25
|
+
* responder. Initialize capabilities are fixed for the connection lifetime, so a later
|
|
26
|
+
* session-scoped responder alone cannot truthfully light this up. */
|
|
27
|
+
elicitation?: boolean;
|
|
28
|
+
}
|
|
23
29
|
/** The client capability advertisement: fs/terminal derived solely from registered consumer
|
|
24
30
|
* handlers, plus the capabilities this client supports natively regardless of handlers —
|
|
25
31
|
* boolean session config options (SessionHandle drives the catalog programmatically and
|
|
26
32
|
* handles `type: "boolean"` entries, e.g. codex-acp's Fast-mode toggle). */
|
|
27
|
-
export declare function clientCapabilitiesFor(handlers: ClientHandlers | undefined): ClientCapabilities;
|
|
33
|
+
export declare function clientCapabilitiesFor(handlers: ClientHandlers | undefined, options?: ClientCapabilityOptions): ClientCapabilities;
|
|
28
34
|
/** Fail-fast validation for JavaScript consumers bypassing the TerminalHandlers type. */
|
|
29
35
|
export declare function validateClientHandlers(handlers: ClientHandlers | undefined): void;
|
|
30
36
|
//# sourceMappingURL=client-handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-handlers.d.ts","sourceRoot":"","sources":["../src/client-handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACtB,MAA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AAsB,CAAC,GAAG,sBAAsB,CAAC;IAC5D,mBAAmB,CACjB,MAAM,EAAE,0BAA0B,EAClC,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;IACtE,YAAY,CACV,MAAM,EAAE,mBAAmB,EAC3B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,GAAG,oBAAoB,GAAG,IAAI,CAAC;IACtE,eAAe,CACb,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,GAAG,uBAAuB,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC;;0EAEsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAUD;;;6EAG6E;AAC7E,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,OAAO,GAAE,uBAA4B,GACpC,kBAAkB,CAapB;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAMjF"}
|
package/dist/client-handlers.js
CHANGED
|
@@ -9,8 +9,10 @@ const TERMINAL_HANDLER_METHODS = [
|
|
|
9
9
|
* handlers, plus the capabilities this client supports natively regardless of handlers —
|
|
10
10
|
* boolean session config options (SessionHandle drives the catalog programmatically and
|
|
11
11
|
* handles `type: "boolean"` entries, e.g. codex-acp's Fast-mode toggle). */
|
|
12
|
-
export function clientCapabilitiesFor(handlers) {
|
|
12
|
+
export function clientCapabilitiesFor(handlers, options = {}) {
|
|
13
13
|
const capabilities = { session: { configOptions: { boolean: {} } } };
|
|
14
|
+
if (options.elicitation)
|
|
15
|
+
capabilities.elicitation = { form: {}, url: {} };
|
|
14
16
|
if (!handlers)
|
|
15
17
|
return capabilities;
|
|
16
18
|
const fs = handlers.fs;
|
package/dist/events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestPermissionRequest, RequestPermissionResponse, SessionNotification } from "@agentclientprotocol/sdk";
|
|
1
|
+
import type { CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { BackendId } from "./backend.js";
|
|
3
3
|
/** The ACP session/update discriminated union (every real-time update an agent can stream). */
|
|
4
4
|
export type AcpSessionUpdate = SessionNotification["update"];
|
|
@@ -36,6 +36,22 @@ export interface AcpPermissionEvent extends AcpEventContext {
|
|
|
36
36
|
request: RequestPermissionRequest;
|
|
37
37
|
outcome: RequestPermissionResponse;
|
|
38
38
|
}
|
|
39
|
+
/** An elicitation/create request parked on an async resolver. Resolver path only; the final
|
|
40
|
+
* response is reported by elicitation_request exactly once. */
|
|
41
|
+
export interface AcpElicitationPendingEvent extends AcpEventContext {
|
|
42
|
+
request: CreateElicitationRequest;
|
|
43
|
+
}
|
|
44
|
+
/** An elicitation/create request the runner answered, paired with the FINAL response returned
|
|
45
|
+
* to the agent. Fires exactly once for resolver-backed and auto-declined requests. */
|
|
46
|
+
export interface AcpElicitationEvent extends AcpEventContext {
|
|
47
|
+
request: CreateElicitationRequest;
|
|
48
|
+
outcome: CreateElicitationResponse;
|
|
49
|
+
}
|
|
50
|
+
/** Notification that a URL-based elicitation completed, correlated back to the session context
|
|
51
|
+
* captured when its elicitation/create request arrived. */
|
|
52
|
+
export interface AcpElicitationCompleteEvent extends AcpEventContext {
|
|
53
|
+
notification: CompleteElicitationNotification;
|
|
54
|
+
}
|
|
39
55
|
/** A vendor extension notification (e.g. Claude `_claude/sdkMessage`) routed to a session. */
|
|
40
56
|
export interface AcpRawMessageEvent extends AcpEventContext {
|
|
41
57
|
method: string;
|
|
@@ -61,6 +77,12 @@ export type AcpRunnerEventMap = AcpSessionUpdateEvents & {
|
|
|
61
77
|
permission_pending: AcpPermissionPendingEvent;
|
|
62
78
|
/** A permission request the runner answered, with the FINAL decision returned. */
|
|
63
79
|
permission_request: AcpPermissionEvent;
|
|
80
|
+
/** An elicitation/create request parked on an async resolver; resolver path only. */
|
|
81
|
+
elicitation_pending: AcpElicitationPendingEvent;
|
|
82
|
+
/** An elicitation/create request the runner answered, with the FINAL response returned. */
|
|
83
|
+
elicitation_request: AcpElicitationEvent;
|
|
84
|
+
/** An elicitation/complete notification correlated to the originating session context. */
|
|
85
|
+
elicitation_complete: AcpElicitationCompleteEvent;
|
|
64
86
|
/** A vendor extension notification arrived for a session. */
|
|
65
87
|
raw_message: AcpRawMessageEvent;
|
|
66
88
|
/** A new session was opened on a pooled connection. */
|
|
@@ -74,7 +96,7 @@ export type AcpEventName = keyof AcpRunnerEventMap;
|
|
|
74
96
|
export type AcpEventListener<K extends AcpEventName> = (event: AcpRunnerEventMap[K]) => void;
|
|
75
97
|
/** Non-session/update runner events. Kept exact by the type-level guard below so a new
|
|
76
98
|
* cross-cutting event cannot be added to AcpRunnerEventMap without updating forwarders. */
|
|
77
|
-
export declare const ACP_CROSS_CUTTING_EVENT_NAMES: readonly ["permission_pending", "permission_request", "raw_message", "session_open", "session_close", "backend_error"];
|
|
99
|
+
export declare const ACP_CROSS_CUTTING_EVENT_NAMES: readonly ["permission_pending", "permission_request", "elicitation_pending", "elicitation_request", "elicitation_complete", "raw_message", "session_open", "session_close", "backend_error"];
|
|
78
100
|
/** Internal emit boundary handed from the runner down through the pool to each connection. */
|
|
79
101
|
export interface AcpEventSink {
|
|
80
102
|
<K extends AcpEventName>(name: K, event: AcpRunnerEventMap[K]): void;
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAWA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AQ,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAOpF,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,QAAQ,GAAG,IAAI;IAK/C,aAAa,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,MAAM;IAI3C,IAAI,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI;CAYlE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAI1G"}
|
package/dist/events.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { AcpRunnerOptions, DeleteSessionOptions, ListSessionsOptions, Reatt
|
|
|
3
3
|
export { InteractiveSession } from "./interactive.js";
|
|
4
4
|
export type { InteractiveSessionOptions, InteractiveTurn } from "./interactive.js";
|
|
5
5
|
export { AGENT_METHODS, CLIENT_METHODS } from "@agentclientprotocol/sdk";
|
|
6
|
-
export type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, DeleteSessionRequest, DeleteSessionResponse, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionMode, SessionModeState, SessionInfo, SendRequestOptions, } from "@agentclientprotocol/sdk";
|
|
6
|
+
export type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, DeleteSessionRequest, DeleteSessionResponse, ElicitationAcceptAction, ElicitationCapabilities, ElicitationContentValue, ElicitationFormCapabilities, ElicitationFormMode, ElicitationId, ElicitationPropertySchema, ElicitationRequestScope, ElicitationSchema, ElicitationSchemaType, ElicitationSessionScope, ElicitationUrlCapabilities, ElicitationUrlMode, ListSessionsRequest, ListSessionsResponse, LoadSessionRequest, LoadSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SessionMode, SessionModeState, SessionInfo, SendRequestOptions, } from "@agentclientprotocol/sdk";
|
|
7
7
|
export { BACKENDS_ENV, registryWithRunBackends, resolveBackendRegistry } from "./registry.js";
|
|
8
8
|
export type { BackendRegistry, CustomBackendConfig, RegisteredBackend } from "./registry.js";
|
|
9
9
|
export { PooledConnection, SessionHandle } from "./acp-client.js";
|
|
@@ -15,15 +15,15 @@ export type { NegotiatedCapabilities } from "./capabilities.js";
|
|
|
15
15
|
export { AcpAgentPool, resolvePoolSize } from "./pool.js";
|
|
16
16
|
export type { AcpPoolOptions, AcpPoolDeps } from "./pool.js";
|
|
17
17
|
export { clientCapabilitiesFor } from "./client-handlers.js";
|
|
18
|
-
export type { AcpSessionContext, ClientHandlers, FsHandlers, TerminalHandlers } from "./client-handlers.js";
|
|
18
|
+
export type { AcpSessionContext, ClientCapabilityOptions, ClientHandlers, FsHandlers, TerminalHandlers, } from "./client-handlers.js";
|
|
19
19
|
export { ACP_CROSS_CUTTING_EVENT_NAMES, TypedEventEmitter, emitSessionUpdate } from "./events.js";
|
|
20
|
-
export type { AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext, AcpEventSink, AcpSessionUpdate, AcpUpdateKind, AcpPermissionPendingEvent, AcpPermissionEvent, AcpRawMessageEvent, AcpBackendErrorEvent, } from "./events.js";
|
|
20
|
+
export type { AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext, AcpEventSink, AcpSessionUpdate, AcpUpdateKind, AcpElicitationCompleteEvent, AcpElicitationEvent, AcpElicitationPendingEvent, AcpPermissionPendingEvent, AcpPermissionEvent, AcpRawMessageEvent, AcpBackendErrorEvent, } from "./events.js";
|
|
21
21
|
export type { Backend, BackendId, BuiltinBackendId, SessionMetaInputs, SpawnConfig, StructuredSource, } from "./backend.js";
|
|
22
22
|
export { ClaudeBackend } from "./backends/claude.js";
|
|
23
23
|
export { CodexBackend } from "./backends/codex.js";
|
|
24
24
|
export { CustomAcpBackend } from "./backends/custom.js";
|
|
25
25
|
export { decidePermission } from "./permissions.js";
|
|
26
|
-
export type { PermissionResolver, ToolPolicy } from "./permissions.js";
|
|
26
|
+
export type { ElicitationResolver, PermissionResolver, ToolPolicy } from "./permissions.js";
|
|
27
27
|
export { UsageAccumulator } from "./usage.js";
|
|
28
28
|
export { toJsonSchema, toStrictJsonSchema } from "./schema-strict.js";
|
|
29
29
|
export { extractValidated, findJsonBlock, parseFinalJson, resolveStructuredOutput, validateValue, } from "./structured-output.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7E,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACzE,YAAY,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,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jB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClG,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/interactive.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ import type { Backend, BackendId } from "./backend.js";
|
|
|
5
5
|
import type { NegotiatedCapabilities } from "./capabilities.js";
|
|
6
6
|
import type { PooledConnection, SessionHandle } from "./acp-client.js";
|
|
7
7
|
import type { AcpEventListener, AcpEventName } from "./events.js";
|
|
8
|
-
import type { PermissionResolver } from "./permissions.js";
|
|
8
|
+
import type { ElicitationResolver, PermissionResolver } from "./permissions.js";
|
|
9
9
|
/** Options for AcpAgentRunner.openSession(): backend selection and session/new inputs for one
|
|
10
10
|
* held-open interactive ACP session. `cwd` is required and absolute; unlike run(), there is no
|
|
11
11
|
* default to process.cwd() because the session can span many turns. The session-scoped
|
|
12
|
-
* permission
|
|
13
|
-
* when no resolver is present. */
|
|
12
|
+
* permission/elicitation resolvers win over the runner-wide defaults; tool allow/deny policy is
|
|
13
|
+
* used only when no permission resolver is present. */
|
|
14
14
|
export interface InteractiveSessionOptions {
|
|
15
15
|
/** Model spec (`provider/modelId`, bare model id, or registered custom backend route). */
|
|
16
16
|
model?: string;
|
|
@@ -26,6 +26,8 @@ export interface InteractiveSessionOptions {
|
|
|
26
26
|
disallowedToolNames?: string[];
|
|
27
27
|
/** Session-scoped permission resolver; overrides the runner-wide resolver for this session. */
|
|
28
28
|
onPermissionRequest?: PermissionResolver;
|
|
29
|
+
/** Session-scoped elicitation resolver; overrides the runner-wide resolver for this session. */
|
|
30
|
+
onElicitation?: ElicitationResolver;
|
|
29
31
|
/** The actually-resolved concrete model id (display/telemetry). */
|
|
30
32
|
onModelResolved?: RunOptions["onModelResolved"];
|
|
31
33
|
/** A requested model/tier spec that was not found and fell back to the session default. */
|
|
@@ -119,8 +121,8 @@ export declare class InteractiveSession {
|
|
|
119
121
|
* explicitly; use `session.sessionId` so the wire call targets this session. */
|
|
120
122
|
notify<Method extends AgentNotificationMethod>(method: Method, params: AgentNotificationParamsByMethod[Method]): Promise<void>;
|
|
121
123
|
notify<Params = unknown>(method: string, params?: Params): Promise<void>;
|
|
122
|
-
/** Best-effort ACP session/cancel for the active turn. Pending permission
|
|
123
|
-
* settled as cancelled by the SessionHandle/PooledConnection cancel path. */
|
|
124
|
+
/** Best-effort ACP session/cancel for the active turn. Pending permission/elicitation
|
|
125
|
+
* resolvers are settled as cancelled by the SessionHandle/PooledConnection cancel path. */
|
|
124
126
|
cancel(): Promise<void>;
|
|
125
127
|
/** Subscribe to runner events for THIS ACP session only. Events from other one-shot or
|
|
126
128
|
* interactive sessions on the same runner are filtered out by sessionId. The returned
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAC7B,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAC7B,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,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,OAAO,CAAC,QAAQ,CAAC;IAMpB,oGAAoG;IAC9F,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C;qFACiF;IACjF,MAAM,CAAC,MAAM,SAAS,uBAAuB,EAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,+BAA+B,CAAC,MAAM,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC;IAChB,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;gGAC4F;IACtF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B;;oGAEgG;IAChG,EAAE,CAAC,CAAC,SAAS,YAAY,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAiB9E;4FACwF;IACxF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAKV,SAAS;IAkBvB,OAAO,CAAC,mBAAmB;CAK5B"}
|
package/dist/interactive.js
CHANGED
|
@@ -104,8 +104,8 @@ export class InteractiveSession {
|
|
|
104
104
|
throw new Error("InteractiveSession has been released");
|
|
105
105
|
await this.connection.notify(method, params);
|
|
106
106
|
}
|
|
107
|
-
/** Best-effort ACP session/cancel for the active turn. Pending permission
|
|
108
|
-
* settled as cancelled by the SessionHandle/PooledConnection cancel path. */
|
|
107
|
+
/** Best-effort ACP session/cancel for the active turn. Pending permission/elicitation
|
|
108
|
+
* resolvers are settled as cancelled by the SessionHandle/PooledConnection cancel path. */
|
|
109
109
|
async cancel() {
|
|
110
110
|
if (this.releasePromise)
|
|
111
111
|
return;
|
package/dist/permissions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestPermissionRequest, RequestPermissionResponse } from "@agentclientprotocol/sdk";
|
|
1
|
+
import type { CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { AcpEventContext } from "./events.js";
|
|
3
3
|
/** Async human-in-the-loop decider for ACP permission requests. When present, it REPLACES the
|
|
4
4
|
* synchronous ToolPolicy path for the sessions it applies to: the agent turn parks until this
|
|
@@ -8,6 +8,10 @@ import type { AcpEventContext } from "./events.js";
|
|
|
8
8
|
* cancelled via session/cancel, or its connection dies, so teardown can never leave an agent
|
|
9
9
|
* turn hung behind an unanswered permission prompt. */
|
|
10
10
|
export type PermissionResolver = (params: RequestPermissionRequest, ctx: AcpEventContext) => Promise<RequestPermissionResponse> | RequestPermissionResponse;
|
|
11
|
+
/** Async human-in-the-loop responder for ACP elicitation/create. ACP marks elicitation
|
|
12
|
+
* UNSTABLE/@experimental; this library deliberately exposes the SDK request/response types
|
|
13
|
+
* directly so regular SDK bumps and wire tests catch drift instead of freezing a local copy. */
|
|
14
|
+
export type ElicitationResolver = (request: CreateElicitationRequest, context: AcpEventContext) => Promise<CreateElicitationResponse> | CreateElicitationResponse;
|
|
11
15
|
export interface ToolPolicy {
|
|
12
16
|
/** Allow-list (agentType `tools`). When non-empty, a tool that matches NOTHING is denied. */
|
|
13
17
|
allow?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAGzB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;wDAMwD;AACxD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,wBAAwB,EAChC,GAAG,EAAE,eAAe,KACjB,OAAO,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AAEpE;;iGAEiG;AACjG,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AAEpE,MAAM,WAAW,UAAU;IACzB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;sGAEkG;IAClG,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAKD,iFAAiF;AACjF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,wBAAwB,EACjC,MAAM,EAAE,UAAU,GACjB,yBAAyB,CAsC3B"}
|
package/dist/pool.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Backend } from "./backend.js";
|
|
|
2
2
|
import { SessionHandle, type AcpSessionOptions } from "./acp-client.js";
|
|
3
3
|
import { type ClientHandlers } from "./client-handlers.js";
|
|
4
4
|
import type { AcpEventSink } from "./events.js";
|
|
5
|
-
import type { PermissionResolver } from "./permissions.js";
|
|
5
|
+
import type { ElicitationResolver, PermissionResolver } from "./permissions.js";
|
|
6
6
|
export interface AcpPoolOptions {
|
|
7
7
|
/** Long-lived processes to keep PER backend. Default 1; falls back to AGENTPRISM_ACP_POOL_SIZE. */
|
|
8
8
|
size?: number;
|
|
@@ -14,6 +14,8 @@ export interface AcpPoolOptions {
|
|
|
14
14
|
export interface AcpPoolDeps {
|
|
15
15
|
onEvent?: AcpEventSink;
|
|
16
16
|
permissionResolver?: PermissionResolver;
|
|
17
|
+
elicitationResolver?: ElicitationResolver;
|
|
18
|
+
advertiseElicitation?: boolean;
|
|
17
19
|
}
|
|
18
20
|
/** Resolve the per-backend pool size: explicit option wins, else env, else 1. Clamped to >= 1. */
|
|
19
21
|
export declare function resolvePoolSize(option?: number): number;
|
package/dist/pool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,cAAc,CAAC;AACvD,OAAO,EAAoB,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,cAAc,CAAC;AACvD,OAAO,EAAoB,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKhF,MAAM,WAAW,cAAc;IAC7B,mGAAmG;IACnG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;6FAC6F;AAC7F,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED,qBAAa,YAAY;IAUrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IATvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4C;IACtE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAS;gBAGvB,OAAO,GAAE,cAAmB,EACX,IAAI,GAAE,WAAgB;IAOzC,8FAA8F;IACxF,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAMhF;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,cAAc;IAStB,+DAA+D;IAC/D,OAAO,CAAC,IAAI;IAOZ,iEAAiE;IAC3D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAMtB,gGAAgG;IAChG,OAAO,CAAC,WAAW;CAGpB"}
|
package/dist/pool.js
CHANGED
|
@@ -56,6 +56,8 @@ export class AcpAgentPool {
|
|
|
56
56
|
onDead: (dead) => this.drop(key, dead),
|
|
57
57
|
onEvent: this.deps.onEvent,
|
|
58
58
|
permissionResolver: this.deps.permissionResolver,
|
|
59
|
+
elicitationResolver: this.deps.elicitationResolver,
|
|
60
|
+
advertiseElicitation: this.deps.advertiseElicitation,
|
|
59
61
|
clientHandlers: this.clientHandlers,
|
|
60
62
|
});
|
|
61
63
|
connections.push(connection);
|
|
@@ -14,8 +14,8 @@ export const CLIENT_METHOD_COVERAGE = {
|
|
|
14
14
|
[CLIENT_METHODS.mcp_connect]: "pending",
|
|
15
15
|
[CLIENT_METHODS.mcp_message]: "pending",
|
|
16
16
|
[CLIENT_METHODS.mcp_disconnect]: "pending",
|
|
17
|
-
[CLIENT_METHODS.elicitation_create]: "
|
|
18
|
-
[CLIENT_METHODS.elicitation_complete]: "
|
|
17
|
+
[CLIENT_METHODS.elicitation_create]: "served",
|
|
18
|
+
[CLIENT_METHODS.elicitation_complete]: "served",
|
|
19
19
|
};
|
|
20
20
|
export const AGENT_METHOD_COVERAGE = {
|
|
21
21
|
[AGENT_METHODS.initialize]: "driven",
|
package/dist/runner.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type AcpEventListener, type AcpEventName } from "./events.js";
|
|
|
6
6
|
import type { Backend } from "./backend.js";
|
|
7
7
|
import { InteractiveSession, type InteractiveSessionOptions } from "./interactive.js";
|
|
8
8
|
import { type BackendRegistry, type CustomBackendConfig } from "./registry.js";
|
|
9
|
-
import type { PermissionResolver } from "./permissions.js";
|
|
9
|
+
import type { ElicitationResolver, PermissionResolver } from "./permissions.js";
|
|
10
10
|
interface LifecycleRoutingOptions {
|
|
11
11
|
/** Model spec used only to select the backend process. */
|
|
12
12
|
model?: string;
|
|
@@ -49,6 +49,9 @@ export interface AcpRunnerOptions extends AcpPoolOptions {
|
|
|
49
49
|
/** Runner-wide human-in-the-loop permission resolver. When set, it replaces ToolPolicy
|
|
50
50
|
* auto-decisions for every session that does not provide its own resolver. */
|
|
51
51
|
onPermissionRequest?: PermissionResolver;
|
|
52
|
+
/** Runner-wide ACP elicitation responder. When set, initialize advertises unstable
|
|
53
|
+
* elicitation form/url support on every connection; sessions may override the resolver. */
|
|
54
|
+
onElicitation?: ElicitationResolver;
|
|
52
55
|
}
|
|
53
56
|
export declare class AcpAgentRunner implements AgentRunner {
|
|
54
57
|
private readonly pool;
|
|
@@ -63,6 +66,7 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
63
66
|
* so dedicated interactive connections must receive the SAME deps the pool receives. */
|
|
64
67
|
private readonly clientHandlers;
|
|
65
68
|
private readonly permissionResolver;
|
|
69
|
+
private readonly elicitationResolver;
|
|
66
70
|
/** Held-open interactive sessions own dedicated ACP processes outside the pool. The runner
|
|
67
71
|
* tracks their connections so dispose() can release them and the process-exit hook can
|
|
68
72
|
* synchronously kill any dedicated children if the host exits without release(). */
|
|
@@ -74,7 +78,8 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
74
78
|
/**
|
|
75
79
|
* Listen in on the live ACP stream. `name` is an ACP `sessionUpdate` discriminant
|
|
76
80
|
* ("agent_message_chunk", "tool_call", "usage_update", …) or one of the cross-cutting events
|
|
77
|
-
* ("session_update" catch-all, "permission_pending", "permission_request",
|
|
81
|
+
* ("session_update" catch-all, "permission_pending", "permission_request",
|
|
82
|
+
* "elicitation_pending", "elicitation_request", "elicitation_complete", "raw_message",
|
|
78
83
|
* "session_open", "session_close", "backend_error"). The listener is typed to the event.
|
|
79
84
|
* Returns an unsubscribe thunk. A pooled runner multiplexes many concurrent runs, so each
|
|
80
85
|
* event carries `{ sessionId, backendId, label?, runId? }` for filtering. Listeners are
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAmBA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAGV,oBAAoB,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAGlB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAItF,OAAO,EAGL,KAAK,eAAe,EAC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IAWjC;kGAC8F;IAC9F,OAAO,CAAC,cAAc;IAmCtB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAMtB,gGAAgG;IAChG,OAAO,CAAC,WAAW;CAGpB;AAED;;;qDAGqD;AACrD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAE1E;AAsDD;;;;oCAIoC;AACpC,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAM1G"}
|
package/dist/runner.js
CHANGED
|
@@ -42,6 +42,7 @@ export class AcpAgentRunner {
|
|
|
42
42
|
* so dedicated interactive connections must receive the SAME deps the pool receives. */
|
|
43
43
|
clientHandlers;
|
|
44
44
|
permissionResolver;
|
|
45
|
+
elicitationResolver;
|
|
45
46
|
/** Held-open interactive sessions own dedicated ACP processes outside the pool. The runner
|
|
46
47
|
* tracks their connections so dispose() can release them and the process-exit hook can
|
|
47
48
|
* synchronously kill any dedicated children if the host exits without release(). */
|
|
@@ -52,16 +53,20 @@ export class AcpAgentRunner {
|
|
|
52
53
|
constructor(options = {}) {
|
|
53
54
|
this.clientHandlers = options.clientHandlers;
|
|
54
55
|
this.permissionResolver = options.onPermissionRequest;
|
|
56
|
+
this.elicitationResolver = options.onElicitation;
|
|
55
57
|
this.pool = new AcpAgentPool(options, {
|
|
56
58
|
onEvent: this.emitEvent,
|
|
57
59
|
permissionResolver: options.onPermissionRequest,
|
|
60
|
+
elicitationResolver: options.onElicitation,
|
|
61
|
+
advertiseElicitation: Boolean(options.onElicitation),
|
|
58
62
|
});
|
|
59
63
|
this.backends = resolveBackendRegistry(options.backends);
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Listen in on the live ACP stream. `name` is an ACP `sessionUpdate` discriminant
|
|
63
67
|
* ("agent_message_chunk", "tool_call", "usage_update", …) or one of the cross-cutting events
|
|
64
|
-
* ("session_update" catch-all, "permission_pending", "permission_request",
|
|
68
|
+
* ("session_update" catch-all, "permission_pending", "permission_request",
|
|
69
|
+
* "elicitation_pending", "elicitation_request", "elicitation_complete", "raw_message",
|
|
65
70
|
* "session_open", "session_close", "backend_error"). The listener is typed to the event.
|
|
66
71
|
* Returns an unsubscribe thunk. A pooled runner multiplexes many concurrent runs, so each
|
|
67
72
|
* event carries `{ sessionId, backendId, label?, runId? }` for filtering. Listeners are
|
|
@@ -272,6 +277,7 @@ export class AcpAgentRunner {
|
|
|
272
277
|
schema: undefined,
|
|
273
278
|
registry: this.backends,
|
|
274
279
|
permissionResolver: opts.permissionResolver ?? opts.onPermissionRequest,
|
|
280
|
+
elicitationResolver: opts.onElicitation,
|
|
275
281
|
retainSessionLog: opts.retainSessionLog ?? false,
|
|
276
282
|
});
|
|
277
283
|
this.installExitHook();
|
|
@@ -322,6 +328,8 @@ export class AcpAgentRunner {
|
|
|
322
328
|
onDead,
|
|
323
329
|
onEvent: this.emitEvent,
|
|
324
330
|
permissionResolver: this.permissionResolver,
|
|
331
|
+
elicitationResolver: this.elicitationResolver,
|
|
332
|
+
advertiseElicitation: Boolean(this.elicitationResolver),
|
|
325
333
|
clientHandlers: this.clientHandlers,
|
|
326
334
|
});
|
|
327
335
|
}
|
|
@@ -343,6 +351,7 @@ export class AcpAgentRunner {
|
|
|
343
351
|
schema: config.schema,
|
|
344
352
|
policy,
|
|
345
353
|
permissionResolver: config.permissionResolver,
|
|
354
|
+
elicitationResolver: config.elicitationResolver,
|
|
346
355
|
signal: config.signal,
|
|
347
356
|
mcpServers: opts.mcpServers,
|
|
348
357
|
// Generic session-scoped _meta passthrough (RunOptions.meta) — merged UNDER the
|