@remnic/core 10.0.159 → 10.0.161
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 +1 -1
- package/dist/access-cli.js +1 -1
- package/dist/access-extraction-force-flush-preempt.js +1 -1
- package/dist/access-extraction-force-flush.js +1 -1
- package/dist/access-http-briefing.js +1 -1
- package/dist/access-http-query.js +1 -1
- package/dist/access-http.js +1 -1
- package/dist/access-identity-continuity-surface.js +1 -1
- package/dist/access-lcm-surface.js +1 -1
- package/dist/access-mcp.js +1 -1
- package/dist/access-observe-write-surface.js +1 -1
- package/dist/access-operations-batch.js +1 -1
- package/dist/access-operations.js +1 -1
- package/dist/access-recall-concurrency.js +1 -1
- package/dist/access-recall-response.js +1 -1
- package/dist/access-recall-surface.js +1 -1
- package/dist/access-service.js +1 -1
- package/dist/{chunk-3RHD5TF5.js → chunk-BFJQBCDL.js} +27 -6
- package/dist/chunk-BFJQBCDL.js.map +1 -0
- package/dist/{chunk-XC5BRK7J.js → chunk-M7BCA43N.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/explicit-capture.js +1 -1
- package/dist/index.js +1 -1
- package/dist/orchestration/backlog-scheduler.js +2 -2
- package/dist/orchestration/buffer-drain-runner.js +2 -2
- package/dist/orchestration/extraction-queue-coordinator.d.ts +11 -2
- package/dist/orchestration/extraction-queue-coordinator.d.ts.map +1 -1
- package/dist/orchestrator.js +1 -1
- package/dist/recall-navigation.js +1 -1
- package/package.json +2 -2
- package/src/orchestration/extraction-queue-coordinator.ts +29 -5
- package/src/orchestration/extraction-queue-drain-budget.test.ts +74 -0
- package/dist/chunk-3RHD5TF5.js.map +0 -1
- /package/dist/{chunk-XC5BRK7J.js.map → chunk-M7BCA43N.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ExtractionDrain,
|
|
3
3
|
TurnIngestionCoordinator,
|
|
4
4
|
shouldSkipImplicitExtraction
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BFJQBCDL.js";
|
|
6
6
|
import {
|
|
7
7
|
headerConnector,
|
|
8
8
|
renderExtractionConversation,
|
|
@@ -447,4 +447,4 @@ export {
|
|
|
447
447
|
ClaimBufferStorage,
|
|
448
448
|
BufferDrainRunner
|
|
449
449
|
};
|
|
450
|
-
//# sourceMappingURL=chunk-
|
|
450
|
+
//# sourceMappingURL=chunk-M7BCA43N.js.map
|
package/dist/cli.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
runWorkProductStatusCliCommand,
|
|
92
92
|
runWorkProjectCliCommand,
|
|
93
93
|
runWorkTaskCliCommand
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-BFJQBCDL.js";
|
|
95
95
|
import "./chunk-TH6OYP6I.js";
|
|
96
96
|
import "./chunk-PQM3B54K.js";
|
|
97
97
|
import "./chunk-2MWKUVHT.js";
|
package/dist/explicit-capture.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
shouldSkipImplicitExtraction,
|
|
9
9
|
stripInlineExplicitCaptureNotes,
|
|
10
10
|
validateExplicitCaptureInput
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BFJQBCDL.js";
|
|
12
12
|
import "./chunk-TH6OYP6I.js";
|
|
13
13
|
import "./chunk-PQM3B54K.js";
|
|
14
14
|
import "./chunk-2MWKUVHT.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BufferDrainRunner,
|
|
3
3
|
ClaimBufferStorage
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-M7BCA43N.js";
|
|
5
|
+
import "../chunk-BFJQBCDL.js";
|
|
6
6
|
import "../chunk-TH6OYP6I.js";
|
|
7
7
|
import "../chunk-PQM3B54K.js";
|
|
8
8
|
import "../chunk-2MWKUVHT.js";
|
|
@@ -105,8 +105,17 @@ export declare class ExtractionQueueCoordinator {
|
|
|
105
105
|
stopAccepting(): void;
|
|
106
106
|
/** Resume producer acceptance after an orchestrator re-initializes. */
|
|
107
107
|
resumeAccepting(): void;
|
|
108
|
-
/**
|
|
109
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Stop new producers and wait for all accepted work to finish. `timeoutMs`
|
|
110
|
+
* is the nominal budget; `tailBudgetMs` bounds the grace wait past it so a
|
|
111
|
+
* task that never settles cannot stall shutdown indefinitely. The flag is
|
|
112
|
+
* honest: false when the tail expired with work outstanding, so the
|
|
113
|
+
* caller's "did not drain" path is live. Callers persist buffered turns
|
|
114
|
+
* before this drain runs, so an abandoned tail loses nothing durable.
|
|
115
|
+
*/
|
|
116
|
+
pauseAndDrain(timeoutMs?: number, tailBudgetMs?: number): Promise<boolean>;
|
|
117
|
+
/** Name what the drain is still waiting on, for timeout diagnostics. */
|
|
118
|
+
private describeOutstanding;
|
|
110
119
|
/**
|
|
111
120
|
* Background queue processor. Runs up to `concurrency` tasks at a time,
|
|
112
121
|
* never two tasks with the same entry key. Called automatically when items
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction-queue-coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestration/extraction-queue-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH;mEACmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvF,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sEAAsE;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kD;IAClD,aAAa,IAAI,IAAI;IAIrB,uEAAuE;IACvE,eAAe,IAAI,IAAI;IAIvB
|
|
1
|
+
{"version":3,"file":"extraction-queue-coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestration/extraction-queue-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH;mEACmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvF,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAYD;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,mDAAmD;IACnD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAQ;IACzB,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,UAAU,CAAK;IACvB,wEAAwE;IACxE,OAAO,CAAC,IAAI,CAAC,CAAa;gBAEd,WAAW,SAAI;IAI3B,mDAAmD;IACnD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,2EAA2E;IAC3E,IAAI,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AAI;IAgBP;;;;;OAKG;IACG,WAAW,CAAC,SAAS,GAAE,MAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB/D;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKpE,+EAA+E;IAC/E,KAAK,IAAI,mBAAmB,GAAG,SAAS;IAIxC;;;;OAIG;IACH,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAG3C"}
|
package/dist/orchestrator.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
mergeGraphExpandedResults,
|
|
7
7
|
qmdStartupCollectionChecksWithTimeout,
|
|
8
8
|
resolveEffectiveIdentityInjectionMode
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BFJQBCDL.js";
|
|
10
10
|
import "./chunk-TH6OYP6I.js";
|
|
11
11
|
import "./chunk-PQM3B54K.js";
|
|
12
12
|
import "./chunk-2MWKUVHT.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.161",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3406,7 +3406,7 @@
|
|
|
3406
3406
|
"core"
|
|
3407
3407
|
],
|
|
3408
3408
|
"peerDependencies": {
|
|
3409
|
-
"@remnic/coding-graph": "^10.0.
|
|
3409
|
+
"@remnic/coding-graph": "^10.0.161"
|
|
3410
3410
|
},
|
|
3411
3411
|
"peerDependenciesMeta": {
|
|
3412
3412
|
"@remnic/coding-graph": {
|
|
@@ -218,13 +218,37 @@ export class ExtractionQueueCoordinator {
|
|
|
218
218
|
this.accepting = true;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
/**
|
|
222
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Stop new producers and wait for all accepted work to finish. `timeoutMs`
|
|
223
|
+
* is the nominal budget; `tailBudgetMs` bounds the grace wait past it so a
|
|
224
|
+
* task that never settles cannot stall shutdown indefinitely. The flag is
|
|
225
|
+
* honest: false when the tail expired with work outstanding, so the
|
|
226
|
+
* caller's "did not drain" path is live. Callers persist buffered turns
|
|
227
|
+
* before this drain runs, so an abandoned tail loses nothing durable.
|
|
228
|
+
*/
|
|
229
|
+
async pauseAndDrain(timeoutMs: number = 60_000, tailBudgetMs: number = 15_000): Promise<boolean> {
|
|
223
230
|
this.stopAccepting();
|
|
231
|
+
const startedMs = Date.now();
|
|
224
232
|
if (await this.waitForIdle(timeoutMs)) return true;
|
|
225
|
-
log.warn(
|
|
226
|
-
|
|
227
|
-
|
|
233
|
+
log.warn(
|
|
234
|
+
`extraction queue drain exceeded ${timeoutMs}ms; waiting up to ` +
|
|
235
|
+
`${tailBudgetMs}ms more for accepted work to settle (${this.describeOutstanding()})`,
|
|
236
|
+
);
|
|
237
|
+
if (await this.waitForIdle(tailBudgetMs)) return true;
|
|
238
|
+
log.warn(
|
|
239
|
+
`extraction queue drain abandoned after ${Date.now() - startedMs}ms; ` +
|
|
240
|
+
`${this.describeOutstanding()} still outstanding`,
|
|
241
|
+
);
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Name what the drain is still waiting on, for timeout diagnostics. */
|
|
246
|
+
private describeOutstanding(): string {
|
|
247
|
+
const names = [
|
|
248
|
+
...[...this.preemptSlots.values()].map((s) => `in-flight '${s.key ?? "(unkeyed)"}'`),
|
|
249
|
+
...this.queue.map((e) => `queued '${e.key ?? "(unkeyed)"}'`),
|
|
250
|
+
];
|
|
251
|
+
return names.length > 0 ? `outstanding: ${names.join(", ")}` : "outstanding: (none)";
|
|
228
252
|
}
|
|
229
253
|
|
|
230
254
|
/**
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import { initLogger, resetLogger } from "../logger.js";
|
|
5
|
+
import { drainExtractionAndShutdownDependencyPropagation } from "./extraction-shutdown.js";
|
|
6
|
+
import { ExtractionQueueCoordinator } from "./extraction-queue-coordinator.js";
|
|
7
|
+
|
|
8
|
+
const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
|
|
10
|
+
// pauseAndDrain's first budget is nominal today: the post-timeout wait is
|
|
11
|
+
// unbounded, so a drain can stall shutdown arbitrarily long with nothing
|
|
12
|
+
// logged about what is still in flight or how long the tail ran (issue
|
|
13
|
+
// #3517). The tail gets its own budget and the drained flag must be honest.
|
|
14
|
+
|
|
15
|
+
test("pauseAndDrain bounds the post-timeout tail and reports not-drained", async () => {
|
|
16
|
+
const queue = new ExtractionQueueCoordinator(1);
|
|
17
|
+
const { promise: block, resolve: release } = Promise.withResolvers<void>();
|
|
18
|
+
queue.enqueue(async () => {
|
|
19
|
+
await block;
|
|
20
|
+
}, { key: "slow" });
|
|
21
|
+
const outcome = await Promise.race([
|
|
22
|
+
queue.pauseAndDrain(20, 40),
|
|
23
|
+
sleep(2_000).then(() => "hung" as const),
|
|
24
|
+
]);
|
|
25
|
+
release();
|
|
26
|
+
assert.notEqual(outcome, "hung", "the post-timeout tail must be bounded, not infinite");
|
|
27
|
+
assert.equal(outcome, false, "a drain abandoned at the tail budget must report not-drained");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("pauseAndDrain returns true when accepted work settles inside the tail budget", async () => {
|
|
31
|
+
const queue = new ExtractionQueueCoordinator(1);
|
|
32
|
+
const { promise: block, resolve: release } = Promise.withResolvers<void>();
|
|
33
|
+
queue.enqueue(async () => {
|
|
34
|
+
await block;
|
|
35
|
+
}, { key: "slow" });
|
|
36
|
+
const drained = queue.pauseAndDrain(20, 1_000);
|
|
37
|
+
setTimeout(release, 60);
|
|
38
|
+
assert.equal(await drained, true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("an abandoned drain logs the outstanding entries and the elapsed time", async () => {
|
|
42
|
+
const warnings: string[] = [];
|
|
43
|
+
initLogger({ info() {}, warn: (m) => warnings.push(String(m)), error() {}, debug() {} });
|
|
44
|
+
let outcome: boolean | "hung";
|
|
45
|
+
try {
|
|
46
|
+
const queue = new ExtractionQueueCoordinator(1);
|
|
47
|
+
const { promise: block } = Promise.withResolvers<void>();
|
|
48
|
+
queue.enqueue(async () => {
|
|
49
|
+
await block;
|
|
50
|
+
}, { key: "slow-extraction-key" });
|
|
51
|
+
outcome = await Promise.race([
|
|
52
|
+
queue.pauseAndDrain(20, 40),
|
|
53
|
+
sleep(500).then(() => "hung" as const),
|
|
54
|
+
]);
|
|
55
|
+
} finally {
|
|
56
|
+
resetLogger();
|
|
57
|
+
}
|
|
58
|
+
assert.notEqual(outcome, "hung", "drain must not hang to reach the abandonment log");
|
|
59
|
+
const named = warnings.find((w) => w.includes("slow-extraction-key"));
|
|
60
|
+
assert.ok(
|
|
61
|
+
named,
|
|
62
|
+
`expected a warning naming the outstanding entry key; got: ${warnings.join(" | ") || "(none)"}`,
|
|
63
|
+
);
|
|
64
|
+
assert.match(named, /\d+\s?ms|elapsed/i, "the abandonment warning must report elapsed time");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("a false drained flag reaches the shutdown path as a drain error", async () => {
|
|
68
|
+
const err = await drainExtractionAndShutdownDependencyPropagation(
|
|
69
|
+
{ pauseAndDrain: async () => false },
|
|
70
|
+
{ shutdown: async () => {} },
|
|
71
|
+
);
|
|
72
|
+
assert.ok(err instanceof Error, "not-drained must surface as an error, not silently pass");
|
|
73
|
+
assert.match(String(err), /did not drain/);
|
|
74
|
+
});
|