flujo-ai 3.38.0 → 3.40.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 (997) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +617 -433
  3. package/.next/app-path-routes-manifest.json +42 -26
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +90 -18
  6. package/.next/react-loadable-manifest.json +40 -47
  7. package/.next/routes-manifest.json +34 -0
  8. package/.next/server/app/_not-found/page.js +3 -4
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_not-found.html +1 -1
  12. package/.next/server/app/_not-found.rsc +5 -5
  13. package/.next/server/app/api/approvals/[id]/route.js +1 -1
  14. package/.next/server/app/api/approvals/[id]/route.js.nft.json +1 -1
  15. package/.next/server/app/api/approvals/[id]/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/approvals/route.js +2 -2
  17. package/.next/server/app/api/approvals/route.js.nft.json +1 -1
  18. package/.next/server/app/api/approvals/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/backup/route.js +1 -1
  20. package/.next/server/app/api/backup/route.js.nft.json +1 -1
  21. package/.next/server/app/api/backup/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/browse/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/bugs/enhance/route.js +2 -2
  24. package/.next/server/app/api/bugs/enhance/route.js.nft.json +1 -1
  25. package/.next/server/app/api/bugs/enhance/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/cwd/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/encryption/secure/route.js +1 -1
  28. package/.next/server/app/api/encryption/secure/route.js.nft.json +1 -1
  29. package/.next/server/app/api/encryption/secure/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/env/route.js +2 -2
  31. package/.next/server/app/api/env/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route.js +1 -0
  33. package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route.js.nft.json +1 -0
  34. package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route_client-reference-manifest.js +1 -0
  35. package/.next/server/app/api/flow/[id]/route.js +1 -1
  36. package/.next/server/app/api/flow/[id]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/flow/[id]/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/flow/[id]/versions/[versionId]/route.js +1 -1
  39. package/.next/server/app/api/flow/[id]/versions/[versionId]/route.js.nft.json +1 -1
  40. package/.next/server/app/api/flow/[id]/versions/[versionId]/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/flow/[id]/versions/route.js +1 -1
  42. package/.next/server/app/api/flow/[id]/versions/route.js.nft.json +1 -1
  43. package/.next/server/app/api/flow/[id]/versions/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/flow/assist/route.js +1 -0
  45. package/.next/server/app/api/flow/assist/route.js.nft.json +1 -0
  46. package/.next/server/app/api/flow/assist/route_client-reference-manifest.js +1 -0
  47. package/.next/server/app/api/flow/compile/route.js +1 -1
  48. package/.next/server/app/api/flow/compile/route.js.nft.json +1 -1
  49. package/.next/server/app/api/flow/compile/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/flow/generate/route.js +1 -1
  51. package/.next/server/app/api/flow/generate/route.js.nft.json +1 -1
  52. package/.next/server/app/api/flow/generate/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/flow/generator/route.js +2 -2
  54. package/.next/server/app/api/flow/generator/route.js.nft.json +1 -1
  55. package/.next/server/app/api/flow/generator/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/flow/improve/route.js +1 -1
  57. package/.next/server/app/api/flow/improve/route.js.nft.json +1 -1
  58. package/.next/server/app/api/flow/improve/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/flow/prompt-renderer/route.js +2 -2
  60. package/.next/server/app/api/flow/prompt-renderer/route.js.nft.json +1 -1
  61. package/.next/server/app/api/flow/prompt-renderer/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/flow/quick-chat/route.js +1 -1
  63. package/.next/server/app/api/flow/quick-chat/route.js.nft.json +1 -1
  64. package/.next/server/app/api/flow/quick-chat/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/flow/repair/route.js +1 -1
  66. package/.next/server/app/api/flow/repair/route.js.nft.json +1 -1
  67. package/.next/server/app/api/flow/repair/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/flow/route.js +1 -1
  69. package/.next/server/app/api/flow/route.js.nft.json +1 -1
  70. package/.next/server/app/api/flow/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/git/route.js +6 -6
  72. package/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/init/route.js +1 -1
  74. package/.next/server/app/api/init/route.js.nft.json +1 -1
  75. package/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/local-models/capability/route.js +1 -1
  77. package/.next/server/app/api/local-models/capability/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/local-models/pull/route.js +1 -1
  79. package/.next/server/app/api/local-models/pull/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/local-models/suggest/route.js +1 -1
  81. package/.next/server/app/api/local-models/suggest/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/mcp/app-sandbox/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/mcp/cancel/route.js +2 -2
  84. package/.next/server/app/api/mcp/cancel/route.js.nft.json +1 -1
  85. package/.next/server/app/api/mcp/cancel/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/mcp/flujo/authoring/route.js +1 -0
  87. package/.next/server/app/api/mcp/flujo/authoring/route.js.nft.json +1 -0
  88. package/.next/server/app/api/mcp/flujo/authoring/route_client-reference-manifest.js +1 -0
  89. package/.next/server/app/api/mcp/flujo/automation/route.js +1 -0
  90. package/.next/server/app/api/mcp/flujo/automation/route.js.nft.json +1 -0
  91. package/.next/server/app/api/mcp/flujo/automation/route_client-reference-manifest.js +1 -0
  92. package/.next/server/app/api/mcp/flujo/flows/route.js +1 -0
  93. package/.next/server/app/api/mcp/flujo/flows/route.js.nft.json +1 -0
  94. package/.next/server/app/api/mcp/flujo/flows/route_client-reference-manifest.js +1 -0
  95. package/.next/server/app/api/mcp/flujo/resources/read/route.js +1 -0
  96. package/.next/server/app/api/mcp/flujo/resources/read/route.js.nft.json +1 -0
  97. package/.next/server/app/api/mcp/flujo/resources/read/route_client-reference-manifest.js +1 -0
  98. package/.next/server/app/api/mcp/flujo/resources/route.js +1 -0
  99. package/.next/server/app/api/mcp/flujo/resources/route.js.nft.json +1 -0
  100. package/.next/server/app/api/mcp/flujo/resources/route_client-reference-manifest.js +1 -0
  101. package/.next/server/app/api/mcp/flujo/servers/route.js +1 -0
  102. package/.next/server/app/api/mcp/flujo/servers/route.js.nft.json +1 -0
  103. package/.next/server/app/api/mcp/flujo/servers/route_client-reference-manifest.js +1 -0
  104. package/.next/server/app/api/mcp/flujo/state/route.js +1 -0
  105. package/.next/server/app/api/mcp/flujo/state/route.js.nft.json +1 -0
  106. package/.next/server/app/api/mcp/flujo/state/route_client-reference-manifest.js +1 -0
  107. package/.next/server/app/api/mcp/flujo/tools/route.js +1 -0
  108. package/.next/server/app/api/mcp/flujo/tools/route.js.nft.json +1 -0
  109. package/.next/server/app/api/mcp/flujo/tools/route_client-reference-manifest.js +1 -0
  110. package/.next/server/app/api/mcp/oauth-capability/route.js +1 -1
  111. package/.next/server/app/api/mcp/oauth-capability/route.js.nft.json +1 -1
  112. package/.next/server/app/api/mcp/oauth-capability/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js +1 -1
  114. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js.nft.json +1 -1
  115. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/mcp/servers/[name]/prompts/route.js +1 -1
  117. package/.next/server/app/api/mcp/servers/[name]/prompts/route.js.nft.json +1 -1
  118. package/.next/server/app/api/mcp/servers/[name]/prompts/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js +1 -1
  120. package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js.nft.json +1 -1
  121. package/.next/server/app/api/mcp/servers/[name]/resources/read/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/mcp/servers/[name]/resources/route.js +1 -1
  123. package/.next/server/app/api/mcp/servers/[name]/resources/route.js.nft.json +1 -1
  124. package/.next/server/app/api/mcp/servers/[name]/resources/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/api/mcp/servers/[name]/route.js +1 -1
  126. package/.next/server/app/api/mcp/servers/[name]/route.js.nft.json +1 -1
  127. package/.next/server/app/api/mcp/servers/[name]/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/api/mcp/servers/[name]/status/route.js +1 -1
  129. package/.next/server/app/api/mcp/servers/[name]/status/route.js.nft.json +1 -1
  130. package/.next/server/app/api/mcp/servers/[name]/status/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js +1 -1
  132. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js.nft.json +1 -1
  133. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/api/mcp/servers/[name]/tools/route.js +1 -1
  135. package/.next/server/app/api/mcp/servers/[name]/tools/route.js.nft.json +1 -1
  136. package/.next/server/app/api/mcp/servers/[name]/tools/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/mcp/servers/route.js +1 -1
  138. package/.next/server/app/api/mcp/servers/route.js.nft.json +1 -1
  139. package/.next/server/app/api/mcp/servers/route_client-reference-manifest.js +1 -1
  140. package/.next/server/app/api/mcp/test-connection/route.js +1 -1
  141. package/.next/server/app/api/mcp/test-connection/route.js.nft.json +1 -1
  142. package/.next/server/app/api/mcp/test-connection/route_client-reference-manifest.js +1 -1
  143. package/.next/server/app/api/mcp/test-connection/stream/route.js +1 -1
  144. package/.next/server/app/api/mcp/test-connection/stream/route.js.nft.json +1 -1
  145. package/.next/server/app/api/mcp/test-connection/stream/route_client-reference-manifest.js +1 -1
  146. package/.next/server/app/api/mcp-registry/route.js +2 -2
  147. package/.next/server/app/api/mcp-registry/route.js.nft.json +1 -1
  148. package/.next/server/app/api/mcp-registry/route_client-reference-manifest.js +1 -1
  149. package/.next/server/app/api/mcp-registry/spotlight/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/model/[id]/route.js +1 -1
  151. package/.next/server/app/api/model/[id]/route.js.nft.json +1 -1
  152. package/.next/server/app/api/model/[id]/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/model/provider/route.js +2 -2
  154. package/.next/server/app/api/model/provider/route.js.nft.json +1 -1
  155. package/.next/server/app/api/model/provider/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/model/route.js +1 -1
  157. package/.next/server/app/api/model/route.js.nft.json +1 -1
  158. package/.next/server/app/api/model/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/api/model/test/route.js +2 -2
  160. package/.next/server/app/api/model/test/route.js.nft.json +1 -1
  161. package/.next/server/app/api/model/test/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/oauth/callback/route.js +1 -1
  163. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  164. package/.next/server/app/api/oauth/initiate/route.js +1 -1
  165. package/.next/server/app/api/oauth/initiate/route_client-reference-manifest.js +1 -1
  166. package/.next/server/app/api/oauth/reset/route.js +2 -2
  167. package/.next/server/app/api/oauth/reset/route.js.nft.json +1 -1
  168. package/.next/server/app/api/oauth/reset/route_client-reference-manifest.js +1 -1
  169. package/.next/server/app/api/packages/build/route.js +1 -1
  170. package/.next/server/app/api/packages/build/route.js.nft.json +1 -1
  171. package/.next/server/app/api/packages/build/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/packages/derive-secrets/route.js +1 -1
  173. package/.next/server/app/api/packages/derive-secrets/route.js.nft.json +1 -1
  174. package/.next/server/app/api/packages/derive-secrets/route_client-reference-manifest.js +1 -1
  175. package/.next/server/app/api/packages/install/route.js +1 -1
  176. package/.next/server/app/api/packages/install/route.js.nft.json +1 -1
  177. package/.next/server/app/api/packages/install/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/packages/install/status/route.js +1 -1
  179. package/.next/server/app/api/packages/install/status/route.js.nft.json +1 -1
  180. package/.next/server/app/api/packages/install/status/route_client-reference-manifest.js +1 -1
  181. package/.next/server/app/api/packages/installed/route.js +1 -1
  182. package/.next/server/app/api/packages/installed/route.js.nft.json +1 -1
  183. package/.next/server/app/api/packages/installed/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/api/packages/resolve/route.js +1 -1
  185. package/.next/server/app/api/packages/resolve/route.js.nft.json +1 -1
  186. package/.next/server/app/api/packages/resolve/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/api/packages/scan-targets/route.js +1 -1
  188. package/.next/server/app/api/packages/scan-targets/route.js.nft.json +1 -1
  189. package/.next/server/app/api/packages/scan-targets/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/api/packages/search/route_client-reference-manifest.js +1 -1
  191. package/.next/server/app/api/packages/uninstall/route.js +1 -1
  192. package/.next/server/app/api/packages/uninstall/route.js.nft.json +1 -1
  193. package/.next/server/app/api/packages/uninstall/route_client-reference-manifest.js +1 -1
  194. package/.next/server/app/api/planned-executions/[id]/route.js +2 -2
  195. package/.next/server/app/api/planned-executions/[id]/route.js.nft.json +1 -1
  196. package/.next/server/app/api/planned-executions/[id]/route_client-reference-manifest.js +1 -1
  197. package/.next/server/app/api/planned-executions/[id]/run/route.js +2 -2
  198. package/.next/server/app/api/planned-executions/[id]/run/route.js.nft.json +1 -1
  199. package/.next/server/app/api/planned-executions/[id]/run/route_client-reference-manifest.js +1 -1
  200. package/.next/server/app/api/planned-executions/[id]/runs/route.js +2 -2
  201. package/.next/server/app/api/planned-executions/[id]/runs/route.js.nft.json +1 -1
  202. package/.next/server/app/api/planned-executions/[id]/runs/route_client-reference-manifest.js +1 -1
  203. package/.next/server/app/api/planned-executions/preview-schedule/route_client-reference-manifest.js +1 -1
  204. package/.next/server/app/api/planned-executions/reconcile/route.js +1 -1
  205. package/.next/server/app/api/planned-executions/reconcile/route.js.nft.json +1 -1
  206. package/.next/server/app/api/planned-executions/reconcile/route_client-reference-manifest.js +1 -1
  207. package/.next/server/app/api/planned-executions/route.js +1 -1
  208. package/.next/server/app/api/planned-executions/route.js.nft.json +1 -1
  209. package/.next/server/app/api/planned-executions/route_client-reference-manifest.js +1 -1
  210. package/.next/server/app/api/registry/auth/resend/route.js +1 -1
  211. package/.next/server/app/api/registry/auth/resend/route_client-reference-manifest.js +1 -1
  212. package/.next/server/app/api/registry/auth/reset/route.js +1 -1
  213. package/.next/server/app/api/registry/auth/reset/route_client-reference-manifest.js +1 -1
  214. package/.next/server/app/api/registry/auth/route.js +1 -1
  215. package/.next/server/app/api/registry/auth/route_client-reference-manifest.js +1 -1
  216. package/.next/server/app/api/registry/feedback/route_client-reference-manifest.js +1 -1
  217. package/.next/server/app/api/registry/oauth/callback/route.js +1 -1
  218. package/.next/server/app/api/registry/oauth/callback/route_client-reference-manifest.js +1 -1
  219. package/.next/server/app/api/registry/oauth/initiate/route.js +1 -1
  220. package/.next/server/app/api/registry/oauth/initiate/route_client-reference-manifest.js +1 -1
  221. package/.next/server/app/api/registry/packages/route.js +1 -1
  222. package/.next/server/app/api/registry/packages/route_client-reference-manifest.js +1 -1
  223. package/.next/server/app/api/registry/publish/route.js +1 -1
  224. package/.next/server/app/api/registry/publish/route_client-reference-manifest.js +1 -1
  225. package/.next/server/app/api/registry/settings/route.js +1 -1
  226. package/.next/server/app/api/registry/settings/route_client-reference-manifest.js +1 -1
  227. package/.next/server/app/api/restore/route.js +1 -1
  228. package/.next/server/app/api/restore/route.js.nft.json +1 -1
  229. package/.next/server/app/api/restore/route_client-reference-manifest.js +1 -1
  230. package/.next/server/app/api/runs/active/route.js +2 -2
  231. package/.next/server/app/api/runs/active/route.js.nft.json +1 -1
  232. package/.next/server/app/api/runs/active/route_client-reference-manifest.js +1 -1
  233. package/.next/server/app/api/setup/ai-cli/route.js +3 -0
  234. package/.next/server/app/api/setup/ai-cli/route.js.nft.json +1 -0
  235. package/.next/server/app/api/setup/ai-cli/route_client-reference-manifest.js +1 -0
  236. package/.next/server/app/api/statistics/route.js +2 -0
  237. package/.next/server/app/api/statistics/route.js.nft.json +1 -0
  238. package/.next/server/app/api/statistics/route_client-reference-manifest.js +1 -0
  239. package/.next/server/app/api/storage/route_client-reference-manifest.js +1 -1
  240. package/.next/server/app/api/telemetry/daily-active/route.js +1 -1
  241. package/.next/server/app/api/telemetry/daily-active/route_client-reference-manifest.js +1 -1
  242. package/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  243. package/.next/server/app/api/waves/route.js +1 -1
  244. package/.next/server/app/api/waves/route.js.nft.json +1 -1
  245. package/.next/server/app/api/waves/route_client-reference-manifest.js +1 -1
  246. package/.next/server/app/api/webhooks/[id]/route.js +1 -1
  247. package/.next/server/app/api/webhooks/[id]/route.js.nft.json +1 -1
  248. package/.next/server/app/api/webhooks/[id]/route_client-reference-manifest.js +1 -1
  249. package/.next/server/app/automation/triggers/page.js +2 -0
  250. package/.next/server/app/automation/triggers/page.js.nft.json +1 -0
  251. package/.next/server/app/automation/triggers/page_client-reference-manifest.js +1 -0
  252. package/.next/server/app/automation/triggers.html +1 -0
  253. package/.next/server/app/automation/triggers.meta +7 -0
  254. package/.next/server/app/automation/triggers.rsc +23 -0
  255. package/.next/server/app/automation/waves/page.js +2 -0
  256. package/.next/server/app/automation/waves/page.js.nft.json +1 -0
  257. package/.next/server/app/automation/waves/page_client-reference-manifest.js +1 -0
  258. package/.next/server/app/automation/waves.html +1 -0
  259. package/.next/server/app/automation/waves.meta +7 -0
  260. package/.next/server/app/automation/waves.rsc +22 -0
  261. package/.next/server/app/chat/page.js +6 -58
  262. package/.next/server/app/chat/page.js.nft.json +1 -1
  263. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  264. package/.next/server/app/chat.html +1 -1
  265. package/.next/server/app/chat.rsc +7 -6
  266. package/.next/server/app/docs/page.js +3 -4
  267. package/.next/server/app/docs/page.js.nft.json +1 -1
  268. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  269. package/.next/server/app/docs.html +1 -1
  270. package/.next/server/app/docs.rsc +6 -6
  271. package/.next/server/app/executions/page.js +2 -3
  272. package/.next/server/app/executions/page.js.nft.json +1 -1
  273. package/.next/server/app/executions/page_client-reference-manifest.js +1 -1
  274. package/.next/server/app/executions.html +1 -1
  275. package/.next/server/app/executions.rsc +7 -6
  276. package/.next/server/app/flows/page.js +3 -3
  277. package/.next/server/app/flows/page.js.nft.json +1 -1
  278. package/.next/server/app/flows/page_client-reference-manifest.js +1 -1
  279. package/.next/server/app/flows.html +1 -1
  280. package/.next/server/app/flows.rsc +7 -7
  281. package/.next/server/app/index.html +1 -1
  282. package/.next/server/app/index.rsc +6 -6
  283. package/.next/server/app/mcp/page.js +6 -57
  284. package/.next/server/app/mcp/page.js.nft.json +1 -1
  285. package/.next/server/app/mcp/page_client-reference-manifest.js +1 -1
  286. package/.next/server/app/mcp-flows/route.js +2 -1
  287. package/.next/server/app/mcp-flows/route.js.nft.json +1 -1
  288. package/.next/server/app/mcp-flows/route_client-reference-manifest.js +1 -1
  289. package/.next/server/app/mcp-proxy/[server]/route.js +2 -1
  290. package/.next/server/app/mcp-proxy/[server]/route.js.nft.json +1 -1
  291. package/.next/server/app/mcp-proxy/[server]/route_client-reference-manifest.js +1 -1
  292. package/.next/server/app/mcp.html +1 -1
  293. package/.next/server/app/mcp.rsc +7 -6
  294. package/.next/server/app/models/page.js +64 -2
  295. package/.next/server/app/models/page.js.nft.json +1 -1
  296. package/.next/server/app/models/page_client-reference-manifest.js +1 -1
  297. package/.next/server/app/packages/page.js +2 -2
  298. package/.next/server/app/packages/page.js.nft.json +1 -1
  299. package/.next/server/app/packages/page_client-reference-manifest.js +1 -1
  300. package/.next/server/app/packages.html +1 -1
  301. package/.next/server/app/packages.rsc +6 -6
  302. package/.next/server/app/page.js +3 -4
  303. package/.next/server/app/page.js.nft.json +1 -1
  304. package/.next/server/app/page_client-reference-manifest.js +1 -1
  305. package/.next/server/app/settings/page.js +2 -2
  306. package/.next/server/app/settings/page.js.nft.json +1 -1
  307. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  308. package/.next/server/app/settings.html +1 -1
  309. package/.next/server/app/settings.rsc +6 -6
  310. package/.next/server/app/statistics/page.js +54 -0
  311. package/.next/server/app/statistics/page.js.nft.json +1 -0
  312. package/.next/server/app/statistics/page_client-reference-manifest.js +1 -0
  313. package/.next/server/app/statistics.html +1 -0
  314. package/.next/server/app/statistics.meta +7 -0
  315. package/.next/server/app/statistics.rsc +22 -0
  316. package/.next/server/app/v1/chat/completions/route.js +1 -1
  317. package/.next/server/app/v1/chat/completions/route.js.nft.json +1 -1
  318. package/.next/server/app/v1/chat/completions/route_client-reference-manifest.js +1 -1
  319. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js +2 -2
  320. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js.nft.json +1 -1
  321. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route_client-reference-manifest.js +1 -1
  322. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js +2 -2
  323. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js.nft.json +1 -1
  324. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route_client-reference-manifest.js +1 -1
  325. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js +1 -1
  326. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js.nft.json +1 -1
  327. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route_client-reference-manifest.js +1 -1
  328. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js +1 -1
  329. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js.nft.json +1 -1
  330. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route_client-reference-manifest.js +1 -1
  331. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js +2 -2
  332. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js.nft.json +1 -1
  333. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route_client-reference-manifest.js +1 -1
  334. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js +3 -3
  335. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js.nft.json +1 -1
  336. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route_client-reference-manifest.js +1 -1
  337. package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route.js +2 -2
  338. package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route.js.nft.json +1 -1
  339. package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route_client-reference-manifest.js +1 -1
  340. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route.js +1 -1
  341. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route.js.nft.json +1 -1
  342. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route_client-reference-manifest.js +1 -1
  343. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js +1 -1
  344. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js.nft.json +1 -1
  345. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route_client-reference-manifest.js +1 -1
  346. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js +1 -1
  347. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js.nft.json +1 -1
  348. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route_client-reference-manifest.js +1 -1
  349. package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route.js +2 -0
  350. package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route.js.nft.json +1 -0
  351. package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route_client-reference-manifest.js +1 -0
  352. package/.next/server/app/v1/chat/conversations/[conversationId]/route.js +2 -2
  353. package/.next/server/app/v1/chat/conversations/[conversationId]/route.js.nft.json +1 -1
  354. package/.next/server/app/v1/chat/conversations/[conversationId]/route_client-reference-manifest.js +1 -1
  355. package/.next/server/app/v1/chat/conversations/route.js +2 -2
  356. package/.next/server/app/v1/chat/conversations/route.js.nft.json +1 -1
  357. package/.next/server/app/v1/chat/conversations/route_client-reference-manifest.js +1 -1
  358. package/.next/server/app/v1/chat/events/route.js +6 -6
  359. package/.next/server/app/v1/chat/events/route.js.nft.json +1 -1
  360. package/.next/server/app/v1/chat/events/route_client-reference-manifest.js +1 -1
  361. package/.next/server/app/v1/models/route.js +2 -2
  362. package/.next/server/app/v1/models/route.js.nft.json +1 -1
  363. package/.next/server/app/v1/models/route_client-reference-manifest.js +1 -1
  364. package/.next/server/app/waves/page.js +2 -4
  365. package/.next/server/app/waves/page.js.nft.json +1 -1
  366. package/.next/server/app/waves/page_client-reference-manifest.js +1 -1
  367. package/.next/server/app/waves.html +1 -1
  368. package/.next/server/app/waves.rsc +6 -6
  369. package/.next/server/app-paths-manifest.json +42 -26
  370. package/.next/server/chunks/1227.js +1 -1
  371. package/.next/server/chunks/1314.js +1 -1
  372. package/.next/server/chunks/1403.js +3 -0
  373. package/.next/server/chunks/{180.js → 1532.js} +1 -1
  374. package/.next/server/chunks/1539.js +1 -0
  375. package/.next/server/chunks/1662.js +2 -0
  376. package/.next/server/chunks/1805.js +1 -1
  377. package/.next/server/chunks/1925.js +1 -1
  378. package/.next/server/chunks/2069.js +1 -0
  379. package/.next/server/chunks/227.js +1 -1
  380. package/.next/server/chunks/2372.js +2 -2
  381. package/.next/server/chunks/2446.js +1 -0
  382. package/.next/server/chunks/2828.js +2 -0
  383. package/.next/server/chunks/2949.js +1 -0
  384. package/.next/server/chunks/{6034.js → 300.js} +15 -15
  385. package/.next/server/chunks/3032.js +29 -0
  386. package/.next/server/chunks/3206.js +2 -0
  387. package/.next/server/chunks/3262.js +90 -0
  388. package/.next/server/chunks/3418.js +1 -0
  389. package/.next/server/chunks/3945.js +10 -0
  390. package/.next/server/chunks/{6967.js → 3954.js} +3 -3
  391. package/.next/server/chunks/3963.js +6 -0
  392. package/.next/server/chunks/3991.js +2 -0
  393. package/.next/server/chunks/4265.js +1 -1
  394. package/.next/server/chunks/4306.js +1 -1
  395. package/.next/server/chunks/4671.js +1 -1
  396. package/.next/server/chunks/4681.js +1 -1
  397. package/.next/server/chunks/4771.js +2 -2
  398. package/.next/server/chunks/5096.js +1 -1
  399. package/.next/server/chunks/5141.js +2 -0
  400. package/.next/server/chunks/519.js +2 -2
  401. package/.next/server/chunks/5444.js +2 -0
  402. package/.next/server/chunks/5446.js +1 -0
  403. package/.next/server/chunks/{7058.js → 5494.js} +2 -2
  404. package/.next/server/chunks/558.js +1 -1
  405. package/.next/server/chunks/5591.js +1 -0
  406. package/.next/server/chunks/{3312.js → 5642.js} +1 -1
  407. package/.next/server/chunks/566.js +2 -0
  408. package/.next/server/chunks/5750.js +1 -0
  409. package/.next/server/chunks/{7519.js → 5807.js} +1 -1
  410. package/.next/server/chunks/5858.js +1 -0
  411. package/.next/server/chunks/5918.js +436 -0
  412. package/.next/server/chunks/5936.js +1 -0
  413. package/.next/server/chunks/6033.js +1 -0
  414. package/.next/server/chunks/6226.js +4 -4
  415. package/.next/server/chunks/6607.js +1 -0
  416. package/.next/server/chunks/6687.js +1 -0
  417. package/.next/server/chunks/701.js +2 -2
  418. package/.next/server/chunks/7031.js +1 -0
  419. package/.next/server/chunks/7147.js +1 -0
  420. package/.next/server/chunks/7480.js +2 -0
  421. package/.next/server/chunks/{8284.js → 7498.js} +2 -2
  422. package/.next/server/chunks/7506.js +2 -2
  423. package/.next/server/chunks/7508.js +5 -0
  424. package/.next/server/chunks/7628.js +1 -1
  425. package/.next/server/chunks/7630.js +1 -1
  426. package/.next/server/chunks/773.js +9 -0
  427. package/.next/server/chunks/7821.js +1 -1
  428. package/.next/server/chunks/7883.js +1 -0
  429. package/.next/server/chunks/7969.js +1 -1
  430. package/.next/server/chunks/8001.js +1 -1
  431. package/.next/server/chunks/8092.js +1 -1
  432. package/.next/server/chunks/8291.js +1 -0
  433. package/.next/server/chunks/8598.js +1 -0
  434. package/.next/server/chunks/8645.js +1 -1
  435. package/.next/server/chunks/{3489.js → 8730.js} +1 -1
  436. package/.next/server/chunks/8897.js +1 -0
  437. package/.next/server/chunks/8903.js +4 -0
  438. package/.next/server/chunks/8940.js +1 -0
  439. package/.next/server/chunks/9088.js +6 -0
  440. package/.next/server/chunks/9543.js +8 -0
  441. package/.next/server/chunks/9624.js +136 -0
  442. package/.next/server/functions-config-manifest.json +4 -3
  443. package/.next/server/instrumentation.js +1 -1
  444. package/.next/server/instrumentation.js.nft.json +1 -1
  445. package/.next/server/middleware-build-manifest.js +1 -1
  446. package/.next/server/middleware-manifest.json +1 -1
  447. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  448. package/.next/server/pages/404.html +1 -1
  449. package/.next/server/pages/500.html +1 -1
  450. package/.next/server/server-reference-manifest.js +1 -1
  451. package/.next/server/server-reference-manifest.json +1 -1
  452. package/.next/static/b1aMk0634gkkiunttd1SQ/_buildManifest.js +1 -0
  453. package/.next/static/chunks/1161-19176c3e7c655121.js +1 -0
  454. package/.next/static/chunks/1521-1c98c9a56726e053.js +1 -0
  455. package/.next/static/chunks/155-12f2a537db5dacec.js +1 -0
  456. package/.next/static/chunks/1576.bc6ae6c9e6d939d8.js +1 -0
  457. package/.next/static/chunks/1871-dd8c10ed9d37100b.js +1 -0
  458. package/.next/static/chunks/1983-242862b3dc022a26.js +1 -0
  459. package/.next/static/chunks/2005.300528b5119c2d38.js +1 -0
  460. package/.next/static/chunks/2141-dba0d13715fe1a28.js +1 -0
  461. package/.next/static/chunks/2498-4f7f5de1cac6feba.js +1 -0
  462. package/.next/static/chunks/2499-92cd97ce4993999f.js +1 -0
  463. package/.next/static/chunks/3272-42d1acae08d1ef0a.js +1 -0
  464. package/.next/static/chunks/3303-febfba58226aebed.js +1 -0
  465. package/.next/static/chunks/{361.bb75b03b740930cd.js → 361.51d642c530c84295.js} +1 -1
  466. package/.next/static/chunks/3731-64070760ae44448f.js +1 -0
  467. package/.next/static/chunks/3776.72638b35ce9bb874.js +1 -0
  468. package/.next/static/chunks/3816-807978463638bb71.js +1 -0
  469. package/.next/static/chunks/4122-d82fad8d1fca26d6.js +1 -0
  470. package/.next/static/chunks/4123-906362aeb986d6db.js +1 -0
  471. package/.next/static/chunks/4156-3823d1c89c4a7e3d.js +1 -0
  472. package/.next/static/chunks/{4555-c9070f8c79bccfad.js → 4483-00dc5c1b601ec898.js} +3 -3
  473. package/.next/static/chunks/4755-83df83d0dbd97483.js +1 -0
  474. package/.next/static/chunks/4814-31eb5f3b10c651c1.js +1 -0
  475. package/.next/static/chunks/4965.39e24b54c3c6ca58.js +1 -0
  476. package/.next/static/chunks/57-64bab7d5db89c9cc.js +1 -0
  477. package/.next/static/chunks/5954-dd2b25224f389fc0.js +1 -0
  478. package/.next/static/chunks/5962-8c59d06b3ee1c42a.js +1 -0
  479. package/.next/static/chunks/5967-59fde8c214c9ca9f.js +1 -0
  480. package/.next/static/chunks/6417.70056fe81ca21682.js +1 -0
  481. package/.next/static/chunks/6420-25dd04f98f3b34b8.js +1 -0
  482. package/.next/static/chunks/6547-2adc20e1ace927fc.js +1 -0
  483. package/.next/static/chunks/684-289a73150568def2.js +1 -0
  484. package/.next/static/chunks/7203-2704865539fa551d.js +1 -0
  485. package/.next/static/chunks/760-2ad13a61701630da.js +1 -0
  486. package/.next/static/chunks/7711-4b017720ec49c96d.js +1 -0
  487. package/.next/static/chunks/7758-42ab0b9cce1dc0e3.js +1 -0
  488. package/.next/static/chunks/8124-94140ee1dd8ed87c.js +1 -0
  489. package/.next/static/chunks/8135-5b975b9014f8920b.js +1 -0
  490. package/.next/static/chunks/{8198.cd0d3f8429c02862.js → 8198.a9cc35771b354b03.js} +1 -1
  491. package/.next/static/chunks/8326-4915403bc93459d2.js +1 -0
  492. package/.next/static/chunks/8529.b5a43e728bb5bb8a.js +1 -0
  493. package/.next/static/chunks/{6428-951188daa6f74b86.js → 8620-c9fa9d75cdc18a5e.js} +3 -3
  494. package/.next/static/chunks/8853-b80e50cbec6fd13c.js +1 -0
  495. package/.next/static/chunks/8862-0e37dd5488b21c77.js +1 -0
  496. package/.next/static/chunks/889-e64385ddb2259b1b.js +1 -0
  497. package/.next/static/chunks/9001-4c27a608feddb878.js +1 -0
  498. package/.next/static/chunks/9050-fcb7a0c89314acb4.js +1 -0
  499. package/.next/static/chunks/9053-283dd8d615f904a5.js +8 -0
  500. package/.next/static/chunks/9136-9c415453ec02519c.js +1 -0
  501. package/.next/static/chunks/9140.6502327a2c098d33.js +1 -0
  502. package/.next/static/chunks/9195-3c9c4300e7505d9e.js +1 -0
  503. package/.next/static/chunks/9524-b9d2c7e4426edd07.js +1 -0
  504. package/.next/static/chunks/9562-5494feecd8c6f7a3.js +1 -0
  505. package/.next/static/chunks/9611-190b55ade8b3af3c.js +1 -0
  506. package/.next/static/chunks/app/api/approvals/[id]/route-e70b5e2b4e09002b.js +1 -0
  507. package/.next/static/chunks/app/api/approvals/route-e70b5e2b4e09002b.js +1 -0
  508. package/.next/static/chunks/app/api/backup/route-e70b5e2b4e09002b.js +1 -0
  509. package/.next/static/chunks/app/api/browse/route-e70b5e2b4e09002b.js +1 -0
  510. package/.next/static/chunks/app/api/bugs/enhance/route-e70b5e2b4e09002b.js +1 -0
  511. package/.next/static/chunks/app/api/cwd/route-e70b5e2b4e09002b.js +1 -0
  512. package/.next/static/chunks/app/api/encryption/secure/route-e70b5e2b4e09002b.js +1 -0
  513. package/.next/static/chunks/app/api/env/route-e70b5e2b4e09002b.js +1 -0
  514. package/.next/static/chunks/app/api/flow/[id]/convert-process-to-subflow/route-e70b5e2b4e09002b.js +1 -0
  515. package/.next/static/chunks/app/api/flow/[id]/route-e70b5e2b4e09002b.js +1 -0
  516. package/.next/static/chunks/app/api/flow/[id]/versions/[versionId]/route-e70b5e2b4e09002b.js +1 -0
  517. package/.next/static/chunks/app/api/flow/[id]/versions/route-e70b5e2b4e09002b.js +1 -0
  518. package/.next/static/chunks/app/api/flow/assist/route-e70b5e2b4e09002b.js +1 -0
  519. package/.next/static/chunks/app/api/flow/compile/route-e70b5e2b4e09002b.js +1 -0
  520. package/.next/static/chunks/app/api/flow/generate/route-e70b5e2b4e09002b.js +1 -0
  521. package/.next/static/chunks/app/api/flow/generator/route-e70b5e2b4e09002b.js +1 -0
  522. package/.next/static/chunks/app/api/flow/improve/route-e70b5e2b4e09002b.js +1 -0
  523. package/.next/static/chunks/app/api/flow/prompt-renderer/route-e70b5e2b4e09002b.js +1 -0
  524. package/.next/static/chunks/app/api/flow/quick-chat/route-e70b5e2b4e09002b.js +1 -0
  525. package/.next/static/chunks/app/api/flow/repair/route-e70b5e2b4e09002b.js +1 -0
  526. package/.next/static/chunks/app/api/flow/route-e70b5e2b4e09002b.js +1 -0
  527. package/.next/static/chunks/app/api/git/route-e70b5e2b4e09002b.js +1 -0
  528. package/.next/static/chunks/app/api/init/route-e70b5e2b4e09002b.js +1 -0
  529. package/.next/static/chunks/app/api/local-models/capability/route-e70b5e2b4e09002b.js +1 -0
  530. package/.next/static/chunks/app/api/local-models/pull/route-e70b5e2b4e09002b.js +1 -0
  531. package/.next/static/chunks/app/api/local-models/suggest/route-e70b5e2b4e09002b.js +1 -0
  532. package/.next/static/chunks/app/api/mcp/app-sandbox/route-e70b5e2b4e09002b.js +1 -0
  533. package/.next/static/chunks/app/api/mcp/cancel/route-e70b5e2b4e09002b.js +1 -0
  534. package/.next/static/chunks/app/api/mcp/flujo/authoring/route-e70b5e2b4e09002b.js +1 -0
  535. package/.next/static/chunks/app/api/mcp/flujo/automation/route-e70b5e2b4e09002b.js +1 -0
  536. package/.next/static/chunks/app/api/mcp/flujo/flows/route-e70b5e2b4e09002b.js +1 -0
  537. package/.next/static/chunks/app/api/mcp/flujo/resources/read/route-e70b5e2b4e09002b.js +1 -0
  538. package/.next/static/chunks/app/api/mcp/flujo/resources/route-e70b5e2b4e09002b.js +1 -0
  539. package/.next/static/chunks/app/api/mcp/flujo/servers/route-e70b5e2b4e09002b.js +1 -0
  540. package/.next/static/chunks/app/api/mcp/flujo/state/route-e70b5e2b4e09002b.js +1 -0
  541. package/.next/static/chunks/app/api/mcp/flujo/tools/route-e70b5e2b4e09002b.js +1 -0
  542. package/.next/static/chunks/app/api/mcp/oauth-capability/route-e70b5e2b4e09002b.js +1 -0
  543. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/get/route-e70b5e2b4e09002b.js +1 -0
  544. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/route-e70b5e2b4e09002b.js +1 -0
  545. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/read/route-e70b5e2b4e09002b.js +1 -0
  546. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/route-e70b5e2b4e09002b.js +1 -0
  547. package/.next/static/chunks/app/api/mcp/servers/[name]/route-e70b5e2b4e09002b.js +1 -0
  548. package/.next/static/chunks/app/api/mcp/servers/[name]/status/route-e70b5e2b4e09002b.js +1 -0
  549. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/[toolName]/route-e70b5e2b4e09002b.js +1 -0
  550. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/route-e70b5e2b4e09002b.js +1 -0
  551. package/.next/static/chunks/app/api/mcp/servers/route-e70b5e2b4e09002b.js +1 -0
  552. package/.next/static/chunks/app/api/mcp/test-connection/route-e70b5e2b4e09002b.js +1 -0
  553. package/.next/static/chunks/app/api/mcp/test-connection/stream/route-e70b5e2b4e09002b.js +1 -0
  554. package/.next/static/chunks/app/api/mcp-registry/route-e70b5e2b4e09002b.js +1 -0
  555. package/.next/static/chunks/app/api/mcp-registry/spotlight/route-e70b5e2b4e09002b.js +1 -0
  556. package/.next/static/chunks/app/api/model/[id]/route-e70b5e2b4e09002b.js +1 -0
  557. package/.next/static/chunks/app/api/model/provider/route-e70b5e2b4e09002b.js +1 -0
  558. package/.next/static/chunks/app/api/model/route-e70b5e2b4e09002b.js +1 -0
  559. package/.next/static/chunks/app/api/model/test/route-e70b5e2b4e09002b.js +1 -0
  560. package/.next/static/chunks/app/api/oauth/callback/route-e70b5e2b4e09002b.js +1 -0
  561. package/.next/static/chunks/app/api/oauth/initiate/route-e70b5e2b4e09002b.js +1 -0
  562. package/.next/static/chunks/app/api/oauth/reset/route-e70b5e2b4e09002b.js +1 -0
  563. package/.next/static/chunks/app/api/packages/build/route-e70b5e2b4e09002b.js +1 -0
  564. package/.next/static/chunks/app/api/packages/derive-secrets/route-e70b5e2b4e09002b.js +1 -0
  565. package/.next/static/chunks/app/api/packages/install/route-e70b5e2b4e09002b.js +1 -0
  566. package/.next/static/chunks/app/api/packages/install/status/route-e70b5e2b4e09002b.js +1 -0
  567. package/.next/static/chunks/app/api/packages/installed/route-e70b5e2b4e09002b.js +1 -0
  568. package/.next/static/chunks/app/api/packages/resolve/route-e70b5e2b4e09002b.js +1 -0
  569. package/.next/static/chunks/app/api/packages/scan-targets/route-e70b5e2b4e09002b.js +1 -0
  570. package/.next/static/chunks/app/api/packages/search/route-e70b5e2b4e09002b.js +1 -0
  571. package/.next/static/chunks/app/api/packages/uninstall/route-e70b5e2b4e09002b.js +1 -0
  572. package/.next/static/chunks/app/api/planned-executions/[id]/route-e70b5e2b4e09002b.js +1 -0
  573. package/.next/static/chunks/app/api/planned-executions/[id]/run/route-e70b5e2b4e09002b.js +1 -0
  574. package/.next/static/chunks/app/api/planned-executions/[id]/runs/route-e70b5e2b4e09002b.js +1 -0
  575. package/.next/static/chunks/app/api/planned-executions/preview-schedule/route-e70b5e2b4e09002b.js +1 -0
  576. package/.next/static/chunks/app/api/planned-executions/reconcile/route-e70b5e2b4e09002b.js +1 -0
  577. package/.next/static/chunks/app/api/planned-executions/route-e70b5e2b4e09002b.js +1 -0
  578. package/.next/static/chunks/app/api/registry/auth/resend/route-e70b5e2b4e09002b.js +1 -0
  579. package/.next/static/chunks/app/api/registry/auth/reset/route-e70b5e2b4e09002b.js +1 -0
  580. package/.next/static/chunks/app/api/registry/auth/route-e70b5e2b4e09002b.js +1 -0
  581. package/.next/static/chunks/app/api/registry/feedback/route-e70b5e2b4e09002b.js +1 -0
  582. package/.next/static/chunks/app/api/registry/oauth/callback/route-e70b5e2b4e09002b.js +1 -0
  583. package/.next/static/chunks/app/api/registry/oauth/initiate/route-e70b5e2b4e09002b.js +1 -0
  584. package/.next/static/chunks/app/api/registry/packages/route-e70b5e2b4e09002b.js +1 -0
  585. package/.next/static/chunks/app/api/registry/publish/route-e70b5e2b4e09002b.js +1 -0
  586. package/.next/static/chunks/app/api/registry/settings/route-e70b5e2b4e09002b.js +1 -0
  587. package/.next/static/chunks/app/api/restore/route-e70b5e2b4e09002b.js +1 -0
  588. package/.next/static/chunks/app/api/runs/active/route-e70b5e2b4e09002b.js +1 -0
  589. package/.next/static/chunks/app/api/setup/ai-cli/route-e70b5e2b4e09002b.js +1 -0
  590. package/.next/static/chunks/app/api/statistics/route-e70b5e2b4e09002b.js +1 -0
  591. package/.next/static/chunks/app/api/storage/route-e70b5e2b4e09002b.js +1 -0
  592. package/.next/static/chunks/app/api/telemetry/daily-active/route-e70b5e2b4e09002b.js +1 -0
  593. package/.next/static/chunks/app/api/update/route-e70b5e2b4e09002b.js +1 -0
  594. package/.next/static/chunks/app/api/waves/route-e70b5e2b4e09002b.js +1 -0
  595. package/.next/static/chunks/app/api/webhooks/[id]/route-e70b5e2b4e09002b.js +1 -0
  596. package/.next/static/chunks/app/automation/triggers/page-594a6294c58344bf.js +1 -0
  597. package/.next/static/chunks/app/automation/waves/page-ce2fef4996cad8e6.js +1 -0
  598. package/.next/static/chunks/app/chat/page-203cb7bf21638ada.js +1 -0
  599. package/.next/static/chunks/app/docs/page-c466a58caf5e3336.js +1 -0
  600. package/.next/static/chunks/app/executions/page-fcc848de86714386.js +1 -0
  601. package/.next/static/chunks/app/flows/page-172c759ca81ba02f.js +1 -0
  602. package/.next/static/chunks/app/layout-a6ca531683a518a7.js +1 -0
  603. package/.next/static/chunks/app/mcp/page-0a96e6b30e45b1e6.js +1 -0
  604. package/.next/static/chunks/app/mcp-flows/route-e70b5e2b4e09002b.js +1 -0
  605. package/.next/static/chunks/app/mcp-proxy/[server]/route-e70b5e2b4e09002b.js +1 -0
  606. package/.next/static/chunks/app/models/error-1964203c5c6e7d0e.js +1 -0
  607. package/.next/static/chunks/app/models/{loading-1687ae86584f5b1b.js → loading-0cdcf9bae7d3b8f3.js} +1 -1
  608. package/.next/static/chunks/app/models/page-ad1cbea6d3324966.js +1 -0
  609. package/.next/static/chunks/app/packages/page-dda48425be9fc137.js +1 -0
  610. package/.next/static/chunks/app/page-04189aa1b1318c2d.js +1 -0
  611. package/.next/static/chunks/app/settings/page-906c229c87011ead.js +1 -0
  612. package/.next/static/chunks/app/statistics/page-9b13a95549f438c0.js +1 -0
  613. package/.next/static/chunks/app/v1/chat/completions/route-e70b5e2b4e09002b.js +1 -0
  614. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/breakpoints/route-e70b5e2b4e09002b.js +1 -0
  615. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/cancel/route-e70b5e2b4e09002b.js +1 -0
  616. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/continue/route-e70b5e2b4e09002b.js +1 -0
  617. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/step/route-e70b5e2b4e09002b.js +1 -0
  618. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/edit-state/route-e70b5e2b4e09002b.js +1 -0
  619. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/events/route-e70b5e2b4e09002b.js +1 -0
  620. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/inject/route-e70b5e2b4e09002b.js +1 -0
  621. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route-e70b5e2b4e09002b.js +1 -0
  622. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/resources/route-e70b5e2b4e09002b.js +1 -0
  623. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/respond/route-e70b5e2b4e09002b.js +1 -0
  624. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/revert/route-e70b5e2b4e09002b.js +1 -0
  625. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/route-e70b5e2b4e09002b.js +1 -0
  626. package/.next/static/chunks/app/v1/chat/conversations/route-e70b5e2b4e09002b.js +1 -0
  627. package/.next/static/chunks/app/v1/chat/events/route-e70b5e2b4e09002b.js +1 -0
  628. package/.next/static/chunks/app/v1/models/route-e70b5e2b4e09002b.js +1 -0
  629. package/.next/static/chunks/app/waves/page-5b53af3eb9409414.js +1 -0
  630. package/.next/static/chunks/webpack-9fbd3587b9ef4dca.js +1 -0
  631. package/.next/static/css/400b1b927c3ffaf6.css +1 -0
  632. package/.next/static/css/82efa7d39b03a714.css +1 -0
  633. package/.next/trace +11 -10
  634. package/.next/types/app/api/flow/[id]/convert-process-to-subflow/route.ts +347 -0
  635. package/.next/types/app/api/flow/assist/route.ts +347 -0
  636. package/.next/types/app/api/mcp/flujo/authoring/route.ts +347 -0
  637. package/.next/types/app/api/mcp/flujo/automation/route.ts +347 -0
  638. package/.next/types/app/api/mcp/flujo/flows/route.ts +347 -0
  639. package/.next/types/app/api/mcp/flujo/resources/read/route.ts +347 -0
  640. package/.next/types/app/api/mcp/flujo/resources/route.ts +347 -0
  641. package/.next/types/app/api/mcp/flujo/servers/route.ts +347 -0
  642. package/.next/types/app/api/mcp/flujo/state/route.ts +347 -0
  643. package/.next/types/app/api/mcp/flujo/tools/route.ts +347 -0
  644. package/.next/types/app/api/setup/ai-cli/route.ts +347 -0
  645. package/.next/types/app/api/statistics/route.ts +347 -0
  646. package/.next/types/app/{layout.ts → automation/triggers/page.ts} +6 -6
  647. package/.next/types/app/{waves → automation/waves}/page.ts +3 -3
  648. package/.next/types/app/{executions → statistics}/page.ts +3 -3
  649. package/.next/types/app/v1/chat/conversations/[conversationId]/revert/route.ts +347 -0
  650. package/.next/types/routes.d.ts +18 -2
  651. package/.next/types/validator.ts +144 -0
  652. package/README.md +79 -52
  653. package/bin/flujo.mjs +42 -5
  654. package/mcp-servers/README.md +94 -0
  655. package/mcp-servers/bash/dist/index.d.ts +3 -0
  656. package/mcp-servers/bash/dist/index.js +85 -0
  657. package/mcp-servers/bash/dist/index.js.map +1 -0
  658. package/mcp-servers/bash/dist/resources.d.ts +13 -0
  659. package/mcp-servers/bash/dist/resources.js +298 -0
  660. package/mcp-servers/bash/dist/resources.js.map +1 -0
  661. package/mcp-servers/bash/dist/shared.d.ts +24 -0
  662. package/mcp-servers/bash/dist/shared.js +161 -0
  663. package/mcp-servers/bash/dist/shared.js.map +1 -0
  664. package/mcp-servers/bash/dist/tools.d.ts +59 -0
  665. package/mcp-servers/bash/dist/tools.js +1493 -0
  666. package/mcp-servers/bash/dist/tools.js.map +1 -0
  667. package/mcp-servers/bash/package.json +33 -0
  668. package/mcp-servers/browser/dist/index.d.ts +4 -0
  669. package/mcp-servers/browser/dist/index.js +34 -0
  670. package/mcp-servers/browser/dist/index.js.map +1 -0
  671. package/mcp-servers/browser/dist/resources.d.ts +6 -0
  672. package/mcp-servers/browser/dist/resources.js +78 -0
  673. package/mcp-servers/browser/dist/resources.js.map +1 -0
  674. package/mcp-servers/browser/dist/runtime.d.ts +26 -0
  675. package/mcp-servers/browser/dist/runtime.js +343 -0
  676. package/mcp-servers/browser/dist/runtime.js.map +1 -0
  677. package/mcp-servers/browser/dist/tools.d.ts +3 -0
  678. package/mcp-servers/browser/dist/tools.js +283 -0
  679. package/mcp-servers/browser/dist/tools.js.map +1 -0
  680. package/mcp-servers/browser/package.json +31 -0
  681. package/mcp-servers/filesystem/dist/index.d.ts +3 -0
  682. package/mcp-servers/filesystem/dist/index.js +56 -0
  683. package/mcp-servers/filesystem/dist/index.js.map +1 -0
  684. package/mcp-servers/filesystem/dist/resources.d.ts +49 -0
  685. package/{.next/server/chunks/9724.js → mcp-servers/filesystem/dist/resources.js} +592 -391
  686. package/mcp-servers/filesystem/dist/resources.js.map +1 -0
  687. package/mcp-servers/filesystem/dist/shared.d.ts +24 -0
  688. package/mcp-servers/filesystem/dist/shared.js +161 -0
  689. package/mcp-servers/filesystem/dist/shared.js.map +1 -0
  690. package/mcp-servers/filesystem/dist/tools.d.ts +3 -0
  691. package/mcp-servers/filesystem/dist/tools.js +1229 -0
  692. package/mcp-servers/filesystem/dist/tools.js.map +1 -0
  693. package/mcp-servers/filesystem/package.json +30 -0
  694. package/mcp-servers/flujo/dist/client.d.ts +12 -0
  695. package/mcp-servers/flujo/dist/client.js +144 -0
  696. package/mcp-servers/flujo/dist/client.js.map +1 -0
  697. package/mcp-servers/flujo/dist/index.d.ts +2 -0
  698. package/mcp-servers/flujo/dist/index.js +31 -0
  699. package/mcp-servers/flujo/dist/index.js.map +1 -0
  700. package/mcp-servers/flujo/package.json +29 -0
  701. package/mcp-servers/mcp-whatsapp-web/dist/auth/link-page.d.ts +11 -0
  702. package/mcp-servers/mcp-whatsapp-web/dist/auth/link-page.js +161 -0
  703. package/mcp-servers/mcp-whatsapp-web/dist/auth/link-page.js.map +1 -0
  704. package/mcp-servers/mcp-whatsapp-web/dist/auth/oauth-provider.d.ts +53 -0
  705. package/mcp-servers/mcp-whatsapp-web/dist/auth/oauth-provider.js +206 -0
  706. package/mcp-servers/mcp-whatsapp-web/dist/auth/oauth-provider.js.map +1 -0
  707. package/mcp-servers/mcp-whatsapp-web/dist/index.d.ts +2 -0
  708. package/mcp-servers/mcp-whatsapp-web/dist/index.js +128 -0
  709. package/mcp-servers/mcp-whatsapp-web/dist/index.js.map +1 -0
  710. package/mcp-servers/mcp-whatsapp-web/dist/server.d.ts +28 -0
  711. package/mcp-servers/mcp-whatsapp-web/dist/server.js +268 -0
  712. package/mcp-servers/mcp-whatsapp-web/dist/server.js.map +1 -0
  713. package/mcp-servers/mcp-whatsapp-web/dist/services/whatsapp.d.ts +149 -0
  714. package/mcp-servers/mcp-whatsapp-web/dist/services/whatsapp.js +818 -0
  715. package/mcp-servers/mcp-whatsapp-web/dist/services/whatsapp.js.map +1 -0
  716. package/mcp-servers/mcp-whatsapp-web/dist/tools/auth.d.ts +8 -0
  717. package/mcp-servers/mcp-whatsapp-web/dist/tools/auth.js +232 -0
  718. package/mcp-servers/mcp-whatsapp-web/dist/tools/auth.js.map +1 -0
  719. package/mcp-servers/mcp-whatsapp-web/dist/tools/chats.d.ts +3 -0
  720. package/mcp-servers/mcp-whatsapp-web/dist/tools/chats.js +90 -0
  721. package/mcp-servers/mcp-whatsapp-web/dist/tools/chats.js.map +1 -0
  722. package/mcp-servers/mcp-whatsapp-web/dist/tools/contacts.d.ts +3 -0
  723. package/mcp-servers/mcp-whatsapp-web/dist/tools/contacts.js +65 -0
  724. package/mcp-servers/mcp-whatsapp-web/dist/tools/contacts.js.map +1 -0
  725. package/mcp-servers/mcp-whatsapp-web/dist/tools/media.d.ts +3 -0
  726. package/mcp-servers/mcp-whatsapp-web/dist/tools/media.js +245 -0
  727. package/mcp-servers/mcp-whatsapp-web/dist/tools/media.js.map +1 -0
  728. package/mcp-servers/mcp-whatsapp-web/dist/tools/messages.d.ts +3 -0
  729. package/mcp-servers/mcp-whatsapp-web/dist/tools/messages.js +141 -0
  730. package/mcp-servers/mcp-whatsapp-web/dist/tools/messages.js.map +1 -0
  731. package/mcp-servers/mcp-whatsapp-web/dist/types/index.d.ts +1 -0
  732. package/mcp-servers/mcp-whatsapp-web/dist/types/index.js +3 -0
  733. package/mcp-servers/mcp-whatsapp-web/dist/types/index.js.map +1 -0
  734. package/mcp-servers/mcp-whatsapp-web/dist/types/whatsapp.d.ts +16 -0
  735. package/mcp-servers/mcp-whatsapp-web/dist/types/whatsapp.js +5 -0
  736. package/mcp-servers/mcp-whatsapp-web/dist/types/whatsapp.js.map +1 -0
  737. package/mcp-servers/mcp-whatsapp-web/dist/utils/audio.d.ts +23 -0
  738. package/mcp-servers/mcp-whatsapp-web/dist/utils/audio.js +99 -0
  739. package/mcp-servers/mcp-whatsapp-web/dist/utils/audio.js.map +1 -0
  740. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-finder.d.ts +12 -0
  741. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-finder.js +72 -0
  742. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-finder.js.map +1 -0
  743. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-process-manager.d.ts +84 -0
  744. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-process-manager.js +297 -0
  745. package/mcp-servers/mcp-whatsapp-web/dist/utils/browser-process-manager.js.map +1 -0
  746. package/mcp-servers/mcp-whatsapp-web/dist/utils/cleanup-browsers.d.ts +12 -0
  747. package/mcp-servers/mcp-whatsapp-web/dist/utils/cleanup-browsers.js +141 -0
  748. package/mcp-servers/mcp-whatsapp-web/dist/utils/cleanup-browsers.js.map +1 -0
  749. package/mcp-servers/mcp-whatsapp-web/dist/utils/logger.d.ts +2 -0
  750. package/mcp-servers/mcp-whatsapp-web/dist/utils/logger.js +69 -0
  751. package/mcp-servers/mcp-whatsapp-web/dist/utils/logger.js.map +1 -0
  752. package/mcp-servers/mcp-whatsapp-web/package.json +75 -0
  753. package/mcp-servers/mcp-windows-desktop-automation/dist/index.d.ts +8 -0
  754. package/mcp-servers/mcp-windows-desktop-automation/dist/index.js +95 -0
  755. package/mcp-servers/mcp-windows-desktop-automation/dist/index.js.map +1 -0
  756. package/mcp-servers/mcp-windows-desktop-automation/dist/prompts/index.d.ts +8 -0
  757. package/mcp-servers/mcp-windows-desktop-automation/dist/prompts/index.js +195 -0
  758. package/mcp-servers/mcp-windows-desktop-automation/dist/prompts/index.js.map +1 -0
  759. package/mcp-servers/mcp-windows-desktop-automation/dist/resources/index.d.ts +8 -0
  760. package/mcp-servers/mcp-windows-desktop-automation/dist/resources/index.js +214 -0
  761. package/mcp-servers/mcp-windows-desktop-automation/dist/resources/index.js.map +1 -0
  762. package/mcp-servers/mcp-windows-desktop-automation/dist/server/server.d.ts +21 -0
  763. package/mcp-servers/mcp-windows-desktop-automation/dist/server/server.js +108 -0
  764. package/mcp-servers/mcp-windows-desktop-automation/dist/server/server.js.map +1 -0
  765. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/control.d.ts +8 -0
  766. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/control.js +301 -0
  767. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/control.js.map +1 -0
  768. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/index.d.ts +8 -0
  769. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/index.js +22 -0
  770. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/index.js.map +1 -0
  771. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/keyboard.d.ts +8 -0
  772. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/keyboard.js +146 -0
  773. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/keyboard.js.map +1 -0
  774. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/mouse.d.ts +8 -0
  775. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/mouse.js +179 -0
  776. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/mouse.js.map +1 -0
  777. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/process.d.ts +8 -0
  778. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/process.js +236 -0
  779. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/process.js.map +1 -0
  780. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/window.d.ts +8 -0
  781. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/window.js +300 -0
  782. package/mcp-servers/mcp-windows-desktop-automation/dist/tools/window.js.map +1 -0
  783. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/logger/logger.d.ts +50 -0
  784. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/logger/logger.js +78 -0
  785. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/logger/logger.js.map +1 -0
  786. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/types.d.ts +51 -0
  787. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/types.js +61 -0
  788. package/mcp-servers/mcp-windows-desktop-automation/dist/utils/types.js.map +1 -0
  789. package/mcp-servers/mcp-windows-desktop-automation/package.json +38 -0
  790. package/mcp-servers/patchright-mcp/package.json +32 -0
  791. package/mcp-servers/reddit-mcp-server/package.json +88 -0
  792. package/mcp-servers/servers/package.json +31 -0
  793. package/mcp-servers/shared/dist/index.d.ts +24 -0
  794. package/mcp-servers/shared/dist/index.js +161 -0
  795. package/mcp-servers/shared/dist/index.js.map +1 -0
  796. package/mcp-servers/shared/package.json +26 -0
  797. package/package.json +119 -99
  798. package/scripts/launch-next.mjs +13 -1
  799. package/.next/server/chunks/1114.js +0 -1
  800. package/.next/server/chunks/1439.js +0 -1
  801. package/.next/server/chunks/1578.js +0 -5
  802. package/.next/server/chunks/1634.js +0 -1
  803. package/.next/server/chunks/166.js +0 -5
  804. package/.next/server/chunks/1664.js +0 -2
  805. package/.next/server/chunks/1690.js +0 -1
  806. package/.next/server/chunks/2859.js +0 -1
  807. package/.next/server/chunks/3629.js +0 -1
  808. package/.next/server/chunks/3653.js +0 -2
  809. package/.next/server/chunks/366.js +0 -2
  810. package/.next/server/chunks/3717.js +0 -1
  811. package/.next/server/chunks/3935.js +0 -4
  812. package/.next/server/chunks/3984.js +0 -9
  813. package/.next/server/chunks/4013.js +0 -1
  814. package/.next/server/chunks/4436.js +0 -1
  815. package/.next/server/chunks/4466.js +0 -1
  816. package/.next/server/chunks/4551.js +0 -6
  817. package/.next/server/chunks/4663.js +0 -1
  818. package/.next/server/chunks/4822.js +0 -1
  819. package/.next/server/chunks/5200.js +0 -1
  820. package/.next/server/chunks/5285.js +0 -1
  821. package/.next/server/chunks/5309.js +0 -78
  822. package/.next/server/chunks/544.js +0 -136
  823. package/.next/server/chunks/5463.js +0 -1
  824. package/.next/server/chunks/5544.js +0 -5
  825. package/.next/server/chunks/5880.js +0 -1
  826. package/.next/server/chunks/6747.js +0 -435
  827. package/.next/server/chunks/6793.js +0 -1
  828. package/.next/server/chunks/7069.js +0 -6
  829. package/.next/server/chunks/7104.js +0 -1
  830. package/.next/server/chunks/7634.js +0 -4
  831. package/.next/server/chunks/793.js +0 -403
  832. package/.next/server/chunks/7965.js +0 -39
  833. package/.next/server/chunks/7993.js +0 -2
  834. package/.next/server/chunks/8356.js +0 -1
  835. package/.next/server/chunks/8387.js +0 -1
  836. package/.next/server/chunks/87.js +0 -1
  837. package/.next/server/chunks/9085.js +0 -2
  838. package/.next/server/chunks/9174.js +0 -1
  839. package/.next/server/chunks/9235.js +0 -29
  840. package/.next/server/chunks/94.js +0 -1
  841. package/.next/server/chunks/9983.js +0 -2
  842. package/.next/static/chunks/1871-14c3e63ca865d85e.js +0 -1
  843. package/.next/static/chunks/2003-f826c607d609d1fa.js +0 -1
  844. package/.next/static/chunks/2005.4eea65c00d9a29cd.js +0 -1
  845. package/.next/static/chunks/2318-13ef0d3048e97834.js +0 -1
  846. package/.next/static/chunks/3077-565833c67440a7fa.js +0 -1
  847. package/.next/static/chunks/3217.260785c2198d1e9d.js +0 -1
  848. package/.next/static/chunks/3272-fd8d59523f61da96.js +0 -1
  849. package/.next/static/chunks/3429-34fb1a84aed96703.js +0 -1
  850. package/.next/static/chunks/3545.353a62a68d3b7fd1.js +0 -1
  851. package/.next/static/chunks/3659-0ab9580d5ee5deea.js +0 -1
  852. package/.next/static/chunks/3772-20197853c04a6993.js +0 -1
  853. package/.next/static/chunks/422-61b173ba64cf0c94.js +0 -1
  854. package/.next/static/chunks/4523-a540747aa2ed34e8.js +0 -1
  855. package/.next/static/chunks/454.5fc2f8eef98483e3.js +0 -1
  856. package/.next/static/chunks/488-7ab54d8ae2b4b550.js +0 -1
  857. package/.next/static/chunks/4919-6c8a48e3cc642349.js +0 -1
  858. package/.next/static/chunks/4929-150b03595474c9d8.js +0 -1
  859. package/.next/static/chunks/5733-1419095a28c1ddc3.js +0 -1
  860. package/.next/static/chunks/639-90ed75d402dc872b.js +0 -1
  861. package/.next/static/chunks/6404-86615a5f5ce5c00f.js +0 -1
  862. package/.next/static/chunks/6430-8c6dac4a758119f2.js +0 -1
  863. package/.next/static/chunks/6539-118a0084e0bfae34.js +0 -1
  864. package/.next/static/chunks/7264-91d1fa99abcd91ad.js +0 -1
  865. package/.next/static/chunks/7328-c8a51bb8c7470d77.js +0 -1
  866. package/.next/static/chunks/7391-5a0abd837ba241f5.js +0 -1
  867. package/.next/static/chunks/7445-d8a8be6e451c522e.js +0 -1
  868. package/.next/static/chunks/7561-2b366ddcbc3cc0ec.js +0 -1
  869. package/.next/static/chunks/8124-4a80e3201b8e51b0.js +0 -1
  870. package/.next/static/chunks/8345.bc5534ec13abc9ee.js +0 -1
  871. package/.next/static/chunks/8404-5aa8ea49197b98b8.js +0 -1
  872. package/.next/static/chunks/8405.a425f94b6b13d2be.js +0 -1
  873. package/.next/static/chunks/8470-72cf748472d4d501.js +0 -1
  874. package/.next/static/chunks/8551-a28272acfda62ac9.js +0 -1
  875. package/.next/static/chunks/8650-f879564a0ed89bc3.js +0 -1
  876. package/.next/static/chunks/8989-5fa9c7c670eb9a1a.js +0 -1
  877. package/.next/static/chunks/9164-de1d167d87614a6d.js +0 -1
  878. package/.next/static/chunks/9195.294887f083b1a11b.js +0 -1
  879. package/.next/static/chunks/9203-786f457ecf60b49c.js +0 -1
  880. package/.next/static/chunks/9244-3281f7fd02003a2c.js +0 -1
  881. package/.next/static/chunks/9345-11d6e48d892b1862.js +0 -8
  882. package/.next/static/chunks/9562-f8371be653010627.js +0 -1
  883. package/.next/static/chunks/9581-6d2523fd68a5e3c4.js +0 -1
  884. package/.next/static/chunks/9611-9867e6e8e65172ec.js +0 -1
  885. package/.next/static/chunks/9951-566fc6b05c12209e.js +0 -1
  886. package/.next/static/chunks/app/api/approvals/[id]/route-b9c783850b4c2acf.js +0 -1
  887. package/.next/static/chunks/app/api/approvals/route-b9c783850b4c2acf.js +0 -1
  888. package/.next/static/chunks/app/api/backup/route-b9c783850b4c2acf.js +0 -1
  889. package/.next/static/chunks/app/api/browse/route-b9c783850b4c2acf.js +0 -1
  890. package/.next/static/chunks/app/api/bugs/enhance/route-b9c783850b4c2acf.js +0 -1
  891. package/.next/static/chunks/app/api/cwd/route-b9c783850b4c2acf.js +0 -1
  892. package/.next/static/chunks/app/api/encryption/secure/route-b9c783850b4c2acf.js +0 -1
  893. package/.next/static/chunks/app/api/env/route-b9c783850b4c2acf.js +0 -1
  894. package/.next/static/chunks/app/api/flow/[id]/route-b9c783850b4c2acf.js +0 -1
  895. package/.next/static/chunks/app/api/flow/[id]/versions/[versionId]/route-b9c783850b4c2acf.js +0 -1
  896. package/.next/static/chunks/app/api/flow/[id]/versions/route-b9c783850b4c2acf.js +0 -1
  897. package/.next/static/chunks/app/api/flow/compile/route-b9c783850b4c2acf.js +0 -1
  898. package/.next/static/chunks/app/api/flow/generate/route-b9c783850b4c2acf.js +0 -1
  899. package/.next/static/chunks/app/api/flow/generator/route-b9c783850b4c2acf.js +0 -1
  900. package/.next/static/chunks/app/api/flow/improve/route-b9c783850b4c2acf.js +0 -1
  901. package/.next/static/chunks/app/api/flow/prompt-renderer/route-b9c783850b4c2acf.js +0 -1
  902. package/.next/static/chunks/app/api/flow/quick-chat/route-b9c783850b4c2acf.js +0 -1
  903. package/.next/static/chunks/app/api/flow/repair/route-b9c783850b4c2acf.js +0 -1
  904. package/.next/static/chunks/app/api/flow/route-b9c783850b4c2acf.js +0 -1
  905. package/.next/static/chunks/app/api/git/route-b9c783850b4c2acf.js +0 -1
  906. package/.next/static/chunks/app/api/init/route-b9c783850b4c2acf.js +0 -1
  907. package/.next/static/chunks/app/api/local-models/capability/route-b9c783850b4c2acf.js +0 -1
  908. package/.next/static/chunks/app/api/local-models/pull/route-b9c783850b4c2acf.js +0 -1
  909. package/.next/static/chunks/app/api/local-models/suggest/route-b9c783850b4c2acf.js +0 -1
  910. package/.next/static/chunks/app/api/mcp/app-sandbox/route-b9c783850b4c2acf.js +0 -1
  911. package/.next/static/chunks/app/api/mcp/cancel/route-b9c783850b4c2acf.js +0 -1
  912. package/.next/static/chunks/app/api/mcp/oauth-capability/route-b9c783850b4c2acf.js +0 -1
  913. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/get/route-b9c783850b4c2acf.js +0 -1
  914. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/route-b9c783850b4c2acf.js +0 -1
  915. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/read/route-b9c783850b4c2acf.js +0 -1
  916. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/route-b9c783850b4c2acf.js +0 -1
  917. package/.next/static/chunks/app/api/mcp/servers/[name]/route-b9c783850b4c2acf.js +0 -1
  918. package/.next/static/chunks/app/api/mcp/servers/[name]/status/route-b9c783850b4c2acf.js +0 -1
  919. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/[toolName]/route-b9c783850b4c2acf.js +0 -1
  920. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/route-b9c783850b4c2acf.js +0 -1
  921. package/.next/static/chunks/app/api/mcp/servers/route-b9c783850b4c2acf.js +0 -1
  922. package/.next/static/chunks/app/api/mcp/test-connection/route-b9c783850b4c2acf.js +0 -1
  923. package/.next/static/chunks/app/api/mcp/test-connection/stream/route-b9c783850b4c2acf.js +0 -1
  924. package/.next/static/chunks/app/api/mcp-registry/route-b9c783850b4c2acf.js +0 -1
  925. package/.next/static/chunks/app/api/mcp-registry/spotlight/route-b9c783850b4c2acf.js +0 -1
  926. package/.next/static/chunks/app/api/model/[id]/route-b9c783850b4c2acf.js +0 -1
  927. package/.next/static/chunks/app/api/model/provider/route-b9c783850b4c2acf.js +0 -1
  928. package/.next/static/chunks/app/api/model/route-b9c783850b4c2acf.js +0 -1
  929. package/.next/static/chunks/app/api/model/test/route-b9c783850b4c2acf.js +0 -1
  930. package/.next/static/chunks/app/api/oauth/callback/route-b9c783850b4c2acf.js +0 -1
  931. package/.next/static/chunks/app/api/oauth/initiate/route-b9c783850b4c2acf.js +0 -1
  932. package/.next/static/chunks/app/api/oauth/reset/route-b9c783850b4c2acf.js +0 -1
  933. package/.next/static/chunks/app/api/packages/build/route-b9c783850b4c2acf.js +0 -1
  934. package/.next/static/chunks/app/api/packages/derive-secrets/route-b9c783850b4c2acf.js +0 -1
  935. package/.next/static/chunks/app/api/packages/install/route-b9c783850b4c2acf.js +0 -1
  936. package/.next/static/chunks/app/api/packages/install/status/route-b9c783850b4c2acf.js +0 -1
  937. package/.next/static/chunks/app/api/packages/installed/route-b9c783850b4c2acf.js +0 -1
  938. package/.next/static/chunks/app/api/packages/resolve/route-b9c783850b4c2acf.js +0 -1
  939. package/.next/static/chunks/app/api/packages/scan-targets/route-b9c783850b4c2acf.js +0 -1
  940. package/.next/static/chunks/app/api/packages/search/route-b9c783850b4c2acf.js +0 -1
  941. package/.next/static/chunks/app/api/packages/uninstall/route-b9c783850b4c2acf.js +0 -1
  942. package/.next/static/chunks/app/api/planned-executions/[id]/route-b9c783850b4c2acf.js +0 -1
  943. package/.next/static/chunks/app/api/planned-executions/[id]/run/route-b9c783850b4c2acf.js +0 -1
  944. package/.next/static/chunks/app/api/planned-executions/[id]/runs/route-b9c783850b4c2acf.js +0 -1
  945. package/.next/static/chunks/app/api/planned-executions/preview-schedule/route-b9c783850b4c2acf.js +0 -1
  946. package/.next/static/chunks/app/api/planned-executions/reconcile/route-b9c783850b4c2acf.js +0 -1
  947. package/.next/static/chunks/app/api/planned-executions/route-b9c783850b4c2acf.js +0 -1
  948. package/.next/static/chunks/app/api/registry/auth/resend/route-b9c783850b4c2acf.js +0 -1
  949. package/.next/static/chunks/app/api/registry/auth/reset/route-b9c783850b4c2acf.js +0 -1
  950. package/.next/static/chunks/app/api/registry/auth/route-b9c783850b4c2acf.js +0 -1
  951. package/.next/static/chunks/app/api/registry/feedback/route-b9c783850b4c2acf.js +0 -1
  952. package/.next/static/chunks/app/api/registry/oauth/callback/route-b9c783850b4c2acf.js +0 -1
  953. package/.next/static/chunks/app/api/registry/oauth/initiate/route-b9c783850b4c2acf.js +0 -1
  954. package/.next/static/chunks/app/api/registry/packages/route-b9c783850b4c2acf.js +0 -1
  955. package/.next/static/chunks/app/api/registry/publish/route-b9c783850b4c2acf.js +0 -1
  956. package/.next/static/chunks/app/api/registry/settings/route-b9c783850b4c2acf.js +0 -1
  957. package/.next/static/chunks/app/api/restore/route-b9c783850b4c2acf.js +0 -1
  958. package/.next/static/chunks/app/api/runs/active/route-b9c783850b4c2acf.js +0 -1
  959. package/.next/static/chunks/app/api/storage/route-b9c783850b4c2acf.js +0 -1
  960. package/.next/static/chunks/app/api/telemetry/daily-active/route-b9c783850b4c2acf.js +0 -1
  961. package/.next/static/chunks/app/api/update/route-b9c783850b4c2acf.js +0 -1
  962. package/.next/static/chunks/app/api/waves/route-b9c783850b4c2acf.js +0 -1
  963. package/.next/static/chunks/app/api/webhooks/[id]/route-b9c783850b4c2acf.js +0 -1
  964. package/.next/static/chunks/app/chat/page-e37bbc561f40ce60.js +0 -1
  965. package/.next/static/chunks/app/docs/page-3b9ce48854b2147d.js +0 -1
  966. package/.next/static/chunks/app/executions/page-8296fd69c439ccee.js +0 -1
  967. package/.next/static/chunks/app/flows/page-e52c8943555e38dd.js +0 -1
  968. package/.next/static/chunks/app/layout-abed1f211e03152f.js +0 -1
  969. package/.next/static/chunks/app/mcp/page-4a3e5a643d84ee89.js +0 -1
  970. package/.next/static/chunks/app/mcp-flows/route-b9c783850b4c2acf.js +0 -1
  971. package/.next/static/chunks/app/mcp-proxy/[server]/route-b9c783850b4c2acf.js +0 -1
  972. package/.next/static/chunks/app/models/error-1718b538d6967e56.js +0 -1
  973. package/.next/static/chunks/app/models/page-595597042e227970.js +0 -1
  974. package/.next/static/chunks/app/packages/page-2f2d29c17841b3cf.js +0 -1
  975. package/.next/static/chunks/app/page-2f9da78a4891731a.js +0 -1
  976. package/.next/static/chunks/app/settings/page-f35e939032b0277d.js +0 -1
  977. package/.next/static/chunks/app/v1/chat/completions/route-b9c783850b4c2acf.js +0 -1
  978. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/breakpoints/route-b9c783850b4c2acf.js +0 -1
  979. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/cancel/route-b9c783850b4c2acf.js +0 -1
  980. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/continue/route-b9c783850b4c2acf.js +0 -1
  981. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/step/route-b9c783850b4c2acf.js +0 -1
  982. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/edit-state/route-b9c783850b4c2acf.js +0 -1
  983. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/events/route-b9c783850b4c2acf.js +0 -1
  984. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/inject/route-b9c783850b4c2acf.js +0 -1
  985. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route-b9c783850b4c2acf.js +0 -1
  986. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/resources/route-b9c783850b4c2acf.js +0 -1
  987. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/respond/route-b9c783850b4c2acf.js +0 -1
  988. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/route-b9c783850b4c2acf.js +0 -1
  989. package/.next/static/chunks/app/v1/chat/conversations/route-b9c783850b4c2acf.js +0 -1
  990. package/.next/static/chunks/app/v1/chat/events/route-b9c783850b4c2acf.js +0 -1
  991. package/.next/static/chunks/app/v1/models/route-b9c783850b4c2acf.js +0 -1
  992. package/.next/static/chunks/app/waves/page-dc99a16141dd902b.js +0 -1
  993. package/.next/static/chunks/webpack-9d09d53b271f49e2.js +0 -1
  994. package/.next/static/css/30253fcfa8035221.css +0 -1
  995. package/.next/static/css/69ab44eb350e0b6c.css +0 -1
  996. package/.next/static/kIFnN4S0HHOnvpPGsSzi9/_buildManifest.js +0 -1
  997. /package/.next/static/{kIFnN4S0HHOnvpPGsSzi9 → b1aMk0634gkkiunttd1SQ}/_ssgManifest.js +0 -0
