@lobu/runtime-server 24.6.0 → 24.8.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 (261) hide show
  1. package/dist/catalogs/connectors.json +199 -316
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/imessage.ts +953 -0
  4. package/dist/connectors/linkedin.ts +20 -377
  5. package/dist/dependencies.bun.lock +124 -92
  6. package/dist/embeddings-server.mjs +14 -2
  7. package/dist/owletto/dist/assets/_-B0tmXZ86.js +2 -0
  8. package/dist/owletto/dist/assets/_-DwXULq4r.js +3 -0
  9. package/dist/owletto/dist/assets/_agentId-B1dNkhnr.js +2 -0
  10. package/dist/owletto/dist/assets/_agentId-sYjvnBaB.js +2 -0
  11. package/dist/owletto/dist/assets/_automationId-Bnw_CnT_.js +2 -0
  12. package/dist/owletto/dist/assets/_connectorKey._connectionId-D7Z8DQ-B.js +2 -0
  13. package/dist/owletto/dist/assets/_connectorKey.index-DM5MTO8c.js +2 -0
  14. package/dist/owletto/dist/assets/_conversationId-OJrZjd0o.js +2 -0
  15. package/dist/owletto/dist/assets/_eventId-CfB0_2zK.js +2 -0
  16. package/dist/owletto/dist/assets/_owner-BDvTUY0a.js +3 -0
  17. package/dist/owletto/dist/assets/_shape-BZidoJMB.js +2 -0
  18. package/dist/owletto/dist/assets/_slug-R989vOiM.js +2 -0
  19. package/dist/owletto/dist/assets/_viewKey-BDUSrpe5.js +2 -0
  20. package/dist/owletto/dist/assets/_viewKey-BnFqh5-t.js +2 -0
  21. package/dist/owletto/dist/assets/{accept-invitation-CQZQ0wwC.js → accept-invitation-BC-ZIsrf.js} +2 -2
  22. package/dist/owletto/dist/assets/activity-route-view-CN2dOiCD.js +2 -0
  23. package/dist/owletto/dist/assets/agent-connect-pages-CdDjrHjn.js +4 -0
  24. package/dist/owletto/dist/assets/agent-editor-form-CDAHRNWl.js +2 -0
  25. package/dist/owletto/dist/assets/{agent-loading-shells-_18OREnx.js → agent-loading-shells-BupiSjR-.js} +2 -2
  26. package/dist/owletto/dist/assets/agent-permissions-matrix-ju7L2M0l.js +2 -0
  27. package/dist/owletto/dist/assets/{agent-skill-context-1DBn7Xc_.js → agent-skill-context-B0ZYVE3n.js} +2 -2
  28. package/dist/owletto/dist/assets/agent-subpage-shell-ByU0xhXn.js +2 -0
  29. package/dist/owletto/dist/assets/{agent-thread-FyEO-y44.js → agent-thread-DiVKn1WX.js} +4 -4
  30. package/dist/owletto/dist/assets/agent-thread-storage-Bx2-WBHQ.js +2 -0
  31. package/dist/owletto/dist/assets/app._appId-BQWElSoP.js +2 -0
  32. package/dist/owletto/dist/assets/assist-composer-igTXq3DL.js +2 -0
  33. package/dist/owletto/dist/assets/automation-detail-content-BJwRU6qT.js +2 -0
  34. package/dist/owletto/dist/assets/{callback-9xSHyA12.js → callback-Dmaio9CX.js} +2 -2
  35. package/dist/owletto/dist/assets/{card-g4yxo4Hr.js → card-rE4Ctuy6.js} +2 -2
  36. package/dist/owletto/dist/assets/{claim-B98IhDra.js → claim-BN17CPYh.js} +2 -2
  37. package/dist/owletto/dist/assets/{client-activity-scopes-BD2HBo-_.js → client-activity-scopes-B7xVaUA-.js} +2 -2
  38. package/dist/owletto/dist/assets/{client-rows-x_CxeWkP.js → client-rows-B3LULJxW.js} +2 -2
  39. package/dist/owletto/dist/assets/clients-CydgUHrc.js +2 -0
  40. package/dist/owletto/dist/assets/code-editor-UppEMWpt.js +26 -0
  41. package/dist/owletto/dist/assets/connect-OdHpIVV9.js +2 -0
  42. package/dist/owletto/dist/assets/connect-menu-B9u86bb2.js +2 -0
  43. package/dist/owletto/dist/assets/connect._clientId-EI1tcdSE.js +2 -0
  44. package/dist/owletto/dist/assets/connected._clientId-CaF-ZWlZ.js +2 -0
  45. package/dist/owletto/dist/assets/{connection-B6fM2KHN.js → connection-D8ZAMHBT.js} +2 -2
  46. package/dist/owletto/dist/assets/connection-feed-detail-CJYqryAV.js +2 -0
  47. package/dist/owletto/dist/assets/connector-boxes-BWPXijAk.js +2 -0
  48. package/dist/owletto/dist/assets/connector-page-shell-C23dWdKz.js +2 -0
  49. package/dist/owletto/dist/assets/connector-provenance-CW4CXtCz.js +2 -0
  50. package/dist/owletto/dist/assets/{connectors-DnOUxX_U.js → connectors-Bp08_KPq.js} +2 -2
  51. package/dist/owletto/dist/assets/consent-_PpYI1cT.js +2 -0
  52. package/dist/owletto/dist/assets/copy-button-1ALlvZU1.js +2 -0
  53. package/dist/owletto/dist/assets/{core.esm-BsXtvNoI.js → core.esm-6koO33th.js} +3 -3
  54. package/dist/owletto/dist/assets/create-DULVO0HS.js +2 -0
  55. package/dist/owletto/dist/assets/create-Drx9tcnG.js +2 -0
  56. package/dist/owletto/dist/assets/create-automation-form-BhujNbRr.js +3 -0
  57. package/dist/owletto/dist/assets/create-kUevP9Xx.js +2 -0
  58. package/dist/owletto/dist/assets/create._connectorKey-N6fhcIPy.js +2 -0
  59. package/dist/owletto/dist/assets/custom-guardrail-edits-B_aCgvoZ.js +2 -0
  60. package/dist/owletto/dist/assets/definition-comparison-3zKUSTt8.js +2 -0
  61. package/dist/owletto/dist/assets/detail-page-skeleton-BmxqqIsH.js +2 -0
  62. package/dist/owletto/dist/assets/{device-DdCoCj-Q.js → device-D2eUt_nr.js} +2 -2
  63. package/dist/owletto/dist/assets/device-automation-Dp3faMvp.js +2 -0
  64. package/dist/owletto/dist/assets/device-pin-tombstone-BFPbTM_o.js +2 -0
  65. package/dist/owletto/dist/assets/device._deviceId-Dqtmb1Xp.js +2 -0
  66. package/dist/owletto/dist/assets/dynamic-schema-form-D3KnzCsW.js +2 -0
  67. package/dist/owletto/dist/assets/entity-options-IUdQ-64R.js +2 -0
  68. package/dist/owletto/dist/assets/entity-page-B3Im65EI.js +2 -0
  69. package/dist/owletto/dist/assets/entity-pages-DJNSQrfB.js +2 -0
  70. package/dist/owletto/dist/assets/entity-type-page-CouHZbc9.js +2 -0
  71. package/dist/owletto/dist/assets/event-detail-CvaRN1qB.js +2 -0
  72. package/dist/owletto/dist/assets/event-kind-options-fHAIXu24.js +2 -0
  73. package/dist/owletto/dist/assets/events-feed-DwOkLk6A.js +2 -0
  74. package/dist/owletto/dist/assets/filter-editors-DQ5V4Cvh.js +2 -0
  75. package/dist/owletto/dist/assets/{full-page-spinner-B5xXnKtV.js → full-page-spinner-B7A6Ycyi.js} +2 -2
  76. package/dist/owletto/dist/assets/home-stream-Bg97PUBJ.js +2 -0
  77. package/dist/owletto/dist/assets/home-toolbar-CpCcHA6z.js +2 -0
  78. package/dist/owletto/dist/assets/index-9PGnv4-5.js +2 -0
  79. package/dist/owletto/dist/assets/{index-TkPy_P_u.js → index-B-dZruj6.js} +2 -2
  80. package/dist/owletto/dist/assets/index-BztXeLBN.js +2 -0
  81. package/dist/owletto/dist/assets/index-C2TCKJDP.js +7901 -0
  82. package/dist/owletto/dist/assets/index-C7QM3aqU.js +2 -0
  83. package/dist/owletto/dist/assets/index-CWn46a4y.js +2 -0
  84. package/dist/owletto/dist/assets/index-CxJONizf.js +2 -0
  85. package/dist/owletto/dist/assets/index-DJhb3li3.js +2 -0
  86. package/dist/owletto/dist/assets/{index-BDl1_w6U.js → index-DXfYVs5m.js} +2 -2
  87. package/dist/owletto/dist/assets/{index-BdNR51Ua.js → index-DY-YGnCe.js} +2 -2
  88. package/dist/owletto/dist/assets/index-j3v7ITPb.js +2 -0
  89. package/dist/owletto/dist/assets/index-oiy6ygaI.js +2 -0
  90. package/dist/owletto/dist/assets/index-pEgtAY1t.js +2 -0
  91. package/dist/owletto/dist/assets/index-xAvK3IyQ.css +1 -0
  92. package/dist/owletto/dist/assets/json-diff-CJK-gzCt.js +4 -0
  93. package/dist/owletto/dist/assets/list-skeleton-bQAZ0hQp.js +2 -0
  94. package/dist/owletto/dist/assets/{login-TWR0vF4_.js → login-DLqL54Rk.js} +2 -2
  95. package/dist/owletto/dist/assets/{logout-BA5kojS0.js → logout-H0F3IfiO.js} +2 -2
  96. package/dist/owletto/dist/assets/member-scope-gate-Doic_6qX.js +2 -0
  97. package/dist/owletto/dist/assets/memory-browse-page-CUea2Llz.js +74 -0
  98. package/dist/owletto/dist/assets/model-selector-BrfaDwIg.js +2 -0
  99. package/dist/owletto/dist/assets/new-5GkxlOuQ.js +2 -0
  100. package/dist/owletto/dist/assets/{new-Dc5Bbotb.js → new-BiA4DGoN.js} +2 -2
  101. package/dist/owletto/dist/assets/new-M-MX_T5C.js +2 -0
  102. package/dist/owletto/dist/assets/organization-CLrcmgNK.js +2 -0
  103. package/dist/owletto/dist/assets/peek-pane-content-B29OcHwm.js +2 -0
  104. package/dist/owletto/dist/assets/{pending-seed-BP3xHM2d.js → pending-seed-DYYOoCvj.js} +2 -2
  105. package/dist/owletto/dist/assets/proposal-review-shell-BVwOMoq9.js +2 -0
  106. package/dist/owletto/dist/assets/public-shell-ready-BbjPgh3k.js +2 -0
  107. package/dist/owletto/dist/assets/record-activity-BCpNKaUo.js +2 -0
  108. package/dist/owletto/dist/assets/{record-session-DOFgdd43.js → record-session-KuEDuF3S.js} +2 -2
  109. package/dist/owletto/dist/assets/{renderer-CHPS-1vD.js → renderer-ucwCQmBk.js} +26 -26
  110. package/dist/owletto/dist/assets/{reset-password-BmNM-apc.js → reset-password-BkiAmXZW.js} +2 -2
  111. package/dist/owletto/dist/assets/run-initiator-8vdkq-3o.js +2 -0
  112. package/dist/owletto/dist/assets/{runs-BntGAKQG.js → runs-B_iywKWb.js} +2 -2
  113. package/dist/owletto/dist/assets/runs-list-CJJFRhTl.js +2 -0
  114. package/dist/owletto/dist/assets/schema-type-editor-panel-C4e8pq1A.js +2 -0
  115. package/dist/owletto/dist/assets/{schema-value-BFb7jCBo.js → schema-value-CefbtPIY.js} +3 -3
  116. package/dist/owletto/dist/assets/scoped-feed-bar-CapleZvS.js +2 -0
  117. package/dist/owletto/dist/assets/{settings-DubSpJfg.js → settings-DvzkRYQy.js} +2 -2
  118. package/dist/owletto/dist/assets/skill-route-key-sF006xiz.js +2 -0
  119. package/dist/owletto/dist/assets/source-record-panels-LJIWGtHb.js +2 -0
  120. package/dist/owletto/dist/assets/status-variants-BxHtpMOj.js +2 -0
  121. package/dist/owletto/dist/assets/subDays-DwIOMzYC.js +2 -0
  122. package/dist/owletto/dist/assets/{table-DALHuXPE.js → table-1O-ik4_O.js} +2 -2
  123. package/dist/owletto/dist/assets/{use-automations-D9hKpufo.js → use-automations-lV8PuE8L.js} +2 -2
  124. package/dist/owletto/dist/assets/use-login-redirect-CfCbEeJR.js +2 -0
  125. package/dist/owletto/dist/assets/use-mention-search-CA-evCDf.js +91 -0
  126. package/dist/owletto/dist/assets/view-param-filters-Bp84PUMd.js +2 -0
  127. package/dist/owletto/dist/assets/{views-access-required-CZ1fvAks.js → views-access-required-BerT4Z1d.js} +2 -2
  128. package/dist/owletto/dist/index.html +2 -2
  129. package/dist/server-main.bundle.mjs +358 -141
  130. package/npm-shrinkwrap.json +540 -447
  131. package/package.json +4 -2
  132. package/vendor/connector-sdk/package.json +1 -1
  133. package/vendor/core/dist/connector-query-errors.d.ts +6 -0
  134. package/vendor/core/dist/connector-query-errors.js +4 -0
  135. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +2 -0
  136. package/vendor/core/dist/contracts/tools/manage-entity.js +7 -0
  137. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +2 -0
  138. package/vendor/core/dist/contracts/tools/manage-feeds.js +3 -0
  139. package/vendor/core/dist/contracts/tools/view-host.js +2 -0
  140. package/vendor/core/dist/error-report.js +1 -0
  141. package/vendor/core/package.json +1 -1
  142. package/vendor/views/package.json +1 -1
  143. package/dist/connectors/linkedin-takeout.ts +0 -577
  144. package/dist/connectors/takeout-utils.ts +0 -240
  145. package/dist/owletto/dist/assets/_-DT3E3BmS.js +0 -3
  146. package/dist/owletto/dist/assets/_-DtqBFgK5.js +0 -2
  147. package/dist/owletto/dist/assets/_-c1xy7bLu.js +0 -2
  148. package/dist/owletto/dist/assets/_agentId-CTfoi0-7.js +0 -2
  149. package/dist/owletto/dist/assets/_agentId-DV8utajn.js +0 -2
  150. package/dist/owletto/dist/assets/_automationId-DvP3qyYL.js +0 -2
  151. package/dist/owletto/dist/assets/_connectorKey._connectionId-CL5SivCn.js +0 -2
  152. package/dist/owletto/dist/assets/_connectorKey.index-tnMwC67b.js +0 -2
  153. package/dist/owletto/dist/assets/_conversationId-DXN_8m88.js +0 -2
  154. package/dist/owletto/dist/assets/_eventId-SdpFT7jB.js +0 -2
  155. package/dist/owletto/dist/assets/_name-CM1AMywz.js +0 -2
  156. package/dist/owletto/dist/assets/_owner-CaGsXXBW.js +0 -3
  157. package/dist/owletto/dist/assets/_shape-DGAkETDp.js +0 -2
  158. package/dist/owletto/dist/assets/_skillKey-Dd4ZHPY8.js +0 -2
  159. package/dist/owletto/dist/assets/_slug-cRvJQtNo.js +0 -2
  160. package/dist/owletto/dist/assets/_view-B5I7mmkl.js +0 -2
  161. package/dist/owletto/dist/assets/_viewKey-Bwn0dyLo.js +0 -2
  162. package/dist/owletto/dist/assets/_viewKey-YjSYD0wc.js +0 -2
  163. package/dist/owletto/dist/assets/activity-route-view-CZykJXQp.js +0 -2
  164. package/dist/owletto/dist/assets/agent-card-controls-DuQJhtqp.js +0 -2
  165. package/dist/owletto/dist/assets/agent-client-setup-list-CpUTAjXf.js +0 -4
  166. package/dist/owletto/dist/assets/agent-connect-pages-Br_ycC0z.js +0 -2
  167. package/dist/owletto/dist/assets/agent-editor-form-BXQBFHSv.js +0 -2
  168. package/dist/owletto/dist/assets/agent-guardrails-route-CN7vpC0X.js +0 -2
  169. package/dist/owletto/dist/assets/agent-list-row-BnP6r4pm.js +0 -2
  170. package/dist/owletto/dist/assets/agent-permissions-matrix-DSjidWHL.js +0 -2
  171. package/dist/owletto/dist/assets/agent-skills-route-d5jh3oBR.js +0 -2
  172. package/dist/owletto/dist/assets/agent-tab-intro-DKrC3SQt.js +0 -2
  173. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -2
  174. package/dist/owletto/dist/assets/agents-kXojozTU.js +0 -2
  175. package/dist/owletto/dist/assets/agents-workbench-CDpJmUVN.js +0 -2
  176. package/dist/owletto/dist/assets/app._appId-DwNeXRJp.js +0 -2
  177. package/dist/owletto/dist/assets/assist-composer-Mn9EfX4X.js +0 -2
  178. package/dist/owletto/dist/assets/automation-detail-content-Bs3vwAPd.js +0 -2
  179. package/dist/owletto/dist/assets/automation-row-B5Q1B10y.js +0 -2
  180. package/dist/owletto/dist/assets/automation-source-list-Dhucq1sI.js +0 -2
  181. package/dist/owletto/dist/assets/automations-kXojozTU.js +0 -2
  182. package/dist/owletto/dist/assets/change-summary-DeuXQEpb.js +0 -2
  183. package/dist/owletto/dist/assets/clients-Cmp0LmOp.js +0 -2
  184. package/dist/owletto/dist/assets/connect-menu-CezOH3s7.js +0 -2
  185. package/dist/owletto/dist/assets/connect-zUot_0kG.js +0 -2
  186. package/dist/owletto/dist/assets/connect._clientId-nsGxe6yO.js +0 -2
  187. package/dist/owletto/dist/assets/connected._clientId-DnclRRXk.js +0 -2
  188. package/dist/owletto/dist/assets/connected._clientId.activity-CDB8atTX.js +0 -2
  189. package/dist/owletto/dist/assets/connected._clientId.index-DBNP2mZo.js +0 -2
  190. package/dist/owletto/dist/assets/connection-feed-detail-Ckq-qEbD.js +0 -2
  191. package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +0 -2
  192. package/dist/owletto/dist/assets/connections-browser-BXsJqieG.js +0 -2
  193. package/dist/owletto/dist/assets/connector-boxes-CbqSFeVm.js +0 -2
  194. package/dist/owletto/dist/assets/connector-page-shell-Di6XzkVo.js +0 -2
  195. package/dist/owletto/dist/assets/connector-provenance-BrnasBW4.js +0 -2
  196. package/dist/owletto/dist/assets/connector-scope-lists-dQnZARCD.js +0 -2
  197. package/dist/owletto/dist/assets/consent-Byli4yMs.js +0 -2
  198. package/dist/owletto/dist/assets/copy-button-Ddf7lBjZ.js +0 -2
  199. package/dist/owletto/dist/assets/create-B34eskZ_.js +0 -2
  200. package/dist/owletto/dist/assets/create-DLB9sXgU.js +0 -2
  201. package/dist/owletto/dist/assets/create-YdAnh3ml.js +0 -2
  202. package/dist/owletto/dist/assets/create-automation-form-C9PMX7N8.js +0 -3
  203. package/dist/owletto/dist/assets/create._connectorKey-Bz4OYRiC.js +0 -2
  204. package/dist/owletto/dist/assets/definition-comparison-B5WgZILB.js +0 -2
  205. package/dist/owletto/dist/assets/device-pin-tombstone-B06J7Af1.js +0 -2
  206. package/dist/owletto/dist/assets/device._deviceId-Bh9S4bFp.js +0 -2
  207. package/dist/owletto/dist/assets/dynamic-schema-form-qWSRtOAv.js +0 -2
  208. package/dist/owletto/dist/assets/entity-options-BkU_En_f.js +0 -2
  209. package/dist/owletto/dist/assets/entity-page-BPFDHY8q.js +0 -2
  210. package/dist/owletto/dist/assets/entity-pages-DxgbjLMt.js +0 -2
  211. package/dist/owletto/dist/assets/entity-type-page-D0ghgRgq.js +0 -2
  212. package/dist/owletto/dist/assets/event-card-CjA_dLzq.js +0 -2
  213. package/dist/owletto/dist/assets/event-detail-CmC-DVrK.js +0 -2
  214. package/dist/owletto/dist/assets/events-feed-CGzA1w3R.js +0 -2
  215. package/dist/owletto/dist/assets/filter-bar-CQ_oE7a9.js +0 -2
  216. package/dist/owletto/dist/assets/guardrails-DkXatmea.js +0 -2
  217. package/dist/owletto/dist/assets/identity-BwJy3ixB.js +0 -2
  218. package/dist/owletto/dist/assets/index-35ehGReZ.js +0 -2
  219. package/dist/owletto/dist/assets/index-B9hYiwBw.js +0 -2
  220. package/dist/owletto/dist/assets/index-BjcZVe7n.js +0 -7899
  221. package/dist/owletto/dist/assets/index-BqAVebvY.js +0 -2
  222. package/dist/owletto/dist/assets/index-BvK1fS1J.js +0 -2
  223. package/dist/owletto/dist/assets/index-CNEpTkgw.css +0 -1
  224. package/dist/owletto/dist/assets/index-CRc73k1t.js +0 -2
  225. package/dist/owletto/dist/assets/index-CYGaSD3y.js +0 -2
  226. package/dist/owletto/dist/assets/index-CfZGe-zn.js +0 -2
  227. package/dist/owletto/dist/assets/index-CkiyxW4w.js +0 -2
  228. package/dist/owletto/dist/assets/index-CzLDNB2E.js +0 -2
  229. package/dist/owletto/dist/assets/index-D-o5iOVd.js +0 -2
  230. package/dist/owletto/dist/assets/index-DjYVV1Ml.js +0 -2
  231. package/dist/owletto/dist/assets/index-VyAX-asP.js +0 -2
  232. package/dist/owletto/dist/assets/json-diff-DtZtra_g.js +0 -28
  233. package/dist/owletto/dist/assets/list-skeleton-CIHWCi2a.js +0 -2
  234. package/dist/owletto/dist/assets/manage-gear-C-0BAMbC.js +0 -2
  235. package/dist/owletto/dist/assets/member-scope-gate-BQiRAqtx.js +0 -2
  236. package/dist/owletto/dist/assets/memory-browse-page-Ba32-vVL.js +0 -74
  237. package/dist/owletto/dist/assets/model-C2q7WDcS.js +0 -2
  238. package/dist/owletto/dist/assets/model-selector-B2cjCn0V.js +0 -2
  239. package/dist/owletto/dist/assets/models-CZkH5gtj.js +0 -2
  240. package/dist/owletto/dist/assets/nav-pill-Bam6s3jj.js +0 -2
  241. package/dist/owletto/dist/assets/new-BJst6K0b.js +0 -2
  242. package/dist/owletto/dist/assets/new-DgbivfDe.js +0 -2
  243. package/dist/owletto/dist/assets/organization-B9U1L-56.js +0 -2
  244. package/dist/owletto/dist/assets/peek-pane-content-Cq8P38s3.js +0 -2
  245. package/dist/owletto/dist/assets/permissions-BVlbeY4u.js +0 -2
  246. package/dist/owletto/dist/assets/proposal-review-shell-BED-DO9C.js +0 -2
  247. package/dist/owletto/dist/assets/public-shell-ready-Diq15_QW.js +0 -2
  248. package/dist/owletto/dist/assets/record-activity-CTLwq8s1.js +0 -2
  249. package/dist/owletto/dist/assets/run-activity-link-Dh1YyCfk.js +0 -2
  250. package/dist/owletto/dist/assets/run-initiator-CCxNv0rK.js +0 -2
  251. package/dist/owletto/dist/assets/runs-panel-BwTVaRsE.js +0 -2
  252. package/dist/owletto/dist/assets/runs-table-CYS1jDdL.js +0 -2
  253. package/dist/owletto/dist/assets/schema-type-editor-panel-v3nR2Oa2.js +0 -2
  254. package/dist/owletto/dist/assets/settings-DBgT60nY.js +0 -2
  255. package/dist/owletto/dist/assets/skills-DDoeRGhJ.js +0 -2
  256. package/dist/owletto/dist/assets/source-record-panels-m8gECt82.js +0 -2
  257. package/dist/owletto/dist/assets/status-dot-BnQPFrcU.js +0 -2
  258. package/dist/owletto/dist/assets/use-login-redirect-ciwfc-7A.js +0 -2
  259. package/dist/owletto/dist/assets/use-mention-search-CJGCatFS.js +0 -96
  260. package/dist/owletto/dist/assets/use-scroll-sentinel-BWCrmNIB.js +0 -2
  261. package/dist/owletto/dist/assets/view-param-filters-CDvwie_f.js +0 -2
