@openclaw/feishu 2026.7.1-beta.1 → 2026.7.1-beta.4

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 (461) hide show
  1. package/dist/{accounts-Cfzht2Hc.js → accounts-Bs5uJ4h0.js} +4 -3
  2. package/dist/api.js +56 -65
  3. package/dist/{app-registration-DapxBG7t.js → app-registration-BwQ-aGTe.js} +23 -15
  4. package/dist/{channel-C1Uun9zo.js → channel-DwCydAeD.js} +77 -58
  5. package/dist/channel-plugin-api.js +1 -1
  6. package/dist/{channel.runtime-Cjc4wDNg.js → channel.runtime-COT2fcCf.js} +96 -149
  7. package/dist/contract-api.js +1 -1
  8. package/dist/{conversation-id-DuL575sn.js → conversation-id-CdLdoot3.js} +5 -1
  9. package/dist/{drive-djUl8IRC.js → drive-BupYOoHa.js} +46 -42
  10. package/dist/json-response-CheljwGr.js +9 -0
  11. package/dist/{monitor-CQo4C7q9.js → monitor-5gbbXIO-.js} +3 -6
  12. package/dist/{monitor.account-08br3nkU.js → monitor.account-lMwQ5v1Q.js} +149 -67
  13. package/dist/runtime-api.js +1 -1
  14. package/dist/{send-BcPh0I15.js → send-DzLGqjEt.js} +33 -40
  15. package/dist/send-result-BMQw-YhV.js +287 -0
  16. package/dist/{session-conversation-CZSMgac-.js → session-conversation-BYuoVJwl.js} +1 -1
  17. package/dist/session-key-api.js +1 -1
  18. package/dist/setup-api.js +1 -1
  19. package/dist/{subagent-hooks-1pqt5tAA.js → subagent-hooks-B2iWPYJ1.js} +1 -1
  20. package/dist/subagent-hooks-api.js +2 -5
  21. package/node_modules/@larksuiteoapi/node-sdk/README.md +40 -0
  22. package/node_modules/@larksuiteoapi/node-sdk/README.zh.md +38 -0
  23. package/node_modules/@larksuiteoapi/node-sdk/es/index.js +183 -24
  24. package/node_modules/@larksuiteoapi/node-sdk/lib/index.js +186 -23
  25. package/node_modules/@larksuiteoapi/node-sdk/package.json +1 -72
  26. package/node_modules/@larksuiteoapi/node-sdk/types/index.d.ts +105 -1
  27. package/node_modules/@types/node/README.md +1 -1
  28. package/node_modules/@types/node/assert/strict.d.ts +10 -1
  29. package/node_modules/@types/node/assert.d.ts +144 -17
  30. package/node_modules/@types/node/async_hooks.d.ts +9 -9
  31. package/node_modules/@types/node/buffer.d.ts +64 -30
  32. package/node_modules/@types/node/child_process.d.ts +17 -21
  33. package/node_modules/@types/node/cluster.d.ts +13 -13
  34. package/node_modules/@types/node/console.d.ts +1 -1
  35. package/node_modules/@types/node/crypto.d.ts +471 -575
  36. package/node_modules/@types/node/diagnostics_channel.d.ts +274 -32
  37. package/node_modules/@types/node/dns.d.ts +15 -15
  38. package/node_modules/@types/node/events.d.ts +3 -3
  39. package/node_modules/@types/node/ffi.d.ts +486 -0
  40. package/node_modules/@types/node/fs/promises.d.ts +7 -4
  41. package/node_modules/@types/node/fs.d.ts +24 -18
  42. package/node_modules/@types/node/globals.d.ts +4 -4
  43. package/node_modules/@types/node/http.d.ts +30 -5
  44. package/node_modules/@types/node/http2.d.ts +5 -1
  45. package/node_modules/@types/node/index.d.ts +1 -3
  46. package/node_modules/@types/node/inspector.d.ts +1 -1
  47. package/node_modules/@types/node/module.d.ts +16 -45
  48. package/node_modules/@types/node/net.d.ts +1 -1
  49. package/node_modules/@types/node/os.d.ts +2 -2
  50. package/node_modules/@types/node/package.json +4 -4
  51. package/node_modules/@types/node/perf_hooks.d.ts +1 -9
  52. package/node_modules/@types/node/process.d.ts +25 -12
  53. package/node_modules/@types/node/quic.d.ts +92 -11
  54. package/node_modules/@types/node/readline.d.ts +12 -11
  55. package/node_modules/@types/node/repl.d.ts +10 -10
  56. package/node_modules/@types/node/sqlite.d.ts +56 -1
  57. package/node_modules/@types/node/stream/iter.d.ts +150 -0
  58. package/node_modules/@types/node/stream/promises.d.ts +2 -2
  59. package/node_modules/@types/node/stream/web.d.ts +1 -1
  60. package/node_modules/@types/node/stream.d.ts +37 -5
  61. package/node_modules/@types/node/test/reporters.d.ts +1 -1
  62. package/node_modules/@types/node/test.d.ts +120 -10
  63. package/node_modules/@types/node/tls.d.ts +1 -1
  64. package/node_modules/@types/node/ts5.6/index.d.ts +2 -4
  65. package/node_modules/@types/node/ts5.7/index.d.ts +1 -3
  66. package/node_modules/@types/node/url.d.ts +3 -3
  67. package/node_modules/@types/node/util/types.d.ts +1 -1
  68. package/node_modules/@types/node/util.d.ts +22 -22
  69. package/node_modules/@types/node/v8.d.ts +85 -3
  70. package/node_modules/@types/node/vm.d.ts +9 -9
  71. package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
  72. package/node_modules/@types/node/worker_threads.d.ts +10 -12
  73. package/node_modules/@types/node/zlib.d.ts +3 -3
  74. package/node_modules/side-channel/CHANGELOG.md +10 -0
  75. package/node_modules/side-channel/README.md +1 -1
  76. package/node_modules/side-channel/index.js +5 -2
  77. package/node_modules/side-channel/package.json +10 -10
  78. package/node_modules/side-channel/test/index.js +16 -0
  79. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  80. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  81. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  82. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  83. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  84. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  85. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  86. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  87. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  88. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  89. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  90. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  91. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  92. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  93. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  94. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  95. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  96. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  97. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  98. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  99. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  100. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  101. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  102. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  103. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  104. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  105. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  106. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  107. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  108. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  109. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  110. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  111. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  112. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  113. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  114. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  115. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  116. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  117. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  118. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  119. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  120. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  121. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  122. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  123. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  124. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  125. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  126. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  127. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  128. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  129. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  130. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  131. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  132. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  133. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  134. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  135. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  136. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  137. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  138. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  139. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  140. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  141. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  142. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  143. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  144. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  145. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  146. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  147. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  148. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  149. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  150. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  151. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  152. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  153. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  154. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  155. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  156. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  157. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  158. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  159. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  160. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  161. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  162. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  163. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  164. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  165. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  166. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  167. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  168. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  169. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  170. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  171. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  172. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  173. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  174. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  175. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  176. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  177. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  178. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  179. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  180. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  181. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  182. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  183. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  184. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  185. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  186. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  187. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  188. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  189. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  190. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  191. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  192. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  193. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  194. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  195. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  196. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  197. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  198. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  199. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  200. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  201. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  202. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  203. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  204. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  205. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  206. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  207. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  208. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  209. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  210. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  211. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  212. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  213. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  214. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  215. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  216. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  217. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  218. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  219. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  220. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  221. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  222. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  223. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  224. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  225. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  226. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  227. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  228. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  229. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  230. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  231. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  232. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  233. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  234. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  235. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  236. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  237. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  238. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  239. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  240. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  241. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  242. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  243. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  244. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  245. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  246. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  247. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  248. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  249. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  250. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  251. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  252. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  253. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  254. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  255. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  256. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  257. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  258. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  259. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  260. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  261. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  262. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  263. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  264. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  265. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  266. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  267. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  268. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  269. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  270. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  271. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  272. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  273. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  274. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  275. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  276. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  277. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  278. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  279. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  280. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  281. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  282. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  283. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  284. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  285. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  286. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  287. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  288. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  289. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  290. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  291. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  292. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  293. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  294. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  295. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  296. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  297. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  298. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  299. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  300. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  301. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  302. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  303. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  304. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  305. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  306. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  307. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  308. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  309. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  310. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  311. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  312. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  313. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  314. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  315. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  316. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  317. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  318. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  319. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  320. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  321. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  322. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  323. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  324. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  325. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  326. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  327. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  328. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  329. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  330. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  331. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  332. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  333. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  334. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  335. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  336. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  337. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  338. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  339. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  340. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  341. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  342. package/node_modules/typebox/build/typebox.d.mts +4 -8
  343. package/node_modules/typebox/build/typebox.mjs +4 -8
  344. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  345. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  346. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  347. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  348. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  349. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  350. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  351. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  352. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  353. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  354. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  355. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  356. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  357. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  358. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  359. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  360. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  361. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  362. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  363. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  364. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  365. package/node_modules/typebox/build/value/index.d.mts +0 -1
  366. package/node_modules/typebox/build/value/index.mjs +0 -1
  367. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  368. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  369. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  370. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  371. package/node_modules/typebox/build/value/value.d.mts +0 -1
  372. package/node_modules/typebox/build/value/value.mjs +0 -1
  373. package/node_modules/typebox/package.json +25 -25
  374. package/node_modules/typebox/readme.md +97 -80
  375. package/node_modules/undici-types/agent.d.ts +0 -2
  376. package/node_modules/undici-types/client.d.ts +25 -19
  377. package/node_modules/undici-types/dispatcher.d.ts +7 -33
  378. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  379. package/node_modules/undici-types/fetch.d.ts +24 -4
  380. package/node_modules/undici-types/h2c-client.d.ts +6 -6
  381. package/node_modules/undici-types/handlers.d.ts +1 -2
  382. package/node_modules/undici-types/header.d.ts +5 -0
  383. package/node_modules/undici-types/index.d.ts +3 -1
  384. package/node_modules/undici-types/interceptors.d.ts +1 -1
  385. package/node_modules/undici-types/package.json +1 -1
  386. package/node_modules/undici-types/pool.d.ts +0 -2
  387. package/node_modules/undici-types/proxy-agent.d.ts +2 -2
  388. package/node_modules/undici-types/round-robin-pool.d.ts +0 -2
  389. package/node_modules/undici-types/snapshot-agent.d.ts +4 -0
  390. package/node_modules/undici-types/socks5-proxy-agent.d.ts +2 -2
  391. package/node_modules/undici-types/webidl.d.ts +0 -1
  392. package/npm-shrinkwrap.json +23 -23
  393. package/package.json +6 -6
  394. package/skills/feishu-drive/SKILL.md +17 -3
  395. package/dist/send-result-DSsIa4-p.js +0 -140
  396. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  397. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  398. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  399. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  400. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  401. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  402. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  403. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  404. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  405. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  406. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  407. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  408. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  409. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  410. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  411. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  412. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  413. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  414. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  415. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  416. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  417. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  418. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  419. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  420. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  421. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  422. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  423. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  424. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  425. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  426. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  427. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  428. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  429. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  430. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  431. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  432. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  433. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  434. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  435. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  436. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  437. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  438. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  439. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  440. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  441. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  442. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  443. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  444. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  445. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  446. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  447. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  448. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  449. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  450. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  451. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  452. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  453. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  454. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  455. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  456. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  457. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  458. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  459. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  460. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  461. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -20,6 +20,7 @@ import pickBy from 'lodash.pickby';
