chore: format

This commit is contained in:
Peter Steinberger
2026-01-09 16:55:51 +01:00
parent fd9e2d3def
commit be48233bc4
4 changed files with 29 additions and 16 deletions

View File

@@ -19,6 +19,12 @@ import {
waitForEmbeddedPiRunEnd, waitForEmbeddedPiRunEnd,
} from "../../agents/pi-embedded.js"; } from "../../agents/pi-embedded.js";
import type { ClawdbotConfig } from "../../config/config.js"; import type { ClawdbotConfig } from "../../config/config.js";
import {
getConfigOverrides,
resetConfigOverrides,
setConfigOverride,
unsetConfigOverride,
} from "../../config/runtime-overrides.js";
import { import {
resolveAgentIdFromSessionKey, resolveAgentIdFromSessionKey,
resolveSessionFilePath, resolveSessionFilePath,
@@ -40,12 +46,6 @@ import { enqueueSystemEvent } from "../../infra/system-events.js";
import { parseAgentSessionKey } from "../../routing/session-key.js"; import { parseAgentSessionKey } from "../../routing/session-key.js";
import { resolveSendPolicy } from "../../sessions/send-policy.js"; import { resolveSendPolicy } from "../../sessions/send-policy.js";
import { normalizeE164 } from "../../utils.js"; import { normalizeE164 } from "../../utils.js";
import {
getConfigOverrides,
resetConfigOverrides,
setConfigOverride,
unsetConfigOverride,
} from "../../config/runtime-overrides.js";
import { resolveCommandAuthorization } from "../command-auth.js"; import { resolveCommandAuthorization } from "../command-auth.js";
import { import {
normalizeCommandBody, normalizeCommandBody,
@@ -627,7 +627,10 @@ export async function handleCommands(params: {
return { shouldContinue: false }; return { shouldContinue: false };
} }
if (debugCommand.action === "error") { if (debugCommand.action === "error") {
return { shouldContinue: false, reply: { text: `⚠️ ${debugCommand.message}` } }; return {
shouldContinue: false,
reply: { text: `⚠️ ${debugCommand.message}` },
};
} }
if (debugCommand.action === "show") { if (debugCommand.action === "show") {
const overrides = getConfigOverrides(); const overrides = getConfigOverrides();
@@ -641,7 +644,9 @@ export async function handleCommands(params: {
const json = JSON.stringify(overrides, null, 2); const json = JSON.stringify(overrides, null, 2);
return { return {
shouldContinue: false, shouldContinue: false,
reply: { text: `⚙️ Debug overrides (memory-only):\n\`\`\`json\n${json}\n\`\`\`` }, reply: {
text: `⚙️ Debug overrides (memory-only):\n\`\`\`json\n${json}\n\`\`\``,
},
}; };
} }
if (debugCommand.action === "reset") { if (debugCommand.action === "reset") {
@@ -662,7 +667,9 @@ export async function handleCommands(params: {
if (!result.removed) { if (!result.removed) {
return { return {
shouldContinue: false, shouldContinue: false,
reply: { text: `⚙️ No debug override found for ${debugCommand.path}.` }, reply: {
text: `⚙️ No debug override found for ${debugCommand.path}.`,
},
}; };
} }
return { return {

View File

@@ -27,7 +27,7 @@ function parseDebugValue(raw: string): { value?: unknown; error?: string } {
} }
if ( if (
(trimmed.startsWith("\"") && trimmed.endsWith("\"")) || (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
(trimmed.startsWith("'") && trimmed.endsWith("'")) (trimmed.startsWith("'") && trimmed.endsWith("'"))
) { ) {
try { try {
@@ -58,7 +58,8 @@ export function parseDebugCommand(raw: string): DebugCommand | null {
case "reset": case "reset":
return { action: "reset" }; return { action: "reset" };
case "unset": { case "unset": {
if (!args) return { action: "error", message: "Usage: /debug unset path" }; if (!args)
return { action: "error", message: "Usage: /debug unset path" };
return { action: "unset", path: args }; return { action: "unset", path: args };
} }
case "set": { case "set": {

View File

@@ -1,6 +1,4 @@
import { describe, expect, it, beforeEach } from "vitest"; import { beforeEach, describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "./types.js";
import { import {
applyConfigOverrides, applyConfigOverrides,
getConfigOverrides, getConfigOverrides,
@@ -8,6 +6,7 @@ import {
setConfigOverride, setConfigOverride,
unsetConfigOverride, unsetConfigOverride,
} from "./runtime-overrides.js"; } from "./runtime-overrides.js";
import type { ClawdbotConfig } from "./types.js";
describe("runtime overrides", () => { describe("runtime overrides", () => {
beforeEach(() => { beforeEach(() => {

View File

@@ -81,13 +81,19 @@ export function resetConfigOverrides(): void {
overrides = {}; overrides = {};
} }
export function setConfigOverride(pathRaw: string, value: unknown): { export function setConfigOverride(
pathRaw: string,
value: unknown,
): {
ok: boolean; ok: boolean;
error?: string; error?: string;
} { } {
const path = parsePath(pathRaw); const path = parsePath(pathRaw);
if (!path) { if (!path) {
return { ok: false, error: "Invalid path. Use dot notation (e.g. foo.bar)." }; return {
ok: false,
error: "Invalid path. Use dot notation (e.g. foo.bar).",
};
} }
setOverrideAtPath(overrides, path, value); setOverrideAtPath(overrides, path, value);
return { ok: true }; return { ok: true };