style: apply oxfmt fixes

This commit is contained in:
Peter Steinberger
2026-01-15 01:53:14 +00:00
parent ad8799522c
commit 1b79730db8
11 changed files with 20 additions and 23 deletions

View File

@@ -37,6 +37,8 @@ describe("formatAssistantErrorText", () => {
const msg = makeAssistantError(
'{"type":"error","error":{"message":"Something exploded","type":"server_error"}}',
);
expect(formatAssistantErrorText(msg)).toBe("The AI service returned an error. Please try again.");
expect(formatAssistantErrorText(msg)).toBe(
"The AI service returned an error. Please try again.",
);
});
});

View File

@@ -4,7 +4,7 @@ import { buildEmbeddedRunPayloads } from "./payloads.js";
describe("buildEmbeddedRunPayloads", () => {
const errorJson =
'{"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"},"request_id":"req_011CX7DwS7tSvggaNHmefwWg"}';
'{"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"},"request_id":"req_011CX7DwS7tSvggaNHmefwWg"}';
const errorJsonPretty = `{
"type": "error",
"error": {

View File

@@ -60,7 +60,9 @@ export function buildEmbeddedRunPayloads(params: {
const rawErrorFingerprint = rawErrorMessage
? getApiErrorPayloadFingerprint(rawErrorMessage)
: null;
const normalizedRawErrorText = rawErrorMessage ? normalizeTextForComparison(rawErrorMessage) : null;
const normalizedRawErrorText = rawErrorMessage
? normalizeTextForComparison(rawErrorMessage)
: null;
if (errorText) replyItems.push({ text: errorText, isError: true });
const inlineToolResults =

View File

@@ -49,7 +49,7 @@ describe("handleCommands /config configWrites gating", () => {
commands: { config: true, text: true },
channels: { whatsapp: { allowFrom: ["*"], configWrites: false } },
} as ClawdbotConfig;
const params = buildParams("/config set messages.ackReaction=\":)\"", cfg);
const params = buildParams('/config set messages.ackReaction=":)"', cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
expect(result.reply?.text).toContain("Config writes are disabled");

View File

@@ -24,9 +24,7 @@ describe("resolveChannelConfigWrites", () => {
},
},
};
expect(
resolveChannelConfigWrites({ cfg, channelId: "slack", accountId: "work" }),
).toBe(false);
expect(resolveChannelConfigWrites({ cfg, channelId: "slack", accountId: "work" })).toBe(false);
});
it("matches account ids case-insensitively", () => {
@@ -40,8 +38,6 @@ describe("resolveChannelConfigWrites", () => {
},
},
};
expect(
resolveChannelConfigWrites({ cfg, channelId: "slack", accountId: "work" }),
).toBe(false);
expect(resolveChannelConfigWrites({ cfg, channelId: "slack", accountId: "work" })).toBe(false);
});
});

View File

@@ -7,10 +7,7 @@ type ChannelConfigWithAccounts = {
accounts?: Record<string, { configWrites?: boolean }>;
};
function resolveAccountConfig(
accounts: ChannelConfigWithAccounts["accounts"],
accountId: string,
) {
function resolveAccountConfig(accounts: ChannelConfigWithAccounts["accounts"], accountId: string) {
if (!accounts || typeof accounts !== "object") return undefined;
if (accountId in accounts) return accounts[accountId];
const matchKey = Object.keys(accounts).find(

View File

@@ -88,4 +88,3 @@ export function registerSecurityCli(program: Command) {
defaultRuntime.log(lines.join("\n"));
});
}

View File

@@ -340,8 +340,8 @@ export async function statusAllCommand(
},
{ Item: "Security", Value: "Run: clawdbot security audit --deep" },
gatewaySelfLine
? { Item: "Gateway self", Value: gatewaySelfLine }
: { Item: "Gateway self", Value: "unknown" },
? { Item: "Gateway self", Value: gatewaySelfLine }
: { Item: "Gateway self", Value: "unknown" },
daemon
? {
Item: "Daemon",

View File

@@ -77,7 +77,11 @@ function normalizeAllowFromList(list: Array<string | number> | undefined | null)
function classifyChannelWarningSeverity(message: string): SecurityAuditSeverity {
const s = message.toLowerCase();
if (s.includes('dms: open') || s.includes('grouppolicy="open"') || s.includes('dmpolicy="open"')) {
if (
s.includes("dms: open") ||
s.includes('grouppolicy="open"') ||
s.includes('dmpolicy="open"')
) {
return "critical";
}
if (s.includes("allows any") || s.includes("anyone can dm") || s.includes("public")) {

View File

@@ -95,9 +95,7 @@ export const registerTelegramHandlers = ({
runtime.log?.(warn(`[telegram] Group migrated: "${chatTitle}" ${oldChatId}${newChatId}`));
if (!resolveChannelConfigWrites({ cfg, channelId: "telegram", accountId })) {
runtime.log?.(
warn("[telegram] Config writes disabled; skipping group config migration."),
);
runtime.log?.(warn("[telegram] Config writes disabled; skipping group config migration."));
return;
}

View File

@@ -60,8 +60,7 @@ async function requireRiskAcknowledgement(params: {
);
const ok = await params.prompter.confirm({
message:
"I understand this is powerful and inherently risky. Continue?",
message: "I understand this is powerful and inherently risky. Continue?",
initialValue: false,
});
if (!ok) {