@astragenie/astramemory-local 0.7.2
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/CHANGELOG.md +341 -0
- package/README.md +419 -0
- package/dist/backup/retention.d.ts +15 -0
- package/dist/backup/retention.js +62 -0
- package/dist/backup/retention.js.map +1 -0
- package/dist/backup/snapshot.d.ts +21 -0
- package/dist/backup/snapshot.js +55 -0
- package/dist/backup/snapshot.js.map +1 -0
- package/dist/backup/verify.d.ts +23 -0
- package/dist/backup/verify.js +77 -0
- package/dist/backup/verify.js.map +1 -0
- package/dist/budget/tracker.d.ts +58 -0
- package/dist/budget/tracker.js +102 -0
- package/dist/budget/tracker.js.map +1 -0
- package/dist/capture/codex.d.ts +63 -0
- package/dist/capture/codex.js +0 -0
- package/dist/capture/codex.js.map +1 -0
- package/dist/cli/backup.d.ts +1 -0
- package/dist/cli/backup.js +112 -0
- package/dist/cli/backup.js.map +1 -0
- package/dist/cli/budget.d.ts +7 -0
- package/dist/cli/budget.js +44 -0
- package/dist/cli/budget.js.map +1 -0
- package/dist/cli/capture.d.ts +10 -0
- package/dist/cli/capture.js +113 -0
- package/dist/cli/capture.js.map +1 -0
- package/dist/cli/consolidate.d.ts +16 -0
- package/dist/cli/consolidate.js +146 -0
- package/dist/cli/consolidate.js.map +1 -0
- package/dist/cli/doctor.d.ts +1 -0
- package/dist/cli/doctor.js +54 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/entity-backfill.d.ts +10 -0
- package/dist/cli/entity-backfill.js +46 -0
- package/dist/cli/entity-backfill.js.map +1 -0
- package/dist/cli/hook-install.d.ts +45 -0
- package/dist/cli/hook-install.js +77 -0
- package/dist/cli/hook-install.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +312 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +16 -0
- package/dist/cli/init.js +431 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/mcp-stdio.d.ts +18 -0
- package/dist/cli/mcp-stdio.js +67 -0
- package/dist/cli/mcp-stdio.js.map +1 -0
- package/dist/cli/memory.d.ts +15 -0
- package/dist/cli/memory.js +52 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/open-runtime-db.d.ts +15 -0
- package/dist/cli/open-runtime-db.js +37 -0
- package/dist/cli/open-runtime-db.js.map +1 -0
- package/dist/cli/pair.d.ts +29 -0
- package/dist/cli/pair.js +64 -0
- package/dist/cli/pair.js.map +1 -0
- package/dist/cli/providers.d.ts +10 -0
- package/dist/cli/providers.js +97 -0
- package/dist/cli/providers.js.map +1 -0
- package/dist/cli/queue-purge.d.ts +5 -0
- package/dist/cli/queue-purge.js +92 -0
- package/dist/cli/queue-purge.js.map +1 -0
- package/dist/cli/queue.d.ts +29 -0
- package/dist/cli/queue.js +73 -0
- package/dist/cli/queue.js.map +1 -0
- package/dist/cli/rebuild.d.ts +15 -0
- package/dist/cli/rebuild.js +70 -0
- package/dist/cli/rebuild.js.map +1 -0
- package/dist/cli/reembed-dim.d.ts +21 -0
- package/dist/cli/reembed-dim.js +199 -0
- package/dist/cli/reembed-dim.js.map +1 -0
- package/dist/cli/reinstall.d.ts +1 -0
- package/dist/cli/reinstall.js +205 -0
- package/dist/cli/reinstall.js.map +1 -0
- package/dist/cli/restore.d.ts +1 -0
- package/dist/cli/restore.js +167 -0
- package/dist/cli/restore.js.map +1 -0
- package/dist/cli/retag.d.ts +14 -0
- package/dist/cli/retag.js +62 -0
- package/dist/cli/retag.js.map +1 -0
- package/dist/cli/search.d.ts +66 -0
- package/dist/cli/search.js +174 -0
- package/dist/cli/search.js.map +1 -0
- package/dist/cli/serve.d.ts +9 -0
- package/dist/cli/serve.js +364 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/service.d.ts +1 -0
- package/dist/cli/service.js +121 -0
- package/dist/cli/service.js.map +1 -0
- package/dist/cli/sync.d.ts +15 -0
- package/dist/cli/sync.js +61 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/token.d.ts +24 -0
- package/dist/cli/token.js +77 -0
- package/dist/cli/token.js.map +1 -0
- package/dist/cli/wait-health.d.ts +4 -0
- package/dist/cli/wait-health.js +23 -0
- package/dist/cli/wait-health.js.map +1 -0
- package/dist/config/config.d.ts +127 -0
- package/dist/config/config.js +38 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/datadir.d.ts +30 -0
- package/dist/config/datadir.js +65 -0
- package/dist/config/datadir.js.map +1 -0
- package/dist/config/loader.d.ts +23 -0
- package/dist/config/loader.js +102 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/migrate-dirs.d.ts +36 -0
- package/dist/config/migrate-dirs.js +132 -0
- package/dist/config/migrate-dirs.js.map +1 -0
- package/dist/config/persist-envs.d.ts +23 -0
- package/dist/config/persist-envs.js +119 -0
- package/dist/config/persist-envs.js.map +1 -0
- package/dist/config/resolve-runtime.d.ts +19 -0
- package/dist/config/resolve-runtime.js +53 -0
- package/dist/config/resolve-runtime.js.map +1 -0
- package/dist/config/secrets.d.ts +28 -0
- package/dist/config/secrets.js +38 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/config/sync-settings.d.ts +16 -0
- package/dist/config/sync-settings.js +34 -0
- package/dist/config/sync-settings.js.map +1 -0
- package/dist/config/writer.d.ts +19 -0
- package/dist/config/writer.js +121 -0
- package/dist/config/writer.js.map +1 -0
- package/dist/consolidate/consolidate.d.ts +80 -0
- package/dist/consolidate/consolidate.js +0 -0
- package/dist/consolidate/consolidate.js.map +1 -0
- package/dist/consolidate/proposals.d.ts +35 -0
- package/dist/consolidate/proposals.js +66 -0
- package/dist/consolidate/proposals.js.map +1 -0
- package/dist/contracts/atom-wire.d.ts +48 -0
- package/dist/contracts/atom-wire.js +55 -0
- package/dist/contracts/atom-wire.js.map +1 -0
- package/dist/contracts/embed.d.ts +41 -0
- package/dist/contracts/embed.js +20 -0
- package/dist/contracts/embed.js.map +1 -0
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/job.d.ts +113 -0
- package/dist/contracts/job.js +32 -0
- package/dist/contracts/job.js.map +1 -0
- package/dist/contracts/llm.d.ts +30 -0
- package/dist/contracts/llm.js +2 -0
- package/dist/contracts/llm.js.map +1 -0
- package/dist/contracts/memory.d.ts +47 -0
- package/dist/contracts/memory.js +5 -0
- package/dist/contracts/memory.js.map +1 -0
- package/dist/contracts/vector.d.ts +29 -0
- package/dist/contracts/vector.js +2 -0
- package/dist/contracts/vector.js.map +1 -0
- package/dist/distill/flatten-turns.d.ts +1 -0
- package/dist/distill/flatten-turns.js +50 -0
- package/dist/distill/flatten-turns.js.map +1 -0
- package/dist/distill/pipeline.d.ts +45 -0
- package/dist/distill/pipeline.js +113 -0
- package/dist/distill/pipeline.js.map +1 -0
- package/dist/distill/prompts/extract.d.ts +122 -0
- package/dist/distill/prompts/extract.js +67 -0
- package/dist/distill/prompts/extract.js.map +1 -0
- package/dist/distill/stages/01-cleanup.d.ts +9 -0
- package/dist/distill/stages/01-cleanup.js +67 -0
- package/dist/distill/stages/01-cleanup.js.map +1 -0
- package/dist/distill/stages/02-normalize.d.ts +9 -0
- package/dist/distill/stages/02-normalize.js +76 -0
- package/dist/distill/stages/02-normalize.js.map +1 -0
- package/dist/distill/stages/03-chunk.d.ts +22 -0
- package/dist/distill/stages/03-chunk.js +138 -0
- package/dist/distill/stages/03-chunk.js.map +1 -0
- package/dist/distill/stages/04-compact.d.ts +28 -0
- package/dist/distill/stages/04-compact.js +69 -0
- package/dist/distill/stages/04-compact.js.map +1 -0
- package/dist/distill/stages/05-extract.d.ts +35 -0
- package/dist/distill/stages/05-extract.js +101 -0
- package/dist/distill/stages/05-extract.js.map +1 -0
- package/dist/distill/stages/06-reduce.d.ts +16 -0
- package/dist/distill/stages/06-reduce.js +30 -0
- package/dist/distill/stages/06-reduce.js.map +1 -0
- package/dist/distill/stages/07-memory-normalize.d.ts +27 -0
- package/dist/distill/stages/07-memory-normalize.js +65 -0
- package/dist/distill/stages/07-memory-normalize.js.map +1 -0
- package/dist/distill/stages/08-embed-index.d.ts +31 -0
- package/dist/distill/stages/08-embed-index.js +82 -0
- package/dist/distill/stages/08-embed-index.js.map +1 -0
- package/dist/doctor/checks.d.ts +77 -0
- package/dist/doctor/checks.js +626 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/hardening-checks.d.ts +9 -0
- package/dist/doctor/hardening-checks.js +182 -0
- package/dist/doctor/hardening-checks.js.map +1 -0
- package/dist/doctor/probes/embed-probe.d.ts +19 -0
- package/dist/doctor/probes/embed-probe.js +47 -0
- package/dist/doctor/probes/embed-probe.js.map +1 -0
- package/dist/doctor/probes/llm-chat-probe.d.ts +11 -0
- package/dist/doctor/probes/llm-chat-probe.js +41 -0
- package/dist/doctor/probes/llm-chat-probe.js.map +1 -0
- package/dist/doctor/probes/plugin-coexistence.d.ts +14 -0
- package/dist/doctor/probes/plugin-coexistence.js +60 -0
- package/dist/doctor/probes/plugin-coexistence.js.map +1 -0
- package/dist/doctor/runner.d.ts +17 -0
- package/dist/doctor/runner.js +53 -0
- package/dist/doctor/runner.js.map +1 -0
- package/dist/doctor/types.d.ts +12 -0
- package/dist/doctor/types.js +2 -0
- package/dist/doctor/types.js.map +1 -0
- package/dist/entity/backfill.d.ts +30 -0
- package/dist/entity/backfill.js +55 -0
- package/dist/entity/backfill.js.map +1 -0
- package/dist/entity/extract-entities.d.ts +27 -0
- package/dist/entity/extract-entities.js +86 -0
- package/dist/entity/extract-entities.js.map +1 -0
- package/dist/entity/normalize.d.ts +17 -0
- package/dist/entity/normalize.js +20 -0
- package/dist/entity/normalize.js.map +1 -0
- package/dist/eval/harness.d.ts +96 -0
- package/dist/eval/harness.js +119 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/eval/metrics.d.ts +23 -0
- package/dist/eval/metrics.js +44 -0
- package/dist/eval/metrics.js.map +1 -0
- package/dist/log/correlation.d.ts +24 -0
- package/dist/log/correlation.js +33 -0
- package/dist/log/correlation.js.map +1 -0
- package/dist/log/logger.d.ts +38 -0
- package/dist/log/logger.js +129 -0
- package/dist/log/logger.js.map +1 -0
- package/dist/log/scrub.d.ts +33 -0
- package/dist/log/scrub.js +91 -0
- package/dist/log/scrub.js.map +1 -0
- package/dist/mcp/server.d.ts +36 -0
- package/dist/mcp/server.js +553 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/memory-tool/adapter.d.ts +73 -0
- package/dist/memory-tool/adapter.js +269 -0
- package/dist/memory-tool/adapter.js.map +1 -0
- package/dist/pipeline/errors.d.ts +21 -0
- package/dist/pipeline/errors.js +34 -0
- package/dist/pipeline/errors.js.map +1 -0
- package/dist/pipeline/failure-classifier.d.ts +13 -0
- package/dist/pipeline/failure-classifier.js +72 -0
- package/dist/pipeline/failure-classifier.js.map +1 -0
- package/dist/pipeline/handler-ctx-ext.d.ts +23 -0
- package/dist/pipeline/handler-ctx-ext.js +19 -0
- package/dist/pipeline/handler-ctx-ext.js.map +1 -0
- package/dist/pipeline/handler.d.ts +20 -0
- package/dist/pipeline/handler.js +2 -0
- package/dist/pipeline/handler.js.map +1 -0
- package/dist/pipeline/handlers/cleanup.d.ts +14 -0
- package/dist/pipeline/handlers/cleanup.js +47 -0
- package/dist/pipeline/handlers/cleanup.js.map +1 -0
- package/dist/pipeline/handlers/consolidate.d.ts +8 -0
- package/dist/pipeline/handlers/consolidate.js +23 -0
- package/dist/pipeline/handlers/consolidate.js.map +1 -0
- package/dist/pipeline/handlers/distill-events.d.ts +15 -0
- package/dist/pipeline/handlers/distill-events.js +134 -0
- package/dist/pipeline/handlers/distill-events.js.map +1 -0
- package/dist/pipeline/handlers/distill.d.ts +17 -0
- package/dist/pipeline/handlers/distill.js +110 -0
- package/dist/pipeline/handlers/distill.js.map +1 -0
- package/dist/pipeline/handlers/reembed.d.ts +10 -0
- package/dist/pipeline/handlers/reembed.js +34 -0
- package/dist/pipeline/handlers/reembed.js.map +1 -0
- package/dist/pipeline/job-repo.d.ts +86 -0
- package/dist/pipeline/job-repo.js +168 -0
- package/dist/pipeline/job-repo.js.map +1 -0
- package/dist/pipeline/mock-providers.d.ts +49 -0
- package/dist/pipeline/mock-providers.js +175 -0
- package/dist/pipeline/mock-providers.js.map +1 -0
- package/dist/pipeline/registry.d.ts +15 -0
- package/dist/pipeline/registry.js +20 -0
- package/dist/pipeline/registry.js.map +1 -0
- package/dist/pipeline/worker.d.ts +41 -0
- package/dist/pipeline/worker.js +167 -0
- package/dist/pipeline/worker.js.map +1 -0
- package/dist/providers/embed/azure-openai.d.ts +25 -0
- package/dist/providers/embed/azure-openai.js +138 -0
- package/dist/providers/embed/azure-openai.js.map +1 -0
- package/dist/providers/embed/ollama.d.ts +17 -0
- package/dist/providers/embed/ollama.js +106 -0
- package/dist/providers/embed/ollama.js.map +1 -0
- package/dist/providers/index.d.ts +19 -0
- package/dist/providers/index.js +72 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/llm/azure-openai.d.ts +20 -0
- package/dist/providers/llm/azure-openai.js +135 -0
- package/dist/providers/llm/azure-openai.js.map +1 -0
- package/dist/providers/llm/ollama.d.ts +13 -0
- package/dist/providers/llm/ollama.js +113 -0
- package/dist/providers/llm/ollama.js.map +1 -0
- package/dist/providers/llm/pricing.d.ts +21 -0
- package/dist/providers/llm/pricing.js +22 -0
- package/dist/providers/llm/pricing.js.map +1 -0
- package/dist/recall/pack.d.ts +32 -0
- package/dist/recall/pack.js +90 -0
- package/dist/recall/pack.js.map +1 -0
- package/dist/recall/policy.d.ts +39 -0
- package/dist/recall/policy.js +96 -0
- package/dist/recall/policy.js.map +1 -0
- package/dist/redact/detectors.d.ts +20 -0
- package/dist/redact/detectors.js +85 -0
- package/dist/redact/detectors.js.map +1 -0
- package/dist/redact/entropy.d.ts +24 -0
- package/dist/redact/entropy.js +77 -0
- package/dist/redact/entropy.js.map +1 -0
- package/dist/redact/index.d.ts +47 -0
- package/dist/redact/index.js +165 -0
- package/dist/redact/index.js.map +1 -0
- package/dist/search/fuse.d.ts +108 -0
- package/dist/search/fuse.js +135 -0
- package/dist/search/fuse.js.map +1 -0
- package/dist/search/query.d.ts +28 -0
- package/dist/search/query.js +70 -0
- package/dist/search/query.js.map +1 -0
- package/dist/search/search.d.ts +164 -0
- package/dist/search/search.js +310 -0
- package/dist/search/search.js.map +1 -0
- package/dist/server/app.d.ts +17 -0
- package/dist/server/app.js +133 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/health-state.d.ts +29 -0
- package/dist/server/health-state.js +28 -0
- package/dist/server/health-state.js.map +1 -0
- package/dist/server/lib/network.d.ts +12 -0
- package/dist/server/lib/network.js +16 -0
- package/dist/server/lib/network.js.map +1 -0
- package/dist/server/lib/score-contract.d.ts +36 -0
- package/dist/server/lib/score-contract.js +54 -0
- package/dist/server/lib/score-contract.js.map +1 -0
- package/dist/server/lib/stable-stringify.d.ts +10 -0
- package/dist/server/lib/stable-stringify.js +27 -0
- package/dist/server/lib/stable-stringify.js.map +1 -0
- package/dist/server/lib/wire-meta.d.ts +7 -0
- package/dist/server/lib/wire-meta.js +29 -0
- package/dist/server/lib/wire-meta.js.map +1 -0
- package/dist/server/queries/dashboard.d.ts +142 -0
- package/dist/server/queries/dashboard.js +166 -0
- package/dist/server/queries/dashboard.js.map +1 -0
- package/dist/server/routes/consolidation.d.ts +14 -0
- package/dist/server/routes/consolidation.js +67 -0
- package/dist/server/routes/consolidation.js.map +1 -0
- package/dist/server/routes/dashboard-api-html.d.ts +15 -0
- package/dist/server/routes/dashboard-api-html.js +144 -0
- package/dist/server/routes/dashboard-api-html.js.map +1 -0
- package/dist/server/routes/dashboard-consolidation-html.d.ts +26 -0
- package/dist/server/routes/dashboard-consolidation-html.js +202 -0
- package/dist/server/routes/dashboard-consolidation-html.js.map +1 -0
- package/dist/server/routes/dashboard-html.d.ts +15 -0
- package/dist/server/routes/dashboard-html.js +365 -0
- package/dist/server/routes/dashboard-html.js.map +1 -0
- package/dist/server/routes/dashboard-jobs-html.d.ts +18 -0
- package/dist/server/routes/dashboard-jobs-html.js +186 -0
- package/dist/server/routes/dashboard-jobs-html.js.map +1 -0
- package/dist/server/routes/dashboard-search-html.d.ts +18 -0
- package/dist/server/routes/dashboard-search-html.js +189 -0
- package/dist/server/routes/dashboard-search-html.js.map +1 -0
- package/dist/server/routes/dashboard.d.ts +19 -0
- package/dist/server/routes/dashboard.js +68 -0
- package/dist/server/routes/dashboard.js.map +1 -0
- package/dist/server/routes/digest.d.ts +9 -0
- package/dist/server/routes/digest.js +37 -0
- package/dist/server/routes/digest.js.map +1 -0
- package/dist/server/routes/entities.d.ts +12 -0
- package/dist/server/routes/entities.js +46 -0
- package/dist/server/routes/entities.js.map +1 -0
- package/dist/server/routes/health.d.ts +14 -0
- package/dist/server/routes/health.js +100 -0
- package/dist/server/routes/health.js.map +1 -0
- package/dist/server/routes/ingest.d.ts +209 -0
- package/dist/server/routes/ingest.js +454 -0
- package/dist/server/routes/ingest.js.map +1 -0
- package/dist/server/routes/lifecycle.d.ts +21 -0
- package/dist/server/routes/lifecycle.js +132 -0
- package/dist/server/routes/lifecycle.js.map +1 -0
- package/dist/server/routes/mcp.d.ts +15 -0
- package/dist/server/routes/mcp.js +36 -0
- package/dist/server/routes/mcp.js.map +1 -0
- package/dist/server/routes/memory-tool.d.ts +14 -0
- package/dist/server/routes/memory-tool.js +28 -0
- package/dist/server/routes/memory-tool.js.map +1 -0
- package/dist/server/routes/memory.d.ts +7 -0
- package/dist/server/routes/memory.js +19 -0
- package/dist/server/routes/memory.js.map +1 -0
- package/dist/server/routes/recall.d.ts +15 -0
- package/dist/server/routes/recall.js +74 -0
- package/dist/server/routes/recall.js.map +1 -0
- package/dist/server/routes/search.d.ts +12 -0
- package/dist/server/routes/search.js +203 -0
- package/dist/server/routes/search.js.map +1 -0
- package/dist/server/routes/version.d.ts +2 -0
- package/dist/server/routes/version.js +11 -0
- package/dist/server/routes/version.js.map +1 -0
- package/dist/server/routes/why.d.ts +9 -0
- package/dist/server/routes/why.js +38 -0
- package/dist/server/routes/why.js.map +1 -0
- package/dist/service/index.d.ts +10 -0
- package/dist/service/index.js +25 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/install-flow.d.ts +18 -0
- package/dist/service/install-flow.js +47 -0
- package/dist/service/install-flow.js.map +1 -0
- package/dist/service/instance-lock.d.ts +26 -0
- package/dist/service/instance-lock.js +150 -0
- package/dist/service/instance-lock.js.map +1 -0
- package/dist/service/launchd.d.ts +11 -0
- package/dist/service/launchd.js +196 -0
- package/dist/service/launchd.js.map +1 -0
- package/dist/service/schtasks.d.ts +31 -0
- package/dist/service/schtasks.js +274 -0
- package/dist/service/schtasks.js.map +1 -0
- package/dist/service/shim.d.ts +21 -0
- package/dist/service/shim.js +80 -0
- package/dist/service/shim.js.map +1 -0
- package/dist/service/systemd.d.ts +11 -0
- package/dist/service/systemd.js +150 -0
- package/dist/service/systemd.js.map +1 -0
- package/dist/service/task-xml.d.ts +36 -0
- package/dist/service/task-xml.js +91 -0
- package/dist/service/task-xml.js.map +1 -0
- package/dist/service/types.d.ts +47 -0
- package/dist/service/types.js +2 -0
- package/dist/service/types.js.map +1 -0
- package/dist/storage/archival.d.ts +29 -0
- package/dist/storage/archival.js +47 -0
- package/dist/storage/archival.js.map +1 -0
- package/dist/storage/bearer-keystore.d.ts +34 -0
- package/dist/storage/bearer-keystore.js +75 -0
- package/dist/storage/bearer-keystore.js.map +1 -0
- package/dist/storage/db.d.ts +37 -0
- package/dist/storage/db.js +92 -0
- package/dist/storage/db.js.map +1 -0
- package/dist/storage/entities.d.ts +71 -0
- package/dist/storage/entities.js +141 -0
- package/dist/storage/entities.js.map +1 -0
- package/dist/storage/ingest-idempotency.d.ts +26 -0
- package/dist/storage/ingest-idempotency.js +29 -0
- package/dist/storage/ingest-idempotency.js.map +1 -0
- package/dist/storage/keystore.d.ts +64 -0
- package/dist/storage/keystore.js +194 -0
- package/dist/storage/keystore.js.map +1 -0
- package/dist/storage/memories.d.ts +51 -0
- package/dist/storage/memories.js +67 -0
- package/dist/storage/memories.js.map +1 -0
- package/dist/storage/memory-events.d.ts +145 -0
- package/dist/storage/memory-events.js +287 -0
- package/dist/storage/memory-events.js.map +1 -0
- package/dist/storage/migrate-encrypt.d.ts +16 -0
- package/dist/storage/migrate-encrypt.js +121 -0
- package/dist/storage/migrate-encrypt.js.map +1 -0
- package/dist/storage/migrate.d.ts +27 -0
- package/dist/storage/migrate.js +105 -0
- package/dist/storage/migrate.js.map +1 -0
- package/dist/storage/redaction-log.d.ts +18 -0
- package/dist/storage/redaction-log.js +27 -0
- package/dist/storage/redaction-log.js.map +1 -0
- package/dist/storage/usefulness.d.ts +115 -0
- package/dist/storage/usefulness.js +203 -0
- package/dist/storage/usefulness.js.map +1 -0
- package/dist/sync/conflict-resolve.d.ts +26 -0
- package/dist/sync/conflict-resolve.js +139 -0
- package/dist/sync/conflict-resolve.js.map +1 -0
- package/dist/sync/puller.d.ts +115 -0
- package/dist/sync/puller.js +173 -0
- package/dist/sync/puller.js.map +1 -0
- package/dist/sync/shipper.d.ts +112 -0
- package/dist/sync/shipper.js +189 -0
- package/dist/sync/shipper.js.map +1 -0
- package/dist/tag-hygiene/backfill.d.ts +50 -0
- package/dist/tag-hygiene/backfill.js +117 -0
- package/dist/tag-hygiene/backfill.js.map +1 -0
- package/dist/tag-hygiene/derive-repo.d.ts +9 -0
- package/dist/tag-hygiene/derive-repo.js +19 -0
- package/dist/tag-hygiene/derive-repo.js.map +1 -0
- package/dist/tag-hygiene/tier2-infer.d.ts +28 -0
- package/dist/tag-hygiene/tier2-infer.js +72 -0
- package/dist/tag-hygiene/tier2-infer.js.map +1 -0
- package/dist/vector/sqlite-vec.d.ts +16 -0
- package/dist/vector/sqlite-vec.js +49 -0
- package/dist/vector/sqlite-vec.js.map +1 -0
- package/migrations/001-init.sql +117 -0
- package/migrations/002-wire-v1.sql +16 -0
- package/migrations/003-expand-memory-types.sql +81 -0
- package/migrations/004-provenance.sql +4 -0
- package/migrations/005-security.sql +12 -0
- package/migrations/006-atom-v3.sql +28 -0
- package/migrations/007-memory-events.sql +30 -0
- package/migrations/008-consolidation.sql +31 -0
- package/migrations/009-tag-hygiene.sql +13 -0
- package/migrations/010-sync-pull.sql +53 -0
- package/migrations/011-embed-dim-migration.sql +28 -0
- package/migrations/012-entities.sql +36 -0
- package/migrations/013-archival.sql +50 -0
- package/package.json +50 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* health-state.ts — mutable per-daemon health snapshot (D3).
|
|
3
|
+
*
|
|
4
|
+
* Written by the boot sequence, the background embed prober, and the job
|
|
5
|
+
* worker; read by the /health route. Enables degraded-start: the daemon
|
|
6
|
+
* binds its port immediately and reports 'starting' → 'ok' | 'degraded'
|
|
7
|
+
* instead of dying when Ollama is slow to load a model at logon.
|
|
8
|
+
*/
|
|
9
|
+
export type DaemonStatus = 'starting' | 'ok' | 'degraded';
|
|
10
|
+
export interface EmbedHealth {
|
|
11
|
+
/** null = not probed yet (starting); true/false = last probe outcome. */
|
|
12
|
+
ok: boolean | null;
|
|
13
|
+
lastOkAt: number | null;
|
|
14
|
+
lastError: string | null;
|
|
15
|
+
attempts: number;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkerHealth {
|
|
18
|
+
lastTickAt: number | null;
|
|
19
|
+
}
|
|
20
|
+
export interface HealthState {
|
|
21
|
+
readonly startedAt: number;
|
|
22
|
+
embed: EmbedHealth;
|
|
23
|
+
worker: WorkerHealth;
|
|
24
|
+
/** Resolved data directory — lets /health report disk_free_bytes. */
|
|
25
|
+
dataDir?: string;
|
|
26
|
+
status(): DaemonStatus;
|
|
27
|
+
uptimeSeconds(): number;
|
|
28
|
+
}
|
|
29
|
+
export declare function createHealthState(now?: () => number): HealthState;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* health-state.ts — mutable per-daemon health snapshot (D3).
|
|
3
|
+
*
|
|
4
|
+
* Written by the boot sequence, the background embed prober, and the job
|
|
5
|
+
* worker; read by the /health route. Enables degraded-start: the daemon
|
|
6
|
+
* binds its port immediately and reports 'starting' → 'ok' | 'degraded'
|
|
7
|
+
* instead of dying when Ollama is slow to load a model at logon.
|
|
8
|
+
*/
|
|
9
|
+
export function createHealthState(now = Date.now) {
|
|
10
|
+
const startedAt = now();
|
|
11
|
+
const state = {
|
|
12
|
+
startedAt,
|
|
13
|
+
embed: { ok: null, lastOkAt: null, lastError: null, attempts: 0 },
|
|
14
|
+
worker: { lastTickAt: null },
|
|
15
|
+
status() {
|
|
16
|
+
if (state.embed.ok === true)
|
|
17
|
+
return 'ok';
|
|
18
|
+
if (state.embed.ok === null)
|
|
19
|
+
return 'starting';
|
|
20
|
+
return 'degraded';
|
|
21
|
+
},
|
|
22
|
+
uptimeSeconds() {
|
|
23
|
+
return Math.floor((now() - startedAt) / 1000);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return state;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=health-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-state.js","sourceRoot":"","sources":["../../src/server/health-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH,MAAM,UAAU,iBAAiB,CAAC,MAAoB,IAAI,CAAC,GAAG;IAC5D,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC;IACxB,MAAM,KAAK,GAAgB;QACzB,SAAS;QACT,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE;QACjE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;QAC5B,MAAM;YACJ,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YACzC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI;gBAAE,OAAO,UAAU,CAAC;YAC/C,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,aAAa;YACX,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* isLoopbackHost — the single predicate that decides both (a) whether the
|
|
3
|
+
* HTTP server binds beyond the local machine and (b) whether /health and
|
|
4
|
+
* /version stay public (FEAT-406).
|
|
5
|
+
*
|
|
6
|
+
* Deriving the auth boundary from the same value that controls the bind
|
|
7
|
+
* (rather than a second independent "require auth" flag) closes the gap the
|
|
8
|
+
* PM pre-mortem flagged: a config typo or partial rollout can no longer
|
|
9
|
+
* leave the daemon bound non-locally while /health/version stay
|
|
10
|
+
* unauthenticated — there is only one knob, not two that can disagree.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* isLoopbackHost — the single predicate that decides both (a) whether the
|
|
3
|
+
* HTTP server binds beyond the local machine and (b) whether /health and
|
|
4
|
+
* /version stay public (FEAT-406).
|
|
5
|
+
*
|
|
6
|
+
* Deriving the auth boundary from the same value that controls the bind
|
|
7
|
+
* (rather than a second independent "require auth" flag) closes the gap the
|
|
8
|
+
* PM pre-mortem flagged: a config typo or partial rollout can no longer
|
|
9
|
+
* leave the daemon bound non-locally while /health/version stay
|
|
10
|
+
* unauthenticated — there is only one knob, not two that can disagree.
|
|
11
|
+
*/
|
|
12
|
+
export function isLoopbackHost(host) {
|
|
13
|
+
const h = host.trim().toLowerCase();
|
|
14
|
+
return h === '127.0.0.1' || h === 'localhost' || h === '::1';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/server/lib/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,KAAK,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response-side [0,1] score wire contract enforcement (FEAT-413/SLICE-411).
|
|
3
|
+
*
|
|
4
|
+
* fuseScores() (src/search/fuse.ts) is the only *intended* score producer
|
|
5
|
+
* today, but nothing stops a future second fusion strategy, a manual score
|
|
6
|
+
* override, or a stale cache read from constructing a hit whose score sits
|
|
7
|
+
* outside [0,1] (or is NaN/Infinity). This module enforces the contract at
|
|
8
|
+
* the JSON serialization boundary — independent of fuseScores() internal
|
|
9
|
+
* math — so an out-of-contract score is clamped and logged server-side
|
|
10
|
+
* instead of shipping invalid wire data that only the plugin's client-side
|
|
11
|
+
* Zod schema rejects (the cedc8a9 failure mode: plugin exit 3, daemon
|
|
12
|
+
* oblivious).
|
|
13
|
+
*/
|
|
14
|
+
export interface ScoreContractContext {
|
|
15
|
+
/** Route the score is being serialized for, e.g. 'GET /search'. */
|
|
16
|
+
route: string;
|
|
17
|
+
/** Id of the hit/memory the score belongs to. */
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Clamp a single score into [0,1]. Non-finite values map to a safe bound
|
|
22
|
+
* (NaN -> 0, +Infinity -> 1, -Infinity -> 0). Logs a structured warning with
|
|
23
|
+
* route + id context whenever the input was out of contract; in-contract
|
|
24
|
+
* values pass through unchanged with no log emitted (no noise on the happy
|
|
25
|
+
* path).
|
|
26
|
+
*/
|
|
27
|
+
export declare function clampScore(value: number, ctx: ScoreContractContext): number;
|
|
28
|
+
/**
|
|
29
|
+
* Clamp scores across a list of hits/memories at a response serialization
|
|
30
|
+
* site. Returns the same item (same reference) when its score is already
|
|
31
|
+
* in-contract, so an untouched happy-path array is bit-identical.
|
|
32
|
+
*/
|
|
33
|
+
export declare function clampScores<T extends {
|
|
34
|
+
id: string;
|
|
35
|
+
score: number;
|
|
36
|
+
}>(items: T[], route: string): T[];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response-side [0,1] score wire contract enforcement (FEAT-413/SLICE-411).
|
|
3
|
+
*
|
|
4
|
+
* fuseScores() (src/search/fuse.ts) is the only *intended* score producer
|
|
5
|
+
* today, but nothing stops a future second fusion strategy, a manual score
|
|
6
|
+
* override, or a stale cache read from constructing a hit whose score sits
|
|
7
|
+
* outside [0,1] (or is NaN/Infinity). This module enforces the contract at
|
|
8
|
+
* the JSON serialization boundary — independent of fuseScores() internal
|
|
9
|
+
* math — so an out-of-contract score is clamped and logged server-side
|
|
10
|
+
* instead of shipping invalid wire data that only the plugin's client-side
|
|
11
|
+
* Zod schema rejects (the cedc8a9 failure mode: plugin exit 3, daemon
|
|
12
|
+
* oblivious).
|
|
13
|
+
*/
|
|
14
|
+
import { childLogger } from '../../log/logger.js';
|
|
15
|
+
const log = childLogger({ component: 'score-contract' });
|
|
16
|
+
/**
|
|
17
|
+
* Clamp a single score into [0,1]. Non-finite values map to a safe bound
|
|
18
|
+
* (NaN -> 0, +Infinity -> 1, -Infinity -> 0). Logs a structured warning with
|
|
19
|
+
* route + id context whenever the input was out of contract; in-contract
|
|
20
|
+
* values pass through unchanged with no log emitted (no noise on the happy
|
|
21
|
+
* path).
|
|
22
|
+
*/
|
|
23
|
+
export function clampScore(value, ctx) {
|
|
24
|
+
if (Number.isNaN(value)) {
|
|
25
|
+
log.warn({ route: ctx.route, id: ctx.id, value: 'NaN' }, 'score-contract: non-finite score clamped to 0');
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
if (!Number.isFinite(value)) {
|
|
29
|
+
const clamped = value > 0 ? 1 : 0;
|
|
30
|
+
log.warn({ route: ctx.route, id: ctx.id, value: value > 0 ? 'Infinity' : '-Infinity' }, 'score-contract: non-finite score clamped');
|
|
31
|
+
return clamped;
|
|
32
|
+
}
|
|
33
|
+
if (value < 0) {
|
|
34
|
+
log.warn({ route: ctx.route, id: ctx.id, value }, 'score-contract: score below 0 clamped to 0');
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
if (value > 1) {
|
|
38
|
+
log.warn({ route: ctx.route, id: ctx.id, value }, 'score-contract: score above 1 clamped to 1');
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Clamp scores across a list of hits/memories at a response serialization
|
|
45
|
+
* site. Returns the same item (same reference) when its score is already
|
|
46
|
+
* in-contract, so an untouched happy-path array is bit-identical.
|
|
47
|
+
*/
|
|
48
|
+
export function clampScores(items, route) {
|
|
49
|
+
return items.map(item => {
|
|
50
|
+
const clamped = clampScore(item.score, { route, id: item.id });
|
|
51
|
+
return clamped === item.score ? item : { ...item, score: clamped };
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=score-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score-contract.js","sourceRoot":"","sources":["../../../src/server/lib/score-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;AASzD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,GAAyB;IACjE,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GA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AE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/D,OAAO,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON stringification with sorted object keys.
|
|
3
|
+
* INPUT CONTRACT: caller must pass Zod-validated plain-JSON values only.
|
|
4
|
+
* Supported: null, boolean, number (finite), string, array (order preserved), plain object.
|
|
5
|
+
* UNSUPPORTED (throws or produces lossy output): Date, BigInt, Symbol, undefined,
|
|
6
|
+
* cyclic references, class instances. Feeding any of these is a programming error.
|
|
7
|
+
*
|
|
8
|
+
* Used by ingest route to hash request bodies for idempotency replay.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stableStringify(value: unknown): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON stringification with sorted object keys.
|
|
3
|
+
* INPUT CONTRACT: caller must pass Zod-validated plain-JSON values only.
|
|
4
|
+
* Supported: null, boolean, number (finite), string, array (order preserved), plain object.
|
|
5
|
+
* UNSUPPORTED (throws or produces lossy output): Date, BigInt, Symbol, undefined,
|
|
6
|
+
* cyclic references, class instances. Feeding any of these is a programming error.
|
|
7
|
+
*
|
|
8
|
+
* Used by ingest route to hash request bodies for idempotency replay.
|
|
9
|
+
*/
|
|
10
|
+
export function stableStringify(value) {
|
|
11
|
+
if (value === null || typeof value !== 'object') {
|
|
12
|
+
return JSON.stringify(value) ?? 'null';
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return '[' + value.map(stableStringify).join(',') + ']';
|
|
16
|
+
}
|
|
17
|
+
// Object — sort keys and recurse
|
|
18
|
+
const sorted = Object.keys(value)
|
|
19
|
+
.sort()
|
|
20
|
+
.map(k => {
|
|
21
|
+
const serialisedKey = JSON.stringify(k);
|
|
22
|
+
const serialisedVal = stableStringify(value[k]);
|
|
23
|
+
return `${serialisedKey}:${serialisedVal}`;
|
|
24
|
+
});
|
|
25
|
+
return '{' + sorted.join(',') + '}';
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=stable-stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stable-stringify.js","sourceRoot":"","sources":["../../../src/server/lib/stable-stringify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC1D,CAAC;IAED,iCAAiC;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC;SACzD,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC,EAAE;QACP,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,eAAe,CAAE,KAAiC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,OAAO,GAAG,aAAa,IAAI,aAAa,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for wire protocol metadata and package version.
|
|
3
|
+
* Both health.ts and version.ts import from here; no literal duplicates.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PKG_VERSION: string;
|
|
6
|
+
export declare const WIRE_VERSIONS_SUPPORTED: readonly ["v0.0", "v1.0"];
|
|
7
|
+
export declare const SCHEMA_VERSION: 13;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for wire protocol metadata and package version.
|
|
3
|
+
* Both health.ts and version.ts import from here; no literal duplicates.
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { join, dirname } from 'node:path';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Package version — read once at module load, Zod-validated cast
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
const _dir = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const _pkgPath = join(_dir, '..', '..', '..', 'package.json');
|
|
14
|
+
const _PkgSchema = z.object({ version: z.string() });
|
|
15
|
+
export const PKG_VERSION = _PkgSchema.parse(JSON.parse(readFileSync(_pkgPath, 'utf-8'))).version;
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Wire versions — single authoritative list
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
export const WIRE_VERSIONS_SUPPORTED = ['v0.0', 'v1.0'];
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema version — single authoritative literal
|
|
22
|
+
// migrate() asserts that MAX(version) FROM schema_version equals this constant
|
|
23
|
+
// at startup. Bump this whenever a new migration file is added.
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Migrations 001-013 (009 = tag hygiene FEAT-403; 010 = sync-pull event_id FEAT-407;
|
|
26
|
+
// 011 = embed-dim FEAT-409; 012 = entities/memory_entities FEAT-402 slice 1;
|
|
27
|
+
// 013 = memory TTL/archival tiers FEAT-404).
|
|
28
|
+
export const SCHEMA_VERSION = 13;
|
|
29
|
+
//# sourceMappingURL=wire-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-meta.js","sourceRoot":"","sources":["../../../src/server/lib/wire-meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,iEAAiE;AACjE,8EAA8E;AAE9E,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAE9D,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,WAAW,GAAW,UAAU,CAAC,KAAK,CACjD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAC5C,CAAC,OAAO,CAAC;AAEV,8EAA8E;AAC9E,4CAA4C;AAC5C,8EAA8E;AAE9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAsC,CAAC;AAE7F,8EAA8E;AAC9E,gDAAgD;AAChD,+EAA+E;AAC/E,gEAAgE;AAChE,8EAA8E;AAE9E,qFAAqF;AACrF,6EAA6E;AAC7E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,EAAW,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only queries powering the /dashboard HTML endpoint.
|
|
3
|
+
* Extracted here so tests can exercise them independently of the route layer.
|
|
4
|
+
*/
|
|
5
|
+
import type { DB } from '../../storage/db.js';
|
|
6
|
+
import { type UsefulnessRate } from '../../storage/usefulness.js';
|
|
7
|
+
import type { HealthState } from '../health-state.js';
|
|
8
|
+
export interface MemoryCountByType {
|
|
9
|
+
type: string;
|
|
10
|
+
count: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RecentMemory {
|
|
13
|
+
id: string;
|
|
14
|
+
type: string;
|
|
15
|
+
text: string;
|
|
16
|
+
importance: number;
|
|
17
|
+
confidence: number;
|
|
18
|
+
session_id: string | null;
|
|
19
|
+
created_at: number;
|
|
20
|
+
}
|
|
21
|
+
export interface JobStateCount {
|
|
22
|
+
state: string;
|
|
23
|
+
count: number;
|
|
24
|
+
}
|
|
25
|
+
/** FEAT-410: job counts grouped by (kind, state) — distinguishes e.g.
|
|
26
|
+
* distill:poison=2 from reembed:poison=1, which the state-only
|
|
27
|
+
* `queryJobStates` cannot. */
|
|
28
|
+
export interface JobStateByKind {
|
|
29
|
+
kind: string;
|
|
30
|
+
state: string;
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
/** FEAT-410: pending consolidation-proposal count + oldest created_at. */
|
|
34
|
+
export interface ConsolidationSummary {
|
|
35
|
+
count: number;
|
|
36
|
+
oldest: number | null;
|
|
37
|
+
}
|
|
38
|
+
/** FEAT-410: a failed/poison job row with its error text, for the
|
|
39
|
+
* "what failed and why" surface. */
|
|
40
|
+
export interface RecentFailedJob {
|
|
41
|
+
id: string;
|
|
42
|
+
kind: string;
|
|
43
|
+
state: string;
|
|
44
|
+
last_error: string | null;
|
|
45
|
+
updated_at: number;
|
|
46
|
+
}
|
|
47
|
+
/** FEAT-410: entity-linking pipeline-stage visibility. */
|
|
48
|
+
export interface EntityLinkage {
|
|
49
|
+
entityCount: number;
|
|
50
|
+
unlinkedMemoryCount: number;
|
|
51
|
+
}
|
|
52
|
+
/** FEAT-410: subsystem health rolled up from the boot-time HealthState —
|
|
53
|
+
* reuses the same instance /health reads instead of recomputing anything. */
|
|
54
|
+
export interface DashboardHealth {
|
|
55
|
+
status: ReturnType<HealthState['status']>;
|
|
56
|
+
uptimeSeconds: number;
|
|
57
|
+
embed: {
|
|
58
|
+
ok: boolean | null;
|
|
59
|
+
lastOkAt: number | null;
|
|
60
|
+
lastError: string | null;
|
|
61
|
+
attempts: number;
|
|
62
|
+
};
|
|
63
|
+
worker: {
|
|
64
|
+
alive: boolean;
|
|
65
|
+
lastTickAt: number | null;
|
|
66
|
+
lastTickAgoMs: number | null;
|
|
67
|
+
};
|
|
68
|
+
diskFreeBytes: number | null;
|
|
69
|
+
}
|
|
70
|
+
export interface HourlyThroughput {
|
|
71
|
+
hour: string;
|
|
72
|
+
count: number;
|
|
73
|
+
}
|
|
74
|
+
export interface ProviderRow {
|
|
75
|
+
provider: string;
|
|
76
|
+
model: string;
|
|
77
|
+
dim: number | null;
|
|
78
|
+
last_health_ok: number;
|
|
79
|
+
last_check_at: number | null;
|
|
80
|
+
}
|
|
81
|
+
export interface BudgetSpendRow {
|
|
82
|
+
day: string;
|
|
83
|
+
usd_total: number;
|
|
84
|
+
calls: number;
|
|
85
|
+
}
|
|
86
|
+
export interface DashboardData {
|
|
87
|
+
memoryCounts: MemoryCountByType[];
|
|
88
|
+
recentMemories: RecentMemory[];
|
|
89
|
+
jobStates: JobStateCount[];
|
|
90
|
+
jobStatesByKind: JobStateByKind[];
|
|
91
|
+
hourlyThroughput: HourlyThroughput[];
|
|
92
|
+
providers: ProviderRow[];
|
|
93
|
+
todaySpend: BudgetSpendRow | null;
|
|
94
|
+
mtdSpend: number;
|
|
95
|
+
mtdCalls: number;
|
|
96
|
+
usefulness: UsefulnessRate;
|
|
97
|
+
consolidation: ConsolidationSummary;
|
|
98
|
+
recentFailedJobs: RecentFailedJob[];
|
|
99
|
+
entityLinkage: EntityLinkage;
|
|
100
|
+
/** null when no HealthState was wired in (e.g. bare test apps) — callers
|
|
101
|
+
* degrade the same way /health does when this field is absent. */
|
|
102
|
+
health: DashboardHealth | null;
|
|
103
|
+
}
|
|
104
|
+
export declare function queryMemoryCounts(db: DB): MemoryCountByType[];
|
|
105
|
+
export declare function queryRecentMemories(db: DB): RecentMemory[];
|
|
106
|
+
export declare function queryJobStates(db: DB): JobStateCount[];
|
|
107
|
+
/** FEAT-410 AC-1: job counts grouped by kind AND state. */
|
|
108
|
+
export declare function queryJobStatesByKind(db: DB): JobStateByKind[];
|
|
109
|
+
/** FEAT-410 AC-3/AC-4: pending proposal count + oldest created_at (via the
|
|
110
|
+
* existing ProposalRepo — no new table scan). Never throws on an empty
|
|
111
|
+
* queue; ProposalRepo.list('pending') already orders by created_at ASC so
|
|
112
|
+
* the first row is the oldest. */
|
|
113
|
+
export declare function queryConsolidationSummary(db: DB): ConsolidationSummary;
|
|
114
|
+
/** FEAT-410 AC-5: most recent failed/poison jobs with their error text,
|
|
115
|
+
* newest-updated first. */
|
|
116
|
+
export declare function queryRecentFailedJobs(db: DB, limit?: number): RecentFailedJob[];
|
|
117
|
+
/** FEAT-410: entity count + unlinked-memory count (currently-valid,
|
|
118
|
+
* not-archived memories with no memory_entities row) for the entity-link
|
|
119
|
+
* pipeline stage. Same "currently valid" predicate used by archival.ts. */
|
|
120
|
+
export declare function queryEntityLinkage(db: DB): EntityLinkage;
|
|
121
|
+
/** FEAT-410: merge the boot-time HealthState (built for /health) into
|
|
122
|
+
* DashboardData instead of recomputing subsystem health from scratch. */
|
|
123
|
+
export declare function buildDashboardHealth(healthState: HealthState): DashboardHealth;
|
|
124
|
+
export declare function queryHourlyThroughput(db: DB): HourlyThroughput[];
|
|
125
|
+
export declare function queryProviders(db: DB): ProviderRow[];
|
|
126
|
+
export declare function queryBudget(db: DB): {
|
|
127
|
+
today: BudgetSpendRow | null;
|
|
128
|
+
mtdUsd: number;
|
|
129
|
+
mtdCalls: number;
|
|
130
|
+
};
|
|
131
|
+
/** ADR-010 recall-usefulness rate, last 7 days. Per-type breakdown is
|
|
132
|
+
* intentionally not part of the dashboard primary path (FEAT-410 design:
|
|
133
|
+
* real product-quality signal, but not an operational glance-screen
|
|
134
|
+
* signal) — see storage/usefulness.ts's usefulnessByType for that data. */
|
|
135
|
+
export declare function queryUsefulness(db: DB): UsefulnessRate;
|
|
136
|
+
/**
|
|
137
|
+
* Run all dashboard queries in a single pass. `healthState` is the same
|
|
138
|
+
* instance built at boot for GET /health (FEAT-410) — when omitted (bare
|
|
139
|
+
* test apps), `health` is null and callers degrade the same way /health
|
|
140
|
+
* does without it.
|
|
141
|
+
*/
|
|
142
|
+
export declare function queryDashboard(db: DB, healthState?: HealthState): Promise<DashboardData>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only queries powering the /dashboard HTML endpoint.
|
|
3
|
+
* Extracted here so tests can exercise them independently of the route layer.
|
|
4
|
+
*/
|
|
5
|
+
import { statfsSync } from 'node:fs';
|
|
6
|
+
import { usefulnessRate } from '../../storage/usefulness.js';
|
|
7
|
+
import { ProposalRepo } from '../../consolidate/proposals.js';
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Query implementations
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export function queryMemoryCounts(db) {
|
|
12
|
+
return db.prepare('SELECT type, COUNT(*) as count FROM memories GROUP BY type ORDER BY 2 DESC').all();
|
|
13
|
+
}
|
|
14
|
+
export function queryRecentMemories(db) {
|
|
15
|
+
return db.prepare(`
|
|
16
|
+
SELECT id, type, text, importance, confidence, session_id, created_at
|
|
17
|
+
FROM memories
|
|
18
|
+
ORDER BY created_at DESC
|
|
19
|
+
LIMIT 25
|
|
20
|
+
`).all();
|
|
21
|
+
}
|
|
22
|
+
export function queryJobStates(db) {
|
|
23
|
+
return db.prepare('SELECT state, COUNT(*) as count FROM jobs GROUP BY state').all();
|
|
24
|
+
}
|
|
25
|
+
/** FEAT-410 AC-1: job counts grouped by kind AND state. */
|
|
26
|
+
export function queryJobStatesByKind(db) {
|
|
27
|
+
return db.prepare('SELECT kind, state, COUNT(*) as count FROM jobs GROUP BY kind, state').all();
|
|
28
|
+
}
|
|
29
|
+
/** FEAT-410 AC-3/AC-4: pending proposal count + oldest created_at (via the
|
|
30
|
+
* existing ProposalRepo — no new table scan). Never throws on an empty
|
|
31
|
+
* queue; ProposalRepo.list('pending') already orders by created_at ASC so
|
|
32
|
+
* the first row is the oldest. */
|
|
33
|
+
export function queryConsolidationSummary(db) {
|
|
34
|
+
const pending = new ProposalRepo(db).list('pending');
|
|
35
|
+
if (pending.length === 0)
|
|
36
|
+
return { count: 0, oldest: null };
|
|
37
|
+
return { count: pending.length, oldest: pending[0].created_at };
|
|
38
|
+
}
|
|
39
|
+
/** FEAT-410 AC-5: most recent failed/poison jobs with their error text,
|
|
40
|
+
* newest-updated first. */
|
|
41
|
+
export function queryRecentFailedJobs(db, limit = 10) {
|
|
42
|
+
return db.prepare(`
|
|
43
|
+
SELECT id, kind, state, last_error, updated_at
|
|
44
|
+
FROM jobs
|
|
45
|
+
WHERE state IN ('failed', 'poison')
|
|
46
|
+
ORDER BY updated_at DESC
|
|
47
|
+
LIMIT ?
|
|
48
|
+
`).all(limit);
|
|
49
|
+
}
|
|
50
|
+
/** FEAT-410: entity count + unlinked-memory count (currently-valid,
|
|
51
|
+
* not-archived memories with no memory_entities row) for the entity-link
|
|
52
|
+
* pipeline stage. Same "currently valid" predicate used by archival.ts. */
|
|
53
|
+
export function queryEntityLinkage(db) {
|
|
54
|
+
const entityCount = db.prepare('SELECT COUNT(*) as n FROM entities').get().n;
|
|
55
|
+
const unlinkedMemoryCount = db.prepare(`
|
|
56
|
+
SELECT COUNT(*) as n
|
|
57
|
+
FROM memories m
|
|
58
|
+
WHERE valid_to IS NULL AND archived = 0
|
|
59
|
+
AND NOT EXISTS (SELECT 1 FROM memory_entities me WHERE me.memory_id = m.id)
|
|
60
|
+
`).get().n;
|
|
61
|
+
return { entityCount, unlinkedMemoryCount };
|
|
62
|
+
}
|
|
63
|
+
/** Generous liveness window: the worker stamps lastTickAt at tick START, so
|
|
64
|
+
* a single long-running job (LLM distill can take up to the 60s chat
|
|
65
|
+
* timeout) must not read as "worker dead". Mirrors health.ts's own
|
|
66
|
+
* WORKER_ALIVE_WINDOW_MS — duplicated locally by design (same precedent as
|
|
67
|
+
* the stub pages' local auth check) to avoid a routes/health.ts <->
|
|
68
|
+
* queries/dashboard.ts import cycle. */
|
|
69
|
+
const WORKER_ALIVE_WINDOW_MS = 90_000;
|
|
70
|
+
function diskFreeBytes(dataDir) {
|
|
71
|
+
try {
|
|
72
|
+
const s = statfsSync(dataDir);
|
|
73
|
+
return s.bavail * s.bsize;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** FEAT-410: merge the boot-time HealthState (built for /health) into
|
|
80
|
+
* DashboardData instead of recomputing subsystem health from scratch. */
|
|
81
|
+
export function buildDashboardHealth(healthState) {
|
|
82
|
+
const lastTick = healthState.worker.lastTickAt;
|
|
83
|
+
return {
|
|
84
|
+
status: healthState.status(),
|
|
85
|
+
uptimeSeconds: healthState.uptimeSeconds(),
|
|
86
|
+
embed: { ...healthState.embed },
|
|
87
|
+
worker: {
|
|
88
|
+
alive: lastTick !== null && Date.now() - lastTick < WORKER_ALIVE_WINDOW_MS,
|
|
89
|
+
lastTickAt: lastTick,
|
|
90
|
+
lastTickAgoMs: lastTick === null ? null : Date.now() - lastTick,
|
|
91
|
+
},
|
|
92
|
+
diskFreeBytes: healthState.dataDir ? diskFreeBytes(healthState.dataDir) : null,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function queryHourlyThroughput(db) {
|
|
96
|
+
const since24hMs = Date.now() - 24 * 60 * 60 * 1000;
|
|
97
|
+
return db.prepare(`
|
|
98
|
+
SELECT
|
|
99
|
+
strftime('%Y-%m-%d %H', datetime(created_at / 1000, 'unixepoch')) AS hour,
|
|
100
|
+
COUNT(*) AS count
|
|
101
|
+
FROM memories
|
|
102
|
+
WHERE created_at > ?
|
|
103
|
+
GROUP BY hour
|
|
104
|
+
ORDER BY hour
|
|
105
|
+
`).all(since24hMs);
|
|
106
|
+
}
|
|
107
|
+
export function queryProviders(db) {
|
|
108
|
+
return db.prepare('SELECT provider, model, dim, last_health_ok, last_check_at FROM provider_state').all();
|
|
109
|
+
}
|
|
110
|
+
export function queryBudget(db) {
|
|
111
|
+
const todayKey = new Date().toISOString().slice(0, 10); // YYYY-MM-DD
|
|
112
|
+
const monthPrefix = todayKey.slice(0, 7); // YYYY-MM
|
|
113
|
+
const today = db.prepare('SELECT day, usd_total, calls FROM budget_spend WHERE day = ?').get(todayKey) ?? null;
|
|
114
|
+
const mtd = db.prepare("SELECT COALESCE(SUM(usd_total), 0) AS usd_total, COALESCE(SUM(calls), 0) AS calls FROM budget_spend WHERE day LIKE ? || '%'").get(monthPrefix);
|
|
115
|
+
return {
|
|
116
|
+
today,
|
|
117
|
+
mtdUsd: mtd?.usd_total ?? 0,
|
|
118
|
+
mtdCalls: mtd?.calls ?? 0,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;
|
|
122
|
+
/** ADR-010 recall-usefulness rate, last 7 days. Per-type breakdown is
|
|
123
|
+
* intentionally not part of the dashboard primary path (FEAT-410 design:
|
|
124
|
+
* real product-quality signal, but not an operational glance-screen
|
|
125
|
+
* signal) — see storage/usefulness.ts's usefulnessByType for that data. */
|
|
126
|
+
export function queryUsefulness(db) {
|
|
127
|
+
const since = Date.now() - SEVEN_DAYS_MS;
|
|
128
|
+
return usefulnessRate(db, { sinceMs: since });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Run all dashboard queries in a single pass. `healthState` is the same
|
|
132
|
+
* instance built at boot for GET /health (FEAT-410) — when omitted (bare
|
|
133
|
+
* test apps), `health` is null and callers degrade the same way /health
|
|
134
|
+
* does without it.
|
|
135
|
+
*/
|
|
136
|
+
export async function queryDashboard(db, healthState) {
|
|
137
|
+
const memoryCounts = queryMemoryCounts(db);
|
|
138
|
+
const recentMemories = queryRecentMemories(db);
|
|
139
|
+
const jobStates = queryJobStates(db);
|
|
140
|
+
const jobStatesByKind = queryJobStatesByKind(db);
|
|
141
|
+
const hourlyThroughput = queryHourlyThroughput(db);
|
|
142
|
+
const providers = queryProviders(db);
|
|
143
|
+
const budget = queryBudget(db);
|
|
144
|
+
const usefulness = queryUsefulness(db);
|
|
145
|
+
const consolidation = queryConsolidationSummary(db);
|
|
146
|
+
const recentFailedJobs = queryRecentFailedJobs(db);
|
|
147
|
+
const entityLinkage = queryEntityLinkage(db);
|
|
148
|
+
const health = healthState ? buildDashboardHealth(healthState) : null;
|
|
149
|
+
return {
|
|
150
|
+
memoryCounts,
|
|
151
|
+
recentMemories,
|
|
152
|
+
jobStates,
|
|
153
|
+
jobStatesByKind,
|
|
154
|
+
hourlyThroughput,
|
|
155
|
+
providers,
|
|
156
|
+
todaySpend: budget.today,
|
|
157
|
+
mtdSpend: budget.mtdUsd,
|
|
158
|
+
mtdCalls: budget.mtdCalls,
|
|
159
|
+
usefulness,
|
|
160
|
+
consolidation,
|
|
161
|
+
recentFailedJobs,
|
|
162
|
+
entityLinkage,
|
|
163
|
+
health,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../../src/server/queries/dashboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,cAAc,EAAuB,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,gC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solidateSummary
|
|
4
|
+
* GET /consolidation/proposals?status= -> { proposals: [...] }
|
|
5
|
+
* POST /consolidation/proposals/:id/accept -> 200 proposal | 404 | 409
|
|
6
|
+
* POST /consolidation/proposals/:id/reject -> 200 proposal | 404 | 409
|
|
7
|
+
*
|
|
8
|
+
* /run executes the deterministic pass inline (no LLM in v1 — cheap enough
|
|
9
|
+
* to run synchronously); the `consolidate` job kind wraps the same call for
|
|
10
|
+
* scheduled runs.
|
|
11
|
+
*/
|
|
12
|
+
import type { FastifyInstance } from 'fastify';
|
|
13
|
+
import type { DB } from '../../storage/db.js';
|
|
14
|
+
export declare function consolidationRoutes(db: DB): (app: FastifyInstance) => Promise<void>;
|