@punkcode/cli 0.1.6 → 0.1.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/dist/cli.js +20 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -49,6 +49,7 @@ function runClaude(options, callbacks) {
|
|
|
49
49
|
...opts.allowedTools && { allowedTools: opts.allowedTools },
|
|
50
50
|
...opts.disallowedTools && { disallowedTools: opts.disallowedTools },
|
|
51
51
|
...opts.maxTurns && { maxTurns: opts.maxTurns },
|
|
52
|
+
systemPrompt: opts.systemPrompt ?? { type: "preset", preset: "claude_code" },
|
|
52
53
|
...options.cwd && { cwd: options.cwd },
|
|
53
54
|
...options.sessionId && { resume: options.sessionId },
|
|
54
55
|
maxThinkingTokens: 1e4,
|
|
@@ -543,7 +544,7 @@ function parseSessionFile(content) {
|
|
|
543
544
|
}
|
|
544
545
|
if (entry.type === "system" && entry.subtype === "compact_boundary") {
|
|
545
546
|
messages.push({
|
|
546
|
-
role: "
|
|
547
|
+
role: "system",
|
|
547
548
|
content: [],
|
|
548
549
|
timestamp: entry.timestamp,
|
|
549
550
|
type: "system",
|
|
@@ -553,6 +554,24 @@ function parseSessionFile(content) {
|
|
|
553
554
|
});
|
|
554
555
|
continue;
|
|
555
556
|
}
|
|
557
|
+
if (entry.isCompactSummary && entry.message) {
|
|
558
|
+
const summaryContent = entry.message.content;
|
|
559
|
+
let summaryText = "";
|
|
560
|
+
if (typeof summaryContent === "string") {
|
|
561
|
+
summaryText = summaryContent;
|
|
562
|
+
} else if (Array.isArray(summaryContent)) {
|
|
563
|
+
summaryText = summaryContent.filter((b) => b.type === "text" && typeof b.text === "string").map((b) => b.text).join("\n");
|
|
564
|
+
}
|
|
565
|
+
if (summaryText) {
|
|
566
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
567
|
+
if (messages[i].subtype === "compact_boundary") {
|
|
568
|
+
messages[i].content = [{ type: "text", text: summaryText }];
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
556
575
|
if ((entry.type === "user" || entry.type === "assistant") && entry.message) {
|
|
557
576
|
const msgContent = entry.message.content;
|
|
558
577
|
messages.push({
|