@ardennguyen/zalo-agent-cli 1.0.7 → 2.0.0

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 (1267) hide show
  1. package/DISCLAIMER.md +2 -2
  2. package/README.md +146 -69
  3. package/node_modules/asynckit/LICENSE +21 -0
  4. package/node_modules/asynckit/README.md +233 -0
  5. package/node_modules/asynckit/bench.js +76 -0
  6. package/node_modules/asynckit/index.js +6 -0
  7. package/node_modules/asynckit/lib/abort.js +29 -0
  8. package/node_modules/asynckit/lib/async.js +34 -0
  9. package/node_modules/asynckit/lib/defer.js +26 -0
  10. package/node_modules/asynckit/lib/iterate.js +75 -0
  11. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  12. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  13. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  14. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  15. package/node_modules/asynckit/lib/state.js +37 -0
  16. package/node_modules/asynckit/lib/streamify.js +141 -0
  17. package/node_modules/asynckit/lib/terminator.js +29 -0
  18. package/node_modules/asynckit/package.json +63 -0
  19. package/node_modules/asynckit/parallel.js +43 -0
  20. package/node_modules/asynckit/serial.js +17 -0
  21. package/node_modules/asynckit/serialOrdered.js +75 -0
  22. package/node_modules/asynckit/stream.js +21 -0
  23. package/node_modules/bignumber.js/CHANGELOG.md +381 -0
  24. package/node_modules/bignumber.js/LICENCE.md +26 -0
  25. package/node_modules/bignumber.js/README.md +289 -0
  26. package/node_modules/bignumber.js/bignumber.d.mts +6 -0
  27. package/node_modules/bignumber.js/bignumber.d.ts +5 -0
  28. package/node_modules/bignumber.js/bignumber.js +2922 -0
  29. package/node_modules/bignumber.js/bignumber.mjs +2907 -0
  30. package/node_modules/bignumber.js/doc/API.html +2249 -0
  31. package/node_modules/bignumber.js/package.json +60 -0
  32. package/node_modules/bignumber.js/types.d.ts +1821 -0
  33. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  34. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  35. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  36. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  37. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  38. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  39. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  40. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  41. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  42. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  43. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  44. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  45. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  46. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  47. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  48. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  49. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  50. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  51. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  52. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  53. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  54. package/node_modules/combined-stream/License +19 -0
  55. package/node_modules/combined-stream/Readme.md +138 -0
  56. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  57. package/node_modules/combined-stream/package.json +25 -0
  58. package/node_modules/crypto-js/CONTRIBUTING.md +28 -0
  59. package/node_modules/crypto-js/LICENSE +24 -0
  60. package/node_modules/crypto-js/README.md +275 -0
  61. package/node_modules/crypto-js/aes.js +234 -0
  62. package/node_modules/crypto-js/blowfish.js +471 -0
  63. package/node_modules/crypto-js/bower.json +39 -0
  64. package/node_modules/crypto-js/cipher-core.js +895 -0
  65. package/node_modules/crypto-js/core.js +807 -0
  66. package/node_modules/crypto-js/crypto-js.js +6657 -0
  67. package/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
  68. package/node_modules/crypto-js/enc-base64.js +136 -0
  69. package/node_modules/crypto-js/enc-base64url.js +148 -0
  70. package/node_modules/crypto-js/enc-hex.js +18 -0
  71. package/node_modules/crypto-js/enc-latin1.js +18 -0
  72. package/node_modules/crypto-js/enc-utf16.js +149 -0
  73. package/node_modules/crypto-js/enc-utf8.js +18 -0
  74. package/node_modules/crypto-js/evpkdf.js +134 -0
  75. package/node_modules/crypto-js/format-hex.js +66 -0
  76. package/node_modules/crypto-js/format-openssl.js +18 -0
  77. package/node_modules/crypto-js/hmac-md5.js +18 -0
  78. package/node_modules/crypto-js/hmac-ripemd160.js +18 -0
  79. package/node_modules/crypto-js/hmac-sha1.js +18 -0
  80. package/node_modules/crypto-js/hmac-sha224.js +18 -0
  81. package/node_modules/crypto-js/hmac-sha256.js +18 -0
  82. package/node_modules/crypto-js/hmac-sha3.js +18 -0
  83. package/node_modules/crypto-js/hmac-sha384.js +18 -0
  84. package/node_modules/crypto-js/hmac-sha512.js +18 -0
  85. package/node_modules/crypto-js/hmac.js +143 -0
  86. package/node_modules/crypto-js/index.js +18 -0
  87. package/node_modules/crypto-js/lib-typedarrays.js +76 -0
  88. package/node_modules/crypto-js/md5.js +268 -0
  89. package/node_modules/crypto-js/mode-cfb.js +80 -0
  90. package/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
  91. package/node_modules/crypto-js/mode-ctr.js +58 -0
  92. package/node_modules/crypto-js/mode-ecb.js +40 -0
  93. package/node_modules/crypto-js/mode-ofb.js +54 -0
  94. package/node_modules/crypto-js/package.json +42 -0
  95. package/node_modules/crypto-js/pad-ansix923.js +49 -0
  96. package/node_modules/crypto-js/pad-iso10126.js +44 -0
  97. package/node_modules/crypto-js/pad-iso97971.js +40 -0
  98. package/node_modules/crypto-js/pad-nopadding.js +30 -0
  99. package/node_modules/crypto-js/pad-pkcs7.js +18 -0
  100. package/node_modules/crypto-js/pad-zeropadding.js +47 -0
  101. package/node_modules/crypto-js/pbkdf2.js +145 -0
  102. package/node_modules/crypto-js/rabbit-legacy.js +190 -0
  103. package/node_modules/crypto-js/rabbit.js +192 -0
  104. package/node_modules/crypto-js/rc4.js +139 -0
  105. package/node_modules/crypto-js/ripemd160.js +267 -0
  106. package/node_modules/crypto-js/sha1.js +150 -0
  107. package/node_modules/crypto-js/sha224.js +80 -0
  108. package/node_modules/crypto-js/sha256.js +199 -0
  109. package/node_modules/crypto-js/sha3.js +326 -0
  110. package/node_modules/crypto-js/sha384.js +83 -0
  111. package/node_modules/crypto-js/sha512.js +326 -0
  112. package/node_modules/crypto-js/tripledes.js +779 -0
  113. package/node_modules/crypto-js/x64-core.js +304 -0
  114. package/node_modules/delayed-stream/.npmignore +1 -0
  115. package/node_modules/delayed-stream/License +19 -0
  116. package/node_modules/delayed-stream/Makefile +7 -0
  117. package/node_modules/delayed-stream/Readme.md +141 -0
  118. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  119. package/node_modules/delayed-stream/package.json +27 -0
  120. package/node_modules/dunder-proto/.eslintrc +5 -0
  121. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  122. package/node_modules/dunder-proto/.nycrc +13 -0
  123. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  124. package/node_modules/dunder-proto/LICENSE +21 -0
  125. package/node_modules/dunder-proto/README.md +54 -0
  126. package/node_modules/dunder-proto/get.d.ts +5 -0
  127. package/node_modules/dunder-proto/get.js +30 -0
  128. package/node_modules/dunder-proto/package.json +76 -0
  129. package/node_modules/dunder-proto/set.d.ts +5 -0
  130. package/node_modules/dunder-proto/set.js +35 -0
  131. package/node_modules/dunder-proto/test/get.js +34 -0
  132. package/node_modules/dunder-proto/test/index.js +4 -0
  133. package/node_modules/dunder-proto/test/set.js +50 -0
  134. package/node_modules/dunder-proto/tsconfig.json +9 -0
  135. package/node_modules/es-define-property/.eslintrc +13 -0
  136. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  137. package/node_modules/es-define-property/.nycrc +9 -0
  138. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  139. package/node_modules/es-define-property/LICENSE +21 -0
  140. package/node_modules/es-define-property/README.md +49 -0
  141. package/node_modules/es-define-property/index.d.ts +3 -0
  142. package/node_modules/es-define-property/index.js +14 -0
  143. package/node_modules/es-define-property/package.json +81 -0
  144. package/node_modules/es-define-property/test/index.js +56 -0
  145. package/node_modules/es-define-property/tsconfig.json +10 -0
  146. package/node_modules/es-errors/.eslintrc +5 -0
  147. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  148. package/node_modules/es-errors/CHANGELOG.md +40 -0
  149. package/node_modules/es-errors/LICENSE +21 -0
  150. package/node_modules/es-errors/README.md +55 -0
  151. package/node_modules/es-errors/eval.d.ts +3 -0
  152. package/node_modules/es-errors/eval.js +4 -0
  153. package/node_modules/es-errors/index.d.ts +3 -0
  154. package/node_modules/es-errors/index.js +4 -0
  155. package/node_modules/es-errors/package.json +80 -0
  156. package/node_modules/es-errors/range.d.ts +3 -0
  157. package/node_modules/es-errors/range.js +4 -0
  158. package/node_modules/es-errors/ref.d.ts +3 -0
  159. package/node_modules/es-errors/ref.js +4 -0
  160. package/node_modules/es-errors/syntax.d.ts +3 -0
  161. package/node_modules/es-errors/syntax.js +4 -0
  162. package/node_modules/es-errors/test/index.js +19 -0
  163. package/node_modules/es-errors/tsconfig.json +49 -0
  164. package/node_modules/es-errors/type.d.ts +3 -0
  165. package/node_modules/es-errors/type.js +4 -0
  166. package/node_modules/es-errors/uri.d.ts +3 -0
  167. package/node_modules/es-errors/uri.js +4 -0
  168. package/node_modules/es-object-atoms/.eslintrc +16 -0
  169. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  170. package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
  171. package/node_modules/es-object-atoms/LICENSE +21 -0
  172. package/node_modules/es-object-atoms/README.md +63 -0
  173. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  174. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  175. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  176. package/node_modules/es-object-atoms/ToObject.js +10 -0
  177. package/node_modules/es-object-atoms/index.d.ts +3 -0
  178. package/node_modules/es-object-atoms/index.js +4 -0
  179. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  180. package/node_modules/es-object-atoms/isObject.js +6 -0
  181. package/node_modules/es-object-atoms/package.json +79 -0
  182. package/node_modules/es-object-atoms/test/index.js +38 -0
  183. package/node_modules/es-object-atoms/tsconfig.json +7 -0
  184. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  185. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  186. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  187. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  188. package/node_modules/es-set-tostringtag/README.md +53 -0
  189. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  190. package/node_modules/es-set-tostringtag/index.js +35 -0
  191. package/node_modules/es-set-tostringtag/package.json +78 -0
  192. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  193. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  194. package/node_modules/form-data/CHANGELOG.md +686 -0
  195. package/node_modules/form-data/License +19 -0
  196. package/node_modules/form-data/README.md +355 -0
  197. package/node_modules/form-data/index.d.ts +62 -0
  198. package/node_modules/form-data/lib/browser.js +4 -0
  199. package/node_modules/form-data/lib/form_data.js +506 -0
  200. package/node_modules/form-data/lib/populate.js +10 -0
  201. package/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
  202. package/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
  203. package/node_modules/form-data/node_modules/mime-db/README.md +100 -0
  204. package/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
  205. package/node_modules/form-data/node_modules/mime-db/index.js +12 -0
  206. package/node_modules/form-data/node_modules/mime-db/package.json +60 -0
  207. package/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
  208. package/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
  209. package/node_modules/form-data/node_modules/mime-types/README.md +113 -0
  210. package/node_modules/form-data/node_modules/mime-types/index.js +188 -0
  211. package/node_modules/form-data/node_modules/mime-types/package.json +44 -0
  212. package/node_modules/form-data/package.json +82 -0
  213. package/node_modules/function-bind/.eslintrc +21 -0
  214. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  215. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  216. package/node_modules/function-bind/.nycrc +13 -0
  217. package/node_modules/function-bind/CHANGELOG.md +136 -0
  218. package/node_modules/function-bind/LICENSE +20 -0
  219. package/node_modules/function-bind/README.md +46 -0
  220. package/node_modules/function-bind/implementation.js +84 -0
  221. package/node_modules/function-bind/index.js +5 -0
  222. package/node_modules/function-bind/package.json +87 -0
  223. package/node_modules/function-bind/test/.eslintrc +9 -0
  224. package/node_modules/function-bind/test/index.js +252 -0
  225. package/node_modules/get-intrinsic/.eslintrc +42 -0
  226. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  227. package/node_modules/get-intrinsic/.nycrc +9 -0
  228. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  229. package/node_modules/get-intrinsic/LICENSE +21 -0
  230. package/node_modules/get-intrinsic/README.md +71 -0
  231. package/node_modules/get-intrinsic/index.js +378 -0
  232. package/node_modules/get-intrinsic/package.json +97 -0
  233. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  234. package/node_modules/get-proto/.eslintrc +10 -0
  235. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  236. package/node_modules/get-proto/.nycrc +9 -0
  237. package/node_modules/get-proto/CHANGELOG.md +21 -0
  238. package/node_modules/get-proto/LICENSE +21 -0
  239. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  240. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  241. package/node_modules/get-proto/README.md +50 -0
  242. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  243. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  244. package/node_modules/get-proto/index.d.ts +5 -0
  245. package/node_modules/get-proto/index.js +27 -0
  246. package/node_modules/get-proto/package.json +81 -0
  247. package/node_modules/get-proto/test/index.js +68 -0
  248. package/node_modules/get-proto/tsconfig.json +9 -0
  249. package/node_modules/gopd/.eslintrc +16 -0
  250. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  251. package/node_modules/gopd/CHANGELOG.md +45 -0
  252. package/node_modules/gopd/LICENSE +21 -0
  253. package/node_modules/gopd/README.md +40 -0
  254. package/node_modules/gopd/gOPD.d.ts +1 -0
  255. package/node_modules/gopd/gOPD.js +4 -0
  256. package/node_modules/gopd/index.d.ts +5 -0
  257. package/node_modules/gopd/index.js +15 -0
  258. package/node_modules/gopd/package.json +77 -0
  259. package/node_modules/gopd/test/index.js +36 -0
  260. package/node_modules/gopd/tsconfig.json +9 -0
  261. package/node_modules/has-symbols/.eslintrc +11 -0
  262. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  263. package/node_modules/has-symbols/.nycrc +9 -0
  264. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  265. package/node_modules/has-symbols/LICENSE +21 -0
  266. package/node_modules/has-symbols/README.md +46 -0
  267. package/node_modules/has-symbols/index.d.ts +3 -0
  268. package/node_modules/has-symbols/index.js +14 -0
  269. package/node_modules/has-symbols/package.json +111 -0
  270. package/node_modules/has-symbols/shams.d.ts +3 -0
  271. package/node_modules/has-symbols/shams.js +45 -0
  272. package/node_modules/has-symbols/test/index.js +22 -0
  273. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  274. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  275. package/node_modules/has-symbols/test/tests.js +58 -0
  276. package/node_modules/has-symbols/tsconfig.json +10 -0
  277. package/node_modules/has-tostringtag/.eslintrc +5 -0
  278. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  279. package/node_modules/has-tostringtag/.nycrc +13 -0
  280. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  281. package/node_modules/has-tostringtag/LICENSE +21 -0
  282. package/node_modules/has-tostringtag/README.md +46 -0
  283. package/node_modules/has-tostringtag/index.d.ts +3 -0
  284. package/node_modules/has-tostringtag/index.js +8 -0
  285. package/node_modules/has-tostringtag/package.json +108 -0
  286. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  287. package/node_modules/has-tostringtag/shams.js +8 -0
  288. package/node_modules/has-tostringtag/test/index.js +21 -0
  289. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  290. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  291. package/node_modules/has-tostringtag/test/tests.js +15 -0
  292. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  293. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  294. package/node_modules/hasown/.nycrc +13 -0
  295. package/node_modules/hasown/CHANGELOG.md +58 -0
  296. package/node_modules/hasown/LICENSE +21 -0
  297. package/node_modules/hasown/README.md +40 -0
  298. package/node_modules/hasown/eslint.config.mjs +6 -0
  299. package/node_modules/hasown/index.d.ts +3 -0
  300. package/node_modules/hasown/index.js +8 -0
  301. package/node_modules/hasown/package.json +91 -0
  302. package/node_modules/hasown/tsconfig.json +6 -0
  303. package/node_modules/json-bigint/LICENSE +20 -0
  304. package/node_modules/json-bigint/README.md +240 -0
  305. package/node_modules/json-bigint/index.js +12 -0
  306. package/node_modules/json-bigint/lib/parse.js +443 -0
  307. package/node_modules/json-bigint/lib/stringify.js +384 -0
  308. package/node_modules/json-bigint/package.json +34 -0
  309. package/node_modules/math-intrinsics/.eslintrc +16 -0
  310. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  311. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  312. package/node_modules/math-intrinsics/LICENSE +21 -0
  313. package/node_modules/math-intrinsics/README.md +50 -0
  314. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  315. package/node_modules/math-intrinsics/abs.js +4 -0
  316. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  317. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  318. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  319. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  320. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  321. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  322. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  323. package/node_modules/math-intrinsics/floor.js +4 -0
  324. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  325. package/node_modules/math-intrinsics/isFinite.js +12 -0
  326. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  327. package/node_modules/math-intrinsics/isInteger.js +16 -0
  328. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  329. package/node_modules/math-intrinsics/isNaN.js +6 -0
  330. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  331. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  332. package/node_modules/math-intrinsics/max.d.ts +1 -0
  333. package/node_modules/math-intrinsics/max.js +4 -0
  334. package/node_modules/math-intrinsics/min.d.ts +1 -0
  335. package/node_modules/math-intrinsics/min.js +4 -0
  336. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  337. package/node_modules/math-intrinsics/mod.js +9 -0
  338. package/node_modules/math-intrinsics/package.json +86 -0
  339. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  340. package/node_modules/math-intrinsics/pow.js +4 -0
  341. package/node_modules/math-intrinsics/round.d.ts +1 -0
  342. package/node_modules/math-intrinsics/round.js +4 -0
  343. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  344. package/node_modules/math-intrinsics/sign.js +11 -0
  345. package/node_modules/math-intrinsics/test/index.js +192 -0
  346. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  347. package/node_modules/pako/LICENSE +21 -0
  348. package/node_modules/pako/README.md +155 -0
  349. package/node_modules/pako/dist/pako.es5.js +6760 -0
  350. package/node_modules/pako/dist/pako.es5.min.js +2 -0
  351. package/node_modules/pako/dist/pako.esm.mjs +6945 -0
  352. package/node_modules/pako/dist/pako.js +6964 -0
  353. package/node_modules/pako/dist/pako.min.js +2 -0
  354. package/node_modules/pako/dist/pako_deflate.es5.js +3953 -0
  355. package/node_modules/pako/dist/pako_deflate.es5.min.js +2 -0
  356. package/node_modules/pako/dist/pako_deflate.js +4154 -0
  357. package/node_modules/pako/dist/pako_deflate.min.js +2 -0
  358. package/node_modules/pako/dist/pako_inflate.es5.js +3272 -0
  359. package/node_modules/pako/dist/pako_inflate.es5.min.js +2 -0
  360. package/node_modules/pako/dist/pako_inflate.js +3279 -0
  361. package/node_modules/pako/dist/pako_inflate.min.js +2 -0
  362. package/node_modules/pako/index.js +18 -0
  363. package/node_modules/pako/lib/deflate.js +387 -0
  364. package/node_modules/pako/lib/inflate.js +456 -0
  365. package/node_modules/pako/lib/utils/common.js +48 -0
  366. package/node_modules/pako/lib/utils/strings.js +174 -0
  367. package/node_modules/pako/lib/zlib/README +59 -0
  368. package/node_modules/pako/lib/zlib/adler32.js +51 -0
  369. package/node_modules/pako/lib/zlib/constants.js +68 -0
  370. package/node_modules/pako/lib/zlib/crc32.js +59 -0
  371. package/node_modules/pako/lib/zlib/deflate.js +2069 -0
  372. package/node_modules/pako/lib/zlib/gzheader.js +58 -0
  373. package/node_modules/pako/lib/zlib/inffast.js +344 -0
  374. package/node_modules/pako/lib/zlib/inflate.js +1575 -0
  375. package/node_modules/pako/lib/zlib/inftrees.js +340 -0
  376. package/node_modules/pako/lib/zlib/messages.js +32 -0
  377. package/node_modules/pako/lib/zlib/trees.js +1179 -0
  378. package/node_modules/pako/lib/zlib/zstream.js +47 -0
  379. package/node_modules/pako/package.json +73 -0
  380. package/node_modules/semver/LICENSE +15 -0
  381. package/node_modules/semver/README.md +680 -0
  382. package/node_modules/semver/bin/semver.js +195 -0
  383. package/node_modules/semver/classes/comparator.js +143 -0
  384. package/node_modules/semver/classes/index.js +7 -0
  385. package/node_modules/semver/classes/range.js +577 -0
  386. package/node_modules/semver/classes/semver.js +350 -0
  387. package/node_modules/semver/functions/clean.js +8 -0
  388. package/node_modules/semver/functions/cmp.js +54 -0
  389. package/node_modules/semver/functions/coerce.js +62 -0
  390. package/node_modules/semver/functions/compare-build.js +9 -0
  391. package/node_modules/semver/functions/compare-loose.js +5 -0
  392. package/node_modules/semver/functions/compare.js +7 -0
  393. package/node_modules/semver/functions/diff.js +60 -0
  394. package/node_modules/semver/functions/eq.js +5 -0
  395. package/node_modules/semver/functions/gt.js +5 -0
  396. package/node_modules/semver/functions/gte.js +5 -0
  397. package/node_modules/semver/functions/inc.js +21 -0
  398. package/node_modules/semver/functions/lt.js +5 -0
  399. package/node_modules/semver/functions/lte.js +5 -0
  400. package/node_modules/semver/functions/major.js +5 -0
  401. package/node_modules/semver/functions/minor.js +5 -0
  402. package/node_modules/semver/functions/neq.js +5 -0
  403. package/node_modules/semver/functions/parse.js +18 -0
  404. package/node_modules/semver/functions/patch.js +5 -0
  405. package/node_modules/semver/functions/prerelease.js +8 -0
  406. package/node_modules/semver/functions/rcompare.js +5 -0
  407. package/node_modules/semver/functions/rsort.js +5 -0
  408. package/node_modules/semver/functions/satisfies.js +12 -0
  409. package/node_modules/semver/functions/sort.js +5 -0
  410. package/node_modules/semver/functions/truncate.js +48 -0
  411. package/node_modules/semver/functions/valid.js +8 -0
  412. package/node_modules/semver/index.js +93 -0
  413. package/node_modules/semver/internal/constants.js +37 -0
  414. package/node_modules/semver/internal/debug.js +11 -0
  415. package/node_modules/semver/internal/identifiers.js +29 -0
  416. package/node_modules/semver/internal/lrucache.js +42 -0
  417. package/node_modules/semver/internal/parse-options.js +17 -0
  418. package/node_modules/semver/internal/re.js +223 -0
  419. package/node_modules/semver/package.json +78 -0
  420. package/node_modules/semver/preload.js +4 -0
  421. package/node_modules/semver/range.bnf +17 -0
  422. package/node_modules/semver/ranges/gtr.js +6 -0
  423. package/node_modules/semver/ranges/intersects.js +9 -0
  424. package/node_modules/semver/ranges/ltr.js +6 -0
  425. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  426. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  427. package/node_modules/semver/ranges/min-version.js +63 -0
  428. package/node_modules/semver/ranges/outside.js +82 -0
  429. package/node_modules/semver/ranges/simplify.js +49 -0
  430. package/node_modules/semver/ranges/subset.js +249 -0
  431. package/node_modules/semver/ranges/to-comparators.js +10 -0
  432. package/node_modules/semver/ranges/valid.js +13 -0
  433. package/node_modules/spark-md5/LICENSE +13 -0
  434. package/node_modules/spark-md5/README.md +191 -0
  435. package/node_modules/spark-md5/package.json +35 -0
  436. package/node_modules/spark-md5/spark-md5.js +751 -0
  437. package/node_modules/spark-md5/spark-md5.min.js +1 -0
  438. package/node_modules/tldts/LICENSE +13 -0
  439. package/node_modules/tldts/README.md +327 -0
  440. package/node_modules/tldts/bin/cli.js +21 -0
  441. package/node_modules/tldts/dist/cjs/index.js +666 -0
  442. package/node_modules/tldts/dist/cjs/index.js.map +1 -0
  443. package/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
  444. package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
  445. package/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
  446. package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
  447. package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
  448. package/node_modules/tldts/dist/es6/index.js +33 -0
  449. package/node_modules/tldts/dist/es6/index.js.map +1 -0
  450. package/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
  451. package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
  452. package/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
  453. package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
  454. package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  455. package/node_modules/tldts/dist/index.cjs.min.js +2 -0
  456. package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
  457. package/node_modules/tldts/dist/index.esm.min.js +2 -0
  458. package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
  459. package/node_modules/tldts/dist/index.umd.min.js +2 -0
  460. package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
  461. package/node_modules/tldts/dist/types/index.d.ts +7 -0
  462. package/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
  463. package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
  464. package/node_modules/tldts/index.ts +62 -0
  465. package/node_modules/tldts/package.json +91 -0
  466. package/node_modules/tldts/src/data/trie.ts +14 -0
  467. package/node_modules/tldts/src/suffix-trie.ts +110 -0
  468. package/node_modules/tldts-core/LICENSE +13 -0
  469. package/node_modules/tldts-core/README.md +3 -0
  470. package/node_modules/tldts-core/dist/cjs/index.js +561 -0
  471. package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
  472. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
  473. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
  474. package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
  475. package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
  476. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
  477. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
  478. package/node_modules/tldts-core/dist/cjs/src/factory.js +104 -0
  479. package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
  480. package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
  481. package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
  482. package/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
  483. package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
  484. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
  485. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
  486. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
  487. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
  488. package/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
  489. package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
  490. package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
  491. package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
  492. package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
  493. package/node_modules/tldts-core/dist/es6/index.js +4 -0
  494. package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
  495. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
  496. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
  497. package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
  498. package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
  499. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
  500. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
  501. package/node_modules/tldts-core/dist/es6/src/factory.js +99 -0
  502. package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
  503. package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
  504. package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
  505. package/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
  506. package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
  507. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
  508. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
  509. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
  510. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
  511. package/node_modules/tldts-core/dist/es6/src/options.js +19 -0
  512. package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
  513. package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
  514. package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
  515. package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  516. package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
  517. package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
  518. package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
  519. package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
  520. package/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
  521. package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
  522. package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
  523. package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
  524. package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
  525. package/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
  526. package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
  527. package/node_modules/tldts-core/index.ts +10 -0
  528. package/node_modules/tldts-core/package.json +68 -0
  529. package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
  530. package/node_modules/tldts-core/src/domain.ts +100 -0
  531. package/node_modules/tldts-core/src/extract-hostname.ts +170 -0
  532. package/node_modules/tldts-core/src/factory.ts +160 -0
  533. package/node_modules/tldts-core/src/is-ip.ts +87 -0
  534. package/node_modules/tldts-core/src/is-valid.ts +79 -0
  535. package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
  536. package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
  537. package/node_modules/tldts-core/src/options.ts +39 -0
  538. package/node_modules/tldts-core/src/subdomain.ts +11 -0
  539. package/node_modules/tough-cookie/LICENSE +12 -0
  540. package/node_modules/tough-cookie/README.md +154 -0
  541. package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +33 -0
  542. package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +65 -0
  543. package/node_modules/tough-cookie/dist/cookie/constants.d.ts +54 -0
  544. package/node_modules/tough-cookie/dist/cookie/constants.js +38 -0
  545. package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +326 -0
  546. package/node_modules/tough-cookie/dist/cookie/cookie.js +831 -0
  547. package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +58 -0
  548. package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +84 -0
  549. package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +621 -0
  550. package/node_modules/tough-cookie/dist/cookie/cookieJar.js +1000 -0
  551. package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +40 -0
  552. package/node_modules/tough-cookie/dist/cookie/defaultPath.js +60 -0
  553. package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +38 -0
  554. package/node_modules/tough-cookie/dist/cookie/domainMatch.js +94 -0
  555. package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +15 -0
  556. package/node_modules/tough-cookie/dist/cookie/formatDate.js +20 -0
  557. package/node_modules/tough-cookie/dist/cookie/index.d.ts +29 -0
  558. package/node_modules/tough-cookie/dist/cookie/index.js +54 -0
  559. package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +103 -0
  560. package/node_modules/tough-cookie/dist/cookie/parseDate.js +323 -0
  561. package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +14 -0
  562. package/node_modules/tough-cookie/dist/cookie/permutePath.js +32 -0
  563. package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +55 -0
  564. package/node_modules/tough-cookie/dist/getPublicSuffix.js +71 -0
  565. package/node_modules/tough-cookie/dist/memstore.d.ts +220 -0
  566. package/node_modules/tough-cookie/dist/memstore.js +187 -0
  567. package/node_modules/tough-cookie/dist/pathMatch.d.ts +17 -0
  568. package/node_modules/tough-cookie/dist/pathMatch.js +40 -0
  569. package/node_modules/tough-cookie/dist/permuteDomain.d.ts +15 -0
  570. package/node_modules/tough-cookie/dist/permuteDomain.js +44 -0
  571. package/node_modules/tough-cookie/dist/store.d.ts +211 -0
  572. package/node_modules/tough-cookie/dist/store.js +76 -0
  573. package/node_modules/tough-cookie/dist/utils.d.ts +34 -0
  574. package/node_modules/tough-cookie/dist/utils.js +99 -0
  575. package/node_modules/tough-cookie/dist/validators.d.ts +24 -0
  576. package/node_modules/tough-cookie/dist/validators.js +90 -0
  577. package/node_modules/tough-cookie/dist/version.d.ts +5 -0
  578. package/node_modules/tough-cookie/dist/version.js +8 -0
  579. package/node_modules/tough-cookie/package.json +144 -0
  580. package/node_modules/ws/LICENSE +20 -0
  581. package/node_modules/ws/README.md +548 -0
  582. package/node_modules/ws/browser.js +8 -0
  583. package/node_modules/ws/index.js +22 -0
  584. package/node_modules/ws/lib/buffer-util.js +131 -0
  585. package/node_modules/ws/lib/constants.js +19 -0
  586. package/node_modules/ws/lib/event-target.js +292 -0
  587. package/node_modules/ws/lib/extension.js +203 -0
  588. package/node_modules/ws/lib/limiter.js +55 -0
  589. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  590. package/node_modules/ws/lib/receiver.js +743 -0
  591. package/node_modules/ws/lib/sender.js +607 -0
  592. package/node_modules/ws/lib/stream.js +161 -0
  593. package/node_modules/ws/lib/subprotocol.js +62 -0
  594. package/node_modules/ws/lib/validation.js +152 -0
  595. package/node_modules/ws/lib/websocket-server.js +562 -0
  596. package/node_modules/ws/lib/websocket.js +1407 -0
  597. package/node_modules/ws/package.json +74 -0
  598. package/node_modules/ws/wrapper.mjs +21 -0
  599. package/node_modules/zca-js/.prettierrc +5 -0
  600. package/node_modules/zca-js/CODE_OF_CONDUCT.md +163 -0
  601. package/node_modules/zca-js/CONTRIBUTING.md +470 -0
  602. package/node_modules/zca-js/LICENSE +21 -0
  603. package/node_modules/zca-js/README.md +225 -0
  604. package/node_modules/zca-js/SECURITY.md +83 -0
  605. package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +4 -0
  606. package/node_modules/zca-js/dist/Errors/ZaloApiError.js +7 -0
  607. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
  608. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
  609. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
  610. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
  611. package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
  612. package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
  613. package/node_modules/zca-js/dist/Errors/index.d.ts +4 -0
  614. package/node_modules/zca-js/dist/Errors/index.js +4 -0
  615. package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +2 -0
  616. package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +28 -0
  617. package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +2 -0
  618. package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +28 -0
  619. package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +2 -0
  620. package/node_modules/zca-js/dist/apis/addGroupDeputy.js +30 -0
  621. package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +14 -0
  622. package/node_modules/zca-js/dist/apis/addPollOptions.js +26 -0
  623. package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +11 -0
  624. package/node_modules/zca-js/dist/apis/addQuickMessage.js +60 -0
  625. package/node_modules/zca-js/dist/apis/addReaction.d.ts +18 -0
  626. package/node_modules/zca-js/dist/apis/addReaction.js +294 -0
  627. package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +8 -0
  628. package/node_modules/zca-js/dist/apis/addUnreadMark.js +52 -0
  629. package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +5 -0
  630. package/node_modules/zca-js/dist/apis/addUserToGroup.js +34 -0
  631. package/node_modules/zca-js/dist/apis/blockUser.d.ts +2 -0
  632. package/node_modules/zca-js/dist/apis/blockUser.js +28 -0
  633. package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +2 -0
  634. package/node_modules/zca-js/dist/apis/blockViewFeed.js +30 -0
  635. package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +3 -0
  636. package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +52 -0
  637. package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +2 -0
  638. package/node_modules/zca-js/dist/apis/changeFriendAlias.js +27 -0
  639. package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +3 -0
  640. package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +44 -0
  641. package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +4 -0
  642. package/node_modules/zca-js/dist/apis/changeGroupName.js +32 -0
  643. package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +4 -0
  644. package/node_modules/zca-js/dist/apis/changeGroupOwner.js +30 -0
  645. package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +14 -0
  646. package/node_modules/zca-js/dist/apis/createAutoReply.js +37 -0
  647. package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +8 -0
  648. package/node_modules/zca-js/dist/apis/createBankAccount.js +32 -0
  649. package/node_modules/zca-js/dist/apis/createCatalog.d.ts +7 -0
  650. package/node_modules/zca-js/dist/apis/createCatalog.js +29 -0
  651. package/node_modules/zca-js/dist/apis/createGroup.d.ts +28 -0
  652. package/node_modules/zca-js/dist/apis/createGroup.js +43 -0
  653. package/node_modules/zca-js/dist/apis/createNote.d.ts +7 -0
  654. package/node_modules/zca-js/dist/apis/createNote.js +47 -0
  655. package/node_modules/zca-js/dist/apis/createPoll.d.ts +36 -0
  656. package/node_modules/zca-js/dist/apis/createPoll.js +40 -0
  657. package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +23 -0
  658. package/node_modules/zca-js/dist/apis/createProductCatalog.js +50 -0
  659. package/node_modules/zca-js/dist/apis/createReminder.d.ts +12 -0
  660. package/node_modules/zca-js/dist/apis/createReminder.js +63 -0
  661. package/node_modules/zca-js/dist/apis/custom.d.ts +9 -0
  662. package/node_modules/zca-js/dist/apis/custom.js +15 -0
  663. package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +5 -0
  664. package/node_modules/zca-js/dist/apis/deleteAutoReply.js +29 -0
  665. package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +9 -0
  666. package/node_modules/zca-js/dist/apis/deleteAvatar.js +27 -0
  667. package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +11 -0
  668. package/node_modules/zca-js/dist/apis/deleteBankAccount.js +32 -0
  669. package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +2 -0
  670. package/node_modules/zca-js/dist/apis/deleteCatalog.js +28 -0
  671. package/node_modules/zca-js/dist/apis/deleteChat.d.ts +19 -0
  672. package/node_modules/zca-js/dist/apis/deleteChat.js +50 -0
  673. package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +9 -0
  674. package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +27 -0
  675. package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +14 -0
  676. package/node_modules/zca-js/dist/apis/deleteMessage.js +52 -0
  677. package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +10 -0
  678. package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +31 -0
  679. package/node_modules/zca-js/dist/apis/deleteSnapshotMobileMsg.js +18 -0
  680. package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +2 -0
  681. package/node_modules/zca-js/dist/apis/disableGroupLink.js +24 -0
  682. package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +2 -0
  683. package/node_modules/zca-js/dist/apis/disperseGroup.js +28 -0
  684. package/node_modules/zca-js/dist/apis/editNote.d.ts +17 -0
  685. package/node_modules/zca-js/dist/apis/editNote.js +46 -0
  686. package/node_modules/zca-js/dist/apis/editReminder.d.ts +13 -0
  687. package/node_modules/zca-js/dist/apis/editReminder.js +61 -0
  688. package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +6 -0
  689. package/node_modules/zca-js/dist/apis/enableGroupLink.js +25 -0
  690. package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +5 -0
  691. package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +10 -0
  692. package/node_modules/zca-js/dist/apis/findUser.d.ts +3 -0
  693. package/node_modules/zca-js/dist/apis/findUser.js +42 -0
  694. package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +3 -0
  695. package/node_modules/zca-js/dist/apis/findUserByUsername.js +27 -0
  696. package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +24 -0
  697. package/node_modules/zca-js/dist/apis/forwardMessage.js +114 -0
  698. package/node_modules/zca-js/dist/apis/getAliasList.d.ts +8 -0
  699. package/node_modules/zca-js/dist/apis/getAliasList.js +27 -0
  700. package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +3 -0
  701. package/node_modules/zca-js/dist/apis/getAllFriends.js +34 -0
  702. package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +7 -0
  703. package/node_modules/zca-js/dist/apis/getAllGroups.js +10 -0
  704. package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +5 -0
  705. package/node_modules/zca-js/dist/apis/getArchivedChatList.js +23 -0
  706. package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +9 -0
  707. package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +21 -0
  708. package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +6 -0
  709. package/node_modules/zca-js/dist/apis/getAutoReplyList.js +24 -0
  710. package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +12 -0
  711. package/node_modules/zca-js/dist/apis/getAvatarList.js +28 -0
  712. package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +7 -0
  713. package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +30 -0
  714. package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +24 -0
  715. package/node_modules/zca-js/dist/apis/getBizAccount.js +27 -0
  716. package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +18 -0
  717. package/node_modules/zca-js/dist/apis/getCatalogList.js +32 -0
  718. package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +3 -0
  719. package/node_modules/zca-js/dist/apis/getCloseFriends.js +20 -0
  720. package/node_modules/zca-js/dist/apis/getContext.d.ts +1 -0
  721. package/node_modules/zca-js/dist/apis/getContext.js +4 -0
  722. package/node_modules/zca-js/dist/apis/getCookie.d.ts +1 -0
  723. package/node_modules/zca-js/dist/apis/getCookie.js +9 -0
  724. package/node_modules/zca-js/dist/apis/getCrossDB.js +18 -0
  725. package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +5 -0
  726. package/node_modules/zca-js/dist/apis/getFriendBoardList.js +26 -0
  727. package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +10 -0
  728. package/node_modules/zca-js/dist/apis/getFriendOnlines.js +35 -0
  729. package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +42 -0
  730. package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +27 -0
  731. package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +8 -0
  732. package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +25 -0
  733. package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +5 -0
  734. package/node_modules/zca-js/dist/apis/getFullAvatar.js +25 -0
  735. package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +23 -0
  736. package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +29 -0
  737. package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +8 -0
  738. package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +36 -0
  739. package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +16 -0
  740. package/node_modules/zca-js/dist/apis/getGroupInfo.js +32 -0
  741. package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
  742. package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +38 -0
  743. package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +38 -0
  744. package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +31 -0
  745. package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +9 -0
  746. package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +25 -0
  747. package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +34 -0
  748. package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +28 -0
  749. package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +17 -0
  750. package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +24 -0
  751. package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +11 -0
  752. package/node_modules/zca-js/dist/apis/getHiddenConversations.js +23 -0
  753. package/node_modules/zca-js/dist/apis/getLabels.d.ts +7 -0
  754. package/node_modules/zca-js/dist/apis/getLabels.js +28 -0
  755. package/node_modules/zca-js/dist/apis/getListBank.d.ts +5 -0
  756. package/node_modules/zca-js/dist/apis/getListBank.js +20 -0
  757. package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +7 -0
  758. package/node_modules/zca-js/dist/apis/getListBankAccount.js +27 -0
  759. package/node_modules/zca-js/dist/apis/getListBoard.d.ts +21 -0
  760. package/node_modules/zca-js/dist/apis/getListBoard.js +45 -0
  761. package/node_modules/zca-js/dist/apis/getListDevice.d.ts +10 -0
  762. package/node_modules/zca-js/dist/apis/getListDevice.js +22 -0
  763. package/node_modules/zca-js/dist/apis/getListReminder.d.ts +28 -0
  764. package/node_modules/zca-js/dist/apis/getListReminder.js +47 -0
  765. package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +5 -0
  766. package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +39 -0
  767. package/node_modules/zca-js/dist/apis/getMute.d.ts +13 -0
  768. package/node_modules/zca-js/dist/apis/getMute.js +22 -0
  769. package/node_modules/zca-js/dist/apis/getOwnId.d.ts +1 -0
  770. package/node_modules/zca-js/dist/apis/getOwnId.js +4 -0
  771. package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +11 -0
  772. package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +27 -0
  773. package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +5 -0
  774. package/node_modules/zca-js/dist/apis/getPinConversations.js +22 -0
  775. package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +3 -0
  776. package/node_modules/zca-js/dist/apis/getPollDetail.js +30 -0
  777. package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +20 -0
  778. package/node_modules/zca-js/dist/apis/getProductCatalogList.js +33 -0
  779. package/node_modules/zca-js/dist/apis/getQR.d.ts +4 -0
  780. package/node_modules/zca-js/dist/apis/getQR.js +29 -0
  781. package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +7 -0
  782. package/node_modules/zca-js/dist/apis/getQuickMessageList.js +24 -0
  783. package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +6 -0
  784. package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +30 -0
  785. package/node_modules/zca-js/dist/apis/getReminder.d.ts +3 -0
  786. package/node_modules/zca-js/dist/apis/getReminder.js +25 -0
  787. package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +5 -0
  788. package/node_modules/zca-js/dist/apis/getReminderResponses.js +24 -0
  789. package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +18 -0
  790. package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +24 -0
  791. package/node_modules/zca-js/dist/apis/getSettings.d.ts +3 -0
  792. package/node_modules/zca-js/dist/apis/getSettings.js +20 -0
  793. package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +3 -0
  794. package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +24 -0
  795. package/node_modules/zca-js/dist/apis/getStickers.d.ts +1 -0
  796. package/node_modules/zca-js/dist/apis/getStickers.js +40 -0
  797. package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +3 -0
  798. package/node_modules/zca-js/dist/apis/getStickersDetail.js +40 -0
  799. package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +14 -0
  800. package/node_modules/zca-js/dist/apis/getUnreadMark.js +30 -0
  801. package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +8 -0
  802. package/node_modules/zca-js/dist/apis/getUserInfo.js +44 -0
  803. package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +10 -0
  804. package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +30 -0
  805. package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +2 -0
  806. package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +25 -0
  807. package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +2 -0
  808. package/node_modules/zca-js/dist/apis/joinGroupLink.js +27 -0
  809. package/node_modules/zca-js/dist/apis/keepAlive.d.ts +4 -0
  810. package/node_modules/zca-js/dist/apis/keepAlive.js +22 -0
  811. package/node_modules/zca-js/dist/apis/lastOnline.d.ts +7 -0
  812. package/node_modules/zca-js/dist/apis/lastOnline.js +26 -0
  813. package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +4 -0
  814. package/node_modules/zca-js/dist/apis/leaveGroup.js +33 -0
  815. package/node_modules/zca-js/dist/apis/listen.d.ts +102 -0
  816. package/node_modules/zca-js/dist/apis/listen.js +425 -0
  817. package/node_modules/zca-js/dist/apis/lockPoll.d.ts +2 -0
  818. package/node_modules/zca-js/dist/apis/lockPoll.js +28 -0
  819. package/node_modules/zca-js/dist/apis/login.d.ts +3 -0
  820. package/node_modules/zca-js/dist/apis/login.js +96 -0
  821. package/node_modules/zca-js/dist/apis/loginQR.d.ts +71 -0
  822. package/node_modules/zca-js/dist/apis/loginQR.js +376 -0
  823. package/node_modules/zca-js/dist/apis/logoutV2.js +79 -0
  824. package/node_modules/zca-js/dist/apis/lostFocus.d.ts +4 -0
  825. package/node_modules/zca-js/dist/apis/lostFocus.js +23 -0
  826. package/node_modules/zca-js/dist/apis/parseLink.d.ts +21 -0
  827. package/node_modules/zca-js/dist/apis/parseLink.js +27 -0
  828. package/node_modules/zca-js/dist/apis/pullMobileMsg.js +22 -0
  829. package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +2 -0
  830. package/node_modules/zca-js/dist/apis/registerCatalog.js +27 -0
  831. package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +2 -0
  832. package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +27 -0
  833. package/node_modules/zca-js/dist/apis/removeFriend.d.ts +2 -0
  834. package/node_modules/zca-js/dist/apis/removeFriend.js +28 -0
  835. package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +2 -0
  836. package/node_modules/zca-js/dist/apis/removeFriendAlias.js +24 -0
  837. package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +2 -0
  838. package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +28 -0
  839. package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +2 -0
  840. package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +30 -0
  841. package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +5 -0
  842. package/node_modules/zca-js/dist/apis/removeQuickMessage.js +27 -0
  843. package/node_modules/zca-js/dist/apis/removeReminder.d.ts +3 -0
  844. package/node_modules/zca-js/dist/apis/removeReminder.js +40 -0
  845. package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +8 -0
  846. package/node_modules/zca-js/dist/apis/removeUnreadMark.js +50 -0
  847. package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +4 -0
  848. package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +34 -0
  849. package/node_modules/zca-js/dist/apis/requestSyncMessage.js +18 -0
  850. package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +2 -0
  851. package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +20 -0
  852. package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +2 -0
  853. package/node_modules/zca-js/dist/apis/reuseAvatar.js +26 -0
  854. package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
  855. package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +38 -0
  856. package/node_modules/zca-js/dist/apis/scanURL.d.ts +4 -0
  857. package/node_modules/zca-js/dist/apis/scanURL.js +28 -0
  858. package/node_modules/zca-js/dist/apis/searchSticker.d.ts +3 -0
  859. package/node_modules/zca-js/dist/apis/searchSticker.js +28 -0
  860. package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +9 -0
  861. package/node_modules/zca-js/dist/apis/sendBankCard.js +53 -0
  862. package/node_modules/zca-js/dist/apis/sendCard.d.ts +10 -0
  863. package/node_modules/zca-js/dist/apis/sendCard.js +75 -0
  864. package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +16 -0
  865. package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +55 -0
  866. package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +2 -0
  867. package/node_modules/zca-js/dist/apis/sendFriendRequest.js +39 -0
  868. package/node_modules/zca-js/dist/apis/sendLink.d.ts +10 -0
  869. package/node_modules/zca-js/dist/apis/sendLink.js +78 -0
  870. package/node_modules/zca-js/dist/apis/sendMessage.d.ts +105 -0
  871. package/node_modules/zca-js/dist/apis/sendMessage.js +486 -0
  872. package/node_modules/zca-js/dist/apis/sendReport.d.ts +17 -0
  873. package/node_modules/zca-js/dist/apis/sendReport.js +53 -0
  874. package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +16 -0
  875. package/node_modules/zca-js/dist/apis/sendSeenEvent.js +63 -0
  876. package/node_modules/zca-js/dist/apis/sendSticker.d.ts +10 -0
  877. package/node_modules/zca-js/dist/apis/sendSticker.js +74 -0
  878. package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +5 -0
  879. package/node_modules/zca-js/dist/apis/sendTypingEvent.js +33 -0
  880. package/node_modules/zca-js/dist/apis/sendVideo.d.ts +35 -0
  881. package/node_modules/zca-js/dist/apis/sendVideo.js +134 -0
  882. package/node_modules/zca-js/dist/apis/sendVoice.d.ts +12 -0
  883. package/node_modules/zca-js/dist/apis/sendVoice.js +89 -0
  884. package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +3 -0
  885. package/node_modules/zca-js/dist/apis/setHiddenConversations.js +39 -0
  886. package/node_modules/zca-js/dist/apis/setMute.d.ts +20 -0
  887. package/node_modules/zca-js/dist/apis/setMute.js +67 -0
  888. package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +3 -0
  889. package/node_modules/zca-js/dist/apis/setPinnedConversations.js +34 -0
  890. package/node_modules/zca-js/dist/apis/sharePoll.d.ts +2 -0
  891. package/node_modules/zca-js/dist/apis/sharePoll.js +28 -0
  892. package/node_modules/zca-js/dist/apis/unblockUser.d.ts +2 -0
  893. package/node_modules/zca-js/dist/apis/unblockUser.js +28 -0
  894. package/node_modules/zca-js/dist/apis/undo.d.ts +9 -0
  895. package/node_modules/zca-js/dist/apis/undo.js +42 -0
  896. package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +2 -0
  897. package/node_modules/zca-js/dist/apis/undoFriendRequest.js +27 -0
  898. package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +4 -0
  899. package/node_modules/zca-js/dist/apis/updateActiveStatus.js +27 -0
  900. package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +10 -0
  901. package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +34 -0
  902. package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +9 -0
  903. package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +40 -0
  904. package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +15 -0
  905. package/node_modules/zca-js/dist/apis/updateAutoReply.js +38 -0
  906. package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +9 -0
  907. package/node_modules/zca-js/dist/apis/updateBankAccount.js +31 -0
  908. package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +11 -0
  909. package/node_modules/zca-js/dist/apis/updateCatalog.js +30 -0
  910. package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +40 -0
  911. package/node_modules/zca-js/dist/apis/updateGroupSettings.js +43 -0
  912. package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +2 -0
  913. package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +30 -0
  914. package/node_modules/zca-js/dist/apis/updateLabels.d.ts +15 -0
  915. package/node_modules/zca-js/dist/apis/updateLabels.js +34 -0
  916. package/node_modules/zca-js/dist/apis/updateLang.d.ts +6 -0
  917. package/node_modules/zca-js/dist/apis/updateLang.js +30 -0
  918. package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +25 -0
  919. package/node_modules/zca-js/dist/apis/updateProductCatalog.js +51 -0
  920. package/node_modules/zca-js/dist/apis/updateProfile.d.ts +20 -0
  921. package/node_modules/zca-js/dist/apis/updateProfile.js +43 -0
  922. package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +2 -0
  923. package/node_modules/zca-js/dist/apis/updateProfileBio.js +27 -0
  924. package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +11 -0
  925. package/node_modules/zca-js/dist/apis/updateQuickMessage.js +61 -0
  926. package/node_modules/zca-js/dist/apis/updateSettings.d.ts +16 -0
  927. package/node_modules/zca-js/dist/apis/updateSettings.js +90 -0
  928. package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
  929. package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +27 -0
  930. package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +50 -0
  931. package/node_modules/zca-js/dist/apis/uploadAttachment.js +197 -0
  932. package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +14 -0
  933. package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +50 -0
  934. package/node_modules/zca-js/dist/apis/votePoll.d.ts +5 -0
  935. package/node_modules/zca-js/dist/apis/votePoll.js +29 -0
  936. package/node_modules/zca-js/dist/apis.d.ts +317 -0
  937. package/node_modules/zca-js/dist/apis.js +327 -0
  938. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +11 -0
  939. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
  940. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
  941. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
  942. package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
  943. package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
  944. package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +35 -0
  945. package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +31 -0
  946. package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +65 -0
  947. package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +308 -0
  948. package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +66 -0
  949. package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +39 -0
  950. package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +33 -0
  951. package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +35 -0
  952. package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
  953. package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +32 -0
  954. package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
  955. package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +37 -0
  956. package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +35 -0
  957. package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +42 -0
  958. package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +37 -0
  959. package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +34 -0
  960. package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +48 -0
  961. package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +52 -0
  962. package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +45 -0
  963. package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +55 -0
  964. package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +77 -0
  965. package/node_modules/zca-js/dist/cjs/apis/custom.cjs +19 -0
  966. package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +34 -0
  967. package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +32 -0
  968. package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +37 -0
  969. package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +33 -0
  970. package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +64 -0
  971. package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
  972. package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +66 -0
  973. package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
  974. package/node_modules/zca-js/dist/cjs/apis/deleteSnapshotMobileMsg.cjs +22 -0
  975. package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +29 -0
  976. package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +33 -0
  977. package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +51 -0
  978. package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +75 -0
  979. package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +30 -0
  980. package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
  981. package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +56 -0
  982. package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +41 -0
  983. package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +129 -0
  984. package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +32 -0
  985. package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +48 -0
  986. package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +15 -0
  987. package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +28 -0
  988. package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
  989. package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +29 -0
  990. package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +33 -0
  991. package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
  992. package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +32 -0
  993. package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +37 -0
  994. package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +25 -0
  995. package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +9 -0
  996. package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +14 -0
  997. package/node_modules/zca-js/dist/cjs/apis/getCrossDB.cjs +22 -0
  998. package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +31 -0
  999. package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +40 -0
  1000. package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
  1001. package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
  1002. package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +30 -0
  1003. package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
  1004. package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
  1005. package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +37 -0
  1006. package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
  1007. package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
  1008. package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
  1009. package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
  1010. package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
  1011. package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +28 -0
  1012. package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +33 -0
  1013. package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +25 -0
  1014. package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +32 -0
  1015. package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +59 -0
  1016. package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +27 -0
  1017. package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +61 -0
  1018. package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
  1019. package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +27 -0
  1020. package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +9 -0
  1021. package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
  1022. package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +27 -0
  1023. package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +35 -0
  1024. package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +38 -0
  1025. package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +34 -0
  1026. package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +29 -0
  1027. package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
  1028. package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +30 -0
  1029. package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +29 -0
  1030. package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
  1031. package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +25 -0
  1032. package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
  1033. package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +45 -0
  1034. package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +45 -0
  1035. package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +35 -0
  1036. package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +58 -0
  1037. package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
  1038. package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
  1039. package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +32 -0
  1040. package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +27 -0
  1041. package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +31 -0
  1042. package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +38 -0
  1043. package/node_modules/zca-js/dist/cjs/apis/listen.cjs +440 -0
  1044. package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +33 -0
  1045. package/node_modules/zca-js/dist/cjs/apis/login.cjs +102 -0
  1046. package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +368 -0
  1047. package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +83 -0
  1048. package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +28 -0
  1049. package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +32 -0
  1050. package/node_modules/zca-js/dist/cjs/apis/pullMobileMsg.cjs +26 -0
  1051. package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +32 -0
  1052. package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
  1053. package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +33 -0
  1054. package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +29 -0
  1055. package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
  1056. package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
  1057. package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +32 -0
  1058. package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +54 -0
  1059. package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +64 -0
  1060. package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
  1061. package/node_modules/zca-js/dist/cjs/apis/requestSyncMessage.cjs +22 -0
  1062. package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
  1063. package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +31 -0
  1064. package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
  1065. package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +33 -0
  1066. package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +33 -0
  1067. package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +68 -0
  1068. package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +89 -0
  1069. package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
  1070. package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +44 -0
  1071. package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +92 -0
  1072. package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +500 -0
  1073. package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +67 -0
  1074. package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +77 -0
  1075. package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +88 -0
  1076. package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +47 -0
  1077. package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +148 -0
  1078. package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +103 -0
  1079. package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +53 -0
  1080. package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +81 -0
  1081. package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +48 -0
  1082. package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +33 -0
  1083. package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +33 -0
  1084. package/node_modules/zca-js/dist/cjs/apis/undo.cjs +56 -0
  1085. package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +32 -0
  1086. package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +32 -0
  1087. package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
  1088. package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
  1089. package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +43 -0
  1090. package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +36 -0
  1091. package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +35 -0
  1092. package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +48 -0
  1093. package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
  1094. package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +39 -0
  1095. package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +35 -0
  1096. package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +56 -0
  1097. package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +48 -0
  1098. package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +32 -0
  1099. package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +66 -0
  1100. package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +95 -0
  1101. package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
  1102. package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +211 -0
  1103. package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
  1104. package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +34 -0
  1105. package/node_modules/zca-js/dist/cjs/apis.cjs +332 -0
  1106. package/node_modules/zca-js/dist/cjs/context.cjs +34 -0
  1107. package/node_modules/zca-js/dist/cjs/index.cjs +159 -0
  1108. package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +9 -0
  1109. package/node_modules/zca-js/dist/cjs/models/Bank.cjs +263 -0
  1110. package/node_modules/zca-js/dist/cjs/models/Board.cjs +8 -0
  1111. package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +23 -0
  1112. package/node_modules/zca-js/dist/cjs/models/Enum.cjs +27 -0
  1113. package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +87 -0
  1114. package/node_modules/zca-js/dist/cjs/models/Group.cjs +13 -0
  1115. package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +94 -0
  1116. package/node_modules/zca-js/dist/cjs/models/Message.cjs +35 -0
  1117. package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +74 -0
  1118. package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +9 -0
  1119. package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +23 -0
  1120. package/node_modules/zca-js/dist/cjs/models/Typing.cjs +23 -0
  1121. package/node_modules/zca-js/dist/cjs/models/Undo.cjs +16 -0
  1122. package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +39 -0
  1123. package/node_modules/zca-js/dist/cjs/update.cjs +34 -0
  1124. package/node_modules/zca-js/dist/cjs/utils.cjs +703 -0
  1125. package/node_modules/zca-js/dist/cjs/zalo.cjs +112 -0
  1126. package/node_modules/zca-js/dist/context.d.ts +179 -0
  1127. package/node_modules/zca-js/dist/context.js +28 -0
  1128. package/node_modules/zca-js/dist/index.d.ts +166 -0
  1129. package/node_modules/zca-js/dist/index.js +14 -0
  1130. package/node_modules/zca-js/dist/models/Attachment.d.ts +9 -0
  1131. package/node_modules/zca-js/dist/models/Attachment.js +1 -0
  1132. package/node_modules/zca-js/dist/models/AutoReply.d.ts +20 -0
  1133. package/node_modules/zca-js/dist/models/AutoReply.js +7 -0
  1134. package/node_modules/zca-js/dist/models/Bank.d.ts +291 -0
  1135. package/node_modules/zca-js/dist/models/Bank.js +262 -0
  1136. package/node_modules/zca-js/dist/models/Board.d.ts +60 -0
  1137. package/node_modules/zca-js/dist/models/Board.js +6 -0
  1138. package/node_modules/zca-js/dist/models/Catalog.d.ts +16 -0
  1139. package/node_modules/zca-js/dist/models/Catalog.js +1 -0
  1140. package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +27 -0
  1141. package/node_modules/zca-js/dist/models/DeliveredMessage.js +17 -0
  1142. package/node_modules/zca-js/dist/models/Enum.d.ts +21 -0
  1143. package/node_modules/zca-js/dist/models/Enum.js +25 -0
  1144. package/node_modules/zca-js/dist/models/FriendEvent.d.ts +107 -0
  1145. package/node_modules/zca-js/dist/models/FriendEvent.js +83 -0
  1146. package/node_modules/zca-js/dist/models/Group.d.ts +125 -0
  1147. package/node_modules/zca-js/dist/models/Group.js +11 -0
  1148. package/node_modules/zca-js/dist/models/GroupEvent.d.ts +178 -0
  1149. package/node_modules/zca-js/dist/models/GroupEvent.js +90 -0
  1150. package/node_modules/zca-js/dist/models/Label.d.ts +10 -0
  1151. package/node_modules/zca-js/dist/models/Label.js +1 -0
  1152. package/node_modules/zca-js/dist/models/Message.d.ts +91 -0
  1153. package/node_modules/zca-js/dist/models/Message.js +29 -0
  1154. package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +17 -0
  1155. package/node_modules/zca-js/dist/models/ProductCatalog.js +1 -0
  1156. package/node_modules/zca-js/dist/models/QuickMessage.d.ts +25 -0
  1157. package/node_modules/zca-js/dist/models/QuickMessage.js +1 -0
  1158. package/node_modules/zca-js/dist/models/Reaction.d.ts +85 -0
  1159. package/node_modules/zca-js/dist/models/Reaction.js +70 -0
  1160. package/node_modules/zca-js/dist/models/Reminder.d.ts +51 -0
  1161. package/node_modules/zca-js/dist/models/Reminder.js +7 -0
  1162. package/node_modules/zca-js/dist/models/SeenMessage.d.ts +26 -0
  1163. package/node_modules/zca-js/dist/models/SeenMessage.js +17 -0
  1164. package/node_modules/zca-js/dist/models/Sticker.d.ts +27 -0
  1165. package/node_modules/zca-js/dist/models/Sticker.js +1 -0
  1166. package/node_modules/zca-js/dist/models/Typing.d.ts +24 -0
  1167. package/node_modules/zca-js/dist/models/Typing.js +17 -0
  1168. package/node_modules/zca-js/dist/models/Undo.d.ts +34 -0
  1169. package/node_modules/zca-js/dist/models/Undo.js +12 -0
  1170. package/node_modules/zca-js/dist/models/User.d.ts +70 -0
  1171. package/node_modules/zca-js/dist/models/User.js +1 -0
  1172. package/node_modules/zca-js/dist/models/ZBusiness.d.ts +22 -0
  1173. package/node_modules/zca-js/dist/models/ZBusiness.js +35 -0
  1174. package/node_modules/zca-js/dist/models/index.d.ts +22 -0
  1175. package/node_modules/zca-js/dist/models/index.js +22 -0
  1176. package/node_modules/zca-js/dist/update.d.ts +2 -0
  1177. package/node_modules/zca-js/dist/update.js +29 -0
  1178. package/node_modules/zca-js/dist/utils.d.ts +167 -0
  1179. package/node_modules/zca-js/dist/utils.js +719 -0
  1180. package/node_modules/zca-js/dist/zalo.d.ts +41 -0
  1181. package/node_modules/zca-js/dist/zalo.js +107 -0
  1182. package/node_modules/zca-js/eslint.config.js +21 -0
  1183. package/node_modules/zca-js/index.d.ts +2 -0
  1184. package/node_modules/zca-js/package.json +78 -0
  1185. package/node_modules/zca-js/rollup.config.js +28 -0
  1186. package/package.json +79 -62
  1187. package/patches/zca-js+2.2.0.patch +1677 -0
  1188. package/src/cli.test.js +34 -5
  1189. package/src/commands/account.js +98 -5
  1190. package/src/commands/auto-reply.js +30 -10
  1191. package/src/commands/catalog.js +5 -4
  1192. package/src/commands/conv.js +551 -14
  1193. package/src/commands/friend.js +19 -7
  1194. package/src/commands/group.js +82 -31
  1195. package/src/commands/listen.js +607 -65
  1196. package/src/commands/login.js +179 -20
  1197. package/src/commands/mcp.js +392 -41
  1198. package/src/commands/msg.js +1278 -139
  1199. package/src/commands/oa-listen.js +130 -20
  1200. package/src/commands/oa.js +26 -5
  1201. package/src/commands/poll.js +7 -2
  1202. package/src/commands/profile.js +3 -2
  1203. package/src/commands/sync.js +2052 -0
  1204. package/src/core/accounts.js +69 -6
  1205. package/src/core/cached-message.js +200 -0
  1206. package/src/core/coverage.js +90 -0
  1207. package/src/core/daemon-channel.js +638 -0
  1208. package/src/core/daemon-sync.js +181 -0
  1209. package/src/core/db.js +1610 -0
  1210. package/src/core/forward.js +112 -0
  1211. package/src/core/group-history.js +248 -0
  1212. package/src/core/group-members.js +68 -0
  1213. package/src/core/group-settings.js +250 -0
  1214. package/src/core/history-fetch.js +208 -0
  1215. package/src/core/listener-lifecycle.js +90 -0
  1216. package/src/core/live-api.js +47 -0
  1217. package/src/core/live-store.js +733 -0
  1218. package/src/core/lock.js +129 -0
  1219. package/src/core/logout.js +289 -0
  1220. package/src/core/offline-queue.js +194 -0
  1221. package/src/core/pin.js +222 -0
  1222. package/src/core/read-state.js +318 -0
  1223. package/src/core/receipts.js +679 -0
  1224. package/src/core/recent-conversations.js +30 -0
  1225. package/src/core/self-heal.js +522 -0
  1226. package/src/core/socket-tap.js +154 -0
  1227. package/src/core/sync-v2/assets.js +181 -0
  1228. package/src/core/sync-v2/board.js +338 -0
  1229. package/src/core/sync-v2/conv-state.js +152 -0
  1230. package/src/core/sync-v2/gap-advice.js +110 -0
  1231. package/src/core/sync-v2/gid.js +103 -0
  1232. package/src/core/sync-v2/index.js +1208 -0
  1233. package/src/core/sync-v2/keepalive.js +177 -0
  1234. package/src/core/sync-v2/media.js +704 -0
  1235. package/src/core/sync-v2/message-types.js +522 -0
  1236. package/src/core/sync-v2/plan.js +95 -0
  1237. package/src/core/sync-v2/reactions.js +236 -0
  1238. package/src/core/sync-v2/renewlink.js +124 -0
  1239. package/src/core/sync-v2/zcloud-cipher.js +88 -0
  1240. package/src/core/sync-v2/zcloud.js +675 -0
  1241. package/src/core/sync.js +540 -0
  1242. package/src/core/zalo-client.js +179 -61
  1243. package/src/core/zca-custom.js +78 -0
  1244. package/src/index.js +14 -3
  1245. package/src/mcp/mcp-config.js +40 -3
  1246. package/src/mcp/mcp-http-transport.js +11 -2
  1247. package/src/mcp/mcp-server.js +4 -2
  1248. package/src/mcp/mcp-tools.js +837 -97
  1249. package/src/mcp/message-buffer.js +38 -8
  1250. package/src/mcp/message-buffer.test.js +67 -15
  1251. package/src/mcp/notifier.js +17 -1
  1252. package/src/mcp/notifier.test.js +6 -0
  1253. package/src/utils/bank-helpers.js +8 -3
  1254. package/src/utils/device-fingerprint.js +72 -0
  1255. package/src/utils/mentions.js +140 -0
  1256. package/src/utils/my-documents.js +95 -0
  1257. package/src/utils/open-file.js +49 -0
  1258. package/src/utils/output.js +75 -4
  1259. package/src/utils/parse-options.js +56 -0
  1260. package/src/utils/qr-http-server.js +44 -7
  1261. package/src/utils/quote.js +203 -0
  1262. package/src/utils/thread-type.js +72 -0
  1263. package/src/utils/update-check.js +42 -1
  1264. package/src/utils/urgency.js +29 -0
  1265. package/src/mcp/media-downloader.js +0 -191
  1266. package/src/mcp/media-downloader.test.js +0 -45
  1267. package/src/utils/qr-display.test.js +0 -97
