@workclaw/openclaw-workclaw 1.0.20 → 1.0.25
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.
- package/README.md +0 -1
- package/api.ts +3 -0
- package/index.ts +325 -0
- package/package.json +3 -11
- package/setup-entry.ts +13 -0
- package/src/accounts.ts +360 -0
- package/src/api/accounts-api.ts +156 -0
- package/src/api/prompts-api.ts +122 -0
- package/src/api/session-api.ts +246 -0
- package/src/api/skills-api.ts +74 -0
- package/src/api/workspace.ts +45 -0
- package/src/channel.ts +226 -0
- package/{dist/src/config-schema.js → src/config-schema.ts} +60 -56
- package/src/connection/workclaw-client.ts +618 -0
- package/src/gateway/agent-handlers.ts +551 -0
- package/src/gateway/config-writer.ts +378 -0
- package/src/gateway/cron-tasks-handler.ts +230 -0
- package/src/gateway/message-context.ts +645 -0
- package/src/gateway/message-dispatcher.ts +688 -0
- package/src/gateway/reconnect.ts +260 -0
- package/src/gateway/skills-handler.ts +805 -0
- package/src/gateway/skills-list-handler.ts +332 -0
- package/src/gateway/tools-list-handler.ts +161 -0
- package/src/gateway/workclaw-gateway.ts +304 -0
- package/src/media/upload.ts +168 -0
- package/src/outbound/index.ts +191 -0
- package/src/outbound/workclaw-sender.ts +161 -0
- package/src/runtime.ts +520 -0
- package/src/secret-contract-api.ts +4 -0
- package/src/send.ts +1 -0
- package/src/setup-api.ts +3 -0
- package/src/setup-core.ts +25 -0
- package/src/setup-surface.ts +498 -0
- package/src/tools/openclaw-workclaw-cron/api/index.ts +326 -0
- package/{dist/src/tools/openclaw-workclaw-cron/index.js → src/tools/openclaw-workclaw-cron/index.ts} +39 -33
- package/src/tools/openclaw-workclaw-cron/src/add/params.ts +177 -0
- package/src/tools/openclaw-workclaw-cron/src/add/sync.ts +188 -0
- package/src/tools/openclaw-workclaw-cron/src/disable/params.ts +100 -0
- package/src/tools/openclaw-workclaw-cron/src/disable/sync.ts +127 -0
- package/src/tools/openclaw-workclaw-cron/src/enable/params.ts +100 -0
- package/src/tools/openclaw-workclaw-cron/src/enable/sync.ts +127 -0
- package/src/tools/openclaw-workclaw-cron/src/notify/sync.ts +148 -0
- package/src/tools/openclaw-workclaw-cron/src/remove/params.ts +109 -0
- package/src/tools/openclaw-workclaw-cron/src/remove/sync.ts +127 -0
- package/src/tools/openclaw-workclaw-cron/src/update/params.ts +195 -0
- package/src/tools/openclaw-workclaw-cron/src/update/sync.ts +161 -0
- package/src/tools/openclaw-workclaw-cron/types/index.ts +55 -0
- package/src/tools/openclaw-workclaw-cron/utils/index.ts +141 -0
- package/{dist/src/tools/openclaw-workclaw-system/index.js → src/tools/openclaw-workclaw-system/index.ts} +17 -15
- package/src/tools/openclaw-workclaw-system/src/get/index.ts +77 -0
- package/src/tools/openclaw-workclaw-system/src/token/index.ts +93 -0
- package/src/types.ts +50 -0
- package/src/utils/content.ts +40 -0
- package/tsconfig.json +34 -0
- package/dist/api.d.ts +0 -3
- package/dist/api.js +0 -3
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -264
- package/dist/setup-entry.d.ts +0 -2
- package/dist/setup-entry.js +0 -12
- package/dist/src/accounts.d.ts +0 -66
- package/dist/src/accounts.js +0 -279
- package/dist/src/api/accounts-api.d.ts +0 -2
- package/dist/src/api/accounts-api.js +0 -130
- package/dist/src/api/prompts-api.d.ts +0 -2
- package/dist/src/api/prompts-api.js +0 -103
- package/dist/src/api/session-api.d.ts +0 -2
- package/dist/src/api/session-api.js +0 -207
- package/dist/src/api/skills-api.d.ts +0 -2
- package/dist/src/api/skills-api.js +0 -64
- package/dist/src/api/workspace.d.ts +0 -3
- package/dist/src/api/workspace.js +0 -30
- package/dist/src/channel.d.ts +0 -11
- package/dist/src/channel.js +0 -199
- package/dist/src/config-schema.d.ts +0 -93
- package/dist/src/connection/workclaw-client.d.ts +0 -147
- package/dist/src/connection/workclaw-client.js +0 -351
- package/dist/src/gateway/agent-handlers.d.ts +0 -12
- package/dist/src/gateway/agent-handlers.js +0 -433
- package/dist/src/gateway/config-writer.d.ts +0 -71
- package/dist/src/gateway/config-writer.js +0 -302
- package/dist/src/gateway/cron-tasks-handler.d.ts +0 -19
- package/dist/src/gateway/cron-tasks-handler.js +0 -188
- package/dist/src/gateway/message-context.d.ts +0 -80
- package/dist/src/gateway/message-context.js +0 -509
- package/dist/src/gateway/message-dispatcher.d.ts +0 -18
- package/dist/src/gateway/message-dispatcher.js +0 -572
- package/dist/src/gateway/reconnect.d.ts +0 -27
- package/dist/src/gateway/reconnect.js +0 -210
- package/dist/src/gateway/skills-handler.d.ts +0 -29
- package/dist/src/gateway/skills-handler.js +0 -615
- package/dist/src/gateway/skills-list-handler.d.ts +0 -27
- package/dist/src/gateway/skills-list-handler.js +0 -233
- package/dist/src/gateway/tools-list-handler.d.ts +0 -30
- package/dist/src/gateway/tools-list-handler.js +0 -101
- package/dist/src/gateway/workclaw-gateway.d.ts +0 -14
- package/dist/src/gateway/workclaw-gateway.js +0 -237
- package/dist/src/media/upload.d.ts +0 -13
- package/dist/src/media/upload.js +0 -125
- package/dist/src/outbound/index.d.ts +0 -36
- package/dist/src/outbound/index.js +0 -123
- package/dist/src/outbound/workclaw-sender.d.ts +0 -36
- package/dist/src/outbound/workclaw-sender.js +0 -95
- package/dist/src/runtime.d.ts +0 -116
- package/dist/src/runtime.js +0 -374
- package/dist/src/secret-contract-api.d.ts +0 -4
- package/dist/src/secret-contract-api.js +0 -4
- package/dist/src/send.d.ts +0 -1
- package/dist/src/send.js +0 -1
- package/dist/src/setup-api.d.ts +0 -3
- package/dist/src/setup-api.js +0 -3
- package/dist/src/setup-core.d.ts +0 -3
- package/dist/src/setup-core.js +0 -13
- package/dist/src/setup-surface.d.ts +0 -7
- package/dist/src/setup-surface.js +0 -363
- package/dist/src/tools/openclaw-workclaw-cron/api/index.d.ts +0 -93
- package/dist/src/tools/openclaw-workclaw-cron/api/index.js +0 -209
- package/dist/src/tools/openclaw-workclaw-cron/index.d.ts +0 -10
- package/dist/src/tools/openclaw-workclaw-cron/src/add/params.d.ts +0 -16
- package/dist/src/tools/openclaw-workclaw-cron/src/add/params.js +0 -152
- package/dist/src/tools/openclaw-workclaw-cron/src/add/sync.d.ts +0 -18
- package/dist/src/tools/openclaw-workclaw-cron/src/add/sync.js +0 -162
- package/dist/src/tools/openclaw-workclaw-cron/src/disable/params.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/disable/params.js +0 -80
- package/dist/src/tools/openclaw-workclaw-cron/src/disable/sync.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/disable/sync.js +0 -107
- package/dist/src/tools/openclaw-workclaw-cron/src/enable/params.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/enable/params.js +0 -80
- package/dist/src/tools/openclaw-workclaw-cron/src/enable/sync.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/enable/sync.js +0 -107
- package/dist/src/tools/openclaw-workclaw-cron/src/notify/sync.d.ts +0 -17
- package/dist/src/tools/openclaw-workclaw-cron/src/notify/sync.js +0 -127
- package/dist/src/tools/openclaw-workclaw-cron/src/remove/params.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/remove/params.js +0 -87
- package/dist/src/tools/openclaw-workclaw-cron/src/remove/sync.d.ts +0 -14
- package/dist/src/tools/openclaw-workclaw-cron/src/remove/sync.js +0 -107
- package/dist/src/tools/openclaw-workclaw-cron/src/update/params.d.ts +0 -17
- package/dist/src/tools/openclaw-workclaw-cron/src/update/params.js +0 -164
- package/dist/src/tools/openclaw-workclaw-cron/src/update/sync.d.ts +0 -18
- package/dist/src/tools/openclaw-workclaw-cron/src/update/sync.js +0 -135
- package/dist/src/tools/openclaw-workclaw-cron/types/index.d.ts +0 -52
- package/dist/src/tools/openclaw-workclaw-cron/types/index.js +0 -4
- package/dist/src/tools/openclaw-workclaw-cron/utils/index.d.ts +0 -40
- package/dist/src/tools/openclaw-workclaw-cron/utils/index.js +0 -122
- package/dist/src/tools/openclaw-workclaw-system/index.d.ts +0 -10
- package/dist/src/tools/openclaw-workclaw-system/src/get/index.d.ts +0 -8
- package/dist/src/tools/openclaw-workclaw-system/src/get/index.js +0 -64
- package/dist/src/tools/openclaw-workclaw-system/src/token/index.d.ts +0 -8
- package/dist/src/tools/openclaw-workclaw-system/src/token/index.js +0 -78
- package/dist/src/types.d.ts +0 -39
- package/dist/src/types.js +0 -1
- package/dist/src/utils/content.d.ts +0 -15
- package/dist/src/utils/content.js +0 -38
package/dist/src/channel.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
2
|
-
import { formatPairingApproveHint } from "openclaw/plugin-sdk/core";
|
|
3
|
-
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
4
|
-
import { isWorkclawAccountConfigured, listWorkclawAccountIds, resolveWorkclawAccount, } from "./accounts.js";
|
|
5
|
-
import { WorkclawConfigSchema } from "./config-schema.js";
|
|
6
|
-
import { sendMessageWorkclaw } from "./outbound/index.js";
|
|
7
|
-
import { getWorkclawRuntime, getWorkclawWsConnection, getLastInboundAt, getLastOutboundAt } from "./runtime.js";
|
|
8
|
-
import { startWorkclawGateway, stopWorkclawGateway } from "./gateway/workclaw-gateway.js";
|
|
9
|
-
import { appendFileSync } from "fs";
|
|
10
|
-
import { join } from "path";
|
|
11
|
-
import { homedir } from "os";
|
|
12
|
-
const meta = {
|
|
13
|
-
id: "openclaw-workclaw",
|
|
14
|
-
label: "智小途",
|
|
15
|
-
selectionLabel: "智小途",
|
|
16
|
-
docsPath: "/channels/openclaw-workclaw",
|
|
17
|
-
docsLabel: "智小途",
|
|
18
|
-
blurb: "智小途 OpenClaw通道",
|
|
19
|
-
aliases: [],
|
|
20
|
-
order: 90,
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* 写入文件日志到磁盘
|
|
24
|
-
* @param message 日志消息
|
|
25
|
-
*/
|
|
26
|
-
function writeFileLog(message) {
|
|
27
|
-
const timestamp = new Date().toISOString();
|
|
28
|
-
const logLine = `[${timestamp}] ${message}\n`;
|
|
29
|
-
const logDir = join(homedir(), ".openclaw", "logs");
|
|
30
|
-
const logFile = join(logDir, "sendtext-outbound.log");
|
|
31
|
-
try {
|
|
32
|
-
appendFileSync(logFile, logLine);
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
console.error(`[writeFileLog] Failed to write log: ${err}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export const workclawDock = {
|
|
39
|
-
id: "openclaw-workclaw",
|
|
40
|
-
capabilities: {
|
|
41
|
-
chatTypes: ["direct", "group"],
|
|
42
|
-
media: true,
|
|
43
|
-
blockStreaming: true,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
export const workclawPlugin = {
|
|
47
|
-
id: "openclaw-workclaw",
|
|
48
|
-
meta,
|
|
49
|
-
capabilities: {
|
|
50
|
-
chatTypes: ["direct", "group"],
|
|
51
|
-
media: true,
|
|
52
|
-
reactions: false,
|
|
53
|
-
threads: false,
|
|
54
|
-
polls: false,
|
|
55
|
-
nativeCommands: false,
|
|
56
|
-
blockStreaming: true,
|
|
57
|
-
},
|
|
58
|
-
reload: { configPrefixes: ["channels.openclaw-workclaw"] },
|
|
59
|
-
configSchema: buildChannelConfigSchema(WorkclawConfigSchema),
|
|
60
|
-
config: {
|
|
61
|
-
listAccountIds: (cfg) => listWorkclawAccountIds(cfg),
|
|
62
|
-
resolveAccount: (cfg, accountId) => resolveWorkclawAccount({ cfg: cfg, accountId }),
|
|
63
|
-
isConfigured: (account) => isWorkclawAccountConfigured(account.config),
|
|
64
|
-
describeAccount: (account) => ({
|
|
65
|
-
accountId: account.accountId,
|
|
66
|
-
name: account.name,
|
|
67
|
-
enabled: account.enabled,
|
|
68
|
-
configured: isWorkclawAccountConfigured(account.config),
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
outbound: {
|
|
72
|
-
deliveryMode: "direct",
|
|
73
|
-
chunker: (text, _limit) => [text],
|
|
74
|
-
textChunkLimit: 4096,
|
|
75
|
-
sendText: async ({ to, text, accountId, cfg, replyToId }) => {
|
|
76
|
-
writeFileLog(`outbound sendText called: replyToId=${replyToId}, accountId=${accountId}, to=${to}, text=${text.substring(0, 100)}`);
|
|
77
|
-
const result = await sendMessageWorkclaw({
|
|
78
|
-
accountId: accountId ?? undefined,
|
|
79
|
-
cfg: cfg,
|
|
80
|
-
to,
|
|
81
|
-
text,
|
|
82
|
-
...(replyToId ? { replyToMessageId: replyToId } : {}),
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
channel: "openclaw-workclaw",
|
|
86
|
-
ok: true,
|
|
87
|
-
messageId: result.messageId,
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => {
|
|
91
|
-
if (!mediaUrl && !text.trim()) {
|
|
92
|
-
throw new Error("mediaUrl is required for outbound media");
|
|
93
|
-
}
|
|
94
|
-
const log = getWorkclawRuntime().log ?? console.log;
|
|
95
|
-
if (typeof log === "function") {
|
|
96
|
-
log(`outbound sendMedia called for ${to} with text ${text} and mediaUrl ${mediaUrl}`);
|
|
97
|
-
}
|
|
98
|
-
else if (log?.info) {
|
|
99
|
-
log.info(`outbound sendMedia called for ${to} with text ${text} and mediaUrl ${mediaUrl}`);
|
|
100
|
-
}
|
|
101
|
-
const messageText = text.trim() ? text : mediaUrl ?? "";
|
|
102
|
-
const result = await sendMessageWorkclaw({
|
|
103
|
-
accountId: accountId ?? undefined,
|
|
104
|
-
cfg: cfg,
|
|
105
|
-
to,
|
|
106
|
-
text: messageText,
|
|
107
|
-
mediaUrl: mediaUrl ?? undefined,
|
|
108
|
-
});
|
|
109
|
-
return {
|
|
110
|
-
channel: "openclaw-workclaw",
|
|
111
|
-
ok: true,
|
|
112
|
-
messageId: result.messageId,
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
security: {
|
|
117
|
-
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
118
|
-
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
119
|
-
const channelConfig = cfg.channels?.["openclaw-workclaw"];
|
|
120
|
-
const useAccountPath = Boolean(channelConfig?.accounts?.[resolvedAccountId]);
|
|
121
|
-
const basePath = useAccountPath
|
|
122
|
-
? `channels.openclaw-workclaw.accounts.${resolvedAccountId}.`
|
|
123
|
-
: "channels.openclaw-workclaw.";
|
|
124
|
-
return {
|
|
125
|
-
policy: account.config.dmPolicy ?? "open",
|
|
126
|
-
allowFrom: account.config.allowFrom ?? ["*"],
|
|
127
|
-
policyPath: `${basePath}dmPolicy`,
|
|
128
|
-
allowFromPath: `${basePath}allowFrom`,
|
|
129
|
-
approveHint: formatPairingApproveHint("openclaw-workclaw"),
|
|
130
|
-
normalizeEntry: (raw) => raw.replace(/^openclaw-workclaw:/i, ""),
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
status: {
|
|
135
|
-
buildAccountSnapshot: async ({ account, cfg }) => {
|
|
136
|
-
// WebSocket 用 appKey 存储
|
|
137
|
-
const wsKey = account.config.appKey;
|
|
138
|
-
const ws = wsKey ? getWorkclawWsConnection(wsKey) : undefined;
|
|
139
|
-
const isConnected = ws && ws.readyState === 1; // WebSocket.OPEN = 1
|
|
140
|
-
const lastInboundAt = account.accountId ? getLastInboundAt(account.accountId) : undefined;
|
|
141
|
-
const lastOutboundAt = account.accountId ? getLastOutboundAt(account.accountId) : undefined;
|
|
142
|
-
return {
|
|
143
|
-
accountId: account.accountId,
|
|
144
|
-
name: account.name,
|
|
145
|
-
enabled: account.enabled,
|
|
146
|
-
configured: account.configured,
|
|
147
|
-
connected: isConnected,
|
|
148
|
-
running: account.enabled && account.configured,
|
|
149
|
-
lastInboundAt: lastInboundAt ?? null,
|
|
150
|
-
lastOutboundAt: lastOutboundAt ?? null,
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
gateway: {
|
|
155
|
-
startAccount: async (ctx) => {
|
|
156
|
-
const { setStatus, getStatus, account, accountId, cfg, log } = ctx;
|
|
157
|
-
log?.info?.(`startAccount called for ${accountId}`);
|
|
158
|
-
await startWorkclawGateway({
|
|
159
|
-
accountId,
|
|
160
|
-
account,
|
|
161
|
-
cfg,
|
|
162
|
-
log,
|
|
163
|
-
});
|
|
164
|
-
setStatus({
|
|
165
|
-
...getStatus(),
|
|
166
|
-
running: true,
|
|
167
|
-
lastStartAt: Date.now(),
|
|
168
|
-
lastError: null,
|
|
169
|
-
});
|
|
170
|
-
log?.info?.(`startAccount completed for ${accountId}, keeping pending until abort`);
|
|
171
|
-
// 保持 pending 状态直到 abortSignal 触发(防止 OpenClaw 3.8 认为启动立即退出)
|
|
172
|
-
await new Promise((resolve) => {
|
|
173
|
-
if (ctx.abortSignal.aborted) {
|
|
174
|
-
resolve();
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
ctx.abortSignal.addEventListener("abort", () => resolve(), { once: true });
|
|
178
|
-
});
|
|
179
|
-
// abort 触发后,清理资源
|
|
180
|
-
log?.info?.(`startAccount abort signal received for ${accountId}`);
|
|
181
|
-
stopWorkclawGateway(accountId);
|
|
182
|
-
setStatus({
|
|
183
|
-
...getStatus(),
|
|
184
|
-
running: false,
|
|
185
|
-
lastStopAt: Date.now(),
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
stopAccount: async (ctx) => {
|
|
189
|
-
const { setStatus, getStatus, accountId, account } = ctx;
|
|
190
|
-
// Stop WorkClaw gateway
|
|
191
|
-
stopWorkclawGateway(accountId);
|
|
192
|
-
setStatus({
|
|
193
|
-
...getStatus(),
|
|
194
|
-
running: false,
|
|
195
|
-
lastStopAt: Date.now(),
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export { z };
|
|
3
|
-
export declare const workclawAccountConfigSchema: z.ZodObject<{
|
|
4
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
-
name: z.ZodOptional<z.ZodString>;
|
|
6
|
-
agentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
7
|
-
userId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
|
-
openConversationId: z.ZodOptional<z.ZodString>;
|
|
9
|
-
dmPolicy: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
open: "open";
|
|
11
|
-
}>>;
|
|
12
|
-
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
13
|
-
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
allowInsecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
-
}, z.core.$strict>;
|
|
16
|
-
export declare const WorkclawConfigSchema: z.ZodObject<{
|
|
17
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
connectionMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
19
|
-
websocket: "websocket";
|
|
20
|
-
}>>>;
|
|
21
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
22
|
-
websocketUrl: z.ZodOptional<z.ZodString>;
|
|
23
|
-
appKey: z.ZodOptional<z.ZodString>;
|
|
24
|
-
appSecret: z.ZodOptional<z.ZodString>;
|
|
25
|
-
agentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
26
|
-
localIp: z.ZodOptional<z.ZodString>;
|
|
27
|
-
userId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
28
|
-
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
29
|
-
allowInsecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
-
allowRawJsonPayload: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
-
uploadUrl: z.ZodOptional<z.ZodString>;
|
|
32
|
-
uploadFieldName: z.ZodOptional<z.ZodString>;
|
|
33
|
-
uploadHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
|
-
uploadFormFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
35
|
-
uploadResponseUrlPath: z.ZodOptional<z.ZodString>;
|
|
36
|
-
dmPolicy: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
37
|
-
open: "open";
|
|
38
|
-
}>>>;
|
|
39
|
-
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
40
|
-
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodObject<{
|
|
42
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
-
name: z.ZodOptional<z.ZodString>;
|
|
44
|
-
agentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
45
|
-
userId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
46
|
-
openConversationId: z.ZodOptional<z.ZodString>;
|
|
47
|
-
dmPolicy: z.ZodOptional<z.ZodEnum<{
|
|
48
|
-
open: "open";
|
|
49
|
-
}>>;
|
|
50
|
-
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
51
|
-
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
52
|
-
allowInsecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
}, z.core.$strict>>>>;
|
|
54
|
-
}, z.core.$strict>;
|
|
55
|
-
export declare const workclawConfigSchema: z.ZodObject<{
|
|
56
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
-
connectionMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
websocket: "websocket";
|
|
59
|
-
}>>>;
|
|
60
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
61
|
-
websocketUrl: z.ZodOptional<z.ZodString>;
|
|
62
|
-
appKey: z.ZodOptional<z.ZodString>;
|
|
63
|
-
appSecret: z.ZodOptional<z.ZodString>;
|
|
64
|
-
agentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
65
|
-
localIp: z.ZodOptional<z.ZodString>;
|
|
66
|
-
userId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
67
|
-
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
68
|
-
allowInsecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
-
allowRawJsonPayload: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
-
uploadUrl: z.ZodOptional<z.ZodString>;
|
|
71
|
-
uploadFieldName: z.ZodOptional<z.ZodString>;
|
|
72
|
-
uploadHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
|
-
uploadFormFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
74
|
-
uploadResponseUrlPath: z.ZodOptional<z.ZodString>;
|
|
75
|
-
dmPolicy: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
76
|
-
open: "open";
|
|
77
|
-
}>>>;
|
|
78
|
-
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
79
|
-
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodObject<{
|
|
81
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
-
name: z.ZodOptional<z.ZodString>;
|
|
83
|
-
agentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
84
|
-
userId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
85
|
-
openConversationId: z.ZodOptional<z.ZodString>;
|
|
86
|
-
dmPolicy: z.ZodOptional<z.ZodEnum<{
|
|
87
|
-
open: "open";
|
|
88
|
-
}>>;
|
|
89
|
-
allowFrom: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
90
|
-
mediaMaxMb: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
allowInsecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
-
}, z.core.$strict>>>>;
|
|
93
|
-
}, z.core.$strict>;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
export declare function clearWorkclawTokenCache(cacheKey: string): void;
|
|
2
|
-
export declare function normalizeBaseUrl(value: string | undefined): string;
|
|
3
|
-
export declare function doFetchJson(url: string, init: RequestInit, allowInsecureTls?: boolean, requestTimeout?: number): Promise<any>;
|
|
4
|
-
export type WorkclawConnectionConfig = {
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
websocketUrl?: string;
|
|
7
|
-
appKey?: string;
|
|
8
|
-
appSecret?: string;
|
|
9
|
-
localIp?: string;
|
|
10
|
-
allowInsecureTls?: boolean;
|
|
11
|
-
requestTimeout?: number;
|
|
12
|
-
};
|
|
13
|
-
export declare function getWorkclawAccessToken(cacheKey: string, config: WorkclawConnectionConfig): Promise<string>;
|
|
14
|
-
export declare function openWorkclawConnection(cacheKey: string, config: WorkclawConnectionConfig): Promise<{
|
|
15
|
-
endpoint: string;
|
|
16
|
-
ticket: string;
|
|
17
|
-
}>;
|
|
18
|
-
export interface AgentInstance {
|
|
19
|
-
id: string;
|
|
20
|
-
createTime: string;
|
|
21
|
-
updateTime: string;
|
|
22
|
-
futureId: string;
|
|
23
|
-
phone: string;
|
|
24
|
-
nickName: string;
|
|
25
|
-
imageId: string;
|
|
26
|
-
level: number;
|
|
27
|
-
identity: string;
|
|
28
|
-
type: string;
|
|
29
|
-
name: string;
|
|
30
|
-
gender: string;
|
|
31
|
-
age: number | null;
|
|
32
|
-
tcId: string | null;
|
|
33
|
-
city: string | null;
|
|
34
|
-
loginType: string | null;
|
|
35
|
-
status: string;
|
|
36
|
-
publicScope: string;
|
|
37
|
-
ip: string | null;
|
|
38
|
-
phoneName: string | null;
|
|
39
|
-
tip: string | null;
|
|
40
|
-
email: string | null;
|
|
41
|
-
featureId: string | null;
|
|
42
|
-
job: string | null;
|
|
43
|
-
newUser: boolean;
|
|
44
|
-
imageKnBase: string | null;
|
|
45
|
-
recommend: string | null;
|
|
46
|
-
comment: string | null;
|
|
47
|
-
treeKnbase: string | null;
|
|
48
|
-
preferredLanguage: string;
|
|
49
|
-
timezone: string;
|
|
50
|
-
introduction: string;
|
|
51
|
-
backgroundId: string;
|
|
52
|
-
voiceId: string;
|
|
53
|
-
characterSettings: string | null;
|
|
54
|
-
personFeatures: string | null;
|
|
55
|
-
learningFeatures: string | null;
|
|
56
|
-
workFeatures: string | null;
|
|
57
|
-
socializeFeatures: string | null;
|
|
58
|
-
useKnowledge: boolean;
|
|
59
|
-
roomOnlyKnowledge: boolean;
|
|
60
|
-
roomWebSearch: boolean;
|
|
61
|
-
abilityId: string | null;
|
|
62
|
-
baiduCensoringStrategy: string | null;
|
|
63
|
-
knowledgeCheckStrategy: string | null;
|
|
64
|
-
interestTags: string | null;
|
|
65
|
-
temporaryId: string | null;
|
|
66
|
-
treeBatchNo: string | null;
|
|
67
|
-
allowJoinSpace: boolean;
|
|
68
|
-
modelId: string;
|
|
69
|
-
orgId: string | null;
|
|
70
|
-
qrCodeUrl: string | null;
|
|
71
|
-
locationPoint: {
|
|
72
|
-
x: number;
|
|
73
|
-
y: number;
|
|
74
|
-
} | null;
|
|
75
|
-
hot: string;
|
|
76
|
-
score: number;
|
|
77
|
-
professionalUser: string | null;
|
|
78
|
-
autoCreateFace: boolean;
|
|
79
|
-
liveId: string | null;
|
|
80
|
-
liveStartTime: string | null;
|
|
81
|
-
isIpAgent: number;
|
|
82
|
-
isAdopted: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 获取智能体列表
|
|
86
|
-
* POST /open-apis/instance/list
|
|
87
|
-
*/
|
|
88
|
-
export declare function getAgentInstances(cacheKey: string, config: WorkclawConnectionConfig): Promise<AgentInstance[]>;
|
|
89
|
-
export type WorkClawMessageParams = {
|
|
90
|
-
cacheKey: string;
|
|
91
|
-
config: WorkclawConnectionConfig;
|
|
92
|
-
agentId: string | number;
|
|
93
|
-
receiveId: string | number;
|
|
94
|
-
msgType: string;
|
|
95
|
-
content: string;
|
|
96
|
-
openConversationId?: string;
|
|
97
|
-
replayMsgId?: string;
|
|
98
|
-
endpoint?: string;
|
|
99
|
-
last?: boolean;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* 发送主动消息(非回复)
|
|
103
|
-
* POST /im/v1/messages
|
|
104
|
-
*/
|
|
105
|
-
export declare function sendWorkclawMessage(params: WorkClawMessageParams): Promise<string>;
|
|
106
|
-
/**
|
|
107
|
-
* 发送回复消息
|
|
108
|
-
* POST /im/v1/messages/{messageId}/reply
|
|
109
|
-
*/
|
|
110
|
-
export declare function sendWorkclawReplyMessage(params: WorkClawMessageParams & {
|
|
111
|
-
messageId: string;
|
|
112
|
-
}): Promise<string>;
|
|
113
|
-
export declare function resolveWorkclawMessage(text: string, mediaUrl?: string): {
|
|
114
|
-
msgType: string;
|
|
115
|
-
content: string;
|
|
116
|
-
};
|
|
117
|
-
export interface CronJobPayload {
|
|
118
|
-
messageId: number | string;
|
|
119
|
-
planId?: number | string;
|
|
120
|
-
clawJobId: string;
|
|
121
|
-
name: string;
|
|
122
|
-
kind: string;
|
|
123
|
-
expr: string;
|
|
124
|
-
message?: string;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 同步 openclaw 创建的定时任务至后端
|
|
128
|
-
* POST /cron/job/add
|
|
129
|
-
*/
|
|
130
|
-
export declare function syncWorkclawCronJobToBackend(cacheKey: string, config: WorkclawConnectionConfig, payload: CronJobPayload): Promise<any>;
|
|
131
|
-
/**
|
|
132
|
-
* 获取AppKey所对应的模型配置
|
|
133
|
-
* POST /open-apis/instance/apiKey/{appKey}
|
|
134
|
-
*/
|
|
135
|
-
export declare function getWorkclawModelConfigByAppKey(cacheKey: string, config: WorkclawConnectionConfig): Promise<{
|
|
136
|
-
baseUrl: string;
|
|
137
|
-
apiKey: string;
|
|
138
|
-
}>;
|
|
139
|
-
export interface CronJobMessagePayload {
|
|
140
|
-
clawJobId: string;
|
|
141
|
-
message: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 此时定时任务触发消息至后端
|
|
145
|
-
* POST /open-apis/cron/job/message
|
|
146
|
-
*/
|
|
147
|
-
export declare function sendWorkclawCronJobMessageToBackend(cacheKey: string, config: WorkclawConnectionConfig, payload: CronJobMessagePayload): Promise<any>;
|