hippo-memory 1.43.3 → 1.45.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 +14 -12
- package/bin/hippo.js +3 -1
- package/dist/api.d.ts +21 -21
- package/dist/api.js +69 -42
- package/dist/audit-prune.js +4 -1
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +9 -0
- package/dist/autolearn.d.ts +1 -1
- package/dist/autolearn.js +2 -1
- package/dist/capture.d.ts +11 -10
- package/dist/capture.js +22 -30
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +309 -171
- package/dist/client.d.ts +4 -21
- package/dist/client.js +3 -112
- package/dist/config.js +2 -1
- package/dist/consolidate.d.ts +3 -0
- package/dist/consolidate.js +44 -42
- package/dist/dag.d.ts +1 -0
- package/dist/dag.js +10 -5
- package/dist/dashboard.js +7 -3
- package/dist/db.js +16 -24
- package/dist/dedupe.d.ts +1 -0
- package/dist/dedupe.js +4 -7
- package/dist/embedding-provider.d.ts +1 -1
- package/dist/embedding-provider.js +3 -2
- package/dist/embeddings.js +81 -8
- package/dist/extract.d.ts +2 -0
- package/dist/extract.js +9 -4
- package/dist/goals.js +12 -3
- package/dist/mcp/server.js +21 -36
- package/dist/memory.d.ts +3 -0
- package/dist/memory.js +7 -1
- package/dist/physics-state.js +4 -1
- package/dist/raw-archive.js +5 -2
- package/dist/recall-trace.js +4 -1
- package/dist/refine-llm.js +3 -2
- package/dist/rerankers/jev.js +3 -2
- package/dist/rerankers/llm.js +3 -2
- package/dist/search.js +3 -3
- package/dist/server.d.ts +5 -0
- package/dist/server.js +39 -29
- package/dist/shared.js +1 -1
- package/dist/stdin.d.ts +12 -0
- package/dist/stdin.js +41 -0
- package/dist/store.d.ts +18 -11
- package/dist/store.js +152 -65
- package/dist/version.d.ts +4 -6
- package/dist/version.js +4 -7
- 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 +8 -5
- package/dist/ablation.d.ts.map +0 -1
- package/dist/ablation.js.map +0 -1
- package/dist/ambient.d.ts.map +0 -1
- package/dist/ambient.js.map +0 -1
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js.map +0 -1
- package/dist/audit-prune.d.ts.map +0 -1
- package/dist/audit-prune.js.map +0 -1
- package/dist/audit.d.ts.map +0 -1
- package/dist/audit.js.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/autolearn.d.ts.map +0 -1
- package/dist/autolearn.js.map +0 -1
- package/dist/availability.d.ts.map +0 -1
- package/dist/availability.js.map +0 -1
- package/dist/benchmarks/e1.3/incident-recall-eval.js +0 -78
- package/dist/benchmarks/e1.3/incident-recall-eval.js.map +0 -1
- package/dist/benchmarks/e1.3/slack-1000-event-smoke.js +0 -103
- package/dist/benchmarks/e1.3/slack-1000-event-smoke.js.map +0 -1
- package/dist/capture.d.ts.map +0 -1
- package/dist/capture.js.map +0 -1
- package/dist/card-detail.d.ts.map +0 -1
- package/dist/card-detail.js.map +0 -1
- package/dist/card.d.ts.map +0 -1
- package/dist/card.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/compare.d.ts.map +0 -1
- package/dist/compare.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/connectors/github/backfill.d.ts.map +0 -1
- package/dist/connectors/github/backfill.js.map +0 -1
- package/dist/connectors/github/cli-impl.d.ts.map +0 -1
- package/dist/connectors/github/cli-impl.js.map +0 -1
- package/dist/connectors/github/deletion.d.ts.map +0 -1
- package/dist/connectors/github/deletion.js.map +0 -1
- package/dist/connectors/github/dlq.d.ts.map +0 -1
- package/dist/connectors/github/dlq.js.map +0 -1
- package/dist/connectors/github/idempotency.d.ts.map +0 -1
- package/dist/connectors/github/idempotency.js.map +0 -1
- package/dist/connectors/github/ingest.d.ts.map +0 -1
- package/dist/connectors/github/ingest.js.map +0 -1
- package/dist/connectors/github/octokit-client.d.ts.map +0 -1
- package/dist/connectors/github/octokit-client.js.map +0 -1
- package/dist/connectors/github/ratelimit.d.ts.map +0 -1
- package/dist/connectors/github/ratelimit.js.map +0 -1
- package/dist/connectors/github/scope.d.ts.map +0 -1
- package/dist/connectors/github/scope.js.map +0 -1
- package/dist/connectors/github/signature.d.ts.map +0 -1
- package/dist/connectors/github/signature.js.map +0 -1
- package/dist/connectors/github/tenant-routing.d.ts.map +0 -1
- package/dist/connectors/github/tenant-routing.js.map +0 -1
- package/dist/connectors/github/transform.d.ts.map +0 -1
- package/dist/connectors/github/transform.js.map +0 -1
- package/dist/connectors/github/types.d.ts.map +0 -1
- package/dist/connectors/github/types.js.map +0 -1
- package/dist/connectors/slack/backfill.d.ts.map +0 -1
- package/dist/connectors/slack/backfill.js.map +0 -1
- package/dist/connectors/slack/deletion.d.ts.map +0 -1
- package/dist/connectors/slack/deletion.js.map +0 -1
- package/dist/connectors/slack/dlq.d.ts.map +0 -1
- package/dist/connectors/slack/dlq.js.map +0 -1
- package/dist/connectors/slack/idempotency.d.ts.map +0 -1
- package/dist/connectors/slack/idempotency.js.map +0 -1
- package/dist/connectors/slack/ingest.d.ts.map +0 -1
- package/dist/connectors/slack/ingest.js.map +0 -1
- package/dist/connectors/slack/ratelimit.d.ts.map +0 -1
- package/dist/connectors/slack/ratelimit.js.map +0 -1
- package/dist/connectors/slack/scope.d.ts.map +0 -1
- package/dist/connectors/slack/scope.js.map +0 -1
- package/dist/connectors/slack/signature.d.ts.map +0 -1
- package/dist/connectors/slack/signature.js.map +0 -1
- package/dist/connectors/slack/tenant-routing.d.ts.map +0 -1
- package/dist/connectors/slack/tenant-routing.js.map +0 -1
- package/dist/connectors/slack/transform.d.ts.map +0 -1
- package/dist/connectors/slack/transform.js.map +0 -1
- package/dist/connectors/slack/types.d.ts.map +0 -1
- package/dist/connectors/slack/types.js.map +0 -1
- package/dist/connectors/slack/web-client.d.ts.map +0 -1
- package/dist/connectors/slack/web-client.js.map +0 -1
- package/dist/connectors/slack/workspaces.d.ts.map +0 -1
- package/dist/connectors/slack/workspaces.js.map +0 -1
- package/dist/consolidate.d.ts.map +0 -1
- package/dist/consolidate.js.map +0 -1
- package/dist/correction-latency.d.ts.map +0 -1
- package/dist/correction-latency.js.map +0 -1
- package/dist/customer-notes.d.ts.map +0 -1
- package/dist/customer-notes.js.map +0 -1
- package/dist/dag.d.ts.map +0 -1
- package/dist/dag.js.map +0 -1
- package/dist/dashboard.d.ts.map +0 -1
- package/dist/dashboard.js.map +0 -1
- package/dist/db.d.ts.map +0 -1
- package/dist/db.js.map +0 -1
- package/dist/decisions.d.ts.map +0 -1
- package/dist/decisions.js.map +0 -1
- package/dist/dedupe.d.ts.map +0 -1
- package/dist/dedupe.js.map +0 -1
- package/dist/embedding-provider.d.ts.map +0 -1
- package/dist/embedding-provider.js.map +0 -1
- package/dist/embeddings.d.ts.map +0 -1
- package/dist/embeddings.js.map +0 -1
- package/dist/eval-suite.d.ts.map +0 -1
- package/dist/eval-suite.js.map +0 -1
- package/dist/eval.d.ts.map +0 -1
- package/dist/eval.js.map +0 -1
- package/dist/extensions/openclaw-plugin/index.js.map +0 -1
- package/dist/extract.d.ts.map +0 -1
- package/dist/extract.js.map +0 -1
- package/dist/forward-claim-detector.d.ts.map +0 -1
- package/dist/forward-claim-detector.js.map +0 -1
- package/dist/goals.d.ts.map +0 -1
- package/dist/goals.js.map +0 -1
- package/dist/graph-extract.d.ts.map +0 -1
- package/dist/graph-extract.js.map +0 -1
- package/dist/graph-recall.d.ts.map +0 -1
- package/dist/graph-recall.js.map +0 -1
- package/dist/graph-stream.d.ts.map +0 -1
- package/dist/graph-stream.js.map +0 -1
- package/dist/graph-view.d.ts.map +0 -1
- package/dist/graph-view.js.map +0 -1
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js.map +0 -1
- package/dist/handoff.d.ts.map +0 -1
- package/dist/handoff.js.map +0 -1
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/importers.d.ts.map +0 -1
- package/dist/importers.js.map +0 -1
- package/dist/incidents.d.ts.map +0 -1
- package/dist/incidents.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invalidation.d.ts.map +0 -1
- package/dist/invalidation.js.map +0 -1
- package/dist/mcp/framing.d.ts.map +0 -1
- package/dist/mcp/framing.js.map +0 -1
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js.map +0 -1
- package/dist/memory-value-weights.d.ts.map +0 -1
- package/dist/memory-value-weights.js.map +0 -1
- package/dist/memory-value.d.ts.map +0 -1
- package/dist/memory-value.js.map +0 -1
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/multihop.d.ts.map +0 -1
- package/dist/multihop.js.map +0 -1
- package/dist/owner-validation.d.ts.map +0 -1
- package/dist/owner-validation.js.map +0 -1
- package/dist/path-context.d.ts.map +0 -1
- package/dist/path-context.js.map +0 -1
- package/dist/physics-config.d.ts.map +0 -1
- package/dist/physics-config.js.map +0 -1
- package/dist/physics-state.d.ts.map +0 -1
- package/dist/physics-state.js.map +0 -1
- package/dist/physics.d.ts.map +0 -1
- package/dist/physics.js.map +0 -1
- package/dist/policies.d.ts.map +0 -1
- package/dist/policies.js.map +0 -1
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js.map +0 -1
- package/dist/predictions.d.ts.map +0 -1
- package/dist/predictions.js.map +0 -1
- package/dist/processes.d.ts.map +0 -1
- package/dist/processes.js.map +0 -1
- package/dist/project-briefs.d.ts.map +0 -1
- package/dist/project-briefs.js.map +0 -1
- package/dist/project-identity.d.ts.map +0 -1
- package/dist/project-identity.js.map +0 -1
- package/dist/provenance-coverage.d.ts.map +0 -1
- package/dist/provenance-coverage.js.map +0 -1
- package/dist/rate-limit.d.ts.map +0 -1
- package/dist/rate-limit.js.map +0 -1
- package/dist/raw-archive-mirror-cleanup.d.ts.map +0 -1
- package/dist/raw-archive-mirror-cleanup.js.map +0 -1
- package/dist/raw-archive.d.ts.map +0 -1
- package/dist/raw-archive.js.map +0 -1
- package/dist/recall-history.d.ts.map +0 -1
- package/dist/recall-history.js.map +0 -1
- package/dist/recall-scope.d.ts.map +0 -1
- package/dist/recall-scope.js.map +0 -1
- package/dist/recall-trace.d.ts.map +0 -1
- package/dist/recall-trace.js.map +0 -1
- package/dist/refine-llm.d.ts.map +0 -1
- package/dist/refine-llm.js.map +0 -1
- package/dist/reject-flow.d.ts.map +0 -1
- package/dist/reject-flow.js.map +0 -1
- package/dist/rejection.d.ts.map +0 -1
- package/dist/rejection.js.map +0 -1
- package/dist/replay.d.ts.map +0 -1
- package/dist/replay.js.map +0 -1
- package/dist/rerankers/cross-encoder.d.ts.map +0 -1
- package/dist/rerankers/cross-encoder.js.map +0 -1
- package/dist/rerankers/index.d.ts.map +0 -1
- package/dist/rerankers/index.js.map +0 -1
- package/dist/rerankers/jev.d.ts.map +0 -1
- package/dist/rerankers/jev.js.map +0 -1
- package/dist/rerankers/llm.d.ts.map +0 -1
- package/dist/rerankers/llm.js.map +0 -1
- package/dist/rerankers/types.d.ts.map +0 -1
- package/dist/rerankers/types.js.map +0 -1
- package/dist/rrf.d.ts.map +0 -1
- package/dist/rrf.js.map +0 -1
- package/dist/salience.d.ts.map +0 -1
- package/dist/salience.js.map +0 -1
- package/dist/scheduler.d.ts.map +0 -1
- package/dist/scheduler.js.map +0 -1
- package/dist/scope.d.ts.map +0 -1
- package/dist/scope.js.map +0 -1
- package/dist/search.d.ts.map +0 -1
- package/dist/search.js.map +0 -1
- package/dist/secret-detect.d.ts.map +0 -1
- package/dist/secret-detect.js.map +0 -1
- package/dist/server-detect.d.ts.map +0 -1
- package/dist/server-detect.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/shared.d.ts.map +0 -1
- package/dist/shared.js.map +0 -1
- package/dist/skills.d.ts.map +0 -1
- package/dist/skills.js.map +0 -1
- package/dist/sleep-redact.d.ts +0 -58
- package/dist/sleep-redact.d.ts.map +0 -1
- package/dist/sleep-redact.js +0 -80
- package/dist/sleep-redact.js.map +0 -1
- package/dist/src/ablation.js +0 -138
- package/dist/src/ablation.js.map +0 -1
- package/dist/src/ambient.js +0 -148
- package/dist/src/ambient.js.map +0 -1
- package/dist/src/api.js +0 -2109
- package/dist/src/api.js.map +0 -1
- package/dist/src/audit-prune.js +0 -106
- package/dist/src/audit-prune.js.map +0 -1
- package/dist/src/audit.js +0 -213
- package/dist/src/audit.js.map +0 -1
- package/dist/src/auth.js +0 -97
- package/dist/src/auth.js.map +0 -1
- package/dist/src/autolearn.js +0 -174
- package/dist/src/autolearn.js.map +0 -1
- package/dist/src/availability.js +0 -94
- package/dist/src/availability.js.map +0 -1
- package/dist/src/capture.js +0 -1354
- package/dist/src/capture.js.map +0 -1
- package/dist/src/card-detail.js +0 -15
- package/dist/src/card-detail.js.map +0 -1
- package/dist/src/card.js +0 -19
- package/dist/src/card.js.map +0 -1
- package/dist/src/cli.js +0 -9328
- package/dist/src/cli.js.map +0 -1
- package/dist/src/client.js +0 -237
- package/dist/src/client.js.map +0 -1
- package/dist/src/compare.js +0 -122
- package/dist/src/compare.js.map +0 -1
- package/dist/src/config.js +0 -135
- package/dist/src/config.js.map +0 -1
- package/dist/src/connectors/github/backfill.js +0 -281
- package/dist/src/connectors/github/backfill.js.map +0 -1
- package/dist/src/connectors/github/cli-impl.js +0 -234
- package/dist/src/connectors/github/cli-impl.js.map +0 -1
- package/dist/src/connectors/github/deletion.js +0 -85
- package/dist/src/connectors/github/deletion.js.map +0 -1
- package/dist/src/connectors/github/dlq.js +0 -190
- package/dist/src/connectors/github/dlq.js.map +0 -1
- package/dist/src/connectors/github/idempotency.js +0 -27
- package/dist/src/connectors/github/idempotency.js.map +0 -1
- package/dist/src/connectors/github/ingest.js +0 -156
- package/dist/src/connectors/github/ingest.js.map +0 -1
- package/dist/src/connectors/github/octokit-client.js +0 -70
- package/dist/src/connectors/github/octokit-client.js.map +0 -1
- package/dist/src/connectors/github/ratelimit.js +0 -31
- package/dist/src/connectors/github/ratelimit.js.map +0 -1
- package/dist/src/connectors/github/scope.js +0 -13
- package/dist/src/connectors/github/scope.js.map +0 -1
- package/dist/src/connectors/github/signature.js +0 -81
- package/dist/src/connectors/github/signature.js.map +0 -1
- package/dist/src/connectors/github/tenant-routing.js +0 -69
- package/dist/src/connectors/github/tenant-routing.js.map +0 -1
- package/dist/src/connectors/github/transform.js +0 -103
- package/dist/src/connectors/github/transform.js.map +0 -1
- package/dist/src/connectors/github/types.js +0 -100
- package/dist/src/connectors/github/types.js.map +0 -1
- package/dist/src/connectors/slack/backfill.js +0 -78
- package/dist/src/connectors/slack/backfill.js.map +0 -1
- package/dist/src/connectors/slack/deletion.js +0 -59
- package/dist/src/connectors/slack/deletion.js.map +0 -1
- package/dist/src/connectors/slack/dlq.js +0 -224
- package/dist/src/connectors/slack/dlq.js.map +0 -1
- package/dist/src/connectors/slack/idempotency.js +0 -31
- package/dist/src/connectors/slack/idempotency.js.map +0 -1
- package/dist/src/connectors/slack/ingest.js +0 -109
- package/dist/src/connectors/slack/ingest.js.map +0 -1
- package/dist/src/connectors/slack/ratelimit.js +0 -18
- package/dist/src/connectors/slack/ratelimit.js.map +0 -1
- package/dist/src/connectors/slack/scope.js +0 -13
- package/dist/src/connectors/slack/scope.js.map +0 -1
- package/dist/src/connectors/slack/signature.js +0 -27
- package/dist/src/connectors/slack/signature.js.map +0 -1
- package/dist/src/connectors/slack/tenant-routing.js +0 -41
- package/dist/src/connectors/slack/tenant-routing.js.map +0 -1
- package/dist/src/connectors/slack/transform.js +0 -47
- package/dist/src/connectors/slack/transform.js.map +0 -1
- package/dist/src/connectors/slack/types.js +0 -35
- package/dist/src/connectors/slack/types.js.map +0 -1
- package/dist/src/connectors/slack/web-client.js +0 -43
- package/dist/src/connectors/slack/web-client.js.map +0 -1
- package/dist/src/connectors/slack/workspaces.js +0 -62
- package/dist/src/connectors/slack/workspaces.js.map +0 -1
- package/dist/src/consolidate.js +0 -978
- package/dist/src/consolidate.js.map +0 -1
- package/dist/src/correction-latency.js +0 -74
- package/dist/src/correction-latency.js.map +0 -1
- package/dist/src/customer-notes.js +0 -325
- package/dist/src/customer-notes.js.map +0 -1
- package/dist/src/dag.js +0 -352
- package/dist/src/dag.js.map +0 -1
- package/dist/src/dashboard.js +0 -258
- package/dist/src/dashboard.js.map +0 -1
- package/dist/src/db.js +0 -2728
- package/dist/src/db.js.map +0 -1
- package/dist/src/decisions.js +0 -304
- package/dist/src/decisions.js.map +0 -1
- package/dist/src/dedupe.js +0 -141
- package/dist/src/dedupe.js.map +0 -1
- package/dist/src/embedding-provider.js +0 -314
- package/dist/src/embedding-provider.js.map +0 -1
- package/dist/src/embeddings.js +0 -543
- package/dist/src/embeddings.js.map +0 -1
- package/dist/src/eval-suite.js +0 -294
- package/dist/src/eval-suite.js.map +0 -1
- package/dist/src/eval.js +0 -187
- package/dist/src/eval.js.map +0 -1
- package/dist/src/extract.js +0 -117
- package/dist/src/extract.js.map +0 -1
- package/dist/src/forward-claim-detector.js +0 -117
- package/dist/src/forward-claim-detector.js.map +0 -1
- package/dist/src/goals.js +0 -390
- package/dist/src/goals.js.map +0 -1
- package/dist/src/graph-extract.js +0 -314
- package/dist/src/graph-extract.js.map +0 -1
- package/dist/src/graph-recall.js +0 -277
- package/dist/src/graph-recall.js.map +0 -1
- package/dist/src/graph-stream.js +0 -176
- package/dist/src/graph-stream.js.map +0 -1
- package/dist/src/graph-view.js +0 -310
- package/dist/src/graph-view.js.map +0 -1
- package/dist/src/graph.js +0 -762
- package/dist/src/graph.js.map +0 -1
- package/dist/src/handoff.js +0 -65
- package/dist/src/handoff.js.map +0 -1
- package/dist/src/hooks.js +0 -926
- package/dist/src/hooks.js.map +0 -1
- package/dist/src/importers.js +0 -881
- package/dist/src/importers.js.map +0 -1
- package/dist/src/incidents.js +0 -336
- package/dist/src/incidents.js.map +0 -1
- package/dist/src/index.js +0 -32
- package/dist/src/index.js.map +0 -1
- package/dist/src/invalidation.js +0 -129
- package/dist/src/invalidation.js.map +0 -1
- package/dist/src/mcp/framing.js +0 -45
- package/dist/src/mcp/framing.js.map +0 -1
- package/dist/src/mcp/server.js +0 -1298
- package/dist/src/mcp/server.js.map +0 -1
- package/dist/src/memory-value-weights.js +0 -31
- package/dist/src/memory-value-weights.js.map +0 -1
- package/dist/src/memory-value.js +0 -261
- package/dist/src/memory-value.js.map +0 -1
- package/dist/src/memory.js +0 -425
- package/dist/src/memory.js.map +0 -1
- package/dist/src/multihop.js +0 -35
- package/dist/src/multihop.js.map +0 -1
- package/dist/src/owner-validation.js +0 -56
- package/dist/src/owner-validation.js.map +0 -1
- package/dist/src/path-context.js +0 -48
- package/dist/src/path-context.js.map +0 -1
- package/dist/src/physics-config.js +0 -26
- package/dist/src/physics-config.js.map +0 -1
- package/dist/src/physics-state.js +0 -169
- package/dist/src/physics-state.js.map +0 -1
- package/dist/src/physics.js +0 -378
- package/dist/src/physics.js.map +0 -1
- package/dist/src/policies.js +0 -414
- package/dist/src/policies.js.map +0 -1
- package/dist/src/postinstall.js +0 -101
- package/dist/src/postinstall.js.map +0 -1
- package/dist/src/predictions.js +0 -629
- package/dist/src/predictions.js.map +0 -1
- package/dist/src/processes.js +0 -349
- package/dist/src/processes.js.map +0 -1
- package/dist/src/project-briefs.js +0 -492
- package/dist/src/project-briefs.js.map +0 -1
- package/dist/src/project-identity.js +0 -200
- package/dist/src/project-identity.js.map +0 -1
- package/dist/src/provenance-coverage.js +0 -23
- package/dist/src/provenance-coverage.js.map +0 -1
- package/dist/src/rate-limit.js +0 -60
- package/dist/src/rate-limit.js.map +0 -1
- package/dist/src/raw-archive-mirror-cleanup.js +0 -55
- package/dist/src/raw-archive-mirror-cleanup.js.map +0 -1
- package/dist/src/raw-archive.js +0 -88
- package/dist/src/raw-archive.js.map +0 -1
- package/dist/src/recall-history.js +0 -235
- package/dist/src/recall-history.js.map +0 -1
- package/dist/src/recall-scope.js +0 -89
- package/dist/src/recall-scope.js.map +0 -1
- package/dist/src/recall-trace.js +0 -183
- package/dist/src/recall-trace.js.map +0 -1
- package/dist/src/refine-llm.js +0 -156
- package/dist/src/refine-llm.js.map +0 -1
- package/dist/src/reject-flow.js +0 -209
- package/dist/src/reject-flow.js.map +0 -1
- package/dist/src/rejection.js +0 -160
- package/dist/src/rejection.js.map +0 -1
- package/dist/src/replay.js +0 -122
- package/dist/src/replay.js.map +0 -1
- package/dist/src/rerankers/cross-encoder.js +0 -137
- package/dist/src/rerankers/cross-encoder.js.map +0 -1
- package/dist/src/rerankers/index.js +0 -20
- package/dist/src/rerankers/index.js.map +0 -1
- package/dist/src/rerankers/jev.js +0 -119
- package/dist/src/rerankers/jev.js.map +0 -1
- package/dist/src/rerankers/llm.js +0 -80
- package/dist/src/rerankers/llm.js.map +0 -1
- package/dist/src/rerankers/types.js +0 -2
- package/dist/src/rerankers/types.js.map +0 -1
- package/dist/src/rrf.js +0 -61
- package/dist/src/rrf.js.map +0 -1
- package/dist/src/salience.js +0 -74
- package/dist/src/salience.js.map +0 -1
- package/dist/src/scheduler.js +0 -77
- package/dist/src/scheduler.js.map +0 -1
- package/dist/src/scope.js +0 -35
- package/dist/src/scope.js.map +0 -1
- package/dist/src/search.js +0 -1003
- package/dist/src/search.js.map +0 -1
- package/dist/src/secret-detect.js +0 -95
- package/dist/src/secret-detect.js.map +0 -1
- package/dist/src/server-detect.js +0 -231
- package/dist/src/server-detect.js.map +0 -1
- package/dist/src/server.js +0 -3255
- package/dist/src/server.js.map +0 -1
- package/dist/src/shared.js +0 -502
- package/dist/src/shared.js.map +0 -1
- package/dist/src/skills.js +0 -346
- package/dist/src/skills.js.map +0 -1
- package/dist/src/sleep-redact.js +0 -80
- package/dist/src/sleep-redact.js.map +0 -1
- package/dist/src/sso.js +0 -22
- package/dist/src/sso.js.map +0 -1
- package/dist/src/store.js +0 -3743
- package/dist/src/store.js.map +0 -1
- package/dist/src/tenant.js +0 -17
- package/dist/src/tenant.js.map +0 -1
- package/dist/src/trace.js +0 -72
- package/dist/src/trace.js.map +0 -1
- package/dist/src/version.js +0 -40
- package/dist/src/version.js.map +0 -1
- package/dist/src/working-memory.js +0 -157
- package/dist/src/working-memory.js.map +0 -1
- package/dist/src/yaml.js +0 -107
- package/dist/src/yaml.js.map +0 -1
- package/dist/sso.d.ts +0 -13
- package/dist/sso.d.ts.map +0 -1
- package/dist/sso.js +0 -22
- package/dist/sso.js.map +0 -1
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/tenant.d.ts.map +0 -1
- package/dist/tenant.js.map +0 -1
- package/dist/trace.d.ts.map +0 -1
- package/dist/trace.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/working-memory.d.ts.map +0 -1
- package/dist/working-memory.js.map +0 -1
- package/dist/yaml.d.ts.map +0 -1
- package/dist/yaml.js.map +0 -1
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E3.1 deterministic entity extraction (first slice)
|
|
3
|
-
* (docs/plans/2026-06-01-e3-deterministic-extraction.md).
|
|
4
|
-
*
|
|
5
|
-
* Populates the E3 graph from the already-structured consolidated E2-object tables -
|
|
6
|
-
* NO NLP, no precision gate for entities + supersedes. The graph is a pure derived
|
|
7
|
-
* function of the current E2 state, so `extractGraph` is an idempotent REBUILD: clear
|
|
8
|
-
* the tenant's graph, then re-derive entities + `supersedes` relations from decisions /
|
|
9
|
-
* policies / customer_notes / project_briefs (the four E2 types whose kind maps to the
|
|
10
|
-
* `entity_type` enum). All writes go through the src/graph.ts consolidated-source guard
|
|
11
|
-
* (insertEntity / insertRelation / clearGraph); this module issues no raw SQL.
|
|
12
|
-
*
|
|
13
|
-
* Pass 3 (E3 cross-object, docs/plans/2026-06-02-e3-cross-object-references.md) adds the
|
|
14
|
-
* first CROSS-OBJECT relations: a deterministic NAME-MATCH heuristic that emits a
|
|
15
|
-
* `references` edge when one consolidated object's text contains another entity's name.
|
|
16
|
-
* It is conservative (word-boundary, length-bounded, ambiguity-guarded, per-source
|
|
17
|
-
* capped); its precision is measured + reported, not assumed.
|
|
18
|
-
*
|
|
19
|
-
* Deferred (follow-ups): NLP prose-extraction (semantic depends-on / blocked-by / owns);
|
|
20
|
-
* skill/incident/process entities (not in the entity_type enum - needs a migration); the
|
|
21
|
-
* `hippo sleep` enqueue-hook.
|
|
22
|
-
*/
|
|
23
|
-
import { clearGraph, insertEntity, insertRelation, runGraphRebuildTransaction, MAX_ENTITY_NAME_LEN } from './graph.js';
|
|
24
|
-
import { loadDecisions } from './decisions.js';
|
|
25
|
-
import { loadPolicies } from './policies.js';
|
|
26
|
-
import { loadCustomerNotes } from './customer-notes.js';
|
|
27
|
-
import { loadProjectBriefs } from './project-briefs.js';
|
|
28
|
-
import { assertTenantId } from './store.js';
|
|
29
|
-
/** Per-type load cap (the loaders default to 100). A type whose active or superseded
|
|
30
|
-
* set exceeds this is truncated; `ExtractResult.truncated` records it so the
|
|
31
|
-
* incompleteness is observable rather than silent. */
|
|
32
|
-
export const MAX_EXTRACT_PER_TYPE = 10000;
|
|
33
|
-
// --- Pass 3 (cross-object references) tunables ------------------------------------
|
|
34
|
-
/** A target entity name must be in [MIN, MAX] chars to be matched: MIN skips short /
|
|
35
|
-
* generic words; MAX skips prose (a decision's prose name is never a target, only a
|
|
36
|
-
* source). */
|
|
37
|
-
export const MIN_REF_NAME_LEN = 4;
|
|
38
|
-
export const MAX_REF_NAME_LEN = 80;
|
|
39
|
-
/** Per-source cap so one object cannot explode the graph with references edges. */
|
|
40
|
-
export const MAX_REFERENCES_PER_OBJECT = 25;
|
|
41
|
-
/** Regex-size bound: at most this many distinct target names enter the combined
|
|
42
|
-
* alternation, keeping the scan regex sane on a huge store. */
|
|
43
|
-
export const MAX_TARGET_NAMES = 5000;
|
|
44
|
-
/** Stable map key: entity types share an id space across tables, so key by both. */
|
|
45
|
-
function keyOf(entityType, e2Id) {
|
|
46
|
-
return `${entityType}:${e2Id}`;
|
|
47
|
-
}
|
|
48
|
-
/** The four E2-derived extraction entity types map 1:1 to source_object_type; the other
|
|
49
|
-
* two EntityType members ('person', 'system') have no E2 table and stay unmapped. */
|
|
50
|
-
const ENTITY_TYPE_TO_SOURCE_OBJECT = {
|
|
51
|
-
decision: 'decision',
|
|
52
|
-
policy: 'policy',
|
|
53
|
-
customer: 'customer',
|
|
54
|
-
project: 'project',
|
|
55
|
-
person: undefined,
|
|
56
|
-
system: undefined,
|
|
57
|
-
};
|
|
58
|
-
/** The E2 source-object ref for an extraction row (always set: every extracted row is an
|
|
59
|
-
* E2 object). Throws on an unmappable entityType (a graph invariant violation). */
|
|
60
|
-
function sourceObjectOf(entityType, e2Id) {
|
|
61
|
-
const type = ENTITY_TYPE_TO_SOURCE_OBJECT[entityType];
|
|
62
|
-
if (!type)
|
|
63
|
-
throw new Error(`graph-extract: entityType '${entityType}' has no source_object_type mapping`);
|
|
64
|
-
return { type, id: e2Id };
|
|
65
|
-
}
|
|
66
|
-
/** Escape a string for safe use as a literal inside a RegExp alternation. */
|
|
67
|
-
function escapeRegex(s) {
|
|
68
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
69
|
-
}
|
|
70
|
-
/** Unordered entity-id pair key, so a relation between a,b is found in either direction. */
|
|
71
|
-
function pairKey(a, b) {
|
|
72
|
-
return a < b ? `${a}:${b}` : `${b}:${a}`;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Load a type's ACTIVE + SUPERSEDED rows (excluding `closed` = retired), normalised.
|
|
76
|
-
* Calls the loader once per status so MAX_EXTRACT_PER_TYPE is a per-status budget
|
|
77
|
-
* (closed rows never consume it). Sets `hitCap` when either status load is full.
|
|
78
|
-
*/
|
|
79
|
-
function loadType(hippoRoot, tenantId, entityType,
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
-
loadFn,
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
-
nameOf,
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
textOf) {
|
|
86
|
-
const rows = [];
|
|
87
|
-
let hitCap = false;
|
|
88
|
-
for (const status of ['active', 'superseded']) {
|
|
89
|
-
const loaded = loadFn(hippoRoot, tenantId, { status, limit: MAX_EXTRACT_PER_TYPE });
|
|
90
|
-
if (loaded.length === MAX_EXTRACT_PER_TYPE)
|
|
91
|
-
hitCap = true;
|
|
92
|
-
for (const r of loaded) {
|
|
93
|
-
// SAFETY: loadFn is always one of loadDecisions/loadPolicies/loadCustomerNotes/
|
|
94
|
-
// loadProjectBriefs (wired at each extractGraph call site); every one of their row
|
|
95
|
-
// types declares id: number, memoryId: string | null, supersededBy: number | null.
|
|
96
|
-
// `any` here is the deliberate type-erasure boundary (see eslint-disable above)
|
|
97
|
-
// that lets one loop handle all four E2 row shapes.
|
|
98
|
-
rows.push({
|
|
99
|
-
entityType,
|
|
100
|
-
e2Id: r.id,
|
|
101
|
-
name: nameOf(r),
|
|
102
|
-
searchText: textOf(r),
|
|
103
|
-
memoryId: (r.memoryId ?? null),
|
|
104
|
-
supersededBy: (r.supersededBy ?? null),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return { rows, hitCap };
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Idempotent rebuild of the tenant's deterministic graph from its consolidated E2
|
|
112
|
-
* objects. Returns the entity/relation counts (+ which types were truncated at the
|
|
113
|
-
* per-type cap). Safe to re-run: output is a pure function of the current E2 state.
|
|
114
|
-
*/
|
|
115
|
-
export function extractGraph(hippoRoot, tenantId) {
|
|
116
|
-
assertTenantId('extractGraph', tenantId);
|
|
117
|
-
const sources = [
|
|
118
|
-
{ entityType: 'decision', loadFn: loadDecisions, nameOf: (r) => r.decisionText, textOf: (r) => [r.decisionText, r.context].filter(Boolean).join(' ') },
|
|
119
|
-
{ entityType: 'policy', loadFn: loadPolicies, nameOf: (r) => r.policyName, textOf: (r) => [r.policyName, r.policyText].filter(Boolean).join(' ') },
|
|
120
|
-
{ entityType: 'customer', loadFn: loadCustomerNotes, nameOf: (r) => r.customer, textOf: (r) => [r.customer, r.note].filter(Boolean).join(' ') },
|
|
121
|
-
{ entityType: 'project', loadFn: loadProjectBriefs, nameOf: (r) => r.repo, textOf: (r) => [r.repo, r.summary].filter(Boolean).join(' ') },
|
|
122
|
-
];
|
|
123
|
-
// READ PHASE: load every source's rows on their own connections BEFORE the
|
|
124
|
-
// write transaction. Holding the rebuild's BEGIN IMMEDIATE write lock while
|
|
125
|
-
// opening a second connection for these reads dead-locks ('database is
|
|
126
|
-
// locked'); preloading keeps the transaction single-connection.
|
|
127
|
-
const loaded = sources.map((src) => {
|
|
128
|
-
const { rows, hitCap } = loadType(hippoRoot, tenantId, src.entityType, src.loadFn, src.nameOf, src.textOf);
|
|
129
|
-
return { entityType: src.entityType, rows, hitCap };
|
|
130
|
-
});
|
|
131
|
-
// WRITE PHASE (codex P2): clear + every insert run in ONE transaction, so two
|
|
132
|
-
// concurrent rebuilds serialize on the SQLite write lock (no duplicate rows)
|
|
133
|
-
// and a throw mid-rebuild rolls back the clear (no bricked graph). No second
|
|
134
|
-
// connection is opened inside.
|
|
135
|
-
return runGraphRebuildTransaction(hippoRoot, tenantId, (txDb) => rebuildGraphRows(txDb, hippoRoot, tenantId, loaded));
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* The deterministic rebuild WRITES, run inside `runGraphRebuildTransaction`'s
|
|
139
|
-
* transaction (`txDb` is its connection). Clears the tenant's graph then
|
|
140
|
-
* re-derives entities + `supersedes` + `references` from the preloaded rows. All
|
|
141
|
-
* DB access here is on `txDb` (or in-memory) — no other connection is opened.
|
|
142
|
-
*/
|
|
143
|
-
function rebuildGraphRows(txDb, hippoRoot, tenantId, loaded) {
|
|
144
|
-
// Rebuild from scratch: the graph is derived, so clear then re-derive.
|
|
145
|
-
clearGraph(hippoRoot, tenantId, txDb);
|
|
146
|
-
const byType = {};
|
|
147
|
-
const truncated = [];
|
|
148
|
-
const allRows = [];
|
|
149
|
-
const entityIdByKey = new Map();
|
|
150
|
-
// The mirror memory per extracted key, null once forgotten/pruned (so a supersedes
|
|
151
|
-
// edge anchors to the successor's object when the mirror is gone but still passes the
|
|
152
|
-
// memory through when it lives).
|
|
153
|
-
const memoryIdByKey = new Map();
|
|
154
|
-
// Created entities ONLY (drives Pass 3 sources + targets), in stable insertion order.
|
|
155
|
-
const created = [];
|
|
156
|
-
// Pass 1: entities. Every ACTIVE/SUPERSEDED E2 row becomes an entity ANCHORED to its
|
|
157
|
-
// authoritative E2 object (source_object_type/id) - it survives a forgotten mirror
|
|
158
|
-
// (memory_id NULL). The mirror memory is passed through only when it still exists
|
|
159
|
-
// (it remains a recall pointer until forgotten/pruned).
|
|
160
|
-
for (const { entityType, rows, hitCap } of loaded) {
|
|
161
|
-
if (hitCap)
|
|
162
|
-
truncated.push(entityType);
|
|
163
|
-
byType[entityType] = 0;
|
|
164
|
-
for (const row of rows) {
|
|
165
|
-
allRows.push(row);
|
|
166
|
-
// Normalise the label so a long/odd-but-valid E2 name can never throw in
|
|
167
|
-
// insertEntity and (because clearGraph already ran) brick the rebuild
|
|
168
|
-
// unrebuildably. E2 name fields (decisionText / policyName) are UNCAPPED at
|
|
169
|
-
// source, and insertEntity REJECTS (not truncates) both an over-cap name AND an
|
|
170
|
-
// empty one. So: TRIM FIRST (codex 2026-06-01: >512 leading-whitespace chars
|
|
171
|
-
// would otherwise slice to a whitespace-only string -> trimmed to '' ->
|
|
172
|
-
// 'name is required' throw), THEN cap to MAX_ENTITY_NAME_LEN; if the normalised
|
|
173
|
-
// label is empty (the E2 save APIs forbid this, but be defensive) skip the row
|
|
174
|
-
// rather than throw. This closes the entire name-brick class.
|
|
175
|
-
const name = (row.name ?? '').trim().slice(0, MAX_ENTITY_NAME_LEN);
|
|
176
|
-
if (name.length === 0)
|
|
177
|
-
continue;
|
|
178
|
-
const sourceObject = sourceObjectOf(row.entityType, row.e2Id);
|
|
179
|
-
const entity = insertEntity(hippoRoot, tenantId, {
|
|
180
|
-
entityType: row.entityType,
|
|
181
|
-
name,
|
|
182
|
-
memoryId: row.memoryId,
|
|
183
|
-
sourceObject,
|
|
184
|
-
}, txDb);
|
|
185
|
-
const k = keyOf(row.entityType, row.e2Id);
|
|
186
|
-
entityIdByKey.set(k, entity.id);
|
|
187
|
-
memoryIdByKey.set(k, row.memoryId);
|
|
188
|
-
created.push({ entityId: entity.id, entityType: row.entityType, memoryId: row.memoryId, sourceObject, name, searchText: row.searchText ?? '', superseded: row.supersededBy !== null });
|
|
189
|
-
byType[entityType] += 1;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// Pass 2: `supersedes` relations. For X superseded by Y (Y is the successor), emit
|
|
193
|
-
// "Y supersedes X" - but only when BOTH X and Y were EXTRACTED (e.g. Y may be closed
|
|
194
|
-
// and absent). The emit guard is ENTITY presence (entityIdByKey), not memory presence:
|
|
195
|
-
// a forgotten successor mirror must still emit the edge. The relation is anchored to Y's
|
|
196
|
-
// authoritative E2 object; Y's mirror memory is passed only when it still lives.
|
|
197
|
-
let relations = 0;
|
|
198
|
-
// Entity-id pairs already related by supersedes (unordered). Pass 3 skips a references
|
|
199
|
-
// edge for such a pair: a version-extends-its-predecessor's-name containment (e.g.
|
|
200
|
-
// "Adopt X (managed)" contains "Adopt X") is a name artifact, not a cross-reference,
|
|
201
|
-
// and supersedes already captures their relationship.
|
|
202
|
-
const supersededPairs = new Set();
|
|
203
|
-
for (const row of allRows) {
|
|
204
|
-
if (row.supersededBy === null)
|
|
205
|
-
continue;
|
|
206
|
-
const xKey = keyOf(row.entityType, row.e2Id);
|
|
207
|
-
const yKey = keyOf(row.entityType, row.supersededBy);
|
|
208
|
-
const fromId = entityIdByKey.get(yKey); // successor Y
|
|
209
|
-
const toId = entityIdByKey.get(xKey); // superseded X
|
|
210
|
-
if (fromId === undefined || toId === undefined)
|
|
211
|
-
continue;
|
|
212
|
-
const yMemoryId = memoryIdByKey.get(yKey) ?? null; // successor's mirror, null if gone
|
|
213
|
-
insertRelation(hippoRoot, tenantId, {
|
|
214
|
-
fromEntityId: fromId,
|
|
215
|
-
toEntityId: toId,
|
|
216
|
-
relType: 'supersedes',
|
|
217
|
-
memoryId: yMemoryId,
|
|
218
|
-
sourceObject: sourceObjectOf(row.entityType, row.supersededBy), // successor Y's object
|
|
219
|
-
}, txDb);
|
|
220
|
-
supersededPairs.add(pairKey(fromId, toId));
|
|
221
|
-
relations += 1;
|
|
222
|
-
}
|
|
223
|
-
// Pass 3: cross-object `references` edges via conservative name matching. A source's
|
|
224
|
-
// text containing a target entity's name -> "source references target". Sources +
|
|
225
|
-
// targets are CREATED entities only, each anchored to its E2 source object (so the
|
|
226
|
-
// edge survives a forgotten source mirror).
|
|
227
|
-
const references = extractReferences(hippoRoot, tenantId, created, supersededPairs, truncated, txDb);
|
|
228
|
-
relations += references;
|
|
229
|
-
const entities = created.length;
|
|
230
|
-
return { entities, relations, references, byType, truncated };
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Pass 3. Build a target-name index from the created entities (names within the length
|
|
234
|
-
* bounds, ambiguous names dropped), scan each created entity's text once with one
|
|
235
|
-
* combined word-boundary regex, and emit `references` edges (self-skipped, deduped,
|
|
236
|
-
* per-source capped). Each edge is anchored to the source entity's E2 object (memoryId
|
|
237
|
-
* passed through only when the mirror lives). Returns the number of references edges written.
|
|
238
|
-
*/
|
|
239
|
-
function extractReferences(hippoRoot, tenantId, created, supersededPairs, truncated, txDb) {
|
|
240
|
-
// Build the target index: normalised name -> single entity id. A name is a target only
|
|
241
|
-
// if its length is in bounds; a name shared by >1 entity is AMBIGUOUS and dropped.
|
|
242
|
-
const nameToId = new Map();
|
|
243
|
-
const ambiguous = new Set();
|
|
244
|
-
for (const e of created) {
|
|
245
|
-
// References are among ACTIVE entities only: a superseded (outdated) row is not a
|
|
246
|
-
// current cross-reference target (codex).
|
|
247
|
-
if (e.superseded)
|
|
248
|
-
continue;
|
|
249
|
-
// Decisions are SOURCE-only: their name is decision prose, referenced by supersedes,
|
|
250
|
-
// not by name-mention. Excluding them as targets also prevents a decision's own name
|
|
251
|
-
// (== its searchText) from whole-string self-matching and shadowing embedded targets.
|
|
252
|
-
if (e.entityType === 'decision')
|
|
253
|
-
continue;
|
|
254
|
-
const norm = e.name.trim().toLowerCase();
|
|
255
|
-
if (norm.length < MIN_REF_NAME_LEN || norm.length > MAX_REF_NAME_LEN)
|
|
256
|
-
continue;
|
|
257
|
-
if (ambiguous.has(norm))
|
|
258
|
-
continue;
|
|
259
|
-
if (nameToId.has(norm)) {
|
|
260
|
-
// Second distinct entity with this name (and not its own id repeated) -> ambiguous.
|
|
261
|
-
if (nameToId.get(norm) !== e.entityId) {
|
|
262
|
-
nameToId.delete(norm);
|
|
263
|
-
ambiguous.add(norm);
|
|
264
|
-
}
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
nameToId.set(norm, e.entityId);
|
|
268
|
-
}
|
|
269
|
-
if (nameToId.size === 0)
|
|
270
|
-
return 0;
|
|
271
|
-
// Record the truncation (observability, mirroring MAX_EXTRACT_PER_TYPE) so a >cap
|
|
272
|
-
// store's under-matched references are not silent.
|
|
273
|
-
if (nameToId.size > MAX_TARGET_NAMES)
|
|
274
|
-
truncated.push('references-targets');
|
|
275
|
-
// LONGEST name first, then alphabetical: JS regex alternation is leftmost-first, so
|
|
276
|
-
// ordering longer names before their prefixes makes the match longest-at-position
|
|
277
|
-
// (`postgres pro` wins over `postgres`; codex). Deterministic, so truncation is stable.
|
|
278
|
-
const targetNames = [...nameToId.keys()]
|
|
279
|
-
.sort((a, b) => b.length - a.length || (a < b ? -1 : a > b ? 1 : 0))
|
|
280
|
-
.slice(0, MAX_TARGET_NAMES);
|
|
281
|
-
const pattern = `\\b(?:${targetNames.map(escapeRegex).join('|')})\\b`;
|
|
282
|
-
const re = new RegExp(pattern, 'gi');
|
|
283
|
-
let references = 0;
|
|
284
|
-
for (const src of created) {
|
|
285
|
-
if (src.superseded)
|
|
286
|
-
continue; // superseded sources hold only stale references (codex)
|
|
287
|
-
if (!src.searchText)
|
|
288
|
-
continue;
|
|
289
|
-
const targets = new Set();
|
|
290
|
-
for (const m of src.searchText.matchAll(re)) {
|
|
291
|
-
const targetId = nameToId.get(m[0].toLowerCase());
|
|
292
|
-
if (targetId === undefined || targetId === src.entityId)
|
|
293
|
-
continue; // miss / self
|
|
294
|
-
if (supersededPairs.has(pairKey(src.entityId, targetId)))
|
|
295
|
-
continue; // already version-related
|
|
296
|
-
targets.add(targetId);
|
|
297
|
-
if (targets.size >= MAX_REFERENCES_PER_OBJECT)
|
|
298
|
-
break; // per-source cap
|
|
299
|
-
}
|
|
300
|
-
for (const targetId of targets) {
|
|
301
|
-
insertRelation(hippoRoot, tenantId, {
|
|
302
|
-
fromEntityId: src.entityId,
|
|
303
|
-
toEntityId: targetId,
|
|
304
|
-
relType: 'references',
|
|
305
|
-
// Anchored to the source object; its mirror memory is passed only when it lives.
|
|
306
|
-
memoryId: src.memoryId,
|
|
307
|
-
sourceObject: src.sourceObject,
|
|
308
|
-
}, txDb);
|
|
309
|
-
references += 1;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return references;
|
|
313
|
-
}
|
|
314
|
-
//# sourceMappingURL=graph-extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-extract.js","sourceRoot":"","sources":["../../src/graph-extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,0BAA0B,EAAE,mBAAmB,EAAgF,MAAM,YAAY,CAAC;AACrM,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB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C;AACpB,CAAC"}
|
package/dist/src/graph-recall.js
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E3.2 multi-hop graph recall (docs/plans/2026-06-02-e3.2-multihop-recall.md).
|
|
3
|
-
*
|
|
4
|
-
* READ-ONLY consumer of the E3 graph substrate (entities/relations built by E3.1,
|
|
5
|
-
* guarded by E3.3). Given the lexical recall seeds, walk the relations graph up to N
|
|
6
|
-
* hops and surface the memories of reached entities that the lexical search did not
|
|
7
|
-
* already return.
|
|
8
|
-
*
|
|
9
|
-
* Relation-type-AGNOSTIC: it walks whatever edges exist. Today the graph holds only
|
|
10
|
-
* `supersedes` edges (so a 1-hop walk surfaces a supersession-linked predecessor/
|
|
11
|
-
* successor a lexical search may miss); the moment E3.1 emits cross-object edges
|
|
12
|
-
* (owns/depends-on/blocked-by/references) the SAME traversal lights up cross-entity
|
|
13
|
-
* multi-hop with zero rework here.
|
|
14
|
-
*
|
|
15
|
-
* Design points (the first two were forced by the verify-stage benchmark, the rest by
|
|
16
|
-
* codex review — all root-cause, not patches):
|
|
17
|
-
* 1. Graph-reached memories are loaded DIRECTLY by id (tenant-scoped PK fetch), NOT
|
|
18
|
-
* intersected with the recall handler's candidate set — that set is lexically
|
|
19
|
-
* prefiltered (loadSearchRows filters by query tokens), so intersecting would exclude
|
|
20
|
-
* exactly the lexically-orthogonal neighbours graph recall exists to surface. We
|
|
21
|
-
* re-apply the recall HARD filters to the directly-loaded rows: the FULL bi-temporal
|
|
22
|
-
* as-of rule (valid_from <= asOf AND, for a superseded row, successor.valid_from >
|
|
23
|
-
* asOf — same as cmdRecall) and the default superseded-drop. SCOPE is intentionally
|
|
24
|
-
* NOT re-applied: the CLI caller (cmdRecall) does not hard-filter scope either (it
|
|
25
|
-
* only soft-boosts it). Rows are tenant-scoped + archived-excluded (loadEntriesByIds).
|
|
26
|
-
* 2. A graph hit inherits its origin seed's relevance (minus a per-hop discount) and is
|
|
27
|
-
* placed adjacent to that seed; budget selection is by score so a high-value hit wins
|
|
28
|
-
* a token slot over a noise distractor. Dead-last appending made the feature do
|
|
29
|
-
* nothing at realistic budgets.
|
|
30
|
-
* 3. BOTH the local and global stores are expanded — a global seed's entities/relations
|
|
31
|
-
* live under the global root, so graph recall must traverse each seed in the store its
|
|
32
|
-
* graph lives in (codex review).
|
|
33
|
-
* 4. By-id loads are chunked at 500 (loadEntriesByIds caps at 500/call), so a high-fanout
|
|
34
|
-
* traversal (--hops 3 --max-neighbors 200 -> up to 600 ids) loses none (codex review).
|
|
35
|
-
*
|
|
36
|
-
* No graph writes (only SELECTs via graph.ts read helpers + store reads), so the E3.3
|
|
37
|
-
* check-graph-writes lint permits this module living outside graph.ts.
|
|
38
|
-
*/
|
|
39
|
-
import { loadEntriesByIds } from './store.js';
|
|
40
|
-
import { estimateTokens } from './search.js';
|
|
41
|
-
import { compareEntryIdentity } from './compare.js';
|
|
42
|
-
import { loadEntitiesByMemoryId, loadEntitiesByIds, loadNeighborRelations, } from './graph.js';
|
|
43
|
-
import { passesCliRecallScopeFilter, passesScopeFilterForRecall } from './recall-scope.js';
|
|
44
|
-
/** Hard cap on `--hops` (a higher value just walks more of a finite graph; this bounds
|
|
45
|
-
* worst-case work and keeps the flag honest). */
|
|
46
|
-
export const MAX_HOPS = 3;
|
|
47
|
-
/** Default per-hop fanout cap (bounds blow-up on a future dense graph). */
|
|
48
|
-
export const DEFAULT_MAX_NEIGHBORS = 25;
|
|
49
|
-
/** Per-hop relevance discount: a graph hit inherits its origin seed's score, scaled down
|
|
50
|
-
* 1% per hop, so it ranks just below its seed and orders by hop-distance. */
|
|
51
|
-
const HOP_DISCOUNT = 0.01;
|
|
52
|
-
/** loadEntriesByIds caps each call at 500 ids; chunk to lose none on high fanout. */
|
|
53
|
-
const LOAD_CHUNK = 500;
|
|
54
|
-
/** Load memories by id in <=500-id chunks (loadEntriesByIds caps each call at 500). */
|
|
55
|
-
function loadByIdsChunked(root, tenantId, ids) {
|
|
56
|
-
if (ids.length === 0)
|
|
57
|
-
return [];
|
|
58
|
-
const out = [];
|
|
59
|
-
for (let i = 0; i < ids.length; i += LOAD_CHUNK) {
|
|
60
|
-
out.push(...loadEntriesByIds(root, ids.slice(i, i + LOAD_CHUNK), tenantId));
|
|
61
|
-
}
|
|
62
|
-
return out;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Traverse one store's graph from the seeds present in it and accumulate new graph hits
|
|
66
|
-
* into `hitsByOrigin`. Mutates `seenMemoryIds` so a memory is surfaced at most once across
|
|
67
|
-
* stores. Pure reads.
|
|
68
|
-
*/
|
|
69
|
-
function produceHitsForRoot(root, baseResults, baseScoreByMemId, seenMemoryIds, hitsByOrigin, opts) {
|
|
70
|
-
const { hops, maxNeighbors, tenantId, includeSuperseded, asOfDate, recallScope } = opts;
|
|
71
|
-
// Seeds = graph entities (in THIS store) whose source memory is a base result.
|
|
72
|
-
const seedEntities = loadEntitiesByMemoryId(root, tenantId, baseResults.map((r) => r.entry.id));
|
|
73
|
-
if (seedEntities.length === 0)
|
|
74
|
-
return;
|
|
75
|
-
// BFS, both directions, up to `hops`. `visited` prevents re-expansion (cycle-safe).
|
|
76
|
-
// `originMemByEntityId` propagates the base-result memory id each reached node descends
|
|
77
|
-
// from (for adjacency placement + score inheritance).
|
|
78
|
-
const visitedEntityIds = new Set(seedEntities.map((e) => e.id));
|
|
79
|
-
const reached = new Map();
|
|
80
|
-
// A seed/reached entity whose mirror was forgotten/pruned has a null memoryId; the map
|
|
81
|
-
// tolerates null so traversal still propagates origin, and the null is dropped before
|
|
82
|
-
// any memory load below (a mirror-less node has no memory to surface).
|
|
83
|
-
const originMemByEntityId = new Map();
|
|
84
|
-
for (const se of seedEntities)
|
|
85
|
-
originMemByEntityId.set(se.id, se.memoryId);
|
|
86
|
-
let frontier = seedEntities.map((e) => e.id);
|
|
87
|
-
for (let depth = 1; depth <= hops && frontier.length > 0; depth++) {
|
|
88
|
-
const frontierSet = new Set(frontier);
|
|
89
|
-
const rels = loadNeighborRelations(root, tenantId, frontier, {
|
|
90
|
-
limit: Math.max(maxNeighbors, maxNeighbors * frontier.length),
|
|
91
|
-
});
|
|
92
|
-
const nextFrontier = [];
|
|
93
|
-
for (const rel of rels) {
|
|
94
|
-
const fromIn = frontierSet.has(rel.fromEntityId);
|
|
95
|
-
const toIn = frontierSet.has(rel.toEntityId);
|
|
96
|
-
let neighborId;
|
|
97
|
-
let reacherId;
|
|
98
|
-
let direction;
|
|
99
|
-
if (fromIn && !toIn) {
|
|
100
|
-
neighborId = rel.toEntityId;
|
|
101
|
-
reacherId = rel.fromEntityId;
|
|
102
|
-
direction = 'to';
|
|
103
|
-
}
|
|
104
|
-
else if (toIn && !fromIn) {
|
|
105
|
-
neighborId = rel.fromEntityId;
|
|
106
|
-
reacherId = rel.toEntityId;
|
|
107
|
-
direction = 'from';
|
|
108
|
-
}
|
|
109
|
-
else
|
|
110
|
-
continue;
|
|
111
|
-
if (visitedEntityIds.has(neighborId))
|
|
112
|
-
continue;
|
|
113
|
-
visitedEntityIds.add(neighborId);
|
|
114
|
-
reached.set(neighborId, { hops: depth, relType: rel.relType, direction });
|
|
115
|
-
const origin = originMemByEntityId.get(reacherId);
|
|
116
|
-
if (origin !== undefined)
|
|
117
|
-
originMemByEntityId.set(neighborId, origin);
|
|
118
|
-
nextFrontier.push(neighborId);
|
|
119
|
-
if (nextFrontier.length >= maxNeighbors)
|
|
120
|
-
break; // per-hop fanout cap
|
|
121
|
-
}
|
|
122
|
-
frontier = nextFrontier;
|
|
123
|
-
}
|
|
124
|
-
if (reached.size === 0)
|
|
125
|
-
return;
|
|
126
|
-
// Reached entities -> source memory ids -> load DIRECTLY by id (chunked), not lexical.
|
|
127
|
-
// A mirror-less reached entity (memoryId === null) has no memory to load: drop its null
|
|
128
|
-
// id BEFORE it reaches loadByIdsChunked / the Set<string> (it cannot be recall-surfaced;
|
|
129
|
-
// it stays in entities/relations for graph extract / visualization).
|
|
130
|
-
const reachedEntities = loadEntitiesByIds(root, tenantId, [...reached.keys()]);
|
|
131
|
-
const needLoad = [...new Set(reachedEntities
|
|
132
|
-
.map((e) => e.memoryId)
|
|
133
|
-
.filter((id) => id !== null && !seenMemoryIds.has(id)))];
|
|
134
|
-
const loadedById = new Map(loadByIdsChunked(root, tenantId, needLoad).map((m) => [m.id, m]));
|
|
135
|
-
// For the bi-temporal as-of rule on a superseded reached row we need its successor's
|
|
136
|
-
// valid_from. Batch-load the successors referenced by the loaded rows.
|
|
137
|
-
let successorValidFrom = new Map();
|
|
138
|
-
if (asOfDate) {
|
|
139
|
-
const succIds = [...new Set([...loadedById.values()].map((m) => m.superseded_by).filter((id) => !!id))];
|
|
140
|
-
successorValidFrom = new Map(loadByIdsChunked(root, tenantId, succIds).map((m) => [m.id, m.valid_from]));
|
|
141
|
-
}
|
|
142
|
-
for (const ent of reachedEntities) {
|
|
143
|
-
if (ent.memoryId === null)
|
|
144
|
-
continue; // mirror-less node: not recall-surfaced
|
|
145
|
-
const mem = loadedById.get(ent.memoryId);
|
|
146
|
-
if (!mem)
|
|
147
|
-
continue; // not found / wrong tenant / already in base
|
|
148
|
-
if (seenMemoryIds.has(mem.id))
|
|
149
|
-
continue; // another reached entity already added it
|
|
150
|
-
const via = reached.get(ent.id);
|
|
151
|
-
// A node reached as the `to` endpoint of a `supersedes` edge IS the superseded
|
|
152
|
-
// (older) version — the graph is the authoritative signal (the memory mirror's
|
|
153
|
-
// `superseded_by` is NOT set by `hippo decide`, only the decisions table is). By
|
|
154
|
-
// default recall shows current truth, so drop it unless --include-superseded; the
|
|
155
|
-
// `from` endpoint (the newer successor) is always kept.
|
|
156
|
-
const isSupersededEndpoint = via.relType === 'supersedes' && via.direction === 'to';
|
|
157
|
-
if (asOfDate) {
|
|
158
|
-
if (new Date(mem.valid_from) > asOfDate)
|
|
159
|
-
continue; // not yet valid at asOf
|
|
160
|
-
if (mem.superseded_by) {
|
|
161
|
-
const succVf = successorValidFrom.get(mem.superseded_by);
|
|
162
|
-
// Visible only while its successor was NOT yet valid at asOf (matches cmdRecall).
|
|
163
|
-
if (succVf && new Date(succVf) <= asOfDate)
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else if (!includeSuperseded && (mem.superseded_by || isSupersededEndpoint)) {
|
|
168
|
-
continue; // default recall drops superseded
|
|
169
|
-
}
|
|
170
|
-
const scopeOk = recallScope.additive
|
|
171
|
-
? passesCliRecallScopeFilter(mem.scope ?? null, recallScope.requested)
|
|
172
|
-
: passesScopeFilterForRecall(mem.scope ?? null, recallScope.requested);
|
|
173
|
-
if (!scopeOk)
|
|
174
|
-
continue;
|
|
175
|
-
const origin = originMemByEntityId.get(ent.id) ?? baseResults[0].entry.id;
|
|
176
|
-
const originScore = baseScoreByMemId.get(origin) ?? baseResults[baseResults.length - 1].score;
|
|
177
|
-
seenMemoryIds.add(mem.id);
|
|
178
|
-
const hit = {
|
|
179
|
-
entry: mem,
|
|
180
|
-
score: originScore * (1 - HOP_DISCOUNT * via.hops),
|
|
181
|
-
bm25: 0, cosine: 0,
|
|
182
|
-
tokens: estimateTokens(mem.content),
|
|
183
|
-
graphVia: via,
|
|
184
|
-
};
|
|
185
|
-
if (!hitsByOrigin.has(origin))
|
|
186
|
-
hitsByOrigin.set(origin, []);
|
|
187
|
-
hitsByOrigin.get(origin).push(hit);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Augment `baseResults` with memories reached by walking the graph `hops` edges out from
|
|
192
|
-
* the seed results' entities (across the local AND global stores). Each graph hit is
|
|
193
|
-
* inserted directly after the base result it descends from, scored just below that seed;
|
|
194
|
-
* the base list's own order is preserved. Token-budget-bounded; deduped against the base
|
|
195
|
-
* set and across stores.
|
|
196
|
-
*
|
|
197
|
-
* No-op (returns `baseResults` unchanged) when `hops <= 0`, there are no base results, the
|
|
198
|
-
* graph is empty, no seed maps to an entity, or nothing new survives the filters/budget.
|
|
199
|
-
*/
|
|
200
|
-
export function graphExpandRecall(baseResults, opts) {
|
|
201
|
-
const { hops, hippoRoot, globalRoot, tenantId } = opts;
|
|
202
|
-
if (hops <= 0 || baseResults.length === 0)
|
|
203
|
-
return baseResults;
|
|
204
|
-
const maxNeighbors = opts.maxNeighbors ?? DEFAULT_MAX_NEIGHBORS;
|
|
205
|
-
const budget = opts.budget ?? 4000;
|
|
206
|
-
const includeSuperseded = opts.includeSuperseded ?? false;
|
|
207
|
-
const asOfDate = opts.asOf ? new Date(opts.asOf) : null;
|
|
208
|
-
const minResults = opts.minResults ?? 1;
|
|
209
|
-
const recallScope = opts.recallScope ?? {};
|
|
210
|
-
const baseScoreByMemId = new Map(baseResults.map((r) => [r.entry.id, r.score]));
|
|
211
|
-
const seenMemoryIds = new Set(baseResults.map((r) => r.entry.id));
|
|
212
|
-
const hitsByOrigin = new Map();
|
|
213
|
-
// Expand against each distinct store the seeds may live in (local + global).
|
|
214
|
-
const roots = globalRoot && globalRoot !== hippoRoot ? [hippoRoot, globalRoot] : [hippoRoot];
|
|
215
|
-
for (const root of roots) {
|
|
216
|
-
produceHitsForRoot(root, baseResults, baseScoreByMemId, seenMemoryIds, hitsByOrigin, {
|
|
217
|
-
hops, maxNeighbors, tenantId, includeSuperseded, asOfDate, recallScope,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
if (hitsByOrigin.size === 0)
|
|
221
|
-
return baseResults;
|
|
222
|
-
// Closer hops first within each origin group, then by inherited score.
|
|
223
|
-
// Hops asc and score desc are both true primary keys (unchanged);
|
|
224
|
-
// compareEntryIdentity is only the TAIL for a same-hop, same-score tie
|
|
225
|
-
// (T2, deterministic tie keys).
|
|
226
|
-
for (const hits of hitsByOrigin.values()) {
|
|
227
|
-
hits.sort((a, b) => {
|
|
228
|
-
const byHops = a.graphVia.hops - b.graphVia.hops;
|
|
229
|
-
if (byHops !== 0)
|
|
230
|
-
return byHops;
|
|
231
|
-
const byScore = b.score - a.score;
|
|
232
|
-
return byScore !== 0 ? byScore : compareEntryIdentity(a.entry, b.entry);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
const allHits = [...hitsByOrigin.values()].flat();
|
|
236
|
-
// Budget SELECTION by score (not by position): a high-value graph hit (it inherits its
|
|
237
|
-
// origin seed's relevance) must be able to win a token slot over a low-score lexical
|
|
238
|
-
// distractor — otherwise a tight --budget keeps the noise and drops the memory --hops
|
|
239
|
-
// surfaced. The greedy pack uses `continue` (not `break`), so a hit's origin seed is
|
|
240
|
-
// NOT guaranteed kept just because the hit is; the DISPLAY loop guards that (a hit is
|
|
241
|
-
// emitted ONLY under a kept seed, never orphaned). At least one result is always kept.
|
|
242
|
-
// (NOTE: at a tight budget a new graph hit can displace a weakly-scored base result;
|
|
243
|
-
// aggregate recall stays >= baseline, the displaced item is the lowest-value one.)
|
|
244
|
-
// Protect the top --min-results base rows from eviction (graph expansion must not
|
|
245
|
-
// violate the recall min-results floor; codex P2). They are kept regardless of budget;
|
|
246
|
-
// baseResults is score-ordered, so slice(0, N) is the top N.
|
|
247
|
-
const protectedCount = Math.min(Math.max(minResults, 1), baseResults.length);
|
|
248
|
-
const keep = new Set(baseResults.slice(0, protectedCount));
|
|
249
|
-
let usedTokens = [...keep].reduce((s, r) => s + r.tokens, 0);
|
|
250
|
-
// T2 note: PLAIN stable score sort on purpose -- both input lists are
|
|
251
|
-
// deterministically ordered by this point, stability inherits that, and a
|
|
252
|
-
// base-vs-graph-hit tie keeps the BASE result first (the concat order),
|
|
253
|
-
// preserving pre-T2 semantics.
|
|
254
|
-
for (const r of [...baseResults.slice(protectedCount), ...allHits].sort((a, b) => b.score - a.score)) {
|
|
255
|
-
if (usedTokens + r.tokens > budget)
|
|
256
|
-
continue;
|
|
257
|
-
usedTokens += r.tokens;
|
|
258
|
-
keep.add(r);
|
|
259
|
-
}
|
|
260
|
-
// DISPLAY order: base order preserved (it may be MMR-diversified); each kept new hit
|
|
261
|
-
// placed directly after the seed it descends from. Hits emit ONLY under a kept seed.
|
|
262
|
-
const merged = [];
|
|
263
|
-
let emittedHit = false;
|
|
264
|
-
for (const r of baseResults) {
|
|
265
|
-
if (!keep.has(r))
|
|
266
|
-
continue;
|
|
267
|
-
merged.push(r);
|
|
268
|
-
for (const hit of hitsByOrigin.get(r.entry.id) ?? []) {
|
|
269
|
-
if (keep.has(hit)) {
|
|
270
|
-
merged.push(hit);
|
|
271
|
-
emittedHit = true;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return emittedHit ? merged : baseResults; // nothing new survived budget -> original base
|
|
276
|
-
}
|
|
277
|
-
//# sourceMappingURL=graph-recall.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-recall.js","sourceRoot":"","sources":["../../src/graph-recall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAqB,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE3F;kDACkD;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC;8EAC8E;AAC9E,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,qFAAqF;AACrF,MAAM,UAAU,GAAG,GAAG,CAAC;AAqCvB,uFAAuF;AACvF,SAAS,gBAAgB,CAAC,IAAY,EAAE,QAAgB,EAAE,GAAa;IACrE,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,GAAG,GAAkB,E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