@remnic/core 9.65.0 → 9.65.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +11 -11
- package/dist/access-admin-ops-surface.js +45 -43
- package/dist/access-authorization-probe.d.ts +12 -13
- package/dist/access-authorization-probe.js +46 -44
- package/dist/access-boundary.d.ts +12 -156
- package/dist/access-boundary.js +45 -43
- package/dist/access-cli.js +120 -116
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +11 -11
- package/dist/access-extraction-force-flush.js +45 -43
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http-lifecycle-flush.d.ts +12 -13
- package/dist/access-http-offline-stream.d.ts +11 -11
- package/dist/access-http-query.d.ts +2 -2
- package/dist/access-http-query.js +47 -45
- package/dist/access-http.d.ts +12 -12
- package/dist/access-http.js +65 -63
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +45 -43
- package/dist/access-lcm-surface.d.ts +11 -11
- package/dist/access-lcm-surface.js +45 -43
- package/dist/access-mcp-admin-tools.js +1 -1
- package/dist/access-mcp-output-schemas.js +1 -1
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +58 -54
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-AqlR0w02.d.ts → access-namespace-preflight-Dhvcl-T0.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +45 -43
- package/dist/access-observe-write-surface.d.ts +11 -11
- package/dist/access-observe-write-surface.js +45 -43
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-offline-manifest.js +5 -5
- package/dist/access-operations-batch.js +49 -47
- package/dist/access-operations.d.ts +18 -19
- package/dist/access-operations.js +52 -50
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +45 -43
- package/dist/access-recall-response.d.ts +11 -11
- package/dist/access-recall-response.js +45 -43
- package/dist/access-recall-surface.d.ts +11 -11
- package/dist/access-recall-surface.js +45 -43
- package/dist/access-schema.d.ts +118 -118
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-BHmtl9BA.d.ts → access-service-Bke1alZO.d.ts} +484 -80
- package/dist/access-service-helpers.d.ts +11 -11
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +45 -43
- package/dist/access-surface-catalog.d.ts +12 -13
- package/dist/access-surface-catalog.js +49 -45
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +3 -3
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +6 -1
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-5L7EUZ27.js → auto-sync-H64ZCNIR.js} +13 -5
- package/dist/{auto-sync-5L7EUZ27.js.map → auto-sync-H64ZCNIR.js.map} +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing-window.d.ts +2 -2
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +19 -17
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +4 -4
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/calibration.js +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{catalog-gBoyN-IW.d.ts → catalog-DV6qnbr7.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +22 -20
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-A6LBDIFS.js → chunk-2E36UXVW.js} +2 -2
- package/dist/{chunk-RRJUMSFX.js → chunk-2XDWWPTN.js} +3 -3
- package/dist/{chunk-QCNB4BRE.js → chunk-2YI72KM3.js} +3 -3
- package/dist/{chunk-3YTTAGPB.js → chunk-3DVBKTSO.js} +2 -2
- package/dist/{chunk-IFK3PVM7.js → chunk-3I7ASZN3.js} +2 -2
- package/dist/chunk-3WU7XOFN.js +102 -0
- package/dist/chunk-3WU7XOFN.js.map +1 -0
- package/dist/{chunk-EIR5VLIH.js → chunk-4K7IW3F7.js} +2 -2
- package/dist/chunk-4K7IW3F7.js.map +1 -0
- package/dist/{chunk-HBKFYXBA.js → chunk-4KYOLI6M.js} +15 -15
- package/dist/chunk-573TEZCD.js +88 -0
- package/dist/chunk-573TEZCD.js.map +1 -0
- package/dist/{chunk-RNKNL5GQ.js → chunk-5NM4OH4P.js} +3 -3
- package/dist/{chunk-CESQ4CMC.js → chunk-5YQ63T4B.js} +2 -2
- package/dist/{chunk-PMVPCZJZ.js → chunk-6433HV72.js} +2 -2
- package/dist/{chunk-4NZHHGVL.js → chunk-7BDZTALN.js} +4 -1
- package/dist/chunk-7BDZTALN.js.map +1 -0
- package/dist/{chunk-NS5ETDYD.js → chunk-7BEPVIH3.js} +3 -3
- package/dist/{chunk-JG22O53B.js → chunk-7CBKAQIG.js} +2 -1
- package/dist/chunk-7CBKAQIG.js.map +1 -0
- package/dist/{chunk-SHQFYZTD.js → chunk-7YQ4IYS2.js} +2 -2
- package/dist/chunk-AAXJNINV.js +55 -0
- package/dist/chunk-AAXJNINV.js.map +1 -0
- package/dist/{chunk-YMOPYG3K.js → chunk-BIJAWZYW.js} +6 -6
- package/dist/{chunk-YQ3CBLL4.js → chunk-BWLRUMOG.js} +78 -8
- package/dist/chunk-BWLRUMOG.js.map +1 -0
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-VYEPACWY.js → chunk-C24UZSFW.js} +2 -2
- package/dist/{chunk-ZPN7W3OP.js → chunk-CDUUDBWJ.js} +3 -3
- package/dist/{chunk-K7JMKLKV.js → chunk-CT56C22C.js} +4 -4
- package/dist/{chunk-KWIGDKM2.js → chunk-D2YNNDML.js} +2 -2
- package/dist/{chunk-ZFBZ4QTS.js → chunk-DJZWNKFO.js} +10 -10
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-VNIETTMR.js → chunk-DZUJ46DO.js} +2 -2
- package/dist/{chunk-T6QMNVMO.js → chunk-EILZG5VC.js} +2 -2
- package/dist/{chunk-652S5A5D.js → chunk-EUYWQ7TS.js} +2 -2
- package/dist/{chunk-YIZRTHHF.js → chunk-GDFVPUJ5.js} +2 -2
- package/dist/{chunk-ML3U4KPR.js → chunk-GIC6BASP.js} +2 -2
- package/dist/{chunk-7PWWGYGO.js → chunk-GNCCUR6K.js} +2 -2
- package/dist/{chunk-Y5UT73VZ.js → chunk-IID2CMUU.js} +2 -2
- package/dist/{chunk-MB6GLPRY.js → chunk-IVKIODHO.js} +4 -4
- package/dist/{chunk-ZAI5R6DW.js → chunk-J275IYMG.js} +26 -17
- package/dist/chunk-J275IYMG.js.map +1 -0
- package/dist/{chunk-UYCIS6V5.js → chunk-JCWY73FK.js} +2 -2
- package/dist/{chunk-URS5GSM7.js → chunk-JXN77SGO.js} +1 -1
- package/dist/chunk-JXN77SGO.js.map +1 -0
- package/dist/{chunk-WHA6ISFX.js → chunk-JYYBA7TF.js} +2 -2
- package/dist/{chunk-T42L3S6A.js → chunk-LBWQ65SX.js} +4 -4
- package/dist/{chunk-MSTNSVXI.js → chunk-LDBFXD4F.js} +2 -1
- package/dist/chunk-LDBFXD4F.js.map +1 -0
- package/dist/{chunk-JXMXTV6C.js → chunk-LGO6A7GJ.js} +56 -56
- package/dist/{chunk-XBRGJJK7.js → chunk-LUNJ3WFO.js} +10 -8
- package/dist/chunk-LUNJ3WFO.js.map +1 -0
- package/dist/{chunk-H6B6GPVH.js → chunk-LZH5FR2W.js} +2 -2
- package/dist/{chunk-5HERQ5FX.js → chunk-M4AHBM72.js} +10 -10
- package/dist/{chunk-GOGHZVY3.js → chunk-MN4KB2A4.js} +3 -3
- package/dist/{chunk-OQIRBGUU.js → chunk-N37X5RU7.js} +2 -2
- package/dist/{chunk-E6EQTCOQ.js → chunk-NKKD4ZAU.js} +2 -2
- package/dist/{chunk-VANZKHTN.js → chunk-NNBZS3DY.js} +2 -2
- package/dist/{chunk-IWUN4RZL.js → chunk-NTWN6HB2.js} +5 -5
- package/dist/{chunk-2PSX5BJU.js → chunk-NZPFCP5A.js} +2 -2
- package/dist/{chunk-U56TGYVS.js → chunk-OCZIYAE5.js} +4 -4
- package/dist/{chunk-I2HTKOOP.js → chunk-ODZG724P.js} +2 -2
- package/dist/{chunk-LTBKKSCX.js → chunk-OLBZ2WGG.js} +2 -2
- package/dist/{chunk-GQ5OJVTM.js → chunk-OTHZWLUD.js} +2 -2
- package/dist/{chunk-PD66CVSD.js → chunk-OUKBMQ2O.js} +2 -2
- package/dist/{chunk-4E6IJCLC.js → chunk-PE255F4T.js} +2 -2
- package/dist/{chunk-GPFZFCRN.js → chunk-PP7R754B.js} +1 -1
- package/dist/{chunk-PHX3ET3C.js → chunk-QOS5LBZN.js} +2 -2
- package/dist/{chunk-G72IPMR7.js → chunk-R4OCGPSH.js} +2 -2
- package/dist/{chunk-VUP47UJI.js → chunk-R7JAM2XF.js} +3 -3
- package/dist/{chunk-LCU5R6TQ.js → chunk-RAIUTAZZ.js} +22 -3
- package/dist/chunk-RAIUTAZZ.js.map +1 -0
- package/dist/chunk-RIAM7DND.js +167 -0
- package/dist/chunk-RIAM7DND.js.map +1 -0
- package/dist/{chunk-JBPKEARU.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/{chunk-P4CQCL27.js → chunk-S2DPMJXH.js} +2 -2
- package/dist/{chunk-YHSNAGN3.js → chunk-SB7D4BT7.js} +548 -126
- package/dist/chunk-SB7D4BT7.js.map +1 -0
- package/dist/{chunk-VRYEXPRX.js → chunk-SBDCZ2AX.js} +1 -1
- package/dist/chunk-SBDCZ2AX.js.map +1 -0
- package/dist/{chunk-OXL5QKTV.js → chunk-SIHSCCUQ.js} +1 -1
- package/dist/{chunk-KLPVXLQJ.js → chunk-SPUJNJJC.js} +2 -2
- package/dist/{chunk-CCP6LXQJ.js → chunk-SQI57UCJ.js} +2 -2
- package/dist/{chunk-UIYYS2YI.js → chunk-SVSRPG6M.js} +2 -2
- package/dist/{chunk-56BSXSHC.js → chunk-TBOJ76ER.js} +14 -1
- package/dist/{chunk-56BSXSHC.js.map → chunk-TBOJ76ER.js.map} +1 -1
- package/dist/{chunk-RQYV6M2T.js → chunk-TF77C7SV.js} +14 -7
- package/dist/chunk-TF77C7SV.js.map +1 -0
- package/dist/{chunk-RNORDDD6.js → chunk-THG4GYIE.js} +2 -2
- package/dist/{chunk-CUIAHZPZ.js → chunk-TR7DGXGI.js} +2 -2
- package/dist/{chunk-GEULB2VI.js → chunk-TZNQUNKL.js} +7 -1
- package/dist/chunk-TZNQUNKL.js.map +1 -0
- package/dist/{chunk-PDKBKBC2.js → chunk-UIN2BWDD.js} +2 -2
- package/dist/{chunk-4GD7YV4Y.js → chunk-UXO5IMBK.js} +3 -3
- package/dist/{chunk-UPIKAT5A.js → chunk-V3MXUL3D.js} +173 -77
- package/dist/chunk-V3MXUL3D.js.map +1 -0
- package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-MUJ4QFUQ.js → chunk-W4BMEGQA.js} +4 -4
- package/dist/{chunk-5HK3CJAR.js → chunk-W675UJCZ.js} +2 -2
- package/dist/{chunk-MDVBCPOS.js → chunk-XCTXS7VY.js} +2 -2
- package/dist/{chunk-NTERJOFA.js → chunk-XRYZRW54.js} +2 -2
- package/dist/{chunk-LA2MSK23.js → chunk-Y7DK7HHJ.js} +2 -2
- package/dist/{chunk-34BMUGRA.js → chunk-YB42WZCY.js} +2 -2
- package/dist/{chunk-LWVG6U7L.js → chunk-YHCBJULX.js} +2 -2
- package/dist/{chunk-HDD4RRIX.js → chunk-YLDXWCZP.js} +21 -6
- package/dist/chunk-YLDXWCZP.js.map +1 -0
- package/dist/{chunk-VYISFWVX.js → chunk-YQNNHLCG.js} +2 -2
- package/dist/{chunk-FFPBTNLC.js → chunk-Z7PBQPJ4.js} +2 -2
- package/dist/{chunk-MXJU4GCA.js → chunk-ZO6AXLEH.js} +2 -2
- package/dist/{chunk-JNSLW2O4.js → chunk-ZQHI2BZB.js} +2 -2
- package/dist/{chunk-A4VJKT2H.js → chunk-ZWXJBFZU.js} +11 -11
- package/dist/chunk-ZWXJBFZU.js.map +1 -0
- package/dist/{cli-BpwTNHTm.d.ts → cli-cShQ13XG.d.ts} +5 -5
- package/dist/cli.d.ts +13 -13
- package/dist/cli.js +89 -86
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +20 -18
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +6 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +19 -17
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +19 -17
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +10 -2
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +21 -19
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/corpus-watermark.d.ts +1 -1
- package/dist/corpus-watermark.js +21 -19
- package/dist/cross-lingual-recall.d.ts +70 -0
- package/dist/cross-lingual-recall.js +14 -0
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-QYJ1-c2M.d.ts → dependency-propagation-delivery-CsGg-VwS.d.ts} +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-origin-fields.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +19 -17
- package/dist/entity-schema.d.ts +1 -1
- package/dist/episodic-context.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +7 -6
- package/dist/external-wiki-access.d.ts +12 -13
- package/dist/external-wiki-access.js +46 -44
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +11 -11
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction-judge.js +2 -2
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-normalization.d.ts +1 -1
- package/dist/extraction-normalization.js +2 -2
- package/dist/extraction-prompt.d.ts +2 -2
- package/dist/extraction-prompt.js +1 -1
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/extraction.js +27 -25
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/{graph-edge-decay-A4SDFMMS.js → graph-edge-decay-FXGELBFA.js} +4 -4
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +3 -3
- package/dist/harmonic-retrieval.js +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/index.d.ts +718 -701
- package/dist/index.js +188 -139
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +4 -4
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +10 -10
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +19 -17
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -17
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +20 -18
- package/dist/{maintenance-BjEr3WKG.d.ts → maintenance-jhMpeGne.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -11
- package/dist/mcp-read-only-tools.js +1 -1
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-subject-cli.d.ts +177 -0
- package/dist/memory-subject-cli.js +16 -0
- package/dist/memory-subject-cli.js.map +1 -0
- package/dist/memory-subject.d.ts +128 -0
- package/dist/memory-subject.js +44 -0
- package/dist/memory-subject.js.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +5 -4
- package/dist/memory-worth-outcomes.js +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +20 -18
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +9 -9
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +19 -17
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +22 -20
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +31 -28
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +25 -23
- package/dist/{orchestrator-CC4USYcD.d.ts → orchestrator-DyGUC7re.d.ts} +8 -8
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +120 -116
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-DWgAgvJN.d.ts → pipeline-C25Oxtp1.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{public-http-CkQC8VpD.d.ts → public-http-CMe7NQzj.d.ts} +1 -1
- package/dist/{qmd-BJGhj4ta.d.ts → qmd-DkDVCbgF.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/qmd.js +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/manifest.js +3 -3
- package/dist/reconcile/plan.d.ts +1 -1
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/{resolution-DKMBPXHI.js → resolution-MFY72STR.js} +11 -3
- package/dist/resolution-MFY72STR.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +7 -2
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/salvage-envelope.d.ts +1 -1
- package/dist/salvage-envelope.js +10 -2
- package/dist/schemas.d.ts +122 -108
- package/dist/schemas.js +1 -1
- package/dist/{scope-profiles-C4PdBYKc.d.ts → scope-profiles-B9xMoFO-.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +8 -8
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +14 -14
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +2 -2
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/search/remote-backend.js +2 -2
- package/dist/{semantic-consolidation-5-HOmIhL.d.ts → semantic-consolidation-C4uykW84.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +20 -18
- package/dist/semantic-rule-promotion.js +19 -17
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +19 -17
- package/dist/{service-8pDy6w8u.d.ts → service-DCZDZNcV.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +11 -11
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +21 -19
- package/dist/{storage-VpDzURiA.d.ts → storage-CcKmEjL8.d.ts} +3 -2
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +21 -19
- package/dist/subject-config.d.ts +38 -0
- package/dist/subject-config.js +20 -0
- package/dist/subject-config.js.map +1 -0
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +14 -14
- package/dist/support-passport/index.js +48 -46
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/types.d.ts +66 -66
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-D9gKdB79.d.ts → types-Pi0lfaEt.d.ts} +40 -29
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +19 -17
- package/dist/who-knows-cli.d.ts +11 -11
- package/dist/who-knows-cli.js +20 -18
- package/dist/who-knows.d.ts +11 -11
- package/dist/who-knows.js +19 -17
- package/dist/write-envelope.d.ts +5 -2
- package/dist/write-envelope.js +10 -1
- package/package.json +2 -2
- package/scripts/build-with-heap.mjs +1 -1
- package/src/access-boundary.ts +2 -0
- package/src/access-mcp-admin-tools.ts +14 -0
- package/src/access-mcp-output-schemas.ts +6 -0
- package/src/access-mcp.ts +6 -6
- package/src/access-operations-batch.ts +8 -0
- package/src/access-service.ts +85 -0
- package/src/access-surface-catalog.ts +2 -0
- package/src/config.ts +10 -17
- package/src/cross-lingual-recall.test.ts +47 -0
- package/src/cross-lingual-recall.ts +186 -0
- package/src/extraction-prompt.ts +1 -0
- package/src/extraction.ts +4 -1
- package/src/index.ts +5 -6
- package/src/mcp-read-only-tools.ts +1 -0
- package/src/memory-subject-cli.ts +135 -0
- package/src/memory-subject.test.ts +48 -0
- package/src/memory-subject.ts +314 -0
- package/src/memory-worth-outcomes.test.ts +6 -2
- package/src/memory-worth-outcomes.ts +11 -7
- package/src/operator-toolkit.ts +1 -1
- package/src/orchestration/extraction-persist.ts +48 -48
- package/src/orchestration/recall-internal-deps.ts +2 -0
- package/src/orchestration/recall-internal.ts +41 -38
- package/src/orchestration/recall-search-pipeline.ts +16 -0
- package/src/procedural/library-maintenance.test.ts +582 -0
- package/src/procedural/library-maintenance.ts +546 -0
- package/src/procedural/maintenance-config.ts +78 -0
- package/src/procedural/procedure-recall.ts +29 -1
- package/src/procedural/procedure-stats.ts +20 -0
- package/src/schemas.ts +7 -0
- package/src/search/port.ts +2 -1
- package/src/spaces/index.ts +38 -2
- package/src/storage.ts +11 -3
- package/src/subject-config.ts +80 -0
- package/src/types.ts +28 -29
- package/src/write-envelope.test.ts +14 -0
- package/src/write-envelope.ts +24 -3
- package/dist/chunk-4NZHHGVL.js.map +0 -1
- package/dist/chunk-A4VJKT2H.js.map +0 -1
- package/dist/chunk-EIR5VLIH.js.map +0 -1
- package/dist/chunk-GEULB2VI.js.map +0 -1
- package/dist/chunk-HDD4RRIX.js.map +0 -1
- package/dist/chunk-JG22O53B.js.map +0 -1
- package/dist/chunk-LCU5R6TQ.js.map +0 -1
- package/dist/chunk-MSTNSVXI.js.map +0 -1
- package/dist/chunk-RQYV6M2T.js.map +0 -1
- package/dist/chunk-UPIKAT5A.js.map +0 -1
- package/dist/chunk-URS5GSM7.js.map +0 -1
- package/dist/chunk-VRYEXPRX.js.map +0 -1
- package/dist/chunk-XBRGJJK7.js.map +0 -1
- package/dist/chunk-YHSNAGN3.js.map +0 -1
- package/dist/chunk-YQ3CBLL4.js.map +0 -1
- package/dist/chunk-ZAI5R6DW.js.map +0 -1
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-A6LBDIFS.js.map → chunk-2E36UXVW.js.map} +0 -0
- /package/dist/{chunk-RRJUMSFX.js.map → chunk-2XDWWPTN.js.map} +0 -0
- /package/dist/{chunk-QCNB4BRE.js.map → chunk-2YI72KM3.js.map} +0 -0
- /package/dist/{chunk-3YTTAGPB.js.map → chunk-3DVBKTSO.js.map} +0 -0
- /package/dist/{chunk-IFK3PVM7.js.map → chunk-3I7ASZN3.js.map} +0 -0
- /package/dist/{chunk-HBKFYXBA.js.map → chunk-4KYOLI6M.js.map} +0 -0
- /package/dist/{chunk-RNKNL5GQ.js.map → chunk-5NM4OH4P.js.map} +0 -0
- /package/dist/{chunk-CESQ4CMC.js.map → chunk-5YQ63T4B.js.map} +0 -0
- /package/dist/{chunk-PMVPCZJZ.js.map → chunk-6433HV72.js.map} +0 -0
- /package/dist/{chunk-NS5ETDYD.js.map → chunk-7BEPVIH3.js.map} +0 -0
- /package/dist/{chunk-SHQFYZTD.js.map → chunk-7YQ4IYS2.js.map} +0 -0
- /package/dist/{chunk-YMOPYG3K.js.map → chunk-BIJAWZYW.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-VYEPACWY.js.map → chunk-C24UZSFW.js.map} +0 -0
- /package/dist/{chunk-ZPN7W3OP.js.map → chunk-CDUUDBWJ.js.map} +0 -0
- /package/dist/{chunk-K7JMKLKV.js.map → chunk-CT56C22C.js.map} +0 -0
- /package/dist/{chunk-KWIGDKM2.js.map → chunk-D2YNNDML.js.map} +0 -0
- /package/dist/{chunk-ZFBZ4QTS.js.map → chunk-DJZWNKFO.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-VNIETTMR.js.map → chunk-DZUJ46DO.js.map} +0 -0
- /package/dist/{chunk-T6QMNVMO.js.map → chunk-EILZG5VC.js.map} +0 -0
- /package/dist/{chunk-652S5A5D.js.map → chunk-EUYWQ7TS.js.map} +0 -0
- /package/dist/{chunk-YIZRTHHF.js.map → chunk-GDFVPUJ5.js.map} +0 -0
- /package/dist/{chunk-ML3U4KPR.js.map → chunk-GIC6BASP.js.map} +0 -0
- /package/dist/{chunk-7PWWGYGO.js.map → chunk-GNCCUR6K.js.map} +0 -0
- /package/dist/{chunk-Y5UT73VZ.js.map → chunk-IID2CMUU.js.map} +0 -0
- /package/dist/{chunk-MB6GLPRY.js.map → chunk-IVKIODHO.js.map} +0 -0
- /package/dist/{chunk-UYCIS6V5.js.map → chunk-JCWY73FK.js.map} +0 -0
- /package/dist/{chunk-WHA6ISFX.js.map → chunk-JYYBA7TF.js.map} +0 -0
- /package/dist/{chunk-T42L3S6A.js.map → chunk-LBWQ65SX.js.map} +0 -0
- /package/dist/{chunk-JXMXTV6C.js.map → chunk-LGO6A7GJ.js.map} +0 -0
- /package/dist/{chunk-H6B6GPVH.js.map → chunk-LZH5FR2W.js.map} +0 -0
- /package/dist/{chunk-5HERQ5FX.js.map → chunk-M4AHBM72.js.map} +0 -0
- /package/dist/{chunk-GOGHZVY3.js.map → chunk-MN4KB2A4.js.map} +0 -0
- /package/dist/{chunk-OQIRBGUU.js.map → chunk-N37X5RU7.js.map} +0 -0
- /package/dist/{chunk-E6EQTCOQ.js.map → chunk-NKKD4ZAU.js.map} +0 -0
- /package/dist/{chunk-VANZKHTN.js.map → chunk-NNBZS3DY.js.map} +0 -0
- /package/dist/{chunk-IWUN4RZL.js.map → chunk-NTWN6HB2.js.map} +0 -0
- /package/dist/{chunk-2PSX5BJU.js.map → chunk-NZPFCP5A.js.map} +0 -0
- /package/dist/{chunk-U56TGYVS.js.map → chunk-OCZIYAE5.js.map} +0 -0
- /package/dist/{chunk-I2HTKOOP.js.map → chunk-ODZG724P.js.map} +0 -0
- /package/dist/{chunk-LTBKKSCX.js.map → chunk-OLBZ2WGG.js.map} +0 -0
- /package/dist/{chunk-GQ5OJVTM.js.map → chunk-OTHZWLUD.js.map} +0 -0
- /package/dist/{chunk-PD66CVSD.js.map → chunk-OUKBMQ2O.js.map} +0 -0
- /package/dist/{chunk-4E6IJCLC.js.map → chunk-PE255F4T.js.map} +0 -0
- /package/dist/{chunk-GPFZFCRN.js.map → chunk-PP7R754B.js.map} +0 -0
- /package/dist/{chunk-PHX3ET3C.js.map → chunk-QOS5LBZN.js.map} +0 -0
- /package/dist/{chunk-G72IPMR7.js.map → chunk-R4OCGPSH.js.map} +0 -0
- /package/dist/{chunk-VUP47UJI.js.map → chunk-R7JAM2XF.js.map} +0 -0
- /package/dist/{chunk-JBPKEARU.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-P4CQCL27.js.map → chunk-S2DPMJXH.js.map} +0 -0
- /package/dist/{chunk-OXL5QKTV.js.map → chunk-SIHSCCUQ.js.map} +0 -0
- /package/dist/{chunk-KLPVXLQJ.js.map → chunk-SPUJNJJC.js.map} +0 -0
- /package/dist/{chunk-CCP6LXQJ.js.map → chunk-SQI57UCJ.js.map} +0 -0
- /package/dist/{chunk-UIYYS2YI.js.map → chunk-SVSRPG6M.js.map} +0 -0
- /package/dist/{chunk-RNORDDD6.js.map → chunk-THG4GYIE.js.map} +0 -0
- /package/dist/{chunk-CUIAHZPZ.js.map → chunk-TR7DGXGI.js.map} +0 -0
- /package/dist/{chunk-PDKBKBC2.js.map → chunk-UIN2BWDD.js.map} +0 -0
- /package/dist/{chunk-4GD7YV4Y.js.map → chunk-UXO5IMBK.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-MUJ4QFUQ.js.map → chunk-W4BMEGQA.js.map} +0 -0
- /package/dist/{chunk-5HK3CJAR.js.map → chunk-W675UJCZ.js.map} +0 -0
- /package/dist/{chunk-MDVBCPOS.js.map → chunk-XCTXS7VY.js.map} +0 -0
- /package/dist/{chunk-NTERJOFA.js.map → chunk-XRYZRW54.js.map} +0 -0
- /package/dist/{chunk-LA2MSK23.js.map → chunk-Y7DK7HHJ.js.map} +0 -0
- /package/dist/{chunk-34BMUGRA.js.map → chunk-YB42WZCY.js.map} +0 -0
- /package/dist/{chunk-LWVG6U7L.js.map → chunk-YHCBJULX.js.map} +0 -0
- /package/dist/{chunk-VYISFWVX.js.map → chunk-YQNNHLCG.js.map} +0 -0
- /package/dist/{chunk-FFPBTNLC.js.map → chunk-Z7PBQPJ4.js.map} +0 -0
- /package/dist/{chunk-MXJU4GCA.js.map → chunk-ZO6AXLEH.js.map} +0 -0
- /package/dist/{chunk-JNSLW2O4.js.map → chunk-ZQHI2BZB.js.map} +0 -0
- /package/dist/{graph-edge-decay-A4SDFMMS.js.map → cross-lingual-recall.js.map} +0 -0
- /package/dist/{resolution-DKMBPXHI.js.map → graph-edge-decay-FXGELBFA.js.map} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/cross-lingual-recall.ts
|
|
2
|
+
var SCRIPT_RANGES = [
|
|
3
|
+
["latn", 65, 90],
|
|
4
|
+
["latn", 97, 122],
|
|
5
|
+
["latn", 192, 591],
|
|
6
|
+
["grek", 880, 1023],
|
|
7
|
+
["cyrl", 1024, 1279],
|
|
8
|
+
["cyrl", 1280, 1327],
|
|
9
|
+
["hebr", 1424, 1535],
|
|
10
|
+
["arab", 1536, 1791],
|
|
11
|
+
["arab", 1872, 1919],
|
|
12
|
+
["deva", 2304, 2431],
|
|
13
|
+
["thai", 3584, 3711],
|
|
14
|
+
["kore", 4352, 4607],
|
|
15
|
+
["latn", 7680, 7935],
|
|
16
|
+
["kana", 12352, 12447],
|
|
17
|
+
["kana", 12448, 12543],
|
|
18
|
+
["kana", 12784, 12799],
|
|
19
|
+
["hani", 13312, 19903],
|
|
20
|
+
["hani", 19968, 40959],
|
|
21
|
+
["kore", 44032, 55203],
|
|
22
|
+
["kana", 65382, 65437]
|
|
23
|
+
];
|
|
24
|
+
function detectLanguageHint(text) {
|
|
25
|
+
const counts = /* @__PURE__ */ new Map();
|
|
26
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
27
|
+
const code = text.charCodeAt(i);
|
|
28
|
+
for (const [script, low, high] of SCRIPT_RANGES) {
|
|
29
|
+
if (code < low) break;
|
|
30
|
+
if (code <= high) {
|
|
31
|
+
counts.set(script, (counts.get(script) ?? 0) + 1);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (counts.has("kana")) return "jpan";
|
|
37
|
+
let best;
|
|
38
|
+
let bestCount = 0;
|
|
39
|
+
for (const [script, count] of counts) {
|
|
40
|
+
if (script === "kana") continue;
|
|
41
|
+
if (count > bestCount) {
|
|
42
|
+
best = script;
|
|
43
|
+
bestCount = count;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return best;
|
|
47
|
+
}
|
|
48
|
+
function corpusDominantLanguage(hints) {
|
|
49
|
+
const counts = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const hint of hints) {
|
|
51
|
+
if (hint === void 0 || hint === "") continue;
|
|
52
|
+
counts.set(hint, (counts.get(hint) ?? 0) + 1);
|
|
53
|
+
}
|
|
54
|
+
let best;
|
|
55
|
+
let bestCount = 0;
|
|
56
|
+
for (const [hint, count] of counts) {
|
|
57
|
+
if (count > bestCount) {
|
|
58
|
+
best = hint;
|
|
59
|
+
bestCount = count;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return best;
|
|
63
|
+
}
|
|
64
|
+
function planCrossScript(input) {
|
|
65
|
+
const crossScript = input.queryLanguage !== void 0 && input.corpusLanguage !== void 0 && input.queryLanguage !== input.corpusLanguage;
|
|
66
|
+
return {
|
|
67
|
+
queryLanguage: input.queryLanguage,
|
|
68
|
+
corpusLanguage: input.corpusLanguage,
|
|
69
|
+
crossScript,
|
|
70
|
+
degradation: crossScript && !input.vectorTierAvailable ? {
|
|
71
|
+
backend: "qmd",
|
|
72
|
+
code: "vector_tier_unavailable",
|
|
73
|
+
detail: `cross-script query (${input.queryLanguage}) over a ${input.corpusLanguage} corpus: lexical recall cannot match across scripts \u2014 enable a multilingual embedding model (embedding fallback) so the vector tier can serve it`
|
|
74
|
+
} : void 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
var CORPUS_SAMPLE_CAP = 500;
|
|
78
|
+
var corpusLanguageCache = /* @__PURE__ */ new Map();
|
|
79
|
+
async function dominantCorpusLanguage(storage) {
|
|
80
|
+
try {
|
|
81
|
+
const version = storage.getCorpusScanVersion();
|
|
82
|
+
const cached = corpusLanguageCache.get(storage.dir);
|
|
83
|
+
if (cached?.version === version) return cached.language;
|
|
84
|
+
const memories = await storage.readAllMemories();
|
|
85
|
+
const language = corpusDominantLanguage(
|
|
86
|
+
memories.slice(0, CORPUS_SAMPLE_CAP).map((memory) => memory.frontmatter.language)
|
|
87
|
+
);
|
|
88
|
+
if (corpusLanguageCache.size > 8) corpusLanguageCache.clear();
|
|
89
|
+
corpusLanguageCache.set(storage.dir, { version, language });
|
|
90
|
+
return language;
|
|
91
|
+
} catch {
|
|
92
|
+
return void 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
detectLanguageHint,
|
|
98
|
+
corpusDominantLanguage,
|
|
99
|
+
planCrossScript,
|
|
100
|
+
dominantCorpusLanguage
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=chunk-3WU7XOFN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cross-lingual-recall.ts"],"sourcesContent":["/**\n * Cross-lingual recall planner (issue #2197).\n *\n * Lexical tiers (BM25/FTS) match on shared surface tokens, so a query whose\n * dominant script differs from the corpus's cannot retrieve lexically — an\n * English query never token-overlaps a Japanese fact. When the planner\n * detects that mismatch it leans on the vector tier (the embedding-fallback\n * supplement in the recall search pipeline), and when NO vector tier exists\n * it emits a {@link SearchDegradation} so \"no results\" stays distinguishable\n * from \"cross-script query, vectors unavailable\" (rule 34).\n *\n * The write-time half is a dominant-script hint stamped into frontmatter\n * `language` by `StorageManager.writeMemory` (ISO 15924 script codes);\n * legacy files without the field simply do not vote for the corpus script.\n */\n\nimport type { MemoryFile } from \"./types.js\";\nimport type { SearchDegradation } from \"./search/port.js\";\n\ntype CorpusLanguageStorage = {\n dir: string;\n readAllMemories: () => Promise<MemoryFile[]>;\n getCorpusScanVersion: () => string;\n};\n\n/** Script classes the cheap detector can distinguish. ISO 15924 codes. */\nexport type LanguageHint =\n | \"latn\"\n | \"jpan\"\n | \"kore\"\n | \"hani\"\n | \"cyrl\"\n | \"grek\"\n | \"arab\"\n | \"hebr\"\n | \"thai\"\n | \"deva\";\n\n/** Inclusive codepoint ranges per script class. `kana` folds into `jpan` at detection. */\nconst SCRIPT_RANGES: ReadonlyArray<readonly [LanguageHint | \"kana\", number, number]> = [\n [\"latn\", 0x41, 0x5a],\n [\"latn\", 0x61, 0x7a],\n [\"latn\", 0xc0, 0x24f],\n [\"grek\", 0x370, 0x3ff],\n [\"cyrl\", 0x400, 0x4ff],\n [\"cyrl\", 0x500, 0x52f],\n [\"hebr\", 0x590, 0x5ff],\n [\"arab\", 0x600, 0x6ff],\n [\"arab\", 0x750, 0x77f],\n [\"deva\", 0x900, 0x97f],\n [\"thai\", 0xe00, 0xe7f],\n [\"kore\", 0x1100, 0x11ff],\n [\"latn\", 0x1e00, 0x1eff],\n [\"kana\", 0x3040, 0x309f],\n [\"kana\", 0x30a0, 0x30ff],\n [\"kana\", 0x31f0, 0x31ff],\n [\"hani\", 0x3400, 0x4dbf],\n [\"hani\", 0x4e00, 0x9fff],\n [\"kore\", 0xac00, 0xd7a3],\n [\"kana\", 0xff66, 0xff9d],\n];\n\n/**\n * Dominant-script hint for a text. Codepoint-range counting (no regex):\n * kana anywhere maps to `jpan` — kana is unique to Japanese and disambiguates\n * it from `hani` (Chinese, or kanji-only Japanese). Returns `undefined` when\n * the text contains no lettered script class.\n */\nexport function detectLanguageHint(text: string): LanguageHint | undefined {\n const counts = new Map<LanguageHint | \"kana\", number>();\n for (let i = 0; i < text.length; i += 1) {\n const code = text.charCodeAt(i);\n for (const [script, low, high] of SCRIPT_RANGES) {\n if (code < low) break;\n if (code <= high) {\n counts.set(script, (counts.get(script) ?? 0) + 1);\n break;\n }\n }\n }\n // SCRIPT_RANGES is sorted by start codepoint, so `break` on the first\n // range starting past the codepoint is exact — one range test per char.\n if (counts.has(\"kana\")) return \"jpan\";\n let best: LanguageHint | undefined;\n let bestCount = 0;\n for (const [script, count] of counts) {\n if (script === \"kana\") continue;\n if (count > bestCount) {\n best = script;\n bestCount = count;\n }\n }\n return best;\n}\n\n/** Dominant hint over a corpus sample; `undefined` entries (legacy files) never vote. */\nexport function corpusDominantLanguage(\n hints: Iterable<string | undefined>,\n): LanguageHint | undefined {\n const counts = new Map<string, number>();\n for (const hint of hints) {\n if (hint === undefined || hint === \"\") continue;\n counts.set(hint, (counts.get(hint) ?? 0) + 1);\n }\n let best: string | undefined;\n let bestCount = 0;\n for (const [hint, count] of counts) {\n if (count > bestCount) {\n best = hint;\n bestCount = count;\n }\n }\n return best as LanguageHint | undefined;\n}\n\n/** Planner decision for one recall query. */\nexport interface CrossScriptPlan {\n queryLanguage: LanguageHint | undefined;\n corpusLanguage: LanguageHint | undefined;\n /** True when both hints resolved and differ — lexical tiers cannot serve this query. */\n crossScript: boolean;\n /** Emitted when `crossScript` is true and no vector tier can compensate. */\n degradation?: SearchDegradation;\n}\n\n/**\n * Pure planner core: compare query/corpus hints and, on a mismatch without a\n * vector tier, build the visible degradation signal.\n */\nexport function planCrossScript(input: {\n queryLanguage: LanguageHint | undefined;\n corpusLanguage: LanguageHint | undefined;\n vectorTierAvailable: boolean;\n}): CrossScriptPlan {\n const crossScript =\n input.queryLanguage !== undefined &&\n input.corpusLanguage !== undefined &&\n input.queryLanguage !== input.corpusLanguage;\n return {\n queryLanguage: input.queryLanguage,\n corpusLanguage: input.corpusLanguage,\n crossScript,\n degradation:\n crossScript && !input.vectorTierAvailable\n ? {\n backend: \"qmd\",\n code: \"vector_tier_unavailable\",\n detail:\n `cross-script query (${input.queryLanguage}) over a ${input.corpusLanguage} corpus: ` +\n \"lexical recall cannot match across scripts — enable a multilingual embedding model \" +\n \"(embedding fallback) so the vector tier can serve it\",\n }\n : undefined,\n };\n}\n\n/** Corpus sample cap: dominant script stabilizes well below the full corpus. */\nconst CORPUS_SAMPLE_CAP = 500;\n\n/** Memoized dominant corpus language per storage dir, keyed by corpus scan version. */\nconst corpusLanguageCache = new Map<string, { version: string; language: LanguageHint | undefined }>();\n\n/**\n * Dominant corpus language for a storage manager, sampled from the newest\n * frontmatter `language` hints (capped, memoized on the corpus scan version so\n * recurring recalls pay one pass per corpus generation, not per query).\n * Read failures degrade to `undefined` — never break recall.\n */\nexport async function dominantCorpusLanguage(\n storage: CorpusLanguageStorage,\n): Promise<LanguageHint | undefined> {\n try {\n const version = storage.getCorpusScanVersion();\n const cached = corpusLanguageCache.get(storage.dir);\n if (cached?.version === version) return cached.language;\n const memories = await storage.readAllMemories();\n const language = corpusDominantLanguage(\n memories.slice(0, CORPUS_SAMPLE_CAP).map((memory: MemoryFile) => memory.frontmatter.language),\n );\n if (corpusLanguageCache.size > 8) corpusLanguageCache.clear();\n corpusLanguageCache.set(storage.dir, { version, language });\n return language;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";AAuCA,IAAM,gBAAiF;AAAA,EACrF,CAAC,QAAQ,IAAM,EAAI;AAAA,EACnB,CAAC,QAAQ,IAAM,GAAI;AAAA,EACnB,CAAC,QAAQ,KAAM,GAAK;AAAA,EACpB,CAAC,QAAQ,KAAO,IAAK;AAAA,EACrB,CAAC,QAAQ,MAAO,IAAK;AAAA,EACrB,CAAC,QAAQ,MAAO,IAAK;AAAA,EACrB,CAAC,QAAQ,MAAO,IAAK;AAAA,EACrB,CAAC,QAAQ,MAAO,IAAK;AAAA,EACrB,CAAC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;AACJ,MAAI,YAAY;AAChB,aAAW,CAAC,MAAM,KAAK,KAAK,QAAQ;AAClC,QAAI,QAAQ,WAAW;AACrB,aAAO;AACP,kBAAY;AAAA,IACd;AAAA,EACF;AACA,SAAO;AACT;AAgBO,SAAS,gBAAgB,OAIZ;AAClB,QAAM,cACJ,MAAM,kBAAkB,UACxB,MAAM,mBAAmB,UACzB,MAAM,kBAAkB,MAAM;AAChC,SAAO;AAAA,IACL,eAAe,MAAM;AAAA,IACrB,gBAAgB,MAAM;AAAA,IACtB;AAAA,IACA,aACE,eAAe,CAAC,MAAM,sBAClB;AAAA,MACE,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QACE,uBAAuB,MAAM,aAAa,YAAY,MAAM,cAAc;AAAA,IAG9E,IACA;AAAA,EACR;AACF;AAGA,IAAM,oBAAoB;AAG1B,IAAM,sBAAsB,oBAAI,IAAqE;AAQrG,eAAsB,uBACpB,SACmC;AACnC,MAAI;AACF,UAAM,UAAU,QAAQ,qBAAqB;AAC7C,UAAM,SAAS,oBAAoB,IAAI,QAAQ,GAAG;AAClD,QAAI,QAAQ,YAAY,QAAS,QAAO,OAAO;AAC/C,UAAM,WAAW,MAAM,QAAQ,gBAAgB;AAC/C,UAAM,WAAW;AAAA,MACf,SAAS,MAAM,GAAG,iBAAiB,EAAE,IAAI,CAAC,WAAuB,OAAO,YAAY,QAAQ;AAAA,IAC9F;AACA,QAAI,oBAAoB,OAAO,EAAG,qBAAoB,MAAM;AAC5D,wBAAoB,IAAI,QAAQ,KAAK,EAAE,SAAS,SAAS,CAAC;AAC1D,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -16,7 +16,7 @@ function runSerialized(key, task) {
|
|
|
16
16
|
});
|
|
17
17
|
return next;
|
|
18
18
|
}
|
|
19
|
-
var MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES = /* @__PURE__ */ new Set(["fact"]);
|
|
19
|
+
var MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES = /* @__PURE__ */ new Set(["fact", "procedure"]);
|
|
20
20
|
function memoryWorthOutcomeEligibleCategories() {
|
|
21
21
|
return new Set(MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES);
|
|
22
22
|
}
|
|
@@ -87,4 +87,4 @@ export {
|
|
|
87
87
|
memoryWorthOutcomeEligibleCategories,
|
|
88
88
|
recordMemoryOutcome
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-4K7IW3F7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory-worth-outcomes.ts"],"sourcesContent":["/**\n * Issue #560 PR 3 — Memory Worth outcome signal pipeline.\n *\n * PR 1 added `mw_success` / `mw_fail` fields to MemoryFrontmatter. PR 2 added\n * a pure scoring helper. This module adds the one piece tying the two\n * together: a way for callers to record a single outcome observation against\n * a memory, which increments the appropriate counter in frontmatter.\n *\n * The public entry point is `recordMemoryOutcome({ memoryPath, outcome, ... })`.\n * Callers pass the full path to the memory file (not just the ID) because in\n * the usual outcome source — the observation ledger — the memory path is\n * already captured in the event payload, and path-based lookup avoids a\n * full-corpus scan.\n *\n * Intentional properties:\n * - Works on a per-memory basis (no bulk API in this slice). Bulk update is\n * an easy layer on top of this once a second caller needs it.\n * - Reuses the existing `updateMemoryFrontmatter(id, patch)` write path so\n * unrelated fields (confidence, importance, lifecycle hooks, etc.) are\n * preserved. The PR 1 serializer rejects negative / non-integer counters,\n * so we rely on that for defensive validation rather than duplicating it.\n * - Only instruments categories in `MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES`\n * (currently `fact` and `procedure` — procedures joined in issue #2370 —\n * matching `MEMORY_WORTH_ELIGIBLE_CATEGORIES` in operator-toolkit.ts for\n * the doctor audit). Non-eligible memories return\n * `{ ok: false, reason: \"ineligible_category\" }` rather than throwing so\n * the caller — typically a ledger consumer draining heterogeneous events\n * — doesn't need to pre-filter by category.\n * - Missing / unknown memory IDs return `{ ok: false, reason: \"not_found\" }`\n * rather than throwing, because outcome events may reference memories\n * that were archived/deleted between the session and the ledger drain.\n * That isn't an operator-actionable error.\n * - On success, returns the new counter values so observability surfaces\n * can report the increment without a second read.\n *\n * Out of scope (later PRs):\n * - Recall filter reading the counters (PR 4).\n * - Benchmark + default flip (PR 5).\n * - Automatic increments from extraction or summarization. Only the\n * explicit `MEM_OUTCOME` ledger tag or an MCP tool call drives writes.\n */\n\nimport path from \"node:path\";\n\nimport type { StorageManager } from \"./storage.js\";\nimport type { MemoryFrontmatter } from \"./types.js\";\n\n/**\n * Per-memory-ID serialization of the read-modify-write increment.\n *\n * Codex P1: without this, concurrent calls for the same memory race. Both\n * callers read the same `mw_*` values, each writes +1, and one increment\n * is lost — silently undercounting outcomes. We chain an async promise\n * per memory ID so read-then-write is atomic with respect to other calls\n * into this module.\n *\n * This serializes only THIS module. Direct writers (e.g. hand-rolled\n * frontmatter patches) still bypass the lock, but the documented surface\n * for Memory Worth increments is this function, and the bench only uses\n * this path.\n *\n * The lock map is WeakRef-free by design: the chain self-cleans once the\n * last pending write resolves (we delete the entry inside the `.finally`\n * of the tail), so memory use stays bounded even for long-running\n * processes that touch many different memory IDs.\n */\nconst outcomeLocks = new Map<string, Promise<unknown>>();\n\nfunction runSerialized<T>(key: string, task: () => Promise<T>): Promise<T> {\n const prev = outcomeLocks.get(key) ?? Promise.resolve();\n // Swallow upstream errors so a failed outcome for memory A doesn't\n // permanently poison the chain for memory A. We still propagate our own\n // result/errors to the caller.\n const next = prev.catch(() => undefined).then(task);\n outcomeLocks.set(key, next);\n // Chain the cleanup off `next` BUT attach a `.catch` so the cleanup\n // promise itself never surfaces as an unhandled rejection. The caller\n // gets `next` back and handles it their own way; this detached cleanup\n // chain has no observer, so without the .catch Node would crash the\n // process on a task rejection even when the caller awaited `next` and\n // handled the error correctly.\n next\n .then(\n () => {\n if (outcomeLocks.get(key) === next) outcomeLocks.delete(key);\n },\n () => {\n if (outcomeLocks.get(key) === next) outcomeLocks.delete(key);\n },\n )\n .catch(() => {\n // Defensive no-op in case a hook inside the cleanup branches throws.\n });\n return next;\n}\n\n/**\n * Categories currently instrumented for Memory Worth counters. `procedure`\n * joined in issue #2370 — the procedure library-health maintenance loop\n * retires on failure-dominant `mw_*` counters, so injected procedures must\n * be able to accrue outcomes. Must be kept in sync with\n * `MEMORY_WORTH_ELIGIBLE_CATEGORIES` in `operator-toolkit.ts`. Declared\n * here (not imported) to avoid a circular dep with operator-toolkit, which\n * imports from this file's peers. The two constants are validated by a\n * test to stay in lockstep.\n */\nconst MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES: ReadonlySet<MemoryFrontmatter[\"category\"]> =\n new Set([\"fact\", \"procedure\"]);\n\n/**\n * Exported so downstream tests / operators can query the allowlist without\n * re-declaring it. Returned as a frozen copy so consumers cannot mutate the\n * module-internal set.\n */\nexport function memoryWorthOutcomeEligibleCategories(): ReadonlySet<MemoryFrontmatter[\"category\"]> {\n return new Set(MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES);\n}\n\n/**\n * The direction of an outcome — whether the session that consumed this\n * memory succeeded or failed. Restricted to a string literal union so\n * callers in TypeScript land can't pass arbitrary tags.\n */\nexport type MemoryOutcomeKind = \"success\" | \"failure\";\n\n/**\n * Arguments to `recordMemoryOutcome`.\n *\n * `memoryPath` is the filesystem path to the memory; we derive the ID from\n * the basename, matching how the operator-toolkit and recall layers map\n * paths to IDs.\n */\nexport interface RecordMemoryOutcomeInput {\n /**\n * Absolute or repo-relative path to the memory file. Typically the value\n * of `MemoryFile.path` for a memory returned by `readAllMemories`.\n */\n memoryPath: string;\n /** Outcome direction — \"success\" bumps mw_success; \"failure\" bumps mw_fail. */\n outcome: MemoryOutcomeKind;\n /**\n * Optional observation timestamp for audit / telemetry. This PR doesn't\n * persist the timestamp (PR 4/5 will use `lastAccessed`, which already\n * covers the recency-decay requirement), but accepting it here keeps the\n * call shape stable so future ledger integrations don't need a breaking\n * change.\n */\n timestamp?: Date | string;\n}\n\n/**\n * Outcome of a `recordMemoryOutcome` call.\n *\n * `ok: true` means the counter was incremented and flushed. The returned\n * values reflect the post-increment state, so callers can log\n * `\"fact-xyz: 4/1 → 5/1\"` without re-reading.\n *\n * `ok: false` carries a short machine-readable `reason` so a ledger drainer\n * can aggregate metrics (\"how many events hit not_found this hour?\"). The\n * human-readable `message` is a friendlier version for logs.\n */\nexport type RecordMemoryOutcomeResult =\n | {\n ok: true;\n memoryId: string;\n /** New value of `mw_success` after the increment. */\n mw_success: number;\n /** New value of `mw_fail` after the increment. */\n mw_fail: number;\n }\n | {\n ok: false;\n reason:\n | \"not_found\"\n | \"ineligible_category\"\n | \"invalid_outcome\"\n | \"invalid_path\";\n message: string;\n };\n\n/**\n * Extract the memory ID from a file path. Memory files are stored as\n * `<id>.md`, matching the rest of the system (see `getMemoryById`, which\n * infers paths from IDs).\n *\n * Returns `null` for any path that does not end in `.md`. The check is\n * unconditional — `path.basename` strips directory components before the\n * suffix check, so previous conditional logic silently accepted\n * directory-prefixed paths like `/tmp/facts/2026-01-01/not-a-memory`\n * (the basename `not-a-memory` is not equal to the input, so the `.md`\n * guard was skipped). The new check looks at the raw input once.\n */\nfunction memoryIdFromPath(memoryPath: string): string | null {\n if (!memoryPath || typeof memoryPath !== \"string\") return null;\n if (!memoryPath.endsWith(\".md\")) return null;\n const basename = path.basename(memoryPath, \".md\");\n if (!basename) return null;\n return basename;\n}\n\n/**\n * Record a single outcome observation against a memory. Increments\n * `mw_success` or `mw_fail` on the memory's frontmatter (preserving all\n * other fields) via the existing `updateMemoryFrontmatter` write path.\n *\n * See the top-of-file doc comment for policy details (eligible categories,\n * error semantics, and what is intentionally out of scope).\n */\nexport async function recordMemoryOutcome(\n storage: StorageManager,\n input: RecordMemoryOutcomeInput,\n): Promise<RecordMemoryOutcomeResult> {\n if (input.outcome !== \"success\" && input.outcome !== \"failure\") {\n return {\n ok: false,\n reason: \"invalid_outcome\",\n message: `outcome must be \"success\" or \"failure\"; got ${JSON.stringify(input.outcome)}`,\n };\n }\n\n const memoryId = memoryIdFromPath(input.memoryPath);\n if (memoryId === null) {\n return {\n ok: false,\n reason: \"invalid_path\",\n message: `memoryPath must end in .md; got ${JSON.stringify(input.memoryPath)}`,\n };\n }\n\n // Serialize the read-modify-write per memory ID so concurrent callers\n // (parallel ledger drain, multiple MCP clients, etc.) can't each read\n // the same snapshot and race to write `+1`, losing an increment.\n return runSerialized(memoryId, async () => {\n const memory = await storage.getMemoryById(memoryId);\n if (!memory) {\n return {\n ok: false,\n reason: \"not_found\",\n message: `no memory with id ${memoryId}`,\n };\n }\n\n if (!MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES.has(memory.frontmatter.category)) {\n return {\n ok: false,\n reason: \"ineligible_category\",\n message: `category ${memory.frontmatter.category} is not instrumented for Memory Worth`,\n };\n }\n\n // Absent counters are treated as 0 (matching the PR 1 semantics — legacy\n // memories implicitly have Beta(1,1) priors). Increments land on the\n // actual counter regardless of whether the field was previously set.\n const currentSuccess = memory.frontmatter.mw_success ?? 0;\n const currentFail = memory.frontmatter.mw_fail ?? 0;\n\n const nextSuccess = input.outcome === \"success\" ? currentSuccess + 1 : currentSuccess;\n const nextFail = input.outcome === \"failure\" ? currentFail + 1 : currentFail;\n\n // `updateMemoryFrontmatter` goes through `writeMemoryFrontmatter`, which\n // routes through the PR 1 serializer — so a stored corrupt value (e.g., a\n // pre-existing float) would be rejected here. That is intentional: we\n // refuse to layer a fresh increment on top of garbage. Operators should\n // use `remnic doctor` to find and fix those rows before PR 4 ships.\n //\n // `updateMemoryFrontmatter` returns `false` when the memory is no\n // longer present (archived / deleted between `getMemoryById` and the\n // write). Surface that as `not_found` so callers see an honest result\n // — silently returning `ok: true` with a counter that never landed\n // would skew downstream worth scoring.\n const updated = await storage.updateMemoryFrontmatter(memoryId, {\n mw_success: nextSuccess,\n mw_fail: nextFail,\n });\n if (!updated) {\n return {\n ok: false,\n reason: \"not_found\",\n message: `memory ${memoryId} disappeared between read and write`,\n };\n }\n\n return {\n ok: true,\n memoryId,\n mw_success: nextSuccess,\n mw_fail: nextFail,\n };\n });\n}\n"],"mappings":";AA0CA,OAAO,UAAU;AAwBjB,IAAM,eAAe,oBAAI,IAA8B;AAEvD,SAAS,cAAiB,KAAa,MAAoC;AACzE,QAAM,OAAO,aAAa,IAAI,GAAG,KAAK,QAAQ,QAAQ;AAItD,QAAM,OAAO,KAAK,MAAM,MAAM,MAAS,EAAE,KAAK,IAAI;AAClD,eAAa,IAAI,KAAK,IAAI;AAO1B,OACG;AAAA,IACC,MAAM;AACJ,UAAI,aAAa,IAAI,GAAG,MAAM,KAAM,cAAa,OAAO,GAAG;AAAA,IAC7D;AAAA,IACA,MAAM;AACJ,UAAI,aAAa,IAAI,GAAG,MAAM,KAAM,cAAa,OAAO,GAAG;AAAA,IAC7D;AAAA,EACF,EACC,MAAM,MAAM;AAAA,EAEb,CAAC;AACH,SAAO;AACT;AAYA,IAAM,2CACJ,oBAAI,IAAI,CAAC,QAAQ,WAAW,CAAC;AAOxB,SAAS,uCAAmF;AACjG,SAAO,IAAI,IAAI,wCAAwC;AACzD;AA4EA,SAAS,iBAAiB,YAAmC;AAC3D,MAAI,CAAC,cAAc,OAAO,eAAe,SAAU,QAAO;AAC1D,MAAI,CAAC,WAAW,SAAS,KAAK,EAAG,QAAO;AACxC,QAAM,WAAW,KAAK,SAAS,YAAY,KAAK;AAChD,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO;AACT;AAUA,eAAsB,oBACpB,SACA,OACoC;AACpC,MAAI,MAAM,YAAY,aAAa,MAAM,YAAY,WAAW;AAC9D,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,SAAS,+CAA+C,KAAK,UAAU,MAAM,OAAO,CAAC;AAAA,IACvF;AAAA,EACF;AAEA,QAAM,WAAW,iBAAiB,MAAM,UAAU;AAClD,MAAI,aAAa,MAAM;AACrB,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9
|
} from "./chunk-TB6CBZ5V.js";
|
|
7
|
-
import {
|
|
8
|
-
AdapterRegistry
|
|
9
|
-
} from "./chunk-JBPKEARU.js";
|
|
10
10
|
import {
|
|
11
11
|
serializeInlineScriptValue
|
|
12
12
|
} from "./chunk-3HSRWJTC.js";
|
|
13
13
|
import {
|
|
14
14
|
handleSupportPassportOwnerHttp
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-S2DPMJXH.js";
|
|
16
16
|
import {
|
|
17
17
|
buildSupportPassportPublicRequestHandler
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Z7PBQPJ4.js";
|
|
19
19
|
import {
|
|
20
20
|
nonEmptyQueryParam,
|
|
21
21
|
optionalNamespaceKindQueryParam,
|
|
22
22
|
optionalQueryString,
|
|
23
23
|
positiveIntQueryParam
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-5YQ63T4B.js";
|
|
25
25
|
import {
|
|
26
26
|
EngramMcpServer,
|
|
27
27
|
MCP_SUPPORTED_PROTOCOL_VERSIONS,
|
|
@@ -31,14 +31,14 @@ import {
|
|
|
31
31
|
processChatMessage,
|
|
32
32
|
sessionBelongsToPrincipal,
|
|
33
33
|
subscribeChatTranscript
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-TF77C7SV.js";
|
|
35
35
|
import {
|
|
36
36
|
RelayMissionStoreError
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OCZIYAE5.js";
|
|
38
38
|
import {
|
|
39
39
|
executeResolution,
|
|
40
40
|
isValidResolutionVerb
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-XCTXS7VY.js";
|
|
42
42
|
import {
|
|
43
43
|
isDefaultReviewNamespace,
|
|
44
44
|
listPairs,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-35NN3ZFA.js";
|
|
47
47
|
import {
|
|
48
48
|
validateRequest
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-W675UJCZ.js";
|
|
50
50
|
import {
|
|
51
51
|
maybeHandleLifecycleFlush
|
|
52
52
|
} from "./chunk-TIDEL77O.js";
|
|
@@ -61,15 +61,15 @@ import {
|
|
|
61
61
|
authorizationProbeNamespaces,
|
|
62
62
|
authorizationProbeRequiresPrincipalNamespace,
|
|
63
63
|
probeOperationAuthorization
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-UIN2BWDD.js";
|
|
65
65
|
import {
|
|
66
66
|
CorrectionContractError,
|
|
67
67
|
getOperation,
|
|
68
68
|
resolveQueryNamespaceWritablePreflight
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-SB7D4BT7.js";
|
|
70
70
|
import {
|
|
71
71
|
handleWhoKnowsHttpQuery
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-SPUJNJJC.js";
|
|
73
73
|
import {
|
|
74
74
|
isTrustZoneName
|
|
75
75
|
} from "./chunk-5QZR2RA3.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
} from "./chunk-DEUNUKTD.js";
|
|
79
79
|
import {
|
|
80
80
|
isRecallDisclosure
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-SBDCZ2AX.js";
|
|
82
82
|
import {
|
|
83
83
|
OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
|
|
84
84
|
OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
|
|
@@ -3388,4 +3388,4 @@ export {
|
|
|
3388
3388
|
resolveDefaultAdminConsolePublicDir,
|
|
3389
3389
|
EngramAccessHttpServer
|
|
3390
3390
|
};
|
|
3391
|
-
//# sourceMappingURL=chunk-
|
|
3391
|
+
//# sourceMappingURL=chunk-4KYOLI6M.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// src/memory-subject-cli.ts
|
|
2
|
+
function parsePromotionCandidatesCliOptions(args) {
|
|
3
|
+
let limit = 20;
|
|
4
|
+
if (args.limit !== void 0) {
|
|
5
|
+
const parsed = Number(args.limit);
|
|
6
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
`promotion-candidates: --limit expects an integer in [1, 100] (got ${JSON.stringify(args.limit)})`
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
limit = parsed;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
...args.namespace !== void 0 && args.namespace !== "" ? { namespace: args.namespace } : {},
|
|
15
|
+
...args.targetNamespace !== void 0 && args.targetNamespace !== "" ? { targetNamespace: args.targetNamespace } : {},
|
|
16
|
+
limit,
|
|
17
|
+
json: args.json === true
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function renderPromotionCandidates(result, json) {
|
|
21
|
+
if (json) return JSON.stringify(result, null, 2);
|
|
22
|
+
const lines = [
|
|
23
|
+
`Namespace: ${result.namespace} Target layer: ${result.targetNamespace} (minAccessCount ${result.minAccessCount})`
|
|
24
|
+
];
|
|
25
|
+
if (result.candidates.length === 0) {
|
|
26
|
+
lines.push("No promotion candidates.");
|
|
27
|
+
return lines.join("\n");
|
|
28
|
+
}
|
|
29
|
+
for (const c of result.candidates) {
|
|
30
|
+
lines.push(
|
|
31
|
+
`- ${c.id} [${c.category}] signal=${c.reuseSignal} access=${c.accessCount} reinforced=${c.reinforcementCount} mw=${c.mwSuccess}/${c.mwFail}`
|
|
32
|
+
);
|
|
33
|
+
lines.push(` ${c.content.replace(/\s+/g, " ").slice(0, 100)}`);
|
|
34
|
+
}
|
|
35
|
+
lines.push("Promote explicitly with the existing promotion commands; nothing is auto-promoted.");
|
|
36
|
+
return lines.join("\n");
|
|
37
|
+
}
|
|
38
|
+
async function runPromotionCandidatesCommand(rest, io) {
|
|
39
|
+
const flag = (name) => {
|
|
40
|
+
const hit = rest.find((a) => a.startsWith(`--${name}=`));
|
|
41
|
+
return hit === void 0 ? void 0 : hit.slice(name.length + 3);
|
|
42
|
+
};
|
|
43
|
+
const options = parsePromotionCandidatesCliOptions({
|
|
44
|
+
namespace: flag("namespace"),
|
|
45
|
+
targetNamespace: flag("target-namespace"),
|
|
46
|
+
limit: flag("limit"),
|
|
47
|
+
json: rest.includes("--json")
|
|
48
|
+
});
|
|
49
|
+
const result = await io.promotionCandidates({
|
|
50
|
+
...options.namespace !== void 0 ? { namespace: options.namespace } : {},
|
|
51
|
+
...options.targetNamespace !== void 0 ? { targetNamespace: options.targetNamespace } : {},
|
|
52
|
+
limit: options.limit
|
|
53
|
+
});
|
|
54
|
+
io.stdout(renderPromotionCandidates(result, options.json));
|
|
55
|
+
}
|
|
56
|
+
function parseSubjectsBackfillCliOptions(args) {
|
|
57
|
+
return {
|
|
58
|
+
mode: args.apply === true ? "apply" : "shadow",
|
|
59
|
+
...args.namespace !== void 0 && args.namespace !== "" ? { namespace: args.namespace } : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async function runSubjectsBackfillCommand(rest, io) {
|
|
63
|
+
const namespaceFlag = rest.find((a) => a.startsWith("--namespace="))?.slice("--namespace=".length);
|
|
64
|
+
const options = parseSubjectsBackfillCliOptions({
|
|
65
|
+
apply: rest.includes("--apply"),
|
|
66
|
+
namespace: namespaceFlag
|
|
67
|
+
});
|
|
68
|
+
const report = await io.backfill(options);
|
|
69
|
+
const lines = [
|
|
70
|
+
`Mode: ${report.mode} Scanned: ${report.scanned} Already stamped: ${report.alreadyStamped} To stamp: ${report.stamped}`
|
|
71
|
+
];
|
|
72
|
+
for (const stamp of report.stamps) {
|
|
73
|
+
lines.push(`- ${stamp.id} [${stamp.category}] \u2192 subject: ${stamp.subject}`);
|
|
74
|
+
}
|
|
75
|
+
if (report.mode === "shadow") {
|
|
76
|
+
lines.push("Shadow run \u2014 nothing written. Re-run with --apply to stamp.");
|
|
77
|
+
}
|
|
78
|
+
io.stdout(lines.join("\n"));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
parsePromotionCandidatesCliOptions,
|
|
83
|
+
renderPromotionCandidates,
|
|
84
|
+
runPromotionCandidatesCommand,
|
|
85
|
+
parseSubjectsBackfillCliOptions,
|
|
86
|
+
runSubjectsBackfillCommand
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=chunk-573TEZCD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory-subject-cli.ts"],"sourcesContent":["/**\n * CLI surface for memory-subject operations (issue #2372).\n *\n * `remnic promotion-candidates` — read-only surfacing of agent-subject,\n * reuse-signaled promotion candidates. `remnic subjects backfill` — the\n * deterministic shadow/apply stamp for unstamped memories. Runners take an\n * io seam (service/storage callbacks + stdout) so tests drive them without\n * booting an orchestrator; the remnic-cli entry supplies the real ones.\n */\n\nimport type {\n PromotionCandidatesResult,\n SubjectBackfillReport,\n} from \"./memory-subject.js\";\n\nexport interface PromotionCandidatesCliOptions {\n namespace?: string;\n targetNamespace?: string;\n limit: number;\n json: boolean;\n}\n\nexport function parsePromotionCandidatesCliOptions(args: {\n namespace?: string;\n targetNamespace?: string;\n limit?: string;\n json?: boolean;\n}): PromotionCandidatesCliOptions {\n let limit = 20;\n if (args.limit !== undefined) {\n const parsed = Number(args.limit);\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) {\n throw new Error(\n `promotion-candidates: --limit expects an integer in [1, 100] (got ${JSON.stringify(args.limit)})`,\n );\n }\n limit = parsed;\n }\n return {\n ...(args.namespace !== undefined && args.namespace !== \"\" ? { namespace: args.namespace } : {}),\n ...(args.targetNamespace !== undefined && args.targetNamespace !== \"\"\n ? { targetNamespace: args.targetNamespace }\n : {}),\n limit,\n json: args.json === true,\n };\n}\n\nexport function renderPromotionCandidates(result: PromotionCandidatesResult, json: boolean): string {\n if (json) return JSON.stringify(result, null, 2);\n const lines = [\n `Namespace: ${result.namespace} Target layer: ${result.targetNamespace} (minAccessCount ${result.minAccessCount})`,\n ];\n if (result.candidates.length === 0) {\n lines.push(\"No promotion candidates.\");\n return lines.join(\"\\n\");\n }\n for (const c of result.candidates) {\n lines.push(\n `- ${c.id} [${c.category}] signal=${c.reuseSignal} access=${c.accessCount} reinforced=${c.reinforcementCount} mw=${c.mwSuccess}/${c.mwFail}`,\n );\n lines.push(` ${c.content.replace(/\\s+/g, \" \").slice(0, 100)}`);\n }\n lines.push(\"Promote explicitly with the existing promotion commands; nothing is auto-promoted.\");\n return lines.join(\"\\n\");\n}\n\nexport async function runPromotionCandidatesCommand(\n rest: string[],\n io: {\n promotionCandidates: (request: {\n namespace?: string;\n targetNamespace?: string;\n limit?: number;\n }) => Promise<PromotionCandidatesResult>;\n stdout: (line: string) => void;\n },\n): Promise<void> {\n const flag = (name: string): string | undefined => {\n const hit = rest.find((a) => a.startsWith(`--${name}=`));\n return hit === undefined ? undefined : hit.slice(name.length + 3);\n };\n const options = parsePromotionCandidatesCliOptions({\n namespace: flag(\"namespace\"),\n targetNamespace: flag(\"target-namespace\"),\n limit: flag(\"limit\"),\n json: rest.includes(\"--json\"),\n });\n const result = await io.promotionCandidates({\n ...(options.namespace !== undefined ? { namespace: options.namespace } : {}),\n ...(options.targetNamespace !== undefined ? { targetNamespace: options.targetNamespace } : {}),\n limit: options.limit,\n });\n io.stdout(renderPromotionCandidates(result, options.json));\n}\n\nexport interface SubjectsBackfillCliOptions {\n mode: \"shadow\" | \"apply\";\n namespace?: string;\n}\n\nexport function parseSubjectsBackfillCliOptions(args: {\n apply?: boolean;\n namespace?: string;\n}): SubjectsBackfillCliOptions {\n return {\n mode: args.apply === true ? \"apply\" : \"shadow\",\n ...(args.namespace !== undefined && args.namespace !== \"\" ? { namespace: args.namespace } : {}),\n };\n}\n\nexport async function runSubjectsBackfillCommand(\n rest: string[],\n io: {\n backfill: (options: { mode: \"shadow\" | \"apply\"; namespace?: string }) => Promise<SubjectBackfillReport>;\n stdout: (line: string) => void;\n },\n): Promise<void> {\n const namespaceFlag = rest.find((a) => a.startsWith(\"--namespace=\"))?.slice(\"--namespace=\".length);\n const options = parseSubjectsBackfillCliOptions({\n apply: rest.includes(\"--apply\"),\n namespace: namespaceFlag,\n });\n const report = await io.backfill(options);\n const lines = [\n `Mode: ${report.mode} Scanned: ${report.scanned} Already stamped: ${report.alreadyStamped} To stamp: ${report.stamped}`,\n ];\n for (const stamp of report.stamps) {\n lines.push(`- ${stamp.id} [${stamp.category}] → subject: ${stamp.subject}`);\n }\n if (report.mode === \"shadow\") {\n lines.push(\"Shadow run — nothing written. Re-run with --apply to stamp.\");\n }\n io.stdout(lines.join(\"\\n\"));\n}\n"],"mappings":";AAsBO,SAAS,mCAAmC,MAKjB;AAChC,MAAI,QAAQ;AACZ,MAAI,KAAK,UAAU,QAAW;AAC5B,UAAM,SAAS,OAAO,KAAK,KAAK;AAChC,QAAI,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,KAAK,SAAS,KAAK;AAC3D,YAAM,IAAI;AAAA,QACR,qEAAqE,KAAK,UAAU,KAAK,KAAK,CAAC;AAAA,MACjG;AAAA,IACF;AACA,YAAQ;AAAA,EACV;AACA,SAAO;AAAA,IACL,GAAI,KAAK,cAAc,UAAa,KAAK,cAAc,KAAK,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IAC7F,GAAI,KAAK,oBAAoB,UAAa,KAAK,oBAAoB,KAC/D,EAAE,iBAAiB,KAAK,gBAAgB,IACxC,CAAC;AAAA,IACL;AAAA,IACA,MAAM,KAAK,SAAS;AAAA,EACtB;AACF;AAEO,SAAS,0BAA0B,QAAmC,MAAuB;AAClG,MAAI,KAAM,QAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AAC/C,QAAM,QAAQ;AAAA,IACZ,cAAc,OAAO,SAAS,mBAAmB,OAAO,eAAe,qBAAqB,OAAO,cAAc;AAAA,EACnH;AACA,MAAI,OAAO,WAAW,WAAW,GAAG;AAClC,UAAM,KAAK,0BAA0B;AACrC,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB;A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AC/F;AACF;AAEA,eAAsB,2BACpB,MACA,IAIe;AACf,QAAM,gBAAgB,KAAK,KAAK,CAAC,MAAM,EAAE,WAAW,cAAc,CAAC,GAAG,MAAM,eAAe,MAAM;AACjG,QAAM,UAAU,gCAAgC;AAAA,IAC9C,OAAO,KAAK,SAAS,SAAS;AAAA,IAC9B,WAAW;AAAA,EACb,CAAC;AACD,QAAM,SAAS,MAAM,GAAG,SAAS,OAAO;AACxC,QAAM,QAAQ;AAAA,IACZ,SAAS,OAAO,IAAI,cAAc,OAAO,OAAO,sBAAsB,OAAO,cAAc,eAAe,OAAO,OAAO;AAAA,EAC1H;AACA,aAAW,SAAS,OAAO,QAAQ;AACjC,UAAM,KAAK,KAAK,MAAM,EAAE,KAAK,MAAM,QAAQ,qBAAgB,MAAM,OAAO,EAAE;AAAA,EAC5E;AACA,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,KAAK,kEAA6D;AAAA,EAC1E;AACA,KAAG,OAAO,MAAM,KAAK,IAAI,CAAC;AAC5B;","names":[]}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
listMemoryGovernanceRuns,
|
|
9
9
|
readMemoryGovernanceRunArtifact
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JYYBA7TF.js";
|
|
11
11
|
import {
|
|
12
12
|
StorageManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-J275IYMG.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeProjectionPreview,
|
|
16
16
|
normalizeProjectionTags
|
|
@@ -1005,4 +1005,4 @@ export {
|
|
|
1005
1005
|
verifyMemoryProjection,
|
|
1006
1006
|
repairMemoryProjection
|
|
1007
1007
|
};
|
|
1008
|
-
//# sourceMappingURL=chunk-
|
|
1008
|
+
//# sourceMappingURL=chunk-5NM4OH4P.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isNamespaceKind
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SQI57UCJ.js";
|
|
4
4
|
import {
|
|
5
5
|
EngramAccessInputError
|
|
6
6
|
} from "./chunk-2Z24E5W2.js";
|
|
@@ -40,4 +40,4 @@ export {
|
|
|
40
40
|
positiveIntQueryParam,
|
|
41
41
|
optionalNamespaceKindQueryParam
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-5YQ63T4B.js.map
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
decryptCapsuleFileInMemory,
|
|
21
21
|
isEncryptedCapsuleFile
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DQEMWVMT.js";
|
|
23
23
|
import {
|
|
24
24
|
assertIsDirectoryNotSymlink,
|
|
25
25
|
assertRealpathInsideRoot,
|
|
@@ -294,4 +294,4 @@ function mintForkId(capsuleId, originalId, now) {
|
|
|
294
294
|
export {
|
|
295
295
|
importCapsule
|
|
296
296
|
};
|
|
297
|
-
//# sourceMappingURL=chunk-
|
|
297
|
+
//# sourceMappingURL=chunk-6433HV72.js.map
|
|
@@ -69,6 +69,9 @@ var ExtractedFactSchema = z.object({
|
|
|
69
69
|
scope: z.enum(["project", "global"]).optional().nullable().describe(
|
|
70
70
|
'Scope classification: "global" for cross-project knowledge (framework bugs, library behavior, API patterns, user preferences, general coding patterns); "project" for project-specific knowledge (file paths, env configs, deployment details, project workarounds) and for tool, command, or CLI-flag instructions tied to one agent, since the same tool name can mean different things across agents. When keeping such an agent-tied instruction, begin the fact with a leading "In <agent>," clause naming that agent. Defaults to "project" when a coding context is active.'
|
|
71
71
|
),
|
|
72
|
+
subject: z.enum(["user", "agent"]).optional().nullable().describe(
|
|
73
|
+
'Memory subject: "user" when the fact models the person (preferences, relationships, biography, moments, commitments about their life); "agent" when it is reusable operating knowledge (procedures, principles, tool-usage lessons, debugging strategies, environment facts with no personal content). Emit only for fact/decision-like facts; the category defaults cover preference, relationship, moment, commitment, procedure, principle, and skill.'
|
|
74
|
+
),
|
|
72
75
|
quote: z.string().optional().nullable().describe(
|
|
73
76
|
"The EXACT verbatim words from the conversation that support this fact. Copy a contiguous span from a single speaker turn (not a paraphrase). Cap at ~300 characters. This is the grounding evidence for downstream faithfulness verification (issue #1575)."
|
|
74
77
|
),
|
|
@@ -301,4 +304,4 @@ export {
|
|
|
301
304
|
BehaviorLoopAdjustmentSchema,
|
|
302
305
|
BehaviorLoopPolicyStateSchema
|
|
303
306
|
};
|
|
304
|
-
//# sourceMappingURL=chunk-
|
|
307
|
+
//# sourceMappingURL=chunk-7BDZTALN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const MemoryActionTypeSchema = z.enum([\n \"store_episode\",\n \"store_note\",\n \"update_note\",\n \"create_artifact\",\n \"summarize_node\",\n \"discard\",\n \"link_graph\",\n]);\n\nexport const MemoryActionEligibilityContextSchema = z\n .object({\n confidence: z.number().min(0).max(1),\n lifecycleState: z.enum([\"active\", \"validated\", \"candidate\", \"stale\", \"archived\"]),\n importance: z.number().min(0).max(1),\n source: z.enum([\"extraction\", \"consolidation\", \"replay\", \"manual\", \"unknown\"]),\n })\n .strict();\n\nexport function parseMemoryActionType(value: unknown): z.infer<typeof MemoryActionTypeSchema> {\n const parsed = MemoryActionTypeSchema.safeParse(value);\n return parsed.success ? parsed.data : \"discard\";\n}\n\nexport function parseMemoryActionEligibilityContext(\n value: unknown,\n): z.infer<typeof MemoryActionEligibilityContextSchema> {\n const parsed = MemoryActionEligibilityContextSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n return {\n confidence: 0,\n lifecycleState: \"candidate\",\n importance: 0,\n source: \"unknown\",\n };\n}\n\nexport const ProcedureStepExtractSchema = z.object({\n order: z.number(),\n intent: z.string(),\n toolCall: z\n .object({\n kind: z.string(),\n signature: z.string(),\n })\n .optional()\n .nullable(),\n expectedOutcome: z.string().optional().nullable(),\n optional: z.boolean().optional().nullable(),\n});\n\nexport const ExtractedFactSchema = z.object({\n category: z.enum([\n \"fact\",\n \"preference\",\n \"correction\",\n \"entity\",\n \"decision\",\n \"relationship\",\n \"principle\",\n \"commitment\",\n \"moment\",\n \"skill\",\n \"rule\",\n \"procedure\",\n \"reasoning_trace\",\n ]),\n content: z\n .string()\n .describe(\"The memory content — a clear, standalone statement\"),\n confidence: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How confident are you this is correct (0-1)\"),\n tags: z.array(z.string()).describe(\"Relevant tags for categorization\"),\n entityRef: z\n .string()\n .optional()\n .nullable()\n .describe(\"If about an entity, its normalized name (e.g. person-jane-doe)\"),\n cueAnchors: z\n .array(\n z.object({\n type: z.enum([\"entity\", \"file\", \"tool\", \"outcome\", \"constraint\", \"date\"]),\n value: z.string(),\n }),\n )\n .optional()\n .nullable()\n .describe(\"Up to three short retrieval cues for this fact.\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this fact.\"),\n scope: z\n .enum([\"project\", \"global\"])\n .optional()\n .nullable()\n .describe(\n 'Scope classification: \"global\" for cross-project knowledge (framework bugs, library behavior, API patterns, user preferences, general coding patterns); \"project\" for project-specific knowledge (file paths, env configs, deployment details, project workarounds) and for tool, command, or CLI-flag instructions tied to one agent, since the same tool name can mean different things across agents. When keeping such an agent-tied instruction, begin the fact with a leading \"In <agent>,\" clause naming that agent. Defaults to \"project\" when a coding context is active.',\n ),\n subject: z\n .enum([\"user\", \"agent\"])\n .optional()\n .nullable()\n .describe(\n 'Memory subject: \"user\" when the fact models the person (preferences, relationships, biography, moments, commitments about their life); \"agent\" when it is reusable operating knowledge (procedures, principles, tool-usage lessons, debugging strategies, environment facts with no personal content). Emit only for fact/decision-like facts; the category defaults cover preference, relationship, moment, commitment, procedure, principle, and skill.',\n ),\n quote: z\n .string()\n .optional()\n .nullable()\n .describe(\n \"The EXACT verbatim words from the conversation that support this fact. Copy a contiguous span from a single speaker turn (not a paraphrase). Cap at ~300 characters. This is the grounding evidence for downstream faithfulness verification (issue #1575).\",\n ),\n structuredAttributes: z\n .record(z.string(), z.string())\n .optional()\n .nullable()\n .describe(\"Structured key-value attributes when the fact contains measurable or categorical data (e.g., {\\\"price\\\": \\\"29.99\\\", \\\"color\\\": \\\"blue\\\", \\\"date\\\": \\\"2024-03-15\\\"}).\"),\n procedureSteps: z\n .array(ProcedureStepExtractSchema)\n .optional()\n .nullable()\n .describe(\n 'For category \"procedure\" only: ordered steps (intent per step). At least two steps; include explicit trigger phrasing in content (e.g. \"When you deploy…\").',\n ),\n reasoningTrace: z\n .object({\n steps: z\n .array(\n z.object({\n order: z.number(),\n description: z.string(),\n }),\n )\n // Prompts and normalizer require >=2 ordered steps; enforce it at\n // the schema layer so gateway-path parsing rejects malformed traces\n // rather than persisting them (local/direct-client normalization\n // already enforces this, keeping the two paths symmetric).\n .min(2)\n .describe(\"Ordered reasoning steps the user walked through (require >=2).\"),\n // Accept snake_case aliases so a loose gateway model using\n // `final_answer` / `observed_outcome` does not fail schema parsing\n // and drop the entire extraction result. Local/direct-client\n // normalization already tolerates these keys; the gateway path must\n // too. Zod's `union` keeps the parse successful either way.\n finalAnswer: z\n .string()\n .optional()\n .nullable()\n .describe(\"The conclusion, decision, or answer the chain arrived at.\"),\n final_answer: z\n .string()\n .optional()\n .nullable()\n .describe(\"Alias for finalAnswer (snake_case). Gateway-tolerance shim.\"),\n observedOutcome: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional note about how the answer actually played out.\"),\n observed_outcome: z\n .string()\n .optional()\n .nullable()\n .describe(\"Alias for observedOutcome (snake_case). Gateway-tolerance shim.\"),\n })\n // Either finalAnswer OR final_answer must be present — enforce here so\n // the rest of the pipeline can assume a usable string downstream.\n .refine(\n (v) =>\n (typeof v.finalAnswer === \"string\" && v.finalAnswer.trim().length > 0) ||\n (typeof v.final_answer === \"string\" && v.final_answer.trim().length > 0),\n { message: \"reasoningTrace requires finalAnswer (or final_answer)\" },\n )\n .optional()\n .nullable()\n .describe(\n 'For category \"reasoning_trace\" only: a stored solution chain with ordered steps, a final answer, and an optional observed outcome. Require at least two steps.',\n ),\n eventTime: z\n .string()\n .optional()\n .nullable()\n .describe(\n 'Optional event-time expression for bi-temporal validity (#1578). An ISO date (\"2025-03-01\") or a relative expression verbatim (\"last March\", \"yesterday\", \"since 2024\", \"until 2025-06-01\"). Resolved against the source turn timestamp at write time — NOT wall-clock. Omit when the fact has no explicit temporal anchor.',\n ),\n event_time: z\n .string()\n .optional()\n .nullable()\n .describe(\"Alias for eventTime (snake_case). Gateway-tolerance shim (#1578).\"),\n}).superRefine((value, ctx) => {\n if (value.category === \"procedure\" && (!Array.isArray(value.procedureSteps) || value.procedureSteps.length < 2)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"procedureSteps\"],\n message: \"procedure facts require at least two procedureSteps\",\n });\n }\n\n if (value.category === \"reasoning_trace\" && value.reasoningTrace == null) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"reasoningTrace\"],\n message: \"reasoning_trace facts require reasoningTrace\",\n });\n }\n});\n\nexport const EntityMentionSchema = z.object({\n name: z\n .string()\n .describe(\"Normalized entity name (e.g. jane-doe, acme-corp, my-project)\"),\n type: z.enum([\"person\", \"project\", \"tool\", \"company\", \"place\", \"other\"]),\n facts: z\n .array(z.string())\n .describe(\"New facts learned about this entity in this conversation\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this entity.\"),\n structuredSections: z\n .array(z.object({\n key: z.string(),\n title: z.string(),\n facts: z.array(z.string()),\n }))\n .optional()\n .nullable()\n .describe(\"Optional named sections for entity-specific facts. Use when facts clearly belong under a durable heading such as Beliefs or Building / Working On.\"),\n});\n\nexport const ExtractedQuestionSchema = z.object({\n question: z.string().describe(\"A genuine question the AI is curious about based on this conversation\"),\n context: z.string().describe(\"Why this question matters or what prompted it\"),\n priority: z.number().min(0).max(1).describe(\"How important/urgent this question is (0-1)\"),\n});\n\nexport const ProactiveQuestionsResultSchema = z.object({\n questions: z\n .array(ExtractedQuestionSchema)\n .describe(\"Additional follow-up questions discovered in a proactive second-pass extraction.\"),\n});\n\nexport const ExtractedRelationshipSchema = z.object({\n source: z.string().describe(\"Source entity name (normalized, e.g. person-jane-doe)\"),\n target: z.string().describe(\"Target entity name (normalized, e.g. company-acme-corp)\"),\n label: z.string().describe(\"Relationship label (e.g. 'works at', 'created', 'manages')\"),\n promptedByQuestion: z\n .string()\n .optional()\n .nullable()\n .describe(\"Optional proactive follow-up question that surfaced this relationship.\"),\n});\n\nexport const ProactiveExtractionResultSchema = z.object({\n facts: z\n .array(ExtractedFactSchema)\n .describe(\n \"Additional high-confidence memories recovered only after answering proactive follow-up questions from the same buffered conversation.\",\n ),\n profileUpdates: z\n .array(z.string())\n .describe(\n \"Additional profile updates directly supported by the buffered conversation. Omit anything speculative.\",\n ),\n entities: z\n .array(EntityMentionSchema)\n .describe(\n \"Additional entities or entity facts surfaced by the proactive follow-up pass.\",\n ),\n relationships: z\n .array(ExtractedRelationshipSchema)\n .optional()\n .nullable()\n .describe(\n \"Additional relationships surfaced by the proactive follow-up pass.\",\n ),\n});\n\n/**\n * Salvage array for model-produced extraction output (issue #2455).\n *\n * Mixed valid+invalid items parse to the valid subset so one malformed\n * element no longer discards the whole extraction. A non-empty array with\n * zero valid items still fails, so bounded retry stays effective and wholly\n * malformed output is never silently accepted as empty. Empty arrays stay\n * valid. Consolidation schemas intentionally stay strict — do not use this\n * for them.\n */\nfunction salvageArray<T extends z.ZodTypeAny>(itemSchema: T) {\n return z\n .array(z.unknown())\n .transform((items, ctx) => {\n const valid: z.infer<T>[] = [];\n for (const raw of items) {\n const parsed = itemSchema.safeParse(raw);\n if (parsed.success) {\n valid.push(parsed.data);\n }\n }\n if (items.length > 0 && valid.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"array contains no items matching the schema\",\n });\n return z.NEVER;\n }\n return valid;\n });\n}\n\nexport const ExtractionResultSchema = z.object({\n facts: salvageArray(ExtractedFactSchema).describe(\n \"Extracted memories from the conversation. Include facts, preferences, corrections, and decisions. Only extract genuinely new, durable information — skip transient task state.\",\n ),\n profileUpdates: salvageArray(z.string()).describe(\n \"Updates to the user's behavioral profile. Each string is a standalone statement about the user's preferences, habits, or personality. Only include genuinely new insights.\",\n ),\n entities: salvageArray(EntityMentionSchema).describe(\n \"Entities mentioned in the conversation with new facts about them.\",\n ),\n questions: salvageArray(ExtractedQuestionSchema).describe(\n \"Zero to three source-grounded questions useful in future sessions. Return an empty array when the conversation supports none.\",\n ),\n identityReflection: z\n .string()\n .optional()\n .nullable()\n .describe(\n \"A brief reflection on what you learned about yourself as an agent in this interaction — patterns in your behavior, growth, things you did well or could improve.\",\n ),\n episodeTitle: z\n .string()\n .optional()\n .nullable()\n .describe(\"A six-to-eight word title for this conversation segment.\"),\n relationships: salvageArray(ExtractedRelationshipSchema)\n .optional()\n .nullable()\n .describe(\n \"Relationships between entities discovered in this conversation. Max 5 per extraction. Format: {source, target, label}.\",\n ),\n});\n\nexport const ConsolidationItemSchema = z.object({\n existingId: z\n .string()\n .describe(\"The ID of the existing memory being evaluated\"),\n action: z.enum([\"ADD\", \"MERGE\", \"UPDATE\", \"INVALIDATE\", \"SKIP\"]),\n mergeWith: z\n .string()\n .optional()\n .nullable()\n .describe(\"If MERGE, the ID of the memory to merge with\"),\n updatedContent: z\n .string()\n .optional()\n .nullable()\n .describe(\"If UPDATE or MERGE, the new content\"),\n reason: z.string().describe(\"Brief reason for this decision\"),\n});\n\nexport const ConsolidationResultSchema = z.object({\n items: z\n .array(ConsolidationItemSchema)\n .describe(\n \"Decisions for each existing memory: ADD (keep as-is), MERGE (combine with another), UPDATE (revise content), INVALIDATE (mark as outdated/wrong), SKIP (no action needed)\",\n ),\n profileUpdates: z\n .array(z.string())\n .describe(\"New profile statements to add or update\"),\n entityUpdates: z\n .array(EntityMentionSchema)\n .describe(\"Entity updates from consolidation analysis\"),\n});\n\nexport function buildProfileConsolidationResultSchema(targetLines: number) {\n return z.object({\n consolidatedProfile: z\n .string()\n .describe(\n `The full consolidated profile as markdown. Preserve all ## section headers. Merge duplicate or near-duplicate bullets into single clear statements. Remove stale or superseded information. Keep the most important and durable observations. Target roughly ${targetLines} lines.`,\n ),\n removedCount: z\n .number()\n .describe(\"Number of bullets removed or merged during consolidation\"),\n summary: z\n .string()\n .describe(\"Brief summary of what was consolidated\"),\n });\n}\n\nexport const ProfileConsolidationResultSchema = buildProfileConsolidationResultSchema(50);\n\nexport const IdentityConsolidationResultSchema = z.object({\n learnedPatterns: z\n .array(z.string())\n .describe(\n \"Consolidated behavioral patterns and lessons learned, each a concise standalone statement\",\n ),\n summary: z\n .string()\n .describe(\n \"A brief paragraph summarizing the agent's core identity insights\",\n ),\n});\n\nexport type IdentityConsolidationResultParsed = z.infer<\n typeof IdentityConsolidationResultSchema\n>;\n\n// Contradiction Verification (Phase 2B)\nexport const ContradictionVerificationSchema = z.object({\n isContradiction: z\n .boolean()\n .describe(\"Whether the two memories truly contradict each other\"),\n confidence: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How confident are you in this assessment (0-1)\"),\n reasoning: z\n .string()\n .describe(\"Explanation of why these are or are not contradictory\"),\n whichIsNewer: z\n .enum([\"first\", \"second\", \"unclear\"])\n .describe(\"Which memory represents the more recent/current state\"),\n});\n\nexport type ContradictionVerificationResult = z.infer<\n typeof ContradictionVerificationSchema\n>;\n\n// Memory Linking (Phase 3A)\nexport const MemoryLinkSchema = z.object({\n targetId: z\n .string()\n .describe(\"The ID of the memory this links to\"),\n linkType: z\n .enum([\"follows\", \"references\", \"contradicts\", \"supports\", \"related\"])\n .describe(\"The type of relationship\"),\n strength: z\n .number()\n .min(0)\n .max(1)\n .describe(\"How strong is this relationship (0-1)\"),\n reason: z\n .string()\n .optional()\n .nullable()\n .describe(\"Why this link exists\"),\n});\n\nexport const SuggestedLinksSchema = z.object({\n links: z\n .array(MemoryLinkSchema)\n .describe(\"Suggested links between memories based on semantic analysis\"),\n});\n\nexport type MemoryLink = z.infer<typeof MemoryLinkSchema>;\nexport type SuggestedLinks = z.infer<typeof SuggestedLinksSchema>;\n\n// Memory Summarization (Phase 4A)\nexport const MemorySummarySchema = z.object({\n summaryText: z\n .string()\n .describe(\"A concise summary of the batch of memories\"),\n keyFacts: z\n .array(z.string())\n .describe(\"The most important facts extracted from these memories\"),\n keyEntities: z\n .array(z.string())\n .describe(\"Key entities mentioned across these memories\"),\n});\n\nexport type MemorySummaryResult = z.infer<typeof MemorySummarySchema>;\n\nexport const DaySummaryResultSchema = z.object({\n summary: z.string().min(1).describe(\"A concise end-of-day summary paragraph.\"),\n bullets: z.array(z.string()).default([]).describe(\"The most important moments from the day.\"),\n next_actions: z.array(z.string()).default([]).describe(\"Concrete next actions for tomorrow.\"),\n risks_or_open_loops: z.array(z.string()).default([]).describe(\"Open loops, blockers, or fragile assumptions still needing attention.\"),\n});\n\n// v8.15 behavior-loop auto-tuning state contracts\nexport const BehaviorLoopAdjustmentSchema = z.object({\n parameter: z.string().min(1),\n previousValue: z.number(),\n nextValue: z.number(),\n delta: z.number(),\n evidenceCount: z.number().int().min(0),\n confidence: z.number().min(0).max(1),\n reason: z.string(),\n appliedAt: z.string(),\n});\n\nexport const BehaviorLoopPolicyStateSchema = z.object({\n version: z.number().int().min(0),\n windowDays: z.number().int().min(0),\n minSignalCount: z.number().int().min(0),\n maxDeltaPerCycle: z.number().min(0).max(1),\n protectedParams: z.array(z.string()),\n adjustments: z.array(BehaviorLoopAdjustmentSchema),\n updatedAt: z.string(),\n});\n\nexport type BehaviorLoopAdjustmentParsed = z.infer<typeof BehaviorLoopAdjustmentSchema>;\nexport type BehaviorLoopPolicyStateParsed = z.infer<typeof BehaviorLoopPolicyStateSchema>;\n\nexport type MemoryActionTypeParsed = z.infer<typeof MemoryActionTypeSchema>;\nexport type MemoryActionEligibilityContextParsed = z.infer<typeof MemoryActionEligibilityContextSchema>;\nexport type ExtractedFactParsed = z.infer<typeof ExtractedFactSchema>;\nexport type EntityMentionParsed = z.infer<typeof EntityMentionSchema>;\nexport type ExtractedQuestionParsed = z.infer<typeof ExtractedQuestionSchema>;\nexport type ProactiveQuestionsResultParsed = z.infer<typeof ProactiveQuestionsResultSchema>;\nexport type ExtractionResultParsed = z.infer<typeof ExtractionResultSchema>;\nexport type ConsolidationItemParsed = z.infer<typeof ConsolidationItemSchema>;\nexport type ConsolidationResultParsed = z.infer<\n typeof ConsolidationResultSchema\n>;\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,yBAAyB,EAAE,KAAK;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,uCAAuC,EACjD,OAAO;AAAA,EACN,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACnC,gBAAgB,EAAE,KAAK,CAAC,UAAU,aAAa,aAAa,SAAS,UAAU,CAAC;AAAA,EAChF,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACnC,QAAQ,EAAE,KAAK,CAAC,cAAc,iBAAiB,UAAU,UAAU,SAAS,CAAC;AAC/E,CAAC,EACA,OAAO;AAEH,SAAS,sBAAsB,OAAwD;AAC5F,QAAM,SAAS,uBAAuB,UAAU,KAAK;AACrD,SAAO,OAAO,UAAU,OAAO,OAAO;AACxC;AAEO,SAAS,oCACd,OACsD;AACtD,QAAM,SAAS,qCAAqC,UAAU,KAAK;AACnE,MAAI,OAAO,QAAS,QAAO,OAAO;AAClC,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AACF;AAEO,IAAM,6BAA6B,EAAE,OAAO;AAAA,EACjD,OAAO,EAAE,OAAO;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ACtB,CAAC;","names":[]}
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
buildExplicitCaptureDedupKey,
|
|
3
3
|
isTombstoneBlockedCaptureWriteLockBusy,
|
|
4
4
|
normalizeExplicitCaptureContent
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-W4BMEGQA.js";
|
|
6
6
|
import {
|
|
7
7
|
TAG_LIMITS,
|
|
8
8
|
composeMemoryEnvelope
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RAIUTAZZ.js";
|
|
10
10
|
import {
|
|
11
11
|
isSupportPassportPrivateMemory
|
|
12
12
|
} from "./chunk-XDL5CYZN.js";
|
|
@@ -787,4 +787,4 @@ export {
|
|
|
787
787
|
shouldProcessInlineExplicitCapture,
|
|
788
788
|
InlineExplicitCaptureProcessor
|
|
789
789
|
};
|
|
790
|
-
//# sourceMappingURL=chunk-
|
|
790
|
+
//# sourceMappingURL=chunk-7BEPVIH3.js.map
|
|
@@ -19,6 +19,7 @@ var EXTRACTION_RESPONSE_SHAPE = `{
|
|
|
19
19
|
"promptedByQuestion": "<optional source-grounded question>",
|
|
20
20
|
"quote": "<optional exact contiguous source span>",
|
|
21
21
|
"scope": "<optional project-or-global>",
|
|
22
|
+
"subject": "<optional user-or-agent>",
|
|
22
23
|
"structuredAttributes": {"<key>": "<value>"},
|
|
23
24
|
"procedureSteps": [{"order": 1, "intent": "<step>"}, {"order": 2, "intent": "<step>"}],
|
|
24
25
|
"reasoningTrace": {
|
|
@@ -194,4 +195,4 @@ export {
|
|
|
194
195
|
buildConsolidationSystemPrompt,
|
|
195
196
|
buildProfileConsolidationSystemPrompt
|
|
196
197
|
};
|
|
197
|
-
//# sourceMappingURL=chunk-
|
|
198
|
+
//# sourceMappingURL=chunk-7CBKAQIG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-prompt.ts"],"sourcesContent":["/**\n * Extraction prompt construction (issue #1995 sibling extraction).\n *\n * The system prompt, its JSON response shape, and the placeholder table\n * derived from that shape are prompt DATA, not engine behavior. They live here\n * so `extraction.ts` holds the pipeline and one module owns the text every\n * extraction path — local LLM, direct client, gateway fallback — sends.\n */\n\nimport { AMBIENT_CAPTURE_PROMPT_SECTION, AMBIENT_SPECULATIVE_TIER_CLAUSE } from \"./ambient-provenance.js\";\nimport { resolveMemoryLifecycleCapabilities, resolveRecallAuxiliaryCapabilities } from \"./capabilities.js\";\nimport type { PluginConfig } from \"./types.js\";\n\nexport const EXTRACTION_RESPONSE_SHAPE = `{\n \"facts\": [{\n \"category\": \"<category>\",\n \"content\": \"<source-grounded statement>\",\n \"confidence\": 0.0,\n \"tags\": [\"<tag>\"],\n \"entityRef\": \"<optional normalized-name>\",\n \"cueAnchors\": [{\"type\": \"<anchor-type>\", \"value\": \"<entity-or-topic plus key aspect>\"}],\n \"promptedByQuestion\": \"<optional source-grounded question>\",\n \"quote\": \"<optional exact contiguous source span>\",\n \"scope\": \"<optional project-or-global>\",\n \"subject\": \"<optional user-or-agent>\",\n \"structuredAttributes\": {\"<key>\": \"<value>\"},\n \"procedureSteps\": [{\"order\": 1, \"intent\": \"<step>\"}, {\"order\": 2, \"intent\": \"<step>\"}],\n \"reasoningTrace\": {\n \"steps\": [{\"order\": 1, \"description\": \"<step>\"}, {\"order\": 2, \"description\": \"<step>\"}],\n \"finalAnswer\": \"<answer>\",\n \"observedOutcome\": \"<optional outcome>\"\n },\n \"eventTime\": \"<optional source temporal expression>\"\n }],\n \"entities\": [{\n \"name\": \"<normalized-name>\",\n \"type\": \"<entity-type>\",\n \"facts\": [\"<source-grounded statement>\"],\n \"promptedByQuestion\": \"<optional source-grounded question>\",\n \"structuredSections\": [{\"key\": \"<section-key>\", \"title\": \"<section-title>\", \"facts\": [\"<source-grounded statement>\"]}]\n }],\n \"profileUpdates\": [\"<source-grounded profile update>\"],\n \"questions\": [{\"question\": \"<source-grounded unresolved question>\", \"context\": \"<source-grounded context>\", \"priority\": 0.0}],\n \"identityReflection\": \"<conversation-grounded agent reflection>\",\n \"episodeTitle\": \"<six-to-eight word conversation segment title>\",\n \"relationships\": [{\"source\": \"<normalized-name>\", \"target\": \"<normalized-name>\", \"label\": \"<source-grounded relationship>\"}]\n}`;\nexport const EXTRACTION_RESPONSE_PLACEHOLDERS: Record<string, true> = {};\nfor (const placeholder of EXTRACTION_RESPONSE_SHAPE.match(/<[^<>\\r\\n]+>/g) ?? []) {\n EXTRACTION_RESPONSE_PLACEHOLDERS[placeholder] = true;\n}\nexport const CUE_ANCHOR_PROMPT_INSTRUCTION = `- For each fact, emit at most 3 \"cueAnchors\".\n- Each cue anchor value must be a source-grounded search hook of at most 120 characters, in the form \"<main entity or topic> <key aspect>\".\n- Set each cue anchor type to entity, file, tool, outcome, constraint, or date.\n- Omit cue anchors when the conversation does not support a useful search hook.\n- Example: \"Alice booked Bistro Max for Mike's surprise party\" can use {\"type\":\"entity\",\"value\":\"Mike surprise party\"} and {\"type\":\"entity\",\"value\":\"Alice restaurant booking\"}.`;\n\n/**\n * Output-language policy (issue #2190). Every prompt that produces memory\n * content embeds this verbatim so non-English conversations are not silently\n * translated to English — translated memories fail later lexical recall.\n */\nexport const OUTPUT_LANGUAGE_POLICY = `Output language: write facts, profile updates, entity names and aliases, tags, questions, and any rewritten or merged memory content in the source language of the conversation or input memories. Never translate into English or another language unless the user explicitly asked for a translation.`;\n\n/**\n * Bi-temporal event-time extraction instruction (#1578 PR2). Emitted on\n * every extraction entry path when `temporal.biTemporal` is on so the LLM\n * emits an optional per-fact `eventTime` expression. The expression is\n * resolved against the source turn timestamp at write time — never\n * wall-clock — so replay/import of old transcripts anchors correctly.\n * Returns an empty string when the gate is off (byte-identical prompt).\n */\nexport function eventTimePromptInstruction(config: PluginConfig): string {\n if (!config.temporalBiTemporal) return \"\";\n return `\nWhen a fact states when it became or stopped being true, copy that explicit temporal expression verbatim into \"eventTime\". Omit \"eventTime\" when no such expression appears; never infer dates.`;\n}\n\n/**\n * Build extraction instructions shared between local and cloud LLM.\n *\n * `ambientCapture` marks input from an always-on recorder, which may carry\n * speech the user never authored (issue #2294).\n */\nexport function buildExtractionInstructions(\n config: PluginConfig,\n existingEntities?: string[],\n ambientCapture = false\n): string {\n const lifecycleCaps = resolveMemoryLifecycleCapabilities(config);\n return `You are a memory extraction system. Analyze the following conversation and extract durable, reusable memories.\n\nMemory categories:\n- fact: Objective information about the world\n- preference: User likes, dislikes, or stylistic choices\n- correction: User correcting a mistake or misconception (highest priority)\n- entity: Information about a specific person, project, tool, or company\n- decision: A choice that was made with rationale\n- relationship: How two entities relate to each other (e.g., \"Alice is Bob's manager\", \"Acme Corp uses Shopify\")\n- principle: Durable rules, values, or operating beliefs (e.g., \"never use Chat Completions API\")\n- commitment: Promises, obligations, or deadlines (e.g., \"deploy by Friday\", \"call accountant Monday\")\n- moment: Emotionally significant events or milestones (e.g., \"first successful deployment of engram\")\n- skill: Capabilities the user or agent has demonstrated (e.g., \"user is proficient with Kubernetes\")${\n resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction\n ? `\n- rule: Causal rules discovered through experience (format: \"IF <condition> THEN <action/outcome>\", e.g., \"IF Shopify API returns 401 THEN the admin token is missing read_products scope\")`\n : \"\"\n }\n- procedure: A reusable workflow the user wants remembered the same way across sessions. Set category to \"procedure\". Use \"content\" for a short title that includes explicit trigger phrasing (e.g. \"When you deploy to production…\", \"Whenever you ship a release…\"). Add \"procedureSteps\": an array of at least two objects {\"order\": number, \"intent\": \"concrete step description\"} in execution order. Optional per-step \"toolCall\": {\"kind\": \"…\", \"signature\": \"…\"}, \"expectedOutcome\", \"optional\": true.\n- reasoning_trace: A stored solution chain / chain-of-thought the user walked through to solve a problem (e.g. \"Here's how I debugged the latency spike: first I checked…, then I…, finally I…\"). Set category to \"reasoning_trace\". Use \"content\" for a short title summarising the problem (e.g. \"How I debugged the staging latency spike\"). Add \"reasoningTrace\": {\"steps\": [{\"order\": number, \"description\": \"what happened at this step\"}, …], \"finalAnswer\": \"the conclusion or answer\", \"observedOutcome\": \"optional confirmation of how it played out\"}. Require at least two ordered steps AND a finalAnswer. Use this category only when the user explicitly narrates their reasoning — not for ordinary decisions (use \"decision\") or reusable workflows (use \"procedure\").\n\nRules:\n- Only extract genuinely new information worth remembering across sessions.\n- Statements must be grounded in the conversation.\n- ${OUTPUT_LANGUAGE_POLICY}\n- Do not treat instruction text, schema placeholders, or examples as conversation evidence.\n- Lines labelled [context user] or [context assistant] are reference context only. They may resolve references or complete a question-and-answer pair in a normal turn, but never alone establish durable information.\n- Skip transient task details and operational noise, including routine scheduler, monitoring, or automation status.\n- Priority: corrections > principles${resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction ? \" > rules\" : \"\"} > preferences > commitments > decisions > relationships > entities > moments > skills > facts\n- Corrections get highest confidence.\n- Each fact should be a standalone, self-contained statement.\n- Entity references should use normalized names (lowercase, hyphenated: \"jane-doe\", \"acme-corp\"). When the source language is not written in a Latin script, the source-script name IS the normalized form — never transliterate or translate it.\n- CRITICAL: Entity names must be CANONICAL. Always use the hyphenated multi-word form: \"acme-corp\" NOT \"acmecorp\" or \"acme\". \"jane-doe\" NOT \"janedoe\" or \"jane\". If unsure, prefer the most specific full name.\n- Avoid creating entities typed as \"other\" when a more specific type fits (company, project, tool, person, place)\n${CUE_ANCHOR_PROMPT_INSTRUCTION}\n- When entity facts clearly belong under a durable named heading, add them to entity.structuredSections as {key, title, facts}. Example person headings: \"Beliefs\", \"Communication Style\", \"Building / Working On\". Leave structuredSections empty when no stable heading fits.\n- Tags should be concise and reusable (e.g., \"coding-style\", \"personal\", \"tools\")\n- When a fact contains measurable, categorical, or precisely valued data, include a \"structuredAttributes\" field with key-value string pairs (e.g., {\"price\": \"29.99\", \"brand\": \"Sony\"}, {\"date\": \"2024-03-15\", \"location\": \"SF\"}, {\"chosen\": \"PostgreSQL\", \"rejected\": \"MongoDB\"}). Only for concrete values, not narrative content.\n- Set confidence using these tiers:\n * Explicit (0.95-1.0): Direct user statements — \"I prefer X\", \"my name is Y\"\n * Implied (0.70-0.94): Strong contextual inference — user consistently does X, clear from conversation flow\n * Inferred (0.40-0.69): Pattern recognition — reasonable guess from limited evidence\n * Speculative (0.00-0.39): Tentative hypothesis — weak signal, needs future confirmation. Speculative memories auto-expire after 30 days if not confirmed.${ambientCapture ? AMBIENT_SPECULATIVE_TIER_CLAUSE : \"\"}${\n config.provenance?.enabled\n ? `\n- Source quotes: For each fact, include a \"quote\" field containing the EXACT verbatim words from the conversation that support the fact. Copy a contiguous span from a single speaker turn (not a paraphrase, not a summary). Cap at ~300 characters. This grounds every memory in the literal utterance that created it.`\n : \"\"\n }\n- For commitments: include any deadline or timeframe mentioned${\n lifecycleCaps.extractionScopeClassification\n ? `\n\nScope classification:\nFor each fact, set \"scope\" to one of:\n- \"global\" — knowledge that applies across projects: core framework/library bugs, API behavior patterns, user preferences (editor, language, style), general coding patterns, infrastructure knowledge, technology facts not tied to one codebase\n- \"project\" — knowledge specific to one codebase: file paths, environment configs, deployment details, project-specific workarounds, team/stakeholder info tied to one project, repo-specific conventions. Tool, command, or CLI-flag instructions TIED TO ONE AGENT are also \"project\", because the same tool name means different things in different agent integrations (a \"search\" tool may search repository code in one agent and the web in another); when keeping such an agent-tied instruction, the fact text MUST name the originating agent as a leading \"In <agent>,\" clause (e.g. \"In Pi, use the search tool with a repository path.\"). A tool/command fact that holds in every agent and every repo is NOT agent-tied — leave it \"global\" and do not add a qualifier (e.g. \"\\`git status --short\\` emits compact output\"). Examples: \"In Pi, the search tool takes a repository path\" -> \"project\"; \"\\`git status --short\\` emits compact output\" -> \"global\".\nWhen in doubt, prefer \"project\" — it is safer to keep knowledge scoped narrowly.`\n : \"\"\n }\n${\n ambientCapture\n ? `${AMBIENT_CAPTURE_PROMPT_SECTION}\n`\n : \"\"\n}\nEntity creation rules (STRICT):\n- Only create entities for DURABLE things: real people, companies, products, tools, ongoing projects\n- NEVER create entities for transient items: individual PRs, branches, Jira tickets, meetings, agent task IDs, log files, database tables, cron job runs, sessions\n- When you learn something about a transient item (e.g., PR #58 fixed a bug), store it as a FACT with an entityRef to the parent project — do NOT create an entity for the PR itself\n- Prefer attaching facts to broad parent entities rather than creating sub-entities. E.g., \"acme-store uses Algolia for search\" is a fact on entity \"acme-store\", NOT a new entity \"acme-store-algolia-connector\"\n- The entity list should be SHORT — think \"things that would have their own Wikipedia page\" not \"things mentioned in passing\"\n\n${\n existingEntities && existingEntities.length > 0\n ? `\nKNOWN ENTITIES (use these exact names when referencing existing things):\n${existingEntities.join(\", \")}\n\nWhen you see something that matches a known entity, use THAT name exactly. Only create a NEW entity if nothing in this list represents it.\n`\n : \"\"\n}\n${eventTimePromptInstruction(config)}\nAlso extract relationships between entities mentioned in the conversation.\n- Format: {source: \"entity-name\", target: \"entity-name\", label: \"relationship description\"}\n- Max 5 relationships per extraction\n- Only include clear, durable relationships (e.g., \"works at\", \"created\", \"manages\", \"uses\")\n- Use normalized entity names (e.g., \"person-jane-doe\", \"company-acme-corp\")\n\n\nAlso emit \"episodeTitle\" as a six-to-eight word title for this conversation segment.\nQuestions are optional. Include only source-grounded unresolved questions that would be useful in future sessions; otherwise return an empty array.\n\nFinally, write a brief identity reflection about the agent who had this conversation, based only on the conversation. Do not write about the extraction process.`;\n}\n\nexport const CONSOLIDATION_RESPONSE_SCHEMA = `{\n \"items\": [\n {\n \"existingId\": \"id\",\n \"action\": \"ADD\",\n \"mergeWith\": \"optional-existing-id\",\n \"updatedContent\": \"optional replacement content\",\n \"reason\": \"brief reason for this action\"\n }\n ],\n \"profileUpdates\": [\"optional profile update\"],\n \"entityUpdates\": [{\"name\": \"person-jane-doe\", \"type\": \"person\", \"facts\": [\"Now leads the backend team\", \"Recently migrated the user service to TypeScript\"]}]\n}`;\n\nexport const PROFILE_CONSOLIDATION_RESPONSE_SCHEMA = `{\n \"consolidatedProfile\": \"# Behavioral Profile\\\\n\\\\n... (complete markdown)\",\n \"removedCount\": 42,\n \"summary\": \"brief summary of what was consolidated\"\n}`;\n\n/**\n * System prompt shared by every consolidation path (gateway, direct client,\n * local LLM). Owns the causal-rule clause and the output-language policy so\n * the three paths cannot drift (issue #2190).\n */\nexport function buildConsolidationSystemPrompt(config: PluginConfig): string {\n return `You are a memory consolidation system. Compare new memories against existing ones and decide what to do with each.\n\nActions:\n- ADD: Keep the new memory as-is (no duplicate exists)\n- MERGE: Combine with an existing memory (provide mergeWith ID and updated content)\n- UPDATE: Replace existing memory content (provide updated content)\n- INVALIDATE: Remove existing memory (it's been superseded or is wrong)\n- SKIP: This new memory is redundant (exact duplicate or subset of existing)\n\nAlso:\n- Suggest profile updates based on patterns across memories\n- Identify entity updates for entity tracking${resolveRecallAuxiliaryCapabilities(config).causalRuleExtraction ? `\n- When merging or updating memories, look for IF→THEN causal patterns. If a memory describes \"X failed/succeeded because Y\" or \"doing X led to Y\", rewrite its content to make the causal rule explicit in the form \"IF <condition> THEN <action/outcome>\".` : \"\"}\n- ${OUTPUT_LANGUAGE_POLICY}`;\n}\n\n/**\n * System prompt shared by every profile-consolidation path (gateway, direct\n * client, local LLM). Owns the output-language policy (issue #2190).\n */\nexport function buildProfileConsolidationSystemPrompt(targetLines: number): string {\n return `You are a profile consolidation system. You are given a behavioral profile (markdown) that has grown too large. Your job is to produce a CONSOLIDATED version that:\n\n1. PRESERVES all ## section headers and their structure\n2. MERGES duplicate or near-duplicate bullet points into single, clear statements\n3. REMOVES stale information that has been superseded by newer bullets\n4. REMOVES trivial or overly specific operational details that won't be useful across sessions\n5. KEEPS the most important, durable observations about the user's preferences, habits, identity, and working style\n6. Target roughly ${targetLines} lines — this is a soft target, prioritize quality over length\n7. Write in the same style as the existing profile — concise bullets, no fluff\n8. ${OUTPUT_LANGUAGE_POLICY}\n\nThe output should be the COMPLETE consolidated profile as valid markdown, starting with \"# Behavioral Profile\".`;\n}\n"],"mappings":";;;;;;;;;;AAaO,IAAM,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYpC;AAEO,IAAM,gCAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AActC,IAAM,wCAAwC;AAAA;AAAA;AAAA;AAAA;AAW9C,SAAS,+BAA+B,QAA8B;AAC3E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+CAWsC,mCAAmC,MAAM,EAAE,uBAAuB;AAAA,oQAC8I,EAAE;AAAA,IAC7P,sBAAsB;AAC1B;AAMO,SAAS,sCAAsC,aAA6B;AACjF,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOW,WAAW;AAAA;AAAA,KAE1B,sBAAsB;AAAA;AAAA;AAG3B;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-SOBJ6NEY.js";
|
|
4
4
|
import {
|
|
5
5
|
summarizeDisclosureTokens
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3I7ASZN3.js";
|
|
7
7
|
import {
|
|
8
8
|
summarizeRetrievedMemoryProvenance
|
|
9
9
|
} from "./chunk-I4WBNM3M.js";
|
|
@@ -606,4 +606,4 @@ export {
|
|
|
606
606
|
renderRecallExplain,
|
|
607
607
|
parseRecallExplainFormat
|
|
608
608
|
};
|
|
609
|
-
//# sourceMappingURL=chunk-
|
|
609
|
+
//# sourceMappingURL=chunk-7YQ4IYS2.js.map
|