@rulvar/cli 1.92.0 → 1.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -4
- package/dist/index.js +17 -5
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -256,9 +256,12 @@ interface CreateServerOptions {
|
|
|
256
256
|
* and counted. A replay that no longer reaches back to a client's
|
|
257
257
|
* cursor carries `x-rulvar-events-dropped: <count>` and a leading SSE
|
|
258
258
|
* comment naming the first retained seq; the journal remains the
|
|
259
|
-
* durable record of the run itself.
|
|
260
|
-
*
|
|
261
|
-
*
|
|
259
|
+
* durable record of the run itself. Defaults to
|
|
260
|
+
* {@link DEFAULT_MAX_BUFFERED_EVENTS_PER_RUN} (RV409; before v1.94.0
|
|
261
|
+
* absent meant unbounded, and an explicit huge bound such as
|
|
262
|
+
* `Number.MAX_SAFE_INTEGER` restores that behavior in effect).
|
|
263
|
+
* Validated at construction: a positive safe integer, anything else
|
|
264
|
+
* is a typed ConfigError.
|
|
262
265
|
*/
|
|
263
266
|
maxBufferedEventsPerRun?: number;
|
|
264
267
|
/**
|
|
@@ -284,6 +287,18 @@ interface CreateServerOptions {
|
|
|
284
287
|
* cannot grow process memory past a few megabytes per connection.
|
|
285
288
|
*/
|
|
286
289
|
declare const DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT = 1e4;
|
|
290
|
+
/**
|
|
291
|
+
* The default per-run replay-buffer bound (RV409): generous enough
|
|
292
|
+
* that any ordinary run keeps its full replay (lifecycle events number
|
|
293
|
+
* in the hundreds; only long `agent:stream` delta torrents approach
|
|
294
|
+
* tens of thousands), small enough that one delta-heavy run cannot
|
|
295
|
+
* grow process memory past a few tens of megabytes. Past the bound the
|
|
296
|
+
* oldest events are dropped and the replay marks the gap; the journal
|
|
297
|
+
* remains the durable record. Before v1.94.0 an absent
|
|
298
|
+
* `maxBufferedEventsPerRun` meant unbounded; set an explicit huge
|
|
299
|
+
* bound (`Number.MAX_SAFE_INTEGER`) to restore that in effect.
|
|
300
|
+
*/
|
|
301
|
+
declare const DEFAULT_MAX_BUFFERED_EVENTS_PER_RUN = 5e4;
|
|
287
302
|
interface RulvarServer {
|
|
288
303
|
fetch(req: Request): Promise<Response>;
|
|
289
304
|
}
|
|
@@ -416,4 +431,4 @@ declare function toOtel(run: {
|
|
|
416
431
|
result: Promise<RunOutcome<unknown>>;
|
|
417
432
|
}, tracer: TracerLike, options?: ToOtelOptions): Promise<number>;
|
|
418
433
|
//#endregion
|
|
419
|
-
export { type AssembledCli, type CliConfig, type CliIo, type CommandContext, type CreateServerOptions, type CreateWorkerOptions, DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, type KbSweepCliConfig, type LoadedWorkflowModule, type OtelContextApi, type PreflightDeclaration, type RulvarServer, type SpanLike, type ToOtelOptions, type TracerLike, type Worker, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, invoiceCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, preflightCommand, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
|
434
|
+
export { type AssembledCli, type CliConfig, type CliIo, type CommandContext, type CreateServerOptions, type CreateWorkerOptions, DEFAULT_MAX_BUFFERED_EVENTS_PER_RUN, DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, type KbSweepCliConfig, type LoadedWorkflowModule, type OtelContextApi, type PreflightDeclaration, type RulvarServer, type SpanLike, type ToOtelOptions, type TracerLike, type Worker, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, invoiceCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, preflightCommand, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,18 @@ import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHe
|
|
|
42
42
|
* cannot grow process memory past a few megabytes per connection.
|
|
43
43
|
*/
|
|
44
44
|
const DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT = 1e4;
|
|
45
|
+
/**
|
|
46
|
+
* The default per-run replay-buffer bound (RV409): generous enough
|
|
47
|
+
* that any ordinary run keeps its full replay (lifecycle events number
|
|
48
|
+
* in the hundreds; only long `agent:stream` delta torrents approach
|
|
49
|
+
* tens of thousands), small enough that one delta-heavy run cannot
|
|
50
|
+
* grow process memory past a few tens of megabytes. Past the bound the
|
|
51
|
+
* oldest events are dropped and the replay marks the gap; the journal
|
|
52
|
+
* remains the durable record. Before v1.94.0 an absent
|
|
53
|
+
* `maxBufferedEventsPerRun` meant unbounded; set an explicit huge
|
|
54
|
+
* bound (`Number.MAX_SAFE_INTEGER`) to restore that in effect.
|
|
55
|
+
*/
|
|
56
|
+
const DEFAULT_MAX_BUFFERED_EVENTS_PER_RUN = 5e4;
|
|
45
57
|
const JSON_HEADERS = { "content-type": "application/json; charset=utf-8" };
|
|
46
58
|
const wallClock = Date.now.bind(globalThis);
|
|
47
59
|
function json(status, body) {
|
|
@@ -100,20 +112,20 @@ function createServer(options) {
|
|
|
100
112
|
requireCap("maxTrackedRuns", options.maxTrackedRuns, 0);
|
|
101
113
|
requireCap("maxBufferedEventsPerRun", options.maxBufferedEventsPerRun, 1);
|
|
102
114
|
requireCap("maxPendingEventsPerClient", options.maxPendingEventsPerClient, 1);
|
|
115
|
+
const bufferCap = options.maxBufferedEventsPerRun ?? 5e4;
|
|
103
116
|
const pendingCap = options.maxPendingEventsPerClient ?? 1e4;
|
|
104
117
|
const journal = engine.stores.journal;
|
|
105
118
|
const runs = /* @__PURE__ */ new Map();
|
|
106
119
|
/**
|
|
107
|
-
* Buffers one event under the
|
|
120
|
+
* Buffers one event under the resolved bound. Overflow drops the
|
|
108
121
|
* oldest chunk (an eighth of the bound) in one splice, so the
|
|
109
122
|
* amortized cost per event stays O(1) and the retained window never
|
|
110
123
|
* falls below seven eighths of the bound.
|
|
111
124
|
*/
|
|
112
125
|
function pushBuffered(run, event) {
|
|
113
126
|
run.buffer.push(event);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const chunk = Math.max(1, Math.floor(max / 8));
|
|
127
|
+
if (run.buffer.length > bufferCap) {
|
|
128
|
+
const chunk = Math.max(1, Math.floor(bufferCap / 8));
|
|
117
129
|
run.buffer.splice(0, chunk);
|
|
118
130
|
run.dropped += chunk;
|
|
119
131
|
}
|
|
@@ -1020,4 +1032,4 @@ async function toOtel(run, tracer, options = {}) {
|
|
|
1020
1032
|
return created;
|
|
1021
1033
|
}
|
|
1022
1034
|
//#endregion
|
|
1023
|
-
export { DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, invoiceCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, preflightCommand, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
|
1035
|
+
export { DEFAULT_MAX_BUFFERED_EVENTS_PER_RUN, DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, invoiceCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, preflightCommand, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.94.0",
|
|
4
4
|
"description": "Rulvar shell: run/resume/runs/inspect/plan/kb commands, TUI progress, createServer, createWorker, OTel exporter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/core": "1.
|
|
25
|
+
"@rulvar/core": "1.94.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.1",
|
|
29
29
|
"tsdown": "^0.22.14",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"@rulvar/
|
|
32
|
-
"@rulvar/
|
|
33
|
-
"@rulvar/
|
|
34
|
-
"@rulvar/
|
|
35
|
-
"@rulvar/
|
|
31
|
+
"@rulvar/testing": "1.94.0",
|
|
32
|
+
"@rulvar/planner": "1.94.0",
|
|
33
|
+
"@rulvar/evals": "1.94.0",
|
|
34
|
+
"@rulvar/plan": "1.94.0",
|
|
35
|
+
"@rulvar/store-sqlite": "1.94.0"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"rulvar": "./dist/cli.js"
|