@remnic/core 9.3.699 → 9.3.700
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 +14 -10
- package/dist/access-cli.js +28 -26
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +5 -5
- package/dist/access-http.js +18 -14
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +17 -13
- package/dist/access-operations.d.ts +5 -5
- package/dist/access-operations.js +16 -12
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-DftqtNUy.d.ts → access-service-Cte3ol0W.d.ts} +2 -2
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +13 -9
- package/dist/access-surface-catalog.d.ts +5 -5
- package/dist/action-confidence.d.ts +1 -1
- package/dist/action-confidence.js +2 -2
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +1 -1
- 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 -3
- 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-D7YDNNF7.d.ts → catalog-DN1PzThs.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 -4
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-SJQ4HY3E.js → chunk-2NWHLAXX.js} +2 -2
- package/dist/{chunk-UDDSC6PO.js → chunk-33L6XHU2.js} +54 -6
- package/dist/chunk-33L6XHU2.js.map +1 -0
- package/dist/{chunk-XFG3PVZE.js → chunk-3E5WRQNQ.js} +8 -8
- package/dist/{chunk-EZWQZYLK.js → chunk-6JDGADXK.js} +2 -2
- package/dist/{chunk-IZ5E6ZTK.js → chunk-CCOXIDRM.js} +6 -6
- package/dist/{chunk-COEZR6F5.js → chunk-CHM274U6.js} +2 -2
- package/dist/{chunk-TIVZ4MCG.js → chunk-D75JXBV4.js} +3 -3
- package/dist/{chunk-M4DQWUKX.js → chunk-DR2JTSLZ.js} +2 -2
- package/dist/{chunk-XL5RSHZP.js → chunk-EOBJRBLC.js} +2 -2
- package/dist/{chunk-YY2HGKWR.js → chunk-G5PKTQ5J.js} +2 -2
- package/dist/{chunk-JYVD2XZ4.js → chunk-GA5A6MJH.js} +57 -24
- package/dist/chunk-GA5A6MJH.js.map +1 -0
- package/dist/{chunk-E6GOVHHJ.js → chunk-GYVVQYA3.js} +3 -3
- package/dist/{chunk-2KJG6ZZK.js → chunk-HDLC75NX.js} +2 -2
- package/dist/{chunk-AC5LO7IU.js → chunk-I4WBNM3M.js} +7 -1
- package/dist/chunk-I4WBNM3M.js.map +1 -0
- package/dist/{chunk-QVTSLRKT.js → chunk-IJEZMWKA.js} +3 -3
- package/dist/{chunk-ZXUOAFUG.js → chunk-IKNQAGBV.js} +1 -1
- package/dist/chunk-IKNQAGBV.js.map +1 -0
- package/dist/{chunk-N55RJT4N.js → chunk-JKW5XSWC.js} +2 -2
- package/dist/{chunk-CQ4PGFMC.js → chunk-JX3YZVII.js} +4 -4
- package/dist/{chunk-3LSSFCB4.js → chunk-K4DWSPMW.js} +11 -1
- package/dist/chunk-K4DWSPMW.js.map +1 -0
- package/dist/{chunk-HZ5DRA4Q.js → chunk-NHBEO3F3.js} +20 -20
- package/dist/{chunk-FSEQXHEZ.js → chunk-O54DY26V.js} +2 -2
- package/dist/{chunk-MRFVMSTR.js → chunk-OMNTQPZO.js} +20 -1
- package/dist/{chunk-MRFVMSTR.js.map → chunk-OMNTQPZO.js.map} +1 -1
- package/dist/chunk-PCZR32VL.js +446 -0
- package/dist/chunk-PCZR32VL.js.map +1 -0
- package/dist/{chunk-2K64VH66.js → chunk-PQG4T5V3.js} +22 -2
- package/dist/chunk-PQG4T5V3.js.map +1 -0
- package/dist/{chunk-JI6HWBYL.js → chunk-Q4O3ET6F.js} +2 -2
- package/dist/{chunk-ANZLT74L.js → chunk-RJ2THZ4H.js} +2 -2
- package/dist/{chunk-LPIWEKZ3.js → chunk-SDPDU2PM.js} +3 -3
- package/dist/{chunk-A62RAIBN.js → chunk-SEWF2O74.js} +2 -2
- package/dist/{chunk-2ULWWAQH.js → chunk-SMIVW7XC.js} +2 -2
- package/dist/{chunk-RTN2BLZM.js → chunk-T5QAZIBO.js} +2 -2
- package/dist/{chunk-RIC5U67B.js → chunk-X74FJSW7.js} +232 -4
- package/dist/chunk-X74FJSW7.js.map +1 -0
- package/dist/{chunk-SIDSEXUG.js → chunk-XY4WJTEX.js} +2 -2
- package/dist/{chunk-LIWU4QI6.js → chunk-YMTGXDN6.js} +5 -5
- package/dist/chunk-YPR7DOPD.js +286 -0
- package/dist/chunk-YPR7DOPD.js.map +1 -0
- package/dist/{chunk-MRX6S22R.js → chunk-YXIFA36P.js} +2 -2
- package/dist/{chunk-AH2JUU6X.js → chunk-Z2YFLXHU.js} +2 -2
- package/dist/{chunk-PJIHCOGV.js → chunk-ZDK2IW5F.js} +2 -2
- package/dist/{cli-DUMkkdLl.d.ts → cli--yVN9yEV.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +32 -28
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +7 -3
- 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 +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +7 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +7 -3
- 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/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +7 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +6 -6
- 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 +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{forget-PLR6J5DN.js → forget-BEXG5PQC.js} +32 -1
- package/dist/forget-BEXG5PQC.js.map +1 -0
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +21 -10
- package/dist/index.js +63 -41
- 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 +7 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -3
- package/dist/maintenance/rebuild-memory-projection.js +8 -4
- 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-provenance.js +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 +8 -4
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/storage.d.ts +20 -2
- package/dist/namespaces/storage.js +7 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +19 -2
- package/dist/operator-toolkit.js +17 -11
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +9 -5
- package/dist/{orchestrator-Dv8JQu3-.d.ts → orchestrator-CJI4xdqV.d.ts} +3 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +20 -18
- 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/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 +4 -4
- 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 +5 -5
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +4 -4
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +3 -3
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resume-bundles.js +2 -2
- 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 +28 -28
- 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-consolidation-CgREi9E0.d.ts → semantic-consolidation-BtUfv-AL.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +8 -4
- package/dist/semantic-rule-promotion.js +7 -3
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +7 -3
- 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 +306 -2
- package/dist/storage.js +6 -2
- 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-supersession.js +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/types.d.ts +12 -12
- package/dist/{types-CeZYSC-E.d.ts → types-PuiPZ9iE.d.ts} +34 -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 +5 -280
- package/dist/utils/serialize-mutations.js.map +1 -1
- package/dist/verified-recall.js +7 -3
- package/package.json +2 -2
- package/src/config.ts +10 -0
- package/src/lifecycle/tombstones.test.ts +355 -0
- package/src/lifecycle/tombstones.ts +807 -0
- package/src/maintenance/forget.ts +41 -0
- package/src/maintenance/pattern-reinforcement.ts +47 -0
- package/src/memory-provenance.ts +12 -0
- package/src/namespaces/storage.ts +33 -0
- package/src/operator-toolkit.ts +77 -0
- package/src/orchestrator.ts +16 -0
- package/src/review/index.ts +48 -3
- package/src/storage.ts +329 -2
- package/src/temporal-supersession.ts +38 -0
- package/src/types.ts +34 -0
- package/dist/chunk-2K64VH66.js.map +0 -1
- package/dist/chunk-3LSSFCB4.js.map +0 -1
- package/dist/chunk-AC5LO7IU.js.map +0 -1
- package/dist/chunk-JYVD2XZ4.js.map +0 -1
- package/dist/chunk-RIC5U67B.js.map +0 -1
- package/dist/chunk-UDDSC6PO.js.map +0 -1
- package/dist/chunk-ZXUOAFUG.js.map +0 -1
- package/dist/forget-PLR6J5DN.js.map +0 -1
- /package/dist/{chunk-SJQ4HY3E.js.map → chunk-2NWHLAXX.js.map} +0 -0
- /package/dist/{chunk-XFG3PVZE.js.map → chunk-3E5WRQNQ.js.map} +0 -0
- /package/dist/{chunk-EZWQZYLK.js.map → chunk-6JDGADXK.js.map} +0 -0
- /package/dist/{chunk-IZ5E6ZTK.js.map → chunk-CCOXIDRM.js.map} +0 -0
- /package/dist/{chunk-COEZR6F5.js.map → chunk-CHM274U6.js.map} +0 -0
- /package/dist/{chunk-TIVZ4MCG.js.map → chunk-D75JXBV4.js.map} +0 -0
- /package/dist/{chunk-M4DQWUKX.js.map → chunk-DR2JTSLZ.js.map} +0 -0
- /package/dist/{chunk-XL5RSHZP.js.map → chunk-EOBJRBLC.js.map} +0 -0
- /package/dist/{chunk-YY2HGKWR.js.map → chunk-G5PKTQ5J.js.map} +0 -0
- /package/dist/{chunk-E6GOVHHJ.js.map → chunk-GYVVQYA3.js.map} +0 -0
- /package/dist/{chunk-2KJG6ZZK.js.map → chunk-HDLC75NX.js.map} +0 -0
- /package/dist/{chunk-QVTSLRKT.js.map → chunk-IJEZMWKA.js.map} +0 -0
- /package/dist/{chunk-N55RJT4N.js.map → chunk-JKW5XSWC.js.map} +0 -0
- /package/dist/{chunk-CQ4PGFMC.js.map → chunk-JX3YZVII.js.map} +0 -0
- /package/dist/{chunk-HZ5DRA4Q.js.map → chunk-NHBEO3F3.js.map} +0 -0
- /package/dist/{chunk-FSEQXHEZ.js.map → chunk-O54DY26V.js.map} +0 -0
- /package/dist/{chunk-JI6HWBYL.js.map → chunk-Q4O3ET6F.js.map} +0 -0
- /package/dist/{chunk-ANZLT74L.js.map → chunk-RJ2THZ4H.js.map} +0 -0
- /package/dist/{chunk-LPIWEKZ3.js.map → chunk-SDPDU2PM.js.map} +0 -0
- /package/dist/{chunk-A62RAIBN.js.map → chunk-SEWF2O74.js.map} +0 -0
- /package/dist/{chunk-2ULWWAQH.js.map → chunk-SMIVW7XC.js.map} +0 -0
- /package/dist/{chunk-RTN2BLZM.js.map → chunk-T5QAZIBO.js.map} +0 -0
- /package/dist/{chunk-SIDSEXUG.js.map → chunk-XY4WJTEX.js.map} +0 -0
- /package/dist/{chunk-LIWU4QI6.js.map → chunk-YMTGXDN6.js.map} +0 -0
- /package/dist/{chunk-MRX6S22R.js.map → chunk-YXIFA36P.js.map} +0 -0
- /package/dist/{chunk-AH2JUU6X.js.map → chunk-Z2YFLXHU.js.map} +0 -0
- /package/dist/{chunk-PJIHCOGV.js.map → chunk-ZDK2IW5F.js.map} +0 -0
package/dist/transfer/types.d.ts
CHANGED
|
@@ -313,13 +313,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
313
313
|
peerProfiles: boolean;
|
|
314
314
|
}>;
|
|
315
315
|
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
schemaVersion: string;
|
|
316
317
|
includes: {
|
|
317
318
|
procedural: boolean;
|
|
318
319
|
taxonomy: boolean;
|
|
319
320
|
identityAnchors: boolean;
|
|
320
321
|
peerProfiles: boolean;
|
|
321
322
|
};
|
|
322
|
-
schemaVersion: string;
|
|
323
323
|
id: string;
|
|
324
324
|
description: string;
|
|
325
325
|
version: string;
|
|
@@ -334,13 +334,13 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
334
334
|
directAnswerEnabled: boolean;
|
|
335
335
|
};
|
|
336
336
|
}, {
|
|
337
|
+
schemaVersion: string;
|
|
337
338
|
includes: {
|
|
338
339
|
procedural: boolean;
|
|
339
340
|
taxonomy: boolean;
|
|
340
341
|
identityAnchors: boolean;
|
|
341
342
|
peerProfiles: boolean;
|
|
342
343
|
};
|
|
343
|
-
schemaVersion: string;
|
|
344
344
|
id: string;
|
|
345
345
|
description: string;
|
|
346
346
|
version: string;
|
|
@@ -464,13 +464,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
464
464
|
peerProfiles: boolean;
|
|
465
465
|
}>;
|
|
466
466
|
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
schemaVersion: string;
|
|
467
468
|
includes: {
|
|
468
469
|
procedural: boolean;
|
|
469
470
|
taxonomy: boolean;
|
|
470
471
|
identityAnchors: boolean;
|
|
471
472
|
peerProfiles: boolean;
|
|
472
473
|
};
|
|
473
|
-
schemaVersion: string;
|
|
474
474
|
id: string;
|
|
475
475
|
description: string;
|
|
476
476
|
version: string;
|
|
@@ -485,13 +485,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
485
485
|
directAnswerEnabled: boolean;
|
|
486
486
|
};
|
|
487
487
|
}, {
|
|
488
|
+
schemaVersion: string;
|
|
488
489
|
includes: {
|
|
489
490
|
procedural: boolean;
|
|
490
491
|
taxonomy: boolean;
|
|
491
492
|
identityAnchors: boolean;
|
|
492
493
|
peerProfiles: boolean;
|
|
493
494
|
};
|
|
494
|
-
schemaVersion: string;
|
|
495
495
|
id: string;
|
|
496
496
|
description: string;
|
|
497
497
|
version: string;
|
|
@@ -518,13 +518,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
518
518
|
pluginVersion: string;
|
|
519
519
|
includesTranscripts: boolean;
|
|
520
520
|
capsule: {
|
|
521
|
+
schemaVersion: string;
|
|
521
522
|
includes: {
|
|
522
523
|
procedural: boolean;
|
|
523
524
|
taxonomy: boolean;
|
|
524
525
|
identityAnchors: boolean;
|
|
525
526
|
peerProfiles: boolean;
|
|
526
527
|
};
|
|
527
|
-
schemaVersion: string;
|
|
528
528
|
id: string;
|
|
529
529
|
description: string;
|
|
530
530
|
version: string;
|
|
@@ -551,13 +551,13 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
551
551
|
pluginVersion: string;
|
|
552
552
|
includesTranscripts: boolean;
|
|
553
553
|
capsule: {
|
|
554
|
+
schemaVersion: string;
|
|
554
555
|
includes: {
|
|
555
556
|
procedural: boolean;
|
|
556
557
|
taxonomy: boolean;
|
|
557
558
|
identityAnchors: boolean;
|
|
558
559
|
peerProfiles: boolean;
|
|
559
560
|
};
|
|
560
|
-
schemaVersion: string;
|
|
561
561
|
id: string;
|
|
562
562
|
description: string;
|
|
563
563
|
version: string;
|
|
@@ -683,13 +683,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
683
683
|
peerProfiles: boolean;
|
|
684
684
|
}>;
|
|
685
685
|
}, "strip", z.ZodTypeAny, {
|
|
686
|
+
schemaVersion: string;
|
|
686
687
|
includes: {
|
|
687
688
|
procedural: boolean;
|
|
688
689
|
taxonomy: boolean;
|
|
689
690
|
identityAnchors: boolean;
|
|
690
691
|
peerProfiles: boolean;
|
|
691
692
|
};
|
|
692
|
-
schemaVersion: string;
|
|
693
693
|
id: string;
|
|
694
694
|
description: string;
|
|
695
695
|
version: string;
|
|
@@ -704,13 +704,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
704
704
|
directAnswerEnabled: boolean;
|
|
705
705
|
};
|
|
706
706
|
}, {
|
|
707
|
+
schemaVersion: string;
|
|
707
708
|
includes: {
|
|
708
709
|
procedural: boolean;
|
|
709
710
|
taxonomy: boolean;
|
|
710
711
|
identityAnchors: boolean;
|
|
711
712
|
peerProfiles: boolean;
|
|
712
713
|
};
|
|
713
|
-
schemaVersion: string;
|
|
714
714
|
id: string;
|
|
715
715
|
description: string;
|
|
716
716
|
version: string;
|
|
@@ -737,13 +737,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
737
737
|
pluginVersion: string;
|
|
738
738
|
includesTranscripts: boolean;
|
|
739
739
|
capsule: {
|
|
740
|
+
schemaVersion: string;
|
|
740
741
|
includes: {
|
|
741
742
|
procedural: boolean;
|
|
742
743
|
taxonomy: boolean;
|
|
743
744
|
identityAnchors: boolean;
|
|
744
745
|
peerProfiles: boolean;
|
|
745
746
|
};
|
|
746
|
-
schemaVersion: string;
|
|
747
747
|
id: string;
|
|
748
748
|
description: string;
|
|
749
749
|
version: string;
|
|
@@ -770,13 +770,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
770
770
|
pluginVersion: string;
|
|
771
771
|
includesTranscripts: boolean;
|
|
772
772
|
capsule: {
|
|
773
|
+
schemaVersion: string;
|
|
773
774
|
includes: {
|
|
774
775
|
procedural: boolean;
|
|
775
776
|
taxonomy: boolean;
|
|
776
777
|
identityAnchors: boolean;
|
|
777
778
|
peerProfiles: boolean;
|
|
778
779
|
};
|
|
779
|
-
schemaVersion: string;
|
|
780
780
|
id: string;
|
|
781
781
|
description: string;
|
|
782
782
|
version: string;
|
|
@@ -819,13 +819,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
819
819
|
pluginVersion: string;
|
|
820
820
|
includesTranscripts: boolean;
|
|
821
821
|
capsule: {
|
|
822
|
+
schemaVersion: string;
|
|
822
823
|
includes: {
|
|
823
824
|
procedural: boolean;
|
|
824
825
|
taxonomy: boolean;
|
|
825
826
|
identityAnchors: boolean;
|
|
826
827
|
peerProfiles: boolean;
|
|
827
828
|
};
|
|
828
|
-
schemaVersion: string;
|
|
829
829
|
id: string;
|
|
830
830
|
description: string;
|
|
831
831
|
version: string;
|
|
@@ -858,13 +858,13 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
858
858
|
pluginVersion: string;
|
|
859
859
|
includesTranscripts: boolean;
|
|
860
860
|
capsule: {
|
|
861
|
+
schemaVersion: string;
|
|
861
862
|
includes: {
|
|
862
863
|
procedural: boolean;
|
|
863
864
|
taxonomy: boolean;
|
|
864
865
|
identityAnchors: boolean;
|
|
865
866
|
peerProfiles: boolean;
|
|
866
867
|
};
|
|
867
|
-
schemaVersion: string;
|
|
868
868
|
id: string;
|
|
869
869
|
description: string;
|
|
870
870
|
version: string;
|
|
@@ -1095,6 +1095,28 @@ interface PluginConfig {
|
|
|
1095
1095
|
* deployments prefer the older (always-inject) behavior. Default `false`.
|
|
1096
1096
|
*/
|
|
1097
1097
|
temporalExpiredInInjection: boolean;
|
|
1098
|
+
/**
|
|
1099
|
+
* Master gate for the tombstone non-resurrection invariant. When `true`
|
|
1100
|
+
* (default), a fact that matches an active tombstone at the storage
|
|
1101
|
+
* chokepoint is persisted as `status: "pending_review"` + `blockedBy`
|
|
1102
|
+
* instead of becoming active — visible, never a silent drop (rule 34).
|
|
1103
|
+
* When `false`, pre-feature behavior: the chokepoint check is a no-op and
|
|
1104
|
+
* retired facts can resurrect through re-extraction / import / consolidation
|
|
1105
|
+
* / dreams / pattern-reinforcement. Off = rollback safety (rule 30).
|
|
1106
|
+
*/
|
|
1107
|
+
tombstonesEnabled: boolean;
|
|
1108
|
+
/**
|
|
1109
|
+
* Tier-4 semantic tombstone matching (issue #1579). Off by default — ships
|
|
1110
|
+
* dark until MemCorrect (#1584) shows an acceptable false-block rate
|
|
1111
|
+
* (rule 48). When `true`, the tombstone lookup also checks embedding cosine
|
|
1112
|
+
* similarity against tombstoned normalized text.
|
|
1113
|
+
*/
|
|
1114
|
+
tombstonesSemanticMatch: boolean;
|
|
1115
|
+
/**
|
|
1116
|
+
* Cosine threshold for tier-4 semantic tombstone matching. Default `0.9`.
|
|
1117
|
+
* Only consulted when `tombstonesSemanticMatch` is `true`.
|
|
1118
|
+
*/
|
|
1119
|
+
tombstonesSemanticThreshold: number;
|
|
1098
1120
|
/**
|
|
1099
1121
|
* When true, recall checks whether a single validated memory in a
|
|
1100
1122
|
* high-trust taxonomy bucket can answer the query before invoking QMD.
|
|
@@ -2586,6 +2608,17 @@ interface MemoryFrontmatter {
|
|
|
2586
2608
|
lineage?: string[];
|
|
2587
2609
|
/** Memory status: active (default), pending_review, rejected, quarantined, superseded, archived, or forgotten */
|
|
2588
2610
|
status?: MemoryStatus;
|
|
2611
|
+
/**
|
|
2612
|
+
* Tombstone block marker (issue #1579). When a new fact matches an active
|
|
2613
|
+
* tombstone at the storage chokepoint, it is persisted with
|
|
2614
|
+
* `status: "pending_review"` and this field set to the tombstone id — making
|
|
2615
|
+
* the block VISIBLE (rule 34: never a silent drop) rather than silently
|
|
2616
|
+
* discarding the extraction. Approving the memory through the review queue
|
|
2617
|
+
* emits a revocation that re-allows the content.
|
|
2618
|
+
*/
|
|
2619
|
+
blockedBy?: string;
|
|
2620
|
+
/** Which tombstone tier matched (`exact`/`normalized`/`keyed`/`semantic`). */
|
|
2621
|
+
tombstoneBlockTier?: "exact" | "normalized" | "keyed" | "semantic";
|
|
2589
2622
|
/** ID of memory that superseded this one */
|
|
2590
2623
|
supersededBy?: string;
|
|
2591
2624
|
/** Timestamp when superseded */
|
|
@@ -3422,4 +3455,4 @@ interface HourlySummary {
|
|
|
3422
3455
|
generatedAt: string;
|
|
3423
3456
|
}
|
|
3424
3457
|
|
|
3425
|
-
export { type
|
|
3458
|
+
export { type EntityStructuredSection as $, type ActiveRecallChatType as A, type BehaviorSignalEvent as B, type CalendarSource as C, type SecretRef as D, type EntityFile as E, type FaithfulnessFrontmatter as F, type GatewayConfig as G, type HourlySummary as H, type IdentityInjectionMode as I, type AgentAccessAuthToken as J, type CompressionGuidelineOptimizerEventCounts as K, type LiveConnectorsConfig as L, type MemoryCategory as M, type CompressionGuidelineOptimizerActionSummary as N, type CompressionGuidelineOptimizerRuleUpdate as O, type PluginConfig as P, type QmdSearchResult as Q, type RecallTierExplain as R, type SessionObserverBandConfig as S, type TranscriptEntry as T, type MemoryActionType as U, type VerificationState as V, type MemoryActionEvent as W, type CompressionGuidelineOptimizerState as X, type EntityMention as Y, type EntitySchemaDefinition as Z, type EntitySchemaSectionDefinition as _, type ActiveRecallQueryMode as a, type MemoryScope as a$, type ExtractionResult as a0, type ConsolidationResult as a1, type DaySummaryResult as a2, type ContinuityIncidentRecord as a3, type ContinuityIncidentCloseInput as a4, type ContinuityIncidentOpenInput as a5, type ContinuityImprovementLoop as a6, type ContinuityLoopReviewInput as a7, type ContinuityLoopUpsertInput as a8, type ImportanceScore as a9, type DreamsRunResult as aA, type WearableConversation as aB, type WearableSourceSettings as aC, type WearableNativeMemory as aD, type WearableMemoryMode as aE, type WearableSourceConnector as aF, type WearablesConfig as aG, type WearableSyncSummary as aH, type WearableSourceStatus as aI, type WearableDayTranscript as aJ, type WearableCorrectionRule as aK, type CodingContext as aL, type BootstrapOptions as aM, type BootstrapResult as aN, type ConsolidationObservation as aO, type EntityTimelineEntry as aP, type CodingModeConfig as aQ, type WearableCleanupSettings as aR, type WearableDayTranscriptMeta as aS, type BriefingConfig as aT, type BriefingOpenCommitment as aU, type BriefingWindow as aV, type CodexCompatConfig as aW, DEFAULT_RECALL_DISCLOSURE as aX, type ExtractedFact as aY, type MemoryActionEligibilitySource as aZ, type MemoryObservation as a_, type MemoryIntent as aa, type QmdSearchExplain as ab, type MemoryActionEligibilityContext as ac, type MemoryActionPolicyResult as ad, type MemoryLifecycleEventType as ae, type MemoryLifecycleStateSummary as af, type ModelProviderConfig as ag, type NativeKnowledgeConfig as ah, type ProvenanceConfig as ai, type ProvenanceSource as aj, type RetrievalTier as ak, type SignalScanResult as al, type ConversationThread as am, type TopicScore as an, type MemoryLink as ao, type BufferState as ap, type MetaState as aq, type FileHygieneConfig as ar, type EntityRelationship as as, type EntityActivityEntry as at, type AccessTrackingEntry as au, type MemorySummary as av, type ScopeProfileLayerId as aw, type ScopeProfilePromotionTarget as ax, type DreamsStatusResult as ay, type DreamsPhase as az, type ActiveRecallPromptStyle as b, type NativeKnowledgeOpenClawWorkspaceConfig as b$, RECALL_DISCLOSURE_LEVELS as b0, type WearableAuthCheck as b1, type WearableFetchOptions as b2, type WearableFetchPage as b3, type WearableNativeMemoryPage as b4, type WearableTranscriptSegment as b5, isRecallDisclosure as b6, type AgentAccessHttpConfig as b7, type AgentDefaultsConfig as b8, type AgentPersona as b9, type DreamsPhasesConfig as bA, type DreamsRemConfig as bB, type EngramTraceEvent as bC, type ExtractedProcedureStep as bD, type ExtractedQuestion as bE, type ExtractedReasoningTrace as bF, type ExtractedReasoningTraceStep as bG, type ExtractedRelationship as bH, type ExtractionPassSource as bI, type GitHubLiveConnectorConfig as bJ, type GmailLiveConnectorConfig as bK, type GoogleDriveLiveConnectorConfig as bL, type HeartbeatConfig as bM, type HeartbeatDetectionMode as bN, type LlmTraceCallback as bO, type LlmTraceEvent as bP, type MemoryActionOutcome as bQ, type MemoryActionPolicyDecision as bR, type MemoryActionStatus as bS, type MemoryLinkType as bT, type MemoryOsPresetName as bU, type ModelApi as bV, type ModelDefinitionConfig as bW, type ModelProviderAuthMode as bX, type NamespacePolicy as bY, type NativeKnowledgeFolderRuleConfig as bZ, type NativeKnowledgeObsidianVaultConfig as b_, type BehaviorLoopAdjustment as ba, type BehaviorSignalDirection as bb, type BehaviorSignalType as bc, type BriefingCalendarSourceError as bd, type BufferEntryState as be, type CaptureMode as bf, type CodexCliReasoningEffort as bg, type CodexCompactionFlushMode as bh, type CodexConnectorConfig as bi, type CodingKnowledgeConfig as bj, type CompressionGuidelineActivationState as bk, type CompressionGuidelineOptimizerSourceWindow as bl, type ConfidenceTier as bm, type ConsolidationAction as bn, type ConsolidationItem as bo, type ContinuityIncidentState as bp, type ContinuityLoopCadence as bq, type ContinuityLoopStatus as br, type ContradictionScanConfig as bs, type CronConversationRecallMode as bt, type CronRecallMode as bu, type DreamingConfig as bv, type DreamingNarrativePromptStyle as bw, type DreamsDeepSleepConfig as bx, type DreamsLightSleepConfig as by, type DreamsPhaseStatus as bz, type ActiveRecallThinking as c, type NotionLiveConnectorConfig as c0, type PrincipalFromSessionKeyMode as c1, type PrincipalRule as c2, type ProceduralConfig as c3, type QuestionEntry as c4, type ReasoningEffort as c5, type RecallPipelineConfig as c6, type RecallSectionConfig as c7, type RecallTraceEvent as c8, type RelevanceFeedback as c9, SPECULATIVE_TTL_DAYS as ca, type ScopeProfileAutoPromoteConfig as cb, type ScopeProfileConfig as cc, type ScopeProfileTeamProjectConfig as cd, type ScopeTeamConfig as ce, type ScoredEntity as cf, type SemanticChunkingConfigShape as cg, type SignalLevel as ch, type SlotBehaviorConfig as ci, type SlotMismatchMode as cj, type TriggerMode as ck, confidenceTier as cl, type ActiveRecallModelFallbackPolicy as d, type BehaviorLoopPolicyState as e, type AgentPersonaModelConfig as f, type MemoryFile as g, type MemoryStatus as h, type RecallPlanMode as i, type RecallDisclosure as j, type MemoryFrontmatter as k, type MemoryProjectionCurrentState as l, type MemoryLifecycleEvent as m, type BriefingSections as n, type BriefingFollowup as o, type BriefingFocus as p, type CalendarEvent as q, type BriefingActiveThread as r, type BriefingResult as s, type BriefingRecentEntity as t, type BufferTurn as u, type Checkpoint as v, type LifecycleState as w, type PolicyClass as x, type ImportanceLevel as y, type BufferSurpriseEvent as z };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './types-ByK7T3L6.js';
|
|
2
2
|
import './index-DJ9QWMw-.js';
|
|
3
|
-
export {
|
|
3
|
+
export { au as AccessTrackingEntry, A as ActiveRecallChatType, d as ActiveRecallModelFallbackPolicy, b as ActiveRecallPromptStyle, a as ActiveRecallQueryMode, c as ActiveRecallThinking, J as AgentAccessAuthToken, b7 as AgentAccessHttpConfig, b8 as AgentDefaultsConfig, b9 as AgentPersona, f as AgentPersonaModelConfig, ba as BehaviorLoopAdjustment, e as BehaviorLoopPolicyState, bb as BehaviorSignalDirection, B as BehaviorSignalEvent, bc as BehaviorSignalType, aM as BootstrapOptions, aN as BootstrapResult, r as BriefingActiveThread, bd as BriefingCalendarSourceError, aT as BriefingConfig, p as BriefingFocus, o as BriefingFollowup, aU as BriefingOpenCommitment, t as BriefingRecentEntity, s as BriefingResult, n as BriefingSections, aV as BriefingWindow, be as BufferEntryState, ap as BufferState, z as BufferSurpriseEvent, u as BufferTurn, q as CalendarEvent, C as CalendarSource, bf as CaptureMode, v as Checkpoint, bg as CodexCliReasoningEffort, bh as CodexCompactionFlushMode, aW as CodexCompatConfig, bi as CodexConnectorConfig, aL as CodingContext, bj as CodingKnowledgeConfig, aQ as CodingModeConfig, bk as CompressionGuidelineActivationState, N as CompressionGuidelineOptimizerActionSummary, K as CompressionGuidelineOptimizerEventCounts, O as CompressionGuidelineOptimizerRuleUpdate, bl as CompressionGuidelineOptimizerSourceWindow, X as CompressionGuidelineOptimizerState, bm as ConfidenceTier, bn as ConsolidationAction, bo as ConsolidationItem, aO as ConsolidationObservation, a1 as ConsolidationResult, a6 as ContinuityImprovementLoop, a4 as ContinuityIncidentCloseInput, a5 as ContinuityIncidentOpenInput, a3 as ContinuityIncidentRecord, bp as ContinuityIncidentState, bq as ContinuityLoopCadence, a7 as ContinuityLoopReviewInput, br as ContinuityLoopStatus, a8 as ContinuityLoopUpsertInput, bs as ContradictionScanConfig, am as ConversationThread, bt as CronConversationRecallMode, bu as CronRecallMode, aX as DEFAULT_RECALL_DISCLOSURE, a2 as DaySummaryResult, bv as DreamingConfig, bw as DreamingNarrativePromptStyle, bx as DreamsDeepSleepConfig, by as DreamsLightSleepConfig, az as DreamsPhase, bz as DreamsPhaseStatus, bA as DreamsPhasesConfig, bB as DreamsRemConfig, aA as DreamsRunResult, ay as DreamsStatusResult, bC as EngramTraceEvent, at as EntityActivityEntry, E as EntityFile, Y as EntityMention, as as EntityRelationship, Z as EntitySchemaDefinition, _ as EntitySchemaSectionDefinition, $ as EntityStructuredSection, aP as EntityTimelineEntry, aY as ExtractedFact, bD as ExtractedProcedureStep, bE as ExtractedQuestion, bF as ExtractedReasoningTrace, bG as ExtractedReasoningTraceStep, bH as ExtractedRelationship, bI as ExtractionPassSource, a0 as ExtractionResult, F as FaithfulnessFrontmatter, ar as FileHygieneConfig, G as GatewayConfig, bJ as GitHubLiveConnectorConfig, bK as GmailLiveConnectorConfig, bL as GoogleDriveLiveConnectorConfig, bM as HeartbeatConfig, bN as HeartbeatDetectionMode, H as HourlySummary, I as IdentityInjectionMode, y as ImportanceLevel, a9 as ImportanceScore, w as LifecycleState, L as LiveConnectorsConfig, bO as LlmTraceCallback, bP as LlmTraceEvent, ac as MemoryActionEligibilityContext, aZ as MemoryActionEligibilitySource, W as MemoryActionEvent, bQ as MemoryActionOutcome, bR as MemoryActionPolicyDecision, ad as MemoryActionPolicyResult, bS as MemoryActionStatus, U as MemoryActionType, M as MemoryCategory, g as MemoryFile, k as MemoryFrontmatter, aa as MemoryIntent, m as MemoryLifecycleEvent, ae as MemoryLifecycleEventType, af as MemoryLifecycleStateSummary, ao as MemoryLink, bT as MemoryLinkType, a_ as MemoryObservation, bU as MemoryOsPresetName, l as MemoryProjectionCurrentState, a$ as MemoryScope, h as MemoryStatus, av as MemorySummary, aq as MetaState, bV as ModelApi, bW as ModelDefinitionConfig, bX as ModelProviderAuthMode, ag as ModelProviderConfig, bY as NamespacePolicy, ah as NativeKnowledgeConfig, bZ as NativeKnowledgeFolderRuleConfig, b_ as NativeKnowledgeObsidianVaultConfig, b$ as NativeKnowledgeOpenClawWorkspaceConfig, c0 as NotionLiveConnectorConfig, P as PluginConfig, x as PolicyClass, c1 as PrincipalFromSessionKeyMode, c2 as PrincipalRule, c3 as ProceduralConfig, ai as ProvenanceConfig, aj as ProvenanceSource, ab as QmdSearchExplain, Q as QmdSearchResult, c4 as QuestionEntry, b0 as RECALL_DISCLOSURE_LEVELS, c5 as ReasoningEffort, j as RecallDisclosure, c6 as RecallPipelineConfig, i as RecallPlanMode, c7 as RecallSectionConfig, R as RecallTierExplain, c8 as RecallTraceEvent, c9 as RelevanceFeedback, ak as RetrievalTier, ca as SPECULATIVE_TTL_DAYS, cb as ScopeProfileAutoPromoteConfig, cc as ScopeProfileConfig, aw as ScopeProfileLayerId, ax as ScopeProfilePromotionTarget, cd as ScopeProfileTeamProjectConfig, ce as ScopeTeamConfig, cf as ScoredEntity, D as SecretRef, cg as SemanticChunkingConfigShape, S as SessionObserverBandConfig, ch as SignalLevel, al as SignalScanResult, ci as SlotBehaviorConfig, cj as SlotMismatchMode, an as TopicScore, T as TranscriptEntry, ck as TriggerMode, V as VerificationState, cl as confidenceTier, b6 as isRecallDisclosure } from './types-PuiPZ9iE.js';
|
package/dist/types.js
CHANGED
|
@@ -1,284 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MutationSerializer,
|
|
3
|
+
serializeMutations,
|
|
4
|
+
withHeldFileLock
|
|
5
|
+
} from "../chunk-YPR7DOPD.js";
|
|
1
6
|
import "../chunk-PZ5AY32C.js";
|
|
2
|
-
|
|
3
|
-
// src/utils/serialize-mutations.ts
|
|
4
|
-
import { randomUUID } from "crypto";
|
|
5
|
-
import { link, mkdir, open, readFile, rename, stat, unlink, utimes } from "fs/promises";
|
|
6
|
-
import path from "path";
|
|
7
|
-
var MutationSerializer = class {
|
|
8
|
-
chains = /* @__PURE__ */ new Map();
|
|
9
|
-
/**
|
|
10
|
-
* Run `task` strictly after every other task already queued under `key` on
|
|
11
|
-
* this serializer has settled.
|
|
12
|
-
*
|
|
13
|
-
* Rejection recovery (rule #40, mirroring the catalog's `queueCritical`):
|
|
14
|
-
* if a prior task rejects, later tasks STILL RUN, while the rejecting task's
|
|
15
|
-
* error is surfaced to ITS OWN caller. Concretely, the recovered tail is
|
|
16
|
-
* `run.then(noop, noop)` — never a bare `.then(fn)`, which would let one
|
|
17
|
-
* failure kill every queued task behind it.
|
|
18
|
-
*
|
|
19
|
-
* No unbounded growth: when a chain's last task settles and no newer task
|
|
20
|
-
* chained onto it, its entry is deleted (the storage router's
|
|
21
|
-
* `inFlightResolved` marker-then-clear discipline).
|
|
22
|
-
*/
|
|
23
|
-
serialize(key, task) {
|
|
24
|
-
if (typeof key !== "string" || key.length === 0) {
|
|
25
|
-
throw new TypeError("MutationSerializer.serialize: key must be a non-empty string");
|
|
26
|
-
}
|
|
27
|
-
if (typeof task !== "function") {
|
|
28
|
-
throw new TypeError("MutationSerializer.serialize: task must be a function returning a promise");
|
|
29
|
-
}
|
|
30
|
-
let entry = this.chains.get(key);
|
|
31
|
-
if (!entry) {
|
|
32
|
-
entry = { tail: Promise.resolve() };
|
|
33
|
-
this.chains.set(key, entry);
|
|
34
|
-
}
|
|
35
|
-
const run = entry.tail.then(task);
|
|
36
|
-
const recovered = run.then(settleNoop, settleNoop);
|
|
37
|
-
entry.tail = recovered;
|
|
38
|
-
void recovered.then(
|
|
39
|
-
() => {
|
|
40
|
-
if (entry && entry.tail === recovered) {
|
|
41
|
-
this.chains.delete(key);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
() => void 0
|
|
45
|
-
);
|
|
46
|
-
return run;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Test-only: the number of keys with a not-yet-cleaned chain. Used to assert
|
|
50
|
-
* the no-unbounded-growth invariant. Not part of the public contract.
|
|
51
|
-
*/
|
|
52
|
-
pendingKeysForTest() {
|
|
53
|
-
return this.chains.size;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
function settleNoop() {
|
|
57
|
-
}
|
|
58
|
-
var defaultSerializer;
|
|
59
|
-
function serializeMutations(key, task) {
|
|
60
|
-
if (!defaultSerializer) defaultSerializer = new MutationSerializer();
|
|
61
|
-
return defaultSerializer.serialize(key, task);
|
|
62
|
-
}
|
|
63
|
-
var DEFAULT_MAX_WAIT_MS = 5e3;
|
|
64
|
-
var DEFAULT_POLL_MS = 50;
|
|
65
|
-
var MIN_HEARTBEAT_MS = 100;
|
|
66
|
-
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
67
|
-
async function withHeldFileLock(lockPath, opts, task) {
|
|
68
|
-
if (typeof lockPath !== "string" || lockPath.length === 0) {
|
|
69
|
-
throw new TypeError("withHeldFileLock: lockPath must be a non-empty string");
|
|
70
|
-
}
|
|
71
|
-
if (typeof opts?.staleMs !== "number" || !Number.isFinite(opts.staleMs) || opts.staleMs <= 0) {
|
|
72
|
-
throw new TypeError(
|
|
73
|
-
`withHeldFileLock: opts.staleMs must be a positive finite number (valid range: > 0 ms, finite; got ${formatInvalidNumber(opts?.staleMs)}).`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
const maxWaitMs = optionalPositiveMs(opts.maxWaitMs, "maxWaitMs", DEFAULT_MAX_WAIT_MS, MAX_TIMER_DELAY_MS);
|
|
77
|
-
const pollMs = optionalPositiveMs(opts.pollMs, "pollMs", DEFAULT_POLL_MS, MAX_TIMER_DELAY_MS);
|
|
78
|
-
const heartbeatMs = optionalPositiveMs(
|
|
79
|
-
opts.heartbeatMs,
|
|
80
|
-
"heartbeatMs",
|
|
81
|
-
Math.max(MIN_HEARTBEAT_MS, Math.floor(opts.staleMs / 3)),
|
|
82
|
-
MAX_TIMER_DELAY_MS
|
|
83
|
-
);
|
|
84
|
-
if (heartbeatMs >= opts.staleMs) {
|
|
85
|
-
throw new TypeError(
|
|
86
|
-
`withHeldFileLock: heartbeatMs (${heartbeatMs}) must be below staleMs (${opts.staleMs}) (valid range: > 0 and < staleMs ms) so at least one heartbeat lands per stale window.`
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
if (heartbeatMs > MAX_TIMER_DELAY_MS) {
|
|
90
|
-
throw new TypeError(
|
|
91
|
-
`withHeldFileLock: derived heartbeatMs (${heartbeatMs} = floor(staleMs/3)) exceeds Node's setTimeout ceiling (${MAX_TIMER_DELAY_MS} ms). Use an explicit opts.heartbeatMs at or below ${MAX_TIMER_DELAY_MS} ms.`
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
const rawWarn = opts.onLockWarning;
|
|
95
|
-
const warn = (message, err) => {
|
|
96
|
-
if (!rawWarn) return;
|
|
97
|
-
try {
|
|
98
|
-
rawWarn(message, err);
|
|
99
|
-
} catch {
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const ownerId = randomUUID();
|
|
103
|
-
const lockDir = path.dirname(lockPath);
|
|
104
|
-
const held = await acquireLock(lockPath, lockDir, ownerId, opts, maxWaitMs, pollMs);
|
|
105
|
-
if (!held) {
|
|
106
|
-
return task(false);
|
|
107
|
-
}
|
|
108
|
-
const heartbeat = setInterval(() => {
|
|
109
|
-
lockHeldBySelf(held).then((ours) => {
|
|
110
|
-
if (!ours) return;
|
|
111
|
-
return utimes(held.path, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
|
112
|
-
}).catch((err) => {
|
|
113
|
-
warn("withHeldFileLock heartbeat refresh failed", err);
|
|
114
|
-
});
|
|
115
|
-
}, heartbeatMs);
|
|
116
|
-
heartbeat.unref?.();
|
|
117
|
-
try {
|
|
118
|
-
return await task(true);
|
|
119
|
-
} finally {
|
|
120
|
-
clearInterval(heartbeat);
|
|
121
|
-
await releaseLock(held, warn, opts.onAfterReleaseRenameForTest);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function optionalPositiveMs(value, name, fallback, maxMs) {
|
|
125
|
-
if (value === void 0) return fallback;
|
|
126
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
127
|
-
throw new TypeError(
|
|
128
|
-
`withHeldFileLock: opts.${name} must be a positive finite number (valid range: > 0 ms, finite; got ${formatInvalidNumber(value)}). Omit the option to use the default of ${fallback} ms.`
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
if (value > maxMs) {
|
|
132
|
-
throw new TypeError(
|
|
133
|
-
`withHeldFileLock: opts.${name} (${value} ms) exceeds the ${maxMs} ms ceiling (Node's setTimeout clamps larger delays to 1ms, turning a typo into tight polling). Omit the option to use the default of ${fallback} ms.`
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
return value;
|
|
137
|
-
}
|
|
138
|
-
function formatInvalidNumber(value) {
|
|
139
|
-
if (typeof value === "number") {
|
|
140
|
-
if (Number.isNaN(value)) return "NaN";
|
|
141
|
-
if (value === Infinity) return "+Infinity";
|
|
142
|
-
if (value === -Infinity) return "-Infinity";
|
|
143
|
-
return String(value);
|
|
144
|
-
}
|
|
145
|
-
return `${typeof value} ${JSON.stringify(value)}`;
|
|
146
|
-
}
|
|
147
|
-
async function acquireLock(lockPath, lockDir, ownerId, opts, maxWaitMs, pollMs) {
|
|
148
|
-
try {
|
|
149
|
-
await mkdir(lockDir, { recursive: true });
|
|
150
|
-
} catch {
|
|
151
|
-
return void 0;
|
|
152
|
-
}
|
|
153
|
-
const deadline = Date.now() + maxWaitMs;
|
|
154
|
-
for (; ; ) {
|
|
155
|
-
try {
|
|
156
|
-
const handle = await open(lockPath, "wx");
|
|
157
|
-
let wroteMeta = true;
|
|
158
|
-
try {
|
|
159
|
-
await handle.writeFile(`${process.pid} ${ownerId} ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
160
|
-
`, "utf8");
|
|
161
|
-
} catch {
|
|
162
|
-
wroteMeta = false;
|
|
163
|
-
} finally {
|
|
164
|
-
try {
|
|
165
|
-
await handle.close();
|
|
166
|
-
} catch {
|
|
167
|
-
wroteMeta = false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (!wroteMeta) {
|
|
171
|
-
await unlink(lockPath).catch(() => void 0);
|
|
172
|
-
return void 0;
|
|
173
|
-
}
|
|
174
|
-
return { path: lockPath, ownerId };
|
|
175
|
-
} catch (err) {
|
|
176
|
-
if (err?.code !== "EEXIST") {
|
|
177
|
-
return void 0;
|
|
178
|
-
}
|
|
179
|
-
await breakStaleLock(lockPath, opts.staleMs, opts.onBeforeBreakStaleUnlinkForTest);
|
|
180
|
-
if (Date.now() >= deadline) return void 0;
|
|
181
|
-
await sleep(Math.min(pollMs, deadline - Date.now()));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async function breakStaleLock(lockPath, staleMs, onBeforeBreakStaleUnlinkForTest) {
|
|
186
|
-
let staleIdentity;
|
|
187
|
-
try {
|
|
188
|
-
const info = await stat(lockPath);
|
|
189
|
-
if (Date.now() - info.mtimeMs <= staleMs) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
staleIdentity = await readFile(lockPath, "utf8");
|
|
193
|
-
} catch {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (onBeforeBreakStaleUnlinkForTest) {
|
|
197
|
-
await onBeforeBreakStaleUnlinkForTest();
|
|
198
|
-
}
|
|
199
|
-
try {
|
|
200
|
-
const current = await readFile(lockPath, "utf8");
|
|
201
|
-
if (current !== staleIdentity) return;
|
|
202
|
-
const recheck = await stat(lockPath);
|
|
203
|
-
if (Date.now() - recheck.mtimeMs <= staleMs) return;
|
|
204
|
-
const trashPath = `${lockPath}.breaking.${process.pid}.${Date.now()}`;
|
|
205
|
-
await rename(lockPath, trashPath);
|
|
206
|
-
try {
|
|
207
|
-
const moved = await readFile(trashPath, "utf8");
|
|
208
|
-
if (moved !== staleIdentity) {
|
|
209
|
-
try {
|
|
210
|
-
await link(trashPath, lockPath);
|
|
211
|
-
await unlink(trashPath).catch(() => void 0);
|
|
212
|
-
} catch {
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
const movedStat = await stat(trashPath);
|
|
216
|
-
if (Date.now() - movedStat.mtimeMs <= staleMs) {
|
|
217
|
-
try {
|
|
218
|
-
await link(trashPath, lockPath);
|
|
219
|
-
await unlink(trashPath).catch(() => void 0);
|
|
220
|
-
} catch {
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
await unlink(trashPath).catch(() => void 0);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
} catch {
|
|
227
|
-
await unlink(trashPath).catch(() => void 0);
|
|
228
|
-
}
|
|
229
|
-
} catch {
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
async function releaseLock(held, warn, onAfterReleaseRenameForTest) {
|
|
233
|
-
try {
|
|
234
|
-
let precheck;
|
|
235
|
-
try {
|
|
236
|
-
precheck = await readFile(held.path, "utf8");
|
|
237
|
-
} catch {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
if (!precheck.includes(held.ownerId)) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const trashPath = `${held.path}.releasing.${process.pid}.${Date.now()}`;
|
|
244
|
-
await rename(held.path, trashPath);
|
|
245
|
-
if (onAfterReleaseRenameForTest) {
|
|
246
|
-
await onAfterReleaseRenameForTest();
|
|
247
|
-
}
|
|
248
|
-
try {
|
|
249
|
-
const moved = await readFile(trashPath, "utf8");
|
|
250
|
-
if (moved.includes(held.ownerId)) {
|
|
251
|
-
await unlink(trashPath).catch(() => void 0);
|
|
252
|
-
} else {
|
|
253
|
-
try {
|
|
254
|
-
await link(trashPath, held.path);
|
|
255
|
-
} catch {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
await unlink(trashPath).catch(() => void 0);
|
|
259
|
-
}
|
|
260
|
-
} catch {
|
|
261
|
-
await unlink(trashPath).catch(() => void 0);
|
|
262
|
-
}
|
|
263
|
-
} catch (err) {
|
|
264
|
-
warn("withHeldFileLock release failed", err);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async function lockHeldBySelf(held) {
|
|
268
|
-
try {
|
|
269
|
-
const body = await readFile(held.path, "utf8");
|
|
270
|
-
const parts = body.trim().split(/\s+/);
|
|
271
|
-
const fileOwner = parts[1];
|
|
272
|
-
return typeof fileOwner === "string" && fileOwner === held.ownerId;
|
|
273
|
-
} catch {
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
function sleep(ms) {
|
|
278
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
279
|
-
setTimeout(resolve, ms);
|
|
280
|
-
return promise;
|
|
281
|
-
}
|
|
282
7
|
export {
|
|
283
8
|
MutationSerializer,
|
|
284
9
|
serializeMutations,
|