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,69 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { visualColor } from './visual-language.js';
|
|
5
|
+
export const WIDE_WELCOME_WORDMARK = [
|
|
6
|
+
'██████╗ █████╗ ██████╗ ██╗ ██╗██╗███╗ ██╗',
|
|
7
|
+
'██╔══██╗██╔══██╗██╔══██╗██║ ██║██║████╗ ██║',
|
|
8
|
+
'██║ ██║███████║██████╔╝██║ █╗ ██║██║██╔██╗ ██║',
|
|
9
|
+
'██║ ██║██╔══██║██╔══██╗██║███╗██║██║██║╚██╗██║',
|
|
10
|
+
'██████╔╝██║ ██║██║ ██║╚███╔███╔╝██║██║ ╚████║',
|
|
11
|
+
];
|
|
12
|
+
export const MEDIUM_WELCOME_WORDMARK = [
|
|
13
|
+
'█▀▄ ▄▀█ █▀█ █ █ █ █ █▄ █',
|
|
14
|
+
'█ █ █▀█ ██▄ █▄█▄█ █ █ ▀█',
|
|
15
|
+
'▀▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀',
|
|
16
|
+
];
|
|
17
|
+
const WIDE_TAGLINE = ' coding through iteration';
|
|
18
|
+
const MEDIUM_TAGLINE = ' coding through iteration';
|
|
19
|
+
const COMPACT_WELCOME = '◆ DARWIN';
|
|
20
|
+
// These are terminal-cell thresholds, not JavaScript string lengths. The current
|
|
21
|
+
// hand-maintained rows are all single-cell glyphs, and the boundary render tests
|
|
22
|
+
// pin that fact so a future wordmark edit cannot silently reintroduce truncation.
|
|
23
|
+
const WIDE_MIN_COLUMNS = 47;
|
|
24
|
+
const MEDIUM_MIN_COLUMNS = 38;
|
|
25
|
+
/**
|
|
26
|
+
* Chooses a complete hand-maintained welcome before Ink renders it.
|
|
27
|
+
*
|
|
28
|
+
* The vertical thresholds leave room for the ordinary ready header and prompt
|
|
29
|
+
* during the initial handoff. The selected rows are never assembled or clipped
|
|
30
|
+
* dynamically: each variant is a complete textual identity without colour.
|
|
31
|
+
*/
|
|
32
|
+
export function welcomeLayout(columns, rows) {
|
|
33
|
+
if (columns >= WIDE_MIN_COLUMNS && rows >= 18) {
|
|
34
|
+
return {
|
|
35
|
+
variant: 'wide',
|
|
36
|
+
lines: [...WIDE_WELCOME_WORDMARK, WIDE_TAGLINE],
|
|
37
|
+
brandRows: WIDE_WELCOME_WORDMARK.length,
|
|
38
|
+
marginBottom: 1,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (columns >= MEDIUM_MIN_COLUMNS && rows >= 10) {
|
|
42
|
+
return {
|
|
43
|
+
variant: 'medium',
|
|
44
|
+
lines: [...MEDIUM_WELCOME_WORDMARK, MEDIUM_TAGLINE],
|
|
45
|
+
brandRows: MEDIUM_WELCOME_WORDMARK.length,
|
|
46
|
+
marginBottom: 1,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
variant: 'compact',
|
|
51
|
+
lines: [COMPACT_WELCOME],
|
|
52
|
+
brandRows: 1,
|
|
53
|
+
marginBottom: 0,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* One presentation-only ready-state welcome committed to terminal scrollback.
|
|
58
|
+
*
|
|
59
|
+
* It is the first presentation-only item in MessageList's existing Static owner:
|
|
60
|
+
* not turn history, trajectory/replay content, measured header furniture, or a
|
|
61
|
+
* frame-budget participant. The successor transcript omits it after `/clear`.
|
|
62
|
+
*/
|
|
63
|
+
export function WelcomeHeader({ layout }) {
|
|
64
|
+
return (_jsx(Box, { flexDirection: "column", marginBottom: layout.marginBottom, children: layout.lines.map((line, index) => {
|
|
65
|
+
const branded = index < layout.brandRows;
|
|
66
|
+
return (_jsx(Text, { ...(branded ? { color: visualColor.identity } : {}), bold: branded, dimColor: !branded, wrap: "truncate-end", children: line }, index));
|
|
67
|
+
}) }));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=WelcomeHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeHeader.js","sourceRoot":"","sources":["../../../src/tui/WelcomeHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAanD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;IACjD,iDAAiD;CACzC,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;CACvB,CAAC;AAEX,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAC9D,MAAM,cAAc,GAAG,iCAAiC,CAAC;AACzD,MAAM,eAAe,GAAG,UAAU,CAAC;AAEnC,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,IAAY;IACzD,IAAI,OAAO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0 +1,22 @@
|
|
|
1
|
+
export declare const BACKGROUND_BASH_MODES: readonly ['start', 'list', 'status', 'output', 'wait', 'stop'];
|
|
2
|
+
export type BackgroundBashMode = (typeof BACKGROUND_BASH_MODES)[number];
|
|
3
|
+
export type CompactBackgroundResult = {
|
|
4
|
+
kind: 'suppress';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'compact';
|
|
7
|
+
summary: string;
|
|
8
|
+
preview: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'fallback';
|
|
11
|
+
};
|
|
12
|
+
/** Recognizes only manager-owned bash lifecycle calls; foreground bash stays unchanged. */
|
|
13
|
+
export declare function backgroundBashMode(toolName: string, input: unknown): BackgroundBashMode | undefined;
|
|
14
|
+
/** One bounded live-row label, without manager paths or full UUIDs. */
|
|
15
|
+
export declare function compactBackgroundCallSummary(mode: BackgroundBashMode, input: unknown): string;
|
|
16
|
+
/** Selects the live label so a detail toggle can redraw an already-active call. */
|
|
17
|
+
export declare function activeToolCallSummary(summary: string, compactSummary: string | undefined, toolDetailsExpanded: boolean): string;
|
|
18
|
+
/**
|
|
19
|
+
* Projects a successful lifecycle result for compact transcript history.
|
|
20
|
+
* Unknown payloads deliberately fall back to the ordinary full preview.
|
|
21
|
+
*/
|
|
22
|
+
export declare function compactBackgroundResult(mode: BackgroundBashMode, input: unknown, content: readonly unknown[]): CompactBackgroundResult;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { TERMINAL_WAIT_TIMEOUT_INSTRUCTION } from '../tools/background-wait-contract.js';
|
|
2
|
+
import { formatTaskId, summarizeTaskCommand } from './task-format.js';
|
|
3
|
+
export const BACKGROUND_BASH_MODES = ['start', 'list', 'status', 'output', 'wait', 'stop'];
|
|
4
|
+
const TASK_ID_LABEL_LIMIT = 24;
|
|
5
|
+
const TASK_STATES = ['running', 'succeeded', 'failed', 'stopped'];
|
|
6
|
+
const START_KEYS = ['taskId', 'pid', 'outputPath'];
|
|
7
|
+
const SNAPSHOT_KEYS = [
|
|
8
|
+
'taskId', 'state', 'command', 'pid', 'startedAt', 'finishedAt',
|
|
9
|
+
'exitCode', 'signal', 'outputPath', 'outputBytes',
|
|
10
|
+
];
|
|
11
|
+
const OUTPUT_KEYS = ['taskId', 'output', 'startOffset', 'endOffset', 'hasMore', 'outputPath'];
|
|
12
|
+
const WAIT_KEYS = ['reason', 'status', 'output'];
|
|
13
|
+
const WAIT_TIMEOUT_KEYS = ['reason', 'status', 'output', 'instruction'];
|
|
14
|
+
const WAIT_REASONS = ['output', 'changed', 'terminal', 'timeout', 'cancelled', 'shutdown'];
|
|
15
|
+
/** Recognizes only manager-owned bash lifecycle calls; foreground bash stays unchanged. */
|
|
16
|
+
export function backgroundBashMode(toolName, input) {
|
|
17
|
+
if (toolName !== 'bash' || !isRecord(input))
|
|
18
|
+
return undefined;
|
|
19
|
+
const mode = input.mode;
|
|
20
|
+
return typeof mode === 'string' && BACKGROUND_BASH_MODES.includes(mode)
|
|
21
|
+
? mode
|
|
22
|
+
: undefined;
|
|
23
|
+
}
|
|
24
|
+
/** One bounded live-row label, without manager paths or full UUIDs. */
|
|
25
|
+
export function compactBackgroundCallSummary(mode, input) {
|
|
26
|
+
if (!isRecord(input))
|
|
27
|
+
return `bash ${mode}`;
|
|
28
|
+
if (mode === 'start' && typeof input.command === 'string') {
|
|
29
|
+
return `bash start: ${summarizeTaskCommand(input.command)}`;
|
|
30
|
+
}
|
|
31
|
+
if ((mode === 'status' || mode === 'output' || mode === 'wait' || mode === 'stop') && typeof input.taskId === 'string') {
|
|
32
|
+
return `bash ${mode}: ${compactTaskId(input.taskId)}`;
|
|
33
|
+
}
|
|
34
|
+
return `bash ${mode}`;
|
|
35
|
+
}
|
|
36
|
+
/** Selects the live label so a detail toggle can redraw an already-active call. */
|
|
37
|
+
export function activeToolCallSummary(summary, compactSummary, toolDetailsExpanded) {
|
|
38
|
+
return toolDetailsExpanded ? summary : (compactSummary ?? summary);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Projects a successful lifecycle result for compact transcript history.
|
|
42
|
+
* Unknown payloads deliberately fall back to the ordinary full preview.
|
|
43
|
+
*/
|
|
44
|
+
export function compactBackgroundResult(mode, input, content) {
|
|
45
|
+
const payload = resultPayload(content);
|
|
46
|
+
if (payload === MALFORMED)
|
|
47
|
+
return { kind: 'fallback' };
|
|
48
|
+
switch (mode) {
|
|
49
|
+
case 'start': {
|
|
50
|
+
if (!isStartResult(payload))
|
|
51
|
+
return { kind: 'fallback' };
|
|
52
|
+
return {
|
|
53
|
+
kind: 'compact',
|
|
54
|
+
summary: `bash start: ${compactTaskId(payload.taskId)} started (pid ${payload.pid})`,
|
|
55
|
+
preview: '',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
case 'list': {
|
|
59
|
+
if (!Array.isArray(payload) || !payload.every(isFullTaskSnapshot))
|
|
60
|
+
return { kind: 'fallback' };
|
|
61
|
+
const states = new Map();
|
|
62
|
+
for (const task of payload)
|
|
63
|
+
states.set(task.state, (states.get(task.state) ?? 0) + 1);
|
|
64
|
+
const breakdown = [...states].map(([state, count]) => `${count} ${state}`).join(', ');
|
|
65
|
+
return {
|
|
66
|
+
kind: 'compact',
|
|
67
|
+
summary: `bash list: ${payload.length} task${payload.length === 1 ? '' : 's'}${breakdown === '' ? '' : ` (${breakdown})`}`,
|
|
68
|
+
preview: '',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
case 'status':
|
|
72
|
+
return isFullTaskSnapshot(payload) && matchesInputTaskId(input, payload.taskId)
|
|
73
|
+
? { kind: 'suppress' }
|
|
74
|
+
: { kind: 'fallback' };
|
|
75
|
+
case 'output': {
|
|
76
|
+
if (!isOutputResult(payload) || !matchesInputTaskId(input, payload.taskId)) {
|
|
77
|
+
return { kind: 'fallback' };
|
|
78
|
+
}
|
|
79
|
+
if (payload.output === '')
|
|
80
|
+
return { kind: 'suppress' };
|
|
81
|
+
return {
|
|
82
|
+
kind: 'compact',
|
|
83
|
+
summary: `bash output: ${compactTaskId(payload.taskId)}`,
|
|
84
|
+
preview: payload.output.trimEnd(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
case 'wait': {
|
|
88
|
+
if (!isWaitResult(payload, input) || !matchesInputTaskId(input, payload.status.taskId)) {
|
|
89
|
+
return { kind: 'fallback' };
|
|
90
|
+
}
|
|
91
|
+
if (payload.status.state === 'running')
|
|
92
|
+
return { kind: 'suppress' };
|
|
93
|
+
return {
|
|
94
|
+
kind: 'compact',
|
|
95
|
+
summary: `bash wait: ${compactTaskId(payload.status.taskId)} ${payload.status.state}`,
|
|
96
|
+
preview: '',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case 'stop':
|
|
100
|
+
if (!isFullTaskSnapshot(payload) || !matchesInputTaskId(input, payload.taskId)) {
|
|
101
|
+
return { kind: 'fallback' };
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
kind: 'compact',
|
|
105
|
+
summary: `bash stop: ${compactTaskId(payload.taskId)} ${payload.state}`,
|
|
106
|
+
preview: '',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const MALFORMED = Symbol('malformed-background-result');
|
|
111
|
+
function resultPayload(content) {
|
|
112
|
+
if (content.length !== 1 || !isRecord(content[0]))
|
|
113
|
+
return MALFORMED;
|
|
114
|
+
const block = content[0];
|
|
115
|
+
if (block.type === 'jsonBlock')
|
|
116
|
+
return hasExactKeys(block, ['type', 'json']) ? block.json : MALFORMED;
|
|
117
|
+
if (block.type !== 'textBlock' || typeof block.text !== 'string' || !hasExactKeys(block, ['type', 'text'])) {
|
|
118
|
+
return MALFORMED;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
return JSON.parse(block.text);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return MALFORMED;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function isStartResult(value) {
|
|
128
|
+
return isRecord(value) && hasExactKeys(value, START_KEYS) && isTaskId(value.taskId) &&
|
|
129
|
+
isPositiveSafeInteger(value.pid) && typeof value.outputPath === 'string';
|
|
130
|
+
}
|
|
131
|
+
function isOutputResult(value) {
|
|
132
|
+
return isRecord(value) && hasExactKeys(value, OUTPUT_KEYS) && isTaskId(value.taskId) &&
|
|
133
|
+
typeof value.output === 'string' && isNonNegativeSafeInteger(value.startOffset) &&
|
|
134
|
+
isNonNegativeSafeInteger(value.endOffset) &&
|
|
135
|
+
value.endOffset - value.startOffset === Buffer.byteLength(value.output) &&
|
|
136
|
+
typeof value.hasMore === 'boolean' && typeof value.outputPath === 'string';
|
|
137
|
+
}
|
|
138
|
+
function isWaitResult(value, input) {
|
|
139
|
+
if (!isRecord(value) ||
|
|
140
|
+
(!hasExactKeys(value, WAIT_KEYS) && !hasExactKeys(value, WAIT_TIMEOUT_KEYS)) ||
|
|
141
|
+
typeof value.reason !== 'string' || !WAIT_REASONS.includes(value.reason) ||
|
|
142
|
+
!isFullTaskSnapshot(value.status) || !isOutputResult(value.output) ||
|
|
143
|
+
value.status.taskId !== value.output.taskId)
|
|
144
|
+
return false;
|
|
145
|
+
if (!isRecord(input) ||
|
|
146
|
+
(input.wakeOnOutput !== undefined && typeof input.wakeOnOutput !== 'boolean'))
|
|
147
|
+
return false;
|
|
148
|
+
const terminalFocused = input.wakeOnOutput === false;
|
|
149
|
+
const hasInstruction = Object.hasOwn(value, 'instruction');
|
|
150
|
+
if (terminalFocused) {
|
|
151
|
+
if (value.reason === 'output' || value.reason === 'changed')
|
|
152
|
+
return false;
|
|
153
|
+
if (value.reason === 'terminal')
|
|
154
|
+
return !hasInstruction && value.status.state !== 'running';
|
|
155
|
+
if (value.reason === 'timeout') {
|
|
156
|
+
return value.status.state === 'running' && hasInstruction &&
|
|
157
|
+
value.instruction === TERMINAL_WAIT_TIMEOUT_INSTRUCTION;
|
|
158
|
+
}
|
|
159
|
+
return !hasInstruction && value.status.state === 'running';
|
|
160
|
+
}
|
|
161
|
+
if (hasInstruction)
|
|
162
|
+
return false;
|
|
163
|
+
if (value.reason === 'output')
|
|
164
|
+
return value.output.output !== '';
|
|
165
|
+
if (value.reason === 'terminal') {
|
|
166
|
+
return value.status.state !== 'running' && value.output.output === '';
|
|
167
|
+
}
|
|
168
|
+
return value.status.state === 'running' && value.output.output === '';
|
|
169
|
+
}
|
|
170
|
+
function isFullTaskSnapshot(value) {
|
|
171
|
+
return isRecord(value) && hasExactKeys(value, SNAPSHOT_KEYS) && isTaskId(value.taskId) &&
|
|
172
|
+
isTaskState(value.state) && typeof value.command === 'string' && isPositiveSafeInteger(value.pid) &&
|
|
173
|
+
isIsoTimestamp(value.startedAt) && (value.finishedAt === null || isIsoTimestamp(value.finishedAt)) &&
|
|
174
|
+
(value.exitCode === null || isNonNegativeSafeInteger(value.exitCode)) &&
|
|
175
|
+
(value.signal === null || typeof value.signal === 'string') && typeof value.outputPath === 'string' &&
|
|
176
|
+
(value.outputBytes === null || isNonNegativeSafeInteger(value.outputBytes));
|
|
177
|
+
}
|
|
178
|
+
function matchesInputTaskId(input, resultTaskId) {
|
|
179
|
+
return isRecord(input) && isTaskId(input.taskId) && input.taskId === resultTaskId;
|
|
180
|
+
}
|
|
181
|
+
function isTaskId(value) {
|
|
182
|
+
return typeof value === 'string' && /^bg-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(value);
|
|
183
|
+
}
|
|
184
|
+
function isTaskState(value) {
|
|
185
|
+
return typeof value === 'string' && TASK_STATES.includes(value);
|
|
186
|
+
}
|
|
187
|
+
function isPositiveSafeInteger(value) {
|
|
188
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value > 0;
|
|
189
|
+
}
|
|
190
|
+
function isNonNegativeSafeInteger(value) {
|
|
191
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
|
|
192
|
+
}
|
|
193
|
+
function isIsoTimestamp(value) {
|
|
194
|
+
if (typeof value !== 'string')
|
|
195
|
+
return false;
|
|
196
|
+
const milliseconds = Date.parse(value);
|
|
197
|
+
return Number.isFinite(milliseconds) && new Date(milliseconds).toISOString() === value;
|
|
198
|
+
}
|
|
199
|
+
function compactTaskId(taskId) {
|
|
200
|
+
return summarizeTaskCommand(formatTaskId(taskId), TASK_ID_LABEL_LIMIT);
|
|
201
|
+
}
|
|
202
|
+
function hasExactKeys(value, expected) {
|
|
203
|
+
const keys = Reflect.ownKeys(value);
|
|
204
|
+
return keys.length === expected.length && expected.every((key) => Object.hasOwn(value, key));
|
|
205
|
+
}
|
|
206
|
+
function isRecord(value) {
|
|
207
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=background-tool-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-tool-presentation.js","sourceRoot":"","sources":["../../../src/tui/background-tool-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAQpG,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAC3E,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY,CAAU,CAAC;AAC5D,MAAM,aAAa,GAAG;IACpB,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY;IAC9D,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa;CACzC,CAAC;AACX,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EA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A2B;IAC/E,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The busy rows' live suffix: elapsed turn time and the session's reported token spend.
|
|
3
|
+
*
|
|
4
|
+
* A pure projection for the `working…` hint and the `thinking…` row (SER-022). It rides
|
|
5
|
+
* rows that already exist and are drawn as one `<Text wrap="truncate-end">` each, so it can
|
|
6
|
+
* never add a frame row or a wrap — which is why the suffix goes directly behind the busy
|
|
7
|
+
* word, ahead of the static command hints: on a narrow terminal the tail is what truncates,
|
|
8
|
+
* and the tail should be the part that never changes.
|
|
9
|
+
*
|
|
10
|
+
* Honesty follows the `usageBuckets` rule: an unknown metric (`input === undefined` on
|
|
11
|
+
* OpenAI Responses without cache detail) is absent from the suffix, never rendered as 0,
|
|
12
|
+
* while a genuinely zero accumulator renders `↑0 ↓0` — the same measured nothing `/usage`
|
|
13
|
+
* prints before the first turn. The numbers are whatever the meter has actually been told:
|
|
14
|
+
* the SDK accumulates a model call when it finishes, so mid-call the totals lag on purpose.
|
|
15
|
+
*/
|
|
16
|
+
import type { UsageBuckets } from '../agent/usage.js';
|
|
17
|
+
import { type RetryWaitState } from '../agent/model-retry.js';
|
|
18
|
+
/**
|
|
19
|
+
* Compact token count for a one-row readout: `318`, `1.2k`, `999.9k`, `2M`.
|
|
20
|
+
*
|
|
21
|
+
* Integer arithmetic throughout — `2900 / 1000 * 10` floors to 28 in floating point —
|
|
22
|
+
* and always floored, never rounded, so a count can never read as the next unit up.
|
|
23
|
+
* A negative or non-finite input degrades to `0` rather than `NaN` on screen.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatTokenCount(count: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* ` · 12s · ↑1.2k ↓318 tokens` — or less, when a metric is unknown — plus
|
|
28
|
+
* ` · throttled, retry 3/6 in 12s` while a model-retry wait is pending (SER-067).
|
|
29
|
+
*
|
|
30
|
+
* `spend === undefined` (the meter could not be read, or the row wants the reduced
|
|
31
|
+
* elapsed-only form) keeps just the duration; an undefined input bucket drops only the
|
|
32
|
+
* `↑` part. Output is always a number in {@link UsageBuckets}, so `↓` is always stated
|
|
33
|
+
* when spend is. The retry phrase is the runtime's published wait state read on the same
|
|
34
|
+
* tick (`retryWait()`), rendered through the one shared {@link describeRetryWait}; with no
|
|
35
|
+
* wait (`undefined`) the suffix is byte-identical to what it was before the phrase existed.
|
|
36
|
+
*/
|
|
37
|
+
export declare function busySuffix(elapsedMs: number, spend: UsageBuckets | undefined, retryWait?: RetryWaitState, nowMs?: number): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describeRetryWait } from '../agent/model-retry.js';
|
|
2
|
+
import { formatTaskDuration } from './task-format.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compact token count for a one-row readout: `318`, `1.2k`, `999.9k`, `2M`.
|
|
5
|
+
*
|
|
6
|
+
* Integer arithmetic throughout — `2900 / 1000 * 10` floors to 28 in floating point —
|
|
7
|
+
* and always floored, never rounded, so a count can never read as the next unit up.
|
|
8
|
+
* A negative or non-finite input degrades to `0` rather than `NaN` on screen.
|
|
9
|
+
*/
|
|
10
|
+
export function formatTokenCount(count) {
|
|
11
|
+
const safe = Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
|
|
12
|
+
if (safe < 1_000)
|
|
13
|
+
return String(safe);
|
|
14
|
+
const [unit, symbol] = safe < 1_000_000 ? [1_000, 'k'] : [1_000_000, 'M'];
|
|
15
|
+
const tenths = Math.floor((safe * 10) / unit);
|
|
16
|
+
const whole = Math.floor(tenths / 10);
|
|
17
|
+
const fraction = tenths % 10;
|
|
18
|
+
return fraction === 0 ? `${whole}${symbol}` : `${whole}.${fraction}${symbol}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* ` · 12s · ↑1.2k ↓318 tokens` — or less, when a metric is unknown — plus
|
|
22
|
+
* ` · throttled, retry 3/6 in 12s` while a model-retry wait is pending (SER-067).
|
|
23
|
+
*
|
|
24
|
+
* `spend === undefined` (the meter could not be read, or the row wants the reduced
|
|
25
|
+
* elapsed-only form) keeps just the duration; an undefined input bucket drops only the
|
|
26
|
+
* `↑` part. Output is always a number in {@link UsageBuckets}, so `↓` is always stated
|
|
27
|
+
* when spend is. The retry phrase is the runtime's published wait state read on the same
|
|
28
|
+
* tick (`retryWait()`), rendered through the one shared {@link describeRetryWait}; with no
|
|
29
|
+
* wait (`undefined`) the suffix is byte-identical to what it was before the phrase existed.
|
|
30
|
+
*/
|
|
31
|
+
export function busySuffix(elapsedMs, spend, retryWait, nowMs = Date.now()) {
|
|
32
|
+
const elapsed = ` · ${formatTaskDuration(elapsedMs)}`;
|
|
33
|
+
const retry = retryWait === undefined ? '' : ` · ${describeRetryWait(retryWait, nowMs)}`;
|
|
34
|
+
if (spend === undefined)
|
|
35
|
+
return `${elapsed}${retry}`;
|
|
36
|
+
const input = spend.input === undefined ? '' : `↑${formatTokenCount(spend.input)} `;
|
|
37
|
+
return `${elapsed} · ${input}↓${formatTokenCount(spend.output)} tokens${retry}`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=busy-suffix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"busy-suffix.js","sourceRoot":"","sources":["../../../src/tui/busy-suffix.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EA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,CAAC,MAAM,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;IACzF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,GAAG,OAAO,GAAG,KAAK,EAAE,CAAC;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;IACpF,OAAO,GAAG,OAAO,MAAM,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,KAAK,EAAE,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ImageBlock } from '@strands-agents/sdk';
|
|
2
|
+
export interface ClipboardCommand {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
readonly extension: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ClipboardImageOptions {
|
|
8
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
9
|
+
readonly platform?: NodeJS.Platform;
|
|
10
|
+
readonly timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const CLIPBOARD_IMAGE_TIMEOUT_MS = 5000;
|
|
13
|
+
/** Selects only helpers that can request an image MIME type without a shell. */
|
|
14
|
+
export declare function clipboardImageCommand(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): ClipboardCommand;
|
|
15
|
+
/** One bounded truthful composer fact; no clipboard payload or fabricated path. */
|
|
16
|
+
export declare function clipboardImageFact(image: ImageBlock): string;
|
|
17
|
+
/** Reads, bounds, and normalizes one clipboard image through imageViewer policy. */
|
|
18
|
+
export declare function readClipboardImage(options?: ClipboardImageOptions): Promise<ImageBlock>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** Bounded, dependency-free operating-system clipboard image acquisition. */
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { decodeImageBytes, MAX_SOURCE_BYTES } from '../tools/image-viewer.js';
|
|
4
|
+
export const CLIPBOARD_IMAGE_TIMEOUT_MS = 5_000;
|
|
5
|
+
/** Selects only helpers that can request an image MIME type without a shell. */
|
|
6
|
+
export function clipboardImageCommand(platform, env) {
|
|
7
|
+
if (platform === 'darwin') {
|
|
8
|
+
return { command: 'pngpaste', args: ['-'], extension: '.png' };
|
|
9
|
+
}
|
|
10
|
+
if (platform !== 'linux') {
|
|
11
|
+
throw new Error(`clipboard image input is not supported on ${platform}`);
|
|
12
|
+
}
|
|
13
|
+
if (env['WAYLAND_DISPLAY']) {
|
|
14
|
+
return { command: 'wl-paste', args: ['--no-newline', '--type', 'image/png'], extension: '.png' };
|
|
15
|
+
}
|
|
16
|
+
if (env['DISPLAY']) {
|
|
17
|
+
return {
|
|
18
|
+
command: 'xclip',
|
|
19
|
+
args: ['-selection', 'clipboard', '-t', 'image/png', '-o'],
|
|
20
|
+
extension: '.png',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
throw new Error('clipboard image input needs a Wayland DISPLAY, X11 DISPLAY, or macOS pngpaste');
|
|
24
|
+
}
|
|
25
|
+
/** One bounded truthful composer fact; no clipboard payload or fabricated path. */
|
|
26
|
+
export function clipboardImageFact(image) {
|
|
27
|
+
const bytes = image.source.type === 'imageSourceBytes' ? image.source.bytes.byteLength : 0;
|
|
28
|
+
const size = bytes < 1024 ? `${bytes} B` : `${Math.ceil(bytes / 1024)} KiB`;
|
|
29
|
+
return `image attached · ${image.format.toUpperCase()} · ${size} · Ctrl+O remove`;
|
|
30
|
+
}
|
|
31
|
+
/** Reads, bounds, and normalizes one clipboard image through imageViewer policy. */
|
|
32
|
+
export async function readClipboardImage(options = {}) {
|
|
33
|
+
const env = options.env ?? process.env;
|
|
34
|
+
const command = clipboardImageCommand(options.platform ?? process.platform, env);
|
|
35
|
+
const source = await readCommand(command, env, options.timeoutMs ?? CLIPBOARD_IMAGE_TIMEOUT_MS);
|
|
36
|
+
try {
|
|
37
|
+
return await decodeImageBytes(source, command.extension, 'clipboard image');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new Error(`clipboard image is invalid or unsupported: ${describe(error)}`, { cause: error });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function readCommand(selected, env, timeoutMs) {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const child = spawn(selected.command, [...selected.args], {
|
|
46
|
+
env,
|
|
47
|
+
shell: false,
|
|
48
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
49
|
+
});
|
|
50
|
+
const chunks = [];
|
|
51
|
+
let bytes = 0;
|
|
52
|
+
let stderr = '';
|
|
53
|
+
let settled = false;
|
|
54
|
+
const finish = (error) => {
|
|
55
|
+
if (settled)
|
|
56
|
+
return;
|
|
57
|
+
settled = true;
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
if (error !== undefined)
|
|
60
|
+
reject(error);
|
|
61
|
+
else
|
|
62
|
+
resolve(Buffer.concat(chunks, bytes));
|
|
63
|
+
};
|
|
64
|
+
const timer = setTimeout(() => {
|
|
65
|
+
child.kill('SIGTERM');
|
|
66
|
+
finish(new Error(`clipboard helper timed out after ${timeoutMs}ms`));
|
|
67
|
+
}, timeoutMs);
|
|
68
|
+
timer.unref();
|
|
69
|
+
child.on('error', (error) => {
|
|
70
|
+
const hint = error.code === 'ENOENT'
|
|
71
|
+
? `${selected.command} is not installed`
|
|
72
|
+
: describe(error);
|
|
73
|
+
finish(new Error(`clipboard helper failed: ${hint}`, { cause: error }));
|
|
74
|
+
});
|
|
75
|
+
child.stdout.on('data', (chunk) => {
|
|
76
|
+
if (settled)
|
|
77
|
+
return;
|
|
78
|
+
bytes += chunk.byteLength;
|
|
79
|
+
if (bytes > MAX_SOURCE_BYTES) {
|
|
80
|
+
child.kill('SIGTERM');
|
|
81
|
+
finish(new Error(`clipboard image exceeds the ${MAX_SOURCE_BYTES}-byte source limit`));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
chunks.push(chunk);
|
|
85
|
+
});
|
|
86
|
+
child.stderr.on('data', (chunk) => {
|
|
87
|
+
if (stderr.length < 512)
|
|
88
|
+
stderr += chunk.toString('utf8', 0, 512 - stderr.length);
|
|
89
|
+
});
|
|
90
|
+
child.on('close', (code, signal) => {
|
|
91
|
+
if (settled)
|
|
92
|
+
return;
|
|
93
|
+
if (code !== 0) {
|
|
94
|
+
const detail = stderr.trim().replace(/\s+/g, ' ').slice(0, 240);
|
|
95
|
+
finish(new Error(`clipboard helper exited ${signal ?? code ?? 'without a status'}${detail === '' ? '' : `: ${detail}`}`));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (bytes === 0) {
|
|
99
|
+
finish(new Error('clipboard contains no PNG image data'));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
finish();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function describe(error) {
|
|
107
|
+
return error instanceof Error ? error.message : String(error);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=clipboard-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-image.js","sourceRoot":"","sources":["../../../src/tui/clipboard-image.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAc9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAEhD,gFAAgF;AAChF,MAAM,UAAU,qBAAqB,CACnC,QAAyB,EACzB,GAAsB;IAEtB,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;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AAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACjC,IAAI,OAAO;gBAAE,OAAO;YACpB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;gBAChE,MAAM,CAAC,IAAI,KAAK,CACd,2BAA2B,MAAM,IAAI,IAAI,IAAI,kBAAkB,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,EAAE,CACvG,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBAChB,MAAM,CAAC,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;gBAC1D,OAAO;YACT,CAAC;YACD,MAAM,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure presentation for `/context`: how big the conversation has grown and how
|
|
3
|
+
* much of the model's window it occupies.
|
|
4
|
+
*
|
|
5
|
+
* Numbers are request-size estimates, not billing figures. When the runtime has a
|
|
6
|
+
* measurement anchor — the prompt-token total the provider reported for the most
|
|
7
|
+
* recent completed model call — the line says so and names the measured base plus
|
|
8
|
+
* the estimated tail, because "measured 126,900 + ~1,531 new" and "~128,431" are
|
|
9
|
+
* different claims and only one of them is what happened. Without an anchor the line
|
|
10
|
+
* is the pre-anchor wording, unchanged: a whole-request character heuristic.
|
|
11
|
+
* An unknown window is said out loud rather than silently guessed.
|
|
12
|
+
*/
|
|
13
|
+
import type { ContextEstimate } from '../agent/runtime.js';
|
|
14
|
+
/** One transcript line: tokens, window share, and message count. */
|
|
15
|
+
export declare function formatContextReport(estimate: ContextEstimate): string;
|
|
16
|
+
/**
|
|
17
|
+
* The value half of the report, without the label — shared with `/status` so the
|
|
18
|
+
* two commands cannot describe the same estimate differently (the `/export`
|
|
19
|
+
* reuses-`formatReplay` precedent, at line scale).
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatContextValue(estimate: ContextEstimate): string;
|
|
22
|
+
/**
|
|
23
|
+
* Integer percent, except that a nonzero share below 1% shows `<1%`: rounding a
|
|
24
|
+
* young conversation to `0%` would claim the context is empty when it is not.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatWindowShare(tokens: number, windowTokens: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* A stateful latch for the context-pressure notice: fires once when the
|
|
29
|
+
* estimated share crosses the existing configurable `warnRatio`, re-arms only
|
|
30
|
+
* after a known share drops below it again (e.g. after a successful user-run
|
|
31
|
+
* `/compact`). There is deliberately no second SRF-010 threshold: one pressure
|
|
32
|
+
* event gets one notice, and `contextWarnRatio: 0` remains the compatibility
|
|
33
|
+
* switch that disables it.
|
|
34
|
+
*
|
|
35
|
+
* Returned as a plain object so the caller (App.tsx) can hold it in a ref:
|
|
36
|
+
* the latch must not reset between renders, and it must never fire when
|
|
37
|
+
* `warnRatio` is 0 or the window is unknown.
|
|
38
|
+
*/
|
|
39
|
+
export interface ContextWarnLatch {
|
|
40
|
+
/** Returns a notice string when the threshold is newly crossed, or null. */
|
|
41
|
+
check(estimate: ContextEstimate, warnRatio: number): string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare function createContextWarnLatch(): ContextWarnLatch;
|