@hienlh/ppm 0.2.12 → 0.2.13
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/package.json
CHANGED
|
@@ -225,6 +225,7 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
225
225
|
|
|
226
226
|
try {
|
|
227
227
|
const providerConfig = this.getProviderConfig();
|
|
228
|
+
console.log(`[sdk] query: session=${sessionId} isFirst=${isFirstMessage} cwd=${meta.projectPath ?? "(none)"} resume=${!isFirstMessage ? sessionId : "N/A"}`);
|
|
228
229
|
|
|
229
230
|
const q = query({
|
|
230
231
|
prompt: message,
|
|
@@ -437,14 +438,20 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
437
438
|
|
|
438
439
|
// Surface non-success subtypes as errors so FE can display them
|
|
439
440
|
if (subtype && subtype !== "success") {
|
|
441
|
+
// Extract error detail from SDK result if available
|
|
442
|
+
const sdkError = result.error ?? result.error_message ?? result.message ?? "";
|
|
443
|
+
const sdkDetail = typeof sdkError === "string" ? sdkError : JSON.stringify(sdkError);
|
|
440
444
|
const errorMessages: Record<string, string> = {
|
|
441
445
|
error_max_turns: "Agent reached maximum turn limit.",
|
|
442
446
|
error_max_budget_usd: "Agent reached budget limit.",
|
|
443
447
|
error_during_execution: "Agent encountered an error during execution.",
|
|
444
448
|
};
|
|
449
|
+
const baseMsg = errorMessages[subtype] ?? `Agent stopped: ${subtype}`;
|
|
450
|
+
const fullMsg = sdkDetail ? `${baseMsg}\n${sdkDetail}` : baseMsg;
|
|
451
|
+
console.error(`[sdk] result error: subtype=${subtype} turns=${result.num_turns ?? 0} detail=${sdkDetail || "(none)"} raw=${JSON.stringify(result).slice(0, 500)}`);
|
|
445
452
|
yield {
|
|
446
453
|
type: "error",
|
|
447
|
-
message:
|
|
454
|
+
message: fullMsg,
|
|
448
455
|
};
|
|
449
456
|
}
|
|
450
457
|
|