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
package/src/core/mcp/manager.ts
DELETED
|
@@ -1,491 +0,0 @@
|
|
|
1
|
-
import { McpClient, type Tool } from "@strands-agents/sdk";
|
|
2
|
-
import { PrefixedMcpTool } from "./prefixed-mcp-tool.ts";
|
|
3
|
-
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
4
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
5
|
-
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
6
|
-
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
7
|
-
import { get } from "lodash";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
import { Config, type NamedMcpTransport } from "./config.ts";
|
|
10
|
-
import type { McpTransport } from "./types.ts";
|
|
11
|
-
import { normalizeAttachmentPaths } from "../utils/attachments.ts";
|
|
12
|
-
|
|
13
|
-
export const HOOMAN_CHANNEL = "hooman/channel";
|
|
14
|
-
export const HOOMAN_CHANNEL_PERMISSION = "hooman/channel/permission";
|
|
15
|
-
const HOOMAN_CHANNEL_PERMISSION_METHOD = `notifications/${HOOMAN_CHANNEL_PERMISSION}`;
|
|
16
|
-
|
|
17
|
-
export type ChannelMessageMeta = {
|
|
18
|
-
subscription: ChannelSubscription;
|
|
19
|
-
source?: string;
|
|
20
|
-
user?: string;
|
|
21
|
-
session?: string;
|
|
22
|
-
thread?: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type ChannelMessage = {
|
|
26
|
-
prompt: string;
|
|
27
|
-
attachments: string[];
|
|
28
|
-
meta: ChannelMessageMeta;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type ChannelPermissionBehavior = "allow_once" | "allow_always" | "deny";
|
|
32
|
-
|
|
33
|
-
export type ChannelSubscription = {
|
|
34
|
-
server: string;
|
|
35
|
-
channel: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type ChannelSubscriptionHandle = {
|
|
39
|
-
unsubscribe: () => void;
|
|
40
|
-
subscriptions: ChannelSubscription[];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
type ChannelPermissionRequest = {
|
|
44
|
-
requestId: string;
|
|
45
|
-
tool: string;
|
|
46
|
-
description: string;
|
|
47
|
-
preview: string;
|
|
48
|
-
source?: string;
|
|
49
|
-
user?: string;
|
|
50
|
-
session?: string;
|
|
51
|
-
thread?: string;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
function transportFor(spec: McpTransport): Transport {
|
|
55
|
-
switch (spec.type) {
|
|
56
|
-
case "stdio":
|
|
57
|
-
return new StdioClientTransport({
|
|
58
|
-
command: spec.command,
|
|
59
|
-
args: spec.args,
|
|
60
|
-
env: spec.env,
|
|
61
|
-
cwd: spec.cwd,
|
|
62
|
-
stderr: "ignore",
|
|
63
|
-
});
|
|
64
|
-
case "streamable-http": {
|
|
65
|
-
const headers = spec.headers;
|
|
66
|
-
return new StreamableHTTPClientTransport(new URL(spec.url), {
|
|
67
|
-
requestInit: headers ? { headers } : undefined,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
case "sse": {
|
|
71
|
-
const headers = spec.headers;
|
|
72
|
-
return new SSEClientTransport(new URL(spec.url), {
|
|
73
|
-
requestInit: headers ? { headers } : undefined,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
default: {
|
|
77
|
-
const _exhaustive: never = spec;
|
|
78
|
-
return _exhaustive;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function readPathValue(
|
|
84
|
-
value: unknown,
|
|
85
|
-
path: string | undefined,
|
|
86
|
-
): string | undefined {
|
|
87
|
-
const key = path?.trim();
|
|
88
|
-
if (!key) {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const current = get(value, key);
|
|
93
|
-
if (typeof current !== "string") {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const trimmed = current.trim();
|
|
98
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function readIdentityPath(
|
|
102
|
-
experimental: unknown,
|
|
103
|
-
key: "hooman/user" | "hooman/session" | "hooman/thread",
|
|
104
|
-
): string | undefined {
|
|
105
|
-
const path = get(experimental, [key, "path"]);
|
|
106
|
-
return typeof path === "string" && path.trim().length > 0
|
|
107
|
-
? path.trim()
|
|
108
|
-
: undefined;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function readSourceValue(value: unknown): string | undefined {
|
|
112
|
-
return readPathValue(value, "meta.source");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function readAttachmentsFromParams(params: unknown): string[] {
|
|
116
|
-
if (!params || typeof params !== "object") {
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
const topLevel = (params as { attachments?: unknown }).attachments;
|
|
120
|
-
return normalizeAttachmentPaths(topLevel);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Holds one {@link McpClient} per named entry in {@link Config}. Call {@link reload}
|
|
125
|
-
* after changing the file on disk (or construct and then {@link reload} once).
|
|
126
|
-
*/
|
|
127
|
-
export class Manager {
|
|
128
|
-
private instances: Map<string, McpClient> | null = null;
|
|
129
|
-
private readonly permissions = new Map<
|
|
130
|
-
string,
|
|
131
|
-
{
|
|
132
|
-
resolve: (behavior: ChannelPermissionBehavior) => void;
|
|
133
|
-
reject: (reason: Error) => void;
|
|
134
|
-
timer: ReturnType<typeof setTimeout>;
|
|
135
|
-
}
|
|
136
|
-
>();
|
|
137
|
-
|
|
138
|
-
public constructor(
|
|
139
|
-
private readonly config: Config,
|
|
140
|
-
private readonly acp = false,
|
|
141
|
-
private readonly servers: readonly NamedMcpTransport[] = [],
|
|
142
|
-
) {}
|
|
143
|
-
|
|
144
|
-
/** Lazily builds clients from the current in-memory config (reloads file first). */
|
|
145
|
-
get clients(): ReadonlyMap<string, McpClient> {
|
|
146
|
-
if (this.instances === null) {
|
|
147
|
-
this.reload();
|
|
148
|
-
}
|
|
149
|
-
return this.instances!;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Rereads the config file, replaces all clients, and best-effort disconnects
|
|
154
|
-
* previous clients (stdio subprocesses, HTTP sessions).
|
|
155
|
-
*/
|
|
156
|
-
public reload(): void {
|
|
157
|
-
if (!this.acp) {
|
|
158
|
-
this.config.reload();
|
|
159
|
-
}
|
|
160
|
-
const previous = this.instances;
|
|
161
|
-
const next = new Map<string, McpClient>();
|
|
162
|
-
const transports = [
|
|
163
|
-
...(this.acp ? [] : this.config.list()),
|
|
164
|
-
// Session-scoped servers override local config entries on name conflicts.
|
|
165
|
-
...this.servers,
|
|
166
|
-
];
|
|
167
|
-
for (const { name, transport } of transports) {
|
|
168
|
-
next.set(
|
|
169
|
-
name,
|
|
170
|
-
new McpClient({
|
|
171
|
-
transport: transportFor(transport),
|
|
172
|
-
}),
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
this.instances = next;
|
|
176
|
-
if (previous?.size) {
|
|
177
|
-
for (const client of previous.values()) {
|
|
178
|
-
void client.disconnect().catch(() => {});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public async disconnect(): Promise<void> {
|
|
184
|
-
for (const [key, pending] of this.permissions.entries()) {
|
|
185
|
-
clearTimeout(pending.timer);
|
|
186
|
-
pending.reject(new Error(`Pending permission "${key}" cancelled.`));
|
|
187
|
-
}
|
|
188
|
-
this.permissions.clear();
|
|
189
|
-
const toClose = this.instances;
|
|
190
|
-
this.instances = null;
|
|
191
|
-
if (!toClose?.size) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
await Promise.all(
|
|
195
|
-
[...toClose.values()].map((c) => c.disconnect().catch(() => undefined)),
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Lists tools from every configured MCP client with names prefixed by a
|
|
201
|
-
* slugified server config key (see {@link PrefixedMcpTool}).
|
|
202
|
-
*/
|
|
203
|
-
public async listPrefixedTools(): Promise<Tool[]> {
|
|
204
|
-
if (this.instances === null) {
|
|
205
|
-
this.reload();
|
|
206
|
-
}
|
|
207
|
-
const map = this.instances!;
|
|
208
|
-
const batches = await Promise.all(
|
|
209
|
-
[...map.entries()].map(async ([server, client]) =>
|
|
210
|
-
client
|
|
211
|
-
.listTools()
|
|
212
|
-
.then((tools) => tools.map((t) => new PrefixedMcpTool(server, t))),
|
|
213
|
-
),
|
|
214
|
-
);
|
|
215
|
-
return batches.flat();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Collects optional server-level instructions from each connected MCP server.
|
|
220
|
-
*/
|
|
221
|
-
public async listServerInstructions(): Promise<string[]> {
|
|
222
|
-
if (this.instances === null) {
|
|
223
|
-
this.reload();
|
|
224
|
-
}
|
|
225
|
-
const map = this.instances!;
|
|
226
|
-
const rows = await Promise.all(
|
|
227
|
-
[...map.entries()].map(async ([server, client]) => {
|
|
228
|
-
await client.connect();
|
|
229
|
-
const instructions = client.client.getInstructions()?.trim();
|
|
230
|
-
if (!instructions) {
|
|
231
|
-
return "";
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return [`MCP server "${server}" instructions:`, "", instructions].join(
|
|
235
|
-
"\n",
|
|
236
|
-
);
|
|
237
|
-
}),
|
|
238
|
-
);
|
|
239
|
-
return rows.filter(Boolean);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
public async subscribeToChannels(
|
|
243
|
-
channels: readonly string[],
|
|
244
|
-
onMessage: (message: ChannelMessage) => void,
|
|
245
|
-
): Promise<ChannelSubscriptionHandle> {
|
|
246
|
-
if (this.instances === null) {
|
|
247
|
-
this.reload();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const map = this.instances!;
|
|
251
|
-
const requested = [
|
|
252
|
-
...new Set(channels.map((c) => c.trim()).filter(Boolean)),
|
|
253
|
-
];
|
|
254
|
-
if (requested.length === 0) {
|
|
255
|
-
return { unsubscribe: () => {}, subscriptions: [] };
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const unsubs: Array<() => void> = [];
|
|
259
|
-
const subscriptions: ChannelSubscription[] = [];
|
|
260
|
-
for (const [server, client] of map.entries()) {
|
|
261
|
-
await client.connect();
|
|
262
|
-
const experimental =
|
|
263
|
-
client.client.getServerCapabilities()?.experimental ?? {};
|
|
264
|
-
const user = readIdentityPath(experimental, "hooman/user");
|
|
265
|
-
const session = readIdentityPath(experimental, "hooman/session");
|
|
266
|
-
const thread = readIdentityPath(experimental, "hooman/thread");
|
|
267
|
-
const supportsPermission =
|
|
268
|
-
Boolean(get(experimental, [HOOMAN_CHANNEL_PERMISSION])) &&
|
|
269
|
-
typeof (client.client as { setNotificationHandler?: unknown })
|
|
270
|
-
.setNotificationHandler === "function";
|
|
271
|
-
|
|
272
|
-
if (supportsPermission) {
|
|
273
|
-
const schema = z.object({
|
|
274
|
-
method: z.literal(HOOMAN_CHANNEL_PERMISSION_METHOD),
|
|
275
|
-
params: z.object({
|
|
276
|
-
request_id: z.string().min(1),
|
|
277
|
-
behavior: z.enum(["allow_once", "allow_always", "deny"]),
|
|
278
|
-
}),
|
|
279
|
-
});
|
|
280
|
-
const handler = (notification: {
|
|
281
|
-
params?: {
|
|
282
|
-
request_id?: string;
|
|
283
|
-
behavior?: ChannelPermissionBehavior;
|
|
284
|
-
};
|
|
285
|
-
}) => {
|
|
286
|
-
const requestId = notification.params?.request_id?.trim();
|
|
287
|
-
const behavior = notification.params?.behavior;
|
|
288
|
-
if (!requestId || !behavior) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
const key = `${server}:${requestId}`;
|
|
292
|
-
const pending = this.permissions.get(key);
|
|
293
|
-
if (!pending) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
this.permissions.delete(key);
|
|
297
|
-
clearTimeout(pending.timer);
|
|
298
|
-
pending.resolve(behavior);
|
|
299
|
-
};
|
|
300
|
-
client.client.setNotificationHandler(schema, handler);
|
|
301
|
-
unsubs.push(() => {
|
|
302
|
-
client.client.setNotificationHandler(schema, () => {});
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
for (const channel of requested) {
|
|
307
|
-
if (!Object.hasOwn(experimental, channel)) {
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
subscriptions.push({ server, channel });
|
|
312
|
-
|
|
313
|
-
const method = `notifications/${channel}`;
|
|
314
|
-
const schema = z.object({
|
|
315
|
-
method: z.literal(method),
|
|
316
|
-
params: z.unknown().optional(),
|
|
317
|
-
});
|
|
318
|
-
const handler = (notification: {
|
|
319
|
-
method: string;
|
|
320
|
-
params?: unknown;
|
|
321
|
-
}) => {
|
|
322
|
-
const { method, params } = notification;
|
|
323
|
-
const prompt = this.toChannelPrompt(params);
|
|
324
|
-
if (!prompt) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
const attachments = readAttachmentsFromParams(params);
|
|
328
|
-
|
|
329
|
-
onMessage({
|
|
330
|
-
prompt,
|
|
331
|
-
attachments,
|
|
332
|
-
meta: {
|
|
333
|
-
subscription: { server, channel },
|
|
334
|
-
source: readSourceValue(params),
|
|
335
|
-
user: readPathValue(params, user),
|
|
336
|
-
session: readPathValue(params, session),
|
|
337
|
-
thread: readPathValue(params, thread),
|
|
338
|
-
},
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
client.client.setNotificationHandler(schema, handler);
|
|
342
|
-
unsubs.push(() => {
|
|
343
|
-
client.client.setNotificationHandler(schema, () => {});
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return {
|
|
349
|
-
subscriptions,
|
|
350
|
-
unsubscribe: () => {
|
|
351
|
-
for (const off of unsubs) {
|
|
352
|
-
off();
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
public async supportsChannelPermission(server: string): Promise<boolean> {
|
|
359
|
-
if (this.instances === null) {
|
|
360
|
-
this.reload();
|
|
361
|
-
}
|
|
362
|
-
const client = this.instances!.get(server);
|
|
363
|
-
if (!client) {
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
|
-
await client.connect();
|
|
367
|
-
const experimental =
|
|
368
|
-
client.client.getServerCapabilities()?.experimental ?? {};
|
|
369
|
-
return Boolean(get(experimental, [HOOMAN_CHANNEL_PERMISSION]));
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
public async requestChannelPermission(
|
|
373
|
-
server: string,
|
|
374
|
-
request: ChannelPermissionRequest,
|
|
375
|
-
timeoutMs = 120_000,
|
|
376
|
-
): Promise<ChannelPermissionBehavior> {
|
|
377
|
-
if (this.instances === null) {
|
|
378
|
-
this.reload();
|
|
379
|
-
}
|
|
380
|
-
const client = this.instances!.get(server);
|
|
381
|
-
if (!client) {
|
|
382
|
-
throw new Error(`MCP server "${server}" is not connected.`);
|
|
383
|
-
}
|
|
384
|
-
await client.connect();
|
|
385
|
-
const experimental =
|
|
386
|
-
client.client.getServerCapabilities()?.experimental ?? {};
|
|
387
|
-
if (!Object.hasOwn(experimental, HOOMAN_CHANNEL_PERMISSION)) {
|
|
388
|
-
throw new Error(
|
|
389
|
-
`MCP server "${server}" does not support ${HOOMAN_CHANNEL_PERMISSION}.`,
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const requestId = request.requestId.trim();
|
|
394
|
-
if (!requestId) {
|
|
395
|
-
throw new Error("requestId is required.");
|
|
396
|
-
}
|
|
397
|
-
const key = `${server}:${requestId}`;
|
|
398
|
-
if (this.permissions.has(key)) {
|
|
399
|
-
throw new Error(`Permission request "${requestId}" is already pending.`);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const response = new Promise<ChannelPermissionBehavior>(
|
|
403
|
-
(resolve, reject) => {
|
|
404
|
-
const timer = setTimeout(() => {
|
|
405
|
-
this.permissions.delete(key);
|
|
406
|
-
reject(
|
|
407
|
-
new Error(
|
|
408
|
-
`Permission request "${requestId}" timed out after ${timeoutMs}ms.`,
|
|
409
|
-
),
|
|
410
|
-
);
|
|
411
|
-
}, timeoutMs);
|
|
412
|
-
this.permissions.set(key, { resolve, reject, timer });
|
|
413
|
-
},
|
|
414
|
-
);
|
|
415
|
-
|
|
416
|
-
try {
|
|
417
|
-
const sender = client.client as {
|
|
418
|
-
notification?: (payload: unknown) => Promise<void>;
|
|
419
|
-
};
|
|
420
|
-
if (typeof sender.notification !== "function") {
|
|
421
|
-
throw new Error(
|
|
422
|
-
`MCP client for "${server}" cannot send notifications.`,
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
await sender.notification({
|
|
426
|
-
method: "notifications/hooman/channel/permission_request",
|
|
427
|
-
params: {
|
|
428
|
-
request_id: requestId,
|
|
429
|
-
tool_name: request.tool,
|
|
430
|
-
description: request.description,
|
|
431
|
-
input_preview: request.preview,
|
|
432
|
-
options: [
|
|
433
|
-
{ id: "allow_once", label: "Allow once" },
|
|
434
|
-
{ id: "allow_always", label: "Always allow" },
|
|
435
|
-
{ id: "deny", label: "Deny" },
|
|
436
|
-
],
|
|
437
|
-
meta: {
|
|
438
|
-
...(request.source ? { source: request.source } : {}),
|
|
439
|
-
...(request.user ? { user: request.user } : {}),
|
|
440
|
-
...(request.session ? { session: request.session } : {}),
|
|
441
|
-
...(request.thread ? { thread: request.thread } : {}),
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
});
|
|
445
|
-
return await response;
|
|
446
|
-
} catch (error) {
|
|
447
|
-
const pending = this.permissions.get(key);
|
|
448
|
-
if (pending) {
|
|
449
|
-
clearTimeout(pending.timer);
|
|
450
|
-
this.permissions.delete(key);
|
|
451
|
-
}
|
|
452
|
-
throw error;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
private toChannelPrompt(params?: unknown): string {
|
|
457
|
-
const parts = [];
|
|
458
|
-
|
|
459
|
-
if (
|
|
460
|
-
params &&
|
|
461
|
-
typeof params === "object" &&
|
|
462
|
-
"content" in params &&
|
|
463
|
-
typeof params.content === "string"
|
|
464
|
-
) {
|
|
465
|
-
parts.push(params.content.trim());
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (
|
|
469
|
-
params &&
|
|
470
|
-
typeof params === "object" &&
|
|
471
|
-
"attachments" in params &&
|
|
472
|
-
Array.isArray(params.attachments) &&
|
|
473
|
-
params.attachments.length > 0
|
|
474
|
-
) {
|
|
475
|
-
parts.push("User sent attachments.");
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (
|
|
479
|
-
params &&
|
|
480
|
-
typeof params === "object" &&
|
|
481
|
-
"event" in params &&
|
|
482
|
-
typeof params.event === "object"
|
|
483
|
-
) {
|
|
484
|
-
parts.push(
|
|
485
|
-
"Raw event data:\n```json\n" + JSON.stringify(params.event) + "\n```",
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return parts.filter(Boolean).join("\n").trim();
|
|
490
|
-
}
|
|
491
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Tool,
|
|
3
|
-
type ToolContext,
|
|
4
|
-
type ToolSpec,
|
|
5
|
-
type ToolStreamGenerator,
|
|
6
|
-
} from "@strands-agents/sdk";
|
|
7
|
-
import slugify from "slugify";
|
|
8
|
-
|
|
9
|
-
function mcpServerPrefix(serverKey: string): string {
|
|
10
|
-
const slug = slugify(serverKey, {
|
|
11
|
-
replacement: "_",
|
|
12
|
-
lower: true,
|
|
13
|
-
strict: true,
|
|
14
|
-
});
|
|
15
|
-
return slug.length > 0 ? slug : "mcp";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Exposes MCP server tools to the model as `slugifiedServerKey__originalName`
|
|
20
|
-
* while delegating execution to the stock SDK tool (correct wire name).
|
|
21
|
-
*/
|
|
22
|
-
export class PrefixedMcpTool extends Tool {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
toolSpec: ToolSpec;
|
|
26
|
-
|
|
27
|
-
public constructor(
|
|
28
|
-
private readonly serverKey: string,
|
|
29
|
-
private readonly inner: Tool,
|
|
30
|
-
) {
|
|
31
|
-
super();
|
|
32
|
-
const prefix = mcpServerPrefix(serverKey);
|
|
33
|
-
this.name = `${prefix}__${inner.name}`;
|
|
34
|
-
this.description = `${inner.description} (MCP server: ${serverKey})`;
|
|
35
|
-
this.toolSpec = {
|
|
36
|
-
...inner.toolSpec,
|
|
37
|
-
name: this.name,
|
|
38
|
-
description: this.description,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
stream(toolContext: ToolContext): ToolStreamGenerator {
|
|
43
|
-
return this.inner.stream(toolContext);
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/core/mcp/tools.ts
DELETED
|
@@ -1,92 +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 { Config } from "./config.ts";
|
|
5
|
-
import { McpTransportSchema } from "./types.ts";
|
|
6
|
-
|
|
7
|
-
function toJsonValue(value: unknown): JSONValue {
|
|
8
|
-
return JSON.parse(JSON.stringify(value)) as JSONValue;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const NamedTransportSchema = z.object({
|
|
12
|
-
name: z.string().min(1).describe("Unique MCP server name."),
|
|
13
|
-
transport: McpTransportSchema.describe(
|
|
14
|
-
"Transport configuration for the MCP server.",
|
|
15
|
-
),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export function createMcpTools(config: Config) {
|
|
19
|
-
return [
|
|
20
|
-
tool({
|
|
21
|
-
name: "list_mcp_servers",
|
|
22
|
-
description:
|
|
23
|
-
"List configured MCP servers from the local MCP config file.",
|
|
24
|
-
inputSchema: z.object({}),
|
|
25
|
-
callback: async () => {
|
|
26
|
-
const servers = config.list();
|
|
27
|
-
return toJsonValue({
|
|
28
|
-
count: servers.length,
|
|
29
|
-
servers,
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
tool({
|
|
34
|
-
name: "get_mcp_server",
|
|
35
|
-
description: "Get a configured MCP server by name.",
|
|
36
|
-
inputSchema: z.object({
|
|
37
|
-
name: z.string().min(1).describe("MCP server name."),
|
|
38
|
-
}),
|
|
39
|
-
callback: async (input) => {
|
|
40
|
-
const transport = config.get(input.name);
|
|
41
|
-
return toJsonValue({
|
|
42
|
-
name: input.name,
|
|
43
|
-
found: transport !== undefined,
|
|
44
|
-
transport: transport ?? null,
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
tool({
|
|
49
|
-
name: "add_mcp_server",
|
|
50
|
-
description:
|
|
51
|
-
"Add a new MCP server configuration to the local MCP config file.",
|
|
52
|
-
inputSchema: NamedTransportSchema,
|
|
53
|
-
callback: async (input) => {
|
|
54
|
-
config.add(input.name, input.transport);
|
|
55
|
-
return toJsonValue({
|
|
56
|
-
added: true,
|
|
57
|
-
name: input.name,
|
|
58
|
-
transport: input.transport,
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
tool({
|
|
63
|
-
name: "update_mcp_server",
|
|
64
|
-
description:
|
|
65
|
-
"Update an existing MCP server configuration in the local MCP config file.",
|
|
66
|
-
inputSchema: NamedTransportSchema,
|
|
67
|
-
callback: async (input) => {
|
|
68
|
-
config.update(input.name, input.transport);
|
|
69
|
-
return toJsonValue({
|
|
70
|
-
updated: true,
|
|
71
|
-
name: input.name,
|
|
72
|
-
transport: input.transport,
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
76
|
-
tool({
|
|
77
|
-
name: "delete_mcp_server",
|
|
78
|
-
description:
|
|
79
|
-
"Delete an MCP server configuration from the local MCP config file.",
|
|
80
|
-
inputSchema: z.object({
|
|
81
|
-
name: z.string().min(1).describe("MCP server name to remove."),
|
|
82
|
-
}),
|
|
83
|
-
callback: async (input) => {
|
|
84
|
-
config.remove(input.name);
|
|
85
|
-
return toJsonValue({
|
|
86
|
-
deleted: true,
|
|
87
|
-
name: input.name,
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
}),
|
|
91
|
-
];
|
|
92
|
-
}
|
package/src/core/mcp/types.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
const headersOrEnvVarsSchema = z.record(z.string(), z.string()).optional();
|
|
4
|
-
|
|
5
|
-
/** MCP stdio server: subprocess with JSON-RPC over stdin/stdout. */
|
|
6
|
-
export const StdioSchema = z.object({
|
|
7
|
-
type: z.literal("stdio"),
|
|
8
|
-
command: z.string().min(1),
|
|
9
|
-
args: z.array(z.string()).optional(),
|
|
10
|
-
env: headersOrEnvVarsSchema,
|
|
11
|
-
cwd: z.string().optional(),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
/** MCP remote server over streamable HTTP (preferred over legacy SSE). */
|
|
15
|
-
export const StreamableHttpSchema = z.object({
|
|
16
|
-
type: z.literal("streamable-http"),
|
|
17
|
-
url: z.url(),
|
|
18
|
-
headers: headersOrEnvVarsSchema,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
/** MCP remote server over SSE + POST messages (legacy transport). */
|
|
22
|
-
export const SseSchema = z.object({
|
|
23
|
-
type: z.literal("sse"),
|
|
24
|
-
url: z.url(),
|
|
25
|
-
headers: headersOrEnvVarsSchema,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const McpTransportSchema = z.discriminatedUnion("type", [
|
|
29
|
-
StdioSchema,
|
|
30
|
-
StreamableHttpSchema,
|
|
31
|
-
SseSchema,
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
export type Stdio = z.infer<typeof StdioSchema>;
|
|
35
|
-
export type StreamableHttp = z.infer<typeof StreamableHttpSchema>;
|
|
36
|
-
export type Sse = z.infer<typeof SseSchema>;
|
|
37
|
-
export type McpTransport = z.infer<typeof McpTransportSchema>;
|
package/src/core/memory/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { create as createShortTermMemory } from "./stm";
|
|
2
|
-
export {
|
|
3
|
-
createLongTermMemoryStore,
|
|
4
|
-
createLongTermMemoryTools,
|
|
5
|
-
LongTermMemoryStore,
|
|
6
|
-
} from "./ltm";
|
|
7
|
-
export type {
|
|
8
|
-
ArchiveMemoryInput,
|
|
9
|
-
LongTermMemoryOptions,
|
|
10
|
-
LongTermMemoryScope,
|
|
11
|
-
MemorySource,
|
|
12
|
-
SearchMemoryInput,
|
|
13
|
-
SearchMemoryResult,
|
|
14
|
-
StoreMemoryInput,
|
|
15
|
-
StoreMemoryResult,
|
|
16
|
-
UpdateMemoryInput,
|
|
17
|
-
} from "./ltm";
|