@remnic/core 10.0.126 → 10.0.127
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.js +38 -38
- package/dist/access-cli.js +38 -38
- package/dist/access-extraction-force-flush.js +38 -38
- package/dist/access-http-briefing.js +38 -38
- package/dist/access-http-query.js +38 -38
- package/dist/access-http.js +38 -38
- package/dist/access-identity-continuity-surface.js +38 -38
- package/dist/access-lcm-surface.js +38 -38
- package/dist/access-mcp.js +38 -38
- package/dist/access-observe-write-surface.js +38 -38
- package/dist/access-operations-batch.js +38 -38
- package/dist/access-operations.js +38 -38
- package/dist/access-recall-concurrency.js +38 -38
- package/dist/access-recall-response.js +38 -38
- package/dist/access-recall-surface.js +38 -38
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +38 -38
- package/dist/active-recall.js +6 -6
- package/dist/briefing.js +4 -4
- package/dist/buffer-turn-helpers.d.ts +7 -0
- package/dist/buffer-turn-helpers.d.ts.map +1 -1
- package/dist/buffer-turn-helpers.js +3 -1
- package/dist/buffer-turn.d.ts +10 -0
- package/dist/buffer-turn.d.ts.map +1 -1
- package/dist/buffer.js +3 -3
- package/dist/causal-consolidation.js +5 -5
- package/dist/{chunk-BNRKSJMO.js → chunk-2BBCM2PX.js} +2 -2
- package/dist/{chunk-2GSPNTOU.js → chunk-2G72JBQB.js} +2 -2
- package/dist/{chunk-IDCZEKK6.js → chunk-34YQ7CVE.js} +3 -3
- package/dist/{chunk-AYWW6JEH.js → chunk-3OLHDECL.js} +115 -41
- package/dist/chunk-3OLHDECL.js.map +1 -0
- package/dist/{chunk-4VWZ4HPL.js → chunk-4DJSDH2M.js} +6 -6
- package/dist/{chunk-YJEOQ72B.js → chunk-6FPJPSQK.js} +2 -2
- package/dist/{chunk-YKUW2EZF.js → chunk-7T7I5D3F.js} +2 -2
- package/dist/{chunk-ERR7ZFPJ.js → chunk-7TC2PWKH.js} +2 -2
- package/dist/{chunk-DH2CDGAE.js → chunk-ALLI23GW.js} +2 -2
- package/dist/{chunk-RTIHO7AJ.js → chunk-AYBRQJXP.js} +2 -2
- package/dist/{chunk-UXXK523X.js → chunk-BR7CZVMO.js} +20 -16
- package/dist/chunk-BR7CZVMO.js.map +1 -0
- package/dist/{chunk-AWD36R4D.js → chunk-DURQZFVJ.js} +36 -6
- package/dist/chunk-DURQZFVJ.js.map +1 -0
- package/dist/{chunk-C7BTGSCY.js → chunk-FPBFDQZZ.js} +9 -9
- package/dist/{chunk-5DCCVEKT.js → chunk-GWFL6LUU.js} +2 -2
- package/dist/{chunk-JTY3NA3I.js → chunk-HJ7M322C.js} +2 -2
- package/dist/{chunk-HURBXNNB.js → chunk-JCPEXUNP.js} +2 -2
- package/dist/{chunk-LKGTTX74.js → chunk-JK2IVISS.js} +2 -2
- package/dist/{chunk-7XG7KMIW.js → chunk-LNQQEFKH.js} +2 -2
- package/dist/{chunk-IB4TDPCC.js → chunk-LR2X3FJM.js} +2 -2
- package/dist/{chunk-6IRJWKR5.js → chunk-LU2GQ4Q4.js} +2 -2
- package/dist/{chunk-4VCASS3Q.js → chunk-MCTGYIYN.js} +2 -2
- package/dist/{chunk-XN43HAIV.js → chunk-MGCV3VGC.js} +2 -2
- package/dist/{chunk-KWVGRNKL.js → chunk-NYZ6ZNFO.js} +2 -2
- package/dist/{chunk-6VAN7VZR.js → chunk-ORMJT23N.js} +7 -7
- package/dist/{chunk-DL7K5PMQ.js → chunk-PPPY2PCU.js} +2 -2
- package/dist/{chunk-5DP4GVKR.js → chunk-PXZLVFNC.js} +2 -2
- package/dist/{chunk-GSCIRMPR.js → chunk-QKYOMKRG.js} +2 -2
- package/dist/{chunk-QF64W4YM.js → chunk-QRZNVNNS.js} +2 -2
- package/dist/{chunk-CQMH65IP.js → chunk-TJJPT2OV.js} +2 -2
- package/dist/{chunk-2AVPRUML.js → chunk-TJY6AKWV.js} +2 -2
- package/dist/{chunk-RRHLI6VU.js → chunk-TQ5NOVMT.js} +2 -2
- package/dist/{chunk-KNT3BZZH.js → chunk-UWU6KEZU.js} +185 -59
- package/dist/chunk-UWU6KEZU.js.map +1 -0
- package/dist/{chunk-PUKLCFCU.js → chunk-VY3DHUL7.js} +2 -2
- package/dist/chunk-VY3DHUL7.js.map +1 -0
- package/dist/{chunk-47W3ALIS.js → chunk-XMKUABIG.js} +3 -3
- package/dist/{chunk-UGCLNASV.js → chunk-XUWDB53W.js} +3 -3
- package/dist/{chunk-XLHLZALR.js → chunk-YCJRYM3Q.js} +3 -3
- package/dist/{chunk-DB4THCGN.js → chunk-YFUHFPV6.js} +2 -2
- package/dist/{chunk-42JE2CF4.js → chunk-YPE3O5VH.js} +2 -2
- package/dist/{chunk-7TJMXZPO.js → chunk-ZO377APE.js} +2 -2
- package/dist/cli.js +38 -38
- package/dist/coding/export-okf-codegraph.js +3 -3
- package/dist/compounding/engine.js +5 -5
- package/dist/config.js +6 -6
- package/dist/connectors/codex-materialize-runner.js +4 -4
- package/dist/connectors/index.js +4 -4
- package/dist/convergence-refresh.js +6 -6
- package/dist/corpus-watermark.js +6 -6
- package/dist/entity-retrieval.js +4 -4
- package/dist/explicit-capture.js +38 -38
- package/dist/extraction-liveness.d.ts +54 -5
- package/dist/extraction-liveness.d.ts.map +1 -1
- package/dist/extraction-liveness.js +1 -1
- package/dist/extraction-span-config.js +2 -2
- package/dist/extraction.js +7 -7
- package/dist/harmonic-retrieval.js +4 -4
- package/dist/index.js +38 -38
- package/dist/location/index.js +5 -5
- package/dist/maintenance/memory-governance.js +4 -4
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
- package/dist/maintenance/rebuild-memory-projection-runner.js +6 -6
- package/dist/maintenance/rebuild-memory-projection.js +5 -5
- package/dist/namespaces/migrate.js +5 -5
- package/dist/namespaces/storage.js +4 -4
- package/dist/operator-doctor-corpus.js +7 -7
- package/dist/operator-toolkit.js +13 -13
- package/dist/orchestration/backlog-scheduler.js +39 -39
- package/dist/orchestration/buffer-drain-runner.js +39 -39
- package/dist/orchestration/extraction-dedupe.d.ts +46 -0
- package/dist/orchestration/extraction-dedupe.d.ts.map +1 -0
- package/dist/orchestration/extraction-drain.d.ts +12 -1
- package/dist/orchestration/extraction-drain.d.ts.map +1 -1
- package/dist/orchestration/extraction-run.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +12 -12
- package/dist/orchestrator.js +38 -38
- package/dist/recall-navigation.js +38 -38
- package/dist/resume-bundles.js +7 -7
- package/dist/semantic-consolidation.js +5 -5
- package/dist/semantic-rule-promotion.js +4 -4
- package/dist/semantic-rule-verifier.js +4 -4
- package/dist/source-agent-qualifier.js +6 -6
- package/dist/standup/build.js +4 -4
- package/dist/storage/buffer-drain-claims.d.ts +19 -4
- package/dist/storage/buffer-drain-claims.d.ts.map +1 -1
- package/dist/storage/buffer-drain-claims.js +2 -2
- package/dist/storage/buffer-session-files.js +2 -2
- package/dist/storage/drain-claim-totals.d.ts +54 -0
- package/dist/storage/drain-claim-totals.d.ts.map +1 -0
- package/dist/storage.js +3 -3
- package/dist/transfer/export-okf.js +4 -4
- package/dist/verified-recall.js +4 -4
- package/dist/who-knows-cli.js +5 -5
- package/dist/who-knows.js +4 -4
- package/package.json +2 -2
- package/src/access-service-health.test.ts +102 -1
- package/src/access-service.ts +10 -1
- package/src/buffer-turn-helpers.ts +25 -15
- package/src/buffer-turn.ts +10 -0
- package/src/extraction-liveness.test.ts +229 -0
- package/src/extraction-liveness.ts +89 -6
- package/src/orchestration/extraction-dedupe.test.ts +101 -0
- package/src/orchestration/extraction-dedupe.ts +80 -0
- package/src/orchestration/extraction-drain-dedupe.test.ts +477 -0
- package/src/orchestration/extraction-drain.ts +69 -9
- package/src/orchestration/extraction-run.ts +2 -0
- package/src/storage/buffer-drain-claims.test.ts +66 -0
- package/src/storage/buffer-drain-claims.ts +49 -4
- package/src/storage/drain-claim-totals.test.ts +356 -0
- package/src/storage/drain-claim-totals.ts +175 -0
- package/dist/chunk-AWD36R4D.js.map +0 -1
- package/dist/chunk-AYWW6JEH.js.map +0 -1
- package/dist/chunk-KNT3BZZH.js.map +0 -1
- package/dist/chunk-PUKLCFCU.js.map +0 -1
- package/dist/chunk-UXXK523X.js.map +0 -1
- /package/dist/{chunk-BNRKSJMO.js.map → chunk-2BBCM2PX.js.map} +0 -0
- /package/dist/{chunk-2GSPNTOU.js.map → chunk-2G72JBQB.js.map} +0 -0
- /package/dist/{chunk-IDCZEKK6.js.map → chunk-34YQ7CVE.js.map} +0 -0
- /package/dist/{chunk-4VWZ4HPL.js.map → chunk-4DJSDH2M.js.map} +0 -0
- /package/dist/{chunk-YJEOQ72B.js.map → chunk-6FPJPSQK.js.map} +0 -0
- /package/dist/{chunk-YKUW2EZF.js.map → chunk-7T7I5D3F.js.map} +0 -0
- /package/dist/{chunk-ERR7ZFPJ.js.map → chunk-7TC2PWKH.js.map} +0 -0
- /package/dist/{chunk-DH2CDGAE.js.map → chunk-ALLI23GW.js.map} +0 -0
- /package/dist/{chunk-RTIHO7AJ.js.map → chunk-AYBRQJXP.js.map} +0 -0
- /package/dist/{chunk-C7BTGSCY.js.map → chunk-FPBFDQZZ.js.map} +0 -0
- /package/dist/{chunk-5DCCVEKT.js.map → chunk-GWFL6LUU.js.map} +0 -0
- /package/dist/{chunk-JTY3NA3I.js.map → chunk-HJ7M322C.js.map} +0 -0
- /package/dist/{chunk-HURBXNNB.js.map → chunk-JCPEXUNP.js.map} +0 -0
- /package/dist/{chunk-LKGTTX74.js.map → chunk-JK2IVISS.js.map} +0 -0
- /package/dist/{chunk-7XG7KMIW.js.map → chunk-LNQQEFKH.js.map} +0 -0
- /package/dist/{chunk-IB4TDPCC.js.map → chunk-LR2X3FJM.js.map} +0 -0
- /package/dist/{chunk-6IRJWKR5.js.map → chunk-LU2GQ4Q4.js.map} +0 -0
- /package/dist/{chunk-4VCASS3Q.js.map → chunk-MCTGYIYN.js.map} +0 -0
- /package/dist/{chunk-XN43HAIV.js.map → chunk-MGCV3VGC.js.map} +0 -0
- /package/dist/{chunk-KWVGRNKL.js.map → chunk-NYZ6ZNFO.js.map} +0 -0
- /package/dist/{chunk-6VAN7VZR.js.map → chunk-ORMJT23N.js.map} +0 -0
- /package/dist/{chunk-DL7K5PMQ.js.map → chunk-PPPY2PCU.js.map} +0 -0
- /package/dist/{chunk-5DP4GVKR.js.map → chunk-PXZLVFNC.js.map} +0 -0
- /package/dist/{chunk-GSCIRMPR.js.map → chunk-QKYOMKRG.js.map} +0 -0
- /package/dist/{chunk-QF64W4YM.js.map → chunk-QRZNVNNS.js.map} +0 -0
- /package/dist/{chunk-CQMH65IP.js.map → chunk-TJJPT2OV.js.map} +0 -0
- /package/dist/{chunk-2AVPRUML.js.map → chunk-TJY6AKWV.js.map} +0 -0
- /package/dist/{chunk-RRHLI6VU.js.map → chunk-TQ5NOVMT.js.map} +0 -0
- /package/dist/{chunk-47W3ALIS.js.map → chunk-XMKUABIG.js.map} +0 -0
- /package/dist/{chunk-UGCLNASV.js.map → chunk-XUWDB53W.js.map} +0 -0
- /package/dist/{chunk-XLHLZALR.js.map → chunk-YCJRYM3Q.js.map} +0 -0
- /package/dist/{chunk-DB4THCGN.js.map → chunk-YFUHFPV6.js.map} +0 -0
- /package/dist/{chunk-42JE2CF4.js.map → chunk-YPE3O5VH.js.map} +0 -0
- /package/dist/{chunk-7TJMXZPO.js.map → chunk-ZO377APE.js.map} +0 -0
|
@@ -2,22 +2,22 @@ import {
|
|
|
2
2
|
ExtractionDrain,
|
|
3
3
|
TurnIngestionCoordinator,
|
|
4
4
|
shouldSkipImplicitExtraction
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3OLHDECL.js";
|
|
6
6
|
import {
|
|
7
7
|
headerConnector,
|
|
8
8
|
renderExtractionConversation,
|
|
9
9
|
resolveSourceConnector
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QRZNVNNS.js";
|
|
11
11
|
import {
|
|
12
12
|
SmartBuffer
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-34YQ7CVE.js";
|
|
14
14
|
import {
|
|
15
15
|
selfDeps
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LR2X3FJM.js";
|
|
17
17
|
import {
|
|
18
18
|
describeError,
|
|
19
19
|
groupTurnsByExtractionScope
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BR7CZVMO.js";
|
|
21
21
|
import {
|
|
22
22
|
resolveMemoryLifecycleCapabilities
|
|
23
23
|
} from "./chunk-C5LWPYS3.js";
|
|
@@ -447,4 +447,4 @@ export {
|
|
|
447
447
|
ClaimBufferStorage,
|
|
448
448
|
BufferDrainRunner
|
|
449
449
|
};
|
|
450
|
-
//# sourceMappingURL=chunk-
|
|
450
|
+
//# sourceMappingURL=chunk-4DJSDH2M.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-GZFKCLRC.js";
|
|
11
11
|
import {
|
|
12
12
|
StorageManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LR2X3FJM.js";
|
|
14
14
|
import {
|
|
15
15
|
normalizeEntityName
|
|
16
16
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -974,4 +974,4 @@ export {
|
|
|
974
974
|
resolveBriefingSaveDir,
|
|
975
975
|
briefingFilename
|
|
976
976
|
};
|
|
977
|
-
//# sourceMappingURL=chunk-
|
|
977
|
+
//# sourceMappingURL=chunk-6FPJPSQK.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
headerConnector,
|
|
7
7
|
renderExtractionConversation,
|
|
8
8
|
resolveSourceConnector
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QRZNVNNS.js";
|
|
10
10
|
import {
|
|
11
11
|
normalizeReasoningTrace
|
|
12
12
|
} from "./chunk-54V4BZWP.js";
|
|
@@ -2449,4 +2449,4 @@ export {
|
|
|
2449
2449
|
shouldEnableLocalExtractionThinking,
|
|
2450
2450
|
ExtractionEngine
|
|
2451
2451
|
};
|
|
2452
|
-
//# sourceMappingURL=chunk-
|
|
2452
|
+
//# sourceMappingURL=chunk-7T7I5D3F.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryProjection,
|
|
3
3
|
watchProjectionRebuildParent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XMKUABIG.js";
|
|
5
5
|
import {
|
|
6
6
|
initLogger,
|
|
7
7
|
log
|
|
@@ -77,4 +77,4 @@ if (invokedAsRunner) {
|
|
|
77
77
|
export {
|
|
78
78
|
PROJECTION_REBUILD_RUNNER_FLAG
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-7TC2PWKH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LR2X3FJM.js";
|
|
4
4
|
import {
|
|
5
5
|
countRecallTokenOverlap,
|
|
6
6
|
normalizeRecallTokens
|
|
@@ -119,4 +119,4 @@ export {
|
|
|
119
119
|
compareVerifiedSemanticRuleResults,
|
|
120
120
|
searchVerifiedSemanticRules
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-ALLI23GW.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KJTKLXTH.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LR2X3FJM.js";
|
|
7
7
|
import {
|
|
8
8
|
assertInjectedStorageRooted
|
|
9
9
|
} from "./chunk-BNZAR6PO.js";
|
|
@@ -260,4 +260,4 @@ export {
|
|
|
260
260
|
backupExistingLedger,
|
|
261
261
|
rebuildMemoryLifecycleLedger
|
|
262
262
|
};
|
|
263
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-AYBRQJXP.js.map
|
|
@@ -153,24 +153,27 @@ function scopeProfilePlanIdentity(plan) {
|
|
|
153
153
|
if (!plan) return "";
|
|
154
154
|
return `${plan.profileId}\0${plan.writeLayer}\0${plan.writeNamespace}`;
|
|
155
155
|
}
|
|
156
|
+
function extractionScopeGroupKey(turn) {
|
|
157
|
+
return [
|
|
158
|
+
turn.writeNamespaceOverride ?? "",
|
|
159
|
+
turn.principalOverride ?? "",
|
|
160
|
+
scopeProfilePlanIdentity(turn.scopeProfileWritePlan),
|
|
161
|
+
// Accepted captures are deliberately accepted content: they must never
|
|
162
|
+
// share a scope group with ordinary turns, or a group-level capture
|
|
163
|
+
// policy (the explicit-mode gate, the planless-accepted null pin) is
|
|
164
|
+
// applied to ordinary conversation turns because `.some(acceptedCapture)`
|
|
165
|
+
// only looked at the merged group.
|
|
166
|
+
turn.acceptedCapture === true ? "accepted" : "",
|
|
167
|
+
turn.codingContext?.projectId ?? "",
|
|
168
|
+
turn.codingContext?.rootPath ?? "",
|
|
169
|
+
turn.codingContext?.branch ?? "",
|
|
170
|
+
turn.codingContext?.defaultBranch ?? ""
|
|
171
|
+
].join("\0");
|
|
172
|
+
}
|
|
156
173
|
function groupTurnsByExtractionScope(turns) {
|
|
157
174
|
const groups = /* @__PURE__ */ new Map();
|
|
158
175
|
for (const turn of turns) {
|
|
159
|
-
const key =
|
|
160
|
-
turn.writeNamespaceOverride ?? "",
|
|
161
|
-
turn.principalOverride ?? "",
|
|
162
|
-
scopeProfilePlanIdentity(turn.scopeProfileWritePlan),
|
|
163
|
-
// Accepted captures are deliberately accepted content: they must never
|
|
164
|
-
// share a scope group with ordinary turns, or a group-level capture
|
|
165
|
-
// policy (the explicit-mode gate, the planless-accepted null pin) is
|
|
166
|
-
// applied to ordinary conversation turns because `.some(acceptedCapture)`
|
|
167
|
-
// only looked at the merged group.
|
|
168
|
-
turn.acceptedCapture === true ? "accepted" : "",
|
|
169
|
-
turn.codingContext?.projectId ?? "",
|
|
170
|
-
turn.codingContext?.rootPath ?? "",
|
|
171
|
-
turn.codingContext?.branch ?? "",
|
|
172
|
-
turn.codingContext?.defaultBranch ?? ""
|
|
173
|
-
].join("\0");
|
|
176
|
+
const key = extractionScopeGroupKey(turn);
|
|
174
177
|
const group = groups.get(key);
|
|
175
178
|
if (group) {
|
|
176
179
|
group.turns.push(turn);
|
|
@@ -287,6 +290,7 @@ export {
|
|
|
287
290
|
selectRetainedDeferredTurns,
|
|
288
291
|
hasPinnedCaptureScope,
|
|
289
292
|
scopeProfilePlanIdentity,
|
|
293
|
+
extractionScopeGroupKey,
|
|
290
294
|
groupTurnsByExtractionScope,
|
|
291
295
|
bufferTurnArraysEqual,
|
|
292
296
|
bufferTurnArrayIsSuffixOfSnapshot,
|
|
@@ -299,4 +303,4 @@ export {
|
|
|
299
303
|
entryHoldsAcceptedCapture,
|
|
300
304
|
normalizeBufferState
|
|
301
305
|
};
|
|
302
|
-
//# sourceMappingURL=chunk-
|
|
306
|
+
//# sourceMappingURL=chunk-BR7CZVMO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/buffer-turn-helpers.ts"],"sourcesContent":["import type { BufferEntryState, BufferState, BufferTurn } from \"./types.js\";\n\n/** Extracted identities retain whether they came from active or retained turns. */\nexport interface DrainedTurnSets {\n turns: BufferTurn[];\n retainedTurns: BufferTurn[];\n}\n\nexport interface BufferTurnOwner {\n /**\n * Server-resolved principal that owns this session at the authenticated\n * observe/write boundary. Persisted with the buffered turn so lifecycle\n * flushes do not have to infer ownership from a client-chosen session key.\n */\n sessionOwnerPrincipal?: string;\n}\n\nexport interface AmbientCaptureProvenance {\n /**\n * True when this turn's content came from an always-on ambient capture\n * device (a wearable recorder, a room microphone) and may therefore carry\n * speech the user never authored: TV, podcasts, music, overheard\n * conversation (issue #2294). Set by the ingesting subsystem, never from\n * tool arguments — extraction reads it to warn the model about media audio\n * and to clamp high-impact personal facts to the speculative tier.\n */\n ambientCapture?: boolean;\n}\n\nexport function describeError(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (err === null) return \"null\";\n if (err === undefined) return \"undefined\";\n if (typeof err === \"string\") return err;\n try {\n return JSON.stringify(err);\n } catch {\n return String(err);\n }\n}\n\nexport function copyBufferTurn(turn: BufferTurn): BufferTurn {\n const copy: BufferTurn = {\n role: turn.role,\n content: turn.content,\n timestamp: turn.timestamp,\n };\n if (typeof turn.sessionKey === \"string\") copy.sessionKey = turn.sessionKey;\n if (typeof turn.logicalSessionKey === \"string\") {\n copy.logicalSessionKey = turn.logicalSessionKey;\n }\n if (turn.providerThreadId === null || typeof turn.providerThreadId === \"string\") {\n copy.providerThreadId = turn.providerThreadId;\n }\n if (typeof turn.sessionOwnerPrincipal === \"string\") {\n copy.sessionOwnerPrincipal = turn.sessionOwnerPrincipal;\n }\n if (typeof turn.turnFingerprint === \"string\") {\n copy.turnFingerprint = turn.turnFingerprint;\n }\n if (typeof turn.persistProcessedFingerprint === \"boolean\") {\n copy.persistProcessedFingerprint = turn.persistProcessedFingerprint;\n }\n if (typeof turn.sourceConnector === \"string\") {\n copy.sourceConnector = turn.sourceConnector;\n }\n if (turn.originRole === \"user\" || turn.originRole === \"assistant\" || turn.originRole === \"tool\") {\n copy.originRole = turn.originRole;\n }\n if (typeof turn.ambientCapture === \"boolean\") {\n copy.ambientCapture = turn.ambientCapture;\n }\n if (turn.sourceValidAt !== undefined) {\n copy.sourceValidAt = turn.sourceValidAt;\n }\n if (turn.parts !== undefined) {\n copy.parts = turn.parts;\n }\n if (turn.rawContent !== undefined) {\n copy.rawContent = turn.rawContent;\n }\n if (turn.sourceFormat !== undefined) {\n copy.sourceFormat = turn.sourceFormat;\n }\n // #3251 scope pins: strings copy by value; the plan object is an immutable\n // config-derived identity passed by reference.\n if (turn.writeNamespaceOverride !== undefined) {\n copy.writeNamespaceOverride = turn.writeNamespaceOverride;\n }\n if (turn.principalOverride !== undefined) {\n copy.principalOverride = turn.principalOverride;\n }\n if (turn.scopeProfileWritePlan !== undefined) {\n copy.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n }\n if (turn.acceptedCapture === true) {\n copy.acceptedCapture = true;\n }\n const ctx = turn.codingContext;\n if (ctx) {\n // All four fields are identity inputs (branchScope uses branch) — copy\n // explicitly as-is; never a spread of external input.\n copy.codingContext = {\n projectId: ctx.projectId,\n branch: ctx.branch,\n rootPath: ctx.rootPath,\n defaultBranch: ctx.defaultBranch,\n };\n }\n return copy;\n}\n\n/**\n * Remove the turns that a drain already extracted (`drained`) from `turns`.\n * Identity-based (role/content/timestamp/session/...): the same comparison\n * the buffer uses to match live turns, so a stale owner can subtract exactly\n * what the drain took and keep everything else.\n */\nexport function subtractBufferTurns(turns: readonly BufferTurn[], drained: readonly BufferTurn[]): BufferTurn[] {\n if (drained.length === 0) return [...turns];\n const kept = [...turns];\n for (const gone of drained) {\n const at = kept.findIndex((live) => bufferTurnsEqual(live, gone));\n if (at >= 0) kept.splice(at, 1);\n }\n return kept;\n}\n\n/** Per-key pending counts over the IN-MEMORY buffer state (counts only — no\n * turn payloads). The claim store's answer stays authoritative for claimed\n * keys; callers must filter through `BufferDrainClaims.isClaimed` before\n * treating a count here as work. */\nexport interface BufferEntryCounts {\n turns: number;\n retainedTurns: number;\n}\n\nexport function bufferEntryCounts(state: BufferState): Map<string, BufferEntryCounts> {\n const out = new Map<string, BufferEntryCounts>();\n const entries = state.entries;\n if (!entries) return out;\n for (const [key, entry] of Object.entries(entries)) {\n out.set(key, { turns: entry.turns.length, retainedTurns: entry.retainedTurns?.length ?? 0 });\n }\n return out;\n}\n\nexport function bufferTurnsEqual(left: BufferTurn | undefined, right: BufferTurn): boolean {\n if (!left) return false;\n return (\n left.role === right.role &&\n left.content === right.content &&\n left.timestamp === right.timestamp &&\n left.sessionKey === right.sessionKey &&\n left.sessionOwnerPrincipal === right.sessionOwnerPrincipal &&\n left.logicalSessionKey === right.logicalSessionKey &&\n left.providerThreadId === right.providerThreadId &&\n left.turnFingerprint === right.turnFingerprint &&\n left.persistProcessedFingerprint === right.persistProcessedFingerprint &&\n left.sourceConnector === right.sourceConnector &&\n left.originRole === right.originRole &&\n left.ambientCapture === right.ambientCapture &&\n left.sourceValidAt === right.sourceValidAt &&\n left.acceptedCapture === right.acceptedCapture &&\n left.codingContext?.projectId === right.codingContext?.projectId &&\n left.codingContext?.rootPath === right.codingContext?.rootPath &&\n left.codingContext?.branch === right.codingContext?.branch &&\n left.codingContext?.defaultBranch === right.codingContext?.defaultBranch &&\n // #3251 scope pins compare by identity triple, not deep plan equality: a\n // restart-rehydrated plan must still match the pin it was accepted under.\n left.writeNamespaceOverride === right.writeNamespaceOverride &&\n left.principalOverride === right.principalOverride &&\n scopeProfilePlanIdentity(left.scopeProfileWritePlan) ===\n scopeProfilePlanIdentity(right.scopeProfileWritePlan)\n );\n}\n\n/**\n * Canonical identity key for a turn, injective over `bufferTurnsEqual`\n * equality classes. Every compared field is a primitive (or the #3251 plan\n * identity string), so set-membership replaces pairwise comparison and turn\n * merges run O(n + m) instead of O(n × m). JSON.stringify of a string is\n * injective (it escapes control characters), and the raw `\\u0001` sentinels\n * distinguish undefined from null — a distinction `===` makes and plain\n * stringification would lose.\n */\nexport function bufferTurnIdentityKey(turn: BufferTurn): string {\n const opt = (value: string | null | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : value === null ? \"\\u0001null\" : JSON.stringify(value);\n const optFlag = (value: boolean | undefined): string =>\n value === undefined ? \"\\u0001undefined\" : String(value);\n const ctx = turn.codingContext;\n return JSON.stringify([\n turn.role,\n turn.content,\n turn.timestamp,\n opt(turn.sessionKey),\n opt(turn.sessionOwnerPrincipal),\n opt(turn.logicalSessionKey),\n turn.providerThreadId === undefined ? \"\\u0001undefined\" : turn.providerThreadId === null ? \"\\u0001null\" : JSON.stringify(turn.providerThreadId),\n opt(turn.turnFingerprint),\n optFlag(turn.persistProcessedFingerprint),\n opt(turn.sourceConnector),\n opt(turn.originRole),\n optFlag(turn.ambientCapture),\n opt(turn.sourceValidAt),\n optFlag(turn.acceptedCapture),\n opt(ctx?.projectId),\n opt(ctx?.rootPath),\n opt(ctx?.branch),\n opt(ctx?.defaultBranch),\n opt(turn.writeNamespaceOverride),\n opt(turn.principalOverride),\n opt(turn.scopeProfileWritePlan ? scopeProfilePlanIdentity(turn.scopeProfileWritePlan) : undefined),\n ]);\n}\n\n/**\n * Identity-dedupe `incoming` turns into `existing` (same contract as the\n * claim-merge `mergeTurns`): identical turns are dropped — the EXISTING\n * entry is kept — genuinely-new turns append in arrival order, and\n * duplicates within `incoming` collapse to their first occurrence. O(n + m)\n * via `bufferTurnIdentityKey` membership instead of pairwise equality.\n */\nexport function mergeBufferTurnsByIdentity(\n existing: readonly BufferTurn[],\n incoming: readonly BufferTurn[],\n): BufferTurn[] {\n const merged = [...existing];\n const seen = new Set(merged.map(bufferTurnIdentityKey));\n for (const turn of incoming) {\n const key = bufferTurnIdentityKey(turn);\n if (seen.has(key)) continue;\n seen.add(key);\n merged.push(turn);\n }\n return merged;\n}\n\n/** Replace only the processed snapshot; callers without one retain legacy whole-slot semantics. */\nexport function selectRetainedDeferredTurns(\n existing: readonly BufferTurn[],\n turns: BufferTurn[],\n max: number,\n originalTurns?: readonly BufferTurn[],\n): BufferTurn[] {\n const others = originalTurns === undefined ? [] : existing.filter(\n (turn) => !originalTurns.some((original) => bufferTurnsEqual(turn, original)),\n );\n if (!Array.isArray(turns) || max <= 0) return others;\n return [...others, ...turns.slice(-max).map(copyBufferTurn)];\n}\n\nexport function hasPinnedCaptureScope(turn: BufferTurn): boolean {\n return turn.acceptedCapture === true ||\n turn.writeNamespaceOverride !== undefined ||\n turn.scopeProfileWritePlan !== undefined;\n}\n\n/** Stable identity string for a pinned scope-profile plan (#3251). */\nexport function scopeProfilePlanIdentity(\n plan: BufferTurn[\"scopeProfileWritePlan\"],\n): string {\n if (!plan) return \"\";\n return `${plan.profileId}\\u0000${plan.writeLayer}\\u0000${plan.writeNamespace}`;\n}\n\nexport interface ExtractionScopeGroup {\n writeNamespaceOverride?: string;\n principalOverride?: string;\n scopeProfileWritePlan?: BufferTurn[\"scopeProfileWritePlan\"];\n codingContext?: BufferTurn[\"codingContext\"];\n turns: BufferTurn[];\n}\n\n/**\n * Scope-group identity for one turn (#3251): the durable pins that decide\n * which extraction scope a turn belongs to. Shared by\n * `groupTurnsByExtractionScope` and the #3443 duplicate collapse so both use\n * ONE definition of \"same scope\".\n */\nexport function extractionScopeGroupKey(turn: BufferTurn): string {\n return [\n turn.writeNamespaceOverride ?? \"\",\n turn.principalOverride ?? \"\",\n scopeProfilePlanIdentity(turn.scopeProfileWritePlan),\n // Accepted captures are deliberately accepted content: they must never\n // share a scope group with ordinary turns, or a group-level capture\n // policy (the explicit-mode gate, the planless-accepted null pin) is\n // applied to ordinary conversation turns because `.some(acceptedCapture)`\n // only looked at the merged group.\n turn.acceptedCapture === true ? \"accepted\" : \"\",\n turn.codingContext?.projectId ?? \"\",\n turn.codingContext?.rootPath ?? \"\",\n turn.codingContext?.branch ?? \"\",\n turn.codingContext?.defaultBranch ?? \"\",\n ].join(\"\\u0000\");\n}\n\n/**\n * Partition extraction turns by their durable scope pins (#3251). Turns\n * captured under different namespaces / principals / scope profiles /\n * project bindings must never be extracted together — each group runs its\n * own extraction under its own scope. Native (unpinned) turns form their own\n * group and keep today's single-store routing.\n */\nexport function groupTurnsByExtractionScope(turns: BufferTurn[]): ExtractionScopeGroup[] {\n const groups = new Map<string, ExtractionScopeGroup>();\n for (const turn of turns) {\n const key = extractionScopeGroupKey(turn);\n const group = groups.get(key);\n if (group) {\n group.turns.push(turn);\n } else {\n const created: ExtractionScopeGroup = { turns: [turn] };\n if (turn.writeNamespaceOverride !== undefined) created.writeNamespaceOverride = turn.writeNamespaceOverride;\n if (turn.principalOverride !== undefined) created.principalOverride = turn.principalOverride;\n if (turn.scopeProfileWritePlan !== undefined) created.scopeProfileWritePlan = turn.scopeProfileWritePlan;\n if (turn.codingContext !== undefined) created.codingContext = turn.codingContext;\n groups.set(key, created);\n }\n }\n return [...groups.values()];\n}\n\nexport function bufferTurnArraysEqual(\n left: readonly BufferTurn[],\n right: readonly BufferTurn[],\n): boolean {\n return left.length === right.length && left.every((turn, index) => bufferTurnsEqual(turn, right[index]));\n}\n\nexport function bufferTurnArrayIsSuffixOfSnapshot(\n liveTurns: readonly BufferTurn[],\n snapshot: readonly BufferTurn[],\n): boolean {\n if (liveTurns.length === 0 || liveTurns.length > snapshot.length) {\n return false;\n }\n const offset = snapshot.length - liveTurns.length;\n return liveTurns.every((turn, index) => bufferTurnsEqual(turn, snapshot[offset + index]));\n}\n\nexport function liveTurnsFromExtractionSnapshot(\n entry: BufferEntryState,\n extractedTurns: readonly BufferTurn[],\n): readonly BufferTurn[] {\n const retainedTurns = entry.retainedTurns ?? [];\n if (\n retainedTurns.length > 0 &&\n extractedTurns.length >= retainedTurns.length &&\n retainedTurns.every((turn, index) => bufferTurnsEqual(extractedTurns[index], turn))\n ) {\n const withoutRetainedPrefix = extractedTurns.slice(retainedTurns.length);\n if (withoutRetainedPrefix.length > 0 && matchingPrefixLength(entry.turns, withoutRetainedPrefix) > 0) {\n return withoutRetainedPrefix;\n }\n }\n return extractedTurns;\n}\n\nfunction matchingPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let index = 0;\n while (\n index < liveTurns.length &&\n index < extractedTurns.length &&\n bufferTurnsEqual(liveTurns[index], extractedTurns[index])\n ) {\n index += 1;\n }\n return index;\n}\n\nexport function matchingQueuedExtractionPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let bestMatchedCount = 0;\n for (let start = 0; start < extractedTurns.length; start += 1) {\n const matchedCount = matchingPrefixLength(liveTurns, extractedTurns.slice(start));\n if (matchedCount > bestMatchedCount) {\n bestMatchedCount = matchedCount;\n if (bestMatchedCount === liveTurns.length) break;\n }\n }\n return bestMatchedCount;\n}\n\nexport class ProbeTimeoutError extends Error {\n constructor(timeoutMs: number) {\n super(`probe exceeded ${timeoutMs}ms`);\n this.name = \"ProbeTimeoutError\";\n }\n}\n\nexport function probeWithTimeout<T>(inflight: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: NodeJS.Timeout | null = null;\n const timeout = new Promise<T>((_, reject) => {\n timer = setTimeout(() => reject(new ProbeTimeoutError(timeoutMs)), timeoutMs);\n if (typeof (timer as NodeJS.Timeout).unref === \"function\") {\n (timer as NodeJS.Timeout).unref();\n }\n });\n return Promise.race([inflight, timeout]).finally(() => {\n if (timer) clearTimeout(timer);\n });\n}\n\nexport const isAcceptedTurn = (t: { acceptedCapture?: boolean; writeNamespaceOverride?: string }): boolean =>\n t.acceptedCapture === true || t.writeNamespaceOverride !== undefined;\n\nexport function entryActivityAt(entry: BufferEntryState): number {\n const lastTurnAt = entry.turns.reduce((latest, turn) => {\n const parsed = Date.parse(turn.timestamp);\n return Number.isFinite(parsed) ? Math.max(latest, parsed) : latest;\n }, -1);\n const lastExtractionAt =\n entry.lastExtractionAt === null ? Number.NaN : Date.parse(entry.lastExtractionAt);\n return Math.max(\n lastTurnAt,\n Number.isFinite(lastExtractionAt) ? lastExtractionAt : -1,\n );\n}\n\nexport function entryHoldsAcceptedCapture(entry: BufferEntryState | undefined): boolean {\n return (entry?.turns ?? []).some(isAcceptedTurn) || (entry?.retainedTurns ?? []).some(isAcceptedTurn);\n}\n\nexport function normalizeBufferState(state: BufferState): BufferState {\n // SAFETY: persisted-state contract — entries, when present, is a record of BufferEntryState.\n const entries = Object.assign(\n Object.create(null),\n state.entries ?? {},\n ) as NonNullable<BufferState[\"entries\"]>;\n if (!entries.default) {\n entries.default = {\n turns: Array.isArray(state.turns) ? [...state.turns] : [],\n lastExtractionAt: state.lastExtractionAt ?? null,\n extractionCount: state.extractionCount ?? 0,\n };\n }\n return {\n turns: entries.default.turns,\n lastExtractionAt: entries.default.lastExtractionAt,\n extractionCount: entries.default.extractionCount,\n entries,\n };\n}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,SAAO;AAAA,IACL,OAAO,QAAQ,QAAQ;AAAA,IACvB,kBAAkB,QAAQ,QAAQ;AAAA,IAClC,iBAAiB,QAAQ,QAAQ;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
|
|
@@ -83,19 +83,25 @@ function evaluateExtractionLiveness(input) {
|
|
|
83
83
|
const metaReadFailed = input.metaReadFailed === true;
|
|
84
84
|
const watermarkPending = input.watermarkPending === true;
|
|
85
85
|
const readFailed = snapshot.readFailed === true;
|
|
86
|
-
const
|
|
86
|
+
const claims = input.claims ?? null;
|
|
87
|
+
const claimsPending = claims?.claimedPendingTurns ?? 0;
|
|
88
|
+
const claimsOldestAge = ageMsFrom(claims?.oldestClaimedTurnAt ?? null, nowMs);
|
|
89
|
+
const claimedStale = claimsPending > 0 && claimsOldestAge !== null && claimsOldestAge >= config.staleWindowMs;
|
|
90
|
+
const degraded = config.enabled && (metaReadFailed || readFailed || claimedStale || !watermarkPending && hasBacklog && stale);
|
|
87
91
|
let degradedReason = null;
|
|
88
92
|
if (degraded) {
|
|
89
93
|
if (metaReadFailed) {
|
|
90
94
|
degradedReason = `extraction watermark unreadable: ${input.metaReadError ?? "meta read failed"}`;
|
|
91
95
|
} else if (readFailed) {
|
|
92
96
|
degradedReason = `extraction buffer unreadable: ${snapshot.readError ?? "buffer snapshot read failed"}`;
|
|
97
|
+
} else if (claimedStale) {
|
|
98
|
+
degradedReason = `claimed drain backlog: ${claims?.claimedSessions ?? 0} claimed session(s), ${claimsPending} claimed turn(s) pending extraction, oldest waiting ${formatAgeMs(claimsOldestAge ?? 0)}` + (claims?.truncated === true ? " (scan truncated)" : "") + (input.llmFailureReason ? `; extraction LLM unavailable: ${input.llmFailureReason}` : "");
|
|
93
99
|
} else {
|
|
94
100
|
const watermark = hasWatermark ? `last succeeded ${formatAgeMs(nowMs - lastMs)} ago` : "no successful extraction on record";
|
|
95
101
|
degradedReason = `${watermark}; ${snapshot.bufferedSessionCount} buffered session(s), ${snapshot.pendingTurnCount} turn(s) pending extraction`;
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
|
|
104
|
+
const status = {
|
|
99
105
|
lastExtractionAt,
|
|
100
106
|
bufferedSessionCount: snapshot.bufferedSessionCount,
|
|
101
107
|
pendingTurnCount: snapshot.pendingTurnCount,
|
|
@@ -105,6 +111,16 @@ function evaluateExtractionLiveness(input) {
|
|
|
105
111
|
...watermarkPending ? { watermarkPending: true } : {},
|
|
106
112
|
watermarkScope: "aggregate"
|
|
107
113
|
};
|
|
114
|
+
if (claims !== null) {
|
|
115
|
+
status.claimedSessionCount = claims.claimedSessions;
|
|
116
|
+
status.claimedPendingTurnCount = claimsPending;
|
|
117
|
+
status.oldestClaimedTurnAgeMs = claimsOldestAge;
|
|
118
|
+
status.oldestClaimedAgeBasis = claims.oldestClaimedAgeBasis;
|
|
119
|
+
status.claimedBacklogUnverified = claims.unverifiedClaims;
|
|
120
|
+
status.claimedBacklogPendingInbox = claims.claimsPendingInbox;
|
|
121
|
+
status.claimedBacklogTruncated = claims.truncated === true;
|
|
122
|
+
}
|
|
123
|
+
return status;
|
|
108
124
|
}
|
|
109
125
|
var EMPTY_SNAPSHOT = {
|
|
110
126
|
bufferedSessionCount: 0,
|
|
@@ -134,7 +150,11 @@ async function gatherExtractionLivenessStatus(input) {
|
|
|
134
150
|
nowMs,
|
|
135
151
|
metaReadFailed: watermarkRead.readFailed,
|
|
136
152
|
metaReadError: watermarkRead.readError,
|
|
137
|
-
watermarkPending: watermarkRead.pending
|
|
153
|
+
watermarkPending: watermarkRead.pending,
|
|
154
|
+
claims: input.claims,
|
|
155
|
+
// #3442: the claimed-backlog reason names the last failure while the
|
|
156
|
+
// extractor is unreachable, matching the /health llm block.
|
|
157
|
+
llmFailureReason: getExtractionLlmHealth().lastFailureReason
|
|
138
158
|
});
|
|
139
159
|
}
|
|
140
160
|
var ExtractionLivenessWarnThrottle = class {
|
|
@@ -160,13 +180,23 @@ function resolveExtractionLivenessConfig(block) {
|
|
|
160
180
|
staleWindowMs: staleWindowMs !== void 0 && Number.isInteger(staleWindowMs) && staleWindowMs >= 1 ? staleWindowMs : DEFAULT_STALE_WINDOW_MS
|
|
161
181
|
};
|
|
162
182
|
}
|
|
163
|
-
async function computeExtractionLivenessStatus(orchestrator, watermark, throttle, nowMs = Date.now()) {
|
|
183
|
+
async function computeExtractionLivenessStatus(orchestrator, watermark, throttle, nowMs = Date.now(), drainClaimTotals) {
|
|
164
184
|
const config = resolveExtractionLivenessConfig(orchestrator.config.extractionLiveness);
|
|
185
|
+
let claims = null;
|
|
186
|
+
if (drainClaimTotals !== void 0) {
|
|
187
|
+
try {
|
|
188
|
+
claims = await drainClaimTotals();
|
|
189
|
+
} catch (err) {
|
|
190
|
+
claims = null;
|
|
191
|
+
log.debug(`extraction liveness: claimed drain totals unavailable: ${err instanceof Error ? err.message : String(err)}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
165
194
|
const status = await gatherExtractionLivenessStatus({
|
|
166
195
|
config,
|
|
167
196
|
watermark,
|
|
168
197
|
buffer: orchestrator.buffer,
|
|
169
|
-
nowMs
|
|
198
|
+
nowMs,
|
|
199
|
+
claims
|
|
170
200
|
});
|
|
171
201
|
throttle?.maybeWarn(status, config.staleWindowMs, nowMs);
|
|
172
202
|
return { ...status, ...getExtractionLlmHealth() };
|
|
@@ -225,4 +255,4 @@ export {
|
|
|
225
255
|
summarizeExtractionLiveness,
|
|
226
256
|
renderExtractionLivenessStats
|
|
227
257
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
258
|
+
//# sourceMappingURL=chunk-DURQZFVJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-liveness.ts"],"sourcesContent":["/**\n * Extraction-pipeline liveness (issue #2151).\n *\n * A daemon's implicit extraction can fail continuously for months while\n * `/health` stays green and recall keeps serving: every individual failure is\n * logged (timeouts, fallback-no-parsed-output), but nothing aggregates them\n * into a checkable status. This module surfaces a liveness *watermark* — the\n * last successful extraction plus the current buffer backlog — and decides when\n * that watermark is stale enough to call the pipeline degraded.\n *\n * The §22 error-vs-empty principle applies at the pipeline level: \"no\n * extraction succeeded for 90 days\" (a non-empty buffer with a stale/absent\n * watermark) must be distinguishable from \"nothing to extract\" (an empty\n * buffer). Degradation therefore requires a NON-EMPTY buffer — an idle daemon\n * with nothing buffered is healthy, not degraded.\n *\n * The core decision (`evaluateExtractionLiveness`) is a pure function shared by\n * every surface (authenticated `/health`, `remnic doctor`, `remnic stats`) so\n * the verdict never diverges across code paths.\n */\nimport { coerceBool, coerceNumber } from \"./connectors/coerce.js\";\nimport { getExtractionLlmHealth } from \"./extraction-llm-health.js\";\nimport { log } from \"./logger.js\";\nimport type { OperatorDoctorCheck } from \"./operator-doctor-types.js\";\nimport type { DrainClaimTotals } from \"./storage/drain-claim-totals.js\";\nimport type { PluginConfig } from \"./types.js\";\n\n/** Default staleness window: 24h. A watermark older than this with a non-empty buffer is degraded. */\nconst DEFAULT_STALE_WINDOW_MS = 86_400_000;\n\nexport interface ExtractionLivenessConfig {\n /** Master gate. When false, liveness is never reported degraded. Default true. */\n enabled: boolean;\n /**\n * How stale the last-successful-extraction watermark may get (ms) before a\n * non-empty buffer flags the pipeline degraded. Default 24h.\n */\n staleWindowMs: number;\n}\n\n/**\n * A read-only snapshot of buffered, not-yet-extracted work. Structurally\n * satisfied by `SmartBuffer.getBufferSnapshot()` so callers can pass the live\n * buffer without this module depending on the buffer implementation.\n */\nexport interface ExtractionBufferSnapshot {\n bufferedSessionCount: number;\n pendingTurnCount: number;\n oldestTurnTimestamp: string | null;\n /**\n * Set by the liveness reader (never by `SmartBuffer`) when the buffer exists\n * but its snapshot read threw. An unreadable buffer is a pipeline fault, not\n * an empty queue (§22): it degrades the pipeline with a distinct reason\n * instead of masquerading as a zero-backlog (healthy) snapshot.\n */\n readFailed?: boolean;\n /** Read-failure detail, surfaced in the degraded reason when `readFailed`. */\n readError?: string;\n}\n\nexport interface ExtractionBufferSource {\n getBufferSnapshot(): Promise<ExtractionBufferSnapshot>;\n}\n\nexport interface ExtractionRootStats {\n extractionCount?: number;\n lastConsolidationAt?: string | null;\n}\n\nexport interface ExtractionWatermarkRead {\n lastExtractionAt: string | null;\n readFailed: boolean;\n readError?: string;\n pending?: boolean;\n rootStats?: ExtractionRootStats;\n}\n\nexport type ExtractionWatermarkOrStorage =\n | ExtractionWatermarkRead\n | { readMetadata(): Promise<{ lastExtractionAt?: string | null } | null> }\n | { loadMeta(): Promise<{ lastExtractionAt?: string | null }> };\n\nexport async function coerceExtractionWatermark(\n watermark: ExtractionWatermarkOrStorage,\n): Promise<ExtractionWatermarkRead> {\n if (watermark && \"readFailed\" in watermark && typeof watermark.readFailed === \"boolean\") {\n return watermark as ExtractionWatermarkRead;\n }\n try {\n let lastExtractionAt: string | null = null;\n if (\"loadMeta\" in watermark && typeof watermark.loadMeta === \"function\") {\n const meta = await watermark.loadMeta();\n lastExtractionAt = meta?.lastExtractionAt ?? null;\n } else if (\"readMetadata\" in watermark && typeof watermark.readMetadata === \"function\") {\n const meta = await watermark.readMetadata();\n lastExtractionAt = meta?.lastExtractionAt ?? null;\n }\n return {\n lastExtractionAt,\n readFailed: true,\n readError: \"aggregate watermark unavailable from legacy root-store-only storage argument\",\n };\n } catch (error) {\n return {\n lastExtractionAt: null,\n readFailed: true,\n readError: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\n/**\n * The daemon-scoped liveness payload surfaced on `/health.extraction` and in\n * doctor/stats details. Its watermark is the maximum successful extraction\n * across every distinct namespace store, matching the daemon-wide buffer scope.\n */\nexport interface ExtractionLivenessStatus {\n lastExtractionAt: string | null;\n bufferedSessionCount: number;\n pendingTurnCount: number;\n oldestBufferedTurnAgeMs: number | null;\n degraded: boolean;\n degradedReason: string | null;\n watermarkPending?: boolean;\n watermarkScope: \"aggregate\";\n /**\n * Extraction-LLM availability (issue #3140): outcome of the last extraction\n * attempt. `lastFailureReason` is non-null exactly while `llmReachable` is\n * false. Populated by the daemon-wide status readers (`/health`, doctor,\n * stats), not by the pure evaluators below.\n */\n llmReachable?: boolean;\n lastFailureReason?: string | null;\n lastFailureAt?: string | null;\n /**\n * Claimed drain backlog (#3442): turns handed to `buffer/drain` claims are\n * NOT in the in-memory counts above. Set (to the daemon-wide sidecar scan)\n * only when the caller supplies a claims reader — i.e. by `/health`, not by\n * the pure evaluators' other surfaces. `oldestClaimedTurnAgeMs` is null when\n * no verified sidecar reports an oldest-turn timestamp (legacy sidecars).\n */\n claimedSessionCount?: number;\n claimedPendingTurnCount?: number;\n oldestClaimedTurnAgeMs?: number | null;\n /**\n * How `oldestClaimedTurnAgeMs` was derived: \"turn\" = a sidecar's oldestTurnAt;\n * \"claim-mtime-lower-bound\" = at least one legacy claim contributed only its\n * body mtime, a true lower bound on the oldest turn's age (whole-file body\n * rewrites keep mtime >= newest turn >= oldest turn), so the true backlog age\n * is at least the reported one. null when no claim contributed a candidate.\n */\n oldestClaimedAgeBasis?: \"turn\" | \"claim-mtime-lower-bound\" | null;\n /**\n * Claims whose sidecar was missing/stale: their pending turns are NOT in\n * `claimedPendingTurnCount` (parsing bodies on the health path is exactly\n * what this reader avoids), so the pending sum may undercount by them.\n */\n claimedBacklogUnverified?: number;\n /**\n * Claims with a non-empty hand-in inbox: pending turns appended after the\n * last sidecar write, also absent from `claimedPendingTurnCount`.\n */\n claimedBacklogPendingInbox?: number;\n /** The claims sidecar scan hit its bound; the pending sum may undercount. */\n claimedBacklogTruncated?: boolean;\n}\n\ninterface ExtractionLivenessOrchestratorLike {\n config: Pick<PluginConfig, \"extractionLiveness\">;\n buffer?: ExtractionBufferSource;\n}\n\n/**\n * Parse the `extractionLiveness` config block. Follows the nested-block shape\n * validation used elsewhere in `config.ts` and coerces string booleans (§24:\n * CLI/JSON deliver `\"false\"`/`\"0\"` as strings, which must read as falsy).\n */\nexport function parseExtractionLivenessConfig(\n cfg: Record<string, unknown>,\n): ExtractionLivenessConfig {\n const raw = cfg.extractionLiveness;\n if (raw !== undefined && (raw === null || typeof raw !== \"object\" || Array.isArray(raw))) {\n throw new Error(`extractionLiveness must be a plain object (got ${JSON.stringify(raw)})`);\n }\n const block = (raw ?? {}) as Record<string, unknown>;\n return {\n // `?? true` keeps the default on when the key is absent while honoring\n // explicit \"false\"/\"0\"/false opt-outs (coerceBool handles the string forms).\n enabled: coerceBool(block.enabled) ?? true,\n staleWindowMs: parseStaleWindowMs(block.staleWindowMs),\n };\n}\n\n/**\n * Parse `extractionLiveness.staleWindowMs`. Absent (`undefined`) → the 24h\n * default; any PRESENT value (including an explicit `null`) must coerce to a\n * positive INTEGER of milliseconds, else THROW. A fractional or non-positive\n * value (\"0.5\" would floor to 0, making every backlog instantly stale; 1.9 would\n * floor to 1) is rejected, never floored/reinterpreted (§1/§17/§39). Mirrors\n * config.ts's `parseIntegerInClosedRange` (round 9 finding 1): only an absent key\n * falls back; an explicit `null` is invalid input, not \"use the default\".\n * Inlined rather than imported because config.ts already imports this module\n * (importing back would be circular), the same reason `recall-concurrency-config.ts`\n * inlines its numeric validation.\n */\nfunction parseStaleWindowMs(value: unknown): number {\n // Only an absent key (undefined) falls back to the default; an explicit `null`\n // is invalid input and proceeds to validation → throw (mirrors\n // parseIntegerInClosedRange, round 9 finding 1).\n if (value === undefined) return DEFAULT_STALE_WINDOW_MS;\n const coerced = coerceNumber(value);\n if (coerced === undefined || !Number.isFinite(coerced) || !Number.isInteger(coerced) || coerced < 1) {\n throw new Error(\n `extractionLiveness.staleWindowMs must be an integer greater than or equal to 1; got ${JSON.stringify(value)}`,\n );\n }\n return coerced;\n}\n\n/** Milliseconds between `timestamp` and `nowMs`, clamped at 0; null when unparsable/absent. */\nfunction ageMsFrom(timestamp: string | null, nowMs: number): number | null {\n if (typeof timestamp !== \"string\") return null;\n const parsed = Date.parse(timestamp);\n if (!Number.isFinite(parsed)) return null;\n return Math.max(0, nowMs - parsed);\n}\n\n/** Compact human-readable duration (\"3d\", \"5h\", \"12m\", \"45s\") for logs and CLI output. */\nexport function formatAgeMs(ms: number): string {\n const s = Math.max(0, Math.floor(ms / 1000));\n if (s >= 86_400) return `${Math.floor(s / 86_400)}d`;\n if (s >= 3_600) return `${Math.floor(s / 3_600)}h`;\n if (s >= 60) return `${Math.floor(s / 60)}m`;\n return `${s}s`;\n}\n\n/**\n * Pure liveness verdict. Degraded when the feature is enabled AND any of: the\n * last-extraction watermark could not be READ (a storage fault, §22), the buffer\n * read failed (a pipeline fault, §22), claimed turns exist and the oldest has\n * waited longer than the staleness window (#3442 — the in-memory watermark can\n * stay fresh while claimed turns pile up invisibly), or the buffer is non-empty\n * and the watermark is absent or stale. Each cause yields a DISTINCT reason so\n * an operator can tell a meta-read failure from a buffer-read failure from a\n * pipeline that has genuinely never extracted.\n *\n * Staleness uses a half-open freshness window (§23): an extraction is fresh\n * while its age is in `[0, staleWindowMs)`, so an age of EXACTLY `staleWindowMs`\n * is stale (the upper bound on \"fresh\" is exclusive). A null/unparsable watermark\n * means \"never succeeded\" and is treated as stale — as is a FUTURE watermark (a\n * clock-skewed or corrupt timestamp ahead of now must not read as a fresh\n * extraction and hide a real backlog stall). The claimed-turn rule shares the\n * half-open window and stays inert when no verified sidecar reports an\n * oldest-turn timestamp: \"unknown age\" is not \"fresh\" and not \"stale\".\n */\nexport function evaluateExtractionLiveness(input: {\n config: ExtractionLivenessConfig;\n lastExtractionAt: string | null;\n snapshot: ExtractionBufferSnapshot;\n nowMs: number;\n metaReadFailed?: boolean;\n metaReadError?: string;\n watermarkPending?: boolean;\n /** Daemon-wide claimed-drain totals (sidecar scan); absent → no claim fields. */\n claims?: DrainClaimTotals | null;\n /** Last extraction-LLM failure; appended to the claimed-backlog reason when present. */\n llmFailureReason?: string | null;\n}): ExtractionLivenessStatus {\n const { config, lastExtractionAt, snapshot, nowMs } = input;\n const lastMs = lastExtractionAt !== null ? Date.parse(lastExtractionAt) : Number.NaN;\n const hasWatermark = Number.isFinite(lastMs);\n const ageMs = nowMs - lastMs;\n // A future watermark (negative age) is clock-skewed or corrupt data, not a\n // fresh extraction: treat it as stale so a real backlog stall is not hidden.\n const stale = !hasWatermark || ageMs < 0 || ageMs >= config.staleWindowMs;\n const hasBacklog = snapshot.bufferedSessionCount > 0;\n // A watermark or buffer that cannot be READ is a fault, not an empty queue\n // (§22): a storage/pipeline outage must not read as healthy, and must stay\n // distinct from a pipeline that has genuinely never extracted.\n const metaReadFailed = input.metaReadFailed === true;\n const watermarkPending = input.watermarkPending === true;\n const readFailed = snapshot.readFailed === true;\n const claims = input.claims ?? null;\n const claimsPending = claims?.claimedPendingTurns ?? 0;\n const claimsOldestAge = ageMsFrom(claims?.oldestClaimedTurnAt ?? null, nowMs);\n const claimedStale = claimsPending > 0 && claimsOldestAge !== null && claimsOldestAge >= config.staleWindowMs;\n const degraded =\n config.enabled && (metaReadFailed || readFailed || claimedStale || (!watermarkPending && hasBacklog && stale));\n\n let degradedReason: string | null = null;\n if (degraded) {\n if (metaReadFailed) {\n degradedReason = `extraction watermark unreadable: ${input.metaReadError ?? \"meta read failed\"}`;\n } else if (readFailed) {\n degradedReason = `extraction buffer unreadable: ${snapshot.readError ?? \"buffer snapshot read failed\"}`;\n } else if (claimedStale) {\n degradedReason =\n `claimed drain backlog: ${claims?.claimedSessions ?? 0} claimed session(s), ` +\n `${claimsPending} claimed turn(s) pending extraction, oldest waiting ${formatAgeMs(claimsOldestAge ?? 0)}` +\n (claims?.truncated === true ? \" (scan truncated)\" : \"\") +\n (input.llmFailureReason ? `; extraction LLM unavailable: ${input.llmFailureReason}` : \"\");\n } else {\n const watermark = hasWatermark\n ? `last succeeded ${formatAgeMs(nowMs - lastMs)} ago`\n : \"no successful extraction on record\";\n degradedReason =\n `${watermark}; ${snapshot.bufferedSessionCount} buffered session(s), ` +\n `${snapshot.pendingTurnCount} turn(s) pending extraction`;\n }\n }\n\n const status: ExtractionLivenessStatus = {\n lastExtractionAt,\n bufferedSessionCount: snapshot.bufferedSessionCount,\n pendingTurnCount: snapshot.pendingTurnCount,\n oldestBufferedTurnAgeMs: ageMsFrom(snapshot.oldestTurnTimestamp, nowMs),\n degraded,\n degradedReason,\n ...(watermarkPending ? { watermarkPending: true } : {}),\n watermarkScope: \"aggregate\",\n };\n if (claims !== null) {\n status.claimedSessionCount = claims.claimedSessions;\n status.claimedPendingTurnCount = claimsPending;\n status.oldestClaimedTurnAgeMs = claimsOldestAge;\n status.oldestClaimedAgeBasis = claims.oldestClaimedAgeBasis;\n status.claimedBacklogUnverified = claims.unverifiedClaims;\n status.claimedBacklogPendingInbox = claims.claimsPendingInbox;\n status.claimedBacklogTruncated = claims.truncated === true;\n }\n return status;\n}\n\nconst EMPTY_SNAPSHOT: ExtractionBufferSnapshot = {\n bufferedSessionCount: 0,\n pendingTurnCount: 0,\n oldestTurnTimestamp: null,\n};\n\n/**\n * Read a buffer snapshot without throwing. An ABSENT buffer degrades to an empty\n * (healthy) snapshot — some service constructions have no orchestrator buffer. A\n * buffer that EXISTS but whose read throws yields a `readFailed` snapshot so the\n * verdict can distinguish a pipeline fault from an empty queue (§22).\n */\nasync function readBufferSnapshot(\n buffer: ExtractionBufferSource | undefined,\n): Promise<ExtractionBufferSnapshot> {\n if (!buffer || typeof buffer.getBufferSnapshot !== \"function\") return EMPTY_SNAPSHOT;\n try {\n return await buffer.getBufferSnapshot();\n } catch (err) {\n return {\n ...EMPTY_SNAPSHOT,\n readFailed: true,\n readError: err instanceof Error ? err.message : String(err),\n };\n }\n}\n\n/**\n * Gather the liveness status from an aggregate watermark read and an optional\n * buffer. A read failure on either side is surfaced as a degraded status with a\n * distinct reason rather than swallowed into a healthy-looking verdict.\n */\nexport async function gatherExtractionLivenessStatus(input: {\n config: ExtractionLivenessConfig;\n watermark: ExtractionWatermarkOrStorage;\n buffer: ExtractionBufferSource | undefined;\n nowMs: number;\n claims?: DrainClaimTotals | null;\n}): Promise<ExtractionLivenessStatus> {\n const { config, buffer, nowMs } = input;\n const watermarkRead = await coerceExtractionWatermark(input.watermark);\n const snapshot = await readBufferSnapshot(buffer);\n return evaluateExtractionLiveness({\n config,\n lastExtractionAt: watermarkRead.lastExtractionAt,\n snapshot,\n nowMs,\n metaReadFailed: watermarkRead.readFailed,\n metaReadError: watermarkRead.readError,\n watermarkPending: watermarkRead.pending,\n claims: input.claims,\n // #3442: the claimed-backlog reason names the last failure while the\n // extractor is unreachable, matching the /health llm block.\n llmFailureReason: getExtractionLlmHealth().lastFailureReason,\n });\n}\n\n/**\n * Aggregated-WARN throttle (issue #2151): emit at most ONE warning per\n * staleness window while degraded — not one line per failed extraction attempt.\n * State is instance-scoped (held by the owning service), never a module global\n * (§5), so multiple service instances throttle independently.\n */\nexport class ExtractionLivenessWarnThrottle {\n private lastWarnAtMs: number | null = null;\n\n /** Warn if degraded and outside the throttle window; returns whether a WARN was emitted. */\n maybeWarn(status: ExtractionLivenessStatus, staleWindowMs: number, nowMs: number): boolean {\n if (!status.degraded) {\n // Recovered (or never degraded): reset so a fresh episode warns at once.\n this.lastWarnAtMs = null;\n return false;\n }\n if (this.lastWarnAtMs !== null && nowMs - this.lastWarnAtMs < staleWindowMs) return false;\n this.lastWarnAtMs = nowMs;\n log.warn(\n `extraction pipeline liveness degraded: ${status.degradedReason ?? \"buffered turns are not being extracted\"}`,\n );\n return true;\n }\n}\n\n/**\n * Normalize the `extractionLiveness` block at the read boundary. `parseConfig`\n * always populates it, but a host adapter, an older persisted config, or a\n * hand-built `PluginConfig` can hand us an absent, partial, or loosely-typed\n * block - and every liveness surface (/health, doctor, stats) must degrade to\n * the documented default (enabled, 24h window) rather than throw. Both fields\n * are coerced with the same rules as `parseExtractionLivenessConfig` (§24:\n * `\"false\"`/`\"0\"` read as falsy; a numeric string like `\"5000\"` parses), except a\n * present but non-integer or non-positive `staleWindowMs` falls back to the\n * default here rather than throwing.\n */\nexport function resolveExtractionLivenessConfig(\n block: { enabled?: unknown; staleWindowMs?: unknown } | undefined,\n): ExtractionLivenessConfig {\n const staleWindowMs = coerceNumber(block?.staleWindowMs);\n return {\n enabled: coerceBool(block?.enabled) ?? true,\n staleWindowMs:\n staleWindowMs !== undefined && Number.isInteger(staleWindowMs) && staleWindowMs >= 1\n ? staleWindowMs\n : DEFAULT_STALE_WINDOW_MS,\n };\n}\n\n/**\n * Compute the daemon-wide liveness status for the authenticated `/health`\n * payload and emit the throttled aggregate warning.\n */\nexport async function computeExtractionLivenessStatus(\n orchestrator: ExtractionLivenessOrchestratorLike,\n watermark: ExtractionWatermarkOrStorage,\n throttle?: ExtractionLivenessWarnThrottle,\n nowMs: number = Date.now(),\n /**\n * #3442 claimed-drain totals provider (access-service: the root storage's\n * cheap sidecar scan). Absent → no claim fields on the status. A throwing\n * provider is logged and treated as absent rather than degrading: the scan\n * itself already reads as an empty backlog on fs errors, and fakes/storage\n * variants without a claims store must not flip health to degraded.\n */\n drainClaimTotals?: () => Promise<DrainClaimTotals | null>,\n): Promise<ExtractionLivenessStatus> {\n const config = resolveExtractionLivenessConfig(orchestrator.config.extractionLiveness);\n let claims: DrainClaimTotals | null = null;\n if (drainClaimTotals !== undefined) {\n try {\n claims = await drainClaimTotals();\n } catch (err) {\n claims = null;\n log.debug(`extraction liveness: claimed drain totals unavailable: ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n const status = await gatherExtractionLivenessStatus({\n config,\n watermark,\n buffer: orchestrator.buffer,\n nowMs,\n claims,\n });\n throttle?.maybeWarn(status, config.staleWindowMs, nowMs);\n // Extraction-LLM availability (#3140): a silent no_models / LLM-unreachable\n // outage must be visible on /health (and doctor/stats) without debug logs.\n return { ...status, ...getExtractionLlmHealth() };\n}\n\n/**\n * `remnic doctor` check for extraction-pipeline liveness. Status `warn` when\n * degraded (with a remediation hint), `ok` otherwise.\n */\nexport async function summarizeExtractionLiveness(\n config: Pick<PluginConfig, \"extractionLiveness\">,\n watermark: ExtractionWatermarkOrStorage,\n buffer?: ExtractionBufferSource,\n nowMs: number = Date.now(),\n): Promise<OperatorDoctorCheck> {\n const livenessConfig = resolveExtractionLivenessConfig(config.extractionLiveness);\n const status = await gatherExtractionLivenessStatus({\n config: livenessConfig,\n watermark,\n buffer,\n nowMs,\n });\n const scopeNote = ` Watermark scope: ${status.watermarkScope}.`;\n const summary =\n (status.degraded\n ? `Extraction pipeline degraded: ${status.degradedReason}.`\n : `Extraction pipeline healthy: last extraction ${status.lastExtractionAt ?? \"never\"}, ` +\n `${status.bufferedSessionCount} buffered session(s), ${status.pendingTurnCount} turn(s) pending` +\n `${livenessConfig.enabled ? \"\" : \" (liveness check disabled)\"}.`) + scopeNote;\n return {\n key: \"extraction_liveness\",\n status: status.degraded ? \"warn\" : \"ok\",\n summary,\n remediation: status.degraded\n ? \"Extraction has stalled while turns are buffered. Inspect daemon logs for extraction \" +\n \"timeouts or fallback-no-parsed-output errors, verify the extraction model/provider is \" +\n \"reachable, then force a flush (e.g. `remnic flush`).\"\n : undefined,\n details: { ...status, staleWindowMs: livenessConfig.staleWindowMs, enabled: livenessConfig.enabled },\n };\n}\n\n/**\n * Lines for `remnic stats`: the aggregate extraction watermark, root metadata\n * counters, buffer backlog, and liveness verdict. Root counter failures render\n * those counters unavailable; the injected aggregate read alone determines\n * watermark liveness so stats cannot diverge from health and doctor.\n */\nexport async function renderExtractionLivenessStats(\n orchestrator: ExtractionLivenessOrchestratorLike,\n watermark: ExtractionWatermarkRead,\n nowMs: number = Date.now(),\n): Promise<string[]> {\n const status = evaluateExtractionLiveness({\n config: resolveExtractionLivenessConfig(orchestrator.config.extractionLiveness),\n lastExtractionAt: watermark.lastExtractionAt,\n snapshot: await readBufferSnapshot(orchestrator.buffer),\n nowMs,\n metaReadFailed: watermark.readFailed,\n metaReadError: watermark.readError,\n watermarkPending: watermark.pending,\n });\n const oldestAge =\n status.oldestBufferedTurnAgeMs !== null ? formatAgeMs(status.oldestBufferedTurnAgeMs) : \"n/a\";\n const rootStats = watermark.rootStats;\n const watermarkDisplay = watermark.readFailed\n ? \"unavailable\"\n : watermark.pending\n ? \"pending\"\n : status.lastExtractionAt ?? \"never\";\n return [\n `Extractions: ${rootStats?.extractionCount ?? \"unavailable\"}`,\n `Last extraction: ${watermarkDisplay}`,\n `Last consolidation: ${rootStats ? rootStats.lastConsolidationAt ?? \"never\" : \"unavailable\"}`,\n `Buffered sessions: ${status.bufferedSessionCount} (${status.pendingTurnCount} turns pending)`,\n `Oldest buffered turn age: ${oldestAge}`,\n `Extraction watermark scope: ${status.watermarkScope}`,\n `Extraction liveness: ${status.degraded ? `DEGRADED — ${status.degradedReason}` : \"ok\"}`,\n ];\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAM,0BAA0B;AAsDhC,eAAsB,0BACpB,WACkC;AAClC,MAAI,aAAa,gBAAgB,aAAa,OAAO,UAAU,eAAe,WAAW;AACvF,WAAO;AAAA,EACT;AACA,MAAI;AACF,QAAI,mBAAkC;AACtC,QAAI,cAAc,aAAa,OAAO,UAAU,aAAa,YAAY;AACvE,YAAM,OAAO,MAAM,UAAU,SAAS;AACtC,yBAAmB,MAAM,oBAAoB;AAAA,IAC/C,WAAW,kBAAkB,aAAa,OAAO,UAAU,iBAAiB,YAAY;AACtF,YAAM,OAAO,MAAM,UAAU,aAAa;AAC1C,yBAAmB,MAAM,oBAAoB;AAAA,IAC/C;AACA,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,EACF,SAAS,OAAO;AACd,WAAO;AAAA,MACL,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,IAClE;AAAA,EACF;AACF;AAoEO,SAAS,8BACd,KAC0B;AAC1B,QAAM,MAAM,IAAI;AAChB,MAAI,QAAQ,WAAc,QAAQ,QAAQ,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,IAAI;AACxF,UAAM,IAAI,MAAM,kDAAkD,KAAK,UAAU,GAAG,CAAC,GAAG;AAAA,EAC1F;AACA,QAAM,QAAS,OAAO,CAAC;AACvB,SAAO;AAAA;AAAA;AAAA,IAGL,SA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AAW,SAAS;AAAA,IACnC;AAAA,IACA,aAAa,OAAO,WAChB,mOAGA;AAAA,IACJ,SAAS,EAAE,GAAG,QAAQ,eAAe,eAAe,eAAe,SAAS,eAAe,QAAQ;AAAA,EACrG;AACF;AAQA,eAAsB,8BACpB,cACA,WACA,QAAgB,KAAK,IAAI,GACN;AACnB,QAAM,SAAS,2BAA2B;AAAA,IACxC,QAAQ,gCAAgC,aAAa,OAAO,kBAAkB;AAAA,IAC9E,kBAAkB,UAAU;AAAA,IAC5B,UAAU,MAAM,mBAAmB,aAAa,MAAM;AAAA,IACtD;AAAA,IACA,gBAAgB,UAAU;AAAA,IAC1B,eAAe,UAAU;AAAA,IACzB,kBAAkB,UAAU;AAAA,EAC9B,CAAC;AACD,QAAM,YACJ,OAAO,4BAA4B,OAAO,YAAY,OAAO,uBAAuB,IAAI;AAC1F,QAAM,YAAY,UAAU;AAC5B,QAAM,mBAAmB,UAAU,aAC/B,gBACA,UAAU,UACR,YACA,OAAO,oBAAoB;AACjC,SAAO;AAAA,IACL,gBAAgB,WAAW,mBAAmB,aAAa;AAAA,IAC3D,oBAAoB,gBAAgB;AAAA,IACpC,uBAAuB,YAAY,UAAU,uBAAuB,UAAU,aAAa;AAAA,IAC3F,sBAAsB,OAAO,oBAAoB,KAAK,OAAO,gBAAgB;AAAA,IAC7E,6BAA6B,SAAS;AAAA,IACtC,+BAA+B,OAAO,cAAc;AAAA,IACpD,wBAAwB,OAAO,WAAW,mBAAc,OAAO,cAAc,KAAK,IAAI;AAAA,EACxF;AACF;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readNamespaceMaintenanceLastRanStatuses,
|
|
4
4
|
readNamespaceMaintenanceStatuses,
|
|
5
5
|
runNamespaceMaintenancePlan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JK2IVISS.js";
|
|
7
7
|
import {
|
|
8
8
|
analyzeSessionIntegrity,
|
|
9
9
|
applySessionRepair,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-CMTINOFS.js";
|
|
15
15
|
import {
|
|
16
16
|
summarizeCorpusAndReplica
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JCPEXUNP.js";
|
|
18
18
|
import {
|
|
19
19
|
readJudgeVerdictStats
|
|
20
20
|
} from "./chunk-OZKOPQCM.js";
|
|
@@ -27,17 +27,17 @@ import {
|
|
|
27
27
|
} from "./chunk-JKMIGCK6.js";
|
|
28
28
|
import {
|
|
29
29
|
resolveCorpusNamespaceRoots
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MGCV3VGC.js";
|
|
31
31
|
import {
|
|
32
32
|
listNamespaces
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-MCTGYIYN.js";
|
|
34
34
|
import {
|
|
35
35
|
runConsolidationProvenanceCheck
|
|
36
36
|
} from "./chunk-ZUMHQEW4.js";
|
|
37
37
|
import {
|
|
38
38
|
listMemoryGovernanceRuns,
|
|
39
39
|
readMemoryGovernanceRunArtifact
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PPPY2PCU.js";
|
|
41
41
|
import {
|
|
42
42
|
resolveCuratedIncludeFilesStatePath,
|
|
43
43
|
resolveNativeKnowledgeStatePath,
|
|
@@ -51,13 +51,13 @@ import {
|
|
|
51
51
|
} from "./chunk-YBPYIAA5.js";
|
|
52
52
|
import {
|
|
53
53
|
parseConfig
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-NYZ6ZNFO.js";
|
|
55
55
|
import {
|
|
56
56
|
summarizeExtractionLiveness
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-DURQZFVJ.js";
|
|
58
58
|
import {
|
|
59
59
|
StorageManager
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-LR2X3FJM.js";
|
|
61
61
|
import {
|
|
62
62
|
lintWorkspaceFiles
|
|
63
63
|
} from "./chunk-DM2T26WE.js";
|
|
@@ -1876,4 +1876,4 @@ export {
|
|
|
1876
1876
|
runBenchmarkRecall,
|
|
1877
1877
|
runOperatorRepair
|
|
1878
1878
|
};
|
|
1879
|
-
//# sourceMappingURL=chunk-
|
|
1879
|
+
//# sourceMappingURL=chunk-FPBFDQZZ.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-3UXOZBHV.js";
|
|
15
15
|
import {
|
|
16
16
|
StorageManager
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LR2X3FJM.js";
|
|
18
18
|
import {
|
|
19
19
|
OKF_PROFILE_TYPE,
|
|
20
20
|
okfTypeForMemory
|
|
@@ -272,4 +272,4 @@ export {
|
|
|
272
272
|
exportOkfBundle,
|
|
273
273
|
firstHeading
|
|
274
274
|
};
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
275
|
+
//# sourceMappingURL=chunk-GWFL6LUU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseEntityFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LR2X3FJM.js";
|
|
4
4
|
import {
|
|
5
5
|
inferMemoryStatus
|
|
6
6
|
} from "./chunk-7RJUVTVF.js";
|
|
@@ -253,4 +253,4 @@ export {
|
|
|
253
253
|
WHO_KNOWS_MCP_TOOLS,
|
|
254
254
|
handleWhoKnowsHttpQuery
|
|
255
255
|
};
|
|
256
|
-
//# sourceMappingURL=chunk-
|
|
256
|
+
//# sourceMappingURL=chunk-HJ7M322C.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
computeCorpusWatermarks,
|
|
6
6
|
resolveCorpusNamespaceRoots
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MGCV3VGC.js";
|
|
8
8
|
|
|
9
9
|
// src/operator-doctor-corpus.ts
|
|
10
10
|
var DIGEST_PREFIX_LENGTH = 12;
|
|
@@ -78,4 +78,4 @@ export {
|
|
|
78
78
|
corpusWatermarksFromCheck,
|
|
79
79
|
summarizeCorpusAndReplica
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-JCPEXUNP.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot,
|
|
3
3
|
resolveNamespaceStorageRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YPE3O5VH.js";
|
|
5
5
|
import {
|
|
6
6
|
getConfiguredNamespaces
|
|
7
7
|
} from "./chunk-UPWOMMVU.js";
|
|
@@ -2308,4 +2308,4 @@ export {
|
|
|
2308
2308
|
runNamespaceMaintenancePlan,
|
|
2309
2309
|
runNamespaceMaintenanceBatchPlan
|
|
2310
2310
|
};
|
|
2311
|
-
//# sourceMappingURL=chunk-
|
|
2311
|
+
//# sourceMappingURL=chunk-JK2IVISS.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseExtractionLivenessConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DURQZFVJ.js";
|
|
4
4
|
|
|
5
5
|
// src/extraction-span-config.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
parseExtractionFields,
|
|
51
51
|
parseExtractionSpanConfig
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-LNQQEFKH.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-O3JG4PD3.js";
|
|
23
23
|
import {
|
|
24
24
|
BufferSessionFiles
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-UWU6KEZU.js";
|
|
26
26
|
import {
|
|
27
27
|
normalizeQmdResultPath,
|
|
28
28
|
resolveNamespaceResultPath
|
|
@@ -13315,4 +13315,4 @@ export {
|
|
|
13315
13315
|
isValidBufferSurpriseEvent,
|
|
13316
13316
|
StorageManager3 as StorageManager
|
|
13317
13317
|
};
|
|
13318
|
-
//# sourceMappingURL=chunk-
|
|
13318
|
+
//# sourceMappingURL=chunk-LR2X3FJM.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-ZCUTSMR2.js";
|
|
14
14
|
import {
|
|
15
15
|
StorageManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LR2X3FJM.js";
|
|
17
17
|
import {
|
|
18
18
|
excludeSupportPassportPrivateMemories
|
|
19
19
|
} from "./chunk-NS7U4ZYU.js";
|
|
@@ -134,4 +134,4 @@ export {
|
|
|
134
134
|
runCodexMaterialize,
|
|
135
135
|
runPostConsolidationMaterialize
|
|
136
136
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-LU2GQ4Q4.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NamespaceStorageRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YPE3O5VH.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceCollectionName
|
|
6
6
|
} from "./chunk-BFDXJHYG.js";
|
|
@@ -213,4 +213,4 @@ export {
|
|
|
213
213
|
verifyNamespaces,
|
|
214
214
|
runNamespaceMigration
|
|
215
215
|
};
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
216
|
+
//# sourceMappingURL=chunk-MCTGYIYN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listNamespaces
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MCTGYIYN.js";
|
|
4
4
|
import {
|
|
5
5
|
corpusScanWorker
|
|
6
6
|
} from "./chunk-4LZ7SVKM.js";
|
|
@@ -292,4 +292,4 @@ export {
|
|
|
292
292
|
computeServiceCorpusWatermarks,
|
|
293
293
|
computeServiceCorpusCensus
|
|
294
294
|
};
|
|
295
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-MGCV3VGC.js.map
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "./chunk-H4WG3UQZ.js";
|
|
65
65
|
import {
|
|
66
66
|
parseExtractionFields
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-LNQQEFKH.js";
|
|
68
68
|
import {
|
|
69
69
|
parseExternalWikiRoots
|
|
70
70
|
} from "./chunk-NDNTNE3S.js";
|
|
@@ -5858,4 +5858,4 @@ export {
|
|
|
5858
5858
|
VALID_MEMORY_CATEGORIES,
|
|
5859
5859
|
parseConfig
|
|
5860
5860
|
};
|
|
5861
|
-
//# sourceMappingURL=chunk-
|
|
5861
|
+
//# sourceMappingURL=chunk-NYZ6ZNFO.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rebuildMemoryLifecycleLedger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AYBRQJXP.js";
|
|
4
4
|
import {
|
|
5
5
|
PROJECTION_REBUILD_RUNNER_FLAG
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7TC2PWKH.js";
|
|
7
7
|
import {
|
|
8
8
|
startLocationAutoSync
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YCJRYM3Q.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureContradictionScanCron,
|
|
12
12
|
ensureDaySummaryCron,
|
|
@@ -21,14 +21,14 @@ import {
|
|
|
21
21
|
isIsoWeekId,
|
|
22
22
|
msUntilNextIsoWeek,
|
|
23
23
|
previousIsoWeekId
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-XUWDB53W.js";
|
|
25
25
|
import {
|
|
26
26
|
planNamespaceMaintenance,
|
|
27
27
|
runNamespaceMaintenanceBatchPlan
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JK2IVISS.js";
|
|
29
29
|
import {
|
|
30
30
|
rebuildMemoryProjection
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-XMKUABIG.js";
|
|
32
32
|
import {
|
|
33
33
|
LocalLlmClient
|
|
34
34
|
} from "./chunk-ASINXIKX.js";
|
|
@@ -2874,4 +2874,4 @@ export {
|
|
|
2874
2874
|
ActivitySyncScheduler,
|
|
2875
2875
|
MaintenanceScheduler
|
|
2876
2876
|
};
|
|
2877
|
-
//# sourceMappingURL=chunk-
|
|
2877
|
+
//# sourceMappingURL=chunk-ORMJT23N.js.map
|