@lobu/runtime-server 24.11.0 → 24.12.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 (275) hide show
  1. package/dist/catalogs/connectors.json +1113 -107
  2. package/dist/catalogs/skills.json +2 -2
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +2 -2
  5. package/dist/connectors/chat-transport-actions.ts +50 -0
  6. package/dist/connectors/discord.ts +2 -0
  7. package/dist/connectors/gchat.ts +2 -0
  8. package/dist/connectors/github.ts +4 -4
  9. package/dist/connectors/google_drive.ts +20 -0
  10. package/dist/connectors/google_gmail.ts +49 -8
  11. package/dist/connectors/herdr.ts +1 -1
  12. package/dist/connectors/imessage.ts +1 -0
  13. package/dist/connectors/linkedin-browser-script.ts +11 -0
  14. package/dist/connectors/linkedin-draft-page.js +24 -8
  15. package/dist/connectors/linkedin-inbox-adapter.js +209 -19
  16. package/dist/connectors/linkedin-inbox.ts +152 -4
  17. package/dist/connectors/linkedin-network.ts +788 -0
  18. package/dist/connectors/linkedin-search.ts +1284 -0
  19. package/dist/connectors/linkedin.ts +892 -27
  20. package/dist/connectors/microsoft_outlook.ts +57 -19
  21. package/dist/connectors/rss.ts +179 -33
  22. package/dist/connectors/slack.ts +2 -0
  23. package/dist/connectors/source-file-attachment.ts +46 -0
  24. package/dist/connectors/teams.ts +2 -0
  25. package/dist/connectors/telegram.ts +2 -0
  26. package/dist/connectors/tiktok_web.ts +1 -1
  27. package/dist/connectors/whatsapp.ts +2 -0
  28. package/dist/connectors/whatsapp_web.ts +3 -3
  29. package/dist/connectors/x-dm-adapter.js +8 -10
  30. package/dist/connectors/x.ts +8 -9
  31. package/dist/db/migrations/20261115040000_account_two_factor.sql +20 -0
  32. package/dist/db/migrations/20261115120000_events_unbound_tool_audit_without_bridge.sql +40 -0
  33. package/dist/db/migrations/20261115120001_events_unbound_tool_audit_validate.sql +19 -0
  34. package/dist/db/migrations/20261115120002_drop_events_linked_org_ids.sql +119 -0
  35. package/dist/db/migrations/20261115130000_entities_retired_type_idx.sql +34 -0
  36. package/dist/db/migrations/20261115140000_entity_identities_personal_owner_idx.sql +34 -0
  37. package/dist/db/migrations/20261117090000_write_policy_kind_note.sql +65 -0
  38. package/dist/db/migrations/20261117120000_app_policy_principal.sql +48 -0
  39. package/dist/db/migrations/20261117170000_personal_org_connector_auto_policy_backfill.sql +57 -0
  40. package/dist/db/migrations/20261117190000_org_slug_reserved_paths.sql +29 -0
  41. package/dist/db/migrations/20261118120000_workspace_view_top_level_paths.sql +69 -0
  42. package/dist/db/migrations/preconditions/20261117190000_org_slug_reserved_paths.sql +14 -0
  43. package/dist/db/migrations/preconditions/20261118120000_workspace_view_top_level_paths.sql +21 -0
  44. package/dist/dependencies.bun.lock +51 -46
  45. package/dist/guest.bundle.js +11 -2
  46. package/dist/owletto/dist/assets/_-BC9j6MkU.js +2 -0
  47. package/dist/owletto/dist/assets/_-Z1u1cIe6.js +3 -0
  48. package/dist/owletto/dist/assets/_agentId-B-TFq9TP.js +2 -0
  49. package/dist/owletto/dist/assets/{_agentId-CGScf8z_.js → _agentId-BGatZWsd.js} +2 -2
  50. package/dist/owletto/dist/assets/_automationId-CMUrWPvr.js +2 -0
  51. package/dist/owletto/dist/assets/_connectorKey._connectionId-CUoAoP0_.js +2 -0
  52. package/dist/owletto/dist/assets/_connectorKey.index-Bs49QGGH.js +2 -0
  53. package/dist/owletto/dist/assets/_conversationId-CszP1den.js +2 -0
  54. package/dist/owletto/dist/assets/_eventId-C0AZUBnD.js +2 -0
  55. package/dist/owletto/dist/assets/_owner-B4ydA75k.js +3 -0
  56. package/dist/owletto/dist/assets/_shape-C4-ikE70.js +2 -0
  57. package/dist/owletto/dist/assets/_slug-DE5J3KVu.js +2 -0
  58. package/dist/owletto/dist/assets/_viewKey-Dkcd8JQC.js +2 -0
  59. package/dist/owletto/dist/assets/{accept-invitation-BKeIzZXE.js → accept-invitation-DmrQQu_W.js} +2 -2
  60. package/dist/owletto/dist/assets/{activity-route-location-sLvKaSCa.js → activity-route-location-Bec6fW-t.js} +2 -2
  61. package/dist/owletto/dist/assets/activity-route-view-DCSNBKZU.js +2 -0
  62. package/dist/owletto/dist/assets/agent-client-connections-xvabPpi6.js +4 -0
  63. package/dist/owletto/dist/assets/agent-connect-pages-DDPtkcmq.js +6 -0
  64. package/dist/owletto/dist/assets/{agent-editor-form-DVFyyMyd.js → agent-editor-form-BrhQbHZg.js} +2 -2
  65. package/dist/owletto/dist/assets/{agent-loading-shells-BLNHIy-r.js → agent-loading-shells-D3y98xuO.js} +2 -2
  66. package/dist/owletto/dist/assets/{agent-permissions-matrix-UBKRR5vs.js → agent-permissions-matrix-jQJjSa9i.js} +2 -2
  67. package/dist/owletto/dist/assets/{agent-skill-context-fqedKd0D.js → agent-skill-context-CCcknBYE.js} +2 -2
  68. package/dist/owletto/dist/assets/{agent-subpage-shell-BUCoY2Nf.js → agent-subpage-shell-6f_53cSf.js} +2 -2
  69. package/dist/owletto/dist/assets/agent-thread-v_lSSnJi.js +6 -0
  70. package/dist/owletto/dist/assets/{app._appId-ByIypCL9.js → app._appId-CKWzZ2ic.js} +2 -2
  71. package/dist/owletto/dist/assets/assist-composer-Q9ZJjAta.js +2 -0
  72. package/dist/owletto/dist/assets/automation-run-now-Dl0MKx3N.js +2 -0
  73. package/dist/owletto/dist/assets/{callback-Pz5uS-k7.js → callback-Bentv78L.js} +2 -2
  74. package/dist/owletto/dist/assets/{card-CAPpY9P5.js → card-C4oPCVh6.js} +2 -2
  75. package/dist/owletto/dist/assets/{claim-DgWWK0KI.js → claim-B3C4qIi2.js} +2 -2
  76. package/dist/owletto/dist/assets/client-activity-scopes-DqaFEyir.js +2 -0
  77. package/dist/owletto/dist/assets/{client-rows-Dd5YV8vn.js → client-rows-rse9thnk.js} +2 -2
  78. package/dist/owletto/dist/assets/{clients-Bf7ZgGro.js → clients-BhPMbxHi.js} +2 -2
  79. package/dist/owletto/dist/assets/{code-editor-z1Sy_hiX.js → code-editor-CTdKUDPY.js} +2 -2
  80. package/dist/owletto/dist/assets/connect-D8o7HBlo.js +2 -0
  81. package/dist/owletto/dist/assets/connect-menu-D5EZvSHb.js +2 -0
  82. package/dist/owletto/dist/assets/connect._clientId-Dbagcg9L.js +2 -0
  83. package/dist/owletto/dist/assets/connected._clientId-DALW9S2K.js +2 -0
  84. package/dist/owletto/dist/assets/connection-DyxzSqVE.js +2 -0
  85. package/dist/owletto/dist/assets/connection-feed-detail-LqpxUCdy.js +2 -0
  86. package/dist/owletto/dist/assets/{connector-page-shell-an3SYLim.js → connector-page-shell-DZjKv9zQ.js} +2 -2
  87. package/dist/owletto/dist/assets/{connector-provenance-mSZCOud-.js → connector-provenance-DtTJn1Nk.js} +2 -2
  88. package/dist/owletto/dist/assets/connectors-BVl-AR33.js +2 -0
  89. package/dist/owletto/dist/assets/{consent-1ulwyJ3k.js → consent-XCqsHLxS.js} +2 -2
  90. package/dist/owletto/dist/assets/{core.esm-Ctg_pXLe.js → core.esm-B1du4Zwy.js} +3 -3
  91. package/dist/owletto/dist/assets/create-BYKCtGL4.js +2 -0
  92. package/dist/owletto/dist/assets/create-D6Mmuxcq.js +2 -0
  93. package/dist/owletto/dist/assets/{create-CGuoqPh8.js → create-GHTb6wKX.js} +2 -2
  94. package/dist/owletto/dist/assets/{create-automation-form-CD6jSlWL.js → create-automation-form-CTiy_S9G.js} +3 -3
  95. package/dist/owletto/dist/assets/create._connectorKey-DMH97KkK.js +2 -0
  96. package/dist/owletto/dist/assets/custom-guardrail-edits-DZy66ucV.js +2 -0
  97. package/dist/owletto/dist/assets/definition-comparison-C2mPfIMD.js +2 -0
  98. package/dist/owletto/dist/assets/detail-page-skeleton-DNBL7nyk.js +2 -0
  99. package/dist/owletto/dist/assets/device-CwP1PY8q.js +2 -0
  100. package/dist/owletto/dist/assets/{device-pin-tombstone-Dkj7hrBE.js → device-pin-tombstone-DYTt7kU5.js} +2 -2
  101. package/dist/owletto/dist/assets/device._deviceId-DZ2kqI4Y.js +2 -0
  102. package/dist/owletto/dist/assets/{entity-options-D4t-NAcg.js → entity-options-D9K_5Lcs.js} +2 -2
  103. package/dist/owletto/dist/assets/entity-page-DggKXrcE.js +2 -0
  104. package/dist/owletto/dist/assets/entity-pages-C6M6yKFf.js +2 -0
  105. package/dist/owletto/dist/assets/{entity-schema-graph-Cq96SJ3c.js → entity-schema-graph-B255NKjF.js} +2 -2
  106. package/dist/owletto/dist/assets/entity-type-page-CGBAP2wt.js +2 -0
  107. package/dist/owletto/dist/assets/event-attachments-D8Z8uwv9.js +2 -0
  108. package/dist/owletto/dist/assets/event-detail-CgG3pDLA.js +2 -0
  109. package/dist/owletto/dist/assets/events-feed-ClhEywwV.js +2 -0
  110. package/dist/owletto/dist/assets/{filter-editors-DGVl9U4D.js → filter-editors-D_Sfn0dv.js} +3 -3
  111. package/dist/owletto/dist/assets/{full-page-spinner-CtVlF8GQ.js → full-page-spinner-C1clibUY.js} +2 -2
  112. package/dist/owletto/dist/assets/{index-CK5GDX4B.js → index-04B26s6E.js} +2 -2
  113. package/dist/owletto/dist/assets/index-2HrEO-nl.js +2 -0
  114. package/dist/owletto/dist/assets/index-BU3k9wpw.js +2 -0
  115. package/dist/owletto/dist/assets/{index-DvuJ_S_o.js → index-BXHqp23o.js} +2 -2
  116. package/dist/owletto/dist/assets/index-BdLRUDIR.js +2 -0
  117. package/dist/owletto/dist/assets/index-C2FrGwYN.js +2 -0
  118. package/dist/owletto/dist/assets/index-CB9wGfUm.js +2 -0
  119. package/dist/owletto/dist/assets/index-Caihaftb.js +2 -0
  120. package/dist/owletto/dist/assets/index-CwH59DJV.js +2 -0
  121. package/dist/owletto/dist/assets/index-DB2lVKuV.js +7908 -0
  122. package/dist/owletto/dist/assets/{index-DbjbHlDe.js → index-DTvJRjrM.js} +2 -2
  123. package/dist/owletto/dist/assets/index-SF2ni1Rs.css +1 -0
  124. package/dist/owletto/dist/assets/{index-BifR-LE9.js → index-mSrdbx3C.js} +9 -9
  125. package/dist/owletto/dist/assets/index-uFn-Ilrx.js +2 -0
  126. package/dist/owletto/dist/assets/{json-diff-OjtREegr.js → json-diff-Ce6YAXzY.js} +2 -2
  127. package/dist/owletto/dist/assets/{list-skeleton-CH0qQBYk.js → list-skeleton-DLPBTnbR.js} +2 -2
  128. package/dist/owletto/dist/assets/login-DeWlvogD.js +2 -0
  129. package/dist/owletto/dist/assets/{logout-DfdgOLoM.js → logout-CJY0ceN9.js} +2 -2
  130. package/dist/owletto/dist/assets/{member-scope-gate-Cxg2zGQT.js → member-scope-gate-CBPMprXu.js} +2 -2
  131. package/dist/owletto/dist/assets/memory-browse-page-D5kj1RaR.js +74 -0
  132. package/dist/owletto/dist/assets/{model-selector-D2OpDkwH.js → model-selector-CjkBPpjN.js} +2 -2
  133. package/dist/owletto/dist/assets/new-BKrNkOQD.js +2 -0
  134. package/dist/owletto/dist/assets/new-BetiMuDq.js +2 -0
  135. package/dist/owletto/dist/assets/new-dk_-eXqU.js +2 -0
  136. package/dist/owletto/dist/assets/new-efN--4Wx.js +2 -0
  137. package/dist/owletto/dist/assets/organization-C3rpwx_d.js +2 -0
  138. package/dist/owletto/dist/assets/pdf-document--AN-oCKj.css +1 -0
  139. package/dist/owletto/dist/assets/pdf-document-2W1q0sRA.js +56 -0
  140. package/dist/owletto/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
  141. package/dist/owletto/dist/assets/peek-pane-content-ChsBWO0P.js +3 -0
  142. package/dist/owletto/dist/assets/{pending-seed-BBACroge.js → pending-seed-CTKYdA4X.js} +2 -2
  143. package/dist/owletto/dist/assets/proposal-review-shell-EyGWEYwQ.js +2 -0
  144. package/dist/owletto/dist/assets/public-shell-ready-_KWdfzEM.js +2 -0
  145. package/dist/owletto/dist/assets/record-session-D27VNxP_.js +2 -0
  146. package/dist/owletto/dist/assets/{renderer-CTKNMcXP.js → renderer-B8yZ5lql.js} +34 -33
  147. package/dist/owletto/dist/assets/{reset-password-DKBEneyR.js → reset-password-BGVJIh2I.js} +2 -2
  148. package/dist/owletto/dist/assets/run-initiator-C0sur8lU.js +2 -0
  149. package/dist/owletto/dist/assets/runs-list-CJOFMgpk.js +2 -0
  150. package/dist/owletto/dist/assets/schema-value-DDNHANGs.js +3 -0
  151. package/dist/owletto/dist/assets/{scoped-feed-bar-DNFL0sYX.js → scoped-feed-bar-BTv9mPcR.js} +2 -2
  152. package/dist/owletto/dist/assets/settings-Ponr5XbS.js +3 -0
  153. package/dist/owletto/dist/assets/{status-variants-SzXYYedJ.js → status-variants-mLqVhg5O.js} +2 -2
  154. package/dist/owletto/dist/assets/subDays-BGA_fkig.js +2 -0
  155. package/dist/owletto/dist/assets/two-factor-pqoxGSgL.js +2 -0
  156. package/dist/owletto/dist/assets/{use-automations-DfBtVzGa.js → use-automations-DcdlmVuX.js} +2 -2
  157. package/dist/owletto/dist/assets/{use-login-redirect-BDiS3eyl.js → use-login-redirect-D7HW5Ed6.js} +2 -2
  158. package/dist/owletto/dist/assets/{use-mention-search-khySpz_V.js → use-mention-search-BniE-K2d.js} +3 -3
  159. package/dist/owletto/dist/assets/view-card-Cg6PeEiV.js +2 -0
  160. package/dist/owletto/dist/assets/view-param-filters-CvrKw0mZ.js +2 -0
  161. package/dist/owletto/dist/index.html +2 -2
  162. package/dist/server-main.bundle.mjs +5766 -2999
  163. package/npm-shrinkwrap.json +195 -172
  164. package/package.json +2 -1
  165. package/vendor/connector-sdk/dist/connector-types.d.ts +20 -0
  166. package/vendor/connector-sdk/dist/define-connector.js +2 -0
  167. package/vendor/connector-sdk/dist/extension-dom-scrape.d.ts +2 -0
  168. package/vendor/connector-sdk/dist/extension-dom-scrape.js +5 -0
  169. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +20 -0
  170. package/vendor/connector-sdk/package.json +1 -1
  171. package/vendor/core/dist/contracts/entity-reference.d.ts +2 -0
  172. package/vendor/core/dist/contracts/entity-reference.js +4 -3
  173. package/vendor/core/dist/contracts/tools/entity-list-sort.d.ts +18 -0
  174. package/vendor/core/dist/contracts/tools/entity-list-sort.js +64 -0
  175. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +1 -1
  176. package/vendor/core/dist/contracts/tools/manage-agents.js +3 -3
  177. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +4 -0
  178. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +4 -0
  179. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +4 -0
  180. package/vendor/core/dist/contracts/tools/manage-entity.js +11 -1
  181. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +29 -3
  182. package/vendor/core/dist/contracts/tools/manage-operations.js +24 -2
  183. package/vendor/core/dist/contracts/tools/manage-views.d.ts +36 -0
  184. package/vendor/core/dist/contracts/tools/manage-views.js +15 -2
  185. package/vendor/core/dist/contracts/tools/view-definition.js +7 -2
  186. package/vendor/core/dist/contracts/tools/view-host.js +5 -0
  187. package/vendor/core/dist/contracts/tools/view-path.d.ts +8 -1
  188. package/vendor/core/dist/contracts/tools/view-path.js +11 -1
  189. package/vendor/core/dist/reserved.d.ts +7 -1
  190. package/vendor/core/dist/reserved.js +17 -0
  191. package/vendor/core/package.json +6 -1
  192. package/vendor/views/dist/api.d.ts +19 -3
  193. package/vendor/views/dist/api.js +53 -5
  194. package/vendor/views/dist/components.d.ts +7 -0
  195. package/vendor/views/dist/components.js +223 -2
  196. package/vendor/views/dist/embed.js +13 -2
  197. package/vendor/views/dist/live-gate.d.ts +34 -0
  198. package/vendor/views/dist/live-gate.js +100 -0
  199. package/vendor/views/dist/native.d.ts +43 -1
  200. package/vendor/views/dist/native.js +1 -0
  201. package/vendor/views/package.json +1 -1
  202. package/dist/owletto/dist/assets/_-BDMUN9XZ.js +0 -2
  203. package/dist/owletto/dist/assets/_-CF5X4ANe.js +0 -3
  204. package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +0 -2
  205. package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +0 -2
  206. package/dist/owletto/dist/assets/_connectorKey._connectionId-DcI29kGy.js +0 -2
  207. package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +0 -2
  208. package/dist/owletto/dist/assets/_conversationId-CnmLYlVS.js +0 -2
  209. package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +0 -2
  210. package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +0 -3
  211. package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +0 -2
  212. package/dist/owletto/dist/assets/_slug-COPpRXLt.js +0 -2
  213. package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +0 -2
  214. package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +0 -2
  215. package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +0 -2
  216. package/dist/owletto/dist/assets/agent-connect-pages-DVq9nAR7.js +0 -4
  217. package/dist/owletto/dist/assets/agent-thread-Cqf9ITrT.js +0 -6
  218. package/dist/owletto/dist/assets/assist-composer-kG_heHXo.js +0 -2
  219. package/dist/owletto/dist/assets/automation-run-now-C5XTS00o.js +0 -2
  220. package/dist/owletto/dist/assets/client-activity-scopes-Aqdo6Pdr.js +0 -2
  221. package/dist/owletto/dist/assets/connect-BFNp1y_s.js +0 -2
  222. package/dist/owletto/dist/assets/connect-menu-BWrAhMqO.js +0 -2
  223. package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +0 -2
  224. package/dist/owletto/dist/assets/connected._clientId-CuOeHafK.js +0 -2
  225. package/dist/owletto/dist/assets/connection-CVeHmDLs.js +0 -2
  226. package/dist/owletto/dist/assets/connection-feed-detail-BYo7zdVD.js +0 -2
  227. package/dist/owletto/dist/assets/connectors-DBEM9QQz.js +0 -2
  228. package/dist/owletto/dist/assets/copy-button-Xhh7ZnjO.js +0 -2
  229. package/dist/owletto/dist/assets/create-Ccb5R-S4.js +0 -2
  230. package/dist/owletto/dist/assets/create-DmhbacIa.js +0 -2
  231. package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +0 -2
  232. package/dist/owletto/dist/assets/custom-guardrail-edits-Ce_BwiwD.js +0 -2
  233. package/dist/owletto/dist/assets/definition-comparison-D_qP25jR.js +0 -2
  234. package/dist/owletto/dist/assets/detail-page-skeleton-CPAfZLG0.js +0 -2
  235. package/dist/owletto/dist/assets/device-DDl5XKvt.js +0 -2
  236. package/dist/owletto/dist/assets/device._deviceId-bNhTcops.js +0 -2
  237. package/dist/owletto/dist/assets/dynamic-schema-form-CRyUchXo.js +0 -2
  238. package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +0 -2
  239. package/dist/owletto/dist/assets/entity-pages-_nuesgnp.js +0 -2
  240. package/dist/owletto/dist/assets/entity-type-page-CkCSbkBx.js +0 -2
  241. package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +0 -2
  242. package/dist/owletto/dist/assets/events-feed-DcKTkJVe.js +0 -2
  243. package/dist/owletto/dist/assets/index-BUlkNJzX.js +0 -2
  244. package/dist/owletto/dist/assets/index-BoqrvLHQ.js +0 -7906
  245. package/dist/owletto/dist/assets/index-CA9mW_ZM.js +0 -2
  246. package/dist/owletto/dist/assets/index-CH0GzG4i.js +0 -2
  247. package/dist/owletto/dist/assets/index-CtI5Eomq.js +0 -2
  248. package/dist/owletto/dist/assets/index-DmtQ0bds.js +0 -2
  249. package/dist/owletto/dist/assets/index-Du_J8hnx.js +0 -2
  250. package/dist/owletto/dist/assets/index-Pae_f9LM.css +0 -1
  251. package/dist/owletto/dist/assets/index-XETZnN7L.js +0 -2
  252. package/dist/owletto/dist/assets/login-DG0b9uSC.js +0 -2
  253. package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +0 -74
  254. package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +0 -2
  255. package/dist/owletto/dist/assets/needs-you-list-3uMsWcDv.js +0 -2
  256. package/dist/owletto/dist/assets/new-AdGV6a8R.js +0 -2
  257. package/dist/owletto/dist/assets/new-BdtIhBpo.js +0 -2
  258. package/dist/owletto/dist/assets/new-BjGwX6s6.js +0 -2
  259. package/dist/owletto/dist/assets/new-D-iMjV74.js +0 -2
  260. package/dist/owletto/dist/assets/organization-qaIpEiQg.js +0 -2
  261. package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +0 -2
  262. package/dist/owletto/dist/assets/proposal-review-shell-C8ZfIAYn.js +0 -2
  263. package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +0 -2
  264. package/dist/owletto/dist/assets/record-session-BrM9cdXu.js +0 -2
  265. package/dist/owletto/dist/assets/run-initiator-BKSgI1o0.js +0 -2
  266. package/dist/owletto/dist/assets/runs-k2NpbZm8.js +0 -2
  267. package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +0 -2
  268. package/dist/owletto/dist/assets/schema-value-wjqGxXhv.js +0 -3
  269. package/dist/owletto/dist/assets/settings-V0m5Om5j.js +0 -2
  270. package/dist/owletto/dist/assets/source-record-panels-BMut9YIA.js +0 -2
  271. package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +0 -2
  272. package/dist/owletto/dist/assets/table-ZuYMOjVR.js +0 -2
  273. package/dist/owletto/dist/assets/view-card-DiHWlypr.js +0 -2
  274. package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +0 -2
  275. package/dist/owletto/dist/assets/views-access-required-HA-PiOwA.js +0 -2
