@jini-ai/agent-runtime 0.7.2 → 0.7.3-next.2
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 -3
- 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 +6 -1
- package/dist/agent-protocol/acp/constants.js +7 -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 +161 -128
- 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 +231 -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 +28 -16
- 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
|
@@ -68,6 +68,10 @@ export declare function createToolCallTextSuppressor(): ArtifactTextSuppressor;
|
|
|
68
68
|
* @param text - The raw text delta to strip.
|
|
69
69
|
* @returns `true` when a `text_delta` was emitted, `false` otherwise.
|
|
70
70
|
*/
|
|
71
|
-
export declare function emitWithTextSuppressor(suppressor
|
|
71
|
+
export declare function emitWithTextSuppressor({ suppressor, onEvent, text }: {
|
|
72
|
+
suppressor: ArtifactTextSuppressor;
|
|
73
|
+
onEvent: EventSink;
|
|
74
|
+
text: string;
|
|
75
|
+
}, _optional?: Record<string, never>): boolean;
|
|
72
76
|
export {};
|
|
73
77
|
//# sourceMappingURL=text-suppression.d.ts.map
|
|
@@ -150,7 +150,7 @@ function createTaggedTextSuppressor(args) {
|
|
|
150
150
|
* @param text - The raw text delta to strip.
|
|
151
151
|
* @returns `true` when a `text_delta` was emitted, `false` otherwise.
|
|
152
152
|
*/
|
|
153
|
-
export function emitWithTextSuppressor(suppressor, onEvent, text) {
|
|
153
|
+
export function emitWithTextSuppressor({ suppressor, onEvent, text }, _optional = {}) {
|
|
154
154
|
const delta = suppressor.strip(text);
|
|
155
155
|
if (!delta)
|
|
156
156
|
return false;
|
|
@@ -17,7 +17,9 @@ import { type AccountFailureClassifier } from './account-failure.js';
|
|
|
17
17
|
* @param update - A parsed ACP `session/update` params object.
|
|
18
18
|
* @returns A flat diagnostic object suitable for inclusion in an agent event payload.
|
|
19
19
|
*/
|
|
20
|
-
export declare function acpRawEventShape(update
|
|
20
|
+
export declare function acpRawEventShape({ update }: {
|
|
21
|
+
update: UnknownRecord;
|
|
22
|
+
}, _optional?: Record<string, never>): {
|
|
21
23
|
sessionUpdate: string | null;
|
|
22
24
|
keys: string[];
|
|
23
25
|
contentKind: string;
|
|
@@ -42,25 +44,33 @@ export declare function acpRawEventShape(update: UnknownRecord): {
|
|
|
42
44
|
*
|
|
43
45
|
* @param update - A parsed ACP `session/update` params object.
|
|
44
46
|
*/
|
|
45
|
-
export declare function acpUpdateStatus(update
|
|
47
|
+
export declare function acpUpdateStatus({ update }: {
|
|
48
|
+
update: UnknownRecord;
|
|
49
|
+
}, _optional?: Record<string, never>): string;
|
|
46
50
|
/**
|
|
47
51
|
* Returns `true` when the update's `status` field represents a successful
|
|
48
52
|
* terminal state (`completed`, `complete`, `succeeded`, or `success`).
|
|
49
53
|
* Used to decide when to emit deferred artifact-write tool events.
|
|
50
54
|
*/
|
|
51
|
-
export declare function isAcpCompletedStatus(update
|
|
55
|
+
export declare function isAcpCompletedStatus({ update }: {
|
|
56
|
+
update: UnknownRecord;
|
|
57
|
+
}, _optional?: Record<string, never>): boolean;
|
|
52
58
|
/**
|
|
53
59
|
* Returns `true` when the update's `status` field represents a terminal
|
|
54
60
|
* failure state (`failed`, `failure`, `error`, `cancelled`, or `canceled`).
|
|
55
61
|
* Used to clean up pending write-suppression state and emit failed tool events.
|
|
56
62
|
*/
|
|
57
|
-
export declare function isAcpTerminalFailureStatus(update
|
|
63
|
+
export declare function isAcpTerminalFailureStatus({ update }: {
|
|
64
|
+
update: UnknownRecord;
|
|
65
|
+
}, _optional?: Record<string, never>): boolean;
|
|
58
66
|
/**
|
|
59
67
|
* Returns `true` when the update's status is `'retry'`. Signals that the AMR
|
|
60
68
|
* agent wants to restart the request; the session promoter maps this to a
|
|
61
69
|
* structured error payload via `promotedAmrRetryStatusPayload`.
|
|
62
70
|
*/
|
|
63
|
-
export declare function isAcpRetryStatus(update
|
|
71
|
+
export declare function isAcpRetryStatus({ update }: {
|
|
72
|
+
update: UnknownRecord;
|
|
73
|
+
}, _optional?: Record<string, never>): boolean;
|
|
64
74
|
/**
|
|
65
75
|
* Recursively collects all text-bearing leaf values from an ACP update
|
|
66
76
|
* (strings, numbers, booleans) up to 4 levels deep. Used to produce a flat
|
|
@@ -71,7 +81,11 @@ export declare function isAcpRetryStatus(update: UnknownRecord): boolean;
|
|
|
71
81
|
* @param depth - Current recursion depth (max 4); callers omit this.
|
|
72
82
|
* @returns A flat array of trimmed non-empty string representations.
|
|
73
83
|
*/
|
|
74
|
-
export declare function acpUpdateDiagnosticText(value
|
|
84
|
+
export declare function acpUpdateDiagnosticText({ value }: {
|
|
85
|
+
value: unknown;
|
|
86
|
+
}, { depth }?: {
|
|
87
|
+
depth?: number | undefined;
|
|
88
|
+
}): string[];
|
|
75
89
|
/**
|
|
76
90
|
* Promotes an AMR `retry` status update into a structured error payload when
|
|
77
91
|
* the update's diagnostic text matches a known account-failure pattern (e.g.
|
|
@@ -83,7 +97,11 @@ export declare function acpUpdateDiagnosticText(value: unknown, depth?: number):
|
|
|
83
97
|
* `noopAccountFailureClassifier`, under which this always returns `null`.
|
|
84
98
|
* @returns A structured error payload with `message` and `error`, or `null`.
|
|
85
99
|
*/
|
|
86
|
-
export declare function promotedAmrRetryStatusPayload(update
|
|
100
|
+
export declare function promotedAmrRetryStatusPayload({ update }: {
|
|
101
|
+
update: UnknownRecord;
|
|
102
|
+
}, { classifier }?: {
|
|
103
|
+
classifier?: AccountFailureClassifier | undefined;
|
|
104
|
+
}): {
|
|
87
105
|
message: string;
|
|
88
106
|
error: {
|
|
89
107
|
code: string;
|
|
@@ -108,7 +126,11 @@ export declare function promotedAmrRetryStatusPayload(update: UnknownRecord, cla
|
|
|
108
126
|
* `noopAccountFailureClassifier`, under which this always returns `null`.
|
|
109
127
|
* @returns A structured error payload, or `null` when not applicable.
|
|
110
128
|
*/
|
|
111
|
-
export declare function promotedAmrStderrPayload(chunk
|
|
129
|
+
export declare function promotedAmrStderrPayload({ chunk }: {
|
|
130
|
+
chunk: string;
|
|
131
|
+
}, { classifier }?: {
|
|
132
|
+
classifier?: AccountFailureClassifier | undefined;
|
|
133
|
+
}): {
|
|
112
134
|
message: string;
|
|
113
135
|
error: {
|
|
114
136
|
code: string;
|
|
@@ -129,7 +151,9 @@ export declare function promotedAmrStderrPayload(chunk: string, classifier?: Acc
|
|
|
129
151
|
*
|
|
130
152
|
* @param update - A parsed ACP `session/update` params object.
|
|
131
153
|
*/
|
|
132
|
-
export declare function acpToolCallId(update
|
|
154
|
+
export declare function acpToolCallId({ update }: {
|
|
155
|
+
update: UnknownRecord;
|
|
156
|
+
}, _optional?: Record<string, never>): string | null;
|
|
133
157
|
/**
|
|
134
158
|
* Returns `true` when the update's `title` or `name` field contains a word
|
|
135
159
|
* that indicates a file-write operation (`edit`, `write`, `create`, `update`,
|
|
@@ -138,7 +162,9 @@ export declare function acpToolCallId(update: UnknownRecord): string | null;
|
|
|
138
162
|
*
|
|
139
163
|
* @param update - A parsed ACP `session/update` params object.
|
|
140
164
|
*/
|
|
141
|
-
export declare function isAcpArtifactWriteLabel(update
|
|
165
|
+
export declare function isAcpArtifactWriteLabel({ update }: {
|
|
166
|
+
update: UnknownRecord;
|
|
167
|
+
}, _optional?: Record<string, never>): boolean;
|
|
142
168
|
/**
|
|
143
169
|
* Returns `true` when an ACP update represents the terminal completion of an
|
|
144
170
|
* artifact-write tool call and should arm the DSML text suppressor. Requires
|
|
@@ -148,7 +174,10 @@ export declare function isAcpArtifactWriteLabel(update: UnknownRecord): boolean;
|
|
|
148
174
|
* @param update - A parsed ACP `session/update` params object.
|
|
149
175
|
* @param writeToolCallIds - The set of tool call ids identified as artifact writes so far.
|
|
150
176
|
*/
|
|
151
|
-
export declare function isAcpArtifactWriteUpdate(update
|
|
177
|
+
export declare function isAcpArtifactWriteUpdate({ update, writeToolCallIds }: {
|
|
178
|
+
update: UnknownRecord;
|
|
179
|
+
writeToolCallIds: Set<string>;
|
|
180
|
+
}, _optional?: Record<string, never>): boolean;
|
|
152
181
|
/**
|
|
153
182
|
* Best-effort extraction of a concrete file path from an ACP artifact-write
|
|
154
183
|
* tool call update, checking three sources in priority order:
|
|
@@ -162,5 +191,7 @@ export declare function isAcpArtifactWriteUpdate(update: UnknownRecord, writeToo
|
|
|
162
191
|
* @param update - A parsed ACP `session/update` params object.
|
|
163
192
|
* @returns An absolute or relative file path string, or `null` when absent.
|
|
164
193
|
*/
|
|
165
|
-
export declare function acpArtifactWritePath(update
|
|
194
|
+
export declare function acpArtifactWritePath({ update }: {
|
|
195
|
+
update: UnknownRecord;
|
|
196
|
+
}, _optional?: Record<string, never>): string | null;
|
|
166
197
|
//# sourceMappingURL=updates.d.ts.map
|
|
@@ -10,22 +10,22 @@ import { accountFailureDetails, noopAccountFailureClassifier, } from './account-
|
|
|
10
10
|
* @param update - A parsed ACP `session/update` params object.
|
|
11
11
|
* @returns A flat diagnostic object suitable for inclusion in an agent event payload.
|
|
12
12
|
*/
|
|
13
|
-
export function acpRawEventShape(update) {
|
|
13
|
+
export function acpRawEventShape({ update }, _optional = {}) {
|
|
14
14
|
const { content, rawInput, locations } = update;
|
|
15
15
|
return {
|
|
16
16
|
sessionUpdate: typeof update.sessionUpdate === 'string' ? update.sessionUpdate : null,
|
|
17
|
-
keys: objectKeys(update),
|
|
18
|
-
contentKind: acpValueKind(content),
|
|
19
|
-
contentKeys: objectKeys(content),
|
|
20
|
-
hasText: Boolean(extractAcpUpdateText(update)),
|
|
17
|
+
keys: objectKeys({ value: update }),
|
|
18
|
+
contentKind: acpValueKind({ value: content }),
|
|
19
|
+
contentKeys: objectKeys({ value: content }),
|
|
20
|
+
hasText: Boolean(extractAcpUpdateText({ update })),
|
|
21
21
|
hasTopLevelText: typeof update.text === 'string' && update.text.length > 0,
|
|
22
22
|
hasTopLevelDelta: typeof update.delta === 'string' && update.delta.length > 0,
|
|
23
23
|
hasTopLevelMessage: update.message !== undefined,
|
|
24
|
-
hasToolCallId: acpToolCallId(update) !== null,
|
|
24
|
+
hasToolCallId: acpToolCallId({ update }) !== null,
|
|
25
25
|
hasRawInput: rawInput !== undefined,
|
|
26
|
-
rawInputKind: acpValueKind(rawInput),
|
|
27
|
-
rawInputKeys: objectKeys(rawInput),
|
|
28
|
-
locationsKind: acpValueKind(locations),
|
|
26
|
+
rawInputKind: acpValueKind({ value: rawInput }),
|
|
27
|
+
rawInputKeys: objectKeys({ value: rawInput }),
|
|
28
|
+
locationsKind: acpValueKind({ value: locations }),
|
|
29
29
|
locationsCount: Array.isArray(locations) ? locations.length : undefined,
|
|
30
30
|
status: typeof update.status === 'string' ? update.status : undefined,
|
|
31
31
|
titlePresent: typeof update.title === 'string' && update.title.length > 0,
|
|
@@ -38,7 +38,7 @@ export function acpRawEventShape(update) {
|
|
|
38
38
|
*
|
|
39
39
|
* @param update - A parsed ACP `session/update` params object.
|
|
40
40
|
*/
|
|
41
|
-
export function acpUpdateStatus(update) {
|
|
41
|
+
export function acpUpdateStatus({ update }, _optional = {}) {
|
|
42
42
|
return typeof update.status === 'string'
|
|
43
43
|
? update.status.trim().toLowerCase().replace(/[\s_-]+/g, '')
|
|
44
44
|
: '';
|
|
@@ -48,8 +48,8 @@ export function acpUpdateStatus(update) {
|
|
|
48
48
|
* terminal state (`completed`, `complete`, `succeeded`, or `success`).
|
|
49
49
|
* Used to decide when to emit deferred artifact-write tool events.
|
|
50
50
|
*/
|
|
51
|
-
export function isAcpCompletedStatus(update) {
|
|
52
|
-
const status = acpUpdateStatus(update);
|
|
51
|
+
export function isAcpCompletedStatus({ update }, _optional = {}) {
|
|
52
|
+
const status = acpUpdateStatus({ update });
|
|
53
53
|
return status === 'completed' || status === 'complete' || status === 'succeeded' || status === 'success';
|
|
54
54
|
}
|
|
55
55
|
const ACP_TERMINAL_FAILURE_STATUSES = new Set(['failed', 'failure', 'error', 'cancelled', 'canceled']);
|
|
@@ -58,8 +58,8 @@ const ACP_TERMINAL_FAILURE_STATUSES = new Set(['failed', 'failure', 'error', 'ca
|
|
|
58
58
|
* failure state (`failed`, `failure`, `error`, `cancelled`, or `canceled`).
|
|
59
59
|
* Used to clean up pending write-suppression state and emit failed tool events.
|
|
60
60
|
*/
|
|
61
|
-
export function isAcpTerminalFailureStatus(update) {
|
|
62
|
-
const status = acpUpdateStatus(update);
|
|
61
|
+
export function isAcpTerminalFailureStatus({ update }, _optional = {}) {
|
|
62
|
+
const status = acpUpdateStatus({ update });
|
|
63
63
|
return ACP_TERMINAL_FAILURE_STATUSES.has(status);
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -67,8 +67,8 @@ export function isAcpTerminalFailureStatus(update) {
|
|
|
67
67
|
* agent wants to restart the request; the session promoter maps this to a
|
|
68
68
|
* structured error payload via `promotedAmrRetryStatusPayload`.
|
|
69
69
|
*/
|
|
70
|
-
export function isAcpRetryStatus(update) {
|
|
71
|
-
return acpUpdateStatus(update) === 'retry';
|
|
70
|
+
export function isAcpRetryStatus({ update }, _optional = {}) {
|
|
71
|
+
return acpUpdateStatus({ update }) === 'retry';
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Recursively collects all text-bearing leaf values from an ACP update
|
|
@@ -80,7 +80,7 @@ export function isAcpRetryStatus(update) {
|
|
|
80
80
|
* @param depth - Current recursion depth (max 4); callers omit this.
|
|
81
81
|
* @returns A flat array of trimmed non-empty string representations.
|
|
82
82
|
*/
|
|
83
|
-
export function acpUpdateDiagnosticText(value, depth = 0) {
|
|
83
|
+
export function acpUpdateDiagnosticText({ value }, { depth = 0 } = {}) {
|
|
84
84
|
if (depth > 4)
|
|
85
85
|
return [];
|
|
86
86
|
if (typeof value === 'string')
|
|
@@ -88,9 +88,9 @@ export function acpUpdateDiagnosticText(value, depth = 0) {
|
|
|
88
88
|
if (typeof value === 'number' || typeof value === 'boolean')
|
|
89
89
|
return [String(value)];
|
|
90
90
|
if (Array.isArray(value)) {
|
|
91
|
-
return value.flatMap((item) => acpUpdateDiagnosticText(item, depth + 1));
|
|
91
|
+
return value.flatMap((item) => acpUpdateDiagnosticText({ value: item }, { depth: depth + 1 }));
|
|
92
92
|
}
|
|
93
|
-
const obj = asObject(value);
|
|
93
|
+
const obj = asObject({ value });
|
|
94
94
|
return obj ? objectDiagnosticText({ obj, depth }) : [];
|
|
95
95
|
}
|
|
96
96
|
/** Keys `acpUpdateDiagnosticText` descends into on an object, in order. */
|
|
@@ -113,7 +113,7 @@ function objectDiagnosticText({ obj, depth }) {
|
|
|
113
113
|
const parts = [];
|
|
114
114
|
for (const key of DIAGNOSTIC_TEXT_KEYS) {
|
|
115
115
|
if (key in obj) {
|
|
116
|
-
parts.push(...acpUpdateDiagnosticText(obj[key], depth + 1));
|
|
116
|
+
parts.push(...acpUpdateDiagnosticText({ value: obj[key] }, { depth: depth + 1 }));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return parts;
|
|
@@ -129,10 +129,10 @@ function objectDiagnosticText({ obj, depth }) {
|
|
|
129
129
|
* `noopAccountFailureClassifier`, under which this always returns `null`.
|
|
130
130
|
* @returns A structured error payload with `message` and `error`, or `null`.
|
|
131
131
|
*/
|
|
132
|
-
export function promotedAmrRetryStatusPayload(update, classifier = noopAccountFailureClassifier) {
|
|
133
|
-
if (!isAcpRetryStatus(update))
|
|
132
|
+
export function promotedAmrRetryStatusPayload({ update }, { classifier = noopAccountFailureClassifier } = {}) {
|
|
133
|
+
if (!isAcpRetryStatus({ update }))
|
|
134
134
|
return null;
|
|
135
|
-
const diagnosticText = acpUpdateDiagnosticText(update).join('\n');
|
|
135
|
+
const diagnosticText = acpUpdateDiagnosticText({ value: update }).join('\n');
|
|
136
136
|
const failure = classifier.classify({ text: diagnosticText });
|
|
137
137
|
if (!failure)
|
|
138
138
|
return null;
|
|
@@ -149,7 +149,7 @@ export function promotedAmrRetryStatusPayload(update, classifier = noopAccountFa
|
|
|
149
149
|
* `noopAccountFailureClassifier`, under which this always returns `null`.
|
|
150
150
|
* @returns A structured error payload, or `null` when not applicable.
|
|
151
151
|
*/
|
|
152
|
-
export function promotedAmrStderrPayload(chunk, classifier = noopAccountFailureClassifier) {
|
|
152
|
+
export function promotedAmrStderrPayload({ chunk }, { classifier = noopAccountFailureClassifier } = {}) {
|
|
153
153
|
if (!/opencode_event_stream_failure|session\.status/i.test(chunk))
|
|
154
154
|
return null;
|
|
155
155
|
if (!/\bretry\b/i.test(chunk))
|
|
@@ -169,7 +169,7 @@ function promotedFailurePayload({ failure, promotedBy }) {
|
|
|
169
169
|
message: failure.message,
|
|
170
170
|
retryable: false,
|
|
171
171
|
details: {
|
|
172
|
-
...accountFailureDetails(failure),
|
|
172
|
+
...accountFailureDetails({ failure }),
|
|
173
173
|
promoted_by: promotedBy,
|
|
174
174
|
},
|
|
175
175
|
},
|
|
@@ -182,7 +182,7 @@ function promotedFailurePayload({ failure, promotedBy }) {
|
|
|
182
182
|
*
|
|
183
183
|
* @param update - A parsed ACP `session/update` params object.
|
|
184
184
|
*/
|
|
185
|
-
export function acpToolCallId(update) {
|
|
185
|
+
export function acpToolCallId({ update }, _optional = {}) {
|
|
186
186
|
return typeof update.toolCallId === 'string' && update.toolCallId.trim()
|
|
187
187
|
? update.toolCallId.trim()
|
|
188
188
|
: null;
|
|
@@ -195,7 +195,7 @@ export function acpToolCallId(update) {
|
|
|
195
195
|
*
|
|
196
196
|
* @param update - A parsed ACP `session/update` params object.
|
|
197
197
|
*/
|
|
198
|
-
export function isAcpArtifactWriteLabel(update) {
|
|
198
|
+
export function isAcpArtifactWriteLabel({ update }, _optional = {}) {
|
|
199
199
|
const label = [
|
|
200
200
|
typeof update.title === 'string' ? update.title : '',
|
|
201
201
|
typeof update.name === 'string' ? update.name : '',
|
|
@@ -211,11 +211,11 @@ export function isAcpArtifactWriteLabel(update) {
|
|
|
211
211
|
* @param update - A parsed ACP `session/update` params object.
|
|
212
212
|
* @param writeToolCallIds - The set of tool call ids identified as artifact writes so far.
|
|
213
213
|
*/
|
|
214
|
-
export function isAcpArtifactWriteUpdate(update, writeToolCallIds) {
|
|
215
|
-
if (!isAcpCompletedStatus(update))
|
|
214
|
+
export function isAcpArtifactWriteUpdate({ update, writeToolCallIds }, _optional = {}) {
|
|
215
|
+
if (!isAcpCompletedStatus({ update }))
|
|
216
216
|
return false;
|
|
217
|
-
const toolCallId = acpToolCallId(update);
|
|
218
|
-
return isAcpArtifactWriteLabel(update) || (toolCallId ? writeToolCallIds.has(toolCallId) : false);
|
|
217
|
+
const toolCallId = acpToolCallId({ update });
|
|
218
|
+
return isAcpArtifactWriteLabel({ update }) || (toolCallId ? writeToolCallIds.has(toolCallId) : false);
|
|
219
219
|
}
|
|
220
220
|
// Best-effort file path for an ACP artifact-write tool call. ACP can carry a
|
|
221
221
|
// `locations: [{ path }]` array and/or `content: [{ type:'diff', path }]`
|
|
@@ -235,7 +235,7 @@ export function isAcpArtifactWriteUpdate(update, writeToolCallIds) {
|
|
|
235
235
|
* @param update - A parsed ACP `session/update` params object.
|
|
236
236
|
* @returns An absolute or relative file path string, or `null` when absent.
|
|
237
237
|
*/
|
|
238
|
-
export function acpArtifactWritePath(update) {
|
|
238
|
+
export function acpArtifactWritePath({ update }, _optional = {}) {
|
|
239
239
|
return entryArrayPath(update) ?? rawInputPath(update) ?? titlePath(update);
|
|
240
240
|
}
|
|
241
241
|
/** Returns the trimmed string when `value` is a non-blank string, else `null`. */
|
|
@@ -249,7 +249,7 @@ function entryArrayPath(update) {
|
|
|
249
249
|
if (!Array.isArray(field))
|
|
250
250
|
continue;
|
|
251
251
|
for (const entry of field) {
|
|
252
|
-
const path = trimmedNonEmpty(asObject(entry)?.path);
|
|
252
|
+
const path = trimmedNonEmpty(asObject({ value: entry })?.path);
|
|
253
253
|
if (path)
|
|
254
254
|
return path;
|
|
255
255
|
}
|
|
@@ -259,7 +259,7 @@ function entryArrayPath(update) {
|
|
|
259
259
|
/** Source 2 of `acpArtifactWritePath`. */
|
|
260
260
|
function rawInputPath(update) {
|
|
261
261
|
// 2. Tool input echoed by some agents as `rawInput.{path,file_path,filename}`.
|
|
262
|
-
const rawInput = asObject(update.rawInput);
|
|
262
|
+
const rawInput = asObject({ value: update.rawInput });
|
|
263
263
|
for (const key of ['path', 'file_path', 'filename']) {
|
|
264
264
|
const value = trimmedNonEmpty(rawInput?.[key]);
|
|
265
265
|
if (value)
|
|
@@ -2,19 +2,39 @@ export interface JsonLineAccumulatorState {
|
|
|
2
2
|
pendingJson: string;
|
|
3
3
|
pendingJsonLineCount: number;
|
|
4
4
|
}
|
|
5
|
-
export declare function emitJsonLine(candidate
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
export declare function emitJsonLine({ candidate, onMessage }: {
|
|
6
|
+
candidate: string;
|
|
7
|
+
onMessage: (requiredArgs: {
|
|
8
|
+
message: unknown;
|
|
9
|
+
rawLine: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
}, _optional?: Record<string, never>): boolean;
|
|
12
|
+
export declare function continuePendingJsonLine({ state, trimmed, onMessage }: {
|
|
13
|
+
state: JsonLineAccumulatorState;
|
|
14
|
+
trimmed: string;
|
|
15
|
+
onMessage: (requiredArgs: {
|
|
16
|
+
message: unknown;
|
|
17
|
+
rawLine: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
}, { onError }?: {
|
|
20
|
+
onError?: ((error: RangeError) => void) | undefined;
|
|
21
|
+
}): void;
|
|
22
|
+
export declare function tryStartPendingJsonLine({ state, trimmed }: {
|
|
23
|
+
state: JsonLineAccumulatorState;
|
|
24
|
+
trimmed: string;
|
|
25
|
+
}, { onError }?: {
|
|
26
|
+
onError?: ((error: RangeError) => void) | undefined;
|
|
27
|
+
}): void;
|
|
28
|
+
export declare function handleJsonLine({ state, line, onMessage }: {
|
|
29
|
+
state: JsonLineAccumulatorState;
|
|
30
|
+
line: string;
|
|
31
|
+
onMessage: (requiredArgs: {
|
|
32
|
+
message: unknown;
|
|
33
|
+
rawLine: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
}, { onError }?: {
|
|
36
|
+
onError?: ((error: RangeError) => void) | undefined;
|
|
37
|
+
}): void;
|
|
18
38
|
/**
|
|
19
39
|
* Creates a streaming JSON-line parser over a raw byte/string stream.
|
|
20
40
|
* Buffers incoming chunks, splits on newline boundaries, and attempts
|
|
@@ -28,16 +48,17 @@ export declare function handleJsonLine(state: JsonLineAccumulatorState, line: st
|
|
|
28
48
|
*
|
|
29
49
|
* @param requiredArgs.onMessage - Called with `{ message, rawLine }` for each
|
|
30
50
|
* successfully parsed JSON value and its raw reassembled line string.
|
|
31
|
-
* @param
|
|
51
|
+
* @param optionalArgs.onError - Reports a physical-line or multiline overflow to the host's failure path.
|
|
32
52
|
* When omitted, feed throws RangeError. Oversized content is never delivered.
|
|
33
53
|
* @returns An object with `feed({ chunk })` for incremental input and `flush()` to
|
|
34
54
|
* drain any residual buffered content at stream end.
|
|
35
55
|
*/
|
|
36
|
-
export declare function createJsonLineStream({ onMessage
|
|
56
|
+
export declare function createJsonLineStream({ onMessage }: {
|
|
37
57
|
onMessage: (requiredArgs: {
|
|
38
58
|
message: unknown;
|
|
39
59
|
rawLine: string;
|
|
40
60
|
}) => void;
|
|
61
|
+
}, { onError }?: {
|
|
41
62
|
onError?: (error: RangeError) => void;
|
|
42
63
|
}): {
|
|
43
64
|
feed({ chunk }: {
|
|
@@ -62,28 +83,102 @@ export interface JsonScanState {
|
|
|
62
83
|
export type JsonScanStepResult = 'invalid' | 'incomplete' | {
|
|
63
84
|
nextIndex: number;
|
|
64
85
|
};
|
|
65
|
-
export declare function afterValue(state
|
|
66
|
-
|
|
86
|
+
export declare function afterValue({ state }: {
|
|
87
|
+
state: JsonScanState;
|
|
88
|
+
}, _optional?: Record<string, never>): void;
|
|
89
|
+
export declare function parseString({ value, start }: {
|
|
90
|
+
value: string;
|
|
91
|
+
start: number;
|
|
92
|
+
}, _optional?: Record<string, never>): number | null;
|
|
67
93
|
/** Index of a scanned value's last character, `null` when the input ends mid-value, `false` when it is not valid JSON. */
|
|
68
94
|
type JsonScanEnd = number | null | false;
|
|
69
|
-
export declare function parseLiteral(value
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export declare function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export declare function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export declare function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export declare function
|
|
95
|
+
export declare function parseLiteral({ value, start, literal }: {
|
|
96
|
+
value: string;
|
|
97
|
+
start: number;
|
|
98
|
+
literal: string;
|
|
99
|
+
}, _optional?: Record<string, never>): JsonScanEnd;
|
|
100
|
+
export declare function parseIntegerDigits({ value, start }: {
|
|
101
|
+
value: string;
|
|
102
|
+
start: number;
|
|
103
|
+
}, _optional?: Record<string, never>): number | false;
|
|
104
|
+
export declare function parseFractionDigits({ value, start }: {
|
|
105
|
+
value: string;
|
|
106
|
+
start: number;
|
|
107
|
+
}, _optional?: Record<string, never>): number | false;
|
|
108
|
+
export declare function parseExponentDigits({ value, start }: {
|
|
109
|
+
value: string;
|
|
110
|
+
start: number;
|
|
111
|
+
}, _optional?: Record<string, never>): number | false;
|
|
112
|
+
export declare function parseNumber({ value, start }: {
|
|
113
|
+
value: string;
|
|
114
|
+
start: number;
|
|
115
|
+
}, _optional?: Record<string, never>): number | false;
|
|
116
|
+
export declare function parseStringValue({ state, index }: {
|
|
117
|
+
state: JsonScanState;
|
|
118
|
+
index: number;
|
|
119
|
+
}, _optional?: Record<string, never>): number | null;
|
|
120
|
+
export declare function parseNumberValue({ state, index }: {
|
|
121
|
+
state: JsonScanState;
|
|
122
|
+
index: number;
|
|
123
|
+
}, _optional?: Record<string, never>): number | false;
|
|
124
|
+
export declare function parseLiteralValue({ state, index, literal }: {
|
|
125
|
+
state: JsonScanState;
|
|
126
|
+
index: number;
|
|
127
|
+
literal: string;
|
|
128
|
+
}, _optional?: Record<string, never>): JsonScanEnd;
|
|
129
|
+
export declare function parseValue({ state, index }: {
|
|
130
|
+
state: JsonScanState;
|
|
131
|
+
index: number;
|
|
132
|
+
}, _optional?: Record<string, never>): JsonScanEnd;
|
|
133
|
+
export declare function stepRootFrame({ state, index }: {
|
|
134
|
+
state: JsonScanState;
|
|
135
|
+
index: number;
|
|
136
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
137
|
+
export declare function stepObjectKeyOrEnd({ state, current, index, char }: {
|
|
138
|
+
state: JsonScanState;
|
|
139
|
+
current: JsonObjectScanFrame;
|
|
140
|
+
index: number;
|
|
141
|
+
char: string;
|
|
142
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
143
|
+
export declare function stepObjectColon({ current, index, char }: {
|
|
144
|
+
current: JsonObjectScanFrame;
|
|
145
|
+
index: number;
|
|
146
|
+
char: string;
|
|
147
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
148
|
+
export declare function stepObjectCommaOrEnd({ state, current, index, char }: {
|
|
149
|
+
state: JsonScanState;
|
|
150
|
+
current: JsonObjectScanFrame;
|
|
151
|
+
index: number;
|
|
152
|
+
char: string;
|
|
153
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
154
|
+
export declare function stepObjectFrame({ state, current, index, char }: {
|
|
155
|
+
state: JsonScanState;
|
|
156
|
+
current: JsonObjectScanFrame;
|
|
157
|
+
index: number;
|
|
158
|
+
char: string;
|
|
159
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
160
|
+
export declare function stepArrayValueOrEnd({ state, index, char }: {
|
|
161
|
+
state: JsonScanState;
|
|
162
|
+
index: number;
|
|
163
|
+
char: string;
|
|
164
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
165
|
+
export declare function stepArrayCommaOrEnd({ state, current, index, char }: {
|
|
166
|
+
state: JsonScanState;
|
|
167
|
+
current: JsonArrayScanFrame;
|
|
168
|
+
index: number;
|
|
169
|
+
char: string;
|
|
170
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
171
|
+
export declare function stepArrayFrame({ state, current, index, char }: {
|
|
172
|
+
state: JsonScanState;
|
|
173
|
+
current: JsonArrayScanFrame;
|
|
174
|
+
index: number;
|
|
175
|
+
char: string;
|
|
176
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
177
|
+
export declare function selectStep({ state, index, char }: {
|
|
178
|
+
state: JsonScanState;
|
|
179
|
+
index: number;
|
|
180
|
+
char: string;
|
|
181
|
+
}, _optional?: Record<string, never>): JsonScanStepResult;
|
|
87
182
|
/**
|
|
88
183
|
* Incremental JSON completeness classifier used by `createJsonLineStream` to
|
|
89
184
|
* decide whether an accumulating multiline candidate can still resolve into
|
|
@@ -99,6 +194,8 @@ export declare function selectStep(state: JsonScanState, index: number, char: st
|
|
|
99
194
|
* @param value - A string candidate to classify, typically one or more
|
|
100
195
|
* accumulated stdout lines from an ACP subprocess.
|
|
101
196
|
*/
|
|
102
|
-
export declare function classifyJsonCandidate(value
|
|
197
|
+
export declare function classifyJsonCandidate({ value }: {
|
|
198
|
+
value: string;
|
|
199
|
+
}, _optional?: Record<string, never>): 'complete' | 'incomplete' | 'invalid';
|
|
103
200
|
export {};
|
|
104
201
|
//# sourceMappingURL=json-line-stream.d.ts.map
|