@jini-ai/agent-runtime 0.7.2 → 0.7.3-next.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/CHANGELOG.md +3 -13
- package/README.md +1 -0
- package/dist/acp-model-probe.d.ts +2 -3
- package/dist/acp-model-probe.js +1 -1
- package/dist/agent-protocol/acp/account-failure.d.ts +3 -1
- package/dist/agent-protocol/acp/account-failure.js +1 -1
- package/dist/agent-protocol/acp/constants.d.ts +3 -1
- package/dist/agent-protocol/acp/constants.js +2 -0
- package/dist/agent-protocol/acp/index.d.ts +2 -1
- package/dist/agent-protocol/acp/index.js +2 -1
- package/dist/agent-protocol/acp/json.d.ts +26 -7
- package/dist/agent-protocol/acp/json.js +11 -11
- package/dist/agent-protocol/acp/models.d.ts +26 -6
- package/dist/agent-protocol/acp/models.js +157 -129
- package/dist/agent-protocol/acp/rpc.d.ts +37 -9
- package/dist/agent-protocol/acp/rpc.js +19 -16
- package/dist/agent-protocol/acp/session-params.d.ts +4 -1
- package/dist/agent-protocol/acp/session-params.js +1 -1
- package/dist/agent-protocol/acp/session-permission.d.ts +13 -0
- package/dist/agent-protocol/acp/session-permission.js +110 -0
- package/dist/agent-protocol/acp/session-results.d.ts +61 -0
- package/dist/agent-protocol/acp/session-results.js +226 -0
- package/dist/agent-protocol/acp/session-run.d.ts +92 -0
- package/dist/agent-protocol/acp/session-run.js +555 -0
- package/dist/agent-protocol/acp/session-state.d.ts +9 -0
- package/dist/agent-protocol/acp/session-state.js +29 -0
- package/dist/agent-protocol/acp/session-text-updates.d.ts +56 -0
- package/dist/agent-protocol/acp/session-text-updates.js +119 -0
- package/dist/agent-protocol/acp/session-tool-updates.d.ts +21 -0
- package/dist/agent-protocol/acp/session-tool-updates.js +90 -0
- package/dist/agent-protocol/acp/session-types.d.ts +166 -0
- package/dist/agent-protocol/acp/session-types.js +4 -0
- package/dist/agent-protocol/acp/session.d.ts +4 -280
- package/dist/agent-protocol/acp/session.js +65 -998
- package/dist/agent-protocol/acp/text-suppression.d.ts +5 -1
- package/dist/agent-protocol/acp/text-suppression.js +1 -1
- package/dist/agent-protocol/acp/updates.d.ts +43 -12
- package/dist/agent-protocol/acp/updates.js +34 -34
- package/dist/agent-protocol/core/json-line-stream.d.ts +133 -36
- package/dist/agent-protocol/core/json-line-stream.js +62 -62
- package/dist/agent-protocol/pi-rpc/events.d.ts +14 -4
- package/dist/agent-protocol/pi-rpc/events.js +14 -14
- package/dist/agent-protocol/pi-rpc/internal.d.ts +9 -3
- package/dist/agent-protocol/pi-rpc/internal.js +3 -3
- package/dist/agent-protocol/pi-rpc/models.d.ts +3 -17
- package/dist/agent-protocol/pi-rpc/models.js +1 -45
- package/dist/agent-protocol/pi-rpc/session.d.ts +36 -12
- package/dist/agent-protocol/pi-rpc/session.js +134 -122
- package/dist/amr-model-cache.d.ts +1 -1
- package/dist/anthropic-live-models.d.ts +8 -3
- package/dist/anthropic-live-models.js +0 -0
- package/dist/auth-common.d.ts +2 -0
- package/dist/auth-common.js +2 -0
- package/dist/auth.d.ts +7 -34
- package/dist/auth.js +25 -139
- package/dist/capabilities.d.ts +1 -1
- package/dist/claude-code-models.d.ts +13 -5
- package/dist/claude-code-models.js +12 -10
- package/dist/claude-filesystem-policy.d.ts +1 -1
- package/dist/claude-stream-frames.d.ts +125 -0
- package/dist/claude-stream-frames.js +327 -0
- package/dist/claude-stream-handler.d.ts +19 -0
- package/dist/claude-stream-handler.js +480 -0
- package/dist/claude-stream.d.ts +3 -72
- package/dist/claude-stream.js +2 -801
- package/dist/core/model-discovery-shared.d.ts +14 -8
- package/dist/core/model-discovery-shared.js +6 -9
- package/dist/core/omit-keys.d.ts +4 -1
- package/dist/core/omit-keys.js +1 -1
- package/dist/defs/aider/executable.d.ts +2 -0
- package/dist/defs/aider/executable.js +2 -0
- package/dist/defs/aider/model-discovery.d.ts +3 -0
- package/dist/defs/aider/model-discovery.js +6 -0
- package/dist/defs/aider.d.ts +10 -10
- package/dist/defs/amp/index.d.ts +35 -0
- package/dist/defs/amp/index.js +75 -0
- package/dist/defs/amp.d.ts +1 -34
- package/dist/defs/amp.js +1 -74
- package/dist/defs/amr/executable-resolution.d.ts +7 -0
- package/dist/defs/amr/executable-resolution.js +50 -0
- package/dist/defs/amr/executable.d.ts +2 -0
- package/dist/defs/amr/executable.js +2 -0
- package/dist/defs/amr/index.d.ts +69 -0
- package/dist/defs/amr/index.js +279 -0
- package/dist/defs/amr/model-discovery.d.ts +3 -0
- package/dist/defs/amr/model-discovery.js +4 -0
- package/dist/defs/amr.d.ts +1 -68
- package/dist/defs/amr.js +1 -291
- package/dist/defs/antigravity/auth.d.ts +14 -0
- package/dist/defs/antigravity/auth.js +47 -0
- package/dist/defs/antigravity/index.d.ts +9 -9
- package/dist/defs/antigravity/index.js +3 -3
- package/dist/defs/antigravity/model-discovery.d.ts +3 -0
- package/dist/defs/antigravity/model-discovery.js +5 -0
- package/dist/defs/auggie/executable.d.ts +2 -0
- package/dist/defs/auggie/executable.js +2 -0
- package/dist/defs/auggie.d.ts +13 -13
- package/dist/defs/auggie.js +2 -9
- package/dist/defs/claude/auth.d.ts +15 -0
- package/dist/defs/claude/auth.js +47 -0
- package/dist/defs/claude/executable.d.ts +2 -0
- package/dist/defs/claude/executable.js +2 -0
- package/dist/defs/claude/model-discovery.d.ts +3 -0
- package/dist/defs/claude/model-discovery.js +20 -0
- package/dist/defs/claude-compatible-args.d.ts +10 -6
- package/dist/defs/claude-compatible-args.js +5 -5
- package/dist/defs/claude.d.ts +11 -11
- package/dist/defs/claude.js +5 -4
- package/dist/defs/cline/executable.d.ts +2 -0
- package/dist/defs/cline/executable.js +2 -0
- package/dist/defs/cline.d.ts +13 -13
- package/dist/defs/cline.js +2 -9
- package/dist/defs/codebuddy/executable.d.ts +2 -0
- package/dist/defs/codebuddy/executable.js +2 -0
- package/dist/defs/codebuddy/index.d.ts +48 -0
- package/dist/defs/codebuddy/index.js +121 -0
- package/dist/defs/codebuddy/model-discovery.d.ts +3 -0
- package/dist/defs/codebuddy/model-discovery.js +5 -0
- package/dist/defs/codebuddy.d.ts +1 -47
- package/dist/defs/codebuddy.js +1 -120
- package/dist/defs/codex/auth.d.ts +4 -0
- package/dist/defs/codex/auth.js +2 -0
- package/dist/defs/codex/event-stream.d.ts +10 -0
- package/dist/defs/codex/event-stream.js +353 -0
- package/dist/defs/codex/executable-resolution.d.ts +7 -0
- package/dist/defs/codex/executable-resolution.js +37 -0
- package/dist/defs/codex/executable.d.ts +2 -0
- package/dist/defs/codex/executable.js +2 -0
- package/dist/defs/codex/launch.d.ts +3 -0
- package/dist/defs/codex/launch.js +155 -0
- package/dist/defs/codex/model-discovery.d.ts +3 -0
- package/dist/defs/codex/model-discovery.js +11 -0
- package/dist/defs/codex/options.d.ts +11 -0
- package/dist/defs/codex/options.js +5 -0
- package/dist/defs/codex.d.ts +18 -11
- package/dist/defs/codex.js +32 -29
- package/dist/defs/crush/executable.d.ts +2 -0
- package/dist/defs/crush/executable.js +2 -0
- package/dist/defs/crush/model-discovery.d.ts +3 -0
- package/dist/defs/crush/model-discovery.js +6 -0
- package/dist/defs/crush.d.ts +10 -10
- package/dist/defs/cursor-agent/auth.d.ts +13 -0
- package/dist/defs/cursor-agent/auth.js +22 -0
- package/dist/defs/cursor-agent/event-stream.d.ts +8 -0
- package/dist/defs/cursor-agent/event-stream.js +104 -0
- package/dist/defs/cursor-agent/executable.d.ts +2 -0
- package/dist/defs/cursor-agent/executable.js +2 -0
- package/dist/defs/cursor-agent/model-discovery.d.ts +3 -0
- package/dist/defs/cursor-agent/model-discovery.js +5 -0
- package/dist/defs/cursor-agent.d.ts +11 -13
- package/dist/defs/cursor-agent.js +1 -1
- package/dist/defs/deepseek/auth.d.ts +13 -0
- package/dist/defs/deepseek/auth.js +18 -0
- package/dist/defs/deepseek/executable.d.ts +2 -0
- package/dist/defs/deepseek/executable.js +2 -0
- package/dist/defs/deepseek/model-discovery.d.ts +3 -0
- package/dist/defs/deepseek/model-discovery.js +5 -0
- package/dist/defs/deepseek.d.ts +10 -10
- package/dist/defs/devin/executable.d.ts +2 -0
- package/dist/defs/devin/executable.js +2 -0
- package/dist/defs/devin.d.ts +15 -15
- package/dist/defs/devin.js +3 -10
- package/dist/defs/droid/executable.d.ts +2 -0
- package/dist/defs/droid/executable.js +2 -0
- package/dist/defs/droid/model-discovery.d.ts +3 -0
- package/dist/defs/droid/model-discovery.js +5 -0
- package/dist/defs/droid.d.ts +10 -10
- package/dist/defs/gemini/event-stream.d.ts +14 -0
- package/dist/defs/gemini/event-stream.js +193 -0
- package/dist/defs/goose/executable.d.ts +2 -0
- package/dist/defs/goose/executable.js +2 -0
- package/dist/defs/goose.d.ts +13 -13
- package/dist/defs/goose.js +2 -9
- package/dist/defs/grok-build/model-discovery.d.ts +3 -0
- package/dist/defs/grok-build/model-discovery.js +5 -0
- package/dist/defs/grok-build.d.ts +10 -10
- package/dist/defs/hermes/executable.d.ts +2 -0
- package/dist/defs/hermes/executable.js +2 -0
- package/dist/defs/hermes/index.d.ts +34 -0
- package/dist/defs/hermes/index.js +57 -0
- package/dist/defs/hermes.d.ts +1 -33
- package/dist/defs/hermes.js +1 -56
- package/dist/defs/index.d.ts +1 -0
- package/dist/defs/index.js +1 -0
- package/dist/defs/kilo/executable.d.ts +2 -0
- package/dist/defs/kilo/executable.js +2 -0
- package/dist/defs/kilo.d.ts +13 -13
- package/dist/defs/kilo.js +2 -9
- package/dist/defs/kimi/event-stream.d.ts +3 -0
- package/dist/defs/kimi/event-stream.js +46 -0
- package/dist/defs/kimi/executable.d.ts +2 -0
- package/dist/defs/kimi/executable.js +2 -0
- package/dist/defs/kimi.d.ts +13 -13
- package/dist/defs/kimi.js +2 -9
- package/dist/defs/kiro/executable.d.ts +2 -0
- package/dist/defs/kiro/executable.js +2 -0
- package/dist/defs/kiro.d.ts +13 -13
- package/dist/defs/kiro.js +2 -9
- package/dist/defs/mimo/executable.d.ts +2 -0
- package/dist/defs/mimo/executable.js +2 -0
- package/dist/defs/mimo/model-discovery.d.ts +3 -0
- package/dist/defs/mimo/model-discovery.js +7 -0
- package/dist/defs/mimo.d.ts +10 -10
- package/dist/defs/opencode/event-stream.d.ts +8 -0
- package/dist/defs/opencode/event-stream.js +108 -0
- package/dist/defs/opencode/executable.d.ts +2 -0
- package/dist/defs/opencode/executable.js +2 -0
- package/dist/defs/opencode/model-discovery.d.ts +4 -0
- package/dist/defs/opencode/model-discovery.js +14 -0
- package/dist/defs/opencode-acp.d.ts +42 -0
- package/dist/defs/opencode-acp.js +23 -0
- package/dist/defs/opencode.d.ts +9 -9
- package/dist/defs/pi/executable.d.ts +2 -0
- package/dist/defs/pi/executable.js +2 -0
- package/dist/defs/pi/model-discovery.d.ts +4 -0
- package/dist/defs/pi/model-discovery.js +16 -0
- package/dist/defs/pi/options.d.ts +11 -0
- package/dist/defs/pi/options.js +5 -0
- package/dist/defs/pi.d.ts +10 -10
- package/dist/defs/qoder/executable.d.ts +2 -0
- package/dist/defs/qoder/executable.js +2 -0
- package/dist/defs/qoder/model-discovery.d.ts +3 -0
- package/dist/defs/qoder/model-discovery.js +7 -0
- package/dist/defs/qoder.d.ts +9 -9
- package/dist/defs/qwen/executable.d.ts +2 -0
- package/dist/defs/qwen/executable.js +2 -0
- package/dist/defs/qwen/model-discovery.d.ts +3 -0
- package/dist/defs/qwen/model-discovery.js +7 -0
- package/dist/defs/qwen.d.ts +10 -10
- package/dist/defs/reasonix/auth.d.ts +13 -0
- package/dist/defs/reasonix/auth.js +18 -0
- package/dist/defs/reasonix/executable.d.ts +2 -0
- package/dist/defs/reasonix/executable.js +2 -0
- package/dist/defs/reasonix.d.ts +13 -13
- package/dist/defs/reasonix.js +2 -9
- package/dist/defs/shared.d.ts +10 -2
- package/dist/defs/shared.js +5 -1
- package/dist/defs/trae-cli/executable.d.ts +2 -0
- package/dist/defs/trae-cli/executable.js +2 -0
- package/dist/defs/trae-cli.d.ts +15 -15
- package/dist/defs/trae-cli.js +2 -9
- package/dist/defs/vibe/executable.d.ts +2 -0
- package/dist/defs/vibe/executable.js +2 -0
- package/dist/defs/vibe.d.ts +13 -13
- package/dist/defs/vibe.js +2 -9
- package/dist/detection.d.ts +4 -3
- package/dist/detection.js +22 -22
- package/dist/diagnostics.d.ts +4 -4
- package/dist/diagnostics.js +2 -2
- package/dist/env.js +2 -1
- package/dist/executable-helpers.d.ts +21 -0
- package/dist/executable-helpers.js +2 -0
- package/dist/executables.d.ts +2 -2
- package/dist/executables.js +68 -114
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/dist/invocation.d.ts +22 -6
- package/dist/invocation.js +19 -17
- package/dist/json-event-stream-shared.d.ts +81 -0
- package/dist/json-event-stream-shared.js +147 -0
- package/dist/json-event-stream.d.ts +2 -4
- package/dist/json-event-stream.js +15 -940
- package/dist/launch.d.ts +1 -9
- package/dist/launch.js +6 -155
- package/dist/log-file.d.ts +2 -8
- package/dist/log-file.js +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +1 -1
- package/dist/mmd-routes.d.ts +7 -7
- package/dist/mmd-routes.js +19 -27
- package/dist/model-discovery-adapters.d.ts +47 -11
- package/dist/model-discovery-adapters.js +47 -41
- package/dist/model-discovery-config-types.d.ts +44 -0
- package/dist/model-discovery-config-types.js +20 -0
- package/dist/model-discovery-config.d.ts +19 -11
- package/dist/model-discovery-config.js +64 -87
- package/dist/model-discovery-native.d.ts +2 -1
- package/dist/model-discovery-native.js +3 -3
- package/dist/model-discovery-sdk.d.ts +6 -2
- package/dist/model-discovery-sdk.js +2 -2
- package/dist/model-discovery-types.d.ts +1 -138
- package/dist/model-discovery-yaml.d.ts +3 -1
- package/dist/model-discovery-yaml.js +1 -1
- package/dist/model-discovery.d.ts +15 -5
- package/dist/model-discovery.js +119 -105
- package/dist/model-loading-state.d.ts +1 -1
- package/dist/model-loading-state.js +1 -1
- package/dist/model-registry.d.ts +5 -5
- package/dist/model-registry.js +7 -6
- package/dist/models.d.ts +4 -3
- package/dist/models.js +2 -2
- package/dist/native-permissions.d.ts +47 -0
- package/dist/native-permissions.js +80 -0
- package/dist/native-runtime.d.ts +11 -8
- package/dist/native-runtime.js +8 -4
- package/dist/native-tool-policy.d.ts +1 -40
- package/dist/opencode-log.d.ts +3 -3
- package/dist/opencode-log.js +5 -3
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/pi-models.d.ts +12 -2
- package/dist/pi-models.js +11 -1
- package/dist/prompt-augmenter.d.ts +1 -37
- package/dist/prompt-augmenter.js +0 -6
- package/dist/prompt-budget.d.ts +3 -3
- package/dist/prompt-budget.js +2 -2
- package/dist/prompt-file.d.ts +2 -6
- package/dist/prompt-file.js +1 -1
- package/dist/providers/aihubmix.d.ts +8 -8
- package/dist/providers/aihubmix.js +8 -8
- package/dist/providers/anthropic-messages.d.ts +22 -23
- package/dist/providers/anthropic-messages.js +26 -53
- package/dist/providers/azure-chat.d.ts +7 -6
- package/dist/providers/azure-chat.js +9 -6
- package/dist/providers/connection-guard.d.ts +3 -9
- package/dist/providers/connection-guard.js +6 -14
- package/dist/providers/connection-test.d.ts +1 -2
- package/dist/providers/connection-test.js +51 -51
- package/dist/providers/credentials.d.ts +59 -0
- package/dist/providers/credentials.js +80 -0
- package/dist/providers/elevenlabs.d.ts +2 -6
- package/dist/providers/elevenlabs.js +2 -31
- package/dist/providers/google-messages.d.ts +11 -10
- package/dist/providers/google-messages.js +16 -35
- package/dist/providers/google-schema.d.ts +1 -1
- package/dist/providers/google-schema.js +1 -1
- package/dist/providers/google.d.ts +6 -6
- package/dist/providers/google.js +6 -6
- package/dist/providers/index.d.ts +5 -2
- package/dist/providers/index.js +5 -2
- package/dist/providers/model-catalog.d.ts +4 -9
- package/dist/providers/model-catalog.js +3 -11
- package/dist/providers/oauth-callback-server.js +93 -87
- package/dist/providers/oauth-provider.d.ts +1 -1
- package/dist/providers/oauth-provider.js +1 -1
- package/dist/providers/oauth-tokens.d.ts +5 -5
- package/dist/providers/oauth-tokens.js +8 -9
- package/dist/providers/ollama-chat.d.ts +13 -12
- package/dist/providers/ollama-chat.js +15 -24
- package/dist/providers/openai-chat-request.d.ts +34 -0
- package/dist/providers/openai-chat-request.js +152 -0
- package/dist/providers/openai-chat-stream.d.ts +48 -0
- package/dist/providers/openai-chat-stream.js +89 -0
- package/dist/providers/openai-chat-tool-results.d.ts +81 -0
- package/dist/providers/openai-chat-tool-results.js +124 -0
- package/dist/providers/openai-chat-types.d.ts +180 -0
- package/dist/providers/openai-chat-types.js +3 -0
- package/dist/providers/openai-chat.d.ts +5 -405
- package/dist/providers/openai-chat.js +9 -388
- package/dist/providers/pkce.d.ts +1 -1
- package/dist/providers/pkce.js +1 -1
- package/dist/providers/provider-url.d.ts +6 -0
- package/dist/providers/provider-url.js +9 -0
- package/dist/providers/response-text.d.ts +4 -0
- package/dist/providers/response-text.js +16 -0
- package/dist/providers/sse-decode.d.ts +4 -0
- package/dist/providers/sse-decode.js +11 -0
- package/dist/providers/token-params.d.ts +5 -5
- package/dist/providers/token-params.js +5 -5
- package/dist/providers/tool-loop-verdict.d.ts +1 -1
- package/dist/providers/tool-loop-verdict.js +1 -1
- package/dist/providers/tool-turn-types.d.ts +2 -1
- package/dist/providers/tool-turn.js +30 -50
- package/dist/providers/turn-end-guard.d.ts +4 -1
- package/dist/providers/turn-end-guard.js +1 -1
- package/dist/qoder-stream.d.ts +1 -1
- package/dist/qoder-stream.js +1 -1
- package/dist/registry.d.ts +5 -5
- package/dist/registry.js +4 -4
- package/dist/role-marker-guard.d.ts +13 -1
- package/dist/role-marker-guard.js +15 -1
- package/dist/runtime-def-binding.d.ts +15 -0
- package/dist/runtime-def-binding.js +19 -0
- package/dist/runtime-port-bindings.d.ts +181 -0
- package/dist/runtime-port-bindings.js +95 -0
- package/dist/runtime-state.d.ts +2 -11
- package/dist/runtime-state.js +0 -13
- package/dist/types.d.ts +1 -454
- package/package.json +27 -15
- package/dist/ai-trace/capture.d.ts +0 -17
- package/dist/ai-trace/capture.js +0 -43
- package/dist/ai-trace/classify.d.ts +0 -12
- package/dist/ai-trace/classify.js +0 -16
- package/dist/ai-trace/index.d.ts +0 -13
- package/dist/ai-trace/index.js +0 -6
- package/dist/ai-trace/recorder.d.ts +0 -64
- package/dist/ai-trace/recorder.js +0 -258
- package/dist/ai-trace/sinks.d.ts +0 -51
- package/dist/ai-trace/sinks.js +0 -153
- package/dist/ai-trace/types.d.ts +0 -123
- package/dist/ai-trace/types.js +0 -17
- package/dist/ai-trace/usage.d.ts +0 -13
- package/dist/ai-trace/usage.js +0 -45
- package/dist/copilot-stream.d.ts +0 -65
- package/dist/copilot-stream.js +0 -131
- package/dist/defs/antigravity.d.ts +0 -94
- package/dist/defs/antigravity.js +0 -320
- package/dist/defs/copilot.d.ts +0 -34
- package/dist/defs/copilot.js +0 -96
- package/dist/defs/gemini.d.ts +0 -24
- package/dist/defs/gemini.js +0 -81
- package/dist/model-contracts.d.ts +0 -29
- package/dist/model-contracts.js +0 -2
- package/dist/providers/types.d.ts +0 -36
- package/dist/providers/types.js +0 -13
package/dist/detection.js
CHANGED
|
@@ -94,7 +94,7 @@ function notInvocableCause(code) {
|
|
|
94
94
|
function unavailableModels(def) {
|
|
95
95
|
// `fallbackModels` is a required field on `RuntimeAgentDef`, never
|
|
96
96
|
// `undefined` for a well-typed def.
|
|
97
|
-
const catalog = offlineSnapshot('', Date.now(), def.fallbackModels);
|
|
97
|
+
const catalog = offlineSnapshot({ fingerprint: '', now: Date.now(), fallback: def.fallbackModels });
|
|
98
98
|
return { models: catalog.models, source: 'fallback', catalog, defaultModelResolution: { status: 'unresolved', reason: 'Agent executable is unavailable.' } };
|
|
99
99
|
}
|
|
100
100
|
function unavailableAgent(def, diagnostics = []) {
|
|
@@ -306,27 +306,27 @@ function stripFns(def) {
|
|
|
306
306
|
// matter extra because they carry closures — `JSON.stringify` would drop
|
|
307
307
|
// the functions but keep their enclosing objects, publishing a misleading
|
|
308
308
|
// `{"buffering":"until-close"}` / `{}` instead of omitting them.
|
|
309
|
-
return omitKeys(def, [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
309
|
+
return omitKeys({ source: def, keys: [
|
|
310
|
+
'discoverModels',
|
|
311
|
+
'resolveDefaultModel',
|
|
312
|
+
'buildArgs',
|
|
313
|
+
'listModels',
|
|
314
|
+
'fetchModels',
|
|
315
|
+
'deriveReasoningOptions',
|
|
316
|
+
'fallbackModels',
|
|
317
|
+
'fallbackModelsAssertedAt',
|
|
318
|
+
'helpArgs',
|
|
319
|
+
'capabilityFlags',
|
|
320
|
+
'fallbackBins',
|
|
321
|
+
'versionProbeTimeoutMs',
|
|
322
|
+
'maxPromptArgBytes',
|
|
323
|
+
'env',
|
|
324
|
+
'inactivityTimeoutMs',
|
|
325
|
+
'authProbe',
|
|
326
|
+
'needsAgentLogFile',
|
|
327
|
+
'stdoutPolicy',
|
|
328
|
+
'runtimeLock',
|
|
329
|
+
] });
|
|
330
330
|
}
|
|
331
331
|
/** Cache executable/version/help/auth per host and effective launch; only expired catalogs refresh.
|
|
332
332
|
* Explicit force queues after the current scan, so a rescan cannot overlap its predecessor.
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Explain executable/authentication detection failures and preserve safe startup evidence.
|
|
4
4
|
*/
|
|
5
5
|
import { type ExecutableResolutionOptions } from './executables.js';
|
|
6
|
-
import type { AgentLaunchResolution } from '
|
|
6
|
+
import type { AgentLaunchResolution, RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
|
|
7
7
|
import type { AgentAuthProbeResult } from './auth.js';
|
|
8
|
-
import type { AgentDiagnostic
|
|
8
|
+
import type { AgentDiagnostic } from '@jini-ai/protocol';
|
|
9
9
|
/** Pasteable startup evidence, redacted before a UTF-8 byte cap is applied. No stack or input
|
|
10
10
|
* envelope is copied; deepest causes come first so a long wrapper cannot hide the cause.
|
|
11
11
|
* @param required Stage owned by the caller and the thrown startup value.
|
|
@@ -31,9 +31,9 @@ export declare function buildNotInvocableDiagnostic({ def, launch, cause }: {
|
|
|
31
31
|
def: Pick<RuntimeAgentDef, 'id' | 'name'>;
|
|
32
32
|
launch: Pick<AgentLaunchResolution, 'selectedPath' | 'launchPath'>;
|
|
33
33
|
cause: NotInvocableCause;
|
|
34
|
-
}): AgentDiagnostic;
|
|
34
|
+
}, _optional?: Record<string, never>): AgentDiagnostic;
|
|
35
35
|
export declare function buildAuthDiagnostic({ def, auth }: {
|
|
36
36
|
def: Pick<RuntimeAgentDef, 'id' | 'name'>;
|
|
37
37
|
auth: AgentAuthProbeResult;
|
|
38
|
-
}): AgentDiagnostic | null;
|
|
38
|
+
}, _optional?: Record<string, never>): AgentDiagnostic | null;
|
|
39
39
|
//# sourceMappingURL=diagnostics.d.ts.map
|
package/dist/diagnostics.js
CHANGED
|
@@ -83,7 +83,7 @@ export function buildExecutableDiagnostic({ def }, { configuredEnv = {}, ...opti
|
|
|
83
83
|
// are real binaries that need their executable bit restored; missing-target
|
|
84
84
|
// failures are usually leftover npm/nvm/mise shims whose underlying target
|
|
85
85
|
// was uninstalled.
|
|
86
|
-
export function buildNotInvocableDiagnostic({ def, launch, cause }) {
|
|
86
|
+
export function buildNotInvocableDiagnostic({ def, launch, cause }, _optional = {}) {
|
|
87
87
|
if (cause === 'not-executable') {
|
|
88
88
|
return {
|
|
89
89
|
reason: 'not-executable',
|
|
@@ -106,7 +106,7 @@ export function buildNotInvocableDiagnostic({ def, launch, cause }) {
|
|
|
106
106
|
// for adapters that declare a cheap, side-effect-free authProbe; until an
|
|
107
107
|
// adapter also declares a spawn-safe OAuth producer, diagnostics point at
|
|
108
108
|
// docs.
|
|
109
|
-
export function buildAuthDiagnostic({ def, auth }) {
|
|
109
|
+
export function buildAuthDiagnostic({ def, auth }, _optional = {}) {
|
|
110
110
|
if (auth.status === 'ok')
|
|
111
111
|
return null;
|
|
112
112
|
const signInIntent = { kind: 'openDocs' };
|
package/dist/env.js
CHANGED
|
@@ -53,6 +53,7 @@ function applyAgentHousekeeping({ env, agentId }) {
|
|
|
53
53
|
case 'amr':
|
|
54
54
|
backfillAmrEnv({ env });
|
|
55
55
|
return;
|
|
56
|
+
case 'opencode-acp':
|
|
56
57
|
case 'opencode':
|
|
57
58
|
// OpenCode is bun-based and, left to its defaults, walks up from its
|
|
58
59
|
// cwd to the nearest project root and runs `bun install` there at
|
|
@@ -74,7 +75,7 @@ function applyAgentHousekeeping({ env, agentId }) {
|
|
|
74
75
|
}
|
|
75
76
|
export function spawnEnvForAgent({ agentId, baseEnv }, { configuredEnv = {}, systemProxyEnv = resolveSystemProxyEnv(), hooks = {} } = {}) {
|
|
76
77
|
const expandedConfiguredEnv = expandConfiguredEnv({ configuredEnv: configuredEnv });
|
|
77
|
-
const env = mergeProxyAwareEnv(process.platform, systemProxyEnv, baseEnv, expandedConfiguredEnv);
|
|
78
|
+
const env = mergeProxyAwareEnv({ platform: process.platform, sources: [systemProxyEnv, baseEnv, expandedConfiguredEnv] });
|
|
78
79
|
applyAgentHousekeeping({ env, agentId });
|
|
79
80
|
const perAgentOverrides = hooks.perAgentEnv?.({ agentId: agentId, env: env });
|
|
80
81
|
if (perAgentOverrides)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AgentRuntimeState } from './runtime-state.js';
|
|
2
|
+
export interface ResolvedExecutableOptions {
|
|
3
|
+
env: NodeJS.ProcessEnv;
|
|
4
|
+
state: AgentRuntimeState;
|
|
5
|
+
}
|
|
6
|
+
export interface ExecutableResolutionHelpers {
|
|
7
|
+
executableFilePath(raw: string | undefined, options: ResolvedExecutableOptions): string | null;
|
|
8
|
+
isRunnableFile(path: string, options: ResolvedExecutableOptions): boolean;
|
|
9
|
+
searchPath(input: {
|
|
10
|
+
bin: string;
|
|
11
|
+
}, options: ResolvedExecutableOptions): string | null;
|
|
12
|
+
platformExecutableName(input: {
|
|
13
|
+
name: string;
|
|
14
|
+
}): string;
|
|
15
|
+
resourceRootOf(options: ResolvedExecutableOptions): string | undefined;
|
|
16
|
+
resolveDetectionHome(options: ResolvedExecutableOptions): {
|
|
17
|
+
home: string;
|
|
18
|
+
hasOverride: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=executable-helpers.d.ts.map
|
package/dist/executables.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentRuntimeState } from './runtime-state.js';
|
|
2
|
-
import type { RuntimeAgentDef } from '
|
|
2
|
+
import type { RuntimeAgentDef } from '@jini-ai/core/contracts/agents';
|
|
3
3
|
/** Host environment and runtime state used by executable resolution. */
|
|
4
4
|
export interface ExecutableResolutionOptions {
|
|
5
5
|
env?: NodeJS.ProcessEnv;
|
|
@@ -23,7 +23,7 @@ export declare function userToolchainBinDirs(_required?: Record<string, never>,
|
|
|
23
23
|
export declare function agentSearchDirs(_required?: Record<string, never>, options?: ExecutableResolutionOptions): string[];
|
|
24
24
|
export declare function agentBinEnvKey({ agentId }: {
|
|
25
25
|
agentId: string | undefined;
|
|
26
|
-
}): string | null;
|
|
26
|
+
}, _optional?: Record<string, never>): string | null;
|
|
27
27
|
export declare function resolveOnPath({ bin }: {
|
|
28
28
|
bin: string;
|
|
29
29
|
}, options?: ExecutableResolutionOptions): string | null;
|
package/dist/executables.js
CHANGED
|
@@ -26,32 +26,60 @@ import path from 'node:path';
|
|
|
26
26
|
import { homedir } from 'node:os';
|
|
27
27
|
import { wellKnownUserToolchainBins } from '@jini-ai/platform/toolchain';
|
|
28
28
|
import { expandHomePath } from './paths.js';
|
|
29
|
+
import { packagedAmrExecutable, resolveAmrCompanion } from './defs/amr/executable-resolution.js';
|
|
30
|
+
import { codexAppBundleExecutable, codexBundleCandidates } from './defs/codex/executable-resolution.js';
|
|
31
|
+
import { amrBinEnvKey } from './defs/amr/executable.js';
|
|
32
|
+
import { aiderBinEnvKey } from './defs/aider/executable.js';
|
|
33
|
+
import { auggieBinEnvKey } from './defs/auggie/executable.js';
|
|
34
|
+
import { claudeBinEnvKey } from './defs/claude/executable.js';
|
|
35
|
+
import { clineBinEnvKey } from './defs/cline/executable.js';
|
|
36
|
+
import { codebuddyBinEnvKey } from './defs/codebuddy/executable.js';
|
|
37
|
+
import { codexBinEnvKey } from './defs/codex/executable.js';
|
|
38
|
+
import { crushBinEnvKey } from './defs/crush/executable.js';
|
|
39
|
+
import { cursorAgentBinEnvKey } from './defs/cursor-agent/executable.js';
|
|
40
|
+
import { deepseekBinEnvKey } from './defs/deepseek/executable.js';
|
|
41
|
+
import { devinBinEnvKey } from './defs/devin/executable.js';
|
|
42
|
+
import { droidBinEnvKey } from './defs/droid/executable.js';
|
|
43
|
+
import { gooseBinEnvKey } from './defs/goose/executable.js';
|
|
44
|
+
import { hermesBinEnvKey } from './defs/hermes/executable.js';
|
|
45
|
+
import { kimiBinEnvKey } from './defs/kimi/executable.js';
|
|
46
|
+
import { kiroBinEnvKey } from './defs/kiro/executable.js';
|
|
47
|
+
import { kiloBinEnvKey } from './defs/kilo/executable.js';
|
|
48
|
+
import { mimoBinEnvKey } from './defs/mimo/executable.js';
|
|
49
|
+
import { opencodeBinEnvKey } from './defs/opencode/executable.js';
|
|
50
|
+
import { piBinEnvKey } from './defs/pi/executable.js';
|
|
51
|
+
import { qoderBinEnvKey } from './defs/qoder/executable.js';
|
|
52
|
+
import { qwenBinEnvKey } from './defs/qwen/executable.js';
|
|
53
|
+
import { reasonixBinEnvKey } from './defs/reasonix/executable.js';
|
|
54
|
+
import { traeCliBinEnvKey } from './defs/trae-cli/executable.js';
|
|
55
|
+
import { vibeBinEnvKey } from './defs/vibe/executable.js';
|
|
29
56
|
const AGENT_BIN_ENV_KEYS = new Map([
|
|
30
|
-
['amr',
|
|
31
|
-
['aider',
|
|
32
|
-
['auggie',
|
|
33
|
-
['claude',
|
|
34
|
-
['cline',
|
|
35
|
-
['codebuddy',
|
|
36
|
-
['codex',
|
|
37
|
-
['crush',
|
|
38
|
-
['cursor-agent',
|
|
39
|
-
['deepseek',
|
|
40
|
-
['devin',
|
|
41
|
-
['droid',
|
|
42
|
-
['goose',
|
|
43
|
-
['hermes',
|
|
44
|
-
['kimi',
|
|
45
|
-
['kiro',
|
|
46
|
-
['kilo',
|
|
47
|
-
['mimo',
|
|
48
|
-
['opencode',
|
|
49
|
-
['
|
|
50
|
-
['
|
|
51
|
-
['
|
|
52
|
-
['
|
|
53
|
-
['
|
|
54
|
-
['
|
|
57
|
+
['amr', amrBinEnvKey],
|
|
58
|
+
['aider', aiderBinEnvKey],
|
|
59
|
+
['auggie', auggieBinEnvKey],
|
|
60
|
+
['claude', claudeBinEnvKey],
|
|
61
|
+
['cline', clineBinEnvKey],
|
|
62
|
+
['codebuddy', codebuddyBinEnvKey],
|
|
63
|
+
['codex', codexBinEnvKey],
|
|
64
|
+
['crush', crushBinEnvKey],
|
|
65
|
+
['cursor-agent', cursorAgentBinEnvKey],
|
|
66
|
+
['deepseek', deepseekBinEnvKey],
|
|
67
|
+
['devin', devinBinEnvKey],
|
|
68
|
+
['droid', droidBinEnvKey],
|
|
69
|
+
['goose', gooseBinEnvKey],
|
|
70
|
+
['hermes', hermesBinEnvKey],
|
|
71
|
+
['kimi', kimiBinEnvKey],
|
|
72
|
+
['kiro', kiroBinEnvKey],
|
|
73
|
+
['kilo', kiloBinEnvKey],
|
|
74
|
+
['mimo', mimoBinEnvKey],
|
|
75
|
+
['opencode', opencodeBinEnvKey],
|
|
76
|
+
['opencode-acp', opencodeBinEnvKey],
|
|
77
|
+
['pi', piBinEnvKey],
|
|
78
|
+
['qoder', qoderBinEnvKey],
|
|
79
|
+
['qwen', qwenBinEnvKey],
|
|
80
|
+
['reasonix', reasonixBinEnvKey],
|
|
81
|
+
['trae-cli', traeCliBinEnvKey],
|
|
82
|
+
['vibe', vibeBinEnvKey],
|
|
55
83
|
]);
|
|
56
84
|
function withDefaults(options) {
|
|
57
85
|
return { env: options.env ?? process.env, state: options.state ?? defaultRuntimeState };
|
|
@@ -150,7 +178,7 @@ export function agentSearchDirs(_required = {}, options = {}) {
|
|
|
150
178
|
// The `*_BIN` environment variable that overrides PATH detection for a given
|
|
151
179
|
// agent id (e.g. `cursor-agent` → `CURSOR_AGENT_BIN`), or null when the agent
|
|
152
180
|
// has no override key. Drives the `setEnv` / `clearEnv` fix intents.
|
|
153
|
-
export function agentBinEnvKey({ agentId }) {
|
|
181
|
+
export function agentBinEnvKey({ agentId }, _optional = {}) {
|
|
154
182
|
if (!agentId)
|
|
155
183
|
return null;
|
|
156
184
|
return AGENT_BIN_ENV_KEYS.get(agentId) ?? null;
|
|
@@ -211,76 +239,16 @@ function configuredExecutableOverride(def, configuredEnv, options) {
|
|
|
211
239
|
return null;
|
|
212
240
|
return executableFilePath(configuredEnv?.[envKey], options);
|
|
213
241
|
}
|
|
214
|
-
export function resolveAmrOpenCodeExecutable({}, { env = process.env, state = defaultRuntimeState } = {}) {
|
|
215
|
-
const options = { env, state };
|
|
216
|
-
// In packaged builds prefer the bundled companion under
|
|
217
|
-
// `<resourceRoot>/bin/libexec/opencode/opencode` so a stale global
|
|
218
|
-
// `opencode` on the user's PATH can't override the known-good build that
|
|
219
|
-
// shipped with this app. PATH is only consulted as a last resort.
|
|
220
|
-
return executableFilePath(env.VELA_OPENCODE_BIN, options)
|
|
221
|
-
?? bundledAmrOpenCode({ resourceRoot: resourceRootOf(options) }, options)
|
|
222
|
-
?? searchPath({ bin: 'opencode-cli' }, options)
|
|
223
|
-
?? searchPath({ bin: 'opencode' }, options);
|
|
224
|
-
}
|
|
225
242
|
function resourceRootOf({ env, state }) {
|
|
226
243
|
return env[state.executable.envNames.resourceRootEnvVar]?.trim();
|
|
227
244
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return
|
|
235
|
-
}
|
|
236
|
-
// The AMR (vela) OpenCode companion ships as a
|
|
237
|
-
// `<resourceRoot>/bin/libexec/opencode/opencode` *executable file*, not just
|
|
238
|
-
// the directory. Treating any directory there as a valid companion produces
|
|
239
|
-
// a false-positive availability path: `detectAgents()` would surface AMR as
|
|
240
|
-
// available even though the first real run can't launch. Verify the inner
|
|
241
|
-
// executable too.
|
|
242
|
-
function packagedVelaOpenCodeCompanionTree(resourceRoot, options) {
|
|
243
|
-
const candidate = path.join(resourceRoot, 'bin', 'libexec', 'opencode');
|
|
244
|
-
try {
|
|
245
|
-
if (!statSync(candidate).isDirectory())
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
return isRunnableFile(path.join(candidate, platformExecutableName({ name: 'opencode' })), options) ? candidate : null;
|
|
252
|
-
}
|
|
253
|
-
function packagedBuiltInExecutable(def, configuredEnv, options) {
|
|
254
|
-
if (def.id !== 'amr')
|
|
255
|
-
return null;
|
|
256
|
-
const resourceRoot = resourceRootOf(options);
|
|
257
|
-
if (!resourceRoot)
|
|
258
|
-
return null;
|
|
259
|
-
if (!resolveAmrOpenCodeExecutable({}, { ...options, env: { ...options.env, ...configuredEnv } }) &&
|
|
260
|
-
!packagedVelaOpenCodeCompanionTree(resourceRoot, options)) {
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
const candidate = path.join(resourceRoot, 'bin', platformExecutableName({ name: 'vela' }));
|
|
264
|
-
return isRunnableFile(candidate, options) ? candidate : null;
|
|
265
|
-
}
|
|
266
|
-
// The official OpenAI Codex desktop app ships the `codex` CLI *inside* its
|
|
267
|
-
// macOS application bundle and does NOT add it to PATH unless the user
|
|
268
|
-
// explicitly runs the app's "Install command line tool" action. Users who
|
|
269
|
-
// installed Codex only through the app therefore see a "not installed"
|
|
270
|
-
// agent card even though a healthy native `codex` binary exists on disk,
|
|
271
|
-
// because neither PATH nor the user-toolchain search dirs cover the app
|
|
272
|
-
// bundle. Probe the well-known bundle locations so app-only installs are
|
|
273
|
-
// detected. This is a last-resort fallback that ranks below PATH, so an
|
|
274
|
-
// explicit `npm i -g` / Homebrew / version-manager install always wins.
|
|
275
|
-
function codexAppBundleExecutable(def, options) {
|
|
276
|
-
if (def?.id !== 'codex')
|
|
277
|
-
return null;
|
|
278
|
-
for (const candidate of appBundleCandidates(options)) {
|
|
279
|
-
const resolved = executableFilePath(candidate, options);
|
|
280
|
-
if (resolved)
|
|
281
|
-
return resolved;
|
|
282
|
-
}
|
|
283
|
-
return null;
|
|
245
|
+
const EXECUTABLE_HELPERS = {
|
|
246
|
+
executableFilePath, isRunnableFile, searchPath, platformExecutableName, resourceRootOf, resolveDetectionHome,
|
|
247
|
+
};
|
|
248
|
+
const PACKAGED_EXECUTABLES = new Map([['amr', packagedAmrExecutable]]);
|
|
249
|
+
const APP_BUNDLE_EXECUTABLES = new Map([['codex', codexAppBundleExecutable]]);
|
|
250
|
+
export function resolveAmrOpenCodeExecutable({}, { env = process.env, state = defaultRuntimeState } = {}) {
|
|
251
|
+
return resolveAmrCompanion({ options: { env, state }, services: EXECUTABLE_HELPERS });
|
|
284
252
|
}
|
|
285
253
|
// Exported for tests: the no-override `/Applications` branch can't be
|
|
286
254
|
// exercised through `resolveAgentExecutable` deterministically (it would
|
|
@@ -288,25 +256,7 @@ function codexAppBundleExecutable(def, options) {
|
|
|
288
256
|
// assert the built candidate list directly to catch a path typo or
|
|
289
257
|
// ordering regression in the common real-world install case.
|
|
290
258
|
export function codexAppBundleCandidates(_required = {}, options = {}) {
|
|
291
|
-
return
|
|
292
|
-
}
|
|
293
|
-
function appBundleCandidates(options) {
|
|
294
|
-
// The Codex app bundle is a macOS-only concept; other platforms have no
|
|
295
|
-
// analogous standalone install of the `codex` CLI to probe for here.
|
|
296
|
-
if (process.platform !== 'darwin')
|
|
297
|
-
return [];
|
|
298
|
-
const { home, hasOverride } = resolveDetectionHome(options);
|
|
299
|
-
const bundleSuffix = ['Codex.app', 'Contents', 'Resources', 'codex'];
|
|
300
|
-
// User-scoped install (~/Applications). Honors the override home so
|
|
301
|
-
// sandboxed detection runs and tests stay deterministic.
|
|
302
|
-
const candidates = [path.join(home, 'Applications', ...bundleSuffix)];
|
|
303
|
-
// System-wide /Applications install. Skip it under an override home for
|
|
304
|
-
// the same isolation reason `userToolchainDirs` skips Homebrew/system
|
|
305
|
-
// bins.
|
|
306
|
-
if (!hasOverride) {
|
|
307
|
-
candidates.unshift(path.join('/Applications', ...bundleSuffix));
|
|
308
|
-
}
|
|
309
|
-
return candidates;
|
|
259
|
+
return codexBundleCandidates({ options: withDefaults(options), services: EXECUTABLE_HELPERS });
|
|
310
260
|
}
|
|
311
261
|
// Resolve the first available binary for an agent definition. Tries
|
|
312
262
|
// `def.bin` first, then walks `def.fallbackBins` in order. Used for agents
|
|
@@ -327,6 +277,11 @@ function firstBinOnPath(def, options) {
|
|
|
327
277
|
export function resolveAgentExecutable({ def }, options = {}) {
|
|
328
278
|
return inspectAgentExecutableResolution({ def: def }, options).selectedPath;
|
|
329
279
|
}
|
|
280
|
+
function bundledExecutablePaths(def, configuredEnv, resolved) {
|
|
281
|
+
const builtInPath = PACKAGED_EXECUTABLES.get(def.id)?.(configuredEnv, resolved, EXECUTABLE_HELPERS) ?? null;
|
|
282
|
+
const appBundlePath = APP_BUNDLE_EXECUTABLES.get(def.id)?.(resolved, EXECUTABLE_HELPERS) ?? null;
|
|
283
|
+
return { builtInPath, appBundlePath };
|
|
284
|
+
}
|
|
330
285
|
export function inspectAgentExecutableResolution({ def }, options = {}) {
|
|
331
286
|
if (!def?.bin) {
|
|
332
287
|
return {
|
|
@@ -339,8 +294,7 @@ export function inspectAgentExecutableResolution({ def }, options = {}) {
|
|
|
339
294
|
const configuredEnv = options.configuredEnv ?? {};
|
|
340
295
|
const configuredOverridePath = configuredExecutableOverride(def, configuredEnv, resolved);
|
|
341
296
|
const pathResolvedPath = firstBinOnPath(def, resolved);
|
|
342
|
-
const builtInPath =
|
|
343
|
-
const appBundlePath = codexAppBundleExecutable(def, resolved);
|
|
297
|
+
const { builtInPath, appBundlePath } = bundledExecutablePaths(def, configuredEnv, resolved);
|
|
344
298
|
return {
|
|
345
299
|
configuredOverridePath,
|
|
346
300
|
pathResolvedPath,
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export * from './types.js';
|
|
12
12
|
export * from './native-tool-policy.js';
|
|
13
|
+
export * from './native-permissions.js';
|
|
13
14
|
export * from './claude-filesystem-policy.js';
|
|
14
15
|
export * from './paths.js';
|
|
15
16
|
export * from './models.js';
|
|
@@ -40,12 +41,15 @@ export { createClaudeStreamHandler, type ClaudeStreamEvent } from './claude-stre
|
|
|
40
41
|
export { createJsonEventStreamHandler } from './json-event-stream.js';
|
|
41
42
|
export { createQoderStreamHandler, type QoderEvent } from './qoder-stream.js';
|
|
42
43
|
export * from './amr-profile-resolver.js';
|
|
43
|
-
export {
|
|
44
|
+
export { noopAcpModelProbe, setAcpModelProbe, detectAcpModels as probeAcpModels, } from './acp-model-probe.js';
|
|
44
45
|
export * from './pi-models.js';
|
|
45
46
|
export * from './prompt-augmenter.js';
|
|
47
|
+
export * from './runtime-def-binding.js';
|
|
48
|
+
export * from './runtime-port-bindings.js';
|
|
49
|
+
export * from './defs/codex/options.js';
|
|
50
|
+
export * from './defs/pi/options.js';
|
|
46
51
|
export * from './artifact-taxonomy.js';
|
|
47
52
|
export * from './telemetry-sink.js';
|
|
48
|
-
export * from './ai-trace/index.js';
|
|
49
53
|
export * from './providers/index.js';
|
|
50
54
|
/** ACP + pi-rpc protocol adapters over the shared JSON-line-stream core. See aliases above. */
|
|
51
55
|
export { createJsonLineStream, type AcpMcpServerInput, type AcpPermissionDecision, type AcpPermissionHandler, type AcpPermissionOption, type AcpPermissionRequest, type AcpSessionController, type ModelOption, type AttachAcpSessionOptions, type AccountFailure, type AccountFailureClassifier, buildAcpSessionNewParams, normalizeModels, detectAcpModels, attachAcpSession, noopAccountFailureClassifier, mapPiRpcEvent, attachPiRpcSession, parsePiModels as parsePiRpcModels, type PiRpcSession, type PiRpcSessionOptions, } from './agent-protocol/index.js';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// Core contract and diagnostic types.
|
|
12
12
|
export * from './types.js';
|
|
13
13
|
export * from './native-tool-policy.js';
|
|
14
|
+
export * from './native-permissions.js';
|
|
14
15
|
export * from './claude-filesystem-policy.js';
|
|
15
16
|
// Generic supporting modules.
|
|
16
17
|
export * from './paths.js';
|
|
@@ -65,9 +66,12 @@ export { noopAcpModelProbe, setAcpModelProbe, detectAcpModels as probeAcpModels,
|
|
|
65
66
|
// below to avoid a public-name collision while preserving both consumers' contracts.
|
|
66
67
|
export * from './pi-models.js';
|
|
67
68
|
export * from './prompt-augmenter.js';
|
|
69
|
+
export * from './runtime-def-binding.js';
|
|
70
|
+
export * from './runtime-port-bindings.js';
|
|
71
|
+
export * from './defs/codex/options.js';
|
|
72
|
+
export * from './defs/pi/options.js';
|
|
68
73
|
export * from './artifact-taxonomy.js';
|
|
69
74
|
export * from './telemetry-sink.js';
|
|
70
|
-
export * from './ai-trace/index.js';
|
|
71
75
|
// LLM-provider integrations (BYOK model catalogs, OAuth+PKCE, gateway helpers).
|
|
72
76
|
export * from './providers/index.js';
|
|
73
77
|
/** ACP + pi-rpc protocol adapters over the shared JSON-line-stream core. See aliases above. */
|
package/dist/invocation.d.ts
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Short, read-only metadata probes (model-list / version / help /
|
|
5
5
|
* auth-status) for an agent CLI. Ported from OD's
|
|
6
|
-
* `apps/daemon/src/runtimes/invocation.ts
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* `apps/daemon/src/runtimes/invocation.ts`. Command planning is core's pure
|
|
7
|
+
* `planCommandInvocation`: `@jini-ai/platform`'s `createCommandInvocation`
|
|
8
|
+
* (the function OD shipped from its workspace package, verbatim-lifted into
|
|
9
|
+
* platform, see its `archived provenance ledger`) is only that planner plus the
|
|
10
|
+
* process's own platform and `ComSpec`, so this module passes those two values
|
|
11
|
+
* explicitly through `ambientCommandShell` instead of importing platform.
|
|
11
12
|
*/
|
|
12
13
|
import { execFile } from 'node:child_process';
|
|
14
|
+
import { type RuntimePlatform } from '@jini-ai/core/contracts/runtime';
|
|
13
15
|
import type { RuntimeExecOptions } from './types.js';
|
|
14
16
|
declare const execFileP: typeof execFile.__promisify__;
|
|
15
17
|
type ProbeExecPort = (input: {
|
|
@@ -19,12 +21,26 @@ type ProbeExecPort = (input: {
|
|
|
19
21
|
windowsVerbatimArguments?: boolean | undefined;
|
|
20
22
|
};
|
|
21
23
|
}, optional: Record<string, never>) => ReturnType<typeof execFileP>;
|
|
24
|
+
/** The platform and fallback `ComSpec` a command plan needs; ambient values, injectable so tests never stub globals. */
|
|
25
|
+
export interface AmbientCommandShell {
|
|
26
|
+
readonly platform: RuntimePlatform;
|
|
27
|
+
readonly fallbackComSpec: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Read the process's own platform and `ComSpec` (every call, never hoisted). When a host-built `env` carries no
|
|
31
|
+
* `ComSpec`, Windows falls back to the process's own; dropping this would silently turn the cmd-shim into a bare `cmd.exe`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ambientCommandShell(_required: Record<string, never>, { platform, ambientEnv }?: {
|
|
34
|
+
platform?: RuntimePlatform;
|
|
35
|
+
ambientEnv?: Readonly<Record<string, string | undefined>>;
|
|
36
|
+
}): AmbientCommandShell;
|
|
22
37
|
export declare function execAgentFile({ command, args }: {
|
|
23
38
|
command: string;
|
|
24
39
|
args: string[];
|
|
25
|
-
}, { options, execute }?: {
|
|
40
|
+
}, { options, execute, commandShell }?: {
|
|
26
41
|
options?: RuntimeExecOptions;
|
|
27
42
|
execute?: ProbeExecPort;
|
|
43
|
+
commandShell?: AmbientCommandShell;
|
|
28
44
|
}): Promise<{
|
|
29
45
|
stdout: string | NonSharedBuffer;
|
|
30
46
|
stderr: string | NonSharedBuffer;
|
package/dist/invocation.js
CHANGED
|
@@ -3,18 +3,26 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Short, read-only metadata probes (model-list / version / help /
|
|
5
5
|
* auth-status) for an agent CLI. Ported from OD's
|
|
6
|
-
* `apps/daemon/src/runtimes/invocation.ts
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* `apps/daemon/src/runtimes/invocation.ts`. Command planning is core's pure
|
|
7
|
+
* `planCommandInvocation`: `@jini-ai/platform`'s `createCommandInvocation`
|
|
8
|
+
* (the function OD shipped from its workspace package, verbatim-lifted into
|
|
9
|
+
* platform, see its `archived provenance ledger`) is only that planner plus the
|
|
10
|
+
* process's own platform and `ComSpec`, so this module passes those two values
|
|
11
|
+
* explicitly through `ambientCommandShell` instead of importing platform.
|
|
11
12
|
*/
|
|
12
13
|
import { execFile } from 'node:child_process';
|
|
13
14
|
import { scheduleProbeProcess } from './probe-scheduler.js';
|
|
14
15
|
import os from 'node:os';
|
|
15
16
|
import { promisify } from 'node:util';
|
|
16
|
-
import {
|
|
17
|
+
import { planCommandInvocation } from '@jini-ai/core/contracts/runtime';
|
|
17
18
|
const execFileP = promisify(execFile);
|
|
19
|
+
/**
|
|
20
|
+
* Read the process's own platform and `ComSpec` (every call, never hoisted). When a host-built `env` carries no
|
|
21
|
+
* `ComSpec`, Windows falls back to the process's own; dropping this would silently turn the cmd-shim into a bare `cmd.exe`.
|
|
22
|
+
*/
|
|
23
|
+
export function ambientCommandShell(_required, { platform = process.platform, ambientEnv = process.env } = {}) {
|
|
24
|
+
return { platform, fallbackComSpec: ambientEnv.ComSpec };
|
|
25
|
+
}
|
|
18
26
|
// Agent probes (model-list / version / help / auth-status) are short
|
|
19
27
|
// read-only metadata calls that never need the caller's project files.
|
|
20
28
|
// Default them to a neutral working directory instead of inheriting the
|
|
@@ -28,17 +36,11 @@ const execFileP = promisify(execFile);
|
|
|
28
36
|
// running dev server. A probe writing a stray lockfile under the OS temp
|
|
29
37
|
// dir is harmless. Actual agent runs spawn elsewhere with an explicit
|
|
30
38
|
// project cwd and are unaffected.
|
|
31
|
-
export function execAgentFile({ command, args }, { options = {}, execute = (input) => execFileP(input.command, input.args, input.options) } = {}) {
|
|
32
|
-
const invocation =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
env: options.env,
|
|
37
|
-
}
|
|
38
|
-
: {
|
|
39
|
-
command,
|
|
40
|
-
args,
|
|
41
|
-
});
|
|
39
|
+
export function execAgentFile({ command, args }, { options = {}, execute = (input) => execFileP(input.command, input.args, input.options), commandShell = ambientCommandShell({}) } = {}) {
|
|
40
|
+
const invocation = planCommandInvocation(
|
|
41
|
+
// The planner reads only `env.ComSpec`; with no env passed the old default (the process env) and the
|
|
42
|
+
// ambient fallback are the same value, so an empty env here keeps that behaviour without a second env read.
|
|
43
|
+
{ command, platform: commandShell.platform, env: options.env ?? {} }, { args, fallbackComSpec: commandShell.fallbackComSpec });
|
|
42
44
|
return scheduleProbeProcess({ work: async () => {
|
|
43
45
|
const pending = execute({ command: invocation.command, args: invocation.args, options: {
|
|
44
46
|
killSignal: 'SIGKILL', ...options, cwd: options.cwd ?? os.tmpdir(),
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** @module json-event-stream-shared
|
|
2
|
+
* Shared types and pure helpers of the multi-CLI JSON event parser: what `json-event-stream.ts`
|
|
3
|
+
* (the dispatcher) and each agent's `defs/<agent>/event-stream.ts` handler both use. Internal to
|
|
4
|
+
* the package; not exported from `index.ts`.
|
|
5
|
+
*
|
|
6
|
+
* This file is a leaf at runtime: it must load no handler module, because the handlers import it
|
|
7
|
+
* and the dispatcher imports the handlers. The per-agent state types below are therefore
|
|
8
|
+
* statement-level `import type`. Under `verbatimModuleSyntax` an inline `import { type X }` is
|
|
9
|
+
* emitted as `import {} from` and still loads the module, which would close the cycle again. */
|
|
10
|
+
import type { AntigravityStreamState } from './defs/antigravity/event-stream.js';
|
|
11
|
+
import type { CodexStreamState } from './defs/codex/event-stream.js';
|
|
12
|
+
import type { CursorStreamState } from './defs/cursor-agent/event-stream.js';
|
|
13
|
+
import type { LegacyGoogleStreamState } from './defs/gemini/event-stream.js';
|
|
14
|
+
import type { OpenCodeStreamState } from './defs/opencode/event-stream.js';
|
|
15
|
+
export type JsonObject = Record<string, unknown>;
|
|
16
|
+
export type StreamEvent = Record<string, unknown>;
|
|
17
|
+
export type StreamEventHandler = (event: StreamEvent) => void;
|
|
18
|
+
export type ParserState = {
|
|
19
|
+
antigravity: AntigravityStreamState;
|
|
20
|
+
cursor: CursorStreamState;
|
|
21
|
+
opencode: OpenCodeStreamState;
|
|
22
|
+
codex: CodexStreamState;
|
|
23
|
+
legacyGoogle: LegacyGoogleStreamState;
|
|
24
|
+
};
|
|
25
|
+
export type Usage = {
|
|
26
|
+
input_tokens?: number;
|
|
27
|
+
output_tokens?: number;
|
|
28
|
+
thought_tokens?: number;
|
|
29
|
+
cached_read_tokens?: number;
|
|
30
|
+
cached_write_tokens?: number;
|
|
31
|
+
};
|
|
32
|
+
/** One vendor frame translator: returns `true` when it handled the frame, `false` to fall back to `raw`. */
|
|
33
|
+
export type FrameHandler = (obj: JsonObject, onEvent: StreamEventHandler, state: ParserState) => boolean;
|
|
34
|
+
/** `[vendor field, Usage field]` pairs, in the emitted key order. */
|
|
35
|
+
export type UsageFields = ReadonlyArray<readonly [string, keyof Usage]>;
|
|
36
|
+
export declare function isRecord(value: unknown): value is JsonObject;
|
|
37
|
+
export declare function nonEmptyString({ value }: {
|
|
38
|
+
value: unknown;
|
|
39
|
+
}, _optional?: Record<string, never>): string | null;
|
|
40
|
+
export declare function trimmedNonBlank({ value }: {
|
|
41
|
+
value: unknown;
|
|
42
|
+
}, _optional?: Record<string, never>): string | null;
|
|
43
|
+
export declare function optionalString({ value }: {
|
|
44
|
+
value: unknown;
|
|
45
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
46
|
+
export declare function optionalNumber({ value }: {
|
|
47
|
+
value: unknown;
|
|
48
|
+
}, _optional?: Record<string, never>): number | undefined;
|
|
49
|
+
/** Copies the numeric vendor counters named in `fields` into a `Usage`, skipping absent ones. */
|
|
50
|
+
export declare function pickUsage({ source, fields }: {
|
|
51
|
+
source: JsonObject;
|
|
52
|
+
fields: UsageFields;
|
|
53
|
+
}, _optional?: Record<string, never>): Usage;
|
|
54
|
+
/** Routes a record frame to the handler registered for its `type`; unknown types are unhandled. */
|
|
55
|
+
export declare function dispatchFrame({ handlers, obj, onEvent, state }: {
|
|
56
|
+
handlers: ReadonlyMap<unknown, FrameHandler>;
|
|
57
|
+
obj: JsonObject;
|
|
58
|
+
onEvent: StreamEventHandler;
|
|
59
|
+
state: ParserState;
|
|
60
|
+
}, _optional?: Record<string, never>): boolean;
|
|
61
|
+
export declare function safeParseJson({ value }: {
|
|
62
|
+
value: unknown;
|
|
63
|
+
}, _optional?: Record<string, never>): unknown;
|
|
64
|
+
export declare function stringifyContent({ value }: {
|
|
65
|
+
value: unknown;
|
|
66
|
+
}, _optional?: Record<string, never>): string;
|
|
67
|
+
/** Unwrap string/record error envelopes, retaining string or numeric codes alongside messages. */
|
|
68
|
+
export declare function extractErrorMessage({ value, fallback }: {
|
|
69
|
+
value: unknown;
|
|
70
|
+
fallback: string;
|
|
71
|
+
}, _optional?: Record<string, never>): string;
|
|
72
|
+
export declare function initializingStatus({ obj }: {
|
|
73
|
+
obj: JsonObject;
|
|
74
|
+
}, _optional?: Record<string, never>): StreamEvent;
|
|
75
|
+
export declare function todoWriteInputFromItems({ items }: {
|
|
76
|
+
items: unknown[];
|
|
77
|
+
}, _optional?: Record<string, never>): JsonObject | null;
|
|
78
|
+
export declare function todoWriteInputFromParsedValue({ value }: {
|
|
79
|
+
value: unknown;
|
|
80
|
+
}, _optional?: Record<string, never>): JsonObject | null;
|
|
81
|
+
//# sourceMappingURL=json-event-stream-shared.d.ts.map
|