@jini-ai/agent-runtime 0.1.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/LICENSE +201 -0
- package/README.md +43 -0
- package/dist/acp-model-probe.d.ts +48 -0
- package/dist/acp-model-probe.d.ts.map +1 -0
- package/dist/acp-model-probe.js +15 -0
- package/dist/acp-model-probe.js.map +1 -0
- package/dist/agent-protocol/acp/account-failure.d.ts +54 -0
- package/dist/agent-protocol/acp/account-failure.d.ts.map +1 -0
- package/dist/agent-protocol/acp/account-failure.js +37 -0
- package/dist/agent-protocol/acp/account-failure.js.map +1 -0
- package/dist/agent-protocol/acp/constants.d.ts +26 -0
- package/dist/agent-protocol/acp/constants.d.ts.map +1 -0
- package/dist/agent-protocol/acp/constants.js +39 -0
- package/dist/agent-protocol/acp/constants.js.map +1 -0
- package/dist/agent-protocol/acp/index.d.ts +14 -0
- package/dist/agent-protocol/acp/index.d.ts.map +1 -0
- package/dist/agent-protocol/acp/index.js +14 -0
- package/dist/agent-protocol/acp/index.js.map +1 -0
- package/dist/agent-protocol/acp/json.d.ts +82 -0
- package/dist/agent-protocol/acp/json.d.ts.map +1 -0
- package/dist/agent-protocol/acp/json.js +144 -0
- package/dist/agent-protocol/acp/json.js.map +1 -0
- package/dist/agent-protocol/acp/models.d.ts +112 -0
- package/dist/agent-protocol/acp/models.d.ts.map +1 -0
- package/dist/agent-protocol/acp/models.js +293 -0
- package/dist/agent-protocol/acp/models.js.map +1 -0
- package/dist/agent-protocol/acp/rpc.d.ts +107 -0
- package/dist/agent-protocol/acp/rpc.d.ts.map +1 -0
- package/dist/agent-protocol/acp/rpc.js +162 -0
- package/dist/agent-protocol/acp/rpc.js.map +1 -0
- package/dist/agent-protocol/acp/session-params.d.ts +55 -0
- package/dist/agent-protocol/acp/session-params.d.ts.map +1 -0
- package/dist/agent-protocol/acp/session-params.js +81 -0
- package/dist/agent-protocol/acp/session-params.js.map +1 -0
- package/dist/agent-protocol/acp/session.d.ts +101 -0
- package/dist/agent-protocol/acp/session.d.ts.map +1 -0
- package/dist/agent-protocol/acp/session.js +832 -0
- package/dist/agent-protocol/acp/session.js.map +1 -0
- package/dist/agent-protocol/acp/text-suppression.d.ts +73 -0
- package/dist/agent-protocol/acp/text-suppression.d.ts.map +1 -0
- package/dist/agent-protocol/acp/text-suppression.js +229 -0
- package/dist/agent-protocol/acp/text-suppression.js.map +1 -0
- package/dist/agent-protocol/acp/types.d.ts +27 -0
- package/dist/agent-protocol/acp/types.d.ts.map +1 -0
- package/dist/agent-protocol/acp/types.js +2 -0
- package/dist/agent-protocol/acp/types.js.map +1 -0
- package/dist/agent-protocol/acp/updates.d.ts +166 -0
- package/dist/agent-protocol/acp/updates.d.ts.map +1 -0
- package/dist/agent-protocol/acp/updates.js +268 -0
- package/dist/agent-protocol/acp/updates.js.map +1 -0
- package/dist/agent-protocol/core/index.d.ts +6 -0
- package/dist/agent-protocol/core/index.d.ts.map +1 -0
- package/dist/agent-protocol/core/index.js +6 -0
- package/dist/agent-protocol/core/index.js.map +1 -0
- package/dist/agent-protocol/core/json-line-stream.d.ts +42 -0
- package/dist/agent-protocol/core/json-line-stream.d.ts.map +1 -0
- package/dist/agent-protocol/core/json-line-stream.js +333 -0
- package/dist/agent-protocol/core/json-line-stream.js.map +1 -0
- package/dist/agent-protocol/index.d.ts +8 -0
- package/dist/agent-protocol/index.d.ts.map +1 -0
- package/dist/agent-protocol/index.js +8 -0
- package/dist/agent-protocol/index.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/events.d.ts +26 -0
- package/dist/agent-protocol/pi-rpc/events.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/events.js +167 -0
- package/dist/agent-protocol/pi-rpc/events.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/index.d.ts +11 -0
- package/dist/agent-protocol/pi-rpc/index.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/index.js +11 -0
- package/dist/agent-protocol/pi-rpc/index.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/internal.d.ts +45 -0
- package/dist/agent-protocol/pi-rpc/internal.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/internal.js +41 -0
- package/dist/agent-protocol/pi-rpc/internal.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/models.d.ts +21 -0
- package/dist/agent-protocol/pi-rpc/models.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/models.js +48 -0
- package/dist/agent-protocol/pi-rpc/models.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/session.d.ts +106 -0
- package/dist/agent-protocol/pi-rpc/session.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/session.js +371 -0
- package/dist/agent-protocol/pi-rpc/session.js.map +1 -0
- package/dist/amr-model-cache.d.ts +40 -0
- package/dist/amr-model-cache.d.ts.map +1 -0
- package/dist/amr-model-cache.js +79 -0
- package/dist/amr-model-cache.js.map +1 -0
- package/dist/amr-profile-resolver.d.ts +21 -0
- package/dist/amr-profile-resolver.d.ts.map +1 -0
- package/dist/amr-profile-resolver.js +4 -0
- package/dist/amr-profile-resolver.js.map +1 -0
- package/dist/artifact-taxonomy.d.ts +27 -0
- package/dist/artifact-taxonomy.d.ts.map +1 -0
- package/dist/artifact-taxonomy.js +5 -0
- package/dist/artifact-taxonomy.js.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +332 -0
- package/dist/auth.js.map +1 -0
- package/dist/capabilities.d.ts +9 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +2 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/claude-stream.d.ts +37 -0
- package/dist/claude-stream.d.ts.map +1 -0
- package/dist/claude-stream.js +660 -0
- package/dist/claude-stream.js.map +1 -0
- package/dist/copilot-stream.d.ts +37 -0
- package/dist/copilot-stream.d.ts.map +1 -0
- package/dist/copilot-stream.js +136 -0
- package/dist/copilot-stream.js.map +1 -0
- package/dist/defs/aider.d.ts +13 -0
- package/dist/defs/aider.d.ts.map +1 -0
- package/dist/defs/aider.js +63 -0
- package/dist/defs/aider.js.map +1 -0
- package/dist/defs/amp.d.ts +12 -0
- package/dist/defs/amp.d.ts.map +1 -0
- package/dist/defs/amp.js +56 -0
- package/dist/defs/amp.js.map +1 -0
- package/dist/defs/amr.d.ts +37 -0
- package/dist/defs/amr.d.ts.map +1 -0
- package/dist/defs/amr.js +303 -0
- package/dist/defs/amr.js.map +1 -0
- package/dist/defs/antigravity.d.ts +25 -0
- package/dist/defs/antigravity.d.ts.map +1 -0
- package/dist/defs/antigravity.js +213 -0
- package/dist/defs/antigravity.js.map +1 -0
- package/dist/defs/claude.d.ts +30 -0
- package/dist/defs/claude.d.ts.map +1 -0
- package/dist/defs/claude.js +130 -0
- package/dist/defs/claude.js.map +1 -0
- package/dist/defs/codebuddy.d.ts +26 -0
- package/dist/defs/codebuddy.d.ts.map +1 -0
- package/dist/defs/codebuddy.js +124 -0
- package/dist/defs/codebuddy.js.map +1 -0
- package/dist/defs/codex.d.ts +30 -0
- package/dist/defs/codex.d.ts.map +1 -0
- package/dist/defs/codex.js +196 -0
- package/dist/defs/codex.js.map +1 -0
- package/dist/defs/copilot.d.ts +12 -0
- package/dist/defs/copilot.d.ts.map +1 -0
- package/dist/defs/copilot.js +88 -0
- package/dist/defs/copilot.js.map +1 -0
- package/dist/defs/cursor-agent.d.ts +27 -0
- package/dist/defs/cursor-agent.d.ts.map +1 -0
- package/dist/defs/cursor-agent.js +93 -0
- package/dist/defs/cursor-agent.js.map +1 -0
- package/dist/defs/deepseek.d.ts +12 -0
- package/dist/defs/deepseek.d.ts.map +1 -0
- package/dist/defs/deepseek.js +53 -0
- package/dist/defs/deepseek.js.map +1 -0
- package/dist/defs/devin.d.ts +12 -0
- package/dist/defs/devin.d.ts.map +1 -0
- package/dist/defs/devin.js +45 -0
- package/dist/defs/devin.js.map +1 -0
- package/dist/defs/grok-build.d.ts +26 -0
- package/dist/defs/grok-build.d.ts.map +1 -0
- package/dist/defs/grok-build.js +105 -0
- package/dist/defs/grok-build.js.map +1 -0
- package/dist/defs/hermes.d.ts +13 -0
- package/dist/defs/hermes.d.ts.map +1 -0
- package/dist/defs/hermes.js +51 -0
- package/dist/defs/hermes.js.map +1 -0
- package/dist/defs/index.d.ts +33 -0
- package/dist/defs/index.d.ts.map +1 -0
- package/dist/defs/index.js +33 -0
- package/dist/defs/index.js.map +1 -0
- package/dist/defs/kilo.d.ts +12 -0
- package/dist/defs/kilo.d.ts.map +1 -0
- package/dist/defs/kilo.js +20 -0
- package/dist/defs/kilo.js.map +1 -0
- package/dist/defs/kimi.d.ts +13 -0
- package/dist/defs/kimi.d.ts.map +1 -0
- package/dist/defs/kimi.js +26 -0
- package/dist/defs/kimi.js.map +1 -0
- package/dist/defs/kiro.d.ts +12 -0
- package/dist/defs/kiro.d.ts.map +1 -0
- package/dist/defs/kiro.js +20 -0
- package/dist/defs/kiro.js.map +1 -0
- package/dist/defs/mimo.d.ts +13 -0
- package/dist/defs/mimo.d.ts.map +1 -0
- package/dist/defs/mimo.js +26 -0
- package/dist/defs/mimo.js.map +1 -0
- package/dist/defs/opencode.d.ts +27 -0
- package/dist/defs/opencode.d.ts.map +1 -0
- package/dist/defs/opencode.js +89 -0
- package/dist/defs/opencode.js.map +1 -0
- package/dist/defs/pi.d.ts +18 -0
- package/dist/defs/pi.d.ts.map +1 -0
- package/dist/defs/pi.js +94 -0
- package/dist/defs/pi.js.map +1 -0
- package/dist/defs/qoder.d.ts +11 -0
- package/dist/defs/qoder.d.ts.map +1 -0
- package/dist/defs/qoder.js +50 -0
- package/dist/defs/qoder.js.map +1 -0
- package/dist/defs/qwen.d.ts +11 -0
- package/dist/defs/qwen.d.ts.map +1 -0
- package/dist/defs/qwen.js +28 -0
- package/dist/defs/qwen.js.map +1 -0
- package/dist/defs/reasonix.d.ts +20 -0
- package/dist/defs/reasonix.d.ts.map +1 -0
- package/dist/defs/reasonix.js +60 -0
- package/dist/defs/reasonix.js.map +1 -0
- package/dist/defs/shared.d.ts +23 -0
- package/dist/defs/shared.d.ts.map +1 -0
- package/dist/defs/shared.js +58 -0
- package/dist/defs/shared.js.map +1 -0
- package/dist/defs/trae-cli.d.ts +14 -0
- package/dist/defs/trae-cli.d.ts.map +1 -0
- package/dist/defs/trae-cli.js +22 -0
- package/dist/defs/trae-cli.js.map +1 -0
- package/dist/defs/vibe.d.ts +12 -0
- package/dist/defs/vibe.d.ts.map +1 -0
- package/dist/defs/vibe.js +20 -0
- package/dist/defs/vibe.js.map +1 -0
- package/dist/detection.d.ts +14 -0
- package/dist/detection.d.ts.map +1 -0
- package/dist/detection.js +266 -0
- package/dist/detection.js.map +1 -0
- package/dist/diagnostics.d.ts +8 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +95 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/env.d.ts +19 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +95 -0
- package/dist/env.js.map +1 -0
- package/dist/executables.d.ts +24 -0
- package/dist/executables.d.ts.map +1 -0
- package/dist/executables.js +349 -0
- package/dist/executables.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/invocation.d.ts +6 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +47 -0
- package/dist/invocation.js.map +1 -0
- package/dist/json-event-stream.d.ts +9 -0
- package/dist/json-event-stream.d.ts.map +1 -0
- package/dist/json-event-stream.js +856 -0
- package/dist/json-event-stream.js.map +1 -0
- package/dist/launch.d.ts +12 -0
- package/dist/launch.d.ts.map +1 -0
- package/dist/launch.js +221 -0
- package/dist/launch.js.map +1 -0
- package/dist/mcp.d.ts +44 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +12 -0
- package/dist/mcp.js.map +1 -0
- package/dist/metadata.d.ts +24 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +100 -0
- package/dist/metadata.js.map +1 -0
- package/dist/mmd-routes.d.ts +12 -0
- package/dist/mmd-routes.d.ts.map +1 -0
- package/dist/mmd-routes.js +146 -0
- package/dist/mmd-routes.js.map +1 -0
- package/dist/model-registry.d.ts +120 -0
- package/dist/model-registry.d.ts.map +1 -0
- package/dist/model-registry.js +77 -0
- package/dist/model-registry.js.map +1 -0
- package/dist/models.d.ts +16 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +93 -0
- package/dist/models.js.map +1 -0
- package/dist/opencode-log.d.ts +16 -0
- package/dist/opencode-log.d.ts.map +1 -0
- package/dist/opencode-log.js +163 -0
- package/dist/opencode-log.js.map +1 -0
- package/dist/paths.d.ts +3 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -0
- package/dist/pi-models.d.ts +13 -0
- package/dist/pi-models.d.ts.map +1 -0
- package/dist/pi-models.js +36 -0
- package/dist/pi-models.js.map +1 -0
- package/dist/prompt-augmenter.d.ts +60 -0
- package/dist/prompt-augmenter.d.ts.map +1 -0
- package/dist/prompt-augmenter.js +26 -0
- package/dist/prompt-augmenter.js.map +1 -0
- package/dist/prompt-budget.d.ts +20 -0
- package/dist/prompt-budget.d.ts.map +1 -0
- package/dist/prompt-budget.js +226 -0
- package/dist/prompt-budget.js.map +1 -0
- package/dist/prompt-file.d.ts +7 -0
- package/dist/prompt-file.d.ts.map +1 -0
- package/dist/prompt-file.js +27 -0
- package/dist/prompt-file.js.map +1 -0
- package/dist/providers/aihubmix.d.ts +99 -0
- package/dist/providers/aihubmix.d.ts.map +1 -0
- package/dist/providers/aihubmix.js +239 -0
- package/dist/providers/aihubmix.js.map +1 -0
- package/dist/providers/anthropic-messages.d.ts +116 -0
- package/dist/providers/anthropic-messages.d.ts.map +1 -0
- package/dist/providers/anthropic-messages.js +313 -0
- package/dist/providers/anthropic-messages.js.map +1 -0
- package/dist/providers/azure-chat.d.ts +99 -0
- package/dist/providers/azure-chat.d.ts.map +1 -0
- package/dist/providers/azure-chat.js +164 -0
- package/dist/providers/azure-chat.js.map +1 -0
- package/dist/providers/connection-guard.d.ts +67 -0
- package/dist/providers/connection-guard.d.ts.map +1 -0
- package/dist/providers/connection-guard.js +211 -0
- package/dist/providers/connection-guard.js.map +1 -0
- package/dist/providers/elevenlabs.d.ts +28 -0
- package/dist/providers/elevenlabs.d.ts.map +1 -0
- package/dist/providers/elevenlabs.js +138 -0
- package/dist/providers/elevenlabs.js.map +1 -0
- package/dist/providers/google-messages.d.ts +108 -0
- package/dist/providers/google-messages.d.ts.map +1 -0
- package/dist/providers/google-messages.js +284 -0
- package/dist/providers/google-messages.js.map +1 -0
- package/dist/providers/google.d.ts +20 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +42 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/index.d.ts +39 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +39 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/model-catalog.d.ts +32 -0
- package/dist/providers/model-catalog.d.ts.map +1 -0
- package/dist/providers/model-catalog.js +394 -0
- package/dist/providers/model-catalog.js.map +1 -0
- package/dist/providers/oauth-callback-server.d.ts +35 -0
- package/dist/providers/oauth-callback-server.d.ts.map +1 -0
- package/dist/providers/oauth-callback-server.js +217 -0
- package/dist/providers/oauth-callback-server.js.map +1 -0
- package/dist/providers/oauth-credentials.d.ts +29 -0
- package/dist/providers/oauth-credentials.d.ts.map +1 -0
- package/dist/providers/oauth-credentials.js +70 -0
- package/dist/providers/oauth-credentials.js.map +1 -0
- package/dist/providers/oauth-provider.d.ts +95 -0
- package/dist/providers/oauth-provider.d.ts.map +1 -0
- package/dist/providers/oauth-provider.js +130 -0
- package/dist/providers/oauth-provider.js.map +1 -0
- package/dist/providers/oauth-tokens.d.ts +35 -0
- package/dist/providers/oauth-tokens.d.ts.map +1 -0
- package/dist/providers/oauth-tokens.js +136 -0
- package/dist/providers/oauth-tokens.js.map +1 -0
- package/dist/providers/ollama-chat.d.ts +106 -0
- package/dist/providers/ollama-chat.d.ts.map +1 -0
- package/dist/providers/ollama-chat.js +292 -0
- package/dist/providers/ollama-chat.js.map +1 -0
- package/dist/providers/openai-chat.d.ts +147 -0
- package/dist/providers/openai-chat.d.ts.map +1 -0
- package/dist/providers/openai-chat.js +302 -0
- package/dist/providers/openai-chat.js.map +1 -0
- package/dist/providers/pkce.d.ts +81 -0
- package/dist/providers/pkce.d.ts.map +1 -0
- package/dist/providers/pkce.js +176 -0
- package/dist/providers/pkce.js.map +1 -0
- package/dist/providers/sse-decode.d.ts +47 -0
- package/dist/providers/sse-decode.d.ts.map +1 -0
- package/dist/providers/sse-decode.js +109 -0
- package/dist/providers/sse-decode.js.map +1 -0
- package/dist/providers/token-params.d.ts +29 -0
- package/dist/providers/token-params.d.ts.map +1 -0
- package/dist/providers/token-params.js +41 -0
- package/dist/providers/token-params.js.map +1 -0
- package/dist/providers/turn-end-guard.d.ts +37 -0
- package/dist/providers/turn-end-guard.d.ts.map +1 -0
- package/dist/providers/turn-end-guard.js +42 -0
- package/dist/providers/turn-end-guard.js.map +1 -0
- package/dist/providers/types.d.ts +36 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +13 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/qoder-stream.d.ts +19 -0
- package/dist/qoder-stream.d.ts.map +1 -0
- package/dist/qoder-stream.js +167 -0
- package/dist/qoder-stream.js.map +1 -0
- package/dist/registry.d.ts +5 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +58 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolution.d.ts +2 -0
- package/dist/resolution.d.ts.map +1 -0
- package/dist/resolution.js +19 -0
- package/dist/resolution.js.map +1 -0
- package/dist/role-marker-guard.d.ts +53 -0
- package/dist/role-marker-guard.d.ts.map +1 -0
- package/dist/role-marker-guard.js +280 -0
- package/dist/role-marker-guard.js.map +1 -0
- package/dist/telemetry-sink.d.ts +35 -0
- package/dist/telemetry-sink.d.ts.map +1 -0
- package/dist/telemetry-sink.js +5 -0
- package/dist/telemetry-sink.js.map +1 -0
- package/dist/terminal-launch.d.ts +11 -0
- package/dist/terminal-launch.d.ts.map +1 -0
- package/dist/terminal-launch.js +123 -0
- package/dist/terminal-launch.js.map +1 -0
- package/dist/types.d.ts +185 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** @module agent-protocol/acp/rpc
|
|
2
|
+
* JSON-RPC 2.0 send helpers, error-shape parsers, usage normaliser, and
|
|
3
|
+
* permission-outcome selector for the ACP protocol layer. Depends on
|
|
4
|
+
* acp/types and acp/json; consumed by acp/session.ts and acp/models.ts.
|
|
5
|
+
*/
|
|
6
|
+
import type { JsonRpcId, RpcWritable } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Writes a JSON-RPC 2.0 request frame to `writable` as a single newline-terminated
|
|
9
|
+
* line. Used to send ACP method calls (e.g. `initialize`, `session/new`,
|
|
10
|
+
* `session/prompt`) to an agent subprocess's stdin.
|
|
11
|
+
*
|
|
12
|
+
* @param writable - The agent's stdin (or equivalent writable).
|
|
13
|
+
* @param id - The JSON-RPC request id used to correlate the response.
|
|
14
|
+
* @param method - The RPC method name.
|
|
15
|
+
* @param params - The method parameter payload (any JSON-serialisable value).
|
|
16
|
+
*/
|
|
17
|
+
export declare function sendRpc(writable: RpcWritable, id: JsonRpcId, method: string, params: unknown): void;
|
|
18
|
+
/**
|
|
19
|
+
* Writes a JSON-RPC 2.0 result response frame to `writable`. Used to reply to
|
|
20
|
+
* incoming `session/request_permission` calls from an ACP agent.
|
|
21
|
+
*
|
|
22
|
+
* @param writable - The agent's stdin (or equivalent writable).
|
|
23
|
+
* @param id - The id from the incoming request being answered.
|
|
24
|
+
* @param result - The result payload to include in the response.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sendRpcResult(writable: RpcWritable, id: JsonRpcId, result: unknown): void;
|
|
27
|
+
/**
|
|
28
|
+
* Type guard that returns `true` when `value` is a valid JSON-RPC id
|
|
29
|
+
* (a `number` or `string`). Used before replying to incoming requests.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isJsonRpcId(value: unknown): value is JsonRpcId;
|
|
32
|
+
/**
|
|
33
|
+
* Extracts a human-readable error message from a raw JSON-RPC response object
|
|
34
|
+
* that contains an `error` field. Returns an empty string when the response
|
|
35
|
+
* is not an error frame, allowing callers to use it as a truthy check.
|
|
36
|
+
*
|
|
37
|
+
* @param raw - A parsed JSON-RPC response object (unknown shape).
|
|
38
|
+
* @returns A non-empty error message string, or `''` when not an error response.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rpcErrorMessage(raw: unknown): string;
|
|
41
|
+
/**
|
|
42
|
+
* Extracts the structured `data` field from a JSON-RPC error response's `error`
|
|
43
|
+
* object, if present. Used to retrieve typed failure details (e.g. `retryable`,
|
|
44
|
+
* vendor-specific error codes) without throwing.
|
|
45
|
+
*
|
|
46
|
+
* @param raw - A parsed JSON-RPC response object (unknown shape).
|
|
47
|
+
* @returns The `error.data` value, or `undefined` when absent.
|
|
48
|
+
*/
|
|
49
|
+
export declare function rpcErrorData(raw: unknown): unknown;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the `retryable` boolean from a structured RPC error `data` payload.
|
|
52
|
+
* Returns `undefined` when the field is absent so callers can distinguish
|
|
53
|
+
* "explicitly false" from "not present" and apply their own default.
|
|
54
|
+
*
|
|
55
|
+
* @param data - The value of `error.data` extracted via `rpcErrorData`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function rpcErrorRetryable(data: unknown): boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Promotes an opencode `ROLE_MARKER_HALLUCINATION` error embedded in an ACP
|
|
60
|
+
* JSON-RPC `error.data` payload into a canonical, structured error object.
|
|
61
|
+
* Returns `null` when the data payload does not match the expected shape.
|
|
62
|
+
* Exists so callers can surface a vendor-specific failure with a structured
|
|
63
|
+
* error code rather than a bare generic message.
|
|
64
|
+
*
|
|
65
|
+
* @param data - The `error.data` field from a JSON-RPC error response.
|
|
66
|
+
* @param fallbackMessage - Used when the payload's `message` field is blank.
|
|
67
|
+
* @returns A structured error payload, or `null` when not applicable.
|
|
68
|
+
*/
|
|
69
|
+
export declare function promotedOpenCodeSessionErrorPayload(data: unknown, fallbackMessage: string): {
|
|
70
|
+
message: string;
|
|
71
|
+
error: {
|
|
72
|
+
code: string;
|
|
73
|
+
message: string;
|
|
74
|
+
retryable: boolean;
|
|
75
|
+
details: {
|
|
76
|
+
promoted_by: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
} | null;
|
|
80
|
+
/** Normalised token-usage counters extracted from an ACP session result for downstream analytics and cost tracking. */
|
|
81
|
+
export interface FormattedUsage {
|
|
82
|
+
input_tokens?: number;
|
|
83
|
+
output_tokens?: number;
|
|
84
|
+
cached_read_tokens?: number;
|
|
85
|
+
thought_tokens?: number;
|
|
86
|
+
total_tokens?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Normalises an ACP agent's raw `usage` object (camelCase keys) into the
|
|
90
|
+
* snake_case `FormattedUsage` shape used by the daemon event stream. Returns
|
|
91
|
+
* `null` when the input is not a recognisable usage object or has no known
|
|
92
|
+
* fields.
|
|
93
|
+
*
|
|
94
|
+
* @param usage - The raw `result.usage` value from a `session/prompt` response.
|
|
95
|
+
* @returns A `FormattedUsage` object with at least one field, or `null`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function formatUsage(usage: unknown): FormattedUsage | null;
|
|
98
|
+
/**
|
|
99
|
+
* Selects the best permission-outcome `optionId` to reply with when an ACP
|
|
100
|
+
* agent sends a `session/request_permission` request. Prefers
|
|
101
|
+
* `approve_for_session`, then `allow_always`, then `allow_once`.
|
|
102
|
+
*
|
|
103
|
+
* @param options - The `params.options` array from the incoming permission request.
|
|
104
|
+
* @returns The chosen `optionId` string, or `null` when no approvable option is found.
|
|
105
|
+
*/
|
|
106
|
+
export declare function choosePermissionOutcome(options: unknown): string | null;
|
|
107
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../../src/agent-protocol/acp/rpc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAInG;AACD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAEzF;AACD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AACD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAepD;AACD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIlD;AACD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAGpE;AACD;;;;;;;;;;GAUG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM;;;;;;;;;;SAyBzF;AACD,uHAAuH;AACvH,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAYjE;AACD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASvE"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { asObject } from './json.js';
|
|
2
|
+
/**
|
|
3
|
+
* Writes a JSON-RPC 2.0 request frame to `writable` as a single newline-terminated
|
|
4
|
+
* line. Used to send ACP method calls (e.g. `initialize`, `session/new`,
|
|
5
|
+
* `session/prompt`) to an agent subprocess's stdin.
|
|
6
|
+
*
|
|
7
|
+
* @param writable - The agent's stdin (or equivalent writable).
|
|
8
|
+
* @param id - The JSON-RPC request id used to correlate the response.
|
|
9
|
+
* @param method - The RPC method name.
|
|
10
|
+
* @param params - The method parameter payload (any JSON-serialisable value).
|
|
11
|
+
*/
|
|
12
|
+
export function sendRpc(writable, id, method, params) {
|
|
13
|
+
writable.write(`${JSON.stringify({ jsonrpc: '2.0', id, method, params })}\n`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Writes a JSON-RPC 2.0 result response frame to `writable`. Used to reply to
|
|
17
|
+
* incoming `session/request_permission` calls from an ACP agent.
|
|
18
|
+
*
|
|
19
|
+
* @param writable - The agent's stdin (or equivalent writable).
|
|
20
|
+
* @param id - The id from the incoming request being answered.
|
|
21
|
+
* @param result - The result payload to include in the response.
|
|
22
|
+
*/
|
|
23
|
+
export function sendRpcResult(writable, id, result) {
|
|
24
|
+
writable.write(`${JSON.stringify({ jsonrpc: '2.0', id, result })}\n`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Type guard that returns `true` when `value` is a valid JSON-RPC id
|
|
28
|
+
* (a `number` or `string`). Used before replying to incoming requests.
|
|
29
|
+
*/
|
|
30
|
+
export function isJsonRpcId(value) {
|
|
31
|
+
return typeof value === 'number' || typeof value === 'string';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extracts a human-readable error message from a raw JSON-RPC response object
|
|
35
|
+
* that contains an `error` field. Returns an empty string when the response
|
|
36
|
+
* is not an error frame, allowing callers to use it as a truthy check.
|
|
37
|
+
*
|
|
38
|
+
* @param raw - A parsed JSON-RPC response object (unknown shape).
|
|
39
|
+
* @returns A non-empty error message string, or `''` when not an error response.
|
|
40
|
+
*/
|
|
41
|
+
export function rpcErrorMessage(raw) {
|
|
42
|
+
const obj = asObject(raw);
|
|
43
|
+
const error = asObject(obj?.error);
|
|
44
|
+
if (!obj || !error) {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
const message = typeof error.message === 'string'
|
|
48
|
+
? error.message
|
|
49
|
+
: typeof error.code === 'number'
|
|
50
|
+
? String(error.code)
|
|
51
|
+
: 'json-rpc error';
|
|
52
|
+
return typeof obj.id === 'number'
|
|
53
|
+
? `json-rpc id ${obj.id}: ${message}`
|
|
54
|
+
: message;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Extracts the structured `data` field from a JSON-RPC error response's `error`
|
|
58
|
+
* object, if present. Used to retrieve typed failure details (e.g. `retryable`,
|
|
59
|
+
* vendor-specific error codes) without throwing.
|
|
60
|
+
*
|
|
61
|
+
* @param raw - A parsed JSON-RPC response object (unknown shape).
|
|
62
|
+
* @returns The `error.data` value, or `undefined` when absent.
|
|
63
|
+
*/
|
|
64
|
+
export function rpcErrorData(raw) {
|
|
65
|
+
const obj = asObject(raw);
|
|
66
|
+
const error = asObject(obj?.error);
|
|
67
|
+
return error && 'data' in error ? error.data : undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Reads the `retryable` boolean from a structured RPC error `data` payload.
|
|
71
|
+
* Returns `undefined` when the field is absent so callers can distinguish
|
|
72
|
+
* "explicitly false" from "not present" and apply their own default.
|
|
73
|
+
*
|
|
74
|
+
* @param data - The value of `error.data` extracted via `rpcErrorData`.
|
|
75
|
+
*/
|
|
76
|
+
export function rpcErrorRetryable(data) {
|
|
77
|
+
const details = asObject(data);
|
|
78
|
+
return typeof details?.retryable === 'boolean' ? details.retryable : undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Promotes an opencode `ROLE_MARKER_HALLUCINATION` error embedded in an ACP
|
|
82
|
+
* JSON-RPC `error.data` payload into a canonical, structured error object.
|
|
83
|
+
* Returns `null` when the data payload does not match the expected shape.
|
|
84
|
+
* Exists so callers can surface a vendor-specific failure with a structured
|
|
85
|
+
* error code rather than a bare generic message.
|
|
86
|
+
*
|
|
87
|
+
* @param data - The `error.data` field from a JSON-RPC error response.
|
|
88
|
+
* @param fallbackMessage - Used when the payload's `message` field is blank.
|
|
89
|
+
* @returns A structured error payload, or `null` when not applicable.
|
|
90
|
+
*/
|
|
91
|
+
export function promotedOpenCodeSessionErrorPayload(data, fallbackMessage) {
|
|
92
|
+
const details = asObject(data);
|
|
93
|
+
if (details?.kind !== 'opencode_session_error' ||
|
|
94
|
+
details.source !== 'opencode' ||
|
|
95
|
+
details.code !== 'ROLE_MARKER_HALLUCINATION') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const message = typeof details.message === 'string' && details.message.trim()
|
|
99
|
+
? details.message.trim()
|
|
100
|
+
: fallbackMessage;
|
|
101
|
+
return {
|
|
102
|
+
message,
|
|
103
|
+
error: {
|
|
104
|
+
code: 'ROLE_MARKER_HALLUCINATION',
|
|
105
|
+
message,
|
|
106
|
+
retryable: typeof details.retryable === 'boolean' ? details.retryable : true,
|
|
107
|
+
details: {
|
|
108
|
+
...details,
|
|
109
|
+
promoted_by: 'agent_runtime_acp',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Normalises an ACP agent's raw `usage` object (camelCase keys) into the
|
|
116
|
+
* snake_case `FormattedUsage` shape used by the daemon event stream. Returns
|
|
117
|
+
* `null` when the input is not a recognisable usage object or has no known
|
|
118
|
+
* fields.
|
|
119
|
+
*
|
|
120
|
+
* @param usage - The raw `result.usage` value from a `session/prompt` response.
|
|
121
|
+
* @returns A `FormattedUsage` object with at least one field, or `null`.
|
|
122
|
+
*/
|
|
123
|
+
export function formatUsage(usage) {
|
|
124
|
+
const src = asObject(usage);
|
|
125
|
+
if (!src)
|
|
126
|
+
return null;
|
|
127
|
+
const out = {};
|
|
128
|
+
if (typeof src.inputTokens === 'number')
|
|
129
|
+
out.input_tokens = src.inputTokens;
|
|
130
|
+
if (typeof src.outputTokens === 'number')
|
|
131
|
+
out.output_tokens = src.outputTokens;
|
|
132
|
+
if (typeof src.cachedReadTokens === 'number') {
|
|
133
|
+
out.cached_read_tokens = src.cachedReadTokens;
|
|
134
|
+
}
|
|
135
|
+
if (typeof src.thoughtTokens === 'number')
|
|
136
|
+
out.thought_tokens = src.thoughtTokens;
|
|
137
|
+
if (typeof src.totalTokens === 'number')
|
|
138
|
+
out.total_tokens = src.totalTokens;
|
|
139
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Selects the best permission-outcome `optionId` to reply with when an ACP
|
|
143
|
+
* agent sends a `session/request_permission` request. Prefers
|
|
144
|
+
* `approve_for_session`, then `allow_always`, then `allow_once`.
|
|
145
|
+
*
|
|
146
|
+
* @param options - The `params.options` array from the incoming permission request.
|
|
147
|
+
* @returns The chosen `optionId` string, or `null` when no approvable option is found.
|
|
148
|
+
*/
|
|
149
|
+
export function choosePermissionOutcome(options) {
|
|
150
|
+
const list = Array.isArray(options) ? options : [];
|
|
151
|
+
const approveForSession = list.find((option) => option?.optionId === 'approve_for_session');
|
|
152
|
+
if (approveForSession)
|
|
153
|
+
return 'approve_for_session';
|
|
154
|
+
const allowAlways = list.find((option) => option?.kind === 'allow_always');
|
|
155
|
+
if (allowAlways?.optionId)
|
|
156
|
+
return allowAlways.optionId;
|
|
157
|
+
const allowOnce = list.find((option) => option?.kind === 'allow_once');
|
|
158
|
+
if (allowOnce?.optionId)
|
|
159
|
+
return allowOnce.optionId;
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../src/agent-protocol/acp/rpc.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,QAAqB,EAAE,EAAa,EAAE,MAAc,EAAE,MAAe;IAC3F,QAAQ,CAAC,KAAK,CACZ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,CAC9D,CAAC;AACJ,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,QAAqB,EAAE,EAAa,EAAE,MAAe;IACjF,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AACD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAChE,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,OA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W,CAAC;IAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,qBAAqB,CAAC,CAAC;IAC5F,IAAI,iBAAiB;QAAE,OAAO,qBAAqB,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,cAAc,CAAC,CAAC;IAC3E,IAAI,WAAW,EAAE,QAAQ;QAAE,OAAO,WAAW,CAAC,QAAQ,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC;IACvE,IAAI,SAAS,EAAE,QAAQ;QAAE,OAAO,SAAS,CAAC,QAAQ,CAAC;IACnD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loose descriptor for a single MCP server entry as supplied by a caller.
|
|
3
|
+
* All fields are typed `unknown` so the builder can safely normalise them
|
|
4
|
+
* without trusting the caller's type discipline.
|
|
5
|
+
*/
|
|
6
|
+
export interface AcpMcpServerInput {
|
|
7
|
+
type?: unknown;
|
|
8
|
+
name?: unknown;
|
|
9
|
+
command?: unknown;
|
|
10
|
+
args?: unknown;
|
|
11
|
+
env?: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Options accepted by `buildAcpSessionNewParams` controlling optional MCP
|
|
15
|
+
* server injection and the env-field wire format used by the target agent.
|
|
16
|
+
*/
|
|
17
|
+
export interface AcpSessionOptions {
|
|
18
|
+
mcpServers?: AcpMcpServerInput[];
|
|
19
|
+
envFormat?: 'array' | 'map';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds the params object for an ACP `session/new` JSON-RPC call. Resolves
|
|
23
|
+
* `cwd` to an absolute path and normalises each MCP server entry's `env` field
|
|
24
|
+
* between `'array'` format (`[{name, value}]`, default, used by Hermes/Kimi)
|
|
25
|
+
* and `'map'` format (`{"KEY": "val"}`, used by reasonix and standard MCP).
|
|
26
|
+
*
|
|
27
|
+
* MCP is optional — omit `mcpServers` to run without it. Never auto-installs
|
|
28
|
+
* or mutates user/global MCP config.
|
|
29
|
+
*
|
|
30
|
+
* @param cwd - The working directory to pass to the ACP agent subprocess.
|
|
31
|
+
* @param options - Optional MCP server list and env-format selector.
|
|
32
|
+
* @returns The `session/new` params object ready for JSON-RPC serialisation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildAcpSessionNewParams(cwd: string, { mcpServers, envFormat }?: AcpSessionOptions): {
|
|
35
|
+
cwd: string;
|
|
36
|
+
mcpServers: {
|
|
37
|
+
type: string;
|
|
38
|
+
name: string;
|
|
39
|
+
command: string;
|
|
40
|
+
args: any[];
|
|
41
|
+
env: any;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Assembles the `prompt` array for a `session/prompt` ACP call. Always
|
|
46
|
+
* includes a leading `{ type: 'text', text: prompt }` block, followed by
|
|
47
|
+
* one `{ type: 'resource_link', uri: imagePath }` block per non-empty image
|
|
48
|
+
* path. Empty or non-string paths are silently skipped.
|
|
49
|
+
*
|
|
50
|
+
* @param prompt - The text prompt to send as the first block.
|
|
51
|
+
* @param imagePaths - Optional image attachment paths to append.
|
|
52
|
+
* @returns An array of prompt blocks ready for inclusion in `session/prompt` params.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildPromptBlocks(prompt: string, imagePaths: string[]): Array<Record<string, string>>;
|
|
55
|
+
//# sourceMappingURL=session-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-params.d.ts","sourceRoot":"","sources":["../../../src/agent-protocol/acp/session-params.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAIjC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAC7B;AACD;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,SAAmB,EAAE,GAAE,iBAAsB;;;;;;;;;EA2ChH;AACD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAOrG"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** @module agent-protocol/acp/session-params
|
|
2
|
+
* Builds the `session/new` parameter object and prompt blocks sent to an ACP
|
|
3
|
+
* agent subprocess at session start. Handles MCP server descriptor normalisation
|
|
4
|
+
* and env-format conversion (array vs map). Consumed by acp/session.ts and
|
|
5
|
+
* acp/models.ts; depends only on Node path.
|
|
6
|
+
*/
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
/**
|
|
9
|
+
* Builds the params object for an ACP `session/new` JSON-RPC call. Resolves
|
|
10
|
+
* `cwd` to an absolute path and normalises each MCP server entry's `env` field
|
|
11
|
+
* between `'array'` format (`[{name, value}]`, default, used by Hermes/Kimi)
|
|
12
|
+
* and `'map'` format (`{"KEY": "val"}`, used by reasonix and standard MCP).
|
|
13
|
+
*
|
|
14
|
+
* MCP is optional — omit `mcpServers` to run without it. Never auto-installs
|
|
15
|
+
* or mutates user/global MCP config.
|
|
16
|
+
*
|
|
17
|
+
* @param cwd - The working directory to pass to the ACP agent subprocess.
|
|
18
|
+
* @param options - Optional MCP server list and env-format selector.
|
|
19
|
+
* @returns The `session/new` params object ready for JSON-RPC serialisation.
|
|
20
|
+
*/
|
|
21
|
+
export function buildAcpSessionNewParams(cwd, { mcpServers, envFormat = 'array' } = {}) {
|
|
22
|
+
const servers = Array.isArray(mcpServers) ? mcpServers : [];
|
|
23
|
+
const wantsMap = envFormat === 'map';
|
|
24
|
+
return {
|
|
25
|
+
cwd: path.resolve(cwd),
|
|
26
|
+
// MCP is an optional compatibility layer. Default to no MCP servers so ACP
|
|
27
|
+
// agents can run through the skill + CLI path without MCP support. Do not
|
|
28
|
+
// auto-install or mutate user/global MCP config; callers must pass an
|
|
29
|
+
// explicit per-session MCP descriptor when a compatible agent supports it.
|
|
30
|
+
mcpServers: servers.map((s) => {
|
|
31
|
+
const rawEnv = s?.env;
|
|
32
|
+
// Already a plain object — pass through in map mode, convert to
|
|
33
|
+
// array in array mode (e.g. live-artifacts MCP from
|
|
34
|
+
// buildLiveArtifactsMcpServersForAgent which already respects
|
|
35
|
+
// acpMcpEnvFormat).
|
|
36
|
+
const isPlainObject = rawEnv && typeof rawEnv === 'object' && !Array.isArray(rawEnv);
|
|
37
|
+
if (wantsMap && isPlainObject) {
|
|
38
|
+
return {
|
|
39
|
+
type: typeof s?.type === 'string' ? s.type : 'stdio',
|
|
40
|
+
name: typeof s?.name === 'string' ? s.name : '',
|
|
41
|
+
command: typeof s?.command === 'string' ? s.command : '',
|
|
42
|
+
args: Array.isArray(s?.args) ? s.args : [],
|
|
43
|
+
env: rawEnv,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const envArr = Array.isArray(rawEnv) ? rawEnv : [];
|
|
47
|
+
const env = wantsMap
|
|
48
|
+
? Object.fromEntries(envArr.map((e) => [e?.name ?? '', e?.value ?? '']))
|
|
49
|
+
: isPlainObject
|
|
50
|
+
? Object.entries(rawEnv).map(([name, value]) => ({ name, value }))
|
|
51
|
+
: envArr;
|
|
52
|
+
return {
|
|
53
|
+
type: typeof s?.type === 'string' ? s.type : 'stdio',
|
|
54
|
+
name: typeof s?.name === 'string' ? s.name : '',
|
|
55
|
+
command: typeof s?.command === 'string' ? s.command : '',
|
|
56
|
+
args: Array.isArray(s?.args) ? s.args : [],
|
|
57
|
+
env,
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Assembles the `prompt` array for a `session/prompt` ACP call. Always
|
|
64
|
+
* includes a leading `{ type: 'text', text: prompt }` block, followed by
|
|
65
|
+
* one `{ type: 'resource_link', uri: imagePath }` block per non-empty image
|
|
66
|
+
* path. Empty or non-string paths are silently skipped.
|
|
67
|
+
*
|
|
68
|
+
* @param prompt - The text prompt to send as the first block.
|
|
69
|
+
* @param imagePaths - Optional image attachment paths to append.
|
|
70
|
+
* @returns An array of prompt blocks ready for inclusion in `session/prompt` params.
|
|
71
|
+
*/
|
|
72
|
+
export function buildPromptBlocks(prompt, imagePaths) {
|
|
73
|
+
const blocks = [{ type: 'text', text: prompt }];
|
|
74
|
+
for (const imagePath of imagePaths) {
|
|
75
|
+
if (typeof imagePath !== 'string' || imagePath.trim().length === 0)
|
|
76
|
+
continue;
|
|
77
|
+
blocks.push({ type: 'resource_link', uri: imagePath });
|
|
78
|
+
}
|
|
79
|
+
return blocks;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=session-params.js.map
|
|
@@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AC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAC1C,GAAG;aACJ,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AACD;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,UAAoB;IACpE,MAAM,MAAM,GAAkC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/E,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAC7E,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ExecutionProfile } from './types.js';
|
|
2
|
+
import type { JsonRpcId, JsonObject, AcpChildProcess } from './types.js';
|
|
3
|
+
import { type AcpMcpServerInput } from './session-params.js';
|
|
4
|
+
import { type AccountFailureClassifier } from './account-failure.js';
|
|
5
|
+
/** One option offered by an ACP agent for a pending tool permission request. */
|
|
6
|
+
export interface AcpPermissionOption {
|
|
7
|
+
readonly optionId: string;
|
|
8
|
+
readonly kind?: string;
|
|
9
|
+
readonly name?: string;
|
|
10
|
+
readonly [key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The complete, host-auditable context for an ACP agent's request to perform
|
|
14
|
+
* one of *its own* tool calls. Selecting an option authorizes or rejects the
|
|
15
|
+
* agent's native tool execution; it is intentionally distinct from Jini's
|
|
16
|
+
* `ToolExecutor`, which only executes Jini-registered delegated tools.
|
|
17
|
+
*/
|
|
18
|
+
export interface AcpPermissionRequest {
|
|
19
|
+
readonly requestId: JsonRpcId;
|
|
20
|
+
readonly sessionId: string | null;
|
|
21
|
+
readonly toolCall: JsonObject | null;
|
|
22
|
+
readonly options: readonly AcpPermissionOption[];
|
|
23
|
+
/** Original ACP request parameters for forward-compatible audit storage. */
|
|
24
|
+
readonly rawParams: JsonObject;
|
|
25
|
+
}
|
|
26
|
+
/** A host's response to an {@link AcpPermissionRequest}. */
|
|
27
|
+
export type AcpPermissionDecision = {
|
|
28
|
+
readonly outcome: 'selected';
|
|
29
|
+
readonly optionId: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly outcome: 'cancelled';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Injected ACP authorization seam. It may be async so a host can persist an
|
|
35
|
+
* audit record or await an interactive policy decision before replying.
|
|
36
|
+
*/
|
|
37
|
+
export type AcpPermissionHandler = (request: AcpPermissionRequest) => AcpPermissionDecision | Promise<AcpPermissionDecision>;
|
|
38
|
+
/** Public state/abort handle returned by {@link attachAcpSession}. */
|
|
39
|
+
export interface AcpSessionController {
|
|
40
|
+
hasFatalError(): boolean;
|
|
41
|
+
getDurableSessionId(): string | null;
|
|
42
|
+
completedSuccessfully(): boolean;
|
|
43
|
+
abort(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for `attachAcpSession`. All fields except `child`, `prompt`, and
|
|
47
|
+
* `send` are optional and carry sensible defaults.
|
|
48
|
+
*/
|
|
49
|
+
export interface AttachAcpSessionOptions {
|
|
50
|
+
child: AcpChildProcess;
|
|
51
|
+
prompt: string;
|
|
52
|
+
cwd?: string;
|
|
53
|
+
model?: string | null;
|
|
54
|
+
imagePaths?: string[];
|
|
55
|
+
mcpServers?: AcpMcpServerInput[];
|
|
56
|
+
envFormat?: 'array' | 'map';
|
|
57
|
+
send: (event: string, payload: unknown) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Receives every native ACP tool-permission request before the agent can
|
|
60
|
+
* execute it. Omit it only when the host intends the session to fail closed
|
|
61
|
+
* on its first permission request; a runnable ACP host injects a policy
|
|
62
|
+
* that records and selects an offered option.
|
|
63
|
+
*/
|
|
64
|
+
onPermissionRequest?: AcpPermissionHandler;
|
|
65
|
+
clientName?: string;
|
|
66
|
+
clientVersion?: string;
|
|
67
|
+
stageTimeoutMs?: number;
|
|
68
|
+
executionProfile?: ExecutionProfile;
|
|
69
|
+
modelUnavailableErrorCode?: 'AMR_MODEL_UNAVAILABLE';
|
|
70
|
+
accountFailureClassifier?: AccountFailureClassifier;
|
|
71
|
+
resumeSessionId?: string | null;
|
|
72
|
+
onCliReady?: () => void;
|
|
73
|
+
onSessionInit?: () => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Attaches an ACP protocol session to an already-spawned child process and
|
|
77
|
+
* drives the full JSON-RPC conversation from handshake to prompt completion.
|
|
78
|
+
*
|
|
79
|
+
* Sequence:
|
|
80
|
+
* 1. Sends `initialize` to confirm the protocol version.
|
|
81
|
+
* 2. Sends `session/new` (or `session/load` when `resumeSessionId` is set).
|
|
82
|
+
* 3. Optionally sends `session/set_model` when a non-default model is requested.
|
|
83
|
+
* 4. Sends `session/prompt` with the user's prompt and any image attachments.
|
|
84
|
+
* 5. Streams `session/update` events to the `send` callback, translating:
|
|
85
|
+
* - `agent_thought_chunk` → `thinking_start` / `thinking_delta`
|
|
86
|
+
* - `agent_message_chunk` → `text_delta` (with DSML and tool-call text suppression)
|
|
87
|
+
* - `tool_call` / `tool_call_update` → deferred `tool_use` / `tool_result` pairs
|
|
88
|
+
* - status updates → `agent.status` events
|
|
89
|
+
* 6. Handles `session/request_permission` calls through an injected policy,
|
|
90
|
+
* failing closed when no policy is supplied.
|
|
91
|
+
* 7. On prompt completion, flushes suppression buffers, emits usage, and closes stdin.
|
|
92
|
+
*
|
|
93
|
+
* Returns a controller object that the caller may use to query session state
|
|
94
|
+
* and to abort the in-progress turn.
|
|
95
|
+
*
|
|
96
|
+
* @param options - See `AttachAcpSessionOptions` for all fields.
|
|
97
|
+
* @returns A controller with `hasFatalError`, `getDurableSessionId`,
|
|
98
|
+
* `completedSuccessfully`, and `abort` methods.
|
|
99
|
+
*/
|
|
100
|
+
export declare function attachAcpSession({ child, prompt, cwd, model, imagePaths, mcpServers, envFormat, send, clientName, clientVersion, stageTimeoutMs, executionProfile, modelUnavailableErrorCode, accountFailureClassifier, resumeSessionId, onPermissionRequest, onCliReady, onSessionInit, }: AttachAcpSessionOptions): AcpSessionController;
|
|
101
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-protocol/acp/session.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAOnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAe,eAAe,EAAE,MAAM,YAAY,CAAC;AAmCtF,OAAO,EAA+C,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EAAgC,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEnG,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAChC;AAED,4DAA4D;AA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