@withbuddi/buddi 0.1.0-pre.52 → 0.1.0-pre.54

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 (552) hide show
  1. package/extension/background.js +38 -7
  2. package/extension/manifest.json +2 -2
  3. package/extension/popup.html +2 -2
  4. package/node_modules/@buddi/cli/dist/.tsbuildinfo +1 -1
  5. package/node_modules/@buddi/cli/dist/dashboard-cmd.d.ts.map +1 -1
  6. package/node_modules/@buddi/cli/dist/dashboard-cmd.js +6 -3
  7. package/node_modules/@buddi/cli/dist/dashboard-cmd.js.map +1 -1
  8. package/node_modules/@buddi/cli/dist/main.js +2 -2
  9. package/node_modules/@buddi/cli/dist/main.js.map +1 -1
  10. package/node_modules/@buddi/cli/dist/status.d.ts +16 -2
  11. package/node_modules/@buddi/cli/dist/status.d.ts.map +1 -1
  12. package/node_modules/@buddi/cli/dist/status.js +42 -2
  13. package/node_modules/@buddi/cli/dist/status.js.map +1 -1
  14. package/node_modules/@buddi/core/dist/.tsbuildinfo +1 -1
  15. package/node_modules/@buddi/core/dist/agents/catalog.d.ts +6 -0
  16. package/node_modules/@buddi/core/dist/agents/catalog.d.ts.map +1 -1
  17. package/node_modules/@buddi/core/dist/agents/catalog.js +1 -1
  18. package/node_modules/@buddi/core/dist/agents/catalog.js.map +1 -1
  19. package/node_modules/@buddi/core/dist/backup/archive.d.ts +6 -0
  20. package/node_modules/@buddi/core/dist/backup/archive.d.ts.map +1 -1
  21. package/node_modules/@buddi/core/dist/backup/archive.js +19 -6
  22. package/node_modules/@buddi/core/dist/backup/archive.js.map +1 -1
  23. package/node_modules/@buddi/core/dist/postgres/binaries.d.ts +21 -1
  24. package/node_modules/@buddi/core/dist/postgres/binaries.d.ts.map +1 -1
  25. package/node_modules/@buddi/core/dist/postgres/binaries.js +72 -10
  26. package/node_modules/@buddi/core/dist/postgres/binaries.js.map +1 -1
  27. package/node_modules/@buddi/core/dist/postgres/cluster.d.ts +8 -0
  28. package/node_modules/@buddi/core/dist/postgres/cluster.d.ts.map +1 -1
  29. package/node_modules/@buddi/core/dist/postgres/cluster.js +119 -17
  30. package/node_modules/@buddi/core/dist/postgres/cluster.js.map +1 -1
  31. package/node_modules/@buddi/core/dist/postgres/windows-guard.d.ts +20 -0
  32. package/node_modules/@buddi/core/dist/postgres/windows-guard.d.ts.map +1 -0
  33. package/node_modules/@buddi/core/dist/postgres/windows-guard.js +140 -0
  34. package/node_modules/@buddi/core/dist/postgres/windows-guard.js.map +1 -0
  35. package/node_modules/@buddi/gateway/dist/.tsbuildinfo +1 -1
  36. package/node_modules/@buddi/gateway/dist/agents/catalog.d.ts.map +1 -1
  37. package/node_modules/@buddi/gateway/dist/agents/catalog.js +3 -2
  38. package/node_modules/@buddi/gateway/dist/agents/catalog.js.map +1 -1
  39. package/node_modules/@buddi/gateway/dist/agents/catalogue-package.d.ts +2 -2
  40. package/node_modules/@buddi/gateway/dist/agents/catalogue-package.d.ts.map +1 -1
  41. package/node_modules/@buddi/gateway/dist/agents/catalogue-package.js +1 -1
  42. package/node_modules/@buddi/gateway/dist/agents/catalogue-package.js.map +1 -1
  43. package/node_modules/@buddi/gateway/dist/agents/platform-catalogue.d.ts +6 -6
  44. package/node_modules/@buddi/gateway/dist/agents/platform-catalogue.d.ts.map +1 -1
  45. package/node_modules/@buddi/gateway/dist/agents/platform-catalogue.js +5 -5
  46. package/node_modules/@buddi/gateway/dist/agents/platform-catalogue.js.map +1 -1
  47. package/node_modules/@buddi/gateway/dist/browser-host.js +1 -1
  48. package/node_modules/@buddi/gateway/dist/browser-host.js.map +1 -1
  49. package/node_modules/@buddi/gateway/dist/missions/chrome-scope.d.ts +10 -10
  50. package/node_modules/@buddi/gateway/dist/missions/chrome-scope.d.ts.map +1 -1
  51. package/node_modules/@buddi/gateway/dist/missions/chrome-scope.js +20 -20
  52. package/node_modules/@buddi/gateway/dist/missions/chrome-scope.js.map +1 -1
  53. package/node_modules/@buddi/gateway/dist/missions/execute.d.ts +2 -2
  54. package/node_modules/@buddi/gateway/dist/missions/execute.d.ts.map +1 -1
  55. package/node_modules/@buddi/gateway/dist/missions/execute.js +11 -11
  56. package/node_modules/@buddi/gateway/dist/missions/execute.js.map +1 -1
  57. package/node_modules/@buddi/gateway/dist/missions/reminders.d.ts +2 -2
  58. package/node_modules/@buddi/gateway/dist/missions/reminders.d.ts.map +1 -1
  59. package/node_modules/@buddi/gateway/dist/missions/reminders.js +5 -5
  60. package/node_modules/@buddi/gateway/dist/missions/reminders.js.map +1 -1
  61. package/node_modules/@buddi/gateway/dist/owner-notify.js +1 -1
  62. package/node_modules/@buddi/gateway/dist/owner-notify.js.map +1 -1
  63. package/node_modules/@buddi/gateway/dist/plugins/npm.d.ts +9 -2
  64. package/node_modules/@buddi/gateway/dist/plugins/npm.d.ts.map +1 -1
  65. package/node_modules/@buddi/gateway/dist/plugins/npm.js +29 -6
  66. package/node_modules/@buddi/gateway/dist/plugins/npm.js.map +1 -1
  67. package/node_modules/@buddi/gateway/dist/plugins/stage.d.ts.map +1 -1
  68. package/node_modules/@buddi/gateway/dist/plugins/stage.js +2 -2
  69. package/node_modules/@buddi/gateway/dist/plugins/stage.js.map +1 -1
  70. package/node_modules/@buddi/gateway/dist/serve.js +1 -1
  71. package/node_modules/@buddi/gateway/dist/serve.js.map +1 -1
  72. package/node_modules/@buddi/gateway/dist/surfaces/browser-cards.d.ts +1 -1
  73. package/node_modules/@buddi/gateway/dist/surfaces/browser-cards.js +1 -1
  74. package/node_modules/@buddi/gateway/dist/system-context.d.ts +11 -0
  75. package/node_modules/@buddi/gateway/dist/system-context.d.ts.map +1 -1
  76. package/node_modules/@buddi/gateway/dist/system-context.js +42 -1
  77. package/node_modules/@buddi/gateway/dist/system-context.js.map +1 -1
  78. package/node_modules/@buddi/gateway/dist/telegram/approvals.js +1 -1
  79. package/node_modules/@buddi/gateway/dist/telegram/approvals.js.map +1 -1
  80. package/node_modules/@buddi/gateway/dist/telegram/browser-view.js +1 -1
  81. package/node_modules/@buddi/gateway/dist/telegram/browser-view.js.map +1 -1
  82. package/node_modules/@buddi/gateway/dist/web/api-routes.js +6 -6
  83. package/node_modules/@buddi/gateway/dist/web/api-routes.js.map +1 -1
  84. package/node_modules/@buddi/gateway/dist/web/approval-ask.js +1 -1
  85. package/node_modules/@buddi/gateway/dist/web/extension.d.ts +6 -0
  86. package/node_modules/@buddi/gateway/dist/web/extension.d.ts.map +1 -1
  87. package/node_modules/@buddi/gateway/dist/web/extension.js +22 -11
  88. package/node_modules/@buddi/gateway/dist/web/extension.js.map +1 -1
  89. package/node_modules/@buddi/gateway/dist/web/read.d.ts +1 -1
  90. package/node_modules/@buddi/gateway/dist/web/read.d.ts.map +1 -1
  91. package/node_modules/@buddi/gateway/dist/web/server.js +4 -4
  92. package/node_modules/@buddi/gateway/dist/web/server.js.map +1 -1
  93. package/node_modules/@buddi/gateway/dist/web/service.d.ts +6 -1
  94. package/node_modules/@buddi/gateway/dist/web/service.d.ts.map +1 -1
  95. package/node_modules/@buddi/gateway/dist/web/service.js +10 -1
  96. package/node_modules/@buddi/gateway/dist/web/service.js.map +1 -1
  97. package/node_modules/@buddi/gateway/dist/web/skills.d.ts.map +1 -1
  98. package/node_modules/@buddi/gateway/dist/web/skills.js +2 -1
  99. package/node_modules/@buddi/gateway/dist/web/skills.js.map +1 -1
  100. package/node_modules/@buddi/gateway/dist/web/write.d.ts +1 -1
  101. package/node_modules/@buddi/gateway/dist/web/write.js +1 -1
  102. package/node_modules/@buddi/install/dist/.tsbuildinfo +1 -1
  103. package/node_modules/@buddi/install/dist/app-layout.d.ts +53 -0
  104. package/node_modules/@buddi/install/dist/app-layout.d.ts.map +1 -1
  105. package/node_modules/@buddi/install/dist/app-layout.js +123 -10
  106. package/node_modules/@buddi/install/dist/app-layout.js.map +1 -1
  107. package/node_modules/@buddi/install/dist/cloudflared.js +2 -2
  108. package/node_modules/@buddi/install/dist/cloudflared.js.map +1 -1
  109. package/node_modules/@buddi/install/dist/environment.d.ts +40 -1
  110. package/node_modules/@buddi/install/dist/environment.d.ts.map +1 -1
  111. package/node_modules/@buddi/install/dist/environment.js +158 -12
  112. package/node_modules/@buddi/install/dist/environment.js.map +1 -1
  113. package/node_modules/@buddi/install/dist/launcher.d.ts.map +1 -1
  114. package/node_modules/@buddi/install/dist/launcher.js +340 -54
  115. package/node_modules/@buddi/install/dist/launcher.js.map +1 -1
  116. package/node_modules/@buddi/install/dist/linux-install.d.ts +41 -0
  117. package/node_modules/@buddi/install/dist/linux-install.d.ts.map +1 -0
  118. package/node_modules/@buddi/install/dist/linux-install.js +86 -0
  119. package/node_modules/@buddi/install/dist/linux-install.js.map +1 -0
  120. package/node_modules/@buddi/install/dist/postgres-check.js +1 -1
  121. package/node_modules/@buddi/install/dist/postgres-check.js.map +1 -1
  122. package/node_modules/@buddi/install/dist/product-uninstall.d.ts +14 -0
  123. package/node_modules/@buddi/install/dist/product-uninstall.d.ts.map +1 -1
  124. package/node_modules/@buddi/install/dist/product-uninstall.js +10 -0
  125. package/node_modules/@buddi/install/dist/product-uninstall.js.map +1 -1
  126. package/node_modules/@buddi/install/dist/runtime-info.d.ts +23 -0
  127. package/node_modules/@buddi/install/dist/runtime-info.d.ts.map +1 -0
  128. package/node_modules/@buddi/install/dist/runtime-info.js +72 -0
  129. package/node_modules/@buddi/install/dist/runtime-info.js.map +1 -0
  130. package/node_modules/@buddi/install/dist/supervisor.d.ts +60 -3
  131. package/node_modules/@buddi/install/dist/supervisor.d.ts.map +1 -1
  132. package/node_modules/@buddi/install/dist/supervisor.js +175 -17
  133. package/node_modules/@buddi/install/dist/supervisor.js.map +1 -1
  134. package/node_modules/@buddi/install/dist/uninstall.d.ts +49 -3
  135. package/node_modules/@buddi/install/dist/uninstall.d.ts.map +1 -1
  136. package/node_modules/@buddi/install/dist/uninstall.js +184 -27
  137. package/node_modules/@buddi/install/dist/uninstall.js.map +1 -1
  138. package/node_modules/@buddi/install/dist/upgrade.d.ts +20 -5
  139. package/node_modules/@buddi/install/dist/upgrade.d.ts.map +1 -1
  140. package/node_modules/@buddi/install/dist/upgrade.js +125 -62
  141. package/node_modules/@buddi/install/dist/upgrade.js.map +1 -1
  142. package/node_modules/@buddi/install/dist/windows-install.d.ts +102 -0
  143. package/node_modules/@buddi/install/dist/windows-install.d.ts.map +1 -0
  144. package/node_modules/@buddi/install/dist/windows-install.js +223 -0
  145. package/node_modules/@buddi/install/dist/windows-install.js.map +1 -0
  146. package/node_modules/@buddi/install/dist/windows-setup.d.ts +107 -0
  147. package/node_modules/@buddi/install/dist/windows-setup.d.ts.map +1 -0
  148. package/node_modules/@buddi/install/dist/windows-setup.js +700 -0
  149. package/node_modules/@buddi/install/dist/windows-setup.js.map +1 -0
  150. package/node_modules/@buddi/install/dist/windows-task.d.ts +49 -0
  151. package/node_modules/@buddi/install/dist/windows-task.d.ts.map +1 -0
  152. package/node_modules/@buddi/install/dist/windows-task.js +167 -0
  153. package/node_modules/@buddi/install/dist/windows-task.js.map +1 -0
  154. package/node_modules/@buddi/runtime/dist/.tsbuildinfo +1 -1
  155. package/node_modules/@buddi/runtime/dist/codex-direct.d.ts +1 -1
  156. package/node_modules/@buddi/runtime/dist/codex-direct.js +1 -1
  157. package/node_modules/@buddi/runtime/dist/openai.d.ts +11 -0
  158. package/node_modules/@buddi/runtime/dist/openai.d.ts.map +1 -1
  159. package/node_modules/@buddi/runtime/dist/openai.js +36 -3
  160. package/node_modules/@buddi/runtime/dist/openai.js.map +1 -1
  161. package/node_modules/@buddi/tool-artifacts/dist/.tsbuildinfo +1 -1
  162. package/node_modules/@buddi/tool-artifacts/dist/tools/write.js +3 -3
  163. package/node_modules/@buddi/tool-artifacts/dist/tools/write.js.map +1 -1
  164. package/node_modules/@buddi/tool-browser/dist/.tsbuildinfo +1 -1
  165. package/node_modules/@buddi/tool-browser/dist/availability.d.ts.map +1 -1
  166. package/node_modules/@buddi/tool-browser/dist/availability.js +1 -0
  167. package/node_modules/@buddi/tool-browser/dist/availability.js.map +1 -1
  168. package/node_modules/@buddi/tool-browser/dist/brand.d.ts +19 -0
  169. package/node_modules/@buddi/tool-browser/dist/brand.d.ts.map +1 -0
  170. package/node_modules/@buddi/tool-browser/dist/brand.js +31 -0
  171. package/node_modules/@buddi/tool-browser/dist/brand.js.map +1 -0
  172. package/node_modules/@buddi/tool-browser/dist/controller.d.ts +2 -2
  173. package/node_modules/@buddi/tool-browser/dist/controller.d.ts.map +1 -1
  174. package/node_modules/@buddi/tool-browser/dist/controller.js +16 -7
  175. package/node_modules/@buddi/tool-browser/dist/controller.js.map +1 -1
  176. package/node_modules/@buddi/tool-browser/dist/downloads.js +1 -1
  177. package/node_modules/@buddi/tool-browser/dist/downloads.js.map +1 -1
  178. package/node_modules/@buddi/tool-browser/dist/extension.d.ts +3 -1
  179. package/node_modules/@buddi/tool-browser/dist/extension.d.ts.map +1 -1
  180. package/node_modules/@buddi/tool-browser/dist/extension.js +4 -4
  181. package/node_modules/@buddi/tool-browser/dist/extension.js.map +1 -1
  182. package/node_modules/@buddi/tool-browser/dist/index.d.ts +3 -2
  183. package/node_modules/@buddi/tool-browser/dist/index.d.ts.map +1 -1
  184. package/node_modules/@buddi/tool-browser/dist/index.js +7 -6
  185. package/node_modules/@buddi/tool-browser/dist/index.js.map +1 -1
  186. package/node_modules/@buddi/tool-browser/dist/routes.d.ts +12 -1
  187. package/node_modules/@buddi/tool-browser/dist/routes.d.ts.map +1 -1
  188. package/node_modules/@buddi/tool-browser/dist/routes.js +31 -14
  189. package/node_modules/@buddi/tool-browser/dist/routes.js.map +1 -1
  190. package/node_modules/@buddi/tool-browser/dist/service.d.ts +2 -0
  191. package/node_modules/@buddi/tool-browser/dist/service.d.ts.map +1 -1
  192. package/node_modules/@buddi/tool-browser/dist/service.js +6 -6
  193. package/node_modules/@buddi/tool-browser/dist/service.js.map +1 -1
  194. package/node_modules/@buddi/tool-browser/dist/telemetry.d.ts +2 -2
  195. package/node_modules/@buddi/tool-browser/dist/telemetry.js +2 -2
  196. package/node_modules/@buddi/tool-browser/dist/telemetry.js.map +1 -1
  197. package/node_modules/@buddi/tool-browser/dist/types.js +1 -1
  198. package/node_modules/@buddi/tool-browser/dist/types.js.map +1 -1
  199. package/node_modules/@buddi/tool-host/dist/.tsbuildinfo +1 -1
  200. package/node_modules/@buddi/tool-host/dist/index.d.ts +2 -1
  201. package/node_modules/@buddi/tool-host/dist/index.d.ts.map +1 -1
  202. package/node_modules/@buddi/tool-host/dist/index.js +11 -2
  203. package/node_modules/@buddi/tool-host/dist/index.js.map +1 -1
  204. package/node_modules/@buddi/tool-host/dist/process.d.ts +58 -1
  205. package/node_modules/@buddi/tool-host/dist/process.d.ts.map +1 -1
  206. package/node_modules/@buddi/tool-host/dist/process.js +229 -15
  207. package/node_modules/@buddi/tool-host/dist/process.js.map +1 -1
  208. package/node_modules/@buddi/tool-host/dist/service.d.ts +2 -0
  209. package/node_modules/@buddi/tool-host/dist/service.d.ts.map +1 -1
  210. package/node_modules/@buddi/tool-host/dist/service.js +8 -6
  211. package/node_modules/@buddi/tool-host/dist/service.js.map +1 -1
  212. package/node_modules/@buddi/tool-host/dist/skill-run.d.ts +10 -0
  213. package/node_modules/@buddi/tool-host/dist/skill-run.d.ts.map +1 -1
  214. package/node_modules/@buddi/tool-host/dist/skill-run.js +14 -0
  215. package/node_modules/@buddi/tool-host/dist/skill-run.js.map +1 -1
  216. package/node_modules/@hono/node-server/package.json +2 -2
  217. package/node_modules/@types/node/README.md +1 -1
  218. package/node_modules/@types/node/package.json +2 -2
  219. package/node_modules/@types/node/util.d.ts +6 -3
  220. package/node_modules/content-disposition/README.md +105 -35
  221. package/node_modules/content-disposition/dist/index.d.ts +72 -0
  222. package/node_modules/content-disposition/dist/index.js +388 -0
  223. package/node_modules/content-disposition/dist/index.js.map +1 -0
  224. package/node_modules/content-disposition/package.json +31 -19
  225. package/node_modules/docx/dist/index.cjs +182 -80
  226. package/node_modules/docx/dist/index.d.cts +63 -6
  227. package/node_modules/docx/dist/index.d.ts +63 -6
  228. package/node_modules/docx/dist/index.iife.js +182 -80
  229. package/node_modules/docx/dist/index.mjs +182 -80
  230. package/node_modules/docx/dist/index.umd.cjs +182 -80
  231. package/node_modules/docx/dist/layout.cjs +1 -6
  232. package/node_modules/docx/dist/layout.iife.js +1 -6
  233. package/node_modules/docx/dist/layout.mjs +1 -6
  234. package/node_modules/docx/dist/layout.umd.cjs +1 -6
  235. package/node_modules/docx/package.json +4 -3
  236. package/node_modules/express/Readme.md +15 -9
  237. package/node_modules/express/lib/application.js +2 -2
  238. package/node_modules/express/lib/request.js +32 -19
  239. package/node_modules/express/lib/response.js +27 -30
  240. package/node_modules/express/node_modules/content-type/LICENSE +22 -0
  241. package/node_modules/express/node_modules/content-type/README.md +71 -0
  242. package/node_modules/express/node_modules/content-type/dist/index.d.ts +46 -0
  243. package/node_modules/express/node_modules/content-type/dist/index.js +176 -0
  244. package/node_modules/express/node_modules/content-type/dist/index.js.map +1 -0
  245. package/node_modules/express/node_modules/content-type/package.json +52 -0
  246. package/node_modules/express/package.json +10 -10
  247. package/node_modules/imapflow/CHANGELOG.md +33 -0
  248. package/node_modules/imapflow/dist/cjs/commands/append.d.ts +1 -1
  249. package/node_modules/imapflow/dist/cjs/commands/append.js +15 -4
  250. package/node_modules/imapflow/dist/cjs/commands/compress.js +2 -2
  251. package/node_modules/imapflow/dist/cjs/commands/id.js +5 -3
  252. package/node_modules/imapflow/dist/cjs/commands/idle.js +9 -9
  253. package/node_modules/imapflow/dist/cjs/commands/list.js +2 -2
  254. package/node_modules/imapflow/dist/cjs/commands/namespace.js +18 -14
  255. package/node_modules/imapflow/dist/cjs/commands/quota.js +2 -3
  256. package/node_modules/imapflow/dist/cjs/commands/status.js +2 -4
  257. package/node_modules/imapflow/dist/cjs/connection-deadline.d.ts +1 -1
  258. package/node_modules/imapflow/dist/cjs/connection-deadline.js +2 -4
  259. package/node_modules/imapflow/dist/cjs/download.js +66 -35
  260. package/node_modules/imapflow/dist/cjs/errors.d.ts +15 -0
  261. package/node_modules/imapflow/dist/cjs/errors.js +22 -0
  262. package/node_modules/imapflow/dist/cjs/handler/imap-compiler.d.ts +4 -4
  263. package/node_modules/imapflow/dist/cjs/handler/imap-compiler.js +18 -18
  264. package/node_modules/imapflow/dist/cjs/handler/imap-parser.js +28 -3
  265. package/node_modules/imapflow/dist/cjs/handler/imap-stream.js +9 -8
  266. package/node_modules/imapflow/dist/cjs/handler/limits.d.ts +1 -1
  267. package/node_modules/imapflow/dist/cjs/handler/limits.js +5 -7
  268. package/node_modules/imapflow/dist/cjs/handler/parser-instance.js +23 -38
  269. package/node_modules/imapflow/dist/cjs/handler/token-parser.d.ts +12 -0
  270. package/node_modules/imapflow/dist/cjs/handler/token-parser.js +44 -104
  271. package/node_modules/imapflow/dist/cjs/imap-flow.d.ts +4 -3
  272. package/node_modules/imapflow/dist/cjs/imap-flow.js +98 -72
  273. package/node_modules/imapflow/dist/cjs/package-info.d.ts +1 -1
  274. package/node_modules/imapflow/dist/cjs/package-info.js +1 -1
  275. package/node_modules/imapflow/dist/cjs/proxy-connection.js +2 -5
  276. package/node_modules/imapflow/dist/cjs/search-compiler.js +2 -3
  277. package/node_modules/imapflow/dist/cjs/tools.d.ts +14 -3
  278. package/node_modules/imapflow/dist/cjs/tools.js +30 -18
  279. package/node_modules/imapflow/dist/cjs/types.d.ts +11 -0
  280. package/node_modules/imapflow/dist/esm/commands/append.d.ts +1 -1
  281. package/node_modules/imapflow/dist/esm/commands/append.js +15 -4
  282. package/node_modules/imapflow/dist/esm/commands/compress.js +2 -2
  283. package/node_modules/imapflow/dist/esm/commands/id.js +6 -4
  284. package/node_modules/imapflow/dist/esm/commands/idle.js +9 -9
  285. package/node_modules/imapflow/dist/esm/commands/list.js +3 -3
  286. package/node_modules/imapflow/dist/esm/commands/namespace.js +19 -15
  287. package/node_modules/imapflow/dist/esm/commands/quota.js +3 -4
  288. package/node_modules/imapflow/dist/esm/commands/status.js +2 -4
  289. package/node_modules/imapflow/dist/esm/connection-deadline.d.ts +1 -1
  290. package/node_modules/imapflow/dist/esm/connection-deadline.js +2 -4
  291. package/node_modules/imapflow/dist/esm/download.js +66 -35
  292. package/node_modules/imapflow/dist/esm/errors.d.ts +15 -0
  293. package/node_modules/imapflow/dist/esm/errors.js +21 -0
  294. package/node_modules/imapflow/dist/esm/handler/imap-compiler.d.ts +4 -4
  295. package/node_modules/imapflow/dist/esm/handler/imap-compiler.js +18 -18
  296. package/node_modules/imapflow/dist/esm/handler/imap-parser.js +28 -3
  297. package/node_modules/imapflow/dist/esm/handler/imap-stream.js +9 -8
  298. package/node_modules/imapflow/dist/esm/handler/limits.d.ts +1 -1
  299. package/node_modules/imapflow/dist/esm/handler/limits.js +5 -7
  300. package/node_modules/imapflow/dist/esm/handler/parser-instance.js +23 -38
  301. package/node_modules/imapflow/dist/esm/handler/token-parser.d.ts +12 -0
  302. package/node_modules/imapflow/dist/esm/handler/token-parser.js +44 -104
  303. package/node_modules/imapflow/dist/esm/imap-flow.d.ts +4 -3
  304. package/node_modules/imapflow/dist/esm/imap-flow.js +99 -73
  305. package/node_modules/imapflow/dist/esm/package-info.d.ts +1 -1
  306. package/node_modules/imapflow/dist/esm/package-info.js +1 -1
  307. package/node_modules/imapflow/dist/esm/proxy-connection.js +2 -5
  308. package/node_modules/imapflow/dist/esm/search-compiler.js +2 -3
  309. package/node_modules/imapflow/dist/esm/tools.d.ts +14 -3
  310. package/node_modules/imapflow/dist/esm/tools.js +30 -19
  311. package/node_modules/imapflow/dist/esm/types.d.ts +11 -0
  312. package/node_modules/imapflow/package.json +6 -3
  313. package/node_modules/ip-address/README.md +70 -70
  314. package/node_modules/ip-address/dist/ipv6.js +7 -4
  315. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  316. package/node_modules/ip-address/dist/v6/constants.d.ts +3 -0
  317. package/node_modules/ip-address/dist/v6/constants.js +3 -0
  318. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  319. package/node_modules/ip-address/package.json +2 -1
  320. package/node_modules/marked/bin/main.js +1 -1
  321. package/node_modules/marked/lib/marked.d.ts +6 -3
  322. package/node_modules/marked/lib/marked.esm.js +48 -50
  323. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  324. package/node_modules/marked/lib/marked.umd.js +45 -47
  325. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  326. package/node_modules/marked/man/marked.1 +1 -1
  327. package/node_modules/marked/package.json +1 -1
  328. package/node_modules/process-warning/.github/workflows/ci.yml +1 -1
  329. package/node_modules/process-warning/.github/workflows/lock-threads.yml +1 -1
  330. package/node_modules/process-warning/.github/workflows/release.yml +24 -0
  331. package/node_modules/process-warning/README.md +46 -46
  332. package/node_modules/process-warning/package.json +1 -1
  333. package/package.json +2 -2
  334. package/packages/cli/dist/.tsbuildinfo +1 -1
  335. package/packages/cli/dist/dashboard-cmd.d.ts.map +1 -1
  336. package/packages/cli/dist/dashboard-cmd.js +6 -3
  337. package/packages/cli/dist/dashboard-cmd.js.map +1 -1
  338. package/packages/cli/dist/main.js +2 -2
  339. package/packages/cli/dist/main.js.map +1 -1
  340. package/packages/cli/dist/status.d.ts +16 -2
  341. package/packages/cli/dist/status.d.ts.map +1 -1
  342. package/packages/cli/dist/status.js +42 -2
  343. package/packages/cli/dist/status.js.map +1 -1
  344. package/packages/core/dist/.tsbuildinfo +1 -1
  345. package/packages/core/dist/agents/catalog.d.ts +6 -0
  346. package/packages/core/dist/agents/catalog.d.ts.map +1 -1
  347. package/packages/core/dist/agents/catalog.js +1 -1
  348. package/packages/core/dist/agents/catalog.js.map +1 -1
  349. package/packages/core/dist/backup/archive.d.ts +6 -0
  350. package/packages/core/dist/backup/archive.d.ts.map +1 -1
  351. package/packages/core/dist/backup/archive.js +19 -6
  352. package/packages/core/dist/backup/archive.js.map +1 -1
  353. package/packages/core/dist/postgres/binaries.d.ts +21 -1
  354. package/packages/core/dist/postgres/binaries.d.ts.map +1 -1
  355. package/packages/core/dist/postgres/binaries.js +72 -10
  356. package/packages/core/dist/postgres/binaries.js.map +1 -1
  357. package/packages/core/dist/postgres/cluster.d.ts +8 -0
  358. package/packages/core/dist/postgres/cluster.d.ts.map +1 -1
  359. package/packages/core/dist/postgres/cluster.js +119 -17
  360. package/packages/core/dist/postgres/cluster.js.map +1 -1
  361. package/packages/core/dist/postgres/windows-guard.d.ts +20 -0
  362. package/packages/core/dist/postgres/windows-guard.d.ts.map +1 -0
  363. package/packages/core/dist/postgres/windows-guard.js +140 -0
  364. package/packages/core/dist/postgres/windows-guard.js.map +1 -0
  365. package/packages/gateway/dist/.tsbuildinfo +1 -1
  366. package/packages/gateway/dist/agents/catalog.d.ts.map +1 -1
  367. package/packages/gateway/dist/agents/catalog.js +3 -2
  368. package/packages/gateway/dist/agents/catalog.js.map +1 -1
  369. package/packages/gateway/dist/agents/catalogue-package.d.ts +2 -2
  370. package/packages/gateway/dist/agents/catalogue-package.d.ts.map +1 -1
  371. package/packages/gateway/dist/agents/catalogue-package.js +1 -1
  372. package/packages/gateway/dist/agents/catalogue-package.js.map +1 -1
  373. package/packages/gateway/dist/agents/platform-catalogue.d.ts +6 -6
  374. package/packages/gateway/dist/agents/platform-catalogue.d.ts.map +1 -1
  375. package/packages/gateway/dist/agents/platform-catalogue.js +5 -5
  376. package/packages/gateway/dist/agents/platform-catalogue.js.map +1 -1
  377. package/packages/gateway/dist/browser-host.js +1 -1
  378. package/packages/gateway/dist/browser-host.js.map +1 -1
  379. package/packages/gateway/dist/missions/chrome-scope.d.ts +10 -10
  380. package/packages/gateway/dist/missions/chrome-scope.d.ts.map +1 -1
  381. package/packages/gateway/dist/missions/chrome-scope.js +20 -20
  382. package/packages/gateway/dist/missions/chrome-scope.js.map +1 -1
  383. package/packages/gateway/dist/missions/execute.d.ts +2 -2
  384. package/packages/gateway/dist/missions/execute.d.ts.map +1 -1
  385. package/packages/gateway/dist/missions/execute.js +11 -11
  386. package/packages/gateway/dist/missions/execute.js.map +1 -1
  387. package/packages/gateway/dist/missions/reminders.d.ts +2 -2
  388. package/packages/gateway/dist/missions/reminders.d.ts.map +1 -1
  389. package/packages/gateway/dist/missions/reminders.js +5 -5
  390. package/packages/gateway/dist/missions/reminders.js.map +1 -1
  391. package/packages/gateway/dist/owner-notify.js +1 -1
  392. package/packages/gateway/dist/owner-notify.js.map +1 -1
  393. package/packages/gateway/dist/plugins/npm.d.ts +9 -2
  394. package/packages/gateway/dist/plugins/npm.d.ts.map +1 -1
  395. package/packages/gateway/dist/plugins/npm.js +29 -6
  396. package/packages/gateway/dist/plugins/npm.js.map +1 -1
  397. package/packages/gateway/dist/plugins/stage.d.ts.map +1 -1
  398. package/packages/gateway/dist/plugins/stage.js +2 -2
  399. package/packages/gateway/dist/plugins/stage.js.map +1 -1
  400. package/packages/gateway/dist/serve.js +1 -1
  401. package/packages/gateway/dist/serve.js.map +1 -1
  402. package/packages/gateway/dist/surfaces/browser-cards.d.ts +1 -1
  403. package/packages/gateway/dist/surfaces/browser-cards.js +1 -1
  404. package/packages/gateway/dist/system-context.d.ts +11 -0
  405. package/packages/gateway/dist/system-context.d.ts.map +1 -1
  406. package/packages/gateway/dist/system-context.js +42 -1
  407. package/packages/gateway/dist/system-context.js.map +1 -1
  408. package/packages/gateway/dist/telegram/approvals.js +1 -1
  409. package/packages/gateway/dist/telegram/approvals.js.map +1 -1
  410. package/packages/gateway/dist/telegram/browser-view.js +1 -1
  411. package/packages/gateway/dist/telegram/browser-view.js.map +1 -1
  412. package/packages/gateway/dist/web/api-routes.js +6 -6
  413. package/packages/gateway/dist/web/api-routes.js.map +1 -1
  414. package/packages/gateway/dist/web/approval-ask.js +1 -1
  415. package/packages/gateway/dist/web/extension.d.ts +6 -0
  416. package/packages/gateway/dist/web/extension.d.ts.map +1 -1
  417. package/packages/gateway/dist/web/extension.js +22 -11
  418. package/packages/gateway/dist/web/extension.js.map +1 -1
  419. package/packages/gateway/dist/web/read.d.ts +1 -1
  420. package/packages/gateway/dist/web/read.d.ts.map +1 -1
  421. package/packages/gateway/dist/web/server.js +4 -4
  422. package/packages/gateway/dist/web/server.js.map +1 -1
  423. package/packages/gateway/dist/web/service.d.ts +6 -1
  424. package/packages/gateway/dist/web/service.d.ts.map +1 -1
  425. package/packages/gateway/dist/web/service.js +10 -1
  426. package/packages/gateway/dist/web/service.js.map +1 -1
  427. package/packages/gateway/dist/web/skills.d.ts.map +1 -1
  428. package/packages/gateway/dist/web/skills.js +2 -1
  429. package/packages/gateway/dist/web/skills.js.map +1 -1
  430. package/packages/gateway/dist/web/write.d.ts +1 -1
  431. package/packages/gateway/dist/web/write.js +1 -1
  432. package/packages/install/dist/.tsbuildinfo +1 -1
  433. package/packages/install/dist/app-layout.d.ts +53 -0
  434. package/packages/install/dist/app-layout.d.ts.map +1 -1
  435. package/packages/install/dist/app-layout.js +123 -10
  436. package/packages/install/dist/app-layout.js.map +1 -1
  437. package/packages/install/dist/cloudflared.js +2 -2
  438. package/packages/install/dist/cloudflared.js.map +1 -1
  439. package/packages/install/dist/environment.d.ts +40 -1
  440. package/packages/install/dist/environment.d.ts.map +1 -1
  441. package/packages/install/dist/environment.js +158 -12
  442. package/packages/install/dist/environment.js.map +1 -1
  443. package/packages/install/dist/launcher.d.ts.map +1 -1
  444. package/packages/install/dist/launcher.js +340 -54
  445. package/packages/install/dist/launcher.js.map +1 -1
  446. package/packages/install/dist/linux-install.d.ts +41 -0
  447. package/packages/install/dist/linux-install.d.ts.map +1 -0
  448. package/packages/install/dist/linux-install.js +86 -0
  449. package/packages/install/dist/linux-install.js.map +1 -0
  450. package/packages/install/dist/postgres-check.js +1 -1
  451. package/packages/install/dist/postgres-check.js.map +1 -1
  452. package/packages/install/dist/product-uninstall.d.ts +14 -0
  453. package/packages/install/dist/product-uninstall.d.ts.map +1 -1
  454. package/packages/install/dist/product-uninstall.js +10 -0
  455. package/packages/install/dist/product-uninstall.js.map +1 -1
  456. package/packages/install/dist/runtime-info.d.ts +23 -0
  457. package/packages/install/dist/runtime-info.d.ts.map +1 -0
  458. package/packages/install/dist/runtime-info.js +72 -0
  459. package/packages/install/dist/runtime-info.js.map +1 -0
  460. package/packages/install/dist/supervisor.d.ts +60 -3
  461. package/packages/install/dist/supervisor.d.ts.map +1 -1
  462. package/packages/install/dist/supervisor.js +175 -17
  463. package/packages/install/dist/supervisor.js.map +1 -1
  464. package/packages/install/dist/uninstall.d.ts +49 -3
  465. package/packages/install/dist/uninstall.d.ts.map +1 -1
  466. package/packages/install/dist/uninstall.js +184 -27
  467. package/packages/install/dist/uninstall.js.map +1 -1
  468. package/packages/install/dist/upgrade.d.ts +20 -5
  469. package/packages/install/dist/upgrade.d.ts.map +1 -1
  470. package/packages/install/dist/upgrade.js +125 -62
  471. package/packages/install/dist/upgrade.js.map +1 -1
  472. package/packages/install/dist/windows-install.d.ts +102 -0
  473. package/packages/install/dist/windows-install.d.ts.map +1 -0
  474. package/packages/install/dist/windows-install.js +223 -0
  475. package/packages/install/dist/windows-install.js.map +1 -0
  476. package/packages/install/dist/windows-setup.d.ts +107 -0
  477. package/packages/install/dist/windows-setup.d.ts.map +1 -0
  478. package/packages/install/dist/windows-setup.js +700 -0
  479. package/packages/install/dist/windows-setup.js.map +1 -0
  480. package/packages/install/dist/windows-task.d.ts +49 -0
  481. package/packages/install/dist/windows-task.d.ts.map +1 -0
  482. package/packages/install/dist/windows-task.js +167 -0
  483. package/packages/install/dist/windows-task.js.map +1 -0
  484. package/packages/runtime/dist/.tsbuildinfo +1 -1
  485. package/packages/runtime/dist/codex-direct.d.ts +1 -1
  486. package/packages/runtime/dist/codex-direct.js +1 -1
  487. package/packages/runtime/dist/openai.d.ts +11 -0
  488. package/packages/runtime/dist/openai.d.ts.map +1 -1
  489. package/packages/runtime/dist/openai.js +36 -3
  490. package/packages/runtime/dist/openai.js.map +1 -1
  491. package/packages/tools/artifacts/dist/.tsbuildinfo +1 -1
  492. package/packages/tools/artifacts/dist/tools/write.js +3 -3
  493. package/packages/tools/artifacts/dist/tools/write.js.map +1 -1
  494. package/packages/tools/browser/dist/.tsbuildinfo +1 -1
  495. package/packages/tools/browser/dist/availability.d.ts.map +1 -1
  496. package/packages/tools/browser/dist/availability.js +1 -0
  497. package/packages/tools/browser/dist/availability.js.map +1 -1
  498. package/packages/tools/browser/dist/brand.d.ts +19 -0
  499. package/packages/tools/browser/dist/brand.d.ts.map +1 -0
  500. package/packages/tools/browser/dist/brand.js +31 -0
  501. package/packages/tools/browser/dist/brand.js.map +1 -0
  502. package/packages/tools/browser/dist/controller.d.ts +2 -2
  503. package/packages/tools/browser/dist/controller.d.ts.map +1 -1
  504. package/packages/tools/browser/dist/controller.js +16 -7
  505. package/packages/tools/browser/dist/controller.js.map +1 -1
  506. package/packages/tools/browser/dist/downloads.js +1 -1
  507. package/packages/tools/browser/dist/downloads.js.map +1 -1
  508. package/packages/tools/browser/dist/extension.d.ts +3 -1
  509. package/packages/tools/browser/dist/extension.d.ts.map +1 -1
  510. package/packages/tools/browser/dist/extension.js +4 -4
  511. package/packages/tools/browser/dist/extension.js.map +1 -1
  512. package/packages/tools/browser/dist/index.d.ts +3 -2
  513. package/packages/tools/browser/dist/index.d.ts.map +1 -1
  514. package/packages/tools/browser/dist/index.js +7 -6
  515. package/packages/tools/browser/dist/index.js.map +1 -1
  516. package/packages/tools/browser/dist/routes.d.ts +12 -1
  517. package/packages/tools/browser/dist/routes.d.ts.map +1 -1
  518. package/packages/tools/browser/dist/routes.js +31 -14
  519. package/packages/tools/browser/dist/routes.js.map +1 -1
  520. package/packages/tools/browser/dist/service.d.ts +2 -0
  521. package/packages/tools/browser/dist/service.d.ts.map +1 -1
  522. package/packages/tools/browser/dist/service.js +6 -6
  523. package/packages/tools/browser/dist/service.js.map +1 -1
  524. package/packages/tools/browser/dist/telemetry.d.ts +2 -2
  525. package/packages/tools/browser/dist/telemetry.js +2 -2
  526. package/packages/tools/browser/dist/telemetry.js.map +1 -1
  527. package/packages/tools/browser/dist/types.js +1 -1
  528. package/packages/tools/browser/dist/types.js.map +1 -1
  529. package/packages/tools/host/dist/.tsbuildinfo +1 -1
  530. package/packages/tools/host/dist/index.d.ts +2 -1
  531. package/packages/tools/host/dist/index.d.ts.map +1 -1
  532. package/packages/tools/host/dist/index.js +11 -2
  533. package/packages/tools/host/dist/index.js.map +1 -1
  534. package/packages/tools/host/dist/process.d.ts +58 -1
  535. package/packages/tools/host/dist/process.d.ts.map +1 -1
  536. package/packages/tools/host/dist/process.js +229 -15
  537. package/packages/tools/host/dist/process.js.map +1 -1
  538. package/packages/tools/host/dist/service.d.ts +2 -0
  539. package/packages/tools/host/dist/service.d.ts.map +1 -1
  540. package/packages/tools/host/dist/service.js +8 -6
  541. package/packages/tools/host/dist/service.js.map +1 -1
  542. package/packages/tools/host/dist/skill-run.d.ts +10 -0
  543. package/packages/tools/host/dist/skill-run.d.ts.map +1 -1
  544. package/packages/tools/host/dist/skill-run.js +14 -0
  545. package/packages/tools/host/dist/skill-run.js.map +1 -1
  546. package/packages/web/dist/assets/index-DnZhfnM7.js +155 -0
  547. package/packages/web/dist/assets/{lottie_light-DROBTM6Y.js → lottie_light-CGUtDt_b.js} +1 -1
  548. package/packages/web/dist/build.json +1 -1
  549. package/packages/web/dist/index.html +1 -1
  550. package/packages/web/dist/precache.json +3 -3
  551. package/node_modules/content-disposition/index.js +0 -536
  552. package/packages/web/dist/assets/index-oxmxR39o.js +0 -155
