@rulvar/cli 1.147.0 → 1.148.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.js +34 -6
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as loadCliConfig, a as invoiceCommand, c as runCommand, d as reportOutcome, f as strictExitCode, g as assembleEngine, h as DEFAULT_STORE_DIR, i as inspectCommand, l as runsLsCommand, m as renderEventLine, n as HELP, o as preflightCommand, p as attachProgress, r as runCli, s as resumeCommand, t as processIo, u as driveRun, v as loadWorkflowModule, y as looksLikeFile } from "./io-CMUAtJ9j.js";
|
|
2
|
-
import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, journalPricingSnapshot, maskSecrets, normalizeEntry, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
|
|
2
|
+
import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, journalPricingSnapshot, maskSecrets, normalizeEntry, persistedTerminalEnvelope, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
|
|
3
3
|
//#region src/server.ts
|
|
4
4
|
/**
|
|
5
5
|
* createServer (M8-T01): the HTTP shell over the public engine API
|
|
@@ -224,6 +224,25 @@ function createServer(options) {
|
|
|
224
224
|
async function metaOf(runId) {
|
|
225
225
|
return readRunMeta(journal, runId);
|
|
226
226
|
}
|
|
227
|
+
/** One run's journal, normalized, ready for any pure fold. */
|
|
228
|
+
async function foldableEntries(runId) {
|
|
229
|
+
return (await journal.load(runId)).map((raw) => normalizeEntry(raw));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The run's settle pins composed with the host's current table
|
|
233
|
+
* (RV611), the engine's outcome-mirror rule: pin-covered rows stay
|
|
234
|
+
* stable against later price-table updates (RV407), the tail past
|
|
235
|
+
* the last pin prices at the current table, and a tail model the
|
|
236
|
+
* host prices nowhere surfaces unpriced, never silently at the last
|
|
237
|
+
* pin's rates. Every offline money surface of this server (the cost
|
|
238
|
+
* report and the persisted terminal envelope) prices through THIS
|
|
239
|
+
* one function, so they cannot disagree.
|
|
240
|
+
*/
|
|
241
|
+
function composedPriceUsd(entries) {
|
|
242
|
+
const settleSnapshot = journalPricingSnapshot(entries);
|
|
243
|
+
const currentPriceUsd = options.priceUsd ?? (() => void 0);
|
|
244
|
+
return settleSnapshot === void 0 ? currentPriceUsd : settleSnapshot.composedPriceUsd(currentPriceUsd);
|
|
245
|
+
}
|
|
227
246
|
async function startRun(req) {
|
|
228
247
|
let body;
|
|
229
248
|
try {
|
|
@@ -300,6 +319,13 @@ function createServer(options) {
|
|
|
300
319
|
code: "config",
|
|
301
320
|
message: `run '${runId}' not found`
|
|
302
321
|
} });
|
|
322
|
+
const entries = await foldableEntries(runId);
|
|
323
|
+
const persisted = persistedTerminalEnvelope({
|
|
324
|
+
runId,
|
|
325
|
+
meta,
|
|
326
|
+
entries,
|
|
327
|
+
priceUsd: composedPriceUsd(entries)
|
|
328
|
+
});
|
|
303
329
|
return json(200, {
|
|
304
330
|
runId,
|
|
305
331
|
status: meta.status,
|
|
@@ -307,7 +333,11 @@ function createServer(options) {
|
|
|
307
333
|
...meta.workflowName === void 0 ? {} : { workflow: meta.workflowName },
|
|
308
334
|
...meta.name === void 0 ? {} : { name: meta.name },
|
|
309
335
|
...meta.tags === void 0 ? {} : { tags: meta.tags },
|
|
310
|
-
updatedAt: meta.updatedAt
|
|
336
|
+
updatedAt: meta.updatedAt,
|
|
337
|
+
...persisted.available ? { envelope: persisted.envelope } : { terminalUnavailable: {
|
|
338
|
+
reason: persisted.reason,
|
|
339
|
+
message: persisted.message
|
|
340
|
+
} }
|
|
311
341
|
});
|
|
312
342
|
}
|
|
313
343
|
async function runEvents(runId, req) {
|
|
@@ -526,10 +556,8 @@ function createServer(options) {
|
|
|
526
556
|
code: "config",
|
|
527
557
|
message: `run '${runId}' not found`
|
|
528
558
|
} });
|
|
529
|
-
const entries =
|
|
530
|
-
|
|
531
|
-
const currentPriceUsd = options.priceUsd ?? (() => void 0);
|
|
532
|
-
return json(200, costReportFromJournal(entries, settleSnapshot === void 0 ? currentPriceUsd : settleSnapshot.composedPriceUsd(currentPriceUsd)));
|
|
559
|
+
const entries = await foldableEntries(runId);
|
|
560
|
+
return json(200, costReportFromJournal(entries, composedPriceUsd(entries)));
|
|
533
561
|
}
|
|
534
562
|
async function route(req) {
|
|
535
563
|
const path = new URL(req.url).pathname;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.148.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.148.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/testing": "1.
|
|
32
|
-
"@rulvar/
|
|
33
|
-
"@rulvar/
|
|
34
|
-
"@rulvar/
|
|
35
|
-
"@rulvar/
|
|
31
|
+
"@rulvar/testing": "1.148.0",
|
|
32
|
+
"@rulvar/store-sqlite": "1.148.0",
|
|
33
|
+
"@rulvar/planner": "1.148.0",
|
|
34
|
+
"@rulvar/plan": "1.148.0",
|
|
35
|
+
"@rulvar/evals": "1.148.0"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"rulvar": "./dist/cli.js"
|