@m1heng-clawd/feishu 0.1.9 → 0.1.10
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 +42 -28
- package/index.ts +3 -1
- package/package.json +4 -4
- package/src/bitable-tools/actions.ts +199 -0
- package/src/bitable-tools/common.ts +90 -0
- package/src/bitable-tools/meta.ts +80 -0
- package/src/bitable-tools/register.ts +195 -0
- package/src/bitable-tools/schemas.ts +221 -0
- package/src/bitable.ts +1 -441
- package/src/bot.ts +129 -67
- package/src/channel.ts +6 -8
- package/src/config-schema.ts +7 -0
- package/src/dedup.ts +31 -0
- package/src/docx.ts +440 -62
- package/src/drive-schema.ts +20 -0
- package/src/drive.ts +84 -27
- package/src/dynamic-agent.ts +8 -4
- package/src/media.ts +25 -40
- package/src/monitor.ts +29 -2
- package/src/onboarding.ts +186 -105
- package/src/perm.ts +23 -24
- package/src/probe.ts +108 -4
- package/src/reply-dispatcher.ts +137 -73
- package/src/streaming-card.ts +211 -0
- package/src/targets.ts +1 -1
- package/src/task-tools/actions.ts +137 -0
- package/src/task-tools/common.ts +18 -0
- package/src/task-tools/register.ts +101 -0
- package/src/task-tools/schemas.ts +138 -0
- package/src/task.ts +1 -0
- package/src/tools-common/feishu-api.ts +184 -0
- package/src/tools-common/tool-context.ts +23 -0
- package/src/tools-common/tool-exec.ts +73 -0
- package/src/tools-config.ts +2 -1
- package/src/types.ts +1 -0
- package/src/wiki.ts +42 -43
package/src/types.ts
CHANGED
package/src/wiki.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
-
import { createFeishuClient } from "./client.js";
|
|
3
|
-
import { listEnabledFeishuAccounts } from "./accounts.js";
|
|
4
2
|
import type * as Lark from "@larksuiteoapi/node-sdk";
|
|
5
3
|
import { FeishuWikiSchema, type FeishuWikiParams } from "./wiki-schema.js";
|
|
6
|
-
import {
|
|
4
|
+
import { hasFeishuToolEnabledForAnyAccount, withFeishuToolClient } from "./tools-common/tool-exec.js";
|
|
7
5
|
|
|
8
6
|
// ============ Helpers ============
|
|
9
7
|
|
|
@@ -155,21 +153,16 @@ export function registerFeishuWikiTools(api: OpenClawPluginApi) {
|
|
|
155
153
|
return;
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
|
|
159
|
-
if (accounts.length === 0) {
|
|
156
|
+
if (!hasFeishuToolEnabledForAnyAccount(api.config)) {
|
|
160
157
|
api.logger.debug?.("feishu_wiki: No Feishu accounts configured, skipping wiki tools");
|
|
161
158
|
return;
|
|
162
159
|
}
|
|
163
160
|
|
|
164
|
-
|
|
165
|
-
const toolsCfg = resolveToolsConfig(firstAccount.config.tools);
|
|
166
|
-
if (!toolsCfg.wiki) {
|
|
161
|
+
if (!hasFeishuToolEnabledForAnyAccount(api.config, "wiki")) {
|
|
167
162
|
api.logger.debug?.("feishu_wiki: wiki tool disabled in config");
|
|
168
163
|
return;
|
|
169
164
|
}
|
|
170
165
|
|
|
171
|
-
const getClient = () => createFeishuClient(firstAccount);
|
|
172
|
-
|
|
173
166
|
api.registerTool(
|
|
174
167
|
{
|
|
175
168
|
name: "feishu_wiki",
|
|
@@ -180,38 +173,44 @@ export function registerFeishuWikiTools(api: OpenClawPluginApi) {
|
|
|
180
173
|
async execute(_toolCallId, params) {
|
|
181
174
|
const p = params as FeishuWikiParams;
|
|
182
175
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
176
|
+
return await withFeishuToolClient({
|
|
177
|
+
api,
|
|
178
|
+
toolName: "feishu_wiki",
|
|
179
|
+
requiredTool: "wiki",
|
|
180
|
+
run: async ({ client }) => {
|
|
181
|
+
switch (p.action) {
|
|
182
|
+
case "spaces":
|
|
183
|
+
return json(await listSpaces(client));
|
|
184
|
+
case "nodes":
|
|
185
|
+
return json(await listNodes(client, p.space_id, p.parent_node_token));
|
|
186
|
+
case "get":
|
|
187
|
+
return json(await getNode(client, p.token));
|
|
188
|
+
case "search":
|
|
189
|
+
return json({
|
|
190
|
+
error:
|
|
191
|
+
"Search is not available. Use feishu_wiki with action: 'nodes' to browse or action: 'get' to lookup by token.",
|
|
192
|
+
});
|
|
193
|
+
case "create":
|
|
194
|
+
return json(
|
|
195
|
+
await createNode(client, p.space_id, p.title, p.obj_type, p.parent_node_token),
|
|
196
|
+
);
|
|
197
|
+
case "move":
|
|
198
|
+
return json(
|
|
199
|
+
await moveNode(
|
|
200
|
+
client,
|
|
201
|
+
p.space_id,
|
|
202
|
+
p.node_token,
|
|
203
|
+
p.target_space_id,
|
|
204
|
+
p.target_parent_token,
|
|
205
|
+
),
|
|
206
|
+
);
|
|
207
|
+
case "rename":
|
|
208
|
+
return json(await renameNode(client, p.space_id, p.node_token, p.title));
|
|
209
|
+
default:
|
|
210
|
+
return json({ error: `Unknown action: ${(p as any).action}` });
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
});
|
|
215
214
|
} catch (err) {
|
|
216
215
|
return json({ error: err instanceof Error ? err.message : String(err) });
|
|
217
216
|
}
|
|
@@ -220,5 +219,5 @@ export function registerFeishuWikiTools(api: OpenClawPluginApi) {
|
|
|
220
219
|
{ name: "feishu_wiki" },
|
|
221
220
|
);
|
|
222
221
|
|
|
223
|
-
api.logger.
|
|
222
|
+
api.logger.debug?.("feishu_wiki: Registered feishu_wiki tool");
|
|
224
223
|
}
|