@orion-agents/orion-code 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 +21 -0
- package/README.md +179 -0
- package/README.zh-CN.md +496 -0
- package/assets/orion-tui-icon.png +0 -0
- package/bin/orion +56 -0
- package/dist/agents/coder.d.ts +12 -0
- package/dist/agents/coder.d.ts.map +1 -0
- package/dist/agents/coder.js +48 -0
- package/dist/agents/coder.js.map +1 -0
- package/dist/agents/coordinator.d.ts +86 -0
- package/dist/agents/coordinator.d.ts.map +1 -0
- package/dist/agents/coordinator.js +251 -0
- package/dist/agents/coordinator.js.map +1 -0
- package/dist/agents/fork.d.ts +61 -0
- package/dist/agents/fork.d.ts.map +1 -0
- package/dist/agents/fork.js +168 -0
- package/dist/agents/fork.js.map +1 -0
- package/dist/agents/leader.d.ts +12 -0
- package/dist/agents/leader.d.ts.map +1 -0
- package/dist/agents/leader.js +49 -0
- package/dist/agents/leader.js.map +1 -0
- package/dist/agents/router.d.ts +59 -0
- package/dist/agents/router.d.ts.map +1 -0
- package/dist/agents/router.js +193 -0
- package/dist/agents/router.js.map +1 -0
- package/dist/agents/worker-pool.d.ts +72 -0
- package/dist/agents/worker-pool.d.ts.map +1 -0
- package/dist/agents/worker-pool.js +215 -0
- package/dist/agents/worker-pool.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +393 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/index.d.ts +15 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +3281 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/parser.d.ts +26 -0
- package/dist/commands/parser.d.ts.map +1 -0
- package/dist/commands/parser.js +66 -0
- package/dist/commands/parser.js.map +1 -0
- package/dist/commands/target-command.d.ts +21 -0
- package/dist/commands/target-command.d.ts.map +1 -0
- package/dist/commands/target-command.js +81 -0
- package/dist/commands/target-command.js.map +1 -0
- package/dist/commands/types.d.ts +96 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +32 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/core/agent.d.ts +84 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +58 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/brain.d.ts +50 -0
- package/dist/core/brain.d.ts.map +1 -0
- package/dist/core/brain.js +95 -0
- package/dist/core/brain.js.map +1 -0
- package/dist/core/checkpoint.d.ts +50 -0
- package/dist/core/checkpoint.d.ts.map +1 -0
- package/dist/core/checkpoint.js +284 -0
- package/dist/core/checkpoint.js.map +1 -0
- package/dist/core/cost-tracker.d.ts +147 -0
- package/dist/core/cost-tracker.d.ts.map +1 -0
- package/dist/core/cost-tracker.js +275 -0
- package/dist/core/cost-tracker.js.map +1 -0
- package/dist/core/security-warning.d.ts +59 -0
- package/dist/core/security-warning.d.ts.map +1 -0
- package/dist/core/security-warning.js +163 -0
- package/dist/core/security-warning.js.map +1 -0
- package/dist/core/strategy-tracker.d.ts +61 -0
- package/dist/core/strategy-tracker.d.ts.map +1 -0
- package/dist/core/strategy-tracker.js +124 -0
- package/dist/core/strategy-tracker.js.map +1 -0
- package/dist/core/tool-artifacts.d.ts +48 -0
- package/dist/core/tool-artifacts.d.ts.map +1 -0
- package/dist/core/tool-artifacts.js +216 -0
- package/dist/core/tool-artifacts.js.map +1 -0
- package/dist/core/warn-dedup.d.ts +39 -0
- package/dist/core/warn-dedup.d.ts.map +1 -0
- package/dist/core/warn-dedup.js +80 -0
- package/dist/core/warn-dedup.js.map +1 -0
- package/dist/framework/index.d.ts +25 -0
- package/dist/framework/index.d.ts.map +1 -0
- package/dist/framework/index.js +53 -0
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/prompt.d.ts +48 -0
- package/dist/framework/prompt.d.ts.map +1 -0
- package/dist/framework/prompt.js +174 -0
- package/dist/framework/prompt.js.map +1 -0
- package/dist/framework/query.d.ts +250 -0
- package/dist/framework/query.d.ts.map +1 -0
- package/dist/framework/query.js +870 -0
- package/dist/framework/query.js.map +1 -0
- package/dist/framework/store.d.ts +79 -0
- package/dist/framework/store.d.ts.map +1 -0
- package/dist/framework/store.js +92 -0
- package/dist/framework/store.js.map +1 -0
- package/dist/framework/tool-scheduler.d.ts +115 -0
- package/dist/framework/tool-scheduler.d.ts.map +1 -0
- package/dist/framework/tool-scheduler.js +285 -0
- package/dist/framework/tool-scheduler.js.map +1 -0
- package/dist/framework/tool-serializer.d.ts +21 -0
- package/dist/framework/tool-serializer.d.ts.map +1 -0
- package/dist/framework/tool-serializer.js +68 -0
- package/dist/framework/tool-serializer.js.map +1 -0
- package/dist/framework/tool-state.d.ts +39 -0
- package/dist/framework/tool-state.d.ts.map +1 -0
- package/dist/framework/tool-state.js +44 -0
- package/dist/framework/tool-state.js.map +1 -0
- package/dist/framework/tool.d.ts +110 -0
- package/dist/framework/tool.d.ts.map +1 -0
- package/dist/framework/tool.js +60 -0
- package/dist/framework/tool.js.map +1 -0
- package/dist/harness/assembler.d.ts +17 -0
- package/dist/harness/assembler.d.ts.map +1 -0
- package/dist/harness/assembler.js +206 -0
- package/dist/harness/assembler.js.map +1 -0
- package/dist/harness/capsule.d.ts +6 -0
- package/dist/harness/capsule.d.ts.map +1 -0
- package/dist/harness/capsule.js +192 -0
- package/dist/harness/capsule.js.map +1 -0
- package/dist/harness/context-harness.d.ts +81 -0
- package/dist/harness/context-harness.d.ts.map +1 -0
- package/dist/harness/context-harness.js +278 -0
- package/dist/harness/context-harness.js.map +1 -0
- package/dist/harness/contract.d.ts +6 -0
- package/dist/harness/contract.d.ts.map +1 -0
- package/dist/harness/contract.js +130 -0
- package/dist/harness/contract.js.map +1 -0
- package/dist/harness/drift-guard.d.ts +12 -0
- package/dist/harness/drift-guard.d.ts.map +1 -0
- package/dist/harness/drift-guard.js +50 -0
- package/dist/harness/drift-guard.js.map +1 -0
- package/dist/harness/evidence.d.ts +20 -0
- package/dist/harness/evidence.d.ts.map +1 -0
- package/dist/harness/evidence.js +195 -0
- package/dist/harness/evidence.js.map +1 -0
- package/dist/harness/harness.d.ts +58 -0
- package/dist/harness/harness.d.ts.map +1 -0
- package/dist/harness/harness.js +195 -0
- package/dist/harness/harness.js.map +1 -0
- package/dist/harness/index.d.ts +16 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +39 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/intent.d.ts +4 -0
- package/dist/harness/intent.d.ts.map +1 -0
- package/dist/harness/intent.js +153 -0
- package/dist/harness/intent.js.map +1 -0
- package/dist/harness/ledger.d.ts +31 -0
- package/dist/harness/ledger.d.ts.map +1 -0
- package/dist/harness/ledger.js +135 -0
- package/dist/harness/ledger.js.map +1 -0
- package/dist/harness/safety.d.ts +91 -0
- package/dist/harness/safety.d.ts.map +1 -0
- package/dist/harness/safety.js +210 -0
- package/dist/harness/safety.js.map +1 -0
- package/dist/harness/state.d.ts +12 -0
- package/dist/harness/state.d.ts.map +1 -0
- package/dist/harness/state.js +114 -0
- package/dist/harness/state.js.map +1 -0
- package/dist/harness/turn-summary.d.ts +25 -0
- package/dist/harness/turn-summary.d.ts.map +1 -0
- package/dist/harness/turn-summary.js +120 -0
- package/dist/harness/turn-summary.js.map +1 -0
- package/dist/harness/types.d.ts +187 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +3 -0
- package/dist/harness/types.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +112 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +312 -0
- package/dist/init.js.map +1 -0
- package/dist/ink/index.d.ts +54 -0
- package/dist/ink/index.d.ts.map +1 -0
- package/dist/ink/index.js +111 -0
- package/dist/ink/index.js.map +1 -0
- package/dist/ink-ui/App.d.ts +9 -0
- package/dist/ink-ui/App.d.ts.map +1 -0
- package/dist/ink-ui/App.js +12 -0
- package/dist/ink-ui/App.js.map +1 -0
- package/dist/ink-ui/components/Markdown.d.ts +10 -0
- package/dist/ink-ui/components/Markdown.d.ts.map +1 -0
- package/dist/ink-ui/components/Markdown.js +210 -0
- package/dist/ink-ui/components/Markdown.js.map +1 -0
- package/dist/ink-ui/components/NativeCursor.d.ts +12 -0
- package/dist/ink-ui/components/NativeCursor.d.ts.map +1 -0
- package/dist/ink-ui/components/NativeCursor.js +35 -0
- package/dist/ink-ui/components/NativeCursor.js.map +1 -0
- package/dist/ink-ui/components/PixelHorseBanner.d.ts +8 -0
- package/dist/ink-ui/components/PixelHorseBanner.d.ts.map +1 -0
- package/dist/ink-ui/components/PixelHorseBanner.js +97 -0
- package/dist/ink-ui/components/PixelHorseBanner.js.map +1 -0
- package/dist/ink-ui/components/PromptInput.d.ts +13 -0
- package/dist/ink-ui/components/PromptInput.d.ts.map +1 -0
- package/dist/ink-ui/components/PromptInput.js +30 -0
- package/dist/ink-ui/components/PromptInput.js.map +1 -0
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts +13 -0
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts.map +1 -0
- package/dist/ink-ui/components/RunningHorseIndicator.js +53 -0
- package/dist/ink-ui/components/RunningHorseIndicator.js.map +1 -0
- package/dist/ink-ui/components/SelectList.d.ts +16 -0
- package/dist/ink-ui/components/SelectList.d.ts.map +1 -0
- package/dist/ink-ui/components/SelectList.js +60 -0
- package/dist/ink-ui/components/SelectList.js.map +1 -0
- package/dist/ink-ui/components/StatusLine.d.ts +11 -0
- package/dist/ink-ui/components/StatusLine.d.ts.map +1 -0
- package/dist/ink-ui/components/StatusLine.js +70 -0
- package/dist/ink-ui/components/StatusLine.js.map +1 -0
- package/dist/ink-ui/components/ToolActivity.d.ts +19 -0
- package/dist/ink-ui/components/ToolActivity.d.ts.map +1 -0
- package/dist/ink-ui/components/ToolActivity.js +134 -0
- package/dist/ink-ui/components/ToolActivity.js.map +1 -0
- package/dist/ink-ui/components/Transcript.d.ts +14 -0
- package/dist/ink-ui/components/Transcript.d.ts.map +1 -0
- package/dist/ink-ui/components/Transcript.js +66 -0
- package/dist/ink-ui/components/Transcript.js.map +1 -0
- package/dist/ink-ui/controllers/chat-controller.d.ts +2 -0
- package/dist/ink-ui/controllers/chat-controller.d.ts.map +1 -0
- package/dist/ink-ui/controllers/chat-controller.js +18 -0
- package/dist/ink-ui/controllers/chat-controller.js.map +1 -0
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts +6 -0
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts.map +1 -0
- package/dist/ink-ui/hooks/use-raw-input-bridge.js +27 -0
- package/dist/ink-ui/hooks/use-raw-input-bridge.js.map +1 -0
- package/dist/ink-ui/hooks/use-terminal-size.d.ts +7 -0
- package/dist/ink-ui/hooks/use-terminal-size.d.ts.map +1 -0
- package/dist/ink-ui/hooks/use-terminal-size.js +34 -0
- package/dist/ink-ui/hooks/use-terminal-size.js.map +1 -0
- package/dist/ink-ui/launch.d.ts +9 -0
- package/dist/ink-ui/launch.d.ts.map +1 -0
- package/dist/ink-ui/launch.js +101 -0
- package/dist/ink-ui/launch.js.map +1 -0
- package/dist/ink-ui/runtime/grapheme.d.ts +10 -0
- package/dist/ink-ui/runtime/grapheme.d.ts.map +1 -0
- package/dist/ink-ui/runtime/grapheme.js +17 -0
- package/dist/ink-ui/runtime/grapheme.js.map +1 -0
- package/dist/ink-ui/runtime/input-buffer.d.ts +10 -0
- package/dist/ink-ui/runtime/input-buffer.d.ts.map +1 -0
- package/dist/ink-ui/runtime/input-buffer.js +18 -0
- package/dist/ink-ui/runtime/input-buffer.js.map +1 -0
- package/dist/ink-ui/runtime/layout-budget.d.ts +13 -0
- package/dist/ink-ui/runtime/layout-budget.d.ts.map +1 -0
- package/dist/ink-ui/runtime/layout-budget.js +25 -0
- package/dist/ink-ui/runtime/layout-budget.js.map +1 -0
- package/dist/ink-ui/runtime/native-cursor.d.ts +62 -0
- package/dist/ink-ui/runtime/native-cursor.d.ts.map +1 -0
- package/dist/ink-ui/runtime/native-cursor.js +398 -0
- package/dist/ink-ui/runtime/native-cursor.js.map +1 -0
- package/dist/ink-ui/runtime/prompt-layout.d.ts +10 -0
- package/dist/ink-ui/runtime/prompt-layout.d.ts.map +1 -0
- package/dist/ink-ui/runtime/prompt-layout.js +21 -0
- package/dist/ink-ui/runtime/prompt-layout.js.map +1 -0
- package/dist/ink-ui/runtime/raw-input.d.ts +4 -0
- package/dist/ink-ui/runtime/raw-input.d.ts.map +1 -0
- package/dist/ink-ui/runtime/raw-input.js +15 -0
- package/dist/ink-ui/runtime/raw-input.js.map +1 -0
- package/dist/ink-ui/runtime/transcript-state.d.ts +37 -0
- package/dist/ink-ui/runtime/transcript-state.d.ts.map +1 -0
- package/dist/ink-ui/runtime/transcript-state.js +91 -0
- package/dist/ink-ui/runtime/transcript-state.js.map +1 -0
- package/dist/ink-ui/screens/ReplScreen.d.ts +22 -0
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +1 -0
- package/dist/ink-ui/screens/ReplScreen.js +616 -0
- package/dist/ink-ui/screens/ReplScreen.js.map +1 -0
- package/dist/ink-ui/types.d.ts +2 -0
- package/dist/ink-ui/types.d.ts.map +1 -0
- package/dist/ink-ui/types.js +18 -0
- package/dist/ink-ui/types.js.map +1 -0
- package/dist/memory/embeddings.d.ts +33 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +138 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/entrypoint.d.ts +55 -0
- package/dist/memory/entrypoint.d.ts.map +1 -0
- package/dist/memory/entrypoint.js +151 -0
- package/dist/memory/entrypoint.js.map +1 -0
- package/dist/memory/index.d.ts +14 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +31 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/prompts.d.ts +12 -0
- package/dist/memory/prompts.d.ts.map +1 -0
- package/dist/memory/prompts.js +117 -0
- package/dist/memory/prompts.js.map +1 -0
- package/dist/memory/relevant-finder.d.ts +54 -0
- package/dist/memory/relevant-finder.d.ts.map +1 -0
- package/dist/memory/relevant-finder.js +157 -0
- package/dist/memory/relevant-finder.js.map +1 -0
- package/dist/memory/semantic-search.d.ts +45 -0
- package/dist/memory/semantic-search.d.ts.map +1 -0
- package/dist/memory/semantic-search.js +113 -0
- package/dist/memory/semantic-search.js.map +1 -0
- package/dist/memory/storage.d.ts +86 -0
- package/dist/memory/storage.d.ts.map +1 -0
- package/dist/memory/storage.js +339 -0
- package/dist/memory/storage.js.map +1 -0
- package/dist/memory/store.d.ts +104 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +235 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/team-paths.d.ts +63 -0
- package/dist/memory/team-paths.d.ts.map +1 -0
- package/dist/memory/team-paths.js +151 -0
- package/dist/memory/team-paths.js.map +1 -0
- package/dist/memory/types.d.ts +40 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +71 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory/validation.d.ts +28 -0
- package/dist/memory/validation.d.ts.map +1 -0
- package/dist/memory/validation.js +147 -0
- package/dist/memory/validation.js.map +1 -0
- package/dist/memory/vector-store.d.ts +69 -0
- package/dist/memory/vector-store.d.ts.map +1 -0
- package/dist/memory/vector-store.js +356 -0
- package/dist/memory/vector-store.js.map +1 -0
- package/dist/migration/command.d.ts +9 -0
- package/dist/migration/command.d.ts.map +1 -0
- package/dist/migration/command.js +96 -0
- package/dist/migration/command.js.map +1 -0
- package/dist/migration/index.d.ts +7 -0
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +14 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/migrate.d.ts +19 -0
- package/dist/migration/migrate.d.ts.map +1 -0
- package/dist/migration/migrate.js +459 -0
- package/dist/migration/migrate.js.map +1 -0
- package/dist/migration/types.d.ts +56 -0
- package/dist/migration/types.d.ts.map +1 -0
- package/dist/migration/types.js +6 -0
- package/dist/migration/types.js.map +1 -0
- package/dist/print-ui/launch.d.ts +50 -0
- package/dist/print-ui/launch.d.ts.map +1 -0
- package/dist/print-ui/launch.js +225 -0
- package/dist/print-ui/launch.js.map +1 -0
- package/dist/product/environment.d.ts +37 -0
- package/dist/product/environment.d.ts.map +1 -0
- package/dist/product/environment.js +72 -0
- package/dist/product/environment.js.map +1 -0
- package/dist/product/identity.d.ts +39 -0
- package/dist/product/identity.d.ts.map +1 -0
- package/dist/product/identity.js +46 -0
- package/dist/product/identity.js.map +1 -0
- package/dist/product/index.d.ts +4 -0
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +63 -0
- package/dist/product/index.js.map +1 -0
- package/dist/product/paths.d.ts +61 -0
- package/dist/product/paths.d.ts.map +1 -0
- package/dist/product/paths.js +243 -0
- package/dist/product/paths.js.map +1 -0
- package/dist/runtime/agent-runtime-controller.d.ts +85 -0
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -0
- package/dist/runtime/agent-runtime-controller.js +417 -0
- package/dist/runtime/agent-runtime-controller.js.map +1 -0
- package/dist/runtime/agent-runtime-protocol.d.ts +118 -0
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -0
- package/dist/runtime/agent-runtime-protocol.js +128 -0
- package/dist/runtime/agent-runtime-protocol.js.map +1 -0
- package/dist/runtime/agent-status.d.ts +9 -0
- package/dist/runtime/agent-status.d.ts.map +1 -0
- package/dist/runtime/agent-status.js +41 -0
- package/dist/runtime/agent-status.js.map +1 -0
- package/dist/runtime/aggregate-tool-presenter.d.ts +13 -0
- package/dist/runtime/aggregate-tool-presenter.d.ts.map +1 -0
- package/dist/runtime/aggregate-tool-presenter.js +44 -0
- package/dist/runtime/aggregate-tool-presenter.js.map +1 -0
- package/dist/runtime/chat-controller.d.ts +89 -0
- package/dist/runtime/chat-controller.d.ts.map +1 -0
- package/dist/runtime/chat-controller.js +2183 -0
- package/dist/runtime/chat-controller.js.map +1 -0
- 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/goals/accounting.d.ts +17 -0
- package/dist/runtime/goals/accounting.d.ts.map +1 -0
- package/dist/runtime/goals/accounting.js +45 -0
- package/dist/runtime/goals/accounting.js.map +1 -0
- package/dist/runtime/goals/completion-audit.d.ts +24 -0
- package/dist/runtime/goals/completion-audit.d.ts.map +1 -0
- package/dist/runtime/goals/completion-audit.js +48 -0
- package/dist/runtime/goals/completion-audit.js.map +1 -0
- package/dist/runtime/goals/coordinator.d.ts +42 -0
- package/dist/runtime/goals/coordinator.d.ts.map +1 -0
- package/dist/runtime/goals/coordinator.js +278 -0
- package/dist/runtime/goals/coordinator.js.map +1 -0
- package/dist/runtime/goals/prompt.d.ts +16 -0
- package/dist/runtime/goals/prompt.d.ts.map +1 -0
- package/dist/runtime/goals/prompt.js +50 -0
- package/dist/runtime/goals/prompt.js.map +1 -0
- package/dist/runtime/goals/tools.d.ts +18 -0
- package/dist/runtime/goals/tools.d.ts.map +1 -0
- package/dist/runtime/goals/tools.js +118 -0
- package/dist/runtime/goals/tools.js.map +1 -0
- package/dist/runtime/goals/types.d.ts +167 -0
- package/dist/runtime/goals/types.d.ts.map +1 -0
- package/dist/runtime/goals/types.js +72 -0
- package/dist/runtime/goals/types.js.map +1 -0
- package/dist/runtime/loop-budget.d.ts +5 -0
- package/dist/runtime/loop-budget.d.ts.map +1 -0
- package/dist/runtime/loop-budget.js +77 -0
- package/dist/runtime/loop-budget.js.map +1 -0
- package/dist/runtime/model-coordinator.d.ts +54 -0
- package/dist/runtime/model-coordinator.d.ts.map +1 -0
- package/dist/runtime/model-coordinator.js +121 -0
- package/dist/runtime/model-coordinator.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 +47 -0
- package/dist/runtime/subagents/production.d.ts.map +1 -0
- package/dist/runtime/subagents/production.js +148 -0
- package/dist/runtime/subagents/production.js.map +1 -0
- package/dist/runtime/subagents/provider-gate.d.ts +104 -0
- package/dist/runtime/subagents/provider-gate.d.ts.map +1 -0
- package/dist/runtime/subagents/provider-gate.js +192 -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 +76 -0
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -0
- package/dist/runtime/subagents/runtime-integration.js +152 -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/tool-detail-repository.d.ts +45 -0
- package/dist/runtime/tool-detail-repository.d.ts.map +1 -0
- package/dist/runtime/tool-detail-repository.js +131 -0
- package/dist/runtime/tool-detail-repository.js.map +1 -0
- package/dist/runtime/tool-output-presentation.d.ts +89 -0
- package/dist/runtime/tool-output-presentation.d.ts.map +1 -0
- package/dist/runtime/tool-output-presentation.js +329 -0
- package/dist/runtime/tool-output-presentation.js.map +1 -0
- package/dist/runtime/turn-controller.d.ts +41 -0
- package/dist/runtime/turn-controller.d.ts.map +1 -0
- package/dist/runtime/turn-controller.js +92 -0
- package/dist/runtime/turn-controller.js.map +1 -0
- package/dist/runtime/ui-events.d.ts +188 -0
- package/dist/runtime/ui-events.d.ts.map +1 -0
- package/dist/runtime/ui-events.js +37 -0
- package/dist/runtime/ui-events.js.map +1 -0
- package/dist/runtime/ui-view-model.d.ts +362 -0
- package/dist/runtime/ui-view-model.d.ts.map +1 -0
- package/dist/runtime/ui-view-model.js +700 -0
- package/dist/runtime/ui-view-model.js.map +1 -0
- package/dist/sdk/index.d.ts +10 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +23 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/init.d.ts +24 -0
- package/dist/sdk/init.d.ts.map +1 -0
- package/dist/sdk/init.js +48 -0
- package/dist/sdk/init.js.map +1 -0
- package/dist/sdk/query.d.ts +19 -0
- package/dist/sdk/query.d.ts.map +1 -0
- package/dist/sdk/query.js +42 -0
- package/dist/sdk/query.js.map +1 -0
- package/dist/sdk/sessions.d.ts +19 -0
- package/dist/sdk/sessions.d.ts.map +1 -0
- package/dist/sdk/sessions.js +57 -0
- package/dist/sdk/sessions.js.map +1 -0
- package/dist/sdk/types.d.ts +47 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +8 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/services/agent-runner.d.ts +68 -0
- package/dist/services/agent-runner.d.ts.map +1 -0
- package/dist/services/agent-runner.js +185 -0
- package/dist/services/agent-runner.js.map +1 -0
- package/dist/services/atomic-write.d.ts +12 -0
- package/dist/services/atomic-write.d.ts.map +1 -0
- package/dist/services/atomic-write.js +27 -0
- package/dist/services/atomic-write.js.map +1 -0
- package/dist/services/auth/auth.d.ts +121 -0
- package/dist/services/auth/auth.d.ts.map +1 -0
- package/dist/services/auth/auth.js +233 -0
- package/dist/services/auth/auth.js.map +1 -0
- package/dist/services/auth/aws.d.ts +27 -0
- package/dist/services/auth/aws.d.ts.map +1 -0
- package/dist/services/auth/aws.js +109 -0
- package/dist/services/auth/aws.js.map +1 -0
- package/dist/services/auth/index.d.ts +6 -0
- package/dist/services/auth/index.d.ts.map +1 -0
- package/dist/services/auth/index.js +17 -0
- package/dist/services/auth/index.js.map +1 -0
- package/dist/services/auto-fix/autoFixConfig.d.ts +33 -0
- package/dist/services/auto-fix/autoFixConfig.d.ts.map +1 -0
- package/dist/services/auto-fix/autoFixConfig.js +61 -0
- package/dist/services/auto-fix/autoFixConfig.js.map +1 -0
- package/dist/services/auto-fix/autoFixHook.d.ts +20 -0
- package/dist/services/auto-fix/autoFixHook.d.ts.map +1 -0
- package/dist/services/auto-fix/autoFixHook.js +90 -0
- package/dist/services/auto-fix/autoFixHook.js.map +1 -0
- package/dist/services/auto-fix/autoFixRunner.d.ts +60 -0
- package/dist/services/auto-fix/autoFixRunner.d.ts.map +1 -0
- package/dist/services/auto-fix/autoFixRunner.js +207 -0
- package/dist/services/auto-fix/autoFixRunner.js.map +1 -0
- package/dist/services/auto-fix/index.d.ts +7 -0
- package/dist/services/auto-fix/index.d.ts.map +1 -0
- package/dist/services/auto-fix/index.js +17 -0
- package/dist/services/auto-fix/index.js.map +1 -0
- package/dist/services/commit-plan.d.ts +17 -0
- package/dist/services/commit-plan.d.ts.map +1 -0
- package/dist/services/commit-plan.js +161 -0
- package/dist/services/commit-plan.js.map +1 -0
- package/dist/services/compact/auto-compact.d.ts +119 -0
- package/dist/services/compact/auto-compact.d.ts.map +1 -0
- package/dist/services/compact/auto-compact.js +273 -0
- package/dist/services/compact/auto-compact.js.map +1 -0
- package/dist/services/compact/compact.d.ts +65 -0
- package/dist/services/compact/compact.d.ts.map +1 -0
- package/dist/services/compact/compact.js +162 -0
- package/dist/services/compact/compact.js.map +1 -0
- 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 +11 -0
- package/dist/services/compact/index.d.ts.map +1 -0
- package/dist/services/compact/index.js +25 -0
- package/dist/services/compact/index.js.map +1 -0
- package/dist/services/compact/micro-compact.d.ts +21 -0
- package/dist/services/compact/micro-compact.d.ts.map +1 -0
- package/dist/services/compact/micro-compact.js +99 -0
- package/dist/services/compact/micro-compact.js.map +1 -0
- package/dist/services/compact/summary-generator.d.ts +40 -0
- package/dist/services/compact/summary-generator.d.ts.map +1 -0
- package/dist/services/compact/summary-generator.js +226 -0
- package/dist/services/compact/summary-generator.js.map +1 -0
- package/dist/services/concurrent-sessions.d.ts +97 -0
- package/dist/services/concurrent-sessions.d.ts.map +1 -0
- package/dist/services/concurrent-sessions.js +265 -0
- package/dist/services/concurrent-sessions.js.map +1 -0
- package/dist/services/config-dir.d.ts +18 -0
- package/dist/services/config-dir.d.ts.map +1 -0
- package/dist/services/config-dir.js +118 -0
- package/dist/services/config-dir.js.map +1 -0
- package/dist/services/config.d.ts +55 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +351 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/diagnostic-tracking/diagnosticTracking.d.ts +58 -0
- package/dist/services/diagnostic-tracking/diagnosticTracking.d.ts.map +1 -0
- package/dist/services/diagnostic-tracking/diagnosticTracking.js +167 -0
- package/dist/services/diagnostic-tracking/diagnosticTracking.js.map +1 -0
- package/dist/services/diagnostic-tracking/formatter.d.ts +17 -0
- package/dist/services/diagnostic-tracking/formatter.d.ts.map +1 -0
- package/dist/services/diagnostic-tracking/formatter.js +78 -0
- package/dist/services/diagnostic-tracking/formatter.js.map +1 -0
- package/dist/services/diagnostic-tracking/index.d.ts +7 -0
- package/dist/services/diagnostic-tracking/index.d.ts.map +1 -0
- package/dist/services/diagnostic-tracking/index.js +19 -0
- package/dist/services/diagnostic-tracking/index.js.map +1 -0
- package/dist/services/diagnostic-tracking/types.d.ts +52 -0
- package/dist/services/diagnostic-tracking/types.d.ts.map +1 -0
- package/dist/services/diagnostic-tracking/types.js +27 -0
- package/dist/services/diagnostic-tracking/types.js.map +1 -0
- package/dist/services/doctor.d.ts +35 -0
- package/dist/services/doctor.d.ts.map +1 -0
- package/dist/services/doctor.js +417 -0
- package/dist/services/doctor.js.map +1 -0
- package/dist/services/file-context.d.ts +21 -0
- package/dist/services/file-context.d.ts.map +1 -0
- package/dist/services/file-context.js +194 -0
- package/dist/services/file-context.js.map +1 -0
- package/dist/services/file-glob.d.ts +30 -0
- package/dist/services/file-glob.d.ts.map +1 -0
- package/dist/services/file-glob.js +140 -0
- package/dist/services/file-glob.js.map +1 -0
- package/dist/services/format.d.ts +2 -0
- package/dist/services/format.d.ts.map +1 -0
- package/dist/services/format.js +20 -0
- package/dist/services/format.js.map +1 -0
- package/dist/services/global-config.d.ts +161 -0
- package/dist/services/global-config.d.ts.map +1 -0
- package/dist/services/global-config.js +166 -0
- package/dist/services/global-config.js.map +1 -0
- package/dist/services/goal-storage.d.ts +22 -0
- package/dist/services/goal-storage.d.ts.map +1 -0
- package/dist/services/goal-storage.js +153 -0
- package/dist/services/goal-storage.js.map +1 -0
- package/dist/services/llm.d.ts +190 -0
- package/dist/services/llm.d.ts.map +1 -0
- package/dist/services/llm.js +740 -0
- package/dist/services/llm.js.map +1 -0
- package/dist/services/mcp/index.d.ts +5 -0
- package/dist/services/mcp/index.d.ts.map +1 -0
- package/dist/services/mcp/index.js +16 -0
- package/dist/services/mcp/index.js.map +1 -0
- package/dist/services/mcp/transports.d.ts +106 -0
- package/dist/services/mcp/transports.d.ts.map +1 -0
- package/dist/services/mcp/transports.js +375 -0
- package/dist/services/mcp/transports.js.map +1 -0
- package/dist/services/memory.d.ts +39 -0
- package/dist/services/memory.d.ts.map +1 -0
- package/dist/services/memory.js +88 -0
- package/dist/services/memory.js.map +1 -0
- package/dist/services/model-catalog.d.ts +14 -0
- package/dist/services/model-catalog.d.ts.map +1 -0
- package/dist/services/model-catalog.js +73 -0
- package/dist/services/model-catalog.js.map +1 -0
- package/dist/services/model-client-pool.d.ts +37 -0
- package/dist/services/model-client-pool.d.ts.map +1 -0
- package/dist/services/model-client-pool.js +88 -0
- package/dist/services/model-client-pool.js.map +1 -0
- package/dist/services/model-context.d.ts +89 -0
- package/dist/services/model-context.d.ts.map +1 -0
- package/dist/services/model-context.js +395 -0
- package/dist/services/model-context.js.map +1 -0
- package/dist/services/model-registry.d.ts +98 -0
- package/dist/services/model-registry.d.ts.map +1 -0
- package/dist/services/model-registry.js +271 -0
- package/dist/services/model-registry.js.map +1 -0
- package/dist/services/project-instructions.d.ts +16 -0
- package/dist/services/project-instructions.d.ts.map +1 -0
- package/dist/services/project-instructions.js +135 -0
- package/dist/services/project-instructions.js.map +1 -0
- package/dist/services/prompt-context.d.ts +3 -0
- package/dist/services/prompt-context.d.ts.map +1 -0
- package/dist/services/prompt-context.js +13 -0
- package/dist/services/prompt-context.js.map +1 -0
- package/dist/services/provider-diagnostics.d.ts +30 -0
- package/dist/services/provider-diagnostics.d.ts.map +1 -0
- package/dist/services/provider-diagnostics.js +314 -0
- package/dist/services/provider-diagnostics.js.map +1 -0
- package/dist/services/provider-resilience/circuit-breaker.d.ts +32 -0
- package/dist/services/provider-resilience/circuit-breaker.d.ts.map +1 -0
- package/dist/services/provider-resilience/circuit-breaker.js +88 -0
- package/dist/services/provider-resilience/circuit-breaker.js.map +1 -0
- package/dist/services/provider-resilience/coordinator.d.ts +38 -0
- package/dist/services/provider-resilience/coordinator.d.ts.map +1 -0
- package/dist/services/provider-resilience/coordinator.js +155 -0
- package/dist/services/provider-resilience/coordinator.js.map +1 -0
- package/dist/services/provider-resilience/error-classifier.d.ts +15 -0
- package/dist/services/provider-resilience/error-classifier.d.ts.map +1 -0
- package/dist/services/provider-resilience/error-classifier.js +162 -0
- package/dist/services/provider-resilience/error-classifier.js.map +1 -0
- package/dist/services/provider-resilience/index.d.ts +10 -0
- package/dist/services/provider-resilience/index.d.ts.map +1 -0
- package/dist/services/provider-resilience/index.js +23 -0
- package/dist/services/provider-resilience/index.js.map +1 -0
- package/dist/services/provider-resilience/request-gate.d.ts +41 -0
- package/dist/services/provider-resilience/request-gate.d.ts.map +1 -0
- package/dist/services/provider-resilience/request-gate.js +82 -0
- package/dist/services/provider-resilience/request-gate.js.map +1 -0
- package/dist/services/provider-resilience/stream-recovery.d.ts +46 -0
- package/dist/services/provider-resilience/stream-recovery.d.ts.map +1 -0
- package/dist/services/provider-resilience/stream-recovery.js +106 -0
- package/dist/services/provider-resilience/stream-recovery.js.map +1 -0
- package/dist/services/provider-resilience/types.d.ts +100 -0
- package/dist/services/provider-resilience/types.d.ts.map +1 -0
- package/dist/services/provider-resilience/types.js +22 -0
- package/dist/services/provider-resilience/types.js.map +1 -0
- package/dist/services/redaction.d.ts +2 -0
- package/dist/services/redaction.d.ts.map +1 -0
- package/dist/services/redaction.js +27 -0
- package/dist/services/redaction.js.map +1 -0
- package/dist/services/session-index.d.ts +50 -0
- package/dist/services/session-index.d.ts.map +1 -0
- package/dist/services/session-index.js +196 -0
- package/dist/services/session-index.js.map +1 -0
- package/dist/services/session-memory/index.d.ts +6 -0
- package/dist/services/session-memory/index.d.ts.map +1 -0
- package/dist/services/session-memory/index.js +15 -0
- package/dist/services/session-memory/index.js.map +1 -0
- package/dist/services/session-memory/prompts.d.ts +23 -0
- package/dist/services/session-memory/prompts.d.ts.map +1 -0
- package/dist/services/session-memory/prompts.js +70 -0
- package/dist/services/session-memory/prompts.js.map +1 -0
- package/dist/services/session-memory/sessionMemory.d.ts +64 -0
- package/dist/services/session-memory/sessionMemory.d.ts.map +1 -0
- package/dist/services/session-memory/sessionMemory.js +243 -0
- package/dist/services/session-memory/sessionMemory.js.map +1 -0
- package/dist/services/session-storage.d.ts +378 -0
- package/dist/services/session-storage.d.ts.map +1 -0
- package/dist/services/session-storage.js +1026 -0
- package/dist/services/session-storage.js.map +1 -0
- package/dist/services/smart-routing.d.ts +41 -0
- package/dist/services/smart-routing.d.ts.map +1 -0
- package/dist/services/smart-routing.js +134 -0
- package/dist/services/smart-routing.js.map +1 -0
- package/dist/services/storage-maintenance.d.ts +53 -0
- package/dist/services/storage-maintenance.d.ts.map +1 -0
- package/dist/services/storage-maintenance.js +370 -0
- package/dist/services/storage-maintenance.js.map +1 -0
- package/dist/services/task-manager.d.ts +156 -0
- package/dist/services/task-manager.d.ts.map +1 -0
- package/dist/services/task-manager.js +301 -0
- package/dist/services/task-manager.js.map +1 -0
- package/dist/services/usage-state.d.ts +70 -0
- package/dist/services/usage-state.d.ts.map +1 -0
- package/dist/services/usage-state.js +257 -0
- package/dist/services/usage-state.js.map +1 -0
- package/dist/services/verification-profile.d.ts +51 -0
- package/dist/services/verification-profile.d.ts.map +1 -0
- package/dist/services/verification-profile.js +307 -0
- package/dist/services/verification-profile.js.map +1 -0
- package/dist/services/web-search-adapters.d.ts +24 -0
- package/dist/services/web-search-adapters.d.ts.map +1 -0
- package/dist/services/web-search-adapters.js +271 -0
- package/dist/services/web-search-adapters.js.map +1 -0
- package/dist/services/web-search-mcp.d.ts +32 -0
- package/dist/services/web-search-mcp.d.ts.map +1 -0
- package/dist/services/web-search-mcp.js +270 -0
- package/dist/services/web-search-mcp.js.map +1 -0
- package/dist/services/web-search-provider.d.ts +28 -0
- package/dist/services/web-search-provider.d.ts.map +1 -0
- package/dist/services/web-search-provider.js +127 -0
- package/dist/services/web-search-provider.js.map +1 -0
- package/dist/services/workspace-diff.d.ts +27 -0
- package/dist/services/workspace-diff.d.ts.map +1 -0
- package/dist/services/workspace-diff.js +160 -0
- package/dist/services/workspace-diff.js.map +1 -0
- package/dist/services/workspace-state.d.ts +25 -0
- package/dist/services/workspace-state.d.ts.map +1 -0
- package/dist/services/workspace-state.js +115 -0
- package/dist/services/workspace-state.js.map +1 -0
- package/dist/services/yaml-config.d.ts +57 -0
- package/dist/services/yaml-config.d.ts.map +1 -0
- package/dist/services/yaml-config.js +176 -0
- package/dist/services/yaml-config.js.map +1 -0
- package/dist/skills/discovery.d.ts +22 -0
- package/dist/skills/discovery.d.ts.map +1 -0
- package/dist/skills/discovery.js +75 -0
- package/dist/skills/discovery.js.map +1 -0
- package/dist/skills/index.d.ts +11 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +27 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +53 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +406 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/registry.d.ts +41 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +157 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/runtime.d.ts +46 -0
- package/dist/skills/runtime.d.ts.map +1 -0
- package/dist/skills/runtime.js +331 -0
- package/dist/skills/runtime.js.map +1 -0
- package/dist/skills/types.d.ts +112 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +24 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/terminal-ui/completion.d.ts +13 -0
- package/dist/terminal-ui/completion.d.ts.map +1 -0
- package/dist/terminal-ui/completion.js +95 -0
- package/dist/terminal-ui/completion.js.map +1 -0
- package/dist/terminal-ui/editor.d.ts +17 -0
- package/dist/terminal-ui/editor.d.ts.map +1 -0
- package/dist/terminal-ui/editor.js +53 -0
- package/dist/terminal-ui/editor.js.map +1 -0
- package/dist/terminal-ui/launch.d.ts +121 -0
- package/dist/terminal-ui/launch.d.ts.map +1 -0
- package/dist/terminal-ui/launch.js +1247 -0
- package/dist/terminal-ui/launch.js.map +1 -0
- package/dist/terminal-ui/output-queue.d.ts +43 -0
- package/dist/terminal-ui/output-queue.d.ts.map +1 -0
- package/dist/terminal-ui/output-queue.js +139 -0
- package/dist/terminal-ui/output-queue.js.map +1 -0
- package/dist/terminal-ui/raw-editor.d.ts +106 -0
- package/dist/terminal-ui/raw-editor.d.ts.map +1 -0
- package/dist/terminal-ui/raw-editor.js +704 -0
- package/dist/terminal-ui/raw-editor.js.map +1 -0
- package/dist/tools/_validate.d.ts +11 -0
- package/dist/tools/_validate.d.ts.map +1 -0
- package/dist/tools/_validate.js +55 -0
- package/dist/tools/_validate.js.map +1 -0
- package/dist/tools/bash_security.d.ts +74 -0
- package/dist/tools/bash_security.d.ts.map +1 -0
- package/dist/tools/bash_security.js +356 -0
- package/dist/tools/bash_security.js.map +1 -0
- package/dist/tools/git.d.ts +15 -0
- package/dist/tools/git.d.ts.map +1 -0
- package/dist/tools/git.js +285 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/index.d.ts +40 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +1881 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lsp.d.ts +18 -0
- package/dist/tools/lsp.d.ts.map +1 -0
- package/dist/tools/lsp.js +548 -0
- package/dist/tools/lsp.js.map +1 -0
- package/dist/tools/mcp.d.ts +86 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js +570 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/plan.d.ts +18 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +82 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/todo.d.ts +18 -0
- package/dist/tools/todo.d.ts.map +1 -0
- package/dist/tools/todo.js +161 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/web.d.ts +26 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +586 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/tui-core/frame.d.ts +37 -0
- package/dist/tui-core/frame.d.ts.map +1 -0
- package/dist/tui-core/frame.js +157 -0
- package/dist/tui-core/frame.js.map +1 -0
- package/dist/tui-core/input-parser.d.ts +36 -0
- package/dist/tui-core/input-parser.d.ts.map +1 -0
- package/dist/tui-core/input-parser.js +291 -0
- package/dist/tui-core/input-parser.js.map +1 -0
- 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 +34 -0
- package/dist/tui-core/terminal-writer.d.ts.map +1 -0
- package/dist/tui-core/terminal-writer.js +105 -0
- package/dist/tui-core/terminal-writer.js.map +1 -0
- package/dist/tui-ui/inline-surface.d.ts +191 -0
- package/dist/tui-ui/inline-surface.d.ts.map +1 -0
- package/dist/tui-ui/inline-surface.js +636 -0
- package/dist/tui-ui/inline-surface.js.map +1 -0
- package/dist/tui-ui/input-ownership.d.ts +46 -0
- package/dist/tui-ui/input-ownership.d.ts.map +1 -0
- package/dist/tui-ui/input-ownership.js +74 -0
- package/dist/tui-ui/input-ownership.js.map +1 -0
- package/dist/tui-ui/launch.d.ts +11 -0
- package/dist/tui-ui/launch.d.ts.map +1 -0
- package/dist/tui-ui/launch.js +632 -0
- package/dist/tui-ui/launch.js.map +1 -0
- package/dist/tui-ui/layout.d.ts +59 -0
- package/dist/tui-ui/layout.d.ts.map +1 -0
- package/dist/tui-ui/layout.js +426 -0
- package/dist/tui-ui/layout.js.map +1 -0
- package/dist/tui-ui/pickers.d.ts +13 -0
- package/dist/tui-ui/pickers.d.ts.map +1 -0
- package/dist/tui-ui/pickers.js +38 -0
- package/dist/tui-ui/pickers.js.map +1 -0
- 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 +149 -0
- package/dist/tui-ui/runner.d.ts.map +1 -0
- package/dist/tui-ui/runner.js +1255 -0
- package/dist/tui-ui/runner.js.map +1 -0
- package/dist/tui-ui/state.d.ts +219 -0
- package/dist/tui-ui/state.d.ts.map +1 -0
- package/dist/tui-ui/state.js +569 -0
- package/dist/tui-ui/state.js.map +1 -0
- package/dist/tui-ui/terminal-image.d.ts +24 -0
- package/dist/tui-ui/terminal-image.d.ts.map +1 -0
- package/dist/tui-ui/terminal-image.js +211 -0
- package/dist/tui-ui/terminal-image.js.map +1 -0
- package/dist/tui-ui/theme-profile.d.ts +25 -0
- package/dist/tui-ui/theme-profile.d.ts.map +1 -0
- package/dist/tui-ui/theme-profile.js +130 -0
- package/dist/tui-ui/theme-profile.js.map +1 -0
- 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-inspector-layout.d.ts +9 -0
- package/dist/tui-ui/transcript-inspector-layout.d.ts.map +1 -0
- package/dist/tui-ui/transcript-inspector-layout.js +97 -0
- package/dist/tui-ui/transcript-inspector-layout.js.map +1 -0
- package/dist/tui-ui/transcript-inspector-surface.d.ts +18 -0
- package/dist/tui-ui/transcript-inspector-surface.d.ts.map +1 -0
- package/dist/tui-ui/transcript-inspector-surface.js +88 -0
- package/dist/tui-ui/transcript-inspector-surface.js.map +1 -0
- package/dist/tui-ui/transcript-inspector.d.ts +35 -0
- package/dist/tui-ui/transcript-inspector.d.ts.map +1 -0
- package/dist/tui-ui/transcript-inspector.js +128 -0
- package/dist/tui-ui/transcript-inspector.js.map +1 -0
- package/dist/tui-ui/transcript-layout.d.ts +22 -0
- package/dist/tui-ui/transcript-layout.d.ts.map +1 -0
- package/dist/tui-ui/transcript-layout.js +442 -0
- package/dist/tui-ui/transcript-layout.js.map +1 -0
- package/dist/ui/box.d.ts +48 -0
- package/dist/ui/box.d.ts.map +1 -0
- package/dist/ui/box.js +196 -0
- package/dist/ui/box.js.map +1 -0
- package/dist/ui/command-panel.d.ts +79 -0
- package/dist/ui/command-panel.d.ts.map +1 -0
- package/dist/ui/command-panel.js +460 -0
- package/dist/ui/command-panel.js.map +1 -0
- package/dist/ui/file-completion.d.ts +65 -0
- package/dist/ui/file-completion.d.ts.map +1 -0
- package/dist/ui/file-completion.js +214 -0
- package/dist/ui/file-completion.js.map +1 -0
- package/dist/ui/markdown.d.ts +18 -0
- package/dist/ui/markdown.d.ts.map +1 -0
- package/dist/ui/markdown.js +301 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/multiline-input.d.ts +51 -0
- package/dist/ui/multiline-input.d.ts.map +1 -0
- package/dist/ui/multiline-input.js +100 -0
- package/dist/ui/multiline-input.js.map +1 -0
- package/dist/ui/progress.d.ts +34 -0
- package/dist/ui/progress.d.ts.map +1 -0
- package/dist/ui/progress.js +85 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/shared/command-palette.d.ts +3 -0
- package/dist/ui/shared/command-palette.d.ts.map +1 -0
- package/dist/ui/shared/command-palette.js +54 -0
- package/dist/ui/shared/command-palette.js.map +1 -0
- package/dist/ui/shared/command-suggestions.d.ts +19 -0
- package/dist/ui/shared/command-suggestions.d.ts.map +1 -0
- package/dist/ui/shared/command-suggestions.js +67 -0
- package/dist/ui/shared/command-suggestions.js.map +1 -0
- package/dist/ui/shared/input-frame.d.ts +19 -0
- package/dist/ui/shared/input-frame.d.ts.map +1 -0
- package/dist/ui/shared/input-frame.js +74 -0
- package/dist/ui/shared/input-frame.js.map +1 -0
- package/dist/ui/shared/text.d.ts +5 -0
- package/dist/ui/shared/text.d.ts.map +1 -0
- package/dist/ui/shared/text.js +55 -0
- package/dist/ui/shared/text.js.map +1 -0
- package/dist/ui/shared/types.d.ts +27 -0
- package/dist/ui/shared/types.d.ts.map +1 -0
- package/dist/ui/shared/types.js +3 -0
- package/dist/ui/shared/types.js.map +1 -0
- package/dist/ui/status-bar.d.ts +33 -0
- package/dist/ui/status-bar.d.ts.map +1 -0
- package/dist/ui/status-bar.js +92 -0
- package/dist/ui/status-bar.js.map +1 -0
- package/dist/ui/stream-markdown.d.ts +50 -0
- package/dist/ui/stream-markdown.d.ts.map +1 -0
- package/dist/ui/stream-markdown.js +221 -0
- package/dist/ui/stream-markdown.js.map +1 -0
- package/dist/ui/suggestions.d.ts +35 -0
- package/dist/ui/suggestions.d.ts.map +1 -0
- package/dist/ui/suggestions.js +118 -0
- package/dist/ui/suggestions.js.map +1 -0
- package/dist/ui/tool-preview.d.ts +34 -0
- package/dist/ui/tool-preview.d.ts.map +1 -0
- package/dist/ui/tool-preview.js +127 -0
- package/dist/ui/tool-preview.js.map +1 -0
- package/dist/ui/user-input.d.ts +11 -0
- package/dist/ui/user-input.d.ts.map +1 -0
- package/dist/ui/user-input.js +70 -0
- package/dist/ui/user-input.js.map +1 -0
- package/dist/ui-v2/components/command-palette.d.ts +2 -0
- package/dist/ui-v2/components/command-palette.d.ts.map +1 -0
- package/dist/ui-v2/components/command-palette.js +18 -0
- package/dist/ui-v2/components/command-palette.js.map +1 -0
- package/dist/ui-v2/components/edit-preview-picker.d.ts +26 -0
- package/dist/ui-v2/components/edit-preview-picker.d.ts.map +1 -0
- package/dist/ui-v2/components/edit-preview-picker.js +79 -0
- package/dist/ui-v2/components/edit-preview-picker.js.map +1 -0
- package/dist/ui-v2/components/session-picker.d.ts +19 -0
- package/dist/ui-v2/components/session-picker.d.ts.map +1 -0
- package/dist/ui-v2/components/session-picker.js +52 -0
- package/dist/ui-v2/components/session-picker.js.map +1 -0
- package/dist/ui-v2/components/shell.d.ts +36 -0
- package/dist/ui-v2/components/shell.d.ts.map +1 -0
- package/dist/ui-v2/components/shell.js +131 -0
- package/dist/ui-v2/components/shell.js.map +1 -0
- package/dist/ui-v2/index.d.ts +11 -0
- package/dist/ui-v2/index.d.ts.map +1 -0
- package/dist/ui-v2/index.js +27 -0
- package/dist/ui-v2/index.js.map +1 -0
- package/dist/ui-v2/runtime/text.d.ts +2 -0
- package/dist/ui-v2/runtime/text.d.ts.map +1 -0
- package/dist/ui-v2/runtime/text.js +18 -0
- package/dist/ui-v2/runtime/text.js.map +1 -0
- package/dist/ui-v2/state/input-reducer.d.ts +39 -0
- package/dist/ui-v2/state/input-reducer.d.ts.map +1 -0
- package/dist/ui-v2/state/input-reducer.js +82 -0
- package/dist/ui-v2/state/input-reducer.js.map +1 -0
- package/dist/ui-v2/state/picker.d.ts +16 -0
- package/dist/ui-v2/state/picker.d.ts.map +1 -0
- package/dist/ui-v2/state/picker.js +52 -0
- package/dist/ui-v2/state/picker.js.map +1 -0
- package/dist/ui-v2/state/sessions.d.ts +15 -0
- package/dist/ui-v2/state/sessions.d.ts.map +1 -0
- package/dist/ui-v2/state/sessions.js +70 -0
- package/dist/ui-v2/state/sessions.js.map +1 -0
- package/dist/ui-v2/state/suggestions.d.ts +2 -0
- package/dist/ui-v2/state/suggestions.d.ts.map +1 -0
- package/dist/ui-v2/state/suggestions.js +18 -0
- package/dist/ui-v2/state/suggestions.js.map +1 -0
- package/dist/ui-v2/types.d.ts +2 -0
- package/dist/ui-v2/types.d.ts.map +1 -0
- package/dist/ui-v2/types.js +18 -0
- package/dist/ui-v2/types.js.map +1 -0
- package/dist/utils/token-estimate.d.ts +42 -0
- package/dist/utils/token-estimate.d.ts.map +1 -0
- package/dist/utils/token-estimate.js +150 -0
- package/dist/utils/token-estimate.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,1247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TerminalInputComposer = exports.TerminalEventSink = void 0;
|
|
7
|
+
exports.resolveTerminalSessionPickerInput = resolveTerminalSessionPickerInput;
|
|
8
|
+
exports.formatTerminalErrorMessage = formatTerminalErrorMessage;
|
|
9
|
+
exports.inferTerminalErrorLayer = inferTerminalErrorLayer;
|
|
10
|
+
exports.formatTerminalStatusMessage = formatTerminalStatusMessage;
|
|
11
|
+
exports.formatTerminalSessionRestored = formatTerminalSessionRestored;
|
|
12
|
+
exports.visibleLength = visibleLength;
|
|
13
|
+
exports.terminalContentWidth = terminalContentWidth;
|
|
14
|
+
exports.truncateTerminalText = truncateTerminalText;
|
|
15
|
+
exports.renderTerminalCapabilitySummary = renderTerminalCapabilitySummary;
|
|
16
|
+
exports.formatTerminalSessionPickerItem = formatTerminalSessionPickerItem;
|
|
17
|
+
exports.formatTerminalSessionPickerHeader = formatTerminalSessionPickerHeader;
|
|
18
|
+
exports.formatTerminalEditPreviewHeader = formatTerminalEditPreviewHeader;
|
|
19
|
+
exports.formatTerminalEditPreviewCandidate = formatTerminalEditPreviewCandidate;
|
|
20
|
+
exports.renderTerminalBanner = renderTerminalBanner;
|
|
21
|
+
exports.renderTerminalContextStatus = renderTerminalContextStatus;
|
|
22
|
+
exports.promptText = promptText;
|
|
23
|
+
exports.formatTerminalPermissionPrompt = formatTerminalPermissionPrompt;
|
|
24
|
+
exports.parseEditInput = parseEditInput;
|
|
25
|
+
exports.renderTerminalShortcuts = renderTerminalShortcuts;
|
|
26
|
+
exports.normalizeTerminalAnswer = normalizeTerminalAnswer;
|
|
27
|
+
exports.launchTerminalUI = launchTerminalUI;
|
|
28
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
29
|
+
const string_width_1 = __importDefault(require("string-width"));
|
|
30
|
+
const agent_runtime_controller_1 = require("../runtime/agent-runtime-controller");
|
|
31
|
+
const agent_runtime_protocol_1 = require("../runtime/agent-runtime-protocol");
|
|
32
|
+
const ui_events_1 = require("../runtime/ui-events");
|
|
33
|
+
const ui_view_model_1 = require("../runtime/ui-view-model");
|
|
34
|
+
const format_1 = require("../services/format");
|
|
35
|
+
const redaction_1 = require("../services/redaction");
|
|
36
|
+
const completion_1 = require("./completion");
|
|
37
|
+
const editor_1 = require("./editor");
|
|
38
|
+
const raw_editor_1 = require("./raw-editor");
|
|
39
|
+
const output_queue_1 = require("./output-queue");
|
|
40
|
+
const target_command_1 = require("../commands/target-command");
|
|
41
|
+
const coordinator_1 = require("../runtime/goals/coordinator");
|
|
42
|
+
const ACCENT = chalk_1.default.hex('#80E6E8');
|
|
43
|
+
const DIM = chalk_1.default.hex('#567089');
|
|
44
|
+
const ERROR = chalk_1.default.hex('#FF7A7A');
|
|
45
|
+
const WARNING = chalk_1.default.hex('#F2C14E');
|
|
46
|
+
const TOOL = chalk_1.default.hex('#7FA2B8');
|
|
47
|
+
const BORDER = chalk_1.default.hex('#38556A');
|
|
48
|
+
function stripTrailingNewlines(text) {
|
|
49
|
+
return text.replace(/\n+$/g, '');
|
|
50
|
+
}
|
|
51
|
+
function normalizePickerText(value) {
|
|
52
|
+
return value.trim().toLowerCase();
|
|
53
|
+
}
|
|
54
|
+
function matchingSessionLabels(session) {
|
|
55
|
+
return [session.name, session.taskSummary].filter((value) => Boolean(value?.trim()));
|
|
56
|
+
}
|
|
57
|
+
function findSessionsByText(input, sessions) {
|
|
58
|
+
const query = normalizePickerText(input);
|
|
59
|
+
if (!query)
|
|
60
|
+
return [];
|
|
61
|
+
const canMatchIdPrefix = query.length >= 4;
|
|
62
|
+
return sessions.filter(session => {
|
|
63
|
+
const id = session.id.toLowerCase();
|
|
64
|
+
if (id === query || (canMatchIdPrefix && id.startsWith(query)))
|
|
65
|
+
return true;
|
|
66
|
+
return matchingSessionLabels(session).some(label => normalizePickerText(label).includes(query));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function findSessionsByExactLabel(input, sessions) {
|
|
70
|
+
const query = normalizePickerText(input);
|
|
71
|
+
if (!query)
|
|
72
|
+
return [];
|
|
73
|
+
return sessions.filter(session => matchingSessionLabels(session).some(label => normalizePickerText(label) === query));
|
|
74
|
+
}
|
|
75
|
+
function resolveTerminalSessionPickerInput(input, request) {
|
|
76
|
+
const trimmed = input.trim();
|
|
77
|
+
if (!trimmed)
|
|
78
|
+
return { type: 'cancelled' };
|
|
79
|
+
if (trimmed.startsWith('/'))
|
|
80
|
+
return { type: 'slash', input: trimmed };
|
|
81
|
+
if (trimmed === '--last') {
|
|
82
|
+
const latest = request.sessions[0];
|
|
83
|
+
if (latest)
|
|
84
|
+
return { type: 'selected', sessionId: latest.id };
|
|
85
|
+
return { type: 'error', message: 'No recent session to resume.' };
|
|
86
|
+
}
|
|
87
|
+
const explicitIndex = trimmed.match(/^#(\d+)$/);
|
|
88
|
+
if (explicitIndex) {
|
|
89
|
+
const index = Number(explicitIndex[1]) - 1;
|
|
90
|
+
const selected = request.sessions[index];
|
|
91
|
+
if (selected)
|
|
92
|
+
return { type: 'selected', sessionId: selected.id };
|
|
93
|
+
return { type: 'error', message: `No session at index ${explicitIndex[1]}.` };
|
|
94
|
+
}
|
|
95
|
+
const numeric = trimmed.match(/^(\d+)$/);
|
|
96
|
+
if (numeric) {
|
|
97
|
+
const index = Number(numeric[1]) - 1;
|
|
98
|
+
const selected = request.sessions[index];
|
|
99
|
+
if (selected)
|
|
100
|
+
return { type: 'selected', sessionId: selected.id };
|
|
101
|
+
}
|
|
102
|
+
const matches = findSessionsByText(trimmed, request.sessions);
|
|
103
|
+
if (matches.length === 1) {
|
|
104
|
+
return { type: 'selected', sessionId: matches[0].id };
|
|
105
|
+
}
|
|
106
|
+
if (matches.length > 1) {
|
|
107
|
+
const preview = matches
|
|
108
|
+
.slice(0, 3)
|
|
109
|
+
.map(session => `${session.id.slice(0, 8)} ${(0, ui_view_model_1.sessionPickerTitle)(session)}`)
|
|
110
|
+
.join(', ');
|
|
111
|
+
const suffix = matches.length > 3 ? `, +${matches.length - 3} more` : '';
|
|
112
|
+
return {
|
|
113
|
+
type: 'error',
|
|
114
|
+
message: `Multiple sessions match "${trimmed}": ${preview}${suffix}. Type a number or a longer session id.`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (numeric) {
|
|
118
|
+
return {
|
|
119
|
+
type: 'error',
|
|
120
|
+
message: `No session at index ${numeric[1]} or id prefix "${trimmed}".`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
type: 'error',
|
|
125
|
+
message: `No session matches "${trimmed}". Type a number, #number, session id prefix, or /resume --last.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function formatTranscriptEntry(entry) {
|
|
129
|
+
const content = stripTrailingNewlines(entry.content);
|
|
130
|
+
if (!content)
|
|
131
|
+
return '';
|
|
132
|
+
switch (entry.role) {
|
|
133
|
+
case 'user':
|
|
134
|
+
return `${ACCENT('›')} ${content}`;
|
|
135
|
+
case 'tool':
|
|
136
|
+
return TOOL(content);
|
|
137
|
+
case 'error':
|
|
138
|
+
return ERROR(formatTerminalErrorMessage(content, entry.errorLayer));
|
|
139
|
+
case 'status':
|
|
140
|
+
return DIM(content);
|
|
141
|
+
case 'command':
|
|
142
|
+
case 'system':
|
|
143
|
+
return content;
|
|
144
|
+
case 'assistant':
|
|
145
|
+
default:
|
|
146
|
+
return content;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const TERMINAL_ERROR_LAYERS = [
|
|
150
|
+
'renderer',
|
|
151
|
+
'runtime',
|
|
152
|
+
'provider',
|
|
153
|
+
'tool',
|
|
154
|
+
'session',
|
|
155
|
+
'memory',
|
|
156
|
+
'mcp',
|
|
157
|
+
'skills',
|
|
158
|
+
'unknown',
|
|
159
|
+
];
|
|
160
|
+
function formatTerminalErrorMessage(message, explicitLayer) {
|
|
161
|
+
const trimmed = message.trim();
|
|
162
|
+
if (!trimmed)
|
|
163
|
+
return trimmed;
|
|
164
|
+
if (hasErrorLayerPrefix(trimmed))
|
|
165
|
+
return trimmed;
|
|
166
|
+
if (explicitLayer) {
|
|
167
|
+
return `[${explicitLayer.toUpperCase()}] ${trimmed}`;
|
|
168
|
+
}
|
|
169
|
+
return `[${inferTerminalErrorLayer(trimmed)}] ${trimmed}`;
|
|
170
|
+
}
|
|
171
|
+
function hasErrorLayerPrefix(message) {
|
|
172
|
+
const lower = message.toLowerCase();
|
|
173
|
+
return TERMINAL_ERROR_LAYERS.some(layer => {
|
|
174
|
+
const label = layer.toLowerCase();
|
|
175
|
+
return (lower.startsWith(`[${label}] `) ||
|
|
176
|
+
lower.startsWith(`error [${label}]:`) ||
|
|
177
|
+
lower.startsWith(`error: [${label}] `));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function inferTerminalErrorLayer(message) {
|
|
181
|
+
const lower = message.toLowerCase();
|
|
182
|
+
if (/\bmcp\b/u.test(lower))
|
|
183
|
+
return 'MCP';
|
|
184
|
+
if (/\b(skill|skills)\b/u.test(lower))
|
|
185
|
+
return 'skills';
|
|
186
|
+
if (/\b(memory|vector store|recall|forget)\b/u.test(lower))
|
|
187
|
+
return 'memory';
|
|
188
|
+
if (/\b(session|resume|compact)\b/u.test(lower))
|
|
189
|
+
return 'session';
|
|
190
|
+
if (/\b(renderer|terminal|tty|prompt|resize|input editor|scrollback)\b/u.test(lower))
|
|
191
|
+
return 'renderer';
|
|
192
|
+
if (/\btool\b/u.test(lower) ||
|
|
193
|
+
/\b(exec_command|read_file|write_file|edit_file|grep|glob|list_files)\b/u.test(lower) ||
|
|
194
|
+
/command exited with code/u.test(lower) ||
|
|
195
|
+
/path is a directory|not a file|enoent|eacces/u.test(lower)) {
|
|
196
|
+
return 'tool';
|
|
197
|
+
}
|
|
198
|
+
if (/\b(provider|model|llm|api|quota|rate limit|rate_limit|provider_busy)\b/u.test(lower) ||
|
|
199
|
+
/\b(openai|anthropic|dashscope|bailian|xunfei|glm|qwen)\b/u.test(lower) ||
|
|
200
|
+
/\bstatus code\b/u.test(lower) ||
|
|
201
|
+
/notEnoughCvError|engineInternalError/i.test(message)) {
|
|
202
|
+
return 'provider';
|
|
203
|
+
}
|
|
204
|
+
return 'runtime';
|
|
205
|
+
}
|
|
206
|
+
function shouldShowStatus(message) {
|
|
207
|
+
return Boolean(message.trim());
|
|
208
|
+
}
|
|
209
|
+
function formatTerminalStatusMessage(message, width = terminalContentWidth(120)) {
|
|
210
|
+
return truncateTerminalText(message.replace(/\s+/g, ' ').trim(), Math.max(1, width));
|
|
211
|
+
}
|
|
212
|
+
function formatTargetCommandResult(input, coordinator) {
|
|
213
|
+
switch (input.action) {
|
|
214
|
+
case 'show': {
|
|
215
|
+
const goal = coordinator?.goal;
|
|
216
|
+
if (goal) {
|
|
217
|
+
const status = goal.status;
|
|
218
|
+
const obj = goal.objective.length > 60 ? goal.objective.slice(0, 57) + '...' : goal.objective;
|
|
219
|
+
const turns = goal.continuationCount;
|
|
220
|
+
const tokens = goal.tokensUsed >= 1000 ? `${(goal.tokensUsed / 1000).toFixed(1)}K` : String(goal.tokensUsed);
|
|
221
|
+
return `Target: ${status} · ${obj} · ${turns} turns · ${tokens} tokens`;
|
|
222
|
+
}
|
|
223
|
+
return 'Target: no active goal. Use /target <objective> to create one.';
|
|
224
|
+
}
|
|
225
|
+
case 'create':
|
|
226
|
+
return `Goal created: ${input.payload?.objective ?? ''}`;
|
|
227
|
+
case 'pause':
|
|
228
|
+
return 'Goal paused. Use /target resume to continue.';
|
|
229
|
+
case 'resume':
|
|
230
|
+
return 'Goal resumed. Will continue when runtime is idle.';
|
|
231
|
+
case 'edit':
|
|
232
|
+
return `Goal updated: ${input.payload?.objective ?? ''}`;
|
|
233
|
+
case 'replace':
|
|
234
|
+
return `Goal replaced: ${input.payload?.objective ?? ''}`;
|
|
235
|
+
case 'clear':
|
|
236
|
+
return 'Goal cleared.';
|
|
237
|
+
case 'set_budget':
|
|
238
|
+
return input.payload?.tokenBudget
|
|
239
|
+
? `Goal token budget set to ${input.payload.tokenBudget}.`
|
|
240
|
+
: 'Goal token budget removed.';
|
|
241
|
+
default:
|
|
242
|
+
return 'Target command processed.';
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function formatTerminalSessionRestored(event) {
|
|
246
|
+
const width = terminalContentWidth(120);
|
|
247
|
+
const view = (0, ui_view_model_1.createSessionRestoredView)(event);
|
|
248
|
+
const fitLine = (prefix, value) => {
|
|
249
|
+
const prefixWidth = visibleLength(prefix);
|
|
250
|
+
if (prefixWidth >= width) {
|
|
251
|
+
return truncateTerminalText(prefix, width);
|
|
252
|
+
}
|
|
253
|
+
return `${prefix}${truncateTerminalText(value, width - prefixWidth)}`;
|
|
254
|
+
};
|
|
255
|
+
const lines = [
|
|
256
|
+
truncateTerminalText(view.headline, width),
|
|
257
|
+
fitLine(` Model: ${view.model} · Project: `, view.projectPath),
|
|
258
|
+
];
|
|
259
|
+
if (view.summary) {
|
|
260
|
+
lines.push(fitLine(' Summary: ', (0, redaction_1.redactTraceText)(view.summary)));
|
|
261
|
+
}
|
|
262
|
+
if (view.summaryGeneratedAt) {
|
|
263
|
+
const origin = view.checkpointId ? 'compact checkpoint' : 'generated on resume';
|
|
264
|
+
lines.push(` Generated: ${new Date(view.summaryGeneratedAt).toLocaleString()} (${origin})`);
|
|
265
|
+
}
|
|
266
|
+
if (typeof view.summaryCoveredMessages === 'number') {
|
|
267
|
+
lines.push(` Covers: ${view.summaryCoveredMessages} source messages`);
|
|
268
|
+
}
|
|
269
|
+
if (typeof view.transcriptMessages === 'number') {
|
|
270
|
+
lines.push(`✔ Restored ${view.restoredMessages} model-context messages / ${view.transcriptMessages} transcript messages`);
|
|
271
|
+
}
|
|
272
|
+
return lines.join('\n');
|
|
273
|
+
}
|
|
274
|
+
class DirectTerminalWriter {
|
|
275
|
+
write(text) {
|
|
276
|
+
process.stdout.write(text);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const ANSI_PATTERN = /\x1b\[[0-9;?]*[A-Za-z]/g;
|
|
280
|
+
function visibleLength(text) {
|
|
281
|
+
return (0, string_width_1.default)(stripTrailingNewlines(text).replace(ANSI_PATTERN, ''));
|
|
282
|
+
}
|
|
283
|
+
function terminalContentWidth(fallback = 88) {
|
|
284
|
+
const columns = process.stdout.columns;
|
|
285
|
+
if (typeof columns === 'number' && columns > 0) {
|
|
286
|
+
return Math.max(1, Math.min(columns, 200));
|
|
287
|
+
}
|
|
288
|
+
const envColumns = Number(process.env.COLUMNS);
|
|
289
|
+
if (Number.isFinite(envColumns) && envColumns > 0) {
|
|
290
|
+
return Math.max(1, Math.min(envColumns, 200));
|
|
291
|
+
}
|
|
292
|
+
return Math.max(60, Math.min(fallback, 200));
|
|
293
|
+
}
|
|
294
|
+
function truncateTerminalText(text, maxWidth) {
|
|
295
|
+
if (maxWidth <= 0)
|
|
296
|
+
return '';
|
|
297
|
+
if ((0, string_width_1.default)(text) <= maxWidth)
|
|
298
|
+
return text;
|
|
299
|
+
if (maxWidth <= 3)
|
|
300
|
+
return '.'.repeat(maxWidth);
|
|
301
|
+
let output = '';
|
|
302
|
+
for (const char of Array.from(text)) {
|
|
303
|
+
if ((0, string_width_1.default)(`${output}${char}...`) > maxWidth)
|
|
304
|
+
break;
|
|
305
|
+
output += char;
|
|
306
|
+
}
|
|
307
|
+
return `${output}...`;
|
|
308
|
+
}
|
|
309
|
+
function bannerRow(content, width) {
|
|
310
|
+
const innerWidth = Math.max(0, width - 2);
|
|
311
|
+
const safeContent = visibleLength(content) > innerWidth
|
|
312
|
+
? truncateTerminalText(content.replace(ANSI_PATTERN, ''), innerWidth)
|
|
313
|
+
: content;
|
|
314
|
+
const padding = ' '.repeat(Math.max(0, innerWidth - visibleLength(safeContent)));
|
|
315
|
+
return `${BORDER('│')}${safeContent}${padding}${BORDER('│')}`;
|
|
316
|
+
}
|
|
317
|
+
function renderTerminalCapabilitySummary(runtime) {
|
|
318
|
+
const snapshot = runtime.store.getSnapshot();
|
|
319
|
+
return (0, ui_view_model_1.createRuntimeCapabilitySummary)({
|
|
320
|
+
projectInstructionsContent: snapshot.projectInstructionsContent,
|
|
321
|
+
skillsContent: snapshot.skillsContent,
|
|
322
|
+
memoryContent: snapshot.memoryContent,
|
|
323
|
+
tools: snapshot.tools,
|
|
324
|
+
webSearchConfigured: Boolean(runtime.config.webSearch),
|
|
325
|
+
}).text;
|
|
326
|
+
}
|
|
327
|
+
function formatTerminalSessionPickerItem(item, width = terminalContentWidth(120)) {
|
|
328
|
+
const safeWidth = Math.max(1, width);
|
|
329
|
+
const prefixPlain = `${String(item.globalIndex).padStart(2, ' ')}. ${item.shortId} `;
|
|
330
|
+
const prefix = `${String(item.globalIndex).padStart(2, ' ')}. ${ACCENT(item.shortId)} `;
|
|
331
|
+
const size = (0, format_1.formatBytes)(item.historySizeBytes);
|
|
332
|
+
const project = item.showProject ? ` ${item.projectPath}` : '';
|
|
333
|
+
const metadataCandidates = [
|
|
334
|
+
`${item.messageCount} msgs ${size} ${item.model}${project}`,
|
|
335
|
+
`${item.messageCount} msgs ${size} ${item.model}`,
|
|
336
|
+
`${item.messageCount} msgs ${size}`,
|
|
337
|
+
`${item.messageCount} msgs`,
|
|
338
|
+
'',
|
|
339
|
+
];
|
|
340
|
+
for (const metadata of metadataCandidates) {
|
|
341
|
+
const suffixPlain = metadata ? ` ${metadata}` : '';
|
|
342
|
+
const titleBudget = safeWidth - visibleLength(prefixPlain) - visibleLength(suffixPlain);
|
|
343
|
+
if (titleBudget < 8)
|
|
344
|
+
continue;
|
|
345
|
+
const title = truncateTerminalText(item.title, titleBudget);
|
|
346
|
+
const row = `${prefix}${title}${metadata ? ` ${DIM(metadata)}` : ''}`;
|
|
347
|
+
if (visibleLength(row) <= safeWidth)
|
|
348
|
+
return row;
|
|
349
|
+
}
|
|
350
|
+
return truncateTerminalText(`${String(item.globalIndex).padStart(2, ' ')}. ${item.shortId} ${item.title}`, safeWidth);
|
|
351
|
+
}
|
|
352
|
+
function formatTerminalSessionPickerHeader(title, page, pageCount, width = terminalContentWidth(120)) {
|
|
353
|
+
const safeWidth = Math.max(1, width);
|
|
354
|
+
const pageLabelPlain = ` page ${page}/${pageCount}`;
|
|
355
|
+
const titleBudget = safeWidth - visibleLength(pageLabelPlain);
|
|
356
|
+
if (titleBudget < 4) {
|
|
357
|
+
return truncateTerminalText(`${title}${pageLabelPlain}`, safeWidth);
|
|
358
|
+
}
|
|
359
|
+
return `${ACCENT(truncateTerminalText(title, titleBudget))}${DIM(pageLabelPlain)}`;
|
|
360
|
+
}
|
|
361
|
+
function formatSessionPickerInstruction(width) {
|
|
362
|
+
const text = width < 72
|
|
363
|
+
? 'Select number/id, n/p page, empty cancels.'
|
|
364
|
+
: 'Type number/#number, session id prefix, unique title text, or /resume --last. Empty input cancels.';
|
|
365
|
+
return truncateTerminalText(text, Math.max(1, width));
|
|
366
|
+
}
|
|
367
|
+
function editPreviewKindLabel(request) {
|
|
368
|
+
return request.kind === 'fuzzy' ? `fuzzy (${request.strategy ?? 'match'})` : 'exact';
|
|
369
|
+
}
|
|
370
|
+
function formatTerminalEditPreviewHeader(request, width = terminalContentWidth(120)) {
|
|
371
|
+
return ACCENT(truncateTerminalText(`Edit Preview: ${request.path} (${editPreviewKindLabel(request)})`, Math.max(1, width)));
|
|
372
|
+
}
|
|
373
|
+
function formatTerminalEditPreviewCandidate(candidate, newString, width = terminalContentWidth(120)) {
|
|
374
|
+
const safeWidth = Math.max(1, width);
|
|
375
|
+
const prefix = ` line ${String(candidate.line).padStart(3, ' ')} `;
|
|
376
|
+
const fixedWidth = visibleLength(`${prefix}"" → ""`);
|
|
377
|
+
const contentBudget = safeWidth - fixedWidth;
|
|
378
|
+
if (contentBudget < 8) {
|
|
379
|
+
return truncateTerminalText(`${prefix}"${candidate.match}" → "${newString}"`, safeWidth);
|
|
380
|
+
}
|
|
381
|
+
const matchBudget = Math.max(1, Math.floor(contentBudget * 0.6));
|
|
382
|
+
const replacementBudget = Math.max(1, contentBudget - matchBudget);
|
|
383
|
+
const row = [
|
|
384
|
+
prefix,
|
|
385
|
+
`"${truncateTerminalText(candidate.match, matchBudget)}"`,
|
|
386
|
+
' → ',
|
|
387
|
+
`"${truncateTerminalText(newString, replacementBudget)}"`,
|
|
388
|
+
].join('');
|
|
389
|
+
return visibleLength(row) <= safeWidth ? row : truncateTerminalText(row, safeWidth);
|
|
390
|
+
}
|
|
391
|
+
class TerminalEventSink {
|
|
392
|
+
constructor(runtime, writer = new DirectTerminalWriter()) {
|
|
393
|
+
this.runtime = runtime;
|
|
394
|
+
this.writer = writer;
|
|
395
|
+
this.entries = new Map();
|
|
396
|
+
this.printedContent = new Map();
|
|
397
|
+
this.pendingAssistantOutput = new Map();
|
|
398
|
+
this.finalizedEntryIds = new Set();
|
|
399
|
+
this.idCounter = 0;
|
|
400
|
+
this.pendingPicker = null;
|
|
401
|
+
this.pickerOffset = 0;
|
|
402
|
+
this.pendingEditPreview = null;
|
|
403
|
+
this.lastStatusMessage = '';
|
|
404
|
+
/**
|
|
405
|
+
* R8: typed subagent timeline, keyed by taskId. The chat-controller's
|
|
406
|
+
* transcript summary drives the visible terminal output (so we do not
|
|
407
|
+
* double-print); this map is the structured source for parity tests and
|
|
408
|
+
* future timeline rendering.
|
|
409
|
+
*/
|
|
410
|
+
this.subtaskTimeline = new Map();
|
|
411
|
+
}
|
|
412
|
+
append(entry) {
|
|
413
|
+
const id = `terminal-${++this.idCounter}`;
|
|
414
|
+
const { live, ...transcriptEntry } = entry;
|
|
415
|
+
const fullEntry = {
|
|
416
|
+
id,
|
|
417
|
+
...transcriptEntry,
|
|
418
|
+
};
|
|
419
|
+
this.entries.set(id, fullEntry);
|
|
420
|
+
const finalized = live !== true;
|
|
421
|
+
const write = this.printEntry(fullEntry, finalized);
|
|
422
|
+
if (finalized) {
|
|
423
|
+
if (write instanceof Promise) {
|
|
424
|
+
void write.then(written => {
|
|
425
|
+
if (written)
|
|
426
|
+
this.releaseEntryBody(id);
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
this.releaseEntryBody(id);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return id;
|
|
434
|
+
}
|
|
435
|
+
update(id, patch) {
|
|
436
|
+
const existing = this.entries.get(id);
|
|
437
|
+
if (!existing)
|
|
438
|
+
return;
|
|
439
|
+
const next = { ...existing, ...patch };
|
|
440
|
+
this.entries.set(id, next);
|
|
441
|
+
this.printEntry(next, false);
|
|
442
|
+
}
|
|
443
|
+
finalize(id, patch) {
|
|
444
|
+
const existing = this.entries.get(id);
|
|
445
|
+
if (!existing)
|
|
446
|
+
return;
|
|
447
|
+
const next = patch ? { ...existing, ...patch } : existing;
|
|
448
|
+
this.entries.set(id, next);
|
|
449
|
+
const write = this.printEntry(next, true);
|
|
450
|
+
if (write instanceof Promise) {
|
|
451
|
+
void write.then(written => {
|
|
452
|
+
if (written)
|
|
453
|
+
this.releaseEntryBody(id);
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
this.releaseEntryBody(id);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
remove(id) {
|
|
461
|
+
this.entries.delete(id);
|
|
462
|
+
this.printedContent.delete(id);
|
|
463
|
+
this.pendingAssistantOutput.delete(id);
|
|
464
|
+
this.finalizedEntryIds.delete(id);
|
|
465
|
+
}
|
|
466
|
+
replaceTranscript(entries) {
|
|
467
|
+
this.entries.clear();
|
|
468
|
+
this.printedContent.clear();
|
|
469
|
+
this.pendingAssistantOutput.clear();
|
|
470
|
+
if (entries.length === 0)
|
|
471
|
+
return;
|
|
472
|
+
this.writer.write(`\n${BORDER('─'.repeat(terminalContentWidth(80)))}\n`);
|
|
473
|
+
this.writer.write(`${DIM('Restored conversation')}\n\n`);
|
|
474
|
+
for (const entry of entries) {
|
|
475
|
+
const formatted = formatTranscriptEntry(entry);
|
|
476
|
+
if (formatted) {
|
|
477
|
+
this.writer.write(`${formatted}\n\n`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
clearTranscript() {
|
|
482
|
+
this.entries.clear();
|
|
483
|
+
this.printedContent.clear();
|
|
484
|
+
this.pendingAssistantOutput.clear();
|
|
485
|
+
this.writer.write(`${DIM('View marker reset. Terminal scrollback is preserved.')}\n`);
|
|
486
|
+
}
|
|
487
|
+
setStatus(message) {
|
|
488
|
+
if (!shouldShowStatus(message))
|
|
489
|
+
return;
|
|
490
|
+
if (message === this.lastStatusMessage)
|
|
491
|
+
return;
|
|
492
|
+
this.lastStatusMessage = message;
|
|
493
|
+
this.writer.write(`${DIM(formatTerminalStatusMessage(message))}\n`);
|
|
494
|
+
}
|
|
495
|
+
showSessionPicker(request) {
|
|
496
|
+
this.pendingPicker = request;
|
|
497
|
+
this.pickerOffset = 0;
|
|
498
|
+
this.printSessionPickerPage();
|
|
499
|
+
}
|
|
500
|
+
showEditPreview(request) {
|
|
501
|
+
this.pendingEditPreview = request;
|
|
502
|
+
const rowWidth = terminalContentWidth(120);
|
|
503
|
+
this.writer.write(`\n${formatTerminalEditPreviewHeader(request, rowWidth)}\n`);
|
|
504
|
+
this.writer.write(`${BORDER('─'.repeat(terminalContentWidth(80)))}\n`);
|
|
505
|
+
request.candidates.slice(0, 10).forEach(c => {
|
|
506
|
+
this.writer.write(`${formatTerminalEditPreviewCandidate(c, request.newString, rowWidth)}\n`);
|
|
507
|
+
});
|
|
508
|
+
if (request.candidates.length > 10) {
|
|
509
|
+
this.writer.write(`${DIM(truncateTerminalText(` ... ${request.candidates.length - 10} more candidates`, rowWidth))}\n`);
|
|
510
|
+
}
|
|
511
|
+
this.writer.write(`${DIM(truncateTerminalText('Press Enter to dismiss.', rowWidth))}\n`);
|
|
512
|
+
}
|
|
513
|
+
sessionRestored(event) {
|
|
514
|
+
this.append({
|
|
515
|
+
role: 'status',
|
|
516
|
+
title: 'resume',
|
|
517
|
+
content: formatTerminalSessionRestored(event),
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
setProcessing(_processing) {
|
|
521
|
+
// The stable terminal UI is append-only, so there is no live spinner state.
|
|
522
|
+
}
|
|
523
|
+
consumePendingSelection(input) {
|
|
524
|
+
const picker = this.pendingPicker;
|
|
525
|
+
if (picker) {
|
|
526
|
+
const navigation = normalizePickerText(input);
|
|
527
|
+
const direction = navigation === 'n' || navigation === 'next'
|
|
528
|
+
? 1
|
|
529
|
+
: navigation === 'p' || navigation === 'prev' || navigation === 'previous'
|
|
530
|
+
? -1
|
|
531
|
+
: 0;
|
|
532
|
+
if (direction !== 0 && findSessionsByExactLabel(input, picker.sessions).length === 0) {
|
|
533
|
+
this.moveSessionPickerPage(direction);
|
|
534
|
+
return '';
|
|
535
|
+
}
|
|
536
|
+
const selection = resolveTerminalSessionPickerInput(input, picker);
|
|
537
|
+
switch (selection.type) {
|
|
538
|
+
case 'cancelled':
|
|
539
|
+
this.pendingPicker = null;
|
|
540
|
+
this.pickerOffset = 0;
|
|
541
|
+
this.writer.write(`${DIM('Session picker cancelled.')}\n`);
|
|
542
|
+
return '';
|
|
543
|
+
case 'slash':
|
|
544
|
+
this.pendingPicker = null;
|
|
545
|
+
this.pickerOffset = 0;
|
|
546
|
+
return selection.input;
|
|
547
|
+
case 'selected':
|
|
548
|
+
this.pendingPicker = null;
|
|
549
|
+
this.pickerOffset = 0;
|
|
550
|
+
return {
|
|
551
|
+
type: 'select_session',
|
|
552
|
+
sessionId: selection.sessionId,
|
|
553
|
+
allProjects: picker.allProjects,
|
|
554
|
+
source: 'picker',
|
|
555
|
+
};
|
|
556
|
+
case 'error':
|
|
557
|
+
this.writer.write(`${ERROR(selection.message)}\n`);
|
|
558
|
+
return '';
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
// Dismiss pending edit preview on any input
|
|
562
|
+
if (this.pendingEditPreview) {
|
|
563
|
+
this.pendingEditPreview = null;
|
|
564
|
+
return '';
|
|
565
|
+
}
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
hasPendingInteraction() {
|
|
569
|
+
return Boolean(this.pendingPicker || this.pendingEditPreview);
|
|
570
|
+
}
|
|
571
|
+
printSessionPickerPage() {
|
|
572
|
+
const request = this.pendingPicker;
|
|
573
|
+
if (!request)
|
|
574
|
+
return;
|
|
575
|
+
const state = (0, ui_view_model_1.createSessionPickerState)(request, this.pickerOffset);
|
|
576
|
+
this.pickerOffset = state.visibleStart;
|
|
577
|
+
const rowWidth = terminalContentWidth(120);
|
|
578
|
+
this.writer.write(`\n${formatTerminalSessionPickerHeader(state.title, state.page, state.pageCount, rowWidth)}\n`);
|
|
579
|
+
this.writer.write(`${BORDER('─'.repeat(terminalContentWidth(80)))}\n`);
|
|
580
|
+
if (state.visibleItems.length === 0) {
|
|
581
|
+
this.writer.write(`${DIM('No saved sessions found.')}\n`);
|
|
582
|
+
}
|
|
583
|
+
state.visibleItems.forEach(item => {
|
|
584
|
+
this.writer.write(`${formatTerminalSessionPickerItem(item, rowWidth)}\n`);
|
|
585
|
+
});
|
|
586
|
+
if (state.totalItems > state.visibleLimit) {
|
|
587
|
+
this.writer.write(`${DIM(truncateTerminalText(`Showing ${state.visibleStart + 1}-${state.visibleStart + state.visibleItems.length} of ${state.totalItems}. Type n/next or p/prev to page.`, rowWidth))}\n`);
|
|
588
|
+
}
|
|
589
|
+
this.writer.write(`${DIM(formatSessionPickerInstruction(rowWidth))}\n`);
|
|
590
|
+
}
|
|
591
|
+
moveSessionPickerPage(delta) {
|
|
592
|
+
const request = this.pendingPicker;
|
|
593
|
+
if (!request)
|
|
594
|
+
return;
|
|
595
|
+
const state = (0, ui_view_model_1.createSessionPickerState)(request, this.pickerOffset);
|
|
596
|
+
const nextOffset = (0, ui_view_model_1.movePickerPageOffset)(state, delta);
|
|
597
|
+
if (nextOffset === this.pickerOffset) {
|
|
598
|
+
this.writer.write(`${DIM(delta > 0 ? 'Already at last session page.' : 'Already at first session page.')}\n`);
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
this.pickerOffset = nextOffset;
|
|
602
|
+
this.printSessionPickerPage();
|
|
603
|
+
}
|
|
604
|
+
printEntry(entry, finalized) {
|
|
605
|
+
if (!entry.content)
|
|
606
|
+
return;
|
|
607
|
+
if (entry.role === 'assistant') {
|
|
608
|
+
return this.printAssistantDelta(entry, finalized);
|
|
609
|
+
}
|
|
610
|
+
const previous = this.printedContent.get(entry.id);
|
|
611
|
+
if (previous === entry.content && !finalized)
|
|
612
|
+
return;
|
|
613
|
+
this.printedContent.set(entry.id, entry.content);
|
|
614
|
+
// v0.2.23: bound printed content.
|
|
615
|
+
this.evictIfNeeded(this.printedContent, TerminalEventSink.MAX_PRINTED_CONTENT);
|
|
616
|
+
const formatted = formatTranscriptEntry(entry);
|
|
617
|
+
if (formatted) {
|
|
618
|
+
return this.writeWithAcknowledgement(`${formatted}\n`);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
printAssistantDelta(entry, finalized) {
|
|
622
|
+
const previous = this.printedContent.get(entry.id) ?? '';
|
|
623
|
+
const next = entry.content;
|
|
624
|
+
if (next === previous && !finalized)
|
|
625
|
+
return;
|
|
626
|
+
const delta = next.startsWith(previous) ? next.slice(previous.length) : `\n${next}`;
|
|
627
|
+
const pending = `${this.pendingAssistantOutput.get(entry.id) ?? ''}${delta}`;
|
|
628
|
+
this.printedContent.set(entry.id, next);
|
|
629
|
+
// v0.2.23: bound printed content.
|
|
630
|
+
this.evictIfNeeded(this.printedContent, TerminalEventSink.MAX_PRINTED_CONTENT);
|
|
631
|
+
const shouldFlush = finalized || pending.includes('\n') || visibleLength(pending) >= 80;
|
|
632
|
+
if (shouldFlush) {
|
|
633
|
+
this.pendingAssistantOutput.delete(entry.id);
|
|
634
|
+
if (pending) {
|
|
635
|
+
return this.writeWithAcknowledgement(pending);
|
|
636
|
+
}
|
|
637
|
+
else if (finalized && next && !next.endsWith('\n')) {
|
|
638
|
+
return this.writeWithAcknowledgement('\n');
|
|
639
|
+
}
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this.pendingAssistantOutput.set(entry.id, pending);
|
|
643
|
+
}
|
|
644
|
+
writeWithAcknowledgement(text) {
|
|
645
|
+
if (this.writer.writeAsync)
|
|
646
|
+
return this.writer.writeAsync(text);
|
|
647
|
+
this.writer.write(text);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* R8: consume the typed subagent event into the shared timeline view-model.
|
|
651
|
+
* Does not print (the chat-controller transcript summary already drives
|
|
652
|
+
* visible terminal output); this is the structured source for parity.
|
|
653
|
+
*/
|
|
654
|
+
subtaskEvent(event) {
|
|
655
|
+
this.subtaskTimeline.set(event.taskId, (0, ui_view_model_1.subtaskEventToTimelineEntry)(event));
|
|
656
|
+
// v0.2.23: bound subtask timeline.
|
|
657
|
+
this.evictIfNeeded(this.subtaskTimeline, TerminalEventSink.MAX_SUBTASK_TIMELINE);
|
|
658
|
+
}
|
|
659
|
+
/** R8: read-only access to the typed subagent timeline (for parity tests). */
|
|
660
|
+
getSubtaskTimeline() {
|
|
661
|
+
return Array.from(this.subtaskTimeline.values());
|
|
662
|
+
}
|
|
663
|
+
// --- v0.2.23: bounded state helpers ---
|
|
664
|
+
/**
|
|
665
|
+
* After finalize, the entry content is in native scrollback.
|
|
666
|
+
* Replace the full body with a lightweight marker so memory doesn't grow
|
|
667
|
+
* with scrollback length.
|
|
668
|
+
*/
|
|
669
|
+
releaseEntryBody(id) {
|
|
670
|
+
const entry = this.entries.get(id);
|
|
671
|
+
if (!entry)
|
|
672
|
+
return;
|
|
673
|
+
// Keep role/id/title but replace heavy content with a marker.
|
|
674
|
+
this.entries.set(id, {
|
|
675
|
+
...entry,
|
|
676
|
+
content: `[scrollback:${entry.role} posted ${entry.content.length} chars]`,
|
|
677
|
+
});
|
|
678
|
+
this.printedContent.delete(id);
|
|
679
|
+
this.pendingAssistantOutput.delete(id);
|
|
680
|
+
this.finalizedEntryIds.delete(id);
|
|
681
|
+
this.finalizedEntryIds.add(id);
|
|
682
|
+
while (this.finalizedEntryIds.size > TerminalEventSink.MAX_FINALIZED_METADATA) {
|
|
683
|
+
const oldest = this.finalizedEntryIds.values().next().value;
|
|
684
|
+
if (!oldest)
|
|
685
|
+
break;
|
|
686
|
+
this.finalizedEntryIds.delete(oldest);
|
|
687
|
+
this.entries.delete(oldest);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Evict oldest entries from a Map when it exceeds the configured limit.
|
|
692
|
+
* Uses Map's insertion-order iteration — oldest entries are evicted first.
|
|
693
|
+
* Mirrors evictOldest in session-storage.ts; kept private to avoid a shared
|
|
694
|
+
* dependency on session-storage internals.
|
|
695
|
+
*/
|
|
696
|
+
evictIfNeeded(map, limit) {
|
|
697
|
+
while (map.size > limit) {
|
|
698
|
+
const firstKey = map.keys().next().value;
|
|
699
|
+
if (firstKey !== undefined)
|
|
700
|
+
map.delete(firstKey);
|
|
701
|
+
else
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
exports.TerminalEventSink = TerminalEventSink;
|
|
707
|
+
// --- v0.2.23: bounded state configuration ---
|
|
708
|
+
TerminalEventSink.MAX_FINALIZED_METADATA = 512;
|
|
709
|
+
TerminalEventSink.MAX_PRINTED_CONTENT = 512;
|
|
710
|
+
TerminalEventSink.MAX_SUBTASK_TIMELINE = 100;
|
|
711
|
+
function renderTerminalBanner(runtime) {
|
|
712
|
+
const width = Math.max(2, terminalContentWidth(88));
|
|
713
|
+
const line = '─'.repeat(Math.max(0, width - 2));
|
|
714
|
+
const firstLine = ` ${ACCENT.bold('ORION CODE | 猎户座')} ${DIM(`v${runtime.version}`)} ${DIM('stable terminal UI')}`;
|
|
715
|
+
const projectPrefix = ` ${DIM('Model')} ${ACCENT(runtime.config.model)} ${DIM('Project')} `;
|
|
716
|
+
const project = truncateTerminalText(runtime.cwd, Math.max(10, width - 2 - visibleLength(projectPrefix)));
|
|
717
|
+
const session = runtime.getSession()?.id.slice(0, 8) ?? 'new';
|
|
718
|
+
const renderer = runtime.config.ui?.renderer ?? 'terminal';
|
|
719
|
+
const rendererLine = ` ${DIM('Session')} ${ACCENT(session)} ${DIM('Renderer')} ${ACCENT(renderer)}`;
|
|
720
|
+
const capabilityPrefix = ` ${DIM('Capabilities')} `;
|
|
721
|
+
const capabilityText = renderTerminalCapabilitySummary(runtime);
|
|
722
|
+
const capabilities = truncateTerminalText(capabilityText, Math.max(10, width - 2 - visibleLength(capabilityPrefix)));
|
|
723
|
+
return [
|
|
724
|
+
'',
|
|
725
|
+
BORDER(`╭${line}╮`),
|
|
726
|
+
bannerRow(firstLine, width),
|
|
727
|
+
bannerRow(`${projectPrefix}${project}`, width),
|
|
728
|
+
bannerRow(rendererLine, width),
|
|
729
|
+
bannerRow(`${capabilityPrefix}${capabilities}`, width),
|
|
730
|
+
BORDER(`╰${line}╯`),
|
|
731
|
+
'',
|
|
732
|
+
'',
|
|
733
|
+
].join('\n');
|
|
734
|
+
}
|
|
735
|
+
function printBanner(runtime) {
|
|
736
|
+
process.stdout.write(renderTerminalBanner(runtime));
|
|
737
|
+
}
|
|
738
|
+
function renderTerminalContextStatus(runtime) {
|
|
739
|
+
const usage = runtime.store.getSnapshot().contextUsage;
|
|
740
|
+
const status = (0, ui_view_model_1.contextUsageStatusText)(usage);
|
|
741
|
+
if (!status)
|
|
742
|
+
return '';
|
|
743
|
+
return usage && usage.percent >= usage.warningThresholdPercent ? WARNING(status) : DIM(status);
|
|
744
|
+
}
|
|
745
|
+
function promptText(runtime) {
|
|
746
|
+
const session = runtime.getSession()?.id.slice(0, 8) ?? 'new';
|
|
747
|
+
const context = renderTerminalContextStatus(runtime);
|
|
748
|
+
return `${DIM(`[${session}]`)}${context ? ` ${context}` : ''} ${ACCENT('›')} `;
|
|
749
|
+
}
|
|
750
|
+
function compactPermissionValue(value, maxWidth) {
|
|
751
|
+
const singleLine = (0, redaction_1.redactTraceText)(value).replace(/\s+/g, ' ').trim();
|
|
752
|
+
return truncateTerminalText(singleLine, Math.max(8, maxWidth));
|
|
753
|
+
}
|
|
754
|
+
function formatTerminalPermissionScope(state) {
|
|
755
|
+
const width = terminalContentWidth(120);
|
|
756
|
+
const maxScopeWidth = Math.max(24, Math.min(72, Math.floor(width * 0.35)));
|
|
757
|
+
return compactPermissionValue((0, ui_view_model_1.permissionScopeDisplayValue)(state.scope), maxScopeWidth);
|
|
758
|
+
}
|
|
759
|
+
function formatTerminalPermissionPrompt(request, cwd) {
|
|
760
|
+
const state = (0, ui_view_model_1.createPermissionPromptState)(request, cwd);
|
|
761
|
+
const width = terminalContentWidth(120);
|
|
762
|
+
const budget = Math.max(1, width);
|
|
763
|
+
const base = `${ACCENT('?')} Allow tool ${ACCENT(state.toolName)}?`;
|
|
764
|
+
const options = DIM(`[${state.options.approve} ${state.options.deny}]`);
|
|
765
|
+
const scope = DIM(formatTerminalPermissionScope(state));
|
|
766
|
+
const cwdLabel = DIM(`cwd=${compactPermissionValue(state.cwd, Math.max(12, Math.min(48, Math.floor(width * 0.22))))}`);
|
|
767
|
+
const risk = DIM(`risk=${compactPermissionValue((0, ui_view_model_1.permissionRiskDisplayValue)(state.risk), Math.max(12, Math.min(48, Math.floor(width * 0.24))))}`);
|
|
768
|
+
const parts = [base, scope, cwdLabel, risk, options];
|
|
769
|
+
while (parts.length > 3 && visibleLength(`${parts.join(' ')} `) > budget) {
|
|
770
|
+
const riskIndex = parts.indexOf(risk);
|
|
771
|
+
if (riskIndex >= 0) {
|
|
772
|
+
parts.splice(riskIndex, 1);
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
const cwdIndex = parts.indexOf(cwdLabel);
|
|
776
|
+
if (cwdIndex >= 0) {
|
|
777
|
+
parts.splice(cwdIndex, 1);
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
let prompt = `${parts.join(' ')} `;
|
|
783
|
+
if (visibleLength(prompt) <= budget)
|
|
784
|
+
return prompt;
|
|
785
|
+
const fixed = `${base} ${options} `;
|
|
786
|
+
const scopeBudget = Math.max(8, budget - visibleLength(fixed) - 1);
|
|
787
|
+
prompt = `${base} ${DIM(truncateTerminalText(formatTerminalPermissionScope(state), scopeBudget))} ${options} `;
|
|
788
|
+
if (visibleLength(prompt) <= budget)
|
|
789
|
+
return prompt;
|
|
790
|
+
const optionWidth = visibleLength(options);
|
|
791
|
+
if (budget <= optionWidth + 1) {
|
|
792
|
+
return truncateTerminalText(`${stripTrailingNewlines(base)} ${stripTrailingNewlines(options)} `, budget);
|
|
793
|
+
}
|
|
794
|
+
const baseBudget = Math.max(1, budget - optionWidth - 2);
|
|
795
|
+
return `${truncateTerminalText(stripTrailingNewlines(base), baseBudget)} ${options} `;
|
|
796
|
+
}
|
|
797
|
+
function parseEditInput(input) {
|
|
798
|
+
const trimmed = input.trimStart();
|
|
799
|
+
if (trimmed === '/edit')
|
|
800
|
+
return { isEdit: true, initialContent: '' };
|
|
801
|
+
if (trimmed.startsWith('/edit ')) {
|
|
802
|
+
return { isEdit: true, initialContent: trimmed.slice('/edit '.length) };
|
|
803
|
+
}
|
|
804
|
+
return { isEdit: false, initialContent: '' };
|
|
805
|
+
}
|
|
806
|
+
function renderTerminalShortcuts() {
|
|
807
|
+
const width = terminalContentWidth(88);
|
|
808
|
+
if (width < 44) {
|
|
809
|
+
const rows = [
|
|
810
|
+
`${ACCENT('Shortcuts')}`,
|
|
811
|
+
`${BORDER('─'.repeat(Math.min(width, 32)))}`,
|
|
812
|
+
`${DIM('Enter')} send ${DIM('Tab')} complete`,
|
|
813
|
+
`${DIM('Ctrl+J')} newline`,
|
|
814
|
+
`${DIM('Ctrl+C')} interrupt; twice exits`,
|
|
815
|
+
`${DIM('/paste')} ${DIM('/edit')} ${DIM('/resume')}`,
|
|
816
|
+
`${DIM('/last-tool')} ${DIM('/trace')}`,
|
|
817
|
+
];
|
|
818
|
+
return `\n${rows.join('\n')}\n`;
|
|
819
|
+
}
|
|
820
|
+
if (width < 72) {
|
|
821
|
+
const rows = [
|
|
822
|
+
`${ACCENT('Shortcuts')}`,
|
|
823
|
+
`${BORDER('─'.repeat(Math.min(width, 40)))}`,
|
|
824
|
+
`${DIM('Enter')} send ${DIM('Tab')} complete ${DIM('↑/↓')} history`,
|
|
825
|
+
`${DIM('Alt+Enter/Ctrl+J')} newline`,
|
|
826
|
+
`${DIM('Ctrl+U/W')} edit ${DIM('Ctrl+C')} interrupt; twice exits`,
|
|
827
|
+
`${DIM('/paste')} multiline ${DIM('/edit')} editor ${DIM('/resume')} sessions`,
|
|
828
|
+
`${DIM('/last-tool')} tool detail ${DIM('/trace')} timeline`,
|
|
829
|
+
];
|
|
830
|
+
return `\n${rows.join('\n')}\n`;
|
|
831
|
+
}
|
|
832
|
+
const rows = [
|
|
833
|
+
`${ACCENT('Terminal shortcuts')}`,
|
|
834
|
+
`${BORDER('─'.repeat(48))}`,
|
|
835
|
+
`${DIM('Enter')} send current input`,
|
|
836
|
+
`${DIM('Alt+Enter')} insert newline (${DIM('Ctrl+J')} also works)`,
|
|
837
|
+
`${DIM('Tab')} complete slash command or @file mention`,
|
|
838
|
+
`${DIM('↑/↓')} navigate local input history`,
|
|
839
|
+
`${DIM('Ctrl+U')} clear current input`,
|
|
840
|
+
`${DIM('Ctrl+W')} delete previous word`,
|
|
841
|
+
`${DIM('Ctrl+C')} interrupt current turn; press twice to exit`,
|
|
842
|
+
`${DIM('/paste')} collect multiline input until /end`,
|
|
843
|
+
`${DIM('/edit')} open $VISUAL or $EDITOR for long input`,
|
|
844
|
+
`${DIM('/resume')} pick a session; use n/p to page results`,
|
|
845
|
+
`${DIM('/last-tool')} inspect the latest tool call/result`,
|
|
846
|
+
`${DIM('/trace')} show the ordered event timeline`,
|
|
847
|
+
];
|
|
848
|
+
return `\n${rows.join('\n')}\n`;
|
|
849
|
+
}
|
|
850
|
+
class TerminalInputComposer {
|
|
851
|
+
constructor() {
|
|
852
|
+
this.mode = null;
|
|
853
|
+
this.lines = [];
|
|
854
|
+
}
|
|
855
|
+
isActive() {
|
|
856
|
+
return this.mode !== null;
|
|
857
|
+
}
|
|
858
|
+
prompt(basePrompt) {
|
|
859
|
+
if (!this.mode)
|
|
860
|
+
return basePrompt;
|
|
861
|
+
const lineCount = Math.max(1, this.lines.length + 1);
|
|
862
|
+
const label = this.mode === 'paste' ? `paste ${lineCount}L` : `multi ${lineCount}L`;
|
|
863
|
+
return `${DIM(`[${label}]`)} ${ACCENT('…')} `;
|
|
864
|
+
}
|
|
865
|
+
receive(input) {
|
|
866
|
+
const trimmed = input.trim();
|
|
867
|
+
if (!this.mode && ['/paste', '/multi', '/multiline'].includes(trimmed)) {
|
|
868
|
+
this.mode = 'paste';
|
|
869
|
+
this.lines.length = 0;
|
|
870
|
+
return {
|
|
871
|
+
notice: DIM('Multiline input: paste or type lines, finish with /end, cancel with /cancel.'),
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
if (this.mode === 'paste') {
|
|
875
|
+
if (trimmed === '/cancel') {
|
|
876
|
+
this.reset();
|
|
877
|
+
return { cancelled: true, notice: DIM('Multiline input cancelled.') };
|
|
878
|
+
}
|
|
879
|
+
if (trimmed === '/end') {
|
|
880
|
+
const submitted = this.lines.join('\n').trimEnd();
|
|
881
|
+
this.reset();
|
|
882
|
+
return submitted
|
|
883
|
+
? { input: submitted }
|
|
884
|
+
: { cancelled: true, notice: DIM('Multiline input was empty.') };
|
|
885
|
+
}
|
|
886
|
+
this.lines.push(input);
|
|
887
|
+
return {};
|
|
888
|
+
}
|
|
889
|
+
if (this.mode === 'continuation') {
|
|
890
|
+
const continued = input.endsWith('\\');
|
|
891
|
+
this.lines.push(continued ? input.slice(0, -1) : input);
|
|
892
|
+
if (continued)
|
|
893
|
+
return {};
|
|
894
|
+
const submitted = this.lines.join('\n').trimEnd();
|
|
895
|
+
this.reset();
|
|
896
|
+
return submitted ? { input: submitted } : {};
|
|
897
|
+
}
|
|
898
|
+
if (input.endsWith('\\')) {
|
|
899
|
+
this.mode = 'continuation';
|
|
900
|
+
this.lines.length = 0;
|
|
901
|
+
this.lines.push(input.slice(0, -1));
|
|
902
|
+
return {};
|
|
903
|
+
}
|
|
904
|
+
return { input };
|
|
905
|
+
}
|
|
906
|
+
reset() {
|
|
907
|
+
this.mode = null;
|
|
908
|
+
this.lines.length = 0;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
exports.TerminalInputComposer = TerminalInputComposer;
|
|
912
|
+
function normalizeTerminalAnswer(input) {
|
|
913
|
+
let output = '';
|
|
914
|
+
let index = 0;
|
|
915
|
+
const popChar = () => {
|
|
916
|
+
const chars = Array.from(output);
|
|
917
|
+
chars.pop();
|
|
918
|
+
output = chars.join('');
|
|
919
|
+
};
|
|
920
|
+
while (index < input.length) {
|
|
921
|
+
const escapeMatch = input.slice(index).match(/^\x1b\[[0-?]*[ -/]*[@-~]/u);
|
|
922
|
+
if (escapeMatch) {
|
|
923
|
+
index += escapeMatch[0].length;
|
|
924
|
+
continue;
|
|
925
|
+
}
|
|
926
|
+
const char = input[index];
|
|
927
|
+
if (char === '\x7f' || char === '\b') {
|
|
928
|
+
popChar();
|
|
929
|
+
index++;
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
if (char === '\x15') {
|
|
933
|
+
output = '';
|
|
934
|
+
index++;
|
|
935
|
+
continue;
|
|
936
|
+
}
|
|
937
|
+
if (char === '\x17') {
|
|
938
|
+
output = output.replace(/\s*\S+\s*$/u, '');
|
|
939
|
+
index++;
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
if (char >= ' ' || char === '\t') {
|
|
943
|
+
output += char;
|
|
944
|
+
}
|
|
945
|
+
index++;
|
|
946
|
+
}
|
|
947
|
+
return output;
|
|
948
|
+
}
|
|
949
|
+
async function launchTerminalUI(runtime) {
|
|
950
|
+
printBanner(runtime);
|
|
951
|
+
let agentController;
|
|
952
|
+
let writer;
|
|
953
|
+
const editor = new raw_editor_1.RawTerminalEditor({
|
|
954
|
+
cwd: runtime.cwd,
|
|
955
|
+
onSubmit: input => handleInput(input),
|
|
956
|
+
onCtrlC: () => handleSigint(),
|
|
957
|
+
onNotice: message => { void writer.write(`${DIM(message)}\n`); },
|
|
958
|
+
});
|
|
959
|
+
const outputAdapter = {
|
|
960
|
+
write: text => editor.writeExternalBatch([text]),
|
|
961
|
+
on: (event, listener) => { process.stdout.on(event, listener); },
|
|
962
|
+
off: (event, listener) => { process.stdout.off(event, listener); },
|
|
963
|
+
};
|
|
964
|
+
const outputQueue = new output_queue_1.TerminalOutputQueue(outputAdapter);
|
|
965
|
+
let outputBatchSequence = 0;
|
|
966
|
+
writer = {
|
|
967
|
+
write: text => {
|
|
968
|
+
void outputQueue.enqueue({
|
|
969
|
+
id: `terminal-output-${++outputBatchSequence}`,
|
|
970
|
+
chunks: [text],
|
|
971
|
+
releaseEntryIds: [],
|
|
972
|
+
}).catch(() => undefined);
|
|
973
|
+
},
|
|
974
|
+
writeAsync: text => outputQueue.enqueue({
|
|
975
|
+
id: `terminal-output-${++outputBatchSequence}`,
|
|
976
|
+
chunks: [text],
|
|
977
|
+
releaseEntryIds: [],
|
|
978
|
+
}).then(() => true, () => false),
|
|
979
|
+
};
|
|
980
|
+
const events = new TerminalEventSink(runtime, writer);
|
|
981
|
+
let stopping = false;
|
|
982
|
+
let settled = false;
|
|
983
|
+
let resolveLaunch = null;
|
|
984
|
+
const composer = new TerminalInputComposer();
|
|
985
|
+
let confirmingTool = false;
|
|
986
|
+
const eventSink = {
|
|
987
|
+
emit: event => {
|
|
988
|
+
if (event.type !== 'permission_requested') {
|
|
989
|
+
return (0, agent_runtime_protocol_1.emitToUiEventSink)(events, event);
|
|
990
|
+
}
|
|
991
|
+
if (event.request.abortSignal?.aborted || stopping) {
|
|
992
|
+
agentController.handle({
|
|
993
|
+
type: 'permission_decision',
|
|
994
|
+
requestId: event.request.id,
|
|
995
|
+
approved: false,
|
|
996
|
+
source: 'programmatic',
|
|
997
|
+
});
|
|
998
|
+
return undefined;
|
|
999
|
+
}
|
|
1000
|
+
confirmingTool = true;
|
|
1001
|
+
void editor
|
|
1002
|
+
.ask(formatTerminalPermissionPrompt(event.request, runtime.cwd), event.request.abortSignal)
|
|
1003
|
+
.then(answer => {
|
|
1004
|
+
agentController.handle({
|
|
1005
|
+
type: 'permission_decision',
|
|
1006
|
+
requestId: event.request.id,
|
|
1007
|
+
approved: /^y(es)?$/i.test(answer.trim()),
|
|
1008
|
+
source: 'keyboard',
|
|
1009
|
+
});
|
|
1010
|
+
})
|
|
1011
|
+
.catch(() => {
|
|
1012
|
+
agentController.handle({
|
|
1013
|
+
type: 'permission_decision',
|
|
1014
|
+
requestId: event.request.id,
|
|
1015
|
+
approved: false,
|
|
1016
|
+
source: 'programmatic',
|
|
1017
|
+
});
|
|
1018
|
+
})
|
|
1019
|
+
.finally(() => {
|
|
1020
|
+
confirmingTool = false;
|
|
1021
|
+
prompt();
|
|
1022
|
+
});
|
|
1023
|
+
return undefined;
|
|
1024
|
+
},
|
|
1025
|
+
};
|
|
1026
|
+
// v0.2.24: initialize goal coordinator for /target mode.
|
|
1027
|
+
const goalCoordinator = new coordinator_1.GoalCoordinator(runtime.cwd, runtime.getSession()?.id ?? 'new');
|
|
1028
|
+
goalCoordinator.load();
|
|
1029
|
+
agentController = new agent_runtime_controller_1.AgentRuntimeController({
|
|
1030
|
+
runtime,
|
|
1031
|
+
eventSink,
|
|
1032
|
+
uiCapabilities: (0, ui_events_1.resolveUiRendererCapabilities)(undefined, 'terminal'),
|
|
1033
|
+
uiRenderer: 'terminal',
|
|
1034
|
+
useRuntimeToolPermissions: true,
|
|
1035
|
+
echoSubmittedInput: false,
|
|
1036
|
+
beforeTurn: () => writer.write('\n'),
|
|
1037
|
+
afterTurnLoop: () => {
|
|
1038
|
+
writer.write('\n');
|
|
1039
|
+
prompt();
|
|
1040
|
+
},
|
|
1041
|
+
onTurnError: error => {
|
|
1042
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1043
|
+
events.append({ role: 'error', content: message });
|
|
1044
|
+
},
|
|
1045
|
+
});
|
|
1046
|
+
agentController.setGoalCoordinator(goalCoordinator);
|
|
1047
|
+
const prompt = () => {
|
|
1048
|
+
if (stopping)
|
|
1049
|
+
return;
|
|
1050
|
+
editor.setPrompt(composer.prompt(promptText(runtime)));
|
|
1051
|
+
};
|
|
1052
|
+
const finishLaunch = () => {
|
|
1053
|
+
if (settled)
|
|
1054
|
+
return;
|
|
1055
|
+
settled = true;
|
|
1056
|
+
resolveLaunch?.();
|
|
1057
|
+
};
|
|
1058
|
+
const stop = async () => {
|
|
1059
|
+
if (stopping)
|
|
1060
|
+
return;
|
|
1061
|
+
stopping = true;
|
|
1062
|
+
await agentController.stopActiveTurn();
|
|
1063
|
+
try {
|
|
1064
|
+
await outputQueue.close();
|
|
1065
|
+
}
|
|
1066
|
+
catch {
|
|
1067
|
+
// Terminal output failure must not block shutdown.
|
|
1068
|
+
}
|
|
1069
|
+
finally {
|
|
1070
|
+
editor.stop();
|
|
1071
|
+
await runtime.shutdown();
|
|
1072
|
+
}
|
|
1073
|
+
process.stdout.write('\n');
|
|
1074
|
+
finishLaunch();
|
|
1075
|
+
};
|
|
1076
|
+
const handleInput = (rawInput) => {
|
|
1077
|
+
if (stopping)
|
|
1078
|
+
return;
|
|
1079
|
+
const answer = (0, completion_1.applyTerminalTabCompletion)(normalizeTerminalAnswer(rawInput), runtime.cwd);
|
|
1080
|
+
const submitted = answer.trim();
|
|
1081
|
+
if (agentController.hasActiveTurn()) {
|
|
1082
|
+
if (confirmingTool) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
if (!submitted) {
|
|
1086
|
+
prompt();
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
// v0.2.26: allow /target pause/status/resume even during active turn.
|
|
1090
|
+
if ((0, target_command_1.isTargetCommand)(answer)) {
|
|
1091
|
+
const parsed = (0, target_command_1.parseTargetCommand)(answer);
|
|
1092
|
+
if (parsed.ok && (parsed.input.action === 'pause' || parsed.input.action === 'show' || parsed.input.action === 'resume' || parsed.input.action === 'set_budget' || parsed.input.action === 'clear')) {
|
|
1093
|
+
// For pause/resume, interrupt the current turn first.
|
|
1094
|
+
if (parsed.input.action === 'pause' || parsed.input.action === 'resume') {
|
|
1095
|
+
agentController.handle({ type: 'interrupt', source: 'keyboard' });
|
|
1096
|
+
}
|
|
1097
|
+
events.append({
|
|
1098
|
+
role: 'system',
|
|
1099
|
+
content: formatTargetCommandResult(parsed.input, goalCoordinator),
|
|
1100
|
+
});
|
|
1101
|
+
agentController.handle(parsed.input);
|
|
1102
|
+
prompt();
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
const result = agentController.handle({ type: 'submit', text: answer, source: 'composer' });
|
|
1107
|
+
if (result.type === 'exit_requested') {
|
|
1108
|
+
void stop();
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
prompt();
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
agentController.handle({ type: 'clear_exit_intent' });
|
|
1115
|
+
if (!composer.isActive() && !events.hasPendingInteraction() && submitted === '?') {
|
|
1116
|
+
writer.write(renderTerminalShortcuts());
|
|
1117
|
+
prompt();
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
let input = !composer.isActive() ? events.consumePendingSelection(answer) : null;
|
|
1121
|
+
if (input === '') {
|
|
1122
|
+
prompt();
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
if (input && typeof input !== 'string') {
|
|
1126
|
+
const result = agentController.handle(input);
|
|
1127
|
+
if (result.type === 'exit_requested') {
|
|
1128
|
+
void stop();
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
input ?? (input = answer);
|
|
1134
|
+
if (!composer.isActive()) {
|
|
1135
|
+
// v0.2.24: intercept /target and /goal commands.
|
|
1136
|
+
if ((0, target_command_1.isTargetCommand)(input)) {
|
|
1137
|
+
const parsed = (0, target_command_1.parseTargetCommand)(input);
|
|
1138
|
+
if (parsed.ok) {
|
|
1139
|
+
events.append({
|
|
1140
|
+
role: 'system',
|
|
1141
|
+
content: formatTargetCommandResult(parsed.input, goalCoordinator),
|
|
1142
|
+
});
|
|
1143
|
+
// Route to controller for goal lifecycle.
|
|
1144
|
+
if (parsed.input.action !== 'show') {
|
|
1145
|
+
agentController.handle(parsed.input);
|
|
1146
|
+
}
|
|
1147
|
+
// v0.2.26: auto-start the first turn when a goal is created or resumed.
|
|
1148
|
+
if ((parsed.input.action === 'create' || parsed.input.action === 'resume') &&
|
|
1149
|
+
goalCoordinator?.isActive) {
|
|
1150
|
+
const req = goalCoordinator.buildContinuationRequest();
|
|
1151
|
+
if (req) {
|
|
1152
|
+
agentController.handle({
|
|
1153
|
+
type: 'submit',
|
|
1154
|
+
text: req.goal?.continuationIndex
|
|
1155
|
+
? `[goal continuation #${req.goal.continuationIndex}]`
|
|
1156
|
+
: 'Continue pursuing the goal.',
|
|
1157
|
+
source: 'programmatic',
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
events.append({ role: 'error', content: parsed.error });
|
|
1164
|
+
}
|
|
1165
|
+
prompt();
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
const edit = parseEditInput(input);
|
|
1169
|
+
if (edit.isEdit) {
|
|
1170
|
+
editor.stop();
|
|
1171
|
+
const result = (0, editor_1.openExternalEditor)({ initialContent: edit.initialContent });
|
|
1172
|
+
if (!stopping)
|
|
1173
|
+
editor.start();
|
|
1174
|
+
if (result.error) {
|
|
1175
|
+
events.append({
|
|
1176
|
+
role: 'error',
|
|
1177
|
+
content: `Editor failed: ${result.error}`,
|
|
1178
|
+
errorLayer: 'renderer',
|
|
1179
|
+
});
|
|
1180
|
+
prompt();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
if (result.cancelled || !result.content) {
|
|
1184
|
+
events.setStatus('Editor input cancelled.');
|
|
1185
|
+
prompt();
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
input = result.content;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
const composed = composer.receive(input);
|
|
1192
|
+
if (composed.notice)
|
|
1193
|
+
writer.write(`${composed.notice}\n`);
|
|
1194
|
+
if (composed.cancelled) {
|
|
1195
|
+
prompt();
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
if (composed.input === undefined) {
|
|
1199
|
+
prompt();
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
input = composed.input;
|
|
1203
|
+
if (!input.trim()) {
|
|
1204
|
+
prompt();
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
const result = agentController.handle({ type: 'submit', text: input, source: 'composer' });
|
|
1208
|
+
if (result.type === 'exit_requested') {
|
|
1209
|
+
void stop();
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
prompt();
|
|
1213
|
+
};
|
|
1214
|
+
const handleSigint = () => {
|
|
1215
|
+
const result = agentController.handle({ type: 'interrupt', source: 'keyboard' });
|
|
1216
|
+
if (result.type === 'exit_requested') {
|
|
1217
|
+
void stop();
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
prompt();
|
|
1221
|
+
};
|
|
1222
|
+
try {
|
|
1223
|
+
process.stdout.write(`${DIM('Ready. Terminal editor supports CJK, Alt/Option+Enter or Ctrl+J newlines, multiline paste, and live revision. /edit is available for oversized drafts.')}\n`);
|
|
1224
|
+
editor.start();
|
|
1225
|
+
prompt();
|
|
1226
|
+
await new Promise(resolve => {
|
|
1227
|
+
resolveLaunch = resolve;
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
finally {
|
|
1231
|
+
if (!stopping) {
|
|
1232
|
+
stopping = true;
|
|
1233
|
+
try {
|
|
1234
|
+
await outputQueue.close();
|
|
1235
|
+
}
|
|
1236
|
+
catch {
|
|
1237
|
+
// Terminal output failure must not block shutdown.
|
|
1238
|
+
}
|
|
1239
|
+
finally {
|
|
1240
|
+
editor.stop();
|
|
1241
|
+
await runtime.shutdown();
|
|
1242
|
+
}
|
|
1243
|
+
process.stdout.write('\n');
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
//# sourceMappingURL=launch.js.map
|