fix: restore ci type checks

This commit is contained in:
Peter Steinberger 2026-03-16 02:23:21 +00:00
parent 6a2efa541b
commit 38abdea8ce
4 changed files with 83 additions and 2 deletions

View File

@ -36,6 +36,74 @@ const LINE_ALLOW_FROM_HELP_LINES = [
`Docs: ${formatDocsLink("/channels/line", "channels/line")}`,
];
function patchLineAccountConfig(params: {
cfg: OpenClawConfig;
accountId: string;
patch: Record<string, unknown>;
clearFields?: string[];
enabled?: boolean;
}): OpenClawConfig {
const accountId = normalizeAccountId(params.accountId);
const lineConfig = (params.cfg.channels?.line ?? {}) as LineConfig;
const clearFields = params.clearFields ?? [];
if (accountId === DEFAULT_ACCOUNT_ID) {
const nextLine = { ...lineConfig } as Record<string, unknown>;
for (const field of clearFields) {
delete nextLine[field];
}
return {
...params.cfg,
channels: {
...params.cfg.channels,
line: {
...nextLine,
...(params.enabled ? { enabled: true } : {}),
...params.patch,
},
},
};
}
const nextAccount = {
...(lineConfig.accounts?.[accountId] ?? {}),
} as Record<string, unknown>;
for (const field of clearFields) {
delete nextAccount[field];
}
return {
...params.cfg,
channels: {
...params.cfg.channels,
line: {
...lineConfig,
...(params.enabled ? { enabled: true } : {}),
accounts: {
...lineConfig.accounts,
[accountId]: {
...nextAccount,
...(params.enabled ? { enabled: true } : {}),
...params.patch,
},
},
},
},
};
}
function isLineConfigured(cfg: OpenClawConfig, accountId: string): boolean {
const resolved = resolveLineAccount({ cfg, accountId });
return Boolean(resolved.channelAccessToken.trim() && resolved.channelSecret.trim());
}
function parseLineAllowFromId(raw: string): string | null {
const trimmed = raw.trim().replace(/^line:(?:user:)?/i, "");
if (!/^U[a-f0-9]{32}$/i.test(trimmed)) {
return null;
}
return trimmed;
}
const lineDmPolicy: ChannelOnboardingDmPolicy = {
label: "LINE",
channel,

View File

@ -0,0 +1,13 @@
export const pluginSdkEntrypoints: string[];
export const pluginSdkSubpaths: string[];
export function buildPluginSdkEntrySources(): Record<string, string>;
export function buildPluginSdkSpecifiers(): string[];
export function buildPluginSdkPackageExports(): Record<
string,
{
types: string;
default: string;
}
>;
export function listPluginSdkDistArtifacts(): string[];

View File

@ -175,7 +175,7 @@ describe("plugin-sdk exports", () => {
const { default: importResults } = await import(pathToFileURL(consumerEntry).href);
expect(importResults).toEqual(
Object.fromEntries(pluginSdkSpecifiers.map((specifier) => [specifier, "object"])),
Object.fromEntries(pluginSdkSpecifiers.map((specifier: string) => [specifier, "object"])),
);
} finally {
await fs.rm(outDir, { recursive: true, force: true });

View File

@ -13,7 +13,7 @@ import { pluginSdkSubpaths } from "../../scripts/lib/plugin-sdk-entries.mjs";
const importPluginSdkSubpath = (specifier: string) => import(/* @vite-ignore */ specifier);
const bundledExtensionSubpathLoaders = pluginSdkSubpaths.map((id) => ({
const bundledExtensionSubpathLoaders = pluginSdkSubpaths.map((id: string) => ({
id,
load: () => importPluginSdkSubpath(`openclaw/plugin-sdk/${id}`),
}));