@@ -0,0 +1,818 @@
1
+ // Import the CommonJS module
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+ const { Client, LocalAuth, MessageMedia,
5
+ // Message, Contact, Chat, ClientOptions - Not directly used, accessed via WAWebJS namespace
6
+ // GroupChat // Import if needed later
7
+ } = require('whatsapp-web.js');
8
+ import { log } from '../utils/logger.js';
9
+ import path from 'path';
10
+ import { BrowserProcessManager } from '../utils/browser-process-manager.js';
11
+ import { findBrowserExecutable } from '../utils/browser-finder.js';
12
+ export class WhatsAppService {
13
+ client;
14
+ clientFactory;
15
+ isInitialized = false;
16
+ latestQrCode = null; // Added to store QR code
17
+ latestPairingCode = null; // Set when phone number pairing is active
18
+ // True during the window between a QR scan / pairing approval and 'ready'
19
+ // (session validation + chat loading, typically 5-15s). Status checks and
20
+ // tool calls in this window should WAIT, not report "not authenticated".
21
+ isAuthenticating = false;
22
+ browserProcessManager;
23
+ reconnectAttempts = 0;
24
+ reconnectTimer = null;
25
+ healthCheckTimer = null;
26
+ suppressReconnect = false; // Set during intentional shutdown/logout
27
+ // In-flight initialize()/destroy(), so concurrent callers share one attempt
28
+ // instead of racing puppeteer (destroy-during-init is what produced the
29
+ // "Protocol error ... Target closed" storms under FLUJO's restart loop).
30
+ initPromise = null;
31
+ destroyPromise = null;
32
+ registeredBrowserPid = null;
33
+ // LocalAuth profile location. Overridable so multiple instances (or e2e
34
+ // tests) can run against isolated session directories.
35
+ sessionDataPath = process.env.WHATSAPP_SESSION_DIR
36
+ ? path.resolve(process.env.WHATSAPP_SESSION_DIR)
37
+ : path.join(process.cwd(), 'whatsapp-sessions');
38
+ // Notified when the WhatsApp session itself becomes invalid (logout or
39
+ // authentication failure) - used e.g. to revoke OAuth tokens.
40
+ sessionInvalidatedListeners = [];
41
+ constructor(deps) {
42
+ this.clientFactory = deps?.clientFactory;
43
+ this.browserProcessManager = deps?.browserProcessManager ?? new BrowserProcessManager();
44
+ this.client = this.createClient();
45
+ }
46
+ buildClientOptions() {
47
+ return {
48
+ authStrategy: new LocalAuth({
49
+ dataPath: this.sessionDataPath, // Project root by default; WHATSAPP_SESSION_DIR overrides
50
+ }),
51
+ puppeteer: {
52
+ // WHATSAPP_HEADLESS=false shows the browser window (debugging aid)
53
+ headless: process.env.WHATSAPP_HEADLESS !== 'false',
54
+ args: [
55
+ '--no-sandbox',
56
+ '--disable-setuid-sandbox',
57
+ '--disable-dev-shm-usage',
58
+ '--disable-accelerated-2d-canvas',
59
+ '--no-first-run',
60
+ '--no-zygote',
61
+ // '--single-process', // Might be needed on some systems
62
+ '--disable-gpu',
63
+ ],
64
+ // Chrome/Edge is needed for video/gif sending, as the Chromium bundled
65
+ // with puppeteer doesn't support H.264/AAC codecs.
66
+ ...(() => {
67
+ const executablePath = findBrowserExecutable();
68
+ return executablePath ? { executablePath } : {};
69
+ })(),
70
+ },
71
+ // Opt-in phone number pairing: when set, the client requests a pairing
72
+ // code instead of relying on the QR code. The code is surfaced via the
73
+ // 'code' event (logged to stderr) and regenerated automatically every
74
+ // ~3 minutes until pairing succeeds.
75
+ ...(process.env.WHATSAPP_PAIRING_PHONE_NUMBER && {
76
+ pairWithPhoneNumber: {
77
+ phoneNumber: process.env.WHATSAPP_PAIRING_PHONE_NUMBER.replace(/\D/g, ''),
78
+ showNotification: true,
79
+ },
80
+ }),
81
+ // Optionally pin the WhatsApp Web version to protect against
82
+ // breaking changes rolled out by WhatsApp (e.g. WA_WEB_VERSION=2.3000.1015010992)
83
+ ...(process.env.WA_WEB_VERSION && {
84
+ webVersionCache: {
85
+ type: 'remote',
86
+ remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${process.env.WA_WEB_VERSION}.html`,
87
+ },
88
+ }),
89
+ };
90
+ }
91
+ createClient() {
92
+ const options = this.buildClientOptions();
93
+ const client = this.clientFactory ? this.clientFactory(options) : new Client(options);
94
+ this.setupEventHandlers(client);
95
+ this.registeredBrowserPid = null; // A new client means a new browser
96
+ return client;
97
+ }
98
+ setupEventHandlers(client) {
99
+ client.on('qr', (qr) => {
100
+ log.info('QR code received.');
101
+ this.latestQrCode = qr; // Store the QR code
102
+ this.isAuthenticating = false; // A (new) QR means we are waiting for the user
103
+ });
104
+ // Fired when WHATSAPP_PAIRING_PHONE_NUMBER is configured. Written directly
105
+ // to stderr, bypassing the logger and its level configuration: the pairing
106
+ // code must always surface in the MCP client's server logs (FLUJO, Claude,
107
+ // Cline, ...) so the user can complete authentication. stderr never
108
+ // interferes with the MCP protocol, which uses stdout only.
109
+ client.on('code', (code) => {
110
+ this.latestPairingCode = code;
111
+ process.stderr.write('\n' +
112
+ '========================================================\n' +
113
+ ` WhatsApp pairing code: ${code}\n` +
114
+ ` On the phone with number ${process.env.WHATSAPP_PAIRING_PHONE_NUMBER}:\n` +
115
+ ' Settings > Linked Devices > Link a device\n' +
116
+ ' > "Link with phone number instead" - enter the code.\n' +
117
+ ' A fresh code is generated every ~3 minutes.\n' +
118
+ '========================================================\n\n');
119
+ log.info(`WhatsApp pairing code received: ${code}`);
120
+ });
121
+ client.on('authenticated', () => {
122
+ log.info('WhatsApp client authenticated.');
123
+ this.latestQrCode = null; // Clear QR code once authenticated
124
+ this.latestPairingCode = null;
125
+ this.isAuthenticating = true; // Not ready yet; chats are still loading
126
+ });
127
+ client.on('auth_failure', (msg) => {
128
+ log.error('WhatsApp authentication failure:', msg);
129
+ this.isInitialized = false;
130
+ this.latestQrCode = null;
131
+ this.isAuthenticating = false;
132
+ this.notifySessionInvalidated();
133
+ // Restart the client so a fresh QR code is emitted and
134
+ // get_qr_code works again without a server restart.
135
+ this.scheduleReconnect(`authentication failure: ${msg}`);
136
+ });
137
+ client.on('ready', () => {
138
+ log.info('WhatsApp client is ready.');
139
+ this.isInitialized = true;
140
+ this.isAuthenticating = false;
141
+ this.reconnectAttempts = 0;
142
+ this.startHealthCheck();
143
+ });
144
+ client.on('message', async (message) => {
145
+ log.debug('Received message:', JSON.stringify(message));
146
+ });
147
+ client.on('message_create', async (message) => {
148
+ // Fired on all message creations, including your own
149
+ if (message.fromMe) {
150
+ log.debug('Sent message:', JSON.stringify(message));
151
+ }
152
+ });
153
+ client.on('disconnected', (reason) => {
154
+ log.warn('WhatsApp client disconnected:', reason);
155
+ this.isInitialized = false;
156
+ this.latestQrCode = null; // Clear QR on disconnect
157
+ this.latestPairingCode = null;
158
+ this.isAuthenticating = false;
159
+ this.scheduleReconnect(`disconnected: ${reason}`);
160
+ });
161
+ client.on('loading_screen', (percent, message) => {
162
+ log.info(`WhatsApp loading: ${percent}% - ${message}`);
163
+ // A loading screen while a QR/pairing code is pending means the user
164
+ // just scanned/approved - flip to "authenticating" immediately so
165
+ // status checks during this window wait instead of saying "not authenticated".
166
+ if (this.latestQrCode || this.latestPairingCode) {
167
+ this.isAuthenticating = true;
168
+ }
169
+ });
170
+ }
171
+ /**
172
+ * Schedule a reconnect attempt with exponential backoff (5s, 10s, 20s, ...
173
+ * capped at 5 minutes). No-op if a reconnect is already pending or the
174
+ * disconnect was intentional (shutdown/logout).
175
+ */
176
+ scheduleReconnect(reason) {
177
+ if (this.suppressReconnect || this.reconnectTimer) {
178
+ return;
179
+ }
180
+ const delayMs = Math.min(5000 * 2 ** this.reconnectAttempts, 5 * 60 * 1000);
181
+ this.reconnectAttempts++;
182
+ log.warn(`WhatsApp connection lost (${reason}). Reconnect attempt ${this.reconnectAttempts} scheduled in ${Math.round(delayMs / 1000)}s.`);
183
+ this.reconnectTimer = setTimeout(() => {
184
+ this.reconnectTimer = null;
185
+ void this.reconnect();
186
+ }, delayMs);
187
+ // Don't let a pending reconnect keep the process alive during shutdown
188
+ this.reconnectTimer.unref?.();
189
+ }
190
+ async reconnect() {
191
+ if (this.suppressReconnect) {
192
+ return;
193
+ }
194
+ log.info('Attempting to reconnect WhatsApp client...');
195
+ this.stopHealthCheck();
196
+ try {
197
+ await this.client.destroy();
198
+ }
199
+ catch (error) {
200
+ log.warn('Error destroying client during reconnect (continuing):', error);
201
+ }
202
+ this.isInitialized = false;
203
+ try {
204
+ // Recreate the client: re-initializing a destroyed client instance is unreliable
205
+ this.client = this.createClient();
206
+ await this.initialize();
207
+ log.info('WhatsApp client reconnected successfully.');
208
+ }
209
+ catch (error) {
210
+ log.error('Reconnect attempt failed:', error);
211
+ this.scheduleReconnect('previous reconnect attempt failed');
212
+ }
213
+ }
214
+ /**
215
+ * Periodically verify the client is still connected. Some failure modes
216
+ * (e.g. the phone going offline for a long time, browser tab dying) do not
217
+ * reliably emit a 'disconnected' event.
218
+ */
219
+ startHealthCheck() {
220
+ this.stopHealthCheck();
221
+ const intervalMs = Number(process.env.HEALTH_CHECK_INTERVAL_MS || 60_000);
222
+ if (intervalMs <= 0) {
223
+ log.info('Health check disabled (HEALTH_CHECK_INTERVAL_MS <= 0).');
224
+ return;
225
+ }
226
+ this.healthCheckTimer = setInterval(async () => {
227
+ try {
228
+ const state = await this.client.getState();
229
+ if (state !== 'CONNECTED') {
230
+ log.warn(`Health check: client state is '${state ?? 'unknown'}', triggering reconnect.`);
231
+ this.isInitialized = false;
232
+ this.stopHealthCheck();
233
+ this.scheduleReconnect(`health check state: ${state}`);
234
+ }
235
+ }
236
+ catch (error) {
237
+ log.warn('Health check: failed to get client state, triggering reconnect.', error);
238
+ this.isInitialized = false;
239
+ this.stopHealthCheck();
240
+ this.scheduleReconnect('health check error');
241
+ }
242
+ }, intervalMs);
243
+ // Don't keep the process alive just for health checks
244
+ this.healthCheckTimer.unref?.();
245
+ }
246
+ stopHealthCheck() {
247
+ if (this.healthCheckTimer) {
248
+ clearInterval(this.healthCheckTimer);
249
+ this.healthCheckTimer = null;
250
+ }
251
+ }
252
+ cancelPendingReconnect() {
253
+ if (this.reconnectTimer) {
254
+ clearTimeout(this.reconnectTimer);
255
+ this.reconnectTimer = null;
256
+ }
257
+ }
258
+ async initialize() {
259
+ if (this.isInitialized) {
260
+ log.warn('WhatsApp client already initialized.');
261
+ return;
262
+ }
263
+ // Share one in-flight attempt between concurrent callers
264
+ if (this.initPromise) {
265
+ return this.initPromise;
266
+ }
267
+ const attempt = (async () => {
268
+ try {
269
+ await this.doInitialize();
270
+ }
271
+ finally {
272
+ this.initPromise = null;
273
+ }
274
+ })();
275
+ this.initPromise = attempt;
276
+ return attempt;
277
+ }
278
+ async doInitialize() {
279
+ // Re-enable auto-reconnect (it is suppressed during logout/shutdown)
280
+ this.suppressReconnect = false;
281
+ // Clean up any orphaned browser processes before starting: both the ones
282
+ // we know from the PID file and any unregistered leftover that still holds
283
+ // the profile lock (e.g. the server was force-killed mid-initialize).
284
+ await this.browserProcessManager.cleanupOrphanedProcesses();
285
+ await this.browserProcessManager.killBrowsersUsingProfile(this.sessionDataPath);
286
+ log.info('Initializing WhatsApp client...');
287
+ const client = this.client;
288
+ try {
289
+ const initInFlight = client.initialize();
290
+ // Register the browser PID as soon as puppeteer has launched, NOT after
291
+ // the full 15-20s initialization: if the process is killed mid-init, the
292
+ // PID file is the only way the next instance can find the leftover browser.
293
+ void this.registerBrowserPidEarly(client, initInFlight);
294
+ await initInFlight;
295
+ const pid = this.tryGetBrowserPid(client);
296
+ if (pid) {
297
+ this.registerBrowserPid(pid);
298
+ }
299
+ else {
300
+ log.warn('Could not determine browser PID after initialization');
301
+ }
302
+ }
303
+ catch (error) {
304
+ if (this.suppressReconnect) {
305
+ // Shutdown/destroy raced the initialization - expected, not an error
306
+ log.info('WhatsApp client initialization aborted by shutdown.');
307
+ throw error;
308
+ }
309
+ log.error('Error initializing WhatsApp client:', error);
310
+ const message = error instanceof Error ? error.message : String(error);
311
+ if (/already running/i.test(message)) {
312
+ // A leftover browser (ours or a zombie predecessor's) holds the profile
313
+ // lock. Kill it and retry instead of staying broken until a restart.
314
+ log.warn('Browser profile is locked; killing the lock holder and scheduling a retry.');
315
+ try {
316
+ await this.browserProcessManager.killBrowsersUsingProfile(this.sessionDataPath, {
317
+ includeOwnedByCurrentProcess: true,
318
+ });
319
+ }
320
+ catch (cleanupError) {
321
+ log.warn('Failed to clear the locked browser profile:', cleanupError);
322
+ }
323
+ this.scheduleReconnect('browser profile was locked by a leftover process');
324
+ }
325
+ throw error;
326
+ }
327
+ }
328
+ /**
329
+ * Poll for the puppeteer browser PID while initialize() is still running and
330
+ * register it the moment it exists. Stops as soon as the PID is registered
331
+ * or the initialization settles (doInitialize then does a final attempt).
332
+ */
333
+ async registerBrowserPidEarly(client, initInFlight) {
334
+ let settled = false;
335
+ initInFlight.then(() => (settled = true), () => (settled = true));
336
+ const POLL_INTERVAL_MS = 250;
337
+ const MAX_POLLS = 240; // Give up after 60s; init has failed long before that
338
+ for (let i = 0; i < MAX_POLLS && !settled; i++) {
339
+ const pid = this.tryGetBrowserPid(client);
340
+ if (pid) {
341
+ this.registerBrowserPid(pid);
342
+ return;
343
+ }
344
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
345
+ }
346
+ }
347
+ registerBrowserPid(pid) {
348
+ if (this.registeredBrowserPid === pid) {
349
+ return; // Already registered (early poller and post-init both call this)
350
+ }
351
+ this.registeredBrowserPid = pid;
352
+ this.browserProcessManager.registerProcess(pid);
353
+ log.info(`Registered browser process with PID: ${pid}`);
354
+ }
355
+ async destroy() {
356
+ // Share one in-flight teardown between concurrent callers (shutdown signal
357
+ // + stdin close + reconnect can all arrive within milliseconds)
358
+ if (this.destroyPromise) {
359
+ return this.destroyPromise;
360
+ }
361
+ const attempt = (async () => {
362
+ try {
363
+ await this.doDestroy();
364
+ }
365
+ finally {
366
+ this.destroyPromise = null;
367
+ }
368
+ })();
369
+ this.destroyPromise = attempt;
370
+ return attempt;
371
+ }
372
+ /**
373
+ * Best-effort teardown that NEVER hangs and never throws: a stdio server
374
+ * that cannot finish its shutdown becomes a zombie whose browser keeps the
375
+ * session directory locked for every future instance.
376
+ */
377
+ async doDestroy() {
378
+ log.info('Destroying WhatsApp client...');
379
+ this.suppressReconnect = true;
380
+ this.cancelPendingReconnect();
381
+ this.stopHealthCheck();
382
+ const client = this.client;
383
+ // Give an in-flight initialize() a moment to settle: destroying the
384
+ // browser mid script-injection is what produced the TargetCloseError
385
+ // storms. Keep it short - MCP clients on the stock SDK TerminateProcess
386
+ // us ~2s after closing stdin, so every ms spent waiting here comes out
387
+ // of the budget for the actual teardown below.
388
+ if (this.initPromise) {
389
+ await Promise.race([
390
+ this.initPromise.catch(() => { }),
391
+ new Promise((resolve) => setTimeout(resolve, 1_000)),
392
+ ]);
393
+ }
394
+ const pid = this.tryGetBrowserPid(client) ?? this.registeredBrowserPid;
395
+ try {
396
+ if (this.isInitialized) {
397
+ await withTimeout(client.destroy(), 5_000, 'client.destroy()');
398
+ log.info('WhatsApp client destroyed successfully');
399
+ }
400
+ else {
401
+ // The client never became ready: client.destroy()'s page-evaluate
402
+ // cleanup is the slow (and hang-prone) part and there is no session
403
+ // state to flush beyond the browser profile itself. Closing the
404
+ // browser directly is what actually flushes the profile to disk.
405
+ const browser = client.pupBrowser;
406
+ if (browser) {
407
+ await withTimeout(browser.close(), 1_500, 'browser.close()');
408
+ log.info('Browser closed directly (client was not ready).');
409
+ }
410
+ else {
411
+ log.info('No browser launched yet; nothing to close.');
412
+ }
413
+ }
414
+ }
415
+ catch (error) {
416
+ log.warn('client.destroy() failed or timed out; force-killing the browser.', error);
417
+ try {
418
+ if (pid) {
419
+ await this.browserProcessManager.killProcessTree(pid);
420
+ }
421
+ else {
422
+ // Browser never got registered (killed mid-launch): find it by its profile path
423
+ await this.browserProcessManager.killBrowsersUsingProfile(this.sessionDataPath, {
424
+ includeOwnedByCurrentProcess: true,
425
+ });
426
+ }
427
+ }
428
+ catch (killError) {
429
+ log.warn('Force-kill of the browser failed:', killError);
430
+ }
431
+ }
432
+ this.isInitialized = false;
433
+ this.latestQrCode = null;
434
+ if (pid) {
435
+ this.browserProcessManager.unregisterProcess(pid);
436
+ log.info(`Unregistered browser process with PID: ${pid}`);
437
+ }
438
+ this.registeredBrowserPid = null;
439
+ }
440
+ async logout() {
441
+ log.info('Logging out of WhatsApp...');
442
+ this.suppressReconnect = true; // The logout will emit 'disconnected'; don't auto-reconnect
443
+ this.cancelPendingReconnect();
444
+ this.stopHealthCheck();
445
+ try {
446
+ // Get the PID before logging out
447
+ const pid = this.tryGetBrowserPid();
448
+ // Logout from WhatsApp
449
+ await this.client.logout();
450
+ this.isInitialized = false;
451
+ this.latestQrCode = null;
452
+ log.info('Successfully logged out of WhatsApp');
453
+ this.notifySessionInvalidated();
454
+ // Unregister the browser process
455
+ if (pid) {
456
+ this.browserProcessManager.unregisterProcess(pid);
457
+ log.info(`Unregistered browser process with PID: ${pid}`);
458
+ }
459
+ // Tear down and recreate the client so the next initialize() starts
460
+ // from a clean state and emits a fresh QR code.
461
+ try {
462
+ await this.client.destroy();
463
+ }
464
+ catch (destroyError) {
465
+ log.warn('Error destroying client after logout (continuing):', destroyError);
466
+ }
467
+ this.client = this.createClient();
468
+ }
469
+ catch (error) {
470
+ log.error('Error logging out of WhatsApp:', error);
471
+ throw error;
472
+ }
473
+ }
474
+ getClient() {
475
+ if (!this.isInitialized) {
476
+ // It might be better to wait for initialization or throw a more specific error
477
+ log.warn('Accessing WhatsApp client before it is fully initialized.');
478
+ }
479
+ return this.client;
480
+ }
481
+ getLatestQrCode() {
482
+ return this.latestQrCode;
483
+ }
484
+ /** Latest pairing code emitted while phone number pairing is active, if any. */
485
+ getLatestPairingCode() {
486
+ return this.latestPairingCode;
487
+ }
488
+ /**
489
+ * Wait for the client to become ready instead of failing immediately.
490
+ *
491
+ * MCP clients (e.g. FLUJO workflows) often call tools within seconds of
492
+ * spawning this server, while WhatsApp Web needs ~15-20s to restore a
493
+ * session. Failing fast produced spurious "client not ready" errors; instead
494
+ * we block the tool call until ready, or fail fast once it is clear that
495
+ * user interaction is required (a QR code / pairing code is pending).
496
+ */
497
+ async ensureReady(timeoutMs = Number(process.env.TOOL_READY_TIMEOUT_MS || 45_000)) {
498
+ if (this.isInitialized)
499
+ return;
500
+ const start = Date.now();
501
+ log.info(`Tool call received while client is not ready; waiting up to ${Math.round(timeoutMs / 1000)}s...`);
502
+ const QR_GRACE_MS = 3_000; // Tolerate the just-scanned race before 'loading_screen' fires
503
+ const deadline = start + timeoutMs;
504
+ while (Date.now() < deadline) {
505
+ if (this.isInitialized) {
506
+ log.info(`Client became ready after ${((Date.now() - start) / 1000).toFixed(1)}s; continuing tool call.`);
507
+ return;
508
+ }
509
+ const codePending = !!(this.latestQrCode || this.latestPairingCode);
510
+ if (codePending && !this.isAuthenticating && Date.now() - start >= QR_GRACE_MS) {
511
+ throw new Error('WhatsApp is not authenticated: a QR code / pairing code is waiting to be used. ' +
512
+ 'Authenticate via get_qr_code or request_pairing_code first.');
513
+ }
514
+ await new Promise((resolve) => setTimeout(resolve, 250));
515
+ }
516
+ throw new Error(`WhatsApp client did not become ready within ${Math.round(timeoutMs / 1000)}s. ` +
517
+ 'It may still be starting up, or another server instance may hold the session - try again shortly.');
518
+ }
519
+ /**
520
+ * Wait until the initial connection attempt has a definitive outcome:
521
+ * ready, or waiting for user authentication (QR/pairing code emitted).
522
+ * Used by check_auth_status so a freshly started server reports the truth
523
+ * instead of a premature "not authenticated".
524
+ */
525
+ async waitForAuthOutcome(timeoutMs = 25_000) {
526
+ const start = Date.now();
527
+ const QR_GRACE_MS = 3_000; // Tolerate the just-scanned race before 'loading_screen' fires
528
+ while (Date.now() - start < timeoutMs) {
529
+ if (this.isInitialized)
530
+ return;
531
+ const codePending = !!(this.latestQrCode || this.latestPairingCode);
532
+ // A pending code is a definitive outcome ("waiting for the user to
533
+ // scan") - but NOT while a scan is being processed (isAuthenticating),
534
+ // and only after a short grace period, so a status check made right
535
+ // after scanning waits for 'ready' instead of reporting a stale state.
536
+ if (codePending && !this.isAuthenticating && Date.now() - start >= QR_GRACE_MS)
537
+ return;
538
+ await new Promise((resolve) => setTimeout(resolve, 250));
539
+ }
540
+ }
541
+ /** Register a listener fired when the WhatsApp session is unlinked or fails to authenticate. */
542
+ onSessionInvalidated(listener) {
543
+ this.sessionInvalidatedListeners.push(listener);
544
+ }
545
+ notifySessionInvalidated() {
546
+ for (const listener of this.sessionInvalidatedListeners) {
547
+ try {
548
+ listener();
549
+ }
550
+ catch (error) {
551
+ log.warn('Session-invalidated listener failed:', error);
552
+ }
553
+ }
554
+ }
555
+ /**
556
+ * Request a pairing code as an alternative to scanning the QR code.
557
+ * The user enters the returned 8-character code on their phone under
558
+ * Settings > Linked Devices > Link a device > "Link with phone number instead".
559
+ *
560
+ * Only valid while the client is unauthenticated and waiting at the QR stage.
561
+ *
562
+ * @param phoneNumber Phone number in international, symbol-free format
563
+ * (e.g. 4915112345678 for Germany, 12025550108 for US).
564
+ */
565
+ async requestPairingCode(phoneNumber) {
566
+ if (this.isAuthenticated()) {
567
+ throw new Error('Client is already authenticated; no pairing code needed.');
568
+ }
569
+ const sanitized = phoneNumber.replace(/\D/g, '');
570
+ if (sanitized.length < 6) {
571
+ throw new Error(`Invalid phone number '${phoneNumber}'. Provide it in international, symbol-free format (e.g. 4915112345678).`);
572
+ }
573
+ if (!this.latestQrCode) {
574
+ throw new Error('The client is not at the pairing stage yet (no QR code has been emitted). Try again in a few seconds.');
575
+ }
576
+ log.info(`Requesting pairing code for phone number ${sanitized}...`);
577
+ return this.client.requestPairingCode(sanitized, true);
578
+ }
579
+ isAuthenticated() {
580
+ // Check if the client is authenticated and connected
581
+ // isInitialized means the client is ready and authenticated
582
+ return this.isInitialized;
583
+ }
584
+ // --- Wrapper Methods for WhatsApp Functionality ---
585
+ // Note: WWebContact and WWebChat aliases are removed from imports, use Contact and Chat directly
586
+ async searchContacts(query) {
587
+ await this.ensureReady();
588
+ const contacts = await this.client.getContacts();
589
+ const lowerQuery = query.toLowerCase();
590
+ return contacts
591
+ .filter((contact) => (contact.name?.toLowerCase().includes(lowerQuery) ||
592
+ contact.number?.includes(query) || // number can be null for some contacts
593
+ contact.pushname?.toLowerCase().includes(lowerQuery)) &&
594
+ contact.isUser // Filter out groups/broadcasts if needed
595
+ )
596
+ .map(this.mapContactToSimpleContact);
597
+ }
598
+ async listChats(limit = 20, includeLastMessage = true) {
599
+ await this.ensureReady();
600
+ const chats = await this.client.getChats();
601
+ // Sort by timestamp descending (most recent first)
602
+ chats.sort((a, b) => b.timestamp - a.timestamp);
603
+ const limitedChats = chats.slice(0, limit);
604
+ const simpleChats = [];
605
+ for (const chat of limitedChats) {
606
+ let lastMsg = undefined;
607
+ if (includeLastMessage && chat.lastMessage) {
608
+ // Fetch the full last message object if needed, or use the partial info
609
+ // For simplicity, we might just use the available info or fetch it
610
+ // const fullLastMessage = await this.client.getMessageById(chat.lastMessage.id._serialized);
611
+ // if (fullLastMessage) {
612
+ // lastMsg = this.mapMessageToSimpleMessage(fullLastMessage);
613
+ // }
614
+ // Or map the partial info directly if sufficient
615
+ lastMsg = {
616
+ id: chat.lastMessage.id._serialized,
617
+ body: chat.lastMessage.body,
618
+ from: chat.lastMessage.from,
619
+ to: chat.lastMessage.to,
620
+ timestamp: chat.lastMessage.timestamp,
621
+ fromMe: chat.lastMessage.fromMe,
622
+ hasMedia: chat.lastMessage.hasMedia,
623
+ type: chat.lastMessage.type,
624
+ };
625
+ }
626
+ simpleChats.push(this.mapChatToSimpleChat(chat, lastMsg));
627
+ }
628
+ return simpleChats;
629
+ }
630
+ async getChatById(chatId) {
631
+ await this.ensureReady();
632
+ try {
633
+ const chat = await this.client.getChatById(chatId);
634
+ return this.mapChatToSimpleChat(chat);
635
+ }
636
+ catch (error) { // Add type any
637
+ log.warn(`Chat not found: ${chatId}`, error);
638
+ return null;
639
+ }
640
+ }
641
+ async getContactById(contactId) {
642
+ await this.ensureReady();
643
+ try {
644
+ const contact = await this.client.getContactById(contactId);
645
+ return this.mapContactToSimpleContact(contact);
646
+ }
647
+ catch (error) { // Add type any
648
+ log.warn(`Contact not found: ${contactId}`, error);
649
+ return null;
650
+ }
651
+ }
652
+ async getMessages(chatId, limit = 50) {
653
+ await this.ensureReady();
654
+ try {
655
+ const chat = await this.client.getChatById(chatId);
656
+ if (!chat)
657
+ throw new Error(`Chat not found: ${chatId}`);
658
+ const messages = await chat.fetchMessages({ limit });
659
+ return messages.map(this.mapMessageToSimpleMessage.bind(this));
660
+ }
661
+ catch (error) {
662
+ log.error(`Failed to get messages for chat ${chatId}:`, error);
663
+ throw error;
664
+ }
665
+ }
666
+ async getMessageById(messageId) {
667
+ await this.ensureReady();
668
+ try {
669
+ const message = await this.client.getMessageById(messageId);
670
+ return message ? this.mapMessageToSimpleMessage(message) : null;
671
+ }
672
+ catch (error) { // Add type any
673
+ log.warn(`Failed to get message by ID ${messageId}:`, error);
674
+ return null;
675
+ }
676
+ }
677
+ async sendMessage(to, content) {
678
+ await this.ensureReady();
679
+ log.info(`Sending message to ${to}`);
680
+ return this.client.sendMessage(to, content);
681
+ }
682
+ async sendMedia(to, mediaPathOrUrl, caption) {
683
+ await this.ensureReady();
684
+ log.info(`Sending media from ${mediaPathOrUrl} to ${to}`);
685
+ let media;
686
+ if (mediaPathOrUrl.startsWith('http://') || mediaPathOrUrl.startsWith('https://')) {
687
+ media = await MessageMedia.fromUrl(mediaPathOrUrl, { unsafeMime: true }); // unsafeMime might be needed for some URLs
688
+ }
689
+ else {
690
+ media = MessageMedia.fromFilePath(mediaPathOrUrl);
691
+ }
692
+ return this.client.sendMessage(to, media, { caption });
693
+ }
694
+ async sendMediaFromBase64(to, base64Data, mimeType, filename, caption) {
695
+ await this.ensureReady();
696
+ log.info(`Sending media from base64 to ${to}`);
697
+ const media = new MessageMedia(mimeType, base64Data, filename);
698
+ return this.client.sendMessage(to, media, { caption });
699
+ }
700
+ async downloadMedia(messageId) {
701
+ await this.ensureReady();
702
+ try {
703
+ const message = await this.client.getMessageById(messageId);
704
+ if (message && message.hasMedia) {
705
+ log.info(`Downloading media for message ${messageId}`);
706
+ const media = await message.downloadMedia();
707
+ return media;
708
+ }
709
+ log.warn(`Message ${messageId} not found or has no media.`);
710
+ return null;
711
+ }
712
+ catch (error) { // Add type any
713
+ log.error(`Failed to download media for message ${messageId}:`, error);
714
+ return null;
715
+ }
716
+ }
717
+ // --- Helper Mappers ---
718
+ mapContactToSimpleContact(contact) {
719
+ return {
720
+ id: contact.id._serialized,
721
+ name: contact.name || null,
722
+ pushname: contact.pushname,
723
+ isMe: contact.isMe,
724
+ isUser: contact.isUser,
725
+ isGroup: contact.isGroup,
726
+ isWAContact: contact.isWAContact,
727
+ isMyContact: contact.isMyContact,
728
+ number: contact.number,
729
+ };
730
+ }
731
+ mapChatToSimpleChat(chat, lastMessage) {
732
+ return {
733
+ id: chat.id._serialized,
734
+ name: chat.name,
735
+ isGroup: chat.isGroup,
736
+ lastMessage: lastMessage,
737
+ unreadCount: chat.unreadCount,
738
+ timestamp: chat.timestamp,
739
+ };
740
+ }
741
+ mapMessageToSimpleMessage(message) {
742
+ return {
743
+ id: message.id._serialized,
744
+ body: message.body,
745
+ from: message.from,
746
+ to: message.to,
747
+ timestamp: message.timestamp,
748
+ fromMe: message.fromMe,
749
+ hasMedia: message.hasMedia,
750
+ mediaKey: message.mediaKey,
751
+ type: message.type,
752
+ // Add more fields as needed, e.g., ack status, quoted message info
753
+ };
754
+ }
755
+ /**
756
+ * Get the process ID of the Chrome browser used by the given (or current)
757
+ * client, or null if the browser has not launched (yet). Quiet by design:
758
+ * it is polled repeatedly while the browser is still starting.
759
+ */
760
+ tryGetBrowserPid(client = this.client) {
761
+ try {
762
+ if (!client) {
763
+ return null;
764
+ }
765
+ // Access the internal puppeteer browser
766
+ // This is a bit hacky but necessary to get the browser PID
767
+ const internal = client;
768
+ // Try different ways to access the browser
769
+ let browser = null;
770
+ // Method 1: Try to access through pupBrowser property (if available)
771
+ if (internal.pupBrowser) {
772
+ browser = internal.pupBrowser;
773
+ }
774
+ // Method 2: Try to access through _page property
775
+ else if (internal._page && internal._page.browser) {
776
+ browser = internal._page.browser();
777
+ }
778
+ // Method 3: Try to access through puppeteer property
779
+ else if (internal.puppeteer && internal.puppeteer.browser) {
780
+ browser = internal.puppeteer.browser;
781
+ }
782
+ if (browser) {
783
+ const browserProcess = browser.process();
784
+ if (browserProcess) {
785
+ return browserProcess.pid ?? null;
786
+ }
787
+ }
788
+ return null;
789
+ }
790
+ catch (error) {
791
+ log.error('Error getting browser PID:', error);
792
+ return null;
793
+ }
794
+ }
795
+ /** @deprecated Use tryGetBrowserPid(); kept for backwards compatibility. */
796
+ async getBrowserPid() {
797
+ return this.tryGetBrowserPid();
798
+ }
799
+ }
800
+ /**
801
+ * Resolve with the promise, or reject once the timeout elapses - whichever
802
+ * comes first. The underlying operation is not cancelled; callers use this to
803
+ * stop WAITING on puppeteer teardown that may never finish.
804
+ */
805
+ function withTimeout(promise, ms, label) {
806
+ return new Promise((resolve, reject) => {
807
+ const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms);
808
+ timer.unref?.();
809
+ promise.then((value) => {
810
+ clearTimeout(timer);
811
+ resolve(value);
812
+ }, (error) => {
813
+ clearTimeout(timer);
814
+ reject(error);
815
+ });
816
+ });
817
+ }
818
+ //# sourceMappingURL=whatsapp.js.map