@openclaw/feishu 2026.7.2-beta.7 → 2026.8.1-beta.2
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 +52 -51
- package/dist/{channel-CScE82zY.js → channel-Dzb5jv3i.js} +53 -30
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-B21e1E0r.js → channel.runtime-CoPaHQQ6.js} +181 -142
- 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-B0JkoiRj.js} +318 -41
- package/dist/{media-CEUraFOR.js → media-BjSy8fiy.js} +298 -182
- package/dist/{monitor-DngbaA6a.js → monitor-CeHCfROt.js} +3 -3
- package/dist/{monitor.account-BnTWCw55.js → monitor.account-DwdqexLU.js} +237 -158
- 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 +1 -1
- 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-B867acTt.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{thread-bindings-N3wkgkIN.js → thread-bindings-Itvfmx6_.js} +6 -3
- 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 { r as createFeishuClient, s as resolveConfiguredHttpTimeoutMs } from "./client-
|
|
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-Dzb5jv3i.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 { r as createFeishuClient, 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, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-
|
|
7
|
+
import { C as resolveFeishuToolAccount, S as resolveAnyEnabledFeishuToolsConfig, b as unknownToolActionResult, n as registerFeishuDriveTools, u as registerFeishuChatTools, v as feishuExternalToolResult, w as resolveToolsConfig, x as createFeishuToolClient, y as toolExecutionErrorResult } from "./drive-B0JkoiRj.js";
|
|
8
|
+
import { n as getFeishuThreadBindingManager, t as createFeishuThreadBindingManager } from "./thread-bindings-Itvfmx6_.js";
|
|
9
|
+
import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-B867acTt.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) {
|
|
@@ -2449,17 +2452,18 @@ function registerFeishuBitableTools(api) {
|
|
|
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, handleFeishuSubagentSpawning, parseFeishuConversationId, parseFeishuDirectConversationId, parseFeishuTargetId, registerFeishuBitableTools, registerFeishuChatTools, registerFeishuDocTools, registerFeishuDriveTools, registerFeishuPermTools, registerFeishuWikiTools, runFeishuLogin, setFeishuNamedAccountEnabled };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as resolveDefaultFeishuAccountId,
|
|
1
|
+
import { a as resolveDefaultFeishuAccountId, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-CCCdMen2.js";
|
|
2
2
|
import { i as resolveReceiveIdType, n as looksLikeFeishuId, r as normalizeFeishuTarget } from "./targets-BUjQ1TcA.js";
|
|
3
|
-
import { A as resolveFeishuChatType, D as resolveFeishuGroupToolPolicy, N as createFeishuCardInteractionEnvelope, _ as canEnumerateAllFeishuPeers, a as readNativeFeishuCardJson, b as resolveFeishuChatReadPreliminaryAuthorization, g as canEnumerateAllFeishuGroups, h as authorizeFeishuChatMemberRead, k as normalizeFeishuChatType, m as assertFeishuChatReadAllowed, n as createFeishuSendReceipt, u as chunkFeishuMarkdown, v as isFeishuGroupReadAllowed, w as resolveFeishuGroupConfig, y as isFeishuGroupReadEnabled } from "./send-result-
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as messageActionTargetAliases } from "./security-audit-
|
|
3
|
+
import { A as resolveFeishuChatType, D as resolveFeishuGroupToolPolicy, N as createFeishuCardInteractionEnvelope, _ as canEnumerateAllFeishuPeers, a as readNativeFeishuCardJson, b as resolveFeishuChatReadPreliminaryAuthorization, g as canEnumerateAllFeishuGroups, h as authorizeFeishuChatMemberRead, k as normalizeFeishuChatType, m as assertFeishuChatReadAllowed, n as createFeishuSendReceipt, u as chunkFeishuMarkdown, v as isFeishuGroupReadAllowed, w as resolveFeishuGroupConfig, y as isFeishuGroupReadEnabled } from "./send-result-DEAycmOk.js";
|
|
4
|
+
import { i as normalizeFeishuWebhookPath, n as normalizeCompatibilityConfig, r as DEFAULT_FEISHU_WEBHOOK_PATH, t as legacyConfigRules } from "./doctor-contract-bEQXIXyP.js";
|
|
5
|
+
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, o as resolveConfiguredFeishuGroupSessionScope, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-VYgGQ-GX.js";
|
|
6
|
+
import { t as messageActionTargetAliases } from "./security-audit-D6Fz2h6p.js";
|
|
7
7
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BCpDLdg9.js";
|
|
8
8
|
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-BgpY7AiJ.js";
|
|
9
|
-
import { t as resolveFeishuSessionConversation } from "./session-conversation-
|
|
9
|
+
import { t as resolveFeishuSessionConversation } from "./session-conversation-DFCIvQK-.js";
|
|
10
10
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
11
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
12
12
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
@@ -18,6 +18,7 @@ import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing
|
|
|
18
18
|
import { createAllowlistProviderGroupPolicyWarningCollector, projectConfigAccountIdWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
19
19
|
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
|
|
20
20
|
import { applyDirectoryQueryAndLimit, createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter, listDirectoryGroupEntriesFromMapKeysAndAllowFrom, listDirectoryUserEntriesFromAllowFrom, listDirectoryUserEntriesFromAllowFromAndMapKeys } from "openclaw/plugin-sdk/directory-runtime";
|
|
21
|
+
import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
|
|
21
22
|
import { legacyInteractiveReplyToPresentation, normalizeLegacyInteractiveReply, normalizeMessagePresentation, renderMessagePresentationChartFallbackText, renderMessagePresentationFallbackText, renderMessagePresentationTableFallbackText, resolveLegacyInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime";
|
|
22
23
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
23
24
|
import { buildProbeChannelStatusSummary, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
@@ -60,6 +61,7 @@ const ChannelActionsSchema = z.object({ reactions: z.boolean().optional() }).str
|
|
|
60
61
|
const FeishuGroupPolicySchema = z.union([GroupPolicySchema, z.literal("allowall").transform(() => "open")]);
|
|
61
62
|
const FeishuDomainSchema = z.union([z.enum(["feishu", "lark"]), z.string().url().startsWith("https://")]);
|
|
62
63
|
const FeishuConnectionModeSchema = z.enum(["websocket", "webhook"]);
|
|
64
|
+
const FeishuWebhookPathSchema = z.string().refine((value) => normalizeFeishuWebhookPath(value) === value, { message: "webhookPath must be a canonical HTTP request path; run \"openclaw doctor --fix\" to repair it" });
|
|
63
65
|
const TtsOverrideSchema = z.object({
|
|
64
66
|
auto: z.enum([
|
|
65
67
|
"off",
|
|
@@ -239,7 +241,7 @@ const FeishuAccountConfigSchema = z.object({
|
|
|
239
241
|
verificationToken: buildSecretInputSchema().optional(),
|
|
240
242
|
domain: FeishuDomainSchema.optional(),
|
|
241
243
|
connectionMode: FeishuConnectionModeSchema.optional(),
|
|
242
|
-
webhookPath:
|
|
244
|
+
webhookPath: FeishuWebhookPathSchema.optional(),
|
|
243
245
|
...FeishuSharedConfigShape,
|
|
244
246
|
groupSessionScope: GroupSessionScopeSchema,
|
|
245
247
|
topicSessionMode: TopicSessionModeSchema
|
|
@@ -253,7 +255,7 @@ const FeishuChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChan
|
|
|
253
255
|
verificationToken: buildSecretInputSchema().optional(),
|
|
254
256
|
domain: FeishuDomainSchema.optional().default("feishu"),
|
|
255
257
|
connectionMode: FeishuConnectionModeSchema.optional().default("websocket"),
|
|
256
|
-
webhookPath:
|
|
258
|
+
webhookPath: FeishuWebhookPathSchema.optional().default(DEFAULT_FEISHU_WEBHOOK_PATH),
|
|
257
259
|
...FeishuSharedConfigShape,
|
|
258
260
|
dmPolicy: DmPolicySchema.optional().default("pairing"),
|
|
259
261
|
reactionNotifications: ReactionNotificationModeSchema.optional().default("own"),
|
|
@@ -455,21 +457,18 @@ function isFeishuSessionStoreKey(key) {
|
|
|
455
457
|
function isFeishuAcpBindingSessionKey(key) {
|
|
456
458
|
return /^agent:[^:]+:acp:binding:feishu(?::|$)/.test(key.trim().toLowerCase());
|
|
457
459
|
}
|
|
458
|
-
function normalizeMetadataString(value) {
|
|
459
|
-
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
460
|
-
}
|
|
461
460
|
function isFeishuSessionEntry(key, value) {
|
|
462
461
|
if (isFeishuAcpBindingSessionKey(key)) return false;
|
|
463
462
|
if (isFeishuSessionStoreKey(key)) return true;
|
|
464
463
|
if (!isRecord(value)) return false;
|
|
465
|
-
if (
|
|
466
|
-
if (
|
|
467
|
-
if (
|
|
468
|
-
if (
|
|
464
|
+
if (normalizeLowercaseStringOrEmpty(value.channel) === "feishu" || normalizeLowercaseStringOrEmpty(value.lastChannel) === "feishu") return true;
|
|
465
|
+
if (normalizeLowercaseStringOrEmpty((isRecord(value.route) ? value.route : null)?.channel) === "feishu") return true;
|
|
466
|
+
if (normalizeLowercaseStringOrEmpty((isRecord(value.deliveryContext) ? value.deliveryContext : null)?.channel) === "feishu") return true;
|
|
467
|
+
if (normalizeLowercaseStringOrEmpty((isRecord(value.pendingFinalDeliveryContext) ? value.pendingFinalDeliveryContext : null)?.channel) === "feishu") return true;
|
|
469
468
|
const origin = isRecord(value.origin) ? value.origin : null;
|
|
470
|
-
const originProvider =
|
|
471
|
-
const originSurface =
|
|
472
|
-
const originFrom =
|
|
469
|
+
const originProvider = normalizeLowercaseStringOrEmpty(origin?.provider);
|
|
470
|
+
const originSurface = normalizeLowercaseStringOrEmpty(origin?.surface);
|
|
471
|
+
const originFrom = normalizeLowercaseStringOrEmpty(origin?.from);
|
|
473
472
|
return originProvider === "feishu" || originSurface.startsWith("feishu") || originFrom.startsWith("feishu:");
|
|
474
473
|
}
|
|
475
474
|
function collectConfiguredAgentIds(cfg) {
|
|
@@ -1567,7 +1566,7 @@ const feishuSetupWizard = {
|
|
|
1567
1566
|
});
|
|
1568
1567
|
let probeResult = null;
|
|
1569
1568
|
if (configured && account.configured) try {
|
|
1570
|
-
const { probeFeishu } = await import("./probe-
|
|
1569
|
+
const { probeFeishu } = await import("./probe-DVpy58s0.js").then((n) => n.n);
|
|
1571
1570
|
probeResult = await probeFeishu(account);
|
|
1572
1571
|
} catch {}
|
|
1573
1572
|
if (!configured) return [formatFeishuStatusLine("needs-credentials")];
|
|
@@ -1619,13 +1618,13 @@ function readBooleanParam(params, keys) {
|
|
|
1619
1618
|
}
|
|
1620
1619
|
}
|
|
1621
1620
|
function hasLegacyFeishuCardCommandValue(actionValue) {
|
|
1622
|
-
return isRecord
|
|
1621
|
+
return isRecord(actionValue) && actionValue.oc !== "ocf1" && (Boolean(typeof actionValue.command === "string" && actionValue.command.trim()) || Boolean(typeof actionValue.text === "string" && actionValue.text.trim()));
|
|
1623
1622
|
}
|
|
1624
1623
|
function containsLegacyFeishuCardCommandValue(node) {
|
|
1625
1624
|
if (Array.isArray(node)) return node.some((item) => containsLegacyFeishuCardCommandValue(item));
|
|
1626
|
-
if (!isRecord
|
|
1625
|
+
if (!isRecord(node)) return false;
|
|
1627
1626
|
if (node.tag === "button" && hasLegacyFeishuCardCommandValue(node.value)) return true;
|
|
1628
|
-
if (node.tag === "button" && Array.isArray(node.behaviors) && node.behaviors.some((behavior) => isRecord
|
|
1627
|
+
if (node.tag === "button" && Array.isArray(node.behaviors) && node.behaviors.some((behavior) => isRecord(behavior) && hasLegacyFeishuCardCommandValue(behavior.value))) return true;
|
|
1629
1628
|
return Object.values(node).some((value) => containsLegacyFeishuCardCommandValue(value));
|
|
1630
1629
|
}
|
|
1631
1630
|
const meta = {
|
|
@@ -1639,7 +1638,25 @@ const meta = {
|
|
|
1639
1638
|
order: 70,
|
|
1640
1639
|
preferSessionLookupForAnnounceTarget: true
|
|
1641
1640
|
};
|
|
1642
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1641
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CoPaHQQ6.js"), "feishuChannelRuntime");
|
|
1642
|
+
async function resolveFeishuMessageSender(params) {
|
|
1643
|
+
try {
|
|
1644
|
+
const sender = params.resolve(await loadFeishuChannelRuntime());
|
|
1645
|
+
if (sender) return sender;
|
|
1646
|
+
throw new Error(params.unavailableMessage);
|
|
1647
|
+
} catch (error) {
|
|
1648
|
+
if (error instanceof PlatformMessageNotDispatchedError) throw error;
|
|
1649
|
+
throw new PlatformMessageNotDispatchedError(params.unavailableMessage, { cause: error });
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
const resolveFeishuTextSender = () => resolveFeishuMessageSender({
|
|
1653
|
+
resolve: (runtime) => runtime.feishuOutbound.sendText,
|
|
1654
|
+
unavailableMessage: "Feishu text sending is not available."
|
|
1655
|
+
});
|
|
1656
|
+
const resolveFeishuMediaSender = () => resolveFeishuMessageSender({
|
|
1657
|
+
resolve: (runtime) => runtime.feishuOutbound.sendMedia,
|
|
1658
|
+
unavailableMessage: "Feishu media sending is not available."
|
|
1659
|
+
});
|
|
1643
1660
|
function toFeishuMessageSendResult(result, kind) {
|
|
1644
1661
|
const receipt = result.receipt ?? createFeishuSendReceipt({
|
|
1645
1662
|
messageId: result.messageId,
|
|
@@ -1658,9 +1675,12 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
1658
1675
|
media: true
|
|
1659
1676
|
} },
|
|
1660
1677
|
send: {
|
|
1678
|
+
lifecycle: { beforeSendAttempt: async (ctx) => {
|
|
1679
|
+
if (ctx.kind === "text") await resolveFeishuTextSender();
|
|
1680
|
+
else if (ctx.kind === "media") await resolveFeishuMediaSender();
|
|
1681
|
+
} },
|
|
1661
1682
|
text: async (ctx) => {
|
|
1662
|
-
const sendText =
|
|
1663
|
-
if (!sendText) throw new Error("Feishu text sending is not available.");
|
|
1683
|
+
const sendText = await resolveFeishuTextSender();
|
|
1664
1684
|
const { onDeliveryResult, ...outboundCtx } = ctx;
|
|
1665
1685
|
return toFeishuMessageSendResult(await sendText({
|
|
1666
1686
|
...outboundCtx,
|
|
@@ -1670,8 +1690,7 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
1670
1690
|
}), "text");
|
|
1671
1691
|
},
|
|
1672
1692
|
media: async (ctx) => {
|
|
1673
|
-
const sendMedia =
|
|
1674
|
-
if (!sendMedia) throw new Error("Feishu media sending is not available.");
|
|
1693
|
+
const sendMedia = await resolveFeishuMediaSender();
|
|
1675
1694
|
const { onDeliveryResult, ...outboundCtx } = ctx;
|
|
1676
1695
|
return toFeishuMessageSendResult(await sendMedia({
|
|
1677
1696
|
...outboundCtx,
|
|
@@ -1683,7 +1702,7 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
1683
1702
|
}
|
|
1684
1703
|
});
|
|
1685
1704
|
async function createFeishuActionClient(account) {
|
|
1686
|
-
const { createFeishuClient } = await import("./client-
|
|
1705
|
+
const { createFeishuClient } = await import("./client-Hp7uo_cl.js").then((n) => n.t);
|
|
1687
1706
|
return createFeishuClient(account);
|
|
1688
1707
|
}
|
|
1689
1708
|
async function resolveFeishuChatTypeById(params) {
|
|
@@ -2196,7 +2215,9 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2196
2215
|
...audioAsVoice === void 0 ? {} : { audioAsVoice }
|
|
2197
2216
|
},
|
|
2198
2217
|
accountId: ctx.accountId ?? void 0,
|
|
2218
|
+
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
2199
2219
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
2220
|
+
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
2200
2221
|
...replyInThread ? { threadId: replyToMessageId } : { replyToId: replyToMessageId },
|
|
2201
2222
|
...audioAsVoice === void 0 ? {} : { audioAsVoice }
|
|
2202
2223
|
});
|
|
@@ -2216,7 +2237,9 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2216
2237
|
text: text ?? "",
|
|
2217
2238
|
mediaUrl,
|
|
2218
2239
|
accountId: ctx.accountId ?? void 0,
|
|
2240
|
+
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
2219
2241
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
2242
|
+
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
2220
2243
|
...replyInThread ? { threadId: replyToMessageId } : { replyToId: replyToMessageId },
|
|
2221
2244
|
...audioAsVoice === true ? { audioAsVoice: true } : {}
|
|
2222
2245
|
});
|
|
@@ -2626,12 +2649,12 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2626
2649
|
afterWrite: { mode: "auto" }
|
|
2627
2650
|
});
|
|
2628
2651
|
} },
|
|
2629
|
-
setup: feishuSetupAdapter,
|
|
2630
2652
|
setupContract: feishuSetupContract,
|
|
2631
2653
|
setupWizard: feishuSetupWizard,
|
|
2632
2654
|
messaging: {
|
|
2633
2655
|
targetPrefixes: ["feishu", "lark"],
|
|
2634
2656
|
normalizeTarget: (raw) => normalizeFeishuTarget(raw) ?? void 0,
|
|
2657
|
+
inferTargetChatType: ({ to }) => resolveReceiveIdType(to) === "chat_id" ? "group" : "direct",
|
|
2635
2658
|
resolveDeliveryTarget: ({ conversationId, parentConversationId }) => {
|
|
2636
2659
|
const directId = parseFeishuDirectConversationId(conversationId);
|
|
2637
2660
|
if (directId) return { to: `user:${directId}` };
|
|
@@ -2698,7 +2721,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2698
2721
|
})
|
|
2699
2722
|
}),
|
|
2700
2723
|
gateway: { startAccount: async (ctx) => {
|
|
2701
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
2724
|
+
const { monitorFeishuProvider } = await import("./monitor-CeHCfROt.js");
|
|
2702
2725
|
const account = resolveFeishuRuntimeAccount({
|
|
2703
2726
|
cfg: ctx.cfg,
|
|
2704
2727
|
accountId: ctx.accountId
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-Dzb5jv3i.js";
|
|
2
2
|
export { feishuPlugin };
|