@hienlh/ppm 0.5.16 → 0.5.17
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 +5 -0
- package/package.json +1 -1
- package/src/providers/claude-agent-sdk.ts +23 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.17] - 2026-03-18
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Windows: resume sessions that exist on disk** — when no explicit mapping but `getSessionMessages()` finds messages, use PPM UUID for `--resume` (session was created with that ID). Prevents losing conversation context when resuming old sessions via CLI fallback
|
|
7
|
+
|
|
3
8
|
## [0.5.16] - 2026-03-18
|
|
4
9
|
|
|
5
10
|
### Fixed
|
package/package.json
CHANGED
|
@@ -108,18 +108,15 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
108
108
|
prompt: string;
|
|
109
109
|
cwd: string;
|
|
110
110
|
sessionId: string;
|
|
111
|
-
|
|
112
|
-
isFirstMessage: boolean;
|
|
113
|
-
shouldFork: boolean;
|
|
111
|
+
resumeSessionId?: string;
|
|
114
112
|
env: Record<string, string | undefined>;
|
|
115
113
|
providerConfig: Partial<import("../types/config.ts").AIProviderConfig>;
|
|
116
114
|
}): AsyncGenerator<any> {
|
|
117
115
|
const args = ["-p", opts.prompt, "--verbose", "--output-format", "stream-json"];
|
|
118
116
|
|
|
119
|
-
// Session management —
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
args.push("--resume", opts.sdkId);
|
|
117
|
+
// Session management — resume if caller confirmed a valid session ID
|
|
118
|
+
if (opts.resumeSessionId) {
|
|
119
|
+
args.push("--resume", opts.resumeSessionId);
|
|
123
120
|
}
|
|
124
121
|
|
|
125
122
|
// Config-driven options
|
|
@@ -464,14 +461,29 @@ export class ClaudeAgentSdkProvider implements AIProvider {
|
|
|
464
461
|
let eventSource: AsyncIterable<any>;
|
|
465
462
|
|
|
466
463
|
if (useDirectCli) {
|
|
467
|
-
|
|
464
|
+
// Determine resumeSessionId for CLI --resume flag:
|
|
465
|
+
// 1. Explicit mapping exists (sdkId !== sessionId) → use mapped SDK ID
|
|
466
|
+
// 2. No mapping but session has messages on disk → session was created with PPM UUID, resume it
|
|
467
|
+
// 3. No mapping, no messages → truly new session, don't resume
|
|
468
|
+
let resumeSessionId: string | undefined;
|
|
469
|
+
if (sdkId !== sessionId) {
|
|
470
|
+
resumeSessionId = sdkId;
|
|
471
|
+
} else if (!isFirstMessage) {
|
|
472
|
+
try {
|
|
473
|
+
const existingMsgs = await getSessionMessages(sessionId);
|
|
474
|
+
if (existingMsgs.length > 0) {
|
|
475
|
+
resumeSessionId = sessionId;
|
|
476
|
+
saveSessionMapping(sessionId, sessionId);
|
|
477
|
+
console.log(`[sdk] session ${sessionId} exists on disk (${existingMsgs.length} msgs) — will resume`);
|
|
478
|
+
}
|
|
479
|
+
} catch {}
|
|
480
|
+
}
|
|
481
|
+
console.log(`[sdk] Windows detected — using direct CLI fallback (resume=${resumeSessionId ?? "none"})`);
|
|
468
482
|
eventSource = this.queryDirectCli({
|
|
469
483
|
prompt: message,
|
|
470
484
|
cwd: effectiveCwd,
|
|
471
485
|
sessionId,
|
|
472
|
-
|
|
473
|
-
isFirstMessage,
|
|
474
|
-
shouldFork,
|
|
486
|
+
resumeSessionId,
|
|
475
487
|
env: queryEnv,
|
|
476
488
|
providerConfig,
|
|
477
489
|
});
|