@lobu/runtime-server 24.1.0 → 24.2.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 (284) hide show
  1. package/dist/catalogs/connectors.json +151 -37
  2. package/dist/catalogs/skills.json +2 -2
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/google_gmail.ts +70 -41
  5. package/dist/connectors/google_gmail_references.ts +406 -0
  6. package/dist/connectors/linkedin-inbox-adapter.js +107 -36
  7. package/dist/connectors/linkedin-inbox.ts +13 -0
  8. package/dist/connectors/linkedin.ts +1 -1
  9. package/dist/connectors/postgres.ts +5 -3
  10. package/dist/connectors/reddit.ts +171 -5
  11. package/dist/connectors/whatsapp-web-adapter.js +147 -61
  12. package/dist/connectors/whatsapp-web-helpers.ts +6 -2
  13. package/dist/connectors/whatsapp_web.ts +48 -17
  14. package/dist/connectors/x-dm-adapter.js +252 -35
  15. package/dist/connectors/x.ts +189 -13
  16. package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +3 -1
  17. package/dist/db/migrations/20261024050000_events_source_reference_arrival.sql +27 -0
  18. package/dist/db/migrations/20261026000000_turn_write_receipts.sql +36 -0
  19. package/dist/db/migrations/20261026190000_federated_relationship_endpoints.sql +143 -0
  20. package/dist/dependencies.bun.lock +81 -83
  21. package/dist/embeddings-server.mjs +81 -11
  22. package/dist/guest.bundle.js +62 -25
  23. package/dist/owletto/dist/assets/_-Cjvw31gU.js +2 -0
  24. package/dist/owletto/dist/assets/_-iToIRRFt.js +3 -0
  25. package/dist/owletto/dist/assets/_agentId-CLdj0X7j.js +2 -0
  26. package/dist/owletto/dist/assets/_agentId-D5cAWjrP.js +2 -0
  27. package/dist/owletto/dist/assets/_automationId-BhEZmkJU.js +2 -0
  28. package/dist/owletto/dist/assets/_connectorKey._connectionId-DZtLc3WW.js +2 -0
  29. package/dist/owletto/dist/assets/_connectorKey.index-BoYpah_l.js +2 -0
  30. package/dist/owletto/dist/assets/_conversationId-ML2TjCwN.js +2 -0
  31. package/dist/owletto/dist/assets/_eventId-BYc3I2EL.js +2 -0
  32. package/dist/owletto/dist/assets/_name-BsOZmvlH.js +2 -0
  33. package/dist/owletto/dist/assets/_owner-UuyQLJ-0.js +3 -0
  34. package/dist/owletto/dist/assets/_shape-BpnVAYWH.js +2 -0
  35. package/dist/owletto/dist/assets/_skillKey-CYrGvNn-.js +2 -0
  36. package/dist/owletto/dist/assets/_slug-MHQU8ftJ.js +2 -0
  37. package/dist/owletto/dist/assets/_viewKey-CGAJ1ucr.js +2 -0
  38. package/dist/owletto/dist/assets/_viewKey-CMkhfs1k.js +2 -0
  39. package/dist/owletto/dist/assets/accept-invitation-D2T_a2dj.js +2 -0
  40. package/dist/owletto/dist/assets/activity-route-view-_G_lDz5K.js +2 -0
  41. package/dist/owletto/dist/assets/agent-card-controls-ColL5rdd.js +2 -0
  42. package/dist/owletto/dist/assets/{agent-client-setup-list-BlXB4SE5.js → agent-client-setup-list-BgyLhJCo.js} +2 -2
  43. package/dist/owletto/dist/assets/agent-connect-pages-BryZas7Z.js +2 -0
  44. package/dist/owletto/dist/assets/{agent-editor-form-DsSoeQeF.js → agent-editor-form-C24p9LLg.js} +2 -2
  45. package/dist/owletto/dist/assets/agent-guardrails-route-D9PpDgR-.js +2 -0
  46. package/dist/owletto/dist/assets/{agent-loading-shells-B7v6Cffw.js → agent-loading-shells-jkf9DjdO.js} +2 -2
  47. package/dist/owletto/dist/assets/agent-permissions-matrix-C8j8kRB1.js +2 -0
  48. package/dist/owletto/dist/assets/{agent-skill-context-DFucg4c4.js → agent-skill-context-B9giw2u2.js} +2 -2
  49. package/dist/owletto/dist/assets/agent-skills-route-BMZ3r1bP.js +2 -0
  50. package/dist/owletto/dist/assets/agent-subpage-shell-D49f-bzP.js +2 -0
  51. package/dist/owletto/dist/assets/{agent-thread-D38STyeu.js → agent-thread-BGHYHWDO.js} +4 -4
  52. package/dist/owletto/dist/assets/agents-C05k-Xw6.js +2 -0
  53. package/dist/owletto/dist/assets/agents-workbench-D1YL3VAB.js +2 -0
  54. package/dist/owletto/dist/assets/app._appId-A51tx2jU.js +2 -0
  55. package/dist/owletto/dist/assets/automation-detail-content-DCAZBKle.js +2 -0
  56. package/dist/owletto/dist/assets/automations-C05k-Xw6.js +2 -0
  57. package/dist/owletto/dist/assets/callback-WmyCei3R.js +2 -0
  58. package/dist/owletto/dist/assets/{card-jzhQrMDP.js → card-Cspo-4M6.js} +2 -2
  59. package/dist/owletto/dist/assets/{claim-B-wq745Q.js → claim-CCKdBtFt.js} +2 -2
  60. package/dist/owletto/dist/assets/client-activity-scopes-CmK3DkSP.js +2 -0
  61. package/dist/owletto/dist/assets/client-rows-fFuxzFtE.js +2 -0
  62. package/dist/owletto/dist/assets/{code-editor-CEqoCky-.js → code-editor-C8FJbT2P.js} +3 -3
  63. package/dist/owletto/dist/assets/connect-BmCUJ3lr.js +2 -0
  64. package/dist/owletto/dist/assets/connect._clientId-B6StGCPK.js +2 -0
  65. package/dist/owletto/dist/assets/connected._clientId-CPiMA6Bx.js +2 -0
  66. package/dist/owletto/dist/assets/connected._clientId.activity-BialEDmu.js +2 -0
  67. package/dist/owletto/dist/assets/connected._clientId.index-X1wVi6v0.js +2 -0
  68. package/dist/owletto/dist/assets/{connection-CNm2ukrI.js → connection-DJd9bnEc.js} +2 -2
  69. package/dist/owletto/dist/assets/{connection-feed-detail-WcGCA6qY.js → connection-feed-detail-IO6G5QjL.js} +2 -2
  70. package/dist/owletto/dist/assets/connections-browser-CzdcZeiU.js +2 -0
  71. package/dist/owletto/dist/assets/{connector-provenance-D-ECOlMJ.js → connector-provenance-bmBJJ9B4.js} +2 -2
  72. package/dist/owletto/dist/assets/connector-scope-lists-B44Q9W-j.js +2 -0
  73. package/dist/owletto/dist/assets/{connectors-CH4KBZyT.js → connectors-CTWPDH8f.js} +2 -2
  74. package/dist/owletto/dist/assets/{consent-C9ZpHb7V.js → consent-C_WBfmQ8.js} +2 -2
  75. package/dist/owletto/dist/assets/copy-button-kcjg8Giw.js +2 -0
  76. package/dist/owletto/dist/assets/{core.esm-BupT3V0i.js → core.esm-CoJ5Splc.js} +2 -2
  77. package/dist/owletto/dist/assets/create-CQE5rD0i.js +2 -0
  78. package/dist/owletto/dist/assets/create-DQNlRTUX.js +2 -0
  79. package/dist/owletto/dist/assets/create-automation-form-y3tq2QIJ.js +3 -0
  80. package/dist/owletto/dist/assets/create-lOFSQV_5.js +2 -0
  81. package/dist/owletto/dist/assets/create._connectorKey-icyNicvn.js +2 -0
  82. package/dist/owletto/dist/assets/{cronstrue-CWImw-kf.js → cronstrue-CeUS_78Q.js} +2 -2
  83. package/dist/owletto/dist/assets/{device-D-7WBe9E.js → device-Br9JHadR.js} +2 -2
  84. package/dist/owletto/dist/assets/device-pin-tombstone-7UpeD4Sq.js +2 -0
  85. package/dist/owletto/dist/assets/device._deviceId-DGMmjr01.js +2 -0
  86. package/dist/owletto/dist/assets/elk-worker.min-BENGc9gn.js +23 -0
  87. package/dist/owletto/dist/assets/{entity-avatar-mdh7Kq5D.js → entity-avatar-BZIa-7i5.js} +2 -2
  88. package/dist/owletto/dist/assets/entity-options-BcTafZ2e.js +2 -0
  89. package/dist/owletto/dist/assets/entity-page-CY7PF3X9.js +2 -0
  90. package/dist/owletto/dist/assets/entity-type-page-BzMZttzh.js +2 -0
  91. package/dist/owletto/dist/assets/{event-detail-DV_zfWnC.js → event-detail-C25TvOb_.js} +2 -2
  92. package/dist/owletto/dist/assets/events-feed-C4VrjIc1.js +2 -0
  93. package/dist/owletto/dist/assets/filter-editors-oNjBX9a2.js +2 -0
  94. package/dist/owletto/dist/assets/{full-page-spinner-BVbcpW3R.js → full-page-spinner-DtmqQmgl.js} +2 -2
  95. package/dist/owletto/dist/assets/guardrails-Acfam-JF.js +2 -0
  96. package/dist/owletto/dist/assets/identity-BkK8ggdp.js +2 -0
  97. package/dist/owletto/dist/assets/index-BhBYXtEN.js +2 -0
  98. package/dist/owletto/dist/assets/{index-BTlx9K_t.js → index-Bhop_otG.js} +2 -2
  99. package/dist/owletto/dist/assets/index-Bw5iV_J7.js +2 -0
  100. package/dist/owletto/dist/assets/index-C3dpyynY.js +2 -0
  101. package/dist/owletto/dist/assets/index-C3zAbslo.js +2 -0
  102. package/dist/owletto/dist/assets/index-CGKN_WN_.js +2 -0
  103. package/dist/owletto/dist/assets/{index-DB1iWI_a.js → index-CgRaCOzW.js} +2 -2
  104. package/dist/owletto/dist/assets/{index-D7gHOpfg.js → index-DRbaESbJ.js} +2 -2
  105. package/dist/owletto/dist/assets/index-DfIoxD5Q.js +2 -0
  106. package/dist/owletto/dist/assets/index-DijuudSs.js +2 -0
  107. package/dist/owletto/dist/assets/index-Dr7bouPX.css +1 -0
  108. package/dist/owletto/dist/assets/index-JmEl29py.js +7950 -0
  109. package/dist/owletto/dist/assets/index-NK2VKPoL.js +2 -0
  110. package/dist/owletto/dist/assets/index-_5qsmBkt.js +2 -0
  111. package/dist/owletto/dist/assets/{index-B64PGxQm.js → index-qkOKpRYs.js} +2 -2
  112. package/dist/owletto/dist/assets/index-wHFQv1aT.js +12 -0
  113. package/dist/owletto/dist/assets/index-wzYkECAe.js +2 -0
  114. package/dist/owletto/dist/assets/json-diff-4sMmayDd.js +4 -0
  115. package/dist/owletto/dist/assets/linked-record-peek-B0_B4PnF.js +97 -0
  116. package/dist/owletto/dist/assets/{list-skeleton-CepswBka.js → list-skeleton-BafzvpOM.js} +2 -2
  117. package/dist/owletto/dist/assets/login-XL5XxN6y.js +2 -0
  118. package/dist/owletto/dist/assets/{logout-Bkzc7J44.js → logout-CMxdhLbM.js} +2 -2
  119. package/dist/owletto/dist/assets/{member-scope-gate-DD4YBFn-.js → member-scope-gate-Dit3MXBQ.js} +2 -2
  120. package/dist/owletto/dist/assets/memory-browse-page-DTlM_9MY.js +74 -0
  121. package/dist/owletto/dist/assets/{model-selector-CDrAjH31.js → model-selector-BeFuFH7p.js} +2 -2
  122. package/dist/owletto/dist/assets/models-BAVaDnKN.js +2 -0
  123. package/dist/owletto/dist/assets/new-1QLuS1o-.js +2 -0
  124. package/dist/owletto/dist/assets/{new-ktz9Cs_P.js → new-ChwqLmVY.js} +2 -2
  125. package/dist/owletto/dist/assets/new-D21LGMl6.js +2 -0
  126. package/dist/owletto/dist/assets/{oauth-workspace-access-lZNZ9gul.js → oauth-workspace-access-D15LYKSe.js} +2 -2
  127. package/dist/owletto/dist/assets/organization-CoUJYXx7.js +2 -0
  128. package/dist/owletto/dist/assets/peek-pane-content-BvkYk72J.js +2 -0
  129. package/dist/owletto/dist/assets/permissions-C6UFdvz2.js +2 -0
  130. package/dist/owletto/dist/assets/proposal-review-shell-CmLy1MZf.js +2 -0
  131. package/dist/owletto/dist/assets/public-shell-ready-_awBxu2Y.js +2 -0
  132. package/dist/owletto/dist/assets/record-activity-Doeu5kPO.js +2 -0
  133. package/dist/owletto/dist/assets/{record-session-Pbr5czGw.js → record-session-CJzFoVKc.js} +2 -2
  134. package/dist/owletto/dist/assets/{reset-password-CzZw6RcC.js → reset-password-Y-WO77iR.js} +2 -2
  135. package/dist/owletto/dist/assets/runs-B0zVYb-w.js +2 -0
  136. package/dist/owletto/dist/assets/runs-panel-Dkyybqos.js +2 -0
  137. package/dist/owletto/dist/assets/{runs-table-B1APZv7d.js → runs-table-9OVdfPXZ.js} +2 -2
  138. package/dist/owletto/dist/assets/schema-type-editor-panel-DcJqbCrU.js +2 -0
  139. package/dist/owletto/dist/assets/settings-Cfy9tCOF.js +2 -0
  140. package/dist/owletto/dist/assets/settings-Dg0D_l_w.js +2 -0
  141. package/dist/owletto/dist/assets/skills-oxA7P5Fe.js +2 -0
  142. package/dist/owletto/dist/assets/source-record-panels-BeAZeMLy.js +2 -0
  143. package/dist/owletto/dist/assets/status-dot-_LQZmEIX.js +2 -0
  144. package/dist/owletto/dist/assets/use-automations-DS3uz3pb.js +2 -0
  145. package/dist/owletto/dist/assets/{use-mention-search-Dcunv4L0.js → use-mention-search-CAFbh-Dk.js} +4 -4
  146. package/dist/owletto/dist/assets/use-scroll-sentinel-BpQ70c28.js +2 -0
  147. package/dist/owletto/dist/assets/view-param-filters-FuOZyjMg.js +2 -0
  148. package/dist/owletto/dist/assets/views-access-required-CWwlobOd.js +2 -0
  149. package/dist/owletto/dist/index.html +2 -2
  150. package/dist/server-main.bundle.mjs +44222 -40683
  151. package/npm-shrinkwrap.json +389 -402
  152. package/package.json +1 -1
  153. package/vendor/connector-sdk/dist/browser-requirement.js +1 -1
  154. package/vendor/connector-sdk/dist/connector-types.d.ts +5 -1
  155. package/vendor/connector-sdk/package.json +1 -1
  156. package/vendor/core/dist/agent-tooling.d.ts +8 -0
  157. package/vendor/core/dist/agent-tooling.js +9 -1
  158. package/vendor/core/dist/capabilities.d.ts +1 -1
  159. package/vendor/core/dist/capabilities.js +5 -0
  160. package/vendor/core/dist/contracts/entity-reference.d.ts +3 -0
  161. package/vendor/core/dist/contracts/entity-reference.js +31 -0
  162. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +3 -0
  163. package/vendor/core/dist/contracts/tools/manage-automations.js +3 -0
  164. package/vendor/core/dist/contracts/tools/manage-connections.js +1 -1
  165. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
  166. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +113 -34
  167. package/vendor/core/dist/contracts/tools/manage-entity.js +41 -14
  168. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +13 -4
  169. package/vendor/core/dist/contracts/tools/manage-operations.js +19 -7
  170. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +6 -1
  171. package/vendor/core/dist/contracts/tools/read-knowledge.js +20 -1
  172. package/vendor/core/dist/contracts/tools/view-attach.d.ts +1 -1
  173. package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -0
  174. package/vendor/core/dist/contracts/tools/view-runtime.js +3 -1
  175. package/vendor/core/dist/contracts/worker/device-automation.d.ts +4 -9
  176. package/vendor/core/dist/contracts/worker/device-automation.js +10 -15
  177. package/vendor/core/dist/contracts/worker/protocol.d.ts +20 -0
  178. package/vendor/core/dist/contracts/worker/protocol.js +20 -0
  179. package/vendor/core/dist/reserved.d.ts +6 -3
  180. package/vendor/core/dist/reserved.js +6 -3
  181. package/vendor/core/dist/worker/auth.d.ts +3 -2
  182. package/vendor/core/package.json +6 -1
  183. package/vendor/postgres/cf/src/query.js +3 -1
  184. package/vendor/postgres/cjs/src/query.js +3 -1
  185. package/vendor/postgres/src/query.js +3 -1
  186. package/vendor/views/dist/api.js +31 -7
  187. package/vendor/views/dist/bridge.d.ts +2 -1
  188. package/vendor/views/dist/bridge.js +10 -1
  189. package/vendor/views/package.json +1 -1
  190. package/dist/owletto/dist/assets/_-BorucF19.js +0 -3
  191. package/dist/owletto/dist/assets/_-CkGyNi0G.js +0 -2
  192. package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +0 -2
  193. package/dist/owletto/dist/assets/_agentId-DgRrCE2B.js +0 -2
  194. package/dist/owletto/dist/assets/_automationId-DSrZIYcs.js +0 -2
  195. package/dist/owletto/dist/assets/_connectorKey._connectionId-DWxv1uoi.js +0 -2
  196. package/dist/owletto/dist/assets/_connectorKey.index-BTP5ijdT.js +0 -2
  197. package/dist/owletto/dist/assets/_conversationId-98Y3RuRO.js +0 -2
  198. package/dist/owletto/dist/assets/_deploymentId-B1UWPY0i.js +0 -2
  199. package/dist/owletto/dist/assets/_eventId-BAnr8g8z.js +0 -2
  200. package/dist/owletto/dist/assets/_name-BUfFO_A0.js +0 -2
  201. package/dist/owletto/dist/assets/_owner-C79BwQ0I.js +0 -3
  202. package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +0 -2
  203. package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +0 -2
  204. package/dist/owletto/dist/assets/_slug-DbPdDc-5.js +0 -2
  205. package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +0 -2
  206. package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +0 -2
  207. package/dist/owletto/dist/assets/accept-invitation-UXU5Fx2G.js +0 -2
  208. package/dist/owletto/dist/assets/activity-route-view-D7ORHntE.js +0 -2
  209. package/dist/owletto/dist/assets/agent-card-controls-CplnPhbv.js +0 -2
  210. package/dist/owletto/dist/assets/agent-connect-pages-BmknviTI.js +0 -2
  211. package/dist/owletto/dist/assets/agent-guardrails-route-TdvvIc_J.js +0 -2
  212. package/dist/owletto/dist/assets/agent-permissions-matrix-BkZu1LYE.js +0 -2
  213. package/dist/owletto/dist/assets/agent-skills-route-B3vvvZZe.js +0 -2
  214. package/dist/owletto/dist/assets/agent-subpage-shell-CZJvnjNC.js +0 -2
  215. package/dist/owletto/dist/assets/agents-DAOln24A.js +0 -2
  216. package/dist/owletto/dist/assets/agents-workbench-DJ67GZ93.js +0 -2
  217. package/dist/owletto/dist/assets/app._appId-Cp78oEZ9.js +0 -2
  218. package/dist/owletto/dist/assets/automation-detail-content-DSwbRpbx.js +0 -2
  219. package/dist/owletto/dist/assets/automations-DAOln24A.js +0 -2
  220. package/dist/owletto/dist/assets/callback-CBexCo3F.js +0 -2
  221. package/dist/owletto/dist/assets/client-rows-BYbsXGy9.js +0 -2
  222. package/dist/owletto/dist/assets/clients-BhNl1tVq.js +0 -2
  223. package/dist/owletto/dist/assets/connect-wx-qqLir.js +0 -2
  224. package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +0 -2
  225. package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +0 -2
  226. package/dist/owletto/dist/assets/connected._clientId.activity-BqprYeOX.js +0 -2
  227. package/dist/owletto/dist/assets/connected._clientId.index-DhRoSzBr.js +0 -2
  228. package/dist/owletto/dist/assets/connections-browser-CrtnAs0Q.js +0 -2
  229. package/dist/owletto/dist/assets/connector-scope-lists-CRFEpSvk.js +0 -2
  230. package/dist/owletto/dist/assets/conversations-table-D_HOe1jN.js +0 -2
  231. package/dist/owletto/dist/assets/create-C4lptGWj.js +0 -2
  232. package/dist/owletto/dist/assets/create-CCjZxIkK.js +0 -2
  233. package/dist/owletto/dist/assets/create-DkgUQAbB.js +0 -2
  234. package/dist/owletto/dist/assets/create-automation-form-Bpy92SM5.js +0 -3
  235. package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +0 -2
  236. package/dist/owletto/dist/assets/deployments-C5hvipQh.js +0 -2
  237. package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +0 -2
  238. package/dist/owletto/dist/assets/deployments-body-DGII20dQ.js +0 -2
  239. package/dist/owletto/dist/assets/device-pin-tombstone-2U0UMu3_.js +0 -2
  240. package/dist/owletto/dist/assets/device._deviceId-Bn37UpWH.js +0 -2
  241. package/dist/owletto/dist/assets/entity-options-Clz_WXK-.js +0 -2
  242. package/dist/owletto/dist/assets/entity-page-D3e4iPle.js +0 -2
  243. package/dist/owletto/dist/assets/entity-type-page-DebN1vCM.js +0 -2
  244. package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +0 -2
  245. package/dist/owletto/dist/assets/filter-editors-Bwhqj7lY.js +0 -2
  246. package/dist/owletto/dist/assets/guardrails-BiJollCA.js +0 -2
  247. package/dist/owletto/dist/assets/identity-HCFWtdaI.js +0 -2
  248. package/dist/owletto/dist/assets/index-8wxsyxqt.js +0 -2
  249. package/dist/owletto/dist/assets/index-9YuSRymd.js +0 -7950
  250. package/dist/owletto/dist/assets/index-B3c-0eZG.js +0 -2
  251. package/dist/owletto/dist/assets/index-BSH07yVD.css +0 -1
  252. package/dist/owletto/dist/assets/index-BX0EA_oB.js +0 -2
  253. package/dist/owletto/dist/assets/index-CDz3-ieP.js +0 -12
  254. package/dist/owletto/dist/assets/index-CdJJaQDX.js +0 -2
  255. package/dist/owletto/dist/assets/index-CfT_W8Vo.js +0 -2
  256. package/dist/owletto/dist/assets/index-CxF2XXzl.js +0 -2
  257. package/dist/owletto/dist/assets/index-D3WHeGql.js +0 -2
  258. package/dist/owletto/dist/assets/index-DMNzF8Lf.js +0 -2
  259. package/dist/owletto/dist/assets/index-DyB3IzOA.js +0 -2
  260. package/dist/owletto/dist/assets/index-Vcq4gwWv.js +0 -2
  261. package/dist/owletto/dist/assets/index-fgAJydgX.js +0 -2
  262. package/dist/owletto/dist/assets/json-diff-DIN5Jhfx.js +0 -4
  263. package/dist/owletto/dist/assets/login-DxGYyE4n.js +0 -2
  264. package/dist/owletto/dist/assets/memory-browse-page-BnuhLJ6X.css +0 -1
  265. package/dist/owletto/dist/assets/memory-browse-page-D_UlBa27.js +0 -103
  266. package/dist/owletto/dist/assets/models-BAVeysNq.js +0 -2
  267. package/dist/owletto/dist/assets/new-C2av0diq.js +0 -2
  268. package/dist/owletto/dist/assets/new-snm1ctHn.js +0 -2
  269. package/dist/owletto/dist/assets/organization-Cb0W823y.js +0 -2
  270. package/dist/owletto/dist/assets/peek-pane-content-BNR9ImQY.js +0 -2
  271. package/dist/owletto/dist/assets/permissions-Dv39zWKt.js +0 -2
  272. package/dist/owletto/dist/assets/proposal-review-shell-CFhOqCLf.js +0 -2
  273. package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +0 -2
  274. package/dist/owletto/dist/assets/recent-QhnLDU1_.js +0 -2
  275. package/dist/owletto/dist/assets/record-activity-ZJntBfN_.js +0 -2
  276. package/dist/owletto/dist/assets/record-field-peek-Brh1IQGy.js +0 -2
  277. package/dist/owletto/dist/assets/runs-panel-C0_DNTcq.js +0 -2
  278. package/dist/owletto/dist/assets/schema-value-normalization-CKdPjdPC.js +0 -97
  279. package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +0 -2
  280. package/dist/owletto/dist/assets/settings-VDNiffKU.js +0 -2
  281. package/dist/owletto/dist/assets/skills-DgDGscm5.js +0 -2
  282. package/dist/owletto/dist/assets/source-record-panels-BdfOVPWn.js +0 -2
  283. package/dist/owletto/dist/assets/view-param-filters-B0quibBi.js +0 -2
  284. /package/vendor/postgres/{.bun-tag-2f292c6554a8475e → .bun-tag-22d644c2873790db} +0 -0
