@mutagent/cli 0.2.131 → 0.2.133
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/bin/cli.js +78 -29
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -455,7 +455,7 @@ function sandboxScopedFailure(failure, commandPath) {
|
|
|
455
455
|
return failure;
|
|
456
456
|
const command = commandPath === "" ? "This command" : `\`mutagent ${commandPath}\``;
|
|
457
457
|
const alternative = SANDBOX_ALTERNATIVES[commandPath.split(" ")[0] ?? ""];
|
|
458
|
-
return new MutagentError("SANDBOX_SCOPE", `${command} isn't available inside a cloud session: this session is signed in with its own session token, which covers the Factory, traces, pushing and
|
|
458
|
+
return new MutagentError("SANDBOX_SCOPE", `${command} isn't available inside a cloud session: this session is signed in with its own session token, which covers the Factory, traces, pushing, updating, listing and showing reports, and this session.`, alternative === undefined ? "Inside this session use the Factory and traces commands, or reports push, reports update, reports list or reports show (mutagent --help lists them)." : `Run: ${alternative}`);
|
|
459
459
|
}
|
|
460
460
|
var SANDBOX_TOKEN_VAR2 = "MUTAGENT_SANDBOX_TOKEN", SANDBOX_ALTERNATIVES;
|
|
461
461
|
var init_sandbox_scope_error = __esm(() => {
|
|
@@ -21893,7 +21893,7 @@ skill never inlines flags. The active surface:
|
|
|
21893
21893
|
| \`factory\` | Register entries from their agentspec; list, show, archive | [workflows/factory-register.md](./workflows/factory-register.md) |
|
|
21894
21894
|
| \`factory spec\` | Spec versions: status, push, get, versions | [workflows/factory-spec-sync.md](./workflows/factory-spec-sync.md) |
|
|
21895
21895
|
| \`factory stage\` | Stage runs: start, finish, record, list, show | [workflows/factory-stages.md](./workflows/factory-stages.md) |
|
|
21896
|
-
| \`reports\` | Push a run's report (with its stage run and build), update, review | [workflows/factory-stages.md](./workflows/factory-stages.md) |
|
|
21896
|
+
| \`reports\` | Push a run's report (with its stage run and build), update, list, show, review | [workflows/factory-stages.md](./workflows/factory-stages.md) |
|
|
21897
21897
|
| \`traces\` | Read sessions, traces, logs and transcripts by session id | [workflows/traces.md](./workflows/traces.md) |
|
|
21898
21898
|
|
|
21899
21899
|
---
|
|
@@ -22060,12 +22060,16 @@ In a cloud sandbox launched for a Factory entry, the platform sets these:
|
|
|
22060
22060
|
| \`MUTAGENT_SESSION_ID\` | this session's id (\`hs1_…\`) | every \`--session\`, e.g. \`mutagent traces get\` |
|
|
22061
22061
|
| \`MUTAGENT_SUBJECT_ID\` | the Factory entry the session is bound to | every entry \`<id>\` and \`--subject\` |
|
|
22062
22062
|
| \`MUTAGENT_STAGE_RUN_ID\` | the stage run the platform opened for this session | \`factory stage finish\`, \`factory stage show\` |
|
|
22063
|
-
| \`MUTAGENT_RUN_ID\` | the gateway run, when a gateway routine started the session |
|
|
22063
|
+
| \`MUTAGENT_RUN_ID\` | the gateway run, when a gateway routine started the session | nothing: no command reads it |
|
|
22064
22064
|
|
|
22065
22065
|
So in a sandbox you write \`mutagent factory stage finish --state succeeded --json\`
|
|
22066
22066
|
with no run id, and \`mutagent reports push <run-dir> --json\` with no
|
|
22067
22067
|
\`--stage-run\`: the server attaches the report to the session's open run, with its
|
|
22068
|
-
entry, spec version and build (the checkout's HEAD).
|
|
22068
|
+
entry, spec version and build (the checkout's HEAD). A report's run id comes from
|
|
22069
|
+
\`--run-id\`, else the report's own render input (its \`runId\`).
|
|
22070
|
+
The same token reads this workspace's reports: \`mutagent reports list --json\` and
|
|
22071
|
+
\`mutagent reports show <id> --json\` work in a sandbox with no key. Review and
|
|
22072
|
+
retract need a signed-in key and fail with \`SANDBOX_SCOPE\` in a sandbox.
|
|
22069
22073
|
|
|
22070
22074
|
Locally none of this exists: pass the entry id, the run id and the build
|
|
22071
22075
|
(\`--build-target\`, \`--build-rev\`) explicitly. A command that needs one and gets
|
|
@@ -22075,7 +22079,10 @@ none fails with \`MISSING_ARGUMENTS\`; it never guesses.
|
|
|
22075
22079
|
|
|
22076
22080
|
A sandbox session works on one entry. A session launched with
|
|
22077
22081
|
\`mutagent helix agent … --subject <id> --stage <stage>\` is bound to that entry from
|
|
22078
|
-
the start
|
|
22082
|
+
the start, with the stage run open. One launched with \`--subject <id>\` and no stage
|
|
22083
|
+
(an entry session, as the web's "Run in Helix" starts) is bound with no run open: it
|
|
22084
|
+
opens the run itself when it starts a stage (see
|
|
22085
|
+
[workflows/factory-stages.md](../workflows/factory-stages.md)). A session started without one binds on its first Factory write (for
|
|
22079
22086
|
example \`mutagent factory add\`). A write to any other entry is refused with
|
|
22080
22087
|
\`SANDBOX_SCOPE\`, which names the scope and the bound entry; the only exception is
|
|
22081
22088
|
an entry whose repository matches the sandbox's checkout.
|
|
@@ -22092,6 +22099,10 @@ refuses it (\`SANDBOX_CANNOT_LAUNCH\`); a person starts one from a terminal, Des
|
|
|
22092
22099
|
When a sandbox session ends, the platform checks its work: specs in sync, stage
|
|
22093
22100
|
runs finished, reports pushed. If something is missing, the session is woken with
|
|
22094
22101
|
the list and continues. Finish your runs and push your reports before you stop.
|
|
22102
|
+
|
|
22103
|
+
Code changes travel the same way:
|
|
22104
|
+
the platform opens the PR with this session's changes when the session ends;
|
|
22105
|
+
don't push or open PRs yourself.
|
|
22095
22106
|
`,
|
|
22096
22107
|
"workflows/agent-deployment.md": "# Managed agents: check, deploy and run an agent.md folder\n\nUse this journey when the user has an agent folder whose entry file is a\nlowercase `agent.md` (YAML frontmatter, then the standing prompt), optionally\nwith TypeScript tools, skill folders and files. Read `mutagent agent --help` and\nthe leaf's help before the first use; help owns the flags and the JSON shapes.\nThe CLI compiles the tools and packages the folder. Do not write registration\nglue or forward a path on this machine to the server.\n\nThe format, in one paragraph: `name` (the slug), `description`, `model`\n(`provider/model`, as `mutagent helix models` lists it), `thinking`, `tools`,\n`disallowed_tools` and `skills` are the local brief. Deployment settings sit in\none optional `harness:` block: `tools.builtin`, `tools.modules`, `skills`,\n`files`, `bindings.secrets`, `runtime.mode` (`interactive` or `headless`) and\n`runtime.scaffold` (`standard`). A deployed agent gets exactly the tools and\nskills `harness:` declares. `apiVersion`, `kind` and `metadata` are refused.\n\n1. **Check.** `mutagent agent check <agent.md> --json`. No network, no model call,\n no tool code runs. Fix every diagnostic before going further.\n2. **Run locally, when the user wants to try it.**\n `mutagent agent run <agent.md> \"<task>\" --json` runs the task with the local\n Helix binary and this machine's LLM provider key. It is not isolated and\n creates nothing in the workspace. It takes a file; a slug is refused.\n3. **Deploy.** `mutagent agent deploy <agent.md> [--env <name>] --json`. `--env`\n names the slot (the agent in that Environment); without it the default slot\n is used. One server-side operation validates and stores the package as the\n next revision and activates it. The server refuses, before writing anything:\n a model outside the workspace model list, an Environment the workspace lacks,\n a required secret binding, an inline agent that already has the slug, and a\n server with no sandbox provider that can stage a package. Report the message\n as the server words it. Show `_directive.renderedCard` verbatim.\n `--no-activate` stores the revision and leaves the slot on its active one.\n4. **Run the managed agent.**\n `mutagent helix agent @<slug> [--env <name>] -p \"<task>\"` runs headless;\n `--rpc` runs interactive. `@<slug>:vN` pins a revision; `@<slug>:latest` runs\n the newest validated one. The receipt (reference, sessionId: the hs1_ session\n id, agent, mode) is one JSON line on stderr: keep the reference. `mutagent helix session attach`,\n `send` (interactive only), `signal`, `checkpoint`, `checkpoints` and\n `close-input` take it. Restore of a managed agent's session is refused today;\n start a new run. A person starts a managed agent run (terminal, Desktop, web); from inside a\n cloud sandbox the platform refuses the launch (`SANDBOX_CANNOT_LAUNCH`): show the refusal as-is.\n5. **Inspect.** `mutagent agent inspect <slug> [--env <name>] --json` shows the\n revisions, each slot's active revision and the sessions launched from it.\n `mutagent agent list --json` lists the workspace's managed agents. Both run on\n a laptop only: inside a cloud sandbox they fail with `SANDBOX_SCOPE`, and the\n deployment check is `mutagent factory show <entry> --json` instead.\n6. **Roll back or retire.** `mutagent agent activate <slug> --revision vN\n [--env <name>] --json` makes an older revision active for new runs; running\n sessions keep theirs. `mutagent agent retire <slug> [--env <name>] --force`\n disables the slot; `activate` re-enables it. Retire refuses without `--force`\n in every mode: confirm with the user first.\n\nOn an uncertain deploy or activate (a network error, a 5xx), retry the same\ncommand with the same `--idempotency-key` the error's recovery names; a new key\nis a new request. `mutagent agent inspect --operation <id>` shows the recorded\noutcome of one operation. `pack --output <archive>` writes the archive for\ninspection; the path must be outside the agent folder and replacing a file\nneeds `--force`.\n",
|
|
22097
22108
|
"workflows/factory-register.md": `---
|
|
@@ -22316,6 +22327,11 @@ outcome". Reports are its evidence. The six stages are spec, build, evaluate,
|
|
|
22316
22327
|
diagnose, optimize and ship. Read \`mutagent factory stage --help\` before the first
|
|
22317
22328
|
use.
|
|
22318
22329
|
|
|
22330
|
+
Reports are discovery, diagnostics, \`--kind evaluator\` (an evaluation) and
|
|
22331
|
+
review (the human-in-the-loop calibration of a judge). The spec stage pushes no report: its
|
|
22332
|
+
output is the spec version (\`mutagent factory spec push\`, see
|
|
22333
|
+
[factory-spec-sync.md](./factory-spec-sync.md)). Record or finish its run without one.
|
|
22334
|
+
|
|
22319
22335
|
## P3: a stage in this session
|
|
22320
22336
|
|
|
22321
22337
|
A stage runs here: the user types \`/<stage>\` (\`/evaluate\`) or asks for one;
|
|
@@ -22329,6 +22345,13 @@ user confirms). Locally, record it as in P4. In a cloud sandbox:
|
|
|
22329
22345
|
3. **Finish the run:** \`mutagent factory stage finish --state succeeded --verdict PASS --json\`.
|
|
22330
22346
|
4. A session ending with work missing is woken with the list.
|
|
22331
22347
|
|
|
22348
|
+
**An entry session** is bound to an entry but launched with no stage (the web's
|
|
22349
|
+
"Run in Helix", or \`mutagent helix agent … --subject <entry-id>\` with no \`--stage\`):
|
|
22350
|
+
no run is open. Its first message names the stage: \`/<stage> …\` means run that stage
|
|
22351
|
+
in this session. Open its run with \`mutagent factory stage start --stage <stage> --json\`
|
|
22352
|
+
(the entry is the bound one), do the work, then push the report and finish the run
|
|
22353
|
+
as in steps 2 and 3.
|
|
22354
|
+
|
|
22332
22355
|
**Only when the user asks for a separate sandbox, and never from inside a sandbox:**
|
|
22333
22356
|
\`mutagent helix agent --name <agent> --subject <entry-id> --stage <stage> -p "<task>"\`
|
|
22334
22357
|
starts a visible child session (\`mutagent helix session list\`, the web); its agent
|
|
@@ -22910,9 +22933,11 @@ user which filters were not applied.
|
|
|
22910
22933
|
## In a cloud sandbox
|
|
22911
22934
|
|
|
22912
22935
|
With no filter, the commands read the sandbox's own session (\`MUTAGENT_SESSION_ID\`).
|
|
22913
|
-
A
|
|
22914
|
-
|
|
22915
|
-
|
|
22936
|
+
A filter that names a client agent (\`--agent\`, \`--skill\`, \`--workflow\`, or a client's
|
|
22937
|
+
own session id) reads any client agent's traces in its workspace, with no stage run
|
|
22938
|
+
needed. Other Helix sessions stay out of reach, except an entry's sessions for a run
|
|
22939
|
+
launched for its evaluate, diagnose or optimize stage. Anything else is refused with
|
|
22940
|
+
\`TRACES_SCOPE\`: narrow to your own session or a client agent. See
|
|
22916
22941
|
[concepts/where-helix-runs.md](../concepts/where-helix-runs.md).
|
|
22917
22942
|
|
|
22918
22943
|
Gateway runs carry the same window: \`mutagent gateway runs --session <hs1_…> --json\`
|
|
@@ -27276,7 +27301,8 @@ async function runCloudLaunch(plan, mode) {
|
|
|
27276
27301
|
...plan.preset === undefined ? {} : { preset: plan.preset },
|
|
27277
27302
|
...plan.sandboxProvider === undefined ? {} : { sandboxProvider: plan.sandboxProvider },
|
|
27278
27303
|
...repositoryFields(plan),
|
|
27279
|
-
...plan.factory === undefined ? {} : { subject: plan.factory.subject
|
|
27304
|
+
...plan.factory === undefined ? {} : { subject: plan.factory.subject },
|
|
27305
|
+
...plan.factory?.stage === undefined ? {} : { stage: plan.factory.stage }
|
|
27280
27306
|
}).catch((error) => {
|
|
27281
27307
|
throw entryRefusal(launchRepositoryRefusal(error));
|
|
27282
27308
|
});
|
|
@@ -27826,7 +27852,7 @@ async function resolveFactoryDefault(name, explicit, usage, conn, env = process.
|
|
|
27826
27852
|
var MISSING_TASK_MESSAGE = 'a cloud run needs a task: pass -p "<task>", or --rpc for an interactive session';
|
|
27827
27853
|
function registerAgentCommand(parent, registration, deps = defaultPlanDeps()) {
|
|
27828
27854
|
const jsonSource = registration?.jsonSource ?? parent;
|
|
27829
|
-
parent.command("agent").description("Run a Helix agent in the cloud, or a managed agent by @slug").argument("[argv...]", "Agent definition, then the task and Helix flags; or @slug[:vN|:latest] for a managed agent").allowUnknownOption(true).allowExcessArguments(true).addOption(new Option("--sandbox <id>", "Run in an existing sandbox, by sandbox id").hideHelp()).option("--preset <name>", "Sandbox preset (not with --sandbox)").option("--sandbox-provider <name>", "Run on this configured sandbox provider").option("--env <name>", "Workspace Environment to load for this run (see mutagent env list)").option("--rpc", "Read JSON commands on stdin; write events on stdout").option("--cwd <path>", "Working directory in the sandbox").option("--repository <owner/name>", "Native brief only: run in a checkout of this GitHub repository (not with --sandbox or --cwd)").option("--branch <name>", "Branch of --repository to check out (default: its default branch)").option("--subject <id>", "Native brief only: bind the session to this Factory entry (with --stage)").option("--stage <stage>", `The platform opens a stage run first (${FACTORY_STAGES.join("|")}); the entry is --subject, else inferred`).addHelpText("after", [
|
|
27855
|
+
parent.command("agent").description("Run a Helix agent in the cloud, or a managed agent by @slug").argument("[argv...]", "Agent definition, then the task and Helix flags; or @slug[:vN|:latest] for a managed agent").allowUnknownOption(true).allowExcessArguments(true).addOption(new Option("--sandbox <id>", "Run in an existing sandbox, by sandbox id").hideHelp()).option("--preset <name>", "Sandbox preset (not with --sandbox)").option("--sandbox-provider <name>", "Run on this configured sandbox provider").option("--env <name>", "Workspace Environment to load for this run (see mutagent env list)").option("--rpc", "Read JSON commands on stdin; write events on stdout").option("--cwd <path>", "Working directory in the sandbox").option("--repository <owner/name>", "Native brief only: run in a checkout of this GitHub repository (not with --sandbox or --cwd)").option("--branch <name>", "Branch of --repository to check out (default: its default branch)").option("--subject <id>", "Native brief only: bind the session to this Factory entry (with or without --stage)").option("--stage <stage>", `The platform opens a stage run first (${FACTORY_STAGES.join("|")}); the entry is --subject, else inferred`).addHelpText("after", [
|
|
27830
27856
|
"",
|
|
27831
27857
|
"Examples:",
|
|
27832
27858
|
' mutagent helix agent @invoice-pricing --env prod -p "Price three widget units."',
|
|
@@ -27837,6 +27863,7 @@ function registerAgentCommand(parent, registration, deps = defaultPlanDeps()) {
|
|
|
27837
27863
|
' mutagent helix agent --name reviewer --env staging -p "check the deploy"',
|
|
27838
27864
|
' mutagent helix agent --name reviewer --repository acme/api --branch feat/login -p "review the branch"',
|
|
27839
27865
|
' mutagent helix agent --name evaluator --subject invoice-pricing --stage evaluate -p "Evaluate spec version 4"',
|
|
27866
|
+
' mutagent helix agent --name evaluator --subject invoice-pricing -p "/evaluate spec version 4"',
|
|
27840
27867
|
"",
|
|
27841
27868
|
"Managed agents (deployed with mutagent agent deploy):",
|
|
27842
27869
|
" @slug runs the slot's active revision; @slug:vN pins revision N; @slug:latest runs the newest validated revision.",
|
|
@@ -27850,7 +27877,9 @@ function registerAgentCommand(parent, registration, deps = defaultPlanDeps()) {
|
|
|
27850
27877
|
" The platform opens a stage run, binds the session to the entry and derives the sandbox",
|
|
27851
27878
|
" token's scopes from the entry, the stage and its policy. There is no grant flag.",
|
|
27852
27879
|
" Without --subject the entry is MUTAGENT_SUBJECT_ID, else the session's, else this checkout's .mutagent/factory.json.",
|
|
27853
|
-
"
|
|
27880
|
+
" --subject without --stage opens an entry session: bound to the entry, no stage run opened;",
|
|
27881
|
+
" the session runs its stage itself (mutagent factory stage start --stage <stage>).",
|
|
27882
|
+
" Errors: FLAG_CONFLICT (--subject or --stage with @id); MISSING_ARGUMENTS (no entry inferred: pass --subject);",
|
|
27854
27883
|
" ENTRY_NOT_FOUND (run: mutagent factory list); VALIDATION_ERROR (--stage is one of the six stages).",
|
|
27855
27884
|
"",
|
|
27856
27885
|
"Definition and task:",
|
|
@@ -27952,17 +27981,14 @@ function factoryLaunchRefusal(argv, options) {
|
|
|
27952
27981
|
if (isManagedAgentAddress(argv[0])) {
|
|
27953
27982
|
return new MutagentError("FLAG_CONFLICT", "@id already names the entry it runs as; --subject and --stage are for a native brief.", "Drop --subject and --stage, or pass them with a native brief (--name, --file or --prompt).");
|
|
27954
27983
|
}
|
|
27955
|
-
if (stage
|
|
27956
|
-
return new MutagentError("FLAG_CONFLICT", "--subject needs --stage <stage>: the stage run is what binds the session to the entry.", "Pass --stage <stage> with --subject <id>");
|
|
27957
|
-
}
|
|
27958
|
-
if (!FACTORY_STAGES.includes(stage)) {
|
|
27984
|
+
if (stage !== undefined && !FACTORY_STAGES.includes(stage)) {
|
|
27959
27985
|
return new MutagentError("VALIDATION_ERROR", `--stage ${stage} is not one of ${FACTORY_STAGES.join(", ")}.`, `Pass one of: ${FACTORY_STAGES.join(" | ")}`);
|
|
27960
27986
|
}
|
|
27961
27987
|
return;
|
|
27962
27988
|
}
|
|
27963
27989
|
async function factoryTarget(opts) {
|
|
27964
27990
|
if (opts.stage === undefined)
|
|
27965
|
-
return;
|
|
27991
|
+
return opts.subject === undefined ? undefined : { subject: opts.subject };
|
|
27966
27992
|
const subject = await resolveFactoryDefault("subject", opts.subject, { what: "--subject <id>", command: "mutagent helix agent" }, connectPlatform);
|
|
27967
27993
|
return { subject, stage: opts.stage };
|
|
27968
27994
|
}
|
|
@@ -34043,7 +34069,7 @@ init_sdk_debug();
|
|
|
34043
34069
|
var SDK_TRANSPORT_ERRORS3 = new Set(["ConnectionError", "RequestTimeoutError", "RequestAbortedError", "UnexpectedClientError"]);
|
|
34044
34070
|
var SDK_SCHEMA_ERRORS2 = new Set(["SDKValidationError", "ResponseValidationError"]);
|
|
34045
34071
|
function notSignedIn(inBox) {
|
|
34046
|
-
return inBox ? new MutagentError("SANDBOX_SCOPE", "
|
|
34072
|
+
return inBox ? new MutagentError("SANDBOX_SCOPE", "This session's token covers `mutagent reports push`, `update`, `list` and `show` only; this command isn't available inside a cloud session.", "Run: mutagent reports list") : new MutagentError("AUTH_REQUIRED", "Not signed in.", "Run: mutagent login");
|
|
34047
34073
|
}
|
|
34048
34074
|
function parseBody3(body) {
|
|
34049
34075
|
try {
|
|
@@ -34238,13 +34264,15 @@ Examples:
|
|
|
34238
34264
|
${chalk53.dim("$")} mutagent reports list --cursor <nextCursor> --json
|
|
34239
34265
|
|
|
34240
34266
|
Filters combine with AND. A page ends with nextCursor; pass it as --cursor for the next.
|
|
34267
|
+
Inside a sandbox with no API key, the sandbox's MUTAGENT_SANDBOX_TOKEN lists its own
|
|
34268
|
+
workspace's reports.
|
|
34241
34269
|
|
|
34242
34270
|
AI Agent Directive:
|
|
34243
34271
|
--json returns { reports, count, nextCursor }. nextCursor null is the last page.
|
|
34244
34272
|
Reading is free: run it before any review or retract.
|
|
34245
34273
|
`).action(async (options, command) => {
|
|
34246
34274
|
await runReportsAction(command, async (isJson) => {
|
|
34247
|
-
const conn = await connectReports({ sandboxBearer:
|
|
34275
|
+
const conn = await connectReports({ sandboxBearer: true });
|
|
34248
34276
|
const page = await conn.call((r) => r.listReports({
|
|
34249
34277
|
...options.subject === undefined ? {} : { subject: options.subject },
|
|
34250
34278
|
...options.kind === undefined ? {} : { kind: options.kind },
|
|
@@ -34273,13 +34301,16 @@ Examples:
|
|
|
34273
34301
|
${chalk53.dim("$")} mutagent reports show rep_123 --html report.html --json
|
|
34274
34302
|
|
|
34275
34303
|
The HTML is never printed; it is served as a file under a sandboxing CSP.
|
|
34304
|
+
Inside a sandbox with no API key, the sandbox's MUTAGENT_SANDBOX_TOKEN reads reports of
|
|
34305
|
+
its own workspace; any other id is REPORT_NOT_FOUND.
|
|
34276
34306
|
|
|
34277
34307
|
AI Agent Directive:
|
|
34278
|
-
--json returns { report, sessionRef, specVersion, buildRef, renderInput,
|
|
34279
|
-
_links } plus htmlFile when --html was given.
|
|
34308
|
+
--json returns { report, sessionRef, harnessSessionId, specVersion, buildRef, renderInput,
|
|
34309
|
+
htmlPath, _links } plus htmlFile when --html was given. harnessSessionId is the session id
|
|
34310
|
+
Helix itself used (null when not known); sessionRef is the hs1_ reference. An unknown id is REPORT_NOT_FOUND, exit 1.
|
|
34280
34311
|
`).action(async (id, options, command) => {
|
|
34281
34312
|
await runReportsAction(command, async (isJson) => {
|
|
34282
|
-
const conn = await connectReports({ sandboxBearer:
|
|
34313
|
+
const conn = await connectReports({ sandboxBearer: true });
|
|
34283
34314
|
const detail = await conn.call((r) => r.getReport({ id }));
|
|
34284
34315
|
let htmlFile;
|
|
34285
34316
|
if (options.html !== undefined) {
|
|
@@ -34298,7 +34329,7 @@ AI Agent Directive:
|
|
|
34298
34329
|
}
|
|
34299
34330
|
const r = detail.report;
|
|
34300
34331
|
console.log(chalk53.bold(r.title));
|
|
34301
|
-
for (const [label, value] of Object.entries({ ...row(r), session: detail.sessionRef ?? "", html: links.html })) {
|
|
34332
|
+
for (const [label, value] of Object.entries({ ...row(r), session: detail.sessionRef ?? "", "helix id": detail.harnessSessionId ?? "", html: links.html })) {
|
|
34302
34333
|
if (label !== "title" && value !== "")
|
|
34303
34334
|
console.log(` ${label.padEnd(9)}${value}`);
|
|
34304
34335
|
}
|
|
@@ -34611,6 +34642,16 @@ async function defaultReportKind(renderInput, htmlPath, openStageRunStage) {
|
|
|
34611
34642
|
throw new MutagentError("VALIDATION_ERROR", `--kind is required: nothing says what kind of report ${htmlPath} is (no open stage run with a report kind, ` + `no kind in the render input, no ${COMPLETION_FILE} stage). Allowed: ${REPORT_KINDS.join(", ")}.`, `Pass --kind <${REPORT_KINDS.join("|")}>`);
|
|
34612
34643
|
}
|
|
34613
34644
|
|
|
34645
|
+
// src/lib/harness-session.ts
|
|
34646
|
+
var HARNESS_SESSION_VAR = "PI_SESSION_ID";
|
|
34647
|
+
var MAX_LENGTH = 200;
|
|
34648
|
+
function harnessSessionField(env = process.env) {
|
|
34649
|
+
const value = env[HARNESS_SESSION_VAR]?.trim();
|
|
34650
|
+
if (value === undefined || value === "" || value.length > MAX_LENGTH)
|
|
34651
|
+
return {};
|
|
34652
|
+
return { harnessSessionId: value };
|
|
34653
|
+
}
|
|
34654
|
+
|
|
34614
34655
|
// src/commands/reports/push.ts
|
|
34615
34656
|
var PUSH_USAGE = "mutagent reports push <run-dir|report-file> [--kind <diagnostics|discovery|evaluator|hitl>] [--run-id <id>] [--subject <id>] [--session-ref <ref>] [--title <text>] [--render-input <file>] [--replace] [--stage-run <run-id>] [--spec-version <n>] [--build-target <target-id>] [--build-rev <rev>] [--apply-id <id>] [--optimize-run <id> --iteration <n>]";
|
|
34616
34657
|
async function openStageRunStage(conn, stageRun) {
|
|
@@ -34722,6 +34763,7 @@ AI Agent Directive:
|
|
|
34722
34763
|
renderInput,
|
|
34723
34764
|
...runId === undefined ? {} : { runId },
|
|
34724
34765
|
...options.sessionRef === undefined ? {} : { sessionRef: options.sessionRef },
|
|
34766
|
+
...harnessSessionField(),
|
|
34725
34767
|
...options.replace === true ? { replace: true } : {},
|
|
34726
34768
|
...links,
|
|
34727
34769
|
...optimize
|
|
@@ -38584,7 +38626,8 @@ function registerAdd2(factory) {
|
|
|
38584
38626
|
...git === undefined ? {} : { git },
|
|
38585
38627
|
...components.length === 0 ? {} : { components },
|
|
38586
38628
|
...options.dryRun === true ? { dryRun: true } : {},
|
|
38587
|
-
origin: "cli"
|
|
38629
|
+
origin: "cli",
|
|
38630
|
+
...harnessSessionField()
|
|
38588
38631
|
}, "mutagent factory add --help");
|
|
38589
38632
|
const id = result.entry.id;
|
|
38590
38633
|
if (!result.dryRun && result.entry.specVersion !== null)
|
|
@@ -38918,7 +38961,8 @@ function registerPush(spec) {
|
|
|
38918
38961
|
...components.length === 0 ? {} : { components },
|
|
38919
38962
|
...options.message === undefined ? {} : { message: options.message },
|
|
38920
38963
|
...options.dryRun === true ? { dryRun: true } : {},
|
|
38921
|
-
origin: "cli"
|
|
38964
|
+
origin: "cli",
|
|
38965
|
+
...harnessSessionField()
|
|
38922
38966
|
}, String(base), "mutagent factory spec push --help");
|
|
38923
38967
|
const version = result.specVersion.id;
|
|
38924
38968
|
if (!result.dryRun)
|
|
@@ -39077,7 +39121,8 @@ function registerStart2(stage) {
|
|
|
39077
39121
|
...fields,
|
|
39078
39122
|
...build,
|
|
39079
39123
|
...session.source === "explicit" || session.source === "env" ? { session: session.value } : {},
|
|
39080
|
-
origin: "cli"
|
|
39124
|
+
origin: "cli",
|
|
39125
|
+
...harnessSessionField()
|
|
39081
39126
|
}, "mutagent factory stage start --help");
|
|
39082
39127
|
const tips = [`Finish it: mutagent factory stage finish ${arg(result.stageRun.id)} --state succeeded --verdict PASS`];
|
|
39083
39128
|
if (isJson) {
|
|
@@ -39118,7 +39163,8 @@ function registerFinish(stage) {
|
|
|
39118
39163
|
...options.verdict === undefined ? {} : { verdict: options.verdict },
|
|
39119
39164
|
...score === undefined ? {} : { score },
|
|
39120
39165
|
...options.summary === undefined ? {} : { summary: options.summary },
|
|
39121
|
-
...options.report === undefined ? {} : { reports: options.report }
|
|
39166
|
+
...options.report === undefined ? {} : { reports: options.report },
|
|
39167
|
+
...harnessSessionField()
|
|
39122
39168
|
}, "mutagent factory stage finish --help");
|
|
39123
39169
|
if (isJson) {
|
|
39124
39170
|
output.output({ success: true, stageRun: run, _links: { ...factoryLinks(conn.endpoint, run.entry), stageRun: `/api/factory/stage-runs/${encodeURIComponent(run.id)}` } });
|
|
@@ -39171,7 +39217,8 @@ function registerRecord(stage) {
|
|
|
39171
39217
|
...options.report === undefined ? {} : { reports: options.report },
|
|
39172
39218
|
...startedAt === undefined ? {} : { startedAt },
|
|
39173
39219
|
...endedAt === undefined ? {} : { endedAt },
|
|
39174
|
-
origin: "cli"
|
|
39220
|
+
origin: "cli",
|
|
39221
|
+
...harnessSessionField()
|
|
39175
39222
|
}, "mutagent factory stage record --help");
|
|
39176
39223
|
if (isJson) {
|
|
39177
39224
|
output.output({ success: true, ...result, ...warningsOf2(recordHint), _links: factoryLinks(conn.endpoint, entryId) });
|
|
@@ -39231,7 +39278,9 @@ function registerShow7(stage) {
|
|
|
39231
39278
|
return;
|
|
39232
39279
|
}
|
|
39233
39280
|
console.log(stageLine(detail.stageRun));
|
|
39234
|
-
|
|
39281
|
+
const { origin } = detail.stageRun;
|
|
39282
|
+
const harness = origin.harnessSessionId ?? null;
|
|
39283
|
+
console.log(` Owner: ${detail.stageRun.owner.kind} ${detail.stageRun.owner.id}${origin.session === null ? "" : ` Session: ${origin.session}`}${harness === null ? "" : ` Helix session: ${harness}`}`);
|
|
39235
39284
|
for (const report of detail.reports)
|
|
39236
39285
|
console.log(` Report: ${report.id} ${report.title}${report.verdict === null ? "" : ` ${report.verdict}`}`);
|
|
39237
39286
|
console.log(` Findings: ${String(detail.findings)}`);
|
|
@@ -40578,4 +40627,4 @@ if (process.env.CLI_VERSION) {
|
|
|
40578
40627
|
}
|
|
40579
40628
|
runCli(process.argv.slice(2), cliVersion);
|
|
40580
40629
|
|
|
40581
|
-
//# debugId=
|
|
40630
|
+
//# debugId=CDD020584ED3A16264756E2164756E21
|
package/dist/index.js
CHANGED
|
@@ -454,7 +454,7 @@ function sandboxScopedFailure(failure, commandPath) {
|
|
|
454
454
|
return failure;
|
|
455
455
|
const command = commandPath === "" ? "This command" : `\`mutagent ${commandPath}\``;
|
|
456
456
|
const alternative = SANDBOX_ALTERNATIVES[commandPath.split(" ")[0] ?? ""];
|
|
457
|
-
return new MutagentError("SANDBOX_SCOPE", `${command} isn't available inside a cloud session: this session is signed in with its own session token, which covers the Factory, traces, pushing and
|
|
457
|
+
return new MutagentError("SANDBOX_SCOPE", `${command} isn't available inside a cloud session: this session is signed in with its own session token, which covers the Factory, traces, pushing, updating, listing and showing reports, and this session.`, alternative === undefined ? "Inside this session use the Factory and traces commands, or reports push, reports update, reports list or reports show (mutagent --help lists them)." : `Run: ${alternative}`);
|
|
458
458
|
}
|
|
459
459
|
var SANDBOX_TOKEN_VAR2 = "MUTAGENT_SANDBOX_TOKEN", SANDBOX_ALTERNATIVES;
|
|
460
460
|
var init_sandbox_scope_error = __esm(() => {
|
|
@@ -2088,4 +2088,4 @@ export {
|
|
|
2088
2088
|
version
|
|
2089
2089
|
};
|
|
2090
2090
|
|
|
2091
|
-
//# debugId=
|
|
2091
|
+
//# debugId=844723769E2CA5CA64756E2164756E21
|
package/package.json
CHANGED