20
20
  import merge from 'lodash.merge';
21
21
  import qs from 'querystring';
22
22
  import WebSocket from 'ws';
23
+ import { gzipSync } from 'zlib';
23
24
  import http from 'http';
24
25
  import https from 'https';
25
26
  import { promises } from 'dns';
@@ -87331,6 +87332,18 @@ class AppTicketManager {
87331
87332
  }
87332
87333
  }
87333
87334
 
87335
+ /**
87336
+ * Build an error message for a token response that is missing its expected
87337
+ * field. Only the API's own `code`/`msg` are echoed back — never request
87338
+ * credentials (app_secret, app_ticket, tokens) — so the message is safe to
87339
+ * surface to callers and logs.
87340
+ */
87341
+ function buildTokenError(field, response) {
87342
+ var _a, _b;
87343
+ const code = (_a = response === null || response === void 0 ? void 0 : response.code) !== null && _a !== void 0 ? _a : 'unknown';
87344
+ const msg = (_b = response === null || response === void 0 ? void 0 : response.msg) !== null && _b !== void 0 ? _b : 'no message';
87345
+ return `failed to get ${field}, code: ${code}, msg: ${msg}`;
87346
+ }
87334
87347
  class TokenManager {
87335
87348
  constructor(params) {
87336
87349
  this.appId = params.appId;
@@ -87351,6 +87364,29 @@ class TokenManager {
87351
87364
  });
87352
87365
  this.logger.debug('token manager is ready');
87353
87366
  }
