@openclaw/whatsapp 2026.7.2-beta.7 → 2026.7.34

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 (435) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-control-pZcxTmd5.js → .setup/access-control-C0jumQuO.mjs} +5 -4
  3. package/dist/.setup/account-config-6PTOSfaI.mjs +47 -0
  4. package/dist/{accounts-CSqLvCY5.js → .setup/accounts-Dw16pdNl.mjs} +9 -47
  5. package/dist/{action-runtime-BzfDFPbH.js → .setup/action-runtime-DLK_9v4r.mjs} +3 -3
  6. package/dist/{active-listener-BEjWsCNM.js → .setup/active-listener-CloPBx0S.mjs} +3 -3
  7. package/dist/{agent-tools-login-DE9MU98T.js → .setup/agent-tools-login-DINqgaYo.mjs} +19 -7
  8. package/dist/{approval-handler.runtime-DrA59QSA.js → .setup/approval-handler.runtime-DtJZbu3y.mjs} +14 -20
  9. package/dist/{approval-resolver-DoeBBt22.js → .setup/approval-resolver-DF-lu8k5.mjs} +1 -2
  10. package/dist/{auth-store-DcEpIOmE.js → .setup/auth-store-BZKGa0tW.mjs} +25 -29
  11. package/dist/{channel-Dg62olhy.js → .setup/channel-9WGjBznd.mjs} +117 -132
  12. package/dist/{channel-react-action-J_YtyMGX.js → .setup/channel-react-action-mvIbAFhn.mjs} +15 -12
  13. package/dist/{channel.runtime-BP0xNmLi.js → .setup/channel.runtime-DmmMgRJQ.mjs} +6 -6
  14. package/dist/.setup/channel.setup-ByBYSeLd.mjs +22 -0
  15. package/dist/.setup/config-schema-mBX2nmn1.mjs +47 -0
  16. package/dist/{connection-controller-BOB2MVKY.js → .setup/connection-controller-Dt62u6fI.mjs} +29 -226
  17. package/dist/.setup/connection-controller-registry-TSX_udJp.mjs +22 -0
  18. package/dist/{constants-HU41RHGI.js → .setup/constants-C7m81BNe.mjs} +1 -1
  19. package/dist/.setup/directory-config-B7Obxrq2.mjs +37 -0
  20. package/dist/.setup/doctor-By3SB4lm.mjs +48 -0
  21. package/dist/{group-session-key-DVMZlO3x.js → .setup/group-session-key-CEwPRRRK.mjs} +5 -38
  22. package/dist/{identity-CPrT5aEU.js → .setup/identity-CDB1bT-p.mjs} +2 -2
  23. package/dist/.setup/legacy-session-surface-api-B2szjq4r.mjs +2 -0
  24. package/dist/.setup/legacy-state-migrations-api-DXCxufZz.mjs +3 -0
  25. package/dist/{login-CvY2Dhch.js → .setup/login-7b3M0iBp.mjs} +12 -51
  26. package/dist/{login-qr-Bncpb6js.js → .setup/login-qr-CbyA4QX5.mjs} +47 -23
  27. package/dist/{monitor-CfkaUSL2.js → .setup/monitor-Dh6Di_YO.mjs} +1451 -1843
  28. package/dist/.setup/normalize-eddWWsNV.mjs +2 -0
  29. package/dist/{normalize-target-CugRyONv.js → .setup/normalize-target-bVWjgftN.mjs} +10 -18
  30. package/dist/{resolve-outbound-target-1GqbT1uX.js → .setup/resolve-outbound-target-oI7VpU4w.mjs} +1 -1
  31. package/dist/.setup/runtime-BfAdAEYT.mjs +8 -0
  32. package/dist/.setup/send-BQjMC41n.mjs +777 -0
  33. package/dist/{send-api-7wk6eQyW.js → .setup/send-api-BiAkPLr3.mjs} +155 -105
  34. package/dist/{session-errors-JuazczrA.js → .setup/session-errors-BAj9D2La.mjs} +1 -2
  35. package/dist/.setup/session-vUI41Jel.mjs +252 -0
  36. package/dist/.setup/session.runtime-B-V3rXP6.mjs +12 -0
  37. package/dist/{shared-CAxd15bp.js → .setup/setup-core--FfzntMG.mjs} +94 -63
  38. package/dist/{setup-finalize-BZucx24W.js → .setup/setup-finalize-DCruIciL.mjs} +17 -46
  39. package/dist/.setup/setup-plugin-api-B6ck_20D.mjs +3 -0
  40. package/dist/{setup-surface-BkVcd769.js → .setup/setup-surface-Zvj2cLzz.mjs} +4 -4
  41. package/dist/.setup/socket-timing-DhbVFjah.mjs +77 -0
  42. package/dist/{state-migrations-CAMTrs2U.js → .setup/state-migrations-D_BmQUR9.mjs} +8 -1
  43. package/dist/.setup/targets-runtime-C-GiVn6Y.mjs +188 -0
  44. package/dist/.setup/text-runtime-CUrq1mFq.mjs +4 -0
  45. package/dist/action-runtime-api.js +1 -1
  46. package/dist/action-runtime.runtime.js +1 -1
  47. package/dist/{call-tool-api.js → agent-tools-api.js} +26 -11
  48. package/dist/api.js +27 -17
  49. package/dist/auth-presence.js +1 -1
  50. package/dist/channel-config-api.js +1 -1
  51. package/dist/channel-plugin-api.js +1 -1
  52. package/dist/constants.js +2 -0
  53. package/dist/contract-api.js +5 -5
  54. package/dist/directory-contract-api.js +1 -1
  55. package/dist/doctor-contract-api.js +5 -46
  56. package/dist/index.js +4 -4
  57. package/dist/legacy-session-surface-api.js +1 -1
  58. package/dist/legacy-state-migrations-api.js +1 -1
  59. package/dist/light-runtime-api.js +4 -4
  60. package/dist/login-qr-runtime.js +1 -1
  61. package/dist/runtime-api.js +14 -14
  62. package/dist/runtime-setter-api.js +1 -1
  63. package/dist/security-contract-api.js +1 -1
  64. package/dist/setup-entry.js +4 -3
  65. package/dist/setup-plugin-api.js +1 -1
  66. package/dist/targets.js +2 -0
  67. package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/package.json +4 -4
  68. package/node_modules/audio-decode/node_modules/@thi.ng/errors/package.json +4 -4
  69. package/node_modules/audio-decode/node_modules/audio-type/package.json +2 -3
  70. package/node_modules/baileys/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  71. package/node_modules/baileys/node_modules/@protobufjs/aspromise/README.md +13 -0
  72. package/node_modules/baileys/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
  73. package/node_modules/baileys/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
  74. package/node_modules/baileys/node_modules/@protobufjs/aspromise/package.json +21 -0
  75. package/node_modules/baileys/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  76. package/node_modules/baileys/node_modules/@protobufjs/base64/LICENSE +26 -0
  77. package/node_modules/baileys/node_modules/@protobufjs/base64/README.md +19 -0
  78. package/node_modules/baileys/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
  79. package/node_modules/baileys/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
  80. package/node_modules/baileys/node_modules/@protobufjs/base64/package.json +21 -0
  81. package/node_modules/baileys/node_modules/@protobufjs/base64/tests/index.js +46 -0
  82. package/node_modules/baileys/node_modules/@protobufjs/codegen/LICENSE +26 -0
  83. package/node_modules/baileys/node_modules/@protobufjs/codegen/README.md +49 -0
  84. package/node_modules/baileys/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
  85. package/node_modules/baileys/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -118
  86. package/node_modules/baileys/node_modules/@protobufjs/codegen/package.json +13 -0
  87. package/node_modules/baileys/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  88. package/node_modules/baileys/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
  89. package/node_modules/baileys/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  90. package/node_modules/baileys/node_modules/@protobufjs/eventemitter/README.md +22 -0
  91. package/node_modules/baileys/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
  92. package/node_modules/baileys/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
  93. package/node_modules/baileys/node_modules/@protobufjs/eventemitter/package.json +21 -0
  94. package/node_modules/baileys/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
  95. package/node_modules/baileys/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  96. package/node_modules/baileys/node_modules/@protobufjs/fetch/LICENSE +26 -0
  97. package/node_modules/baileys/node_modules/@protobufjs/fetch/README.md +13 -0
  98. package/node_modules/baileys/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
  99. package/node_modules/baileys/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
  100. package/node_modules/baileys/node_modules/@protobufjs/fetch/package.json +27 -0
  101. package/node_modules/baileys/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  102. package/node_modules/baileys/node_modules/@protobufjs/fetch/tests/index.js +158 -0
  103. package/node_modules/baileys/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  104. package/node_modules/baileys/node_modules/@protobufjs/float/LICENSE +26 -0
  105. package/node_modules/baileys/node_modules/@protobufjs/float/README.md +102 -0
  106. package/node_modules/baileys/node_modules/@protobufjs/float/bench/index.js +87 -0
  107. package/node_modules/baileys/node_modules/@protobufjs/float/bench/suite.js +46 -0
  108. package/node_modules/baileys/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
  109. package/node_modules/baileys/node_modules/@protobufjs/float/package.json +26 -0
  110. package/node_modules/baileys/node_modules/@protobufjs/float/tests/index.js +100 -0
  111. package/node_modules/baileys/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
  112. package/node_modules/baileys/node_modules/@protobufjs/inquire/LICENSE +26 -0
  113. package/node_modules/baileys/node_modules/@protobufjs/inquire/README.md +13 -0
  114. package/node_modules/baileys/node_modules/@protobufjs/inquire/index.d.ts +10 -0
  115. package/node_modules/baileys/node_modules/@protobufjs/inquire/index.js +38 -0
  116. package/node_modules/baileys/node_modules/@protobufjs/inquire/package.json +21 -0
  117. package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
  118. package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
  119. package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
  120. package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
  121. package/node_modules/baileys/node_modules/@protobufjs/inquire/tests/index.js +20 -0
  122. package/node_modules/baileys/node_modules/@protobufjs/path/LICENSE +26 -0
  123. package/node_modules/baileys/node_modules/@protobufjs/path/README.md +19 -0
  124. package/node_modules/baileys/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
  125. package/node_modules/baileys/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -100
  126. package/node_modules/baileys/node_modules/@protobufjs/path/package.json +21 -0
  127. package/node_modules/baileys/node_modules/@protobufjs/path/tests/index.js +60 -0
  128. package/node_modules/baileys/node_modules/@protobufjs/pool/.npmignore +3 -0
  129. package/node_modules/baileys/node_modules/@protobufjs/pool/LICENSE +26 -0
  130. package/node_modules/baileys/node_modules/@protobufjs/pool/README.md +13 -0
  131. package/node_modules/baileys/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
  132. package/node_modules/baileys/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
  133. package/node_modules/baileys/node_modules/@protobufjs/pool/package.json +21 -0
  134. package/node_modules/baileys/node_modules/@protobufjs/pool/tests/index.js +33 -0
  135. package/node_modules/baileys/node_modules/@protobufjs/utf8/LICENSE +26 -0
  136. package/node_modules/baileys/node_modules/@protobufjs/utf8/README.md +20 -0
  137. package/node_modules/baileys/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
  138. package/node_modules/baileys/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -190
  139. package/node_modules/baileys/node_modules/@protobufjs/utf8/package.json +21 -0
  140. package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
  141. package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  142. package/node_modules/baileys/node_modules/@protobufjs/utf8/tests/index.js +74 -0
  143. package/node_modules/baileys/node_modules/@types/node/LICENSE +21 -0
  144. package/node_modules/baileys/node_modules/@types/node/README.md +15 -0
  145. package/node_modules/baileys/node_modules/@types/node/assert/strict.d.ts +68 -0
  146. package/node_modules/baileys/node_modules/@types/node/assert.d.ts +1077 -0
  147. package/node_modules/baileys/node_modules/@types/node/async_hooks.d.ts +711 -0
  148. package/node_modules/baileys/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  149. package/node_modules/baileys/node_modules/@types/node/buffer.d.ts +1799 -0
  150. package/node_modules/baileys/node_modules/@types/node/child_process.d.ts +1362 -0
  151. package/node_modules/baileys/node_modules/@types/node/cluster.d.ts +432 -0
  152. package/node_modules/baileys/node_modules/@types/node/console.d.ts +93 -0
  153. package/node_modules/baileys/node_modules/@types/node/constants.d.ts +14 -0
  154. package/node_modules/baileys/node_modules/@types/node/crypto.d.ts +3954 -0
  155. package/node_modules/baileys/node_modules/@types/node/dgram.d.ts +537 -0
  156. package/node_modules/baileys/node_modules/@types/node/diagnostics_channel.d.ts +794 -0
  157. package/node_modules/baileys/node_modules/@types/node/dns/promises.d.ts +497 -0
  158. package/node_modules/baileys/node_modules/@types/node/dns.d.ts +876 -0
  159. package/node_modules/baileys/node_modules/@types/node/domain.d.ts +150 -0
  160. package/node_modules/baileys/node_modules/@types/node/events.d.ts +1008 -0
  161. package/node_modules/baileys/node_modules/@types/node/ffi.d.ts +486 -0
  162. package/node_modules/baileys/node_modules/@types/node/fs/promises.d.ts +1471 -0
  163. package/node_modules/baileys/node_modules/@types/node/fs.d.ts +4786 -0
  164. package/node_modules/baileys/node_modules/@types/node/globals.d.ts +150 -0
  165. package/node_modules/baileys/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  166. package/node_modules/baileys/node_modules/@types/node/http.d.ts +2172 -0
  167. package/node_modules/baileys/node_modules/@types/node/http2.d.ts +2489 -0
  168. package/node_modules/baileys/node_modules/@types/node/https.d.ts +400 -0
  169. package/node_modules/baileys/node_modules/@types/node/index.d.ts +115 -0
  170. package/node_modules/baileys/node_modules/@types/node/inspector/promises.d.ts +35 -0
  171. package/node_modules/baileys/node_modules/@types/node/inspector.d.ts +264 -0
  172. package/node_modules/baileys/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  173. package/node_modules/baileys/node_modules/@types/node/module.d.ts +726 -0
  174. package/node_modules/baileys/node_modules/@types/node/net.d.ts +970 -0
  175. package/node_modules/baileys/node_modules/@types/node/os.d.ts +498 -0
  176. package/node_modules/baileys/node_modules/@types/node/package.json +155 -0
  177. package/node_modules/baileys/node_modules/@types/node/path/posix.d.ts +8 -0
  178. package/node_modules/baileys/node_modules/@types/node/path/win32.d.ts +8 -0
  179. package/node_modules/baileys/node_modules/@types/node/path.d.ts +178 -0
  180. package/node_modules/baileys/node_modules/@types/node/perf_hooks.d.ts +604 -0
  181. package/node_modules/baileys/node_modules/@types/node/process.d.ts +2217 -0
  182. package/node_modules/baileys/node_modules/@types/node/punycode.d.ts +89 -0
  183. package/node_modules/baileys/node_modules/@types/node/querystring.d.ts +139 -0
  184. package/node_modules/baileys/node_modules/@types/node/quic.d.ts +978 -0
  185. package/node_modules/baileys/node_modules/@types/node/readline/promises.d.ts +158 -0
  186. package/node_modules/baileys/node_modules/@types/node/readline.d.ts +508 -0
  187. package/node_modules/baileys/node_modules/@types/node/repl.d.ts +420 -0
  188. package/node_modules/baileys/node_modules/@types/node/sea.d.ts +47 -0
  189. package/node_modules/baileys/node_modules/@types/node/sqlite.d.ts +1123 -0
  190. package/node_modules/baileys/node_modules/@types/node/stream/consumers.d.ts +114 -0
  191. package/node_modules/baileys/node_modules/@types/node/stream/iter.d.ts +451 -0
  192. package/node_modules/baileys/node_modules/@types/node/stream/promises.d.ts +211 -0
  193. package/node_modules/baileys/node_modules/@types/node/stream/web.d.ts +300 -0
  194. package/node_modules/baileys/node_modules/@types/node/stream.d.ts +1806 -0
  195. package/node_modules/baileys/node_modules/@types/node/string_decoder.d.ts +27 -0
  196. package/node_modules/baileys/node_modules/@types/node/test/reporters.d.ts +59 -0
  197. package/node_modules/baileys/node_modules/@types/node/test.d.ts +2389 -0
  198. package/node_modules/baileys/node_modules/@types/node/timers/promises.d.ts +93 -0
  199. package/node_modules/baileys/node_modules/@types/node/timers.d.ts +149 -0
  200. package/node_modules/baileys/node_modules/@types/node/tls.d.ts +1193 -0
  201. package/node_modules/baileys/node_modules/@types/node/trace_events.d.ts +103 -0
  202. package/node_modules/baileys/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  203. package/node_modules/baileys/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  204. package/node_modules/baileys/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  205. package/node_modules/baileys/node_modules/@types/node/ts5.6/index.d.ts +117 -0
  206. package/node_modules/baileys/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  207. package/node_modules/baileys/node_modules/@types/node/ts5.7/index.d.ts +117 -0
  208. package/node_modules/baileys/node_modules/@types/node/tty.d.ts +225 -0
  209. package/node_modules/baileys/node_modules/@types/node/url.d.ts +556 -0
  210. package/node_modules/baileys/node_modules/@types/node/util/types.d.ts +558 -0
  211. package/node_modules/baileys/node_modules/@types/node/util.d.ts +1677 -0
  212. package/node_modules/baileys/node_modules/@types/node/v8.d.ts +1062 -0
  213. package/node_modules/baileys/node_modules/@types/node/vm.d.ts +1136 -0
  214. package/node_modules/baileys/node_modules/@types/node/wasi.d.ts +131 -0
  215. package/node_modules/baileys/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  216. package/node_modules/baileys/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  217. package/node_modules/baileys/node_modules/@types/node/web-globals/console.d.ts +9 -0
  218. package/node_modules/baileys/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  219. package/node_modules/baileys/node_modules/@types/node/web-globals/domexception.d.ts +83 -0
  220. package/node_modules/baileys/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  221. package/node_modules/baileys/node_modules/@types/node/web-globals/events.d.ts +106 -0
  222. package/node_modules/baileys/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  223. package/node_modules/baileys/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  224. package/node_modules/baileys/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  225. package/node_modules/baileys/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  226. package/node_modules/baileys/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  227. package/node_modules/baileys/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  228. package/node_modules/baileys/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  229. package/node_modules/baileys/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  230. package/node_modules/baileys/node_modules/@types/node/web-globals/url.d.ts +24 -0
  231. package/node_modules/baileys/node_modules/@types/node/worker_threads.d.ts +669 -0
  232. package/node_modules/baileys/node_modules/@types/node/zlib/iter.d.ts +131 -0
  233. package/node_modules/baileys/node_modules/@types/node/zlib.d.ts +589 -0
  234. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
  235. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.js +4 -11
  236. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
  237. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
  238. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
  239. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
  240. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.js +4 -11
  241. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
  242. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
  243. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
  244. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
  245. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.js +4 -11
  246. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
  247. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
  248. package/node_modules/baileys/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
  249. package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
  250. package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.js +4 -11
  251. package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
  252. package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
  253. package/node_modules/baileys/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
  254. package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
  255. package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.js +4 -11
  256. package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.js.map +1 -1
  257. package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.min.js +1 -1
  258. package/node_modules/baileys/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
  259. package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
  260. package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.js +4 -11
  261. package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
  262. package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
  263. package/node_modules/baileys/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
  264. package/node_modules/baileys/node_modules/lru-cache/package.json +1 -1
  265. package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
  266. package/node_modules/baileys/node_modules/music-metadata/lib/common/Util.js +1 -7
  267. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameHeader.js +3 -23
  268. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
  269. package/node_modules/baileys/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
  270. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +13 -38
  271. package/node_modules/baileys/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
  272. package/node_modules/baileys/node_modules/music-metadata/package.json +6 -6
  273. package/node_modules/baileys/node_modules/p-queue/dist/index.js +27 -37
  274. package/node_modules/baileys/node_modules/p-queue/package.json +1 -1
  275. package/node_modules/baileys/node_modules/protobufjs/README.md +553 -266
  276. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +1985 -3177
  277. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  278. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  279. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  280. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +1244 -1966
  281. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  282. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  283. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  284. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +2005 -3330
  285. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  286. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  287. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  288. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/README.md +70 -3
  289. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
  290. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
  291. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  292. package/node_modules/baileys/node_modules/protobufjs/google/api/annotations.json +1 -3
  293. package/node_modules/baileys/node_modules/protobufjs/google/api/http.json +1 -2
  294. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/api.json +6 -12
  295. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.json +87 -170
  296. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.proto +8 -0
  297. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/source_context.json +1 -2
  298. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/type.json +7 -14
  299. package/node_modules/baileys/node_modules/protobufjs/index.d.ts +703 -1066
  300. package/node_modules/baileys/node_modules/protobufjs/package.json +52 -25
  301. package/node_modules/baileys/node_modules/protobufjs/scripts/postinstall.js +32 -0
  302. package/node_modules/baileys/node_modules/protobufjs/src/common.js +8 -14
  303. package/node_modules/baileys/node_modules/protobufjs/src/converter.js +51 -85
  304. package/node_modules/baileys/node_modules/protobufjs/src/decoder.js +61 -205
  305. package/node_modules/baileys/node_modules/protobufjs/src/encoder.js +7 -27
  306. package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -18
  307. package/node_modules/baileys/node_modules/protobufjs/src/field.js +19 -71
  308. package/node_modules/baileys/node_modules/protobufjs/src/index-light.js +29 -29
  309. package/node_modules/baileys/node_modules/protobufjs/src/index-minimal.js +13 -12
  310. package/node_modules/baileys/node_modules/protobufjs/src/index.js +6 -6
  311. package/node_modules/baileys/node_modules/protobufjs/src/mapfield.js +8 -26
  312. package/node_modules/baileys/node_modules/protobufjs/src/message.js +11 -5
  313. package/node_modules/baileys/node_modules/protobufjs/src/method.js +7 -30
  314. package/node_modules/baileys/node_modules/protobufjs/src/namespace.js +10 -26
  315. package/node_modules/baileys/node_modules/protobufjs/src/object.js +31 -41
  316. package/node_modules/baileys/node_modules/protobufjs/src/oneof.js +1 -12
  317. package/node_modules/baileys/node_modules/protobufjs/src/parse.js +47 -169
  318. package/node_modules/baileys/node_modules/protobufjs/src/reader.js +50 -412
  319. package/node_modules/baileys/node_modules/protobufjs/src/reader_buffer.js +5 -31
  320. package/node_modules/baileys/node_modules/protobufjs/src/root.js +4 -16
  321. package/node_modules/baileys/node_modules/protobufjs/src/rpc/service.js +5 -18
  322. package/node_modules/baileys/node_modules/protobufjs/src/service.js +2 -15
  323. package/node_modules/baileys/node_modules/protobufjs/src/tokenize.js +1 -6
  324. package/node_modules/baileys/node_modules/protobufjs/src/type.js +36 -80
  325. package/node_modules/baileys/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  326. package/node_modules/baileys/node_modules/protobufjs/src/util/longbits.js +6 -10
  327. package/node_modules/baileys/node_modules/protobufjs/src/util/minimal.js +54 -71
  328. package/node_modules/baileys/node_modules/protobufjs/src/util.js +17 -51
  329. package/node_modules/baileys/node_modules/protobufjs/src/verifier.js +14 -19
  330. package/node_modules/baileys/node_modules/protobufjs/src/wrappers.js +3 -2
  331. package/node_modules/baileys/node_modules/protobufjs/src/writer.js +191 -424
  332. package/node_modules/baileys/node_modules/protobufjs/src/writer_buffer.js +26 -41
  333. package/node_modules/baileys/node_modules/protobufjs/tsconfig.json +5 -3
  334. package/node_modules/baileys/node_modules/undici-types/LICENSE +21 -0
  335. package/node_modules/baileys/node_modules/undici-types/README.md +6 -0
  336. package/node_modules/baileys/node_modules/undici-types/agent.d.ts +30 -0
  337. package/node_modules/baileys/node_modules/undici-types/api.d.ts +43 -0
  338. package/node_modules/baileys/node_modules/undici-types/balanced-pool.d.ts +30 -0
  339. package/node_modules/baileys/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  340. package/node_modules/baileys/node_modules/undici-types/cache.d.ts +36 -0
  341. package/node_modules/baileys/node_modules/undici-types/client-stats.d.ts +15 -0
  342. package/node_modules/baileys/node_modules/undici-types/client.d.ts +129 -0
  343. package/node_modules/baileys/node_modules/undici-types/connector.d.ts +36 -0
  344. package/node_modules/baileys/node_modules/undici-types/content-type.d.ts +21 -0
  345. package/node_modules/baileys/node_modules/undici-types/cookies.d.ts +30 -0
  346. package/node_modules/baileys/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  347. package/node_modules/baileys/node_modules/undici-types/dispatcher.d.ts +253 -0
  348. package/node_modules/baileys/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  349. package/node_modules/baileys/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  350. package/node_modules/baileys/node_modules/undici-types/errors.d.ts +177 -0
  351. package/node_modules/baileys/node_modules/undici-types/eventsource.d.ts +66 -0
  352. package/node_modules/baileys/node_modules/undici-types/fetch.d.ts +231 -0
  353. package/node_modules/baileys/node_modules/undici-types/formdata.d.ts +108 -0
  354. package/node_modules/baileys/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  355. package/node_modules/baileys/node_modules/undici-types/global-origin.d.ts +7 -0
  356. package/node_modules/baileys/node_modules/undici-types/h2c-client.d.ts +73 -0
  357. package/node_modules/baileys/node_modules/undici-types/handlers.d.ts +14 -0
  358. package/node_modules/baileys/node_modules/undici-types/header.d.ts +165 -0
  359. package/node_modules/baileys/node_modules/undici-types/index.d.ts +93 -0
  360. package/node_modules/baileys/node_modules/undici-types/interceptors.d.ts +80 -0
  361. package/node_modules/baileys/node_modules/undici-types/mock-agent.d.ts +68 -0
  362. package/node_modules/baileys/node_modules/undici-types/mock-call-history.d.ts +111 -0
  363. package/node_modules/baileys/node_modules/undici-types/mock-client.d.ts +27 -0
  364. package/node_modules/baileys/node_modules/undici-types/mock-errors.d.ts +12 -0
  365. package/node_modules/baileys/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  366. package/node_modules/baileys/node_modules/undici-types/mock-pool.d.ts +27 -0
  367. package/node_modules/baileys/node_modules/undici-types/package.json +55 -0
  368. package/node_modules/baileys/node_modules/undici-types/patch.d.ts +29 -0
  369. package/node_modules/baileys/node_modules/undici-types/pool-stats.d.ts +19 -0
  370. package/node_modules/baileys/node_modules/undici-types/pool.d.ts +39 -0
  371. package/node_modules/baileys/node_modules/undici-types/proxy-agent.d.ts +29 -0
  372. package/node_modules/baileys/node_modules/undici-types/readable.d.ts +68 -0
  373. package/node_modules/baileys/node_modules/undici-types/retry-agent.d.ts +8 -0
  374. package/node_modules/baileys/node_modules/undici-types/retry-handler.d.ts +125 -0
  375. package/node_modules/baileys/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  376. package/node_modules/baileys/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  377. package/node_modules/baileys/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  378. package/node_modules/baileys/node_modules/undici-types/util.d.ts +18 -0
  379. package/node_modules/baileys/node_modules/undici-types/utility.d.ts +7 -0
  380. package/node_modules/baileys/node_modules/undici-types/webidl.d.ts +346 -0
  381. package/node_modules/baileys/node_modules/undici-types/websocket.d.ts +188 -0
  382. package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
  383. package/node_modules/baileys/node_modules/ws/package.json +1 -1
  384. package/node_modules/typebox/build/compile/validator.d.mts +4 -1
  385. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  386. package/node_modules/typebox/build/guard/guard.mjs +2 -5
  387. package/node_modules/typebox/build/guard/string.mjs +4 -16
  388. package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
  389. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  390. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
  391. package/node_modules/typebox/build/typebox.d.mts +1 -1
  392. package/node_modules/typebox/build/typebox.mjs +1 -1
  393. package/node_modules/typebox/package.json +1 -1
  394. package/node_modules/typebox/readme.md +32 -29
  395. package/openclaw.plugin.json +239 -214
  396. package/package.json +11 -21
  397. package/dist/approval-reactions-Cu66aYdq.js +0 -373
  398. package/dist/channel.setup-pMwNVkCA.js +0 -19
  399. package/dist/config-schema-BQP5YCeK.js +0 -50
  400. package/dist/connection-controller-runtime-context-DG0tuYuw.js +0 -23
  401. package/dist/directory-config-DalGrfGN.js +0 -196
  402. package/dist/doctor-CwzVXKoE.js +0 -10
  403. package/dist/normalize-C7Hkc_vE.js +0 -2
  404. package/dist/question-reactions-CRsnyoMK.js +0 -142
  405. package/dist/runtime-BLlToOi6.js +0 -21
  406. package/dist/send-D37ddk22.js +0 -436
  407. package/dist/session.runtime-Nsqaehbd.js +0 -16
  408. package/dist/socket-close-DridEuzz.js +0 -622
  409. package/dist/targets-runtime-TMk0lGuy.js +0 -299
  410. package/dist/text-runtime-CaKLhowd.js +0 -4
  411. package/node_modules/baileys/node_modules/protobufjs/ext/README.md +0 -70
  412. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.d.ts +0 -87
  413. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -417
  414. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +0 -1356
  415. package/node_modules/baileys/node_modules/protobufjs/ext/protojson.LICENSE +0 -201
  416. package/node_modules/baileys/node_modules/protobufjs/ext/protojson.d.ts +0 -20
  417. package/node_modules/baileys/node_modules/protobufjs/ext/protojson.generated.d.ts +0 -49
  418. package/node_modules/baileys/node_modules/protobufjs/ext/protojson.js +0 -951
  419. package/node_modules/baileys/node_modules/protobufjs/ext/textformat.d.ts +0 -19
  420. package/node_modules/baileys/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -33
  421. package/node_modules/baileys/node_modules/protobufjs/ext/textformat.js +0 -1276
  422. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
  423. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
  424. package/node_modules/baileys/node_modules/protobufjs/src/typescript.js +0 -25
  425. /package/dist/{account-ids-CB5SOWjc.js → .setup/account-ids-CB5SOWjc.mjs} +0 -0
  426. /package/dist/{audio-preflight.runtime-C_glQhZY.js → .setup/audio-preflight.runtime-C_glQhZY.mjs} +0 -0
  427. /package/dist/{command-policy-BIOSHySD.js → .setup/command-policy-BIOSHySD.mjs} +0 -0
  428. /package/dist/{creds-files-B1kSWtBg.js → .setup/creds-files-B1kSWtBg.mjs} +0 -0
  429. /package/dist/{group-config-path-BGyzT9Lg.js → .setup/group-config-path-BGyzT9Lg.mjs} +0 -0
  430. /package/dist/{group-session-contract-DDnZSsJ1.js → .setup/group-session-contract-DDnZSsJ1.mjs} +0 -0
  431. /package/dist/{reply-resolver.runtime-Ded8D58Y.js → .setup/reply-resolver.runtime-Ded8D58Y.mjs} +0 -0
  432. /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  433. /package/dist/{security-contract-nAzD945y.js → .setup/security-contract-nAzD945y.mjs} +0 -0
  434. /package/dist/{session-contract-DMTm6Q_L.js → .setup/session-contract-DMTm6Q_L.mjs} +0 -0
  435. /package/node_modules/baileys/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
