mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
83bf0379c9
* refactor(channels): share plugin contract scaffolds * fix: preserve channel config hint metadata * chore: refresh Plugin SDK API baseline * ci: refresh plugin SDK surface budget * fix(ci): allow read-only state database boundary * fix(ci): dedupe read-only state database boundary
21 lines
930 B
TypeScript
21 lines
930 B
TypeScript
// Feishu plugin module implements approval auth behavior.
|
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
import { resolveFeishuAccount } from "./accounts.js";
|
|
import { normalizeFeishuTarget } from "./targets.js";
|
|
|
|
function normalizeFeishuApproverId(value: string | number): string | undefined {
|
|
const normalized = normalizeFeishuTarget(String(value));
|
|
const trimmed = normalizeOptionalLowercaseString(normalized);
|
|
return trimmed?.startsWith("ou_") ? trimmed : undefined;
|
|
}
|
|
|
|
export const feishuApprovalAuth = createChannelApprovalAuth({
|
|
channelLabel: "Feishu",
|
|
resolveInputs: ({ cfg, accountId }) => {
|
|
const account = resolveFeishuAccount({ cfg, accountId }).config;
|
|
return { allowFrom: account.allowFrom };
|
|
},
|
|
normalizeApprover: normalizeFeishuApproverId,
|
|
}).approvalAuth;
|