@hienlh/ppm 0.8.5 → 0.8.7
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 +12 -0
- package/package.json +1 -1
- package/src/providers/claude-agent-sdk.ts +12 -1
- package/src/server/ws/chat.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.7] - 2026-03-23
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Env var diagnostics in timeout/error messages**: When SDK hangs or returns `unknown` error, error message now guides user to check `ANTHROPIC_API_KEY`/`ANTHROPIC_BASE_URL` env vars (stale/invalid keys cause silent hang) with exact debug commands
|
|
7
|
+
- **Shell env logging**: Log when shell environment has `ANTHROPIC_API_KEY`/`ANTHROPIC_BASE_URL` set — helps diagnose SDK hangs in server logs
|
|
8
|
+
|
|
9
|
+
## [0.8.6] - 2026-03-23
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **Actionable timeout error**: Timeout error now shows project path, exact `claude -p "hi"` debug command, and steps to check hooks/MCP/settings
|
|
13
|
+
- **SDK lifecycle logging**: All SDK `system` events (hook_started, init, etc.) now logged with full JSON — helps diagnose where SDK hangs
|
|
14
|
+
|
|
3
15
|
## [0.8.5] - 2026-03-23
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/package.json
CHANGED
|
@@ -82,6 +82,12 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
82
82
|
account: { id: string; accessToken: string } | null,
|
|
83
83
|
): Record<string, string | undefined> {
|
|
84
84
|
const base = { ...process.env, ...this.getProjectEnvOverrides(projectPath) };
|
|
85
|
+
// Log if shell env has Anthropic vars — helps diagnose hanging SDK
|
|
86
|
+
for (const key of this.SENSITIVE_ENV_KEYS) {
|
|
87
|
+
if (process.env[key]) {
|
|
88
|
+
console.log(`[sdk] Shell env has ${key} set (length=${process.env[key]!.length})`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
85
91
|
if (!account) return base;
|
|
86
92
|
const isOAuthToken = account.accessToken.startsWith("sk-ant-oat");
|
|
87
93
|
if (isOAuthToken) {
|
|
@@ -688,6 +694,11 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
688
694
|
yield approvalEvents.shift()!;
|
|
689
695
|
}
|
|
690
696
|
|
|
697
|
+
// Log all system events for debugging SDK lifecycle
|
|
698
|
+
if (msg.type === "system") {
|
|
699
|
+
console.log(`[sdk] session=${sessionId} system: subtype=${(msg as any).subtype ?? "none"} ${JSON.stringify(msg).slice(0, 500)}`);
|
|
700
|
+
}
|
|
701
|
+
|
|
691
702
|
// Capture SDK session metadata from init message
|
|
692
703
|
if (msg.type === "system" && (msg as any).subtype === "init") {
|
|
693
704
|
const initMsg = msg as any;
|
|
@@ -808,7 +819,7 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
808
819
|
rate_limit: "Rate limited by the API. Please wait and try again.",
|
|
809
820
|
invalid_request: "Invalid request sent to the API.",
|
|
810
821
|
server_error: "Anthropic API server error. Try again shortly.",
|
|
811
|
-
unknown: `API error in project "${effectiveCwd}". Debug:
|
|
822
|
+
unknown: `API error in project "${effectiveCwd}". Debug:\n1. Run: \`cd ${effectiveCwd} && claude -p "hi"\`\n2. Check env: \`echo $ANTHROPIC_API_KEY $ANTHROPIC_BASE_URL\` — stale/invalid keys cause this\n3. Try: \`ANTHROPIC_API_KEY="" ANTHROPIC_BASE_URL="" claude -p "hi"\`\n4. Refresh auth: \`claude login\``,
|
|
812
823
|
};
|
|
813
824
|
const hint = errorHints[assistantError] ?? `API error: ${assistantError}`;
|
|
814
825
|
yield { type: "error", message: hint };
|
package/src/server/ws/chat.ts
CHANGED
|
@@ -135,9 +135,10 @@ async function runStreamLoop(sessionId: string, providerId: string, content: str
|
|
|
135
135
|
const wslHint = isWSL
|
|
136
136
|
? "\n\nWSL detected — this is likely a network issue. Try from your WSL terminal:\n curl -s https://api.anthropic.com\nIf that fails, check WSL DNS settings (/etc/resolv.conf) or proxy configuration."
|
|
137
137
|
: "";
|
|
138
|
+
const debugCmd = projectPath ? `cd ${projectPath} && claude -p "hi"` : `claude -p "hi"`;
|
|
138
139
|
safeSend(sessionId, {
|
|
139
140
|
type: "error",
|
|
140
|
-
message: `Claude SDK
|
|
141
|
+
message: `Claude SDK timed out after ${elapsed}s for project "${projectPath || "(no project)"}".${wslHint}\n\nDebug steps:\n1. Run: \`${debugCmd}\` — if it also hangs, the issue is your Claude CLI environment\n2. Check env vars: \`echo $ANTHROPIC_API_KEY $ANTHROPIC_BASE_URL\` — stale/invalid keys cause silent hang\n3. Try with env cleared: \`ANTHROPIC_API_KEY="" ANTHROPIC_BASE_URL="" ${debugCmd}\`\n4. Check hooks/MCP: \`cat ${projectPath}/.claude/settings.local.json\`\n5. Refresh auth: \`claude login\``,
|
|
141
142
|
});
|
|
142
143
|
abortController.abort();
|
|
143
144
|
return;
|