@rulvar/cli 1.40.0 → 1.41.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/cli.js +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +2 -2
- package/dist/{io-C2rsgBE4.js → io-BXU6hEnw.js} +34 -9
- package/package.json +7 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -150,6 +150,16 @@ declare function driveRun(options: {
|
|
|
150
150
|
* P2-1). Values print as JSON, which escapes control bytes on its own.
|
|
151
151
|
*/
|
|
152
152
|
declare function reportOutcome(outcome: RunOutcome<unknown>, io: CliIo): number;
|
|
153
|
+
/**
|
|
154
|
+
* `--strict` (the v1.40.0 improvement plan's completion contract): a
|
|
155
|
+
* settled ok run whose orchestration acceptance envelope reports a
|
|
156
|
+
* completion other than 'complete' exits nonzero, with the degraded
|
|
157
|
+
* reasons printed. Outcomes without an acceptance envelope (a workflow
|
|
158
|
+
* that never opted into orchestrate acceptance) and nonzero exit codes
|
|
159
|
+
* pass through unchanged, so the flag never masks the ordinary status
|
|
160
|
+
* exit and never bites a plain workflow.
|
|
161
|
+
*/
|
|
162
|
+
declare function strictExitCode(outcome: RunOutcome<unknown>, base: number, io: CliIo): number;
|
|
153
163
|
//#endregion
|
|
154
164
|
//#region src/server.d.ts
|
|
155
165
|
interface CreateServerOptions {
|
|
@@ -352,4 +362,4 @@ declare function toOtel(run: {
|
|
|
352
362
|
result: Promise<RunOutcome<unknown>>;
|
|
353
363
|
}, tracer: TracerLike, options?: ToOtelOptions): Promise<number>;
|
|
354
364
|
//#endregion
|
|
355
|
-
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 RulvarServer, type SpanLike, type ToOtelOptions, type TracerLike, type Worker, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, toOtel };
|
|
365
|
+
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 RulvarServer, type SpanLike, type ToOtelOptions, type TracerLike, type Worker, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resumeCommand, c as driveRun, d as
|
|
1
|
+
import { _ as looksLikeFile, a as resumeCommand, c as driveRun, d as attachProgress, f as renderEventLine, g as loadWorkflowModule, h as loadCliConfig, i as inspectCommand, l as reportOutcome, m as assembleEngine, n as HELP, o as runCommand, p as DEFAULT_STORE_DIR, r as runCli, s as runsLsCommand, t as processIo, u as strictExitCode } from "./io-BXU6hEnw.js";
|
|
2
2
|
import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, costReportFromJournal, maskSecrets, normalizeEntry, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
|
|
3
3
|
//#region src/server.ts
|
|
4
4
|
/**
|
|
@@ -899,4 +899,4 @@ async function toOtel(run, tracer, options = {}) {
|
|
|
899
899
|
return created;
|
|
900
900
|
}
|
|
901
901
|
//#endregion
|
|
902
|
-
export { DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, toOtel };
|
|
902
|
+
export { DEFAULT_MAX_PENDING_EVENTS_PER_CLIENT, DEFAULT_STORE_DIR, DEFAULT_WORKER_TTL_MS, HELP, assembleEngine, attachProgress, createServer, createWorker, driveRun, inspectCommand, loadCliConfig, loadWorkflowModule, looksLikeFile, processIo, renderEventLine, reportOutcome, resumeCommand, runCli, runCommand, runsLsCommand, strictExitCode, toOtel };
|
|
@@ -363,6 +363,25 @@ function reportOutcome(outcome, io) {
|
|
|
363
363
|
default: return 1;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* `--strict` (the v1.40.0 improvement plan's completion contract): a
|
|
368
|
+
* settled ok run whose orchestration acceptance envelope reports a
|
|
369
|
+
* completion other than 'complete' exits nonzero, with the degraded
|
|
370
|
+
* reasons printed. Outcomes without an acceptance envelope (a workflow
|
|
371
|
+
* that never opted into orchestrate acceptance) and nonzero exit codes
|
|
372
|
+
* pass through unchanged, so the flag never masks the ordinary status
|
|
373
|
+
* exit and never bites a plain workflow.
|
|
374
|
+
*/
|
|
375
|
+
function strictExitCode(outcome, base, io) {
|
|
376
|
+
if (base !== 0 || outcome.status !== "ok") return base;
|
|
377
|
+
const value = outcome.value;
|
|
378
|
+
const completion = typeof value === "object" && value !== null && typeof value.completion === "string" ? value.completion : void 0;
|
|
379
|
+
if (completion === void 0 || completion === "complete") return base;
|
|
380
|
+
io.err(`strict: the orchestration acceptance reports completion '${sanitizeTerminalText(completion)}'`);
|
|
381
|
+
const reasons = Array.isArray(value?.degradedReasons) ? value.degradedReasons : [];
|
|
382
|
+
for (const reason of reasons.filter((entry) => typeof entry === "string")) io.err(` ${sanitizeTerminalText(reason)}`);
|
|
383
|
+
return 1;
|
|
384
|
+
}
|
|
366
385
|
//#endregion
|
|
367
386
|
//#region src/grammar.ts
|
|
368
387
|
/**
|
|
@@ -403,7 +422,8 @@ const GRAMMAR = {
|
|
|
403
422
|
{
|
|
404
423
|
name: "profile",
|
|
405
424
|
placeholder: "NAME"
|
|
406
|
-
}
|
|
425
|
+
},
|
|
426
|
+
{ name: "strict" }
|
|
407
427
|
]
|
|
408
428
|
},
|
|
409
429
|
resume: {
|
|
@@ -413,7 +433,8 @@ const GRAMMAR = {
|
|
|
413
433
|
ARGS,
|
|
414
434
|
STORE,
|
|
415
435
|
{ name: "dry-run" },
|
|
416
|
-
{ name: "allow-args-change" }
|
|
436
|
+
{ name: "allow-args-change" },
|
|
437
|
+
{ name: "strict" }
|
|
417
438
|
]
|
|
418
439
|
},
|
|
419
440
|
"runs ls": {
|
|
@@ -648,8 +669,8 @@ function parseBudgetValue(flagName, value) {
|
|
|
648
669
|
/**
|
|
649
670
|
* The four M5 commands of the canonical CLI grammar (no aliases in v1):
|
|
650
671
|
*
|
|
651
|
-
* rulvar run <file|name> [--args JSON] [--store PATH] [--budget-usd N]
|
|
652
|
-
* rulvar resume <runId> [--store PATH]
|
|
672
|
+
* rulvar run <file|name> [--args JSON] [--store PATH] [--budget-usd N] [--strict]
|
|
673
|
+
* rulvar resume <runId> [--store PATH] [--strict]
|
|
653
674
|
* rulvar runs ls [--store PATH]
|
|
654
675
|
* rulvar inspect <runId> [--store PATH]
|
|
655
676
|
*
|
|
@@ -737,13 +758,15 @@ async function runCommand(argv, context) {
|
|
|
737
758
|
const runOptions = { ...budgetUsd === void 0 ? {} : { budgetUsd } };
|
|
738
759
|
const first = assembled.engine.run(workflow, args, runOptions);
|
|
739
760
|
context.io.err(`runId: ${first.runId}`);
|
|
740
|
-
|
|
761
|
+
const outcome = await driveRun({
|
|
741
762
|
engine: assembled.engine,
|
|
742
763
|
workflow,
|
|
743
764
|
first,
|
|
744
765
|
io: context.io,
|
|
745
766
|
args
|
|
746
|
-
})
|
|
767
|
+
});
|
|
768
|
+
const base = reportOutcome(outcome, context.io);
|
|
769
|
+
return parsed.values.strict === true ? strictExitCode(outcome, base, context.io) : base;
|
|
747
770
|
}
|
|
748
771
|
/**
|
|
749
772
|
* The resume args safety gate (the v1.23.0 review): a run's logical
|
|
@@ -821,13 +844,15 @@ async function resumeCommand(argv, context) {
|
|
|
821
844
|
...dryRun ? { dryRun: true } : {}
|
|
822
845
|
});
|
|
823
846
|
if (dryRun) return await reportDryRun(first, context.io);
|
|
824
|
-
|
|
847
|
+
const outcome = await driveRun({
|
|
825
848
|
engine: assembled.engine,
|
|
826
849
|
workflow,
|
|
827
850
|
first,
|
|
828
851
|
io: context.io,
|
|
829
852
|
args
|
|
830
|
-
})
|
|
853
|
+
});
|
|
854
|
+
const base = reportOutcome(outcome, context.io);
|
|
855
|
+
return parsed.values.strict === true ? strictExitCode(outcome, base, context.io) : base;
|
|
831
856
|
}
|
|
832
857
|
async function runsLsCommand(argv, context) {
|
|
833
858
|
const store = parseCommand(GRAMMAR["runs ls"], argv).values.store;
|
|
@@ -1423,4 +1448,4 @@ function processIo() {
|
|
|
1423
1448
|
};
|
|
1424
1449
|
}
|
|
1425
1450
|
//#endregion
|
|
1426
|
-
export { resumeCommand as a, driveRun as c,
|
|
1451
|
+
export { looksLikeFile as _, resumeCommand as a, driveRun as c, attachProgress as d, renderEventLine as f, loadWorkflowModule as g, loadCliConfig as h, inspectCommand as i, reportOutcome as l, assembleEngine as m, HELP as n, runCommand as o, DEFAULT_STORE_DIR as p, runCli as r, runsLsCommand as s, processIo as t, strictExitCode as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.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.41.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.0",
|
|
29
29
|
"tsdown": "^0.22.3",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"@rulvar/testing": "1.
|
|
32
|
-
"@rulvar/
|
|
33
|
-
"@rulvar/
|
|
34
|
-
"@rulvar/
|
|
35
|
-
"@rulvar/
|
|
31
|
+
"@rulvar/testing": "1.41.0",
|
|
32
|
+
"@rulvar/planner": "1.41.0",
|
|
33
|
+
"@rulvar/evals": "1.41.0",
|
|
34
|
+
"@rulvar/store-sqlite": "1.41.0",
|
|
35
|
+
"@rulvar/plan": "1.41.0"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"rulvar": "./dist/cli.js"
|