@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,130 @@
|
|
|
1
|
+
/** Ported verbatim from OD's `apps/daemon/src/runtimes/defs/claude.ts` (import path adjusted only). See `source-map.md`. */
|
|
2
|
+
import { agentCapabilities } from '../capabilities.js';
|
|
3
|
+
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
4
|
+
import { loadMmdRouteModels } from '../mmd-routes.js';
|
|
5
|
+
/**
|
|
6
|
+
* The levels `claude --effort` accepts, as the CLI itself reports them when
|
|
7
|
+
* given an unknown one. Anything outside this set is dropped rather than
|
|
8
|
+
* forwarded: the CLI answers an unrecognized level with a stderr warning and
|
|
9
|
+
* then runs at its default, so passing one through would look like the setting
|
|
10
|
+
* applied while silently doing nothing.
|
|
11
|
+
*/
|
|
12
|
+
const CLAUDE_EFFORT_LEVELS = new Set([
|
|
13
|
+
'low', 'medium', 'high', 'xhigh', 'max',
|
|
14
|
+
]);
|
|
15
|
+
const CLAUDE_FALLBACK_MODELS = [
|
|
16
|
+
DEFAULT_MODEL_OPTION,
|
|
17
|
+
{ id: 'sonnet', label: 'Sonnet (alias)' },
|
|
18
|
+
{ id: 'opus', label: 'Opus (alias)' },
|
|
19
|
+
{ id: 'haiku', label: 'Haiku (alias)' },
|
|
20
|
+
{ id: 'claude-opus-4-5', label: 'claude-opus-4-5' },
|
|
21
|
+
{ id: 'claude-sonnet-4-5', label: 'claude-sonnet-4-5' },
|
|
22
|
+
{ id: 'claude-haiku-4-5', label: 'claude-haiku-4-5' },
|
|
23
|
+
];
|
|
24
|
+
export const claudeAgentDef = {
|
|
25
|
+
id: 'claude',
|
|
26
|
+
name: 'Claude Code',
|
|
27
|
+
bin: 'claude',
|
|
28
|
+
// Drop-in forks that ship a CLI argv-compatible with `claude`. Tried in
|
|
29
|
+
// order if `claude` itself isn't on PATH, so users on a single-binary
|
|
30
|
+
// install (e.g. only OpenClaude — https://github.com/Gitlawb/openclaude
|
|
31
|
+
// — issue #235) get auto-detected without writing wrapper scripts.
|
|
32
|
+
fallbackBins: ['openclaude'],
|
|
33
|
+
versionArgs: ['--version'],
|
|
34
|
+
authProbe: {
|
|
35
|
+
args: ['auth', 'status'],
|
|
36
|
+
timeoutMs: 5000,
|
|
37
|
+
},
|
|
38
|
+
helpArgs: ['-p', '--help'],
|
|
39
|
+
capabilityFlags: {
|
|
40
|
+
// Flag string -> capability key. After probing `--help`, we set
|
|
41
|
+
// `agentCapabilities[id][key] = true` for each substring that matches.
|
|
42
|
+
// `--add-dir` and `--include-partial-messages` live under `claude -p`
|
|
43
|
+
// subcommand, so we probe `claude -p --help` instead of `claude --help`.
|
|
44
|
+
// Fixes issue #430: --add-dir never detected because it wasn't in global help.
|
|
45
|
+
'--include-partial-messages': 'partialMessages',
|
|
46
|
+
'--add-dir': 'addDir',
|
|
47
|
+
'--effort': 'effort',
|
|
48
|
+
},
|
|
49
|
+
// `claude` has no list-models subcommand. Prefer local mmd/MMS routes
|
|
50
|
+
// when present so proxy-backed Claude-compatible models appear in the
|
|
51
|
+
// picker, then keep the built-in aliases as fallback hints.
|
|
52
|
+
fallbackModels: CLAUDE_FALLBACK_MODELS,
|
|
53
|
+
fetchModels: async (_resolvedBin, env) => loadMmdRouteModels(env, CLAUDE_FALLBACK_MODELS),
|
|
54
|
+
// `claude --effort <level>`. The set differs from codex's on both ends — it
|
|
55
|
+
// has `max` and has no `none`/`minimal` — so it is spelled out rather than
|
|
56
|
+
// shared, and `CLAUDE_EFFORT_LEVELS` below is what `buildArgs` validates
|
|
57
|
+
// against: a level carried over from another runtime's picker must not reach
|
|
58
|
+
// the CLI, which would warn on stderr and silently fall back to the default.
|
|
59
|
+
reasoningOptions: [
|
|
60
|
+
// Spelled out rather than reusing DEFAULT_MODEL_OPTION: its label reads
|
|
61
|
+
// "Default (CLI config)", which is right for a model row and wrong here.
|
|
62
|
+
{ id: 'default', label: 'Default' },
|
|
63
|
+
{ id: 'low', label: 'Low' },
|
|
64
|
+
{ id: 'medium', label: 'Medium' },
|
|
65
|
+
{ id: 'high', label: 'High' },
|
|
66
|
+
{ id: 'xhigh', label: 'XHigh' },
|
|
67
|
+
{ id: 'max', label: 'Max' },
|
|
68
|
+
],
|
|
69
|
+
// Prompt delivered via stdin to avoid both Linux `spawn E2BIG`
|
|
70
|
+
// (MAX_ARG_STRLEN caps a single argv entry at ~128 KB) and Windows
|
|
71
|
+
// `spawn ENAMETOOLONG` (CreateProcess caps the full command line at
|
|
72
|
+
// ~32 KB direct, ~8 KB via .cmd shim). `claude -p` with no positional
|
|
73
|
+
// prompt reads the prompt from stdin under `--input-format text` (the
|
|
74
|
+
// default), which has no length cap. Mirrors the codex/gemini/opencode/
|
|
75
|
+
// cursor/qwen entries below.
|
|
76
|
+
buildArgs: (_prompt, _imagePaths, extraAllowedDirs = [], options = {}, runtimeContext = {}) => {
|
|
77
|
+
const caps = agentCapabilities.get('claude') || {};
|
|
78
|
+
// `--input-format stream-json` lets the daemon stream multiple JSONL
|
|
79
|
+
// messages into stdin instead of closing it after the initial prompt,
|
|
80
|
+
// keeping the turn open so the daemon can stream further user messages
|
|
81
|
+
// mid-conversation. Paired with `--output-format stream-json` so the
|
|
82
|
+
// adapter parses structured events (see claude-stream.ts).
|
|
83
|
+
const args = ['-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose'];
|
|
84
|
+
// `--include-partial-messages` lands richer streaming events but only
|
|
85
|
+
// exists in newer Claude Code builds. Older installs reject it with
|
|
86
|
+
// "unknown option" and exit 1, killing the chat. Gate on the probe.
|
|
87
|
+
if (caps.partialMessages) {
|
|
88
|
+
args.push('--include-partial-messages');
|
|
89
|
+
}
|
|
90
|
+
if (options.model && options.model !== 'default') {
|
|
91
|
+
args.push('--model', options.model);
|
|
92
|
+
}
|
|
93
|
+
// `--effort` is newer than `--model`, so it gets the same probe gate as
|
|
94
|
+
// `--include-partial-messages`: an older build rejects an unknown option
|
|
95
|
+
// with exit 1, which kills the chat rather than degrading it.
|
|
96
|
+
if (caps.effort
|
|
97
|
+
&& typeof options.reasoning === 'string'
|
|
98
|
+
&& CLAUDE_EFFORT_LEVELS.has(options.reasoning)) {
|
|
99
|
+
args.push('--effort', options.reasoning);
|
|
100
|
+
}
|
|
101
|
+
const dirs = (extraAllowedDirs || []).filter((d) => typeof d === 'string' && d.length > 0);
|
|
102
|
+
// `--add-dir` is older but still gate it for symmetry — old/forked
|
|
103
|
+
// builds may lack it.
|
|
104
|
+
if (dirs.length > 0 && caps.addDir !== false) {
|
|
105
|
+
args.push('--add-dir', ...dirs);
|
|
106
|
+
}
|
|
107
|
+
// Continue Claude's own CLI session across turns so it keeps its
|
|
108
|
+
// working memory (files read, edits made, tool history) instead of
|
|
109
|
+
// re-deriving everything from the rendered transcript each turn.
|
|
110
|
+
// `--resume <id>` continues a stored session; `--session-id <uuid>`
|
|
111
|
+
// starts a new one with an id the daemon controls and persists.
|
|
112
|
+
if (typeof runtimeContext.resumeSessionId === 'string' && runtimeContext.resumeSessionId) {
|
|
113
|
+
args.push('--resume', runtimeContext.resumeSessionId);
|
|
114
|
+
}
|
|
115
|
+
else if (typeof runtimeContext.newSessionId === 'string' && runtimeContext.newSessionId) {
|
|
116
|
+
args.push('--session-id', runtimeContext.newSessionId);
|
|
117
|
+
}
|
|
118
|
+
args.push('--permission-mode', 'bypassPermissions');
|
|
119
|
+
return args;
|
|
120
|
+
},
|
|
121
|
+
promptViaStdin: true,
|
|
122
|
+
promptInputFormat: 'stream-json',
|
|
123
|
+
streamFormat: 'claude-stream-json',
|
|
124
|
+
// Claude Code auto-loads `.mcp.json` from the project cwd at spawn,
|
|
125
|
+
// so the daemon writes the user's external MCP servers there before
|
|
126
|
+
// launching (server.ts handles the cwd guard).
|
|
127
|
+
externalMcpInjection: 'claude-mcp-json',
|
|
128
|
+
resumesSessionViaCli: true,
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/defs/claude.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK;CACxC,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG;IAC7B,oBAAoB;IACpB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE;IACzC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE;IACrC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE;IACvC,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE;IACvD,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,EAAE;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,QAAQ;IACb,wEAAwE;IACxE,sEAAsE;IACtE,wEAAwE;IACxE,m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C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAAC;QAClC,CAAC;QACD,iEAAiE;QACjE,mEAAmE;QACnE,iEAAiE;QACjE,oEAAoE;QACpE,gEAAgE;QAChE,IAAI,OAAO,cAAc,CAAC,eAAe,KAAK,QAAQ,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;YACzF,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,OAAO,cAAc,CAAC,YAAY,KAAK,QAAQ,IAAI,cAAc,CAAC,YAAY,EAAE,CAAC;YAC1F,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,cAAc,EAAE,IAAI;IACpB,iBAAiB,EAAE,aAAa;IAChC,YAAY,EAAE,oBAAoB;IAClC,oEAAoE;IACpE,oEAAoE;IACpE,+CAA+C;IAC/C,oBAAoB,EAAE,iBAAiB;IACvC,oBAAoB,EAAE,IAAI;CACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const codebuddyAgentDef: {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
bin: string;
|
|
5
|
+
fallbackBins: string[];
|
|
6
|
+
versionArgs: string[];
|
|
7
|
+
helpArgs: string[];
|
|
8
|
+
capabilityFlags: {
|
|
9
|
+
'--include-partial-messages': string;
|
|
10
|
+
'--add-dir': string;
|
|
11
|
+
};
|
|
12
|
+
fallbackModels: import("../types.js").RuntimeModelOption[];
|
|
13
|
+
reasoningOptions: {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
buildArgs: (_prompt: string, _imagePaths: string[], extraAllowedDirs?: string[] | undefined, options?: import("../types.js").RuntimeBuildOptions | undefined, runtimeContext?: import("../types.js").RuntimeContext | undefined) => string[];
|
|
18
|
+
promptViaStdin: true;
|
|
19
|
+
promptInputFormat: "stream-json";
|
|
20
|
+
streamFormat: string;
|
|
21
|
+
externalMcpInjection: "claude-mcp-json";
|
|
22
|
+
resumesSessionViaCli: true;
|
|
23
|
+
installUrl: string;
|
|
24
|
+
docsUrl: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=codebuddy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codebuddy.d.ts","sourceRoot":"","sources":["../../src/defs/codebuddy.ts"],"names":[],"mappings":"AA+CA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;CAgFH,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Ported verbatim from OD's `apps/daemon/src/runtimes/defs/codebuddy.ts` (import path adjusted only). See `source-map.md`. */
|
|
2
|
+
import { agentCapabilities } from '../capabilities.js';
|
|
3
|
+
import { DEFAULT_MODEL_OPTION } from './shared.js';
|
|
4
|
+
// Codebuddy Code (https://www.codebuddy.cn) — a Claude Code–compatible CLI
|
|
5
|
+
// that ships as `codebuddy` (short alias: `cbc`). The argument surface is a
|
|
6
|
+
// superset of Claude Code's `-p` mode: `--output-format stream-json`,
|
|
7
|
+
// `--input-format stream-json`, `--permission-mode`, `--session-id`,
|
|
8
|
+
// `--resume`, `--add-dir`, `--include-partial-messages`, and `--model` all
|
|
9
|
+
// work identically. The stream wire format matches Claude Code's, so we reuse
|
|
10
|
+
// `streamFormat: 'claude-stream-json'`.
|
|
11
|
+
//
|
|
12
|
+
// Key differences from the claude adapter:
|
|
13
|
+
// • Binary names: `codebuddy` / `cbc` (not `claude` / `openclaude`).
|
|
14
|
+
// • `--effort` flag for reasoning control (minimal/low/medium/high/xhigh/max).
|
|
15
|
+
// • Richer multi-provider model list (GLM, Kimi, MiniMax, Claude, GPT,
|
|
16
|
+
// Gemini, DeepSeek) exposed through `--model <id>`.
|
|
17
|
+
// • `--mcp-config <fileOrString>` for MCP server injection (the daemon can
|
|
18
|
+
// also write `.mcp.json` to the project cwd, same as Claude Code).
|
|
19
|
+
const CODEBUDDY_FALLBACK_MODELS = [
|
|
20
|
+
DEFAULT_MODEL_OPTION,
|
|
21
|
+
// GLM family (Zhipu AI)
|
|
22
|
+
{ id: 'glm-5.1-ioa', label: 'glm-5.1-ioa' },
|
|
23
|
+
{ id: 'glm-5v-turbo-ioa', label: 'glm-5v-turbo-ioa' },
|
|
24
|
+
// Claude family (via Codebuddy proxy)
|
|
25
|
+
{ id: 'claude-opus-4.8-1m', label: 'claude-opus-4.8-1m' },
|
|
26
|
+
{ id: 'claude-opus-4.8', label: 'claude-opus-4.8' },
|
|
27
|
+
{ id: 'claude-sonnet-4.6-1m', label: 'claude-sonnet-4.6-1m' },
|
|
28
|
+
{ id: 'claude-haiku-4.5', label: 'claude-haiku-4.5' },
|
|
29
|
+
// GPT family
|
|
30
|
+
{ id: 'gpt-5.5', label: 'gpt-5.5' },
|
|
31
|
+
{ id: 'gpt-5.4', label: 'gpt-5.4' },
|
|
32
|
+
{ id: 'gpt-5.3-codex', label: 'gpt-5.3-codex' },
|
|
33
|
+
// Gemini family
|
|
34
|
+
{ id: 'gemini-3.5-flash', label: 'gemini-3.5-flash' },
|
|
35
|
+
// DeepSeek family
|
|
36
|
+
{ id: 'deepseek-v4-pro-ioa', label: 'deepseek-v4-pro-ioa' },
|
|
37
|
+
{ id: 'deepseek-v4-flash-ioa', label: 'deepseek-v4-flash-ioa' },
|
|
38
|
+
// Kimi family
|
|
39
|
+
{ id: 'kimi-k2.6-ioa', label: 'kimi-k2.6-ioa' },
|
|
40
|
+
// MiniMax family
|
|
41
|
+
{ id: 'minimax-m3-ioa', label: 'minimax-m3-ioa' },
|
|
42
|
+
{ id: 'minimax-m2.7-ioa', label: 'minimax-m2.7-ioa' },
|
|
43
|
+
];
|
|
44
|
+
export const codebuddyAgentDef = {
|
|
45
|
+
id: 'codebuddy',
|
|
46
|
+
name: 'Codebuddy Code',
|
|
47
|
+
bin: 'codebuddy',
|
|
48
|
+
// `cbc` is the short alias shipped alongside `codebuddy`. Tried as a
|
|
49
|
+
// fallback when the primary binary isn't on PATH.
|
|
50
|
+
fallbackBins: ['cbc'],
|
|
51
|
+
versionArgs: ['--version'],
|
|
52
|
+
helpArgs: ['-p', '--help'],
|
|
53
|
+
capabilityFlags: {
|
|
54
|
+
// Same probing strategy as the claude adapter: these flags live under
|
|
55
|
+
// the `-p` subcommand help, so we probe `codebuddy -p --help`.
|
|
56
|
+
'--include-partial-messages': 'partialMessages',
|
|
57
|
+
'--add-dir': 'addDir',
|
|
58
|
+
},
|
|
59
|
+
fallbackModels: CODEBUDDY_FALLBACK_MODELS,
|
|
60
|
+
// Codebuddy CLI does not ship a `models` subcommand; the supported model
|
|
61
|
+
// ids are advertised in `--help` output. Fallback list above covers the
|
|
62
|
+
// current set; users can type custom ids through the "Custom" input.
|
|
63
|
+
// Codebuddy CLI --effort supports exactly 6 levels:
|
|
64
|
+
// minimal, low, medium, high, xhigh, max
|
|
65
|
+
// We additionally expose a synthetic `default` sentinel as the FIRST
|
|
66
|
+
// option so the web pickers (AvatarMenu / SettingsDialog) — which
|
|
67
|
+
// fall back to `reasoningOptions[0].id` when nothing is saved yet —
|
|
68
|
+
// surface a real "use Codebuddy's own default" choice that round-trips
|
|
69
|
+
// to "no --effort flag". `buildArgs` treats `default` as omit.
|
|
70
|
+
reasoningOptions: [
|
|
71
|
+
{ id: 'default', label: 'Default' },
|
|
72
|
+
{ id: 'minimal', label: 'Minimal' },
|
|
73
|
+
{ id: 'low', label: 'Low' },
|
|
74
|
+
{ id: 'medium', label: 'Medium' },
|
|
75
|
+
{ id: 'high', label: 'High' },
|
|
76
|
+
{ id: 'xhigh', label: 'XHigh' },
|
|
77
|
+
{ id: 'max', label: 'Max' },
|
|
78
|
+
],
|
|
79
|
+
buildArgs: (_prompt, _imagePaths, extraAllowedDirs = [], options = {}, runtimeContext = {}) => {
|
|
80
|
+
const caps = agentCapabilities.get('codebuddy') || {};
|
|
81
|
+
// Same stdin strategy as Claude Code: `--input-format stream-json`
|
|
82
|
+
// enables JSONL stdin so the daemon can answer AskUserQuestion tool
|
|
83
|
+
// calls. `--output-format stream-json` gives us SSE-style events.
|
|
84
|
+
const args = ['-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose'];
|
|
85
|
+
// `--include-partial-messages` lands richer streaming deltas. Gate on
|
|
86
|
+
// the help-text probe to avoid "unknown option" errors on older builds.
|
|
87
|
+
if (caps.partialMessages) {
|
|
88
|
+
args.push('--include-partial-messages');
|
|
89
|
+
}
|
|
90
|
+
if (options.model && options.model !== 'default') {
|
|
91
|
+
args.push('--model', options.model);
|
|
92
|
+
}
|
|
93
|
+
// Reasoning effort control — Codebuddy supports `--effort <level>`.
|
|
94
|
+
// The `default` sentinel means "let Codebuddy pick" — omit the flag.
|
|
95
|
+
if (options.reasoning && options.reasoning !== 'default') {
|
|
96
|
+
args.push('--effort', options.reasoning);
|
|
97
|
+
}
|
|
98
|
+
const dirs = (extraAllowedDirs || []).filter((d) => typeof d === 'string' && d.length > 0);
|
|
99
|
+
if (dirs.length > 0 && caps.addDir !== false) {
|
|
100
|
+
args.push('--add-dir', ...dirs);
|
|
101
|
+
}
|
|
102
|
+
// Session continuity: Codebuddy supports `--resume <id>` and
|
|
103
|
+
// `--session-id <uuid>` identically to Claude Code.
|
|
104
|
+
if (typeof runtimeContext.resumeSessionId === 'string' && runtimeContext.resumeSessionId) {
|
|
105
|
+
args.push('--resume', runtimeContext.resumeSessionId);
|
|
106
|
+
}
|
|
107
|
+
else if (typeof runtimeContext.newSessionId === 'string' && runtimeContext.newSessionId) {
|
|
108
|
+
args.push('--session-id', runtimeContext.newSessionId);
|
|
109
|
+
}
|
|
110
|
+
args.push('--permission-mode', 'bypassPermissions');
|
|
111
|
+
return args;
|
|
112
|
+
},
|
|
113
|
+
promptViaStdin: true,
|
|
114
|
+
promptInputFormat: 'stream-json',
|
|
115
|
+
streamFormat: 'claude-stream-json',
|
|
116
|
+
// Codebuddy CLI auto-loads `.mcp.json` from the project cwd at spawn
|
|
117
|
+
// (same behavior as Claude Code), so the daemon can write the user's
|
|
118
|
+
// external MCP servers there before launching.
|
|
119
|
+
externalMcpInjection: 'claude-mcp-json',
|
|
120
|
+
resumesSessionViaCli: true,
|
|
121
|
+
installUrl: 'https://www.codebuddy.cn',
|
|
122
|
+
docsUrl: 'https://www.codebuddy.cn/docs/workbuddy/Overview',
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=codebuddy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codebuddy.js","sourceRoot":"","sources":["../../src/defs/codebuddy.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAC/H,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,qEAAqE;AACrE,2EAA2E;AAC3E,8EAA8E;AAC9E,wCAAwC;AACxC,EAAE;AACF,2CAA2C;AAC3C,uEAAuE;AACvE,iFAAiF;AACjF,yEAAyE;AACzE,wDAAwD;AACxD,6EAA6E;AAC7E,uEAAuE;AAEvE,MAAM,yBAAyB,GAAG;IAChC,oBAAoB;IACpB,wBAAwB;IACxB,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC3C,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,EAAE;IACrD,sCAAsC;IACtC,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,EAAE;IACzD,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,EAAE,EAAE,sBAAsB,EAAE,KA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untimeModelOption } from '../types.js';
|
|
2
|
+
export declare function parseCodexDebugModels(stdout: string): RuntimeModelOption[] | null;
|
|
3
|
+
export declare function codexNeedsDangerFullAccessSandbox(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
4
|
+
export declare const codexAgentDef: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
bin: string;
|
|
8
|
+
versionArgs: string[];
|
|
9
|
+
listModels: {
|
|
10
|
+
args: string[];
|
|
11
|
+
parse: typeof parseCodexDebugModels;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
};
|
|
14
|
+
authProbe: {
|
|
15
|
+
args: string[];
|
|
16
|
+
timeoutMs: number;
|
|
17
|
+
};
|
|
18
|
+
fallbackModels: RuntimeModelOption[];
|
|
19
|
+
reasoningOptions: {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}[];
|
|
23
|
+
buildArgs: (_prompt: string, _imagePaths: string[], extraAllowedDirs?: string[] | undefined, options?: import("../types.js").RuntimeBuildOptions | undefined, runtimeContext?: import("../types.js").RuntimeContext | undefined) => string[];
|
|
24
|
+
promptViaStdin: true;
|
|
25
|
+
resumesSessionViaCli: true;
|
|
26
|
+
capturesSessionIdFromStream: true;
|
|
27
|
+
streamFormat: string;
|
|
28
|
+
eventParser: string;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/defs/codex.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,GAAG,IAAI,CAmCjF;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAST;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;CAoJC,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ported from OD's `apps/daemon/src/runtimes/defs/codex.ts` with one
|
|
3
|
+
* de-branding change: the two operator-override env vars (originally
|
|
4
|
+
* product-prefixed) are renamed to `CODEX_SANDBOX_MODE` /
|
|
5
|
+
* `CODEX_DISABLE_PLUGINS` — these are already codex-adapter-scoped
|
|
6
|
+
* operator knobs, so no product namespacing is needed. See
|
|
7
|
+
* `source-map.md` for the exact original names.
|
|
8
|
+
*/
|
|
9
|
+
import { DEFAULT_MODEL_OPTION, clampCodexReasoning } from './shared.js';
|
|
10
|
+
export function parseCodexDebugModels(stdout) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = JSON.parse(String(stdout || ''));
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (!parsed || typeof parsed !== 'object')
|
|
19
|
+
return null;
|
|
20
|
+
const models = parsed.models;
|
|
21
|
+
if (!Array.isArray(models))
|
|
22
|
+
return null;
|
|
23
|
+
const out = [DEFAULT_MODEL_OPTION];
|
|
24
|
+
const seen = new Set([DEFAULT_MODEL_OPTION.id]);
|
|
25
|
+
for (const raw of models) {
|
|
26
|
+
if (!raw || typeof raw !== 'object')
|
|
27
|
+
continue;
|
|
28
|
+
const entry = raw;
|
|
29
|
+
if (entry.visibility === 'hidden')
|
|
30
|
+
continue;
|
|
31
|
+
const id = typeof entry.slug === 'string' ? entry.slug.trim() : typeof entry.id === 'string' ? entry.id.trim() : '';
|
|
32
|
+
if (!id || seen.has(id))
|
|
33
|
+
continue;
|
|
34
|
+
seen.add(id);
|
|
35
|
+
const label = typeof entry.display_name === 'string' && entry.display_name.trim()
|
|
36
|
+
? entry.display_name.trim()
|
|
37
|
+
: typeof entry.name === 'string' && entry.name.trim()
|
|
38
|
+
? entry.name.trim()
|
|
39
|
+
: id;
|
|
40
|
+
out.push({ id, label });
|
|
41
|
+
}
|
|
42
|
+
return out.length > 1 ? out : null;
|
|
43
|
+
}
|
|
44
|
+
export function codexNeedsDangerFullAccessSandbox(platform = process.platform, env = process.env) {
|
|
45
|
+
// Operator override for deployments where Codex cannot create its
|
|
46
|
+
// workspace-write sandbox, for example unprivileged Linux containers.
|
|
47
|
+
// Only danger-full-access is accepted; unknown values keep the default path.
|
|
48
|
+
if (env.CODEX_SANDBOX_MODE?.trim() === 'danger-full-access')
|
|
49
|
+
return true;
|
|
50
|
+
if (platform === 'win32')
|
|
51
|
+
return true;
|
|
52
|
+
// WSL reports `linux` but Codex still hits the Windows read-only
|
|
53
|
+
// workspace-write sandbox path when launched from there.
|
|
54
|
+
return Boolean(env.WSL_DISTRO_NAME?.trim());
|
|
55
|
+
}
|
|
56
|
+
export const codexAgentDef = {
|
|
57
|
+
id: 'codex',
|
|
58
|
+
name: 'Codex CLI',
|
|
59
|
+
bin: 'codex',
|
|
60
|
+
versionArgs: ['--version'],
|
|
61
|
+
// Codex exposes its installed model catalog through `debug models` on
|
|
62
|
+
// recent CLIs. Older builds fall back to these static hints.
|
|
63
|
+
listModels: {
|
|
64
|
+
args: ['debug', 'models'],
|
|
65
|
+
parse: parseCodexDebugModels,
|
|
66
|
+
timeoutMs: 5000,
|
|
67
|
+
},
|
|
68
|
+
authProbe: {
|
|
69
|
+
args: ['login', 'status'],
|
|
70
|
+
timeoutMs: 5000,
|
|
71
|
+
},
|
|
72
|
+
fallbackModels: [
|
|
73
|
+
DEFAULT_MODEL_OPTION,
|
|
74
|
+
{ id: 'gpt-5.5', label: 'gpt-5.5' },
|
|
75
|
+
{ id: 'gpt-5.4', label: 'gpt-5.4' },
|
|
76
|
+
{ id: 'gpt-5.4-mini', label: 'gpt-5.4-mini' },
|
|
77
|
+
{ id: 'gpt-5.3-codex', label: 'gpt-5.3-codex' },
|
|
78
|
+
{ id: 'gpt-5.1', label: 'gpt-5.1' },
|
|
79
|
+
{ id: 'gpt-5.1-codex-mini', label: 'gpt-5.1-codex-mini' },
|
|
80
|
+
{ id: 'gpt-5-codex', label: 'gpt-5-codex' },
|
|
81
|
+
{ id: 'gpt-5', label: 'gpt-5' },
|
|
82
|
+
{ id: 'o3', label: 'o3' },
|
|
83
|
+
{ id: 'o4-mini', label: 'o4-mini' },
|
|
84
|
+
],
|
|
85
|
+
reasoningOptions: [
|
|
86
|
+
{ id: 'default', label: 'Default' },
|
|
87
|
+
{ id: 'none', label: 'None' },
|
|
88
|
+
{ id: 'minimal', label: 'Minimal' },
|
|
89
|
+
{ id: 'low', label: 'Low' },
|
|
90
|
+
{ id: 'medium', label: 'Medium' },
|
|
91
|
+
{ id: 'high', label: 'High' },
|
|
92
|
+
{ id: 'xhigh', label: 'XHigh' },
|
|
93
|
+
],
|
|
94
|
+
// Prompt is delivered via stdin pipe (gated by `promptViaStdin: true`
|
|
95
|
+
// below) to avoid Windows `spawn ENAMETOOLONG` while keeping Codex on
|
|
96
|
+
// its structured JSON stream. Recent Codex CLI versions reject a bare
|
|
97
|
+
// `-` argv sentinel — passing both the pipe and `-` produces
|
|
98
|
+
// `error: unexpected argument '-' found` and the agent exits with
|
|
99
|
+
// code 2 before any prompt is read. The pipe alone is sufficient for
|
|
100
|
+
// stdin delivery.
|
|
101
|
+
buildArgs: (_prompt, _imagePaths, extraAllowedDirs = [], options = {}, runtimeContext = {}) => {
|
|
102
|
+
// Codex CLI's `workspace-write` sandbox blocks shell invocations on
|
|
103
|
+
// Windows ("powershell.exe ... rejected: blocked by policy"),
|
|
104
|
+
// because Codex has no working OS-level sandbox on Windows and falls
|
|
105
|
+
// back to a coarse policy that rejects any shell. macOS (Seatbelt)
|
|
106
|
+
// and Linux (Landlock+seccomp) keep workspace-write because their
|
|
107
|
+
// sandbox enforcement permits shell while restricting writes.
|
|
108
|
+
const needsDangerFullAccess = codexNeedsDangerFullAccessSandbox();
|
|
109
|
+
// Capture-style resume: when the caller has a stored Codex thread id
|
|
110
|
+
// for this conversation it asks the CLI to continue that session
|
|
111
|
+
// with `exec resume <thread_id>` instead of `exec` (a fresh
|
|
112
|
+
// session). Codex mints its own id, so the caller does not specify
|
|
113
|
+
// one — it captures the id from the create turn's
|
|
114
|
+
// `thread.started.thread_id` event (see the json-event-stream
|
|
115
|
+
// `codex` parser) and replays it here on resume.
|
|
116
|
+
const resumeSessionId = typeof runtimeContext.resumeSessionId === 'string' &&
|
|
117
|
+
runtimeContext.resumeSessionId.length > 0
|
|
118
|
+
? runtimeContext.resumeSessionId
|
|
119
|
+
: null;
|
|
120
|
+
// `codex exec resume` rejects `--sandbox` (only valid on a fresh
|
|
121
|
+
// `exec`); the sandbox mode must be passed as a `-c sandbox_mode=...`
|
|
122
|
+
// config override. We mirror the exact same effective sandbox policy as
|
|
123
|
+
// the create turn so Codex's per-turn `turn_context` block byte-matches
|
|
124
|
+
// across turns and does not break the upstream prefix cache the resume
|
|
125
|
+
// is meant to reuse.
|
|
126
|
+
const sandboxArgs = needsDangerFullAccess
|
|
127
|
+
? resumeSessionId
|
|
128
|
+
? ['-c', 'sandbox_mode="danger-full-access"']
|
|
129
|
+
: ['--sandbox', 'danger-full-access']
|
|
130
|
+
: resumeSessionId
|
|
131
|
+
? [
|
|
132
|
+
'-c',
|
|
133
|
+
'sandbox_mode="workspace-write"',
|
|
134
|
+
'-c',
|
|
135
|
+
'sandbox_workspace_write.network_access=true',
|
|
136
|
+
]
|
|
137
|
+
: [
|
|
138
|
+
'--sandbox',
|
|
139
|
+
'workspace-write',
|
|
140
|
+
'-c',
|
|
141
|
+
'sandbox_workspace_write.network_access=true',
|
|
142
|
+
];
|
|
143
|
+
const args = resumeSessionId
|
|
144
|
+
? ['exec', 'resume', '--json', '--skip-git-repo-check', ...sandboxArgs]
|
|
145
|
+
: ['exec', '--json', '--skip-git-repo-check', ...sandboxArgs];
|
|
146
|
+
if (process.env.CODEX_DISABLE_PLUGINS === '1') {
|
|
147
|
+
args.push('--disable', 'plugins');
|
|
148
|
+
}
|
|
149
|
+
// `-C <cwd>` and `--add-dir <dir>` are CREATE-only flags: `codex exec
|
|
150
|
+
// resume` rejects both (`error: unexpected argument '-C' found`), so
|
|
151
|
+
// appending them on a resume turn would make the follow-up turn die
|
|
152
|
+
// before the first event. The caller already spawns the child with
|
|
153
|
+
// `cwd: effectiveCwd`, and resuming by explicit SESSION_ID does not
|
|
154
|
+
// use codex's cwd-based session filtering, so the resumed turn still
|
|
155
|
+
// runs in the right workspace without `-C`. The extra writable dirs
|
|
156
|
+
// were granted when the session was created and are carried by the
|
|
157
|
+
// resumed session.
|
|
158
|
+
if (!resumeSessionId) {
|
|
159
|
+
if (runtimeContext.cwd) {
|
|
160
|
+
args.push('-C', runtimeContext.cwd);
|
|
161
|
+
}
|
|
162
|
+
const dirs = (extraAllowedDirs || []).filter((d) => typeof d === 'string' && d.length > 0);
|
|
163
|
+
for (const d of dirs) {
|
|
164
|
+
args.push('--add-dir', d);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (options.model && options.model !== 'default') {
|
|
168
|
+
args.push('--model', options.model);
|
|
169
|
+
}
|
|
170
|
+
if (options.reasoning && options.reasoning !== 'default') {
|
|
171
|
+
const effort = clampCodexReasoning(options.model, options.reasoning);
|
|
172
|
+
// Codex accepts `-c key=value` config overrides; reasoning effort
|
|
173
|
+
// is exposed as `model_reasoning_effort`.
|
|
174
|
+
args.push('-c', `model_reasoning_effort="${effort}"`);
|
|
175
|
+
}
|
|
176
|
+
// The resume thread id is the positional SESSION_ID argument of
|
|
177
|
+
// `codex exec resume`; it must come after the flags. The prompt is
|
|
178
|
+
// delivered via stdin (promptViaStdin), so the thread id is the final
|
|
179
|
+
// argv entry.
|
|
180
|
+
if (resumeSessionId) {
|
|
181
|
+
args.push(resumeSessionId);
|
|
182
|
+
}
|
|
183
|
+
return args;
|
|
184
|
+
},
|
|
185
|
+
promptViaStdin: true,
|
|
186
|
+
// Codex's CLI carries its own session across spawns: on a follow-up turn
|
|
187
|
+
// the caller resumes the captured thread id instead of re-sending the
|
|
188
|
+
// flattened transcript, so the first upstream call reuses the warm prefix
|
|
189
|
+
// cache. Capture-style: the resume handle is the `thread.started.thread_id`
|
|
190
|
+
// captured from the stream, not a caller-minted id.
|
|
191
|
+
resumesSessionViaCli: true,
|
|
192
|
+
capturesSessionIdFromStream: true,
|
|
193
|
+
streamFormat: 'json-event-stream',
|
|
194
|
+
eventParser: 'codex',
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/defs/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIxE,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,MAAM,GAAI,MAA+B,CAAC,MAAM,CAAC;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,MAAM,GAAG,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,SAAS;QAC9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QACD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACzD,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YACrE,kEAAkE;YAClE,0CAA0C;YAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,2BAA2B,MAAM,GAAG,CAAC,CAAC;QACxD,CAAC;QACD,gEAAgE;QAChE,mEAAmE;QACnE,sEAAsE;QACtE,cAAc;QACd,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,cAAc,EAAE,IAAI;IACpB,yEAAyE;IACzE,sEAAsE;IACtE,0EAA0E;IAC1E,4EAA4E;IAC5E,oDAAoD;IACpD,oBAAoB,EAAE,IAAI;IAC1B,2BAA2B,EAAE,IAAI;IACjC,YAAY,EAAE,mBAAmB;IACjC,WAAW,EAAE,OAAO;CACG,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const copilotAgentDef: {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
bin: string;
|
|
5
|
+
versionArgs: string[];
|
|
6
|
+
fallbackModels: import("../types.js").RuntimeModelOption[];
|
|
7
|
+
buildArgs: (_prompt: string, _imagePaths: string[], extraAllowedDirs?: string[] | undefined, options?: import("../types.js").RuntimeBuildOptions | undefined) => string[];
|
|
8
|
+
promptViaStdin: true;
|
|
9
|
+
streamFormat: string;
|
|
10
|
+
inactivityTimeoutMs: number;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=copilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../src/defs/copilot.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe;;;;;;;;;;CA4ED,CAAC"}
|