@mutagent/cli 0.1.271 → 0.1.272

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 CHANGED
@@ -2886,8 +2886,8 @@ AI Agent Directive:
2886
2886
  _directive: directive
2887
2887
  });
2888
2888
  } else {
2889
- output.success(`Provider created: ${created.name ?? options.name}`);
2890
- console.log(` ID: ${String(created.id)}`);
2889
+ output.success(`Provider created: ${created.name}`);
2890
+ console.log(` ID: ${created.id}`);
2891
2891
  console.log(` Type: ${providerType}`);
2892
2892
  if (options.hostedFamily) {
2893
2893
  console.log(` Serves: ${options.hostedFamily}`);
@@ -2990,16 +2990,16 @@ PATCH semantics — only provided fields are updated.
2990
2990
  output.output({
2991
2991
  success: true,
2992
2992
  ...updated,
2993
- _links: providerLinks(updated.id ?? id),
2993
+ _links: providerLinks(updated.id),
2994
2994
  _directive: directive
2995
2995
  });
2996
2996
  } else {
2997
- output.success(`Provider updated: ${String(updated.name ?? id)}`);
2998
- console.log(` ID: ${String(updated.id ?? id)}`);
2997
+ output.success(`Provider updated: ${updated.name}`);
2998
+ console.log(` ID: ${updated.id}`);
2999
2999
  if (updated.workspaceId) {
3000
3000
  console.log(` Workspace: ${updated.workspaceId}`);
3001
3001
  }
3002
- console.log(` URL: ${providerLink(updated.id ?? id)}`);
3002
+ console.log(` URL: ${providerLink(updated.id)}`);
3003
3003
  if (options.apiKey) {
3004
3004
  console.log(chalk9.dim(" API key re-encrypted server-side."));
3005
3005
  }
@@ -3170,14 +3170,13 @@ Examples:
3170
3170
  filters.type = validateProviderType(options.type);
3171
3171
  }
3172
3172
  const result = await client.listProviders(filters);
3173
- let catalogByKind = {};
3173
+ const catalogByKind = {};
3174
3174
  if (options.models) {
3175
3175
  try {
3176
3176
  const catalog = await client.getModelsCatalog();
3177
3177
  for (const entry of catalog.models) {
3178
3178
  const kind = entry.provider.kind;
3179
- if (!catalogByKind[kind])
3180
- catalogByKind[kind] = [];
3179
+ catalogByKind[kind] ??= [];
3181
3180
  catalogByKind[kind].push(entry.id);
3182
3181
  }
3183
3182
  } catch {}
@@ -3188,7 +3187,7 @@ Examples:
3188
3187
  return "—";
3189
3188
  if (models.length <= 3)
3190
3189
  return models.join(", ");
3191
- return `${models.slice(0, 3).join(", ")} +${models.length - 3} more`;
3190
+ return `${models.slice(0, 3).join(", ")} +${String(models.length - 3)} more`;
3192
3191
  };
3193
3192
  if (isJson) {
3194
3193
  const withLinks = result.data.map((p) => ({
@@ -4335,7 +4334,7 @@ function convertTranscript(records, opts) {
4335
4334
  lastTs = startTime;
4336
4335
  const text = contentToText(r.message?.content);
4337
4336
  const span = {
4338
- spanId: String(r.id ?? r.uuid ?? `span-${String(spans.length)}`).slice(0, 128),
4337
+ spanId: (r.id ?? r.uuid ?? `span-${String(spans.length)}`).slice(0, 128),
4339
4338
  name: `helix.${role}`,
4340
4339
  kind: role === "assistant" ? "llm" : "message",
4341
4340
  startTime,
@@ -4795,7 +4794,7 @@ async function handleStop() {
4795
4794
  writeState(sessionId, state);
4796
4795
  if (!turnSpanId)
4797
4796
  return;
4798
- const stopReason = getString(input, "stop_reason", "stopReason") || (input.stop_reason != null ? String(input.stop_reason) : undefined);
4797
+ const stopReason = getString(input, "stop_reason", "stopReason") || serializePayload(input.stop_reason);
4799
4798
  const assistantText = input.message ?? input.assistant_message ?? input.response ?? input.text;
4800
4799
  const outputValue = assistantText ?? (stopReason ? { stop_reason: stopReason } : undefined);
4801
4800
  const turnOutput = serializePayload(outputValue);
@@ -5046,9 +5045,9 @@ async function handlePostToolUseFailure() {
5046
5045
  const toolResponse = input.tool_response ?? input.toolResponse;
5047
5046
  let reason = "Tool use failed";
5048
5047
  if (typeof toolResponse === "object" && toolResponse !== null) {
5049
- const nested = toolResponse.error ?? toolResponse.stderr;
5050
- if (nested != null && String(nested).length > 0) {
5051
- reason = String(nested);
5048
+ const nested = serializePayload(toolResponse.error ?? toolResponse.stderr);
5049
+ if (nested !== undefined && nested.length > 0) {
5050
+ reason = nested;
5052
5051
  }
5053
5052
  } else {
5054
5053
  const fallback = getString(input, "error", "reason", "message");
@@ -5295,7 +5294,7 @@ unparseable lines without sending anything.
5295
5294
  unparseableLines: skipped,
5296
5295
  recordsIgnored: ignored
5297
5296
  });
5298
- say(`[mutagent hooks] ${basename(file)}: ${String(trace.spans.length)} spans` + `${skipped > 0 ? `, ${String(skipped)} unparseable lines` : ""}` + `${ignored > 0 ? `, ${String(ignored)} records ignored` : ""}
5297
+ say(`[mutagent hooks] ${basename(file)}: ${String(trace.spans.length)} spans` + (skipped > 0 ? `, ${String(skipped)} unparseable lines` : "") + (ignored > 0 ? `, ${String(ignored)} records ignored` : "") + `
5299
5298
  `);
5300
5299
  batch.push(trace);
5301
5300
  }
@@ -6774,8 +6773,12 @@ function reattachHint(id, lastSeq) {
6774
6773
  function createSessionSink(isJson) {
6775
6774
  if (isJson) {
6776
6775
  return {
6777
- stdout: (text, seq) => writeEvent("stdout", { seq, text }),
6778
- stderr: (text, seq) => writeEvent("stderr", { seq, text }),
6776
+ stdout: (text, seq) => {
6777
+ writeEvent("stdout", { seq, text });
6778
+ },
6779
+ stderr: (text, seq) => {
6780
+ writeEvent("stderr", { seq, text });
6781
+ },
6779
6782
  notice: (message) => {
6780
6783
  process.stderr.write(`${JSON.stringify({ type: "notice", message })}
6781
6784
  `);
@@ -6840,7 +6843,7 @@ function reportOutcome(id, result, sink, onDisconnect) {
6840
6843
  if (result.gaps > 0) {
6841
6844
  sink.notice(`Session ended, but ${String(result.gaps)} gap(s) occurred — the output above is not complete.`);
6842
6845
  }
6843
- if (result.result !== undefined && result.result.tornDown === false) {
6846
+ if (result.result !== undefined && !result.result.tornDown) {
6844
6847
  sink.notice(`Sandbox ${result.result.sandboxId} was NOT torn down. Destroy it with: mutagent helix rm ${result.result.sandboxId} --force`);
6845
6848
  }
6846
6849
  if (result.result?.timedOut === true) {
@@ -6980,7 +6983,7 @@ async function createSandbox(definition, isJson) {
6980
6983
  const spinner = ora2(`Spawning ${definition.image} (${definition.arch})...`).start();
6981
6984
  try {
6982
6985
  const sandbox = await spawnSandbox(definition);
6983
- spinner.succeed(chalk20.green(`Sandbox ${String(sandbox.id)} spawned`));
6986
+ spinner.succeed(chalk20.green(`Sandbox ${sandbox.id} spawned`));
6984
6987
  return sandbox;
6985
6988
  } catch (error) {
6986
6989
  spinner.fail(chalk20.red("Spawn failed"));
@@ -7357,7 +7360,7 @@ AI Agent Directive:
7357
7360
  const sandboxes = await listSandboxes();
7358
7361
  if (isJson) {
7359
7362
  output.output({
7360
- sandboxes: sandboxes.map((s) => ({ ...s, _links: sandboxLinks(String(s.id)) })),
7363
+ sandboxes: sandboxes.map((s) => ({ ...s, _links: sandboxLinks(s.id) })),
7361
7364
  count: sandboxes.length
7362
7365
  });
7363
7366
  return;
@@ -7501,12 +7504,7 @@ AI Agent Directive:
7501
7504
  return;
7502
7505
  }
7503
7506
  output.output(spans.map((span) => {
7504
- const {
7505
- workspaceId: _workspaceId,
7506
- sandboxId: _sandboxId,
7507
- receivedAt: _receivedAt,
7508
- ...rest
7509
- } = span;
7507
+ const { workspaceId: _workspaceId, sandboxId: _sandboxId, receivedAt: _receivedAt, ...rest } = span;
7510
7508
  return rest;
7511
7509
  }));
7512
7510
  } catch (error) {
@@ -7608,7 +7606,7 @@ var lerp = (a, b, t) => Math.round(a + (b - a) * t);
7608
7606
  function mix(from, to, t) {
7609
7607
  return [lerp(from[0], to[0], t), lerp(from[1], to[1], t), lerp(from[2], to[2], t)];
7610
7608
  }
7611
- var ansi = (r, g, b) => `\x1B[38;2;${r};${g};${b}m`;
7609
+ var ansi = (r, g, b) => `\x1B[38;2;${String(r)};${String(g)};${String(b)}m`;
7612
7610
  var RESET = "\x1B[0m";
7613
7611
  function gradientLine(line, from, to) {
7614
7612
  const chars = Array.from(line);
@@ -7809,5 +7807,5 @@ program.addCommand(createFeedbackCommand());
7809
7807
  program.addCommand(createTraceCommand());
7810
7808
  program.parse();
7811
7809
 
7812
- //# debugId=84C2BB73F467526664756E2164756E21
7810
+ //# debugId=CF4805C211690B5864756E2164756E21
7813
7811
  //# sourceMappingURL=cli.js.map