openhorse 0.2.19 → 0.2.22
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/dist/agents/coordinator.d.ts.map +1 -1
- package/dist/agents/fork.d.ts.map +1 -1
- package/dist/agents/fork.js +0 -1
- package/dist/agents/fork.js.map +1 -1
- package/dist/agents/worker-pool.d.ts.map +1 -1
- package/dist/agents/worker-pool.js +3 -1
- package/dist/agents/worker-pool.js.map +1 -1
- package/dist/cli.js +28 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +202 -77
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/parser.d.ts.map +1 -1
- package/dist/commands/parser.js +8 -3
- package/dist/commands/parser.js.map +1 -1
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/core/checkpoint.d.ts.map +1 -1
- package/dist/core/checkpoint.js +3 -0
- package/dist/core/checkpoint.js.map +1 -1
- package/dist/core/cost-tracker.d.ts +45 -5
- package/dist/core/cost-tracker.d.ts.map +1 -1
- package/dist/core/cost-tracker.js +78 -13
- package/dist/core/cost-tracker.js.map +1 -1
- package/dist/framework/index.d.ts +1 -1
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js.map +1 -1
- package/dist/framework/prompt.d.ts.map +1 -1
- package/dist/framework/prompt.js +16 -0
- package/dist/framework/prompt.js.map +1 -1
- package/dist/framework/query.d.ts +25 -0
- package/dist/framework/query.d.ts.map +1 -1
- package/dist/framework/query.js +196 -56
- package/dist/framework/query.js.map +1 -1
- package/dist/framework/store.d.ts +6 -1
- package/dist/framework/store.d.ts.map +1 -1
- package/dist/framework/store.js +10 -1
- package/dist/framework/store.js.map +1 -1
- package/dist/harness/context-harness.d.ts.map +1 -1
- package/dist/harness/context-harness.js +6 -1
- package/dist/harness/context-harness.js.map +1 -1
- package/dist/harness/ledger.d.ts +1 -0
- package/dist/harness/ledger.d.ts.map +1 -1
- package/dist/harness/ledger.js +12 -0
- package/dist/harness/ledger.js.map +1 -1
- package/dist/harness/safety.d.ts +2 -0
- package/dist/harness/safety.d.ts.map +1 -1
- package/dist/harness/safety.js +27 -3
- package/dist/harness/safety.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -1
- package/dist/init.js.map +1 -1
- package/dist/ink-ui/components/Markdown.d.ts +1 -1
- package/dist/ink-ui/components/Markdown.d.ts.map +1 -1
- package/dist/ink-ui/components/Markdown.js +1 -1
- package/dist/ink-ui/components/Markdown.js.map +1 -1
- package/dist/ink-ui/components/StatusLine.d.ts.map +1 -1
- package/dist/ink-ui/components/StatusLine.js +0 -2
- package/dist/ink-ui/components/StatusLine.js.map +1 -1
- package/dist/ink-ui/runtime/grapheme.d.ts +9 -8
- package/dist/ink-ui/runtime/grapheme.d.ts.map +1 -1
- package/dist/ink-ui/runtime/grapheme.js +14 -60
- package/dist/ink-ui/runtime/grapheme.js.map +1 -1
- package/dist/ink-ui/runtime/input-buffer.d.ts +9 -31
- package/dist/ink-ui/runtime/input-buffer.d.ts.map +1 -1
- package/dist/ink-ui/runtime/input-buffer.js +15 -162
- package/dist/ink-ui/runtime/input-buffer.js.map +1 -1
- package/dist/ink-ui/runtime/native-cursor.js +0 -25
- package/dist/ink-ui/runtime/native-cursor.js.map +1 -1
- package/dist/ink-ui/runtime/prompt-layout.d.ts +9 -29
- package/dist/ink-ui/runtime/prompt-layout.d.ts.map +1 -1
- package/dist/ink-ui/runtime/prompt-layout.js +18 -166
- package/dist/ink-ui/runtime/prompt-layout.js.map +1 -1
- package/dist/ink-ui/runtime/transcript-state.d.ts.map +1 -1
- package/dist/ink-ui/runtime/transcript-state.js +2 -0
- package/dist/ink-ui/runtime/transcript-state.js.map +1 -1
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +1 -1
- package/dist/ink-ui/screens/ReplScreen.js +23 -5
- package/dist/ink-ui/screens/ReplScreen.js.map +1 -1
- package/dist/memory/entrypoint.js +1 -1
- package/dist/memory/entrypoint.js.map +1 -1
- package/dist/memory/storage.js +1 -1
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/store.d.ts +1 -0
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +9 -0
- package/dist/memory/store.js.map +1 -1
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-controller.js +25 -0
- package/dist/runtime/agent-runtime-controller.js.map +1 -1
- package/dist/runtime/agent-runtime-protocol.d.ts +4 -1
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-protocol.js +6 -0
- package/dist/runtime/agent-runtime-protocol.js.map +1 -1
- package/dist/runtime/chat-controller.d.ts +27 -0
- package/dist/runtime/chat-controller.d.ts.map +1 -1
- package/dist/runtime/chat-controller.js +374 -88
- package/dist/runtime/chat-controller.js.map +1 -1
- package/dist/runtime/composer/buffer.d.ts +43 -0
- package/dist/runtime/composer/buffer.d.ts.map +1 -0
- package/dist/runtime/composer/buffer.js +176 -0
- package/dist/runtime/composer/buffer.js.map +1 -0
- package/dist/runtime/composer/grapheme.d.ts +19 -0
- package/dist/runtime/composer/grapheme.d.ts.map +1 -0
- package/dist/runtime/composer/grapheme.js +73 -0
- package/dist/runtime/composer/grapheme.js.map +1 -0
- package/dist/runtime/composer/history.d.ts +39 -0
- package/dist/runtime/composer/history.d.ts.map +1 -0
- package/dist/runtime/composer/history.js +91 -0
- package/dist/runtime/composer/history.js.map +1 -0
- package/dist/runtime/composer/layout.d.ts +40 -0
- package/dist/runtime/composer/layout.d.ts.map +1 -0
- package/dist/runtime/composer/layout.js +174 -0
- package/dist/runtime/composer/layout.js.map +1 -0
- package/dist/runtime/rich-text/ansi-parser.d.ts +31 -0
- package/dist/runtime/rich-text/ansi-parser.d.ts.map +1 -0
- package/dist/runtime/rich-text/ansi-parser.js +310 -0
- package/dist/runtime/rich-text/ansi-parser.js.map +1 -0
- package/dist/runtime/rich-text/layout.d.ts +12 -0
- package/dist/runtime/rich-text/layout.d.ts.map +1 -0
- package/dist/runtime/rich-text/layout.js +362 -0
- package/dist/runtime/rich-text/layout.js.map +1 -0
- package/dist/runtime/rich-text/markdown-parser.d.ts +17 -0
- package/dist/runtime/rich-text/markdown-parser.d.ts.map +1 -0
- package/dist/runtime/rich-text/markdown-parser.js +218 -0
- package/dist/runtime/rich-text/markdown-parser.js.map +1 -0
- package/dist/runtime/rich-text/sanitizer.d.ts +18 -0
- package/dist/runtime/rich-text/sanitizer.d.ts.map +1 -0
- package/dist/runtime/rich-text/sanitizer.js +32 -0
- package/dist/runtime/rich-text/sanitizer.js.map +1 -0
- package/dist/runtime/rich-text/types.d.ts +59 -0
- package/dist/runtime/rich-text/types.d.ts.map +1 -0
- package/dist/runtime/rich-text/types.js +17 -0
- package/dist/runtime/rich-text/types.js.map +1 -0
- package/dist/runtime/subagents/budget.d.ts +118 -0
- package/dist/runtime/subagents/budget.d.ts.map +1 -0
- package/dist/runtime/subagents/budget.js +173 -0
- package/dist/runtime/subagents/budget.js.map +1 -0
- package/dist/runtime/subagents/child-executor-guard.d.ts +60 -0
- package/dist/runtime/subagents/child-executor-guard.d.ts.map +1 -0
- package/dist/runtime/subagents/child-executor-guard.js +219 -0
- package/dist/runtime/subagents/child-executor-guard.js.map +1 -0
- package/dist/runtime/subagents/context-builder.d.ts +34 -0
- package/dist/runtime/subagents/context-builder.d.ts.map +1 -0
- package/dist/runtime/subagents/context-builder.js +99 -0
- package/dist/runtime/subagents/context-builder.js.map +1 -0
- package/dist/runtime/subagents/index.d.ts +21 -0
- package/dist/runtime/subagents/index.d.ts.map +1 -0
- package/dist/runtime/subagents/index.js +62 -0
- package/dist/runtime/subagents/index.js.map +1 -0
- package/dist/runtime/subagents/policy.d.ts +68 -0
- package/dist/runtime/subagents/policy.d.ts.map +1 -0
- package/dist/runtime/subagents/policy.js +230 -0
- package/dist/runtime/subagents/policy.js.map +1 -0
- package/dist/runtime/subagents/presets.d.ts +44 -0
- package/dist/runtime/subagents/presets.d.ts.map +1 -0
- package/dist/runtime/subagents/presets.js +148 -0
- package/dist/runtime/subagents/presets.js.map +1 -0
- package/dist/runtime/subagents/production.d.ts +44 -0
- package/dist/runtime/subagents/production.d.ts.map +1 -0
- package/dist/runtime/subagents/production.js +143 -0
- package/dist/runtime/subagents/production.js.map +1 -0
- package/dist/runtime/subagents/provider-gate.d.ts +99 -0
- package/dist/runtime/subagents/provider-gate.d.ts.map +1 -0
- package/dist/runtime/subagents/provider-gate.js +186 -0
- package/dist/runtime/subagents/provider-gate.js.map +1 -0
- package/dist/runtime/subagents/result-parser.d.ts +40 -0
- package/dist/runtime/subagents/result-parser.d.ts.map +1 -0
- package/dist/runtime/subagents/result-parser.js +240 -0
- package/dist/runtime/subagents/result-parser.js.map +1 -0
- package/dist/runtime/subagents/runner.d.ts +53 -0
- package/dist/runtime/subagents/runner.d.ts.map +1 -0
- package/dist/runtime/subagents/runner.js +172 -0
- package/dist/runtime/subagents/runner.js.map +1 -0
- package/dist/runtime/subagents/runtime-integration.d.ts +73 -0
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -0
- package/dist/runtime/subagents/runtime-integration.js +148 -0
- package/dist/runtime/subagents/runtime-integration.js.map +1 -0
- package/dist/runtime/subagents/supervisor.d.ts +79 -0
- package/dist/runtime/subagents/supervisor.d.ts.map +1 -0
- package/dist/runtime/subagents/supervisor.js +301 -0
- package/dist/runtime/subagents/supervisor.js.map +1 -0
- package/dist/runtime/subagents/tool.d.ts +38 -0
- package/dist/runtime/subagents/tool.d.ts.map +1 -0
- package/dist/runtime/subagents/tool.js +171 -0
- package/dist/runtime/subagents/tool.js.map +1 -0
- package/dist/runtime/subagents/types.d.ts +152 -0
- package/dist/runtime/subagents/types.d.ts.map +1 -0
- package/dist/runtime/subagents/types.js +56 -0
- package/dist/runtime/subagents/types.js.map +1 -0
- package/dist/runtime/ui-events.d.ts +18 -0
- package/dist/runtime/ui-events.d.ts.map +1 -1
- package/dist/runtime/ui-events.js.map +1 -1
- package/dist/runtime/ui-view-model.d.ts +44 -1
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +90 -37
- package/dist/runtime/ui-view-model.js.map +1 -1
- package/dist/sdk/query.d.ts.map +1 -1
- package/dist/sdk/query.js +0 -1
- package/dist/sdk/query.js.map +1 -1
- package/dist/services/auto-fix/autoFixHook.d.ts.map +1 -1
- package/dist/services/auto-fix/autoFixHook.js +3 -2
- package/dist/services/auto-fix/autoFixHook.js.map +1 -1
- package/dist/services/auto-fix/autoFixRunner.d.ts +2 -2
- package/dist/services/auto-fix/autoFixRunner.d.ts.map +1 -1
- package/dist/services/auto-fix/autoFixRunner.js +2 -2
- package/dist/services/auto-fix/autoFixRunner.js.map +1 -1
- package/dist/services/compact/auto-compact.d.ts +15 -2
- package/dist/services/compact/auto-compact.d.ts.map +1 -1
- package/dist/services/compact/auto-compact.js +59 -27
- package/dist/services/compact/auto-compact.js.map +1 -1
- package/dist/services/compact/compact.d.ts +2 -0
- package/dist/services/compact/compact.d.ts.map +1 -1
- package/dist/services/compact/compact.js +22 -5
- package/dist/services/compact/compact.js.map +1 -1
- package/dist/services/compact/coordinator.d.ts +26 -0
- package/dist/services/compact/coordinator.d.ts.map +1 -0
- package/dist/services/compact/coordinator.js +44 -0
- package/dist/services/compact/coordinator.js.map +1 -0
- package/dist/services/compact/index.d.ts +1 -0
- package/dist/services/compact/index.d.ts.map +1 -1
- package/dist/services/compact/index.js +3 -1
- package/dist/services/compact/index.js.map +1 -1
- package/dist/services/compact/summary-generator.d.ts +6 -2
- package/dist/services/compact/summary-generator.d.ts.map +1 -1
- package/dist/services/compact/summary-generator.js +73 -32
- package/dist/services/compact/summary-generator.js.map +1 -1
- package/dist/services/concurrent-sessions.d.ts.map +1 -1
- package/dist/services/concurrent-sessions.js +3 -0
- package/dist/services/concurrent-sessions.js.map +1 -1
- package/dist/services/config-dir.d.ts +11 -1
- package/dist/services/config-dir.d.ts.map +1 -1
- package/dist/services/config-dir.js +19 -2
- package/dist/services/config-dir.js.map +1 -1
- package/dist/services/config.d.ts +13 -4
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +85 -4
- package/dist/services/config.js.map +1 -1
- package/dist/services/doctor.d.ts +2 -0
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +9 -2
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/global-config.d.ts +33 -1
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/global-config.js +3 -0
- package/dist/services/global-config.js.map +1 -1
- package/dist/services/llm.d.ts +21 -4
- package/dist/services/llm.d.ts.map +1 -1
- package/dist/services/llm.js +75 -9
- package/dist/services/llm.js.map +1 -1
- package/dist/services/mcp/transports.d.ts +2 -0
- package/dist/services/mcp/transports.d.ts.map +1 -1
- package/dist/services/mcp/transports.js +23 -2
- package/dist/services/mcp/transports.js.map +1 -1
- package/dist/services/memory.d.ts.map +1 -1
- package/dist/services/memory.js.map +1 -1
- package/dist/services/model-context.d.ts +36 -0
- package/dist/services/model-context.d.ts.map +1 -1
- package/dist/services/model-context.js +243 -31
- package/dist/services/model-context.js.map +1 -1
- package/dist/services/redaction.js +1 -1
- package/dist/services/redaction.js.map +1 -1
- package/dist/services/session-memory/sessionMemory.js +1 -1
- package/dist/services/session-memory/sessionMemory.js.map +1 -1
- package/dist/services/session-storage.d.ts +39 -1
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +156 -28
- package/dist/services/session-storage.js.map +1 -1
- package/dist/services/task-manager.d.ts +2 -0
- package/dist/services/task-manager.d.ts.map +1 -1
- package/dist/services/task-manager.js +13 -0
- package/dist/services/task-manager.js.map +1 -1
- package/dist/services/usage-state.d.ts +55 -5
- package/dist/services/usage-state.d.ts.map +1 -1
- package/dist/services/usage-state.js +188 -59
- package/dist/services/usage-state.js.map +1 -1
- package/dist/services/verification-profile.d.ts.map +1 -1
- package/dist/services/verification-profile.js +3 -2
- package/dist/services/verification-profile.js.map +1 -1
- package/dist/services/workspace-diff.d.ts.map +1 -1
- package/dist/services/workspace-diff.js +34 -3
- package/dist/services/workspace-diff.js.map +1 -1
- package/dist/services/yaml-config.js +1 -1
- package/dist/skills/loader.d.ts +1 -1
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +1 -1
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/registry.d.ts +1 -1
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +1 -1
- package/dist/skills/registry.js.map +1 -1
- package/dist/skills/runtime.d.ts +9 -5
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +157 -12
- package/dist/skills/runtime.js.map +1 -1
- package/dist/terminal-ui/launch.d.ts +20 -3
- package/dist/terminal-ui/launch.d.ts.map +1 -1
- package/dist/terminal-ui/launch.js +86 -25
- package/dist/terminal-ui/launch.js.map +1 -1
- package/dist/terminal-ui/raw-editor.d.ts +9 -0
- package/dist/terminal-ui/raw-editor.d.ts.map +1 -1
- package/dist/terminal-ui/raw-editor.js +207 -30
- package/dist/terminal-ui/raw-editor.js.map +1 -1
- package/dist/tools/bash_security.d.ts.map +1 -1
- package/dist/tools/bash_security.js +14 -5
- package/dist/tools/bash_security.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +51 -24
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/lsp.js.map +1 -1
- package/dist/tools/plan.d.ts.map +1 -1
- package/dist/tools/plan.js +7 -0
- package/dist/tools/plan.js.map +1 -1
- package/dist/tools/web.d.ts +10 -0
- package/dist/tools/web.d.ts.map +1 -1
- package/dist/tools/web.js +84 -4
- package/dist/tools/web.js.map +1 -1
- package/dist/tui-core/frame.d.ts +13 -1
- package/dist/tui-core/frame.d.ts.map +1 -1
- package/dist/tui-core/frame.js +61 -8
- package/dist/tui-core/frame.js.map +1 -1
- package/dist/tui-core/input-parser.d.ts +1 -1
- package/dist/tui-core/input-parser.d.ts.map +1 -1
- package/dist/tui-core/input-parser.js +20 -1
- package/dist/tui-core/input-parser.js.map +1 -1
- package/dist/tui-core/style.d.ts +103 -0
- package/dist/tui-core/style.d.ts.map +1 -0
- package/dist/tui-core/style.js +269 -0
- package/dist/tui-core/style.js.map +1 -0
- package/dist/tui-core/terminal-writer.d.ts.map +1 -1
- package/dist/tui-core/terminal-writer.js +16 -3
- package/dist/tui-core/terminal-writer.js.map +1 -1
- package/dist/tui-ui/inline-surface.d.ts +185 -0
- package/dist/tui-ui/inline-surface.d.ts.map +1 -0
- package/dist/tui-ui/inline-surface.js +615 -0
- package/dist/tui-ui/inline-surface.js.map +1 -0
- package/dist/tui-ui/launch.d.ts +1 -0
- package/dist/tui-ui/launch.d.ts.map +1 -1
- package/dist/tui-ui/launch.js +398 -69
- package/dist/tui-ui/launch.js.map +1 -1
- package/dist/tui-ui/layout.d.ts +51 -2
- package/dist/tui-ui/layout.d.ts.map +1 -1
- package/dist/tui-ui/layout.js +240 -77
- package/dist/tui-ui/layout.js.map +1 -1
- package/dist/tui-ui/render-scheduler.d.ts +37 -0
- package/dist/tui-ui/render-scheduler.d.ts.map +1 -0
- package/dist/tui-ui/render-scheduler.js +118 -0
- package/dist/tui-ui/render-scheduler.js.map +1 -0
- package/dist/tui-ui/runner.d.ts +78 -5
- package/dist/tui-ui/runner.d.ts.map +1 -1
- package/dist/tui-ui/runner.js +317 -22
- package/dist/tui-ui/runner.js.map +1 -1
- package/dist/tui-ui/state.d.ts +38 -7
- package/dist/tui-ui/state.d.ts.map +1 -1
- package/dist/tui-ui/state.js +199 -40
- package/dist/tui-ui/state.js.map +1 -1
- package/dist/tui-ui/theme.d.ts +13 -0
- package/dist/tui-ui/theme.d.ts.map +1 -0
- package/dist/tui-ui/theme.js +20 -0
- package/dist/tui-ui/theme.js.map +1 -0
- package/dist/tui-ui/transcript-cache.d.ts +35 -0
- package/dist/tui-ui/transcript-cache.d.ts.map +1 -0
- package/dist/tui-ui/transcript-cache.js +74 -0
- package/dist/tui-ui/transcript-cache.js.map +1 -0
- package/dist/tui-ui/transcript-layout.d.ts +21 -0
- package/dist/tui-ui/transcript-layout.d.ts.map +1 -0
- package/dist/tui-ui/transcript-layout.js +398 -0
- package/dist/tui-ui/transcript-layout.js.map +1 -0
- package/dist/ui/box.d.ts.map +1 -1
- package/dist/ui/box.js +0 -11
- package/dist/ui/box.js.map +1 -1
- package/dist/ui/command-panel.d.ts.map +1 -1
- package/dist/ui/command-panel.js +1 -3
- package/dist/ui/command-panel.js.map +1 -1
- package/dist/ui/file-completion.js +1 -1
- package/dist/ui/file-completion.js.map +1 -1
- package/dist/ui/markdown.d.ts.map +1 -1
- package/dist/ui/markdown.js +1 -2
- package/dist/ui/markdown.js.map +1 -1
- package/dist/ui/multiline-input.d.ts.map +1 -1
- package/dist/ui/multiline-input.js +1 -2
- package/dist/ui/multiline-input.js.map +1 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +0 -3
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/status-bar.d.ts +1 -1
- package/dist/ui/status-bar.d.ts.map +1 -1
- package/dist/ui/status-bar.js +2 -16
- package/dist/ui/status-bar.js.map +1 -1
- package/dist/ui/stream-markdown.d.ts +3 -0
- package/dist/ui/stream-markdown.d.ts.map +1 -1
- package/dist/ui/stream-markdown.js +0 -6
- package/dist/ui/stream-markdown.js.map +1 -1
- package/dist/ui/tool-preview.d.ts.map +1 -1
- package/dist/ui/tool-preview.js +0 -1
- package/dist/ui/tool-preview.js.map +1 -1
- package/dist/ui-v2/components/shell.d.ts.map +1 -1
- package/dist/ui-v2/components/shell.js +0 -8
- package/dist/ui-v2/components/shell.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli-dbg.js +0 -717
- package/dist/cli-debug.d.ts +0 -7
- package/dist/cli-debug.d.ts.map +0 -1
- package/dist/cli-debug.js +0 -717
- package/dist/cli-debug.js.map +0 -1
- package/dist/cli-debug2.d.ts +0 -7
- package/dist/cli-debug2.d.ts.map +0 -1
- package/dist/cli-debug2.js +0 -717
- package/dist/cli-debug2.js.map +0 -1
- package/dist/cli-debug3.d.ts +0 -7
- package/dist/cli-debug3.d.ts.map +0 -1
- package/dist/cli-debug3.js +0 -719
- package/dist/cli-debug3.js.map +0 -1
- package/dist/cli-ink.d.ts +0 -8
- package/dist/cli-ink.d.ts.map +0 -1
- package/dist/cli-ink.js +0 -32
- package/dist/cli-ink.js.map +0 -1
- package/dist/cli-patch.js +0 -716
- package/dist/cli-test.js +0 -726
|
@@ -51,6 +51,7 @@ const tool_serializer_1 = require("../framework/tool-serializer");
|
|
|
51
51
|
const tool_artifacts_1 = require("../core/tool-artifacts");
|
|
52
52
|
const checkpoint_1 = require("../core/checkpoint");
|
|
53
53
|
const skills_1 = require("../skills");
|
|
54
|
+
const subagents_1 = require("./subagents");
|
|
54
55
|
const file_context_1 = require("../services/file-context");
|
|
55
56
|
const prompt_context_1 = require("../services/prompt-context");
|
|
56
57
|
const format_1 = require("../services/format");
|
|
@@ -120,7 +121,18 @@ function compactMiddle(text, maxLength) {
|
|
|
120
121
|
return `${compact.slice(0, headLength)}...${compact.slice(-tailLength)}`;
|
|
121
122
|
}
|
|
122
123
|
function compactToolArgs(args, maxLength = 160) {
|
|
123
|
-
for (const key of [
|
|
124
|
+
for (const key of [
|
|
125
|
+
'path',
|
|
126
|
+
'file_path',
|
|
127
|
+
'file',
|
|
128
|
+
'cwd',
|
|
129
|
+
'command',
|
|
130
|
+
'pattern',
|
|
131
|
+
'query',
|
|
132
|
+
'url',
|
|
133
|
+
'target',
|
|
134
|
+
'sessionId',
|
|
135
|
+
]) {
|
|
124
136
|
const value = args[key];
|
|
125
137
|
if (typeof value === 'string') {
|
|
126
138
|
return compactMiddle(value, maxLength);
|
|
@@ -147,16 +159,14 @@ function buildTraceArgsDetails(projectPath, name, args) {
|
|
|
147
159
|
const argsSummary = compactToolArgs(args);
|
|
148
160
|
const fullArgs = (0, session_storage_1.redactTraceText)(fullToolArgsForTrace(name, args)).trim();
|
|
149
161
|
const argsBytes = byteLength(fullArgs);
|
|
150
|
-
if (!projectPath
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
if (!projectPath ||
|
|
163
|
+
!fullArgs ||
|
|
164
|
+
fullArgs === (0, session_storage_1.redactTraceText)(argsSummary) ||
|
|
165
|
+
argsBytes <= TRACE_ARGS_ARTIFACT_THRESHOLD_BYTES) {
|
|
154
166
|
return { argsSummary };
|
|
155
167
|
}
|
|
156
168
|
const artifact = (0, tool_artifacts_1.storeArtifact)(projectPath, `${name}-args`, fullArgs, argsBytes);
|
|
157
|
-
return artifact
|
|
158
|
-
? { argsSummary, argsArtifactId: artifact.id, argsBytes }
|
|
159
|
-
: { argsSummary };
|
|
169
|
+
return artifact ? { argsSummary, argsArtifactId: artifact.id, argsBytes } : { argsSummary };
|
|
160
170
|
}
|
|
161
171
|
function parseToolCallArgsForRuntime(toolCall) {
|
|
162
172
|
try {
|
|
@@ -210,7 +220,9 @@ function createPreToolCheckpoint(events, sessionId, turnId, checkpointId, cwd, t
|
|
|
210
220
|
checkpointFiles: checkpoint?.files.map(file => file.path) ?? [],
|
|
211
221
|
workspaceFiles: relativeTargets,
|
|
212
222
|
note: checkpoint
|
|
213
|
-
?
|
|
223
|
+
? risky
|
|
224
|
+
? 'risky_multi_file_checkpoint'
|
|
225
|
+
: 'pre_edit_checkpoint'
|
|
214
226
|
: 'pre_edit_checkpoint_skipped',
|
|
215
227
|
});
|
|
216
228
|
return { created: true, targetCount: targets.length, risky };
|
|
@@ -238,7 +250,9 @@ function formatWorkspaceFileForTrace(file) {
|
|
|
238
250
|
const metadata = [
|
|
239
251
|
typeof file.sizeBytes === 'number' ? `${file.sizeBytes}B` : '',
|
|
240
252
|
typeof file.mtimeMs === 'number' ? `mtime=${file.mtimeMs}` : '',
|
|
241
|
-
]
|
|
253
|
+
]
|
|
254
|
+
.filter(Boolean)
|
|
255
|
+
.join(' ');
|
|
242
256
|
return `${file.status} ${file.path}${metadata ? ` (${metadata})` : ''}`;
|
|
243
257
|
}
|
|
244
258
|
function appendWorkspaceSnapshotTrace(events, sessionId, turnId, phase, snapshot) {
|
|
@@ -274,19 +288,13 @@ function appendWorkspaceDeltaTrace(events, sessionId, turnId, before, after) {
|
|
|
274
288
|
return delta;
|
|
275
289
|
}
|
|
276
290
|
function workspaceDeltaHasTurnChanges(delta) {
|
|
277
|
-
return delta.newFilesByTurn.length > 0
|
|
278
|
-
|
|
279
|
-
|
|
291
|
+
return (delta.newFilesByTurn.length > 0 ||
|
|
292
|
+
delta.changedByTurn.length > 0 ||
|
|
293
|
+
delta.resolvedByTurn.length > 0);
|
|
280
294
|
}
|
|
281
295
|
function formatFailureRecoveryNotice(turnId, delta, checkpointIds) {
|
|
282
|
-
const files = compactPathList([
|
|
283
|
-
|
|
284
|
-
...delta.changedByTurn,
|
|
285
|
-
...delta.resolvedByTurn,
|
|
286
|
-
], 8);
|
|
287
|
-
const fileText = files.length > 0
|
|
288
|
-
? files.join(', ')
|
|
289
|
-
: 'workspace changes recorded';
|
|
296
|
+
const files = compactPathList([...delta.newFilesByTurn, ...delta.changedByTurn, ...delta.resolvedByTurn], 8);
|
|
297
|
+
const fileText = files.length > 0 ? files.join(', ') : 'workspace changes recorded';
|
|
290
298
|
const checkpointText = checkpointIds.length > 0
|
|
291
299
|
? ` Checkpoints: ${checkpointIds.join(', ')}. Preview rollback with /checkpoint restore <id>; restore each listed checkpoint if multiple.`
|
|
292
300
|
: '';
|
|
@@ -347,15 +355,17 @@ function withVerificationLoopStats(stats, summary) {
|
|
|
347
355
|
verificationPassedCommands: compactVerificationCommands(summary.passedCommands),
|
|
348
356
|
verificationFailedCommands: compactVerificationCommands(summary.failedCommands),
|
|
349
357
|
verificationMissingCommands: compactVerificationCommands(summary.missingCommands),
|
|
350
|
-
verificationSkippedReason: summary.skippedReason
|
|
358
|
+
verificationSkippedReason: summary.skippedReason
|
|
359
|
+
? (0, session_storage_1.redactTraceText)(summary.skippedReason)
|
|
360
|
+
: undefined,
|
|
351
361
|
};
|
|
352
362
|
}
|
|
353
363
|
function shouldRecordVerificationLoopStats(profile, summary) {
|
|
354
|
-
return profile.changedFiles.length > 0
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
364
|
+
return (profile.changedFiles.length > 0 ||
|
|
365
|
+
summary.commandsRun.length > 0 ||
|
|
366
|
+
summary.passedCommands.length > 0 ||
|
|
367
|
+
summary.failedCommands.length > 0 ||
|
|
368
|
+
summary.missingCommands.length > 0);
|
|
359
369
|
}
|
|
360
370
|
function appendPostWorkspaceTrace(events, sessionId, turnId, cwd, before, verificationResults = []) {
|
|
361
371
|
const postWorkspace = (0, workspace_state_1.captureWorkspaceSnapshot)(cwd);
|
|
@@ -450,11 +460,43 @@ function toolStartContent(event) {
|
|
|
450
460
|
function toolFinishContent(event) {
|
|
451
461
|
return (0, ui_view_model_1.formatToolActivityTranscript)((0, ui_view_model_1.toolActivityFromFinished)(event, compactToolArgs(event.args, TOOL_TRANSCRIPT_ARG_BUDGET)));
|
|
452
462
|
}
|
|
463
|
+
function structuredToolStartActivity(event, seq) {
|
|
464
|
+
const command = event.name === 'exec_command' && typeof event.args.command === 'string'
|
|
465
|
+
? event.args.command
|
|
466
|
+
: undefined;
|
|
467
|
+
return {
|
|
468
|
+
state: 'running',
|
|
469
|
+
name: event.name,
|
|
470
|
+
detail: command ? '' : compactToolArgs(event.args, TOOL_TRANSCRIPT_ARG_BUDGET),
|
|
471
|
+
command,
|
|
472
|
+
body: '',
|
|
473
|
+
seq,
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function structuredToolFinishActivity(event, seq) {
|
|
477
|
+
const modelVisible = (0, tool_serializer_1.parseToolResultEnvelope)(event.modelVisibleResult);
|
|
478
|
+
const command = event.name === 'exec_command' && typeof event.args.command === 'string'
|
|
479
|
+
? event.args.command
|
|
480
|
+
: undefined;
|
|
481
|
+
return {
|
|
482
|
+
state: event.success ? 'success' : 'error',
|
|
483
|
+
name: event.name,
|
|
484
|
+
detail: command ? '' : compactToolArgs(event.args, TOOL_TRANSCRIPT_ARG_BUDGET),
|
|
485
|
+
command,
|
|
486
|
+
duration: `${event.duration}ms`,
|
|
487
|
+
summary: event.summary?.split(/\r?\n/u, 1)[0],
|
|
488
|
+
outputBytes: event.outputBytes,
|
|
489
|
+
body: modelVisible.output,
|
|
490
|
+
error: event.error,
|
|
491
|
+
seq,
|
|
492
|
+
artifactHint: event.artifactRef ? `/artifacts show ${event.artifactRef.id} --full` : undefined,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
453
495
|
function isSyntheticCompactContext(content) {
|
|
454
|
-
return content.startsWith('[OpenHorse Context State v2]')
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
496
|
+
return (content.startsWith('[OpenHorse Context State v2]') ||
|
|
497
|
+
content.startsWith('[Context Summary]') ||
|
|
498
|
+
content.startsWith('I will continue from this OpenHorse Context State') ||
|
|
499
|
+
content.startsWith('I understand the context. I will continue the conversation with this background information.'));
|
|
458
500
|
}
|
|
459
501
|
function sessionToolCallSummaries(message) {
|
|
460
502
|
return (message.tool_calls ?? []).map(call => {
|
|
@@ -505,13 +547,12 @@ function sessionToolResultSummary(message, toolCallsById) {
|
|
|
505
547
|
const args = parseToolCallArgs(call.function.arguments);
|
|
506
548
|
const detail = compactToolArgs(args);
|
|
507
549
|
const parsed = parseSessionToolResult(message.content);
|
|
508
|
-
const firstLine = parsed.summary ||
|
|
550
|
+
const firstLine = parsed.summary ||
|
|
551
|
+
`${parsed.success ? '✓' : '✗'} ${call.function.name}${detail ? ` ${detail}` : ''}`;
|
|
509
552
|
return parsed.error ? `${firstLine}\nError: ${parsed.error}` : firstLine;
|
|
510
553
|
}
|
|
511
554
|
function sessionMessagesToTranscriptEntries(sessionId) {
|
|
512
|
-
const
|
|
513
|
-
const displayStartTime = session?.transcriptDisplayStartTime;
|
|
514
|
-
const messages = (0, session_storage_1.readSessionMessages)(sessionId).filter(message => typeof displayStartTime !== 'number' || (message.timestamp ?? 0) >= displayStartTime);
|
|
555
|
+
const messages = (0, session_storage_1.loadSessionTranscriptMessages)(sessionId);
|
|
515
556
|
const entries = [];
|
|
516
557
|
const toolCallsById = new Map();
|
|
517
558
|
const completedToolCallIds = new Set();
|
|
@@ -532,12 +573,16 @@ function sessionMessagesToTranscriptEntries(sessionId) {
|
|
|
532
573
|
return;
|
|
533
574
|
}
|
|
534
575
|
if (message.role === 'assistant') {
|
|
535
|
-
if (message.content
|
|
576
|
+
if (message.content?.trim()) {
|
|
536
577
|
entries.push({ id: `${idBase}-assistant`, role: 'assistant', content: message.content });
|
|
537
578
|
}
|
|
538
579
|
for (const summary of sessionToolCallSummaries(message)) {
|
|
539
580
|
if (!completedToolCallIds.has(summary.id)) {
|
|
540
|
-
entries.push({
|
|
581
|
+
entries.push({
|
|
582
|
+
id: `${idBase}-tool-call-${entries.length}`,
|
|
583
|
+
role: 'tool',
|
|
584
|
+
content: summary.content,
|
|
585
|
+
});
|
|
541
586
|
}
|
|
542
587
|
}
|
|
543
588
|
return;
|
|
@@ -547,7 +592,10 @@ function sessionMessagesToTranscriptEntries(sessionId) {
|
|
|
547
592
|
entries.push({
|
|
548
593
|
id: `${idBase}-tool`,
|
|
549
594
|
role: 'tool',
|
|
550
|
-
content: summary ??
|
|
595
|
+
content: summary ??
|
|
596
|
+
(message.toolCallId
|
|
597
|
+
? `Tool result ${message.toolCallId}\n${message.content}`
|
|
598
|
+
: message.content),
|
|
551
599
|
});
|
|
552
600
|
return;
|
|
553
601
|
}
|
|
@@ -632,19 +680,27 @@ function parseLocalFastPath(input) {
|
|
|
632
680
|
}
|
|
633
681
|
const readMatch = /^(?:read|读取)\s+(.+)$/i.exec(text);
|
|
634
682
|
const readTarget = readMatch?.[1]?.trim();
|
|
635
|
-
const looksLikePath = Boolean(readTarget)
|
|
636
|
-
|
|
637
|
-
|
|
683
|
+
const looksLikePath = Boolean(readTarget) &&
|
|
684
|
+
!/\s/.test(readTarget) &&
|
|
685
|
+
(/[/\\.]/.test(readTarget) || readTarget.startsWith('~'));
|
|
638
686
|
if (readTarget && looksLikePath) {
|
|
639
687
|
return { tool: 'read_file', args: { path: readTarget }, label: `read ${readTarget}` };
|
|
640
688
|
}
|
|
641
689
|
const grepMatch = /^(?:grep|搜索)\s+(.+)$/i.exec(text);
|
|
642
690
|
if (grepMatch?.[1]?.trim()) {
|
|
643
|
-
return {
|
|
691
|
+
return {
|
|
692
|
+
tool: 'grep',
|
|
693
|
+
args: { pattern: grepMatch[1].trim() },
|
|
694
|
+
label: `grep ${grepMatch[1].trim()}`,
|
|
695
|
+
};
|
|
644
696
|
}
|
|
645
697
|
const runTestMatch = /^(?:run\s+test|运行测试)\s*[::]\s*(.+)$/i.exec(text);
|
|
646
698
|
if (runTestMatch?.[1]?.trim()) {
|
|
647
|
-
return {
|
|
699
|
+
return {
|
|
700
|
+
tool: 'exec_command',
|
|
701
|
+
args: { command: runTestMatch[1].trim() },
|
|
702
|
+
label: `run test: ${runTestMatch[1].trim()}`,
|
|
703
|
+
};
|
|
648
704
|
}
|
|
649
705
|
return null;
|
|
650
706
|
}
|
|
@@ -692,12 +748,7 @@ function createToolEventPresenter(events) {
|
|
|
692
748
|
role: 'tool',
|
|
693
749
|
title: 'tool',
|
|
694
750
|
content: toolStartContent(event),
|
|
695
|
-
toolActivity:
|
|
696
|
-
state: 'running',
|
|
697
|
-
name: event.name,
|
|
698
|
-
detail: '',
|
|
699
|
-
seq,
|
|
700
|
-
},
|
|
751
|
+
toolActivity: structuredToolStartActivity(event, seq),
|
|
701
752
|
});
|
|
702
753
|
runningToolEntries.set(event.callId, {
|
|
703
754
|
entryId,
|
|
@@ -720,15 +771,7 @@ function createToolEventPresenter(events) {
|
|
|
720
771
|
const content = toolFinishContent(event);
|
|
721
772
|
const stored = runningToolEntries.get(event.callId);
|
|
722
773
|
const seq = stored?.sequence ?? ++toolSequenceCounter;
|
|
723
|
-
const
|
|
724
|
-
const toolActivity = {
|
|
725
|
-
state,
|
|
726
|
-
name: event.name,
|
|
727
|
-
detail: '',
|
|
728
|
-
duration: `${event.duration}ms`,
|
|
729
|
-
error: event.error,
|
|
730
|
-
seq,
|
|
731
|
-
};
|
|
774
|
+
const toolActivity = structuredToolFinishActivity(event, seq);
|
|
732
775
|
if (stored) {
|
|
733
776
|
events.finalize(stored.entryId, {
|
|
734
777
|
role: event.success ? 'tool' : 'error',
|
|
@@ -772,6 +815,7 @@ function createToolEventPresenter(events) {
|
|
|
772
815
|
state: 'skipped',
|
|
773
816
|
name: entry.name,
|
|
774
817
|
detail: '',
|
|
818
|
+
body: '',
|
|
775
819
|
error: reason,
|
|
776
820
|
seq: entry.sequence,
|
|
777
821
|
},
|
|
@@ -799,7 +843,7 @@ async function captureConsoleOutput(fn) {
|
|
|
799
843
|
const originalError = console.error;
|
|
800
844
|
const originalWarn = console.warn;
|
|
801
845
|
const capture = (...args) => {
|
|
802
|
-
lines.push(stripAnsi(args.map(arg => typeof arg === 'string' ? arg : JSON.stringify(arg)).join(' ')));
|
|
846
|
+
lines.push(stripAnsi(args.map(arg => (typeof arg === 'string' ? arg : JSON.stringify(arg))).join(' ')));
|
|
803
847
|
};
|
|
804
848
|
console.log = capture;
|
|
805
849
|
console.error = capture;
|
|
@@ -849,7 +893,7 @@ class AgentChatController {
|
|
|
849
893
|
}
|
|
850
894
|
const command = (0, commands_1.findCommand)(parsed.name);
|
|
851
895
|
if (!command) {
|
|
852
|
-
if ((0, skills_1.hasMatchingSkill)(text)) {
|
|
896
|
+
if ((0, skills_1.hasMatchingSkill)(text, this.runtime.cwd)) {
|
|
853
897
|
await this.runChat(text, options);
|
|
854
898
|
return;
|
|
855
899
|
}
|
|
@@ -901,7 +945,9 @@ class AgentChatController {
|
|
|
901
945
|
}
|
|
902
946
|
}
|
|
903
947
|
async runLocalFastPath(input, action, options = {}) {
|
|
904
|
-
const activeSession = this.runtime.getSession() ??
|
|
948
|
+
const activeSession = this.runtime.getSession() ??
|
|
949
|
+
this.runtime.ensureSession() ??
|
|
950
|
+
(0, session_storage_1.loadSessionMeta)(this.runtime.getSession()?.id ?? '');
|
|
905
951
|
const sessionId = activeSession?.id;
|
|
906
952
|
const turnId = traceTurnId(options.turnId);
|
|
907
953
|
const localCallId = `local-${turnId}`;
|
|
@@ -980,23 +1026,25 @@ class AgentChatController {
|
|
|
980
1026
|
modelVisibleToolBytes: 0,
|
|
981
1027
|
summarizedBytes: outputBytes,
|
|
982
1028
|
});
|
|
1029
|
+
const localToolResultEvent = {
|
|
1030
|
+
type: 'tool_result',
|
|
1031
|
+
name: action.tool,
|
|
1032
|
+
args: action.args,
|
|
1033
|
+
callId: localCallId,
|
|
1034
|
+
result,
|
|
1035
|
+
modelVisibleResult: result,
|
|
1036
|
+
duration,
|
|
1037
|
+
success: envelope.success,
|
|
1038
|
+
error: envelope.error,
|
|
1039
|
+
summary: envelope.summary,
|
|
1040
|
+
outputBytes,
|
|
1041
|
+
artifactRef: formattedLocalResult.artifactRef,
|
|
1042
|
+
};
|
|
983
1043
|
this.events.append({
|
|
984
1044
|
role: envelope.success ? 'tool' : 'error',
|
|
985
1045
|
title: 'local',
|
|
986
|
-
content: toolFinishContent(
|
|
987
|
-
|
|
988
|
-
name: action.tool,
|
|
989
|
-
args: action.args,
|
|
990
|
-
callId: localCallId,
|
|
991
|
-
result,
|
|
992
|
-
modelVisibleResult: result,
|
|
993
|
-
duration,
|
|
994
|
-
success: envelope.success,
|
|
995
|
-
error: envelope.error,
|
|
996
|
-
summary: envelope.summary,
|
|
997
|
-
outputBytes,
|
|
998
|
-
artifactRef: formattedLocalResult.artifactRef,
|
|
999
|
-
}),
|
|
1046
|
+
content: toolFinishContent(localToolResultEvent),
|
|
1047
|
+
toolActivity: structuredToolFinishActivity(localToolResultEvent, 1),
|
|
1000
1048
|
});
|
|
1001
1049
|
this.runtime.store.addMessage({ role: 'assistant', content: assistantContent });
|
|
1002
1050
|
this.setLoopStats(stats);
|
|
@@ -1082,6 +1130,7 @@ class AgentChatController {
|
|
|
1082
1130
|
config: this.runtime.config,
|
|
1083
1131
|
store: this.runtime.store,
|
|
1084
1132
|
llm: this.runtime.llm,
|
|
1133
|
+
compactCoordinator: this.runtime.compactCoordinator,
|
|
1085
1134
|
runtime: this.runtime.runtime,
|
|
1086
1135
|
sessionId: this.runtime.getSession()?.id,
|
|
1087
1136
|
turnId,
|
|
@@ -1109,9 +1158,86 @@ class AgentChatController {
|
|
|
1109
1158
|
uiCapabilities: (0, ui_events_1.resolveUiRendererCapabilities)(this.controllerOptions.uiCapabilities, this.controllerOptions.uiRenderer ?? this.runtime.config.ui?.renderer),
|
|
1110
1159
|
};
|
|
1111
1160
|
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Forward a subagent lifecycle event to the runtime event sink and session
|
|
1163
|
+
* trace. Renderers consume the same event across terminal/Ink/TUI; this is
|
|
1164
|
+
* the only place a subtask event touches the root loop.
|
|
1165
|
+
*/
|
|
1166
|
+
handleSubtaskEvent(event, sessionId, turnId) {
|
|
1167
|
+
// Emit the renderer-independent runtime event first so all renderers
|
|
1168
|
+
// (terminal/Ink/TUI) consume the same lifecycle through one protocol.
|
|
1169
|
+
this.events.subtaskEvent?.(event);
|
|
1170
|
+
const stateToTraceType = {
|
|
1171
|
+
queued: 'subtask_requested',
|
|
1172
|
+
running: 'subtask_started',
|
|
1173
|
+
completed: 'subtask_completed',
|
|
1174
|
+
failed: 'subtask_failed',
|
|
1175
|
+
cancelled: 'subtask_cancelled',
|
|
1176
|
+
rejected: 'subtask_rejected',
|
|
1177
|
+
timed_out: 'subtask_timed_out',
|
|
1178
|
+
};
|
|
1179
|
+
if (sessionId) {
|
|
1180
|
+
const traceType = stateToTraceType[event.state];
|
|
1181
|
+
if (traceType) {
|
|
1182
|
+
recordTraceEvent(this.events, sessionId, {
|
|
1183
|
+
turnId: String(turnId),
|
|
1184
|
+
type: traceType,
|
|
1185
|
+
name: `${event.role}:${event.taskId}`,
|
|
1186
|
+
argsSummary: event.objective.slice(0, 160),
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
// Surface start/complete/fail/cancel summaries in the transcript so all
|
|
1191
|
+
// renderers show subtask progress without renderer-local logic.
|
|
1192
|
+
if (event.state === 'running') {
|
|
1193
|
+
this.events.append({
|
|
1194
|
+
role: 'system',
|
|
1195
|
+
content: `▸ subtask ${event.role} started: ${event.objective.slice(0, 120)}`,
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
else if (event.state === 'completed' ||
|
|
1199
|
+
event.state === 'failed' ||
|
|
1200
|
+
event.state === 'cancelled' ||
|
|
1201
|
+
event.state === 'timed_out' ||
|
|
1202
|
+
event.state === 'rejected') {
|
|
1203
|
+
const summary = event.summary ? ` — ${event.summary.slice(0, 200)}` : '';
|
|
1204
|
+
this.events.append({
|
|
1205
|
+
role: 'system',
|
|
1206
|
+
content: `◂ subtask ${event.role} ${event.state}${summary}`,
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Fold reconciled child aggregate usage into the root turn's loop stats so
|
|
1212
|
+
* `/cost` and loop-budget accounting reflect subagent cost. Child model
|
|
1213
|
+
* requests and tool calls are added to the root counters; a note records the
|
|
1214
|
+
* subagent contribution so it is distinguishable from root work.
|
|
1215
|
+
*/
|
|
1216
|
+
foldSubagentUsage(stats, bundle) {
|
|
1217
|
+
if (!bundle)
|
|
1218
|
+
return stats;
|
|
1219
|
+
const usage = bundle.getAggregateUsage();
|
|
1220
|
+
if (usage.modelRequests === 0 && usage.toolCalls === 0)
|
|
1221
|
+
return stats;
|
|
1222
|
+
const subtaskCount = bundle.getSubtaskCount();
|
|
1223
|
+
const subagentSuffix = `subagents: ${usage.modelRequests} req/${usage.toolCalls} calls across ${subtaskCount} task(s)`;
|
|
1224
|
+
return {
|
|
1225
|
+
...stats,
|
|
1226
|
+
llmRequests: (stats.llmRequests ?? 0) + usage.modelRequests,
|
|
1227
|
+
toolCalls: (stats.toolCalls ?? 0) + usage.toolCalls,
|
|
1228
|
+
readOnlyToolCalls: (stats.readOnlyToolCalls ?? 0) + usage.toolCalls,
|
|
1229
|
+
continuationHint: stats.continuationHint
|
|
1230
|
+
? `${stats.continuationHint} (${subagentSuffix})`
|
|
1231
|
+
: subagentSuffix,
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1112
1234
|
async runChat(input, options = {}) {
|
|
1113
1235
|
if (!input) {
|
|
1114
|
-
this.events.append({
|
|
1236
|
+
this.events.append({
|
|
1237
|
+
role: 'error',
|
|
1238
|
+
content: 'Usage: /chat <message>',
|
|
1239
|
+
errorLayer: 'runtime',
|
|
1240
|
+
});
|
|
1115
1241
|
return;
|
|
1116
1242
|
}
|
|
1117
1243
|
if (!this.runtime.llm || !(0, config_1.isConfigured)(this.runtime.config)) {
|
|
@@ -1124,7 +1250,9 @@ class AgentChatController {
|
|
|
1124
1250
|
}
|
|
1125
1251
|
const abortSignal = options.abortSignal;
|
|
1126
1252
|
const turnId = traceTurnId(options.turnId);
|
|
1127
|
-
const activeSession = this.runtime.getSession() ??
|
|
1253
|
+
const activeSession = this.runtime.getSession() ??
|
|
1254
|
+
this.runtime.ensureSession() ??
|
|
1255
|
+
(0, session_storage_1.loadSessionMeta)(this.runtime.getSession()?.id ?? '');
|
|
1128
1256
|
const sessionId = activeSession?.id;
|
|
1129
1257
|
const preWorkspace = (0, workspace_state_1.captureWorkspaceSnapshot)(this.runtime.cwd);
|
|
1130
1258
|
const runtimeTools = (0, tools_1.getRuntimeTools)();
|
|
@@ -1167,14 +1295,67 @@ class AgentChatController {
|
|
|
1167
1295
|
const intent = harness.updateContractFromUserInput(input);
|
|
1168
1296
|
harness.recordAppliedSkills(skillResolution.skills);
|
|
1169
1297
|
// Reconcile diagnostic: when harness state is present but objective may be incomplete
|
|
1170
|
-
if (snapshot.harnessState &&
|
|
1298
|
+
if (snapshot.harnessState &&
|
|
1299
|
+
!snapshot.harnessState.rootObjective &&
|
|
1300
|
+
!snapshot.harnessState.contract?.objective) {
|
|
1171
1301
|
this.events.setStatus('Resume diagnostic: harness state restored but objective may be incomplete. Run /harness explain to review.');
|
|
1172
1302
|
}
|
|
1303
|
+
const subagentConfig = this.runtime.config.subagents;
|
|
1304
|
+
// The subtask capability is a root-level tool. It is exposed on normal
|
|
1305
|
+
// turns, but respects an active skill scope: when a skill restricts the
|
|
1306
|
+
// tool set, subtask is not appended (the skill owns the scope).
|
|
1307
|
+
const projectPath = activeSession?.projectPath;
|
|
1308
|
+
const subagentBundle = subagentConfig &&
|
|
1309
|
+
subagentConfig.mode !== 'off' &&
|
|
1310
|
+
this.runtime.llm &&
|
|
1311
|
+
!skillResolution.toolScopeActive
|
|
1312
|
+
? (0, subagents_1.createSubagentBundleForTurn)({
|
|
1313
|
+
config: subagentConfig,
|
|
1314
|
+
cwd: this.runtime.cwd,
|
|
1315
|
+
rootLlmConfig: (0, subagents_1.deriveRootLlmConfig)(this.runtime.config),
|
|
1316
|
+
modelLabel: this.runtime.llm.getModel(),
|
|
1317
|
+
rootObjectiveSummary: harness.toJSON()?.rootObjective ?? input,
|
|
1318
|
+
abortSignal,
|
|
1319
|
+
onSubtaskEvent: event => {
|
|
1320
|
+
this.handleSubtaskEvent(event, sessionId, turnId);
|
|
1321
|
+
},
|
|
1322
|
+
onSubtaskResult: (result, _batchId) => {
|
|
1323
|
+
if (!projectPath || result.status !== 'completed')
|
|
1324
|
+
return;
|
|
1325
|
+
const json = JSON.stringify(result);
|
|
1326
|
+
const artifact = (0, tool_artifacts_1.storeArtifact)(projectPath, `subtask_${result.role}`, json, Buffer.byteLength(json, 'utf8'));
|
|
1327
|
+
if (artifact) {
|
|
1328
|
+
// Record a trace event for artifact discoverability only.
|
|
1329
|
+
// The subtask state transition (subtask_completed) is already
|
|
1330
|
+
// emitted by handleSubtaskEvent above.
|
|
1331
|
+
if (sessionId) {
|
|
1332
|
+
recordTraceEvent(this.events, sessionId, {
|
|
1333
|
+
turnId: String(turnId),
|
|
1334
|
+
type: 'subtask_artifact_stored',
|
|
1335
|
+
name: `${result.role}:${result.id}`,
|
|
1336
|
+
argsSummary: result.summary.slice(0, 200),
|
|
1337
|
+
argsArtifactId: artifact.id,
|
|
1338
|
+
argsBytes: artifact.outputBytes,
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
},
|
|
1343
|
+
// R6: wire live permission state so the subagent policy gate can
|
|
1344
|
+
// prevent background delegation while the user is deciding a tool
|
|
1345
|
+
// permission. Injected by AgentRuntimeController via chatOptions.
|
|
1346
|
+
hasPendingPermission: this.controllerOptions.hasPendingPermission,
|
|
1347
|
+
// R6: wire child usage callback so CostTracker records subagent
|
|
1348
|
+
// token consumption. Injected by AgentRuntimeController via chatOptions.
|
|
1349
|
+
onChildUsage: this.controllerOptions.onChildUsage,
|
|
1350
|
+
})
|
|
1351
|
+
: null;
|
|
1352
|
+
const subtaskTool = subagentBundle?.tool ?? null;
|
|
1353
|
+
const turnTools = subtaskTool ? [...skillResolution.tools, subtaskTool] : skillResolution.tools;
|
|
1173
1354
|
const promptCtx = {
|
|
1174
1355
|
cwd: this.runtime.cwd,
|
|
1175
1356
|
platform: process.platform,
|
|
1176
1357
|
nodeVersion: process.version,
|
|
1177
|
-
tools:
|
|
1358
|
+
tools: turnTools,
|
|
1178
1359
|
memoryContent: snapshot.memoryContent,
|
|
1179
1360
|
skillsContent: snapshot.skillsContent,
|
|
1180
1361
|
projectInstructionsContent: snapshot.projectInstructionsContent,
|
|
@@ -1192,6 +1373,7 @@ class AgentChatController {
|
|
|
1192
1373
|
let finalModel = '';
|
|
1193
1374
|
let pendingCompleteTrace = null;
|
|
1194
1375
|
let pendingCompleteStats;
|
|
1376
|
+
let pendingCompact;
|
|
1195
1377
|
const verificationResults = [];
|
|
1196
1378
|
const sessionMessagesToRecord = [];
|
|
1197
1379
|
const assistantStream = createAssistantStreamPresenter(this.events, abortSignal);
|
|
@@ -1204,7 +1386,19 @@ class AgentChatController {
|
|
|
1204
1386
|
},
|
|
1205
1387
|
};
|
|
1206
1388
|
const toolExecutor = async (name, args, signal) => {
|
|
1207
|
-
|
|
1389
|
+
// The runtime-bound `subtask` tool is not in the global TOOLS registry;
|
|
1390
|
+
// dispatch it directly so it reaches the Supervisor closure.
|
|
1391
|
+
if (name === 'subtask' && subtaskTool) {
|
|
1392
|
+
const result = await subtaskTool.execute(args, {
|
|
1393
|
+
cwd: this.runtime.cwd,
|
|
1394
|
+
config: { name: this.runtime.config.name, mode: this.runtime.config.mode },
|
|
1395
|
+
abortSignal: signal,
|
|
1396
|
+
sessionId,
|
|
1397
|
+
turnId,
|
|
1398
|
+
});
|
|
1399
|
+
return JSON.stringify(result);
|
|
1400
|
+
}
|
|
1401
|
+
if (!turnTools.some(tool => tool.name === name)) {
|
|
1208
1402
|
return JSON.stringify({
|
|
1209
1403
|
success: false,
|
|
1210
1404
|
error: skillResolution.toolScopeActive
|
|
@@ -1233,7 +1427,7 @@ class AgentChatController {
|
|
|
1233
1427
|
try {
|
|
1234
1428
|
for await (const event of (0, framework_1.query)({
|
|
1235
1429
|
messages,
|
|
1236
|
-
tools:
|
|
1430
|
+
tools: turnTools,
|
|
1237
1431
|
toolExecutor,
|
|
1238
1432
|
llm: this.runtime.llm,
|
|
1239
1433
|
streamCallbacks,
|
|
@@ -1254,6 +1448,10 @@ class AgentChatController {
|
|
|
1254
1448
|
harness,
|
|
1255
1449
|
input,
|
|
1256
1450
|
loopBudget,
|
|
1451
|
+
onContextUsage: usage => {
|
|
1452
|
+
this.runtime.store.setContextUsage(usage);
|
|
1453
|
+
},
|
|
1454
|
+
compactCoordinator: this.runtime.compactCoordinator,
|
|
1257
1455
|
})) {
|
|
1258
1456
|
switch (event.type) {
|
|
1259
1457
|
case 'request_start':
|
|
@@ -1304,9 +1502,7 @@ class AgentChatController {
|
|
|
1304
1502
|
this.events.append({ role: 'status', content: suggestion });
|
|
1305
1503
|
}
|
|
1306
1504
|
}
|
|
1307
|
-
const checkpointId = checkpointSequence === 0
|
|
1308
|
-
? turnId
|
|
1309
|
-
: `${turnId}-checkpoint-${checkpointSequence + 1}`;
|
|
1505
|
+
const checkpointId = checkpointSequence === 0 ? turnId : `${turnId}-checkpoint-${checkpointSequence + 1}`;
|
|
1310
1506
|
const checkpointResult = createPreToolCheckpoint(this.events, sessionId, turnId, checkpointId, this.runtime.cwd, event.toolCalls);
|
|
1311
1507
|
if (checkpointResult.created) {
|
|
1312
1508
|
checkpointIds.push(checkpointId);
|
|
@@ -1316,6 +1512,7 @@ class AgentChatController {
|
|
|
1316
1512
|
this.events.append({
|
|
1317
1513
|
role: 'status',
|
|
1318
1514
|
title: 'checkpoint',
|
|
1515
|
+
statusTone: 'warning',
|
|
1319
1516
|
content: `Risky edit: ${checkpointResult.targetCount} files in one turn. Checkpoint ${checkpointId} created for rollback (/checkpoints restore ${checkpointId}).`,
|
|
1320
1517
|
});
|
|
1321
1518
|
}
|
|
@@ -1323,6 +1520,7 @@ class AgentChatController {
|
|
|
1323
1520
|
this.events.append({
|
|
1324
1521
|
role: 'status',
|
|
1325
1522
|
title: 'checkpoint',
|
|
1523
|
+
statusTone: 'warning',
|
|
1326
1524
|
content: `Risky edit: ${checkpointResult.targetCount} files in one turn, but checkpoint creation failed. Restore any pre-existing checkpoint manually or revert via git.`,
|
|
1327
1525
|
});
|
|
1328
1526
|
}
|
|
@@ -1476,6 +1674,7 @@ class AgentChatController {
|
|
|
1476
1674
|
finalContent = event.content;
|
|
1477
1675
|
finalUsage = event.usage;
|
|
1478
1676
|
finalModel = event.model;
|
|
1677
|
+
pendingCompact = event.compact;
|
|
1479
1678
|
if (event.stats) {
|
|
1480
1679
|
pendingCompleteStats = event.stats;
|
|
1481
1680
|
recordProviderTraceEvents(this.events, sessionId, turnId, event.stats);
|
|
@@ -1532,11 +1731,17 @@ class AgentChatController {
|
|
|
1532
1731
|
this.events.append({
|
|
1533
1732
|
role: 'status',
|
|
1534
1733
|
title: 'recovery',
|
|
1734
|
+
statusTone: 'warning',
|
|
1535
1735
|
content: recoveryNotice,
|
|
1536
1736
|
});
|
|
1537
1737
|
}
|
|
1538
1738
|
(0, session_storage_1.removeLastIncompleteAssistantMessage)(sessionId);
|
|
1539
1739
|
}
|
|
1740
|
+
// Persist any accumulated session messages before returning,
|
|
1741
|
+
// so tool results from the interrupted turn are not lost.
|
|
1742
|
+
if (sessionId && sessionMessagesToRecord.length > 0) {
|
|
1743
|
+
(0, session_storage_1.appendSessionMessages)(sessionId, sessionMessagesToRecord);
|
|
1744
|
+
}
|
|
1540
1745
|
return;
|
|
1541
1746
|
}
|
|
1542
1747
|
assistantStream.closeSegment();
|
|
@@ -1559,6 +1764,7 @@ class AgentChatController {
|
|
|
1559
1764
|
this.events.append({
|
|
1560
1765
|
role: 'status',
|
|
1561
1766
|
title: 'verification',
|
|
1767
|
+
statusTone: 'warning',
|
|
1562
1768
|
content: notice,
|
|
1563
1769
|
});
|
|
1564
1770
|
finalContent = finalContent ? `${finalContent}\n\n${notice}` : notice;
|
|
@@ -1603,12 +1809,17 @@ class AgentChatController {
|
|
|
1603
1809
|
lines.push(`Next: ${stats.continuationHint}`);
|
|
1604
1810
|
}
|
|
1605
1811
|
const notice = lines.join('\n');
|
|
1606
|
-
this.events.append({
|
|
1812
|
+
this.events.append({
|
|
1813
|
+
role: 'status',
|
|
1814
|
+
title: 'budget',
|
|
1815
|
+
statusTone: 'warning',
|
|
1816
|
+
content: notice,
|
|
1817
|
+
});
|
|
1607
1818
|
finalContent = finalContent ? `${finalContent}\n\n${notice}` : notice;
|
|
1608
1819
|
appendAssistantNotice(sessionMessagesToRecord, notice);
|
|
1609
1820
|
}
|
|
1610
1821
|
if (pendingCompleteStats) {
|
|
1611
|
-
this.setLoopStats(pendingCompleteStats);
|
|
1822
|
+
this.setLoopStats(this.foldSubagentUsage(pendingCompleteStats, subagentBundle));
|
|
1612
1823
|
}
|
|
1613
1824
|
if (finalContent) {
|
|
1614
1825
|
this.runtime.store.addMessage({ role: 'assistant', content: finalContent });
|
|
@@ -1616,7 +1827,74 @@ class AgentChatController {
|
|
|
1616
1827
|
if (sessionId && sessionMessagesToRecord.length > 0) {
|
|
1617
1828
|
(0, session_storage_1.appendSessionMessages)(sessionId, sessionMessagesToRecord);
|
|
1618
1829
|
}
|
|
1830
|
+
if (pendingCompact) {
|
|
1831
|
+
try {
|
|
1832
|
+
let committedCheckpointId;
|
|
1833
|
+
if (sessionId) {
|
|
1834
|
+
const sourceMessageCount = (0, session_storage_1.readSessionMessages)(sessionId).length;
|
|
1835
|
+
const checkpoint = (0, session_storage_1.commitSessionCompactCheckpoint)({
|
|
1836
|
+
sessionId,
|
|
1837
|
+
mode: pendingCompact.mode,
|
|
1838
|
+
modelId: finalModel || this.runtime.llm.getModel(),
|
|
1839
|
+
sourceMessageCount,
|
|
1840
|
+
transcriptStartMessageIndex: Math.max(0, sourceMessageCount - 20),
|
|
1841
|
+
modelHistory: pendingCompact.modelHistory,
|
|
1842
|
+
summary: pendingCompact.summary,
|
|
1843
|
+
beforeUsage: pendingCompact.before,
|
|
1844
|
+
afterUsage: pendingCompact.after,
|
|
1845
|
+
});
|
|
1846
|
+
committedCheckpointId = checkpoint.checkpointId;
|
|
1847
|
+
this.runtime.store.setState({ conversationHistory: checkpoint.modelHistory });
|
|
1848
|
+
}
|
|
1849
|
+
else {
|
|
1850
|
+
this.runtime.store.setState({
|
|
1851
|
+
conversationHistory: pendingCompact.modelHistory.filter(message => message.role !== 'system'),
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
this.runtime.store.setContextUsage(pendingCompact.after);
|
|
1855
|
+
if (sessionId) {
|
|
1856
|
+
recordTraceEvent(this.events, sessionId, {
|
|
1857
|
+
turnId,
|
|
1858
|
+
type: 'compact_completed',
|
|
1859
|
+
checkpointId: committedCheckpointId,
|
|
1860
|
+
model: finalModel || this.runtime.llm.getModel(),
|
|
1861
|
+
note: pendingCompact.mode,
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
this.events.append({
|
|
1865
|
+
role: 'status',
|
|
1866
|
+
title: 'auto-compact',
|
|
1867
|
+
statusTone: 'neutral',
|
|
1868
|
+
content: `Context reached ${pendingCompact.before.percent}% of the safe input budget. Agent core committed a ${pendingCompact.mode} compact checkpoint; current context is ${pendingCompact.after.percent}%.`,
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
catch (error) {
|
|
1872
|
+
if (sessionId) {
|
|
1873
|
+
recordTraceEvent(this.events, sessionId, {
|
|
1874
|
+
turnId,
|
|
1875
|
+
type: 'compact_failed',
|
|
1876
|
+
model: finalModel || this.runtime.llm.getModel(),
|
|
1877
|
+
error: compactTraceError(error),
|
|
1878
|
+
note: pendingCompact.mode,
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
this.events.append({
|
|
1882
|
+
role: 'error',
|
|
1883
|
+
title: 'compact-failed',
|
|
1884
|
+
content: `Compact checkpoint failed; the previous model context remains active. ${error instanceof Error ? error.message : String(error)}`,
|
|
1885
|
+
errorLayer: 'runtime',
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1619
1889
|
if (finalUsage) {
|
|
1890
|
+
// Fold subagent token usage into /cost accounting.
|
|
1891
|
+
if (subagentBundle) {
|
|
1892
|
+
const subUsage = subagentBundle.getAggregateUsage();
|
|
1893
|
+
finalUsage = {
|
|
1894
|
+
promptTokens: finalUsage.promptTokens + subUsage.promptTokens,
|
|
1895
|
+
completionTokens: finalUsage.completionTokens + subUsage.completionTokens,
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1620
1898
|
this.runtime.store.setTokenUsage(finalUsage);
|
|
1621
1899
|
}
|
|
1622
1900
|
harness.ingestTurn({
|
|
@@ -1660,6 +1938,7 @@ class AgentChatController {
|
|
|
1660
1938
|
this.events.append({
|
|
1661
1939
|
role: 'status',
|
|
1662
1940
|
title: 'recovery',
|
|
1941
|
+
statusTone: 'warning',
|
|
1663
1942
|
content: recoveryNotice,
|
|
1664
1943
|
});
|
|
1665
1944
|
}
|
|
@@ -1668,7 +1947,11 @@ class AgentChatController {
|
|
|
1668
1947
|
return;
|
|
1669
1948
|
}
|
|
1670
1949
|
assistantStream.discardSegment();
|
|
1671
|
-
this.events.append({
|
|
1950
|
+
this.events.append({
|
|
1951
|
+
role: 'error',
|
|
1952
|
+
content: formatChatError(error),
|
|
1953
|
+
errorLayer: errorLayerForChatError(error),
|
|
1954
|
+
});
|
|
1672
1955
|
this.events.setStatus('Turn failed. Ready for the next input.');
|
|
1673
1956
|
const failedStats = error instanceof framework_1.QueryLoopError
|
|
1674
1957
|
? error.stats
|
|
@@ -1694,6 +1977,7 @@ class AgentChatController {
|
|
|
1694
1977
|
this.events.append({
|
|
1695
1978
|
role: 'status',
|
|
1696
1979
|
title: 'recovery',
|
|
1980
|
+
statusTone: 'warning',
|
|
1697
1981
|
content: recoveryNotice,
|
|
1698
1982
|
});
|
|
1699
1983
|
}
|
|
@@ -1736,7 +2020,9 @@ exports.InkChatController = AgentChatController;
|
|
|
1736
2020
|
function loadSessionIntoRuntime(runtime, sessionId) {
|
|
1737
2021
|
const history = (0, session_storage_1.loadSessionHistory)(sessionId);
|
|
1738
2022
|
runtime.store.setState({ conversationHistory: history });
|
|
1739
|
-
runtime.store.setState({
|
|
2023
|
+
runtime.store.setState({
|
|
2024
|
+
harnessState: (0, session_storage_1.loadSessionHarnessState)(sessionId) ?? (0, session_storage_1.loadSessionMeta)(sessionId)?.harnessState,
|
|
2025
|
+
});
|
|
1740
2026
|
return `Restored ${history.length} messages`;
|
|
1741
2027
|
}
|
|
1742
2028
|
function closeSession(runtime) {
|