openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
7 lines • 6.44 kB
JavaScript
import{Et as _enum,Fn as object,Jn as string,Lt as boolean,Nt as array,Pn as number,Un as record,or as union,qn as strictObject,sr as unknown}from"../schemas-DuCQi-Qb.mjs";import{i as loadBundledPluginPublicSurfaceModuleSyncCore,n as createLazyFacadeObjectValue}from"../facade-loader-BQF_V8Ba.mjs";import{A as requireOpenAllowFrom,M as DmConfigSchema,a as ContextVisibilityModeSchema,c as GroupPolicySchema,h as ReplyRuntimeConfigSchemaShape,k as requireAllowlistAllowFrom,n as BlockStreamingCoalesceSchema,o as DmPolicySchema,p as MarkdownConfigSchema,r as ChannelDeliveryStreamingConfigSchema}from"../zod-schema.core-D4C8kcop.mjs";import{i as SecretRefSchema,n as sensitive}from"../zod-schema.sensitive-DjFrxrFP.mjs";import{a as ToolPolicySchema}from"../zod-schema.agent-runtime-B9SLJsAn.mjs";import{c as buildChannelAccountSchemaParts,d as buildChannelReactionShape,l as buildChannelAllowBotsSchema,p as ChannelBotLoopProtectionSchema,r as ChannelSendReadReceiptsSchema,t as ChannelDangerouslyAllowNameMatchingSchema}from"../zod-schema.channel-messaging-common-6OnG_FW4.mjs";import{t as resolveAccountEntry}from"../account-lookup-DXbrh7Os.mjs";import{a as buildGroupEntrySchema,c as buildNestedDmConfigSchema,i as buildChannelConfigSchema,n as ChannelGroupEntrySchema,r as buildCatchallMultiAccountChannelSchema,s as buildMultiAccountChannelSchema,t as AllowFromListSchema,u as refineChannelDmPolicy}from"../config-schema-BELT5_VZ.mjs";import"../channel-config-schema-BMHY_2Pe.mjs";
//!src/config/zod-schema.providers-googlechat.ts
const GoogleChatGroupSchema=strictObject({enabled:boolean().optional(),requireMention:boolean().optional(),botLoopProtection:ChannelBotLoopProtectionSchema.optional(),users:array(union([string(),number()])).optional(),systemPrompt:string().optional()});const{accountShape:accountShape$1,rootPolicyShape:rootPolicyShape$1}=buildChannelAccountSchemaParts({omit:[`mentionPatterns`],streaming:ChannelDeliveryStreamingConfigSchema.optional()});const GoogleChatAccountSchemaBase=strictObject({...accountShape$1,allowBots:buildChannelAllowBotsSchema(),botLoopProtection:ChannelBotLoopProtectionSchema.optional(),dangerouslyAllowNameMatching:ChannelDangerouslyAllowNameMatchingSchema,requireMention:boolean().optional(),groups:record(string(),GoogleChatGroupSchema.optional()).optional(),serviceAccount:union([string(),record(string(),unknown()),SecretRefSchema]).optional().register(sensitive),serviceAccountFile:string().optional(),audienceType:_enum([`app-url`,`project-number`]).optional(),audience:string().optional(),appPrincipal:string().optional(),webhookPath:string().optional(),webhookUrl:string().optional(),botUser:string().optional(),dm:strictObject({enabled:boolean().optional()}).optional(),typingIndicator:_enum([`none`,`message`,`reaction`]).optional()});const GoogleChatConfigSchema=GoogleChatAccountSchemaBase.extend({...rootPolicyShape$1,accounts:record(string(),GoogleChatAccountSchemaBase.optional()).optional(),defaultAccount:string().optional()}).superRefine((e,t)=>{refineChannelDmPolicy({channelId:`googlechat`,value:e,ctx:t});for(const n of Object.keys(e.accounts??{}))refineChannelDmPolicy({channelId:`googlechat`,value:e,accountId:n,ctx:t})});
//!src/config/zod-schema.providers-whatsapp.ts
const WhatsAppGroupEntrySchema=buildGroupEntrySchema(void 0,{omit:[`skills`,`enabled`,`allowFrom`]}).optional();const WhatsAppDirectEntrySchema=strictObject({systemPrompt:string().optional()}).optional();const{accountShape,rootPolicyShape}=buildChannelAccountSchemaParts({omit:[`name`],allowFrom:array(string()).optional(),groupAllowFrom:array(string()).optional(),streaming:ChannelDeliveryStreamingConfigSchema.optional(),mediaMaxMb:number().int().positive().optional()});const WhatsAppCommonShape={...accountShape,sendReadReceipts:ChannelSendReadReceiptsSchema,selfChatMode:boolean().optional(),groups:record(string(),WhatsAppGroupEntrySchema).optional(),direct:record(string(),WhatsAppDirectEntrySchema).optional(),...buildChannelReactionShape({reactionLevels:[`off`,`ack`,`minimal`,`extensive`]}),pluginHooks:strictObject({messageReceived:boolean().optional()}).optional()};const WhatsAppAccountSchema=strictObject({...WhatsAppCommonShape,name:string().optional(),authDir:string().optional()});const WhatsAppConfigSchema=strictObject({...WhatsAppCommonShape,...rootPolicyShape,accounts:record(string(),WhatsAppAccountSchema.optional()).optional(),defaultAccount:string().optional(),mediaMaxMb:number().int().positive().optional().default(50),actions:strictObject({reactions:boolean().optional(),sendMessage:boolean().optional(),polls:boolean().optional(),calls:boolean().optional()}).optional()}).superRefine((e,t)=>{const n=resolveAccountEntry(e.accounts,`default`);refineChannelDmPolicy({channelId:`whatsapp`,value:e,ctx:t});const r={...e,dmPolicy:n?.dmPolicy??e.dmPolicy,allowFrom:n?.allowFrom??e.allowFrom};for(const n of Object.keys(e.accounts??{}))refineChannelDmPolicy({channelId:`whatsapp`,value:n==="default"?e:r,accountId:n,ctx:t})});
//!src/plugin-sdk/bundled-channel-config-schema.ts
function createLegacyExternalChannelConfigSchema(){return object({}).passthrough()}const SlackConfigSchema=createLegacyExternalChannelConfigSchema();const DiscordConfigSchema=createLegacyExternalChannelConfigSchema();const SignalConfigSchema=createLegacyExternalChannelConfigSchema();const MSTeamsConfigSchema=createLegacyExternalChannelConfigSchema();function loadBundledConfigSchema(e,t){const n=loadBundledPluginPublicSurfaceModuleSyncCore({dirName:e,artifactBasename:`config-api.js`})[t];if(!n)throw new Error(`Bundled plugin ${e} config API does not export ${t}`);return n}const IMessageConfigSchema=createLazyFacadeObjectValue(()=>loadBundledConfigSchema(`imessage`,`IMessageConfigSchema`));const TelegramConfigSchema=createLazyFacadeObjectValue(()=>loadBundledConfigSchema(`telegram`,`TelegramConfigSchema`));export{AllowFromListSchema,BlockStreamingCoalesceSchema,ChannelGroupEntrySchema,ContextVisibilityModeSchema,DiscordConfigSchema,DmConfigSchema,DmPolicySchema,GoogleChatConfigSchema,GroupPolicySchema,IMessageConfigSchema,MSTeamsConfigSchema,MarkdownConfigSchema,ReplyRuntimeConfigSchemaShape,SignalConfigSchema,SlackConfigSchema,TelegramConfigSchema,ToolPolicySchema,WhatsAppConfigSchema,buildCatchallMultiAccountChannelSchema,buildChannelConfigSchema,buildGroupEntrySchema,buildMultiAccountChannelSchema,buildNestedDmConfigSchema,requireAllowlistAllowFrom,requireOpenAllowFrom};