style: apply oxfmt fixes
This commit is contained in:
@@ -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.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -88,4 +88,3 @@ export function registerSecurityCli(program: Command) {
|
||||
defaultRuntime.log(lines.join("\n"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user