@automatalabs/acp-agents 0.13.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 +33 -3
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +242 -18
- package/dist/capabilities.d.ts +11 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +28 -1
- 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 +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/interactive.d.ts +14 -6
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +10 -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.d.ts +3 -1
- package/dist/protocol-coverage.d.ts.map +1 -1
- package/dist/protocol-coverage.js +7 -7
- package/dist/runner.d.ts +52 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +142 -56
- package/package.json +1 -1
package/dist/capabilities.js
CHANGED
|
@@ -35,17 +35,44 @@ export const GATED_CUSTOM_META_KEYS = [
|
|
|
35
35
|
/** Parse an initialize response into the connection'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;
|
|
@@ -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,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC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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,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,+FAA+F;AAC/F,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,QAAQ,CAA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,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
|
@@ -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, 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,
|
|
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,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,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0B,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
|
@@ -1,16 +1,16 @@
|
|
|
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";
|
|
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. */
|
|
@@ -42,6 +44,8 @@ export interface InteractiveSessionOptions {
|
|
|
42
44
|
developerInstructions?: string;
|
|
43
45
|
/** Client-provided MCP servers to attach at session/new. */
|
|
44
46
|
mcpServers?: McpServerConfig[];
|
|
47
|
+
/** Keep accumulated text/history after each prompt turn; default false for held-open sessions. */
|
|
48
|
+
retainSessionLog?: boolean;
|
|
45
49
|
/** Host-owned cancellation. Aborting releases this interactive session. */
|
|
46
50
|
signal?: AbortSignal;
|
|
47
51
|
}
|
|
@@ -93,6 +97,10 @@ export declare class InteractiveSession {
|
|
|
93
97
|
get capabilities(): NegotiatedCapabilities | undefined;
|
|
94
98
|
/** Agent-advertised session mode catalog plus the currently active mode, if supported. */
|
|
95
99
|
get modes(): SessionModeState | null | undefined;
|
|
100
|
+
/** Assistant text accumulated in this session's retained log. */
|
|
101
|
+
get text(): string;
|
|
102
|
+
/** Message/tool history accumulated in this session's retained log. */
|
|
103
|
+
get history(): readonly AgentHistoryEntry[];
|
|
96
104
|
/** Send one prompt turn. A concurrent prompt on the same InteractiveSession is rejected with a
|
|
97
105
|
* clear host-side error; queueing is deliberately left to the host so turn boundaries remain
|
|
98
106
|
* explicit. Per-turn images are appended only to this prompt, and SessionHandle.prompt()
|
|
@@ -113,8 +121,8 @@ export declare class InteractiveSession {
|
|
|
113
121
|
* explicitly; use `session.sessionId` so the wire call targets this session. */
|
|
114
122
|
notify<Method extends AgentNotificationMethod>(method: Method, params: AgentNotificationParamsByMethod[Method]): Promise<void>;
|
|
115
123
|
notify<Params = unknown>(method: string, params?: Params): Promise<void>;
|
|
116
|
-
/** Best-effort ACP session/cancel for the active turn. Pending permission
|
|
117
|
-
* 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. */
|
|
118
126
|
cancel(): Promise<void>;
|
|
119
127
|
/** Subscribe to runner events for THIS ACP session only. Events from other one-shot or
|
|
120
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,EACl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O,CAAC,eAAe,CAAC;IAsB3B;;;uEAGmE;IACnE,OAAO,CAAC,MAAM,SAAS,kBAAkB,EACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAC1C,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,QAAQ,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,kBAAkB,GAC3B,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
|
@@ -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()
|
|
@@ -96,8 +104,8 @@ export class InteractiveSession {
|
|
|
96
104
|
throw new Error("InteractiveSession has been released");
|
|
97
105
|
await this.connection.notify(method, params);
|
|
98
106
|
}
|
|
99
|
-
/** Best-effort ACP session/cancel for the active turn. Pending permission
|
|
100
|
-
* 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. */
|
|
101
109
|
async cancel() {
|
|
102
110
|
if (this.releasePromise)
|
|
103
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,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,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);
|
|
@@ -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"}
|
|
@@ -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",
|
|
@@ -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,11 +1,45 @@
|
|
|
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";
|
|
5
6
|
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
|
-
import type { PermissionResolver } from "./permissions.js";
|
|
9
|
+
import type { ElicitationResolver, 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 {
|
|
@@ -15,6 +49,9 @@ export interface AcpRunnerOptions extends AcpPoolOptions {
|
|
|
15
49
|
/** Runner-wide human-in-the-loop permission resolver. When set, it replaces ToolPolicy
|
|
16
50
|
* auto-decisions for every session that does not provide its own resolver. */
|
|
17
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;
|
|
18
55
|
}
|
|
19
56
|
export declare class AcpAgentRunner implements AgentRunner {
|
|
20
57
|
private readonly pool;
|
|
@@ -29,6 +66,7 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
29
66
|
* so dedicated interactive connections must receive the SAME deps the pool receives. */
|
|
30
67
|
private readonly clientHandlers;
|
|
31
68
|
private readonly permissionResolver;
|
|
69
|
+
private readonly elicitationResolver;
|
|
32
70
|
/** Held-open interactive sessions own dedicated ACP processes outside the pool. The runner
|
|
33
71
|
* tracks their connections so dispose() can release them and the process-exit hook can
|
|
34
72
|
* synchronously kill any dedicated children if the host exits without release(). */
|
|
@@ -40,7 +78,8 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
40
78
|
/**
|
|
41
79
|
* Listen in on the live ACP stream. `name` is an ACP `sessionUpdate` discriminant
|
|
42
80
|
* ("agent_message_chunk", "tool_call", "usage_update", …) or one of the cross-cutting events
|
|
43
|
-
* ("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",
|
|
44
83
|
* "session_open", "session_close", "backend_error"). The listener is typed to the event.
|
|
45
84
|
* Returns an unsubscribe thunk. A pooled runner multiplexes many concurrent runs, so each
|
|
46
85
|
* event carries `{ sessionId, backendId, label?, runId? }` for filtering. Listeners are
|
|
@@ -60,10 +99,20 @@ export declare class AcpAgentRunner implements AgentRunner {
|
|
|
60
99
|
* is one).
|
|
61
100
|
*/
|
|
62
101
|
openSession(opts: InteractiveSessionOptions): Promise<InteractiveSession>;
|
|
102
|
+
/** List persisted ACP sessions from the selected backend. */
|
|
103
|
+
listSessions(opts?: ListSessionsOptions): Promise<ListSessionsResponse>;
|
|
104
|
+
/** Delete a persisted ACP session from the selected backend. */
|
|
105
|
+
deleteSession(opts: DeleteSessionOptions): Promise<void>;
|
|
106
|
+
/** Load an existing ACP session and return a live, routed InteractiveSession. */
|
|
107
|
+
loadSession(opts: ReattachSessionOptions): Promise<InteractiveSession>;
|
|
108
|
+
/** Resume an existing ACP session without replay and return a live, routed InteractiveSession. */
|
|
109
|
+
resumeSession(opts: ReattachSessionOptions): Promise<InteractiveSession>;
|
|
63
110
|
run<S extends TSchema | undefined = undefined>(prompt: string, options?: RunOptions<S>): Promise<AgentResult<S>>;
|
|
64
111
|
/** Tear down the whole pool (close every long-lived process). Call when the run ends / the
|
|
65
112
|
* runner is disposed. Beyond the AgentRunner seam (additive) — never enters the resume hash. */
|
|
66
113
|
dispose(): Promise<void>;
|
|
114
|
+
private createInteractiveSession;
|
|
115
|
+
private createDedicatedConnection;
|
|
67
116
|
/** Build the backend choice, model-selection spec, tool policy, and session/new options in one
|
|
68
117
|
* place for run() and openSession() so new AcpSessionOptions fields cannot drift by path. */
|
|
69
118
|
private prepareSession;
|
|
@@ -86,4 +135,5 @@ export declare function selectBackend(opts: {
|
|
|
86
135
|
model?: string;
|
|
87
136
|
tier?: string;
|
|
88
137
|
}, registry?: BackendRegistry): Backend;
|
|
138
|
+
export {};
|
|
89
139
|
//# 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,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,EACpB,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAc,MAAM,kBAAkB,CAAC;AA0C5F,UAAU,uBAAuB;IAC/B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,KAAK,CAAC,E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