@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GFIARMA7.js";
|
|
4
4
|
|
|
5
5
|
// src/semantic-rule-promotion.ts
|
|
6
6
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -529,4 +529,4 @@ export {
|
|
|
529
529
|
setSemanticRulePromotionTestHooks,
|
|
530
530
|
promoteSemanticRuleFromMemory
|
|
531
531
|
};
|
|
532
|
-
//# sourceMappingURL=chunk-
|
|
532
|
+
//# sourceMappingURL=chunk-IX72AAMZ.js.map
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot,
|
|
3
3
|
resolveNamespaceStorageRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-64XXOQRW.js";
|
|
5
5
|
import {
|
|
6
6
|
namespaceIdentityFromToken,
|
|
7
7
|
namespaceIdentityToken,
|
|
8
8
|
normalizeNamespaceIdentity
|
|
9
9
|
} from "./chunk-ZFXCQPNO.js";
|
|
10
|
+
import {
|
|
11
|
+
MutationSerializer,
|
|
12
|
+
withHeldFileLock
|
|
13
|
+
} from "./chunk-LTJAMRGI.js";
|
|
10
14
|
import {
|
|
11
15
|
displayErrorDetail
|
|
12
16
|
} from "./chunk-6KYMPV2O.js";
|
|
@@ -19,19 +23,14 @@ import {
|
|
|
19
23
|
|
|
20
24
|
// src/namespaces/catalog.ts
|
|
21
25
|
import path from "path";
|
|
22
|
-
import { randomUUID } from "crypto";
|
|
23
26
|
import {
|
|
24
27
|
appendFile,
|
|
25
28
|
lstat,
|
|
26
29
|
mkdir,
|
|
27
|
-
open,
|
|
28
30
|
readdir,
|
|
29
31
|
readFile,
|
|
30
32
|
realpath,
|
|
31
33
|
rename,
|
|
32
|
-
stat,
|
|
33
|
-
unlink,
|
|
34
|
-
utimes,
|
|
35
34
|
writeFile
|
|
36
35
|
} from "fs/promises";
|
|
37
36
|
var NAMESPACE_KINDS = [
|
|
@@ -240,15 +239,16 @@ var NamespaceCatalog = class {
|
|
|
240
239
|
stateDir;
|
|
241
240
|
catalogPath;
|
|
242
241
|
rebuildLockPath;
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
|
|
242
|
+
// In-process serialization for catalog mutations (issue #1524 adoption).
|
|
243
|
+
// Replaces the bespoke `writeChain` field: every touch/rebuild runs through
|
|
244
|
+
// this serializer so a single failed section never poisons subsequent ones
|
|
245
|
+
// (CLAUDE.md rule #40 — recovery is the util's contract, not re-implemented
|
|
246
|
+
// here). Cross-process identity (the lock file's owner-uuid) is now per-CALL
|
|
247
|
+
// inside the shared util, which is STRONGER than the previous per-instance
|
|
248
|
+
// `lockOwnerId` — two calls on the SAME instance get different ids, so
|
|
249
|
+
// neither mistakes the other's lock for self-held (round 6, codex P2 — NBsGP
|
|
250
|
+
// invariant preserved and tightened).
|
|
251
|
+
criticalSection = new MutationSerializer();
|
|
252
252
|
// Test-only seam (round 7 — NEZkA): fires inside a touch's HELD-lock critical
|
|
253
253
|
// section, after the lock is acquired but BEFORE the read→merge→append. A
|
|
254
254
|
// deterministic concurrency test installs a hook here to widen the (otherwise
|
|
@@ -1091,24 +1091,23 @@ var NamespaceCatalog = class {
|
|
|
1091
1091
|
* their respective critical sections — closing the check-then-append gap where a
|
|
1092
1092
|
* polled-only touch could append into a rebuild's load→rename window.
|
|
1093
1093
|
*
|
|
1094
|
-
*
|
|
1095
|
-
* `
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1094
|
+
* Issue #1524 adoption: this is now a thin delegation to the shared
|
|
1095
|
+
* `withHeldFileLock` utility. The acquire loop, mtime heartbeat, stale-break
|
|
1096
|
+
* (NG7Bg replacement-safe), and ownership-checked release (NCzT6) all live in
|
|
1097
|
+
* ONE place — the util — so this module no longer re-implements them. The
|
|
1098
|
+
* catalog's `REBUILD_LOCK_*` constants and the `onBeforeBreakStaleUnlinkForTest`
|
|
1099
|
+
* seam flow straight through. The util generates a per-CALL owner uuid, which
|
|
1100
|
+
* is stricter than the previous per-instance `lockOwnerId` (two calls on the
|
|
1101
|
+
* same instance get different ids, so neither mistakes the other's lock as
|
|
1102
|
+
* self-held — the NBsGP invariant, preserved and tightened).
|
|
1098
1103
|
*
|
|
1099
1104
|
* IN-PROCESS SAFETY: every caller invokes this from inside (or wrapping) the
|
|
1100
1105
|
* per-process `queueCritical` chain, which serializes all catalog mutations in
|
|
1101
|
-
* THIS process. So within one process only one
|
|
1102
|
-
* acquisition at a time — the file lock is never
|
|
1103
|
-
* the lock is acquired and released within a
|
|
1104
|
-
* lock adds only the missing CROSS-process
|
|
1105
|
-
*
|
|
1106
|
-
* HEARTBEAT (round 5, cursor/codex Medium/P2): while WE hold the lock a timer
|
|
1107
|
-
* refreshes its mtime every `REBUILD_LOCK_HEARTBEAT_MS`, so a legitimately long
|
|
1108
|
-
* holder (> `REBUILD_LOCK_STALE_MS`) is not treated as a crashed holder and
|
|
1109
|
-
* unlinked by another process — which would let overlapping windows lose
|
|
1110
|
-
* appends. Heartbeat failures are swallowed; the timer is always cleared in
|
|
1111
|
-
* `finally`.
|
|
1106
|
+
* THIS process (now via `MutationSerializer`). So within one process only one
|
|
1107
|
+
* logical holder attempts OS-lock acquisition at a time — the file lock is never
|
|
1108
|
+
* self-contended in-process, and the lock is acquired and released within a
|
|
1109
|
+
* single in-process turn. The file lock adds only the missing CROSS-process
|
|
1110
|
+
* exclusion.
|
|
1112
1111
|
*
|
|
1113
1112
|
* ACQUISITION RESULT (round 6, codex P2 — NBPmY): `fn` receives whether WE
|
|
1114
1113
|
* actually hold the lock. When acquisition TIMED OUT (another holder is active),
|
|
@@ -1117,120 +1116,20 @@ var NamespaceCatalog = class {
|
|
|
1117
1116
|
* caller uses `acquired` to run compute-only (rebuild) or DROP the append
|
|
1118
1117
|
* (touch) when unlocked.
|
|
1119
1118
|
*/
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
if (acquired) {
|
|
1135
|
-
try {
|
|
1136
|
-
if (await this.rebuildLockHeldBySelf()) {
|
|
1137
|
-
await unlink(this.rebuildLockPath);
|
|
1138
|
-
}
|
|
1139
|
-
} catch {
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
/** Try to acquire the rebuild lock; returns true if WE created it. */
|
|
1145
|
-
async acquireRebuildLock() {
|
|
1146
|
-
const deadline = Date.now() + REBUILD_LOCK_MAX_WAIT_MS;
|
|
1147
|
-
await mkdir(this.stateDir, { recursive: true });
|
|
1148
|
-
for (; ; ) {
|
|
1149
|
-
try {
|
|
1150
|
-
const handle = await open(this.rebuildLockPath, "wx");
|
|
1151
|
-
try {
|
|
1152
|
-
await handle.writeFile(
|
|
1153
|
-
`${process.pid} ${this.lockOwnerId} ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
1154
|
-
`,
|
|
1155
|
-
"utf8"
|
|
1156
|
-
);
|
|
1157
|
-
} catch {
|
|
1158
|
-
} finally {
|
|
1159
|
-
await handle.close();
|
|
1160
|
-
}
|
|
1161
|
-
return true;
|
|
1162
|
-
} catch (err) {
|
|
1163
|
-
if (err?.code !== "EEXIST") {
|
|
1164
|
-
return false;
|
|
1165
|
-
}
|
|
1166
|
-
await this.breakStaleRebuildLock();
|
|
1167
|
-
if (Date.now() >= deadline) return false;
|
|
1168
|
-
await new Promise((r) => setTimeout(r, REBUILD_LOCK_POLL_MS));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
/**
|
|
1173
|
-
* Remove the lock file if its mtime is older than the stale threshold.
|
|
1174
|
-
*
|
|
1175
|
-
* REPLACEMENT-SAFE (NG7Bg, codex P2): a plain `stat` → `unlink` has a TOCTOU
|
|
1176
|
-
* window — two processes can both observe the SAME stale lock; one removes it and
|
|
1177
|
-
* creates a FRESH lock, and the other's later `unlink` then deletes that fresh
|
|
1178
|
-
* holder's ACTIVE lock based on the stale identity it read earlier, leaving the
|
|
1179
|
-
* fresh holder running its critical section with no visible lock and reopening the
|
|
1180
|
-
* lost-update race the mutex prevents. We therefore capture the lock's IDENTITY
|
|
1181
|
-
* (its full content line: `<pid> <owner-uuid> <iso>`) when we judge it stale, then
|
|
1182
|
-
* RE-READ immediately before unlinking and only remove it when the content is
|
|
1183
|
-
* byte-identical AND still stale. A replacement lock has a different owner id /
|
|
1184
|
-
* timestamp, so its content differs and we leave it untouched. We never unlink a
|
|
1185
|
-
* lock whose mtime is now fresh (a heartbeat refreshed it) or whose identity
|
|
1186
|
-
* changed (a replacement was created). This is best-effort: any mismatch/vanish
|
|
1187
|
-
* simply skips the break and the caller polls again.
|
|
1188
|
-
*/
|
|
1189
|
-
async breakStaleRebuildLock() {
|
|
1190
|
-
let staleIdentity;
|
|
1191
|
-
try {
|
|
1192
|
-
const info = await stat(this.rebuildLockPath);
|
|
1193
|
-
if (Date.now() - info.mtimeMs <= REBUILD_LOCK_STALE_MS) {
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
staleIdentity = await readFile(this.rebuildLockPath, "utf8");
|
|
1197
|
-
} catch {
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
if (this.onBeforeBreakStaleUnlinkForTest) {
|
|
1201
|
-
await this.onBeforeBreakStaleUnlinkForTest();
|
|
1202
|
-
}
|
|
1203
|
-
try {
|
|
1204
|
-
const current = await readFile(this.rebuildLockPath, "utf8");
|
|
1205
|
-
if (current !== staleIdentity) return;
|
|
1206
|
-
const recheck = await stat(this.rebuildLockPath);
|
|
1207
|
-
if (Date.now() - recheck.mtimeMs <= REBUILD_LOCK_STALE_MS) return;
|
|
1208
|
-
await unlink(this.rebuildLockPath).catch(() => void 0);
|
|
1209
|
-
} catch {
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Whether the rebuild lock file was written by THIS instance (round 6, codex
|
|
1214
|
-
* P2 — NBsGP). Matches the per-instance owner id, NOT just `process.pid`: two
|
|
1215
|
-
* NamespaceCatalog instances in the same process share a PID, so a PID-only
|
|
1216
|
-
* check would wrongly treat instance A's lock as self-held by instance B and
|
|
1217
|
-
* let B's touch skip the wait and append into A's rebuild window. Falls back to
|
|
1218
|
-
* the legacy PID-only form for lock files written before owner ids existed.
|
|
1219
|
-
*/
|
|
1220
|
-
async rebuildLockHeldBySelf() {
|
|
1221
|
-
try {
|
|
1222
|
-
const body = await readFile(this.rebuildLockPath, "utf8");
|
|
1223
|
-
const parts = body.trim().split(/\s+/);
|
|
1224
|
-
const pid = Number.parseInt(parts[0] ?? "", 10);
|
|
1225
|
-
const ownerId = parts[1];
|
|
1226
|
-
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1227
|
-
if (ownerId && UUID_RE.test(ownerId)) {
|
|
1228
|
-
return ownerId === this.lockOwnerId;
|
|
1229
|
-
}
|
|
1230
|
-
return Number.isFinite(pid) && pid === process.pid;
|
|
1231
|
-
} catch {
|
|
1232
|
-
return false;
|
|
1233
|
-
}
|
|
1119
|
+
withHeldCatalogLock(fn) {
|
|
1120
|
+
return withHeldFileLock(
|
|
1121
|
+
this.rebuildLockPath,
|
|
1122
|
+
{
|
|
1123
|
+
staleMs: REBUILD_LOCK_STALE_MS,
|
|
1124
|
+
maxWaitMs: REBUILD_LOCK_MAX_WAIT_MS,
|
|
1125
|
+
pollMs: REBUILD_LOCK_POLL_MS,
|
|
1126
|
+
heartbeatMs: REBUILD_LOCK_HEARTBEAT_MS,
|
|
1127
|
+
// NG7Bg seam: fires inside the util's breakStaleLock after it judges the
|
|
1128
|
+
// lock stale and captures its identity, before the atomic rename+verify.
|
|
1129
|
+
onBeforeBreakStaleUnlinkForTest: this.onBeforeBreakStaleUnlinkForTest
|
|
1130
|
+
},
|
|
1131
|
+
fn
|
|
1132
|
+
);
|
|
1234
1133
|
}
|
|
1235
1134
|
/**
|
|
1236
1135
|
* Merge a prior record's preserved metadata (timestamps, principal hints)
|
|
@@ -1288,20 +1187,20 @@ var NamespaceCatalog = class {
|
|
|
1288
1187
|
}
|
|
1289
1188
|
/**
|
|
1290
1189
|
* Serialize an arbitrary read-modify-write critical section through the single
|
|
1291
|
-
*
|
|
1292
|
-
* runs through this so they are mutually exclusive: a touch always
|
|
1293
|
-
* latest persisted state before appending, and a rebuild rewrite
|
|
1294
|
-
* interleave with a touch's append.
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1190
|
+
* per-instance chain. Every catalog mutation (touch read+merge+append, full
|
|
1191
|
+
* rewrite) runs through this so they are mutually exclusive: a touch always
|
|
1192
|
+
* reads the latest persisted state before appending, and a rebuild rewrite
|
|
1193
|
+
* cannot interleave with a touch's append.
|
|
1194
|
+
*
|
|
1195
|
+
* Issue #1524 adoption: delegates to the shared `MutationSerializer` (stored
|
|
1196
|
+
* as `criticalSection`). The util owns the rejection-recovery invariant
|
|
1197
|
+
* (CLAUDE.md rule #40 — one failed section never poisons subsequent ones, but
|
|
1198
|
+
* the failing section's error still surfaces to ITS awaited promise) and the
|
|
1199
|
+
* no-unbounded-growth cleanup. The key is constant: the catalog has ONE
|
|
1200
|
+
* logical mutation queue (touches and rebuilds mutually exclude in-process).
|
|
1297
1201
|
*/
|
|
1298
1202
|
queueCritical(fn) {
|
|
1299
|
-
|
|
1300
|
-
this.writeChain = run.then(
|
|
1301
|
-
() => void 0,
|
|
1302
|
-
() => void 0
|
|
1303
|
-
);
|
|
1304
|
-
return run;
|
|
1203
|
+
return this.criticalSection.serialize("catalog", fn);
|
|
1305
1204
|
}
|
|
1306
1205
|
/**
|
|
1307
1206
|
* Append a single record to the JSONL log WITHOUT re-serializing through the
|
|
@@ -1336,14 +1235,14 @@ function isPathInside(root, child) {
|
|
|
1336
1235
|
}
|
|
1337
1236
|
|
|
1338
1237
|
// src/maintenance/namespace-planner.ts
|
|
1339
|
-
import { createHash, randomUUID
|
|
1340
|
-
import { lstat as lstat2, mkdir as mkdir2, open
|
|
1238
|
+
import { createHash, randomUUID } from "crypto";
|
|
1239
|
+
import { lstat as lstat2, mkdir as mkdir2, open, readFile as readFile2, readdir as readdir2, rename as rename2, rm, rmdir, utimes, writeFile as writeFile2 } from "fs/promises";
|
|
1341
1240
|
import path2 from "path";
|
|
1342
1241
|
var DEFAULT_MAX_NAMESPACES_PER_CYCLE = 20;
|
|
1343
1242
|
var DEFAULT_LOCK_STALE_MS = 10 * 6e4;
|
|
1344
1243
|
var LOCK_BASE = "maintenance-locks";
|
|
1345
1244
|
var STATUS_BASE = "namespace-maintenance-status";
|
|
1346
|
-
var namespaceMaintenanceFs = { open
|
|
1245
|
+
var namespaceMaintenanceFs = { open, rm };
|
|
1347
1246
|
function configuredNamespaces(config) {
|
|
1348
1247
|
return Array.from(
|
|
1349
1248
|
new Set(
|
|
@@ -1589,7 +1488,7 @@ async function tryAcquireNamespaceMaintenanceLock(config, jobName, namespace) {
|
|
|
1589
1488
|
const filePath = lockPath(config, jobName, namespace);
|
|
1590
1489
|
await mkdir2(path2.dirname(filePath), { recursive: true });
|
|
1591
1490
|
try {
|
|
1592
|
-
const lockId =
|
|
1491
|
+
const lockId = randomUUID();
|
|
1593
1492
|
await mkdir2(filePath);
|
|
1594
1493
|
const ownerPath = path2.join(filePath, `${lockId}.json`);
|
|
1595
1494
|
let handle;
|
|
@@ -1620,8 +1519,8 @@ async function tryAcquireNamespaceMaintenanceLock(config, jobName, namespace) {
|
|
|
1620
1519
|
const parsed = JSON.parse(await readFile2(ownerPath, "utf8"));
|
|
1621
1520
|
if (parsed.lockId === lockId) {
|
|
1622
1521
|
const now = /* @__PURE__ */ new Date();
|
|
1623
|
-
await
|
|
1624
|
-
await
|
|
1522
|
+
await utimes(ownerPath, now, now);
|
|
1523
|
+
await utimes(filePath, now, now);
|
|
1625
1524
|
}
|
|
1626
1525
|
} catch {
|
|
1627
1526
|
}
|
|
@@ -2051,4 +1950,4 @@ export {
|
|
|
2051
1950
|
runNamespaceMaintenancePlan,
|
|
2052
1951
|
runNamespaceMaintenanceBatchPlan
|
|
2053
1952
|
};
|
|
2054
|
-
//# sourceMappingURL=chunk-
|
|
1953
|
+
//# sourceMappingURL=chunk-JMA4RYRN.js.map
|