@@ -15,6 +15,11 @@ function isViewRead(tool, args) {
15
15
  args?.action === "get" ||
16
16
  args?.action === "list_links");
17
17
  }
18
+ if (tool === "manage_feeds") {
19
+ return (args?.action === "list_feeds" ||
20
+ args?.action === "read_feed" ||
21
+ args?.action === "read_feeds");
22
+ }
18
23
  if (tool === "manage_automations")
19
24
  return args?.action === "list";
20
25
  if (tool === "manage_agents")
@@ -3,7 +3,7 @@
3
3
  * never by a query key, so the page's query string is the view's params alone
4
4
  * and can never collide with the host's own keys (filters, peek, paging):
5
5
  *
6
- * /<org>/data/-/views/<key> workspace view (Data hub tab)
6
+ * /<org>/<key> workspace view (top-level page)
7
7
  * /<org>/<type>/-/views/<key> view attached to a type
8
8
  * /<org>/<type>/<slug>/-/views/<key> view attached to a record
9
9
  *
@@ -11,8 +11,15 @@
11
11
  * create rejects it (RESERVED_ENTITY_TYPE_SLUGS) and so does a record's
12
12
  * explicit slug, and a derived record slug never is one (slugify trims dashes). The server's `open_view` links and the web host's tabs both build
