strands-darwin 0.0.3
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/README.md +140 -0
- package/README.zh-CN.md +140 -0
- package/dist/patches/@strands-agents+sdk+1.16.0.patch +1443 -0
- package/dist/src/agent/background-delegation.d.ts +67 -0
- package/dist/src/agent/background-delegation.js +159 -0
- package/dist/src/agent/background-delegation.js.map +1 -0
- package/dist/src/agent/call-stats.d.ts +118 -0
- package/dist/src/agent/call-stats.js +128 -0
- package/dist/src/agent/call-stats.js.map +1 -0
- package/dist/src/agent/compact.d.ts +108 -0
- package/dist/src/agent/compact.js +192 -0
- package/dist/src/agent/compact.js.map +1 -0
- package/dist/src/agent/context-anchor.d.ts +64 -0
- package/dist/src/agent/context-anchor.js +43 -0
- package/dist/src/agent/context-anchor.js.map +1 -0
- package/dist/src/agent/cost.d.ts +56 -0
- package/dist/src/agent/cost.js +44 -0
- package/dist/src/agent/cost.js.map +1 -0
- package/dist/src/agent/diagnostics.d.ts +212 -0
- package/dist/src/agent/diagnostics.js +374 -0
- package/dist/src/agent/diagnostics.js.map +1 -0
- package/dist/src/agent/instructions.d.ts +54 -0
- package/dist/src/agent/instructions.js +118 -0
- package/dist/src/agent/instructions.js.map +1 -0
- package/dist/src/agent/max-tokens-recovery.d.ts +17 -0
- package/dist/src/agent/max-tokens-recovery.js +65 -0
- package/dist/src/agent/max-tokens-recovery.js.map +1 -0
- package/dist/src/agent/model-call-budget.d.ts +8 -0
- package/dist/src/agent/model-call-budget.js +24 -0
- package/dist/src/agent/model-call-budget.js.map +1 -0
- package/dist/src/agent/model-retry.d.ts +134 -0
- package/dist/src/agent/model-retry.js +256 -0
- package/dist/src/agent/model-retry.js.map +1 -0
- package/dist/src/agent/permission-rules.d.ts +47 -0
- package/dist/src/agent/permission-rules.js +260 -0
- package/dist/src/agent/permission-rules.js.map +1 -0
- package/dist/src/agent/permission.d.ts +361 -0
- package/dist/src/agent/permission.js +797 -0
- package/dist/src/agent/permission.js.map +1 -0
- package/dist/src/agent/prompt-cache.d.ts +66 -0
- package/dist/src/agent/prompt-cache.js +194 -0
- package/dist/src/agent/prompt-cache.js.map +1 -0
- package/dist/src/agent/refusal.d.ts +20 -0
- package/dist/src/agent/refusal.js +23 -0
- package/dist/src/agent/refusal.js.map +1 -0
- package/dist/src/agent/retry-guard.d.ts +26 -0
- package/dist/src/agent/retry-guard.js +193 -0
- package/dist/src/agent/retry-guard.js.map +1 -0
- package/dist/src/agent/rewind.d.ts +29 -0
- package/dist/src/agent/rewind.js +118 -0
- package/dist/src/agent/rewind.js.map +1 -0
- package/dist/src/agent/runtime.d.ts +814 -0
- package/dist/src/agent/runtime.js +1596 -0
- package/dist/src/agent/runtime.js.map +1 -0
- package/dist/src/agent/safety-classifier.d.ts +11 -0
- package/dist/src/agent/safety-classifier.js +0 -0
- package/dist/src/agent/safety-classifier.js.map +1 -0
- package/dist/src/agent/sdk-logging.d.ts +49 -0
- package/dist/src/agent/sdk-logging.js +110 -0
- package/dist/src/agent/sdk-logging.js.map +1 -0
- package/dist/src/agent/session.d.ts +102 -0
- package/dist/src/agent/session.js +244 -0
- package/dist/src/agent/session.js.map +1 -0
- package/dist/src/agent/stream-resumption.d.ts +16 -0
- package/dist/src/agent/stream-resumption.js +33 -0
- package/dist/src/agent/stream-resumption.js.map +1 -0
- package/dist/src/agent/system-prompt.d.ts +50 -0
- package/dist/src/agent/system-prompt.js +161 -0
- package/dist/src/agent/system-prompt.js.map +1 -0
- package/dist/src/agent/thinking.d.ts +99 -0
- package/dist/src/agent/thinking.js +145 -0
- package/dist/src/agent/thinking.js.map +1 -0
- package/dist/src/agent/usage.d.ts +132 -0
- package/dist/src/agent/usage.js +233 -0
- package/dist/src/agent/usage.js.map +1 -0
- package/dist/src/agent/working-context.d.ts +51 -0
- package/dist/src/agent/working-context.js +160 -0
- package/dist/src/agent/working-context.js.map +1 -0
- package/dist/src/agents/child-recipe.d.ts +33 -0
- package/dist/src/agents/child-recipe.js +98 -0
- package/dist/src/agents/child-recipe.js.map +1 -0
- package/dist/src/agents/concurrency-limit.d.ts +25 -0
- package/dist/src/agents/concurrency-limit.js +43 -0
- package/dist/src/agents/concurrency-limit.js.map +1 -0
- package/dist/src/agents/dispatch-registry.d.ts +180 -0
- package/dist/src/agents/dispatch-registry.js +289 -0
- package/dist/src/agents/dispatch-registry.js.map +1 -0
- package/dist/src/agents/failed-child-text.d.ts +44 -0
- package/dist/src/agents/failed-child-text.js +69 -0
- package/dist/src/agents/failed-child-text.js.map +1 -0
- package/dist/src/agents/loader.d.ts +26 -0
- package/dist/src/agents/loader.js +134 -0
- package/dist/src/agents/loader.js.map +1 -0
- package/dist/src/agents/report-projection.d.ts +31 -0
- package/dist/src/agents/report-projection.js +125 -0
- package/dist/src/agents/report-projection.js.map +1 -0
- package/dist/src/agents/subagent-tool.d.ts +61 -0
- package/dist/src/agents/subagent-tool.js +180 -0
- package/dist/src/agents/subagent-tool.js.map +1 -0
- package/dist/src/agents/workflow-tool.d.ts +85 -0
- package/dist/src/agents/workflow-tool.js +530 -0
- package/dist/src/agents/workflow-tool.js.map +1 -0
- package/dist/src/cli-args.d.ts +39 -0
- package/dist/src/cli-args.js +198 -0
- package/dist/src/cli-args.js.map +1 -0
- package/dist/src/cli-doctor.d.ts +26 -0
- package/dist/src/cli-doctor.js +398 -0
- package/dist/src/cli-doctor.js.map +1 -0
- package/dist/src/cli-main.d.ts +1 -0
- package/dist/src/cli-main.js +279 -0
- package/dist/src/cli-main.js.map +1 -0
- package/dist/src/cli-sessions.d.ts +17 -0
- package/dist/src/cli-sessions.js +136 -0
- package/dist/src/cli-sessions.js.map +1 -0
- package/dist/src/cli-trajectory.d.ts +37 -0
- package/dist/src/cli-trajectory.js +303 -0
- package/dist/src/cli-trajectory.js.map +1 -0
- package/dist/src/cli-usage.d.ts +18 -0
- package/dist/src/cli-usage.js +53 -0
- package/dist/src/cli-usage.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +29 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/custom-commands.d.ts +43 -0
- package/dist/src/commands/custom-commands.js +155 -0
- package/dist/src/commands/custom-commands.js.map +1 -0
- package/dist/src/commands/workflow-command.d.ts +26 -0
- package/dist/src/commands/workflow-command.js +56 -0
- package/dist/src/commands/workflow-command.js.map +1 -0
- package/dist/src/config.d.ts +463 -0
- package/dist/src/config.js +1457 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-overflow-error.d.ts +7 -0
- package/dist/src/context-overflow-error.js +26 -0
- package/dist/src/context-overflow-error.js.map +1 -0
- package/dist/src/dev-repl.d.ts +1 -0
- package/dist/src/dev-repl.js +365 -0
- package/dist/src/dev-repl.js.map +1 -0
- package/dist/src/headless-protocol.d.ts +147 -0
- package/dist/src/headless-protocol.js +359 -0
- package/dist/src/headless-protocol.js.map +1 -0
- package/dist/src/headless-runner.d.ts +30 -0
- package/dist/src/headless-runner.js +405 -0
- package/dist/src/headless-runner.js.map +1 -0
- package/dist/src/headless-stdin.d.ts +28 -0
- package/dist/src/headless-stdin.js +78 -0
- package/dist/src/headless-stdin.js.map +1 -0
- package/dist/src/headless.d.ts +106 -0
- package/dist/src/headless.js +229 -0
- package/dist/src/headless.js.map +1 -0
- package/dist/src/hooks/codex-hook-runner.d.ts +92 -0
- package/dist/src/hooks/codex-hook-runner.js +446 -0
- package/dist/src/hooks/codex-hook-runner.js.map +1 -0
- package/dist/src/hooks/codex-hooks.d.ts +23 -0
- package/dist/src/hooks/codex-hooks.js +152 -0
- package/dist/src/hooks/codex-hooks.js.map +1 -0
- package/dist/src/hooks/hook-process.d.ts +23 -0
- package/dist/src/hooks/hook-process.js +241 -0
- package/dist/src/hooks/hook-process.js.map +1 -0
- package/dist/src/hooks/lifecycle-hooks.d.ts +37 -0
- package/dist/src/hooks/lifecycle-hooks.js +153 -0
- package/dist/src/hooks/lifecycle-hooks.js.map +1 -0
- package/dist/src/hooks/tool-hooks.d.ts +63 -0
- package/dist/src/hooks/tool-hooks.js +350 -0
- package/dist/src/hooks/tool-hooks.js.map +1 -0
- package/dist/src/mcp/codegraph-preflight.d.ts +29 -0
- package/dist/src/mcp/codegraph-preflight.js +232 -0
- package/dist/src/mcp/codegraph-preflight.js.map +1 -0
- package/dist/src/mcp/registry.d.ts +133 -0
- package/dist/src/mcp/registry.js +209 -0
- package/dist/src/mcp/registry.js.map +1 -0
- package/dist/src/mcp/web-search-empty-results.d.ts +14 -0
- package/dist/src/mcp/web-search-empty-results.js +94 -0
- package/dist/src/mcp/web-search-empty-results.js.map +1 -0
- package/dist/src/memory/command.d.ts +11 -0
- package/dist/src/memory/command.js +253 -0
- package/dist/src/memory/command.js.map +1 -0
- package/dist/src/memory/controller.d.ts +51 -0
- package/dist/src/memory/controller.js +316 -0
- package/dist/src/memory/controller.js.map +1 -0
- package/dist/src/memory/prompt.d.ts +4 -0
- package/dist/src/memory/prompt.js +22 -0
- package/dist/src/memory/prompt.js.map +1 -0
- package/dist/src/memory/scheduler.d.ts +33 -0
- package/dist/src/memory/scheduler.js +134 -0
- package/dist/src/memory/scheduler.js.map +1 -0
- package/dist/src/memory/state.d.ts +112 -0
- package/dist/src/memory/state.js +355 -0
- package/dist/src/memory/state.js.map +1 -0
- package/dist/src/memory/store.d.ts +19 -0
- package/dist/src/memory/store.js +130 -0
- package/dist/src/memory/store.js.map +1 -0
- package/dist/src/memory/tools.d.ts +29 -0
- package/dist/src/memory/tools.js +22 -0
- package/dist/src/memory/tools.js.map +1 -0
- package/dist/src/memory/validation.d.ts +33 -0
- package/dist/src/memory/validation.js +159 -0
- package/dist/src/memory/validation.js.map +1 -0
- package/dist/src/npm-package/generate-patch.d.ts +23 -0
- package/dist/src/npm-package/generate-patch.js +88 -0
- package/dist/src/npm-package/generate-patch.js.map +1 -0
- package/dist/src/npm-package/patch-package-format.d.ts +43 -0
- package/dist/src/npm-package/patch-package-format.js +66 -0
- package/dist/src/npm-package/patch-package-format.js.map +1 -0
- package/dist/src/paths.d.ts +39 -0
- package/dist/src/paths.js +105 -0
- package/dist/src/paths.js.map +1 -0
- package/dist/src/pricing/cost.d.ts +182 -0
- package/dist/src/pricing/cost.js +215 -0
- package/dist/src/pricing/cost.js.map +1 -0
- package/dist/src/pricing/model-prices.d.ts +112 -0
- package/dist/src/pricing/model-prices.js +320 -0
- package/dist/src/pricing/model-prices.js.map +1 -0
- package/dist/src/sdk-patch-preflight.d.ts +23 -0
- package/dist/src/sdk-patch-preflight.js +71 -0
- package/dist/src/sdk-patch-preflight.js.map +1 -0
- package/dist/src/skills/builtin/commit-message/SKILL.md +45 -0
- package/dist/src/skills/builtin/commit-message/references/types.md +8 -0
- package/dist/src/skills/builtin/developer/SKILL.md +107 -0
- package/dist/src/skills/builtin/self-evolution-research/SKILL.md +150 -0
- package/dist/src/skills/builtin/self-evolution-research/scripts/roll-research-path.mjs +208 -0
- package/dist/src/skills/builtin/self-reflection/SKILL.md +172 -0
- package/dist/src/skills/builtin/self-reflection/references/reflection-template.md +90 -0
- package/dist/src/skills/builtin/self-reflection/scripts/locate-trajectory.mjs +175 -0
- package/dist/src/skills/loader.d.ts +26 -0
- package/dist/src/skills/loader.js +186 -0
- package/dist/src/skills/loader.js.map +1 -0
- package/dist/src/skills/plugin.d.ts +34 -0
- package/dist/src/skills/plugin.js +137 -0
- package/dist/src/skills/plugin.js.map +1 -0
- package/dist/src/skills/prompt.d.ts +8 -0
- package/dist/src/skills/prompt.js +214 -0
- package/dist/src/skills/prompt.js.map +1 -0
- package/dist/src/skills/resource-safety.d.ts +15 -0
- package/dist/src/skills/resource-safety.js +149 -0
- package/dist/src/skills/resource-safety.js.map +1 -0
- package/dist/src/tools/background-bash.d.ts +95 -0
- package/dist/src/tools/background-bash.js +639 -0
- package/dist/src/tools/background-bash.js.map +1 -0
- package/dist/src/tools/background-tail.d.ts +28 -0
- package/dist/src/tools/background-tail.js +75 -0
- package/dist/src/tools/background-tail.js.map +1 -0
- package/dist/src/tools/background-wait-contract.d.ts +4 -0
- package/dist/src/tools/background-wait-contract.js +7 -0
- package/dist/src/tools/background-wait-contract.js.map +1 -0
- package/dist/src/tools/file-editor-serial.d.ts +24 -0
- package/dist/src/tools/file-editor-serial.js +99 -0
- package/dist/src/tools/file-editor-serial.js.map +1 -0
- package/dist/src/tools/image-viewer.d.ts +43 -0
- package/dist/src/tools/image-viewer.js +256 -0
- package/dist/src/tools/image-viewer.js.map +1 -0
- package/dist/src/tools/update-plan.d.ts +30 -0
- package/dist/src/tools/update-plan.js +65 -0
- package/dist/src/tools/update-plan.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +70 -0
- package/dist/src/tools/web-fetch.js +667 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/trajectory/export.d.ts +31 -0
- package/dist/src/trajectory/export.js +116 -0
- package/dist/src/trajectory/export.js.map +1 -0
- package/dist/src/trajectory/fork.d.ts +19 -0
- package/dist/src/trajectory/fork.js +110 -0
- package/dist/src/trajectory/fork.js.map +1 -0
- package/dist/src/trajectory/memory-tool.d.ts +20 -0
- package/dist/src/trajectory/memory-tool.js +98 -0
- package/dist/src/trajectory/memory-tool.js.map +1 -0
- package/dist/src/trajectory/prompt-history.d.ts +62 -0
- package/dist/src/trajectory/prompt-history.js +256 -0
- package/dist/src/trajectory/prompt-history.js.map +1 -0
- package/dist/src/trajectory/reader.d.ts +21 -0
- package/dist/src/trajectory/reader.js +62 -0
- package/dist/src/trajectory/reader.js.map +1 -0
- package/dist/src/trajectory/record.d.ts +417 -0
- package/dist/src/trajectory/record.js +394 -0
- package/dist/src/trajectory/record.js.map +1 -0
- package/dist/src/trajectory/replay.d.ts +74 -0
- package/dist/src/trajectory/replay.js +285 -0
- package/dist/src/trajectory/replay.js.map +1 -0
- package/dist/src/trajectory/resume-recap.d.ts +43 -0
- package/dist/src/trajectory/resume-recap.js +68 -0
- package/dist/src/trajectory/resume-recap.js.map +1 -0
- package/dist/src/trajectory/search.d.ts +40 -0
- package/dist/src/trajectory/search.js +127 -0
- package/dist/src/trajectory/search.js.map +1 -0
- package/dist/src/trajectory/spend.d.ts +157 -0
- package/dist/src/trajectory/spend.js +264 -0
- package/dist/src/trajectory/spend.js.map +1 -0
- package/dist/src/trajectory/stream.d.ts +30 -0
- package/dist/src/trajectory/stream.js +30 -0
- package/dist/src/trajectory/stream.js.map +1 -0
- package/dist/src/trajectory/writer.d.ts +310 -0
- package/dist/src/trajectory/writer.js +636 -0
- package/dist/src/trajectory/writer.js.map +1 -0
- package/dist/src/tui/App.d.ts +109 -0
- package/dist/src/tui/App.js +2660 -0
- package/dist/src/tui/App.js.map +1 -0
- package/dist/src/tui/InputBox.d.ts +90 -0
- package/dist/src/tui/InputBox.js +129 -0
- package/dist/src/tui/InputBox.js.map +1 -0
- package/dist/src/tui/MarkdownText.d.ts +16 -0
- package/dist/src/tui/MarkdownText.js +117 -0
- package/dist/src/tui/MarkdownText.js.map +1 -0
- package/dist/src/tui/MessageList.d.ts +27 -0
- package/dist/src/tui/MessageList.js +61 -0
- package/dist/src/tui/MessageList.js.map +1 -0
- package/dist/src/tui/PermissionPrompt.d.ts +18 -0
- package/dist/src/tui/PermissionPrompt.js +114 -0
- package/dist/src/tui/PermissionPrompt.js.map +1 -0
- package/dist/src/tui/PlanChecklist.d.ts +7 -0
- package/dist/src/tui/PlanChecklist.js +12 -0
- package/dist/src/tui/PlanChecklist.js.map +1 -0
- package/dist/src/tui/QueuedMessages.d.ts +8 -0
- package/dist/src/tui/QueuedMessages.js +24 -0
- package/dist/src/tui/QueuedMessages.js.map +1 -0
- package/dist/src/tui/StartupScreen.d.ts +25 -0
- package/dist/src/tui/StartupScreen.js +51 -0
- package/dist/src/tui/StartupScreen.js.map +1 -0
- package/dist/src/tui/ToolCallPanel.d.ts +33 -0
- package/dist/src/tui/ToolCallPanel.js +112 -0
- package/dist/src/tui/ToolCallPanel.js.map +1 -0
- package/dist/src/tui/WelcomeHeader.d.ts +30 -0
- package/dist/src/tui/WelcomeHeader.js +69 -0
- package/dist/src/tui/WelcomeHeader.js.map +1 -0
- package/dist/src/tui/background-tool-presentation.d.ts +22 -0
- package/dist/src/tui/background-tool-presentation.js +209 -0
- package/dist/src/tui/background-tool-presentation.js.map +1 -0
- package/dist/src/tui/busy-suffix.d.ts +37 -0
- package/dist/src/tui/busy-suffix.js +39 -0
- package/dist/src/tui/busy-suffix.js.map +1 -0
- package/dist/src/tui/clipboard-image.d.ts +18 -0
- package/dist/src/tui/clipboard-image.js +109 -0
- package/dist/src/tui/clipboard-image.js.map +1 -0
- package/dist/src/tui/context-format.d.ts +43 -0
- package/dist/src/tui/context-format.js +71 -0
- package/dist/src/tui/context-format.js.map +1 -0
- package/dist/src/tui/copy-command.d.ts +68 -0
- package/dist/src/tui/copy-command.js +182 -0
- package/dist/src/tui/copy-command.js.map +1 -0
- package/dist/src/tui/edit-diff.d.ts +135 -0
- package/dist/src/tui/edit-diff.js +356 -0
- package/dist/src/tui/edit-diff.js.map +1 -0
- package/dist/src/tui/frame-budget.d.ts +351 -0
- package/dist/src/tui/frame-budget.js +446 -0
- package/dist/src/tui/frame-budget.js.map +1 -0
- package/dist/src/tui/help-format.d.ts +17 -0
- package/dist/src/tui/help-format.js +38 -0
- package/dist/src/tui/help-format.js.map +1 -0
- package/dist/src/tui/live-text.d.ts +51 -0
- package/dist/src/tui/live-text.js +154 -0
- package/dist/src/tui/live-text.js.map +1 -0
- package/dist/src/tui/markdown.d.ts +62 -0
- package/dist/src/tui/markdown.js +244 -0
- package/dist/src/tui/markdown.js.map +1 -0
- package/dist/src/tui/mcp-format.d.ts +28 -0
- package/dist/src/tui/mcp-format.js +67 -0
- package/dist/src/tui/mcp-format.js.map +1 -0
- package/dist/src/tui/path-completion.d.ts +119 -0
- package/dist/src/tui/path-completion.js +305 -0
- package/dist/src/tui/path-completion.js.map +1 -0
- package/dist/src/tui/permission-queue.d.ts +61 -0
- package/dist/src/tui/permission-queue.js +129 -0
- package/dist/src/tui/permission-queue.js.map +1 -0
- package/dist/src/tui/plan-format.d.ts +9 -0
- package/dist/src/tui/plan-format.js +30 -0
- package/dist/src/tui/plan-format.js.map +1 -0
- package/dist/src/tui/prompt-completion.d.ts +22 -0
- package/dist/src/tui/prompt-completion.js +46 -0
- package/dist/src/tui/prompt-completion.js.map +1 -0
- package/dist/src/tui/prompt-editor.d.ts +102 -0
- package/dist/src/tui/prompt-editor.js +379 -0
- package/dist/src/tui/prompt-editor.js.map +1 -0
- package/dist/src/tui/prompt-history-search.d.ts +53 -0
- package/dist/src/tui/prompt-history-search.js +123 -0
- package/dist/src/tui/prompt-history-search.js.map +1 -0
- package/dist/src/tui/prompt-queue.d.ts +58 -0
- package/dist/src/tui/prompt-queue.js +74 -0
- package/dist/src/tui/prompt-queue.js.map +1 -0
- package/dist/src/tui/prompt-recall.d.ts +74 -0
- package/dist/src/tui/prompt-recall.js +90 -0
- package/dist/src/tui/prompt-recall.js.map +1 -0
- package/dist/src/tui/react-environment.d.ts +11 -0
- package/dist/src/tui/react-environment.js +24 -0
- package/dist/src/tui/react-environment.js.map +1 -0
- package/dist/src/tui/rewind-search.d.ts +34 -0
- package/dist/src/tui/rewind-search.js +68 -0
- package/dist/src/tui/rewind-search.js.map +1 -0
- package/dist/src/tui/shell-command.d.ts +114 -0
- package/dist/src/tui/shell-command.js +310 -0
- package/dist/src/tui/shell-command.js.map +1 -0
- package/dist/src/tui/spend-advisory.d.ts +52 -0
- package/dist/src/tui/spend-advisory.js +64 -0
- package/dist/src/tui/spend-advisory.js.map +1 -0
- package/dist/src/tui/status-format.d.ts +120 -0
- package/dist/src/tui/status-format.js +192 -0
- package/dist/src/tui/status-format.js.map +1 -0
- package/dist/src/tui/subagent-format.d.ts +49 -0
- package/dist/src/tui/subagent-format.js +146 -0
- package/dist/src/tui/subagent-format.js.map +1 -0
- package/dist/src/tui/task-format.d.ts +29 -0
- package/dist/src/tui/task-format.js +87 -0
- package/dist/src/tui/task-format.js.map +1 -0
- package/dist/src/tui/terminal-bell.d.ts +20 -0
- package/dist/src/tui/terminal-bell.js +33 -0
- package/dist/src/tui/terminal-bell.js.map +1 -0
- package/dist/src/tui/tool-detail-presentation.d.ts +60 -0
- package/dist/src/tui/tool-detail-presentation.js +206 -0
- package/dist/src/tui/tool-detail-presentation.js.map +1 -0
- package/dist/src/tui/turn-state.d.ts +195 -0
- package/dist/src/tui/turn-state.js +548 -0
- package/dist/src/tui/turn-state.js.map +1 -0
- package/dist/src/tui/visual-language.d.ts +45 -0
- package/dist/src/tui/visual-language.js +57 -0
- package/dist/src/tui/visual-language.js.map +1 -0
- package/dist/src/version.d.ts +7 -0
- package/dist/src/version.js +38 -0
- package/dist/src/version.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reverse-search state over the bounded project prompt history.
|
|
3
|
+
*
|
|
4
|
+
* Disk access stays in `trajectory/prompt-history.ts`; this module only snapshots
|
|
5
|
+
* that reader's already bounded entries and transforms local keystrokes. The opening
|
|
6
|
+
* editor value is retained byte-for-byte so Escape can restore text, offset and
|
|
7
|
+
* affinity even when terminal input and React renders are batched.
|
|
8
|
+
*/
|
|
9
|
+
import { type PromptHistory } from '../trajectory/prompt-history.js';
|
|
10
|
+
import type { EditorValue } from './prompt-editor.js';
|
|
11
|
+
/** A query can never grow without bound, including when a terminal pastes one event. */
|
|
12
|
+
export declare const MAX_PROMPT_SEARCH_QUERY_CODE_POINTS = 256;
|
|
13
|
+
/** A fixed presentation cap; shorter terminals may grant fewer through the frame budget. */
|
|
14
|
+
export declare const MAX_PROMPT_SEARCH_MATCHES = 5;
|
|
15
|
+
export interface PromptHistorySearch {
|
|
16
|
+
/** Exact editor snapshot restored by cancellation. */
|
|
17
|
+
readonly original: EditorValue;
|
|
18
|
+
/** Reader generation this search may accept; stale asynchronous reads are ignored. */
|
|
19
|
+
readonly requestId: number;
|
|
20
|
+
/** The reader's newest-first, duplicate-collapsed bounded snapshot. */
|
|
21
|
+
readonly entries: readonly string[];
|
|
22
|
+
readonly query: string;
|
|
23
|
+
readonly matches: readonly string[];
|
|
24
|
+
readonly selected: number;
|
|
25
|
+
readonly pending: boolean;
|
|
26
|
+
/** Reader omissions/degradation, kept on the bounded title row. */
|
|
27
|
+
readonly note: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
export interface PromptHistorySearchView {
|
|
30
|
+
readonly title: string;
|
|
31
|
+
readonly matches: readonly string[];
|
|
32
|
+
/** Selected index within the bounded visible window. */
|
|
33
|
+
readonly selected: number;
|
|
34
|
+
readonly hiddenAbove: number;
|
|
35
|
+
readonly hiddenBelow: number;
|
|
36
|
+
}
|
|
37
|
+
/** Opens without waiting for disk; `history` is absent while that bounded read lands. */
|
|
38
|
+
export declare function openPromptHistorySearch(original: EditorValue, requestId: number, history: PromptHistory | undefined): PromptHistorySearch;
|
|
39
|
+
/** Applies only the read requested by this search instance. */
|
|
40
|
+
export declare function resolvePromptHistorySearch(search: PromptHistorySearch, requestId: number, history: PromptHistory): PromptHistorySearch;
|
|
41
|
+
/** Appends printable query text with a Unicode code-point bound. */
|
|
42
|
+
export declare function appendPromptHistorySearchQuery(search: PromptHistorySearch, inserted: string): PromptHistorySearch;
|
|
43
|
+
/** Removes one Unicode code point, never half of a surrogate pair. */
|
|
44
|
+
export declare function backspacePromptHistorySearchQuery(search: PromptHistorySearch): PromptHistorySearch;
|
|
45
|
+
export declare function clearPromptHistorySearchQuery(search: PromptHistorySearch): PromptHistorySearch;
|
|
46
|
+
/** Navigation wraps through the bounded reader snapshot; positive means older. */
|
|
47
|
+
export declare function movePromptHistorySearchSelection(search: PromptHistorySearch, delta: number): PromptHistorySearch;
|
|
48
|
+
/** Selected match as an editor value, or nothing while loading/empty/no-match. */
|
|
49
|
+
export declare function acceptPromptHistorySearch(search: PromptHistorySearch): EditorValue | undefined;
|
|
50
|
+
/** Exact pre-search draft and cursor. */
|
|
51
|
+
export declare function cancelPromptHistorySearch(search: PromptHistorySearch): EditorValue;
|
|
52
|
+
/** Bounded, one-row-safe strings for the counted prompt projection. */
|
|
53
|
+
export declare function promptHistorySearchView(search: PromptHistorySearch): PromptHistorySearchView;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reverse-search state over the bounded project prompt history.
|
|
3
|
+
*
|
|
4
|
+
* Disk access stays in `trajectory/prompt-history.ts`; this module only snapshots
|
|
5
|
+
* that reader's already bounded entries and transforms local keystrokes. The opening
|
|
6
|
+
* editor value is retained byte-for-byte so Escape can restore text, offset and
|
|
7
|
+
* affinity even when terminal input and React renders are batched.
|
|
8
|
+
*/
|
|
9
|
+
import { promptHistoryNote } from '../trajectory/prompt-history.js';
|
|
10
|
+
/** A query can never grow without bound, including when a terminal pastes one event. */
|
|
11
|
+
export const MAX_PROMPT_SEARCH_QUERY_CODE_POINTS = 256;
|
|
12
|
+
/** A fixed presentation cap; shorter terminals may grant fewer through the frame budget. */
|
|
13
|
+
export const MAX_PROMPT_SEARCH_MATCHES = 5;
|
|
14
|
+
/** Opens without waiting for disk; `history` is absent while that bounded read lands. */
|
|
15
|
+
export function openPromptHistorySearch(original, requestId, history) {
|
|
16
|
+
const base = {
|
|
17
|
+
original: cloneEditor(original),
|
|
18
|
+
requestId,
|
|
19
|
+
query: '',
|
|
20
|
+
selected: 0,
|
|
21
|
+
};
|
|
22
|
+
if (history === undefined) {
|
|
23
|
+
return { ...base, entries: [], matches: [], pending: true, note: undefined };
|
|
24
|
+
}
|
|
25
|
+
return fromHistory(base, history);
|
|
26
|
+
}
|
|
27
|
+
/** Applies only the read requested by this search instance. */
|
|
28
|
+
export function resolvePromptHistorySearch(search, requestId, history) {
|
|
29
|
+
if (!search.pending || search.requestId !== requestId)
|
|
30
|
+
return search;
|
|
31
|
+
return fromHistory(search, history);
|
|
32
|
+
}
|
|
33
|
+
/** Appends printable query text with a Unicode code-point bound. */
|
|
34
|
+
export function appendPromptHistorySearchQuery(search, inserted) {
|
|
35
|
+
const room = MAX_PROMPT_SEARCH_QUERY_CODE_POINTS - [...search.query].length;
|
|
36
|
+
if (room <= 0 || inserted === '')
|
|
37
|
+
return search;
|
|
38
|
+
return withQuery(search, search.query + [...inserted].slice(0, room).join(''));
|
|
39
|
+
}
|
|
40
|
+
/** Removes one Unicode code point, never half of a surrogate pair. */
|
|
41
|
+
export function backspacePromptHistorySearchQuery(search) {
|
|
42
|
+
const points = [...search.query];
|
|
43
|
+
if (points.length === 0)
|
|
44
|
+
return search;
|
|
45
|
+
points.pop();
|
|
46
|
+
return withQuery(search, points.join(''));
|
|
47
|
+
}
|
|
48
|
+
export function clearPromptHistorySearchQuery(search) {
|
|
49
|
+
return search.query === '' ? search : withQuery(search, '');
|
|
50
|
+
}
|
|
51
|
+
/** Navigation wraps through the bounded reader snapshot; positive means older. */
|
|
52
|
+
export function movePromptHistorySearchSelection(search, delta) {
|
|
53
|
+
if (search.matches.length === 0)
|
|
54
|
+
return search;
|
|
55
|
+
const selected = normalizeSelection(search.selected + delta, search.matches.length);
|
|
56
|
+
return selected === search.selected ? search : { ...search, selected };
|
|
57
|
+
}
|
|
58
|
+
/** Selected match as an editor value, or nothing while loading/empty/no-match. */
|
|
59
|
+
export function acceptPromptHistorySearch(search) {
|
|
60
|
+
const text = search.matches[search.selected];
|
|
61
|
+
return text === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: { text, cursor: { offset: text.length, affinity: 'upstream' } };
|
|
64
|
+
}
|
|
65
|
+
/** Exact pre-search draft and cursor. */
|
|
66
|
+
export function cancelPromptHistorySearch(search) {
|
|
67
|
+
return cloneEditor(search.original);
|
|
68
|
+
}
|
|
69
|
+
/** Bounded, one-row-safe strings for the counted prompt projection. */
|
|
70
|
+
export function promptHistorySearchView(search) {
|
|
71
|
+
const query = search.query === '' ? '(all)' : search.query;
|
|
72
|
+
let state;
|
|
73
|
+
if (search.pending)
|
|
74
|
+
state = 'reading this project’s record…';
|
|
75
|
+
else if (search.matches.length === 0)
|
|
76
|
+
state = search.entries.length === 0 ? 'no earlier prompts' : 'no matches';
|
|
77
|
+
else
|
|
78
|
+
state = `${search.selected + 1}/${search.matches.length} · Ctrl+R/↑ older ↓ newer · Enter/Tab accept · Esc cancel`;
|
|
79
|
+
const note = search.note === undefined ? '' : ` — ${search.note}`;
|
|
80
|
+
const capacity = Math.min(search.matches.length, MAX_PROMPT_SEARCH_MATCHES);
|
|
81
|
+
const start = Math.max(0, Math.min(search.selected - Math.floor(capacity / 2), search.matches.length - capacity));
|
|
82
|
+
const end = start + capacity;
|
|
83
|
+
return {
|
|
84
|
+
title: `reverse search: ${query} · ${state}${note}`,
|
|
85
|
+
matches: search.matches.slice(start, end),
|
|
86
|
+
selected: search.selected - start,
|
|
87
|
+
hiddenAbove: start,
|
|
88
|
+
hiddenBelow: search.matches.length - end,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function fromHistory(base, history) {
|
|
92
|
+
const entries = [...history.entries];
|
|
93
|
+
const query = base.query;
|
|
94
|
+
const matches = filterEntries(entries, query);
|
|
95
|
+
return {
|
|
96
|
+
...base,
|
|
97
|
+
entries,
|
|
98
|
+
query,
|
|
99
|
+
matches,
|
|
100
|
+
selected: normalizeSelection(base.selected, matches.length),
|
|
101
|
+
pending: false,
|
|
102
|
+
note: promptHistoryNote(history),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function withQuery(search, query) {
|
|
106
|
+
const matches = filterEntries(search.entries, query);
|
|
107
|
+
return { ...search, query, matches, selected: 0 };
|
|
108
|
+
}
|
|
109
|
+
function filterEntries(entries, query) {
|
|
110
|
+
if (query === '')
|
|
111
|
+
return [...entries];
|
|
112
|
+
const folded = query.toLocaleLowerCase();
|
|
113
|
+
return entries.filter((entry) => entry.toLocaleLowerCase().includes(folded));
|
|
114
|
+
}
|
|
115
|
+
function normalizeSelection(selected, total) {
|
|
116
|
+
if (total <= 0)
|
|
117
|
+
return 0;
|
|
118
|
+
return (selected % total + total) % total;
|
|
119
|
+
}
|
|
120
|
+
function cloneEditor(value) {
|
|
121
|
+
return { text: value.text, cursor: { ...value.cursor } };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=prompt-history-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-history-search.js","sourceRoot":"","sources":["../../../src/tui/prompt-history-search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iBAAiB,EAAsB,MAAM,iCAAiC,CAAC;AAGxF,wFAAwF;AACxF,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AACvD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AA0B3C,yFAAyF;AACzF,MAAM,UAAU,uBAAuB,CACrC,QAAqB,EACrB,SAAiB,EACjB,OAAkC;IAElC,MAAM,IAAI,GAAG;QACX,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC;QAC/B,SAAS;QACT,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,CAAC;KACH,CAAC;IACX,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC/E,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,0BAA0B,CACxC,MAA2B,EAC3B,SAAiB,EACjB,OAAsB;IAEtB,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACrE,OAAO,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,8BAA8B,CAC5C,MAA2B,EAC3B,QAAgB;IAEhB,MAAM,IAAI,GAAG,mCAAmC,GAAG,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AAE,CAAC;AACpD,CAAC;AAED,SAAS,aAAa,CAAC,OAA0B,EAAE,KAAa;IAC9D,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC;IACzC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAgB,EAAE,KAAa;IACzD,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAC5C,CAAC;AAED,SAAS,WAAW,CAAC,KAAkB;IACrC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt queue: what a submission during a busy session becomes (SER-027).
|
|
3
|
+
*
|
|
4
|
+
* This deliberately supersedes SER-010's "retained, never queued" busy-submit
|
|
5
|
+
* contract, by explicit user product decision (2026-08-19). A prompt or `!`
|
|
6
|
+
* command submitted while a turn streams or a `!` command runs leaves the editor
|
|
7
|
+
* and joins this FIFO queue; when the session returns to idle the queue drains
|
|
8
|
+
* one entry at a time through the ordinary submit path, so every entry keeps its
|
|
9
|
+
* own meaning (its own turn, its own `!` run, its own trajectory `userInput` line
|
|
10
|
+
* written exactly at send time). Nothing here is I/O and nothing here decides
|
|
11
|
+
* *when* to send — the App owns the state machine; this module owns the pure
|
|
12
|
+
* projections it shares with the frame budget and the tests:
|
|
13
|
+
*
|
|
14
|
+
* - the one-row projection of an entry (`queueRowText`),
|
|
15
|
+
* - the draft a take-back composes (`takeBackDraft`),
|
|
16
|
+
* - the hint segment that states the count (`queuedCountHint`) — nothing
|
|
17
|
+
* invisible may accumulate.
|
|
18
|
+
*
|
|
19
|
+
* The queue is live-session state only: `/clear` drops it with the conversation,
|
|
20
|
+
* a cancelled or failed turn returns it to the editor unsent, and nothing about
|
|
21
|
+
* an entry is recorded until the moment it is actually sent.
|
|
22
|
+
*/
|
|
23
|
+
import type { ImageBlock } from '@strands-agents/sdk';
|
|
24
|
+
/** One live-only queued submission; image bytes never enter any durable record. */
|
|
25
|
+
export interface QueuedPrompt {
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly image?: ImageBlock;
|
|
28
|
+
}
|
|
29
|
+
/** One clipboard image may be pending or queued at a time, bounding live memory. */
|
|
30
|
+
export declare function hasQueuedImage(entries: readonly QueuedPrompt[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Marker every queued row carries. Like `tool ·`, it survives ANSI stripping,
|
|
33
|
+
* monochrome terminals and pty captures, so tests and logs can name the row.
|
|
34
|
+
*/
|
|
35
|
+
export declare const QUEUED_MARKER = "queued \u00B7";
|
|
36
|
+
/** True when a busy submission must be refused (draft retained) rather than queued. */
|
|
37
|
+
export declare function refusesToQueue(text: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* One queued entry as one counted terminal row: marker, then the entry with its
|
|
40
|
+
* newlines shown as `⏎` so a multi-line entry stays one row — the row is drawn
|
|
41
|
+
* as a single `<Text wrap="truncate-end">`, so width overflow truncates and can
|
|
42
|
+
* never grow a row the budget did not count.
|
|
43
|
+
*/
|
|
44
|
+
export declare function queueRowText(value: QueuedPrompt | string): string;
|
|
45
|
+
/**
|
|
46
|
+
* The draft a take-back (or a cancel-return) composes: queued entries one per
|
|
47
|
+
* line, oldest first, **ahead of any typed text** — the Claude Code shape. The
|
|
48
|
+
* entries were going to be sent before anything typed later, so they read in
|
|
49
|
+
* that order too.
|
|
50
|
+
*/
|
|
51
|
+
export declare function takeBackDraft(entries: readonly (QueuedPrompt | string)[], draft: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* The busy hint's queue segment, or an empty string while nothing is queued.
|
|
54
|
+
* It rides behind the live elapsed/spend readout and ahead of the static
|
|
55
|
+
* command hints, on the same one truncated `<Text>` row — the count is how the
|
|
56
|
+
* queue stays visible even when the listing's rows were all cut.
|
|
57
|
+
*/
|
|
58
|
+
export declare function queuedCountHint(count: number): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt queue: what a submission during a busy session becomes (SER-027).
|
|
3
|
+
*
|
|
4
|
+
* This deliberately supersedes SER-010's "retained, never queued" busy-submit
|
|
5
|
+
* contract, by explicit user product decision (2026-08-19). A prompt or `!`
|
|
6
|
+
* command submitted while a turn streams or a `!` command runs leaves the editor
|
|
7
|
+
* and joins this FIFO queue; when the session returns to idle the queue drains
|
|
8
|
+
* one entry at a time through the ordinary submit path, so every entry keeps its
|
|
9
|
+
* own meaning (its own turn, its own `!` run, its own trajectory `userInput` line
|
|
10
|
+
* written exactly at send time). Nothing here is I/O and nothing here decides
|
|
11
|
+
* *when* to send — the App owns the state machine; this module owns the pure
|
|
12
|
+
* projections it shares with the frame budget and the tests:
|
|
13
|
+
*
|
|
14
|
+
* - the one-row projection of an entry (`queueRowText`),
|
|
15
|
+
* - the draft a take-back composes (`takeBackDraft`),
|
|
16
|
+
* - the hint segment that states the count (`queuedCountHint`) — nothing
|
|
17
|
+
* invisible may accumulate.
|
|
18
|
+
*
|
|
19
|
+
* The queue is live-session state only: `/clear` drops it with the conversation,
|
|
20
|
+
* a cancelled or failed turn returns it to the editor unsent, and nothing about
|
|
21
|
+
* an entry is recorded until the moment it is actually sent.
|
|
22
|
+
*/
|
|
23
|
+
/** One clipboard image may be pending or queued at a time, bounding live memory. */
|
|
24
|
+
export function hasQueuedImage(entries) {
|
|
25
|
+
return entries.some((entry) => entry.image !== undefined);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Marker every queued row carries. Like `tool ·`, it survives ANSI stripping,
|
|
29
|
+
* monochrome terminals and pty captures, so tests and logs can name the row.
|
|
30
|
+
*/
|
|
31
|
+
export const QUEUED_MARKER = 'queued ·';
|
|
32
|
+
/**
|
|
33
|
+
* Commands that refuse to queue and keep the SER-010 refusal shape instead:
|
|
34
|
+
* each replaces the session or the process, and running one minutes later,
|
|
35
|
+
* unprompted, is worse than asking for a second Enter. Matched against the
|
|
36
|
+
* trimmed submission's first word.
|
|
37
|
+
*/
|
|
38
|
+
const BUSY_REFUSED_COMMANDS = new Set(['/clear', '/compact', '/model', '/rewind', '/exit', '/quit']);
|
|
39
|
+
/** True when a busy submission must be refused (draft retained) rather than queued. */
|
|
40
|
+
export function refusesToQueue(text) {
|
|
41
|
+
const firstWord = text.split(/\s/, 1)[0] ?? '';
|
|
42
|
+
return BUSY_REFUSED_COMMANDS.has(firstWord);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One queued entry as one counted terminal row: marker, then the entry with its
|
|
46
|
+
* newlines shown as `⏎` so a multi-line entry stays one row — the row is drawn
|
|
47
|
+
* as a single `<Text wrap="truncate-end">`, so width overflow truncates and can
|
|
48
|
+
* never grow a row the budget did not count.
|
|
49
|
+
*/
|
|
50
|
+
export function queueRowText(value) {
|
|
51
|
+
const entry = typeof value === 'string' ? { text: value } : value;
|
|
52
|
+
const attachment = entry.image === undefined ? '' : '[image] ';
|
|
53
|
+
return `${QUEUED_MARKER} ${attachment}${entry.text.replace(/\n/g, ' ⏎ ')}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The draft a take-back (or a cancel-return) composes: queued entries one per
|
|
57
|
+
* line, oldest first, **ahead of any typed text** — the Claude Code shape. The
|
|
58
|
+
* entries were going to be sent before anything typed later, so they read in
|
|
59
|
+
* that order too.
|
|
60
|
+
*/
|
|
61
|
+
export function takeBackDraft(entries, draft) {
|
|
62
|
+
const queued = entries.map((entry) => typeof entry === 'string' ? entry : entry.text).join('\n');
|
|
63
|
+
return draft === '' ? queued : `${queued}\n${draft}`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The busy hint's queue segment, or an empty string while nothing is queued.
|
|
67
|
+
* It rides behind the live elapsed/spend readout and ahead of the static
|
|
68
|
+
* command hints, on the same one truncated `<Text>` row — the count is how the
|
|
69
|
+
* queue stays visible even when the listing's rows were all cut.
|
|
70
|
+
*/
|
|
71
|
+
export function queuedCountHint(count) {
|
|
72
|
+
return count > 0 ? ` · ${count} queued` : '';
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=prompt-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-queue.js","sourceRoot":"","sources":["../../../src/tui/prompt-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,OAAgC;IAC7D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;AAC5D,CAAC;AAGD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AAExC;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAErG,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAA4B;IACvD,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/D,OAAO,GAAG,aAAa,IAAI,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2C,EAAE,KAAa;IACtF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjG,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,KAAK,EAAE,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt recall: which key steps where, and what the editor says while it does.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is pure and synchronous — a walk over a list of strings the
|
|
5
|
+
* trajectory reader already produced (`src/trajectory/prompt-history.ts`). The split
|
|
6
|
+
* is the same one `path-completion.ts` uses: the I/O is async, bounded and cached by
|
|
7
|
+
* the caller, and the part a keystroke actually runs is this.
|
|
8
|
+
*
|
|
9
|
+
* The binding is the risky part of this feature, so it is stated once, here, and
|
|
10
|
+
* enforced by the caller in exactly this order:
|
|
11
|
+
*
|
|
12
|
+
* 1. A **completion menu wins**. `App.tsx` handles `Up`/`Down` as menu selection
|
|
13
|
+
* whenever `completions.length > 0`, before recall is consulted at all — so recall
|
|
14
|
+
* is unreachable with a `/` or `@` menu open, by construction rather than by a
|
|
15
|
+
* predicate that could drift.
|
|
16
|
+
* 2. **`Up` recalls only when the draft is empty**, or when a walk is already active
|
|
17
|
+
* and the cursor sits on the first visual row. A non-empty draft that is not a walk
|
|
18
|
+
* falls through to `moveVertical` exactly as before, which is what makes recall
|
|
19
|
+
* incapable of replacing typed text — no stash, and nothing to lose.
|
|
20
|
+
* 3. **`Down` applies only inside a walk**, and only from the last visual row. Past the
|
|
21
|
+
* newest entry it empties the draft and ends the walk, which is where the walk
|
|
22
|
+
* started; outside a walk `Down` is untouched.
|
|
23
|
+
* 4. Cursor movement does not end a walk — `Up` through a recalled multi-row prompt
|
|
24
|
+
* reaches its top row and only then steps further back — but every **edit** does.
|
|
25
|
+
*/
|
|
26
|
+
import { type PromptHistory } from '../trajectory/prompt-history.js';
|
|
27
|
+
/** A recall walk in progress. Absent from `App` state means "not recalling". */
|
|
28
|
+
export interface PromptRecall {
|
|
29
|
+
/**
|
|
30
|
+
* The entries this walk started from.
|
|
31
|
+
*
|
|
32
|
+
* Snapshotted deliberately: a re-read landing mid-walk must not renumber what `Up`
|
|
33
|
+
* is stepping through under the user's hands.
|
|
34
|
+
*/
|
|
35
|
+
readonly entries: readonly string[];
|
|
36
|
+
/** Index into {@link entries}; `-1` only while nothing can be applied (see {@link pending}). */
|
|
37
|
+
readonly index: number;
|
|
38
|
+
/** True while the history read this walk asked for has not landed yet. */
|
|
39
|
+
readonly pending: boolean;
|
|
40
|
+
/** What the reading is not showing, stated on the indicator row. */
|
|
41
|
+
readonly note: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
export type RecallDirection = 'older' | 'newer';
|
|
44
|
+
/** The result of opening or stepping a walk. */
|
|
45
|
+
export interface RecallStep {
|
|
46
|
+
/** The walk afterwards; `undefined` ends it. */
|
|
47
|
+
readonly recall: PromptRecall | undefined;
|
|
48
|
+
/** Draft text to apply, or `undefined` to leave the draft exactly as it is. */
|
|
49
|
+
readonly text: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Opens a walk on the newest entry.
|
|
53
|
+
*
|
|
54
|
+
* `history` is `undefined` while the read has not landed. That case opens a *pending*
|
|
55
|
+
* walk rather than claiming there is no history: saying "no earlier prompts" about a
|
|
56
|
+
* file that has not been read yet would be a lie in the one row the user is looking at.
|
|
57
|
+
*/
|
|
58
|
+
export declare function openPromptRecall(history: PromptHistory | undefined): RecallStep;
|
|
59
|
+
/**
|
|
60
|
+
* Steps a walk one entry older or newer.
|
|
61
|
+
*
|
|
62
|
+
* Never wraps. At the oldest entry `Up` holds still — the indicator already says
|
|
63
|
+
* `(oldest)`, and wrapping to the newest is how a walk loses the user's place.
|
|
64
|
+
*/
|
|
65
|
+
export declare function stepPromptRecall(recall: PromptRecall, direction: RecallDirection): RecallStep;
|
|
66
|
+
/**
|
|
67
|
+
* The single row a walk draws under the draft.
|
|
68
|
+
*
|
|
69
|
+
* One string, one row, counted by {@link RECALL_INDICATOR_ROWS} and rendered as one
|
|
70
|
+
* `<Text wrap="truncate-end">` — the live-frame rule for any row whose height has to
|
|
71
|
+
* be known. A bounded or degraded reading is a *suffix* of this row, never a row of
|
|
72
|
+
* its own, exactly like the completion menu's scan note.
|
|
73
|
+
*/
|
|
74
|
+
export declare function promptRecallIndicator(recall: PromptRecall): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt recall: which key steps where, and what the editor says while it does.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is pure and synchronous — a walk over a list of strings the
|
|
5
|
+
* trajectory reader already produced (`src/trajectory/prompt-history.ts`). The split
|
|
6
|
+
* is the same one `path-completion.ts` uses: the I/O is async, bounded and cached by
|
|
7
|
+
* the caller, and the part a keystroke actually runs is this.
|
|
8
|
+
*
|
|
9
|
+
* The binding is the risky part of this feature, so it is stated once, here, and
|
|
10
|
+
* enforced by the caller in exactly this order:
|
|
11
|
+
*
|
|
12
|
+
* 1. A **completion menu wins**. `App.tsx` handles `Up`/`Down` as menu selection
|
|
13
|
+
* whenever `completions.length > 0`, before recall is consulted at all — so recall
|
|
14
|
+
* is unreachable with a `/` or `@` menu open, by construction rather than by a
|
|
15
|
+
* predicate that could drift.
|
|
16
|
+
* 2. **`Up` recalls only when the draft is empty**, or when a walk is already active
|
|
17
|
+
* and the cursor sits on the first visual row. A non-empty draft that is not a walk
|
|
18
|
+
* falls through to `moveVertical` exactly as before, which is what makes recall
|
|
19
|
+
* incapable of replacing typed text — no stash, and nothing to lose.
|
|
20
|
+
* 3. **`Down` applies only inside a walk**, and only from the last visual row. Past the
|
|
21
|
+
* newest entry it empties the draft and ends the walk, which is where the walk
|
|
22
|
+
* started; outside a walk `Down` is untouched.
|
|
23
|
+
* 4. Cursor movement does not end a walk — `Up` through a recalled multi-row prompt
|
|
24
|
+
* reaches its top row and only then steps further back — but every **edit** does.
|
|
25
|
+
*/
|
|
26
|
+
import { promptHistoryNote } from '../trajectory/prompt-history.js';
|
|
27
|
+
/**
|
|
28
|
+
* Opens a walk on the newest entry.
|
|
29
|
+
*
|
|
30
|
+
* `history` is `undefined` while the read has not landed. That case opens a *pending*
|
|
31
|
+
* walk rather than claiming there is no history: saying "no earlier prompts" about a
|
|
32
|
+
* file that has not been read yet would be a lie in the one row the user is looking at.
|
|
33
|
+
*/
|
|
34
|
+
export function openPromptRecall(history) {
|
|
35
|
+
if (history === undefined) {
|
|
36
|
+
return { recall: { entries: [], index: -1, pending: true, note: undefined }, text: undefined };
|
|
37
|
+
}
|
|
38
|
+
const note = promptHistoryNote(history);
|
|
39
|
+
const empty = { entries: history.entries, index: -1, pending: false, note };
|
|
40
|
+
return history.entries.length === 0 ? { recall: empty, text: undefined } : step(empty, 'older');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Steps a walk one entry older or newer.
|
|
44
|
+
*
|
|
45
|
+
* Never wraps. At the oldest entry `Up` holds still — the indicator already says
|
|
46
|
+
* `(oldest)`, and wrapping to the newest is how a walk loses the user's place.
|
|
47
|
+
*/
|
|
48
|
+
export function stepPromptRecall(recall, direction) {
|
|
49
|
+
return step(recall, direction);
|
|
50
|
+
}
|
|
51
|
+
function step(recall, direction) {
|
|
52
|
+
// Nothing to step through: a pending read, or a project with no prompts. `Up` holds
|
|
53
|
+
// the indicator (the user may press it again once the read lands); `Down` dismisses it.
|
|
54
|
+
if (recall.entries.length === 0) {
|
|
55
|
+
return direction === 'older' ? { recall, text: undefined } : { recall: undefined, text: undefined };
|
|
56
|
+
}
|
|
57
|
+
if (direction === 'older') {
|
|
58
|
+
const next = Math.min(recall.index + 1, recall.entries.length - 1);
|
|
59
|
+
if (next === recall.index)
|
|
60
|
+
return { recall, text: undefined };
|
|
61
|
+
return { recall: { ...recall, index: next }, text: recall.entries[next] };
|
|
62
|
+
}
|
|
63
|
+
// Newer than the newest is where the walk began: an empty draft, and no walk. The
|
|
64
|
+
// eligibility rule means that is exactly the draft `Up` replaced.
|
|
65
|
+
if (recall.index <= 0)
|
|
66
|
+
return { recall: undefined, text: '' };
|
|
67
|
+
const next = recall.index - 1;
|
|
68
|
+
return { recall: { ...recall, index: next }, text: recall.entries[next] };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The single row a walk draws under the draft.
|
|
72
|
+
*
|
|
73
|
+
* One string, one row, counted by {@link RECALL_INDICATOR_ROWS} and rendered as one
|
|
74
|
+
* `<Text wrap="truncate-end">` — the live-frame rule for any row whose height has to
|
|
75
|
+
* be known. A bounded or degraded reading is a *suffix* of this row, never a row of
|
|
76
|
+
* its own, exactly like the completion menu's scan note.
|
|
77
|
+
*/
|
|
78
|
+
export function promptRecallIndicator(recall) {
|
|
79
|
+
if (recall.pending)
|
|
80
|
+
return 'history: reading this project\u2019s record…';
|
|
81
|
+
if (recall.entries.length === 0) {
|
|
82
|
+
const note = recall.note === undefined ? '' : ` — ${recall.note}`;
|
|
83
|
+
return `history: no earlier prompts in this project${note}`;
|
|
84
|
+
}
|
|
85
|
+
const position = `history ${Math.max(recall.index, 0) + 1}/${recall.entries.length}`;
|
|
86
|
+
const oldest = recall.index === recall.entries.length - 1 ? ' (oldest)' : '';
|
|
87
|
+
const note = recall.note === undefined ? '' : ` — ${recall.note}`;
|
|
88
|
+
return `${position}${oldest} · ↑ older ↓ newer${note}`;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=prompt-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-recall.js","sourceRoot":"","sources":["../../../src/tui/prompt-recall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,iBAAiB,EAAsB,MAAM,iCAAiC,CAAC;AA6BxF;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAkC;IACjE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACjG,CAAC;IACD,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,KAAK,GAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC1F,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CA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AE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAW,EAAE,CAAC;AACtF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,8CAA8C,CAAC;IAC1E,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,8CAA8C,IAAI,EAAE,CAAC;IAC9D,CAAC;IACD,MAAM,QAAQ,GAAG,WAAW,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IACrF,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IAClE,OAAO,GAAG,QAAQ,GAAG,MAAM,qBAAqB,IAAI,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads the interactive React/Ink graph through React's production condition,
|
|
3
|
+
* regardless of the caller's ambient mode.
|
|
4
|
+
*
|
|
5
|
+
* React 19's development reconciler writes `performance.measure()` entries for
|
|
6
|
+
* every component on every commit. Node retains those timeline entries until
|
|
7
|
+
* somebody clears them; Darwin's 90 ms busy tick can therefore exhaust the heap
|
|
8
|
+
* during a provider-silent turn. The mode must be selected before the first React
|
|
9
|
+
* import, but it need not leak into later runtime/MCP subprocess construction.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withProductionReactImports<T>(load: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads the interactive React/Ink graph through React's production condition,
|
|
3
|
+
* regardless of the caller's ambient mode.
|
|
4
|
+
*
|
|
5
|
+
* React 19's development reconciler writes `performance.measure()` entries for
|
|
6
|
+
* every component on every commit. Node retains those timeline entries until
|
|
7
|
+
* somebody clears them; Darwin's 90 ms busy tick can therefore exhaust the heap
|
|
8
|
+
* during a provider-silent turn. The mode must be selected before the first React
|
|
9
|
+
* import, but it need not leak into later runtime/MCP subprocess construction.
|
|
10
|
+
*/
|
|
11
|
+
export async function withProductionReactImports(load) {
|
|
12
|
+
const previous = process.env.NODE_ENV;
|
|
13
|
+
process.env.NODE_ENV = 'production';
|
|
14
|
+
try {
|
|
15
|
+
return await load();
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
if (previous === undefined)
|
|
19
|
+
delete process.env.NODE_ENV;
|
|
20
|
+
else
|
|
21
|
+
process.env.NODE_ENV = previous;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=react-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-environment.js","sourceRoot":"","sources":["../../../src/tui/react-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAI,IAAsB;IACxE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;;YACnD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Pure bounded chooser state for conversation-only `/rewind`. */
|
|
2
|
+
import type { RewindCheckpoint } from '../agent/rewind.js';
|
|
3
|
+
import type { EditorValue } from './prompt-editor.js';
|
|
4
|
+
export declare const MAX_REWIND_SEARCH_MATCHES = 5;
|
|
5
|
+
export declare const MAX_REWIND_SEARCH_QUERY_CODE_POINTS = 256;
|
|
6
|
+
/**
|
|
7
|
+
* Esc Esc (SER-059): how long after a first no-op Escape on an empty idle
|
|
8
|
+
* composer a second Escape still opens the `/rewind` chooser. A timestamp
|
|
9
|
+
* comparison in the key handler, never a timer.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ESCAPE_REWIND_CHORD_MS = 500;
|
|
12
|
+
export interface RewindSearch {
|
|
13
|
+
readonly original: EditorValue;
|
|
14
|
+
readonly sourceSessionId: string;
|
|
15
|
+
readonly checkpoints: readonly RewindCheckpoint[];
|
|
16
|
+
readonly query: string;
|
|
17
|
+
readonly matches: readonly RewindCheckpoint[];
|
|
18
|
+
readonly selected: number;
|
|
19
|
+
}
|
|
20
|
+
export interface RewindSearchView {
|
|
21
|
+
readonly title: string;
|
|
22
|
+
readonly matches: readonly string[];
|
|
23
|
+
readonly selected: number;
|
|
24
|
+
readonly hiddenAbove: number;
|
|
25
|
+
readonly hiddenBelow: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function openRewindSearch(original: EditorValue, sourceSessionId: string, checkpoints: readonly RewindCheckpoint[]): RewindSearch;
|
|
28
|
+
export declare function appendRewindSearchQuery(search: RewindSearch, inserted: string): RewindSearch;
|
|
29
|
+
export declare function backspaceRewindSearchQuery(search: RewindSearch): RewindSearch;
|
|
30
|
+
export declare function clearRewindSearchQuery(search: RewindSearch): RewindSearch;
|
|
31
|
+
export declare function moveRewindSearchSelection(search: RewindSearch, delta: number): RewindSearch;
|
|
32
|
+
export declare function acceptRewindSearch(search: RewindSearch): RewindCheckpoint | undefined;
|
|
33
|
+
export declare function cancelRewindSearch(search: RewindSearch): EditorValue;
|
|
34
|
+
export declare function rewindSearchView(search: RewindSearch): RewindSearchView;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const MAX_REWIND_SEARCH_MATCHES = 5;
|
|
2
|
+
export const MAX_REWIND_SEARCH_QUERY_CODE_POINTS = 256;
|
|
3
|
+
/**
|
|
4
|
+
* Esc Esc (SER-059): how long after a first no-op Escape on an empty idle
|
|
5
|
+
* composer a second Escape still opens the `/rewind` chooser. A timestamp
|
|
6
|
+
* comparison in the key handler, never a timer.
|
|
7
|
+
*/
|
|
8
|
+
export const ESCAPE_REWIND_CHORD_MS = 500;
|
|
9
|
+
export function openRewindSearch(original, sourceSessionId, checkpoints) {
|
|
10
|
+
return {
|
|
11
|
+
original: { ...original, cursor: { ...original.cursor } },
|
|
12
|
+
sourceSessionId,
|
|
13
|
+
checkpoints: [...checkpoints],
|
|
14
|
+
query: '',
|
|
15
|
+
matches: [...checkpoints],
|
|
16
|
+
selected: 0,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function appendRewindSearchQuery(search, inserted) {
|
|
20
|
+
const room = MAX_REWIND_SEARCH_QUERY_CODE_POINTS - [...search.query].length;
|
|
21
|
+
if (room <= 0 || inserted === '')
|
|
22
|
+
return search;
|
|
23
|
+
return withQuery(search, search.query + [...inserted].slice(0, room).join(''));
|
|
24
|
+
}
|
|
25
|
+
export function backspaceRewindSearchQuery(search) {
|
|
26
|
+
const points = [...search.query];
|
|
27
|
+
if (points.length === 0)
|
|
28
|
+
return search;
|
|
29
|
+
points.pop();
|
|
30
|
+
return withQuery(search, points.join(''));
|
|
31
|
+
}
|
|
32
|
+
export function clearRewindSearchQuery(search) {
|
|
33
|
+
return search.query === '' ? search : withQuery(search, '');
|
|
34
|
+
}
|
|
35
|
+
export function moveRewindSearchSelection(search, delta) {
|
|
36
|
+
if (search.matches.length === 0)
|
|
37
|
+
return search;
|
|
38
|
+
const selected = ((search.selected + delta) % search.matches.length + search.matches.length) % search.matches.length;
|
|
39
|
+
return selected === search.selected ? search : { ...search, selected };
|
|
40
|
+
}
|
|
41
|
+
export function acceptRewindSearch(search) {
|
|
42
|
+
return search.matches[search.selected];
|
|
43
|
+
}
|
|
44
|
+
export function cancelRewindSearch(search) {
|
|
45
|
+
return { ...search.original, cursor: { ...search.original.cursor } };
|
|
46
|
+
}
|
|
47
|
+
export function rewindSearchView(search) {
|
|
48
|
+
const capacity = Math.min(search.matches.length, MAX_REWIND_SEARCH_MATCHES);
|
|
49
|
+
const start = capacity === 0
|
|
50
|
+
? 0
|
|
51
|
+
: Math.min(Math.max(0, search.selected - capacity + 1), search.matches.length - capacity);
|
|
52
|
+
const end = start + capacity;
|
|
53
|
+
return {
|
|
54
|
+
title: search.matches.length === 0
|
|
55
|
+
? `rewind prompts — no match for ${JSON.stringify(search.query)}`
|
|
56
|
+
: `rewind prompts (${search.selected + 1}/${search.matches.length}) — type to filter · ↑/↓ · enter branch · esc cancel`,
|
|
57
|
+
matches: search.matches.slice(start, end).map((checkpoint) => checkpoint.prompt.replace(/\n/g, ' ⏎ ')),
|
|
58
|
+
selected: Math.max(0, search.selected - start),
|
|
59
|
+
hiddenAbove: start,
|
|
60
|
+
hiddenBelow: search.matches.length - end,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function withQuery(search, query) {
|
|
64
|
+
const folded = query.toLocaleLowerCase();
|
|
65
|
+
const matches = search.checkpoints.filter((checkpoint) => checkpoint.prompt.toLocaleLowerCase().includes(folded));
|
|
66
|
+
return { ...search, query, matches, selected: 0 };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=rewind-search.js.map
|