@@ -1,4 +1,5 @@
1
1
  import { formatFlag, canUseFlag, formatDateTime, normalizePath, encodePath, comparePaths, parseBigIntValue, parseUintValue, MAX_UINT32_DIGITS, getSelectedMailbox, emitSafe, isAuthenticatedState, reportCommandError, logConnectionError } from '../tools.js';
2
+ import { createImapError } from '../errors.js';
2
3
  /**
3
4
  * Appends a message to a mailbox.
4
5
  *
@@ -15,14 +16,24 @@ export default async function append(connection, destination, content, flags, id
15
16
  // nothing to do here
16
17
  return;
17
18
  }
19
+ // The literal size marker is announced from these bytes, so anything that is not
20
+ // bytes (a Readable, a plain object) is refused here instead of desyncing the session
21
+ let message;
18
22
  if (typeof content === 'string') {
19
- content = Buffer.from(content);
23
+ message = Buffer.from(content);
24
+ }
25
+ else if (content instanceof Uint8Array) {
26
+ // a Buffer as is, any other Uint8Array as a view over the same memory, not a copy
27
+ message = Buffer.isBuffer(content) ? content : Buffer.from(content.buffer, content.byteOffset, content.byteLength);
28
+ }
29
+ else {
30
+ throw createImapError('Message content must be a Buffer, Uint8Array or string', 'InvalidMessageContent');
20
31
  }
21
32
  // APPENDLIMIT capability (RFC 7889): server may advertise the maximum message
22
33
  // size it accepts. Check before sending to avoid a wasted round-trip.
23
34
  if (connection.capabilities.has('APPENDLIMIT')) {
24
35
  let appendLimit = connection.capabilities.get('APPENDLIMIT');
25
- if (typeof appendLimit === 'number' && appendLimit < content.length) {
36
+ if (typeof appendLimit === 'number' && appendLimit < message.length) {
26
37
  let err = new Error('Message content too big for APPENDLIMIT=' + appendLimit);
27
38
  err.serverResponseCode = 'APPENDLIMIT';
28
39
  throw err;
@@ -79,9 +90,9 @@ export default async function append(connection, destination, content, flags, id
79
90
  // Regular literals cannot contain NUL bytes per the IMAP grammar.
80
91
  let isLiteral8 = false;
81
92
  if (connection.capabilities.has('BINARY') && !connection.disableBinary) {
82
- isLiteral8 = content.indexOf(Buffer.from([0])) >= 0;
93
+ isLiteral8 = message.indexOf(0) >= 0;
83
94
  }
84
- attributes.push({ type: 'LITERAL', value: content, isLiteral8 });
95
+ attributes.push({ type: 'LITERAL', value: message, isLiteral8 });
85
96
  let map = { destination };
86
97
  if (connection.mailbox && connection.mailbox.path) {
87
98
  map.path = connection.mailbox.path;
@@ -1,3 +1,4 @@
1
+ import { createImapError } from '../errors.js';
1
2
  /**
2
3
  * Requests DEFLATE compression from the server.
3
4
  *
@@ -33,8 +34,7 @@ export default async function compress(connection) {
33
34
  // back its unconsumed tail on unpipe so the transport can feed it into the
34
35
  // inflater - not something a command module can reach from here.
35
36
  if (response.hasTrailingData) {
36
- let error = new Error('Server sent data between the COMPRESS response and the compression layer switch');
37
- error.code = 'COMPRESS_TRAILING_DATA';
37
+ let error = createImapError('Server sent data between the COMPRESS response and the compression layer switch', 'COMPRESS_TRAILING_DATA');
38
38
  connection.log.error({ err: error, cid: connection.id });
39
39
  // Schedule the close before releasing parser backpressure, so the buffered
40
40
  // deflate-framed bytes cannot settle anything before teardown begins. This is
@@ -1,4 +1,4 @@
1
- import { formatDateTime, isUnsafeKey } from '../tools.js';
1
+ import { formatDateTime, isUnsafeKey, getStringValue } from '../tools.js';
2
2
  /**
3
3
  * Sends ID info to the server and updates server info data based on the response.
4
4
  *
@@ -36,17 +36,19 @@ export default async function id(connection, clientInfo) {
36
36
  let params = untagged.attributes && untagged.attributes[0];
37
37
  let key;
38
38
  (Array.isArray(params) ? params : [].concat(params || [])).forEach((val, i) => {
39
+ // keys are strings and values nstrings, either may come as a literal
40
+ let value = getStringValue(val);
39
41
  if (i % 2 === 0) {
40
- key = val.value;
42
+ key = value;
41
43
  }
42
- else if (typeof key === 'string' && typeof val.value === 'string') {
44
+ else if (key !== undefined && value !== undefined) {
43
45
  // The server picks the keys of this object, which the caller reads
44
46
  // back as serverInfo: a prototype-chain name is skipped as it is for
45
47
  // every other server-named key, so it can neither be shadowed nor
46
48
  // written through
47
49
  let name = key.toLowerCase().trim();
48
50
  if (!isUnsafeKey(name)) {
49
- map[name] = val.value;
51
+ map[name] = value;
50
52
  }
51
53
  }
52
54
  });
@@ -1,4 +1,5 @@
1
1
  import { guardedPromise, hasCapability, isServerRefusal, logConnectionError, restampConnectionError, unrefTimer, clearTimer, getSelectedMailbox } from '../tools.js';
2
+ import { createImapError } from '../errors.js';
2
3
  const NOOP_INTERVAL = 2 * 60 * 1000;
3
4
  /**
4
5
  * Marks the connection as idling on behalf of one session and returns a release function.
@@ -124,14 +125,15 @@ async function runIdle(connection) {
124
125
  }
125
126
  catch (err) {
126
127
  logConnectionError(connection, 'IDLE session failed', err);
127
- // A tagged NO or BAD only means the server refused IDLE; the connection is still usable,
128
- // so the waiters are released by the finally block below and their own commands run.
129
- // Anything else (close, lost socket, parser failure) fails the waiters too.
130
- let refusedByServer = isServerRefusal(err);
131
- if (refusedByServer) {
128
+ // A tagged NO or BAD only means the server did not run IDLE; the connection is still
129
+ // usable, so the waiters are released by the finally block below and their own commands
130
+ // run. Anything else (close, lost socket, parser failure) fails the waiters too. Only a
131
+ // refusal turns IDLE off for the session, a throttled IDLE is tried again later.
132
+ let answeredByServer = err.responseStatus === 'NO' || err.responseStatus === 'BAD';
133
+ if (isServerRefusal(err)) {
132
134
  connection.skipIdle = true;
133
135
  }
134
- if (preCheckWaitQueue.length && !refusedByServer) {
136
+ if (preCheckWaitQueue.length && !answeredByServer) {
135
137
  // One error for the whole queue: every waiter failed at the same site, for the same
136
138
  // reason. Built inside the guard so a teardown with nothing queued - the common case -
137
139
  // does not pay for an Error and its stack capture.
@@ -188,9 +190,7 @@ async function pollOnce(connection, session) {
188
190
  highestModseq: true
189
191
  });
190
192
  if (!status) {
191
- let err = new Error('STATUS poll failed');
192
- err.code = 'PollFailed';
193
- throw err;
193
+ throw createImapError('STATUS poll failed', 'PollFailed');
194
194
  }
195
195
  break;
196
196
  }
@@ -1,4 +1,4 @@
1
- import { decodePath, encodePath, normalizePath, enhanceCommandError, hasCapability, isRev2Active, buildStatusQueryAttributes, getStringList } from '../tools.js';
1
+ import { decodePath, encodePath, normalizePath, enhanceCommandError, hasCapability, isRev2Active, buildStatusQueryAttributes, getStringList, getStringValue } from '../tools.js';
2
2
  import { parseStatusList } from './status-fields.js';
3
3
  import { specialUse } from '../special-use.js';
4
4
  /**
@@ -155,7 +155,7 @@ export default async function list(connection, reference, mailbox, options) {
155
155
  path: normalizePath(connection, decodePath(connection, rawPath)),
156
156
  pathAsListed: rawPath,
157
157
  flags: new Set(getStringList(untagged.attributes[0])),
158
- delimiter: (untagged.attributes[1] && untagged.attributes[1].value),
158
+ delimiter: getStringValue(untagged.attributes[1]),
159
159
  listed: true
160
160
  };
161
161
  normalizeFlags(entry);
@@ -396,7 +396,7 @@ export default async function list(connection, reference, mailbox, options) {
396
396
  path: normalizePath(connection, decodePath(connection, rawPath)),
397
397
  pathAsListed: rawPath,
398
398
  flags: new Set(getStringList(untagged.attributes[0])),
399
- delimiter: (untagged.attributes[1] && untagged.attributes[1].value),
399
+ delimiter: getStringValue(untagged.attributes[1]),
400
400
  subscribed: true
401
401
  };
402
402
  if (entry.path.toUpperCase() === 'INBOX') {
@@ -1,4 +1,4 @@
1
- import { hasCapability, getStringList, isAuthenticatedState } from '../tools.js';
1
+ import { hasCapability, getStringList, getStringValue, isAuthenticatedState } from '../tools.js';
2
2
  /**
3
3
  * Requests NAMESPACE info from the server.
4
4
  *
@@ -91,8 +91,9 @@ async function getListPrefix(connection) {
91
91
  return;
92
92
  }
93
93
  map.flags = new Set(getStringList(untagged.attributes[0]));
94
- map.delimiter = (untagged.attributes[1] && untagged.attributes[1].value);
95
- map.prefix = ((untagged.attributes[2] && untagged.attributes[2].value) || '');
94
+ // the name may be a literal, which arrives as a Buffer
95
+ map.delimiter = getStringValue(untagged.attributes[1]) || null;
96
+ map.prefix = getStringValue(untagged.attributes[2]) || '';
96
97
  if (map.delimiter && map.prefix.charAt(0) === map.delimiter) {
97
98
  map.prefix = map.prefix.slice(1);
98
99
  }
@@ -117,22 +118,25 @@ function getNamsepaceInfo(attribute) {
117
118
  if (!attribute || !Array.isArray(attribute) || !attribute.length) {
118
119
  return false;
119
120
  }
120
- return attribute
121
- .filter(entry => {
122
- let pair = entry;
123
- // RFC 2342 section 5 allows the delimiter to be NIL when the namespace has
124
- // no hierarchy. The token parser emits a literal `null` for NIL.
125
- return pair.length >= 2 && pair[0] && typeof pair[0].value === 'string' && (pair[1] === null || (pair[1] && typeof pair[1].value === 'string'));
126
- })
127
- .map(entry => {
121
+ let entries = [];
122
+ for (let entry of attribute) {
123
+ if (!Array.isArray(entry)) {
124
+ continue;
125
+ }
128
126
  let pair = entry;
129
- let prefix = pair[0].value;
130
- let delimiter = pair[1] === null ? null : pair[1].value;
127
+ let prefix = getStringValue(pair[0]);
128
+ // RFC 2342 section 5 allows the delimiter to be NIL when the namespace has no hierarchy.
129
+ // The token parser emits a literal `null` for NIL.
130
+ let delimiter = pair[1] === null ? null : getStringValue(pair[1]);
131
+ if (pair.length < 2 || prefix === undefined || delimiter === undefined) {
132
+ continue;
133
+ }
131
134
  // Append the delimiter to the prefix if it doesn't already end with one,
132
135
  // so callers can construct full paths by simply concatenating prefix + name.
133
136
  if (delimiter && prefix && prefix.charAt(prefix.length - 1) !== delimiter) {
134
137
  prefix += delimiter;
135
138
  }
136
- return { prefix, delimiter };
137
- });
139
+ entries.push({ prefix, delimiter });
140
+ }
141
+ return entries;
138
142
  }
@@ -1,4 +1,4 @@
1
- import { encodePath, normalizePath, parseUintValue, isUnsafeKey, isAuthenticatedState, reportCommandError } from '../tools.js';
1
+ import { encodePath, normalizePath, parseUintValue, isUnsafeKey, isAuthenticatedState, reportCommandError, getStringValue } from '../tools.js';
2
2
  /**
3
3
  * Requests quota information for a mailbox.
4
4
  *
@@ -79,9 +79,8 @@ export default async function quota(connection, path) {
79
79
  // QUOTAROOT response tells us which quota root applies to this mailbox.
80
80
  // A mailbox may have zero or one quota root.
81
81
  QUOTAROOT: async (untagged) => {
82
- let quotaRoot = untagged.attributes && untagged.attributes[1] && typeof untagged.attributes[1].value === 'string'
83
- ? untagged.attributes[1].value
84
- : false;
82
+ // the root name is an astring, which may come as a literal
83
+ let quotaRoot = getStringValue(untagged.attributes && untagged.attributes[1]);
85
84
  if (quotaRoot) {
86
85
  map.quotaRoot = quotaRoot;
87
86
  }
@@ -1,5 +1,6 @@
1
1
  import { encodePath, normalizePath, buildStatusQueryAttributes, isRev2Active, isAuthenticatedState, emitSafe, getSelectedMailbox, logConnectionError } from '../tools.js';
2
2
  import { parseStatusList } from './status-fields.js';
3
+ import { createImapError } from '../errors.js';
3
4
  // STATUS fields that also refresh the live mailbox state when the queried mailbox is the
4
5
  // currently selected one. Keyed by the output property name parseStatusList() reports.
5
6
  const MAILBOX_UPDATERS = {
@@ -96,10 +97,7 @@ export default async function status(connection, path, query) {
96
97
  return false;
97
98
  });
98
99
  if (folders && !folders.length) {
99
- let error = new Error(`Mailbox doesn't exist: ${path}`);
100
- error.code = 'NotFound';
101
- error.response = err;
102
- throw error;
100
+ throw createImapError(`Mailbox doesn't exist: ${path}`, 'NotFound', { response: err });
103
101
  }
104
102
  }
105
103
  connection.log.warn({ err, cid: connection.id });
@@ -1,4 +1,4 @@
1
- import type { ImapFlowError } from './errors.js';
1
+ import { type ImapFlowError } from './errors.js';
2
2
  export declare const CONNECT_TIMEOUT: number;
3
3
  /**
4
4
  * One deadline for an entire connection attempt.
@@ -1,4 +1,5 @@
1
1
  import { clearTimer } from './tools.js';
2
+ import { createImapError } from './errors.js';
2
3
  // Default upper bound for establishing a usable transport, including DNS and proxy negotiation.
3
4
  export const CONNECT_TIMEOUT = 90 * 1000;
4
5
  /**
@@ -28,10 +29,7 @@ export class ConnectionDeadline {
28
29
  * @returns The shared `CONNECT_TIMEOUT` error.
29
30
  */
