@openclaw/feishu 2026.7.2-beta.7 → 2026.8.1-beta.3
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/dist/accounts-CCCdMen2.js +203 -0
- package/dist/api.js +61 -60
- package/dist/{channel-CScE82zY.js → channel-Ceq80_zP.js} +71 -42
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-B21e1E0r.js → channel.runtime-DnRyzGoU.js} +201 -152
- package/dist/{client-Dcbs6vml.js → client-Hp7uo_cl.js} +27 -16
- package/dist/contract-api.js +2 -2
- package/dist/{conversation-id-BeJL-wq7.js → conversation-id-VYgGQ-GX.js} +11 -15
- package/dist/doctor-contract-api.js +1 -1
- package/dist/doctor-contract-bEQXIXyP.js +158 -0
- package/dist/{drive-hSi_Utp0.js → drive-BVYM_Y4k.js} +325 -44
- package/dist/{media-CEUraFOR.js → media-BDouVaaM.js} +298 -182
- package/dist/{monitor-DngbaA6a.js → monitor-CZ8cDXrq.js} +3 -3
- package/dist/{monitor.account-BnTWCw55.js → monitor.account-Dq_voVMB.js} +263 -179
- package/dist/{monitor.startup-CqH2tiJq.js → monitor.startup-BGErejNH.js} +1 -1
- package/dist/{probe-p3POS2RN.js → probe-DVpy58s0.js} +2 -2
- package/dist/security-audit-D6Fz2h6p.js +23 -0
- package/dist/{send-result-B9_BpUPx.js → send-result-DEAycmOk.js} +18 -9
- package/dist/session-binding-contract-api.js +2 -2
- package/dist/{session-conversation-BksWrfzm.js → session-conversation-DFCIvQK-.js} +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/{subagent-hooks-Cx1cX7rW.js → subagent-hooks-KUi-7vUy.js} +4 -64
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{thread-bindings-N3wkgkIN.js → thread-bindings-CptM_YU6.js} +7 -9
- package/openclaw.plugin.json +143 -1
- package/package.json +4 -4
- package/skills/feishu-doc/SKILL.md +20 -195
- package/skills/feishu-doc/references/block-types.md +9 -14
- package/skills/feishu-drive/SKILL.md +16 -102
- package/skills/feishu-perm/SKILL.md +10 -110
- package/skills/feishu-wiki/SKILL.md +13 -109
- package/dist/accounts-u9X5Wsan.js +0 -469
- package/dist/doctor-contract-BiD9tyIv.js +0 -102
- package/dist/security-audit-D7WK_BHh.js +0 -11
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, hasConfiguredAccountValue, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
4
|
+
import { coerceSecretRef } from "openclaw/plugin-sdk/provider-auth";
|
|
5
|
+
//#region extensions/feishu/src/accounts.ts
|
|
6
|
+
var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
FeishuSecretRefUnavailableError: () => FeishuSecretRefUnavailableError,
|
|
8
|
+
inspectFeishuCredentials: () => inspectFeishuCredentials,
|
|
9
|
+
listEnabledFeishuAccounts: () => listEnabledFeishuAccounts,
|
|
10
|
+
listFeishuAccountIds: () => listFeishuAccountIds,
|
|
11
|
+
resolveDefaultFeishuAccountId: () => resolveDefaultFeishuAccountId,
|
|
12
|
+
resolveDefaultFeishuAccountSelection: () => resolveDefaultFeishuAccountSelection,
|
|
13
|
+
resolveFeishuAccount: () => resolveFeishuAccount,
|
|
14
|
+
resolveFeishuCredentials: () => resolveFeishuCredentials,
|
|
15
|
+
resolveFeishuRuntimeAccount: () => resolveFeishuRuntimeAccount
|
|
16
|
+
});
|
|
17
|
+
const { listAccountIds: listFeishuAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMergedFeishuAccountConfig } = createAccountListHelpers("feishu", {
|
|
18
|
+
allowUnlistedDefaultAccount: true,
|
|
19
|
+
omitKeys: ["defaultAccount"],
|
|
20
|
+
nestedObjectKeys: ["tools"],
|
|
21
|
+
hasImplicitDefaultAccount: (cfg) => {
|
|
22
|
+
const feishu = cfg.channels?.feishu;
|
|
23
|
+
return hasConfiguredAccountValue(feishu?.appId) && hasConfiguredAccountValue(feishu?.appSecret);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
function formatSecretRefLabel(ref) {
|
|
27
|
+
return `${ref.source}:${ref.provider}:${ref.id}`;
|
|
28
|
+
}
|
|
29
|
+
var FeishuSecretRefUnavailableError = class extends Error {
|
|
30
|
+
constructor(path, ref) {
|
|
31
|
+
super(`${path}: unresolved SecretRef "${formatSecretRefLabel(ref)}". Resolve this command against an active gateway runtime snapshot before reading it.`);
|
|
32
|
+
this.name = "FeishuSecretRefUnavailableError";
|
|
33
|
+
this.path = path;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function resolveFeishuSecretLike(params) {
|
|
37
|
+
const asString = normalizeOptionalString(params.value);
|
|
38
|
+
if (asString) return asString;
|
|
39
|
+
const ref = coerceSecretRef(params.value);
|
|
40
|
+
if (!ref) return;
|
|
41
|
+
if (params.mode === "inspect") {
|
|
42
|
+
if (params.allowEnvSecretRefRead && ref.source === "env") {
|
|
43
|
+
const envValue = normalizeOptionalString(process.env[ref.id]);
|
|
44
|
+
if (envValue) return envValue;
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
throw new FeishuSecretRefUnavailableError(params.path, ref);
|
|
49
|
+
}
|
|
50
|
+
function resolveFeishuBaseCredentials(cfg, mode) {
|
|
51
|
+
const appId = resolveFeishuSecretLike({
|
|
52
|
+
value: cfg?.appId,
|
|
53
|
+
path: "channels.feishu.appId",
|
|
54
|
+
mode,
|
|
55
|
+
allowEnvSecretRefRead: true
|
|
56
|
+
});
|
|
57
|
+
const appSecret = resolveFeishuSecretLike({
|
|
58
|
+
value: cfg?.appSecret,
|
|
59
|
+
path: "channels.feishu.appSecret",
|
|
60
|
+
mode,
|
|
61
|
+
allowEnvSecretRefRead: true
|
|
62
|
+
});
|
|
63
|
+
if (!appId || !appSecret) return null;
|
|
64
|
+
return {
|
|
65
|
+
appId,
|
|
66
|
+
appSecret,
|
|
67
|
+
domain: cfg?.domain ?? "feishu"
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function resolveFeishuEventSecrets(cfg, mode) {
|
|
71
|
+
return {
|
|
72
|
+
encryptKey: (cfg?.connectionMode ?? "websocket") === "webhook" ? resolveFeishuSecretLike({
|
|
73
|
+
value: cfg?.encryptKey,
|
|
74
|
+
path: "channels.feishu.encryptKey",
|
|
75
|
+
mode,
|
|
76
|
+
allowEnvSecretRefRead: true
|
|
77
|
+
}) : normalizeOptionalString(cfg?.encryptKey),
|
|
78
|
+
verificationToken: resolveFeishuSecretLike({
|
|
79
|
+
value: cfg?.verificationToken,
|
|
80
|
+
path: "channels.feishu.verificationToken",
|
|
81
|
+
mode,
|
|
82
|
+
allowEnvSecretRefRead: true
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the default account selection and its source.
|
|
88
|
+
*/
|
|
89
|
+
function resolveDefaultFeishuAccountSelection(cfg) {
|
|
90
|
+
const preferred = normalizeOptionalAccountId((cfg.channels?.feishu)?.defaultAccount);
|
|
91
|
+
if (preferred) return {
|
|
92
|
+
accountId: preferred,
|
|
93
|
+
source: "explicit-default"
|
|
94
|
+
};
|
|
95
|
+
const ids = listFeishuAccountIds(cfg);
|
|
96
|
+
if (ids.includes(DEFAULT_ACCOUNT_ID)) return {
|
|
97
|
+
accountId: DEFAULT_ACCOUNT_ID,
|
|
98
|
+
source: "mapped-default"
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
accountId: ids[0] ?? DEFAULT_ACCOUNT_ID,
|
|
102
|
+
source: "fallback"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Resolve the default account ID.
|
|
107
|
+
*/
|
|
108
|
+
function resolveDefaultFeishuAccountId(cfg) {
|
|
109
|
+
return resolveDefaultAccountId(cfg);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Merge top-level config with account-specific config.
|
|
113
|
+
* Account-specific fields override top-level fields.
|
|
114
|
+
*/
|
|
115
|
+
function mergeFeishuAccountConfig(cfg, accountId) {
|
|
116
|
+
const feishuCfg = cfg.channels?.feishu;
|
|
117
|
+
const merged = resolveMergedFeishuAccountConfig(cfg, accountId);
|
|
118
|
+
const topTools = feishuCfg?.tools;
|
|
119
|
+
if (merged.tools === void 0 && topTools !== void 0) return {
|
|
120
|
+
...merged,
|
|
121
|
+
tools: topTools
|
|
122
|
+
};
|
|
123
|
+
if (topTools?.bitable === false) return {
|
|
124
|
+
...merged,
|
|
125
|
+
tools: {
|
|
126
|
+
...merged.tools,
|
|
127
|
+
bitable: false
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return merged;
|
|
131
|
+
}
|
|
132
|
+
function resolveFeishuCredentials(cfg, options) {
|
|
133
|
+
const mode = options?.mode ?? (options?.allowUnresolvedSecretRef ? "inspect" : "strict");
|
|
134
|
+
const base = resolveFeishuBaseCredentials(cfg, mode);
|
|
135
|
+
if (!base) return null;
|
|
136
|
+
const eventSecrets = resolveFeishuEventSecrets(cfg, mode);
|
|
137
|
+
return {
|
|
138
|
+
...base,
|
|
139
|
+
...eventSecrets
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function inspectFeishuCredentials(cfg) {
|
|
143
|
+
return resolveFeishuCredentials(cfg, { mode: "inspect" });
|
|
144
|
+
}
|
|
145
|
+
function buildResolvedFeishuAccount(params) {
|
|
146
|
+
const hasExplicitAccountId = typeof params.accountId === "string" && params.accountId.trim() !== "";
|
|
147
|
+
const defaultSelection = hasExplicitAccountId ? null : resolveDefaultFeishuAccountSelection(params.cfg);
|
|
148
|
+
const accountId = hasExplicitAccountId ? normalizeAccountId(params.accountId) : defaultSelection?.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
149
|
+
const selectionSource = hasExplicitAccountId ? "explicit" : defaultSelection?.source ?? "fallback";
|
|
150
|
+
const baseEnabled = (params.cfg.channels?.feishu)?.enabled !== false;
|
|
151
|
+
const merged = mergeFeishuAccountConfig(params.cfg, accountId);
|
|
152
|
+
const accountEnabled = merged.enabled !== false;
|
|
153
|
+
const enabled = baseEnabled && accountEnabled;
|
|
154
|
+
const baseCreds = resolveFeishuBaseCredentials(merged, params.baseMode);
|
|
155
|
+
const eventSecrets = resolveFeishuEventSecrets(merged, params.eventSecretMode);
|
|
156
|
+
const accountName = merged.name;
|
|
157
|
+
return {
|
|
158
|
+
accountId,
|
|
159
|
+
selectionSource,
|
|
160
|
+
enabled,
|
|
161
|
+
configured: Boolean(baseCreds),
|
|
162
|
+
name: typeof accountName === "string" ? accountName.trim() || void 0 : void 0,
|
|
163
|
+
appId: baseCreds?.appId,
|
|
164
|
+
appSecret: baseCreds?.appSecret,
|
|
165
|
+
encryptKey: eventSecrets.encryptKey,
|
|
166
|
+
verificationToken: eventSecrets.verificationToken,
|
|
167
|
+
domain: baseCreds?.domain ?? "feishu",
|
|
168
|
+
config: merged
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Resolve a read-only Feishu account snapshot for CLI/config surfaces.
|
|
173
|
+
* Unresolved SecretRefs are treated as unavailable instead of throwing.
|
|
174
|
+
*/
|
|
175
|
+
function resolveFeishuAccount(params) {
|
|
176
|
+
return buildResolvedFeishuAccount({
|
|
177
|
+
...params,
|
|
178
|
+
baseMode: "inspect",
|
|
179
|
+
eventSecretMode: "inspect"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resolve a runtime Feishu account.
|
|
184
|
+
* Required app credentials stay strict; event-only secrets can be required by callers.
|
|
185
|
+
*/
|
|
186
|
+
function resolveFeishuRuntimeAccount(params, options) {
|
|
187
|
+
return buildResolvedFeishuAccount({
|
|
188
|
+
...params,
|
|
189
|
+
baseMode: "strict",
|
|
190
|
+
eventSecretMode: options?.requireEventSecrets ? "strict" : "inspect"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List all enabled and configured accounts.
|
|
195
|
+
*/
|
|
196
|
+
function listEnabledFeishuAccounts(cfg) {
|
|
197
|
+
return listFeishuAccountIds(cfg).map((accountId) => resolveFeishuAccount({
|
|
198
|
+
cfg,
|
|
199
|
+
accountId
|
|
200
|
+
})).filter((account) => account.enabled && account.configured);
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { resolveDefaultFeishuAccountId as a, listFeishuAccountIds as i, inspectFeishuCredentials as n, resolveFeishuAccount as o, listEnabledFeishuAccounts as r, resolveFeishuRuntimeAccount as s, accounts_exports as t };
|
package/dist/api.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { r as listEnabledFeishuAccounts } from "./accounts-
|
|
2
|
-
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-
|
|
3
|
-
import { p as parseFeishuMarkdown, u as chunkFeishuMarkdown } from "./send-result-
|
|
4
|
-
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-
|
|
5
|
-
import {
|
|
1
|
+
import { r as listEnabledFeishuAccounts } from "./accounts-CCCdMen2.js";
|
|
2
|
+
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-Ceq80_zP.js";
|
|
3
|
+
import { p as parseFeishuMarkdown, u as chunkFeishuMarkdown } from "./send-result-DEAycmOk.js";
|
|
4
|
+
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-VYgGQ-GX.js";
|
|
5
|
+
import { s as resolveConfiguredHttpTimeoutMs } from "./client-Hp7uo_cl.js";
|
|
6
6
|
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
|
|
7
|
-
import {
|
|
8
|
-
import { n as getFeishuThreadBindingManager,
|
|
9
|
-
import { n as handleFeishuSubagentEnded,
|
|
7
|
+
import { C as resolveFeishuToolAccount, S as resolveAnyEnabledFeishuToolsConfig, b as unknownToolActionResult, n as registerFeishuDriveTools, u as registerFeishuChatTools, v as feishuExternalToolResult, x as createFeishuToolClient, y as toolExecutionErrorResult } from "./drive-BVYM_Y4k.js";
|
|
8
|
+
import { n as getFeishuThreadBindingManager, t as createFeishuThreadBindingManager } from "./thread-bindings-CptM_YU6.js";
|
|
9
|
+
import { n as handleFeishuSubagentEnded, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-KUi-7vUy.js";
|
|
10
10
|
import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
11
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
12
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
13
|
import { existsSync } from "node:fs";
|
|
13
14
|
import { homedir } from "node:os";
|
|
14
15
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
15
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
16
|
-
import { jsonResult } from "openclaw/plugin-sdk/tool-results";
|
|
17
16
|
import { Type } from "typebox";
|
|
18
17
|
import { canonicalizeBase64, estimateBase64DecodedBytes, extensionForMime } from "openclaw/plugin-sdk/media-runtime";
|
|
19
18
|
import { readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
|
|
@@ -1584,42 +1583,43 @@ function registerFeishuDocTools(api) {
|
|
|
1584
1583
|
const trustedRequesterOpenId = ctx.messageChannel === "feishu" ? normalizeOptionalString(ctx.requesterSenderId) : void 0;
|
|
1585
1584
|
return {
|
|
1586
1585
|
name: "feishu_doc",
|
|
1586
|
+
resultContentSource: "network",
|
|
1587
1587
|
label: "Feishu Doc",
|
|
1588
1588
|
description: "Feishu document operations. Actions: read, write, append, insert, create, list_blocks, get_block, update_block, delete_block, create_table, write_table_cells, create_table_with_values, insert_table_row, insert_table_column, delete_table_rows, delete_table_columns, merge_table_cells, upload_image, upload_file, color_text",
|
|
1589
1589
|
parameters: FeishuDocSchema,
|
|
1590
1590
|
async execute(_toolCallId, params) {
|
|
1591
1591
|
const p = params;
|
|
1592
1592
|
try {
|
|
1593
|
-
if (p.action === "create" && Object.hasOwn(p, "content")) return
|
|
1593
|
+
if (p.action === "create" && Object.hasOwn(p, "content")) return feishuExternalToolResult({ error: "Feishu document creation does not support content. Call action \"create\" first, then call action \"write\" with the returned document_id as doc_token." });
|
|
1594
1594
|
const client = getClient(p, defaultAccountId);
|
|
1595
1595
|
switch (p.action) {
|
|
1596
|
-
case "read": return
|
|
1597
|
-
case "write": return
|
|
1598
|
-
case "append": return
|
|
1599
|
-
case "insert": return
|
|
1600
|
-
case "create": return
|
|
1596
|
+
case "read": return feishuExternalToolResult(await readDoc(client, p.doc_token));
|
|
1597
|
+
case "write": return feishuExternalToolResult(await writeDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
|
|
1598
|
+
case "append": return feishuExternalToolResult(await appendDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
|
|
1599
|
+
case "insert": return feishuExternalToolResult(await insertDoc(client, p.doc_token, p.content, p.after_block_id, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
|
|
1600
|
+
case "create": return feishuExternalToolResult(await createDoc(client, p.title, p.folder_token, {
|
|
1601
1601
|
grantToRequester: p.grant_to_requester,
|
|
1602
1602
|
requesterOpenId: trustedRequesterOpenId
|
|
1603
1603
|
}));
|
|
1604
|
-
case "list_blocks": return
|
|
1605
|
-
case "get_block": return
|
|
1606
|
-
case "update_block": return
|
|
1607
|
-
case "delete_block": return
|
|
1608
|
-
case "create_table": return
|
|
1609
|
-
case "write_table_cells": return
|
|
1610
|
-
case "create_table_with_values": return
|
|
1611
|
-
case "upload_image": return
|
|
1612
|
-
case "upload_file": return
|
|
1613
|
-
case "color_text": return
|
|
1614
|
-
case "insert_table_row": return
|
|
1615
|
-
case "insert_table_column": return
|
|
1616
|
-
case "delete_table_rows": return
|
|
1617
|
-
case "delete_table_columns": return
|
|
1618
|
-
case "merge_table_cells": return
|
|
1619
|
-
default: return
|
|
1604
|
+
case "list_blocks": return feishuExternalToolResult(await listBlocks(client, p.doc_token));
|
|
1605
|
+
case "get_block": return feishuExternalToolResult(await getBlock(client, p.doc_token, p.block_id));
|
|
1606
|
+
case "update_block": return feishuExternalToolResult(await updateBlock(client, p.doc_token, p.block_id, p.content));
|
|
1607
|
+
case "delete_block": return feishuExternalToolResult(await deleteBlock(client, p.doc_token, p.block_id));
|
|
1608
|
+
case "create_table": return feishuExternalToolResult(await createTable(client, p.doc_token, p.row_size, p.column_size, p.parent_block_id, p.column_width));
|
|
1609
|
+
case "write_table_cells": return feishuExternalToolResult(await writeTableCells(client, p.doc_token, p.table_block_id, p.values));
|
|
1610
|
+
case "create_table_with_values": return feishuExternalToolResult(await createTableWithValues(client, p.doc_token, p.row_size, p.column_size, p.values, p.parent_block_id, p.column_width));
|
|
1611
|
+
case "upload_image": return feishuExternalToolResult(await uploadImageBlock(client, p.doc_token, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), mediaLocalRoots, p.url, p.file_path, p.parent_block_id, p.filename, p.index, p.image));
|
|
1612
|
+
case "upload_file": return feishuExternalToolResult(await uploadFileBlock(client, p.doc_token, getMediaMaxBytes(p, defaultAccountId), mediaLocalRoots, p.url, p.file_path, p.parent_block_id, p.filename));
|
|
1613
|
+
case "color_text": return feishuExternalToolResult(await updateColorText(client, p.doc_token, p.block_id, p.content));
|
|
1614
|
+
case "insert_table_row": return feishuExternalToolResult(await insertTableRow(client, p.doc_token, p.block_id, p.row_index));
|
|
1615
|
+
case "insert_table_column": return feishuExternalToolResult(await insertTableColumn(client, p.doc_token, p.block_id, p.column_index));
|
|
1616
|
+
case "delete_table_rows": return feishuExternalToolResult(await deleteTableRows(client, p.doc_token, p.block_id, p.row_start, p.row_count));
|
|
1617
|
+
case "delete_table_columns": return feishuExternalToolResult(await deleteTableColumns(client, p.doc_token, p.block_id, p.column_start, p.column_count));
|
|
1618
|
+
case "merge_table_cells": return feishuExternalToolResult(await mergeTableCells(client, p.doc_token, p.block_id, p.row_start, p.row_end, p.column_start, p.column_end));
|
|
1619
|
+
default: return feishuExternalToolResult({ error: "Unknown action" });
|
|
1620
1620
|
}
|
|
1621
1621
|
} catch (err) {
|
|
1622
|
-
return
|
|
1622
|
+
return feishuExternalToolResult({ error: formatErrorMessage(err) });
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
@@ -1629,12 +1629,13 @@ function registerFeishuDocTools(api) {
|
|
|
1629
1629
|
if (toolsCfg.scopes) {
|
|
1630
1630
|
api.registerTool((ctx) => ({
|
|
1631
1631
|
name: "feishu_app_scopes",
|
|
1632
|
+
resultContentSource: "network",
|
|
1632
1633
|
label: "Feishu App Scopes",
|
|
1633
1634
|
description: "List current app permissions (scopes). Use to debug permission issues or check available capabilities.",
|
|
1634
1635
|
parameters: Type.Object({}),
|
|
1635
1636
|
async execute() {
|
|
1636
1637
|
try {
|
|
1637
|
-
return
|
|
1638
|
+
return feishuExternalToolResult(await listAppScopes(createFeishuToolClient({
|
|
1638
1639
|
api,
|
|
1639
1640
|
defaultAccountId: ctx.agentAccountId,
|
|
1640
1641
|
requiredTool: {
|
|
@@ -1643,7 +1644,7 @@ function registerFeishuDocTools(api) {
|
|
|
1643
1644
|
}
|
|
1644
1645
|
})));
|
|
1645
1646
|
} catch (err) {
|
|
1646
|
-
return
|
|
1647
|
+
return feishuExternalToolResult({ error: formatErrorMessage(err) });
|
|
1647
1648
|
}
|
|
1648
1649
|
}
|
|
1649
1650
|
}), { name: "feishu_app_scopes" });
|
|
@@ -1843,6 +1844,7 @@ function registerFeishuWikiTools(api) {
|
|
|
1843
1844
|
const defaultAccountId = ctx.agentAccountId;
|
|
1844
1845
|
return {
|
|
1845
1846
|
name: "feishu_wiki",
|
|
1847
|
+
resultContentSource: "network",
|
|
1846
1848
|
label: "Feishu Wiki",
|
|
1847
1849
|
description: "Feishu knowledge base operations. Actions: spaces, nodes, get, create, move, rename",
|
|
1848
1850
|
parameters: FeishuWikiSchema,
|
|
@@ -1859,27 +1861,27 @@ function registerFeishuWikiTools(api) {
|
|
|
1859
1861
|
}
|
|
1860
1862
|
});
|
|
1861
1863
|
switch (p.action) {
|
|
1862
|
-
case "spaces": return
|
|
1864
|
+
case "spaces": return feishuExternalToolResult(await listSpaces(createClient(), readWikiPageSize(p), p.page_token));
|
|
1863
1865
|
case "nodes": {
|
|
1864
1866
|
const spaceId = requireWikiSpaceId(p.space_id, "space_id");
|
|
1865
|
-
return
|
|
1867
|
+
return feishuExternalToolResult(await listNodes(createClient(), spaceId, p.parent_node_token, readWikiPageSize(p), p.page_token));
|
|
1866
1868
|
}
|
|
1867
|
-
case "get": return
|
|
1869
|
+
case "get": return feishuExternalToolResult(await getNode(createClient(), p.token));
|
|
1868
1870
|
case "search":
|
|
1869
1871
|
optionalWikiSpaceId(p.space_id, "space_id");
|
|
1870
1872
|
createClient();
|
|
1871
|
-
return
|
|
1873
|
+
return feishuExternalToolResult({ error: "Search is not available. Use feishu_wiki with action: 'nodes' to browse or action: 'get' to lookup by token." });
|
|
1872
1874
|
case "create": {
|
|
1873
1875
|
const spaceId = requireWikiSpaceId(p.space_id, "space_id");
|
|
1874
|
-
return
|
|
1876
|
+
return feishuExternalToolResult(await createNode(createClient(), spaceId, p.title, p.obj_type, p.parent_node_token));
|
|
1875
1877
|
}
|
|
1876
1878
|
case "move": {
|
|
1877
1879
|
const spaceId = requireWikiSpaceId(p.space_id, "space_id");
|
|
1878
|
-
return
|
|
1880
|
+
return feishuExternalToolResult(await moveNode(createClient(), spaceId, p.node_token, optionalWikiSpaceId(p.target_space_id, "target_space_id"), p.target_parent_token));
|
|
1879
1881
|
}
|
|
1880
1882
|
case "rename": {
|
|
1881
1883
|
const spaceId = requireWikiSpaceId(p.space_id, "space_id");
|
|
1882
|
-
return
|
|
1884
|
+
return feishuExternalToolResult(await renameNode(createClient(), spaceId, p.node_token, p.title));
|
|
1883
1885
|
}
|
|
1884
1886
|
default: return unknownToolActionResult(p.action);
|
|
1885
1887
|
}
|
|
@@ -1994,6 +1996,7 @@ function registerFeishuPermTools(api) {
|
|
|
1994
1996
|
const defaultAccountId = ctx.agentAccountId;
|
|
1995
1997
|
return {
|
|
1996
1998
|
name: "feishu_perm",
|
|
1999
|
+
resultContentSource: "network",
|
|
1997
2000
|
label: "Feishu Perm",
|
|
1998
2001
|
description: "Feishu permission management. Actions: list, add, remove",
|
|
1999
2002
|
parameters: FeishuPermSchema,
|
|
@@ -2010,9 +2013,9 @@ function registerFeishuPermTools(api) {
|
|
|
2010
2013
|
}
|
|
2011
2014
|
});
|
|
2012
2015
|
switch (p.action) {
|
|
2013
|
-
case "list": return
|
|
2014
|
-
case "add": return
|
|
2015
|
-
case "remove": return
|
|
2016
|
+
case "list": return feishuExternalToolResult(await listMembers(client, p.token, p.type));
|
|
2017
|
+
case "add": return feishuExternalToolResult(await addMember(client, p.token, p.type, p.member_type, p.member_id, p.perm));
|
|
2018
|
+
case "remove": return feishuExternalToolResult(await removeMember(client, p.token, p.type, p.member_type, p.member_id));
|
|
2016
2019
|
default: return unknownToolActionResult(p.action);
|
|
2017
2020
|
}
|
|
2018
2021
|
} catch (err) {
|
|
@@ -2437,29 +2440,30 @@ function registerFeishuBitableTools(api) {
|
|
|
2437
2440
|
const accounts = listEnabledFeishuAccounts(api.config);
|
|
2438
2441
|
if (accounts.length === 0) return;
|
|
2439
2442
|
if (!resolveAnyEnabledFeishuToolsConfig(accounts).bitable) return;
|
|
2440
|
-
const getClient = (params, defaultAccountId) => {
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
};
|
|
2443
|
+
const getClient = (params, defaultAccountId) => createFeishuToolClient({
|
|
2444
|
+
api,
|
|
2445
|
+
executeParams: params,
|
|
2446
|
+
defaultAccountId,
|
|
2447
|
+
requiredTool: {
|
|
2448
|
+
family: "bitable",
|
|
2449
|
+
label: "Bitable"
|
|
2450
|
+
}
|
|
2451
|
+
});
|
|
2449
2452
|
const registerBitableTool = (params) => {
|
|
2450
2453
|
api.registerTool((ctx) => ({
|
|
2451
2454
|
name: params.name,
|
|
2455
|
+
resultContentSource: "network",
|
|
2452
2456
|
label: params.label,
|
|
2453
2457
|
description: params.description,
|
|
2454
2458
|
parameters: params.parameters,
|
|
2455
2459
|
async execute(_toolCallId, rawParams) {
|
|
2456
2460
|
try {
|
|
2457
|
-
return
|
|
2461
|
+
return feishuExternalToolResult(await params.execute({
|
|
2458
2462
|
params: rawParams,
|
|
2459
2463
|
defaultAccountId: ctx.agentAccountId
|
|
2460
2464
|
}));
|
|
2461
2465
|
} catch (err) {
|
|
2462
|
-
return
|
|
2466
|
+
return feishuExternalToolResult({ error: formatErrorMessage(err) });
|
|
2463
2467
|
}
|
|
2464
2468
|
}
|
|
2465
2469
|
}), { name: params.name });
|
|
@@ -2541,7 +2545,4 @@ function registerFeishuBitableTools(api) {
|
|
|
2541
2545
|
});
|
|
2542
2546
|
}
|
|
2543
2547
|
//#endregion
|
|
2544
|
-
|
|
2545
|
-
const feishuSessionBindingAdapterChannels = ["feishu"];
|
|
2546
|
-
//#endregion
|
|
2547
|
-
export { testing as __testing, testing as feishuThreadBindingTesting, testing, buildFeishuConversationId, buildFeishuModelOverrideParentCandidates, createClackPrompter, createFeishuThreadBindingManager, feishuPlugin, feishuSessionBindingAdapterChannels, feishuSetupAdapter, feishuSetupWizard, getFeishuThreadBindingManager, handleFeishuSubagentDeliveryTarget, handleFeishuSubagentEnded, handleFeishuSubagentSpawning, parseFeishuConversationId, parseFeishuDirectConversationId, parseFeishuTargetId, registerFeishuBitableTools, registerFeishuChatTools, registerFeishuDocTools, registerFeishuDriveTools, registerFeishuPermTools, registerFeishuWikiTools, runFeishuLogin, setFeishuNamedAccountEnabled };
|
|
2548
|
+
export { buildFeishuConversationId, buildFeishuModelOverrideParentCandidates, createClackPrompter, createFeishuThreadBindingManager, feishuPlugin, feishuSetupAdapter, feishuSetupWizard, getFeishuThreadBindingManager, handleFeishuSubagentDeliveryTarget, handleFeishuSubagentEnded, parseFeishuConversationId, parseFeishuDirectConversationId, parseFeishuTargetId, registerFeishuBitableTools, registerFeishuChatTools, registerFeishuDocTools, registerFeishuDriveTools, registerFeishuPermTools, registerFeishuWikiTools, runFeishuLogin, setFeishuNamedAccountEnabled };
|