@rulvar/cli 1.21.0 → 1.23.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 +6 -1
- package/dist/index.js +1 -1
- package/dist/{io-74cSn0r8.js → io-Dh-Fa5Nf.js} +32 -13
- package/package.json +7 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -227,7 +227,12 @@ interface Worker {
|
|
|
227
227
|
declare function createWorker(engine: Engine, options: CreateWorkerOptions): Worker;
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/tui.d.ts
|
|
230
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* Renders one event to a line, or undefined for silent event types. The
|
|
232
|
+
* composed line is sanitized so an untrusted provider/tool/log string
|
|
233
|
+
* cannot inject a control sequence or a second physical line (v1.21.0
|
|
234
|
+
* review P2-1).
|
|
235
|
+
*/
|
|
231
236
|
declare function renderEventLine(event: WorkflowEvent): string | undefined;
|
|
232
237
|
/** Attaches the renderer to a handle's event stream; returns a detach. */
|
|
233
238
|
declare function attachProgress(handle: RunHandle<unknown>, io: CliIo): () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-
|
|
1
|
+
import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-Dh-Fa5Nf.js";
|
|
2
2
|
import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, costReportFromJournal, maskSecrets, normalizeEntry, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
|
|
3
3
|
//#region src/server.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigError, FileModelKnowledgeStore, INBOX_PROPOSAL_TTL_DAYS, JsonlFileStore, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, parseModelRef, priceUsdOf, proposalStatement, remeasureQueue, resolvePricing, runProfile } from "@rulvar/core";
|
|
1
|
+
import { ConfigError, FileModelKnowledgeStore, INBOX_PROPOSAL_TTL_DAYS, JsonlFileStore, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, parseModelRef, priceUsdOf, proposalStatement, remeasureQueue, resolvePricing, runProfile, sanitizeTerminalText } from "@rulvar/core";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -168,24 +168,43 @@ function applyRunProfile(profile, host) {
|
|
|
168
168
|
}
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/tui.ts
|
|
171
|
+
/**
|
|
172
|
+
* TUI progress renderer over the WorkflowEvent stream. Line-oriented: one compact line per
|
|
173
|
+
* lifecycle event, replay-marked events dimmed with a prefix, a cost
|
|
174
|
+
* and usage summary at run:end. TTY gets no special screen handling in
|
|
175
|
+
* v1 beyond being the default sink; piped output stays byte-stable for
|
|
176
|
+
* tests and logs.
|
|
177
|
+
*/
|
|
171
178
|
function money(usd) {
|
|
172
179
|
return `$${usd.toFixed(4)}`;
|
|
173
180
|
}
|
|
174
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Renders one event to a line, or undefined for silent event types. The
|
|
183
|
+
* composed line is sanitized so an untrusted provider/tool/log string
|
|
184
|
+
* cannot inject a control sequence or a second physical line (v1.21.0
|
|
185
|
+
* review P2-1).
|
|
186
|
+
*/
|
|
175
187
|
function renderEventLine(event) {
|
|
188
|
+
const line = rawEventLine(event);
|
|
189
|
+
return line === void 0 ? void 0 : sanitizeTerminalText(line);
|
|
190
|
+
}
|
|
191
|
+
function rawEventLine(event) {
|
|
176
192
|
const replayMark = event.replayed === true ? "replay " : "";
|
|
193
|
+
const str = (value) => typeof value === "string" ? value : "";
|
|
194
|
+
const num = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
195
|
+
const who = str(event.agentType) || "(anon)";
|
|
177
196
|
switch (event.type) {
|
|
178
|
-
case "run:start": return `run ${event.runId} ${event.resumed ? "resumed" : "started"} (workflow ${event.workflow})`;
|
|
179
|
-
case "phase:start": return `phase ${event.phase}`;
|
|
180
|
-
case "agent:start": return `${replayMark}agent ${
|
|
181
|
-
case "agent:end": return `${replayMark}agent ${
|
|
182
|
-
case "agent:error": return `agent ${
|
|
183
|
-
case "agent:queued": return `agent ${
|
|
184
|
-
case "tool:start": return `${replayMark}tool ${event.toolName}`;
|
|
185
|
-
case "tool:end": return `${replayMark}tool ${event.toolName} ${event.outcome} (${event.durationMs}ms)`;
|
|
186
|
-
case "approval:pending": return `approval pending: tool ${event.toolName} (entry ${event.entryRef})`;
|
|
187
|
-
case "log": return event.level === "debug" ? void 0 : `${event.level}: ${event.msg}`;
|
|
188
|
-
case "run:end": return `run ${event.runId} ${event.status}`;
|
|
197
|
+
case "run:start": return `run ${str(event.runId)} ${event.resumed === true ? "resumed" : "started"} (workflow ${str(event.workflow)})`;
|
|
198
|
+
case "phase:start": return `phase ${str(event.phase)}`;
|
|
199
|
+
case "agent:start": return `${replayMark}agent ${who}${str(event.label) === "" ? "" : ` [${str(event.label)}]`} ${str(event.role)} on ${str(event.model)}`;
|
|
200
|
+
case "agent:end": return `${replayMark}agent ${who} ${str(event.status)} (${money(num(event.costUsd))}, ${String(num(event.usage?.inputTokens) + num(event.usage?.outputTokens))} tok)`;
|
|
201
|
+
case "agent:error": return `agent ${who} error: ${str(event.error?.message)}${event.willRetry === true ? " (will retry)" : ""}`;
|
|
202
|
+
case "agent:queued": return `agent ${who} queued`;
|
|
203
|
+
case "tool:start": return `${replayMark}tool ${str(event.toolName)}`;
|
|
204
|
+
case "tool:end": return `${replayMark}tool ${str(event.toolName)} ${str(event.outcome)} (${String(num(event.durationMs))}ms)`;
|
|
205
|
+
case "approval:pending": return `approval pending: tool ${str(event.toolName)} (entry ${String(num(event.entryRef))})`;
|
|
206
|
+
case "log": return event.level === "debug" ? void 0 : `${str(event.level)}: ${str(event.msg)}`;
|
|
207
|
+
case "run:end": return `run ${str(event.runId)} ${str(event.status)}`;
|
|
189
208
|
default: return;
|
|
190
209
|
}
|
|
191
210
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.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.23.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/
|
|
32
|
-
"@rulvar/
|
|
33
|
-
"@rulvar/planner": "1.
|
|
34
|
-
"@rulvar/
|
|
35
|
-
"@rulvar/
|
|
31
|
+
"@rulvar/testing": "1.23.0",
|
|
32
|
+
"@rulvar/store-sqlite": "1.23.0",
|
|
33
|
+
"@rulvar/planner": "1.23.0",
|
|
34
|
+
"@rulvar/plan": "1.23.0",
|
|
35
|
+
"@rulvar/evals": "1.23.0"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"rulvar": "./dist/cli.js"
|