From 8e35ad54846f6e1e9f49c21177a995c25fe81f7a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 9 Jan 2026 05:27:54 +0000 Subject: [PATCH] style: format after gate --- src/agents/claude-cli-runner.ts | 7 +++++-- src/agents/model-selection.test.ts | 18 +++++++++++------- .../reply/agent-runner.claude-cli.test.ts | 7 ++----- src/auto-reply/reply/agent-runner.ts | 11 +++++++---- src/auto-reply/status.ts | 4 +++- src/cli/daemon-cli.ts | 15 ++++++++++----- src/cli/gateway-cli.ts | 5 ++++- src/logging.ts | 3 +-- 8 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/agents/claude-cli-runner.ts b/src/agents/claude-cli-runner.ts index 7f89f0ffc..ed79afeec 100644 --- a/src/agents/claude-cli-runner.ts +++ b/src/agents/claude-cli-runner.ts @@ -5,10 +5,10 @@ import type { AgentTool } from "@mariozechner/pi-agent-core"; import { resolveHeartbeatPrompt } from "../auto-reply/heartbeat.js"; import type { ThinkLevel } from "../auto-reply/thinking.js"; import type { ClawdbotConfig } from "../config/config.js"; +import { shouldLogVerbose } from "../globals.js"; import { createSubsystemLogger } from "../logging.js"; import { runCommandWithTimeout } from "../process/exec.js"; import { resolveUserPath } from "../utils.js"; -import { shouldLogVerbose } from "../globals.js"; import { buildBootstrapContextFiles, type EmbeddedContextFile, @@ -21,7 +21,10 @@ const log = createSubsystemLogger("agent/claude-cli"); const CLAUDE_CLI_QUEUE_KEY = "global"; const CLAUDE_CLI_RUN_QUEUE = new Map>(); -function enqueueClaudeCliRun(key: string, task: () => Promise): Promise { +function enqueueClaudeCliRun( + key: string, + task: () => Promise, +): Promise { const prior = CLAUDE_CLI_RUN_QUEUE.get(key) ?? Promise.resolve(); const chained = prior.catch(() => undefined).then(task); const tracked = chained.finally(() => { diff --git a/src/agents/model-selection.test.ts b/src/agents/model-selection.test.ts index 4335c1ae9..8281941e7 100644 --- a/src/agents/model-selection.test.ts +++ b/src/agents/model-selection.test.ts @@ -1,7 +1,11 @@ import { describe, expect, it } from "vitest"; import type { ClawdbotConfig } from "../config/config.js"; -import { buildAllowedModelSet, modelKey, parseModelRef } from "./model-selection.js"; +import { + buildAllowedModelSet, + modelKey, + parseModelRef, +} from "./model-selection.js"; const catalog = [ { @@ -30,9 +34,9 @@ describe("buildAllowedModelSet", () => { expect(allowed.allowAny).toBe(false); expect(allowed.allowedKeys.has(modelKey("openai", "gpt-4"))).toBe(true); - expect( - allowed.allowedKeys.has(modelKey("claude-cli", "opus-4.5")), - ).toBe(true); + expect(allowed.allowedKeys.has(modelKey("claude-cli", "opus-4.5"))).toBe( + true, + ); }); it("includes the default model when no allowlist is set", () => { @@ -49,9 +53,9 @@ describe("buildAllowedModelSet", () => { expect(allowed.allowAny).toBe(true); expect(allowed.allowedKeys.has(modelKey("openai", "gpt-4"))).toBe(true); - expect( - allowed.allowedKeys.has(modelKey("claude-cli", "opus-4.5")), - ).toBe(true); + expect(allowed.allowedKeys.has(modelKey("claude-cli", "opus-4.5"))).toBe( + true, + ); }); }); diff --git a/src/auto-reply/reply/agent-runner.claude-cli.test.ts b/src/auto-reply/reply/agent-runner.claude-cli.test.ts index f4e109148..f47bea7dd 100644 --- a/src/auto-reply/reply/agent-runner.claude-cli.test.ts +++ b/src/auto-reply/reply/agent-runner.claude-cli.test.ts @@ -1,8 +1,7 @@ import crypto from "node:crypto"; import { describe, expect, it, vi } from "vitest"; - -import type { TemplateContext } from "../templating.js"; import { onAgentEvent } from "../../infra/agent-events.js"; +import type { TemplateContext } from "../templating.js"; import type { FollowupRun, QueueSettings } from "./queue.js"; import { createMockTypingController } from "./test-helpers.js"; @@ -105,9 +104,7 @@ function createRun() { describe("runReplyAgent claude-cli routing", () => { it("uses claude-cli runner for claude-cli provider", async () => { - const randomSpy = vi - .spyOn(crypto, "randomUUID") - .mockReturnValue("run-1"); + const randomSpy = vi.spyOn(crypto, "randomUUID").mockReturnValue("run-1"); const lifecyclePhases: string[] = []; const unsubscribe = onAgentEvent((evt) => { if (evt.runId !== "run-1") return; diff --git a/src/auto-reply/reply/agent-runner.ts b/src/auto-reply/reply/agent-runner.ts index eca41f080..48bfc7cbc 100644 --- a/src/auto-reply/reply/agent-runner.ts +++ b/src/auto-reply/reply/agent-runner.ts @@ -18,7 +18,10 @@ import { } from "../../config/sessions.js"; import type { TypingMode } from "../../config/types.js"; import { logVerbose } from "../../globals.js"; -import { emitAgentEvent, registerAgentRunContext } from "../../infra/agent-events.js"; +import { + emitAgentEvent, + registerAgentRunContext, +} from "../../infra/agent-events.js"; import { defaultRuntime } from "../../runtime.js"; import { estimateUsageCost, @@ -352,9 +355,9 @@ export async function runReplyAgent(params: { runId, extraSystemPrompt: followupRun.run.extraSystemPrompt, ownerNumbers: followupRun.run.ownerNumbers, - claudeSessionId: - sessionEntry?.claudeCliSessionId?.trim() || undefined, - }) + claudeSessionId: + sessionEntry?.claudeCliSessionId?.trim() || undefined, + }) .then((result) => { emitAgentEvent({ runId, diff --git a/src/auto-reply/status.ts b/src/auto-reply/status.ts index 668304b20..f3408e4d5 100644 --- a/src/auto-reply/status.ts +++ b/src/auto-reply/status.ts @@ -329,7 +329,9 @@ export function buildStatusMessage(args: StatusArgs): string { const usagePair = formatUsagePair(inputTokens, outputTokens); const costLine = costLabel ? `💵 Cost: ${costLabel}` : null; const usageCostLine = - usagePair && costLine ? `${usagePair} · ${costLine}` : usagePair ?? costLine; + usagePair && costLine + ? `${usagePair} · ${costLine}` + : (usagePair ?? costLine); return [ versionLine, diff --git a/src/cli/daemon-cli.ts b/src/cli/daemon-cli.ts index fbc3594a1..fa9438384 100644 --- a/src/cli/daemon-cli.ts +++ b/src/cli/daemon-cli.ts @@ -672,7 +672,9 @@ function printDaemonStatus(status: DaemonStatus, opts: { json: boolean }) { service.runtime?.status === "running" ) { defaultRuntime.log( - warnText("Warm-up: launch agents can take a few seconds. Try again shortly."), + warnText( + "Warm-up: launch agents can take a few seconds. Try again shortly.", + ), ); } if (rpc) { @@ -680,8 +682,7 @@ function printDaemonStatus(status: DaemonStatus, opts: { json: boolean }) { defaultRuntime.log(`${label("RPC probe:")} ${okText("ok")}`); } else { defaultRuntime.error(`${label("RPC probe:")} ${errorText("failed")}`); - if (rpc.url) - defaultRuntime.error(`${label("RPC target:")} ${rpc.url}`); + if (rpc.url) defaultRuntime.error(`${label("RPC target:")} ${rpc.url}`); const lines = String(rpc.error ?? "unknown") .split(/\r?\n/) .filter(Boolean); @@ -698,7 +699,9 @@ function printDaemonStatus(status: DaemonStatus, opts: { json: boolean }) { } } else if (service.loaded && service.runtime?.status === "stopped") { defaultRuntime.error( - errorText("Service is loaded but not running (likely exited immediately)."), + errorText( + "Service is loaded but not running (likely exited immediately).", + ), ); for (const hint of renderRuntimeHints( service.runtime, @@ -736,7 +739,9 @@ function printDaemonStatus(status: DaemonStatus, opts: { json: boolean }) { ), ); if (addrs.length > 0) { - defaultRuntime.log(`${label("Listening:")} ${infoText(addrs.join(", "))}`); + defaultRuntime.log( + `${label("Listening:")} ${infoText(addrs.join(", "))}`, + ); } } if (status.portCli && status.portCli.port !== status.port?.port) { diff --git a/src/cli/gateway-cli.ts b/src/cli/gateway-cli.ts index 449b9235e..4c3e49757 100644 --- a/src/cli/gateway-cli.ts +++ b/src/cli/gateway-cli.ts @@ -24,7 +24,10 @@ import { import { setVerbose } from "../globals.js"; import { GatewayLockError } from "../infra/gateway-lock.js"; import { formatPortDiagnostics, inspectPortUsage } from "../infra/ports.js"; -import { createSubsystemLogger, setConsoleSubsystemFilter } from "../logging.js"; +import { + createSubsystemLogger, + setConsoleSubsystemFilter, +} from "../logging.js"; import { defaultRuntime } from "../runtime.js"; import { forceFreePortAndWait } from "./ports.js"; import { withProgress } from "./progress.js"; diff --git a/src/logging.ts b/src/logging.ts index 5836c5e4c..e3ded381c 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -275,8 +275,7 @@ export function shouldLogSubsystemToConsole(subsystem: string): boolean { return true; } return consoleSubsystemFilter.some( - (prefix) => - subsystem === prefix || subsystem.startsWith(`${prefix}/`), + (prefix) => subsystem === prefix || subsystem.startsWith(`${prefix}/`), ); }