@@ -0,0 +1,794 @@
1
+ declare module "node:diagnostics_channel" {
2
+ import { AsyncLocalStorage } from "node:async_hooks";
3
+ /**
4
+ * Check if there are active subscribers to the named channel. This is helpful if
5
+ * the message you want to send might be expensive to prepare.
6
+ *
7
+ * This API is optional but helpful when trying to publish messages from very
8
+ * performance-sensitive code.
9
+ *
10
+ * ```js
11
+ * import diagnostics_channel from 'node:diagnostics_channel';
12
+ *
13
+ * if (diagnostics_channel.hasSubscribers('my-channel')) {
14
+ * // There are subscribers, prepare and publish message
15
+ * }
16
+ * ```
17
+ * @since v15.1.0, v14.17.0
18
+ * @param name The channel name
19
+ * @return If there are active subscribers
20
+ */
21
+ function hasSubscribers(name: string | symbol): boolean;
22
+ /**
23
+ * This is the primary entry-point for anyone wanting to publish to a named
24
+ * channel. It produces a channel object which is optimized to reduce overhead at
25
+ * publish time as much as possible.
26
+ *
27
+ * ```js
28
+ * import diagnostics_channel from 'node:diagnostics_channel';
29
+ *
30
+ * const channel = diagnostics_channel.channel('my-channel');
31
+ * ```
32
+ * @since v15.1.0, v14.17.0
33
+ * @param name The channel name
34
+ * @return The named channel object
35
+ */
36
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
37
+ function channel<ContextType = any, StoreType = ContextType>(
38
+ name: string | symbol,
39
+ ): Channel<ContextType, StoreType>;
40
+ type ChannelListener = (message: unknown, name: string | symbol) => void;
41
+ /**
42
+ * Register a message handler to subscribe to this channel. This message handler
43
+ * will be run synchronously whenever a message is published to the channel. Any
44
+ * errors thrown in the message handler will trigger an `'uncaughtException'`.
45
+ *
46
+ * ```js
47
+ * import diagnostics_channel from 'node:diagnostics_channel';
48
+ *
49
+ * diagnostics_channel.subscribe('my-channel', (message, name) => {
50
+ * // Received data
51
+ * });
52
+ * ```
53
+ * @since v18.7.0, v16.17.0
54
+ * @param name The channel name
55
+ * @param onMessage The handler to receive channel messages
56
+ */
57
+ function subscribe(name: string | symbol, onMessage: ChannelListener): void;
58
+ /**
59
+ * Remove a message handler previously registered to this channel with {@link subscribe}.
60
+ *
61
+ * ```js
62
+ * import diagnostics_channel from 'node:diagnostics_channel';
63
+ *
64
+ * function onMessage(message, name) {
65
+ * // Received data
66
+ * }
67
+ *
68
+ * diagnostics_channel.subscribe('my-channel', onMessage);
69
+ *
70
+ * diagnostics_channel.unsubscribe('my-channel', onMessage);
71
+ * ```
72
+ * @since v18.7.0, v16.17.0
73
+ * @param name The channel name
74
+ * @param onMessage The previous subscribed handler to remove
75
+ * @return `true` if the handler was found, `false` otherwise.
76
+ */
77
+ function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
78
+ /**
79
+ * Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
80
+ * channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
81
+ *
82
+ * ```js
83
+ * import diagnostics_channel from 'node:diagnostics_channel';
84
+ *
85
+ * const channelsByName = diagnostics_channel.tracingChannel('my-channel');
86
+ *
87
+ * // or...
88
+ *
89
+ * const channelsByCollection = diagnostics_channel.tracingChannel({
90
+ * start: diagnostics_channel.channel('tracing:my-channel:start'),
91
+ * end: diagnostics_channel.channel('tracing:my-channel:end'),
92
+ * asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
93
+ * asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
94
+ * error: diagnostics_channel.channel('tracing:my-channel:error'),
95
+ * });
96
+ * ```
97
+ * @since v19.9.0
98
+ * @experimental
99
+ * @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
100
+ * @return Collection of channels to trace with
101
+ */
102
+ function tracingChannel<ContextType extends object = object, StoreType = ContextType>(
103
+ nameOrChannels: string | TracingChannelCollection<ContextType, StoreType>,
104
+ ): TracingChannel<ContextType, StoreType>;
105
+ /**
106
+ * Creates a {@link BoundedChannel} wrapper for the given channels. If a name is
107
+ * given, the corresponding channels will be created in the form of
108
+ * `tracing:${name}:${eventType}` where `eventType` is `start` or `end`.
109
+ *
110
+ * A `BoundedChannel` is a simplified version of {@link TracingChannel} that only
111
+ * traces synchronous operations. It only has `start` and `end` events, without
112
+ * `asyncStart`, `asyncEnd`, or `error` events, making it suitable for tracing
113
+ * operations that don't involve asynchronous continuations or error handling.
114
+ *
115
+ * ```js
116
+ * import { boundedChannel, channel } from 'node:diagnostics_channel';
117
+ *
118
+ * const wc = boundedChannel('my-operation');
119
+ *
120
+ * // or...
121
+ *
122
+ * const wc2 = boundedChannel({
123
+ * start: channel('tracing:my-operation:start'),
124
+ * end: channel('tracing:my-operation:end'),
125
+ * });
126
+ * ```
127
+ * @since v26.1.0
128
+ * @experimental
129
+ * @param nameOrChannels Channel name or
130
+ * object containing all the [BoundedChannel Channels](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#boundedchannel-channels)
131
+ */
132
+ function boundedChannel<ContextType extends object = object, StoreType = ContextType>(
133
+ nameOrChannels: string | BoundedChannelCollection<ContextType, StoreType>,
134
+ ): BoundedChannel<ContextType, StoreType>;
135
+ /**
136
+ * The class `Channel` represents an individual named channel within the data
137
+ * pipeline. It is used to track subscribers and to publish messages when there
138
+ * are subscribers present. It exists as a separate object to avoid channel
139
+ * lookups at publish time, enabling very fast publish speeds and allowing
140
+ * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
141
+ * with `new Channel(name)` is not supported.
142
+ * @since v15.1.0, v14.17.0
143
+ */
144
+ class Channel<ContextType = any, StoreType = ContextType> {
145
+ private constructor();
146
+ readonly name: string | symbol;
147
+ /**
148
+ * Check if there are active subscribers to this channel. This is helpful if
149
+ * the message you want to send might be expensive to prepare.
150
+ *
151
+ * This API is optional but helpful when trying to publish messages from very
152
+ * performance-sensitive code.
153
+ *
154
+ * ```js
155
+ * import diagnostics_channel from 'node:diagnostics_channel';
156
+ *
157
+ * const channel = diagnostics_channel.channel('my-channel');
158
+ *
159
+ * if (channel.hasSubscribers) {
160
+ * // There are subscribers, prepare and publish message
161
+ * }
162
+ * ```
163
+ * @since v15.1.0, v14.17.0
164
+ */
165
+ readonly hasSubscribers: boolean;
166
+ /**
167
+ * Publish a message to any subscribers to the channel. This will trigger
168
+ * message handlers synchronously so they will execute within the same context.
169
+ *
170
+ * ```js
171
+ * import diagnostics_channel from 'node:diagnostics_channel';
172
+ *
173
+ * const channel = diagnostics_channel.channel('my-channel');
174
+ *
175
+ * channel.publish({
176
+ * some: 'message',
177
+ * });
178
+ * ```
179
+ * @since v15.1.0, v14.17.0
180
+ * @param message The message to send to the channel subscribers
181
+ */
182
+ publish(message: unknown): void;
183
+ /**
184
+ * Register a message handler to subscribe to this channel. This message handler
185
+ * will be run synchronously whenever a message is published to the channel. Any
186
+ * errors thrown in the message handler will trigger an `'uncaughtException'`.
187
+ *
188
+ * ```js
189
+ * import diagnostics_channel from 'node:diagnostics_channel';
190
+ *
191
+ * const channel = diagnostics_channel.channel('my-channel');
192
+ *
193
+ * channel.subscribe((message, name) => {
194
+ * // Received data
195
+ * });
196
+ * ```
197
+ * @since v15.1.0, v14.17.0
198
+ * @param onMessage The handler to receive channel messages
199
+ */
200
+ subscribe(onMessage: ChannelListener): void;
201
+ /**
202
+ * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
203
+ *
204
+ * ```js
205
+ * import diagnostics_channel from 'node:diagnostics_channel';
206
+ *
207
+ * const channel = diagnostics_channel.channel('my-channel');
208
+ *
209
+ * function onMessage(message, name) {
210
+ * // Received data
211
+ * }
212
+ *
213
+ * channel.subscribe(onMessage);
214
+ *
215
+ * channel.unsubscribe(onMessage);
216
+ * ```
217
+ * @since v15.1.0, v14.17.0
218
+ * @param onMessage The previous subscribed handler to remove
219
+ * @return `true` if the handler was found, `false` otherwise.
220
+ */
221
+ unsubscribe(onMessage: ChannelListener): void;
222
+ /**
223
+ * When `channel.runStores(context, ...)` is called, the given context data
224
+ * will be applied to any store bound to the channel. If the store has already been
225
+ * bound the previous `transform` function will be replaced with the new one.
226
+ * The `transform` function may be omitted to set the given context data as the
227
+ * context directly.
228
+ *
229
+ * ```js
230
+ * import diagnostics_channel from 'node:diagnostics_channel';
231
+ * import { AsyncLocalStorage } from 'node:async_hooks';
232
+ *
233
+ * const store = new AsyncLocalStorage();
234
+ *
235
+ * const channel = diagnostics_channel.channel('my-channel');
236
+ *
237
+ * channel.bindStore(store, (data) => {
238
+ * return { data };
239
+ * });
240
+ * ```
241
+ * @since v19.9.0
242
+ * @experimental
243
+ * @param store The store to which to bind the context data
244
+ * @param transform Transform context data before setting the store context
245
+ */
246
+ bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
247
+ /**
248
+ * Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
249
+ *
250
+ * ```js
251
+ * import diagnostics_channel from 'node:diagnostics_channel';
252
+ * import { AsyncLocalStorage } from 'node:async_hooks';
253
+ *
254
+ * const store = new AsyncLocalStorage();
255
+ *
256
+ * const channel = diagnostics_channel.channel('my-channel');
257
+ *
258
+ * channel.bindStore(store);
259
+ * channel.unbindStore(store);
260
+ * ```
261
+ * @since v19.9.0
262
+ * @experimental
263
+ * @param store The store to unbind from the channel.
264
+ * @return `true` if the store was found, `false` otherwise.
265
+ */
266
+ unbindStore(store: AsyncLocalStorage<StoreType>): boolean;
267
+ /**
268
+ * Applies the given data to any AsyncLocalStorage instances bound to the channel
269
+ * for the duration of the given function, then publishes to the channel within
270
+ * the scope of that data is applied to the stores.
271
+ *
272
+ * If a transform function was given to `channel.bindStore(store)` it will be
273
+ * applied to transform the message data before it becomes the context value for
274
+ * the store. The prior storage context is accessible from within the transform
275
+ * function in cases where context linking is required.
276
+ *
277
+ * The context applied to the store should be accessible in any async code which
278
+ * continues from execution which began during the given function, however
279
+ * there are some situations in which `context loss` may occur.
280
+ *
281
+ * ```js
282
+ * import diagnostics_channel from 'node:diagnostics_channel';
283
+ * import { AsyncLocalStorage } from 'node:async_hooks';
284
+ *
285
+ * const store = new AsyncLocalStorage();
286
+ *
287
+ * const channel = diagnostics_channel.channel('my-channel');
288
+ *
289
+ * channel.bindStore(store, (message) => {
290
+ * const parent = store.getStore();
291
+ * return new Span(message, parent);
292
+ * });
293
+ * channel.runStores({ some: 'message' }, () => {
294
+ * store.getStore(); // Span({ some: 'message' })
295
+ * });
296
+ * ```
297
+ * @since v19.9.0
298
+ * @experimental
299
+ * @param context Message to send to subscribers and bind to stores
300
+ * @param fn Handler to run within the entered storage context
301
+ * @param thisArg The receiver to be used for the function call.
302
+ * @param args Optional arguments to pass to the function.
303
+ */
304
+ runStores<ThisArg = any, Args extends any[] = any[], Result = any>(
305
+ context: ContextType,
306
+ fn: (this: ThisArg, ...args: Args) => Result,
307
+ thisArg?: ThisArg,
308
+ ...args: Args
309
+ ): Result;
310
+ /**
311
+ * Creates a disposable scope that binds the given data to any AsyncLocalStorage
312
+ * instances bound to the channel and publishes it to subscribers. The scope
313
+ * automatically restores the previous storage contexts when disposed.
314
+ *
315
+ * This method enables the use of JavaScript's explicit resource management
316
+ * (`using` syntax with `Symbol.dispose`) to manage store contexts without
317
+ * closure wrapping.
318
+ *
319
+ * ```js
320
+ * import { channel } from 'node:diagnostics_channel';
321
+ * import { AsyncLocalStorage } from 'node:async_hooks';
322
+ *
323
+ * const store = new AsyncLocalStorage();
324
+ * const ch = channel('my-channel');
325
+ *
326
+ * ch.bindStore(store, (message) => {
327
+ * return { ...message, timestamp: Date.now() };
328
+ * });
329
+ *
330
+ * {
331
+ * using scope = ch.withStoreScope({ request: 'data' });
332
+ * // Store is entered, data is published
333
+ * console.log(store.getStore()); // { request: 'data', timestamp: ... }
334
+ * }
335
+ * // Store is automatically restored on scope exit
336
+ * ```
337
+ * @since v26.1.0
338
+ * @experimental
339
+ */
340
+ withStoreScope(data: ContextType): RunStoresScope;
341
+ }
342
+ /**
343
+ * The class `RunStoresScope` represents a disposable scope created by
344
+ * `channel.withStoreScope(data)`. It manages the lifecycle of store
345
+ * contexts and ensures they are properly restored when the scope exits.
346
+ *
347
+ * The scope must be used with the `using` syntax to ensure proper disposal.
348
+ * @since v26.1.0
349
+ * @experimental
350
+ */
351
+ interface RunStoresScope extends Disposable {}
352
+ interface TracingChannelSubscribers<ContextType extends object> {
353
+ start: (message: ContextType) => void;
354
+ end: (
355
+ message: ContextType & {
356
+ error?: unknown;
357
+ result?: unknown;
358
+ },
359
+ ) => void;
360
+ asyncStart: (
361
+ message: ContextType & {
362
+ error?: unknown;
363
+ result?: unknown;
364
+ },
365
+ ) => void;
366
+ asyncEnd: (
367
+ message: ContextType & {
368
+ error?: unknown;
369
+ result?: unknown;
370
+ },
371
+ ) => void;
372
+ error: (
373
+ message: ContextType & {
374
+ error: unknown;
375
+ },
376
+ ) => void;
377
+ }
378
+ interface TracingChannelCollection<ContextType extends object = object, StoreType = ContextType> {
379
+ start: Channel<ContextType, StoreType>;
380
+ end: Channel<ContextType, StoreType>;
381
+ asyncStart: Channel<ContextType, StoreType>;
382
+ asyncEnd: Channel<ContextType, StoreType>;
383
+ error: Channel<ContextType, StoreType>;
384
+ }
385
+ /**
386
+ * The class `TracingChannel` is a collection of `TracingChannel Channels` which
387
+ * together express a single traceable action. It is used to formalize and
388
+ * simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
389
+ * single `TracingChannel` at the top-level of the file rather than creating them
390
+ * dynamically.
391
+ * @since v19.9.0
392
+ * @experimental
393
+ */
394
+ interface TracingChannel<ContextType extends object = object, StoreType = ContextType>
395
+ extends TracingChannelCollection<ContextType, StoreType>
396
+ {
397
+ /**
398
+ * Helper to subscribe a collection of functions to the corresponding channels.
399
+ * This is the same as calling `channel.subscribe(onMessage)` on each channel
400
+ * individually.
401
+ *
402
+ * ```js
403
+ * import diagnostics_channel from 'node:diagnostics_channel';
404
+ *
405
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
406
+ *
407
+ * channels.subscribe({
408
+ * start(message) {
409
+ * // Handle start message
410
+ * },
411
+ * end(message) {
412
+ * // Handle end message
413
+ * },
414
+ * asyncStart(message) {
415
+ * // Handle asyncStart message
416
+ * },
417
+ * asyncEnd(message) {
418
+ * // Handle asyncEnd message
419
+ * },
420
+ * error(message) {
421
+ * // Handle error message
422
+ * },
423
+ * });
424
+ * ```
425
+ * @since v19.9.0
426
+ * @experimental
427
+ * @param subscribers Set of `TracingChannel Channels` subscribers
428
+ */
429
+ subscribe(subscribers: NodeJS.PartialOptions<TracingChannelSubscribers<ContextType>>): void;
430
+ /**
431
+ * Helper to unsubscribe a collection of functions from the corresponding channels.
432
+ * This is the same as calling `channel.unsubscribe(onMessage)` on each channel
433
+ * individually.
434
+ *
435
+ * ```js
436
+ * import diagnostics_channel from 'node:diagnostics_channel';
437
+ *
438
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
439
+ *
440
+ * channels.unsubscribe({
441
+ * start(message) {
442
+ * // Handle start message
443
+ * },
444
+ * end(message) {
445
+ * // Handle end message
446
+ * },
447
+ * asyncStart(message) {
448
+ * // Handle asyncStart message
449
+ * },
450
+ * asyncEnd(message) {
451
+ * // Handle asyncEnd message
452
+ * },
453
+ * error(message) {
454
+ * // Handle error message
455
+ * },
456
+ * });
457
+ * ```
458
+ * @since v19.9.0
459
+ * @experimental
460
+ * @param subscribers Set of `TracingChannel Channels` subscribers
461
+ * @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
462
+ */
463
+ unsubscribe(subscribers: NodeJS.PartialOptions<TracingChannelSubscribers<ContextType>>): void;
464
+ /**
465
+ * Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
466
+ * This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
467
+ * events should have any bound stores set to match this trace context.
468
+ *
469
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
470
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
471
+ *
472
+ * ```js
473
+ * import diagnostics_channel from 'node:diagnostics_channel';
474
+ *
475
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
476
+ *
477
+ * channels.traceSync(() => {
478
+ * // Do something
479
+ * }, {
480
+ * some: 'thing',
481
+ * });
482
+ * ```
483
+ * @since v19.9.0
484
+ * @experimental
485
+ * @param fn Function to wrap a trace around
486
+ * @param context Shared object to correlate events through
487
+ * @param thisArg The receiver to be used for the function call
488
+ * @param args Optional arguments to pass to the function
489
+ * @return The return value of the given function
490
+ */
491
+ traceSync<ThisArg = any, Args extends any[] = any[], Result = any>(
492
+ fn: (this: ThisArg, ...args: Args) => Result,
493
+ context?: ContextType,
494
+ thisArg?: ThisArg,
495
+ ...args: Args
496
+ ): Result;
497
+ /**
498
+ * Trace an asynchronous function call which returns a `Promise` or
499
+ * [thenable object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables). This will always produce a [`start` event](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#startevent) and
500
+ * [`end` event](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#endevent) around the synchronous portion of the function execution, and
501
+ * will produce an [`asyncStart` event](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#asyncstartevent) and [`asyncEnd` event](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#asyncendevent) when the
502
+ * returned promise is resolved or rejected. It may also produce an
503
+ * [`error` event](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html#errorevent) if the given function throws an error or the returned promise
504
+ * is rejected. This will run the given function using
505
+ * [`channel.runStores(context, ...)`](https://nodejs.org/docs/latest-v26.x/api/diagnostics_channel.html##channelrunstorescontext-fn-thisarg-args) on the `start` channel which ensures all
506
+ * events should have any bound stores set to match this trace context.
507
+ *
508
+ * If the value returned by `fn` is not a Promise or thenable, then it will be
509
+ * returned with a warning, and no `asyncStart` or `asyncEnd` events will be
510
+ * produced.
511
+ *
512
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
513
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
514
+ *
515
+ * ```js
516
+ * import diagnostics_channel from 'node:diagnostics_channel';
517
+ *
518
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
519
+ *
520
+ * channels.tracePromise(async () => {
521
+ * // Do something
522
+ * }, {
523
+ * some: 'thing',
524
+ * });
525
+ * ```
526
+ * @since v19.9.0
527
+ * @experimental
528
+ * @param fn Function to wrap a trace around
529
+ * @param context Shared object to correlate trace events through
530
+ * @param thisArg The receiver to be used for the function call
531
+ * @param args Optional arguments to pass to the function
532
+ * @returns The return value of the given function, or the result of
533
+ * calling `.then(...)` on the return value if the tracing channel has active
534
+ * subscribers. If the return value is not a Promise or thenable, then
535
+ * it is returned as-is and a warning is emitted.
536
+ */
537
+ tracePromise<ThisArg = any, Args extends any[] = any[], Result extends PromiseLike<unknown> = any>(
538
+ fn: (this: ThisArg, ...args: Args) => Result,
539
+ context?: ContextType,
540
+ thisArg?: ThisArg,
541
+ ...args: Args
542
+ ): Result;
543
+ /**
544
+ * Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
545
+ * function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
546
+ * the returned
547
+ * promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
548
+ * events should have any bound stores set to match this trace context.
549
+ *
550
+ * The `position` will be -1 by default to indicate the final argument should
551
+ * be used as the callback.
552
+ *
553
+ * ```js
554
+ * import diagnostics_channel from 'node:diagnostics_channel';
555
+ *
556
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
557
+ *
558
+ * channels.traceCallback((arg1, callback) => {
559
+ * // Do something
560
+ * callback(null, 'result');
561
+ * }, 1, {
562
+ * some: 'thing',
563
+ * }, thisArg, arg1, callback);
564
+ * ```
565
+ *
566
+ * The callback will also be run with `channel.runStores(context, ...)` which
567
+ * enables context loss recovery in some cases.
568
+ *
569
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
570
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
571
+ *
572
+ * ```js
573
+ * import diagnostics_channel from 'node:diagnostics_channel';
574
+ * import { AsyncLocalStorage } from 'node:async_hooks';
575
+ *
576
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
577
+ * const myStore = new AsyncLocalStorage();
578
+ *
579
+ * // The start channel sets the initial store data to something
580
+ * // and stores that store data value on the trace context object
581
+ * channels.start.bindStore(myStore, (data) => {
582
+ * const span = new Span(data);
583
+ * data.span = span;
584
+ * return span;
585
+ * });
586
+ *
587
+ * // Then asyncStart can restore from that data it stored previously
588
+ * channels.asyncStart.bindStore(myStore, (data) => {
589
+ * return data.span;
590
+ * });
591
+ * ```
592
+ * @since v19.9.0
593
+ * @experimental
594
+ * @param fn callback using function to wrap a trace around
595
+ * @param position Zero-indexed argument position of expected callback
596
+ * @param context Shared object to correlate trace events through
597
+ * @param thisArg The receiver to be used for the function call
598
+ * @param args Optional arguments to pass to the function
599
+ * @return The return value of the given function
600
+ */
601
+ traceCallback<ThisArg = any, Args extends any[] = any[], Result = any>(
602
+ fn: (this: ThisArg, ...args: Args) => Result,
603
+ position?: number,
604
+ context?: ContextType,
605
+ thisArg?: ThisArg,
606
+ ...args: Args
607
+ ): Result;
608
+ /**
609
+ * `true` if any of the individual channels has a subscriber, `false` if not.
610
+ *
611
+ * This is a helper method available on a {@link TracingChannel} instance to check
612
+ * if any of the [TracingChannel Channels](https://nodejs.org/api/diagnostics_channel.html#tracingchannel-channels) have subscribers.
613
+ * A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise.
614
+ *
615
+ * ```js
616
+ * const diagnostics_channel = require('node:diagnostics_channel');
617
+ *
618
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
619
+ *
620
+ * if (channels.hasSubscribers) {
621
+ * // Do something
622
+ * }
623
+ * ```
624
+ * @since v22.0.0, v20.13.0
625
+ */
626
+ readonly hasSubscribers: boolean;
627
+ }
628
+ interface BoundedChannelSubscribers<ContextType extends object> {
629
+ start: (message: ContextType) => void;
630
+ end: (message: ContextType) => void;
631
+ }
632
+ interface BoundedChannelCollection<ContextType extends object = object, StoreType = ContextType> {
633
+ start: Channel<ContextType, StoreType>;
634
+ end: Channel<ContextType, StoreType>;
635
+ }
636
+ /**
637
+ * The class `BoundedChannel` is a simplified version of {@link TracingChannel} that
638
+ * only traces synchronous operations. It consists of two channels (`start` and
639
+ * `end`) instead of five, omitting the `asyncStart`, `asyncEnd`, and `error`
640
+ * events. This makes it suitable for tracing operations that don't involve
641
+ * asynchronous continuations or error handling.
642
+ *
643
+ * Like `TracingChannel`, it is recommended to create and reuse a single
644
+ * `BoundedChannel` at the top-level of the file rather than creating them
645
+ * dynamically.
646
+ * @since v26.1.0
647
+ * @experimental
648
+ */
649
+ interface BoundedChannel<ContextType extends object = object, StoreType = ContextType>
650
+ extends BoundedChannelCollection<ContextType, StoreType>
651
+ {
652
+ /**
653
+ * Check if any of the `start` or `end` channels have subscribers.
654
+ *
655
+ * ```js
656
+ * import { boundedChannel } from 'node:diagnostics_channel';
657
+ *
658
+ * const wc = boundedChannel('my-operation');
659
+ *
660
+ * if (wc.hasSubscribers) {
661
+ * // There are subscribers, perform traced operation
662
+ * }
663
+ * ```
664
+ * @since v26.1.0
665
+ */
666
+ readonly hasSubscribers: boolean;
667
+ /**
668
+ * Subscribe to the bounded channel events. This is equivalent to calling
669
+ * [`channel.subscribe(onMessage)`][] on each channel individually.
670
+ *
671
+ * ```mjs
672
+ * import { boundedChannel } from 'node:diagnostics_channel';
673
+ *
674
+ * const wc = boundedChannel('my-operation');
675
+ *
676
+ * wc.subscribe({
677
+ * start(message) {
678
+ * // Handle start
679
+ * },
680
+ * end(message) {
681
+ * // Handle end
682
+ * },
683
+ * });
684
+ * ```
685
+ * @since v26.1.0
686
+ * @param handlers Set of channel subscribers
687
+ */
688
+ subscribe(handlers: NodeJS.PartialOptions<BoundedChannelSubscribers<ContextType>>): void;
689
+ /**
690
+ * Unsubscribe from the bounded channel events. This is equivalent to calling
691
+ * [`channel.unsubscribe(onMessage)`][] on each channel individually.
692
+ *
693
+ * ```js
694
+ * import { boundedChannel } from 'node:diagnostics_channel';
695
+ *
696
+ * const wc = boundedChannel('my-operation');
697
+ *
698
+ * const handlers = {
699
+ * start(message) {},
700
+ * end(message) {},
701
+ * };
702
+ *
703
+ * wc.subscribe(handlers);
704
+ * wc.unsubscribe(handlers);
705
+ * ```
706
+ * @since v26.1.0
707
+ * @param handlers Set of channel subscribers
708
+ * @returns `true` if all handlers were successfully unsubscribed,
709
+ * `false` otherwise.
710
+ */
711
+ unsubscribe(handlers: NodeJS.PartialOptions<BoundedChannelSubscribers<ContextType>>): boolean;
712
+ /**
713
+ * Trace a synchronous function call. This will produce a `start` event and `end`
714
+ * event around the execution. This runs the given function using
715
+ * [`channel.runStores(context, ...)`][] on the `start` channel which ensures all
716
+ * events have any bound stores set to match this trace context.
717
+ *
718
+ * ```js
719
+ * import { boundedChannel } from 'node:diagnostics_channel';
720
+ *
721
+ * const wc = boundedChannel('my-operation');
722
+ *
723
+ * const result = wc.run({ operationId: '123' }, () => {
724
+ * // Perform operation
725
+ * return 42;
726
+ * });
727
+ * ```
728
+ * @since v26.1.0
729
+ * @param context Shared object to correlate events through
730
+ * @param fn Function to wrap a trace around
731
+ * @param thisArg The receiver to be used for the function call
732
+ * @param args Optional arguments to pass to the function
733
+ * @returns The return value of the given function
734
+ */
735
+ run<ThisArg = any, Args extends any[] = any[], Result = any>(
736
+ fn: (this: ThisArg, ...args: Args) => Result,
737
+ context?: ContextType,
738
+ thisArg?: ThisArg,
739
+ ...args: Args
740
+ ): Result;
741
+ /**
742
+ * Create a disposable scope for tracing a synchronous operation using JavaScript's
743
+ * explicit resource management (`using` syntax). The scope automatically publishes
744
+ * `start` and `end` events, enters bound stores, and handles cleanup when disposed.
745
+ *
746
+ * ```js
747
+ * import { boundedChannel } from 'node:diagnostics_channel';
748
+ *
749
+ * const wc = boundedChannel('my-operation');
750
+ *
751
+ * const context = { operationId: '123' };
752
+ * {
753
+ * using scope = wc.withScope(context);
754
+ * // Stores are entered, start event is published
755
+ *
756
+ * // Perform work and set result on context
757
+ * context.result = 42;
758
+ * }
759
+ * // End event is published, stores are restored automatically
760
+ * ```
761
+ * @since v26.1.0
762
+ * @param context Shared object to correlate events through
763
+ * @returns Disposable scope object
764
+ */
765
+ withScope(context: ContextType): BoundedChannelScope;
766
+ }
767
+ /**
768
+ * The class `BoundedChannelScope` represents a disposable scope created by
769
+ * `boundedChannel.withScope(context)`. It manages the lifecycle of a traced
770
+ * operation, automatically publishing events and managing store contexts.
771
+ *
772
+ * The scope must be used with the `using` syntax to ensure proper disposal.
773
+ *
774
+ * ```js
775
+ * import { boundedChannel } from 'node:diagnostics_channel';
776
+ *
777
+ * const wc = boundedChannel('my-operation');
778
+ *
779
+ * const context = {};
780
+ * {
781
+ * using scope = wc.withScope(context);
782
+ * // Start event is published, stores are entered
783
+ * context.result = performOperation();
784
+ * // End event is automatically published at end of block
785
+ * }
786
+ * ```
787
+ * @since v26.1.0
788
+ * @experimental
789
+ */
790
+ interface BoundedChannelScope extends Disposable {}
791
+ }
792
+ declare module "diagnostics_channel" {
793
+ export * from "node:diagnostics_channel";
794
+ }