@hienlh/ppm 0.5.8 → 0.5.9

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.9] - 2026-03-18
4
+
5
+ ### Fixed
6
+ - **Windows: SDK query hangs silently** — provide fallback `cwd` (home directory) when no project selected; undefined cwd caused SDK subprocess to fail on Windows daemons
7
+ - **Better SDK diagnostics** — log claude CLI path check, full error stack on failure; helps debug Windows daemon PATH issues
8
+
3
9
  ## [0.5.8] - 2026-03-18
4
10
 
5
11
  ### 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.9",
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,16 @@ 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
+
344
357
  let lastPartialText = "";
345
358
  /** Number of tool_use blocks pending results (top-level tools only, not subagent children) */
346
359
  let pendingToolCount = 0;
@@ -589,7 +602,10 @@ export class ClaudeAgentSdkProvider implements AIProvider {
589
602
  yield approvalEvents.shift()!;
590
603
  }
591
604
  } catch (e) {
592
- const msg = (e as Error).message;
605
+ const msg = (e as Error).message ?? String(e);
606
+ const stack = (e as Error).stack ?? "";
607
+ console.error(`[sdk] error: ${msg}`);
608
+ if (stack) console.error(`[sdk] stack: ${stack}`);
593
609
  // Don't yield error for intentional abort
594
610
  if (!msg.includes("abort")) {
595
611
  yield { type: "error", message: `SDK error: ${msg}` };