@remnic/core 9.47.1 → 9.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.d.ts +6 -5
- package/dist/access-admin-ops-surface.js +27 -25
- package/dist/access-audit.js +2 -2
- package/dist/access-authorization-probe.d.ts +6 -5
- package/dist/access-authorization-probe.js +28 -26
- package/dist/access-boundary.d.ts +6 -5
- package/dist/access-boundary.js +27 -25
- package/dist/access-cli.js +87 -85
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.d.ts +6 -5
- package/dist/access-extraction-force-flush.js +27 -25
- package/dist/access-http-lcm-compaction.d.ts +6 -5
- package/dist/access-http-lifecycle-flush.d.ts +6 -5
- package/dist/access-http-offline-stream.d.ts +6 -5
- package/dist/access-http-query.js +27 -25
- package/dist/access-http.d.ts +6 -5
- package/dist/access-http.js +36 -34
- package/dist/access-identity-continuity-surface.d.ts +5 -4
- package/dist/access-identity-continuity-surface.js +27 -25
- package/dist/access-lcm-surface.d.ts +6 -5
- package/dist/access-lcm-surface.js +27 -25
- package/dist/access-mcp.d.ts +6 -5
- package/dist/access-mcp.js +32 -30
- package/dist/access-namespace-preflight.js +27 -25
- package/dist/access-observe-write-surface.d.ts +6 -5
- package/dist/access-observe-write-surface.js +27 -25
- package/dist/access-offline-manifest.d.ts +5 -4
- package/dist/access-offline-manifest.js +4 -4
- package/dist/access-operations-batch.js +29 -27
- package/dist/access-operations.d.ts +6 -5
- package/dist/access-operations.js +31 -29
- package/dist/access-recall-concurrency.d.ts +6 -5
- package/dist/access-recall-concurrency.js +27 -25
- package/dist/access-recall-response.d.ts +6 -5
- package/dist/access-recall-response.js +27 -25
- package/dist/access-recall-surface.d.ts +11 -10
- package/dist/access-recall-surface.js +27 -25
- package/dist/access-schema.d.ts +2 -2
- package/dist/{access-service-DNBYHK33.d.ts → access-service-andNjwfD.d.ts} +3 -3
- package/dist/access-service-helpers.d.ts +6 -5
- package/dist/access-service.d.ts +10 -9
- package/dist/access-service.js +27 -25
- package/dist/access-surface-catalog.d.ts +6 -5
- package/dist/access-wearables-meetings-surface.d.ts +3 -2
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/artifact-search.d.ts +37 -0
- package/dist/artifact-search.js +13 -0
- package/dist/artifact-search.js.map +1 -0
- package/dist/bootstrap.d.ts +5 -4
- package/dist/briefing.d.ts +2 -1
- package/dist/briefing.js +10 -7
- package/dist/buffer.d.ts +2 -1
- package/dist/buffer.js +4 -4
- package/dist/causal-consolidation.js +11 -8
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-T6JRMVOV.js → chunk-2EJNXE53.js} +2 -2
- package/dist/{chunk-SIP5DBDN.js → chunk-2P3GQVM2.js} +152 -130
- package/dist/chunk-2P3GQVM2.js.map +1 -0
- package/dist/{chunk-64BHFFKZ.js → chunk-2RPJ4NEE.js} +2 -2
- package/dist/{chunk-JFO5QZ7N.js → chunk-3JUYWPFJ.js} +2 -2
- package/dist/{chunk-L7G72WY4.js → chunk-3NDN5P55.js} +2 -2
- package/dist/{chunk-IXH2U2QT.js → chunk-45OTV7FZ.js} +19 -19
- package/dist/chunk-4O4TKIXQ.js +171 -0
- package/dist/chunk-4O4TKIXQ.js.map +1 -0
- package/dist/{chunk-BDNL34CT.js → chunk-4WBGZYZZ.js} +33 -8
- package/dist/chunk-4WBGZYZZ.js.map +1 -0
- package/dist/{chunk-U6JGQ37L.js → chunk-52I3YZZ6.js} +3 -3
- package/dist/{chunk-IZQ5TDFT.js → chunk-53AJILXF.js} +3 -3
- package/dist/chunk-5AUY5Z5E.js +34 -0
- package/dist/chunk-5AUY5Z5E.js.map +1 -0
- package/dist/{chunk-YWCOJOUI.js → chunk-5L7PTX2Q.js} +2 -2
- package/dist/{chunk-ELIL2A37.js → chunk-7FGL6CGA.js} +5 -5
- package/dist/{chunk-TVVEYCNW.js → chunk-7K5Q6COX.js} +4 -4
- package/dist/{chunk-HXXTXLKA.js → chunk-A2TFK5PG.js} +2 -2
- package/dist/{chunk-LI7OE7G6.js → chunk-ANCC3JJH.js} +2 -2
- package/dist/{chunk-ILBLZ5Y5.js → chunk-D5NGH2EW.js} +2 -2
- package/dist/{chunk-ST5IEK3H.js → chunk-DUEEQCTT.js} +2 -2
- package/dist/{chunk-QISYTKG4.js → chunk-EZNXW27Q.js} +6 -6
- package/dist/{chunk-47J4EDGR.js → chunk-FJ2ND6CZ.js} +2 -2
- package/dist/{chunk-FQU3HTQM.js → chunk-FMCHFSZF.js} +6 -6
- package/dist/{chunk-FULKGK7P.js → chunk-G2RBWVFQ.js} +2 -2
- package/dist/{chunk-W2ZSNIBP.js → chunk-GD7UPIBG.js} +2 -2
- package/dist/{chunk-Z54EM5YZ.js → chunk-GF22HWS2.js} +4 -4
- package/dist/{chunk-ZDAYWJV6.js → chunk-GVX3NAUU.js} +2 -2
- package/dist/{chunk-M2INOSTA.js → chunk-GWHPQOUC.js} +2 -2
- package/dist/{chunk-N5XULCU3.js → chunk-HIDEBEAN.js} +9 -9
- package/dist/{chunk-74HN5QUH.js → chunk-HRMEYQRO.js} +2 -2
- package/dist/{chunk-VFZS2HAA.js → chunk-IP3DHDU2.js} +2 -2
- package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
- package/dist/{chunk-PFJXPOD4.js → chunk-JYPO7L3G.js} +2 -2
- package/dist/{chunk-G2L5IZV4.js → chunk-KSGEGHYA.js} +44 -44
- package/dist/{chunk-PKCLQ7KM.js → chunk-LZGCJSQR.js} +5 -5
- package/dist/{chunk-WOC6DXP5.js → chunk-M4DMO67I.js} +4 -4
- package/dist/{chunk-JCNJIXZN.js → chunk-NXUJRXSF.js} +2 -2
- package/dist/{chunk-5VQPZ4GV.js → chunk-PELT6ADC.js} +3 -3
- package/dist/{chunk-IDE5AR5W.js → chunk-PLCZD3LG.js} +28 -66
- package/dist/chunk-PLCZD3LG.js.map +1 -0
- package/dist/{chunk-KMWYZTIE.js → chunk-PRVJH7CY.js} +2 -2
- package/dist/{chunk-RVO6TCTU.js → chunk-QCECHYZL.js} +6 -6
- package/dist/{chunk-KA47C7BF.js → chunk-RSPSHRZA.js} +2 -2
- package/dist/{chunk-E4FOAENZ.js → chunk-S55OAS5P.js} +5 -5
- package/dist/{chunk-BIPBQQFI.js → chunk-UMOO7IY7.js} +2 -2
- package/dist/{chunk-5U7ID3EZ.js → chunk-UTVZKHJK.js} +2 -2
- package/dist/{chunk-V5FE3UAI.js → chunk-WOEVJKKQ.js} +2 -2
- package/dist/{chunk-N3LL5NEU.js → chunk-WQIHRA5F.js} +2 -2
- package/dist/chunk-Z7L72ZHL.js +75 -0
- package/dist/chunk-Z7L72ZHL.js.map +1 -0
- package/dist/{cli-BWXSPxB9.d.ts → cli-p_WmVo2h.d.ts} +3 -3
- package/dist/cli.d.ts +7 -6
- package/dist/cli.js +55 -53
- package/dist/compounding/engine.d.ts +2 -1
- package/dist/compounding/engine.js +10 -7
- package/dist/connectors/codex-materialize-runner.js +10 -7
- package/dist/connectors/index.js +10 -7
- package/dist/consolidation-provenance-check.d.ts +2 -1
- package/dist/consolidation-undo.d.ts +2 -1
- package/dist/contradiction/index.d.ts +7 -6
- package/dist/convergence-refresh.d.ts +2 -1
- package/dist/convergence-refresh.js +12 -9
- package/dist/corpus-watermark.js +15 -13
- package/dist/entity-recall-cancellation.d.ts +36 -0
- package/dist/entity-recall-cancellation.js +19 -0
- package/dist/entity-recall-cancellation.js.map +1 -0
- package/dist/entity-retrieval.d.ts +14 -6
- package/dist/entity-retrieval.js +11 -7
- package/dist/explicit-capture.d.ts +5 -4
- package/dist/external-wiki-access.d.ts +6 -5
- package/dist/external-wiki-access.js +28 -26
- package/dist/external-wiki-mcp-tools.d.ts +6 -5
- package/dist/extraction.js +15 -13
- package/dist/index.d.ts +11 -10
- package/dist/index.js +114 -112
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +7 -7
- package/dist/maintenance/memory-governance.js +10 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +7 -6
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -7
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -1
- package/dist/maintenance/rebuild-memory-projection.js +11 -8
- package/dist/{maintenance-DQrL93Uu.d.ts → maintenance-BfcuwfJS.d.ts} +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +6 -5
- package/dist/memory-worth-outcomes.d.ts +2 -1
- package/dist/namespaces/migrate.d.ts +2 -1
- package/dist/namespaces/migrate.js +14 -12
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.d.ts +7 -6
- package/dist/namespaces/storage.js +10 -7
- package/dist/offline-sync-impression-drain.js +3 -3
- package/dist/operator-doctor-corpus.js +16 -14
- package/dist/operator-toolkit.d.ts +2 -1
- package/dist/operator-toolkit.js +20 -18
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -1
- package/dist/orchestration/maintenance.d.ts +3 -2
- package/dist/orchestration/maintenance.js +14 -12
- package/dist/{orchestrator-CRR-6sVB.d.ts → orchestrator-B7nLo4z1.d.ts} +3 -3
- package/dist/orchestrator.d.ts +5 -4
- package/dist/orchestrator.js +89 -87
- package/dist/qmd.js +4 -4
- package/dist/recall-qos.d.ts +109 -2
- package/dist/recall-qos.js +12 -3
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/semantic-consolidation.js +11 -8
- package/dist/semantic-rule-promotion.js +10 -7
- package/dist/semantic-rule-verifier.js +10 -7
- package/dist/{service-DJ0LDyuN.d.ts → service-B5W5IYCx.d.ts} +1 -1
- package/dist/source-agent-qualifier.js +13 -11
- package/dist/{storage-y340tYKb.d.ts → storage-COL907QF.d.ts} +2 -1
- package/dist/storage.d.ts +2 -1
- package/dist/storage.js +9 -6
- package/dist/temporal-supersession.d.ts +2 -1
- package/dist/tier-migration.d.ts +2 -1
- package/dist/verified-recall.js +10 -7
- package/package.json +2 -2
- package/src/artifact-search.test.ts +110 -0
- package/src/artifact-search.ts +115 -0
- package/src/entity-recall-cancellation.ts +58 -0
- package/src/entity-retrieval.ts +58 -4
- package/src/orchestration/namespace-read-fanout.ts +4 -1
- package/src/orchestration/recall-internal-deps.ts +2 -0
- package/src/orchestration/recall-internal.ts +76 -55
- package/src/orchestration/recall-search-pipeline.ts +9 -1
- package/src/orchestration/recall-search-prefilter.ts +18 -1
- package/src/orchestrator.ts +5 -6
- package/src/recall-qos.test.ts +289 -0
- package/src/recall-qos.ts +238 -1
- package/src/storage.ts +12 -56
- package/dist/chunk-BDNL34CT.js.map +0 -1
- package/dist/chunk-C3AKM55W.js +0 -59
- package/dist/chunk-C3AKM55W.js.map +0 -1
- package/dist/chunk-IDE5AR5W.js.map +0 -1
- package/dist/chunk-SIP5DBDN.js.map +0 -1
- /package/dist/{chunk-T6JRMVOV.js.map → chunk-2EJNXE53.js.map} +0 -0
- /package/dist/{chunk-64BHFFKZ.js.map → chunk-2RPJ4NEE.js.map} +0 -0
- /package/dist/{chunk-JFO5QZ7N.js.map → chunk-3JUYWPFJ.js.map} +0 -0
- /package/dist/{chunk-L7G72WY4.js.map → chunk-3NDN5P55.js.map} +0 -0
- /package/dist/{chunk-IXH2U2QT.js.map → chunk-45OTV7FZ.js.map} +0 -0
- /package/dist/{chunk-U6JGQ37L.js.map → chunk-52I3YZZ6.js.map} +0 -0
- /package/dist/{chunk-IZQ5TDFT.js.map → chunk-53AJILXF.js.map} +0 -0
- /package/dist/{chunk-YWCOJOUI.js.map → chunk-5L7PTX2Q.js.map} +0 -0
- /package/dist/{chunk-ELIL2A37.js.map → chunk-7FGL6CGA.js.map} +0 -0
- /package/dist/{chunk-TVVEYCNW.js.map → chunk-7K5Q6COX.js.map} +0 -0
- /package/dist/{chunk-HXXTXLKA.js.map → chunk-A2TFK5PG.js.map} +0 -0
- /package/dist/{chunk-LI7OE7G6.js.map → chunk-ANCC3JJH.js.map} +0 -0
- /package/dist/{chunk-ILBLZ5Y5.js.map → chunk-D5NGH2EW.js.map} +0 -0
- /package/dist/{chunk-ST5IEK3H.js.map → chunk-DUEEQCTT.js.map} +0 -0
- /package/dist/{chunk-QISYTKG4.js.map → chunk-EZNXW27Q.js.map} +0 -0
- /package/dist/{chunk-47J4EDGR.js.map → chunk-FJ2ND6CZ.js.map} +0 -0
- /package/dist/{chunk-FQU3HTQM.js.map → chunk-FMCHFSZF.js.map} +0 -0
- /package/dist/{chunk-FULKGK7P.js.map → chunk-G2RBWVFQ.js.map} +0 -0
- /package/dist/{chunk-W2ZSNIBP.js.map → chunk-GD7UPIBG.js.map} +0 -0
- /package/dist/{chunk-Z54EM5YZ.js.map → chunk-GF22HWS2.js.map} +0 -0
- /package/dist/{chunk-ZDAYWJV6.js.map → chunk-GVX3NAUU.js.map} +0 -0
- /package/dist/{chunk-M2INOSTA.js.map → chunk-GWHPQOUC.js.map} +0 -0
- /package/dist/{chunk-N5XULCU3.js.map → chunk-HIDEBEAN.js.map} +0 -0
- /package/dist/{chunk-74HN5QUH.js.map → chunk-HRMEYQRO.js.map} +0 -0
- /package/dist/{chunk-VFZS2HAA.js.map → chunk-IP3DHDU2.js.map} +0 -0
- /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
- /package/dist/{chunk-PFJXPOD4.js.map → chunk-JYPO7L3G.js.map} +0 -0
- /package/dist/{chunk-G2L5IZV4.js.map → chunk-KSGEGHYA.js.map} +0 -0
- /package/dist/{chunk-PKCLQ7KM.js.map → chunk-LZGCJSQR.js.map} +0 -0
- /package/dist/{chunk-WOC6DXP5.js.map → chunk-M4DMO67I.js.map} +0 -0
- /package/dist/{chunk-JCNJIXZN.js.map → chunk-NXUJRXSF.js.map} +0 -0
- /package/dist/{chunk-5VQPZ4GV.js.map → chunk-PELT6ADC.js.map} +0 -0
- /package/dist/{chunk-KMWYZTIE.js.map → chunk-PRVJH7CY.js.map} +0 -0
- /package/dist/{chunk-RVO6TCTU.js.map → chunk-QCECHYZL.js.map} +0 -0
- /package/dist/{chunk-KA47C7BF.js.map → chunk-RSPSHRZA.js.map} +0 -0
- /package/dist/{chunk-E4FOAENZ.js.map → chunk-S55OAS5P.js.map} +0 -0
- /package/dist/{chunk-BIPBQQFI.js.map → chunk-UMOO7IY7.js.map} +0 -0
- /package/dist/{chunk-5U7ID3EZ.js.map → chunk-UTVZKHJK.js.map} +0 -0
- /package/dist/{chunk-V5FE3UAI.js.map → chunk-WOEVJKKQ.js.map} +0 -0
- /package/dist/{chunk-N3LL5NEU.js.map → chunk-WQIHRA5F.js.map} +0 -0
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-H3FZVNRN.js";
|
|
14
14
|
import {
|
|
15
15
|
ExtractionDeadlineError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WQIHRA5F.js";
|
|
17
17
|
import {
|
|
18
18
|
resolvePrincipal
|
|
19
19
|
} from "./chunk-3GD2HFR6.js";
|
|
@@ -792,4 +792,4 @@ var SmartBuffer = class {
|
|
|
792
792
|
export {
|
|
793
793
|
SmartBuffer
|
|
794
794
|
};
|
|
795
|
-
//# sourceMappingURL=chunk-
|
|
795
|
+
//# sourceMappingURL=chunk-2RPJ4NEE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryProjection
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M4DMO67I.js";
|
|
4
4
|
|
|
5
5
|
// src/convergence-refresh.ts
|
|
6
6
|
async function refreshConvergedNamespaces(namespaces, namespaceSearchRouter, getStorage, searchEnabled) {
|
|
@@ -32,4 +32,4 @@ async function refreshConvergedNamespaces(namespaces, namespaceSearchRouter, get
|
|
|
32
32
|
export {
|
|
33
33
|
refreshConvergedNamespaces
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-3JUYWPFJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PLCZD3LG.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeEntityName
|
|
6
6
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -958,4 +958,4 @@ export {
|
|
|
958
958
|
resolveBriefingSaveDir,
|
|
959
959
|
briefingFilename
|
|
960
960
|
};
|
|
961
|
-
//# sourceMappingURL=chunk-
|
|
961
|
+
//# sourceMappingURL=chunk-3NDN5P55.js.map
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
} from "./chunk-P2OTGMTR.js";
|
|
46
46
|
import {
|
|
47
47
|
readAggregateExtractionWatermark
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-RSPSHRZA.js";
|
|
49
49
|
import {
|
|
50
50
|
ReplicaDivergenceMonitor
|
|
51
51
|
} from "./chunk-CVILPI77.js";
|
|
@@ -61,9 +61,6 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
buildGraphSnapshot
|
|
63
63
|
} from "./chunk-JYIFGGEM.js";
|
|
64
|
-
import {
|
|
65
|
-
REDACTION_RULES_SUBDIR
|
|
66
|
-
} from "./chunk-LTHVM4XN.js";
|
|
67
64
|
import {
|
|
68
65
|
wrapWorkLayerContext
|
|
69
66
|
} from "./chunk-EI6V5UXY.js";
|
|
@@ -80,6 +77,9 @@ import {
|
|
|
80
77
|
buildProcedurePersistBody,
|
|
81
78
|
normalizeProcedureSteps
|
|
82
79
|
} from "./chunk-QDW3E4RD.js";
|
|
80
|
+
import {
|
|
81
|
+
REDACTION_RULES_SUBDIR
|
|
82
|
+
} from "./chunk-LTHVM4XN.js";
|
|
83
83
|
import {
|
|
84
84
|
persistExplicitCapture,
|
|
85
85
|
queueExplicitCaptureForReview,
|
|
@@ -88,6 +88,13 @@ import {
|
|
|
88
88
|
import {
|
|
89
89
|
lcmEvidenceIdentity
|
|
90
90
|
} from "./chunk-C37ZRXX7.js";
|
|
91
|
+
import {
|
|
92
|
+
CorpusWatermarkCache,
|
|
93
|
+
computeServiceCorpusCensus
|
|
94
|
+
} from "./chunk-JYPO7L3G.js";
|
|
95
|
+
import {
|
|
96
|
+
namespaceCollectionName
|
|
97
|
+
} from "./chunk-PRVJH7CY.js";
|
|
91
98
|
import {
|
|
92
99
|
CrossNamespaceBudget,
|
|
93
100
|
toBudgetWarning
|
|
@@ -99,14 +106,7 @@ import {
|
|
|
99
106
|
listMemoryGovernanceRuns,
|
|
100
107
|
readMemoryGovernanceRunArtifact,
|
|
101
108
|
runMemoryGovernance
|
|
102
|
-
} from "./chunk-
|
|
103
|
-
import {
|
|
104
|
-
CorpusWatermarkCache,
|
|
105
|
-
computeServiceCorpusCensus
|
|
106
|
-
} from "./chunk-PFJXPOD4.js";
|
|
107
|
-
import {
|
|
108
|
-
namespaceCollectionName
|
|
109
|
-
} from "./chunk-KMWYZTIE.js";
|
|
109
|
+
} from "./chunk-WOEVJKKQ.js";
|
|
110
110
|
import {
|
|
111
111
|
defaultCapsulesDir
|
|
112
112
|
} from "./chunk-ZY2MNJR6.js";
|
|
@@ -120,14 +120,14 @@ import {
|
|
|
120
120
|
enqueuePassiveCorrectionNotification,
|
|
121
121
|
parseBriefingFocus,
|
|
122
122
|
parseBriefingWindow
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-3NDN5P55.js";
|
|
124
124
|
import {
|
|
125
125
|
parseEntityFile,
|
|
126
126
|
parseFrontmatter,
|
|
127
127
|
qmdCollectionPathParts,
|
|
128
128
|
qmdResultPathCandidates,
|
|
129
129
|
selfDeps
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-PLCZD3LG.js";
|
|
131
131
|
import {
|
|
132
132
|
DEFAULT_RECALL_DISCLOSURE,
|
|
133
133
|
isRecallDisclosure
|
|
@@ -162,7 +162,7 @@ import {
|
|
|
162
162
|
isActivityDigestPath,
|
|
163
163
|
isArtifactMemoryPath,
|
|
164
164
|
isMeetingRecordPath
|
|
165
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-WQIHRA5F.js";
|
|
166
166
|
import {
|
|
167
167
|
ExtractionLivenessWarnThrottle,
|
|
168
168
|
computeExtractionLivenessStatus
|
|
@@ -208,10 +208,10 @@ import {
|
|
|
208
208
|
} from "./chunk-LNEWDF2A.js";
|
|
209
209
|
import {
|
|
210
210
|
createOfflineSyncManifestStream
|
|
211
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-UMOO7IY7.js";
|
|
212
212
|
import {
|
|
213
213
|
offlineSyncStorageForSnapshot
|
|
214
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-UTVZKHJK.js";
|
|
215
215
|
import {
|
|
216
216
|
resolveScopePlan,
|
|
217
217
|
resolveScopedWritableNamespaceValue,
|
|
@@ -317,7 +317,7 @@ import {
|
|
|
317
317
|
} from "./chunk-BTTPKDIL.js";
|
|
318
318
|
import {
|
|
319
319
|
AccessAuditAdapter
|
|
320
|
-
} from "./chunk-
|
|
320
|
+
} from "./chunk-7K5Q6COX.js";
|
|
321
321
|
import {
|
|
322
322
|
decodeCitationNamespace
|
|
323
323
|
} from "./chunk-JIYDRBVZ.js";
|
|
@@ -13523,4 +13523,4 @@ export {
|
|
|
13523
13523
|
EngramAccessService,
|
|
13524
13524
|
AccessAdminOpsSurface
|
|
13525
13525
|
};
|
|
13526
|
-
//# sourceMappingURL=chunk-
|
|
13526
|
+
//# sourceMappingURL=chunk-45OTV7FZ.js.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
abortError,
|
|
3
|
+
isAbortError
|
|
4
|
+
} from "./chunk-BTTPKDIL.js";
|
|
5
|
+
import {
|
|
6
|
+
log
|
|
7
|
+
} from "./chunk-3WCASNQZ.js";
|
|
8
|
+
|
|
9
|
+
// src/recall-qos.ts
|
|
10
|
+
function yieldToEventLoop() {
|
|
11
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
12
|
+
setImmediate(resolve);
|
|
13
|
+
return promise;
|
|
14
|
+
}
|
|
15
|
+
function defaultTiming(metric) {
|
|
16
|
+
if (typeof metric.timing === "string" && metric.timing.length > 0) {
|
|
17
|
+
return metric.timing;
|
|
18
|
+
}
|
|
19
|
+
if (metric.source === "timeout") {
|
|
20
|
+
return `timeout(${Math.max(0, Math.round(metric.durationMs))}ms)`;
|
|
21
|
+
}
|
|
22
|
+
if (metric.source === "skip") {
|
|
23
|
+
return "skip";
|
|
24
|
+
}
|
|
25
|
+
return `${Math.max(0, Math.round(metric.durationMs))}ms`;
|
|
26
|
+
}
|
|
27
|
+
function formatRecallSectionMetric(metric) {
|
|
28
|
+
const payload = {
|
|
29
|
+
section: metric.section,
|
|
30
|
+
priority: metric.priority,
|
|
31
|
+
durationMs: metric.durationMs,
|
|
32
|
+
deadlineMs: metric.deadlineMs,
|
|
33
|
+
source: metric.source,
|
|
34
|
+
success: metric.success
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
message: "recall section metric",
|
|
38
|
+
payload,
|
|
39
|
+
level: metric.priority === "core" && metric.success && metric.source !== "skip" ? "info" : "debug",
|
|
40
|
+
timing: defaultTiming(metric)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function createRecallSectionMetricRecorder(options = {}) {
|
|
44
|
+
const logger = options.logger ?? log;
|
|
45
|
+
return (metric) => {
|
|
46
|
+
const entry = formatRecallSectionMetric(metric);
|
|
47
|
+
if (options.timings) {
|
|
48
|
+
options.timings[metric.section] = entry.timing;
|
|
49
|
+
}
|
|
50
|
+
if (entry.level === "info") {
|
|
51
|
+
if (typeof logger.info === "function") {
|
|
52
|
+
logger.info(entry.message, entry.payload);
|
|
53
|
+
} else {
|
|
54
|
+
log.info(entry.message, entry.payload);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (typeof logger.debug === "function") {
|
|
58
|
+
logger.debug(entry.message, entry.payload);
|
|
59
|
+
} else {
|
|
60
|
+
log.debug(entry.message, entry.payload);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return entry;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var CORE_SECTION_MAX_SHARE_OF_REQUEST = 0.8;
|
|
67
|
+
function resolveRecallCoreSectionDeadlineMs(options) {
|
|
68
|
+
const configured = options.configuredCoreDeadlineMs;
|
|
69
|
+
if (!Number.isFinite(configured) || configured <= 0) return configured;
|
|
70
|
+
const remaining = options.remainingOuterMs;
|
|
71
|
+
if (remaining === null || !Number.isFinite(remaining)) return configured;
|
|
72
|
+
if (remaining <= 0) return 1;
|
|
73
|
+
return Math.min(
|
|
74
|
+
configured,
|
|
75
|
+
Math.max(1, Math.floor(remaining * CORE_SECTION_MAX_SHARE_OF_REQUEST))
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
async function runRecallSectionWithinDeadline(options) {
|
|
79
|
+
const now = options.now ?? Date.now;
|
|
80
|
+
const startedAtMs = now();
|
|
81
|
+
const controller = new AbortController();
|
|
82
|
+
const parentSignal = options.parentSignal;
|
|
83
|
+
const onParentAbort = () => controller.abort();
|
|
84
|
+
if (parentSignal?.aborted) {
|
|
85
|
+
controller.abort();
|
|
86
|
+
} else if (parentSignal) {
|
|
87
|
+
parentSignal.addEventListener("abort", onParentAbort, { once: true });
|
|
88
|
+
}
|
|
89
|
+
const bounded = Number.isFinite(options.deadlineMs) && options.deadlineMs > 0;
|
|
90
|
+
let timer;
|
|
91
|
+
try {
|
|
92
|
+
const work = options.run(controller.signal).then(
|
|
93
|
+
(value) => ({ kind: "value", value })
|
|
94
|
+
);
|
|
95
|
+
if (!bounded) {
|
|
96
|
+
const settled2 = await work;
|
|
97
|
+
return { value: settled2.value, timedOut: false, durationMs: now() - startedAtMs };
|
|
98
|
+
}
|
|
99
|
+
const deadline = Promise.withResolvers();
|
|
100
|
+
timer = setTimeout(() => deadline.resolve({ kind: "timeout" }), options.deadlineMs);
|
|
101
|
+
const settled = await Promise.race([work, deadline.promise]);
|
|
102
|
+
if (settled.kind === "timeout") {
|
|
103
|
+
controller.abort(abortError("recall section deadline exceeded"));
|
|
104
|
+
void work.catch(() => {
|
|
105
|
+
});
|
|
106
|
+
return { value: options.fallback, timedOut: true, durationMs: now() - startedAtMs };
|
|
107
|
+
}
|
|
108
|
+
return { value: settled.value, timedOut: false, durationMs: now() - startedAtMs };
|
|
109
|
+
} finally {
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
parentSignal?.removeEventListener("abort", onParentAbort);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function createBoundedCoreSectionRunner(options) {
|
|
115
|
+
const logger = options.logger ?? log;
|
|
116
|
+
const now = options.now ?? Date.now;
|
|
117
|
+
return async (section, fallback, run) => {
|
|
118
|
+
const startedAtMs = now();
|
|
119
|
+
const deadlineMs = resolveRecallCoreSectionDeadlineMs({
|
|
120
|
+
configuredCoreDeadlineMs: options.configuredDeadlineMs,
|
|
121
|
+
remainingOuterMs: options.outerDeadlineAtMs === null ? null : options.outerDeadlineAtMs - startedAtMs
|
|
122
|
+
});
|
|
123
|
+
let outcome;
|
|
124
|
+
try {
|
|
125
|
+
outcome = await runRecallSectionWithinDeadline({
|
|
126
|
+
deadlineMs,
|
|
127
|
+
fallback,
|
|
128
|
+
parentSignal: options.parentSignal,
|
|
129
|
+
run,
|
|
130
|
+
now
|
|
131
|
+
});
|
|
132
|
+
} catch (err) {
|
|
133
|
+
if (!isAbortError(err)) throw err;
|
|
134
|
+
const durationMs = now() - startedAtMs;
|
|
135
|
+
options.record({
|
|
136
|
+
section,
|
|
137
|
+
priority: "core",
|
|
138
|
+
durationMs,
|
|
139
|
+
deadlineMs,
|
|
140
|
+
source: "skip",
|
|
141
|
+
success: false,
|
|
142
|
+
timing: `cancelled(${durationMs}ms)`
|
|
143
|
+
});
|
|
144
|
+
return fallback;
|
|
145
|
+
}
|
|
146
|
+
if (outcome.timedOut) {
|
|
147
|
+
logger.warn(
|
|
148
|
+
`recall section [${section}] exceeded its ${deadlineMs}ms core deadline after ${outcome.durationMs}ms; recall continues without it`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
options.record({
|
|
152
|
+
section,
|
|
153
|
+
priority: "core",
|
|
154
|
+
durationMs: outcome.durationMs,
|
|
155
|
+
deadlineMs,
|
|
156
|
+
source: outcome.timedOut ? "timeout" : "fresh",
|
|
157
|
+
success: !outcome.timedOut
|
|
158
|
+
});
|
|
159
|
+
return outcome.value;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
yieldToEventLoop,
|
|
165
|
+
formatRecallSectionMetric,
|
|
166
|
+
createRecallSectionMetricRecorder,
|
|
167
|
+
resolveRecallCoreSectionDeadlineMs,
|
|
168
|
+
runRecallSectionWithinDeadline,
|
|
169
|
+
createBoundedCoreSectionRunner
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=chunk-4O4TKIXQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/recall-qos.ts"],"sourcesContent":["import { abortError, isAbortError } from \"./abort-error.js\";\nimport { log, type LoggerBackend } from \"./logger.js\";\n\n/**\n * Hand the event loop one macrotask.\n *\n * A recall section deadline is a timer, and a timer cannot fire while a\n * synchronous scan holds the loop — so a provider that iterates the whole corpus\n * must call this periodically or its budget is unenforceable (issue #2291).\n * `setImmediate` (check phase) is used rather than a `0ms` timer so the yield\n * cannot be starved by the timer queue it exists to let run.\n */\nexport function yieldToEventLoop(): Promise<void> {\n const { promise, resolve } = Promise.withResolvers<void>();\n setImmediate(resolve);\n return promise;\n}\n\nexport type RecallSectionPriority = \"core\" | \"enrichment\";\n/**\n * `timeout` records a section that started, exceeded its deadline, and was\n * degraded to its neutral value (issue #2291). It is distinct from `skip`\n * (never ran: disabled or zero-limit) so operators can tell a configuration\n * choice from a budget breach in the section metric log.\n */\nexport type RecallSectionSource = \"fresh\" | \"stale\" | \"skip\" | \"timeout\";\n\nexport interface RecallSectionMetric {\n section: string;\n priority: RecallSectionPriority;\n durationMs: number;\n deadlineMs: number;\n source: RecallSectionSource;\n success: boolean;\n timing?: string;\n}\n\nexport interface RecallSectionMetricLog {\n message: string;\n payload: {\n section: string;\n priority: RecallSectionPriority;\n durationMs: number;\n deadlineMs: number;\n source: RecallSectionSource;\n success: boolean;\n };\n level: \"info\" | \"debug\";\n timing: string;\n}\n\nfunction defaultTiming(metric: RecallSectionMetric): string {\n if (typeof metric.timing === \"string\" && metric.timing.length > 0) {\n return metric.timing;\n }\n if (metric.source === \"timeout\") {\n return `timeout(${Math.max(0, Math.round(metric.durationMs))}ms)`;\n }\n if (metric.source === \"skip\") {\n return \"skip\";\n }\n return `${Math.max(0, Math.round(metric.durationMs))}ms`;\n}\n\nexport function formatRecallSectionMetric(metric: RecallSectionMetric): RecallSectionMetricLog {\n const payload = {\n section: metric.section,\n priority: metric.priority,\n durationMs: metric.durationMs,\n deadlineMs: metric.deadlineMs,\n source: metric.source,\n success: metric.success,\n };\n return {\n message: \"recall section metric\",\n payload,\n level: metric.priority === \"core\" && metric.success && metric.source !== \"skip\" ? \"info\" : \"debug\",\n timing: defaultTiming(metric),\n };\n}\n\nexport function createRecallSectionMetricRecorder(options: {\n timings?: Record<string, string>;\n logger?: Pick<LoggerBackend, \"info\" | \"debug\">;\n} = {}) {\n const logger = options.logger ?? log;\n return (metric: RecallSectionMetric): RecallSectionMetricLog => {\n const entry = formatRecallSectionMetric(metric);\n if (options.timings) {\n options.timings[metric.section] = entry.timing;\n }\n if (entry.level === \"info\") {\n if (typeof logger.info === \"function\") {\n logger.info(entry.message, entry.payload);\n } else {\n log.info(entry.message, entry.payload);\n }\n } else {\n if (typeof logger.debug === \"function\") {\n logger.debug(entry.message, entry.payload);\n } else {\n log.debug(entry.message, entry.payload);\n }\n }\n return entry;\n };\n}\n\n/**\n * Fraction of the request's REMAINING budget that a single core section may\n * consume. The remainder is what makes degradation possible at all: time to\n * assemble and return the sections that did arrive before the outer timeout\n * kills the request outright.\n */\nconst CORE_SECTION_MAX_SHARE_OF_REQUEST = 0.8;\n\n/**\n * Effective per-section deadline for optional core recall providers.\n *\n * Two things make the configured value unusable as-is (issue #2291):\n *\n * - `recallCoreDeadlineMs` and `recallOuterTimeoutMs` both default to 75s, so a\n * section budget taken at face value can never fire before the request ceiling\n * that cancels everything — the caller loses the whole recall rather than one\n * section.\n * - Sections start *after* planning, namespace resolution, and mode selection.\n * Capping against the original ceiling would let a section that starts 20s in\n * still be running when the request is aborted, which is the same failure.\n *\n * So the cap is taken against `remainingOuterMs` — the request budget left when\n * the section actually starts. An operator who lowers `recallCoreDeadlineMs`\n * below that still gets exactly what they asked for.\n *\n * `remainingOuterMs === null` means the request is unbounded and there is nothing\n * to reserve headroom against. A non-positive remainder means the request is\n * already over budget, so the section degrades immediately rather than starting\n * work that cannot be delivered.\n */\nexport function resolveRecallCoreSectionDeadlineMs(options: {\n configuredCoreDeadlineMs: number;\n remainingOuterMs: number | null;\n}): number {\n const configured = options.configuredCoreDeadlineMs;\n if (!Number.isFinite(configured) || configured <= 0) return configured;\n const remaining = options.remainingOuterMs;\n if (remaining === null || !Number.isFinite(remaining)) return configured;\n if (remaining <= 0) return 1;\n return Math.min(\n configured,\n Math.max(1, Math.floor(remaining * CORE_SECTION_MAX_SHARE_OF_REQUEST)),\n );\n}\n\nexport interface RecallSectionDeadlineOutcome<T> {\n /** The section's value, or `fallback` when the deadline was exceeded. */\n value: T;\n timedOut: boolean;\n durationMs: number;\n}\n\n/**\n * Run one recall section under a deadline, degrading to `fallback` instead of\n * blocking the phase it belongs to (issue #2291).\n *\n * Before this existed, `deadlineMs` was recorded in the section metric but\n * never enforced for core sections: a provider doing a multi-minute scan on a\n * slow filesystem blocked the whole phase-one `Promise.all`, and kept scanning\n * after the caller aborted. Two guarantees fix that:\n *\n * 1. The returned promise settles within `deadlineMs`, with `timedOut: true`\n * and the caller's neutral value, so one slow optional provider degrades\n * independently rather than holding the response.\n * 2. `run` receives a signal that fires on the deadline AND on the caller's\n * abort, so the section can stop its own work at its next checkpoint.\n *\n * `deadlineMs <= 0` (or non-finite) means unbounded, matching the config\n * contract that a zero budget disables the limit. The section signal is still\n * created and still tracks the parent, so cancellation propagates either way.\n */\nexport async function runRecallSectionWithinDeadline<T>(options: {\n deadlineMs: number;\n fallback: T;\n parentSignal?: AbortSignal;\n run: (sectionSignal: AbortSignal) => Promise<T>;\n now?: () => number;\n}): Promise<RecallSectionDeadlineOutcome<T>> {\n const now = options.now ?? Date.now;\n const startedAtMs = now();\n const controller = new AbortController();\n const parentSignal = options.parentSignal;\n const onParentAbort = () => controller.abort();\n if (parentSignal?.aborted) {\n controller.abort();\n } else if (parentSignal) {\n parentSignal.addEventListener(\"abort\", onParentAbort, { once: true });\n }\n\n const bounded = Number.isFinite(options.deadlineMs) && options.deadlineMs > 0;\n let timer: NodeJS.Timeout | undefined;\n\n try {\n // Wrap in a tagged result rather than racing raw values against a sentinel:\n // T is caller-chosen and must never be mistaken for the timeout marker.\n const work = options.run(controller.signal).then(\n (value) => ({ kind: \"value\" as const, value }),\n );\n if (!bounded) {\n const settled = await work;\n return { value: settled.value, timedOut: false, durationMs: now() - startedAtMs };\n }\n const deadline = Promise.withResolvers<{ kind: \"timeout\" }>();\n // Deliberately NOT unref'd: the caller is awaiting this bound, so the timer\n // must keep the loop alive until it fires or `finally` clears it.\n timer = setTimeout(() => deadline.resolve({ kind: \"timeout\" }), options.deadlineMs);\n const settled = await Promise.race([work, deadline.promise]);\n if (settled.kind === \"timeout\") {\n controller.abort(abortError(\"recall section deadline exceeded\"));\n // The abandoned work outlives this call; swallow its settlement so a\n // late rejection is not reported as unhandled.\n void work.catch(() => {});\n return { value: options.fallback, timedOut: true, durationMs: now() - startedAtMs };\n }\n return { value: settled.value, timedOut: false, durationMs: now() - startedAtMs };\n } finally {\n clearTimeout(timer);\n parentSignal?.removeEventListener(\"abort\", onParentAbort);\n }\n}\n\n/**\n * Runs one *optional* core recall section, bounded and accounted for.\n *\n * Binds a section's deadline, the caller's abort signal, and the QoS recorder\n * once so each provider is one call (issue #2291). A breach degrades the\n * section to `fallback`, warns with the section name and budget, and records the\n * section as `timeout` — so a slow provider costs its own section, not the\n * response.\n *\n * The budget is resolved when each section STARTS, against the request budget\n * still left at that moment (`outerDeadlineAtMs`), not against the original\n * configured ceiling: sections begin after planning and namespace resolution, and\n * a section sized to the full request would otherwise still be running when the\n * request itself is aborted.\n *\n * Cancellation degrades too, and must: the section signal fires on the caller's\n * abort, and the phase this section belongs to is awaited through a race that the\n * caller's abort also wins. A rejection here would therefore land on a promise\n * nobody is awaiting any more — an unhandled rejection rather than a signal. The\n * caller learns of its own abort from that race, not from a section result.\n *\n * Only sections whose absence leaves recall coherent belong here: the fallback\n * IS the degraded contract.\n */\nexport function createBoundedCoreSectionRunner(options: {\n configuredDeadlineMs: number;\n /** Absolute time the whole request is aborted, or null when unbounded. */\n outerDeadlineAtMs: number | null;\n parentSignal?: AbortSignal;\n record: (metric: RecallSectionMetric) => unknown;\n logger?: Pick<LoggerBackend, \"warn\">;\n now?: () => number;\n}): <T>(\n section: string,\n fallback: T,\n run: (sectionSignal: AbortSignal) => Promise<T>,\n) => Promise<T> {\n const logger = options.logger ?? log;\n const now = options.now ?? Date.now;\n return async <T>(\n section: string,\n fallback: T,\n run: (sectionSignal: AbortSignal) => Promise<T>,\n ): Promise<T> => {\n const startedAtMs = now();\n const deadlineMs = resolveRecallCoreSectionDeadlineMs({\n configuredCoreDeadlineMs: options.configuredDeadlineMs,\n remainingOuterMs:\n options.outerDeadlineAtMs === null ? null : options.outerDeadlineAtMs - startedAtMs,\n });\n let outcome: RecallSectionDeadlineOutcome<T>;\n try {\n outcome = await runRecallSectionWithinDeadline({\n deadlineMs,\n fallback,\n parentSignal: options.parentSignal,\n run,\n now,\n });\n } catch (err) {\n if (!isAbortError(err)) throw err;\n const durationMs = now() - startedAtMs;\n options.record({\n section,\n priority: \"core\",\n durationMs,\n deadlineMs,\n source: \"skip\",\n success: false,\n timing: `cancelled(${durationMs}ms)`,\n });\n return fallback;\n }\n if (outcome.timedOut) {\n logger.warn(\n `recall section [${section}] exceeded its ${deadlineMs}ms core deadline ` +\n `after ${outcome.durationMs}ms; recall continues without it`,\n );\n }\n options.record({\n section,\n priority: \"core\",\n durationMs: outcome.durationMs,\n deadlineMs,\n source: outcome.timedOut ? \"timeout\" : \"fresh\",\n success: !outcome.timedOut,\n });\n return outcome.value;\n };\n}"],"mappings":";;;;;;;;;AAYO,SAAS,mBAAkC;AAChD,QAAM,EAAE,SAAS,QAAQ,IAAI,QAAQ,cAAoB;AACzD,eAAa,OAAO;AACpB,SAAO;AACT;AAmCA,SAAS,cAAc,QAAqC;AAC1D,MAAI,OAAO,OAAO,WAAW,YAAY,OAAO,OAAO,SAAS,GAAG;AACjE,WAAO,OAAO;AAAA,EAChB;AACA,MAAI,OAAO,WAAW,WAAW;AAC/B,WAAO,WAAW,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,UAAU,CAAC,CAAC;AAAA,EAC9D;AACA,MAAI,OAAO,WAAW,QAAQ;AAC5B,WAAO;AAAA,EACT;AACA,SAAO,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,UAAU,CAAC,CAAC;AACtD;AAEO,SAAS,0BAA0B,QAAqD;AAC7F,QAAM,UAAU;AAAA,IACd,SAAS,OAAO;AAAA,IAChB,UAAU,OAAO;AAAA,IACjB,YAAY,OAAO;AAAA,IACnB,YAAY,OAAO;AAAA,IACnB,QAAQ,OAAO;AAAA,IACf,SAAS,OAAO;AAAA,EAClB;AACA,SAAO;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA,OAAO,OAAO,aAAa,UAAU,OAAO,WAAW,OAAO,WAAW,SAAS,SAAS;AAAA,IAC3F,QAAQ,cAAc,MAAM;AAAA,EAC9B;AACF;AAEO,SAAS,kCAAkC,UAG9C,CAAC,GAAG;AACN,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO,CAAC,WAAwD;AAC9D,UAAM,QAAQ,0BAA0B,MAAM;AAC9C,QAAI,QAAQ,SAAS;AACnB,cAAQ,QAAQ,OAAO,OAAO,IAAI,MAAM;AAAA,IAC1C;AACA,QAAI,MAAM,UAAU,QAAQ;AAC1B,UAAI,OAAO,OAAO,SAAS,YAAY;AACrC,eAAO,KAAK,MAAM,SAAS,MAAM,OAAO;AAAA,MAC1C,OAAO;AACL,YAAI,KAAK,MAAM,SAAS,MAAM,OAAO;AAAA,MACvC;AAAA,IACF,OAAO;AACL,UAAI,OAAO,OAAO,UAAU,YAAY;AACtC,eAAO,MAAM,MAAM,SAAS,MAAM,OAAO;AAAA,MAC3C,OAAO;AACL,YAAI,MAAM,MAAM,SAAS,MAAM,OAAO;AAAA,MACxC;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAQA,IAAM,oCAAoC;AAwBnC,SAAS,mCAAmC,SAGxC;AACT,QAAM,aAAa,QAAQ;AAC3B,MAAI,CAAC,OAAO,SAAS,UAAU,KAAK,cAAc,EAAG,QAAO;AAC5D,QAAM,YAAY,QAAQ;AAC1B,MAAI,cAAc,QAAQ,CAAC,OAAO,SAAS,SAAS,EAAG,QAAO;AAC9D,MAAI,aAAa,EAAG,QAAO;AAC3B,SAAO,KAAK;AAAA,IACV;AAAA,IACA,KAAK,IAAI,GAAG,KAAK,MAAM,YAAY,iCAAiC,CAAC;AAAA,EACvE;AACF;AA4BA,eAAsB,+BAAkC,SAMX;AAC3C,QAAM,MAAM,QAAQ,OAAO,KAAK;AAChC,QAAM,cAAc,IAAI;AACxB,QAAM,aAAa,IAAI,gBAAgB;AACvC,QAAM,eAAe,QAAQ;AAC7B,QAAM,gBAAgB,MAAM,WAAW,MAAM;AAC7C,MAAI,cAAc,SAAS;AACzB,eAAW,MAAM;AAAA,EACnB,WAAW,cAAc;AACvB,iBAAa,iBAAiB,SAAS,eAAe,EAAE,MAAM,KAAK,CAAC;AAAA,EACtE;AAEA,QAAM,UAAU,OAAO,SAAS,QAAQ,UAAU,KAAK,QAAQ,aAAa;AAC5E,MAAI;AAEJ,MAAI;AAGF,UAAM,OAAO,QAAQ,IAAI,WAAW,MAAM,EAAE;AAAA,MAC1C,CAAC,WAAW,EAAE,MAAM,SAAkB,MAAM;AAAA,IAC9C;AACA,QAAI,CAAC,SAAS;AACZ,YAAMA,WAAU,MAAM;AACtB,aAAO,EAAE,OAAOA,SAAQ,OAAO,UAAU,OAAO,YAAY,IAAI,IAAI,YAAY;AAAA,IAClF;AACA,UAAM,WAAW,QAAQ,cAAmC;AAG5D,YAAQ,WAAW,MAAM,SAAS,QAAQ,EAAE,MAAM,UAAU,CAAC,GAAG,QAAQ,UAAU;AAClF,UAAM,UAAU,MAAM,QAAQ,KAAK,CAAC,MAAM,SAAS,OAAO,CAAC;AAC3D,QAAI,QAAQ,SAAS,WAAW;AAC9B,iBAAW,MAAM,WAAW,kCAAkC,CAAC;AAG/D,WAAK,KAAK,MAAM,MAAM;AAAA,MAAC,CAAC;AACxB,aAAO,EAAE,OAAO,QAAQ,UAAU,UAAU,MAAM,YAAY,IAAI,IAAI,YAAY;AAAA,IACpF;AACA,WAAO,EAAE,OAAO,QAAQ,OAAO,UAAU,OAAO,YAAY,IAAI,IAAI,YAAY;AAAA,EAClF,UAAE;AACA,iBAAa,KAAK;AAClB,kBAAc,oBAAoB,SAAS,aAAa;AAAA,EAC1D;AACF;AA0BO,SAAS,+BAA+B,SAY/B;AACd,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO,KAAK;AAChC,SAAO,OACL,SACA,UACA,QACe;AACf,UAAM,cAAc,IAAI;AACxB,UAAM,aAAa,mCAAmC;AAAA,MACpD,0BAA0B,QAAQ;AAAA,MAClC,kBACE,QAAQ,sBAAsB,OAAO,OAAO,QAAQ,oBAAoB;AAAA,IAC5E,CAAC;AACD,QAAI;AACJ,QAAI;AACF,gBAAU,MAAM,+BAA+B;AAAA,QAC7C;AAAA,QACA;AAAA,QACA,cAAc,QAAQ;AAAA,QACtB;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,UAAI,CAAC,aAAa,GAAG,EAAG,OAAM;AAC9B,YAAM,aAAa,IAAI,IAAI;AAC3B,cAAQ,OAAO;AAAA,QACb;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AACD,aAAO;AAAA,IACT;AACA,QAAI,QAAQ,UAAU;AACpB,aAAO;AAAA,QACL,mBAAmB,OAAO,kBAAkB,UAAU,0BAC3C,QAAQ,UAAU;AAAA,MAC/B;AAAA,IACF;AACA,YAAQ,OAAO;AAAA,MACb;AAAA,MACA,UAAU;AAAA,MACV,YAAY,QAAQ;AAAA,MACpB;AAAA,MACA,QAAQ,QAAQ,WAAW,YAAY;AAAA,MACvC,SAAS,CAAC,QAAQ;AAAA,IACpB,CAAC;AACD,WAAO,QAAQ;AAAA,EACjB;AACF;","names":["settled"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkEntityRecallAbort,
|
|
3
|
+
entityRecallSectionAbsent,
|
|
4
|
+
yieldEntityRecallScan,
|
|
5
|
+
yieldEntityRecallScanEvery
|
|
6
|
+
} from "./chunk-5AUY5Z5E.js";
|
|
1
7
|
import {
|
|
2
8
|
containsPhrase
|
|
3
9
|
} from "./chunk-SVH57F5Z.js";
|
|
@@ -6,7 +12,7 @@ import {
|
|
|
6
12
|
} from "./chunk-2DQ2XREU.js";
|
|
7
13
|
import {
|
|
8
14
|
compareEntityTimestamps
|
|
9
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PLCZD3LG.js";
|
|
10
16
|
import {
|
|
11
17
|
normalizeEntityName
|
|
12
18
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -376,7 +382,8 @@ function hasFreshNativeExplicitMention(index, nativeChunks, query) {
|
|
|
376
382
|
};
|
|
377
383
|
return resolveLanguageIndependentExplicitCandidates(freshNativeIndex, query).length > 0;
|
|
378
384
|
}
|
|
379
|
-
async function buildEntityMentionIndex(storage, config, recallNamespaces, namespaceStorage, nativeChunksOverride, resolvedStorages) {
|
|
385
|
+
async function buildEntityMentionIndex(storage, config, recallNamespaces, namespaceStorage, nativeChunksOverride, resolvedStorages, abortSignal) {
|
|
386
|
+
checkEntityRecallAbort(abortSignal);
|
|
380
387
|
const storages = resolvedStorages ?? await resolveEntityIndexStorages(
|
|
381
388
|
storage,
|
|
382
389
|
config,
|
|
@@ -391,12 +398,16 @@ async function buildEntityMentionIndex(storage, config, recallNamespaces, namesp
|
|
|
391
398
|
Promise.all(storages.map((scopedStorage) => scopedStorage.readAllMemories())),
|
|
392
399
|
nativeChunksOverride ? Promise.resolve(nativeChunksOverride) : readNativeChunks(config, recallNamespaces)
|
|
393
400
|
]);
|
|
401
|
+
checkEntityRecallAbort(abortSignal);
|
|
394
402
|
const entityRecords = entityFileSets.flatMap(
|
|
395
403
|
(set, index2) => set.map((entity) => ({ entity, storage: storages[index2] }))
|
|
396
404
|
);
|
|
397
405
|
const memories = memorySets.flat();
|
|
406
|
+
let scanned = 0;
|
|
398
407
|
const entities = /* @__PURE__ */ new Map();
|
|
399
408
|
for (const { entity, storage: entityStorage } of entityRecords) {
|
|
409
|
+
scanned += 1;
|
|
410
|
+
await yieldEntityRecallScanEvery(scanned, abortSignal);
|
|
400
411
|
const canonicalId = typeof entityStorage.normalizeEntityName === "function" ? entityStorage.normalizeEntityName(entity.name, entity.type) : normalizeEntityName(entity.name, entity.type, entityStorage.entityAliases);
|
|
401
412
|
const rawStructuredSections = entity.structuredSections ?? [];
|
|
402
413
|
const rawBeliefLedgerFactKeys = beliefLedgerFactKeys(rawStructuredSections);
|
|
@@ -423,7 +434,10 @@ async function buildEntityMentionIndex(storage, config, recallNamespaces, namesp
|
|
|
423
434
|
nativeChunks: []
|
|
424
435
|
});
|
|
425
436
|
}
|
|
437
|
+
scanned = 0;
|
|
426
438
|
for (const memory of memories) {
|
|
439
|
+
scanned += 1;
|
|
440
|
+
await yieldEntityRecallScanEvery(scanned, abortSignal);
|
|
427
441
|
const entityRef = typeof memory.frontmatter.entityRef === "string" ? memory.frontmatter.entityRef : "";
|
|
428
442
|
if (!entityRef) continue;
|
|
429
443
|
const entry = entities.get(entityRef);
|
|
@@ -433,6 +447,7 @@ async function buildEntityMentionIndex(storage, config, recallNamespaces, namesp
|
|
|
433
447
|
entry.memorySnippets.push(snippet);
|
|
434
448
|
}
|
|
435
449
|
}
|
|
450
|
+
await yieldEntityRecallScan(abortSignal);
|
|
436
451
|
const aliasIndex = buildAliasIndex([...entities.values()]);
|
|
437
452
|
for (const chunk of nativeChunks) {
|
|
438
453
|
const existingPseudo = entities.get(nativePseudoCanonicalId(chunk));
|
|
@@ -452,8 +467,11 @@ async function buildEntityMentionIndex(storage, config, recallNamespaces, namesp
|
|
|
452
467
|
const pseudoEntry = createPseudoNativeEntry(chunk);
|
|
453
468
|
entities.set(pseudoEntry.canonicalId, pseudoEntry);
|
|
454
469
|
}
|
|
470
|
+
await yieldEntityRecallScan(abortSignal);
|
|
455
471
|
const sortedEntities = [...entities.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
472
|
+
await yieldEntityRecallScan(abortSignal);
|
|
456
473
|
const previousEntities = previousIndex ? JSON.stringify(previousIndex.entities) : "";
|
|
474
|
+
await yieldEntityRecallScan(abortSignal);
|
|
457
475
|
const nextEntities = JSON.stringify(sortedEntities);
|
|
458
476
|
const entityStatusVersionAfter = shouldPersistIndex ? storage.getMemoryStatusVersion() : void 0;
|
|
459
477
|
const canPersistIndex = shouldPersistIndex && entityStatusVersionBefore === entityStatusVersionAfter;
|
|
@@ -464,6 +482,7 @@ async function buildEntityMentionIndex(storage, config, recallNamespaces, namesp
|
|
|
464
482
|
entities: sortedEntities
|
|
465
483
|
};
|
|
466
484
|
if (canPersistIndex) {
|
|
485
|
+
checkEntityRecallAbort(abortSignal);
|
|
467
486
|
await writeEntityIndexState(storage, index);
|
|
468
487
|
}
|
|
469
488
|
return index;
|
|
@@ -769,6 +788,7 @@ function formatEntityHintSection(candidates, queryTokens, mode, maxRelatedEntiti
|
|
|
769
788
|
return result.trim().length > 0 ? result.trimEnd() : null;
|
|
770
789
|
}
|
|
771
790
|
async function buildEntityRecallSection(options) {
|
|
791
|
+
checkEntityRecallAbort(options.abortSignal);
|
|
772
792
|
const prefixedMode = detectEntityQueryMode(options.query);
|
|
773
793
|
const persistedIndex = prefixedMode ? null : await readCurrentPersistedEntityIndex(
|
|
774
794
|
options.storage,
|
|
@@ -776,11 +796,12 @@ async function buildEntityRecallSection(options) {
|
|
|
776
796
|
options.recallNamespaces,
|
|
777
797
|
options.namespaceStorage
|
|
778
798
|
);
|
|
799
|
+
checkEntityRecallAbort(options.abortSignal);
|
|
779
800
|
let nativeChunks;
|
|
780
801
|
if (!prefixedMode && persistedIndex && resolveLanguageIndependentExplicitCandidates(persistedIndex, options.query).length === 0) {
|
|
781
802
|
nativeChunks = await readNativeChunks(options.config, options.recallNamespaces);
|
|
782
803
|
if (!hasFreshNativeExplicitMention(persistedIndex, nativeChunks, options.query)) {
|
|
783
|
-
return
|
|
804
|
+
return entityRecallSectionAbsent(options.abortSignal);
|
|
784
805
|
}
|
|
785
806
|
}
|
|
786
807
|
const namespaceScoped = resolveNamespaceCapabilities(options.config).namespaces && options.namespaceStorage !== void 0 && (options.recallNamespaces?.length ?? 0) > 0;
|
|
@@ -799,6 +820,7 @@ async function buildEntityRecallSection(options) {
|
|
|
799
820
|
nativeEntityIndexRevision(nativeChunks)
|
|
800
821
|
) : void 0;
|
|
801
822
|
let index = namespaceCacheKey ? namespaceEntityIndexCache.get(namespaceCacheKey) : void 0;
|
|
823
|
+
checkEntityRecallAbort(options.abortSignal);
|
|
802
824
|
if (!index) {
|
|
803
825
|
index = await buildEntityMentionIndex(
|
|
804
826
|
options.storage,
|
|
@@ -806,16 +828,19 @@ async function buildEntityRecallSection(options) {
|
|
|
806
828
|
options.recallNamespaces,
|
|
807
829
|
options.namespaceStorage,
|
|
808
830
|
nativeChunks,
|
|
809
|
-
resolvedStorages
|
|
831
|
+
resolvedStorages,
|
|
832
|
+
options.abortSignal
|
|
810
833
|
);
|
|
811
834
|
if (namespaceCacheKey) rememberNamespaceEntityIndex(namespaceCacheKey, index);
|
|
812
835
|
}
|
|
836
|
+
await yieldEntityRecallScan(options.abortSignal);
|
|
813
837
|
const explicitCandidates = resolveExplicitCandidates(index, options.query);
|
|
838
|
+
await yieldEntityRecallScan(options.abortSignal);
|
|
814
839
|
const queryCandidates = prefixedMode ? explicitCandidates : resolveLanguageIndependentExplicitCandidates(index, options.query);
|
|
815
840
|
const mode = prefixedMode ?? (queryCandidates.length > 0 ? "direct" : null);
|
|
816
|
-
if (!mode) return
|
|
841
|
+
if (!mode) return entityRecallSectionAbsent(options.abortSignal);
|
|
817
842
|
const candidates = queryCandidates.length > 0 ? queryCandidates : resolveRecentTurnCandidates(index, options.transcriptEntries, options.recentTurns);
|
|
818
|
-
if (candidates.length === 0) return
|
|
843
|
+
if (candidates.length === 0) return entityRecallSectionAbsent(options.abortSignal);
|
|
819
844
|
const queryTokens = tokenize(options.query);
|
|
820
845
|
const candidateLimit = queryCandidates.length === 0 && mode === "follow_up" ? 1 : options.maxHints;
|
|
821
846
|
const rankedCandidates = candidates.slice(0, candidateLimit);
|
|
@@ -844,7 +869,7 @@ async function buildEntityRecallSection(options) {
|
|
|
844
869
|
})
|
|
845
870
|
);
|
|
846
871
|
const section = formatEntityHintSection(enriched, queryTokens, mode, options.maxRelatedEntities, options.maxChars);
|
|
847
|
-
if (!section) return
|
|
872
|
+
if (!section) return entityRecallSectionAbsent(options.abortSignal);
|
|
848
873
|
return section;
|
|
849
874
|
}
|
|
850
875
|
async function readRecentEntityTranscriptEntries(transcriptEntriesPromise, recentTurns) {
|
|
@@ -862,4 +887,4 @@ export {
|
|
|
862
887
|
entityIndexVersion,
|
|
863
888
|
entityRecentTranscriptLookbackHours
|
|
864
889
|
};
|
|
865
|
-
//# sourceMappingURL=chunk-
|
|
890
|
+
//# sourceMappingURL=chunk-4WBGZYZZ.js.map
|