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,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Locates the trajectory file of the darwin session that is running right now in
|
|
4
|
+
* this project, so the self-reflection skill can hand its child an exact subject.
|
|
5
|
+
*
|
|
6
|
+
* Read-only by construction: the script opens files, writes nothing, and never
|
|
7
|
+
* touches the resume pointer. Selection is "newest trajectory.jsonl by mtime"
|
|
8
|
+
* because the Host's own prompt was appended to its record synchronously at send
|
|
9
|
+
* time — run this BEFORE launching any child, and the newest record is the Host's.
|
|
10
|
+
* The printed `last-user-input:` preview exists so the caller can verify that
|
|
11
|
+
* instead of trusting the heuristic. The latest valid `turnEnded` in the same
|
|
12
|
+
* read is the inclusive subject cutoff, so a later open reflection turn is never
|
|
13
|
+
* handed to the child.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* node locate-trajectory.mjs [--project <root>] [--session <id>]
|
|
17
|
+
*
|
|
18
|
+
* `--session` pins an explicit session and refuses a missing one rather than
|
|
19
|
+
* falling back; `--project` defaults to the current working directory.
|
|
20
|
+
*/
|
|
21
|
+
import { createHash } from 'node:crypto';
|
|
22
|
+
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
|
23
|
+
import os from 'node:os';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
import process from 'node:process';
|
|
26
|
+
|
|
27
|
+
const TRAJECTORY_FILENAME = 'trajectory.jsonl';
|
|
28
|
+
const PREVIEW_CODE_POINTS = 160;
|
|
29
|
+
|
|
30
|
+
/** Mirrors `projectKey` in `src/paths.ts`; keep the two in step. */
|
|
31
|
+
function projectKey(projectRoot) {
|
|
32
|
+
let canonical;
|
|
33
|
+
try {
|
|
34
|
+
canonical = realpathSync.native(projectRoot);
|
|
35
|
+
} catch {
|
|
36
|
+
canonical = path.resolve(projectRoot);
|
|
37
|
+
}
|
|
38
|
+
const readable = canonical.replace(/[^a-zA-Z0-9_-]/g, '-').slice(0, 180) || 'project';
|
|
39
|
+
const digest = createHash('sha256').update(canonical).digest('hex');
|
|
40
|
+
return `${readable}--${digest}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function fail(message) {
|
|
44
|
+
console.error(`locate-trajectory: ${message}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function parseArgs(argv) {
|
|
49
|
+
const args = { project: process.cwd(), session: undefined };
|
|
50
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
51
|
+
if (argv[i] === '--project' && argv[i + 1] !== undefined) {
|
|
52
|
+
args.project = argv[(i += 1)];
|
|
53
|
+
} else if (argv[i] === '--session' && argv[i + 1] !== undefined) {
|
|
54
|
+
args.session = argv[(i += 1)];
|
|
55
|
+
} else {
|
|
56
|
+
fail(`unknown or incomplete argument ${JSON.stringify(argv[i])}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return args;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Read-only subject facts from complete, valid JSONL records. */
|
|
63
|
+
function inspectTrajectory(trajectoryFile) {
|
|
64
|
+
let raw;
|
|
65
|
+
try {
|
|
66
|
+
raw = readFileSync(trajectoryFile, 'utf8');
|
|
67
|
+
} catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let lastUserInput;
|
|
72
|
+
let closedThrough;
|
|
73
|
+
for (const line of raw.split('\n')) {
|
|
74
|
+
let record;
|
|
75
|
+
try {
|
|
76
|
+
record = JSON.parse(line);
|
|
77
|
+
} catch {
|
|
78
|
+
// A half-written or corrupt line is tolerated, never repaired.
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (record === null || typeof record !== 'object' || Array.isArray(record)) continue;
|
|
82
|
+
if (
|
|
83
|
+
record.type === 'userInput' &&
|
|
84
|
+
typeof record.text === 'string' &&
|
|
85
|
+
Number.isInteger(record.seq) &&
|
|
86
|
+
Number.isInteger(record.turn)
|
|
87
|
+
) {
|
|
88
|
+
lastUserInput = record;
|
|
89
|
+
}
|
|
90
|
+
if (
|
|
91
|
+
record.type === 'turnEnded' &&
|
|
92
|
+
Number.isInteger(record.seq) &&
|
|
93
|
+
record.seq >= 0 &&
|
|
94
|
+
Number.isInteger(record.turn) &&
|
|
95
|
+
record.turn >= 1 &&
|
|
96
|
+
(closedThrough === undefined || record.seq > closedThrough.seq)
|
|
97
|
+
) {
|
|
98
|
+
closedThrough = { seq: record.seq, turn: record.turn };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let preview;
|
|
103
|
+
if (lastUserInput !== undefined) {
|
|
104
|
+
const flat = lastUserInput.text.replace(/\s+/g, ' ').trim();
|
|
105
|
+
const points = [...flat];
|
|
106
|
+
preview = points.length > PREVIEW_CODE_POINTS
|
|
107
|
+
? `${points.slice(0, PREVIEW_CODE_POINTS).join('')}…`
|
|
108
|
+
: flat;
|
|
109
|
+
}
|
|
110
|
+
return { preview, closedThrough };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const args = parseArgs(process.argv.slice(2));
|
|
114
|
+
const sessionsDir = path.join(os.homedir(), '.darwin', 'sessions', projectKey(args.project));
|
|
115
|
+
|
|
116
|
+
let entries;
|
|
117
|
+
try {
|
|
118
|
+
entries = readdirSync(sessionsDir, { withFileTypes: true });
|
|
119
|
+
} catch {
|
|
120
|
+
fail(`no session state for this project at ${sessionsDir} — nothing to reflect on`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const candidates = [];
|
|
124
|
+
for (const entry of entries) {
|
|
125
|
+
if (!entry.isDirectory() || entry.name === 'session') continue;
|
|
126
|
+
if (!/^[a-z0-9_-]+$/.test(entry.name)) continue;
|
|
127
|
+
const trajectoryFile = path.join(sessionsDir, entry.name, TRAJECTORY_FILENAME);
|
|
128
|
+
if (!existsSync(trajectoryFile)) continue;
|
|
129
|
+
candidates.push({
|
|
130
|
+
session: entry.name,
|
|
131
|
+
trajectoryFile,
|
|
132
|
+
mtime: statSync(trajectoryFile).mtime,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (candidates.length === 0) {
|
|
137
|
+
fail(`no trajectory.jsonl under ${sessionsDir} — recording may be off (trajectory: false)`);
|
|
138
|
+
}
|
|
139
|
+
candidates.sort((left, right) => right.mtime.getTime() - left.mtime.getTime());
|
|
140
|
+
|
|
141
|
+
let selected;
|
|
142
|
+
let selectedBy;
|
|
143
|
+
if (args.session !== undefined) {
|
|
144
|
+
selected = candidates.find((candidate) => candidate.session === args.session);
|
|
145
|
+
if (selected === undefined) {
|
|
146
|
+
fail(`session ${JSON.stringify(args.session)} has no trajectory in ${sessionsDir}`);
|
|
147
|
+
}
|
|
148
|
+
selectedBy = 'explicit --session';
|
|
149
|
+
} else {
|
|
150
|
+
[selected] = candidates;
|
|
151
|
+
selectedBy = 'newest trajectory mtime';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const inspection = inspectTrajectory(selected.trajectoryFile);
|
|
155
|
+
if (inspection === undefined) {
|
|
156
|
+
fail(`cannot read selected trajectory ${selected.trajectoryFile}`);
|
|
157
|
+
}
|
|
158
|
+
if (inspection.closedThrough === undefined) {
|
|
159
|
+
fail(`session ${JSON.stringify(selected.session)} has no closed turn — nothing to reflect on`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
console.log(`project-root: ${args.project}`);
|
|
163
|
+
console.log(`sessions-dir: ${sessionsDir}`);
|
|
164
|
+
console.log(`session: ${selected.session}`);
|
|
165
|
+
console.log(`trajectory: ${selected.trajectoryFile}`);
|
|
166
|
+
console.log(`selected-by: ${selectedBy}`);
|
|
167
|
+
console.log(`trajectory-mtime: ${selected.mtime.toISOString()}`);
|
|
168
|
+
console.log(`last-user-input: ${inspection.preview ?? '(none recorded)'}`);
|
|
169
|
+
console.log(`closed-through-turn: ${inspection.closedThrough.turn}`);
|
|
170
|
+
console.log(`closed-through-seq: ${inspection.closedThrough.seq}`);
|
|
171
|
+
const others = candidates.filter((candidate) => candidate !== selected).slice(0, 5);
|
|
172
|
+
console.log(`other-recent-sessions: ${others.length === 0 ? '(none)' : ''}`);
|
|
173
|
+
for (const other of others) {
|
|
174
|
+
console.log(` ${other.session} (${other.mtime.toISOString()})`);
|
|
175
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Skill } from '@strands-agents/sdk/vended-plugins/skills';
|
|
2
|
+
export declare const SKILL_FILENAME = "SKILL.md";
|
|
3
|
+
export declare const SKILLS_DIRNAME = "skills";
|
|
4
|
+
/** Assets live beside this module in both `src/` and copied `dist/src/` output. */
|
|
5
|
+
export declare const BUILTIN_SKILLS_DIR: string;
|
|
6
|
+
export declare const REQUIRED_BUILTIN_SKILLS: readonly ['developer', 'self-evolution-research', 'self-reflection'];
|
|
7
|
+
/** A skill directory that could not be used, kept so the UI can surface it. */
|
|
8
|
+
export interface SkillProblem {
|
|
9
|
+
directory: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SkillScan {
|
|
13
|
+
/** Official SDK Skill instances, already filtered into Darwin precedence order. */
|
|
14
|
+
skills: Skill[];
|
|
15
|
+
problems: SkillProblem[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Scans bundled, project and global skill directories.
|
|
19
|
+
*
|
|
20
|
+
* Required built-ins come first and fail startup when broken. Optional layers are
|
|
21
|
+
* project then global so a valid project definition claims its name first; an
|
|
22
|
+
* invalid definition claims nothing and cannot hide a valid lower layer.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scanSkills(root: string, options?: {
|
|
25
|
+
builtinSkillsDir?: string;
|
|
26
|
+
}): Promise<SkillScan>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { lstat, readFile, readdir, realpath } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { Skill } from '@strands-agents/sdk/vended-plugins/skills';
|
|
5
|
+
import { extensionRoots } from '../paths.js';
|
|
6
|
+
export const SKILL_FILENAME = 'SKILL.md';
|
|
7
|
+
export const SKILLS_DIRNAME = 'skills';
|
|
8
|
+
/** Assets live beside this module in both `src/` and copied `dist/src/` output. */
|
|
9
|
+
export const BUILTIN_SKILLS_DIR = fileURLToPath(new URL('./builtin', import.meta.url));
|
|
10
|
+
export const REQUIRED_BUILTIN_SKILLS = ['developer', 'self-evolution-research', 'self-reflection'];
|
|
11
|
+
/**
|
|
12
|
+
* Scans bundled, project and global skill directories.
|
|
13
|
+
*
|
|
14
|
+
* Required built-ins come first and fail startup when broken. Optional layers are
|
|
15
|
+
* project then global so a valid project definition claims its name first; an
|
|
16
|
+
* invalid definition claims nothing and cannot hide a valid lower layer.
|
|
17
|
+
*/
|
|
18
|
+
export async function scanSkills(root, options = {}) {
|
|
19
|
+
const builtinSkillsDir = options.builtinSkillsDir ?? BUILTIN_SKILLS_DIR;
|
|
20
|
+
const skills = [];
|
|
21
|
+
const problems = [];
|
|
22
|
+
const seen = new Map();
|
|
23
|
+
const builtinEntries = orderBuiltinEntries(await readdir(builtinSkillsDir, { withFileTypes: true }));
|
|
24
|
+
await scanDirectory(builtinSkillsDir, builtinEntries, 'built-in', skills, problems, seen);
|
|
25
|
+
for (const required of REQUIRED_BUILTIN_SKILLS) {
|
|
26
|
+
if (!skills.some((skill) => skill.name.toLowerCase() === required)) {
|
|
27
|
+
throw new Error(`Required built-in ${required} skill is missing from ${builtinSkillsDir}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (const layer of extensionRoots(root)) {
|
|
31
|
+
const directory = path.join(layer.root, SKILLS_DIRNAME);
|
|
32
|
+
if (directory === builtinSkillsDir)
|
|
33
|
+
continue;
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Missing or unreadable optional roots carry no attributable skill entry.
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
await scanDirectory(directory, sortedSkillEntries(entries), layer.scope, skills, problems, seen);
|
|
43
|
+
}
|
|
44
|
+
return { skills, problems };
|
|
45
|
+
}
|
|
46
|
+
function orderBuiltinEntries(entries) {
|
|
47
|
+
const directories = sortedDirectories(entries);
|
|
48
|
+
const required = REQUIRED_BUILTIN_SKILLS.flatMap((name) => directories.filter((entry) => entry.name === name));
|
|
49
|
+
const requiredNames = new Set(REQUIRED_BUILTIN_SKILLS);
|
|
50
|
+
return [...required, ...directories.filter((entry) => !requiredNames.has(entry.name))];
|
|
51
|
+
}
|
|
52
|
+
function sortedDirectories(entries) {
|
|
53
|
+
return entries
|
|
54
|
+
.filter((entry) => entry.isDirectory())
|
|
55
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
56
|
+
}
|
|
57
|
+
function sortedSkillEntries(entries) {
|
|
58
|
+
return entries
|
|
59
|
+
.filter((entry) => entry.isDirectory() || entry.isSymbolicLink())
|
|
60
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
61
|
+
}
|
|
62
|
+
async function scanDirectory(skillsDir, entries, owner, skills, problems, seen) {
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
if (!entry.isDirectory() && !entry.isSymbolicLink())
|
|
65
|
+
continue;
|
|
66
|
+
const discoveredDirectory = path.join(skillsDir, entry.name);
|
|
67
|
+
if (entry.isSymbolicLink()) {
|
|
68
|
+
try {
|
|
69
|
+
const target = await realpath(discoveredDirectory);
|
|
70
|
+
if (!(await lstat(target)).isDirectory()) {
|
|
71
|
+
problems.push({ directory: discoveredDirectory, reason: `skill symlink does not resolve to a directory: ${target}` });
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
problems.push({ directory: discoveredDirectory, reason: `could not resolve skill symlink: ${describe(error)}` });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Keep the discovered symlink path as the official Skill root. Resolving it
|
|
81
|
+
// here would pin activation to the old target and defeat the use-time root
|
|
82
|
+
// recheck if the symlink is swapped after discovery.
|
|
83
|
+
const directory = discoveredDirectory;
|
|
84
|
+
const skillFile = path.join(directory, SKILL_FILENAME);
|
|
85
|
+
let raw;
|
|
86
|
+
try {
|
|
87
|
+
raw = await readFile(skillFile, 'utf8');
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (owner === 'built-in') {
|
|
91
|
+
throw new Error(`Required built-in skill asset could not be read at ${skillFile}: ${describe(error)}`);
|
|
92
|
+
}
|
|
93
|
+
if (isMissing(error)) {
|
|
94
|
+
// A directory without SKILL.md is not a skill. This matches the SDK's
|
|
95
|
+
// directory scanner and keeps optional grouping folders silent.
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
problems.push({ directory, reason: `could not read ${SKILL_FILENAME}: ${describe(error)}` });
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const parsed = parseOfficialSkill(raw, discoveredDirectory, entry.name);
|
|
102
|
+
if ('reason' in parsed) {
|
|
103
|
+
if (owner === 'built-in') {
|
|
104
|
+
throw new Error(`Invalid built-in skill at ${directory}: ${parsed.reason}`);
|
|
105
|
+
}
|
|
106
|
+
problems.push({ directory, reason: parsed.reason });
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const key = parsed.name.toLowerCase();
|
|
110
|
+
const duplicateOf = seen.get(key);
|
|
111
|
+
if (duplicateOf !== undefined) {
|
|
112
|
+
problems.push({
|
|
113
|
+
directory,
|
|
114
|
+
reason: duplicateOf.owner === 'built-in'
|
|
115
|
+
? `skill name "${parsed.name}" is reserved by built-in skill ${path.basename(duplicateOf.directory)}`
|
|
116
|
+
: `duplicate skill name "${parsed.name}" (already defined by ${duplicateOf.directory})`,
|
|
117
|
+
});
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
seen.set(key, { directory, owner });
|
|
121
|
+
skills.push(parsed);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Hands frontmatter/body parsing to the official SDK. Darwin keeps two product
|
|
126
|
+
* compatibility decisions: a missing name defaults to the directory, and the
|
|
127
|
+
* established name grammar remains `[A-Za-z0-9_-]+` rather than the SDK's stricter
|
|
128
|
+
* lowercase/hyphen recommendation.
|
|
129
|
+
*/
|
|
130
|
+
function parseOfficialSkill(raw, directory, dirName) {
|
|
131
|
+
try {
|
|
132
|
+
const parsed = parseWithDefaultName(raw, dirName);
|
|
133
|
+
const name = parsed.name.trim();
|
|
134
|
+
const description = parsed.description.trim();
|
|
135
|
+
if (description === '') {
|
|
136
|
+
return { reason: `${SKILL_FILENAME} frontmatter is missing a "description" field` };
|
|
137
|
+
}
|
|
138
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
|
|
139
|
+
return {
|
|
140
|
+
reason: `skill name ${JSON.stringify(name)} must contain only letters, numbers, hyphens and underscores`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// `Skill.fromContent` parsed every field. Reconstructing the official model
|
|
144
|
+
// only supplies its host path without imposing the SDK's optional
|
|
145
|
+
// name-equals-directory warning on Darwin's established naming contract.
|
|
146
|
+
return new Skill({
|
|
147
|
+
name,
|
|
148
|
+
description,
|
|
149
|
+
instructions: parsed.instructions,
|
|
150
|
+
path: directory,
|
|
151
|
+
allowedTools: parsed.allowedTools,
|
|
152
|
+
metadata: parsed.metadata,
|
|
153
|
+
license: parsed.license,
|
|
154
|
+
compatibility: parsed.compatibility,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return { reason: officialReason(error) };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function parseWithDefaultName(raw, dirName) {
|
|
162
|
+
try {
|
|
163
|
+
return Skill.fromContent(raw);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
if (!(error instanceof Error) || error.message !== "SKILL.md content must have a 'name' field in frontmatter") {
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
const withName = raw.replace(/^(\s*---\s*\r?\n)/, `$1name: ${JSON.stringify(dirName)}\n`);
|
|
170
|
+
return Skill.fromContent(withName);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function officialReason(error) {
|
|
174
|
+
const message = describe(error);
|
|
175
|
+
if (message === "SKILL.md content must have a 'description' field in frontmatter") {
|
|
176
|
+
return `${SKILL_FILENAME} frontmatter is missing a "description" field`;
|
|
177
|
+
}
|
|
178
|
+
return /yaml/i.test(message) ? `invalid YAML frontmatter: ${message}` : message;
|
|
179
|
+
}
|
|
180
|
+
function isMissing(error) {
|
|
181
|
+
return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
|
|
182
|
+
}
|
|
183
|
+
function describe(error) {
|
|
184
|
+
return error instanceof Error ? error.message : String(error);
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/skills/loader.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,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AC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAClF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnG,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,34 @@
|
|
|
1
|
+
import type { LocalAgent, Plugin, Tool, ToolContext } from '@strands-agents/sdk';
|
|
2
|
+
import { Skill } from '@strands-agents/sdk/vended-plugins/skills';
|
|
3
|
+
import { type SkillProblem } from './loader.js';
|
|
4
|
+
/** Explicitly bound: the SDK also bounds resource recursion to three levels. */
|
|
5
|
+
export declare const MAX_SKILL_RESOURCE_FILES = 20;
|
|
6
|
+
export declare class SkillsPlugin implements Plugin {
|
|
7
|
+
readonly skills: readonly Skill[];
|
|
8
|
+
readonly problems: readonly SkillProblem[];
|
|
9
|
+
readonly name = "darwin:skills";
|
|
10
|
+
private readonly official;
|
|
11
|
+
private readonly officialTool;
|
|
12
|
+
private agent;
|
|
13
|
+
private constructor();
|
|
14
|
+
/** Scans Darwin's layers and builds an adapter over official SDK Skill objects. */
|
|
15
|
+
static load(root: string, options?: {
|
|
16
|
+
maxResourceFiles?: number;
|
|
17
|
+
}): Promise<SkillsPlugin>;
|
|
18
|
+
initAgent(agent: LocalAgent): Promise<void>;
|
|
19
|
+
getTools(): Tool[];
|
|
20
|
+
/** Case-insensitive for both the compatibility tool and `/Commit-Message`. */
|
|
21
|
+
find(name: string): Skill | undefined;
|
|
22
|
+
/** Official activation, used by both the tool callback and slash expansion. */
|
|
23
|
+
activate(skill: Skill, context?: ToolContext): Promise<string>;
|
|
24
|
+
getActivatedSkills(agent: LocalAgent): readonly string[];
|
|
25
|
+
private notFound;
|
|
26
|
+
private slashContext;
|
|
27
|
+
}
|
|
28
|
+
export interface ExpandedSkillCommand {
|
|
29
|
+
skill: Skill;
|
|
30
|
+
/** Message text to send in place of the user's raw slash command. */
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
/** Expands `/skill-name [request]` through the official activation path. */
|
|
34
|
+
export declare function expandSkillCommand(plugin: SkillsPlugin, input: string): Promise<ExpandedSkillCommand | null>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Darwin's compatibility adapter around the official SDK `AgentSkills` plugin.
|
|
3
|
+
*
|
|
4
|
+
* The SDK owns parsing, catalogue injection, activation state and bounded resource
|
|
5
|
+
* listing. Darwin keeps one model-facing contract — `load_skill({ name })` — so
|
|
6
|
+
* existing prompts, permissions and child allowlists do not see a second `skills`
|
|
7
|
+
* tool with a different schema.
|
|
8
|
+
*/
|
|
9
|
+
import { tool } from '@strands-agents/sdk';
|
|
10
|
+
import { AgentSkills, Skill } from '@strands-agents/sdk/vended-plugins/skills';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { scanSkills } from './loader.js';
|
|
13
|
+
import { guardSkillActivation } from './resource-safety.js';
|
|
14
|
+
/** Explicitly bound: the SDK also bounds resource recursion to three levels. */
|
|
15
|
+
export const MAX_SKILL_RESOURCE_FILES = 20;
|
|
16
|
+
const SKILL_STATE_KEY = 'darwin_agent_skills';
|
|
17
|
+
export class SkillsPlugin {
|
|
18
|
+
skills;
|
|
19
|
+
problems;
|
|
20
|
+
name = 'darwin:skills';
|
|
21
|
+
official;
|
|
22
|
+
officialTool;
|
|
23
|
+
agent;
|
|
24
|
+
constructor(skills, problems, maxResourceFiles) {
|
|
25
|
+
this.skills = skills;
|
|
26
|
+
this.problems = problems;
|
|
27
|
+
this.official = new AgentSkills({
|
|
28
|
+
skills: [...skills],
|
|
29
|
+
maxResourceFiles,
|
|
30
|
+
stateKey: SKILL_STATE_KEY,
|
|
31
|
+
});
|
|
32
|
+
const nativeTools = this.official.getTools();
|
|
33
|
+
const native = nativeTools[0];
|
|
34
|
+
if (nativeTools.length !== 1 || native?.name !== 'skills' || !('invoke' in native)) {
|
|
35
|
+
throw new Error('Official AgentSkills plugin did not provide an invokable skills tool.');
|
|
36
|
+
}
|
|
37
|
+
this.officialTool = native;
|
|
38
|
+
}
|
|
39
|
+
/** Scans Darwin's layers and builds an adapter over official SDK Skill objects. */
|
|
40
|
+
static async load(root, options = {}) {
|
|
41
|
+
const { skills, problems } = await scanSkills(root);
|
|
42
|
+
return new SkillsPlugin(skills, problems, options.maxResourceFiles ?? MAX_SKILL_RESOURCE_FILES);
|
|
43
|
+
}
|
|
44
|
+
async initAgent(agent) {
|
|
45
|
+
this.agent = agent;
|
|
46
|
+
await this.official.initAgent(agent);
|
|
47
|
+
}
|
|
48
|
+
getTools() {
|
|
49
|
+
if (this.skills.length === 0)
|
|
50
|
+
return [];
|
|
51
|
+
const known = this.skills.map((skill) => skill.name).join(', ');
|
|
52
|
+
return [
|
|
53
|
+
tool({
|
|
54
|
+
name: 'load_skill',
|
|
55
|
+
description: `Read the full instructions for one of the available skills before starting a task ` +
|
|
56
|
+
`it applies to. Available skills: ${known}.`,
|
|
57
|
+
inputSchema: z.object({
|
|
58
|
+
name: z.string().describe('Name of the skill to load'),
|
|
59
|
+
}),
|
|
60
|
+
callback: async ({ name }, context) => {
|
|
61
|
+
const skill = this.find(name);
|
|
62
|
+
if (skill === undefined)
|
|
63
|
+
return this.notFound(name);
|
|
64
|
+
if (context === undefined) {
|
|
65
|
+
throw new Error('load_skill requires a ToolContext with an agent reference');
|
|
66
|
+
}
|
|
67
|
+
return { instructions: await this.activate(skill, context) };
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
/** Case-insensitive for both the compatibility tool and `/Commit-Message`. */
|
|
73
|
+
find(name) {
|
|
74
|
+
const wanted = name.trim().toLowerCase();
|
|
75
|
+
return this.skills.find((skill) => skill.name.toLowerCase() === wanted);
|
|
76
|
+
}
|
|
77
|
+
/** Official activation, used by both the tool callback and slash expansion. */
|
|
78
|
+
async activate(skill, context) {
|
|
79
|
+
const liveContext = context ?? this.slashContext(skill);
|
|
80
|
+
const guardedContext = await guardSkillActivation(liveContext, skill);
|
|
81
|
+
return this.officialTool.invoke({ skill_name: skill.name }, guardedContext);
|
|
82
|
+
}
|
|
83
|
+
getActivatedSkills(agent) {
|
|
84
|
+
return this.official.getActivatedSkills(agent);
|
|
85
|
+
}
|
|
86
|
+
notFound(name) {
|
|
87
|
+
return {
|
|
88
|
+
error: `No skill named ${JSON.stringify(name)}.`,
|
|
89
|
+
availableSkills: this.skills.map((skill) => skill.name),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
slashContext(skill) {
|
|
93
|
+
const agent = this.agent;
|
|
94
|
+
if (agent === undefined) {
|
|
95
|
+
throw new Error(`Cannot expand /${skill.name} before the skills plugin is initialized.`);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
agent,
|
|
99
|
+
invocationState: {},
|
|
100
|
+
toolUse: {
|
|
101
|
+
name: 'load_skill',
|
|
102
|
+
toolUseId: `slash-${skill.name}`,
|
|
103
|
+
input: { name: skill.name },
|
|
104
|
+
},
|
|
105
|
+
interrupt: () => {
|
|
106
|
+
throw new Error('load_skill activation does not support interrupts');
|
|
107
|
+
},
|
|
108
|
+
// A slash expansion is synchronous with the keystroke that asked for it;
|
|
109
|
+
// nothing can cancel it, so the signal is one that never aborts.
|
|
110
|
+
cancelSignal: new AbortController().signal,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** Expands `/skill-name [request]` through the official activation path. */
|
|
115
|
+
export async function expandSkillCommand(plugin, input) {
|
|
116
|
+
const trimmed = input.trim();
|
|
117
|
+
if (!trimmed.startsWith('/'))
|
|
118
|
+
return null;
|
|
119
|
+
const withoutSlash = trimmed.slice(1);
|
|
120
|
+
const separator = withoutSlash.search(/\s/);
|
|
121
|
+
const name = separator === -1 ? withoutSlash : withoutSlash.slice(0, separator);
|
|
122
|
+
const remainder = separator === -1 ? '' : withoutSlash.slice(separator).trim();
|
|
123
|
+
const skill = plugin.find(name);
|
|
124
|
+
if (skill === undefined)
|
|
125
|
+
return null;
|
|
126
|
+
const instructions = await plugin.activate(skill);
|
|
127
|
+
const request = remainder === ''
|
|
128
|
+
? `Apply the "${skill.name}" skill to what we are working on.`
|
|
129
|
+
: remainder;
|
|
130
|
+
const alreadyLoaded = `The full instructions for the "${skill.name}" skill are included above — ` +
|
|
131
|
+
`do not call load_skill for it.`;
|
|
132
|
+
return {
|
|
133
|
+
skill,
|
|
134
|
+
message: `${instructions}\n\n${alreadyLoaded}\n\n${request}`,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/skills/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAQ3C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAI9C,MAAM,OAAO,YAAY;IAOZ,MAAM;IACN,QAAQ;IAPV,IAAI,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|
+
export declare function orderOfficialSkillsPrompt(agent: LocalAgent): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Replaces current working context while preserving a separate official catalogue
|
|
6
|
+
* and removes the prior cache point so the runtime can apply the current plan.
|
|
7
|
+
*/
|
|
8
|
+
export declare function refreshKnownPrompt(prompt: SystemPrompt | undefined, fragment: string | undefined): SystemPrompt | undefined;
|