@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
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Reddit Connector (V1 runtime)
3
3
  *
4
- * Fetches posts and comments from Reddit subreddits or search queries.
5
- * Supports both authenticated (OAuth) and unauthenticated (public JSON API) modes.
4
+ * Fetches posts and comments from Reddit subreddits or search queries, and the
5
+ * connected user's home feed. Supports both authenticated (OAuth) and
6
+ * unauthenticated (public JSON API) modes.
6
7
  */
7
8
 
8
9
  import {
@@ -16,6 +17,7 @@ import {
16
17
  type SyncContext,
17
18
  type SyncResult,
18
19
  } from '@lobu/connector-sdk';
20
+ import addFormats from 'ajv-formats';
19
21
 
20
22
  // ---------------------------------------------------------------------------
21
23
  // Reddit API types
@@ -71,6 +73,16 @@ interface RedditCheckpoint {
71
73
  pagination_cutoff?: string;
72
74
  }
73
75
 
76
+ // Use the gateway's URI format check: WHATWG URL parsing also accepts non-URI characters.
77
+ const isUri = addFormats.get('uri') as (value: string) => boolean;
78
+
79
+ /** Metadata declares these fields `format: uri`; one bad value rejects the whole batch. */
80
+ function httpUrl(value: string | undefined): string | undefined {
81
+ if (!value || !isUri(value) || !URL.canParse(value)) return undefined;
82
+ const { protocol } = new URL(value);
83
+ return protocol === 'http:' || protocol === 'https:' ? value : undefined;
84
+ }
85
+
74
86
  // ---------------------------------------------------------------------------
75
87
  // Connector
76
88
  // ---------------------------------------------------------------------------
@@ -79,8 +91,9 @@ export default class RedditConnector extends ConnectorRuntime {
79
91
  readonly definition: RuntimeConnectorDefinition = {
80
92
  key: 'reddit',
81
93
  name: 'Reddit',
82
- description: 'Fetches posts and comments from Reddit subreddits or search queries.',
83
- version: '1.0.0',
94
+ description:
95
+ "Fetches posts and comments from Reddit subreddits or search queries, and the connected user's home feed.",
96
+ version: '1.2.1',
84
97
  faviconDomain: 'reddit.com',
85
98
  authSchema: {
86
99
  methods: [
@@ -88,6 +101,7 @@ export default class RedditConnector extends ConnectorRuntime {
88
101
  type: 'oauth',
89
102
  provider: 'reddit',
90
103
  requiredScopes: ['identity', 'read', 'history'],
104
+ loginScopes: ['identity'],
91
105
  setupInstructions:
92
106
  '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.',
93
107
  },
@@ -238,6 +252,48 @@ export default class RedditConnector extends ConnectorRuntime {
238
252
  },
239
253
  },
240
254
  },
255
+ home_feed: {
256
+ key: 'home_feed',
257
+ name: 'Home feed',
258
+ sync: (ctx) => this.syncFeed(ctx),
259
+ description:
260
+ "Fetch the connected user's personalized home feed (Best). Requires user OAuth.",
261
+ displayNameTemplate: 'Reddit home feed',
262
+ configSchema: {
263
+ type: 'object',
264
+ properties: {
265
+ lookback_days: {
266
+ type: 'integer',
267
+ minimum: 1,
268
+ maximum: 30,
269
+ default: 7,
270
+ description: 'Skip home feed posts older than this many days.',
271
+ },
272
+ },
273
+ },
274
+ eventKinds: {
275
+ post: {
276
+ description: "A Reddit post from the connected user's home feed",
277
+ metadataSchema: {
278
+ type: 'object',
279
+ properties: {
280
+ subreddit: { type: 'string' },
281
+ score: { type: 'number', description: 'Reddit score (upvotes - downvotes)' },
282
+ num_comments: { type: 'number' },
283
+ upvote_ratio: { type: 'number' },
284
+ is_self: { type: 'boolean' },
285
+ domain: { type: 'string' },
286
+ thumbnail: { type: 'string', format: 'uri', description: 'Preview thumbnail URL' },
287
+ media_url: {
288
+ type: 'string',
289
+ format: 'uri',
290
+ description: 'Linked content URL for non-self posts (image, video, article)',
291
+ },
292
+ },
293
+ },
294
+ },
295
+ },
296
+ },
241
297
  },
242
298
  };
243
299
 
@@ -253,17 +309,20 @@ export default class RedditConnector extends ConnectorRuntime {
253
309
  const subreddit = ctx.config.subreddit as string | undefined;
254
310
  const searchTerms = ctx.config.search_terms as string | undefined;
255
311
  const isUserFeed = ctx.feedKey === 'user_activity';
256
- const contentType = isUserFeed ? 'overview' : ctx.feedKey === 'comments' ? 'comment' : 'post';
257
- const lookbackDays = (ctx.config.lookback_days as number) ?? 365;
312
+ // Best is ranked, not chronological: old posts interleave with new ones and
313
+ // a saved `after` anchor is meaningless once the ranking moves.
314
+ const isHomeFeed = ctx.feedKey === 'home_feed';
315
+ const contentType = isUserFeed
316
+ ? 'overview'
317
+ : isHomeFeed
318
+ ? 'home'
319
+ : ctx.feedKey === 'comments'
320
+ ? 'comment'
321
+ : 'post';
322
+ const lookbackDays = (ctx.config.lookback_days as number) ?? (isHomeFeed ? 7 : 365);
258
323
 
259
324
  // Resolve access token: user OAuth > app-only OAuth > unauthenticated
260
325
  const userAccessToken = ctx.credentials?.accessToken ?? null;
261
- let accessToken: string | undefined = userAccessToken ?? undefined;
262
- if (!accessToken) {
263
- accessToken = await this.getAppOnlyToken(ctx);
264
- }
265
- const baseUrl = accessToken ? 'https://oauth.reddit.com' : 'https://www.reddit.com';
266
-
267
326
  let username: string | undefined;
268
327
  if (isUserFeed) {
269
328
  if (!userAccessToken) {
@@ -273,9 +332,18 @@ export default class RedditConnector extends ConnectorRuntime {
273
332
  }
274
333
  username = await this.resolveUsername(ctx, userAccessToken);
275
334
  }
335
+ if (isHomeFeed && !userAccessToken) {
336
+ throw new Error('home_feed requires user OAuth. Connect Reddit with the read scope.');
337
+ }
338
+
339
+ let accessToken: string | undefined = userAccessToken ?? undefined;
340
+ if (!accessToken) {
341
+ accessToken = await this.getAppOnlyToken(ctx);
342
+ }
343
+ const baseUrl = accessToken ? 'https://oauth.reddit.com' : 'https://www.reddit.com';
276
344
 
277
345
  const previous = (ctx.checkpoint ?? {}) as RedditCheckpoint;
278
- const resumeAfter = previous.pagination_token ?? null;
346
+ const resumeAfter = isHomeFeed ? null : (previous.pagination_token ?? null);
279
347
  let cutoffDate = new Date();
280
348
  cutoffDate.setDate(cutoffDate.getDate() - lookbackDays);
281
349
  // Keep items eligible for the whole bounded sweep, even across sync runs.
@@ -355,6 +423,7 @@ export default class RedditConnector extends ConnectorRuntime {
355
423
  const itemDate = new Date(itemData.created_utc * 1000);
356
424
 
357
425
  if (itemDate < cutoffDate) {
426
+ if (isHomeFeed) continue;
358
427
  reachedCutoff = true;
359
428
  break;
360
429
  }
@@ -388,8 +457,9 @@ export default class RedditConnector extends ConnectorRuntime {
388
457
 
389
458
  const checkpoint: RedditCheckpoint = {
390
459
  last_timestamp: new Date().toISOString(),
391
- pagination_token: !reachedCutoff ? (after ?? undefined) : undefined,
392
- pagination_cutoff: !reachedCutoff && after ? cutoffDate.toISOString() : undefined,
460
+ pagination_token: !reachedCutoff && !isHomeFeed ? (after ?? undefined) : undefined,
461
+ pagination_cutoff:
462
+ !reachedCutoff && !isHomeFeed && after ? cutoffDate.toISOString() : undefined,
393
463
  };
394
464
 
395
465
  await ctx.commit(events, checkpoint as Record<string, unknown>);
@@ -498,6 +568,10 @@ export default class RedditConnector extends ConnectorRuntime {
498
568
  return `${baseUrl}/user/${encodeURIComponent(username)}/overview${jsonSuffix}?limit=100&sort=new${afterParam}`;
499
569
  }
500
570
 
571
+ if (contentType === 'home') {
572
+ return `${baseUrl}/best${jsonSuffix}?limit=100${afterParam}`;
573
+ }
574
+
501
575
  if (contentType === 'comment') {
502
576
  // Comments from a subreddit
503
577
  if (subredditPath) {
@@ -541,11 +615,9 @@ export default class RedditConnector extends ConnectorRuntime {
541
615
  });
542
616
 
543
617
  // For non-self posts, the Reddit `url` field points to the linked content (image, article, etc.)
544
- const mediaUrl = !post.is_self ? post.url : undefined;
545
- const thumbnail =
546
- post.thumbnail && !['self', 'default', 'nsfw', 'spoiler', ''].includes(post.thumbnail)
547
- ? post.thumbnail
548
- : undefined;
618
+ const mediaUrl = !post.is_self ? httpUrl(post.url) : undefined;
619
+ // `thumbnail` also carries placeholder words ("self", "image", "nsfw", ...).
620
+ const thumbnail = httpUrl(post.thumbnail);
549
621
 
550
622
  return {
551
623
  origin_id: `reddit_post_${post.name}`,
@@ -65,6 +65,7 @@ const SLACK_BOT_SCOPES = [
65
65
  const SLACK_BOT_EVENTS = [
66
66
  "app_home_opened",
67
67
  "app_mention",
68
+ "assistant_thread_started",
68
69
  "member_joined_channel",
69
70
  "member_left_channel",
70
71
  "message.channels",
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Pure takeout parsing/formatting helpers for the LinkedIn data-export feeds
3
+ * (`linkedin.ts`, `linkedin-takeout.ts`).
4
+ *
5
+ * ISOLATE-SAFE BY CONTRACT: this module must never import `node:fs`,
6
+ * `node:path`, or any other builtin the isolate prelude does not provide.
7
+ * Connector bundles run in a V8 isolate and `assertIsolateEligible` rejects the
8
+ * WHOLE bundle over one surviving builtin `require`, so an `fs` import here
9
+ * would take down the live browser feeds of every connector that shares these
10
+ * helpers — the LinkedIn regression in Lobu#3392.
11
+ *
12
+ * `node:crypto` is fine: the guest prelude serves it from `global.crypto`
13
+ * (see ISOLATE_PRELUDE_PROVIDED_BUILTINS).
14
+ *
15
+ * The CSV reader is injected into the connector (see its constructor), never
16
+ * imported, so no filesystem code reaches the bundle.
17
+ */
18
+
19
+ import { createHash } from "node:crypto";
20
+ import type { EventEnvelope } from "@lobu/connector-sdk";
21
+
22
+ const DEFAULT_WATERMARK = "1970-01-01T00:00:00.000Z";
23
+ const DEFAULT_BATCH_SIZE = 1000;
24
+
25
+ export interface LocalTakeoutConfig {
26
+ takeout_dir?: string;
27
+ batch_size?: number;
28
+ }
29
+
30
+ export function batchSize(config: LocalTakeoutConfig): number {
31
+ return Math.max(1, Math.min(config.batch_size ?? DEFAULT_BATCH_SIZE, 5000));
32
+ }
33
+
34
+ export function takeBatch<T extends EventEnvelope>(
35
+ events: T[],
36
+ watermark: string | undefined,
37
+ max: number
38
+ ): T[] {
39
+ const after = watermark ?? DEFAULT_WATERMARK;
40
+ return events
41
+ .filter((event) => eventCursor(event) > after)
42
+ .sort((a, b) => eventCursor(a).localeCompare(eventCursor(b)))
43
+ .slice(0, max);
44
+ }
45
+
46
+ export function maxEventCursor(
47
+ events: EventEnvelope[],
48
+ fallback?: string
49
+ ): string {
50
+ return events.reduce(
51
+ (max, event) => (eventCursor(event) > max ? eventCursor(event) : max),
52
+ fallback ?? DEFAULT_WATERMARK
53
+ );
54
+ }
55
+
56
+ // Composite watermark: ISO timestamp + origin_id so events sharing a second
57
+ // still order deterministically. The delimiter is persisted inside the jsonb
58
+ // checkpoint column, so it must NOT be NUL: Postgres rejects NUL in jsonb
59
+ // (unsupported Unicode escape sequence). \u0001 (SOH) sorts before every
60
+ // printable char (preserving timestamp-first ordering) and is jsonb-safe.
61
+ const CURSOR_DELIMITER = "\u0001";
62
+
63
+ function eventCursor(event: EventEnvelope): string {
64
+ return `${event.occurred_at.toISOString()}${CURSOR_DELIMITER}${event.origin_id}`;
65
+ }
66
+
67
+ export function stableId(
68
+ prefix: string,
69
+ parts: Array<string | number | undefined>
70
+ ): string {
71
+ const hash = createHash("sha256")
72
+ .update(parts.map((part) => String(part ?? "")).join("\0"))
73
+ .digest("hex")
74
+ .slice(0, 32);
75
+ return `${prefix}_${hash}`;
76
+ }
77
+
78
+ export function stripHtml(html: string): string {
79
+ return decodeHtml(htmlToPlainText(html))
80
+ .replace(/\n{3,}/g, "\n\n")
81
+ .replace(/[ \t]{2,}/g, " ")
82
+ .trim();
83
+ }
84
+
85
+ function htmlToPlainText(html: string): string {
86
+ let output = "";
87
+ let index = 0;
88
+ const lowerHtml = html.toLowerCase();
89
+
90
+ while (index < html.length) {
91
+ const char = html[index];
92
+ if (char !== "<") {
93
+ output += char;
94
+ index += 1;
95
+ continue;
96
+ }
97
+
98
+ const tagEnd = html.indexOf(">", index + 1);
99
+ if (tagEnd === -1) {
100
+ output += char;
101
+ index += 1;
102
+ continue;
103
+ }
104
+
105
+ const tagName = readTagName(html.slice(index + 1, tagEnd));
106
+ if (tagName === "script" || tagName === "style") {
107
+ const closeTagStart = lowerHtml.indexOf(`</${tagName}`, tagEnd + 1);
108
+ if (closeTagStart === -1) {
109
+ break;
110
+ }
111
+ const closeTagEnd = html.indexOf(">", closeTagStart + tagName.length + 2);
112
+ index = closeTagEnd === -1 ? html.length : closeTagEnd + 1;
113
+ continue;
114
+ }
115
+
116
+ if (tagName === "br" || isBlockBreakTag(tagName)) {
117
+ output += "\n";
118
+ }
119
+ index = tagEnd + 1;
120
+ }
121
+
122
+ return output;
123
+ }
124
+
125
+ function readTagName(tag: string): string {
126
+ let index = tag[0] === "/" ? 1 : 0;
127
+ while (tag[index] === " " || tag[index] === "\t" || tag[index] === "\n") {
128
+ index += 1;
129
+ }
130
+
131
+ let name = "";
132
+ while (index < tag.length) {
133
+ const char = tag[index]?.toLowerCase();
134
+ if (!char || !isAsciiNameChar(char)) {
135
+ break;
136
+ }
137
+ name += char;
138
+ index += 1;
139
+ }
140
+ return name;
141
+ }
142
+
143
+ function isAsciiNameChar(char: string): boolean {
144
+ return (
145
+ (char >= "a" && char <= "z") || (char >= "0" && char <= "9") || char === "-"
146
+ );
147
+ }
148
+
149
+ function isBlockBreakTag(tagName: string): boolean {
150
+ return (
151
+ tagName === "p" ||
152
+ tagName === "div" ||
153
+ tagName === "li" ||
154
+ tagName === "h1" ||
155
+ tagName === "h2" ||
156
+ tagName === "h3" ||
157
+ tagName === "h4" ||
158
+ tagName === "h5" ||
159
+ tagName === "h6"
160
+ );
161
+ }
162
+
163
+ export function decodeHtml(text: string): string {
164
+ return text.replace(
165
+ /&(nbsp|amp|quot|#039|apos|#\d+|#x[0-9a-f]+);/gi,
166
+ (entity, code) => {
167
+ const normalized = String(code).toLowerCase();
168
+ if (normalized === "nbsp") return " ";
169
+ if (normalized === "amp") return "&";
170
+ if (normalized === "quot") return '"';
171
+ if (normalized === "#039" || normalized === "apos") return "'";
172
+ if (normalized.startsWith("#x")) {
173
+ const codePoint = Number.parseInt(normalized.slice(2), 16);
174
+ return decodeHtmlCodePoint(codePoint, entity);
175
+ }
176
+ if (normalized.startsWith("#")) {
177
+ const codePoint = Number(normalized.slice(1));
178
+ return decodeHtmlCodePoint(codePoint, entity);
179
+ }
180
+ return entity;
181
+ }
182
+ );
183
+ }
184
+
185
+ function decodeHtmlCodePoint(codePoint: number, fallback: string): string {
186
+ if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {
187
+ return fallback;
188
+ }
189
+ if (codePoint === 60 || codePoint === 62) {
190
+ return fallback;
191
+ }
192
+ return String.fromCodePoint(codePoint);
193
+ }
194
+
195
+ export function parseCsv(text: string): Record<string, string>[] {
196
+ const rows: string[][] = [];
197
+ let row: string[] = [];
198
+ let cell = "";
199
+ let inQuotes = false;
200
+
201
+ for (let i = 0; i < text.length; i++) {
202
+ const char = text[i];
203
+ const next = text[i + 1];
204
+ if (char === '"') {
205
+ if (inQuotes && next === '"') {
206
+ cell += '"';
207
+ i++;
208
+ } else {
209
+ inQuotes = !inQuotes;
210
+ }
211
+ } else if (char === "," && !inQuotes) {
212
+ row.push(cell);
213
+ cell = "";
214
+ } else if ((char === "\n" || char === "\r") && !inQuotes) {
215
+ if (char === "\r" && next === "\n") i++;
216
+ row.push(cell);
217
+ if (row.some((value) => value.trim().length > 0)) rows.push(row);
218
+ row = [];
219
+ cell = "";
220
+ } else {
221
+ cell += char;
222
+ }
223
+ }
224
+ row.push(cell);
225
+ if (row.some((value) => value.trim().length > 0)) rows.push(row);
226
+
227
+ const headerIndex = rows.findIndex((candidate) => {
228
+ const values = candidate.map((value) => value.trim()).filter(Boolean);
229
+ return values.length > 1 && !values[0]?.startsWith("Notes:");
230
+ });
231
+ if (headerIndex < 0) return [];
232
+ const headers = rows[headerIndex].map((value) => value.trim());
233
+ return rows.slice(headerIndex + 1).map((values) => {
234
+ const record: Record<string, string> = {};
235
+ headers.forEach((header, index) => {
236
+ record[header] = values[index]?.trim() ?? "";
237
+ });
238
+ return record;
239
+ });
240
+ }
@@ -1,14 +1,14 @@
1
1
  // Serialized into the paired browser. Read only the inbox's own loaded records
2
2
  // and read loaders; never return provider clients, tickets, or arbitrary state.
3
3
  export async function tiktokInboxPage(input) {
4
- const fail = message => { throw new Error(`TikTok inbox: ${message}`); };
4
+ const fail = (message, reason) => { throw Object.assign(new Error(`TikTok inbox: ${message}`), reason ? { browser_interruption: reason } : {}); };
5
5
  const visible = element => !!element?.getClientRects().length;
6
6
  const account = () => {
7
7
  if (location.origin !== "https://www.tiktok.com") fail("Wrong page origin");
8
- if (visible(document.querySelector("#captcha-verify-container-main-page"))) fail("Verification required in the connected browser");
8
+ if (visible(document.querySelector("#captcha-verify-container-main-page"))) fail("Verification required in the connected browser", "challenge_required");
9
9
  const raw = document.querySelector("#__UNIVERSAL_DATA_FOR_REHYDRATION__")?.textContent;
10
10
  const user = raw && JSON.parse(raw).__DEFAULT_SCOPE__?.["webapp.app-context"]?.user;
11
- if (typeof user?.uid !== "string" || !/^\d+$/.test(user.uid)) fail("Sign-in is required");
11
+ if (typeof user?.uid !== "string" || !/^\d+$/.test(user.uid)) fail("Sign-in is required", "login_required");
12
12
  return user.uid;
13
13
  };
14
14
  const owner = account();
@@ -16,12 +16,12 @@ export async function tiktokInboxPage(input) {
16
16
  const pause = () => new Promise(resolve => setTimeout(resolve, 100));
17
17
  const wait = async read => {
18
18
  while (Date.now() < deadline) {
19
- if (account() !== owner) fail("Account changed during the read");
19
+ if (account() !== owner) fail("Account changed during the read", "account_mismatch");
20
20
  const value = read();
21
21
  if (value) return value;
22
22
  await pause();
23
23
  }
24
- fail("Inbox did not finish loading; restart this page read");
24
+ fail("Inbox did not finish loading; restart this page read", "loading_failure");
25
25
  };
26
26
  const readWithinDeadline = async read => {
27
27
  let outcome;
@@ -47,7 +47,7 @@ export async function tiktokInboxPage(input) {
47
47
  const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(row)));
48
48
  return { ...row, source_revision: [...new Uint8Array(bytes)].map(byte => byte.toString(16).padStart(2, "0")).join("") };
49
49
  }));
50
- if (account() !== owner) fail("Account changed during the read");
50
+ if (account() !== owner) fail("Account changed during the read", "account_mismatch");
51
51
  return { rows: revised, hasMore: !!next, ...(next ? { nextCursor: JSON.stringify({ v: feed === "messages" ? 2 : 1, feed, account: owner, ...next }) } : {}) };
52
52
  };
53
53
  // React attaches the source record and loading state to these exact inbox
@@ -162,7 +162,7 @@ export async function tiktokInboxPage(input) {
162
162
  return null;
163
163
  };
164
164
  const api = await wait(clientApi);
165
- if (api.instance.ctx?.option?.userId !== owner) fail("Message client belongs to a different account");
165
+ if (api.instance.ctx?.option?.userId !== owner) fail("Message client belongs to a different account", "account_mismatch");
166
166
  await wait(() => {
167
167
  if (api.stateStore.isInitError || api.stateStore.isNotAvailable) fail("Message initialization failed");
168
168
  return api.stateStore.isInitSucceeded && api.stateStore.isInitLoadDone;
@@ -175,7 +175,7 @@ export async function tiktokInboxPage(input) {
175
175
  const snapshot = [...ids].sort();
176
176
  const finish = async (rows, next) => {
177
177
  const output = await result(rows, next);
178
- if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
178
+ if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read", "account_mismatch");
179
179
  const latest = api.instance.getConversationList();
180
180
  if (!Array.isArray(latest) || JSON.stringify(latest.map(thread => thread.id).sort()) !== JSON.stringify(snapshot)) fail("Conversation set changed; restart the read, previous coverage is incomplete");
181
181
  return output;
@@ -204,7 +204,7 @@ export async function tiktokInboxPage(input) {
204
204
  };
205
205
  for (let page = 0; page < 20; page++) {
206
206
  await wait(() => !thread.isPullingMessages);
207
- if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
207
+ if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read", "account_mismatch");
208
208
  const messages = thread.getMessageList().map(project).sort((a,b) => b.occurred_at.localeCompare(a.occurred_at) || b.id.localeCompare(a.id));
209
209
  const start = cursor.after ? messages.findIndex(message => message.id === cursor.after) + 1 : 0;
210
210
  if ((cursor.after && !start) || start === messages.length && thread.hasMoreMessages) {
@@ -1,10 +1,11 @@
1
1
  // Self-contained browser adapter. Serialized into the user's paired browser;
2
2
  // keep every dependency inside this function, as in the WhatsApp page adapter.
3
3
  export async function tiktokPage(command, args = {}) {
4
+ const interrupt = (reason, message) => { throw Object.assign(new Error(message), { browser_interruption: reason }); };
4
5
  const visible = (e) => !!e && e.getClientRects().length > 0;
5
6
  const assertNoChallenge = () => {
6
7
  if (visible(document.querySelector("#captcha-verify-container-main-page"))) {
7
- throw new Error("TikTok verification required; complete the challenge in the connected browser");
8
+ interrupt("challenge_required", "TikTok verification required; complete the challenge in the connected browser");
8
9
  }
9
10
  };
10
11
  assertNoChallenge();
@@ -19,27 +20,36 @@ export async function tiktokPage(command, args = {}) {
19
20
  };
20
21
  const wait = async (read) => {
21
22
  for (let i = 0; i < 40; i++) {
23
+ assertNoChallenge();
22
24
  const value = read();
23
25
  if (value) return value;
24
26
  await new Promise(resolve => setTimeout(resolve, 250));
25
27
  }
26
- throw new Error("TikTok page did not expose the requested content; it may be loading, signed out, or unavailable");
28
+ interrupt("loading_failure", "TikTok page did not expose the requested content");
27
29
  };
28
30
  if (command === "identity") {
29
- try { return await wait(identity); } catch { return null; }
31
+ try { return await wait(identity); } catch (error) {
32
+ if (error.browser_interruption !== "loading_failure") throw error;
33
+ return null;
34
+ }
30
35
  }
31
- if (!identity()) throw new Error("TikTok sign-in is required");
32
- const assertFollowing = () => {
33
- if (location.origin !== "https://www.tiktok.com" || location.pathname !== "/following") throw new Error("TikTok Following page changed");
36
+ const owner = identity()?.accountId;
37
+ if (!owner) interrupt("login_required", "TikTok sign-in is required");
38
+ if (command === "read_failure") interrupt("loading_failure", "TikTok page did not finish loading the requested content");
39
+ const assertTimeline = (path) => {
40
+ if (location.origin !== "https://www.tiktok.com" || location.pathname !== path) throw new Error("TikTok timeline page changed");
34
41
  assertNoChallenge();
35
- if (!identity()) throw new Error("TikTok sign-in is required");
42
+ if (!identity()) interrupt("login_required", "TikTok sign-in is required");
43
+ if (identity().accountId !== owner) interrupt("account_mismatch", "TikTok account changed during the read");
36
44
  };
37
- if (command === "following_status" || command === "following_wait") {
38
- assertFollowing();
45
+ const assertFollowing = () => assertTimeline("/following");
46
+ if (["following_status", "following_wait", "for_you_status", "for_you_wait"].includes(command)) {
47
+ const path = command.startsWith("following_") ? "/following" : "/";
48
+ assertTimeline(path);
39
49
  document.querySelectorAll("video,audio").forEach(media => { media.muted = true; });
40
- if (command === "following_wait") {
50
+ if (command.endsWith("_wait")) {
41
51
  await new Promise(resolve => setTimeout(resolve, 250));
42
- assertFollowing();
52
+ assertTimeline(path);
43
53
  }
44
54
  return { ready: true };
45
55
  }
@@ -94,10 +104,6 @@ export async function tiktokPage(command, args = {}) {
94
104
  if (seen.size < args.limit && hasMore) throw new Error(`TikTok Following read incomplete: collected ${seen.size} of ${args.limit} requested posts; retry the read`);
95
105
  return { items: [...items.values()] };
96
106
  }
97
- if (command === "snapshot") {
98
- const d = scope();
99
- return { items: (d["webapp.updated-items"] || []).map(project) };
100
- }
101
107
  if (command === "post_links") {
102
108
  // Hidden preload links appear before search results render. Their presence
103
109
  // satisfies wait_for_selector but cannot establish readable coverage.