@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,1255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TuiRunner = void 0;
|
|
4
|
+
const frame_1 = require("../tui-core/frame");
|
|
5
|
+
const input_parser_1 = require("../tui-core/input-parser");
|
|
6
|
+
const commands_1 = require("../commands");
|
|
7
|
+
const layout_1 = require("./layout");
|
|
8
|
+
const pickers_1 = require("./pickers");
|
|
9
|
+
const render_scheduler_1 = require("./render-scheduler");
|
|
10
|
+
const state_1 = require("./state");
|
|
11
|
+
const input_ownership_1 = require("./input-ownership");
|
|
12
|
+
const transcript_inspector_1 = require("./transcript-inspector");
|
|
13
|
+
const transcript_inspector_layout_1 = require("./transcript-inspector-layout");
|
|
14
|
+
const transcript_cache_1 = require("./transcript-cache");
|
|
15
|
+
const transcript_layout_1 = require("./transcript-layout");
|
|
16
|
+
const theme_1 = require("./theme");
|
|
17
|
+
const history_1 = require("../runtime/composer/history");
|
|
18
|
+
const promises_1 = require("fs/promises");
|
|
19
|
+
const os_1 = require("os");
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
/** Actions that should use 'stream' priority (FPS-capped). */
|
|
22
|
+
const STREAM_ACTIONS = new Set([
|
|
23
|
+
'updateTranscript',
|
|
24
|
+
'setStatusSnapshot',
|
|
25
|
+
'setStatus',
|
|
26
|
+
'toolStarted',
|
|
27
|
+
'toolFinished',
|
|
28
|
+
'subtaskEvent',
|
|
29
|
+
]);
|
|
30
|
+
class TuiRunner {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.options = options;
|
|
33
|
+
this.parser = new input_parser_1.TuiInputParser();
|
|
34
|
+
this.inputOwnership = new input_ownership_1.TuiInputOwnershipController();
|
|
35
|
+
this.transcriptCache = new transcript_cache_1.TranscriptLayoutCache();
|
|
36
|
+
this.history = history_1.initialHistoryState;
|
|
37
|
+
this.surfaceFailed = false;
|
|
38
|
+
this.inspectorReady = false;
|
|
39
|
+
this.inspectorSearchActive = false;
|
|
40
|
+
this.modalTransition = Promise.resolve();
|
|
41
|
+
this.commitSequence = 0;
|
|
42
|
+
this.commitInFlight = false;
|
|
43
|
+
this.commitMismatchRetries = 0;
|
|
44
|
+
this.state = state_1.initialTuiUiState;
|
|
45
|
+
this.lastFrame = null;
|
|
46
|
+
this.surfaceResizePending = false;
|
|
47
|
+
this.resizeEpoch = 0;
|
|
48
|
+
this.surfaceResizeGeneration = 0;
|
|
49
|
+
this.counters = {
|
|
50
|
+
layoutCount: 0,
|
|
51
|
+
paintCount: 0,
|
|
52
|
+
changedRows: 0,
|
|
53
|
+
commitCount: 0,
|
|
54
|
+
};
|
|
55
|
+
this.width = options.width;
|
|
56
|
+
this.height = options.height;
|
|
57
|
+
this.surface = options.surface ?? null;
|
|
58
|
+
this.theme = (0, theme_1.resolveTuiTheme)(options.theme);
|
|
59
|
+
this.themeId = options.themeId ?? theme_1.DEFAULT_TUI_THEME_ID;
|
|
60
|
+
this.inspectorSurface = options.inspectorSurface ?? null;
|
|
61
|
+
this.inspectorController = options.detailRepository
|
|
62
|
+
? new transcript_inspector_1.TranscriptInspectorController(options.detailRepository, options.cwd ?? process.cwd())
|
|
63
|
+
: null;
|
|
64
|
+
this.scheduler = (0, render_scheduler_1.createTuiRenderScheduler)(() => this.renderLive(), options.schedulerDeps);
|
|
65
|
+
this.events = (0, state_1.createTuiUiEventSink)(action => this.dispatch(action));
|
|
66
|
+
// Initial render: paint the live region immediately.
|
|
67
|
+
this.renderLive();
|
|
68
|
+
}
|
|
69
|
+
getState() {
|
|
70
|
+
return this.state;
|
|
71
|
+
}
|
|
72
|
+
getLastFrame() {
|
|
73
|
+
return this.lastFrame;
|
|
74
|
+
}
|
|
75
|
+
getVisibleRows() {
|
|
76
|
+
return this.lastFrame ? (0, frame_1.renderFrameRows)(this.lastFrame) : [];
|
|
77
|
+
}
|
|
78
|
+
/** Get the scheduler for external lifecycle management (flush, stop). */
|
|
79
|
+
getScheduler() {
|
|
80
|
+
return this.scheduler;
|
|
81
|
+
}
|
|
82
|
+
/** Stop stale-width paints as soon as the terminal reports SIGWINCH. */
|
|
83
|
+
beginResize(width = this.width) {
|
|
84
|
+
if (this.state.inspector)
|
|
85
|
+
return;
|
|
86
|
+
if (!this.surface || this.surfaceFailed)
|
|
87
|
+
return;
|
|
88
|
+
this.surfaceResizePending = true;
|
|
89
|
+
this.resizeEpoch += 1;
|
|
90
|
+
this.surfaceResizeGeneration = this.surface.beginResize(width);
|
|
91
|
+
}
|
|
92
|
+
resize(width, height) {
|
|
93
|
+
if (this.state.inspector) {
|
|
94
|
+
this.width = width;
|
|
95
|
+
this.height = height;
|
|
96
|
+
this.paintInspector();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.beginResize(width);
|
|
100
|
+
const resizeEpoch = this.resizeEpoch;
|
|
101
|
+
const surfaceResizeGeneration = this.surfaceResizeGeneration;
|
|
102
|
+
this.width = width;
|
|
103
|
+
this.height = height;
|
|
104
|
+
// Invalidate transcript cache on resize so committed entries are re-laid-out
|
|
105
|
+
// at the new width.
|
|
106
|
+
this.transcriptCache.invalidate(this.state.transcriptGeneration, this.transcriptWidth, this.themeId);
|
|
107
|
+
if (this.surface && !this.surfaceFailed) {
|
|
108
|
+
// Surface resize is async (serialized FIFO); fire-and-forget is safe
|
|
109
|
+
// because subsequent renders go through the surface queue too.
|
|
110
|
+
void this.surface
|
|
111
|
+
.resize(width, height, () => {
|
|
112
|
+
const frame = this.buildLiveFrame(width);
|
|
113
|
+
this.lastFrame = frame;
|
|
114
|
+
this.counters.layoutCount += 1;
|
|
115
|
+
this.counters.paintCount += 1;
|
|
116
|
+
return frame;
|
|
117
|
+
}, surfaceResizeGeneration)
|
|
118
|
+
.then(() => {
|
|
119
|
+
if (resizeEpoch !== this.resizeEpoch)
|
|
120
|
+
return;
|
|
121
|
+
this.surfaceResizePending = false;
|
|
122
|
+
this.tryCommit(this.state, true);
|
|
123
|
+
this.scheduler.request('immediate');
|
|
124
|
+
this.scheduler.flush();
|
|
125
|
+
})
|
|
126
|
+
.catch(error => this.handleSurfaceError(error));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.scheduler.request('immediate');
|
|
130
|
+
this.scheduler.flush();
|
|
131
|
+
}
|
|
132
|
+
dispatch(action) {
|
|
133
|
+
const prevState = this.state;
|
|
134
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, action);
|
|
135
|
+
if (action.type === 'setToolOutputViewMode' && action.mode !== prevState.toolOutputViewMode) {
|
|
136
|
+
this.transcriptCache.clear();
|
|
137
|
+
}
|
|
138
|
+
// Check if any transcript entries became committable (finalized).
|
|
139
|
+
this.tryCommit(prevState);
|
|
140
|
+
const priority = STREAM_ACTIONS.has(action.type) ? 'stream' : 'immediate';
|
|
141
|
+
this.scheduler.request(priority);
|
|
142
|
+
}
|
|
143
|
+
feedInput(chunk) {
|
|
144
|
+
const events = this.parser.feed(chunk, { detectUnbracketedMultilinePaste: true });
|
|
145
|
+
for (const event of events) {
|
|
146
|
+
this.applyInputEvent(event);
|
|
147
|
+
}
|
|
148
|
+
return events;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Render the full frame (legacy path for tests without surface).
|
|
152
|
+
* Uses renderTuiUiFrame which includes both static and live transcript.
|
|
153
|
+
*/
|
|
154
|
+
renderFullFrame() {
|
|
155
|
+
this.counters.layoutCount += 1;
|
|
156
|
+
const frame = (0, layout_1.renderTuiUiFrame)(this.state, {
|
|
157
|
+
width: this.width,
|
|
158
|
+
height: this.height,
|
|
159
|
+
...this.transcriptLayoutOptions(),
|
|
160
|
+
});
|
|
161
|
+
this.lastFrame = frame;
|
|
162
|
+
this.counters.paintCount += 1;
|
|
163
|
+
return frame;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Render the live region via InlineTerminalSurface.
|
|
167
|
+
* When surface is available, only ephemeral content (live transcript, overlay,
|
|
168
|
+
* status, prompt) is painted into the live region.
|
|
169
|
+
* When no surface (test mode), renders the full frame including committed
|
|
170
|
+
* transcript so tests can inspect complete content via getLastFrame().
|
|
171
|
+
*/
|
|
172
|
+
renderLive() {
|
|
173
|
+
if (this.state.inspector) {
|
|
174
|
+
this.paintInspector();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (this.surface && !this.surfaceFailed) {
|
|
178
|
+
if (this.surfaceResizePending)
|
|
179
|
+
return;
|
|
180
|
+
this.counters.layoutCount += 1;
|
|
181
|
+
// Production path: render only the live region for inline surface.
|
|
182
|
+
const frame = this.buildLiveFrame(this.width);
|
|
183
|
+
this.lastFrame = frame;
|
|
184
|
+
this.counters.paintCount += 1;
|
|
185
|
+
// Surface renderLive is async (serialized FIFO), but for production use
|
|
186
|
+
// we fire-and-forget because the next render will also go through the queue.
|
|
187
|
+
void this.surface.renderLive(frame).catch(error => this.handleSurfaceError(error));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.counters.layoutCount += 1;
|
|
191
|
+
// Test path (no surface): render the full frame so getLastFrame() /
|
|
192
|
+
// getVisibleRows() return complete content including committed transcript.
|
|
193
|
+
const frame = (0, layout_1.renderTuiUiFrame)(this.state, {
|
|
194
|
+
width: this.width,
|
|
195
|
+
height: this.height,
|
|
196
|
+
...this.transcriptLayoutOptions(),
|
|
197
|
+
});
|
|
198
|
+
this.lastFrame = frame;
|
|
199
|
+
this.counters.paintCount += 1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Build a compact live-region frame that grows only for active content. */
|
|
203
|
+
buildLiveFrame(terminalWidth) {
|
|
204
|
+
const width = this.surface
|
|
205
|
+
? Math.max(1, Math.floor(terminalWidth) - 1)
|
|
206
|
+
: Math.max(1, Math.floor(terminalWidth));
|
|
207
|
+
const height = this.surface
|
|
208
|
+
? (0, layout_1.measureTuiLiveFrameHeight)(this.state, width, this.surface.getLiveBandRows(), this.transcriptLayoutOptions())
|
|
209
|
+
: this.height - 1;
|
|
210
|
+
return (0, layout_1.renderTuiLiveFrame)(this.state, {
|
|
211
|
+
width,
|
|
212
|
+
height,
|
|
213
|
+
...this.transcriptLayoutOptions(),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Try to commit any newly-finalized transcript entries to scrollback.
|
|
218
|
+
* Called after each dispatch. Only commits entries that are committable
|
|
219
|
+
* but not yet queued.
|
|
220
|
+
*/
|
|
221
|
+
tryCommit(prevState, force = false) {
|
|
222
|
+
if (!this.surface || this.surfaceResizePending || this.state.inspector || this.commitInFlight)
|
|
223
|
+
return;
|
|
224
|
+
const prevCommittable = prevState.committableTranscriptCount;
|
|
225
|
+
const currCommittable = this.state.committableTranscriptCount;
|
|
226
|
+
const generationChanged = this.state.transcriptGeneration !== prevState.transcriptGeneration;
|
|
227
|
+
if (!force && !generationChanged && currCommittable <= prevCommittable)
|
|
228
|
+
return;
|
|
229
|
+
if (currCommittable <= this.state.queuedTranscriptCount)
|
|
230
|
+
return;
|
|
231
|
+
// Gather entries to commit: from queued boundary to new committable boundary.
|
|
232
|
+
const entriesToCommit = (0, state_1.pendingCommitRecords)(this.state);
|
|
233
|
+
if (entriesToCommit.length === 0)
|
|
234
|
+
return;
|
|
235
|
+
// Advance the queued boundary so we don't double-commit.
|
|
236
|
+
this.state = (0, state_1.markTranscriptQueued)(this.state, entriesToCommit.length);
|
|
237
|
+
// Build the commit batch.
|
|
238
|
+
const committedEntries = entriesToCommit.map(entry => ({
|
|
239
|
+
displayKey: entry.id,
|
|
240
|
+
rows: this.layoutTranscriptRecord(entry, this.transcriptWidth),
|
|
241
|
+
}));
|
|
242
|
+
const batch = {
|
|
243
|
+
batchId: `tui-commit-${++this.commitSequence}`,
|
|
244
|
+
generation: this.state.transcriptGeneration,
|
|
245
|
+
reason: 'finalize',
|
|
246
|
+
entries: committedEntries,
|
|
247
|
+
};
|
|
248
|
+
// The LiveFrameProvider ensures the live frame is rebuilt after commit
|
|
249
|
+
// with the latest state (where committed entries are no longer in the
|
|
250
|
+
// live region).
|
|
251
|
+
const generation = batch.generation;
|
|
252
|
+
const getLatestLiveFrame = () => this.buildLiveFrame(this.width);
|
|
253
|
+
this.commitInFlight = true;
|
|
254
|
+
let continueCommit = true;
|
|
255
|
+
// Surface commit is async (serialized FIFO). Fire-and-forget: the
|
|
256
|
+
// commit's internal getLatestLiveFrame already rebuilds the live region,
|
|
257
|
+
// so no additional scheduler paint is needed here.
|
|
258
|
+
void this.surface
|
|
259
|
+
.commit(batch, getLatestLiveFrame)
|
|
260
|
+
.then(result => {
|
|
261
|
+
if (result.batchId !== batch.batchId ||
|
|
262
|
+
result.generation !== generation ||
|
|
263
|
+
result.committedEntries !== entriesToCommit.length) {
|
|
264
|
+
if (this.state.transcriptGeneration === generation) {
|
|
265
|
+
this.state = {
|
|
266
|
+
...this.state,
|
|
267
|
+
queuedTranscriptCount: Math.max(0, this.state.queuedTranscriptCount - entriesToCommit.length),
|
|
268
|
+
};
|
|
269
|
+
this.commitMismatchRetries += 1;
|
|
270
|
+
if (this.commitMismatchRetries > 1) {
|
|
271
|
+
continueCommit = false;
|
|
272
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
273
|
+
type: 'setStatus',
|
|
274
|
+
message: 'TUI transcript acknowledgement mismatch; retained content for retry.',
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
void this.surface?.forceRedraw(this.buildLiveFrame(this.width));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const acknowledgement = (0, state_1.acknowledgeTranscriptCommit)(this.state, {
|
|
282
|
+
generation,
|
|
283
|
+
recordIds: result.displayKeys ?? [],
|
|
284
|
+
});
|
|
285
|
+
if (!acknowledgement.accepted) {
|
|
286
|
+
if (this.state.transcriptGeneration === generation) {
|
|
287
|
+
this.state = {
|
|
288
|
+
...this.state,
|
|
289
|
+
queuedTranscriptCount: Math.max(0, this.state.queuedTranscriptCount - entriesToCommit.length),
|
|
290
|
+
};
|
|
291
|
+
this.commitMismatchRetries += 1;
|
|
292
|
+
if (this.commitMismatchRetries > 1) {
|
|
293
|
+
continueCommit = false;
|
|
294
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
295
|
+
type: 'setStatus',
|
|
296
|
+
message: 'TUI transcript acknowledgement mismatch; retained content for retry.',
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
void this.surface?.forceRedraw(this.buildLiveFrame(this.width));
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
this.state = acknowledgement.state;
|
|
304
|
+
this.commitMismatchRetries = 0;
|
|
305
|
+
this.counters.commitCount += 1;
|
|
306
|
+
})
|
|
307
|
+
.catch(error => this.handleSurfaceError(error))
|
|
308
|
+
.finally(() => {
|
|
309
|
+
this.commitInFlight = false;
|
|
310
|
+
if (!this.surfaceFailed && continueCommit)
|
|
311
|
+
this.tryCommit(this.state, true);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/** Layout a transcript record once per revision/width/theme combination. */
|
|
315
|
+
layoutTranscriptRecord(entry, width) {
|
|
316
|
+
const cached = this.transcriptCache.get(entry.id, entry.revision, this.state.transcriptGeneration, width, this.themeId);
|
|
317
|
+
if (cached)
|
|
318
|
+
return cached;
|
|
319
|
+
const rows = (0, transcript_layout_1.layoutTranscriptEntry)(entry, {
|
|
320
|
+
width,
|
|
321
|
+
theme: this.theme,
|
|
322
|
+
toolOutputMode: this.state.toolOutputViewMode,
|
|
323
|
+
});
|
|
324
|
+
this.transcriptCache.set(entry.id, entry.revision, rows, this.state.transcriptGeneration, width, this.themeId);
|
|
325
|
+
return rows;
|
|
326
|
+
}
|
|
327
|
+
get transcriptWidth() {
|
|
328
|
+
return this.surface ? Math.max(1, this.width - 1) : Math.max(1, this.width);
|
|
329
|
+
}
|
|
330
|
+
transcriptLayoutOptions() {
|
|
331
|
+
return {
|
|
332
|
+
transcriptWidth: this.transcriptWidth,
|
|
333
|
+
theme: this.theme,
|
|
334
|
+
toolOutputMode: this.state.toolOutputViewMode,
|
|
335
|
+
layoutTranscriptRecord: (entry, width) => this.layoutTranscriptRecord(entry, width),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
handleSurfaceError(error) {
|
|
339
|
+
if (this.surfaceFailed)
|
|
340
|
+
return;
|
|
341
|
+
this.surfaceFailed = true;
|
|
342
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
343
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
344
|
+
type: 'setStatus',
|
|
345
|
+
message: `TUI output error: ${message}`,
|
|
346
|
+
});
|
|
347
|
+
this.options.onSurfaceError?.(error);
|
|
348
|
+
}
|
|
349
|
+
applyInputEvent(event) {
|
|
350
|
+
if (this.state.inspector) {
|
|
351
|
+
this.applyInspectorInput(event);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (this.state.overlay?.type === 'permission') {
|
|
355
|
+
if (event.type === 'text') {
|
|
356
|
+
const answer = event.value.trim().toLowerCase();
|
|
357
|
+
if (answer === 'y' || answer === 'yes') {
|
|
358
|
+
this.answerPermission(true);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (answer === 'n' || answer === 'no') {
|
|
362
|
+
this.answerPermission(false);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
// Ignore paste and non-escape keys during permission overlay
|
|
368
|
+
if (event.type === 'paste')
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
switch (event.type) {
|
|
372
|
+
case 'text':
|
|
373
|
+
case 'paste':
|
|
374
|
+
if (event.type === 'text' && event.value === '?' && this.state.prompt.value === '') {
|
|
375
|
+
this.dispatch({ type: 'showShortcuts' });
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
this.updatePrompt(insertAtCursor(this.state.prompt.value, this.state.prompt.cursor, event.value));
|
|
379
|
+
return;
|
|
380
|
+
case 'key':
|
|
381
|
+
this.applyKey(event.key);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
applyKey(key) {
|
|
386
|
+
const { value, cursor } = this.state.prompt;
|
|
387
|
+
const overlay = this.state.overlay;
|
|
388
|
+
if (overlay?.type === 'sessions') {
|
|
389
|
+
switch (key) {
|
|
390
|
+
case 'up':
|
|
391
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -1 });
|
|
392
|
+
return;
|
|
393
|
+
case 'down':
|
|
394
|
+
case 'tab':
|
|
395
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 1 });
|
|
396
|
+
return;
|
|
397
|
+
case 'pageup':
|
|
398
|
+
this.dispatch({
|
|
399
|
+
type: 'moveOverlaySelection',
|
|
400
|
+
delta: -Math.max(1, overlay.request.maxVisibleItems ?? 10),
|
|
401
|
+
});
|
|
402
|
+
return;
|
|
403
|
+
case 'pagedown':
|
|
404
|
+
this.dispatch({
|
|
405
|
+
type: 'moveOverlaySelection',
|
|
406
|
+
delta: Math.max(1, overlay.request.maxVisibleItems ?? 10),
|
|
407
|
+
});
|
|
408
|
+
return;
|
|
409
|
+
case 'enter':
|
|
410
|
+
this.submitPrompt({ allowEmpty: true });
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (overlay?.type === 'edit') {
|
|
415
|
+
switch (key) {
|
|
416
|
+
case 'up':
|
|
417
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -1 });
|
|
418
|
+
return;
|
|
419
|
+
case 'down':
|
|
420
|
+
case 'tab':
|
|
421
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 1 });
|
|
422
|
+
return;
|
|
423
|
+
case 'pageup':
|
|
424
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -10 });
|
|
425
|
+
return;
|
|
426
|
+
case 'pagedown':
|
|
427
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 10 });
|
|
428
|
+
return;
|
|
429
|
+
case 'enter':
|
|
430
|
+
case 'escape':
|
|
431
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (overlay?.type === 'commands') {
|
|
436
|
+
switch (key) {
|
|
437
|
+
case 'up':
|
|
438
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -1 });
|
|
439
|
+
return;
|
|
440
|
+
case 'down':
|
|
441
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 1 });
|
|
442
|
+
return;
|
|
443
|
+
case 'pageup':
|
|
444
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -10 });
|
|
445
|
+
return;
|
|
446
|
+
case 'pagedown':
|
|
447
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 10 });
|
|
448
|
+
return;
|
|
449
|
+
case 'tab':
|
|
450
|
+
this.completeCommand(overlay.items[overlay.selectedIndex], false);
|
|
451
|
+
return;
|
|
452
|
+
case 'enter':
|
|
453
|
+
if (/^\/(?:tool-output|redraw)(?:\s|$)/u.test(this.state.prompt.value.trim())) {
|
|
454
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
455
|
+
this.submitPrompt();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this.completeCommand(overlay.items[overlay.selectedIndex], true);
|
|
459
|
+
return;
|
|
460
|
+
case 'escape':
|
|
461
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (overlay?.type === 'files') {
|
|
466
|
+
switch (key) {
|
|
467
|
+
case 'up':
|
|
468
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -1 });
|
|
469
|
+
return;
|
|
470
|
+
case 'down':
|
|
471
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 1 });
|
|
472
|
+
return;
|
|
473
|
+
case 'pageup':
|
|
474
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -10 });
|
|
475
|
+
return;
|
|
476
|
+
case 'pagedown':
|
|
477
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 10 });
|
|
478
|
+
return;
|
|
479
|
+
case 'tab':
|
|
480
|
+
case 'enter':
|
|
481
|
+
this.completeFile(overlay.items[overlay.selectedIndex]);
|
|
482
|
+
return;
|
|
483
|
+
case 'escape':
|
|
484
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (overlay?.type === 'shortcuts') {
|
|
489
|
+
switch (key) {
|
|
490
|
+
case 'enter':
|
|
491
|
+
case 'escape':
|
|
492
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (overlay?.type === 'permission') {
|
|
497
|
+
switch (key) {
|
|
498
|
+
case 'up':
|
|
499
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: -1 });
|
|
500
|
+
return;
|
|
501
|
+
case 'down':
|
|
502
|
+
case 'tab':
|
|
503
|
+
this.dispatch({ type: 'moveOverlaySelection', delta: 1 });
|
|
504
|
+
return;
|
|
505
|
+
case 'enter':
|
|
506
|
+
this.answerPermission(overlay.selectedIndex === 0);
|
|
507
|
+
return;
|
|
508
|
+
case 'escape':
|
|
509
|
+
case 'ctrl+c':
|
|
510
|
+
this.answerPermission(false);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
switch (key) {
|
|
516
|
+
case 'ctrl+o':
|
|
517
|
+
this.openToolInspector();
|
|
518
|
+
return;
|
|
519
|
+
case 'ctrl+l':
|
|
520
|
+
this.forceOwnedRedraw();
|
|
521
|
+
return;
|
|
522
|
+
case 'enter':
|
|
523
|
+
this.submitPrompt();
|
|
524
|
+
return;
|
|
525
|
+
case 'newline':
|
|
526
|
+
this.updatePrompt(insertAtCursor(value, cursor, '\n'));
|
|
527
|
+
return;
|
|
528
|
+
case 'backspace':
|
|
529
|
+
this.updatePrompt(deleteBeforeCursor(value, cursor));
|
|
530
|
+
return;
|
|
531
|
+
case 'delete':
|
|
532
|
+
this.updatePrompt(deleteAfterCursor(value, cursor));
|
|
533
|
+
return;
|
|
534
|
+
case 'left':
|
|
535
|
+
this.dispatch({ type: 'setPrompt', value, cursor: previousBoundary(value, cursor) });
|
|
536
|
+
return;
|
|
537
|
+
case 'right':
|
|
538
|
+
this.dispatch({ type: 'setPrompt', value, cursor: nextBoundary(value, cursor) });
|
|
539
|
+
return;
|
|
540
|
+
case 'home':
|
|
541
|
+
this.moveCursorLineHome();
|
|
542
|
+
return;
|
|
543
|
+
case 'end':
|
|
544
|
+
this.moveCursorLineEnd();
|
|
545
|
+
return;
|
|
546
|
+
case 'ctrl+u':
|
|
547
|
+
this.dispatch({ type: 'setPrompt', value: '', cursor: 0 });
|
|
548
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
549
|
+
return;
|
|
550
|
+
case 'ctrl+w':
|
|
551
|
+
this.updatePrompt(deleteWordBeforeCursor(value, cursor));
|
|
552
|
+
return;
|
|
553
|
+
case 'ctrl+c':
|
|
554
|
+
this.options.onCtrlC?.();
|
|
555
|
+
return;
|
|
556
|
+
case 'escape':
|
|
557
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
558
|
+
return;
|
|
559
|
+
case 'tab':
|
|
560
|
+
if (value.startsWith('/')) {
|
|
561
|
+
this.syncPromptOverlay(value);
|
|
562
|
+
}
|
|
563
|
+
else if ((0, pickers_1.getFileQuery)(value)) {
|
|
564
|
+
this.syncPromptOverlay(value);
|
|
565
|
+
}
|
|
566
|
+
return;
|
|
567
|
+
case 'up':
|
|
568
|
+
this.moveCursorUpOrHistory();
|
|
569
|
+
return;
|
|
570
|
+
case 'down':
|
|
571
|
+
this.moveCursorDownOrHistory();
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
/** Navigate to previous history entry. */
|
|
576
|
+
historyBack() {
|
|
577
|
+
if (this.state.overlay)
|
|
578
|
+
return; // overlay handles up/down itself
|
|
579
|
+
const { value } = this.state.prompt;
|
|
580
|
+
const next = (0, history_1.historyPrevious)(this.history, value);
|
|
581
|
+
this.history = next;
|
|
582
|
+
const displayValue = (0, history_1.historyCurrentValue)(next, value);
|
|
583
|
+
this.dispatch({ type: 'setPrompt', value: displayValue, cursor: displayValue.length });
|
|
584
|
+
}
|
|
585
|
+
/** Navigate to next history entry (or back to draft). */
|
|
586
|
+
historyForward() {
|
|
587
|
+
if (this.state.overlay)
|
|
588
|
+
return;
|
|
589
|
+
const { value } = this.state.prompt;
|
|
590
|
+
const next = (0, history_1.historyNext)(this.history);
|
|
591
|
+
this.history = next;
|
|
592
|
+
const displayValue = (0, history_1.historyCurrentValue)(next, value);
|
|
593
|
+
this.dispatch({ type: 'setPrompt', value: displayValue, cursor: displayValue.length });
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Up in a multi-line prompt moves the cursor to the previous visual line;
|
|
597
|
+
* only at the first line does it fall back to command history (matching
|
|
598
|
+
* shell/editor behaviour). Single-line prompts behave exactly as before.
|
|
599
|
+
*/
|
|
600
|
+
moveCursorUpOrHistory() {
|
|
601
|
+
if (this.state.overlay)
|
|
602
|
+
return;
|
|
603
|
+
const { value, cursor } = this.state.prompt;
|
|
604
|
+
const { line, col } = lineColOfCursor(value, cursor);
|
|
605
|
+
if (line > 0) {
|
|
606
|
+
this.dispatch({ type: 'setPrompt', value, cursor: cursorOfLineCol(value, line - 1, col) });
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
this.historyBack();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Down in a multi-line prompt moves the cursor to the next visual line;
|
|
614
|
+
* only at the last line does it fall back to command history.
|
|
615
|
+
*/
|
|
616
|
+
moveCursorDownOrHistory() {
|
|
617
|
+
if (this.state.overlay)
|
|
618
|
+
return;
|
|
619
|
+
const { value, cursor } = this.state.prompt;
|
|
620
|
+
const lines = value.split('\n');
|
|
621
|
+
const { line, col } = lineColOfCursor(value, cursor);
|
|
622
|
+
if (line < lines.length - 1) {
|
|
623
|
+
this.dispatch({ type: 'setPrompt', value, cursor: cursorOfLineCol(value, line + 1, col) });
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
this.historyForward();
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/** Home: move to the start of the current visual line (not whole buffer). */
|
|
630
|
+
moveCursorLineHome() {
|
|
631
|
+
if (this.state.overlay)
|
|
632
|
+
return;
|
|
633
|
+
const { value, cursor } = this.state.prompt;
|
|
634
|
+
const { line } = lineColOfCursor(value, cursor);
|
|
635
|
+
this.dispatch({ type: 'setPrompt', value, cursor: cursorOfLineCol(value, line, 0) });
|
|
636
|
+
}
|
|
637
|
+
/** End: move to the end of the current visual line (not whole buffer). */
|
|
638
|
+
moveCursorLineEnd() {
|
|
639
|
+
if (this.state.overlay)
|
|
640
|
+
return;
|
|
641
|
+
const { value, cursor } = this.state.prompt;
|
|
642
|
+
const { line } = lineColOfCursor(value, cursor);
|
|
643
|
+
const lines = value.split('\n');
|
|
644
|
+
this.dispatch({
|
|
645
|
+
type: 'setPrompt',
|
|
646
|
+
value,
|
|
647
|
+
cursor: cursorOfLineCol(value, line, lines[line].length),
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
submitPrompt(options = {}) {
|
|
651
|
+
const input = this.state.prompt.value;
|
|
652
|
+
if (!input.trim() && !options.allowEmpty)
|
|
653
|
+
return;
|
|
654
|
+
// Push to history before clearing.
|
|
655
|
+
this.history = (0, history_1.pushHistoryEntry)(this.history, input);
|
|
656
|
+
this.dispatch({ type: 'setPrompt', value: '', cursor: 0 });
|
|
657
|
+
if (this.handleLocalCommand(input))
|
|
658
|
+
return;
|
|
659
|
+
try {
|
|
660
|
+
const submission = this.options.onSubmit?.(input);
|
|
661
|
+
if (submission) {
|
|
662
|
+
void submission.catch(() => this.reportSubmitFailure());
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
catch {
|
|
666
|
+
this.reportSubmitFailure();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
reportSubmitFailure() {
|
|
670
|
+
this.events.append({ role: 'error', content: 'Input submission failed.' });
|
|
671
|
+
}
|
|
672
|
+
handleLocalCommand(input) {
|
|
673
|
+
const command = input.trim();
|
|
674
|
+
if (command === '/redraw') {
|
|
675
|
+
this.forceOwnedRedraw();
|
|
676
|
+
return true;
|
|
677
|
+
}
|
|
678
|
+
const match = command.match(/^\/tool-output(?:\s+(adaptive|collapsed|full))?$/u);
|
|
679
|
+
if (match) {
|
|
680
|
+
const mode = match[1];
|
|
681
|
+
if (mode)
|
|
682
|
+
this.dispatch({ type: 'setToolOutputViewMode', mode });
|
|
683
|
+
this.dispatch({
|
|
684
|
+
type: 'setStatus',
|
|
685
|
+
message: `tool output: ${mode ?? this.state.toolOutputViewMode}`,
|
|
686
|
+
});
|
|
687
|
+
return true;
|
|
688
|
+
}
|
|
689
|
+
if (command.startsWith('/tool-output')) {
|
|
690
|
+
this.dispatch({
|
|
691
|
+
type: 'setStatus',
|
|
692
|
+
message: 'Usage: /tool-output adaptive|collapsed|full',
|
|
693
|
+
});
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
forceOwnedRedraw() {
|
|
699
|
+
if (this.surface && !this.surfaceFailed) {
|
|
700
|
+
void this.surface
|
|
701
|
+
.forceRedraw(this.buildLiveFrame(this.width))
|
|
702
|
+
.catch(error => this.handleSurfaceError(error));
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
this.lastFrame = null;
|
|
706
|
+
this.scheduler.request('immediate');
|
|
707
|
+
}
|
|
708
|
+
updatePrompt(next) {
|
|
709
|
+
this.dispatch({ type: 'setPrompt', value: next.value, cursor: next.cursor });
|
|
710
|
+
this.syncPromptOverlay(next.value);
|
|
711
|
+
}
|
|
712
|
+
syncPromptOverlay(value) {
|
|
713
|
+
if (this.state.overlay?.type === 'shortcuts' && value.trim()) {
|
|
714
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
715
|
+
}
|
|
716
|
+
if (value.startsWith('/')) {
|
|
717
|
+
this.dispatch({
|
|
718
|
+
type: 'showCommandPalette',
|
|
719
|
+
query: value.slice(1),
|
|
720
|
+
items: visibleTuiCommandItems(value),
|
|
721
|
+
});
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const fileQuery = (0, pickers_1.getFileQuery)(value);
|
|
725
|
+
if (fileQuery) {
|
|
726
|
+
this.dispatch({
|
|
727
|
+
type: 'showFilePicker',
|
|
728
|
+
base: fileQuery.base,
|
|
729
|
+
query: fileQuery.query,
|
|
730
|
+
items: (0, pickers_1.visibleFileItems)(this.options.cwd ?? process.cwd(), value),
|
|
731
|
+
});
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (this.state.overlay?.type === 'commands' || this.state.overlay?.type === 'files') {
|
|
735
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
completeCommand(item, submitImmediately) {
|
|
739
|
+
if (!item)
|
|
740
|
+
return;
|
|
741
|
+
const command = (0, commands_1.getCommands)().find(candidate => candidate.name === item.value);
|
|
742
|
+
const needsArgs = item.value === 'tool-output' ||
|
|
743
|
+
Boolean(command?.argumentHint || command?.params?.some(param => param.required));
|
|
744
|
+
const value = `/${item.value}${needsArgs ? ' ' : ''}`;
|
|
745
|
+
const promptAlreadyMatchesCommand = this.state.prompt.value.trim() === `/${item.value}`;
|
|
746
|
+
const nextValue = promptAlreadyMatchesCommand ? `/${item.value}` : value;
|
|
747
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
748
|
+
this.dispatch({ type: 'setPrompt', value: nextValue, cursor: nextValue.length });
|
|
749
|
+
if (submitImmediately && (!needsArgs || promptAlreadyMatchesCommand)) {
|
|
750
|
+
this.submitPrompt();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
completeFile(item) {
|
|
754
|
+
if (!item)
|
|
755
|
+
return;
|
|
756
|
+
const fileQuery = (0, pickers_1.getFileQuery)(this.state.prompt.value);
|
|
757
|
+
if (!fileQuery)
|
|
758
|
+
return;
|
|
759
|
+
const value = `${fileQuery.base}@${item.value}${item.value.endsWith('/') ? '' : ' '}`;
|
|
760
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
761
|
+
this.dispatch({ type: 'setPrompt', value, cursor: value.length });
|
|
762
|
+
}
|
|
763
|
+
answerPermission(approved) {
|
|
764
|
+
const overlay = this.state.overlay;
|
|
765
|
+
if (overlay?.type !== 'permission')
|
|
766
|
+
return;
|
|
767
|
+
this.dispatch({ type: 'closeOverlay' });
|
|
768
|
+
void this.options.onPermissionDecision?.(overlay.request.id, approved);
|
|
769
|
+
}
|
|
770
|
+
/** Restore any temporary Inspector terminal ownership before shutdown. */
|
|
771
|
+
async closeModalSurface() {
|
|
772
|
+
if (this.state.inspector || this.inspectorSurface?.isMounted) {
|
|
773
|
+
this.closeToolInspector();
|
|
774
|
+
}
|
|
775
|
+
await this.modalTransition;
|
|
776
|
+
}
|
|
777
|
+
/** Wait until the current Inspector ownership transition is complete. */
|
|
778
|
+
async waitForModalSurface() {
|
|
779
|
+
await this.modalTransition;
|
|
780
|
+
}
|
|
781
|
+
/** Flush every finalized transcript batch, including batches queued by acknowledgements. */
|
|
782
|
+
async flushTranscriptCommits() {
|
|
783
|
+
if (!this.surface || this.surfaceFailed)
|
|
784
|
+
return;
|
|
785
|
+
for (let attempt = 0; attempt < 1024; attempt += 1) {
|
|
786
|
+
await this.surface.whenIdle();
|
|
787
|
+
await Promise.resolve();
|
|
788
|
+
if (!this.commitInFlight && (0, state_1.pendingCommitRecords)(this.state).length === 0)
|
|
789
|
+
return;
|
|
790
|
+
if (!this.commitInFlight)
|
|
791
|
+
this.tryCommit(this.state, true);
|
|
792
|
+
}
|
|
793
|
+
throw new Error('TUI transcript commits did not settle');
|
|
794
|
+
}
|
|
795
|
+
openToolInspector() {
|
|
796
|
+
if (this.state.inspector || !this.inspectorController || !this.inspectorSurface)
|
|
797
|
+
return;
|
|
798
|
+
this.inputOwnership.capture('inspector', {
|
|
799
|
+
value: this.state.prompt.value,
|
|
800
|
+
cursor: this.state.prompt.cursor,
|
|
801
|
+
parserState: this.parser.getState(),
|
|
802
|
+
});
|
|
803
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'openToolInspector' });
|
|
804
|
+
this.inspectorReady = false;
|
|
805
|
+
this.inspectorSearchActive = false;
|
|
806
|
+
this.modalTransition = this.modalTransition
|
|
807
|
+
.then(async () => {
|
|
808
|
+
await this.surface?.suspend();
|
|
809
|
+
this.inspectorReady = true;
|
|
810
|
+
await this.inspectorSurface.mount(this.buildInspectorFrame());
|
|
811
|
+
})
|
|
812
|
+
.catch(error => this.handleSurfaceError(error));
|
|
813
|
+
}
|
|
814
|
+
closeToolInspector() {
|
|
815
|
+
if (!this.state.inspector && !this.inspectorSurface?.isMounted)
|
|
816
|
+
return;
|
|
817
|
+
this.inspectorController?.cancel();
|
|
818
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'closeToolInspector' });
|
|
819
|
+
const snapshot = this.inputOwnership.restore();
|
|
820
|
+
if (snapshot) {
|
|
821
|
+
this.parser.setState(snapshot.parserState);
|
|
822
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
823
|
+
type: 'setPrompt',
|
|
824
|
+
value: snapshot.value,
|
|
825
|
+
cursor: snapshot.cursor,
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
this.inspectorReady = false;
|
|
829
|
+
this.inspectorSearchActive = false;
|
|
830
|
+
this.modalTransition = this.modalTransition
|
|
831
|
+
.then(async () => {
|
|
832
|
+
await this.inspectorSurface?.unmount();
|
|
833
|
+
if (this.surface) {
|
|
834
|
+
await this.surface.restore(() => this.buildLiveFrame(this.width), this.width, this.height);
|
|
835
|
+
}
|
|
836
|
+
this.scheduler.request('immediate');
|
|
837
|
+
})
|
|
838
|
+
.catch(error => this.handleSurfaceError(error));
|
|
839
|
+
}
|
|
840
|
+
applyInspectorInput(event) {
|
|
841
|
+
if (event.type === 'paste')
|
|
842
|
+
return;
|
|
843
|
+
if (event.type === 'text') {
|
|
844
|
+
if (!this.inspectorSearchActive) {
|
|
845
|
+
if (event.value === 'j') {
|
|
846
|
+
this.moveInspectorSelection(1);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
if (event.value === 'k') {
|
|
850
|
+
this.moveInspectorSelection(-1);
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
if (event.value === ' ') {
|
|
854
|
+
void this.loadSelectedInspectorDetail(false);
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
if (event.value === 'g') {
|
|
858
|
+
this.moveInspectorSelectionTo('first');
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
if (event.value === 'G') {
|
|
862
|
+
this.moveInspectorSelectionTo('last');
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
if (event.value === 'n' && this.state.inspector?.searchQuery) {
|
|
866
|
+
this.moveInspectorSelection(1, true);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
if (event.value === 'N' && this.state.inspector?.searchQuery) {
|
|
870
|
+
this.moveInspectorSelection(-1, true);
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
if (event.value === 'v') {
|
|
874
|
+
this.openSelectedInspectorDetailInEditor();
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (!this.inspectorSearchActive && (event.value === 'q' || event.value === 'Q')) {
|
|
879
|
+
this.closeToolInspector();
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (!this.inspectorSearchActive && event.value === '/') {
|
|
883
|
+
this.inspectorSearchActive = true;
|
|
884
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'setToolInspectorSearch', query: '' });
|
|
885
|
+
this.paintInspector();
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
if (!this.inspectorSearchActive && event.value === '[') {
|
|
889
|
+
this.exportInspectorResults();
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (this.inspectorSearchActive) {
|
|
893
|
+
const query = `${this.state.inspector?.searchQuery ?? ''}${event.value}`;
|
|
894
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'setToolInspectorSearch', query });
|
|
895
|
+
this.paintInspector();
|
|
896
|
+
}
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
switch (event.key) {
|
|
900
|
+
case 'ctrl+o':
|
|
901
|
+
case 'escape':
|
|
902
|
+
this.closeToolInspector();
|
|
903
|
+
return;
|
|
904
|
+
case 'ctrl+c':
|
|
905
|
+
this.closeToolInspector();
|
|
906
|
+
return;
|
|
907
|
+
case 'up':
|
|
908
|
+
this.moveInspectorSelection(-1);
|
|
909
|
+
return;
|
|
910
|
+
case 'down':
|
|
911
|
+
this.moveInspectorSelection(1);
|
|
912
|
+
return;
|
|
913
|
+
case 'pageup':
|
|
914
|
+
case 'ctrl+u':
|
|
915
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'scrollToolInspector', delta: -10 });
|
|
916
|
+
this.paintInspector();
|
|
917
|
+
return;
|
|
918
|
+
case 'pagedown':
|
|
919
|
+
case 'ctrl+d':
|
|
920
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'scrollToolInspector', delta: 10 });
|
|
921
|
+
void this.loadSelectedInspectorDetail(true);
|
|
922
|
+
return;
|
|
923
|
+
case 'home':
|
|
924
|
+
this.moveInspectorSelectionTo('first');
|
|
925
|
+
return;
|
|
926
|
+
case 'end':
|
|
927
|
+
this.moveInspectorSelectionTo('last');
|
|
928
|
+
return;
|
|
929
|
+
case 'backspace': {
|
|
930
|
+
if (!this.inspectorSearchActive)
|
|
931
|
+
return;
|
|
932
|
+
const query = this.state.inspector?.searchQuery ?? '';
|
|
933
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
934
|
+
type: 'setToolInspectorSearch',
|
|
935
|
+
query: query.slice(0, -1),
|
|
936
|
+
});
|
|
937
|
+
this.paintInspector();
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
case 'enter':
|
|
941
|
+
if (this.inspectorSearchActive) {
|
|
942
|
+
this.inspectorSearchActive = false;
|
|
943
|
+
this.paintInspector();
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
void this.loadSelectedInspectorDetail(false);
|
|
947
|
+
return;
|
|
948
|
+
case 'ctrl+e':
|
|
949
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'toggleAllToolInspectorEntries' });
|
|
950
|
+
this.paintInspector();
|
|
951
|
+
return;
|
|
952
|
+
case 'ctrl+l':
|
|
953
|
+
this.paintInspector();
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
async loadSelectedInspectorDetail(append) {
|
|
958
|
+
const inspector = this.state.inspector;
|
|
959
|
+
if (!inspector || !this.inspectorController)
|
|
960
|
+
return;
|
|
961
|
+
const view = this.inspectorController.view(this.state.recentToolDetails, inspector);
|
|
962
|
+
const selected = view.selected;
|
|
963
|
+
if (!selected)
|
|
964
|
+
return;
|
|
965
|
+
const expanded = inspector.expandedCallIds.includes(selected.callId);
|
|
966
|
+
if (!append && expanded) {
|
|
967
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
968
|
+
type: 'toggleToolInspectorEntry',
|
|
969
|
+
callId: selected.callId,
|
|
970
|
+
});
|
|
971
|
+
this.paintInspector();
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
if (!expanded) {
|
|
975
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
976
|
+
type: 'toggleToolInspectorEntry',
|
|
977
|
+
callId: selected.callId,
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
this.paintInspector();
|
|
981
|
+
await this.inspectorController.load(selected, append && view.detail?.nextOffsetBytes !== undefined);
|
|
982
|
+
if (this.state.inspector)
|
|
983
|
+
this.paintInspector();
|
|
984
|
+
}
|
|
985
|
+
moveInspectorSelection(delta, wrap = false) {
|
|
986
|
+
const inspector = this.state.inspector;
|
|
987
|
+
if (!inspector || !this.inspectorController)
|
|
988
|
+
return;
|
|
989
|
+
const view = this.inspectorController.view(this.state.recentToolDetails, inspector);
|
|
990
|
+
if (view.entries.length === 0)
|
|
991
|
+
return;
|
|
992
|
+
const target = wrap
|
|
993
|
+
? (view.selectedIndex + delta + view.entries.length) % view.entries.length
|
|
994
|
+
: Math.max(0, Math.min(view.entries.length - 1, view.selectedIndex + delta));
|
|
995
|
+
this.inspectorController.cancel();
|
|
996
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, { type: 'setToolInspectorSelection', index: target });
|
|
997
|
+
this.paintInspector();
|
|
998
|
+
}
|
|
999
|
+
moveInspectorSelectionTo(edge) {
|
|
1000
|
+
const inspector = this.state.inspector;
|
|
1001
|
+
if (!inspector || !this.inspectorController)
|
|
1002
|
+
return;
|
|
1003
|
+
const view = this.inspectorController.view(this.state.recentToolDetails, inspector);
|
|
1004
|
+
if (view.entries.length === 0)
|
|
1005
|
+
return;
|
|
1006
|
+
this.inspectorController.cancel();
|
|
1007
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1008
|
+
type: 'setToolInspectorSelection',
|
|
1009
|
+
index: edge === 'first' ? 0 : view.entries.length - 1,
|
|
1010
|
+
});
|
|
1011
|
+
this.paintInspector();
|
|
1012
|
+
}
|
|
1013
|
+
exportInspectorResults() {
|
|
1014
|
+
const inspector = this.state.inspector;
|
|
1015
|
+
if (!inspector || !this.inspectorController)
|
|
1016
|
+
return;
|
|
1017
|
+
const entries = this.inspectorController.view(this.state.recentToolDetails, inspector).entries;
|
|
1018
|
+
this.closeToolInspector();
|
|
1019
|
+
this.modalTransition = this.modalTransition
|
|
1020
|
+
.then(async () => {
|
|
1021
|
+
if (!this.surface) {
|
|
1022
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1023
|
+
type: 'setStatus',
|
|
1024
|
+
message: 'Inspector export requires an inline terminal surface.',
|
|
1025
|
+
});
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
for (const entry of entries) {
|
|
1029
|
+
let pageIndex = 0;
|
|
1030
|
+
for await (const page of this.inspectorController.readPages(entry)) {
|
|
1031
|
+
const heading = pageIndex === 0 ? `#${entry.sequence} ${entry.toolName}\n` : '';
|
|
1032
|
+
const rows = (0, transcript_layout_1.layoutTranscriptEntry)({
|
|
1033
|
+
role: 'tool',
|
|
1034
|
+
content: `${heading}${page.content}`,
|
|
1035
|
+
}, {
|
|
1036
|
+
width: this.transcriptWidth,
|
|
1037
|
+
theme: this.theme,
|
|
1038
|
+
toolOutputMode: 'full',
|
|
1039
|
+
});
|
|
1040
|
+
await this.surface.commit({
|
|
1041
|
+
batchId: `tui-inspector-export-${++this.commitSequence}`,
|
|
1042
|
+
generation: this.state.transcriptGeneration,
|
|
1043
|
+
reason: 'append',
|
|
1044
|
+
entries: [
|
|
1045
|
+
{
|
|
1046
|
+
displayKey: `inspector-export-${entry.callId}-${pageIndex}`,
|
|
1047
|
+
rows,
|
|
1048
|
+
},
|
|
1049
|
+
],
|
|
1050
|
+
}, () => this.buildLiveFrame(this.width));
|
|
1051
|
+
pageIndex += 1;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1055
|
+
type: 'setStatus',
|
|
1056
|
+
message: `Exported ${entries.length} tool result${entries.length === 1 ? '' : 's'} to scrollback.`,
|
|
1057
|
+
});
|
|
1058
|
+
this.scheduler.request('immediate');
|
|
1059
|
+
})
|
|
1060
|
+
.catch(error => this.handleSurfaceError(error));
|
|
1061
|
+
}
|
|
1062
|
+
openSelectedInspectorDetailInEditor() {
|
|
1063
|
+
const inspector = this.state.inspector;
|
|
1064
|
+
if (!inspector || !this.inspectorController)
|
|
1065
|
+
return;
|
|
1066
|
+
const selected = this.inspectorController.view(this.state.recentToolDetails, inspector).selected;
|
|
1067
|
+
if (!selected)
|
|
1068
|
+
return;
|
|
1069
|
+
if (!this.options.onOpenExternalEditor) {
|
|
1070
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1071
|
+
type: 'setStatus',
|
|
1072
|
+
message: 'External editor is unavailable in this TUI environment.',
|
|
1073
|
+
});
|
|
1074
|
+
this.paintInspector();
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
this.closeToolInspector();
|
|
1078
|
+
this.modalTransition = this.modalTransition
|
|
1079
|
+
.then(async () => {
|
|
1080
|
+
const directory = await (0, promises_1.mkdtemp)((0, path_1.join)((0, os_1.tmpdir)(), 'orion-code-tool-'));
|
|
1081
|
+
const filePath = (0, path_1.join)(directory, `${selected.sequence}-${safeFileName(selected.toolName)}.txt`);
|
|
1082
|
+
try {
|
|
1083
|
+
await this.inspectorController.writeDetailToFile(selected, filePath);
|
|
1084
|
+
await this.options.onOpenExternalEditor(filePath);
|
|
1085
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1086
|
+
type: 'setStatus',
|
|
1087
|
+
message: `Viewed #${selected.sequence} ${selected.toolName} in external editor.`,
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
finally {
|
|
1091
|
+
await (0, promises_1.rm)(directory, { recursive: true, force: true });
|
|
1092
|
+
}
|
|
1093
|
+
this.forceOwnedRedraw();
|
|
1094
|
+
})
|
|
1095
|
+
.catch(error => {
|
|
1096
|
+
this.state = (0, state_1.tuiUiReducer)(this.state, {
|
|
1097
|
+
type: 'setStatus',
|
|
1098
|
+
message: `External editor failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
1099
|
+
});
|
|
1100
|
+
this.forceOwnedRedraw();
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
paintInspector() {
|
|
1104
|
+
if (!this.state.inspector ||
|
|
1105
|
+
!this.inspectorController ||
|
|
1106
|
+
!this.inspectorSurface ||
|
|
1107
|
+
!this.inspectorReady)
|
|
1108
|
+
return;
|
|
1109
|
+
const frame = this.buildInspectorFrame();
|
|
1110
|
+
this.lastFrame = frame;
|
|
1111
|
+
void this.inspectorSurface.paint(frame).catch(error => this.handleSurfaceError(error));
|
|
1112
|
+
}
|
|
1113
|
+
buildInspectorFrame() {
|
|
1114
|
+
const inspector = this.state.inspector;
|
|
1115
|
+
const view = inspector && this.inspectorController
|
|
1116
|
+
? this.inspectorController.view(this.state.recentToolDetails, inspector)
|
|
1117
|
+
: {
|
|
1118
|
+
entries: [],
|
|
1119
|
+
selectedIndex: 0,
|
|
1120
|
+
expandedCallIds: [],
|
|
1121
|
+
searchQuery: '',
|
|
1122
|
+
detailOffset: 0,
|
|
1123
|
+
};
|
|
1124
|
+
return (0, transcript_inspector_layout_1.renderTranscriptInspectorFrame)(view, {
|
|
1125
|
+
width: this.width,
|
|
1126
|
+
height: this.height,
|
|
1127
|
+
theme: this.theme,
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
exports.TuiRunner = TuiRunner;
|
|
1132
|
+
function insertAtCursor(value, cursor, text) {
|
|
1133
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1134
|
+
return {
|
|
1135
|
+
value: value.slice(0, safeCursor) + text + value.slice(safeCursor),
|
|
1136
|
+
cursor: safeCursor + text.length,
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function visibleTuiCommandItems(input) {
|
|
1140
|
+
const query = input.startsWith('/')
|
|
1141
|
+
? input.slice(1).trim().split(/\s+/u, 1)[0].toLowerCase()
|
|
1142
|
+
: '';
|
|
1143
|
+
const local = [
|
|
1144
|
+
{
|
|
1145
|
+
value: 'tool-output',
|
|
1146
|
+
label: '/tool-output',
|
|
1147
|
+
description: 'Set TUI tool output mode',
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
value: 'redraw',
|
|
1151
|
+
label: '/redraw',
|
|
1152
|
+
description: 'Redraw the TUI-owned live region',
|
|
1153
|
+
},
|
|
1154
|
+
].filter(item => item.value.includes(query));
|
|
1155
|
+
const localNames = new Set(local.map(item => item.value));
|
|
1156
|
+
return [...local, ...(0, pickers_1.visibleCommandItems)(input).filter(item => !localNames.has(item.value))];
|
|
1157
|
+
}
|
|
1158
|
+
function safeFileName(value) {
|
|
1159
|
+
return value.replace(/[^a-zA-Z0-9._-]+/gu, '-').replace(/^-+|-+$/gu, '') || 'tool';
|
|
1160
|
+
}
|
|
1161
|
+
function deleteBeforeCursor(value, cursor) {
|
|
1162
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1163
|
+
if (safeCursor === 0)
|
|
1164
|
+
return { value, cursor: 0 };
|
|
1165
|
+
const previous = previousBoundary(value, safeCursor);
|
|
1166
|
+
return {
|
|
1167
|
+
value: value.slice(0, previous) + value.slice(safeCursor),
|
|
1168
|
+
cursor: previous,
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
function deleteAfterCursor(value, cursor) {
|
|
1172
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1173
|
+
if (safeCursor >= value.length)
|
|
1174
|
+
return { value, cursor: safeCursor };
|
|
1175
|
+
const next = nextBoundary(value, safeCursor);
|
|
1176
|
+
return {
|
|
1177
|
+
value: value.slice(0, safeCursor) + value.slice(next),
|
|
1178
|
+
cursor: safeCursor,
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
function deleteWordBeforeCursor(value, cursor) {
|
|
1182
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1183
|
+
const before = value.slice(0, safeCursor).replace(/\s*\S+\s*$/u, '');
|
|
1184
|
+
return {
|
|
1185
|
+
value: before + value.slice(safeCursor),
|
|
1186
|
+
cursor: before.length,
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
function previousBoundary(value, cursor) {
|
|
1190
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1191
|
+
let previous = 0;
|
|
1192
|
+
for (const boundary of graphemeBoundaries(value)) {
|
|
1193
|
+
if (boundary >= safeCursor)
|
|
1194
|
+
break;
|
|
1195
|
+
previous = boundary;
|
|
1196
|
+
}
|
|
1197
|
+
return previous;
|
|
1198
|
+
}
|
|
1199
|
+
function nextBoundary(value, cursor) {
|
|
1200
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1201
|
+
for (const boundary of graphemeBoundaries(value)) {
|
|
1202
|
+
if (boundary > safeCursor)
|
|
1203
|
+
return boundary;
|
|
1204
|
+
}
|
|
1205
|
+
return value.length;
|
|
1206
|
+
}
|
|
1207
|
+
function graphemeBoundaries(value) {
|
|
1208
|
+
const Segmenter = Intl.Segmenter;
|
|
1209
|
+
if (!Segmenter) {
|
|
1210
|
+
const boundaries = [0];
|
|
1211
|
+
let index = 0;
|
|
1212
|
+
for (const char of Array.from(value)) {
|
|
1213
|
+
index += char.length;
|
|
1214
|
+
boundaries.push(index);
|
|
1215
|
+
}
|
|
1216
|
+
return boundaries;
|
|
1217
|
+
}
|
|
1218
|
+
const segmenter = new Segmenter(undefined, { granularity: 'grapheme' });
|
|
1219
|
+
const boundaries = [0];
|
|
1220
|
+
for (const part of segmenter.segment(value)) {
|
|
1221
|
+
boundaries.push(part.index + part.segment.length);
|
|
1222
|
+
}
|
|
1223
|
+
return Array.from(new Set(boundaries)).sort((left, right) => left - right);
|
|
1224
|
+
}
|
|
1225
|
+
function clampCursor(value, cursor) {
|
|
1226
|
+
if (!Number.isFinite(cursor))
|
|
1227
|
+
return value.length;
|
|
1228
|
+
return Math.min(Math.max(0, Math.floor(cursor)), value.length);
|
|
1229
|
+
}
|
|
1230
|
+
/** Map an absolute character cursor to {line, col} within a multi-line value. */
|
|
1231
|
+
function lineColOfCursor(value, cursor) {
|
|
1232
|
+
const lines = value.split('\n');
|
|
1233
|
+
const safeCursor = clampCursor(value, cursor);
|
|
1234
|
+
let offset = 0;
|
|
1235
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1236
|
+
const lineLen = lines[i].length;
|
|
1237
|
+
if (safeCursor <= offset + lineLen) {
|
|
1238
|
+
return { line: i, col: safeCursor - offset };
|
|
1239
|
+
}
|
|
1240
|
+
offset += lineLen + 1; // +1 for the newline separator
|
|
1241
|
+
}
|
|
1242
|
+
const last = lines.length - 1;
|
|
1243
|
+
return { line: last, col: lines[last].length };
|
|
1244
|
+
}
|
|
1245
|
+
/** Map a {line, col} back to an absolute character cursor within a multi-line value. */
|
|
1246
|
+
function cursorOfLineCol(value, line, col) {
|
|
1247
|
+
const lines = value.split('\n');
|
|
1248
|
+
const safeLine = Math.max(0, Math.min(line, lines.length - 1));
|
|
1249
|
+
let offset = 0;
|
|
1250
|
+
for (let i = 0; i < safeLine; i++) {
|
|
1251
|
+
offset += lines[i].length + 1;
|
|
1252
|
+
}
|
|
1253
|
+
return offset + Math.max(0, Math.min(col, lines[safeLine].length));
|
|
1254
|
+
}
|
|
1255
|
+
//# sourceMappingURL=runner.js.map
|