@mono-agent/agent-runtime 0.17.1 → 0.18.1
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/MIGRATION.md +46 -3
- package/README.md +107 -13
- package/package.json +7 -2
- package/src/ai/failure.js +2 -1
- package/src/ai/index.js +2 -0
- package/src/ai/providers/acp-client.js +1149 -0
- package/src/ai/providers/acp-privacy.js +124 -0
- package/src/ai/providers/acp-public.js +21 -0
- package/src/ai/providers/acp-session-tokens.js +282 -0
- package/src/ai/providers/acp-transport.js +356 -0
- package/src/ai/providers/acp.js +539 -0
- package/src/ai/runtime/capabilities.js +16 -0
- package/src/ai/runtime/model-refs.js +20 -1
- package/src/ai/runtime/registry.js +6 -0
- package/src/ai/runtime/router.js +4 -1
- package/src/ai/types.js +11 -5
- package/src/runtime.js +5 -2
- package/types/ai/failure.d.ts +2 -2
- package/types/ai/index.d.ts +2 -0
- package/types/ai/providers/acp-client.d.ts +227 -0
- package/types/ai/providers/acp-privacy.d.ts +25 -0
- package/types/ai/providers/acp-public.d.ts +7 -0
- package/types/ai/providers/acp-session-tokens.d.ts +41 -0
- package/types/ai/providers/acp-transport.d.ts +45 -0
- package/types/ai/providers/acp.d.ts +93 -0
- package/types/ai/runtime/capabilities.d.ts +21 -0
- package/types/ai/types.d.ts +39 -9
package/types/ai/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {"claude" | "pi" | "codex" | "opencode" | (string & {})} RuntimeSdkId
|
|
2
|
+
* @typedef {"claude" | "pi" | "codex" | "opencode" | "acp" | (string & {})} RuntimeSdkId
|
|
3
3
|
* Canonical active runtime id. See ACTIVE_RUNTIME_KINDS (model-refs.js) for
|
|
4
4
|
* the enforced-at-runtime vocabulary.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* @typedef {"claude" | "claude-code" | "codex-app" | "opencode-app" | "pi" | (string & {})} RuntimeBridgeId
|
|
7
|
+
* @typedef {"claude" | "claude-code" | "codex-app" | "opencode-app" | "pi" | "acp-stdio" | (string & {})} RuntimeBridgeId
|
|
8
8
|
* Registry bridge id (distinct from RuntimeSdkId: a single sdk can be served
|
|
9
9
|
* by more than one bridge, e.g. sdk "claude" is served by both the "claude"
|
|
10
10
|
* SDK bridge and the "claude-code" CLI bridge). See
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
* @typedef {Object} RuntimeRunOptions
|
|
105
105
|
* The options object a host passes to `createRuntime(host).run(systemPrompt, options)`.
|
|
106
106
|
* @property {RuntimeModelRef} model Resolved model reference; see parseRuntimeModelReference.
|
|
107
|
-
* @property {
|
|
107
|
+
* @property {"sdk"|"cli"|"acp"} [executionMode] "sdk" (default), "cli", or "acp"; selects which bridge variant handles the model.
|
|
108
108
|
* @property {string} [sessionId] Host conversation/session key for resumable bridges.
|
|
109
109
|
* @property {string} [providerSessionId] Provider-owned resume id for resumable bridges.
|
|
110
110
|
* @property {typeof import("@anthropic-ai/claude-agent-sdk").query} [claudeAgentQuery] Advanced programmatic/test seam for the Claude SDK route; omitted runs use the runtime's pinned SDK query implementation.
|
|
@@ -134,6 +134,9 @@
|
|
|
134
134
|
* @property {RuntimeToolLimits} [toolLimits] Typed per-run tool-output limits (supported replacement for the deprecated `settings` tool keys).
|
|
135
135
|
* @property {RuntimeCompactionPolicy} [compaction] Typed per-run compaction policy (supported replacement for the deprecated `settings` compaction keys).
|
|
136
136
|
* @property {RuntimePromptOverrides} [prompts] Per-run prompt-fragment overrides (run wins over the host default).
|
|
137
|
+
* @property {import('./providers/acp-client.js').AcpClientHostOptions["resolveAcpProfile"]} [resolveAcpProfile] Per-run ACP profile resolver; wins over the host default.
|
|
138
|
+
* @property {import('./providers/acp-client.js').AcpClientHostOptions["onAcpInteractionRequest"]} [onAcpInteractionRequest] Per-run ACP permission/elicitation callback; wins over the host default.
|
|
139
|
+
* @property {Uint8Array} [acpSessionTokenKey] Host-owned 32-byte key for confidential authenticated ACP session handles. Required for every ACP task run.
|
|
137
140
|
* @property {{backend?: "auto"|"searxng"|"keyless", endpoint?: string}} [webSearchConfig] Run-scoped WebSearch backend configuration.
|
|
138
141
|
* @property {{render?: "never"|"auto", browserCommand?: string}} [webFetchConfig] Run-scoped WebFetch extraction/render configuration.
|
|
139
142
|
* @property {"sequential"|"safe-parallel"} [piToolExecutionMode] Pi built-in tool scheduling mode. Safe parallelism is the default.
|
|
@@ -150,7 +153,7 @@
|
|
|
150
153
|
*/
|
|
151
154
|
/**
|
|
152
155
|
* @typedef {RuntimeRunOptions
|
|
153
|
-
* & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "persistArtifact" | "onCompactionRecorded" | "onToolApprovalRequest" | "toolRiskTiers" | "approvalDefaultRiskTier" | "approvalTimeoutMs" | "approvalAlwaysAllowTools">
|
|
156
|
+
* & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "resolveAcpProfile" | "onAcpInteractionRequest" | "acpSessionTokenKey" | "persistArtifact" | "onCompactionRecorded" | "onToolApprovalRequest" | "toolRiskTiers" | "approvalDefaultRiskTier" | "approvalTimeoutMs" | "approvalAlwaysAllowTools">
|
|
154
157
|
* & {runtimeBrand: import('../runtime-brand.js').RuntimeBrand, toolContext?: import('../agent/tools/shared/tool-context.js').ToolContext, observerHub: {emit: (event: RuntimeEvent) => void, flush: () => Promise<void>}}
|
|
155
158
|
* } RuntimeRequest
|
|
156
159
|
* The request shape a bridge's `execute(systemPrompt, req)` receives as its
|
|
@@ -318,6 +321,9 @@
|
|
|
318
321
|
* @property {*} [runtimeBrand] See resolveRuntimeBrand (runtime-brand.js); accepts a partial RuntimeBrand.
|
|
319
322
|
* @property {(parsed: {sdk: (string|null), provider?: string, model: string}) => (import('./cost.js').NormalizedPricing|null)} [resolveCustomPricing] See resolvePricing (ai/cost.js).
|
|
320
323
|
* @property {import('../pi-auth.js').PiApiKeyResolver} [resolvePiApiKey] See createPiOAuthApiKeyResolver (pi-auth.js) for a ready-made implementation.
|
|
324
|
+
* @property {import('./providers/acp-client.js').AcpClientHostOptions["resolveAcpProfile"]} [resolveAcpProfile] Default ACP profile resolver; a per-run callback wins.
|
|
325
|
+
* @property {import('./providers/acp-client.js').AcpClientHostOptions["onAcpInteractionRequest"]} [onAcpInteractionRequest] Default ACP interaction callback; a per-run callback wins.
|
|
326
|
+
* @property {Uint8Array} [acpSessionTokenKey] Default host-owned 32-byte key for confidential authenticated ACP session handles.
|
|
321
327
|
* @property {(artifact: {filename: string, buffer: Buffer, toolName: string, toolUseId: (string|null)}) => (string|null)} [persistArtifact]
|
|
322
328
|
* @property {(record: CompactionRecordedPayload) => void} [onCompactionRecorded]
|
|
323
329
|
* @property {(payload: ApprovalRequestPayload) => Promise<ApprovalDecision>} [onToolApprovalRequest]
|
|
@@ -355,14 +361,14 @@ export const PROVIDER_KIND_VALUES: string[];
|
|
|
355
361
|
* Canonical active runtime id. See ACTIVE_RUNTIME_KINDS (model-refs.js) for
|
|
356
362
|
* the enforced-at-runtime vocabulary.
|
|
357
363
|
*/
|
|
358
|
-
export type RuntimeSdkId = "claude" | "pi" | "codex" | "opencode" | (string & {});
|
|
364
|
+
export type RuntimeSdkId = "claude" | "pi" | "codex" | "opencode" | "acp" | (string & {});
|
|
359
365
|
/**
|
|
360
366
|
* Registry bridge id (distinct from RuntimeSdkId: a single sdk can be served
|
|
361
367
|
* by more than one bridge, e.g. sdk "claude" is served by both the "claude"
|
|
362
368
|
* SDK bridge and the "claude-code" CLI bridge). See
|
|
363
369
|
* src/ai/runtime/registry.js's builtinBridgeSpecs.
|
|
364
370
|
*/
|
|
365
|
-
export type RuntimeBridgeId = "claude" | "claude-code" | "codex-app" | "opencode-app" | "pi" | (string & {});
|
|
371
|
+
export type RuntimeBridgeId = "claude" | "claude-code" | "codex-app" | "opencode-app" | "pi" | "acp-stdio" | (string & {});
|
|
366
372
|
export type RuntimeModelRef = {
|
|
367
373
|
/**
|
|
368
374
|
* Canonical active runtime id.
|
|
@@ -535,9 +541,9 @@ export type RuntimeRunOptions = {
|
|
|
535
541
|
*/
|
|
536
542
|
model: RuntimeModelRef;
|
|
537
543
|
/**
|
|
538
|
-
* "sdk" (default) or "
|
|
544
|
+
* "sdk" (default), "cli", or "acp"; selects which bridge variant handles the model.
|
|
539
545
|
*/
|
|
540
|
-
executionMode?:
|
|
546
|
+
executionMode?: "sdk" | "cli" | "acp";
|
|
541
547
|
/**
|
|
542
548
|
* Host conversation/session key for resumable bridges.
|
|
543
549
|
*/
|
|
@@ -630,6 +636,18 @@ export type RuntimeRunOptions = {
|
|
|
630
636
|
* Per-run prompt-fragment overrides (run wins over the host default).
|
|
631
637
|
*/
|
|
632
638
|
prompts?: RuntimePromptOverrides;
|
|
639
|
+
/**
|
|
640
|
+
* Per-run ACP profile resolver; wins over the host default.
|
|
641
|
+
*/
|
|
642
|
+
resolveAcpProfile?: import("./providers/acp-client.js").AcpClientHostOptions["resolveAcpProfile"];
|
|
643
|
+
/**
|
|
644
|
+
* Per-run ACP permission/elicitation callback; wins over the host default.
|
|
645
|
+
*/
|
|
646
|
+
onAcpInteractionRequest?: import("./providers/acp-client.js").AcpClientHostOptions["onAcpInteractionRequest"];
|
|
647
|
+
/**
|
|
648
|
+
* Host-owned 32-byte key for confidential authenticated ACP session handles. Required for every ACP task run.
|
|
649
|
+
*/
|
|
650
|
+
acpSessionTokenKey?: Uint8Array;
|
|
633
651
|
/**
|
|
634
652
|
* Run-scoped WebSearch backend configuration.
|
|
635
653
|
*/
|
|
@@ -686,7 +704,7 @@ export type RuntimeRunOptions = {
|
|
|
686
704
|
* createRuntime), and the per-run observerHub (onEvent is overridden to the
|
|
687
705
|
* hub's emit). `systemPrompt` is passed positionally, not folded into this object.
|
|
688
706
|
*/
|
|
689
|
-
export type RuntimeRequest = RuntimeRunOptions & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "persistArtifact" | "onCompactionRecorded" | "onToolApprovalRequest" | "toolRiskTiers" | "approvalDefaultRiskTier" | "approvalTimeoutMs" | "approvalAlwaysAllowTools"> & {
|
|
707
|
+
export type RuntimeRequest = RuntimeRunOptions & Pick<AgentRuntimeHostOptions, "resolveCustomPricing" | "resolvePiApiKey" | "resolveAcpProfile" | "onAcpInteractionRequest" | "acpSessionTokenKey" | "persistArtifact" | "onCompactionRecorded" | "onToolApprovalRequest" | "toolRiskTiers" | "approvalDefaultRiskTier" | "approvalTimeoutMs" | "approvalAlwaysAllowTools"> & {
|
|
690
708
|
runtimeBrand: import("../runtime-brand.js").RuntimeBrand;
|
|
691
709
|
toolContext?: import("../agent/tools/shared/tool-context.js").ToolContext;
|
|
692
710
|
observerHub: {
|
|
@@ -955,6 +973,18 @@ export type AgentRuntimeHostOptions = {
|
|
|
955
973
|
* See createPiOAuthApiKeyResolver (pi-auth.js) for a ready-made implementation.
|
|
956
974
|
*/
|
|
957
975
|
resolvePiApiKey?: import("../pi-auth.js").PiApiKeyResolver;
|
|
976
|
+
/**
|
|
977
|
+
* Default ACP profile resolver; a per-run callback wins.
|
|
978
|
+
*/
|
|
979
|
+
resolveAcpProfile?: import("./providers/acp-client.js").AcpClientHostOptions["resolveAcpProfile"];
|
|
980
|
+
/**
|
|
981
|
+
* Default ACP interaction callback; a per-run callback wins.
|
|
982
|
+
*/
|
|
983
|
+
onAcpInteractionRequest?: import("./providers/acp-client.js").AcpClientHostOptions["onAcpInteractionRequest"];
|
|
984
|
+
/**
|
|
985
|
+
* Default host-owned 32-byte key for confidential authenticated ACP session handles.
|
|
986
|
+
*/
|
|
987
|
+
acpSessionTokenKey?: Uint8Array;
|
|
958
988
|
persistArtifact?: (artifact: {
|
|
959
989
|
filename: string;
|
|
960
990
|
buffer: Buffer;
|