13
13
  * the suffix here, so the two cannot drift apart.
14
+ *
15
+ * A workspace view shares the `/<org>/<segment>` space with entity type list
16
+ * pages. The database keeps the two apart (a workspace view key never equals a
17
+ * live entity type slug) and `manage_views` refuses reserved route names, so
18
+ * one segment always names exactly one page.
14
19
  */
15
20
  export declare const VIEW_PATH_MARKER = "-";
16
21
  /** The suffix that selects view `key` beneath a host page's path. */
17
22
  export declare function viewPathSuffix(key: string): string;
23
+ /** A workspace view's own page: a top-level page of the workspace. */
24
+ export declare function workspaceViewPath(orgSlug: string, key: string): string;
18
25
  //# sourceMappingURL=view-path.d.ts.map
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIEW_PATH_MARKER = void 0;
4
4
  exports.viewPathSuffix = viewPathSuffix;
5
+ exports.workspaceViewPath = workspaceViewPath;
5
6
  /**
6
7
  * Where a view lives in the web host's URL space. A view is selected by path,
7
8
  * never by a query key, so the page's query string is the view's params alone
8
9
  * and can never collide with the host's own keys (filters, peek, paging):
9
10
  *
10
- * /<org>/data/-/views/<key> workspace view (Data hub tab)
11
+ * /<org>/<key> workspace view (top-level page)
11
12
  * /<org>/<type>/-/views/<key> view attached to a type
12
13
  * /<org>/<type>/<slug>/-/views/<key> view attached to a record
13
14
  *
@@ -15,10 +16,19 @@ exports.viewPathSuffix = viewPathSuffix;
15
16
  * create rejects it (RESERVED_ENTITY_TYPE_SLUGS) and so does a record's
16
17
  * explicit slug, and a derived record slug never is one (slugify trims dashes). The server's `open_view` links and the web host's tabs both build
17
18
  * the suffix here, so the two cannot drift apart.
19
+ *
20
+ * A workspace view shares the `/<org>/<segment>` space with entity type list
21
+ * pages. The database keeps the two apart (a workspace view key never equals a
22
+ * live entity type slug) and `manage_views` refuses reserved route names, so
23
+ * one segment always names exactly one page.
18
24
  */
