@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,704 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RawTerminalEditor = void 0;
|
|
7
|
+
const readline_1 = __importDefault(require("readline"));
|
|
8
|
+
const string_width_1 = __importDefault(require("string-width"));
|
|
9
|
+
const input_parser_1 = require("../tui-core/input-parser");
|
|
10
|
+
const completion_1 = require("./completion");
|
|
11
|
+
const BRACKETED_PASTE_ENABLE = '\x1b[?2004h';
|
|
12
|
+
const BRACKETED_PASTE_DISABLE = '\x1b[?2004l';
|
|
13
|
+
/** v0.2.22: character-based limit (kept for backward compat, superseded by byte budget). */
|
|
14
|
+
const MAX_INPUT_CHARACTERS = 1000000;
|
|
15
|
+
const MAX_EDITOR_ROWS = 6;
|
|
16
|
+
const RENDER_DEBOUNCE_MS = 8;
|
|
17
|
+
/** v0.2.23: bounded input history (default 500). */
|
|
18
|
+
const MAX_HISTORY_SIZE = 500;
|
|
19
|
+
/** v0.2.23: UTF-8 byte budget — soft threshold triggers /edit hint, hard rejects new bytes. */
|
|
20
|
+
const INPUT_SOFT_BYTES = 64 * 1024; // 64 KiB
|
|
21
|
+
const INPUT_HARD_BYTES = 256 * 1024; // 256 KiB
|
|
22
|
+
class RawTerminalEditor {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.parser = new input_parser_1.TuiInputParser();
|
|
26
|
+
this.value = '';
|
|
27
|
+
this.cursor = 0;
|
|
28
|
+
this.promptValue = '';
|
|
29
|
+
this.questionPrompt = null;
|
|
30
|
+
this.questionResolve = null;
|
|
31
|
+
this.history = [];
|
|
32
|
+
this.historyIndex = null;
|
|
33
|
+
this.historyDraft = '';
|
|
34
|
+
this.running = false;
|
|
35
|
+
this.wasRaw = false;
|
|
36
|
+
this.resizeListenerAttached = false;
|
|
37
|
+
this.renderedRows = 0;
|
|
38
|
+
this.renderedCursorRow = 0;
|
|
39
|
+
this.inputLimitNoticeShown = false;
|
|
40
|
+
this.inputSoftNoticeShown = false;
|
|
41
|
+
this.renderTimer = null;
|
|
42
|
+
/** v0.2.23: saved draft during modal interactions (permission, picker, etc.). */
|
|
43
|
+
this.savedDraft = null;
|
|
44
|
+
this.handleData = (chunk) => {
|
|
45
|
+
this.feed(chunk);
|
|
46
|
+
};
|
|
47
|
+
this.handleResize = () => {
|
|
48
|
+
if (!this.running)
|
|
49
|
+
return;
|
|
50
|
+
this.render();
|
|
51
|
+
};
|
|
52
|
+
this.input = options.input ?? process.stdin;
|
|
53
|
+
this.output = options.output ?? process.stdout;
|
|
54
|
+
}
|
|
55
|
+
start() {
|
|
56
|
+
if (this.running)
|
|
57
|
+
return;
|
|
58
|
+
this.running = true;
|
|
59
|
+
this.wasRaw = this.input.isRaw === true;
|
|
60
|
+
this.input.setEncoding('utf8');
|
|
61
|
+
this.input.resume();
|
|
62
|
+
if (this.input.isTTY && typeof this.input.setRawMode === 'function') {
|
|
63
|
+
this.input.setRawMode(true);
|
|
64
|
+
}
|
|
65
|
+
if (this.output.isTTY !== false) {
|
|
66
|
+
this.output.write(BRACKETED_PASTE_ENABLE);
|
|
67
|
+
}
|
|
68
|
+
this.input.on('data', this.handleData);
|
|
69
|
+
this.attachResizeListener();
|
|
70
|
+
}
|
|
71
|
+
stop() {
|
|
72
|
+
if (!this.running)
|
|
73
|
+
return;
|
|
74
|
+
this.running = false;
|
|
75
|
+
this.cancelScheduledRender();
|
|
76
|
+
this.input.off('data', this.handleData);
|
|
77
|
+
this.detachResizeListener();
|
|
78
|
+
if (this.output.isTTY !== false) {
|
|
79
|
+
this.output.write(BRACKETED_PASTE_DISABLE);
|
|
80
|
+
}
|
|
81
|
+
if (this.input.isTTY && typeof this.input.setRawMode === 'function') {
|
|
82
|
+
this.input.setRawMode(this.wasRaw);
|
|
83
|
+
}
|
|
84
|
+
if (!this.wasRaw)
|
|
85
|
+
this.input.pause();
|
|
86
|
+
}
|
|
87
|
+
setPrompt(prompt) {
|
|
88
|
+
this.promptValue = prompt;
|
|
89
|
+
this.render();
|
|
90
|
+
}
|
|
91
|
+
ask(prompt, abortSignal) {
|
|
92
|
+
if (this.questionResolve) {
|
|
93
|
+
this.questionResolve('');
|
|
94
|
+
}
|
|
95
|
+
// v0.2.23: Save current draft before entering question mode.
|
|
96
|
+
if (!this.savedDraft) {
|
|
97
|
+
this.savedDraft = this.captureDraft();
|
|
98
|
+
}
|
|
99
|
+
// The question owns a fresh parser. Restore the interrupted UTF-8/paste
|
|
100
|
+
// state only after the modal answer has been consumed.
|
|
101
|
+
this.parser.reset();
|
|
102
|
+
this.questionPrompt = prompt;
|
|
103
|
+
this.value = '';
|
|
104
|
+
this.cursor = 0;
|
|
105
|
+
this.render();
|
|
106
|
+
return new Promise(resolve => {
|
|
107
|
+
let settled = false;
|
|
108
|
+
const finish = (answer) => {
|
|
109
|
+
if (settled)
|
|
110
|
+
return;
|
|
111
|
+
settled = true;
|
|
112
|
+
abortSignal?.removeEventListener('abort', onAbort);
|
|
113
|
+
// v0.2.23: Restore draft in finally via the caller.
|
|
114
|
+
resolve(answer);
|
|
115
|
+
};
|
|
116
|
+
const onAbort = () => {
|
|
117
|
+
this.cancelQuestion();
|
|
118
|
+
finish('');
|
|
119
|
+
};
|
|
120
|
+
this.questionResolve = finish;
|
|
121
|
+
abortSignal?.addEventListener('abort', onAbort, { once: true });
|
|
122
|
+
if (abortSignal?.aborted)
|
|
123
|
+
onAbort();
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
cancelQuestion() {
|
|
127
|
+
if (!this.questionResolve && !this.questionPrompt)
|
|
128
|
+
return;
|
|
129
|
+
const resolve = this.questionResolve;
|
|
130
|
+
this.questionPrompt = null;
|
|
131
|
+
this.questionResolve = null;
|
|
132
|
+
this.value = '';
|
|
133
|
+
this.cursor = 0;
|
|
134
|
+
resolve?.('');
|
|
135
|
+
// v0.2.23: Restore the pre-question draft.
|
|
136
|
+
if (this.savedDraft) {
|
|
137
|
+
this.restoreDraft(this.savedDraft);
|
|
138
|
+
this.savedDraft = null;
|
|
139
|
+
}
|
|
140
|
+
this.render();
|
|
141
|
+
}
|
|
142
|
+
writeExternal(text) {
|
|
143
|
+
this.writeExternalBatch([text]);
|
|
144
|
+
}
|
|
145
|
+
/** Write one external batch with a single prompt clear/redraw transaction. */
|
|
146
|
+
writeExternalBatch(chunks) {
|
|
147
|
+
const text = chunks.filter(Boolean).join('');
|
|
148
|
+
if (!text)
|
|
149
|
+
return true;
|
|
150
|
+
this.clearPromptLine();
|
|
151
|
+
const accepted = this.output.write(text.endsWith('\n') ? text : `${text}\n`);
|
|
152
|
+
this.render();
|
|
153
|
+
return accepted !== false;
|
|
154
|
+
}
|
|
155
|
+
feed(chunk) {
|
|
156
|
+
const events = this.parser.feed(chunk, { detectUnbracketedMultilinePaste: true });
|
|
157
|
+
for (const event of events) {
|
|
158
|
+
this.applyEvent(event);
|
|
159
|
+
}
|
|
160
|
+
return events;
|
|
161
|
+
}
|
|
162
|
+
getBuffer() {
|
|
163
|
+
return { value: this.value, cursor: this.cursor };
|
|
164
|
+
}
|
|
165
|
+
// --- v0.2.23: Modal draft preservation ---
|
|
166
|
+
/** Deep-copy the current editor state for modal restore. */
|
|
167
|
+
captureDraft() {
|
|
168
|
+
return {
|
|
169
|
+
value: this.value,
|
|
170
|
+
cursor: this.cursor,
|
|
171
|
+
parserState: this.parser.getState(),
|
|
172
|
+
historyIndex: this.historyIndex,
|
|
173
|
+
historyDraft: this.historyDraft,
|
|
174
|
+
inputLimitNoticeShown: this.inputLimitNoticeShown,
|
|
175
|
+
inputSoftNoticeShown: this.inputSoftNoticeShown,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** Restore editor state from a snapshot. Null is a safe no-op. */
|
|
179
|
+
restoreDraft(snapshot) {
|
|
180
|
+
if (!snapshot)
|
|
181
|
+
return;
|
|
182
|
+
this.value = snapshot.value;
|
|
183
|
+
this.cursor = clampCursor(snapshot.value, snapshot.cursor);
|
|
184
|
+
this.historyIndex = snapshot.historyIndex;
|
|
185
|
+
this.historyDraft = snapshot.historyDraft;
|
|
186
|
+
this.inputLimitNoticeShown = snapshot.inputLimitNoticeShown;
|
|
187
|
+
this.inputSoftNoticeShown = snapshot.inputSoftNoticeShown;
|
|
188
|
+
this.parser.setState(snapshot.parserState);
|
|
189
|
+
this.scheduleRender();
|
|
190
|
+
}
|
|
191
|
+
attachResizeListener() {
|
|
192
|
+
if (this.resizeListenerAttached)
|
|
193
|
+
return;
|
|
194
|
+
const output = this.output;
|
|
195
|
+
if (typeof output.on !== 'function')
|
|
196
|
+
return;
|
|
197
|
+
output.on('resize', this.handleResize);
|
|
198
|
+
this.resizeListenerAttached = true;
|
|
199
|
+
}
|
|
200
|
+
detachResizeListener() {
|
|
201
|
+
if (!this.resizeListenerAttached)
|
|
202
|
+
return;
|
|
203
|
+
const output = this.output;
|
|
204
|
+
if (typeof output.off === 'function') {
|
|
205
|
+
output.off('resize', this.handleResize);
|
|
206
|
+
}
|
|
207
|
+
else if (typeof output.removeListener === 'function') {
|
|
208
|
+
output.removeListener('resize', this.handleResize);
|
|
209
|
+
}
|
|
210
|
+
this.resizeListenerAttached = false;
|
|
211
|
+
}
|
|
212
|
+
applyEvent(event) {
|
|
213
|
+
if (event.type === 'text' || event.type === 'paste') {
|
|
214
|
+
this.insert(event.value);
|
|
215
|
+
if (event.type === 'paste') {
|
|
216
|
+
this.emitPasteNotice(event.value);
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.applyKey(event.key);
|
|
221
|
+
}
|
|
222
|
+
emitPasteNotice(value) {
|
|
223
|
+
const lines = (0, input_parser_1.normalizePastedText)(value).split('\n').length;
|
|
224
|
+
if (lines < 2)
|
|
225
|
+
return;
|
|
226
|
+
const suffix = lines >= 20 ? ' /edit is better for very long drafts.' : '';
|
|
227
|
+
this.options.onNotice?.(`Pasted ${lines} lines. Enter sends once; Ctrl+U clears.${suffix}`);
|
|
228
|
+
}
|
|
229
|
+
applyKey(key) {
|
|
230
|
+
switch (key) {
|
|
231
|
+
case 'enter':
|
|
232
|
+
this.submit();
|
|
233
|
+
return;
|
|
234
|
+
case 'newline':
|
|
235
|
+
this.insert('\n');
|
|
236
|
+
return;
|
|
237
|
+
case 'tab':
|
|
238
|
+
this.completeInput();
|
|
239
|
+
return;
|
|
240
|
+
case 'backspace':
|
|
241
|
+
this.deleteBeforeCursor();
|
|
242
|
+
return;
|
|
243
|
+
case 'delete':
|
|
244
|
+
this.deleteAfterCursor();
|
|
245
|
+
return;
|
|
246
|
+
case 'left':
|
|
247
|
+
this.cursor = previousBoundary(this.value, this.cursor);
|
|
248
|
+
this.scheduleRender();
|
|
249
|
+
return;
|
|
250
|
+
case 'right':
|
|
251
|
+
this.cursor = nextBoundary(this.value, this.cursor);
|
|
252
|
+
this.scheduleRender();
|
|
253
|
+
return;
|
|
254
|
+
case 'home':
|
|
255
|
+
this.cursor = currentLineStart(this.value, this.cursor);
|
|
256
|
+
this.scheduleRender();
|
|
257
|
+
return;
|
|
258
|
+
case 'end':
|
|
259
|
+
this.cursor = currentLineEnd(this.value, this.cursor);
|
|
260
|
+
this.scheduleRender();
|
|
261
|
+
return;
|
|
262
|
+
case 'up':
|
|
263
|
+
if (this.moveCursorAcrossLines(-1))
|
|
264
|
+
return;
|
|
265
|
+
this.moveHistory(-1);
|
|
266
|
+
return;
|
|
267
|
+
case 'down':
|
|
268
|
+
if (this.moveCursorAcrossLines(1))
|
|
269
|
+
return;
|
|
270
|
+
this.moveHistory(1);
|
|
271
|
+
return;
|
|
272
|
+
case 'ctrl+u':
|
|
273
|
+
this.setValue('');
|
|
274
|
+
return;
|
|
275
|
+
case 'ctrl+w':
|
|
276
|
+
this.deleteWordBeforeCursor();
|
|
277
|
+
return;
|
|
278
|
+
case 'ctrl+c':
|
|
279
|
+
this.options.onCtrlC();
|
|
280
|
+
return;
|
|
281
|
+
case 'ctrl+l':
|
|
282
|
+
this.redrawPrompt();
|
|
283
|
+
return;
|
|
284
|
+
case 'escape':
|
|
285
|
+
case 'pageup':
|
|
286
|
+
case 'pagedown':
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// --- v0.2.23: UTF-8 byte budget ---
|
|
291
|
+
/** Current input size in UTF-8 bytes. */
|
|
292
|
+
byteLength() {
|
|
293
|
+
return Buffer.byteLength(this.value, 'utf8');
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Try to accept text insertion. Returns the portion that fits within the
|
|
297
|
+
* hard byte budget, or empty string if the budget is exhausted.
|
|
298
|
+
*/
|
|
299
|
+
acceptBytes(text) {
|
|
300
|
+
const current = this.byteLength();
|
|
301
|
+
const remaining = Math.max(0, INPUT_HARD_BYTES - current);
|
|
302
|
+
if (remaining <= 0) {
|
|
303
|
+
// Hard limit: reject all new bytes.
|
|
304
|
+
if (!this.inputSoftNoticeShown) {
|
|
305
|
+
this.inputSoftNoticeShown = true;
|
|
306
|
+
this.options.onNotice?.(`Input limit reached (${(INPUT_HARD_BYTES / 1024).toFixed(0)} KiB). Use /edit for larger drafts, or submit/clear existing content.`);
|
|
307
|
+
}
|
|
308
|
+
return '';
|
|
309
|
+
}
|
|
310
|
+
// Accept text up to remaining bytes.
|
|
311
|
+
let accepted = '';
|
|
312
|
+
let byteCount = 0;
|
|
313
|
+
// Fast path: if all of text fits within remaining bytes, accept entire string.
|
|
314
|
+
if (Buffer.byteLength(text, 'utf8') <= remaining) {
|
|
315
|
+
accepted = text;
|
|
316
|
+
byteCount = Buffer.byteLength(text, 'utf8');
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
for (const char of text) {
|
|
320
|
+
const charBytes = Buffer.byteLength(char, 'utf8');
|
|
321
|
+
if (byteCount + charBytes > remaining)
|
|
322
|
+
break;
|
|
323
|
+
accepted += char;
|
|
324
|
+
byteCount += charBytes;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// Soft threshold: show /edit hint once.
|
|
328
|
+
const newTotal = current + byteCount;
|
|
329
|
+
if (newTotal >= INPUT_SOFT_BYTES && !this.inputSoftNoticeShown) {
|
|
330
|
+
this.inputSoftNoticeShown = true;
|
|
331
|
+
this.options.onNotice?.(`Input is large (${(newTotal / 1024).toFixed(1)} KiB). Consider /edit for better editing.`);
|
|
332
|
+
}
|
|
333
|
+
if (accepted.length < text.length) {
|
|
334
|
+
this.options.onNotice?.(`Input limit reached (${(INPUT_HARD_BYTES / 1024).toFixed(0)} KiB). Use /edit for larger drafts.`);
|
|
335
|
+
}
|
|
336
|
+
return accepted;
|
|
337
|
+
}
|
|
338
|
+
insert(text) {
|
|
339
|
+
const safeCursor = clampCursor(this.value, this.cursor);
|
|
340
|
+
// v0.2.23: UTF-8 byte budget check.
|
|
341
|
+
const accepted = this.acceptBytes(text);
|
|
342
|
+
// Also enforce the old character-based max as a safety net.
|
|
343
|
+
const charRemaining = Math.max(0, MAX_INPUT_CHARACTERS - this.value.length);
|
|
344
|
+
const finalAccepted = safeSlice(accepted, charRemaining);
|
|
345
|
+
if (!finalAccepted) {
|
|
346
|
+
this.scheduleRender();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
this.value = `${this.value.slice(0, safeCursor)}${finalAccepted}${this.value.slice(safeCursor)}`;
|
|
350
|
+
this.cursor = safeCursor + finalAccepted.length;
|
|
351
|
+
this.historyIndex = null;
|
|
352
|
+
this.scheduleRender();
|
|
353
|
+
}
|
|
354
|
+
completeInput() {
|
|
355
|
+
const result = (0, completion_1.applySingleTerminalTabCompletion)(this.value, this.options.cwd);
|
|
356
|
+
if (result.changed) {
|
|
357
|
+
this.setValue(result.value);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (result.matches.length > 0) {
|
|
361
|
+
this.options.onNotice?.((0, completion_1.summarizeTerminalCompletions)(result.matches));
|
|
362
|
+
this.scheduleRender();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
submit() {
|
|
366
|
+
const submitted = this.value;
|
|
367
|
+
this.render();
|
|
368
|
+
this.commitRenderedEditor();
|
|
369
|
+
this.value = '';
|
|
370
|
+
this.cursor = 0;
|
|
371
|
+
this.historyIndex = null;
|
|
372
|
+
this.historyDraft = '';
|
|
373
|
+
this.inputLimitNoticeShown = false;
|
|
374
|
+
this.inputSoftNoticeShown = false;
|
|
375
|
+
if (this.questionPrompt) {
|
|
376
|
+
const resolve = this.questionResolve;
|
|
377
|
+
this.questionPrompt = null;
|
|
378
|
+
this.questionResolve = null;
|
|
379
|
+
// v0.2.23: Restore the pre-question draft after answering.
|
|
380
|
+
if (this.savedDraft) {
|
|
381
|
+
this.restoreDraft(this.savedDraft);
|
|
382
|
+
this.savedDraft = null;
|
|
383
|
+
}
|
|
384
|
+
resolve?.(submitted);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (submitted.trim()) {
|
|
388
|
+
// v0.2.23: dedup adjacent entries and enforce history bound.
|
|
389
|
+
if (this.history.length === 0 || this.history[this.history.length - 1] !== submitted) {
|
|
390
|
+
this.history.push(submitted);
|
|
391
|
+
if (this.history.length > MAX_HISTORY_SIZE) {
|
|
392
|
+
this.history.shift();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
this.options.onSubmit(submitted);
|
|
397
|
+
}
|
|
398
|
+
setValue(value) {
|
|
399
|
+
this.value = safeSlice(value, MAX_INPUT_CHARACTERS);
|
|
400
|
+
this.cursor = this.value.length;
|
|
401
|
+
this.historyIndex = null;
|
|
402
|
+
this.inputLimitNoticeShown = false;
|
|
403
|
+
this.inputSoftNoticeShown = value.length > this.value.length;
|
|
404
|
+
this.scheduleRender();
|
|
405
|
+
}
|
|
406
|
+
deleteBeforeCursor() {
|
|
407
|
+
const safeCursor = clampCursor(this.value, this.cursor);
|
|
408
|
+
if (safeCursor === 0)
|
|
409
|
+
return;
|
|
410
|
+
const previous = previousBoundary(this.value, safeCursor);
|
|
411
|
+
this.value = `${this.value.slice(0, previous)}${this.value.slice(safeCursor)}`;
|
|
412
|
+
this.cursor = previous;
|
|
413
|
+
this.scheduleRender();
|
|
414
|
+
}
|
|
415
|
+
deleteAfterCursor() {
|
|
416
|
+
const safeCursor = clampCursor(this.value, this.cursor);
|
|
417
|
+
if (safeCursor >= this.value.length)
|
|
418
|
+
return;
|
|
419
|
+
const next = nextBoundary(this.value, safeCursor);
|
|
420
|
+
this.value = `${this.value.slice(0, safeCursor)}${this.value.slice(next)}`;
|
|
421
|
+
this.cursor = safeCursor;
|
|
422
|
+
this.scheduleRender();
|
|
423
|
+
}
|
|
424
|
+
deleteWordBeforeCursor() {
|
|
425
|
+
const safeCursor = clampCursor(this.value, this.cursor);
|
|
426
|
+
const before = this.value.slice(0, safeCursor).replace(/\s*\S+\s*$/u, '');
|
|
427
|
+
this.value = `${before}${this.value.slice(safeCursor)}`;
|
|
428
|
+
this.cursor = before.length;
|
|
429
|
+
this.scheduleRender();
|
|
430
|
+
}
|
|
431
|
+
moveHistory(delta) {
|
|
432
|
+
if (this.history.length === 0)
|
|
433
|
+
return;
|
|
434
|
+
if (this.historyIndex === null) {
|
|
435
|
+
this.historyDraft = this.value;
|
|
436
|
+
this.historyIndex = this.history.length;
|
|
437
|
+
}
|
|
438
|
+
this.historyIndex = Math.max(0, Math.min(this.history.length, this.historyIndex + delta));
|
|
439
|
+
const next = this.historyIndex === this.history.length
|
|
440
|
+
? this.historyDraft
|
|
441
|
+
: (this.history[this.historyIndex] ?? '');
|
|
442
|
+
this.value = next;
|
|
443
|
+
this.cursor = next.length;
|
|
444
|
+
this.scheduleRender();
|
|
445
|
+
}
|
|
446
|
+
moveCursorAcrossLines(delta) {
|
|
447
|
+
if (!this.value.includes('\n'))
|
|
448
|
+
return false;
|
|
449
|
+
const safeCursor = clampCursor(this.value, this.cursor);
|
|
450
|
+
const start = currentLineStart(this.value, safeCursor);
|
|
451
|
+
const column = safeCursor - start;
|
|
452
|
+
if (delta < 0) {
|
|
453
|
+
if (start === 0)
|
|
454
|
+
return true;
|
|
455
|
+
const targetEnd = start - 1;
|
|
456
|
+
const targetStart = currentLineStart(this.value, targetEnd);
|
|
457
|
+
this.cursor = Math.min(targetStart + column, targetEnd);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
const end = currentLineEnd(this.value, safeCursor);
|
|
461
|
+
if (end >= this.value.length)
|
|
462
|
+
return true;
|
|
463
|
+
const targetStart = end + 1;
|
|
464
|
+
const targetEnd = currentLineEnd(this.value, targetStart);
|
|
465
|
+
this.cursor = Math.min(targetStart + column, targetEnd);
|
|
466
|
+
}
|
|
467
|
+
this.scheduleRender();
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
scheduleRender() {
|
|
471
|
+
if (!this.running) {
|
|
472
|
+
this.render();
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (this.renderTimer)
|
|
476
|
+
return;
|
|
477
|
+
this.renderTimer = setTimeout(() => {
|
|
478
|
+
this.renderTimer = null;
|
|
479
|
+
if (this.running)
|
|
480
|
+
this.render();
|
|
481
|
+
}, RENDER_DEBOUNCE_MS);
|
|
482
|
+
}
|
|
483
|
+
cancelScheduledRender() {
|
|
484
|
+
if (!this.renderTimer)
|
|
485
|
+
return;
|
|
486
|
+
clearTimeout(this.renderTimer);
|
|
487
|
+
this.renderTimer = null;
|
|
488
|
+
}
|
|
489
|
+
render() {
|
|
490
|
+
this.cancelScheduledRender();
|
|
491
|
+
const prompt = this.questionPrompt ?? this.promptValue;
|
|
492
|
+
const width = Math.max(20, this.output.columns || 80);
|
|
493
|
+
const terminalRows = Math.max(4, this.output.rows || 24);
|
|
494
|
+
const frame = layoutEditorFrame({
|
|
495
|
+
prompt,
|
|
496
|
+
value: this.value,
|
|
497
|
+
cursor: this.cursor,
|
|
498
|
+
width,
|
|
499
|
+
maxRows: Math.min(MAX_EDITOR_ROWS, Math.max(1, terminalRows - 3)),
|
|
500
|
+
});
|
|
501
|
+
this.clearPromptLine();
|
|
502
|
+
for (let index = 0; index < frame.rows.length; index++) {
|
|
503
|
+
this.output.write(frame.rows[index]);
|
|
504
|
+
if (index < frame.rows.length - 1)
|
|
505
|
+
this.output.write('\r\n');
|
|
506
|
+
}
|
|
507
|
+
const rowsBelowCursor = frame.rows.length - 1 - frame.cursorRow;
|
|
508
|
+
if (rowsBelowCursor > 0 && this.output.isTTY !== false) {
|
|
509
|
+
readline_1.default.moveCursor(this.output, 0, -rowsBelowCursor);
|
|
510
|
+
}
|
|
511
|
+
readline_1.default.cursorTo(this.output, frame.cursorColumn);
|
|
512
|
+
this.renderedRows = frame.rows.length;
|
|
513
|
+
this.renderedCursorRow = frame.cursorRow;
|
|
514
|
+
}
|
|
515
|
+
clearPromptLine() {
|
|
516
|
+
if (this.output.isTTY === false)
|
|
517
|
+
return;
|
|
518
|
+
if (this.renderedRows > 1 && this.renderedCursorRow > 0) {
|
|
519
|
+
readline_1.default.moveCursor(this.output, 0, -this.renderedCursorRow);
|
|
520
|
+
}
|
|
521
|
+
readline_1.default.cursorTo(this.output, 0);
|
|
522
|
+
const rows = Math.max(1, this.renderedRows);
|
|
523
|
+
for (let index = 0; index < rows; index++) {
|
|
524
|
+
readline_1.default.clearLine(this.output, 0);
|
|
525
|
+
if (index < rows - 1)
|
|
526
|
+
readline_1.default.moveCursor(this.output, 0, 1);
|
|
527
|
+
}
|
|
528
|
+
if (rows > 1)
|
|
529
|
+
readline_1.default.moveCursor(this.output, 0, -(rows - 1));
|
|
530
|
+
readline_1.default.cursorTo(this.output, 0);
|
|
531
|
+
this.renderedRows = 0;
|
|
532
|
+
this.renderedCursorRow = 0;
|
|
533
|
+
}
|
|
534
|
+
// --- v0.2.23: Ctrl+L prompt-only redraw ---
|
|
535
|
+
/** Redraw only the editor-owned prompt rows without clearing native scrollback. */
|
|
536
|
+
redrawPrompt() {
|
|
537
|
+
// Clear editor-owned rendered rows.
|
|
538
|
+
this.clearPromptLine();
|
|
539
|
+
// Invalidate layout snapshot and re-render current prompt + input.
|
|
540
|
+
this.render();
|
|
541
|
+
}
|
|
542
|
+
commitRenderedEditor() {
|
|
543
|
+
if (this.output.isTTY !== false && this.renderedRows > 0) {
|
|
544
|
+
const rowsBelowCursor = this.renderedRows - 1 - this.renderedCursorRow;
|
|
545
|
+
if (rowsBelowCursor > 0)
|
|
546
|
+
readline_1.default.moveCursor(this.output, 0, rowsBelowCursor);
|
|
547
|
+
readline_1.default.cursorTo(this.output, 0);
|
|
548
|
+
}
|
|
549
|
+
this.output.write('\r\n');
|
|
550
|
+
this.renderedRows = 0;
|
|
551
|
+
this.renderedCursorRow = 0;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
exports.RawTerminalEditor = RawTerminalEditor;
|
|
555
|
+
function layoutEditorFrame(input) {
|
|
556
|
+
const safeCursor = clampCursor(input.value, input.cursor);
|
|
557
|
+
const promptCells = (0, string_width_1.default)(stripAnsi(input.prompt));
|
|
558
|
+
const available = Math.max(1, input.width - promptCells - 1);
|
|
559
|
+
const lines = input.value.split('\n');
|
|
560
|
+
const beforeCursor = input.value.slice(0, safeCursor);
|
|
561
|
+
const cursorLine = countNewlines(beforeCursor);
|
|
562
|
+
const cursorLineStart = beforeCursor.lastIndexOf('\n') + 1;
|
|
563
|
+
const cursorInLine = safeCursor - cursorLineStart;
|
|
564
|
+
const visibleRows = Math.max(1, Math.min(input.maxRows, lines.length));
|
|
565
|
+
const maxStart = Math.max(0, lines.length - visibleRows);
|
|
566
|
+
const viewportStart = Math.max(0, Math.min(maxStart, cursorLine - Math.floor(visibleRows / 2)));
|
|
567
|
+
const viewportEnd = Math.min(lines.length, viewportStart + visibleRows);
|
|
568
|
+
const continuation = ' '.repeat(promptCells);
|
|
569
|
+
const rows = [];
|
|
570
|
+
let cursorRow = 0;
|
|
571
|
+
let cursorColumn = promptCells;
|
|
572
|
+
for (let lineIndex = viewportStart; lineIndex < viewportEnd; lineIndex++) {
|
|
573
|
+
const prefix = rows.length === 0 ? input.prompt : continuation;
|
|
574
|
+
const line = displayInputLine(lines[lineIndex] ?? '');
|
|
575
|
+
if (lineIndex === cursorLine) {
|
|
576
|
+
const displayCursor = displayInputLine((lines[lineIndex] ?? '').slice(0, cursorInLine)).length;
|
|
577
|
+
const window = fitInputWindow(line, displayCursor, available);
|
|
578
|
+
rows.push(`${prefix}${window.visible}`);
|
|
579
|
+
cursorRow = rows.length - 1;
|
|
580
|
+
cursorColumn = Math.min(input.width - 1, promptCells + window.cursorColumn);
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
rows.push(`${prefix}${clipInputLine(line, available)}`);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return { rows, cursorRow, cursorColumn };
|
|
587
|
+
}
|
|
588
|
+
function displayInputLine(value) {
|
|
589
|
+
return value.replace(/\t/g, ' ').replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, '�');
|
|
590
|
+
}
|
|
591
|
+
function clipInputLine(value, available) {
|
|
592
|
+
if ((0, string_width_1.default)(value) <= available)
|
|
593
|
+
return value;
|
|
594
|
+
const marker = '›';
|
|
595
|
+
return `${takeLeftCells(value, Math.max(0, available - (0, string_width_1.default)(marker)))}${marker}`;
|
|
596
|
+
}
|
|
597
|
+
function countNewlines(value) {
|
|
598
|
+
let count = 0;
|
|
599
|
+
for (let index = 0; index < value.length; index++) {
|
|
600
|
+
if (value.charCodeAt(index) === 10)
|
|
601
|
+
count++;
|
|
602
|
+
}
|
|
603
|
+
return count;
|
|
604
|
+
}
|
|
605
|
+
function fitInputWindow(value, cursor, available) {
|
|
606
|
+
if ((0, string_width_1.default)(value) <= available) {
|
|
607
|
+
return { visible: value, cursorColumn: (0, string_width_1.default)(value.slice(0, cursor)) };
|
|
608
|
+
}
|
|
609
|
+
const before = value.slice(0, cursor);
|
|
610
|
+
const after = value.slice(cursor);
|
|
611
|
+
const marker = '‹';
|
|
612
|
+
const markerWidth = (0, string_width_1.default)(marker);
|
|
613
|
+
const afterHead = takeLeftCells(after, Math.min((0, string_width_1.default)(after), Math.max(0, Math.floor(available / 3))));
|
|
614
|
+
const beforeTail = takeRightCells(before, Math.max(0, available - markerWidth - (0, string_width_1.default)(afterHead)));
|
|
615
|
+
const visible = `${marker}${beforeTail}${afterHead}`;
|
|
616
|
+
return {
|
|
617
|
+
visible,
|
|
618
|
+
cursorColumn: markerWidth + (0, string_width_1.default)(beforeTail),
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
function takeLeftCells(value, maxWidth) {
|
|
622
|
+
let output = '';
|
|
623
|
+
for (const char of value) {
|
|
624
|
+
if ((0, string_width_1.default)(`${output}${char}`) > maxWidth)
|
|
625
|
+
break;
|
|
626
|
+
output += char;
|
|
627
|
+
}
|
|
628
|
+
return output;
|
|
629
|
+
}
|
|
630
|
+
function takeRightCells(value, maxWidth) {
|
|
631
|
+
let output = '';
|
|
632
|
+
const tailStart = Math.max(0, value.length - maxWidth * 4 - 16);
|
|
633
|
+
for (const char of Array.from(value.slice(tailStart)).reverse()) {
|
|
634
|
+
if ((0, string_width_1.default)(`${char}${output}`) > maxWidth)
|
|
635
|
+
break;
|
|
636
|
+
output = `${char}${output}`;
|
|
637
|
+
}
|
|
638
|
+
return output;
|
|
639
|
+
}
|
|
640
|
+
function stripAnsi(text) {
|
|
641
|
+
return text.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '');
|
|
642
|
+
}
|
|
643
|
+
function previousBoundary(value, cursor) {
|
|
644
|
+
const safeCursor = clampCursor(value, cursor);
|
|
645
|
+
let previous = 0;
|
|
646
|
+
for (const boundary of graphemeBoundaries(value)) {
|
|
647
|
+
if (boundary >= safeCursor)
|
|
648
|
+
break;
|
|
649
|
+
previous = boundary;
|
|
650
|
+
}
|
|
651
|
+
return previous;
|
|
652
|
+
}
|
|
653
|
+
function nextBoundary(value, cursor) {
|
|
654
|
+
const safeCursor = clampCursor(value, cursor);
|
|
655
|
+
for (const boundary of graphemeBoundaries(value)) {
|
|
656
|
+
if (boundary > safeCursor)
|
|
657
|
+
return boundary;
|
|
658
|
+
}
|
|
659
|
+
return value.length;
|
|
660
|
+
}
|
|
661
|
+
function graphemeBoundaries(value) {
|
|
662
|
+
const Segmenter = Intl.Segmenter;
|
|
663
|
+
if (!Segmenter) {
|
|
664
|
+
const boundaries = [0];
|
|
665
|
+
let index = 0;
|
|
666
|
+
for (const char of Array.from(value)) {
|
|
667
|
+
index += char.length;
|
|
668
|
+
boundaries.push(index);
|
|
669
|
+
}
|
|
670
|
+
return boundaries;
|
|
671
|
+
}
|
|
672
|
+
const segmenter = new Segmenter(undefined, { granularity: 'grapheme' });
|
|
673
|
+
const boundaries = [0];
|
|
674
|
+
for (const part of segmenter.segment(value)) {
|
|
675
|
+
boundaries.push(part.index + part.segment.length);
|
|
676
|
+
}
|
|
677
|
+
return Array.from(new Set(boundaries)).sort((left, right) => left - right);
|
|
678
|
+
}
|
|
679
|
+
function clampCursor(value, cursor) {
|
|
680
|
+
if (!Number.isFinite(cursor))
|
|
681
|
+
return value.length;
|
|
682
|
+
return Math.min(Math.max(0, Math.floor(cursor)), value.length);
|
|
683
|
+
}
|
|
684
|
+
function currentLineStart(value, cursor) {
|
|
685
|
+
const safeCursor = clampCursor(value, cursor);
|
|
686
|
+
if (safeCursor === 0)
|
|
687
|
+
return 0;
|
|
688
|
+
return value.lastIndexOf('\n', safeCursor - 1) + 1;
|
|
689
|
+
}
|
|
690
|
+
function currentLineEnd(value, cursor) {
|
|
691
|
+
const safeCursor = clampCursor(value, cursor);
|
|
692
|
+
const end = value.indexOf('\n', safeCursor);
|
|
693
|
+
return end < 0 ? value.length : end;
|
|
694
|
+
}
|
|
695
|
+
function safeSlice(value, maxLength) {
|
|
696
|
+
if (value.length <= maxLength)
|
|
697
|
+
return value;
|
|
698
|
+
let end = Math.max(0, maxLength);
|
|
699
|
+
const code = value.charCodeAt(end - 1);
|
|
700
|
+
if (code >= 0xd800 && code <= 0xdbff)
|
|
701
|
+
end--;
|
|
702
|
+
return value.slice(0, end);
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=raw-editor.js.map
|