@workclaw/openclaw-workclaw 1.0.23 → 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/package.json +1 -1
- package/src/gateway/workclaw-gateway.ts +8 -2
- 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/config-schema.js +0 -56
- 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/index.js +0 -33
- 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/index.js +0 -15
- 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/package.json
CHANGED
|
@@ -37,7 +37,7 @@ export interface WorkclawGatewayOptions {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export async function startWorkclawGateway(options: WorkclawGatewayOptions): Promise<void> {
|
|
40
|
-
const {
|
|
40
|
+
const { log } = options
|
|
41
41
|
|
|
42
42
|
const logger = createLogger('', log)
|
|
43
43
|
setWorkclawLoggerFromContext(logger)
|
|
@@ -168,6 +168,8 @@ async function startSharedWebSocket(options: WorkclawGatewayOptions): Promise<vo
|
|
|
168
168
|
function handleSharedMessage(appKey: string, data: string, cfg: any, logger: any): void {
|
|
169
169
|
const parsed = parseWorkClawMessage(data, logger)
|
|
170
170
|
|
|
171
|
+
logger.info?.(`Gateway received message: ${JSON.stringify(parsed)}`)
|
|
172
|
+
|
|
171
173
|
if (!parsed) {
|
|
172
174
|
logger.warn?.(`Gateway failed to parse message`)
|
|
173
175
|
return
|
|
@@ -219,10 +221,14 @@ function handleSharedMessage(appKey: string, data: string, cfg: any, logger: any
|
|
|
219
221
|
userId = String(parsed.eventData?.futureId || parsed.eventData?.userId || '')
|
|
220
222
|
agentId = String(parsed.eventData?.id || parsed.eventData?.agentId || '')
|
|
221
223
|
}
|
|
222
|
-
else if (parsed.type === 'tools_list'
|
|
224
|
+
else if (parsed.type === 'tools_list') {
|
|
223
225
|
userId = String(parsed.eventData?.userId || '')
|
|
224
226
|
agentId = String(parsed.eventData?.agentId || '')
|
|
225
227
|
}
|
|
228
|
+
else if (parsed.type === 'skills_list' || parsed.type === 'skills_event') {
|
|
229
|
+
userId = String(parsed.eventData?.data?.userId || parsed.eventData?.userId || '')
|
|
230
|
+
agentId = String(parsed.eventData?.data?.agentIds?.[0] || parsed.eventData?.data?.agentId || parsed.eventData?.agentId || '')
|
|
231
|
+
}
|
|
226
232
|
else if (parsed.type === 'init_agent') {
|
|
227
233
|
userId = String(parsed.eventData?.futureId || parsed.eventData?.userId || '')
|
|
228
234
|
agentId = String(parsed.eventData?.id || parsed.eventData?.agentId || '')
|
package/dist/api.d.ts
DELETED
package/dist/api.js
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
configSchema: import("openclaw/plugin-sdk").ChannelConfigSchema;
|
|
7
|
-
register: (api: OpenClawPluginApi) => void;
|
|
8
|
-
channelPlugin: import("openclaw/plugin-sdk").ChannelPlugin<import("./src/types.js").ResolvedWorkclawAccount>;
|
|
9
|
-
setChannelRuntime?: (runtime: import("openclaw/plugin-sdk").PluginRuntime) => void;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
package/dist/index.js
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
-
// @ts-ignore - types from openclaw 4.2, local dev uses 3.13
|
|
4
|
-
import { defineChannelPluginEntry } from "openclaw/plugin-sdk/core";
|
|
5
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { workclawPlugin } from "./src/channel.js";
|
|
9
|
-
import { setWorkclawRuntime, getWorkclawRuntime, getToolResultHint, getWorkclawLogger, } from "./src/runtime.js";
|
|
10
|
-
import { resolveWorkspaceDir, isDefaultWorkspace } from "./src/api/workspace.js";
|
|
11
|
-
import { createPromptsApiHandler } from "./src/api/prompts-api.js";
|
|
12
|
-
import { createAccountsApiHandler } from "./src/api/accounts-api.js";
|
|
13
|
-
import { createSessionApiHandler } from "./src/api/session-api.js";
|
|
14
|
-
import { createSkillsApiHandler } from "./src/api/skills-api.js";
|
|
15
|
-
import { registerAllOpenclawWorkclawCronTools } from "./src/tools/openclaw-workclaw-cron/index.js";
|
|
16
|
-
import { getToolContext, setToolCallIdToRunIdMapping, deleteToolContext, } from "./src/runtime.js";
|
|
17
|
-
import { sendMessageWorkclaw } from "./src/outbound/index.js";
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// Tool output formatting helpers
|
|
20
|
-
// ============================================================================
|
|
21
|
-
function formatToolParams(toolName, params) {
|
|
22
|
-
if (!params || typeof params !== "object") {
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
const normalizedToolName = (toolName || "").toLowerCase().trim();
|
|
26
|
-
const p = params;
|
|
27
|
-
try {
|
|
28
|
-
if (normalizedToolName === "exec" || normalizedToolName === "bash" || normalizedToolName === "shell") {
|
|
29
|
-
const cmd = p.command || p.cmd;
|
|
30
|
-
if (cmd)
|
|
31
|
-
return `command: ${String(cmd).slice(0, 200)}`;
|
|
32
|
-
}
|
|
33
|
-
else if (normalizedToolName === "read" ||
|
|
34
|
-
normalizedToolName === "file_read" ||
|
|
35
|
-
normalizedToolName === "view") {
|
|
36
|
-
const p2 = p.path;
|
|
37
|
-
if (p2)
|
|
38
|
-
return `path: ${p2}`;
|
|
39
|
-
}
|
|
40
|
-
else if (normalizedToolName === "write" ||
|
|
41
|
-
normalizedToolName === "file_write" ||
|
|
42
|
-
normalizedToolName === "edit" ||
|
|
43
|
-
normalizedToolName === "patch") {
|
|
44
|
-
const p2 = p.path;
|
|
45
|
-
if (p2)
|
|
46
|
-
return `path: ${p2}`;
|
|
47
|
-
}
|
|
48
|
-
else if (normalizedToolName === "web_fetch" ||
|
|
49
|
-
normalizedToolName === "fetch" ||
|
|
50
|
-
normalizedToolName === "http_get" ||
|
|
51
|
-
normalizedToolName === "http_request" ||
|
|
52
|
-
normalizedToolName === "open_url" ||
|
|
53
|
-
normalizedToolName === "browser_open" ||
|
|
54
|
-
normalizedToolName === "open") {
|
|
55
|
-
const u = p.url;
|
|
56
|
-
if (u)
|
|
57
|
-
return `url: ${u}`;
|
|
58
|
-
}
|
|
59
|
-
else if (normalizedToolName === "search" ||
|
|
60
|
-
normalizedToolName === "web_search" ||
|
|
61
|
-
normalizedToolName === "google_search" ||
|
|
62
|
-
normalizedToolName === "browser_search" ||
|
|
63
|
-
normalizedToolName === "browser.search") {
|
|
64
|
-
const q = p.query || p.q || p.search;
|
|
65
|
-
if (q)
|
|
66
|
-
return `query: ${q}`;
|
|
67
|
-
}
|
|
68
|
-
else if (normalizedToolName === "image_generate" ||
|
|
69
|
-
normalizedToolName === "generate_image" ||
|
|
70
|
-
normalizedToolName === "dalle" ||
|
|
71
|
-
normalizedToolName === "text_to_image") {
|
|
72
|
-
const prompt = p.prompt;
|
|
73
|
-
if (prompt)
|
|
74
|
-
return `prompt: ${String(prompt).slice(0, 200)}`;
|
|
75
|
-
}
|
|
76
|
-
else if (normalizedToolName === "code_interpreter" ||
|
|
77
|
-
normalizedToolName === "python" ||
|
|
78
|
-
normalizedToolName === "jupyter") {
|
|
79
|
-
const code = p.code;
|
|
80
|
-
if (code)
|
|
81
|
-
return `code: ${String(code).slice(0, 200)}`;
|
|
82
|
-
}
|
|
83
|
-
else if (normalizedToolName === "mcp_deliver" || normalizedToolName === "deliver") {
|
|
84
|
-
const target = p.target || p.to;
|
|
85
|
-
if (target)
|
|
86
|
-
return `target: ${target}`;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
const entries = Object.entries(p);
|
|
90
|
-
if (entries.length > 0) {
|
|
91
|
-
return entries
|
|
92
|
-
.map(([k, v]) => {
|
|
93
|
-
const vStr = typeof v === "string" ? v : JSON.stringify(v);
|
|
94
|
-
return vStr.length > 100 ? `${k}: ${vStr.slice(0, 100)}...` : `${k}: ${vStr}`;
|
|
95
|
-
})
|
|
96
|
-
.join("\n");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
return String(params);
|
|
102
|
-
}
|
|
103
|
-
return "";
|
|
104
|
-
}
|
|
105
|
-
function formatToolOutput(toolName, params, _result) {
|
|
106
|
-
return formatToolParams(toolName, params);
|
|
107
|
-
}
|
|
108
|
-
// ============================================================================
|
|
109
|
-
// Tool hooks
|
|
110
|
-
// ============================================================================
|
|
111
|
-
function registerToolHooks(api) {
|
|
112
|
-
api.on("agent_end", (event, ctx) => {
|
|
113
|
-
const { runId } = ctx || {};
|
|
114
|
-
if (runId) {
|
|
115
|
-
deleteToolContext(runId);
|
|
116
|
-
api.logger?.info?.(`[ToolHook] agent_end runId=${runId} cleaned up`);
|
|
117
|
-
}
|
|
118
|
-
return event;
|
|
119
|
-
});
|
|
120
|
-
api.on("before_tool_call", (event, _ctx) => {
|
|
121
|
-
api.logger?.info?.(`[ToolHook] before_tool_call event=${JSON.stringify(event)}`);
|
|
122
|
-
});
|
|
123
|
-
api.on("after_tool_call", (event, _ctx) => {
|
|
124
|
-
api.logger?.info?.(`[ToolHook] after_tool_call event=${JSON.stringify(event)}`);
|
|
125
|
-
const { runId, toolCallId, toolName, params, result } = event || {};
|
|
126
|
-
const toolCtx = runId ? getToolContext(runId) : undefined;
|
|
127
|
-
if (toolCtx && result) {
|
|
128
|
-
const content = formatToolOutput(toolName, params, result);
|
|
129
|
-
if (content) {
|
|
130
|
-
try {
|
|
131
|
-
const cfg = getWorkclawRuntime().config.loadConfig();
|
|
132
|
-
const formattedToolOutput = {
|
|
133
|
-
name: getToolResultHint(toolName),
|
|
134
|
-
toolName: toolName,
|
|
135
|
-
content: content,
|
|
136
|
-
state: "result",
|
|
137
|
-
};
|
|
138
|
-
sendMessageWorkclaw({
|
|
139
|
-
cfg,
|
|
140
|
-
to: toolCtx.target,
|
|
141
|
-
text: JSON.stringify(formattedToolOutput),
|
|
142
|
-
msgType: "26",
|
|
143
|
-
accountId: toolCtx.accountId,
|
|
144
|
-
openConversationId: toolCtx.openConversationId,
|
|
145
|
-
agentId: toolCtx.agentId,
|
|
146
|
-
replyToMessageId: toolCtx.replyToMessageId,
|
|
147
|
-
}).catch((err) => {
|
|
148
|
-
api.logger?.error?.(`[ToolHook] after_tool_call push failed: ${err}`);
|
|
149
|
-
});
|
|
150
|
-
api.logger?.info?.(`[ToolHook] after_tool_call pushed for toolName=${toolName}`);
|
|
151
|
-
}
|
|
152
|
-
catch (err) {
|
|
153
|
-
api.logger?.error?.(`[ToolHook] after_tool_call push failed: ${err}`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (runId && toolCallId) {
|
|
158
|
-
setToolCallIdToRunIdMapping(toolCallId, runId);
|
|
159
|
-
}
|
|
160
|
-
return event;
|
|
161
|
-
});
|
|
162
|
-
api.on("tool_result_persist", (event, _ctx) => {
|
|
163
|
-
return { message: event.message };
|
|
164
|
-
});
|
|
165
|
-
api.logger?.info?.(`[ToolHook] Tool execution hooks registered`);
|
|
166
|
-
}
|
|
167
|
-
// ============================================================================
|
|
168
|
-
// Templates
|
|
169
|
-
// ============================================================================
|
|
170
|
-
const templateNames = ["SOUL.md", "IDENTITY.md"];
|
|
171
|
-
/**
|
|
172
|
-
* 获取插件所在目录,兼容 Windows 下的 file:// URL 问题。
|
|
173
|
-
* 4.2 的插件加载器在 Windows 上可能传入不带协议前缀的路径。
|
|
174
|
-
*/
|
|
175
|
-
function getPluginDir() {
|
|
176
|
-
try {
|
|
177
|
-
const url = import.meta.url;
|
|
178
|
-
if (!url.startsWith("file://")) {
|
|
179
|
-
// Windows 路径被直接传入(不带 file:// 前缀),直接取目录
|
|
180
|
-
return path.dirname(url);
|
|
181
|
-
}
|
|
182
|
-
return path.dirname(fileURLToPath(url));
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
return process.cwd();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async function writeFileIfMissing(filePath, content) {
|
|
189
|
-
try {
|
|
190
|
-
await writeFile(filePath, content, { encoding: "utf-8", flag: "wx" });
|
|
191
|
-
}
|
|
192
|
-
catch (error) {
|
|
193
|
-
if (error &&
|
|
194
|
-
typeof error === "object" &&
|
|
195
|
-
"code" in error &&
|
|
196
|
-
error.code === "EEXIST") {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
async function releaseTemplates(api) {
|
|
203
|
-
const workspaceDir = resolveWorkspaceDir(api);
|
|
204
|
-
getWorkclawLogger().info(`workspaceDir: ${workspaceDir}`);
|
|
205
|
-
// 模板文件在根目录的 templates/ 中,而不是 dist/templates/
|
|
206
|
-
const currentDir = getPluginDir();
|
|
207
|
-
const templatesDir = path.join(currentDir.endsWith("dist") ? path.dirname(currentDir) : currentDir, "templates");
|
|
208
|
-
const shouldOverwrite = isDefaultWorkspace(api);
|
|
209
|
-
await mkdir(workspaceDir, { recursive: true });
|
|
210
|
-
await Promise.all(templateNames.map(async (name) => {
|
|
211
|
-
const sourcePath = path.join(templatesDir, name);
|
|
212
|
-
const targetPath = path.join(workspaceDir, name);
|
|
213
|
-
const content = await readFile(sourcePath, "utf-8");
|
|
214
|
-
if (shouldOverwrite) {
|
|
215
|
-
await writeFile(targetPath, content, { encoding: "utf-8" });
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
await writeFileIfMissing(targetPath, content);
|
|
219
|
-
}
|
|
220
|
-
}));
|
|
221
|
-
api.logger.info(`openclaw-workclaw templates ready: ${workspaceDir}`);
|
|
222
|
-
}
|
|
223
|
-
// ============================================================================
|
|
224
|
-
// Plugin entry point
|
|
225
|
-
// ============================================================================
|
|
226
|
-
export default defineChannelPluginEntry({
|
|
227
|
-
id: "openclaw-workclaw",
|
|
228
|
-
name: "openclaw-workclaw",
|
|
229
|
-
description: "智小途 channel plugin",
|
|
230
|
-
configSchema: emptyPluginConfigSchema(),
|
|
231
|
-
plugin: workclawPlugin,
|
|
232
|
-
registerFull(api) {
|
|
233
|
-
setWorkclawRuntime(api.runtime);
|
|
234
|
-
registerAllOpenclawWorkclawCronTools(api);
|
|
235
|
-
registerToolHooks(api);
|
|
236
|
-
api.registerService({
|
|
237
|
-
id: "openclaw-workclaw-templates",
|
|
238
|
-
start: async () => {
|
|
239
|
-
await releaseTemplates(api);
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
api.registerHttpRoute({
|
|
243
|
-
path: "/openclaw-workclaw/workspace/prompts",
|
|
244
|
-
handler: createPromptsApiHandler(api),
|
|
245
|
-
auth: "plugin",
|
|
246
|
-
});
|
|
247
|
-
api.registerHttpRoute({
|
|
248
|
-
path: "/openclaw-workclaw/accounts",
|
|
249
|
-
handler: createAccountsApiHandler(api),
|
|
250
|
-
auth: "plugin",
|
|
251
|
-
});
|
|
252
|
-
api.registerHttpRoute({
|
|
253
|
-
path: "/openclaw-workclaw/skills",
|
|
254
|
-
handler: createSkillsApiHandler(api),
|
|
255
|
-
auth: "plugin",
|
|
256
|
-
});
|
|
257
|
-
api.registerHttpRoute({
|
|
258
|
-
path: "/openclaw-workclaw/sessions",
|
|
259
|
-
handler: createSessionApiHandler(api),
|
|
260
|
-
auth: "plugin",
|
|
261
|
-
match: "prefix",
|
|
262
|
-
});
|
|
263
|
-
},
|
|
264
|
-
});
|
package/dist/setup-entry.d.ts
DELETED
package/dist/setup-entry.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
2
|
-
export default defineBundledChannelSetupEntry({
|
|
3
|
-
importMetaUrl: import.meta.url,
|
|
4
|
-
plugin: {
|
|
5
|
-
specifier: "./api.js",
|
|
6
|
-
exportName: "workclawPlugin",
|
|
7
|
-
},
|
|
8
|
-
secrets: {
|
|
9
|
-
specifier: "./src/secret-contract-api.js",
|
|
10
|
-
exportName: "channelSecrets",
|
|
11
|
-
},
|
|
12
|
-
});
|
package/dist/src/accounts.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { OpenClawConfig } from 'openclaw/plugin-sdk';
|
|
2
|
-
import type { ResolvedWorkclawAccount, WorkclawConfig } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Normalize account ID by trimming whitespace
|
|
5
|
-
*/
|
|
6
|
-
export declare function normalizeAccountId(accountId: string | null | undefined): string;
|
|
7
|
-
/**
|
|
8
|
-
* Build the lookup cache from existing accounts in cfg.
|
|
9
|
-
* Called once at gateway startup.
|
|
10
|
-
*/
|
|
11
|
-
export declare function buildAccountMap(cfg: OpenClawConfig): void;
|
|
12
|
-
/**
|
|
13
|
-
* Resolve accountId by userId + agentId.
|
|
14
|
-
* First checks cache, then falls back to iteration.
|
|
15
|
-
*/
|
|
16
|
-
export declare function resolveAccountByUserIdAndAgentId(cfg: OpenClawConfig, userId: string, agentId: string): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Allocate a new workspace-N accountId and register it in the map.
|
|
19
|
-
*/
|
|
20
|
-
export declare function allocateWorkerAccountId(_cfg: OpenClawConfig, userId: string, agentId: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Refresh the cache when an account's userId or agentId changes.
|
|
23
|
-
*/
|
|
24
|
-
export declare function refreshAccountCache(cfg: OpenClawConfig): void;
|
|
25
|
-
/**
|
|
26
|
-
* List all account IDs.
|
|
27
|
-
* If no accounts are configured but plugin has workclaw config, returns [DEFAULT_ACCOUNT_ID].
|
|
28
|
-
*/
|
|
29
|
-
export declare function listWorkclawAccountIds(cfg: OpenClawConfig): string[];
|
|
30
|
-
/**
|
|
31
|
-
* Resolve the default account ID.
|
|
32
|
-
*/
|
|
33
|
-
export declare function resolveDefaultWorkclawAccountId(cfg: OpenClawConfig): string;
|
|
34
|
-
export declare function isWorkclawAccountConfigured(config: {
|
|
35
|
-
appKey?: string;
|
|
36
|
-
appSecret?: string;
|
|
37
|
-
agentId?: string | number;
|
|
38
|
-
}): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Resolve a complete account with merged config.
|
|
41
|
-
*/
|
|
42
|
-
export declare function resolveWorkclawAccount(params: {
|
|
43
|
-
cfg: OpenClawConfig;
|
|
44
|
-
accountId?: string | null;
|
|
45
|
-
}): ResolvedWorkclawAccount;
|
|
46
|
-
/**
|
|
47
|
-
* List all enabled and configured accounts.
|
|
48
|
-
*/
|
|
49
|
-
export declare function listEnabledWorkclawAccounts(cfg: OpenClawConfig): ResolvedWorkclawAccount[];
|
|
50
|
-
/**
|
|
51
|
-
* Resolve account and apply cached connection config if available.
|
|
52
|
-
* This ensures that appKey/appSecret etc. use the stable values captured at connection time,
|
|
53
|
-
* not potentially mutated values from cfg at resolution time.
|
|
54
|
-
*/
|
|
55
|
-
export declare function resolveWorkclawAccountWithCache(params: {
|
|
56
|
-
cfg: OpenClawConfig;
|
|
57
|
-
accountId?: string | null;
|
|
58
|
-
}): ResolvedWorkclawAccount;
|
|
59
|
-
/**
|
|
60
|
-
* Inspect and probe workclaw credentials.
|
|
61
|
-
* Returns a function that can be called to test the connection.
|
|
62
|
-
*/
|
|
63
|
-
export declare function inspectWorkclawCredentials(workclawCfg?: WorkclawConfig): (() => Promise<{
|
|
64
|
-
ok: boolean;
|
|
65
|
-
botName?: string;
|
|
66
|
-
}>) | null;
|