chore(format): apply biome fixes
This commit is contained in:
@@ -15,8 +15,9 @@ import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
|||||||
import { resolvePreferredNodePath } from "../daemon/runtime-paths.js";
|
import { resolvePreferredNodePath } from "../daemon/runtime-paths.js";
|
||||||
import { resolveGatewayService } from "../daemon/service.js";
|
import { resolveGatewayService } from "../daemon/service.js";
|
||||||
import { buildServiceEnvironment } from "../daemon/service-env.js";
|
import { buildServiceEnvironment } from "../daemon/service-env.js";
|
||||||
import { buildGatewayConnectionDetails } from "../gateway/call.js";
|
import { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js";
|
||||||
import { formatPortDiagnostics, inspectPortUsage } from "../infra/ports.js";
|
import { formatPortDiagnostics, inspectPortUsage } from "../infra/ports.js";
|
||||||
|
import { collectProvidersStatusIssues } from "../infra/providers-status-issues.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { resolveUserPath, sleep } from "../utils.js";
|
import { resolveUserPath, sleep } from "../utils.js";
|
||||||
@@ -66,8 +67,6 @@ import {
|
|||||||
printWizardHeader,
|
printWizardHeader,
|
||||||
} from "./onboard-helpers.js";
|
} from "./onboard-helpers.js";
|
||||||
import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
|
import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
|
||||||
import { callGateway } from "../gateway/call.js";
|
|
||||||
import { collectProvidersStatusIssues } from "../infra/providers-status-issues.js";
|
|
||||||
|
|
||||||
function resolveMode(cfg: ClawdbotConfig): "local" | "remote" {
|
function resolveMode(cfg: ClawdbotConfig): "local" | "remote" {
|
||||||
return cfg.gateway?.mode === "remote" ? "remote" : "local";
|
return cfg.gateway?.mode === "remote" ? "remote" : "local";
|
||||||
|
|||||||
@@ -357,7 +357,9 @@ describe("providers command", () => {
|
|||||||
|
|
||||||
it("surfaces WhatsApp auth/runtime hints when unlinked or disconnected", () => {
|
it("surfaces WhatsApp auth/runtime hints when unlinked or disconnected", () => {
|
||||||
const unlinked = formatGatewayProvidersStatusLines({
|
const unlinked = formatGatewayProvidersStatusLines({
|
||||||
whatsappAccounts: [{ accountId: "default", enabled: true, linked: false }],
|
whatsappAccounts: [
|
||||||
|
{ accountId: "default", enabled: true, linked: false },
|
||||||
|
],
|
||||||
});
|
});
|
||||||
expect(unlinked.join("\n")).toMatch(/WhatsApp/i);
|
expect(unlinked.join("\n")).toMatch(/WhatsApp/i);
|
||||||
expect(unlinked.join("\n")).toMatch(/Not linked/i);
|
expect(unlinked.join("\n")).toMatch(/Not linked/i);
|
||||||
|
|||||||
@@ -39,4 +39,3 @@ describe("resolveDiscordPrivilegedIntentsFromFlags", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -150,8 +150,11 @@ export async function probeDiscord(
|
|||||||
};
|
};
|
||||||
if (includeApplication) {
|
if (includeApplication) {
|
||||||
result.application =
|
result.application =
|
||||||
(await fetchDiscordApplicationSummary(normalized, timeoutMs, fetcher)) ??
|
(await fetchDiscordApplicationSummary(
|
||||||
undefined;
|
normalized,
|
||||||
|
timeoutMs,
|
||||||
|
fetcher,
|
||||||
|
)) ?? undefined;
|
||||||
}
|
}
|
||||||
return { ...result, elapsedMs: Date.now() - started };
|
return { ...result, elapsedMs: Date.now() - started };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -98,9 +98,14 @@ export const providersHandlers: GatewayRequestHandlers = {
|
|||||||
lastProbeAt = Date.now();
|
lastProbeAt = Date.now();
|
||||||
}
|
}
|
||||||
const groups =
|
const groups =
|
||||||
cfg.telegram?.accounts?.[account.accountId]?.groups ?? cfg.telegram?.groups;
|
cfg.telegram?.accounts?.[account.accountId]?.groups ??
|
||||||
|
cfg.telegram?.groups;
|
||||||
const allowUnmentionedGroups =
|
const allowUnmentionedGroups =
|
||||||
Boolean(groups?.["*"] && (groups["*"] as { requireMention?: boolean }).requireMention === false) ||
|
Boolean(
|
||||||
|
groups?.["*"] &&
|
||||||
|
(groups["*"] as { requireMention?: boolean }).requireMention ===
|
||||||
|
false,
|
||||||
|
) ||
|
||||||
Object.entries(groups ?? {}).some(
|
Object.entries(groups ?? {}).some(
|
||||||
([key, value]) =>
|
([key, value]) =>
|
||||||
key !== "*" &&
|
key !== "*" &&
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import {
|
|||||||
resolveDiscordAccount,
|
resolveDiscordAccount,
|
||||||
} from "../discord/accounts.js";
|
} from "../discord/accounts.js";
|
||||||
import { monitorDiscordProvider } from "../discord/index.js";
|
import { monitorDiscordProvider } from "../discord/index.js";
|
||||||
import type { DiscordApplicationSummary, DiscordProbe } from "../discord/probe.js";
|
import type {
|
||||||
|
DiscordApplicationSummary,
|
||||||
|
DiscordProbe,
|
||||||
|
} from "../discord/probe.js";
|
||||||
import { probeDiscord } from "../discord/probe.js";
|
import { probeDiscord } from "../discord/probe.js";
|
||||||
import { shouldLogVerbose } from "../globals.js";
|
import { shouldLogVerbose } from "../globals.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ function readDiscordAccountStatus(value: unknown): DiscordAccountStatus | null {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function readDiscordApplicationSummary(value: unknown): DiscordApplicationSummary {
|
function readDiscordApplicationSummary(
|
||||||
|
value: unknown,
|
||||||
|
): DiscordApplicationSummary {
|
||||||
if (!isRecord(value)) return {};
|
if (!isRecord(value)) return {};
|
||||||
const intentsRaw = value.intents;
|
const intentsRaw = value.intents;
|
||||||
if (!isRecord(intentsRaw)) return {};
|
if (!isRecord(intentsRaw)) return {};
|
||||||
@@ -74,7 +76,9 @@ function readDiscordApplicationSummary(value: unknown): DiscordApplicationSummar
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function readTelegramAccountStatus(value: unknown): TelegramAccountStatus | null {
|
function readTelegramAccountStatus(
|
||||||
|
value: unknown,
|
||||||
|
): TelegramAccountStatus | null {
|
||||||
if (!isRecord(value)) return null;
|
if (!isRecord(value)) return null;
|
||||||
return {
|
return {
|
||||||
accountId: value.accountId,
|
accountId: value.accountId,
|
||||||
@@ -84,7 +88,9 @@ function readTelegramAccountStatus(value: unknown): TelegramAccountStatus | null
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function readWhatsAppAccountStatus(value: unknown): WhatsAppAccountStatus | null {
|
function readWhatsAppAccountStatus(
|
||||||
|
value: unknown,
|
||||||
|
): WhatsAppAccountStatus | null {
|
||||||
if (!isRecord(value)) return null;
|
if (!isRecord(value)) return null;
|
||||||
return {
|
return {
|
||||||
accountId: value.accountId,
|
accountId: value.accountId,
|
||||||
@@ -159,7 +165,9 @@ export function collectProvidersStatusIssues(
|
|||||||
const running = account.running === true;
|
const running = account.running === true;
|
||||||
const connected = account.connected === true;
|
const connected = account.connected === true;
|
||||||
const reconnectAttempts =
|
const reconnectAttempts =
|
||||||
typeof account.reconnectAttempts === "number" ? account.reconnectAttempts : null;
|
typeof account.reconnectAttempts === "number"
|
||||||
|
? account.reconnectAttempts
|
||||||
|
: null;
|
||||||
const lastError = asString(account.lastError);
|
const lastError = asString(account.lastError);
|
||||||
|
|
||||||
if (!linked) {
|
if (!linked) {
|
||||||
|
|||||||
@@ -1151,7 +1151,10 @@ describe("web auto-reply", () => {
|
|||||||
bindings: [
|
bindings: [
|
||||||
{
|
{
|
||||||
agentId: "work",
|
agentId: "work",
|
||||||
match: { provider: "whatsapp", peer: { kind: "group", id: "123@g.us" } },
|
match: {
|
||||||
|
provider: "whatsapp",
|
||||||
|
peer: { kind: "group", id: "123@g.us" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user