30
31
  error() {
31
- let err = new Error('Failed to establish connection in required time');
32
- err.code = 'CONNECT_TIMEOUT';
33
- err.details = { connectionTimeout: this.timeout };
34
- return err;
32
+ return createImapError('Failed to establish connection in required time', 'CONNECT_TIMEOUT', { details: { connectionTimeout: this.timeout } });
35
33
  }
36
34
  /**
37
35
  * Maps a dependency's own expiry onto the shared `CONNECT_TIMEOUT` shape, so callers see one
@@ -11,6 +11,7 @@ import { LimitedPassthrough, normalizeByteLimit } from './limited-passthrough.js
11
11
  // What a wait on the head stream listens for: it can take more input, it failed, or it went
12
12
  // away (a consumer destroying it closes it without a 'drain')
13
13
  const DRAIN_WAIT_EVENTS = ['drain', 'error', 'close'];
14
+ import { createImapError } from './errors.js';
14
15
  import { getDecoder, isUnsafeKey } from './tools.js';
15
16
  const isEmptySection = (value) => !value?.length;
16
17
  /**
@@ -33,8 +34,9 @@ const partialStarts = (requests) => {
33
34
  }
34
35
  return starts;
35
36
  };
36
- // How many times a request is repeated after answers that belong to another request
37
- const MAX_FOREIGN_ANSWERS = 3;
37
+ // Attempts per request when the answer belongs to another request or, for a message known to
38
+ // exist, is empty
39
+ const MAX_FETCH_ATTEMPTS = 3;
38
40
  const requestedUid = (range, options) => options.uid && /^\d+$/.test(String(range)) ? Number(range) : undefined;
39
41
  const isForeignAnswer = (response, expected) => {
40
42
  if (expected.uid && response.uid && response.uid !== expected.uid) {
@@ -56,11 +58,19 @@ const isForeignAnswer = (response, expected) => {
56
58
  * within the answer to the next one. Taken at face value it would be the data of that next
57
59
  * request, and a download would end without an error but with misplaced bytes. An answer for
58
60
  * another UID, or with a partial section that starts at another offset than asked, is dropped
59
- * and the request repeated.
61
+ * and the request repeated. An empty answer is repeated too while `expected.retryEmpty()` says
62
+ * the message exists, as the data of a late answer arrives with the repeated request.
60
63
  */
