@warble/claude-agent-sdk 0.18.0 → 0.19.0
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.
|
@@ -5,6 +5,12 @@ var DispatchError = class extends Error {
|
|
|
5
5
|
this.name = "DispatchError";
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
+
function boundedMessage(message) {
|
|
9
|
+
const collapsed = message.replace(/[\r\n\t]+/g, " ").replace(/\s+/g, " ").trim();
|
|
10
|
+
const withoutPaths = collapsed.replace(/(?:^|\s)\/(?:[^\s/]+\/)*[^\s]*/g, " [redacted path]");
|
|
11
|
+
const safe = /\b(select|insert|update|delete|merge|alter|drop|create)\b/i.test(withoutPaths) ? "The callee did not complete the request." : withoutPaths;
|
|
12
|
+
return (safe || "The child run did not complete.").slice(0, 240);
|
|
13
|
+
}
|
|
8
14
|
|
|
9
15
|
// src/codegen.ts
|
|
10
16
|
function ident(verb) {
|
|
@@ -2967,18 +2973,19 @@ async function runHybridStaged(plan, cfg) {
|
|
|
2967
2973
|
continue;
|
|
2968
2974
|
}
|
|
2969
2975
|
if (decision.kind === "repair") {
|
|
2970
|
-
|
|
2976
|
+
const originalFailureText = boundedMessage(artifacts[decision.target.produces ?? decision.target.name] ?? "");
|
|
2977
|
+
let lastFailureText = originalFailureText;
|
|
2971
2978
|
const { recovered, attempts } = await runRepairLoop(DEFAULT_MAX_REPAIR_ATTEMPTS, async () => {
|
|
2972
2979
|
const attempt = await executeStep(step, artifacts, execCtx, true);
|
|
2973
2980
|
outcomes[step.name] = attempt.outcome;
|
|
2974
2981
|
artifacts[artifactKey(step)] = attempt.text;
|
|
2975
2982
|
if (attempt.outcome === "success") finalText = attempt.text;
|
|
2976
|
-
else lastFailureText = attempt.text;
|
|
2983
|
+
else lastFailureText = boundedMessage(attempt.text);
|
|
2977
2984
|
return { failed: attempt.outcome === "failure" };
|
|
2978
2985
|
});
|
|
2979
2986
|
if (!recovered) {
|
|
2980
2987
|
throw new DispatchError(
|
|
2981
|
-
`repair step '${step.name}' did not recover '${decision.target.name}' after ${attempts} attempt(s); last failure: ${lastFailureText}`
|
|
2988
|
+
`repair step '${step.name}' did not recover '${decision.target.name}' after ${attempts} attempt(s); ${decision.target.name} failed: ${originalFailureText}; last failure: ${lastFailureText}`
|
|
2982
2989
|
);
|
|
2983
2990
|
}
|
|
2984
2991
|
process.stderr.write(
|
|
@@ -3090,12 +3097,6 @@ function assertSupportedComponentInvocationLimits(input) {
|
|
|
3090
3097
|
function byteLength(value) {
|
|
3091
3098
|
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
3092
3099
|
}
|
|
3093
|
-
function boundedMessage(message) {
|
|
3094
|
-
const collapsed = message.replace(/[\r\n\t]+/g, " ").replace(/\s+/g, " ").trim();
|
|
3095
|
-
const withoutPaths = collapsed.replace(/(?:^|\s)\/(?:[^\s/]+\/)*[^\s]*/g, " [redacted path]");
|
|
3096
|
-
const safe = /\b(select|insert|update|delete|merge|alter|drop|create)\b/i.test(withoutPaths) ? "The callee did not complete the request." : withoutPaths;
|
|
3097
|
-
return (safe || "The child run did not complete.").slice(0, 240);
|
|
3098
|
-
}
|
|
3099
3100
|
function isJsonValue(value, seen = /* @__PURE__ */ new Set()) {
|
|
3100
3101
|
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
3101
3102
|
if (typeof value === "number") return Number.isFinite(value);
|
|
@@ -3536,7 +3537,13 @@ var ComponentInvocationRuntime = class {
|
|
|
3536
3537
|
if (result2.outcome === "success") finalText = result2.text;
|
|
3537
3538
|
return { failed: result2.outcome === "failure" };
|
|
3538
3539
|
});
|
|
3539
|
-
if (!repair.recovered)
|
|
3540
|
+
if (!repair.recovered) {
|
|
3541
|
+
const target = decision.target;
|
|
3542
|
+
const original = boundedMessage(artifacts[target.produces ?? target.name] ?? "");
|
|
3543
|
+
throw new DispatchError(
|
|
3544
|
+
`callee_failed: repair step '${call.name}' did not recover; ${target.name} failed: ${original}`
|
|
3545
|
+
);
|
|
3546
|
+
}
|
|
3540
3547
|
continue;
|
|
3541
3548
|
}
|
|
3542
3549
|
}
|
|
@@ -4684,4 +4691,4 @@ export {
|
|
|
4684
4691
|
ChatSession,
|
|
4685
4692
|
createChatSession
|
|
4686
4693
|
};
|
|
4687
|
-
//# sourceMappingURL=chunk-
|
|
4694
|
+
//# sourceMappingURL=chunk-J53WGCGG.js.map
|