mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
73 lines
2.5 KiB
TypeScript
73 lines
2.5 KiB
TypeScript
/**
|
|
* Zod-backed config schema for ClickClack channel accounts.
|
|
*/
|
|
import {
|
|
buildChannelAllowBotsSchema,
|
|
buildChannelConfigSchema,
|
|
buildMultiAccountChannelSchema,
|
|
ChannelBotLoopProtectionSchema,
|
|
} from "openclaw/plugin-sdk/channel-config-schema";
|
|
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
import { z } from "zod";
|
|
|
|
const ClickClackAccountConfigSchema = z
|
|
.object({
|
|
name: z.string().optional(),
|
|
enabled: z.boolean().optional(),
|
|
configWrites: z.boolean().optional(),
|
|
baseUrl: z.string().url().optional(),
|
|
apiBaseUrl: z.string().url().optional(),
|
|
token: buildSecretInputSchema().optional(),
|
|
tokenFile: z.string().optional(),
|
|
workspace: z.string().optional(),
|
|
botUserId: z.string().optional(),
|
|
agentId: z.string().optional(),
|
|
replyMode: z.enum(["agent", "model"]).optional(),
|
|
model: z.string().optional(),
|
|
systemPrompt: z.string().optional(),
|
|
toolsAllow: z.array(z.string()).optional(),
|
|
defaultTo: z.string().optional(),
|
|
allowFrom: z.array(z.string()).optional(),
|
|
allowBots: buildChannelAllowBotsSchema({ allowMentions: true }),
|
|
botLoopProtection: ChannelBotLoopProtectionSchema.optional(),
|
|
reconnectMs: z.number().int().min(100).max(60_000).optional(),
|
|
agentActivity: z.boolean().optional(),
|
|
nativeProgress: z.boolean().optional(),
|
|
commandMenu: z.boolean().optional(),
|
|
requireMention: z.boolean().optional(),
|
|
mentionPatterns: z.array(z.string()).optional(),
|
|
groups: z
|
|
.record(
|
|
z.string(),
|
|
z
|
|
.object({
|
|
requireMention: z.boolean().optional(),
|
|
mentionPatterns: z.array(z.string()).optional(),
|
|
allowBots: buildChannelAllowBotsSchema({ allowMentions: true }),
|
|
botLoopProtection: ChannelBotLoopProtectionSchema.optional(),
|
|
})
|
|
.strict(),
|
|
)
|
|
.optional(),
|
|
discussions: z
|
|
.object({
|
|
enabled: z.boolean().optional(),
|
|
workspace: z.string().optional(),
|
|
controlUrlBase: z.string().url().optional(),
|
|
section: z.string().optional(),
|
|
})
|
|
.strict()
|
|
.optional(),
|
|
})
|
|
.strict();
|
|
|
|
const ClickClackConfigSchema = buildMultiAccountChannelSchema(ClickClackAccountConfigSchema, {
|
|
accountSchema: ClickClackAccountConfigSchema.partial(),
|
|
});
|
|
|
|
/**
|
|
* Config schema exported to core so `openclaw doctor` and config validation
|
|
* understand both default and named ClickClack accounts.
|
|
*/
|
|
export const clickClackConfigSchema = buildChannelConfigSchema(ClickClackConfigSchema);
|