hoomanjs 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -26
- package/dist/acp/acp-agent.d.ts +69 -0
- package/dist/acp/acp-agent.js +628 -0
- package/dist/acp/acp-agent.js.map +1 -0
- package/dist/acp/approvals.d.ts +5 -0
- package/dist/acp/approvals.js +130 -0
- package/dist/acp/approvals.js.map +1 -0
- package/dist/acp/index.d.ts +1 -0
- package/dist/acp/index.js +2 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/mcp-servers.d.ts +7 -0
- package/dist/acp/mcp-servers.js +57 -0
- package/dist/acp/mcp-servers.js.map +1 -0
- package/dist/acp/meta/system-prompt.d.ts +12 -0
- package/dist/acp/meta/system-prompt.js +41 -0
- package/dist/acp/meta/system-prompt.js.map +1 -0
- package/dist/acp/meta/user-id.d.ts +12 -0
- package/dist/acp/meta/user-id.js +43 -0
- package/dist/acp/meta/user-id.js.map +1 -0
- package/dist/acp/prompt-invoke.d.ts +10 -0
- package/dist/acp/prompt-invoke.js +131 -0
- package/dist/acp/prompt-invoke.js.map +1 -0
- package/dist/acp/sessions/config-options.d.ts +7 -0
- package/dist/acp/sessions/config-options.js +101 -0
- package/dist/acp/sessions/config-options.js.map +1 -0
- package/dist/acp/sessions/replay.d.ts +7 -0
- package/dist/acp/sessions/replay.js +117 -0
- package/dist/acp/sessions/replay.js.map +1 -0
- package/dist/acp/sessions/store.d.ts +24 -0
- package/dist/acp/sessions/store.js +96 -0
- package/dist/acp/sessions/store.js.map +1 -0
- package/dist/acp/sessions/title.d.ts +5 -0
- package/dist/acp/sessions/title.js +22 -0
- package/dist/acp/sessions/title.js.map +1 -0
- package/dist/acp/utils/paths.d.ts +2 -0
- package/{src/acp/utils/paths.ts → dist/acp/utils/paths.js} +2 -2
- package/dist/acp/utils/paths.js.map +1 -0
- package/dist/acp/utils/tool-kind.d.ts +6 -0
- package/dist/acp/utils/tool-kind.js +53 -0
- package/dist/acp/utils/tool-kind.js.map +1 -0
- package/dist/acp/utils/tool-locations.d.ts +3 -0
- package/dist/acp/utils/tool-locations.js +44 -0
- package/dist/acp/utils/tool-locations.js.map +1 -0
- package/dist/acp/utils/tool-result-content.d.ts +8 -0
- package/dist/acp/utils/tool-result-content.js +14 -0
- package/dist/acp/utils/tool-result-content.js.map +1 -0
- package/dist/chat/app.d.ts +15 -0
- package/dist/chat/app.js +458 -0
- package/dist/chat/app.js.map +1 -0
- package/dist/chat/approvals.d.ts +15 -0
- package/dist/chat/approvals.js +74 -0
- package/dist/chat/approvals.js.map +1 -0
- package/dist/chat/components/ApprovalPrompt.d.ts +6 -0
- package/dist/chat/components/ApprovalPrompt.js +11 -0
- package/dist/chat/components/ApprovalPrompt.js.map +1 -0
- package/dist/chat/components/ChatMessage.d.ts +7 -0
- package/dist/chat/components/ChatMessage.js +19 -0
- package/dist/chat/components/ChatMessage.js.map +1 -0
- package/dist/chat/components/Composer.d.ts +11 -0
- package/dist/chat/components/Composer.js +9 -0
- package/dist/chat/components/Composer.js.map +1 -0
- package/dist/chat/components/EmptyChatBanner.d.ts +2 -0
- package/dist/chat/components/EmptyChatBanner.js +8 -0
- package/dist/chat/components/EmptyChatBanner.js.map +1 -0
- package/dist/chat/components/PromptInput.d.ts +11 -0
- package/dist/chat/components/PromptInput.js +26 -0
- package/dist/chat/components/PromptInput.js.map +1 -0
- package/dist/chat/components/QueuedPrompts.d.ts +10 -0
- package/dist/chat/components/QueuedPrompts.js +38 -0
- package/dist/chat/components/QueuedPrompts.js.map +1 -0
- package/dist/chat/components/ReasoningStrip.d.ts +6 -0
- package/dist/chat/components/ReasoningStrip.js +13 -0
- package/dist/chat/components/ReasoningStrip.js.map +1 -0
- package/dist/chat/components/ScrollView.d.ts +101 -0
- package/dist/chat/components/ScrollView.js +74 -0
- package/dist/chat/components/ScrollView.js.map +1 -0
- package/dist/chat/components/Spinner.d.ts +8 -0
- package/dist/chat/components/Spinner.js +19 -0
- package/dist/chat/components/Spinner.js.map +1 -0
- package/dist/chat/components/StatusBar.d.ts +20 -0
- package/dist/chat/components/StatusBar.js +20 -0
- package/dist/chat/components/StatusBar.js.map +1 -0
- package/dist/chat/components/ThinkingStatus.d.ts +1 -0
- package/dist/chat/components/ThinkingStatus.js +119 -0
- package/dist/chat/components/ThinkingStatus.js.map +1 -0
- package/dist/chat/components/TodoPanel.d.ts +6 -0
- package/dist/chat/components/TodoPanel.js +27 -0
- package/dist/chat/components/TodoPanel.js.map +1 -0
- package/dist/chat/components/ToolEvent.d.ts +6 -0
- package/dist/chat/components/ToolEvent.js +18 -0
- package/dist/chat/components/ToolEvent.js.map +1 -0
- package/dist/chat/components/ToolEventFileResult.d.ts +9 -0
- package/dist/chat/components/ToolEventFileResult.js +50 -0
- package/dist/chat/components/ToolEventFileResult.js.map +1 -0
- package/dist/chat/components/Transcript.d.ts +7 -0
- package/dist/chat/components/Transcript.js +9 -0
- package/dist/chat/components/Transcript.js.map +1 -0
- package/dist/chat/components/TranscriptViewport.d.ts +9 -0
- package/dist/chat/components/TranscriptViewport.js +124 -0
- package/dist/chat/components/TranscriptViewport.js.map +1 -0
- package/dist/chat/components/ascii-logo.d.ts +1 -0
- package/{src/chat/components/ascii-logo.ts → dist/chat/components/ascii-logo.js} +3 -2
- package/dist/chat/components/ascii-logo.js.map +1 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.d.ts +26 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js +73 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js.map +1 -0
- package/dist/chat/components/markdown/BlockRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/BlockRenderer.js +87 -0
- package/dist/chat/components/markdown/BlockRenderer.js.map +1 -0
- package/dist/chat/components/markdown/CodeBlock.d.ts +7 -0
- package/dist/chat/components/markdown/CodeBlock.js +55 -0
- package/dist/chat/components/markdown/CodeBlock.js.map +1 -0
- package/dist/chat/components/markdown/InlineRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/InlineRenderer.js +96 -0
- package/dist/chat/components/markdown/InlineRenderer.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownMessage.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownMessage.js +13 -0
- package/dist/chat/components/markdown/MarkdownMessage.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownTable.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownTable.js +12 -0
- package/dist/chat/components/markdown/MarkdownTable.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.d.ts +7 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js +186 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.d.ts +9 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js +25 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js.map +1 -0
- package/dist/chat/components/markdown/lexer.d.ts +7 -0
- package/dist/chat/components/markdown/lexer.js +89 -0
- package/dist/chat/components/markdown/lexer.js.map +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.d.ts +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.js +112 -0
- package/dist/chat/components/prompt-input/clipboard-image.js.map +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.d.ts +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js +2 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js.map +1 -0
- package/dist/chat/components/prompt-input/input-model.d.ts +28 -0
- package/dist/chat/components/prompt-input/input-model.js +231 -0
- package/dist/chat/components/prompt-input/input-model.js.map +1 -0
- package/dist/chat/components/prompt-input/paste.d.ts +11 -0
- package/dist/chat/components/prompt-input/paste.js +85 -0
- package/dist/chat/components/prompt-input/paste.js.map +1 -0
- package/dist/chat/components/prompt-input/render.d.ts +13 -0
- package/dist/chat/components/prompt-input/render.js +54 -0
- package/dist/chat/components/prompt-input/render.js.map +1 -0
- package/dist/chat/components/prompt-input/usePromptInputController.d.ts +17 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js +366 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js.map +1 -0
- package/dist/chat/components/shared.d.ts +6 -0
- package/dist/chat/components/shared.js +66 -0
- package/dist/chat/components/shared.js.map +1 -0
- package/dist/chat/index.d.ts +13 -0
- package/dist/chat/index.js +18 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/mouse.d.ts +5 -0
- package/dist/chat/mouse.js +9 -0
- package/dist/chat/mouse.js.map +1 -0
- package/dist/chat/types.d.ts +20 -0
- package/dist/chat/types.js +2 -0
- package/dist/chat/types.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +126 -0
- package/dist/cli.js.map +1 -0
- package/dist/configure/app.d.ts +3 -0
- package/dist/configure/app.js +1036 -0
- package/dist/configure/app.js.map +1 -0
- package/dist/configure/components/BusyScreen.d.ts +6 -0
- package/dist/configure/components/BusyScreen.js +7 -0
- package/dist/configure/components/BusyScreen.js.map +1 -0
- package/dist/configure/components/HomeScreen.d.ts +12 -0
- package/dist/configure/components/HomeScreen.js +7 -0
- package/dist/configure/components/HomeScreen.js.map +1 -0
- package/dist/configure/components/MenuScreen.d.ts +10 -0
- package/dist/configure/components/MenuScreen.js +15 -0
- package/dist/configure/components/MenuScreen.js.map +1 -0
- package/dist/configure/components/PromptForm.d.ts +8 -0
- package/dist/configure/components/PromptForm.js +12 -0
- package/dist/configure/components/PromptForm.js.map +1 -0
- package/dist/configure/components/SelectMenuItem.d.ts +7 -0
- package/dist/configure/components/SelectMenuItem.js +18 -0
- package/dist/configure/components/SelectMenuItem.js.map +1 -0
- package/dist/configure/index.d.ts +1 -0
- package/dist/configure/index.js +28 -0
- package/dist/configure/index.js.map +1 -0
- package/dist/configure/open-in-editor.d.ts +8 -0
- package/dist/configure/open-in-editor.js +120 -0
- package/dist/configure/open-in-editor.js.map +1 -0
- package/dist/configure/types.d.ts +63 -0
- package/dist/configure/types.js +2 -0
- package/dist/configure/types.js.map +1 -0
- package/dist/configure/utils.d.ts +19 -0
- package/dist/configure/utils.js +108 -0
- package/dist/configure/utils.js.map +1 -0
- package/dist/core/agent/index.d.ts +13 -0
- package/dist/core/agent/index.js +70 -0
- package/dist/core/agent/index.js.map +1 -0
- package/dist/core/agents/definitions.d.ts +12 -0
- package/dist/core/agents/definitions.js +35 -0
- package/dist/core/agents/definitions.js.map +1 -0
- package/dist/core/agents/index.d.ts +4 -0
- package/dist/core/agents/index.js +5 -0
- package/dist/core/agents/index.js.map +1 -0
- package/dist/core/agents/registry.d.ts +5 -0
- package/dist/core/agents/registry.js +84 -0
- package/dist/core/agents/registry.js.map +1 -0
- package/dist/core/agents/runner.d.ts +36 -0
- package/dist/core/agents/runner.js +275 -0
- package/dist/core/agents/runner.js.map +1 -0
- package/dist/core/agents/tools.d.ts +20 -0
- package/dist/core/agents/tools.js +66 -0
- package/dist/core/agents/tools.js.map +1 -0
- package/dist/core/config.d.ts +272 -0
- package/dist/core/config.js +334 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.js +21 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/mcp/config.d.ts +44 -0
- package/dist/core/mcp/config.js +65 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +8 -0
- package/dist/core/mcp/index.js +12 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +69 -0
- package/dist/core/mcp/manager.js +376 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/mcp/prefixed-mcp-tool.d.ts +14 -0
- package/dist/core/mcp/prefixed-mcp-tool.js +38 -0
- package/dist/core/mcp/prefixed-mcp-tool.js.map +1 -0
- package/dist/core/mcp/tools.d.ts +5 -0
- package/dist/core/mcp/tools.js +82 -0
- package/dist/core/mcp/tools.js.map +1 -0
- package/dist/core/mcp/types.d.ts +40 -0
- package/dist/core/mcp/types.js +28 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory/index.d.ts +3 -0
- package/dist/core/memory/index.js +3 -0
- package/dist/core/memory/index.js.map +1 -0
- package/dist/core/memory/ltm/embed.d.ts +16 -0
- package/dist/core/memory/ltm/embed.js +49 -0
- package/dist/core/memory/ltm/embed.js.map +1 -0
- package/dist/core/memory/ltm/index.d.ts +3 -0
- package/dist/core/memory/ltm/index.js +3 -0
- package/dist/core/memory/ltm/index.js.map +1 -0
- package/dist/core/memory/ltm/store.d.ts +20 -0
- package/dist/core/memory/ltm/store.js +271 -0
- package/dist/core/memory/ltm/store.js.map +1 -0
- package/dist/core/memory/ltm/tools.d.ts +21 -0
- package/dist/core/memory/ltm/tools.js +127 -0
- package/dist/core/memory/ltm/tools.js.map +1 -0
- package/dist/core/memory/ltm/types.d.ts +79 -0
- package/dist/core/memory/ltm/types.js +2 -0
- package/dist/core/memory/ltm/types.js.map +1 -0
- package/dist/core/memory/ltm/utils.d.ts +40 -0
- package/dist/core/memory/ltm/utils.js +145 -0
- package/dist/core/memory/ltm/utils.js.map +1 -0
- package/dist/core/memory/stm/flat-file-storage.d.ts +27 -0
- package/dist/core/memory/stm/flat-file-storage.js +63 -0
- package/dist/core/memory/stm/flat-file-storage.js.map +1 -0
- package/dist/core/memory/stm/index.d.ts +13 -0
- package/dist/core/memory/stm/index.js +24 -0
- package/dist/core/memory/stm/index.js.map +1 -0
- package/dist/core/memory/stm/lazy-session-manager.d.ts +37 -0
- package/dist/core/memory/stm/lazy-session-manager.js +163 -0
- package/dist/core/memory/stm/lazy-session-manager.js.map +1 -0
- package/dist/core/models/anthropic.d.ts +10 -0
- package/dist/core/models/anthropic.js +38 -0
- package/dist/core/models/anthropic.js.map +1 -0
- package/dist/core/models/bedrock.d.ts +21 -0
- package/dist/core/models/bedrock.js +24 -0
- package/dist/core/models/bedrock.js.map +1 -0
- package/dist/core/models/google.d.ts +10 -0
- package/dist/core/models/google.js +36 -0
- package/dist/core/models/google.js.map +1 -0
- package/dist/core/models/groq.d.ts +10 -0
- package/dist/core/models/groq.js +33 -0
- package/dist/core/models/groq.js.map +1 -0
- package/dist/core/models/index.d.ts +5 -0
- package/dist/core/models/index.js +11 -0
- package/dist/core/models/index.js.map +1 -0
- package/dist/core/models/moonshot.d.ts +11 -0
- package/dist/core/models/moonshot.js +39 -0
- package/dist/core/models/moonshot.js.map +1 -0
- package/dist/core/models/ollama/index.d.ts +3 -0
- package/dist/core/models/ollama/index.js +9 -0
- package/dist/core/models/ollama/index.js.map +1 -0
- package/dist/core/models/ollama/strands-ollama.d.ts +30 -0
- package/dist/core/models/ollama/strands-ollama.js +336 -0
- package/dist/core/models/ollama/strands-ollama.js.map +1 -0
- package/dist/core/models/openai.d.ts +4 -0
- package/dist/core/models/openai.js +9 -0
- package/dist/core/models/openai.js.map +1 -0
- package/dist/core/models/xai.d.ts +10 -0
- package/dist/core/models/xai.js +33 -0
- package/dist/core/models/xai.js.map +1 -0
- package/dist/core/prompts/environment.d.ts +11 -0
- package/dist/core/prompts/environment.js +51 -0
- package/dist/core/prompts/environment.js.map +1 -0
- package/dist/core/prompts/index.d.ts +7 -0
- package/dist/core/prompts/index.js +14 -0
- package/dist/core/prompts/index.js.map +1 -0
- package/dist/core/prompts/skills.d.ts +15 -0
- package/dist/core/prompts/skills.js +86 -0
- package/dist/core/prompts/skills.js.map +1 -0
- package/dist/core/prompts/system.d.ts +22 -0
- package/dist/core/prompts/system.js +164 -0
- package/dist/core/prompts/system.js.map +1 -0
- package/dist/core/skills/built-in/hooman-config/SKILL.md +9 -0
- package/dist/core/skills/index.d.ts +2 -0
- package/dist/core/skills/index.js +3 -0
- package/dist/core/skills/index.js.map +1 -0
- package/dist/core/skills/metadata.d.ts +8 -0
- package/dist/core/skills/metadata.js +20 -0
- package/dist/core/skills/metadata.js.map +1 -0
- package/dist/core/skills/registry.d.ts +38 -0
- package/dist/core/skills/registry.js +165 -0
- package/dist/core/skills/registry.js.map +1 -0
- package/dist/core/skills/tools.d.ts +9 -0
- package/dist/core/skills/tools.js +73 -0
- package/dist/core/skills/tools.js.map +1 -0
- package/dist/core/state/file-tool-display.d.ts +20 -0
- package/dist/core/state/file-tool-display.js +35 -0
- package/dist/core/state/file-tool-display.js.map +1 -0
- package/dist/core/state/thought-process.d.ts +18 -0
- package/dist/core/state/thought-process.js +21 -0
- package/dist/core/state/thought-process.js.map +1 -0
- package/dist/core/state/todos.d.ts +39 -0
- package/dist/core/state/todos.js +53 -0
- package/dist/core/state/todos.js.map +1 -0
- package/dist/core/state/tool-approvals.d.ts +12 -0
- package/dist/core/state/tool-approvals.js +81 -0
- package/dist/core/state/tool-approvals.js.map +1 -0
- package/dist/core/tools/fetch.d.ts +9 -0
- package/dist/core/tools/fetch.js +228 -0
- package/dist/core/tools/fetch.js.map +1 -0
- package/dist/core/tools/filesystem.d.ts +35 -0
- package/dist/core/tools/filesystem.js +791 -0
- package/dist/core/tools/filesystem.js.map +1 -0
- package/dist/core/tools/index.d.ts +9 -0
- package/dist/core/tools/index.js +10 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/shell.d.ts +18 -0
- package/dist/core/tools/shell.js +308 -0
- package/dist/core/tools/shell.js.map +1 -0
- package/dist/core/tools/sleep.d.ts +4 -0
- package/dist/core/tools/sleep.js +46 -0
- package/dist/core/tools/sleep.js.map +1 -0
- package/dist/core/tools/thinking.d.ts +12 -0
- package/dist/core/tools/thinking.js +119 -0
- package/dist/core/tools/thinking.js.map +1 -0
- package/dist/core/tools/time.d.ts +8 -0
- package/dist/core/tools/time.js +94 -0
- package/dist/core/tools/time.js.map +1 -0
- package/dist/core/tools/todo.d.ts +9 -0
- package/dist/core/tools/todo.js +33 -0
- package/dist/core/tools/todo.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +11 -0
- package/dist/core/tools/web-search.js +211 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/wiki.d.ts +11 -0
- package/dist/core/tools/wiki.js +566 -0
- package/dist/core/tools/wiki.js.map +1 -0
- package/dist/core/utils/attachments.d.ts +23 -0
- package/dist/core/utils/attachments.js +125 -0
- package/dist/core/utils/attachments.js.map +1 -0
- package/dist/core/utils/cwd-context.d.ts +2 -0
- package/dist/core/utils/cwd-context.js +9 -0
- package/dist/core/utils/cwd-context.js.map +1 -0
- package/dist/core/utils/file-formats.d.ts +4 -0
- package/dist/core/utils/file-formats.js +48 -0
- package/dist/core/utils/file-formats.js.map +1 -0
- package/dist/core/utils/paths.d.ts +7 -0
- package/dist/core/utils/paths.js +25 -0
- package/dist/core/utils/paths.js.map +1 -0
- package/dist/daemon/approvals.d.ts +5 -0
- package/dist/daemon/approvals.js +95 -0
- package/dist/daemon/approvals.js.map +1 -0
- package/dist/daemon/index.d.ts +11 -0
- package/dist/daemon/index.js +106 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/queue.d.ts +5 -0
- package/dist/daemon/queue.js +38 -0
- package/dist/daemon/queue.js.map +1 -0
- package/dist/exec/approvals.d.ts +6 -0
- package/dist/exec/approvals.js +74 -0
- package/dist/exec/approvals.js.map +1 -0
- package/package.json +20 -9
- package/.github/screenshot.png +0 -0
- package/.github/workflows/build-publish.yml +0 -49
- package/docker-compose.yml +0 -13
- package/src/acp/acp-agent.ts +0 -814
- package/src/acp/approvals.ts +0 -146
- package/src/acp/index.ts +0 -1
- package/src/acp/mcp-servers.ts +0 -64
- package/src/acp/meta/system-prompt.ts +0 -44
- package/src/acp/meta/user-id.ts +0 -44
- package/src/acp/prompt-invoke.ts +0 -149
- package/src/acp/sessions/config-options.ts +0 -120
- package/src/acp/sessions/replay.ts +0 -131
- package/src/acp/sessions/store.ts +0 -161
- package/src/acp/sessions/title.ts +0 -22
- package/src/acp/utils/tool-kind.ts +0 -61
- package/src/acp/utils/tool-locations.ts +0 -48
- package/src/acp/utils/tool-result-content.ts +0 -27
- package/src/chat/app.tsx +0 -636
- package/src/chat/approvals.ts +0 -97
- package/src/chat/components/ApprovalPrompt.tsx +0 -25
- package/src/chat/components/ChatMessage.tsx +0 -50
- package/src/chat/components/Composer.tsx +0 -45
- package/src/chat/components/EmptyChatBanner.tsx +0 -26
- package/src/chat/components/PromptInput.tsx +0 -62
- package/src/chat/components/QueuedPrompts.tsx +0 -76
- package/src/chat/components/ReasoningStrip.tsx +0 -30
- package/src/chat/components/Spinner.tsx +0 -34
- package/src/chat/components/StatusBar.tsx +0 -67
- package/src/chat/components/ThinkingStatus.tsx +0 -128
- package/src/chat/components/TodoPanel.tsx +0 -49
- package/src/chat/components/ToolEvent.tsx +0 -41
- package/src/chat/components/ToolEventFileResult.tsx +0 -116
- package/src/chat/components/Transcript.tsx +0 -34
- package/src/chat/components/TranscriptViewport.tsx +0 -170
- package/src/chat/components/file-tool-diff/file-tool-result.ts +0 -155
- package/src/chat/components/markdown/BlockRenderer.tsx +0 -207
- package/src/chat/components/markdown/CodeBlock.tsx +0 -100
- package/src/chat/components/markdown/InlineRenderer.tsx +0 -122
- package/src/chat/components/markdown/MarkdownMessage.tsx +0 -35
- package/src/chat/components/markdown/MarkdownTable.tsx +0 -23
- package/src/chat/components/markdown/hooks/useMarkdownTableLayout.ts +0 -242
- package/src/chat/components/markdown/hooks/useMarkdownTokens.ts +0 -46
- package/src/chat/components/markdown/lexer.ts +0 -100
- package/src/chat/components/prompt-input/clipboard-image.ts +0 -119
- package/src/chat/components/prompt-input/hooks/usePromptInputController.ts +0 -4
- package/src/chat/components/prompt-input/input-model.ts +0 -294
- package/src/chat/components/prompt-input/paste.ts +0 -105
- package/src/chat/components/prompt-input/render.ts +0 -83
- package/src/chat/components/prompt-input/usePromptInputController.ts +0 -498
- package/src/chat/components/shared.ts +0 -70
- package/src/chat/index.tsx +0 -41
- package/src/chat/mouse.ts +0 -17
- package/src/chat/types.ts +0 -24
- package/src/cli.ts +0 -181
- package/src/configure/app.tsx +0 -1349
- package/src/configure/components/BusyScreen.tsx +0 -22
- package/src/configure/components/HomeScreen.tsx +0 -43
- package/src/configure/components/MenuScreen.tsx +0 -44
- package/src/configure/components/PromptForm.tsx +0 -40
- package/src/configure/components/SelectMenuItem.tsx +0 -30
- package/src/configure/index.tsx +0 -43
- package/src/configure/open-in-editor.ts +0 -133
- package/src/configure/types.ts +0 -51
- package/src/configure/utils.ts +0 -134
- package/src/core/agent/index.ts +0 -108
- package/src/core/agents/definitions.ts +0 -48
- package/src/core/agents/index.ts +0 -15
- package/src/core/agents/registry.ts +0 -106
- package/src/core/agents/runner.ts +0 -375
- package/src/core/agents/tools.ts +0 -100
- package/src/core/config.ts +0 -377
- package/src/core/index.ts +0 -60
- package/src/core/mcp/config.ts +0 -80
- package/src/core/mcp/index.ts +0 -33
- package/src/core/mcp/manager.ts +0 -491
- package/src/core/mcp/prefixed-mcp-tool.ts +0 -45
- package/src/core/mcp/tools.ts +0 -92
- package/src/core/mcp/types.ts +0 -37
- package/src/core/memory/index.ts +0 -17
- package/src/core/memory/ltm/embed.ts +0 -67
- package/src/core/memory/ltm/index.ts +0 -18
- package/src/core/memory/ltm/store.ts +0 -376
- package/src/core/memory/ltm/tools.ts +0 -146
- package/src/core/memory/ltm/types.ts +0 -111
- package/src/core/memory/ltm/utils.ts +0 -218
- package/src/core/memory/stm/flat-file-storage.ts +0 -89
- package/src/core/memory/stm/index.ts +0 -32
- package/src/core/memory/stm/lazy-session-manager.ts +0 -220
- package/src/core/models/anthropic.ts +0 -53
- package/src/core/models/bedrock.ts +0 -54
- package/src/core/models/google.ts +0 -51
- package/src/core/models/groq.ts +0 -48
- package/src/core/models/index.ts +0 -19
- package/src/core/models/moonshot.ts +0 -54
- package/src/core/models/ollama/index.ts +0 -13
- package/src/core/models/ollama/strands-ollama.ts +0 -439
- package/src/core/models/openai.ts +0 -12
- package/src/core/models/xai.ts +0 -47
- package/src/core/prompts/environment.ts +0 -71
- package/src/core/prompts/index.ts +0 -22
- package/src/core/prompts/skills.ts +0 -66
- package/src/core/prompts/system.ts +0 -183
- package/src/core/skills/index.ts +0 -2
- package/src/core/skills/registry.ts +0 -239
- package/src/core/skills/tools.ts +0 -80
- package/src/core/state/file-tool-display.ts +0 -70
- package/src/core/state/thought-process.ts +0 -49
- package/src/core/state/todos.ts +0 -84
- package/src/core/state/tool-approvals.ts +0 -100
- package/src/core/tools/fetch.ts +0 -288
- package/src/core/tools/filesystem.ts +0 -1105
- package/src/core/tools/index.ts +0 -9
- package/src/core/tools/shell.ts +0 -426
- package/src/core/tools/sleep.ts +0 -51
- package/src/core/tools/thinking.ts +0 -149
- package/src/core/tools/time.ts +0 -121
- package/src/core/tools/todo.ts +0 -44
- package/src/core/tools/web-search.ts +0 -278
- package/src/core/tools/wiki.ts +0 -703
- package/src/core/utils/attachments.ts +0 -201
- package/src/core/utils/cwd-context.ts +0 -11
- package/src/core/utils/file-formats.ts +0 -60
- package/src/core/utils/paths.ts +0 -37
- package/src/daemon/approvals.ts +0 -127
- package/src/daemon/index.ts +0 -153
- package/src/daemon/queue.ts +0 -48
- package/src/exec/approvals.ts +0 -90
- package/tsconfig.json +0 -30
- /package/{src → dist}/core/prompts/agents/plan.md +0 -0
- /package/{src → dist}/core/prompts/agents/research.md +0 -0
- /package/{src → dist}/core/prompts/harness/behaviour.md +0 -0
- /package/{src → dist}/core/prompts/harness/communication.md +0 -0
- /package/{src → dist}/core/prompts/harness/engineering.md +0 -0
- /package/{src → dist}/core/prompts/harness/execution.md +0 -0
- /package/{src → dist}/core/prompts/harness/guardrails.md +0 -0
- /package/{src → dist}/core/prompts/static/daemon.md +0 -0
- /package/{src → dist}/core/prompts/static/environment.md +0 -0
- /package/{src → dist}/core/prompts/static/fetch.md +0 -0
- /package/{src → dist}/core/prompts/static/filesystem.md +0 -0
- /package/{src → dist}/core/prompts/static/identity.md +0 -0
- /package/{src → dist}/core/prompts/static/ltm.md +0 -0
- /package/{src → dist}/core/prompts/static/shell.md +0 -0
- /package/{src → dist}/core/prompts/static/skills.md +0 -0
- /package/{src → dist}/core/prompts/static/sleep.md +0 -0
- /package/{src → dist}/core/prompts/static/subagents.md +0 -0
- /package/{src → dist}/core/prompts/static/thinking.md +0 -0
- /package/{src → dist}/core/prompts/static/todo.md +0 -0
- /package/{src → dist}/core/prompts/static/web-search.md +0 -0
- /package/{src → dist}/core/prompts/static/wiki.md +0 -0
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import type { Where } from "chromadb";
|
|
2
|
-
import type {
|
|
3
|
-
LongTermMemoryScope,
|
|
4
|
-
Memory,
|
|
5
|
-
MemorySource,
|
|
6
|
-
MemoryStatus,
|
|
7
|
-
MemoryType,
|
|
8
|
-
} from "./types.ts";
|
|
9
|
-
|
|
10
|
-
export const DEFAULT_HALF_LIFE_MS = 1000 * 60 * 60 * 24 * 30;
|
|
11
|
-
export const DEFAULT_REINFORCEMENT_STEP = 0.1;
|
|
12
|
-
export const DEFAULT_DEDUPE_THRESHOLD = 0.92;
|
|
13
|
-
const DEFAULT_SEARCH_LIMIT = 5;
|
|
14
|
-
const MAX_SEARCH_LIMIT = 20;
|
|
15
|
-
|
|
16
|
-
export type ChromaMemoryMetadata = {
|
|
17
|
-
userId: string;
|
|
18
|
-
type: MemoryType;
|
|
19
|
-
status: MemoryStatus;
|
|
20
|
-
importance: number;
|
|
21
|
-
strength: number;
|
|
22
|
-
accessCount: number;
|
|
23
|
-
confidence: number | null;
|
|
24
|
-
createdAt: number;
|
|
25
|
-
updatedAt: number | null;
|
|
26
|
-
lastAccessedAt: number | null;
|
|
27
|
-
version: number;
|
|
28
|
-
source: MemorySource;
|
|
29
|
-
/** Omitted when empty: Chroma rejects `[]` for list metadata values. */
|
|
30
|
-
tags?: string[];
|
|
31
|
-
entities?: string[];
|
|
32
|
-
relatedTo?: string[];
|
|
33
|
-
supersededBy: string | null;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export function clampSearchLimit(limit?: number): number {
|
|
37
|
-
const value = Math.trunc(limit ?? DEFAULT_SEARCH_LIMIT);
|
|
38
|
-
return Math.min(Math.max(value, 1), MAX_SEARCH_LIMIT);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function clampUnitInterval(value: number, fallback: number): number {
|
|
42
|
-
if (!Number.isFinite(value)) {
|
|
43
|
-
return fallback;
|
|
44
|
-
}
|
|
45
|
-
return Math.min(1, Math.max(0, value));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function asStringArray(value: unknown): string[] | undefined {
|
|
49
|
-
if (Array.isArray(value)) {
|
|
50
|
-
return value.filter((item): item is string => typeof item === "string");
|
|
51
|
-
}
|
|
52
|
-
if (typeof value === "string" && value.length > 0) {
|
|
53
|
-
return [value];
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function normalizeText(text: string): string {
|
|
59
|
-
return text
|
|
60
|
-
.toLowerCase()
|
|
61
|
-
.replace(/[^\p{L}\p{N}\s]/gu, " ")
|
|
62
|
-
.replace(/\s+/g, " ")
|
|
63
|
-
.trim();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function similarity(left: string, right: string): number {
|
|
67
|
-
const a = normalizeText(left);
|
|
68
|
-
const b = normalizeText(right);
|
|
69
|
-
if (!a || !b) {
|
|
70
|
-
return 0;
|
|
71
|
-
}
|
|
72
|
-
if (a === b) {
|
|
73
|
-
return 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const shorter = a.length <= b.length ? a : b;
|
|
77
|
-
const longer = a.length > b.length ? a : b;
|
|
78
|
-
const containment = longer.includes(shorter)
|
|
79
|
-
? shorter.length / longer.length
|
|
80
|
-
: 0;
|
|
81
|
-
|
|
82
|
-
const tokensA = new Set(a.split(" "));
|
|
83
|
-
const tokensB = new Set(b.split(" "));
|
|
84
|
-
let intersection = 0;
|
|
85
|
-
for (const token of tokensA) {
|
|
86
|
-
if (tokensB.has(token)) {
|
|
87
|
-
intersection += 1;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const union = new Set([...tokensA, ...tokensB]).size;
|
|
91
|
-
const jaccard = union === 0 ? 0 : intersection / union;
|
|
92
|
-
|
|
93
|
-
return Math.max(containment, jaccard);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function getEffectiveStrength(
|
|
97
|
-
metadata: Pick<
|
|
98
|
-
Memory["metadata"],
|
|
99
|
-
"createdAt" | "lastAccessedAt" | "strength"
|
|
100
|
-
>,
|
|
101
|
-
halfLifeMs: number,
|
|
102
|
-
): number {
|
|
103
|
-
const reference = metadata.lastAccessedAt ?? metadata.createdAt;
|
|
104
|
-
const age = Math.max(0, Date.now() - reference);
|
|
105
|
-
return metadata.strength * Math.exp(-age / halfLifeMs);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function toChromaMetadata(memory: Memory): ChromaMemoryMetadata {
|
|
109
|
-
const tags = (memory.metadata.tags ?? []).filter((t) => t.length > 0);
|
|
110
|
-
const entities = (memory.metadata.entities ?? []).filter((t) => t.length > 0);
|
|
111
|
-
const relatedTo = (memory.metadata.relatedTo ?? []).filter(
|
|
112
|
-
(t) => t.length > 0,
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
const meta: ChromaMemoryMetadata = {
|
|
116
|
-
userId: memory.userId,
|
|
117
|
-
type: memory.type,
|
|
118
|
-
status: memory.status,
|
|
119
|
-
importance: memory.metadata.importance,
|
|
120
|
-
strength: memory.metadata.strength,
|
|
121
|
-
accessCount: memory.metadata.accessCount,
|
|
122
|
-
confidence: memory.metadata.confidence ?? null,
|
|
123
|
-
createdAt: memory.metadata.createdAt,
|
|
124
|
-
updatedAt: memory.metadata.updatedAt ?? null,
|
|
125
|
-
lastAccessedAt: memory.metadata.lastAccessedAt ?? null,
|
|
126
|
-
version: memory.metadata.version,
|
|
127
|
-
source: memory.metadata.source,
|
|
128
|
-
supersededBy: memory.metadata.supersededBy ?? null,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
if (tags.length > 0) {
|
|
132
|
-
meta.tags = tags;
|
|
133
|
-
}
|
|
134
|
-
if (entities.length > 0) {
|
|
135
|
-
meta.entities = entities;
|
|
136
|
-
}
|
|
137
|
-
if (relatedTo.length > 0) {
|
|
138
|
-
meta.relatedTo = relatedTo;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return meta;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function toMemory(
|
|
145
|
-
id: string,
|
|
146
|
-
content: string,
|
|
147
|
-
metadata: ChromaMemoryMetadata | null | undefined,
|
|
148
|
-
): Memory {
|
|
149
|
-
const createdAt = Number(metadata?.createdAt ?? Date.now());
|
|
150
|
-
return {
|
|
151
|
-
id,
|
|
152
|
-
userId: metadata?.userId ?? "",
|
|
153
|
-
type: (metadata?.type ?? "semantic") as MemoryType,
|
|
154
|
-
status: (metadata?.status ?? "active") as MemoryStatus,
|
|
155
|
-
content,
|
|
156
|
-
metadata: {
|
|
157
|
-
createdAt,
|
|
158
|
-
updatedAt: metadata?.updatedAt ?? undefined,
|
|
159
|
-
lastAccessedAt: metadata?.lastAccessedAt ?? undefined,
|
|
160
|
-
importance: clampUnitInterval(Number(metadata?.importance ?? 0.7), 0.7),
|
|
161
|
-
strength: Number(metadata?.strength ?? 0.5),
|
|
162
|
-
confidence:
|
|
163
|
-
metadata?.confidence == null
|
|
164
|
-
? undefined
|
|
165
|
-
: clampUnitInterval(Number(metadata.confidence), 1),
|
|
166
|
-
accessCount: Number(metadata?.accessCount ?? 0),
|
|
167
|
-
version: Number(metadata?.version ?? 1),
|
|
168
|
-
source: (metadata?.source ?? "assistant") as MemorySource,
|
|
169
|
-
tags: asStringArray(metadata?.tags),
|
|
170
|
-
entities: asStringArray(metadata?.entities),
|
|
171
|
-
supersededBy: metadata?.supersededBy ?? undefined,
|
|
172
|
-
relatedTo: asStringArray(metadata?.relatedTo),
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export function buildWhere(
|
|
178
|
-
scope: LongTermMemoryScope,
|
|
179
|
-
options?: {
|
|
180
|
-
status?: MemoryStatus;
|
|
181
|
-
includeArchived?: boolean;
|
|
182
|
-
types?: MemoryType[];
|
|
183
|
-
},
|
|
184
|
-
): Where {
|
|
185
|
-
// Chroma v3: top-level `where` must have exactly one key (field predicate or $and/$or).
|
|
186
|
-
const parts: Where[] = [{ userId: scope.userId } as Where];
|
|
187
|
-
|
|
188
|
-
const statusFilter = options?.includeArchived
|
|
189
|
-
? options.status
|
|
190
|
-
: (options?.status ?? "active");
|
|
191
|
-
|
|
192
|
-
if (statusFilter !== undefined) {
|
|
193
|
-
parts.push({ status: statusFilter } as Where);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (options?.types?.length) {
|
|
197
|
-
parts.push({ type: { $in: options.types } } as Where);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (parts.length === 1) {
|
|
201
|
-
return parts[0]!;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return { $and: parts } as Where;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export function chromaClientArgsFromUrl(urlString: string): {
|
|
208
|
-
host: string;
|
|
209
|
-
port?: number;
|
|
210
|
-
ssl: boolean;
|
|
211
|
-
} {
|
|
212
|
-
const url = new URL(urlString);
|
|
213
|
-
return {
|
|
214
|
-
host: url.hostname,
|
|
215
|
-
port: url.port ? Number(url.port) : undefined,
|
|
216
|
-
ssl: url.protocol === "https:",
|
|
217
|
-
};
|
|
218
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import type {
|
|
4
|
-
Snapshot,
|
|
5
|
-
SnapshotLocation,
|
|
6
|
-
SnapshotManifest,
|
|
7
|
-
SnapshotStorage,
|
|
8
|
-
} from "@strands-agents/sdk";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Snapshot storage with a flat per-session layout:
|
|
12
|
-
* `<baseDir>/<sessionId>/snapshot_latest.json`.
|
|
13
|
-
*/
|
|
14
|
-
export class FlatFileStorage implements SnapshotStorage {
|
|
15
|
-
constructor(private readonly baseDir: string) {}
|
|
16
|
-
|
|
17
|
-
async saveSnapshot(params: {
|
|
18
|
-
location: SnapshotLocation;
|
|
19
|
-
snapshotId: string;
|
|
20
|
-
isLatest: boolean;
|
|
21
|
-
snapshot: Snapshot;
|
|
22
|
-
}): Promise<void> {
|
|
23
|
-
const path = this.snapshotPath(params.location, params.snapshotId);
|
|
24
|
-
await mkdir(join(this.sessionDir(params.location.sessionId)), {
|
|
25
|
-
recursive: true,
|
|
26
|
-
});
|
|
27
|
-
await writeFile(path, JSON.stringify(params.snapshot, null, 2), "utf8");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async loadSnapshot(params: {
|
|
31
|
-
location: SnapshotLocation;
|
|
32
|
-
snapshotId?: string;
|
|
33
|
-
}): Promise<Snapshot | null> {
|
|
34
|
-
const path = this.snapshotPath(params.location, params.snapshotId);
|
|
35
|
-
try {
|
|
36
|
-
const raw = await readFile(path, "utf8");
|
|
37
|
-
return JSON.parse(raw) as Snapshot;
|
|
38
|
-
} catch (error) {
|
|
39
|
-
if (
|
|
40
|
-
error instanceof Error &&
|
|
41
|
-
"code" in error &&
|
|
42
|
-
error.code === "ENOENT"
|
|
43
|
-
) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async listSnapshotIds(): Promise<string[]> {
|
|
51
|
-
// Flat storage only tracks one mutable snapshot.
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async deleteSession(params: { sessionId: string }): Promise<void> {
|
|
56
|
-
await rm(this.sessionDir(params.sessionId), {
|
|
57
|
-
recursive: true,
|
|
58
|
-
force: true,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async loadManifest(): Promise<SnapshotManifest> {
|
|
63
|
-
return {
|
|
64
|
-
schemaVersion: "1.0",
|
|
65
|
-
updatedAt: new Date().toISOString(),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async saveManifest(): Promise<void> {
|
|
70
|
-
// No-op: flat storage doesn't persist manifest metadata.
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private sessionDir(sessionId: string): string {
|
|
74
|
-
return join(this.baseDir, sessionId);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private snapshotPath(
|
|
78
|
-
location: SnapshotLocation,
|
|
79
|
-
snapshotId?: string,
|
|
80
|
-
): string {
|
|
81
|
-
if (snapshotId && snapshotId !== "latest") {
|
|
82
|
-
return join(
|
|
83
|
-
this.sessionDir(location.sessionId),
|
|
84
|
-
`snapshot_${snapshotId}.json`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return join(this.sessionDir(location.sessionId), "snapshot_latest.json");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SessionManager,
|
|
3
|
-
SummarizingConversationManager,
|
|
4
|
-
} from "@strands-agents/sdk";
|
|
5
|
-
import { sessionsPath } from "../../utils/paths";
|
|
6
|
-
import { FlatFileStorage } from "./flat-file-storage";
|
|
7
|
-
import { LazySessionManager } from "./lazy-session-manager";
|
|
8
|
-
|
|
9
|
-
export function create(sessionId?: string) {
|
|
10
|
-
const conversationManager = new SummarizingConversationManager({
|
|
11
|
-
summaryRatio: 0.5,
|
|
12
|
-
preserveRecentMessages: 5,
|
|
13
|
-
});
|
|
14
|
-
const storage = new FlatFileStorage(sessionsPath());
|
|
15
|
-
|
|
16
|
-
if (!sessionId) {
|
|
17
|
-
return {
|
|
18
|
-
plugins: [new LazySessionManager({ storage })],
|
|
19
|
-
conversationManager,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const sessionManager = new SessionManager({
|
|
24
|
-
sessionId,
|
|
25
|
-
storage: { snapshot: storage },
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return { sessionManager, conversationManager };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { LazySessionManager } from "./lazy-session-manager";
|
|
32
|
-
export type { LazySessionManagerConfig } from "./lazy-session-manager";
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterInvocationEvent,
|
|
3
|
-
BeforeInvocationEvent,
|
|
4
|
-
Message,
|
|
5
|
-
contentBlockFromData,
|
|
6
|
-
type LocalAgent,
|
|
7
|
-
type MessageData,
|
|
8
|
-
type Plugin,
|
|
9
|
-
type SystemPrompt,
|
|
10
|
-
type SystemPromptData,
|
|
11
|
-
type Snapshot,
|
|
12
|
-
type SnapshotLocation,
|
|
13
|
-
type SnapshotStorage,
|
|
14
|
-
} from "@strands-agents/sdk";
|
|
15
|
-
import type { JSONValue } from "@strands-agents/sdk";
|
|
16
|
-
|
|
17
|
-
const DEFAULT_SESSION_ID = "default-session";
|
|
18
|
-
const DEFAULT_APP_STATE_KEY = "sessionId";
|
|
19
|
-
const DEFAULT_SCOPE_ID = "agent";
|
|
20
|
-
const SNAPSHOT_SCHEMA_VERSION = "1.0";
|
|
21
|
-
// `FileStorage` (and any backend that follows its convention) validates ids
|
|
22
|
-
// against `[a-z0-9_-]+`, so coerce anything else (e.g. `919599960600@c.us`).
|
|
23
|
-
const UNSAFE_CHARS = /[^a-z0-9_-]+/g;
|
|
24
|
-
const RUNTIME_OWNED_KEYS = ["userId", "origin"] as const;
|
|
25
|
-
|
|
26
|
-
export type LazySessionManagerConfig = {
|
|
27
|
-
/** Pluggable snapshot backend (e.g. `FileStorage`). */
|
|
28
|
-
storage: SnapshotStorage;
|
|
29
|
-
/** Fallback session id when `appState` does not provide one. Defaults to `"default-session"`. */
|
|
30
|
-
defaultSessionId?: string;
|
|
31
|
-
/** `appState` key used to derive the active session id. Defaults to `"sessionId"`. */
|
|
32
|
-
appStateKey?: string;
|
|
33
|
-
/** Scope id passed through to the storage backend. Defaults to `"agent"`. */
|
|
34
|
-
scopeId?: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Short-term memory plugin that resolves the active session id at invocation
|
|
39
|
-
* time from `agent.appState` instead of binding it once at construction.
|
|
40
|
-
*
|
|
41
|
-
* Designed for long-lived agents that fan out to many independent
|
|
42
|
-
* conversations (e.g. a daemon routing notifications from multiple chat
|
|
43
|
-
* channels). Persistence is delegated to a `SnapshotStorage` so any backend
|
|
44
|
-
* (filesystem, S3, custom) works.
|
|
45
|
-
*/
|
|
46
|
-
export class LazySessionManager implements Plugin {
|
|
47
|
-
private readonly storage: SnapshotStorage;
|
|
48
|
-
private readonly defaultSessionId: string;
|
|
49
|
-
private readonly appStateKey: string;
|
|
50
|
-
private readonly scopeId: string;
|
|
51
|
-
|
|
52
|
-
constructor(config: LazySessionManagerConfig) {
|
|
53
|
-
this.storage = config.storage;
|
|
54
|
-
this.defaultSessionId = sanitize(
|
|
55
|
-
config.defaultSessionId ?? DEFAULT_SESSION_ID,
|
|
56
|
-
);
|
|
57
|
-
this.appStateKey = config.appStateKey ?? DEFAULT_APP_STATE_KEY;
|
|
58
|
-
this.scopeId = sanitize(config.scopeId ?? DEFAULT_SCOPE_ID);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get name(): string {
|
|
62
|
-
return "hooman:lazy-session-manager";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
initAgent(agent: LocalAgent): void {
|
|
66
|
-
agent.addHook(BeforeInvocationEvent, async (event) => {
|
|
67
|
-
await this.restore(event.agent);
|
|
68
|
-
});
|
|
69
|
-
agent.addHook(AfterInvocationEvent, async (event) => {
|
|
70
|
-
await this.save(event.agent);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Removes the persisted history for the given session, if present. */
|
|
75
|
-
async deleteSession(sessionId: string): Promise<void> {
|
|
76
|
-
await this.storage.deleteSession({ sessionId: sanitize(sessionId) });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private location(agent: LocalAgent): SnapshotLocation {
|
|
80
|
-
return {
|
|
81
|
-
sessionId: sanitize(this.resolveSessionId(agent)),
|
|
82
|
-
scope: "agent",
|
|
83
|
-
scopeId: this.scopeId,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private resolveSessionId(agent: LocalAgent): string {
|
|
88
|
-
const raw = agent.appState.get(this.appStateKey);
|
|
89
|
-
const candidate = typeof raw === "string" ? raw.trim() : "";
|
|
90
|
-
return candidate.length > 0 ? candidate : this.defaultSessionId;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private async restore(agent: LocalAgent): Promise<void> {
|
|
94
|
-
const runtimeState = this.captureRuntimeState(agent);
|
|
95
|
-
const snapshot = await this.storage.loadSnapshot({
|
|
96
|
-
location: this.location(agent),
|
|
97
|
-
});
|
|
98
|
-
agent.messages.length = 0;
|
|
99
|
-
if (!snapshot) {
|
|
100
|
-
this.restoreRuntimeState(agent, runtimeState);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
loadSnapshot(agent, snapshot);
|
|
104
|
-
this.restoreRuntimeState(agent, runtimeState);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private async save(agent: LocalAgent): Promise<void> {
|
|
108
|
-
const snapshot = takeSnapshot(agent);
|
|
109
|
-
await this.storage.saveSnapshot({
|
|
110
|
-
location: this.location(agent),
|
|
111
|
-
snapshotId: "latest",
|
|
112
|
-
isLatest: true,
|
|
113
|
-
snapshot,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private captureRuntimeState(agent: LocalAgent): Map<string, unknown> {
|
|
118
|
-
const state = new Map<string, unknown>();
|
|
119
|
-
const keys = [this.appStateKey, ...RUNTIME_OWNED_KEYS];
|
|
120
|
-
for (const key of keys) {
|
|
121
|
-
state.set(key, agent.appState.get(key));
|
|
122
|
-
}
|
|
123
|
-
return state;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private restoreRuntimeState(
|
|
127
|
-
agent: LocalAgent,
|
|
128
|
-
runtimeState: Map<string, unknown>,
|
|
129
|
-
): void {
|
|
130
|
-
for (const [key, value] of runtimeState.entries()) {
|
|
131
|
-
if (value === undefined) {
|
|
132
|
-
agent.appState.delete(key);
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
agent.appState.set(key, value);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function sanitize(value: string): string {
|
|
141
|
-
const trimmed = value.trim().toLowerCase().replace(UNSAFE_CHARS, "_");
|
|
142
|
-
return trimmed.length > 0 ? trimmed : DEFAULT_SESSION_ID;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function takeSnapshot(agent: LocalAgent): Snapshot {
|
|
146
|
-
const data: Record<string, JSONValue> = {
|
|
147
|
-
messages: agent.messages.map((message) =>
|
|
148
|
-
message.toJSON(),
|
|
149
|
-
) as unknown as JSONValue,
|
|
150
|
-
state: agent.appState.getAll() as JSONValue,
|
|
151
|
-
systemPrompt:
|
|
152
|
-
agent.systemPrompt !== undefined
|
|
153
|
-
? (systemPromptToData(agent.systemPrompt) as JSONValue)
|
|
154
|
-
: null,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
scope: "agent",
|
|
159
|
-
schemaVersion: SNAPSHOT_SCHEMA_VERSION,
|
|
160
|
-
createdAt: new Date().toISOString(),
|
|
161
|
-
data,
|
|
162
|
-
appData: {},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function loadSnapshot(agent: LocalAgent, snapshot: Snapshot): void {
|
|
167
|
-
if (snapshot.scope !== "agent") {
|
|
168
|
-
throw new Error(`Expected snapshot scope 'agent', got '${snapshot.scope}'`);
|
|
169
|
-
}
|
|
170
|
-
if (snapshot.schemaVersion !== SNAPSHOT_SCHEMA_VERSION) {
|
|
171
|
-
throw new Error(
|
|
172
|
-
`Unsupported snapshot schema version: ${snapshot.schemaVersion}. Current version: ${SNAPSHOT_SCHEMA_VERSION}`,
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if ("messages" in snapshot.data) {
|
|
177
|
-
const messages = snapshot.data.messages;
|
|
178
|
-
agent.messages.length = 0;
|
|
179
|
-
for (const msgData of messages as unknown as MessageData[]) {
|
|
180
|
-
agent.messages.push(Message.fromJSON(msgData));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if ("state" in snapshot.data) {
|
|
185
|
-
const state = snapshot.data.state;
|
|
186
|
-
const nextState =
|
|
187
|
-
state && typeof state === "object" && !Array.isArray(state)
|
|
188
|
-
? (state as Record<string, JSONValue>)
|
|
189
|
-
: {};
|
|
190
|
-
agent.appState.clear();
|
|
191
|
-
for (const [key, value] of Object.entries(nextState)) {
|
|
192
|
-
agent.appState.set(key, value);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if ("systemPrompt" in snapshot.data) {
|
|
197
|
-
const systemPrompt = snapshot.data.systemPrompt;
|
|
198
|
-
if (systemPrompt !== null) {
|
|
199
|
-
agent.systemPrompt = systemPromptFromData(
|
|
200
|
-
systemPrompt as SystemPromptData,
|
|
201
|
-
);
|
|
202
|
-
} else {
|
|
203
|
-
delete agent.systemPrompt;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function systemPromptToData(prompt: SystemPrompt): SystemPromptData {
|
|
209
|
-
if (typeof prompt === "string") {
|
|
210
|
-
return prompt;
|
|
211
|
-
}
|
|
212
|
-
return prompt.map((block) => block.toJSON()) as SystemPromptData;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function systemPromptFromData(data: SystemPromptData): SystemPrompt {
|
|
216
|
-
if (typeof data === "string") {
|
|
217
|
-
return data;
|
|
218
|
-
}
|
|
219
|
-
return data.map((block) => contentBlockFromData(block)) as SystemPrompt;
|
|
220
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
2
|
-
import { VercelModel } from "@strands-agents/sdk/models/vercel";
|
|
3
|
-
import type { AnthropicProviderSettings } from "@ai-sdk/anthropic";
|
|
4
|
-
import type { VercelModelConfig } from "@strands-agents/sdk/models/vercel";
|
|
5
|
-
import { omit, pick } from "lodash";
|
|
6
|
-
|
|
7
|
-
const PROVIDER_SETTINGS_KEYS = [
|
|
8
|
-
"apiKey",
|
|
9
|
-
"authToken",
|
|
10
|
-
"baseURL",
|
|
11
|
-
"headers",
|
|
12
|
-
] as const;
|
|
13
|
-
|
|
14
|
-
function pickProviderSettings(
|
|
15
|
-
params: Record<string, unknown>,
|
|
16
|
-
): AnthropicProviderSettings {
|
|
17
|
-
const picked = pick(params, [...PROVIDER_SETTINGS_KEYS]) as Record<
|
|
18
|
-
string,
|
|
19
|
-
unknown
|
|
20
|
-
>;
|
|
21
|
-
const unset = Object.keys(picked).filter((k) => picked[k] === undefined);
|
|
22
|
-
return omit(picked, unset) as AnthropicProviderSettings;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function pickVercelModelConfig(
|
|
26
|
-
params: Record<string, unknown>,
|
|
27
|
-
): Partial<VercelModelConfig> {
|
|
28
|
-
return omit(params, [
|
|
29
|
-
...PROVIDER_SETTINGS_KEYS,
|
|
30
|
-
]) as Partial<VercelModelConfig>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Anthropic via AI SDK + Strands {@link VercelModel}.
|
|
35
|
-
*
|
|
36
|
-
* - **`config.llm.model`**: model id passed to `anthropic(...)` (e.g. `claude-sonnet-4-20250514`).
|
|
37
|
-
* - **`params`**: Settings {@link AnthropicProviderSettings} (`apiKey`, `authToken`, `baseURL`, …).
|
|
38
|
-
* If none are set, the default provider is used (`ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` from env).
|
|
39
|
-
* - Any other `params` keys are forwarded as {@link VercelModelConfig} (e.g. `temperature`, `maxTokens`).
|
|
40
|
-
*/
|
|
41
|
-
export function create(
|
|
42
|
-
model: string,
|
|
43
|
-
params: Record<string, unknown> = {},
|
|
44
|
-
): VercelModel {
|
|
45
|
-
const settings = pickProviderSettings(params);
|
|
46
|
-
const provider =
|
|
47
|
-
Object.keys(settings).length > 0 ? createAnthropic(settings) : anthropic;
|
|
48
|
-
const config = pickVercelModelConfig(params);
|
|
49
|
-
return new VercelModel({
|
|
50
|
-
provider: provider(model),
|
|
51
|
-
...config,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { BedrockRuntimeClientConfig } from "@aws-sdk/client-bedrock-runtime";
|
|
2
|
-
import { BedrockModel } from "@strands-agents/sdk/models/bedrock";
|
|
3
|
-
import type { BedrockModelOptions } from "@strands-agents/sdk";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Params map from `config.llm.params` into {@link BedrockModel} options.
|
|
7
|
-
*
|
|
8
|
-
* - **`region`**: AWS region (default `us-west-2`).
|
|
9
|
-
* - **`clientConfig`**: passed to the Bedrock Runtime client (credentials, profile, etc.).
|
|
10
|
-
* See AWS SDK v3 docs for credential options.
|
|
11
|
-
* - **`apiKey`**: optional Bedrock API key auth (bearer), if used instead of SigV4.
|
|
12
|
-
* - Any other keys are forwarded as Bedrock model config (e.g. `maxTokens`, `temperature`,
|
|
13
|
-
* `stream`, `cacheConfig`).
|
|
14
|
-
*
|
|
15
|
-
* `config.llm.model` is always used as `modelId`.
|
|
16
|
-
*/
|
|
17
|
-
export type BedrockLlmParams = Omit<
|
|
18
|
-
BedrockModelOptions,
|
|
19
|
-
"modelId" | "region" | "clientConfig" | "apiKey"
|
|
20
|
-
> & {
|
|
21
|
-
region?: string;
|
|
22
|
-
clientConfig?: BedrockRuntimeClientConfig;
|
|
23
|
-
apiKey?: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const TOP_LEVEL_KEYS = new Set(["region", "clientConfig", "apiKey", "modelId"]);
|
|
27
|
-
|
|
28
|
-
export function create(
|
|
29
|
-
model: string,
|
|
30
|
-
params: Record<string, unknown> = {},
|
|
31
|
-
): BedrockModel {
|
|
32
|
-
const p = params as Record<string, unknown>;
|
|
33
|
-
const region =
|
|
34
|
-
typeof p.region === "string" && p.region.length > 0
|
|
35
|
-
? p.region
|
|
36
|
-
: "us-west-2";
|
|
37
|
-
const clientConfig = p.clientConfig as BedrockRuntimeClientConfig | undefined;
|
|
38
|
-
const apiKey = typeof p.apiKey === "string" ? p.apiKey : undefined;
|
|
39
|
-
|
|
40
|
-
const modelOptions: Record<string, unknown> = {};
|
|
41
|
-
for (const [key, value] of Object.entries(p)) {
|
|
42
|
-
if (!TOP_LEVEL_KEYS.has(key)) {
|
|
43
|
-
modelOptions[key] = value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return new BedrockModel({
|
|
48
|
-
modelId: model,
|
|
49
|
-
region,
|
|
50
|
-
...(clientConfig ? { clientConfig } : {}),
|
|
51
|
-
...(apiKey !== undefined ? { apiKey } : {}),
|
|
52
|
-
...modelOptions,
|
|
53
|
-
} as BedrockModelOptions);
|
|
54
|
-
}
|