61
64
  async function fetchExpected(client, range, query, options, expected) {
62
65
  for (let attempt = 1;; attempt++) {
63
66
  let response = await client.fetchOne(range, query, options);
67
+ if (response === false && expected.retryEmpty && expected.retryEmpty() && attempt < MAX_FETCH_ATTEMPTS) {
68
+ // The answer may come late instead (after the tagged OK, with the next answer), then
69
+ // it shows up in the answer to the repeated request. A message that is really gone
70
+ // answers empty every time, and the caller reports it.
71
+ client.log.warn({ msg: 'Server answered a request for an existing message with no data, asking again', attempt, cid: client.id });
72
+ continue;
73
+ }
64
74
  if (!response || !isForeignAnswer(response, expected)) {
65
75
  return response;
66
76
  }
@@ -71,11 +81,8 @@ async function fetchExpected(client, range, query, options, expected) {
71
81
  attempt,
72
82
  cid: client.id
73
83
  });
74
- if (attempt >= MAX_FOREIGN_ANSWERS) {
75
- let err = new Error('Server kept answering with data of another request');
76
- err.code = 'DownloadIncomplete';
77
- err.cid = client.id;
78
- throw err;
84
+ if (attempt >= MAX_FETCH_ATTEMPTS) {
85
+ throw createImapError('Server kept answering with data of another request', 'DownloadIncomplete', { cid: client.id });
79
86
  }
80
87
  }
81
88
  }
