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,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the redrawn part of the frame is divided between everything that wants rows.
|
|
3
|
+
*
|
|
4
|
+
* Round 1 bounded the streaming answer against a *measured* chrome height: the
|
|
5
|
+
* header and the box below it were measured with `useBoxMetrics`, and whatever was
|
|
6
|
+
* left over went to the answer. That works only while the chrome itself is
|
|
7
|
+
* bounded, and it is not — measured with `spike/probe-live-frame-overflow.tsx`
|
|
8
|
+
* (numbers defended in `spike/verify-frame-budget.ts`): a 13-row
|
|
9
|
+
* draft in a 24-row terminal already takes Ink's `clearTerminal` branch (2
|
|
10
|
+
* whole-screen clears, scrollback included, per added row), and one in-flight tool
|
|
11
|
+
* call with details expanded draws 41 rows from caps that count logical lines and
|
|
12
|
+
* code points rather than terminal rows.
|
|
13
|
+
*
|
|
14
|
+
* So the budget is inverted here. Instead of measuring what the furniture took and
|
|
15
|
+
* giving the answer the rest, every participant states what it *wants* and what it
|
|
16
|
+
* cannot usefully go below, and this module hands out the rows. Nothing here
|
|
17
|
+
* depends on a measurement of the boxes being bounded, so the budget cannot
|
|
18
|
+
* oscillate; the one thing still measured is the header, whose height depends on
|
|
19
|
+
* nothing below it.
|
|
20
|
+
*
|
|
21
|
+
* The order is fixed and follows what the user cannot act without: the prompt
|
|
22
|
+
* region (the draft they are typing, or the question they must answer) is served
|
|
23
|
+
* first, the tool panel next, the still-arriving answer last — it is the one
|
|
24
|
+
* participant whose content is already guaranteed to reach `<Static>` history in
|
|
25
|
+
* full. The counter-rule is the share ceiling below, so "served first" cannot mean
|
|
26
|
+
* "takes everything".
|
|
27
|
+
*/
|
|
28
|
+
import { diffLineEmphasis, diffLineTone } from './edit-diff.js';
|
|
29
|
+
import { wrapToRows } from './live-text.js';
|
|
30
|
+
import { SHELL_TOOL_NAME } from './shell-command.js';
|
|
31
|
+
import { expandedToolInput, permissionDetail } from './tool-detail-presentation.js';
|
|
32
|
+
/**
|
|
33
|
+
* The row Ink needs to not treat the frame as fullscreen.
|
|
34
|
+
*
|
|
35
|
+
* `renderInteractiveFrame` calls a frame `isFullscreen` at `outputHeight >= rows`
|
|
36
|
+
* and clears the whole screen when the next one shrinks below that
|
|
37
|
+
* (`isLeavingFullscreen`), so "fits" has to mean strictly shorter than the
|
|
38
|
+
* viewport.
|
|
39
|
+
*/
|
|
40
|
+
export const SPARE_FRAME_ROW = 1;
|
|
41
|
+
/**
|
|
42
|
+
* Divides the rows below the header between prompt, tool panel, parent plan,
|
|
43
|
+
* queued listing and live answer.
|
|
44
|
+
*
|
|
45
|
+
* A grant never exceeds what is left, so darwin never *chooses* to overflow: with
|
|
46
|
+
* a viewport smaller than the furniture the frame still fits and the participants
|
|
47
|
+
* render their degraded form. The only overflow this cannot prevent is a header
|
|
48
|
+
* taller than the terminal, which this module does not own.
|
|
49
|
+
*
|
|
50
|
+
* The parent plan ranks after the tool panel, then the queued listing (SER-027),
|
|
51
|
+
* then the answer. Plan and queue both state omitted content; the user can act on
|
|
52
|
+
* queued work (`Up` takes it back), while the answer already lives in `<Static>`
|
|
53
|
+
* in full and still yields last of all.
|
|
54
|
+
*/
|
|
55
|
+
export function frameBudget(claims) {
|
|
56
|
+
const available = Math.max(0, claims.rows - SPARE_FRAME_ROW - claims.headerRows - claims.thinkingRows);
|
|
57
|
+
const planClaim = claims.plan ?? { wanted: 0, floor: 0 };
|
|
58
|
+
const queuedClaim = claims.queued ?? { wanted: 0, floor: 0 };
|
|
59
|
+
let remaining = available;
|
|
60
|
+
const prompt = grant(claims.prompt, remaining, claims.tools.wanted + planClaim.wanted + queuedClaim.wanted + claims.live.wanted);
|
|
61
|
+
remaining -= prompt;
|
|
62
|
+
const tools = grant(claims.tools, remaining, planClaim.wanted + queuedClaim.wanted + claims.live.wanted);
|
|
63
|
+
remaining -= tools;
|
|
64
|
+
const plan = grant(planClaim, remaining, queuedClaim.wanted + claims.live.wanted);
|
|
65
|
+
remaining -= plan;
|
|
66
|
+
const queued = grant(queuedClaim, remaining, claims.live.wanted);
|
|
67
|
+
remaining -= queued;
|
|
68
|
+
const live = Math.max(0, Math.min(claims.live.wanted, remaining));
|
|
69
|
+
return {
|
|
70
|
+
prompt,
|
|
71
|
+
tools,
|
|
72
|
+
plan,
|
|
73
|
+
queued,
|
|
74
|
+
live,
|
|
75
|
+
degraded: prompt < Math.min(claims.prompt.floor, claims.prompt.wanted) ||
|
|
76
|
+
tools < Math.min(claims.tools.floor, claims.tools.wanted) ||
|
|
77
|
+
plan < Math.min(planClaim.floor, planClaim.wanted) ||
|
|
78
|
+
queued < Math.min(queuedClaim.floor, queuedClaim.wanted) ||
|
|
79
|
+
live < Math.min(claims.live.floor, claims.live.wanted),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* One participant's share.
|
|
84
|
+
*
|
|
85
|
+
* While something of lower priority still wants rows, no one may claim more than
|
|
86
|
+
* half of what is left — otherwise a pasted 200-row draft would be served first
|
|
87
|
+
* and correctly leave the streaming answer nothing at all. With nothing lower
|
|
88
|
+
* waiting, the ceiling is the whole remainder, so a tall draft *does* fill an idle
|
|
89
|
+
* screen.
|
|
90
|
+
*/
|
|
91
|
+
function grant(claim, remaining, lowerWants) {
|
|
92
|
+
if (remaining <= 0 || claim.wanted <= 0)
|
|
93
|
+
return 0;
|
|
94
|
+
const shares = lowerWants > 0 && claim.modal !== true;
|
|
95
|
+
const ceiling = shares ? Math.max(claim.floor, Math.ceil(remaining / 2)) : remaining;
|
|
96
|
+
return Math.max(0, Math.min(claim.wanted, remaining, Math.max(claim.floor, Math.min(ceiling, remaining))));
|
|
97
|
+
}
|
|
98
|
+
/* ------------------------------------------------- rows bounded content occupies */
|
|
99
|
+
/** Indent every expanded tool-input row carries; not available to the text. */
|
|
100
|
+
export const TOOL_INPUT_INDENT = ' ';
|
|
101
|
+
/** Indent every permission detail row carries; not available to the text. */
|
|
102
|
+
export const PERMISSION_DETAIL_INDENT = ' ';
|
|
103
|
+
/**
|
|
104
|
+
* One logical line as counted rows, tone and intraline emphasis riding along.
|
|
105
|
+
*
|
|
106
|
+
* The emphasis range names offsets in the *logical line*; each wrapped row is a
|
|
107
|
+
* contiguous slice of it, located by scanning forward (word wrap only drops
|
|
108
|
+
* whitespace at wrap points), so the range is intersected per row. Lines
|
|
109
|
+
* containing tabs skip emphasis — `wrapToRows` expands them, which would skew
|
|
110
|
+
* the offsets — and keep their tone; the `+ `/`- ` markers stay the durable
|
|
111
|
+
* statement either way.
|
|
112
|
+
*/
|
|
113
|
+
function contentRows(line, width, tone, emphasis) {
|
|
114
|
+
const mappable = emphasis !== undefined && !line.includes('\t') ? emphasis : undefined;
|
|
115
|
+
let cursor = 0;
|
|
116
|
+
return wrapToRows(line, width).map((text) => {
|
|
117
|
+
const row = { text };
|
|
118
|
+
if (tone !== undefined)
|
|
119
|
+
row.tone = tone;
|
|
120
|
+
if (mappable !== undefined && text !== '') {
|
|
121
|
+
const found = line.indexOf(text, cursor);
|
|
122
|
+
const at = found === -1 ? cursor : found;
|
|
123
|
+
cursor = at + text.length;
|
|
124
|
+
const start = Math.max(mappable.start, at) - at;
|
|
125
|
+
const end = Math.min(mappable.end, at + text.length) - at;
|
|
126
|
+
if (start < end)
|
|
127
|
+
row.emphasis = { start, end };
|
|
128
|
+
}
|
|
129
|
+
return row;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The expanded input of one running call, as terminal rows.
|
|
134
|
+
*
|
|
135
|
+
* `expandedToolInput` bounds what is *read* — 100 logical lines, 8000 code points —
|
|
136
|
+
* and that is not a height: measured at 80 columns, one 300-line file write came
|
|
137
|
+
* back as 4 logical lines and **41 terminal rows**. This is the function that turns
|
|
138
|
+
* the one unit into the other, and both the panel and the budget call it, so they
|
|
139
|
+
* cannot disagree about how tall the panel is.
|
|
140
|
+
*/
|
|
141
|
+
export function toolInputRows(input, columns, toolName) {
|
|
142
|
+
const width = Math.max(1, columns - TOOL_INPUT_INDENT.length);
|
|
143
|
+
// The `!` pseudo-tool's "input" is its live output tail — already plain,
|
|
144
|
+
// already bounded (`liveShellTail`) — so it is wrapped as-is rather than
|
|
145
|
+
// JSON-stringified onto one escaped line.
|
|
146
|
+
const lines = toolName === SHELL_TOOL_NAME && typeof input === 'string'
|
|
147
|
+
? input === '' ? [] : input.split('\n')
|
|
148
|
+
: expandedToolInput(input, toolName);
|
|
149
|
+
// Only fileEditor inputs are diff projections; a bash command that happens
|
|
150
|
+
// to start with `- ` must not turn red — nor gain an emphasis span.
|
|
151
|
+
const isDiff = toolName === 'fileEditor';
|
|
152
|
+
const emphasis = isDiff ? diffLineEmphasis(lines) : [];
|
|
153
|
+
return lines.flatMap((line, index) => contentRows(line, width, isDiff ? diffLineTone(line) : undefined, emphasis[index]));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Whether one running call's detail rows are drawn. Ctrl+B's session-wide toggle
|
|
157
|
+
* for real tools; always on for the `!` pseudo-tool, whose live output tail is
|
|
158
|
+
* the point of running it. One predicate, used by both the claims computation in
|
|
159
|
+
* `App.tsx` and the panel in `ToolCallPanel.tsx`, so what is counted and what is
|
|
160
|
+
* drawn cannot be two different answers.
|
|
161
|
+
*/
|
|
162
|
+
export function toolDetailsVisible(toolName, toolDetailsExpanded) {
|
|
163
|
+
return toolDetailsExpanded || toolName === SHELL_TOOL_NAME;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* One permission detail block's value, as terminal rows. `diff` marks a block
|
|
167
|
+
* whose value is diff text, and is what scopes the tone: a bash command whose
|
|
168
|
+
* line starts with `- ` stays plain.
|
|
169
|
+
*/
|
|
170
|
+
export function permissionDetailRows(value, columns, diff = false) {
|
|
171
|
+
const width = Math.max(1, columns - PERMISSION_DETAIL_INDENT.length);
|
|
172
|
+
const lines = permissionDetail(value);
|
|
173
|
+
const emphasis = diff ? diffLineEmphasis(lines) : [];
|
|
174
|
+
return lines.flatMap((line, index) => contentRows(line, width, diff ? diffLineTone(line) : undefined, emphasis[index]));
|
|
175
|
+
}
|
|
176
|
+
/** Rows the prompt region would draw with nothing bounding it. */
|
|
177
|
+
export function promptBoxWanted(input) {
|
|
178
|
+
const menu = input.completions > 0 ? 2 + input.completions + (input.moreCompletions ? 1 : 0) : 0;
|
|
179
|
+
const search = input.searchMatches === undefined
|
|
180
|
+
? 0
|
|
181
|
+
: 1 + input.searchMatches + (input.moreSearchMatches === true ? 1 : 0);
|
|
182
|
+
return input.draftRows + menu + search + (input.hasAttachment === true ? 1 : 0) +
|
|
183
|
+
(input.hasRecall === true ? RECALL_INDICATOR_ROWS : 0) + (input.hasHint ? 2 : 0);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Rows the prompt-recall indicator draws when it is granted one.
|
|
187
|
+
*
|
|
188
|
+
* One, and it lives here rather than beside the walk it describes because this module
|
|
189
|
+
* owns every row count in the region: a second definition is how a box comes to draw
|
|
190
|
+
* one more row than the budget handed it.
|
|
191
|
+
*/
|
|
192
|
+
export const RECALL_INDICATOR_ROWS = 1;
|
|
193
|
+
/** Rows the tool panel would draw with nothing bounding it. */
|
|
194
|
+
export function toolPanelWanted(tools) {
|
|
195
|
+
return tools.reduce((total, tool) => total + 1 + tool.detailRows, 0);
|
|
196
|
+
}
|
|
197
|
+
/** Rows the permission box would draw with nothing bounding it. */
|
|
198
|
+
export function permissionBoxWanted(blockRows, fixedRows = PERMISSION_BOX_FIXED_ROWS) {
|
|
199
|
+
return fixedRows + blockRows.reduce((total, rows) => total + rows + 2, 0);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Width available to text inside the permission box: its border and `paddingX`.
|
|
203
|
+
*
|
|
204
|
+
* Not cosmetic arithmetic — wrapping the details to the terminal's width instead of
|
|
205
|
+
* the box's made a 900-character value 25 rows tall by the budget's count and 27 by
|
|
206
|
+
* Ink's, which is a cleared screen at 40 columns.
|
|
207
|
+
*/
|
|
208
|
+
export const PERMISSION_BOX_CHROME_COLUMNS = 4;
|
|
209
|
+
/**
|
|
210
|
+
* The window of draft rows to draw: the newest rows that fit, moved to keep the
|
|
211
|
+
* cursor inside.
|
|
212
|
+
*
|
|
213
|
+
* A draft is not an answer — the row being edited must be visible whatever the
|
|
214
|
+
* scroll position implies, because rows Ink dropped are rows the cursor cannot be
|
|
215
|
+
* seen on. Exactly one row is reserved for the notice whenever anything is hidden,
|
|
216
|
+
* above and below together, so the height is decided in one step instead of
|
|
217
|
+
* depending on a window it has not chosen yet. With a single row to spend, the row
|
|
218
|
+
* the cursor is on wins over the line that would say rows are missing.
|
|
219
|
+
*/
|
|
220
|
+
export function draftWindow(totalRows, cursorRow, maxRows) {
|
|
221
|
+
if (maxRows <= 0)
|
|
222
|
+
return { start: 0, end: 0, hiddenAbove: 0, hiddenBelow: totalRows, notice: false };
|
|
223
|
+
if (totalRows <= maxRows)
|
|
224
|
+
return { start: 0, end: totalRows, hiddenAbove: 0, hiddenBelow: 0, notice: false };
|
|
225
|
+
const notice = maxRows > 1;
|
|
226
|
+
const capacity = maxRows - (notice ? 1 : 0);
|
|
227
|
+
const start = Math.max(0, Math.min(cursorRow - capacity + 1, totalRows - capacity));
|
|
228
|
+
const end = Math.min(totalRows, start + capacity);
|
|
229
|
+
return { start, end, hiddenAbove: start, hiddenBelow: totalRows - end, notice };
|
|
230
|
+
}
|
|
231
|
+
/** One line about the draft rows that are not on screen. */
|
|
232
|
+
export function hiddenDraftNotice(hiddenAbove, hiddenBelow) {
|
|
233
|
+
const parts = [];
|
|
234
|
+
if (hiddenAbove > 0)
|
|
235
|
+
parts.push(`${hiddenAbove} above`);
|
|
236
|
+
if (hiddenBelow > 0)
|
|
237
|
+
parts.push(`${hiddenBelow} below`);
|
|
238
|
+
const total = hiddenAbove + hiddenBelow;
|
|
239
|
+
return `… ${total} draft ${total === 1 ? 'row' : 'rows'} not shown (${parts.join(', ')})`;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Splits the prompt region's grant between draft, completion menu, recall indicator
|
|
243
|
+
* and hint.
|
|
244
|
+
*
|
|
245
|
+
* The draft keeps a floor first (its cursor row, plus the notice row it needs as
|
|
246
|
+
* soon as it is windowed), then the menu — a list of commands nobody can see is a
|
|
247
|
+
* list nobody uses — then the recall indicator, then the hint, which is the only
|
|
248
|
+
* purely informational row here and so the first to go. Whatever is left goes back to
|
|
249
|
+
* the draft, which is why an idle terminal shows a long draft in full.
|
|
250
|
+
*
|
|
251
|
+
* Recall outranks the hint and yields to the menu on purpose: it is the one row that
|
|
252
|
+
* says *why the draft just changed under the user's hands*, so it is worth more than a
|
|
253
|
+
* standing reminder of which commands exist — and worth less than the list the other
|
|
254
|
+
* arrow key is currently driving.
|
|
255
|
+
*/
|
|
256
|
+
export function planPromptBox(input) {
|
|
257
|
+
const maxRows = Math.max(0, input.maxRows);
|
|
258
|
+
const draftFloor = Math.min(maxRows, input.draftRows <= 1 ? 1 : 2);
|
|
259
|
+
let spare = maxRows - draftFloor;
|
|
260
|
+
// Search is modal within the editor: while open it replaces completion/recall chrome.
|
|
261
|
+
// Its title is useful even for loading, empty and no-match states. A partly granted
|
|
262
|
+
// result list spends its last row saying what was hidden.
|
|
263
|
+
let search = false;
|
|
264
|
+
let searchItems = 0;
|
|
265
|
+
let searchMore = false;
|
|
266
|
+
if (input.searchMatches !== undefined && spare >= 1) {
|
|
267
|
+
search = true;
|
|
268
|
+
const matches = Math.max(0, input.searchMatches);
|
|
269
|
+
const matchRows = Math.max(0, spare - 1);
|
|
270
|
+
searchMore = input.moreSearchMatches === true || matchRows < matches;
|
|
271
|
+
const omissionRows = searchMore && matchRows > 0 ? 1 : 0;
|
|
272
|
+
searchItems = Math.min(matches, Math.max(0, matchRows - omissionRows));
|
|
273
|
+
searchMore = searchMore && matchRows > 0;
|
|
274
|
+
spare -= 1 + searchItems + (searchMore ? 1 : 0);
|
|
275
|
+
}
|
|
276
|
+
// marginTop + the "commands (…)" title + one row per entry + the overflow line.
|
|
277
|
+
const menuWanted = input.searchMatches === undefined && input.completions > 0
|
|
278
|
+
? 2 + input.completions + (input.moreCompletions ? 1 : 0)
|
|
279
|
+
: 0;
|
|
280
|
+
const menuRows = Math.min(menuWanted, Math.max(0, spare));
|
|
281
|
+
// A partly granted menu pays for its own "… n more" row out of the grant, so the
|
|
282
|
+
// entries it drops are not dropped silently.
|
|
283
|
+
const moreRow = menuRows < menuWanted ? 1 : input.moreCompletions ? 1 : 0;
|
|
284
|
+
const completionItems = Math.max(0, Math.min(input.completions, menuRows - 2 - moreRow));
|
|
285
|
+
// Two rows of chrome with no entry under them says less than nothing, so a menu
|
|
286
|
+
// that cannot show one entry costs nothing at all.
|
|
287
|
+
if (completionItems > 0)
|
|
288
|
+
spare -= menuRows;
|
|
289
|
+
// The pending attachment is actionable editor state, so it precedes recall/hint.
|
|
290
|
+
const attachmentRows = input.hasAttachment === true && spare >= 1 ? 1 : 0;
|
|
291
|
+
spare -= attachmentRows;
|
|
292
|
+
// One row, or it is not drawn at all — the same all-or-nothing rule the hint has.
|
|
293
|
+
const recallRows = input.hasRecall === true && spare >= RECALL_INDICATOR_ROWS ? RECALL_INDICATOR_ROWS : 0;
|
|
294
|
+
spare -= recallRows;
|
|
295
|
+
// The hint is one row plus the blank row above it, or it is not drawn: a block
|
|
296
|
+
// granted half of what it draws is exactly how a frame outgrows its budget.
|
|
297
|
+
const hintRows = input.hasHint && spare >= 2 ? 2 : 0;
|
|
298
|
+
spare -= hintRows;
|
|
299
|
+
return {
|
|
300
|
+
draftRows: draftFloor + Math.max(0, spare),
|
|
301
|
+
completionItems,
|
|
302
|
+
completionMore: completionItems > 0 && moreRow === 1,
|
|
303
|
+
search,
|
|
304
|
+
searchItems,
|
|
305
|
+
searchMore,
|
|
306
|
+
attachment: attachmentRows > 0,
|
|
307
|
+
recall: recallRows > 0,
|
|
308
|
+
hint: hintRows > 0,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Fits the running calls into `maxRows`.
|
|
313
|
+
*
|
|
314
|
+
* Summaries come before detail: a call the user cannot see is a call they do not
|
|
315
|
+
* know is running, while expanded input is a display preference they toggled and
|
|
316
|
+
* can toggle back. When even the summaries do not fit, the last row becomes the
|
|
317
|
+
* collapsed count — one row that says how many calls it is standing in for.
|
|
318
|
+
*
|
|
319
|
+
* An entry costs `1 + detailRows + (hiddenDetailRows > 0 ? 1 : 0)` rows: the
|
|
320
|
+
* summary, the input rows, and the row spent saying what was left out. That notice
|
|
321
|
+
* row is why a call whose detail is cut to nothing reports nothing — with no free
|
|
322
|
+
* row there is nowhere to say it, and the panel would otherwise overflow to
|
|
323
|
+
* apologise. The `tool details: expanded` notice in history still records the mode.
|
|
324
|
+
*/
|
|
325
|
+
export function planToolPanel(tools, maxRows) {
|
|
326
|
+
// No rows at all means an invisible panel: there is nowhere to even say that a
|
|
327
|
+
// call is running. `frameBudget` reports that as `degraded`.
|
|
328
|
+
if (tools.length === 0 || maxRows <= 0) {
|
|
329
|
+
return { entries: [], hiddenTools: 0 };
|
|
330
|
+
}
|
|
331
|
+
if (tools.length > maxRows) {
|
|
332
|
+
const shown = Math.max(0, maxRows - 1);
|
|
333
|
+
return {
|
|
334
|
+
entries: tools.slice(0, shown).map(() => ({ detailRows: 0, hiddenDetailRows: 0 })),
|
|
335
|
+
hiddenTools: tools.length - shown,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
let spare = maxRows - tools.length;
|
|
339
|
+
const entries = tools.map((tool) => {
|
|
340
|
+
if (tool.detailRows === 0 || spare <= 0)
|
|
341
|
+
return { detailRows: 0, hiddenDetailRows: 0 };
|
|
342
|
+
if (tool.detailRows <= spare) {
|
|
343
|
+
spare -= tool.detailRows;
|
|
344
|
+
return { detailRows: tool.detailRows, hiddenDetailRows: 0 };
|
|
345
|
+
}
|
|
346
|
+
// One of the granted rows pays for the notice, so detail never just stops.
|
|
347
|
+
const drawn = spare - 1;
|
|
348
|
+
spare = 0;
|
|
349
|
+
return drawn <= 0
|
|
350
|
+
? { detailRows: 0, hiddenDetailRows: 0 }
|
|
351
|
+
: { detailRows: drawn, hiddenDetailRows: tool.detailRows - drawn };
|
|
352
|
+
});
|
|
353
|
+
return { entries, hiddenTools: 0 };
|
|
354
|
+
}
|
|
355
|
+
/** One line about tool input rows that did not fit. */
|
|
356
|
+
export function hiddenDetailNotice(hiddenRows) {
|
|
357
|
+
return `… ${hiddenRows} more input ${hiddenRows === 1 ? 'row' : 'rows'} not shown`;
|
|
358
|
+
}
|
|
359
|
+
/** One line standing in for the calls the panel had no room for. */
|
|
360
|
+
export function hiddenToolsNotice(hiddenTools) {
|
|
361
|
+
return `… ${hiddenTools} more tool ${hiddenTools === 1 ? 'call' : 'calls'} running`;
|
|
362
|
+
}
|
|
363
|
+
/** Rows the queued listing would draw with nothing bounding it: one per entry. */
|
|
364
|
+
export function queueListWanted(entries) {
|
|
365
|
+
return entries;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Fits the queued listing into `maxRows`.
|
|
369
|
+
*
|
|
370
|
+
* The head of the queue is what drains next, so when rows run out the oldest
|
|
371
|
+
* entries stay and one row states the rest — the same truncation vocabulary as
|
|
372
|
+
* the tool panel. A single granted row for several entries goes entirely to the
|
|
373
|
+
* notice: one entry shown while others hide silently would misstate the queue.
|
|
374
|
+
*/
|
|
375
|
+
export function planQueueList(entries, maxRows) {
|
|
376
|
+
if (entries <= 0 || maxRows <= 0)
|
|
377
|
+
return { shown: 0, hiddenEntries: entries };
|
|
378
|
+
if (entries <= maxRows)
|
|
379
|
+
return { shown: entries, hiddenEntries: 0 };
|
|
380
|
+
const shown = Math.max(0, maxRows - 1);
|
|
381
|
+
return { shown, hiddenEntries: entries - shown };
|
|
382
|
+
}
|
|
383
|
+
/** One line standing in for the queued entries the listing had no room for. */
|
|
384
|
+
export function hiddenQueuedNotice(hiddenEntries) {
|
|
385
|
+
return `… ${hiddenEntries} more queued`;
|
|
386
|
+
}
|
|
387
|
+
/* --------------------------------------------------------- the permission box */
|
|
388
|
+
/**
|
|
389
|
+
* Rows the box costs before any detail: the border, the heading, the summary, and
|
|
390
|
+
* the decision row with the blank row above it.
|
|
391
|
+
*/
|
|
392
|
+
export const PERMISSION_BOX_FIXED_ROWS = 6;
|
|
393
|
+
/**
|
|
394
|
+
* Fits the permission box into `maxRows`.
|
|
395
|
+
*
|
|
396
|
+
* The heading, the summary and the decision row are never what yields: a prompt
|
|
397
|
+
* whose question scrolled off the frame is a prompt that cannot be answered, and
|
|
398
|
+
* this is the one box in the TUI where a silently shortened view would be a
|
|
399
|
+
* security problem rather than a cosmetic one. So detail is cut from the bottom,
|
|
400
|
+
* every cut is counted, and the row that states the cut is reserved before any
|
|
401
|
+
* detail is handed out.
|
|
402
|
+
*
|
|
403
|
+
* `fixedRows` is passed in rather than assumed: on a narrow terminal the heading
|
|
404
|
+
* and the decision row wrap, and a box that budgeted one row for each of them
|
|
405
|
+
* would overflow by exactly the rows it did not count.
|
|
406
|
+
*
|
|
407
|
+
* Below the fixed cost the box drops its border and its details rather than its
|
|
408
|
+
* question, and keeps stating what it hid for as long as it has a row for it. The
|
|
409
|
+
* last thing standing, at one row, is `allow?` itself.
|
|
410
|
+
*/
|
|
411
|
+
export function planPermissionBox(blockRows, maxRows, fixedRows = PERMISSION_BOX_FIXED_ROWS) {
|
|
412
|
+
const wanted = blockRows.reduce((total, rows) => total + rows + 2, 0);
|
|
413
|
+
const detailBudget = maxRows - fixedRows;
|
|
414
|
+
const needsNotice = wanted > Math.max(0, detailBudget);
|
|
415
|
+
if (maxRows < fixedRows + (needsNotice ? 1 : 0)) {
|
|
416
|
+
// Compact: the decision row, then the summary, then the line about what is
|
|
417
|
+
// missing — in that order, because that is the order they stop being optional.
|
|
418
|
+
return {
|
|
419
|
+
blocks: blockRows.map((rows) => ({ rows: 0, hiddenRows: rows })),
|
|
420
|
+
hiddenBlocks: blockRows.length,
|
|
421
|
+
compact: true,
|
|
422
|
+
summary: maxRows >= 2,
|
|
423
|
+
notice: maxRows >= 3 && wanted > 0,
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
let spare = detailBudget - (needsNotice ? 1 : 0);
|
|
427
|
+
let hiddenBlocks = 0;
|
|
428
|
+
const blocks = blockRows.map((rows) => {
|
|
429
|
+
// A blank row and the label have to be paid before a single detail row shows.
|
|
430
|
+
if (spare < 3) {
|
|
431
|
+
hiddenBlocks += 1;
|
|
432
|
+
return { rows: 0, hiddenRows: rows };
|
|
433
|
+
}
|
|
434
|
+
const granted = Math.min(rows, spare - 2);
|
|
435
|
+
spare -= granted + 2;
|
|
436
|
+
return { rows: granted, hiddenRows: rows - granted };
|
|
437
|
+
});
|
|
438
|
+
return { blocks, hiddenBlocks, compact: false, summary: true, notice: needsNotice };
|
|
439
|
+
}
|
|
440
|
+
/** One line about detail rows the box could not show. */
|
|
441
|
+
export function hiddenPermissionNotice(hiddenRows, hiddenBlocks) {
|
|
442
|
+
const rows = `${hiddenRows} detail ${hiddenRows === 1 ? 'row' : 'rows'}`;
|
|
443
|
+
const blocks = hiddenBlocks > 0 ? ` in ${hiddenBlocks} hidden ${hiddenBlocks === 1 ? 'block' : 'blocks'}` : '';
|
|
444
|
+
return `… ${rows}${blocks} not shown — the terminal is too short`;
|
|
445
|
+
}
|
|
446
|
+
//# sourceMappingURL=frame-budget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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O,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACtF,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,YAAoB;IAC7E,MAAM,IAAI,GAAG,GAAG,UAAU,WAAW,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzE,MAAM,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,YAAY,WAAW,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/G,OAAO,KAAK,IAAI,GAAG,MAAM,wCAAwC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Hard report bounds: help is transcript history, never an unbounded catalogue dump. */
|
|
2
|
+
export declare const MAX_HELP_COMMANDS = 24;
|
|
3
|
+
/**
|
|
4
|
+
* Fixed rows `formatHelpReport()` always emits: the title, the command-section header,
|
|
5
|
+
* the "prompt and completion" block and the "editing and session" block, plus the
|
|
6
|
+
* one-line overflow notice a filled command cap would add.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HELP_FIXED_LINES = 23;
|
|
9
|
+
/**
|
|
10
|
+
* The line cap must cover the worst case — a command inventory that fills
|
|
11
|
+
* `MAX_HELP_COMMANDS` *and* every fixed row — so `slice()` can never silently drop a
|
|
12
|
+
* documented control. Derived, never a hand-picked number with incidental headroom.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MAX_HELP_LINES: number;
|
|
15
|
+
export declare const MAX_HELP_LINE_CODE_POINTS = 160;
|
|
16
|
+
/** A pure local projection of the canonical command inventory and fixed input controls. */
|
|
17
|
+
export declare function formatHelpReport(): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BUILTIN_COMMAND_DESCRIPTIONS, BUILTIN_COMMAND_NAMES, } from '../commands/custom-commands.js';
|
|
2
|
+
import { ESCAPE_REWIND_CHORD_MS } from './rewind-search.js';
|
|
3
|
+
/** Hard report bounds: help is transcript history, never an unbounded catalogue dump. */
|
|
4
|
+
export const MAX_HELP_COMMANDS = 24;
|
|
5
|
+
/**
|
|
6
|
+
* Fixed rows `formatHelpReport()` always emits: the title, the command-section header,
|
|
7
|
+
* the "prompt and completion" block and the "editing and session" block, plus the
|
|
8
|
+
* one-line overflow notice a filled command cap would add.
|
|
9
|
+
*/
|
|
10
|
+
export const HELP_FIXED_LINES = 23;
|
|
11
|
+
/**
|
|
12
|
+
* The line cap must cover the worst case — a command inventory that fills
|
|
13
|
+
* `MAX_HELP_COMMANDS` *and* every fixed row — so `slice()` can never silently drop a
|
|
14
|
+
* documented control. Derived, never a hand-picked number with incidental headroom.
|
|
15
|
+
*/
|
|
16
|
+
export const MAX_HELP_LINES = MAX_HELP_COMMANDS + HELP_FIXED_LINES;
|
|
17
|
+
export const MAX_HELP_LINE_CODE_POINTS = 160;
|
|
18
|
+
function boundedLine(value) {
|
|
19
|
+
const points = [...value];
|
|
20
|
+
if (points.length <= MAX_HELP_LINE_CODE_POINTS)
|
|
21
|
+
return value;
|
|
22
|
+
return `${points.slice(0, MAX_HELP_LINE_CODE_POINTS - 1).join('')}…`;
|
|
23
|
+
}
|
|
24
|
+
/** A pure local projection of the canonical command inventory and fixed input controls. */
|
|
25
|
+
export function formatHelpReport() {
|
|
26
|
+
const commandNames = BUILTIN_COMMAND_NAMES.slice(0, MAX_HELP_COMMANDS);
|
|
27
|
+
const lines = [
|
|
28
|
+
'help — local controls',
|
|
29
|
+
`commands (${commandNames.length}/${BUILTIN_COMMAND_NAMES.length}):`,
|
|
30
|
+
...commandNames.map((name) => ` /${name} — ${BUILTIN_COMMAND_DESCRIPTIONS[name]}`),
|
|
31
|
+
];
|
|
32
|
+
if (commandNames.length < BUILTIN_COMMAND_NAMES.length) {
|
|
33
|
+
lines.push(` … ${BUILTIN_COMMAND_NAMES.length - commandNames.length} more commands not shown`);
|
|
34
|
+
}
|
|
35
|
+
lines.push('prompt and completion:', ' / opens commands and skills · Up/Down select · Tab/Enter completes the selected row', ' @ completes a workspace path · acceptance inserts path text only, never file content', ' !<command> runs your shell command locally (not as a model tool call)', ' Enter sends · Ctrl+J or trailing \\ + Enter inserts a newline · multiline paste never submits', ' Ctrl+O attaches one clipboard image to the next prompt; Ctrl+O again removes it', ' Ctrl+R searches this project’s prompt history · type to filter · Ctrl+R/Up/Down navigate · Tab/Enter accepts', ' Up/Down precedence: completion · Up queued-message take-back · prompt recall · cursor movement', ' Esc closes completion, cancels history search to its exact draft/cursor, or ends prompt recall', ` Esc Esc (within ${ESCAPE_REWIND_CHORD_MS} ms) on an empty idle composer opens the /rewind chooser; one Esc there does nothing`, 'editing and session:', ' Home/End or Ctrl+A/E moves to the visible row edge', ' Ctrl+K/U deletes to the row end/start · Ctrl+W deletes the previous word', ' Alt/Ctrl+Left/Right or Alt+B/F moves by word · Alt+Backspace/Alt+D deletes the word before/after', ' Ctrl+_ (or Ctrl+-) undoes the last Ctrl+K/U, Ctrl+W or Alt word deletion in the draft', ' /rewind branches conversation only; it never rolls back workspace files or side effects', ' /copy puts the last completed answer on the clipboard via OSC 52 (plus wl-copy/xclip/pbcopy when a display is present)', ' Ctrl+B toggles compact/expanded tool details', ' Ctrl+C cancels busy work; press again within 2s to exit (while idle, it exits)', ' Ctrl+D or /exit or /quit exits');
|
|
36
|
+
return lines.slice(0, MAX_HELP_LINES).map(boundedLine).join('\n');
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=help-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-format.js","sourceRoot":"","sources":["../../../src/tui/help-format.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4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B,uFAAuF,EACvF,wFAAwF,EACxF,yEAAyE,EACzE,iGAAiG,EACjG,mFAAmF,EACnF,gHAAgH,EAChH,kGAAkG,EAClG,kGAAkG,EAClG,qBAAqB,sBAAsB,sFAAsF,EACjI,sBAAsB,EACtB,sDAAsD,EACtD,4EAA4E,EAC5E,oGAAoG,EACpG,yFAAyF,EACzF,2FAA2F,EAC3F,0HAA0H,EAC1H,gDAAgD,EAChD,kFAAkF,EAClF,kCAAkC,CACnC,CAAC;IAEF,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `agent` label above the text and the blank row below it.
|
|
3
|
+
*
|
|
4
|
+
* Exported because the block's *claim* on the frame is stated in `App` and its
|
|
5
|
+
* height is decided here: a claim that forgot the label would be short by two rows.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LIVE_BLOCK_CHROME_ROWS = 2;
|
|
8
|
+
/**
|
|
9
|
+
* Shortest block this can draw: the label, one row of answer, the notice that
|
|
10
|
+
* says rows are missing, and the bottom margin. Below it the block does not
|
|
11
|
+
* shrink further — it yields the frame entirely, because the streaming answer is
|
|
12
|
+
* the one participant whose text is already guaranteed to reach `<Static>` history
|
|
13
|
+
* in full, and a block that "stops shrinking" is a block that overflows.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MINIMUM_LIVE_BLOCK_ROWS: number;
|
|
16
|
+
/** One pre-wrapped terminal row of the live block. */
|
|
17
|
+
export interface LiveRow {
|
|
18
|
+
/** The row's text, already wrapped to the terminal width. */
|
|
19
|
+
readonly text: string;
|
|
20
|
+
/**
|
|
21
|
+
* Index of the logical line (in the live text split on `\n`) this row came
|
|
22
|
+
* from — how a wrapped row finds its markdown line kind without a second
|
|
23
|
+
* wrapping calculation.
|
|
24
|
+
*/
|
|
25
|
+
readonly line: number;
|
|
26
|
+
}
|
|
27
|
+
export interface LiveTextView {
|
|
28
|
+
/** Rows to draw, already wrapped to the terminal width, oldest first. */
|
|
29
|
+
readonly rows: readonly LiveRow[];
|
|
30
|
+
/** Wrapped rows dropped off the top; `0` when the whole answer fits. */
|
|
31
|
+
readonly hiddenRows: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The tail of `text` that fits `maxRows` terminal rows.
|
|
35
|
+
*
|
|
36
|
+
* `maxRows` covers the whole block the caller draws — the `agent` label, its
|
|
37
|
+
* bottom margin, and the "scrolled out" notice — not just the text, because the
|
|
38
|
+
* budget it comes from is a slice of the viewport, and a label that overflows
|
|
39
|
+
* costs exactly as much as a line of answer would.
|
|
40
|
+
*/
|
|
41
|
+
export declare function liveTextView(text: string, columns: number, maxRows: number): LiveTextView;
|
|
42
|
+
/** One line of prose about the rows that no longer fit. */
|
|
43
|
+
export declare function hiddenRowsNotice(hiddenRows: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* Wraps `text` into terminal rows the way the live block draws them.
|
|
46
|
+
*
|
|
47
|
+
* The last column is left empty: terminals disagree about whether writing the
|
|
48
|
+
* final cell wraps immediately or on the next character, and a row that wraps
|
|
49
|
+
* on its own is a row Ink did not count.
|
|
50
|
+
*/
|
|
51
|
+
export declare function wrapToRows(text: string, columns: number): readonly string[];
|