openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
92 lines (91 loc) • 3.31 kB
JavaScript
import { o as ToolPolicySchema } from "./zod-schema.agent-runtime-Dtg4Jy6G.js";
import { a as DmPolicySchema, c as GroupPolicySchema, m as MarkdownConfigSchema } from "./zod-schema.core-BuVz8Rk7.js";
import { Db as formatAllowFromLowercase, Jb as adaptScopedAccountAccessor, Qb as createScopedChannelConfigAdapter } from "./pi-embedded-CbCYZxIb.js";
import { n as describeAccountSnapshot } from "./account-helpers-BzkeDMfB.js";
import { n as buildCatchallMultiAccountChannelSchema, r as buildChannelConfigSchema, t as AllowFromListSchema } from "./config-schema-CPzP2Ds6.js";
import { t as checkZaloAuthenticated } from "./zalo-js-HULxcu6w.js";
import { a as listZalouserAccountIds, o as resolveDefaultZalouserAccountId, s as resolveZalouserAccountSync } from "./setup-surface-CiV2AJTU.js";
import { z } from "zod";
//#region extensions/zalouser/src/config-schema.ts
const groupConfigSchema = z.object({
allow: z.boolean().optional(),
enabled: z.boolean().optional(),
requireMention: z.boolean().optional(),
tools: ToolPolicySchema
});
const ZalouserConfigSchema = buildCatchallMultiAccountChannelSchema(z.object({
name: z.string().optional(),
enabled: z.boolean().optional(),
markdown: MarkdownConfigSchema,
profile: z.string().optional(),
dangerouslyAllowNameMatching: z.boolean().optional(),
dmPolicy: DmPolicySchema.optional(),
allowFrom: AllowFromListSchema,
historyLimit: z.number().int().min(0).optional(),
groupAllowFrom: AllowFromListSchema,
groupPolicy: GroupPolicySchema.optional().default("allowlist"),
groups: z.object({}).catchall(groupConfigSchema).optional(),
messagePrefix: z.string().optional(),
responsePrefix: z.string().optional()
}));
//#endregion
//#region extensions/zalouser/src/shared.ts
const zalouserMeta = {
id: "zalouser",
label: "Zalo Personal",
selectionLabel: "Zalo (Personal Account)",
docsPath: "/channels/zalouser",
docsLabel: "zalouser",
blurb: "Zalo personal account via QR code login.",
aliases: ["zlu"],
order: 85,
quickstartAllowFrom: false
};
const zalouserConfigAdapter = createScopedChannelConfigAdapter({
sectionKey: "zalouser",
listAccountIds: listZalouserAccountIds,
resolveAccount: adaptScopedAccountAccessor(resolveZalouserAccountSync),
defaultAccountId: resolveDefaultZalouserAccountId,
clearBaseFields: [
"profile",
"name",
"dmPolicy",
"allowFrom",
"historyLimit",
"groupAllowFrom",
"groupPolicy",
"groups",
"messagePrefix"
],
resolveAllowFrom: (account) => account.config.allowFrom,
formatAllowFrom: (allowFrom) => formatAllowFromLowercase({
allowFrom,
stripPrefixRe: /^(zalouser|zlu):/i
})
});
function createZalouserPluginBase(params) {
return {
id: "zalouser",
meta: zalouserMeta,
setupWizard: params.setupWizard,
capabilities: {
chatTypes: ["direct", "group"],
media: true,
reactions: true,
threads: false,
polls: false,
nativeCommands: false,
blockStreaming: true
},
reload: { configPrefixes: ["channels.zalouser"] },
configSchema: buildChannelConfigSchema(ZalouserConfigSchema),
config: {
...zalouserConfigAdapter,
isConfigured: async (account) => await checkZaloAuthenticated(account.profile),
describeAccount: (account) => describeAccountSnapshot({ account })
},
setup: params.setup
};
}
//#endregion
export { createZalouserPluginBase as t };