From cf192f8551bf22800150343327e57850bcf3f242 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 10 Jan 2026 19:47:17 +0000 Subject: [PATCH] style: biome format --- src/agents/bash-tools.ts | 8 +++++-- src/agents/pi-embedded-helpers.ts | 5 ++--- src/agents/sandbox-explain.test.ts | 1 - src/auto-reply/reply.ts | 14 +++++++++--- src/auto-reply/reply/directive-handling.ts | 5 +---- src/cli/sandbox-cli.ts | 5 ++++- src/commands/sandbox-explain.test.ts | 13 +++++------ src/commands/sandbox-explain.ts | 26 ++++++++++++++-------- 8 files changed, 46 insertions(+), 31 deletions(-) diff --git a/src/agents/bash-tools.ts b/src/agents/bash-tools.ts index f9d0c2508..0f37afe40 100644 --- a/src/agents/bash-tools.ts +++ b/src/agents/bash-tools.ts @@ -197,9 +197,13 @@ export function createBashTool( const runtime = defaults?.sandbox ? "sandboxed" : "direct"; const gates: string[] = []; if (!elevatedDefaults?.enabled) { - gates.push("enabled (tools.elevated.enabled / agents.list[].tools.elevated.enabled)"); + gates.push( + "enabled (tools.elevated.enabled / agents.list[].tools.elevated.enabled)", + ); } else { - gates.push("allowFrom (tools.elevated.allowFrom. / agents.list[].tools.elevated.allowFrom.)"); + gates.push( + "allowFrom (tools.elevated.allowFrom. / agents.list[].tools.elevated.allowFrom.)", + ); } throw new Error( [ diff --git a/src/agents/pi-embedded-helpers.ts b/src/agents/pi-embedded-helpers.ts index c7820541e..832a2d0cb 100644 --- a/src/agents/pi-embedded-helpers.ts +++ b/src/agents/pi-embedded-helpers.ts @@ -6,14 +6,13 @@ import type { AgentToolResult, } from "@mariozechner/pi-agent-core"; import type { AssistantMessage } from "@mariozechner/pi-ai"; -import type { ClawdbotConfig } from "../config/config.js"; import { normalizeThinkLevel, type ThinkLevel, } from "../auto-reply/thinking.js"; - -import { sanitizeContentBlocksImages } from "./tool-images.js"; +import type { ClawdbotConfig } from "../config/config.js"; import { formatSandboxToolPolicyBlockedMessage } from "./sandbox.js"; +import { sanitizeContentBlocksImages } from "./tool-images.js"; import type { WorkspaceBootstrapFile } from "./workspace.js"; export type EmbeddedContextFile = { path: string; content: string }; diff --git a/src/agents/sandbox-explain.test.ts b/src/agents/sandbox-explain.test.ts index 0f51800c6..f596e6e69 100644 --- a/src/agents/sandbox-explain.test.ts +++ b/src/agents/sandbox-explain.test.ts @@ -64,4 +64,3 @@ describe("sandbox explain helpers", () => { expect(msg).toContain("Use main session key (direct): agent:main:main"); }); }); - diff --git a/src/auto-reply/reply.ts b/src/auto-reply/reply.ts index 110289590..af845ef05 100644 --- a/src/auto-reply/reply.ts +++ b/src/auto-reply/reply.ts @@ -219,7 +219,11 @@ function resolveElevatedPermissions(params: { agentId: string; ctx: MsgContext; provider: string; -}): { enabled: boolean; allowed: boolean; failures: Array<{ gate: string; key: string }> } { +}): { + enabled: boolean; + allowed: boolean; + failures: Array<{ gate: string; key: string }>; +} { const globalConfig = params.cfg.tools?.elevated; const agentConfig = resolveAgentConfig(params.cfg, params.agentId)?.tools ?.elevated; @@ -227,9 +231,13 @@ function resolveElevatedPermissions(params: { const agentEnabled = agentConfig?.enabled !== false; const enabled = globalEnabled && agentEnabled; const failures: Array<{ gate: string; key: string }> = []; - if (!globalEnabled) failures.push({ gate: "enabled", key: "tools.elevated.enabled" }); + if (!globalEnabled) + failures.push({ gate: "enabled", key: "tools.elevated.enabled" }); if (!agentEnabled) - failures.push({ gate: "enabled", key: "agents.list[].tools.elevated.enabled" }); + failures.push({ + gate: "enabled", + key: "agents.list[].tools.elevated.enabled", + }); if (!enabled) return { enabled, allowed: false, failures }; if (!params.provider) { failures.push({ gate: "provider", key: "ctx.Provider" }); diff --git a/src/auto-reply/reply/directive-handling.ts b/src/auto-reply/reply/directive-handling.ts index 6a04e734e..801e3ae8f 100644 --- a/src/auto-reply/reply/directive-handling.ts +++ b/src/auto-reply/reply/directive-handling.ts @@ -31,10 +31,7 @@ import { } from "../../agents/model-selection.js"; import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js"; import type { ClawdbotConfig } from "../../config/config.js"; -import { - type SessionEntry, - saveSessionStore, -} from "../../config/sessions.js"; +import { type SessionEntry, saveSessionStore } from "../../config/sessions.js"; import { enqueueSystemEvent } from "../../infra/system-events.js"; import { applyVerboseOverride } from "../../sessions/level-overrides.js"; import { shortenHomePath } from "../../utils.js"; diff --git a/src/cli/sandbox-cli.ts b/src/cli/sandbox-cli.ts index c562b8a9d..e307d7db1 100644 --- a/src/cli/sandbox-cli.ts +++ b/src/cli/sandbox-cli.ts @@ -144,7 +144,10 @@ export function registerSandboxCli(program: Command) { sandbox .command("explain") .description("Explain effective sandbox/tool policy for a session/agent") - .option("--session ", "Session key to inspect (defaults to agent main)") + .option( + "--session ", + "Session key to inspect (defaults to agent main)", + ) .option("--agent ", "Agent id to inspect (defaults to derived agent)") .option("--json", "Output result as JSON", false) .addHelpText("after", EXAMPLES.explain) diff --git a/src/commands/sandbox-explain.test.ts b/src/commands/sandbox-explain.test.ts index 77b836cf8..3fec0f172 100644 --- a/src/commands/sandbox-explain.test.ts +++ b/src/commands/sandbox-explain.test.ts @@ -28,14 +28,11 @@ describe("sandbox explain command", () => { const { sandboxExplainCommand } = await import("./sandbox-explain.js"); const logs: string[] = []; - await sandboxExplainCommand( - { json: true, session: "agent:main:main" }, - { - log: (msg: string) => logs.push(msg), - error: (msg: string) => logs.push(msg), - exit: (_code: number) => {}, - } as unknown as Parameters[1], - ); + await sandboxExplainCommand({ json: true, session: "agent:main:main" }, { + log: (msg: string) => logs.push(msg), + error: (msg: string) => logs.push(msg), + exit: (_code: number) => {}, + } as unknown as Parameters[1]); const out = logs.join(""); const parsed = JSON.parse(out); diff --git a/src/commands/sandbox-explain.ts b/src/commands/sandbox-explain.ts index 5fde276ea..debfc71d0 100644 --- a/src/commands/sandbox-explain.ts +++ b/src/commands/sandbox-explain.ts @@ -1,3 +1,8 @@ +import { resolveAgentConfig } from "../agents/agent-scope.js"; +import { + resolveSandboxConfigForAgent, + resolveSandboxToolPolicyForAgent, +} from "../agents/sandbox.js"; import type { ClawdbotConfig } from "../config/config.js"; import { loadConfig } from "../config/config.js"; import { @@ -14,11 +19,6 @@ import { resolveAgentIdFromSessionKey, } from "../routing/session-key.js"; import type { RuntimeEnv } from "../runtime.js"; -import { resolveAgentConfig } from "../agents/agent-scope.js"; -import { - resolveSandboxConfigForAgent, - resolveSandboxToolPolicyForAgent, -} from "../agents/sandbox.js"; type SandboxExplainOptions = { session?: string; @@ -71,7 +71,9 @@ function inferProviderFromSessionKey(params: { const configuredMainKey = normalizeMainKey(params.cfg.session?.mainKey); if (parts[0] === configuredMainKey) return undefined; const candidate = parts[0]?.trim().toLowerCase(); - return candidate && KNOWN_PROVIDER_KEYS.has(candidate) ? candidate : undefined; + return candidate && KNOWN_PROVIDER_KEYS.has(candidate) + ? candidate + : undefined; } function resolveActiveProvider(params: { @@ -135,7 +137,9 @@ export async function sandboxExplainCommand( ): Promise { const cfg = loadConfig(); - const defaultAgentId = resolveAgentIdFromSessionKey(resolveMainSessionKey(cfg)); + const defaultAgentId = resolveAgentIdFromSessionKey( + resolveMainSessionKey(cfg), + ); const resolvedAgentId = normalizeAgentId( opts.agent?.trim() ? opts.agent @@ -277,7 +281,8 @@ export async function sandboxExplainCommand( alwaysAllowedByConfig: elevatedAlwaysAllowedByConfig, allowFrom: { global: provider ? globalAllowTokens : undefined, - agent: elevatedAgent?.allowFrom && provider ? agentAllowTokens : undefined, + agent: + elevatedAgent?.allowFrom && provider ? agentAllowTokens : undefined, }, failures: elevatedFailures, }, @@ -323,7 +328,10 @@ export async function sandboxExplainCommand( .join(", ")}`, ); } - if (payload.sandbox.mode === "non-main" && payload.sandbox.sessionIsSandboxed) { + if ( + payload.sandbox.mode === "non-main" && + payload.sandbox.sessionIsSandboxed + ) { lines.push(""); lines.push( `Hint: sandbox mode is non-main; use main session key to run direct: ${payload.mainSessionKey}`,