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/acp/approvals.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { AgentSideConnection } from "@agentclientprotocol/sdk";
|
|
2
|
-
import { BeforeToolCallEvent, type HookCallback } from "@strands-agents/sdk";
|
|
3
|
-
import {
|
|
4
|
-
INTERNAL_ALWAYS_ALLOWED,
|
|
5
|
-
allowToolForSession,
|
|
6
|
-
isToolSessionAllowed,
|
|
7
|
-
} from "../core/state/tool-approvals.ts";
|
|
8
|
-
import { inferToolKind, toolDisplayTitle } from "./utils/tool-kind.ts";
|
|
9
|
-
import { toolCallLocationsFromInput } from "./utils/tool-locations.ts";
|
|
10
|
-
|
|
11
|
-
export function createAcpToolApprovalHook(
|
|
12
|
-
connection: AgentSideConnection,
|
|
13
|
-
sessionId: string,
|
|
14
|
-
/** Tool calls already announced via model stream (`tool_call` pending). */
|
|
15
|
-
streamPrimedToolCallIds?: () => ReadonlySet<string>,
|
|
16
|
-
): HookCallback<BeforeToolCallEvent> {
|
|
17
|
-
return async function onBeforeToolCall(event) {
|
|
18
|
-
const name = event.toolUse.name;
|
|
19
|
-
const title = toolDisplayTitle(name, event.tool);
|
|
20
|
-
const kind = inferToolKind(name);
|
|
21
|
-
const locations = toolCallLocationsFromInput(name, event.toolUse.input);
|
|
22
|
-
|
|
23
|
-
const primed =
|
|
24
|
-
streamPrimedToolCallIds?.().has(event.toolUse.toolUseId) ?? false;
|
|
25
|
-
if (primed) {
|
|
26
|
-
await connection.sessionUpdate({
|
|
27
|
-
sessionId,
|
|
28
|
-
update: {
|
|
29
|
-
sessionUpdate: "tool_call_update",
|
|
30
|
-
toolCallId: event.toolUse.toolUseId,
|
|
31
|
-
title,
|
|
32
|
-
kind,
|
|
33
|
-
status: "pending",
|
|
34
|
-
rawInput: event.toolUse.input,
|
|
35
|
-
...(locations ? { locations } : {}),
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
await connection.sessionUpdate({
|
|
40
|
-
sessionId,
|
|
41
|
-
update: {
|
|
42
|
-
sessionUpdate: "tool_call",
|
|
43
|
-
toolCallId: event.toolUse.toolUseId,
|
|
44
|
-
title,
|
|
45
|
-
kind,
|
|
46
|
-
status: "pending",
|
|
47
|
-
rawInput: event.toolUse.input,
|
|
48
|
-
...(locations ? { locations } : {}),
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
INTERNAL_ALWAYS_ALLOWED.has(name) ||
|
|
55
|
-
isToolSessionAllowed(event.agent, name)
|
|
56
|
-
) {
|
|
57
|
-
await connection.sessionUpdate({
|
|
58
|
-
sessionId,
|
|
59
|
-
update: {
|
|
60
|
-
sessionUpdate: "tool_call_update",
|
|
61
|
-
toolCallId: event.toolUse.toolUseId,
|
|
62
|
-
status: "in_progress",
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const response = await connection.requestPermission({
|
|
69
|
-
sessionId,
|
|
70
|
-
toolCall: {
|
|
71
|
-
toolCallId: event.toolUse.toolUseId,
|
|
72
|
-
title,
|
|
73
|
-
kind,
|
|
74
|
-
status: "pending",
|
|
75
|
-
rawInput: event.toolUse.input,
|
|
76
|
-
...(locations ? { locations } : {}),
|
|
77
|
-
},
|
|
78
|
-
options: [
|
|
79
|
-
{
|
|
80
|
-
kind: "allow_once",
|
|
81
|
-
name: "Allow once",
|
|
82
|
-
optionId: "allow_once",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
kind: "allow_always",
|
|
86
|
-
name: "Always allow",
|
|
87
|
-
optionId: "allow_always",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
kind: "reject_once",
|
|
91
|
-
name: "Reject",
|
|
92
|
-
optionId: "reject_once",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
if (response.outcome.outcome === "cancelled") {
|
|
98
|
-
event.cancel = `Tool "${name}" permission request was cancelled.`;
|
|
99
|
-
await connection.sessionUpdate({
|
|
100
|
-
sessionId,
|
|
101
|
-
update: {
|
|
102
|
-
sessionUpdate: "tool_call_update",
|
|
103
|
-
toolCallId: event.toolUse.toolUseId,
|
|
104
|
-
status: "failed",
|
|
105
|
-
rawOutput: { reason: "permission_cancelled" },
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const optionId = response.outcome.optionId;
|
|
112
|
-
if (optionId === "allow_once") {
|
|
113
|
-
await connection.sessionUpdate({
|
|
114
|
-
sessionId,
|
|
115
|
-
update: {
|
|
116
|
-
sessionUpdate: "tool_call_update",
|
|
117
|
-
toolCallId: event.toolUse.toolUseId,
|
|
118
|
-
status: "in_progress",
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (optionId === "allow_always") {
|
|
124
|
-
allowToolForSession(event.agent, name);
|
|
125
|
-
await connection.sessionUpdate({
|
|
126
|
-
sessionId,
|
|
127
|
-
update: {
|
|
128
|
-
sessionUpdate: "tool_call_update",
|
|
129
|
-
toolCallId: event.toolUse.toolUseId,
|
|
130
|
-
status: "in_progress",
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
event.cancel = `Tool "${name}" was rejected by the user.`;
|
|
136
|
-
await connection.sessionUpdate({
|
|
137
|
-
sessionId,
|
|
138
|
-
update: {
|
|
139
|
-
sessionUpdate: "tool_call_update",
|
|
140
|
-
toolCallId: event.toolUse.toolUseId,
|
|
141
|
-
status: "failed",
|
|
142
|
-
rawOutput: { reason: "permission_rejected" },
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
}
|
package/src/acp/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AcpAgent, runAcpStdio } from "./acp-agent.ts";
|
package/src/acp/mcp-servers.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { RequestError, type McpServer } from "@agentclientprotocol/sdk";
|
|
2
|
-
import type { NamedMcpTransport } from "../core/mcp/index.ts";
|
|
3
|
-
|
|
4
|
-
function pairsToRecord(
|
|
5
|
-
pairs: ReadonlyArray<{ name: string; value: string }>,
|
|
6
|
-
): Record<string, string> | undefined {
|
|
7
|
-
if (pairs.length === 0) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
return Object.fromEntries(pairs.map((pair) => [pair.name, pair.value]));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function toNamedTransport(server: McpServer): NamedMcpTransport {
|
|
14
|
-
if ("command" in server) {
|
|
15
|
-
return {
|
|
16
|
-
name: server.name,
|
|
17
|
-
transport: {
|
|
18
|
-
type: "stdio",
|
|
19
|
-
command: server.command,
|
|
20
|
-
args: server.args,
|
|
21
|
-
env: pairsToRecord(server.env),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
if (server.type === "http") {
|
|
26
|
-
return {
|
|
27
|
-
name: server.name,
|
|
28
|
-
transport: {
|
|
29
|
-
type: "streamable-http",
|
|
30
|
-
url: server.url,
|
|
31
|
-
headers: pairsToRecord(server.headers),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
name: server.name,
|
|
37
|
-
transport: {
|
|
38
|
-
type: "sse",
|
|
39
|
-
url: server.url,
|
|
40
|
-
headers: pairsToRecord(server.headers),
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Convert ACP session MCP server definitions into the transport shape used by
|
|
47
|
-
* Hooman's MCP manager.
|
|
48
|
-
*/
|
|
49
|
-
export function normalizeAcpSessionMcpServers(
|
|
50
|
-
servers: readonly McpServer[] | null | undefined,
|
|
51
|
-
): NamedMcpTransport[] {
|
|
52
|
-
const normalized = (servers ?? []).map(toNamedTransport);
|
|
53
|
-
const seen = new Set<string>();
|
|
54
|
-
for (const { name } of normalized) {
|
|
55
|
-
if (seen.has(name)) {
|
|
56
|
-
throw RequestError.invalidParams({
|
|
57
|
-
mcpServers: servers,
|
|
58
|
-
message: `Duplicate ACP MCP server name "${name}" in session request`,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
seen.add(name);
|
|
62
|
-
}
|
|
63
|
-
return normalized;
|
|
64
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const MAX_SYSTEM_PROMPT_LEN = 32_000;
|
|
2
|
-
|
|
3
|
-
function sanitizeClientSystemPrompt(raw: string): string {
|
|
4
|
-
return raw.replace(/\r\n?/g, "\n").trim().slice(0, MAX_SYSTEM_PROMPT_LEN);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Session-level system prompt override from ACP `_meta` on `session/new` and `session/load`.
|
|
9
|
-
*
|
|
10
|
-
* Resolution order (first non-empty wins):
|
|
11
|
-
* - `_meta["hooman/systemPrompt"]` (string)
|
|
12
|
-
* - `_meta.hooman.systemPrompt` (string)
|
|
13
|
-
* - `_meta.systemPrompt` (string)
|
|
14
|
-
*
|
|
15
|
-
* Values are normalized to `\n`, trimmed, and capped in length.
|
|
16
|
-
* Empty after sanitization is treated as absent.
|
|
17
|
-
*/
|
|
18
|
-
export function extractAcpClientSystemPrompt(
|
|
19
|
-
_meta: unknown,
|
|
20
|
-
): string | undefined {
|
|
21
|
-
if (!_meta || typeof _meta !== "object") {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const m = _meta as Record<string, unknown>;
|
|
25
|
-
const candidates: unknown[] = [
|
|
26
|
-
m["hooman/systemPrompt"],
|
|
27
|
-
m.hooman !== null &&
|
|
28
|
-
typeof m.hooman === "object" &&
|
|
29
|
-
"systemPrompt" in m.hooman
|
|
30
|
-
? (m.hooman as Record<string, unknown>).systemPrompt
|
|
31
|
-
: undefined,
|
|
32
|
-
m.systemPrompt,
|
|
33
|
-
];
|
|
34
|
-
for (const c of candidates) {
|
|
35
|
-
if (typeof c !== "string") {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const s = sanitizeClientSystemPrompt(c);
|
|
39
|
-
if (s) {
|
|
40
|
-
return s;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
package/src/acp/meta/user-id.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const MAX_USER_ID_LEN = 256;
|
|
2
|
-
|
|
3
|
-
function sanitizeClientUserId(raw: string): string {
|
|
4
|
-
const t = raw.trim().slice(0, MAX_USER_ID_LEN);
|
|
5
|
-
if (!t) {
|
|
6
|
-
return "";
|
|
7
|
-
}
|
|
8
|
-
return t.replace(/[\u0000-\u001F\u007F]/g, "");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Logical user id from ACP `_meta` on `session/new` and `session/load`.
|
|
13
|
-
*
|
|
14
|
-
* Resolution order (first non-empty wins):
|
|
15
|
-
* - `_meta["hooman/userId"]` (string)
|
|
16
|
-
* - `_meta.hooman.userId` (string)
|
|
17
|
-
* - `_meta.userId` (string)
|
|
18
|
-
*
|
|
19
|
-
* Values are trimmed, capped in length, and stripped of ASCII control characters.
|
|
20
|
-
* Empty after sanitization is treated as absent.
|
|
21
|
-
*/
|
|
22
|
-
export function extractAcpClientUserId(_meta: unknown): string | undefined {
|
|
23
|
-
if (!_meta || typeof _meta !== "object") {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
const m = _meta as Record<string, unknown>;
|
|
27
|
-
const candidates: unknown[] = [
|
|
28
|
-
m["hooman/userId"],
|
|
29
|
-
m.hooman !== null && typeof m.hooman === "object" && "userId" in m.hooman
|
|
30
|
-
? (m.hooman as Record<string, unknown>).userId
|
|
31
|
-
: undefined,
|
|
32
|
-
m.userId,
|
|
33
|
-
];
|
|
34
|
-
for (const c of candidates) {
|
|
35
|
-
if (typeof c !== "string") {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const s = sanitizeClientUserId(c);
|
|
39
|
-
if (s) {
|
|
40
|
-
return s;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
package/src/acp/prompt-invoke.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type { ContentBlock as AcpContentBlock } from "@agentclientprotocol/sdk";
|
|
2
|
-
import {
|
|
3
|
-
Agent as StrandsAgent,
|
|
4
|
-
DocumentBlock,
|
|
5
|
-
ImageBlock,
|
|
6
|
-
Message,
|
|
7
|
-
TextBlock,
|
|
8
|
-
} from "@strands-agents/sdk";
|
|
9
|
-
import type { ContentBlock } from "@strands-agents/sdk";
|
|
10
|
-
|
|
11
|
-
type AgentStreamInput = Parameters<
|
|
12
|
-
InstanceType<typeof StrandsAgent>["stream"]
|
|
13
|
-
>[0];
|
|
14
|
-
|
|
15
|
-
function decodeBase64(data: string): Uint8Array {
|
|
16
|
-
return new Uint8Array(Buffer.from(data, "base64"));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function mimeToImageFormat(mime: string): "png" | "jpeg" | "gif" | "webp" {
|
|
20
|
-
const m = mime.toLowerCase();
|
|
21
|
-
if (m.includes("png")) return "png";
|
|
22
|
-
if (m.includes("jpeg") || m.includes("jpg")) return "jpeg";
|
|
23
|
-
if (m.includes("gif")) return "gif";
|
|
24
|
-
if (m.includes("webp")) return "webp";
|
|
25
|
-
return "png";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function mimeToDocFormat(
|
|
29
|
-
mime: string,
|
|
30
|
-
): "pdf" | "html" | "txt" | "md" | "json" | "xml" | "csv" {
|
|
31
|
-
const m = mime.toLowerCase();
|
|
32
|
-
if (m.includes("pdf")) return "pdf";
|
|
33
|
-
if (m.includes("html")) return "html";
|
|
34
|
-
if (m.includes("markdown") || m.endsWith("/md")) return "md";
|
|
35
|
-
if (m.includes("json")) return "json";
|
|
36
|
-
if (m.includes("xml")) return "xml";
|
|
37
|
-
if (m.includes("csv")) return "csv";
|
|
38
|
-
return "txt";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function acpBlockToStrands(block: AcpContentBlock): ContentBlock[] {
|
|
42
|
-
switch (block.type) {
|
|
43
|
-
case "text":
|
|
44
|
-
return [new TextBlock(block.text)];
|
|
45
|
-
case "resource_link":
|
|
46
|
-
return [
|
|
47
|
-
new TextBlock(
|
|
48
|
-
`[resource_link name=${JSON.stringify(block.name)} uri=${JSON.stringify(block.uri)}]`,
|
|
49
|
-
),
|
|
50
|
-
];
|
|
51
|
-
case "resource": {
|
|
52
|
-
const r = block.resource;
|
|
53
|
-
if ("text" in r) {
|
|
54
|
-
return [new TextBlock(r.text)];
|
|
55
|
-
}
|
|
56
|
-
const bytes = decodeBase64(r.blob);
|
|
57
|
-
const mime = (r.mimeType ?? "application/octet-stream").toLowerCase();
|
|
58
|
-
if (mime.startsWith("image/")) {
|
|
59
|
-
return [
|
|
60
|
-
new ImageBlock({
|
|
61
|
-
format: mimeToImageFormat(mime),
|
|
62
|
-
source: { bytes },
|
|
63
|
-
}),
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
return [
|
|
67
|
-
new DocumentBlock({
|
|
68
|
-
format: mimeToDocFormat(mime),
|
|
69
|
-
name: r.uri.split("/").pop() ?? "attachment",
|
|
70
|
-
source: { bytes },
|
|
71
|
-
}),
|
|
72
|
-
];
|
|
73
|
-
}
|
|
74
|
-
case "image": {
|
|
75
|
-
const bytes = decodeBase64(block.data);
|
|
76
|
-
return [
|
|
77
|
-
new ImageBlock({
|
|
78
|
-
format: mimeToImageFormat(block.mimeType),
|
|
79
|
-
source: { bytes },
|
|
80
|
-
}),
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
case "audio": {
|
|
84
|
-
const bytes = decodeBase64(block.data);
|
|
85
|
-
return [
|
|
86
|
-
new TextBlock(
|
|
87
|
-
`[audio mimeType=${JSON.stringify(block.mimeType)} bytes=${bytes.byteLength}]`,
|
|
88
|
-
),
|
|
89
|
-
new DocumentBlock({
|
|
90
|
-
format: "txt",
|
|
91
|
-
name: "audio.bin",
|
|
92
|
-
source: { bytes },
|
|
93
|
-
}),
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
default:
|
|
97
|
-
return [
|
|
98
|
-
new TextBlock(
|
|
99
|
-
`[unsupported ACP block ${JSON.stringify(block as unknown)}]`,
|
|
100
|
-
),
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Convert an ACP `session/prompt` payload to Strands {@link InvokeArgs} (multimodal user turn).
|
|
107
|
-
*/
|
|
108
|
-
export function acpPromptToInvokeArgs(
|
|
109
|
-
prompt: AcpContentBlock[],
|
|
110
|
-
): AgentStreamInput {
|
|
111
|
-
const parts: ContentBlock[] = [];
|
|
112
|
-
for (const block of prompt) {
|
|
113
|
-
parts.push(...acpBlockToStrands(block));
|
|
114
|
-
}
|
|
115
|
-
return [new Message({ role: "user", content: parts })];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** Flattened text for `user_message_chunk` echoes (lossy but readable). */
|
|
119
|
-
export function acpPromptEchoText(prompt: AcpContentBlock[]): string {
|
|
120
|
-
const lines: string[] = [];
|
|
121
|
-
for (const block of prompt) {
|
|
122
|
-
switch (block.type) {
|
|
123
|
-
case "text":
|
|
124
|
-
lines.push(block.text);
|
|
125
|
-
break;
|
|
126
|
-
case "resource_link":
|
|
127
|
-
lines.push(`[resource_link ${block.name}](${block.uri})`);
|
|
128
|
-
break;
|
|
129
|
-
case "resource":
|
|
130
|
-
if ("text" in block.resource) {
|
|
131
|
-
lines.push(block.resource.text);
|
|
132
|
-
} else {
|
|
133
|
-
lines.push(
|
|
134
|
-
`[binary resource uri=${block.resource.uri} mime=${block.resource.mimeType ?? ""} len=${block.resource.blob.length}]`,
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case "image":
|
|
139
|
-
lines.push(`[image ${block.mimeType} ${block.data.length} b64 chars]`);
|
|
140
|
-
break;
|
|
141
|
-
case "audio":
|
|
142
|
-
lines.push(`[audio ${block.mimeType} ${block.data.length} b64 chars]`);
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
lines.push(JSON.stringify(block));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return lines.join("\n\n").trim();
|
|
149
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { RequestError } from "@agentclientprotocol/sdk";
|
|
2
|
-
import type {
|
|
3
|
-
SessionConfigOption,
|
|
4
|
-
SetSessionConfigOptionRequest,
|
|
5
|
-
} from "@agentclientprotocol/sdk";
|
|
6
|
-
import type { Config } from "../../core/config.ts";
|
|
7
|
-
|
|
8
|
-
export const HOOMAN_LTM_CONFIG_ID = "hooman.longTermMemory" as const;
|
|
9
|
-
export const HOOMAN_WIKI_CONFIG_ID = "hooman.wiki" as const;
|
|
10
|
-
export const HOOMAN_TODO_CONFIG_ID = "hooman.todo" as const;
|
|
11
|
-
|
|
12
|
-
export function buildSessionConfigOptions(
|
|
13
|
-
config: Config,
|
|
14
|
-
): SessionConfigOption[] {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
type: "select",
|
|
18
|
-
id: HOOMAN_TODO_CONFIG_ID,
|
|
19
|
-
name: "Todo tracking",
|
|
20
|
-
description:
|
|
21
|
-
"When enabled, the agent can use update_todos to track multi-step progress in app state.",
|
|
22
|
-
category: "_hooman",
|
|
23
|
-
currentValue: config.tools.todo.enabled ? "on" : "off",
|
|
24
|
-
options: [
|
|
25
|
-
{ value: "on", name: "On" },
|
|
26
|
-
{ value: "off", name: "Off" },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "select",
|
|
31
|
-
id: HOOMAN_LTM_CONFIG_ID,
|
|
32
|
-
name: "Long-term memory",
|
|
33
|
-
description:
|
|
34
|
-
"When enabled, the agent can store and search memories (requires Chroma at the configured URL).",
|
|
35
|
-
category: "_hooman",
|
|
36
|
-
currentValue: config.ltm.enabled ? "on" : "off",
|
|
37
|
-
options: [
|
|
38
|
-
{ value: "on", name: "On" },
|
|
39
|
-
{ value: "off", name: "Off" },
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "select",
|
|
44
|
-
id: HOOMAN_WIKI_CONFIG_ID,
|
|
45
|
-
name: "Wiki",
|
|
46
|
-
description:
|
|
47
|
-
"When enabled, the agent can read, write, and search wiki pages (requires Chroma at the configured URL).",
|
|
48
|
-
category: "_hooman",
|
|
49
|
-
currentValue: config.wiki.enabled ? "on" : "off",
|
|
50
|
-
options: [
|
|
51
|
-
{ value: "on", name: "On" },
|
|
52
|
-
{ value: "off", name: "Off" },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function applySessionConfigOption(
|
|
59
|
-
config: Config,
|
|
60
|
-
params: SetSessionConfigOptionRequest,
|
|
61
|
-
): void {
|
|
62
|
-
if ("type" in params && params.type === "boolean") {
|
|
63
|
-
throw RequestError.invalidParams({
|
|
64
|
-
message: "Boolean session config options are not supported.",
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (
|
|
68
|
-
params.configId !== HOOMAN_TODO_CONFIG_ID &&
|
|
69
|
-
params.configId !== HOOMAN_LTM_CONFIG_ID &&
|
|
70
|
-
params.configId !== HOOMAN_WIKI_CONFIG_ID
|
|
71
|
-
) {
|
|
72
|
-
throw RequestError.invalidParams({ configId: params.configId });
|
|
73
|
-
}
|
|
74
|
-
const value = params.value;
|
|
75
|
-
if (value !== "on" && value !== "off") {
|
|
76
|
-
throw RequestError.invalidParams({ value });
|
|
77
|
-
}
|
|
78
|
-
if (params.configId === HOOMAN_LTM_CONFIG_ID) {
|
|
79
|
-
const chroma = config.ltm.chroma;
|
|
80
|
-
config.update({
|
|
81
|
-
tools: {
|
|
82
|
-
...config.tools,
|
|
83
|
-
ltm: {
|
|
84
|
-
enabled: value === "on",
|
|
85
|
-
chroma: {
|
|
86
|
-
url: chroma.url,
|
|
87
|
-
collection: { memory: chroma.collection.memory },
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (params.configId === HOOMAN_TODO_CONFIG_ID) {
|
|
96
|
-
config.update({
|
|
97
|
-
tools: {
|
|
98
|
-
...config.tools,
|
|
99
|
-
todo: {
|
|
100
|
-
enabled: value === "on",
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const chroma = config.wiki.chroma;
|
|
108
|
-
config.update({
|
|
109
|
-
tools: {
|
|
110
|
-
...config.tools,
|
|
111
|
-
wiki: {
|
|
112
|
-
enabled: value === "on",
|
|
113
|
-
chroma: {
|
|
114
|
-
url: chroma.url,
|
|
115
|
-
collection: { wiki: chroma.collection.wiki },
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { AgentSideConnection } from "@agentclientprotocol/sdk";
|
|
2
|
-
import type { Message } from "@strands-agents/sdk";
|
|
3
|
-
import {
|
|
4
|
-
ToolResultBlock,
|
|
5
|
-
ToolUseBlock,
|
|
6
|
-
type ContentBlock,
|
|
7
|
-
} from "@strands-agents/sdk";
|
|
8
|
-
import { inferToolKind } from "../utils/tool-kind.ts";
|
|
9
|
-
import { toolResultToAcpContent } from "../utils/tool-result-content.ts";
|
|
10
|
-
|
|
11
|
-
function blockToFallbackText(block: ContentBlock): string | null {
|
|
12
|
-
if (block.type === "textBlock") {
|
|
13
|
-
return block.text;
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
return JSON.stringify(block.toJSON?.() ?? block, null, 2);
|
|
17
|
-
} catch {
|
|
18
|
-
return String(block);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function collectToolResults(messages: Message[]): Map<string, ToolResultBlock> {
|
|
23
|
-
const byId = new Map<string, ToolResultBlock>();
|
|
24
|
-
for (const message of messages) {
|
|
25
|
-
for (const block of message.content) {
|
|
26
|
-
if (block instanceof ToolResultBlock) {
|
|
27
|
-
byId.set(block.toolUseId, block);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return byId;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Replay persisted conversation to the client using ACP session updates.
|
|
36
|
-
* Emits separate chunks for text vs structured tool call / result updates.
|
|
37
|
-
*/
|
|
38
|
-
export async function replayConversationHistory(
|
|
39
|
-
connection: AgentSideConnection,
|
|
40
|
-
sessionId: string,
|
|
41
|
-
messages: Message[],
|
|
42
|
-
): Promise<void> {
|
|
43
|
-
const resultsByToolUseId = collectToolResults(messages);
|
|
44
|
-
|
|
45
|
-
for (const message of messages) {
|
|
46
|
-
const role = message.role;
|
|
47
|
-
|
|
48
|
-
for (const block of message.content) {
|
|
49
|
-
if (role === "user") {
|
|
50
|
-
if (block instanceof ToolResultBlock) {
|
|
51
|
-
await connection.sessionUpdate({
|
|
52
|
-
sessionId,
|
|
53
|
-
update: {
|
|
54
|
-
sessionUpdate: "tool_call_update",
|
|
55
|
-
toolCallId: block.toolUseId,
|
|
56
|
-
status: block.status === "success" ? "completed" : "failed",
|
|
57
|
-
rawOutput: block.toJSON() as unknown,
|
|
58
|
-
content: toolResultToAcpContent(block),
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const text = blockToFallbackText(block);
|
|
64
|
-
if (text?.trim()) {
|
|
65
|
-
await connection.sessionUpdate({
|
|
66
|
-
sessionId,
|
|
67
|
-
update: {
|
|
68
|
-
sessionUpdate: "user_message_chunk",
|
|
69
|
-
content: { type: "text", text },
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (role === "assistant") {
|
|
77
|
-
if (block instanceof ToolUseBlock) {
|
|
78
|
-
const hasResult = resultsByToolUseId.has(block.toolUseId);
|
|
79
|
-
await connection.sessionUpdate({
|
|
80
|
-
sessionId,
|
|
81
|
-
update: {
|
|
82
|
-
sessionUpdate: "tool_call",
|
|
83
|
-
toolCallId: block.toolUseId,
|
|
84
|
-
title: block.name,
|
|
85
|
-
kind: inferToolKind(block.name),
|
|
86
|
-
rawInput: block.input,
|
|
87
|
-
status: hasResult ? "in_progress" : "completed",
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (block.type === "textBlock") {
|
|
93
|
-
const t = block.text;
|
|
94
|
-
if (t) {
|
|
95
|
-
await connection.sessionUpdate({
|
|
96
|
-
sessionId,
|
|
97
|
-
update: {
|
|
98
|
-
sessionUpdate: "agent_message_chunk",
|
|
99
|
-
content: { type: "text", text: t },
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (block.type === "reasoningBlock") {
|
|
106
|
-
const t = blockToFallbackText(block);
|
|
107
|
-
if (t?.trim()) {
|
|
108
|
-
await connection.sessionUpdate({
|
|
109
|
-
sessionId,
|
|
110
|
-
update: {
|
|
111
|
-
sessionUpdate: "agent_thought_chunk",
|
|
112
|
-
content: { type: "text", text: t },
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const fallback = blockToFallbackText(block);
|
|
119
|
-
if (fallback?.trim()) {
|
|
120
|
-
await connection.sessionUpdate({
|
|
121
|
-
sessionId,
|
|
122
|
-
update: {
|
|
123
|
-
sessionUpdate: "agent_message_chunk",
|
|
124
|
-
content: { type: "text", text: fallback },
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|