@@ -33,7 +33,7 @@ export function whatsAppWebAdapterProgram() {
33
33
  // when this number moves: shipping a fix under the old number leaves every
34
34
  // already-open tab running the previous code with nothing to show for it.
35
35
  // Keep in lockstep with WHATSAPP_ADAPTER_VERSION in whatsapp-web-helpers.ts.
36
- const ADAPTER_VERSION = 26;
36
+ const ADAPTER_VERSION = 27;
37
37
  const SOURCE_ERROR_ID = "whatsapp-web:source-observation-error";
38
38
  // Storage rows one `chat:` read examines; a whole personal history is
39
39
  // usually under this, so one read answers.
@@ -57,13 +57,18 @@ export function whatsAppWebAdapterProgram() {
57
57
  if (existing?.version === ADAPTER_VERSION) {
58
58
  return;
59
59
  }
60
- existing?.detach?.();
60
+ existing?.detach?.(undefined, "WhatsApp adapter was replaced; recovery is required");
61
61
  const listeners = new Map();
62
62
 
63
- function detach(bindingId) {
63
+ function detach(bindingId, reason) {
64
64
  const selected = bindingId ? [listeners.get(bindingId)] : [...listeners.values()];
65
65
  for (const state of selected) {
66
66
  if (!state) continue;
67
+ if (reason) {
68
+ state.error = reason;
69
+ state.post({ sequence: ++state.sequence, record: { id: SOURCE_ERROR_ID, source_error: reason } });
70
+ }
71
+ for (const entry of state.pending.values()) entry.reject?.(new Error(reason ?? "Source listener was detached"));
67
72
  state.collection.off("add", state.onAdd);
68
73
  state.collection.off("change", state.onChange);
69
74
  window.removeEventListener("message", state.onReply);
@@ -71,7 +76,19 @@ export function whatsAppWebAdapterProgram() {
71
76
  }
72
77
  }
73
78
 
79
+ function assertAccount(account) {
80
+ if (typeof account !== "string" || !account || widString(meUser()) !== account) {
81
+ throw new Error("WhatsApp saved account changed or is unavailable; reconnect this connection");
82
+ }
83
+ }
84
+
85
+ async function digest(value) {
86
+ const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
87
+ return Array.from(new Uint8Array(bytes), byte => byte.toString(16).padStart(2, "0")).join("");
88
+ }
89
+
74
90
  function listen(request) {
91
+ assertAccount(request.account_id);
75
92
  const collection = requireFirst(["WAWebCollections"])?.Msg;
76
93
  if (typeof collection?.on !== "function" || typeof collection?.off !== "function") {
77
94
  throw new Error("WhatsApp message observation is unavailable in this build");
@@ -94,7 +111,8 @@ export function whatsAppWebAdapterProgram() {
94
111
  });
95
112
  };
96
113
  const resident = listeners.get(request.bridge_id);
97
- const previous = resident?.request.chat_filter === request.chat_filter
114
+ const previous = resident?.request.account_id === request.account_id
115
+ && resident?.request.chat_filter === request.chat_filter
98
116
  && resident?.request.minimum_timestamp === request.minimum_timestamp ? resident : null;
99
117
  detach(request.bridge_id);
100
118
  // A new listener identity fences pending normalization from the detached
@@ -116,8 +134,10 @@ export function whatsAppWebAdapterProgram() {
116
134
  const sequence = ++state.sequence;
117
135
  // A throwing model getter must reach the error record below, not escape
118
136
  // the collection handler, so the reference is read inside the promise.
119
- void new Promise((resolve) => resolve(messageReference(model))).then((record) => {
120
- if (listeners.get(state.id) !== state || !record || record.timestamp <= 0) return;
137
+ void new Promise((resolve) => { assertAccount(state.request.account_id); resolve(messageReference(model)); }).then((record) => {
138
+ if (listeners.get(state.id) !== state) return;
139
+ assertAccount(state.request.account_id);
140
+ if (!record || record.timestamp <= 0) return;
121
141
  if (state.request.chat_filter === "group" && !record.is_group) return;
122
142
  if (state.request.chat_filter === "individual" && record.is_group) return;
123
143
  if (state.request.minimum_timestamp != null && record.timestamp < state.request.minimum_timestamp) return;
@@ -160,6 +180,11 @@ export function whatsAppWebAdapterProgram() {
160
180
  if (event.source !== window || event.origin !== location.origin || event.data?.token !== state.token) return;
161
181
  if (event.data.type === "lobu-feed-record:stop") { detach(state.id); return; }
162
182
  if (event.data.type !== "lobu-feed-record:ack") return;
183
+ try { assertAccount(state.request.account_id); }
184
+ catch {
185
+ detach(state.id, "WhatsApp saved account changed; recovery is required");
186
+ return;
187
+ }
163
188
  for (const [id, entry] of state.pending) {
164
189
  if (entry.sequence !== event.data.sequence) continue;
165
190
  if (event.data.ok) {
@@ -192,7 +217,12 @@ export function whatsAppWebAdapterProgram() {
192
217
  async function publishChanges(request) {
193
218
  const state = listeners.get(request.bridge_id);
194
219
  if (!state || state.token !== request.token) throw new Error("Source listener is unavailable");
195
- const record = request.batch;
220
+ assertAccount(state.request.account_id);
221
+ // Include the complete transition, not just row positions: a hydrated
222
+ // placeholder can change a batch while its insertion cursor stays fixed.
223
+ const record = { ...request.batch, id: `replay:${await digest(JSON.stringify([request.transition ?? null, request.batch]))}` };
224
+ if (listeners.get(state.id) !== state) throw new Error("Source listener was replaced");
225
+ assertAccount(state.request.account_id);
196
226
  const bytes = new TextEncoder().encode(JSON.stringify(record)).length;
197
227
  const previous = state.pending.get(record.id);
198
228
  if (bytes > MAX_RECORD_BYTES || state.pendingBytes - (previous?.bytes ?? 0) + bytes > MAX_BUFFER_BYTES ||
@@ -360,10 +390,14 @@ export function whatsAppWebAdapterProgram() {
360
390
  return { id, timestamp: unixSeconds(row), is_group: remote.endsWith("@g.us") };
361
391
  }
362
392
 
363
- /** Resume insertion order after reconnect without exporting any message body. */
393
+ /** Replay retained routing metadata; row IDs alone do not survive a rebuild. */
364
394
  async function observeMessages(input = {}) {
365
395
  const after = input.after ?? null;
366
396
  if (after !== null && (!Number.isSafeInteger(after) || after < 0)) throw new Error("Invalid WhatsApp observation cursor");
397
+ const pending = input.unresolved ?? [];
398
+ if (!Array.isArray(pending) || pending.length > 32 || pending.some(row =>
399
+ !Number.isSafeInteger(row.position) || row.position <= 0 || typeof row.id !== "string" || row.id.length > 512 ||
400
+ !Number.isSafeInteger(row.first_seen) || row.first_seen < 0)) throw new Error("Invalid WhatsApp pending placeholder cursor");
367
401
  const database = await new Promise((resolve, reject) => {
368
402
  const request = indexedDB.open("model-storage");
369
403
  request.onupgradeneeded = () => { request.transaction.abort(); reject(new Error("WhatsApp source history database is unavailable")); };
@@ -371,48 +405,82 @@ export function whatsAppWebAdapterProgram() {
371
405
  request.onblocked = () => reject(new Error("WhatsApp source history database is blocked"));
372
406
  request.onsuccess = () => resolve(request.result);
373
407
  });
374
- let rows;
408
+ const now = Math.floor(Date.now() / 1000);
409
+ const gaps = [];
410
+ const gap = (reason, detail) => gaps.push({ reason, detail });
411
+ const scan = (position, limit, direction = "next", inclusive = false) => new Promise((resolve, reject) => {
412
+ const transaction = database.transaction("message", "readonly");
413
+ transaction.onabort = () => reject(transaction.error ?? new Error("WhatsApp source observation aborted"));
414
+ const index = transaction.objectStore("message").index("rowId");
415
+ const request = index.openCursor(position === null ? null : IDBKeyRange.lowerBound(position, !inclusive), direction);
416
+ const page = [];
417
+ request.onerror = () => reject(request.error);
418
+ request.onsuccess = () => {
419
+ const cursor = request.result;
420
+ if (!cursor) { resolve(page); return; }
421
+ if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== "string" || cursor.value.id.length > 512) {
422
+ reject(new Error("WhatsApp source history has an unsupported key layout")); return;
423
+ }
424
+ page.push({ position: cursor.key, id: cursor.value.id, timestamp: unixSeconds(cursor.value), type: cursor.value.type });
425
+ if (page.length >= limit) resolve(page); else cursor.continue();
426
+ };
427
+ });
428
+ let rows, rechecks;
375
429
  try {
376
- rows = await new Promise((resolve, reject) => {
377
- const transaction = database.transaction("message", "readonly");
378
- transaction.onabort = () => reject(transaction.error ?? new Error("WhatsApp source observation aborted"));
379
- const index = transaction.objectStore("message").index("rowId");
380
- const request = index.openCursor(after === null ? null : IDBKeyRange.lowerBound(after, true), after === null ? "prev" : "next");
381
- const page = [];
382
- request.onerror = () => reject(request.error);
383
- request.onsuccess = () => {
384
- const cursor = request.result;
385
- if (!cursor) { resolve(page); return; }
386
- if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== "string") {
387
- reject(new Error("WhatsApp source history has an unsupported key layout")); return;
388
- }
389
- page.push({ position: cursor.key, id: cursor.value.id, timestamp: unixSeconds(cursor.value), type: cursor.value.type });
390
- if (after === null || page.length > 500) resolve(page);
391
- else cursor.continue();
392
- };
393
- });
430
+ if (after === null) {
431
+ rows = await scan(null, 1, "prev");
432
+ const head = rows[0];
433
+ return { after: head?.position ?? 0, anchor: head?.id ?? null,
434
+ unresolved: head?.timestamp === 0 ? [{ position: head.position, id: head.id, first_seen: now }] : [],
435
+ references: [], gaps: [], hasMore: false };
436
+ }
437
+ let start = after;
438
+ if (after > 0) {
439
+ const [anchor] = await scan(after, 1, "next", true);
440
+ if (!input.anchor || anchor?.position !== after || anchor.id !== input.anchor) {
441
+ gap("history-continuity", [after, input.anchor ?? null]);
442
+ start = 0;
443
+ }
444
+ }
445
+ rechecks = await Promise.all(pending.map(async item => ({ item, row: (await scan(item.position, 1, "next", true))[0] })));
446
+ rows = await scan(start, 501);
394
447
  } finally { database.close(); }
395
- if (after === null) return { after: rows[0]?.position ?? 0, references: [], hasMore: false };
396
448
  const page = rows.slice(0, 500);
397
- const references = [];
398
- if (page.length) {
399
- const keys = requireFirst(["WAWebMsgKey"]);
400
- if (typeof keys?.fromString !== "function") throw new Error("WhatsApp source message keys are unavailable");
401
- for (const row of page) {
402
- // IndexedDB already contains routing and time metadata. Loading message
403
- // models would hydrate private content and fails for status entries.
404
- const reference = messageReference({ id: keys.fromString(row.id), t: row.timestamp, type: row.type });
405
- if (!reference) continue;
406
- // Timestamp-zero rows are source placeholders, not messages. A later
407
- // hydration change is also observed by the reference listener.
408
- if (reference.timestamp <= 0) continue;
409
- if (reference.timestamp < input.started_at) continue;
410
- if (input.chat_filter === "group" && !reference.is_group) continue;
411
- if (input.chat_filter === "individual" && reference.is_group) continue;
412
- references.push(reference);
449
+ const references = new Map();
450
+ const unresolved = new Map();
451
+ const keys = requireFirst(["WAWebMsgKey"]);
452
+ if ((page.length || rechecks.length) && typeof keys?.fromString !== "function") throw new Error("WhatsApp source message keys are unavailable");
453
+ const accept = (row, firstSeen = now) => {
454
+ const reference = messageReference({ id: keys.fromString(row.id), t: row.timestamp, type: row.type });
455
+ if (!reference) return;
456
+ if (input.chat_filter === "group" && !reference.is_group) return;
457
+ if (input.chat_filter === "individual" && reference.is_group) return;
458
+ if (reference.timestamp <= 0) {
459
+ if (now - firstSeen >= 7 * 24 * 60 * 60) gap("placeholder-expired", [row.position, row.id, firstSeen]);
460
+ else if (unresolved.size < 32 || unresolved.has(row.id)) unresolved.set(row.id, { position: row.position, id: row.id, first_seen: firstSeen });
461
+ else gap("placeholder-capacity", [row.position, row.id]);
462
+ return;
413
463
  }
464
+ if (reference.timestamp >= input.started_at) references.set(reference.id, reference);
465
+ };
466
+ const checked = new Set();
467
+ for (const { item, row } of rechecks) {
468
+ if (!row || row.position !== item.position || row.id !== item.id) gap("placeholder-unavailable", [item.position, item.id]);
469
+ else { checked.add(item.id); accept(row, item.first_seen); }
414
470
  }
415
- return { after: page[page.length - 1]?.position ?? after, references, hasMore: rows.length > 500 };
471
+ for (const row of page) if (!checked.has(row.id)) accept(row);
472
+ const last = page[page.length - 1];
473
+ const rebased = gaps.some(item => item.reason === "history-continuity");
474
+ return {
475
+ after: last?.position ?? (rebased ? 0 : after),
476
+ anchor: last?.id ?? (rebased ? null : input.anchor ?? null),
477
+ unresolved: [...unresolved.values()], references: [...references.values()], hasMore: rows.length > 500,
478
+ gaps: await Promise.all(gaps.map(async item => {
479
+ const identity = await digest(JSON.stringify([input.account_id, input.started_at, input.chat_filter, item]));
480
+ return { id: `gap:${identity}`, event_type: "source.gap", resource_type: "message",
481
+ resource_ref: `whatsapp:${item.reason}:${identity}` };
482
+ })),
483
+ };
416
484
  }
417
485
 
418
486
  function models(collection) {
@@ -933,7 +1001,7 @@ export function whatsAppWebAdapterProgram() {
933
1001
  * `id:<message ID>` read is the exception: ids are unique, so it walks
934
1002
  * history until that message and answers in one read.
935
1003
  */
936
- async function readMessages(input = {}) {
1004
+ async function readMessages(input = {}, account) {
937
1005
  const query = String(input.query ?? "").trim();
938
1006
  const chatFilter = input.chat_filter ?? "all";
939
1007
  const limit = Math.min(100, Math.max(1, Math.trunc(Number(input.limit) || 50)));
@@ -941,7 +1009,7 @@ export function whatsAppWebAdapterProgram() {
941
1009
  if (input.cursor) {
942
1010
  const cursor = JSON.parse(input.cursor);
943
1011
  if (cursor.v !== 1 || !Number.isSafeInteger(cursor.before) || cursor.before <= 0 ||
944
- cursor.query !== query || cursor.chat_filter !== chatFilter) {
1012
+ cursor.query !== query || cursor.chat_filter !== chatFilter || cursor.account !== account) {
945
1013
  throw new Error("Invalid WhatsApp source cursor or changed query scope");
946
1014
  }
947
1015
  before = cursor.before;
@@ -1051,7 +1119,7 @@ export function whatsAppWebAdapterProgram() {
1051
1119
  return {
1052
1120
  results,
1053
1121
  hasMore,
1054
- ...(hasMore ? { nextCursor: JSON.stringify({ v: 1, before: last.position, query, chat_filter: chatFilter }) } : {}),
1122
+ ...(hasMore ? { nextCursor: JSON.stringify({ v: 1, before: last.position, query, chat_filter: chatFilter, account }) } : {}),
1055
1123
  };
1056
1124
  }
1057
1125
 
@@ -1166,7 +1234,7 @@ export function whatsAppWebAdapterProgram() {
1166
1234
  };
1167
1235
  }
1168
1236
 
1169
- async function draftMessage(input) {
1237
+ async function draftMessage(input, account) {
1170
1238
  const collections = requireFirst(["WAWebCollections"]);
1171
1239
  const chat = await resolveChat(collections, input);
1172
1240
  const text = String(input?.text ?? "");
@@ -1187,11 +1255,13 @@ export function whatsAppWebAdapterProgram() {
1187
1255
  ]) {
1188
1256
  if (typeof fn !== "function") continue;
1189
1257
  try {
1258
+ assertAccount(account);
1190
1259
  await fn.call(module, chat, draft);
1191
1260
  applied = true;
1192
1261
  break;
1193
1262
  } catch {
1194
1263
  try {
1264
+ assertAccount(account);
1195
1265
  await fn.call(module, draft, chat);
1196
1266
  applied = true;
1197
1267
  break;
@@ -1201,6 +1271,7 @@ export function whatsAppWebAdapterProgram() {
1201
1271
  }
1202
1272
  }
1203
1273
  if (!applied && typeof chat?.setDraft === "function") {
1274
+ assertAccount(account);
1204
1275
  await chat.setDraft(draft);
1205
1276
  applied = true;
1206
1277
  }
@@ -1220,7 +1291,7 @@ export function whatsAppWebAdapterProgram() {
1220
1291
  };
1221
1292
  }
1222
1293
 
1223
- async function sendMessage(input) {
1294
+ async function sendMessage(input, account) {
1224
1295
  const collections = requireFirst(["WAWebCollections"]);
1225
1296
  const chat = await resolveChat(collections, input);
1226
1297
  const text = String(input?.text ?? "");
@@ -1241,6 +1312,7 @@ export function whatsAppWebAdapterProgram() {
1241
1312
  const plannedId = rawId(data?.id);
1242
1313
  if (!plannedId)
1243
1314
  throw new Error("WhatsApp did not assign an id to the outgoing message");
1315
+ assertAccount(account);
1244
1316
  await module.addAndSendTextMsg(chat, data);
1245
1317
  return {
1246
1318
  sent: true,
@@ -1254,6 +1326,7 @@ export function whatsAppWebAdapterProgram() {
1254
1326
  throw new Error(
1255
1327
  "WhatsApp send capability is unavailable in this web build"
1256
1328
  );
1329
+ assertAccount(account);
1257
1330
  const result =
1258
1331
  fn === chat?.sendMessage
1259
1332
  ? await fn.call(chat, text)
@@ -1308,7 +1381,7 @@ export function whatsAppWebAdapterProgram() {
1308
1381
  return message;
1309
1382
  }
1310
1383
 
1311
- async function editMessage(input) {
1384
+ async function editMessage(input, account) {
1312
1385
  const collections = requireFirst(["WAWebCollections"]);
1313
1386
  const message = resolveMessage(collections, input?.message_id);
1314
1387
  const before = modelData(message);
@@ -1339,6 +1412,7 @@ export function whatsAppWebAdapterProgram() {
1339
1412
  // `canEditText(chat)` check fail and reject with "Cannot edit message",
1340
1413
  // an error that reads like the message was ineligible when in fact it
1341
1414
  // was being handed the wrong object.
1415
+ assertAccount(account);
1342
1416
  await (fn === message?.edit
1343
1417
  ? fn.call(message, text)
1344
1418
  : fn.call(module, message, text, {}));
@@ -1355,7 +1429,7 @@ export function whatsAppWebAdapterProgram() {
1355
1429
  };
1356
1430
  }
1357
1431
 
1358
- async function reactMessage(input) {
1432
+ async function reactMessage(input, account) {
1359
1433
  const collections = requireFirst(["WAWebCollections"]);
1360
1434
  const message = resolveMessage(collections, input?.message_id);
1361
1435
  const emoji = input?.remove ? "" : String(input?.emoji ?? "");
@@ -1368,6 +1442,7 @@ export function whatsAppWebAdapterProgram() {
1368
1442
  throw new Error(
1369
1443
  "WhatsApp reaction capability is unavailable in this web build"
1370
1444
  );
1445
+ assertAccount(account);
1371
1446
  await (fn === message?.react
1372
1447
  ? fn.call(message, emoji)
1373
1448
  : fn.call(module, message, emoji));
@@ -1410,7 +1485,7 @@ export function whatsAppWebAdapterProgram() {
1410
1485
  };
1411
1486
  }
1412
1487
 
1413
- async function revokeMessage(input) {
1488
+ async function revokeMessage(input, account) {
1414
1489
  const collections = requireFirst(["WAWebCollections"]);
1415
1490
  const message = resolveMessage(collections, input?.message_id);
1416
1491
  const before = modelData(message);
@@ -1440,6 +1515,7 @@ export function whatsAppWebAdapterProgram() {
1440
1515
  throw new Error(
1441
1516
  "WhatsApp revoke capability is unavailable in this web build"
1442
1517
  );
1518
+ assertAccount(account);
1443
1519
  if (fn === message?.sendRevoke || fn === message?.revoke)
1444
1520
  await fn.call(message);
1445
1521
  else await fn.call(module, [message], modelData(message).id?.remote);
@@ -1474,9 +1550,16 @@ export function whatsAppWebAdapterProgram() {
1474
1550
  ? { ok: true, status, capabilities: operationCapabilities() }
1475
1551
  : { ok: false, error: status };
1476
1552
  }
1553
+ assertAccount(request.account_id);
1554
+ const input = { ...request.input, account_id: request.account_id };
1555
+ const finish = async promise => {
1556
+ const value = await promise;
1557
+ assertAccount(request.account_id);
1558
+ return { ok: true, ...value };
1559
+ };
1477
1560
  if (request.op === "listen") return listen(request);
1478
1561
  if (request.op === "publish_changes") return await publishChanges(request);
1479
- if (request.op === "observe_messages") return { ok: true, ...(await observeMessages(request.input)) };
1562
+ if (request.op === "observe_messages") return await finish(observeMessages(input));
1480
1563
  const capabilities = operationCapabilities();
1481
1564
  if (capabilities[request.op] !== true) {
1482
1565
  return {
@@ -1488,24 +1571,27 @@ export function whatsAppWebAdapterProgram() {
1488
1571
  };
1489
1572
  }
1490
1573
  if (request.op === "read_messages")
1491
- return { ok: true, ...(await readMessages(request.input)) };
1574
+ return await finish(readMessages(input, request.account_id));
1492
1575
  if (request.op === "search_messages")
1493
- return { ok: true, ...(await searchMessages(request.input)) };
1576
+ return await finish(searchMessages(input));
1494
1577
  if (request.op === "draft_message")
1495
- return { ok: true, ...(await draftMessage(request.input)) };
1578
+ return await finish(draftMessage(input, request.account_id));
1496
1579
  if (request.op === "send_message")
1497
- return { ok: true, ...(await sendMessage(request.input)) };
1580
+ return await finish(sendMessage(input, request.account_id));
1498
1581
  if (request.op === "edit_message")
1499
- return { ok: true, ...(await editMessage(request.input)) };
1582
+ return await finish(editMessage(input, request.account_id));
1500
1583
  if (request.op === "react_message")
1501
- return { ok: true, ...(await reactMessage(request.input)) };
1584
+ return await finish(reactMessage(input, request.account_id));
1502
1585
  if (request.op === "revoke_message")
1503
- return { ok: true, ...(await revokeMessage(request.input)) };
1586
+ return await finish(revokeMessage(input, request.account_id));
1504
1587
  return {
1505
1588
  ok: false,
1506
1589
  error: { state: "unsupported_operation", reason: String(request?.op) },
1507
1590
  };
1508
1591
  } catch (error) {
1592
+ if (request?.account_id && widString(meUser()) !== request.account_id) {
1593
+ error = new Error("WhatsApp saved account changed or is unavailable; reconnect this connection");
1594
+ }
1509
1595
  return {
1510
1596
  ok: false,
1511
1597
  error: {
@@ -14,7 +14,7 @@ import {
14
14
  WHATSAPP_PHONE_SERVER,
15
15
  } from "./whatsapp-web-identity.js";
16
16
 
17
- export const WHATSAPP_ADAPTER_VERSION = 26;
17
+ export const WHATSAPP_ADAPTER_VERSION = 27;
18
18
  export const WHATSAPP_ORIGIN = "https://web.whatsapp.com";
19
19
 
20
20
  export type ChatFilter = "all" | "individual" | "group";
@@ -50,7 +50,11 @@ export interface WhatsAppMessage {
50
50
 
51
51
  /** Reference-only observation position in WhatsApp's own local message store. */
52
52
  export interface ObservationCheckpoint {
53
- observation?: { after: number; started_at: number; chat_filter: ChatFilter };
53
+ observation?: {
54
+ after: number; started_at: number; chat_filter: ChatFilter;
55
+ account?: string; anchor?: string | null;
56
+ unresolved?: Array<{ position: number; id: string; first_seen: number }>;
57
+ };
54
58
  }
55
59
 
56
60
  export function rawMessageId(value: unknown): string | null {
@@ -61,6 +61,15 @@ interface WhatsAppWebConfig {
61
61
  chat_filter?: ChatFilter;
62
62
  }
63
63
 
64
+ /** Use the same identity namespace as the connection's browser account probe. */
65
+ function requireWhatsAppAccount(ctx: { sessionState?: Record<string, unknown> | null }): string {
66
+ const account = ctx.sessionState?.account_id;
67
+ if (typeof account !== "string" || !/^[0-9]+@(c\.us|s\.whatsapp\.net|lid)$/.test(account)) {
68
+ throw new Error("WhatsApp saved account identity is unavailable; reconnect this connection");
69
+ }
70
+ return account;
71
+ }
72
+
64
73
  /** Adapter failures the bridge can recover from by re-injecting the program. */
65
74
  const REINJECTABLE_STATES = new Set([
66
75
  "adapter_unavailable",
@@ -354,7 +363,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
354
363
  name: "WhatsApp",
355
364
  description:
356
365
  "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.",
357
- version: "2.2.0",
366
+ version: "2.3.0",
358
367
  faviconDomain: "whatsapp.com",
359
368
  authSchema: { methods: [{ type: "browser", mode: "live" }] },
360
369
  browser: {
@@ -386,6 +395,9 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
386
395
  },
387
396
  },
388
397
  capabilities: { replyToSource: true },
398
+ }, {
399
+ key: "source.gap", label: "Source history gap", resourceType: "message",
400
+ description: "WhatsApp local history or an unresolved placeholder could not be recovered completely. Read retained messages separately; this is not a new message.",
389
401
  }],
390
402
  feeds: {
391
403
  live_messages: {
@@ -395,7 +407,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
395
407
  "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.",
396
408
  read: (ctx) => this.readMessages(ctx),
397
409
  observe: (ctx) => this.observeMessages(ctx),
398
- webhook: { mode: "trigger", events: ["message.created"] },
410
+ webhook: { mode: "trigger", events: ["message.created", "source.gap"] },
399
411
  configSchema: {
400
412
  type: "object",
401
413
  properties: {
@@ -593,14 +605,25 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
593
605
  };
594
606
 
595
607
  private async observeMessages(ctx: FeedObserveContext<ObservationCheckpoint, WhatsAppWebConfig>): Promise<void> {
608
+ const account = requireWhatsAppAccount(ctx);
609
+ if (ctx.checkpoint?.observation?.account && ctx.checkpoint.observation.account !== account) {
610
+ throw new Error("WhatsApp checkpoint belongs to a different saved account");
611
+ }
596
612
  const dispatcher = requireBrowser(ctx);
597
613
  const tabId = await readyWhatsAppTab(dispatcher);
598
614
  const chatFilter = ctx.config.chat_filter ?? "all";
599
615
  const previous = ctx.checkpoint?.observation?.chat_filter === chatFilter ? ctx.checkpoint.observation : undefined;
600
616
  const startedAt = previous?.started_at ?? Math.floor(Date.now() / 1000);
617
+ type Replay = {
618
+ after: number; anchor?: string | null;
619
+ unresolved?: NonNullable<ObservationCheckpoint["observation"]>["unresolved"];
620
+ references: Array<{ id: string; timestamp: number }>; hasMore: boolean;
621
+ gaps?: Array<{ id: string; event_type: string; resource_type: string; resource_ref: string }>;
622
+ };
601
623
  // Snapshot before attaching so replay covers messages arriving during setup.
602
- let after = previous?.after ?? (await invokeAdapter<{ after: number }>(
603
- dispatcher, tabId, { op: "observe_messages", input: {} })).after;
624
+ let position = previous ?? await invokeAdapter<Replay>(dispatcher, tabId, {
625
+ op: "observe_messages", account_id: account, input: {},
626
+ });
604
627
  const binding = await dispatcher.dispatch<{
605
628
  bridge_id: string; token: string; listening?: boolean; subscription?: { scope_key: string };
606
629
  }>("feed_listen", { tab_id: tabId });
@@ -608,37 +631,43 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
608
631
  throw new Error("A browser supporting source subscriptions is required for WhatsApp");
609
632
  }
610
633
  await invokeAdapter(dispatcher, tabId, {
611
- op: "listen", bridge_id: binding.bridge_id, token: binding.token,
634
+ op: "listen", account_id: account, bridge_id: binding.bridge_id, token: binding.token,
612
635
  chat_filter: chatFilter, minimum_timestamp: startedAt,
613
636
  });
614
637
  let cursor = ctx.checkpoint ?? null;
615
638
  for (let page = 0; page < 10; page++) {
616
- const replay = await invokeAdapter<{
617
- after: number; references: Array<{ id: string; timestamp: number }>; hasMore: boolean;
618
- }>(dispatcher, tabId, { op: "observe_messages", input: { after, started_at: startedAt, chat_filter: chatFilter } });
639
+ const replay = await invokeAdapter<Replay>(dispatcher, tabId, {
640
+ op: "observe_messages", account_id: account,
641
+ input: { after: position.after, anchor: position.anchor, unresolved: position.unresolved,
642
+ started_at: startedAt, chat_filter: chatFilter },
643
+ });
619
644
  const next: ObservationCheckpoint = {
620
- observation: { after: replay.after, started_at: startedAt, chat_filter: chatFilter },
645
+ observation: { after: replay.after, started_at: startedAt, chat_filter: chatFilter,
646
+ account, anchor: replay.anchor ?? null, unresolved: replay.unresolved ?? [] },
621
647
  };
622
- const events = replay.references.map(reference => ({
648
+ const events = [...(replay.gaps ?? []), ...replay.references.map(reference => ({
623
649
  id: reference.id, event_type: "message.created", resource_type: "message",
624
650
  resource_ref: reference.id, occurred_at: new Date(reference.timestamp * 1000).toISOString(),
625
- }));
651
+ }))];
626
652
  // Earlier chunks may be replayed after interruption; existing signal
627
653
  // dedupe handles them. Advance only after the entire page is accepted.
628
- const batches = splitReferenceBatches(events, (slice, isLast, offset) => ({
629
- id: `replay:${chatFilter}:${startedAt}:${after}:${replay.after}:${offset}`,
654
+ // The page adapter hashes the entire batch before buffering it, including
655
+ // placeholders and predecessor, so unchanged row positions cannot collide.
656
+ const batches = splitReferenceBatches(events, (slice, isLast) => ({
657
+ // Reserve the final SHA-256 record ID when enforcing the byte limit.
658
+ id: `replay:${"0".repeat(64)}`,
630
659
  events: slice,
631
660
  ...(isLast ? { checkpoint: { previous: cursor, next } } : {}),
632
661
  more: isLast && replay.hasMore && page === 9,
633
662
  }));
634
663
  for (const batch of batches) {
635
664
  await invokeAdapter(dispatcher, tabId, {
636
- op: "publish_changes", bridge_id: binding.bridge_id, token: binding.token, batch,
665
+ op: "publish_changes", account_id: account, bridge_id: binding.bridge_id, token: binding.token, batch, transition: { previous: cursor, next },
637
666
  });
638
667
  }
639
668
  if (!replay.hasMore) return;
640
669
  cursor = next;
641
- after = replay.after;
670
+ position = next.observation!;
642
671
  }
643
672
  }
644
673
 
@@ -648,6 +677,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
648
677
  // Source message time cannot represent edits, revokes, or delayed arrivals.
649
678
  // Automations subscribe to new-message references and read content by ID.
650
679
  assertNoWindow(ctx, "WhatsApp live reads do not support change-time windows; subscribe to message.created and read references by id:<message ID>.");
680
+ const account = requireWhatsAppAccount(ctx);
651
681
  const dispatcher = requireBrowser(ctx);
652
682
  const tabId = await readyWhatsAppTab(dispatcher);
653
683
  const response = await invokeAdapter<{
@@ -655,7 +685,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
655
685
  nextCursor?: string;
656
686
  hasMore: boolean;
657
687
  }>(dispatcher, tabId, {
658
- op: "read_messages",
688
+ op: "read_messages", account_id: account,
659
689
  input: {
660
690
  query: ctx.query,
661
691
  cursor: ctx.cursor,
@@ -692,12 +722,13 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
692
722
  return { success: false, error: `Unknown action: ${action}` };
693
723
  }
694
724
  try {
725
+ const account = requireWhatsAppAccount(ctx);
695
726
  const dispatcher = requireBrowser(ctx);
696
727
  const tabId = await readyWhatsAppTab(dispatcher);
697
728
  const response = await invokeAdapter<Record<string, unknown>>(
698
729
  dispatcher,
699
730
  tabId,
700
- { op: action, input: ctx.input ?? {} }
731
+ { op: action, account_id: account, input: ctx.input ?? {} }
701
732
  );
702
733
  if (action === "search_messages") {
703
734
  return {