hoomanjs 1.18.0 → 1.18.1
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 +22 -26
- package/dist/acp/acp-agent.d.ts +69 -0
- package/dist/acp/acp-agent.js +628 -0
- package/dist/acp/acp-agent.js.map +1 -0
- package/dist/acp/approvals.d.ts +5 -0
- package/dist/acp/approvals.js +130 -0
- package/dist/acp/approvals.js.map +1 -0
- package/dist/acp/index.d.ts +1 -0
- package/dist/acp/index.js +2 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/mcp-servers.d.ts +7 -0
- package/dist/acp/mcp-servers.js +57 -0
- package/dist/acp/mcp-servers.js.map +1 -0
- package/dist/acp/meta/system-prompt.d.ts +12 -0
- package/dist/acp/meta/system-prompt.js +41 -0
- package/dist/acp/meta/system-prompt.js.map +1 -0
- package/dist/acp/meta/user-id.d.ts +12 -0
- package/dist/acp/meta/user-id.js +43 -0
- package/dist/acp/meta/user-id.js.map +1 -0
- package/dist/acp/prompt-invoke.d.ts +10 -0
- package/dist/acp/prompt-invoke.js +131 -0
- package/dist/acp/prompt-invoke.js.map +1 -0
- package/dist/acp/sessions/config-options.d.ts +7 -0
- package/dist/acp/sessions/config-options.js +101 -0
- package/dist/acp/sessions/config-options.js.map +1 -0
- package/dist/acp/sessions/replay.d.ts +7 -0
- package/dist/acp/sessions/replay.js +117 -0
- package/dist/acp/sessions/replay.js.map +1 -0
- package/dist/acp/sessions/store.d.ts +24 -0
- package/dist/acp/sessions/store.js +96 -0
- package/dist/acp/sessions/store.js.map +1 -0
- package/dist/acp/sessions/title.d.ts +5 -0
- package/dist/acp/sessions/title.js +22 -0
- package/dist/acp/sessions/title.js.map +1 -0
- package/dist/acp/utils/paths.d.ts +2 -0
- package/{src/acp/utils/paths.ts → dist/acp/utils/paths.js} +2 -2
- package/dist/acp/utils/paths.js.map +1 -0
- package/dist/acp/utils/tool-kind.d.ts +6 -0
- package/dist/acp/utils/tool-kind.js +53 -0
- package/dist/acp/utils/tool-kind.js.map +1 -0
- package/dist/acp/utils/tool-locations.d.ts +3 -0
- package/dist/acp/utils/tool-locations.js +44 -0
- package/dist/acp/utils/tool-locations.js.map +1 -0
- package/dist/acp/utils/tool-result-content.d.ts +8 -0
- package/dist/acp/utils/tool-result-content.js +14 -0
- package/dist/acp/utils/tool-result-content.js.map +1 -0
- package/dist/chat/app.d.ts +15 -0
- package/dist/chat/app.js +458 -0
- package/dist/chat/app.js.map +1 -0
- package/dist/chat/approvals.d.ts +15 -0
- package/dist/chat/approvals.js +74 -0
- package/dist/chat/approvals.js.map +1 -0
- package/dist/chat/components/ApprovalPrompt.d.ts +6 -0
- package/dist/chat/components/ApprovalPrompt.js +11 -0
- package/dist/chat/components/ApprovalPrompt.js.map +1 -0
- package/dist/chat/components/ChatMessage.d.ts +7 -0
- package/dist/chat/components/ChatMessage.js +19 -0
- package/dist/chat/components/ChatMessage.js.map +1 -0
- package/dist/chat/components/Composer.d.ts +11 -0
- package/dist/chat/components/Composer.js +9 -0
- package/dist/chat/components/Composer.js.map +1 -0
- package/dist/chat/components/EmptyChatBanner.d.ts +2 -0
- package/dist/chat/components/EmptyChatBanner.js +8 -0
- package/dist/chat/components/EmptyChatBanner.js.map +1 -0
- package/dist/chat/components/PromptInput.d.ts +11 -0
- package/dist/chat/components/PromptInput.js +26 -0
- package/dist/chat/components/PromptInput.js.map +1 -0
- package/dist/chat/components/QueuedPrompts.d.ts +10 -0
- package/dist/chat/components/QueuedPrompts.js +38 -0
- package/dist/chat/components/QueuedPrompts.js.map +1 -0
- package/dist/chat/components/ReasoningStrip.d.ts +6 -0
- package/dist/chat/components/ReasoningStrip.js +13 -0
- package/dist/chat/components/ReasoningStrip.js.map +1 -0
- package/dist/chat/components/ScrollView.d.ts +101 -0
- package/dist/chat/components/ScrollView.js +74 -0
- package/dist/chat/components/ScrollView.js.map +1 -0
- package/dist/chat/components/Spinner.d.ts +8 -0
- package/dist/chat/components/Spinner.js +19 -0
- package/dist/chat/components/Spinner.js.map +1 -0
- package/dist/chat/components/StatusBar.d.ts +20 -0
- package/dist/chat/components/StatusBar.js +20 -0
- package/dist/chat/components/StatusBar.js.map +1 -0
- package/dist/chat/components/ThinkingStatus.d.ts +1 -0
- package/dist/chat/components/ThinkingStatus.js +119 -0
- package/dist/chat/components/ThinkingStatus.js.map +1 -0
- package/dist/chat/components/TodoPanel.d.ts +6 -0
- package/dist/chat/components/TodoPanel.js +27 -0
- package/dist/chat/components/TodoPanel.js.map +1 -0
- package/dist/chat/components/ToolEvent.d.ts +6 -0
- package/dist/chat/components/ToolEvent.js +18 -0
- package/dist/chat/components/ToolEvent.js.map +1 -0
- package/dist/chat/components/ToolEventFileResult.d.ts +9 -0
- package/dist/chat/components/ToolEventFileResult.js +50 -0
- package/dist/chat/components/ToolEventFileResult.js.map +1 -0
- package/dist/chat/components/Transcript.d.ts +7 -0
- package/dist/chat/components/Transcript.js +9 -0
- package/dist/chat/components/Transcript.js.map +1 -0
- package/dist/chat/components/TranscriptViewport.d.ts +9 -0
- package/dist/chat/components/TranscriptViewport.js +124 -0
- package/dist/chat/components/TranscriptViewport.js.map +1 -0
- package/dist/chat/components/ascii-logo.d.ts +1 -0
- package/{src/chat/components/ascii-logo.ts → dist/chat/components/ascii-logo.js} +3 -2
- package/dist/chat/components/ascii-logo.js.map +1 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.d.ts +26 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js +73 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js.map +1 -0
- package/dist/chat/components/markdown/BlockRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/BlockRenderer.js +87 -0
- package/dist/chat/components/markdown/BlockRenderer.js.map +1 -0
- package/dist/chat/components/markdown/CodeBlock.d.ts +7 -0
- package/dist/chat/components/markdown/CodeBlock.js +55 -0
- package/dist/chat/components/markdown/CodeBlock.js.map +1 -0
- package/dist/chat/components/markdown/InlineRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/InlineRenderer.js +96 -0
- package/dist/chat/components/markdown/InlineRenderer.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownMessage.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownMessage.js +13 -0
- package/dist/chat/components/markdown/MarkdownMessage.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownTable.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownTable.js +12 -0
- package/dist/chat/components/markdown/MarkdownTable.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.d.ts +7 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js +186 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.d.ts +9 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js +25 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js.map +1 -0
- package/dist/chat/components/markdown/lexer.d.ts +7 -0
- package/dist/chat/components/markdown/lexer.js +89 -0
- package/dist/chat/components/markdown/lexer.js.map +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.d.ts +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.js +112 -0
- package/dist/chat/components/prompt-input/clipboard-image.js.map +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.d.ts +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js +2 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js.map +1 -0
- package/dist/chat/components/prompt-input/input-model.d.ts +28 -0
- package/dist/chat/components/prompt-input/input-model.js +231 -0
- package/dist/chat/components/prompt-input/input-model.js.map +1 -0
- package/dist/chat/components/prompt-input/paste.d.ts +11 -0
- package/dist/chat/components/prompt-input/paste.js +85 -0
- package/dist/chat/components/prompt-input/paste.js.map +1 -0
- package/dist/chat/components/prompt-input/render.d.ts +13 -0
- package/dist/chat/components/prompt-input/render.js +54 -0
- package/dist/chat/components/prompt-input/render.js.map +1 -0
- package/dist/chat/components/prompt-input/usePromptInputController.d.ts +17 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js +366 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js.map +1 -0
- package/dist/chat/components/shared.d.ts +6 -0
- package/dist/chat/components/shared.js +66 -0
- package/dist/chat/components/shared.js.map +1 -0
- package/dist/chat/index.d.ts +13 -0
- package/dist/chat/index.js +18 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/mouse.d.ts +5 -0
- package/dist/chat/mouse.js +9 -0
- package/dist/chat/mouse.js.map +1 -0
- package/dist/chat/types.d.ts +20 -0
- package/dist/chat/types.js +2 -0
- package/dist/chat/types.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +126 -0
- package/dist/cli.js.map +1 -0
- package/dist/configure/app.d.ts +3 -0
- package/dist/configure/app.js +1036 -0
- package/dist/configure/app.js.map +1 -0
- package/dist/configure/components/BusyScreen.d.ts +6 -0
- package/dist/configure/components/BusyScreen.js +7 -0
- package/dist/configure/components/BusyScreen.js.map +1 -0
- package/dist/configure/components/HomeScreen.d.ts +12 -0
- package/dist/configure/components/HomeScreen.js +7 -0
- package/dist/configure/components/HomeScreen.js.map +1 -0
- package/dist/configure/components/MenuScreen.d.ts +10 -0
- package/dist/configure/components/MenuScreen.js +15 -0
- package/dist/configure/components/MenuScreen.js.map +1 -0
- package/dist/configure/components/PromptForm.d.ts +8 -0
- package/dist/configure/components/PromptForm.js +12 -0
- package/dist/configure/components/PromptForm.js.map +1 -0
- package/dist/configure/components/SelectMenuItem.d.ts +7 -0
- package/dist/configure/components/SelectMenuItem.js +18 -0
- package/dist/configure/components/SelectMenuItem.js.map +1 -0
- package/dist/configure/index.d.ts +1 -0
- package/dist/configure/index.js +28 -0
- package/dist/configure/index.js.map +1 -0
- package/dist/configure/open-in-editor.d.ts +8 -0
- package/dist/configure/open-in-editor.js +120 -0
- package/dist/configure/open-in-editor.js.map +1 -0
- package/dist/configure/types.d.ts +63 -0
- package/dist/configure/types.js +2 -0
- package/dist/configure/types.js.map +1 -0
- package/dist/configure/utils.d.ts +19 -0
- package/dist/configure/utils.js +108 -0
- package/dist/configure/utils.js.map +1 -0
- package/dist/core/agent/index.d.ts +13 -0
- package/dist/core/agent/index.js +70 -0
- package/dist/core/agent/index.js.map +1 -0
- package/dist/core/agents/definitions.d.ts +12 -0
- package/dist/core/agents/definitions.js +35 -0
- package/dist/core/agents/definitions.js.map +1 -0
- package/dist/core/agents/index.d.ts +4 -0
- package/dist/core/agents/index.js +5 -0
- package/dist/core/agents/index.js.map +1 -0
- package/dist/core/agents/registry.d.ts +5 -0
- package/dist/core/agents/registry.js +84 -0
- package/dist/core/agents/registry.js.map +1 -0
- package/dist/core/agents/runner.d.ts +36 -0
- package/dist/core/agents/runner.js +275 -0
- package/dist/core/agents/runner.js.map +1 -0
- package/dist/core/agents/tools.d.ts +20 -0
- package/dist/core/agents/tools.js +66 -0
- package/dist/core/agents/tools.js.map +1 -0
- package/dist/core/config.d.ts +272 -0
- package/dist/core/config.js +334 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.js +21 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/mcp/config.d.ts +44 -0
- package/dist/core/mcp/config.js +65 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +8 -0
- package/dist/core/mcp/index.js +12 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +69 -0
- package/dist/core/mcp/manager.js +376 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/mcp/prefixed-mcp-tool.d.ts +14 -0
- package/dist/core/mcp/prefixed-mcp-tool.js +38 -0
- package/dist/core/mcp/prefixed-mcp-tool.js.map +1 -0
- package/dist/core/mcp/tools.d.ts +5 -0
- package/dist/core/mcp/tools.js +82 -0
- package/dist/core/mcp/tools.js.map +1 -0
- package/dist/core/mcp/types.d.ts +40 -0
- package/dist/core/mcp/types.js +28 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory/index.d.ts +3 -0
- package/dist/core/memory/index.js +3 -0
- package/dist/core/memory/index.js.map +1 -0
- package/dist/core/memory/ltm/embed.d.ts +16 -0
- package/dist/core/memory/ltm/embed.js +49 -0
- package/dist/core/memory/ltm/embed.js.map +1 -0
- package/dist/core/memory/ltm/index.d.ts +3 -0
- package/dist/core/memory/ltm/index.js +3 -0
- package/dist/core/memory/ltm/index.js.map +1 -0
- package/dist/core/memory/ltm/store.d.ts +20 -0
- package/dist/core/memory/ltm/store.js +271 -0
- package/dist/core/memory/ltm/store.js.map +1 -0
- package/dist/core/memory/ltm/tools.d.ts +21 -0
- package/dist/core/memory/ltm/tools.js +127 -0
- package/dist/core/memory/ltm/tools.js.map +1 -0
- package/dist/core/memory/ltm/types.d.ts +79 -0
- package/dist/core/memory/ltm/types.js +2 -0
- package/dist/core/memory/ltm/types.js.map +1 -0
- package/dist/core/memory/ltm/utils.d.ts +40 -0
- package/dist/core/memory/ltm/utils.js +145 -0
- package/dist/core/memory/ltm/utils.js.map +1 -0
- package/dist/core/memory/stm/flat-file-storage.d.ts +27 -0
- package/dist/core/memory/stm/flat-file-storage.js +63 -0
- package/dist/core/memory/stm/flat-file-storage.js.map +1 -0
- package/dist/core/memory/stm/index.d.ts +13 -0
- package/dist/core/memory/stm/index.js +24 -0
- package/dist/core/memory/stm/index.js.map +1 -0
- package/dist/core/memory/stm/lazy-session-manager.d.ts +37 -0
- package/dist/core/memory/stm/lazy-session-manager.js +163 -0
- package/dist/core/memory/stm/lazy-session-manager.js.map +1 -0
- package/dist/core/models/anthropic.d.ts +10 -0
- package/dist/core/models/anthropic.js +38 -0
- package/dist/core/models/anthropic.js.map +1 -0
- package/dist/core/models/bedrock.d.ts +21 -0
- package/dist/core/models/bedrock.js +24 -0
- package/dist/core/models/bedrock.js.map +1 -0
- package/dist/core/models/google.d.ts +10 -0
- package/dist/core/models/google.js +36 -0
- package/dist/core/models/google.js.map +1 -0
- package/dist/core/models/groq.d.ts +10 -0
- package/dist/core/models/groq.js +33 -0
- package/dist/core/models/groq.js.map +1 -0
- package/dist/core/models/index.d.ts +5 -0
- package/dist/core/models/index.js +11 -0
- package/dist/core/models/index.js.map +1 -0
- package/dist/core/models/moonshot.d.ts +11 -0
- package/dist/core/models/moonshot.js +39 -0
- package/dist/core/models/moonshot.js.map +1 -0
- package/dist/core/models/ollama/index.d.ts +3 -0
- package/dist/core/models/ollama/index.js +9 -0
- package/dist/core/models/ollama/index.js.map +1 -0
- package/dist/core/models/ollama/strands-ollama.d.ts +30 -0
- package/dist/core/models/ollama/strands-ollama.js +336 -0
- package/dist/core/models/ollama/strands-ollama.js.map +1 -0
- package/dist/core/models/openai.d.ts +4 -0
- package/dist/core/models/openai.js +9 -0
- package/dist/core/models/openai.js.map +1 -0
- package/dist/core/models/xai.d.ts +10 -0
- package/dist/core/models/xai.js +33 -0
- package/dist/core/models/xai.js.map +1 -0
- package/dist/core/prompts/environment.d.ts +11 -0
- package/dist/core/prompts/environment.js +51 -0
- package/dist/core/prompts/environment.js.map +1 -0
- package/dist/core/prompts/index.d.ts +7 -0
- package/dist/core/prompts/index.js +14 -0
- package/dist/core/prompts/index.js.map +1 -0
- package/dist/core/prompts/skills.d.ts +15 -0
- package/dist/core/prompts/skills.js +86 -0
- package/dist/core/prompts/skills.js.map +1 -0
- package/dist/core/prompts/system.d.ts +22 -0
- package/dist/core/prompts/system.js +164 -0
- package/dist/core/prompts/system.js.map +1 -0
- package/dist/core/skills/built-in/hooman-config/SKILL.md +9 -0
- package/dist/core/skills/index.d.ts +2 -0
- package/dist/core/skills/index.js +3 -0
- package/dist/core/skills/index.js.map +1 -0
- package/dist/core/skills/metadata.d.ts +8 -0
- package/dist/core/skills/metadata.js +20 -0
- package/dist/core/skills/metadata.js.map +1 -0
- package/dist/core/skills/registry.d.ts +38 -0
- package/dist/core/skills/registry.js +165 -0
- package/dist/core/skills/registry.js.map +1 -0
- package/dist/core/skills/tools.d.ts +9 -0
- package/dist/core/skills/tools.js +73 -0
- package/dist/core/skills/tools.js.map +1 -0
- package/dist/core/state/file-tool-display.d.ts +20 -0
- package/dist/core/state/file-tool-display.js +35 -0
- package/dist/core/state/file-tool-display.js.map +1 -0
- package/dist/core/state/thought-process.d.ts +18 -0
- package/dist/core/state/thought-process.js +21 -0
- package/dist/core/state/thought-process.js.map +1 -0
- package/dist/core/state/todos.d.ts +39 -0
- package/dist/core/state/todos.js +53 -0
- package/dist/core/state/todos.js.map +1 -0
- package/dist/core/state/tool-approvals.d.ts +12 -0
- package/dist/core/state/tool-approvals.js +81 -0
- package/dist/core/state/tool-approvals.js.map +1 -0
- package/dist/core/tools/fetch.d.ts +9 -0
- package/dist/core/tools/fetch.js +228 -0
- package/dist/core/tools/fetch.js.map +1 -0
- package/dist/core/tools/filesystem.d.ts +35 -0
- package/dist/core/tools/filesystem.js +791 -0
- package/dist/core/tools/filesystem.js.map +1 -0
- package/dist/core/tools/index.d.ts +9 -0
- package/dist/core/tools/index.js +10 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/shell.d.ts +18 -0
- package/dist/core/tools/shell.js +308 -0
- package/dist/core/tools/shell.js.map +1 -0
- package/dist/core/tools/sleep.d.ts +4 -0
- package/dist/core/tools/sleep.js +46 -0
- package/dist/core/tools/sleep.js.map +1 -0
- package/dist/core/tools/thinking.d.ts +12 -0
- package/dist/core/tools/thinking.js +119 -0
- package/dist/core/tools/thinking.js.map +1 -0
- package/dist/core/tools/time.d.ts +8 -0
- package/dist/core/tools/time.js +94 -0
- package/dist/core/tools/time.js.map +1 -0
- package/dist/core/tools/todo.d.ts +9 -0
- package/dist/core/tools/todo.js +33 -0
- package/dist/core/tools/todo.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +11 -0
- package/dist/core/tools/web-search.js +211 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/wiki.d.ts +11 -0
- package/dist/core/tools/wiki.js +566 -0
- package/dist/core/tools/wiki.js.map +1 -0
- package/dist/core/utils/attachments.d.ts +23 -0
- package/dist/core/utils/attachments.js +125 -0
- package/dist/core/utils/attachments.js.map +1 -0
- package/dist/core/utils/cwd-context.d.ts +2 -0
- package/dist/core/utils/cwd-context.js +9 -0
- package/dist/core/utils/cwd-context.js.map +1 -0
- package/dist/core/utils/file-formats.d.ts +4 -0
- package/dist/core/utils/file-formats.js +48 -0
- package/dist/core/utils/file-formats.js.map +1 -0
- package/dist/core/utils/paths.d.ts +7 -0
- package/dist/core/utils/paths.js +25 -0
- package/dist/core/utils/paths.js.map +1 -0
- package/dist/daemon/approvals.d.ts +5 -0
- package/dist/daemon/approvals.js +95 -0
- package/dist/daemon/approvals.js.map +1 -0
- package/dist/daemon/index.d.ts +11 -0
- package/dist/daemon/index.js +106 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/queue.d.ts +5 -0
- package/dist/daemon/queue.js +38 -0
- package/dist/daemon/queue.js.map +1 -0
- package/dist/exec/approvals.d.ts +6 -0
- package/dist/exec/approvals.js +74 -0
- package/dist/exec/approvals.js.map +1 -0
- package/package.json +20 -9
- package/.github/screenshot.png +0 -0
- package/.github/workflows/build-publish.yml +0 -49
- package/docker-compose.yml +0 -13
- package/src/acp/acp-agent.ts +0 -814
- package/src/acp/approvals.ts +0 -146
- package/src/acp/index.ts +0 -1
- package/src/acp/mcp-servers.ts +0 -64
- package/src/acp/meta/system-prompt.ts +0 -44
- package/src/acp/meta/user-id.ts +0 -44
- package/src/acp/prompt-invoke.ts +0 -149
- package/src/acp/sessions/config-options.ts +0 -120
- package/src/acp/sessions/replay.ts +0 -131
- package/src/acp/sessions/store.ts +0 -161
- package/src/acp/sessions/title.ts +0 -22
- package/src/acp/utils/tool-kind.ts +0 -61
- package/src/acp/utils/tool-locations.ts +0 -48
- package/src/acp/utils/tool-result-content.ts +0 -27
- package/src/chat/app.tsx +0 -636
- package/src/chat/approvals.ts +0 -97
- package/src/chat/components/ApprovalPrompt.tsx +0 -25
- package/src/chat/components/ChatMessage.tsx +0 -50
- package/src/chat/components/Composer.tsx +0 -45
- package/src/chat/components/EmptyChatBanner.tsx +0 -26
- package/src/chat/components/PromptInput.tsx +0 -62
- package/src/chat/components/QueuedPrompts.tsx +0 -76
- package/src/chat/components/ReasoningStrip.tsx +0 -30
- package/src/chat/components/Spinner.tsx +0 -34
- package/src/chat/components/StatusBar.tsx +0 -67
- package/src/chat/components/ThinkingStatus.tsx +0 -128
- package/src/chat/components/TodoPanel.tsx +0 -49
- package/src/chat/components/ToolEvent.tsx +0 -41
- package/src/chat/components/ToolEventFileResult.tsx +0 -116
- package/src/chat/components/Transcript.tsx +0 -34
- package/src/chat/components/TranscriptViewport.tsx +0 -170
- package/src/chat/components/file-tool-diff/file-tool-result.ts +0 -155
- package/src/chat/components/markdown/BlockRenderer.tsx +0 -207
- package/src/chat/components/markdown/CodeBlock.tsx +0 -100
- package/src/chat/components/markdown/InlineRenderer.tsx +0 -122
- package/src/chat/components/markdown/MarkdownMessage.tsx +0 -35
- package/src/chat/components/markdown/MarkdownTable.tsx +0 -23
- package/src/chat/components/markdown/hooks/useMarkdownTableLayout.ts +0 -242
- package/src/chat/components/markdown/hooks/useMarkdownTokens.ts +0 -46
- package/src/chat/components/markdown/lexer.ts +0 -100
- package/src/chat/components/prompt-input/clipboard-image.ts +0 -119
- package/src/chat/components/prompt-input/hooks/usePromptInputController.ts +0 -4
- package/src/chat/components/prompt-input/input-model.ts +0 -294
- package/src/chat/components/prompt-input/paste.ts +0 -105
- package/src/chat/components/prompt-input/render.ts +0 -83
- package/src/chat/components/prompt-input/usePromptInputController.ts +0 -498
- package/src/chat/components/shared.ts +0 -70
- package/src/chat/index.tsx +0 -41
- package/src/chat/mouse.ts +0 -17
- package/src/chat/types.ts +0 -24
- package/src/cli.ts +0 -181
- package/src/configure/app.tsx +0 -1349
- package/src/configure/components/BusyScreen.tsx +0 -22
- package/src/configure/components/HomeScreen.tsx +0 -43
- package/src/configure/components/MenuScreen.tsx +0 -44
- package/src/configure/components/PromptForm.tsx +0 -40
- package/src/configure/components/SelectMenuItem.tsx +0 -30
- package/src/configure/index.tsx +0 -43
- package/src/configure/open-in-editor.ts +0 -133
- package/src/configure/types.ts +0 -51
- package/src/configure/utils.ts +0 -134
- package/src/core/agent/index.ts +0 -108
- package/src/core/agents/definitions.ts +0 -48
- package/src/core/agents/index.ts +0 -15
- package/src/core/agents/registry.ts +0 -106
- package/src/core/agents/runner.ts +0 -375
- package/src/core/agents/tools.ts +0 -100
- package/src/core/config.ts +0 -377
- package/src/core/index.ts +0 -60
- package/src/core/mcp/config.ts +0 -80
- package/src/core/mcp/index.ts +0 -33
- package/src/core/mcp/manager.ts +0 -491
- package/src/core/mcp/prefixed-mcp-tool.ts +0 -45
- package/src/core/mcp/tools.ts +0 -92
- package/src/core/mcp/types.ts +0 -37
- package/src/core/memory/index.ts +0 -17
- package/src/core/memory/ltm/embed.ts +0 -67
- package/src/core/memory/ltm/index.ts +0 -18
- package/src/core/memory/ltm/store.ts +0 -376
- package/src/core/memory/ltm/tools.ts +0 -146
- package/src/core/memory/ltm/types.ts +0 -111
- package/src/core/memory/ltm/utils.ts +0 -218
- package/src/core/memory/stm/flat-file-storage.ts +0 -89
- package/src/core/memory/stm/index.ts +0 -32
- package/src/core/memory/stm/lazy-session-manager.ts +0 -220
- package/src/core/models/anthropic.ts +0 -53
- package/src/core/models/bedrock.ts +0 -54
- package/src/core/models/google.ts +0 -51
- package/src/core/models/groq.ts +0 -48
- package/src/core/models/index.ts +0 -19
- package/src/core/models/moonshot.ts +0 -54
- package/src/core/models/ollama/index.ts +0 -13
- package/src/core/models/ollama/strands-ollama.ts +0 -439
- package/src/core/models/openai.ts +0 -12
- package/src/core/models/xai.ts +0 -47
- package/src/core/prompts/environment.ts +0 -71
- package/src/core/prompts/index.ts +0 -22
- package/src/core/prompts/skills.ts +0 -66
- package/src/core/prompts/system.ts +0 -183
- package/src/core/skills/index.ts +0 -2
- package/src/core/skills/registry.ts +0 -239
- package/src/core/skills/tools.ts +0 -80
- package/src/core/state/file-tool-display.ts +0 -70
- package/src/core/state/thought-process.ts +0 -49
- package/src/core/state/todos.ts +0 -84
- package/src/core/state/tool-approvals.ts +0 -100
- package/src/core/tools/fetch.ts +0 -288
- package/src/core/tools/filesystem.ts +0 -1105
- package/src/core/tools/index.ts +0 -9
- package/src/core/tools/shell.ts +0 -426
- package/src/core/tools/sleep.ts +0 -51
- package/src/core/tools/thinking.ts +0 -149
- package/src/core/tools/time.ts +0 -121
- package/src/core/tools/todo.ts +0 -44
- package/src/core/tools/web-search.ts +0 -278
- package/src/core/tools/wiki.ts +0 -703
- package/src/core/utils/attachments.ts +0 -201
- package/src/core/utils/cwd-context.ts +0 -11
- package/src/core/utils/file-formats.ts +0 -60
- package/src/core/utils/paths.ts +0 -37
- package/src/daemon/approvals.ts +0 -127
- package/src/daemon/index.ts +0 -153
- package/src/daemon/queue.ts +0 -48
- package/src/exec/approvals.ts +0 -90
- package/tsconfig.json +0 -30
- /package/{src → dist}/core/prompts/agents/plan.md +0 -0
- /package/{src → dist}/core/prompts/agents/research.md +0 -0
- /package/{src → dist}/core/prompts/harness/behaviour.md +0 -0
- /package/{src → dist}/core/prompts/harness/communication.md +0 -0
- /package/{src → dist}/core/prompts/harness/engineering.md +0 -0
- /package/{src → dist}/core/prompts/harness/execution.md +0 -0
- /package/{src → dist}/core/prompts/harness/guardrails.md +0 -0
- /package/{src → dist}/core/prompts/static/daemon.md +0 -0
- /package/{src → dist}/core/prompts/static/environment.md +0 -0
- /package/{src → dist}/core/prompts/static/fetch.md +0 -0
- /package/{src → dist}/core/prompts/static/filesystem.md +0 -0
- /package/{src → dist}/core/prompts/static/identity.md +0 -0
- /package/{src → dist}/core/prompts/static/ltm.md +0 -0
- /package/{src → dist}/core/prompts/static/shell.md +0 -0
- /package/{src → dist}/core/prompts/static/skills.md +0 -0
- /package/{src → dist}/core/prompts/static/sleep.md +0 -0
- /package/{src → dist}/core/prompts/static/subagents.md +0 -0
- /package/{src → dist}/core/prompts/static/thinking.md +0 -0
- /package/{src → dist}/core/prompts/static/todo.md +0 -0
- /package/{src → dist}/core/prompts/static/web-search.md +0 -0
- /package/{src → dist}/core/prompts/static/wiki.md +0 -0
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
release as osRelease,
|
|
5
|
-
type as osType,
|
|
6
|
-
version as osVersion,
|
|
7
|
-
} from "node:os";
|
|
8
|
-
|
|
9
|
-
type EnvironmentPromptContext = {
|
|
10
|
-
cwd: string;
|
|
11
|
-
platform: string;
|
|
12
|
-
osVersion: string;
|
|
13
|
-
shell: string;
|
|
14
|
-
isGitRepo: boolean;
|
|
15
|
-
currentDateTime: string;
|
|
16
|
-
timeZone: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function detectPlatform(): string {
|
|
20
|
-
return ["darwin", "linux", "win32"].includes(process.platform)
|
|
21
|
-
? process.platform
|
|
22
|
-
: process.platform;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function detectOsVersion(): string {
|
|
26
|
-
if (process.platform === "win32") {
|
|
27
|
-
return `${osVersion()} ${osRelease()}`;
|
|
28
|
-
}
|
|
29
|
-
return `${osType()} ${osRelease()}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function detectShell(): string {
|
|
33
|
-
const shell =
|
|
34
|
-
process.env.SHELL ||
|
|
35
|
-
process.env.ComSpec ||
|
|
36
|
-
process.env.COMSPEC ||
|
|
37
|
-
"unknown";
|
|
38
|
-
return shell.trim() || "unknown";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function detectGitRepo(startDir: string): boolean {
|
|
42
|
-
let current = startDir;
|
|
43
|
-
while (true) {
|
|
44
|
-
if (existsSync(join(current, ".git"))) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
const parent = dirname(current);
|
|
48
|
-
if (parent === current) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
current = parent;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function detectTimeZone(): string {
|
|
56
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone || "unknown";
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function getEnvironmentPromptContext(): EnvironmentPromptContext {
|
|
60
|
-
const cwd = process.cwd();
|
|
61
|
-
const now = new Date();
|
|
62
|
-
return {
|
|
63
|
-
cwd,
|
|
64
|
-
platform: detectPlatform(),
|
|
65
|
-
osVersion: detectOsVersion(),
|
|
66
|
-
shell: detectShell(),
|
|
67
|
-
isGitRepo: detectGitRepo(cwd),
|
|
68
|
-
currentDateTime: now.toString(),
|
|
69
|
-
timeZone: detectTimeZone(),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Config } from "../config.ts";
|
|
2
|
-
import type { Registry } from "../skills/registry.ts";
|
|
3
|
-
import { Skills } from "./skills.ts";
|
|
4
|
-
import { System, type SystemMode } from "./system.ts";
|
|
5
|
-
|
|
6
|
-
export { Skills, System };
|
|
7
|
-
|
|
8
|
-
export async function system(
|
|
9
|
-
path: string,
|
|
10
|
-
config: Config,
|
|
11
|
-
mode: SystemMode = "default",
|
|
12
|
-
): Promise<System> {
|
|
13
|
-
const prompt = new System(path, config, mode);
|
|
14
|
-
await prompt.reload();
|
|
15
|
-
return prompt;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function skills(registry: Registry): Promise<Skills> {
|
|
19
|
-
const prompt = new Skills(registry);
|
|
20
|
-
await prompt.reload();
|
|
21
|
-
return prompt;
|
|
22
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import type { Registry } from "../skills/registry.ts";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Builds the dynamic **Available skills** markdown block using
|
|
7
|
-
* {@link Registry.list} (same source as the skills CLI).
|
|
8
|
-
*
|
|
9
|
-
* Mirrors {@link System}: call {@link reload}, then read {@link content}.
|
|
10
|
-
*/
|
|
11
|
-
export class Skills {
|
|
12
|
-
private readonly registry: Registry;
|
|
13
|
-
private data = "";
|
|
14
|
-
|
|
15
|
-
public constructor(registry: Registry) {
|
|
16
|
-
this.registry = registry;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get content(): string {
|
|
20
|
-
return this.data;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async reload(): Promise<void> {
|
|
24
|
-
let entries;
|
|
25
|
-
try {
|
|
26
|
-
entries = await this.registry.list();
|
|
27
|
-
} catch {
|
|
28
|
-
this.data = [
|
|
29
|
-
"## Available skills",
|
|
30
|
-
"",
|
|
31
|
-
"The skills list could not be loaded (for example if `npx skills` is unavailable). Skills management tools may still work; try again later.",
|
|
32
|
-
"",
|
|
33
|
-
].join("\n");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const lines: string[] = [
|
|
38
|
-
"## Available skills",
|
|
39
|
-
"",
|
|
40
|
-
"Installed skills for this environment. When one matches the user's request or would materially help the current turn, read its `SKILL.md` at the path shown (for example with your file-reading tool) and follow that guidance.",
|
|
41
|
-
"",
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
if (entries.length === 0) {
|
|
45
|
-
lines.push(
|
|
46
|
-
"No skills are installed yet. Use the skills management tools to search and install packages, or add them under your agent skills directory.",
|
|
47
|
-
"",
|
|
48
|
-
);
|
|
49
|
-
this.data = lines.join("\n").trim();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const sorted = [...entries].sort((a, b) =>
|
|
54
|
-
a.name.localeCompare(b.name, undefined, { sensitivity: "base" }),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
for (const e of sorted) {
|
|
58
|
-
lines.push(`- **${e.name}**`);
|
|
59
|
-
lines.push(` - Description: ${e.description}`);
|
|
60
|
-
lines.push(` - Path: \`${e.path}\``);
|
|
61
|
-
lines.push("");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.data = lines.join("\n").trim();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { compile } from "handlebars";
|
|
5
|
-
import type { Config } from "../config.ts";
|
|
6
|
-
import { getEnvironmentPromptContext } from "./environment.ts";
|
|
7
|
-
|
|
8
|
-
/** Bundled markdown next to this module (`prompts/static/`). */
|
|
9
|
-
const STATIC_PROMPT_FILES = [
|
|
10
|
-
"identity.md",
|
|
11
|
-
"environment.md",
|
|
12
|
-
"ltm.md",
|
|
13
|
-
"todo.md",
|
|
14
|
-
"thinking.md",
|
|
15
|
-
"filesystem.md",
|
|
16
|
-
"fetch.md",
|
|
17
|
-
"web-search.md",
|
|
18
|
-
"shell.md",
|
|
19
|
-
"sleep.md",
|
|
20
|
-
"daemon.md",
|
|
21
|
-
"wiki.md",
|
|
22
|
-
"skills.md",
|
|
23
|
-
"subagents.md",
|
|
24
|
-
] as const;
|
|
25
|
-
|
|
26
|
-
const HARNESS_PROMPT_FILES = [
|
|
27
|
-
{ key: "behaviour", file: "behaviour.md" },
|
|
28
|
-
{ key: "communication", file: "communication.md" },
|
|
29
|
-
{ key: "execution", file: "execution.md" },
|
|
30
|
-
{ key: "engineering", file: "engineering.md" },
|
|
31
|
-
{ key: "guardrails", file: "guardrails.md" },
|
|
32
|
-
] as const;
|
|
33
|
-
|
|
34
|
-
export type SystemMode = "default" | "daemon" | "acp";
|
|
35
|
-
|
|
36
|
-
const SECTION_BREAK = "\n\n---\n\n";
|
|
37
|
-
const EXTRA_CWD_INSTRUCTIONS = "AGENTS.md";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Loads `prompts/static/*.md` from the package, then `instructions.md` from disk,
|
|
41
|
-
* concatenates them, and renders with Handlebars using `context`.
|
|
42
|
-
*/
|
|
43
|
-
export class System {
|
|
44
|
-
private readonly path: string;
|
|
45
|
-
private readonly config: Config;
|
|
46
|
-
private readonly mode: SystemMode;
|
|
47
|
-
private data = "";
|
|
48
|
-
|
|
49
|
-
public constructor(
|
|
50
|
-
path: string,
|
|
51
|
-
config: Config,
|
|
52
|
-
mode: SystemMode = "default",
|
|
53
|
-
) {
|
|
54
|
-
this.path = path;
|
|
55
|
-
this.config = config;
|
|
56
|
-
this.mode = mode;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private staticPromptFiles(): readonly (typeof STATIC_PROMPT_FILES)[number][] {
|
|
60
|
-
return STATIC_PROMPT_FILES.filter((file) => {
|
|
61
|
-
switch (file) {
|
|
62
|
-
case "ltm.md":
|
|
63
|
-
return this.config.tools.ltm.enabled;
|
|
64
|
-
case "fetch.md":
|
|
65
|
-
return this.config.tools.fetch.enabled;
|
|
66
|
-
case "web-search.md":
|
|
67
|
-
return this.config.search.enabled;
|
|
68
|
-
case "todo.md":
|
|
69
|
-
return this.config.tools.todo.enabled;
|
|
70
|
-
case "filesystem.md":
|
|
71
|
-
return this.config.tools.filesystem.enabled;
|
|
72
|
-
case "shell.md":
|
|
73
|
-
return this.config.tools.shell.enabled;
|
|
74
|
-
case "sleep.md":
|
|
75
|
-
return this.config.tools.sleep.enabled;
|
|
76
|
-
case "daemon.md":
|
|
77
|
-
return this.mode === "daemon";
|
|
78
|
-
case "wiki.md":
|
|
79
|
-
return this.config.tools.wiki.enabled;
|
|
80
|
-
case "skills.md":
|
|
81
|
-
return this.config.tools.skills.enabled;
|
|
82
|
-
case "subagents.md":
|
|
83
|
-
return this.config.tools.agents.enabled;
|
|
84
|
-
case "thinking.md":
|
|
85
|
-
default:
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private readBundledStaticPrompts(): string {
|
|
92
|
-
const dir = join(dirname(fileURLToPath(import.meta.url)), "static");
|
|
93
|
-
const parts: string[] = [];
|
|
94
|
-
for (const file of this.staticPromptFiles()) {
|
|
95
|
-
const full = join(dir, file);
|
|
96
|
-
if (!existsSync(full)) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
const text = readFileSync(full, "utf8").trim();
|
|
100
|
-
if (text.length > 0) {
|
|
101
|
-
parts.push(text);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return parts.join("\n\n");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private readBundledHarnessPrompts(): string {
|
|
108
|
-
const dir = join(dirname(fileURLToPath(import.meta.url)), "harness");
|
|
109
|
-
const parts: string[] = [];
|
|
110
|
-
for (const { key, file } of HARNESS_PROMPT_FILES) {
|
|
111
|
-
if (!this.config.prompts[key]) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const full = join(dir, file);
|
|
115
|
-
if (!existsSync(full)) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const text = readFileSync(full, "utf8").trim();
|
|
119
|
-
if (text.length > 0) {
|
|
120
|
-
parts.push(text);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return parts.join("\n\n");
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private readCwdAgentsInstructions(): string {
|
|
127
|
-
const path = join(process.cwd(), EXTRA_CWD_INSTRUCTIONS);
|
|
128
|
-
if (!existsSync(path)) {
|
|
129
|
-
return "";
|
|
130
|
-
}
|
|
131
|
-
return readFileSync(path, "utf8").trim();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private readRawText(): string {
|
|
135
|
-
const instructions = existsSync(this.path)
|
|
136
|
-
? readFileSync(this.path, "utf8").trim()
|
|
137
|
-
: "";
|
|
138
|
-
const bundled = this.readBundledStaticPrompts();
|
|
139
|
-
const harness = this.readBundledHarnessPrompts();
|
|
140
|
-
const extra = this.readCwdAgentsInstructions();
|
|
141
|
-
|
|
142
|
-
const blocks: string[] = [];
|
|
143
|
-
if (bundled.length > 0) {
|
|
144
|
-
blocks.push(bundled);
|
|
145
|
-
}
|
|
146
|
-
if (harness.length > 0) {
|
|
147
|
-
blocks.push(harness);
|
|
148
|
-
}
|
|
149
|
-
if (instructions.length > 0) {
|
|
150
|
-
blocks.push(instructions);
|
|
151
|
-
}
|
|
152
|
-
if (extra.length > 0) {
|
|
153
|
-
blocks.push(extra);
|
|
154
|
-
}
|
|
155
|
-
if (blocks.length === 0) {
|
|
156
|
-
return "";
|
|
157
|
-
}
|
|
158
|
-
return blocks.join(SECTION_BREAK);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
get content(): string {
|
|
162
|
-
return this.data;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** Plain object for Handlebars (`{{name}}`, `{{llm.model}}`, …). */
|
|
166
|
-
private context(): Record<string, unknown> {
|
|
167
|
-
return {
|
|
168
|
-
name: this.config.name,
|
|
169
|
-
llm: this.config.llm,
|
|
170
|
-
environment: getEnvironmentPromptContext(),
|
|
171
|
-
ltm: this.config.tools.ltm,
|
|
172
|
-
wiki: this.config.tools.wiki,
|
|
173
|
-
compaction: this.config.compaction,
|
|
174
|
-
mode: this.mode,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public async reload(): Promise<void> {
|
|
179
|
-
const raw = this.readRawText();
|
|
180
|
-
const template = compile(raw);
|
|
181
|
-
this.data = template(this.context()).trim();
|
|
182
|
-
}
|
|
183
|
-
}
|
package/src/core/skills/index.ts
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
import { readFile, rm } from "node:fs/promises";
|
|
4
|
-
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
5
|
-
import matter from "gray-matter";
|
|
6
|
-
|
|
7
|
-
const execFileAsync = promisify(execFile);
|
|
8
|
-
|
|
9
|
-
/** Vercel `skills` CLI package; uses latest every time. */
|
|
10
|
-
const SKILLS_CLI = "skills@latest";
|
|
11
|
-
/** Agent target for `skills add/list` — OpenClaw layout → `./skills/`. */
|
|
12
|
-
const SKILLS_AGENT = "openclaw";
|
|
13
|
-
const SKILLS_API_URL = "https://skills.sh";
|
|
14
|
-
const NPX_BIN = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
15
|
-
|
|
16
|
-
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Parse name and description from a SKILL.md file's YAML frontmatter.
|
|
20
|
-
*/
|
|
21
|
-
function parseSkillFrontmatter(
|
|
22
|
-
content: string,
|
|
23
|
-
dirName: string,
|
|
24
|
-
): { name: string; description?: string } {
|
|
25
|
-
try {
|
|
26
|
-
const { data } = matter(content);
|
|
27
|
-
const name =
|
|
28
|
-
typeof data?.name === "string" && data.name.trim()
|
|
29
|
-
? data.name.trim()
|
|
30
|
-
: dirName;
|
|
31
|
-
const description =
|
|
32
|
-
typeof data?.description === "string" && data.description.trim()
|
|
33
|
-
? data.description.trim()
|
|
34
|
-
: undefined;
|
|
35
|
-
return { name, description };
|
|
36
|
-
} catch {
|
|
37
|
-
return { name: dirName };
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function stripAnsi(s: string): string {
|
|
42
|
-
return s.replace(ANSI_RE, "");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type SkillsListJsonRow = {
|
|
46
|
-
name: string;
|
|
47
|
-
path: string;
|
|
48
|
-
scope?: string;
|
|
49
|
-
agents?: string[];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type SkillListEntry = {
|
|
53
|
-
/** Display title (skill `name` from SKILL.md) */
|
|
54
|
-
name: string;
|
|
55
|
-
/** Full description read using gray-matter */
|
|
56
|
-
description?: string;
|
|
57
|
-
/** Absolute path to the skill package root from `skills list --json`. */
|
|
58
|
-
path: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export interface SkillSearchResult {
|
|
62
|
-
name: string;
|
|
63
|
-
slug: string;
|
|
64
|
-
source: string;
|
|
65
|
-
installs: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function runNpxSkills(
|
|
69
|
-
args: string[],
|
|
70
|
-
options: { cwd?: string; timeout?: number } = {},
|
|
71
|
-
): Promise<{ stdout: string; stderr: string }> {
|
|
72
|
-
const { cwd, timeout = 300_000 } = options;
|
|
73
|
-
return execFileAsync(NPX_BIN, ["--yes", SKILLS_CLI, ...args], {
|
|
74
|
-
cwd,
|
|
75
|
-
maxBuffer: 20 * 1024 * 1024,
|
|
76
|
-
timeout,
|
|
77
|
-
env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" },
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Install / list / delete skills via the Vercel [`skills` CLI](https://github.com/vercel-labs/skills)
|
|
83
|
-
* (`npx skills`), using OpenClaw scope (`./skills/`).
|
|
84
|
-
*/
|
|
85
|
-
export class Registry {
|
|
86
|
-
private readonly cwd: string;
|
|
87
|
-
|
|
88
|
-
constructor(cwd: string) {
|
|
89
|
-
this.cwd = cwd;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async list(): Promise<SkillListEntry[]> {
|
|
93
|
-
let stdout: string;
|
|
94
|
-
try {
|
|
95
|
-
const r = await runNpxSkills(["list", "--json", "-a", SKILLS_AGENT], {
|
|
96
|
-
cwd: this.cwd,
|
|
97
|
-
});
|
|
98
|
-
stdout = r.stdout;
|
|
99
|
-
} catch (e) {
|
|
100
|
-
const err = e as { stderr?: string; message?: string };
|
|
101
|
-
const detail = err.stderr ?? err.message ?? String(e);
|
|
102
|
-
throw new Error(
|
|
103
|
-
`skills list failed. Is Node/npm available?\n${stripAnsi(detail)}`,
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
const text = stdout.trim();
|
|
107
|
-
if (!text) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
let rows: SkillsListJsonRow[];
|
|
111
|
-
try {
|
|
112
|
-
rows = JSON.parse(text) as SkillsListJsonRow[];
|
|
113
|
-
} catch {
|
|
114
|
-
throw new Error(
|
|
115
|
-
`Unexpected skills list output (expected JSON):\n${text.slice(0, 500)}`,
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
if (!Array.isArray(rows)) {
|
|
119
|
-
return [];
|
|
120
|
-
}
|
|
121
|
-
const entries: SkillListEntry[] = [];
|
|
122
|
-
for (const row of rows) {
|
|
123
|
-
try {
|
|
124
|
-
const folder = basename(row.path);
|
|
125
|
-
const root = isAbsolute(row.path)
|
|
126
|
-
? resolve(row.path)
|
|
127
|
-
: resolve(this.cwd, row.path);
|
|
128
|
-
const md = resolve(join(root, "SKILL.md"));
|
|
129
|
-
const raw = await readFile(md, "utf-8");
|
|
130
|
-
const { name, description } = parseSkillFrontmatter(raw, folder);
|
|
131
|
-
entries.push({
|
|
132
|
-
name,
|
|
133
|
-
description,
|
|
134
|
-
path: md,
|
|
135
|
-
});
|
|
136
|
-
} catch {
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return entries;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* `skills add <source> -y -a openclaw --copy` — supports owner/repo, Git URLs with tree paths, local paths, etc.
|
|
145
|
-
*/
|
|
146
|
-
async install(source: string): Promise<void> {
|
|
147
|
-
const raw = source.trim();
|
|
148
|
-
if (!raw) {
|
|
149
|
-
throw new Error(
|
|
150
|
-
"Enter a skill source (e.g. owner/repo or a GitHub URL).",
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
await runNpxSkills(["add", raw, "-y", "-a", SKILLS_AGENT, "--copy"], {
|
|
155
|
-
cwd: this.cwd,
|
|
156
|
-
timeout: 600_000,
|
|
157
|
-
});
|
|
158
|
-
} catch (e) {
|
|
159
|
-
const err = e as { stderr?: string; stdout?: string; message?: string };
|
|
160
|
-
const detail = stripAnsi(
|
|
161
|
-
err.stderr || err.stdout || err.message || String(e),
|
|
162
|
-
);
|
|
163
|
-
throw new Error(`skills add failed:\n${detail}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Remove by on-disk folder name (basename of `path` from `skills list --json`).
|
|
169
|
-
*
|
|
170
|
-
* We do **not** pass `--agent` so removal matches the CLI’s universal layout behavior.
|
|
171
|
-
*/
|
|
172
|
-
async delete(folder: string): Promise<void> {
|
|
173
|
-
const safe = folder.trim();
|
|
174
|
-
if (!safe || /[\\/]/.test(safe) || safe.includes("..")) {
|
|
175
|
-
throw new Error("Invalid skill name.");
|
|
176
|
-
}
|
|
177
|
-
try {
|
|
178
|
-
await runNpxSkills(["remove", safe, "-y"], { cwd: this.cwd });
|
|
179
|
-
} catch (e) {
|
|
180
|
-
const err = e as { stderr?: string; stdout?: string; message?: string };
|
|
181
|
-
const detail = stripAnsi(
|
|
182
|
-
err.stderr || err.stdout || err.message || String(e),
|
|
183
|
-
);
|
|
184
|
-
throw new Error(`skills remove failed:\n${detail}`);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
await rm(join(this.cwd, "skills", safe), {
|
|
188
|
-
recursive: true,
|
|
189
|
-
force: true,
|
|
190
|
-
}).catch(() => {});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Search the public catalog at skills.sh (same API as the `skills` CLI `find` command).
|
|
195
|
-
*/
|
|
196
|
-
async search(query: string): Promise<SkillSearchResult[]> {
|
|
197
|
-
const q = query.trim();
|
|
198
|
-
if (!q) {
|
|
199
|
-
throw new Error("Enter a search term for the skills catalog.");
|
|
200
|
-
}
|
|
201
|
-
if (q.length < 2) {
|
|
202
|
-
throw new Error("Use at least 2 characters to search.");
|
|
203
|
-
}
|
|
204
|
-
try {
|
|
205
|
-
const url = `${SKILLS_API_URL}/api/search?q=${encodeURIComponent(q)}&limit=10`;
|
|
206
|
-
const res = await fetch(url);
|
|
207
|
-
if (!res.ok) {
|
|
208
|
-
return [];
|
|
209
|
-
}
|
|
210
|
-
const data = (await res.json()) as {
|
|
211
|
-
skills: Array<{
|
|
212
|
-
skillId: string;
|
|
213
|
-
name: string;
|
|
214
|
-
installs: number;
|
|
215
|
-
source: string;
|
|
216
|
-
}>;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
if (!Array.isArray(data.skills)) {
|
|
220
|
-
throw new Error("Skills search did not return .skills[] in response");
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return data.skills
|
|
224
|
-
.map((skill) => ({
|
|
225
|
-
name: skill.name,
|
|
226
|
-
slug: `${skill.source.trim()}@${skill.skillId.trim()}`,
|
|
227
|
-
source: skill.source || "",
|
|
228
|
-
installs: skill.installs,
|
|
229
|
-
}))
|
|
230
|
-
.sort((a, b) => (b.installs || 0) - (a.installs || 0));
|
|
231
|
-
} catch {
|
|
232
|
-
return [];
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export function create(cwd: string) {
|
|
238
|
-
return new Registry(cwd);
|
|
239
|
-
}
|
package/src/core/skills/tools.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { tool } from "@strands-agents/sdk";
|
|
2
|
-
import type { JSONValue } from "@strands-agents/sdk";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import type { Registry } from "./registry.ts";
|
|
5
|
-
|
|
6
|
-
function toJsonValue(value: unknown): JSONValue {
|
|
7
|
-
return JSON.parse(JSON.stringify(value)) as JSONValue;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function create(registry: Registry) {
|
|
11
|
-
return [
|
|
12
|
-
tool({
|
|
13
|
-
name: "list_skills",
|
|
14
|
-
description:
|
|
15
|
-
"List currently installed skills available to the local agent.",
|
|
16
|
-
inputSchema: z.object({}),
|
|
17
|
-
callback: async () => {
|
|
18
|
-
const skills = await registry.list();
|
|
19
|
-
return toJsonValue({
|
|
20
|
-
count: skills.length,
|
|
21
|
-
skills,
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
25
|
-
tool({
|
|
26
|
-
name: "search_skills",
|
|
27
|
-
description:
|
|
28
|
-
"Search the public skills catalog for skills matching a query.",
|
|
29
|
-
inputSchema: z.object({
|
|
30
|
-
query: z
|
|
31
|
-
.string()
|
|
32
|
-
.min(2)
|
|
33
|
-
.describe("Search query for the public skills catalog."),
|
|
34
|
-
}),
|
|
35
|
-
callback: async (input) => {
|
|
36
|
-
const results = await registry.search(input.query);
|
|
37
|
-
return toJsonValue({
|
|
38
|
-
count: results.length,
|
|
39
|
-
results,
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
tool({
|
|
44
|
-
name: "install_skill",
|
|
45
|
-
description:
|
|
46
|
-
"Install a skill from a source such as owner/repo, a GitHub URL, or a local path.",
|
|
47
|
-
inputSchema: z.object({
|
|
48
|
-
source: z
|
|
49
|
-
.string()
|
|
50
|
-
.min(1)
|
|
51
|
-
.describe("Skill source to install (repo, URL, or local path)."),
|
|
52
|
-
}),
|
|
53
|
-
callback: async (input) => {
|
|
54
|
-
await registry.install(input.source);
|
|
55
|
-
return toJsonValue({
|
|
56
|
-
installed: true,
|
|
57
|
-
source: input.source,
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
tool({
|
|
62
|
-
name: "delete_skill",
|
|
63
|
-
description:
|
|
64
|
-
"Delete an installed skill by its folder name under the local skills directory.",
|
|
65
|
-
inputSchema: z.object({
|
|
66
|
-
folder: z
|
|
67
|
-
.string()
|
|
68
|
-
.min(1)
|
|
69
|
-
.describe("Installed skill folder name to remove."),
|
|
70
|
-
}),
|
|
71
|
-
callback: async (input) => {
|
|
72
|
-
await registry.delete(input.folder);
|
|
73
|
-
return toJsonValue({
|
|
74
|
-
deleted: true,
|
|
75
|
-
folder: input.folder,
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
}),
|
|
79
|
-
];
|
|
80
|
-
}
|