@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/auth.js
CHANGED
|
@@ -19,140 +19,32 @@
|
|
|
19
19
|
* through to whichever guidance function they call. See `archived provenance ledger`.
|
|
20
20
|
*/
|
|
21
21
|
import { execAgentFile } from './invocation.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// chat UI is a dead end (no input field to paste the code into). Instead
|
|
35
|
-
// we ask the user to run `agy` in a terminal once, which opens the
|
|
36
|
-
// browser, completes OAuth, and writes the credentials to the system
|
|
37
|
-
// keyring — both `-p` and TUI invocations read from there afterward, so
|
|
38
|
-
// the chat run can succeed on retry.
|
|
39
|
-
export function antigravityAuthGuidance({}, { hostName = DEFAULT_HOST_NAME } = {}) {
|
|
40
|
-
return `Antigravity needs to sign in. The agy CLI's keyring entry has expired or been cleared, and \`-p\` print mode cannot complete OAuth on its own (it has no field to paste the auth code into).\n\nFix: open a terminal and run \`agy\` once — it will open Google sign-in in your browser, accept the redirect, and store the token in your system keyring. After you finish, return here and retry this chat. You only need to do this once; the keyring entry persists across both terminal and ${hostName} runs.`;
|
|
41
|
-
}
|
|
42
|
-
// agy's account-level quota is per-model (consumer accounts get a
|
|
43
|
-
// separate quota for Gemini 3 Pro vs Flash vs Claude vs GPT-OSS), and
|
|
44
|
-
// when exhausted the upstream returns
|
|
45
|
-
// RESOURCE_EXHAUSTED (code 429): Individual quota reached. Contact
|
|
46
|
-
// your administrator to enable overages. Resets in <H>h<M>m<S>s.
|
|
47
|
-
// to the `--log-file`. Print mode emits nothing on stdout/stderr, so
|
|
48
|
-
// without log inspection the failure misreads as missing-OAuth.
|
|
49
|
-
export function antigravityQuotaGuidance() {
|
|
50
|
-
return 'Antigravity returned "RESOURCE_EXHAUSTED: Individual quota reached" for the current model. Each Antigravity model (Gemini 3 Pro / Flash, Claude 4.6, GPT-OSS) has its own quota.\n\nFix: open `agy` in a terminal and use its Switch Model picker (the menu at the bottom of the TUI) to pick a model with available quota, then retry here. Quotas reset automatically on Antigravity\'s schedule.';
|
|
51
|
-
}
|
|
52
|
-
export function reasonixAuthGuidance({}, { hostName = DEFAULT_HOST_NAME } = {}) {
|
|
53
|
-
return `DeepSeek Reasonix is installed but is not authenticated. Add your API key in \`~/.reasonix/config.json\` under \`apiKey\`, or expose DEEPSEEK_API_KEY to ${hostName}'s daemon process, then retry. If ${hostName} is launched outside an interactive shell, shell rc files such as ~/.zshrc may not be loaded.`;
|
|
54
|
-
}
|
|
55
|
-
export function claudeAuthGuidance({}, { hostName = DEFAULT_HOST_NAME } = {}) {
|
|
56
|
-
return `Claude Code is installed but is not authenticated. Run \`claude auth login\` or open \`claude\` and complete login in a terminal, then rescan. If ${hostName} was launched outside an interactive shell, your shell rc files (e.g. ~/.zshrc) may not be loaded into its environment.`;
|
|
57
|
-
}
|
|
58
|
-
export function isCursorAuthFailureText({ text }) {
|
|
59
|
-
const value = String(text || '');
|
|
60
|
-
if (!value.trim())
|
|
61
|
-
return false;
|
|
62
|
-
return [
|
|
63
|
-
/authentication required/i,
|
|
64
|
-
/not authenticated/i,
|
|
65
|
-
/not logged in/i,
|
|
66
|
-
/unauthenticated/i,
|
|
67
|
-
/agent login/i,
|
|
68
|
-
/cursor_api_key/i,
|
|
69
|
-
].some((pattern) => pattern.test(value));
|
|
70
|
-
}
|
|
71
|
-
// agy's plain-mode output when no keyring credentials are available:
|
|
72
|
-
// - Top of stdout: "Authentication required. Please visit the URL to log in: <URL>"
|
|
73
|
-
// - Tail of stdout: "Waiting for authentication (timeout 30s)..."
|
|
74
|
-
// "Error: authentication timed out."
|
|
75
|
-
// The same TUI text is logged by `agy --log-file` as
|
|
76
|
-
// "You are not logged into Antigravity" and
|
|
77
|
-
// "error getting token source: You are not logged into Antigravity"
|
|
78
|
-
// Any of these is sufficient signal — match conservatively so the regex
|
|
79
|
-
// doesn't fire on prose containing the word "authentication" by accident.
|
|
80
|
-
export function isAntigravityAuthFailureText({ text }) {
|
|
81
|
-
const value = String(text || '');
|
|
82
|
-
if (!value.trim())
|
|
83
|
-
return false;
|
|
84
|
-
return (/authentication required.*please visit/i.test(value) ||
|
|
85
|
-
/authentication timed out/i.test(value) ||
|
|
86
|
-
/not logged into antigravity/i.test(value) ||
|
|
87
|
-
/accounts\.google\.com\/o\/oauth2\/auth.*antigravity/i.test(value));
|
|
88
|
-
}
|
|
89
|
-
export function isDeepSeekAuthFailureText({ text }) {
|
|
90
|
-
const value = String(text || '');
|
|
91
|
-
if (!value.trim())
|
|
92
|
-
return false;
|
|
93
|
-
const placeholderKey = /KEY=<your-key>/i.test(value) || /api_key\s*=\s*["']<your-key>["']/i.test(value);
|
|
94
|
-
const configMentionsKey = /~\/\.deepseek\/config\.toml/i.test(value) && /api[_ -]?key|KEY=/i.test(value);
|
|
95
|
-
const envKeyProblem = /DEEPSEEK_API_KEY/i.test(value) && /auth|missing|not set|required|unauthorized|empty|invalid/i.test(value);
|
|
96
|
-
return placeholderKey || configMentionsKey || envKeyProblem;
|
|
97
|
-
}
|
|
98
|
-
export function isReasonixAuthFailureText({ text }) {
|
|
99
|
-
const value = String(text || '');
|
|
100
|
-
if (!value.trim())
|
|
101
|
-
return false;
|
|
102
|
-
return ((/~\/\.reasonix\/config\.json/i.test(value) &&
|
|
103
|
-
/api[_ -]?key|missing|not set|required|unauthorized|invalid/i.test(value)) ||
|
|
104
|
-
(/DEEPSEEK_API_KEY/i.test(value) &&
|
|
105
|
-
/auth|missing|not set|required|unauthorized|invalid/i.test(value)));
|
|
106
|
-
}
|
|
107
|
-
// Structured verdict from `claude auth status` JSON: a boolean when either key
|
|
108
|
-
// is a boolean (`true` wins), undefined when the text is not JSON or carries
|
|
109
|
-
// neither key. Property access on a JSON `null` throws inside the `try`, which
|
|
110
|
-
// deliberately lands in the same text-matching fallback as invalid JSON.
|
|
111
|
-
function claudeJsonAuthFailure({ value }) {
|
|
112
|
-
try {
|
|
113
|
-
const parsed = JSON.parse(value);
|
|
114
|
-
if (parsed.authenticated === true || parsed.loggedIn === true)
|
|
115
|
-
return false;
|
|
116
|
-
if (parsed.authenticated === false || parsed.loggedIn === false)
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
// Fall through to text matching below.
|
|
121
|
-
}
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
function claudeTextAuthFailure({ value }) {
|
|
125
|
-
if (/"authenticated"\s*:\s*true/i.test(value) || /"loggedIn"\s*:\s*true/i.test(value)) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return [
|
|
129
|
-
/"authenticated"\s*:\s*false/i,
|
|
130
|
-
/"loggedIn"\s*:\s*false/i,
|
|
131
|
-
/not authenticated/i,
|
|
132
|
-
/not logged[ _-]?in/i,
|
|
133
|
-
/authentication required/i,
|
|
134
|
-
/please (?:sign|log)[ _-]?in/i,
|
|
135
|
-
].some((pattern) => pattern.test(value));
|
|
136
|
-
}
|
|
137
|
-
export function isClaudeAuthFailureText({ text }) {
|
|
138
|
-
const value = String(text || '');
|
|
139
|
-
if (!value.trim())
|
|
140
|
-
return false;
|
|
141
|
-
return claudeJsonAuthFailure({ value }) ?? claudeTextAuthFailure({ value });
|
|
142
|
-
}
|
|
22
|
+
import { DEFAULT_HOST_NAME } from './auth-common.js';
|
|
23
|
+
import { claudeAuthProfile } from './defs/claude/auth.js';
|
|
24
|
+
import { codexAuthProfile } from './defs/codex/auth.js';
|
|
25
|
+
import { cursorAuthProfile } from './defs/cursor-agent/auth.js';
|
|
26
|
+
import { deepseekAuthProfile } from './defs/deepseek/auth.js';
|
|
27
|
+
import { antigravityAuthProfile } from './defs/antigravity/auth.js';
|
|
28
|
+
import { reasonixAuthProfile } from './defs/reasonix/auth.js';
|
|
29
|
+
export { claudeAuthGuidance, isClaudeAuthFailureText } from './defs/claude/auth.js';
|
|
30
|
+
export { cursorAuthGuidance, isCursorAuthFailureText } from './defs/cursor-agent/auth.js';
|
|
31
|
+
export { deepseekAuthGuidance, isDeepSeekAuthFailureText } from './defs/deepseek/auth.js';
|
|
32
|
+
export { antigravityAuthGuidance, antigravityQuotaGuidance, isAntigravityAuthFailureText } from './defs/antigravity/auth.js';
|
|
33
|
+
export { reasonixAuthGuidance, isReasonixAuthFailureText } from './defs/reasonix/auth.js';
|
|
143
34
|
// Agents that ship a bespoke auth-failure classifier + tailored sign-in hint.
|
|
144
35
|
// Map (not an object literal) so an arbitrary agent id can never hit a
|
|
145
|
-
// prototype key.
|
|
36
|
+
// prototype key. Codex also declares credentials that satisfy its probe.
|
|
146
37
|
const TAILORED_AUTH_CLASSIFIERS = new Map([
|
|
147
|
-
['claude',
|
|
148
|
-
['
|
|
149
|
-
['
|
|
150
|
-
['
|
|
151
|
-
['
|
|
38
|
+
['claude', claudeAuthProfile],
|
|
39
|
+
['codex', codexAuthProfile],
|
|
40
|
+
['cursor-agent', cursorAuthProfile],
|
|
41
|
+
['deepseek', deepseekAuthProfile],
|
|
42
|
+
['antigravity', antigravityAuthProfile],
|
|
43
|
+
['reasonix', reasonixAuthProfile],
|
|
152
44
|
]);
|
|
153
45
|
export function classifyAgentAuthFailure({ agentId, text }, { hostName = DEFAULT_HOST_NAME } = {}) {
|
|
154
46
|
const classifier = TAILORED_AUTH_CLASSIFIERS.get(agentId);
|
|
155
|
-
if (!classifier?.isFailure({ text: text }))
|
|
47
|
+
if (!classifier?.isFailure?.({ text: text }) || !classifier.guidance)
|
|
156
48
|
return null;
|
|
157
49
|
return { status: 'missing', message: classifier.guidance({ hostName: hostName }) };
|
|
158
50
|
}
|
|
@@ -182,7 +74,7 @@ const AGENT_UPSTREAM_FAILURE_RE = new RegExp(`(\\b(overloaded(?:_error)?|service
|
|
|
182
74
|
// process failure. Auth is checked before rate/upstream so a `401` is never
|
|
183
75
|
// misread as a `5xx`. Pure text match — no agent-specific assumptions — so it
|
|
184
76
|
// applies uniformly to any CLI agent.
|
|
185
|
-
export function classifyAgentServiceFailure({ text }) {
|
|
77
|
+
export function classifyAgentServiceFailure({ text }, _optional = {}) {
|
|
186
78
|
const value = String(text || '');
|
|
187
79
|
if (!value.trim())
|
|
188
80
|
return null;
|
|
@@ -233,8 +125,8 @@ function genericAuthGuidance(agentName, hostName) {
|
|
|
233
125
|
// regex (e.g. cursor-agent's healthy `status` output mentions "login" in
|
|
234
126
|
// ways the generic matcher would misread). The generic classifier is only a
|
|
235
127
|
// fallback for adapters with no tailored classifier of their own.
|
|
236
|
-
// (The tailored set is
|
|
237
|
-
//
|
|
128
|
+
// (The tailored set is the entries with `isFailure` in `TAILORED_AUTH_CLASSIFIERS`,
|
|
129
|
+
// so the classifier and the fallback decision cannot drift apart.)
|
|
238
130
|
function hasNonEmptyEnv(env, keys) {
|
|
239
131
|
return keys.some((key) => {
|
|
240
132
|
const value = env[key];
|
|
@@ -242,13 +134,7 @@ function hasNonEmptyEnv(env, keys) {
|
|
|
242
134
|
});
|
|
243
135
|
}
|
|
244
136
|
function hasProbeSatisfyingApiKey(def, env) {
|
|
245
|
-
|
|
246
|
-
return hasNonEmptyEnv(env, ['CODEX_API_KEY', 'OPENAI_API_KEY']);
|
|
247
|
-
}
|
|
248
|
-
if (def.id === 'claude') {
|
|
249
|
-
return hasNonEmptyEnv(env, ['ANTHROPIC_API_KEY', 'ANTHROPIC_AUTH_TOKEN']);
|
|
250
|
-
}
|
|
251
|
-
return false;
|
|
137
|
+
return hasNonEmptyEnv(env, TAILORED_AUTH_CLASSIFIERS.get(def.id)?.apiKeyEnv ?? []);
|
|
252
138
|
}
|
|
253
139
|
// Classify an auth-probe's combined output into a missing-auth result, or
|
|
254
140
|
// null when the output does not look like an auth failure. Agents with a
|
|
@@ -257,7 +143,7 @@ function hasProbeSatisfyingApiKey(def, env) {
|
|
|
257
143
|
// HTTP/text classifier so it still gets a usable signal without bespoke
|
|
258
144
|
// regexes.
|
|
259
145
|
function classifyProbedAuthFailure(def, text, hostName) {
|
|
260
|
-
if (TAILORED_AUTH_CLASSIFIERS.
|
|
146
|
+
if (TAILORED_AUTH_CLASSIFIERS.get(def.id)?.isFailure) {
|
|
261
147
|
return classifyAgentAuthFailure({ agentId: def.id, text: text }, { hostName: hostName });
|
|
262
148
|
}
|
|
263
149
|
if (classifyAgentServiceFailure({ text: text }) === 'AGENT_AUTH_REQUIRED') {
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const agentCapabilities: Map<string, import("
|
|
1
|
+
export declare const agentCapabilities: Map<string, import("@jini-ai/core/contracts/agents").RuntimeCapabilityMap>;
|
|
2
2
|
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentRuntimeState } from './runtime-state.js';
|
|
2
|
-
import type { RuntimeEnv, RuntimeModelOption } from '
|
|
2
|
+
import type { RuntimeEnv, RuntimeModelOption } from '@jini-ai/core/contracts/agents';
|
|
3
3
|
/** The single stdin line that asks the CLI for its initialize payload (which carries `models`). */
|
|
4
4
|
export declare const CLAUDE_CODE_INITIALIZE_REQUEST = "{\"type\":\"control_request\",\"request_id\":\"jini-model-probe\",\"request\":{\"subtype\":\"initialize\"}}\n";
|
|
5
5
|
/**
|
|
@@ -29,7 +29,9 @@ export type ClaudeCodePickerCacheParse = {
|
|
|
29
29
|
* @returns Normalized ids (bracket suffix stripped), or a typed reason. Never throws.
|
|
30
30
|
* @complexity O(n) over the cache entries (plus the JSON parse of the whole file).
|
|
31
31
|
*/
|
|
32
|
-
export declare function parseClaudeCodePickerCache(raw
|
|
32
|
+
export declare function parseClaudeCodePickerCache({ raw }: {
|
|
33
|
+
raw: string;
|
|
34
|
+
}, _optional?: Record<string, never>): ClaudeCodePickerCacheParse;
|
|
33
35
|
/**
|
|
34
36
|
* Parses the CLI's stream-json stdout for the initialize `control_response` and returns its model
|
|
35
37
|
* rows (aliases and concrete ids, bracket suffixes stripped, deduped, `default` excluded).
|
|
@@ -37,9 +39,13 @@ export declare function parseClaudeCodePickerCache(raw: string): ClaudeCodePicke
|
|
|
37
39
|
* @returns The rows, or `null` when no well-formed response with at least one usable model exists.
|
|
38
40
|
* @complexity O(s + n) over the stdout length and the n models listed.
|
|
39
41
|
*/
|
|
40
|
-
export declare function parseClaudeInitializeModels(stdout
|
|
42
|
+
export declare function parseClaudeInitializeModels({ stdout }: {
|
|
43
|
+
stdout: string;
|
|
44
|
+
}, _optional?: Record<string, never>): RuntimeModelOption[] | null;
|
|
41
45
|
/** Where Claude Code keeps `.claude.json` for this env: `$CLAUDE_CONFIG_DIR` when set, else HOME. */
|
|
42
|
-
export declare function resolveClaudeConfigPath(env
|
|
46
|
+
export declare function resolveClaudeConfigPath({ env }: {
|
|
47
|
+
env: RuntimeEnv;
|
|
48
|
+
}, _optional?: Record<string, never>): string;
|
|
43
49
|
/** The two I/O edges, injectable so tests never spawn a real CLI or read the real home dir. */
|
|
44
50
|
export interface ClaudeCodeModelIo {
|
|
45
51
|
/** Runs the initialize probe; resolves to whatever stdout was captured, or `null`. Never rejects. */
|
|
@@ -48,7 +54,9 @@ export interface ClaudeCodeModelIo {
|
|
|
48
54
|
readConfigFile(path: string): Promise<string | null>;
|
|
49
55
|
}
|
|
50
56
|
/** Test-only: install fake I/O (or `null` to restore the real one) and clear the process cache. */
|
|
51
|
-
export declare function setClaudeCodeModelIoForTesting(io
|
|
57
|
+
export declare function setClaudeCodeModelIoForTesting({ io }: {
|
|
58
|
+
io: ClaudeCodeModelIo | null;
|
|
59
|
+
}, _optional?: Record<string, never>): void;
|
|
52
60
|
/** Options for the object call form of {@link loadClaudeCodeModels}. */
|
|
53
61
|
export interface ClaudeCodeModelsOptions {
|
|
54
62
|
state?: AgentRuntimeState;
|
|
@@ -39,7 +39,8 @@ import { createHash } from 'node:crypto';
|
|
|
39
39
|
import { readFile } from 'node:fs/promises';
|
|
40
40
|
import os from 'node:os';
|
|
41
41
|
import { join } from 'node:path';
|
|
42
|
-
import {
|
|
42
|
+
import { planCommandInvocation } from '@jini-ai/core/contracts/runtime';
|
|
43
|
+
import { ambientCommandShell } from './invocation.js';
|
|
43
44
|
import { sanitizeCustomModel } from './models.js';
|
|
44
45
|
/** A spawn costs ~2.5s and the picker list only moves when Claude Code updates or the server's
|
|
45
46
|
* "additional" options change, so one answer is trusted for this long per process. Failures are
|
|
@@ -86,7 +87,7 @@ function stripTrailingBracketGroup(raw) {
|
|
|
86
87
|
* @returns Normalized ids (bracket suffix stripped), or a typed reason. Never throws.
|
|
87
88
|
* @complexity O(n) over the cache entries (plus the JSON parse of the whole file).
|
|
88
89
|
*/
|
|
89
|
-
export function parseClaudeCodePickerCache(raw) {
|
|
90
|
+
export function parseClaudeCodePickerCache({ raw }, _optional = {}) {
|
|
90
91
|
let parsed;
|
|
91
92
|
try {
|
|
92
93
|
parsed = JSON.parse(raw);
|
|
@@ -152,7 +153,7 @@ function initializeEntryRows(entry) {
|
|
|
152
153
|
* @returns The rows, or `null` when no well-formed response with at least one usable model exists.
|
|
153
154
|
* @complexity O(s + n) over the stdout length and the n models listed.
|
|
154
155
|
*/
|
|
155
|
-
export function parseClaudeInitializeModels(stdout) {
|
|
156
|
+
export function parseClaudeInitializeModels({ stdout }, _optional = {}) {
|
|
156
157
|
const models = findInitializeModels(String(stdout || ''));
|
|
157
158
|
if (!models)
|
|
158
159
|
return null;
|
|
@@ -171,7 +172,7 @@ export function parseClaudeInitializeModels(stdout) {
|
|
|
171
172
|
return out.length > 0 ? out : null;
|
|
172
173
|
}
|
|
173
174
|
/** Where Claude Code keeps `.claude.json` for this env: `$CLAUDE_CONFIG_DIR` when set, else HOME. */
|
|
174
|
-
export function resolveClaudeConfigPath(env) {
|
|
175
|
+
export function resolveClaudeConfigPath({ env }, _optional = {}) {
|
|
175
176
|
const configDir = typeof env.CLAUDE_CONFIG_DIR === 'string' ? env.CLAUDE_CONFIG_DIR.trim() : '';
|
|
176
177
|
if (configDir)
|
|
177
178
|
return join(configDir, '.claude.json');
|
|
@@ -181,7 +182,8 @@ export function resolveClaudeConfigPath(env) {
|
|
|
181
182
|
function runInitializeProbe(bin, env) {
|
|
182
183
|
return new Promise((resolve) => {
|
|
183
184
|
try {
|
|
184
|
-
const
|
|
185
|
+
const { platform, fallbackComSpec } = ambientCommandShell({});
|
|
186
|
+
const invocation = planCommandInvocation({ command: bin, platform, env }, { args: [...CLAUDE_CODE_INITIALIZE_ARGS], fallbackComSpec });
|
|
185
187
|
const child = execFile(invocation.command, invocation.args, {
|
|
186
188
|
env: env,
|
|
187
189
|
// Neutral cwd, same reason as `invocation.ts#execAgentFile`: a metadata probe must never
|
|
@@ -207,7 +209,7 @@ const defaultIo = {
|
|
|
207
209
|
};
|
|
208
210
|
let activeIo = defaultIo;
|
|
209
211
|
/** Test-only: install fake I/O (or `null` to restore the real one) and clear the process cache. */
|
|
210
|
-
export function setClaudeCodeModelIoForTesting(io) {
|
|
212
|
+
export function setClaudeCodeModelIoForTesting({ io }, _optional = {}) {
|
|
211
213
|
activeIo = io ?? defaultIo;
|
|
212
214
|
defaultRuntimeState.claudeModels.clear();
|
|
213
215
|
}
|
|
@@ -218,17 +220,17 @@ function cacheKeyFor(bin, env) {
|
|
|
218
220
|
.map((name) => (typeof env[name] === 'string' ? env[name] : ''))
|
|
219
221
|
.join('\u0000');
|
|
220
222
|
const fingerprint = createHash('sha256').update(auth).digest('hex').slice(0, 16);
|
|
221
|
-
return `${bin}\u0000${resolveClaudeConfigPath(env)}\u0000${fingerprint}`;
|
|
223
|
+
return `${bin}\u0000${resolveClaudeConfigPath({ env })}\u0000${fingerprint}`;
|
|
222
224
|
}
|
|
223
225
|
/** Source (1), then source (2). Never rejects. */
|
|
224
226
|
async function discoverClaudeCodeModels(bin, env, io) {
|
|
225
227
|
try {
|
|
226
228
|
const stdout = await io.runInitialize(bin, env);
|
|
227
|
-
const fromCli = stdout ? parseClaudeInitializeModels(stdout) : null;
|
|
229
|
+
const fromCli = stdout ? parseClaudeInitializeModels({ stdout }) : null;
|
|
228
230
|
if (fromCli)
|
|
229
231
|
return fromCli;
|
|
230
|
-
const raw = await io.readConfigFile(resolveClaudeConfigPath(env));
|
|
231
|
-
const cached = raw === null ? null : parseClaudeCodePickerCache(raw);
|
|
232
|
+
const raw = await io.readConfigFile(resolveClaudeConfigPath({ env }));
|
|
233
|
+
const cached = raw === null ? null : parseClaudeCodePickerCache({ raw });
|
|
232
234
|
if (!cached?.ok)
|
|
233
235
|
return null;
|
|
234
236
|
return cached.ids
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execAgentFile } from './invocation.js';
|
|
2
|
-
import type { RuntimeBuildOptions } from '
|
|
2
|
+
import type { RuntimeBuildOptions } from '@jini-ai/core/contracts/agents';
|
|
3
3
|
/** Canonical host directory and attachment grants, checked again after image augmentation.
|
|
4
4
|
* Throws before spawn on missing/non-directory roots, conflicting cwd, traversal or symlinks.
|
|
5
5
|
* Reuses the platform reader's containment owner; O(n) filesystem checks for n supplied paths.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { ClaudeStreamEvent } from './claude-stream.js';
|
|
2
|
+
export type EventSink = (event: ClaudeStreamEvent) => void;
|
|
3
|
+
export type BlockState = {
|
|
4
|
+
type?: unknown;
|
|
5
|
+
name?: unknown;
|
|
6
|
+
id?: unknown;
|
|
7
|
+
input: string;
|
|
8
|
+
inputValue?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type RuntimeTask = {
|
|
11
|
+
id: string;
|
|
12
|
+
content: string;
|
|
13
|
+
status: 'pending' | 'in_progress' | 'completed' | 'stopped';
|
|
14
|
+
activeForm?: string;
|
|
15
|
+
};
|
|
16
|
+
export type RuntimeTaskIdCounter = {
|
|
17
|
+
next: number;
|
|
18
|
+
};
|
|
19
|
+
export interface TaskRegistry {
|
|
20
|
+
tasks: Map<string, RuntimeTask>;
|
|
21
|
+
counter: RuntimeTaskIdCounter;
|
|
22
|
+
seenToolUseIds: Set<string>;
|
|
23
|
+
}
|
|
24
|
+
export interface ArtifactEchoContext {
|
|
25
|
+
suppressHtmlArtifactsAfterFileWrite: boolean;
|
|
26
|
+
wroteHtmlFileThisTurn: boolean;
|
|
27
|
+
recentWriteContents: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export declare function toolInputPath({ input }: {
|
|
30
|
+
input: Record<string, unknown>;
|
|
31
|
+
}, _optional?: Record<string, never>): string;
|
|
32
|
+
export declare function normalizeTaskStatus({ value }: {
|
|
33
|
+
value: unknown;
|
|
34
|
+
}, _optional?: Record<string, never>): RuntimeTask['status'];
|
|
35
|
+
export declare function runtimeTaskIdFromCreate({ input, counter }: {
|
|
36
|
+
input: Record<string, unknown>;
|
|
37
|
+
counter: RuntimeTaskIdCounter;
|
|
38
|
+
}, _optional?: Record<string, never>): string;
|
|
39
|
+
export declare function applyTaskCreate({ input, tasks, counter }: {
|
|
40
|
+
input: Record<string, unknown>;
|
|
41
|
+
tasks: Map<string, RuntimeTask>;
|
|
42
|
+
counter: RuntimeTaskIdCounter;
|
|
43
|
+
}, _optional?: Record<string, never>): boolean;
|
|
44
|
+
export declare function applyTaskUpdate({ input, tasks }: {
|
|
45
|
+
input: Record<string, unknown>;
|
|
46
|
+
tasks: Map<string, RuntimeTask>;
|
|
47
|
+
}, _optional?: Record<string, never>): boolean;
|
|
48
|
+
export declare function emitCanonicalTaskSnapshot({ toolUseId, name, input, registry, onEvent }: {
|
|
49
|
+
toolUseId: unknown;
|
|
50
|
+
name: unknown;
|
|
51
|
+
input: unknown;
|
|
52
|
+
registry: TaskRegistry;
|
|
53
|
+
onEvent: EventSink;
|
|
54
|
+
}, _optional?: Record<string, never>): boolean;
|
|
55
|
+
export declare function isFileWriteToolUse({ name, input }: {
|
|
56
|
+
name: unknown;
|
|
57
|
+
input: unknown;
|
|
58
|
+
}, _optional?: Record<string, never>): boolean;
|
|
59
|
+
export declare function fileWriteContent({ input }: {
|
|
60
|
+
input: unknown;
|
|
61
|
+
}, _optional?: Record<string, never>): string | null;
|
|
62
|
+
export declare function isHtmlWriteToolInput({ input }: {
|
|
63
|
+
input: unknown;
|
|
64
|
+
}, _optional?: Record<string, never>): boolean;
|
|
65
|
+
export declare function artifactOpenCandidateLength({ text, openTag }: {
|
|
66
|
+
text: string;
|
|
67
|
+
openTag: string;
|
|
68
|
+
}, _optional?: Record<string, never>): number;
|
|
69
|
+
export declare function normalizeArtifactEchoContent({ value }: {
|
|
70
|
+
value: string;
|
|
71
|
+
}, _optional?: Record<string, never>): string;
|
|
72
|
+
export declare function isRedundantWrittenArtifact({ candidate, ctx }: {
|
|
73
|
+
candidate: string;
|
|
74
|
+
ctx: ArtifactEchoContext;
|
|
75
|
+
}, _optional?: Record<string, never>): boolean;
|
|
76
|
+
export declare function assistantText({ content }: {
|
|
77
|
+
content: unknown[];
|
|
78
|
+
}, _optional?: Record<string, never>): string;
|
|
79
|
+
export declare function isUnstreamedTextBlock(block: Record<string, unknown>, { alreadyStreamed }: {
|
|
80
|
+
alreadyStreamed: boolean;
|
|
81
|
+
}): block is Record<string, unknown> & {
|
|
82
|
+
text: string;
|
|
83
|
+
};
|
|
84
|
+
export declare function isUnstreamedThinkingBlock(block: Record<string, unknown>, { alreadyStreamed }: {
|
|
85
|
+
alreadyStreamed: boolean;
|
|
86
|
+
}): block is Record<string, unknown> & {
|
|
87
|
+
thinking: string;
|
|
88
|
+
};
|
|
89
|
+
/** One MCP server's state from an init frame's `mcp_servers`, e.g. `{ name: 'jini', status: 'failed' }`. */
|
|
90
|
+
export interface McpServerStatus {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly status: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The init frame's `mcp_servers`, reduced to `{name, status}`, or `undefined` when the frame has no
|
|
96
|
+
* such list. Kept on the event so a host can tell "its bridge did not connect" from "no bridge was
|
|
97
|
+
* configured": Claude Code times a dead MCP server out, reports it `failed` here, and carries on
|
|
98
|
+
* without its tools (the 2026-10-01 desktop incident). Entries without a string name and status are
|
|
99
|
+
* dropped rather than guessed at.
|
|
100
|
+
*/
|
|
101
|
+
export declare function initMcpServers({ obj }: {
|
|
102
|
+
obj: Record<string, unknown>;
|
|
103
|
+
}, _optional?: Record<string, never>): McpServerStatus[] | undefined;
|
|
104
|
+
export declare function handleSystemMessage({ obj, onEvent }: {
|
|
105
|
+
obj: Record<string, unknown>;
|
|
106
|
+
onEvent: EventSink;
|
|
107
|
+
}, _optional?: Record<string, never>): void;
|
|
108
|
+
export declare function stringifyToolResult({ content }: {
|
|
109
|
+
content: unknown;
|
|
110
|
+
}, _optional?: Record<string, never>): string;
|
|
111
|
+
export declare function handleUserMessage({ obj, onEvent }: {
|
|
112
|
+
obj: Record<string, unknown>;
|
|
113
|
+
onEvent: EventSink;
|
|
114
|
+
}, _optional?: Record<string, never>): void;
|
|
115
|
+
export declare function applyInputJsonDelta({ state, partialJson, onEvent }: {
|
|
116
|
+
state: BlockState | undefined;
|
|
117
|
+
partialJson: string;
|
|
118
|
+
onEvent: EventSink;
|
|
119
|
+
}, _optional?: Record<string, never>): void;
|
|
120
|
+
export declare function emitAssistantErrorIfPresent({ obj, content, onEvent }: {
|
|
121
|
+
obj: Record<string, unknown>;
|
|
122
|
+
content: unknown[];
|
|
123
|
+
onEvent: EventSink;
|
|
124
|
+
}, _optional?: Record<string, never>): void;
|
|
125
|
+
//# sourceMappingURL=claude-stream-frames.d.ts.map
|