@wirecat/max-cli 0.0.0 → 0.43.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 (546) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +531 -0
  3. package/dist/adapter/max-adapter.d.ts +17 -0
  4. package/dist/adapter/max-adapter.d.ts.map +1 -0
  5. package/dist/adapter/max-adapter.js +364 -0
  6. package/dist/adapter/max-adapter.js.map +1 -0
  7. package/dist/app.d.ts +3 -0
  8. package/dist/app.d.ts.map +1 -0
  9. package/dist/app.js +9 -0
  10. package/dist/app.js.map +1 -0
  11. package/dist/bin/max.d.ts +3 -0
  12. package/dist/bin/max.d.ts.map +1 -0
  13. package/dist/bin/max.js +20 -0
  14. package/dist/bin/max.js.map +1 -0
  15. package/dist/bot/adapter.d.ts +25 -0
  16. package/dist/bot/adapter.d.ts.map +1 -0
  17. package/dist/bot/adapter.js +404 -0
  18. package/dist/bot/adapter.js.map +1 -0
  19. package/dist/bot/auth.d.ts +13 -0
  20. package/dist/bot/auth.d.ts.map +1 -0
  21. package/dist/bot/auth.js +9 -0
  22. package/dist/bot/auth.js.map +1 -0
  23. package/dist/bot/client.d.ts +26 -0
  24. package/dist/bot/client.d.ts.map +1 -0
  25. package/dist/bot/client.js +105 -0
  26. package/dist/bot/client.js.map +1 -0
  27. package/dist/bot/generated/manifest.d.ts +3 -0
  28. package/dist/bot/generated/manifest.d.ts.map +1 -0
  29. package/dist/bot/generated/manifest.js +1232 -0
  30. package/dist/bot/generated/manifest.js.map +1 -0
  31. package/dist/bot/generated/schemas.d.ts +271 -0
  32. package/dist/bot/generated/schemas.d.ts.map +1 -0
  33. package/dist/bot/generated/schemas.js +869 -0
  34. package/dist/bot/generated/schemas.js.map +1 -0
  35. package/dist/bot/generated/types.d.ts +1088 -0
  36. package/dist/bot/generated/types.d.ts.map +1 -0
  37. package/dist/bot/generated/types.js +5 -0
  38. package/dist/bot/generated/types.js.map +1 -0
  39. package/dist/bot/input.d.ts +6 -0
  40. package/dist/bot/input.d.ts.map +1 -0
  41. package/dist/bot/input.js +6 -0
  42. package/dist/bot/input.js.map +1 -0
  43. package/dist/bot/joins.d.ts +26 -0
  44. package/dist/bot/joins.d.ts.map +1 -0
  45. package/dist/bot/joins.js +56 -0
  46. package/dist/bot/joins.js.map +1 -0
  47. package/dist/bot/keep.d.ts +25 -0
  48. package/dist/bot/keep.d.ts.map +1 -0
  49. package/dist/bot/keep.js +98 -0
  50. package/dist/bot/keep.js.map +1 -0
  51. package/dist/bot/map.d.ts +14 -0
  52. package/dist/bot/map.d.ts.map +1 -0
  53. package/dist/bot/map.js +101 -0
  54. package/dist/bot/map.js.map +1 -0
  55. package/dist/bot/mcp-tools.d.ts +4 -0
  56. package/dist/bot/mcp-tools.d.ts.map +1 -0
  57. package/dist/bot/mcp-tools.js +78 -0
  58. package/dist/bot/mcp-tools.js.map +1 -0
  59. package/dist/bot/permissions.d.ts +14 -0
  60. package/dist/bot/permissions.d.ts.map +1 -0
  61. package/dist/bot/permissions.js +88 -0
  62. package/dist/bot/permissions.js.map +1 -0
  63. package/dist/bot/registry.d.ts +11 -0
  64. package/dist/bot/registry.d.ts.map +1 -0
  65. package/dist/bot/registry.js +13 -0
  66. package/dist/bot/registry.js.map +1 -0
  67. package/dist/bot/russian-trusted-root.d.ts +8 -0
  68. package/dist/bot/russian-trusted-root.d.ts.map +1 -0
  69. package/dist/bot/russian-trusted-root.js +41 -0
  70. package/dist/bot/russian-trusted-root.js.map +1 -0
  71. package/dist/bot/transport.d.ts +46 -0
  72. package/dist/bot/transport.d.ts.map +1 -0
  73. package/dist/bot/transport.js +252 -0
  74. package/dist/bot/transport.js.map +1 -0
  75. package/dist/bot/uploads.d.ts +42 -0
  76. package/dist/bot/uploads.d.ts.map +1 -0
  77. package/dist/bot/uploads.js +145 -0
  78. package/dist/bot/uploads.js.map +1 -0
  79. package/dist/client.d.ts +650 -0
  80. package/dist/client.d.ts.map +1 -0
  81. package/dist/client.js +2836 -0
  82. package/dist/client.js.map +1 -0
  83. package/dist/commands/account.d.ts +3 -0
  84. package/dist/commands/account.d.ts.map +1 -0
  85. package/dist/commands/account.js +4 -0
  86. package/dist/commands/account.js.map +1 -0
  87. package/dist/commands/bot-comments.d.ts +3 -0
  88. package/dist/commands/bot-comments.d.ts.map +1 -0
  89. package/dist/commands/bot-comments.js +74 -0
  90. package/dist/commands/bot-comments.js.map +1 -0
  91. package/dist/commands/bot-context.d.ts +38 -0
  92. package/dist/commands/bot-context.d.ts.map +1 -0
  93. package/dist/commands/bot-context.js +121 -0
  94. package/dist/commands/bot-context.js.map +1 -0
  95. package/dist/commands/bot-members.d.ts +14 -0
  96. package/dist/commands/bot-members.d.ts.map +1 -0
  97. package/dist/commands/bot-members.js +64 -0
  98. package/dist/commands/bot-members.js.map +1 -0
  99. package/dist/commands/bot-messenger.d.ts +10 -0
  100. package/dist/commands/bot-messenger.d.ts.map +1 -0
  101. package/dist/commands/bot-messenger.js +101 -0
  102. package/dist/commands/bot-messenger.js.map +1 -0
  103. package/dist/commands/bot-reads.d.ts +4 -0
  104. package/dist/commands/bot-reads.d.ts.map +1 -0
  105. package/dist/commands/bot-reads.js +13 -0
  106. package/dist/commands/bot-reads.js.map +1 -0
  107. package/dist/commands/bot-sends.d.ts +13 -0
  108. package/dist/commands/bot-sends.d.ts.map +1 -0
  109. package/dist/commands/bot-sends.js +103 -0
  110. package/dist/commands/bot-sends.js.map +1 -0
  111. package/dist/commands/bot-setup.d.ts +3 -0
  112. package/dist/commands/bot-setup.d.ts.map +1 -0
  113. package/dist/commands/bot-setup.js +20 -0
  114. package/dist/commands/bot-setup.js.map +1 -0
  115. package/dist/commands/bot.d.ts +3 -0
  116. package/dist/commands/bot.d.ts.map +1 -0
  117. package/dist/commands/bot.js +60 -0
  118. package/dist/commands/bot.js.map +1 -0
  119. package/dist/commands/calls.d.ts +3 -0
  120. package/dist/commands/calls.d.ts.map +1 -0
  121. package/dist/commands/calls.js +4 -0
  122. package/dist/commands/calls.js.map +1 -0
  123. package/dist/commands/chats.d.ts +3 -0
  124. package/dist/commands/chats.d.ts.map +1 -0
  125. package/dist/commands/chats.js +46 -0
  126. package/dist/commands/chats.js.map +1 -0
  127. package/dist/commands/commands.d.ts +2 -0
  128. package/dist/commands/commands.d.ts.map +1 -0
  129. package/dist/commands/commands.js +4 -0
  130. package/dist/commands/commands.js.map +1 -0
  131. package/dist/commands/complete.d.ts +2 -0
  132. package/dist/commands/complete.d.ts.map +1 -0
  133. package/dist/commands/complete.js +34 -0
  134. package/dist/commands/complete.js.map +1 -0
  135. package/dist/commands/config.d.ts +3 -0
  136. package/dist/commands/config.d.ts.map +1 -0
  137. package/dist/commands/config.js +170 -0
  138. package/dist/commands/config.js.map +1 -0
  139. package/dist/commands/contacts.d.ts +10 -0
  140. package/dist/commands/contacts.d.ts.map +1 -0
  141. package/dist/commands/contacts.js +80 -0
  142. package/dist/commands/contacts.js.map +1 -0
  143. package/dist/commands/context.d.ts +126 -0
  144. package/dist/commands/context.d.ts.map +1 -0
  145. package/dist/commands/context.js +137 -0
  146. package/dist/commands/context.js.map +1 -0
  147. package/dist/commands/doctor.d.ts +24 -0
  148. package/dist/commands/doctor.d.ts.map +1 -0
  149. package/dist/commands/doctor.js +308 -0
  150. package/dist/commands/doctor.js.map +1 -0
  151. package/dist/commands/mcp.d.ts +36 -0
  152. package/dist/commands/mcp.d.ts.map +1 -0
  153. package/dist/commands/mcp.js +214 -0
  154. package/dist/commands/mcp.js.map +1 -0
  155. package/dist/commands/messages.d.ts +3 -0
  156. package/dist/commands/messages.d.ts.map +1 -0
  157. package/dist/commands/messages.js +105 -0
  158. package/dist/commands/messages.js.map +1 -0
  159. package/dist/commands/models.d.ts +3 -0
  160. package/dist/commands/models.d.ts.map +1 -0
  161. package/dist/commands/models.js +4 -0
  162. package/dist/commands/models.js.map +1 -0
  163. package/dist/commands/paging.d.ts +59 -0
  164. package/dist/commands/paging.d.ts.map +1 -0
  165. package/dist/commands/paging.js +77 -0
  166. package/dist/commands/paging.js.map +1 -0
  167. package/dist/commands/recipients.d.ts +9 -0
  168. package/dist/commands/recipients.d.ts.map +1 -0
  169. package/dist/commands/recipients.js +74 -0
  170. package/dist/commands/recipients.js.map +1 -0
  171. package/dist/commands/runs.d.ts +2 -0
  172. package/dist/commands/runs.d.ts.map +1 -0
  173. package/dist/commands/runs.js +4 -0
  174. package/dist/commands/runs.js.map +1 -0
  175. package/dist/commands/sends.d.ts +3 -0
  176. package/dist/commands/sends.d.ts.map +1 -0
  177. package/dist/commands/sends.js +4 -0
  178. package/dist/commands/sends.js.map +1 -0
  179. package/dist/commands/serve-members.d.ts +14 -0
  180. package/dist/commands/serve-members.d.ts.map +1 -0
  181. package/dist/commands/serve-members.js +54 -0
  182. package/dist/commands/serve-members.js.map +1 -0
  183. package/dist/commands/serve-stems.d.ts +9 -0
  184. package/dist/commands/serve-stems.d.ts.map +1 -0
  185. package/dist/commands/serve-stems.js +26 -0
  186. package/dist/commands/serve-stems.js.map +1 -0
  187. package/dist/commands/serve.d.ts +10 -0
  188. package/dist/commands/serve.d.ts.map +1 -0
  189. package/dist/commands/serve.js +79 -0
  190. package/dist/commands/serve.js.map +1 -0
  191. package/dist/commands/server.d.ts +16 -0
  192. package/dist/commands/server.d.ts.map +1 -0
  193. package/dist/commands/server.js +51 -0
  194. package/dist/commands/server.js.map +1 -0
  195. package/dist/commands/session.d.ts +15 -0
  196. package/dist/commands/session.d.ts.map +1 -0
  197. package/dist/commands/session.js +169 -0
  198. package/dist/commands/session.js.map +1 -0
  199. package/dist/commands/setup.d.ts +3 -0
  200. package/dist/commands/setup.d.ts.map +1 -0
  201. package/dist/commands/setup.js +168 -0
  202. package/dist/commands/setup.js.map +1 -0
  203. package/dist/commands/skill.d.ts +3 -0
  204. package/dist/commands/skill.d.ts.map +1 -0
  205. package/dist/commands/skill.js +7 -0
  206. package/dist/commands/skill.js.map +1 -0
  207. package/dist/commands/stickers.d.ts +3 -0
  208. package/dist/commands/stickers.d.ts.map +1 -0
  209. package/dist/commands/stickers.js +4 -0
  210. package/dist/commands/stickers.js.map +1 -0
  211. package/dist/commands/upgrade.d.ts +2 -0
  212. package/dist/commands/upgrade.d.ts.map +1 -0
  213. package/dist/commands/upgrade.js +14 -0
  214. package/dist/commands/upgrade.js.map +1 -0
  215. package/dist/commands/watch.d.ts +27 -0
  216. package/dist/commands/watch.d.ts.map +1 -0
  217. package/dist/commands/watch.js +105 -0
  218. package/dist/commands/watch.js.map +1 -0
  219. package/dist/config.d.ts +385 -0
  220. package/dist/config.d.ts.map +1 -0
  221. package/dist/config.js +372 -0
  222. package/dist/config.js.map +1 -0
  223. package/dist/deadline.d.ts +2 -0
  224. package/dist/deadline.d.ts.map +1 -0
  225. package/dist/deadline.js +2 -0
  226. package/dist/deadline.js.map +1 -0
  227. package/dist/diagnose.d.ts +143 -0
  228. package/dist/diagnose.d.ts.map +1 -0
  229. package/dist/diagnose.js +183 -0
  230. package/dist/diagnose.js.map +1 -0
  231. package/dist/domain/map.d.ts +65 -0
  232. package/dist/domain/map.d.ts.map +1 -0
  233. package/dist/domain/map.js +431 -0
  234. package/dist/domain/map.js.map +1 -0
  235. package/dist/domain/models.d.ts +238 -0
  236. package/dist/domain/models.d.ts.map +1 -0
  237. package/dist/domain/models.js +17 -0
  238. package/dist/domain/models.js.map +1 -0
  239. package/dist/download.d.ts +38 -0
  240. package/dist/download.d.ts.map +1 -0
  241. package/dist/download.js +199 -0
  242. package/dist/download.js.map +1 -0
  243. package/dist/format-markdown.d.ts +13 -0
  244. package/dist/format-markdown.d.ts.map +1 -0
  245. package/dist/format-markdown.js +241 -0
  246. package/dist/format-markdown.js.map +1 -0
  247. package/dist/generated/client.generated.d.ts +95 -0
  248. package/dist/generated/client.generated.d.ts.map +1 -0
  249. package/dist/generated/client.generated.js +91 -0
  250. package/dist/generated/client.generated.js.map +1 -0
  251. package/dist/generated/opcodes.generated.d.ts +76 -0
  252. package/dist/generated/opcodes.generated.d.ts.map +1 -0
  253. package/dist/generated/opcodes.generated.js +76 -0
  254. package/dist/generated/opcodes.generated.js.map +1 -0
  255. package/dist/generated/operations.generated.d.ts +502 -0
  256. package/dist/generated/operations.generated.d.ts.map +1 -0
  257. package/dist/generated/operations.generated.js +72 -0
  258. package/dist/generated/operations.generated.js.map +1 -0
  259. package/dist/inbox-point.d.ts +3 -0
  260. package/dist/inbox-point.d.ts.map +1 -0
  261. package/dist/inbox-point.js +17 -0
  262. package/dist/inbox-point.js.map +1 -0
  263. package/dist/install/postinstall.d.ts +8 -0
  264. package/dist/install/postinstall.d.ts.map +1 -0
  265. package/dist/install/postinstall.js +62 -0
  266. package/dist/install/postinstall.js.map +1 -0
  267. package/dist/install.d.ts +43 -0
  268. package/dist/install.d.ts.map +1 -0
  269. package/dist/install.js +142 -0
  270. package/dist/install.js.map +1 -0
  271. package/dist/markdown.d.ts +13 -0
  272. package/dist/markdown.d.ts.map +1 -0
  273. package/dist/markdown.js +6 -0
  274. package/dist/markdown.js.map +1 -0
  275. package/dist/mcp/instructions.d.ts +13 -0
  276. package/dist/mcp/instructions.d.ts.map +1 -0
  277. package/dist/mcp/instructions.js +16 -0
  278. package/dist/mcp/instructions.js.map +1 -0
  279. package/dist/mcp/legacy-check.d.ts +12 -0
  280. package/dist/mcp/legacy-check.d.ts.map +1 -0
  281. package/dist/mcp/legacy-check.js +44 -0
  282. package/dist/mcp/legacy-check.js.map +1 -0
  283. package/dist/mcp/photo.d.ts +9 -0
  284. package/dist/mcp/photo.d.ts.map +1 -0
  285. package/dist/mcp/photo.js +38 -0
  286. package/dist/mcp/photo.js.map +1 -0
  287. package/dist/mcp/prompts.d.ts +7 -0
  288. package/dist/mcp/prompts.d.ts.map +1 -0
  289. package/dist/mcp/prompts.js +100 -0
  290. package/dist/mcp/prompts.js.map +1 -0
  291. package/dist/mcp/resources.d.ts +15 -0
  292. package/dist/mcp/resources.d.ts.map +1 -0
  293. package/dist/mcp/resources.js +56 -0
  294. package/dist/mcp/resources.js.map +1 -0
  295. package/dist/mcp/server.d.ts +31 -0
  296. package/dist/mcp/server.d.ts.map +1 -0
  297. package/dist/mcp/server.js +116 -0
  298. package/dist/mcp/server.js.map +1 -0
  299. package/dist/mcp/session.d.ts +30 -0
  300. package/dist/mcp/session.d.ts.map +1 -0
  301. package/dist/mcp/session.js +109 -0
  302. package/dist/mcp/session.js.map +1 -0
  303. package/dist/mcp/shared.d.ts +14 -0
  304. package/dist/mcp/shared.d.ts.map +1 -0
  305. package/dist/mcp/shared.js +46 -0
  306. package/dist/mcp/shared.js.map +1 -0
  307. package/dist/mcp/tools.d.ts +30 -0
  308. package/dist/mcp/tools.d.ts.map +1 -0
  309. package/dist/mcp/tools.js +248 -0
  310. package/dist/mcp/tools.js.map +1 -0
  311. package/dist/messenger.d.ts +15 -0
  312. package/dist/messenger.d.ts.map +1 -0
  313. package/dist/messenger.js +149 -0
  314. package/dist/messenger.js.map +1 -0
  315. package/dist/moderation/check.d.ts +103 -0
  316. package/dist/moderation/check.d.ts.map +1 -0
  317. package/dist/moderation/check.js +273 -0
  318. package/dist/moderation/check.js.map +1 -0
  319. package/dist/moderation/points.d.ts +8 -0
  320. package/dist/moderation/points.d.ts.map +1 -0
  321. package/dist/moderation/points.js +21 -0
  322. package/dist/moderation/points.js.map +1 -0
  323. package/dist/moderation/rules.d.ts +7 -0
  324. package/dist/moderation/rules.d.ts.map +1 -0
  325. package/dist/moderation/rules.js +24 -0
  326. package/dist/moderation/rules.js.map +1 -0
  327. package/dist/online.d.ts +23 -0
  328. package/dist/online.d.ts.map +1 -0
  329. package/dist/online.js +87 -0
  330. package/dist/online.js.map +1 -0
  331. package/dist/output.d.ts +2 -0
  332. package/dist/output.d.ts.map +1 -0
  333. package/dist/output.js +2 -0
  334. package/dist/output.js.map +1 -0
  335. package/dist/permissions.d.ts +20 -0
  336. package/dist/permissions.d.ts.map +1 -0
  337. package/dist/permissions.js +76 -0
  338. package/dist/permissions.js.map +1 -0
  339. package/dist/profile.d.ts +33 -0
  340. package/dist/profile.d.ts.map +1 -0
  341. package/dist/profile.js +60 -0
  342. package/dist/profile.js.map +1 -0
  343. package/dist/program.d.ts +10 -0
  344. package/dist/program.d.ts.map +1 -0
  345. package/dist/program.js +172 -0
  346. package/dist/program.js.map +1 -0
  347. package/dist/protocol/connection.d.ts +83 -0
  348. package/dist/protocol/connection.d.ts.map +1 -0
  349. package/dist/protocol/connection.js +301 -0
  350. package/dist/protocol/connection.js.map +1 -0
  351. package/dist/protocol/frame.d.ts +55 -0
  352. package/dist/protocol/frame.d.ts.map +1 -0
  353. package/dist/protocol/frame.js +149 -0
  354. package/dist/protocol/frame.js.map +1 -0
  355. package/dist/protocol/lz4.d.ts +15 -0
  356. package/dist/protocol/lz4.d.ts.map +1 -0
  357. package/dist/protocol/lz4.js +157 -0
  358. package/dist/protocol/lz4.js.map +1 -0
  359. package/dist/record.d.ts +41 -0
  360. package/dist/record.d.ts.map +1 -0
  361. package/dist/record.js +104 -0
  362. package/dist/record.js.map +1 -0
  363. package/dist/rendering/messages.d.ts +24 -0
  364. package/dist/rendering/messages.d.ts.map +1 -0
  365. package/dist/rendering/messages.js +172 -0
  366. package/dist/rendering/messages.js.map +1 -0
  367. package/dist/report.d.ts +43 -0
  368. package/dist/report.d.ts.map +1 -0
  369. package/dist/report.js +104 -0
  370. package/dist/report.js.map +1 -0
  371. package/dist/resolve.d.ts +6 -0
  372. package/dist/resolve.d.ts.map +1 -0
  373. package/dist/resolve.js +5 -0
  374. package/dist/resolve.js.map +1 -0
  375. package/dist/sends.d.ts +17 -0
  376. package/dist/sends.d.ts.map +1 -0
  377. package/dist/sends.js +97 -0
  378. package/dist/sends.js.map +1 -0
  379. package/dist/server/lines.d.ts +23 -0
  380. package/dist/server/lines.d.ts.map +1 -0
  381. package/dist/server/lines.js +56 -0
  382. package/dist/server/lines.js.map +1 -0
  383. package/dist/server/replies.d.ts +31 -0
  384. package/dist/server/replies.d.ts.map +1 -0
  385. package/dist/server/replies.js +95 -0
  386. package/dist/server/replies.js.map +1 -0
  387. package/dist/server/server-connection.d.ts +55 -0
  388. package/dist/server/server-connection.d.ts.map +1 -0
  389. package/dist/server/server-connection.js +245 -0
  390. package/dist/server/server-connection.js.map +1 -0
  391. package/dist/server/server.d.ts +88 -0
  392. package/dist/server/server.d.ts.map +1 -0
  393. package/dist/server/server.js +634 -0
  394. package/dist/server/server.js.map +1 -0
  395. package/dist/server/start.d.ts +37 -0
  396. package/dist/server/start.d.ts.map +1 -0
  397. package/dist/server/start.js +102 -0
  398. package/dist/server/start.js.map +1 -0
  399. package/dist/server/subscribe.d.ts +9 -0
  400. package/dist/server/subscribe.d.ts.map +1 -0
  401. package/dist/server/subscribe.js +26 -0
  402. package/dist/server/subscribe.js.map +1 -0
  403. package/dist/session/adopt.d.ts +22 -0
  404. package/dist/session/adopt.d.ts.map +1 -0
  405. package/dist/session/adopt.js +34 -0
  406. package/dist/session/adopt.js.map +1 -0
  407. package/dist/session/browser.d.ts +55 -0
  408. package/dist/session/browser.d.ts.map +1 -0
  409. package/dist/session/browser.js +321 -0
  410. package/dist/session/browser.js.map +1 -0
  411. package/dist/session/handshake.d.ts +57 -0
  412. package/dist/session/handshake.d.ts.map +1 -0
  413. package/dist/session/handshake.js +40 -0
  414. package/dist/session/handshake.js.map +1 -0
  415. package/dist/session/login.d.ts +20 -0
  416. package/dist/session/login.d.ts.map +1 -0
  417. package/dist/session/login.js +66 -0
  418. package/dist/session/login.js.map +1 -0
  419. package/dist/session/prompt.d.ts +2 -0
  420. package/dist/session/prompt.d.ts.map +1 -0
  421. package/dist/session/prompt.js +2 -0
  422. package/dist/session/prompt.js.map +1 -0
  423. package/dist/session/qr-terminal.d.ts +9 -0
  424. package/dist/session/qr-terminal.d.ts.map +1 -0
  425. package/dist/session/qr-terminal.js +34 -0
  426. package/dist/session/qr-terminal.js.map +1 -0
  427. package/dist/session/store.d.ts +76 -0
  428. package/dist/session/store.d.ts.map +1 -0
  429. package/dist/session/store.js +134 -0
  430. package/dist/session/store.js.map +1 -0
  431. package/dist/skill.d.ts +7 -0
  432. package/dist/skill.d.ts.map +1 -0
  433. package/dist/skill.js +8 -0
  434. package/dist/skill.js.map +1 -0
  435. package/dist/spec/check.d.ts +16 -0
  436. package/dist/spec/check.d.ts.map +1 -0
  437. package/dist/spec/check.js +44 -0
  438. package/dist/spec/check.js.map +1 -0
  439. package/dist/spec/define.d.ts +108 -0
  440. package/dist/spec/define.d.ts.map +1 -0
  441. package/dist/spec/define.js +47 -0
  442. package/dist/spec/define.js.map +1 -0
  443. package/dist/spec/guards.d.ts +16 -0
  444. package/dist/spec/guards.d.ts.map +1 -0
  445. package/dist/spec/guards.js +30 -0
  446. package/dist/spec/guards.js.map +1 -0
  447. package/dist/spec/identity.d.ts +57 -0
  448. package/dist/spec/identity.d.ts.map +1 -0
  449. package/dist/spec/identity.js +53 -0
  450. package/dist/spec/identity.js.map +1 -0
  451. package/dist/spec/index.d.ts +15 -0
  452. package/dist/spec/index.d.ts.map +1 -0
  453. package/dist/spec/index.js +84 -0
  454. package/dist/spec/index.js.map +1 -0
  455. package/dist/spec/operations/account.d.ts +39 -0
  456. package/dist/spec/operations/account.d.ts.map +1 -0
  457. package/dist/spec/operations/account.js +103 -0
  458. package/dist/spec/operations/account.js.map +1 -0
  459. package/dist/spec/operations/assets.d.ts +17 -0
  460. package/dist/spec/operations/assets.d.ts.map +1 -0
  461. package/dist/spec/operations/assets.js +43 -0
  462. package/dist/spec/operations/assets.js.map +1 -0
  463. package/dist/spec/operations/attachments.d.ts +15 -0
  464. package/dist/spec/operations/attachments.d.ts.map +1 -0
  465. package/dist/spec/operations/attachments.js +40 -0
  466. package/dist/spec/operations/attachments.js.map +1 -0
  467. package/dist/spec/operations/banners.d.ts +7 -0
  468. package/dist/spec/operations/banners.d.ts.map +1 -0
  469. package/dist/spec/operations/banners.js +16 -0
  470. package/dist/spec/operations/banners.js.map +1 -0
  471. package/dist/spec/operations/calls.d.ts +8 -0
  472. package/dist/spec/operations/calls.d.ts.map +1 -0
  473. package/dist/spec/operations/calls.js +25 -0
  474. package/dist/spec/operations/calls.js.map +1 -0
  475. package/dist/spec/operations/chats.d.ts +115 -0
  476. package/dist/spec/operations/chats.d.ts.map +1 -0
  477. package/dist/spec/operations/chats.js +331 -0
  478. package/dist/spec/operations/chats.js.map +1 -0
  479. package/dist/spec/operations/contacts.d.ts +39 -0
  480. package/dist/spec/operations/contacts.d.ts.map +1 -0
  481. package/dist/spec/operations/contacts.js +135 -0
  482. package/dist/spec/operations/contacts.js.map +1 -0
  483. package/dist/spec/operations/folders.d.ts +31 -0
  484. package/dist/spec/operations/folders.d.ts.map +1 -0
  485. package/dist/spec/operations/folders.js +94 -0
  486. package/dist/spec/operations/folders.js.map +1 -0
  487. package/dist/spec/operations/login.d.ts +64 -0
  488. package/dist/spec/operations/login.d.ts.map +1 -0
  489. package/dist/spec/operations/login.js +105 -0
  490. package/dist/spec/operations/login.js.map +1 -0
  491. package/dist/spec/operations/messages.d.ts +142 -0
  492. package/dist/spec/operations/messages.d.ts.map +1 -0
  493. package/dist/spec/operations/messages.js +347 -0
  494. package/dist/spec/operations/messages.js.map +1 -0
  495. package/dist/spec/operations/session.d.ts +120 -0
  496. package/dist/spec/operations/session.d.ts.map +1 -0
  497. package/dist/spec/operations/session.js +202 -0
  498. package/dist/spec/operations/session.js.map +1 -0
  499. package/dist/spec/operations/uploads.d.ts +31 -0
  500. package/dist/spec/operations/uploads.d.ts.map +1 -0
  501. package/dist/spec/operations/uploads.js +59 -0
  502. package/dist/spec/operations/uploads.js.map +1 -0
  503. package/dist/spec/scalars.d.ts +17 -0
  504. package/dist/spec/scalars.d.ts.map +1 -0
  505. package/dist/spec/scalars.js +33 -0
  506. package/dist/spec/scalars.js.map +1 -0
  507. package/dist/transcribe/index.d.ts +70 -0
  508. package/dist/transcribe/index.d.ts.map +1 -0
  509. package/dist/transcribe/index.js +127 -0
  510. package/dist/transcribe/index.js.map +1 -0
  511. package/dist/transcribe/install.d.ts +2 -0
  512. package/dist/transcribe/install.d.ts.map +1 -0
  513. package/dist/transcribe/install.js +2 -0
  514. package/dist/transcribe/install.js.map +1 -0
  515. package/dist/transcribe/models.d.ts +5 -0
  516. package/dist/transcribe/models.d.ts.map +1 -0
  517. package/dist/transcribe/models.js +6 -0
  518. package/dist/transcribe/models.js.map +1 -0
  519. package/dist/transcribe/speech.d.ts +25 -0
  520. package/dist/transcribe/speech.d.ts.map +1 -0
  521. package/dist/transcribe/speech.js +107 -0
  522. package/dist/transcribe/speech.js.map +1 -0
  523. package/dist/update.d.ts +31 -0
  524. package/dist/update.d.ts.map +1 -0
  525. package/dist/update.js +69 -0
  526. package/dist/update.js.map +1 -0
  527. package/dist/upload.d.ts +15 -0
  528. package/dist/upload.d.ts.map +1 -0
  529. package/dist/upload.js +97 -0
  530. package/dist/upload.js.map +1 -0
  531. package/dist/version.d.ts +2 -0
  532. package/dist/version.d.ts.map +1 -0
  533. package/dist/version.js +2 -0
  534. package/dist/version.js.map +1 -0
  535. package/dist/voice.d.ts +9 -0
  536. package/dist/voice.d.ts.map +1 -0
  537. package/dist/voice.js +36 -0
  538. package/dist/voice.js.map +1 -0
  539. package/dist/wire-events.d.ts +23 -0
  540. package/dist/wire-events.d.ts.map +1 -0
  541. package/dist/wire-events.js +47 -0
  542. package/dist/wire-events.js.map +1 -0
  543. package/install/postinstall.mjs +3 -0
  544. package/install/windows.ps1 +160 -0
  545. package/package.json +120 -3
  546. package/skills/max-cli/SKILL.md +523 -0