@@ -1,12 +1,295 @@
1
1
  /**
2
2
  * Message commands — send text, images, files, cards, bank cards, QR transfers,
3
- * stickers, reactions, delete, forward.
3
+ * stickers, reactions, delete, forward, pin.
4
4
  */
5
5
 
6
- import { resolve } from "path";
7
- import { getApi } from "../core/zalo-client.js";
8
- import { success, error, info, output } from "../utils/output.js";
9
- import { extractMessageText } from "../utils/extract-message-text.js";
6
+ import { existsSync } from "node:fs";
7
+ import { resolve, join } from "path";
8
+ import { InvalidArgumentError } from "commander";
9
+ import { getApi, getOwnId } from "../core/zalo-client.js";
10
+ import { success, error, info, output, warning } from "../utils/output.js";
11
+ import { parseIntOption } from "../utils/parse-options.js";
12
+ import { getActive } from "../core/accounts.js";
13
+ import { CONFIG_DIR } from "../core/credentials.js";
14
+ import { initDb, getMessages, getMessageById, getDisplayName, getThreadType } from "../core/db.js";
15
+ import { sendViaDaemon, getDaemonChannel, getSyncChannel, syncViaDaemon } from "../core/daemon-channel.js";
16
+ import { fetchAndCacheHistory } from "../core/history-fetch.js";
17
+ import { classifyLiveMessage } from "../core/sync-v2/message-types.js";
18
+ import { downloadSyncedMedia } from "../core/sync-v2/media.js";
19
+ import { describeZaloError } from "../core/sync-v2/board.js";
20
+ import {
21
+ cachedCliMsgId,
22
+ cachedText,
23
+ resolveSenderUid,
24
+ cachedMessageById,
25
+ reactionCliMsgId,
26
+ recallCliMsgId,
27
+ } from "../core/cached-message.js";
28
+ import { buildForwardReference, sendForward, LOG_SRC_TYPE } from "../core/forward.js";
29
+ import { fetchMemberNames } from "../core/group-members.js";
30
+ import { pinMessage, unpinMessage, textPinParams } from "../core/pin.js";
31
+ import { expandMentions, parseMentionSpecs, shiftStyles, ALL_MENTION_UID } from "../utils/mentions.js";
32
+ import { applySelfThreadAlias } from "../utils/my-documents.js";
33
+ import { buildQuote, resolveQuoteSender } from "../utils/quote.js";
34
+ import { urgencyLevel } from "../utils/urgency.js";
35
+
36
+ /**
37
+ * Open the active account's SQLite cache.
38
+ *
39
+ * Best-effort on purpose: every caller here has a useful fallback for "no
40
+ * account, no cache file, or a db that will not open", so this reports that
41
+ * as false rather than failing the command.
42
+ *
43
+ * @returns {boolean} true when db.js is initialized and safe to query
44
+ */
45
+ function openAccountDb() {
46
+ try {
47
+ const acc = getActive();
48
+ if (!acc) return false;
49
+ initDb(join(CONFIG_DIR, "accounts", acc.ownId, "zalo.db"));
50
+ return true;
51
+ } catch {
52
+ return false;
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Display name for a `@[uid]` mention token, or null.
58
+ *
59
+ * Never throws. A name that cannot be looked up degrades to the uid, which
60
+ * still tags the right person — failing the whole send over a cache miss
61
+ * would be a far worse trade.
62
+ *
63
+ * @param {string} uid
64
+ * @param {boolean} cacheOpen - whether openAccountDb() succeeded
65
+ * @returns {string|null}
66
+ */
67
+ function mentionName(uid, cacheOpen) {
68
+ if (!cacheOpen) return null;
69
+ try {
70
+ return getDisplayName(uid);
71
+ } catch {
72
+ return null;
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Ask Zalo for the names the local cache could not supply.
78
+ *
79
+ * The cache only knows someone who has already spoken — `senderName` comes
80
+ * off their messages — so a member who has never posted in the group would
81
+ * be tagged as a bare uid. `getGroupMembersInfo` takes the whole missing set
82
+ * in one call, and only runs when there is something missing, so the common
83
+ * case still costs no network at all.
84
+ *
85
+ * Nothing is written back. `msg send` writes nothing to zalo.db (Arden,
86
+ * 2026-09-30: "the msg send should not write anything, the data will come
87
+ * from live listener or sync"), so a member the cache cannot name costs this
88
+ * one lookup on every send until the listener or a sync learns their name.
89
+ *
90
+ * Never throws: no session, not a member of that group, or an API hiccup all
91
+ * leave the uid in place, which is still a valid mention. The lookup itself is
92
+ * shared with `zalo_get_group_members` (src/core/group-members.js).
93
+ *
94
+ * @param {string[]} uids - uids the cache had no name for
95
+ * @returns {Promise<Map<string, string>>} uid → display name, for those found
96
+ */
97
+ async function fetchMentionNames(uids) {
98
+ if (uids.length === 0) return new Map();
99
+ try {
100
+ return (await fetchMemberNames(getApi(), uids)).names;
101
+ } catch {
102
+ return new Map(); // no session: fall back to the uid — see the doc comment
103
+ }
104
+ }
105
+
106
+ /**
107
+ * {@link cachedMessageById} for the active account, opening its cache first.
108
+ *
109
+ * The lookup is shared with the MCP tools (src/core/cached-message.js); only
110
+ * opening the db is the CLI's own. Null when there is no account or no cache.
111
+ *
112
+ * @param {string} threadId
113
+ * @param {string} msgId
114
+ * @returns {{cliMsgId: string, uidFrom: string|null}|null}
115
+ */
116
+ function cachedInAccount(threadId, msgId) {
117
+ return openAccountDb() ? cachedMessageById(threadId, msgId) : null;
118
+ }
119
+
120
+ /**
121
+ * Whether a conversation is a group, for commands that can act on either.
122
+ *
123
+ * `-t` wins whenever something set it: the user, or the preAction hook that
124
+ * fills it in from the cache for a `threadId` argument. When it is still at
125
+ * its default -- e.g. `msg pin <msgId>`, where the conversation comes from the
126
+ * cached message rather than an argument -- the cache decides, and the
127
+ * default (0) applies only to a conversation the cache has never seen.
128
+ *
129
+ * @param {string} threadId
130
+ * @param {object} opts - the command's options
131
+ * @param {import("commander").Command} cmd
132
+ * @returns {boolean}
133
+ */
134
+ function threadIsGroup(threadId, opts, cmd) {
135
+ if (cmd?.getOptionValueSource?.("type") === "default") {
136
+ try {
137
+ const kind = openAccountDb() ? getThreadType(threadId) : null;
138
+ if (kind) return kind === "group";
139
+ } catch {
140
+ /* fall back to the flag */
141
+ }
142
+ }
143
+ return Number(opts.type) === 1;
144
+ }
145
+
146
+ /**
147
+ * This session's My Documents thread id (`loginInfo.send2me_id`), or null.
148
+ *
149
+ * @param {object} api
150
+ * @returns {string|null}
151
+ */
152
+ function send2meIdOf(api) {
153
+ try {
154
+ const id = api.getContext().loginInfo?.send2me_id;
155
+ return id ? String(id) : null;
156
+ } catch {
157
+ return null;
158
+ }
159
+ }
160
+
161
+ /**
162
+ * What a forward reference needs to know about its source message.
163
+ *
164
+ * @param {object} api - a logged-in zca-js API
165
+ * @param {object} row - the cached source message
166
+ * @returns {Promise<object>} the input for buildForwardReference, or `{error}`
167
+ */
168
+ async function forwardSource(api, row) {
169
+ const cliMsgId = cachedCliMsgId(row);
170
+ if (!cliMsgId) {
171
+ return {
172
+ error:
173
+ "its cliMsgId was never cached, and the forward reference is derived from it " +
174
+ "(`listen` caches messages as they arrive, `sync` restores older ones)",
175
+ };
176
+ }
177
+ const threadId = String(row.threadId || "");
178
+ const isMyDocuments = Boolean(threadId) && threadId === send2meIdOf(api);
179
+ let kind = null;
180
+ try {
181
+ kind = threadId ? getThreadType(threadId) : null;
182
+ } catch {
183
+ /* reported below */
184
+ }
185
+ if (!kind && !isMyDocuments) {
186
+ return {
187
+ error:
188
+ `the local cache does not say whether its conversation (${threadId || "unknown"}) is a group ` +
189
+ `or a 1-1, and the forward reference depends on it`,
190
+ };
191
+ }
192
+ const sender = await resolveSenderUid(api, row.senderId, getOwnId());
193
+ if (sender.error) return { error: sender.error };
194
+ return {
195
+ cliMsgId,
196
+ senderUid: sender.uid,
197
+ threadId,
198
+ isGroup: kind === "group" && !isMyDocuments,
199
+ // The web's sendDttm: the server timestamp for any message it did not
200
+ // send itself. The cliMsgId is the fallback for a row that lost it.
201
+ ts: Number(row.timestamp) || Number(cliMsgId),
202
+ ...(isMyDocuments && { logSrcType: LOG_SRC_TYPE.MY_CLOUD }),
203
+ };
204
+ }
205
+
206
+ /**
207
+ * Commander parser for `--urgency`: `important` → 1, `urgent` → 2. The
208
+ * mapping is src/utils/urgency.js, which `zalo_send_message` shares.
209
+ *
210
+ * @param {string} value
211
+ * @returns {number}
212
+ * @throws {InvalidArgumentError} for anything else
213
+ */
214
+ function parseUrgency(value) {
215
+ const level = urgencyLevel(value);
216
+ if (!level) throw new InvalidArgumentError("Expected one of: important, urgent.");
217
+ return level;
218
+ }
219
+
220
+ /**
221
+ * Report a refusal: the error line, and a non-zero exit.
222
+ *
223
+ * @param {string} message
224
+ */
225
+ function refuse(message) {
226
+ error(message);
227
+ process.exitCode = 1;
228
+ }
229
+
230
+ /**
231
+ * A history row built with the classifier every other capture path uses.
232
+ *
233
+ * `msg history` is a third way into the cache, beside the listener and the
234
+ * mobile sync, and it used to carry its own mapping: the raw live msgType
235
+ * (chat.photo) as the row type -- the very spelling a one-off migration had to
236
+ * clean out -- and no has_attachment, so replaying a synced photo overwrote it
237
+ * to 0 and sync-media never fetched it again. It also won the merge below over
238
+ * the correctly classified cached row, so even the printed history showed the
239
+ * raw spelling.
240
+ *
241
+ * @param {object} data - a live-encoded message payload (msgType string + content)
242
+ * @param {string} threadId
243
+ * @returns {object} the row as printed; `raw_data` is dropped before output
244
+ */
245
+ function historyRow(data, threadId) {
246
+ const info = classifyLiveMessage(data || {});
247
+ return {
248
+ msgId: data?.msgId,
249
+ threadId,
250
+ senderId: data?.uidFrom || null,
251
+ senderName: data?.dName || null,
252
+ text: info.text,
253
+ timestamp: data?.ts ? Number(data.ts) : null,
254
+ type: info.type,
255
+ has_attachment: info.hasAttachment ? 1 : 0,
256
+ raw_data: info.raw,
257
+ };
258
+ }
259
+
260
+ /**
261
+ * Why a running daemon did not hand back `msg history`'s fetch.
262
+ *
263
+ * Every case ends the command with nothing fetched or written in this process:
264
+ * the daemon holds the account's one web session and is its one db writer, so
265
+ * doing either beside it is exactly what the hand-off exists to prevent. The
266
+ * only way past a daemon is for it to be gone, which a re-run finds out.
267
+ *
268
+ * @param {{status?: number, error?: string, disconnected?: boolean, busyStage?: string,
269
+ * busySince?: number}} r - syncViaDaemon's refusal
270
+ * @param {number} pid - the daemon's
271
+ * @returns {string} the reason, to follow "History fetch failed: "
272
+ */
273
+ function daemonHistoryFailure(r, pid) {
274
+ const who = `the listen/mcp daemon (pid ${pid})`;
275
+ if (r.status === 409) {
276
+ const since = r.busySince ? `, started ${Math.round((Date.now() - Number(r.busySince)) / 1000)}s ago` : "";
277
+ return (
278
+ `${who} is running a ${r.busyStage || "sync"} stage${since} — run this again when it finishes. ` +
279
+ "This command wrote nothing."
280
+ );
281
+ }
282
+ if (r.status === 404 || r.status === 503) {
283
+ return `${who} does not run the history fetch — restart it, then run this again.`;
284
+ }
285
+ if (r.disconnected) {
286
+ return (
287
+ `lost ${who} mid-fetch (${r.error}). This command wrote nothing. Run it again: a daemon that is ` +
288
+ "still up fetches it, and once the daemon has stopped this command fetches on its own."
289
+ );
290
+ }
291
+ return `${who} could not fetch it: ${r.error || "no reason given"}. This command wrote nothing.`;
292
+ }
10
293
 
11
294
  /**
12
295
  * TextStyle codes matching zca-js TextStyle enum.
@@ -74,6 +357,174 @@ function parseMarkdownStyles(input) {
74
357
  return { plain, styles };
75
358
  }
76
359
 
360
+ /**
361
+ * Extensions zca-js uploads through its inline-image path.
362
+ *
363
+ * uploadAttachment() routes on EXTENSION, not on which CLI command was used:
364
+ * these four resolve their upload promise synchronously, `gif` is split off
365
+ * by sendMessage() into its own inline path, and **everything else** —
366
+ * bmp, tiff, heic, avif, svg, mp4, pdf, … — takes the "others"/"video" path,
367
+ * which waits on a WebSocket upload-complete frame.
368
+ *
369
+ * Zalo does not restrict these formats (its `restricted_ext_file` denylist
370
+ * covers only executables: exe, cmd, bat, com, lnk, vbs, msi, …), so a user
371
+ * can legitimately hand `send-image` a .bmp. It simply arrives as a file
372
+ * attachment rather than an inline image.
373
+ */
374
+ const INLINE_IMAGE_EXTS = new Set(["jpg", "jpeg", "png", "webp", "gif"]);
375
+
376
+ /** True when every path is a format Zalo renders inline. */
377
+ function allInlineImages(paths) {
378
+ return paths.every((p) => INLINE_IMAGE_EXTS.has(p.split(".").pop().toLowerCase()));
379
+ }
380
+
381
+ /**
382
+ * Pull the {msgId, cliMsgId} pairs out of an attachment send response.
383
+ *
384
+ * `msg send` reports `result.cliMsgId` off `result.message`, but an
385
+ * attachment send usually has no `result.message` at all: for a single
386
+ * jpg/jpeg/png/webp zca-js folds the caption into the attachment and leaves
387
+ * `message` null. The ids live in `result.attachment` instead -- an array,
388
+ * one entry per file.
389
+ *
390
+ * Until this existed an attachment's cliMsgId was unreachable from the CLI,
391
+ * so `msg undo` could not recall an image or a file at all unless a listener
392
+ * happened to be running and cached Zalo's echo of it. That is how tier 4
393
+ * ended up unable to clean up 24 attachments it had sent itself.
394
+ *
395
+ * @param {object} result - sendMessage() response
396
+ * @returns {Array<{msgId: string, cliMsgId: string|null}>}
397
+ */
398
+ function sentAttachmentIds(result) {
399
+ const raw = result?.attachment;
400
+ const rows = Array.isArray(raw) ? raw : [raw];
401
+ return rows
402
+ .filter((r) => (r?.msgId ?? null) !== null)
403
+ .map((r) => ({
404
+ msgId: String(r.msgId),
405
+ cliMsgId: (r.cliMsgId ?? null) === null ? null : String(r.cliMsgId),
406
+ }));
407
+ }
408
+
409
+ /**
410
+ * Send attachments, bringing the WebSocket listener up first when any of
411
+ * them needs it.
412
+ *
413
+ * zca-js's uploadAttachment() resolves synchronously for inline images, but
414
+ * for "video" and "others" it registers an entry in ctx.uploadCallbacks and
415
+ * awaits a promise that ONLY apis/listen.js can settle, when the
416
+ * upload-complete control frame arrives. With no listener there is no
417
+ * timeout and no fallback — the await never settles and the command hangs
418
+ * with no output at all.
419
+ *
420
+ * Both `send-image` and `send-file` hit this, because the routing is by
421
+ * extension: `send-image photo.bmp` takes the same "others" path as
422
+ * `send-file doc.pdf`. So the listener decision is made from the actual
423
+ * paths, not from the command name.
424
+ *
425
+ * Opening that socket is only safe when nothing else holds one. A running
426
+ * `listen` or `mcp` daemon does, and Zalo answers a second session by killing
427
+ * the first, so this asks the daemon to do the upload when one is up and only
428
+ * opens its own session when none is. See src/core/daemon-channel.js.
429
+ *
430
+ * @param {object} api
431
+ * @param {string[]} absPaths
432
+ * @param {string} threadId
433
+ * @param {number} type
434
+ * @param {object} opts - {caption, uploadTimeout}
435
+ * @returns {Promise<{result?: object, error?: string, listenerStarted?: boolean, viaDaemon?: boolean}>}
436
+ */
437
+ async function sendAttachments(api, absPaths, threadId, type, opts) {
438
+ const needsListener = !allInlineImages(absPaths);
439
+ let listenerStarted = false;
440
+
441
+ // A running `listen`/`mcp` daemon already holds the account's one permitted
442
+ // socket. Opening a second one here makes Zalo evict the daemon (cmd 3000),
443
+ // which loses every message that arrives during its ~6s reconnect -- a real
444
+ // message was lost this way, and the gap it recorded has no working repair
445
+ // path. So hand the upload to the daemon when there is one.
446
+ if (needsListener) {
447
+ const acc = getActive();
448
+ if (acc) {
449
+ const viaDaemon = await sendViaDaemon(join(CONFIG_DIR, "accounts", acc.ownId), {
450
+ paths: absPaths,
451
+ threadId,
452
+ type,
453
+ caption: opts.caption,
454
+ timeoutMs: Number(opts.uploadTimeout),
455
+ });
456
+ // null means no daemon answered; fall through and open our own.
457
+ if (viaDaemon) {
458
+ return viaDaemon.ok
459
+ ? { result: viaDaemon.result, viaDaemon: true }
460
+ : { error: viaDaemon.error, viaDaemon: true };
461
+ }
462
+ }
463
+ }
464
+
465
+ if (needsListener) {
466
+ try {
467
+ await new Promise((res, rej) => {
468
+ const timer = setTimeout(() => rej(new Error("Listener connection timeout")), 15000);
469
+ api.listener.once("connected", () => {
470
+ clearTimeout(timer);
471
+ listenerStarted = true;
472
+ res();
473
+ });
474
+ api.listener.once("error", (err) => {
475
+ clearTimeout(timer);
476
+ rej(err);
477
+ });
478
+ api.listener.start({ retryOnClose: false });
479
+ });
480
+ } catch (e) {
481
+ return { error: `Could not open the upload channel: ${e.message}` };
482
+ }
483
+ }
484
+
485
+ try {
486
+ const result = await withTimeout(
487
+ api.sendMessage({ msg: opts.caption, attachments: absPaths }, threadId, type),
488
+ Number(opts.uploadTimeout),
489
+ "Upload timed out waiting for Zalo's upload-complete event",
490
+ );
491
+ return { result, listenerStarted };
492
+ } catch (e) {
493
+ return { error: e.message, listenerStarted };
494
+ } finally {
495
+ if (listenerStarted) {
496
+ try {
497
+ api.listener.stop();
498
+ } catch {
499
+ // Nothing useful to do — we're exiting anyway.
500
+ }
501
+ }
502
+ }
503
+ }
504
+
505
+ /**
506
+ * Reject with `message` if `promise` hasn't settled within `ms`.
507
+ *
508
+ * Used by the attachment path: zca-js's non-inline upload waits on a
509
+ * WebSocket event with no timeout of its own, so a dropped or missed
510
+ * upload-complete frame would otherwise hang the command indefinitely.
511
+ * Better to fail loudly than to look frozen.
512
+ *
513
+ * @param {Promise} promise
514
+ * @param {number} ms
515
+ * @param {string} message
516
+ */
517
+ function withTimeout(promise, ms, message) {
518
+ if (!Number.isFinite(ms) || ms <= 0) return promise;
519
+ let timer;
520
+ return Promise.race([
521
+ promise.finally(() => clearTimeout(timer)),
522
+ new Promise((_, reject) => {
523
+ timer = setTimeout(() => reject(new Error(message)), ms);
524
+ }),
525
+ ]);
526
+ }
527
+
77
528
  /**
78
529
  * Parse manual style specs: "start:len:style" → { start, len, st }
79
530
  * Style names: bold, italic, underline, strikethrough, red, orange, yellow, green, big, small
@@ -92,12 +543,32 @@ function parseStyleSpecs(specs) {
92
543
  export function registerMsgCommands(program) {
93
544
  const msg = program.command("msg").description("Send and manage messages");
94
545
 
546
+ // `me` (or the own uid) as a thread argument means My Documents, a 1-1
547
+ // thread of its own -- see src/utils/my-documents.js. Resolved once, here,
548
+ // for every msg subcommand that takes a threadId. Runs after the program's
549
+ // hook, so the session is already logged in.
550
+ msg.hook("preAction", (_msgCommand, actionCommand) => {
551
+ const out = applySelfThreadAlias(actionCommand, {
552
+ ownId: getOwnId(),
553
+ send2meId: () => getApi().getContext().loginInfo?.send2me_id,
554
+ });
555
+ if (out?.error) {
556
+ error(out.error);
557
+ process.exit(1);
558
+ }
559
+ if (out?.notice) info(out.notice);
560
+ });
561
+
95
562
  msg.command("send <threadId> <message>")
96
- .description("Send a text message with optional formatting")
563
+ .description("Send a text message with optional formatting. <threadId> may be `me` for My Documents")
97
564
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
98
565
  .option(
99
566
  "--mention <specs...>",
100
- "Mention users in group message. Format: pos:userId:len (e.g. 0:USER_ID:5). Use userId=-1 for @All.",
567
+ "Mention users by raw offset. Format: pos:userId:len (e.g. 0:USER_ID:5). Prefer writing @[userId] in the message — offsets are then computed for you. Use userId=-1 for @All.",
568
+ )
569
+ .option(
570
+ "--quote <msgId>",
571
+ "Send as a quote-reply to this message. Text messages only, and it must already be in the local cache. A running `listen`/`mcp` daemon is what puts messages there as they arrive; `msg history`/`sync` backfill older ones, but neither can seed a message you just sent.",
101
572
  )
102
573
  .option("--style <specs...>", "Text styles. Format: start:len:style (e.g. 0:5:bold 6:5:italic)")
103
574
  .option("--md", "Parse markdown-like formatting: **bold** *italic* __underline__ ~~strike~~ {red:text}")
@@ -105,13 +576,17 @@ export function registerMsgCommands(program) {
105
576
  "--react <icon>",
106
577
  "Auto-react to sent message. Codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
107
578
  )
579
+ .option(
580
+ "--urgency <level>",
581
+ "Mark the message the way the apps' Important/Urgent option does: important | urgent",
582
+ parseUrgency,
583
+ )
108
584
  .action(async (threadId, message, opts) => {
109
585
  try {
110
- // Parse mention specs: "pos:uid:len" → { pos, uid, len }
111
- const mentions = (opts.mention || []).map((spec) => {
112
- const [pos, uid, len] = spec.split(":");
113
- return { pos: Number(pos), uid, len: Number(len) };
114
- });
586
+ // One cache open serves both the @[uid] name lookups and the
587
+ // --quote rebuild. Absent cache is not fatal for either: names
588
+ // fall back to the uid, and --quote reports why it cannot.
589
+ const cached = openAccountDb();
115
590
 
116
591
  // Parse text styles
117
592
  let styles = [];
@@ -129,26 +604,139 @@ export function registerMsgCommands(program) {
129
604
  styles = styles.concat(parseStyleSpecs(opts.style));
130
605
  }
131
606
 
132
- // Build message content
133
- const hasExtras = mentions.length > 0 || styles.length > 0;
607
+ // Mentions expand last, on the post-markdown text: a `@[uid]`
608
+ // token contains no markdown metacharacters, whereas a display
609
+ // name may well contain `*` or `_` and would be eaten the other
610
+ // way round. Styles are then moved across the substitutions,
611
+ // since their offsets were counted before the names went in.
612
+ //
613
+ // Expanding is pure and cheap, so it runs twice: once off the
614
+ // cache to learn which uids it could not name, then again with
615
+ // whatever one batched lookup filled in.
616
+ const missing = new Set();
617
+ let expanded = expandMentions(finalMsg, (uid) => {
618
+ const name = mentionName(uid, cached);
619
+ if (!name && uid !== ALL_MENTION_UID) missing.add(uid);
620
+ return name;
621
+ });
622
+ if (missing.size > 0 && Number(opts.type) === 1) {
623
+ const fetched = await fetchMentionNames([...missing]);
624
+ if (fetched.size > 0) {
625
+ expanded = expandMentions(finalMsg, (uid) => fetched.get(uid) || mentionName(uid, cached));
626
+ }
627
+ }
628
+
629
+ finalMsg = expanded.text;
630
+ styles = shiftStyles(styles, expanded.edits);
631
+ const mentions = [...parseMentionSpecs(opts.mention), ...expanded.mentions];
632
+
633
+ // zca-js drops mentions outside a group, so a `-t 0` send would
634
+ // quietly arrive with the names as plain text and nobody tagged.
635
+ if (mentions.length > 0 && Number(opts.type) !== 1) {
636
+ warning("Mentions only apply to group messages — pass -t 1 to tag anyone.");
637
+ }
638
+
639
+ let quote;
640
+ if (opts.quote) {
641
+ const built = buildQuote(cached ? getMessageById(opts.quote) : null, {
642
+ msgId: opts.quote,
643
+ threadId,
644
+ });
645
+ if (built.error) {
646
+ error(built.error);
647
+ return;
648
+ }
649
+ if (built.warning) warning(built.warning);
650
+ quote = built.quote;
651
+ // A sync-restored row's sender is a noised id that Zalo
652
+ // rejects outright (code 114), so resolve it rather than
653
+ // send something that cannot land.
654
+ if (built.opaqueSender) {
655
+ const fixed = await resolveQuoteSender(quote, getApi());
656
+ if (fixed.error) {
657
+ error(fixed.error);
658
+ return;
659
+ }
660
+ if (fixed.resolved) info(`Resolved the quoted message's sender: ${fixed.resolved}`);
661
+ }
662
+ }
663
+
664
+ // Build message content. `urgency` is 1 (important) or 2
665
+ // (urgent); zca-js turns it into the `metaData: {urgency}`
666
+ // object Zalo Web sends, on every text endpoint.
667
+ const urgency = opts.urgency;
668
+ const hasExtras = mentions.length > 0 || styles.length > 0 || Boolean(quote) || Boolean(urgency);
134
669
  const msgContent = hasExtras
135
- ? { msg: finalMsg, ...(mentions.length > 0 && { mentions }), ...(styles.length > 0 && { styles }) }
670
+ ? {
671
+ msg: finalMsg,
672
+ ...(mentions.length > 0 && { mentions }),
673
+ ...(styles.length > 0 && { styles }),
674
+ ...(quote && { quote }),
675
+ ...(urgency && { urgency }),
676
+ }
136
677
  : finalMsg;
137
678
 
138
- const cliMsgId = String(Date.now());
139
679
  const result = await getApi().sendMessage(msgContent, threadId, Number(opts.type));
140
- result.cliMsgId = cliMsgId;
680
+
681
+ // The cliMsgId comes back from zca-js, which hands over the
682
+ // clientId it actually put on the wire (patches/zca-js+2.2.0.patch
683
+ // — upstream stamps `params.clientId = Date.now()` inside
684
+ // handleMessage() and returns only {msgId}).
685
+ //
686
+ // This used to be a second `Date.now()` read here, taken before
687
+ // the call. That is a different number from the one zca-js sent,
688
+ // by however long the AES encrypt and the POST took — usually
689
+ // 0-2ms, never guaranteed equal. So every id `send --json`
690
+ // printed was a near-miss, and all three things that key on it
691
+ // (`msg react`, `msg undo`, and `--quote`, which rebuilds the
692
+ // payload from a cached row's cliMsgId) failed silently on it.
693
+ //
694
+ // Report only an id Zalo really holds. When there is none, say
695
+ // so — a fabricated one is worse than an absent one.
696
+ const cliMsgId = result.message?.cliMsgId ? String(result.message.cliMsgId) : null;
697
+ if (cliMsgId) result.cliMsgId = cliMsgId;
141
698
  output(result, program.opts().json, () => success("Message sent"));
142
699
 
700
+ if (result.message && !cliMsgId) {
701
+ warning(
702
+ "Zalo returned no cliMsgId for this send, so none is reported — the zca-js patch " +
703
+ "is missing (run `npx patch-package`). `msg react`/`msg undo`/`msg send --quote` " +
704
+ "need one; the local cache gets the real value once `listen` or `sync` sees " +
705
+ "Zalo echo the message back.",
706
+ );
707
+ }
708
+
143
709
  // Auto-react if --react flag provided
144
710
  if (opts.react && result.message?.msgId) {
145
- const dest = {
146
- data: { msgId: String(result.message.msgId), cliMsgId },
147
- threadId,
148
- type: Number(opts.type),
149
- };
150
- await getApi().addReaction(opts.react, dest);
151
- success(`Auto-reacted with '${opts.react}'`);
711
+ // addReaction needs the message's real cliMsgId — with the
712
+ // msgId in its place Zalo accepts the call and the
713
+ // reaction never shows up. It used to fall back to exactly
714
+ // that on an install whose zca-js patch had not applied;
715
+ // now the reaction is skipped and the way to add it later
716
+ // is named. The message itself has already gone out.
717
+ //
718
+ // Exit status stays 0: the send succeeded, and a caller
719
+ // that read a failure here would send the message twice.
720
+ const sentMsgId = String(result.message.msgId);
721
+ const target = reactionCliMsgId(
722
+ { msgId: sentMsgId, threadId, cliMsgId },
723
+ { lookup: cachedInAccount },
724
+ );
725
+ if (target.error) {
726
+ warning(
727
+ `--react skipped: Zalo returned no cliMsgId for this send, and a reaction keyed on ` +
728
+ `the msgId is accepted but never shown. Once \`listen\` has cached the message, ` +
729
+ `run: msg react ${sentMsgId} ${threadId} <icon> (or pass -c <cliMsgId>).`,
730
+ );
731
+ } else {
732
+ const dest = {
733
+ data: { msgId: sentMsgId, cliMsgId: target.cliMsgId },
734
+ threadId,
735
+ type: Number(opts.type),
736
+ };
737
+ await getApi().addReaction(opts.react, dest);
738
+ success(`Auto-reacted with '${opts.react}'`);
739
+ }
152
740
  }
153
741
  } catch (e) {
154
742
  error(e.message);
@@ -156,39 +744,84 @@ export function registerMsgCommands(program) {
156
744
  });
157
745
 
158
746
  msg.command("send-image <threadId> <paths...>")
159
- .description("Send one or more images")
747
+ .description("Send one or more images (jpg/jpeg/png/webp/gif render inline; other formats arrive as files)")
160
748
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
161
749
  .option("-m, --caption <text>", "Caption text", "")
750
+ .option("--upload-timeout <ms>", "Max wait for the upload-complete event", "120000")
162
751
  .action(async (threadId, paths, opts) => {
163
- try {
164
- const absPaths = paths.map((p) => resolve(p));
165
- const result = await getApi().sendMessage(
166
- { msg: opts.caption, attachments: absPaths },
167
- threadId,
168
- Number(opts.type),
752
+ const absPaths = paths.map((p) => resolve(p));
753
+
754
+ // A format Zalo does not render inline (bmp, tiff, heic, …) is
755
+ // still uploaded — Zalo only denylists executables — but it
756
+ // arrives as a file attachment. Say so rather than letting the
757
+ // command name quietly mislead.
758
+ const offbeat = absPaths.filter((p) => !INLINE_IMAGE_EXTS.has(p.split(".").pop().toLowerCase()));
759
+ if (offbeat.length && !program.opts().json) {
760
+ warning(
761
+ `Not an inline image format: ${offbeat.map((p) => p.split(/[\\/]/).pop()).join(", ")} — ` +
762
+ `will arrive as a file attachment. Convert to PNG/JPEG for an inline image.`,
169
763
  );
170
- output(result, program.opts().json, () => success(`Image(s) sent to ${threadId}`));
171
- } catch (e) {
172
- error(e.message);
173
764
  }
765
+
766
+ const {
767
+ result,
768
+ error: err,
769
+ listenerStarted,
770
+ viaDaemon,
771
+ } = await sendAttachments(getApi(), absPaths, threadId, Number(opts.type), opts);
772
+ if (err) error(err);
773
+ // Surface which socket carried this. sendAttachments() has always
774
+ // returned viaDaemon, and every caller dropped it on the floor —
775
+ // so the one branch whose entire reason for existing is that a
776
+ // second socket evicts the running daemon with cmd 3000 was
777
+ // invisible from the outside, and untestable.
778
+ else
779
+ output(
780
+ { ...result, sent: sentAttachmentIds(result), viaDaemon: Boolean(viaDaemon) },
781
+ program.opts().json,
782
+ () => success(`Image(s) sent to ${threadId}${viaDaemon ? " (via the running daemon)" : ""}`),
783
+ );
784
+
785
+ // Only force-exit when the listener ran; it leaves handles behind
786
+ // that keep the event loop alive. The pure-inline path needs no
787
+ // such thing, so leave its exit behavior untouched.
788
+ if (listenerStarted) process.exit(err ? 1 : 0);
789
+ else if (err) process.exitCode = 1;
174
790
  });
175
791
 
176
792
  msg.command("send-file <threadId> <paths...>")
177
793
  .description("Send files (docx, pdf, zip, etc.)")
178
794
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
179
795
  .option("-m, --caption <text>", "Caption text", "")
796
+ .option("--upload-timeout <ms>", "Max wait for the upload-complete event", "120000")
180
797
  .action(async (threadId, paths, opts) => {
181
- try {
182
- const absPaths = paths.map((p) => resolve(p));
183
- const result = await getApi().sendMessage(
184
- { msg: opts.caption, attachments: absPaths },
185
- threadId,
186
- Number(opts.type),
798
+ // Shares sendAttachments() with `send-image`. It used to carry its
799
+ // own copy of the bring-the-listener-up dance, which meant the
800
+ // hand-off to a running daemon only ever applied to send-image --
801
+ // and send-file is the command that needs it most, since every
802
+ // non-inline attachment takes the socket path.
803
+ const absPaths = paths.map((p) => resolve(p));
804
+ const {
805
+ result,
806
+ error: err,
807
+ listenerStarted,
808
+ viaDaemon,
809
+ } = await sendAttachments(getApi(), absPaths, threadId, Number(opts.type), opts);
810
+ if (err) error(err);
811
+ else
812
+ output(
813
+ { ...result, sent: sentAttachmentIds(result), viaDaemon: Boolean(viaDaemon) },
814
+ program.opts().json,
815
+ () => success(`File(s) sent to ${threadId}${viaDaemon ? " (via the running daemon)" : ""}`),
187
816
  );
188
- output(result, program.opts().json, () => success(`File(s) sent to ${threadId}`));
189
- } catch (e) {
190
- error(e.message);
191
- }
817
+
818
+ // listener.stop() closes the socket but does not release every
819
+ // handle it registered, so the event loop stays alive and the
820
+ // command would sit there, done but not exited. `msg history`
821
+ // resolves the same problem the same way. Nothing to force when
822
+ // the daemon did the upload -- this process never opened a socket.
823
+ if (listenerStarted) process.exit(err ? 1 : 0);
824
+ else if (err) process.exitCode = 1;
192
825
  });
193
826
 
194
827
  msg.command("send-card <threadId> <userId>")
@@ -243,7 +876,7 @@ export function registerMsgCommands(program) {
243
876
  msg.command("send-qr-transfer <threadId> <accountNumber>")
244
877
  .description("Generate VietQR and send as image")
245
878
  .requiredOption("-b, --bank <name>", "Bank name or BIN code")
246
- .option("-a, --amount <n>", "Transfer amount in VND", parseInt)
879
+ .option("-a, --amount <n>", "Transfer amount in VND", parseIntOption)
247
880
  .option("-m, --content <text>", "Transfer content (max 50 chars)")
248
881
  .option("--template <tpl>", "QR style: compact, print, qronly", "compact")
249
882
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
@@ -329,7 +962,7 @@ export function registerMsgCommands(program) {
329
962
  msg.command("send-voice <threadId> <voiceUrl>")
330
963
  .description("Send a voice message from URL")
331
964
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
332
- .option("--ttl <ms>", "Time to live in milliseconds", parseInt, 0)
965
+ .option("--ttl <ms>", "Time to live in milliseconds", parseIntOption, 0)
333
966
  .action(async (threadId, voiceUrl, opts) => {
334
967
  try {
335
968
  info(`Sending voice: ${voiceUrl}`);
@@ -359,9 +992,9 @@ export function registerMsgCommands(program) {
359
992
  .requiredOption("--thumb <url>", "Thumbnail image URL")
360
993
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
361
994
  .option("-m, --caption <text>", "Caption text", "")
362
- .option("-d, --duration <ms>", "Video duration in milliseconds", parseInt)
363
- .option("-W, --width <px>", "Video width", parseInt, 1280)
364
- .option("-H, --height <px>", "Video height", parseInt, 720)
995
+ .option("-d, --duration <ms>", "Video duration in milliseconds", parseIntOption)
996
+ .option("-W, --width <px>", "Video width", parseIntOption, 1280)
997
+ .option("-H, --height <px>", "Video height", parseIntOption, 720)
365
998
  .action(async (threadId, videoUrl, opts) => {
366
999
  try {
367
1000
  info(`Sending video: ${videoUrl}`);
@@ -426,12 +1059,26 @@ export function registerMsgCommands(program) {
426
1059
  "React to a message. Reaction codes: :> (haha), /-heart (heart), /-strong (like), :o (wow), :-(( (cry), :-h (angry)",
427
1060
  )
428
1061
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
429
- .option("-c, --cli-msg-id <id>", "Client message ID (required for reaction to appear, get from listen --json)")
1062
+ .option(
1063
+ "-c, --cli-msg-id <id>",
1064
+ "Message's cliMsgId. Looked up in the local cache when omitted; the reaction is refused when neither has it",
1065
+ )
430
1066
  .action(async (msgId, threadId, reaction, opts) => {
431
1067
  try {
432
- // zca-js addReaction(icon, dest) — dest needs msgId + cliMsgId
1068
+ // zca-js addReaction(icon, dest) — dest needs msgId + cliMsgId.
1069
+ // The cliMsgId used to fall back to the msgId, which Zalo
1070
+ // accepts and never displays. Resolved before getApi(), so an
1071
+ // uncached message is refused without touching the network.
1072
+ const target = reactionCliMsgId(
1073
+ { msgId, threadId, cliMsgId: opts.cliMsgId },
1074
+ { lookup: cachedInAccount },
1075
+ );
1076
+ if (target.error) {
1077
+ refuse(target.error);
1078
+ return;
1079
+ }
433
1080
  const dest = {
434
- data: { msgId, cliMsgId: opts.cliMsgId || msgId },
1081
+ data: { msgId, cliMsgId: target.cliMsgId },
435
1082
  threadId,
436
1083
  type: Number(opts.type),
437
1084
  };
@@ -443,12 +1090,59 @@ export function registerMsgCommands(program) {
443
1090
  });
444
1091
 
445
1092
  msg.command("delete <msgId> <threadId>")
446
- .description("Delete a message you sent")
1093
+ .description("Delete a message from your own view only (use `msg undo` to recall it for everyone)")
447
1094
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
1095
+ .option("-c, --cli-msg-id <id>", "Message's cliMsgId. Looked up in the local cache when omitted")
1096
+ .option("--uid-from <id>", "Message sender's id (defaults to your own id)")
1097
+ .option(
1098
+ "--everyone",
1099
+ "Delete for everyone instead of just you. Only valid for SOMEONE ELSE'S message in a group — " +
1100
+ "Zalo rejects it for your own messages (use `msg undo`) and in private chats",
1101
+ )
448
1102
  .action(async (msgId, threadId, opts) => {
449
1103
  try {
450
- const result = await getApi().deleteMessage(msgId, threadId, Number(opts.type));
451
- output(result, program.opts().json, () => success("Message deleted"));
1104
+ const type = Number(opts.type);
1105
+
1106
+ // zca-js takes deleteMessage(dest, onlyMe) where dest is
1107
+ // {data: {cliMsgId, msgId, uidFrom}, threadId, type} — NOT
1108
+ // (msgId, threadId, type), which is what this used to pass.
1109
+ // That shape put a bare string where `dest` belongs, so every
1110
+ // invocation died on "Cannot read properties of undefined
1111
+ // (reading 'uidFrom')" before reaching the network.
1112
+ //
1113
+ // cliMsgId is not derivable from msgId, exactly as for `undo`:
1114
+ // it is a client-generated id that only the sender ever saw.
1115
+ // Look in the local cache first, then insist the caller
1116
+ // supplies it rather than guessing.
1117
+ let cliMsgId = opts.cliMsgId;
1118
+ let uidFrom = opts.uidFrom;
1119
+
1120
+ if (!cliMsgId || !uidFrom) {
1121
+ const cached = cachedInAccount(threadId, msgId);
1122
+ cliMsgId = cliMsgId || cached?.cliMsgId;
1123
+ uidFrom = uidFrom || cached?.uidFrom;
1124
+ }
1125
+ uidFrom = uidFrom || getOwnId();
1126
+
1127
+ if (!cliMsgId) {
1128
+ error(
1129
+ "cliMsgId is required to delete a message and is not in the local cache. " +
1130
+ "Pass --cli-msg-id (from `listen --json`).",
1131
+ );
1132
+ return;
1133
+ }
1134
+
1135
+ const result = await getApi().deleteMessage(
1136
+ {
1137
+ data: { cliMsgId: String(cliMsgId), msgId: String(msgId), uidFrom: String(uidFrom) },
1138
+ threadId,
1139
+ type,
1140
+ },
1141
+ Boolean(opts.everyone) === false,
1142
+ );
1143
+ output(result, program.opts().json, () =>
1144
+ success(opts.everyone ? "Message deleted for everyone" : "Message deleted from your view"),
1145
+ );
452
1146
  } catch (e) {
453
1147
  error(e.message);
454
1148
  }
@@ -457,14 +1151,33 @@ export function registerMsgCommands(program) {
457
1151
  msg.command("undo <msgId> <threadId>")
458
1152
  .description("Recall/undo a message for both sides (like Zalo app recall). Requires cliMsgId.")
459
1153
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
460
- .option("-c, --cli-msg-id <id>", "Client message ID (required, get from listen --json or send --json)")
1154
+ .option("-c, --cli-msg-id <id>", "Message's cliMsgId. Looked up in the local cache when omitted")
461
1155
  .action(async (msgId, threadId, opts) => {
462
1156
  try {
463
- if (!opts.cliMsgId) {
464
- error("cliMsgId is required for undo. Get it from: listen --json or send --json output.");
1157
+ // Same lookup `msg delete` does. cliMsgId is client-generated
1158
+ // and not derivable from msgId, but anything `listen`, `mcp` or
1159
+ // a sync captured has it -- so asking the caller for it was
1160
+ // only ever necessary for a message this machine never saw.
1161
+ //
1162
+ // `send --json` is a valid source again. It used to print a
1163
+ // second Date.now() of its own -- zca-js stamps the real
1164
+ // clientId inside handleMessage() and upstream returns only
1165
+ // {msgId} -- so the id it gave matched only by luck. The zca-js
1166
+ // patch now hands that clientId back, and `msg send` reports
1167
+ // that value or none at all.
1168
+ //
1169
+ // The resolution is shared with `zalo_undo`
1170
+ // (src/core/cached-message.js). The refusal exits 0 here, as
1171
+ // it always has.
1172
+ const target = recallCliMsgId(
1173
+ { msgId, threadId, cliMsgId: opts.cliMsgId },
1174
+ { lookup: cachedInAccount },
1175
+ );
1176
+ if (target.error) {
1177
+ error(target.error);
465
1178
  return;
466
1179
  }
467
- const payload = { msgId, cliMsgId: opts.cliMsgId };
1180
+ const payload = { msgId, cliMsgId: target.cliMsgId };
468
1181
  const result = await getApi().undo(payload, threadId, Number(opts.type));
469
1182
  output(result, program.opts().json, () => success("Message recalled (undone)"));
470
1183
  } catch (e) {
@@ -473,129 +1186,555 @@ export function registerMsgCommands(program) {
473
1186
  });
474
1187
 
475
1188
  msg.command("forward <msgId> <threadId>")
476
- .description("Forward a message to another thread")
1189
+ .description(
1190
+ "Forward a cached message to another conversation. Text goes out as a real forward, badged the way " +
1191
+ "the apps badge it; other kinds are re-sent as a message of their own type",
1192
+ )
477
1193
  .option("-t, --type <n>", "Thread type: 0=User, 1=Group", "0")
478
1194
  .action(async (msgId, threadId, opts) => {
1195
+ // This command could never have worked. zca-js takes
1196
+ // `forwardMessage(payload, threadIds, type)` where payload is
1197
+ // `{ message: string }` and threadIds is an ARRAY; the old call
1198
+ // passed the msgId string as the payload and a bare string as the
1199
+ // thread list. `if (!payload.message) throw` fires on the first
1200
+ // line of the API, so every invocation died with "Missing message
1201
+ // content" before touching the network -- identically for -t 0 and
1202
+ // -t 1, for every message type. The zca-api-surface test did not
1203
+ // catch it because the method does exist; only its arity was wrong.
1204
+ const jsonMode = program.opts().json;
1205
+ const activeAcc = getActive();
1206
+ if (!activeAcc) {
1207
+ error("No active account. Please login first.");
1208
+ process.exit(1);
1209
+ }
1210
+
1211
+ let row;
479
1212
  try {
480
- const result = await getApi().forwardMessage(msgId, threadId, Number(opts.type));
481
- output(result, program.opts().json, () => success("Message forwarded"));
1213
+ initDb(join(CONFIG_DIR, "accounts", activeAcc.ownId, "zalo.db"));
1214
+ row = getMessageById(msgId);
1215
+ } catch (e) {
1216
+ error(
1217
+ `Local cache unavailable (${e.message}). Run \`zalo-agent listen\` or \`zalo-agent sync\` first.`,
1218
+ );
1219
+ process.exit(1);
1220
+ }
1221
+ if (!row) {
1222
+ error(`Message ${msgId} is not in the local cache.`);
1223
+ info("Fetch the conversation first: zalo-agent msg history <threadId> -t <0|1>");
1224
+ process.exit(1);
1225
+ }
1226
+
1227
+ // "Forward" is not one operation in Zalo. Only TEXT rides the
1228
+ // mforward API and gets the "forwarded" badge. Everything else the
1229
+ // app re-sends as a fresh message of its own kind -- measured
1230
+ // 2026-09-28 by forwarding a contact card by hand: the copy that
1231
+ // arrived carried no `reference` and no `fwLvl` at all, where a
1232
+ // forwarded text carries both. So dispatch on the row's classified
1233
+ // type and reproduce what the app does.
1234
+ //
1235
+ // Guard on `type`, never on `typeof text === "string"`: a synced
1236
+ // photo/file/sticker stores a human placeholder ("[Hình ảnh]",
1237
+ // "[File] x.pdf") in the text column, and a type-of check would
1238
+ // forward that placeholder and call it a forwarded photo.
1239
+ const api = getApi();
1240
+ const threadType = Number(opts.type);
1241
+ let raw = {};
1242
+ try {
1243
+ raw = JSON.parse(row.raw_data || "{}");
1244
+ } catch {
1245
+ /* a row with unreadable raw_data can still forward as text */
1246
+ }
1247
+ const c = raw.content && typeof raw.content === "object" ? raw.content : null;
1248
+
1249
+ /**
1250
+ * Re-send a downloaded file as its own attachment.
1251
+ *
1252
+ * Goes through sendAttachments, not api.sendMessage: a non-inline
1253
+ * upload needs a socket to settle its upload-complete frame, and a
1254
+ * running daemon holds the account's only one. Calling sendMessage
1255
+ * directly parks the send in ctx.uploadCallbacks with nothing left
1256
+ * to settle it -- measured, a file forward simply hung for four
1257
+ * minutes and returned nothing at all. sendAttachments hands the
1258
+ * upload to the daemon and falls back to its own socket when none
1259
+ * is running.
1260
+ */
1261
+ const resendLocal = async () => {
1262
+ if (!row.localPath || !existsSync(row.localPath)) {
1263
+ error(`Message ${msgId} is "${row.type}" but its media is not downloaded locally.`);
1264
+ info("Fetch it first: zalo-agent sync-media -T <threadId>");
1265
+ process.exit(1);
1266
+ }
1267
+ const out = await sendAttachments(api, [resolve(row.localPath)], threadId, threadType, {
1268
+ caption: "",
1269
+ uploadTimeout: 120000,
1270
+ });
1271
+ if (out.error) throw new Error(out.error);
1272
+ return out.result;
1273
+ };
1274
+
1275
+ const forwarders = {
1276
+ // action "recommened.user" carries the shared person's uid in
1277
+ // `params`; sendCard reproduces the card exactly as the app does.
1278
+ card: async () => api.sendCard({ userId: String(c?.params ?? "").trim() }, threadId, threadType),
1279
+ sticker: async () =>
1280
+ api.sendSticker({ id: c?.id, cateId: c?.catId, type: c?.type ?? 3 }, threadId, threadType),
1281
+ link: async () => api.sendLink({ link: c?.href }, threadId, threadType),
1282
+ // sendVideo wants the geometry too; Zalo rejects the call with
1283
+ // code 114 when duration/width/height are missing. They live in
1284
+ // the payload's `params` blob, not as top-level fields.
1285
+ video: async () => {
1286
+ let p = {};
1287
+ try {
1288
+ p = typeof c?.params === "string" ? JSON.parse(c.params) : (c?.params ?? {});
1289
+ } catch {
1290
+ /* geometry falls back to the defaults below */
1291
+ }
1292
+ return api.sendVideo(
1293
+ {
1294
+ videoUrl: c?.href,
1295
+ thumbnailUrl: c?.thumb || "",
1296
+ duration: Number(p.duration) || 0,
1297
+ width: Number(p.video_width || p.video_original_width) || 1280,
1298
+ height: Number(p.video_height || p.video_original_height) || 720,
1299
+ },
1300
+ threadId,
1301
+ threadType,
1302
+ );
1303
+ },
1304
+ voice: async () => api.sendVoice({ voiceUrl: c?.href }, threadId, threadType),
1305
+ photo: resendLocal,
1306
+ file: resendLocal,
1307
+ gif: resendLocal,
1308
+ doodle: resendLocal,
1309
+ };
1310
+
1311
+ // A shared contact arrives as a link whose action says otherwise.
1312
+ const kind = c?.action === "recommened.user" ? "card" : row.type;
1313
+
1314
+ if (kind !== "text") {
1315
+ const send = forwarders[kind];
1316
+ if (!send) {
1317
+ error(`Cannot forward a "${row.type}" message — no send path reproduces it.`);
1318
+ info("Text uses the forward API; other kinds are re-sent as a new message of their own type.");
1319
+ process.exit(1);
1320
+ }
1321
+ try {
1322
+ const res = await send();
1323
+ output(res, jsonMode, () => success(`Forwarded ${kind} to ${threadId}`));
1324
+ } catch (e) {
1325
+ error(`Forward failed (${kind}): ${e.message}`);
1326
+ process.exit(1);
1327
+ }
1328
+ return;
1329
+ }
1330
+ const text = cachedText(row);
1331
+ if (!text) {
1332
+ error(`Message ${msgId} has no text to forward.`);
1333
+ process.exit(1);
1334
+ }
1335
+
1336
+ // A forward is the text plus a `reference` naming the source
1337
+ // message. Without it the copy arrives as plain text with no
1338
+ // "forwarded" badge, which is all this command used to send. The
1339
+ // reference id is md5(cliMsgId + senderUid + conversationKey),
1340
+ // derived the way Zalo Web derives it -- src/core/forward.js has
1341
+ // the derivation and the capture it reproduces. Refuse rather than
1342
+ // send a reference built from a guess.
1343
+ const source = await forwardSource(api, row);
1344
+ if (source.error) {
1345
+ error(`Cannot forward message ${msgId}: ${source.error}.`);
1346
+ info("To send the words without the forward, use: zalo-agent msg send <threadId> <text>");
1347
+ process.exit(1);
1348
+ }
1349
+
1350
+ try {
1351
+ const { reference, decorLog } = buildForwardReference(source);
1352
+ const result = await sendForward(
1353
+ api,
1354
+ { message: text, reference, decorLog },
1355
+ [threadId],
1356
+ Number(opts.type),
1357
+ );
1358
+
1359
+ // Zalo answers {success: [...], failed: [...]}. This read
1360
+ // `result.fail`, which is never a key on that response, so
1361
+ // the count was always 0 and a rejected target was reported
1362
+ // as a success. Accept both spellings rather than betting on
1363
+ // one.
1364
+ const rejected = result?.failed ?? result?.fail ?? [];
1365
+ if (rejected.length > 0) {
1366
+ error(`Forward rejected for ${rejected.length} target(s): ${JSON.stringify(rejected)}`);
1367
+ process.exit(1);
1368
+ }
1369
+
1370
+ // Pair each target's msgId with the cliMsgId, the same
1371
+ // `sent` shape send-image and send-file report. The forward
1372
+ // call mints ONE clientId for the whole call; Zalo echoes it
1373
+ // per target as `clientId`, and sendForward reports it at the
1374
+ // top level as `cliMsgId` (as patches/zca-js+2.2.0.patch does
1375
+ // for zca-js's forwardMessage) -- neither spot alone gives a
1376
+ // caller the {msgId, cliMsgId} pair that `msg undo` needs.
1377
+ // Tier 4 hit exactly that: it recorded the forwarded msgId
1378
+ // with a null id and could not recall the message.
1379
+ const shared = (result?.cliMsgId ?? null) === null ? null : String(result.cliMsgId);
1380
+ const sent = (Array.isArray(result?.success) ? result.success : [])
1381
+ .filter((x) => (x?.msgId ?? null) !== null)
1382
+ .map((x) => ({
1383
+ msgId: String(x.msgId),
1384
+ cliMsgId: (x.clientId ?? shared ?? null) === null ? null : String(x.clientId ?? shared),
1385
+ }));
1386
+
1387
+ output({ ...result, sent }, jsonMode, () => success(`Forwarded to ${threadId}`));
482
1388
  } catch (e) {
483
1389
  error(e.message);
484
1390
  }
485
1391
  });
486
1392
 
1393
+ msg.command("pin <msgId> [threadId]")
1394
+ .description(
1395
+ "Pin a text message to the top of its conversation, as the apps do. The message must be in the local " +
1396
+ "cache; [threadId] defaults to the one it was cached under",
1397
+ )
1398
+ .option("-t, --type <n>", "Thread type: 0=User, 1=Group (default: the cached conversation's kind)", "0")
1399
+ .action(async (msgId, threadId, opts, cmd) => {
1400
+ try {
1401
+ // Everything the pin carries -- cliMsgId, sender, text -- comes
1402
+ // from the cached row, so every refusal below happens before
1403
+ // any request.
1404
+ const row = openAccountDb() ? getMessageById(msgId) : null;
1405
+ if (!row) {
1406
+ refuse(
1407
+ `Message ${msgId} is not in the local cache, so it cannot be pinned: a pin carries the ` +
1408
+ `message's cliMsgId, sender and text. \`listen\` caches messages as they arrive and ` +
1409
+ `\`sync\` restores older ones.`,
1410
+ );
1411
+ return;
1412
+ }
1413
+ if (threadId && row.threadId && String(row.threadId) !== String(threadId)) {
1414
+ refuse(`Message ${msgId} belongs to thread ${row.threadId}, not ${threadId}.`);
1415
+ return;
1416
+ }
1417
+ if (row.type !== "text") {
1418
+ refuse(
1419
+ `Only text messages can be pinned from the CLI; message ${msgId} is a ` +
1420
+ `${row.type || "message of unknown kind"}. Pin it from the app.`,
1421
+ );
1422
+ return;
1423
+ }
1424
+ const cliMsgId = cachedCliMsgId(row);
1425
+ if (!cliMsgId) {
1426
+ refuse(`Message ${msgId}'s cliMsgId was never cached, and a pin must name it.`);
1427
+ return;
1428
+ }
1429
+ const conversation = String(threadId || row.threadId);
1430
+ const isGroup = threadIsGroup(conversation, opts, cmd);
1431
+
1432
+ const api = getApi();
1433
+ const sender = await resolveSenderUid(api, row.senderId, getOwnId());
1434
+ if (sender.error) {
1435
+ refuse(`Cannot pin message ${msgId}: ${sender.error}.`);
1436
+ return;
1437
+ }
1438
+ const params = textPinParams({
1439
+ cliMsgId,
1440
+ msgId,
1441
+ senderUid: sender.uid,
1442
+ senderName: row.senderName,
1443
+ text: cachedText(row),
1444
+ });
1445
+ const result = await pinMessage(api, { threadId: conversation, isGroup, params });
1446
+ output(result, program.opts().json, () => success(`Pinned message ${msgId} in ${conversation}`));
1447
+ } catch (e) {
1448
+ refuse(`Pin failed: ${describeZaloError(e)}`);
1449
+ }
1450
+ });
1451
+
1452
+ msg.command("unpin <msgId> [threadId]")
1453
+ .description(
1454
+ "Unpin a message. [threadId] defaults to the conversation the message is cached under, and is " +
1455
+ "required when it is not cached",
1456
+ )
1457
+ .option("-t, --type <n>", "Thread type: 0=User, 1=Group (default: the cached conversation's kind)", "0")
1458
+ .action(async (msgId, threadId, opts, cmd) => {
1459
+ try {
1460
+ // Unpinning takes the pin's topic id, which comes from the
1461
+ // conversation's live pin list -- so only the conversation has
1462
+ // to be known, not the message.
1463
+ const row = openAccountDb() ? getMessageById(msgId) : null;
1464
+ if (threadId && row?.threadId && String(row.threadId) !== String(threadId)) {
1465
+ refuse(`Message ${msgId} belongs to thread ${row.threadId}, not ${threadId}.`);
1466
+ return;
1467
+ }
1468
+ const conversation = threadId || row?.threadId;
1469
+ if (!conversation) {
1470
+ refuse(
1471
+ `Message ${msgId} is not in the local cache, so its thread is unknown. ` +
1472
+ `Name it: zalo-agent msg unpin ${msgId} <threadId> -t <0|1>`,
1473
+ );
1474
+ return;
1475
+ }
1476
+ const isGroup = threadIsGroup(String(conversation), opts, cmd);
1477
+ const result = await unpinMessage(getApi(), { threadId: String(conversation), isGroup, msgId });
1478
+ if (result.notPinned) {
1479
+ refuse(`Message ${msgId} is not pinned in ${conversation}.`);
1480
+ return;
1481
+ }
1482
+ output(result, program.opts().json, () => success(`Unpinned message ${msgId} in ${conversation}`));
1483
+ } catch (e) {
1484
+ refuse(`Unpin failed: ${describeZaloError(e)}`);
1485
+ }
1486
+ });
1487
+
487
1488
  msg.command("history <threadId>")
488
- .description("Fetch message history from a DM or group conversation via WebSocket")
1489
+ .description("Fetch message history. Groups try REST API then fallback to WebSocket. DMs use WebSocket.")
489
1490
  .option("-t, --type <n>", "Thread type: 0=User(DM), 1=Group", "0")
490
- .option("-n, --limit <n>", "Max messages to fetch (fetches in pages until limit)", "50")
1491
+ .option("-n, --limit <n>", "Max most-recent messages to fetch", "50")
1492
+ .option("--scan <n>", "Max raw global messages to scan (WebSocket only)", "2000")
1493
+ .option("--from-msg-id <id>", "Anchor message ID to scan older messages from")
491
1494
  .option("--timeout <ms>", "Timeout in milliseconds waiting for response", "15000")
1495
+ .option("--no-cache", "Force live fetch instead of using local cache, and amend db")
492
1496
  .action(async (threadId, opts) => {
493
1497
  const jsonMode = program.opts().json;
494
1498
  const threadType = Number(opts.type);
495
1499
  const limit = Number(opts.limit);
496
1500
  const timeout = Number(opts.timeout);
1501
+ const scanLimit = Number(opts.scan);
1502
+
1503
+ // Order matters: getApi() throws when there is no session, and
1504
+ // this line sits outside any try/catch. Calling it ABOVE the
1505
+ // guard made the friendly message unreachable — a logged-out
1506
+ // user got a raw Node stack trace instead. `conv recent` gets
1507
+ // this order right; keep them consistent.
1508
+ const activeAcc = getActive();
1509
+ if (!activeAcc) {
1510
+ error("No active account. Please login first.");
1511
+ process.exit(1);
1512
+ }
1513
+
1514
+ let api;
1515
+ try {
1516
+ api = getApi();
1517
+ } catch (e) {
1518
+ error(e.message);
1519
+ process.exit(1);
1520
+ }
1521
+
1522
+ if (!jsonMode) {
1523
+ info(
1524
+ "Note: To maintain a complete local cache without missing gaps, ensure the 'zalo-cli listen' daemon is running continuously on this device.",
1525
+ );
1526
+ }
1527
+
1528
+ let localMsgs = [];
1529
+ let dbActive = false;
1530
+
1531
+ try {
1532
+ const accountDir = join(CONFIG_DIR, "accounts", activeAcc.ownId);
1533
+ initDb(join(accountDir, "zalo.db"));
1534
+ dbActive = true;
1535
+
1536
+ if (opts.cache !== false) {
1537
+ localMsgs = getMessages(threadId, limit);
1538
+ if (localMsgs && localMsgs.length >= limit) {
1539
+ if (!jsonMode) info(`Found ${localMsgs.length} messages in local cache.`);
1540
+ // Fetch through the shared downloader, which writes to
1541
+ // accounts/<ownId>/media/<threadName>/ and records the
1542
+ // path itself. The old per-command downloader used a
1543
+ // different flat layout and its extension logic keyed off
1544
+ // Number(message.type) -- always NaN for a string type --
1545
+ // so reading history quietly scattered files into a second
1546
+ // location that nothing else knew about.
1547
+ try {
1548
+ await downloadSyncedMedia({
1549
+ api,
1550
+ accountDir,
1551
+ threadId,
1552
+ limit,
1553
+ concurrency: 2,
1554
+ });
1555
+ localMsgs = getMessages(threadId, limit);
1556
+ } catch {
1557
+ /* showing history must not fail because media did */
1558
+ }
1559
+ const messages = localMsgs.map((m) => ({
1560
+ msgId: m.msgId,
1561
+ threadId: m.threadId,
1562
+ senderId: m.senderId,
1563
+ senderName: m.senderName,
1564
+ text: m.text,
1565
+ timestamp: m.timestamp,
1566
+ type: m.type,
1567
+ localPath: m.localPath,
1568
+ }));
1569
+
1570
+ output(
1571
+ {
1572
+ threadId,
1573
+ threadType: threadType === 0 ? "dm" : "group",
1574
+ count: messages.length,
1575
+ source: "sqlite",
1576
+ messages,
1577
+ },
1578
+ jsonMode,
1579
+ () => {
1580
+ success(`${messages.length} message(s) from ${threadId} (Local Cache)`);
1581
+ for (const m of messages) {
1582
+ const date = m.timestamp ? new Date(m.timestamp).toLocaleString() : "?";
1583
+ const name = m.senderName || m.senderId || "?";
1584
+ const mediaInfo = m.localPath ? ` [Media: ${m.localPath}]` : "";
1585
+ console.log(` [${date}] ${name}: ${(m.text || "").slice(0, 200)}${mediaInfo}`);
1586
+ }
1587
+ },
1588
+ );
1589
+ return;
1590
+ } else if (localMsgs && localMsgs.length > 0 && !jsonMode) {
1591
+ info(
1592
+ `Found only ${localMsgs.length} messages in cache. Falling back to live fetch to reach limit of ${limit}.`,
1593
+ );
1594
+ }
1595
+ } else if (opts.cache === false && !jsonMode) {
1596
+ info(`--no-cache specified. Fetching live from server and amending database.`);
1597
+ }
1598
+ } catch (err) {
1599
+ if (!jsonMode && err.message !== "Database not initialized") {
1600
+ warning(`Local DB query failed: ${err.message}. Falling back to network.`);
1601
+ }
1602
+ }
497
1603
 
498
1604
  try {
499
1605
  if (!jsonMode && limit > 100) {
500
- info(
501
- `Warning: fetching up to ${limit} messages. Large history may use significant memory and bandwidth.`,
502
- );
1606
+ info(`Warning: fetching up to ${limit} messages.`);
503
1607
  }
504
1608
 
505
- const api = getApi();
506
- const allMessages = [];
507
- let lastMsgId = null;
508
- let done = false;
509
-
510
- // Start listener (required for WebSocket requestOldMessages)
511
- await new Promise((resolve, reject) => {
512
- const timer = setTimeout(() => reject(new Error("Listener connection timeout")), 10000);
513
- api.listener.on("connected", () => {
514
- clearTimeout(timer);
515
- resolve();
1609
+ /** One progress line from the fetch, whichever process runs it. */
1610
+ const report = (e) => {
1611
+ if (jsonMode || !e?.detail) return;
1612
+ if (e.level === "warn") warning(e.detail);
1613
+ else info(e.detail);
1614
+ };
1615
+ const fetchOpts = { limit, scanLimit, timeoutMs: timeout, fromMsgId: opts.fromMsgId || null };
1616
+
1617
+ // The group store, the WebSocket global stream scanning and the
1618
+ // cache write after them are one function, fetchAndCacheHistory,
1619
+ // run by whichever process holds the account: it owns the one web
1620
+ // session the scan needs and is the one db writer (AGENTS.md
1621
+ // §13). With a daemon up that is the daemon, and this command
1622
+ // only displays what it returns.
1623
+ const daemonDir = join(CONFIG_DIR, "accounts", activeAcc.ownId);
1624
+ const daemon = getDaemonChannel(daemonDir);
1625
+ let fetched = null;
1626
+ let handledByDaemon = false;
1627
+ if (daemon) {
1628
+ // Nothing below fetches, writes or opens a socket in this
1629
+ // process beside a live daemon: when it cannot answer, the
1630
+ // command fails and says why.
1631
+ if (!getSyncChannel(daemonDir, "history")) {
1632
+ throw new Error(
1633
+ `a listen/mcp daemon (pid ${daemon.pid}) holds this account but predates the ` +
1634
+ "history hand-off — restart it, then run this again.",
1635
+ );
1636
+ }
1637
+ report({
1638
+ detail: `A listen/mcp daemon (pid ${daemon.pid}) holds this account — it fetches and caches; this command only displays.`,
516
1639
  });
517
- api.listener.on("error", (err) => {
518
- clearTimeout(timer);
519
- reject(err);
1640
+ const viaDaemon = await syncViaDaemon(daemonDir, {
1641
+ stage: "history",
1642
+ params: { threadId, threadType, ...fetchOpts },
1643
+ onEvent: report,
520
1644
  });
521
- api.listener.start({ retryOnClose: false });
522
- });
523
-
524
- // Fetch pages until limit reached or no more messages
525
- while (!done && allMessages.length < limit) {
526
- const pageMessages = await new Promise((resolve) => {
527
- const handler = (messages) => {
528
- clearTimeout(timer);
529
- api.listener.removeListener("old_messages", handler);
530
- resolve(messages);
531
- };
532
- const timer = setTimeout(() => {
533
- api.listener.removeListener("old_messages", handler);
534
- resolve([]);
535
- }, timeout);
1645
+ if (viaDaemon && !viaDaemon.ok) throw new Error(daemonHistoryFailure(viaDaemon, daemon.pid));
1646
+ // null: gone before the request reached it. Confirmed gone,
1647
+ // so the session is this process's again.
1648
+ handledByDaemon = viaDaemon !== null;
1649
+ fetched = viaDaemon?.result ?? null;
1650
+ }
536
1651
 
537
- api.listener.on("old_messages", handler);
538
- api.listener.requestOldMessages(threadType, lastMsgId);
1652
+ if (!handledByDaemon) {
1653
+ fetched = await fetchAndCacheHistory(api, threadId, threadType, {
1654
+ ...fetchOpts,
1655
+ cache: dbActive,
1656
+ onProgress: report,
1657
+ // No daemon: the session is this process's, and so is
1658
+ // opening the socket for the scan and closing it after.
1659
+ connect: async () => {
1660
+ await new Promise((resolve, reject) => {
1661
+ const timer = setTimeout(() => reject(new Error("Listener connection timeout")), 10000);
1662
+ api.listener.once("connected", () => {
1663
+ clearTimeout(timer);
1664
+ resolve();
1665
+ });
1666
+ api.listener.once("error", (err) => {
1667
+ clearTimeout(timer);
1668
+ reject(err);
1669
+ });
1670
+ api.listener.start({ retryOnClose: false });
1671
+ });
1672
+ return () => {
1673
+ try {
1674
+ api.listener.stop();
1675
+ } catch {}
1676
+ };
1677
+ },
539
1678
  });
1679
+ }
540
1680
 
541
- if (!pageMessages || pageMessages.length === 0) {
542
- done = true;
543
- break;
544
- }
1681
+ const frames = Array.isArray(fetched?.frames) ? fetched.frames : [];
1682
+ const fetchedMessages = frames.map((f) => historyRow(f.data, f.threadId));
1683
+ if (handledByDaemon && typeof fetched?.added !== "number") {
1684
+ // Its history stage from before this version returned frames
1685
+ // for the CLI to write, and nothing here writes them.
1686
+ warning(
1687
+ `The listen/mcp daemon (pid ${daemon.pid}) predates cached history: it fetched this ` +
1688
+ "but cached none of it. Restart it so what msg history fetches is cached.",
1689
+ );
1690
+ } else if (!jsonMode && fetched?.cached && frames.length > 0) {
1691
+ info(
1692
+ `${handledByDaemon ? "The daemon cached" : "Cached"} ${fetched.added} message(s) the local ` +
1693
+ `database did not have; ${fetched.untouched} already there or not storable were left untouched.`,
1694
+ );
1695
+ }
545
1696
 
546
- for (const msg of pageMessages) {
547
- if (allMessages.length >= limit) break;
548
- // API returns messages globally — filter to requested thread
549
- const msgThread = String(msg.threadId || "");
550
- const msgSender = String(msg.data?.uidFrom || "");
551
- const target = String(threadId);
552
- if (msgThread !== target && msgSender !== target) continue;
553
- allMessages.push({
554
- msgId: msg.data?.msgId,
555
- threadId: msg.threadId,
556
- senderId: msg.data?.uidFrom || null,
557
- senderName: msg.data?.dName || null,
558
- text:
559
- typeof msg.data?.content === "string"
560
- ? msg.data.content
561
- : extractMessageText(msg.data?.content, msg.data?.msgType),
562
- timestamp: msg.data?.ts ? Number(msg.data.ts) : null,
563
- type: typeof msg.data?.content === "string" ? "text" : msg.data?.msgType || "attachment",
564
- });
565
- }
1697
+ // Merge and sort
1698
+ // If we fetched live, we might want to merge with localMsgs in case we didn't fetch enough to hit the limit
1699
+ const mergedMap = new Map();
1700
+ for (const m of localMsgs) mergedMap.set(m.msgId, m);
1701
+ for (const m of fetchedMessages) mergedMap.set(m.msgId, m);
566
1702
 
567
- // Use last message's actionId for pagination
568
- const lastMsg = pageMessages[pageMessages.length - 1];
569
- const nextId = lastMsg?.data?.actionId || lastMsg?.data?.msgId;
570
- if (!nextId || nextId === lastMsgId) {
571
- done = true;
572
- }
573
- lastMsgId = nextId;
574
- }
1703
+ const mergedArray = Array.from(mergedMap.values());
1704
+ // Sort newest-first (descending timestamp)
1705
+ mergedArray.sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0));
1706
+
1707
+ const result = mergedArray.slice(0, limit);
575
1708
 
576
- // Sort by timestamp (oldest first)
577
- allMessages.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
1709
+ // Format final output
1710
+ const cleanResult = result.map((m) => {
1711
+ const r = { ...m };
1712
+ delete r.raw_data;
1713
+ return r;
1714
+ });
578
1715
 
579
1716
  output(
580
1717
  {
581
1718
  threadId,
582
1719
  threadType: threadType === 0 ? "dm" : "group",
583
- count: allMessages.length,
584
- messages: allMessages,
1720
+ count: cleanResult.length,
1721
+ source: "live",
1722
+ // A group's store withheld older messages (since-login only).
1723
+ filtered: fetched?.filtered === true,
1724
+ messages: cleanResult,
585
1725
  },
586
1726
  jsonMode,
587
1727
  () => {
588
- success(`${allMessages.length} message(s) from ${threadId}`);
589
- for (const m of allMessages) {
1728
+ success(`${cleanResult.length} message(s) from ${threadId}`);
1729
+ for (const m of cleanResult) {
590
1730
  const date = m.timestamp ? new Date(m.timestamp).toLocaleString() : "?";
591
1731
  const name = m.senderName || m.senderId || "?";
592
- console.log(` [${date}] ${name}: ${(m.text || "").slice(0, 200)}`);
1732
+ const mediaInfo = m.localPath ? ` [Media: ${m.localPath}]` : "";
1733
+ console.log(` [${date}] ${name}: ${(m.text || "").slice(0, 200)}${mediaInfo}`);
593
1734
  }
594
1735
  },
595
1736
  );
596
1737
 
597
- // Clean up listener
598
- api.listener.stop();
599
1738
  process.exit(0);
600
1739
  } catch (e) {
601
1740
  try {