19
25
  exports.VIEW_PATH_MARKER = "-";
20
26
  /** The suffix that selects view `key` beneath a host page's path. */
21
27
  function viewPathSuffix(key) {
22
28
  return `/${exports.VIEW_PATH_MARKER}/views/${key}`;
23
29
  }
30
+ /** A workspace view's own page: a top-level page of the workspace. */
31
+ function workspaceViewPath(orgSlug, key) {
32
+ return `/${orgSlug}/${key}`;
33
+ }
24
34
  //# sourceMappingURL=view-path.js.map
@@ -13,6 +13,12 @@
13
13
  export declare function isSystemEntityType(et: {
14
14
  slug?: string | null;
15
15
  }): boolean;
16
+ /**
17
+ * True when an event metadata key is server-owned bookkeeping (idempotency
18
+ * keys, audit stamps). Sole signal: key starts with `_lobu_`. Writers strip
19
+ * these from caller input; readers keep them out of human-facing views.
20
+ */
21
+ export declare function isReservedMetadataKey(key: string): boolean;
16
22
  /**
17
23
  * Owner-level route segments under /$owner/. Entity type slugs and org slugs
18
24
  * must never collide with these.
@@ -31,7 +37,7 @@ export declare const REMOVED_OWNER_SEGMENTS: readonly ["events", "automations",
31
37
  * pages, global prefixes, and infra subdomains that must not be claimed as
32
38
  * org slugs.
33
39
  */
