@openclaw/feishu 2026.8.1 → 2026.8.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/api.js +30 -26
- package/dist/{app-registration-BpfUzS9m.js → app-registration-BI99e_JI.js} +12 -9
- package/dist/{channel-CnpfeyYb.js → channel-BtM7n79m.js} +46 -33
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BhBg13ML.js → channel.runtime-DmCiCQJE.js} +5 -5
- package/dist/{chat-BjgJQ9dk.js → chat-Cbr7P_JH.js} +12 -9
- package/dist/{client-DalLmpMf.js → client-vJJyfkxI.js} +2 -1
- package/dist/contract-api.js +2 -2
- package/dist/{doctor-contract-DpQKxB7B.js → doctor-contract-CQAuBotF.js} +3 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{json-response-CheljwGr.js → json-response-DXajw_FU.js} +1 -1
- package/dist/{monitor.startup-D-gL82OO.js → monitor-BVYpA9SO.js} +62 -2
- package/dist/{monitor.account-B6Fv45B2.js → monitor.account-CuOAmGJf.js} +74 -66
- package/dist/{probe-CfhhR_0a.js → probe-Cs1s-qSS.js} +3 -3
- package/dist/{reply-delivery-result-7Jezz03B.js → reply-delivery-result-BIIeISPG.js} +21 -15
- package/dist/{security-audit-D6Fz2h6p.js → security-audit-DKfR4Cv3.js} +1 -1
- package/dist/{security-audit-shared-BgpY7AiJ.js → security-audit-shared-CK5rVR-1.js} +2 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/{subagent-hooks-DOwDqgg7.js → subagent-hooks-BnO3ALWB.js} +1 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{thread-bindings-DlDOHuiJ.js → thread-bindings-BiL1wGqK.js} +19 -8
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/@larksuiteoapi/node-sdk/node_modules/ws/package.json +1 -1
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +5 -5
- package/dist/monitor-DRVC2e_W.js +0 -62
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-
|
|
2
|
-
import { B as resolveFeishuToolAccount, F as feishuExternalToolResult, I as toolExecutionErrorResult, L as unknownToolActionResult, P as registerFeishuDriveTools, R as createFeishuToolClient, et as chunkFeishuMarkdown, rt as parseFeishuMarkdown, z as resolveAnyEnabledFeishuToolsConfig } from "./reply-delivery-result-
|
|
1
|
+
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-BtM7n79m.js";
|
|
2
|
+
import { B as resolveFeishuToolAccount, F as feishuExternalToolResult, I as toolExecutionErrorResult, L as unknownToolActionResult, P as registerFeishuDriveTools, R as createFeishuToolClient, et as chunkFeishuMarkdown, rt as parseFeishuMarkdown, z as resolveAnyEnabledFeishuToolsConfig } from "./reply-delivery-result-BIIeISPG.js";
|
|
3
3
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-VYgGQ-GX.js";
|
|
4
|
-
import { s as resolveConfiguredHttpTimeoutMs } from "./client-
|
|
4
|
+
import { s as resolveConfiguredHttpTimeoutMs } from "./client-vJJyfkxI.js";
|
|
5
5
|
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
|
|
6
|
-
import { o as registerFeishuChatTools } from "./chat-
|
|
7
|
-
import { n as getFeishuThreadBindingManager, t as createFeishuThreadBindingManager } from "./thread-bindings-
|
|
8
|
-
import { n as handleFeishuSubagentEnded, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-
|
|
6
|
+
import { o as registerFeishuChatTools } from "./chat-Cbr7P_JH.js";
|
|
7
|
+
import { n as getFeishuThreadBindingManager, t as createFeishuThreadBindingManager } from "./thread-bindings-BiL1wGqK.js";
|
|
8
|
+
import { n as handleFeishuSubagentEnded, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-BnO3ALWB.js";
|
|
9
9
|
import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
10
10
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -902,7 +902,8 @@ function normalizeConvertedBlockTree(blocks, firstLevelIds) {
|
|
|
902
902
|
const parentId = typeof block?.parent_id === "string" ? block.parent_id : "";
|
|
903
903
|
return !childIds.has(blockId) && (!parentId || !byId.has(parentId));
|
|
904
904
|
}).toSorted((a, b) => (originalOrder.get(a.block_id ?? "__missing__") ?? 0) - (originalOrder.get(b.block_id ?? "__missing__") ?? 0)).map((block) => block.block_id).filter((blockId) => typeof blockId === "string");
|
|
905
|
-
const
|
|
905
|
+
const rootIds = (firstLevelIds && firstLevelIds.length > 0 ? firstLevelIds : inferredTopLevelIds).filter((id) => typeof id === "string" && byId.has(id));
|
|
906
|
+
const uniqueRootIds = uniqueStrings(rootIds);
|
|
906
907
|
const orderedBlocks = [];
|
|
907
908
|
const visited = /* @__PURE__ */ new Set();
|
|
908
909
|
const visit = (blockId) => {
|
|
@@ -1244,23 +1245,25 @@ async function createDoc(client, title, folderToken, options) {
|
|
|
1244
1245
|
let requesterPermissionAdded = false;
|
|
1245
1246
|
let requesterPermissionSkippedReason;
|
|
1246
1247
|
let requesterPermissionError;
|
|
1247
|
-
if (shouldGrantToRequester)
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1248
|
+
if (shouldGrantToRequester) {
|
|
1249
|
+
if (!requesterOpenId) requesterPermissionSkippedReason = "trusted requester identity unavailable";
|
|
1250
|
+
else try {
|
|
1251
|
+
await client.drive.permissionMember.create({
|
|
1252
|
+
path: { token: docToken },
|
|
1253
|
+
params: {
|
|
1254
|
+
type: "docx",
|
|
1255
|
+
need_notification: false
|
|
1256
|
+
},
|
|
1257
|
+
data: {
|
|
1258
|
+
member_type: "openid",
|
|
1259
|
+
member_id: requesterOpenId,
|
|
1260
|
+
perm: requesterPermType
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
requesterPermissionAdded = true;
|
|
1264
|
+
} catch (err) {
|
|
1265
|
+
requesterPermissionError = formatErrorMessage(err);
|
|
1266
|
+
}
|
|
1264
1267
|
}
|
|
1265
1268
|
return {
|
|
1266
1269
|
document_id: docToken,
|
|
@@ -1627,14 +1630,15 @@ function registerFeishuDocTools(api) {
|
|
|
1627
1630
|
parameters: Type.Object({}),
|
|
1628
1631
|
async execute() {
|
|
1629
1632
|
try {
|
|
1630
|
-
|
|
1633
|
+
const result = await listAppScopes(createFeishuToolClient({
|
|
1631
1634
|
api,
|
|
1632
1635
|
defaultAccountId: ctx.agentAccountId,
|
|
1633
1636
|
requiredTool: {
|
|
1634
1637
|
family: "scopes",
|
|
1635
1638
|
label: "App Scopes"
|
|
1636
1639
|
}
|
|
1637
|
-
}))
|
|
1640
|
+
}));
|
|
1641
|
+
return feishuExternalToolResult(result);
|
|
1638
1642
|
} catch (err) {
|
|
1639
1643
|
return feishuExternalToolResult({ error: formatErrorMessage(err) });
|
|
1640
1644
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as readFeishuJsonResponse } from "./json-response-
|
|
1
|
+
import { t as readFeishuJsonResponse } from "./json-response-DXajw_FU.js";
|
|
2
2
|
import { finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
|
|
3
3
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
4
4
|
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -128,13 +128,15 @@ async function pollAppRegistration(params) {
|
|
|
128
128
|
openId: pollRes.user_info?.open_id
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
if (pollRes.error)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
if (pollRes.error) {
|
|
132
|
+
if (pollRes.error === "authorization_pending") {} else if (pollRes.error === "slow_down") currentInterval += 5;
|
|
133
|
+
else if (pollRes.error === "access_denied") return { status: "access_denied" };
|
|
134
|
+
else if (pollRes.error === "expired_token") return { status: "expired" };
|
|
135
|
+
else return {
|
|
136
|
+
status: "error",
|
|
137
|
+
message: `${pollRes.error}: ${pollRes.error_description ?? "unknown"}`
|
|
138
|
+
};
|
|
139
|
+
}
|
|
138
140
|
await sleepRegistrationPollInterval(currentInterval, abortSignal);
|
|
139
141
|
}
|
|
140
142
|
return { status: "timeout" };
|
|
@@ -195,7 +197,8 @@ async function getAppOwnerOpenId(params) {
|
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
async function sleepRegistrationPollInterval(intervalSeconds, abortSignal) {
|
|
198
|
-
|
|
200
|
+
const intervalMs = finiteSecondsToTimerSafeMilliseconds(intervalSeconds) ?? DEFAULT_REGISTRATION_POLL_INTERVAL_SECONDS * 1e3;
|
|
201
|
+
await sleepWithAbort(intervalMs, abortSignal).catch(() => {});
|
|
199
202
|
}
|
|
200
203
|
//#endregion
|
|
201
204
|
export { beginAppRegistration, getAppOwnerOpenId, initAppRegistration, pollAppRegistration, printQrCode };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as resolveDefaultFeishuAccountId, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-RwSyseKr.js";
|
|
2
2
|
import { i as resolveReceiveIdType, n as looksLikeFeishuId, r as normalizeFeishuTarget } from "./targets-BUjQ1TcA.js";
|
|
3
|
-
import { $ as sanitizeNativeFeishuCard, A as buildFeishuMediaFallbackText, M as resolveFeishuIdentityHeaderTitle, N as deliverCommentThreadText, Q as resolveFeishuCardTemplate, S as sendStructuredCardFeishu, V as cleanupAmbientCommentTypingReaction, X as parseFeishuCommentTarget, Z as readNativeFeishuCardJson, _t as resolveFeishuGroupToolPolicy, a as assertFeishuCardWithinEnvelope, at as authorizeFeishuChatMemberRead, b as sendCardFeishu, bt as resolveFeishuChatType, c as buildFeishuPresentationFallback, ct as isFeishuGroupReadAllowed, d as resolveFeishuRichReply, et as chunkFeishuMarkdown, g as chunkFeishuCardMarkdown, h as shouldSuppressFeishuTextForVoiceMedia, it as assertFeishuChatReadAllowed, k as createFeishuSendReceipt, l as isFeishuCardWithinEnvelope, lt as isFeishuGroupReadEnabled, mt as resolveFeishuGroupConfig, n as createFeishuReplyDeliveryResult, nt as materializeFeishuPostMarkdownSoftBreaks, o as buildFeishuPresentationCard, ot as canEnumerateAllFeishuGroups, p as sendMediaFeishu, s as buildFeishuPresentationCardElements, st as canEnumerateAllFeishuPeers, t as createFeishuPartialReplyDeliveryError, tt as chunkFeishuPostMarkdown, u as renderFeishuPresentationFallbackText, ut as resolveFeishuChatReadPreliminaryAuthorization, x as sendMessageFeishu, yt as normalizeFeishuChatType } from "./reply-delivery-result-
|
|
4
|
-
import { n as normalizeCompatibilityConfig, o as normalizeFeishuExternalKey, r as FeishuChannelConfigSchema, t as legacyConfigRules } from "./doctor-contract-
|
|
3
|
+
import { $ as sanitizeNativeFeishuCard, A as buildFeishuMediaFallbackText, M as resolveFeishuIdentityHeaderTitle, N as deliverCommentThreadText, Q as resolveFeishuCardTemplate, S as sendStructuredCardFeishu, V as cleanupAmbientCommentTypingReaction, X as parseFeishuCommentTarget, Z as readNativeFeishuCardJson, _t as resolveFeishuGroupToolPolicy, a as assertFeishuCardWithinEnvelope, at as authorizeFeishuChatMemberRead, b as sendCardFeishu, bt as resolveFeishuChatType, c as buildFeishuPresentationFallback, ct as isFeishuGroupReadAllowed, d as resolveFeishuRichReply, et as chunkFeishuMarkdown, g as chunkFeishuCardMarkdown, h as shouldSuppressFeishuTextForVoiceMedia, it as assertFeishuChatReadAllowed, k as createFeishuSendReceipt, l as isFeishuCardWithinEnvelope, lt as isFeishuGroupReadEnabled, mt as resolveFeishuGroupConfig, n as createFeishuReplyDeliveryResult, nt as materializeFeishuPostMarkdownSoftBreaks, o as buildFeishuPresentationCard, ot as canEnumerateAllFeishuGroups, p as sendMediaFeishu, s as buildFeishuPresentationCardElements, st as canEnumerateAllFeishuPeers, t as createFeishuPartialReplyDeliveryError, tt as chunkFeishuPostMarkdown, u as renderFeishuPresentationFallbackText, ut as resolveFeishuChatReadPreliminaryAuthorization, x as sendMessageFeishu, yt as normalizeFeishuChatType } from "./reply-delivery-result-BIIeISPG.js";
|
|
4
|
+
import { n as normalizeCompatibilityConfig, o as normalizeFeishuExternalKey, r as FeishuChannelConfigSchema, t as legacyConfigRules } from "./doctor-contract-CQAuBotF.js";
|
|
5
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-
|
|
7
|
-
import { r as createFeishuClient } from "./client-
|
|
6
|
+
import { t as messageActionTargetAliases } from "./security-audit-DKfR4Cv3.js";
|
|
7
|
+
import { r as createFeishuClient } from "./client-vJJyfkxI.js";
|
|
8
8
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BCpDLdg9.js";
|
|
9
|
-
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-
|
|
9
|
+
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-CK5rVR-1.js";
|
|
10
10
|
import { t as resolveFeishuSessionConversation } from "./session-conversation-DFCIvQK-.js";
|
|
11
11
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
12
12
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
@@ -48,7 +48,8 @@ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createSetupTranslator, form
|
|
|
48
48
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
49
49
|
//#region extensions/feishu/src/approval-auth.ts
|
|
50
50
|
function normalizeFeishuApproverId(value) {
|
|
51
|
-
const
|
|
51
|
+
const normalized = normalizeFeishuTarget(String(value));
|
|
52
|
+
const trimmed = normalizeOptionalLowercaseString(normalized);
|
|
52
53
|
return trimmed?.startsWith("ou_") ? trimmed : void 0;
|
|
53
54
|
}
|
|
54
55
|
const feishuApprovalAuth = createChannelApprovalAuth({
|
|
@@ -102,11 +103,12 @@ async function listFeishuDirectoryGroups(params) {
|
|
|
102
103
|
}).map((entry) => entry.id));
|
|
103
104
|
}
|
|
104
105
|
async function listAuthorizedFeishuDirectoryPeers(params) {
|
|
106
|
+
const account = resolveFeishuAccount({
|
|
107
|
+
cfg: params.cfg,
|
|
108
|
+
accountId: params.accountId
|
|
109
|
+
});
|
|
105
110
|
return toFeishuDirectoryPeers(listDirectoryUserEntriesFromAllowFrom({
|
|
106
|
-
allowFrom:
|
|
107
|
-
cfg: params.cfg,
|
|
108
|
-
accountId: params.accountId
|
|
109
|
-
}).config.allowFrom,
|
|
111
|
+
allowFrom: account.config.allowFrom,
|
|
110
112
|
query: params.query,
|
|
111
113
|
limit: params.limit,
|
|
112
114
|
normalizeId: (entry) => normalizeFeishuTarget(entry) ?? entry
|
|
@@ -117,17 +119,19 @@ async function listAuthorizedFeishuDirectoryGroups(params) {
|
|
|
117
119
|
cfg: params.cfg,
|
|
118
120
|
accountId: params.accountId
|
|
119
121
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
const enabledGroups = Object.fromEntries(Object.entries(account.config.groups ?? {}).filter(([, group]) => group?.enabled !== false));
|
|
123
|
+
const authorizedEntries = listDirectoryGroupEntriesFromMapKeysAndAllowFrom({
|
|
124
|
+
groups: enabledGroups,
|
|
122
125
|
allowFrom: account.config.groupAllowFrom
|
|
123
|
-
}).filter((entry) => isFeishuGroupReadAllowed(params.cfg, account, entry.id, false))
|
|
126
|
+
}).filter((entry) => isFeishuGroupReadAllowed(params.cfg, account, entry.id, false));
|
|
127
|
+
return toFeishuDirectoryGroups(applyDirectoryQueryAndLimit(authorizedEntries.map((entry) => entry.id), params));
|
|
124
128
|
}
|
|
125
129
|
//#endregion
|
|
126
130
|
//#region extensions/feishu/src/doctor.ts
|
|
127
131
|
const FEISHU_STATE_DIR = "feishu";
|
|
128
132
|
const BACKUP_PREFIX = "feishu-state-repair";
|
|
129
133
|
const BLANK_USER_MESSAGE_REPAIR_THRESHOLD = 3;
|
|
130
|
-
const SESSION_FILE_INSPECTION_MAX_BYTES =
|
|
134
|
+
const SESSION_FILE_INSPECTION_MAX_BYTES = 16777216;
|
|
131
135
|
function timestampForPath(now = /* @__PURE__ */ new Date()) {
|
|
132
136
|
return now.toISOString().replaceAll(":", "-");
|
|
133
137
|
}
|
|
@@ -191,9 +195,12 @@ function isFeishuSessionEntry(key, value) {
|
|
|
191
195
|
if (isFeishuSessionStoreKey(key)) return true;
|
|
192
196
|
if (!isRecord(value)) return false;
|
|
193
197
|
if (normalizeLowercaseStringOrEmpty(value.channel) === "feishu" || normalizeLowercaseStringOrEmpty(value.lastChannel) === "feishu") return true;
|
|
194
|
-
|
|
195
|
-
if (normalizeLowercaseStringOrEmpty(
|
|
196
|
-
|
|
198
|
+
const route = isRecord(value.route) ? value.route : null;
|
|
199
|
+
if (normalizeLowercaseStringOrEmpty(route?.channel) === "feishu") return true;
|
|
200
|
+
const deliveryContext = isRecord(value.deliveryContext) ? value.deliveryContext : null;
|
|
201
|
+
if (normalizeLowercaseStringOrEmpty(deliveryContext?.channel) === "feishu") return true;
|
|
202
|
+
const pendingDeliveryContext = isRecord(value.pendingFinalDeliveryContext) ? value.pendingFinalDeliveryContext : null;
|
|
203
|
+
if (normalizeLowercaseStringOrEmpty(pendingDeliveryContext?.channel) === "feishu") return true;
|
|
197
204
|
const origin = isRecord(value.origin) ? value.origin : null;
|
|
198
205
|
const originProvider = normalizeLowercaseStringOrEmpty(origin?.provider);
|
|
199
206
|
const originSurface = normalizeLowercaseStringOrEmpty(origin?.surface);
|
|
@@ -845,12 +852,13 @@ function buildFeishuPayloadCard(params) {
|
|
|
845
852
|
assertFeishuCardWithinEnvelope(textCard, "Feishu native card");
|
|
846
853
|
return markRenderedFeishuCard(textCard);
|
|
847
854
|
}
|
|
855
|
+
const text = textCard ? void 0 : resolveLegacyInteractiveTextFallback({
|
|
856
|
+
text: rawText,
|
|
857
|
+
interactive
|
|
858
|
+
});
|
|
848
859
|
const elements = buildFeishuPresentationCardElements({
|
|
849
860
|
presentation,
|
|
850
|
-
fallbackText:
|
|
851
|
-
text: rawText,
|
|
852
|
-
interactive
|
|
853
|
-
})
|
|
861
|
+
fallbackText: text
|
|
854
862
|
});
|
|
855
863
|
const identityTitle = resolveFeishuIdentityHeaderTitle(params.identity);
|
|
856
864
|
const title = presentation?.title ?? identityTitle;
|
|
@@ -870,8 +878,9 @@ function buildFeishuPayloadCard(params) {
|
|
|
870
878
|
return isFeishuCardWithinEnvelope(card) ? card : void 0;
|
|
871
879
|
}
|
|
872
880
|
function renderFeishuPresentationPayload({ payload, presentation, ctx }) {
|
|
881
|
+
const textCard = readNativeFeishuCardJson(payload.text);
|
|
873
882
|
const { fallbackText, fallbackHasCommand } = buildFeishuPresentationFallback({
|
|
874
|
-
text:
|
|
883
|
+
text: textCard ? void 0 : payload.text,
|
|
875
884
|
presentation,
|
|
876
885
|
textFormat: parseFeishuCommentTarget(ctx.to) ? "plain" : "markdown"
|
|
877
886
|
});
|
|
@@ -927,10 +936,11 @@ function resolveFeishuReplyMode(params) {
|
|
|
927
936
|
async function sendCommentThreadReply(params) {
|
|
928
937
|
const target = parseFeishuCommentTarget(params.to);
|
|
929
938
|
if (!target) return null;
|
|
930
|
-
const
|
|
939
|
+
const account = resolveFeishuAccount({
|
|
931
940
|
cfg: params.cfg,
|
|
932
941
|
accountId: params.accountId
|
|
933
|
-
})
|
|
942
|
+
});
|
|
943
|
+
const client = createFeishuClient(account);
|
|
934
944
|
const replyId = params.replyId?.trim();
|
|
935
945
|
try {
|
|
936
946
|
const result = await deliverCommentThreadText(client, {
|
|
@@ -1129,8 +1139,9 @@ const feishuOutbound = {
|
|
|
1129
1139
|
if (parseFeishuCommentTarget(ctx.to)) {
|
|
1130
1140
|
const { presentation } = resolveFeishuRichReply(payload);
|
|
1131
1141
|
const textCard = readNativeFeishuCardJson(payload.text);
|
|
1142
|
+
const fallbackSourceText = textCard ? void 0 : payload.text;
|
|
1132
1143
|
const { commentText: text, fallbackText } = buildFeishuPresentationFallback({
|
|
1133
|
-
text:
|
|
1144
|
+
text: fallbackSourceText,
|
|
1134
1145
|
presentation,
|
|
1135
1146
|
fallbackHasCommand: isRecord(payload.channelData?.feishu) && payload.channelData.feishu.fallbackHasCommand === true
|
|
1136
1147
|
});
|
|
@@ -1571,11 +1582,12 @@ async function promptFeishuAllowFrom(params) {
|
|
|
1571
1582
|
"- ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
1572
1583
|
"- on_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
1573
1584
|
].join("\n"), t("wizard.feishu.allowlistTitle"));
|
|
1574
|
-
const
|
|
1585
|
+
const entry = await params.prompter.text({
|
|
1575
1586
|
message: t("wizard.feishu.allowFromPrompt"),
|
|
1576
1587
|
placeholder: "ou_xxxxx, ou_yyyyy",
|
|
1577
1588
|
initialValue: existingAllowFrom.length > 0 ? existingAllowFrom.map(String).join(", ") : void 0
|
|
1578
|
-
})
|
|
1589
|
+
});
|
|
1590
|
+
const mergedAllowFrom = mergeAllowFromEntries(existingAllowFrom, splitSetupEntries(entry));
|
|
1579
1591
|
return patchFeishuConfig(params.cfg, resolvedAccountId, { allowFrom: mergedAllowFrom });
|
|
1580
1592
|
}
|
|
1581
1593
|
async function noteFeishuCredentialHelp(prompter) {
|
|
@@ -1626,7 +1638,7 @@ function applyNewAppSecurityPolicy(cfg, accountId, openId, groupPolicy) {
|
|
|
1626
1638
|
next = patchFeishuConfig(next, accountId, groupPatch);
|
|
1627
1639
|
return next;
|
|
1628
1640
|
}
|
|
1629
|
-
const loadAppRegistrationModule = createLazyRuntimeModule(() => import("./app-registration-
|
|
1641
|
+
const loadAppRegistrationModule = createLazyRuntimeModule(() => import("./app-registration-BI99e_JI.js"));
|
|
1630
1642
|
async function promptFeishuDomain(params) {
|
|
1631
1643
|
return await params.prompter.select({
|
|
1632
1644
|
message: t("wizard.feishu.domainPrompt"),
|
|
@@ -1851,7 +1863,7 @@ const feishuSetupWizard = {
|
|
|
1851
1863
|
});
|
|
1852
1864
|
let probeResult = null;
|
|
1853
1865
|
if (configured && account.configured) try {
|
|
1854
|
-
const { probeFeishu } = await import("./probe-
|
|
1866
|
+
const { probeFeishu } = await import("./probe-Cs1s-qSS.js").then((n) => n.n);
|
|
1855
1867
|
probeResult = await probeFeishu(account);
|
|
1856
1868
|
} catch {}
|
|
1857
1869
|
if (!configured) return [formatFeishuStatusLine("needs-credentials")];
|
|
@@ -2019,7 +2031,7 @@ const meta = {
|
|
|
2019
2031
|
order: 70,
|
|
2020
2032
|
preferSessionLookupForAnnounceTarget: true
|
|
2021
2033
|
};
|
|
2022
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
2034
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-DmCiCQJE.js"), "feishuChannelRuntime");
|
|
2023
2035
|
async function resolveFeishuMessageSender(params) {
|
|
2024
2036
|
try {
|
|
2025
2037
|
const sender = params.resolve(await loadFeishuChannelRuntime());
|
|
@@ -2083,12 +2095,13 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
2083
2095
|
}
|
|
2084
2096
|
});
|
|
2085
2097
|
async function createFeishuActionClient(account) {
|
|
2086
|
-
const { createFeishuClient } = await import("./client-
|
|
2098
|
+
const { createFeishuClient } = await import("./client-vJJyfkxI.js").then((n) => n.t);
|
|
2087
2099
|
return createFeishuClient(account);
|
|
2088
2100
|
}
|
|
2089
2101
|
async function resolveFeishuChatTypeById(params) {
|
|
2090
2102
|
const client = await createFeishuActionClient(params.account);
|
|
2091
|
-
|
|
2103
|
+
const chat = await params.runtime.getChatInfo(client, params.chatId);
|
|
2104
|
+
return resolveFeishuChatType(chat);
|
|
2092
2105
|
}
|
|
2093
2106
|
async function resolveFeishuMessageChatType(params) {
|
|
2094
2107
|
const knownChatType = normalizeFeishuChatType(params.message.chatType);
|
|
@@ -3142,7 +3155,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
3142
3155
|
})
|
|
3143
3156
|
}),
|
|
3144
3157
|
gateway: { startAccount: async (ctx) => {
|
|
3145
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
3158
|
+
const { monitorFeishuProvider } = await import("./monitor-BVYpA9SO.js");
|
|
3146
3159
|
const account = resolveFeishuRuntimeAccount({
|
|
3147
3160
|
cfg: ctx.cfg,
|
|
3148
3161
|
accountId: ctx.accountId
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-BtM7n79m.js";
|
|
2
2
|
export { feishuPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as resolveFeishuAccount, s as resolveFeishuRuntimeAccount } from "./accounts-RwSyseKr.js";
|
|
2
|
-
import { c as listFeishuDirectoryPeers, o as feishuOutbound, s as listFeishuDirectoryGroups } from "./channel-
|
|
3
|
-
import { _ as editMessageFeishu, b as sendCardFeishu, m as sendStickerFeishu, v as getMessageFeishu, x as sendMessageFeishu } from "./reply-delivery-result-
|
|
4
|
-
import { r as createFeishuClient } from "./client-
|
|
5
|
-
import { a as getFeishuMemberInfo, i as getChatMembers, n as buildFeishuDirectChatMembers, r as getChatInfo, t as assertFeishuChatMember } from "./chat-
|
|
6
|
-
import { t as probeFeishu } from "./probe-
|
|
2
|
+
import { c as listFeishuDirectoryPeers, o as feishuOutbound, s as listFeishuDirectoryGroups } from "./channel-BtM7n79m.js";
|
|
3
|
+
import { _ as editMessageFeishu, b as sendCardFeishu, m as sendStickerFeishu, v as getMessageFeishu, x as sendMessageFeishu } from "./reply-delivery-result-BIIeISPG.js";
|
|
4
|
+
import { r as createFeishuClient } from "./client-vJJyfkxI.js";
|
|
5
|
+
import { a as getFeishuMemberInfo, i as getChatMembers, n as buildFeishuDirectChatMembers, r as getChatInfo, t as assertFeishuChatMember } from "./chat-Cbr7P_JH.js";
|
|
6
|
+
import { t as probeFeishu } from "./probe-Cs1s-qSS.js";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
//#region extensions/feishu/src/directory.ts
|
|
9
9
|
const MAX_FEISHU_DIRECTORY_PAGES = 100;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as resolveFeishuToolAccount, F as feishuExternalToolResult, G as formatFeishuApiError, at as authorizeFeishuChatMemberRead, bt as resolveFeishuChatType, it as assertFeishuChatReadAllowed, ut as resolveFeishuChatReadPreliminaryAuthorization, z as resolveAnyEnabledFeishuToolsConfig } from "./reply-delivery-result-
|
|
2
|
-
import { r as createFeishuClient } from "./client-
|
|
1
|
+
import { B as resolveFeishuToolAccount, F as feishuExternalToolResult, G as formatFeishuApiError, at as authorizeFeishuChatMemberRead, bt as resolveFeishuChatType, it as assertFeishuChatReadAllowed, ut as resolveFeishuChatReadPreliminaryAuthorization, z as resolveAnyEnabledFeishuToolsConfig } from "./reply-delivery-result-BIIeISPG.js";
|
|
2
|
+
import { r as createFeishuClient } from "./client-vJJyfkxI.js";
|
|
3
3
|
import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
4
4
|
import { readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
|
|
5
5
|
import { Type } from "typebox";
|
|
@@ -235,13 +235,16 @@ function registerFeishuChatTools(api) {
|
|
|
235
235
|
return feishuExternalToolResult(await getChatMembers(client, p.chat_id, readChatPageSize(rawParams), p.page_token, p.member_id_type));
|
|
236
236
|
case "info":
|
|
237
237
|
if (!p.chat_id) return feishuExternalToolResult({ error: "chat_id is required for action info" });
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
{
|
|
239
|
+
const chat = await getAuthorizedFeishuChatInfo({
|
|
240
|
+
client,
|
|
241
|
+
cfg,
|
|
242
|
+
account,
|
|
243
|
+
chatId: p.chat_id,
|
|
244
|
+
ctx: toolContext
|
|
245
|
+
});
|
|
246
|
+
return feishuExternalToolResult(chat);
|
|
247
|
+
}
|
|
245
248
|
case "member_info":
|
|
246
249
|
if (!p.member_id) return feishuExternalToolResult({ error: "member_id is required for action member_info" });
|
|
247
250
|
if (!p.chat_id) return feishuExternalToolResult({ error: "chat_id is required for action member_info" });
|
|
@@ -32,7 +32,8 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
32
32
|
createFeishuWSClient: () => createFeishuWSClient,
|
|
33
33
|
getFeishuUserAgent: () => getFeishuUserAgent
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const require = createRequire(import.meta.url);
|
|
36
|
+
const FEISHU_USER_AGENT = `openclaw-feishu-builtin/${readPluginPackageVersion({ require })}/${process.platform}`;
|
|
36
37
|
const FEISHU_SDK_ORIGIN = "https://open.feishu.cn";
|
|
37
38
|
const FEISHU_WS_CONFIG = { pingTimeout: 3 };
|
|
38
39
|
/** User-Agent header value for all Feishu API requests. */
|
package/dist/contract-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-VYgGQ-GX.js";
|
|
2
|
-
import { t as messageActionTargetAliases } from "./security-audit-
|
|
3
|
-
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-
|
|
2
|
+
import { t as messageActionTargetAliases } from "./security-audit-DKfR4Cv3.js";
|
|
3
|
+
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-CK5rVR-1.js";
|
|
4
4
|
export { buildFeishuConversationId, collectFeishuSecurityAuditFindings, messageActionTargetAliases, parseFeishuConversationId, parseFeishuDirectConversationId, parseFeishuTargetId };
|
|
@@ -230,7 +230,7 @@ const FeishuAccountConfigSchema = z.object({
|
|
|
230
230
|
groupSessionScope: GroupSessionScopeSchema,
|
|
231
231
|
topicSessionMode: TopicSessionModeSchema
|
|
232
232
|
}).strict();
|
|
233
|
-
const
|
|
233
|
+
const FeishuConfigSchemaBase = z.object({
|
|
234
234
|
enabled: z.boolean().optional(),
|
|
235
235
|
defaultAccount: z.string().optional(),
|
|
236
236
|
stickerSets: FeishuStickerSetsSchema.optional(),
|
|
@@ -251,7 +251,8 @@ const FeishuConfigSchema = buildMultiAccountChannelSchema(z.object({
|
|
|
251
251
|
dynamicAgentCreation: DynamicAgentCreationSchema,
|
|
252
252
|
typingIndicator: z.boolean().optional().default(true),
|
|
253
253
|
resolveSenderNames: z.boolean().optional().default(true)
|
|
254
|
-
}).strict()
|
|
254
|
+
}).strict();
|
|
255
|
+
const FeishuConfigSchema = buildMultiAccountChannelSchema(FeishuConfigSchemaBase, {
|
|
255
256
|
accountSchema: FeishuAccountConfigSchema,
|
|
256
257
|
optionalAccount: true
|
|
257
258
|
}).superRefine((value, ctx) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CQAuBotF.js";
|
|
2
2
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
2
2
|
//#region extensions/feishu/src/json-response.ts
|
|
3
3
|
/** Feishu control-plane JSON responses are tiny; 16 MiB leaves ample headroom. */
|
|
4
|
-
const FEISHU_JSON_MAX_BYTES =
|
|
4
|
+
const FEISHU_JSON_MAX_BYTES = 16777216;
|
|
5
5
|
async function readFeishuJsonResponse(response, label = "feishu.api") {
|
|
6
6
|
return readProviderJsonResponse(response, label, { maxBytes: FEISHU_JSON_MAX_BYTES });
|
|
7
7
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-RwSyseKr.js";
|
|
1
2
|
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
|
|
2
|
-
import { r as registerFeishuAiAgent, t as probeFeishu } from "./probe-
|
|
3
|
+
import { r as registerFeishuAiAgent, t as probeFeishu } from "./probe-Cs1s-qSS.js";
|
|
4
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
4
6
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
5
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -140,4 +142,62 @@ async function fetchBotIdentityForMonitor(account, options = {}) {
|
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
//#endregion
|
|
143
|
-
|
|
145
|
+
//#region extensions/feishu/src/monitor.ts
|
|
146
|
+
const loadMonitorAccountRuntime = createLazyRuntimeModule(() => import("./monitor.account-CuOAmGJf.js"));
|
|
147
|
+
async function monitorFeishuProvider(opts = {}) {
|
|
148
|
+
const cfg = opts.config;
|
|
149
|
+
if (!cfg) throw new Error("Config is required for Feishu monitor");
|
|
150
|
+
const log = opts.runtime?.log ?? console.log;
|
|
151
|
+
if (opts.accountId) {
|
|
152
|
+
const account = resolveFeishuRuntimeAccount({
|
|
153
|
+
cfg,
|
|
154
|
+
accountId: opts.accountId
|
|
155
|
+
}, { requireEventSecrets: true });
|
|
156
|
+
if (!account.enabled || !account.configured) throw new Error(`Feishu account "${opts.accountId}" not configured or disabled`);
|
|
157
|
+
const { monitorSingleAccount } = await loadMonitorAccountRuntime();
|
|
158
|
+
return monitorSingleAccount({
|
|
159
|
+
cfg,
|
|
160
|
+
account,
|
|
161
|
+
channelRuntime: opts.channelRuntime,
|
|
162
|
+
runtime: opts.runtime,
|
|
163
|
+
abortSignal: opts.abortSignal,
|
|
164
|
+
...opts.statusSink ? { statusSink: opts.statusSink } : {}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const accounts = listEnabledFeishuAccounts(cfg);
|
|
168
|
+
if (accounts.length === 0) throw new Error("No enabled Feishu accounts configured");
|
|
169
|
+
log(`feishu: starting ${accounts.length} account(s): ${accounts.map((a) => a.accountId).join(", ")}`);
|
|
170
|
+
const { monitorSingleAccount } = await loadMonitorAccountRuntime();
|
|
171
|
+
const monitorPromises = [];
|
|
172
|
+
for (const account of accounts) {
|
|
173
|
+
if (opts.abortSignal?.aborted) {
|
|
174
|
+
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
const { botOpenId, botName, source } = await fetchBotIdentityForMonitor(account, {
|
|
178
|
+
runtime: opts.runtime,
|
|
179
|
+
abortSignal: opts.abortSignal
|
|
180
|
+
});
|
|
181
|
+
if (opts.abortSignal?.aborted) {
|
|
182
|
+
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
monitorPromises.push(monitorSingleAccount({
|
|
186
|
+
cfg,
|
|
187
|
+
account,
|
|
188
|
+
channelRuntime: opts.channelRuntime,
|
|
189
|
+
runtime: opts.runtime,
|
|
190
|
+
abortSignal: opts.abortSignal,
|
|
191
|
+
botOpenIdSource: {
|
|
192
|
+
kind: "prefetched",
|
|
193
|
+
botOpenId,
|
|
194
|
+
botName,
|
|
195
|
+
source
|
|
196
|
+
},
|
|
197
|
+
...opts.statusSink ? { statusSink: opts.statusSink } : {}
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
await Promise.all(monitorPromises);
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { monitorFeishuProvider, fetchBotIdentityForMonitor as t };
|