@remnic/core 9.64.4 → 9.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +12 -11
- package/dist/access-admin-ops-surface.js +36 -35
- package/dist/access-authorization-probe.d.ts +12 -11
- package/dist/access-authorization-probe.js +37 -36
- package/dist/access-boundary.d.ts +12 -11
- package/dist/access-boundary.js +36 -35
- package/dist/access-cli.js +91 -88
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +2 -1
- package/dist/access-extraction-force-flush.d.ts +12 -11
- package/dist/access-extraction-force-flush.js +36 -35
- package/dist/access-health-types.d.ts +2 -1
- package/dist/access-http-lcm-compaction.d.ts +12 -11
- package/dist/access-http-lifecycle-flush.d.ts +12 -11
- package/dist/access-http-offline-stream.d.ts +12 -11
- package/dist/access-http-query.d.ts +3 -2
- package/dist/access-http-query.js +38 -37
- package/dist/access-http.d.ts +13 -12
- package/dist/access-http.js +49 -48
- package/dist/access-identity-continuity-surface.d.ts +10 -9
- package/dist/access-identity-continuity-surface.js +36 -35
- package/dist/access-lcm-surface.d.ts +12 -11
- package/dist/access-lcm-surface.js +36 -35
- package/dist/access-mcp.d.ts +12 -11
- package/dist/access-mcp.js +42 -41
- package/dist/access-memory-search-fanout.d.ts +3 -2
- package/dist/{access-namespace-preflight-CYeI1R2_.d.ts → access-namespace-preflight-BKUnKsBv.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +4 -3
- package/dist/access-namespace-preflight.js +36 -35
- package/dist/access-observe-write-surface.d.ts +12 -11
- package/dist/access-observe-write-surface.js +36 -35
- package/dist/access-offline-manifest.d.ts +10 -9
- package/dist/access-operations-batch.js +38 -37
- package/dist/access-operations.d.ts +12 -11
- package/dist/access-operations.js +41 -40
- package/dist/access-recall-concurrency.d.ts +12 -11
- package/dist/access-recall-concurrency.js +36 -35
- package/dist/access-recall-response.d.ts +12 -11
- package/dist/access-recall-response.js +36 -35
- package/dist/access-recall-surface.d.ts +12 -11
- package/dist/access-recall-surface.js +36 -35
- package/dist/{access-service-BKtdXnyk.d.ts → access-service-B1Lbb-nQ.d.ts} +13 -13
- package/dist/access-service-helpers.d.ts +12 -11
- package/dist/access-service.d.ts +12 -11
- package/dist/access-service.js +36 -35
- package/dist/access-surface-catalog.d.ts +12 -11
- package/dist/access-surface-catalog.js +38 -37
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +4 -3
- package/dist/action-confidence.d.ts +2 -1
- package/dist/active-memory-bridge.d.ts +2 -1
- package/dist/active-recall.d.ts +2 -1
- package/dist/active-recall.js +4 -2
- package/dist/active-recall.js.map +1 -1
- package/dist/ambient-provenance.d.ts +2 -1
- package/dist/artifact-search.d.ts +2 -1
- package/dist/behavior-learner.d.ts +2 -1
- package/dist/behavior-signals.d.ts +2 -1
- package/dist/bootstrap.d.ts +10 -9
- package/dist/briefing-window.d.ts +3 -2
- package/dist/briefing.d.ts +3 -2
- package/dist/briefing.js +15 -14
- package/dist/buffer-surprise-report.d.ts +2 -1
- package/dist/buffer-turn-helpers.d.ts +2 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.js +5 -5
- package/dist/bulk-import/index.d.ts +4 -3
- package/dist/calibration.d.ts +2 -1
- package/dist/capabilities.d.ts +2 -1
- package/dist/{catalog-CLAqQO2L.d.ts → catalog-DjVhJoRM.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +2 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +2 -1
- package/dist/causal-consolidation.js +18 -17
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +2 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-5HERQ5FX.js → chunk-256FBCVX.js} +5 -5
- package/dist/{chunk-GVRLED7R.js → chunk-2572MRP2.js} +2 -2
- package/dist/{chunk-TY35YQ6E.js → chunk-3MADV4YC.js} +2 -2
- package/dist/{chunk-XACYILRA.js → chunk-3PXVYJMC.js} +31 -31
- package/dist/{chunk-DC4FJY2G.js → chunk-3RHFGGI5.js} +4 -4
- package/dist/{chunk-LOETWOEB.js → chunk-3TMYV3LP.js} +2 -2
- package/dist/chunk-3WU7XOFN.js +102 -0
- package/dist/chunk-3WU7XOFN.js.map +1 -0
- package/dist/{chunk-XH4IQVTN.js → chunk-4W6INNXO.js} +2 -2
- package/dist/{chunk-SB6YBB2V.js → chunk-53ENM6F6.js} +2 -2
- package/dist/{chunk-7V3AZWWZ.js → chunk-5UYSCYR7.js} +9 -7
- package/dist/{chunk-7V3AZWWZ.js.map → chunk-5UYSCYR7.js.map} +1 -1
- package/dist/{chunk-Z6CJLYXT.js → chunk-63FHSH7E.js} +3 -3
- package/dist/{chunk-DG6MJD7W.js → chunk-6JJT5AKI.js} +2 -2
- package/dist/{chunk-7BVO64UC.js → chunk-6L27N6YI.js} +2 -2
- package/dist/chunk-7PHI6GUI.js +95 -0
- package/dist/chunk-7PHI6GUI.js.map +1 -0
- package/dist/{chunk-YXGU3MDQ.js → chunk-7PWWGYGO.js} +2 -2
- package/dist/{chunk-CKZHKFY3.js → chunk-7QFBLYFP.js} +3 -3
- package/dist/{chunk-RWLRKMZK.js → chunk-AGKIG3YA.js} +2 -2
- package/dist/{chunk-A2IBK3TG.js → chunk-ALCJRQ72.js} +2 -2
- package/dist/{chunk-44DSGZFF.js → chunk-BC4QD3FM.js} +2 -2
- package/dist/{chunk-YMOPYG3K.js → chunk-BIJAWZYW.js} +6 -6
- package/dist/{chunk-KRPE7ANR.js → chunk-CCTVAVTT.js} +2 -2
- package/dist/{chunk-VYEPACWY.js → chunk-CEH2AFXG.js} +7 -7
- package/dist/{chunk-XBRGJJK7.js → chunk-CEQF6L5K.js} +3 -3
- package/dist/{chunk-PVIXAMWM.js → chunk-CFRBTATE.js} +2 -2
- package/dist/{chunk-UIYYS2YI.js → chunk-CTQRPANJ.js} +2 -2
- package/dist/{chunk-XZUCNVGE.js → chunk-CUS6S7PN.js} +10 -10
- package/dist/{chunk-KWIGDKM2.js → chunk-D2YNNDML.js} +2 -2
- package/dist/{chunk-MJRVF7SF.js → chunk-DBXZZIDU.js} +87 -56
- package/dist/chunk-DBXZZIDU.js.map +1 -0
- package/dist/{chunk-2QI2JBLQ.js → chunk-DEFI2QBT.js} +16 -10
- package/dist/chunk-DEFI2QBT.js.map +1 -0
- package/dist/{chunk-JCSUNXYJ.js → chunk-ESCQ6LY7.js} +3 -3
- package/dist/{chunk-652S5A5D.js → chunk-EUYWQ7TS.js} +2 -2
- package/dist/{chunk-ML3U4KPR.js → chunk-GIC6BASP.js} +2 -2
- package/dist/{chunk-ZSYE2QVJ.js → chunk-GXWDWOWP.js} +2 -2
- package/dist/{chunk-55SJFHVD.js → chunk-HJQZQUPC.js} +11 -11
- package/dist/{chunk-6LTCUN3T.js → chunk-HQSBYI5X.js} +2 -2
- package/dist/{chunk-H5CGAD7L.js → chunk-HQSPXTQO.js} +1 -1
- package/dist/{chunk-EJDLQRUO.js → chunk-HUNSEO5U.js} +2 -2
- package/dist/{chunk-ON2P3SHG.js → chunk-IAY7YBXS.js} +2 -2
- package/dist/{chunk-MB6GLPRY.js → chunk-IVKIODHO.js} +4 -4
- package/dist/{chunk-CUIAHZPZ.js → chunk-IXRC7EQG.js} +2 -2
- package/dist/{chunk-VRYEXPRX.js → chunk-JFJ3MHGV.js} +1 -1
- package/dist/{chunk-VRYEXPRX.js.map → chunk-JFJ3MHGV.js.map} +1 -1
- package/dist/{chunk-LZKCMK3U.js → chunk-JTSVMJHV.js} +2 -2
- package/dist/{chunk-URS5GSM7.js → chunk-JXN77SGO.js} +1 -1
- package/dist/chunk-JXN77SGO.js.map +1 -0
- package/dist/{chunk-WBM5NR4E.js → chunk-KPBLJCCV.js} +2 -2
- package/dist/{chunk-VLES5S4K.js → chunk-LWVO2QZV.js} +36 -36
- package/dist/{chunk-NO7B6DRB.js → chunk-LYIZXQYY.js} +2 -2
- package/dist/{chunk-7RAJ3GXO.js → chunk-M6L7HI7R.js} +2 -156
- package/dist/chunk-M6L7HI7R.js.map +1 -0
- package/dist/{chunk-VUP47UJI.js → chunk-MIBKEW7A.js} +3 -3
- package/dist/{chunk-OQIRBGUU.js → chunk-N37X5RU7.js} +2 -2
- package/dist/{chunk-C6AKYOFO.js → chunk-N6TRHP72.js} +2 -2
- package/dist/{chunk-VANZKHTN.js → chunk-NNBZS3DY.js} +2 -2
- package/dist/{chunk-2PSX5BJU.js → chunk-NZPFCP5A.js} +2 -2
- package/dist/{chunk-LTBKKSCX.js → chunk-OLBZ2WGG.js} +2 -2
- package/dist/{chunk-PD66CVSD.js → chunk-OUKBMQ2O.js} +2 -2
- package/dist/{chunk-GPFZFCRN.js → chunk-PP7R754B.js} +1 -1
- package/dist/{chunk-TKI2WOL5.js → chunk-R3AAOKR2.js} +2 -2
- package/dist/{chunk-RNORDDD6.js → chunk-S2VBSTTA.js} +2 -2
- package/dist/{chunk-3A46U7XG.js → chunk-SYJ6EKKE.js} +2 -2
- package/dist/{chunk-YFQTDE7N.js → chunk-VJ6ECBIP.js} +2 -2
- package/dist/{chunk-IFK3PVM7.js → chunk-VPGRXEAB.js} +2 -2
- package/dist/{chunk-246HFJVG.js → chunk-VZVP2W4O.js} +2 -2
- package/dist/{chunk-SHQFYZTD.js → chunk-W6TSGWYS.js} +2 -2
- package/dist/{chunk-DA2O3F5V.js → chunk-WTOE7CW4.js} +13 -13
- package/dist/{chunk-IJXECCUV.js → chunk-X5SDZMO7.js} +2 -2
- package/dist/chunk-XAB6STPO.js +160 -0
- package/dist/chunk-XAB6STPO.js.map +1 -0
- package/dist/{chunk-DHKV6E4A.js → chunk-Y23B2QXP.js} +2 -2
- package/dist/{chunk-PE76XIDM.js → chunk-YEQEGSJA.js} +3 -3
- package/dist/{chunk-UMDZXW5J.js → chunk-YQ3CBLL4.js} +5 -85
- package/dist/chunk-YQ3CBLL4.js.map +1 -0
- package/dist/{chunk-VYISFWVX.js → chunk-YQNNHLCG.js} +2 -2
- package/dist/{chunk-3LOQN3TO.js → chunk-Z54TXZ2F.js} +3 -3
- package/dist/{cli-CLvBewKf.d.ts → cli-Pulnz-qm.d.ts} +5 -5
- package/dist/cli.d.ts +14 -13
- package/dist/cli.js +70 -67
- package/dist/coding/pre-action-gate.d.ts +2 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +15 -14
- package/dist/compounding/preference-consolidator.d.ts +2 -1
- package/dist/compression-optimizer.d.ts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +4 -2
- package/dist/connectors/codex-materialize-runner.d.ts +2 -1
- package/dist/connectors/codex-materialize-runner.js +15 -14
- package/dist/connectors/codex-materialize.d.ts +2 -1
- package/dist/connectors/index.d.ts +2 -1
- package/dist/connectors/index.js +15 -14
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/contradiction/index.d.ts +3 -2
- package/dist/converge-config.d.ts +2 -1
- package/dist/convergence-refresh.d.ts +3 -2
- package/dist/convergence-refresh.js +17 -16
- package/dist/conversation-index/backend.d.ts +2 -1
- package/dist/conversation-index/chunker.d.ts +2 -1
- package/dist/conversation-index/faiss-adapter.d.ts +2 -1
- package/dist/conversation-index/indexer.d.ts +2 -1
- package/dist/conversation-index/search.d.ts +2 -1
- package/dist/corpus-watermark.d.ts +2 -1
- package/dist/corpus-watermark.js +17 -16
- package/dist/cross-lingual-recall.d.ts +70 -0
- package/dist/cross-lingual-recall.js +14 -0
- package/dist/day-summary.d.ts +2 -1
- package/dist/delinearize.d.ts +2 -1
- package/dist/dependency-propagation-config.d.ts +2 -1
- package/dist/{dependency-propagation-delivery-DMqIw9Zh.d.ts → dependency-propagation-delivery-Co17gxYb.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +2 -1
- package/dist/direct-answer.d.ts +2 -1
- package/dist/embedding-fallback.d.ts +2 -1
- package/dist/enrichment/index.d.ts +2 -1
- package/dist/entity-origin-fields.d.ts +2 -1
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +15 -14
- package/dist/entity-schema.d.ts +2 -1
- package/dist/episodic-context.d.ts +2 -1
- package/dist/explicit-capture.d.ts +10 -9
- package/dist/external-wiki-access.d.ts +12 -11
- package/dist/external-wiki-access.js +37 -36
- package/dist/external-wiki-collection-registration.d.ts +2 -1
- package/dist/external-wiki-collection.d.ts +2 -1
- package/dist/external-wiki-mcp-tools.d.ts +12 -11
- package/dist/extraction-error-classification.d.ts +2 -1
- package/dist/extraction-faithfulness.d.ts +2 -1
- package/dist/extraction-judge-telemetry.d.ts +2 -1
- package/dist/extraction-judge-training.d.ts +2 -1
- package/dist/extraction-judge.d.ts +2 -1
- package/dist/extraction-liveness.d.ts +2 -1
- package/dist/extraction-normalization.d.ts +2 -1
- package/dist/extraction-prompt.d.ts +2 -1
- package/dist/extraction-source-grounding-rules.d.ts +2 -1
- package/dist/extraction-source-grounding.d.ts +2 -1
- package/dist/extraction.d.ts +2 -1
- package/dist/extraction.js +20 -19
- package/dist/fallback-llm.d.ts +2 -1
- package/dist/graph-dashboard-diff.d.ts +2 -1
- package/dist/graph-dashboard-key.d.ts +2 -1
- package/dist/graph-dashboard-parser.d.ts +2 -1
- package/dist/{graph-edge-decay-A4SDFMMS.js → graph-edge-decay-FXGELBFA.js} +4 -4
- package/dist/graph-edge-decay-FXGELBFA.js.map +1 -0
- package/dist/graph-edge-reinforcement.d.ts +2 -1
- package/dist/graph-path-reconstruction.d.ts +2 -1
- package/dist/graph-path-scoring.d.ts +2 -1
- package/dist/graph-snapshot.d.ts +2 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +2 -1
- package/dist/graph.js +3 -3
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/importance.d.ts +2 -1
- package/dist/importers/index.d.ts +2 -1
- package/dist/in-flight-reads.d.ts +2 -1
- package/dist/index.d.ts +24 -23
- package/dist/index.js +130 -126
- package/dist/intent.d.ts +2 -1
- package/dist/lcm/engine.d.ts +2 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +2 -1
- package/dist/lcm/index.js +5 -5
- package/dist/lcm/tools.d.ts +2 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/live-connectors-runner.d.ts +2 -1
- package/dist/local-llm.d.ts +2 -1
- package/dist/local-llm.js +2 -2
- package/dist/local-model-endpoint.d.ts +2 -1
- package/dist/location/index.d.ts +295 -0
- package/dist/location/index.js +798 -0
- package/dist/location/index.js.map +1 -0
- package/dist/maintenance/memory-governance.d.ts +2 -1
- package/dist/maintenance/memory-governance.js +15 -14
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +15 -14
- package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-projection.js +16 -15
- package/dist/{maintenance-DITiehFX.d.ts → maintenance-DiSLtVN7.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +12 -11
- package/dist/memory-action-policy.d.ts +2 -1
- package/dist/memory-cache.d.ts +2 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
- package/dist/memory-projection-store.d.ts +2 -1
- package/dist/memory-provenance.d.ts +2 -1
- package/dist/memory-snapshot.d.ts +2 -1
- package/dist/memory-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +2 -1
- package/dist/namespaces/migrate.d.ts +4 -3
- package/dist/namespaces/migrate.js +16 -15
- package/dist/namespaces/principal.d.ts +2 -1
- package/dist/namespaces/search.d.ts +2 -1
- package/dist/namespaces/search.js +10 -10
- package/dist/namespaces/storage.d.ts +4 -3
- package/dist/namespaces/storage.js +15 -14
- package/dist/native-knowledge.d.ts +2 -1
- package/dist/offline-sync-impression-drain.d.ts +2 -1
- package/dist/operator-doctor-corpus.d.ts +2 -1
- package/dist/operator-doctor-corpus.js +18 -17
- package/dist/operator-doctor-replica.d.ts +2 -1
- package/dist/operator-toolkit.d.ts +4 -3
- package/dist/operator-toolkit.js +29 -26
- package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
- package/dist/orchestration/maintenance.d.ts +5 -4
- package/dist/orchestration/maintenance.js +23 -21
- package/dist/{orchestrator-6fPa2l9x.d.ts → orchestrator-DzCaxNS4.d.ts} +8 -8
- package/dist/orchestrator.d.ts +10 -9
- package/dist/orchestrator.js +92 -89
- package/dist/patterns-cli.d.ts +2 -1
- package/dist/{pipeline-DHpYtfM3.d.ts → pipeline-HJ8DKbFl.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +2 -1
- package/dist/proactive-contention.d.ts +2 -1
- package/dist/provenance.d.ts +2 -1
- package/dist/{public-http-BT36aBb-.d.ts → public-http-DwXauTX3.d.ts} +1 -1
- package/dist/{qmd-BaX31tM0.d.ts → qmd-BzxluoLt.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +3 -2
- package/dist/qmd-recall-cache.d.ts +2 -1
- package/dist/qmd.d.ts +3 -2
- package/dist/qmd.js +5 -5
- package/dist/recall-concurrency-config.d.ts +2 -1
- package/dist/recall-disclosure-escalation.d.ts +2 -1
- package/dist/recall-explain-renderer.d.ts +2 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +2 -1
- package/dist/recall-planner-llm.d.ts +2 -1
- package/dist/recall-state.d.ts +2 -1
- package/dist/recall-tag-filter.d.ts +2 -1
- package/dist/recall-timings.d.ts +2 -1
- package/dist/recall-xray-cli.d.ts +2 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +2 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +2 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +2 -1
- package/dist/reconcile/manifest.d.ts +2 -1
- package/dist/reconcile/plan.d.ts +2 -1
- package/dist/replay/normalizers/chatgpt.d.ts +2 -1
- package/dist/replay/normalizers/claude.d.ts +2 -1
- package/dist/replay/normalizers/openclaw.d.ts +2 -1
- package/dist/replay/normalizers/shared.d.ts +2 -1
- package/dist/replay/runner.d.ts +2 -1
- package/dist/replay/types.d.ts +2 -1
- package/dist/replica-divergence.d.ts +2 -1
- package/dist/replica-peers-config.d.ts +2 -1
- package/dist/resolve-auth-token.d.ts +2 -1
- package/dist/resume-bundles.js +5 -3
- package/dist/retrieval-agents.d.ts +3 -2
- package/dist/retrieval-tiers.d.ts +2 -1
- package/dist/routing/engine.d.ts +2 -1
- package/dist/routing/store.d.ts +2 -1
- package/dist/salvage-envelope.d.ts +2 -1
- package/dist/schemas.d.ts +30 -30
- package/dist/{scope-profiles-1hYWJ9bM.d.ts → scope-profiles-CEMZz0t5.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +2 -1
- package/dist/search/factory.d.ts +2 -1
- package/dist/search/factory.js +9 -9
- package/dist/search/index.d.ts +2 -1
- package/dist/search/index.js +13 -13
- package/dist/search/lancedb-backend.d.ts +2 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +2 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +2 -1
- package/dist/search/orama-backend.d.ts +2 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +3 -2
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +2 -1
- package/dist/search/remote-backend.js +2 -2
- package/dist/{semantic-consolidation-Chmddvcg.d.ts → semantic-consolidation-D9dYj6vu.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +3 -2
- package/dist/semantic-consolidation.js +16 -15
- package/dist/semantic-rule-promotion.js +15 -14
- package/dist/semantic-rule-verifier.d.ts +2 -1
- package/dist/semantic-rule-verifier.js +15 -14
- package/dist/{service-DMs_dCCg.d.ts → service-_qgST_0y.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +2 -1
- package/dist/session-observer-state.d.ts +2 -1
- package/dist/shared-context/manager.d.ts +2 -1
- package/dist/signal.d.ts +2 -1
- package/dist/source-agent-qualifier.d.ts +2 -1
- package/dist/source-agent-qualifier.js +17 -16
- package/dist/{storage-CzorrpcN.d.ts → storage-B9lbNTYE.d.ts} +1 -1
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +14 -13
- package/dist/summarizer.d.ts +2 -1
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +2 -1
- package/dist/support-passport/index.d.ts +15 -14
- package/dist/support-passport/index.js +39 -38
- package/dist/temporal-supersession.d.ts +3 -2
- package/dist/temporal-timeline-recall.d.ts +2 -1
- package/dist/temporal-validity.d.ts +2 -1
- package/dist/threading.d.ts +2 -1
- package/dist/tier-migration.d.ts +3 -2
- package/dist/tier-routing.d.ts +2 -1
- package/dist/topics.d.ts +2 -1
- package/dist/transcript.d.ts +2 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/trust-score-stage.d.ts +2 -1
- package/dist/trust-score.d.ts +2 -1
- package/dist/{types-BP5MC8UU.d.ts → types-BrEzuxPA.d.ts} +3 -23
- package/dist/types-CM86alG1.d.ts +89 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -1
- package/dist/verified-recall.js +15 -14
- package/dist/who-knows-cli.d.ts +12 -11
- package/dist/who-knows-cli.js +16 -15
- package/dist/who-knows.d.ts +12 -11
- package/dist/who-knows.js +15 -14
- package/dist/write-envelope.d.ts +2 -1
- package/package.json +12 -2
- package/src/cross-lingual-recall.test.ts +47 -0
- package/src/cross-lingual-recall.ts +186 -0
- package/src/location/adapter-isolation.test.ts +44 -0
- package/src/location/index.ts +16 -0
- package/src/orchestration/recall-internal-deps.ts +2 -0
- package/src/orchestration/recall-internal.ts +35 -33
- package/src/orchestration/recall-search-pipeline.ts +16 -0
- package/src/search/port.ts +2 -1
- package/src/storage.ts +5 -1
- package/src/types.ts +2 -0
- package/dist/chunk-2QI2JBLQ.js.map +0 -1
- package/dist/chunk-7RAJ3GXO.js.map +0 -1
- package/dist/chunk-MJRVF7SF.js.map +0 -1
- package/dist/chunk-UMDZXW5J.js.map +0 -1
- package/dist/chunk-URS5GSM7.js.map +0 -1
- /package/dist/{chunk-5HERQ5FX.js.map → chunk-256FBCVX.js.map} +0 -0
- /package/dist/{chunk-GVRLED7R.js.map → chunk-2572MRP2.js.map} +0 -0
- /package/dist/{chunk-TY35YQ6E.js.map → chunk-3MADV4YC.js.map} +0 -0
- /package/dist/{chunk-XACYILRA.js.map → chunk-3PXVYJMC.js.map} +0 -0
- /package/dist/{chunk-DC4FJY2G.js.map → chunk-3RHFGGI5.js.map} +0 -0
- /package/dist/{chunk-LOETWOEB.js.map → chunk-3TMYV3LP.js.map} +0 -0
- /package/dist/{chunk-XH4IQVTN.js.map → chunk-4W6INNXO.js.map} +0 -0
- /package/dist/{chunk-SB6YBB2V.js.map → chunk-53ENM6F6.js.map} +0 -0
- /package/dist/{chunk-Z6CJLYXT.js.map → chunk-63FHSH7E.js.map} +0 -0
- /package/dist/{chunk-DG6MJD7W.js.map → chunk-6JJT5AKI.js.map} +0 -0
- /package/dist/{chunk-7BVO64UC.js.map → chunk-6L27N6YI.js.map} +0 -0
- /package/dist/{chunk-YXGU3MDQ.js.map → chunk-7PWWGYGO.js.map} +0 -0
- /package/dist/{chunk-CKZHKFY3.js.map → chunk-7QFBLYFP.js.map} +0 -0
- /package/dist/{chunk-RWLRKMZK.js.map → chunk-AGKIG3YA.js.map} +0 -0
- /package/dist/{chunk-A2IBK3TG.js.map → chunk-ALCJRQ72.js.map} +0 -0
- /package/dist/{chunk-44DSGZFF.js.map → chunk-BC4QD3FM.js.map} +0 -0
- /package/dist/{chunk-YMOPYG3K.js.map → chunk-BIJAWZYW.js.map} +0 -0
- /package/dist/{chunk-KRPE7ANR.js.map → chunk-CCTVAVTT.js.map} +0 -0
- /package/dist/{chunk-VYEPACWY.js.map → chunk-CEH2AFXG.js.map} +0 -0
- /package/dist/{chunk-XBRGJJK7.js.map → chunk-CEQF6L5K.js.map} +0 -0
- /package/dist/{chunk-PVIXAMWM.js.map → chunk-CFRBTATE.js.map} +0 -0
- /package/dist/{chunk-UIYYS2YI.js.map → chunk-CTQRPANJ.js.map} +0 -0
- /package/dist/{chunk-XZUCNVGE.js.map → chunk-CUS6S7PN.js.map} +0 -0
- /package/dist/{chunk-KWIGDKM2.js.map → chunk-D2YNNDML.js.map} +0 -0
- /package/dist/{chunk-JCSUNXYJ.js.map → chunk-ESCQ6LY7.js.map} +0 -0
- /package/dist/{chunk-652S5A5D.js.map → chunk-EUYWQ7TS.js.map} +0 -0
- /package/dist/{chunk-ML3U4KPR.js.map → chunk-GIC6BASP.js.map} +0 -0
- /package/dist/{chunk-ZSYE2QVJ.js.map → chunk-GXWDWOWP.js.map} +0 -0
- /package/dist/{chunk-55SJFHVD.js.map → chunk-HJQZQUPC.js.map} +0 -0
- /package/dist/{chunk-6LTCUN3T.js.map → chunk-HQSBYI5X.js.map} +0 -0
- /package/dist/{chunk-H5CGAD7L.js.map → chunk-HQSPXTQO.js.map} +0 -0
- /package/dist/{chunk-EJDLQRUO.js.map → chunk-HUNSEO5U.js.map} +0 -0
- /package/dist/{chunk-ON2P3SHG.js.map → chunk-IAY7YBXS.js.map} +0 -0
- /package/dist/{chunk-MB6GLPRY.js.map → chunk-IVKIODHO.js.map} +0 -0
- /package/dist/{chunk-CUIAHZPZ.js.map → chunk-IXRC7EQG.js.map} +0 -0
- /package/dist/{chunk-LZKCMK3U.js.map → chunk-JTSVMJHV.js.map} +0 -0
- /package/dist/{chunk-WBM5NR4E.js.map → chunk-KPBLJCCV.js.map} +0 -0
- /package/dist/{chunk-VLES5S4K.js.map → chunk-LWVO2QZV.js.map} +0 -0
- /package/dist/{chunk-NO7B6DRB.js.map → chunk-LYIZXQYY.js.map} +0 -0
- /package/dist/{chunk-VUP47UJI.js.map → chunk-MIBKEW7A.js.map} +0 -0
- /package/dist/{chunk-OQIRBGUU.js.map → chunk-N37X5RU7.js.map} +0 -0
- /package/dist/{chunk-C6AKYOFO.js.map → chunk-N6TRHP72.js.map} +0 -0
- /package/dist/{chunk-VANZKHTN.js.map → chunk-NNBZS3DY.js.map} +0 -0
- /package/dist/{chunk-2PSX5BJU.js.map → chunk-NZPFCP5A.js.map} +0 -0
- /package/dist/{chunk-LTBKKSCX.js.map → chunk-OLBZ2WGG.js.map} +0 -0
- /package/dist/{chunk-PD66CVSD.js.map → chunk-OUKBMQ2O.js.map} +0 -0
- /package/dist/{chunk-GPFZFCRN.js.map → chunk-PP7R754B.js.map} +0 -0
- /package/dist/{chunk-TKI2WOL5.js.map → chunk-R3AAOKR2.js.map} +0 -0
- /package/dist/{chunk-RNORDDD6.js.map → chunk-S2VBSTTA.js.map} +0 -0
- /package/dist/{chunk-3A46U7XG.js.map → chunk-SYJ6EKKE.js.map} +0 -0
- /package/dist/{chunk-YFQTDE7N.js.map → chunk-VJ6ECBIP.js.map} +0 -0
- /package/dist/{chunk-IFK3PVM7.js.map → chunk-VPGRXEAB.js.map} +0 -0
- /package/dist/{chunk-246HFJVG.js.map → chunk-VZVP2W4O.js.map} +0 -0
- /package/dist/{chunk-SHQFYZTD.js.map → chunk-W6TSGWYS.js.map} +0 -0
- /package/dist/{chunk-DA2O3F5V.js.map → chunk-WTOE7CW4.js.map} +0 -0
- /package/dist/{chunk-IJXECCUV.js.map → chunk-X5SDZMO7.js.map} +0 -0
- /package/dist/{chunk-DHKV6E4A.js.map → chunk-Y23B2QXP.js.map} +0 -0
- /package/dist/{chunk-PE76XIDM.js.map → chunk-YEQEGSJA.js.map} +0 -0
- /package/dist/{chunk-VYISFWVX.js.map → chunk-YQNNHLCG.js.map} +0 -0
- /package/dist/{chunk-3LOQN3TO.js.map → chunk-Z54TXZ2F.js.map} +0 -0
- /package/dist/{graph-edge-decay-A4SDFMMS.js.map → cross-lingual-recall.js.map} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { bE as BulkImportSourceAdapter } from '../types-
|
|
2
|
-
export { bD as BulkImportError, aa as BulkImportOptions, ac as BulkImportResult, ab as BulkImportSource, bM as ImportSourceRole, a9 as ImportTurn, bN as ImportTurnValidationIssue, b_ as isImportRole, c0 as parseIsoTimestamp, c1 as validateImportTurn } from '../types-
|
|
3
|
-
export { a as ProcessBatchContext, P as ProcessBatchFn, b as ProcessBatchResult, f as formatBatchTranscript, r as resolveBulkImportContext, c as runBulkImportPipeline, v as validateBatchSize } from '../pipeline-
|
|
1
|
+
import { bE as BulkImportSourceAdapter } from '../types-BrEzuxPA.js';
|
|
2
|
+
export { bD as BulkImportError, aa as BulkImportOptions, ac as BulkImportResult, ab as BulkImportSource, bM as ImportSourceRole, a9 as ImportTurn, bN as ImportTurnValidationIssue, b_ as isImportRole, c0 as parseIsoTimestamp, c1 as validateImportTurn } from '../types-BrEzuxPA.js';
|
|
3
|
+
export { a as ProcessBatchContext, P as ProcessBatchFn, b as ProcessBatchResult, f as formatBatchTranscript, r as resolveBulkImportContext, c as runBulkImportPipeline, v as validateBatchSize } from '../pipeline-HJ8DKbFl.js';
|
|
4
4
|
import '../message-parts/index.js';
|
|
5
5
|
import '../bounded-jsonl-state.js';
|
|
6
|
+
import '../types-CM86alG1.js';
|
|
6
7
|
import '../operator-doctor-types.js';
|
|
7
8
|
import '../external-wiki-config.js';
|
|
8
9
|
import '../contradiction-config.js';
|
package/dist/calibration.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FallbackLlmClient } from './fallback-llm.js';
|
|
2
|
-
import { G as GatewayConfig, A as AgentPersonaModelConfig } from './types-
|
|
2
|
+
import { G as GatewayConfig, A as AgentPersonaModelConfig } from './types-BrEzuxPA.js';
|
|
3
3
|
import './resolve-provider-secret.js';
|
|
4
4
|
import './message-parts/index.js';
|
|
5
5
|
import './bounded-jsonl-state.js';
|
|
6
|
+
import './types-CM86alG1.js';
|
|
6
7
|
import './operator-doctor-types.js';
|
|
7
8
|
import './external-wiki-config.js';
|
|
8
9
|
import './contradiction-config.js';
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as PluginConfig } from './types-
|
|
1
|
+
import { P as PluginConfig } from './types-BrEzuxPA.js';
|
|
2
2
|
import './message-parts/index.js';
|
|
3
3
|
import './bounded-jsonl-state.js';
|
|
4
|
+
import './types-CM86alG1.js';
|
|
4
5
|
import './operator-doctor-types.js';
|
|
5
6
|
import './external-wiki-config.js';
|
|
6
7
|
import './contradiction-config.js';
|
|
@@ -2,9 +2,10 @@ import { CausalChainIndex } from './causal-chain.js';
|
|
|
2
2
|
import { ConsolidatedPreference } from './compounding/preference-consolidator.js';
|
|
3
3
|
import './causal-trajectory.js';
|
|
4
4
|
import './objective-state.js';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-BrEzuxPA.js';
|
|
6
6
|
import './message-parts/index.js';
|
|
7
7
|
import './bounded-jsonl-state.js';
|
|
8
|
+
import './types-CM86alG1.js';
|
|
8
9
|
import './operator-doctor-types.js';
|
|
9
10
|
import './external-wiki-config.js';
|
|
10
11
|
import './contradiction-config.js';
|
package/dist/causal-behavior.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NZPFCP5A.js";
|
|
5
5
|
import "./chunk-B7RWBZXW.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveCausalTrajectoryStoreDir
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PP7R754B.js";
|
|
9
9
|
import {
|
|
10
10
|
normalizeRecallTokens
|
|
11
11
|
} from "./chunk-YCVB7X56.js";
|
package/dist/causal-chain.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
stitchCausalChain,
|
|
7
7
|
validateCausalEdge,
|
|
8
8
|
writeChainIndex
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NZPFCP5A.js";
|
|
10
10
|
import "./chunk-B7RWBZXW.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-PP7R754B.js";
|
|
12
12
|
import "./chunk-YCVB7X56.js";
|
|
13
13
|
import "./chunk-A2IYSXDQ.js";
|
|
14
14
|
import "./chunk-P77QX3ID.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { G as GatewayConfig, A as AgentPersonaModelConfig, P as PluginConfig, M as MemoryFile } from './types-
|
|
1
|
+
import { G as GatewayConfig, A as AgentPersonaModelConfig, P as PluginConfig, M as MemoryFile } from './types-BrEzuxPA.js';
|
|
2
2
|
import { RolloutSummaryInput, MaterializeResult } from './connectors/codex-materialize.js';
|
|
3
3
|
import './message-parts/index.js';
|
|
4
4
|
import './bounded-jsonl-state.js';
|
|
5
|
+
import './types-CM86alG1.js';
|
|
5
6
|
import './operator-doctor-types.js';
|
|
6
7
|
import './external-wiki-config.js';
|
|
7
8
|
import './contradiction-config.js';
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NZPFCP5A.js";
|
|
5
5
|
import {
|
|
6
6
|
buildExtensionsBlockForConsolidation
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VZVP2W4O.js";
|
|
8
8
|
import "./chunk-5JMAGU26.js";
|
|
9
9
|
import "./chunk-B7RWBZXW.js";
|
|
10
10
|
import {
|
|
11
11
|
runPostConsolidationMaterialize
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6L27N6YI.js";
|
|
13
13
|
import "./chunk-RDFF2NAU.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveCausalTrajectoryStoreDir
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-UHVXE24Y.js";
|
|
16
|
+
} from "./chunk-PP7R754B.js";
|
|
17
|
+
import "./chunk-DEFI2QBT.js";
|
|
19
18
|
import "./chunk-46WM6JX2.js";
|
|
19
|
+
import "./chunk-UHVXE24Y.js";
|
|
20
20
|
import "./chunk-SXIMQLGV.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-X5SDZMO7.js";
|
|
22
|
+
import "./chunk-HJQZQUPC.js";
|
|
23
|
+
import "./chunk-NNBZS3DY.js";
|
|
24
|
+
import "./chunk-CYEPCZN5.js";
|
|
25
|
+
import "./chunk-GIC6BASP.js";
|
|
26
|
+
import "./chunk-YQNNHLCG.js";
|
|
25
27
|
import "./chunk-6KTXE6A3.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-VANZKHTN.js";
|
|
28
|
+
import "./chunk-N37X5RU7.js";
|
|
28
29
|
import "./chunk-W7IGLX4G.js";
|
|
29
30
|
import "./chunk-GUMZC2BO.js";
|
|
30
|
-
import "./chunk-CYEPCZN5.js";
|
|
31
31
|
import "./chunk-227UFSEQ.js";
|
|
32
32
|
import "./chunk-ET356KSB.js";
|
|
33
33
|
import "./chunk-72A4L5JJ.js";
|
|
34
34
|
import "./chunk-A7Q43EUZ.js";
|
|
35
35
|
import "./chunk-S2V7RUCL.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-JFJ3MHGV.js";
|
|
37
37
|
import "./chunk-SCU65EZI.js";
|
|
38
38
|
import "./chunk-PO7NXBG2.js";
|
|
39
39
|
import "./chunk-S2HLHAZ4.js";
|
|
@@ -47,6 +47,7 @@ import "./chunk-BT7NVCML.js";
|
|
|
47
47
|
import "./chunk-3ONXXHQO.js";
|
|
48
48
|
import "./chunk-YXZG5TVN.js";
|
|
49
49
|
import "./chunk-5GINB5LC.js";
|
|
50
|
+
import "./chunk-3WU7XOFN.js";
|
|
50
51
|
import "./chunk-UFKPQBXH.js";
|
|
51
52
|
import "./chunk-XCB6QDL6.js";
|
|
52
53
|
import "./chunk-RBOJCG4T.js";
|
|
@@ -54,10 +55,10 @@ import "./chunk-ZVPVTPGI.js";
|
|
|
54
55
|
import "./chunk-5WITETWU.js";
|
|
55
56
|
import "./chunk-6CIAGZ6X.js";
|
|
56
57
|
import "./chunk-G7D6GZ5J.js";
|
|
57
|
-
import "./chunk-
|
|
58
|
-
import "./chunk-
|
|
59
|
-
import "./chunk-ZLQ37WJX.js";
|
|
58
|
+
import "./chunk-CEH2AFXG.js";
|
|
59
|
+
import "./chunk-JXN77SGO.js";
|
|
60
60
|
import "./chunk-IUM3VSHI.js";
|
|
61
|
+
import "./chunk-ZLQ37WJX.js";
|
|
61
62
|
import "./chunk-C64XATK7.js";
|
|
62
63
|
import "./chunk-42JKGUFJ.js";
|
|
63
64
|
import {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\n}\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidence(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMaterialize in codex-materialize-runner.ts.\n return runPostConsolidationMaterialize(\"[cmc]\", options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAO3B,OAAO,UAAU;AA0CjB,IAAM,yBAAyB,oBAAI,IAAI,CAAC,QAAQ,aAAa,YAAY,CAAC;AAY1E,eAAe,oBACb,WACA,0BACmC;AACnC,QAAM,OAAO,gCAAgC,WAAW,wBAAwB;AAChF,QAAM,kBAAkB,KAAK,KAAK,MAAM,cAAc;AAEtD,QAAM,QAAQ,MAAM,cAAc,eAAe,EAAE,MAAM,MAAM,CAAC,CAAa;AAC7E,QAAM,UAAoC,CAAC;AAE3C,aAAW,YAAY,OAAO;AAC5B,QAAI;AACF,YAAM,MAAM,MAAM,aAAa,QAAQ;AACvC,UAAI,SAAS,GAAG,KAAK,OAAO,IAAI,iBAAiB,UAAU;AACzD,gBAAQ,KAAK,GAAwC;AAAA,MACvD;AAAA,IAC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AW,QAAQ,wBAAwB;AACtF,UAAM,aAAa,MAAM,eAAe,SAAS;AACjD,UAAM,UAAU,oBAAoB,cAAc,UAAU;AAE5D,UAAM,MAAM,IAAI,kBAAkB,QAAQ,eAAe;AAAA,MACvD,cAAc,QAAQ;AAAA,IACxB,CAAC;AACD,UAAM,aAAa,EAAE,SAAS,QAAQ,gBAAgB,YAAY,QAAQ,WAAW;AACrF,QAAI,CAAC,IAAI,YAAY,UAAU,EAAG,QAAO;AAEzC,UAAM,SAAS,MAAM,mBAAmB,SAAS,KAAK,UAAU;AAChE,QAAI,OAAO,YAAY,WAAW,KAAK,OAAO,MAAM,WAAW,EAAG,QAAO;AAEzE,UAAM,QAAkB,CAAC,uDAAuD,EAAE;AAElF,eAAW,QAAQ,OAAO,aAAa;AACrC,YAAM,KAAK,KAAK,KAAK,SAAS,EAAE;AAAA,IAClC;AAEA,eAAW,QAAQ,OAAO,OAAO;AAC/B,YAAM,KAAK,KAAK,KAAK,OAAO,EAAE;AAAA,IAChC;AAEA,UAAM,KAAK,EAAE;AACb,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,QAAI,KAAK,kDAAkD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACnH,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,oCAAoC,SAQpB;AAGpC,SAAO,gCAAgC,SAAS,OAAO;AACzD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/causal-consolidation.ts"],"sourcesContent":["/**\n * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation\n *\n * Uses an LLM to analyze causal trajectory patterns across sessions.\n * The LLM receives the causal chain graph as context — connected trajectories\n * from different sessions — and identifies recurring behavioral patterns,\n * preference signals, and actionable rules.\n *\n * This is the core CMC innovation: the LLM gets cross-session causal context\n * that no other memory system provides. It can see that a user investigated\n * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —\n * and synthesize a rule or preference from that chain.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { resolveCausalTrajectoryStoreDir, type CausalTrajectoryRecord } from \"./causal-trajectory.js\";\nimport { readChainIndex, resolveChainsDir, type CausalChainIndex, type CausalEdge } from \"./causal-chain.js\";\nimport { listJsonFiles, readJsonFile } from \"./json-store.js\";\nimport { isRecord } from \"./store-contract.js\";\nimport { FallbackLlmClient, fallbackLlmRuntimeContextFromConfig } from \"./fallback-llm.js\";\nimport type { AgentPersonaModelConfig, GatewayConfig, MemoryFile, PluginConfig } from \"./types.js\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport { runPostConsolidationMaterialize } from \"./connectors/codex-materialize-runner.js\";\nimport type { MaterializeResult, RolloutSummaryInput } from \"./connectors/codex-materialize.js\";\nimport { buildExtensionsBlockForConsolidation } from \"./semantic-consolidation.js\";\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\nexport interface CausalPatternCandidate {\n id: string;\n sourceType: \"causal-pattern\";\n subject: string;\n category: \"principle\" | \"rule\" | \"preference\";\n content: string;\n score: number;\n rationale: string;\n outcome: null;\n provenance: string[];\n agent: string | null;\n workflow: string | null;\n}\n\nexport interface ConsolidationConfig {\n minRecurrence: number;\n minSessions: number;\n successThreshold: number;\n}\n\nexport interface LlmConsolidationResult {\n rules: Array<{\n content: string;\n category: \"rule\" | \"principle\" | \"preference\";\n confidence: number;\n evidence: string[];\n }>;\n preferences: Array<{\n statement: string;\n confidence: number;\n evidence: string[];\n }>;\n}\n\nconst CAUSAL_RULE_CATEGORIES = new Set([\"rule\", \"principle\", \"preference\"]);\n\ninterface ConsolidationLlmClient {\n isAvailable(options?: { agentId?: string; modelChain?: AgentPersonaModelConfig }): boolean;\n chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options?: { temperature?: number; maxTokens?: number; agentId?: string; modelChain?: AgentPersonaModelConfig },\n ): Promise<{ content: string } | null>;\n}\n\n// ─── Trajectory Reading ──────────────────────────────────────────────────────\n\nasync function readAllTrajectories(\n memoryDir: string,\n causalTrajectoryStoreDir?: string,\n): Promise<CausalTrajectoryRecord[]> {\n const root = resolveCausalTrajectoryStoreDir(memoryDir, causalTrajectoryStoreDir);\n const trajectoriesDir = path.join(root, \"trajectories\");\n\n const files = await listJsonFiles(trajectoriesDir).catch(() => [] as string[]);\n const results: CausalTrajectoryRecord[] = [];\n\n for (const filePath of files) {\n try {\n const raw = await readJsonFile(filePath);\n if (isRecord(raw) && typeof raw.trajectoryId === \"string\") {\n results.push(raw as unknown as CausalTrajectoryRecord);\n }\n } catch {\n // skip invalid\n }\n }\n\n return results;\n}\n\n// ─── Context Formatting ──────────────────────────────────────────────────────\n\n/**\n * Format trajectories and their causal connections as a readable context\n * for the LLM. Groups by session and shows chain connections.\n */\nfunction formatCausalContext(\n trajectories: CausalTrajectoryRecord[],\n chainIndex: CausalChainIndex,\n maxChars: number = 8000,\n): string {\n // Group trajectories by session\n const bySession = new Map<string, CausalTrajectoryRecord[]>();\n for (const t of trajectories) {\n const list = bySession.get(t.sessionKey) ?? [];\n list.push(t);\n bySession.set(t.sessionKey, list);\n }\n\n const lines: string[] = [];\n lines.push(`## Causal Trajectories (${trajectories.length} across ${bySession.size} sessions)`);\n lines.push(\"\");\n\n // Format each session's trajectories\n for (const [sessionKey, sessionTrajs] of bySession) {\n lines.push(`### Session: ${sessionKey}`);\n for (const t of sessionTrajs.slice(0, 5)) {\n const outcome = t.outcomeKind === \"success\" ? \"+\" : t.outcomeKind === \"failure\" ? \"-\" : \"~\";\n lines.push(`[${outcome}] Goal: ${t.goal}`);\n lines.push(` Action: ${t.actionSummary}`);\n lines.push(` Outcome: ${t.outcomeSummary}`);\n if (t.followUpSummary) lines.push(` Follow-up: ${t.followUpSummary}`);\n if (t.entityRefs?.length) lines.push(` Entities: ${t.entityRefs.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n // Format causal chain connections\n const edgeCount = Object.keys(chainIndex.edges).length;\n if (edgeCount > 0) {\n lines.push(`## Cross-Session Causal Chains (${edgeCount} connections)`);\n lines.push(\"\");\n\n const trajectoryMap = new Map(trajectories.map((t) => [t.trajectoryId, t]));\n const shown = new Set<string>();\n\n for (const [edgeId, edge] of Object.entries(chainIndex.edges)) {\n if (shown.size >= 10) break; // limit output size\n const from = trajectoryMap.get(edge.fromTrajectoryId);\n const to = trajectoryMap.get(edge.toTrajectoryId);\n if (!from || !to) continue;\n\n lines.push(`${edge.edgeType}: \"${from.goal}\" (${from.sessionKey}) → \"${to.goal}\" (${to.sessionKey})`);\n shown.add(edgeId);\n }\n lines.push(\"\");\n }\n\n const result = lines.join(\"\\n\");\n return result.length > maxChars ? result.slice(0, maxChars) + \"\\n[truncated]\" : result;\n}\n\n// ─── LLM Consolidation ──────────────────────────────────────────────────────\n\nconst CONSOLIDATION_PROMPT = `You are analyzing a user's causal trajectory history across multiple sessions. Trajectories record what the user tried to do (goal), what they did (action), and what happened (outcome).\n\nYour job is to identify:\n1. BEHAVIORAL RULES: Recurring patterns where the same approach consistently succeeds or fails. These should be actionable guidance for future sessions.\n2. PREFERENCES: What the user cares about, prefers, or consistently chooses — even if never explicitly stated. Infer preferences from what they repeatedly do, retry until successful, or always include in their workflow.\n\nIMPORTANT:\n- Look for CROSS-SESSION patterns — things that repeat across different sessions are more significant than within-session patterns.\n- A user who retries the same goal across sessions has a strong implicit preference for that outcome.\n- Consistent action choices reveal preferences even when the user never says \"I prefer X.\"\n- Frame preferences as \"The user would prefer responses that...\" when applicable.\n\nOutput valid JSON only:\n{\n \"rules\": [\n {\"content\": \"actionable rule text\", \"category\": \"rule|principle\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ],\n \"preferences\": [\n {\"statement\": \"The user would prefer...\", \"confidence\": 0.0-1.0, \"evidence\": [\"trajectory IDs\"]}\n ]\n}\n\nIf no clear patterns exist, return {\"rules\": [], \"preferences\": []}.`;\n\nasync function consolidateWithLlm(\n context: string,\n llm: ConsolidationLlmClient,\n options: { agentId?: string; modelChain?: AgentPersonaModelConfig } = {},\n): Promise<LlmConsolidationResult> {\n const response = await llm.chatCompletion(\n [\n { role: \"system\", content: CONSOLIDATION_PROMPT },\n { role: \"user\", content: context },\n ],\n { temperature: 0.2, maxTokens: 2000, agentId: options.agentId, modelChain: options.modelChain },\n );\n\n if (!response?.content) {\n return { rules: [], preferences: [] };\n }\n\n try {\n // Extract JSON from response (may have markdown code fences)\n let jsonStr = response.content.trim();\n const fenceMatch = jsonStr.match(/```(?:json)?\\s*\\n?([\\s\\S]*?)\\n?\\s*```/);\n if (fenceMatch) jsonStr = fenceMatch[1];\n\n const parsed = JSON.parse(jsonStr);\n const rawRules: unknown[] = Array.isArray(parsed.rules) ? parsed.rules : [];\n const rawPreferences: unknown[] = Array.isArray(parsed.preferences) ? parsed.preferences : [];\n return {\n rules: rawRules\n .map(parseLlmRule)\n .filter((rule): rule is LlmConsolidationResult[\"rules\"][number] => !!rule),\n preferences: rawPreferences\n .map(parseLlmPreference)\n .filter((pref): pref is LlmConsolidationResult[\"preferences\"][number] => !!pref),\n };\n } catch {\n log.warn(\"[cmc] failed to parse LLM consolidation response\");\n return { rules: [], preferences: [] };\n }\n}\n\n// ─── Candidate Generation ────────────────────────────────────────────────────\n\nfunction stablePatternId(content: string): string {\n const digest = createHash(\"sha256\")\n .update(`causal-pattern\\0${content}`)\n .digest(\"hex\")\n .slice(0, 16);\n return `causal-pattern:${digest}`;\n}\n\nfunction parseConfidence(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return Math.max(0, Math.min(1, value));\n}\n\nfunction parseEvidence(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && item.trim().length > 0);\n}\n\nfunction parseLlmRule(raw: unknown): LlmConsolidationResult[\"rules\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const r = raw as Record<string, unknown>;\n const content = typeof r.content === \"string\" ? r.content.trim() : \"\";\n const category = typeof r.category === \"string\" ? r.category : \"\";\n const confidence = parseConfidence(r.confidence);\n if (content.length <= 5 || !CAUSAL_RULE_CATEGORIES.has(category) || confidence === undefined) {\n return undefined;\n }\n return {\n content,\n category: category as \"rule\" | \"principle\" | \"preference\",\n confidence,\n evidence: parseEvidence(r.evidence),\n };\n}\n\nfunction parseLlmPreference(raw: unknown): LlmConsolidationResult[\"preferences\"][number] | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const p = raw as Record<string, unknown>;\n const statement = typeof p.statement === \"string\" ? p.statement.trim() : \"\";\n const confidence = parseConfidence(p.confidence);\n if (statement.length <= 5 || confidence === undefined) return undefined;\n return {\n statement,\n confidence,\n evidence: parseEvidence(p.evidence),\n };\n}\n\nfunction llmResultToCandidates(result: LlmConsolidationResult): CausalPatternCandidate[] {\n const candidates: CausalPatternCandidate[] = [];\n\n for (const rule of result.rules) {\n const category =\n rule.category === \"principle\" || rule.category === \"preference\"\n ? rule.category\n : \"rule\";\n candidates.push({\n id: stablePatternId(rule.content),\n sourceType: \"causal-pattern\",\n subject: rule.content.slice(0, 80),\n category,\n content: rule.content,\n score: Math.min(1, rule.confidence ?? 0.7),\n rationale: \"LLM-identified causal pattern from cross-session trajectory analysis\",\n outcome: null,\n provenance: (rule.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n for (const preference of result.preferences) {\n candidates.push({\n id: stablePatternId(preference.statement),\n sourceType: \"causal-pattern\",\n subject: preference.statement.slice(0, 80),\n category: \"preference\",\n content: preference.statement,\n score: Math.min(1, preference.confidence ?? 0.7),\n rationale: \"LLM-identified preference from cross-session trajectory analysis\",\n outcome: null,\n provenance: (preference.evidence ?? []).slice(0, 5),\n agent: null,\n workflow: null,\n });\n }\n\n return candidates;\n}\n\nfunction normalizePositiveInteger(value: number, fallback: number): number {\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeSuccessThreshold(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 0;\n return Math.min(1, value);\n}\n\nfunction trajectorySuccessScore(trajectory: CausalTrajectoryRecord): number {\n if (trajectory.outcomeKind === \"success\") return 1;\n if (trajectory.outcomeKind === \"partial\") return 0.5;\n return 0;\n}\n\nfunction averageSuccessScore(trajectories: CausalTrajectoryRecord[]): number {\n if (trajectories.length === 0) return 0;\n const total = trajectories.reduce((sum, trajectory) => sum + trajectorySuccessScore(trajectory), 0);\n return total / trajectories.length;\n}\n\nfunction passesConsolidationGates(\n trajectories: CausalTrajectoryRecord[],\n config: ConsolidationConfig,\n): boolean {\n const minRecurrence = normalizePositiveInteger(config.minRecurrence, 1);\n if (trajectories.length < minRecurrence) return false;\n\n const minSessions = normalizePositiveInteger(config.minSessions, 1);\n const sessionCount = new Set(trajectories.map((trajectory) => trajectory.sessionKey)).size;\n if (sessionCount < minSessions) return false;\n\n const successThreshold = normalizeSuccessThreshold(config.successThreshold);\n if (successThreshold > 0 && averageSuccessScore(trajectories) < successThreshold) {\n return false;\n }\n\n return true;\n}\n\n// ─── Public API ──────────────────────────────────────────────────────────────\n\n/**\n * Run LLM-assisted consolidation: read trajectories, format causal context,\n * ask LLM to identify patterns and preferences.\n */\nexport async function deriveCausalPromotionCandidates(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n config: ConsolidationConfig;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n pluginConfig?: PluginConfig;\n llmClient?: ConsolidationLlmClient;\n}): Promise<CausalPatternCandidate[]> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (!passesConsolidationGates(trajectories, options.config)) return [];\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n\n // Format the causal context for the LLM\n let context = formatCausalContext(trajectories, chainIndex);\n\n // Append memory extensions block if available (#382)\n if (options.pluginConfig) {\n const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);\n if (extBlock.length > 0) {\n context += \"\\n\\n\" + extBlock;\n }\n }\n\n // If no LLM available, fall back to empty (no deterministic fallback)\n const llm = options.llmClient ?? new FallbackLlmClient(\n options.gatewayConfig,\n options.pluginConfig\n ? fallbackLlmRuntimeContextFromConfig(options.pluginConfig, {\n workspaceDir: options.workspaceDir ?? options.pluginConfig.workspaceDir,\n })\n : { workspaceDir: options.workspaceDir },\n );\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) {\n log.debug(\"[cmc] no LLM available for consolidation — skipping\");\n return [];\n }\n\n // Call LLM for pattern analysis\n const result = await consolidateWithLlm(context, llm, llmOptions);\n const candidates = llmResultToCandidates(result);\n\n log.debug(`[cmc] LLM consolidation produced ${candidates.length} rule(s) and ${result.preferences.length} preference(s)`);\n return candidates;\n } catch (error) {\n log.warn(`[cmc] consolidation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n}\n\n/**\n * Get LLM-synthesized preferences from causal trajectory analysis.\n * Returns formatted preference statements for recall injection.\n */\nexport async function synthesizeCausalPreferencesViaLlm(options: {\n memoryDir: string;\n causalTrajectoryStoreDir?: string;\n gatewayConfig?: GatewayConfig;\n gatewayAgentId?: string;\n modelChain?: AgentPersonaModelConfig;\n workspaceDir?: string;\n minTrajectories?: number;\n}): Promise<string | null> {\n try {\n const trajectories = await readAllTrajectories(options.memoryDir, options.causalTrajectoryStoreDir);\n if (trajectories.length < (options.minTrajectories ?? 2)) return null;\n\n const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);\n const chainIndex = await readChainIndex(chainsDir);\n const context = formatCausalContext(trajectories, chainIndex);\n\n const llm = new FallbackLlmClient(options.gatewayConfig, {\n workspaceDir: options.workspaceDir,\n });\n const llmOptions = { agentId: options.gatewayAgentId, modelChain: options.modelChain };\n if (!llm.isAvailable(llmOptions)) return null;\n\n const result = await consolidateWithLlm(context, llm, llmOptions);\n if (result.preferences.length === 0 && result.rules.length === 0) return null;\n\n const lines: string[] = [\"## Behavioral Insights (from Causal Chain Analysis)\", \"\"];\n\n for (const pref of result.preferences) {\n lines.push(`- ${pref.statement}`);\n }\n\n for (const rule of result.rules) {\n lines.push(`- ${rule.content}`);\n }\n\n lines.push(\"\");\n return lines.join(\"\\n\");\n } catch (error) {\n log.warn(`[cmc] preference synthesis failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n}\n\n/**\n * Optional post-consolidation hook — materializes Codex-native memory artifacts\n * after a causal consolidation run. Guarded by `codexMaterializeMemories` and\n * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the\n * sentinel is missing (honors user hand-edits).\n *\n * Split from the orchestrator-owned flow so #378 avoids touching\n * orchestrator.ts while Wave 1 edits are in flight.\n */\nexport async function materializeAfterCausalConsolidation(options: {\n config: PluginConfig;\n namespace?: string;\n memories?: MemoryFile[];\n memoryDir?: string;\n codexHome?: string;\n rolloutSummaries?: RolloutSummaryInput[];\n now?: Date;\n}): Promise<MaterializeResult | null> {\n // Delegates to the shared post-consolidation helper — see\n // runPostConsolidationMaterialize in codex-materialize-runner.ts.\n return runPostConsolidationMaterialize(\"[cmc]\", options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,kBAAkB;AAO3B,OAAO,UAAU;AA0CjB,IAAM,yBAAyB,oBAAI,IAAI,CAAC,QAAQ,aAAa,YAAY,CAAC;AAY1E,eAAe,oBACb,WACA,0BACmC;AACnC,QAAM,OAAO,gCAAgC,WAAW,wBAAwB;AAChF,QAAM,kBAAkB,KAAK,KAAK,MAAM,cAAc;AAEtD,QAAM,QAAQ,MAAM,cAAc,eAAe,EAAE,MA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|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NZPFCP5A.js";
|
|
5
5
|
import "./chunk-B7RWBZXW.js";
|
|
6
6
|
import {
|
|
7
7
|
readCausalTrajectoryRecords,
|
|
8
8
|
searchCausalTrajectories
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PP7R754B.js";
|
|
10
10
|
import "./chunk-YCVB7X56.js";
|
|
11
11
|
import "./chunk-A2IYSXDQ.js";
|
|
12
12
|
import "./chunk-P77QX3ID.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { a as GraphEdge } from './graph-444E-DrF.js';
|
|
2
2
|
import { CausalTrajectoryRecord } from './causal-trajectory.js';
|
|
3
3
|
import './capabilities.js';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-BrEzuxPA.js';
|
|
5
5
|
import './message-parts/index.js';
|
|
6
6
|
import './bounded-jsonl-state.js';
|
|
7
|
+
import './types-CM86alG1.js';
|
|
7
8
|
import './operator-doctor-types.js';
|
|
8
9
|
import './external-wiki-config.js';
|
|
9
10
|
import './contradiction-config.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendEdge
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BIJAWZYW.js";
|
|
4
|
+
import "./chunk-LXY5VVGM.js";
|
|
4
5
|
import "./chunk-2LSZVONP.js";
|
|
5
6
|
import "./chunk-DEUNUKTD.js";
|
|
6
|
-
import "./chunk-LXY5VVGM.js";
|
|
7
7
|
import "./chunk-PZ5AY32C.js";
|
|
8
8
|
|
|
9
9
|
// src/causal-trajectory-graph.ts
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveCausalTrajectoryStoreDir,
|
|
10
10
|
searchCausalTrajectories,
|
|
11
11
|
validateCausalTrajectoryRecord
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PP7R754B.js";
|
|
13
13
|
import "./chunk-YCVB7X56.js";
|
|
14
14
|
import "./chunk-A2IYSXDQ.js";
|
|
15
15
|
import "./chunk-P77QX3ID.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureLcmStateDir,
|
|
3
|
+
openLcmDatabase
|
|
4
|
+
} from "./chunk-DDA47TES.js";
|
|
1
5
|
import {
|
|
2
6
|
LcmSummarizer
|
|
3
7
|
} from "./chunk-ZPUIRTIZ.js";
|
|
@@ -13,10 +17,6 @@ import {
|
|
|
13
17
|
import {
|
|
14
18
|
assembleCompressedHistoryWithTrace
|
|
15
19
|
} from "./chunk-UXPUUL3G.js";
|
|
16
|
-
import {
|
|
17
|
-
ensureLcmStateDir,
|
|
18
|
-
openLcmDatabase
|
|
19
|
-
} from "./chunk-DDA47TES.js";
|
|
20
20
|
import {
|
|
21
21
|
estimateTokenCount
|
|
22
22
|
} from "./chunk-TOTT6S2V.js";
|
|
@@ -568,4 +568,4 @@ export {
|
|
|
568
568
|
extractLcmConfig,
|
|
569
569
|
LcmEngine
|
|
570
570
|
};
|
|
571
|
-
//# sourceMappingURL=chunk-
|
|
571
|
+
//# sourceMappingURL=chunk-256FBCVX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DEFI2QBT.js";
|
|
4
4
|
import {
|
|
5
5
|
keyring_exports,
|
|
6
6
|
secureStoreDir
|
|
@@ -412,4 +412,4 @@ export {
|
|
|
412
412
|
resolveNamespaceStorageRoot,
|
|
413
413
|
NamespaceStorageRouter
|
|
414
414
|
};
|
|
415
|
-
//# sourceMappingURL=chunk-
|
|
415
|
+
//# sourceMappingURL=chunk-2572MRP2.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
WHO_KNOWS_DEFAULT_LIMIT,
|
|
3
3
|
WHO_KNOWS_MAX_LIMIT,
|
|
4
4
|
validateWhoKnowsInput
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R3AAOKR2.js";
|
|
6
6
|
|
|
7
7
|
// src/who-knows-cli.ts
|
|
8
8
|
function extractWhoKnowsRawArgs(rest) {
|
|
@@ -74,4 +74,4 @@ export {
|
|
|
74
74
|
renderWhoKnowsText,
|
|
75
75
|
renderWhoKnows
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-3MADV4YC.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
computeWhoKnows,
|
|
22
22
|
loadWhoKnowsEntities,
|
|
23
23
|
validateWhoKnowsInput
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-R3AAOKR2.js";
|
|
25
25
|
import {
|
|
26
26
|
trustResultFor
|
|
27
27
|
} from "./chunk-GNVZQ5JN.js";
|
|
@@ -40,36 +40,36 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
planSessionTranscriptMigration
|
|
42
42
|
} from "./chunk-P5FPO2BR.js";
|
|
43
|
-
import {
|
|
44
|
-
toRecallExplainJson
|
|
45
|
-
} from "./chunk-SHQFYZTD.js";
|
|
46
|
-
import {
|
|
47
|
-
estimateRecallTokens
|
|
48
|
-
} from "./chunk-IFK3PVM7.js";
|
|
49
43
|
import {
|
|
50
44
|
decideDisclosureEscalation
|
|
51
45
|
} from "./chunk-H7XKCNR6.js";
|
|
52
46
|
import {
|
|
53
|
-
|
|
54
|
-
} from "./chunk-
|
|
47
|
+
toRecallExplainJson
|
|
48
|
+
} from "./chunk-W6TSGWYS.js";
|
|
55
49
|
import {
|
|
56
|
-
|
|
57
|
-
} from "./chunk-
|
|
50
|
+
estimateRecallTokens
|
|
51
|
+
} from "./chunk-VPGRXEAB.js";
|
|
58
52
|
import {
|
|
59
|
-
|
|
60
|
-
} from "./chunk-
|
|
53
|
+
readAggregateExtractionWatermark
|
|
54
|
+
} from "./chunk-4W6INNXO.js";
|
|
61
55
|
import {
|
|
62
56
|
recordObjectiveStateSnapshotsFromObservedMessages
|
|
63
57
|
} from "./chunk-2HIJHXB3.js";
|
|
64
58
|
import {
|
|
65
59
|
objectiveStateStoreOverrideForNamespace
|
|
66
60
|
} from "./chunk-HTP6XRUI.js";
|
|
61
|
+
import {
|
|
62
|
+
ReplicaDivergenceMonitor
|
|
63
|
+
} from "./chunk-CVILPI77.js";
|
|
64
|
+
import {
|
|
65
|
+
recordMemoryOutcome
|
|
66
|
+
} from "./chunk-EIR5VLIH.js";
|
|
67
67
|
import {
|
|
68
68
|
coerceIncludedMemories
|
|
69
69
|
} from "./chunk-2YA5N2BY.js";
|
|
70
70
|
import {
|
|
71
71
|
buildGraphSnapshot
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-OUKBMQ2O.js";
|
|
73
73
|
import {
|
|
74
74
|
REDACTION_RULES_SUBDIR
|
|
75
75
|
} from "./chunk-LTHVM4XN.js";
|
|
@@ -87,14 +87,11 @@ import {
|
|
|
87
87
|
} from "./chunk-NLE6TSLG.js";
|
|
88
88
|
import {
|
|
89
89
|
LocalLlmClient
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-IVKIODHO.js";
|
|
91
91
|
import {
|
|
92
92
|
buildProcedurePersistBody,
|
|
93
93
|
normalizeProcedureSteps
|
|
94
94
|
} from "./chunk-QDW3E4RD.js";
|
|
95
|
-
import {
|
|
96
|
-
lcmEvidenceIdentity
|
|
97
|
-
} from "./chunk-C37ZRXX7.js";
|
|
98
95
|
import {
|
|
99
96
|
persistExplicitCapture,
|
|
100
97
|
queueExplicitCaptureForReview,
|
|
@@ -105,6 +102,13 @@ import {
|
|
|
105
102
|
composeRecallContext,
|
|
106
103
|
renderAuthorityBoundContent
|
|
107
104
|
} from "./chunk-7ZNJN5WZ.js";
|
|
105
|
+
import {
|
|
106
|
+
lcmEvidenceIdentity
|
|
107
|
+
} from "./chunk-C37ZRXX7.js";
|
|
108
|
+
import {
|
|
109
|
+
CrossNamespaceBudget,
|
|
110
|
+
toBudgetWarning
|
|
111
|
+
} from "./chunk-UFGFMWAD.js";
|
|
108
112
|
import {
|
|
109
113
|
buildProposedActions,
|
|
110
114
|
buildQualityScore,
|
|
@@ -112,50 +116,46 @@ import {
|
|
|
112
116
|
listMemoryGovernanceRuns,
|
|
113
117
|
readMemoryGovernanceRunArtifact,
|
|
114
118
|
runMemoryGovernance
|
|
115
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-SYJ6EKKE.js";
|
|
116
120
|
import {
|
|
117
121
|
CorpusWatermarkCache,
|
|
118
122
|
computeServiceCorpusCensus
|
|
119
|
-
} from "./chunk-
|
|
120
|
-
import {
|
|
121
|
-
CrossNamespaceBudget,
|
|
122
|
-
toBudgetWarning
|
|
123
|
-
} from "./chunk-UFGFMWAD.js";
|
|
123
|
+
} from "./chunk-53ENM6F6.js";
|
|
124
124
|
import {
|
|
125
125
|
ExtractionDeadlineError,
|
|
126
126
|
isActivityDigestPath,
|
|
127
127
|
isArtifactMemoryPath,
|
|
128
128
|
isLocationDayPath,
|
|
129
129
|
isMeetingRecordPath
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-S2VBSTTA.js";
|
|
131
131
|
import {
|
|
132
132
|
defaultCapsulesDir
|
|
133
133
|
} from "./chunk-ZY2MNJR6.js";
|
|
134
134
|
import {
|
|
135
135
|
filterTrajectoriesByLookbackDays,
|
|
136
136
|
readCausalTrajectoryRecords
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-PP7R754B.js";
|
|
138
138
|
import {
|
|
139
139
|
FileCalendarSource,
|
|
140
140
|
buildBriefing,
|
|
141
141
|
enqueuePassiveCorrectionNotification,
|
|
142
142
|
parseBriefingFocus,
|
|
143
143
|
parseBriefingWindow
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-3TMYV3LP.js";
|
|
145
145
|
import {
|
|
146
146
|
parseEntityFile,
|
|
147
147
|
parseFrontmatter,
|
|
148
148
|
qmdCollectionPathParts,
|
|
149
149
|
qmdResultPathCandidates,
|
|
150
150
|
selfDeps
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-DEFI2QBT.js";
|
|
152
152
|
import {
|
|
153
153
|
namespaceCollectionName
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-X5SDZMO7.js";
|
|
155
155
|
import {
|
|
156
156
|
DEFAULT_RECALL_DISCLOSURE,
|
|
157
157
|
isRecallDisclosure
|
|
158
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-JFJ3MHGV.js";
|
|
159
159
|
import {
|
|
160
160
|
normalizeProjectionPreview,
|
|
161
161
|
normalizeProjectionTags
|
|
@@ -17705,4 +17705,4 @@ export {
|
|
|
17705
17705
|
EngramAccessService,
|
|
17706
17706
|
AccessAdminOpsSurface
|
|
17707
17707
|
};
|
|
17708
|
-
//# sourceMappingURL=chunk-
|
|
17708
|
+
//# sourceMappingURL=chunk-3PXVYJMC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runGraphEdgeDecayMaintenanceAcrossNamespaces
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OLBZ2WGG.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeDreamsStatusWindowHours
|
|
6
6
|
} from "./chunk-EQWEIIKQ.js";
|
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
defineOperation,
|
|
33
33
|
parseNamespacePreflightWriteOp,
|
|
34
34
|
resolveAuthorizedNamespaceWritablePreflight
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-3PXVYJMC.js";
|
|
36
36
|
import {
|
|
37
37
|
validateBriefingFormat
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-3TMYV3LP.js";
|
|
39
39
|
import {
|
|
40
40
|
enforceNamespaceAllowList,
|
|
41
41
|
tokenCapabilityStore
|
|
@@ -518,4 +518,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
|
|
|
518
518
|
defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
519
519
|
defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
|
|
520
520
|
defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
|
|
521
|
-
//# sourceMappingURL=chunk-
|
|
521
|
+
//# sourceMappingURL=chunk-3RHFGGI5.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DEFI2QBT.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeEntityName
|
|
6
6
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -957,4 +957,4 @@ export {
|
|
|
957
957
|
resolveBriefingSaveDir,
|
|
958
958
|
briefingFilename
|
|
959
959
|
};
|
|
960
|
-
//# sourceMappingURL=chunk-
|
|
960
|
+
//# sourceMappingURL=chunk-3TMYV3LP.js.map
|