taskplane 0.22.16 → 0.22.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/bin/rpc-wrapper.mjs +30 -1
- package/package.json +1 -1
package/bin/rpc-wrapper.mjs
CHANGED
|
@@ -770,10 +770,36 @@ piArgs.push(...args.passthrough);
|
|
|
770
770
|
|
|
771
771
|
// ── Spawn pi process ─────────────────────────────────────────────────
|
|
772
772
|
|
|
773
|
+
// ── System prompt: file-based passthrough to avoid command line limits ────
|
|
774
|
+
// Windows CreateProcess has a ~32K command line limit. Orchestrated worker
|
|
775
|
+
// system prompts routinely exceed this (PROMPT.md + context docs + steps).
|
|
776
|
+
// When the system prompt is large, write it to a temp file and use shell
|
|
777
|
+
// expansion `$(cat file)` to pass it. This works in MSYS2/Git Bash tmux
|
|
778
|
+
// (where the lane sessions run) without hitting the Win32 limit.
|
|
779
|
+
//
|
|
780
|
+
// For small system prompts (< 8K), pass inline for simplicity.
|
|
781
|
+
const SYSTEM_PROMPT_FILE_THRESHOLD = 8192;
|
|
782
|
+
let systemPromptTempFile = null;
|
|
783
|
+
|
|
784
|
+
if (systemPromptContent && systemPromptContent.length >= SYSTEM_PROMPT_FILE_THRESHOLD) {
|
|
785
|
+
// Remove --system-prompt from piArgs (was added above) and use file instead
|
|
786
|
+
const sysIdx = piArgs.indexOf("--system-prompt");
|
|
787
|
+
if (sysIdx >= 0) piArgs.splice(sysIdx, 2);
|
|
788
|
+
// Write to temp file and use --append-system-prompt with @file syntax.
|
|
789
|
+
// Pi's --append-system-prompt accepts @filepath to read from a file.
|
|
790
|
+
// We use --system-prompt "" (empty base) + --append-system-prompt @file
|
|
791
|
+
// to effectively set the system prompt from a file.
|
|
792
|
+
systemPromptTempFile = join(tmpdir(), `pi-rpc-sysprompt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.txt`);
|
|
793
|
+
writeFileSync(systemPromptTempFile, systemPromptContent, "utf-8");
|
|
794
|
+
piArgs.push("--system-prompt", "");
|
|
795
|
+
piArgs.push("--append-system-prompt", `@${systemPromptTempFile}`);
|
|
796
|
+
process.stderr.write(`[rpc-wrapper] system prompt written to file (${systemPromptContent.length} chars): ${systemPromptTempFile}\n`);
|
|
797
|
+
}
|
|
798
|
+
|
|
773
799
|
const proc = spawn("pi", piArgs, {
|
|
774
800
|
stdio: ["pipe", "pipe", "pipe"],
|
|
775
801
|
env: { ...process.env },
|
|
776
|
-
shell: true,
|
|
802
|
+
shell: true,
|
|
777
803
|
});
|
|
778
804
|
|
|
779
805
|
// ── TP-097: Write PID file for orphan cleanup ──────────────────
|
|
@@ -796,6 +822,9 @@ try {
|
|
|
796
822
|
// Clean up PID file on process exit (best-effort)
|
|
797
823
|
function cleanupPidFile() {
|
|
798
824
|
try { unlinkSync(pidFilePath); } catch { /* ignore */ }
|
|
825
|
+
if (systemPromptTempFile) {
|
|
826
|
+
try { unlinkSync(systemPromptTempFile); } catch { /* ignore */ }
|
|
827
|
+
}
|
|
799
828
|
}
|
|
800
829
|
process.on("exit", cleanupPidFile);
|
|
801
830
|
|