@openclaw/feishu 2026.10.1-beta.2 → 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 (151) hide show
  1. package/dist/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
  2. package/dist/.setup/{channel-CX62T71S.mjs → channel-CjGGyrdx.mjs} +87 -174
  3. package/dist/.setup/{channel.runtime-COiaq-Rv.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
  4. package/dist/.setup/{chat-BdyvImsY.mjs → chat-fC3dvxFs.mjs} +16 -28
  5. package/dist/.setup/{client-BsBVWJzN.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-B1B9ogdd.mjs → doctor-contract-oIpUWtNO.mjs} +23 -20
  8. package/dist/.setup/{monitor-7DvwUs4Y.mjs → monitor-Yt__BUki.mjs} +33 -54
  9. package/dist/.setup/{monitor.account-7xVu7XWY.mjs → monitor.account-CVz16781.mjs} +377 -664
  10. package/dist/.setup/{probe-B9o7iey6.mjs → probe-DXnFxq5j.mjs} +14 -17
  11. package/dist/.setup/{reply-delivery-result-Bt-BWBEA.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-DmzX9S01.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
  14. package/dist/.setup/{subagent-hooks-CUXg0pC-.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 +2 -2
  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 +91 -0
  26. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  27. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -0
  28. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
  29. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  30. package/node_modules/@openclaw/fs-safe/dist/archive-entry.js +7 -3
  31. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  32. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  33. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  34. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  35. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  36. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  37. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  38. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +38 -0
  39. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +195 -0
  40. package/node_modules/@openclaw/fs-safe/dist/create.d.ts +1 -0
  41. package/node_modules/@openclaw/fs-safe/dist/create.js +4 -1
  42. package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +3 -1
  43. package/node_modules/@openclaw/fs-safe/dist/errors.d.ts +2 -0
  44. package/node_modules/@openclaw/fs-safe/dist/errors.js +5 -0
  45. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  46. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  47. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  48. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  49. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  50. package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -1
  51. package/node_modules/@openclaw/fs-safe/dist/index.js +1 -1
  52. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +4 -0
  53. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.d.ts +3 -0
  54. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.js +54 -0
  55. package/node_modules/@openclaw/fs-safe/dist/native-noreplace.d.ts +8 -0
  56. package/node_modules/@openclaw/fs-safe/dist/native-noreplace.js +55 -0
  57. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  58. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  59. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  60. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.d.ts +1 -1
  61. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +12 -2
  62. package/node_modules/@openclaw/fs-safe/dist/native-rename-outcome.js +3 -1
  63. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +1 -1
  64. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +52 -6
  65. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  66. package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.d.ts +2 -0
  67. package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.js +17 -0
  68. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  69. package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +1 -1
  70. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  71. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.d.ts +5 -0
  72. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.js +1 -0
  73. package/node_modules/@openclaw/fs-safe/dist/publish-file.d.ts +2 -0
  74. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +35 -2
  75. package/node_modules/@openclaw/fs-safe/dist/replace-directory.js +6 -5
  76. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  77. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  78. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  79. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  80. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  81. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  82. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  83. package/node_modules/@openclaw/fs-safe/dist/root-errors.js +25 -4
  84. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +18 -18
  85. package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.d.ts +4 -2
  86. package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +13 -17
  87. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  88. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  89. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  90. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  91. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  92. package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +18 -3
  93. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  94. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  95. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  96. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  97. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  98. package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.js +4 -1
  99. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  100. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  101. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  102. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  103. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  104. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  105. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  106. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.d.ts +1 -0
  107. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.js +27 -4
  108. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  109. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  110. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  111. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  112. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  113. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -0
  114. package/node_modules/@openclaw/fs-safe/docs/archive.md +5 -1
  115. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  116. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  117. package/node_modules/@openclaw/fs-safe/docs/copy.md +109 -1
  118. package/node_modules/@openclaw/fs-safe/docs/durability.md +50 -5
  119. package/node_modules/@openclaw/fs-safe/docs/errors.md +37 -0
  120. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  121. package/node_modules/@openclaw/fs-safe/docs/native-helper.md +5 -3
  122. package/node_modules/@openclaw/fs-safe/docs/native.md +39 -6
  123. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  124. package/node_modules/@openclaw/fs-safe/docs/public-api.md +3 -1
  125. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  126. package/node_modules/@openclaw/fs-safe/docs/staged-file.md +10 -3
  127. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  128. package/node_modules/@openclaw/fs-safe/docs/watch.md +6 -3
  129. package/node_modules/@openclaw/fs-safe/docs/writing.md +40 -11
  130. package/node_modules/@openclaw/fs-safe/package.json +16 -16
  131. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  132. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  133. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  134. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  135. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  136. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  137. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  138. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  139. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  140. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  141. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  142. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  143. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  144. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  145. package/node_modules/follow-redirects/index.js +10 -1
  146. package/node_modules/follow-redirects/package.json +1 -1
  147. package/package.json +5 -5
  148. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  149. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  150. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  151. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
@@ -13,28 +13,22 @@ const DEFAULT_REGISTRATION_EXPIRE_SECONDS = 600;
13
13
  function accountsBaseUrl(domain) {
14
14
  return domain === "lark" ? LARK_ACCOUNTS_URL : FEISHU_ACCOUNTS_URL;
15
15
  }
16
- async function postRegistration(baseUrl, body, options) {
17
- return await fetchFeishuJson({
16
+ async function postRegistration(baseUrl, body) {
17
+ return fetchFeishuJson({
18
18
  url: `${baseUrl}${REGISTRATION_PATH}`,
19
19
  init: {
20
20
  method: "POST",
21
21
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
22
22
  body: new URLSearchParams(body).toString()
23
23
  },
24
- auditContext: "feishu.app-registration.post",
25
- fetchImpl: options?.fetchImpl,
26
- lookupFn: options?.lookupFn,
27
- timeoutMs: options?.timeoutMs
24
+ auditContext: "feishu.app-registration.post"
28
25
  });
29
26
  }
30
27
  async function fetchFeishuJson(params) {
31
- const timeoutMs = params.timeoutMs ?? APP_REGISTRATION_REQUEST_TIMEOUT_MS;
32
28
  const { response, release } = await fetchWithSsrFGuard({
33
29
  url: params.url,
34
30
  init: params.init,
35
- fetchImpl: params.fetchImpl,
36
- lookupFn: params.lookupFn,
37
- timeoutMs,
31
+ timeoutMs: APP_REGISTRATION_REQUEST_TIMEOUT_MS,
38
32
  policy: { allowedHostnames: [new URL(params.url).hostname] },
39
33
  auditContext: params.auditContext
40
34
  });
@@ -44,26 +38,20 @@ async function fetchFeishuJson(params) {
44
38
  await release();
45
39
  }
46
40
  }
47
- /**
48
- * Step 1: Initialize registration and verify the environment supports
49
- * `client_secret` auth.
50
- *
51
- * @throws If the environment does not support `client_secret`.
52
- */
53
- async function initAppRegistration(domain = "feishu", options) {
54
- if (!(await postRegistration(accountsBaseUrl(domain), { action: "init" }, options)).supported_auth_methods?.includes("client_secret")) throw new Error("Current environment does not support client_secret auth method");
41
+ async function initAppRegistration(domain = "feishu") {
42
+ if (!(await postRegistration(accountsBaseUrl(domain), { action: "init" })).supported_auth_methods?.includes("client_secret")) throw new Error("Current environment does not support client_secret auth method");
55
43
  }
56
44
  /**
57
45
  * Step 2: Begin the device-code flow. Returns a device code and a QR URL
58
46
  * that the user should scan with Feishu/Lark mobile app.
59
47
  */
60
- async function beginAppRegistration(domain = "feishu", options) {
48
+ async function beginAppRegistration(domain = "feishu") {
61
49
  const res = await postRegistration(accountsBaseUrl(domain), {
62
50
  action: "begin",
63
51
  archetype: "PersonalAgent",
64
52
  auth_method: "client_secret",
65
53
  request_user_info: "open_id"
66
- }, options);
54
+ });
67
55
  const qrUrl = new URL(res.verification_uri_complete);
68
56
  qrUrl.searchParams.set("from", "oc_onboard");
69
57
  qrUrl.searchParams.set("tp", "ob_cli_app");
@@ -81,7 +69,7 @@ async function beginAppRegistration(domain = "feishu", options) {
81
69
  * detected as "lark".
82
70
  */
83
71
  async function pollAppRegistration(params) {
84
- const { deviceCode, expireIn, initialDomain = "feishu", abortSignal, tp, fetchImpl, lookupFn } = params;
72
+ const { deviceCode, expireIn, initialDomain = "feishu", abortSignal, tp } = params;
85
73
  let currentInterval = params.interval;
86
74
  let domain = initialDomain;
87
75
  let domainSwitched = false;
@@ -96,9 +84,6 @@ async function pollAppRegistration(params) {
96
84
  action: "poll",
97
85
  device_code: deviceCode,
98
86
  ...tp ? { tp } : {}
99
- }, {
100
- fetchImpl,
101
- lookupFn
102
87
  });
103
88
  } catch {
104
89
  await sleepRegistrationPollInterval(currentInterval, abortSignal);
@@ -118,8 +103,8 @@ async function pollAppRegistration(params) {
118
103
  openId: pollRes.user_info?.open_id
119
104
  }
120
105
  };
121
- if (pollRes.error) {
122
- if (pollRes.error === "authorization_pending") {} else if (pollRes.error === "slow_down") currentInterval += 5;
106
+ if (pollRes.error && pollRes.error !== "authorization_pending") {
107
+ if (pollRes.error === "slow_down") currentInterval += 5;
123
108
  else if (pollRes.error === "access_denied") return { status: "access_denied" };
124
109
  else if (pollRes.error === "expired_token") return { status: "expired" };
125
110
  else return {
@@ -160,9 +145,7 @@ async function getAppOwnerOpenId(params) {
160
145
  app_secret: params.appSecret
161
146
  })
162
147
  },
163
- auditContext: "feishu.app-registration.owner-token",
164
- fetchImpl: params.fetchImpl,
165
- lookupFn: params.lookupFn
148
+ auditContext: "feishu.app-registration.owner-token"
166
149
  });
167
150
  if (!tokenData.tenant_access_token) return;
168
151
  const appData = await fetchFeishuJson({
@@ -174,9 +157,7 @@ async function getAppOwnerOpenId(params) {
174
157
  "Content-Type": "application/json"
175
158
  }
176
159
  },
177
- auditContext: "feishu.app-registration.owner-app",
178
- fetchImpl: params.fetchImpl,
179
- lookupFn: params.lookupFn
160
+ auditContext: "feishu.app-registration.owner-app"
180
161
  });
181
162
  if (appData.code !== 0) return;
182
163
  const app = appData.data?.app;
@@ -1,12 +1,12 @@
1
- import { _ as __reExport, a as DEFAULT_FEISHU_WEBHOOK_PATH, d as listFeishuAccountIds, f as mergeFeishuAccountConfig, g as __exportAll, h as resolveFeishuRuntimeAccount, i as FeishuChannelConfigSchema, l as inspectFeishuCredentials, m as resolveFeishuAccount, n as legacyConfigRules, o as normalizeFeishuWebhookPath, p as resolveDefaultFeishuAccountId, r as normalizeCompatibilityConfig, s as normalizeFeishuExternalKey, u as listEnabledFeishuAccounts } from "./doctor-contract-B1B9ogdd.mjs";
2
- import { a as parseFeishuTargetId, c as looksLikeFeishuId, i as parseFeishuDirectConversationId, l as normalizeFeishuTarget, n as buildFeishuModelOverrideParentCandidates, o as resolveConfiguredFeishuGroupSessionScope, r as parseFeishuConversationId, t as buildFeishuConversationId, u as resolveReceiveIdType } from "./conversation-id-C1ofUfU8.mjs";
3
- import { $ as cleanupAmbientCommentTypingReaction, A as sendMessageFeishu, Ct as readFeishuChatInfoWithAuthorization, G as deliverCommentThreadText, H as buildFeishuMediaFallbackText, M as toFeishuMessageSendResult, Nt as normalizeFeishuChatType, Ot as resolveFeishuGroupConfig, Pt as resolveFeishuChatType, S as sendMediaFeishu, St as isFeishuGroupReadEnabled, T as chunkFeishuCardMarkdown, W as resolveFeishuIdentityHeaderTitle, _ as renderFeishuPresentationPayload, _t as assertFeishuChatReadAllowed, b as withinCardTableLimit, bt as canEnumerateAllFeishuPeers, c as buildFeishuPayloadCard, ct as parseFeishuCommentTarget, d as consumeFeishuPresentationFallbackMarker, dt as chunkFeishuMarkdown, f as feishuCardWithinTableLimit, ft as chunkFeishuPostMarkdown, g as renderFeishuPresentationFallbackText, h as readNativeFeishuCard, ht as shouldUseFeishuCard, j as sendStructuredCardFeishu, jt as resolveFeishuGroupToolPolicy, k as sendCardFeishu, l as buildFeishuPresentationCard, lt as readNativeFeishuCardJson, m as markRenderedFeishuCard, n as createFeishuReplyDeliveryResult, o as FEISHU_PRESENTATION_CAPABILITIES, p as isFeishuCardWithinEnvelope, pt as materializeFeishuPostMarkdownSoftBreaks, s as assertFeishuCardWithinEnvelope, t as createFeishuPartialReplyDeliveryError, u as buildFeishuPresentationFallback, vt as authorizeFeishuChatMemberRead, w as shouldSuppressFeishuTextForVoiceMedia, wt as resolveFeishuChatReadPreliminaryAuthorization, xt as isFeishuGroupReadAllowed, y as resolveFeishuRichReply, yt as canEnumerateAllFeishuGroups } from "./reply-delivery-result-Bt-BWBEA.mjs";
1
+ import { _ as __exportAll, a as FeishuChannelConfigSchema, c as normalizeFeishuExternalKey, d as listEnabledFeishuAccounts, f as listFeishuAccountIds, g as resolveFeishuRuntimeAccount, h as resolveFeishuAccount, m as resolveDefaultFeishuAccountId, n as legacyConfigRules, o as DEFAULT_FEISHU_WEBHOOK_PATH, p as mergeFeishuAccountConfig, r as normalizeCompatibilityConfig, s as normalizeFeishuWebhookPath, u as inspectFeishuCredentials, v as __reExport } from "./doctor-contract-oIpUWtNO.mjs";
2
+ import { a as parseFeishuTargetId, c as looksLikeFeishuId, i as parseFeishuDirectConversationId, l as normalizeFeishuTarget, n as buildFeishuModelOverrideParentCandidates, o as resolveConfiguredFeishuGroupSessionScope, r as parseFeishuConversationId, t as buildFeishuConversationId, u as resolveReceiveIdType } from "./conversation-id-D00i9uy5.mjs";
3
+ import { A as sendMessageFeishu, Ct as isFeishuGroupReadEnabled, Ft as resolveFeishuChatType, G as resolveFeishuIdentityHeaderTitle, K as deliverCommentThreadText, M as toFeishuMessageSendResult, Mt as resolveFeishuGroupToolPolicy, Pt as normalizeFeishuChatType, S as sendMediaFeishu, St as isFeishuGroupReadAllowed, T as chunkFeishuCardMarkdown, Tt as resolveFeishuChatReadPreliminaryAuthorization, U as buildFeishuMediaFallbackText, _ as renderFeishuPresentationPayload, b as withinCardTableLimit, bt as canEnumerateAllFeishuGroups, c as buildFeishuPayloadCard, d as consumeFeishuPresentationFallbackMarker, et as cleanupAmbientCommentTypingReaction, f as feishuCardWithinTableLimit, ft as chunkFeishuMarkdown, g as renderFeishuPresentationFallbackText, gt as shouldUseFeishuCard, h as readNativeFeishuCard, j as sendStructuredCardFeishu, k as sendCardFeishu, kt as resolveFeishuGroupConfig, l as buildFeishuPresentationCard, lt as parseFeishuCommentTarget, m as markRenderedFeishuCard, mt as materializeFeishuPostMarkdownSoftBreaks, n as createFeishuReplyDeliveryResult, o as FEISHU_PRESENTATION_CAPABILITIES, p as isFeishuCardWithinEnvelope, pt as chunkFeishuPostMarkdown, s as assertFeishuCardWithinEnvelope, t as createFeishuPartialReplyDeliveryError, u as buildFeishuPresentationFallback, ut as readNativeFeishuCardJson, vt as assertFeishuChatReadAllowed, w as shouldSuppressFeishuTextForVoiceMedia, wt as readFeishuChatInfoWithAuthorization, xt as canEnumerateAllFeishuPeers, y as resolveFeishuRichReply, yt as authorizeFeishuChatMemberRead } from "./reply-delivery-result-iCCrdxE1.mjs";
4
4
  import { t as messageActionTargetAliases } from "./message-action-contract-Bhxj8Zrf.mjs";
5
- import { l as withFeishuRequestContext, r as createFeishuClient, u as withFeishuSendContext } from "./client-BsBVWJzN.mjs";
5
+ import { l as withFeishuRequestContext, r as createFeishuClient, u as withFeishuSendContext } from "./client-wwr8PGPH.mjs";
6
6
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-CI1wCr9i.mjs";
7
7
  import { t as collectFeishuSecurityAuditFindings } from "./security-audit-b86aSgH2.mjs";
8
- import { t as resolveFeishuSessionConversation } from "./session-conversation-C53IEUWt.mjs";
9
- import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
8
+ import { t as resolveFeishuSessionConversation } from "./session-conversation-BSBNK5Mq.mjs";
9
+ import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
10
10
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
11
11
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-resolution";
12
12
  import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
@@ -190,22 +190,15 @@ function normalizePathSeparators(pathname) {
190
190
  if (collapsed.length <= 1) return collapsed;
191
191
  return collapsed.replace(/\/+$/, "");
192
192
  }
193
- function resolveDotSegments(pathname) {
194
- try {
195
- return new URL(pathname, "http://localhost").pathname;
196
- } catch {
197
- return pathname;
198
- }
199
- }
200
193
  function normalizePathForSecurity(pathname) {
201
- return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(resolveDotSegments(pathname))) || "/";
194
+ return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(URL.parse(pathname, "http://localhost")?.pathname ?? pathname)) || "/";
202
195
  }
203
- function buildCanonicalPathCandidates(pathname, maxDecodePasses = MAX_PATH_DECODE_PASSES) {
196
+ function buildCanonicalPathCandidates(pathname) {
204
197
  const candidates = /* @__PURE__ */ new Set([normalizePathForSecurity(pathname)]);
205
198
  let decoded = pathname;
206
199
  let malformedEncoding = false;
207
200
  let decodePasses = 0;
208
- for (let pass = 0; pass < maxDecodePasses; pass++) {
201
+ for (let pass = 0; pass < MAX_PATH_DECODE_PASSES; pass++) {
209
202
  let nextDecoded;
210
203
  try {
211
204
  nextDecoded = decodeURIComponent(decoded);
@@ -294,7 +287,7 @@ function describeFeishuWebhookPathConflict(path) {
294
287
  const pathname = new URL(normalized, "http://localhost").pathname;
295
288
  const probe = classifyGatewayProbePath(pathname);
296
289
  let reason;
297
- if (probe !== "outside" && probe !== "namespace") reason = "is reserved for Gateway probes";
290
+ if (probe !== "outside" && probe !== "namespace") reason = "is reserved for Gateway checks";
298
291
  else if (isProtectedPluginRoutePathFromContext(resolvePluginRoutePathContext(pathname))) reason = "requires Gateway authentication";
299
292
  else return;
300
293
  return `webhookPath ${JSON.stringify(path)} ${reason}. Set webhookPath to ${DEFAULT_FEISHU_WEBHOOK_PATH} and update the Feishu callback URL or reverse-proxy path to match.`;
@@ -451,14 +444,14 @@ function collectCorruptFeishuStateJsonFindings(feishuStateDir) {
451
444
  }
452
445
  return findings;
453
446
  }
454
- function resolveSessionTranscriptCandidates(params) {
447
+ function resolveSessionTranscriptPath(params) {
455
448
  const candidate = params.entry.sessionFile;
456
- if (typeof candidate !== "string" || !candidate.trim()) return [];
449
+ if (typeof candidate !== "string" || !candidate.trim()) return;
457
450
  const sessionsDir = path.dirname(params.storePath);
458
451
  const agentSessionsDir = resolveFeishuAgentSessionsDir(params.agentId);
459
452
  const trimmed = candidate.trim();
460
453
  const resolved = path.isAbsolute(trimmed) ? path.resolve(trimmed) : path.resolve(sessionsDir, trimmed);
461
- return resolved !== sessionsDir && resolved !== agentSessionsDir && (isPathStrictlyInside(sessionsDir, resolved) || isPathStrictlyInside(agentSessionsDir, resolved)) ? [resolved] : [];
454
+ return resolved !== sessionsDir && resolved !== agentSessionsDir && (isPathStrictlyInside(sessionsDir, resolved) || isPathStrictlyInside(agentSessionsDir, resolved)) ? resolved : void 0;
462
455
  }
463
456
  function isSessionHeader(value) {
464
457
  return isRecord(value) && value.type === "session" && typeof value.id === "string";
@@ -575,23 +568,19 @@ function collectFeishuSessionFindings(params) {
575
568
  });
576
569
  return finding ? [finding] : [];
577
570
  }
578
- const transcriptCandidates = resolveSessionTranscriptCandidates(params);
579
- const existing = transcriptCandidates.filter(existsFile);
580
- if (transcriptCandidates.length > 0 && existing.length === 0) return [{
571
+ const transcriptPath = resolveSessionTranscriptPath(params);
572
+ if (!transcriptPath) return [];
573
+ if (!existsFile(transcriptPath)) return [{
581
574
  kind: "missing-session-transcript",
582
575
  sessionKey: params.sessionKey,
583
576
  storePath: params.storePath
584
577
  }];
585
- const findings = [];
586
- for (const transcriptPath of existing) {
587
- const finding = inspectSessionTranscript({
588
- sessionKey: params.sessionKey,
589
- storePath: params.storePath,
590
- transcriptPath
591
- });
592
- if (finding) findings.push(finding);
593
- }
594
- return findings;
578
+ const finding = inspectSessionTranscript({
579
+ sessionKey: params.sessionKey,
580
+ storePath: params.storePath,
581
+ transcriptPath
582
+ });
583
+ return finding ? [finding] : [];
595
584
  }
596
585
  function hasCorruptFeishuStateJsonFinding(inspection) {
597
586
  return inspection.findings.some((finding) => finding.kind === "corrupt-state-json");
@@ -690,16 +679,15 @@ function copyStoreBackup(params) {
690
679
  }
691
680
  }
692
681
  function collectSessionArtifactPaths(params) {
693
- const artifacts = /* @__PURE__ */ new Set();
694
- for (const transcriptPath of resolveSessionTranscriptCandidates(params)) {
695
- artifacts.add(transcriptPath);
696
- if (transcriptPath.endsWith(".jsonl")) {
697
- const base = transcriptPath.slice(0, -6);
698
- artifacts.add(`${base}.trajectory.jsonl`);
699
- artifacts.add(`${base}.trajectory-path.json`);
700
- }
701
- }
702
- return [...artifacts].toSorted();
682
+ const transcriptPath = resolveSessionTranscriptPath(params);
683
+ if (!transcriptPath) return [];
684
+ if (!transcriptPath.endsWith(".jsonl")) return [transcriptPath];
685
+ const base = transcriptPath.slice(0, -6);
686
+ return [
687
+ transcriptPath,
688
+ `${base}.trajectory.jsonl`,
689
+ `${base}.trajectory-path.json`
690
+ ].toSorted();
703
691
  }
704
692
  function archiveSessionArtifacts(params) {
705
693
  const seen = /* @__PURE__ */ new Set();
@@ -860,7 +848,7 @@ const feishuDoctor = {
860
848
  //#endregion
861
849
  //#region extensions/feishu/src/gateway.ts
862
850
  const feishuGatewayAdapter = { startAccount: async (ctx) => {
863
- const { monitorFeishuProvider } = await import("./monitor-7DvwUs4Y.mjs");
851
+ const { monitorFeishuProvider } = await import("./monitor-Yt__BUki.mjs");
864
852
  const account = resolveFeishuRuntimeAccount({
865
853
  cfg: ctx.cfg,
866
854
  accountId: ctx.accountId
@@ -1351,36 +1339,24 @@ const feishuOutbound = withFeishuOutboundSendContext({
1351
1339
  replyToMode: ctx.replyToMode,
1352
1340
  onDeliveryResult
1353
1341
  };
1354
- if (parseFeishuCommentTarget(to)) {
1355
- const commentText = mediaUrl?.trim() ? await buildFeishuMediaFallbackText({
1356
- text,
1357
- mediaUrl,
1358
- mediaLinkStyle: "plain"
1359
- }) : text?.trim() ?? "";
1360
- return toFeishuOutboundResult(await sendOutboundText({
1361
- ...sendParams,
1362
- text: commentText,
1363
- ...nextReplyMode(),
1364
- ...deliveryOptions
1365
- }));
1366
- }
1367
- if (!mediaUrl) return toFeishuOutboundResult(await sendOutboundText({
1342
+ const sendText = (value, replyMode = nextReplyMode()) => sendOutboundText({
1368
1343
  ...sendParams,
1369
- text: text ?? "",
1370
- ...nextReplyMode(),
1344
+ text: value,
1345
+ ...replyMode,
1371
1346
  ...deliveryOptions
1372
- }));
1347
+ });
1348
+ if (parseFeishuCommentTarget(to)) return toFeishuOutboundResult(await sendText(mediaUrl?.trim() ? await buildFeishuMediaFallbackText({
1349
+ text,
1350
+ mediaUrl,
1351
+ mediaLinkStyle: "plain"
1352
+ }) : text?.trim() ?? ""));
1353
+ if (!mediaUrl) return toFeishuOutboundResult(await sendText(text ?? ""));
1373
1354
  const suppressTextForVoiceMedia = shouldSuppressFeishuTextForVoiceMedia({
1374
1355
  mediaUrl,
1375
1356
  audioAsVoice
1376
1357
  });
1377
1358
  let captionResult;
1378
- if (text?.trim() && !suppressTextForVoiceMedia) captionResult = await sendOutboundText({
1379
- ...sendParams,
1380
- text,
1381
- ...nextReplyMode(),
1382
- ...deliveryOptions
1383
- });
1359
+ if (text?.trim() && !suppressTextForVoiceMedia) captionResult = await sendText(text);
1384
1360
  const results = captionResult ? [captionResult] : [];
1385
1361
  let mediaResult;
1386
1362
  const mediaReplyMode = nextReplyMode();
@@ -1406,12 +1382,7 @@ const feishuOutbound = withFeishuOutboundSendContext({
1406
1382
  mediaUrl
1407
1383
  });
1408
1384
  try {
1409
- const fallbackResult = await sendOutboundText({
1410
- ...sendParams,
1411
- text: fallbackText,
1412
- ...captionResult ? nextReplyMode() : mediaReplyMode,
1413
- ...deliveryOptions
1414
- });
1385
+ const fallbackResult = await sendText(fallbackText, captionResult ? nextReplyMode() : mediaReplyMode);
1415
1386
  return toFeishuOutboundResult(aggregateFeishuSendResult(fallbackResult, [...results, fallbackResult]));
1416
1387
  } catch (error) {
1417
1388
  throw partialFeishuSendError(error, results);
@@ -1420,12 +1391,7 @@ const feishuOutbound = withFeishuOutboundSendContext({
1420
1391
  results.push(mediaResult);
1421
1392
  try {
1422
1393
  await reportFeishuOutboundDelivery(mediaResult, onDeliveryResult);
1423
- if (mediaResult.voiceIntentDegradedToFile && text?.trim()) results.push(await sendOutboundText({
1424
- ...sendParams,
1425
- text,
1426
- ...nextReplyMode(),
1427
- ...deliveryOptions
1428
- }));
1394
+ if (mediaResult.voiceIntentDegradedToFile && text?.trim()) results.push(await sendText(text));
1429
1395
  } catch (error) {
1430
1396
  throw partialFeishuSendError(error, results);
1431
1397
  }
@@ -1577,9 +1543,8 @@ const feishuDmPolicy = createChannelDmPolicy({
1577
1543
  applyPatch: ({ cfg, account, patch }) => patchFeishuConfig(cfg, account.accountId, patch),
1578
1544
  promptAllowFrom: promptFeishuAllowFrom
1579
1545
  });
1580
- const loadAppRegistrationModule = createLazyRuntimeModule(() => import("./app-registration-BB6TubaW.mjs"));
1581
1546
  async function runScanToCreate(prompter, domain, beforePersistentEffect) {
1582
- const { beginAppRegistration, initAppRegistration, pollAppRegistration, printQrCode } = await loadAppRegistrationModule();
1547
+ const { beginAppRegistration, initAppRegistration, pollAppRegistration, printQrCode } = await import("./app-registration-DQOq5urV.mjs");
1583
1548
  try {
1584
1549
  await initAppRegistration(domain);
1585
1550
  } catch {
@@ -1598,23 +1563,12 @@ async function runScanToCreate(prompter, domain, beforePersistentEffect) {
1598
1563
  initialDomain: domain,
1599
1564
  tp: SCAN_TO_CREATE_TP
1600
1565
  });
1601
- let message;
1602
- switch (outcome.status) {
1603
- case "success":
1604
- message = t("wizard.feishu.scanCompleted");
1605
- break;
1606
- case "access_denied":
1607
- message = t("wizard.feishu.scanDenied");
1608
- break;
1609
- case "expired":
1610
- message = t("wizard.feishu.scanExpired");
1611
- break;
1612
- case "timeout":
1613
- message = t("wizard.feishu.scanTimedOut");
1614
- break;
1615
- case "error": message = t("wizard.feishu.scanError", { error: outcome.message });
1616
- }
1617
- progress.stop(message);
1566
+ progress.stop(outcome.status === "error" ? t("wizard.feishu.scanError", { error: outcome.message }) : t({
1567
+ success: "wizard.feishu.scanCompleted",
1568
+ access_denied: "wizard.feishu.scanDenied",
1569
+ expired: "wizard.feishu.scanExpired",
1570
+ timeout: "wizard.feishu.scanTimedOut"
1571
+ }[outcome.status]));
1618
1572
  return outcome.status === "success" ? outcome.result : null;
1619
1573
  }
1620
1574
  async function runNewAppFlow(params) {
@@ -1681,7 +1635,7 @@ async function runNewAppFlow(params) {
1681
1635
  appSecretProbeValue = appSecretResult.resolvedValue;
1682
1636
  }
1683
1637
  if (appId && appSecretProbeValue) {
1684
- const { getAppOwnerOpenId } = await loadAppRegistrationModule();
1638
+ const { getAppOwnerOpenId } = await import("./app-registration-DQOq5urV.mjs");
1685
1639
  scanOpenId = await getAppOwnerOpenId({
1686
1640
  appId,
1687
1641
  appSecret: appSecretProbeValue,
@@ -1782,7 +1736,7 @@ const feishuSetupWizard = {
1782
1736
  });
1783
1737
  let probeResult = null;
1784
1738
  if (configured && account.configured) try {
1785
- const { probeFeishu } = await import("./probe-B9o7iey6.mjs").then((n) => n.n);
1739
+ const { probeFeishu } = await import("./probe-DXnFxq5j.mjs").then((n) => n.n);
1786
1740
  probeResult = await probeFeishu(account);
1787
1741
  } catch {}
1788
1742
  if (!configured) return [`Feishu: ${t("wizard.channels.statusNeedsAppCredentials")}`];
@@ -1918,11 +1872,11 @@ function hasLegacyFeishuCardCommandValue(actionValue) {
1918
1872
  return isRecord(actionValue) && actionValue.oc !== "ocf1" && (Boolean(typeof actionValue.command === "string" && actionValue.command.trim()) || Boolean(typeof actionValue.text === "string" && actionValue.text.trim()));
1919
1873
  }
1920
1874
  function containsLegacyFeishuCardCommandValue(node) {
1921
- if (Array.isArray(node)) return node.some((item) => containsLegacyFeishuCardCommandValue(item));
1875
+ if (Array.isArray(node)) return node.some(containsLegacyFeishuCardCommandValue);
1922
1876
  if (!isRecord(node)) return false;
1923
1877
  if (node.tag === "button" && hasLegacyFeishuCardCommandValue(node.value)) return true;
1924
1878
  if (node.tag === "button" && Array.isArray(node.behaviors) && node.behaviors.some((behavior) => isRecord(behavior) && hasLegacyFeishuCardCommandValue(behavior.value))) return true;
1925
- return Object.values(node).some((value) => containsLegacyFeishuCardCommandValue(value));
1879
+ return Object.values(node).some(containsLegacyFeishuCardCommandValue);
1926
1880
  }
1927
1881
  const meta = {
1928
1882
  id: "feishu",
@@ -1935,25 +1889,29 @@ const meta = {
1935
1889
  order: 70,
1936
1890
  preferSessionLookupForAnnounceTarget: true
1937
1891
  };
1938
- const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-COiaq-Rv.mjs"), "feishuChannelRuntime");
1939
- async function resolveFeishuMessageSender(params) {
1892
+ const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-SaC_uTPM.mjs"), "feishuChannelRuntime");
1893
+ async function resolveFeishuMessageSender(kind) {
1894
+ const unavailableMessage = `Feishu ${kind} sending is not available.`;
1940
1895
  try {
1941
- const sender = params.resolve(await loadFeishuChannelRuntime());
1896
+ const sender = (await loadFeishuChannelRuntime()).feishuOutbound[kind === "text" ? "sendText" : "sendMedia"];
1942
1897
  if (sender) return sender;
1943
- throw new Error(params.unavailableMessage);
1898
+ throw new Error(unavailableMessage);
1944
1899
  } catch (error) {
1945
1900
  if (error instanceof PlatformMessageNotDispatchedError) throw error;
1946
- throw new PlatformMessageNotDispatchedError(params.unavailableMessage, { cause: error });
1901
+ throw new PlatformMessageNotDispatchedError(unavailableMessage, { cause: error });
1947
1902
  }
1948
1903
  }
1949
- const resolveFeishuTextSender = () => resolveFeishuMessageSender({
1950
- resolve: (runtime) => runtime.feishuOutbound.sendText,
1951
- unavailableMessage: "Feishu text sending is not available."
1952
- });
1953
- const resolveFeishuMediaSender = () => resolveFeishuMessageSender({
1954
- resolve: (runtime) => runtime.feishuOutbound.sendMedia,
1955
- unavailableMessage: "Feishu media sending is not available."
1956
- });
1904
+ async function sendFeishuAdapterMessage(kind, ctx) {
1905
+ const send = await resolveFeishuMessageSender(kind);
1906
+ const { onDeliveryResult, ...outboundCtx } = ctx;
1907
+ const result = await send({
1908
+ ...outboundCtx,
1909
+ ...onDeliveryResult ? { onDeliveryResult: async (progress) => {
1910
+ await onDeliveryResult(toFeishuMessageSendResult(progress, kind));
1911
+ } } : {}
1912
+ });
1913
+ return toFeishuMessageSendResult(result, kind);
1914
+ }
1957
1915
  const feishuMessageAdapter = defineChannelMessageAdapter({
1958
1916
  id: "feishu",
1959
1917
  durableFinal: { capabilities: {
@@ -1962,51 +1920,16 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
1962
1920
  } },
1963
1921
  send: {
1964
1922
  lifecycle: { beforeSendAttempt: async (ctx) => {
1965
- if (ctx.kind === "text") await resolveFeishuTextSender();
1966
- else if (ctx.kind === "media") await resolveFeishuMediaSender();
1923
+ if (ctx.kind === "text" || ctx.kind === "media") await resolveFeishuMessageSender(ctx.kind);
1967
1924
  } },
1968
- text: async (ctx) => {
1969
- const sendText = await resolveFeishuTextSender();
1970
- const { onDeliveryResult, ...outboundCtx } = ctx;
1971
- const result = await sendText({
1972
- ...outboundCtx,
1973
- ...onDeliveryResult ? { onDeliveryResult: async (progress) => {
1974
- await onDeliveryResult(toFeishuMessageSendResult(progress, "text"));
1975
- } } : {}
1976
- });
1977
- return toFeishuMessageSendResult(result, "text");
1978
- },
1979
- media: async (ctx) => {
1980
- const sendMedia = await resolveFeishuMediaSender();
1981
- const { onDeliveryResult, ...outboundCtx } = ctx;
1982
- const result = await sendMedia({
1983
- ...outboundCtx,
1984
- ...onDeliveryResult ? { onDeliveryResult: async (progress) => {
1985
- await onDeliveryResult(toFeishuMessageSendResult(progress, "media"));
1986
- } } : {}
1987
- });
1988
- return toFeishuMessageSendResult(result, "media");
1989
- }
1925
+ text: (ctx) => sendFeishuAdapterMessage("text", ctx),
1926
+ media: (ctx) => sendFeishuAdapterMessage("media", ctx)
1990
1927
  }
1991
1928
  });
1992
1929
  async function createFeishuActionClient(account) {
1993
- const { createFeishuClient } = await import("./client-BsBVWJzN.mjs").then((n) => n.t);
1930
+ const { createFeishuClient } = await import("./client-wwr8PGPH.mjs").then((n) => n.t);
1994
1931
  return createFeishuClient(account);
1995
1932
  }
1996
- async function resolveFeishuChatTypeById(params) {
1997
- const client = await createFeishuActionClient(params.account);
1998
- const chat = await params.runtime.getChatInfo(client, params.chatId);
1999
- return resolveFeishuChatType(chat);
2000
- }
2001
- async function resolveFeishuMessageChatType(params) {
2002
- const knownChatType = normalizeFeishuChatType(params.message.chatType);
2003
- if (knownChatType) return knownChatType;
2004
- return resolveFeishuChatTypeById({
2005
- account: params.account,
2006
- chatId: params.message.chatId,
2007
- runtime: params.runtime
2008
- });
2009
- }
2010
1933
  const collectFeishuSecurityWarnings = createAllowlistProviderGroupPolicyWarningCollector({
2011
1934
  providerConfigPresent: (cfg) => cfg.channels?.feishu !== void 0,
2012
1935
  resolveGroupPolicy: ({ cfg, accountId }) => resolveFeishuAccount({
@@ -2102,9 +2025,7 @@ function buildFeishuSendReplyAnchor(ctx, accountId) {
2102
2025
  }
2103
2026
  function isSupportedFeishuDirectConversationId(conversationId) {
2104
2027
  const trimmed = conversationId.trim();
2105
- if (!trimmed || trimmed.includes(":")) return false;
2106
- if (trimmed.startsWith("oc_") || trimmed.startsWith("on_")) return false;
2107
- return true;
2028
+ return Boolean(trimmed) && !trimmed.includes(":") && !trimmed.startsWith("oc_") && !trimmed.startsWith("on_");
2108
2029
  }
2109
2030
  function normalizeFeishuAcpConversationId(conversationId) {
2110
2031
  const parsed = parseFeishuConversationId({ conversationId });
@@ -2243,18 +2164,14 @@ function resolveFeishuMessageReadTarget(ctx) {
2243
2164
  chatType: ctx.toolContext?.currentChatType === "direct" ? "p2p" : ctx.toolContext?.currentChatType === "group" || ctx.toolContext?.currentChatType === "channel" ? "group" : void 0
2244
2165
  };
2245
2166
  }
2246
- function assertFeishuMessageMatchesReadTarget(params) {
2247
- if ((normalizeFeishuTarget(params.messageChatId) ?? params.messageChatId.trim()) !== params.authorizedChatId) throw new ToolAuthorizationError("Feishu message target is not allowed.");
2248
- }
2249
2167
  async function authorizeFeishuMessageReadTarget(params) {
2250
- const authorize = (chatType) => assertFeishuChatReadAllowed({
2168
+ if (params.target.chatType) return assertFeishuChatReadAllowed({
2251
2169
  cfg: params.ctx.cfg,
2252
2170
  account: params.account,
2253
2171
  chatId: params.target.chatId,
2254
- chatType,
2172
+ chatType: params.target.chatType,
2255
2173
  ctx: params.ctx
2256
2174
  });
2257
- if (params.target.chatType) return authorize(params.target.chatType);
2258
2175
  const preliminary = resolveFeishuChatReadPreliminaryAuthorization({
2259
2176
  cfg: params.ctx.cfg,
2260
2177
  account: params.account,
@@ -2305,19 +2222,15 @@ async function getAuthorizedFeishuMessage(params) {
2305
2222
  accountId: params.ctx.accountId ?? void 0
2306
2223
  });
2307
2224
  if (!message) return null;
2308
- if (authorizedChatId) assertFeishuMessageMatchesReadTarget({
2309
- authorizedChatId,
2310
- messageChatId: message.chatId
2311
- });
2225
+ if (authorizedChatId) {
2226
+ if ((normalizeFeishuTarget(message.chatId) ?? message.chatId.trim()) !== authorizedChatId) throw new ToolAuthorizationError("Feishu message target is not allowed.");
2227
+ }
2228
+ const chatType = normalizeFeishuChatType(message.chatType) ?? resolveFeishuChatType(await params.runtime.getChatInfo(await createFeishuActionClient(params.account), message.chatId));
2312
2229
  assertFeishuChatReadAllowed({
2313
2230
  cfg: params.ctx.cfg,
2314
2231
  account: params.account,
2315
2232
  chatId: message.chatId,
2316
- chatType: await resolveFeishuMessageChatType({
2317
- account: params.account,
2318
- message,
2319
- runtime: params.runtime
2320
- }),
2233
+ chatType,
2321
2234
  ctx: params.ctx
2322
2235
  });
2323
2236
  return message;
@@ -2362,7 +2275,7 @@ const feishuPlugin = createChatChannelPlugin({
2362
2275
  id: "feishu",
2363
2276
  meta,
2364
2277
  capabilities: {
2365
- chatTypes: ["direct", "channel"],
2278
+ chatTypes: ["direct", "group"],
2366
2279
  polls: false,
2367
2280
  threads: true,
2368
2281
  media: true,
@@ -2556,7 +2469,7 @@ const feishuPlugin = createChatChannelPlugin({
2556
2469
  ...ctx.action === "send" ? { propagateMediaUploadFailure: true } : {}
2557
2470
  });
2558
2471
  else {
2559
- const { target, ...delivery } = await (await resolveFeishuTextSender())(outboundContext);
2472
+ const { target, ...delivery } = await (await resolveFeishuMessageSender("text"))(outboundContext);
2560
2473
  result = {
2561
2474
  ...delivery,
2562
2475
  chatId: target?.id