@automatalabs/acp-agents 0.13.0 → 0.14.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 +16 -1
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +125 -12
- package/dist/capabilities.d.ts +11 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +28 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/interactive.d.ts +7 -1
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +8 -0
- package/dist/protocol-coverage.d.ts +3 -1
- package/dist/protocol-coverage.d.ts.map +1 -1
- package/dist/protocol-coverage.js +5 -5
- package/dist/runner.d.ts +45 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +132 -55
- package/package.json +1 -1
package/dist/acp-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ContentBlock, type AgentNotificationMethod, type AgentNotificationParamsByMethod, type AgentRequestMethod, type AgentRequestParamsByMethod, type AgentRequestResponsesByMethod, 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 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";
|
|
@@ -127,6 +127,9 @@ export declare class PooledConnection {
|
|
|
127
127
|
/** Drop the backend-declared bare `_meta` keys the connected agent did not advertise support
|
|
128
128
|
* for (see gateCustomMeta). Applied to BOTH session/new and session/prompt `_meta`. */
|
|
129
129
|
gateCustomMeta(meta: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
130
|
+
private assertSupportedMcpServers;
|
|
131
|
+
private sessionRequestMeta;
|
|
132
|
+
private assertLifecycleSupported;
|
|
130
133
|
/** Mark this connection dead exactly once, then ask the pool to evict it. Idempotent. */
|
|
131
134
|
private die;
|
|
132
135
|
private stderrSuffix;
|
|
@@ -140,6 +143,16 @@ export declare class PooledConnection {
|
|
|
140
143
|
* synchronously (before the first await) so the pool's load accounting is race-free.
|
|
141
144
|
*/
|
|
142
145
|
openSession(opts: AcpSessionOptions): Promise<SessionHandle>;
|
|
146
|
+
/** Reopen an existing session and replay its transcript through the router before resolving. */
|
|
147
|
+
loadSession(sessionId: string, opts: AcpSessionOptions): Promise<SessionHandle>;
|
|
148
|
+
/** Reopen an existing session without transcript replay. */
|
|
149
|
+
resumeSession(sessionId: string, opts: AcpSessionOptions): Promise<SessionHandle>;
|
|
150
|
+
private rawAgentRequest;
|
|
151
|
+
private reattachSession;
|
|
152
|
+
/** session/list on a dedicated connection, gated on the initialize advertisement. */
|
|
153
|
+
listSessions(request: ListSessionsRequest, label?: string): Promise<ListSessionsResponse>;
|
|
154
|
+
/** session/delete on a dedicated connection, gated on the initialize advertisement. */
|
|
155
|
+
deleteSession(request: DeleteSessionRequest, label?: string): Promise<void>;
|
|
143
156
|
/** session/prompt on this connection, raced against process death. */
|
|
144
157
|
prompt(request: PromptRequest): Promise<PromptResponse>;
|
|
145
158
|
/** session/set_config_option on this connection, raced against process death. */
|
|
@@ -187,6 +200,8 @@ export declare class SessionHandle implements StructuredSource {
|
|
|
187
200
|
get usage(): UsageAccumulator;
|
|
188
201
|
/** Diagnostic message/tool history accumulated across this session's run. */
|
|
189
202
|
get history(): AgentHistoryEntry[];
|
|
203
|
+
/** Assistant text accumulated across the retained session log. */
|
|
204
|
+
get text(): string;
|
|
190
205
|
/** Agent-advertised session mode catalog plus the currently active mode, if supported. */
|
|
191
206
|
get modes(): SessionModeState | null | undefined;
|
|
192
207
|
/**
|
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,EAUL,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,
|
|
1
|
+
{"version":3,"file":"acp-client.d.ts","sourceRoot":"","sources":["../src/acp-client.ts"],"names":[],"mappings":"AAwBA,OAAO,EAUL,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,EAGxB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAO5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,SAA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C1F,IAAI,KAAK,IAAI,gBAAgB,CAE5B;IAED,6EAA6E;IAC7E,IAAI,OAAO,IAAI,iBAAiB,EAAE,CAEjC;IAED,kEAAkE;IAClE,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,0FAA0F;IAC1F,IAAI,KAAK,IAAI,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAE/C;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAgBjF;;;;;;;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
|
@@ -24,7 +24,7 @@ import { spawn } from "node:child_process";
|
|
|
24
24
|
import { Readable, Writable } from "node:stream";
|
|
25
25
|
import { AGENT_METHODS, client, CLIENT_METHODS, ndJsonStream, PROTOCOL_VERSION, RequestError, } from "@agentclientprotocol/sdk";
|
|
26
26
|
import { META_KEYS, WorkflowError, WorkflowErrorCode, } from "@automatalabs/shared-types";
|
|
27
|
-
import { adaptPromptContent, gateCustomMeta, isSupportedProtocolVersion, negotiateCapabilities, unsupportedMcpServer, } from "./capabilities.js";
|
|
27
|
+
import { adaptPromptContent, describeLifecycleAdvertisement, gateCustomMeta, isSupportedProtocolVersion, negotiateCapabilities, unsupportedMcpServer, } from "./capabilities.js";
|
|
28
28
|
import { emitSessionUpdate } from "./events.js";
|
|
29
29
|
import { decidePermission } from "./permissions.js";
|
|
30
30
|
import { UsageAccumulator } from "./usage.js";
|
|
@@ -42,6 +42,15 @@ const CLOSE_SESSION_TIMEOUT_MS = 5_000;
|
|
|
42
42
|
/** Bound the graceful SIGTERM shutdown before escalating to SIGKILL. */
|
|
43
43
|
const DISPOSE_SIGKILL_GRACE_MS = 2_000;
|
|
44
44
|
const TOMBSTONE_SESSION_CAP = 64;
|
|
45
|
+
const GUARDED_STATEFUL_REQUESTS = new Map([
|
|
46
|
+
[AGENT_METHODS.session_new, "use openSession()"],
|
|
47
|
+
[AGENT_METHODS.session_load, "use loadSession()"],
|
|
48
|
+
[AGENT_METHODS.session_resume, "use resumeSession()"],
|
|
49
|
+
[
|
|
50
|
+
AGENT_METHODS.session_fork,
|
|
51
|
+
"no driven wrapper yet; raw forked sessions cannot be routed (permissions auto-cancel)",
|
|
52
|
+
],
|
|
53
|
+
]);
|
|
45
54
|
/** Per-session accumulator: assistant text, tool history, usage, the Claude raw structured_output,
|
|
46
55
|
* and the permission policy/resolver used to answer permission requests for THIS session. */
|
|
47
56
|
class SessionState {
|
|
@@ -318,6 +327,14 @@ function cancelledPermissionResponse() {
|
|
|
318
327
|
function methodNotAdvertised(method) {
|
|
319
328
|
return new RequestError(-32601, `${method} was not advertised by this client`, { method });
|
|
320
329
|
}
|
|
330
|
+
function assertSafeRawRequest(method) {
|
|
331
|
+
const guidance = GUARDED_STATEFUL_REQUESTS.get(method);
|
|
332
|
+
if (!guidance)
|
|
333
|
+
return;
|
|
334
|
+
throw new Error(`Raw ACP request "${method}" is guarded: ${guidance}. Sessions created, reopened, or forked ` +
|
|
335
|
+
"outside the router are unregistered: session/update notifications do not fold into an " +
|
|
336
|
+
"accumulator, permission requests auto-cancel, and fs/terminal dispatch fails for unknown sessions.");
|
|
337
|
+
}
|
|
321
338
|
function modeIds(modes) {
|
|
322
339
|
return modes?.availableModes.map((mode) => mode.id) ?? [];
|
|
323
340
|
}
|
|
@@ -326,6 +343,12 @@ function modeSelectionError(backendId, requested, advertisedIds, label, cause) {
|
|
|
326
343
|
const suffix = cause ? `: ${thrownMessage(cause)}` : "";
|
|
327
344
|
return new WorkflowError(`ACP agent (${backendId}) cannot apply session mode "${requested}" (advertised modes: ${advertised})${suffix}`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label, details: cause });
|
|
328
345
|
}
|
|
346
|
+
function lifecycleCapabilityError(backendId, method, capabilities, label) {
|
|
347
|
+
const advertised = capabilities
|
|
348
|
+
? describeLifecycleAdvertisement(capabilities.agent)
|
|
349
|
+
: "initialize did not complete";
|
|
350
|
+
return new WorkflowError(`ACP agent (${backendId}) does not advertise ${method}; advertised lifecycle capabilities: ${advertised}`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label });
|
|
351
|
+
}
|
|
329
352
|
function thrownMessage(error) {
|
|
330
353
|
if (error instanceof Error)
|
|
331
354
|
return error.message;
|
|
@@ -490,6 +513,35 @@ export class PooledConnection {
|
|
|
490
513
|
gateCustomMeta(meta) {
|
|
491
514
|
return gateCustomMeta(meta, this.negotiated?.customMetaSupport, this.negotiated?.gatedKeys);
|
|
492
515
|
}
|
|
516
|
+
assertSupportedMcpServers(opts) {
|
|
517
|
+
const unsupported = this.negotiated
|
|
518
|
+
? unsupportedMcpServer(opts.mcpServers, this.negotiated.agent)
|
|
519
|
+
: undefined;
|
|
520
|
+
if (!unsupported)
|
|
521
|
+
return;
|
|
522
|
+
throw new WorkflowError(`MCP server "${unsupported.name}" uses the "${unsupported.transport}" transport, which the ` +
|
|
523
|
+
`${this.backendId} agent does not support`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: opts.label });
|
|
524
|
+
}
|
|
525
|
+
sessionRequestMeta(opts) {
|
|
526
|
+
return this.gateCustomMeta(stampRunId(layerMeta(this.backend.sessionMetaDefaults?.(), opts.meta, this.backend.sessionMeta(opts.schema, {
|
|
527
|
+
baseInstructions: opts.baseInstructions,
|
|
528
|
+
developerInstructions: opts.developerInstructions,
|
|
529
|
+
})), opts.runId));
|
|
530
|
+
}
|
|
531
|
+
assertLifecycleSupported(method, label) {
|
|
532
|
+
const supported = method === AGENT_METHODS.session_load
|
|
533
|
+
? this.negotiated?.supportsLoadSession
|
|
534
|
+
: method === AGENT_METHODS.session_list
|
|
535
|
+
? this.negotiated?.supportsListSessions
|
|
536
|
+
: method === AGENT_METHODS.session_delete
|
|
537
|
+
? this.negotiated?.supportsDeleteSession
|
|
538
|
+
: method === AGENT_METHODS.session_resume
|
|
539
|
+
? this.negotiated?.supportsResumeSession
|
|
540
|
+
: false;
|
|
541
|
+
if (supported)
|
|
542
|
+
return;
|
|
543
|
+
throw lifecycleCapabilityError(this.backendId, method, this.negotiated, label);
|
|
544
|
+
}
|
|
493
545
|
/** Mark this connection dead exactly once, then ask the pool to evict it. Idempotent. */
|
|
494
546
|
die(error) {
|
|
495
547
|
if (!this._alive)
|
|
@@ -577,23 +629,14 @@ export class PooledConnection {
|
|
|
577
629
|
// does not advertise (http/sse gated on mcpCapabilities; stdio is always serviceable).
|
|
578
630
|
// Fail-fast and non-recoverable — re-running the same incompatible transport can never
|
|
579
631
|
// succeed. Lenient for agents that advertise no mcpCapabilities (the legacy passthrough).
|
|
580
|
-
|
|
581
|
-
? unsupportedMcpServer(opts.mcpServers, this.negotiated.agent)
|
|
582
|
-
: undefined;
|
|
583
|
-
if (unsupported) {
|
|
584
|
-
throw new WorkflowError(`MCP server "${unsupported.name}" uses the "${unsupported.transport}" transport, which the ` +
|
|
585
|
-
`${this.backendId} agent does not support`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: opts.label });
|
|
586
|
-
}
|
|
632
|
+
this.assertSupportedMcpServers(opts);
|
|
587
633
|
// session/new `_meta`, layered lowest-to-highest precedence: the backend's static
|
|
588
634
|
// defaults (a custom registry entry's `sessionMeta`), then the generic user passthrough
|
|
589
635
|
// (opts.meta), then the backend's protocol-critical `_meta` (Claude schema channel;
|
|
590
636
|
// Codex base/developer instructions), then the engine runId correlation stamp. The result
|
|
591
637
|
// is gated against the agent's advertised custom capabilities (a declared key the agent
|
|
592
638
|
// said it does not honor is dropped). When no layer survives, no `_meta` is sent.
|
|
593
|
-
const meta = this.
|
|
594
|
-
baseInstructions: opts.baseInstructions,
|
|
595
|
-
developerInstructions: opts.developerInstructions,
|
|
596
|
-
})), opts.runId));
|
|
639
|
+
const meta = this.sessionRequestMeta(opts);
|
|
597
640
|
const request = {
|
|
598
641
|
cwd: opts.cwd,
|
|
599
642
|
// Client-provided MCP servers (additive run input), else the default empty list.
|
|
@@ -610,6 +653,71 @@ export class PooledConnection {
|
|
|
610
653
|
throw error;
|
|
611
654
|
}
|
|
612
655
|
}
|
|
656
|
+
/** Reopen an existing session and replay its transcript through the router before resolving. */
|
|
657
|
+
loadSession(sessionId, opts) {
|
|
658
|
+
return this.reattachSession(AGENT_METHODS.session_load, sessionId, opts);
|
|
659
|
+
}
|
|
660
|
+
/** Reopen an existing session without transcript replay. */
|
|
661
|
+
resumeSession(sessionId, opts) {
|
|
662
|
+
return this.reattachSession(AGENT_METHODS.session_resume, sessionId, opts);
|
|
663
|
+
}
|
|
664
|
+
rawAgentRequest(method, params) {
|
|
665
|
+
// SDK 1.2.0 still maps session/load through emptyObjectResponse in ClientContext.request(),
|
|
666
|
+
// but both supported adapters return configOptions/modes there and the driven wrapper must
|
|
667
|
+
// adopt them. This bypasses only the SDK response mapper, not JSON-RPC validation/racing.
|
|
668
|
+
const agent = this.connection.agent;
|
|
669
|
+
return this.race(agent.sendRequest(method, params));
|
|
670
|
+
}
|
|
671
|
+
async reattachSession(method, sessionId, opts) {
|
|
672
|
+
this._activeSessions += 1;
|
|
673
|
+
let registered = false;
|
|
674
|
+
const state = new SessionState(opts.cwd, opts.policy, opts.permissionResolver, opts.label, opts.runId, undefined, opts.retainSessionLog ?? true);
|
|
675
|
+
try {
|
|
676
|
+
await this.ready;
|
|
677
|
+
this.assertLifecycleSupported(method, opts.label);
|
|
678
|
+
this.assertSupportedMcpServers(opts);
|
|
679
|
+
const meta = this.sessionRequestMeta(opts);
|
|
680
|
+
const request = {
|
|
681
|
+
sessionId,
|
|
682
|
+
cwd: opts.cwd,
|
|
683
|
+
mcpServers: opts.mcpServers ?? [],
|
|
684
|
+
...(meta ? { _meta: meta } : {}),
|
|
685
|
+
};
|
|
686
|
+
// Replayed updates and permission requests can arrive before the response, so the
|
|
687
|
+
// caller-provided id must be routable before the wire call leaves this process.
|
|
688
|
+
this.client.register(sessionId, state);
|
|
689
|
+
registered = true;
|
|
690
|
+
let response;
|
|
691
|
+
if (method === AGENT_METHODS.session_load) {
|
|
692
|
+
const loadRequest = request;
|
|
693
|
+
response = await this.rawAgentRequest(AGENT_METHODS.session_load, loadRequest);
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
const resumeRequest = request;
|
|
697
|
+
response = await this.rawAgentRequest(AGENT_METHODS.session_resume, resumeRequest);
|
|
698
|
+
}
|
|
699
|
+
state.modes = response.modes;
|
|
700
|
+
return new SessionHandle(this, sessionId, state, response.configOptions ?? [], opts);
|
|
701
|
+
}
|
|
702
|
+
catch (error) {
|
|
703
|
+
if (registered)
|
|
704
|
+
this.client.unregister(sessionId);
|
|
705
|
+
this._activeSessions -= 1;
|
|
706
|
+
throw error;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/** session/list on a dedicated connection, gated on the initialize advertisement. */
|
|
710
|
+
async listSessions(request, label) {
|
|
711
|
+
await this.ready;
|
|
712
|
+
this.assertLifecycleSupported(AGENT_METHODS.session_list, label);
|
|
713
|
+
return this.race(this.connection.agent.request(AGENT_METHODS.session_list, request));
|
|
714
|
+
}
|
|
715
|
+
/** session/delete on a dedicated connection, gated on the initialize advertisement. */
|
|
716
|
+
async deleteSession(request, label) {
|
|
717
|
+
await this.ready;
|
|
718
|
+
this.assertLifecycleSupported(AGENT_METHODS.session_delete, label);
|
|
719
|
+
await this.race(this.connection.agent.request(AGENT_METHODS.session_delete, request));
|
|
720
|
+
}
|
|
613
721
|
/** session/prompt on this connection, raced against process death. */
|
|
614
722
|
prompt(request) {
|
|
615
723
|
return this.race(this.connection.agent.request(AGENT_METHODS.session_prompt, request));
|
|
@@ -623,6 +731,7 @@ export class PooledConnection {
|
|
|
623
731
|
return this.race(this.connection.agent.request(AGENT_METHODS.session_set_mode, request));
|
|
624
732
|
}
|
|
625
733
|
request(method, params, options) {
|
|
734
|
+
assertSafeRawRequest(method);
|
|
626
735
|
return this.race(this.connection.agent.request(method, params, options));
|
|
627
736
|
}
|
|
628
737
|
notify(method, params) {
|
|
@@ -743,6 +852,10 @@ export class SessionHandle {
|
|
|
743
852
|
get history() {
|
|
744
853
|
return this.state.history;
|
|
745
854
|
}
|
|
855
|
+
/** Assistant text accumulated across the retained session log. */
|
|
856
|
+
get text() {
|
|
857
|
+
return this.state.textChunks.join("");
|
|
858
|
+
}
|
|
746
859
|
/** Agent-advertised session mode catalog plus the currently active mode, if supported. */
|
|
747
860
|
get modes() {
|
|
748
861
|
return this.state.modes;
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -18,6 +18,15 @@ export interface NegotiatedCapabilities {
|
|
|
18
18
|
agentInfo: Implementation | undefined;
|
|
19
19
|
/** Whether session/close is advertised (gates the best-effort release-time close). */
|
|
20
20
|
supportsClose: boolean;
|
|
21
|
+
/** Whether session/load is advertised. The current SDK keeps this as the legacy top-level
|
|
22
|
+
* `loadSession` flag; tolerate a future sessionCapabilities.load shape for forward compat. */
|
|
23
|
+
supportsLoadSession: boolean;
|
|
24
|
+
/** Whether session/list is advertised. */
|
|
25
|
+
supportsListSessions: boolean;
|
|
26
|
+
/** Whether session/delete is advertised. */
|
|
27
|
+
supportsDeleteSession: boolean;
|
|
28
|
+
/** Whether session/resume is advertised. */
|
|
29
|
+
supportsResumeSession: boolean;
|
|
21
30
|
/** The parsed backend-declared custom-capability block (the namespaced `_meta` object), or
|
|
22
31
|
* undefined when the backend declared none or the agent did not advertise it — passthrough. */
|
|
23
32
|
customMetaSupport: Record<string, unknown> | undefined;
|
|
@@ -27,6 +36,8 @@ export interface NegotiatedCapabilities {
|
|
|
27
36
|
}
|
|
28
37
|
/** Parse an initialize response into the connection's derived capability state. */
|
|
29
38
|
export declare function negotiateCapabilities(response: InitializeResponse, customCapabilities?: Backend["customCapabilities"]): NegotiatedCapabilities;
|
|
39
|
+
/** Human-readable lifecycle advertisement summary for strict wrapper gate errors. */
|
|
40
|
+
export declare function describeLifecycleAdvertisement(agent: AgentCapabilities): string;
|
|
30
41
|
/** True only when the agent selected EXACTLY PROTOCOL_VERSION. This client implements that one wire
|
|
31
42
|
* version and adapts its behavior to no other, so any other selected version — older or newer —
|
|
32
43
|
* means close the connection per the ACP spec's SHOULD-close rule. Per the spec the agent echoes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAkBA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ5C;;;iGAGiG;AACjG,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAInD,CAAC;AAEF,qFAAqF;AACrF,MAAM,WAAW,sBAAsB;IACrC;0FACsF;IACtF,eAAe,EAAE,MAAM,CAAC;IACxB;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ection's derived capability state. */
|
|
36
36
|
export function negotiateCapabilities(response, customCapabilities) {
|
|
37
37
|
const agent = response.agentCapabilities ?? {};
|
|
38
|
+
const sessionCapabilities = agent.sessionCapabilities;
|
|
38
39
|
return {
|
|
39
40
|
protocolVersion: response.protocolVersion,
|
|
40
41
|
agent,
|
|
41
42
|
agentInfo: response.agentInfo ?? undefined,
|
|
42
|
-
supportsClose:
|
|
43
|
+
supportsClose: advertised(sessionCapabilities?.close),
|
|
44
|
+
supportsLoadSession: agent.loadSession === true || advertised(sessionCapabilities?.load),
|
|
45
|
+
supportsListSessions: advertised(sessionCapabilities?.list),
|
|
46
|
+
supportsDeleteSession: advertised(sessionCapabilities?.delete),
|
|
47
|
+
supportsResumeSession: advertised(sessionCapabilities?.resume),
|
|
43
48
|
customMetaSupport: customCapabilities
|
|
44
49
|
? readCustomNamespace(agent._meta, customCapabilities.namespace)
|
|
45
50
|
: undefined,
|
|
46
51
|
gatedKeys: customCapabilities ? [...customCapabilities.gatedKeys] : undefined,
|
|
47
52
|
};
|
|
48
53
|
}
|
|
54
|
+
function advertised(capability) {
|
|
55
|
+
return capability !== undefined && capability !== null && capability !== false;
|
|
56
|
+
}
|
|
57
|
+
/** Human-readable lifecycle advertisement summary for strict wrapper gate errors. */
|
|
58
|
+
export function describeLifecycleAdvertisement(agent) {
|
|
59
|
+
const sessionCapabilities = agent.sessionCapabilities;
|
|
60
|
+
const session = [
|
|
61
|
+
["close", sessionCapabilities?.close],
|
|
62
|
+
["list", sessionCapabilities?.list],
|
|
63
|
+
["delete", sessionCapabilities?.delete],
|
|
64
|
+
["resume", sessionCapabilities?.resume],
|
|
65
|
+
["fork", sessionCapabilities?.fork],
|
|
66
|
+
["additionalDirectories", sessionCapabilities?.additionalDirectories],
|
|
67
|
+
["load", sessionCapabilities?.load],
|
|
68
|
+
]
|
|
69
|
+
.filter(([, value]) => advertised(value))
|
|
70
|
+
.map(([name]) => name);
|
|
71
|
+
return [
|
|
72
|
+
`loadSession=${agent.loadSession === true ? "true" : "false"}`,
|
|
73
|
+
`sessionCapabilities=${session.length > 0 ? session.join(", ") : "none"}`,
|
|
74
|
+
].join("; ");
|
|
75
|
+
}
|
|
49
76
|
function readCustomNamespace(meta, namespace) {
|
|
50
77
|
if (!meta || typeof meta !== "object")
|
|
51
78
|
return undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { AcpAgentRunner, createAcpRunner, selectBackend } from "./runner.js";
|
|
2
|
-
export type { AcpRunnerOptions } from "./runner.js";
|
|
2
|
+
export type { AcpRunnerOptions, DeleteSessionOptions, ListSessionsOptions, ReattachSessionOptions, } from "./runner.js";
|
|
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, SessionMode, SessionModeState, SendRequestOptions, } 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";
|
|
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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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ChB,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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, ContentBlock, SendRequestOptions, SessionModeState, StopReason } from "@agentclientprotocol/sdk";
|
|
2
|
-
import type { McpServerConfig, PromptImage } from "@automatalabs/shared-types";
|
|
2
|
+
import type { AgentHistoryEntry, McpServerConfig, PromptImage } from "@automatalabs/shared-types";
|
|
3
3
|
import type { RunOptions } from "@automatalabs/shared-types";
|
|
4
4
|
import type { Backend, BackendId } from "./backend.js";
|
|
5
5
|
import type { NegotiatedCapabilities } from "./capabilities.js";
|
|
@@ -42,6 +42,8 @@ export interface InteractiveSessionOptions {
|
|
|
42
42
|
developerInstructions?: string;
|
|
43
43
|
/** Client-provided MCP servers to attach at session/new. */
|
|
44
44
|
mcpServers?: McpServerConfig[];
|
|
45
|
+
/** Keep accumulated text/history after each prompt turn; default false for held-open sessions. */
|
|
46
|
+
retainSessionLog?: boolean;
|
|
45
47
|
/** Host-owned cancellation. Aborting releases this interactive session. */
|
|
46
48
|
signal?: AbortSignal;
|
|
47
49
|
}
|
|
@@ -93,6 +95,10 @@ export declare class InteractiveSession {
|
|
|
93
95
|
get capabilities(): NegotiatedCapabilities | undefined;
|
|
94
96
|
/** Agent-advertised session mode catalog plus the currently active mode, if supported. */
|
|
95
97
|
get modes(): SessionModeState | null | undefined;
|
|
98
|
+
/** Assistant text accumulated in this session's retained log. */
|
|
99
|
+
get text(): string;
|
|
100
|
+
/** Message/tool history accumulated in this session's retained log. */
|
|
101
|
+
get history(): readonly AgentHistoryEntry[];
|
|
96
102
|
/** Send one prompt turn. A concurrent prompt on the same InteractiveSession is rejected with a
|
|
97
103
|
* clear host-side error; queueing is deliberately left to the host so turn boundaries remain
|
|
98
104
|
* explicit. Per-turn images are appended only to this prompt, and SessionHandle.prompt()
|
|
@@ -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,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,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,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;AAO3D;;;;mCAIm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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
|
@@ -53,6 +53,14 @@ export class InteractiveSession {
|
|
|
53
53
|
get modes() {
|
|
54
54
|
return this.session.modes;
|
|
55
55
|
}
|
|
56
|
+
/** Assistant text accumulated in this session's retained log. */
|
|
57
|
+
get text() {
|
|
58
|
+
return this.session.text;
|
|
59
|
+
}
|
|
60
|
+
/** Message/tool history accumulated in this session's retained log. */
|
|
61
|
+
get history() {
|
|
62
|
+
return this.session.history;
|
|
63
|
+
}
|
|
56
64
|
/** Send one prompt turn. A concurrent prompt on the same InteractiveSession is rejected with a
|
|
57
65
|
* clear host-side error; queueing is deliberately left to the host so turn boundaries remain
|
|
58
66
|
* explicit. Per-turn images are appended only to this prompt, and SessionHandle.prompt()
|
|
@@ -3,7 +3,9 @@ type ValueOf<T> = T[keyof T];
|
|
|
3
3
|
type ClientMethod = ValueOf<typeof CLIENT_METHODS>;
|
|
4
4
|
type AgentMethod = ValueOf<typeof AGENT_METHODS>;
|
|
5
5
|
export type ClientMethodCoverage = "served" | "pending";
|
|
6
|
-
|
|
6
|
+
/** `guarded` means the raw passthrough would create/reopen session state outside the router, so
|
|
7
|
+
* the client rejects it until a driven wrapper can route updates, permissions, and terminals. */
|
|
8
|
+
export type AgentMethodCoverage = "driven" | "passthrough" | "guarded";
|
|
7
9
|
/** Enforceable definition of "full ACP spec support": every SDK method constant is classified
|
|
8
10
|
* here, and the tripwire test fails when an SDK bump silently widens or shrinks the protocol. */
|
|
9
11
|
export declare const CLIENT_METHOD_COVERAGE: Record<ClientMethod, ClientMethodCoverage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-coverage.d.ts","sourceRoot":"","sources":["../src/protocol-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,KAAK,YAAY,GAAG,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC;AACnD,KAAK,WAAW,GAAG,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AACxD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol-coverage.d.ts","sourceRoot":"","sources":["../src/protocol-coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,KAAK,YAAY,GAAG,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC;AACnD,KAAK,WAAW,GAAG,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;AAEjD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AACxD;kGACkG;AAClG,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;AAEvE;kGACkG;AAClG,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,YAAY,EAAE,oBAAoB,CAe7E,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CA6B1E,CAAC"}
|
|
@@ -24,16 +24,16 @@ export const AGENT_METHOD_COVERAGE = {
|
|
|
24
24
|
[AGENT_METHODS.providers_set]: "passthrough",
|
|
25
25
|
[AGENT_METHODS.providers_disable]: "passthrough",
|
|
26
26
|
[AGENT_METHODS.session_new]: "driven",
|
|
27
|
-
[AGENT_METHODS.session_load]: "
|
|
27
|
+
[AGENT_METHODS.session_load]: "driven",
|
|
28
28
|
[AGENT_METHODS.session_set_mode]: "driven",
|
|
29
29
|
[AGENT_METHODS.session_set_config_option]: "driven",
|
|
30
30
|
[AGENT_METHODS.session_prompt]: "driven",
|
|
31
31
|
[AGENT_METHODS.session_cancel]: "driven",
|
|
32
32
|
[AGENT_METHODS.mcp_message]: "passthrough",
|
|
33
|
-
[AGENT_METHODS.session_list]: "
|
|
34
|
-
[AGENT_METHODS.session_delete]: "
|
|
35
|
-
[AGENT_METHODS.session_fork]: "
|
|
36
|
-
[AGENT_METHODS.session_resume]: "
|
|
33
|
+
[AGENT_METHODS.session_list]: "driven",
|
|
34
|
+
[AGENT_METHODS.session_delete]: "driven",
|
|
35
|
+
[AGENT_METHODS.session_fork]: "guarded",
|
|
36
|
+
[AGENT_METHODS.session_resume]: "driven",
|
|
37
37
|
[AGENT_METHODS.session_close]: "driven",
|
|
38
38
|
[AGENT_METHODS.logout]: "passthrough",
|
|
39
39
|
[AGENT_METHODS.nes_start]: "passthrough",
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AgentResult, type AgentRunner, type RunOptions } from "@automatalabs/shared-types";
|
|
2
|
+
import type { ListSessionsResponse } from "@agentclientprotocol/sdk";
|
|
2
3
|
import type { TSchema } from "typebox";
|
|
3
4
|
import { type AcpPoolOptions } from "./pool.js";
|
|
4
5
|
import { type AcpEventListener, type AcpEventName } from "./events.js";
|
|
@@ -6,6 +7,39 @@ import type { Backend } from "./backend.js";
|
|
|
6
7
|
import { InteractiveSession, type InteractiveSessionOptions } from "./interactive.js";
|
|
7
8
|
import { type BackendRegistry, type CustomBackendConfig } from "./registry.js";
|
|
8
9
|
import type { PermissionResolver } from "./permissions.js";
|
|
10
|
+
interface LifecycleRoutingOptions {
|
|
11
|
+
/** Model spec used only to select the backend process. */
|
|
12
|
+
model?: string;
|
|
13
|
+
/** Coarse tier consulted only when `model` is unset. */
|
|
14
|
+
tier?: string;
|
|
15
|
+
/** Event/telemetry label used in strict capability errors. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Host-owned cancellation while the lifecycle request is in flight. */
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/** Options for AcpAgentRunner.listSessions(). */
|
|
21
|
+
export interface ListSessionsOptions extends LifecycleRoutingOptions {
|
|
22
|
+
/** Optional absolute working-directory filter. */
|
|
23
|
+
cwd?: string;
|
|
24
|
+
/** Opaque pagination cursor from the previous response. */
|
|
25
|
+
cursor?: string;
|
|
26
|
+
/** Generic ACP `_meta` passthrough for session/list. */
|
|
27
|
+
meta?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/** Options for AcpAgentRunner.deleteSession(). */
|
|
30
|
+
export interface DeleteSessionOptions extends LifecycleRoutingOptions {
|
|
31
|
+
/** Session id returned by session/list or previously persisted by the backend. */
|
|
32
|
+
sessionId: string;
|
|
33
|
+
/** Generic ACP `_meta` passthrough for session/delete. */
|
|
34
|
+
meta?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/** Options for AcpAgentRunner.loadSession() and resumeSession(). */
|
|
37
|
+
export interface ReattachSessionOptions extends InteractiveSessionOptions {
|
|
38
|
+
/** Existing backend session id to route before the lifecycle request is sent. */
|
|
39
|
+
sessionId: string;
|
|
40
|
+
/** Alias for onPermissionRequest for hosts that name the resolver by role. */
|
|
41
|
+
permissionResolver?: PermissionResolver;
|
|
42
|
+
}
|
|
9
43
|
/** Constructor options for the runner: pool sizing, client-side handlers, and the custom-backend
|
|
10
44
|
* registry. `backends` merges over (and wins against) env-declared AGENTPRISM_BACKENDS entries. */
|
|
11
45
|
export interface AcpRunnerOptions extends AcpPoolOptions {
|
|
@@ -60,10 +94,20 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
60
94
|
* is one).
|
|
61
95
|
*/
|
|
62
96
|
openSession(opts: InteractiveSessionOptions): Promise<InteractiveSession>;
|
|
97
|
+
/** List persisted ACP sessions from the selected backend. */
|
|
98
|
+
listSessions(opts?: ListSessionsOptions): Promise<ListSessionsResponse>;
|
|
99
|
+
/** Delete a persisted ACP session from the selected backend. */
|
|
100
|
+
deleteSession(opts: DeleteSessionOptions): Promise<void>;
|
|
101
|
+
/** Load an existing ACP session and return a live, routed InteractiveSession. */
|
|
102
|
+
loadSession(opts: ReattachSessionOptions): Promise<InteractiveSession>;
|
|
103
|
+
/** Resume an existing ACP session without replay and return a live, routed InteractiveSession. */
|
|
104
|
+
resumeSession(opts: ReattachSessionOptions): Promise<InteractiveSession>;
|
|
63
105
|
run<S extends TSchema | undefined = undefined>(prompt: string, options?: RunOptions<S>): Promise<AgentResult<S>>;
|
|
64
106
|
/** Tear down the whole pool (close every long-lived process). Call when the run ends / the
|
|
65
107
|
* runner is disposed. Beyond the AgentRunner seam (additive) — never enters the resume hash. */
|
|
66
108
|
dispose(): Promise<void>;
|
|
109
|
+
private createInteractiveSession;
|
|
110
|
+
private createDedicatedConnection;
|
|
67
111
|
/** Build the backend choice, model-selection spec, tool policy, and session/new options in one
|
|
68
112
|
* place for run() and openSession() so new AcpSessionOptions fields cannot drift by path. */
|
|
69
113
|
private prepareSession;
|
|
@@ -86,4 +130,5 @@ export declare function selectBackend(opts: {
|
|
|
86
130
|
model?: string;
|
|
87
131
|
tier?: string;
|
|
88
132
|
}, registry?: BackendRegistry): Backend;
|
|
133
|
+
export {};
|
|
89
134
|
//# sourceMappingURL=runner.d.ts.map
|
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;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAmBA,OA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EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAM1G"}
|
package/dist/runner.js
CHANGED
|
@@ -91,70 +91,66 @@ export class AcpAgentRunner {
|
|
|
91
91
|
* is one).
|
|
92
92
|
*/
|
|
93
93
|
async openSession(opts) {
|
|
94
|
+
return this.createInteractiveSession(opts, "openSession", (connection, prepared) => connection.openSession(prepared.sessionOptions));
|
|
95
|
+
}
|
|
96
|
+
/** List persisted ACP sessions from the selected backend. */
|
|
97
|
+
async listSessions(opts = {}) {
|
|
94
98
|
if (this.disposed)
|
|
95
99
|
throw new Error("ACP agent runner is disposed");
|
|
96
|
-
|
|
100
|
+
validateOptionalLifecycleCwd(opts.cwd, opts.label, "listSessions");
|
|
97
101
|
opts.signal?.throwIfAborted();
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
schema: undefined,
|
|
101
|
-
registry: this.backends,
|
|
102
|
-
permissionResolver: opts.onPermissionRequest,
|
|
103
|
-
retainSessionLog: false,
|
|
104
|
-
});
|
|
105
|
-
this.installExitHook();
|
|
106
|
-
let interactive;
|
|
107
|
-
const connection = PooledConnection.create(prepared.backend, {
|
|
108
|
-
onDead: () => {
|
|
109
|
-
// Dedicated connections are not stored in pool arrays, so there is nothing to evict.
|
|
110
|
-
// Once the public wrapper exists, process death releases it through the normal path:
|
|
111
|
-
// subscriptions are removed, session_close is emitted, and future prompt() calls fail
|
|
112
|
-
// with the clean released-session error. Before then, openSession's catch tears down.
|
|
113
|
-
void interactive?.release();
|
|
114
|
-
},
|
|
115
|
-
onEvent: this.emitEvent,
|
|
116
|
-
permissionResolver: this.permissionResolver,
|
|
117
|
-
clientHandlers: this.clientHandlers,
|
|
118
|
-
});
|
|
119
|
-
let session;
|
|
102
|
+
const backend = selectBackend(opts, this.backends);
|
|
103
|
+
const connection = this.createDedicatedConnection(backend, () => undefined);
|
|
120
104
|
try {
|
|
121
|
-
|
|
105
|
+
const request = {
|
|
106
|
+
...(opts.cwd ? { cwd: opts.cwd } : {}),
|
|
107
|
+
...(opts.cursor ? { cursor: opts.cursor } : {}),
|
|
108
|
+
...(opts.meta ? { _meta: opts.meta } : {}),
|
|
109
|
+
};
|
|
110
|
+
const response = await connection.listSessions(request, opts.label);
|
|
122
111
|
opts.signal?.throwIfAborted();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
if (this.disposed)
|
|
113
|
+
throw new Error("ACP agent runner is disposed");
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
await disposeBestEffort(connection);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** Delete a persisted ACP session from the selected backend. */
|
|
121
|
+
async deleteSession(opts) {
|
|
122
|
+
if (this.disposed)
|
|
123
|
+
throw new Error("ACP agent runner is disposed");
|
|
124
|
+
if (typeof opts.sessionId !== "string" || opts.sessionId.trim() === "") {
|
|
125
|
+
throw new WorkflowError("deleteSession requires sessionId to be a non-empty string", WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: opts.label });
|
|
126
|
+
}
|
|
127
|
+
opts.signal?.throwIfAborted();
|
|
128
|
+
const backend = selectBackend(opts, this.backends);
|
|
129
|
+
const connection = this.createDedicatedConnection(backend, () => undefined);
|
|
130
|
+
try {
|
|
131
|
+
const request = {
|
|
132
|
+
sessionId: opts.sessionId,
|
|
133
|
+
...(opts.meta ? { _meta: opts.meta } : {}),
|
|
134
|
+
};
|
|
135
|
+
await connection.deleteSession(request, opts.label);
|
|
127
136
|
opts.signal?.throwIfAborted();
|
|
128
137
|
if (this.disposed)
|
|
129
138
|
throw new Error("ACP agent runner is disposed");
|
|
130
|
-
interactive = new InteractiveSession({
|
|
131
|
-
session,
|
|
132
|
-
connection,
|
|
133
|
-
backend: prepared.backend,
|
|
134
|
-
subscribe: (name, listener) => this.events.on(name, listener),
|
|
135
|
-
onRelease: (self) => this.interactiveSessions.delete(self),
|
|
136
|
-
signal: opts.signal,
|
|
137
|
-
label: opts.label,
|
|
138
|
-
});
|
|
139
|
-
this.interactiveSessions.set(interactive, connection);
|
|
140
|
-
return interactive;
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
await session?.release();
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
// best-effort: openSession failed, so teardown must never mask the real error.
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
await connection.dispose();
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
// best-effort: same as pool teardown.
|
|
154
|
-
}
|
|
155
|
-
throw error;
|
|
140
|
+
finally {
|
|
141
|
+
await disposeBestEffort(connection);
|
|
156
142
|
}
|
|
157
143
|
}
|
|
144
|
+
/** Load an existing ACP session and return a live, routed InteractiveSession. */
|
|
145
|
+
async loadSession(opts) {
|
|
146
|
+
validateLifecycleSessionId(opts.sessionId, opts.label, "loadSession");
|
|
147
|
+
return this.createInteractiveSession(opts, "loadSession", (connection, prepared) => connection.loadSession(opts.sessionId, prepared.sessionOptions));
|
|
148
|
+
}
|
|
149
|
+
/** Resume an existing ACP session without replay and return a live, routed InteractiveSession. */
|
|
150
|
+
async resumeSession(opts) {
|
|
151
|
+
validateLifecycleSessionId(opts.sessionId, opts.label, "resumeSession");
|
|
152
|
+
return this.createInteractiveSession(opts, "resumeSession", (connection, prepared) => connection.resumeSession(opts.sessionId, prepared.sessionOptions));
|
|
153
|
+
}
|
|
158
154
|
async run(prompt, options = {}) {
|
|
159
155
|
const opts = options;
|
|
160
156
|
const schema = opts.schema;
|
|
@@ -266,6 +262,69 @@ export class AcpAgentRunner {
|
|
|
266
262
|
await this.pool.dispose();
|
|
267
263
|
this.events.removeAllListeners();
|
|
268
264
|
}
|
|
265
|
+
async createInteractiveSession(opts, methodName, open) {
|
|
266
|
+
if (this.disposed)
|
|
267
|
+
throw new Error("ACP agent runner is disposed");
|
|
268
|
+
validateInteractiveCwd(opts.cwd, opts.label, methodName);
|
|
269
|
+
opts.signal?.throwIfAborted();
|
|
270
|
+
const prepared = this.prepareSession(opts, {
|
|
271
|
+
cwd: opts.cwd,
|
|
272
|
+
schema: undefined,
|
|
273
|
+
registry: this.backends,
|
|
274
|
+
permissionResolver: opts.permissionResolver ?? opts.onPermissionRequest,
|
|
275
|
+
retainSessionLog: opts.retainSessionLog ?? false,
|
|
276
|
+
});
|
|
277
|
+
this.installExitHook();
|
|
278
|
+
let interactive;
|
|
279
|
+
const connection = this.createDedicatedConnection(prepared.backend, () => {
|
|
280
|
+
// Dedicated connections are not stored in pool arrays, so there is nothing to evict.
|
|
281
|
+
// Once the public wrapper exists, process death releases it through the normal path:
|
|
282
|
+
// subscriptions are removed, session_close is emitted, and future prompt() calls fail
|
|
283
|
+
// with the clean released-session error. Before then, this method's catch tears down.
|
|
284
|
+
void interactive?.release();
|
|
285
|
+
});
|
|
286
|
+
let session;
|
|
287
|
+
try {
|
|
288
|
+
session = await open(connection, prepared);
|
|
289
|
+
opts.signal?.throwIfAborted();
|
|
290
|
+
await applyModelSelection(session, prepared.modelSpec, opts);
|
|
291
|
+
opts.signal?.throwIfAborted();
|
|
292
|
+
if (opts.mode)
|
|
293
|
+
await session.setMode(opts.mode);
|
|
294
|
+
opts.signal?.throwIfAborted();
|
|
295
|
+
if (this.disposed)
|
|
296
|
+
throw new Error("ACP agent runner is disposed");
|
|
297
|
+
interactive = new InteractiveSession({
|
|
298
|
+
session,
|
|
299
|
+
connection,
|
|
300
|
+
backend: prepared.backend,
|
|
301
|
+
subscribe: (name, listener) => this.events.on(name, listener),
|
|
302
|
+
onRelease: (self) => this.interactiveSessions.delete(self),
|
|
303
|
+
signal: opts.signal,
|
|
304
|
+
label: opts.label,
|
|
305
|
+
});
|
|
306
|
+
this.interactiveSessions.set(interactive, connection);
|
|
307
|
+
return interactive;
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
try {
|
|
311
|
+
await session?.release();
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// best-effort: lifecycle setup failed, so teardown must never mask the real error.
|
|
315
|
+
}
|
|
316
|
+
await disposeBestEffort(connection);
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
createDedicatedConnection(backend, onDead) {
|
|
321
|
+
return PooledConnection.create(backend, {
|
|
322
|
+
onDead,
|
|
323
|
+
onEvent: this.emitEvent,
|
|
324
|
+
permissionResolver: this.permissionResolver,
|
|
325
|
+
clientHandlers: this.clientHandlers,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
269
328
|
/** Build the backend choice, model-selection spec, tool policy, and session/new options in one
|
|
270
329
|
* place for run() and openSession() so new AcpSessionOptions fields cannot drift by path. */
|
|
271
330
|
prepareSession(opts, config) {
|
|
@@ -412,9 +471,27 @@ function innerModelSpec(spec, backend) {
|
|
|
412
471
|
}
|
|
413
472
|
/** Interactive sessions are public and long-lived, so fail before spawning a dedicated process
|
|
414
473
|
* when the required worktree root is absent or not absolute. */
|
|
415
|
-
function validateInteractiveCwd(cwd, label) {
|
|
474
|
+
function validateInteractiveCwd(cwd, label, methodName) {
|
|
416
475
|
if (typeof cwd !== "string" || cwd.trim() === "" || !isAbsolute(cwd)) {
|
|
417
|
-
throw new WorkflowError(
|
|
476
|
+
throw new WorkflowError(`${methodName} requires cwd to be a non-empty absolute path`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label });
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function validateOptionalLifecycleCwd(cwd, label, methodName) {
|
|
480
|
+
if (cwd === undefined || cwd === null)
|
|
481
|
+
return;
|
|
482
|
+
validateInteractiveCwd(cwd, label, methodName);
|
|
483
|
+
}
|
|
484
|
+
function validateLifecycleSessionId(sessionId, label, methodName) {
|
|
485
|
+
if (typeof sessionId !== "string" || sessionId.trim() === "") {
|
|
486
|
+
throw new WorkflowError(`${methodName} requires sessionId to be a non-empty string`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
async function disposeBestEffort(connection) {
|
|
490
|
+
try {
|
|
491
|
+
await connection.dispose();
|
|
492
|
+
}
|
|
493
|
+
catch {
|
|
494
|
+
// Dedicated lifecycle processes are already no longer useful; never mask the request result.
|
|
418
495
|
}
|
|
419
496
|
}
|
|
420
497
|
function backendIdForSpec(spec) {
|