@mutagent/cli 0.1.275 → 0.1.277
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 +23 -15
- package/dist/bin/cli.js.map +5 -5
- package/package.json +3 -4
package/dist/bin/cli.js
CHANGED
|
@@ -4731,6 +4731,20 @@ async function handlePostToolUse() {
|
|
|
4731
4731
|
|
|
4732
4732
|
// src/commands/hooks/handlers-v2.ts
|
|
4733
4733
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4734
|
+
function resolveStopReason(input) {
|
|
4735
|
+
return getString(input, "stop_reason", "stopReason") || serializePayload(input.stop_reason);
|
|
4736
|
+
}
|
|
4737
|
+
function resolveToolFailureReason(input) {
|
|
4738
|
+
const toolResponse = input.tool_response ?? input.toolResponse;
|
|
4739
|
+
if (typeof toolResponse === "object" && toolResponse !== null) {
|
|
4740
|
+
const nested = serializePayload(toolResponse.error ?? toolResponse.stderr);
|
|
4741
|
+
if (nested !== undefined && nested.length > 0)
|
|
4742
|
+
return nested;
|
|
4743
|
+
return "Tool use failed";
|
|
4744
|
+
}
|
|
4745
|
+
const fallback = getString(input, "error", "reason", "message");
|
|
4746
|
+
return fallback.length > 0 ? fallback : "Tool use failed";
|
|
4747
|
+
}
|
|
4734
4748
|
async function handleUserPromptSubmit() {
|
|
4735
4749
|
const input = await readStdin();
|
|
4736
4750
|
const sessionId = getString(input, "session_id", "sessionId");
|
|
@@ -4794,7 +4808,7 @@ async function handleStop() {
|
|
|
4794
4808
|
writeState(sessionId, state);
|
|
4795
4809
|
if (!turnSpanId)
|
|
4796
4810
|
return;
|
|
4797
|
-
const stopReason =
|
|
4811
|
+
const stopReason = resolveStopReason(input);
|
|
4798
4812
|
const assistantText = input.message ?? input.assistant_message ?? input.response ?? input.text;
|
|
4799
4813
|
const outputValue = assistantText ?? (stopReason ? { stop_reason: stopReason } : undefined);
|
|
4800
4814
|
const turnOutput = serializePayload(outputValue);
|
|
@@ -5042,18 +5056,7 @@ async function handlePostToolUseFailure() {
|
|
|
5042
5056
|
}
|
|
5043
5057
|
state.openSpans = Object.fromEntries(Object.entries(state.openSpans).filter(([k]) => k !== matchedKey));
|
|
5044
5058
|
writeState(sessionId, state);
|
|
5045
|
-
const
|
|
5046
|
-
let reason = "Tool use failed";
|
|
5047
|
-
if (typeof toolResponse === "object" && toolResponse !== null) {
|
|
5048
|
-
const nested = serializePayload(toolResponse.error ?? toolResponse.stderr);
|
|
5049
|
-
if (nested !== undefined && nested.length > 0) {
|
|
5050
|
-
reason = nested;
|
|
5051
|
-
}
|
|
5052
|
-
} else {
|
|
5053
|
-
const fallback = getString(input, "error", "reason", "message");
|
|
5054
|
-
if (fallback.length > 0)
|
|
5055
|
-
reason = fallback;
|
|
5056
|
-
}
|
|
5059
|
+
const reason = resolveToolFailureReason(input);
|
|
5057
5060
|
const errorPayload = serializePayload(reason);
|
|
5058
5061
|
await sendBatchTrace([
|
|
5059
5062
|
{
|
|
@@ -7504,7 +7507,12 @@ AI Agent Directive:
|
|
|
7504
7507
|
return;
|
|
7505
7508
|
}
|
|
7506
7509
|
output.output(spans.map((span) => {
|
|
7507
|
-
const {
|
|
7510
|
+
const {
|
|
7511
|
+
workspaceId: _workspaceId,
|
|
7512
|
+
sandboxId: _sandboxId,
|
|
7513
|
+
receivedAt: _receivedAt,
|
|
7514
|
+
...rest
|
|
7515
|
+
} = span;
|
|
7508
7516
|
return rest;
|
|
7509
7517
|
}));
|
|
7510
7518
|
} catch (error) {
|
|
@@ -7807,5 +7815,5 @@ program.addCommand(createFeedbackCommand());
|
|
|
7807
7815
|
program.addCommand(createTraceCommand());
|
|
7808
7816
|
program.parse();
|
|
7809
7817
|
|
|
7810
|
-
//# debugId=
|
|
7818
|
+
//# debugId=0D5785F3AE94E3BA64756E2164756E21
|
|
7811
7819
|
//# sourceMappingURL=cli.js.map
|