@lobu/runtime-server 22.0.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/dist/catalogs/connectors.json +1448 -212
  2. package/dist/catalogs/skills.json +1 -1
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +15 -2
  5. package/dist/connectors/google_gmail.ts +1 -0
  6. package/dist/connectors/jira-helpers.ts +313 -0
  7. package/dist/connectors/jira.ts +29 -221
  8. package/dist/connectors/linkedin-browser-script.ts +13 -0
  9. package/dist/connectors/linkedin-draft-page.js +104 -0
  10. package/dist/connectors/linkedin-drafts.ts +73 -0
  11. package/dist/connectors/linkedin-identity.ts +32 -0
  12. package/dist/connectors/linkedin-inbox-adapter.js +1182 -0
  13. package/dist/connectors/linkedin-inbox.ts +156 -0
  14. package/dist/connectors/linkedin-like.ts +114 -0
  15. package/dist/connectors/linkedin-takeout.ts +577 -0
  16. package/dist/connectors/linkedin.ts +4017 -0
  17. package/dist/connectors/reddit.ts +92 -20
  18. package/dist/connectors/slack.ts +1 -0
  19. package/dist/connectors/takeout-utils.ts +240 -0
  20. package/dist/connectors/tiktok-inbox-page.js +9 -9
  21. package/dist/connectors/tiktok-web-page.js +21 -15
  22. package/dist/connectors/tiktok_web.ts +63 -30
  23. package/dist/connectors/whatsapp-web-adapter.js +104 -574
  24. package/dist/connectors/whatsapp-web-helpers.ts +30 -444
  25. package/dist/connectors/whatsapp-web-identity.ts +20 -6
  26. package/dist/connectors/whatsapp_web.ts +46 -646
  27. package/dist/connectors/x-dm-adapter.js +556 -0
  28. package/dist/connectors/x-identity.ts +33 -2
  29. package/dist/connectors/x.ts +266 -120
  30. package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
  31. package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
  32. package/dist/db/migrations/20261019120000_retire_identities_of_deleted_entities.sql +21 -0
  33. package/dist/db/migrations/20261020120000_entities_live_metadata_domain.sql +66 -0
  34. package/dist/db/migrations/20261020130000_agents_starters.sql +14 -0
  35. package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +71 -0
  36. package/dist/dependencies.bun.lock +78 -75
  37. package/dist/guest.bundle.js +650 -448
  38. package/dist/owletto/dist/assets/_-CC8cTmRg.js +3 -0
  39. package/dist/owletto/dist/assets/_-ksFp4zVf.js +2 -0
  40. package/dist/owletto/dist/assets/_agentId-DWUFSrVp.js +2 -0
  41. package/dist/owletto/dist/assets/_agentId-MENLoohA.js +2 -0
  42. package/dist/owletto/dist/assets/_automationId-BnHqdXOC.js +2 -0
  43. package/dist/owletto/dist/assets/_connectorKey._connectionId-CefXIqy2.js +2 -0
  44. package/dist/owletto/dist/assets/_connectorKey.index-C1QPGf9E.js +2 -0
  45. package/dist/owletto/dist/assets/_conversationId-DinuPCUp.js +2 -0
  46. package/dist/owletto/dist/assets/{_deploymentId-BQfYN1U2.js → _deploymentId-BeyzVjRm.js} +2 -2
  47. package/dist/owletto/dist/assets/_eventId-3L_qeL_l.js +2 -0
  48. package/dist/owletto/dist/assets/_name-Dgedji78.js +2 -0
  49. package/dist/owletto/dist/assets/_owner-DbrKma4e.js +3 -0
  50. package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +2 -0
  51. package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +2 -0
  52. package/dist/owletto/dist/assets/_slug-ndDr_CUg.js +2 -0
  53. package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +2 -0
  54. package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +2 -0
  55. package/dist/owletto/dist/assets/{accept-invitation-D3OgJG4i.js → accept-invitation-CRKbM2Xy.js} +2 -2
  56. package/dist/owletto/dist/assets/activity-route-view-CFLNukhD.js +2 -0
  57. package/dist/owletto/dist/assets/{agent-card-controls-DzRs4Ix9.js → agent-card-controls-Be1Okb2C.js} +2 -2
  58. package/dist/owletto/dist/assets/{agent-client-setup-list-B2SvH7xD.js → agent-client-setup-list-BA8dU_C6.js} +2 -2
  59. package/dist/owletto/dist/assets/agent-connect-pages-CAV-yXus.js +2 -0
  60. package/dist/owletto/dist/assets/agent-editor-form-Bi6WvYX-.js +2 -0
  61. package/dist/owletto/dist/assets/{agent-guardrails-route-BaV1VpDh.js → agent-guardrails-route-DMOjG1D4.js} +2 -2
  62. package/dist/owletto/dist/assets/{agent-loading-shells-CtZJM2Gc.js → agent-loading-shells-De_2d8Lr.js} +2 -2
  63. package/dist/owletto/dist/assets/{agent-permissions-matrix-Ds48KFK9.js → agent-permissions-matrix-gZWl6mAe.js} +2 -2
  64. package/dist/owletto/dist/assets/{agent-skill-context-DPk5r08w.js → agent-skill-context-JLaTamGR.js} +2 -2
  65. package/dist/owletto/dist/assets/{agent-skills-route-DYpB5H1J.js → agent-skills-route-DcK41PWj.js} +2 -2
  66. package/dist/owletto/dist/assets/agent-subpage-shell-BBJoyTuC.js +2 -0
  67. package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +6 -0
  68. package/dist/owletto/dist/assets/agents-C-ReckCa.js +2 -0
  69. package/dist/owletto/dist/assets/agents-workbench-CqaKGggb.js +2 -0
  70. package/dist/owletto/dist/assets/app._appId-Cl1fTuIt.js +2 -0
  71. package/dist/owletto/dist/assets/automation-detail-content-BMLL4lxO.js +2 -0
  72. package/dist/owletto/dist/assets/automations-C-ReckCa.js +2 -0
  73. package/dist/owletto/dist/assets/callback-DTKKsfkz.js +2 -0
  74. package/dist/owletto/dist/assets/{card-DIF8SF9b.js → card-yU0TmNRH.js} +2 -2
  75. package/dist/owletto/dist/assets/{claim-DELEa-gH.js → claim-DJfTvlT2.js} +2 -2
  76. package/dist/owletto/dist/assets/client-rows--FrZfJol.js +2 -0
  77. package/dist/owletto/dist/assets/{clients-CpG676mg.js → clients-L4K1UT8c.js} +2 -2
  78. package/dist/owletto/dist/assets/{code-editor-V27Z4o3P.js → code-editor-U54Gwjit.js} +2 -2
  79. package/dist/owletto/dist/assets/connect-4zqtnDHb.js +2 -0
  80. package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +2 -0
  81. package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +2 -0
  82. package/dist/owletto/dist/assets/connected._clientId.activity-DTpSW1Xy.js +2 -0
  83. package/dist/owletto/dist/assets/connected._clientId.index-h9X5H1x8.js +2 -0
  84. package/dist/owletto/dist/assets/{connection-DySpRE9x.js → connection-ByvKkyFm.js} +2 -2
  85. package/dist/owletto/dist/assets/{connection-feed-detail-C_D68j6d.js → connection-feed-detail-DWM9lTao.js} +2 -2
  86. package/dist/owletto/dist/assets/connections-browser-CEwYrYqt.js +2 -0
  87. package/dist/owletto/dist/assets/{connector-provenance-CNXtzYg5.js → connector-provenance-BocTm__v.js} +2 -2
  88. package/dist/owletto/dist/assets/connector-scope-lists-OYDOydtz.js +2 -0
  89. package/dist/owletto/dist/assets/connectors-CyZpcE5f.js +2 -0
  90. package/dist/owletto/dist/assets/{consent-BVzxrAO9.js → consent-DdfINrVp.js} +2 -2
  91. package/dist/owletto/dist/assets/{conversations-table-DfZGICl7.js → conversations-table-BSznfdYt.js} +2 -2
  92. package/dist/owletto/dist/assets/{core.esm-DiTpULFl.js → core.esm-Dr7tcIB-.js} +2 -2
  93. package/dist/owletto/dist/assets/create-CBGwASon.js +2 -0
  94. package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +2 -0
  95. package/dist/owletto/dist/assets/create-CwThQtd3.js +2 -0
  96. package/dist/owletto/dist/assets/create-automation-form-9T5WnoUs.js +3 -0
  97. package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +2 -0
  98. package/dist/owletto/dist/assets/{cronstrue-DPXl0qA2.js → cronstrue-BWFEyy_P.js} +2 -2
  99. package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +2 -0
  100. package/dist/owletto/dist/assets/{deployments-body-D6TAWs_6.js → deployments-body-2xKS8gRo.js} +2 -2
  101. package/dist/owletto/dist/assets/{deployments-DCQdFdwG.js → deployments-wG_8QzOF.js} +2 -2
  102. package/dist/owletto/dist/assets/{device-CntqYW65.js → device-6z-xgsoW.js} +2 -2
  103. package/dist/owletto/dist/assets/device-pin-tombstone-Cwq88RMU.js +2 -0
  104. package/dist/owletto/dist/assets/device._deviceId-BDerBfD9.js +2 -0
  105. package/dist/owletto/dist/assets/entity-avatar-Cc1CuI-0.js +2 -0
  106. package/dist/owletto/dist/assets/entity-options-DHdMC1Lx.js +2 -0
  107. package/dist/owletto/dist/assets/entity-page--OkXmlNP.js +2 -0
  108. package/dist/owletto/dist/assets/entity-type-page-89RoK_-P.js +2 -0
  109. package/dist/owletto/dist/assets/event-detail-D4YZRtrA.js +2 -0
  110. package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +2 -0
  111. package/dist/owletto/dist/assets/filter-editors-B1_QUpg_.js +2 -0
  112. package/dist/owletto/dist/assets/{full-page-spinner-KpV2FS2u.js → full-page-spinner-Cqih-8IW.js} +2 -2
  113. package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +2 -0
  114. package/dist/owletto/dist/assets/identity-B0nH4yiC.js +2 -0
  115. package/dist/owletto/dist/assets/index-4TSkcsth.js +2 -0
  116. package/dist/owletto/dist/assets/index-BSH07yVD.css +1 -0
  117. package/dist/owletto/dist/assets/index-BgkhXElB.js +2 -0
  118. package/dist/owletto/dist/assets/index-CoW4Bz3w.js +2 -0
  119. package/dist/owletto/dist/assets/index-Codw-Qqi.js +2 -0
  120. package/dist/owletto/dist/assets/{index-BNh2cidi.js → index-DAOyXG1X.js} +2 -2
  121. package/dist/owletto/dist/assets/{index-BEvyBdOU.js → index-DKPwCasf.js} +2 -2
  122. package/dist/owletto/dist/assets/index-DMyXd3bJ.js +2 -0
  123. package/dist/owletto/dist/assets/index-DYCqXaMf.js +7950 -0
  124. package/dist/owletto/dist/assets/index-DYYZLcJ0.js +2 -0
  125. package/dist/owletto/dist/assets/index-DYzWV5_z.js +2 -0
  126. package/dist/owletto/dist/assets/index-Da6CrGEu.js +2 -0
  127. package/dist/owletto/dist/assets/{index-DCdkwg9H.js → index-DfyDUpuI.js} +2 -2
  128. package/dist/owletto/dist/assets/index-DneshLbf.js +2 -0
  129. package/dist/owletto/dist/assets/index-TgRS2v_F.js +2 -0
  130. package/dist/owletto/dist/assets/{index-BJXkc60S.js → index-ZNlrDc_f.js} +2 -2
  131. package/dist/owletto/dist/assets/{json-diff-D_Ym3Uku.js → json-diff-DFvYINBT.js} +3 -3
  132. package/dist/owletto/dist/assets/{list-skeleton-Bl0OS39L.js → list-skeleton-DFsEqLU1.js} +2 -2
  133. package/dist/owletto/dist/assets/login-DO0j-AYr.js +2 -0
  134. package/dist/owletto/dist/assets/{logout-DUccApuZ.js → logout-BmNwoAf7.js} +2 -2
  135. package/dist/owletto/dist/assets/member-scope-gate-B2LrMWBU.js +2 -0
  136. package/dist/owletto/dist/assets/memory-browse-page-Cjpl8EbB.js +103 -0
  137. package/dist/owletto/dist/assets/{model-selector-CB1BDvlW.js → model-selector-TQcA93xm.js} +2 -2
  138. package/dist/owletto/dist/assets/models-D7aED5Sa.js +2 -0
  139. package/dist/owletto/dist/assets/new-BMrFy5Qa.js +2 -0
  140. package/dist/owletto/dist/assets/{new-B5UsLiy6.js → new-ByBhteWA.js} +2 -2
  141. package/dist/owletto/dist/assets/new-DWp3deoW.js +2 -0
  142. package/dist/owletto/dist/assets/{oauth-workspace-access-PGyTnW2K.js → oauth-workspace-access-D_5uESuz.js} +2 -2
  143. package/dist/owletto/dist/assets/{organization-BH8PYlVu.js → organization-DTFoYP4V.js} +2 -2
  144. package/dist/owletto/dist/assets/peek-pane-content-DF5iGC3c.js +2 -0
  145. package/dist/owletto/dist/assets/{permissions-CwN_YP3u.js → permissions-C_auqxfP.js} +2 -2
  146. package/dist/owletto/dist/assets/proposal-review-shell-DsNiavG_.js +2 -0
  147. package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +2 -0
  148. package/dist/owletto/dist/assets/{recent-DqdZE_TI.js → recent-3d99S2IE.js} +2 -2
  149. package/dist/owletto/dist/assets/record-activity-C9KfBkXb.js +2 -0
  150. package/dist/owletto/dist/assets/record-field-peek-BBZcRuGT.js +2 -0
  151. package/dist/owletto/dist/assets/record-session-BizRugWs.js +2 -0
  152. package/dist/owletto/dist/assets/{reset-password-DAvBYkiI.js → reset-password-DqfcSn8M.js} +2 -2
  153. package/dist/owletto/dist/assets/runs-panel-T1ZxTVz6.js +2 -0
  154. package/dist/owletto/dist/assets/runs-table-D_8QlCCN.js +2 -0
  155. package/dist/owletto/dist/assets/schema-value-normalization-CylKX3PK.js +97 -0
  156. package/dist/owletto/dist/assets/settings-B_ClYztB.js +2 -0
  157. package/dist/owletto/dist/assets/settings-DgX1-xo7.js +2 -0
  158. package/dist/owletto/dist/assets/skills-Drw5tcZw.js +2 -0
  159. package/dist/owletto/dist/assets/{source-record-panels-CRIPMWfN.js → source-record-panels-Cg249m1S.js} +2 -2
  160. package/dist/owletto/dist/assets/{use-mention-search-DqEykWl_.js → use-mention-search-BYbFvHbJ.js} +2 -2
  161. package/dist/owletto/dist/assets/view-param-filters-DMSqkN2J.js +2 -0
  162. package/dist/owletto/dist/index.html +2 -2
  163. package/dist/server-main.bundle.mjs +14031 -12680
  164. package/npm-shrinkwrap.json +329 -313
  165. package/package.json +6 -5
  166. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  167. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  168. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  169. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  170. package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
  171. package/vendor/connector-sdk/dist/index.d.ts +3 -0
  172. package/vendor/connector-sdk/dist/index.js +2 -0
  173. package/vendor/connector-sdk/package.json +9 -1
  174. package/vendor/core/dist/agent-policy.js +0 -3
  175. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  176. package/vendor/core/dist/agent-tooling.js +3 -1
  177. package/vendor/core/dist/capabilities.d.ts +1 -1
  178. package/vendor/core/dist/capabilities.js +0 -1
  179. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  180. package/vendor/core/dist/connector-query-errors.js +41 -1
  181. package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
  182. package/vendor/core/dist/contracts/agent-settings.js +12 -1
  183. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  184. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  185. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  186. package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
  187. package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
  188. package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
  189. package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
  190. package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
  191. package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
  192. package/vendor/core/dist/contracts/worker/protocol.d.ts +47 -133
  193. package/vendor/core/dist/contracts/worker/protocol.js +33 -62
  194. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  195. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  196. package/vendor/core/dist/index.d.ts +3 -2
  197. package/vendor/core/dist/index.js +3 -1
  198. package/vendor/core/dist/logger.js +10 -25
  199. package/vendor/core/dist/suggestions.d.ts +15 -2
  200. package/vendor/core/dist/suggestions.js +48 -3
  201. package/vendor/core/dist/types.d.ts +26 -0
  202. package/vendor/core/dist/types.js +5 -0
  203. package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
  204. package/vendor/core/dist/worker/wire.d.ts +0 -10
  205. package/vendor/core/package.json +16 -10
  206. package/vendor/postgres/cf/src/connection.js +18 -0
  207. package/vendor/postgres/cjs/src/connection.js +18 -0
  208. package/vendor/postgres/src/connection.js +18 -0
  209. package/vendor/views/dist/api.d.ts +71 -17
  210. package/vendor/views/dist/api.js +200 -35
  211. package/vendor/views/dist/bridge.d.ts +3 -0
  212. package/vendor/views/dist/bridge.js +9 -1
  213. package/vendor/views/dist/components.d.ts +170 -0
  214. package/vendor/views/dist/components.js +361 -0
  215. package/vendor/views/dist/index.d.ts +1 -1
  216. package/vendor/views/package.json +11 -1
  217. package/dist/owletto/dist/assets/_-CEPl6gU4.js +0 -3
  218. package/dist/owletto/dist/assets/_-C_zNZben.js +0 -2
  219. package/dist/owletto/dist/assets/_agentId-CBC_SadO.js +0 -2
  220. package/dist/owletto/dist/assets/_agentId-QQW91cHX.js +0 -2
  221. package/dist/owletto/dist/assets/_automationId-YTTNksw6.js +0 -2
  222. package/dist/owletto/dist/assets/_connectorKey._connectionId-fK0h7RAp.js +0 -2
  223. package/dist/owletto/dist/assets/_connectorKey.index-C7TPS598.js +0 -2
  224. package/dist/owletto/dist/assets/_conversationId-CEhxlTIo.js +0 -2
  225. package/dist/owletto/dist/assets/_eventId-Cl8GSdjg.js +0 -2
  226. package/dist/owletto/dist/assets/_name-t3oBJ6Zf.js +0 -2
  227. package/dist/owletto/dist/assets/_owner-cUtGHqSw.js +0 -3
  228. package/dist/owletto/dist/assets/_shape-bo2lMVCu.js +0 -2
  229. package/dist/owletto/dist/assets/_skillKey-Dwm4Q4wI.js +0 -2
  230. package/dist/owletto/dist/assets/_slug-CU1PuHB9.js +0 -2
  231. package/dist/owletto/dist/assets/_viewKey-Bh6E_NxA.js +0 -2
  232. package/dist/owletto/dist/assets/_viewKey-D4jKl-Zf.js +0 -2
  233. package/dist/owletto/dist/assets/activity-route-view-DQglkhXU.js +0 -2
  234. package/dist/owletto/dist/assets/agent-connect-pages-B6uKvT_X.js +0 -2
  235. package/dist/owletto/dist/assets/agent-editor-form-oUnIYHd7.js +0 -2
  236. package/dist/owletto/dist/assets/agent-subpage-shell-B3K_jPYR.js +0 -2
  237. package/dist/owletto/dist/assets/agent-thread-C8UaUTWc.js +0 -6
  238. package/dist/owletto/dist/assets/agents-F4mGI2oF.js +0 -2
  239. package/dist/owletto/dist/assets/agents-workbench-CMyk4PI7.js +0 -2
  240. package/dist/owletto/dist/assets/app._appId-DH1Qutz6.js +0 -2
  241. package/dist/owletto/dist/assets/automation-detail-content-CEDNboId.js +0 -2
  242. package/dist/owletto/dist/assets/automations-F4mGI2oF.js +0 -2
  243. package/dist/owletto/dist/assets/callback-CU-hb8JB.js +0 -2
  244. package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +0 -2
  245. package/dist/owletto/dist/assets/connect-B2YL6qIK.js +0 -2
  246. package/dist/owletto/dist/assets/connect._clientId-B6LDmDRV.js +0 -2
  247. package/dist/owletto/dist/assets/connected._clientId-D_HaKoI1.js +0 -2
  248. package/dist/owletto/dist/assets/connected._clientId.activity-DQWcUqKM.js +0 -2
  249. package/dist/owletto/dist/assets/connected._clientId.index-BC3R303A.js +0 -2
  250. package/dist/owletto/dist/assets/connections-browser-Cnv2iBbZ.js +0 -2
  251. package/dist/owletto/dist/assets/connector-scope-lists-BKDetNDc.js +0 -2
  252. package/dist/owletto/dist/assets/connectors-BJnk1z_2.js +0 -2
  253. package/dist/owletto/dist/assets/create-CUqO6Kfk.js +0 -2
  254. package/dist/owletto/dist/assets/create-JRFM8mMf.js +0 -2
  255. package/dist/owletto/dist/assets/create-automation-form-_4vUkrls.js +0 -3
  256. package/dist/owletto/dist/assets/create-iHcxV0xd.js +0 -2
  257. package/dist/owletto/dist/assets/create._connectorKey-CCYLEicg.js +0 -2
  258. package/dist/owletto/dist/assets/deployments-ihkhK1zV.js +0 -2
  259. package/dist/owletto/dist/assets/device-pin-tombstone-Bz4JHHMK.js +0 -2
  260. package/dist/owletto/dist/assets/device._deviceId-D4plO3GM.js +0 -2
  261. package/dist/owletto/dist/assets/entity-options-UJs64GdQ.js +0 -2
  262. package/dist/owletto/dist/assets/entity-page-Djz6T50J.js +0 -2
  263. package/dist/owletto/dist/assets/entity-type-page-OznRag6A.js +0 -2
  264. package/dist/owletto/dist/assets/event-detail-04qOUGIP.js +0 -2
  265. package/dist/owletto/dist/assets/events-feed-fucGZSJR.js +0 -2
  266. package/dist/owletto/dist/assets/filter-editors-DCQgGLyR.js +0 -2
  267. package/dist/owletto/dist/assets/guardrails-molekzAF.js +0 -2
  268. package/dist/owletto/dist/assets/identity-BJcaG66g.js +0 -2
  269. package/dist/owletto/dist/assets/index-B04ON9Jv.js +0 -2
  270. package/dist/owletto/dist/assets/index-BLEcy9-T.css +0 -1
  271. package/dist/owletto/dist/assets/index-BOsK-K-2.js +0 -2
  272. package/dist/owletto/dist/assets/index-BOzuAbvi.js +0 -2
  273. package/dist/owletto/dist/assets/index-Bk1x7A67.js +0 -2
  274. package/dist/owletto/dist/assets/index-CFnx5huL.js +0 -2
  275. package/dist/owletto/dist/assets/index-D3s8rhG9.js +0 -2
  276. package/dist/owletto/dist/assets/index-Dbd1jusf.js +0 -2
  277. package/dist/owletto/dist/assets/index-DqZuqC08.js +0 -2
  278. package/dist/owletto/dist/assets/index-Dr-Xg_xO.js +0 -2
  279. package/dist/owletto/dist/assets/index-KPOvMVa-.js +0 -2
  280. package/dist/owletto/dist/assets/index-_oPeVpL_.js +0 -7950
  281. package/dist/owletto/dist/assets/login-QHdxqX-4.js +0 -2
  282. package/dist/owletto/dist/assets/member-scope-gate-CFbrq1by.js +0 -2
  283. package/dist/owletto/dist/assets/memory-browse-page-IrIXuZTF.js +0 -103
  284. package/dist/owletto/dist/assets/models-DnMb3n-Z.js +0 -2
  285. package/dist/owletto/dist/assets/new-BWo8_Pms.js +0 -2
  286. package/dist/owletto/dist/assets/new-DpmDXmFI.js +0 -2
  287. package/dist/owletto/dist/assets/peek-pane-content-B2AFNTzP.js +0 -2
  288. package/dist/owletto/dist/assets/proposal-review-shell-DKKGu4Ww.js +0 -2
  289. package/dist/owletto/dist/assets/public-shell-ready-7KYnww6e.js +0 -2
  290. package/dist/owletto/dist/assets/record-activity-CvgZyCmw.js +0 -2
  291. package/dist/owletto/dist/assets/renderer-BL6VcwQH.js +0 -97
  292. package/dist/owletto/dist/assets/runs-BWtc5rmc.js +0 -2
  293. package/dist/owletto/dist/assets/runs-panel-BO3h5RkS.js +0 -2
  294. package/dist/owletto/dist/assets/runs-table-DxIiqrSk.js +0 -2
  295. package/dist/owletto/dist/assets/settings-4Ev-0iNL.js +0 -2
  296. package/dist/owletto/dist/assets/settings-Crxlwps-.js +0 -2
  297. package/dist/owletto/dist/assets/skills-D0X430X8.js +0 -2
  298. package/dist/owletto/dist/assets/status-dot-C5KDvvm9.js +0 -2
  299. package/dist/owletto/dist/assets/tabs-B4Er9hJj.js +0 -2
  300. package/dist/owletto/dist/assets/view-param-filters-Cylutoy1.js +0 -2
  301. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  302. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
  303. /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
