chore: bump pi deps for tau rpc

This commit is contained in:
Peter Steinberger
2025-12-09 21:52:49 +00:00
parent 42c3c2b804
commit 50c33dfcdf
2 changed files with 27 additions and 4 deletions

View File

@@ -34,8 +34,8 @@
"packageManager": "pnpm@10.23.0",
"dependencies": {
"@grammyjs/transformer-throttler": "^1.2.1",
"@mariozechner/pi-ai": "^0.16.0",
"@mariozechner/pi-coding-agent": "^0.16.0",
"@mariozechner/pi-ai": "^0.17.0",
"@mariozechner/pi-coding-agent": "^0.17.0",
"@sinclair/typebox": "^0.34.41",
"@whiskeysockets/baileys": "7.0.0-rc.9",
"ajv": "^8.17.1",

View File

@@ -78,7 +78,29 @@ class TauRpcClient {
// Parse the line once to track agent lifecycle signals.
try {
const evt = JSON.parse(line) as { type?: string; message?: unknown };
const evt = JSON.parse(line) as {
type?: string;
command?: string;
success?: boolean;
error?: string;
message?: unknown;
};
if (evt.type === "response" && evt.command === "prompt") {
if (evt.success === false) {
const pending = this.pending;
this.pending = undefined;
this.buffer = [];
if (pending) {
clearTimeout(pending.timer);
pending.reject(
new Error(evt.error ?? "tau rpc prompt failed (response=false)"),
);
}
this.child?.kill("SIGKILL");
return;
}
}
if (evt?.type === "agent_end") {
// Tau signals the end of the prompt/response cycle; resolve with all buffered output.
@@ -124,7 +146,8 @@ class TauRpcClient {
const ok = child.stdin.write(
`${JSON.stringify({
type: "prompt",
message: { role: "user", content: [{ type: "text", text: prompt }] },
// RPC v0.17+ accepts raw string prompts and normalizes internally.
message: prompt,
})}\n`,
(err) => (err ? reject(err) : resolve()),
);