@wu529778790/open-im 1.10.9-beta.11 → 1.10.9-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ const PLATFORM_LABELS = {
5
5
  wework: "企业微信",
6
6
  dingtalk: "钉钉",
7
7
  workbuddy: "WorkBuddy",
8
+ clawbot: "ClawBot",
8
9
  };
9
10
  export const CHANNEL_CAPABILITIES = {
10
11
  telegram: {
@@ -31,6 +32,10 @@ export const CHANNEL_CAPABILITIES = {
31
32
  inbound: { text: "native", image: "none", file: "none", voice: "none", video: "none" },
32
33
  outbound: { streamEdit: "none", streamPush: "none", image: "none", card: "none", typing: "none" },
33
34
  },
35
+ clawbot: {
36
+ inbound: { text: "native", image: "none", file: "none", voice: "none", video: "none" },
37
+ outbound: { streamEdit: "none", streamPush: "none", image: "none", card: "none", typing: "none" },
38
+ },
34
39
  };
35
40
  function listPreferredPlatforms(kind) {
36
41
  return Object.entries(CHANNEL_CAPABILITIES)
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ClawBot Client - WeChat iLink API long-polling client
3
+ *
4
+ * Receives messages via long-polling ilink/bot/getupdates
5
+ * and dispatches them to the event handler.
6
+ */
7
+ import type { Config } from '../config.js';
8
+ import type { ClawBotState } from './types.js';
9
+ export declare function getChannelState(): ClawBotState;
10
+ export declare function initClawbot(config: Config, eventHandler: (chatId: string, msgId: string, content: string) => Promise<void>, onStateChange?: (state: ClawBotState) => void): Promise<void>;
11
+ export declare function stopClawbot(): void;
@@ -0,0 +1,169 @@
1
+ /**
2
+ * ClawBot Client - WeChat iLink API long-polling client
3
+ *
4
+ * Receives messages via long-polling ilink/bot/getupdates
5
+ * and dispatches them to the event handler.
6
+ */
7
+ import { createLogger } from '../logger.js';
8
+ import { jitteredDelay } from '../shared/reconnect.js';
9
+ import { CLAWBOT_POLL_INTERVAL_MS } from '../constants.js';
10
+ const log = createLogger('ClawBot');
11
+ const RECONNECT_DELAYS_MS = [3000, 5000, 10000, 20000, 30000];
12
+ let pollController = null;
13
+ let channelState = 'disconnected';
14
+ let messageHandler = null;
15
+ let stateChangeHandler = null;
16
+ let reconnectTimer = null;
17
+ let reconnectAttempt = 0;
18
+ let stopped = false;
19
+ let apiUrl = 'http://127.0.0.1:26322';
20
+ let apiToken = '';
21
+ let lastUpdateId = 0;
22
+ export function getChannelState() {
23
+ return channelState;
24
+ }
25
+ export async function initClawbot(config, eventHandler, onStateChange) {
26
+ const pc = config.platforms?.clawbot;
27
+ if (!pc?.enabled) {
28
+ throw new Error('ClawBot platform not enabled');
29
+ }
30
+ if (!pc.apiToken) {
31
+ throw new Error('ClawBot apiToken required');
32
+ }
33
+ apiUrl = pc.apiUrl ?? 'http://127.0.0.1:26322';
34
+ apiToken = pc.apiToken;
35
+ messageHandler = eventHandler;
36
+ stateChangeHandler = onStateChange ?? null;
37
+ stopped = false;
38
+ reconnectAttempt = 0;
39
+ lastUpdateId = 0;
40
+ // Verify connectivity
41
+ try {
42
+ const res = await fetchApi('/ilink/bot/getupdates?timeout=1');
43
+ if (!res.ok) {
44
+ throw new Error(`API check failed: ${res.error ?? 'unknown'}`);
45
+ }
46
+ log.info(`ClawBot API reachable at ${apiUrl}`);
47
+ }
48
+ catch (err) {
49
+ log.error('ClawBot API connectivity check failed:', err);
50
+ throw err;
51
+ }
52
+ updateState('connected');
53
+ startPolling();
54
+ log.info('ClawBot client initialized');
55
+ }
56
+ function startPolling() {
57
+ if (stopped || pollController)
58
+ return;
59
+ pollController = new AbortController();
60
+ const signal = pollController.signal;
61
+ (async () => {
62
+ log.info('ClawBot long-polling started');
63
+ while (!stopped && !signal.aborted) {
64
+ try {
65
+ const url = `/ilink/bot/getupdates?timeout=30${lastUpdateId > 0 ? `&offset=${lastUpdateId + 1}` : ''}`;
66
+ const res = await fetchApi(url, signal);
67
+ if (signal.aborted)
68
+ break;
69
+ if (!res.ok) {
70
+ log.warn(`ClawBot getupdates error: ${res.error ?? 'unknown'}`);
71
+ await sleep(CLAWBOT_POLL_INTERVAL_MS, signal);
72
+ continue;
73
+ }
74
+ const updates = res.result ?? [];
75
+ for (const update of updates) {
76
+ if (signal.aborted)
77
+ break;
78
+ lastUpdateId = Math.max(lastUpdateId, update.update_id);
79
+ const msg = update.message;
80
+ if (!msg?.text)
81
+ continue;
82
+ const chatId = msg.chat?.id ?? msg.from?.id ?? '';
83
+ const msgId = String(msg.message_id ?? update.update_id);
84
+ const content = msg.text;
85
+ if (!chatId) {
86
+ log.warn('ClawBot message missing chatId, skipping');
87
+ continue;
88
+ }
89
+ log.info(`ClawBot message: chatId=${chatId}, msgId=${msgId}, content="${content.substring(0, 100)}"`);
90
+ if (messageHandler) {
91
+ try {
92
+ await messageHandler(chatId, msgId, content);
93
+ }
94
+ catch (err) {
95
+ log.error('Error in ClawBot message handler:', err);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ catch (err) {
101
+ if (signal.aborted)
102
+ break;
103
+ if (err instanceof Error && err.name === 'AbortError')
104
+ break;
105
+ log.error('ClawBot polling error:', err);
106
+ updateState('error');
107
+ scheduleReconnect();
108
+ return;
109
+ }
110
+ }
111
+ })();
112
+ }
113
+ function scheduleReconnect() {
114
+ if (stopped)
115
+ return;
116
+ if (reconnectTimer) {
117
+ clearTimeout(reconnectTimer);
118
+ reconnectTimer = null;
119
+ }
120
+ const baseDelay = RECONNECT_DELAYS_MS[Math.min(reconnectAttempt, RECONNECT_DELAYS_MS.length - 1)];
121
+ const delay = jitteredDelay(baseDelay);
122
+ reconnectAttempt++;
123
+ log.info(`ClawBot reconnecting in ${delay}ms (attempt ${reconnectAttempt})...`);
124
+ reconnectTimer = setTimeout(() => {
125
+ reconnectTimer = null;
126
+ if (stopped)
127
+ return;
128
+ updateState('connected');
129
+ startPolling();
130
+ }, delay);
131
+ }
132
+ function updateState(state) {
133
+ channelState = state;
134
+ stateChangeHandler?.(state);
135
+ log.debug(`ClawBot state: ${state}`);
136
+ }
137
+ async function fetchApi(path, signal) {
138
+ const url = `${apiUrl}${path}`;
139
+ const res = await fetch(url, {
140
+ headers: { Authorization: `Bearer ${apiToken}` },
141
+ signal,
142
+ });
143
+ return res.json();
144
+ }
145
+ function sleep(ms, signal) {
146
+ return new Promise((resolve) => {
147
+ if (signal?.aborted) {
148
+ resolve();
149
+ return;
150
+ }
151
+ const timer = setTimeout(resolve, ms);
152
+ signal?.addEventListener('abort', () => { clearTimeout(timer); resolve(); }, { once: true });
153
+ });
154
+ }
155
+ export function stopClawbot() {
156
+ log.info('Stopping ClawBot client...');
157
+ stopped = true;
158
+ if (pollController) {
159
+ pollController.abort();
160
+ pollController = null;
161
+ }
162
+ if (reconnectTimer) {
163
+ clearTimeout(reconnectTimer);
164
+ reconnectTimer = null;
165
+ }
166
+ messageHandler = null;
167
+ updateState('disconnected');
168
+ log.info('ClawBot client stopped');
169
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ClawBot Event Handler - Handle messages from iLink API long-polling
3
+ */
4
+ import type { Config } from '../config.js';
5
+ import type { SessionManager } from '../session/session-manager.js';
6
+ export interface ClawBotEventHandlerHandle {
7
+ stop: () => void;
8
+ runningTasks: Map<string, import('../shared/ai-task.js').TaskRunState>;
9
+ getRunningTaskCount: () => number;
10
+ handleEvent: (chatId: string, msgId: string, content: string) => Promise<void>;
11
+ }
12
+ export declare function setupClawbotHandlers(config: Config, sessionManager: SessionManager): ClawBotEventHandlerHandle;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * ClawBot Event Handler - Handle messages from iLink API long-polling
3
+ */
4
+ import { sendTextReply, sendErrorReply } from './message-sender.js';
5
+ import { startTaskCleanup } from '../shared/task-cleanup.js';
6
+ import { CLAWBOT_THROTTLE_MS } from '../constants.js';
7
+ import { createLogger } from '../logger.js';
8
+ import { createPlatformEventContext } from '../platform/create-event-context.js';
9
+ import { createPlatformAIRequestHandler } from '../platform/handle-ai-request.js';
10
+ import { handleTextFlow } from '../platform/handle-text-flow.js';
11
+ const log = createLogger('ClawBotHandler');
12
+ export function setupClawbotHandlers(config, sessionManager) {
13
+ const ctx = createPlatformEventContext({
14
+ platform: 'clawbot',
15
+ allowedUserIds: config.clawbotAllowedUserIds,
16
+ config,
17
+ sessionManager,
18
+ sender: {
19
+ sendTextReply: async (chatId, text) => {
20
+ await sendTextReply(chatId, text);
21
+ },
22
+ },
23
+ });
24
+ const stopTaskCleanup = startTaskCleanup(ctx.runningTasks);
25
+ const platformSender = {
26
+ sendThinkingMessage: async (_chatId, _replyToMessageId, _toolId) => {
27
+ return 'clawbot_no_thinking';
28
+ },
29
+ sendTextReply: async (chatId, text) => {
30
+ await sendTextReply(chatId, text);
31
+ },
32
+ startTyping: (_chatId) => {
33
+ return () => { };
34
+ },
35
+ };
36
+ async function handleEvent(chatId, msgId, content) {
37
+ log.info(`[handleEvent] chatId=${chatId}, msgId=${msgId}, content="${content.substring(0, 100)}"`);
38
+ const userId = chatId;
39
+ const text = content.trim();
40
+ const msgIdSender = {
41
+ ...platformSender,
42
+ sendTextReply: async (c, t) => {
43
+ await sendTextReply(c, t);
44
+ },
45
+ };
46
+ const handleAIRequest = createPlatformAIRequestHandler({
47
+ platform: 'clawbot',
48
+ config,
49
+ sessionManager,
50
+ sender: msgIdSender,
51
+ throttleMs: CLAWBOT_THROTTLE_MS,
52
+ runningTasks: ctx.runningTasks,
53
+ taskKeyBuilder: (userId, _msgId) => `${userId}:${msgId}`,
54
+ taskCallbacksFactory: ({ chatId: c }) => ({
55
+ streamUpdate: async () => { },
56
+ sendComplete: async (content) => {
57
+ await sendTextReply(c, content);
58
+ },
59
+ sendError: async (error) => {
60
+ await sendErrorReply(c, error);
61
+ },
62
+ }),
63
+ });
64
+ await handleTextFlow({
65
+ platform: 'clawbot',
66
+ userId,
67
+ chatId,
68
+ text,
69
+ ctx,
70
+ handleAIRequest,
71
+ sendTextReply: (c, t) => sendTextReply(c, t),
72
+ workDir: sessionManager.getWorkDir(userId),
73
+ convId: sessionManager.getConvId(userId),
74
+ accessDeniedMessage: (uid) => `抱歉,您没有访问权限。\n您的 ID: ${uid}`,
75
+ queueFullMessage: '请求队列已满,请稍后再试。',
76
+ queuedMessage: '您的请求已排队等待。',
77
+ });
78
+ }
79
+ return {
80
+ stop: () => stopTaskCleanup(),
81
+ runningTasks: ctx.runningTasks,
82
+ getRunningTaskCount: () => ctx.runningTasks.size,
83
+ handleEvent,
84
+ };
85
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ClawBot Message Sender - Send messages via iLink API
3
+ */
4
+ export declare function initClawBotSender(url: string, token: string): void;
5
+ /**
6
+ * Send text reply to a ClawBot chat, splitting long messages automatically.
7
+ */
8
+ export declare function sendTextReply(chatId: string, text: string): Promise<void>;
9
+ /**
10
+ * Send error reply to a ClawBot chat.
11
+ */
12
+ export declare function sendErrorReply(chatId: string, error: string): Promise<void>;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * ClawBot Message Sender - Send messages via iLink API
3
+ */
4
+ import { createLogger } from '../logger.js';
5
+ import { splitLongContent, toReplyPlainText } from '../shared/utils.js';
6
+ import { MAX_CLAWBOT_MESSAGE_LENGTH } from '../constants.js';
7
+ import { getChannelState } from './client.js';
8
+ const log = createLogger('ClawBotSender');
9
+ let apiUrl = 'http://127.0.0.1:26322';
10
+ let apiToken = '';
11
+ export function initClawBotSender(url, token) {
12
+ apiUrl = url;
13
+ apiToken = token;
14
+ }
15
+ async function postMessage(chatId, text) {
16
+ if (getChannelState() !== 'connected') {
17
+ log.warn('ClawBot not connected, cannot send message');
18
+ return false;
19
+ }
20
+ try {
21
+ const res = await fetch(`${apiUrl}/ilink/bot/sendmessage`, {
22
+ method: 'POST',
23
+ headers: {
24
+ 'Content-Type': 'application/json',
25
+ Authorization: `Bearer ${apiToken}`,
26
+ },
27
+ body: JSON.stringify({ chat_id: chatId, text }),
28
+ });
29
+ const data = await res.json();
30
+ if (!data.ok) {
31
+ log.error(`ClawBot sendmessage failed: ${data.error ?? 'unknown'}`);
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ catch (err) {
37
+ log.error('ClawBot sendmessage error:', err);
38
+ return false;
39
+ }
40
+ }
41
+ /**
42
+ * Send text reply to a ClawBot chat, splitting long messages automatically.
43
+ */
44
+ export async function sendTextReply(chatId, text) {
45
+ const plainText = toReplyPlainText(text);
46
+ const parts = splitLongContent(plainText, MAX_CLAWBOT_MESSAGE_LENGTH);
47
+ if (parts.length === 1) {
48
+ log.info(`Sending ClawBot reply to chatId=${chatId}, len=${plainText.length}`);
49
+ await postMessage(chatId, plainText);
50
+ return;
51
+ }
52
+ log.info(`Sending ClawBot reply in ${parts.length} parts to chatId=${chatId}, totalLen=${plainText.length}`);
53
+ for (let i = 0; i < parts.length; i++) {
54
+ const partText = i === 0
55
+ ? `${parts[i]}\n\n_(1/${parts.length})_`
56
+ : `_(续 ${i + 1}/${parts.length})_\n\n${parts[i]}`;
57
+ await postMessage(chatId, partText);
58
+ log.info(`ClawBot part ${i + 1}/${parts.length} sent`);
59
+ }
60
+ }
61
+ /**
62
+ * Send error reply to a ClawBot chat.
63
+ */
64
+ export async function sendErrorReply(chatId, error) {
65
+ log.warn(`Sending ClawBot error to chatId=${chatId}`);
66
+ await postMessage(chatId, `错误: ${error}`);
67
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ClawBot QR Code Login - WeChat iLink API
3
+ *
4
+ * Calls https://ilinkai.weixin.qq.com to get QR code and poll for login confirmation.
5
+ * Returns bot_token on success.
6
+ */
7
+ export interface QRLoginSession {
8
+ sessionKey: string;
9
+ qrcode: string;
10
+ qrcodeUrl: string;
11
+ startedAt: number;
12
+ }
13
+ export interface QRLoginResult {
14
+ connected: boolean;
15
+ botToken?: string;
16
+ accountId?: string;
17
+ baseUrl?: string;
18
+ userId?: string;
19
+ message: string;
20
+ }
21
+ export declare function fetchQRCode(): Promise<{
22
+ qrcode: string;
23
+ qrcodeUrl: string;
24
+ }>;
25
+ /**
26
+ * Start QR code login session. Returns QR code URL for display.
27
+ */
28
+ export declare function startQRLogin(): Promise<QRLoginSession>;
29
+ /**
30
+ * Wait for user to scan QR code. Polls until confirmed or timeout.
31
+ * Returns bot_token on success.
32
+ */
33
+ export declare function waitForQRLogin(session: QRLoginSession, onStatusChange?: (status: string) => void): Promise<QRLoginResult>;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * ClawBot QR Code Login - WeChat iLink API
3
+ *
4
+ * Calls https://ilinkai.weixin.qq.com to get QR code and poll for login confirmation.
5
+ * Returns bot_token on success.
6
+ */
7
+ import { randomUUID } from 'node:crypto';
8
+ import { createLogger } from '../logger.js';
9
+ const log = createLogger('ClawBotQR');
10
+ const ILINK_BASE_URL = 'https://ilinkai.weixin.qq.com';
11
+ const ILINK_APP_ID = 'bot';
12
+ const BOT_TYPE = '3';
13
+ const POLL_TIMEOUT_MS = 35_000;
14
+ const LOGIN_TIMEOUT_MS = 5 * 60_000;
15
+ function buildHeaders() {
16
+ return {
17
+ 'Content-Type': 'application/json',
18
+ 'AuthorizationType': 'ilink_bot_token',
19
+ 'X-WECHAT-UIN': randomUUID(),
20
+ 'iLink-App-Id': ILINK_APP_ID,
21
+ 'iLink-App-ClientVersion': '131588', // 2.4.4 encoded
22
+ };
23
+ }
24
+ export async function fetchQRCode() {
25
+ const url = `${ILINK_BASE_URL}/ilink/bot/get_bot_qrcode?bot_type=${BOT_TYPE}`;
26
+ const res = await fetch(url, {
27
+ method: 'POST',
28
+ headers: buildHeaders(),
29
+ body: JSON.stringify({ local_token_list: [] }),
30
+ });
31
+ const data = await res.json();
32
+ if (!data.qrcode) {
33
+ throw new Error('Failed to get QR code from iLink API');
34
+ }
35
+ return { qrcode: data.qrcode, qrcodeUrl: data.qrcode_img_content };
36
+ }
37
+ async function pollQRStatus(qrcode) {
38
+ const url = `${ILINK_BASE_URL}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(qrcode)}`;
39
+ const controller = new AbortController();
40
+ const timer = setTimeout(() => controller.abort(), POLL_TIMEOUT_MS);
41
+ try {
42
+ const headers = buildHeaders();
43
+ delete headers['Content-Type'];
44
+ const res = await fetch(url, {
45
+ method: 'GET',
46
+ headers,
47
+ signal: controller.signal,
48
+ });
49
+ clearTimeout(timer);
50
+ return await res.json();
51
+ }
52
+ catch (err) {
53
+ clearTimeout(timer);
54
+ if (err instanceof Error && err.name === 'AbortError') {
55
+ return { status: 'wait' };
56
+ }
57
+ throw err;
58
+ }
59
+ }
60
+ /**
61
+ * Start QR code login session. Returns QR code URL for display.
62
+ */
63
+ export async function startQRLogin() {
64
+ log.info('Starting ClawBot QR login...');
65
+ const { qrcode, qrcodeUrl } = await fetchQRCode();
66
+ log.info(`QR code received, url=${qrcodeUrl}`);
67
+ return {
68
+ sessionKey: randomUUID(),
69
+ qrcode,
70
+ qrcodeUrl,
71
+ startedAt: Date.now(),
72
+ };
73
+ }
74
+ /**
75
+ * Wait for user to scan QR code. Polls until confirmed or timeout.
76
+ * Returns bot_token on success.
77
+ */
78
+ export async function waitForQRLogin(session, onStatusChange) {
79
+ const deadline = Date.now() + LOGIN_TIMEOUT_MS;
80
+ let currentBaseUrl = ILINK_BASE_URL;
81
+ let redirectCount = 0;
82
+ log.info('Waiting for QR code scan...');
83
+ while (Date.now() < deadline) {
84
+ const result = await pollQRStatus(session.qrcode);
85
+ onStatusChange?.(result.status);
86
+ switch (result.status) {
87
+ case 'wait':
88
+ case 'scaned':
89
+ break;
90
+ case 'scaned_but_redirect':
91
+ if (result.redirect_host) {
92
+ currentBaseUrl = `https://${result.redirect_host}`;
93
+ redirectCount++;
94
+ log.info(`IDC redirect to ${result.redirect_host} (${redirectCount})`);
95
+ }
96
+ break;
97
+ case 'confirmed':
98
+ if (!result.bot_token) {
99
+ return { connected: false, message: '登录失败:服务器未返回 bot_token' };
100
+ }
101
+ log.info(`Login confirmed! botId=${result.ilink_bot_id}`);
102
+ return {
103
+ connected: true,
104
+ botToken: result.bot_token,
105
+ accountId: result.ilink_bot_id,
106
+ baseUrl: result.baseurl,
107
+ userId: result.ilink_user_id,
108
+ message: '登录成功',
109
+ };
110
+ case 'expired':
111
+ return { connected: false, message: '二维码已过期,请重新生成' };
112
+ case 'binded_redirect':
113
+ return { connected: false, message: '已连接过,无需重复连接' };
114
+ default:
115
+ log.warn(`Unknown QR status: ${result.status}`);
116
+ }
117
+ await new Promise(r => setTimeout(r, 1000));
118
+ }
119
+ return { connected: false, message: '登录超时,请重试' };
120
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * ClawBot Types - WeChat iLink API
3
+ */
4
+ /** Connection state */
5
+ export type ClawBotState = 'disconnected' | 'connecting' | 'connected' | 'error';
6
+ /** ClawBot configuration */
7
+ export interface ClawBotConfig {
8
+ /** iLink API base URL (default: http://127.0.0.1:26322) */
9
+ apiUrl: string;
10
+ /** Bearer token for authentication */
11
+ apiToken: string;
12
+ }
13
+ /** Message from getupdates */
14
+ export interface ClawBotUpdate {
15
+ update_id: number;
16
+ message?: {
17
+ message_id: number;
18
+ from?: {
19
+ id: string;
20
+ name?: string;
21
+ };
22
+ chat?: {
23
+ id: string;
24
+ type?: string;
25
+ };
26
+ text?: string;
27
+ date?: number;
28
+ };
29
+ }
30
+ /** getupdates response */
31
+ export interface ClawBotUpdatesResponse {
32
+ ok: boolean;
33
+ result?: ClawBotUpdate[];
34
+ error?: string;
35
+ }
36
+ /** sendmessage response */
37
+ export interface ClawBotSendResponse {
38
+ ok: boolean;
39
+ result?: {
40
+ message_id: number;
41
+ };
42
+ error?: string;
43
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ClawBot Types - WeChat iLink API
3
+ */
4
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { LogLevel } from '../logger.js';
2
- export type Platform = 'dingtalk' | 'feishu' | 'qq' | 'telegram' | 'wework' | 'workbuddy';
2
+ export type Platform = 'clawbot' | 'dingtalk' | 'feishu' | 'qq' | 'telegram' | 'wework' | 'workbuddy';
3
3
  export type AiCommand = 'claude' | 'codex' | 'codebuddy';
4
4
  export interface Config {
5
5
  enabledPlatforms: Platform[];
@@ -21,6 +21,7 @@ export interface Config {
21
21
  weworkAllowedUserIds: string[];
22
22
  dingtalkAllowedUserIds: string[];
23
23
  workbuddyAllowedUserIds: string[];
24
+ clawbotAllowedUserIds: string[];
24
25
  codexCliPath: string;
25
26
  codebuddyCliPath: string;
26
27
  /** Claude 访问 API 的代理(如 http://127.0.0.1:7890) */
@@ -87,6 +88,13 @@ export interface Config {
87
88
  guid?: string;
88
89
  workspacePath?: string;
89
90
  };
91
+ clawbot?: {
92
+ enabled: boolean;
93
+ aiCommand?: AiCommand;
94
+ allowedUserIds: string[];
95
+ apiUrl?: string;
96
+ apiToken?: string;
97
+ };
90
98
  };
91
99
  }
92
100
  export interface FilePlatformTelegram {
@@ -147,6 +155,13 @@ export interface FilePlatformWorkBuddy {
147
155
  guid?: string;
148
156
  workspacePath?: string;
149
157
  }
158
+ export interface FilePlatformClawbot {
159
+ enabled?: boolean;
160
+ aiCommand?: AiCommand;
161
+ allowedUserIds?: string[];
162
+ apiUrl?: string;
163
+ apiToken?: string;
164
+ }
150
165
  export interface FileToolClaude {
151
166
  cliPath?: string;
152
167
  workDir?: string;
@@ -180,6 +195,7 @@ export interface FileConfig {
180
195
  wework?: FilePlatformWework;
181
196
  dingtalk?: FilePlatformDingtalk;
182
197
  workbuddy?: FilePlatformWorkBuddy;
198
+ clawbot?: FilePlatformClawbot;
183
199
  };
184
200
  /** @deprecated 仅旧配置兼容;运行时以各 platforms.*.aiCommand 为准 */
185
201
  aiCommand?: string;