@hienlh/ppm 0.8.4 → 0.8.5
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/providers/claude-agent-sdk.ts +5 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.5] - 2026-03-23
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Diagnostic error messages for project-specific failures**: When SDK returns `assistant error: unknown`, error now includes project path and exact `claude` CLI command to run for diagnosis
|
|
7
|
+
- **Full SDK event dump on error**: Log complete assistant message JSON for debugging (visible in server logs)
|
|
8
|
+
- **Removed broken session retry**: Retry-as-fresh-session didn't help since fresh sessions also fail for the same project — removed to avoid masking the real error
|
|
9
|
+
|
|
3
10
|
## [0.8.4] - 2026-03-23
|
|
4
11
|
|
|
5
12
|
### Fixed
|
package/package.json
CHANGED
|
@@ -799,47 +799,16 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
799
799
|
// SDK assistant messages can carry an error field for auth/billing/rate-limit failures
|
|
800
800
|
const assistantError = (msg as any).error as string | undefined;
|
|
801
801
|
if (assistantError) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
retryCount++;
|
|
806
|
-
console.warn(`[sdk] session=${sessionId} resume failed with assistant error "${assistantError}" — retrying as fresh session`);
|
|
807
|
-
yield { type: "text" as const, content: `Session resume failed (${assistantError}). Retrying with a fresh session...` };
|
|
808
|
-
// Re-create query without resume
|
|
809
|
-
const freshQ = query({
|
|
810
|
-
prompt: message,
|
|
811
|
-
options: {
|
|
812
|
-
cwd: effectiveCwd,
|
|
813
|
-
systemPrompt: systemPromptOpt,
|
|
814
|
-
settingSources: ["user", "project"],
|
|
815
|
-
env: queryEnv,
|
|
816
|
-
settings: { permissions: { allow: [], deny: [] } },
|
|
817
|
-
allowedTools,
|
|
818
|
-
permissionMode,
|
|
819
|
-
allowDangerouslySkipPermissions: isBypass,
|
|
820
|
-
...(permissionHooks && { hooks: permissionHooks }),
|
|
821
|
-
...(providerConfig.model && { model: providerConfig.model }),
|
|
822
|
-
...(providerConfig.effort && { effort: providerConfig.effort }),
|
|
823
|
-
maxTurns: providerConfig.max_turns ?? 100,
|
|
824
|
-
...(providerConfig.max_budget_usd && { maxBudgetUsd: providerConfig.max_budget_usd }),
|
|
825
|
-
...(providerConfig.thinking_budget_tokens != null && {
|
|
826
|
-
thinkingBudgetTokens: providerConfig.thinking_budget_tokens,
|
|
827
|
-
}),
|
|
828
|
-
canUseTool,
|
|
829
|
-
includePartialMessages: true,
|
|
830
|
-
} as any,
|
|
831
|
-
});
|
|
832
|
-
this.activeQueries.set(sessionId, freshQ);
|
|
833
|
-
eventSource = freshQ;
|
|
834
|
-
continue retryLoop;
|
|
835
|
-
}
|
|
802
|
+
// Dump full SDK message for debugging
|
|
803
|
+
console.error(`[sdk] session=${sessionId} cwd=${effectiveCwd} assistant error: ${assistantError} (isFirst=${isFirstMessage} retry=${retryCount})`);
|
|
804
|
+
console.error(`[sdk] assistant message dump: ${JSON.stringify(msg).slice(0, 2000)}`);
|
|
836
805
|
const errorHints: Record<string, string> = {
|
|
837
806
|
authentication_failed: "API authentication failed. Check your account credentials in Settings → Accounts.",
|
|
838
807
|
billing_error: "Billing error on this account. Check your subscription status.",
|
|
839
808
|
rate_limit: "Rate limited by the API. Please wait and try again.",
|
|
840
809
|
invalid_request: "Invalid request sent to the API.",
|
|
841
810
|
server_error: "Anthropic API server error. Try again shortly.",
|
|
842
|
-
unknown:
|
|
811
|
+
unknown: `API error in project "${effectiveCwd}". Debug: run \`cd ${effectiveCwd} && claude -p "hi"\` in your terminal. If that also fails, the issue is Claude CLI auth or project config (.claude/ folder). Try: 1) \`claude login\`, 2) Remove .claude/settings.local.json, 3) Create a new chat session.`,
|
|
843
812
|
};
|
|
844
813
|
const hint = errorHints[assistantError] ?? `API error: ${assistantError}`;
|
|
845
814
|
yield { type: "error", message: hint };
|
|
@@ -1020,7 +989,7 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
1020
989
|
} // end retryLoop
|
|
1021
990
|
} catch (e) {
|
|
1022
991
|
const msg = (e as Error).message ?? String(e);
|
|
1023
|
-
console.error(`[sdk] error: ${msg}`);
|
|
992
|
+
console.error(`[sdk] session=${sessionId} cwd=${meta.projectPath} error: ${msg}`);
|
|
1024
993
|
if (msg.includes("abort") || msg.includes("closed")) {
|
|
1025
994
|
// User-initiated abort or WS closed — nothing to report
|
|
1026
995
|
} else if (!isFirstMessage && msg.includes("exited with code")) {
|