@@ -1737,6 +1737,7 @@
1737
1737
  "eventKinds": {
1738
1738
  "thread": {
1739
1739
  "description": "A Gmail email thread",
1740
+ "updatedEvent": true,
1740
1741
  "metadataSchema": {
1741
1742
  "type": "object",
1742
1743
  "properties": {
@@ -18836,6 +18837,1230 @@
18836
18837
  "login_enabled": false
18837
18838
  }
18838
18839
  },
18840
+ {
18841
+ "id": "linkedin",
18842
+ "name": "LinkedIn",
18843
+ "version": "3.20.1",
18844
+ "description": "Read LinkedIn feeds, notifications, and recent inbox messages through paired Chrome. Subscribe to source changes, answer direct messages, and prepare message, post, or comment drafts for human submission. Also supports local LinkedIn Data Export CSV files.",
18845
+ "detail": {
18846
+ "source_path": "linkedin.ts",
18847
+ "auth_schema": {
18848
+ "methods": [
18849
+ {
18850
+ "type": "browser",
18851
+ "mode": "live"
18852
+ },
18853
+ {
18854
+ "type": "none",
18855
+ "label": "Local data export"
18856
+ },
18857
+ {
18858
+ "type": "oauth",
18859
+ "provider": "linkedin",
18860
+ "requiredScopes": [],
18861
+ "loginScopes": [
18862
+ "openid",
18863
+ "profile",
18864
+ "email"
18865
+ ],
18866
+ "loginProvisioning": {
18867
+ "autoCreateConnection": false
18868
+ },
18869
+ "authorizationUrl": "https://www.linkedin.com/oauth/v2/authorization",
18870
+ "tokenUrl": "https://www.linkedin.com/oauth/v2/accessToken",
18871
+ "userinfoUrl": "https://api.linkedin.com/v2/userinfo",
18872
+ "tokenEndpointAuthMethod": "client_secret_post",
18873
+ "clientIdKey": "LINKEDIN_CLIENT_ID",
18874
+ "clientSecretKey": "LINKEDIN_CLIENT_SECRET",
18875
+ "description": "Identity-only LinkedIn sign-in. Feeds use the browser or local exports.",
18876
+ "setupInstructions": "Enable Sign In with LinkedIn using OpenID Connect in your LinkedIn app. Register /api/auth/oauth2/callback/linkedin on your Lobu origin for sign-in, then enter the client ID and client secret."
18877
+ }
18878
+ ]
18879
+ },
18880
+ "browser": {
18881
+ "authMethods": [
18882
+ "browser"
18883
+ ],
18884
+ "origins": [
18885
+ "https://www.linkedin.com"
18886
+ ],
18887
+ "accountProbe": {
18888
+ "url": "https://www.linkedin.com/feed/foryou/",
18889
+ "expression": "(async () => {\n const raw = document.cookie.split('; ').find(cookie => cookie.startsWith('JSESSIONID='));\n if (!raw) return null;\n const csrf = decodeURIComponent(raw.slice(11)).replace(/^\"|\"$/g, '');\n const response = await fetch('/voyager/api/me', {\n credentials: 'include',\n headers: { 'csrf-token': csrf, 'x-restli-protocol-version': '2.0.0' },\n });\n if (response.status === 401 || response.status === 403) return null;\n if (!response.ok) throw new Error('LinkedIn account check failed (HTTP ' + response.status + ')');\n const self = await response.json();\n const accountId = self.miniProfile?.entityUrn;\n return typeof accountId === 'string' && accountId ? { accountId } : null;\n })()"
18890
+ }
18891
+ },
18892
+ "webhook": null,
18893
+ "feeds_schema": {
18894
+ "notifications": {
18895
+ "key": "notifications",
18896
+ "name": "Notifications",
18897
+ "description": "Read notification content and links without marking them seen. Subscriptions check once per minute while the paired browser is online; grouped notification content changes activate Automations, and catch-up beyond the scan budget reports a source gap. Exact source timestamps are unavailable.",
18898
+ "webhook": {
18899
+ "mode": "trigger",
18900
+ "events": [
18901
+ "notification.changed",
18902
+ "source.gap"
18903
+ ]
18904
+ },
18905
+ "eventKinds": {
18906
+ "notification.changed": {
18907
+ "description": "A new or meaningfully changed LinkedIn notification"
18908
+ },
18909
+ "source.gap": {
18910
+ "description": "Catch-up scanned its page budget without reaching a known notification"
18911
+ }
18912
+ },
18913
+ "operations": [
18914
+ "read"
18915
+ ]
18916
+ },
18917
+ "live_messages": {
18918
+ "key": "live_messages",
18919
+ "name": "Live Messages",
18920
+ "description": "Read recent messages from inbox conversations without marking them seen. The cursor pages conversations and their recent message pages, not a full history export; `id:<message URN>` reads one recent message back. Rows carry the conversation's thread_id and full conversation_id, whether it is a group, the sender's member id, slug and name, and the message's content_kind; a company page inbox's rows also carry the visitor's topic when LinkedIn shows one. The `inbox` setting reads a company page's inbox the signed-in member administers instead of the member's own. Subscriptions check once per minute while the browser is online and report catch-up gaps.",
18921
+ "configSchema": {
18922
+ "type": "object",
18923
+ "properties": {
18924
+ "inbox": {
18925
+ "type": "string",
18926
+ "pattern": "^(?:me|urn:li:fsd_pageMailbox:[0-9]+)$",
18927
+ "default": "me",
18928
+ "description": "Whose inbox to read: \"me\" (default) for the signed-in member, or a company page's mailbox URN (urn:li:fsd_pageMailbox:<number>, the mailboxUrn the page's admin inbox at /company/<id>/admin/inbox/ requests; it differs from the company id). The signed-in member must administer the page. Changing it restarts the feed's subscription from a fresh baseline."
18929
+ }
18930
+ }
18931
+ },
18932
+ "webhook": {
18933
+ "mode": "trigger",
18934
+ "events": [
18935
+ "message.created",
18936
+ "source.gap"
18937
+ ]
18938
+ },
18939
+ "eventKinds": {
18940
+ "message.created": {
18941
+ "description": "A new LinkedIn inbox message"
18942
+ },
18943
+ "source.gap": {
18944
+ "description": "A conversation's recent message page may hide older catch-up messages"
18945
+ }
18946
+ },
18947
+ "operations": [
18948
+ "read"
18949
+ ]
18950
+ },
18951
+ "home_feed": {
18952
+ "key": "home_feed",
18953
+ "name": "Home Feed",
18954
+ "description": "Your personalized LinkedIn home feed.",
18955
+ "configSchema": {
18956
+ "type": "object",
18957
+ "properties": {
18958
+ "max_scrolls": {
18959
+ "type": "integer",
18960
+ "minimum": 1,
18961
+ "maximum": 30,
18962
+ "default": 8,
18963
+ "description": "Maximum scroll iterations for the home feed (default: 8). Upper end of the range when min_scrolls is set."
18964
+ },
18965
+ "min_scrolls": {
18966
+ "type": "integer",
18967
+ "minimum": 1,
18968
+ "maximum": 30,
18969
+ "description": "Optional lower bound. When set below max_scrolls, each sync picks a uniform random scroll count in [min_scrolls, max_scrolls]."
18970
+ }
18971
+ }
18972
+ },
18973
+ "eventKinds": {
18974
+ "post": {
18975
+ "description": "A post from your personalized LinkedIn home feed",
18976
+ "attributions": [
18977
+ {
18978
+ "name": "author",
18979
+ "role": "authored_by",
18980
+ "autoCreate": true,
18981
+ "target": {
18982
+ "entityType": "person",
18983
+ "titlePath": "author_name",
18984
+ "identities": [
18985
+ {
18986
+ "namespace": "linkedin_slug",
18987
+ "eventPath": "metadata.author_linkedin_slug"
18988
+ }
18989
+ ]
18990
+ },
18991
+ "traits": {
18992
+ "linkedin_url": {
18993
+ "eventPath": "metadata.author_profile_url",
18994
+ "mergeStrategy": "prefer_non_empty"
18995
+ }
18996
+ }
18997
+ },
18998
+ {
18999
+ "name": "engager",
19000
+ "role": "performed_by",
19001
+ "autoCreate": true,
19002
+ "target": {
19003
+ "entityType": "person",
19004
+ "titlePath": "metadata.social_actor",
19005
+ "identities": [
19006
+ {
19007
+ "namespace": "linkedin_slug",
19008
+ "eventPath": "metadata.social_actor_slug"
19009
+ }
19010
+ ]
19011
+ },
19012
+ "traits": {
19013
+ "linkedin_url": {
19014
+ "eventPath": "metadata.social_actor_profile_url",
19015
+ "mergeStrategy": "prefer_non_empty"
19016
+ }
19017
+ }
19018
+ }
19019
+ ],
19020
+ "metadataSchema": {
19021
+ "type": "object",
19022
+ "properties": {
19023
+ "author": {
19024
+ "type": "string"
19025
+ },
19026
+ "author_linkedin_slug": {
19027
+ "type": "string"
19028
+ },
19029
+ "author_profile_url": {
19030
+ "type": "string"
19031
+ },
19032
+ "social_actor": {
19033
+ "type": "string",
19034
+ "description": "Member whose engagement surfaced this post (likes/commented/reposted banners)."
19035
+ },
19036
+ "social_action": {
19037
+ "type": "string",
19038
+ "description": "Engagement verb: like, love, celebrate, support, insightful, funny, comment, repost."
19039
+ },
19040
+ "social_actor_slug": {
19041
+ "type": "string"
19042
+ },
19043
+ "social_actor_profile_url": {
19044
+ "type": "string"
19045
+ },
19046
+ "reactions": {
19047
+ "type": "number"
19048
+ },
19049
+ "comments": {
19050
+ "type": "number"
19051
+ },
19052
+ "reposts": {
19053
+ "type": "number"
19054
+ }
19055
+ }
19056
+ }
19057
+ },
19058
+ "comment": {
19059
+ "description": "A complete comment or reply on a personalized feed post",
19060
+ "attributions": [
19061
+ {
19062
+ "name": "commenter",
19063
+ "role": "authored_by",
19064
+ "autoCreate": true,
19065
+ "target": {
19066
+ "entityType": "person",
19067
+ "titlePath": "author_name",
19068
+ "identities": [
19069
+ {
19070
+ "namespace": "linkedin_slug",
19071
+ "eventPath": "metadata.author_linkedin_slug"
19072
+ }
19073
+ ]
19074
+ },
19075
+ "traits": {
19076
+ "linkedin_url": {
19077
+ "eventPath": "metadata.author_profile_url",
19078
+ "mergeStrategy": "prefer_non_empty"
19079
+ }
19080
+ }
19081
+ },
19082
+ {
19083
+ "name": "post_author",
19084
+ "role": "about",
19085
+ "autoCreate": true,
19086
+ "target": {
19087
+ "entityType": "person",
19088
+ "titlePath": "metadata.parent_author",
19089
+ "identities": [
19090
+ {
19091
+ "namespace": "linkedin_slug",
19092
+ "eventPath": "metadata.parent_author_linkedin_slug"
19093
+ }
19094
+ ]
19095
+ },
19096
+ "traits": {
19097
+ "linkedin_url": {
19098
+ "eventPath": "metadata.parent_author_profile_url",
19099
+ "mergeStrategy": "prefer_non_empty"
19100
+ }
19101
+ }
19102
+ },
19103
+ {
19104
+ "name": "parent_comment_author",
19105
+ "role": "mentions",
19106
+ "autoCreate": true,
19107
+ "target": {
19108
+ "entityType": "person",
19109
+ "titlePath": "metadata.parent_comment_author",
19110
+ "identities": [
19111
+ {
19112
+ "namespace": "linkedin_slug",
19113
+ "eventPath": "metadata.parent_comment_author_linkedin_slug"
19114
+ }
19115
+ ]
19116
+ },
19117
+ "traits": {
19118
+ "linkedin_url": {
19119
+ "eventPath": "metadata.parent_comment_author_profile_url",
19120
+ "mergeStrategy": "prefer_non_empty"
19121
+ }
19122
+ }
19123
+ }
19124
+ ],
19125
+ "metadataSchema": {
19126
+ "type": "object",
19127
+ "properties": {
19128
+ "author": {
19129
+ "type": "string"
19130
+ },
19131
+ "author_linkedin_slug": {
19132
+ "type": "string"
19133
+ },
19134
+ "author_profile_url": {
19135
+ "type": "string"
19136
+ },
19137
+ "parent_post_origin_id": {
19138
+ "type": "string"
19139
+ },
19140
+ "parent_author": {
19141
+ "type": "string"
19142
+ },
19143
+ "parent_author_linkedin_slug": {
19144
+ "type": "string"
19145
+ },
19146
+ "parent_author_profile_url": {
19147
+ "type": "string"
19148
+ },
19149
+ "comment_urn": {
19150
+ "type": "string"
19151
+ },
19152
+ "comment_id": {
19153
+ "type": "string"
19154
+ },
19155
+ "parent_activity_id": {
19156
+ "type": "string"
19157
+ },
19158
+ "parent_activity_namespace": {
19159
+ "type": "string"
19160
+ },
19161
+ "parent_comment_origin_id": {
19162
+ "type": "string"
19163
+ },
19164
+ "parent_comment_id": {
19165
+ "type": "string"
19166
+ },
19167
+ "parent_comment_author": {
19168
+ "type": "string"
19169
+ },
19170
+ "parent_comment_author_linkedin_slug": {
19171
+ "type": "string"
19172
+ },
19173
+ "parent_comment_author_profile_url": {
19174
+ "type": "string"
19175
+ },
19176
+ "is_reply": {
19177
+ "type": "boolean"
19178
+ },
19179
+ "reactions": {
19180
+ "type": "number"
19181
+ },
19182
+ "comments": {
19183
+ "type": "number"
19184
+ },
19185
+ "reposts": {
19186
+ "type": "number"
19187
+ }
19188
+ }
19189
+ }
19190
+ }
19191
+ },
19192
+ "operations": [
19193
+ "sync"
19194
+ ]
19195
+ },
19196
+ "company_updates": {
19197
+ "key": "company_updates",
19198
+ "name": "Company Updates",
19199
+ "description": "Posts and updates from the company LinkedIn page.",
19200
+ "configSchema": {
19201
+ "type": "object",
19202
+ "required": [
19203
+ "company_url"
19204
+ ],
19205
+ "properties": {
19206
+ "company_url": {
19207
+ "type": "string",
19208
+ "description": "LinkedIn company page URL (e.g., \"https://www.linkedin.com/company/openai\")"
19209
+ },
19210
+ "max_scrolls": {
19211
+ "type": "integer",
19212
+ "minimum": 1,
19213
+ "maximum": 20,
19214
+ "default": 5,
19215
+ "description": "Maximum scroll iterations for pagination (default: 5)"
19216
+ }
19217
+ }
19218
+ },
19219
+ "eventKinds": {
19220
+ "post": {
19221
+ "description": "A company LinkedIn post",
19222
+ "attributions": [
19223
+ {
19224
+ "role": "authored_by",
19225
+ "autoCreate": true,
19226
+ "target": {
19227
+ "entityType": "person",
19228
+ "titlePath": "author_name",
19229
+ "identities": [
19230
+ {
19231
+ "namespace": "linkedin_member_id",
19232
+ "eventPath": "metadata.author_member_id"
19233
+ },
19234
+ {
19235
+ "namespace": "linkedin_slug",
19236
+ "eventPath": "metadata.author_linkedin_slug"
19237
+ }
19238
+ ]
19239
+ },
19240
+ "traits": {
19241
+ "linkedin_headline": {
19242
+ "eventPath": "metadata.author_headline",
19243
+ "mergeStrategy": "prefer_non_empty"
19244
+ },
19245
+ "last_linkedin_post_at": {
19246
+ "eventPath": "occurred_at",
19247
+ "mergeStrategy": "overwrite"
19248
+ }
19249
+ }
19250
+ }
19251
+ ],
19252
+ "metadataSchema": {
19253
+ "type": "object",
19254
+ "properties": {
19255
+ "author_headline": {
19256
+ "type": "string"
19257
+ },
19258
+ "author_member_id": {
19259
+ "type": "string"
19260
+ },
19261
+ "author_linkedin_slug": {
19262
+ "type": "string"
19263
+ },
19264
+ "likes": {
19265
+ "type": "number"
19266
+ },
19267
+ "comments": {
19268
+ "type": "number"
19269
+ },
19270
+ "shares": {
19271
+ "type": "number"
19272
+ }
19273
+ }
19274
+ }
19275
+ }
19276
+ },
19277
+ "operations": [
19278
+ "sync"
19279
+ ]
19280
+ },
19281
+ "jobs": {
19282
+ "key": "jobs",
19283
+ "name": "Job Listings",
19284
+ "description": "Open job positions (hiring velocity signal).",
19285
+ "configSchema": {
19286
+ "type": "object",
19287
+ "required": [
19288
+ "company_url"
19289
+ ],
19290
+ "properties": {
19291
+ "company_url": {
19292
+ "type": "string",
19293
+ "description": "LinkedIn company page URL (e.g., \"https://www.linkedin.com/company/openai\")"
19294
+ },
19295
+ "max_scrolls": {
19296
+ "type": "integer",
19297
+ "minimum": 1,
19298
+ "maximum": 10,
19299
+ "default": 3,
19300
+ "description": "Maximum scroll iterations for job listings (default: 3)"
19301
+ }
19302
+ }
19303
+ },
19304
+ "eventKinds": {
19305
+ "job_posting": {
19306
+ "description": "An open job listing",
19307
+ "metadataSchema": {
19308
+ "type": "object",
19309
+ "properties": {
19310
+ "location": {
19311
+ "type": "string"
19312
+ }
19313
+ }
19314
+ }
19315
+ }
19316
+ },
19317
+ "operations": [
19318
+ "sync"
19319
+ ]
19320
+ },
19321
+ "messages": {
19322
+ "key": "messages",
19323
+ "name": "Messages",
19324
+ "configSchema": {
19325
+ "type": "object",
19326
+ "properties": {
19327
+ "takeout_dir": {
19328
+ "type": "string",
19329
+ "description": "Path to the LinkedIn Data Export folder."
19330
+ },
19331
+ "batch_size": {
19332
+ "type": "integer",
19333
+ "minimum": 1,
19334
+ "maximum": 5000,
19335
+ "default": 1000,
19336
+ "description": "Maximum events to emit per sync run."
19337
+ }
19338
+ }
19339
+ },
19340
+ "eventKinds": {
19341
+ "message": {
19342
+ "description": "A LinkedIn direct message",
19343
+ "attributions": [
19344
+ {
19345
+ "role": "authored_by",
19346
+ "autoCreate": true,
19347
+ "target": {
19348
+ "entityType": "person",
19349
+ "titlePath": "metadata.from",
19350
+ "identities": [
19351
+ {
19352
+ "namespace": "linkedin_slug",
19353
+ "eventPath": "metadata.sender_linkedin_slug"
19354
+ }
19355
+ ]
19356
+ },
19357
+ "traits": {
19358
+ "linkedin_url": {
19359
+ "eventPath": "metadata.sender_profile_url",
19360
+ "mergeStrategy": "prefer_non_empty"
19361
+ },
19362
+ "last_linkedin_message_at": {
19363
+ "eventPath": "occurred_at",
19364
+ "mergeStrategy": "overwrite"
19365
+ }
19366
+ }
19367
+ }
19368
+ ]
19369
+ }
19370
+ },
19371
+ "operations": [
19372
+ "sync"
19373
+ ]
19374
+ },
19375
+ "connections": {
19376
+ "key": "connections",
19377
+ "name": "Connections",
19378
+ "configSchema": {
19379
+ "type": "object",
19380
+ "properties": {
19381
+ "takeout_dir": {
19382
+ "type": "string",
19383
+ "description": "Path to the LinkedIn Data Export folder."
19384
+ },
19385
+ "batch_size": {
19386
+ "type": "integer",
19387
+ "minimum": 1,
19388
+ "maximum": 5000,
19389
+ "default": 1000,
19390
+ "description": "Maximum events to emit per sync run."
19391
+ }
19392
+ }
19393
+ },
19394
+ "eventKinds": {
19395
+ "connection": {
19396
+ "description": "A first-degree LinkedIn connection",
19397
+ "attributions": [
19398
+ {
19399
+ "role": "about",
19400
+ "autoCreate": true,
19401
+ "target": {
19402
+ "entityType": "person",
19403
+ "titlePath": "author_name",
19404
+ "identities": [
19405
+ {
19406
+ "namespace": "linkedin_slug",
19407
+ "eventPath": "metadata.linkedin_slug"
19408
+ },
19409
+ {
19410
+ "namespace": "email",
19411
+ "eventPath": "metadata.email"
19412
+ }
19413
+ ]
19414
+ },
19415
+ "traits": {
19416
+ "linkedin_url": {
19417
+ "eventPath": "metadata.linkedin_url",
19418
+ "mergeStrategy": "prefer_non_empty"
19419
+ },
19420
+ "company": {
19421
+ "eventPath": "metadata.company",
19422
+ "mergeStrategy": "prefer_non_empty"
19423
+ },
19424
+ "position": {
19425
+ "eventPath": "metadata.position",
19426
+ "mergeStrategy": "prefer_non_empty"
19427
+ }
19428
+ }
19429
+ }
19430
+ ]
19431
+ }
19432
+ },
19433
+ "operations": [
19434
+ "sync"
19435
+ ]
19436
+ },
19437
+ "invitations": {
19438
+ "key": "invitations",
19439
+ "name": "Invitations",
19440
+ "configSchema": {
19441
+ "type": "object",
19442
+ "properties": {
19443
+ "takeout_dir": {
19444
+ "type": "string",
19445
+ "description": "Path to the LinkedIn Data Export folder."
19446
+ },
19447
+ "batch_size": {
19448
+ "type": "integer",
19449
+ "minimum": 1,
19450
+ "maximum": 5000,
19451
+ "default": 1000,
19452
+ "description": "Maximum events to emit per sync run."
19453
+ }
19454
+ }
19455
+ },
19456
+ "operations": [
19457
+ "sync"
19458
+ ]
19459
+ },
19460
+ "applied_jobs": {
19461
+ "key": "applied_jobs",
19462
+ "name": "Applied Jobs",
19463
+ "description": "Your own applied/saved job postings from the LinkedIn Data Export.",
19464
+ "configSchema": {
19465
+ "type": "object",
19466
+ "properties": {
19467
+ "takeout_dir": {
19468
+ "type": "string",
19469
+ "description": "Path to the LinkedIn Data Export folder."
19470
+ },
19471
+ "batch_size": {
19472
+ "type": "integer",
19473
+ "minimum": 1,
19474
+ "maximum": 5000,
19475
+ "default": 1000,
19476
+ "description": "Maximum events to emit per sync run."
19477
+ }
19478
+ }
19479
+ },
19480
+ "operations": [
19481
+ "sync"
19482
+ ]
19483
+ },
19484
+ "profile": {
19485
+ "key": "profile",
19486
+ "name": "Profile",
19487
+ "configSchema": {
19488
+ "type": "object",
19489
+ "properties": {
19490
+ "takeout_dir": {
19491
+ "type": "string",
19492
+ "description": "Path to the LinkedIn Data Export folder."
19493
+ },
19494
+ "batch_size": {
19495
+ "type": "integer",
19496
+ "minimum": 1,
19497
+ "maximum": 5000,
19498
+ "default": 1000,
19499
+ "description": "Maximum events to emit per sync run."
19500
+ }
19501
+ }
19502
+ },
19503
+ "operations": [
19504
+ "sync"
19505
+ ]
19506
+ },
19507
+ "companies": {
19508
+ "key": "companies",
19509
+ "name": "Company Follows",
19510
+ "configSchema": {
19511
+ "type": "object",
19512
+ "properties": {
19513
+ "takeout_dir": {
19514
+ "type": "string",
19515
+ "description": "Path to the LinkedIn Data Export folder."
19516
+ },
19517
+ "batch_size": {
19518
+ "type": "integer",
19519
+ "minimum": 1,
19520
+ "maximum": 5000,
19521
+ "default": 1000,
19522
+ "description": "Maximum events to emit per sync run."
19523
+ }
19524
+ }
19525
+ },
19526
+ "operations": [
19527
+ "sync"
19528
+ ]
19529
+ },
19530
+ "learning": {
19531
+ "key": "learning",
19532
+ "name": "Learning",
19533
+ "configSchema": {
19534
+ "type": "object",
19535
+ "properties": {
19536
+ "takeout_dir": {
19537
+ "type": "string",
19538
+ "description": "Path to the LinkedIn Data Export folder."
19539
+ },
19540
+ "batch_size": {
19541
+ "type": "integer",
19542
+ "minimum": 1,
19543
+ "maximum": 5000,
19544
+ "default": 1000,
19545
+ "description": "Maximum events to emit per sync run."
19546
+ }
19547
+ }
19548
+ },
19549
+ "operations": [
19550
+ "sync"
19551
+ ]
19552
+ },
19553
+ "events": {
19554
+ "key": "events",
19555
+ "name": "Events",
19556
+ "configSchema": {
19557
+ "type": "object",
19558
+ "properties": {
19559
+ "takeout_dir": {
19560
+ "type": "string",
19561
+ "description": "Path to the LinkedIn Data Export folder."
19562
+ },
19563
+ "batch_size": {
19564
+ "type": "integer",
19565
+ "minimum": 1,
19566
+ "maximum": 5000,
19567
+ "default": 1000,
19568
+ "description": "Maximum events to emit per sync run."
19569
+ }
19570
+ }
19571
+ },
19572
+ "operations": [
19573
+ "sync"
19574
+ ]
19575
+ },
19576
+ "endorsements": {
19577
+ "key": "endorsements",
19578
+ "name": "Endorsements and Recommendations",
19579
+ "configSchema": {
19580
+ "type": "object",
19581
+ "properties": {
19582
+ "takeout_dir": {
19583
+ "type": "string",
19584
+ "description": "Path to the LinkedIn Data Export folder."
19585
+ },
19586
+ "batch_size": {
19587
+ "type": "integer",
19588
+ "minimum": 1,
19589
+ "maximum": 5000,
19590
+ "default": 1000,
19591
+ "description": "Maximum events to emit per sync run."
19592
+ }
19593
+ }
19594
+ },
19595
+ "operations": [
19596
+ "sync"
19597
+ ]
19598
+ },
19599
+ "media": {
19600
+ "key": "media",
19601
+ "name": "Rich Media",
19602
+ "configSchema": {
19603
+ "type": "object",
19604
+ "properties": {
19605
+ "takeout_dir": {
19606
+ "type": "string",
19607
+ "description": "Path to the LinkedIn Data Export folder."
19608
+ },
19609
+ "batch_size": {
19610
+ "type": "integer",
19611
+ "minimum": 1,
19612
+ "maximum": 5000,
19613
+ "default": 1000,
19614
+ "description": "Maximum events to emit per sync run."
19615
+ }
19616
+ }
19617
+ },
19618
+ "operations": [
19619
+ "sync"
19620
+ ]
19621
+ }
19622
+ },
19623
+ "actions_schema": {
19624
+ "set_like": {
19625
+ "key": "set_like",
19626
+ "name": "Set like",
19627
+ "kind": "write",
19628
+ "description": "Set the Like reaction on one exact LinkedIn post and verify it after reload. Already-matching posts are unchanged. Preserves other reaction types. Never comments or posts; selection and budgets belong to the Automation.",
19629
+ "annotations": {
19630
+ "openWorldHint": true,
19631
+ "destructiveHint": false,
19632
+ "idempotentHint": true
19633
+ },
19634
+ "inputSchema": {
19635
+ "type": "object",
19636
+ "required": [
19637
+ "post_url",
19638
+ "liked"
19639
+ ],
19640
+ "properties": {
19641
+ "post_url": {
19642
+ "type": "string",
19643
+ "format": "uri"
19644
+ },
19645
+ "liked": {
19646
+ "type": "boolean"
19647
+ }
19648
+ },
19649
+ "additionalProperties": false
19650
+ }
19651
+ },
19652
+ "send_message": {
19653
+ "key": "send_message",
19654
+ "name": "Send direct message reply",
19655
+ "kind": "write",
19656
+ "description": "Send a text reply into an exact existing LinkedIn direct-message conversation and confirm it appears there. Pass a member-inbox row's thread_id, or a row's full conversation_id to reply from the inbox the message came from (a company page the signed-in member administers). This direct send is approved only for answering direct messages on accounts the owner operates; group conversations are refused, and posts, comments and other messages stay draft-only through prepare_message, prepare_post and prepare_comment. A retry with the same idempotency_key returns the earlier message instead of sending again.",
19657
+ "annotations": {
19658
+ "openWorldHint": true,
19659
+ "destructiveHint": false,
19660
+ "idempotentHint": true
19661
+ },
19662
+ "inputSchema": {
19663
+ "type": "object",
19664
+ "required": [
19665
+ "conversation_id",
19666
+ "text",
19667
+ "idempotency_key"
19668
+ ],
19669
+ "additionalProperties": false,
19670
+ "properties": {
19671
+ "conversation_id": {
19672
+ "type": "string",
19673
+ "pattern": "^(?:[A-Za-z0-9_-]+=*|urn:li:msg_conversation:\\((?:urn:li:fsd_profile:[A-Za-z0-9_-]+|urn:li:fsd_pageMailbox:[0-9]+),[A-Za-z0-9_-]+=*\\))$",
19674
+ "maxLength": 500,
19675
+ "description": "The row's thread_id (the member's own inbox) or its full conversation_id (the inbox it names)."
19676
+ },
19677
+ "text": {
19678
+ "type": "string",
19679
+ "minLength": 1,
19680
+ "maxLength": 3000
19681
+ },
19682
+ "idempotency_key": {
19683
+ "type": "string",
19684
+ "minLength": 1,
19685
+ "maxLength": 300,
19686
+ "description": "One reply per key: a retry returns the first send."
19687
+ }
19688
+ }
19689
+ }
19690
+ },
19691
+ "prepare_message": {
19692
+ "key": "prepare_message",
19693
+ "name": "Prepare message",
19694
+ "kind": "write",
19695
+ "description": "Prepare a text reply in an exact existing conversation. Execute with activation: { kind: 'page_visit', urls: [conversation_url] }. When the user visits that URL, fill its empty composer. The user clicks Send. Never sends or overwrites a draft.",
19696
+ "annotations": {
19697
+ "openWorldHint": true,
19698
+ "destructiveHint": false,
19699
+ "idempotentHint": false
19700
+ },
19701
+ "inputSchema": {
19702
+ "type": "object",
19703
+ "required": [
19704
+ "conversation_url",
19705
+ "body"
19706
+ ],
19707
+ "additionalProperties": false,
19708
+ "properties": {
19709
+ "conversation_url": {
19710
+ "type": "string",
19711
+ "format": "uri"
19712
+ },
19713
+ "body": {
19714
+ "type": "string",
19715
+ "minLength": 1,
19716
+ "maxLength": 3000
19717
+ }
19718
+ }
19719
+ }
19720
+ },
19721
+ "prepare_post": {
19722
+ "key": "prepare_post",
19723
+ "name": "Prepare personal post",
19724
+ "kind": "write",
19725
+ "description": "Prepare a text post for the signed-in member. Execute with activation: { kind: 'page_visit', urls: ['https://www.linkedin.com/feed/foryou/'] }. When the user visits that page, open its personal post composer and fill an empty draft. The user clicks Post. Never publishes or overwrites a draft.",
19726
+ "annotations": {
19727
+ "openWorldHint": true,
19728
+ "destructiveHint": false,
19729
+ "idempotentHint": false
19730
+ },
19731
+ "inputSchema": {
19732
+ "type": "object",
19733
+ "required": [
19734
+ "body"
19735
+ ],
19736
+ "additionalProperties": false,
19737
+ "properties": {
19738
+ "body": {
19739
+ "type": "string",
19740
+ "minLength": 1,
19741
+ "maxLength": 3000
19742
+ }
19743
+ }
19744
+ }
19745
+ },
19746
+ "prepare_comment": {
19747
+ "key": "prepare_comment",
19748
+ "name": "Prepare comment",
19749
+ "description": "Stage a comment draft after the user opens the exact LinkedIn post (fill composer, banner). The page-activation target is the post page URL with a trailing slash (https://www.linkedin.com/feed/update/urn:li:activity:<id>/), the form LinkedIn settles on. NEVER opens a tab or submits — the human must click Post.",
19750
+ "kind": "write",
19751
+ "annotations": {
19752
+ "openWorldHint": true,
19753
+ "destructiveHint": false,
19754
+ "idempotentHint": false
19755
+ },
19756
+ "inputSchema": {
19757
+ "type": "object",
19758
+ "required": [
19759
+ "body"
19760
+ ],
19761
+ "anyOf": [
19762
+ {
19763
+ "required": [
19764
+ "post_url"
19765
+ ]
19766
+ },
19767
+ {
19768
+ "required": [
19769
+ "activity_id"
19770
+ ]
19771
+ }
19772
+ ],
19773
+ "properties": {
19774
+ "post_url": {
19775
+ "type": "string",
19776
+ "description": "LinkedIn post URL, or activity id / URN (e.g. \"https://www.linkedin.com/feed/update/urn:li:activity:7312345678901234567\", \"urn:li:activity:7312345678901234567\", or \"7312345678901234567\")."
19777
+ },
19778
+ "activity_id": {
19779
+ "type": "string",
19780
+ "description": "Activity id when post_url is omitted (digits or urn:li:activity:…)."
19781
+ },
19782
+ "body": {
19783
+ "type": "string",
19784
+ "description": "Draft comment text. Left in the composer for the user to edit/send.",
19785
+ "minLength": 1,
19786
+ "maxLength": 3000
19787
+ },
19788
+ "reason": {
19789
+ "type": "string",
19790
+ "description": "Optional short explanation for the in-page banner (truncated).",
19791
+ "maxLength": 500
19792
+ },
19793
+ "banner": {
19794
+ "type": "boolean",
19795
+ "description": "Inject a small in-page Lobu handoff banner (default true)."
19796
+ }
19797
+ }
19798
+ },
19799
+ "outputSchema": {
19800
+ "type": "object",
19801
+ "properties": {
19802
+ "prepared": {
19803
+ "type": "boolean"
19804
+ },
19805
+ "status": {
19806
+ "type": "string",
19807
+ "enum": [
19808
+ "not_actionable",
19809
+ "prepared"
19810
+ ],
19811
+ "description": "prepared after the draft is staged; not_actionable when the input did not carry a durable post id (no browser action was taken)."
19812
+ },
19813
+ "reason": {
19814
+ "type": "string",
19815
+ "description": "Present with status=not_actionable: why the input was not actionable (e.g. missing_durable_post_id)."
19816
+ },
19817
+ "tab_id": {
19818
+ "type": "integer"
19819
+ },
19820
+ "post_url": {
19821
+ "type": "string"
19822
+ },
19823
+ "body": {
19824
+ "type": "string"
19825
+ },
19826
+ "method": {
19827
+ "type": "string"
19828
+ },
19829
+ "banner_shown": {
19830
+ "type": "boolean"
19831
+ },
19832
+ "reason_preview": {
19833
+ "type": "string"
19834
+ },
19835
+ "message": {
19836
+ "type": "string"
19837
+ }
19838
+ }
19839
+ }
19840
+ },
19841
+ "verify_staged_comment": {
19842
+ "key": "verify_staged_comment",
19843
+ "name": "Verify staged comment",
19844
+ "description": "Re-open a LinkedIn post in the paired Chrome browser and check whether a comment matching the draft body is visible. Read-only — never posts. Best-effort DOM scrape (not a guarantee of publication).",
19845
+ "kind": "read",
19846
+ "annotations": {
19847
+ "openWorldHint": true,
19848
+ "destructiveHint": false,
19849
+ "idempotentHint": true
19850
+ },
19851
+ "inputSchema": {
19852
+ "type": "object",
19853
+ "required": [
19854
+ "body"
19855
+ ],
19856
+ "anyOf": [
19857
+ {
19858
+ "required": [
19859
+ "post_url"
19860
+ ]
19861
+ },
19862
+ {
19863
+ "required": [
19864
+ "activity_id"
19865
+ ]
19866
+ }
19867
+ ],
19868
+ "properties": {
19869
+ "post_url": {
19870
+ "type": "string",
19871
+ "description": "LinkedIn post URL, activity id, or URN (same shapes as prepare_comment)."
19872
+ },
19873
+ "activity_id": {
19874
+ "type": "string",
19875
+ "description": "Activity id when post_url is omitted (digits or urn:li:activity:…)."
19876
+ },
19877
+ "body": {
19878
+ "type": "string",
19879
+ "description": "Expected comment text (the staged draft).",
19880
+ "minLength": 1,
19881
+ "maxLength": 3000
19882
+ },
19883
+ "author_hint": {
19884
+ "type": "string",
19885
+ "description": "Optional author display-name substring to require when matching.",
19886
+ "maxLength": 200
19887
+ },
19888
+ "focus": {
19889
+ "type": "boolean",
19890
+ "description": "Bring the post tab to the foreground (default true)."
19891
+ }
19892
+ }
19893
+ },
19894
+ "outputSchema": {
19895
+ "type": "object",
19896
+ "properties": {
19897
+ "verified": {
19898
+ "type": "boolean"
19899
+ },
19900
+ "status": {
19901
+ "type": "string",
19902
+ "enum": [
19903
+ "not_actionable",
19904
+ "verified"
19905
+ ],
19906
+ "description": "verified after a matching comment is found; not_actionable when the input did not carry a durable post id (no browser action was taken)."
19907
+ },
19908
+ "reason": {
19909
+ "type": "string",
19910
+ "description": "Present whenever verification did not succeed: why (e.g. missing_durable_post_id, no_matching_comment, no_comments_visible, scrape_exception)."
19911
+ },
19912
+ "post_url": {
19913
+ "type": "string"
19914
+ },
19915
+ "body": {
19916
+ "type": "string"
19917
+ },
19918
+ "tab_id": {
19919
+ "type": "integer"
19920
+ },
19921
+ "comments_scanned": {
19922
+ "type": "integer"
19923
+ },
19924
+ "match": {
19925
+ "type": "object",
19926
+ "properties": {
19927
+ "author": {
19928
+ "type": "string"
19929
+ },
19930
+ "text_preview": {
19931
+ "type": "string"
19932
+ },
19933
+ "match_kind": {
19934
+ "type": "string",
19935
+ "enum": [
19936
+ "exact",
19937
+ "prefix",
19938
+ "contains"
19939
+ ]
19940
+ }
19941
+ }
19942
+ },
19943
+ "message": {
19944
+ "type": "string"
19945
+ }
19946
+ }
19947
+ }
19948
+ },
19949
+ "read_my_activity": {
19950
+ "key": "read_my_activity",
19951
+ "name": "Read my activity",
19952
+ "description": "Read the signed-in member's own recent LinkedIn posts and comments from their profile activity pages in the paired Chrome browser, and return them without storing any events. Read-only.",
19953
+ "kind": "read",
19954
+ "annotations": {
19955
+ "openWorldHint": true,
19956
+ "destructiveHint": false,
19957
+ "idempotentHint": true
19958
+ },
19959
+ "inputSchema": {
19960
+ "type": "object",
19961
+ "properties": {
19962
+ "kinds": {
19963
+ "type": "array",
19964
+ "items": {
19965
+ "type": "string",
19966
+ "enum": [
19967
+ "posts",
19968
+ "comments"
19969
+ ]
19970
+ },
19971
+ "description": "Which activity lists to read. Default [\"posts\", \"comments\"]."
19972
+ },
19973
+ "max_scrolls": {
19974
+ "type": "integer",
19975
+ "minimum": 1,
19976
+ "maximum": 10,
19977
+ "description": "Scroll passes per list (default 3)."
19978
+ }
19979
+ }
19980
+ }
19981
+ },
19982
+ "read_home_feed": {
19983
+ "key": "read_home_feed",
19984
+ "name": "Read home feed",
19985
+ "description": "Read the signed-in member's current LinkedIn home feed in the paired Chrome browser, and return the visible posts and comments without storing any events. Read-only.",
19986
+ "kind": "read",
19987
+ "annotations": {
19988
+ "openWorldHint": true,
19989
+ "destructiveHint": false,
19990
+ "idempotentHint": true
19991
+ },
19992
+ "inputSchema": {
19993
+ "type": "object",
19994
+ "properties": {
19995
+ "max_scrolls": {
19996
+ "type": "integer",
19997
+ "minimum": 1,
19998
+ "maximum": 10,
19999
+ "description": "Scroll passes over the feed (default 6)."
20000
+ }
20001
+ }
20002
+ }
20003
+ },
20004
+ "verify_browser": {
20005
+ "name": "Verify browser connection",
20006
+ "kind": "read",
20007
+ "description": "Check the selected browser and any declared account identity without reading source content.",
20008
+ "inputSchema": {
20009
+ "type": "object",
20010
+ "properties": {},
20011
+ "additionalProperties": false
20012
+ }
20013
+ }
20014
+ },
20015
+ "automation_events": [
20016
+ {
20017
+ "key": "notification.changed",
20018
+ "label": "Notification Changed",
20019
+ "resourceType": "notification",
20020
+ "description": "A new or changed notification reference. Read its content from the notifications feed."
20021
+ },
20022
+ {
20023
+ "key": "message.created",
20024
+ "label": "Message Created",
20025
+ "resourceType": "message",
20026
+ "description": "A new inbox message reference. Read its content from the live messages feed by id:<message URN>. A reply Automation can answer a direct message in its conversation.",
20027
+ "capabilities": {
20028
+ "replyToSource": true
20029
+ }
20030
+ },
20031
+ {
20032
+ "key": "source.gap",
20033
+ "label": "Source Gap",
20034
+ "description": "Catch-up reached the end of what LinkedIn exposes, so earlier changes at this conversation or notification position may be missing."
20035
+ },
20036
+ {
20037
+ "key": "post",
20038
+ "label": "Post"
20039
+ },
20040
+ {
20041
+ "key": "comment",
20042
+ "label": "Comment"
20043
+ },
20044
+ {
20045
+ "key": "job_posting",
20046
+ "label": "Job Posting"
20047
+ },
20048
+ {
20049
+ "key": "message",
20050
+ "label": "Message"
20051
+ },
20052
+ {
20053
+ "key": "connection",
20054
+ "label": "Connection"
20055
+ }
20056
+ ],
20057
+ "options_schema": null,
20058
+ "favicon_domain": "linkedin.com",
20059
+ "required_capability": null,
20060
+ "runtime": null,
20061
+ "login_enabled": false
20062
+ }
20063
+ },
18839
20064
  {
18840
20065
  "id": "market.quotes",
18841
20066
  "name": "Market Quotes",
@@ -19504,8 +20729,8 @@
19504
20729
  {
19505
20730
  "id": "reddit",
19506
20731
  "name": "Reddit",
19507
- "version": "1.0.0",
19508
- "description": "Fetches posts and comments from Reddit subreddits or search queries.",
20732
+ "version": "1.2.1",
20733
+ "description": "Fetches posts and comments from Reddit subreddits or search queries, and the connected user's home feed.",
19509
20734
  "detail": {
19510
20735
  "source_path": "reddit.ts",
19511
20736
  "auth_schema": {
@@ -19518,6 +20743,9 @@
19518
20743
  "read",
19519
20744
  "history"
19520
20745
  ],
20746
+ "loginScopes": [
20747
+ "identity"
20748
+ ],
19521
20749
  "setupInstructions": "Create a Reddit app at https://www.reddit.com/prefs/apps — choose \"web app\" as the type. Set the redirect URI to {{redirect_uri}}, then copy the client ID and secret below."
19522
20750
  },
19523
20751
  {
@@ -19621,7 +20849,76 @@
19621
20849
  },
19622
20850
  "eventKinds": {
19623
20851
  "comment": {
19624
- "description": "A Reddit comment",
20852
+ "description": "A Reddit comment",
20853
+ "metadataSchema": {
20854
+ "type": "object",
20855
+ "properties": {
20856
+ "subreddit": {
20857
+ "type": "string"
20858
+ },
20859
+ "score": {
20860
+ "type": "number",
20861
+ "description": "Reddit score (upvotes - downvotes)"
20862
+ }
20863
+ }
20864
+ }
20865
+ }
20866
+ },
20867
+ "operations": [
20868
+ "sync"
20869
+ ]
20870
+ },
20871
+ "user_activity": {
20872
+ "key": "user_activity",
20873
+ "name": "User activity",
20874
+ "description": "Fetch a Reddit user's posts and comments interleaved. Defaults to the connected user.",
20875
+ "displayNameTemplate": "u/{username} activity",
20876
+ "configSchema": {
20877
+ "type": "object",
20878
+ "properties": {
20879
+ "username": {
20880
+ "type": "string",
20881
+ "description": "Reddit username without u/ prefix. Leave empty to use the connected account's identity."
20882
+ },
20883
+ "lookback_days": {
20884
+ "type": "integer",
20885
+ "minimum": 1,
20886
+ "maximum": 730,
20887
+ "default": 365,
20888
+ "description": "Number of days to look back for historical activity."
20889
+ }
20890
+ }
20891
+ },
20892
+ "eventKinds": {
20893
+ "post": {
20894
+ "description": "A Reddit post authored by the user",
20895
+ "metadataSchema": {
20896
+ "type": "object",
20897
+ "properties": {
20898
+ "subreddit": {
20899
+ "type": "string"
20900
+ },
20901
+ "score": {
20902
+ "type": "number",
20903
+ "description": "Reddit score (upvotes - downvotes)"
20904
+ },
20905
+ "num_comments": {
20906
+ "type": "number"
20907
+ },
20908
+ "upvote_ratio": {
20909
+ "type": "number"
20910
+ },
20911
+ "is_self": {
20912
+ "type": "boolean"
20913
+ },
20914
+ "domain": {
20915
+ "type": "string"
20916
+ }
20917
+ }
20918
+ }
20919
+ },
20920
+ "comment": {
20921
+ "description": "A Reddit comment authored by the user",
19625
20922
  "metadataSchema": {
19626
20923
  "type": "object",
19627
20924
  "properties": {
@@ -19640,30 +20937,26 @@
19640
20937
  "sync"
19641
20938
  ]
19642
20939
  },
19643
- "user_activity": {
19644
- "key": "user_activity",
19645
- "name": "User activity",
19646
- "description": "Fetch a Reddit user's posts and comments interleaved. Defaults to the connected user.",
19647
- "displayNameTemplate": "u/{username} activity",
20940
+ "home_feed": {
20941
+ "key": "home_feed",
20942
+ "name": "Home feed",
20943
+ "description": "Fetch the connected user's personalized home feed (Best). Requires user OAuth.",
20944
+ "displayNameTemplate": "Reddit home feed",
19648
20945
  "configSchema": {
19649
20946
  "type": "object",
19650
20947
  "properties": {
19651
- "username": {
19652
- "type": "string",
19653
- "description": "Reddit username without u/ prefix. Leave empty to use the connected account's identity."
19654
- },
19655
20948
  "lookback_days": {
19656
20949
  "type": "integer",
19657
20950
  "minimum": 1,
19658
- "maximum": 730,
19659
- "default": 365,
19660
- "description": "Number of days to look back for historical activity."
20951
+ "maximum": 30,
20952
+ "default": 7,
20953
+ "description": "Skip home feed posts older than this many days."
19661
20954
  }
19662
20955
  }
19663
20956
  },
19664
20957
  "eventKinds": {
19665
20958
  "post": {
19666
- "description": "A Reddit post authored by the user",
20959
+ "description": "A Reddit post from the connected user's home feed",
19667
20960
  "metadataSchema": {
19668
20961
  "type": "object",
19669
20962
  "properties": {
@@ -19685,21 +20978,16 @@
19685
20978
  },
19686
20979
  "domain": {
19687
20980
  "type": "string"
19688
- }
19689
- }
19690
- }
19691
- },
19692
- "comment": {
19693
- "description": "A Reddit comment authored by the user",
19694
- "metadataSchema": {
19695
- "type": "object",
19696
- "properties": {
19697
- "subreddit": {
19698
- "type": "string"
19699
20981
  },
19700
- "score": {
19701
- "type": "number",
19702
- "description": "Reddit score (upvotes - downvotes)"
20982
+ "thumbnail": {
20983
+ "type": "string",
20984
+ "format": "uri",
20985
+ "description": "Preview thumbnail URL"
20986
+ },
20987
+ "media_url": {
20988
+ "type": "string",
20989
+ "format": "uri",
20990
+ "description": "Linked content URL for non-self posts (image, video, article)"
19703
20991
  }
19704
20992
  }
19705
20993
  }
@@ -19837,6 +21125,7 @@
19837
21125
  "events": [
19838
21126
  "app_home_opened",
19839
21127
  "app_mention",
21128
+ "assistant_thread_started",
19840
21129
  "member_joined_channel",
19841
21130
  "member_left_channel",
19842
21131
  "message.channels",
@@ -20032,7 +21321,7 @@
20032
21321
  {
20033
21322
  "id": "tiktok.web",
20034
21323
  "name": "TikTok",
20035
- "version": "1.1.5",
21324
+ "version": "1.1.9",
20036
21325
  "description": "Read TikTok through your signed-in paired browser, inspect post visuals, set likes, and prepare comments for human submission. Automations decide what to read and act on.",
20037
21326
  "detail": {
20038
21327
  "source_path": "tiktok_web.ts",
@@ -20053,7 +21342,7 @@
20053
21342
  ],
20054
21343
  "accountProbe": {
20055
21344
  "url": "https://www.tiktok.com",
20056
- "expression": "(async function tiktokPage(command, args = {}) {\n const visible = (e) => !!e && e.getClientRects().length > 0, assertNoChallenge = () => {\n if (visible(document.querySelector(\"#captcha-verify-container-main-page\")))\n throw Error(\"TikTok verification required; complete the challenge in the connected browser\");\n };\n assertNoChallenge();\n const scope = () => {\n const script = document.querySelector(\"#__UNIVERSAL_DATA_FOR_REHYDRATION__\");\n return script ? JSON.parse(script.textContent).__DEFAULT_SCOPE__ || {} : {};\n }, identity = () => {\n const user = scope()[\"webapp.app-context\"]?.user;\n return typeof user?.uid === \"string\" && /^[0-9]+$/.test(user.uid) ? { accountId: user.uid, displayName: user.uniqueId } : null;\n }, wait = async (read) => {\n for (let i = 0;i < 40; i++) {\n const value = read();\n if (value)\n return value;\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n throw Error(\"TikTok page did not expose the requested content; it may be loading, signed out, or unavailable\");\n };\n if (command === \"identity\")\n try {\n return await wait(identity);\n } catch {\n return null;\n }\n if (!identity())\n throw Error(\"TikTok sign-in is required\");\n const assertFollowing = () => {\n if (location.origin !== \"https://www.tiktok.com\" || location.pathname !== \"/following\")\n throw Error(\"TikTok Following page changed\");\n assertNoChallenge();\n if (!identity())\n throw Error(\"TikTok sign-in is required\");\n };\n if (command === \"following_status\" || command === \"following_wait\") {\n assertFollowing();\n document.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n if (command === \"following_wait\") {\n await new Promise((resolve) => setTimeout(resolve, 250));\n assertFollowing();\n }\n return { ready: !0 };\n }\n const project = (item) => ({\n id: item.id,\n desc: item.desc,\n createTime: item.createTime,\n author: item.author && { id: item.author.id, uniqueId: item.author.uniqueId, nickname: item.author.nickname },\n video: item.video && { duration: item.video.duration, width: item.video.width, height: item.video.height },\n imagePost: item.imagePost && { images: item.imagePost.images?.map(() => ({})) },\n stats: item.stats && { diggCount: item.stats.diggCount, commentCount: item.stats.commentCount, playCount: item.stats.playCount, shareCount: item.stats.shareCount },\n digged: item.digged\n });\n if (command === \"following_posts\") {\n assertFollowing();\n const url = new URL(args.url);\n if (url.origin !== location.origin || url.pathname !== \"/api/following/item_list/\" || url.username || url.password)\n throw Error(\"Unexpected TikTok Following URL\");\n if (!Number.isInteger(args.limit) || args.limit < 1 || args.limit > 30 || !Array.isArray(args.seen_ids))\n throw Error(\"Invalid TikTok Following collection request\");\n const seen = new Set(args.seen_ids), items = new Map, requested = new Set;\n let { cursor, level } = args, hasMore = !0;\n const controller = new AbortController, timer = setTimeout(() => controller.abort(), 16000);\n try {\n for (let round = 0;round < 12 && seen.size < args.limit && hasMore; round++) {\n assertFollowing();\n if (typeof cursor !== \"string\" || !cursor || cursor.length > 256 || !Number.isSafeInteger(level) || level < 1)\n throw Error(\"TikTok Following continuation is unavailable\");\n const key = `${level}:${cursor}`;\n if (requested.has(key))\n break;\n requested.add(key);\n url.searchParams.set(\"count\", \"30\");\n url.searchParams.set(\"pullType\", \"2\");\n url.searchParams.set(\"cursor\", cursor);\n url.searchParams.set(\"level\", String(level));\n document.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n const response = await fetch(url.href, { credentials: \"include\", signal: controller.signal });\n if (response.status !== 200)\n throw Error(\"TikTok Following continuation request failed\");\n const json = await response.json();\n assertFollowing();\n if (json.status_code !== 0 || json.statusCode !== void 0 && json.statusCode !== 0 || !Array.isArray(json.itemList) || typeof json.hasMore !== \"boolean\")\n throw Error(\"TikTok did not return a successful Following feed\");\n for (const item of json.itemList) {\n seen.add(item.id);\n items.set(item.id, project(item));\n }\n ({ cursor, level, hasMore } = json);\n }\n } finally {\n clearTimeout(timer);\n }\n assertFollowing();\n if (seen.size < args.limit && hasMore)\n throw Error(`TikTok Following read incomplete: collected ${seen.size} of ${args.limit} requested posts; retry the read`);\n return { items: [...items.values()] };\n }\n if (command === \"snapshot\")\n return { items: (scope()[\"webapp.updated-items\"] || []).map(project) };\n if (command === \"post_links\")\n return { rows: (await wait(() => {\n assertNoChallenge();\n const rendered = [...document.querySelectorAll('a[href*=\"/video/\"],a[href*=\"/photo/\"]')].filter(visible);\n return rendered.length ? rendered : null;\n })).map((a) => ({\n url: a.href,\n text: a.querySelector(\"img\")?.alt || a.innerText || \"\"\n })) };\n const detail = args.source_item || await wait(() => scope()[\"webapp.video-detail\"]?.itemInfo?.itemStruct), target = new URL(args.url);\n if (!/^[A-Za-z0-9_.]{1,64}$/.test(detail.author?.uniqueId || \"\"))\n throw Error(\"TikTok post author is invalid\");\n const assertTarget = () => {\n if (location.origin !== target.origin || location.pathname !== target.pathname || detail.id !== target.pathname.split(\"/\").pop())\n throw Error(\"TikTok post changed; refusing to act on a different post\");\n };\n assertTarget();\n const card = await wait(() => {\n const matches = [...document.querySelectorAll('[data-e2e=\"recommend-list-item-container\"]')].filter((candidate) => visible(candidate) && candidate.querySelector('[data-e2e=\"more-menu-icon\"]')?.getAttribute(\"data-more-menu-item-id\") === detail.id);\n if (matches.length > 1)\n throw Error(\"TikTok displayed post identity is ambiguous\");\n return matches[0];\n });\n assertTarget();\n const author = card.querySelector(`a[href=\"/@${detail.author.uniqueId}\"]`), description = card.querySelector('[data-e2e=\"video-desc\"]'), compact = (text) => String(text || \"\").replace(/\\s+/g, \"\").trim();\n if (!author || detail.desc && !compact(description?.textContent).includes(compact(detail.desc)))\n throw Error(\"TikTok displayed post does not match the requested source record\");\n const likeButton = card.querySelector('[data-e2e=\"like-icon\"]'), liked = () => {\n const value = likeButton?.getAttribute(\"aria-pressed\");\n if (value !== \"true\" && value !== \"false\")\n throw Error(\"TikTok like state is unavailable\");\n return value === \"true\";\n };\n if (command === \"detail\")\n return { item: project(detail), liked: liked() };\n if (command === \"mute\") {\n card.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n return { muted: !0 };\n }\n if (command === \"photo\") {\n const count = detail.imagePost?.images?.length, index = args.index;\n if (!Number.isInteger(index) || index < 0 || !count || index >= count)\n throw Error(\"Photo index is outside this post\");\n const carousel = card.querySelector(\".swiper\")?.swiper;\n if (typeof carousel?.slideToLoop !== \"function\" || typeof carousel?.autoplay?.stop !== \"function\")\n throw Error(\"TikTok photo carousel is unavailable\");\n carousel.autoplay.stop();\n carousel.slideToLoop(index, 0);\n await wait(() => carousel.realIndex === index && !carousel.animating);\n const slide = card.querySelector(\".swiper-slide-active\"), image = slide?.querySelector(\"img\");\n await wait(() => image?.complete && image.naturalWidth > 0);\n assertTarget();\n slide.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { photo_index: index, photo_count: count };\n }\n if (command === \"set_like\") {\n if (typeof args.liked !== \"boolean\")\n throw Error(\"liked must be a boolean\");\n const before = liked();\n if (before !== args.liked) {\n likeButton.click();\n await wait(() => liked() === args.liked);\n }\n assertTarget();\n return { liked: liked(), changed: before !== args.liked };\n }\n if (command === \"frame\") {\n const video = card.querySelector(\"video\");\n if (!video)\n throw Error(\"No playable video on this post\");\n video.muted = !0;\n await video.play();\n await wait(() => video.readyState >= 2 && Number.isFinite(video.duration) && video.duration > 0);\n assertTarget();\n video.pause();\n const seconds = args.seconds;\n if (!Number.isFinite(seconds) || seconds < 0 || seconds >= video.duration)\n throw Error(\"Frame time is outside the video duration\");\n video.currentTime = seconds;\n await wait(() => !video.seeking && Math.abs(video.currentTime - seconds) < 0.15 && video.readyState >= 2);\n assertTarget();\n video.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { seconds: video.currentTime, duration_seconds: video.duration };\n }\n if (command === \"open_comment\") {\n if (![...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].find(visible)) {\n const button = card.querySelector('[data-e2e=\"comment-icon\"]');\n if (!button)\n throw Error(\"TikTok comment control is unavailable\");\n button.click();\n }\n const editor = await wait(() => [...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].find(visible));\n assertTarget();\n if (editor.textContent.trim())\n throw Error(\"The comment composer already contains text; preserving the user's draft\");\n editor.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { opened: !0 };\n }\n if (command === \"comment_text\") {\n const editors = [...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].filter(visible);\n if (editors.length !== 1)\n throw Error(\"TikTok comment composer is ambiguous\");\n return { text: editors[0].innerText };\n }\n throw Error(\"Unsupported TikTok page command\");\n })(\"identity\",{})"
21345
+ "expression": "Promise.resolve().then(() => (async function tiktokPage(command, args = {}) {\n const interrupt = (reason, message) => {\n throw Object.assign(Error(message), { browser_interruption: reason });\n }, visible = (e) => !!e && e.getClientRects().length > 0, assertNoChallenge = () => {\n if (visible(document.querySelector(\"#captcha-verify-container-main-page\")))\n interrupt(\"challenge_required\", \"TikTok verification required; complete the challenge in the connected browser\");\n };\n assertNoChallenge();\n const scope = () => {\n const script = document.querySelector(\"#__UNIVERSAL_DATA_FOR_REHYDRATION__\");\n return script ? JSON.parse(script.textContent).__DEFAULT_SCOPE__ || {} : {};\n }, identity = () => {\n const user = scope()[\"webapp.app-context\"]?.user;\n return typeof user?.uid === \"string\" && /^[0-9]+$/.test(user.uid) ? { accountId: user.uid, displayName: user.uniqueId } : null;\n }, wait = async (read) => {\n for (let i = 0;i < 40; i++) {\n assertNoChallenge();\n const value = read();\n if (value)\n return value;\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n interrupt(\"loading_failure\", \"TikTok page did not expose the requested content\");\n };\n if (command === \"identity\")\n try {\n return await wait(identity);\n } catch (error) {\n if (error.browser_interruption !== \"loading_failure\")\n throw error;\n return null;\n }\n const owner = identity()?.accountId;\n if (!owner)\n interrupt(\"login_required\", \"TikTok sign-in is required\");\n if (command === \"read_failure\")\n interrupt(\"loading_failure\", \"TikTok page did not finish loading the requested content\");\n const assertTimeline = (path) => {\n if (location.origin !== \"https://www.tiktok.com\" || location.pathname !== path)\n throw Error(\"TikTok timeline page changed\");\n assertNoChallenge();\n if (!identity())\n interrupt(\"login_required\", \"TikTok sign-in is required\");\n if (identity().accountId !== owner)\n interrupt(\"account_mismatch\", \"TikTok account changed during the read\");\n }, assertFollowing = () => assertTimeline(\"/following\");\n if ([\"following_status\", \"following_wait\", \"for_you_status\", \"for_you_wait\"].includes(command)) {\n const path = command.startsWith(\"following_\") ? \"/following\" : \"/\";\n assertTimeline(path);\n document.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n if (command.endsWith(\"_wait\")) {\n await new Promise((resolve) => setTimeout(resolve, 250));\n assertTimeline(path);\n }\n return { ready: !0 };\n }\n const project = (item) => ({\n id: item.id,\n desc: item.desc,\n createTime: item.createTime,\n author: item.author && { id: item.author.id, uniqueId: item.author.uniqueId, nickname: item.author.nickname },\n video: item.video && { duration: item.video.duration, width: item.video.width, height: item.video.height },\n imagePost: item.imagePost && { images: item.imagePost.images?.map(() => ({})) },\n stats: item.stats && { diggCount: item.stats.diggCount, commentCount: item.stats.commentCount, playCount: item.stats.playCount, shareCount: item.stats.shareCount },\n digged: item.digged\n });\n if (command === \"following_posts\") {\n assertFollowing();\n const url = new URL(args.url);\n if (url.origin !== location.origin || url.pathname !== \"/api/following/item_list/\" || url.username || url.password)\n throw Error(\"Unexpected TikTok Following URL\");\n if (!Number.isInteger(args.limit) || args.limit < 1 || args.limit > 30 || !Array.isArray(args.seen_ids))\n throw Error(\"Invalid TikTok Following collection request\");\n const seen = new Set(args.seen_ids), items = new Map, requested = new Set;\n let { cursor, level } = args, hasMore = !0;\n const controller = new AbortController, timer = setTimeout(() => controller.abort(), 16000);\n try {\n for (let round = 0;round < 12 && seen.size < args.limit && hasMore; round++) {\n assertFollowing();\n if (typeof cursor !== \"string\" || !cursor || cursor.length > 256 || !Number.isSafeInteger(level) || level < 1)\n throw Error(\"TikTok Following continuation is unavailable\");\n const key = `${level}:${cursor}`;\n if (requested.has(key))\n break;\n requested.add(key);\n url.searchParams.set(\"count\", \"30\");\n url.searchParams.set(\"pullType\", \"2\");\n url.searchParams.set(\"cursor\", cursor);\n url.searchParams.set(\"level\", String(level));\n document.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n const response = await fetch(url.href, { credentials: \"include\", signal: controller.signal });\n if (response.status !== 200)\n throw Error(\"TikTok Following continuation request failed\");\n const json = await response.json();\n assertFollowing();\n if (json.status_code !== 0 || json.statusCode !== void 0 && json.statusCode !== 0 || !Array.isArray(json.itemList) || typeof json.hasMore !== \"boolean\")\n throw Error(\"TikTok did not return a successful Following feed\");\n for (const item of json.itemList) {\n seen.add(item.id);\n items.set(item.id, project(item));\n }\n ({ cursor, level, hasMore } = json);\n }\n } finally {\n clearTimeout(timer);\n }\n assertFollowing();\n if (seen.size < args.limit && hasMore)\n throw Error(`TikTok Following read incomplete: collected ${seen.size} of ${args.limit} requested posts; retry the read`);\n return { items: [...items.values()] };\n }\n if (command === \"post_links\")\n return { rows: (await wait(() => {\n assertNoChallenge();\n const rendered = [...document.querySelectorAll('a[href*=\"/video/\"],a[href*=\"/photo/\"]')].filter(visible);\n return rendered.length ? rendered : null;\n })).map((a) => ({\n url: a.href,\n text: a.querySelector(\"img\")?.alt || a.innerText || \"\"\n })) };\n const detail = args.source_item || await wait(() => scope()[\"webapp.video-detail\"]?.itemInfo?.itemStruct), target = new URL(args.url);\n if (!/^[A-Za-z0-9_.]{1,64}$/.test(detail.author?.uniqueId || \"\"))\n throw Error(\"TikTok post author is invalid\");\n const assertTarget = () => {\n if (location.origin !== target.origin || location.pathname !== target.pathname || detail.id !== target.pathname.split(\"/\").pop())\n throw Error(\"TikTok post changed; refusing to act on a different post\");\n };\n assertTarget();\n const card = await wait(() => {\n const matches = [...document.querySelectorAll('[data-e2e=\"recommend-list-item-container\"]')].filter((candidate) => visible(candidate) && candidate.querySelector('[data-e2e=\"more-menu-icon\"]')?.getAttribute(\"data-more-menu-item-id\") === detail.id);\n if (matches.length > 1)\n throw Error(\"TikTok displayed post identity is ambiguous\");\n return matches[0];\n });\n assertTarget();\n const author = card.querySelector(`a[href=\"/@${detail.author.uniqueId}\"]`), description = card.querySelector('[data-e2e=\"video-desc\"]'), compact = (text) => String(text || \"\").replace(/\\s+/g, \"\").trim();\n if (!author || detail.desc && !compact(description?.textContent).includes(compact(detail.desc)))\n throw Error(\"TikTok displayed post does not match the requested source record\");\n const likeButton = card.querySelector('[data-e2e=\"like-icon\"]'), liked = () => {\n const value = likeButton?.getAttribute(\"aria-pressed\");\n if (value !== \"true\" && value !== \"false\")\n throw Error(\"TikTok like state is unavailable\");\n return value === \"true\";\n };\n if (command === \"detail\")\n return { item: project(detail), liked: liked() };\n if (command === \"mute\") {\n card.querySelectorAll(\"video,audio\").forEach((media) => {\n media.muted = !0;\n });\n return { muted: !0 };\n }\n if (command === \"photo\") {\n const count = detail.imagePost?.images?.length, index = args.index;\n if (!Number.isInteger(index) || index < 0 || !count || index >= count)\n throw Error(\"Photo index is outside this post\");\n const carousel = card.querySelector(\".swiper\")?.swiper;\n if (typeof carousel?.slideToLoop !== \"function\" || typeof carousel?.autoplay?.stop !== \"function\")\n throw Error(\"TikTok photo carousel is unavailable\");\n carousel.autoplay.stop();\n carousel.slideToLoop(index, 0);\n await wait(() => carousel.realIndex === index && !carousel.animating);\n const slide = card.querySelector(\".swiper-slide-active\"), image = slide?.querySelector(\"img\");\n await wait(() => image?.complete && image.naturalWidth > 0);\n assertTarget();\n slide.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { photo_index: index, photo_count: count };\n }\n if (command === \"set_like\") {\n if (typeof args.liked !== \"boolean\")\n throw Error(\"liked must be a boolean\");\n const before = liked();\n if (before !== args.liked) {\n likeButton.click();\n await wait(() => liked() === args.liked);\n }\n assertTarget();\n return { liked: liked(), changed: before !== args.liked };\n }\n if (command === \"frame\") {\n const video = card.querySelector(\"video\");\n if (!video)\n throw Error(\"No playable video on this post\");\n video.muted = !0;\n await video.play();\n await wait(() => video.readyState >= 2 && Number.isFinite(video.duration) && video.duration > 0);\n assertTarget();\n video.pause();\n const seconds = args.seconds;\n if (!Number.isFinite(seconds) || seconds < 0 || seconds >= video.duration)\n throw Error(\"Frame time is outside the video duration\");\n video.currentTime = seconds;\n await wait(() => !video.seeking && Math.abs(video.currentTime - seconds) < 0.15 && video.readyState >= 2);\n assertTarget();\n video.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { seconds: video.currentTime, duration_seconds: video.duration };\n }\n if (command === \"open_comment\") {\n if (![...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].find(visible)) {\n const button = card.querySelector('[data-e2e=\"comment-icon\"]');\n if (!button)\n throw Error(\"TikTok comment control is unavailable\");\n button.click();\n }\n const editor = await wait(() => [...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].find(visible));\n assertTarget();\n if (editor.textContent.trim())\n throw Error(\"The comment composer already contains text; preserving the user's draft\");\n editor.scrollIntoView({ block: \"center\", behavior: \"instant\" });\n return { opened: !0 };\n }\n if (command === \"comment_text\") {\n const editors = [...document.querySelectorAll('[contenteditable=\"true\"][role=\"textbox\"]')].filter(visible);\n if (editors.length !== 1)\n throw Error(\"TikTok comment composer is ambiguous\");\n return { text: editors[0].innerText };\n }\n throw Error(\"Unsupported TikTok page command\");\n })(\"identity\",{})).catch(error => { if (!error.browser_interruption) throw error; return { __lobu_browser_interruption: { reason: error.browser_interruption, message: error.message } }; })"
20057
21346
  }
20058
21347
  },
20059
21348
  "webhook": null,
@@ -20077,7 +21366,7 @@
20077
21366
  "for_you": {
20078
21367
  "key": "for_you",
20079
21368
  "name": "For You",
20080
- "description": "Initial personalized timeline snapshot. No history coverage or continuation; repeat reads can overlap.",
21369
+ "description": "Initial personalized timeline snapshot. Ad units without canonical post identity are excluded. No history coverage or continuation; repeat reads can overlap.",
20081
21370
  "operations": [
20082
21371
  "read"
20083
21372
  ]
@@ -20234,8 +21523,8 @@
20234
21523
  {
20235
21524
  "id": "whatsapp.web",
20236
21525
  "name": "WhatsApp",
20237
- "version": "1.0.9",
20238
- "description": "Personal WhatsApp messages read from WhatsApp Web in the paired Owletto Chrome. Syncs one-to-one and group chats, progressively hydrates history, and can search, draft, send, edit, react to, and revoke messages.",
21526
+ "version": "2.2.0",
21527
+ "description": "Personal WhatsApp messages read live from WhatsApp Web in the paired Owletto Chrome without importing message history. Automations react to new-message references and read content on demand. Search, draft, send, edit, react to, and revoke messages.",
20239
21528
  "detail": {
20240
21529
  "source_path": "whatsapp_web.ts",
20241
21530
  "auth_schema": {
@@ -20252,7 +21541,7 @@
20252
21541
  ],
20253
21542
  "accountProbe": {
20254
21543
  "url": "https://web.whatsapp.com/",
20255
- "expression": "(async () => {\n (function whatsAppWebAdapterProgram() {\n const SYSTEM_TYPES = new Set([\n \"gp2\",\n \"notification_template\",\n \"e2e_notification\"\n ]);\n let readinessSignature = null, readinessStableSince = 0;\n const existing = globalThis.__owlettoWhatsAppAdapterV1;\n if (existing?.version === 22)\n return;\n existing?.detach?.();\n const listeners = new Map;\n function detach(bindingId) {\n const selected = bindingId ? [listeners.get(bindingId)] : [...listeners.values()];\n for (const state of selected) {\n if (!state)\n continue;\n state.collection.off(\"add\", state.onAdd);\n state.collection.off(\"change\", state.onChange);\n window.removeEventListener(\"message\", state.onReply);\n listeners.delete(state.id);\n }\n }\n function listen(request) {\n const collection = requireFirst([\"WAWebCollections\"])?.Msg;\n if (typeof collection?.on !== \"function\" || typeof collection?.off !== \"function\")\n throw Error(\"WhatsApp message observation is unavailable in this build\");\n if (!request.bridge_id || !request.token)\n throw Error(\"A feed bridge is required\");\n const post = (state2, entry) => window.postMessage({\n type: \"lobu-feed-record\",\n token: state2.token,\n sequence: entry.sequence,\n record: entry.record\n }, location.origin), reportError = (state2, message, sequence = ++state2.sequence) => {\n state2.error = message;\n post(state2, {\n sequence,\n record: {\n id: \"whatsapp-web:source-observation-error\",\n source_error: message\n }\n });\n }, resident = listeners.get(request.bridge_id), previous = resident?.request.references_only === request.references_only && resident?.request.chat_filter === request.chat_filter && resident?.request.minimum_timestamp === request.minimum_timestamp ? resident : null;\n detach(request.bridge_id);\n const state = {\n ...previous ?? {\n id: request.bridge_id,\n collection,\n sequence: 0,\n pending: new Map,\n fingerprints: new Map,\n pendingBytes: 0,\n fingerprintBytes: 0,\n error: null\n },\n collection,\n error: null\n };\n state.token = request.token;\n state.request = request;\n state.post = (entry) => post(state, entry);\n const observe = (model, kind) => {\n if (state.error)\n return;\n const sequence = ++state.sequence;\n (request.references_only ? Promise.resolve(messageReference(model)) : normalizeMessage(model, \"reconcile\")).then((record) => {\n if (listeners.get(state.id) !== state || !record || record.timestamp <= 0)\n return;\n if (state.request.chat_filter === \"group\" && !record.is_group)\n return;\n if (state.request.chat_filter === \"individual\" && record.is_group)\n return;\n if (state.request.minimum_timestamp != null && record.timestamp < state.request.minimum_timestamp)\n return;\n if (kind === \"add\" && record.timestamp < state.request.recent_since)\n return;\n if (request.references_only)\n record = {\n id: record.id,\n events: [{\n id: record.id,\n event_type: \"message.created\",\n resource_ref: record.id,\n resource_type: \"message\",\n occurred_at: new Date(record.timestamp * 1000).toISOString()\n }]\n };\n const previous2 = state.pending.get(record.id), seen = state.fingerprints.get(record.id);\n if (seen && seen.sequence >= sequence)\n return;\n const fingerprint = JSON.stringify(record);\n if (seen?.fingerprint === fingerprint) {\n seen.sequence = sequence;\n return;\n }\n const bytes = new TextEncoder().encode(fingerprint).length;\n if (bytes > 131072 || state.pendingBytes - (previous2?.bytes ?? 0) + bytes > 16777216 || state.pending.size >= 1e4 && !previous2) {\n reportError(state, \"WhatsApp page observation buffer overflowed; recovery is required\", sequence);\n return;\n }\n const entry = { sequence, record, bytes };\n state.pendingBytes += bytes - (previous2?.bytes ?? 0);\n state.pending.set(record.id, entry);\n state.fingerprintBytes += bytes - (seen?.bytes ?? 0);\n state.fingerprints.delete(record.id);\n state.fingerprints.set(record.id, { fingerprint, sequence, bytes });\n while (state.fingerprints.size > 1e4 || state.fingerprintBytes > 16777216) {\n const oldest = state.fingerprints.keys().next().value;\n state.fingerprintBytes -= state.fingerprints.get(oldest).bytes;\n state.fingerprints.delete(oldest);\n }\n post(state, entry);\n }).catch(() => {\n if (listeners.get(state.id) !== state)\n return;\n reportError(state, \"WhatsApp source observation failed; recovery is required\", sequence);\n });\n };\n state.onAdd = (model) => observe(model, \"add\");\n state.onChange = (model) => observe(model, \"change\");\n state.onReply = (event) => {\n if (event.source !== window || event.origin !== location.origin || event.data?.token !== state.token)\n return;\n if (event.data.type === \"lobu-feed-record:stop\") {\n detach(state.id);\n return;\n }\n if (event.data.type !== \"lobu-feed-record:ack\")\n return;\n for (const [id, entry] of state.pending) {\n if (entry.sequence !== event.data.sequence)\n continue;\n if (event.data.ok) {\n state.pendingBytes -= entry.bytes;\n state.pending.delete(id);\n entry.resolve?.();\n } else\n entry.reject?.(Error(\"Browser rejected the source reference batch\"));\n break;\n }\n };\n listeners.set(state.id, state);\n try {\n collection.on(\"add\", state.onAdd);\n collection.on(\"change\", state.onChange);\n window.addEventListener(\"message\", state.onReply);\n } catch (error) {\n reportError(state, \"WhatsApp source observation failed; recovery is required\");\n throw error;\n }\n if (previous?.error)\n post(state, {\n sequence: ++state.sequence,\n record: { id: \"whatsapp-web:source-observation-error\", source_error: previous.error }\n });\n for (const entry of state.pending.values())\n post(state, entry);\n return { ok: !0, listening: !0 };\n }\n async function publishChanges(request) {\n const state = listeners.get(request.bridge_id);\n if (!state?.request.references_only || state.token !== request.token)\n throw Error(\"Source listener is unavailable\");\n const record = request.batch, bytes = new TextEncoder().encode(JSON.stringify(record)).length, previous = state.pending.get(record.id);\n if (bytes > 131072 || state.pendingBytes - (previous?.bytes ?? 0) + bytes > 16777216 || state.pending.size >= 1e4 && !previous)\n throw Error(\"Source replay buffer is full\");\n await new Promise((resolve, reject) => {\n const timer = setTimeout(() => reject(Error(\"Source replay was not accepted by the browser\")), 1e4), entry = {\n record,\n bytes,\n sequence: ++state.sequence,\n resolve: () => {\n clearTimeout(timer);\n resolve();\n },\n reject: (error) => {\n clearTimeout(timer);\n reject(error);\n }\n };\n state.pendingBytes += bytes - (previous?.bytes ?? 0);\n state.pending.set(record.id, entry);\n state.post(entry);\n });\n return { ok: !0 };\n }\n function requireFirst(names) {\n for (const name of names)\n try {\n const module2 = window.require?.(name);\n if (module2)\n return module2;\n } catch {}\n return null;\n }\n function meUser() {\n const module2 = requireFirst([\n \"WAWebUserPrefsMeUser\",\n \"WAWebUserPrefsMe\",\n \"WAWebUserPrefs\"\n ]);\n if (!module2)\n return null;\n for (const accessor of [\n \"getMaybeMePnUser\",\n \"getMaybeMeUser\",\n \"getMeUser\",\n \"getMeUserOrThrow\",\n \"getMaybeMeLidUser\"\n ])\n try {\n const value = module2[accessor]?.();\n if (value)\n return value;\n } catch {}\n try {\n return module2.me ?? null;\n } catch {}\n return null;\n }\n const SEND_MODULES = [\n \"WAWebSendTextMsgChatAction\",\n \"WAWebSendMsgChatAction\",\n \"WAWebSendMessage\"\n ], REACTION_MODULES = [\n \"WAWebSendReactionMsgAction\",\n \"WAWebSendReactionMsg\",\n \"WAWebReactionAction\"\n ], REVOKE_MODULES = [\n \"WAWebChatSendMessages\",\n \"WAWebRevokeMsgAction\",\n \"WAWebDeleteChatAction\",\n \"WAWebRevokeMessage\"\n ], EDIT_MODULES = [\"WAWebSendMessageEditAction\", \"WAWebEditMessage\"], DRAFT_MODULES = [\n \"WAWebChatDraftUtils\",\n \"WAWebSetDraft\",\n \"WAWebComposeBoxActions\"\n ];\n function modelData(model) {\n return model?.attributes ?? model?._data ?? model ?? {};\n }\n function messageReference(model) {\n const row = modelData(model), key = row.id ?? model?.id, id = rawId(key), remote = widString(key?.remote ?? row.chatId ?? (key?.fromMe ? row.to : row.from));\n if (!id || !remote || remote === \"status@broadcast\" || remote.endsWith(\"@newsletter\") || SYSTEM_TYPES.has(row.type))\n return null;\n return { id, timestamp: unixSeconds(row), is_group: remote.endsWith(\"@g.us\") };\n }\n async function observeMessages(input = {}) {\n const after = input.after ?? null;\n if (after !== null && (!Number.isSafeInteger(after) || after < 0))\n throw Error(\"Invalid WhatsApp observation cursor\");\n const database = await new Promise((resolve, reject) => {\n const request = indexedDB.open(\"model-storage\");\n request.onupgradeneeded = () => {\n request.transaction.abort();\n reject(Error(\"WhatsApp source history database is unavailable\"));\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(Error(\"WhatsApp source history database is blocked\"));\n request.onsuccess = () => resolve(request.result);\n });\n let rows;\n try {\n rows = await new Promise((resolve, reject) => {\n const transaction = database.transaction(\"message\", \"readonly\");\n transaction.onabort = () => reject(transaction.error ?? Error(\"WhatsApp source observation aborted\"));\n const request = transaction.objectStore(\"message\").index(\"rowId\").openCursor(after === null ? null : IDBKeyRange.lowerBound(after, !0), after === null ? \"prev\" : \"next\"), page2 = [];\n request.onerror = () => reject(request.error);\n request.onsuccess = () => {\n const cursor = request.result;\n if (!cursor) {\n resolve(page2);\n return;\n }\n if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== \"string\") {\n reject(Error(\"WhatsApp source history has an unsupported key layout\"));\n return;\n }\n page2.push({ position: cursor.key, id: cursor.value.id, timestamp: unixSeconds(cursor.value), type: cursor.value.type });\n if (after === null || page2.length > 500)\n resolve(page2);\n else\n cursor.continue();\n };\n });\n } finally {\n database.close();\n }\n if (after === null)\n return { after: rows[0]?.position ?? 0, references: [], hasMore: !1 };\n const page = rows.slice(0, 500), references = [];\n if (page.length) {\n const keys = requireFirst([\"WAWebMsgKey\"]);\n if (typeof keys?.fromString !== \"function\")\n throw Error(\"WhatsApp source message keys are unavailable\");\n for (const row of page) {\n const reference = messageReference({ id: keys.fromString(row.id), t: row.timestamp, type: row.type });\n if (!reference)\n continue;\n if (reference.timestamp <= 0)\n continue;\n if (reference.timestamp < input.started_at)\n continue;\n if (input.chat_filter === \"group\" && !reference.is_group)\n continue;\n if (input.chat_filter === \"individual\" && reference.is_group)\n continue;\n references.push(reference);\n }\n }\n return { after: page[page.length - 1]?.position ?? after, references, hasMore: rows.length > 500 };\n }\n function models(collection) {\n if (Array.isArray(collection?._models))\n return collection._models;\n if (Array.isArray(collection?.models))\n return collection.models;\n if (typeof collection?.toArray === \"function\")\n try {\n return collection.toArray();\n } catch {}\n return [];\n }\n function widString(value) {\n if (typeof value === \"string\")\n return value;\n if (!value)\n return null;\n if (typeof value._serialized === \"string\")\n return value._serialized;\n try {\n const rendered = value.toString?.();\n return rendered && rendered !== \"[object Object]\" ? String(rendered) : null;\n } catch {\n return null;\n }\n }\n function rawId(value) {\n if (typeof value === \"string\")\n return value && !/^(?:true|false)_/i.test(value) ? value : null;\n if (typeof value?.id === \"string\")\n return value.id && !/^(?:true|false)_/i.test(value.id) ? value.id : null;\n return null;\n }\n function unixSeconds(row) {\n const value = Number(row?.t ?? row?.timestamp ?? row?.ephemeralStartTimestamp ?? 0);\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;\n }\n async function canonicalJid(value) {\n const original = widString(value);\n if (!original)\n return { jid: null, lid: null };\n let jid = original.toLowerCase();\n if (jid.endsWith(\"@c.us\"))\n jid = `${jid.slice(0, -5)}@s.whatsapp.net`;\n if (!jid.endsWith(\"@lid\"))\n return { jid, lid: null };\n const migration = requireFirst([\n \"WAWebLidMigrationUtils\",\n \"WAWebLidMigration\"\n ]), toPn = migration?.toPn ?? migration?.getPnForLid ?? migration?.lidToPhone;\n if (typeof toPn === \"function\")\n try {\n const converted = await toPn.call(migration, value), phoneJid = widString(converted);\n if (phoneJid)\n return {\n jid: phoneJid.endsWith(\"@c.us\") ? `${phoneJid.slice(0, -5)}@s.whatsapp.net` : phoneJid,\n lid: jid\n };\n } catch {}\n return { jid, lid: jid };\n }\n function collectionByRawId(collection, id) {\n if (!id)\n return null;\n for (const model of models(collection)) {\n const row = modelData(model);\n if (rawId(row.id ?? model?.id) === id)\n return model;\n }\n return null;\n }\n function reactionTargetId(row) {\n return rawId(row.reactionParentKey) ?? rawId(row.parentMsgKey) ?? rawId(row.parentMessageKey) ?? (typeof row.quotedStanzaID === \"string\" ? row.quotedStanzaID : null);\n }\n function normalizeReactions(row) {\n const source = row.reactions ?? row.reactionCollection ?? row.reactionsBySender;\n return (Array.isArray(source) ? source : models(source)).map((reaction) => {\n const data = modelData(reaction);\n return {\n emoji: data.text ?? data.reactionText ?? data.emoji ?? null,\n sender_jid: widString(data.senderUserJid ?? data.sender ?? data.author),\n from_me: Boolean(data.fromMe)\n };\n }).filter((reaction) => typeof reaction.emoji === \"string\" && reaction.emoji.length > 0);\n }\n function nameIndex(collections) {\n const byId = (collection) => {\n const map = new Map;\n for (const model of models(collection)) {\n const id = widString(modelData(model).id ?? model?.id);\n if (id && !map.has(id))\n map.set(id, model);\n }\n return map;\n };\n return { chats: byId(collections?.Chat), contacts: byId(collections?.Contact) };\n }\n function contactName(names, jid) {\n if (!jid)\n return null;\n const contact = names?.contacts?.get(jid);\n if (!contact)\n return null;\n const row = modelData(contact);\n return row.name ?? row.pushname ?? row.shortName ?? row.formattedName ?? null;\n }\n function chatName(names, jid) {\n if (!jid)\n return null;\n const chat = names?.chats?.get(jid);\n if (!chat)\n return null;\n const row = modelData(chat);\n return row.name ?? row.formattedTitle ?? row.contact?.name ?? row.contact?.pushname ?? null;\n }\n async function normalizeMessage(model, eventType = \"snapshot\", collectionsOverride = null, names = null) {\n const collections = collectionsOverride ?? requireFirst([\"WAWebCollections\"]);\n if (!collections)\n return null;\n const nameLookup = names ?? nameIndex(collections);\n let row = modelData(model), key = row.id ?? model?.id, id = rawId(key);\n if (!id)\n return null;\n if (row.type === \"reaction\") {\n const targetId = reactionTargetId(row), target = collectionByRawId(collections.Msg, targetId);\n if (target) {\n model = target;\n row = modelData(model);\n key = row.id ?? model?.id;\n id = rawId(key);\n }\n }\n const fromMe = Boolean(key?.fromMe ?? row.fromMe), remoteRaw = key?.remote ?? row.chatId, fromRaw = row.from, toRaw = row.to, authorRaw = row.author ?? key?.participant, chatRaw = remoteRaw ?? (fromMe ? toRaw : fromRaw), chat = await canonicalJid(chatRaw);\n if (!chat.jid || chat.jid === \"status@broadcast\" || chat.jid.endsWith(\"@newsletter\"))\n return null;\n const senderRaw = fromMe ? fromRaw : authorRaw ?? fromRaw, sender = await canonicalJid(senderRaw), participant = await canonicalJid(key?.participant ?? row.participant ?? (fromMe ? toRaw : null)), timestamp = unixSeconds(row), body = typeof row.body === \"string\" ? row.body : \"\", caption = typeof row.caption === \"string\" ? row.caption : \"\", quotedId = typeof row.quotedStanzaID === \"string\" ? row.quotedStanzaID : rawId(row.quotedMsg?.id ?? row.quotedMsgKey), type = typeof row.type === \"string\" ? row.type : \"unknown\";\n return {\n id,\n chat_jid: chat.jid,\n chat_lid: chat.lid,\n chat_name: chatName(nameLookup, widString(chatRaw)),\n sender_jid: sender.jid,\n sender_lid: sender.lid,\n push_name: contactName(nameLookup, widString(senderRaw)) ?? row.notifyName ?? null,\n participant: participant.jid,\n from_me: fromMe,\n is_group: chat.jid.endsWith(\"@g.us\"),\n timestamp,\n occurred_at: timestamp > 0 ? new Date(timestamp * 1000).toISOString() : null,\n body,\n caption,\n message_type: type,\n media_kind: type === \"ptt\" ? \"audio\" : [\"image\", \"video\", \"audio\", \"document\", \"sticker\"].includes(type) ? type : null,\n media_type: typeof row.mimetype === \"string\" ? row.mimetype : null,\n media_size: Number.isFinite(Number(row.size ?? row.fileSize)) ? Number(row.size ?? row.fileSize) : null,\n media_filename: row.filename ?? row.fileName ?? row.title ?? null,\n quoted_id: quotedId,\n is_forwarded: Boolean(row.isForwarded || Number(row.forwardingScore) > 0),\n is_starred: Boolean(row.star ?? row.isStarred),\n is_system_event: SYSTEM_TYPES.has(type),\n edited: Boolean(row.isEdited || row.editVersion || row.latestEditMsgKey),\n edit_timestamp: Number(row.editTimestamp ?? row.lastEditTimestamp) || null,\n revoked: Boolean(row.isRevoked || row.revoked || type === \"revoked\"),\n reactions: normalizeReactions(row),\n event_type: eventType\n };\n }\n function readiness() {\n if (typeof window.require !== \"function\")\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"whatsapp_runtime_unavailable\"\n };\n const collections = requireFirst([\"WAWebCollections\"]);\n if (!collections?.Msg || !collections?.Chat)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"collections_unavailable\"\n };\n const me = meUser(), qrVisible = Boolean(document.querySelector('[data-testid=\"qrcode\"], canvas[aria-label*=\"Scan\" i], [data-ref] canvas'));\n if (!me && qrVisible)\n return { ready: !1, state: \"logged_out\", reason: \"qr_code_visible\" };\n if (!me)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"authenticated_self_identity_unavailable\"\n };\n const socket = requireFirst([\"WAWebSocketModel\"])?.Socket, connection = socket ?? requireFirst([\"WAWebSocketState\", \"WAWebConn\", \"WAWebConnectionState\"]), connectionState = String(connection?.getSocketState?.() ?? connection?.state ?? connection?.socketState ?? \"\").toLowerCase();\n if (!connectionState)\n return {\n ready: !1,\n state: \"capability_unavailable\",\n reason: \"connection_state_unavailable\"\n };\n if (!/^(connected|open|ready|syncing)$/.test(connectionState))\n return {\n ready: !1,\n state: \"not_ready\",\n reason: `connection_${connectionState}`\n };\n if (socket) {\n const stream = String(socket.stream ?? \"\").toLowerCase();\n if (!stream)\n return {\n ready: !1,\n state: \"capability_unavailable\",\n reason: \"stream_state_unavailable\"\n };\n if (!/^(connected|open|ready)$/.test(stream))\n return { ready: !1, state: \"not_ready\", reason: `stream_${stream}` };\n if (socket.hasSynced === !1)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"initial_sync_incomplete\"\n };\n }\n const offlineDelivery = requireFirst([\n \"WAWebOfflineDelivery\",\n \"WAWebOfflineDeliveryState\"\n ]);\n if ((offlineDelivery?.isOfflineDeliveryComplete?.() ?? offlineDelivery?.offlineDeliveryComplete ?? offlineDelivery?.isComplete) === !1)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"offline_delivery_incomplete\"\n };\n const hydration = requireFirst([\n \"WAWebInitialSyncInfo\",\n \"WAWebHistorySync\",\n \"WAWebAppState\"\n ]);\n if ((hydration?.isInitialSyncComplete?.() ?? hydration?.initialSyncComplete ?? hydration?.isHydrated ?? !0) !== !0)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"initial_sync_incomplete\"\n };\n if (!Array.isArray(collections.Chat._models) && !Array.isArray(collections.Chat.models))\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"chat_store_placeholder\"\n };\n const signature = `${widString(me)}:${models(collections.Chat).length}:${models(collections.Msg).length}`;\n if (signature !== readinessSignature) {\n readinessSignature = signature;\n readinessStableSince = Date.now();\n return { ready: !1, state: \"hydrating\", reason: \"stores_settling\" };\n }\n if (Date.now() - readinessStableSince < 500)\n return { ready: !1, state: \"hydrating\", reason: \"stores_settling\" };\n return {\n ready: !0,\n state: \"ready\",\n message_count: models(collections.Msg).length,\n chat_count: models(collections.Chat).length\n };\n }\n function operationCapabilities() {\n const history = requireFirst([\"WAWebChatLoadMessages\"]), search = requireFirst([\n \"WAWebChatMessageSearch\",\n \"WAWebMessageSearch\",\n \"WAWebSearchMessages\"\n ]), draft = requireFirst(DRAFT_MODULES), send = requireFirst(SEND_MODULES), edit = requireFirst(EDIT_MODULES), reaction = requireFirst(REACTION_MODULES), revoke = requireFirst(REVOKE_MODULES), mediaModule = requireFirst([\"WAWebDownloadManager\"]), media = mediaModule?.downloadManager ?? mediaModule, hasFunction = (module2, names) => names.some((name) => typeof module2?.[name] === \"function\");\n return {\n collect: hasFunction(history, [\"loadEarlierMsgs\"]),\n read_messages: typeof indexedDB < \"u\" && typeof requireFirst([\"WAWebMsgKey\"])?.fromString === \"function\" && typeof requireFirst([\"WAWebCollections\"])?.Msg?.getMessagesById === \"function\",\n download_media: hasFunction(media, [\"downloadAndMaybeDecrypt\"]) || models(requireFirst([\"WAWebCollections\"])?.Msg).some((model) => typeof model?.downloadMedia === \"function\"),\n search_messages: hasFunction(search, [\"searchMessages\", \"searchMsgs\", \"search\"]) || Boolean(requireFirst([\"WAWebCollections\"])?.Msg),\n draft_message: hasFunction(draft, [\n \"setDraft\",\n \"setChatDraft\",\n \"saveDraft\"\n ]),\n send_message: hasFunction(send, [\n \"sendTextMsgToChat\",\n \"sendMessage\",\n \"addAndSendTextMsg\"\n ]),\n edit_message: hasFunction(edit, [\"sendMessageEdit\", \"editMessage\"]),\n react_message: hasFunction(reaction, [\n \"sendReactionToMsg\",\n \"sendReaction\"\n ]),\n revoke_message: hasFunction(revoke, [\"sendRevokeMsgs\", \"revokeMessage\"])\n };\n }\n function oldestMessage(chat) {\n let oldest = null;\n for (const message of models(modelData(chat).msgs ?? chat?.msgs)) {\n const row = modelData(message), timestamp = unixSeconds(row), id = rawId(row.id ?? message?.id);\n if (!id)\n continue;\n if (!oldest || timestamp < oldest.timestamp || timestamp === oldest.timestamp && id < oldest.id)\n oldest = { timestamp, id };\n }\n return oldest;\n }\n function chatHasEarlier(chat) {\n const row = modelData(chat), state = row.msgs?.msgLoadState ?? chat?.msgs?.msgLoadState ?? row.msgLoadState ?? {};\n if (state.noEarlierMsgs === !0 || state.hasEarlierMsgs === !1)\n return !1;\n if (row.hasEarlierMsgs === !1)\n return !1;\n return !0;\n }\n async function loadEarlier(chat, limit, deadline) {\n const loader = requireFirst([\"WAWebChatLoadMessages\"]);\n if (typeof loader?.loadEarlierMsgs !== \"function\")\n return {\n available: !1,\n reason: \"WAWebChatLoadMessages.loadEarlierMsgs unavailable\",\n loads: 0\n };\n let loads = 0;\n const beforeIds = new Set(models(modelData(chat).msgs ?? chat?.msgs).map((message) => rawId(modelData(message).id ?? message?.id)).filter(Boolean));\n let previous = oldestMessage(chat), madeProgress = !1;\n while (loads < limit && chatHasEarlier(chat)) {\n if (deadline && Date.now() >= deadline)\n throw Error(\"history deadline budget exhausted\");\n await loader.loadEarlierMsgs({ chat, msgCollection: chat.msgs });\n loads += 1;\n const next = oldestMessage(chat);\n if (!next || previous && next.id === previous.id && next.timestamp === previous.timestamp)\n break;\n madeProgress = !0;\n previous = next;\n }\n let hasMore = chatHasEarlier(chat);\n const loadedIds = () => models(modelData(chat).msgs ?? chat?.msgs).map((message) => rawId(modelData(message).id ?? message?.id)).filter((id) => id && !beforeIds.has(id));\n if (hasMore && !madeProgress)\n return {\n available: !0,\n loads,\n has_more: !0,\n loaded_ids: loadedIds(),\n frontier_advanced: !1,\n error: \"WhatsApp history loader made no progress\"\n };\n if (hasMore) {\n const phone = loader.loadEarlierMsgsFromPhone ?? loader.requestEarlierMsgsFromPhone ?? loader.loadEarlierMsgsFromServer, state = modelData(chat).msgs?.msgLoadState ?? chat?.msgs?.msgLoadState ?? {}, wantsPhone = state.canRequestFromPhone === !0 || state.hasMoreFromPhone === !0;\n if (wantsPhone && typeof phone !== \"function\")\n return {\n available: !0,\n loads,\n has_more: !0,\n loaded_ids: loadedIds(),\n frontier_advanced: !1,\n error: \"phone-assisted WhatsApp history is advertised but its loader is unavailable\"\n };\n if (typeof phone === \"function\" && wantsPhone)\n try {\n await phone.call(loader, { chat, msgCollection: chat.msgs });\n hasMore = chatHasEarlier(chat);\n } catch (error) {\n return {\n available: !0,\n loads,\n has_more: !0,\n loaded_ids: loadedIds(),\n frontier_advanced: !1,\n error: `phone-assisted history failed: ${String(error)}`\n };\n }\n }\n return {\n available: !0,\n loads,\n has_more: hasMore,\n loaded_ids: loadedIds(),\n frontier_advanced: !0\n };\n }\n function uniqueMessageModels(collections) {\n const byId = new Map;\n for (const message of models(collections.Msg)) {\n const id = rawId(modelData(message).id ?? message?.id);\n if (id)\n byId.set(id, message);\n }\n for (const chat of models(collections.Chat))\n for (const message of models(modelData(chat).msgs ?? chat?.msgs)) {\n const id = rawId(modelData(message).id ?? message?.id);\n if (id)\n byId.set(id, message);\n }\n return [...byId.values()];\n }\n async function collect(request) {\n const status = readiness();\n if (!status.ready)\n return { ok: !1, error: status };\n const collections = requireFirst([\"WAWebCollections\"]), chatFilter = [\"all\", \"individual\", \"group\"].includes(request.chat_filter) ? request.chat_filter : \"all\", chatRows = [];\n for (const chat of models(collections.Chat)) {\n const raw = widString(modelData(chat).id ?? chat?.id), jid = (await canonicalJid(raw)).jid;\n if (!jid || jid === \"status@broadcast\" || jid.endsWith(\"@newsletter\") || chatFilter === \"group\" && !jid.endsWith(\"@g.us\") || chatFilter === \"individual\" && jid.endsWith(\"@g.us\"))\n continue;\n chatRows.push({ chat, jid });\n }\n chatRows.sort((a, b) => a.jid.localeCompare(b.jid));\n const backfill = request.backfill ?? { complete: !1, chats: {} }, updates = {};\n let cursor = backfill.cursor_chat_jid ?? null;\n const loadedByChat = new Map, backfillMessageIds = new Set, eligible = request.backfill_disabled ? [] : chatRows.filter((entry) => backfill.chats?.[entry.jid]?.has_more !== !1);\n if (eligible.length > 0) {\n let start = cursor ? eligible.findIndex((entry) => entry.jid > cursor) : 0;\n if (start < 0)\n start = 0;\n const selected = [...eligible.slice(start), ...eligible.slice(0, start)].slice(0, Math.max(1, Number(request.max_chats) || 1)), budgetMs = Number(request.budget_ms), historyDeadline = Number.isFinite(budgetMs) && budgetMs > 0 ? Date.now() + budgetMs : null;\n for (const entry of selected) {\n if (historyDeadline && Date.now() >= historyDeadline)\n break;\n try {\n const loaded = await loadEarlier(entry.chat, Math.max(1, Number(request.max_loads_per_chat) || 1), historyDeadline);\n if (!loaded.available)\n return {\n ok: !1,\n error: {\n state: \"capability_unavailable\",\n reason: loaded.reason\n }\n };\n const oldest = oldestMessage(entry.chat);\n for (const id of loaded.loaded_ids)\n backfillMessageIds.add(id);\n loadedByChat.set(entry.jid, loaded.loaded_ids);\n if (loaded.frontier_advanced === !1) {\n updates[entry.jid] = {\n ...backfill.chats?.[entry.jid] ?? {},\n error: loaded.error,\n has_more: !0,\n loads: loaded.loads\n };\n continue;\n }\n updates[entry.jid] = {\n oldest_timestamp: oldest?.timestamp ?? null,\n oldest_id: oldest?.id ?? null,\n has_more: loaded.has_more,\n loads: loaded.loads\n };\n cursor = entry.jid;\n } catch (error) {\n if (/unavailable/i.test(String(error)))\n return {\n ok: !1,\n error: {\n state: \"capability_unavailable\",\n reason: String(error)\n }\n };\n updates[entry.jid] = {\n ...backfill.chats?.[entry.jid] ?? {},\n error: String(error),\n has_more: !0\n };\n }\n }\n }\n const minimum = Number.isFinite(Number(request.minimum_timestamp)) ? Number(request.minimum_timestamp) : null, recent = Number.isFinite(Number(request.recent_since)) ? Number(request.recent_since) : null, dirtyRanges = Array.isArray(request.dirty_ranges) ? request.dirty_ranges : [], dirtyByMessageId = new Map(dirtyRanges.filter((marker) => marker?.message_id).map((marker) => [marker.message_id, marker])), normalized = [], quarantined = [], names = nameIndex(collections);\n for (const model of uniqueMessageModels(collections)) {\n const message = await normalizeMessage(model, \"reconcile\", collections, names);\n if (!message)\n continue;\n if (message.timestamp <= 0) {\n quarantined.push({\n key: `${message.chat_jid}:${message.id}`,\n message_id: message.id,\n chat_jid: message.chat_jid,\n reason: \"missing_stable_timestamp\"\n });\n continue;\n }\n if (chatFilter === \"group\" && !message.is_group)\n continue;\n if (chatFilter === \"individual\" && message.is_group)\n continue;\n if (minimum != null && message.timestamp < minimum)\n continue;\n if (recent != null && message.timestamp < recent && !backfillMessageIds.has(message.id) && !dirtyByMessageId.has(message.id))\n continue;\n normalized.push(message);\n }\n normalized.sort((a, b) => a.timestamp - b.timestamp || a.id.localeCompare(b.id));\n const maxMessages = Math.max(1, Math.min(Number(request.max_messages) || 1000, 2000)), byId = new Map(normalized.map((message) => [message.id, message])), historyPages = [];\n for (const [chatJid, ids] of loadedByChat)\n historyPages.push({\n chat_jid: chatJid,\n ...updates[chatJid] ?? {},\n messages: ids.map((id) => byId.get(id)).filter(Boolean)\n });\n const messages = normalized.filter((message) => !backfillMessageIds.has(message.id)).slice(-maxMessages).sort((a, b) => a.timestamp - b.timestamp || a.id.localeCompare(b.id)), mergedChats = { ...backfill.chats ?? {}, ...updates };\n return {\n ok: !0,\n status,\n messages,\n history_pages: historyPages,\n quarantined,\n dirty_reconciled: normalized.filter((message) => dirtyByMessageId.has(message.id)).map((message) => ({\n key: dirtyByMessageId.get(message.id).key,\n message_id: message.id\n })),\n backfill: {\n complete: request.backfill_disabled === !0 || chatRows.length > 0 && chatRows.every((entry) => mergedChats[entry.jid]?.has_more === !1),\n cursor_chat_jid: cursor,\n inventory: chatRows.map((entry) => entry.jid),\n chats: updates\n }\n };\n }\n async function resolveChat(collections, input) {\n if (input?.self_chat === !0) {\n const me = meUser(), selfJid = (await canonicalJid(me)).jid;\n let self = null;\n for (const chat of models(collections.Chat))\n if ((await canonicalJid(modelData(chat).id ?? chat?.id)).jid === selfJid) {\n self = chat;\n break;\n }\n if (!self)\n throw Error(\"WhatsApp self chat is not loaded\");\n return self;\n }\n const requestedJidRaw = typeof input?.chat_jid === \"string\" ? input.chat_jid.trim().toLowerCase() : null, requestedJid = requestedJidRaw ? (await canonicalJid(requestedJidRaw)).jid : null, requestedName = typeof input?.chat_name === \"string\" ? input.chat_name.trim().toLowerCase() : null, matches = [];\n for (const chat of models(collections.Chat)) {\n const row = modelData(chat), jid = (await canonicalJid(row.id ?? chat?.id)).jid, name = String(row.name ?? row.formattedTitle ?? row.contact?.name ?? \"\").trim().toLowerCase();\n if (requestedJid ? jid === requestedJid : requestedName && name === requestedName)\n matches.push(chat);\n }\n if (matches.length === 0)\n throw Error(\"WhatsApp chat not found; pass an exact canonical chat_jid or exact chat_name\");\n if (matches.length > 1)\n throw Error(\"WhatsApp chat name is ambiguous; pass chat_jid\");\n return matches[0];\n }\n async function waitForPostState(check, label, timeoutMs = 2000) {\n const deadline = Date.now() + timeoutMs;\n do {\n if (check())\n return;\n await new Promise((resolve) => setTimeout(resolve, 50));\n } while (Date.now() < deadline);\n throw Error(`WhatsApp did not confirm ${label}`);\n }\n async function readMessages(input = {}) {\n const query = String(input.query ?? \"\").trim(), chatFilter = input.chat_filter ?? \"all\", limit = Math.min(100, Math.max(1, Math.trunc(Number(input.limit) || 50)));\n let before = null;\n if (input.cursor) {\n const cursor = JSON.parse(input.cursor);\n if (cursor.v !== 1 || !Number.isSafeInteger(cursor.before) || cursor.before <= 0 || cursor.query !== query || cursor.chat_filter !== chatFilter)\n throw Error(\"Invalid WhatsApp source cursor or changed query scope\");\n before = cursor.before;\n }\n const keyModule = requireFirst([\"WAWebMsgKey\"]), exactId = query.startsWith(\"id:\") ? query.slice(3) : null, database = await new Promise((resolve, reject) => {\n const request = indexedDB.open(\"model-storage\");\n request.onupgradeneeded = () => {\n request.transaction.abort();\n reject(Error(\"WhatsApp source history database is unavailable\"));\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(Error(\"WhatsApp source history database is blocked\"));\n request.onsuccess = () => resolve(request.result);\n });\n let sourceRows;\n try {\n sourceRows = await new Promise((resolve, reject) => {\n const transaction = database.transaction(\"message\", \"readonly\");\n transaction.onabort = () => reject(transaction.error ?? Error(\"WhatsApp source read aborted\"));\n const index = transaction.objectStore(\"message\").index(\"rowId\"), range = before === null ? null : IDBKeyRange.upperBound(before, !0), request = index.openCursor(range, \"prev\"), rows = [];\n request.onerror = () => reject(request.error);\n request.onsuccess = () => {\n const cursor = request.result;\n if (!cursor) {\n resolve(rows);\n return;\n }\n if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== \"string\") {\n reject(Error(\"WhatsApp source history has an unsupported key layout\"));\n return;\n }\n if (exactId !== null) {\n if (keyModule.fromString(cursor.value.id).id !== exactId) {\n cursor.continue();\n return;\n }\n resolve([{ position: cursor.key, id: cursor.value.id }]);\n return;\n }\n rows.push({ position: cursor.key, id: cursor.value.id });\n if (rows.length > limit)\n resolve(rows);\n else\n cursor.continue();\n };\n });\n } finally {\n database.close();\n }\n const hasMore = sourceRows.length > limit, page = sourceRows.slice(0, limit), collections = requireFirst([\"WAWebCollections\"]), selected = page.filter((row) => {\n const key = keyModule.fromString(row.id);\n if (exactId !== null && key.id !== exactId)\n return !1;\n const remote = widString(key.remote);\n if (remote === \"status@broadcast\" || remote.endsWith(\"@newsletter\"))\n return !1;\n const isGroup = remote.endsWith(\"@g.us\");\n return !(chatFilter === \"group\" && !isGroup) && !(chatFilter === \"individual\" && isGroup);\n }), results = [];\n if (selected.length) {\n const loaded = await collections.Msg.getMessagesById(selected.map((row) => row.id));\n if (loaded?.canceled || !Array.isArray(loaded?.messages))\n throw Error(\"Source message loading was canceled or unavailable\");\n const byKey = new Map(loaded.messages.map((model) => [String(model.id ?? modelData(model).id), model])), names = nameIndex(collections);\n for (const row of selected) {\n const model = byKey.get(row.id);\n if (!model)\n throw Error(\"Source message could not be loaded; retry the read\");\n const message = await normalizeMessage(model, \"snapshot\", collections, names);\n if (!message || message.timestamp <= 0)\n continue;\n if (exactId === null && query && !`${message.body}\n${message.caption}`.toLowerCase().includes(query.toLowerCase()))\n continue;\n results.push(message);\n }\n }\n return {\n results,\n hasMore,\n ...hasMore ? { nextCursor: JSON.stringify({ v: 1, before: page[page.length - 1].position, query, chat_filter: chatFilter }) } : {}\n };\n }\n async function searchMessages(input) {\n const collections = requireFirst([\"WAWebCollections\"]), query = String(input?.query ?? \"\").trim();\n if (!query)\n throw Error(\"query is required\");\n const offset = Math.max(0, Number(input?.offset) || 0), requestedLimit = Math.max(1, Math.min(Number(input?.limit) || 50, 100));\n if (offset >= 100)\n throw Error(\"WhatsApp source search supports only the first 100 matches\");\n const limit = Math.min(requestedLimit, 100 - offset), searchSourceLimit = 100, chatFilter = [\"all\", \"individual\", \"group\"].includes(input?.chat_filter) ? input.chat_filter : \"all\", chat = input?.chat_jid || input?.chat_name || input?.self_chat === !0 ? await resolveChat(collections, input) : null;\n let scopedChats = chat ? [chat] : void 0;\n if (!chat && chatFilter !== \"all\") {\n scopedChats = [];\n for (const candidate of models(collections.Chat)) {\n const jid = (await canonicalJid(modelData(candidate).id ?? candidate?.id)).jid;\n if (!jid || jid === \"status@broadcast\" || jid.endsWith(\"@newsletter\"))\n continue;\n const isGroup = jid.endsWith(\"@g.us\");\n if (chatFilter === \"group\" ? isGroup : !isGroup)\n scopedChats.push(candidate);\n }\n }\n const search = requireFirst([\n \"WAWebChatMessageSearch\",\n \"WAWebMessageSearch\",\n \"WAWebSearchMessages\"\n ]);\n let found = null;\n for (const fn of [\n search?.searchMessages,\n search?.searchMsgs,\n search?.search\n ]) {\n if (typeof fn !== \"function\")\n continue;\n try {\n found = await fn.call(search, query, scopedChats, searchSourceLimit);\n break;\n } catch {}\n }\n let source = \"whatsapp_fts\", candidates = Array.isArray(found) ? found : models(found?.messages ?? found);\n if (!found) {\n source = \"loaded_model_fallback\";\n const needle = query.toLowerCase();\n candidates = uniqueMessageModels(collections).filter((model) => {\n const row = modelData(model);\n if (chat) {\n const chatId = widString(modelData(chat).id ?? chat?.id);\n if (widString(row.id?.remote ?? row.chatId) !== chatId)\n return !1;\n }\n return String(row.body ?? row.caption ?? \"\").toLowerCase().includes(needle);\n });\n }\n const normalized = [], names = nameIndex(collections);\n for (const candidate of candidates) {\n const model = candidate?.msg ?? candidate?.message ?? candidate, message = await normalizeMessage(model, \"search\", collections, names);\n if (!message || Number(message.timestamp) <= 0)\n continue;\n if (chatFilter === \"group\" && !message.is_group)\n continue;\n if (chatFilter === \"individual\" && message.is_group)\n continue;\n normalized.push(message);\n if (normalized.length >= searchSourceLimit)\n break;\n }\n return {\n source,\n results: normalized.slice(offset, offset + limit),\n hasMore: offset + limit < normalized.length\n };\n }\n async function draftMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), chat = await resolveChat(collections, input), text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const draft = {\n body: text,\n timestamp: Math.floor(Date.now() / 1000),\n type: \"chat\",\n mentionedJidList: [],\n quotedMsg: null\n }, module2 = requireFirst(DRAFT_MODULES);\n let applied = !1;\n for (const fn of [\n module2?.setDraft,\n module2?.setChatDraft,\n module2?.saveDraft\n ]) {\n if (typeof fn !== \"function\")\n continue;\n try {\n await fn.call(module2, chat, draft);\n applied = !0;\n break;\n } catch {\n try {\n await fn.call(module2, draft, chat);\n applied = !0;\n break;\n } catch {}\n }\n }\n if (!applied && typeof chat?.setDraft === \"function\") {\n await chat.setDraft(draft);\n applied = !0;\n }\n if (!applied)\n throw Error(\"WhatsApp draft capability is unavailable in this web build\");\n const stored = modelData(chat).draft ?? chat.get?.(\"draft\") ?? null;\n if (!stored || typeof stored !== \"object\" || stored.body !== text)\n throw Error(\"WhatsApp rejected the persistent draft shape\");\n return {\n drafted: !0,\n sent: !1,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n draft\n };\n }\n async function sendMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), chat = await resolveChat(collections, input), text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const module2 = requireFirst(SEND_MODULES);\n if (typeof module2?.createTextMsgData === \"function\" && typeof module2?.addAndSendTextMsg === \"function\") {\n const data = await module2.createTextMsgData(chat, text), plannedId = rawId(data?.id);\n if (!plannedId)\n throw Error(\"WhatsApp did not assign an id to the outgoing message\");\n await module2.addAndSendTextMsg(chat, data);\n return {\n sent: !0,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n message_id: plannedId\n };\n }\n const fn = module2?.sendTextMsgToChat ?? module2?.sendMessage ?? chat?.sendMessage;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp send capability is unavailable in this web build\");\n const result = fn === chat?.sendMessage ? await fn.call(chat, text) : await fn.call(module2, chat, text), messageId = rawId(modelData(result).id ?? result?.id);\n if (!messageId)\n throw Error(\"WhatsApp send acknowledgment has no raw message ID\");\n return {\n sent: !0,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n message_id: messageId\n };\n }\n function messageActionAllowed(message, predicateNames, legacyFlags) {\n const row = modelData(message);\n for (const flag of legacyFlags)\n if (row[flag] === !0)\n return !0;\n const capability = requireFirst([\"WAWebMsgActionCapability\"]);\n for (const name of predicateNames) {\n if (typeof capability?.[name] !== \"function\")\n continue;\n try {\n if (capability[name](message) === !0)\n return !0;\n } catch {}\n }\n return !1;\n }\n function resolveMessage(collections, id) {\n const raw = String(id ?? \"\").trim();\n if (!raw)\n throw Error(\"message_id is required\");\n const message = collectionByRawId(collections.Msg, raw);\n if (!message)\n throw Error(`WhatsApp message ${raw} is not loaded; sync or search it first`);\n return message;\n }\n async function editMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), before = modelData(message);\n if (!(before.id?.fromMe ?? before.fromMe))\n throw Error(\"WhatsApp only permits editing outgoing messages\");\n if (!messageActionAllowed(message, [\"canEditText\", \"canEditCaption\", \"canEnterEditingFlow\"], [\"canEdit\", \"isEditable\"]))\n throw Error(\"WhatsApp did not affirm that this message is currently editable\");\n const text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const module2 = requireFirst(EDIT_MODULES), fn = module2?.sendMessageEdit ?? module2?.editMessage ?? message?.edit;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp edit capability is unavailable in this web build\");\n await (fn === message?.edit ? fn.call(message, text) : fn.call(module2, message, text, {}));\n await waitForPostState(() => {\n const row = modelData(message);\n return row.body === text && Boolean(row.isEdited || row.editVersion || row.latestEditMsgKey);\n }, \"message edit\");\n return {\n edited: !0,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function reactMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), emoji = input?.remove ? \"\" : String(input?.emoji ?? \"\");\n if (!input?.remove && !emoji)\n throw Error(\"emoji is required unless remove=true\");\n const module2 = requireFirst(REACTION_MODULES), fn = module2?.sendReactionToMsg ?? module2?.sendReaction ?? message?.react;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp reaction capability is unavailable in this web build\");\n await (fn === message?.react ? fn.call(message, emoji) : fn.call(module2, message, emoji));\n await waitForPostState(() => {\n const row = modelData(message), reactions = normalizeReactions(row);\n if (reactions.length > 0)\n return input?.remove ? !reactions.some((reaction) => reaction.from_me) : reactions.some((reaction) => reaction.from_me && reaction.emoji === emoji);\n return input?.remove ? !0 : row.hasReaction === !0;\n }, \"reaction state\");\n return {\n reacted: !0,\n confirmed: input?.remove ? normalizeReactions(modelData(message)).length > 0 : !0,\n removed: Boolean(input?.remove),\n emoji: emoji || null,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function revokeMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), before = modelData(message);\n if (!(before.id?.fromMe ?? before.fromMe))\n throw Error(\"WhatsApp only permits revoking outgoing messages\");\n if (!messageActionAllowed(message, [\"canSenderRevokeMsg\", \"canAdminRevokeMsg\"], [\"canRevoke\", \"isRevokable\"]))\n throw Error(\"WhatsApp did not affirm that this message is currently revokable\");\n const module2 = requireFirst(REVOKE_MODULES), fn = module2?.sendRevokeMsgs ?? module2?.sendRevoke ?? module2?.revokeMessage ?? message?.sendRevoke ?? message?.revoke;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp revoke capability is unavailable in this web build\");\n if (fn === message?.sendRevoke || fn === message?.revoke)\n await fn.call(message);\n else\n await fn.call(module2, [message], modelData(message).id?.remote);\n await waitForPostState(() => {\n const row = modelData(message);\n return Boolean(row.isRevoked || row.revoked || row.type === \"revoked\");\n }, \"message revoke\");\n return {\n revoked: !0,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function blobFromMedia(model) {\n const row = modelData(model);\n let result = null;\n if (typeof model?.downloadMedia === \"function\")\n result = await model.downloadMedia({\n downloadEvenIfExpensive: !0,\n rmrReason: 1\n });\n result = result ?? modelData(model).mediaData?.mediaBlob ?? model?.mediaData?.mediaBlob ?? row.mediaBlob ?? null;\n if (!result) {\n const managerModule = requireFirst([\"WAWebDownloadManager\"]), manager = managerModule?.downloadManager ?? managerModule;\n if (typeof manager?.downloadAndMaybeDecrypt === \"function\")\n result = await manager.downloadAndMaybeDecrypt({\n directPath: row.directPath,\n encFilehash: row.encFilehash,\n filehash: row.filehash,\n mediaKey: row.mediaKey,\n mediaKeyTimestamp: row.mediaKeyTimestamp,\n type: row.type,\n mimetype: row.mimetype,\n downloadOrigin: null,\n partialVideoOpts: null,\n downloadQpl: new Proxy({}, {\n get: () => () => {}\n }),\n signal: new AbortController().signal\n });\n }\n if (result === \"NEED_POKE\" || result?.status === \"NEED_POKE\")\n return { status: \"NEED_POKE\" };\n const candidate = result?.blob ?? result?.mediaBlob ?? result;\n if (candidate instanceof Blob)\n return { status: \"downloaded\", blob: candidate };\n if (candidate instanceof ArrayBuffer || ArrayBuffer.isView(candidate))\n return {\n status: \"downloaded\",\n blob: new Blob([candidate], {\n type: row.mimetype || \"application/octet-stream\"\n })\n };\n if (candidate?.getData) {\n const data = await candidate.getData();\n if (data instanceof Blob)\n return { status: \"downloaded\", blob: data };\n if (data instanceof ArrayBuffer || ArrayBuffer.isView(data))\n return {\n status: \"downloaded\",\n blob: new Blob([data], { type: row.mimetype })\n };\n }\n return { status: row.directPath ? \"unavailable\" : \"expired\" };\n }\n function bytesToBase64(bytes) {\n let binary = \"\";\n const chunk = 32768;\n for (let i = 0;i < bytes.length; i += chunk)\n binary += String.fromCharCode(...bytes.subarray(i, i + chunk));\n return btoa(binary);\n }\n async function downloadMedia(input) {\n const collections = requireFirst([\"WAWebCollections\"]), model = resolveMessage(collections, input?.message_id), row = modelData(model);\n if (row.isViewOnce || row.viewOnce || row.type === \"view_once\")\n return { status: \"view_once\" };\n const limit = Math.max(1, Number(input?.max_bytes) || 1), size = Number(row.size ?? row.fileSize ?? 0);\n if (size > limit)\n return { status: \"too_large\", size_bytes: size };\n if ((row.type === \"video\" || String(row.mimetype ?? \"\").startsWith(\"video/\")) && size <= 0)\n return { status: \"metadata_only\", retryable: !0, size_bytes: null };\n const budgetMs = Math.max(0, Number(input?.timeout_ms) || 0);\n let downloaded, budgetTimer = null;\n try {\n downloaded = budgetMs ? await Promise.race([\n blobFromMedia(model),\n new Promise((_, reject) => {\n budgetTimer = setTimeout(() => reject(Object.assign(Error(\"media download exceeded its budget\"), { state: \"timeout_retryable\" })), budgetMs);\n })\n ]) : await blobFromMedia(model);\n } catch (error) {\n const detail = String(error), reported = String(error?.state ?? error?.status ?? \"\"), explicit = [\n \"NEED_POKE\",\n \"awaiting_primary_device\",\n \"view_once\",\n \"expired\",\n \"too_large\",\n \"timeout_retryable\",\n \"metadata_only\",\n \"unavailable\"\n ].find((state) => reported === state || detail.toLowerCase().includes(state.toLowerCase()));\n return {\n status: explicit ?? \"unavailable\",\n retryable: [\n \"NEED_POKE\",\n \"awaiting_primary_device\",\n \"timeout_retryable\",\n \"metadata_only\",\n \"unavailable\"\n ].includes(explicit ?? \"unavailable\"),\n detail: detail.slice(0, 200)\n };\n } finally {\n if (budgetTimer !== null)\n clearTimeout(budgetTimer);\n }\n if (!downloaded.blob)\n return downloaded;\n if (downloaded.blob.size > limit)\n return { status: \"too_large\", size_bytes: downloaded.blob.size };\n const bytes = new Uint8Array(await downloaded.blob.arrayBuffer());\n if (bytes.length === 0)\n return { status: \"unavailable\", detail: \"empty\" };\n const mime = downloaded.blob.type || row.mimetype || \"application/octet-stream\";\n return {\n status: \"downloaded\",\n attachment: {\n kind: mime.startsWith(\"audio/\") ? \"audio\" : mime.startsWith(\"image/\") ? \"image\" : \"file\",\n filename: row.filename ?? row.fileName ?? `whatsapp-${rawId(row.id ?? model?.id)}`,\n mime_type: mime,\n data: bytesToBase64(bytes),\n size_bytes: bytes.length\n }\n };\n }\n async function invoke(request) {\n try {\n if (Number(request?.adapter_version) !== 22)\n return {\n ok: !1,\n error: {\n state: \"adapter_mismatch\",\n reason: \"expected 22\"\n }\n };\n if (request.op === \"account_identity\") {\n const accountId = widString(meUser());\n return accountId ? { accountId } : null;\n }\n if (request.op === \"probe\") {\n const status = readiness();\n return status.ready ? { ok: !0, status, capabilities: operationCapabilities() } : { ok: !1, error: status };\n }\n if (request.op === \"listen\")\n return listen(request);\n if (request.op === \"publish_changes\")\n return await publishChanges(request);\n if (request.op === \"observe_messages\")\n return { ok: !0, ...await observeMessages(request.input) };\n if (operationCapabilities()[request.op] !== !0)\n return {\n ok: !1,\n error: {\n state: \"capability_unavailable\",\n reason: `${request.op} is unavailable in this WhatsApp Web build`\n }\n };\n if (request.op === \"collect\")\n return await collect(request);\n if (request.op === \"read_messages\")\n return { ok: !0, ...await readMessages(request.input) };\n if (request.op === \"download_media\")\n return { ok: !0, ...await downloadMedia(request) };\n if (request.op === \"search_messages\")\n return { ok: !0, ...await searchMessages(request.input) };\n if (request.op === \"draft_message\")\n return { ok: !0, ...await draftMessage(request.input) };\n if (request.op === \"send_message\")\n return { ok: !0, ...await sendMessage(request.input) };\n if (request.op === \"edit_message\")\n return { ok: !0, ...await editMessage(request.input) };\n if (request.op === \"react_message\")\n return { ok: !0, ...await reactMessage(request.input) };\n if (request.op === \"revoke_message\")\n return { ok: !0, ...await revokeMessage(request.input) };\n return {\n ok: !1,\n error: { state: \"unsupported_operation\", reason: String(request?.op) }\n };\n } catch (error) {\n return {\n ok: !1,\n error: {\n state: \"operation_failed\",\n reason: error instanceof Error ? error.message : String(error)\n }\n };\n }\n }\n globalThis.__owlettoWhatsAppAdapterV1 = { version: 22, invoke, detach };\n })();\n for (let i = 0; i < 40; i++) {\n const identity = await globalThis.__owlettoWhatsAppAdapterV1.invoke({ op: \"account_identity\", adapter_version: 22 });\n if (identity?.accountId) return identity;\n await new Promise(resolve => setTimeout(resolve, 250));\n }\n return null;\n })()"
21544
+ "expression": "(async () => {\n (function whatsAppWebAdapterProgram() {\n const SYSTEM_TYPES = new Set([\n \"gp2\",\n \"notification_template\",\n \"e2e_notification\"\n ]);\n let readinessSignature = null, readinessStableSince = 0;\n const existing = globalThis.__owlettoWhatsAppAdapterV1;\n if (existing?.version === 26)\n return;\n existing?.detach?.();\n const listeners = new Map;\n function detach(bindingId) {\n const selected = bindingId ? [listeners.get(bindingId)] : [...listeners.values()];\n for (const state of selected) {\n if (!state)\n continue;\n state.collection.off(\"add\", state.onAdd);\n state.collection.off(\"change\", state.onChange);\n window.removeEventListener(\"message\", state.onReply);\n listeners.delete(state.id);\n }\n }\n function listen(request) {\n const collection = requireFirst([\"WAWebCollections\"])?.Msg;\n if (typeof collection?.on !== \"function\" || typeof collection?.off !== \"function\")\n throw Error(\"WhatsApp message observation is unavailable in this build\");\n if (!request.bridge_id || !request.token)\n throw Error(\"A feed bridge is required\");\n const post = (state2, entry) => window.postMessage({\n type: \"lobu-feed-record\",\n token: state2.token,\n sequence: entry.sequence,\n record: entry.record\n }, location.origin), reportError = (state2, message, sequence = ++state2.sequence) => {\n state2.error = message;\n post(state2, {\n sequence,\n record: {\n id: \"whatsapp-web:source-observation-error\",\n source_error: message\n }\n });\n }, resident = listeners.get(request.bridge_id), previous = resident?.request.chat_filter === request.chat_filter && resident?.request.minimum_timestamp === request.minimum_timestamp ? resident : null;\n detach(request.bridge_id);\n const state = {\n ...previous ?? {\n id: request.bridge_id,\n collection,\n sequence: 0,\n pending: new Map,\n fingerprints: new Map,\n pendingBytes: 0,\n fingerprintBytes: 0,\n error: null\n },\n collection,\n error: null\n };\n state.token = request.token;\n state.request = request;\n state.post = (entry) => post(state, entry);\n const observe = (model) => {\n if (state.error)\n return;\n const sequence = ++state.sequence;\n new Promise((resolve) => resolve(messageReference(model))).then((record) => {\n if (listeners.get(state.id) !== state || !record || record.timestamp <= 0)\n return;\n if (state.request.chat_filter === \"group\" && !record.is_group)\n return;\n if (state.request.chat_filter === \"individual\" && record.is_group)\n return;\n if (state.request.minimum_timestamp != null && record.timestamp < state.request.minimum_timestamp)\n return;\n record = {\n id: record.id,\n events: [{\n id: record.id,\n event_type: \"message.created\",\n resource_ref: record.id,\n resource_type: \"message\",\n occurred_at: new Date(record.timestamp * 1000).toISOString()\n }]\n };\n const previous2 = state.pending.get(record.id), seen = state.fingerprints.get(record.id);\n if (seen && seen.sequence >= sequence)\n return;\n const fingerprint = JSON.stringify(record);\n if (seen?.fingerprint === fingerprint) {\n seen.sequence = sequence;\n return;\n }\n const bytes = new TextEncoder().encode(fingerprint).length;\n if (bytes > 131072 || state.pendingBytes - (previous2?.bytes ?? 0) + bytes > 16777216 || state.pending.size >= 1e4 && !previous2) {\n reportError(state, \"WhatsApp page observation buffer overflowed; recovery is required\", sequence);\n return;\n }\n const entry = { sequence, record, bytes };\n state.pendingBytes += bytes - (previous2?.bytes ?? 0);\n state.pending.set(record.id, entry);\n state.fingerprintBytes += bytes - (seen?.bytes ?? 0);\n state.fingerprints.delete(record.id);\n state.fingerprints.set(record.id, { fingerprint, sequence, bytes });\n while (state.fingerprints.size > 1e4 || state.fingerprintBytes > 16777216) {\n const oldest = state.fingerprints.keys().next().value;\n state.fingerprintBytes -= state.fingerprints.get(oldest).bytes;\n state.fingerprints.delete(oldest);\n }\n post(state, entry);\n }).catch(() => {\n if (listeners.get(state.id) !== state)\n return;\n reportError(state, \"WhatsApp source observation failed; recovery is required\", sequence);\n });\n };\n state.onAdd = (model) => observe(model);\n state.onChange = (model) => observe(model);\n state.onReply = (event) => {\n if (event.source !== window || event.origin !== location.origin || event.data?.token !== state.token)\n return;\n if (event.data.type === \"lobu-feed-record:stop\") {\n detach(state.id);\n return;\n }\n if (event.data.type !== \"lobu-feed-record:ack\")\n return;\n for (const [id, entry] of state.pending) {\n if (entry.sequence !== event.data.sequence)\n continue;\n if (event.data.ok) {\n state.pendingBytes -= entry.bytes;\n state.pending.delete(id);\n entry.resolve?.();\n } else\n entry.reject?.(Error(\"Browser rejected the source reference batch\"));\n break;\n }\n };\n listeners.set(state.id, state);\n try {\n collection.on(\"add\", state.onAdd);\n collection.on(\"change\", state.onChange);\n window.addEventListener(\"message\", state.onReply);\n } catch (error) {\n reportError(state, \"WhatsApp source observation failed; recovery is required\");\n throw error;\n }\n if (previous?.error)\n post(state, {\n sequence: ++state.sequence,\n record: { id: \"whatsapp-web:source-observation-error\", source_error: previous.error }\n });\n for (const entry of state.pending.values())\n post(state, entry);\n return { ok: !0, listening: !0 };\n }\n async function publishChanges(request) {\n const state = listeners.get(request.bridge_id);\n if (!state || state.token !== request.token)\n throw Error(\"Source listener is unavailable\");\n const record = request.batch, bytes = new TextEncoder().encode(JSON.stringify(record)).length, previous = state.pending.get(record.id);\n if (bytes > 131072 || state.pendingBytes - (previous?.bytes ?? 0) + bytes > 16777216 || state.pending.size >= 1e4 && !previous)\n throw Error(\"Source replay buffer is full\");\n await new Promise((resolve, reject) => {\n const timer = setTimeout(() => reject(Error(\"Source replay was not accepted by the browser\")), 1e4), entry = {\n record,\n bytes,\n sequence: ++state.sequence,\n resolve: () => {\n clearTimeout(timer);\n resolve();\n },\n reject: (error) => {\n clearTimeout(timer);\n reject(error);\n }\n };\n state.pendingBytes += bytes - (previous?.bytes ?? 0);\n state.pending.set(record.id, entry);\n state.post(entry);\n });\n return { ok: !0 };\n }\n function requireFirst(names) {\n for (const name of names)\n try {\n const module2 = window.require?.(name);\n if (module2)\n return module2;\n } catch {}\n return null;\n }\n function meUser() {\n const module2 = requireFirst([\n \"WAWebUserPrefsMeUser\",\n \"WAWebUserPrefsMe\",\n \"WAWebUserPrefs\"\n ]);\n if (!module2)\n return null;\n for (const accessor of [\n \"getMaybeMePnUser\",\n \"getMaybeMeUser\",\n \"getMeUser\",\n \"getMeUserOrThrow\",\n \"getMaybeMeLidUser\"\n ])\n try {\n const value = module2[accessor]?.();\n if (value)\n return value;\n } catch {}\n try {\n return module2.me ?? null;\n } catch {}\n return null;\n }\n async function ownJids() {\n const module2 = requireFirst([\"WAWebUserPrefsMeUser\"]), candidates = [meUser()];\n for (const accessor of [\"getMaybeMePnUser\", \"getMaybeMeLidUser\"])\n try {\n candidates.push(module2?.[accessor]?.());\n } catch {}\n const forms = new Set;\n for (const value of candidates) {\n const own = await canonicalJid(value);\n if (own.jid)\n forms.add(own.jid);\n if (own.lid)\n forms.add(own.lid);\n }\n return forms;\n }\n async function mentionsOwnAccount(row) {\n const addressed = [\n ...Array.isArray(row.mentionedJidList) ? row.mentionedJidList : [],\n row.quotedParticipant\n ].filter(Boolean);\n if (addressed.length === 0)\n return !1;\n const own = await ownJids();\n for (const value of addressed) {\n const candidate = await canonicalJid(value);\n if (own.has(candidate.jid) || candidate.lid && own.has(candidate.lid))\n return !0;\n }\n return !1;\n }\n const SEND_MODULES = [\n \"WAWebSendTextMsgChatAction\",\n \"WAWebSendMsgChatAction\",\n \"WAWebSendMessage\"\n ], REACTION_MODULES = [\n \"WAWebSendReactionMsgAction\",\n \"WAWebSendReactionMsg\",\n \"WAWebReactionAction\"\n ], REVOKE_MODULES = [\n \"WAWebChatSendMessages\",\n \"WAWebRevokeMsgAction\",\n \"WAWebDeleteChatAction\",\n \"WAWebRevokeMessage\"\n ], EDIT_MODULES = [\"WAWebSendMessageEditAction\", \"WAWebEditMessage\"], DRAFT_MODULES = [\n \"WAWebChatDraftUtils\",\n \"WAWebSetDraft\",\n \"WAWebComposeBoxActions\"\n ];\n function modelData(model) {\n return model?.attributes ?? model?._data ?? model ?? {};\n }\n function messageReference(model) {\n const row = modelData(model), key = row.id ?? model?.id, id = rawId(key), remote = widString(key?.remote ?? row.chatId ?? (key?.fromMe ? row.to : row.from));\n if (!id || !remote || remote === \"status@broadcast\" || remote.endsWith(\"@newsletter\") || SYSTEM_TYPES.has(row.type))\n return null;\n return { id, timestamp: unixSeconds(row), is_group: remote.endsWith(\"@g.us\") };\n }\n async function observeMessages(input = {}) {\n const after = input.after ?? null;\n if (after !== null && (!Number.isSafeInteger(after) || after < 0))\n throw Error(\"Invalid WhatsApp observation cursor\");\n const database = await new Promise((resolve, reject) => {\n const request = indexedDB.open(\"model-storage\");\n request.onupgradeneeded = () => {\n request.transaction.abort();\n reject(Error(\"WhatsApp source history database is unavailable\"));\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(Error(\"WhatsApp source history database is blocked\"));\n request.onsuccess = () => resolve(request.result);\n });\n let rows;\n try {\n rows = await new Promise((resolve, reject) => {\n const transaction = database.transaction(\"message\", \"readonly\");\n transaction.onabort = () => reject(transaction.error ?? Error(\"WhatsApp source observation aborted\"));\n const request = transaction.objectStore(\"message\").index(\"rowId\").openCursor(after === null ? null : IDBKeyRange.lowerBound(after, !0), after === null ? \"prev\" : \"next\"), page2 = [];\n request.onerror = () => reject(request.error);\n request.onsuccess = () => {\n const cursor = request.result;\n if (!cursor) {\n resolve(page2);\n return;\n }\n if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== \"string\") {\n reject(Error(\"WhatsApp source history has an unsupported key layout\"));\n return;\n }\n page2.push({ position: cursor.key, id: cursor.value.id, timestamp: unixSeconds(cursor.value), type: cursor.value.type });\n if (after === null || page2.length > 500)\n resolve(page2);\n else\n cursor.continue();\n };\n });\n } finally {\n database.close();\n }\n if (after === null)\n return { after: rows[0]?.position ?? 0, references: [], hasMore: !1 };\n const page = rows.slice(0, 500), references = [];\n if (page.length) {\n const keys = requireFirst([\"WAWebMsgKey\"]);\n if (typeof keys?.fromString !== \"function\")\n throw Error(\"WhatsApp source message keys are unavailable\");\n for (const row of page) {\n const reference = messageReference({ id: keys.fromString(row.id), t: row.timestamp, type: row.type });\n if (!reference)\n continue;\n if (reference.timestamp <= 0)\n continue;\n if (reference.timestamp < input.started_at)\n continue;\n if (input.chat_filter === \"group\" && !reference.is_group)\n continue;\n if (input.chat_filter === \"individual\" && reference.is_group)\n continue;\n references.push(reference);\n }\n }\n return { after: page[page.length - 1]?.position ?? after, references, hasMore: rows.length > 500 };\n }\n function models(collection) {\n if (Array.isArray(collection?._models))\n return collection._models;\n if (Array.isArray(collection?.models))\n return collection.models;\n if (typeof collection?.toArray === \"function\")\n try {\n return collection.toArray();\n } catch {}\n return [];\n }\n function widString(value) {\n if (typeof value === \"string\")\n return value;\n if (!value)\n return null;\n if (typeof value._serialized === \"string\")\n return value._serialized;\n try {\n const rendered = value.toString?.();\n return rendered && rendered !== \"[object Object]\" ? String(rendered) : null;\n } catch {\n return null;\n }\n }\n function rawId(value) {\n if (typeof value === \"string\")\n return value && !/^(?:true|false)_/i.test(value) ? value : null;\n if (typeof value?.id === \"string\")\n return value.id && !/^(?:true|false)_/i.test(value.id) ? value.id : null;\n return null;\n }\n function unixSeconds(row) {\n const value = Number(row?.t ?? row?.timestamp ?? row?.ephemeralStartTimestamp ?? 0);\n return Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;\n }\n async function canonicalJid(value) {\n const original = widString(value);\n if (!original)\n return { jid: null, lid: null };\n let jid = original.toLowerCase();\n if (jid.endsWith(\"@c.us\"))\n jid = `${jid.slice(0, -5)}@s.whatsapp.net`;\n if (!jid.endsWith(\"@lid\"))\n return { jid, lid: null };\n const migration = requireFirst([\n \"WAWebLidMigrationUtils\",\n \"WAWebLidMigration\"\n ]), toPn = migration?.toPn ?? migration?.getPnForLid ?? migration?.lidToPhone;\n if (typeof toPn === \"function\")\n try {\n const converted = await toPn.call(migration, value), phoneJid = widString(converted);\n if (phoneJid)\n return {\n jid: phoneJid.endsWith(\"@c.us\") ? `${phoneJid.slice(0, -5)}@s.whatsapp.net` : phoneJid,\n lid: jid\n };\n } catch {}\n return { jid, lid: jid };\n }\n function collectionByRawId(collection, id) {\n if (!id)\n return null;\n for (const model of models(collection)) {\n const row = modelData(model);\n if (rawId(row.id ?? model?.id) === id)\n return model;\n }\n return null;\n }\n function reactionTargetId(row) {\n return rawId(row.reactionParentKey) ?? rawId(row.parentMsgKey) ?? rawId(row.parentMessageKey) ?? (typeof row.quotedStanzaID === \"string\" ? row.quotedStanzaID : null);\n }\n function normalizeReactions(row) {\n const source = row.reactions ?? row.reactionCollection ?? row.reactionsBySender;\n return (Array.isArray(source) ? source : models(source)).map((reaction) => {\n const data = modelData(reaction);\n return {\n emoji: data.text ?? data.reactionText ?? data.emoji ?? null,\n sender_jid: widString(data.senderUserJid ?? data.sender ?? data.author),\n from_me: Boolean(data.fromMe)\n };\n }).filter((reaction) => typeof reaction.emoji === \"string\" && reaction.emoji.length > 0);\n }\n function nameIndex(collections) {\n const byId = (collection) => {\n const map = new Map;\n for (const model of models(collection)) {\n const id = widString(modelData(model).id ?? model?.id);\n if (id && !map.has(id))\n map.set(id, model);\n }\n return map;\n };\n return { chats: byId(collections?.Chat), contacts: byId(collections?.Contact) };\n }\n function contactName(names, jid) {\n if (!jid)\n return null;\n const contact = names?.contacts?.get(jid);\n if (!contact)\n return null;\n const row = modelData(contact);\n return row.name ?? row.pushname ?? row.shortName ?? row.formattedName ?? null;\n }\n function chatName(names, jid) {\n if (!jid)\n return null;\n const chat = names?.chats?.get(jid);\n if (!chat)\n return null;\n const row = modelData(chat);\n return row.name ?? row.formattedTitle ?? row.contact?.name ?? row.contact?.pushname ?? null;\n }\n async function normalizeMessage(model, eventType = \"snapshot\", collectionsOverride = null, names = null) {\n const collections = collectionsOverride ?? requireFirst([\"WAWebCollections\"]);\n if (!collections)\n return null;\n const nameLookup = names ?? nameIndex(collections);\n let row = modelData(model), key = row.id ?? model?.id, id = rawId(key);\n if (!id)\n return null;\n if (row.type === \"reaction\") {\n const targetId = reactionTargetId(row), target = collectionByRawId(collections.Msg, targetId);\n if (target) {\n model = target;\n row = modelData(model);\n key = row.id ?? model?.id;\n id = rawId(key);\n }\n }\n const fromMe = Boolean(key?.fromMe ?? row.fromMe), remoteRaw = key?.remote ?? row.chatId, fromRaw = row.from, toRaw = row.to, authorRaw = row.author ?? key?.participant, chatRaw = remoteRaw ?? (fromMe ? toRaw : fromRaw), chat = await canonicalJid(chatRaw);\n if (!chat.jid || chat.jid === \"status@broadcast\" || chat.jid.endsWith(\"@newsletter\"))\n return null;\n const senderRaw = fromMe ? fromRaw : authorRaw ?? fromRaw, sender = await canonicalJid(senderRaw), participant = await canonicalJid(key?.participant ?? row.participant ?? (fromMe ? toRaw : null)), timestamp = unixSeconds(row), body = typeof row.body === \"string\" ? row.body : \"\", caption = typeof row.caption === \"string\" ? row.caption : \"\", quotedId = typeof row.quotedStanzaID === \"string\" ? row.quotedStanzaID : rawId(row.quotedMsg?.id ?? row.quotedMsgKey), type = typeof row.type === \"string\" ? row.type : \"unknown\";\n return {\n id,\n chat_jid: chat.jid,\n chat_lid: chat.lid,\n chat_name: chatName(nameLookup, widString(chatRaw)),\n sender_jid: sender.jid,\n sender_lid: sender.lid,\n push_name: contactName(nameLookup, widString(senderRaw)) ?? row.notifyName ?? null,\n participant: participant.jid,\n from_me: fromMe,\n is_group: chat.jid.endsWith(\"@g.us\"),\n timestamp,\n occurred_at: timestamp > 0 ? new Date(timestamp * 1000).toISOString() : null,\n body,\n caption,\n message_type: type,\n media_kind: type === \"ptt\" ? \"audio\" : [\"image\", \"video\", \"audio\", \"document\", \"sticker\"].includes(type) ? type : null,\n media_type: typeof row.mimetype === \"string\" ? row.mimetype : null,\n media_size: Number.isFinite(Number(row.size ?? row.fileSize)) ? Number(row.size ?? row.fileSize) : null,\n media_filename: row.filename ?? row.fileName ?? row.title ?? null,\n quoted_id: quotedId,\n mentions_me: await mentionsOwnAccount(row),\n is_forwarded: Boolean(row.isForwarded || Number(row.forwardingScore) > 0),\n is_starred: Boolean(row.star ?? row.isStarred),\n is_system_event: SYSTEM_TYPES.has(type),\n edited: Boolean(row.isEdited || row.editVersion || row.latestEditMsgKey),\n edit_timestamp: Number(row.editTimestamp ?? row.lastEditTimestamp) || null,\n revoked: Boolean(row.isRevoked || row.revoked || type === \"revoked\"),\n reactions: normalizeReactions(row),\n event_type: eventType\n };\n }\n function readiness() {\n if (typeof window.require !== \"function\")\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"whatsapp_runtime_unavailable\"\n };\n const collections = requireFirst([\"WAWebCollections\"]);\n if (!collections?.Msg || !collections?.Chat)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"collections_unavailable\"\n };\n const me = meUser(), qrVisible = Boolean(document.querySelector('[data-testid=\"qrcode\"], canvas[aria-label*=\"Scan\" i], [data-ref] canvas'));\n if (!me && qrVisible)\n return { ready: !1, state: \"logged_out\", reason: \"qr_code_visible\" };\n if (!me)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"authenticated_self_identity_unavailable\"\n };\n const socket = requireFirst([\"WAWebSocketModel\"])?.Socket, connection = socket ?? requireFirst([\"WAWebSocketState\", \"WAWebConn\", \"WAWebConnectionState\"]), connectionState = String(connection?.getSocketState?.() ?? connection?.state ?? connection?.socketState ?? \"\").toLowerCase();\n if (!connectionState)\n return {\n ready: !1,\n state: \"capability_unavailable\",\n reason: \"connection_state_unavailable\"\n };\n if (!/^(connected|open|ready|syncing)$/.test(connectionState))\n return {\n ready: !1,\n state: \"not_ready\",\n reason: `connection_${connectionState}`\n };\n if (socket) {\n const stream = String(socket.stream ?? \"\").toLowerCase();\n if (!stream)\n return {\n ready: !1,\n state: \"capability_unavailable\",\n reason: \"stream_state_unavailable\"\n };\n if (!/^(connected|open|ready)$/.test(stream))\n return { ready: !1, state: \"not_ready\", reason: `stream_${stream}` };\n if (socket.hasSynced === !1)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"initial_sync_incomplete\"\n };\n }\n const offlineDelivery = requireFirst([\n \"WAWebOfflineDelivery\",\n \"WAWebOfflineDeliveryState\"\n ]);\n if ((offlineDelivery?.isOfflineDeliveryComplete?.() ?? offlineDelivery?.offlineDeliveryComplete ?? offlineDelivery?.isComplete) === !1)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"offline_delivery_incomplete\"\n };\n const hydration = requireFirst([\n \"WAWebInitialSyncInfo\",\n \"WAWebHistorySync\",\n \"WAWebAppState\"\n ]);\n if ((hydration?.isInitialSyncComplete?.() ?? hydration?.initialSyncComplete ?? hydration?.isHydrated ?? !0) !== !0)\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"initial_sync_incomplete\"\n };\n if (!Array.isArray(collections.Chat._models) && !Array.isArray(collections.Chat.models))\n return {\n ready: !1,\n state: \"hydrating\",\n reason: \"chat_store_placeholder\"\n };\n const signature = `${widString(me)}:${models(collections.Chat).length}:${models(collections.Msg).length}`;\n if (signature !== readinessSignature) {\n readinessSignature = signature;\n readinessStableSince = Date.now();\n return { ready: !1, state: \"hydrating\", reason: \"stores_settling\" };\n }\n if (Date.now() - readinessStableSince < 500)\n return { ready: !1, state: \"hydrating\", reason: \"stores_settling\" };\n return {\n ready: !0,\n state: \"ready\",\n message_count: models(collections.Msg).length,\n chat_count: models(collections.Chat).length\n };\n }\n function operationCapabilities() {\n const search = requireFirst([\n \"WAWebChatMessageSearch\",\n \"WAWebMessageSearch\",\n \"WAWebSearchMessages\"\n ]), draft = requireFirst(DRAFT_MODULES), send = requireFirst(SEND_MODULES), edit = requireFirst(EDIT_MODULES), reaction = requireFirst(REACTION_MODULES), revoke = requireFirst(REVOKE_MODULES), hasFunction = (module2, names) => names.some((name) => typeof module2?.[name] === \"function\");\n return {\n read_messages: typeof indexedDB < \"u\" && typeof requireFirst([\"WAWebMsgKey\"])?.fromString === \"function\" && typeof requireFirst([\"WAWebCollections\"])?.Msg?.getMessagesById === \"function\",\n search_messages: hasFunction(search, [\"searchMessages\", \"searchMsgs\", \"search\"]) || Boolean(requireFirst([\"WAWebCollections\"])?.Msg),\n draft_message: hasFunction(draft, [\n \"setDraft\",\n \"setChatDraft\",\n \"saveDraft\"\n ]),\n send_message: hasFunction(send, [\n \"sendTextMsgToChat\",\n \"sendMessage\",\n \"addAndSendTextMsg\"\n ]),\n edit_message: hasFunction(edit, [\"sendMessageEdit\", \"editMessage\"]),\n react_message: hasFunction(reaction, [\n \"sendReactionToMsg\",\n \"sendReaction\"\n ]),\n revoke_message: hasFunction(revoke, [\"sendRevokeMsgs\", \"revokeMessage\"])\n };\n }\n function uniqueMessageModels(collections) {\n const byId = new Map;\n for (const message of models(collections.Msg)) {\n const id = rawId(modelData(message).id ?? message?.id);\n if (id)\n byId.set(id, message);\n }\n for (const chat of models(collections.Chat))\n for (const message of models(modelData(chat).msgs ?? chat?.msgs)) {\n const id = rawId(modelData(message).id ?? message?.id);\n if (id)\n byId.set(id, message);\n }\n return [...byId.values()];\n }\n async function resolveChat(collections, input) {\n if (input?.self_chat === !0) {\n const me = meUser(), selfJid = (await canonicalJid(me)).jid;\n let self = null;\n for (const chat of models(collections.Chat))\n if ((await canonicalJid(modelData(chat).id ?? chat?.id)).jid === selfJid) {\n self = chat;\n break;\n }\n if (!self)\n throw Error(\"WhatsApp self chat is not loaded\");\n return self;\n }\n const requestedJidRaw = typeof input?.chat_jid === \"string\" ? input.chat_jid.trim().toLowerCase() : null, requestedJid = requestedJidRaw ? (await canonicalJid(requestedJidRaw)).jid : null, requestedName = typeof input?.chat_name === \"string\" ? input.chat_name.trim().toLowerCase() : null, matches = [];\n for (const chat of models(collections.Chat)) {\n const row = modelData(chat), jid = (await canonicalJid(row.id ?? chat?.id)).jid, name = String(row.name ?? row.formattedTitle ?? row.contact?.name ?? \"\").trim().toLowerCase();\n if (requestedJid ? jid === requestedJid : requestedName && name === requestedName)\n matches.push(chat);\n }\n if (matches.length === 0)\n throw Error(\"WhatsApp chat not found; pass an exact canonical chat_jid or exact chat_name\");\n if (matches.length > 1)\n throw Error(\"WhatsApp chat name is ambiguous; pass chat_jid\");\n return matches[0];\n }\n async function waitForPostState(check, label, timeoutMs = 2000) {\n const deadline = Date.now() + timeoutMs;\n do {\n if (check())\n return;\n await new Promise((resolve) => setTimeout(resolve, 50));\n } while (Date.now() < deadline);\n throw Error(`WhatsApp did not confirm ${label}`);\n }\n async function readMessages(input = {}) {\n const query = String(input.query ?? \"\").trim(), chatFilter = input.chat_filter ?? \"all\", limit = Math.min(100, Math.max(1, Math.trunc(Number(input.limit) || 50)));\n let before = null;\n if (input.cursor) {\n const cursor = JSON.parse(input.cursor);\n if (cursor.v !== 1 || !Number.isSafeInteger(cursor.before) || cursor.before <= 0 || cursor.query !== query || cursor.chat_filter !== chatFilter)\n throw Error(\"Invalid WhatsApp source cursor or changed query scope\");\n before = cursor.before;\n }\n const keyModule = requireFirst([\"WAWebMsgKey\"]), exactId = query.startsWith(\"id:\") ? query.slice(3) : null;\n let chatJid = null;\n if (query.startsWith(\"chat:\")) {\n const chat = await resolveChat(requireFirst([\"WAWebCollections\"]), { chat_jid: query.slice(5) });\n chatJid = (await canonicalJid(modelData(chat).id ?? chat?.id)).jid;\n }\n const database = await new Promise((resolve, reject) => {\n const request = indexedDB.open(\"model-storage\");\n request.onupgradeneeded = () => {\n request.transaction.abort();\n reject(Error(\"WhatsApp source history database is unavailable\"));\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => reject(Error(\"WhatsApp source history database is blocked\"));\n request.onsuccess = () => resolve(request.result);\n });\n let sourceRows;\n try {\n sourceRows = await new Promise((resolve, reject) => {\n const transaction = database.transaction(\"message\", \"readonly\");\n transaction.onabort = () => reject(transaction.error ?? Error(\"WhatsApp source read aborted\"));\n const index = transaction.objectStore(\"message\").index(\"rowId\"), range = before === null ? null : IDBKeyRange.upperBound(before, !0), request = index.openCursor(range, \"prev\"), rows = [];\n request.onerror = () => reject(request.error);\n request.onsuccess = () => {\n const cursor = request.result;\n if (!cursor) {\n resolve(rows);\n return;\n }\n if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== \"string\") {\n reject(Error(\"WhatsApp source history has an unsupported key layout\"));\n return;\n }\n if (exactId !== null) {\n if (keyModule.fromString(cursor.value.id).id !== exactId) {\n cursor.continue();\n return;\n }\n resolve([{ position: cursor.key, id: cursor.value.id }]);\n return;\n }\n rows.push({ position: cursor.key, id: cursor.value.id });\n if (rows.length > (chatJid === null ? limit : 20000))\n resolve(rows);\n else\n cursor.continue();\n };\n });\n } finally {\n database.close();\n }\n let hasMore = sourceRows.length > limit, page = sourceRows.slice(0, limit), last = page[page.length - 1];\n if (chatJid !== null) {\n const examined = sourceRows.slice(0, 20000), canonical = new Map, matches = [];\n for (const row of examined) {\n const remote = keyModule.fromString(row.id).remote, raw = widString(remote);\n if (!canonical.has(raw))\n canonical.set(raw, (await canonicalJid(remote)).jid);\n if (canonical.get(raw) !== chatJid)\n continue;\n matches.push(row);\n if (matches.length > limit)\n break;\n }\n page = matches.slice(0, limit);\n hasMore = matches.length > limit || sourceRows.length > 20000;\n last = matches.length > limit ? page[page.length - 1] : examined[examined.length - 1];\n }\n const collections = requireFirst([\"WAWebCollections\"]), selected = [];\n for (const row of page) {\n const key = keyModule.fromString(row.id);\n if (exactId !== null && key.id !== exactId)\n continue;\n const remote = widString(key.remote);\n if (remote === \"status@broadcast\" || remote.endsWith(\"@newsletter\"))\n continue;\n const isGroup = remote.endsWith(\"@g.us\");\n if (chatFilter === \"group\" && !isGroup || chatFilter === \"individual\" && isGroup)\n continue;\n selected.push(row);\n }\n const results = [];\n if (selected.length) {\n const loaded = await collections.Msg.getMessagesById(selected.map((row) => row.id));\n if (loaded?.canceled || !Array.isArray(loaded?.messages))\n throw Error(\"Source message loading was canceled or unavailable\");\n const byKey = new Map(loaded.messages.map((model) => [String(model.id ?? modelData(model).id), model])), names = nameIndex(collections);\n for (const row of selected) {\n const model = byKey.get(row.id);\n if (!model)\n throw Error(\"Source message could not be loaded; retry the read\");\n const message = await normalizeMessage(model, \"snapshot\", collections, names);\n if (!message || message.timestamp <= 0)\n continue;\n if (exactId === null && chatJid === null && query && !`${message.body}\n${message.caption}`.toLowerCase().includes(query.toLowerCase()))\n continue;\n results.push(message);\n }\n }\n return {\n results,\n hasMore,\n ...hasMore ? { nextCursor: JSON.stringify({ v: 1, before: last.position, query, chat_filter: chatFilter }) } : {}\n };\n }\n async function searchMessages(input) {\n const collections = requireFirst([\"WAWebCollections\"]), query = String(input?.query ?? \"\").trim();\n if (!query)\n throw Error(\"query is required\");\n const offset = Math.max(0, Number(input?.offset) || 0), requestedLimit = Math.max(1, Math.min(Number(input?.limit) || 50, 100));\n if (offset >= 100)\n throw Error(\"WhatsApp source search supports only the first 100 matches\");\n const limit = Math.min(requestedLimit, 100 - offset), searchSourceLimit = 100, chatFilter = [\"all\", \"individual\", \"group\"].includes(input?.chat_filter) ? input.chat_filter : \"all\", chat = input?.chat_jid || input?.chat_name || input?.self_chat === !0 ? await resolveChat(collections, input) : null;\n let scopedChats = chat ? [chat] : void 0;\n if (!chat && chatFilter !== \"all\") {\n scopedChats = [];\n for (const candidate of models(collections.Chat)) {\n const jid = (await canonicalJid(modelData(candidate).id ?? candidate?.id)).jid;\n if (!jid || jid === \"status@broadcast\" || jid.endsWith(\"@newsletter\"))\n continue;\n const isGroup = jid.endsWith(\"@g.us\");\n if (chatFilter === \"group\" ? isGroup : !isGroup)\n scopedChats.push(candidate);\n }\n }\n const search = requireFirst([\n \"WAWebChatMessageSearch\",\n \"WAWebMessageSearch\",\n \"WAWebSearchMessages\"\n ]);\n let found = null;\n for (const fn of [\n search?.searchMessages,\n search?.searchMsgs,\n search?.search\n ]) {\n if (typeof fn !== \"function\")\n continue;\n try {\n found = await fn.call(search, query, scopedChats, searchSourceLimit);\n break;\n } catch {}\n }\n let source = \"whatsapp_fts\", candidates = Array.isArray(found) ? found : models(found?.messages ?? found);\n if (!found) {\n source = \"loaded_model_fallback\";\n const needle = query.toLowerCase();\n candidates = uniqueMessageModels(collections).filter((model) => {\n const row = modelData(model);\n if (chat) {\n const chatId = widString(modelData(chat).id ?? chat?.id);\n if (widString(row.id?.remote ?? row.chatId) !== chatId)\n return !1;\n }\n return String(row.body ?? row.caption ?? \"\").toLowerCase().includes(needle);\n });\n }\n const normalized = [], names = nameIndex(collections);\n for (const candidate of candidates) {\n const model = candidate?.msg ?? candidate?.message ?? candidate, message = await normalizeMessage(model, \"search\", collections, names);\n if (!message || Number(message.timestamp) <= 0)\n continue;\n if (chatFilter === \"group\" && !message.is_group)\n continue;\n if (chatFilter === \"individual\" && message.is_group)\n continue;\n normalized.push(message);\n if (normalized.length >= searchSourceLimit)\n break;\n }\n return {\n source,\n results: normalized.slice(offset, offset + limit),\n hasMore: offset + limit < normalized.length\n };\n }\n async function draftMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), chat = await resolveChat(collections, input), text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const draft = {\n body: text,\n timestamp: Math.floor(Date.now() / 1000),\n type: \"chat\",\n mentionedJidList: [],\n quotedMsg: null\n }, module2 = requireFirst(DRAFT_MODULES);\n let applied = !1;\n for (const fn of [\n module2?.setDraft,\n module2?.setChatDraft,\n module2?.saveDraft\n ]) {\n if (typeof fn !== \"function\")\n continue;\n try {\n await fn.call(module2, chat, draft);\n applied = !0;\n break;\n } catch {\n try {\n await fn.call(module2, draft, chat);\n applied = !0;\n break;\n } catch {}\n }\n }\n if (!applied && typeof chat?.setDraft === \"function\") {\n await chat.setDraft(draft);\n applied = !0;\n }\n if (!applied)\n throw Error(\"WhatsApp draft capability is unavailable in this web build\");\n const stored = modelData(chat).draft ?? chat.get?.(\"draft\") ?? null;\n if (!stored || typeof stored !== \"object\" || stored.body !== text)\n throw Error(\"WhatsApp rejected the persistent draft shape\");\n return {\n drafted: !0,\n sent: !1,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n draft\n };\n }\n async function sendMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), chat = await resolveChat(collections, input), text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const module2 = requireFirst(SEND_MODULES);\n if (typeof module2?.createTextMsgData === \"function\" && typeof module2?.addAndSendTextMsg === \"function\") {\n const data = await module2.createTextMsgData(chat, text), plannedId = rawId(data?.id);\n if (!plannedId)\n throw Error(\"WhatsApp did not assign an id to the outgoing message\");\n await module2.addAndSendTextMsg(chat, data);\n return {\n sent: !0,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n message_id: plannedId\n };\n }\n const fn = module2?.sendTextMsgToChat ?? module2?.sendMessage ?? chat?.sendMessage;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp send capability is unavailable in this web build\");\n const result = fn === chat?.sendMessage ? await fn.call(chat, text) : await fn.call(module2, chat, text), messageId = rawId(modelData(result).id ?? result?.id);\n if (!messageId)\n throw Error(\"WhatsApp send acknowledgment has no raw message ID\");\n return {\n sent: !0,\n chat_jid: widString(modelData(chat).id ?? chat?.id),\n message_id: messageId\n };\n }\n function messageActionAllowed(message, predicateNames, legacyFlags) {\n const row = modelData(message);\n for (const flag of legacyFlags)\n if (row[flag] === !0)\n return !0;\n const capability = requireFirst([\"WAWebMsgActionCapability\"]);\n for (const name of predicateNames) {\n if (typeof capability?.[name] !== \"function\")\n continue;\n try {\n if (capability[name](message) === !0)\n return !0;\n } catch {}\n }\n return !1;\n }\n function resolveMessage(collections, id) {\n const raw = String(id ?? \"\").trim();\n if (!raw)\n throw Error(\"message_id is required\");\n const message = collectionByRawId(collections.Msg, raw);\n if (!message)\n throw Error(`WhatsApp message ${raw} is not loaded; read it with id:${raw} from the live messages feed or search it first`);\n return message;\n }\n async function editMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), before = modelData(message);\n if (!(before.id?.fromMe ?? before.fromMe))\n throw Error(\"WhatsApp only permits editing outgoing messages\");\n if (!messageActionAllowed(message, [\"canEditText\", \"canEditCaption\", \"canEnterEditingFlow\"], [\"canEdit\", \"isEditable\"]))\n throw Error(\"WhatsApp did not affirm that this message is currently editable\");\n const text = String(input?.text ?? \"\");\n if (!text.trim())\n throw Error(\"text is required\");\n const module2 = requireFirst(EDIT_MODULES), fn = module2?.sendMessageEdit ?? module2?.editMessage ?? message?.edit;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp edit capability is unavailable in this web build\");\n await (fn === message?.edit ? fn.call(message, text) : fn.call(module2, message, text, {}));\n await waitForPostState(() => {\n const row = modelData(message);\n return row.body === text && Boolean(row.isEdited || row.editVersion || row.latestEditMsgKey);\n }, \"message edit\");\n return {\n edited: !0,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function reactMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), emoji = input?.remove ? \"\" : String(input?.emoji ?? \"\");\n if (!input?.remove && !emoji)\n throw Error(\"emoji is required unless remove=true\");\n const module2 = requireFirst(REACTION_MODULES), fn = module2?.sendReactionToMsg ?? module2?.sendReaction ?? message?.react;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp reaction capability is unavailable in this web build\");\n await (fn === message?.react ? fn.call(message, emoji) : fn.call(module2, message, emoji));\n await waitForPostState(() => {\n const row = modelData(message), reactions = normalizeReactions(row);\n if (reactions.length > 0)\n return input?.remove ? !reactions.some((reaction) => reaction.from_me) : reactions.some((reaction) => reaction.from_me && reaction.emoji === emoji);\n return input?.remove ? !0 : row.hasReaction === !0;\n }, \"reaction state\");\n return {\n reacted: !0,\n confirmed: input?.remove ? normalizeReactions(modelData(message)).length > 0 : !0,\n removed: Boolean(input?.remove),\n emoji: emoji || null,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function revokeMessage(input) {\n const collections = requireFirst([\"WAWebCollections\"]), message = resolveMessage(collections, input?.message_id), before = modelData(message);\n if (!(before.id?.fromMe ?? before.fromMe))\n throw Error(\"WhatsApp only permits revoking outgoing messages\");\n if (!messageActionAllowed(message, [\"canSenderRevokeMsg\", \"canAdminRevokeMsg\"], [\"canRevoke\", \"isRevokable\"]))\n throw Error(\"WhatsApp did not affirm that this message is currently revokable\");\n const module2 = requireFirst(REVOKE_MODULES), fn = module2?.sendRevokeMsgs ?? module2?.sendRevoke ?? module2?.revokeMessage ?? message?.sendRevoke ?? message?.revoke;\n if (typeof fn !== \"function\")\n throw Error(\"WhatsApp revoke capability is unavailable in this web build\");\n if (fn === message?.sendRevoke || fn === message?.revoke)\n await fn.call(message);\n else\n await fn.call(module2, [message], modelData(message).id?.remote);\n await waitForPostState(() => {\n const row = modelData(message);\n return Boolean(row.isRevoked || row.revoked || row.type === \"revoked\");\n }, \"message revoke\");\n return {\n revoked: !0,\n message_id: rawId(modelData(message).id ?? message?.id)\n };\n }\n async function invoke(request) {\n try {\n if (Number(request?.adapter_version) !== 26)\n return {\n ok: !1,\n error: {\n state: \"adapter_mismatch\",\n reason: \"expected 26\"\n }\n };\n if (request.op === \"account_identity\") {\n const accountId = widString(meUser());\n return accountId ? { accountId } : null;\n }\n if (request.op === \"probe\") {\n const status = readiness();\n return status.ready ? { ok: !0, status, capabilities: operationCapabilities() } : { ok: !1, error: status };\n }\n if (request.op === \"listen\")\n return listen(request);\n if (request.op === \"publish_changes\")\n return await publishChanges(request);\n if (request.op === \"observe_messages\")\n return { ok: !0, ...await observeMessages(request.input) };\n if (operationCapabilities()[request.op] !== !0)\n return {\n ok: !1,\n error: {\n state: \"capability_unavailable\",\n reason: `${request.op} is unavailable in this WhatsApp Web build`\n }\n };\n if (request.op === \"read_messages\")\n return { ok: !0, ...await readMessages(request.input) };\n if (request.op === \"search_messages\")\n return { ok: !0, ...await searchMessages(request.input) };\n if (request.op === \"draft_message\")\n return { ok: !0, ...await draftMessage(request.input) };\n if (request.op === \"send_message\")\n return { ok: !0, ...await sendMessage(request.input) };\n if (request.op === \"edit_message\")\n return { ok: !0, ...await editMessage(request.input) };\n if (request.op === \"react_message\")\n return { ok: !0, ...await reactMessage(request.input) };\n if (request.op === \"revoke_message\")\n return { ok: !0, ...await revokeMessage(request.input) };\n return {\n ok: !1,\n error: { state: \"unsupported_operation\", reason: String(request?.op) }\n };\n } catch (error) {\n return {\n ok: !1,\n error: {\n state: \"operation_failed\",\n reason: error instanceof Error ? error.message : String(error)\n }\n };\n }\n }\n globalThis.__owlettoWhatsAppAdapterV1 = { version: 26, invoke, detach };\n })();\n for (let i = 0; i < 40; i++) {\n const identity = await globalThis.__owlettoWhatsAppAdapterV1.invoke({ op: \"account_identity\", adapter_version: 26 });\n if (identity?.accountId) return identity;\n await new Promise(resolve => setTimeout(resolve, 250));\n }\n return null;\n })()"
20256
21545
  }
20257
21546
  },
20258
21547
  "webhook": null,
@@ -20260,7 +21549,7 @@
20260
21549
  "live_messages": {
20261
21550
  "key": "live_messages",
20262
21551
  "name": "Live messages",
20263
- "description": "Read messages directly from WhatsApp Web without importing history, using literal text search or id:<message ID>. Active Automations can subscribe to new-message references. Requires the paired browser to be online and signed in; reconnects replay messages still available in WhatsApp's local history.",
21552
+ "description": "Read messages directly from WhatsApp Web without importing history, using literal text search, id:<message ID>, or chat:<chat JID> for one chat's messages in reverse storage order. Follow cursors even after an empty filtered page. Active Automations can subscribe to new-message references. Requires the paired browser to be online and signed in; reconnects replay messages still available in WhatsApp's local history.",
20264
21553
  "webhook": {
20265
21554
  "mode": "trigger",
20266
21555
  "events": [
@@ -20285,177 +21574,6 @@
20285
21574
  "operations": [
20286
21575
  "read"
20287
21576
  ]
20288
- },
20289
- "messages": {
20290
- "webhook": {
20291
- "events": [
20292
- "message"
20293
- ],
20294
- "mode": "trigger"
20295
- },
20296
- "key": "messages",
20297
- "name": "Messages",
20298
- "description": "Personal WhatsApp messages from one-to-one and group chats. Syncs live changes and progressively hydrates history available to WhatsApp Web.",
20299
- "configSchema": {
20300
- "type": "object",
20301
- "properties": {
20302
- "chat_filter": {
20303
- "type": "string",
20304
- "enum": [
20305
- "all",
20306
- "individual",
20307
- "group"
20308
- ],
20309
- "default": "all",
20310
- "description": "Which chats to include."
20311
- },
20312
- "max_messages_per_sync": {
20313
- "type": "integer",
20314
- "minimum": 1,
20315
- "maximum": 1000,
20316
- "default": 1000,
20317
- "description": "Bounded maximum messages emitted per sync. Additional durable history resumes on later runs."
20318
- }
20319
- }
20320
- },
20321
- "eventKinds": {
20322
- "message": {
20323
- "description": "A WhatsApp message, caption, media placeholder, edit, revoke, or reaction-updated message.",
20324
- "metadataSchema": {
20325
- "type": "object",
20326
- "required": [
20327
- "source",
20328
- "origin_id",
20329
- "chat_jid",
20330
- "is_group",
20331
- "from_me"
20332
- ],
20333
- "properties": {
20334
- "source": {
20335
- "type": "string",
20336
- "const": "whatsapp_web"
20337
- },
20338
- "origin_id": {
20339
- "type": "string"
20340
- },
20341
- "chat_jid": {
20342
- "type": "string"
20343
- },
20344
- "is_group": {
20345
- "type": "boolean"
20346
- },
20347
- "from_me": {
20348
- "type": "boolean"
20349
- },
20350
- "is_direct_inbound": {
20351
- "type": "boolean"
20352
- },
20353
- "participant": {
20354
- "type": "string"
20355
- },
20356
- "sender_jid": {
20357
- "type": "string"
20358
- },
20359
- "sender_phone": {
20360
- "type": "string"
20361
- },
20362
- "push_name": {
20363
- "type": "string"
20364
- },
20365
- "media_type": {
20366
- "type": "string"
20367
- },
20368
- "quoted_id": {
20369
- "type": "string"
20370
- },
20371
- "is_forwarded": {
20372
- "type": "boolean"
20373
- },
20374
- "is_starred": {
20375
- "type": "boolean"
20376
- },
20377
- "is_system_event": {
20378
- "type": "boolean"
20379
- },
20380
- "edited": {
20381
- "type": "boolean"
20382
- },
20383
- "edit_timestamp": {
20384
- "type": "number"
20385
- },
20386
- "revoked": {
20387
- "type": "boolean"
20388
- },
20389
- "reactions": {
20390
- "type": "array",
20391
- "items": {
20392
- "type": "object"
20393
- }
20394
- },
20395
- "voice_note_skipped": {
20396
- "type": "string",
20397
- "enum": [
20398
- "not_downloaded",
20399
- "too_large",
20400
- "empty",
20401
- "read_error",
20402
- "invalid_path"
20403
- ]
20404
- },
20405
- "media_status": {
20406
- "type": "string",
20407
- "enum": [
20408
- "downloaded",
20409
- "awaiting_primary_device",
20410
- "view_once",
20411
- "expired",
20412
- "too_large",
20413
- "timeout_retryable",
20414
- "metadata_only",
20415
- "unavailable"
20416
- ]
20417
- }
20418
- }
20419
- },
20420
- "attributions": [
20421
- {
20422
- "role": "authored_by",
20423
- "autoCreate": true,
20424
- "target": {
20425
- "entityType": "person",
20426
- "createWhen": {
20427
- "path": "metadata.is_direct_inbound",
20428
- "equals": true
20429
- },
20430
- "titlePath": "metadata.push_name",
20431
- "identities": [
20432
- {
20433
- "namespace": "wa_jid",
20434
- "eventPath": "metadata.sender_jid"
20435
- },
20436
- {
20437
- "namespace": "phone",
20438
- "eventPath": "metadata.sender_phone"
20439
- }
20440
- ]
20441
- },
20442
- "traits": {
20443
- "push_name": {
20444
- "eventPath": "metadata.push_name",
20445
- "mergeStrategy": "prefer_non_empty"
20446
- },
20447
- "last_seen_at": {
20448
- "eventPath": "occurred_at",
20449
- "mergeStrategy": "overwrite"
20450
- }
20451
- }
20452
- }
20453
- ]
20454
- }
20455
- },
20456
- "operations": [
20457
- "sync"
20458
- ]
20459
21577
  }
20460
21578
  },
20461
21579
  "actions_schema": {
@@ -20514,6 +21632,9 @@
20514
21632
  "items": {
20515
21633
  "type": "object"
20516
21634
  }
21635
+ },
21636
+ "hasMore": {
21637
+ "type": "boolean"
20517
21638
  }
20518
21639
  }
20519
21640
  }
@@ -20793,7 +21914,7 @@
20793
21914
  "channel_id": {
20794
21915
  "type": "string",
20795
21916
  "title": "Chat",
20796
- "description": "WhatsApp chat ID. Replies into a group need this set to that group."
21917
+ "description": "WhatsApp chat ID. Scoping replies to a group allows replies without a mention, subject to the other trigger filters. Unscoped group replies require an @mention or a reply quoting the account."
20797
21918
  }
20798
21919
  }
20799
21920
  },
@@ -20899,8 +22020,8 @@
20899
22020
  {
20900
22021
  "id": "x",
20901
22022
  "name": "X (Twitter)",
20902
- "version": "3.14.2",
20903
- "description": "Fetches tweets, browser-visible like history, bookmarks, and DMs through the X API v2 or the paired Owletto Chrome extension, and reads the chronological Following timeline live through the X API. Links social actors into the person graph.",
22023
+ "version": "3.15.0",
22024
+ "description": "Fetches tweets, browser-visible like history, bookmarks, and DMs through the X API v2 or the paired Owletto Chrome extension, reads the chronological Following timeline live through the X API, and reads and answers DMs live in the paired browser. Links social actors into the person graph.",
20904
22025
  "detail": {
20905
22026
  "source_path": "x.ts",
20906
22027
  "auth_schema": {
@@ -20958,6 +22079,20 @@
20958
22079
  },
20959
22080
  "webhook": null,
20960
22081
  "feeds_schema": {
22082
+ "live_messages": {
22083
+ "key": "live_messages",
22084
+ "name": "Live messages",
22085
+ "description": "Read recent X direct messages live from the paired browser without importing history or marking them read, page by the returned cursor, or read one message by id:<message id>. Message requests from accounts the user does not follow are included and marked is_request. Active Automations subscribe to new-message references; the browser checks once a minute while it is online and resumes from X's inbox update cursor after reconnecting. Requires a browser-authenticated X connection.",
22086
+ "webhook": {
22087
+ "mode": "trigger",
22088
+ "events": [
22089
+ "message.created"
22090
+ ]
22091
+ },
22092
+ "operations": [
22093
+ "read"
22094
+ ]
22095
+ },
20961
22096
  "following_timeline": {
20962
22097
  "key": "following_timeline",
20963
22098
  "name": "Following Timeline (live)",
@@ -22177,6 +23312,67 @@
22177
23312
  }
22178
23313
  },
22179
23314
  "actions_schema": {
23315
+ "send_message": {
23316
+ "key": "send_message",
23317
+ "kind": "write",
23318
+ "name": "Send DM reply",
23319
+ "description": "Requires an X connection authenticated through your paired Chrome browser. Send a text reply into an exact existing X direct message conversation and confirm it appears there. This direct send is approved only for answering DMs on bot accounts the owner operates; public replies and posts stay draft-only through prepare_reply. On retry, reuse both this input's idempotency_key and the enclosing operations.execute idempotency_key. The browser can recognise an earlier send only while its request ID is on the latest conversation page; matching recent text without a request ID is refused.",
23320
+ "annotations": {
23321
+ "destructiveHint": false,
23322
+ "idempotentHint": false,
23323
+ "openWorldHint": true
23324
+ },
23325
+ "inputSchema": {
23326
+ "type": "object",
23327
+ "required": [
23328
+ "conversation_id",
23329
+ "text",
23330
+ "idempotency_key"
23331
+ ],
23332
+ "additionalProperties": false,
23333
+ "properties": {
23334
+ "conversation_id": {
23335
+ "type": "string",
23336
+ "pattern": "^[0-9]{1,20}(-[0-9]{1,20})?$",
23337
+ "description": "Exact X DM conversation ID, the conversation_id of a live_messages row."
23338
+ },
23339
+ "text": {
23340
+ "type": "string",
23341
+ "minLength": 1,
23342
+ "maxLength": 10000
23343
+ },
23344
+ "idempotency_key": {
23345
+ "type": "string",
23346
+ "minLength": 1,
23347
+ "maxLength": 200,
23348
+ "description": "Stable key used to derive X's client request ID. Reuse it and the enclosing operation's idempotency_key on retry; browser deduplication only checks the latest conversation page."
23349
+ }
23350
+ }
23351
+ },
23352
+ "outputSchema": {
23353
+ "type": "object",
23354
+ "properties": {
23355
+ "sent": {
23356
+ "type": "boolean"
23357
+ },
23358
+ "deduplicated": {
23359
+ "type": "boolean"
23360
+ },
23361
+ "id": {
23362
+ "type": "string"
23363
+ },
23364
+ "message_id": {
23365
+ "type": "string"
23366
+ },
23367
+ "conversation_id": {
23368
+ "type": "string"
23369
+ },
23370
+ "occurred_at": {
23371
+ "type": "string"
23372
+ }
23373
+ }
23374
+ }
23375
+ },
22180
23376
  "prepare_reply": {
22181
23377
  "key": "prepare_reply",
22182
23378
  "kind": "write",
@@ -22278,7 +23474,47 @@
22278
23474
  }
22279
23475
  }
22280
23476
  },
22281
- "automation_events": null,
23477
+ "automation_events": [
23478
+ {
23479
+ "key": "message.created",
23480
+ "label": "New DM",
23481
+ "resourceType": "message",
23482
+ "description": "A new X direct message reference from the paired browser. The Automation reads its content from the live messages feed, or replies in the conversation it came from.",
23483
+ "filterSchema": {
23484
+ "type": "object",
23485
+ "properties": {
23486
+ "channel_id": {
23487
+ "type": "string",
23488
+ "title": "Conversation",
23489
+ "description": "X DM conversation ID."
23490
+ }
23491
+ }
23492
+ },
23493
+ "capabilities": {
23494
+ "replyToSource": true
23495
+ }
23496
+ },
23497
+ {
23498
+ "key": "tweet",
23499
+ "label": "Tweet"
23500
+ },
23501
+ {
23502
+ "key": "reply",
23503
+ "label": "Reply"
23504
+ },
23505
+ {
23506
+ "key": "liked_tweet",
23507
+ "label": "Liked Tweet"
23508
+ },
23509
+ {
23510
+ "key": "bookmark",
23511
+ "label": "Bookmark"
23512
+ },
23513
+ {
23514
+ "key": "dm_message",
23515
+ "label": "DM Message"
23516
+ }
23517
+ ],
22282
23518
  "options_schema": null,
22283
23519
  "favicon_domain": "x.com",
22284
23520
  "required_capability": null,