@remnic/core 9.3.726 → 9.3.728
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-boundary.d.ts +5 -5
- package/dist/access-boundary.js +22 -22
- package/dist/access-cli.js +45 -45
- package/dist/access-http.d.ts +20 -5
- package/dist/access-http.js +27 -27
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +26 -26
- package/dist/access-operations-batch.js +23 -23
- package/dist/access-operations.d.ts +6 -6
- package/dist/access-operations.js +25 -25
- package/dist/access-schema.d.ts +4 -4
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-B2PlPtxh.d.ts → access-service-Bgpjxo4f.d.ts} +36 -4
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +21 -21
- package/dist/access-surface-catalog.d.ts +5 -5
- 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 +3 -3
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +4 -4
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +7 -7
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +44 -2
- package/dist/capabilities.js +5 -3
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{catalog-CzUb-GyD.d.ts → catalog-bMczlO2G.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +8 -8
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-BIA7ELIB.js → chunk-36SEDFAU.js} +3 -3
- package/dist/{chunk-UQSVUEN2.js → chunk-37436GML.js} +2 -2
- package/dist/{chunk-DVRHLN2O.js → chunk-3RCBIOOJ.js} +18 -2
- package/dist/{chunk-DVRHLN2O.js.map → chunk-3RCBIOOJ.js.map} +1 -1
- package/dist/{chunk-RRHHQYJS.js → chunk-3TSTGI6F.js} +2 -2
- package/dist/{chunk-5OOA7SGX.js → chunk-4ESAR77N.js} +2 -2
- package/dist/{chunk-FO3HO52S.js → chunk-4H4F3BFL.js} +2 -2
- package/dist/{chunk-BEUCACTV.js → chunk-4NOI577P.js} +2 -2
- package/dist/{chunk-BBIE7W52.js → chunk-4NR2PDZ5.js} +2 -2
- package/dist/{chunk-WGTWGDR5.js → chunk-76NHR6ZL.js} +5 -5
- package/dist/{chunk-PKMQK2WY.js → chunk-773DPI6T.js} +4 -4
- package/dist/{chunk-MQVKHFIU.js → chunk-7RLCCNHU.js} +8 -8
- package/dist/{chunk-XGTBNVIU.js → chunk-AAD2ZS6P.js} +11 -1
- package/dist/chunk-AAD2ZS6P.js.map +1 -0
- package/dist/{chunk-EZNDNMRH.js → chunk-AQLOP5F4.js} +2 -2
- package/dist/{chunk-UNNDFYUX.js → chunk-ARV3AUOM.js} +5 -5
- package/dist/{chunk-NPL7VDM6.js → chunk-ASKXIAHD.js} +2 -2
- package/dist/{chunk-TQQH2FTX.js → chunk-BQCHEV7O.js} +106 -15
- package/dist/{chunk-TQQH2FTX.js.map → chunk-BQCHEV7O.js.map} +1 -1
- package/dist/{chunk-ZA2S2VLL.js → chunk-C2PG7IEH.js} +5 -2
- package/dist/chunk-C2PG7IEH.js.map +1 -0
- package/dist/{chunk-K4ZNARDO.js → chunk-CBWI22JN.js} +2 -2
- package/dist/{chunk-ZOHMPFOB.js → chunk-CKFLLAIS.js} +3 -3
- package/dist/{chunk-JPUT5NGH.js → chunk-DMQWV6SQ.js} +2 -2
- package/dist/{chunk-F3XZN24Z.js → chunk-DRUDC2UX.js} +2 -2
- package/dist/{chunk-KJR66XOM.js → chunk-EY6MDMHK.js} +2 -2
- package/dist/{chunk-3TUT4PWB.js → chunk-FVZ2ISIX.js} +2 -2
- package/dist/{chunk-C4X4QGIO.js → chunk-G6NKALRN.js} +5 -2
- package/dist/chunk-G6NKALRN.js.map +1 -0
- package/dist/{chunk-6SQQOJ4U.js → chunk-GKRLPHPU.js} +2 -2
- package/dist/{chunk-PLG6JHQS.js → chunk-H5BWGCRZ.js} +43 -42
- package/dist/chunk-H5BWGCRZ.js.map +1 -0
- package/dist/{chunk-2NBP25BG.js → chunk-HGNOCPZX.js} +171 -79
- package/dist/chunk-HGNOCPZX.js.map +1 -0
- package/dist/{chunk-5NWYQUQC.js → chunk-HOHVIVDR.js} +2 -2
- package/dist/{chunk-DCKNMLEQ.js → chunk-I5REUWLH.js} +11 -5
- package/dist/chunk-I5REUWLH.js.map +1 -0
- package/dist/{chunk-6WAJQKBS.js → chunk-JYLFZWUX.js} +2 -2
- package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
- package/dist/{chunk-UKTDXTWX.js → chunk-M4AYVEWS.js} +7 -7
- package/dist/{chunk-YTZ3VGC7.js → chunk-M4V2JVSZ.js} +2 -2
- package/dist/{chunk-TA3Y6GEX.js → chunk-MLKWJOAJ.js} +2 -2
- package/dist/{chunk-DQXPJ6HD.js → chunk-O6YH5F47.js} +4 -4
- package/dist/{chunk-7AG54AF3.js → chunk-PUR2CKX2.js} +1 -1
- package/dist/chunk-PUR2CKX2.js.map +1 -0
- package/dist/{chunk-OAHOL3ZC.js → chunk-QNEUZIAH.js} +152 -62
- package/dist/chunk-QNEUZIAH.js.map +1 -0
- package/dist/{chunk-Q6D75LVH.js → chunk-UM5AWJNQ.js} +79 -17
- package/dist/chunk-UM5AWJNQ.js.map +1 -0
- package/dist/{chunk-53EEQYE5.js → chunk-UTHQPSRC.js} +8 -8
- package/dist/{chunk-BB57OZWC.js → chunk-UVPL565C.js} +2 -2
- package/dist/{chunk-6AFVIOVZ.js → chunk-V4GNSDFH.js} +2 -2
- package/dist/{chunk-EHISUJFN.js → chunk-WAS3NV46.js} +6 -3
- package/dist/chunk-WAS3NV46.js.map +1 -0
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-V7CMKMHM.js → chunk-Y4YD5TYW.js} +3 -3
- package/dist/{chunk-7NS7AWMZ.js → chunk-YGIQORJ3.js} +3 -3
- package/dist/{chunk-MDBZTH7N.js → chunk-YKBHOBJK.js} +44 -10
- package/dist/chunk-YKBHOBJK.js.map +1 -0
- package/dist/{chunk-3MS3QVX6.js → chunk-YOLZS7NY.js} +2 -2
- package/dist/{chunk-6OIDDKAA.js → chunk-YTU7WKYN.js} +35 -9
- package/dist/chunk-YTU7WKYN.js.map +1 -0
- package/dist/{cli-IOlDHSBT.d.ts → cli-BLME420h.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +49 -49
- package/dist/compat/codex-cli-fallback.d.ts +1 -0
- package/dist/compat/codex-cli-fallback.js +22 -0
- package/dist/compat/codex-cli-fallback.js.map +1 -0
- package/dist/compat/codex-thread-key.d.ts +1 -0
- package/dist/compat/codex-thread-key.js +18 -0
- package/dist/compat/codex-thread-key.js.map +1 -0
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +7 -7
- 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 +3 -3
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +7 -7
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- 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/day-summary.d.ts +1 -1
- package/dist/delinearize.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/embedding-fallback.js +2 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +7 -7
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +4 -4
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-faithfulness.js +2 -2
- 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.d.ts +1 -1
- package/dist/extraction.js +3 -2
- package/dist/faithfulness-config.d.ts +1 -0
- package/dist/faithfulness-config.js +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-PG5HBC3K.js → first-start-migration-22LPFHD5.js} +6 -2
- package/dist/first-start-migration-22LPFHD5.js.map +1 -0
- 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-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +64 -64
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +7 -7
- 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-model-endpoint.d.ts +9 -4
- package/dist/local-model-endpoint.js +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +7 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection.js +8 -8
- package/dist/mcp-memory-inspector-app.d.ts +5 -5
- 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-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +2 -2
- package/dist/namespaces/migrate.js +14 -13
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +6 -5
- package/dist/namespaces/storage.d.ts +2 -2
- package/dist/namespaces/storage.js +7 -7
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +20 -20
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +9 -9
- package/dist/{orchestrator-C_OMSIMZ.d.ts → orchestrator-DqPAz8ot.d.ts} +3 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +33 -33
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/provenance.js +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.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-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-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/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +4 -4
- package/dist/retrieval-agents.d.ts +1 -1
- 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/search/embed-helper.d.ts +1 -1
- package/dist/search/embed-helper.js +2 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +5 -4
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +9 -8
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-B8LiYtvx.d.ts → semantic-consolidation-Cl15ksZy.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +8 -8
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +7 -7
- 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 +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +6 -6
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.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 +1 -1
- 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/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-DmTaqob2.d.ts → types-ChQb9D6s.d.ts} +8 -0
- 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 +7 -7
- package/package.json +26 -2
- package/src/access-http.ts +68 -1
- package/src/access-service.ts +2 -1
- package/src/admin/admin-surfaces.test.ts +289 -0
- package/src/admin/admin-surfaces.ts +138 -7
- package/src/bitemporal-dedup-backfill.test.ts +294 -0
- package/src/capabilities.test.ts +155 -0
- package/src/capabilities.ts +91 -0
- package/src/chat/chat-engine.test.ts +104 -1
- package/src/chat/chat-http.test.ts +119 -1
- package/src/chat/chat-http.ts +252 -97
- package/src/chat/chat-session.ts +166 -7
- package/src/cli.ts +3 -2
- package/src/compat/codex-cli-fallback.ts +23 -0
- package/src/compat/codex-subpath-aliases.test.ts +93 -0
- package/src/compat/codex-thread-key.ts +23 -0
- package/src/embedding-fallback.ts +2 -1
- package/src/extraction-faithfulness.test.ts +240 -0
- package/src/extraction-faithfulness.ts +58 -6
- package/src/extraction.ts +7 -3
- package/src/faithfulness-config.ts +16 -1
- package/src/local-model-endpoint.ts +24 -3
- package/src/maintenance/first-start-migration.ts +3 -1
- package/src/orchestrator.ts +238 -34
- package/src/provenance-extraction.test.ts +266 -0
- package/src/provenance.ts +66 -16
- package/src/search/embed-helper.ts +3 -2
- package/src/types.ts +8 -0
- package/dist/chunk-2NBP25BG.js.map +0 -1
- package/dist/chunk-6OIDDKAA.js.map +0 -1
- package/dist/chunk-7AG54AF3.js.map +0 -1
- package/dist/chunk-C4X4QGIO.js.map +0 -1
- package/dist/chunk-DCKNMLEQ.js.map +0 -1
- package/dist/chunk-EHISUJFN.js.map +0 -1
- package/dist/chunk-MDBZTH7N.js.map +0 -1
- package/dist/chunk-OAHOL3ZC.js.map +0 -1
- package/dist/chunk-PLG6JHQS.js.map +0 -1
- package/dist/chunk-Q6D75LVH.js.map +0 -1
- package/dist/chunk-XGTBNVIU.js.map +0 -1
- package/dist/chunk-ZA2S2VLL.js.map +0 -1
- package/dist/first-start-migration-PG5HBC3K.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-BIA7ELIB.js.map → chunk-36SEDFAU.js.map} +0 -0
- /package/dist/{chunk-UQSVUEN2.js.map → chunk-37436GML.js.map} +0 -0
- /package/dist/{chunk-RRHHQYJS.js.map → chunk-3TSTGI6F.js.map} +0 -0
- /package/dist/{chunk-5OOA7SGX.js.map → chunk-4ESAR77N.js.map} +0 -0
- /package/dist/{chunk-FO3HO52S.js.map → chunk-4H4F3BFL.js.map} +0 -0
- /package/dist/{chunk-BEUCACTV.js.map → chunk-4NOI577P.js.map} +0 -0
- /package/dist/{chunk-BBIE7W52.js.map → chunk-4NR2PDZ5.js.map} +0 -0
- /package/dist/{chunk-WGTWGDR5.js.map → chunk-76NHR6ZL.js.map} +0 -0
- /package/dist/{chunk-PKMQK2WY.js.map → chunk-773DPI6T.js.map} +0 -0
- /package/dist/{chunk-MQVKHFIU.js.map → chunk-7RLCCNHU.js.map} +0 -0
- /package/dist/{chunk-EZNDNMRH.js.map → chunk-AQLOP5F4.js.map} +0 -0
- /package/dist/{chunk-UNNDFYUX.js.map → chunk-ARV3AUOM.js.map} +0 -0
- /package/dist/{chunk-NPL7VDM6.js.map → chunk-ASKXIAHD.js.map} +0 -0
- /package/dist/{chunk-K4ZNARDO.js.map → chunk-CBWI22JN.js.map} +0 -0
- /package/dist/{chunk-ZOHMPFOB.js.map → chunk-CKFLLAIS.js.map} +0 -0
- /package/dist/{chunk-JPUT5NGH.js.map → chunk-DMQWV6SQ.js.map} +0 -0
- /package/dist/{chunk-F3XZN24Z.js.map → chunk-DRUDC2UX.js.map} +0 -0
- /package/dist/{chunk-KJR66XOM.js.map → chunk-EY6MDMHK.js.map} +0 -0
- /package/dist/{chunk-3TUT4PWB.js.map → chunk-FVZ2ISIX.js.map} +0 -0
- /package/dist/{chunk-6SQQOJ4U.js.map → chunk-GKRLPHPU.js.map} +0 -0
- /package/dist/{chunk-5NWYQUQC.js.map → chunk-HOHVIVDR.js.map} +0 -0
- /package/dist/{chunk-6WAJQKBS.js.map → chunk-JYLFZWUX.js.map} +0 -0
- /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-UKTDXTWX.js.map → chunk-M4AYVEWS.js.map} +0 -0
- /package/dist/{chunk-YTZ3VGC7.js.map → chunk-M4V2JVSZ.js.map} +0 -0
- /package/dist/{chunk-TA3Y6GEX.js.map → chunk-MLKWJOAJ.js.map} +0 -0
- /package/dist/{chunk-DQXPJ6HD.js.map → chunk-O6YH5F47.js.map} +0 -0
- /package/dist/{chunk-53EEQYE5.js.map → chunk-UTHQPSRC.js.map} +0 -0
- /package/dist/{chunk-BB57OZWC.js.map → chunk-UVPL565C.js.map} +0 -0
- /package/dist/{chunk-6AFVIOVZ.js.map → chunk-V4GNSDFH.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-V7CMKMHM.js.map → chunk-Y4YD5TYW.js.map} +0 -0
- /package/dist/{chunk-7NS7AWMZ.js.map → chunk-YGIQORJ3.js.map} +0 -0
- /package/dist/{chunk-3MS3QVX6.js.map → chunk-YOLZS7NY.js.map} +0 -0
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
getHostEmbeddingProvider,
|
|
3
3
|
normalizeHostEmbeddingVector
|
|
4
4
|
} from "./chunk-3ONXXHQO.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveMemoryLifecycleCapabilities
|
|
7
|
+
} from "./chunk-3RCBIOOJ.js";
|
|
5
8
|
import {
|
|
6
9
|
readEnvVar
|
|
7
10
|
} from "./chunk-JUC24CTX.js";
|
|
@@ -225,7 +228,7 @@ var EmbeddingFallback = class {
|
|
|
225
228
|
return run;
|
|
226
229
|
}
|
|
227
230
|
async resolveProvider(options = {}) {
|
|
228
|
-
if (!this.config.
|
|
231
|
+
if (!resolveMemoryLifecycleCapabilities(this.config).embeddingFallback) return null;
|
|
229
232
|
if (options.includeHost !== false && this.config.hostEmbeddingProviderEnabled !== false) {
|
|
230
233
|
const hostProvider = getHostEmbeddingProvider(this.config.memoryDir);
|
|
231
234
|
if (hostProvider) {
|
|
@@ -510,4 +513,4 @@ export {
|
|
|
510
513
|
EmbeddingProviderUnavailableError,
|
|
511
514
|
EmbeddingFallback
|
|
512
515
|
};
|
|
513
|
-
//# sourceMappingURL=chunk-
|
|
516
|
+
//# sourceMappingURL=chunk-C2PG7IEH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/embedding-fallback.ts"],"sourcesContent":["import path from \"node:path\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { log } from \"./logger.js\";\nimport { resolveMemoryLifecycleCapabilities } from \"./capabilities.js\";\nimport { readEnvVar } from \"./runtime/env.js\";\nimport type { PluginConfig } from \"./types.js\";\nimport {\n getHostEmbeddingProvider,\n type HostEmbeddingProvider,\n normalizeHostEmbeddingVector,\n} from \"./host-embedding-provider.js\";\n\ntype EmbeddingProviderType = \"openai\" | \"local\" | \"host\";\n\ntype ProviderConfig = {\n type: EmbeddingProviderType;\n model: string;\n endpoint?: string;\n headers?: Record<string, string>;\n hostProvider?: HostEmbeddingProvider;\n};\n\ntype EmbeddingIndexEntry = {\n vector: number[];\n path: string;\n};\n\ntype EmbeddingResult = {\n provider: ProviderConfig;\n vector: number[];\n};\n\ntype EmbeddingIndexFile = {\n version: 1;\n provider: EmbeddingProviderType;\n model: string;\n entries: Record<string, EmbeddingIndexEntry>;\n};\n\ntype EmbeddingIndexIdentity = Pick<EmbeddingIndexFile, \"provider\" | \"model\">;\ntype EmbeddingIndexComparable =\n | EmbeddingIndexIdentity\n | Pick<ProviderConfig, \"type\" | \"model\">;\n\nconst DEFAULT_OPENAI_MODEL = \"text-embedding-3-small\";\n\n/**\n * Thrown by `EmbeddingFallback.search()` (via `embed()`) when the embedding\n * backend is effectively unavailable on the lookup path — either because the\n * HTTP fetch exceeded its deadline OR because the endpoint returned a non-2xx\n * status code. Callers that need to distinguish a backend outage from \"no\n * candidates\" can `instanceof`-check against this class.\n *\n * Round 9 fix (Finding UZqB): previously a timeout returned null from embed(),\n * which caused search() to return [] silently. decideSemanticDedup then\n * classified the result as no_candidates instead of backend_unavailable, so\n * the per-batch batchBackendUnavailable short-circuit never activated and\n * batches of N facts each paid a full timeout roundtrip.\n *\n * Round 10 fix (Findings Ui1J + Ui1L): search() now only re-throws this error\n * when the caller explicitly passes `{ throwOnTimeout: true }`. Without that\n * flag search() catches it and returns [] instead, preserving fail-open\n * semantics for recall-path callers (searchEmbeddingFallback) that have no\n * try/catch. Only the semantic-dedup path (semanticDedupLookup) passes the\n * flag so it can still reach decideSemanticDedup's backend_unavailable branch.\n *\n * Round 11 fix (Finding Ur_J): `embed()` now also throws this error from the\n * lookup path when the HTTP response is non-2xx (e.g. 429, 500, 503). Without\n * this, repeated 5xx outages would each return null → [] → no_candidates and\n * subsequent facts in the same batch would all pay full roundtrips instead of\n * tripping the per-batch backend_unavailable short-circuit.\n *\n * The class name is kept for backward compatibility — `EmbeddingTimeoutError`\n * now signals \"lookup backend unavailable\" rather than strictly \"timed out\".\n */\nexport class EmbeddingTimeoutError extends Error {\n override readonly name = \"EmbeddingTimeoutError\" as const;\n constructor(message: string) {\n super(message);\n }\n}\n\nexport class EmbeddingProviderUnavailableError extends Error {\n override readonly name = \"EmbeddingProviderUnavailableError\" as const;\n constructor(message: string) {\n super(message);\n }\n}\n\nfunction isLookupBackendUnavailableError(err: unknown): boolean {\n return (\n err instanceof EmbeddingTimeoutError ||\n err instanceof EmbeddingProviderUnavailableError\n );\n}\n\n/**\n * Maximum time to wait for an embedding HTTP request on the LOOKUP/query\n * path before giving up.\n *\n * The write-time semantic dedup guard in orchestrator.persistExtraction()\n * blocks each candidate fact on an embedding lookup. If the embedding\n * endpoint hangs (degraded OpenAI, stalled local gateway, DNS timeout),\n * extraction would otherwise stall indefinitely — a single bad backend\n * could freeze the entire persist loop. Bounding the fetch here ensures\n * the decision path fails open (returns null) within a predictable window\n * and writes proceed as non-duplicates.\n *\n * Tests can override via REMNIC_EMBEDDING_FETCH_TIMEOUT_MS so they don't\n * have to wait the full default on hung-fetch assertions.\n *\n * Related: joshuaswarren/remnic#373, PR #399 P1/P2 review.\n */\nconst DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS = 5000;\n\n/**\n * Maximum time to wait for an embedding HTTP request on the INDEX path.\n *\n * Indexing runs asynchronously after a memory has already been persisted\n * to disk. It does not block extraction or writes — it only updates the\n * embedding index used by later semantic dedup lookups. A slow local\n * CPU-backed embedding model can legitimately take tens of seconds per\n * call, so applying the short lookup timeout here silently dropped index\n * updates and caused later dedup lookups to miss recently persisted\n * memories. Use a much larger budget on this path.\n *\n * Tests can override via REMNIC_EMBEDDING_INDEX_TIMEOUT_MS.\n */\nconst DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS = 120_000;\n\nfunction resolveEmbeddingLookupTimeoutMs(): number {\n const raw = readEnvVar(\"REMNIC_EMBEDDING_FETCH_TIMEOUT_MS\");\n if (raw) {\n const parsed = Number(raw);\n if (Number.isFinite(parsed) && parsed > 0) {\n return Math.floor(parsed);\n }\n }\n return DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS;\n}\n\nfunction resolveEmbeddingIndexTimeoutMs(): number {\n const raw = readEnvVar(\"REMNIC_EMBEDDING_INDEX_TIMEOUT_MS\");\n if (raw) {\n const parsed = Number(raw);\n if (Number.isFinite(parsed) && parsed > 0) {\n return Math.floor(parsed);\n }\n }\n return DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS;\n}\n\n/**\n * Options for the low-level embed() call.\n *\n * `mode` selects the timeout profile:\n * - \"lookup\" (default): bounded by the short lookup budget; fails open fast.\n * - \"index\": bounded by a much longer budget so slow backends can still\n * index newly persisted memories.\n */\nexport type EmbedMode = \"lookup\" | \"index\";\n\nexport class EmbeddingFallback {\n private readonly indexPath: string;\n private loaded: EmbeddingIndexFile | null = null;\n private mutationQueue: Promise<void> = Promise.resolve();\n\n constructor(private readonly config: PluginConfig) {\n this.indexPath = path.join(config.memoryDir, \"state\", \"embeddings.json\");\n }\n\n async isAvailable(): Promise<boolean> {\n return (await this.resolveProvider()) !== null;\n }\n\n /**\n * Embed an array of texts and return their embedding vectors.\n *\n * This is the public batch-embed interface used by semantic chunking\n * (Finding 1, PR #420 post-merge). Texts are grouped into batches of\n * `embeddingBatchSize` (from `semanticChunkingConfig`, default 32) and\n * each batch is dispatched concurrently via `Promise.all()`. This\n * preserves the semantic intent of `embeddingBatchSize` — without batching,\n * every text incurred a sequential HTTP round-trip, making the batch size\n * config ineffective. (PR #439 post-merge Finding 2.)\n *\n * If the provider is unavailable or any single embedding fails, the method\n * throws so the caller can fall back to recursive chunking.\n */\n async embedTexts(texts: string[]): Promise<number[][]> {\n const provider = await this.resolveProvider();\n if (!provider) {\n throw new Error(\"Embedding provider is not available\");\n }\n\n const batchSize = Math.max(\n 1,\n this.config.semanticChunkingConfig?.embeddingBatchSize ?? 32,\n );\n\n const vectors: number[][] = [];\n for (let i = 0; i < texts.length; i += batchSize) {\n const batch = texts.slice(i, i + batchSize);\n const batchResults = await Promise.all(\n batch.map((text) => this.embed(text, provider, { mode: \"lookup\" })),\n );\n for (const vec of batchResults) {\n if (!vec) {\n throw new Error(\"Embedding returned null for input text\");\n }\n vectors.push(vec);\n }\n }\n return vectors;\n }\n\n /**\n * Nearest-neighbor search against the embedding index.\n *\n * @param query The query string to embed and search for.\n * @param limit Max number of hits to return.\n * @param options Optional filters.\n * - `pathPrefix` Restrict candidates to entries whose indexed `path`\n * starts with this prefix (relative to `memoryDir`).\n * Used by the semantic dedup guard to scope lookups\n * to the target namespace so a high-similarity hit\n * from a different namespace can't suppress a write\n * in the target namespace. Default: no filter.\n * - `pathExcludePrefixes`\n * Exclude any entry whose indexed `path` starts with\n * any of these prefixes. Used for the default\n * namespace case: when the default namespace lives at\n * `memoryDir` root (legacy layout) we still want to\n * exclude `namespaces/<other>/…` entries.\n */\n async search(\n query: string,\n limit: number,\n options: {\n pathPrefix?: string;\n pathExcludePrefixes?: readonly string[];\n /**\n * When true, an `EmbeddingTimeoutError` from the embedding backend is\n * re-thrown to the caller. Use this on the semantic-dedup path so\n * `decideSemanticDedup`'s catch block can classify the result as\n * `reason=\"backend_unavailable\"` and activate the per-batch\n * short-circuit.\n *\n * When false (the default), a timeout is caught here and search()\n * returns [] instead — preserving fail-open semantics for the recall\n * path (`searchEmbeddingFallback`) which has no surrounding try/catch.\n * Without this gate a timed-out embedding request on the recall path\n * would propagate as an unhandled rejection and abort recall entirely.\n * (Round 10 fix, Findings Ui1J + Ui1L.)\n */\n throwOnTimeout?: boolean;\n } = {},\n ): Promise<Array<{ id: string; score: number; path: string }>> {\n const provider = await this.resolveProvider();\n if (!provider) return [];\n\n let queryResult = await this.embedForSearch(query, provider, options);\n if (!queryResult) return [];\n\n const diskIdentity = await this.readIndexIdentityFromDisk();\n if (diskIdentity && !sameIndexIdentity(diskIdentity, queryResult.provider)) {\n const diskProvider = await this.resolveFallbackProviderForIndexIdentity(diskIdentity);\n if (diskProvider) {\n const diskQueryResult = await this.embedForSearch(query, diskProvider, options);\n if (diskQueryResult && sameIndexIdentity(diskIdentity, diskQueryResult.provider)) {\n queryResult = diskQueryResult;\n } else {\n log.debug(\n `embedding fallback search skipped: preserved ${diskIdentity.provider}/${diskIdentity.model} index is unavailable for lookup`,\n );\n return [];\n }\n } else {\n log.debug(\n `embedding fallback search skipped: query provider ${queryResult.provider.type}/${queryResult.provider.model} does not match existing ${diskIdentity.provider}/${diskIdentity.model} index`,\n );\n return [];\n }\n }\n\n const index = await this.loadIndex(queryResult.provider);\n const ids = Object.keys(index.entries);\n if (ids.length === 0) return [];\n\n const includePrefix = normalizePathPrefix(options.pathPrefix);\n const excludePrefixes = (options.pathExcludePrefixes ?? [])\n .map((p) => normalizePathPrefix(p))\n .filter((p): p is string => typeof p === \"string\");\n\n const scored = ids\n .map((id) => {\n const entry = index.entries[id];\n return {\n id,\n path: entry.path,\n score: cosineSimilarity(queryResult.vector, entry.vector),\n };\n })\n .filter((r) => {\n if (!Number.isFinite(r.score)) return false;\n const normalized = normalizeEntryPath(r.path);\n if (includePrefix !== undefined && !normalized.startsWith(includePrefix)) {\n return false;\n }\n for (const excl of excludePrefixes) {\n if (normalized.startsWith(excl)) return false;\n }\n return true;\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, Math.max(1, limit));\n\n return scored;\n }\n\n async indexFile(memoryId: string, content: string, filePath: string): Promise<void> {\n const provider = await this.resolveProvider();\n if (!provider) return;\n // Indexing is not on the write-critical path: a newly persisted memory\n // has already been written to disk by the time we reach this call. Use\n // the long \"index\" timeout so slow local embedding backends can still\n // add the entry to the index. Previously this used the short lookup\n // budget and silently dropped updates, leaving later dedup lookups\n // blind to the memory. Related: PR #399 P2.\n const result = await this.embedWithEffectiveProvider(content, provider, {\n mode: \"index\",\n });\n if (!result) return;\n\n await this.enqueueIndexMutation(async () => {\n const existing = await this.readIndexIdentityFromDisk();\n if (\n existing &&\n !sameIndexIdentity(existing, result.provider) &&\n !canReplaceIndexIdentity(existing, result.provider)\n ) {\n log.debug(\n `embedding fallback index update skipped: ${result.provider.type}/${result.provider.model} would replace existing ${existing.provider}/${existing.model} index`,\n );\n return;\n }\n const index = await this.loadIndex(result.provider);\n const relPath = toMemoryRelativePath(this.config.memoryDir, filePath);\n index.entries[memoryId] = {\n vector: result.vector,\n path: relPath,\n };\n await this.saveIndex(index);\n });\n }\n\n async removeFromIndex(memoryId: string): Promise<void> {\n const provider = await this.resolveProvider();\n if (!provider) return;\n\n await this.enqueueIndexMutation(async () => {\n const providers = [provider];\n const diskIdentity = await this.readIndexIdentityFromDisk();\n if (\n diskIdentity &&\n !providers.some((entry) => sameIndexIdentity(entry, diskIdentity))\n ) {\n providers.push(providerFromIndexIdentity(diskIdentity));\n }\n if (provider.type === \"host\") {\n const fallbackProvider = await this.resolveProvider({ includeHost: false });\n if (\n fallbackProvider &&\n !providers.some((entry) => sameIndexIdentity(entry, fallbackProvider))\n ) {\n providers.push(fallbackProvider);\n }\n }\n\n for (const indexProvider of providers) {\n const index = await this.loadIndex(indexProvider);\n if (!index.entries[memoryId]) continue;\n delete index.entries[memoryId];\n await this.saveIndex(index);\n }\n });\n }\n\n private enqueueIndexMutation<T>(mutation: () => Promise<T>): Promise<T> {\n const run = this.mutationQueue.catch(() => undefined).then(mutation);\n this.mutationQueue = run.then(\n () => undefined,\n () => undefined,\n );\n return run;\n }\n\n private async resolveProvider(\n options: { includeHost?: boolean } = {},\n ): Promise<ProviderConfig | null> {\n if (!resolveMemoryLifecycleCapabilities(this.config).embeddingFallback) return null;\n\n if (\n options.includeHost !== false &&\n this.config.hostEmbeddingProviderEnabled !== false\n ) {\n const hostProvider = getHostEmbeddingProvider(this.config.memoryDir);\n if (hostProvider) {\n return {\n type: \"host\",\n model: hostProvider.model || hostProvider.id,\n hostProvider,\n };\n }\n }\n\n const preferred = this.config.embeddingFallbackProvider;\n const providers = preferred === \"auto\" ? [\"openai\", \"local\"] : [preferred];\n\n for (const p of providers) {\n if (p === \"openai\") {\n const provider = this.createOpenAiProvider();\n if (provider) return provider;\n }\n\n if (p === \"local\") {\n const provider = this.createLocalProvider();\n if (provider) return provider;\n }\n }\n\n return null;\n }\n\n private async resolveFallbackProviderForIndexIdentity(\n identity: EmbeddingIndexIdentity,\n ): Promise<ProviderConfig | null> {\n if (identity.provider === \"openai\") {\n const provider = this.createOpenAiProvider();\n return provider && sameIndexIdentity(provider, identity) ? provider : null;\n }\n if (identity.provider === \"local\") {\n const provider = this.createLocalProvider();\n return provider && sameIndexIdentity(provider, identity) ? provider : null;\n }\n return null;\n }\n\n private createOpenAiProvider(): ProviderConfig | null {\n if (!this.config.openaiApiKey) return null;\n const baseUrl = this.config.openaiBaseUrl ?? \"https://api.openai.com/v1\";\n return {\n type: \"openai\",\n model: DEFAULT_OPENAI_MODEL,\n endpoint: `${baseUrl.replace(/\\/$/, \"\")}/embeddings`,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${this.config.openaiApiKey}`,\n },\n };\n }\n\n private createLocalProvider(): ProviderConfig | null {\n if (!this.config.localLlmEnabled || !this.config.localLlmUrl) return null;\n const base = this.config.localLlmUrl.replace(/\\/$/, \"\");\n const endpoint = /\\/v1$/i.test(base) ? `${base}/embeddings` : `${base}/v1/embeddings`;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...(this.config.localLlmHeaders ?? {}),\n };\n if (this.config.localLlmApiKey && this.config.localLlmAuthHeader !== false) {\n headers.Authorization = `Bearer ${this.config.localLlmApiKey}`;\n }\n return {\n type: \"local\",\n model:\n this.config.embeddingFallbackModel ||\n this.config.localLlmModel ||\n DEFAULT_OPENAI_MODEL,\n endpoint,\n headers,\n };\n }\n\n private async embedForSearch(\n query: string,\n provider: ProviderConfig,\n options: { throwOnTimeout?: boolean } = {},\n ): Promise<EmbeddingResult | null> {\n try {\n return await this.embedWithEffectiveProvider(query, provider, {\n mode: \"lookup\",\n });\n } catch (err) {\n if (isLookupBackendUnavailableError(err)) {\n if (options.throwOnTimeout) {\n throw err;\n }\n // Fail-open: recall-path callers get an empty result rather than an\n // unhandled rejection that would abort recall entirely.\n log.debug(\"embedding fallback search: backend unavailable on lookup, returning [] (throwOnTimeout=false)\");\n return null;\n }\n throw err;\n }\n }\n\n private async embed(\n input: string,\n provider: ProviderConfig,\n options: { mode?: EmbedMode } = {},\n ): Promise<number[] | null> {\n const result = await this.embedWithEffectiveProvider(input, provider, options);\n return result?.vector ?? null;\n }\n\n private async embedWithEffectiveProvider(\n input: string,\n provider: ProviderConfig,\n options: { mode?: EmbedMode } = {},\n ): Promise<EmbeddingResult | null> {\n // Bound the fetch so a hung embedding endpoint cannot stall callers.\n // The lookup path uses a short budget (see DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS\n // docblock) so semantic dedup fails open fast. The index path uses a\n // much longer budget because slow local backends (CPU embedding models)\n // otherwise drop index updates and blind later dedup lookups. See\n // DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS docblock and PR #399 P2 review.\n const mode: EmbedMode = options.mode ?? \"lookup\";\n const timeoutMs =\n mode === \"index\"\n ? resolveEmbeddingIndexTimeoutMs()\n : resolveEmbeddingLookupTimeoutMs();\n if (provider.type === \"host\") {\n const vector = await this.embedWithHostProvider(input, provider, mode, timeoutMs);\n if (vector) return { provider, vector };\n const fallbackProvider = await this.resolveProvider({ includeHost: false });\n if (!fallbackProvider) {\n if (mode === \"lookup\") {\n throw new EmbeddingProviderUnavailableError(\n `host embedding provider unavailable (${provider.hostProvider?.id ?? provider.model})`,\n );\n }\n return null;\n }\n return this.embedWithEffectiveProvider(input, fallbackProvider, options);\n }\n if (!provider.endpoint || !provider.headers) return null;\n try {\n const res = await fetch(provider.endpoint, {\n method: \"POST\",\n headers: provider.headers,\n body: JSON.stringify({\n model: provider.model,\n input: input.slice(0, 8000),\n encoding_format: \"float\",\n }),\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!res.ok) {\n log.debug(`embedding fallback request failed: ${provider.type} ${res.status}`);\n // Round 11 fix (Finding Ur_J): on the LOOKUP path, a non-2xx response\n // means the embedding backend is effectively unavailable. Throw the\n // tagged error so search() (when called with throwOnTimeout) propagates\n // to decideSemanticDedup's backend_unavailable branch, activating the\n // per-batch short-circuit. Without this, repeated 429/5xx responses\n // would silently return [] for every fact in the batch.\n //\n // On the INDEX path a non-2xx is non-fatal (the memory is already\n // persisted; index update can be skipped) — return null there.\n if (mode === \"lookup\") {\n throw new EmbeddingTimeoutError(\n `embedding backend returned ${res.status} (${provider.type})`,\n );\n }\n return null;\n }\n const payload = (await res.json()) as any;\n const vector = payload?.data?.[0]?.embedding;\n if (!Array.isArray(vector)) return null;\n const normalized = vector\n .map((n: unknown) => Number(n))\n .filter((n: number) => Number.isFinite(n));\n return normalized.length > 0 ? { provider, vector: normalized } : null;\n } catch (err) {\n // Round 11 (Finding Ur_J): the !res.ok branch above throws\n // EmbeddingTimeoutError directly. Re-throw it here so the catch does\n // not swallow our own intentional signal back into a null return.\n if (isLookupBackendUnavailableError(err)) {\n throw err;\n }\n // AbortSignal.timeout throws a DOMException with name \"TimeoutError\";\n // surface at warn level so operators can distinguish slow backends from\n // generic errors.\n const isTimeout =\n err instanceof Error &&\n (err.name === \"TimeoutError\" || err.name === \"AbortError\");\n if (isTimeout) {\n log.warn(\n `embedding fallback fetch timed out after ${timeoutMs}ms (${provider.type}, mode=${mode})`,\n );\n // Round 9 fix (Finding UZqB): on the LOOKUP path a timeout means the\n // embedding backend is effectively unavailable — re-throw so that\n // search() propagates the error to semanticDedupLookup, which lets it\n // reach decideSemanticDedup's catch block and return\n // reason=\"backend_unavailable\". Without this, search() would silently\n // return [] and the per-batch batchBackendUnavailable flag would never\n // flip, causing subsequent facts in the same batch to each pay a full\n // timeout roundtrip (N × timeout instead of 1 × timeout).\n //\n // On the INDEX path a timeout is not fatal (the memory is already\n // persisted; index update can be skipped) — return null there so\n // indexFile() stays non-blocking.\n if (mode === \"lookup\") {\n throw new EmbeddingTimeoutError(\n `embedding backend timed out after ${timeoutMs}ms (${provider.type})`,\n );\n }\n } else {\n // Round 12 fix (PR #399 thread PRRT_kwDORJXyws56U6Gi): non-timeout\n // transport failures (ECONNREFUSED, DNS errors, TLS failures) are just\n // as fatal as timeouts on the LOOKUP path — the embedding backend is\n // effectively unreachable. Throw EmbeddingTimeoutError so that\n // search() (when called with throwOnTimeout:true) propagates the error\n // to decideSemanticDedup's backend_unavailable branch, activating the\n // per-batch short-circuit. Without this, each fact in the batch would\n // pay a full ECONNREFUSED roundtrip and return null → [] → no_candidates,\n // preventing batchBackendUnavailable from ever being set.\n //\n // On the INDEX path a transport failure is non-fatal — the memory is\n // already persisted; index update can be safely skipped.\n if (mode === \"lookup\") {\n log.warn(\n `embedding fallback transport error on lookup path (${provider.type}): ${err}`,\n );\n throw new EmbeddingTimeoutError(\n `embedding backend transport failure (${provider.type}): ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n log.debug(`embedding fallback error: ${err}`);\n }\n return null;\n }\n }\n\n private async embedWithHostProvider(\n input: string,\n provider: ProviderConfig,\n mode: EmbedMode,\n timeoutMs: number,\n ): Promise<number[] | null> {\n const hostProvider = provider.hostProvider;\n if (!hostProvider) return null;\n try {\n const vector = await hostProvider.embed(input.slice(0, 8000), {\n signal: AbortSignal.timeout(timeoutMs),\n inputType: mode === \"lookup\" ? \"query\" : \"document\",\n });\n return normalizeHostEmbeddingVector(vector);\n } catch (err) {\n log.debug(`host embedding provider error: ${hostProvider.id}: ${err}`);\n return null;\n }\n }\n\n private async loadIndex(provider: ProviderConfig): Promise<EmbeddingIndexFile> {\n if (this.loaded && this.loaded.provider === provider.type && this.loaded.model === provider.model) {\n return this.loaded;\n }\n\n try {\n const raw = await readFile(this.indexPath, \"utf-8\");\n const parsed = JSON.parse(raw) as EmbeddingIndexFile;\n if (\n parsed &&\n parsed.version === 1 &&\n parsed.provider === provider.type &&\n parsed.model === provider.model &&\n parsed.entries &&\n typeof parsed.entries === \"object\"\n ) {\n this.loaded = {\n version: 1,\n provider: provider.type,\n model: provider.model,\n entries: parsed.entries,\n };\n return this.loaded;\n }\n } catch {\n // ignore and create a new index\n }\n\n this.loaded = {\n version: 1,\n provider: provider.type,\n model: provider.model,\n entries: {},\n };\n return this.loaded;\n }\n\n private async readIndexIdentityFromDisk(): Promise<EmbeddingIndexIdentity | null> {\n try {\n const raw = await readFile(this.indexPath, \"utf-8\");\n const parsed = JSON.parse(raw) as Partial<EmbeddingIndexFile> | null;\n if (\n parsed &&\n parsed.version === 1 &&\n (parsed.provider === \"openai\" ||\n parsed.provider === \"local\" ||\n parsed.provider === \"host\") &&\n typeof parsed.model === \"string\" &&\n parsed.model.length > 0\n ) {\n return {\n provider: parsed.provider,\n model: parsed.model,\n };\n }\n } catch {\n // Missing or invalid indexes are treated as absent; loadIndex() owns\n // creating a fresh file when it is safe to write.\n }\n return null;\n }\n\n private async saveIndex(index: EmbeddingIndexFile): Promise<void> {\n const dir = path.dirname(this.indexPath);\n await mkdir(dir, { recursive: true });\n const tempPath = path.join(\n dir,\n `.embeddings.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,\n );\n try {\n await writeFile(tempPath, JSON.stringify(index), \"utf-8\");\n await rename(tempPath, this.indexPath);\n } catch (err) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw err;\n }\n this.loaded = index;\n }\n}\n\nfunction toMemoryRelativePath(memoryDir: string, filePath: string): string {\n if (!path.isAbsolute(filePath)) return filePath;\n const rel = path.relative(memoryDir, filePath);\n return rel.startsWith(\"..\") ? filePath : rel;\n}\n\n/**\n * Normalize an index entry path to forward-slashes for stable prefix\n * comparison. Entries are stored as `path.relative(memoryDir, …)` output,\n * which on Windows uses back-slashes. Normalize both sides so prefix\n * matching is OS-independent.\n *\n * Also strip a leading `./` so this helper's output is symmetric with\n * `normalizePathPrefix` below. `toMemoryRelativePath` is a pass-through for\n * non-absolute filePath inputs, so an index entry could legitimately carry a\n * stored path like `\"./namespaces/alpha/facts/f.md\"`. Without this strip, a\n * caller-supplied prefix `\"./namespaces/alpha\"` (which `normalizePathPrefix`\n * rewrites to `\"namespaces/alpha/\"`) would silently miss that entry and\n * namespace-scoped dedup would either let a near-duplicate through or fail\n * to exclude a cross-namespace hit.\n */\nfunction normalizeEntryPath(p: string): string {\n let out = p.replace(/\\\\/g, \"/\");\n if (out.startsWith(\"./\")) out = out.slice(2);\n return out;\n}\n\n/**\n * Normalize a caller-supplied path prefix:\n * - Return `undefined` for nullish/empty input (no filter).\n * - Replace back-slashes with forward-slashes.\n * - Strip a leading `./`.\n * - Ensure a trailing `/` so `\"namespaces/a\"` doesn't accidentally match\n * `\"namespaces/another/…\"`.\n */\nfunction normalizePathPrefix(prefix: string | undefined): string | undefined {\n if (prefix === undefined || prefix === null) return undefined;\n let p = String(prefix).replace(/\\\\/g, \"/\");\n if (p.startsWith(\"./\")) p = p.slice(2);\n if (p.length === 0) return undefined;\n if (!p.endsWith(\"/\")) p = `${p}/`;\n return p;\n}\n\nfunction sameIndexIdentity(\n left: EmbeddingIndexComparable,\n right: EmbeddingIndexComparable,\n): boolean {\n return indexIdentityProvider(left) === indexIdentityProvider(right) && left.model === right.model;\n}\n\nfunction indexIdentityProvider(identity: EmbeddingIndexComparable): EmbeddingProviderType {\n return \"provider\" in identity ? identity.provider : identity.type;\n}\n\nfunction canReplaceIndexIdentity(\n existing: EmbeddingIndexIdentity,\n replacement: Pick<ProviderConfig, \"type\" | \"model\">,\n): boolean {\n return existing.provider === \"host\" && !sameIndexIdentity(existing, replacement);\n}\n\nfunction providerFromIndexIdentity(identity: EmbeddingIndexIdentity): ProviderConfig {\n return {\n type: identity.provider,\n model: identity.model,\n };\n}\n\nfunction cosineSimilarity(a: number[], b: number[]): number {\n const n = Math.min(a.length, b.length);\n if (n === 0) return 0;\n let dot = 0;\n let normA = 0;\n let normB = 0;\n for (let i = 0; i < n; i++) {\n const av = a[i] ?? 0;\n const bv = b[i] ?? 0;\n dot += av * bv;\n normA += av * av;\n normB += bv * bv;\n }\n const denom = Math.sqrt(normA) * Math.sqrt(normB);\n if (denom === 0) return 0;\n return dot / denom;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,OAAO,UAAU,QAAQ,IAAI,iBAAiB;AA2CvD,IAAM,uBAAuB;AA+BtB,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC7B,OAA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8
|
// src/maintenance/namespace-maintenance-fanout.ts
|
|
9
9
|
var NAMESPACE_MAINTENANCE_JOBS = [
|
|
@@ -146,4 +146,4 @@ export {
|
|
|
146
146
|
summarizeNamespaceMaintenanceHealth,
|
|
147
147
|
formatNamespaceMaintenanceHealthText
|
|
148
148
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-CBWI22JN.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseXrayFormat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GKRLPHPU.js";
|
|
4
4
|
import {
|
|
5
5
|
RECALL_DISCLOSURE_LEVELS,
|
|
6
6
|
isRecallDisclosure
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PUR2CKX2.js";
|
|
8
8
|
|
|
9
9
|
// src/recall-xray-cli.ts
|
|
10
10
|
function parseXrayDisclosureFlag(value) {
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
parseXrayBudgetFlag,
|
|
51
51
|
parseXrayCliOptions
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-CKFLLAIS.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPostConsolidationMaterialize
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-37436GML.js";
|
|
4
4
|
import {
|
|
5
5
|
discoverMemoryExtensions,
|
|
6
6
|
renderExtensionsBlock,
|
|
@@ -217,4 +217,4 @@ export {
|
|
|
217
217
|
buildExtensionsBlockForConsolidation,
|
|
218
218
|
materializeAfterSemanticConsolidation
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-DMQWV6SQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRecallDisclosure
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PUR2CKX2.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeRetrievedMemoryProvenance
|
|
6
6
|
} from "./chunk-I4WBNM3M.js";
|
|
@@ -292,4 +292,4 @@ export {
|
|
|
292
292
|
RecallXrayBuilder,
|
|
293
293
|
summarizeDisclosureTokens
|
|
294
294
|
};
|
|
295
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-DRUDC2UX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager,
|
|
3
3
|
normalizeEntityName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7RLCCNHU.js";
|
|
5
5
|
import {
|
|
6
6
|
serializeMutations
|
|
7
7
|
} from "./chunk-LTJAMRGI.js";
|
|
@@ -956,4 +956,4 @@ export {
|
|
|
956
956
|
resolveBriefingSaveDir,
|
|
957
957
|
briefingFilename
|
|
958
958
|
};
|
|
959
|
-
//# sourceMappingURL=chunk-
|
|
959
|
+
//# sourceMappingURL=chunk-EY6MDMHK.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isValidCapsuleSince
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KQAFEZQX.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPSULE_ID_PATTERN
|
|
6
6
|
} from "./chunk-WEHSQBFR.js";
|
|
@@ -441,4 +441,4 @@ export {
|
|
|
441
441
|
actionConfidenceRequestSchema,
|
|
442
442
|
validateRequest
|
|
443
443
|
};
|
|
444
|
-
//# sourceMappingURL=chunk-
|
|
444
|
+
//# sourceMappingURL=chunk-FVZ2ISIX.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
coerceBool,
|
|
2
3
|
coerceNumber
|
|
3
4
|
} from "./chunk-PHK3HARR.js";
|
|
4
5
|
|
|
@@ -38,12 +39,14 @@ function parseFaithfulnessGateConfig(cfg) {
|
|
|
38
39
|
parseIntegerAtLeast(cfg.extractionFaithfulnessTimeoutMs, 8e3, 1, "extractionFaithfulnessTimeoutMs"),
|
|
39
40
|
6e4
|
|
40
41
|
);
|
|
42
|
+
const extractionFaithfulnessLocalParseFallback = coerceBool(cfg.extractionFaithfulnessLocalParseFallback) === true;
|
|
41
43
|
return {
|
|
42
44
|
extractionFaithfulnessGate,
|
|
43
45
|
extractionFaithfulnessModel,
|
|
44
46
|
extractionFaithfulnessBaseUrl,
|
|
45
47
|
extractionFaithfulnessContextChars,
|
|
46
|
-
extractionFaithfulnessTimeoutMs
|
|
48
|
+
extractionFaithfulnessTimeoutMs,
|
|
49
|
+
extractionFaithfulnessLocalParseFallback
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
function parseCorrectionIntentConfig(cfg) {
|
|
@@ -57,4 +60,4 @@ export {
|
|
|
57
60
|
parseFaithfulnessGateConfig,
|
|
58
61
|
parseCorrectionIntentConfig
|
|
59
62
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-G6NKALRN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/faithfulness-config.ts"],"sourcesContent":["/**\n * Faithfulness-gate + correction-intent config parsing (issue #1576 / #1585).\n *\n * Extracted verbatim from `config.ts` (a watchlisted god file) so the gate\n * config block can grow — the model-lab pointer keys\n * `extractionFaithfulnessBaseUrl` (#1585) and the correction-intent pointers\n * (`correctionIntentModel` / `correctionIntentBaseUrl`) — without growing the\n * god file. This is a behavior-preserving extraction (#1526-style): the\n * validation, defaults, and error messages are byte-identical to the inline\n * block it replaces, which the existing extraction-faithfulness + config\n * tests pin.\n *\n * Why a dedicated module (and not inline): the ratchet\n * (`scripts/check-ratchets.mjs`) forbids `config.ts` from growing, and the\n * model-lab integration needs three new optional keys. Centralizing the whole\n * gate+intent parsing here keeps it unit-testable in isolation and lets\n * `config.ts` spread the result in one line.\n */\n\nimport { coerceBool, coerceNumber } from \"./connectors/coerce.js\";\n\n/**\n * Parse a value as a strict integer >= `min`, throwing on anything else.\n *\n * Mirrors `parseIntegerAtLeast` in `config.ts` byte-for-byte (issue #1634:\n * reject non-numeric, <=0, non-integer, NaN, Infinity, booleans, objects —\n * gotcha #51). Reimplemented locally rather than exported from `config.ts`\n * so this module has no dependency on the god file (and vice versa).\n */\nfunction parseIntegerAtLeast(\n value: unknown,\n fallback: number,\n min: number,\n keyName: string,\n): number {\n if (value === undefined || value === null) return fallback;\n const coerced = coerceNumber(value);\n if (\n coerced === undefined ||\n !Number.isFinite(coerced) ||\n !Number.isInteger(coerced) ||\n coerced < min\n ) {\n throw new Error(\n `${keyName} must be an integer greater than or equal to ${min}; got ${JSON.stringify(value)}`,\n );\n }\n return coerced;\n}\n\n/**\n * Parse the extraction faithfulness gate config block.\n *\n * Returns exactly the `PluginConfig` fields this block owns. Defaults preserve\n * the byte-identical pre-feature pipeline (rule 39): gate \"off\", empty model\n * + base URL, context 400 chars, timeout 8000 ms. Invalid `gate` values reject\n * listing valid options (rule 51); invalid integers throw (issue #1634).\n *\n * `extractionFaithfulnessBaseUrl` (issue #1585) is the model-lab pointer: when\n * set together with `extractionFaithfulnessModel`, the gate routes to that\n * local openai-compatible endpoint before the configured chain; empty string\n * (default) preserves the existing routing exactly.\n */\nexport function parseFaithfulnessGateConfig(cfg: Record<string, unknown>): {\n extractionFaithfulnessGate: \"off\" | \"shadow\" | \"enforce\";\n extractionFaithfulnessModel: string;\n extractionFaithfulnessBaseUrl: string;\n extractionFaithfulnessContextChars: number;\n extractionFaithfulnessTimeoutMs: number;\n extractionFaithfulnessLocalParseFallback: boolean;\n} {\n const gateValue = cfg.extractionFaithfulnessGate;\n let extractionFaithfulnessGate: \"off\" | \"shadow\" | \"enforce\";\n if (gateValue === undefined || gateValue === null) {\n extractionFaithfulnessGate = \"off\";\n } else {\n // Present-but-invalid (true/1/{}) must reject, not silently disable the gate (Ob4RQ).\n const raw = typeof gateValue === \"string\" ? gateValue.trim().toLowerCase() : gateValue;\n if (raw === \"off\" || raw === \"shadow\" || raw === \"enforce\") {\n extractionFaithfulnessGate = raw;\n } else {\n throw new Error(\n `extractionFaithfulnessGate must be one of \"off\" | \"shadow\" | \"enforce\" (got ${JSON.stringify(gateValue)})`,\n );\n }\n }\n\n const extractionFaithfulnessModel =\n typeof cfg.extractionFaithfulnessModel === \"string\" ? cfg.extractionFaithfulnessModel : \"\";\n\n // Issue #1585: model-lab pointer. Empty default → gate uses its existing\n // routing chain (byte-identical). Non-empty + a model name → gate prefers\n // the local served endpoint, falling back to the chain on failure.\n const extractionFaithfulnessBaseUrl =\n typeof cfg.extractionFaithfulnessBaseUrl === \"string\"\n ? cfg.extractionFaithfulnessBaseUrl\n : \"\";\n\n const extractionFaithfulnessContextChars = Math.min(\n parseIntegerAtLeast(cfg.extractionFaithfulnessContextChars, 400, 1, \"extractionFaithfulnessContextChars\"),\n 4000,\n );\n\n const extractionFaithfulnessTimeoutMs = Math.min(\n parseIntegerAtLeast(cfg.extractionFaithfulnessTimeoutMs, 8000, 1, \"extractionFaithfulnessTimeoutMs\"),\n 60_000,\n );\n\n // Issue #1700 nit #6: resilient-fallback toggle for the local model-lab\n // endpoint. Default false preserves the loud-signal behavior (a 200-with-\n // garbage local response surfaces malformed_output so a misconfigured\n // endpoint is visible); true falls back to the configured chain on local\n // parse failure. Byte-identical pre-feature when unset (rule 39).\n // coerceBool for CLI-string parity: a CLI override like\n // --config extractionFaithfulnessLocalParseFallback=true reaches here as the\n // string \"true\"; === true would silently leave the flag disabled. Matches\n // every other CLI-settable boolean in config.ts (gotcha 36, codex P2\n // PRRT_kwDORJXyws6O6gDQ / cursor BUGBOT e273b22c).\n const extractionFaithfulnessLocalParseFallback =\n coerceBool(cfg.extractionFaithfulnessLocalParseFallback) === true;\n\n return {\n extractionFaithfulnessGate,\n extractionFaithfulnessModel,\n extractionFaithfulnessBaseUrl,\n extractionFaithfulnessContextChars,\n extractionFaithfulnessTimeoutMs,\n extractionFaithfulnessLocalParseFallback,\n };\n}\n\n/**\n * Parse the correction-intent config block (issue #1581 / #1585).\n *\n * The model-lab pointer for passive-correction detection: when both\n * `correctionIntentModel` and `correctionIntentBaseUrl` are set, the detection\n * path can route to that local fine-tuned classifier; empty defaults (the\n * common case) keep the rule-based `detectPassiveCorrections` heuristic as the\n * sole detector — byte-identical to the pre-feature path. Consumption by the\n * detector is the consuming child's job (#1581's detector is a pure function;\n * wiring a model call into it is out of scope for this config-pointer PR).\n */\nexport function parseCorrectionIntentConfig(cfg: Record<string, unknown>): {\n correctionIntentModel: string;\n correctionIntentBaseUrl: string;\n} {\n return {\n correctionIntentModel:\n typeof cfg.correctionIntentModel === \"string\" ? cfg.correctionIntentModel : \"\",\n correctionIntentBaseUrl:\n typeof cfg.correctionIntentBaseUrl === \"string\" ? cfg.correctionIntentBaseUrl : \"\",\n };\n}\n"],"mappings":";;;;;;AA6BA,SAAS,oBACP,OACA,UACA,KACA,SACQ;AACR,MAAI,UAAU,UAAa,UAAU,KAAM,QAAO;AAClD,QAAM,UAAU,aAAa,KAAK;AAClC,MACE,YAAY,UACZ,CAAC,OAAO,SAAS,OAAO,KACxB,CAAC,OAAO,UAAU,OAAO,KACzB,UAAU,KACV;AACA,UAAM,IAAI;AAAA,MACR,GAAG,OAAO,gDAAgD,GAAG,SAAS,KAAK,UAAU,KAAK,CAAC;AAAA,IAC7F;AAAA,EACF;AACA,SAAO;AACT;AAeO,SAAS,4BAA4B,KAO1C;AACA,QAAM,YAAY,IAAI;AACtB,MAAI;AACJ,MAAI,cAAc,UAAa,cAAc,MAAM;AACjD,iCAA6B;AAAA,EAC/B,OAAO;AAEL,UAAM,MAAM,OAAO,cAAc,WAAW,UAAU,KAAK,EAAE,YAAY,IAAI;AAC7E,QAAI,QAAQ,SAAS,QAAQ,YAAY,QAAQ,WAAW;AAC1D,mCAA6B;AAAA,IAC/B,OAAO;AACL,YAAM,IAAI;AAAA,QACR,+EAA+E,KAAK,UAAU,SAAS,CAAC;AAAA,MAC1G;AAAA,IACF;AAAA,EACF;AAEA,QAAM,8BACJ,OAAO,IAAI,gCAAgC,WAAW,IAAI,8BAA8B;AAK1F,QAAM,gCACJ,OAAO,IAAI,kCAAkC,WACzC,IAAI,gCACJ;AAEN,QAAM,qCAAqC,KAAK;AAAA,IAC9C,oBAAoB,IAAI,oCAAoC,KAAK,GAAG,oCAAoC;AAAA,IACxG;AAAA,EACF;AAEA,QAAM,kCAAkC,KAAK;AAAA,IAC3C,oBAAoB,IAAI,iCAAiC,KAAM,GAAG,iCAAiC;AAAA,IACnG;AAAA,EACF;AAYA,QAAM,2CACJ,WAAW,IAAI,wCAAwC,MAAM;AAE/D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAaO,SAAS,4BAA4B,KAG1C;AACA,SAAO;AAAA,IACL,uBACE,OAAO,IAAI,0BAA0B,WAAW,IAAI,wBAAwB;AAAA,IAC9E,yBACE,OAAO,IAAI,4BAA4B,WAAW,IAAI,0BAA0B;AAAA,EACpF;AACF;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-SOBJ6NEY.js";
|
|
4
4
|
import {
|
|
5
5
|
summarizeDisclosureTokens
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DRUDC2UX.js";
|
|
7
7
|
import {
|
|
8
8
|
summarizeRetrievedMemoryProvenance
|
|
9
9
|
} from "./chunk-I4WBNM3M.js";
|
|
@@ -587,4 +587,4 @@ export {
|
|
|
587
587
|
renderRecallExplain,
|
|
588
588
|
parseRecallExplainFormat
|
|
589
589
|
};
|
|
590
|
-
//# sourceMappingURL=chunk-
|
|
590
|
+
//# sourceMappingURL=chunk-GKRLPHPU.js.map
|
|
@@ -7,35 +7,30 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
openclawReplayNormalizer
|
|
9
9
|
} from "./chunk-7F7Z6MOS.js";
|
|
10
|
+
import {
|
|
11
|
+
exportSqlite
|
|
12
|
+
} from "./chunk-7VFZTJ7K.js";
|
|
10
13
|
import {
|
|
11
14
|
importMarkdownBundle
|
|
12
15
|
} from "./chunk-HDDRVXX4.js";
|
|
13
16
|
import {
|
|
14
17
|
importSqlite
|
|
15
18
|
} from "./chunk-AGNBY3VG.js";
|
|
16
|
-
import {
|
|
17
|
-
backupMemoryDir
|
|
18
|
-
} from "./chunk-OWHERGF2.js";
|
|
19
|
-
import {
|
|
20
|
-
exportJsonBundle
|
|
21
|
-
} from "./chunk-UP6MOYCB.js";
|
|
22
|
-
import {
|
|
23
|
-
exportSqlite
|
|
24
|
-
} from "./chunk-7VFZTJ7K.js";
|
|
25
19
|
import {
|
|
26
20
|
detectImportFormat
|
|
27
21
|
} from "./chunk-OZKVVUJB.js";
|
|
28
22
|
import {
|
|
29
23
|
importJsonBundle
|
|
30
24
|
} from "./chunk-2DL3OFLD.js";
|
|
25
|
+
import {
|
|
26
|
+
backupMemoryDir
|
|
27
|
+
} from "./chunk-2NLLXCJG.js";
|
|
28
|
+
import {
|
|
29
|
+
exportJsonBundle
|
|
30
|
+
} from "./chunk-UP6MOYCB.js";
|
|
31
31
|
import {
|
|
32
32
|
exportMarkdownBundle
|
|
33
33
|
} from "./chunk-765K3SAT.js";
|
|
34
|
-
import {
|
|
35
|
-
buildReplayNormalizerRegistry,
|
|
36
|
-
clampBatchSize,
|
|
37
|
-
runReplay
|
|
38
|
-
} from "./chunk-HOJZMQ4J.js";
|
|
39
34
|
import {
|
|
40
35
|
TailscaleHelper
|
|
41
36
|
} from "./chunk-EEC4PCG5.js";
|
|
@@ -43,22 +38,27 @@ import {
|
|
|
43
38
|
WebDavServer
|
|
44
39
|
} from "./chunk-PYIFUBRK.js";
|
|
45
40
|
import {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} from "./chunk-6WAJQKBS.js";
|
|
41
|
+
buildReplayNormalizerRegistry,
|
|
42
|
+
clampBatchSize,
|
|
43
|
+
runReplay
|
|
44
|
+
} from "./chunk-HOJZMQ4J.js";
|
|
51
45
|
import {
|
|
52
46
|
rebuildMemoryProjection,
|
|
53
47
|
repairMemoryProjection,
|
|
54
48
|
verifyMemoryProjection
|
|
55
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-Y4YD5TYW.js";
|
|
56
50
|
import {
|
|
57
51
|
rebuildObservations
|
|
58
52
|
} from "./chunk-LZZNTPLR.js";
|
|
59
53
|
import {
|
|
60
54
|
archiveObservations
|
|
61
55
|
} from "./chunk-WMWVO45V.js";
|
|
56
|
+
import {
|
|
57
|
+
migrateObservations
|
|
58
|
+
} from "./chunk-D6RIFG4O.js";
|
|
59
|
+
import {
|
|
60
|
+
rebuildMemoryLifecycleLedger
|
|
61
|
+
} from "./chunk-JYLFZWUX.js";
|
|
62
62
|
import {
|
|
63
63
|
getBulkImportSource,
|
|
64
64
|
listBulkImportSources,
|
|
@@ -70,18 +70,18 @@ import {
|
|
|
70
70
|
} from "./chunk-GQL52GQ5.js";
|
|
71
71
|
import {
|
|
72
72
|
promoteSemanticRuleFromMemory
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4H4F3BFL.js";
|
|
74
74
|
import {
|
|
75
75
|
buildResumeBundleFromState,
|
|
76
76
|
getResumeBundleStatus,
|
|
77
77
|
recordResumeBundle
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-HOHVIVDR.js";
|
|
79
79
|
import {
|
|
80
80
|
resolveAgentAccessAuthToken
|
|
81
81
|
} from "./chunk-TGQ2NTWH.js";
|
|
82
82
|
import {
|
|
83
83
|
parseXrayCliOptions
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-CKFLLAIS.js";
|
|
85
85
|
import {
|
|
86
86
|
collectPatternMemories,
|
|
87
87
|
explainPatternMemory,
|
|
@@ -98,12 +98,12 @@ import {
|
|
|
98
98
|
runOperatorInventory,
|
|
99
99
|
runOperatorRepair,
|
|
100
100
|
runOperatorSetup
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-M4AYVEWS.js";
|
|
102
102
|
import {
|
|
103
103
|
listNamespaces,
|
|
104
104
|
runNamespaceMigration,
|
|
105
105
|
verifyNamespaces
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-YGIQORJ3.js";
|
|
107
107
|
import {
|
|
108
108
|
GraphDashboardServer
|
|
109
109
|
} from "./chunk-EZ25VE3G.js";
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from "./chunk-WIWPSQYU.js";
|
|
117
117
|
import {
|
|
118
118
|
searchVerifiedEpisodes
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-ASKXIAHD.js";
|
|
120
120
|
import {
|
|
121
121
|
getUtilityLearningStatus,
|
|
122
122
|
learnUtilityPromotionWeights
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
} from "./chunk-QRDOSYOR.js";
|
|
131
131
|
import {
|
|
132
132
|
searchVerifiedSemanticRules
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-UVPL565C.js";
|
|
134
134
|
import {
|
|
135
135
|
getWorkProductLedgerStatus,
|
|
136
136
|
recordWorkProductLedgerEntry,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./chunk-33JBK2XP.js";
|
|
146
146
|
import {
|
|
147
147
|
formatNamespaceMaintenanceHealthText
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-CBWI22JN.js";
|
|
149
149
|
import {
|
|
150
150
|
analyzeSessionIntegrity,
|
|
151
151
|
applySessionRepair,
|
|
@@ -209,13 +209,13 @@ import {
|
|
|
209
209
|
} from "./chunk-UQ7RN5HK.js";
|
|
210
210
|
import {
|
|
211
211
|
parseConfig
|
|
212
|
-
} from "./chunk-
|
|
212
|
+
} from "./chunk-36SEDFAU.js";
|
|
213
213
|
import {
|
|
214
214
|
getAbstractionNodeStoreStatus
|
|
215
215
|
} from "./chunk-OADWQ5CR.js";
|
|
216
216
|
import {
|
|
217
217
|
EngramAccessHttpServer
|
|
218
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-HGNOCPZX.js";
|
|
219
219
|
import {
|
|
220
220
|
WearablesInputError
|
|
221
221
|
} from "./chunk-7WV3F5DQ.js";
|
|
@@ -228,10 +228,10 @@ import {
|
|
|
228
228
|
createProductionChatLlmAdapter,
|
|
229
229
|
loadChatSession,
|
|
230
230
|
sessionBelongsToPrincipal
|
|
231
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-BQCHEV7O.js";
|
|
232
232
|
import {
|
|
233
233
|
EngramAccessService
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-UM5AWJNQ.js";
|
|
235
235
|
import {
|
|
236
236
|
WorkStorage
|
|
237
237
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -243,13 +243,13 @@ import {
|
|
|
243
243
|
parseRecallExplainFormat,
|
|
244
244
|
renderRecallExplain,
|
|
245
245
|
renderXray
|
|
246
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-GKRLPHPU.js";
|
|
247
247
|
import {
|
|
248
248
|
listMemoryGovernanceRuns,
|
|
249
249
|
readMemoryGovernanceRunArtifact,
|
|
250
250
|
restoreMemoryGovernanceRun,
|
|
251
251
|
runMemoryGovernance
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-4NOI577P.js";
|
|
253
253
|
import {
|
|
254
254
|
getTrustZoneStoreStatus,
|
|
255
255
|
promoteTrustZoneRecord,
|
|
@@ -260,8 +260,9 @@ import {
|
|
|
260
260
|
} from "./chunk-6HMYUWXR.js";
|
|
261
261
|
import {
|
|
262
262
|
resolveCapabilities,
|
|
263
|
-
resolveGraphConstructionCapabilities
|
|
264
|
-
|
|
263
|
+
resolveGraphConstructionCapabilities,
|
|
264
|
+
resolveMemoryLifecycleCapabilities
|
|
265
|
+
} from "./chunk-3RCBIOOJ.js";
|
|
265
266
|
import {
|
|
266
267
|
getCausalTrajectoryStoreStatus
|
|
267
268
|
} from "./chunk-SQNED75R.js";
|
|
@@ -274,7 +275,7 @@ import {
|
|
|
274
275
|
import {
|
|
275
276
|
RECALL_DISCLOSURE_LEVELS,
|
|
276
277
|
isRecallDisclosure
|
|
277
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-PUR2CKX2.js";
|
|
278
279
|
import {
|
|
279
280
|
RECALL_FALLBACK_DIRS
|
|
280
281
|
} from "./chunk-VS2IYZRU.js";
|
|
@@ -3464,7 +3465,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3464
3465
|
console.log("=== Extraction Judge Verdict Stats ===\n");
|
|
3465
3466
|
console.log(`Total verdicts: ${stats.total}`);
|
|
3466
3467
|
if (stats.total === 0) {
|
|
3467
|
-
if (!orchestrator.config.
|
|
3468
|
+
if (!resolveMemoryLifecycleCapabilities(orchestrator.config).extractionJudgeTelemetry) {
|
|
3468
3469
|
console.log(
|
|
3469
3470
|
"\nNote: extractionJudgeTelemetryEnabled is OFF. Enable it in plugin config to collect verdict telemetry."
|
|
3470
3471
|
);
|
|
@@ -4133,7 +4134,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4133
4134
|
}
|
|
4134
4135
|
}
|
|
4135
4136
|
if (sourceArchive.endsWith(".enc")) {
|
|
4136
|
-
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-
|
|
4137
|
+
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-7FJQINUR.js");
|
|
4137
4138
|
const encDetected = await isEncryptedCapsuleFile(sourceArchive).catch(() => true);
|
|
4138
4139
|
if (encDetected) {
|
|
4139
4140
|
throw new Error(
|
|
@@ -4296,7 +4297,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4296
4297
|
const { parseExportBundle } = await import("./transfer/types.js");
|
|
4297
4298
|
let decryptedBuf;
|
|
4298
4299
|
try {
|
|
4299
|
-
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-
|
|
4300
|
+
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-7FJQINUR.js");
|
|
4300
4301
|
decryptedBuf = await decryptCapsuleFileInMemory(archivePath, memoryDir);
|
|
4301
4302
|
} catch (decErr) {
|
|
4302
4303
|
const msg = decErr instanceof Error ? decErr.message : String(decErr);
|
|
@@ -6792,7 +6793,7 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
6792
6793
|
config: orchestrator.config,
|
|
6793
6794
|
memoryDir: orchestrator.config.memoryDir,
|
|
6794
6795
|
embeddingLookupFactory: (storage) => {
|
|
6795
|
-
if (!orchestrator.config.
|
|
6796
|
+
if (!resolveMemoryLifecycleCapabilities(orchestrator.config).embeddingFallback) return void 0;
|
|
6796
6797
|
return async (content, limit) => {
|
|
6797
6798
|
try {
|
|
6798
6799
|
return await orchestrator.semanticDedupLookup(content, limit, storage);
|
|
@@ -7505,4 +7506,4 @@ export {
|
|
|
7505
7506
|
listMemoryMarkdownFilePaths,
|
|
7506
7507
|
registerCli
|
|
7507
7508
|
};
|
|
7508
|
-
//# sourceMappingURL=chunk-
|
|
7509
|
+
//# sourceMappingURL=chunk-H5BWGCRZ.js.map
|