@chendpoc/pi-memory 0.1.13 → 0.2.0
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 +66 -258
- package/UBIQUITOUS_LANGUAGE.md +81 -0
- package/dist/adapters/embed/factory.d.ts +7 -0
- package/dist/adapters/embed/factory.d.ts.map +1 -0
- package/dist/adapters/embed/factory.js +44 -0
- package/dist/adapters/embed/factory.js.map +1 -0
- package/dist/adapters/embed/hash.d.ts +3 -0
- package/dist/adapters/embed/hash.d.ts.map +1 -0
- package/dist/adapters/embed/hash.js +26 -0
- package/dist/adapters/embed/hash.js.map +1 -0
- package/dist/adapters/embed/normalize.d.ts +3 -0
- package/dist/adapters/embed/normalize.d.ts.map +1 -0
- package/dist/adapters/embed/normalize.js +15 -0
- package/dist/adapters/embed/normalize.js.map +1 -0
- package/dist/adapters/embed/ollama.d.ts +8 -0
- package/dist/adapters/embed/ollama.d.ts.map +1 -0
- package/dist/adapters/embed/ollama.js +31 -0
- package/dist/adapters/embed/ollama.js.map +1 -0
- package/dist/adapters/embed/openai.d.ts +8 -0
- package/dist/adapters/embed/openai.d.ts.map +1 -0
- package/dist/adapters/embed/openai.js +30 -0
- package/dist/adapters/embed/openai.js.map +1 -0
- package/dist/adapters/embed/types.d.ts +9 -0
- package/dist/adapters/embed/types.d.ts.map +1 -0
- package/dist/adapters/embed/types.js.map +1 -0
- package/dist/adapters/http.d.ts +13 -0
- package/dist/adapters/http.d.ts.map +1 -0
- package/dist/adapters/http.js +31 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/llm/extractText.d.ts +5 -0
- package/dist/adapters/llm/extractText.d.ts.map +1 -0
- package/dist/adapters/llm/extractText.js +7 -0
- package/dist/adapters/llm/extractText.js.map +1 -0
- package/dist/adapters/llm/factory.d.ts +11 -0
- package/dist/adapters/llm/factory.d.ts.map +1 -0
- package/dist/adapters/llm/factory.js +48 -0
- package/dist/adapters/llm/factory.js.map +1 -0
- package/dist/adapters/llm/index.d.ts +8 -0
- package/dist/adapters/llm/index.d.ts.map +1 -0
- package/dist/adapters/llm/index.js +7 -0
- package/dist/adapters/llm/index.js.map +1 -0
- package/dist/adapters/llm/modelSpec.d.ts +10 -0
- package/dist/adapters/llm/modelSpec.d.ts.map +1 -0
- package/dist/adapters/llm/modelSpec.js +21 -0
- package/dist/adapters/llm/modelSpec.js.map +1 -0
- package/dist/adapters/llm/ollama.d.ts +4 -0
- package/dist/adapters/llm/ollama.d.ts.map +1 -0
- package/dist/adapters/llm/ollama.js +32 -0
- package/dist/adapters/llm/ollama.js.map +1 -0
- package/dist/adapters/llm/openai-compat.d.ts +4 -0
- package/dist/adapters/llm/openai-compat.d.ts.map +1 -0
- package/dist/adapters/llm/openai-compat.js +36 -0
- package/dist/adapters/llm/openai-compat.js.map +1 -0
- package/dist/adapters/llm/pi-ai.d.ts +5 -0
- package/dist/adapters/llm/pi-ai.d.ts.map +1 -0
- package/dist/adapters/llm/pi-ai.js +60 -0
- package/dist/adapters/llm/pi-ai.js.map +1 -0
- package/dist/adapters/llm/standalone.d.ts +6 -0
- package/dist/adapters/llm/standalone.d.ts.map +1 -0
- package/dist/adapters/llm/standalone.js +44 -0
- package/dist/adapters/llm/standalone.js.map +1 -0
- package/dist/adapters/llm/types.d.ts +15 -0
- package/dist/adapters/llm/types.d.ts.map +1 -0
- package/dist/adapters/llm/types.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +13 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/jobs.d.ts +32 -0
- package/dist/cli/jobs.d.ts.map +1 -0
- package/dist/cli/jobs.js +100 -0
- package/dist/cli/jobs.js.map +1 -0
- package/dist/cli/log.d.ts +14 -0
- package/dist/cli/log.d.ts.map +1 -0
- package/dist/cli/log.js +32 -0
- package/dist/cli/log.js.map +1 -0
- package/dist/cli/parseArgs.d.ts +35 -0
- package/dist/cli/parseArgs.d.ts.map +1 -0
- package/dist/cli/parseArgs.js +127 -0
- package/dist/cli/parseArgs.js.map +1 -0
- package/dist/cli/status.d.ts +44 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +238 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/theme.d.ts +14 -0
- package/dist/cli/theme.d.ts.map +1 -0
- package/dist/cli/theme.js +20 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/cli.js +70 -356
- package/dist/cli.js.map +1 -1
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +14 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/parseMemoryStatusArgs.d.ts +3 -0
- package/dist/commands/parseMemoryStatusArgs.d.ts.map +1 -0
- package/dist/commands/parseMemoryStatusArgs.js +15 -0
- package/dist/commands/parseMemoryStatusArgs.js.map +1 -0
- package/dist/commands/parseRememberArgs.d.ts +10 -0
- package/dist/commands/parseRememberArgs.d.ts.map +1 -0
- package/dist/commands/parseRememberArgs.js +46 -0
- package/dist/commands/parseRememberArgs.js.map +1 -0
- package/dist/commands/remember.d.ts +8 -0
- package/dist/commands/remember.d.ts.map +1 -0
- package/dist/commands/remember.js +30 -0
- package/dist/commands/remember.js.map +1 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +81 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/types.d.ts +10 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +2 -0
- package/dist/{consolidation → commands}/types.js.map +1 -1
- package/dist/compact/index.d.ts +5 -0
- package/dist/compact/index.d.ts.map +1 -0
- package/dist/compact/index.js +5 -0
- package/dist/compact/index.js.map +1 -0
- package/dist/compact/parseMemoryExport.d.ts +6 -0
- package/dist/compact/parseMemoryExport.d.ts.map +1 -0
- package/dist/compact/parseMemoryExport.js +62 -0
- package/dist/compact/parseMemoryExport.js.map +1 -0
- package/dist/compact/register.d.ts +10 -0
- package/dist/compact/register.d.ts.map +1 -0
- package/dist/compact/register.js +47 -0
- package/dist/compact/register.js.map +1 -0
- package/dist/compact/runSummary.d.ts +6 -0
- package/dist/compact/runSummary.d.ts.map +1 -0
- package/dist/compact/runSummary.js +29 -0
- package/dist/compact/runSummary.js.map +1 -0
- package/dist/compact/subagentDelta.d.ts +6 -0
- package/dist/compact/subagentDelta.d.ts.map +1 -0
- package/dist/compact/subagentDelta.js +13 -0
- package/dist/compact/subagentDelta.js.map +1 -0
- package/dist/compact/summaryPrompt.d.ts +3 -0
- package/dist/compact/summaryPrompt.d.ts.map +1 -0
- package/dist/compact/summaryPrompt.js +41 -0
- package/dist/compact/summaryPrompt.js.map +1 -0
- package/dist/config/agentDir.d.ts +11 -0
- package/dist/config/agentDir.d.ts.map +1 -0
- package/dist/config/agentDir.js +21 -0
- package/dist/config/agentDir.js.map +1 -0
- package/dist/config/chunking.d.ts +7 -0
- package/dist/config/chunking.d.ts.map +1 -0
- package/dist/config/chunking.js +20 -0
- package/dist/config/chunking.js.map +1 -0
- package/dist/config/env.d.ts +28 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/env.js +43 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loadEnv.d.ts +10 -0
- package/dist/config/loadEnv.d.ts.map +1 -0
- package/dist/config/loadEnv.js +25 -0
- package/dist/config/loadEnv.js.map +1 -0
- package/dist/config/preflightBudget.d.ts +9 -0
- package/dist/config/preflightBudget.d.ts.map +1 -0
- package/dist/config/preflightBudget.js +16 -0
- package/dist/config/preflightBudget.js.map +1 -0
- package/dist/config/retrieval.d.ts +10 -0
- package/dist/config/retrieval.d.ts.map +1 -0
- package/dist/config/retrieval.js +31 -0
- package/dist/config/retrieval.js.map +1 -0
- package/dist/consolidate/entryKey.d.ts +6 -0
- package/dist/consolidate/entryKey.d.ts.map +1 -0
- package/dist/consolidate/entryKey.js +5 -0
- package/dist/consolidate/entryKey.js.map +1 -0
- package/dist/consolidate/index.d.ts +5 -0
- package/dist/consolidate/index.d.ts.map +1 -0
- package/dist/consolidate/index.js +5 -0
- package/dist/consolidate/index.js.map +1 -0
- package/dist/consolidate/mergeEntries.d.ts +4 -0
- package/dist/consolidate/mergeEntries.d.ts.map +1 -0
- package/dist/consolidate/mergeEntries.js +17 -0
- package/dist/consolidate/mergeEntries.js.map +1 -0
- package/dist/consolidate/mergePrompt.d.ts +4 -0
- package/dist/consolidate/mergePrompt.d.ts.map +1 -0
- package/dist/consolidate/mergePrompt.js +40 -0
- package/dist/consolidate/mergePrompt.js.map +1 -0
- package/dist/consolidate/mergeWithLlm.d.ts +4 -0
- package/dist/consolidate/mergeWithLlm.d.ts.map +1 -0
- package/dist/consolidate/mergeWithLlm.js +27 -0
- package/dist/consolidate/mergeWithLlm.js.map +1 -0
- package/dist/consolidate/runJob.d.ts +29 -0
- package/dist/consolidate/runJob.d.ts.map +1 -0
- package/dist/consolidate/runJob.js +48 -0
- package/dist/consolidate/runJob.js.map +1 -0
- package/dist/consolidate/scheduler.d.ts +18 -0
- package/dist/consolidate/scheduler.d.ts.map +1 -0
- package/dist/consolidate/scheduler.js +32 -0
- package/dist/consolidate/scheduler.js.map +1 -0
- package/dist/constants/chunking.d.ts +7 -0
- package/dist/constants/chunking.d.ts.map +1 -0
- package/dist/constants/chunking.js +7 -0
- package/dist/constants/chunking.js.map +1 -0
- package/dist/constants/env.d.ts +44 -0
- package/dist/constants/env.d.ts.map +1 -0
- package/dist/constants/env.js +49 -0
- package/dist/constants/env.js.map +1 -0
- package/dist/constants/index.d.ts +8 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +8 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/memory.d.ts +17 -0
- package/dist/constants/memory.d.ts.map +1 -0
- package/dist/constants/memory.js +16 -0
- package/dist/constants/memory.js.map +1 -0
- package/dist/constants/paths.d.ts +23 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +23 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/preflight.d.ts +10 -0
- package/dist/constants/preflight.d.ts.map +1 -0
- package/dist/constants/preflight.js +10 -0
- package/dist/constants/preflight.js.map +1 -0
- package/dist/constants/retrieval.d.ts +10 -0
- package/dist/constants/retrieval.d.ts.map +1 -0
- package/dist/constants/retrieval.js +10 -0
- package/dist/constants/retrieval.js.map +1 -0
- package/dist/constants/security.d.ts +5 -0
- package/dist/constants/security.d.ts.map +1 -0
- package/dist/constants/security.js +5 -0
- package/dist/constants/security.js.map +1 -0
- package/dist/constants/timing.d.ts +36 -0
- package/dist/constants/timing.d.ts.map +1 -0
- package/dist/constants/timing.js +36 -0
- package/dist/constants/timing.js.map +1 -0
- package/dist/index.d.ts +11 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -28
- package/dist/index.js.map +1 -1
- package/dist/init/workspace.d.ts +15 -0
- package/dist/init/workspace.d.ts.map +1 -0
- package/dist/init/workspace.js +32 -0
- package/dist/init/workspace.js.map +1 -0
- package/dist/ipc/jsonlFramer.d.ts +9 -0
- package/dist/ipc/jsonlFramer.d.ts.map +1 -0
- package/dist/ipc/jsonlFramer.js +26 -0
- package/dist/ipc/jsonlFramer.js.map +1 -0
- package/dist/pi-extension.d.ts +0 -2
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +161 -520
- package/dist/pi-extension.js.map +1 -1
- package/dist/preflight/episodic.d.ts +20 -0
- package/dist/preflight/episodic.d.ts.map +1 -0
- package/dist/preflight/episodic.js +109 -0
- package/dist/preflight/episodic.js.map +1 -0
- package/dist/preflight/queryCache.d.ts +15 -0
- package/dist/preflight/queryCache.d.ts.map +1 -0
- package/dist/preflight/queryCache.js +46 -0
- package/dist/preflight/queryCache.js.map +1 -0
- package/dist/preflight/queryIntent.d.ts +20 -0
- package/dist/preflight/queryIntent.d.ts.map +1 -0
- package/dist/preflight/queryIntent.js +75 -0
- package/dist/preflight/queryIntent.js.map +1 -0
- package/dist/preflight/render.d.ts +8 -33
- package/dist/preflight/render.d.ts.map +1 -1
- package/dist/preflight/render.js +29 -126
- package/dist/preflight/render.js.map +1 -1
- package/dist/preflight/session.d.ts +3 -0
- package/dist/preflight/session.d.ts.map +1 -0
- package/dist/preflight/session.js +6 -0
- package/dist/preflight/session.js.map +1 -0
- package/dist/preflight/strip.d.ts +0 -8
- package/dist/preflight/strip.d.ts.map +1 -1
- package/dist/preflight/strip.js +2 -11
- package/dist/preflight/strip.js.map +1 -1
- package/dist/shutdown/enqueue.d.ts +12 -0
- package/dist/shutdown/enqueue.d.ts.map +1 -0
- package/dist/shutdown/enqueue.js +14 -0
- package/dist/shutdown/enqueue.js.map +1 -0
- package/dist/shutdown/extractPrompt.d.ts +4 -0
- package/dist/shutdown/extractPrompt.d.ts.map +1 -0
- package/dist/shutdown/extractPrompt.js +29 -0
- package/dist/shutdown/extractPrompt.js.map +1 -0
- package/dist/shutdown/processed.d.ts +9 -0
- package/dist/shutdown/processed.d.ts.map +1 -0
- package/dist/shutdown/processed.js +28 -0
- package/dist/shutdown/processed.js.map +1 -0
- package/dist/shutdown/readQueue.d.ts +4 -0
- package/dist/shutdown/readQueue.d.ts.map +1 -0
- package/dist/shutdown/readQueue.js +26 -0
- package/dist/shutdown/readQueue.js.map +1 -0
- package/dist/shutdown/runDrainJob.d.ts +26 -0
- package/dist/shutdown/runDrainJob.d.ts.map +1 -0
- package/dist/shutdown/runDrainJob.js +143 -0
- package/dist/shutdown/runDrainJob.js.map +1 -0
- package/dist/shutdown/sessionReader.d.ts +6 -0
- package/dist/shutdown/sessionReader.d.ts.map +1 -0
- package/dist/shutdown/sessionReader.js +44 -0
- package/dist/shutdown/sessionReader.js.map +1 -0
- package/dist/sidecar/client.d.ts +17 -16
- package/dist/sidecar/client.d.ts.map +1 -1
- package/dist/sidecar/client.js +64 -100
- package/dist/sidecar/client.js.map +1 -1
- package/dist/sidecar/paths.d.ts +8 -0
- package/dist/sidecar/paths.d.ts.map +1 -0
- package/dist/sidecar/paths.js +23 -0
- package/dist/sidecar/paths.js.map +1 -0
- package/dist/sidecar/protocol.d.ts +54 -0
- package/dist/sidecar/protocol.d.ts.map +1 -0
- package/dist/sidecar/protocol.js +4 -0
- package/dist/sidecar/protocol.js.map +1 -0
- package/dist/sidecar/reindexBridge.d.ts +13 -0
- package/dist/sidecar/reindexBridge.d.ts.map +1 -0
- package/dist/sidecar/reindexBridge.js +37 -0
- package/dist/sidecar/reindexBridge.js.map +1 -0
- package/dist/sidecar/server/process.d.ts +2 -0
- package/dist/sidecar/server/process.d.ts.map +1 -0
- package/dist/sidecar/server/process.js +22 -0
- package/dist/sidecar/server/process.js.map +1 -0
- package/dist/sidecar/server/query.d.ts +8 -0
- package/dist/sidecar/server/query.d.ts.map +1 -0
- package/dist/sidecar/server/query.js +7 -0
- package/dist/sidecar/server/query.js.map +1 -0
- package/dist/sidecar/server/reindex.d.ts +8 -0
- package/dist/sidecar/server/reindex.d.ts.map +1 -0
- package/dist/sidecar/server/reindex.js +12 -0
- package/dist/sidecar/server/reindex.js.map +1 -0
- package/dist/sidecar/server/server.d.ts +11 -0
- package/dist/sidecar/server/server.d.ts.map +1 -0
- package/dist/sidecar/server/server.js +76 -0
- package/dist/sidecar/server/server.js.map +1 -0
- package/dist/sidecar/server/stats.d.ts +8 -0
- package/dist/sidecar/server/stats.d.ts.map +1 -0
- package/dist/sidecar/server/stats.js +18 -0
- package/dist/sidecar/server/stats.js.map +1 -0
- package/dist/sidecar/server/vec/embedder.d.ts +2 -0
- package/dist/sidecar/server/vec/embedder.d.ts.map +1 -0
- package/dist/sidecar/server/vec/embedder.js +2 -0
- package/dist/sidecar/server/vec/embedder.js.map +1 -0
- package/dist/sidecar/server/vec/mmr.d.ts +13 -0
- package/dist/sidecar/server/vec/mmr.d.ts.map +1 -0
- package/dist/sidecar/server/vec/mmr.js +36 -0
- package/dist/sidecar/server/vec/mmr.js.map +1 -0
- package/dist/sidecar/server/vec/store.d.ts +30 -0
- package/dist/sidecar/server/vec/store.d.ts.map +1 -0
- package/dist/sidecar/server/vec/store.js +179 -0
- package/dist/sidecar/server/vec/store.js.map +1 -0
- package/dist/sidecar/sidecarManager.d.ts +10 -0
- package/dist/sidecar/sidecarManager.d.ts.map +1 -0
- package/dist/sidecar/sidecarManager.js +111 -0
- package/dist/sidecar/sidecarManager.js.map +1 -0
- package/dist/sidecar/utils.d.ts +3 -0
- package/dist/sidecar/utils.d.ts.map +1 -0
- package/dist/sidecar/utils.js +27 -0
- package/dist/sidecar/utils.js.map +1 -0
- package/dist/store/backend.d.ts +12 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +47 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/index.d.ts +6 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +6 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/indexChunks.d.ts +9 -0
- package/dist/store/indexChunks.d.ts.map +1 -0
- package/dist/store/indexChunks.js +78 -0
- package/dist/store/indexChunks.js.map +1 -0
- package/dist/store/markdown/format.d.ts +5 -0
- package/dist/store/markdown/format.d.ts.map +1 -0
- package/dist/store/markdown/format.js +14 -0
- package/dist/store/markdown/format.js.map +1 -0
- package/dist/store/markdown/parse.d.ts +5 -0
- package/dist/store/markdown/parse.d.ts.map +1 -0
- package/dist/store/markdown/parse.js +57 -0
- package/dist/store/markdown/parse.js.map +1 -0
- package/dist/store/markdown/template.d.ts +3 -0
- package/dist/store/markdown/template.d.ts.map +1 -0
- package/dist/store/markdown/template.js +22 -0
- package/dist/store/markdown/template.js.map +1 -0
- package/dist/store/memoryStore.d.ts +69 -0
- package/dist/store/memoryStore.d.ts.map +1 -0
- package/dist/store/memoryStore.js +421 -0
- package/dist/store/memoryStore.js.map +1 -0
- package/dist/store/paths.d.ts +10 -0
- package/dist/store/paths.d.ts.map +1 -0
- package/dist/store/paths.js +19 -0
- package/dist/store/paths.js.map +1 -0
- package/dist/store/types.d.ts +38 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +3 -0
- package/dist/store/types.js.map +1 -0
- package/dist/ui/memoryStatusWidget.d.ts +20 -0
- package/dist/ui/memoryStatusWidget.d.ts.map +1 -0
- package/dist/ui/memoryStatusWidget.js +51 -0
- package/dist/ui/memoryStatusWidget.js.map +1 -0
- package/dist/utils/debugLog.d.ts +4 -0
- package/dist/utils/debugLog.d.ts.map +1 -0
- package/dist/utils/debugLog.js +14 -0
- package/dist/utils/debugLog.js.map +1 -0
- package/dist/utils/fs.d.ts +26 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +101 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/paths.d.ts +22 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +51 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/platform.d.ts +7 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +18 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/scheduler.d.ts +33 -0
- package/dist/utils/scheduler.d.ts.map +1 -0
- package/dist/utils/scheduler.js +63 -0
- package/dist/utils/scheduler.js.map +1 -0
- package/dist/utils/socket.d.ts +7 -0
- package/dist/utils/socket.d.ts.map +1 -0
- package/dist/utils/socket.js +35 -0
- package/dist/utils/socket.js.map +1 -0
- package/dist/utils/time.d.ts +22 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +42 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +28 -10
- package/scripts/init-memory-workspace.mjs +62 -0
- package/scripts/path-utils.mjs +12 -0
- package/scripts/platform-fs.mjs +65 -0
- package/scripts/postinstall.mjs +17 -0
- package/src/adapters/embed/factory.ts +50 -0
- package/src/adapters/embed/hash.ts +29 -0
- package/src/adapters/embed/normalize.ts +13 -0
- package/src/adapters/embed/ollama.ts +49 -0
- package/src/adapters/embed/openai.ts +46 -0
- package/src/adapters/embed/types.ts +9 -0
- package/src/adapters/http.ts +42 -0
- package/src/adapters/index.ts +16 -0
- package/src/adapters/llm/extractText.ts +6 -0
- package/src/adapters/llm/factory.ts +60 -0
- package/src/adapters/llm/index.ts +7 -0
- package/src/adapters/llm/modelSpec.ts +39 -0
- package/src/adapters/llm/ollama.ts +42 -0
- package/src/adapters/llm/openai-compat.ts +46 -0
- package/src/adapters/llm/pi-ai.ts +75 -0
- package/src/adapters/llm/standalone.ts +60 -0
- package/src/adapters/llm/types.ts +16 -0
- package/src/cli/init.ts +18 -0
- package/src/cli/jobs.ts +144 -0
- package/src/cli/log.ts +46 -0
- package/src/cli/parseArgs.ts +175 -0
- package/src/cli/status.ts +323 -0
- package/src/cli/theme.ts +26 -0
- package/src/cli.ts +80 -374
- package/src/commands/index.ts +20 -0
- package/src/commands/parseMemoryStatusArgs.ts +11 -0
- package/src/commands/parseRememberArgs.ts +55 -0
- package/src/commands/remember.ts +43 -0
- package/src/commands/status.ts +112 -0
- package/src/commands/types.ts +12 -0
- package/src/compact/index.ts +4 -0
- package/src/compact/parseMemoryExport.ts +71 -0
- package/src/compact/register.ts +57 -0
- package/src/compact/runSummary.ts +42 -0
- package/src/compact/subagentDelta.ts +22 -0
- package/src/compact/summaryPrompt.ts +45 -0
- package/src/config/agentDir.ts +24 -0
- package/src/config/chunking.ts +36 -0
- package/src/config/env.ts +97 -0
- package/src/config/index.ts +6 -0
- package/src/config/loadEnv.ts +26 -0
- package/src/config/preflightBudget.ts +33 -0
- package/src/config/retrieval.ts +50 -0
- package/src/consolidate/entryKey.ts +4 -0
- package/src/consolidate/index.ts +4 -0
- package/src/consolidate/mergeEntries.ts +22 -0
- package/src/consolidate/mergePrompt.ts +46 -0
- package/src/consolidate/mergeWithLlm.ts +39 -0
- package/src/consolidate/runJob.ts +81 -0
- package/src/consolidate/scheduler.ts +54 -0
- package/src/constants/chunking.ts +8 -0
- package/src/constants/env.ts +56 -0
- package/src/constants/index.ts +7 -0
- package/src/constants/memory.ts +22 -0
- package/src/constants/paths.ts +26 -0
- package/src/constants/preflight.ts +13 -0
- package/src/constants/retrieval.ts +10 -0
- package/src/constants/security.ts +5 -0
- package/src/constants/timing.ts +46 -0
- package/src/index.ts +11 -247
- package/src/init/workspace.ts +44 -0
- package/src/ipc/jsonlFramer.ts +29 -0
- package/src/pi-extension.ts +177 -606
- package/src/preflight/episodic.ts +159 -0
- package/src/preflight/queryCache.ts +59 -0
- package/src/preflight/queryIntent.ts +92 -0
- package/src/preflight/render.ts +34 -180
- package/src/preflight/session.ts +7 -0
- package/src/preflight/strip.ts +4 -11
- package/src/shutdown/enqueue.ts +29 -0
- package/src/shutdown/extractPrompt.ts +27 -0
- package/src/shutdown/processed.ts +45 -0
- package/src/shutdown/readQueue.ts +26 -0
- package/src/shutdown/runDrainJob.ts +202 -0
- package/src/shutdown/sessionReader.ts +61 -0
- package/src/sidecar/client.ts +98 -150
- package/src/sidecar/paths.ts +31 -0
- package/src/sidecar/protocol.ts +38 -0
- package/src/sidecar/reindexBridge.ts +52 -0
- package/src/sidecar/server/process.ts +27 -0
- package/src/sidecar/server/query.ts +16 -0
- package/src/sidecar/server/reindex.ts +21 -0
- package/src/sidecar/server/server.ts +105 -0
- package/src/sidecar/server/stats.ts +23 -0
- package/src/sidecar/server/vec/embedder.ts +1 -0
- package/src/sidecar/server/vec/mmr.ts +55 -0
- package/src/sidecar/server/vec/store.ts +232 -0
- package/src/sidecar/sidecarManager.ts +134 -0
- package/src/sidecar/utils.ts +28 -0
- package/src/store/backend.ts +66 -0
- package/src/store/index.ts +5 -0
- package/src/store/indexChunks.ts +89 -0
- package/src/store/markdown/format.ts +16 -0
- package/src/store/markdown/parse.ts +63 -0
- package/src/store/markdown/template.ts +24 -0
- package/src/store/memoryStore.ts +518 -0
- package/src/store/paths.ts +33 -0
- package/src/store/proper-lockfile.d.ts +3 -0
- package/src/store/types.ts +46 -0
- package/src/ui/memoryStatusWidget.ts +80 -0
- package/src/utils/debugLog.ts +22 -0
- package/src/utils/fs.ts +115 -0
- package/src/utils/index.ts +68 -0
- package/src/utils/paths.ts +67 -0
- package/src/utils/platform.ts +20 -0
- package/src/utils/scheduler.ts +98 -0
- package/src/utils/socket.ts +33 -0
- package/src/utils/time.ts +51 -0
- package/templates/MEMORY.md.example +22 -0
- package/dist/adapters/ollamaClient.d.ts +0 -11
- package/dist/adapters/ollamaClient.d.ts.map +0 -1
- package/dist/adapters/ollamaClient.js +0 -122
- package/dist/adapters/ollamaClient.js.map +0 -1
- package/dist/adapters/openaiCompatClient.d.ts +0 -11
- package/dist/adapters/openaiCompatClient.d.ts.map +0 -1
- package/dist/adapters/openaiCompatClient.js +0 -118
- package/dist/adapters/openaiCompatClient.js.map +0 -1
- package/dist/adapters/piComplete.d.ts +0 -17
- package/dist/adapters/piComplete.d.ts.map +0 -1
- package/dist/adapters/piComplete.js +0 -169
- package/dist/adapters/piComplete.js.map +0 -1
- package/dist/bundle/install.d.ts +0 -34
- package/dist/bundle/install.d.ts.map +0 -1
- package/dist/bundle/install.js +0 -183
- package/dist/bundle/install.js.map +0 -1
- package/dist/cache/memoryCaches.d.ts +0 -32
- package/dist/cache/memoryCaches.d.ts.map +0 -1
- package/dist/cache/memoryCaches.js +0 -59
- package/dist/cache/memoryCaches.js.map +0 -1
- package/dist/config.d.ts +0 -55
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -85
- package/dist/config.js.map +0 -1
- package/dist/consolidation/enqueue.d.ts +0 -33
- package/dist/consolidation/enqueue.d.ts.map +0 -1
- package/dist/consolidation/enqueue.js +0 -145
- package/dist/consolidation/enqueue.js.map +0 -1
- package/dist/consolidation/index.d.ts +0 -19
- package/dist/consolidation/index.d.ts.map +0 -1
- package/dist/consolidation/index.js +0 -15
- package/dist/consolidation/index.js.map +0 -1
- package/dist/consolidation/lock.d.ts +0 -5
- package/dist/consolidation/lock.d.ts.map +0 -1
- package/dist/consolidation/lock.js +0 -33
- package/dist/consolidation/lock.js.map +0 -1
- package/dist/consolidation/log.d.ts +0 -8
- package/dist/consolidation/log.d.ts.map +0 -1
- package/dist/consolidation/log.js +0 -32
- package/dist/consolidation/log.js.map +0 -1
- package/dist/consolidation/memoryIndex.d.ts +0 -18
- package/dist/consolidation/memoryIndex.d.ts.map +0 -1
- package/dist/consolidation/memoryIndex.js +0 -100
- package/dist/consolidation/memoryIndex.js.map +0 -1
- package/dist/consolidation/phase2/runPhase2.d.ts +0 -23
- package/dist/consolidation/phase2/runPhase2.d.ts.map +0 -1
- package/dist/consolidation/phase2/runPhase2.js +0 -196
- package/dist/consolidation/phase2/runPhase2.js.map +0 -1
- package/dist/consolidation/scheduler/launchd.d.ts +0 -5
- package/dist/consolidation/scheduler/launchd.d.ts.map +0 -1
- package/dist/consolidation/scheduler/launchd.js +0 -54
- package/dist/consolidation/scheduler/launchd.js.map +0 -1
- package/dist/consolidation/scheduler/runConsolidate.d.ts +0 -26
- package/dist/consolidation/scheduler/runConsolidate.d.ts.map +0 -1
- package/dist/consolidation/scheduler/runConsolidate.js +0 -83
- package/dist/consolidation/scheduler/runConsolidate.js.map +0 -1
- package/dist/consolidation/scheduler/setupSchedule.d.ts +0 -3
- package/dist/consolidation/scheduler/setupSchedule.d.ts.map +0 -1
- package/dist/consolidation/scheduler/setupSchedule.js +0 -79
- package/dist/consolidation/scheduler/setupSchedule.js.map +0 -1
- package/dist/consolidation/scheduler/systemd.d.ts +0 -9
- package/dist/consolidation/scheduler/systemd.d.ts.map +0 -1
- package/dist/consolidation/scheduler/systemd.js +0 -57
- package/dist/consolidation/scheduler/systemd.js.map +0 -1
- package/dist/consolidation/scheduler/types.d.ts +0 -24
- package/dist/consolidation/scheduler/types.d.ts.map +0 -1
- package/dist/consolidation/scheduler/types.js.map +0 -1
- package/dist/consolidation/scope.d.ts +0 -12
- package/dist/consolidation/scope.d.ts.map +0 -1
- package/dist/consolidation/scope.js +0 -51
- package/dist/consolidation/scope.js.map +0 -1
- package/dist/consolidation/stage1/deltaExtract.d.ts +0 -3
- package/dist/consolidation/stage1/deltaExtract.d.ts.map +0 -1
- package/dist/consolidation/stage1/deltaExtract.js +0 -19
- package/dist/consolidation/stage1/deltaExtract.js.map +0 -1
- package/dist/consolidation/stage1/drainQueue.d.ts +0 -21
- package/dist/consolidation/stage1/drainQueue.d.ts.map +0 -1
- package/dist/consolidation/stage1/drainQueue.js +0 -113
- package/dist/consolidation/stage1/drainQueue.js.map +0 -1
- package/dist/consolidation/stage1/extractSession.d.ts +0 -6
- package/dist/consolidation/stage1/extractSession.d.ts.map +0 -1
- package/dist/consolidation/stage1/extractSession.js +0 -47
- package/dist/consolidation/stage1/extractSession.js.map +0 -1
- package/dist/consolidation/stage1/store.d.ts +0 -45
- package/dist/consolidation/stage1/store.d.ts.map +0 -1
- package/dist/consolidation/stage1/store.js +0 -297
- package/dist/consolidation/stage1/store.js.map +0 -1
- package/dist/consolidation/types.d.ts +0 -49
- package/dist/consolidation/types.d.ts.map +0 -1
- package/dist/errclass.d.ts +0 -7
- package/dist/errclass.d.ts.map +0 -1
- package/dist/errclass.js +0 -32
- package/dist/errclass.js.map +0 -1
- package/dist/extension.d.ts +0 -24
- package/dist/extension.d.ts.map +0 -1
- package/dist/extension.js +0 -7
- package/dist/extension.js.map +0 -1
- package/dist/fallback/index.d.ts +0 -11
- package/dist/fallback/index.d.ts.map +0 -1
- package/dist/fallback/index.js +0 -16
- package/dist/fallback/index.js.map +0 -1
- package/dist/fallback/llmRerank.d.ts +0 -19
- package/dist/fallback/llmRerank.d.ts.map +0 -1
- package/dist/fallback/llmRerank.js +0 -68
- package/dist/fallback/llmRerank.js.map +0 -1
- package/dist/fallback/memoryMd.d.ts +0 -6
- package/dist/fallback/memoryMd.d.ts.map +0 -1
- package/dist/fallback/memoryMd.js +0 -35
- package/dist/fallback/memoryMd.js.map +0 -1
- package/dist/fallback/sessionIndex.d.ts +0 -35
- package/dist/fallback/sessionIndex.d.ts.map +0 -1
- package/dist/fallback/sessionIndex.js +0 -239
- package/dist/fallback/sessionIndex.js.map +0 -1
- package/dist/fallback/sessionSearch.d.ts +0 -18
- package/dist/fallback/sessionSearch.d.ts.map +0 -1
- package/dist/fallback/sessionSearch.js +0 -234
- package/dist/fallback/sessionSearch.js.map +0 -1
- package/dist/local/graphQuery.d.ts +0 -31
- package/dist/local/graphQuery.d.ts.map +0 -1
- package/dist/local/graphQuery.js +0 -195
- package/dist/local/graphQuery.js.map +0 -1
- package/dist/paths.d.ts +0 -7
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -26
- package/dist/paths.js.map +0 -1
- package/dist/preflight/detectIntents.d.ts +0 -102
- package/dist/preflight/detectIntents.d.ts.map +0 -1
- package/dist/preflight/detectIntents.js +0 -631
- package/dist/preflight/detectIntents.js.map +0 -1
- package/dist/preflight/hook.d.ts +0 -76
- package/dist/preflight/hook.d.ts.map +0 -1
- package/dist/preflight/hook.js +0 -122
- package/dist/preflight/hook.js.map +0 -1
- package/dist/service.d.ts +0 -72
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js +0 -257
- package/dist/service.js.map +0 -1
- package/dist/session/activeBranch.d.ts +0 -17
- package/dist/session/activeBranch.d.ts.map +0 -1
- package/dist/session/activeBranch.js +0 -251
- package/dist/session/activeBranch.js.map +0 -1
- package/dist/settings.d.ts +0 -41
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -85
- package/dist/settings.js.map +0 -1
- package/dist/sidecar/bundle.d.ts +0 -19
- package/dist/sidecar/bundle.d.ts.map +0 -1
- package/dist/sidecar/bundle.js +0 -39
- package/dist/sidecar/bundle.js.map +0 -1
- package/dist/sidecar/process.d.ts +0 -14
- package/dist/sidecar/process.d.ts.map +0 -1
- package/dist/sidecar/process.js +0 -138
- package/dist/sidecar/process.js.map +0 -1
- package/dist/tools/memoryAppend.d.ts +0 -47
- package/dist/tools/memoryAppend.d.ts.map +0 -1
- package/dist/tools/memoryAppend.js +0 -138
- package/dist/tools/memoryAppend.js.map +0 -1
- package/dist/tools/memoryRecall.d.ts +0 -113
- package/dist/tools/memoryRecall.d.ts.map +0 -1
- package/dist/tools/memoryRecall.js +0 -351
- package/dist/tools/memoryRecall.js.map +0 -1
- package/dist/trainer/bundleBuilder.d.ts +0 -30
- package/dist/trainer/bundleBuilder.d.ts.map +0 -1
- package/dist/trainer/bundleBuilder.js +0 -106
- package/dist/trainer/bundleBuilder.js.map +0 -1
- package/dist/trainer/bundleLoader.d.ts +0 -12
- package/dist/trainer/bundleLoader.d.ts.map +0 -1
- package/dist/trainer/bundleLoader.js +0 -59
- package/dist/trainer/bundleLoader.js.map +0 -1
- package/dist/trainer/deltaMerge.d.ts +0 -38
- package/dist/trainer/deltaMerge.d.ts.map +0 -1
- package/dist/trainer/deltaMerge.js +0 -183
- package/dist/trainer/deltaMerge.js.map +0 -1
- package/dist/trainer/entityResolver.d.ts +0 -27
- package/dist/trainer/entityResolver.d.ts.map +0 -1
- package/dist/trainer/entityResolver.js +0 -92
- package/dist/trainer/entityResolver.js.map +0 -1
- package/dist/trainer/extractFacts.d.ts +0 -67
- package/dist/trainer/extractFacts.d.ts.map +0 -1
- package/dist/trainer/extractFacts.js +0 -213
- package/dist/trainer/extractFacts.js.map +0 -1
- package/dist/trainer/index.d.ts +0 -54
- package/dist/trainer/index.d.ts.map +0 -1
- package/dist/trainer/index.js +0 -82
- package/dist/trainer/index.js.map +0 -1
- package/dist/trainer/llmExtractor.d.ts +0 -16
- package/dist/trainer/llmExtractor.d.ts.map +0 -1
- package/dist/trainer/llmExtractor.js +0 -146
- package/dist/trainer/llmExtractor.js.map +0 -1
- package/dist/trainer/marker.d.ts +0 -10
- package/dist/trainer/marker.d.ts.map +0 -1
- package/dist/trainer/marker.js +0 -28
- package/dist/trainer/marker.js.map +0 -1
- package/dist/trainer/scheduler.d.ts +0 -33
- package/dist/trainer/scheduler.d.ts.map +0 -1
- package/dist/trainer/scheduler.js +0 -73
- package/dist/trainer/scheduler.js.map +0 -1
- package/dist/trainer/sessionLoader.d.ts +0 -26
- package/dist/trainer/sessionLoader.d.ts.map +0 -1
- package/dist/trainer/sessionLoader.js +0 -145
- package/dist/trainer/sessionLoader.js.map +0 -1
- package/dist/types.d.ts +0 -135
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -8
- package/dist/types.js.map +0 -1
- package/src/adapters/ollamaClient.ts +0 -179
- package/src/adapters/openaiCompatClient.ts +0 -155
- package/src/adapters/piComplete.ts +0 -233
- package/src/bundle/install.ts +0 -206
- package/src/cache/memoryCaches.ts +0 -72
- package/src/config.ts +0 -180
- package/src/consolidation/enqueue.ts +0 -205
- package/src/consolidation/index.ts +0 -90
- package/src/consolidation/lock.ts +0 -41
- package/src/consolidation/log.ts +0 -43
- package/src/consolidation/memoryIndex.ts +0 -127
- package/src/consolidation/phase2/runPhase2.ts +0 -255
- package/src/consolidation/scheduler/launchd.ts +0 -62
- package/src/consolidation/scheduler/runConsolidate.ts +0 -115
- package/src/consolidation/scheduler/setupSchedule.ts +0 -106
- package/src/consolidation/scheduler/systemd.ts +0 -78
- package/src/consolidation/scheduler/types.ts +0 -27
- package/src/consolidation/scope.ts +0 -58
- package/src/consolidation/stage1/deltaExtract.ts +0 -29
- package/src/consolidation/stage1/drainQueue.ts +0 -143
- package/src/consolidation/stage1/extractSession.ts +0 -58
- package/src/consolidation/stage1/store.ts +0 -411
- package/src/consolidation/types.ts +0 -52
- package/src/errclass.ts +0 -37
- package/src/extension.ts +0 -23
- package/src/fallback/index.ts +0 -24
- package/src/fallback/llmRerank.ts +0 -97
- package/src/fallback/memoryMd.ts +0 -36
- package/src/fallback/sessionIndex.ts +0 -290
- package/src/fallback/sessionSearch.ts +0 -261
- package/src/local/graphQuery.ts +0 -252
- package/src/paths.ts +0 -28
- package/src/preflight/detectIntents.ts +0 -660
- package/src/preflight/hook.ts +0 -213
- package/src/service.ts +0 -306
- package/src/session/activeBranch.ts +0 -294
- package/src/settings.ts +0 -161
- package/src/sidecar/bundle.ts +0 -52
- package/src/sidecar/process.ts +0 -160
- package/src/tools/memoryAppend.ts +0 -166
- package/src/tools/memoryRecall.ts +0 -388
- package/src/trainer/bundleBuilder.ts +0 -192
- package/src/trainer/bundleLoader.ts +0 -105
- package/src/trainer/deltaMerge.ts +0 -221
- package/src/trainer/entityResolver.ts +0 -140
- package/src/trainer/extractFacts.ts +0 -312
- package/src/trainer/index.ts +0 -147
- package/src/trainer/llmExtractor.ts +0 -206
- package/src/trainer/marker.ts +0 -30
- package/src/trainer/scheduler.ts +0 -107
- package/src/trainer/sessionLoader.ts +0 -176
- package/src/types.ts +0 -168
- /package/dist/{consolidation/scheduler → adapters/embed}/types.js +0 -0
- /package/dist/{consolidation → adapters/llm}/types.js +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import { open } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
import { openConsolidationStore } from "../consolidation/stage1/store.js";
|
|
6
|
-
import type { MemoryScope } from "../consolidation/scope.js";
|
|
7
|
-
import type { ToolResult } from "../types.js";
|
|
8
|
-
|
|
9
|
-
export const MEMORY_APPEND_NAME = "memory_append";
|
|
10
|
-
|
|
11
|
-
export const MEMORY_APPEND_DESCRIPTION =
|
|
12
|
-
"Persist durable memory only when the user explicitly asks to remember something. " +
|
|
13
|
-
"Writes go through the pi-memory consolidation stage instead of direct file edits when configured.";
|
|
14
|
-
|
|
15
|
-
export const MEMORY_APPEND_PROMPT_SNIPPET = "Persist explicit user memory";
|
|
16
|
-
|
|
17
|
-
export const MEMORY_APPEND_PROMPT_GUIDELINES = [
|
|
18
|
-
"Use memory_append only when the user explicitly asks to remember a preference or durable fact — not for transient task state.",
|
|
19
|
-
] as const;
|
|
20
|
-
|
|
21
|
-
export const MEMORY_APPEND_PARAMETERS = {
|
|
22
|
-
type: "object",
|
|
23
|
-
properties: {
|
|
24
|
-
content: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description:
|
|
27
|
-
"New entries to append (markdown bullet points). Write in English by default.",
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
required: ["content"],
|
|
31
|
-
} as const;
|
|
32
|
-
|
|
33
|
-
const LOCK_RETRIES = 50;
|
|
34
|
-
const LOCK_DELAY_MS = 20;
|
|
35
|
-
|
|
36
|
-
async function withAppendLock<T>(
|
|
37
|
-
lockPath: string,
|
|
38
|
-
fn: () => Promise<T>,
|
|
39
|
-
): Promise<T> {
|
|
40
|
-
let handle;
|
|
41
|
-
for (let i = 0; i < LOCK_RETRIES; i++) {
|
|
42
|
-
try {
|
|
43
|
-
handle = await open(lockPath, "wx");
|
|
44
|
-
break;
|
|
45
|
-
} catch {
|
|
46
|
-
await new Promise((r) => setTimeout(r, LOCK_DELAY_MS));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (!handle) {
|
|
50
|
-
throw new Error("could not acquire MEMORY.md append lock");
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
return await fn();
|
|
54
|
-
} finally {
|
|
55
|
-
await handle.close();
|
|
56
|
-
await fs.unlink(lockPath).catch(() => {});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function appendToMemoryMd(
|
|
61
|
-
memoryMdPath: string,
|
|
62
|
-
content: string,
|
|
63
|
-
): Promise<void> {
|
|
64
|
-
const trimmed = content.trim();
|
|
65
|
-
if (!trimmed) {
|
|
66
|
-
throw new Error("content must not be empty");
|
|
67
|
-
}
|
|
68
|
-
await fs.mkdir(path.dirname(memoryMdPath), { recursive: true, mode: 0o700 });
|
|
69
|
-
const lockPath = `${memoryMdPath}.append.lock`;
|
|
70
|
-
const block = content.endsWith("\n") ? content : `${content}\n`;
|
|
71
|
-
await withAppendLock(lockPath, async () => {
|
|
72
|
-
await fs.appendFile(memoryMdPath, block, { encoding: "utf8", mode: 0o600 });
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface Stage1AppendOptions {
|
|
77
|
-
dbPath: string;
|
|
78
|
-
sessionId?: string;
|
|
79
|
-
sessionFile?: string;
|
|
80
|
-
scope?: MemoryScope;
|
|
81
|
-
now?: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export async function appendToStage1(
|
|
85
|
-
content: string,
|
|
86
|
-
opts: Stage1AppendOptions,
|
|
87
|
-
): Promise<string> {
|
|
88
|
-
const trimmed = content.trim();
|
|
89
|
-
if (!trimmed) throw new Error("content must not be empty");
|
|
90
|
-
const store = openConsolidationStore(opts.dbPath);
|
|
91
|
-
if (!store) throw new Error("could not open consolidation store");
|
|
92
|
-
const now = opts.now ?? new Date().toISOString();
|
|
93
|
-
const sessionId = opts.sessionId
|
|
94
|
-
? `manual_${opts.sessionId}_${Date.now()}`
|
|
95
|
-
: `manual_${Date.now()}`;
|
|
96
|
-
try {
|
|
97
|
-
store.upsertStage1Output({
|
|
98
|
-
session_id: sessionId,
|
|
99
|
-
session_file: opts.sessionFile ?? "manual-memory-append",
|
|
100
|
-
source_mtime_ms: Date.now(),
|
|
101
|
-
generated_at: now,
|
|
102
|
-
raw_memory: trimmed,
|
|
103
|
-
rollout_summary: trimmed,
|
|
104
|
-
scope: opts.scope ?? "global",
|
|
105
|
-
status: "done",
|
|
106
|
-
selected_for_phase2: false,
|
|
107
|
-
usage_count: 0,
|
|
108
|
-
last_usage: now,
|
|
109
|
-
error_message: null,
|
|
110
|
-
});
|
|
111
|
-
return sessionId;
|
|
112
|
-
} finally {
|
|
113
|
-
store.close();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export class MemoryAppendTool {
|
|
118
|
-
constructor(
|
|
119
|
-
private readonly memoryMdPath: string,
|
|
120
|
-
private readonly stage1?: Stage1AppendOptions,
|
|
121
|
-
) {}
|
|
122
|
-
|
|
123
|
-
info() {
|
|
124
|
-
return {
|
|
125
|
-
name: MEMORY_APPEND_NAME,
|
|
126
|
-
description: MEMORY_APPEND_DESCRIPTION,
|
|
127
|
-
parameters: MEMORY_APPEND_PARAMETERS,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async run(argsJson: string): Promise<ToolResult> {
|
|
132
|
-
let raw: Record<string, unknown>;
|
|
133
|
-
try {
|
|
134
|
-
raw = JSON.parse(argsJson) as Record<string, unknown>;
|
|
135
|
-
} catch (e) {
|
|
136
|
-
return {
|
|
137
|
-
content: `invalid arguments: ${e instanceof Error ? e.message : e}`,
|
|
138
|
-
isError: true,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const content = typeof raw.content === "string" ? raw.content : "";
|
|
142
|
-
if (!content.trim()) {
|
|
143
|
-
return { content: "content must not be empty", isError: true };
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
if (this.stage1) {
|
|
147
|
-
const id = await appendToStage1(content, this.stage1);
|
|
148
|
-
return { content: `queued memory for consolidation: ${id}` };
|
|
149
|
-
}
|
|
150
|
-
await appendToMemoryMd(this.memoryMdPath, content);
|
|
151
|
-
return { content: `appended to ${this.memoryMdPath}` };
|
|
152
|
-
} catch (e) {
|
|
153
|
-
return {
|
|
154
|
-
content: `error appending: ${e instanceof Error ? e.message : e}`,
|
|
155
|
-
isError: true,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function createMemoryAppendTool(
|
|
162
|
-
memoryMdPath: string,
|
|
163
|
-
stage1?: Stage1AppendOptions,
|
|
164
|
-
): MemoryAppendTool {
|
|
165
|
-
return new MemoryAppendTool(memoryMdPath, stage1);
|
|
166
|
-
}
|
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import { createFallbackQuery } from "../fallback/index.js";
|
|
2
|
-
import { rerankWithLLM, type RerankOptions, type RankedResult } from "../fallback/llmRerank.js";
|
|
3
|
-
import type { SessionSearchHit } from "../fallback/sessionSearch.js";
|
|
4
|
-
import type { FallbackQuery, MemoryQuerier, MemoryRecallArgs, QueryIntent, QueryMode, ResponseEnvelope, ToolResult } from "../types.js";
|
|
5
|
-
|
|
6
|
-
export const MEMORY_RECALL_NAME = "memory_recall";
|
|
7
|
-
|
|
8
|
-
export const MEMORY_RECALL_DESCRIPTION =
|
|
9
|
-
"Read structured episodic memory from the local TLM sidecar — past sessions consolidated into long-term records.\n" +
|
|
10
|
-
"Modes:\n" +
|
|
11
|
-
"- direct_relation: one-hop predicate (e.g. \"what did X create?\"). Read groups[].via_relations.\n" +
|
|
12
|
-
"- path_query: multi-hop / possessive. relation_constraints is the ordered path; inverse hops use ^-1.\n" +
|
|
13
|
-
"- typed_neighborhood: typed target with exactly one relation. Requires candidate_type.\n\n" +
|
|
14
|
-
"Ground answers in supporting evidence internally; tell the user \"past records\" / \"以前的记录\", not raw event IDs.";
|
|
15
|
-
|
|
16
|
-
export const MEMORY_RECALL_PROMPT_SNIPPET =
|
|
17
|
-
"Query local episodic memory by entity or relationship";
|
|
18
|
-
|
|
19
|
-
export const MEMORY_RECALL_PROMPT_GUIDELINES = [
|
|
20
|
-
"Use memory_recall when the user asks about past sessions, people, projects, or decisions stored in long-term memory.",
|
|
21
|
-
"Use memory_recall for relationship questions (e.g. who is X to me) when implicit preflight did not already answer.",
|
|
22
|
-
] as const;
|
|
23
|
-
|
|
24
|
-
export const MEMORY_RECALL_PARAMETERS = {
|
|
25
|
-
type: "object",
|
|
26
|
-
properties: {
|
|
27
|
-
mode: {
|
|
28
|
-
type: "string",
|
|
29
|
-
enum: ["direct_relation", "path_query", "typed_neighborhood"],
|
|
30
|
-
},
|
|
31
|
-
anchor_mentions: { type: "array", items: { type: "string" } },
|
|
32
|
-
relation_constraints: { type: "array", items: { type: "string" } },
|
|
33
|
-
candidate_type: { type: "string" },
|
|
34
|
-
scope_filter: { type: "array", items: { type: "string" } },
|
|
35
|
-
target_slot: { type: "string", enum: ["head", "tail"] },
|
|
36
|
-
time_window: { type: "string" },
|
|
37
|
-
evidence_budget: { type: "integer" },
|
|
38
|
-
result_limit: { type: "integer" },
|
|
39
|
-
},
|
|
40
|
-
required: ["anchor_mentions"],
|
|
41
|
-
} as const;
|
|
42
|
-
|
|
43
|
-
export class MemoryRecallTool {
|
|
44
|
-
constructor(
|
|
45
|
-
private readonly service: MemoryQuerier,
|
|
46
|
-
private readonly fallback: FallbackQuery | null = null,
|
|
47
|
-
private readonly rerankOpts: RerankOptions | null = null,
|
|
48
|
-
) {}
|
|
49
|
-
|
|
50
|
-
info() {
|
|
51
|
-
return {
|
|
52
|
-
name: MEMORY_RECALL_NAME,
|
|
53
|
-
description: MEMORY_RECALL_DESCRIPTION,
|
|
54
|
-
parameters: MEMORY_RECALL_PARAMETERS,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async run(argsJson: string, signal?: AbortSignal, onProgress?: (msg: string) => void): Promise<ToolResult> {
|
|
59
|
-
const args = parseArgs(argsJson);
|
|
60
|
-
if ("error" in args) {
|
|
61
|
-
return { content: args.error, isError: true };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const intent = argsToIntent(args);
|
|
65
|
-
const validation = validateArgs(args);
|
|
66
|
-
if (validation) {
|
|
67
|
-
return { content: validation, isError: true };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return this.runIntent(intent, signal, onProgress);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async runIntent(intent: QueryIntent, signal?: AbortSignal, onProgress?: (msg: string) => void): Promise<ToolResult> {
|
|
74
|
-
if (this.service.status() !== "ready") {
|
|
75
|
-
return this.fallbackResult(intent, "service_unavailable", "fallback");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Emit a progress message if the sidecar takes longer than 500 ms.
|
|
79
|
-
let progressTimer: ReturnType<typeof setTimeout> | null = null;
|
|
80
|
-
if (onProgress) {
|
|
81
|
-
progressTimer = setTimeout(() => {
|
|
82
|
-
onProgress("Querying episodic memory…");
|
|
83
|
-
}, 500);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let result;
|
|
87
|
-
try {
|
|
88
|
-
result = await this.service.query(intent, signal);
|
|
89
|
-
} finally {
|
|
90
|
-
if (progressTimer != null) clearTimeout(progressTimer);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (result.transportError || result.errorClass === "unavailable") {
|
|
94
|
-
return this.fallbackResult(intent, "service_unavailable", "fallback");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (result.errorClass === "retryable") {
|
|
98
|
-
let retryTimer: ReturnType<typeof setTimeout> | null = null;
|
|
99
|
-
if (onProgress) {
|
|
100
|
-
retryTimer = setTimeout(() => onProgress("Retrying memory query…"), 500);
|
|
101
|
-
}
|
|
102
|
-
let retryResult;
|
|
103
|
-
try {
|
|
104
|
-
await sleep(500, signal);
|
|
105
|
-
retryResult = await this.service.query(intent, signal);
|
|
106
|
-
} finally {
|
|
107
|
-
if (retryTimer != null) clearTimeout(retryTimer);
|
|
108
|
-
}
|
|
109
|
-
if (
|
|
110
|
-
retryResult.transportError ||
|
|
111
|
-
retryResult.errorClass === "unavailable" ||
|
|
112
|
-
retryResult.errorClass === "retryable"
|
|
113
|
-
) {
|
|
114
|
-
return this.fallbackResult(intent, "retryable_failed", "fallback_after_retry");
|
|
115
|
-
}
|
|
116
|
-
result = retryResult;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (result.errorClass === "permanent") {
|
|
120
|
-
return permanentResult(result.env);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return shapeResult(result.env!);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private async fallbackResult(
|
|
127
|
-
intent: QueryIntent,
|
|
128
|
-
reason: string,
|
|
129
|
-
source: string,
|
|
130
|
-
): Promise<ToolResult> {
|
|
131
|
-
const candidates: Record<string, unknown>[] = [];
|
|
132
|
-
const warnings: Record<string, unknown>[] = [];
|
|
133
|
-
|
|
134
|
-
if (this.fallback) {
|
|
135
|
-
const query = intent.anchor_mentions.map((s) => s.trim()).filter(Boolean).join(" ");
|
|
136
|
-
const limit = intent.result_limit && intent.result_limit > 0 ? intent.result_limit : 10;
|
|
137
|
-
try {
|
|
138
|
-
const hits = await this.fallback.sessionKeyword(query, limit);
|
|
139
|
-
|
|
140
|
-
let reranked: RankedResult[] | null = null;
|
|
141
|
-
if (this.rerankOpts && hits.length > 0) {
|
|
142
|
-
try {
|
|
143
|
-
reranked = await rerankWithLLM(
|
|
144
|
-
query,
|
|
145
|
-
hits as SessionSearchHit[],
|
|
146
|
-
this.rerankOpts,
|
|
147
|
-
);
|
|
148
|
-
} catch {
|
|
149
|
-
/* silent fallback to original order */
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (reranked) {
|
|
154
|
-
for (const r of reranked) {
|
|
155
|
-
const original = hits[r.index];
|
|
156
|
-
candidates.push({
|
|
157
|
-
value: r.summary,
|
|
158
|
-
score: r.score,
|
|
159
|
-
evidence: "llm_rerank",
|
|
160
|
-
...(typeof original === "object" && original !== null &&
|
|
161
|
-
"session_id" in (original as Record<string, unknown>)
|
|
162
|
-
? { scope: "session_search", session_id: (original as Record<string, unknown>).session_id }
|
|
163
|
-
: {}),
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
for (const h of hits) {
|
|
168
|
-
candidates.push({
|
|
169
|
-
value: typeof h === "string" ? h : JSON.stringify(h),
|
|
170
|
-
evidence: "text_search",
|
|
171
|
-
...(typeof h === "object" &&
|
|
172
|
-
h !== null &&
|
|
173
|
-
"session_id" in (h as Record<string, unknown>)
|
|
174
|
-
? { scope: "session_search" }
|
|
175
|
-
: {}),
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
} catch (err) {
|
|
180
|
-
warnings.push({
|
|
181
|
-
code: "fallback_session_search_failed",
|
|
182
|
-
message: err instanceof Error ? err.message : String(err),
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
try {
|
|
186
|
-
const snippet = await this.fallback.memoryFileSnippet(query);
|
|
187
|
-
if (snippet) {
|
|
188
|
-
candidates.push({
|
|
189
|
-
value: snippet,
|
|
190
|
-
evidence: "text_search",
|
|
191
|
-
scope: "memory_md",
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
} catch {
|
|
195
|
-
/* optional */
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const out = {
|
|
200
|
-
source,
|
|
201
|
-
evidence_quality: "text_search",
|
|
202
|
-
bundle_version: null,
|
|
203
|
-
candidates,
|
|
204
|
-
warnings,
|
|
205
|
-
fallback_reason: reason,
|
|
206
|
-
};
|
|
207
|
-
return { content: JSON.stringify(out) };
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function parseArgs(argsJson: string): MemoryRecallArgs | { error: string } {
|
|
212
|
-
let raw: Record<string, unknown>;
|
|
213
|
-
try {
|
|
214
|
-
raw = JSON.parse(coerceArgs(argsJson)) as Record<string, unknown>;
|
|
215
|
-
} catch (e) {
|
|
216
|
-
return { error: `invalid input: ${e instanceof Error ? e.message : e}` };
|
|
217
|
-
}
|
|
218
|
-
const anchor = raw.anchor_mentions;
|
|
219
|
-
if (!Array.isArray(anchor) || anchor.length === 0) {
|
|
220
|
-
return { error: "anchor_mentions is required and must be non-empty" };
|
|
221
|
-
}
|
|
222
|
-
return raw as unknown as MemoryRecallArgs;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function argsToIntent(a: MemoryRecallArgs): QueryIntent {
|
|
226
|
-
return {
|
|
227
|
-
mode: (a.mode as QueryMode) || "direct_relation",
|
|
228
|
-
anchor_mentions: a.anchor_mentions,
|
|
229
|
-
relation_constraints: a.relation_constraints,
|
|
230
|
-
candidate_type: a.candidate_type,
|
|
231
|
-
scope_filter: a.scope_filter,
|
|
232
|
-
target_slot: (a.target_slot as QueryIntent["target_slot"]) ?? "",
|
|
233
|
-
time_window: a.time_window,
|
|
234
|
-
evidence_budget: a.evidence_budget && a.evidence_budget > 0 ? a.evidence_budget : 5,
|
|
235
|
-
result_limit: a.result_limit && a.result_limit > 0 ? a.result_limit : 10,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function validateArgs(a: MemoryRecallArgs): string | null {
|
|
240
|
-
for (const rel of a.relation_constraints ?? []) {
|
|
241
|
-
if (isBroadRelation(rel)) {
|
|
242
|
-
return "memory_recall requires concrete relation_constraints. Broad relations like related_to are not valid for structured lookup.";
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (a.mode === "typed_neighborhood") {
|
|
246
|
-
if (!a.candidate_type?.trim()) {
|
|
247
|
-
return "typed_neighborhood requires candidate_type.";
|
|
248
|
-
}
|
|
249
|
-
if ((a.relation_constraints?.length ?? 0) !== 1) {
|
|
250
|
-
return "typed_neighborhood requires exactly one relation_constraints value.";
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function isBroadRelation(rel: string): boolean {
|
|
257
|
-
let r = rel.trim().toLowerCase();
|
|
258
|
-
r = r.replace(/^\^/, "").replace(/\^-1$/, "");
|
|
259
|
-
return ["related_to", "relates_to", "associated_with", "about", "mentions", "other"].includes(r);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function coerceArgs(argsJson: string): string {
|
|
263
|
-
let raw: Record<string, unknown>;
|
|
264
|
-
try {
|
|
265
|
-
raw = JSON.parse(argsJson) as Record<string, unknown>;
|
|
266
|
-
} catch {
|
|
267
|
-
return argsJson;
|
|
268
|
-
}
|
|
269
|
-
let changed = false;
|
|
270
|
-
for (const field of ["anchor_mentions", "relation_constraints", "scope_filter"]) {
|
|
271
|
-
const v = raw[field];
|
|
272
|
-
if (typeof v === "string") {
|
|
273
|
-
try {
|
|
274
|
-
raw[field] = JSON.parse(v);
|
|
275
|
-
changed = true;
|
|
276
|
-
} catch {
|
|
277
|
-
/* keep */
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
for (const field of ["result_limit", "evidence_budget"]) {
|
|
282
|
-
const v = raw[field];
|
|
283
|
-
if (typeof v === "string") {
|
|
284
|
-
const n = Number(v);
|
|
285
|
-
if (!Number.isNaN(n)) {
|
|
286
|
-
raw[field] = n;
|
|
287
|
-
changed = true;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
return changed ? JSON.stringify(raw) : argsJson;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function shapeResult(env: ResponseEnvelope): ToolResult {
|
|
295
|
-
let quality = "structured";
|
|
296
|
-
const warnings = envelopeWarnings(env);
|
|
297
|
-
if (env.reason === "degraded") {
|
|
298
|
-
quality = "structured_degraded";
|
|
299
|
-
warnings.unshift({
|
|
300
|
-
code: "bundle_degraded",
|
|
301
|
-
message: "memory bundle degraded — results may be incomplete",
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
const cands = env.candidates.map((c) => {
|
|
305
|
-
const m: Record<string, unknown> = {
|
|
306
|
-
value: c.value,
|
|
307
|
-
score: c.score,
|
|
308
|
-
evidence: c.evidence,
|
|
309
|
-
supporting_event_ids: c.supporting_event_ids,
|
|
310
|
-
};
|
|
311
|
-
if (c.scope != null) m.scope = c.scope;
|
|
312
|
-
if (c.support_count != null) m.support_count = c.support_count;
|
|
313
|
-
if (c.distinct_session_count != null) {
|
|
314
|
-
m.distinct_session_count = c.distinct_session_count;
|
|
315
|
-
}
|
|
316
|
-
return m;
|
|
317
|
-
});
|
|
318
|
-
const out = {
|
|
319
|
-
source: "memory_sidecar",
|
|
320
|
-
evidence_quality: quality,
|
|
321
|
-
bundle_version: env.bundle_version ?? null,
|
|
322
|
-
memory_block: env.memory_block ?? null,
|
|
323
|
-
candidates: cands,
|
|
324
|
-
warnings,
|
|
325
|
-
fallback_reason: null,
|
|
326
|
-
};
|
|
327
|
-
return { content: JSON.stringify(out) };
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function permanentResult(env: ResponseEnvelope | null): ToolResult {
|
|
331
|
-
const out = {
|
|
332
|
-
source: "memory_sidecar",
|
|
333
|
-
evidence_quality: "structured",
|
|
334
|
-
bundle_version: env?.bundle_version ?? null,
|
|
335
|
-
candidates: [],
|
|
336
|
-
warnings: envelopeWarnings(env),
|
|
337
|
-
fallback_reason: null,
|
|
338
|
-
};
|
|
339
|
-
return { content: JSON.stringify(out), isError: true };
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function envelopeWarnings(env: ResponseEnvelope | null): Record<string, unknown>[] {
|
|
343
|
-
const out: Record<string, unknown>[] = [];
|
|
344
|
-
if (!env) return out;
|
|
345
|
-
for (const w of env.warnings ?? []) {
|
|
346
|
-
out.push({ code: w.code, message: w.message });
|
|
347
|
-
}
|
|
348
|
-
if (env.error) {
|
|
349
|
-
out.push({
|
|
350
|
-
code: env.error.code,
|
|
351
|
-
message: env.error.message,
|
|
352
|
-
sub_code: env.error.details?.sub_code,
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return out;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function sleep(ms: number, signal?: AbortSignal): Promise<void> {
|
|
359
|
-
return new Promise((resolve, reject) => {
|
|
360
|
-
if (signal?.aborted) {
|
|
361
|
-
reject(new Error("aborted"));
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
const t = setTimeout(resolve, ms);
|
|
365
|
-
signal?.addEventListener("abort", () => {
|
|
366
|
-
clearTimeout(t);
|
|
367
|
-
reject(new Error("aborted"));
|
|
368
|
-
}, { once: true });
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/** @deprecated Use createFallbackQuery — kept for backward-compatible imports. */
|
|
373
|
-
export function createStubFallback(
|
|
374
|
-
memoryMdPaths: string[],
|
|
375
|
-
sessionsDir = "",
|
|
376
|
-
): FallbackQuery {
|
|
377
|
-
return createFallbackQuery({ sessionsDir, memoryMdPaths });
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
export { createFallbackQuery };
|
|
381
|
-
|
|
382
|
-
export function createMemoryRecallTool(
|
|
383
|
-
service: MemoryQuerier,
|
|
384
|
-
fallback: FallbackQuery | null,
|
|
385
|
-
rerankOpts?: RerankOptions | null,
|
|
386
|
-
): MemoryRecallTool {
|
|
387
|
-
return new MemoryRecallTool(service, fallback, rerankOpts ?? null);
|
|
388
|
-
}
|