@jini-ai/agent-runtime 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +43 -0
- package/dist/acp-model-probe.d.ts +48 -0
- package/dist/acp-model-probe.d.ts.map +1 -0
- package/dist/acp-model-probe.js +15 -0
- package/dist/acp-model-probe.js.map +1 -0
- package/dist/agent-protocol/acp/account-failure.d.ts +54 -0
- package/dist/agent-protocol/acp/account-failure.d.ts.map +1 -0
- package/dist/agent-protocol/acp/account-failure.js +37 -0
- package/dist/agent-protocol/acp/account-failure.js.map +1 -0
- package/dist/agent-protocol/acp/constants.d.ts +26 -0
- package/dist/agent-protocol/acp/constants.d.ts.map +1 -0
- package/dist/agent-protocol/acp/constants.js +39 -0
- package/dist/agent-protocol/acp/constants.js.map +1 -0
- package/dist/agent-protocol/acp/index.d.ts +14 -0
- package/dist/agent-protocol/acp/index.d.ts.map +1 -0
- package/dist/agent-protocol/acp/index.js +14 -0
- package/dist/agent-protocol/acp/index.js.map +1 -0
- package/dist/agent-protocol/acp/json.d.ts +82 -0
- package/dist/agent-protocol/acp/json.d.ts.map +1 -0
- package/dist/agent-protocol/acp/json.js +144 -0
- package/dist/agent-protocol/acp/json.js.map +1 -0
- package/dist/agent-protocol/acp/models.d.ts +112 -0
- package/dist/agent-protocol/acp/models.d.ts.map +1 -0
- package/dist/agent-protocol/acp/models.js +293 -0
- package/dist/agent-protocol/acp/models.js.map +1 -0
- package/dist/agent-protocol/acp/rpc.d.ts +107 -0
- package/dist/agent-protocol/acp/rpc.d.ts.map +1 -0
- package/dist/agent-protocol/acp/rpc.js +162 -0
- package/dist/agent-protocol/acp/rpc.js.map +1 -0
- package/dist/agent-protocol/acp/session-params.d.ts +55 -0
- package/dist/agent-protocol/acp/session-params.d.ts.map +1 -0
- package/dist/agent-protocol/acp/session-params.js +81 -0
- package/dist/agent-protocol/acp/session-params.js.map +1 -0
- package/dist/agent-protocol/acp/session.d.ts +101 -0
- package/dist/agent-protocol/acp/session.d.ts.map +1 -0
- package/dist/agent-protocol/acp/session.js +832 -0
- package/dist/agent-protocol/acp/session.js.map +1 -0
- package/dist/agent-protocol/acp/text-suppression.d.ts +73 -0
- package/dist/agent-protocol/acp/text-suppression.d.ts.map +1 -0
- package/dist/agent-protocol/acp/text-suppression.js +229 -0
- package/dist/agent-protocol/acp/text-suppression.js.map +1 -0
- package/dist/agent-protocol/acp/types.d.ts +27 -0
- package/dist/agent-protocol/acp/types.d.ts.map +1 -0
- package/dist/agent-protocol/acp/types.js +2 -0
- package/dist/agent-protocol/acp/types.js.map +1 -0
- package/dist/agent-protocol/acp/updates.d.ts +166 -0
- package/dist/agent-protocol/acp/updates.d.ts.map +1 -0
- package/dist/agent-protocol/acp/updates.js +268 -0
- package/dist/agent-protocol/acp/updates.js.map +1 -0
- package/dist/agent-protocol/core/index.d.ts +6 -0
- package/dist/agent-protocol/core/index.d.ts.map +1 -0
- package/dist/agent-protocol/core/index.js +6 -0
- package/dist/agent-protocol/core/index.js.map +1 -0
- package/dist/agent-protocol/core/json-line-stream.d.ts +42 -0
- package/dist/agent-protocol/core/json-line-stream.d.ts.map +1 -0
- package/dist/agent-protocol/core/json-line-stream.js +333 -0
- package/dist/agent-protocol/core/json-line-stream.js.map +1 -0
- package/dist/agent-protocol/index.d.ts +8 -0
- package/dist/agent-protocol/index.d.ts.map +1 -0
- package/dist/agent-protocol/index.js +8 -0
- package/dist/agent-protocol/index.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/events.d.ts +26 -0
- package/dist/agent-protocol/pi-rpc/events.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/events.js +167 -0
- package/dist/agent-protocol/pi-rpc/events.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/index.d.ts +11 -0
- package/dist/agent-protocol/pi-rpc/index.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/index.js +11 -0
- package/dist/agent-protocol/pi-rpc/index.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/internal.d.ts +45 -0
- package/dist/agent-protocol/pi-rpc/internal.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/internal.js +41 -0
- package/dist/agent-protocol/pi-rpc/internal.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/models.d.ts +21 -0
- package/dist/agent-protocol/pi-rpc/models.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/models.js +48 -0
- package/dist/agent-protocol/pi-rpc/models.js.map +1 -0
- package/dist/agent-protocol/pi-rpc/session.d.ts +106 -0
- package/dist/agent-protocol/pi-rpc/session.d.ts.map +1 -0
- package/dist/agent-protocol/pi-rpc/session.js +371 -0
- package/dist/agent-protocol/pi-rpc/session.js.map +1 -0
- package/dist/amr-model-cache.d.ts +40 -0
- package/dist/amr-model-cache.d.ts.map +1 -0
- package/dist/amr-model-cache.js +79 -0
- package/dist/amr-model-cache.js.map +1 -0
- package/dist/amr-profile-resolver.d.ts +21 -0
- package/dist/amr-profile-resolver.d.ts.map +1 -0
- package/dist/amr-profile-resolver.js +4 -0
- package/dist/amr-profile-resolver.js.map +1 -0
- package/dist/artifact-taxonomy.d.ts +27 -0
- package/dist/artifact-taxonomy.d.ts.map +1 -0
- package/dist/artifact-taxonomy.js +5 -0
- package/dist/artifact-taxonomy.js.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +332 -0
- package/dist/auth.js.map +1 -0
- package/dist/capabilities.d.ts +9 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +2 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/claude-stream.d.ts +37 -0
- package/dist/claude-stream.d.ts.map +1 -0
- package/dist/claude-stream.js +660 -0
- package/dist/claude-stream.js.map +1 -0
- package/dist/copilot-stream.d.ts +37 -0
- package/dist/copilot-stream.d.ts.map +1 -0
- package/dist/copilot-stream.js +136 -0
- package/dist/copilot-stream.js.map +1 -0
- package/dist/defs/aider.d.ts +13 -0
- package/dist/defs/aider.d.ts.map +1 -0
- package/dist/defs/aider.js +63 -0
- package/dist/defs/aider.js.map +1 -0
- package/dist/defs/amp.d.ts +12 -0
- package/dist/defs/amp.d.ts.map +1 -0
- package/dist/defs/amp.js +56 -0
- package/dist/defs/amp.js.map +1 -0
- package/dist/defs/amr.d.ts +37 -0
- package/dist/defs/amr.d.ts.map +1 -0
- package/dist/defs/amr.js +303 -0
- package/dist/defs/amr.js.map +1 -0
- package/dist/defs/antigravity.d.ts +25 -0
- package/dist/defs/antigravity.d.ts.map +1 -0
- package/dist/defs/antigravity.js +213 -0
- package/dist/defs/antigravity.js.map +1 -0
- package/dist/defs/claude.d.ts +30 -0
- package/dist/defs/claude.d.ts.map +1 -0
- package/dist/defs/claude.js +130 -0
- package/dist/defs/claude.js.map +1 -0
- package/dist/defs/codebuddy.d.ts +26 -0
- package/dist/defs/codebuddy.d.ts.map +1 -0
- package/dist/defs/codebuddy.js +124 -0
- package/dist/defs/codebuddy.js.map +1 -0
- package/dist/defs/codex.d.ts +30 -0
- package/dist/defs/codex.d.ts.map +1 -0
- package/dist/defs/codex.js +196 -0
- package/dist/defs/codex.js.map +1 -0
- package/dist/defs/copilot.d.ts +12 -0
- package/dist/defs/copilot.d.ts.map +1 -0
- package/dist/defs/copilot.js +88 -0
- package/dist/defs/copilot.js.map +1 -0
- package/dist/defs/cursor-agent.d.ts +27 -0
- package/dist/defs/cursor-agent.d.ts.map +1 -0
- package/dist/defs/cursor-agent.js +93 -0
- package/dist/defs/cursor-agent.js.map +1 -0
- package/dist/defs/deepseek.d.ts +12 -0
- package/dist/defs/deepseek.d.ts.map +1 -0
- package/dist/defs/deepseek.js +53 -0
- package/dist/defs/deepseek.js.map +1 -0
- package/dist/defs/devin.d.ts +12 -0
- package/dist/defs/devin.d.ts.map +1 -0
- package/dist/defs/devin.js +45 -0
- package/dist/defs/devin.js.map +1 -0
- package/dist/defs/grok-build.d.ts +26 -0
- package/dist/defs/grok-build.d.ts.map +1 -0
- package/dist/defs/grok-build.js +105 -0
- package/dist/defs/grok-build.js.map +1 -0
- package/dist/defs/hermes.d.ts +13 -0
- package/dist/defs/hermes.d.ts.map +1 -0
- package/dist/defs/hermes.js +51 -0
- package/dist/defs/hermes.js.map +1 -0
- package/dist/defs/index.d.ts +33 -0
- package/dist/defs/index.d.ts.map +1 -0
- package/dist/defs/index.js +33 -0
- package/dist/defs/index.js.map +1 -0
- package/dist/defs/kilo.d.ts +12 -0
- package/dist/defs/kilo.d.ts.map +1 -0
- package/dist/defs/kilo.js +20 -0
- package/dist/defs/kilo.js.map +1 -0
- package/dist/defs/kimi.d.ts +13 -0
- package/dist/defs/kimi.d.ts.map +1 -0
- package/dist/defs/kimi.js +26 -0
- package/dist/defs/kimi.js.map +1 -0
- package/dist/defs/kiro.d.ts +12 -0
- package/dist/defs/kiro.d.ts.map +1 -0
- package/dist/defs/kiro.js +20 -0
- package/dist/defs/kiro.js.map +1 -0
- package/dist/defs/mimo.d.ts +13 -0
- package/dist/defs/mimo.d.ts.map +1 -0
- package/dist/defs/mimo.js +26 -0
- package/dist/defs/mimo.js.map +1 -0
- package/dist/defs/opencode.d.ts +27 -0
- package/dist/defs/opencode.d.ts.map +1 -0
- package/dist/defs/opencode.js +89 -0
- package/dist/defs/opencode.js.map +1 -0
- package/dist/defs/pi.d.ts +18 -0
- package/dist/defs/pi.d.ts.map +1 -0
- package/dist/defs/pi.js +94 -0
- package/dist/defs/pi.js.map +1 -0
- package/dist/defs/qoder.d.ts +11 -0
- package/dist/defs/qoder.d.ts.map +1 -0
- package/dist/defs/qoder.js +50 -0
- package/dist/defs/qoder.js.map +1 -0
- package/dist/defs/qwen.d.ts +11 -0
- package/dist/defs/qwen.d.ts.map +1 -0
- package/dist/defs/qwen.js +28 -0
- package/dist/defs/qwen.js.map +1 -0
- package/dist/defs/reasonix.d.ts +20 -0
- package/dist/defs/reasonix.d.ts.map +1 -0
- package/dist/defs/reasonix.js +60 -0
- package/dist/defs/reasonix.js.map +1 -0
- package/dist/defs/shared.d.ts +23 -0
- package/dist/defs/shared.d.ts.map +1 -0
- package/dist/defs/shared.js +58 -0
- package/dist/defs/shared.js.map +1 -0
- package/dist/defs/trae-cli.d.ts +14 -0
- package/dist/defs/trae-cli.d.ts.map +1 -0
- package/dist/defs/trae-cli.js +22 -0
- package/dist/defs/trae-cli.js.map +1 -0
- package/dist/defs/vibe.d.ts +12 -0
- package/dist/defs/vibe.d.ts.map +1 -0
- package/dist/defs/vibe.js +20 -0
- package/dist/defs/vibe.js.map +1 -0
- package/dist/detection.d.ts +14 -0
- package/dist/detection.d.ts.map +1 -0
- package/dist/detection.js +266 -0
- package/dist/detection.js.map +1 -0
- package/dist/diagnostics.d.ts +8 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +95 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/env.d.ts +19 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +95 -0
- package/dist/env.js.map +1 -0
- package/dist/executables.d.ts +24 -0
- package/dist/executables.d.ts.map +1 -0
- package/dist/executables.js +349 -0
- package/dist/executables.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/invocation.d.ts +6 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +47 -0
- package/dist/invocation.js.map +1 -0
- package/dist/json-event-stream.d.ts +9 -0
- package/dist/json-event-stream.d.ts.map +1 -0
- package/dist/json-event-stream.js +856 -0
- package/dist/json-event-stream.js.map +1 -0
- package/dist/launch.d.ts +12 -0
- package/dist/launch.d.ts.map +1 -0
- package/dist/launch.js +221 -0
- package/dist/launch.js.map +1 -0
- package/dist/mcp.d.ts +44 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +12 -0
- package/dist/mcp.js.map +1 -0
- package/dist/metadata.d.ts +24 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +100 -0
- package/dist/metadata.js.map +1 -0
- package/dist/mmd-routes.d.ts +12 -0
- package/dist/mmd-routes.d.ts.map +1 -0
- package/dist/mmd-routes.js +146 -0
- package/dist/mmd-routes.js.map +1 -0
- package/dist/model-registry.d.ts +120 -0
- package/dist/model-registry.d.ts.map +1 -0
- package/dist/model-registry.js +77 -0
- package/dist/model-registry.js.map +1 -0
- package/dist/models.d.ts +16 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +93 -0
- package/dist/models.js.map +1 -0
- package/dist/opencode-log.d.ts +16 -0
- package/dist/opencode-log.d.ts.map +1 -0
- package/dist/opencode-log.js +163 -0
- package/dist/opencode-log.js.map +1 -0
- package/dist/paths.d.ts +3 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -0
- package/dist/pi-models.d.ts +13 -0
- package/dist/pi-models.d.ts.map +1 -0
- package/dist/pi-models.js +36 -0
- package/dist/pi-models.js.map +1 -0
- package/dist/prompt-augmenter.d.ts +60 -0
- package/dist/prompt-augmenter.d.ts.map +1 -0
- package/dist/prompt-augmenter.js +26 -0
- package/dist/prompt-augmenter.js.map +1 -0
- package/dist/prompt-budget.d.ts +20 -0
- package/dist/prompt-budget.d.ts.map +1 -0
- package/dist/prompt-budget.js +226 -0
- package/dist/prompt-budget.js.map +1 -0
- package/dist/prompt-file.d.ts +7 -0
- package/dist/prompt-file.d.ts.map +1 -0
- package/dist/prompt-file.js +27 -0
- package/dist/prompt-file.js.map +1 -0
- package/dist/providers/aihubmix.d.ts +99 -0
- package/dist/providers/aihubmix.d.ts.map +1 -0
- package/dist/providers/aihubmix.js +239 -0
- package/dist/providers/aihubmix.js.map +1 -0
- package/dist/providers/anthropic-messages.d.ts +116 -0
- package/dist/providers/anthropic-messages.d.ts.map +1 -0
- package/dist/providers/anthropic-messages.js +313 -0
- package/dist/providers/anthropic-messages.js.map +1 -0
- package/dist/providers/azure-chat.d.ts +99 -0
- package/dist/providers/azure-chat.d.ts.map +1 -0
- package/dist/providers/azure-chat.js +164 -0
- package/dist/providers/azure-chat.js.map +1 -0
- package/dist/providers/connection-guard.d.ts +67 -0
- package/dist/providers/connection-guard.d.ts.map +1 -0
- package/dist/providers/connection-guard.js +211 -0
- package/dist/providers/connection-guard.js.map +1 -0
- package/dist/providers/elevenlabs.d.ts +28 -0
- package/dist/providers/elevenlabs.d.ts.map +1 -0
- package/dist/providers/elevenlabs.js +138 -0
- package/dist/providers/elevenlabs.js.map +1 -0
- package/dist/providers/google-messages.d.ts +108 -0
- package/dist/providers/google-messages.d.ts.map +1 -0
- package/dist/providers/google-messages.js +284 -0
- package/dist/providers/google-messages.js.map +1 -0
- package/dist/providers/google.d.ts +20 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +42 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/index.d.ts +39 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +39 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/model-catalog.d.ts +32 -0
- package/dist/providers/model-catalog.d.ts.map +1 -0
- package/dist/providers/model-catalog.js +394 -0
- package/dist/providers/model-catalog.js.map +1 -0
- package/dist/providers/oauth-callback-server.d.ts +35 -0
- package/dist/providers/oauth-callback-server.d.ts.map +1 -0
- package/dist/providers/oauth-callback-server.js +217 -0
- package/dist/providers/oauth-callback-server.js.map +1 -0
- package/dist/providers/oauth-credentials.d.ts +29 -0
- package/dist/providers/oauth-credentials.d.ts.map +1 -0
- package/dist/providers/oauth-credentials.js +70 -0
- package/dist/providers/oauth-credentials.js.map +1 -0
- package/dist/providers/oauth-provider.d.ts +95 -0
- package/dist/providers/oauth-provider.d.ts.map +1 -0
- package/dist/providers/oauth-provider.js +130 -0
- package/dist/providers/oauth-provider.js.map +1 -0
- package/dist/providers/oauth-tokens.d.ts +35 -0
- package/dist/providers/oauth-tokens.d.ts.map +1 -0
- package/dist/providers/oauth-tokens.js +136 -0
- package/dist/providers/oauth-tokens.js.map +1 -0
- package/dist/providers/ollama-chat.d.ts +106 -0
- package/dist/providers/ollama-chat.d.ts.map +1 -0
- package/dist/providers/ollama-chat.js +292 -0
- package/dist/providers/ollama-chat.js.map +1 -0
- package/dist/providers/openai-chat.d.ts +147 -0
- package/dist/providers/openai-chat.d.ts.map +1 -0
- package/dist/providers/openai-chat.js +302 -0
- package/dist/providers/openai-chat.js.map +1 -0
- package/dist/providers/pkce.d.ts +81 -0
- package/dist/providers/pkce.d.ts.map +1 -0
- package/dist/providers/pkce.js +176 -0
- package/dist/providers/pkce.js.map +1 -0
- package/dist/providers/sse-decode.d.ts +47 -0
- package/dist/providers/sse-decode.d.ts.map +1 -0
- package/dist/providers/sse-decode.js +109 -0
- package/dist/providers/sse-decode.js.map +1 -0
- package/dist/providers/token-params.d.ts +29 -0
- package/dist/providers/token-params.d.ts.map +1 -0
- package/dist/providers/token-params.js +41 -0
- package/dist/providers/token-params.js.map +1 -0
- package/dist/providers/turn-end-guard.d.ts +37 -0
- package/dist/providers/turn-end-guard.d.ts.map +1 -0
- package/dist/providers/turn-end-guard.js +42 -0
- package/dist/providers/turn-end-guard.js.map +1 -0
- package/dist/providers/types.d.ts +36 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +13 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/qoder-stream.d.ts +19 -0
- package/dist/qoder-stream.d.ts.map +1 -0
- package/dist/qoder-stream.js +167 -0
- package/dist/qoder-stream.js.map +1 -0
- package/dist/registry.d.ts +5 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +58 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolution.d.ts +2 -0
- package/dist/resolution.d.ts.map +1 -0
- package/dist/resolution.js +19 -0
- package/dist/resolution.js.map +1 -0
- package/dist/role-marker-guard.d.ts +53 -0
- package/dist/role-marker-guard.d.ts.map +1 -0
- package/dist/role-marker-guard.js +280 -0
- package/dist/role-marker-guard.js.map +1 -0
- package/dist/telemetry-sink.d.ts +35 -0
- package/dist/telemetry-sink.d.ts.map +1 -0
- package/dist/telemetry-sink.js +5 -0
- package/dist/telemetry-sink.js.map +1 -0
- package/dist/terminal-launch.d.ts +11 -0
- package/dist/terminal-launch.d.ts.map +1 -0
- package/dist/terminal-launch.js +123 -0
- package/dist/terminal-launch.js.map +1 -0
- package/dist/types.d.ts +185 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module resolution
|
|
3
|
+
*
|
|
4
|
+
* Resolve the absolute path of an agent's binary on the current PATH, by
|
|
5
|
+
* agent id, from the registry. Ported verbatim from OD's
|
|
6
|
+
* `apps/daemon/src/runtimes/launch/resolution.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import { getAgentDef } from './registry.js';
|
|
9
|
+
import { resolveAgentExecutable } from './executables.js';
|
|
10
|
+
// Used by the chat handler so spawn() gets the same executable that
|
|
11
|
+
// detection reported as available — fixes Windows ENOENT when the bare
|
|
12
|
+
// bin name isn't on the child process's PATH.
|
|
13
|
+
export function resolveAgentBin(id, configuredEnv = {}) {
|
|
14
|
+
const def = getAgentDef(id);
|
|
15
|
+
if (!def?.bin)
|
|
16
|
+
return null;
|
|
17
|
+
return resolveAgentExecutable(def, configuredEnv);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution.js","sourceRoot":"","sources":["../src/resolution.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,oEAAoE;AACpE,uEAAuE;AACvE,8CAA8C;AAC9C,MAAM,UAAU,eAAe,CAAC,EAAU,EAAE,gBAAwC,EAAE;IACpF,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,GAAG;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,sBAAsB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module role-marker-guard
|
|
3
|
+
*
|
|
4
|
+
* Shared utility for detecting and stripping fabricated role-marker lines
|
|
5
|
+
* (`## user`, `## assistant`, `## system`) injected by the model into its
|
|
6
|
+
* own output (see #3247 — same class as #2102 / #2464).
|
|
7
|
+
*
|
|
8
|
+
* `createRoleMarkerGuard()` — stateful per-message guard for structured
|
|
9
|
+
* stream handlers that can track message boundaries (Claude, Copilot,
|
|
10
|
+
* Qoder, OpenCode/Codex, Pi, ACP). Returns `{ feedText, contaminated,
|
|
11
|
+
* warningEvent }`.
|
|
12
|
+
*
|
|
13
|
+
* Ported verbatim from OD's `apps/daemon/src/role-marker-guard.ts` (a
|
|
14
|
+
* top-level daemon file, not under `runtimes/`, but consumed by
|
|
15
|
+
* `claude-stream.ts` and self-contained with no product coupling — see
|
|
16
|
+
* `source-map.md`).
|
|
17
|
+
*/
|
|
18
|
+
export declare const FABRICATED_ROLE_MARKER_RE: RegExp;
|
|
19
|
+
export interface RoleMarkerGuard {
|
|
20
|
+
/** Feed a text delta for the current message. Returns the safe portion
|
|
21
|
+
* to emit (may be shorter than `text` if a marker was found mid-chunk,
|
|
22
|
+
* or empty string if the entire chunk is past the cut point). */
|
|
23
|
+
feedText(text: string): string;
|
|
24
|
+
/** Whether a fabricated marker was detected (further text is dropped). */
|
|
25
|
+
readonly contaminated: boolean;
|
|
26
|
+
/** If contaminated, the warning event to emit. `null` if clean. */
|
|
27
|
+
warningEvent(): {
|
|
28
|
+
type: 'fabricated_role_marker';
|
|
29
|
+
marker: string;
|
|
30
|
+
messageId: string;
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a stateful guard that detects fabricated role markers across
|
|
35
|
+
* chunk boundaries. Memory + per-call work is O(1): instead of
|
|
36
|
+
* accumulating the full message text, the guard retains only a small
|
|
37
|
+
* trailing suffix (TAIL_BUFFER_SIZE chars) — enough for the matcher to
|
|
38
|
+
* see across chunk boundaries when a marker straddles them.
|
|
39
|
+
*
|
|
40
|
+
* Usage in a stream handler:
|
|
41
|
+
*
|
|
42
|
+
* const guard = createRoleMarkerGuard(messageId);
|
|
43
|
+
* for (const delta of deltas) {
|
|
44
|
+
* const safe = guard.feedText(delta.text);
|
|
45
|
+
* if (safe.length > 0) onEvent({ type: 'text_delta', delta: safe });
|
|
46
|
+
* if (guard.contaminated) {
|
|
47
|
+
* onEvent(guard.warningEvent()!);
|
|
48
|
+
* break; // stop emitting text for this message
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
*/
|
|
52
|
+
export declare function createRoleMarkerGuard(messageId: string): RoleMarkerGuard;
|
|
53
|
+
//# sourceMappingURL=role-marker-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-marker-guard.d.ts","sourceRoot":"","sources":["../src/role-marker-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAuEH,eAAO,MAAM,yBAAyB,QAC8B,CAAC;AAuDrE,MAAM,WAAW,eAAe;IAC9B;;sEAEkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,mEAAmE;IACnE,YAAY,IAAI;QAAE,IAAI,EAAE,wBAAwB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAkIxE"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module role-marker-guard
|
|
3
|
+
*
|
|
4
|
+
* Shared utility for detecting and stripping fabricated role-marker lines
|
|
5
|
+
* (`## user`, `## assistant`, `## system`) injected by the model into its
|
|
6
|
+
* own output (see #3247 — same class as #2102 / #2464).
|
|
7
|
+
*
|
|
8
|
+
* `createRoleMarkerGuard()` — stateful per-message guard for structured
|
|
9
|
+
* stream handlers that can track message boundaries (Claude, Copilot,
|
|
10
|
+
* Qoder, OpenCode/Codex, Pi, ACP). Returns `{ feedText, contaminated,
|
|
11
|
+
* warningEvent }`.
|
|
12
|
+
*
|
|
13
|
+
* Ported verbatim from OD's `apps/daemon/src/role-marker-guard.ts` (a
|
|
14
|
+
* top-level daemon file, not under `runtimes/`, but consumed by
|
|
15
|
+
* `claude-stream.ts` and self-contained with no product coupling — see
|
|
16
|
+
* `source-map.md`).
|
|
17
|
+
*/
|
|
18
|
+
// Regex matching fabricated role-marker lines injected by the model into
|
|
19
|
+
// its own output. Anchored to start-of-line via (?:^|\n) so we don't
|
|
20
|
+
// false-positive on user prose like "here is the ## user content".
|
|
21
|
+
//
|
|
22
|
+
// Scope (deliberately narrow): Markdown-style `## user` / `## assistant`
|
|
23
|
+
// / `## assist` / `## system` only — these are the patterns the chat
|
|
24
|
+
// host actually parses as turn boundaries (see `buildDaemonTranscript`
|
|
25
|
+
// in apps/web/src/providers/daemon.ts). Chat-style markers like
|
|
26
|
+
// `User:` / `Assistant:` / `Human:` / `AI:` are intentionally NOT
|
|
27
|
+
// included, because:
|
|
28
|
+
// (1) The host never parses them as turn boundaries; a model emitting
|
|
29
|
+
// them does NOT cause the original #3247 security failure mode.
|
|
30
|
+
// (2) They collide with legitimate output far more often than the
|
|
31
|
+
// Markdown family (e.g., "User: bob@example.com", form labels,
|
|
32
|
+
// JSDoc lines). With kill-on-detection wired in server.ts
|
|
33
|
+
// (`abortForRoleMarker`), a false positive aborts the whole run
|
|
34
|
+
// — a much more expensive failure than a stray unflagged
|
|
35
|
+
// `User:` line in the chat scrollback.
|
|
36
|
+
// If a host frontend ever starts parsing chat-style markers as
|
|
37
|
+
// boundaries, narrow the additions to that frontend's specific
|
|
38
|
+
// path rather than the shared regex.
|
|
39
|
+
//
|
|
40
|
+
// Three deliberate refinements vs. a naive `## role` match:
|
|
41
|
+
//
|
|
42
|
+
// 1. CASE-SENSITIVE. The chat host's turn-boundary delimiter is
|
|
43
|
+
// lowercase (`## user` / `## assistant` / `## system` — see
|
|
44
|
+
// `buildDaemonTranscript` in apps/web/src/providers/daemon.ts), and
|
|
45
|
+
// the `## CRITICAL` system-prompt block forbids only the lowercase
|
|
46
|
+
// forms. Title-Case Markdown headings like `## User Guide`,
|
|
47
|
+
// `## System Architecture`, `## Assistant settings` are LEGITIMATE
|
|
48
|
+
// content (LLMs emit these constantly in technical writing) and
|
|
49
|
+
// must not contaminate. Matching with `/i` would deterministically
|
|
50
|
+
// abort any run that produced such a heading — exactly the
|
|
51
|
+
// "false positive aborts the whole run" cost the docblock cites
|
|
52
|
+
// as the reason to keep the regex narrow.
|
|
53
|
+
// (See PR #3303 review r3324151877.)
|
|
54
|
+
//
|
|
55
|
+
// 2. POSITIVE LOOKAHEAD `(?=[^a-z])`. Without it, `## userland`,
|
|
56
|
+
// `## userspace`, `## users guide`, `## systemd`, `## assistance`
|
|
57
|
+
// all match via prefix in the alternation. The positive lookahead
|
|
58
|
+
// requires the character after the role keyword to exist AND to NOT
|
|
59
|
+
// be a lowercase letter:
|
|
60
|
+
// - `## user\n…` → match (newline is not lowercase)
|
|
61
|
+
// - `## assistantR…` → match (R is uppercase; the glued-form
|
|
62
|
+
// attack pattern still gets caught)
|
|
63
|
+
// - `## assistant.` → match (. is not a letter)
|
|
64
|
+
// - `## users guide` → no match (s is lowercase letter)
|
|
65
|
+
// - `## userland` → no match (l is lowercase letter)
|
|
66
|
+
// Why POSITIVE `[^a-z]` rather than NEGATIVE `(?![a-z])`: the
|
|
67
|
+
// negative form is satisfied at end-of-string, which in a streaming
|
|
68
|
+
// context means "we have just received `## user` but don't know
|
|
69
|
+
// what comes next yet". A negative lookahead would fire prematurely
|
|
70
|
+
// if the rest of the role-keyword landed in a later chunk (e.g.
|
|
71
|
+
// the model emits `## user` then `land` arrives). The positive
|
|
72
|
+
// form requires an actual non-lowercase character to be present,
|
|
73
|
+
// so detection waits one more chunk in that edge case — a
|
|
74
|
+
// one-character latency traded for correctness.
|
|
75
|
+
//
|
|
76
|
+
// 3. `[ \t]` instead of `\s` for inner whitespace. `\s` matches
|
|
77
|
+
// newlines, which would let oddities like `##\nuser` match across
|
|
78
|
+
// lines. Markdown role markers are always single-line by
|
|
79
|
+
// convention; restricting to space/tab tightens the match without
|
|
80
|
+
// losing any real attack pattern.
|
|
81
|
+
//
|
|
82
|
+
// Alternation order: `assistant` is listed before `assist` so a
|
|
83
|
+
// fully-spelled `## assistant` consumes 9 chars (not 6) and the
|
|
84
|
+
// `(?![a-z])` check is applied at position 9 (after the full word)
|
|
85
|
+
// rather than position 6. Truncated forms (`## assist\n` from a
|
|
86
|
+
// stream cut mid-emission) still match via the `assist` branch.
|
|
87
|
+
export const FABRICATED_ROLE_MARKER_RE = /(?:^|\n)[ \t]*##[ \t]+(?:user|assistant|assist|system)(?=[^a-z])/;
|
|
88
|
+
// Internal-only variant used after the first chunk has been processed.
|
|
89
|
+
// Drops the `^` alternative: once `tail` is a rolling slice of
|
|
90
|
+
// mid-stream text, `^` no longer represents the genuine message start
|
|
91
|
+
// — applying it would let the regex anchor at an arbitrary cut point
|
|
92
|
+
// inside legitimate prose ("…take a look at the ## user content…"
|
|
93
|
+
// fed char-by-char would eventually slide a tail window onto leading
|
|
94
|
+
// whitespace + `## user` and false-positive). Only `\n`-preceded
|
|
95
|
+
// markers are real role boundaries on subsequent chunks; the preceding
|
|
96
|
+
// newline is retained inside the 64-char tail so genuine markers
|
|
97
|
+
// straddling a chunk boundary are still caught.
|
|
98
|
+
// (See PR #3303 review r3324060995.)
|
|
99
|
+
const NEWLINE_ANCHORED_ROLE_MARKER_RE = /\n[ \t]*##[ \t]+(?:user|assistant|assist|system)(?=[^a-z])/;
|
|
100
|
+
// Pending-marker variants used in the no-match branch to detect a
|
|
101
|
+
// COMPLETE-but-unconfirmed marker prefix at the end of the buffer.
|
|
102
|
+
// Drop the `(?=[^a-z])` lookahead and anchor with `$` instead — the
|
|
103
|
+
// lookahead's whole purpose is to require a non-lowercase character
|
|
104
|
+
// AFTER the role keyword, which by definition can't be present when
|
|
105
|
+
// the chunk boundary fell exactly between the role keyword and its
|
|
106
|
+
// next byte. If one of these matches, the role keyword IS at the end
|
|
107
|
+
// of the current buffer; we withhold it and revisit on the next
|
|
108
|
+
// feed, where one of three things will happen:
|
|
109
|
+
// (1) The next char is non-lowercase → main regex matches →
|
|
110
|
+
// contaminated → withheld bytes dropped.
|
|
111
|
+
// (2) The next char is lowercase (e.g. `## userl…`) → main regex
|
|
112
|
+
// no longer matches the role keyword → withheld bytes are
|
|
113
|
+
// confirmed safe and emitted alongside the new chunk.
|
|
114
|
+
// (3) The role keyword is part of a longer word that itself is a
|
|
115
|
+
// role keyword (only `user` ⊂ `users`, etc. — none extend to
|
|
116
|
+
// a different role) → still case (2), since the extension is
|
|
117
|
+
// lowercase.
|
|
118
|
+
// This implements the suggested fix on review r3324277xxx —
|
|
119
|
+
// preserves the documented "everything from the marker onward is
|
|
120
|
+
// silently dropped" contract across chunk boundaries that fall
|
|
121
|
+
// inside the lookahead-detection window.
|
|
122
|
+
const FIRST_CHUNK_PENDING_MARKER_TAIL_RE = /(?:^|\n)[ \t]*##[ \t]+(?:user|assistant|assist|system)$/;
|
|
123
|
+
const NEWLINE_ANCHORED_PENDING_MARKER_TAIL_RE = /\n[ \t]*##[ \t]+(?:user|assistant|assist|system)$/;
|
|
124
|
+
// Bounded tail size for cross-chunk matching. Must comfortably exceed
|
|
125
|
+
// the longest possible marker prefix:
|
|
126
|
+
// "\n" + whitespace run + "##" + whitespace + "assistant" ≈ 16–24
|
|
127
|
+
// chars in practice (LLMs rarely emit more than a couple newlines or a
|
|
128
|
+
// handful of spaces between sections). 64 leaves generous margin and
|
|
129
|
+
// keeps the guard's memory + per-delta work O(1) regardless of message
|
|
130
|
+
// length — important because a 50KB assistant response delivered in
|
|
131
|
+
// 1000 chunks of 50 bytes is otherwise O(n²) on string concatenation
|
|
132
|
+
// alone.
|
|
133
|
+
const TAIL_BUFFER_SIZE = 64;
|
|
134
|
+
/**
|
|
135
|
+
* Create a stateful guard that detects fabricated role markers across
|
|
136
|
+
* chunk boundaries. Memory + per-call work is O(1): instead of
|
|
137
|
+
* accumulating the full message text, the guard retains only a small
|
|
138
|
+
* trailing suffix (TAIL_BUFFER_SIZE chars) — enough for the matcher to
|
|
139
|
+
* see across chunk boundaries when a marker straddles them.
|
|
140
|
+
*
|
|
141
|
+
* Usage in a stream handler:
|
|
142
|
+
*
|
|
143
|
+
* const guard = createRoleMarkerGuard(messageId);
|
|
144
|
+
* for (const delta of deltas) {
|
|
145
|
+
* const safe = guard.feedText(delta.text);
|
|
146
|
+
* if (safe.length > 0) onEvent({ type: 'text_delta', delta: safe });
|
|
147
|
+
* if (guard.contaminated) {
|
|
148
|
+
* onEvent(guard.warningEvent()!);
|
|
149
|
+
* break; // stop emitting text for this message
|
|
150
|
+
* }
|
|
151
|
+
* }
|
|
152
|
+
*/
|
|
153
|
+
export function createRoleMarkerGuard(messageId) {
|
|
154
|
+
// Rolling tail of the bytes we have ALREADY EMITTED, capped at
|
|
155
|
+
// TAIL_BUFFER_SIZE. Used as the prefix when matching against new
|
|
156
|
+
// text so we catch markers that straddle a chunk boundary.
|
|
157
|
+
let tail = '';
|
|
158
|
+
// Bytes we have RECEIVED but DEFERRED — held back because they form
|
|
159
|
+
// a complete-but-unconfirmed marker suffix at the end of the buffer
|
|
160
|
+
// and we don't yet know whether the next chunk will confirm them
|
|
161
|
+
// (next char non-lowercase → contaminated, drop) or deny them
|
|
162
|
+
// (next char lowercase → suffix was part of a longer word, emit).
|
|
163
|
+
// Without this, a chunk boundary falling exactly between the role
|
|
164
|
+
// keyword and its lookahead char would leak the marker line itself
|
|
165
|
+
// into the UI / app.sqlite before we could classify it. See review
|
|
166
|
+
// r3324277xxx.
|
|
167
|
+
let pending = '';
|
|
168
|
+
// Tracks whether `tail` still represents the ENTIRE emission so
|
|
169
|
+
// far — i.e. no slicing has occurred yet and `^` in the canonical
|
|
170
|
+
// regex genuinely anchors at byte 0 of the message stream. While
|
|
171
|
+
// this holds, the `^|\n` alternation safely catches a role marker
|
|
172
|
+
// that arrives at the start of the stream even if its prefix is
|
|
173
|
+
// split across multiple chunks (`## ` | `user\n…`, `## us` | `er\n…`,
|
|
174
|
+
// `##` | ` user\n…`). The moment `tail` would exceed
|
|
175
|
+
// TAIL_BUFFER_SIZE, the slice turns `tail` into a mid-stream
|
|
176
|
+
// window and `^` no longer represents the stream start — we then
|
|
177
|
+
// switch to the newline-only variants so a sliding window cannot
|
|
178
|
+
// manufacture a match from prose. The transition is on slicing,
|
|
179
|
+
// not on first emission: earlier definitions ("any byte emitted",
|
|
180
|
+
// "newline emitted") both had failure modes — see PR #3303 reviews
|
|
181
|
+
// r3324060995 and r3324xxxxxx, and the regression tests below.
|
|
182
|
+
let firstChunk = true;
|
|
183
|
+
let _contaminated = false;
|
|
184
|
+
let markerText = null;
|
|
185
|
+
return {
|
|
186
|
+
get contaminated() {
|
|
187
|
+
return _contaminated;
|
|
188
|
+
},
|
|
189
|
+
feedText(text) {
|
|
190
|
+
if (_contaminated)
|
|
191
|
+
return '';
|
|
192
|
+
if (text.length === 0)
|
|
193
|
+
return '';
|
|
194
|
+
// Combine `tail` (already-emitted suffix for cross-chunk matching),
|
|
195
|
+
// `pending` (deferred-from-prior-call suspicious suffix), and the
|
|
196
|
+
// new `text` into a single matching buffer.
|
|
197
|
+
const buffer = tail + pending + text;
|
|
198
|
+
const matchRe = firstChunk
|
|
199
|
+
? FABRICATED_ROLE_MARKER_RE
|
|
200
|
+
: NEWLINE_ANCHORED_ROLE_MARKER_RE;
|
|
201
|
+
const pendingRe = firstChunk
|
|
202
|
+
? FIRST_CHUNK_PENDING_MARKER_TAIL_RE
|
|
203
|
+
: NEWLINE_ANCHORED_PENDING_MARKER_TAIL_RE;
|
|
204
|
+
// `firstChunk` transitions are tied to actual byte emission, not
|
|
205
|
+
// feed count — see comment above. Transitioned at the end of
|
|
206
|
+
// this function only when we emit at least one byte.
|
|
207
|
+
const match = matchRe.exec(buffer);
|
|
208
|
+
if (match) {
|
|
209
|
+
// Marker confirmed. Compute the safe-to-emit portion (bytes
|
|
210
|
+
// between previously-emitted `tail` and the marker), drop
|
|
211
|
+
// `pending` (the deferred portion sits inside the marker
|
|
212
|
+
// region by definition once the lookahead char arrives), and
|
|
213
|
+
// mark contaminated. Subsequent feeds early-return.
|
|
214
|
+
_contaminated = true;
|
|
215
|
+
markerText = match[0].trim();
|
|
216
|
+
pending = '';
|
|
217
|
+
const alreadyEmitted = tail.length;
|
|
218
|
+
const markerStart = match.index;
|
|
219
|
+
if (markerStart <= alreadyEmitted)
|
|
220
|
+
return '';
|
|
221
|
+
return buffer.slice(alreadyEmitted, markerStart);
|
|
222
|
+
}
|
|
223
|
+
// No confirmed marker. Check whether the buffer ends with a
|
|
224
|
+
// complete-but-unconfirmed marker prefix (role keyword present,
|
|
225
|
+
// lookahead char not yet arrived). If so, withhold that suffix
|
|
226
|
+
// until the next feed; emit the rest.
|
|
227
|
+
const pendingMatch = pendingRe.exec(buffer);
|
|
228
|
+
const alreadyEmitted = tail.length;
|
|
229
|
+
const pendingStart = pendingMatch
|
|
230
|
+
// Never withhold bytes we have already emitted in a prior
|
|
231
|
+
// feed — the suspicious suffix could in pathological cases
|
|
232
|
+
// start inside `tail` (we held back `pending` correctly on
|
|
233
|
+
// the prior call, but the suffix-start position is upstream
|
|
234
|
+
// of where we hold). Clamp to alreadyEmitted so safeToEmit
|
|
235
|
+
// never goes negative.
|
|
236
|
+
? Math.max(pendingMatch.index, alreadyEmitted)
|
|
237
|
+
: buffer.length;
|
|
238
|
+
const safeToEmit = buffer.slice(alreadyEmitted, pendingStart);
|
|
239
|
+
pending = buffer.slice(pendingStart);
|
|
240
|
+
// Roll the emitted-bytes tail forward.
|
|
241
|
+
const fullEmitted = tail + safeToEmit;
|
|
242
|
+
const willSlice = fullEmitted.length > TAIL_BUFFER_SIZE;
|
|
243
|
+
tail = willSlice
|
|
244
|
+
? fullEmitted.slice(fullEmitted.length - TAIL_BUFFER_SIZE)
|
|
245
|
+
: fullEmitted;
|
|
246
|
+
// `firstChunk` is true exactly while `tail` still represents the
|
|
247
|
+
// entire emission so far — i.e. no slice has occurred and `^` in
|
|
248
|
+
// the canonical regex genuinely anchors at byte 0 of the stream.
|
|
249
|
+
// The moment we slice (emitted bytes exceed TAIL_BUFFER_SIZE),
|
|
250
|
+
// `tail` becomes a mid-stream window, `^` becomes meaningless,
|
|
251
|
+
// and we switch to the newline-only variants.
|
|
252
|
+
//
|
|
253
|
+
// Earlier iterations of this code used "any byte emitted" or
|
|
254
|
+
// "newline emitted" as the transition trigger. Both were wrong:
|
|
255
|
+
// - "any byte" lost the `^` anchor before a chunk-split
|
|
256
|
+
// message-start marker (e.g. `## ` | `user\n…`,
|
|
257
|
+
// `## us` | `er\n…`) could finish arriving — see PR #3303
|
|
258
|
+
// review r3324xxxxxx, and the new tests below.
|
|
259
|
+
// - "newline emitted" left `^` valid on a sliced buffer for
|
|
260
|
+
// streams that hadn't yet emitted a newline, which then
|
|
261
|
+
// false-positived the rolling-tail mid-stream case from
|
|
262
|
+
// review r3324060995.
|
|
263
|
+
// Slice-based is the invariant that satisfies both: while we
|
|
264
|
+
// haven't sliced, `^` is correct; once we slice, it isn't.
|
|
265
|
+
if (willSlice)
|
|
266
|
+
firstChunk = false;
|
|
267
|
+
return safeToEmit;
|
|
268
|
+
},
|
|
269
|
+
warningEvent() {
|
|
270
|
+
if (!_contaminated || !markerText)
|
|
271
|
+
return null;
|
|
272
|
+
return {
|
|
273
|
+
type: 'fabricated_role_marker',
|
|
274
|
+
marker: markerText,
|
|
275
|
+
messageId,
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=role-marker-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-marker-guard.js","sourceRoot":"","sources":["../src/role-marker-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,yEAAyE;AACzE,qEAAqE;AACrE,mEAAmE;AACnE,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,gEAAgE;AAChE,kEAAkE;AAClE,qBAAqB;AACrB,wEAAwE;AACxE,sEAAsE;AACtE,oEAAoE;AACpE,qEAAqE;AACrE,gEAAgE;AAChE,sEAAsE;AACtE,+DAA+D;AAC/D,6CAA6C;AAC7C,+DAA+D;AAC/D,+DAA+D;AAC/D,qCAAqC;AACrC,EAAE;AACF,4DAA4D;AAC5D,EAAE;AACF,gEAAgE;AAChE,+DAA+D;AAC/D,uEAAuE;AACvE,sEAAsE;AACtE,+DAA+D;AAC/D,sEAAsE;AACtE,mEAAmE;AACnE,sEAAsE;AACtE,8DAA8D;AAC9D,mEAAmE;AACnE,6CAA6C;AAC7C,wCAAwC;AACxC,EAAE;AACF,iEAAiE;AACjE,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,4BAA4B;AAC5B,6DAA6D;AAC7D,kEAAkE;AAClE,8DAA8D;AAC9D,sDAAsD;AACtD,6DAA6D;AAC7D,6DAA6D;AAC7D,iEAAiE;AACjE,uEAAuE;AACvE,mEAAmE;AACnE,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,oEAAoE;AACpE,6DAA6D;AAC7D,mDAAmD;AACnD,EAAE;AACF,gEAAgE;AAChE,qEAAqE;AACrE,4DAA4D;A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D,4DAA4D;YAC5D,4DAA4D;YAC5D,0BAA0B;YAC1B,6DAA6D;YAC7D,2DAA2D;YAC3D,IAAI,SAAS;gBAAE,UAAU,GAAG,KAAK,CAAC;YAElC,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,YAAY;YACV,IAAI,CAAC,aAAa,IAAI,CAAC,UAAU;gBAAE,OAAO,IAAI,CAAC;YAC/C,OAAO;gBACL,IAAI,EAAE,wBAAwB;gBAC9B,MAAM,EAAE,UAAU;gBAClB,SAAS;aACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module telemetry-sink
|
|
3
|
+
*
|
|
4
|
+
* Port replacing the OD analytics naming baked into OD's
|
|
5
|
+
* `runtimes/runs/run-artifacts.ts` (`run_finished.artifact_count`,
|
|
6
|
+
* `runAskedUserQuestion` → `run_finished.asked_user_question`,
|
|
7
|
+
* `deriveActivationMilestones`'s PostHog `$set_once` person-property
|
|
8
|
+
* scheme) and `run-lifecycle-analytics.ts` (not present as a separate file
|
|
9
|
+
* on this branch — its concerns are folded into `run-artifacts.ts` here).
|
|
10
|
+
* None of that OD-schema logic is ported.
|
|
11
|
+
*
|
|
12
|
+
* Per r1b §1b: the engine emits a generic run-lifecycle event stream; the
|
|
13
|
+
* host maps it to its own analytics schema. `data` is intentionally
|
|
14
|
+
* `Record<string, unknown>` — artifactCount, askedUserQuestion, stopReason,
|
|
15
|
+
* etc. are opaque to the engine, populated by whatever
|
|
16
|
+
* `ArtifactTaxonomy`/`PromptAugmenter` implementation the host wires in.
|
|
17
|
+
*/
|
|
18
|
+
export interface RunLifecycleEvent {
|
|
19
|
+
type: 'run_started' | 'run_finished' | 'run_failed' | 'tool_use' | 'artifact_written';
|
|
20
|
+
runId: string;
|
|
21
|
+
agentId: string;
|
|
22
|
+
at: number;
|
|
23
|
+
data?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface TelemetrySink {
|
|
26
|
+
emit(event: RunLifecycleEvent): void;
|
|
27
|
+
reportFinalizedMessage?(input: {
|
|
28
|
+
runId: string;
|
|
29
|
+
text: string;
|
|
30
|
+
meta: Record<string, unknown>;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
33
|
+
/** Discards every event. Safe default until a host supplies a real sink. */
|
|
34
|
+
export declare const noopTelemetrySink: TelemetrySink;
|
|
35
|
+
//# sourceMappingURL=telemetry-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-sink.d.ts","sourceRoot":"","sources":["../src/telemetry-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,kBAAkB,CAAC;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC,sBAAsB,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;CACtG;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,aAE/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-sink.js","sourceRoot":"","sources":["../src/telemetry-sink.ts"],"names":[],"mappings":"AA8BA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TerminalLaunchResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
platform: NodeJS.Platform;
|
|
4
|
+
via: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
platform: NodeJS.Platform;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function launchAgentInSystemTerminal(command: string, platform?: NodeJS.Platform, windowTitle?: string): Promise<TerminalLaunchResult>;
|
|
11
|
+
//# sourceMappingURL=terminal-launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-launch.d.ts","sourceRoot":"","sources":["../src/terminal-launch.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAmF7D,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,WAAW,GAAE,MAAwB,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAe/B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module terminal-launch
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform "open a system terminal and run this command in it."
|
|
5
|
+
* Used by adapters whose OAuth flow cannot complete in a headless/print
|
|
6
|
+
* mode (e.g. antigravity's `agy -p`) — the CLI has to run interactively at
|
|
7
|
+
* least once to populate a credential keyring, and spawning a terminal from
|
|
8
|
+
* inside the host app makes that a one-click action instead of a "go open
|
|
9
|
+
* Terminal yourself" task.
|
|
10
|
+
*
|
|
11
|
+
* Ported from OD's `apps/daemon/src/runtimes/launch/terminal-launch.ts`
|
|
12
|
+
* with one de-branding change: the Windows path opened a `cmd.exe` window
|
|
13
|
+
* titled literally with the product's own name (see `source-map.md` for
|
|
14
|
+
* the exact original string). `launchAgentInSystemTerminal` now takes an
|
|
15
|
+
* optional `windowTitle` (default `'Agent Sign-in'`).
|
|
16
|
+
*
|
|
17
|
+
* Each platform branch uses primitives that are safe against shell
|
|
18
|
+
* injection BECAUSE we never accept user input here — the `command`
|
|
19
|
+
* argument is always a hard-coded binary name. Adding caller-supplied
|
|
20
|
+
* flags or env vars to this helper would invalidate that guarantee, so the
|
|
21
|
+
* signature is intentionally narrow.
|
|
22
|
+
*/
|
|
23
|
+
import { execFile, spawn } from 'node:child_process';
|
|
24
|
+
import { promisify } from 'node:util';
|
|
25
|
+
const execFileAsync = promisify(execFile);
|
|
26
|
+
// macOS: AppleScript via osascript. Bringing Terminal.app to the
|
|
27
|
+
// foreground and creating a new shell that immediately runs the command is
|
|
28
|
+
// the canonical macOS pattern.
|
|
29
|
+
async function launchOnDarwin(command) {
|
|
30
|
+
// `do script "<cmd>"` opens a new Terminal window and runs <cmd> in it;
|
|
31
|
+
// activate brings Terminal.app to the foreground so the user actually
|
|
32
|
+
// sees the new window. Strict double-quote escaping protects us if
|
|
33
|
+
// `command` ever grows special characters.
|
|
34
|
+
const safe = command.replace(/"/g, '\\"');
|
|
35
|
+
const script = `tell application "Terminal" to do script "${safe}"\ntell application "Terminal" to activate`;
|
|
36
|
+
try {
|
|
37
|
+
await execFileAsync('osascript', ['-e', script], { timeout: 5_000 });
|
|
38
|
+
return { ok: true, platform: 'darwin', via: 'osascript' };
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
platform: 'darwin',
|
|
44
|
+
reason: `osascript failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Linux: try the Debian/Ubuntu meta-emulator first, then the common
|
|
49
|
+
// concrete terminals. Each attempt spawns detached so the terminal
|
|
50
|
+
// window's lifetime is independent from the host process group. We
|
|
51
|
+
// resolve as soon as the child process starts (not when it exits), because
|
|
52
|
+
// terminals like xterm and x-terminal-emulator stay alive for the duration
|
|
53
|
+
// of the interactive session — waiting for exit would time out and kill
|
|
54
|
+
// the window mid-OAuth-flow.
|
|
55
|
+
async function launchOnLinux(command) {
|
|
56
|
+
// Order matters: x-terminal-emulator is the Debian alternative that
|
|
57
|
+
// resolves to whichever terminal the distro chose. Otherwise try the
|
|
58
|
+
// common ones. Each requires a slightly different invocation syntax
|
|
59
|
+
// (`-e` vs `--` vs `-x`), captured in this table.
|
|
60
|
+
const attempts = [
|
|
61
|
+
{ bin: 'x-terminal-emulator', args: ['-e', command] },
|
|
62
|
+
{ bin: 'gnome-terminal', args: ['--', 'sh', '-c', `${command}; exec $SHELL`] },
|
|
63
|
+
{ bin: 'konsole', args: ['-e', command] },
|
|
64
|
+
{ bin: 'xfce4-terminal', args: ['-e', command] },
|
|
65
|
+
{ bin: 'xterm', args: ['-e', command] },
|
|
66
|
+
];
|
|
67
|
+
const errors = [];
|
|
68
|
+
for (const { bin, args } of attempts) {
|
|
69
|
+
try {
|
|
70
|
+
await new Promise((resolve, reject) => {
|
|
71
|
+
const child = spawn(bin, args, { detached: true, stdio: 'ignore' });
|
|
72
|
+
child.unref();
|
|
73
|
+
child.once('spawn', resolve);
|
|
74
|
+
child.once('error', reject);
|
|
75
|
+
});
|
|
76
|
+
return { ok: true, platform: 'linux', via: bin };
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
errors.push(`${bin}: ${err instanceof Error ? err.message : String(err)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
platform: 'linux',
|
|
85
|
+
reason: `no system terminal worked (${errors.join('; ')})`,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// Windows: `cmd /c start "<title>" cmd /k "<command>"` — the outer `start`
|
|
89
|
+
// opens a new console window (the first quoted arg is the window title,
|
|
90
|
+
// required by `start`'s positional-arg parser when the next token is also
|
|
91
|
+
// quoted), and the inner `cmd /k` keeps the window open after the command
|
|
92
|
+
// finishes so the user can see OAuth output and finish the flow before the
|
|
93
|
+
// window closes.
|
|
94
|
+
async function launchOnWindows(command, windowTitle) {
|
|
95
|
+
try {
|
|
96
|
+
await execFileAsync('cmd.exe', ['/c', 'start', windowTitle, 'cmd.exe', '/k', command], { timeout: 5_000 });
|
|
97
|
+
return { ok: true, platform: 'win32', via: 'cmd /c start' };
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return {
|
|
101
|
+
ok: false,
|
|
102
|
+
platform: 'win32',
|
|
103
|
+
reason: `cmd /c start failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function launchAgentInSystemTerminal(command, platform = process.platform, windowTitle = 'Agent Sign-in') {
|
|
108
|
+
switch (platform) {
|
|
109
|
+
case 'darwin':
|
|
110
|
+
return launchOnDarwin(command);
|
|
111
|
+
case 'linux':
|
|
112
|
+
return launchOnLinux(command);
|
|
113
|
+
case 'win32':
|
|
114
|
+
return launchOnWindows(command, windowTitle);
|
|
115
|
+
default:
|
|
116
|
+
return {
|
|
117
|
+
ok: false,
|
|
118
|
+
platform,
|
|
119
|
+
reason: `system-terminal launch is not supported on ${platform}`,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=terminal-launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-launch.js","sourceRoot":"","sources":["../src/terminal-launch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,EAAE,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