@mutagent/cli 0.2.4 → 0.2.6
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/README.md +2 -2
- package/dist/bin/cli.js +27 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ sandboxes and Helix sessions, and the standalone Helix binary installer.
|
|
|
23
23
|
**Status:** all commands and flags below were verified against `mutagent --help`
|
|
24
24
|
(and each subcommand's `--help`) on this branch. `sandbox` is internal (everyday
|
|
25
25
|
use goes through `mutagent helix`); `trace` is not implemented in this binary —
|
|
26
|
-
it prints where to find it (
|
|
26
|
+
it prints where to find it (in Helix) and exits with an error.
|
|
27
27
|
|
|
28
28
|
[Context](#context) · [Concepts](#concepts) · [Components](#components) · [Configuration](#configuration) · [Reference](#reference)
|
|
29
29
|
|
|
@@ -111,7 +111,7 @@ flowchart TD
|
|
|
111
111
|
ENVIRONMENT["mutagent env"]
|
|
112
112
|
HELIX["mutagent helix"]
|
|
113
113
|
AGENT["mutagent agent"]
|
|
114
|
-
TRACE["mutagent trace<br/>(→
|
|
114
|
+
TRACE["mutagent trace<br/>(→ Helix)"]
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
subgraph LIFECYCLE ["Helix & Feedback"]
|
package/dist/bin/cli.js
CHANGED
|
@@ -30790,9 +30790,11 @@ async function resolveGatewayConnection() {
|
|
|
30790
30790
|
const workspaceId = tenancy.workspaceId?.trim();
|
|
30791
30791
|
if (workspaceId === undefined || workspaceId === "")
|
|
30792
30792
|
throw noWorkspaceSelected();
|
|
30793
|
-
const headers = {
|
|
30794
|
-
|
|
30795
|
-
|
|
30793
|
+
const headers = {
|
|
30794
|
+
"x-api-key": apiKey,
|
|
30795
|
+
"Content-Type": "application/json",
|
|
30796
|
+
"x-workspace-id": workspaceId
|
|
30797
|
+
};
|
|
30796
30798
|
return {
|
|
30797
30799
|
endpoint: tenancy.endpoint,
|
|
30798
30800
|
apiKey,
|
|
@@ -34166,7 +34168,8 @@ var PUBLISH_MARKER_VALUES = ["redacted", "assume-sanitized"];
|
|
|
34166
34168
|
var MAX_REPORT_HTML_CHARS = 10 * 1024 * 1024;
|
|
34167
34169
|
var MAX_RENDER_INPUT_BYTES = 2 * 1024 * 1024;
|
|
34168
34170
|
var RENDER_INPUT_FILE = "render-input.json";
|
|
34169
|
-
var
|
|
34171
|
+
var NOT_BY_HELIX = "This report was not published by Helix; rerun the stage in Helix.";
|
|
34172
|
+
var PUBLISH_FIX = "Rerun the stage in Helix, which publishes the report, then push its run directory: mutagent reports push <run dir>";
|
|
34170
34173
|
var INTERNAL_SURFACES = [
|
|
34171
34174
|
{ name: "calibration panel (section#t5)", pattern: /<section\b[^>]*\bid\s*=\s*["']t5["']/i },
|
|
34172
34175
|
{ name: "internal navigation tab", pattern: /<button\b[^>]*\bclass\s*=\s*["']tab-btn internal["']/i },
|
|
@@ -34186,7 +34189,7 @@ function parseReportKind(value2) {
|
|
|
34186
34189
|
return value2;
|
|
34187
34190
|
const mapped3 = HELIX_RENDER_KIND_MAP[value2];
|
|
34188
34191
|
if (mapped3 !== undefined) {
|
|
34189
|
-
throw invalid2(`'${value2}' is the
|
|
34192
|
+
throw invalid2(`'${value2}' is the Helix render kind; push it as --kind ${mapped3}.`);
|
|
34190
34193
|
}
|
|
34191
34194
|
throw invalid2(`Unknown report kind '${value2}'. Allowed: ${REPORT_KINDS.join(", ")}.`);
|
|
34192
34195
|
}
|
|
@@ -34204,17 +34207,17 @@ function assertPublished(html, path) {
|
|
|
34204
34207
|
const markers = publishMarkersOf(html);
|
|
34205
34208
|
const marker = markers[0];
|
|
34206
34209
|
if (markers.length > 1) {
|
|
34207
|
-
throw notPublished(`${path} carries ${String(markers.length)} ${PUBLISH_MARKER_NAME} markers; a published report has exactly one. ` +
|
|
34210
|
+
throw notPublished(`${path} carries ${String(markers.length)} ${PUBLISH_MARKER_NAME} markers; a published report has exactly one. ` + NOT_BY_HELIX);
|
|
34208
34211
|
}
|
|
34209
34212
|
if (marker === undefined) {
|
|
34210
|
-
throw notPublished(`${path} has no ${PUBLISH_MARKER_NAME} marker
|
|
34213
|
+
throw notPublished(`${path} has no ${PUBLISH_MARKER_NAME} marker (publishing is the PII gate). ${NOT_BY_HELIX}`);
|
|
34211
34214
|
}
|
|
34212
34215
|
if (!PUBLISH_MARKER_VALUES.includes(marker)) {
|
|
34213
|
-
throw notPublished(`${path} has an unknown ${PUBLISH_MARKER_NAME} value '${marker}' (expected ${PUBLISH_MARKER_VALUES.join(" or ")}). ` +
|
|
34216
|
+
throw notPublished(`${path} has an unknown ${PUBLISH_MARKER_NAME} value '${marker}' (expected ${PUBLISH_MARKER_VALUES.join(" or ")}). ` + NOT_BY_HELIX);
|
|
34214
34217
|
}
|
|
34215
34218
|
const leftovers = internalSurfacesOf(html);
|
|
34216
34219
|
if (leftovers.length > 0) {
|
|
34217
|
-
throw notPublished(`${path} still carries internal report surfaces (${leftovers.join(", ")})
|
|
34220
|
+
throw notPublished(`${path} still carries internal report surfaces (${leftovers.join(", ")}). ${NOT_BY_HELIX}`);
|
|
34218
34221
|
}
|
|
34219
34222
|
return marker;
|
|
34220
34223
|
}
|
|
@@ -34227,7 +34230,7 @@ function resolveReportFiles(target, renderInputFlag) {
|
|
|
34227
34230
|
const published = htmlFiles.filter((f) => /\.client\.html?$/i.test(f));
|
|
34228
34231
|
if (published.length === 0) {
|
|
34229
34232
|
if (htmlFiles.length > 0) {
|
|
34230
|
-
throw notPublished(`${target} has no published report (*.client.html), only ${htmlFiles.join(", ")}.
|
|
34233
|
+
throw notPublished(`${target} has no published report (*.client.html), only ${htmlFiles.join(", ")}. ${NOT_BY_HELIX}`);
|
|
34231
34234
|
}
|
|
34232
34235
|
throw invalid2(`${target} holds no report HTML. Pass the published file itself, or the run directory that holds it.`);
|
|
34233
34236
|
}
|
|
@@ -34302,27 +34305,29 @@ function refuseForHitl(options) {
|
|
|
34302
34305
|
throw new MutagentError("VALIDATION_ERROR", `${refused.join(" and ")} cannot be used with --kind hitl: a hitl report carries no run id, so every push stores a new report and there is nothing to replace.`, "Run: mutagent reports push --help");
|
|
34303
34306
|
}
|
|
34304
34307
|
function registerReportsPush(reports) {
|
|
34305
|
-
reports.command("push").description("Upload a
|
|
34308
|
+
reports.command("push").description("Upload a run report Helix published: its render input and its client-safe HTML").argument("<run-dir|report-file>", "A run directory (render-input.json + one *.client.html), or the published HTML file").option("--kind <kind>", "diagnostics|discovery|evaluator|hitl").option("--run-id <id>", "The producing run (default: the render input's runId). Not with --kind hitl").option("--subject <id>", "The agent, skill or workflow the report is about").option("--session-ref <ref>", "The Helix session reference").option("--title <text>", "Report title (default: the HTML <title>)").option("--render-input <file>", "The render-input JSON (default: render-input.json beside the HTML)").option("--replace", "Swap the content of the report already stored for this run and kind. Not with --kind hitl").addHelpText("after", `
|
|
34306
34309
|
Usage:
|
|
34307
34310
|
${PUSH_USAGE}
|
|
34308
34311
|
|
|
34312
|
+
Helix publishes a run's report and, in a cloud sandbox, pushes it. To push a report
|
|
34313
|
+
Helix already published from a local run: \`mutagent reports push <run dir>\`.
|
|
34314
|
+
|
|
34309
34315
|
Examples:
|
|
34310
|
-
${chalk54.dim("$")} helix-cli report publish runs/42/report.html runs/42/report.client.html
|
|
34311
34316
|
${chalk54.dim("$")} mutagent reports push runs/42 --kind evaluator
|
|
34312
34317
|
${chalk54.dim("$")} mutagent reports push runs/42/report.client.html --kind diagnostics --run-id run-42 --json
|
|
34313
34318
|
${chalk54.dim("$")} mutagent reports push runs/42 --kind evaluator --replace
|
|
34314
34319
|
${chalk54.dim("$")} mutagent reports push review/ --kind hitl
|
|
34315
34320
|
|
|
34316
|
-
Kinds, and the
|
|
34321
|
+
Kinds, and the Helix render kind each one comes from:
|
|
34317
34322
|
diagnosis → diagnostics · discover → discovery · eval → evaluator · review → hitl
|
|
34318
34323
|
Any other kind (roster, dogfood, ship, the skill-builder kinds) is refused.
|
|
34319
34324
|
|
|
34320
34325
|
Only published reports are accepted:
|
|
34321
|
-
The HTML must be the file
|
|
34322
|
-
stamps <meta name="mutagent-report-published" content="redacted|assume-sanitized">
|
|
34326
|
+
The HTML must be the client-safe file Helix published (publishing is the PII gate).
|
|
34327
|
+
Publishing stamps <meta name="mutagent-report-published" content="redacted|assume-sanitized">
|
|
34323
34328
|
into every report; a file without exactly one such tag with one of those values is
|
|
34324
34329
|
refused (exit 1, REPORT_NOT_PUBLISHED) and nothing is sent. So is a file that still carries the evaluator's internal panels.
|
|
34325
|
-
|
|
34330
|
+
Such a report was not published by Helix: rerun the stage in Helix.
|
|
34326
34331
|
|
|
34327
34332
|
Idempotent per run and kind:
|
|
34328
34333
|
A repeat push of the same run id and kind stores nothing new: it prints
|
|
@@ -34342,13 +34347,13 @@ Exit 0: stored, or already stored.
|
|
|
34342
34347
|
${EXIT_CODES_LINE}
|
|
34343
34348
|
|
|
34344
34349
|
AI Agent Directive:
|
|
34345
|
-
1.
|
|
34346
|
-
|
|
34350
|
+
1. Push only a report Helix published: the run directory or its .client.html file.
|
|
34351
|
+
Never push the raw render.
|
|
34347
34352
|
2. --json returns { success, created, replaced, report, _links, _directive }.
|
|
34348
34353
|
created:false with replaced:false means it was already stored; that is success.
|
|
34349
34354
|
3. Pass --replace only when the user asked to overwrite the stored report.
|
|
34350
|
-
4. On REPORT_NOT_PUBLISHED,
|
|
34351
|
-
the HTML to add the marker.
|
|
34355
|
+
4. On REPORT_NOT_PUBLISHED, the report was not published by Helix: rerun the stage in
|
|
34356
|
+
Helix (suggestedAction). Do not edit the HTML to add the marker.
|
|
34352
34357
|
5. Show _directive.renderedCard to the user verbatim.
|
|
34353
34358
|
`).action(async (target, options, command) => {
|
|
34354
34359
|
await runReportsAction(command, async (isJson) => {
|
|
@@ -34420,7 +34425,7 @@ The workspace is the usual one: --workspace, MUTAGENT_WORKSPACE_ID or 'mutagent
|
|
|
34420
34425
|
|
|
34421
34426
|
AI Agent Directive:
|
|
34422
34427
|
1. Read first: 'mutagent reports list --json'. Reads need no confirmation.
|
|
34423
|
-
2. push only
|
|
34428
|
+
2. push only reports Helix published; see 'mutagent reports push --help'.
|
|
34424
34429
|
3. review and retract are writes: confirm with the user, then run them (retract with --force).
|
|
34425
34430
|
4. On an error, run the command in suggestedAction once; never retry blind.
|
|
34426
34431
|
`);
|
|
@@ -37223,4 +37228,4 @@ if (process.env.CLI_VERSION) {
|
|
|
37223
37228
|
}
|
|
37224
37229
|
runCli(process.argv.slice(2), cliVersion);
|
|
37225
37230
|
|
|
37226
|
-
//# debugId=
|
|
37231
|
+
//# debugId=E319FD98480B5A9D64756E2164756E21
|
package/package.json
CHANGED