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,67 +0,0 @@
|
|
|
1
|
-
import { pipeline } from "@huggingface/transformers";
|
|
2
|
-
import type { FeatureExtractionPipeline } from "@huggingface/transformers";
|
|
3
|
-
import type { EmbeddingFunction } from "chromadb";
|
|
4
|
-
|
|
5
|
-
const DEFAULT_MODEL =
|
|
6
|
-
process.env.HF_EMBEDDING_MODEL ?? "Xenova/bge-small-en-v1.5";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Chroma {@link EmbeddingFunction} backed by `@huggingface/transformers`
|
|
10
|
-
* `feature-extraction` (mean-pooled, L2-normalized sentence embeddings).
|
|
11
|
-
*
|
|
12
|
-
* The pipeline is loaded lazily on first {@link HFEmbedding.generate} call so
|
|
13
|
-
* constructors stay synchronous and startup stays fast.
|
|
14
|
-
*/
|
|
15
|
-
export class HFEmbedding implements EmbeddingFunction {
|
|
16
|
-
private readonly modelId: string;
|
|
17
|
-
private pipePromise: Promise<FeatureExtractionPipeline> | null = null;
|
|
18
|
-
|
|
19
|
-
constructor(modelId: string = DEFAULT_MODEL) {
|
|
20
|
-
this.modelId = modelId;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get name(): string {
|
|
24
|
-
return `hf-transformers:${this.modelId}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private async getPipeline(): Promise<FeatureExtractionPipeline> {
|
|
28
|
-
if (!this.pipePromise) {
|
|
29
|
-
this.pipePromise = pipeline(
|
|
30
|
-
"feature-extraction",
|
|
31
|
-
this.modelId,
|
|
32
|
-
) as Promise<FeatureExtractionPipeline>;
|
|
33
|
-
}
|
|
34
|
-
return this.pipePromise;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async generate(texts: string[]): Promise<number[][]> {
|
|
38
|
-
if (texts.length === 0) {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
const pipe = await this.getPipeline();
|
|
42
|
-
const tensor = await pipe(texts, {
|
|
43
|
-
pooling: "mean",
|
|
44
|
-
normalize: true,
|
|
45
|
-
});
|
|
46
|
-
const raw = tensor.tolist() as unknown;
|
|
47
|
-
|
|
48
|
-
if (texts.length === 1) {
|
|
49
|
-
if (Array.isArray(raw) && raw.every((x) => typeof x === "number")) {
|
|
50
|
-
return [raw as number[]];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
Array.isArray(raw) &&
|
|
56
|
-
raw.length > 0 &&
|
|
57
|
-
Array.isArray(raw[0]) &&
|
|
58
|
-
(raw[0] as unknown[]).every((x) => typeof x === "number")
|
|
59
|
-
) {
|
|
60
|
-
return raw as number[][];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
throw new Error(
|
|
64
|
-
"Unexpected embedding tensor shape from feature-extraction pipeline",
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
LongTermMemoryStore,
|
|
3
|
-
create as createLongTermMemoryStore,
|
|
4
|
-
} from "./store.ts";
|
|
5
|
-
|
|
6
|
-
export { create as createLongTermMemoryTools } from "./tools.ts";
|
|
7
|
-
|
|
8
|
-
export type {
|
|
9
|
-
ArchiveMemoryInput,
|
|
10
|
-
LongTermMemoryOptions,
|
|
11
|
-
LongTermMemoryScope,
|
|
12
|
-
MemorySource,
|
|
13
|
-
SearchMemoryInput,
|
|
14
|
-
SearchMemoryResult,
|
|
15
|
-
StoreMemoryInput,
|
|
16
|
-
StoreMemoryResult,
|
|
17
|
-
UpdateMemoryInput,
|
|
18
|
-
} from "./types.ts";
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
import { ChromaClient } from "chromadb";
|
|
2
|
-
import type { QueryRowResult } from "chromadb";
|
|
3
|
-
import { HFEmbedding } from "./embed.ts";
|
|
4
|
-
import type {
|
|
5
|
-
ArchiveMemoryInput,
|
|
6
|
-
LongTermMemoryOptions,
|
|
7
|
-
LongTermMemoryScope,
|
|
8
|
-
Memory,
|
|
9
|
-
SearchMemoryInput,
|
|
10
|
-
SearchMemoryResult,
|
|
11
|
-
StoreMemoryInput,
|
|
12
|
-
StoreMemoryResult,
|
|
13
|
-
UpdateMemoryInput,
|
|
14
|
-
} from "./types.ts";
|
|
15
|
-
import type { Config } from "../../config.ts";
|
|
16
|
-
import {
|
|
17
|
-
DEFAULT_DEDUPE_THRESHOLD,
|
|
18
|
-
DEFAULT_HALF_LIFE_MS,
|
|
19
|
-
DEFAULT_REINFORCEMENT_STEP,
|
|
20
|
-
type ChromaMemoryMetadata,
|
|
21
|
-
buildWhere,
|
|
22
|
-
chromaClientArgsFromUrl,
|
|
23
|
-
clampSearchLimit,
|
|
24
|
-
clampUnitInterval,
|
|
25
|
-
getEffectiveStrength,
|
|
26
|
-
similarity,
|
|
27
|
-
toChromaMetadata,
|
|
28
|
-
toMemory,
|
|
29
|
-
} from "./utils.ts";
|
|
30
|
-
|
|
31
|
-
type Collection = Awaited<ReturnType<ChromaClient["getOrCreateCollection"]>>;
|
|
32
|
-
|
|
33
|
-
export class LongTermMemoryStore {
|
|
34
|
-
private readonly client: ChromaClient;
|
|
35
|
-
private collectionPromise: Promise<Collection> | null = null;
|
|
36
|
-
|
|
37
|
-
public constructor(
|
|
38
|
-
private readonly config: Config,
|
|
39
|
-
private readonly options: LongTermMemoryOptions = {},
|
|
40
|
-
) {
|
|
41
|
-
this.client = new ChromaClient({
|
|
42
|
-
...chromaClientArgsFromUrl(config.ltm.chroma.url),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private async collection(): Promise<Collection> {
|
|
47
|
-
if (!this.collectionPromise) {
|
|
48
|
-
this.collectionPromise = this.client.getOrCreateCollection({
|
|
49
|
-
name: this.config.ltm.chroma.collection.memory,
|
|
50
|
-
embeddingFunction: new HFEmbedding(),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return this.collectionPromise;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public async count(scope?: LongTermMemoryScope): Promise<number> {
|
|
57
|
-
const collection = await this.collection();
|
|
58
|
-
if (!scope) {
|
|
59
|
-
return collection.count();
|
|
60
|
-
}
|
|
61
|
-
const result = await collection.get({
|
|
62
|
-
where: buildWhere(scope, { includeArchived: true }),
|
|
63
|
-
include: [],
|
|
64
|
-
});
|
|
65
|
-
return result.ids.length;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public async get(id: string): Promise<Memory | null> {
|
|
69
|
-
const collection = await this.collection();
|
|
70
|
-
const result = await collection.get<ChromaMemoryMetadata>({
|
|
71
|
-
ids: [id],
|
|
72
|
-
include: ["documents", "metadatas"],
|
|
73
|
-
});
|
|
74
|
-
const content = result.documents[0];
|
|
75
|
-
const metadata = result.metadatas[0];
|
|
76
|
-
if (!content) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
return toMemory(id, content, metadata);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public async search(input: SearchMemoryInput): Promise<SearchMemoryResult[]> {
|
|
83
|
-
const collection = await this.collection();
|
|
84
|
-
const result = await collection.query<ChromaMemoryMetadata>({
|
|
85
|
-
queryTexts: [input.query],
|
|
86
|
-
nResults: clampSearchLimit(input.limit),
|
|
87
|
-
where: buildWhere(input.scope, {
|
|
88
|
-
includeArchived: input.includeArchived,
|
|
89
|
-
types: input.types,
|
|
90
|
-
}),
|
|
91
|
-
include: ["documents", "metadatas", "distances"],
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const rows = (result.rows()[0] ??
|
|
95
|
-
[]) as QueryRowResult<ChromaMemoryMetadata>[];
|
|
96
|
-
const memories = rows
|
|
97
|
-
.filter(
|
|
98
|
-
(
|
|
99
|
-
row: QueryRowResult<ChromaMemoryMetadata>,
|
|
100
|
-
): row is QueryRowResult<ChromaMemoryMetadata> & {
|
|
101
|
-
document: string;
|
|
102
|
-
metadata: ChromaMemoryMetadata;
|
|
103
|
-
} => typeof row.document === "string" && !!row.metadata,
|
|
104
|
-
)
|
|
105
|
-
.map(
|
|
106
|
-
(
|
|
107
|
-
row: QueryRowResult<ChromaMemoryMetadata> & {
|
|
108
|
-
document: string;
|
|
109
|
-
metadata: ChromaMemoryMetadata;
|
|
110
|
-
},
|
|
111
|
-
) => {
|
|
112
|
-
const memory = toMemory(row.id, row.document, row.metadata);
|
|
113
|
-
return {
|
|
114
|
-
...memory,
|
|
115
|
-
distance: row.distance,
|
|
116
|
-
effectiveStrength: getEffectiveStrength(
|
|
117
|
-
memory.metadata,
|
|
118
|
-
this.options.halfLifeMs ?? DEFAULT_HALF_LIFE_MS,
|
|
119
|
-
),
|
|
120
|
-
} satisfies SearchMemoryResult;
|
|
121
|
-
},
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
if (input.reinforce !== false && memories.length > 0) {
|
|
125
|
-
await Promise.all(
|
|
126
|
-
memories.map((memory: SearchMemoryResult) => this.reinforce(memory)),
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return memories;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
public async store(
|
|
134
|
-
input: StoreMemoryInput,
|
|
135
|
-
scope: LongTermMemoryScope,
|
|
136
|
-
): Promise<StoreMemoryResult> {
|
|
137
|
-
const collection = await this.collection();
|
|
138
|
-
const content = input.content.trim();
|
|
139
|
-
if (!content) {
|
|
140
|
-
throw new Error("Long-term memory content cannot be empty");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (input.dedupe !== false) {
|
|
144
|
-
const duplicate = await this.findDuplicate(content, scope);
|
|
145
|
-
if (duplicate) {
|
|
146
|
-
const merged = await this.mergeDuplicate(duplicate, input);
|
|
147
|
-
return {
|
|
148
|
-
id: merged.id,
|
|
149
|
-
merged: true,
|
|
150
|
-
memory: merged,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const now = Date.now();
|
|
156
|
-
const memory: Memory = {
|
|
157
|
-
id: crypto.randomUUID(),
|
|
158
|
-
userId: scope.userId,
|
|
159
|
-
type: input.type,
|
|
160
|
-
status: "active",
|
|
161
|
-
content,
|
|
162
|
-
metadata: {
|
|
163
|
-
createdAt: now,
|
|
164
|
-
updatedAt: now,
|
|
165
|
-
importance: clampUnitInterval(input.importance ?? 0.7, 0.7),
|
|
166
|
-
strength: 0.5,
|
|
167
|
-
accessCount: 0,
|
|
168
|
-
version: 1,
|
|
169
|
-
source: input.source ?? "assistant",
|
|
170
|
-
confidence:
|
|
171
|
-
input.confidence == null
|
|
172
|
-
? undefined
|
|
173
|
-
: clampUnitInterval(input.confidence, 1),
|
|
174
|
-
tags: input.tags,
|
|
175
|
-
entities: input.entities,
|
|
176
|
-
relatedTo: input.relatedTo,
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
await collection.add({
|
|
181
|
-
ids: [memory.id],
|
|
182
|
-
documents: [memory.content],
|
|
183
|
-
metadatas: [toChromaMetadata(memory)],
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
id: memory.id,
|
|
188
|
-
merged: false,
|
|
189
|
-
memory,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
public async update(input: UpdateMemoryInput): Promise<Memory> {
|
|
194
|
-
const existing = await this.get(input.id);
|
|
195
|
-
if (!existing) {
|
|
196
|
-
throw new Error(`Memory not found: ${input.id}`);
|
|
197
|
-
}
|
|
198
|
-
const content = input.content.trim();
|
|
199
|
-
if (!content) {
|
|
200
|
-
throw new Error("Long-term memory content cannot be empty");
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const next: Memory = {
|
|
204
|
-
...existing,
|
|
205
|
-
type: input.type ?? existing.type,
|
|
206
|
-
status: input.status ?? existing.status,
|
|
207
|
-
content,
|
|
208
|
-
metadata: {
|
|
209
|
-
...existing.metadata,
|
|
210
|
-
updatedAt: Date.now(),
|
|
211
|
-
version: existing.metadata.version + 1,
|
|
212
|
-
importance:
|
|
213
|
-
input.importance == null
|
|
214
|
-
? existing.metadata.importance
|
|
215
|
-
: clampUnitInterval(input.importance, existing.metadata.importance),
|
|
216
|
-
confidence:
|
|
217
|
-
input.confidence == null
|
|
218
|
-
? existing.metadata.confidence
|
|
219
|
-
: clampUnitInterval(
|
|
220
|
-
input.confidence,
|
|
221
|
-
existing.metadata.confidence ?? 1,
|
|
222
|
-
),
|
|
223
|
-
tags: input.tags ?? existing.metadata.tags,
|
|
224
|
-
entities: input.entities ?? existing.metadata.entities,
|
|
225
|
-
relatedTo: input.relatedTo ?? existing.metadata.relatedTo,
|
|
226
|
-
supersededBy: input.supersededBy ?? existing.metadata.supersededBy,
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const collection = await this.collection();
|
|
231
|
-
await collection.update({
|
|
232
|
-
ids: [next.id],
|
|
233
|
-
documents: [next.content],
|
|
234
|
-
metadatas: [toChromaMetadata(next)],
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
return next;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public async archive(input: ArchiveMemoryInput): Promise<Memory> {
|
|
241
|
-
const existing = await this.get(input.id);
|
|
242
|
-
if (!existing) {
|
|
243
|
-
throw new Error(`Memory not found: ${input.id}`);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const archived: Memory = {
|
|
247
|
-
...existing,
|
|
248
|
-
status: input.status ?? "archived",
|
|
249
|
-
metadata: {
|
|
250
|
-
...existing.metadata,
|
|
251
|
-
updatedAt: Date.now(),
|
|
252
|
-
version: existing.metadata.version + 1,
|
|
253
|
-
supersededBy: input.supersededBy ?? existing.metadata.supersededBy,
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
const collection = await this.collection();
|
|
258
|
-
await collection.update({
|
|
259
|
-
ids: [archived.id],
|
|
260
|
-
documents: [archived.content],
|
|
261
|
-
metadatas: [toChromaMetadata(archived)],
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
return archived;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private async reinforce(memory: Memory): Promise<void> {
|
|
268
|
-
const updated: Memory = {
|
|
269
|
-
...memory,
|
|
270
|
-
metadata: {
|
|
271
|
-
...memory.metadata,
|
|
272
|
-
strength:
|
|
273
|
-
memory.metadata.strength +
|
|
274
|
-
(this.options.reinforcementStep ?? DEFAULT_REINFORCEMENT_STEP),
|
|
275
|
-
lastAccessedAt: Date.now(),
|
|
276
|
-
accessCount: memory.metadata.accessCount + 1,
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
const collection = await this.collection();
|
|
281
|
-
await collection.update({
|
|
282
|
-
ids: [updated.id],
|
|
283
|
-
documents: [updated.content],
|
|
284
|
-
metadatas: [toChromaMetadata(updated)],
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
private async findDuplicate(
|
|
289
|
-
content: string,
|
|
290
|
-
scope: LongTermMemoryScope,
|
|
291
|
-
): Promise<Memory | null> {
|
|
292
|
-
const collection = await this.collection();
|
|
293
|
-
const result = await collection.query<ChromaMemoryMetadata>({
|
|
294
|
-
queryTexts: [content],
|
|
295
|
-
nResults: 3,
|
|
296
|
-
where: buildWhere(scope, { status: "active" }),
|
|
297
|
-
include: ["documents", "metadatas"],
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
const rows = result.rows()[0] ?? [];
|
|
301
|
-
for (const row of rows) {
|
|
302
|
-
if (!row.document || !row.metadata) {
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
if (
|
|
306
|
-
similarity(row.document, content) >=
|
|
307
|
-
(this.options.dedupeThreshold ?? DEFAULT_DEDUPE_THRESHOLD)
|
|
308
|
-
) {
|
|
309
|
-
return toMemory(row.id, row.document, row.metadata);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return null;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
private async mergeDuplicate(
|
|
316
|
-
existing: Memory,
|
|
317
|
-
incoming: StoreMemoryInput,
|
|
318
|
-
): Promise<Memory> {
|
|
319
|
-
const mergedTags = new Set([
|
|
320
|
-
...(existing.metadata.tags ?? []),
|
|
321
|
-
...(incoming.tags ?? []),
|
|
322
|
-
]);
|
|
323
|
-
const mergedEntities = new Set([
|
|
324
|
-
...(existing.metadata.entities ?? []),
|
|
325
|
-
...(incoming.entities ?? []),
|
|
326
|
-
]);
|
|
327
|
-
const mergedRelated = new Set([
|
|
328
|
-
...(existing.metadata.relatedTo ?? []),
|
|
329
|
-
...(incoming.relatedTo ?? []),
|
|
330
|
-
]);
|
|
331
|
-
|
|
332
|
-
const updated: Memory = {
|
|
333
|
-
...existing,
|
|
334
|
-
metadata: {
|
|
335
|
-
...existing.metadata,
|
|
336
|
-
updatedAt: Date.now(),
|
|
337
|
-
lastAccessedAt: Date.now(),
|
|
338
|
-
accessCount: existing.metadata.accessCount + 1,
|
|
339
|
-
version: existing.metadata.version + 1,
|
|
340
|
-
strength:
|
|
341
|
-
existing.metadata.strength +
|
|
342
|
-
(this.options.reinforcementStep ?? DEFAULT_REINFORCEMENT_STEP),
|
|
343
|
-
importance: Math.max(
|
|
344
|
-
existing.metadata.importance,
|
|
345
|
-
clampUnitInterval(incoming.importance ?? 0.7, 0.7),
|
|
346
|
-
),
|
|
347
|
-
confidence:
|
|
348
|
-
incoming.confidence == null
|
|
349
|
-
? existing.metadata.confidence
|
|
350
|
-
: Math.max(
|
|
351
|
-
existing.metadata.confidence ?? 0,
|
|
352
|
-
clampUnitInterval(incoming.confidence, 1),
|
|
353
|
-
),
|
|
354
|
-
tags: mergedTags.size > 0 ? [...mergedTags] : undefined,
|
|
355
|
-
entities: mergedEntities.size > 0 ? [...mergedEntities] : undefined,
|
|
356
|
-
relatedTo: mergedRelated.size > 0 ? [...mergedRelated] : undefined,
|
|
357
|
-
},
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
const collection = await this.collection();
|
|
361
|
-
await collection.update({
|
|
362
|
-
ids: [updated.id],
|
|
363
|
-
documents: [updated.content],
|
|
364
|
-
metadatas: [toChromaMetadata(updated)],
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
return updated;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export function create(
|
|
372
|
-
config: Config,
|
|
373
|
-
options?: LongTermMemoryOptions,
|
|
374
|
-
): LongTermMemoryStore {
|
|
375
|
-
return new LongTermMemoryStore(config, options);
|
|
376
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { tool } from "@strands-agents/sdk";
|
|
2
|
-
import type { JSONValue, ToolContext } from "@strands-agents/sdk";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import type { LongTermMemoryStore } from "./store.ts";
|
|
5
|
-
import type { LongTermMemoryScope, MemoryType } from "./types.ts";
|
|
6
|
-
|
|
7
|
-
const StoreTypes: [MemoryType, ...MemoryType[]] = [
|
|
8
|
-
"fact",
|
|
9
|
-
"preference",
|
|
10
|
-
"task",
|
|
11
|
-
];
|
|
12
|
-
const SearchTypes: [MemoryType, ...MemoryType[]] = [
|
|
13
|
-
"fact",
|
|
14
|
-
"preference",
|
|
15
|
-
"task",
|
|
16
|
-
"episodic",
|
|
17
|
-
"semantic",
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
function toJsonValue(value: unknown): JSONValue {
|
|
21
|
-
return JSON.parse(JSON.stringify(value)) as JSONValue;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function resolveScope(context?: ToolContext): LongTermMemoryScope {
|
|
25
|
-
const userId = context?.agent.appState.get("userId");
|
|
26
|
-
if (typeof userId !== "string" || userId.trim().length === 0) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
"Long-term memory tools require `userId` in agent appState.",
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return { userId };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function create(ltm: LongTermMemoryStore) {
|
|
36
|
-
return [
|
|
37
|
-
tool({
|
|
38
|
-
name: "store_memory",
|
|
39
|
-
description:
|
|
40
|
-
"Store important long-term memory. Only use for reusable facts, preferences, or tasks.",
|
|
41
|
-
inputSchema: z.object({
|
|
42
|
-
content: z.string().min(1).describe("Compressed memory content"),
|
|
43
|
-
type: z.enum(StoreTypes),
|
|
44
|
-
importance: z.number().min(0).max(1).optional(),
|
|
45
|
-
tags: z.array(z.string()).optional(),
|
|
46
|
-
entities: z.array(z.string()).optional(),
|
|
47
|
-
}),
|
|
48
|
-
callback: async (input, context?: ToolContext) => {
|
|
49
|
-
const scope = resolveScope(context);
|
|
50
|
-
const result = await ltm.store(
|
|
51
|
-
{
|
|
52
|
-
content: input.content,
|
|
53
|
-
type: input.type,
|
|
54
|
-
importance: input.importance,
|
|
55
|
-
tags: input.tags,
|
|
56
|
-
entities: input.entities,
|
|
57
|
-
dedupe: true,
|
|
58
|
-
},
|
|
59
|
-
scope,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
return toJsonValue({
|
|
63
|
-
id: result.id,
|
|
64
|
-
merged: result.merged,
|
|
65
|
-
memory: result.memory,
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
tool({
|
|
70
|
-
name: "search_memory",
|
|
71
|
-
description:
|
|
72
|
-
"Search relevant past memory for context. Use only if additional context is needed.",
|
|
73
|
-
inputSchema: z.object({
|
|
74
|
-
query: z.string().min(1).describe("What to search for"),
|
|
75
|
-
types: z.array(z.enum(SearchTypes)).optional(),
|
|
76
|
-
k: z
|
|
77
|
-
.number()
|
|
78
|
-
.int()
|
|
79
|
-
.min(1)
|
|
80
|
-
.max(20)
|
|
81
|
-
.optional()
|
|
82
|
-
.describe("Number of results (default 5, max 20)"),
|
|
83
|
-
}),
|
|
84
|
-
callback: async (input, context?: ToolContext) => {
|
|
85
|
-
const scope = resolveScope(context);
|
|
86
|
-
const memories = await ltm.search({
|
|
87
|
-
query: input.query,
|
|
88
|
-
scope,
|
|
89
|
-
types: input.types,
|
|
90
|
-
limit: input.k,
|
|
91
|
-
reinforce: true,
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return toJsonValue({
|
|
95
|
-
count: memories.length,
|
|
96
|
-
memories,
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
tool({
|
|
101
|
-
name: "update_memory",
|
|
102
|
-
description:
|
|
103
|
-
"Update or correct an existing memory. Prefer this over deleting.",
|
|
104
|
-
inputSchema: z.object({
|
|
105
|
-
id: z.string().min(1),
|
|
106
|
-
content: z.string().min(1),
|
|
107
|
-
tags: z.array(z.string()).optional(),
|
|
108
|
-
entities: z.array(z.string()).optional(),
|
|
109
|
-
}),
|
|
110
|
-
callback: async (input) => {
|
|
111
|
-
const memory = await ltm.update({
|
|
112
|
-
id: input.id,
|
|
113
|
-
content: input.content,
|
|
114
|
-
tags: input.tags,
|
|
115
|
-
entities: input.entities,
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
return toJsonValue({
|
|
119
|
-
id: memory.id,
|
|
120
|
-
memory,
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
}),
|
|
124
|
-
tool({
|
|
125
|
-
name: "archive_memory",
|
|
126
|
-
description: "Mark memory as no longer relevant without deleting it.",
|
|
127
|
-
inputSchema: z.object({
|
|
128
|
-
id: z.string().min(1),
|
|
129
|
-
reason: z.string().optional(),
|
|
130
|
-
}),
|
|
131
|
-
callback: async (input) => {
|
|
132
|
-
const memory = await ltm.archive({
|
|
133
|
-
id: input.id,
|
|
134
|
-
status: "archived",
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
return toJsonValue({
|
|
138
|
-
id: memory.id,
|
|
139
|
-
status: memory.status,
|
|
140
|
-
reason: input.reason ?? null,
|
|
141
|
-
memory,
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
}),
|
|
145
|
-
];
|
|
146
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
export type MemoryStatus = "active" | "archived" | "superseded" | "deleted";
|
|
2
|
-
|
|
3
|
-
export type MemoryType =
|
|
4
|
-
| "fact"
|
|
5
|
-
| "preference"
|
|
6
|
-
| "task"
|
|
7
|
-
| "episodic"
|
|
8
|
-
| "semantic";
|
|
9
|
-
|
|
10
|
-
export interface Memory {
|
|
11
|
-
id: string;
|
|
12
|
-
|
|
13
|
-
// multi-tenant partitioning
|
|
14
|
-
userId: string;
|
|
15
|
-
|
|
16
|
-
type: MemoryType;
|
|
17
|
-
status: MemoryStatus;
|
|
18
|
-
|
|
19
|
-
content: string; // human-readable
|
|
20
|
-
embedding?: number[]; // optional (store-level)
|
|
21
|
-
|
|
22
|
-
metadata: {
|
|
23
|
-
// timestamps
|
|
24
|
-
createdAt: number;
|
|
25
|
-
updatedAt?: number;
|
|
26
|
-
lastAccessedAt?: number;
|
|
27
|
-
|
|
28
|
-
// scoring
|
|
29
|
-
importance: number; // write-time signal (0–1)
|
|
30
|
-
strength: number; // dynamic reinforcement (0–∞)
|
|
31
|
-
confidence?: number; // extraction confidence
|
|
32
|
-
|
|
33
|
-
// lifecycle
|
|
34
|
-
accessCount: number;
|
|
35
|
-
version: number;
|
|
36
|
-
|
|
37
|
-
// provenance
|
|
38
|
-
source: "user" | "assistant" | "system" | "inferred";
|
|
39
|
-
|
|
40
|
-
// structure
|
|
41
|
-
tags?: string[];
|
|
42
|
-
entities?: string[];
|
|
43
|
-
|
|
44
|
-
// relationships
|
|
45
|
-
supersededBy?: string; // memory id
|
|
46
|
-
relatedTo?: string[]; // graph-lite
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type MemorySource = Memory["metadata"]["source"];
|
|
51
|
-
|
|
52
|
-
export interface LongTermMemoryScope {
|
|
53
|
-
userId: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface LongTermMemoryOptions {
|
|
57
|
-
halfLifeMs?: number;
|
|
58
|
-
reinforcementStep?: number;
|
|
59
|
-
dedupeThreshold?: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface StoreMemoryInput {
|
|
63
|
-
content: string;
|
|
64
|
-
type: MemoryType;
|
|
65
|
-
importance?: number;
|
|
66
|
-
confidence?: number;
|
|
67
|
-
tags?: string[];
|
|
68
|
-
entities?: string[];
|
|
69
|
-
relatedTo?: string[];
|
|
70
|
-
source?: MemorySource;
|
|
71
|
-
dedupe?: boolean;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface SearchMemoryInput {
|
|
75
|
-
query: string;
|
|
76
|
-
scope: LongTermMemoryScope;
|
|
77
|
-
types?: MemoryType[];
|
|
78
|
-
limit?: number;
|
|
79
|
-
includeArchived?: boolean;
|
|
80
|
-
reinforce?: boolean;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface SearchMemoryResult extends Memory {
|
|
84
|
-
distance?: number | null;
|
|
85
|
-
effectiveStrength: number;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface UpdateMemoryInput {
|
|
89
|
-
id: string;
|
|
90
|
-
content: string;
|
|
91
|
-
type?: MemoryType;
|
|
92
|
-
status?: MemoryStatus;
|
|
93
|
-
importance?: number;
|
|
94
|
-
confidence?: number;
|
|
95
|
-
tags?: string[];
|
|
96
|
-
entities?: string[];
|
|
97
|
-
relatedTo?: string[];
|
|
98
|
-
supersededBy?: string;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface ArchiveMemoryInput {
|
|
102
|
-
id: string;
|
|
103
|
-
status?: Extract<MemoryStatus, "archived" | "superseded" | "deleted">;
|
|
104
|
-
supersededBy?: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface StoreMemoryResult {
|
|
108
|
-
id: string;
|
|
109
|
-
merged: boolean;
|
|
110
|
-
memory: Memory;
|
|
111
|
-
}
|