@remnic/core 10.0.188 → 10.0.190
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 +2 -2
- package/dist/access-cli.js +2 -2
- package/dist/access-extraction-force-flush-preempt.js +2 -2
- package/dist/access-extraction-force-flush.d.ts.map +1 -1
- package/dist/access-extraction-force-flush.js +2 -2
- package/dist/access-http-briefing.js +2 -2
- package/dist/access-http-query.js +2 -2
- package/dist/access-http.js +2 -2
- package/dist/access-identity-continuity-surface.js +2 -2
- package/dist/access-lcm-surface.js +2 -2
- package/dist/access-mcp.js +2 -2
- package/dist/access-observe-helpers.d.ts +1 -4
- package/dist/access-observe-helpers.d.ts.map +1 -1
- package/dist/access-observe-helpers.js +1 -1
- package/dist/access-observe-write-surface.d.ts +0 -4
- package/dist/access-observe-write-surface.d.ts.map +1 -1
- package/dist/access-observe-write-surface.js +2 -2
- package/dist/access-operations-batch.js +2 -2
- package/dist/access-operations.js +2 -2
- package/dist/access-recall-concurrency.js +2 -2
- package/dist/access-recall-response.js +2 -2
- package/dist/access-recall-surface.js +2 -2
- package/dist/access-service.d.ts +0 -2
- package/dist/access-service.d.ts.map +1 -1
- package/dist/access-service.js +2 -2
- package/dist/{chunk-T3XOP7TA.js → chunk-7X6EZ2QB.js} +2 -2
- package/dist/{chunk-MTKSH7HY.js → chunk-ABPOW3SX.js} +44 -74
- package/dist/chunk-ABPOW3SX.js.map +1 -0
- package/dist/{chunk-CYTTY4M2.js → chunk-OPXK5IQU.js} +47 -47
- package/dist/chunk-OPXK5IQU.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/explicit-capture.js +2 -2
- package/dist/index.js +2 -2
- package/dist/orchestration/backlog-scheduler.js +3 -3
- package/dist/orchestration/buffer-drain-runner.js +3 -3
- package/dist/orchestration/extraction-queue-coordinator.d.ts +14 -1
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestrator.js +2 -2
- package/dist/recall-navigation.js +2 -2
- package/package.json +2 -2
- package/src/access-extraction-force-flush-preempt-coordinator.test.ts +71 -0
- package/src/access-extraction-force-flush.ts +20 -56
- package/src/access-observe-helpers.test.ts +71 -88
- package/src/access-observe-helpers.ts +60 -73
- package/src/access-observe-write-surface.ts +1 -22
- package/src/access-service-observe-lcm-parity.test.ts +176 -89
- package/src/access-service-observe-scope.test.ts +18 -86
- package/src/access-service.ts +0 -13
- package/src/orchestration/extraction-queue-coordinator.ts +34 -3
- package/dist/chunk-CYTTY4M2.js.map +0 -1
- package/dist/chunk-MTKSH7HY.js.map +0 -1
- /package/dist/{chunk-T3XOP7TA.js.map → chunk-7X6EZ2QB.js.map} +0 -0
|
@@ -1399,7 +1399,7 @@ import {
|
|
|
1399
1399
|
import {
|
|
1400
1400
|
PendingObserveExtractionTracker,
|
|
1401
1401
|
pendingObserveScopeHint
|
|
1402
|
-
} from "./chunk-
|
|
1402
|
+
} from "./chunk-OPXK5IQU.js";
|
|
1403
1403
|
import {
|
|
1404
1404
|
archiveObservedTurns
|
|
1405
1405
|
} from "./chunk-L3E7MLMK.js";
|
|
@@ -4886,6 +4886,16 @@ var ExtractionQueueCoordinator = class _ExtractionQueueCoordinator {
|
|
|
4886
4886
|
/** Preempt slots of the currently running tasks, keyed by slot identity. */
|
|
4887
4887
|
preemptSlots = /* @__PURE__ */ new Map();
|
|
4888
4888
|
preemptSeq = 0;
|
|
4889
|
+
/**
|
|
4890
|
+
* COS-825: keys whose running task was already preempted for a force-flush
|
|
4891
|
+
* once. A flush preempts a session's extraction at most once per episode:
|
|
4892
|
+
* the retried generation (the turns the preempted task left buffered) is
|
|
4893
|
+
* waited for, never killed again, until some task for the key succeeds.
|
|
4894
|
+
* This stops the livelock where every flush call killed the extraction that
|
|
4895
|
+
* was about to finish and then died on its own deadline, so nothing ever
|
|
4896
|
+
* completed.
|
|
4897
|
+
*/
|
|
4898
|
+
preemptedKeys = /* @__PURE__ */ new Set();
|
|
4889
4899
|
/** Running tasks per lane — the backlog share and the foreground floor. */
|
|
4890
4900
|
activeBacklog = 0;
|
|
4891
4901
|
activeForeground = 0;
|
|
@@ -4980,11 +4990,15 @@ var ExtractionQueueCoordinator = class _ExtractionQueueCoordinator {
|
|
|
4980
4990
|
preemptRunning(preferredKey) {
|
|
4981
4991
|
const armed = Array.from(this.preemptSlots.values()).filter((slot) => slot.armed !== void 0);
|
|
4982
4992
|
if (armed.length === 0) return;
|
|
4983
|
-
const
|
|
4984
|
-
const
|
|
4993
|
+
const latched = preferredKey !== void 0 && this.preemptedKeys.has(preferredKey);
|
|
4994
|
+
const preferred = latched ? void 0 : preferredKey !== void 0 ? armed.find((slot) => slot.key === preferredKey) : void 0;
|
|
4995
|
+
let victims = armed.some((slot) => slot.backlog !== true) ? armed.filter((slot) => slot.backlog !== true) : armed;
|
|
4996
|
+
if (latched) victims = victims.filter((slot) => slot.key !== preferredKey);
|
|
4997
|
+
if (victims.length === 0 && !preferred) return;
|
|
4985
4998
|
const chosen = preferred ?? victims.reduce((a, b) => (b.armed?.seq ?? -1) > (a.armed?.seq ?? -1) ? b : a);
|
|
4986
4999
|
const abort = chosen.armed?.abort;
|
|
4987
5000
|
chosen.armed = void 0;
|
|
5001
|
+
if (chosen.key !== void 0) this.preemptedKeys.add(chosen.key);
|
|
4988
5002
|
abort?.();
|
|
4989
5003
|
}
|
|
4990
5004
|
runPreemptable(preempt, preemptable, parent, run) {
|
|
@@ -5101,6 +5115,7 @@ var ExtractionQueueCoordinator = class _ExtractionQueueCoordinator {
|
|
|
5101
5115
|
this.preemptSlots.set(slot, { key: entry.key, backlog: entry.backlog });
|
|
5102
5116
|
try {
|
|
5103
5117
|
await entry.run(this.createPreemptHandle(slot));
|
|
5118
|
+
if (entry.key !== void 0) this.preemptedKeys.delete(entry.key);
|
|
5104
5119
|
} catch (err) {
|
|
5105
5120
|
this.logExtractionQueueFailure(err, "task");
|
|
5106
5121
|
} finally {
|
|
@@ -5122,14 +5137,21 @@ var ExtractionQueueCoordinator = class _ExtractionQueueCoordinator {
|
|
|
5122
5137
|
* `key` and abort nothing when none does. Unlike `preemptRunning` there is
|
|
5123
5138
|
* deliberately no newest-slot fallback - a keyed caller (force-flush on
|
|
5124
5139
|
* session K) must never take out an unrelated background task just
|
|
5125
|
-
* because K's own extraction is not (yet) armed.
|
|
5140
|
+
* because K's own extraction is not (yet) armed.
|
|
5141
|
+
* COS-825: at most one preemption per key episode — once K's task has
|
|
5142
|
+
* been preempted, later flushes wait for the retried work; the latch
|
|
5143
|
+
* clears when a task for K succeeds. */
|
|
5126
5144
|
preemptKeyed(key) {
|
|
5145
|
+
if (this.preemptedKeys.has(key)) return;
|
|
5146
|
+
let preempted = false;
|
|
5127
5147
|
for (const state of this.preemptSlots.values()) {
|
|
5128
5148
|
if (state.key !== key || state.armed === void 0) continue;
|
|
5129
5149
|
const abort = state.armed.abort;
|
|
5130
5150
|
state.armed = void 0;
|
|
5151
|
+
preempted = true;
|
|
5131
5152
|
abort();
|
|
5132
5153
|
}
|
|
5154
|
+
if (preempted) this.preemptedKeys.add(key);
|
|
5133
5155
|
}
|
|
5134
5156
|
createPreemptHandle(slot) {
|
|
5135
5157
|
return {
|
|
@@ -61322,70 +61344,31 @@ async function extractionForceFlush(deps, request, waitForPendingObserveExtracti
|
|
|
61322
61344
|
committed = true;
|
|
61323
61345
|
request.onCommitted?.();
|
|
61324
61346
|
};
|
|
61325
|
-
let abortHandler;
|
|
61326
61347
|
const reservationScopeHint = pendingObserveScopeHint(request);
|
|
61327
|
-
const cancelBeforeScopeResolution = () => {
|
|
61328
|
-
const explicitNamespace = request.namespace?.trim();
|
|
61329
|
-
if (explicitNamespace) {
|
|
61330
|
-
deps.cancelPendingObserveExtractions?.(
|
|
61331
|
-
request.sessionKey,
|
|
61332
|
-
authenticatedPrincipal ?? sessionPrincipal,
|
|
61333
|
-
explicitNamespace,
|
|
61334
|
-
reservationScopeHint
|
|
61335
|
-
);
|
|
61336
|
-
return;
|
|
61337
|
-
}
|
|
61338
|
-
if (reservationScopeHint !== void 0) {
|
|
61339
|
-
deps.cancelPendingObservePreparations?.(request.sessionKey, reservationScopeHint);
|
|
61340
|
-
return;
|
|
61341
|
-
}
|
|
61342
|
-
if (!namespacesEnabled) {
|
|
61343
|
-
deps.cancelPendingObserveExtractions?.(request.sessionKey);
|
|
61344
|
-
}
|
|
61345
|
-
};
|
|
61346
61348
|
try {
|
|
61347
|
-
|
|
61348
|
-
|
|
61349
|
-
|
|
61350
|
-
|
|
61351
|
-
|
|
61352
|
-
|
|
61353
|
-
|
|
61354
|
-
|
|
61355
|
-
|
|
61356
|
-
onDeadline: cancelBeforeScopeResolution
|
|
61357
|
-
}
|
|
61358
|
-
);
|
|
61359
|
-
} catch (error) {
|
|
61360
|
-
if (request.abortSignal?.aborted) cancelBeforeScopeResolution();
|
|
61361
|
-
throw error;
|
|
61362
|
-
}
|
|
61363
|
-
const cancelScopedPendingObserveExtractions = () => {
|
|
61364
|
-
deps.cancelPendingObserveExtractions?.(
|
|
61365
|
-
request.sessionKey,
|
|
61366
|
-
scope.principal,
|
|
61367
|
-
scope.writeNamespace,
|
|
61368
|
-
reservationScopeHint
|
|
61369
|
-
);
|
|
61370
|
-
};
|
|
61371
|
-
if (request.abortSignal?.aborted) cancelScopedPendingObserveExtractions();
|
|
61349
|
+
const scope = await awaitSessionFlushPhase(
|
|
61350
|
+
() => deps.resolveMemoryScopePlan(request),
|
|
61351
|
+
{
|
|
61352
|
+
abortSignal: request.abortSignal,
|
|
61353
|
+
extractionDeadlineMs: deadlineAt,
|
|
61354
|
+
reason: "access_force_flush",
|
|
61355
|
+
deadlineStage: "scope_resolution"
|
|
61356
|
+
}
|
|
61357
|
+
);
|
|
61372
61358
|
throwIfAborted(request.abortSignal, "extraction force-flush aborted");
|
|
61373
61359
|
if (deadlineAt !== void 0 && deadlineAt <= Date.now()) {
|
|
61374
|
-
cancelScopedPendingObserveExtractions();
|
|
61375
61360
|
throw new EngramAccessInputError("extraction force-flush deadline exceeded before buffer drain");
|
|
61376
61361
|
}
|
|
61377
|
-
abortHandler = cancelScopedPendingObserveExtractions;
|
|
61378
|
-
request.abortSignal?.addEventListener("abort", abortHandler, { once: true });
|
|
61379
61362
|
if (waitForPendingObserveExtraction) {
|
|
61380
|
-
let
|
|
61363
|
+
let stopWaitingForPending;
|
|
61381
61364
|
await awaitSessionFlushPhase(
|
|
61382
61365
|
() => waitForPendingObserveExtraction(
|
|
61383
61366
|
request.sessionKey,
|
|
61384
61367
|
scope.principal,
|
|
61385
61368
|
scope.writeNamespace,
|
|
61386
61369
|
request.abortSignal,
|
|
61387
|
-
(
|
|
61388
|
-
|
|
61370
|
+
(stop) => {
|
|
61371
|
+
stopWaitingForPending = stop;
|
|
61389
61372
|
},
|
|
61390
61373
|
reservationScopeHint
|
|
61391
61374
|
),
|
|
@@ -61394,9 +61377,9 @@ async function extractionForceFlush(deps, request, waitForPendingObserveExtracti
|
|
|
61394
61377
|
extractionDeadlineMs: deadlineAt,
|
|
61395
61378
|
reason: "access_force_flush",
|
|
61396
61379
|
deadlineStage: "pending_observe_extraction",
|
|
61380
|
+
// The flush budget stops the WAIT; the queued extractions continue.
|
|
61397
61381
|
onDeadline: () => {
|
|
61398
|
-
|
|
61399
|
-
cancelPendingObserveExtraction?.();
|
|
61382
|
+
stopWaitingForPending?.();
|
|
61400
61383
|
}
|
|
61401
61384
|
}
|
|
61402
61385
|
);
|
|
@@ -61420,9 +61403,10 @@ async function extractionForceFlush(deps, request, waitForPendingObserveExtracti
|
|
|
61420
61403
|
extractionDeadlineMs: deadlineAt,
|
|
61421
61404
|
reason: "access_force_flush",
|
|
61422
61405
|
deadlineStage: "buffer_drain",
|
|
61406
|
+
// The flush budget aborts its OWN drain; queued observe extractions
|
|
61407
|
+
// keep running (COS-825).
|
|
61423
61408
|
onDeadline: () => {
|
|
61424
61409
|
drainAbort.abort();
|
|
61425
|
-
cancelScopedPendingObserveExtractions();
|
|
61426
61410
|
}
|
|
61427
61411
|
}
|
|
61428
61412
|
);
|
|
@@ -61470,8 +61454,6 @@ async function extractionForceFlush(deps, request, waitForPendingObserveExtracti
|
|
|
61470
61454
|
throw new EngramAccessInputError(error.message);
|
|
61471
61455
|
}
|
|
61472
61456
|
throw error;
|
|
61473
|
-
} finally {
|
|
61474
|
-
if (abortHandler) request.abortSignal?.removeEventListener("abort", abortHandler);
|
|
61475
61457
|
}
|
|
61476
61458
|
}
|
|
61477
61459
|
|
|
@@ -61510,12 +61492,6 @@ var AccessObserveWriteSurface = class {
|
|
|
61510
61492
|
quarantineStoreInstance;
|
|
61511
61493
|
pendingObserveExtractions = new PendingObserveExtractionTracker();
|
|
61512
61494
|
observeTranscriptPersister = new ObserveTranscriptPersister();
|
|
61513
|
-
cancelPendingObservePreparations(sessionKey, scopeHint) {
|
|
61514
|
-
this.pendingObserveExtractions.cancelPreparations(sessionKey, scopeHint);
|
|
61515
|
-
}
|
|
61516
|
-
cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint, reason) {
|
|
61517
|
-
this.pendingObserveExtractions.cancel(sessionKey, principal, namespace, scopeHint, reason);
|
|
61518
|
-
}
|
|
61519
61495
|
quarantineStore() {
|
|
61520
61496
|
if (!this.quarantineStoreInstance) {
|
|
61521
61497
|
this.quarantineStoreInstance = new WriteQuarantineStore(this.deps.orchestrator.config.memoryDir);
|
|
@@ -62039,7 +62015,7 @@ var AccessObserveWriteSurface = class {
|
|
|
62039
62015
|
extraction.catch((err) => {
|
|
62040
62016
|
log.error(`access-observe background extraction failed: ${err}`);
|
|
62041
62017
|
});
|
|
62042
|
-
this.pendingObserveExtractions.track(trackedExtractionKey, extraction
|
|
62018
|
+
this.pendingObserveExtractions.track(trackedExtractionKey, extraction);
|
|
62043
62019
|
extractionQueued = true;
|
|
62044
62020
|
};
|
|
62045
62021
|
}
|
|
@@ -66233,12 +66209,6 @@ var EngramAccessService = class extends SupportPassportAccessServiceBase {
|
|
|
66233
66209
|
async extractionForceFlush(request) {
|
|
66234
66210
|
return delegateExtractionForceFlush(this.accessObserveWriteSurface, request);
|
|
66235
66211
|
}
|
|
66236
|
-
cancelPendingObservePreparations(sessionKey, scopeHint) {
|
|
66237
|
-
this.accessObserveWriteSurface.cancelPendingObservePreparations(sessionKey, scopeHint);
|
|
66238
|
-
}
|
|
66239
|
-
cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint, reason) {
|
|
66240
|
-
this.accessObserveWriteSurface.cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint, reason);
|
|
66241
|
-
}
|
|
66242
66212
|
async lcmCompactionRecord(request) {
|
|
66243
66213
|
if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
|
|
66244
66214
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
@@ -68085,4 +68055,4 @@ export {
|
|
|
68085
68055
|
EngramAccessService,
|
|
68086
68056
|
AccessAdminOpsSurface
|
|
68087
68057
|
};
|
|
68088
|
-
//# sourceMappingURL=chunk-
|
|
68058
|
+
//# sourceMappingURL=chunk-ABPOW3SX.js.map
|