@@ -0,0 +1,650 @@
1
+ import { type SleepLike } from "@wirecat/cli-core";
2
+ import { type DiagnosticEvent } from "@wirecat/cli-messaging/cli";
3
+ import { type ChatAction, type SendGuard, type Upload as SharedUpload } from "@wirecat/cli-messaging/sends";
4
+ import type { AccountSession, AttachmentLink, Button, CallRecord, Chat, ChatCard, ChatEvents, ChatKind, Contact, ContactImport, Deletion, Folder, GroupCard, GroupMember, GroupMembers, GroupSettings, Id, JoinRequest, MediaKind, Message, MessageChange, MessageHit, Page, PersonCard, Pin, PollMessage, PrivacySettings, Profile, ProfileFacts, Reactions, ReadMark, Sticker, StickerSet, WindowedMessage } from "./domain/models.js";
5
+ import { type Markup } from "./markdown.js";
6
+ import { type Wire } from "./protocol/connection.js";
7
+ import { type Payload } from "./protocol/frame.js";
8
+ import type { MaxRecord, SyncSummary } from "./record.js";
9
+ import { type Resume } from "./session/handshake.js";
10
+ import { type QrLogin } from "./session/login.js";
11
+ import { type SessionState, type SessionStore } from "./session/store.js";
12
+ import { ASSET_TYPES } from "./spec/operations/assets.js";
13
+ export interface MaxClientOptions {
14
+ store: SessionStore;
15
+ timeoutMs?: number;
16
+ /** Injected by tests, or one through `max serve`; defaults to a real WebSocket connection. */
17
+ connection?: Wire;
18
+ /**
19
+ * Log in without the saved contact marker, so the answer names every contact. `max serve` needs that: it hands its login to other commands as theirs.
20
+ */
21
+ fullLogin?: boolean;
22
+ /** The previous connection's login, for logging in again as a web tab does (`MAX-51`). `max serve` only. */
23
+ resume?: ResumeFrom;
24
+ /**
25
+ * Where a protocol note goes. Never stdout: in machine mode that stream carries one JSON value
26
+ * and nothing else.
27
+ */
28
+ warn?: (message: string) => void;
29
+ /** What the login brings, kept in the shared `messages.db`. */
30
+ record?: MaxRecord;
31
+ /** Refuse network use; the shared services own offline reads. */
32
+ offline?: boolean;
33
+ /**
34
+ * One event per request, for whoever is keeping a diagnostic. Injected the way `warn` is: the
35
+ * client reports what it did and never decides where that goes. Absent means nothing is kept.
36
+ */
37
+ events?: (event: DiagnosticEvent) => void;
38
+ /**
39
+ * Asked before every send and told its outcome. `"caller"` when whoever holds the client guards
40
+ * its writes instead: the shared services, or `max serve` for each write it forwards.
41
+ * Required, so a client without a guard is a choice somebody wrote and never one they forgot.
42
+ */
43
+ sends: SendGuard | "caller";
44
+ reads?: (key: string) => void;
45
+ /** The wait between retries; a test passes one that returns at once. */
46
+ sleep?: SleepLike;
47
+ }
48
+ /**
49
+ * **The only thing above this line that knows MAX exists.** Commands speak the domain model; the
50
+ * opcodes and the frames stop here, so a different transport underneath changes this file and
51
+ * nothing else (REQUIREMENTS §25).
52
+ *
53
+ * The methods are grouped by subject — `client.chats.list()`, `client.messages.send()` — which is
54
+ * the shape §8 sketched. **There is only this door.** The generated per-operation wrappers sit
55
+ * underneath and stay internal: they return raw MAX payloads, without the resend rule, the name
56
+ * filling or the id conversion that make this safe to point at a real account (`NEED-34`).
57
+ *
58
+ * One instance is one connection. `open` then `close`, always in a `finally`.
59
+ */
60
+ export declare class MaxClient {
61
+ #private;
62
+ constructor({ store, timeoutMs, connection, warn, record, offline, events, sleep, sends, reads, fullLogin, resume, }: MaxClientOptions);
63
+ readonly account: {
64
+ me: () => Promise<Profile>;
65
+ /** What the login carried: MAX sends the account's settings with it, so reading them asks nothing more. */
66
+ privacy: () => Promise<PrivacySettings>;
67
+ /** Only the owner's notifications change; `forever`, an ISO time, or null to hear the chat again. */
68
+ mute: (chatId: Id, until: string | null) => Promise<void>;
69
+ /** Only the settings named go out, under MAX's names; the answer is read back as `privacy` reads the login. */
70
+ updatePrivacy: (change: PrivacySettings) => Promise<PrivacySettings>;
71
+ /** Newest first. The web tab asks the same with the sync value it last kept; 0 is the whole history. */
72
+ calls: (limit: number) => Promise<Page<CallRecord>>;
73
+ /**
74
+ * Changes the profile everyone sees. **The name goes out whole**: the web client always sends
75
+ * the current first name, so a change to the description alone keeps it from the login.
76
+ */
77
+ update: (change: ProfileChange) => Promise<Profile>;
78
+ sessions: () => Promise<AccountSession[]>;
79
+ /**
80
+ * Logs every other device out — the owner's phone included — and keeps this one.
81
+ *
82
+ * PyMax reads a replacement token from the answer and the web client reads nothing (`RISK-25`),
83
+ * so both are handled: a token that came back is stored before anything is reported, and then
84
+ * the session is asked for once more, so a MAX that ended this one too says so here rather
85
+ * than on the next command.
86
+ */
87
+ endOtherSessions: () => Promise<AccountSession[]>;
88
+ };
89
+ /**
90
+ * Obtaining a token rather than using one. The token comes back to the caller, unstored and not yet
91
+ * tried: `adoptToken` logs in with it on a connection of its own before the keyring sees it, so
92
+ * a login that went wrong halfway cannot replace a working session.
93
+ */
94
+ readonly login: {
95
+ byQr: (options: QrLogin) => Promise<string>;
96
+ };
97
+ readonly chats: {
98
+ /**
99
+ * Chats come with the login; a limit trims rather than fetching more.
100
+ *
101
+ * **A one-to-one chat has no title of its own** — its name is the other person's, which MAX
102
+ * does not put in the chat object. So the partner is looked up once, for every dialog at a
103
+ * time, and the name is filled in. Without this, `max chats` shows a column of blanks for
104
+ * exactly the chats a person recognises by name.
105
+ */
106
+ list: (options?: PageRequest) => Promise<Page<Chat>>;
107
+ /**
108
+ * Turns what the person typed into a chat id.
109
+ *
110
+ * A number is taken as an id. Anything else is matched against chat titles, exactly first and
111
+ * then as a fragment — and **an ambiguous name is an error, not a guess**: sending to the wrong
112
+ * conversation is not undoable, so the caller is shown the candidates and asked to be specific.
113
+ */
114
+ resolve: (reference: string) => Promise<Id>;
115
+ /**
116
+ * One chat and who is in it, from the list the login just refreshed.
117
+ *
118
+ * ⚠ **An id is checked here, where `resolve` lets any number through** — for a read that is
119
+ * the difference between an answer and a card of nulls for a chat that does not exist.
120
+ */
121
+ show: (reference: string) => Promise<ChatCard>;
122
+ /** The other person in a one-to-one chat, by the chat's participants; `undefined` for anything else. */
123
+ partner: (chatId: Id) => Promise<Id | undefined>;
124
+ /**
125
+ * The owner and admins of a group, from the chat as the login carried it (`owner`, `admins`,
126
+ * `adminParticipants` — measured 2026-09-24, `FIND-116`). `undefined` when the login did not
127
+ * carry this chat or its admins: the login carries only chats that changed lately, and the rest
128
+ * come from the local copy.
129
+ */
130
+ adminIds: (chatId: Id) => Promise<Id[] | undefined>;
131
+ /**
132
+ * Who joined, left, was added or removed since a point: the service messages in the chat's
133
+ * history, read forward from `since` without reactions. At most `EVENTS_READ` messages, the oldest.
134
+ */
135
+ events: (reference: string, { since }?: {
136
+ since?: number;
137
+ }) => Promise<ChatEvents>;
138
+ /**
139
+ * A chat's history after `since`, oldest first and without reactions, at most `EVENTS_READ`
140
+ * messages; `more` when there was more than that.
141
+ */
142
+ since: (chatId: Id, since: number) => Promise<{
143
+ messages: Message[];
144
+ more: boolean;
145
+ }>;
146
+ /** What a link leads to, without joining it. */
147
+ inspect: (link: string) => Promise<GroupCard>;
148
+ /** Who asked to join a channel that approves joins. MAX says nothing of when, so `requestedAt` is null. */
149
+ joinRequests: (chatId: Id, { limit, search, link }: {
150
+ limit: number;
151
+ search?: string;
152
+ link?: string;
153
+ }) => Promise<Page<JoinRequest>>;
154
+ /** Lets one person in, or turns them away; the web client's 77 with `type: JOIN_REQUEST`. */
155
+ answerJoinRequest: (chatId: Id, personId: Id, accept: boolean) => Promise<{
156
+ already: boolean;
157
+ }>;
158
+ /**
159
+ * `requested` where the chat takes join requests: MAX answers the chat with `joinRequestTime` and
160
+ * without the owner among its participants (measured 2026-10-08 on a channel), and the owner is not in it yet.
161
+ */
162
+ join: (link: string) => Promise<GroupCard | {
163
+ requested: true;
164
+ }>;
165
+ /**
166
+ * Marks a chat read up to `messageId`, or up to its newest message. The one call here that
167
+ * sends `CHAT_MARK`; nothing that reads does (REQUIREMENTS §19). The other person sees it, so it
168
+ * passes the send guard like a pin, and is not retried.
169
+ */
170
+ markRead: (chatId: Id, messageId?: Id) => Promise<ReadMark>;
171
+ leave: (reference: string) => Promise<ChatChange>;
172
+ /** For this account only: the others in it keep the chat and its messages. */
173
+ delete: (reference: string) => Promise<ChatChange>;
174
+ /**
175
+ * A bot's link to the chat with it — one never opened included — and the `?start=` it carries.
176
+ * `undefined` for anything that is not a link to a bot. Asks MAX only for a link.
177
+ */
178
+ botLink: (reference: string) => Promise<{
179
+ chatId: Id;
180
+ payload?: string;
181
+ } | undefined>;
182
+ /** Starts the bot in a one-to-one chat, as its Start button does: a service message to it. */
183
+ startBot: (chatId: Id, cid: number, payload?: string) => Promise<void>;
184
+ /** The address of the bot's mini app. ⚠ It signs the owner in: returned to the caller, logged nowhere. */
185
+ app: (chatId: Id, startParam?: string) => Promise<{
186
+ url: string;
187
+ }>;
188
+ /** Every message, for this account only. */
189
+ clear: (reference: string) => Promise<ChatChange>;
190
+ /**
191
+ * Not retried, unlike a message: a second attempt with a new `cid` is a second group, and
192
+ * whether MAX deduplicates a creation by `cid` is not measured.
193
+ */
194
+ create: (title: string, people?: string[], { channel }?: {
195
+ channel?: boolean | undefined;
196
+ }) => Promise<GroupCard>;
197
+ members: {
198
+ /**
199
+ * Everyone in a group or channel, from MAX, page by page. Paging follows PyMax: each answer's
200
+ * `marker` asks for the next page, and none means the last. Stops at `MEMBERS_READ`, or when a
201
+ * page repeats its marker or brings nobody new, so a misread marker cannot loop.
202
+ */
203
+ list: (reference: string) => Promise<GroupMembers>;
204
+ page: (reference: string, window: {
205
+ limit?: number;
206
+ offset: number;
207
+ }) => Promise<{
208
+ items: GroupMember[];
209
+ hasMore: boolean;
210
+ chatId: string;
211
+ rolesKnown: boolean;
212
+ truncated: boolean;
213
+ readCount: number;
214
+ }>;
215
+ /** No history unless asked (`NEED-272`): what was said before somebody joined is not theirs by default. */
216
+ add: (reference: string, people: string[], { history }?: {
217
+ history?: boolean;
218
+ }) => Promise<ChatChange>;
219
+ remove: (reference: string, people: string[]) => Promise<ChatChange>;
220
+ };
221
+ admins: {
222
+ add: (reference: string, person: string, rights: AdminRight[]) => Promise<ChatChange>;
223
+ remove: (reference: string, person: string) => Promise<ChatChange>;
224
+ };
225
+ update: (reference: string, { title, description, photo }: {
226
+ title?: string;
227
+ description?: string;
228
+ photo?: SharedUpload;
229
+ }) => Promise<GroupCard>;
230
+ /** With no changes, reads the settings the login carried; nothing is sent. */
231
+ settings: (reference: string, changes?: Partial<GroupSettings>) => Promise<GroupCard>;
232
+ /** The old link stops working for everyone who has it. */
233
+ resetLink: (reference: string) => Promise<GroupCard>;
234
+ };
235
+ readonly contacts: {
236
+ /**
237
+ * Finds whoever MAX has under a phone number. A lookup, not an add: nothing changes on the
238
+ * account. ⚠ The number is never repeated in an error — it is the one field here the sixth
239
+ * constraint is about.
240
+ */
241
+ lookup: (phone: string) => Promise<Contact>;
242
+ add: (reference: string) => Promise<Contact>;
243
+ remove: (reference: string) => Promise<Contact>;
244
+ /** They can no longer write to you. Works for somebody who is not a contact too (measured). */
245
+ block: (reference: string) => Promise<Contact>;
246
+ unblock: (reference: string) => Promise<Contact>;
247
+ /** A name of your own for them, kept beside the one they chose; they do not see it. */
248
+ rename: (reference: string, firstName: string, lastName?: string) => Promise<Contact>;
249
+ /** Uploads phone numbers to MAX — other people's — under the names they were saved with. */
250
+ import: (entries: PhoneBookEntry[]) => Promise<ContactImport>;
251
+ /**
252
+ * One person and the chats we share, **whoever they are** — a group member is as findable as
253
+ * a contact. `NEED-105` decides who `list` lists, not who can be looked up.
254
+ *
255
+ * Only from the store: the shared chats are its `chat_members`, which nothing else holds.
256
+ */
257
+ show: (reference: string) => Promise<PersonCard>;
258
+ /**
259
+ * What MAX says about one person — one `CONTACT_INFO` — and the chats shared with them, from
260
+ * the store as `show` reads them.
261
+ */
262
+ profile: (reference: string) => Promise<ProfileFacts>;
263
+ /**
264
+ * **Start again from zero**: forget the marker, so this login asks for the whole collection
265
+ * rather than for what changed, and name everybody it mentions.
266
+ *
267
+ * It is a repair tool, not the way contacts arrive. The delta rides on the login every command
268
+ * already performs, so there is nothing to schedule and no budget to spend — what this is for
269
+ * is a store that has drifted, or a full re-take after a schema rebuild threw the rows away.
270
+ */
271
+ sync: () => Promise<SyncSummary & {
272
+ full: true;
273
+ }>;
274
+ };
275
+ readonly messages: {
276
+ /** A bot's keyboard under one message, row by row; `[]` for a message without one. */
277
+ buttons: (chatId: Id, messageId: Id) => Promise<Button[][]>;
278
+ /** Presses one callback button; the bot learns who pressed it. Only the attach's handle and the button's payload go. */
279
+ press: (chatId: Id, messageId: Id, row: number, column: number) => Promise<void>;
280
+ /**
281
+ * The chat's queue of scheduled messages, soonest first. Read-only: cancelling is `MSG_DELETE`,
282
+ * which nothing here sends. Never cached — the queue empties by itself as messages go out.
283
+ */
284
+ scheduled: (chatId: Id) => Promise<Message[]>;
285
+ /**
286
+ * **Paged backwards through time, not by page number.** MAX's history is already anchored —
287
+ * it takes a moment and answers with what came before it — so `--before` is exact where a page
288
+ * number over a live conversation would repeat and skip rows.
289
+ *
290
+ * `after` reads the other way and **leaves the anchor out**, so the next page's hint does not
291
+ * repeat a row. MAX puts it in — measured 2026-09-23, `forward: n` with `backward: 0` starts
292
+ * with the message it was given — so the window starts a millisecond later, and one more than the page is
293
+ * asked for to tell whether another follows. Asking from the moment itself spent that one on the anchor.
294
+ * `before` keeps the anchor, as it always has.
295
+ *
296
+ * `hasMore` here is a claim about the copy we hold, never about the chat. MAX's answer carries
297
+ * `messages` and nothing that says whether older ones exist, and a page can come back short in the
298
+ * middle of a chat, as Telegram's does. So a short page back is checked with one more request for a
299
+ * single older message; a full page is taken as more, and an empty one as the start.
300
+ */
301
+ list: (chatId: Id, options?: {
302
+ limit?: number;
303
+ before?: number;
304
+ after?: number;
305
+ reactions?: boolean;
306
+ }) => Promise<Page<Message>>;
307
+ /**
308
+ * **A chat's gallery**, as web.max.ru asks for it: messages that carry these kinds of attachment,
309
+ * read back from a message — the newest one, or `before`. Oldest first, like history.
310
+ */
311
+ media: (chatId: Id, kinds: MediaKind[], limit: number, before?: Id) => Promise<Page<Message>>;
312
+ /**
313
+ * **MAX's own text search, in one chat**, newest first as the server answers. It matches a word's
314
+ * beginning, not another form of a Russian word (measured 2026-10-07): the caller treats the answer
315
+ * as candidates. No reactions, no read marks.
316
+ */
317
+ search: (chatId: Id, query: string, limit: number) => Promise<Page<Message>>;
318
+ /**
319
+ * **One message and a window either side of it**, oldest first, the one asked for marked
320
+ * `anchor: true`.
321
+ *
322
+ * Measured 2026-09-22: from a message's own time, `backward: n` answers n messages ending with
323
+ * it and `forward: n` the n after it. Its time comes from its id, so no stored copy is needed.
324
+ * Correction 2026-09-23: that holds with `backward` above zero; with `backward: 0`, `forward`
325
+ * starts with the message itself (`messages.list` with `after` depends on the difference).
326
+ *
327
+ * ⚠ **A message that is gone is refused, not replaced by its neighbour** — MAX answers with
328
+ * whatever is nearest, and showing that as the message asked for would be a quiet lie.
329
+ */
330
+ around: (chatId: Id, messageId: Id, { before, after, reactions }?: {
331
+ before?: number;
332
+ after?: number;
333
+ reactions?: boolean;
334
+ }) => Promise<WindowedMessage[]>;
335
+ /**
336
+ * **Where each attachment of one message can be downloaded from.** A photo and an audio carry
337
+ * their link; a file and a video carry only an id, and MAX answers the link for it (measured
338
+ * 2026-09-23). A video is taken as its largest MP4 — the streaming renditions are playlists,
339
+ * not a file. An attachment with no link to give is left out and named in `skipped`.
340
+ */
341
+ links: (chatId: Id, messageId: Id) => Promise<{
342
+ links: AttachmentLink[];
343
+ skipped: string[];
344
+ }>;
345
+ /**
346
+ * Turns what `--before` or `--after` was given into a moment.
347
+ *
348
+ * **ISO 8601 is a time; a bare integer is a message id**, and a message id carries its own time
349
+ * (`timeOfMessageId`). Deciding between the two by length would be a trap that fires the first
350
+ * time either changes size, so the rule is what the string looks like.
351
+ */
352
+ moment: (reference: string, flag?: string) => number;
353
+ /**
354
+ * Sends one message, retrying **only with the same `cid`**.
355
+ *
356
+ * §17 allows a send to be retried when the protocol has a verified deduplication handle. It has
357
+ * one, measured against MAX on 2026-09-19: sending the same `cid` twice returned the same
358
+ * message id and left **one** copy in the chat — and it held across two separate connections
359
+ * and logins, which is the case a retry actually faces.
360
+ *
361
+ * So one retry, same `cid`, and nothing beyond that. What is still unmeasured is how long the
362
+ * server remembers a `cid`; the two probes were seconds apart. If the retry also fails the
363
+ * answer is `outcome_unknown` — never failed, never sent — and it names the `cid`, because
364
+ * `max messages send … --send-id <n>` can then repeat the attempt without risking a second message.
365
+ *
366
+ * **`at` queues it on MAX** (epoch ms), which sends it then even with this machine off. That is
367
+ * never retried: deduplication by `cid` was measured for ordinary messages only, and a second
368
+ * copy would surface later, where nobody is watching. The guard counts it now, when it is queued.
369
+ */
370
+ send: (chatId: Id, text: string, options?: {
371
+ cid?: number;
372
+ notify?: boolean;
373
+ replyTo?: Id;
374
+ markdown?: boolean;
375
+ files?: string[];
376
+ /** Send every file as a plain file, a video included — how a video went before `MAX-23`. */
377
+ asFile?: boolean;
378
+ /** An Ogg Opus file sent as a voice message, alone in its message. */
379
+ voice?: string;
380
+ /** A sticker's id, sent alone as web.max.ru sends one: `{_type: "STICKER", stickerId}`. */
381
+ sticker?: Id;
382
+ anyFile?: boolean;
383
+ at?: number;
384
+ /** Files already read and checked by the caller — the shared services read their own. */
385
+ uploads?: {
386
+ name: string;
387
+ bytes: Uint8Array;
388
+ kind: "photo" | "video" | "file" | "voice";
389
+ }[];
390
+ /** Marks already taken out of `text`, in MAX's names. */
391
+ markup?: Markup[];
392
+ }) => Promise<Message>;
393
+ /** Puts one emoji reaction on a message; it replaces the one you had. */
394
+ react: (chatId: Id, messageId: Id, emoji: string) => Promise<Reactions>;
395
+ /** Takes your reaction off. Measured 2026-09-24: a second call is answered the same, not refused. */
396
+ unreact: (chatId: Id, messageId: Id) => Promise<Reactions>;
397
+ /**
398
+ * Changes the text of one of the owner's own messages. The person may have read it already.
399
+ *
400
+ * **Its attachments are sent back as history gives them**: measured 2026-09-24, an edit with
401
+ * none removes a photo from the message. Refused before asking MAX when the message is not the
402
+ * owner's, is a forward, or carries anything but photos — the web client offers none of those. MAX's own limit is
403
+ * `edit-timeout` from LOGIN, 604800 s when measured; past it MAX refuses and that is the answer.
404
+ * Not retried, like a reaction.
405
+ */
406
+ edit: (chatId: Id, messageId: Id, text: string, { markdown, markup }?: {
407
+ markdown?: boolean;
408
+ markup?: Markup[];
409
+ }) => Promise<Message>;
410
+ /**
411
+ * Forwards one message into another chat: a new message there, so it goes through `#deliver`
412
+ * — the same `cid`, the same one retry — and counts against `sendsPerHour`.
413
+ */
414
+ forward: (fromChatId: Id, messageId: Id, toChatId: Id, options?: {
415
+ cid?: number;
416
+ notify?: boolean;
417
+ }) => Promise<Message>;
418
+ /**
419
+ * Deletes messages — for this account only, or with `forEveryone` for everyone in the chat. The
420
+ * owner's word is the command's `--allow-dangerous`; here it is the guard, and each message
421
+ * counts toward the hourly limit (`MAX-47`). Whose message it is, MAX decides: an admin may
422
+ * delete somebody else's in a group. Not retried, like an edit.
423
+ */
424
+ delete: (chatId: Id, messageIds: Id[], { forEveryone }?: {
425
+ forEveryone?: boolean | undefined;
426
+ }) => Promise<Deletion>;
427
+ /**
428
+ * Pins one message in a chat, or with `null` unpins whatever is pinned — `pinMessageId: 0` is
429
+ * how the web client unpins. No notification unless asked (`NEED-196`). Not retried.
430
+ *
431
+ * **Never in a personal chat**: the web client's dialog class answers `viewerCanPin` with `false`, and
432
+ * MAX refused both in Saved messages and in a dialog with a person (measured 2026-09-24, `FIND-107`).
433
+ * A chat the login did not list is left to MAX. In a group, pin and unpin were measured the same day.
434
+ */
435
+ pin: (chatId: Id, messageId: Id | null, { notify }?: {
436
+ notify?: boolean | undefined;
437
+ }) => Promise<Pin>;
438
+ };
439
+ /**
440
+ * **Polls: vote, take a vote back, close one's own, create one.** Every one of them is a write
441
+ * somebody else can see, so it passes the send guard and the journal under the kind of what it is:
442
+ * a vote is a `reaction`, closing is an `edit` of the owner's message, a new poll is a `message`.
443
+ * A vote is never retried — nothing measured makes a blind repeat safe.
444
+ *
445
+ * The shapes were measured in Saved messages on 2026-09-27 (`pnpm probe:polls`, `FIND-247`). The
446
+ * checks before sending are the web client's, so what it would refuse never reaches MAX.
447
+ */
448
+ readonly polls: {
449
+ /** One poll as it stands, read from its message; changes nothing. */
450
+ show: (chatId: Id, messageId: Id) => Promise<PollMessage>;
451
+ vote: (chatId: Id, messageId: Id, answerIds: Id[]) => Promise<PollMessage>;
452
+ /** Closes the owner's own poll: the web client edits the message with the `closed` bit raised. */
453
+ close: (chatId: Id, messageId: Id) => Promise<PollMessage>;
454
+ /**
455
+ * A new message whose one attachment is the poll — so it goes through `#deliver`, with its `cid`
456
+ * and its one retry, like any message.
457
+ */
458
+ create: (chatId: Id, question: string, answers: string[], options?: {
459
+ multiple?: boolean;
460
+ anonymous?: boolean;
461
+ revote?: boolean;
462
+ cid?: number;
463
+ notify?: boolean;
464
+ }) => Promise<Message>;
465
+ };
466
+ /** What the account has added, as web.max.ru reads it: the sections' set ids, then the sets, then their stickers. */
467
+ readonly stickers: {
468
+ sets: () => Promise<StickerSet[]>;
469
+ list: (setId: Id) => Promise<Sticker[]>;
470
+ };
471
+ readonly folders: {
472
+ list: () => Promise<Folder[]>;
473
+ create: (title: string, chats?: string[]) => Promise<Folder>;
474
+ /**
475
+ * **The folder goes back whole**, as the web client sends it: an edit that left out the chats
476
+ * would empty the folder. What MAX keeps for itself — `sourceId`, `updateTime` — is not sent.
477
+ */
478
+ update: (reference: string, change: FolderChange) => Promise<Folder>;
479
+ /**
480
+ * Every folder's id, in the new order. MAX keeps "all chats" first and refuses an order that
481
+ * changes nothing (`folder.order.all-folder-not-first`, `folder.order.same`, measured 2026-10-08),
482
+ * so the first is put back in front and the second is not sent.
483
+ */
484
+ order: (ids: string[]) => Promise<void>;
485
+ /** The folder only — its chats stay where they are. */
486
+ delete: (reference: string) => Promise<Folder>;
487
+ };
488
+ /**
489
+ * **For a connection that stays open** (`max serve`). A one-shot command never calls these.
490
+ */
491
+ readonly live: {
492
+ /** The keep-alive the web client sends every 30 s; `interactive` is never true here. */
493
+ ping: () => Promise<void>;
494
+ /**
495
+ * **The reads a web tab sends after every login** (`MAX-52`, recorded 2026-09-25), in its order
496
+ * and all at once, as it sends them: folders, banners, call history, then the four asset sets.
497
+ * Each carries the sync value its previous answer returned — 0 the first time — and the answers
498
+ * are kept only for those. `max serve` alone sends them; a one-shot command never did.
499
+ */
500
+ readLikeTab: (sync: TabSync) => Promise<TabSync>;
501
+ /**
502
+ * What a hidden web tab reports once, 20 s after it opened: the chat list, shown at `at`.
503
+ * `sessionId` is when the tab's connection began, and it survives the tab's reconnects.
504
+ */
505
+ chatListShown: ({ at, sessionId }: {
506
+ at: number;
507
+ sessionId: number;
508
+ }) => Promise<void>;
509
+ /**
510
+ * The login this connection holds, kept current from what MAX pushes — `max serve` hands it to
511
+ * a command as that command's own login.
512
+ */
513
+ snapshot: () => Payload;
514
+ /**
515
+ * What the next login on a new connection sends to pick up where this one is (`MAX-51`):
516
+ * `undefined` when this login lacks what that needs, and the next one is then a full login.
517
+ */
518
+ resumeFrom: () => ResumeFrom | undefined;
519
+ /**
520
+ * Keeps the snapshot current from one push. **`false` means it can no longer be trusted** and
521
+ * the server stops handing it out until it has logged in again. What web.max.ru does with each
522
+ * push (bundle read 2026-09-24) is what is copied here:
523
+ * - 128, a new message: the chat's last message and time move; unread goes up for somebody
524
+ * else's message and to zero for our own, as the app does once you have written in a chat.
525
+ * - 130, read up to a point: when we are the reader, the chat's unread becomes `unread`;
526
+ * somebody else reading changes nothing here.
527
+ * - 135, a chat changed: MAX sends the whole chat, and it replaces ours.
528
+ * - 134, the settings changed elsewhere — a mute, the privacy: `{config: {hash, user | chats}}`, folded in
529
+ * as our own change's answer is (measured 2026-10-08 with a second connection).
530
+ * Anything else that touches the chats — a deletion — cannot be followed.
531
+ */
532
+ patch: (opcode: number, payload: Payload) => boolean;
533
+ /**
534
+ * Whether a chat sent whole says something the held copy does not: a chat not held, or another
535
+ * title, description, member count, status, type, photo or owner. The rest — its last message, its
536
+ * unread count — changes with every message and is not a change to the chat.
537
+ */
538
+ news: (changed: Payload) => boolean;
539
+ /** A contact MAX answered with after our own change to it replaces the login's copy. */
540
+ contact: (changed: Payload) => void;
541
+ /** One request from a command, on this connection. The server decides which ones may pass. */
542
+ forward: (opcode: number, payload: Payload) => Promise<Payload>;
543
+ /**
544
+ * A message MAX pushed (opcode 128) as the same shape `messages list` prints, with its chat's
545
+ * name — so whoever reads `max watch` gets one schema, and no MAX type crosses this file.
546
+ * Anything else pushed answers `undefined`.
547
+ */
548
+ message: (opcode: number, payload: Payload) => Promise<MessageHit | undefined>;
549
+ /** An edit, a deletion or a reaction pushed by MAX, or `undefined` for anything else. */
550
+ change: (opcode: number, payload: Payload) => Promise<MessageChange | undefined>;
551
+ };
552
+ /**
553
+ * Opens the connection and logs in with the stored token, or with one offered for trial.
554
+ *
555
+ * The login response carries the profile, the chats, the contacts and recent messages, so most
556
+ * commands need no further request — measured against MAX on 2026-09-19.
557
+ *
558
+ * **A candidate token is tried and not stored**, which is what lets `adoptToken` write to the
559
+ * keyring only after MAX has accepted it. Nothing here writes a token; see `session/adopt.ts`.
560
+ */
561
+ connect({ token: candidate }?: {
562
+ token?: string;
563
+ }): Promise<void>;
564
+ /** Ends this session on MAX's side; the token stops working everywhere it was copied to. */
565
+ logout(): Promise<void>;
566
+ close(): Promise<void>;
567
+ takeApplied(operationId: string | undefined): boolean;
568
+ /** An id goes as given; a name is looked up in the store, and an ambiguous one is refused. */
569
+ people(references: string[]): Promise<Id[]>;
570
+ /** The `max serve` this client talks through, when it does — the server then journals each write. */
571
+ get server(): {
572
+ readonly journals: boolean;
573
+ } | undefined;
574
+ /** A send id as MAX's own client makes one: the moment, in milliseconds, never repeated. */
575
+ newSendId(): string;
576
+ }
577
+ /** What a change to a chat answers when MAX sends back no chat of its own. */
578
+ export interface ChatChange {
579
+ chatId: Id;
580
+ action: ChatAction;
581
+ people: Id[];
582
+ chat: GroupCard | null;
583
+ }
584
+ export type AdminRight = "read" | "members" | "admins" | "info" | "pin" | "link" | "post" | "edit" | "delete";
585
+ /**
586
+ * PyMax `AdminPermission`; the sum is what MAX takes. `read` and `link` measured 2026-09-27 by
587
+ * switching them in the app for a bot and reading its `permissions` back (`MAX-61`): «Read messages»
588
+ * sets 1 and 32 together — the Bot API calls them `read_all_messages` and `write` — and «Update chat
589
+ * link» 128. A bot without `read` sees no message of the group.
590
+ */
591
+ export declare const ADMIN_RIGHTS: Record<AdminRight, number>;
592
+ /**
593
+ * A private link goes as `join/<token>`, whatever came before it, as PyMax sends it and as
594
+ * measured. A public one (`https://max.ru/<name>`) goes whole, which is PyMax's claim only.
595
+ */
596
+ export declare const wireLink: (link: string) => string;
597
+ /** What every listing takes. Absent means "the caller did not say", never a number chosen here. */
598
+ export interface PageRequest {
599
+ limit?: number;
600
+ offset?: number;
601
+ /** Part of a name. Refused below three characters — see `checkedQuery`. */
602
+ query?: string;
603
+ kind?: ChatKind;
604
+ /** Only chats MAX counts unread messages in; a chat where it did not say is not one of them. */
605
+ unread?: boolean;
606
+ }
607
+ /**
608
+ * When a message was sent, read from its id: **`id >> 16` is the send time in milliseconds**, the
609
+ * low 16 bits a counter. Measured 2026-09-22 on three messages across two days, exact every time.
610
+ * `undefined` for anything that is not a message id.
611
+ */
612
+ export declare const timeOfMessageId: (id: Id) => number | undefined;
613
+ /** How far back `chats events` looks without `since`. */
614
+ export declare const EVENTS_DAYS = 7;
615
+ /** What `readLikeTab` sends back to MAX on the next login. */
616
+ export interface TabSync {
617
+ folders: number;
618
+ calls: number;
619
+ assets: Partial<Record<(typeof ASSET_TYPES)[number], number>>;
620
+ }
621
+ export declare const FIRST_TAB_SYNC: TabSync;
622
+ export interface ResumeFrom {
623
+ login: Resume;
624
+ chats: Payload[];
625
+ }
626
+ /** Bounded so that deleting a long history is many spread-out calls, never one sweep (`MAX-47`). */
627
+ export declare const DELETE_AT_ONCE = 10;
628
+ /** A join that only asked: MAX stamps the request and leaves the owner out of the participants. */
629
+ export declare const isJoinRequest: (chat: Payload) => boolean;
630
+ /** Before any request: a login inside the pause is one more attempt MAX counts (`MAX-38`). */
631
+ export declare const refuseWhilePaused: (state: SessionState) => void;
632
+ export interface ProfileChange {
633
+ firstName?: string;
634
+ lastName?: string;
635
+ description?: string;
636
+ /** Uploaded first, so a failed upload leaves the profile as it was. */
637
+ photo?: string | SharedUpload;
638
+ }
639
+ export interface FolderChange {
640
+ title?: string;
641
+ add?: string[];
642
+ remove?: string[];
643
+ }
644
+ export interface PhoneBookEntry {
645
+ phone: string;
646
+ name: string;
647
+ }
648
+ /** `+` and digits, as the lookup was measured. ⚠ The refusal never repeats what was typed. */
649
+ export declare const wirePhone: (typed: string) => string;
650
+ //# sourceMappingURL=client.d.ts.map