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,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trajectory record format: what one line of `trajectory.jsonl` is, and how an
|
|
3
|
+
* SDK stream event becomes one.
|
|
4
|
+
*
|
|
5
|
+
* Everything here is pure and synchronous. The writer must be able to format a
|
|
6
|
+
* record between two stream events without awaiting anything, and every reader —
|
|
7
|
+
* search, replay, the CLI — has to be able to parse a line without constructing a
|
|
8
|
+
* model or an agent. See `docs/architecture/load-bearing-decisions.md` § Session trajectory.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentStreamEvent } from '@strands-agents/sdk';
|
|
11
|
+
/** Bumped only for a change a reader cannot tolerate; readers keep older versions readable. */
|
|
12
|
+
export declare const SCHEMA_VERSION = 1;
|
|
13
|
+
/**
|
|
14
|
+
* Cap on any single string inside a record, in code points.
|
|
15
|
+
*
|
|
16
|
+
* Sized so a long assistant answer (~2k tokens) survives whole while a
|
|
17
|
+
* whole-file `fileEditor view` result or a 100k-line log does not. Code points
|
|
18
|
+
* rather than bytes, matching `headlessField`: slicing UTF-8 by byte length
|
|
19
|
+
* replaces a trailing multi-byte sequence with U+FFFD (a byte-slice truncation
|
|
20
|
+
* mistake this project made once and must not repeat).
|
|
21
|
+
*/
|
|
22
|
+
export declare const MAX_FIELD_CHARS = 8000;
|
|
23
|
+
/**
|
|
24
|
+
* Cap on one serialized record, in bytes — the same 64 KiB bound the background
|
|
25
|
+
* `bash output` mode already uses. A record still over it after field capping
|
|
26
|
+
* keeps its envelope and loses its payload, because a line nothing can parse is
|
|
27
|
+
* worse than a line that says it was dropped.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MAX_RECORD_BYTES: number;
|
|
30
|
+
/**
|
|
31
|
+
* Cap on one session's record file, in bytes.
|
|
32
|
+
*
|
|
33
|
+
* Nothing in darwin garbage-collects session state (see `contextOffload` in
|
|
34
|
+
* `src/config.ts`), so a per-conversation hard bound is the only real disk bound.
|
|
35
|
+
* Recording stops at this point rather than rotating: rotation would either
|
|
36
|
+
* rewrite bytes or scatter one conversation over several files, and both cost
|
|
37
|
+
* more than they save for an observational record.
|
|
38
|
+
*/
|
|
39
|
+
export declare const MAX_FILE_BYTES: number;
|
|
40
|
+
/** Marks a string the caps shortened, so "all there was" and "cut" stay distinguishable. */
|
|
41
|
+
export interface Truncation {
|
|
42
|
+
/** Dotted path inside the record payload, e.g. `toolUse.input.command`. */
|
|
43
|
+
path: string;
|
|
44
|
+
/** Code points the original held. */
|
|
45
|
+
chars: number;
|
|
46
|
+
/** Code points retained. */
|
|
47
|
+
kept: number;
|
|
48
|
+
}
|
|
49
|
+
/** SDK event types the record retains. Everything else is counted, not stored. */
|
|
50
|
+
export declare const RECORDED_EVENT_TYPES: readonly ['contentBlockEvent', 'beforeToolCallEvent', 'afterToolCallEvent', 'agentResultEvent'];
|
|
51
|
+
export type RecordedEventType = (typeof RECORDED_EVENT_TYPES)[number];
|
|
52
|
+
export declare function isRecordedEventType(type: string): type is RecordedEventType;
|
|
53
|
+
export type TrajectoryRecordType = 'runStarted' | 'userInput' | 'turnEnded' | 'modelCall' | 'forkedFrom' | 'recordingStopped' | 'shellCommand' | RecordedEventType;
|
|
54
|
+
/** Fields every record carries, whatever its type. */
|
|
55
|
+
export interface RecordEnvelope {
|
|
56
|
+
/** {@link SCHEMA_VERSION} at write time. */
|
|
57
|
+
v: number;
|
|
58
|
+
/** Monotonic within the file, continuing across runs so a gap means real loss. */
|
|
59
|
+
seq: number;
|
|
60
|
+
/** ISO 8601 time the event was observed, not the time its batch was appended. */
|
|
61
|
+
t: string;
|
|
62
|
+
/** 1-based turn ordinal within this file. `0` for records outside a turn. */
|
|
63
|
+
turn: number;
|
|
64
|
+
type: TrajectoryRecordType;
|
|
65
|
+
/** Present only when a cap shortened something. */
|
|
66
|
+
trunc?: Truncation[];
|
|
67
|
+
}
|
|
68
|
+
export interface RunStartedRecord extends RecordEnvelope {
|
|
69
|
+
type: 'runStarted';
|
|
70
|
+
session: string;
|
|
71
|
+
agentId: string;
|
|
72
|
+
darwinVersion: string;
|
|
73
|
+
provider: string;
|
|
74
|
+
model: string;
|
|
75
|
+
permissionMode: string;
|
|
76
|
+
thinkingEffort: string | undefined;
|
|
77
|
+
resumed: boolean;
|
|
78
|
+
restoredMessages: number;
|
|
79
|
+
pid: number;
|
|
80
|
+
}
|
|
81
|
+
export interface UserInputRecord extends RecordEnvelope {
|
|
82
|
+
type: 'userInput';
|
|
83
|
+
/** Exactly what was handed to `agent.stream()`, so a slash command appears expanded. */
|
|
84
|
+
text: string;
|
|
85
|
+
}
|
|
86
|
+
export interface EventRecord extends RecordEnvelope {
|
|
87
|
+
type: RecordedEventType;
|
|
88
|
+
/** The SDK event's own `toJSON()` projection, capped. */
|
|
89
|
+
data: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What the turn's stream threw, as far as an observer can honestly say.
|
|
93
|
+
*
|
|
94
|
+
* `name` is the error's class, `message` its text — the two things that identify a
|
|
95
|
+
* provider failure without carrying a stack trace (which names local paths and is
|
|
96
|
+
* not what the record is for). All fields are capped like any other string field.
|
|
97
|
+
*/
|
|
98
|
+
export interface TurnFailure {
|
|
99
|
+
name: string;
|
|
100
|
+
message: string;
|
|
101
|
+
/**
|
|
102
|
+
* The wrapped error's class, when the thrown error wraps another.
|
|
103
|
+
*
|
|
104
|
+
* Not decoration: measured on `@strands-agents/sdk@1.12.0`, `Model.streamAggregated`
|
|
105
|
+
* catches anything that is not already a `ModelError` and rethrows
|
|
106
|
+
* `new ModelError(normalized.message, { cause: original })`. So a real Bedrock
|
|
107
|
+
* rejection reaches the caller as `ModelError` with the provider's *message* intact
|
|
108
|
+
* and its *class* only on `cause` — without this field every provider failure in the
|
|
109
|
+
* file would read `ModelError` and nothing would distinguish a throttle from an
|
|
110
|
+
* expired token. The cause's message is deliberately not stored: the wrapper copied
|
|
111
|
+
* it, so the class is the only fact wrapping loses.
|
|
112
|
+
*/
|
|
113
|
+
cause?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* What one turn cost, in the mutually exclusive buckets `src/agent/usage.ts` defines.
|
|
117
|
+
*
|
|
118
|
+
* Named `spend` rather than `usage` on purpose: a recorded `agentResultEvent` already
|
|
119
|
+
* carries `result.lastMessage.metadata.usage` — the provider's counters for the
|
|
120
|
+
* **final model call** of the turn, because `Message.toJSON()` keeps `metadata` while
|
|
121
|
+
* `AgentResult.toJSON()` drops `metrics`. That number is not this one: it covers one
|
|
122
|
+
* call, not the turn, and a failed or cancelled turn (which emits no
|
|
123
|
+
* `agentResultEvent`) has none at all. Two different things called `usage` in one file
|
|
124
|
+
* would be worse than no name.
|
|
125
|
+
*
|
|
126
|
+
* Every field is the *delta over one turn* of the SDK meter's lifetime accumulator,
|
|
127
|
+
* projected through `usageBuckets`, so the numbers mean exactly what the headless
|
|
128
|
+
* `usage:` line means and the two can be compared field for field.
|
|
129
|
+
*
|
|
130
|
+
* An unreported metric is an **absent key**, never `0`: "the provider did not report
|
|
131
|
+
* this" and "this was zero" are different facts, and OpenAI Responses genuinely cannot
|
|
132
|
+
* split uncached input when either cache subset is missing. `input`/`output` are always
|
|
133
|
+
* reported by every provider the SDK supports, so a `0` there is a measurement — the
|
|
134
|
+
* turn's model calls billed nothing, which is what a turn that failed before its first
|
|
135
|
+
* call completed really did.
|
|
136
|
+
*/
|
|
137
|
+
export interface TurnSpend {
|
|
138
|
+
/** Provider that incurred it — the same string `runStarted.provider` carries. */
|
|
139
|
+
provider: string;
|
|
140
|
+
/** Model id that incurred it. Attribution lives on the same line as the numbers. */
|
|
141
|
+
model: string;
|
|
142
|
+
/** Uncached input. Absent when a provider-native total cannot be split without guessing. */
|
|
143
|
+
input?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Output tokens. Always written by darwin — every provider the SDK supports reports
|
|
146
|
+
* them — and optional only so that a damaged or foreign record missing the key reads
|
|
147
|
+
* as unknown rather than as a free turn.
|
|
148
|
+
*/
|
|
149
|
+
output?: number;
|
|
150
|
+
/** Absent until the provider reports it. */
|
|
151
|
+
cacheRead?: number;
|
|
152
|
+
/** Absent until the provider reports it. */
|
|
153
|
+
cacheWrite?: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Reads the live token meter for the turn being recorded.
|
|
157
|
+
*
|
|
158
|
+
* Injected into `TrajectoryRecorder.beginTurn` by `AgentRuntime.send` — the one layer
|
|
159
|
+
* that knows both the SDK meter and the live model config — for the same reason the
|
|
160
|
+
* permission gate takes a `dispatchSource` resolver: an observer must not learn about
|
|
161
|
+
* the agent. It keeps `src/trajectory/**` free of any `Agent`/`Model` import, which is
|
|
162
|
+
* what makes "the read paths call no model" structural rather than a promise.
|
|
163
|
+
*
|
|
164
|
+
* `read()` is called synchronously while the closing record is composed, must not
|
|
165
|
+
* throw, and returns `undefined` when the meter could not be read — which is recorded
|
|
166
|
+
* as *nothing*, and reads back as unknown.
|
|
167
|
+
*/
|
|
168
|
+
export interface TurnSpendMeter {
|
|
169
|
+
read(): TurnSpend | undefined;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Projects one completed model call's provider counters into {@link TurnSpend}.
|
|
173
|
+
*
|
|
174
|
+
* Injected into `TrajectoryRecorder.beginTurn` by `AgentRuntime.send`, beside the
|
|
175
|
+
* turn's {@link TurnSpendMeter} and for the same reason: the projection needs the
|
|
176
|
+
* live provider/model config, which `src/trajectory/**` must never import — the
|
|
177
|
+
* structural no-model-import property of every read path depends on it. The usage
|
|
178
|
+
* parameter is typed structurally (the SDK `Usage` shape) so this file needs no SDK
|
|
179
|
+
* type either.
|
|
180
|
+
*
|
|
181
|
+
* `project()` is called synchronously while a call's record is composed, must not
|
|
182
|
+
* throw, and returns `undefined` when the counters cannot be projected — recorded
|
|
183
|
+
* as *nothing*, which reads back as unknown.
|
|
184
|
+
*/
|
|
185
|
+
export interface CallSpendProjector {
|
|
186
|
+
project(usage: {
|
|
187
|
+
inputTokens: number;
|
|
188
|
+
outputTokens: number;
|
|
189
|
+
cacheReadInputTokens?: number;
|
|
190
|
+
cacheWriteInputTokens?: number;
|
|
191
|
+
}): TurnSpend | undefined;
|
|
192
|
+
}
|
|
193
|
+
export interface TurnEndedRecord extends RecordEnvelope {
|
|
194
|
+
type: 'turnEnded';
|
|
195
|
+
stopReason: string | undefined;
|
|
196
|
+
ms: number;
|
|
197
|
+
/** Recorded event counts by SDK type. */
|
|
198
|
+
recorded: Record<string, number>;
|
|
199
|
+
/** Events the allowlist dropped, counted by SDK type, so the loss is visible. */
|
|
200
|
+
dropped: Record<string, number>;
|
|
201
|
+
/** Assistant text that never reached an assembled block (a cancelled turn). */
|
|
202
|
+
partialText?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Present only when the turn's stream threw: what reached the caller of
|
|
205
|
+
* `AgentRuntime.send`.
|
|
206
|
+
*
|
|
207
|
+
* Optional and additive on purpose. A thrown turn never emits `agentResultEvent`,
|
|
208
|
+
* so `stopReason` is `undefined` for it and always will be — inventing a
|
|
209
|
+
* `'failed'` stop reason would put a value no provider produced into a field whose
|
|
210
|
+
* contract is the SDK's own. The presence of this field is what makes a failed turn
|
|
211
|
+
* a failed turn; see {@link turnOutcome}.
|
|
212
|
+
*/
|
|
213
|
+
failure?: TurnFailure;
|
|
214
|
+
/**
|
|
215
|
+
* Present when the meter could be read for this turn: what the turn cost.
|
|
216
|
+
*
|
|
217
|
+
* Optional and additive, like {@link failure}: a record written before this field
|
|
218
|
+
* existed, a session recorded with the meter unreadable, and a turn nothing metered
|
|
219
|
+
* are all *unknown*, and no reader may turn that into a zero-cost turn. A failed turn
|
|
220
|
+
* carries this **and** `failure`, because the tokens were billed either way.
|
|
221
|
+
*/
|
|
222
|
+
spend?: TurnSpend;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* One completed model call within a turn (issue #8 follow-up A), written when the
|
|
226
|
+
* observed `afterModelCallEvent` carries `stopData` — a failed attempt writes
|
|
227
|
+
* nothing, and stays visible through `attempt` gaps and `turnEnded.failure`.
|
|
228
|
+
*
|
|
229
|
+
* This is the turn-scoped `spend` field at call granularity, and it exists for the
|
|
230
|
+
* same reason: the raw `afterModelCallEvent` is dropped by the allowlist (and stays
|
|
231
|
+
* dropped — this bounded projection does not change `turnEnded.dropped`), so without
|
|
232
|
+
* it no reader could say *which* call of a multi-cycle turn grew the context or
|
|
233
|
+
* burned the cache. Additive under schema v1: readers ignore unknown types.
|
|
234
|
+
*/
|
|
235
|
+
export interface ModelCallRecord extends RecordEnvelope {
|
|
236
|
+
type: 'modelCall';
|
|
237
|
+
/** The SDK's 1-indexed attempt count for this cycle; a gap means a failed retry. */
|
|
238
|
+
attempt: number;
|
|
239
|
+
/** Milliseconds since the turn started, so a reader can line calls up against tool records. */
|
|
240
|
+
ms: number;
|
|
241
|
+
/** The SDK stop reason for this call, when reported. */
|
|
242
|
+
stopReason?: string;
|
|
243
|
+
/**
|
|
244
|
+
* The last `beforeModelCallEvent.projectedInputTokens` seen this turn — the agent
|
|
245
|
+
* loop's request-size estimate for this call. Absent when never reported; never 0.
|
|
246
|
+
*/
|
|
247
|
+
contextTokens?: number;
|
|
248
|
+
/**
|
|
249
|
+
* This one call's own counters in the {@link TurnSpend} bucket vocabulary, so a
|
|
250
|
+
* call line and a `turnEnded.spend` line are comparable field for field. Absent
|
|
251
|
+
* when the provider reported no usage for the call — never zeros.
|
|
252
|
+
*/
|
|
253
|
+
spend?: TurnSpend;
|
|
254
|
+
}
|
|
255
|
+
export interface ForkedFromRecord extends RecordEnvelope {
|
|
256
|
+
type: 'forkedFrom';
|
|
257
|
+
session: string;
|
|
258
|
+
/** Last sequence number copied from the source (the envelope's `seq` is this record's own). */
|
|
259
|
+
sourceSeq: number;
|
|
260
|
+
/** Bytes copied from the source record. */
|
|
261
|
+
bytes: number;
|
|
262
|
+
}
|
|
263
|
+
export interface RecordingStoppedRecord extends RecordEnvelope {
|
|
264
|
+
type: 'recordingStopped';
|
|
265
|
+
reason: 'budget' | 'error';
|
|
266
|
+
detail?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* A user-typed `!` command (SER-024), run directly by the TUI — never a model tool
|
|
270
|
+
* call, so it has no `beforeToolCallEvent`/`afterToolCallEvent` pair to ride on.
|
|
271
|
+
*
|
|
272
|
+
* Deliberately **not** a `userInput` record: nothing was handed to
|
|
273
|
+
* `agent.stream()`, and `userInput` is the one line prompt recall reads — a `!`
|
|
274
|
+
* command is a session action, not a prompt, and is not offered back. The
|
|
275
|
+
* envelope's `turn` is the last *closed* turn's ordinal (like
|
|
276
|
+
* `recordingStopped`), because the command ran between turns.
|
|
277
|
+
*
|
|
278
|
+
* `output` is the already-bounded SER-009 projection the screen showed, marker
|
|
279
|
+
* included — the record repeats what was shown, it does not re-derive it.
|
|
280
|
+
*/
|
|
281
|
+
export interface ShellCommandRecord extends RecordEnvelope {
|
|
282
|
+
type: 'shellCommand';
|
|
283
|
+
command: string;
|
|
284
|
+
/** Process exit code; `null` when it died to a signal or never spawned. */
|
|
285
|
+
exitCode: number | null;
|
|
286
|
+
/** Signal that ended it, `null` for a plain exit. */
|
|
287
|
+
signal: string | null;
|
|
288
|
+
/** True when the TUI's hard timeout killed it. */
|
|
289
|
+
timedOut: boolean;
|
|
290
|
+
durationMs: number;
|
|
291
|
+
output: string;
|
|
292
|
+
}
|
|
293
|
+
export type TrajectoryRecord = RunStartedRecord | UserInputRecord | EventRecord | TurnEndedRecord | ModelCallRecord | ForkedFromRecord | RecordingStoppedRecord | ShellCommandRecord;
|
|
294
|
+
/**
|
|
295
|
+
* A thrown value as the fields the record keeps.
|
|
296
|
+
*
|
|
297
|
+
* The class is read from the prototype rather than from `error.name`, because the
|
|
298
|
+
* two disagree exactly where it matters: every SDK error class sets `name` to its
|
|
299
|
+
* own class name (measured on `@strands-agents/sdk@1.12.0`, `dist/src/errors.js`),
|
|
300
|
+
* but nothing forces a provider or a future subclass to, and then `name` degrades to
|
|
301
|
+
* the useless `'Error'` while the constructor still knows what was thrown. When both
|
|
302
|
+
* are present and differ, the class wins and `name` is appended, because they are
|
|
303
|
+
* two different facts and a record that silently picked one would hide the other.
|
|
304
|
+
*
|
|
305
|
+
* A non-`Error` throw is described by its type rather than pretended to be an error:
|
|
306
|
+
* `String(value)` is the only honest message available.
|
|
307
|
+
*/
|
|
308
|
+
export declare function failureFromError(error: unknown): TurnFailure;
|
|
309
|
+
/**
|
|
310
|
+
* The SDK event's own JSON projection, capped.
|
|
311
|
+
*
|
|
312
|
+
* `JSON.stringify` is used deliberately rather than reading fields off the event:
|
|
313
|
+
* every stream event class declares a `toJSON()` that excludes `agent` and
|
|
314
|
+
* `invocationState` (measured on `@strands-agents/sdk@1.12.0`), so this is the one
|
|
315
|
+
* projection that cannot drag the live agent, its whole message list, or arbitrary
|
|
316
|
+
* per-invocation objects into the file. A hand-rolled copy would have to be
|
|
317
|
+
* re-audited on every SDK upgrade.
|
|
318
|
+
*
|
|
319
|
+
* Reasoning is reduced to its presence here, not by the caps: the reply is the
|
|
320
|
+
* record, the model's private deliberation is not.
|
|
321
|
+
*/
|
|
322
|
+
export declare function projectEvent(event: AgentStreamEvent): {
|
|
323
|
+
data: Record<string, unknown>;
|
|
324
|
+
trunc: Truncation[];
|
|
325
|
+
};
|
|
326
|
+
/** Caps one plain string field (user input, partial assistant text). */
|
|
327
|
+
export declare function capField(value: string, path: string): {
|
|
328
|
+
value: string;
|
|
329
|
+
trunc: Truncation[];
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* One record as the line that will be appended, newline included.
|
|
333
|
+
*
|
|
334
|
+
* A record that is still oversized after field capping keeps its envelope and
|
|
335
|
+
* loses its payload: the alternative is a line no reader can parse, which would
|
|
336
|
+
* also break `seq` continuation for every later run.
|
|
337
|
+
*/
|
|
338
|
+
export declare function encodeRecord(record: TrajectoryRecord): string;
|
|
339
|
+
/**
|
|
340
|
+
* Parses one line, or `undefined` when it is not a usable record.
|
|
341
|
+
*
|
|
342
|
+
* Deliberately forgiving about *unknown* types and extra fields (a newer darwin's
|
|
343
|
+
* file must stay readable) and strict about the envelope: without `type` and `seq`
|
|
344
|
+
* a line cannot be ordered or interpreted, so it counts as damage.
|
|
345
|
+
*/
|
|
346
|
+
export declare function parseRecordLine(line: string): TrajectoryRecord | undefined;
|
|
347
|
+
/** The text a record contributes to search, in the order a reader would read it. */
|
|
348
|
+
export declare function searchableText(record: TrajectoryRecord): string[];
|
|
349
|
+
/** How a `turnEnded` record reads on its own, with no other line of the file. */
|
|
350
|
+
export type TurnOutcome = 'clean' | 'cancelled' | 'failed' | 'abandoned';
|
|
351
|
+
/**
|
|
352
|
+
* The one shared reading of how a turn ended, so `list`, `replay` and the tests
|
|
353
|
+
* cannot drift into three different answers.
|
|
354
|
+
*
|
|
355
|
+
* `abandoned` is the honest name for the pre-existing fourth case: the consumer
|
|
356
|
+
* stopped reading before a result arrived (an early `break`, or a for-await body that
|
|
357
|
+
* threw, which JavaScript delivers to the generator as a `return` completion rather
|
|
358
|
+
* than as the turn failing). It is no longer conflated with a failure.
|
|
359
|
+
*/
|
|
360
|
+
export declare function turnOutcome(record: TurnEndedRecord): TurnOutcome;
|
|
361
|
+
/**
|
|
362
|
+
* A record's failure as a reader can trust it.
|
|
363
|
+
*
|
|
364
|
+
* Defensive about the payload rather than about the envelope, matching
|
|
365
|
+
* {@link parseRecordLine}: the line may come from an older darwin that never wrote
|
|
366
|
+
* the field, a newer one that writes more, or an interrupted write. A half-present
|
|
367
|
+
* failure is still reported as a failure — dropping it would hide the very thing the
|
|
368
|
+
* field exists to say.
|
|
369
|
+
*/
|
|
370
|
+
export declare function turnFailureOf(record: TurnEndedRecord): TurnFailure | undefined;
|
|
371
|
+
/**
|
|
372
|
+
* A turn's spend as a reader can trust it.
|
|
373
|
+
*
|
|
374
|
+
* Defensive about the payload for the same reasons {@link turnFailureOf} is: the line
|
|
375
|
+
* may come from an older darwin that never wrote the field, a newer one that writes
|
|
376
|
+
* more, or an interrupted write. The rule that matters is that a value which is not a
|
|
377
|
+
* finite number is **unknown**, never `0` — a report that turned a missing counter into
|
|
378
|
+
* a zero would claim a session was cheap when nobody measured it. A `spend` with no
|
|
379
|
+
* usable numbers at all is `undefined`, so "unknown" has exactly one representation.
|
|
380
|
+
*/
|
|
381
|
+
export declare function turnSpendOf(record: TurnEndedRecord): TurnSpend | undefined;
|
|
382
|
+
/** A {@link ModelCallRecord} as readers consume it, numbers validated. */
|
|
383
|
+
export interface ModelCallReading {
|
|
384
|
+
turn: number;
|
|
385
|
+
attempt: number;
|
|
386
|
+
ms: number;
|
|
387
|
+
stopReason?: string;
|
|
388
|
+
contextTokens?: number;
|
|
389
|
+
spend?: TurnSpend;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* A record's model-call payload as a reader can trust it, defensive on
|
|
393
|
+
* {@link turnSpendOf}'s terms: the line may come from a newer darwin that writes
|
|
394
|
+
* more, or an interrupted write. A value that is not a finite number is **unknown**
|
|
395
|
+
* — `attempt`/`ms` degrade to 0 (an honest "not usable" for ordinals a report only
|
|
396
|
+
* prints), and the optional fields to absence, never to an invented 0.
|
|
397
|
+
*/
|
|
398
|
+
export declare function modelCallOf(record: ModelCallRecord): ModelCallReading;
|
|
399
|
+
/**
|
|
400
|
+
* Cap on one rendered failure summary, in code points.
|
|
401
|
+
*
|
|
402
|
+
* Small on purpose: this is the bound for a *summary* line, where a whole session is
|
|
403
|
+
* one line. The full message — itself capped at {@link MAX_FIELD_CHARS} — stays in
|
|
404
|
+
* the record and is what `replay` prints.
|
|
405
|
+
*/
|
|
406
|
+
export declare const MAX_FAILURE_SUMMARY_CHARS = 120;
|
|
407
|
+
/** The failure as one unbounded line: what search matches against. */
|
|
408
|
+
export declare function failureLine(failure: TurnFailure): string;
|
|
409
|
+
/**
|
|
410
|
+
* {@link failureLine} on one line, bounded — for summary rows.
|
|
411
|
+
*
|
|
412
|
+
* The bound covers the whole rendered line, not the message alone, because the class
|
|
413
|
+
* name is provider-controlled too: an 8,000 code-point name would otherwise blow the
|
|
414
|
+
* row just as easily as a long message. Newlines are collapsed because a provider
|
|
415
|
+
* message with embedded newlines would turn one summary row into several.
|
|
416
|
+
*/
|
|
417
|
+
export declare function formatTurnFailure(failure: TurnFailure, limit?: number): string;
|