chore: Run pnpm format:fix.

This commit is contained in:
cpojer
2026-01-31 21:13:13 +09:00
parent dcc2de15a6
commit 8cab78abbc
624 changed files with 10729 additions and 7514 deletions

View File

@@ -91,8 +91,8 @@ function resolveZalouserGroupToolPolicy(
const groups = account.config.groups ?? {};
const groupId = params.groupId?.trim();
const groupChannel = params.groupChannel?.trim();
const candidates = [groupId, groupChannel, "*"].filter(
(value): value is string => Boolean(value),
const candidates = [groupId, groupChannel, "*"].filter((value): value is string =>
Boolean(value),
);
for (const key of candidates) {
const entry = groups[key];
@@ -111,9 +111,9 @@ export const zalouserDock: ChannelDock = {
outbound: { textChunkLimit: 2000 },
config: {
resolveAllowFrom: ({ cfg, accountId }) =>
(resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId }).config.allowFrom ?? []).map(
(entry) => String(entry),
),
(
resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId }).config.allowFrom ?? []
).map((entry) => String(entry)),
formatAllowFrom: ({ allowFrom }) =>
allowFrom
.map((entry) => String(entry).trim())
@@ -163,7 +163,15 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
cfg: cfg as OpenClawConfig,
sectionKey: "zalouser",
accountId,
clearBaseFields: ["profile", "name", "dmPolicy", "allowFrom", "groupPolicy", "groups", "messagePrefix"],
clearBaseFields: [
"profile",
"name",
"dmPolicy",
"allowFrom",
"groupPolicy",
"groups",
"messagePrefix",
],
}),
isConfigured: async (account) => {
// Check if zca auth status is OK for this profile
@@ -180,9 +188,9 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
configured: undefined,
}),
resolveAllowFrom: ({ cfg, accountId }) =>
(resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId }).config.allowFrom ?? []).map(
(entry) => String(entry),
),
(
resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId }).config.allowFrom ?? []
).map((entry) => String(entry)),
formatAllowFrom: ({ allowFrom }) =>
allowFrom
.map((entry) => String(entry).trim())
@@ -291,7 +299,10 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
const ok = await checkZcaInstalled();
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
const account = resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId });
const result = await runZca(["me", "info", "-j"], { profile: account.profile, timeout: 10000 });
const result = await runZca(["me", "info", "-j"], {
profile: account.profile,
timeout: 10000,
});
if (!result.ok) {
runtime.error(result.stderr || "Failed to fetch profile");
return null;
@@ -309,9 +320,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
const ok = await checkZcaInstalled();
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
const account = resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId });
const args = query?.trim()
? ["friend", "find", query.trim()]
: ["friend", "list", "-j"];
const args = query?.trim() ? ["friend", "find", query.trim()] : ["friend", "list", "-j"];
const result = await runZca(args, { profile: account.profile, timeout: 15000 });
if (!result.ok) {
throw new Error(result.stderr || "Failed to list peers");
@@ -333,7 +342,10 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
const ok = await checkZcaInstalled();
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
const account = resolveZalouserAccountSync({ cfg: cfg as OpenClawConfig, accountId });
const result = await runZca(["group", "list", "-j"], { profile: account.profile, timeout: 15000 });
const result = await runZca(["group", "list", "-j"], {
profile: account.profile,
timeout: 15000,
});
if (!result.ok) {
throw new Error(result.stderr || "Failed to list groups");
}
@@ -364,7 +376,9 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
if (!result.ok) {
throw new Error(result.stderr || "Failed to list group members");
}
const parsed = parseJsonOutput<Array<Partial<ZcaFriend> & { userId?: string | number }>>(result.stdout);
const parsed = parseJsonOutput<Array<Partial<ZcaFriend> & { userId?: string | number }>>(
result.stdout,
);
const rows = Array.isArray(parsed)
? parsed
.map((m) => {
@@ -433,7 +447,8 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
name: g.name ?? undefined,
}))
: [];
const best = matches.find((g) => g.name?.toLowerCase() === trimmed.toLowerCase()) ?? matches[0];
const best =
matches.find((g) => g.name?.toLowerCase() === trimmed.toLowerCase()) ?? matches[0];
results.push({
input,
resolved: Boolean(best?.id),
@@ -550,8 +565,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
probe: snapshot.probe,
lastProbeAt: snapshot.lastProbeAt ?? null,
}),
probeAccount: async ({ account, timeoutMs }) =>
probeZalouser(account.profile, timeoutMs),
probeAccount: async ({ account, timeoutMs }) => probeZalouser(account.profile, timeoutMs),
buildAccountSnapshot: async ({ account, runtime }) => {
const zcaInstalled = await checkZcaInstalled();
const configured = zcaInstalled ? await checkZcaAuthenticated(account.profile) : false;
@@ -564,7 +578,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
running: runtime?.running ?? false,
lastStartAt: runtime?.lastStartAt ?? null,
lastStopAt: runtime?.lastStopAt ?? null,
lastError: configured ? (runtime?.lastError ?? null) : runtime?.lastError ?? configError,
lastError: configured ? (runtime?.lastError ?? null) : (runtime?.lastError ?? configError),
lastInboundAt: runtime?.lastInboundAt ?? null,
lastOutboundAt: runtime?.lastOutboundAt ?? null,
dmPolicy: account.config.dmPolicy ?? "pairing",