@@ -878,7 +878,8 @@ var init_error_report = __esm({
878
878
  "NOT_FOUND",
879
879
  "VALIDATION",
880
880
  "PERMISSION",
881
- "MANUAL_EDIT_NOT_ALLOWED"
881
+ "MANUAL_EDIT_NOT_ALLOWED",
882
+ "PRECONDITION_FAILED"
882
883
  ]);
883
884
  DEPENDENCY_TOOL_CODES = /* @__PURE__ */ new Set([
884
885
  "AUTH_INVALID",
@@ -1192,6 +1193,10 @@ var init_connector_query_errors = __esm({
1192
1193
  retryable: false,
1193
1194
  message: "This caller may not assert a manual edit; it needs the entities:manual_edit scope and no agent, MCP session or Automation behind it."
1194
1195
  },
1196
+ PRECONDITION_FAILED: {
1197
+ retryable: false,
1198
+ message: "A field changed since it was read, so nothing was written; re-read it and retry with the current values."
1199
+ },
1195
1200
  RATE_LIMITED: {
1196
1201
  retryable: true,
1197
1202
  message: "The upstream rate limit was hit; retry shortly."
@@ -8498,6 +8503,8 @@ function toolErrorHttpStatus(code) {
8498
8503
  case "PERMISSION":
8499
8504
  case "MANUAL_EDIT_NOT_ALLOWED":
8500
8505
  return 403;
8506
+ case "PRECONDITION_FAILED":
8507
+ return 409;
8501
8508
  case "RATE_LIMITED":
8502
8509
  return 429;
8503
8510
  case "VALIDATION":
@@ -8544,12 +8551,19 @@ var init_errors2 = __esm({
8544
8551
  */
8545
8552
  retryAfterSeconds;
8546
8553
  callId;
8547
- constructor(message, httpStatus = 400, code) {
8554
+ /**
8555
+ * Structured, caller-safe facts about the failure (e.g. `mismatched_fields`
8556
+ * for `PRECONDITION_FAILED`). Every wire boundary that reports `code`
8557
+ * reports these alongside it, so a client branches on data, not prose.
8558
+ */
8559
+ details;
8560
+ constructor(message, httpStatus = 400, code, details) {
8548
8561
  super(message);
8549
8562
  this.name = "ToolUserError";
8550
8563
  this.httpStatus = CDN_SUBSTITUTED_STATUSES.has(httpStatus) ? code ? toolErrorHttpStatus(code) : 500 : httpStatus;
8551
8564
  this.code = code;
8552
8565
  this.retryable = code ? isRetryable(code) : false;
8566
+ this.details = details;
8553
8567
  }
8554
8568
  };
8555
8569
  ToolNotRegisteredError = class extends Error {
@@ -12982,8 +12996,9 @@ export default async (_ctx, client) => {
12982
12996
  };`
12983
12997
  },
12984
12998
  "entities.update": {
12985
- summary: "Update an existing entity.",
12986
- access: "write"
12999
+ summary: "Update an existing entity. Pass `expected` (metadata field -> the value you read) to make the write conditional: if any field changed since, nothing is written and the call fails with 409 PRECONDITION_FAILED, whose `details.mismatched_fields` names the stale fields.",
13000
+ access: "write",
13001
+ example: "await client.entities.update({ entity_id: 42, expected: { stage: 'open' }, metadata: { stage: 'won' } });"
12987
13002
  },
12988
13003
  "entities.delete": {
12989
13004
  summary: "Delete an entity. force_delete_tree hard-deletes the whole descendant tree (event history is kept, only detached); dry_run previews what would be removed/detached without mutating.",
@@ -14104,6 +14119,12 @@ function resolveSdkMaxAccessLevel(memberRole2, scopes, accountScope = false) {
14104
14119
  function isPublicReadable(toolName, args) {
14105
14120
  return actionMatches(PUBLIC_READ_ACTIONS, toolName, args);
14106
14121
  }
14122
+ function publicToolDenial(toolName) {
14123
+ if (toolName === "query_sql" || toolName === "query_sdk") {
14124
+ return "SQL and SDK queries are not available to public workspace visitors. Sign in and join this workspace, or use its public pages.";
14125
+ }
14126
+ return null;
14127
+ }
14107
14128
  function getPublicReadableActions(toolName) {
14108
14129
  return PUBLIC_READ_ACTIONS[toolName];
14109
14130
  }
@@ -16054,6 +16075,9 @@ async function runScript(options) {
16054
16075
  error: {
16055
16076
  name: error.name,
16056
16077
  message: error.message,
16078
+ // A script that catches the failure branches on these (e.g.
16079
+ // `mismatched_fields` on PRECONDITION_FAILED), not on prose.
16080
+ ...error.details === void 0 ? {} : { details: safeErrorDetails(error.details) },
16057
16081
  classificationToken: trustErrorClassification(code)
16058
16082
  }
16059
16083
  });
@@ -34220,9 +34244,9 @@ function parseDateAlias(alias, referenceDate = /* @__PURE__ */ new Date()) {
34220
34244
  if (named) {
34221
34245
  return { date: utcDayStartBefore(referenceDate, named), originalInput: alias };
34222
34246
  }
34223
- const relative5 = parseRelativeAlias(lowered);
34224
- if (relative5) {
34225
- return { date: utcDayStartBefore(referenceDate, relative5), originalInput: alias };
34247
+ const relative4 = parseRelativeAlias(lowered);
34248
+ if (relative4) {
34249
+ return { date: utcDayStartBefore(referenceDate, relative4), originalInput: alias };
34226
34250
  }
34227
34251
  const instant = parseIsoInstant(unquoted);
34228
34252
  if (instant) {
@@ -40373,6 +40397,10 @@ var init_run_lease = __esm({
40373
40397
  });
40374
40398
 
40375
40399
  // src/tools/admin/approval-events.ts
40400
+ function operationCardLabel(metadata, runActionKey) {
40401
+ const label = metadata.operation_name ?? metadata.action_name ?? metadata.operation_key ?? metadata.action_key ?? runActionKey;
40402
+ return typeof label === "string" && label !== "" ? label : "Operation";
40403
+ }
40376
40404
  function requireApprovalCard(runId, eventId, transition) {
40377
40405
  if (eventId === void 0) {
40378
40406
  throw new Error(
@@ -40408,10 +40436,11 @@ async function terminalizeApprovalRunCompleted(runId, organizationId, output, ca
40408
40436
  return cardId;
40409
40437
  });
40410
40438
  }
40411
- async function supersedeActionEvent(runId, organizationId, status, title, content, extraMetadata = {}, reviewer = null, db = getDb(), interactionInput) {
40439
+ async function supersedeActionEvent(runId, organizationId, status, titleText, contentText2, extraMetadata = {}, reviewer = null, db = getDb(), interactionInput) {
40412
40440
  const sql2 = db;
40413
40441
  const originalEvent = await sql2`
40414
- SELECT id, entity_ids, metadata, author_name, interaction_input_schema, interaction_input
40442
+ SELECT id, entity_ids, metadata, author_name, interaction_input_schema, interaction_input,
40443
+ (SELECT action_key FROM runs WHERE id = ${runId} AND organization_id = ${organizationId}) AS run_action_key
40415
40444
  FROM current_event_records
40416
40445
  WHERE run_id = ${runId}
40417
40446
  AND organization_id = ${organizationId}
@@ -40422,6 +40451,9 @@ async function supersedeActionEvent(runId, organizationId, status, title, conten
40422
40451
  if (originalEvent.length === 0) return void 0;
40423
40452
  const orig = originalEvent[0];
40424
40453
  const priorMetadata = orig.metadata ?? {};
40454
+ const operationName = operationCardLabel(priorMetadata, orig.run_action_key);
40455
+ const title = typeof titleText === "function" ? titleText(operationName) : titleText;
40456
+ const content = typeof contentText2 === "function" ? contentText2(operationName) : contentText2;
40425
40457
  const reviewedById = reviewer?.userId ?? priorMetadata.reviewed_by_id ?? null;
40426
40458
  const reviewedByName = reviewer?.name ?? priorMetadata.reviewed_by_name ?? null;
40427
40459
  const reviewedAt = reviewer ? (/* @__PURE__ */ new Date()).toISOString() : priorMetadata.reviewed_at ?? null;
@@ -40461,9 +40493,7 @@ async function supersedeActionEvent(runId, organizationId, status, title, conten
40461
40493
  runId,
40462
40494
  organizationId,
40463
40495
  cardStatus: status,
40464
- operationName: String(
40465
- priorMetadata.operation_name ?? priorMetadata.action_name ?? priorMetadata.operation_key ?? priorMetadata.action_key ?? "Operation"
40466
- ),
40496
+ operationName,
40467
40497
  connectionName: typeof priorMetadata.connection_name === "string" ? priorMetadata.connection_name : null,
40468
40498
  output: extraMetadata.output ?? extraMetadata.action_output ?? null,
40469
40499
  reason: String(
@@ -40583,13 +40613,12 @@ async function terminalizeInlineOperationRun(runId, organizationId, claimedBy, t
40583
40613
  RETURNING action_key
40584
40614
  `;
40585
40615
  if (rows.length === 0) return false;
40586
- const actionKey = rows[0].action_key ?? "Operation";
40587
40616
  await supersedeActionEvent(
40588
40617
  runId,
40589
40618
  organizationId,
40590
40619
  terminal.status,
40591
- `${actionKey} \u2014 ${terminal.status}`,
40592
- terminal.status === "completed" ? `Operation completed: ${actionKey}` : `Operation failed: ${actionKey} \u2014 ${terminal.errorMessage}`,
40620
+ (operation) => `${operation} \u2014 ${terminal.status}`,
40621
+ (operation) => terminal.status === "completed" ? `Operation completed: ${operation}` : `Operation failed: ${operation} \u2014 ${terminal.errorMessage}`,
40593
40622
  terminal.status === "completed" ? { output: terminal.output } : {
40594
40623
  error_message: terminal.errorMessage,
40595
40624
  ...output === null ? {} : { output }
@@ -40729,7 +40758,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
40729
40758
  if (!blocked && !resolved) throw new Error("Approval operation became unavailable during policy recheck");
40730
40759
  const connectionName = resolved?.connection.display_name ?? run.connector_key ?? "Connection";
40731
40760
  const status = blocked ? "rejected" : "pending_approval";
40732
- const title = `${run.action_key ?? "Operation"} \u2014 ${blocked ? "blocked by policy" : "pending approval"}`;
40761
+ const title = (operation) => `${operation} \u2014 ${blocked ? "blocked by policy" : "pending approval"}`;
40733
40762
  const metadata = {
40734
40763
  policy_reason: policy.reason,
40735
40764
  policy_rule_ids: policy.ruleIds,
@@ -40741,7 +40770,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
40741
40770
  entityIds: [],
40742
40771
  organizationId,
40743
40772
  originId: `run_${runId}_${status}`,
40744
- title,
40773
+ title: title(operationCardLabel({ operation_name: resolved?.operation.name }, run.action_key)),
40745
40774
  content: message,
40746
40775
  semanticType: "operation",
40747
40776
  runId,
@@ -40750,7 +40779,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
40750
40779
  interactionType: "approval",
40751
40780
  interactionStatus: blocked ? "rejected" : "pending",
40752
40781
  interactionInput: isSourceFeedRead(run.run_metadata) ? null : run.action_input,
40753
- metadata: { ...metadata, status, run_id: runId, action_key: run.action_key, operation_key: run.action_key }
40782
+ metadata: { ...metadata, ...resolved ? { operation_name: resolved.operation.name } : {}, status, run_id: runId, action_key: run.action_key, operation_key: run.action_key }
40754
40783
  }, { sql: sql2 });
40755
40784
  cardId = Number(event.id);
40756
40785
  }
@@ -41099,6 +41128,10 @@ function connectorRunEnv(opts) {
41099
41128
  const env = buildConnectorWorkerEnv();
41100
41129
  return { ...opts.cloud && opts.organizationSupplied ? withoutDeploymentProviderKeys(env) : env };
41101
41130
  }
41131
+ function httpEgressAllowHostsEnv() {
41132
+ const hosts = process.env.LOBU_HTTP_EGRESS_ALLOW_HOSTS;
41133
+ return hosts ? { LOBU_HTTP_EGRESS_ALLOW_HOSTS: hosts } : {};
41134
+ }
41102
41135
  function buildConnectorWorkerEnv() {
41103
41136
  return {
41104
41137
  ENVIRONMENT: process.env.ENVIRONMENT || "production",
@@ -41122,7 +41155,8 @@ function buildConnectorWorkerEnv() {
41122
41155
  // predates that field. The isolate HOST refuses internal/metadata addresses
41123
41156
  // for a DB socket under block-private (`socketOpen` in `executor/isolate.ts`);
41124
41157
  // self-hosted (allow-private) reaches its own private DB.
41125
- LOBU_DB_EGRESS_POLICY: cloudModeOn() ? "block-private" : "allow-private"
41158
+ LOBU_DB_EGRESS_POLICY: cloudModeOn() ? "block-private" : "allow-private",
41159
+ ...httpEgressAllowHostsEnv()
41126
41160
  };
41127
41161
  }
41128
41162
  var DEPLOYMENT_PROVIDER_ENV_KEYS;
@@ -43751,6 +43785,11 @@ function refusedAddress(error) {
43751
43785
  return "";
43752
43786
  return null;
43753
43787
  }
43788
+ function operatorHttpExemptHosts(job) {
43789
+ if (job.mode === "agent_turn" || job.env?.LOBU_DB_EGRESS_POLICY !== "allow-private")
43790
+ return [];
43791
+ return parseExemptHosts(job.env.LOBU_HTTP_EGRESS_ALLOW_HOSTS, "LOBU_HTTP_EGRESS_ALLOW_HOSTS").map((host2) => stripIpv6Brackets(normalizeDomainPattern(host2)));
43792
+ }
43754
43793
  var MIB, DEFAULT_OPTIONS, STREAM_TAIL_CAP_BYTES, MAX_REDIRECTS, MAX_OPEN_FETCHES, IsolateRuntimeUnavailableError, GUEST_RUNNER, CROSS_ORIGIN_SENSITIVE_HEADERS, UNSUPPORTED_SCHEME_MESSAGE, IsolateExecutor;
43755
43794
  var init_isolate = __esm({
43756
43795
  "../connector-worker/dist/executor/isolate.js"() {
@@ -44096,6 +44135,7 @@ var init_isolate = __esm({
44096
44135
  throw new Error("HTTP authentication requires a gateway fetch hook");
44097
44136
  }
44098
44137
  assertIsolateEligible(compiledCode);
44138
+ const exemptHosts = [...this.exactAllowedHosts, ...operatorHttpExemptHosts(job)];
44099
44139
  const ivm = await this.requireIsolatedVm();
44100
44140
  const tail = new RingBuffer(STREAM_TAIL_CAP_BYTES);
44101
44141
  let logBytesUsed = 0;
@@ -44115,7 +44155,7 @@ var init_isolate = __esm({
44115
44155
  closeFetch(active);
44116
44156
  activeFetches.clear();
44117
44157
  };
44118
- const egress = new EgressDispatcher({ exemptHosts: this.exactAllowedHosts, lookup: this.options.lookup });
44158
+ const egress = new EgressDispatcher({ exemptHosts, lookup: this.options.lookup });
44119
44159
  const vault = new CredentialVault();
44120
44160
  const guestJob = concealCredentials(job, vault);
44121
44161
  let host2 = null;
@@ -44212,6 +44252,7 @@ var init_isolate = __esm({
44212
44252
  };
44213
44253
  const network = {
44214
44254
  egress,
44255
+ exemptHosts,
44215
44256
  vault,
44216
44257
  spends: /* @__PURE__ */ new Set(),
44217
44258
  log: log3,
@@ -44717,7 +44758,7 @@ ${GUEST_RUNNER}`;
44717
44758
  let spent;
44718
44759
  try {
44719
44760
  spent = net4.vault.swapHeaders(headers, url, {
44720
- plaintextAllowed: this.exactAllowedHosts.includes(bareHost) && (bareHost === "localhost" || isReservedIp(bareHost))
44761
+ plaintextAllowed: net4.exemptHosts.includes(bareHost) && (bareHost === "localhost" || isReservedIp(bareHost))
44721
44762
  });
44722
44763
  } catch (error) {
44723
44764
  throw refuse(net4.log, `fetch to ${url.hostname}: ${error instanceof Error ? error.message : String(error)}`);
@@ -46239,6 +46280,11 @@ function buildNotificationCard(ownerSlug, n) {
46239
46280
  const type = String(n.type ?? "generic");
46240
46281
  const created = String(n.created_at ?? (/* @__PURE__ */ new Date()).toISOString());
46241
46282
  const atMs = new Date(created).getTime();
46283
+ const resourceSubjectId = (type2) => {
46284
+ if (n.resource_type !== type2) return void 0;
46285
+ const subjectId = Number(n.resource_id);
46286
+ return Number.isSafeInteger(subjectId) && subjectId > 0 ? subjectId : void 0;
46287
+ };
46242
46288
  const approvalRunId = n.approval_run_id != null ? Number(n.approval_run_id) : NaN;
46243
46289
  const interactionType = typeof n.interaction_type === "string" && n.interaction_type !== "" ? n.interaction_type : void 0;
46244
46290
  const interactionStatus = interactionType === "authorization" && typeof n.interaction_status === "string" ? n.interaction_status : interactionType === "approval" && typeof n.approval_status === "string" && n.approval_status !== "" ? n.approval_status : void 0;
@@ -46275,12 +46321,12 @@ function buildNotificationCard(ownerSlug, n) {
46275
46321
  browser_url: typeof n.browser_url === "string" ? n.browser_url : void 0,
46276
46322
  browser_handoff: browserHandoff,
46277
46323
  platform: typeof n.platform === "string" ? n.platform : void 0,
46278
- connection_id: typeof n.connection_id === "number" ? n.connection_id : void 0,
46324
+ connection_id: typeof n.connection_id === "number" ? n.connection_id : resourceSubjectId("connection"),
46279
46325
  connection_name: typeof n.connection_name === "string" ? n.connection_name : void 0,
46280
46326
  feed_id: typeof n.feed_id === "number" ? n.feed_id : void 0,
46281
46327
  feed_key: typeof n.feed_key === "string" ? n.feed_key : void 0,
46282
46328
  feed_name: typeof n.feed_name === "string" ? n.feed_name : void 0,
46283
- automation_id: typeof n.automation_id === "number" ? n.automation_id : void 0,
46329
+ automation_id: typeof n.automation_id === "number" ? n.automation_id : resourceSubjectId("automation"),
46284
46330
  automation_name: typeof n.automation_name === "string" ? n.automation_name : void 0,
46285
46331
  agent_id: typeof n.agent_id === "string" ? n.agent_id : void 0,
46286
46332
  agent_name: typeof n.agent_name === "string" ? n.agent_name : void 0,
@@ -48525,13 +48571,12 @@ async function waitForDeviceActionRunWithOptions(runId, organizationId, options)
48525
48571
  RETURNING id, action_key
48526
48572
  `;
48527
48573
  if (rows.length === 0) return rows;
48528
- const actionKey = rows[0].action_key ?? "Operation";
48529
48574
  await supersedeActionEvent(
48530
48575
  runId,
48531
48576
  organizationId,
48532
48577
  "failed",
48533
- `${actionKey} \u2014 ${callerAbortMessage == null ? "timed out" : "caller wait ended"}`,
48534
- `Operation ${callerAbortMessage == null ? "timed out" : "wait ended"}: ${actionKey} \u2014 ${timeoutMessage}`,
48578
+ (operation) => `${operation} \u2014 ${callerAbortMessage == null ? "timed out" : "caller wait ended"}`,
48579
+ (operation) => `Operation ${callerAbortMessage == null ? "timed out" : "wait ended"}: ${operation} \u2014 ${timeoutMessage}`,
48535
48580
  { error_message: timeoutMessage, run_status: "timeout" },
48536
48581
  null,
48537
48582
  tx
@@ -50816,7 +50861,7 @@ async function runConnectorQuery(p) {
50816
50861
  ...mergeExecutionConfig(conn.config, connectionCredentials, p.config),
50817
50862
  ...dbEgressConfig()
50818
50863
  },
50819
- env: dbEgressConfig(),
50864
+ env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() },
50820
50865
  sessionState,
50821
50866
  credentials,
50822
50867
  httpAuth,
@@ -51204,7 +51249,7 @@ async function readSourceFeedWithinDeadline(p, onBrowserLease) {
51204
51249
  cursor: p.cursor,
51205
51250
  window: p.window,
51206
51251
  config,
51207
- env: dbEgressConfig(),
51252
+ env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() },
51208
51253
  sessionState,
51209
51254
  browser: await connectionBrowserGrant(p.scope.organizationId, feed.connection_id, feed.pinned_version ?? feed.definition_version),
51210
51255
  credentials,
@@ -51241,6 +51286,7 @@ var init_connector_pushdown = __esm({
51241
51286
  "use strict";
51242
51287
  init_src();
51243
51288
  init_browser_resource();
51289
+ init_env2();
51244
51290
  init_runtime();
51245
51291
  init_dist();
51246
51292
  init_insert_event();
@@ -67040,6 +67086,11 @@ Please ensure your LLM output matches the template schema exactly.`,
67040
67086
  NULLIF(model_used, 'external-client'),
67041
67087
  CASE
67042
67088
  WHEN dispatched_message_id IS NOT NULL THEN 'lobu-agent'
67089
+ WHEN approved_input->>'device_worker_id' IS NOT NULL
67090
+ THEN 'device-cli' || COALESCE(
67091
+ ':' || NULLIF(btrim(approved_input->>'agent_kind'), ''),
67092
+ ''
67093
+ )
67043
67094
  ELSE 'external-client'
67044
67095
  END
67045
67096
  ),
@@ -78389,7 +78440,7 @@ function IdentityDecisionResults(action2) {
78389
78440
  )
78390
78441
  ];
78391
78442
  }
78392
- var EntityType, EntityReferenceType, EntityId2, EntityFields, Metadata, AutomationSource, DryRun, IncludeDeleted, EdgeEndpoints, RelationshipId, Confidence2, RelationshipSource, CreateEntityAction, UpdateEntityAction, ListEntitiesAction, GetEntityAction, DeleteEntityAction, IdentityPreview, LinkEntitiesAction, UnlinkEntitiesAction, UpdateLinkAction, ListLinksAction, DiscoverDuplicatesAction, ManageEntitySchema, RelationshipRowSchema, RelationshipCountByTypeSchema, EntityIdentitySchema, ManageEntityItemSchema, RelationshipReadFailureSchema, ManageEntityResultSchema;
78443
+ var EntityType, EntityReferenceType, EntityId2, EntityFields, Metadata, AutomationSource, DryRun, IncludeDeleted, EdgeEndpoints, RelationshipId, Confidence2, RelationshipSource, CreateEntityAction, MAX_EXPECTED_FIELDS, UpdateEntityAction, ListEntitiesAction, GetEntityAction, DeleteEntityAction, IdentityPreview, LinkEntitiesAction, UnlinkEntitiesAction, UpdateLinkAction, ListLinksAction, DiscoverDuplicatesAction, ManageEntitySchema, RelationshipRowSchema, RelationshipCountByTypeSchema, EntityIdentitySchema, ManageEntityItemSchema, RelationshipReadFailureSchema, ManageEntityResultSchema;
78393
78444
  var init_manage_entity = __esm({
78394
78445
  "../core/src/contracts/tools/manage-entity.ts"() {
78395
78446
  "use strict";
@@ -78493,6 +78544,7 @@ var init_manage_entity = __esm({
78493
78544
  metadata: Type23.Optional(Metadata),
78494
78545
  automation_source: Type23.Optional(AutomationSource)
78495
78546
  });
78547
+ MAX_EXPECTED_FIELDS = 50;
78496
78548
  UpdateEntityAction = Type23.Object({
78497
78549
  action: Type23.Literal("update", {
78498
78550
  description: "Patch entity fields (human-owned fields queued for approval)."
@@ -78522,6 +78574,13 @@ var init_manage_entity = __esm({
78522
78574
  description: "[update] Assert that the signed-in person made this change themselves, so it is recorded as their manual edit: the fields it sets (and affirm_fields) become theirs, and Automations then queue an approval instead of updating them. A wrong assertion takes the field away from Automations. Honoured for a person's own web-session edit, or for a token minted with the entities:manual_edit scope by a person in the web app, with no agent, MCP session or Automation behind the call; otherwise the update fails with 403 MANUAL_EDIT_NOT_ALLOWED and nothing is written. Defaults to false."
78523
78575
  })
78524
78576
  ),
78577
+ // Optimistic concurrency: the values the caller read before writing
78578
+ expected: Type23.Optional(
78579
+ Type23.Record(Type23.String(), Type23.Unknown(), {
78580
+ maxProperties: MAX_EXPECTED_FIELDS,
78581
+ description: `[update] Metadata field name -> the value the caller last read. Checked against the live row under the update's row lock: if any field differs, nothing is written (no field changes, ownership markers, events or approvals) and the update fails with 409 PRECONDITION_FAILED listing the field names in mismatched_fields. Values compare structurally (object key order is ignored); null matches a field that was never set. Metadata fields only (not name, content, slug or parent_id); at most ${MAX_EXPECTED_FIELDS} keys.`
78582
+ })
78583
+ ),
78525
78584
  automation_source: Type23.Optional(AutomationSource)
78526
78585
  });
78527
78586
  ListEntitiesAction = Type23.Object({
@@ -80965,6 +81024,7 @@ async function handleUpdate2(args, env, ctx) {
80965
81024
  if (args.affirm_fields !== void 0)
80966
81025
  updateData.affirm_fields = args.affirm_fields;
80967
81026
  if (args.manual_edit !== void 0) updateData.manual_edit = args.manual_edit;
81027
+ if (args.expected !== void 0) updateData.expected = args.expected;
80968
81028
  const updateActor = await actingPrincipalFor2(args, ctx);
80969
81029
  const updateAttribution = await resolveAutomationAttribution(
80970
81030
  ctx,
@@ -84329,6 +84389,11 @@ var init_manage_feeds = __esm({
84329
84389
  description: "Filter by runtime health for active feeds on non-paused connections; paused feeds and feeds on paused connections are excluded. 'failing' = last sync failed or the feed has one or more consecutive failures; 'healthy' = otherwise. Surfaces active-but-failing feeds the `status` filter cannot."
84330
84390
  })
84331
84391
  ),
84392
+ include_event_count: Type26.Optional(
84393
+ Type26.Boolean({
84394
+ description: "Add `event_count`, each feed's stored events. Counting takes seconds on a busy connection, so it is off by default; ask for it only when you show the number."
84395
+ })
84396
+ ),
84332
84397
  ...paginationFields(50)
84333
84398
  });
84334
84399
  ReadFeedAction = Type26.Object({
@@ -84916,10 +84981,8 @@ async function handleListFeeds(args, ctx) {
84916
84981
  WHERE ${where}
84917
84982
  ORDER BY f.created_at DESC LIMIT ${limit} OFFSET ${offset}
84918
84983
  `;
84919
- const query = sql2`
84920
- WITH page AS MATERIALIZED (
84921
- ${pageQuery}
84922
- ),
84984
+ const countEvents = args.include_event_count === true;
84985
+ const eventCounts = countEvents ? sql2`,
84923
84986
  event_counts AS (
84924
84987
  SELECT e.connection_id, e.feed_key, COUNT(*)::int AS event_count
84925
84988
  FROM events e
@@ -84934,7 +84997,14 @@ async function handleListFeeds(args, ctx) {
84934
84997
  AND e.feed_key = ANY(ARRAY(SELECT DISTINCT feed_key FROM page WHERE feed_key IS NOT NULL))
84935
84998
  AND e.superseded_by IS NULL
84936
84999
  GROUP BY e.connection_id, e.feed_key
85000
+ )` : sql2``;
85001
+ const eventCountColumn = countEvents ? sql2`, COALESCE(ec.event_count, 0)::int AS event_count` : sql2``;
85002
+ const eventCountJoin = countEvents ? sql2`LEFT JOIN event_counts ec ON ec.connection_id = p.connection_id AND ec.feed_key = p.feed_key` : sql2``;
85003
+ const query = sql2`
85004
+ WITH page AS MATERIALIZED (
85005
+ ${pageQuery}
84937
85006
  )
85007
+ ${eventCounts}
84938
85008
  SELECT p.*, c.connector_key, c.display_name AS connection_name,
84939
85009
  c.status AS connection_status,
84940
85010
  c.external_tenant_id AS external_tenant_id,
@@ -84970,8 +85040,8 @@ async function handleListFeeds(args, ctx) {
84970
85040
  WHERE subscription.organization_id = p.organization_id
84971
85041
  AND subscription.connection_id = p.connection_id
84972
85042
  AND subscription.channel_id = p.feed_key
84973
- LIMIT 1) AS target_agent_id,
84974
- COALESCE(ec.event_count, 0)::int AS event_count
85043
+ LIMIT 1) AS target_agent_id
85044
+ ${eventCountColumn}
84975
85045
  FROM page p
84976
85046
  JOIN connections c ON c.id = p.connection_id
84977
85047
  JOIN "organization" o ON o.id = c.organization_id
@@ -85002,7 +85072,7 @@ async function handleListFeeds(args, ctx) {
85002
85072
  })}
85003
85073
  ) cv ON TRUE
85004
85074
  LEFT JOIN auth_profiles ap ON ap.id = c.auth_profile_id
85005
- LEFT JOIN event_counts ec ON ec.connection_id = p.connection_id AND ec.feed_key = p.feed_key
85075
+ ${eventCountJoin}
85006
85076
  ORDER BY p.created_at DESC
85007
85077
  `;
85008
85078
  const rows = await query;
@@ -93358,6 +93428,15 @@ var init_multi_tenant = __esm({
93358
93428
  if (!requestedOrgId) {
93359
93429
  return setContextAndContinue({ organizationId: null, memberRole: null });
93360
93430
  }
93431
+ if (requestedOrgVisibility === "public" && requestedToolName) {
93432
+ const denial = publicToolDenial(requestedToolName);
93433
+ if (denial) {
93434
+ return c.json(
93435
+ { error: "forbidden", error_description: denial },
93436
+ 403
93437
+ );
93438
+ }
93439
+ }
93361
93440
  if (!allowOrgLevelPublicRead && !allowAnonymousPublicOrgMcp) {
93362
93441
  return c.json(
93363
93442
  {
@@ -96113,8 +96192,8 @@ async function tryReconcileTerminalization(args, ctx, reviewer) {
96113
96192
  content = `Builder action completed: ${desc}`;
96114
96193
  message = `${handler.nounLabel} ${desc} approved and applied.`;
96115
96194
  } else {
96116
- title = `${row.action_key} \u2014 completed`;
96117
- content = `Operation completed: ${row.action_key}`;
96195
+ title = (operation) => `${operation} \u2014 completed`;
96196
+ content = (operation) => `Operation completed: ${operation}`;
96118
96197
  message = "Operation approved and executed.";
96119
96198
  }
96120
96199
  const eventId = await terminalizeApprovalRunCompleted(
@@ -96924,7 +97003,7 @@ async function handleApprove(args, ctx, env) {
96924
97003
  args.run_id,
96925
97004
  ctx.organizationId,
96926
97005
  "rejected",
96927
- `${pendingRun.action_key} \u2014 blocked by policy`,
97006
+ (operation) => `${operation} \u2014 blocked by policy`,
96928
97007
  why,
96929
97008
  { reject_reason: why },
96930
97009
  reviewer2,
@@ -96977,8 +97056,8 @@ async function handleApprove(args, ctx, env) {
96977
97056
  args.run_id,
96978
97057
  ctx.organizationId,
96979
97058
  "confirmed",
96980
- `${rows[0].action_key} \u2014 executing`,
96981
- `Operation confirmed: ${rows[0].action_key} \u2014 waiting for execution`,
97059
+ (operation) => `${operation} \u2014 executing`,
97060
+ (operation) => `Operation confirmed: ${operation} \u2014 waiting for execution`,
96982
97061
  args.input ? { approved_input: args.input } : {},
96983
97062
  reviewer,
96984
97063
  tx
@@ -97018,8 +97097,8 @@ async function handleApprove(args, ctx, env) {
97018
97097
  ctx.organizationId,
97019
97098
  result.output,
97020
97099
  {
97021
- title: `${run.action_key} \u2014 completed`,
97022
- content: `Operation completed: ${run.action_key}`
97100
+ title: (operation) => `${operation} \u2014 completed`,
97101
+ content: (operation) => `Operation completed: ${operation}`
97023
97102
  },
97024
97103
  reviewer,
97025
97104
  inlineOwner
@@ -97051,8 +97130,8 @@ async function handleApprove(args, ctx, env) {
97051
97130
  args.run_id,
97052
97131
  ctx.organizationId,
97053
97132
  "failed",
97054
- `${run.action_key} \u2014 failed`,
97055
- `Operation failed: ${run.action_key}${result.error_message ? ` \u2014 ${result.error_message}` : ""}`,
97133
+ (operation) => `${operation} \u2014 failed`,
97134
+ (operation) => `Operation failed: ${operation}${result.error_message ? ` \u2014 ${result.error_message}` : ""}`,
97056
97135
  { error_message: result.error_message },
97057
97136
  reviewer,
97058
97137
  tx
@@ -97095,13 +97174,12 @@ async function handleReject(args, ctx) {
97095
97174
  RETURNING id, action_key
97096
97175
  `;
97097
97176
  if (updated.length === 0) return null;
97098
- const operationKey = updated[0].action_key;
97099
97177
  const eventId = await supersedeActionEvent(
97100
97178
  args.run_id,
97101
97179
  ctx.organizationId,
97102
97180
  "rejected",
97103
- `${operationKey} \u2014 rejected`,
97104
- `Operation rejected: ${operationKey}${args.reason ? ` \u2014 ${args.reason}` : ""}`,
97181
+ (operation) => `${operation} \u2014 rejected`,
97182
+ (operation) => `Operation rejected: ${operation}${args.reason ? ` \u2014 ${args.reason}` : ""}`,
97105
97183
  { reject_reason: reason },
97106
97184
  reviewer,
97107
97185
  tx
@@ -97386,7 +97464,7 @@ async function handleCancel(args, ctx) {
97386
97464
  args.run_id,
97387
97465
  ctx.organizationId,
97388
97466
  withdrawnApproval ? "rejected" : "failed",
97389
- `${run.action_key} \u2014 cancelled`,
97467
+ (operation) => `${operation} \u2014 cancelled`,
97390
97468
  message,
97391
97469
  withdrawnApproval ? {
97392
97470
  run_status: "cancelled",
@@ -104914,6 +104992,10 @@ function toNumberOrNull(value) {
104914
104992
  const n = Number(value);
104915
104993
  return Number.isFinite(n) ? n : null;
104916
104994
  }
104995
+ function connectorWebhookCallbackUrl(connectionId) {
104996
+ const baseUrl = resolvePublicGatewayUrl().replace(/\/+$/, "");
104997
+ return `${baseUrl}/api/v1/webhooks/${connectionId}`;
104998
+ }
104917
104999
  function defaultSecretStore() {
104918
105000
  return new PostgresSecretStore();
104919
105001
  }
@@ -104959,8 +105041,7 @@ async function registerConnectorWebhook(params) {
104959
105041
  logContext: { connection_id: connectionId },
104960
105042
  logMessage: "Failed to resolve webhook registration credentials"
104961
105043
  });
104962
- const baseUrl = resolveBaseUrl({ request: params.request ?? null }).replace(/\/+$/, "");
104963
- const callbackUrl = `${baseUrl}/api/v1/webhooks/${connectionId}`;
105044
+ const callbackUrl = connectorWebhookCallbackUrl(connectionId);
104964
105045
  const envStrings = connectorRunEnv({
104965
105046
  organizationSupplied: findBundledConnectorFile2(connection.connector_key) === null,
104966
105047
  cloud: isCloudMode()
@@ -105136,8 +105217,8 @@ var init_webhook_registration = __esm({
105136
105217
  init_postgres_secret_store();
105137
105218
  init_org_context();
105138
105219
  init_secrets();
105139
- init_base_url();
105140
105220
  init_cloud_mode();
105221
+ init_public_origin();
105141
105222
  init_connector_catalog();
105142
105223
  init_ensure_connector_installed();
105143
105224
  init_execution_context();
@@ -111524,7 +111605,7 @@ async function runSourceFeedListener(task) {
111524
111605
  credentials: auth.credentials,
111525
111606
  sessionState: auth.sessionState,
111526
111607
  httpAuth: auth.httpAuth,
111527
- env: dbEgressConfig()
111608
+ env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() }
111528
111609
  },
111529
111610
  hooks: {
111530
111611
  onHttpFetch: auth.onHttpFetch,
@@ -111550,6 +111631,7 @@ var LISTENER_SETUP_TIMEOUT_MS;
111550
111631
  var init_source_feed_listener = __esm({
111551
111632
  "src/runs/source-feed-listener.ts"() {
111552
111633
  "use strict";
111634
+ init_env2();
111553
111635
  init_runtime();
111554
111636
  init_client();
111555
111637
  init_source_read_bridge();
@@ -113979,7 +114061,6 @@ async function completeActionRun(c) {
113979
114061
  });
113980
114062
  if (rows.length === 0) return rows;
113981
114063
  const organizationId2 = rows[0]?.organization_id;
113982
- const actionKey = rows[0]?.action_key ?? "Action";
113983
114064
  const approvalStatus = rows[0]?.approval_status;
113984
114065
  const cardBearingRun = approvalStatus === "approved" || rows[0]?.run_type === "action" && approvalStatus === "auto";
113985
114066
  if (organizationId2 && cardBearingRun && !sourceRead) {
@@ -113988,8 +114069,8 @@ async function completeActionRun(c) {
113988
114069
  req.run_id,
113989
114070
  organizationId2,
113990
114071
  newStatus,
113991
- `${actionKey} \u2014 ${newStatus}`,
113992
- req.status === "success" ? `Action completed: ${actionKey}` : `Action failed: ${actionKey}${req.error_message ? ` \u2014 ${req.error_message}` : ""}`,
114072
+ (operation) => `${operation} \u2014 ${newStatus}`,
114073
+ (operation) => req.status === "success" ? `Action completed: ${operation}` : `Action failed: ${operation}${req.error_message ? ` \u2014 ${req.error_message}` : ""}`,
113993
114074
  req.status === "success" ? { action_output: actionOutput } : { error_message: req.error_message },
113994
114075
  null,
113995
114076
  tx
@@ -122602,12 +122683,11 @@ async function handleDelete4(args, ctx) {
122602
122683
  RETURNING action_key
122603
122684
  `;
122604
122685
  if (expired.length === 0) continue;
122605
- const actionKey = expired[0].action_key ?? "Action";
122606
122686
  const eventId = await supersedeActionEvent(
122607
122687
  pendingApproval.id,
122608
122688
  organizationId,
122609
122689
  "rejected",
122610
- `${actionKey} \u2014 expired`,
122690
+ (operation) => `${operation} \u2014 expired`,
122611
122691
  approvalExpiryReason,
122612
122692
  {
122613
122693
  expiry_reason: approvalExpiryReason,
@@ -122653,12 +122733,11 @@ async function handleDelete4(args, ctx) {
122653
122733
  RETURNING action_key, approval_status
122654
122734
  `;
122655
122735
  if (cancelled.length === 0) continue;
122656
- const actionKey = cancelled[0].action_key ?? "Action";
122657
122736
  const eventId = await supersedeActionEvent(
122658
122737
  unclaimedRun.id,
122659
122738
  organizationId,
122660
122739
  "failed",
122661
- `${actionKey} \u2014 cancelled`,
122740
+ (operation) => `${operation} \u2014 cancelled`,
122662
122741
  unclaimedActionCancelReason,
122663
122742
  {
122664
122743
  error_message: unclaimedActionCancelReason,
@@ -129601,12 +129680,21 @@ function createAgentApi(config) {
129601
129680
  SELECT slug FROM organization WHERE id = ${messageOrganizationId} LIMIT 1
129602
129681
  `;
129603
129682
  const ownerSlug = orgRow[0]?.slug ?? messageOrganizationId;
129683
+ const attentionMemberRole = await getMembershipRole(
129684
+ messageOrganizationId,
129685
+ attentionUserId
129686
+ );
129604
129687
  const { items } = await listOrgActivity({
129605
129688
  organizationId: messageOrganizationId,
129606
129689
  userId: attentionUserId,
129607
129690
  ownerSlug,
129608
129691
  limit: 12,
129609
- aggregate: true
129692
+ aggregate: true,
129693
+ publicReader: isPublicReader({
129694
+ isAuthenticated: true,
129695
+ userId: attentionUserId,
129696
+ memberRole: attentionMemberRole
129697
+ })
129610
129698
  });
129611
129699
  ephemeralForTurn = formatActivityAttentionBlock(items);
129612
129700
  } catch {
@@ -137602,6 +137690,8 @@ async function checkToolAccess(toolName, args, authCtx) {
137602
137690
  }
137603
137691
  if (!role) {
137604
137692
  if (!isPublicReadable(toolName, args)) {
137693
+ const denial = publicToolDenial(toolName);
137694
+ if (denial) throw new AccessDeniedError(denial);
137605
137695
  if (authCtx.userId) {
137606
137696
  throw new AccessDeniedError(
137607
137697
  "This public workspace is read-only for your account. Join the workspace to unlock write access."
@@ -156063,6 +156153,23 @@ function formatWhyApprovalNeeded(reason) {
156063
156153
  if (!reason) return fallback;
156064
156154
  return reason.replace(/^Automation proposes updating /i, "Field is protected: ");
156065
156155
  }
156156
+ function formatIdentityChangeTitle(operation, proposal) {
156157
+ const verb = operation === "link" ? "Link" : "Separate";
156158
+ const ids = [proposal?.from_entity_id, proposal?.to_entity_id].filter(
156159
+ (id) => typeof id === "number" && Number.isFinite(id)
156160
+ );
156161
+ if (ids.length < 2)
156162
+ return `Review ${operation === "link" ? "associating" : "separating"} identity records`;
156163
+ const records = Array.isArray(proposal?.records) ? proposal.records : [];
156164
+ const nameOf = (id) => {
156165
+ const record4 = records.find(
156166
+ (item) => typeof item === "object" && item !== null && item.id === id
156167
+ );
156168
+ const name = typeof record4?.name === "string" ? truncateNotificationLine(record4.name) : "";
156169
+ return name ? `${name} (#${id})` : `#${id}`;
156170
+ };
156171
+ return `${verb} ${nameOf(ids[0])} and ${nameOf(ids[1])}`;
156172
+ }
156066
156173
  function formatActionApprovalTitle(actionKey, details) {
156067
156174
  if (details?.kind === "entity_field_change") {
156068
156175
  return formatFieldChangeAction(
@@ -156072,7 +156179,8 @@ function formatActionApprovalTitle(actionKey, details) {
156072
156179
  }
156073
156180
  if (details?.kind === "entity_change") {
156074
156181
  const entityLabel = details.entityType ? formatLabel(details.entityType).toLowerCase() : "entity";
156075
- if (details.operation === "link" || details.operation === "unlink") return `Review ${details.operation === "link" ? "associating" : "separating"} identity records`;
156182
+ if (details.operation === "link" || details.operation === "unlink")
156183
+ return formatIdentityChangeTitle(details.operation, details.proposal);
156076
156184
  return details.operation === "delete" ? `Review deleting ${entityLabel}` : `Review creating ${entityLabel}`;
156077
156185
  }
156078
156186
  return `Action "${actionKey}" needs approval`;
@@ -157314,6 +157422,14 @@ function stableStringify4(value) {
157314
157422
  );
157315
157423
  return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify4(v)}`).join(",")}}`;
157316
157424
  }
157425
+ function mismatchedExpectedFields(metadata, expected) {
157426
+ return Object.keys(expected).filter(
157427
+ (field) => !sameValue(
157428
+ Object.hasOwn(metadata, field) ? metadata[field] : void 0,
157429
+ expected[field]
157430
+ )
157431
+ );
157432
+ }
157317
157433
  function computeFieldMerge(args) {
157318
157434
  const {
157319
157435
  metadata,
@@ -157496,6 +157612,26 @@ async function getEntityCountsByTypes(types, ctx) {
157496
157612
  }
157497
157613
  return counts;
157498
157614
  }
157615
+ function assertExpectedNamesMetadata(expected) {
157616
+ const invalid2 = Object.keys(expected).filter(
157617
+ (key2) => NON_METADATA_EXPECTED_KEYS.has(key2) || key2.startsWith("$")
157618
+ );
157619
+ if (invalid2.length > 0) {
157620
+ throw new ToolUserError(
157621
+ `expected only takes metadata field names; ${invalid2.join(", ")} cannot be used as a precondition.`,
157622
+ 400,
157623
+ "VALIDATION"
157624
+ );
157625
+ }
157626
+ }
157627
+ function preconditionFailed(mismatchedFields) {
157628
+ return new ToolUserError(
157629
+ `Precondition failed: ${mismatchedFields.join(", ")} changed since it was read, so nothing was written. Re-read the entity and retry with its current values.`,
157630
+ 409,
157631
+ "PRECONDITION_FAILED",
157632
+ { mismatched_fields: mismatchedFields }
157633
+ );
157634
+ }
157499
157635
  function manualEditNotAllowed(refusal) {
157500
157636
  return new ToolUserError(MANUAL_EDIT_REFUSAL_MESSAGES[refusal], 403, "MANUAL_EDIT_NOT_ALLOWED");
157501
157637
  }
@@ -157870,6 +158006,8 @@ async function updateEntity(entityId, data, _env, ctx, opts) {
157870
158006
  if (opts?.derivedName && data.name !== void 0) {
157871
158007
  throw new ToolUserError("An explicit name cannot also be derived from metadata", 400, "VALIDATION");
157872
158008
  }
158009
+ const expected = data.expected ?? null;
158010
+ if (expected) assertExpectedNamesMetadata(expected);
157873
158011
  await requireWriteAccess(sql2, entityId, ctx);
157874
158012
  if (data.parent_id !== void 0 && data.parent_id !== null) {
157875
158013
  await preventEntityCycles(entityId, data.parent_id, sql2);
@@ -157933,6 +158071,10 @@ async function updateEntity(entityId, data, _env, ctx, opts) {
157933
158071
  }
157934
158072
  const existing = typeof current[0].metadata === "string" ? JSON.parse(current[0].metadata) : current[0].metadata ?? {};
157935
158073
  const existingControls = typeof current[0].field_controls === "string" ? JSON.parse(current[0].field_controls) : current[0].field_controls ?? {};
158074
+ if (expected) {
158075
+ const mismatched = mismatchedExpectedFields(existing, expected);
158076
+ if (mismatched.length > 0) throw preconditionFailed(mismatched);
158077
+ }
157936
158078
  const derivedName = opts?.derivedName && current[0].name === opts.derivedName.compute(existing) ? opts.derivedName : void 0;
157937
158079
  const proposedName = data.name ?? derivedName?.compute({ ...existing, ...metadataUpdates });
157938
158080
  let effectiveName = proposedName;
@@ -159098,7 +159240,7 @@ async function batchLoadRelationships(entityIds, specs, organizationId, readRest
159098
159240
  }
159099
159241
  return result;
159100
159242
  }
159101
- var MANUAL_EDIT_REFUSAL_MESSAGES, DERIVED_SLUG_ATTEMPTS, DERIVED_SLUG_COLUMNS;
159243
+ var MANUAL_EDIT_REFUSAL_MESSAGES, NON_METADATA_EXPECTED_KEYS, DERIVED_SLUG_ATTEMPTS, DERIVED_SLUG_COLUMNS;
159102
159244
  var init_entity_management = __esm({
159103
159245
  "src/utils/entity-management.ts"() {
159104
159246
  "use strict";
@@ -159136,6 +159278,7 @@ var init_entity_management = __esm({
159136
159278
  missing_scope: "manual_edit needs a token minted with the entities:manual_edit scope by a person in the Lobu web app, and this caller does not hold it. Nothing was written.",
159137
159279
  delegated_caller: "manual_edit cannot be asserted by an agent, MCP session, chat turn or Automation; only a person's own edit relayed by a first-party backend qualifies. Nothing was written."
159138
159280
  };
159281
+ NON_METADATA_EXPECTED_KEYS = /* @__PURE__ */ new Set(["name", "content", "slug", "parent_id"]);
159139
159282
  DERIVED_SLUG_ATTEMPTS = 20;
159140
159283
  DERIVED_SLUG_COLUMNS = ["slug", "id"];
159141
159284
  }
@@ -163662,8 +163805,7 @@ async function handleOAuthCallback(c, tokenRow, code, redirectUri) {
163662
163805
  if (tokenRow.connection_id) {
163663
163806
  await registerConnectorWebhook({
163664
163807
  organizationId: tokenRow.organization_id,
163665
- connectionId: tokenRow.connection_id,
163666
- request: c.req.raw
163808
+ connectionId: tokenRow.connection_id
163667
163809
  });
163668
163810
  }
163669
163811
  return c.redirect(await oauthResultUrl(tokenRow, baseUrl, "connected"));
@@ -164618,21 +164760,24 @@ function isExcludedSpaPath(requestPath) {
164618
164760
  if (SPA_ALLOWED_PATHS.has(normalizedPath)) {
164619
164761
  return false;
164620
164762
  }
164763
+ if (SPA_EXCLUDED_PATHS.has(normalizedPath)) {
164764
+ return true;
164765
+ }
164621
164766
  return SPA_EXCLUDED_PREFIXES.some(
164622
164767
  (prefix) => normalizedPath === prefix || normalizedPath.startsWith(`${prefix}/`)
164623
164768
  );
164624
164769
  }
164625
- var SPA_ALLOWED_PATHS, SPA_EXCLUDED_PREFIXES;
164770
+ var SPA_ALLOWED_PATHS, SPA_EXCLUDED_PATHS, SPA_EXCLUDED_PREFIXES;
164626
164771
  var init_spa_route_filter = __esm({
164627
164772
  "src/http/spa-route-filter.ts"() {
164628
164773
  "use strict";
164629
164774
  SPA_ALLOWED_PATHS = /* @__PURE__ */ new Set(["/oauth/consent", "/oauth/device"]);
164775
+ SPA_EXCLUDED_PATHS = /* @__PURE__ */ new Set(["/legal"]);
164630
164776
  SPA_EXCLUDED_PREFIXES = [
164631
164777
  "/.well-known",
164632
164778
  "/api",
164633
164779
  "/connect",
164634
164780
  "/health",
164635
- "/legal",
164636
164781
  "/logo.png",
164637
164782
  "/mcp",
164638
164783
  "/openapi.json",
@@ -166655,6 +166800,7 @@ function createServerForContext(env, authCtx, mcpAppsSupported) {
166655
166800
  }) : null;
166656
166801
  const code = error?.code;
166657
166802
  const structuredError = typeof code === "string" && typeof error?.retryable === "boolean" ? {
166803
+ ...error instanceof ToolUserError ? error.details ?? {} : {},
166658
166804
  code,
166659
166805
  retryable: error.retryable,
166660
166806
  ...error.callId ? { call_id: error.callId } : {}
@@ -168180,7 +168326,9 @@ var init_agent_routes = __esm({
168180
168326
  automationCounts,
168181
168327
  userCounts,
168182
168328
  platformRows,
168183
- providerRows
168329
+ providerRows,
168330
+ lastReplyRows,
168331
+ lastRunRows
168184
168332
  ] = await Promise.all([
168185
168333
  sql2`
168186
168334
  SELECT system_agent_id FROM organization WHERE id = ${orgId} LIMIT 1
@@ -168219,6 +168367,36 @@ var init_agent_routes = __esm({
168219
168367
  SELECT id, models
168220
168368
  FROM agents
168221
168369
  WHERE organization_id = ${orgId}
168370
+ `,
168371
+ // Each agent's newest reply: one probe per agent on conversations_listing.
168372
+ sql2`
168373
+ SELECT a.id AS agent_id, c.platform, c.last_activity_at
168374
+ FROM agents a
168375
+ CROSS JOIN LATERAL (
168376
+ SELECT platform, last_activity_at
168377
+ FROM conversations
168378
+ WHERE organization_id = a.organization_id
168379
+ AND agent_id = a.id
168380
+ AND archived_at IS NULL
168381
+ AND last_activity_at IS NOT NULL
168382
+ ORDER BY last_activity_at DESC
168383
+ LIMIT 1
168384
+ ) c
168385
+ WHERE a.organization_id = ${orgId}
168386
+ `,
168387
+ // Each agent's newest Automation run that the agent itself analyzed: a
168388
+ // prompted version, not a script or an outside client.
168389
+ sql2`
168390
+ SELECT DISTINCT ON (au.managed_agent_id)
168391
+ au.managed_agent_id AS agent_id, au.id, au.name, au.last_run_completed_at
168392
+ FROM automations au
168393
+ JOIN automation_versions v ON v.id = au.current_version_id
168394
+ WHERE au.organization_id = ${orgId}
168395
+ AND au.managed_agent_id IS NOT NULL
168396
+ AND au.last_run_completed_at IS NOT NULL
168397
+ AND btrim(COALESCE(v.prompt, '')) <> ''
168398
+ AND COALESCE(au.execution_config->'executor'->>'kind', '') NOT IN ('script', 'external')
168399
+ ORDER BY au.managed_agent_id, au.last_run_completed_at DESC
168222
168400
  `
168223
168401
  ]);
168224
168402
  const systemAgentId = systemRows[0]?.system_agent_id ?? null;
@@ -168250,6 +168428,33 @@ var init_agent_routes = __esm({
168250
168428
  }
168251
168429
  providersMap.set(r.id, [...set]);
168252
168430
  }
168431
+ const lastReplyMap = new Map(
168432
+ lastReplyRows.map((r) => [
168433
+ r.agent_id,
168434
+ {
168435
+ kind: "conversation",
168436
+ at: new Date(r.last_activity_at).toISOString(),
168437
+ platform: String(r.platform)
168438
+ }
168439
+ ])
168440
+ );
168441
+ const lastRunMap = new Map(
168442
+ lastRunRows.map((r) => [
168443
+ r.agent_id,
168444
+ {
168445
+ kind: "automation",
168446
+ at: new Date(r.last_run_completed_at).toISOString(),
168447
+ automationId: String(r.id),
168448
+ automationName: String(r.name)
168449
+ }
168450
+ ])
168451
+ );
168452
+ const lastActivityOf = (agentId) => {
168453
+ const reply = lastReplyMap.get(agentId);
168454
+ const run = lastRunMap.get(agentId);
168455
+ if (!reply || !run) return reply ?? run ?? null;
168456
+ return reply.at >= run.at ? reply : run;
168457
+ };
168253
168458
  return c.json({
168254
168459
  agents: agents.map((a) => ({
168255
168460
  ...a,
@@ -168261,7 +168466,8 @@ var init_agent_routes = __esm({
168261
168466
  userCount: userCountMap.get(a.agentId) ?? 0,
168262
168467
  platforms: platformsMap.get(a.agentId) ?? [],
168263
168468
  providers: providersMap.get(a.agentId) ?? [],
168264
- status: (activeCountMap.get(a.agentId) ?? 0) > 0 ? "active" : "idle"
168469
+ status: (activeCountMap.get(a.agentId) ?? 0) > 0 ? "active" : "idle",
168470
+ lastActivity: lastActivityOf(a.agentId)
168265
168471
  }))
168266
168472
  });
168267
168473
  });
@@ -170944,6 +171150,8 @@ async function withPublicOrg(c, handler) {
170944
171150
  }
170945
171151
  function toolUserErrorBody(error) {
170946
171152
  return {
171153
+ // Spread first so a detail can never overwrite the message or the code.
171154
+ ...error.details ?? {},
170947
171155
  error: error.message,
170948
171156
  ...error.code ? {
170949
171157
  code: error.code,
@@ -173665,13 +173873,12 @@ async function failClaimedWorkerRun(params) {
173665
173873
  });
173666
173874
  }
173667
173875
  if (row.run_type === "action" && (row.approval_status === "approved" || row.approval_status === "auto")) {
173668
- const actionKey = row.action_key ?? "Action";
173669
173876
  const eventId = await supersedeActionEvent(
173670
173877
  params.runId,
173671
173878
  row.organization_id,
173672
173879
  "failed",
173673
- `${actionKey} \u2014 failed`,
173674
- `Action failed before worker dispatch: ${actionKey} \u2014 ${params.errorMessage}`,
173880
+ (operation) => `${operation} \u2014 failed`,
173881
+ (operation) => `Action failed before worker dispatch: ${operation} \u2014 ${params.errorMessage}`,
173675
173882
  { error_message: params.errorMessage },
173676
173883
  null,
173677
173884
  tx
@@ -176851,14 +177058,13 @@ async function reapStaleRuns() {
176851
177058
  const runId = Number(candidate.id);
176852
177059
  try {
176853
177060
  if (candidate.action_output != null) {
176854
- const actionKey = candidate.action_key ?? "Action";
176855
177061
  const eventId = await terminalizeApprovalRunCompleted(
176856
177062
  runId,
176857
177063
  candidate.organization_id,
176858
177064
  candidate.action_output,
176859
177065
  {
176860
- title: `${actionKey} \u2014 completed`,
176861
- content: `Operation completed: ${actionKey}`
177066
+ title: (operation) => `${operation} \u2014 completed`,
177067
+ content: (operation) => `Operation completed: ${operation}`
176862
177068
  },
176863
177069
  null,
176864
177070
  // Finalize the run exactly as read: if the gateway or another
@@ -176890,14 +177096,13 @@ async function reapStaleRuns() {
176890
177096
  ]
176891
177097
  );
176892
177098
  if (rows.length === 0) return false;
176893
- const actionKey = rows[0].action_key ?? "Action";
176894
177099
  const errorMessage2 = rows[0].error_message;
176895
177100
  const eventId = await supersedeActionEvent(
176896
177101
  runId,
176897
177102
  rows[0].organization_id,
176898
177103
  "failed",
176899
- `${actionKey} \u2014 timed out`,
176900
- `Action timed out: ${actionKey} \u2014 ${errorMessage2}`,
177104
+ (operation) => `${operation} \u2014 timed out`,
177105
+ (operation) => `Action timed out: ${operation} \u2014 ${errorMessage2}`,
176901
177106
  {
176902
177107
  error_message: errorMessage2,
176903
177108
  run_status: "timeout"
@@ -177132,15 +177337,14 @@ async function reapStaleRuns() {
177132
177337
  const timedOutActionsRaw = reapedRow?.timed_out_actions;
177133
177338
  const timedOutActions = Array.isArray(timedOutActionsRaw) ? timedOutActionsRaw : typeof timedOutActionsRaw === "string" ? JSON.parse(timedOutActionsRaw) : [];
177134
177339
  for (const row of timedOutActions) {
177135
- const actionKey = row.actionKey ?? "Operation";
177136
177340
  const reason = row.staleStatus === "pending" ? claimErrorMessage : heartbeatErrorMessage;
177137
177341
  try {
177138
177342
  await supersedeActionEvent(
177139
177343
  row.runId,
177140
177344
  row.organizationId,
177141
177345
  "failed",
177142
- `${actionKey} \u2014 timed out`,
177143
- `Operation timed out: ${actionKey} \u2014 ${reason}`,
177346
+ (operation) => `${operation} \u2014 timed out`,
177347
+ (operation) => `Operation timed out: ${operation} \u2014 ${reason}`,
177144
177348
  {
177145
177349
  error_message: reason,
177146
177350
  run_status: "timeout"
@@ -177972,7 +178176,7 @@ var init_client6 = __esm({
177972
178176
 
177973
178177
  // ../connector-worker/dist/daemon/automation-process.js
177974
178178
  import { execFileSync as execFileSync2, spawn } from "node:child_process";
177975
- import { readFileSync as readFileSync6, readdirSync as readdirSync3 } from "node:fs";
178179
+ import { readFileSync as readFileSync5, readdirSync as readdirSync3 } from "node:fs";
177976
178180
  function runCliSupervisor(spawnChild, treeTermGraceMs, argv) {
177977
178181
  const [binary, ...args] = argv;
177978
178182
  let targetFinished = false;
@@ -178149,7 +178353,7 @@ function defaultProcessTableReader() {
178149
178353
  continue;
178150
178354
  let stat7;
178151
178355
  try {
178152
- stat7 = readFileSync6(`/proc/${entry}/stat`, "utf8");
178356
+ stat7 = readFileSync5(`/proc/${entry}/stat`, "utf8");
178153
178357
  } catch {
178154
178358
  continue;
178155
178359
  }
@@ -178438,9 +178642,9 @@ var init_log = __esm({
178438
178642
  });
178439
178643
 
178440
178644
  // ../connector-worker/dist/daemon/interactive-session.js
178441
- import { createHash as createHash55, randomBytes as randomBytes13 } from "node:crypto";
178645
+ import { createHash as createHash55, randomBytes as randomBytes14 } from "node:crypto";
178442
178646
  import { spawn as spawn2 } from "node:child_process";
178443
- import { accessSync, chmodSync as chmodSync2, constants, lstatSync as lstatSync2, mkdtempSync, readFileSync as readFileSync7, rmSync, statSync, writeFileSync } from "node:fs";
178647
+ import { accessSync, chmodSync as chmodSync2, constants, lstatSync as lstatSync2, mkdtempSync, readFileSync as readFileSync6, rmSync, statSync, writeFileSync } from "node:fs";
178444
178648
  import net3 from "node:net";
178445
178649
  import { homedir as homedir5, tmpdir as tmpdir4 } from "node:os";
178446
178650
  import path11 from "node:path";
@@ -178463,7 +178667,7 @@ function readSessionRecord(registryPath) {
178463
178667
  if (!stat7.isFile() || uid != null && stat7.uid !== uid || (stat7.mode & 18) !== 0) {
178464
178668
  return null;
178465
178669
  }
178466
- const parsed = JSON.parse(readFileSync7(registryPath, "utf8"));
178670
+ const parsed = JSON.parse(readFileSync6(registryPath, "utf8"));
178467
178671
  return parsed != null && typeof parsed === "object" ? parsed : null;
178468
178672
  } catch {
178469
178673
  return null;
@@ -178854,7 +179058,7 @@ async function handoffToInteractiveSession(opts) {
178854
179058
  let disconnectCheck;
178855
179059
  let onShutdown;
178856
179060
  let onTerminal;
178857
- const nonce = randomBytes13(32).toString("hex");
179061
+ const nonce = randomBytes14(32).toString("hex");
178858
179062
  const helperSockets = /* @__PURE__ */ new Set();
178859
179063
  const server = net3.createServer((socket) => {
178860
179064
  helperSockets.add(socket);
@@ -182115,9 +182319,9 @@ var init_executor = __esm({
182115
182319
  });
182116
182320
 
182117
182321
  // ../connector-worker/dist/daemon/resources.js
182118
- import { readFileSync as readFileSync8 } from "node:fs";
182322
+ import { readFileSync as readFileSync7 } from "node:fs";
182119
182323
  import { availableParallelism, freemem, totalmem } from "node:os";
182120
- import { dirname as dirname8, join as join18, relative as relative4 } from "node:path";
182324
+ import { dirname as dirname8, join as join18, relative as relative3 } from "node:path";
182121
182325
  function hostMemory() {
182122
182326
  const runtime = process;
182123
182327
  return { limitBytes: totalmem(), availableBytes: runtime.availableMemory?.() ?? freemem() };
@@ -182167,7 +182371,7 @@ function groups(read) {
182167
182371
  const member = entry.slice(entry.indexOf(":", entry.indexOf(":") + 1) + 1);
182168
182372
  const suffix = mountedFrom === "/" ? member.slice(1) : member === mountedFrom ? "" : member.startsWith(`${mountedFrom}/`) ? member.slice(mountedFrom.length + 1) : member === "/" ? "" : member.slice(1);
182169
182373
  const candidate = join18(root, suffix);
182170
- const leaf = relative4(root, candidate).startsWith("..") ? root : candidate;
182374
+ const leaf = relative3(root, candidate).startsWith("..") ? root : candidate;
182171
182375
  result[controller] = { root, leaf, v2: kind === "cgroup2" };
182172
182376
  }
182173
182377
  }
@@ -182183,7 +182387,7 @@ function ancestors(group) {
182183
182387
  }
182184
182388
  return paths;
182185
182389
  }
182186
- function createResourceSampler(read = (path15) => readFileSync8(path15, "utf8"), platform = process.platform, readHostMemory = hostMemory) {
182390
+ function createResourceSampler(read = (path15) => readFileSync7(path15, "utf8"), platform = process.platform, readHostMemory = hostMemory) {
182187
182391
  const discovered = platform === "linux" ? groups(read) : {};
182188
182392
  return () => {
182189
182393
  const memory = [];
@@ -182238,7 +182442,7 @@ function createResourceSampler(read = (path15) => readFileSync8(path15, "utf8"),
182238
182442
  if (!quota || !period)
182239
182443
  continue;
182240
182444
  const accounting = discovered.cpuacct;
182241
- const usagePath = accounting ? join18(accounting.leaf, relative4(discovered.cpu.leaf, path15)) : path15;
182445
+ const usagePath = accounting ? join18(accounting.leaf, relative3(discovered.cpu.leaf, path15)) : path15;
182242
182446
  const raw = discovered.cpu.v2 ? optional(read, join18(path15, "cpu.stat"))?.match(/^usage_usec (\d+)$/m)?.[1] : optional(read, join18(usagePath, "cpuacct.usage"));
182243
182447
  const used = raw === void 0 ? Number.NaN : Number(raw);
182244
182448
  if (!Number.isFinite(used) || used < 0)
@@ -182666,7 +182870,7 @@ var init_worker = __esm({
182666
182870
  });
182667
182871
 
182668
182872
  // ../connector-worker/dist/executor/runtime-dependency-loader.js
182669
- import { existsSync as existsSync14, readFileSync as readFileSync9 } from "node:fs";
182873
+ import { existsSync as existsSync14, readFileSync as readFileSync8 } from "node:fs";
182670
182874
  import { mkdir as mkdir4, symlink as symlink2 } from "node:fs/promises";
182671
182875
  import { createRequire as createRequire8, register } from "node:module";
182672
182876
  import { basename as basename3, dirname as dirname9, join as join19 } from "node:path";
@@ -184919,7 +185123,7 @@ async function expirePendingApprovals(ttlDays = intervals.pendingApprovalTtlDays
184919
185123
  Number(row.id),
184920
185124
  row.organization_id,
184921
185125
  "rejected",
184922
- `${row.action_key ?? "approval"} \u2014 expired`,
185126
+ (operation) => `${operation} \u2014 expired`,
184923
185127
  reason,
184924
185128
  { reason, expired: true, expired_after_days: ttlDays },
184925
185129
  null,
@@ -186286,27 +186490,27 @@ function applyUserServerConfigToEnv(configPath, contextOverride) {
186286
186490
  // src/server.ts
186287
186491
  init_compile();
186288
186492
  init_client();
186289
- import { randomBytes as randomBytes14 } from "node:crypto";
186493
+ import { randomBytes as randomBytes15 } from "node:crypto";
186290
186494
  import { createRequire as createRequire11 } from "node:module";
186291
186495
  import path14 from "node:path";
186292
186496
  import { fileURLToPath as fileURLToPath15 } from "node:url";
186293
186497
 
186294
186498
  // src/embedded-runtime.ts
186295
186499
  import { execFileSync, fork as fork2 } from "node:child_process";
186500
+ import { randomBytes as randomBytes13 } from "node:crypto";
186501
+ import { once } from "node:events";
186296
186502
  import {
186297
186503
  chmodSync,
186298
186504
  chownSync,
186299
186505
  existsSync as existsSync8,
186300
186506
  lstatSync,
186301
186507
  mkdirSync as mkdirSync2,
186302
- readFileSync as readFileSync5,
186303
- realpathSync as realpathSync2,
186304
- symlinkSync
186508
+ realpathSync as realpathSync2
186305
186509
  } from "node:fs";
186306
186510
  import http2 from "node:http";
186307
186511
  import { createRequire as createRequire5 } from "node:module";
186308
186512
  import { homedir as homedir3 } from "node:os";
186309
- import { dirname as dirname4, join as join14, relative as relative3, resolve as resolve10 } from "node:path";
186513
+ import { dirname as dirname4, join as join14, resolve as resolve10 } from "node:path";
186310
186514
  import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL3 } from "node:url";
186311
186515
  import postgres4 from "postgres";
186312
186516
 
@@ -186537,6 +186741,24 @@ async function importPgvectorEmbedded() {
186537
186741
  return await import(vendored);
186538
186742
  }
186539
186743
  }
186744
+ var LIFECYCLE_SIGNALS = ["SIGTERM", "SIGINT"];
186745
+ async function loadReleasingSignalHooks(load) {
186746
+ const before = new Map(
186747
+ LIFECYCLE_SIGNALS.map((signal) => [signal, new Set(process.listeners(signal))])
186748
+ );
186749
+ const loaded = await load();
186750
+ const added = LIFECYCLE_SIGNALS.flatMap(
186751
+ (signal) => process.listeners(signal).filter((listener) => !before.get(signal)?.has(listener)).map((listener) => ({ signal, listener }))
186752
+ );
186753
+ return {
186754
+ loaded,
186755
+ releaseSignalHooks: () => {
186756
+ for (const { signal, listener } of added) {
186757
+ process.removeListener(signal, listener);
186758
+ }
186759
+ }
186760
+ };
186761
+ }
186540
186762
  function resolveDataRoot() {
186541
186763
  const dbUrl = process.env.DATABASE_URL?.trim();
186542
186764
  if (!dbUrl) {
@@ -186735,34 +186957,6 @@ function ensureEmbeddedPgTraversal(paths, identity, mutation = { chmod: chmodSyn
186735
186957
  }
186736
186958
  };
186737
186959
  }
186738
- function hydrateEmbeddedPgSymlinks(nativeDir) {
186739
- const manifest = join14(nativeDir, "pg-symlinks.json");
186740
- if (!existsSync8(manifest)) return;
186741
- let entries;
186742
- try {
186743
- entries = JSON.parse(readFileSync5(manifest, "utf8"));
186744
- } catch {
186745
- return;
186746
- }
186747
- const pkgRoot = dirname4(nativeDir);
186748
- let created = 0;
186749
- for (const { source, target } of entries) {
186750
- const targetPath = join14(pkgRoot, target);
186751
- if (existsSync8(targetPath)) continue;
186752
- const rel = relative3(dirname4(targetPath), join14(pkgRoot, source));
186753
- try {
186754
- symlinkSync(rel, targetPath);
186755
- created++;
186756
- } catch {
186757
- }
186758
- }
186759
- if (created > 0) {
186760
- logger_default.info(
186761
- { nativeDir, created },
186762
- "Hydrated embedded Postgres library symlinks"
186763
- );
186764
- }
186765
- }
186766
186960
  async function startEmbeddedRuntime() {
186767
186961
  const dataRoot = resolveDataRoot();
186768
186962
  const pgDataDir = join14(dataRoot, ".lobu", "pgdata");
@@ -186771,12 +186965,20 @@ async function startEmbeddedRuntime() {
186771
186965
  process.env.LOBU_SINGLE_USER = "1";
186772
186966
  }
186773
186967
  const componentEntry = process.env.LOBU_RUNTIME_POSTGRES_ENTRY;
186774
- const component = componentEntry ? await import(pathToFileURL3(componentEntry).href) : null;
186775
- const { default: EmbeddedPostgres } = component ?? await import("embedded-postgres");
186776
- const { ensureNativeLibSonames, installPgvector, resolveEmbeddedNativeDir } = component ?? await importPgvectorEmbedded();
186968
+ const {
186969
+ loaded: { component, EmbeddedPostgres },
186970
+ releaseSignalHooks
186971
+ } = await loadReleasingSignalHooks(async () => {
186972
+ const component2 = componentEntry ? await import(pathToFileURL3(componentEntry).href) : null;
186973
+ const { default: EmbeddedPostgres2 } = component2 ?? await import("embedded-postgres");
186974
+ return { component: component2, EmbeddedPostgres: EmbeddedPostgres2 };
186975
+ });
186976
+ const { installPgvector, prepareEmbeddedNative, resolveEmbeddedNativeDir } = component ?? await importPgvectorEmbedded();
186777
186977
  const nativeDir = resolveEmbeddedNativeDir();
186778
- hydrateEmbeddedPgSymlinks(nativeDir);
186779
- ensureNativeLibSonames(nativeDir);
186978
+ const { linksCreated } = prepareEmbeddedNative(nativeDir);
186979
+ if (linksCreated > 0) {
186980
+ logger_default.info({ nativeDir, linksCreated }, "Prepared embedded Postgres library links");
186981
+ }
186780
186982
  const pgvectorDir = join14(dataRoot, ".lobu", "pgvector");
186781
186983
  const pgvector = installPgvector(pgvectorDir);
186782
186984
  const pgPort = parseInt(process.env.LOBU_PG_PORT || "", 10) || await findFreePort();
@@ -186829,19 +187031,19 @@ async function startEmbeddedRuntime() {
186829
187031
  // Install-operator provisioning, shared with the external-DB
186830
187032
  // `lobu run` path (see local-bootstrap.ts).
186831
187033
  preListenHooks: buildLocalBootstrapHooks(),
187034
+ // The lifecycle has registered its SIGTERM/SIGINT handlers by now.
187035
+ postListenHooks: [releaseSignalHooks],
186832
187036
  // Runs after stopLobuGateway + closeDbSingleton so gateway connections
186833
187037
  // release before the embeddings child + PG child are stopped. Restore
186834
187038
  // ancestor ownership/modes only after postgres no longer needs them.
186835
187039
  extraTeardown: [
186836
- () => {
186837
- embeddingsChild?.kill();
186838
- },
187040
+ () => stopEmbeddings(embeddingsChild),
186839
187041
  () => pg.stop(),
186840
187042
  () => restoreTraversal()
186841
187043
  ]
186842
187044
  };
186843
187045
  } catch (error) {
186844
- embeddingsChild?.kill();
187046
+ await stopEmbeddings(embeddingsChild);
186845
187047
  const cleanupErrors = [];
186846
187048
  if (postgresStarted) {
186847
187049
  try {
@@ -186945,6 +187147,17 @@ async function runMigrations(databaseUrl) {
186945
187147
  await sql2.end();
186946
187148
  }
186947
187149
  }
187150
+ async function stopEmbeddings(child) {
187151
+ if (!child || child.exitCode !== null || child.signalCode !== null) return;
187152
+ const exited = once(child, "exit");
187153
+ child.kill("SIGTERM");
187154
+ const force = setTimeout(() => child.kill("SIGKILL"), 5e3);
187155
+ try {
187156
+ await exited;
187157
+ } finally {
187158
+ clearTimeout(force);
187159
+ }
187160
+ }
186948
187161
  async function startEmbeddings() {
186949
187162
  if (process.env.EMBEDDINGS_SERVICE_URL?.trim()) return null;
186950
187163
  const embeddingsPort = parseInt(process.env.EMBEDDINGS_PORT || "0", 10);
@@ -186968,6 +187181,9 @@ async function startEmbeddings() {
186968
187181
  return null;
186969
187182
  }
186970
187183
  const port = embeddingsPort || await findFreePort();
187184
+ if (!process.env.EMBEDDINGS_SERVICE_TOKEN?.trim()) {
187185
+ process.env.EMBEDDINGS_SERVICE_TOKEN = randomBytes13(32).toString("hex");
187186
+ }
186971
187187
  let execArgv2 = [];
186972
187188
  if (serverPath.endsWith(".ts")) {
186973
187189
  const tsxPackageJson = require4.resolve("tsx/package.json");
@@ -187136,15 +187352,16 @@ async function main() {
187136
187352
  let databaseReadiness;
187137
187353
  let preListenHooks = [];
187138
187354
  let extraTeardown = [];
187355
+ let runtimePostListenHooks = [];
187139
187356
  if (!external || process.env.LOBU_RUN_OWNS_DB === "1") {
187140
187357
  if (!process.env.BETTER_AUTH_SECRET) {
187141
- process.env.BETTER_AUTH_SECRET = randomBytes14(32).toString("base64");
187358
+ process.env.BETTER_AUTH_SECRET = randomBytes15(32).toString("base64");
187142
187359
  logger_default.info(
187143
187360
  "Generated ephemeral BETTER_AUTH_SECRET \u2014 set in .env to persist sessions"
187144
187361
  );
187145
187362
  }
187146
187363
  if (!process.env.JWT_SECRET) {
187147
- process.env.JWT_SECRET = process.env.ENCRYPTION_KEY ? deriveJwtSecret(process.env.ENCRYPTION_KEY) : randomBytes14(32).toString("base64");
187364
+ process.env.JWT_SECRET = process.env.ENCRYPTION_KEY ? deriveJwtSecret(process.env.ENCRYPTION_KEY) : randomBytes15(32).toString("base64");
187148
187365
  }
187149
187366
  if (!process.env.PUBLIC_GATEWAY_URL) {
187150
187367
  process.env.PUBLIC_GATEWAY_URL = `http://localhost:${port}/lobu`;
@@ -187190,13 +187407,12 @@ async function main() {
187190
187407
  databaseReadiness = rt.databaseReadiness;
187191
187408
  preListenHooks = rt.preListenHooks;
187192
187409
  extraTeardown = rt.extraTeardown;
187410
+ runtimePostListenHooks = rt.postListenHooks;
187193
187411
  logger_default.info(`Data: ${rt.dataDir}`);
187194
187412
  }
187195
187413
  if (external && process.env.LOBU_RUN_OWNS_DB === "1") {
187196
187414
  const embeddings = await startEmbeddings();
187197
- if (embeddings) extraTeardown.push(() => {
187198
- embeddings.kill();
187199
- });
187415
+ if (embeddings) extraTeardown.push(() => stopEmbeddings(embeddings));
187200
187416
  }
187201
187417
  const { createServerLifecycle: createServerLifecycle2, reportBootFailure: reportBootFailure2 } = await Promise.resolve().then(() => (init_server_lifecycle(), server_lifecycle_exports));
187202
187418
  const lifecycle = createServerLifecycle2({
@@ -187210,6 +187426,7 @@ async function main() {
187210
187426
  // instead of letting feeds silently fail later. After listen() so the
187211
187427
  // sync require.resolve walk doesn't add to readiness latency.
187212
187428
  postListenHooks: [
187429
+ ...runtimePostListenHooks,
187213
187430
  () => {
187214
187431
  try {
187215
187432
  assertExternalDepsResolvable(createRequire11(import.meta.url).resolve);