hippo-memory 1.71.0 → 1.72.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 +1 -1
- package/dist/agent-memories/apply.d.ts +0 -11
- package/dist/agent-memories/apply.js +6 -21
- package/dist/agent-memories/claude-code.js +1 -1
- package/dist/agent-memories/codex.js +1 -1
- package/dist/agent-memories/copilot.d.ts +1 -3
- package/dist/agent-memories/copilot.js +1 -17
- package/dist/agent-memories/project-folds.d.ts +10 -0
- package/dist/agent-memories/project-folds.js +34 -0
- package/dist/agent-memories/sync.js +8 -6
- package/dist/api/assemble.js +1 -1
- package/dist/api/audit.d.ts +29 -1
- package/dist/api/audit.js +44 -5
- package/dist/api/auth.d.ts +7 -4
- package/dist/api/auth.js +12 -8
- package/dist/api/auto-sleep.d.ts +5 -2
- package/dist/api/auto-sleep.js +7 -3
- package/dist/api/availability.js +2 -3
- package/dist/api/cards.d.ts +42 -0
- package/dist/api/cards.js +52 -0
- package/dist/api/conflicts.d.ts +28 -0
- package/dist/api/conflicts.js +61 -0
- package/dist/api/context-render.js +4 -3
- package/dist/api/context-select.js +9 -11
- package/dist/api/context.js +17 -8
- package/dist/api/continuity.d.ts +47 -0
- package/dist/api/continuity.js +66 -0
- package/dist/api/dormant.js +4 -2
- package/dist/api/drill-down.js +1 -1
- package/dist/api/embeddings.d.ts +17 -0
- package/dist/api/embeddings.js +28 -0
- package/dist/api/error-reply.d.ts +8 -0
- package/dist/api/error-reply.js +21 -0
- package/dist/api/forget.d.ts +6 -2
- package/dist/api/forget.js +18 -7
- package/dist/api/goals.d.ts +1 -1
- package/dist/api/goals.js +5 -9
- package/dist/api/index.d.ts +4 -2
- package/dist/api/index.js +4 -2
- package/dist/api/instruction-detect.js +5 -1
- package/dist/api/learn.d.ts +4 -0
- package/dist/api/learn.js +53 -27
- package/dist/api/ledger-db.d.ts +2 -6
- package/dist/api/ledger-db.js +4 -36
- package/dist/api/memories.d.ts +19 -1
- package/dist/api/memories.js +39 -0
- package/dist/api/objects.d.ts +1 -1
- package/dist/api/outcome.js +1 -1
- package/dist/api/pilot-arm.d.ts +1 -11
- package/dist/api/pilot-arm.js +5 -45
- package/dist/api/predictions.d.ts +3 -1
- package/dist/api/predictions.js +6 -0
- package/dist/api/projects.d.ts +21 -0
- package/dist/api/projects.js +24 -0
- package/dist/api/promote.js +1 -1
- package/dist/api/prompt-hook.d.ts +15 -2
- package/dist/api/prompt-hook.js +44 -4
- package/dist/api/recall-cli.d.ts +3 -0
- package/dist/api/recall-cli.js +13 -4
- package/dist/api/recall-core.js +3 -3
- package/dist/api/recall-pipeline.js +6 -7
- package/dist/api/recall-request.js +1 -1
- package/dist/api/recall.d.ts +0 -3
- package/dist/api/recall.js +19 -44
- package/dist/api/remember-local.js +1 -1
- package/dist/api/remember.d.ts +2 -1
- package/dist/api/remember.js +3 -2
- package/dist/api/session-end.d.ts +22 -0
- package/dist/api/session-end.js +101 -0
- package/dist/api/sleep-run.d.ts +1 -1
- package/dist/api/sleep-run.js +13 -9
- package/dist/api/status.d.ts +24 -0
- package/dist/api/status.js +40 -0
- package/dist/api/store-init.d.ts +4 -0
- package/dist/api/store-init.js +9 -0
- package/dist/api/tokens.js +1 -1
- package/dist/api/types.d.ts +2 -0
- package/dist/api/types.js +6 -1
- package/dist/capture/caller-session.d.ts +0 -3
- package/dist/capture/caller-session.js +1 -12
- package/dist/capture/capture-error.d.ts +2 -2
- package/dist/capture/capture-error.js +23 -18
- package/dist/capture/codex-patch.js +3 -1
- package/dist/capture/command.js +36 -95
- package/dist/capture/compact.js +10 -5
- package/dist/capture/compaction-items-caller.js +11 -20
- package/dist/capture/compaction-record.d.ts +7 -93
- package/dist/capture/compaction-record.js +29 -426
- package/dist/capture/compaction-spool.d.ts +4 -2
- package/dist/capture/compaction-spool.js +20 -6
- package/dist/capture/copilot-transcript.d.ts +2 -1
- package/dist/capture/copilot-transcript.js +2 -1
- package/dist/capture/extract.d.ts +5 -2
- package/dist/capture/extract.js +4 -3
- package/dist/capture/failure-caller.d.ts +1 -1
- package/dist/capture/failure-caller.js +21 -16
- package/dist/capture/failure-reading.d.ts +2 -1
- package/dist/capture/failure-reading.js +7 -9
- package/dist/capture/pre-compact-caller.js +5 -4
- package/dist/capture/session-digest.js +4 -3
- package/dist/capture/session-end-caller.js +2 -1
- package/dist/capture/session-worker.js +3 -4
- package/dist/capture/transcript.d.ts +2 -1
- package/dist/capture/transcript.js +6 -3
- package/dist/capture/working-state.d.ts +4 -2
- package/dist/capture/working-state.js +4 -2
- package/dist/cli/audit-prune.d.ts +0 -25
- package/dist/cli/audit-prune.js +1 -27
- package/dist/cli/audit.js +13 -13
- package/dist/cli/auth.d.ts +1 -1
- package/dist/cli/auth.js +12 -13
- package/dist/cli/briefs.d.ts +1 -4
- package/dist/cli/briefs.js +37 -292
- package/dist/cli/card.js +41 -33
- package/dist/cli/client.d.ts +5 -0
- package/dist/cli/client.js +24 -8
- package/dist/cli/compact-resume-payload.js +1 -1
- package/dist/cli/context.d.ts +1 -1
- package/dist/cli/context.js +12 -12
- package/dist/cli/continuity.d.ts +1 -1
- package/dist/cli/continuity.js +36 -39
- package/dist/cli/curate.d.ts +1 -1
- package/dist/cli/curate.js +23 -27
- package/dist/cli/dag.d.ts +1 -1
- package/dist/cli/dag.js +23 -8
- package/dist/cli/decisions.d.ts +0 -2
- package/dist/cli/decisions.js +4 -281
- package/dist/cli/eval.d.ts +1 -1
- package/dist/cli/eval.js +12 -13
- package/dist/cli/explain.d.ts +1 -1
- package/dist/cli/explain.js +21 -25
- package/dist/cli/flag-values.js +16 -6
- package/dist/cli/flags.d.ts +0 -289
- package/dist/cli/flags.js +3 -138
- package/dist/cli/graph.d.ts +3 -0
- package/dist/cli/graph.js +83 -0
- package/dist/cli/hook-runtime.d.ts +3 -5
- package/dist/cli/hook-runtime.js +7 -34
- package/dist/cli/incidents.d.ts +3 -0
- package/dist/cli/incidents.js +112 -0
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +28 -19
- package/dist/cli/install-steps.d.ts +2 -1
- package/dist/cli/install-steps.js +11 -3
- package/dist/cli/last-sleep.js +1 -1
- package/dist/cli/lenient-id.d.ts +2 -0
- package/dist/cli/lenient-id.js +13 -0
- package/dist/cli/maintenance.d.ts +3 -3
- package/dist/cli/maintenance.js +29 -30
- package/dist/cli/notes.d.ts +2 -0
- package/dist/cli/notes.js +41 -0
- package/dist/cli/open-browser.d.ts +14 -0
- package/dist/cli/open-browser.js +26 -0
- package/dist/cli/playbooks.d.ts +3 -4
- package/dist/cli/playbooks.js +126 -290
- package/dist/cli/predictions.d.ts +3 -0
- package/dist/cli/predictions.js +175 -0
- package/dist/cli/print.js +2 -1
- package/dist/cli/projects.js +30 -22
- package/dist/cli/quality-repair-once.d.ts +1 -1
- package/dist/cli/quality-repair-once.js +6 -5
- package/dist/cli/recall.js +13 -7
- package/dist/cli/refine-llm.js +17 -17
- package/dist/cli/remember.js +12 -12
- package/dist/cli/scheduler.js +2 -1
- package/dist/cli/serve.js +3 -3
- package/dist/cli/session-hooks.d.ts +1 -1
- package/dist/cli/session-hooks.js +45 -115
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.js +17 -10
- package/dist/cli/shared.d.ts +2 -6
- package/dist/cli/shared.js +9 -29
- package/dist/cli/sleep-render.js +6 -3
- package/dist/cli/sleep.js +6 -37
- package/dist/cli/status.d.ts +3 -3
- package/dist/cli/status.js +32 -35
- package/dist/cli/transfer.d.ts +1 -1
- package/dist/cli/transfer.js +33 -31
- package/dist/cli/usage.d.ts +0 -79
- package/dist/cli/usage.js +1 -695
- package/dist/cli/verb-row.d.ts +32 -0
- package/dist/cli/verb-row.js +6 -0
- package/dist/cli/verbs/health.d.ts +27 -0
- package/dist/cli/verbs/health.js +232 -0
- package/dist/cli/verbs/memory.d.ts +16 -0
- package/dist/cli/verbs/memory.js +244 -0
- package/dist/cli/verbs/objects.d.ts +20 -0
- package/dist/cli/verbs/objects.js +254 -0
- package/dist/cli/verbs/sessions.d.ts +31 -0
- package/dist/cli/verbs/sessions.js +312 -0
- package/dist/cli/verbs.d.ts +81 -0
- package/dist/cli/verbs.js +7 -0
- package/dist/cli/versioned-verbs.d.ts +51 -0
- package/dist/cli/versioned-verbs.js +79 -0
- package/dist/cli.d.ts +1 -272
- package/dist/cli.js +23 -313
- package/dist/connectors/dlq.d.ts +39 -3
- package/dist/connectors/dlq.js +37 -3
- package/dist/connectors/github/backfill.js +12 -3
- package/dist/connectors/github/dlq.js +31 -73
- package/dist/connectors/github/ingest.d.ts +2 -6
- package/dist/connectors/github/ingest.js +3 -28
- package/dist/connectors/github/webhook.d.ts +2 -1
- package/dist/connectors/github/webhook.js +33 -2
- package/dist/connectors/ingest.d.ts +10 -0
- package/dist/connectors/ingest.js +28 -0
- package/dist/connectors/slack/dlq.js +49 -71
- package/dist/connectors/slack/ingest.d.ts +2 -6
- package/dist/connectors/slack/ingest.js +2 -27
- package/dist/connectors/slack/webhook.d.ts +2 -1
- package/dist/connectors/slack/webhook.js +2 -1
- package/dist/consolidate/conflicts.js +1 -1
- package/dist/consolidate/dag.js +15 -9
- package/dist/consolidate/dedupe.d.ts +7 -0
- package/dist/consolidate/dedupe.js +5 -3
- package/dist/consolidate/llm-passes.js +45 -19
- package/dist/consolidate/memory-value.js +2 -1
- package/dist/consolidate/merge.js +2 -2
- package/dist/consolidate/physics-pass.d.ts +6 -1
- package/dist/consolidate/physics-pass.js +26 -6
- package/dist/consolidate/replay.js +11 -4
- package/dist/consolidate/sleep.js +8 -5
- package/dist/consolidate/traces.js +3 -3
- package/dist/core/ablation.d.ts +10 -0
- package/dist/core/ablation.js +12 -0
- package/dist/{sharing/scope.d.ts → core/active-scope.d.ts} +1 -1
- package/dist/{sharing/scope.js → core/active-scope.js} +1 -1
- package/dist/core/ambient.d.ts +4 -0
- package/dist/core/ambient.js +39 -18
- package/dist/core/api-errors.d.ts +16 -0
- package/dist/core/api-errors.js +20 -0
- package/dist/core/card.js +3 -1
- package/dist/core/compaction-timing.d.ts +7 -0
- package/dist/core/compaction-timing.js +9 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.js +7 -2
- package/dist/core/cosine.d.ts +3 -0
- package/dist/core/cosine.js +19 -0
- package/dist/{store → core}/markdown.d.ts +1 -1
- package/dist/{store → core}/markdown.js +2 -2
- package/dist/core/memory-audit.d.ts +17 -0
- package/dist/core/memory-audit.js +54 -0
- package/dist/core/memory.d.ts +10 -4
- package/dist/core/memory.js +25 -18
- package/dist/{consolidate → core}/merged-row.d.ts +1 -1
- package/dist/{consolidate → core}/merged-row.js +1 -1
- package/dist/core/physics.js +6 -16
- package/dist/core/prediction.d.ts +3 -0
- package/dist/core/prediction.js +6 -0
- package/dist/core/project-identity.d.ts +3 -0
- package/dist/core/project-identity.js +10 -1
- package/dist/{store → core}/recall-scope.d.ts +1 -10
- package/dist/{store → core}/recall-scope.js +2 -19
- package/dist/db/busy.d.ts +2 -7
- package/dist/db/busy.js +21 -26
- package/dist/db/connect.d.ts +0 -1
- package/dist/db/connect.js +5 -6
- package/dist/db/index.d.ts +3 -3
- package/dist/db/index.js +3 -3
- package/dist/db/migrations/index.d.ts +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/v55.d.ts +3 -0
- package/dist/db/migrations/v55.js +17 -0
- package/dist/db/open.d.ts +0 -2
- package/dist/db/open.js +6 -10
- package/dist/db/physics-state.js +3 -3
- package/dist/db/tables.d.ts +2 -0
- package/dist/db/tables.js +6 -2
- package/dist/db/vector-store.js +17 -4
- package/dist/db/wal-checkpointer.js +2 -1
- package/dist/doctor.js +11 -8
- package/dist/embeddings/local.d.ts +62 -0
- package/dist/embeddings/local.js +146 -0
- package/dist/{store/embeddings → embeddings}/provider.d.ts +5 -2
- package/dist/{store/embeddings → embeddings}/provider.js +18 -15
- package/dist/embeddings/transformers.d.ts +26 -0
- package/dist/embeddings/transformers.js +89 -0
- package/dist/entry/session-text.d.ts +1 -1
- package/dist/entry/session-text.js +1 -1
- package/dist/eval/eval-suite.js +17 -11
- package/dist/eval/eval.js +1 -1
- package/dist/eval/judgment.js +11 -4
- package/dist/graph/extract.js +3 -3
- package/dist/graph/recall.js +1 -1
- package/dist/graph/view.js +13 -5
- package/dist/graph/write.d.ts +1 -1
- package/dist/graph/write.js +9 -9
- package/dist/hooks/codex-session.js +3 -2
- package/dist/hooks/codex-wrapper.js +2 -1
- package/dist/hooks/json-hooks.js +4 -2
- package/dist/hooks/opencode.js +8 -5
- package/dist/hooks/shared.d.ts +0 -6
- package/dist/hooks/shared.js +4 -15
- package/dist/importers/core.js +1 -1
- package/dist/importers/sources.js +5 -4
- package/dist/importers/vault.js +7 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/learn/autolearn.d.ts +10 -2
- package/dist/learn/autolearn.js +32 -12
- package/dist/learn/churn-git.js +13 -4
- package/dist/learn/extract.d.ts +3 -2
- package/dist/learn/extract.js +6 -4
- package/dist/learn/forward-claim-detector.js +4 -2
- package/dist/learn/invalidation.js +10 -6
- package/dist/mcp/admin-tools.d.ts +2 -2
- package/dist/mcp/admin-tools.js +27 -48
- package/dist/mcp/format.js +3 -2
- package/dist/mcp/framing.d.ts +1 -0
- package/dist/mcp/framing.js +1 -1
- package/dist/mcp/memory-tools.js +3 -1
- package/dist/mcp/protocol.d.ts +11 -7
- package/dist/mcp/protocol.js +25 -12
- package/dist/mcp/recall-tools.js +12 -9
- package/dist/mcp/request.js +2 -1
- package/dist/mcp/stdio.js +24 -8
- package/dist/mcp/tool-args.js +2 -1
- package/dist/mcp/tools.js +44 -21
- package/dist/objects/customer-notes.d.ts +2 -2
- package/dist/objects/decisions.d.ts +2 -2
- package/dist/objects/descriptor.d.ts +1 -1
- package/dist/objects/incidents.d.ts +2 -2
- package/dist/objects/lifecycle.d.ts +1 -1
- package/dist/objects/lifecycle.js +2 -1
- package/dist/objects/policies.d.ts +2 -2
- package/dist/objects/policies.js +2 -1
- package/dist/objects/processes.d.ts +2 -2
- package/dist/objects/project-briefs.d.ts +2 -2
- package/dist/objects/project-briefs.js +2 -3
- package/dist/objects/skills.d.ts +2 -2
- package/dist/postinstall.js +1 -1
- package/dist/rerankers/clef.js +3 -6
- package/dist/rerankers/cross-encoder.d.ts +31 -2
- package/dist/rerankers/cross-encoder.js +63 -97
- package/dist/rerankers/index.js +5 -4
- package/dist/rerankers/jev.js +2 -4
- package/dist/rerankers/outage-warning.d.ts +3 -1
- package/dist/rerankers/outage-warning.js +5 -3
- package/dist/search/bm25-search.js +1 -1
- package/dist/search/boosts.js +1 -1
- package/dist/search/embed-memories.d.ts +9 -0
- package/dist/search/embed-memories.js +377 -0
- package/dist/search/goal-boost.d.ts +1 -1
- package/dist/search/goal-boost.js +6 -3
- package/dist/search/hybrid.d.ts +9 -2
- package/dist/search/hybrid.js +9 -4
- package/dist/search/physics-search.d.ts +6 -3
- package/dist/search/physics-search.js +22 -15
- package/dist/search/rerank.js +1 -1
- package/dist/search/vector.d.ts +8 -6
- package/dist/search/vector.js +10 -13
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.js +17 -7
- package/dist/server/boot.js +7 -66
- package/dist/server/client-ip.d.ts +0 -2
- package/dist/server/client-ip.js +3 -2
- package/dist/server/deadline.d.ts +0 -2
- package/dist/server/deadline.js +1 -7
- package/dist/server/defaults.d.ts +1 -0
- package/dist/server/defaults.js +1 -0
- package/dist/server/mcp-http.js +16 -11
- package/dist/server/request.js +7 -2
- package/dist/server/route-checks.d.ts +7 -0
- package/dist/server/route-checks.js +42 -0
- package/dist/server/route-table.d.ts +9 -8
- package/dist/server/route-table.js +127 -132
- package/dist/server/routes/admin.d.ts +8 -8
- package/dist/server/routes/admin.js +13 -21
- package/dist/server/routes/customer-notes.d.ts +6 -6
- package/dist/server/routes/customer-notes.js +1 -2
- package/dist/server/routes/decisions.d.ts +6 -6
- package/dist/server/routes/decisions.js +2 -4
- package/dist/server/routes/incidents.d.ts +6 -6
- package/dist/server/routes/incidents.js +2 -5
- package/dist/server/routes/memories.d.ts +9 -9
- package/dist/server/routes/memories.js +15 -38
- package/dist/server/routes/object-routes.d.ts +6 -6
- package/dist/server/routes/object-routes.js +4 -7
- package/dist/server/routes/policies.d.ts +7 -7
- package/dist/server/routes/policies.js +2 -4
- package/dist/server/routes/predictions.d.ts +6 -6
- package/dist/server/routes/predictions.js +9 -13
- package/dist/server/routes/processes.d.ts +6 -6
- package/dist/server/routes/processes.js +1 -2
- package/dist/server/routes/project-briefs.d.ts +7 -7
- package/dist/server/routes/project-briefs.js +2 -4
- package/dist/server/routes/recall.d.ts +5 -5
- package/dist/server/routes/recall.js +6 -10
- package/dist/server/routes/skills.d.ts +7 -7
- package/dist/server/routes/skills.js +2 -4
- package/dist/server/server-detect.d.ts +7 -1
- package/dist/server/server-detect.js +36 -11
- package/dist/server/sleep-child.js +26 -7
- package/dist/server/sleep-offload.d.ts +11 -5
- package/dist/server/sleep-offload.js +17 -11
- package/dist/server/types.d.ts +22 -10
- package/dist/server/validation.d.ts +1 -2
- package/dist/server/validation.js +6 -11
- package/dist/server.d.ts +5 -4
- package/dist/server.js +5 -4
- package/dist/sharing/global-store.js +2 -2
- package/dist/sharing/global-sync.js +38 -45
- package/dist/sharing/project-merge.d.ts +7 -14
- package/dist/sharing/project-merge.js +57 -121
- package/dist/sharing/search-both.js +1 -1
- package/dist/sharing/share.d.ts +2 -0
- package/dist/sharing/share.js +37 -34
- package/dist/store/ambient.js +5 -6
- package/dist/store/audit-event.d.ts +1 -1
- package/dist/store/audit.d.ts +0 -16
- package/dist/store/audit.js +4 -55
- package/dist/store/auth.d.ts +4 -2
- package/dist/store/auth.js +7 -3
- package/dist/store/candidates.d.ts +3 -2
- package/dist/store/candidates.js +42 -23
- package/dist/store/capture-write.d.ts +17 -0
- package/dist/store/capture-write.js +35 -0
- package/dist/store/cards.js +1 -1
- package/dist/store/compaction-caller.d.ts +18 -0
- package/dist/store/compaction-caller.js +29 -0
- package/dist/store/compactions-record.d.ts +115 -0
- package/dist/store/compactions-record.js +417 -0
- package/dist/store/compactions.js +6 -4
- package/dist/store/conflicts.js +7 -4
- package/dist/store/connectors/dlq.d.ts +10 -0
- package/dist/store/connectors/dlq.js +32 -0
- package/dist/store/connectors/github.d.ts +7 -9
- package/dist/store/connectors/github.js +30 -53
- package/dist/store/connectors/slack.d.ts +2 -11
- package/dist/store/connectors/slack.js +18 -47
- package/dist/store/dashboard-reads.js +7 -6
- package/dist/store/delete-and-batch.d.ts +6 -0
- package/dist/store/delete-and-batch.js +36 -3
- package/dist/store/delivery-recorder.d.ts +10 -3
- package/dist/store/delivery-recorder.js +12 -5
- package/dist/store/descendant-page.js +6 -3
- package/dist/store/dormant.d.ts +1 -1
- package/dist/store/dormant.js +3 -1
- package/dist/store/embeddings/index.d.ts +2 -12
- package/dist/store/embeddings/index.js +5 -374
- package/dist/store/entry-reads.d.ts +13 -4
- package/dist/store/entry-reads.js +47 -11
- package/dist/store/entry-writes.d.ts +5 -5
- package/dist/store/entry-writes.js +32 -12
- package/dist/store/failure-log-at.d.ts +8 -0
- package/dist/store/failure-log-at.js +16 -0
- package/dist/store/failure-log.d.ts +2 -2
- package/dist/store/failure-log.js +5 -3
- package/dist/{trust → store}/gated-write.d.ts +3 -1
- package/dist/{trust → store}/gated-write.js +7 -5
- package/dist/store/goals.js +20 -18
- package/dist/store/graph-reads.js +4 -2
- package/dist/store/graph-writes.d.ts +6 -6
- package/dist/store/graph-writes.js +48 -71
- package/dist/store/handoffs.d.ts +1 -1
- package/dist/store/handoffs.js +6 -6
- package/dist/store/index-and-stats.js +2 -2
- package/dist/store/key-writes.js +1 -1
- package/dist/store/ledger-turn.d.ts +9 -0
- package/dist/store/ledger-turn.js +38 -0
- package/dist/store/mirrors.js +10 -6
- package/dist/store/open.d.ts +0 -4
- package/dist/store/open.js +40 -53
- package/dist/store/pilot-arm.d.ts +12 -0
- package/dist/store/pilot-arm.js +42 -0
- package/dist/store/port.d.ts +9 -3
- package/dist/store/port.js +8 -0
- package/dist/store/predictions.d.ts +1 -2
- package/dist/store/predictions.js +3 -6
- package/dist/store/project-tags.d.ts +62 -0
- package/dist/store/project-tags.js +67 -0
- package/dist/store/quarantine.js +2 -1
- package/dist/store/recall-trace.d.ts +2 -0
- package/dist/store/recall-trace.js +18 -2
- package/dist/store/rejected-values.js +2 -1
- package/dist/store/rejection-probe.d.ts +4 -0
- package/dist/store/rejection-probe.js +19 -0
- package/dist/store/rejection.d.ts +0 -17
- package/dist/store/rejection.js +1 -21
- package/dist/store/rule-sql.d.ts +9 -0
- package/dist/store/rule-sql.js +21 -2
- package/dist/store/search-rows.js +9 -4
- package/dist/store/sessions.js +4 -2
- package/dist/store/set-aside.d.ts +14 -0
- package/dist/store/set-aside.js +23 -0
- package/dist/store/sqlite/busy.d.ts +3 -0
- package/dist/store/sqlite/busy.js +8 -0
- package/dist/store/sqlite/connector-events-group.js +4 -7
- package/dist/store/sqlite/connector-writes-group.js +3 -3
- package/dist/store/sqlite/entry-writes-group.js +2 -2
- package/dist/store/sqlite/error-codec.js +4 -3
- package/dist/store/sqlite/executor.js +10 -4
- package/dist/store/sqlite/graph-reads-group.js +1 -1
- package/dist/store/sqlite/held-connection.d.ts +9 -0
- package/dist/store/sqlite/held-connection.js +41 -0
- package/dist/store/sqlite/object-rows.d.ts +1 -1
- package/dist/store/sqlite/objects-group.d.ts +1 -1
- package/dist/store/sqlite/objects-group.js +1 -1
- package/dist/store/sqlite/store.js +14 -12
- package/dist/store/summaries.d.ts +3 -3
- package/dist/store/summaries.js +5 -4
- package/dist/store/token-ledger.d.ts +0 -7
- package/dist/store/token-ledger.js +0 -35
- package/dist/store/vector-index.js +3 -2
- package/dist/support-bundle.js +2 -3
- package/dist/trust/reject-flow.js +2 -2
- package/dist/util/agent-homes.d.ts +15 -0
- package/dist/util/agent-homes.js +34 -0
- package/dist/util/anthropic-messages.d.ts +3 -0
- package/dist/util/anthropic-messages.js +22 -5
- package/dist/util/chunked.d.ts +3 -0
- package/dist/util/chunked.js +10 -0
- package/dist/util/ellipsize.d.ts +3 -0
- package/dist/util/ellipsize.js +5 -0
- package/dist/util/env.d.ts +2 -1
- package/dist/util/env.js +2 -1
- package/dist/util/format.d.ts +3 -0
- package/dist/util/format.js +6 -0
- package/dist/util/hook-payload.d.ts +8 -0
- package/dist/util/hook-payload.js +37 -0
- package/dist/util/http-retry.d.ts +6 -0
- package/dist/util/http-retry.js +43 -5
- package/dist/util/http-util.d.ts +0 -8
- package/dist/util/http-util.js +10 -21
- package/dist/util/limits.d.ts +7 -0
- package/dist/util/limits.js +14 -0
- package/dist/util/log.d.ts +4 -0
- package/dist/util/log.js +9 -0
- package/dist/util/request-scope.d.ts +3 -1
- package/dist/util/request-scope.js +11 -6
- package/dist/util/secret-detect.js +6 -1
- package/dist/util/sqlite-blocked.d.ts +2 -0
- package/dist/util/sqlite-blocked.js +5 -0
- package/dist/util/stream-tee.d.ts +3 -0
- package/dist/util/stream-tee.js +35 -0
- package/dist/util/time.d.ts +4 -0
- package/dist/util/time.js +4 -0
- package/dist/util/version.d.ts +1 -1
- package/dist/util/version.js +1 -1
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/dist/store/embeddings/local.d.ts +0 -15
- package/dist/store/embeddings/local.js +0 -175
- /package/dist/{cli → api}/correction-latency.d.ts +0 -0
- /package/dist/{cli → api}/correction-latency.js +0 -0
- /package/dist/{cli → api}/provenance-coverage.d.ts +0 -0
- /package/dist/{cli → api}/provenance-coverage.js +0 -0
- /package/dist/{store → core}/object-types.d.ts +0 -0
- /package/dist/{store → core}/object-types.js +0 -0
- /package/dist/{capture → util}/compaction-items.d.ts +0 -0
- /package/dist/{capture → util}/compaction-items.js +0 -0
- /package/dist/{store → util}/yaml.d.ts +0 -0
- /package/dist/{store → util}/yaml.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Learned memory-value scorer, a rescue-only veto in the sleep decay pass (it can only shrink the condemned set); mirrors benchmarks/memory-value/*.mjs.
|
|
2
2
|
* rescueSet rescues a condemned entry iff it ranks in the top 30% (RESCUE_BUDGET) of its tenant's non-pinned set; memory-value-wiring.test.ts guards parity. */
|
|
3
3
|
import { DEFAULT_TENANT_ID } from '../util/env.js';
|
|
4
|
+
import { strengthAblation } from '../core/ablation.js';
|
|
4
5
|
import { calculateStrength } from '../core/memory.js';
|
|
5
6
|
import { compareEntryIdentity } from '../core/compare.js';
|
|
6
7
|
import { MEMORY_VALUE_WEIGHTS, SOURCE_ARTIFACT_SHA256 } from './memory-value-weights.js';
|
|
@@ -31,7 +32,7 @@ export function computeMvFeatures(entry, now) {
|
|
|
31
32
|
return {
|
|
32
33
|
age_days: ageDays,
|
|
33
34
|
half_life_days: entry.half_life_days,
|
|
34
|
-
strength: calculateStrength(entry, now), // clock-basis, never
|
|
35
|
+
strength: calculateStrength(entry, now, { ablation: strengthAblation() }), // clock-basis, never the production decay basis — see doc comment above
|
|
35
36
|
retrieval_count: entry.retrieval_count,
|
|
36
37
|
outcome_positive: pos,
|
|
37
38
|
outcome_negative: neg,
|
|
@@ -3,10 +3,10 @@ import { tokenize } from '../util/tokenize.js';
|
|
|
3
3
|
import { jaccardMinShared, overlapPartners } from './overlap-index.js';
|
|
4
4
|
import { compareEntryIdentity } from '../core/compare.js';
|
|
5
5
|
import { duplicateKey, mergedText } from '../util/same-text.js';
|
|
6
|
-
import { successorAfterRetirement } from '
|
|
6
|
+
import { successorAfterRetirement } from '../core/merged-row.js';
|
|
7
7
|
import { rejectionDigest } from '../store/rejection.js';
|
|
8
8
|
import { reportAuditWriteFailure } from '../store/audit.js';
|
|
9
|
-
import { derivationScope, derivationPartitionKey } from '../
|
|
9
|
+
import { derivationScope, derivationPartitionKey } from '../core/recall-scope.js';
|
|
10
10
|
import { jaccardSets } from './conflicts.js';
|
|
11
11
|
import { keptAsWritten } from './run.js';
|
|
12
12
|
import { isReusable } from '../core/memory-quality.js';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { type PhysicsParticle } from '../core/physics.js';
|
|
2
|
+
import type { MemoryEntry } from '../core/memory.js';
|
|
1
3
|
import type { SleepRun } from './run.js';
|
|
2
|
-
export declare function physicsPass(run: SleepRun): void;
|
|
4
|
+
export declare function physicsPass(run: SleepRun, maxParticles?: number): void;
|
|
5
|
+
/** Every stored particle in load order up to the cap; past it, the most recently recalled survivors (memory id breaks ties),
|
|
6
|
+
* then particles with no survivor. */
|
|
7
|
+
export declare function particlesToSimulate(stored: PhysicsParticle[], entries: ReadonlyMap<string, MemoryEntry>, max?: number): PhysicsParticle[];
|
|
3
8
|
//# sourceMappingURL=physics-pass.d.ts.map
|
|
@@ -3,8 +3,10 @@ import { loadStoredParticles, saveStoredParticles } from '../store/vector-index.
|
|
|
3
3
|
import { simulate } from '../core/physics.js';
|
|
4
4
|
import { errorMessage } from '../util/log.js';
|
|
5
5
|
const STATS_DECIMALS = 4;
|
|
6
|
+
// Every substep is all-pairs, so one sleep moves at most this many particles; the rest keep their stored state until they are recalled.
|
|
7
|
+
const SLEEP_PHYSICS_MAX_PARTICLES = 1000;
|
|
6
8
|
// 2. Physics simulation pass
|
|
7
|
-
export function physicsPass(run) {
|
|
9
|
+
export function physicsPass(run, maxParticles = SLEEP_PHYSICS_MAX_PARTICLES) {
|
|
8
10
|
if (run.dryRun)
|
|
9
11
|
return;
|
|
10
12
|
const { config, result } = run;
|
|
@@ -12,27 +14,45 @@ export function physicsPass(run) {
|
|
|
12
14
|
const physicsEnabled = config.physics.enabled === true
|
|
13
15
|
|| (config.physics.enabled === 'auto');
|
|
14
16
|
if (physicsEnabled)
|
|
15
|
-
simulateStoredParticles(run);
|
|
17
|
+
simulateStoredParticles(run, maxParticles);
|
|
16
18
|
}
|
|
17
19
|
catch (error) {
|
|
18
20
|
result.details.push(` ⚠️ physics simulation skipped: ${errorMessage(error)}`);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
function simulateStoredParticles(run) {
|
|
23
|
+
function simulateStoredParticles(run, maxParticles) {
|
|
22
24
|
const { result, survivors } = run;
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
+
const stored = loadStoredParticles(run.hippoRoot);
|
|
26
|
+
if (stored.length === 0)
|
|
25
27
|
return;
|
|
26
28
|
// Build entry lookup for property refresh
|
|
27
29
|
const entryMap = new Map(survivors.map(e => [e.id, e]));
|
|
30
|
+
const particles = particlesToSimulate(stored, entryMap, maxParticles);
|
|
28
31
|
refreshParticleProperties(particles, entryMap, run.now);
|
|
29
32
|
const stats = simulate(particles, survivorForces(run));
|
|
30
33
|
saveStoredParticles(run.hippoRoot, particles);
|
|
31
34
|
result.physicsSimulated = stats.particleCount;
|
|
32
|
-
|
|
35
|
+
const capped = particles.length < stored.length ? ` (the ${particles.length} most recently recalled of ${stored.length})` : '';
|
|
36
|
+
result.details.push(` ⚛️ physics: ${stats.particleCount} particles${capped}, ` +
|
|
33
37
|
`avg vel ${stats.avgVelocityMagnitude.toFixed(STATS_DECIMALS)}, ` +
|
|
34
38
|
`energy ${stats.energy.total.toFixed(STATS_DECIMALS)}`);
|
|
35
39
|
}
|
|
40
|
+
/** Every stored particle in load order up to the cap; past it, the most recently recalled survivors (memory id breaks ties),
|
|
41
|
+
* then particles with no survivor. */
|
|
42
|
+
export function particlesToSimulate(stored, entries, max = SLEEP_PHYSICS_MAX_PARTICLES) {
|
|
43
|
+
if (stored.length <= max)
|
|
44
|
+
return stored;
|
|
45
|
+
const recalled = (p) => entries.get(p.memoryId)?.last_retrieved ?? '';
|
|
46
|
+
const ranked = [...stored].sort((a, b) => {
|
|
47
|
+
const [ra, rb] = [recalled(a), recalled(b)];
|
|
48
|
+
if (ra !== rb)
|
|
49
|
+
return ra < rb ? 1 : -1;
|
|
50
|
+
return a.memoryId < b.memoryId ? -1 : a.memoryId > b.memoryId ? 1 : 0;
|
|
51
|
+
});
|
|
52
|
+
const kept = new Set(ranked.slice(0, max));
|
|
53
|
+
// Load order, not rank order: the force sums run in this order, so a capped run matches an uncapped one over the same set.
|
|
54
|
+
return stored.filter((p) => kept.has(p));
|
|
55
|
+
}
|
|
36
56
|
function survivorForces(run) {
|
|
37
57
|
// Build conflict pairs from survivors
|
|
38
58
|
const conflictPairs = new Map();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Replay: during `hippo sleep`, sample N survivors weighted by reward, valence, under-rehearsal and age, then apply the `markRetrieved` strengthening.
|
|
2
2
|
* A lightweight deterministic analog of hippocampal replay, so important memories stay strong without being queried; distinct from decay, physics and merge. */
|
|
3
|
+
import { HOUR_MS } from '../util/time.js';
|
|
3
4
|
import { isOutcomeSlowAblated } from '../core/ablation.js';
|
|
4
5
|
import { resolveConfidence } from '../core/memory.js';
|
|
5
6
|
const VALENCE_WEIGHT = {
|
|
@@ -8,6 +9,12 @@ const VALENCE_WEIGHT = {
|
|
|
8
9
|
negative: 1.5,
|
|
9
10
|
critical: 2.0,
|
|
10
11
|
};
|
|
12
|
+
// Floor keeps every weight positive for sampleForReplay; the rest scale reward and idle boosts.
|
|
13
|
+
const REWARD_FLOOR = 0.1;
|
|
14
|
+
const REWARD_POSITIVE_GAIN = 0.5;
|
|
15
|
+
const REWARD_NET_GAIN = 0.25;
|
|
16
|
+
const IDLE_BOOST_GAIN = 0.1;
|
|
17
|
+
const STRENGTH_FLOOR = 0.1;
|
|
11
18
|
/** Priority score for ranking survivors for replay (higher = more likely sampled); pure in the entry and current time. */
|
|
12
19
|
export function replayPriority(entry, now, outcomeAblated) {
|
|
13
20
|
const pos = entry.outcome_positive ?? 0;
|
|
@@ -16,18 +23,18 @@ export function replayPriority(entry, now, outcomeAblated) {
|
|
|
16
23
|
// The clamp is required because sampleForReplay needs all weights positive.
|
|
17
24
|
const rewardSignal = outcomeAblated
|
|
18
25
|
? 1.0 // EVAL-ONLY ablation (see ablation.ts): outcome-off also silences replay's reward bias
|
|
19
|
-
: Math.max(
|
|
26
|
+
: Math.max(REWARD_FLOOR, 1 + pos * REWARD_POSITIVE_GAIN + (pos - neg) * REWARD_NET_GAIN);
|
|
20
27
|
const valence = VALENCE_WEIGHT[entry.emotional_valence] ?? 1.0;
|
|
21
28
|
// Under-rehearsed memories benefit most from replay.
|
|
22
29
|
const underRehearsed = 1 / (1 + (entry.retrieval_count ?? 0));
|
|
23
30
|
// Idle-time boost: memories that haven't been touched recently need rehearsal more.
|
|
24
31
|
const lastRetrieved = new Date(entry.last_retrieved);
|
|
25
32
|
const deltaMs = now.getTime() - lastRetrieved.getTime();
|
|
26
|
-
const ageHours = Number.isFinite(deltaMs) ? Math.max(0, deltaMs /
|
|
27
|
-
const idleBoost = 1 + Math.log1p(ageHours) *
|
|
33
|
+
const ageHours = Number.isFinite(deltaMs) ? Math.max(0, deltaMs / HOUR_MS) : 0;
|
|
34
|
+
const idleBoost = 1 + Math.log1p(ageHours) * IDLE_BOOST_GAIN;
|
|
28
35
|
// Weight by current strength so dead-and-decaying memories don't waste replay slots.
|
|
29
36
|
const rawStrength = Number.isFinite(entry.strength) ? entry.strength : 0;
|
|
30
|
-
const strengthFloor = Math.max(
|
|
37
|
+
const strengthFloor = Math.max(STRENGTH_FLOOR, rawStrength);
|
|
31
38
|
return rewardSignal * valence * underRehearsed * idleBoost * strengthFloor;
|
|
32
39
|
}
|
|
33
40
|
/** Deterministic 32-bit RNG (Mulberry32): same seed, same sequence, so replay is reproducible without a random-number dependency. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Consolidation engine ("Sleep"): decay pass (drop entries below the strength threshold), merge pass (semantic summaries of overlapping episodics), stats. */
|
|
2
|
-
import { evalNow } from '../core/ablation.js';
|
|
2
|
+
import { evalNow, strengthAblation } from '../core/ablation.js';
|
|
3
3
|
import { canAutoDelete } from '../core/memory.js';
|
|
4
4
|
import { loadAllEntriesWithBase } from '../store/entry-reads.js';
|
|
5
5
|
import { commitInChunks, memoriesBackingObjects } from '../store/delete-and-batch.js';
|
|
@@ -11,7 +11,7 @@ import { loadConfig } from '../core/config.js';
|
|
|
11
11
|
import { recordAuditEventsRowByRow, reportAuditWriteFailure } from '../store/audit.js';
|
|
12
12
|
import { lazyTombstoneChecks } from '../store/tombstone-checks.js';
|
|
13
13
|
import { migrateDefaultHalfLife, LEGACY_TYPED_HALF_LIFE } from './half-life-migration.js';
|
|
14
|
-
import { errorMessage, log } from '../util/log.js';
|
|
14
|
+
import { errorFields, errorMessage, log } from '../util/log.js';
|
|
15
15
|
import { WRITE_BUDGET } from '../util/write-budget.js';
|
|
16
16
|
import { decayPass } from './decay.js';
|
|
17
17
|
import { familyUnits, groupFlush } from './flush-units.js';
|
|
@@ -68,6 +68,7 @@ function sessionDecayOptions(hippoRoot, config) {
|
|
|
68
68
|
decayBasis: config.decayBasis,
|
|
69
69
|
avgSessionIntervalDays: sessionCtx.avgSessionIntervalDays,
|
|
70
70
|
sleepCount: sessionCtx.sleepCount,
|
|
71
|
+
ablation: strengthAblation(),
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
/** Every pass between decay and the flush; the tombstone-check handle closes whichever of them throws. */
|
|
@@ -96,7 +97,8 @@ function migrateHalfLives(hippoRoot, dryRun, result) {
|
|
|
96
97
|
result.details.push(` ⏳ ${dryRun ? 'would move' : 'moved'} ${halfLife.rescaled} memories from the ${halfLife.from}-day to the ${halfLife.to}-day half-life`);
|
|
97
98
|
}
|
|
98
99
|
if (halfLife.typed > 0) {
|
|
99
|
-
result.details.push(` ⏳ ${dryRun ? 'would move' : 'moved'} ${halfLife.typed} memories of decisions, incidents and other objects
|
|
100
|
+
result.details.push(` ⏳ ${dryRun ? 'would move' : 'moved'} ${halfLife.typed} memories of decisions, incidents and other objects ` +
|
|
101
|
+
`from the ${LEGACY_TYPED_HALF_LIFE}-day to the ${halfLife.to}-day half-life`);
|
|
100
102
|
}
|
|
101
103
|
return halfLife;
|
|
102
104
|
}
|
|
@@ -126,7 +128,8 @@ async function expireDormant(run, budget) {
|
|
|
126
128
|
const cutoff = new Date(run.now.getTime() - config.dormant.retentionDays * DAY_MS).toISOString();
|
|
127
129
|
result.dormantExpired = await expireDormantBefore(run.hippoRoot, cutoff, { dryRun, budget, busyWaitMs: SLEEP_DB_WAIT_MS });
|
|
128
130
|
if (result.dormantExpired > 0) {
|
|
129
|
-
result.details.push(` ⌛ ${dryRun ? 'would expire' : 'expired'} ${result.dormantExpired} dormant memor${result.dormantExpired === 1 ? 'y' : 'ies'}
|
|
131
|
+
result.details.push(` ⌛ ${dryRun ? 'would expire' : 'expired'} ${result.dormantExpired} dormant memor${result.dormantExpired === 1 ? 'y' : 'ies'} ` +
|
|
132
|
+
`older than ${config.dormant.retentionDays} days`);
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
// 4. Log run
|
|
@@ -175,7 +178,7 @@ function auditRescues(run, { rescuedEntries, rankById }) {
|
|
|
175
178
|
}
|
|
176
179
|
catch (err) {
|
|
177
180
|
// An audit store that will not open must never crash the mutation it records.
|
|
178
|
-
log.
|
|
181
|
+
log.warn(`mv_rescue audit unavailable: ${errorMessage(err)}`, { errorClass: errorFields(err).errorClass });
|
|
179
182
|
result.details.push(` ⚠️ memory-value: mv_rescue audit unavailable this cycle ` +
|
|
180
183
|
`(${rescuedEntries.length} rescue${rescuedEntries.length === 1 ? '' : 's'} not audited)`);
|
|
181
184
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRecallBoostAblated } from '../core/ablation.js';
|
|
1
|
+
import { isRecallBoostAblated, strengthAblation } from '../core/ablation.js';
|
|
2
2
|
import { Layer, createMemory, markRetrieved } from '../core/memory.js';
|
|
3
3
|
import { findPromotableSessions, traceExistsForSession, listSessionEvents } from '../store/sessions.js';
|
|
4
4
|
import { rejectionDigest } from '../store/rejection.js';
|
|
@@ -6,7 +6,7 @@ import { sampleForReplay } from './replay.js';
|
|
|
6
6
|
import { renderTraceContent } from './trace.js';
|
|
7
7
|
import { resolveTenantId } from '../store/tenant.js';
|
|
8
8
|
import { reportAuditWriteFailure } from '../store/audit.js';
|
|
9
|
-
import { commonDerivationScope } from '../
|
|
9
|
+
import { commonDerivationScope } from '../core/recall-scope.js';
|
|
10
10
|
import { log } from '../util/log.js';
|
|
11
11
|
import { REPLAY_COUNT_DEFAULT } from './run.js';
|
|
12
12
|
import { isJsonString } from '../util/json.js';
|
|
@@ -136,7 +136,7 @@ export function replayPass(run) {
|
|
|
136
136
|
const picked = sampleForReplay(survivors, replayCount, now, seed);
|
|
137
137
|
if (picked.length === 0)
|
|
138
138
|
return;
|
|
139
|
-
const rehearsed = markRetrieved(picked, now);
|
|
139
|
+
const rehearsed = markRetrieved(picked, now, { ablation: strengthAblation() });
|
|
140
140
|
const rehearsedById = new Map(rehearsed.map((e) => [e.id, e]));
|
|
141
141
|
// Update survivors in place so downstream passes see rehearsed state.
|
|
142
142
|
for (let i = 0; i < survivors.length; i++) {
|
package/dist/core/ablation.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/** EVAL-ONLY ablation switches (HIPPO_ABLATE_*, HIPPO_EVAL_RECENCY_DAYS, HIPPO_FAKE_NOW): each cuts ONE mechanism (outcome also replayPriority bias).
|
|
2
2
|
* Not a production surface. Env is read once per process; tests that mutate these vars MUST call _resetAblationCacheForTests() in beforeEach AND afterEach. See
|
|
3
3
|
* docs/ARCHITECTURE.md#srccoreablationts. */
|
|
4
|
+
/** The three switches strength scoring honours, resolved by the entry layer and handed to core in DecayOptions. */
|
|
5
|
+
export interface StrengthAblation {
|
|
6
|
+
readonly decay: boolean;
|
|
7
|
+
readonly recallBoost: boolean;
|
|
8
|
+
readonly outcomeSlow: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Production scoring: nothing ablated. Core falls back to this, so it never reads the environment. */
|
|
11
|
+
export declare const NO_STRENGTH_ABLATION: StrengthAblation;
|
|
12
|
+
/** The frozen strength switches for this process; entry-layer callers pass them as `DecayOptions.ablation`. */
|
|
13
|
+
export declare function strengthAblation(): StrengthAblation;
|
|
4
14
|
export declare function isDecayAblated(): boolean;
|
|
5
15
|
export declare function isRecallBoostAblated(): boolean;
|
|
6
16
|
export declare function isOutcomeSlowAblated(): boolean;
|
package/dist/core/ablation.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Not a production surface. Env is read once per process; tests that mutate these vars MUST call _resetAblationCacheForTests() in beforeEach AND afterEach. See
|
|
3
3
|
* docs/ARCHITECTURE.md#srccoreablationts. */
|
|
4
4
|
import { envAblateDecay, envAblateOutcome, envAblateOutcomeFast, envAblateOutcomeSlow, envAblateRecallBoost, envAblateRecency, envEvalRecencyDays, envFakeNowMs, } from '../util/env.js';
|
|
5
|
+
/** Production scoring: nothing ablated. Core falls back to this, so it never reads the environment. */
|
|
6
|
+
export const NO_STRENGTH_ABLATION = Object.freeze({ decay: false, recallBoost: false, outcomeSlow: false });
|
|
5
7
|
let _cache;
|
|
8
|
+
let _strengthCache;
|
|
6
9
|
function readFlags() {
|
|
7
10
|
if (_cache !== undefined)
|
|
8
11
|
return _cache;
|
|
@@ -18,6 +21,14 @@ function readFlags() {
|
|
|
18
21
|
};
|
|
19
22
|
return _cache;
|
|
20
23
|
}
|
|
24
|
+
/** The frozen strength switches for this process; entry-layer callers pass them as `DecayOptions.ablation`. */
|
|
25
|
+
export function strengthAblation() {
|
|
26
|
+
if (_strengthCache === undefined) {
|
|
27
|
+
const f = readFlags();
|
|
28
|
+
_strengthCache = Object.freeze({ decay: f.decay, recallBoost: f.recallBoost, outcomeSlow: f.outcomeSlow });
|
|
29
|
+
}
|
|
30
|
+
return _strengthCache;
|
|
31
|
+
}
|
|
21
32
|
export function isDecayAblated() {
|
|
22
33
|
return readFlags().decay;
|
|
23
34
|
}
|
|
@@ -45,5 +56,6 @@ export function evalNow() {
|
|
|
45
56
|
/** Test-only. See module JSDoc: call in BOTH beforeEach AND afterEach. */
|
|
46
57
|
export function _resetAblationCacheForTests() {
|
|
47
58
|
_cache = undefined;
|
|
59
|
+
_strengthCache = undefined;
|
|
48
60
|
}
|
|
49
61
|
//# sourceMappingURL=ablation.js.map
|
|
@@ -4,4 +4,4 @@ export declare function detectScope(): string | null;
|
|
|
4
4
|
/** Compute scope match between a memory's scope tags and the active scope.
|
|
5
5
|
* Returns: 1 if matching scope, -1 if mismatching scope, 0 if neutral (no scope on either side). */
|
|
6
6
|
export declare function scopeMatch(memoryTags: string[], activeScope: string | null): -1 | 0 | 1;
|
|
7
|
-
//# sourceMappingURL=scope.d.ts.map
|
|
7
|
+
//# sourceMappingURL=active-scope.d.ts.map
|
package/dist/core/ambient.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export interface AmbientState {
|
|
|
13
13
|
dagDepth: number;
|
|
14
14
|
totalMemories: number;
|
|
15
15
|
}
|
|
16
|
+
/** A memory is fresh when created within this window. */
|
|
17
|
+
export declare const AMBIENT_FRESH_WINDOW_MS: number;
|
|
18
|
+
/** A memory counts as high schema fit strictly above this. */
|
|
19
|
+
export declare const HIGH_SCHEMA_FIT_ABOVE = 0.7;
|
|
16
20
|
/** Row counts and sums an AmbientState is derived from; two stores' tallies add with addAmbientTallies. */
|
|
17
21
|
export interface AmbientTallies {
|
|
18
22
|
total: number;
|
package/dist/core/ambient.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
/** Ambient state vector: a compact O(N) summary of the corpus telling the agent "where it is" in knowledge-space without retrieving specific memories. */
|
|
2
|
-
import { evalNow } from './ablation.js';
|
|
2
|
+
import { evalNow, strengthAblation } from './ablation.js';
|
|
3
3
|
import { Layer } from './memory.js';
|
|
4
4
|
import { calculateStrength } from './memory.js';
|
|
5
5
|
import { DAY_MS } from '../util/time.js';
|
|
6
6
|
const STATE_DECIMALS = 3;
|
|
7
|
+
// Cut points renderAmbientSummary uses to turn the state vector into words.
|
|
8
|
+
const SUMMARY_THRESHOLD = {
|
|
9
|
+
freshHigh: 0.5,
|
|
10
|
+
freshLow: 0.1,
|
|
11
|
+
skewHigh: 0.3,
|
|
12
|
+
skewLow: -0.3,
|
|
13
|
+
consolidatedHigh: 0.4,
|
|
14
|
+
consolidatedLow: 0.1,
|
|
15
|
+
extractionHigh: 0.5,
|
|
16
|
+
conflictShown: 0.1,
|
|
17
|
+
dagDepthShown: 2,
|
|
18
|
+
strengthLow: 0.3,
|
|
19
|
+
strengthHigh: 0.7,
|
|
20
|
+
entropyHigh: 0.8,
|
|
21
|
+
entropyLow: 0.3,
|
|
22
|
+
};
|
|
23
|
+
/** A memory is fresh when created within this window. */
|
|
24
|
+
export const AMBIENT_FRESH_WINDOW_MS = 7 * DAY_MS;
|
|
25
|
+
/** A memory counts as high schema fit strictly above this. */
|
|
26
|
+
export const HIGH_SCHEMA_FIT_ABOVE = 0.7;
|
|
7
27
|
/** The tallies of two disjoint row sets taken together. */
|
|
8
28
|
export function addAmbientTallies(a, b) {
|
|
9
29
|
const tagCounts = new Map(a.tagCounts);
|
|
@@ -31,7 +51,7 @@ export function isErrorTagged(tags) {
|
|
|
31
51
|
/** Tallies over loaded entries; superseded rows count toward the total only, as they always have here. */
|
|
32
52
|
export function tallyAmbientEntries(entries, now) {
|
|
33
53
|
const currentTime = now ?? evalNow(); // honors HIPPO_FAKE_NOW (eval-only)
|
|
34
|
-
const
|
|
54
|
+
const freshAfter = currentTime.getTime() - AMBIENT_FRESH_WINDOW_MS;
|
|
35
55
|
const t = {
|
|
36
56
|
total: entries.length, strengthSum: 0, fresh: 0, negative: 0, highSchemaFit: 0, errors: 0,
|
|
37
57
|
semantic: 0, episodic: 0, conflicts: 0, extracted: 0, maxDagLevel: 0, tagCounts: new Map(),
|
|
@@ -41,14 +61,14 @@ export function tallyAmbientEntries(entries, now) {
|
|
|
41
61
|
continue;
|
|
42
62
|
for (const tag of entry.tags)
|
|
43
63
|
t.tagCounts.set(tag, (t.tagCounts.get(tag) ?? 0) + 1);
|
|
44
|
-
t.strengthSum += calculateStrength(entry, currentTime);
|
|
45
|
-
if (new Date(entry.created).getTime() >
|
|
64
|
+
t.strengthSum += calculateStrength(entry, currentTime, { ablation: strengthAblation() });
|
|
65
|
+
if (new Date(entry.created).getTime() > freshAfter)
|
|
46
66
|
t.fresh++;
|
|
47
67
|
if (entry.emotional_valence === 'negative' || entry.emotional_valence === 'critical')
|
|
48
68
|
t.negative++;
|
|
49
69
|
if (isErrorTagged(entry.tags))
|
|
50
70
|
t.errors++;
|
|
51
|
-
if (entry.schema_fit >
|
|
71
|
+
if (entry.schema_fit > HIGH_SCHEMA_FIT_ABOVE)
|
|
52
72
|
t.highSchemaFit++;
|
|
53
73
|
if (entry.layer === Layer.Semantic)
|
|
54
74
|
t.semantic++;
|
|
@@ -116,33 +136,34 @@ function shannonEntropy(counts, total) {
|
|
|
116
136
|
export function renderAmbientSummary(state) {
|
|
117
137
|
if (state.totalMemories === 0)
|
|
118
138
|
return 'Memory state: empty store, no memories yet.';
|
|
139
|
+
const T = SUMMARY_THRESHOLD;
|
|
119
140
|
const parts = [];
|
|
120
141
|
parts.push(`${state.totalMemories} memories`);
|
|
121
|
-
if (state.recencyFreshness >
|
|
142
|
+
if (state.recencyFreshness > T.freshHigh)
|
|
122
143
|
parts.push('mostly fresh (<7d)');
|
|
123
|
-
else if (state.recencyFreshness <
|
|
144
|
+
else if (state.recencyFreshness < T.freshLow)
|
|
124
145
|
parts.push('mostly aged');
|
|
125
|
-
if (state.emotionalSkew >
|
|
146
|
+
if (state.emotionalSkew > T.skewHigh)
|
|
126
147
|
parts.push('error-focused');
|
|
127
|
-
else if (state.emotionalSkew <
|
|
148
|
+
else if (state.emotionalSkew < T.skewLow)
|
|
128
149
|
parts.push('steady operation');
|
|
129
|
-
if (state.consolidationRatio >
|
|
150
|
+
if (state.consolidationRatio > T.consolidatedHigh)
|
|
130
151
|
parts.push('well-consolidated');
|
|
131
|
-
else if (state.consolidationRatio <
|
|
152
|
+
else if (state.consolidationRatio < T.consolidatedLow)
|
|
132
153
|
parts.push('mostly episodic');
|
|
133
|
-
if (state.extractionCoverage >
|
|
154
|
+
if (state.extractionCoverage > T.extractionHigh)
|
|
134
155
|
parts.push('high extraction coverage');
|
|
135
|
-
if (state.conflictIntensity >
|
|
156
|
+
if (state.conflictIntensity > T.conflictShown)
|
|
136
157
|
parts.push(`${(state.conflictIntensity * 100).toFixed(0)}% conflict rate`);
|
|
137
|
-
if (state.dagDepth >=
|
|
158
|
+
if (state.dagDepth >= T.dagDepthShown)
|
|
138
159
|
parts.push(`DAG depth ${state.dagDepth}`);
|
|
139
|
-
if (state.avgStrength <
|
|
160
|
+
if (state.avgStrength < T.strengthLow)
|
|
140
161
|
parts.push('low avg strength (aging corpus)');
|
|
141
|
-
else if (state.avgStrength >
|
|
162
|
+
else if (state.avgStrength > T.strengthHigh)
|
|
142
163
|
parts.push('high avg strength');
|
|
143
|
-
if (state.tagEntropy >
|
|
164
|
+
if (state.tagEntropy > T.entropyHigh)
|
|
144
165
|
parts.push('diverse topics');
|
|
145
|
-
else if (state.tagEntropy <
|
|
166
|
+
else if (state.tagEntropy < T.entropyLow)
|
|
146
167
|
parts.push('narrow focus');
|
|
147
168
|
return `Memory state: ${parts.join(', ')}.`;
|
|
148
169
|
}
|
|
@@ -24,4 +24,20 @@ export declare class ConflictError extends ApiError {
|
|
|
24
24
|
readonly status = 409;
|
|
25
25
|
constructor(message: string);
|
|
26
26
|
}
|
|
27
|
+
/** Thrown by the write-path guard (checkRejectionGuard, via upsertEntryRow) when a write would introduce a tombstoned value; carries what the
|
|
28
|
+
* transaction-owner catch blocks (writeEntry, api.supersede) need to write the post-rollback `reject_refusal` audit row via `auditRejectionRefusal`. */
|
|
29
|
+
export declare class RejectedValueError extends BadRequestError {
|
|
30
|
+
readonly digest: string;
|
|
31
|
+
readonly tenantId: string;
|
|
32
|
+
readonly entryId: string;
|
|
33
|
+
readonly reason: string | null;
|
|
34
|
+
readonly rejectedAt: string;
|
|
35
|
+
constructor(opts: {
|
|
36
|
+
digest: string;
|
|
37
|
+
tenantId: string;
|
|
38
|
+
entryId: string;
|
|
39
|
+
reason: string | null;
|
|
40
|
+
rejectedAt: string;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
27
43
|
//# sourceMappingURL=api-errors.d.ts.map
|
package/dist/core/api-errors.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Errors whose HTTP status is part of the API contract; the server maps by class, so message text can change freely. */
|
|
2
|
+
import { DIGEST_DISPLAY_CHARS } from '../util/token-text.js';
|
|
2
3
|
/** Base class: an error the caller caused, carrying the status the HTTP layer answers with. */
|
|
3
4
|
export class ApiError extends Error {
|
|
4
5
|
}
|
|
@@ -34,4 +35,23 @@ export class ConflictError extends ApiError {
|
|
|
34
35
|
this.name = 'ConflictError';
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
/** Thrown by the write-path guard (checkRejectionGuard, via upsertEntryRow) when a write would introduce a tombstoned value; carries what the
|
|
39
|
+
* transaction-owner catch blocks (writeEntry, api.supersede) need to write the post-rollback `reject_refusal` audit row via `auditRejectionRefusal`. */
|
|
40
|
+
export class RejectedValueError extends BadRequestError {
|
|
41
|
+
digest;
|
|
42
|
+
tenantId;
|
|
43
|
+
entryId;
|
|
44
|
+
reason;
|
|
45
|
+
rejectedAt;
|
|
46
|
+
constructor(opts) {
|
|
47
|
+
super(`Memory value refused: matches a rejected value (digest ${opts.digest.slice(0, DIGEST_DISPLAY_CHARS)}..., ` +
|
|
48
|
+
`reason: ${opts.reason ?? 'none given'}). Run "hippo unreject" to allow it again.`);
|
|
49
|
+
this.name = 'RejectedValueError';
|
|
50
|
+
this.digest = opts.digest;
|
|
51
|
+
this.tenantId = opts.tenantId;
|
|
52
|
+
this.entryId = opts.entryId;
|
|
53
|
+
this.reason = opts.reason;
|
|
54
|
+
this.rejectedAt = opts.rejectedAt;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
37
57
|
//# sourceMappingURL=api-errors.js.map
|
package/dist/core/card.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Work-queue card types: a claimable unit of work, N candidates claim one row, first wins.
|
|
2
|
+
import { HOUR_MS } from '../util/time.js';
|
|
1
3
|
const CARD_STATUSES = ['backlog', 'ready', 'running', 'blocked', 'review', 'done', 'shelved'];
|
|
2
4
|
/** Narrows a raw string, such as a CLI flag value, to a CardStatus. */
|
|
3
5
|
export function isCardStatus(v) {
|
|
@@ -15,7 +17,7 @@ export const CARD_TRANSITIONS = {
|
|
|
15
17
|
};
|
|
16
18
|
// SHORTCUT: one fixed lease for every claim; add a per-claim lease when the W3 dispatcher heartbeats on a timer.
|
|
17
19
|
/** How long a claim or a heartbeat keeps a running card's lease before reclaimExpiredCards may return it to ready. */
|
|
18
|
-
export const CARD_LEASE_MS = 4 *
|
|
20
|
+
export const CARD_LEASE_MS = 4 * HOUR_MS;
|
|
19
21
|
/** Throws on any move CARD_TRANSITIONS does not allow, before a status write touches the row. */
|
|
20
22
|
export function assertCardTransition(from, to) {
|
|
21
23
|
for (const status of from) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** PostCompact has 10 s in all (PreCompact 30 s), so a locked store must be given up on early. */
|
|
2
|
+
export declare const COMPACTION_DB_WAIT_MS = 2000;
|
|
3
|
+
/** Long enough that a live hook has finished with its own record. */
|
|
4
|
+
export declare const REPLAY_AFTER_MS: number;
|
|
5
|
+
/** Claude Code deletes transcripts after 30 days, so an older gap can never be filled. */
|
|
6
|
+
export declare const TRANSCRIPT_FILL_WINDOW_MS: number;
|
|
7
|
+
//# sourceMappingURL=compaction-timing.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Waits and windows shared by the compaction record's SQL (src/store) and the hooks and CLI that schedule it.
|
|
2
|
+
import { DAY_MS, MINUTE_MS } from '../util/time.js';
|
|
3
|
+
/** PostCompact has 10 s in all (PreCompact 30 s), so a locked store must be given up on early. */
|
|
4
|
+
export const COMPACTION_DB_WAIT_MS = 2000;
|
|
5
|
+
/** Long enough that a live hook has finished with its own record. */
|
|
6
|
+
export const REPLAY_AFTER_MS = 10 * MINUTE_MS;
|
|
7
|
+
/** Claude Code deletes transcripts after 30 days, so an older gap can never be filled. */
|
|
8
|
+
export const TRANSCRIPT_FILL_WINDOW_MS = 30 * DAY_MS;
|
|
9
|
+
//# sourceMappingURL=compaction-timing.js.map
|
package/dist/core/config.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface HippoConfig {
|
|
|
20
20
|
model: string;
|
|
21
21
|
hybridWeight: number;
|
|
22
22
|
/** Embedding backend: 'local' (default) = zero-dependency transformers.js; 'openai' | 'voyage' | 'cohere' = opt-in API embedder needing the provider's
|
|
23
|
-
* API key in env (OPENAI_API_KEY / VOYAGE_API_KEY / COHERE_API_KEY). See src/
|
|
23
|
+
* API key in env (OPENAI_API_KEY / VOYAGE_API_KEY / COHERE_API_KEY). See src/embeddings/provider.ts. */
|
|
24
24
|
provider?: 'local' | 'openai' | 'voyage' | 'cohere';
|
|
25
25
|
/** Optional API base-URL override (self-host / proxy). HTTPS only (localhost
|
|
26
26
|
* may use http). Ignored by the local provider. */
|
package/dist/core/config.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as path from 'path';
|
|
|
6
6
|
import { DEFAULT_PHYSICS_CONFIG, mergePhysicsConfig } from './physics-config.js';
|
|
7
7
|
import { DEFAULT_HALF_LIFE_DAYS } from './memory.js';
|
|
8
8
|
import { DEFAULT_LOCAL_BUMP, DEFAULT_RECALL_BUDGET } from './search-types.js';
|
|
9
|
-
import { errorMessage, log } from '../util/log.js';
|
|
9
|
+
import { errorCode, errorMessage, log } from '../util/log.js';
|
|
10
10
|
import { isJsonObject } from '../util/json.js';
|
|
11
11
|
export const DEFAULT_CONFIG = {
|
|
12
12
|
defaultHalfLifeDays: DEFAULT_HALF_LIFE_DAYS,
|
|
@@ -243,7 +243,12 @@ function fileStamp(file) {
|
|
|
243
243
|
return stat === undefined ? null : `${stat.mtimeMs}:${stat.size}`;
|
|
244
244
|
}
|
|
245
245
|
catch (err) {
|
|
246
|
-
|
|
246
|
+
const code = errorCode(err);
|
|
247
|
+
const message = `config: ${file} could not be reached, read as missing: ${errorMessage(err)}`;
|
|
248
|
+
if (code === 'EACCES' || code === 'EPERM')
|
|
249
|
+
log.warnThenDebug(`config-unreachable:${file}:${code}`, message, { path: file, code });
|
|
250
|
+
else
|
|
251
|
+
log.debug(message);
|
|
247
252
|
return null;
|
|
248
253
|
}
|
|
249
254
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Cosine over any indexable vectors (a Float32 view scores as its number[] copy); 0 for empty, mismatched or zero-norm input. */
|
|
2
|
+
export function cosineOf(a, b) {
|
|
3
|
+
if (a.length === 0 || b.length === 0 || a.length !== b.length)
|
|
4
|
+
return 0;
|
|
5
|
+
let dot = 0;
|
|
6
|
+
let normA = 0;
|
|
7
|
+
let normB = 0;
|
|
8
|
+
for (let i = 0; i < a.length; i++) {
|
|
9
|
+
dot += a[i] * b[i];
|
|
10
|
+
normA += a[i] * a[i];
|
|
11
|
+
normB += b[i] * b[i];
|
|
12
|
+
}
|
|
13
|
+
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
14
|
+
if (denom < 1e-10)
|
|
15
|
+
return 0;
|
|
16
|
+
// Clamp to [-1, 1] to handle floating point drift
|
|
17
|
+
return Math.min(1, Math.max(-1, dot / denom));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cosine.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MemoryEntry } from '
|
|
1
|
+
import { type MemoryEntry } from './memory.js';
|
|
2
2
|
/** Serialize a MemoryEntry to markdown with YAML frontmatter. */
|
|
3
3
|
export declare function serializeEntry(entry: MemoryEntry): string;
|
|
4
4
|
/** Deserialize a markdown file to a MemoryEntry. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_TENANT_ID } from '../util/env.js';
|
|
2
|
-
import { FALLBACK_HALF_LIFE_DAYS, DEFAULT_SCHEMA_FIT } from '
|
|
3
|
-
import { dumpFrontmatter, parseFrontmatter } from '
|
|
2
|
+
import { FALLBACK_HALF_LIFE_DAYS, DEFAULT_SCHEMA_FIT } from './memory.js';
|
|
3
|
+
import { dumpFrontmatter, parseFrontmatter } from '../util/yaml.js';
|
|
4
4
|
/** The fields every mirror file carries; serializeEntry adds the optional ones. */
|
|
5
5
|
function entryFrontmatter(entry) {
|
|
6
6
|
return {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type MemoryEntry } from './memory.js';
|
|
2
|
+
export type AuditSeverity = 'warning' | 'error';
|
|
3
|
+
export interface AuditIssue {
|
|
4
|
+
memoryId: string;
|
|
5
|
+
content: string;
|
|
6
|
+
severity: AuditSeverity;
|
|
7
|
+
reason: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AuditResult {
|
|
10
|
+
total: number;
|
|
11
|
+
issues: AuditIssue[];
|
|
12
|
+
clean: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function auditMemory(entry: MemoryEntry, backsObject?: boolean): AuditIssue | null;
|
|
15
|
+
/** `backing`: ids of memories that back an object (store.memoriesBackingObjects). */
|
|
16
|
+
export declare function auditMemories(entries: MemoryEntry[], backing: ReadonlySet<string>): AuditResult;
|
|
17
|
+
//# sourceMappingURL=memory-audit.d.ts.map
|