34
- export declare const RESERVED_PATHS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "auth", "api", "inbox", "templates", "help", "account", "me", "admin", "health", "login", "logout", "signup", "register", "contents", "entity-types", "www", "mcp", "static", "assets", "cdn", "docs", "mail", "connector", "oauth", "orgs", "slack", "dashboard"];
40
+ export declare const RESERVED_PATHS: readonly ["activity", "agents", "connectors", "data", "memory", "members", "settings", "events", "automations", "connections", "sources", "environments", "infrastructure", "inference-providers", "devices", "auth", "api", "inbox", "templates", "help", "account", "me", "admin", "health", "login", "logout", "signup", "register", "contents", "entity-types", "www", "mcp", "static", "assets", "cdn", "docs", "mail", "connector", "oauth", "orgs", "slack", "dashboard", "connect", "catalog", "internal", "mcp-apps"];
35
41
  export declare const RESERVED_PATHS_SET: ReadonlySet<string>;
36
42
  /**
37
43
  * Slugs users cannot use when *creating* an entity type. Route collisions plus
@@ -10,6 +10,7 @@
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.CONNECTOR_SUBROUTE_SEGMENTS = exports.SANDBOX_PROVIDER_KEY_PREFIX = exports.SANDBOX_ROW_KEY_PREFIX = exports.INFERENCE_ROW_KEY_PREFIX = exports.RESERVED_ENTITY_TYPE_SLUGS = exports.RESERVED_PATHS_SET = exports.RESERVED_PATHS = exports.REMOVED_OWNER_SEGMENTS = exports.OWNER_ROUTE_SEGMENTS = void 0;
12
12
  exports.isSystemEntityType = isSystemEntityType;
13
+ exports.isReservedMetadataKey = isReservedMetadataKey;
13
14
  exports.isReservedEntityTypeSlug = isReservedEntityTypeSlug;
14
15
  exports.normalizeEntityTypeSlug = normalizeEntityTypeSlug;
15
16
  exports.isReservedConnectorKey = isReservedConnectorKey;
@@ -22,6 +23,15 @@ const view_path_1 = require("./contracts/tools/view-path");
22
23
  function isSystemEntityType(et) {
23
24
  return typeof et.slug === "string" && et.slug.startsWith("$");
24
25
  }
26
+ // ── Event metadata ──────────────────────────────────────────────────────────
27
+ /**
28
+ * True when an event metadata key is server-owned bookkeeping (idempotency
29
+ * keys, audit stamps). Sole signal: key starts with `_lobu_`. Writers strip
30
+ * these from caller input; readers keep them out of human-facing views.
31
+ */
32
+ function isReservedMetadataKey(key) {
33
+ return key.startsWith("_lobu_");
34
+ }
25
35
  // ── Route / path reserved names ─────────────────────────────────────────────
26
36
  /**
27
37
  * Owner-level route segments under /$owner/. Entity type slugs and org slugs
@@ -99,6 +109,13 @@ exports.RESERVED_PATHS = [
99
109
  "orgs",
100
110
  "slack",
101
111
  "dashboard",
112
+ // Top-level server routes registered ahead of the SPA fallback: a workspace
113
+ // with one of these slugs would have its pages shadowed by the server's
114
+ // response.
115
+ "connect",
116
+ "catalog",
117
+ "internal",
118
+ "mcp-apps",
102
119
  ];
103
120
  exports.RESERVED_PATHS_SET = new Set(exports.RESERVED_PATHS);
104
121
  // ── Entity type create denylist ─────────────────────────────────────────────
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/core",
3
- "version": "24.11.0",
3
+ "version": "24.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Core types and utilities for Lobu agent platform",
6
6
  "repository": {
@@ -161,6 +161,11 @@
161
161
  "import": "./dist/contracts/tools/manage-entity-schema.js",
162
162
  "require": "./dist/contracts/tools/manage-entity-schema.js"
163
163
  },
164
+ "./contracts/tools/entity-list-sort": {
165
+ "types": "./dist/contracts/tools/entity-list-sort.d.ts",
166
+ "import": "./dist/contracts/tools/entity-list-sort.js",
167
+ "require": "./dist/contracts/tools/entity-list-sort.js"
168
+ },
164
169
  "./contracts/tools/collection-presentation": {
165
170
  "types": "./dist/contracts/tools/collection-presentation.d.ts",
166
171
  "import": "./dist/contracts/tools/collection-presentation.js",
@@ -20,7 +20,11 @@
20
20
  *
21
21
  * Read budget: reads run on a user-facing path, when the host is ready and
22
22
  * the query changes, `refetch()` is called, or a live query receives a host
23
- * data-change notification.
23
+ * data-change notification. Host data changes are bounded: the first change
24
+ * reads immediately, then at most one trailing read per
25
+ * `LIVE_REFRESH_MIN_INTERVAL_MS` (15 s), none while the frame is hidden, and
26
+ * an immediate read after a committed action. A live view therefore costs at
27
+ * most one read set per 15 s, not one per workspace write.
24
28
  * `query_sql` runs in a read-only, org-scoped transaction with a 5 second
25
29
  * statement timeout and returns at most 500 rows; `useQuery` reports a hit as
26
30
  * `errorCode: "UPSTREAM_TIMEOUT"` or `truncated: true`, so render those
@@ -118,7 +122,7 @@ export interface ParamDef {
118
122
  * - `{ collection: "deal", when? }` — a tab on the deal list page. `when`
119
123
  * equalities must all be present in scope.collection.filters; they control
120
124
  * discoverability, never authorization.
121
- * - `{ workspace: true }` — a tab on the Data hub.
125
+ * - `{ workspace: true }` — a top-level page of the workspace, at `/<key>`.
122
126
  * - `{ event: "deal.won", type? }` — one event's page, optionally only when
123
127
  * the event links an entity of `type`.
124
128
  */
@@ -167,6 +171,14 @@ export interface ActionDef {
167
171
  entityType: string;
168
172
  fields: string[];
169
173
  };
174
+ /** Patch one existing relationship with `{ relationship_id, set }` and
175
+ * matching expected keys. Both endpoint types must appear in attach. */
176
+ updatesLink?: {
177
+ relationshipType: string;
178
+ fromEntityType: string;
179
+ toEntityType: string;
180
+ fields: string[];
181
+ };
170
182
  }
