From d8b1a38350693f053da427655ab696ccbeeb4de5 Mon Sep 17 00:00:00 2001 From: Joao Lisboa Date: Tue, 2 Dec 2025 17:11:45 -0300 Subject: [PATCH] style: fix biome lint errors --- src/auto-reply/command-reply.ts | 8 +++++--- src/process/tau-rpc.ts | 23 ++++++++++++++++------- src/web/outbound.ts | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/auto-reply/command-reply.ts b/src/auto-reply/command-reply.ts index f79ff45e2..7ec983db0 100644 --- a/src/auto-reply/command-reply.ts +++ b/src/auto-reply/command-reply.ts @@ -189,7 +189,7 @@ export async function runCommandReply( systemSent, identityPrefix: agentCfg.identityPrefix, format: agentCfg.format, - }) + }) : argv; logVerbose( @@ -208,7 +208,7 @@ export async function runCommandReply( const rpcArgv = (() => { const copy = [...finalArgv]; copy.splice(bodyIndex, 1); - const modeIdx = copy.findIndex((a) => a === "--mode"); + const modeIdx = copy.indexOf("--mode"); if (modeIdx >= 0 && copy[modeIdx + 1]) { copy.splice(modeIdx, 2, "--mode", "rpc"); } else if (!copy.includes("--mode")) { @@ -231,7 +231,9 @@ export async function runCommandReply( queuedMs = waitMs; queuedAhead = ahead; if (isVerbose()) { - logVerbose(`Command auto-reply queued for ${waitMs}ms (${queuedAhead} ahead)`); + logVerbose( + `Command auto-reply queued for ${waitMs}ms (${queuedAhead} ahead)`, + ); } }, }); diff --git a/src/process/tau-rpc.ts b/src/process/tau-rpc.ts index 9d28e7ed5..cf3450d6f 100644 --- a/src/process/tau-rpc.ts +++ b/src/process/tau-rpc.ts @@ -1,4 +1,4 @@ -import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process"; +import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process"; import readline from "node:readline"; type TauRpcOptions = { @@ -22,7 +22,10 @@ class TauRpcClient { } | undefined; - constructor(private readonly argv: string[], private readonly cwd: string | undefined) {} + constructor( + private readonly argv: string[], + private readonly cwd: string | undefined, + ) {} private ensureChild() { if (this.child) return; @@ -37,7 +40,9 @@ class TauRpcClient { }); this.child.on("exit", (code, signal) => { if (this.pending) { - this.pending.reject(new Error(`tau rpc exited (code=${code}, signal=${signal})`)); + this.pending.reject( + new Error(`tau rpc exited (code=${code}, signal=${signal})`), + ); clearTimeout(this.pending.timer); this.pending = undefined; } @@ -49,7 +54,10 @@ class TauRpcClient { if (!this.pending) return; this.buffer.push(line); // Finish on assistant message_end event to mirror parse logic in piSpec - if (line.includes('"type":"message_end"') && line.includes('"role":"assistant"')) { + if ( + line.includes('"type":"message_end"') && + line.includes('"role":"assistant"') + ) { const out = this.buffer.join("\n"); clearTimeout(this.pending.timer); const pending = this.pending; @@ -64,13 +72,14 @@ class TauRpcClient { if (this.pending) { throw new Error("tau rpc already handling a request"); } - const child = this.child!; + const child = this.child; + if (!child) throw new Error("tau rpc child not initialized"); await new Promise((resolve, reject) => { const ok = child.stdin.write( - JSON.stringify({ + `${JSON.stringify({ type: "prompt", message: { role: "user", content: [{ type: "text", text: prompt }] }, - }) + "\n", + })}\n`, (err) => (err ? reject(err) : resolve()), ); if (!ok) child.stdin.once("drain", () => resolve()); diff --git a/src/web/outbound.ts b/src/web/outbound.ts index f1d0af851..6e1b3cf0c 100644 --- a/src/web/outbound.ts +++ b/src/web/outbound.ts @@ -41,7 +41,7 @@ export async function sendMessageWeb( const mimetype = media.contentType === "audio/ogg" ? "audio/ogg; codecs=opus" - : media.contentType ?? "application/octet-stream"; + : (media.contentType ?? "application/octet-stream"); payload = { audio: media.buffer, ptt: true, mimetype }; } else if (media.kind === "video") { const mimetype = media.contentType ?? "application/octet-stream";