87367
+ /**
87368
+ * POST a token endpoint and return the validated response body.
87369
+ *
87370
+ * On transport failure the original error is logged and rethrown — so the
87371
+ * caller sees the real cause (EPIPE, timeout, ...) instead of a secondary
87372
+ * "Cannot destructure ... of undefined". On an HTTP-200 business failure the
87373
+ * required field is absent; we throw an error carrying only the API's
87374
+ * code/msg and never cache an undefined token.
87375
+ */
87376
+ requestToken(url, body, requiredField) {
87377
+ return __awaiter(this, void 0, void 0, function* () {
87378
+ const response = yield this.httpInstance
87379
+ .post(url, body)
87380
+ .catch((e) => {
87381
+ this.logger.error(e);
87382
+ throw e;
87383
+ });
87384
+ if (!response || !response[requiredField]) {
87385
+ throw new Error(buildTokenError(requiredField, response));
87386
+ }
87387
+ return response;
87388
+ });
87389
+ }
87354
87390
  getCustomTenantAccessToken() {
87355
87391
  var _a, _b;
87356
87392
  return __awaiter(this, void 0, void 0, function* () {
@@ -87362,15 +87398,10 @@ class TokenManager {
87362
87398
  return cachedTenantAccessToken;
87363
87399
  }
87364
87400
  this.logger.debug('request token');
87365
- // @ts-ignore
87366
- const { tenant_access_token, expire } = yield this.httpInstance
87367
- .post(`${this.domain}/open-apis/auth/v3/tenant_access_token/internal`, {
87401
+ const { tenant_access_token, expire } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/tenant_access_token/internal`, {
87368
87402
  app_id: this.appId,
87369
87403
  app_secret: this.appSecret,
87370
- })
87371
- .catch((e) => {
87372
- this.logger.error(e);
87373
- });
87404
+ }, 'tenant_access_token');
87374
87405
  yield ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.set(CTenantAccessToken, tenant_access_token,
87375
87406
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
87376
87407
  new Date().getTime() + expire * 1000 - 3 * 60 * 1000, {
@@ -87401,27 +87432,17 @@ class TokenManager {
87401
87432
  }
87402
87433
  this.logger.debug('get app access token');
87403
87434
  // 获取app_access_token
87404
- // @ts-ignore
87405
- const { app_access_token } = yield this.httpInstance
87406
- .post(`${this.domain}/open-apis/auth/v3/app_access_token`, {
87435
+ const { app_access_token } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/app_access_token`, {
87407
87436
  app_id: this.appId,
87408
87437
  app_secret: this.appSecret,
87409
87438
  app_ticket: appTicket,
87410
- })
87411
- .catch((e) => {
87412
- this.logger.error(e);
87413
- });
87439
+ }, 'app_access_token');
87414
87440
  this.logger.debug('get tenant access token');
87415
87441
  // 获取tenant_access_token
87416
- // @ts-ignore
87417
- const { tenant_access_token, expire } = yield this.httpInstance
87418
- .post(`${this.domain}/open-apis/auth/v3/tenant_access_token`, {
87442
+ const { tenant_access_token, expire } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/tenant_access_token`, {
87419
87443
  app_access_token,
87420
87444
  tenant_key: tenantKey,
87421
- })
87422
- .catch((e) => {
87423
- this.logger.error(e);
87424
- });
87445
+ }, 'tenant_access_token');
87425
87446
  // 设置tenant_access_token
87426
87447
  yield this.cache.set(`larkMarketAccessToken${tenantKey}`, tenant_access_token,
87427
87448
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
@@ -88888,10 +88909,15 @@ class DataCache {
88888
88909
  deleteCache(message_id) {
88889
88910
  this.cache.delete(message_id);
88890
88911
  }
88912
+ // Idempotent: re-arming an already-running sweep is a no-op, so it is safe
88913
+ // to call again on start() after a previous destroy().
88891
88914
  clearAtInterval() {
88915
+ if (this.timer) {
88916
+ return;
88917
+ }
88892
88918
  // magic number,10s expired
88893
88919
  const clearIntervalMs = 10000;
88894
- setInterval(() => {
88920
+ this.timer = setInterval(() => {
88895
88921
  const now = Date.now();
88896
88922
  this.cache.forEach((value, key) => {
88897
88923
  var _a;
@@ -88902,6 +88928,20 @@ class DataCache {
88902
88928
  }
88903
88929
  });
88904
88930
  }, clearIntervalMs);
88931
+ // Don't let the sweep timer keep the Node process alive on its own; the
88932
+ // process should be free to exit once nothing else references the loop.
88933
+ if (typeof this.timer.unref === 'function') {
88934
+ this.timer.unref();
88935
+ }
88936
+ }
88937
+ // Stop the sweep timer and drop cached fragments. Called from
88938
+ // WSClient.close() so the client releases its event-loop handle.
88939
+ destroy() {
88940
+ if (this.timer) {
88941
+ clearInterval(this.timer);
88942
+ this.timer = undefined;
88943
+ }
88944
+ this.cache.clear();
88905
88945
  }
88906
88946
  }
88907
88947
 
@@ -89436,6 +89476,7 @@ class WSClient {
89436
89476
  this.reconnectInterval = undefined;
89437
89477
  }
89438
89478
  this.clearLiveness();
89479
+ this.dataCache.destroy();
89439
89480
  this.isConnecting = false;
89440
89481
  this.currentReconnectAttempts = 0;
89441
89482
  const wsInstance = this.wsConfig.getWSInstance();
@@ -89467,6 +89508,9 @@ class WSClient {
89467
89508
  // getConnectionStatus() reflects the fresh start.
89468
89509
  this.terminalError = false;
89469
89510
  this.currentReconnectAttempts = 0;
89511
+ // Re-arm the cache sweep in case the client was previously close()d
89512
+ // (which destroys the timer); idempotent when already running.
89513
+ this.dataCache.clearAtInterval();
89470
89514
  this.logger.info('[ws]', `receive events or callbacks through persistent connection only available in self-build & Feishu app, Configured in:
89471
89515
  Developer Console(开发者后台)
89472
89516
  ->
@@ -89742,6 +89786,105 @@ class Aily {
89742
89786
  }
89743
89787
  }
89744
89788
 
89789
+ function assertPlainObject(value, path) {
89790
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
89791
+ throw new Error(`${path} must be an object`);
89792
+ }
89793
+ }
89794
+ /**
89795
+ * The confirm page silently discards the whole payload on any shape mismatch,
89796
+ * so unknown keys (typos, or sensitive manifest fields like `security`)
89797
+ * must fail loudly here instead.
89798
+ */
89799
+ function assertAllowedKeys(obj, allowed, path) {
89800
+ for (const key of Object.keys(obj)) {
89801
+ if (!allowed.includes(key)) {
89802
+ throw new Error(`${path}.${key} is not allowed; allowed keys: ${allowed.join(', ')}`);
89803
+ }
89804
+ }
89805
+ }
89806
+ function validateStringArray(value, path) {
89807
+ if (value === undefined) {
89808
+ return undefined;
89809
+ }
89810
+ if (!Array.isArray(value)) {
89811
+ throw new Error(`${path} must be an array of strings`);
89812
+ }
89813
+ value.forEach((item, idx) => {
89814
+ if (typeof item !== 'string' || item === '') {
89815
+ throw new Error(`${path}[${idx}] must be a non-empty string`);
89816
+ }
89817
+ });
89818
+ return value;
89819
+ }
89820
+ /**
89821
+ * Validate the shape of `addons` and rebuild it from the 5 known public
89822
+ * fields only, so nothing outside the whitelist can ever be serialized.
89823
+ */
89824
+ function normalizeAddons(addons) {
89825
+ assertPlainObject(addons, 'addons');
89826
+ assertAllowedKeys(addons, ['scopes', 'events', 'callbacks'], 'addons');
89827
+ let itemCount = 0;
89828
+ const pick = (value, path) => {
89829
+ var _a;
89830
+ const items = validateStringArray(value, path);
89831
+ itemCount += (_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0;
89832
+ return items;
89833
+ };
89834
+ const normalized = {};
89835
+ if (addons.scopes !== undefined) {
89836
+ assertPlainObject(addons.scopes, 'addons.scopes');
89837
+ assertAllowedKeys(addons.scopes, ['tenant', 'user'], 'addons.scopes');
89838
+ normalized.scopes = {
89839
+ tenant: pick(addons.scopes.tenant, 'addons.scopes.tenant'),
89840
+ user: pick(addons.scopes.user, 'addons.scopes.user'),
89841
+ };
89842
+ }
89843
+ if (addons.events !== undefined) {
89844
+ assertPlainObject(addons.events, 'addons.events');
89845
+ assertAllowedKeys(addons.events, ['items'], 'addons.events');
89846
+ if (addons.events.items !== undefined) {
89847
+ assertPlainObject(addons.events.items, 'addons.events.items');
89848
+ assertAllowedKeys(addons.events.items, ['tenant', 'user'], 'addons.events.items');
89849
+ normalized.events = {
89850
+ items: {
89851
+ tenant: pick(addons.events.items.tenant, 'addons.events.items.tenant'),
89852
+ user: pick(addons.events.items.user, 'addons.events.items.user'),
89853
+ },
89854
+ };
89855
+ }
89856
+ }
89857
+ if (addons.callbacks !== undefined) {
89858
+ assertPlainObject(addons.callbacks, 'addons.callbacks');
89859
+ assertAllowedKeys(addons.callbacks, ['items'], 'addons.callbacks');
89860
+ normalized.callbacks = {
89861
+ items: pick(addons.callbacks.items, 'addons.callbacks.items'),
89862
+ };
89863
+ }
89864
+ // An all-empty addons is treated as "no addons" by the confirm page —
89865
+ // passing one is always a caller bug, so surface it at build time.
89866
+ if (itemCount === 0) {
89867
+ throw new Error('addons must contain at least one scope, event or callback');
89868
+ }
89869
+ return normalized;
89870
+ }
89871
+ /**
89872
+ * Validate `addons` and encode it into the URL-safe string carried by the
89873
+ * `addons` query param of the one-click app creation / update link.
89874
+ *
89875
+ * Encoding pipeline (fixed by the platform):
89876
+ * `JSON.stringify → gzip → base64 → URL-safe ('+' → '-', '/' → '_') → strip '=' padding`.
89877
+ * The result only contains `A-Z a-z 0-9 - _` and needs no further escaping.
89878
+ */
89879
+ function encodeAddons(addons) {
89880
+ const json = JSON.stringify(normalizeAddons(addons));
89881
+ return gzipSync(Buffer.from(json, 'utf8'))
89882
+ .toString('base64')
89883
+ .replace(/\+/g, '-')
89884
+ .replace(/\//g, '_')
89885
+ .replace(/=+$/, '');
89886
+ }
89887
+
89745
89888
  function createError(code, description) {
89746
89889
  return { code, description };
89747
89890
  }
@@ -89896,7 +90039,10 @@ function startPolling(ctx) {
89896
90039
  function registerApp(options) {
89897
90040
  var _a, _b, _c, _d;
89898
90041
  return __awaiter(this, void 0, void 0, function* () {
89899
- const { domain, source, signal, onQRCodeReady, onStatusChange, appPreset } = options;
90042
+ const { domain, source, signal, onQRCodeReady, onStatusChange, appPreset, addons, createOnly, appId } = options;
90043
+ if (appId !== undefined && (typeof appId !== 'string' || appId === '')) {
90044
+ throw new Error('appId must be a non-empty string');
90045
+ }
89900
90046
  const baseUrl = `https://${domain !== null && domain !== void 0 ? domain : DEFAULT_FEISHU_DOMAIN}`;
89901
90047
  const beginRes = yield begin(baseUrl);
89902
90048
  const qrCodeUrl = new URL(beginRes.verification_uri_complete);
@@ -89906,6 +90052,19 @@ function registerApp(options) {
89906
90052
  if (appPreset) {
89907
90053
  applyAppPreset(qrCodeUrl, appPreset);
89908
90054
  }
90055
+ if (addons) {
90056
+ qrCodeUrl.searchParams.set('addons', encodeAddons(addons));
90057
+ }
90058
+ // The landing page only honors the literal value 'true'; anything else is
90059
+ // treated as absent, so the param is simply omitted in that case.
90060
+ if (createOnly === true) {
90061
+ qrCodeUrl.searchParams.set('createOnly', 'true');
90062
+ }
90063
+ // When both are present the page gives createOnly precedence and ignores
90064
+ // clientID, so the two params can be passed through together as-is.
90065
+ if (appId) {
90066
+ qrCodeUrl.searchParams.set('clientID', appId);
90067
+ }
89909
90068
  onQRCodeReady({
89910
90069
  url: qrCodeUrl.toString(),
89911
90070
  expireIn: (_a = beginRes.expires_in) !== null && _a !== void 0 ? _a : 600,
@@ -93664,4 +93823,4 @@ function cardActionId(action) {
93664
93823
  return `${action.tag}|${(_b = action.name) !== null && _b !== void 0 ? _b : ''}|${(_c = action.option) !== null && _c !== void 0 ? _c : ''}|${valuePart}`;
93665
93824
  }
93666
93825
 
93667
- export { AESCipher, Aily, AppType, CAppTicket, CTenantAccessToken, CardActionHandler, Client, Domain, EventDispatcher, LarkChannel, LarkChannelError, LoggerLevel, WSClient, adaptDefault, adaptExpress, adaptKoa, adaptKoaRouter, createLarkChannel, defaultHttpInstance, generateChallenge, messageCard, normalize, normalizeBotAdded, normalizeCardAction, normalizeComment, normalizeReaction, registerApp, withAll, withHelpDeskCredential, withTenantKey, withTenantToken, withUserAccessToken };
93826
+ export { AESCipher, Aily, AppType, CAppTicket, CTenantAccessToken, CardActionHandler, Client, DefaultCache, Domain, EventDispatcher, LarkChannel, LarkChannelError, LoggerLevel, LoggerProxy, WSClient, adaptDefault, adaptExpress, adaptKoa, adaptKoaRouter, createLarkChannel, defaultHttpInstance, defaultLogger, generateChallenge, internalCache, messageCard, normalize, normalizeBotAdded, normalizeCardAction, normalizeComment, normalizeReaction, registerApp, withAll, withHelpDeskCredential, withTenantKey, withTenantToken, withUserAccessToken };
@@ -24,6 +24,7 @@ var pickBy = require('lodash.pickby');
24
24
  var merge = require('lodash.merge');
25
25
  var qs$1 = require('querystring');
26
26
  var WebSocket = require('ws');
27
+ var zlib = require('zlib');
27
28
  var http = require('http');
28
29
  var https = require('https');
29
30
  var dns = require('dns');
@@ -87349,6 +87350,18 @@ class AppTicketManager {
87349
87350
  }
87350
87351
  }
87351
87352
 
87353
+ /**
87354
+ * Build an error message for a token response that is missing its expected
87355
+ * field. Only the API's own `code`/`msg` are echoed back — never request
87356
+ * credentials (app_secret, app_ticket, tokens) — so the message is safe to
87357
+ * surface to callers and logs.
87358
+ */
87359
+ function buildTokenError(field, response) {
87360
+ var _a, _b;
87361
+ const code = (_a = response === null || response === void 0 ? void 0 : response.code) !== null && _a !== void 0 ? _a : 'unknown';
87362
+ const msg = (_b = response === null || response === void 0 ? void 0 : response.msg) !== null && _b !== void 0 ? _b : 'no message';
87363
+ return `failed to get ${field}, code: ${code}, msg: ${msg}`;
87364
+ }
87352
87365
  class TokenManager {
87353
87366
  constructor(params) {
87354
87367
  this.appId = params.appId;
@@ -87369,6 +87382,29 @@ class TokenManager {
87369
87382
  });
87370
87383
  this.logger.debug('token manager is ready');
87371
87384
  }
87385
+ /**
87386
+ * POST a token endpoint and return the validated response body.
87387
+ *
87388
+ * On transport failure the original error is logged and rethrown — so the
87389
+ * caller sees the real cause (EPIPE, timeout, ...) instead of a secondary
87390
+ * "Cannot destructure ... of undefined". On an HTTP-200 business failure the
87391
+ * required field is absent; we throw an error carrying only the API's
87392
+ * code/msg and never cache an undefined token.
87393
+ */
87394
+ requestToken(url, body, requiredField) {
87395
+ return __awaiter(this, void 0, void 0, function* () {
87396
+ const response = yield this.httpInstance
87397
+ .post(url, body)
87398
+ .catch((e) => {
87399
+ this.logger.error(e);
87400
+ throw e;
87401
+ });
87402
+ if (!response || !response[requiredField]) {
87403
+ throw new Error(buildTokenError(requiredField, response));
87404
+ }
87405
+ return response;
87406
+ });
87407
+ }
87372
87408
  getCustomTenantAccessToken() {
87373
87409
  var _a, _b;
87374
87410
  return __awaiter(this, void 0, void 0, function* () {
@@ -87380,15 +87416,10 @@ class TokenManager {
87380
87416
  return cachedTenantAccessToken;
87381
87417
  }
87382
87418
  this.logger.debug('request token');
87383
- // @ts-ignore
87384
- const { tenant_access_token, expire } = yield this.httpInstance
87385
- .post(`${this.domain}/open-apis/auth/v3/tenant_access_token/internal`, {
87419
+ const { tenant_access_token, expire } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/tenant_access_token/internal`, {
87386
87420
  app_id: this.appId,
87387
87421
  app_secret: this.appSecret,
87388
- })
87389
- .catch((e) => {
87390
- this.logger.error(e);
87391
- });
87422
+ }, 'tenant_access_token');
87392
87423
  yield ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.set(CTenantAccessToken, tenant_access_token,
87393
87424
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
87394
87425
  new Date().getTime() + expire * 1000 - 3 * 60 * 1000, {
@@ -87419,27 +87450,17 @@ class TokenManager {
87419
87450
  }
87420
87451
  this.logger.debug('get app access token');
87421
87452
  // 获取app_access_token
87422
- // @ts-ignore
87423
- const { app_access_token } = yield this.httpInstance
87424
- .post(`${this.domain}/open-apis/auth/v3/app_access_token`, {
87453
+ const { app_access_token } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/app_access_token`, {
87425
87454
  app_id: this.appId,
87426
87455
  app_secret: this.appSecret,
87427
87456
  app_ticket: appTicket,
87428
- })
87429
- .catch((e) => {
87430
- this.logger.error(e);
87431
- });
87457
+ }, 'app_access_token');
87432
87458
  this.logger.debug('get tenant access token');
87433
87459
  // 获取tenant_access_token
87434
- // @ts-ignore
87435
- const { tenant_access_token, expire } = yield this.httpInstance
87436
- .post(`${this.domain}/open-apis/auth/v3/tenant_access_token`, {
87460
+ const { tenant_access_token, expire } = yield this.requestToken(`${this.domain}/open-apis/auth/v3/tenant_access_token`, {
87437
87461
  app_access_token,
87438
87462
  tenant_key: tenantKey,
87439
- })
87440
- .catch((e) => {
87441
- this.logger.error(e);
87442
- });
87463
+ }, 'tenant_access_token');
87443
87464
  // 设置tenant_access_token
87444
87465
  yield this.cache.set(`larkMarketAccessToken${tenantKey}`, tenant_access_token,
87445
87466
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
@@ -88906,10 +88927,15 @@ class DataCache {
88906
88927
  deleteCache(message_id) {
88907
88928
  this.cache.delete(message_id);
88908
88929
  }
88930
+ // Idempotent: re-arming an already-running sweep is a no-op, so it is safe
88931
+ // to call again on start() after a previous destroy().
88909
88932
  clearAtInterval() {
88933
+ if (this.timer) {
88934
+ return;
88935
+ }
88910
88936
  // magic number,10s expired
88911
88937
  const clearIntervalMs = 10000;
88912
- setInterval(() => {
88938
+ this.timer = setInterval(() => {
88913
88939
  const now = Date.now();
88914
88940
  this.cache.forEach((value, key) => {
88915
88941
  var _a;
@@ -88920,6 +88946,20 @@ class DataCache {
88920
88946
  }
88921
88947
  });
88922
88948
  }, clearIntervalMs);
88949
+ // Don't let the sweep timer keep the Node process alive on its own; the
88950
+ // process should be free to exit once nothing else references the loop.
88951
+ if (typeof this.timer.unref === 'function') {
88952
+ this.timer.unref();
88953
+ }
88954
+ }
88955
+ // Stop the sweep timer and drop cached fragments. Called from
88956
+ // WSClient.close() so the client releases its event-loop handle.
88957
+ destroy() {
88958
+ if (this.timer) {
88959
+ clearInterval(this.timer);
88960
+ this.timer = undefined;
88961
+ }
88962
+ this.cache.clear();
88923
88963
  }
88924
88964
  }
88925
88965
 
@@ -89454,6 +89494,7 @@ class WSClient {
89454
89494
  this.reconnectInterval = undefined;
89455
89495
  }
89456
89496
  this.clearLiveness();
89497
+ this.dataCache.destroy();
89457
89498
  this.isConnecting = false;
89458
89499
  this.currentReconnectAttempts = 0;
89459
89500
  const wsInstance = this.wsConfig.getWSInstance();
@@ -89485,6 +89526,9 @@ class WSClient {
89485
89526
  // getConnectionStatus() reflects the fresh start.
89486
89527
  this.terminalError = false;
89487
89528
  this.currentReconnectAttempts = 0;
89529
+ // Re-arm the cache sweep in case the client was previously close()d
89530
+ // (which destroys the timer); idempotent when already running.
89531
+ this.dataCache.clearAtInterval();
89488
89532
  this.logger.info('[ws]', `receive events or callbacks through persistent connection only available in self-build & Feishu app, Configured in:
89489
89533
  Developer Console(开发者后台)
89490
89534
  ->
@@ -89760,6 +89804,105 @@ class Aily {
89760
89804
  }
89761
89805
  }
89762
89806
 
89807
+ function assertPlainObject(value, path) {
89808
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
89809
+ throw new Error(`${path} must be an object`);
89810
+ }
89811
+ }
89812
+ /**
89813
+ * The confirm page silently discards the whole payload on any shape mismatch,
89814
+ * so unknown keys (typos, or sensitive manifest fields like `security`)
89815
+ * must fail loudly here instead.
89816
+ */
89817
+ function assertAllowedKeys(obj, allowed, path) {
89818
+ for (const key of Object.keys(obj)) {
89819
+ if (!allowed.includes(key)) {
89820
+ throw new Error(`${path}.${key} is not allowed; allowed keys: ${allowed.join(', ')}`);
89821
+ }
89822
+ }
89823
+ }
89824
+ function validateStringArray(value, path) {
89825
+ if (value === undefined) {
89826
+ return undefined;
89827
+ }
89828
+ if (!Array.isArray(value)) {
89829
+ throw new Error(`${path} must be an array of strings`);
89830
+ }
89831
+ value.forEach((item, idx) => {
89832
+ if (typeof item !== 'string' || item === '') {
89833
+ throw new Error(`${path}[${idx}] must be a non-empty string`);
89834
+ }
89835
+ });
89836
+ return value;
89837
+ }
89838
+ /**
89839
+ * Validate the shape of `addons` and rebuild it from the 5 known public
89840
+ * fields only, so nothing outside the whitelist can ever be serialized.
89841
+ */
89842
+ function normalizeAddons(addons) {
89843
+ assertPlainObject(addons, 'addons');
89844
+ assertAllowedKeys(addons, ['scopes', 'events', 'callbacks'], 'addons');
89845
+ let itemCount = 0;
89846
+ const pick = (value, path) => {
89847
+ var _a;
89848
+ const items = validateStringArray(value, path);
89849
+ itemCount += (_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0;
89850
+ return items;
89851
+ };
89852
+ const normalized = {};
89853
+ if (addons.scopes !== undefined) {
89854
+ assertPlainObject(addons.scopes, 'addons.scopes');
89855
+ assertAllowedKeys(addons.scopes, ['tenant', 'user'], 'addons.scopes');
89856
+ normalized.scopes = {
89857
+ tenant: pick(addons.scopes.tenant, 'addons.scopes.tenant'),
89858
+ user: pick(addons.scopes.user, 'addons.scopes.user'),
89859
+ };
89860
+ }
89861
+ if (addons.events !== undefined) {
89862
+ assertPlainObject(addons.events, 'addons.events');
89863
+ assertAllowedKeys(addons.events, ['items'], 'addons.events');
89864
+ if (addons.events.items !== undefined) {
89865
+ assertPlainObject(addons.events.items, 'addons.events.items');
89866
+ assertAllowedKeys(addons.events.items, ['tenant', 'user'], 'addons.events.items');
89867
+ normalized.events = {
89868
+ items: {
89869
+ tenant: pick(addons.events.items.tenant, 'addons.events.items.tenant'),
89870
+ user: pick(addons.events.items.user, 'addons.events.items.user'),
89871
+ },
89872
+ };
89873
+ }
89874
+ }
89875
+ if (addons.callbacks !== undefined) {
89876
+ assertPlainObject(addons.callbacks, 'addons.callbacks');
89877
+ assertAllowedKeys(addons.callbacks, ['items'], 'addons.callbacks');
89878
+ normalized.callbacks = {
89879
+ items: pick(addons.callbacks.items, 'addons.callbacks.items'),
89880
+ };
89881
+ }
89882
+ // An all-empty addons is treated as "no addons" by the confirm page —
89883
+ // passing one is always a caller bug, so surface it at build time.
89884
+ if (itemCount === 0) {
89885
+ throw new Error('addons must contain at least one scope, event or callback');
89886
+ }
89887
+ return normalized;
89888
+ }
89889
+ /**
89890
+ * Validate `addons` and encode it into the URL-safe string carried by the
89891
+ * `addons` query param of the one-click app creation / update link.
89892
+ *
89893
+ * Encoding pipeline (fixed by the platform):
89894
+ * `JSON.stringify → gzip → base64 → URL-safe ('+' → '-', '/' → '_') → strip '=' padding`.
89895
+ * The result only contains `A-Z a-z 0-9 - _` and needs no further escaping.
89896
+ */
89897
+ function encodeAddons(addons) {
89898
+ const json = JSON.stringify(normalizeAddons(addons));
89899
+ return zlib.gzipSync(Buffer.from(json, 'utf8'))
89900
+ .toString('base64')
89901
+ .replace(/\+/g, '-')
89902
+ .replace(/\//g, '_')
89903
+ .replace(/=+$/, '');
89904
+ }
89905
+
89763
89906
  function createError(code, description) {
89764
89907
  return { code, description };
89765
89908
  }
@@ -89914,7 +90057,10 @@ function startPolling(ctx) {
89914
90057
  function registerApp(options) {
89915
90058
  var _a, _b, _c, _d;
89916
90059
  return __awaiter(this, void 0, void 0, function* () {
89917
- const { domain, source, signal, onQRCodeReady, onStatusChange, appPreset } = options;
90060
+ const { domain, source, signal, onQRCodeReady, onStatusChange, appPreset, addons, createOnly, appId } = options;
90061
+ if (appId !== undefined && (typeof appId !== 'string' || appId === '')) {
90062
+ throw new Error('appId must be a non-empty string');
90063
+ }
89918
90064
  const baseUrl = `https://${domain !== null && domain !== void 0 ? domain : DEFAULT_FEISHU_DOMAIN}`;
89919
90065
  const beginRes = yield begin(baseUrl);
89920
90066
  const qrCodeUrl = new URL(beginRes.verification_uri_complete);
@@ -89924,6 +90070,19 @@ function registerApp(options) {
89924
90070
  if (appPreset) {
89925
90071
  applyAppPreset(qrCodeUrl, appPreset);
89926
90072
  }
90073
+ if (addons) {
90074
+ qrCodeUrl.searchParams.set('addons', encodeAddons(addons));
90075
+ }
90076
+ // The landing page only honors the literal value 'true'; anything else is
90077
+ // treated as absent, so the param is simply omitted in that case.
90078
+ if (createOnly === true) {
90079
+ qrCodeUrl.searchParams.set('createOnly', 'true');
90080
+ }
90081
+ // When both are present the page gives createOnly precedence and ignores
90082
+ // clientID, so the two params can be passed through together as-is.
90083
+ if (appId) {
90084
+ qrCodeUrl.searchParams.set('clientID', appId);
90085
+ }
89927
90086
  onQRCodeReady({
89928
90087
  url: qrCodeUrl.toString(),
89929
90088
  expireIn: (_a = beginRes.expires_in) !== null && _a !== void 0 ? _a : 600,
@@ -93688,9 +93847,11 @@ exports.CAppTicket = CAppTicket;
93688
93847
  exports.CTenantAccessToken = CTenantAccessToken;
93689
93848
  exports.CardActionHandler = CardActionHandler;
93690
93849
  exports.Client = Client;
93850
+ exports.DefaultCache = DefaultCache;
93691
93851
  exports.EventDispatcher = EventDispatcher;
93692
93852
  exports.LarkChannel = LarkChannel;
93693
93853
  exports.LarkChannelError = LarkChannelError;
93854
+ exports.LoggerProxy = LoggerProxy;
93694
93855
  exports.WSClient = WSClient;
93695
93856
  exports.adaptDefault = adaptDefault;
93696
93857
  exports.adaptExpress = adaptExpress;
@@ -93698,7 +93859,9 @@ exports.adaptKoa = adaptKoa;
93698
93859
  exports.adaptKoaRouter = adaptKoaRouter;
93699
93860
  exports.createLarkChannel = createLarkChannel;
93700
93861
  exports.defaultHttpInstance = defaultHttpInstance;
93862
+ exports.defaultLogger = defaultLogger;
93701
93863
  exports.generateChallenge = generateChallenge;
93864
+ exports.internalCache = internalCache;
93702
93865
  exports.messageCard = messageCard;
93703
93866
  exports.normalize = normalize;
93704
93867
  exports.normalizeBotAdded = normalizeBotAdded;