171
183
  export interface ActionOptions {
172
184
  /** For an `updates` action: metadata field -> the value this view read.
@@ -300,14 +312,18 @@ export declare function coerceScope(raw: unknown): Scope;
300
312
  * update-model-context. The server bootstrap renders this around the view's
301
313
  * default export; `mountView` does the same for CLI-bundled entries.
302
314
  */
303
- export declare function Provider({ def, bridge, children, }: {
315
+ export declare function Provider({ def, bridge, liveRefreshIntervalMs, children, }: {
304
316
  def: ViewDefinition;
305
317
  bridge?: ViewBridge;
318
+ /** Test seam: shorten the minimum interval between live refreshes. */
319
+ liveRefreshIntervalMs?: number;
306
320
  children: ReactNode;
307
321
  }): import("react/jsx-runtime").JSX.Element;
308
322
  export interface MountOptions {
309
323
  /** Test seam: drive the view against a fake parent instead of `window.parent`. */
310
324
  bridge?: ViewBridge;
325
+ /** Test seam: shorten the minimum interval between live refreshes. */
326
+ liveRefreshIntervalMs?: number;
311
327
  }
312
328
  /** Entry point the compiled bundle calls once. Mounts the component into
313
329
  * `#root` and connects to the host. */
@@ -3,6 +3,7 @@ import { Component, createContext, useCallback, useContext, useEffect, useMemo,
3
3
  import { createRoot } from "react-dom/client";
4
4
  import { ViewBridge, ViewBridgeError, } from "./bridge.js";
5
5
  import { EmbedProvider, EmbedRegistry } from "./embed.js";
6
+ import { createDataChangeGate, documentHidden, LIVE_REFRESH_MIN_INTERVAL_MS, } from "./live-gate.js";
6
7
  export function defineView(def) {
7
8
  if (!def || typeof def.key !== "string" || def.key.length === 0) {
8
9
  throw new Error("defineView({ key, attach, ... }) requires a non-empty key");
@@ -215,6 +216,17 @@ export function useQuery(query, options = {}) {
215
216
  const reading = useRef(0);
216
217
  const owed = useRef(false);
217
218
  const [followUp, setFollowUp] = useState(0);
219
+ // A follow-up owed when the frame hid waits for the next visible frame. The
220
+ // in-flight read may settle into a hidden tab, and that settle must not
221
+ // spend a read nobody is looking at.
222
+ useEffect(() => {
223
+ if (!rt.ready || !live || !rt.visible)
224
+ return;
225
+ if (!owed.current || reading.current !== 0)
226
+ return;
227
+ owed.current = false;
228
+ setFollowUp((n) => n + 1);
229
+ }, [rt.ready, rt.visible, live]);
218
230
  const key = query === null
219
231
  ? null
220
232
  : typeof query === "string"
@@ -240,6 +252,21 @@ export function useQuery(query, options = {}) {
240
252
  lastRead.current.tick === tick) {
241
253
  return;
242
254
  }
255
+ // Live reads wait for a visible frame. The gate pauses host changes, but
256
+ // an in-flight settle, refetch(), or key change can land here hidden; keep
257
+ // one owed read for the next visible transition.
258
+ if (live && documentHidden()) {
259
+ // A key change still moves the hook even though the read waits: drop
260
+ // any in-flight result for the previous key and show loading. Otherwise
261
+ // the old read's show() would paint its rows onto the new query with
262
+ // loading false.
263
+ if (lastRead.current?.key !== key) {
264
+ lastRead.current = null;
265
+ setState((s) => (s.loading ? s : { ...s, loading: true }));
266
+ }
267
+ owed.current = true;
268
+ return;
269
+ }
243
270
  const last = lastRead.current;
244
271
  const background = last?.key === key &&
245
272
  last.tick === tick &&
@@ -262,7 +289,9 @@ export function useQuery(query, options = {}) {
262
289
  if (reading.current !== seq)
263
290
  return;
264
291
  reading.current = 0;
265
- if (owed.current && lastRead.current?.key === key) {
292
+ if (owed.current) {
293
+ if (documentHidden())
294
+ return;
266
295
  owed.current = false;
267
296
  setFollowUp((n) => n + 1);
268
297
  }
@@ -348,6 +377,10 @@ export function useAction(name) {
348
377
  try {
349
378
  const result = await rt.callTool("invoke_view_action", args);
350
379
  const error = resultError(result);
380
+ // The view sees its own write now instead of waiting for the next
381
+ // refresh window; a committed action is not workspace churn.
382
+ if (!error)
383
+ rt.refreshData();
351
384
  return {
352
385
  ok: !error,
353
386
  error,
@@ -527,7 +560,7 @@ class RenderBoundary extends Component {
527
560
  * update-model-context. The server bootstrap renders this around the view's
528
561
  * default export; `mountView` does the same for CLI-bundled entries.
529
562
  */
530
- export function Provider({ def, bridge, children, }) {
563
+ export function Provider({ def, bridge, liveRefreshIntervalMs = LIVE_REFRESH_MIN_INTERVAL_MS, children, }) {
531
564
  const [connected, setConnected] = useState(false);
532
565
  const [ready, setReady] = useState(false);
533
566
  const [scope, setScope] = useState({});
@@ -536,6 +569,15 @@ export function Provider({ def, bridge, children, }) {
536
569
  const [displayMode, setDisplayMode] = useState("inline");
537
570
  const [container, setContainer] = useState({});
538
571
  const [dataVersion, setDataVersion] = useState(0);
572
+ const [visible, setVisible] = useState(() => !documentHidden());
573
+ // One timer per view, not per query: a data change re-reads the whole view
574
+ // together, inside one bounded window.
575
+ const dataGate = useMemo(() => createDataChangeGate(() => setDataVersion((v) => v + 1), liveRefreshIntervalMs), [liveRefreshIntervalMs]);
576
+ useEffect(() => {
577
+ const onVisibilityChange = () => setVisible(!documentHidden());
578
+ document.addEventListener("visibilitychange", onVisibilityChange);
579
+ return () => document.removeEventListener("visibilitychange", onVisibilityChange);
580
+ }, []);
539
581
  const bridgeRef = useRef(bridge ?? null);
540
582
  if (bridge)
541
583
  bridgeRef.current = bridge;
@@ -551,6 +593,7 @@ export function Provider({ def, bridge, children, }) {
551
593
  // before effects run); fail loud instead of dereferencing null.
552
594
  if (!b)
553
595
  throw new Error("@lobu/views provider has no host bridge");
596
+ dataGate.start();
554
597
  const offInput = b.onToolInput((args) => {
555
598
  const input = (args ?? {});
556
599
  setScope(coerceScope(input.scope));
@@ -574,7 +617,7 @@ export function Provider({ def, bridge, children, }) {
574
617
  setContainer(containerFromContext(ctx));
575
618
  };
576
619
  const offCtx = b.onHostContext(adoptContext);
577
- const offData = b.onDataChanged(() => setDataVersion((v) => v + 1));
620
+ const offData = b.onDataChanged(dataGate.notify);
578
621
  const offEmbeds = embeds.attach(b);
579
622
  b.connect()
580
623
  .then((ctx) => {
@@ -586,6 +629,7 @@ export function Provider({ def, bridge, children, }) {
586
629
  })
587
630
  .catch((e) => console.error("[lobu-views] connect failed", e));
588
631
  return () => {
632
+ dataGate.stop();
589
633
  offInput();
590
634
  offResult();
591
635
  offCtx();
@@ -593,7 +637,7 @@ export function Provider({ def, bridge, children, }) {
593
637
  offEmbeds();
594
638
  embeds.setConnected(false);
595
639
  };
596
- }, [def, embeds]);
640
+ }, [def, embeds, dataGate]);
597
641
  // Report the document height so the host can fit the frame. This lives in
598
642
  // the provider, not `mountView`: the server bootstrap renders the provider
599
643
  // directly, and a frame that never hears a size stays at its minimum height.
@@ -690,6 +734,8 @@ export function Provider({ def, bridge, children, }) {
690
734
  setParams,
691
735
  theme,
692
736
  dataVersion,
737
+ visible,
738
+ refreshData: dataGate.force,
693
739
  callTool,
694
740
  openLink,
695
741
  openRecord,
@@ -705,6 +751,8 @@ export function Provider({ def, bridge, children, }) {
705
751
  setParams,
706
752
  theme,
707
753
  dataVersion,
754
+ visible,
755
+ dataGate,
708
756
  callTool,
709
757
  openLink,
710
758
  openRecord,
@@ -723,6 +771,6 @@ export function mountView(def, Component, opts) {
723
771
  const el = document.getElementById("root");
724
772
  if (!el)
725
773
  throw new Error("#root missing in view shell");
726
- createRoot(el).render(_jsx(Provider, { def: valid, bridge: opts?.bridge, children: _jsx(Component, {}) }));
774
+ createRoot(el).render(_jsx(Provider, { def: valid, bridge: opts?.bridge, liveRefreshIntervalMs: opts?.liveRefreshIntervalMs, children: _jsx(Component, {}) }));
727
775
  }
728
776
  //# sourceMappingURL=api.js.map
@@ -22,6 +22,7 @@
22
22
  * through `lobu apply`, which bundles the project's own `node_modules`.
23
23
  */
24
24
  import type { ReactNode } from "react";
25
+ import { type EntityCollectionProps } from "./native.js";
25
26
  export interface CardProps {
26
27
  title?: string;
27
28
  description?: string;
@@ -190,5 +191,11 @@ export declare function TruncatedNotice({ shown, total, }: {
190
191
  }): import("react/jsx-runtime").JSX.Element;
191
192
  /** Format large counts compactly (1.2K, 3.4M). Plain numbers pass through. */
192
193
  export declare function formatCompact(value: number): string;
194
+ /**
195
+ * The native collection where the host supplies native components; anywhere
196
+ * else a plain table over the same `manage_entity_schema get` and
197
+ * `manage_entity list` reads. See `EntityCollectionProps`.
198
+ */
199
+ export declare function EntityCollection(props: EntityCollectionProps): import("react").ReactElement<EntityCollectionProps, string | import("react").JSXElementConstructor<any>> | import("react").FunctionComponentElement<EntityCollectionProps>;
193
200
  export * from "./native.js";
194
201
  //# sourceMappingURL=components.d.ts.map
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useId, useRef, useState } from "react";
3
- import { resolveViewHref, useHost } from "./api.js";
2
+ import { collectionSortFieldError, ENTITY_LIST_METADATA_SORT_PREFIX, ENTITY_LIST_SORT_KEYS, } from "@lobu/core/contracts/tools/entity-list-sort";
3
+ import { createElement, useEffect, useId, useRef, useState } from "react";
4
+ import { resolveViewHref, tool, useHost, useQuery } from "./api.js";
5
+ import { NATIVE_COMPONENT_GLOBAL, } from "./native.js";
4
6
  const FONT_STACK = 'var(--font-sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)';
5
7
  const INK = {
6
8
  color: "var(--foreground, #0a0a0a)",
@@ -422,5 +424,224 @@ export function formatCompact(value) {
422
424
  return `${(value / 1_000).toFixed(1)}K`;
423
425
  return String(value);
424
426
  }
427
+ /* ------------------------------------------------------------------ */
428
+ /* EntityCollection */
429
+ /* ------------------------------------------------------------------ */
430
+ /**
431
+ * The native collection where the host supplies native components; anywhere
432
+ * else a plain table over the same `manage_entity_schema get` and
433
+ * `manage_entity list` reads. See `EntityCollectionProps`.
434
+ */
435
+ export function EntityCollection(props) {
436
+ const native = globalThis[NATIVE_COMPONENT_GLOBAL]?.EntityCollection;
437
+ if (native)
438
+ return createElement(native, props);
439
+ // A new selection starts the fallback table at its first page.
440
+ const key = JSON.stringify([
441
+ props.entityType,
442
+ props.preset,
443
+ props.selection ?? props.defaultSelection,
444
+ ]);
445
+ return createElement(CollectionTable, { ...props, key });
446
+ }
447
+ // The fallback checks core's CollectionSelectionSchema by hand, bounds
448
+ // included: the schema library behind it would add ~227 KB to every view's
449
+ // runtime. A malformed selection must fail closed, never widen the read.
450
+ const FIELD = /^[A-Za-z_][A-Za-z0-9_]{0,119}$/;
451
+ const MAX_PAGE_SIZE = 500;
452
+ const MAX_FILTERS = 32;
453
+ const MAX_VALUE = 2000;
454
+ function storedListSort(sort, properties) {
455
+ const declared = properties && typeof properties === "object" && !Array.isArray(properties)
456
+ ? properties
457
+ : undefined;
458
+ if (!sort || collectionSortFieldError(sort.field, declared))
459
+ return { field: "created_at", order: "desc" };
460
+ const builtin = ENTITY_LIST_SORT_KEYS.includes(sort.field);
461
+ return {
462
+ field: builtin
463
+ ? sort.field
464
+ : `${ENTITY_LIST_METADATA_SORT_PREFIX}${sort.field}`,
465
+ order: sort.order,
466
+ };
467
+ }
468
+ function plainValue(value, nullable) {
469
+ if (typeof value === "string")
470
+ return value.length <= MAX_VALUE;
471
+ if (typeof value === "number")
472
+ return Number.isFinite(value);
473
+ return nullable && (value === null || typeof value === "boolean");
474
+ }
475
+ function plainFilter(filter) {
476
+ if (!filter || typeof filter !== "object")
477
+ return false;
478
+ const { field, op, value, ...rest } = filter;
479
+ if (Object.keys(rest).length ||
480
+ typeof field !== "string" ||
481
+ !FIELD.test(field))
482
+ return false;
483
+ if (op === "eq" || op === "neq")
484
+ return plainValue(value, true);
485
+ return ((op === "lt" || op === "lte" || op === "gt" || op === "gte") &&
486
+ plainValue(value, false));
487
+ }
488
+ function boundedString(value, min, max) {
489
+ return (typeof value === "string" && value.length >= min && value.length <= max);
490
+ }
491
+ function plainSelection(raw) {
492
+ const valid = !!raw &&
493
+ typeof raw === "object" &&
494
+ !Array.isArray(raw) &&
495
+ Object.entries(raw).every(([key, value]) => key === "filters"
496
+ ? Array.isArray(value) &&
497
+ value.length <= MAX_FILTERS &&
498
+ value.every(plainFilter)
499
+ : key === "search"
500
+ ? boundedString(value, 0, 512)
501
+ : key === "segment" && boundedString(value, 1, 120));
502
+ if (!valid)
503
+ throw new Error("Invalid collection selection");
504
+ return raw;
505
+ }
506
+ function plainTable(raw) {
507
+ const table = (raw && typeof raw === "object" ? raw : {});
508
+ const sort = table.sort;
509
+ return {
510
+ columns: Array.isArray(table.columns)
511
+ ? table.columns.filter((c) => typeof c === "string")
512
+ : undefined,
513
+ sort: sort &&
514
+ typeof sort.field === "string" &&
515
+ FIELD.test(sort.field) &&
516
+ (sort.order === "asc" || sort.order === "desc")
517
+ ? { field: sort.field, order: sort.order }
518
+ : undefined,
519
+ };
520
+ }
521
+ /** What a fallback table reads and shows: the preset's selection and table
522
+ * (or the type's default table). A saved filter it cannot resolve on its
523
+ * own (a viewer or relative-date preset) is an error, never every row. */
524
+ function fallbackCollection(schema, preset, selection) {
525
+ const presentation = schema?.["x-lobu-collection"];
526
+ if (preset === undefined)
527
+ return {
528
+ selection: plainSelection(selection ?? {}),
529
+ table: plainTable(presentation?.table),
530
+ };
531
+ const presets = presentation?.presets;
532
+ const found = Array.isArray(presets)
533
+ ? presets.find((item) => item?.key === preset)
534
+ : undefined;
535
+ if (!found || found.viewer !== undefined)
536
+ throw new Error("This saved filter is unavailable. Choose another filter.");
537
+ if (selection === undefined && found.relativeDate !== undefined)
538
+ throw new Error("This saved filter needs the native collection.");
539
+ return {
540
+ selection: plainSelection(selection ?? found.selection ?? {}),
541
+ table: plainTable(found.table ?? presentation?.table),
542
+ };
543
+ }
544
+ function CollectionTable(props) {
545
+ const host = useHost();
546
+ const [page, setPage] = useState(1);
547
+ const type = useQuery(tool("manage_entity_schema", {
548
+ schema_type: "entity_type",
549
+ action: "get",
550
+ slug: props.entityType,
551
+ }));
552
+ const rawSchema = type.data?.entity_type?.metadata_schema;
553
+ let schema;
554
+ let selection;
555
+ let table = {};
556
+ let invalid;
557
+ try {
558
+ schema =
559
+ typeof rawSchema === "string"
560
+ ? JSON.parse(rawSchema)
561
+ : (rawSchema ?? undefined);
562
+ ({ selection, table } = fallbackCollection(schema, props.preset, props.selection ?? props.defaultSelection));
563
+ }
564
+ catch (error) {
565
+ invalid = error instanceof Error ? error.message : String(error);
566
+ }
567
+ const pageSize = Math.min(Math.max(1, Math.floor(props.pageSize ?? 50) || 50), MAX_PAGE_SIZE);
568
+ const ready = !!type.data?.entity_type && !invalid;
569
+ // The native collection's order: a derived type sorts by its own columns; a
570
+ // stored type takes a built-in key or a declared scalar property
571
+ // (`metadata.<field>`) and otherwise lists newest first.
572
+ const sort = type.data?.entity_type?.backing_sql
573
+ ? table.sort
574
+ : storedListSort(table.sort, schema?.properties);
575
+ const list = useQuery(ready
576
+ ? tool("manage_entity", {
577
+ action: "list",
578
+ entity_type: props.entityType,
579
+ search: selection?.search?.trim() || undefined,
580
+ filters: selection?.filters?.length ? selection.filters : undefined,
581
+ segment: selection?.segment,
582
+ sort_by: sort?.field,
583
+ sort_order: sort?.order,
584
+ limit: pageSize,
585
+ offset: (page - 1) * pageSize,
586
+ })
587
+ : null);
588
+ const properties = schema?.properties ?? {};
589
+ const columns = [
590
+ {
591
+ key: "name",
592
+ header: "Name",
593
+ render: (entity) => (_jsx("button", { type: "button", onClick: () => props.onOpenRecord
594
+ ? props.onOpenRecord(entity)
595
+ : void host
596
+ .openRecord({
597
+ entity_id: entity.id ?? entity.slug,
598
+ entity_type: entity.entity_type,
599
+ }, { mode: "peek" })
600
+ .catch((error) => console.error("[lobu-views] record not opened", error)), style: {
601
+ border: 0,
602
+ padding: 0,
603
+ background: "transparent",
604
+ font: "inherit",
605
+ cursor: "pointer",
606
+ textAlign: "left",
607
+ color: "var(--color-text-info, #2563eb)",
608
+ }, children: entity.name })),
609
+ },
610
+ ...Object.entries(properties)
611
+ .filter(([key, prop]) => prop?.["x-table-column"] === true &&
612
+ (!table.columns || table.columns.includes(key)))
613
+ .map(([key, prop]) => ({
614
+ key,
615
+ header: String(prop?.["x-table-label"] ?? prop?.title ?? key),
616
+ render: (entity) => {
617
+ const value = entity.metadata?.[key];
618
+ return value === null || value === undefined
619
+ ? ""
620
+ : typeof value === "object"
621
+ ? JSON.stringify(value)
622
+ : String(value);
623
+ },
624
+ })),
625
+ ];
626
+ const error = invalid ??
627
+ type.error ??
628
+ (type.data && !type.data.entity_type ? "Entity type not found." : null) ??
629
+ list.error;
630
+ const rows = list.data?.entities ?? [];
631
+ return (_jsxs("section", { style: INK, "aria-label": props.entityType, children: [_jsxs("div", { style: {
632
+ display: "flex",
633
+ alignItems: "center",
634
+ justifyContent: "space-between",
635
+ gap: 8,
636
+ marginBottom: 8,
637
+ }, children: [_jsx("h2", { style: { margin: 0, fontSize: 16 }, children: props.title ?? type.data?.entity_type?.name ?? props.entityType }), props.actions] }), error ? (_jsx(ErrorState, { message: error, onRetry: invalid
638
+ ? undefined
639
+ : () => (type.error ? type.refetch() : list.refetch()) })) : !list.loading && list.data && rows.length === 0 && props.empty ? (props.empty) : (_jsx(DataTable, { columns: columns, rows: rows, keyOf: (entity, index) => String(entity.id ?? entity.slug ?? index), loading: type.loading || list.loading || !list.data, emptyText: "No records.", pagination: {
640
+ page,
641
+ pageSize,
642
+ total: list.data?.metadata?.total_count,
643
+ onPage: setPage,
644
+ } }))] }));
645
+ }
425
646
  export * from "./native.js";
426
647
  //# sourceMappingURL=components.js.map
@@ -77,6 +77,17 @@ function shownPart(element, box) {
77
77
  }
78
78
  /** Longest a transition or animation keeps the per-frame sync running. */
79
79
  const MOTION_LIMIT_MS = 5_000;
80
+ /** rAF is absent outside a browser (jsdom, SSR); a timeout keeps the
81
+ * scheduler measuring instead of throwing from inside a MutationObserver. */
82
+ const requestFrame = (callback) => typeof requestAnimationFrame === "function"
83
+ ? requestAnimationFrame(callback)
84
+ : setTimeout(() => callback(performance.now()), 16);
85
+ const cancelFrame = (id) => {
86
+ if (typeof cancelAnimationFrame === "function")
87
+ cancelAnimationFrame(id);
88
+ else
89
+ clearTimeout(id);
90
+ };
80
91
  /**
81
92
  * The slots of one frame. A change that can move a slot — the page's DOM, a
82
93
  * resize, any scroll, an image load, a transition or animation — schedules
@@ -191,7 +202,7 @@ export class EmbedRegistry {
191
202
  mutations?.disconnect();
192
203
  this.observer = null;
193
204
  if (this.frame)
194
- cancelAnimationFrame(this.frame);
205
+ cancelFrame(this.frame);
195
206
  this.frame = 0;
196
207
  };
197
208
  }
@@ -253,7 +264,7 @@ export class EmbedRegistry {
253
264
  schedule() {
254
265
  if (this.frame || this.unsupported || !this.connected)
255
266
  return;
256
- this.frame = requestAnimationFrame(() => {
267
+ this.frame = requestFrame(() => {
257
268
  this.frame = 0;
258
269
  void this.sync();
259
270
  // Mid-motion a slot moves every frame without any other signal.