@hienlh/ppm 0.5.8 → 0.5.10

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.10] - 2026-03-18
4
+
5
+ ### Added
6
+ - **SDK diagnostic logging** — logs `claude --version` output, auth env var status (SET/unset) before each query; helps identify why SDK hangs on Windows
7
+
8
+ ## [0.5.9] - 2026-03-18
9
+
10
+ ### Fixed
11
+ - **Windows: SDK query hangs silently** — provide fallback `cwd` (home directory) when no project selected; undefined cwd caused SDK subprocess to fail on Windows daemons
12
+ - **Better SDK diagnostics** — log claude CLI path check, full error stack on failure; helps debug Windows daemon PATH issues
13
+
3
14
  ## [0.5.8] - 2026-03-18
4
15
 
5
16
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -295,7 +295,10 @@ export class ClaudeAgentSdkProvider implements AIProvider {
295
295
  // Resolve SDK's actual session ID for resume (may differ from PPM's UUID)
296
296
  // For fork: use the source session's SDK id
297
297
  const sdkId = shouldFork ? getSdkSessionId(forkSourceId!) : getSdkSessionId(sessionId);
298
- console.log(`[sdk] query: session=${sessionId} sdkId=${sdkId} isFirst=${isFirstMessage} fork=${shouldFork} cwd=${meta.projectPath ?? "(none)"} platform=${process.platform}`);
298
+ // Fallback cwd: SDK needs a valid working directory even when no project is selected.
299
+ // On Windows daemons, undefined cwd can cause the subprocess to fail silently.
300
+ const effectiveCwd = meta.projectPath || homedir();
301
+ console.log(`[sdk] query: session=${sessionId} sdkId=${sdkId} isFirst=${isFirstMessage} fork=${shouldFork} cwd=${effectiveCwd} platform=${process.platform}`);
299
302
 
300
303
  const q = query({
301
304
  prompt: message,
@@ -303,7 +306,7 @@ export class ClaudeAgentSdkProvider implements AIProvider {
303
306
  sessionId: isFirstMessage && !shouldFork ? sessionId : undefined,
304
307
  resume: (isFirstMessage && !shouldFork) ? undefined : sdkId,
305
308
  ...(shouldFork && { forkSession: true }),
306
- cwd: meta.projectPath,
309
+ cwd: effectiveCwd,
307
310
  // Use full Claude Code system prompt (coding guidelines, security, response style)
308
311
  systemPrompt: { type: "preset", preset: "claude_code" },
309
312
  // Load skills/settings from both user (~/.claude) and project directory
@@ -341,6 +344,36 @@ export class ClaudeAgentSdkProvider implements AIProvider {
341
344
  this.activeQueries.set(sessionId, q);
342
345
  console.log(`[sdk] query object created, starting iteration...`);
343
346
 
347
+ // Verify claude CLI is accessible (early warning on Windows daemons)
348
+ try {
349
+ const which = Bun.spawnSync({
350
+ cmd: process.platform === "win32" ? ["where", "claude"] : ["which", "claude"],
351
+ stdout: "pipe", stderr: "pipe",
352
+ });
353
+ const claudePath = which.stdout.toString().trim().split("\n")[0];
354
+ console.log(`[sdk] claude CLI: ${claudePath || "(not found in PATH)"}`);
355
+ } catch { console.log("[sdk] claude CLI: check failed"); }
356
+
357
+ // Quick CLI version check — verify the binary actually runs from this process
358
+ try {
359
+ const verProc = Bun.spawnSync({
360
+ cmd: ["claude", "--version"],
361
+ stdout: "pipe", stderr: "pipe",
362
+ cwd: effectiveCwd,
363
+ });
364
+ console.log(`[sdk] claude --version: exit=${verProc.exitCode} out="${verProc.stdout.toString().trim().slice(0, 100)}"`);
365
+ if (verProc.exitCode !== 0) {
366
+ console.error(`[sdk] claude --version stderr: ${verProc.stderr.toString().trim().slice(0, 300)}`);
367
+ }
368
+ } catch (e) {
369
+ console.error(`[sdk] claude --version failed: ${(e as Error).message}`);
370
+ }
371
+
372
+ // Log env keys relevant to SDK auth (values redacted)
373
+ const authKeys = ["ANTHROPIC_API_KEY", "CLAUDE_CODE_USE_BEDROCK", "CLAUDE_CODE_USE_VERTEX", "CLAUDE_CODE_USE_FOUNDRY"];
374
+ const envStatus = authKeys.map(k => `${k}=${process.env[k] ? "SET" : "unset"}`).join(" ");
375
+ console.log(`[sdk] env auth: ${envStatus}`);
376
+
344
377
  let lastPartialText = "";
345
378
  /** Number of tool_use blocks pending results (top-level tools only, not subagent children) */
346
379
  let pendingToolCount = 0;
@@ -589,7 +622,10 @@ export class ClaudeAgentSdkProvider implements AIProvider {
589
622
  yield approvalEvents.shift()!;
590
623
  }
591
624
  } catch (e) {
592
- const msg = (e as Error).message;
625
+ const msg = (e as Error).message ?? String(e);
626
+ const stack = (e as Error).stack ?? "";
627
+ console.error(`[sdk] error: ${msg}`);
628
+ if (stack) console.error(`[sdk] stack: ${stack}`);
593
629
  // Don't yield error for intentional abort
594
630
  if (!msg.includes("abort")) {
595
631
  yield { type: "error", message: `SDK error: ${msg}` };