@mutagent/cli 0.1.136 → 0.1.137

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
@@ -912,7 +912,7 @@ class SDKClientWrapper {
912
912
  return response.data ?? [];
913
913
  }
914
914
  async getTrace(id) {
915
- return this.request(`/api/traces/${id}`);
915
+ return this.request(`/api/traces/${id}?include=io`);
916
916
  }
917
917
  async analyzeTraces(promptId) {
918
918
  return this.request(`/api/prompts/${promptId}/trace-analysis`);
@@ -10994,7 +10994,8 @@ async function handlePostToolUse() {
10994
10994
  state.openSpans = Object.fromEntries(Object.entries(state.openSpans).filter(([k]) => k !== matchedKey));
10995
10995
  writeState(sessionId, state);
10996
10996
  }
10997
- const toolOutput = serializePayload(input.tool_output ?? input.toolOutput ?? input.tool_result ?? input.toolResult ?? input.output ?? input.result);
10997
+ const rawOutput = input.tool_response ?? input.toolResponse ?? input.tool_output ?? input.toolOutput ?? input.tool_result ?? input.toolResult ?? input.output ?? input.result;
10998
+ const toolOutput = serializePayload(rawOutput);
10998
10999
  await sendBatchTrace([
10999
11000
  {
11000
11001
  traceId,
@@ -11083,6 +11084,10 @@ async function handleStop() {
11083
11084
  writeState(sessionId, state);
11084
11085
  if (!turnSpanId)
11085
11086
  return;
11087
+ const stopReason = getString(input, "stop_reason", "stopReason") || (input.stop_reason != null ? String(input.stop_reason) : undefined);
11088
+ const assistantText = input.message ?? input.assistant_message ?? input.response ?? input.text;
11089
+ const outputValue = assistantText ?? (stopReason ? { stop_reason: stopReason } : undefined);
11090
+ const turnOutput = serializePayload(outputValue);
11086
11091
  await sendBatchTrace([
11087
11092
  {
11088
11093
  traceId: state.traceId,
@@ -11099,7 +11104,8 @@ async function handleStop() {
11099
11104
  startTime: now,
11100
11105
  endTime: now,
11101
11106
  status: "completed",
11102
- parentSpanId: peekParent(state)
11107
+ parentSpanId: peekParent(state),
11108
+ ...turnOutput !== undefined ? { output: turnOutput } : {}
11103
11109
  }
11104
11110
  ]
11105
11111
  }
@@ -11124,6 +11130,8 @@ async function handleSubagentStart() {
11124
11130
  const agentType = getString(input, "agent_type", "agentType") || "subagent";
11125
11131
  const agentId = getString(input, "agent_id", "agentId");
11126
11132
  const agentName = agentId ? `${agentType}:${agentId}` : agentType;
11133
+ const promptValue = input.prompt ?? input.message ?? input.system_prompt ?? input.task ?? input.tool_response ?? input.toolResponse;
11134
+ const agentInput = serializePayload(promptValue);
11127
11135
  pushParent(state, agentSpanId, "agent");
11128
11136
  writeState(sessionId, state);
11129
11137
  await sendBatchTrace([
@@ -11141,7 +11149,8 @@ async function handleSubagentStart() {
11141
11149
  kind: "agent",
11142
11150
  startTime: now,
11143
11151
  status: "running",
11144
- ...parentSpanId !== null ? { parentSpanId } : {}
11152
+ ...parentSpanId !== null ? { parentSpanId } : {},
11153
+ ...agentInput !== undefined ? { input: agentInput } : {}
11145
11154
  }
11146
11155
  ]
11147
11156
  }
@@ -11175,6 +11184,10 @@ async function handleSubagentStop() {
11175
11184
  writeState(sessionId, state);
11176
11185
  if (!agentSpanId)
11177
11186
  return;
11187
+ const finalMessage = input.message ?? input.assistant_message ?? input.response ?? input.tool_response ?? input.toolResponse;
11188
+ const stopReason = getString(input, "stop_reason", "stopReason");
11189
+ const outputValue = finalMessage ?? (stopReason ? { stop_reason: stopReason } : undefined);
11190
+ const agentOutput = serializePayload(outputValue);
11178
11191
  await sendBatchTrace([
11179
11192
  {
11180
11193
  traceId: state.traceId,
@@ -11191,7 +11204,8 @@ async function handleSubagentStop() {
11191
11204
  startTime: now,
11192
11205
  endTime: now,
11193
11206
  status: "completed",
11194
- ...newParent !== null ? { parentSpanId: newParent } : {}
11207
+ ...newParent !== null ? { parentSpanId: newParent } : {},
11208
+ ...agentOutput !== undefined ? { output: agentOutput } : {}
11195
11209
  }
11196
11210
  ]
11197
11211
  }
@@ -11318,7 +11332,18 @@ async function handlePostToolUseFailure() {
11318
11332
  }
11319
11333
  state.openSpans = Object.fromEntries(Object.entries(state.openSpans).filter(([k]) => k !== matchedKey));
11320
11334
  writeState(sessionId, state);
11321
- const reason = getString(input, "error", "reason", "message") || "Tool use failed";
11335
+ const toolResponse = input.tool_response ?? input.toolResponse;
11336
+ let reason = "Tool use failed";
11337
+ if (typeof toolResponse === "object" && toolResponse !== null) {
11338
+ const nested = toolResponse.error ?? toolResponse.stderr;
11339
+ if (nested != null && String(nested).length > 0) {
11340
+ reason = String(nested);
11341
+ }
11342
+ } else {
11343
+ const fallback = getString(input, "error", "reason", "message");
11344
+ if (fallback.length > 0)
11345
+ reason = fallback;
11346
+ }
11322
11347
  const errorPayload = serializePayload(reason);
11323
11348
  await sendBatchTrace([
11324
11349
  {
@@ -11850,5 +11875,5 @@ if (isInteractive && !isSkillCommand) {
11850
11875
  }
11851
11876
  program.parse();
11852
11877
 
11853
- //# debugId=A1F82C134C46598C64756E2164756E21
11878
+ //# debugId=7CCCA447B8F6661464756E2164756E21
11854
11879
  //# sourceMappingURL=cli.js.map