@remnic/core 9.3.700 → 9.3.702
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 +7 -7
- package/dist/access-boundary.js +17 -14
- package/dist/access-cli.js +40 -37
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +7 -7
- package/dist/access-http.js +20 -17
- package/dist/access-mcp.d.ts +7 -7
- package/dist/access-mcp.js +19 -16
- package/dist/access-operations.d.ts +7 -7
- package/dist/access-operations.js +18 -15
- package/dist/{access-service-Cte3ol0W.d.ts → access-service-COCzhgEL.d.ts} +397 -19
- package/dist/access-service.d.ts +6 -6
- package/dist/access-service.js +16 -13
- package/dist/access-surface-catalog.d.ts +7 -7
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +7 -6
- package/dist/active-recall.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 +5 -5
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +8 -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 +1 -1
- package/dist/{catalog-DN1PzThs.d.ts → catalog-DxCzhjE6.d.ts} +28 -54
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +9 -8
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-XJNBEDFE.js → chunk-3FAMU5TX.js} +31 -74
- package/dist/chunk-3FAMU5TX.js.map +1 -0
- package/dist/{chunk-PCZR32VL.js → chunk-3JJWNZTT.js} +2 -2
- package/dist/{chunk-YXLT4EMM.js → chunk-4463LUIE.js} +12 -2
- package/dist/chunk-4463LUIE.js.map +1 -0
- package/dist/{chunk-R5DB26G6.js → chunk-4SBW47WK.js} +9 -23
- package/dist/chunk-4SBW47WK.js.map +1 -0
- package/dist/{chunk-CCOXIDRM.js → chunk-5VXVXJH6.js} +149 -6
- package/dist/{chunk-CCOXIDRM.js.map → chunk-5VXVXJH6.js.map} +1 -1
- package/dist/{chunk-PQG4T5V3.js → chunk-64XXOQRW.js} +49 -45
- package/dist/chunk-64XXOQRW.js.map +1 -0
- package/dist/{chunk-YXIFA36P.js → chunk-6TAETM63.js} +2 -2
- package/dist/{chunk-6JDGADXK.js → chunk-6VVP6NK7.js} +2 -2
- package/dist/{chunk-FN2SM5SN.js → chunk-ABCGDW3A.js} +75 -12
- package/dist/chunk-ABCGDW3A.js.map +1 -0
- package/dist/{chunk-CHM274U6.js → chunk-AMNLZ6SF.js} +2 -2
- package/dist/{chunk-JX3YZVII.js → chunk-CZJ6QSKG.js} +3 -3
- package/dist/{chunk-GYVVQYA3.js → chunk-EOOVJK2U.js} +3 -3
- package/dist/{chunk-JKW5XSWC.js → chunk-EYJD6KIO.js} +2 -2
- package/dist/{chunk-XY4WJTEX.js → chunk-EZR35XHX.js} +2 -2
- package/dist/{chunk-UU6MVCJ6.js → chunk-FIOYURII.js} +32 -25
- package/dist/chunk-FIOYURII.js.map +1 -0
- package/dist/{chunk-2NWHLAXX.js → chunk-FVI5B7DE.js} +2 -2
- package/dist/{chunk-X74FJSW7.js → chunk-GFIARMA7.js} +16 -8
- package/dist/chunk-GFIARMA7.js.map +1 -0
- package/dist/{chunk-PONNZ54D.js → chunk-GY3SKOS4.js} +4 -4
- package/dist/{chunk-U33LWTQQ.js → chunk-HV57RHMD.js} +4 -4
- package/dist/{chunk-RC3CNIPK.js → chunk-IO5NQEGZ.js} +2 -2
- package/dist/{chunk-IKNQAGBV.js → chunk-IX3UQT4H.js} +1 -1
- package/dist/{chunk-IKNQAGBV.js.map → chunk-IX3UQT4H.js.map} +1 -1
- package/dist/{chunk-HDLC75NX.js → chunk-IX72AAMZ.js} +2 -2
- package/dist/{chunk-DR2JTSLZ.js → chunk-JMA4RYRN.js} +62 -163
- package/dist/chunk-JMA4RYRN.js.map +1 -0
- package/dist/{chunk-G5PKTQ5J.js → chunk-JTKFZMZ7.js} +2 -2
- package/dist/{chunk-YMTGXDN6.js → chunk-KC6TCAWV.js} +5 -5
- package/dist/{chunk-ROZJACKP.js → chunk-KKK7YTYN.js} +4 -1
- package/dist/chunk-KKK7YTYN.js.map +1 -0
- package/dist/{chunk-EC2AYKRX.js → chunk-L6W77GWW.js} +10 -24
- package/dist/chunk-L6W77GWW.js.map +1 -0
- package/dist/{chunk-ED35D32I.js → chunk-LQ4J7ELC.js} +2 -2
- package/dist/{chunk-YPR7DOPD.js → chunk-LTJAMRGI.js} +4 -4
- package/dist/{chunk-YPR7DOPD.js.map → chunk-LTJAMRGI.js.map} +1 -1
- package/dist/chunk-LUPVCGYK.js +63 -0
- package/dist/chunk-LUPVCGYK.js.map +1 -0
- package/dist/{chunk-RJ2THZ4H.js → chunk-MBUM2Y3L.js} +2 -2
- package/dist/{chunk-T5QAZIBO.js → chunk-MOXFPLD6.js} +3 -3
- package/dist/{chunk-O54DY26V.js → chunk-MXEWQKM7.js} +2 -2
- package/dist/{chunk-33L6XHU2.js → chunk-NUIJEGVD.js} +6 -6
- package/dist/{chunk-3E5WRQNQ.js → chunk-OXEAMU42.js} +529 -9
- package/dist/chunk-OXEAMU42.js.map +1 -0
- package/dist/{chunk-EOBJRBLC.js → chunk-QGJAGC2J.js} +2 -2
- package/dist/{chunk-SMIVW7XC.js → chunk-QIMFOCSH.js} +2 -2
- package/dist/{chunk-IJEZMWKA.js → chunk-SFOAQQDJ.js} +3 -3
- package/dist/{chunk-HRUULBBV.js → chunk-SHRRWOVY.js} +81 -4
- package/dist/chunk-SHRRWOVY.js.map +1 -0
- package/dist/{chunk-NINRTFSV.js → chunk-SINGJCUR.js} +5 -5
- package/dist/{chunk-ZPQVJEVQ.js → chunk-SK2CR6MW.js} +146 -2
- package/dist/chunk-SK2CR6MW.js.map +1 -0
- package/dist/{chunk-SEWF2O74.js → chunk-TGAHHCB6.js} +2 -2
- package/dist/{chunk-D75JXBV4.js → chunk-WN4GHSDH.js} +2 -2
- package/dist/{chunk-K4DWSPMW.js → chunk-WRGPE6AW.js} +2 -2
- package/dist/{chunk-GA5A6MJH.js → chunk-XGMCUY5P.js} +62 -116
- package/dist/chunk-XGMCUY5P.js.map +1 -0
- package/dist/{chunk-SDPDU2PM.js → chunk-YTMDF6S7.js} +2 -2
- package/dist/{chunk-ZDK2IW5F.js → chunk-Z7XEIAV4.js} +2 -2
- package/dist/{chunk-NHBEO3F3.js → chunk-ZCEI242W.js} +24 -24
- package/dist/{cli--yVN9yEV.d.ts → cli-BM4xQPp4.d.ts} +3 -3
- package/dist/cli.d.ts +7 -7
- package/dist/cli.js +35 -34
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +8 -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 +4 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +8 -7
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +9 -8
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +2 -2
- 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/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +8 -7
- package/dist/entity-schema.d.ts +1 -1
- package/dist/event-order-recall.js +2 -1
- package/dist/explicit-capture.d.ts +5 -5
- package/dist/explicit-capture.js +2 -2
- package/dist/explicit-cue-recall.js +2 -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.d.ts +14 -1
- package/dist/extraction.js +5 -3
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{forget-BEXG5PQC.js → forget-6SOIPUMQ.js} +3 -3
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +123 -123
- package/dist/index.js +57 -56
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- 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/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +8 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +8 -7
- package/dist/maintenance/rebuild-memory-projection.js +9 -8
- package/dist/mcp-memory-inspector-app.d.ts +7 -7
- 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 +9 -8
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +14 -3
- package/dist/namespaces/storage.js +8 -7
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +14 -13
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +10 -9
- package/dist/{orchestrator-CJI4xdqV.d.ts → orchestrator-C9CDWAm6.d.ts} +4 -4
- package/dist/orchestrator.d.ts +5 -5
- package/dist/orchestrator.js +33 -31
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/provenance.d.ts +36 -2
- package/dist/provenance.js +5 -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-pipeline-stages.d.ts +15 -0
- package/dist/recall-pipeline-stages.js +3 -56
- package/dist/recall-pipeline-stages.js.map +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-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/response-guidance-recall.js +2 -1
- package/dist/resume-bundles.js +7 -5
- 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/schemas.d.ts +19 -0
- package/dist/schemas.js +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/index.d.ts +1 -1
- 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-DJR8_DMQ.d.ts → semantic-SLAa_prH.d.ts} +1 -1
- package/dist/{semantic-consolidation-BtUfv-AL.d.ts → semantic-consolidation-DgFXyALl.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +9 -8
- package/dist/semantic-rule-promotion.js +8 -7
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +8 -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 +13 -1
- package/dist/storage.js +7 -6
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -2
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/summary-snapshot.js +2 -1
- package/dist/targeted-fact-recall.js +2 -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/transcript.js +2 -2
- package/dist/{types-PuiPZ9iE.d.ts → types-MWKPZnM0.d.ts} +25 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/utils/serialize-mutations.js +1 -1
- package/dist/verified-recall.js +8 -7
- package/package.json +2 -2
- package/src/access-http.ts +162 -0
- package/src/access-service.ts +215 -0
- package/src/admin/admin-surfaces.test.ts +458 -0
- package/src/admin/admin-surfaces.ts +819 -0
- package/src/event-order-recall.test.ts +53 -0
- package/src/event-order-recall.ts +61 -37
- package/src/explicit-cue-recall.ts +21 -1
- package/src/extraction.ts +91 -6
- package/src/namespaces/catalog.test.ts +222 -14
- package/src/namespaces/catalog.ts +54 -187
- package/src/namespaces/storage.ts +87 -80
- package/src/orchestrator.ts +46 -5
- package/src/provenance-extraction.test.ts +838 -0
- package/src/provenance.ts +413 -0
- package/src/recall-pipeline-parity.test.ts +288 -0
- package/src/recall-pipeline-stages.test.ts +43 -0
- package/src/recall-pipeline-stages.ts +22 -0
- package/src/response-guidance-recall.ts +32 -36
- package/src/schemas.ts +7 -0
- package/src/storage.ts +23 -0
- package/src/summary-snapshot.test.ts +63 -1
- package/src/summary-snapshot.ts +61 -80
- package/src/targeted-fact-recall.ts +25 -32
- package/src/types.ts +24 -0
- package/src/utils/serialize-mutations.ts +10 -6
- package/dist/chunk-3E5WRQNQ.js.map +0 -1
- package/dist/chunk-DR2JTSLZ.js.map +0 -1
- package/dist/chunk-EC2AYKRX.js.map +0 -1
- package/dist/chunk-FN2SM5SN.js.map +0 -1
- package/dist/chunk-GA5A6MJH.js.map +0 -1
- package/dist/chunk-HRUULBBV.js.map +0 -1
- package/dist/chunk-PQG4T5V3.js.map +0 -1
- package/dist/chunk-R5DB26G6.js.map +0 -1
- package/dist/chunk-ROZJACKP.js.map +0 -1
- package/dist/chunk-UU6MVCJ6.js.map +0 -1
- package/dist/chunk-X74FJSW7.js.map +0 -1
- package/dist/chunk-XJNBEDFE.js.map +0 -1
- package/dist/chunk-YXLT4EMM.js.map +0 -1
- package/dist/chunk-ZPQVJEVQ.js.map +0 -1
- /package/dist/{chunk-PCZR32VL.js.map → chunk-3JJWNZTT.js.map} +0 -0
- /package/dist/{chunk-YXIFA36P.js.map → chunk-6TAETM63.js.map} +0 -0
- /package/dist/{chunk-6JDGADXK.js.map → chunk-6VVP6NK7.js.map} +0 -0
- /package/dist/{chunk-CHM274U6.js.map → chunk-AMNLZ6SF.js.map} +0 -0
- /package/dist/{chunk-JX3YZVII.js.map → chunk-CZJ6QSKG.js.map} +0 -0
- /package/dist/{chunk-GYVVQYA3.js.map → chunk-EOOVJK2U.js.map} +0 -0
- /package/dist/{chunk-JKW5XSWC.js.map → chunk-EYJD6KIO.js.map} +0 -0
- /package/dist/{chunk-XY4WJTEX.js.map → chunk-EZR35XHX.js.map} +0 -0
- /package/dist/{chunk-2NWHLAXX.js.map → chunk-FVI5B7DE.js.map} +0 -0
- /package/dist/{chunk-PONNZ54D.js.map → chunk-GY3SKOS4.js.map} +0 -0
- /package/dist/{chunk-U33LWTQQ.js.map → chunk-HV57RHMD.js.map} +0 -0
- /package/dist/{chunk-RC3CNIPK.js.map → chunk-IO5NQEGZ.js.map} +0 -0
- /package/dist/{chunk-HDLC75NX.js.map → chunk-IX72AAMZ.js.map} +0 -0
- /package/dist/{chunk-G5PKTQ5J.js.map → chunk-JTKFZMZ7.js.map} +0 -0
- /package/dist/{chunk-YMTGXDN6.js.map → chunk-KC6TCAWV.js.map} +0 -0
- /package/dist/{chunk-ED35D32I.js.map → chunk-LQ4J7ELC.js.map} +0 -0
- /package/dist/{chunk-RJ2THZ4H.js.map → chunk-MBUM2Y3L.js.map} +0 -0
- /package/dist/{chunk-T5QAZIBO.js.map → chunk-MOXFPLD6.js.map} +0 -0
- /package/dist/{chunk-O54DY26V.js.map → chunk-MXEWQKM7.js.map} +0 -0
- /package/dist/{chunk-33L6XHU2.js.map → chunk-NUIJEGVD.js.map} +0 -0
- /package/dist/{chunk-EOBJRBLC.js.map → chunk-QGJAGC2J.js.map} +0 -0
- /package/dist/{chunk-SMIVW7XC.js.map → chunk-QIMFOCSH.js.map} +0 -0
- /package/dist/{chunk-IJEZMWKA.js.map → chunk-SFOAQQDJ.js.map} +0 -0
- /package/dist/{chunk-NINRTFSV.js.map → chunk-SINGJCUR.js.map} +0 -0
- /package/dist/{chunk-SEWF2O74.js.map → chunk-TGAHHCB6.js.map} +0 -0
- /package/dist/{chunk-D75JXBV4.js.map → chunk-WN4GHSDH.js.map} +0 -0
- /package/dist/{chunk-K4DWSPMW.js.map → chunk-WRGPE6AW.js.map} +0 -0
- /package/dist/{chunk-SDPDU2PM.js.map → chunk-YTMDF6S7.js.map} +0 -0
- /package/dist/{chunk-ZDK2IW5F.js.map → chunk-Z7XEIAV4.js.map} +0 -0
- /package/dist/{chunk-NHBEO3F3.js.map → chunk-ZCEI242W.js.map} +0 -0
- /package/dist/{forget-BEXG5PQC.js.map → forget-6SOIPUMQ.js.map} +0 -0
|
@@ -6,6 +6,7 @@ import type { PluginConfig } from "../types.js";
|
|
|
6
6
|
import { ALL_CATEGORY_DIRS } from "../utils/category-dir.js";
|
|
7
7
|
import { namespaceIdentityToken, normalizeNamespaceIdentity } from "./identity.js";
|
|
8
8
|
import type { NamespaceCatalog } from "./catalog.js";
|
|
9
|
+
import { MutationSerializer } from "../utils/serialize-mutations.js";
|
|
9
10
|
|
|
10
11
|
async function exists(p: string): Promise<boolean> {
|
|
11
12
|
try {
|
|
@@ -209,21 +210,22 @@ export class NamespaceStorageRouter {
|
|
|
209
210
|
// rebuilds. We fire the hook only when the (namespace, storageDir) pair is new
|
|
210
211
|
// or its dir changed, so a steady-state cache hit is a no-op for the catalog.
|
|
211
212
|
private readonly notifiedResolved = new Map<string, string>();
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
// the first
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
|
|
213
|
+
// Instance-scoped serializer for the resolve hook (issue #1524 adoption).
|
|
214
|
+
// Replaces the bespoke `inFlightResolved` marker-then-clear pattern: the
|
|
215
|
+
// serializer's per-key chain strictly orders concurrent notifications for the
|
|
216
|
+
// SAME namespace, and the task re-checks `notifiedResolved` once it runs, so a
|
|
217
|
+
// burst of cache hits before the first hook settles collapses to a single
|
|
218
|
+
// hook invocation (the once-per-namespace intent). Recovery is preserved —
|
|
219
|
+
// one rejected hook never poisons subsequent notifications for that key.
|
|
220
|
+
private readonly resolveSerializer = new MutationSerializer();
|
|
221
|
+
// (namespace, storageDir) pairs whose resolve hook is currently pending. Set SYNCHRONOUSLY in
|
|
222
|
+
// notifyResolved (before queueing) so a burst of concurrent storageFor()
|
|
223
|
+
// cache hits collapses onto the one in-flight hook instead of each enqueuing
|
|
224
|
+
// its own task. Cleared when the queued hook settles. Without this, a dropped
|
|
225
|
+
// hook (returns false on a rebuild-lock timeout) leaves notifiedResolved
|
|
226
|
+
// unset, so every queued sibling task would re-run the hook — N serial lock
|
|
227
|
+
// waits (cursor Medium 06f58a7c, codex P2).
|
|
228
|
+
private readonly inFlightResolveHooks = new Set<string>();
|
|
227
229
|
// Tracks every in-flight resolve-hook promise so callers can deterministically
|
|
228
230
|
// await the fire-and-forget registrations that `storageFor()` kicks off (see
|
|
229
231
|
// `whenResolveHooksSettled`). Entries are removed as each hook settles, so the
|
|
@@ -308,77 +310,82 @@ export class NamespaceStorageRouter {
|
|
|
308
310
|
/**
|
|
309
311
|
* Fire the resolve hook defensively. A hook failure (e.g. a catalog write
|
|
310
312
|
* error) MUST NOT crash storage resolution — see CLAUDE.md gotcha #13.
|
|
313
|
+
*
|
|
314
|
+
* Issue #1524 adoption: hook invocations for the SAME namespace are now
|
|
315
|
+
* strictly ordered through the shared `MutationSerializer` rather than the
|
|
316
|
+
* bespoke `inFlightResolved` marker-then-clear pattern. The serializer
|
|
317
|
+
* guarantees one in-flight hook per namespace; a concurrent burst of
|
|
318
|
+
* `storageFor()` cache hits collapses to a single hook invocation because
|
|
319
|
+
* each queued task re-checks `notifiedResolved` before invoking the hook. A
|
|
320
|
+
* dropped (`false`) or rejected hook leaves `notifiedResolved` unset so the
|
|
321
|
+
* next `storageFor()` retries — the serializer recovers from the rejection,
|
|
322
|
+
* so a failed hook never poisons later notifications.
|
|
311
323
|
*/
|
|
312
324
|
private notifyResolved(namespace: string, storageDir: string): void {
|
|
313
325
|
const hook = this.hooks.onResolve;
|
|
314
326
|
if (!hook) return;
|
|
315
|
-
//
|
|
316
|
-
// storageDir)
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
// cursor Medium — ND3EJ).
|
|
327
|
+
// Permanent dedup: skip once we've SUCCESSFULLY notified this exact
|
|
328
|
+
// (namespace, storageDir). A changed dir (rare: migration/realignment)
|
|
329
|
+
// still re-fires once. The mark is set ONLY AFTER the hook succeeds, so a
|
|
330
|
+
// dropped registration (e.g. rebuild-lock timeout) is RETRIED on the next
|
|
331
|
+
// cache hit instead of being suppressed forever (round 6, cursor Medium —
|
|
332
|
+
// ND3EJ).
|
|
322
333
|
if (this.notifiedResolved.get(namespace) === storageDir) return;
|
|
323
|
-
// In-flight dedup (
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this.
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (this.inFlightResolved.get(namespace) === storageDir) {
|
|
367
|
-
this.inFlightResolved.delete(namespace);
|
|
368
|
-
}
|
|
369
|
-
if (this.notifiedResolved.get(namespace) === storageDir) {
|
|
370
|
-
this.notifiedResolved.delete(namespace);
|
|
371
|
-
}
|
|
372
|
-
this.pendingResolveHooks.delete(hookResult);
|
|
373
|
-
},
|
|
374
|
-
);
|
|
375
|
-
} catch {
|
|
376
|
-
// Synchronous throw: clear any in-flight marker we just set and leave the
|
|
377
|
-
// pair un-notified so a later resolve retries.
|
|
378
|
-
if (this.inFlightResolved.get(namespace) === storageDir) {
|
|
379
|
-
this.inFlightResolved.delete(namespace);
|
|
334
|
+
// In-flight dedup (cursor Medium 06f58a7c, codex P2): if a hook for THIS
|
|
335
|
+
// namespace is already pending, collapse this call onto it instead of
|
|
336
|
+
// enqueueing another task. The serializer strictly orders queued tasks, but
|
|
337
|
+
// ordering alone is not enough — when the first hook returns `false`
|
|
338
|
+
// (dropped touch, e.g. rebuild-lock timeout), `notifiedResolved` stays
|
|
339
|
+
// unset, so each queued sibling task would pass its re-check and re-run the
|
|
340
|
+
// hook. With the real catalog hook each retry can spend the full lock wait,
|
|
341
|
+
// so N cache hits during a rebuild leave N serial background lock attempts.
|
|
342
|
+
// Collapsing here means at most ONE hook runs per in-flight registration;
|
|
343
|
+
// its result (set `notifiedResolved` on success, leave unset on drop)
|
|
344
|
+
// decides whether a LATER `storageFor()` retries — collapsing loses
|
|
345
|
+
// nothing because the drop is already retried on the next cache hit.
|
|
346
|
+
// Keyed by the composite (namespace, storageDir) so a CHANGED dir
|
|
347
|
+
// (migration/realignment) for the same namespace still gets its own hook —
|
|
348
|
+
// it is NOT collapsed onto the old dir's pending registration (cursor
|
|
349
|
+
// Medium, codex P2).
|
|
350
|
+
const inFlightKey = namespace + "\u0000" + storageDir;
|
|
351
|
+
if (this.inFlightResolveHooks.has(inFlightKey)) return;
|
|
352
|
+
this.inFlightResolveHooks.add(inFlightKey);
|
|
353
|
+
// Queue through the serializer. Concurrent calls for the same namespace
|
|
354
|
+
// strictly order here; the 2nd call's task runs only after the 1st's hook
|
|
355
|
+
// settles, by which point `notifiedResolved` is either set (no-op) or still
|
|
356
|
+
// unset (retry). The returned promise is tracked for
|
|
357
|
+
// `whenResolveHooksSettled()`. Rejections from the task body are caught so
|
|
358
|
+
// they never reach the caller (best-effort hook contract); the serializer's
|
|
359
|
+
// recovered tail still lets subsequent notifications run.
|
|
360
|
+
const task = async (): Promise<void> => {
|
|
361
|
+
// Re-check after queueing: a prior task in this same chain may have just
|
|
362
|
+
// marked the pair as notified.
|
|
363
|
+
if (this.notifiedResolved.get(namespace) === storageDir) return;
|
|
364
|
+
try {
|
|
365
|
+
// Hook may be sync or async; Promise.resolve normalizes both. A result
|
|
366
|
+
// of `false` means the registration was dropped/no-op (e.g. rebuild-lock
|
|
367
|
+
// timeout) — leave notifiedResolved UNSET so the next storageFor retries
|
|
368
|
+
// (round 6, codex P2 — NEFoX). `void`/`undefined` is success for legacy
|
|
369
|
+
// hooks. A rejection leaves notifiedResolved unset for the same reason.
|
|
370
|
+
const persisted = await Promise.resolve(hook(namespace, storageDir));
|
|
371
|
+
if (persisted !== false) {
|
|
372
|
+
this.notifiedResolved.set(namespace, storageDir);
|
|
373
|
+
}
|
|
374
|
+
} catch {
|
|
375
|
+
// Best-effort: a hook failure MUST NOT crash storage resolution. Leave
|
|
376
|
+
// notifiedResolved unset so a later storageFor retries the registration.
|
|
380
377
|
}
|
|
381
|
-
}
|
|
378
|
+
};
|
|
379
|
+
const queued = this.resolveSerializer.serialize(namespace, task);
|
|
380
|
+
this.pendingResolveHooks.add(queued);
|
|
381
|
+
// Clear the in-flight marker when the hook settles so a subsequent
|
|
382
|
+
// storageFor() can retry after a drop, or short-circuit via notifiedResolved
|
|
383
|
+
// after a success.
|
|
384
|
+
const cleanup = (): void => {
|
|
385
|
+
this.inFlightResolveHooks.delete(inFlightKey);
|
|
386
|
+
this.pendingResolveHooks.delete(queued);
|
|
387
|
+
};
|
|
388
|
+
void queued.then(cleanup, cleanup);
|
|
382
389
|
}
|
|
383
390
|
|
|
384
391
|
/**
|
package/src/orchestrator.ts
CHANGED
|
@@ -343,7 +343,7 @@ import {
|
|
|
343
343
|
lcmReadSessionIdsForNamespaces,
|
|
344
344
|
resolveCodingNamespaceOverlay,
|
|
345
345
|
} from "./coding/coding-namespace.js";
|
|
346
|
-
import type { CodingContext } from "./types.js";
|
|
346
|
+
import type { CodingContext, ProvenanceSource } from "./types.js";
|
|
347
347
|
import {
|
|
348
348
|
NamespaceSearchRouter,
|
|
349
349
|
type NamespaceSearchHealth,
|
|
@@ -13923,6 +13923,8 @@ export class Orchestrator {
|
|
|
13923
13923
|
memoryKind?: MemoryFrontmatter["memoryKind"];
|
|
13924
13924
|
validAt?: string;
|
|
13925
13925
|
source: string;
|
|
13926
|
+
sources?: ProvenanceSource[];
|
|
13927
|
+
provenance?: "verified" | "unverified" | "none";
|
|
13926
13928
|
}): Promise<void> => {
|
|
13927
13929
|
if (
|
|
13928
13930
|
!scopeProfileWritePlan ||
|
|
@@ -13979,6 +13981,8 @@ export class Orchestrator {
|
|
|
13979
13981
|
memoryKind: options.memoryKind,
|
|
13980
13982
|
validAt: options.validAt,
|
|
13981
13983
|
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
13984
|
+
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
13985
|
+
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
13982
13986
|
},
|
|
13983
13987
|
);
|
|
13984
13988
|
if (
|
|
@@ -14039,6 +14043,9 @@ export class Orchestrator {
|
|
|
14039
14043
|
memoryKind?: MemoryFrontmatter["memoryKind"];
|
|
14040
14044
|
validAt?: string;
|
|
14041
14045
|
source: string;
|
|
14046
|
+
/** Claim-level provenance spans (issue #1575 PR 2). */
|
|
14047
|
+
sources?: ProvenanceSource[];
|
|
14048
|
+
provenance?: "verified" | "unverified" | "none";
|
|
14042
14049
|
}): Promise<void> => {
|
|
14043
14050
|
await promoteMemoryToProfileTargets(options);
|
|
14044
14051
|
if (
|
|
@@ -14264,10 +14271,10 @@ export class Orchestrator {
|
|
|
14264
14271
|
intentEntityTypes: options.intentEntityTypes,
|
|
14265
14272
|
memoryKind: options.memoryKind,
|
|
14266
14273
|
validAt: options.validAt,
|
|
14267
|
-
// Index the same canonical body used by hasFactContentHash above.
|
|
14268
|
-
// For structured facts this includes the normalized Attributes
|
|
14269
|
-
// suffix, matching StorageManager.writeMemory enrichment.
|
|
14270
14274
|
contentHashSource: options.category === "fact" ? dedupContent : rawContent,
|
|
14275
|
+
// Claim-level provenance spans (issue #1575 PR 2).
|
|
14276
|
+
...(options.sources && options.sources.length > 0 ? { sources: options.sources } : {}),
|
|
14277
|
+
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
14271
14278
|
},
|
|
14272
14279
|
);
|
|
14273
14280
|
// PR #402 Finding 3 fix: run temporal supersession against the shared
|
|
@@ -14887,7 +14894,7 @@ export class Orchestrator {
|
|
|
14887
14894
|
// pre-computed verdict for this fact and translate it to frontmatter +
|
|
14888
14895
|
// an optional enforce-mode pending_review status. Logic lives in the
|
|
14889
14896
|
// pure module; this is thin read-through (ground rule 4).
|
|
14890
|
-
const { faithfulness: faithfulnessFm, enforceStatus:
|
|
14897
|
+
const { faithfulness: faithfulnessFm, enforceStatus: faithfulnessGateStatus } =
|
|
14891
14898
|
applyFaithfulnessVerdict(
|
|
14892
14899
|
faithfulnessResultsByFactIndex,
|
|
14893
14900
|
factLoopIndex,
|
|
@@ -14896,6 +14903,22 @@ export class Orchestrator {
|
|
|
14896
14903
|
this.faithfulnessCounters,
|
|
14897
14904
|
);
|
|
14898
14905
|
|
|
14906
|
+
// requireSpans enforcement (issue #1575 PR 2): when an operator opts
|
|
14907
|
+
// into provenance.requireSpans, a fact whose quote could not be located
|
|
14908
|
+
// in any source turn (carried as the transient requireSpansPending
|
|
14909
|
+
// signal from the extraction validator) routes to pending_review — the
|
|
14910
|
+
// same review queue an unsupported faithfulness verdict uses. This is
|
|
14911
|
+
// the persist-path wiring ProvenanceConfig.requireSpans documents.
|
|
14912
|
+
// Faithfulness takes precedence when it already routed the fact; both
|
|
14913
|
+
// gates agree on pending_review so the merge is a simple coalesce
|
|
14914
|
+
// (chatgpt-codex-connector thread 4xB).
|
|
14915
|
+
const requireSpansPendingStatus =
|
|
14916
|
+
this.config.provenance?.requireSpans === true &&
|
|
14917
|
+
fact.requireSpansPending === true
|
|
14918
|
+
? ("pending_review" as const)
|
|
14919
|
+
: undefined;
|
|
14920
|
+
const faithfulnessEnforceStatus = faithfulnessGateStatus ?? requireSpansPendingStatus;
|
|
14921
|
+
|
|
14899
14922
|
// Issue #373 — write-time semantic similarity guard. Hook runs after
|
|
14900
14923
|
// the exact content-hash miss and the importance gate so that:
|
|
14901
14924
|
// (a) paraphrased near-duplicates never reach writeMemory(), and
|
|
@@ -15169,6 +15192,9 @@ export class Orchestrator {
|
|
|
15169
15192
|
// Faithfulness gate (issue #1576).
|
|
15170
15193
|
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
15171
15194
|
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
15195
|
+
// Claim-level provenance spans (issue #1575 PR 2).
|
|
15196
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
15197
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
15172
15198
|
},
|
|
15173
15199
|
);
|
|
15174
15200
|
try {
|
|
@@ -15209,6 +15235,12 @@ export class Orchestrator {
|
|
|
15209
15235
|
// is not indexed as active through its chunks (chatgpt P2).
|
|
15210
15236
|
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
15211
15237
|
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
15238
|
+
// Claim-level provenance (issue #1575 PR 2): mirror the
|
|
15239
|
+
// parent's spans onto each chunk so a chunk surfaced
|
|
15240
|
+
// independently (memory_get/x-ray on a chunk ID) preserves
|
|
15241
|
+
// the verified span (chatgpt-codex-connector thread Ocvmo).
|
|
15242
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
15243
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
15212
15244
|
},
|
|
15213
15245
|
);
|
|
15214
15246
|
}
|
|
@@ -15281,6 +15313,8 @@ export class Orchestrator {
|
|
|
15281
15313
|
memoryKind,
|
|
15282
15314
|
validAt: sourceContext?.validAt,
|
|
15283
15315
|
source: extractionWriteSource,
|
|
15316
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
15317
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
15284
15318
|
});
|
|
15285
15319
|
// Register chunked content in the target storage hash index too.
|
|
15286
15320
|
// Thread 3 fix: canonicalize by stripping any pre-existing citation
|
|
@@ -15454,6 +15488,11 @@ export class Orchestrator {
|
|
|
15454
15488
|
// Faithfulness gate (issue #1576).
|
|
15455
15489
|
...(faithfulnessFm ? { faithfulness: faithfulnessFm } : {}),
|
|
15456
15490
|
...(faithfulnessEnforceStatus ? { status: faithfulnessEnforceStatus } : {}),
|
|
15491
|
+
// Claim-level provenance spans (issue #1575 PR 2). Carry verified
|
|
15492
|
+
// sources + the coarse strength tag from the extraction validator
|
|
15493
|
+
// through to frontmatter so they survive end-to-end.
|
|
15494
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
15495
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
15457
15496
|
},
|
|
15458
15497
|
);
|
|
15459
15498
|
if (routedRuleId) {
|
|
@@ -15527,6 +15566,8 @@ export class Orchestrator {
|
|
|
15527
15566
|
memoryKind,
|
|
15528
15567
|
validAt: sourceContext?.validAt,
|
|
15529
15568
|
source: extractionWriteSource,
|
|
15569
|
+
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
15570
|
+
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
15530
15571
|
});
|
|
15531
15572
|
// v8.2: graph edge building (fail-open). #1576: skip pending_review facts.
|
|
15532
15573
|
if (graphCaps.multiGraphMemory && faithfulnessEnforceStatus !== "pending_review") {
|