@openclaw/feishu 2026.10.1 → 2026.10.5-beta.1

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.
Files changed (116) hide show
  1. package/dist/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
  2. package/dist/.setup/{channel-DoRSlOQd.mjs → channel-CjGGyrdx.mjs} +87 -174
  3. package/dist/.setup/{channel.runtime-jLSFNkJh.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
  4. package/dist/.setup/{chat-mTBvMMvx.mjs → chat-fC3dvxFs.mjs} +16 -28
  5. package/dist/.setup/{client-CcxmEkoy.mjs → client-wwr8PGPH.mjs} +24 -30
  6. package/dist/.setup/{conversation-id-C1ofUfU8.mjs → conversation-id-D00i9uy5.mjs} +5 -10
  7. package/dist/.setup/{doctor-contract-DyOo8NvC.mjs → doctor-contract-oIpUWtNO.mjs} +8 -15
  8. package/dist/.setup/{monitor-DX3vAlY9.mjs → monitor-Yt__BUki.mjs} +33 -54
  9. package/dist/.setup/{monitor.account-C_uDFPtG.mjs → monitor.account-CVz16781.mjs} +377 -664
  10. package/dist/.setup/{probe-BjSykXB8.mjs → probe-DXnFxq5j.mjs} +14 -17
  11. package/dist/.setup/{reply-delivery-result-laBNOmBu.mjs → reply-delivery-result-iCCrdxE1.mjs} +153 -181
  12. package/dist/.setup/{session-conversation-C53IEUWt.mjs → session-conversation-BSBNK5Mq.mjs} +1 -1
  13. package/dist/.setup/{setup-api-DTTsvzfC.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
  14. package/dist/.setup/{subagent-hooks-C8Z_x3KJ.mjs → subagent-hooks-9Pc1-k37.mjs} +7 -17
  15. package/dist/.setup/{thread-bindings-jW2x5VuN.mjs → thread-bindings-DdNLxoL3.mjs} +21 -44
  16. package/dist/api.js +218 -326
  17. package/dist/channel-plugin-api.js +1 -1
  18. package/dist/contract-api.js +1 -1
  19. package/dist/doctor-contract-api.js +1 -1
  20. package/dist/session-binding-contract-api.js +1 -1
  21. package/dist/session-key-api.js +1 -1
  22. package/dist/setup-api.js +1 -1
  23. package/dist/setup-entry.js +1 -1
  24. package/dist/subagent-hooks-api.js +1 -1
  25. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
  26. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  27. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
  28. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
  29. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  30. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  31. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  32. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  33. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  34. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  35. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  36. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  37. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
  38. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
  39. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  40. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  41. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  42. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  43. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  44. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
  45. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  46. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  47. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  48. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
  49. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  50. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  51. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  52. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
  53. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  54. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  55. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  56. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  57. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  58. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  59. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  60. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
  61. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  62. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  63. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  64. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  65. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  66. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  67. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  68. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  69. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  70. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  71. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  72. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  73. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  74. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  75. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  76. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  77. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  78. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  79. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  80. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  81. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  82. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  83. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
  84. package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
  85. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  86. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  87. package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
  88. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  89. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  90. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  91. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  92. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  93. package/node_modules/@openclaw/fs-safe/package.json +15 -15
  94. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  95. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  96. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  97. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  98. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  99. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  100. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  101. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  102. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  103. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  104. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  105. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  106. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  107. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  108. package/node_modules/follow-redirects/index.js +10 -1
  109. package/node_modules/follow-redirects/package.json +1 -1
  110. package/package.json +5 -5
  111. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  112. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  113. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
  114. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
  115. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  116. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
@@ -1,100 +1,83 @@
1
- import { h as resolveFeishuAccount } from "./doctor-contract-DyOo8NvC.mjs";
2
- import { d as listFeishuDirectoryPeers, o as feishuOutbound, u as listFeishuDirectoryGroups } from "./channel-DoRSlOQd.mjs";
3
- import { A as sendMessageFeishu, C as sendStickerFeishu, D as getMessageFeishu, E as editMessageFeishu, Q as assertFeishuApiSuccess, V as createConfiguredFeishuClient, k as sendCardFeishu } from "./reply-delivery-result-laBNOmBu.mjs";
4
- import { r as createFeishuClient } from "./client-CcxmEkoy.mjs";
5
- import { a as getFeishuMemberInfo, i as getChatMembers, n as buildFeishuDirectChatMembers, r as getChatInfo, t as assertFeishuChatMember } from "./chat-mTBvMMvx.mjs";
6
- import { t as probeFeishu } from "./probe-BjSykXB8.mjs";
1
+ import { h as resolveFeishuAccount } from "./doctor-contract-oIpUWtNO.mjs";
2
+ import { d as listFeishuDirectoryPeers, o as feishuOutbound, u as listFeishuDirectoryGroups } from "./channel-CjGGyrdx.mjs";
3
+ import { $ as assertFeishuApiSuccess, A as sendMessageFeishu, C as sendStickerFeishu, D as getMessageFeishu, E as editMessageFeishu, H as createConfiguredFeishuClient, k as sendCardFeishu } from "./reply-delivery-result-iCCrdxE1.mjs";
4
+ import { r as createFeishuClient } from "./client-wwr8PGPH.mjs";
5
+ import { a as getFeishuMemberInfo, i as getChatMembers, n as buildFeishuDirectChatMembers, r as getChatInfo, t as assertFeishuChatMember } from "./chat-fC3dvxFs.mjs";
6
+ import { t as probeFeishu } from "./probe-DXnFxq5j.mjs";
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;
10
- async function listFeishuDirectoryPeersLive(params) {
10
+ async function listFeishuDirectoryLive(params, options) {
11
11
  const account = resolveFeishuAccount({
12
12
  cfg: params.cfg,
13
13
  accountId: params.accountId
14
14
  });
15
- if (!account.configured) return listFeishuDirectoryPeers(params);
15
+ if (!account.configured) return options.fallback(params);
16
+ const label = `Feishu live ${options.kind}`;
16
17
  try {
17
18
  const client = createFeishuClient(account);
18
- const peers = [];
19
+ const entries = [];
19
20
  const limit = params.limit ?? 50;
20
21
  const q = normalizeLowercaseStringOrEmpty(params.query);
21
- const pageSize = q ? 50 : Math.min(limit, 50);
22
+ const peers = options.kind === "peer";
23
+ const pageSize = peers && q ? 50 : Math.min(limit, peers ? 50 : 100);
22
24
  let pageToken;
23
25
  const seenPageTokens = /* @__PURE__ */ new Set();
24
- for (let page = 0; page < MAX_FEISHU_DIRECTORY_PAGES; page += 1) {
25
- const response = await client.contact.user.list({ params: {
26
- page_size: pageSize,
27
- page_token: pageToken
28
- } });
26
+ for (let page = 1; page <= MAX_FEISHU_DIRECTORY_PAGES; page += 1) {
27
+ const response = await options.fetchPage(client, pageSize, pageToken);
29
28
  if (response.code !== 0) throw new Error(response.msg || `code ${response.code}`);
30
- for (const user of response.data?.items ?? []) {
31
- if (user.open_id) {
32
- const name = user.name || "";
33
- if (!q || normalizeLowercaseStringOrEmpty(user.open_id).includes(q) || normalizeLowercaseStringOrEmpty(name).includes(q)) peers.push({
34
- kind: "user",
35
- id: user.open_id,
36
- name: name || void 0
37
- });
29
+ for (const item of response.data?.items ?? []) {
30
+ const entry = options.toEntry(item);
31
+ if (entry && (!q || normalizeLowercaseStringOrEmpty(entry.id).includes(q) || normalizeLowercaseStringOrEmpty(entry.name).includes(q)) && (peers || !params.filter || params.filter(entry))) entries.push(entry);
32
+ if (entries.length >= limit) {
33
+ if (peers) return entries;
34
+ break;
38
35
  }
39
- if (peers.length >= limit) return peers;
40
36
  }
41
- if (!response.data?.has_more) return peers;
42
- const nextPageToken = response.data.page_token;
43
- if (!nextPageToken) throw new Error("Feishu live peer directory returned an empty page token");
44
- if (seenPageTokens.has(nextPageToken)) throw new Error("Feishu live peer directory returned a repeated page token");
37
+ const nextPageToken = response.data?.has_more ? response.data.page_token : void 0;
38
+ if (peers && response.data?.has_more && !nextPageToken) throw new Error(`${label} directory returned an empty page token`);
39
+ if (nextPageToken && seenPageTokens.has(nextPageToken)) throw new Error(`${label} directory returned a repeated page token`);
40
+ if (!nextPageToken) return entries;
45
41
  seenPageTokens.add(nextPageToken);
46
42
  pageToken = nextPageToken;
43
+ if (page === MAX_FEISHU_DIRECTORY_PAGES) throw new Error(`${label} directory pagination limit exceeded`);
44
+ if (!peers && !(entries.length < limit)) return entries;
47
45
  }
48
- throw new Error("Feishu live peer directory pagination limit exceeded");
46
+ throw new Error(`${label} directory pagination limit exceeded`);
49
47
  } catch (err) {
50
- if (params.fallbackToStatic === false) throw err instanceof Error ? err : /* @__PURE__ */ new Error("Feishu live peer lookup failed");
51
- return listFeishuDirectoryPeers(params);
48
+ if (params.fallbackToStatic === false) throw err instanceof Error ? err : /* @__PURE__ */ new Error(`${label} lookup failed`);
49
+ return options.fallback(params);
52
50
  }
53
51
  }
54
- async function listFeishuDirectoryGroupsLive(params) {
55
- const account = resolveFeishuAccount({
56
- cfg: params.cfg,
57
- accountId: params.accountId
52
+ function listFeishuDirectoryPeersLive(params) {
53
+ return listFeishuDirectoryLive(params, {
54
+ kind: "peer",
55
+ fallback: listFeishuDirectoryPeers,
56
+ fetchPage: (client, pageSize, pageToken) => client.contact.user.list({ params: {
57
+ page_size: pageSize,
58
+ page_token: pageToken
59
+ } }),
60
+ toEntry: (user) => user.open_id ? {
61
+ kind: "user",
62
+ id: user.open_id,
63
+ name: user.name || void 0
64
+ } : void 0
65
+ });
66
+ }
67
+ function listFeishuDirectoryGroupsLive(params) {
68
+ return listFeishuDirectoryLive(params, {
69
+ kind: "group",
70
+ fallback: listFeishuDirectoryGroups,
71
+ fetchPage: (client, pageSize, pageToken) => client.im.chat.list({ params: {
72
+ page_size: pageSize,
73
+ page_token: pageToken
74
+ } }),
75
+ toEntry: (chat) => chat.chat_id ? {
76
+ kind: "group",
77
+ id: chat.chat_id,
78
+ name: chat.name || void 0
79
+ } : void 0
58
80
  });
59
- if (!account.configured) return listFeishuDirectoryGroups(params);
60
- try {
61
- const client = createFeishuClient(account);
62
- const groups = [];
63
- const limit = params.limit ?? 50;
64
- const q = normalizeLowercaseStringOrEmpty(params.query);
65
- let pageToken;
66
- let pages = 0;
67
- const seenPageTokens = /* @__PURE__ */ new Set();
68
- do {
69
- const response = await client.im.chat.list({ params: {
70
- page_size: Math.min(limit, 100),
71
- page_token: pageToken
72
- } });
73
- if (response.code !== 0) throw new Error(response.msg || `code ${response.code}`);
74
- for (const chat of response.data?.items ?? []) {
75
- if (chat.chat_id) {
76
- const name = chat.name || "";
77
- const group = {
78
- kind: "group",
79
- id: chat.chat_id,
80
- name: name || void 0
81
- };
82
- if ((!q || normalizeLowercaseStringOrEmpty(chat.chat_id).includes(q) || normalizeLowercaseStringOrEmpty(name).includes(q)) && (!params.filter || params.filter(group))) groups.push(group);
83
- }
84
- if (groups.length >= limit) break;
85
- }
86
- pages += 1;
87
- const nextPageToken = response.data?.has_more ? response.data.page_token : void 0;
88
- if (nextPageToken && seenPageTokens.has(nextPageToken)) throw new Error("Feishu live group directory returned a repeated page token");
89
- if (nextPageToken) seenPageTokens.add(nextPageToken);
90
- pageToken = nextPageToken;
91
- } while (pageToken && groups.length < limit && pages < MAX_FEISHU_DIRECTORY_PAGES);
92
- if (pageToken && pages >= MAX_FEISHU_DIRECTORY_PAGES) throw new Error("Feishu live group directory pagination limit exceeded");
93
- return groups;
94
- } catch (err) {
95
- if (params.fallbackToStatic === false) throw err instanceof Error ? err : /* @__PURE__ */ new Error("Feishu live group lookup failed");
96
- return listFeishuDirectoryGroups(params);
97
- }
98
81
  }
99
82
  //#endregion
100
83
  //#region extensions/feishu/src/pins.ts
@@ -1,5 +1,5 @@
1
- import { Ct as readFeishuChatInfoWithAuthorization, J as feishuExternalToolResult, Pt as resolveFeishuChatType, Q as assertFeishuApiSuccess, Z as resolveFeishuToolAccount, _t as assertFeishuChatReadAllowed, q as registerFeishuTool, rt as formatFeishuApiError, vt as authorizeFeishuChatMemberRead, wt as resolveFeishuChatReadPreliminaryAuthorization } from "./reply-delivery-result-laBNOmBu.mjs";
2
- import { r as createFeishuClient } from "./client-CcxmEkoy.mjs";
1
+ import { $ as assertFeishuApiSuccess, Ft as resolveFeishuChatType, J as registerFeishuTool, Q as resolveFeishuToolAccount, Tt as resolveFeishuChatReadPreliminaryAuthorization, Y as feishuExternalToolResult, it as formatFeishuApiError, vt as assertFeishuChatReadAllowed, wt as readFeishuChatInfoWithAuthorization, yt as authorizeFeishuChatMemberRead } from "./reply-delivery-result-iCCrdxE1.mjs";
2
+ import { r as createFeishuClient } from "./client-wwr8PGPH.mjs";
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";
@@ -63,26 +63,6 @@ async function getChatInfo(client, chatId) {
63
63
  avatar: chat?.avatar
64
64
  };
65
65
  }
66
- async function getAuthorizedFeishuChatInfo(params) {
67
- const preliminary = resolveFeishuChatReadPreliminaryAuthorization({
68
- cfg: params.cfg,
69
- account: params.account,
70
- chatId: params.chatId,
71
- ctx: params.ctx
72
- });
73
- if (preliminary.decision === "deny") assertFeishuChatReadAllowed({
74
- cfg: params.cfg,
75
- account: params.account,
76
- chatId: preliminary.chatId,
77
- ctx: params.ctx
78
- });
79
- return readFeishuChatInfoWithAuthorization({
80
- cfg: params.cfg,
81
- account: params.account,
82
- ctx: params.ctx,
83
- preliminary
84
- }, (chatId) => getChatInfo(params.client, chatId));
85
- }
86
66
  async function getChatMembers(client, chatId, pageSize, pageToken, memberIdType) {
87
67
  const page_size = pageSize ? Math.max(1, Math.min(100, pageSize)) : 50;
88
68
  const res = await client.im.chatMembers.get({
@@ -185,20 +165,28 @@ function registerFeishuChatTools(api) {
185
165
  }
186
166
  if (p.action === "member_info" && !p.member_id) return feishuExternalToolResult({ error: "member_id is required for action member_info" });
187
167
  if (!p.chat_id) return feishuExternalToolResult({ error: `chat_id is required for action ${p.action}` });
188
- const chat = await getAuthorizedFeishuChatInfo({
189
- client,
168
+ const readContext = {
190
169
  cfg,
191
170
  account,
192
- chatId: p.chat_id,
193
171
  ctx
172
+ };
173
+ const preliminary = resolveFeishuChatReadPreliminaryAuthorization({
174
+ ...readContext,
175
+ chatId: p.chat_id
194
176
  });
177
+ if (preliminary.decision === "deny") assertFeishuChatReadAllowed({
178
+ ...readContext,
179
+ chatId: preliminary.chatId
180
+ });
181
+ const chat = await readFeishuChatInfoWithAuthorization({
182
+ ...readContext,
183
+ preliminary
184
+ }, (chatId) => getChatInfo(client, chatId));
195
185
  if (p.action === "info") return feishuExternalToolResult(chat);
196
186
  const authorization = authorizeFeishuChatMemberRead({
197
- cfg,
198
- account,
187
+ ...readContext,
199
188
  chatId: p.chat_id,
200
189
  chatType: resolveFeishuChatType(chat),
201
- ctx,
202
190
  memberId: p.action === "member_info" ? p.member_id : void 0,
203
191
  memberIdType: p.member_id_type
204
192
  });
@@ -1,32 +1,20 @@
1
- import { _ as __exportAll } from "./doctor-contract-DyOo8NvC.mjs";
1
+ import { _ as __exportAll } from "./doctor-contract-oIpUWtNO.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { PlatformMessageNotDispatchedError } from "openclaw/plugin-sdk/error-runtime";
4
- import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
4
+ import { asPositiveFiniteNumber, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
5
5
  import * as Lark from "@larksuiteoapi/node-sdk";
6
6
  import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
7
7
  import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
8
8
  import { readPluginPackageVersion, resolveAmbientNodeProxyAgent } from "openclaw/plugin-sdk/extension-shared";
9
- import { captureChannelReadAuthority } from "openclaw/plugin-sdk/fetch-runtime";
9
+ import { captureChannelReadAuthority, captureEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
11
11
  //#region extensions/feishu/src/client-timeout.ts
12
- /** Default HTTP timeout for Feishu API requests (30 seconds). */
13
12
  const FEISHU_HTTP_TIMEOUT_MS = 3e4;
14
13
  const FEISHU_HTTP_TIMEOUT_MAX_MS = 3e5;
15
14
  const FEISHU_HTTP_TIMEOUT_ENV_VAR = "OPENCLAW_FEISHU_HTTP_TIMEOUT_MS";
16
15
  function resolveConfiguredHttpTimeoutMs(creds) {
17
- const clampTimeout = (value) => {
18
- return Math.min(Math.max(Math.floor(value), 1), FEISHU_HTTP_TIMEOUT_MAX_MS);
19
- };
20
- const fromDirectField = creds.httpTimeoutMs;
21
- if (typeof fromDirectField === "number" && Number.isFinite(fromDirectField) && fromDirectField > 0) return clampTimeout(fromDirectField);
22
- const envRaw = process.env[FEISHU_HTTP_TIMEOUT_ENV_VAR];
23
- if (envRaw) {
24
- const envValue = parseStrictPositiveInteger(envRaw);
25
- if (envValue !== void 0) return clampTimeout(envValue);
26
- }
27
- const timeout = creds.config?.httpTimeoutMs;
28
- if (typeof timeout !== "number" || !Number.isFinite(timeout) || timeout <= 0) return FEISHU_HTTP_TIMEOUT_MS;
29
- return clampTimeout(timeout);
16
+ const timeout = asPositiveFiniteNumber(creds.httpTimeoutMs) ?? parseStrictPositiveInteger(process.env[FEISHU_HTTP_TIMEOUT_ENV_VAR]) ?? asPositiveFiniteNumber(creds.config?.httpTimeoutMs) ?? 3e4;
17
+ return Math.min(Math.max(Math.floor(timeout), 1), FEISHU_HTTP_TIMEOUT_MAX_MS);
30
18
  }
31
19
  //#endregion
32
20
  //#region extensions/feishu/src/send-context.ts
@@ -91,7 +79,6 @@ const require = createRequire(import.meta.url);
91
79
  const FEISHU_USER_AGENT = `openclaw-feishu-builtin/${readPluginPackageVersion({ require })}/${process.platform}`;
92
80
  const FEISHU_SDK_ORIGIN = "https://open.feishu.cn";
93
81
  const FEISHU_WS_CONFIG = { pingTimeout: 3 };
94
- /** User-Agent header value for all Feishu API requests. */
95
82
  function getFeishuUserAgent() {
96
83
  return FEISHU_USER_AGENT;
97
84
  }
@@ -286,15 +273,25 @@ function createFeishuHttpInstance(defaultTimeoutMs, configuredDomain) {
286
273
  throw error;
287
274
  }
288
275
  }
276
+ async function dispatch(authority, options, send) {
277
+ const effect = captureEffectAuthority();
278
+ const prepared = await injectRequestOptions(options, authority);
279
+ return effect.initiate(() => {
280
+ authority?.assertCurrent();
281
+ return send(prepared);
282
+ });
283
+ }
284
+ const createMethod = (method) => (url, opts) => runRequest((authority) => dispatch(authority, opts, (prepared) => base[method](resolveRequestUrl(url), prepared)));
285
+ const createDataMethod = (method) => (url, data, opts) => runRequest((authority) => dispatch(authority, opts, (prepared) => base[method](resolveRequestUrl(url), data, prepared)));
289
286
  return {
290
- request: (opts) => runRequest(async (authority) => base.request(await injectRequestOptions(normalizeMultipartUploadData(opts), authority)), "request"),
291
- get: (url, opts) => runRequest(async (assert) => base.get(resolveRequestUrl(url), await injectRequestOptions(opts, assert))),
292
- post: (url, data, opts) => runRequest(async (assert) => base.post(resolveRequestUrl(url), data, await injectRequestOptions(opts, assert))),
293
- put: (url, data, opts) => runRequest(async (assert) => base.put(resolveRequestUrl(url), data, await injectRequestOptions(opts, assert))),
294
- patch: (url, data, opts) => runRequest(async (assert) => base.patch(resolveRequestUrl(url), data, await injectRequestOptions(opts, assert))),
295
- delete: (url, opts) => runRequest(async (assert) => base.delete(resolveRequestUrl(url), await injectRequestOptions(opts, assert))),
296
- head: (url, opts) => runRequest(async (assert) => base.head(resolveRequestUrl(url), await injectRequestOptions(opts, assert))),
297
- options: (url, opts) => runRequest(async (assert) => base.options(resolveRequestUrl(url), await injectRequestOptions(opts, assert)))
287
+ request: (opts) => runRequest((authority) => dispatch(authority, normalizeMultipartUploadData(opts), (prepared) => base.request(prepared)), "request"),
288
+ get: createMethod("get"),
289
+ post: createDataMethod("post"),
290
+ put: createDataMethod("put"),
291
+ patch: createDataMethod("patch"),
292
+ delete: createMethod("delete"),
293
+ head: createMethod("head"),
294
+ options: createMethod("options")
298
295
  };
299
296
  }
300
297
  function createFeishuClient(creds) {
@@ -321,10 +318,7 @@ function createFeishuClient(creds) {
321
318
  });
322
319
  return client;
323
320
  }
324
- /**
325
- * Create a Feishu WebSocket client for an account.
326
- * Note: WSClient is not cached since each call creates a new connection.
327
- */
321
+ /** WSClient is not cached since each call creates a new connection. */
328
322
  async function createFeishuWSClient(account, callbacks = {}) {
329
323
  const { accountId, appId, appSecret, domain } = account;
330
324
  if (!appId || !appSecret) throw new Error(`Feishu credentials not configured for account "${accountId}"`);
@@ -22,7 +22,7 @@ function normalizeFeishuTarget(raw) {
22
22
  }
23
23
  function resolveReceiveIdType(id) {
24
24
  const trimmed = id.trim();
25
- const lowered = normalizeLowercaseStringOrEmpty(trimmed);
25
+ const lowered = trimmed.toLowerCase();
26
26
  if (lowered.startsWith("chat:") || lowered.startsWith("group:") || lowered.startsWith("channel:")) return "chat_id";
27
27
  if (lowered.startsWith("open_id:")) return "open_id";
28
28
  if (lowered.startsWith("user:") || lowered.startsWith("dm:")) return trimmed.replace(/^(user|dm):/i, "").trim().startsWith(OPEN_ID_PREFIX) ? "open_id" : "user_id";
@@ -53,15 +53,10 @@ function buildFeishuConversationId(params) {
53
53
  const chatId = normalizeOptionalString(params.chatId) ?? "unknown";
54
54
  const senderOpenId = normalizeOptionalString(params.senderOpenId);
55
55
  const topicId = normalizeOptionalString(params.topicId);
56
- switch (params.scope) {
57
- case "group_sender": return senderOpenId ? `${chatId}:sender:${senderOpenId}` : chatId;
58
- case "group_topic": return topicId ? `${chatId}:topic:${topicId}` : chatId;
59
- case "group_topic_sender":
60
- if (topicId && senderOpenId) return `${chatId}:topic:${topicId}:sender:${senderOpenId}`;
61
- if (topicId) return `${chatId}:topic:${topicId}`;
62
- return senderOpenId ? `${chatId}:sender:${senderOpenId}` : chatId;
63
- default: return chatId;
64
- }
56
+ let conversationId = chatId;
57
+ if (topicId && (params.scope === "group_topic" || params.scope === "group_topic_sender")) conversationId += `:topic:${topicId}`;
58
+ if (senderOpenId && (params.scope === "group_sender" || params.scope === "group_topic_sender")) conversationId += `:sender:${senderOpenId}`;
59
+ return conversationId;
65
60
  }
66
61
  function parseFeishuTargetId(raw) {
67
62
  const target = normalizeOptionalString(raw);
@@ -161,10 +161,10 @@ function inspectFeishuCredentials(cfg, rootConfig) {
161
161
  });
162
162
  }
163
163
  function buildResolvedFeishuAccount(params) {
164
- const hasExplicitAccountId = typeof params.accountId === "string" && params.accountId.trim() !== "";
165
- const defaultSelection = hasExplicitAccountId ? null : resolveDefaultFeishuAccountSelection(params.cfg);
166
- const accountId = hasExplicitAccountId ? normalizeAccountId(params.accountId) : defaultSelection?.accountId ?? DEFAULT_ACCOUNT_ID;
167
- const selectionSource = hasExplicitAccountId ? "explicit" : defaultSelection?.source ?? "fallback";
164
+ const { accountId, source: selectionSource } = typeof params.accountId === "string" && params.accountId.trim() !== "" ? {
165
+ accountId: normalizeAccountId(params.accountId),
166
+ source: "explicit"
167
+ } : resolveDefaultFeishuAccountSelection(params.cfg);
168
168
  const feishuCfg = params.cfg.channels?.feishu;
169
169
  const merged = mergeFeishuAccountConfig(params.cfg, accountId);
170
170
  const baseCreds = resolveFeishuBaseCredentials(merged, params.baseMode, params.cfg);
@@ -226,14 +226,10 @@ const DEFAULT_FEISHU_WEBHOOK_PATH = "/feishu/events";
226
226
  function normalizeFeishuWebhookPath(value) {
227
227
  const configured = value?.trim();
228
228
  if (!configured) return DEFAULT_FEISHU_WEBHOOK_PATH;
229
- try {
230
- const parsed = new URL(configured, "http://localhost");
231
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
232
- const emptyQuery = !parsed.search && parsed.href.endsWith("?") && !configured.includes("#") ? "?" : "";
233
- return `${parsed.pathname}${parsed.search}${emptyQuery}`;
234
- } catch {
235
- return null;
236
- }
229
+ const parsed = URL.parse(configured, "http://localhost");
230
+ if (!parsed || parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
231
+ const emptyQuery = !parsed.search && parsed.href.endsWith("?") && !configured.includes("#") ? "?" : "";
232
+ return `${parsed.pathname}${parsed.search}${emptyQuery}`;
237
233
  }
238
234
  //#endregion
239
235
  //#region extensions/feishu/src/config-schema.ts
@@ -315,9 +311,6 @@ const DynamicAgentCreationSchema = z.object({
315
311
  maxAgents: z.number().int().positive().optional()
316
312
  }).strict().optional();
317
313
  /**
318
- * Feishu tools configuration.
319
- * Controls which tool categories are enabled.
320
- *
321
314
  * Dependencies:
322
315
  * - wiki requires doc (wiki content is edited via doc tools)
323
316
  * - perm can work independently but is typically used with drive
@@ -1,6 +1,6 @@
1
- import { d as listEnabledFeishuAccounts, g as resolveFeishuRuntimeAccount } from "./doctor-contract-DyOo8NvC.mjs";
1
+ import { d as listEnabledFeishuAccounts, g as resolveFeishuRuntimeAccount } from "./doctor-contract-oIpUWtNO.mjs";
2
2
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.mjs";
3
- import { r as registerFeishuAiAgent, t as probeFeishu } from "./probe-BjSykXB8.mjs";
3
+ import { r as registerFeishuAiAgent, t as probeFeishu } from "./probe-DXnFxq5j.mjs";
4
4
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
5
5
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
6
6
  import { clampTimerTimeoutMs, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
@@ -69,43 +69,6 @@ function resolveStartupProbeTimeoutMs(env = process.env) {
69
69
  //#endregion
70
70
  //#region extensions/feishu/src/monitor.startup.ts
71
71
  const FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS = resolveStartupProbeTimeoutMs();
72
- function isTimeoutErrorMessage(message) {
73
- const lower = normalizeLowercaseStringOrEmpty(message);
74
- return lower.includes("timeout") || lower.includes("timed out");
75
- }
76
- function isAbortErrorMessage(message) {
77
- return normalizeLowercaseStringOrEmpty(message).includes("aborted");
78
- }
79
- async function writeProviderBotIdentityCache(params) {
80
- try {
81
- await writeCachedFeishuBotIdentity({
82
- accountId: params.account.accountId,
83
- appId: params.account.appId,
84
- botOpenId: params.botOpenId,
85
- botName: params.botName
86
- });
87
- } catch {
88
- params.runtime?.log?.(`feishu[${params.account.accountId}]: bot identity cache write failed; continuing startup`);
89
- }
90
- }
91
- async function readProviderBotIdentityCache(params) {
92
- try {
93
- const cached = await readCachedFeishuBotIdentity({
94
- accountId: params.account.accountId,
95
- appId: params.account.appId
96
- });
97
- if (!cached) return {};
98
- params.runtime?.log?.(`feishu[${params.account.accountId}]: using cached provider-verified bot identity while the fresh probe is unavailable`);
99
- return {
100
- botOpenId: cached.botOpenId,
101
- botName: cached.botName,
102
- source: "cache"
103
- };
104
- } catch {
105
- params.runtime?.log?.(`feishu[${params.account.accountId}]: bot identity cache read failed; continuing without cached identity`);
106
- return {};
107
- }
108
- }
109
72
  async function fetchBotIdentityForMonitor(account, options = {}) {
110
73
  if (options.abortSignal?.aborted) return {};
111
74
  const timeoutMs = FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS;
@@ -120,31 +83,47 @@ async function fetchBotIdentityForMonitor(account, options = {}) {
120
83
  }).catch(() => {
121
84
  (options.runtime?.log ?? console.log)(`feishu[${account.accountId}]: AI-agent registration failed unexpectedly; continuing with standard bot identity`);
122
85
  });
123
- await writeProviderBotIdentityCache({
124
- account,
125
- botOpenId: result.botOpenId,
126
- botName: result.botName,
127
- runtime: options.runtime
128
- });
86
+ try {
87
+ await writeCachedFeishuBotIdentity({
88
+ accountId: account.accountId,
89
+ appId: account.appId,
90
+ botOpenId: result.botOpenId,
91
+ botName: result.botName
92
+ });
93
+ } catch {
94
+ options.runtime?.log?.(`feishu[${account.accountId}]: bot identity cache write failed; continuing startup`);
95
+ }
129
96
  return {
130
97
  botOpenId: normalizeOptionalString(result.botOpenId),
131
98
  botName: normalizeOptionalString(result.botName),
132
99
  source: "provider"
133
100
  };
134
101
  }
135
- if (result.ok) (options.runtime?.log ?? console.log)(`feishu[${account.accountId}]: bot info probe returned identity for a different app; ignoring stale result`);
136
- const probeError = result.error ?? void 0;
137
- if (options.abortSignal?.aborted || isAbortErrorMessage(probeError)) return {};
138
- if (isTimeoutErrorMessage(probeError)) (options.runtime?.error ?? console.error)(`feishu[${account.accountId}]: bot info probe timed out after ${timeoutMs}ms; continuing startup`);
102
+ if (result.ok) (options.runtime?.log ?? console.log)(`feishu[${account.accountId}]: bot info check returned identity for a different app; ignoring stale result`);
103
+ const probeError = normalizeLowercaseStringOrEmpty(result.error);
104
+ if (options.abortSignal?.aborted || probeError.includes("aborted")) return {};
105
+ if (probeError.includes("timeout") || probeError.includes("timed out")) (options.runtime?.error ?? console.error)(`feishu[${account.accountId}]: bot info check timed out after ${timeoutMs}ms; continuing startup`);
139
106
  if (options.allowCachedFallback === false) return {};
140
- return readProviderBotIdentityCache({
141
- account,
142
- runtime: options.runtime
143
- });
107
+ try {
108
+ const cached = await readCachedFeishuBotIdentity({
109
+ accountId: account.accountId,
110
+ appId: account.appId
111
+ });
112
+ if (!cached) return {};
113
+ options.runtime?.log?.(`feishu[${account.accountId}]: using cached provider-verified bot identity while the fresh check is unavailable`);
114
+ return {
115
+ botOpenId: cached.botOpenId,
116
+ botName: cached.botName,
117
+ source: "cache"
118
+ };
119
+ } catch {
120
+ options.runtime?.log?.(`feishu[${account.accountId}]: bot identity cache read failed; continuing without cached identity`);
121
+ return {};
122
+ }
144
123
  }
145
124
  //#endregion
146
125
  //#region extensions/feishu/src/monitor.ts
147
- const loadMonitorAccountRuntime = createLazyRuntimeModule(() => import("./monitor.account-C_uDFPtG.mjs"));
126
+ const loadMonitorAccountRuntime = createLazyRuntimeModule(() => import("./monitor.account-CVz16781.mjs"));
148
127
  async function monitorFeishuProvider(opts = {}) {
149
128
  const cfg = opts.config;
150
129
  if (!cfg) throw new Error("Config is required for Feishu monitor");