@@ -101,7 +108,8 @@ async function refetchDroppedSections(client, response, range, options, sections
101
108
  let uid = response.uid;
102
109
  let retry = await fetchExpected(client, uid || range, { uid: true, bodyParts: sections }, uid ? { ...options, uid: true } : options, {
103
110
  uid,
104
- origins: partialStarts(sections)
111
+ origins: partialStarts(sections),
112
+ retryEmpty: () => true
105
113
  });
106
114
  if (!retry) {
107
115
  return;
@@ -147,7 +155,13 @@ export async function downloadMessage(client, range, part, options) {
147
155
  // Special handling for part "1": in single-node emails (no childNodes),
148
156
  // the body is accessed via "TEXT" rather than "1", and headers via
149
157
  // "HEADER" instead of "1.MIME". Check bodyStructure to detect this.
150
- let response = await client.fetchOne(range, { uid: true, bodyStructure: true }, downloadOptions);
158
+ let expectedUid = requestedUid(range, downloadOptions);
159
+ let response = await fetchExpected(client, range, { uid: true, bodyStructure: true }, downloadOptions, {
160
+ uid: expectedUid,
161
+ origins: new Map(),
162
+ // a message addressed by UID is taken to exist, see getNextPart() below
163
+ retryEmpty: expectedUid ? () => true : undefined
164
+ });
151
165
  if (!response) {
152
166
  return {};
153
167
  }
@@ -163,6 +177,14 @@ export async function downloadMessage(client, range, part, options) {
163
177
  part = 'TEXT';
164
178
  }
165
179
  }
180
+ // The decoder pipeline, built once the head chunk told what the part is (see below)
181
+ let stream;
182
+ let output;
183
+ let fetchAborted = false;
184
+ // A consumer that gave up: its 'close' may still be a tick away from setting fetchAborted,
185
+ // so the stream's own flag is checked as well
186
+ // `output` is unset until the head chunk is in, and the head chunk's retry asks already
187
+ let downloadAborted = () => fetchAborted || !!output?.destroyed;
166
188
  let getNextPart = async (query) => {
167
189
  query = query || {};
168
190
  let mimeKey;
@@ -196,12 +218,23 @@ export async function downloadMessage(client, range, part, options) {
196
218
  };
197
219
  query.bodyParts.push(contentRequest);
198
220
  }
221
+ let expectedUid = uid || requestedUid(range, downloadOptions);
199
222
  let expected = {
200
- uid: uid || requestedUid(range, downloadOptions),
201
- origins: new Map([[part || '', processed]])
223
+ uid: expectedUid,
224
+ origins: new Map([[part || '', processed]]),
225
+ // Every chunk after the first is of a message that was there a moment ago, and a
226
+ // message the caller addresses by UID is taken to exist: an empty answer may be a
227
+ // late one (Apache James), a message that is really gone costs two more requests
228
+ retryEmpty: processed > 0 || expectedUid ? () => !downloadAborted() : undefined
202
229
  };
203
230
  let response = await fetchExpected(client, range, query, downloadOptions, expected);
204
231
  if (!response) {
232
+ // An empty answer also comes from a connection that closed while the consumer was
233
+ // paused between chunks (fetchOne() finds no mailbox then), and that is not a
234
+ // missing message: a caller that retries would skip it
235
+ if (!client.usable) {
236
+ throw client.createNoConnectionError(false, { rejectedFrom: 'download' });
237
+ }
205
238
  return { response: false, chunk: false };
206
239
  }
207
240
  if (!uid && response.uid) {
@@ -309,9 +342,6 @@ export async function downloadMessage(client, range, part, options) {
309
342
  meta.filename = filename;
310
343
  }
311
344
  }
312
- let stream;
313
- let output;
314
- let fetchAborted = false;
315
345
  // Build a decoder pipeline that progressively transforms the raw FETCH data:
316
346
  // 1. Transfer-encoding decoder (base64 or quoted-printable -> binary)
317
347
  // 2. Format decoder (format=flowed -> plain text, if applicable)
@@ -341,13 +371,19 @@ export async function downloadMessage(client, range, part, options) {
341
371
  // would still pull the entire part off the wire.
342
372
  let limiters = [];
343
373
  let isLimited = () => limiters.some(entry => entry.limited);
374
+ // Every stage after the head, so a download that ends early can release all of them
375
+ let stages = [];
344
376
  // Appending a stage means forwarding the current tail's errors to it before piping, so a
345
- // failure anywhere reaches the stream the caller is reading
377
+ // failure anywhere reaches the stream the caller is reading. The stage is destroyed with
378
+ // the error rather than only emitting it: pipe() does not end its destination on a source
379
+ // error, so a consumer that only listens for 'finish' or 'close' (a plain .pipe() into a
380
+ // file) would otherwise wait forever.
346
381
  let pipeStage = (stage) => {
347
382
  output.on('error', err => {
348
- stage.emit('error', err);
383
+ stage.destroy(err);
349
384
  });
350
385
  output = output.pipe(stage);
386
+ stages.push(stage);
351
387
  return stage;
352
388
  };
353
389
  let isTextNode = ['text/html', 'text/plain', 'text/x-amp-html'].includes(meta.contentType) || (part === '1' && !meta.contentType);
@@ -392,8 +428,8 @@ export async function downloadMessage(client, range, part, options) {
392
428
  // Cleanup function
393
429
  const cleanup = () => {
394
430
  fetchAborted = true;
395
- if (stream && !stream.destroyed) {
396
- stream.destroy();
431
+ for (let entry of [stream, ...stages]) {
432
+ entry.destroy();
397
433
  }
398
434
  };
399
435
  // Listen for stream destruction
@@ -466,26 +502,18 @@ export async function downloadMessage(client, range, part, options) {
466
502
  // Loud on purpose. Everything written downstream by this point holds
467
503
  // duplicated content, and a quiet stop is indistinguishable from a clean EOF,
468
504
  // so the consumer would store a corrupt body believing it intact.
469
- let err = new Error('Download exceeded the expected message size');
470
- err.code = 'DownloadOverflow';
471
- err.maxSize = maxTotalBytes;
472
- err.cid = client.id;
473
- throw err;
505
+ throw createImapError('Download exceeded the expected message size', 'DownloadOverflow', { maxSize: maxTotalBytes, cid: client.id });
474
506
  }
475
507
  let { response, chunk } = await getNextPart();
476
- // A consumer that gave up while the chunk was in flight: its 'close' may still be a
477
- // tick away from setting fetchAborted, so the stream's own flag is checked as well
478
- if (fetchAborted || output.destroyed) {
508
+ // A consumer that gave up while the chunk was in flight
509
+ if (downloadAborted()) {
479
510
  break;
480
511
  }
481
512
  if (response === false) {
482
513
  // The message is gone mid-download (expunged by another client, or the
483
514
  // mailbox was closed). Ending the stream here would pass the truncated body
484
515
  // off as complete, so the consumer is told the same way as for an overflow.
485
- let err = new Error('Message disappeared before the download completed');
486
- err.code = 'DownloadIncomplete';
487
- err.cid = client.id;
488
- throw err;
516
+ throw createImapError('Message disappeared before the download completed', 'DownloadIncomplete', { cid: client.id });
489
517
  }
490
518
  if (!chunk) {
491
519
  break;
@@ -515,7 +543,7 @@ export async function downloadMessage(client, range, part, options) {
515
543
  fetchAllParts(head)
516
544
  .catch(err => {
517
545
  if (!fetchAborted && stream && !stream.destroyed) {
518
- stream.emit('error', err);
546
+ stream.destroy(err);
519
547
  /* c8 ignore start */ // the else logs when a fetch error arrives after the stream was already torn down (timing-dependent)
520
548
  }
521
549
  else {
@@ -540,7 +568,7 @@ export async function downloadMessage(client, range, part, options) {
540
568
  // above rejects a promise nobody holds and takes the process down on
541
569
  // unhandledRejection. Reaching it always means an invariant broke - the head
542
570
  // stream kept pipeStage()'s error forwarder for the life of the download, so
543
- // emit('error') above has somewhere to go - which is why it logs at error even
571
+ // destroy(err) above has somewhere to go - which is why it logs at error even
544
572
  // for a routine-looking connection code.
545
573
  .catch(err => client.log.error({ msg: 'Failed to fail the download stream', err, cid: client.id }));
546
574
  };
@@ -579,9 +607,12 @@ export async function downloadMessageParts(client, range, parts, options) {
579
607
  contentRequests.set(part, contentRequest);
580
608
  query.bodyParts.push(contentRequest);
581
609
  }
610
+ let expectedUid = requestedUid(range, downloadOptions);
582
611
  let response = await fetchExpected(client, range, query, downloadOptions, {
583
- uid: requestedUid(range, downloadOptions),
584
- origins: partialStarts(query.bodyParts)
612
+ uid: expectedUid,
613
+ origins: partialStarts(query.bodyParts),
614
+ // a message addressed by UID is taken to exist, as for download()
615
+ retryEmpty: expectedUid ? () => true : undefined
585
616
  });
586
617
  if (!response || !response.bodyParts) {
587
618
  return {};
@@ -29,6 +29,7 @@ export declare const ImapFlowErrorCode: {
29
29
  readonly MissingServerExtension: "MissingServerExtension";
30
30
  readonly ParserError: "ParserError";
31
31
  readonly ParserErrorExchange: "ParserErrorExchange";
32
+ readonly ParserErrorInternal: "ParserErrorInternal";
32
33
  readonly MAX_IMAP_NESTING_REACHED: "MAX_IMAP_NESTING_REACHED";
33
34
  readonly LineTooLarge: "LineTooLarge";
34
35
  readonly LiteralTooLarge: "LiteralTooLarge";
@@ -38,6 +39,7 @@ export declare const ImapFlowErrorCode: {
38
39
  readonly InvalidTextValue: "InvalidTextValue";
39
40
  readonly InvalidSequenceSet: "InvalidSequenceSet";
40
41
  readonly InvalidSearchQuery: "InvalidSearchQuery";
42
+ readonly InvalidMessageContent: "InvalidMessageContent";
41
43
  readonly DownloadOverflow: "DownloadOverflow";
42
44
  readonly DownloadIncomplete: "DownloadIncomplete";
43
45
  readonly ProxyError: "ProxyError";
@@ -48,6 +50,8 @@ export declare const ImapFlowErrorCode: {
48
50
  };
49
51
  /** One of the {@link ImapFlowErrorCode} values */
50
52
  export type ImapFlowErrorCode = (typeof ImapFlowErrorCode)[keyof typeof ImapFlowErrorCode];
53
+ /** A numbered parser error code, `ParserError1` and up */
54
+ export type ParserErrorCode = `ParserError${number}`;
51
55
  /**
52
56
  * An Error raised by ImapFlow, with the extra properties the library attaches to describe
53
57
  * the failure. Every property is optional: which ones are present depends on where the
@@ -132,3 +136,14 @@ export declare class AuthenticationFailure extends Error implements ImapFlowErro
132
136
  response?: string | undefined;
133
137
  oauthError?: any;
134
138
  }
139
+ /**
140
+ * Creates an {@link ImapFlowError} with a code and optional extra properties. The code is
141
+ * checked by the compiler against {@link ImapFlowErrorCode}, so a typo or an undeclared
142
+ * code fails the build instead of reaching consumers.
143
+ *
144
+ * @param message - The error message
145
+ * @param code - The error code
146
+ * @param props - Extra properties to set on the error
147
+ * @returns The error, ready to throw or reject with
148
+ */
149
+ export declare function createImapError(message: string, code: ImapFlowErrorCode | ParserErrorCode, props?: Omit<ImapFlowError, 'name' | 'message' | 'stack' | 'code'> | undefined): ImapFlowError;
@@ -32,6 +32,8 @@ export const ImapFlowErrorCode = {
32
32
  // response parsing and size limits
33
33
  ParserError: 'ParserError',
34
34
  ParserErrorExchange: 'ParserErrorExchange',
35
+ // an unexpected exception inside the parser, re-raised with a code; a parser bug
36
+ ParserErrorInternal: 'ParserErrorInternal',
35
37
  MAX_IMAP_NESTING_REACHED: 'MAX_IMAP_NESTING_REACHED',
36
38
  LineTooLarge: 'LineTooLarge',
37
39
  LiteralTooLarge: 'LiteralTooLarge',
@@ -42,6 +44,7 @@ export const ImapFlowErrorCode = {
42
44
  InvalidTextValue: 'InvalidTextValue',
43
45
  InvalidSequenceSet: 'InvalidSequenceSet',
44
46
  InvalidSearchQuery: 'InvalidSearchQuery',
47
+ InvalidMessageContent: 'InvalidMessageContent',
45
48
  // download()
46
49
  DownloadOverflow: 'DownloadOverflow',
47
50
  DownloadIncomplete: 'DownloadIncomplete',
@@ -62,3 +65,21 @@ export class AuthenticationFailure extends Error {
62
65
  this.authenticationFailed = true;
63
66
  }
64
67
  }
68
+ /**
69
+ * Creates an {@link ImapFlowError} with a code and optional extra properties. The code is
70
+ * checked by the compiler against {@link ImapFlowErrorCode}, so a typo or an undeclared
71
+ * code fails the build instead of reaching consumers.
72
+ *
73
+ * @param message - The error message
74
+ * @param code - The error code
75
+ * @param props - Extra properties to set on the error
76
+ * @returns The error, ready to throw or reject with
77
+ */
78
+ export function createImapError(message, code, props) {
79
+ const error = new Error(message);
80
+ error.code = code;
81
+ if (props) {
82
+ Object.assign(error, props);
83
+ }
84
+ return error;
85
+ }
@@ -12,13 +12,13 @@ import type { CompilerOptions, ImapCompileInput } from './types.js';
12
12
  * @param options.isLogging - If true, redacts sensitive values and truncates long strings/literals for logging purposes.
13
13
  * @param options.literalPlus - If true, uses the LITERAL+ extension (appends "+" to literal length markers).
14
14
  * @param options.literalMinus - If true, uses the LITERAL- extension for literals up to 4096 bytes.
15
- * @returns A promise that resolves to an array of Buffers (if asArray is true) or a single concatenated Buffer.
15
+ * @returns An array of Buffers (if asArray is true) or a single concatenated Buffer.
16
16
  */
17
17
  declare function compiler(response: ImapCompileInput, options: CompilerOptions & {
18
18
  asArray: true;
19
- }): Promise<Buffer[]>;
19
+ }): Buffer[];
20
20
  declare function compiler(response: ImapCompileInput, options?: (CompilerOptions & {
21
21
  asArray?: false | undefined;
22
- }) | undefined): Promise<Buffer>;
23
- declare function compiler(response: ImapCompileInput, options?: CompilerOptions | undefined): Promise<Buffer | Buffer[]>;
22
+ }) | undefined): Buffer;
23
+ declare function compiler(response: ImapCompileInput, options?: CompilerOptions | undefined): Buffer | Buffer[];
24
24
  export default compiler;