@lobu/runtime-server 24.10.0 → 24.11.1

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 (176) hide show
  1. package/dist/catalogs/connectors.json +1 -1
  2. package/dist/catalogs/skills.json +1 -1
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/linkedin-inbox-adapter.js +13 -3
  5. package/dist/connectors/whatsapp-web-adapter.js +14 -13
  6. package/dist/connectors/whatsapp-web-helpers.ts +37 -1
  7. package/dist/connectors/whatsapp_web.ts +5 -5
  8. package/dist/connectors/x-dm-adapter.js +17 -3
  9. package/dist/db/migrations/20261113170000_member_sql_rls.sql +254 -0
  10. package/dist/db/migrations/20261113180000_member_sql_rls_parallel_plans.sql +192 -0
  11. package/dist/db/migrations/20261113190000_member_sql_schema_usage.sql +24 -0
  12. package/dist/db/migrations/20261114120000_events_owner_only_visibility.sql +39 -0
  13. package/dist/db/migrations/20261115120000_events_unbound_tool_audit_without_bridge.sql +40 -0
  14. package/dist/db/migrations/20261115120001_events_unbound_tool_audit_validate.sql +19 -0
  15. package/dist/db/migrations/20261115120002_drop_events_linked_org_ids.sql +119 -0
  16. package/dist/dependencies.bun.lock +10 -10
  17. package/dist/embeddings-server.mjs +1 -1
  18. package/dist/guest.bundle.js +1 -1
  19. package/dist/owletto/dist/assets/_-BDMUN9XZ.js +2 -0
  20. package/dist/owletto/dist/assets/_-CF5X4ANe.js +3 -0
  21. package/dist/owletto/dist/assets/{_agentId-DN0EwMAC.js → _agentId-CGScf8z_.js} +2 -2
  22. package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +2 -0
  23. package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +2 -0
  24. package/dist/owletto/dist/assets/{_connectorKey._connectionId-CVKfL9AG.js → _connectorKey._connectionId-DcI29kGy.js} +2 -2
  25. package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +2 -0
  26. package/dist/owletto/dist/assets/{_conversationId-CPpNySjO.js → _conversationId-CnmLYlVS.js} +2 -2
  27. package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +2 -0
  28. package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +3 -0
  29. package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +2 -0
  30. package/dist/owletto/dist/assets/{_slug-DJx_8fsV.js → _slug-COPpRXLt.js} +2 -2
  31. package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +2 -0
  32. package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +2 -0
  33. package/dist/owletto/dist/assets/{accept-invitation-Dwq1GAnG.js → accept-invitation-BKeIzZXE.js} +2 -2
  34. package/dist/owletto/dist/assets/{activity-route-location-C1jcXC7v.js → activity-route-location-sLvKaSCa.js} +2 -2
  35. package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +2 -0
  36. package/dist/owletto/dist/assets/{agent-connect-pages-DoI9UR0a.js → agent-connect-pages-DVq9nAR7.js} +3 -3
  37. package/dist/owletto/dist/assets/{agent-editor-form-DlavYg2q.js → agent-editor-form-DVFyyMyd.js} +2 -2
  38. package/dist/owletto/dist/assets/{agent-loading-shells-DYqQphN7.js → agent-loading-shells-BLNHIy-r.js} +2 -2
  39. package/dist/owletto/dist/assets/{agent-permissions-matrix-C1L8IcYR.js → agent-permissions-matrix-UBKRR5vs.js} +2 -2
  40. package/dist/owletto/dist/assets/{agent-skill-context-D1nMrVod.js → agent-skill-context-fqedKd0D.js} +2 -2
  41. package/dist/owletto/dist/assets/{agent-subpage-shell-2w7vTeXw.js → agent-subpage-shell-BUCoY2Nf.js} +2 -2
  42. package/dist/owletto/dist/assets/{agent-thread-BopD-2k1.js → agent-thread-Cqf9ITrT.js} +2 -2
  43. package/dist/owletto/dist/assets/app-bridge-B-L0rGz9.js +121 -0
  44. package/dist/owletto/dist/assets/{app._appId-BXeFXW1w.js → app._appId-ByIypCL9.js} +2 -2
  45. package/dist/owletto/dist/assets/{assist-composer-CL5x8pNt.js → assist-composer-kG_heHXo.js} +2 -2
  46. package/dist/owletto/dist/assets/{automation-run-now-MtxUTfzd.js → automation-run-now-C5XTS00o.js} +2 -2
  47. package/dist/owletto/dist/assets/{callback-BgfwP1Eo.js → callback-Pz5uS-k7.js} +2 -2
  48. package/dist/owletto/dist/assets/{card-DtLIFq7D.js → card-CAPpY9P5.js} +2 -2
  49. package/dist/owletto/dist/assets/{claim-CT3hYVMF.js → claim-DgWWK0KI.js} +2 -2
  50. package/dist/owletto/dist/assets/{client-activity-scopes-BPbRX-Pe.js → client-activity-scopes-Aqdo6Pdr.js} +2 -2
  51. package/dist/owletto/dist/assets/{client-rows-vrNA6FLs.js → client-rows-Dd5YV8vn.js} +2 -2
  52. package/dist/owletto/dist/assets/{clients-xnzZeEdZ.js → clients-Bf7ZgGro.js} +2 -2
  53. package/dist/owletto/dist/assets/{code-editor-mrKkAfcE.js → code-editor-z1Sy_hiX.js} +2 -2
  54. package/dist/owletto/dist/assets/connect-BFNp1y_s.js +2 -0
  55. package/dist/owletto/dist/assets/{connect-menu-C6iVtuSo.js → connect-menu-BWrAhMqO.js} +2 -2
  56. package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +2 -0
  57. package/dist/owletto/dist/assets/{connected._clientId-ROfVgp9h.js → connected._clientId-CuOeHafK.js} +2 -2
  58. package/dist/owletto/dist/assets/{connection-BMz740Wi.js → connection-CVeHmDLs.js} +2 -2
  59. package/dist/owletto/dist/assets/{connection-feed-detail-0VAJiZTP.js → connection-feed-detail-BYo7zdVD.js} +2 -2
  60. package/dist/owletto/dist/assets/{connector-page-shell-BFv21yuv.js → connector-page-shell-an3SYLim.js} +2 -2
  61. package/dist/owletto/dist/assets/{connector-provenance-b59RfBtk.js → connector-provenance-mSZCOud-.js} +2 -2
  62. package/dist/owletto/dist/assets/{connectors-nYS31lO2.js → connectors-DBEM9QQz.js} +2 -2
  63. package/dist/owletto/dist/assets/{consent-cPRF9JQv.js → consent-1ulwyJ3k.js} +2 -2
  64. package/dist/owletto/dist/assets/{copy-button-C3wMMv63.js → copy-button-Xhh7ZnjO.js} +2 -2
  65. package/dist/owletto/dist/assets/{core.esm-C9QlSrgK.js → core.esm-Ctg_pXLe.js} +2 -2
  66. package/dist/owletto/dist/assets/{create-CGOWfMk4.js → create-CGuoqPh8.js} +2 -2
  67. package/dist/owletto/dist/assets/create-Ccb5R-S4.js +2 -0
  68. package/dist/owletto/dist/assets/{create-ASRN3Obq.js → create-DmhbacIa.js} +2 -2
  69. package/dist/owletto/dist/assets/{create-automation-form-CLicoPH5.js → create-automation-form-CD6jSlWL.js} +2 -2
  70. package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +2 -0
  71. package/dist/owletto/dist/assets/{custom-guardrail-edits-BUL7nmuO.js → custom-guardrail-edits-Ce_BwiwD.js} +2 -2
  72. package/dist/owletto/dist/assets/{definition-comparison-4UYMI6BK.js → definition-comparison-D_qP25jR.js} +2 -2
  73. package/dist/owletto/dist/assets/{detail-page-skeleton-C8v3rJXK.js → detail-page-skeleton-CPAfZLG0.js} +2 -2
  74. package/dist/owletto/dist/assets/{device-BBwsOi7q.js → device-DDl5XKvt.js} +2 -2
  75. package/dist/owletto/dist/assets/{device-pin-tombstone-Bcpe7nAA.js → device-pin-tombstone-Dkj7hrBE.js} +2 -2
  76. package/dist/owletto/dist/assets/{device._deviceId-DLT4jh0Z.js → device._deviceId-bNhTcops.js} +2 -2
  77. package/dist/owletto/dist/assets/{dynamic-schema-form-BDT8x0Vg.js → dynamic-schema-form-CRyUchXo.js} +2 -2
  78. package/dist/owletto/dist/assets/{entity-options-B9hm9V87.js → entity-options-D4t-NAcg.js} +2 -2
  79. package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +2 -0
  80. package/dist/owletto/dist/assets/{entity-pages-BWBpttz3.js → entity-pages-_nuesgnp.js} +2 -2
  81. package/dist/owletto/dist/assets/{entity-schema-graph-lMMx3HhR.js → entity-schema-graph-Cq96SJ3c.js} +2 -2
  82. package/dist/owletto/dist/assets/{entity-type-page-CkQm0yEu.js → entity-type-page-CkCSbkBx.js} +2 -2
  83. package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +2 -0
  84. package/dist/owletto/dist/assets/{events-feed-DmRzikZW.js → events-feed-DcKTkJVe.js} +2 -2
  85. package/dist/owletto/dist/assets/{filter-editors-CQoSj-20.js → filter-editors-DGVl9U4D.js} +3 -3
  86. package/dist/owletto/dist/assets/{full-page-spinner-CYyCnKve.js → full-page-spinner-CtVlF8GQ.js} +2 -2
  87. package/dist/owletto/dist/assets/index-BUlkNJzX.js +2 -0
  88. package/dist/owletto/dist/assets/{index-BS5Ty3tf.js → index-BifR-LE9.js} +2 -2
  89. package/dist/owletto/dist/assets/{index-DByaMzsG.js → index-BoqrvLHQ.js} +1383 -1383
  90. package/dist/owletto/dist/assets/index-CA9mW_ZM.js +2 -0
  91. package/dist/owletto/dist/assets/index-CH0GzG4i.js +2 -0
  92. package/dist/owletto/dist/assets/index-CK5GDX4B.js +2 -0
  93. package/dist/owletto/dist/assets/index-CtI5Eomq.js +2 -0
  94. package/dist/owletto/dist/assets/{index-CUndAH6o.js → index-DbjbHlDe.js} +2 -2
  95. package/dist/owletto/dist/assets/index-DmtQ0bds.js +2 -0
  96. package/dist/owletto/dist/assets/{index-CDyFQ32o.js → index-Du_J8hnx.js} +2 -2
  97. package/dist/owletto/dist/assets/{index-ittfA0k8.js → index-DvuJ_S_o.js} +2 -2
  98. package/dist/owletto/dist/assets/index-Pae_f9LM.css +1 -0
  99. package/dist/owletto/dist/assets/{index-C3hz9tzx.js → index-XETZnN7L.js} +2 -2
  100. package/dist/owletto/dist/assets/{json-diff-mcDgyct_.js → json-diff-OjtREegr.js} +2 -2
  101. package/dist/owletto/dist/assets/{list-skeleton-DsYGUHxi.js → list-skeleton-CH0qQBYk.js} +2 -2
  102. package/dist/owletto/dist/assets/{login-EoLq136v.js → login-DG0b9uSC.js} +2 -2
  103. package/dist/owletto/dist/assets/{logout-gLgEQOiX.js → logout-DfdgOLoM.js} +2 -2
  104. package/dist/owletto/dist/assets/{member-scope-gate-vvkgSAb2.js → member-scope-gate-Cxg2zGQT.js} +2 -2
  105. package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +74 -0
  106. package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +2 -0
  107. package/dist/owletto/dist/assets/{model-selector-D3vSMLO2.js → model-selector-D2OpDkwH.js} +2 -2
  108. package/dist/owletto/dist/assets/{needs-you-list-B5Bgd05M.js → needs-you-list-3uMsWcDv.js} +2 -2
  109. package/dist/owletto/dist/assets/{new-dLXsCHBd.js → new-AdGV6a8R.js} +2 -2
  110. package/dist/owletto/dist/assets/new-BdtIhBpo.js +2 -0
  111. package/dist/owletto/dist/assets/{new-Bk_flKQO.js → new-BjGwX6s6.js} +2 -2
  112. package/dist/owletto/dist/assets/{new-BPW3V0Y1.js → new-D-iMjV74.js} +2 -2
  113. package/dist/owletto/dist/assets/{organization-DBfgBkzq.js → organization-qaIpEiQg.js} +2 -2
  114. package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +2 -0
  115. package/dist/owletto/dist/assets/{pending-seed-CBhx2Ql-.js → pending-seed-BBACroge.js} +2 -2
  116. package/dist/owletto/dist/assets/{proposal-review-shell-B-jYcKfB.js → proposal-review-shell-C8ZfIAYn.js} +2 -2
  117. package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +2 -0
  118. package/dist/owletto/dist/assets/{record-session-CAmGHMyM.js → record-session-BrM9cdXu.js} +2 -2
  119. package/dist/owletto/dist/assets/{renderer-olRv_HMI.js → renderer-CTKNMcXP.js} +4 -4
  120. package/dist/owletto/dist/assets/{reset-password-B9_xi8Pq.js → reset-password-DKBEneyR.js} +2 -2
  121. package/dist/owletto/dist/assets/{run-initiator-DhE5v4z0.js → run-initiator-BKSgI1o0.js} +2 -2
  122. package/dist/owletto/dist/assets/{runs-C8sZQr4o.js → runs-k2NpbZm8.js} +2 -2
  123. package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +2 -0
  124. package/dist/owletto/dist/assets/{schema-value-zTJGE4eh.js → schema-value-wjqGxXhv.js} +3 -3
  125. package/dist/owletto/dist/assets/{scoped-feed-bar-BKyJSa3_.js → scoped-feed-bar-DNFL0sYX.js} +2 -2
  126. package/dist/owletto/dist/assets/{settings-z02cvVS3.js → settings-V0m5Om5j.js} +2 -2
  127. package/dist/owletto/dist/assets/{source-record-panels-CGmKIJdN.js → source-record-panels-BMut9YIA.js} +2 -2
  128. package/dist/owletto/dist/assets/{status-variants-DyRCXBzM.js → status-variants-SzXYYedJ.js} +2 -2
  129. package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +2 -0
  130. package/dist/owletto/dist/assets/{table-C637cQxG.js → table-ZuYMOjVR.js} +2 -2
  131. package/dist/owletto/dist/assets/{use-automations-CgWNoYio.js → use-automations-DfBtVzGa.js} +2 -2
  132. package/dist/owletto/dist/assets/{use-login-redirect-tDdhXTpt.js → use-login-redirect-BDiS3eyl.js} +2 -2
  133. package/dist/owletto/dist/assets/{use-mention-search-D-kIKchD.js → use-mention-search-khySpz_V.js} +2 -2
  134. package/dist/owletto/dist/assets/view-card-DiHWlypr.js +2 -0
  135. package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +2 -0
  136. package/dist/owletto/dist/assets/{views-access-required-C35Dyt91.js → views-access-required-HA-PiOwA.js} +2 -2
  137. package/dist/owletto/dist/index.html +2 -2
  138. package/dist/server-main.bundle.mjs +1099 -545
  139. package/npm-shrinkwrap.json +38 -38
  140. package/package.json +1 -1
  141. package/vendor/connector-sdk/package.json +1 -1
  142. package/vendor/core/package.json +1 -1
  143. package/vendor/views/package.json +1 -1
  144. package/dist/owletto/dist/assets/_-CYvj1y65.js +0 -3
  145. package/dist/owletto/dist/assets/_-CeLTSYYY.js +0 -2
  146. package/dist/owletto/dist/assets/_agentId-BB5E-L6T.js +0 -2
  147. package/dist/owletto/dist/assets/_automationId-DvUl9CSd.js +0 -2
  148. package/dist/owletto/dist/assets/_connectorKey.index-Cv6FzK1v.js +0 -2
  149. package/dist/owletto/dist/assets/_eventId-DZKicuq6.js +0 -2
  150. package/dist/owletto/dist/assets/_owner-Dauk3YuD.js +0 -3
  151. package/dist/owletto/dist/assets/_shape-cKrEID3T.js +0 -2
  152. package/dist/owletto/dist/assets/_viewKey-CPVzVKEf.js +0 -2
  153. package/dist/owletto/dist/assets/_viewKey-CW8gexOQ.js +0 -2
  154. package/dist/owletto/dist/assets/activity-route-view-D78Wj0RH.js +0 -2
  155. package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +0 -121
  156. package/dist/owletto/dist/assets/connect-NUCSay8X.js +0 -2
  157. package/dist/owletto/dist/assets/connect._clientId-Cp-d9Q5b.js +0 -2
  158. package/dist/owletto/dist/assets/create-CBcodaSO.js +0 -2
  159. package/dist/owletto/dist/assets/create._connectorKey-s4xkktTC.js +0 -2
  160. package/dist/owletto/dist/assets/entity-page-DZjzQ2V4.js +0 -2
  161. package/dist/owletto/dist/assets/event-detail-CkzfakTK.js +0 -2
  162. package/dist/owletto/dist/assets/index-BE7eb2kE.js +0 -2
  163. package/dist/owletto/dist/assets/index-BFR0uiKY.js +0 -2
  164. package/dist/owletto/dist/assets/index-C38OzBpB.js +0 -2
  165. package/dist/owletto/dist/assets/index-CiKysEhV.js +0 -2
  166. package/dist/owletto/dist/assets/index-DfdinB7B.js +0 -2
  167. package/dist/owletto/dist/assets/index-DgMM4Zt5.css +0 -1
  168. package/dist/owletto/dist/assets/index-Xk711gVC.js +0 -2
  169. package/dist/owletto/dist/assets/memory-browse-page-DvDtwrEI.js +0 -74
  170. package/dist/owletto/dist/assets/new-C5HtQdM_.js +0 -2
  171. package/dist/owletto/dist/assets/peek-pane-content-c2PG3TEX.js +0 -2
  172. package/dist/owletto/dist/assets/public-shell-ready-D8TijlRY.js +0 -2
  173. package/dist/owletto/dist/assets/record-activity-DnRVOrG2.js +0 -2
  174. package/dist/owletto/dist/assets/runs-list-CwtH-wmk.js +0 -2
  175. package/dist/owletto/dist/assets/subDays-D8nHthaS.js +0 -2
  176. package/dist/owletto/dist/assets/view-param-filters-CUCj9Df-.js +0 -2
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peek-pane-content-CEsDVScl.js","assets/index-BoqrvLHQ.js","assets/index-Pae_f9LM.css","assets/automation-run-now-C5XTS00o.js","assets/event-detail-DUvlqn9b.js","assets/events-feed-DcKTkJVe.js","assets/definition-comparison-D_qP25jR.js","assets/json-diff-OjtREegr.js","assets/code-editor-z1Sy_hiX.js","assets/index-Vcq4gwWv.js","assets/schema-value-wjqGxXhv.js","assets/run-initiator-BKSgI1o0.js","assets/list-skeleton-CH0qQBYk.js","assets/subDays-9s9OEl5t.js","assets/use-automations-DfBtVzGa.js","assets/clients-Bf7ZgGro.js","assets/renderer-CTKNMcXP.js","assets/card-CAPpY9P5.js","assets/table-ZuYMOjVR.js","assets/copy-button-Xhh7ZnjO.js","assets/device-automation-Dp3faMvp.js","assets/missing-view-xT0B-f5z.js","assets/app-bridge-B-L0rGz9.js","assets/view-param-filters-DGKxSr7r.js","assets/filter-editors-DGVl9U4D.js","assets/needs-you-list-3uMsWcDv.js","assets/scoped-feed-bar-DNFL0sYX.js","assets/event-kind-options-fHAIXu24.js","assets/create-automation-form-CD6jSlWL.js","assets/entity-options-D4t-NAcg.js","assets/model-selector-D2OpDkwH.js","assets/skill-editor-D_W3QlRz.js","assets/use-mention-search-khySpz_V.js","assets/proposal-review-shell-C8ZfIAYn.js","assets/runs-k2NpbZm8.js","assets/runs-list-DUXRMkWN.js","assets/agent-loading-shells-BLNHIy-r.js","assets/agent-thread-Cqf9ITrT.js","assets/pending-seed-BBACroge.js","assets/connection-feed-detail-BYo7zdVD.js","assets/status-variants-SzXYYedJ.js","assets/feed-event-kinds-BYuZCoU4.js","assets/connect-menu-BWrAhMqO.js","assets/source-record-panels-BMut9YIA.js","assets/entity-type-page-CkCSbkBx.js","assets/views-access-required-HA-PiOwA.js","assets/dynamic-schema-form-CRyUchXo.js","assets/record-session-BrM9cdXu.js"])))=>i.map(i=>d[i]);
2
+ import{p as m,j as t,r as p,C as R,L as v,u as N,a as P,b as A,c as E,d as D,D as _,e as $,f as z,g as K,h as L,i as j,B as h,k as T,S as O,A as q,X as W,l as B,_ as U,m as g,n as C,o as F,q as H,s as Q,t as G,v as J,w as M,x as V,y as Y,z as X,E as Z,F as w,G as S,R as ee,H as te,I as ne,J as ae,K as se,N as re,O as b}from"./index-BoqrvLHQ.js";import{R as ie}from"./record-session-BrM9cdXu.js";import{u as oe}from"./use-automations-DfBtVzGa.js";import{u as le}from"./clients-Bf7ZgGro.js";function I({item:e}){const n=e.href?m(e.href):null;if(!n||n.kind==="event"||n.kind==="automation"&&!("runId"in n&&n.runId!=null))return null;const a=n.owner,o=n.kind==="automation"?n.automationId:e.sourceAttribution?.automation_id??null,s=e.sourceAttribution,r=[{label:a,to:"/$owner",params:{owner:a}}];return s?.agent_id&&s.agent_name&&r.push({label:s.agent_name,to:"/$owner/agents/$agentId",params:{owner:a,agentId:s.agent_id}}),o!=null&&r.push({label:s?.automation_name??"Automation",to:"/$owner/automations/$automationId",params:{owner:a,automationId:String(o)}}),(n.kind==="memory"||n.kind==="automation")&&"runId"in n&&n.runId!=null?r.push({label:"Run details"}):n.kind==="memory"&&"contentIds"in n&&r.push({label:"Details"}),r.length<2?null:t.jsx("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-3 py-1.5 text-xs text-muted-foreground",children:r.map((i,l)=>{const c=l===r.length-1,f=t.jsx("span",{className:c?"truncate font-medium text-foreground":"whitespace-nowrap",children:i.label});return t.jsxs(p.Fragment,{children:[l>0?t.jsx(R,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}):null,i.to&&!c?t.jsx(v,{to:i.to,params:i.params,className:"whitespace-nowrap transition-colors hover:text-foreground",children:i.label}):f]},i.to??i.label)})})}const ce=B(async()=>({default:(await U(async()=>{const{PeekPaneContent:e}=await import("./peek-pane-content-CEsDVScl.js");return{PeekPaneContent:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]))).PeekPaneContent}));function ue(){return t.jsxs("div",{"data-testid":"peek-pane-body-loading",className:"space-y-3 p-4",children:[t.jsx(g,{className:"h-5 w-2/3"}),t.jsx(g,{className:"h-4 w-full"}),t.jsx(g,{className:"h-24 w-full rounded-lg"})]})}const de=460,fe=480;function he({children:e}){const n=p.useRef(null),a=N(),o=P(),s=A(n,de+fe),r=!o&&s&&a?.item!=null;return t.jsxs("div",{ref:n,className:"relative flex min-h-0 flex-1 flex-row",children:[t.jsx("div",{inert:r,className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:e}),t.jsx(me,{covers:r})]})}function me({covers:e=!1}){const n=N(),a=P();return n?.item?t.jsx(ve,{item:n.item,onClose:n.close,onBack:n.back,isNarrow:a,covers:e}):null}function y({item:e,children:n}){const a=e.href?m(e.href):null;return a?.kind==="automation"&&a.runId==null&&!e.runId?t.jsx(ge,{owner:a.owner,automationId:a.automationId,fallback:e.title,children:n}):a?.kind==="agent"?t.jsx(we,{agentId:a.agentId,clientIds:a.clientIds,fallback:e.title,children:n}):a?.kind==="event"?t.jsx(xe,{owner:a.owner,eventId:a.eventId,fallback:e.title,children:n}):t.jsx(pe,{item:e,children:n})}function xe({owner:e,eventId:n,fallback:a,children:o}){const{org:s}=C(e),{data:r}=G(s?.id??null,void 0,{contentIds:[n]},e),i=r?.pages[0]?.content.find(l=>Number(l.id)===n);return o({title:i?J(i):a,status:null})}function pe({item:e,children:n}){const a=e.href?m(e.href):null,o=a?.kind==="record-view"?a.viewKey:null,s=a?.kind==="entity-type"?a:null,r=s?.typeSlug??null,i=M({slug:o?a?.owner:void 0}),{data:l}=V(r?a?.owner??null:null),c=r?l?.find(f=>f.slug===r)?.name:void 0;return n({title:o&&i.data?.find(f=>f.key===o)?.name||c&&(s?.view==="activity"?`${c} activity`:c)||e.title,status:null})}function ge({owner:e,automationId:n,fallback:a,children:o}){const{org:s}=C(e),{data:r}=oe(s?.id,void 0,{includeDetails:!1}),i=r?.find(l=>l.automation_id===n);return o({title:i?.name?.trim()||a,status:i?F(H(i),Date.now()):null})}function we({agentId:e,clientIds:n,fallback:a,children:o}){const s=Q({enabled:!!e}),r=le(null,{enabled:!e&&!!n?.length}),i=e?s.data?.find(l=>l.agentId===e)?.name:r.data?.find(l=>n?.includes(l.id))?.title;return o({title:i?.trim()||a,status:null})}function ye(e){const n=e.connectorPanel;if(n?.connectionId!=null)return{label:"Settings",pathname:`/${n.ownerSlug}/connectors/${encodeURIComponent(n.connectorKey)}/${n.connectionId}`,search:{settings:!0}};const a=e.href?m(e.href):null;if(a?.kind==="automation"&&a.runId==null&&!e.runId)return{label:"Edit",pathname:`/${a.owner}/automations/${encodeURIComponent(a.automationId)}`,search:{view:"definition"}};if(a?.kind==="agent"&&a.owner!=="me"){if(a.agentId)return{label:"Agent settings",pathname:`/${a.owner}/agents/${encodeURIComponent(a.agentId)}`};const o=a.clientIds?.[0];if(o)return{label:"Agent settings",pathname:`/${a.owner}/agents/connected/${encodeURIComponent(o)}`}}return null}function ve({item:e,onClose:n,onBack:a,isNarrow:o,covers:s}){const r=E(),i=e.href?m(e.href):null,l=e.runId&&i?.kind==="automation"&&i.view==="activity"?{pathname:`/${i.owner}/events`,search:{run_ids:String(e.runId)}}:e.href?D(e.href):null,c=ye(e);p.useEffect(()=>{if(o)return;const d=u=>{u.defaultPrevented||u.key!=="Escape"||(u.preventDefault(),n())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n,o]);const f=d=>t.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-1 border-b border-border px-3 py-1.5",children:[a||d?t.jsx(h,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:a??n,children:t.jsx(T,{className:"h-4 w-4"})}):null,t.jsx(y,{item:e,children:({title:u,status:x})=>t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u}),x?t.jsx("p",{title:x.text,className:j("truncate text-xs",x.problem?"text-destructive":"text-muted-foreground"),children:x.text}):null]})}),c?t.jsx(h,{asChild:!0,variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground",children:t.jsxs(v,{to:c.pathname,search:c.search??{},onClick:u=>{u.button!==0||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||(u.preventDefault(),(async()=>(await n(),await r({to:c.pathname,search:c.search??{}})))())},children:[t.jsx(O,{"aria-hidden":"true",className:"h-3.5 w-3.5"}),c.label]})}):null,l?t.jsx(h,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:t.jsx(v,{to:l.pathname,search:l.search??{},onClick:u=>{u.button!==0||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||(u.preventDefault(),(async()=>(await n(),await r({to:l.pathname,search:l.search??{}})))())},children:t.jsx(q,{className:"h-4 w-4"})})}):null,t.jsx(h,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:n,children:t.jsx(W,{className:"h-4 w-4"})})]}),k=t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t.jsx(p.Suspense,{fallback:t.jsx(ue,{}),children:t.jsx(y,{item:e,children:({title:d})=>t.jsx(ce,{item:d===e.title?e:{...e,title:d}})})})});return o?t.jsx(_,{open:!0,onOpenChange:d=>{d||n()},children:t.jsxs($,{children:[t.jsx(z,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),t.jsxs(K,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[t.jsx(L,{className:"sr-only",children:t.jsx(y,{item:e,children:({title:d})=>d})}),f(!0),t.jsx(I,{item:e}),k]})]})}):t.jsxs("aside",{className:j("flex flex-col border-l border-border bg-background",s?"absolute inset-0 z-30 w-full":"w-[460px] max-w-[45vw] shrink-0"),children:[f(!1),t.jsx(I,{item:e}),k]})}function ke({owner:e,userId:n,children:a}){const o=Y(),s=X({queryKey:["workspace-invitation",n,e],retry:!1,queryFn:async()=>{const i=await w.organization.listUserInvitations();if(i.error)throw new Error(i.error.message||"Could not check invitations.");for(const l of i.data??[]){if(l.status!=="pending"||new Date(l.expiresAt).getTime()<=Date.now())continue;const c=await w.organization.getInvitation({query:{id:l.id}});if(c.error){if([400,403,404].includes(c.error.status))continue;throw new Error(c.error.message||"Could not check invitations.")}if(c.data.organizationSlug===e)return c.data}return null}}),r=Z({mutationFn:async()=>{if(!s.data)return;const i=await w.organization.acceptInvitation({invitationId:s.data.id});if(i.error)throw new Error(i.error.message||"Could not accept the invitation.");await Promise.all([o.invalidateQueries({queryKey:["organizations"]}),o.invalidateQueries({queryKey:S.queryOptions(e,{slug:e}).queryKey})])}});return s.isPending?t.jsx("p",{role:"status",className:"py-12 text-center text-sm text-muted-foreground",children:"Checking your invitation…"}):s.isError?t.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 py-12 text-center",children:[t.jsx("p",{role:"alert",className:"text-sm text-muted-foreground",children:"Your invitations could not be checked."}),t.jsx(h,{variant:"outline",onClick:()=>void s.refetch(),children:"Try again"})]}):s.data?t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 px-4 py-12 text-center",children:[t.jsxs("div",{className:"max-w-md space-y-2",children:[t.jsxs("h1",{className:"text-xl font-semibold text-balance",children:["You're invited to join ",s.data.organizationName]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Accept your invitation to open this workspace."})]}),r.isError&&t.jsx("p",{role:"alert",className:"max-w-md text-sm text-destructive",children:r.error.message}),t.jsx(h,{disabled:r.isPending,onClick:()=>r.mutate(),children:r.isPending?"Joining…":"Accept invitation"})]}):a}function Pe(){const{owner:e}=ee.useParams(),{data:n,isLoading:a,error:o}=S(e==="me"?null:e,{slug:e}),{session:s,isReady:r}=te();if(ne({active:ae({settled:!a,authReady:r,session:s,resolved:!!n?.workspace,error:o}),owner:e}))return null;const l=e!=="me"&&s&&r&&!a&&!n?.workspace&&o instanceof se&&[401,403,404].includes(o.status);return t.jsx(re,{children:t.jsx(ie,{children:t.jsx(he,{children:l&&s?t.jsx(ke,{owner:e,userId:s.user.id,children:t.jsx(b,{})},`${s.user.id}:${e}`):t.jsx(b,{})})})})}export{Pe as component};
3
+ //# sourceMappingURL=_owner-CkOZR4n0.js.map
@@ -0,0 +1,2 @@
1
+ import{jB as p,j as e,bo as m}from"./index-BoqrvLHQ.js";import{M as i}from"./memory-browse-page-qEDQ9Z18.js";import"./public-shell-ready-K2R8iXSI.js";import"./dynamic-schema-form-CRyUchXo.js";import"./renderer-CTKNMcXP.js";import"./schema-value-wjqGxXhv.js";import"./card-CAPpY9P5.js";import"./table-ZuYMOjVR.js";import"./entity-pages-_nuesgnp.js";import"./filter-editors-DGVl9U4D.js";import"./subDays-9s9OEl5t.js";import"./entity-schema-graph-Cq96SJ3c.js";import"./core.esm-Ctg_pXLe.js";import"./missing-view-xT0B-f5z.js";import"./app-bridge-B-L0rGz9.js";import"./view-param-filters-DGKxSr7r.js";import"./member-scope-gate-Cxg2zGQT.js";function l(){const{owner:o,entityType:t,shape:r}=p.useParams();return e.jsx(i,{ownerSlug:o,typeScope:m(t),create:!1,shape:r})}export{l as component};
2
+ //# sourceMappingURL=_shape-C_FmSf9G.js.map
@@ -1,2 +1,2 @@
1
- import{dp as m,M as y,c as d,dq as u,cY as c,j as t,at as g,au as x,bQ as E}from"./index-DByaMzsG.js";import{E as f}from"./entity-type-page-CkQm0yEu.js";import"./event-kind-options-fHAIXu24.js";import"./code-editor-mrKkAfcE.js";import"./index-Vcq4gwWv.js";function b(){const{owner:a,slug:n}=m.useParams(),{orgContext:s}=y(),o=d(),{data:i=[],isLoading:r}=u(s),e=i.find(l=>l.slug===n)??null,p=e?c(e):!1;return t.jsx(g,{className:"gap-4 pt-2.5 pb-8",children:t.jsx(x,{children:r?t.jsx(E,{label:"entity type",variant:"panel"}):e?t.jsx(f,{entityType:e,orgContext:s,hideDelete:p,onClose:()=>{o({to:"/$owner",params:{owner:a},search:{layout:"graph"}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{b as component};
2
- //# sourceMappingURL=_slug-DJx_8fsV.js.map
1
+ import{dr as m,M as y,c as d,ds as u,cY as c,j as t,at as g,au as x,bQ as E}from"./index-BoqrvLHQ.js";import{E as f}from"./entity-type-page-CkCSbkBx.js";import"./event-kind-options-fHAIXu24.js";import"./code-editor-z1Sy_hiX.js";import"./index-Vcq4gwWv.js";function b(){const{owner:a,slug:n}=m.useParams(),{orgContext:s}=y(),o=d(),{data:i=[],isLoading:r}=u(s),e=i.find(l=>l.slug===n)??null,p=e?c(e):!1;return t.jsx(g,{className:"gap-4 pt-2.5 pb-8",children:t.jsx(x,{children:r?t.jsx(E,{label:"entity type",variant:"panel"}):e?t.jsx(f,{entityType:e,orgContext:s,hideDelete:p,onClose:()=>{o({to:"/$owner",params:{owner:a},search:{layout:"graph"}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{b as component};
2
+ //# sourceMappingURL=_slug-COPpRXLt.js.map
@@ -0,0 +1,2 @@
1
+ import{jC as t,j as m}from"./index-BoqrvLHQ.js";import{M as i}from"./memory-browse-page-qEDQ9Z18.js";import"./public-shell-ready-K2R8iXSI.js";import"./dynamic-schema-form-CRyUchXo.js";import"./renderer-CTKNMcXP.js";import"./schema-value-wjqGxXhv.js";import"./card-CAPpY9P5.js";import"./table-ZuYMOjVR.js";import"./entity-pages-_nuesgnp.js";import"./filter-editors-DGVl9U4D.js";import"./subDays-9s9OEl5t.js";import"./entity-schema-graph-Cq96SJ3c.js";import"./core.esm-Ctg_pXLe.js";import"./missing-view-xT0B-f5z.js";import"./app-bridge-B-L0rGz9.js";import"./view-param-filters-DGKxSr7r.js";import"./member-scope-gate-Cxg2zGQT.js";function v(){const{owner:o,viewKey:r}=t.useParams();return m.jsx(i,{ownerSlug:o,create:!1,viewKey:r})}export{v as component};
2
+ //# sourceMappingURL=_viewKey-BVdJiilV.js.map
@@ -0,0 +1,2 @@
1
+ import{jL as e,j as p,bo as i}from"./index-BoqrvLHQ.js";import{M as m}from"./memory-browse-page-qEDQ9Z18.js";import"./public-shell-ready-K2R8iXSI.js";import"./dynamic-schema-form-CRyUchXo.js";import"./renderer-CTKNMcXP.js";import"./schema-value-wjqGxXhv.js";import"./card-CAPpY9P5.js";import"./table-ZuYMOjVR.js";import"./entity-pages-_nuesgnp.js";import"./filter-editors-DGVl9U4D.js";import"./subDays-9s9OEl5t.js";import"./entity-schema-graph-Cq96SJ3c.js";import"./core.esm-Ctg_pXLe.js";import"./missing-view-xT0B-f5z.js";import"./app-bridge-B-L0rGz9.js";import"./view-param-filters-DGKxSr7r.js";import"./member-scope-gate-Cxg2zGQT.js";function R(){const{owner:o,entityType:t,viewKey:r}=e.useParams();return p.jsx(m,{ownerSlug:o,typeScope:i(t),create:!1,viewKey:r})}export{R as component};
2
+ //# sourceMappingURL=_viewKey-mxxpqjtC.js.map
@@ -1,2 +1,2 @@
1
- import{H as l,ar as u,r as c,a4 as m,j as e,as as d,y as h,F as f}from"./index-DByaMzsG.js";import{S as v,A as x,a as g}from"./index-BS5Ty3tf.js";import{F as p}from"./full-page-spinner-CYyCnKve.js";function j({alt:t="",...a}){return e.jsx("img",{alt:t,...a,referrerPolicy:"no-referrer"})}function w({children:t}){const a=h(),n=async i=>{await a.invalidateQueries({queryKey:["organizations"]}),i()};return e.jsx(g,{authClient:f,navigate:i=>{n(()=>{window.location.href=i})},replace:i=>{n(()=>window.location.replace(i))},Link:({href:i,children:s,className:r})=>e.jsx("a",{href:i,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:j},children:t})}function b(){const{session:t,sessionResult:a}=l(),{invitationId:n}=u.useSearch(),i=c.useRef(!1);return c.useEffect(()=>{a.isPending||t||!n||i.current||(i.current=!0,(async()=>{let s=null;try{const o=await fetch(`${m}/api/invitation-preview?id=${encodeURIComponent(n)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(n)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[t,a.isPending,n]),t&&!n?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):t?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(w,{children:e.jsx(v,{children:e.jsx(x,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{b as component};
2
- //# sourceMappingURL=accept-invitation-Dwq1GAnG.js.map
1
+ import{H as l,ar as u,r as c,a4 as m,j as e,as as d,y as h,F as f}from"./index-BoqrvLHQ.js";import{S as v,A as x,a as g}from"./index-BifR-LE9.js";import{F as p}from"./full-page-spinner-CtVlF8GQ.js";function j({alt:t="",...a}){return e.jsx("img",{alt:t,...a,referrerPolicy:"no-referrer"})}function w({children:t}){const a=h(),n=async i=>{await a.invalidateQueries({queryKey:["organizations"]}),i()};return e.jsx(g,{authClient:f,navigate:i=>{n(()=>{window.location.href=i})},replace:i=>{n(()=>window.location.replace(i))},Link:({href:i,children:s,className:r})=>e.jsx("a",{href:i,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:j},children:t})}function b(){const{session:t,sessionResult:a}=l(),{invitationId:n}=u.useSearch(),i=c.useRef(!1);return c.useEffect(()=>{a.isPending||t||!n||i.current||(i.current=!0,(async()=>{let s=null;try{const o=await fetch(`${m}/api/invitation-preview?id=${encodeURIComponent(n)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(n)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[t,a.isPending,n]),t&&!n?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):t?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(w,{children:e.jsx(v,{children:e.jsx(x,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{b as component};
2
+ //# sourceMappingURL=accept-invitation-BKeIzZXE.js.map
@@ -1,2 +1,2 @@
1
- import{r as a,dm as r,j as s}from"./index-DByaMzsG.js";const n=a.createContext(null);function i({children:t,...o}){return s.jsx(n.Provider,{value:o,children:t})}function u(){const t=a.useContext(n),o=r({strict:!1,select:e=>({pathname:e.pathname,search:e.search})});return t??o}export{i as A,u};
2
- //# sourceMappingURL=activity-route-location-C1jcXC7v.js.map
1
+ import{r as a,dp as r,j as s}from"./index-BoqrvLHQ.js";const n=a.createContext(null);function i({children:t,...o}){return s.jsx(n.Provider,{value:o,children:t})}function u(){const t=a.useContext(n),o=r({strict:!1,select:e=>({pathname:e.pathname,search:e.search})});return t??o}export{i as A,u};
2
+ //# sourceMappingURL=activity-route-location-sLvKaSCa.js.map
@@ -0,0 +1,2 @@
1
+ import{M as ne,n as Se,bo as we,cm as Le,V as ft,r as h,cn as pt,co as re,cp as yt,aw as bt,cq as jt,j as e,bQ as vt,bc as Ee,cr as Me,cs as Be,ct as Nt,B as Q,L as H,cu as Te,cv as wt,q as kt,cw as Ct,cx as St,cy as Lt,cz as Ye,cA as Et,cB as Mt,cC as Tt,Z as ee,bq as fe,br as pe,bs as ye,bt as be,bu as ie,cD as It,$ as Ve,cE as _t,bR as Rt,cF as At,cG as $t,cH as Pt,x as Ie,cI as Ot,c as Ue,u as Xe,cJ as Qe,cK as qe,cL as Ze,cM as Je,cN as Ht,cO as Wt,cP as et,aN as Dt,aP as Ft,b$ as Gt,ab as Kt,i as $,X as zt,s as Bt,cQ as Yt,cR as Vt,cS as Ut,m as W,cT as Xt,cU as Qt,cV as qt,a9 as Zt,cW as Ae,cX as te,ad as Jt,cY as en,a1 as tn,am as nn,cZ as sn,c_ as an,c$ as on,d0 as rn,d1 as ln,d2 as cn,d3 as dn,d4 as un,d5 as mn,d6 as hn,aC as gn,d7 as xn,d8 as fn,d9 as pn,da as yn,db as tt,bf as bn,dc as jn,bk as vn,d as nt,dd as Nn,de as wn,df as kn,dg as Cn,dh as Sn,di as Ln,dj as En,dk as Mn,w as Tn,dl as In,dm as _n,dn as Rn,at as An,aS as $n,au as Pn}from"./index-BoqrvLHQ.js";import{R as On,E as Hn,V as Wn,M as Dn}from"./view-card-DiHWlypr.js";import{M as Fn}from"./member-scope-gate-Cxg2zGQT.js";import{N as Gn}from"./needs-you-list-3uMsWcDv.js";import{V as $e}from"./missing-view-xT0B-f5z.js";import{H as je,n as ve,s as Kn,l as zn,b as Bn,a as Yn,G as Vn,c as Un}from"./entity-schema-graph-Cq96SJ3c.js";import{u as st}from"./use-automations-DfBtVzGa.js";import{f as Xn}from"./feed-event-kinds-BYuZCoU4.js";import{a as at}from"./list-skeleton-CH0qQBYk.js";import{u as Qn}from"./clients-Bf7ZgGro.js";import{u as qn}from"./client-activity-scopes-Aqdo6Pdr.js";import{g as Zn}from"./client-rows-Dd5YV8vn.js";import{P as Jn}from"./public-shell-ready-K2R8iXSI.js";function es({organizationId:t,ownerSlug:n,typeScope:s,entityScope:o}){const{orgContext:i}=ne(),{isMember:d,isLoading:a}=Se(),l=d&&!!t,c=s?we(s):void 0,u=!o&&!c,f=Le(l?n:null),w=ft({strict:!1}),x=h.useMemo(()=>pt(re(f.attentionCards),w),[f.attentionCards,w]),{feeds:g,pageIds:L}=yt(t,h.useMemo(()=>x.map(({item:R})=>R),[x])),r=h.useMemo(()=>[...x].sort((R,C)=>Number(L.has(C.item.id))-Number(L.has(R.item.id))),[x,L]),b=h.useMemo(()=>({approvalRunIds:new Set(r.flatMap(({item:R})=>R.approvalRunId!=null?[R.approvalRunId]:[])),eventIds:new Set(r.flatMap(({item:R,unreadIds:C})=>[...R.notificationId!=null?[R.notificationId]:[],...C]))}),[r]),v=R=>{R.length>0&&f.markManyRead.mutateAsync(R)},{data:p,isLoading:N,error:j}=bt(o?`/${n}/${jt(o)}`:`/${n}`,i),S=o?p?.entity:void 0,P=(o?S?.entity_type??we(o.split("/").at(-2)??""):c)==="$member",D=o!=null&&!N&&(j!=null||p?.entity==null),M=o?void 0:p?.counts,F=M?M.connections>0||M.agents>0:!1,_=l&&!a&&!N&&M!=null&&!F,G=o&&N?e.jsx(vt,{label:"Loading record…"}):D?e.jsx(Ee,{icon:Me,title:"Record not found",description:"It may have been deleted, or it may live in a workspace you can't access."}):S?e.jsx(On,{ownerSlug:n,entity:S,organizationId:t}):e.jsx(Hn,{organizationId:t,ownerSlug:n,hideSourceFilter:!0,scopedEntityTypes:c?[c]:void 0,pinned:u?{needsYou:f.isError?e.jsx("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:"Could not load what needs you. Refresh to try again."}):e.jsx(Gn,{owner:n,entries:r,pageIds:L,onMarkRead:v,markPending:f.markManyRead.isPending}),rows:g.length>0?e.jsx(Be,{organizationId:t,feeds:g}):null,hidden:b}:void 0,toolbar:!0,emptyState:_?e.jsx(ts,{ownerSlug:n}):void 0});return e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:[o?null:e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Activity"}),P?e.jsx(Fn,{children:G}):G]})}function ts({ownerSlug:t}){return e.jsx("div",{className:"px-6",children:e.jsx(Ee,{icon:Nt,title:"Nothing to catch up on — yet",description:"No notifications here. Add a connector to bring in data, or bring your agent to Lobu and give it something to work with.",children:e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[e.jsx(Q,{asChild:!0,children:e.jsxs(H,{to:"/$owner/connectors/create",params:{owner:t},children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),"Add a connector"]})}),e.jsx(Q,{asChild:!0,variant:"outline",children:e.jsxs(H,{to:"/$owner/agents/connect",params:{owner:t},children:[e.jsx(wt,{className:"mr-2 h-4 w-4"}),"Connect agent"]})})]})})})}const Pe={trigger:"runs on arrival",delivery:"delivers here"};function ns(t){const n=new Map,s=(o,i,d,a)=>{const l=Number(o);if(!Number.isInteger(l)||l<=0)return;const c=n.get(l)??[],u=c.find(f=>f.automation.automation_id===i.automation_id);if(u){if(u.reason===d)for(const f of a)u.eventTypes.includes(f)||u.eventTypes.push(f);return}c.push({automation:i,reason:d,eventTypes:[...a]}),n.set(l,c)};for(const o of t){for(const i of o.triggers??[]){const d=Array.isArray(i.event_types)?i.event_types.map(String):[];s(i.connection_id,o,"trigger",d)}s(o.delivery_target?.connection_id,o,"delivery",[])}return n}function ss(t){const n=new Map;for(const s of t){const o=n.get(s.connection_id)??[];o.push(s),n.set(s.connection_id,o)}return n}function as(t){const n=(s,o,i)=>`${s} ${s===1?o:i}`;return[n(t.feeds,"feed","feeds"),t.actions>0?n(t.actions,"action","actions"):null,t.automations>0?n(t.automations,"Automation","Automations"):null].filter(Boolean).join(" · ")}const ke="connector:",Oe=t=>`${ke}${t}`,os={event:"Zap",schedule:"CalendarClock",manual:"Hand"},is=0,rs=1,He=2;function ls(t,n){const s=new Map;for(const{kind:o,targets:i}of Xn(t?.feeds_schema?.[n]))for(const{entityType:d,creates:a}of i){const l=s.get(d)??{creates:!1,eventKinds:new Set};l.creates||=a,l.eventKinds.add(o),s.set(d,l)}return s}function cs(t,n){const s=new Map(t.connectorDefs.map(r=>[r.key,r])),o=new Map(t.connectorDefs.map(r=>[r.key,r.name])),i=new Map(t.connections.map(r=>[r.id,r])),d=ss(t.feeds),a=r=>`connection:${r}`,l=r=>`automation:${r}`,c=[],u=(r,b,v,p,N=!1)=>{c.push({id:`flow:${r}->${b}`,source:r,target:b,layoutReversed:N,data:{relationships:[],isSymmetric:!1,flow:{summary:v,details:p}}})},f=new Set(t.connections.map(r=>r.id));for(const r of t.connections){const b=new Map;for(const v of d.get(r.id)??[]){const p=ls(s.get(r.connector_key),v.feed_key);for(const[N,j]of p){const S=b.get(N)??{creates:!1,eventKinds:new Set};S.creates||=j.creates;for(const I of j.eventKinds)S.eventKinds.add(I);b.set(N,S)}}for(const[v,p]of b){const N=n.get(v);N&&u(a(r.id),N,p.creates?"creates records":"links records",[`From ${[...p.eventKinds].sort().join(", ")} events`])}}const w=ns(t.automations);for(const[r,b]of w)if(f.has(r))for(const{automation:v,reason:p,eventTypes:N}of b){const j=l(v.automation_id);p==="trigger"?u(a(r),j,Pe.trigger,N.length>0?[`On ${[...N].sort().join(", ")}`]:[]):u(j,a(r),Pe.delivery,[],!0)}const x=[];for(const r of t.automations){const b=l(r.automation_id),v=r.entity_type?n.get(r.entity_type):void 0;v&&u(v,b,"anchored here",[r.entity_name?`On ${r.entity_name}`:""].filter(Boolean));const p=kt(r,o,i),N=Ct(r),j=r.health==="degraded"?"Needs attention":void 0;x.push({id:b,lane:He,width:ve(`${p.does} ${j??""}`,p.when),height:je,data:{slug:b,label:p.does,icon:N?Oe(N):os[p.kind],isSystem:!1,badge:j,metaLabel:p.when,ref:{kind:"automation",automationId:r.automation_id}}})}const g=[];for(const r of t.metrics){const b=n.get(r.typeSlug);if(!b)continue;const v=`metric:${r.typeSlug}:${r.name}`;u(b,v,"measures",[r.description].filter(Boolean)),g.push({id:v,lane:He,width:ve(r.name,r.agg),height:je,data:{slug:v,label:r.name,icon:"ChartColumn",isSystem:!1,metaLabel:r.agg,ref:{kind:"metric",typeSlug:r.typeSlug,name:r.name}}})}return{nodes:[...t.connections.map(r=>{const b=St(r),v=Lt(r,s.get(r.connector_key)),p=as({feeds:d.get(r.id)?.length||r.feed_count,actions:r.operations_summary?.total??0,automations:w.get(r.id)?.length??0}),N=v.needsAttention?"Needs attention":r.device_label??void 0;return{id:a(r.id),lane:is,width:ve(`${b} ${N??""}`,p),height:je,data:{slug:a(r.id),label:b,icon:Oe(r.connector_key),isSystem:!1,badge:N,metaLabel:p,ref:{kind:"connection",connectorKey:r.connector_key,connectionId:r.id}}}}),...x,...g],edges:c}}function ot(t){switch(t.data.ref?.kind){case"connection":return"connections";case"automation":return"automations";case"metric":return"metrics";default:return"entities"}}function ds(t,n){const s=new Map;for(const c of t.nodes)(!c.data.organizationSlug||!s.has(c.data.slug))&&s.set(c.data.slug,c.id);const o=cs(n,s),{layers:i}=n,d=[...o.nodes,...t.nodes.map(c=>({...c,lane:rs}))].filter(c=>i[ot(c)]),a=new Set(d.map(c=>c.id)),l=[...t.edges,...o.edges].filter(c=>a.has(c.source)&&a.has(c.target));return{nodes:d,edges:l}}const We="__new__";function De(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function us({entityTypes:t,initialSource:n="",initialTarget:s="",onDone:o}){const i=h.useId(),d=`${i}-relationship`,a=`${i}-name`,l=`${i}-symmetric`,c=`${i}-source`,u=`${i}-target`,{orgContext:f}=ne(),{data:w=[]}=Ye(f),x=Et(),g=Mt(),[L,r]=h.useState(""),[b,v]=h.useState(""),[p,N]=h.useState(!1),[j,S]=h.useState(n),[I,P]=h.useState(s),[D,M]=h.useState(null),F=L===We,_=w.filter(C=>C.status==="active"&&C.purpose!==Tt&&(!C.organization_slug||C.organization_slug===f?.slug)),G=x.isPending||g.isPending,R=async()=>{if(M(null),!L)return M("Pick a relationship");if(!j||!I)return M("Pick both ends");try{let C=L;if(F){const K=b.trim();if(!K)return M("Name the relationship");const O=De(K);if(!O)return M("Name must contain a letter or number");C=(await x.mutateAsync({slug:O,name:K,is_symmetric:p})).relationship_type.slug,r(C)}await g.mutateAsync({slug:C,source_entity_type_slug:j,target_entity_type_slug:I}),o()}catch(C){M(C instanceof Error?C.message:"Could not save")}};return e.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Relationships are defined once for the workspace, then paired with the types they connect."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ee,{htmlFor:d,className:"text-xs after:ml-1 after:text-destructive after:content-['*']",children:"Relationship"}),e.jsxs(fe,{value:L,onValueChange:r,children:[e.jsx(pe,{id:d,className:"h-8 text-xs",children:e.jsx(ye,{placeholder:"Pick or define one"})}),e.jsxs(be,{children:[_.map(C=>e.jsx(ie,{value:C.slug,children:C.name||C.slug},C.slug)),_.length>0?e.jsx(It,{}):null,e.jsx(ie,{value:We,children:"Define a new one…"})]})]})]}),F?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ee,{htmlFor:a,className:"text-xs after:ml-1 after:text-destructive after:content-['*']",children:"Name"}),e.jsx(Ve,{id:a,value:b,onChange:C=>v(C.target.value),placeholder:"works at",className:"h-8 text-xs"}),b.trim()?e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Slug: ",e.jsx("code",{children:De(b)||"—"})]}):null]}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs(ee,{htmlFor:l,className:"text-xs font-normal",children:["Symmetric",e.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:"Both ends mean the same thing, like “connected with”."})]}),e.jsx(_t,{id:l,checked:p,onCheckedChange:N})]})]}):null,e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ee,{htmlFor:c,className:"text-xs after:ml-1 after:text-destructive after:content-['*']",children:"From"}),e.jsxs(fe,{value:j,onValueChange:S,children:[e.jsx(pe,{id:c,className:"h-8 text-xs",children:e.jsx(ye,{placeholder:"Type"})}),e.jsx(be,{children:t.map(C=>e.jsx(ie,{value:C.slug,children:C.label},C.slug))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ee,{htmlFor:u,className:"text-xs after:ml-1 after:text-destructive after:content-['*']",children:"To"}),e.jsxs(fe,{value:I,onValueChange:P,children:[e.jsx(pe,{id:u,className:"h-8 text-xs",children:e.jsx(ye,{placeholder:"Type"})}),e.jsx(be,{children:t.map(C=>e.jsx(ie,{value:C.slug,children:C.label},C.slug))})]})]}),D?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,e.jsx(Rt,{onCancel:o,cancelDisabled:G,className:"[&>button]:h-7 [&>button]:px-3 [&>button]:text-xs",children:e.jsx(Q,{type:"button",size:"sm",onClick:R,disabled:G,children:G?"Saving…":"Add relationship"})})]})}const it=288,le=240,ce=720,ms=320,_e="lobu.schema-panel-width:v1";function de(t,n){if(!Number.isFinite(t))return it;const s=Math.max(le,Math.min(ce,n-ms));return Math.round(Math.min(s,Math.max(le,t)))}function hs(){const t=At(_e);if(t===null)return null;const n=Number.parseInt(t,10);return!Number.isFinite(n)||n<le||n>ce?null:n}function gs(t){$t(_e,String(Math.round(t)))}function xs(){Pt(_e)}const Fe={nodes:[],edges:[]};function fs(t,n,s){const{orgContext:o}=ne(),{data:i=[],isLoading:d,isError:a}=Ie(o),{data:l=[],isLoading:c,isError:u}=Ye(o),f=h.useMemo(()=>Kn(l,t),[l,t]),{data:w,isLoading:x,isError:g}=Ot(o),L=h.useMemo(()=>{const j=new Map(f.map(I=>[I.id,I.slug])),S={};for(const I of w??[]){const P=j.get(I.relationship_type_id);P&&(S[P]??=[]).push(I)}return S},[w,f]),r=h.useMemo(()=>({entityTypes:i,relationshipTypes:f,rulesBySlug:L,ownerSlug:t,targetAspect:n,flow:s}),[i,f,L,t,n,s]),[b,v]=h.useState(null),p=d||c||x,N=a||u||g;return h.useEffect(()=>{if(p||N)return;let j=!1;const S={targetAspect:r.targetAspect};let I;return r.flow?I=zn(ds(Bn(r),r.flow),S):I=Yn(r,S),I.then(P=>{j||v({graph:P,isError:!1})}).catch(()=>{j||v({graph:Fe,isError:!0})}),()=>{j=!0}},[r,p,N]),{graph:b?.graph??Fe,isLoading:!N&&!b,isError:N||b?.isError===!0}}function Ge(t){const n=t.ruleCount>1?` ×${t.ruleCount}`:"",s=typeof t.linkCount=="number"?` · ${t.linkCount.toLocaleString()}`:"";return`${t.label}${n}${s}`}const Ce={connections:"--chart-3",entities:"--chart-5",automations:"--chart-2",metrics:"--chart-4"};function ps(t,n){const s=t.nodes.some(a=>a.data.ref),o=new Map(t.nodes.map(a=>[a.id,a.data.label])),i=t.nodes.map(a=>({id:a.id,x:a.position.x+a.width/2,y:a.position.y+a.height/2,w:a.width,h:a.height,title:a.data.label,meta:a.data.metaLabel,icon:a.data.icon,badge:a.data.badge??a.data.organizationSlug,muted:a.data.isSystem,dimmed:n?!n.nodes.has(a.id):!1,accent:s?Ce[ot(a)]:void 0})),d=t.edges.map(a=>{const{relationships:l,isSymmetric:c,flow:u}=a.data;if(u)return{id:a.id,source:a.source,target:a.target,route:a.route??null,summary:u.summary,details:[u.summary,...u.details],directed:!0,dimmed:n?!n.edges.has(a.id):!1,ariaLabel:`${o.get(a.source)??a.source} to ${o.get(a.target)??a.target}: ${u.summary}`};const f=l.map(w=>w.label).join(", ");return{id:a.id,source:a.source,target:a.target,route:a.route??null,summary:l.length===1?Ge(l[0]):`${l.length} relationships`,details:l.map(Ge),directed:!c,dimmed:n?!n.edges.has(a.id):!1,ariaLabel:`${o.get(a.source)??a.source} ${c?"and":"to"} ${o.get(a.target)??a.target}: ${f}`}});return{boxes:i,edges:d}}const Ke=[{key:"connections",label:"Connections"},{key:"entities",label:"Entities"},{key:"automations",label:"Automations"},{key:"metrics",label:"Metrics"}],ys={count:"Count",count_distinct:"Distinct count",sum:"Sum",min:"Minimum",max:"Maximum"};function bs({metric:t,ownerSlug:n}){const s=(o,i)=>i.length>0?e.jsxs("section",{className:"flex flex-col gap-1.5",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o}),e.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:i.map(d=>e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:d.name}),d.description?e.jsx("span",{className:"text-muted-foreground",children:` · ${d.description}`}):null]},d.name))})]}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"flex flex-col gap-1",children:[e.jsxs("p",{className:"text-sm",children:[ys[t.agg]??t.agg," of"," ",e.jsx("code",{className:"rounded bg-muted px-1 text-xs",children:t.eventSet})," ","events, per ",t.typeLabel]}),t.description?e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}):null]}),s("Data from",t.sources.map(o=>({name:o,description:""}))),s("Group by",t.dimensions),s("Segments",t.segments),e.jsx(Q,{asChild:!0,variant:"outline",size:"sm",className:"self-start",children:e.jsxs(H,{to:"/$owner/$entityType",params:{owner:n,entityType:t.typeSlug},children:["Open ",t.typeLabel]})})]})}function js({ownerSlug:t,metric:n,endpointOptions:s,canAuthor:o,mode:i,onModeChange:d}){const a=()=>d({kind:"index"});return i.kind==="metric"?n?e.jsx(bs,{metric:n,ownerSlug:t}):null:o&&i.kind==="new-relationship"?e.jsx(us,{entityTypes:s,initialSource:i.source,initialTarget:i.target,onDone:a},`${i.source??""}|${i.target??""}`):null}function vs(t){const{mode:n,canAuthor:s,onModeChange:o,isPeekOpen:i}=t,d=n.kind==="metric"?n.name:s&&n.kind==="new-relationship"?"New relationship":"Data map",a=h.useRef(null),l=JSON.stringify(n),c=h.useRef(l);return h.useEffect(()=>{c.current!==l&&(c.current=l,a.current?.focus({preventScroll:!0}))},[l]),e.jsx("aside",{style:{"--schema-panel-width":`${t.width}px`},className:$("order-first flex w-full shrink-0 flex-col lg:order-none lg:w-[var(--schema-panel-width)]",n.kind==="index"?"lg:absolute lg:top-0 lg:right-6 lg:z-10 lg:w-max lg:max-w-[calc(100%-3rem)] lg:max-h-[calc(100%-2rem)]":"bg-background lg:relative",i&&"lg:hidden"),children:e.jsxs("div",{className:$("flex min-h-0 flex-1 flex-col",n.kind!=="index"&&"lg:absolute lg:inset-0"),children:[e.jsxs("div",{className:n.kind==="index"?"sr-only":"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[e.jsx("h2",{ref:a,tabIndex:-1,className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground outline-none",children:d}),n.kind!=="index"?e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close",onClick:()=>o({kind:"index"}),children:e.jsx(zt,{className:"h-4 w-4"})}):null]}),e.jsx("div",{className:$("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto",n.kind==="index"?"pb-1":"p-4"),children:e.jsx(js,{...t})})]})})}function rt(t){const n=t.previousElementSibling,s=t.nextElementSibling;if(n instanceof HTMLElement&&s instanceof HTMLElement){const o=n.clientWidth+s.clientWidth;if(o>0)return o}return 0}function Ns({width:t,maxWidth:n,onResize:s,onCommit:o,onReset:i,className:d}){const[a,l]=h.useState(!1),c=h.useRef(0),u=x=>{const g=rt(x);return g>0?g:x.parentElement?.clientWidth??0},f=x=>{if(x.button!==0)return;const g=x.currentTarget;if(!g.parentElement)return;x.preventDefault(),c.current=u(g);const r=x.clientX,b=t;l(!0),g.setPointerCapture(x.pointerId);const v=S=>de(b-(S-r),c.current);let p=b;const N=S=>{p=v(S.clientX),s(p)},j=S=>{g.removeEventListener("pointermove",N),g.removeEventListener("pointerup",j),g.removeEventListener("pointercancel",j),l(!1),o(S.type==="pointercancel"?p:v(S.clientX))};g.addEventListener("pointermove",N),g.addEventListener("pointerup",j),g.addEventListener("pointercancel",j)},w=x=>{const g=u(x.currentTarget),L=r=>{x.preventDefault(),o(de(t+r,g))};x.key==="ArrowLeft"?L(16):x.key==="ArrowRight"?L(-16):x.key==="Home"&&(x.preventDefault(),i())};return e.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize map panel","aria-valuenow":t,"aria-valuemin":le,"aria-valuemax":n,tabIndex:0,onPointerDown:f,onKeyDown:w,onDoubleClick:i,className:$("group hidden shrink-0 cursor-col-resize touch-none items-stretch justify-center px-1.5 outline-none lg:flex",a&&"cursor-col-resize",d),children:e.jsx("div",{className:$("w-px rounded-full bg-border transition-[background-color,width] group-hover:w-0.5 group-hover:bg-primary/60 group-focus-visible:w-0.5 group-focus-visible:bg-primary",a&&"w-0.5 bg-primary")})})}function ws({ownerSlug:t,renderToolbar:n}){const s=Ue(),o=Xe(),i=o?.item!=null,{orgContext:d}=ne(),{isAdmin:a}=Qe(d.organizationId),[l,c]=h.useState({connections:!0,entities:!0,automations:!0,metrics:!0}),[u,f]=h.useState({kind:"index"}),w=o?.close,x=h.useCallback(m=>{m.kind!=="index"&&i&&w?.(),f(m)},[i,w]),[g,L]=h.useState(),r=h.useRef(null),b=h.useCallback(m=>{if(r.current?.disconnect(),r.current=null,!m||typeof ResizeObserver>"u")return;const y=()=>{if(!m.clientWidth||!m.clientHeight)return;const A=Math.round(m.clientHeight/m.clientWidth*10)/10;L(E=>E===A?E:A)};y();const T=new ResizeObserver(y);T.observe(m),r.current=T},[]),v=d.organizationId,p=qe(v),N=Ze(v),j=Je(v),S=st(v??void 0),{data:I}=Ie(d),P=h.useMemo(()=>I?.filter(m=>Ht(m,t)),[I,t]),D=h.useMemo(()=>(P??[]).flatMap(m=>Object.entries(m.metrics_config?.measures??{}).map(([y,T])=>({typeSlug:m.slug,name:y,agg:T.agg,description:T.description}))),[P]),M=p.isLoading||N.isLoading||j.isLoading||S.isLoading,F=h.useMemo(()=>M?null:{connections:p.data??[],feeds:N.data??[],connectorDefs:j.data??[],automations:S.data??[],metrics:D,layers:l},[M,p.data,N.data,j.data,S.data,D,l]),{graph:_,isLoading:G,isError:R}=fs(t,g,F),C=G||M,K={connections:!M&&(p.data??[]).length===0,entities:!1,automations:!M&&(S.data??[]).length===0,metrics:!M&&D.length===0},O=u.kind==="metric"?u:null,B=h.useMemo(()=>{if(!O)return null;const m=`metric:${O.typeSlug}:${O.name}`,y=_.edges.find(E=>E.target===m);if(!y)return null;const T=y.source,A=_.edges.filter(E=>E.target===T&&_.nodes.find(Y=>Y.id===E.source)?.data.ref?.kind==="connection");return{typeId:T,nodes:new Set([m,T,...A.map(E=>E.source)]),edges:new Set([y.id,...A.map(E=>E.id)]),sources:A.map(E=>_.nodes.find(Y=>Y.id===E.source)?.data.label??E.source)}},[O,_]),{boxes:se,edges:ue}=h.useMemo(()=>ps(_,B),[_,B]),me=h.useMemo(()=>{if(!O)return null;const m=P?.find(A=>A.slug===O.typeSlug),y=m?.metrics_config,T=y?.measures?.[O.name];return!m||!T?null:{name:O.name,typeSlug:m.slug,typeLabel:m.name||m.slug,agg:T.agg,eventSet:T.eventSet,description:T.description,dimensions:Object.entries(y?.dimensions??{}).map(([A,E])=>({name:A,description:E.description})),segments:Object.entries(y?.segments??{}).map(([A,E])=>({name:A,description:E.description})),sources:B?.sources??[]}},[O,P,B]),V=h.useMemo(()=>new Map(_.nodes.map(m=>[m.id,m.data.slug])),[_.nodes]),U=h.useMemo(()=>new Map(_.nodes.flatMap(m=>m.data.ref?[[m.id,m.data.ref]]:[])),[_.nodes]),X=h.useMemo(()=>{const m=new Map;for(const y of _.nodes)y.data.ref||(!y.data.organizationSlug||!m.has(y.data.slug))&&m.set(y.data.slug,{slug:y.data.slug,label:y.data.label});return[...m.values()]},[_.nodes]),J=h.useCallback(m=>{const y=U.get(m);if(y?.kind==="connection"){s({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:y.connectorKey,connectionId:String(y.connectionId)},search:{}});return}if(y?.kind==="metric"){x({kind:"metric",typeSlug:y.typeSlug,name:y.name});return}if(y?.kind==="automation"){s({to:"/$owner/automations/$automationId",params:{owner:t,automationId:y.automationId},search:{view:"activity",run_id:void 0}});return}s(Wt(t,V.get(m)??m))},[s,t,V,U,x]),he=h.useCallback((m,y)=>{U.has(m)||U.has(y)||x({kind:"new-relationship",source:V.get(m)??m,target:V.get(y)??y})},[V,U,x]),ge=h.useCallback(m=>{const y=m.startsWith(ke)?m.slice(ke.length):null;if(!y)return e.jsx(et,{icon:m||null,className:"h-4 w-4"});const T=Dt(y,j.data??[],{name:p.data?.find(A=>A.connector_key===y)?.connector_name??y});return e.jsx(Ft,{plain:!0,icon:T.icon,iconUrl:T.iconUrl,name:T.name,faviconDomain:T.faviconDomain})},[j.data,p.data]),ae=u.kind==="metric"||a&&u.kind!=="index",[oe,q]=h.useState(()=>hs()),k=oe??it,[z,dt]=h.useState(null),xe=h.useRef(null),ut=h.useCallback(m=>{if(xe.current?.disconnect(),xe.current=null,!m||typeof ResizeObserver>"u")return;const y=m.children[1];if(!y)return;const T=()=>{const E=rt(y);E>0&&dt(Y=>Y===E?Y:E)};T();const A=new ResizeObserver(T);A.observe(m),xe.current=A},[]),Re=z===null?k:de(k,z),mt=z===null?ce:de(ce,z),ht=h.useCallback(m=>{q(m),gs(m)},[]),gt=h.useCallback(()=>{q(null),xs()},[]);if(C)return e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[n(null),e.jsx(Vn,{label:"Loading data map",fill:!0})]});if(R)return e.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[n(null),e.jsx(Gt,{label:"data map"})]});const xt=e.jsxs("fieldset",{className:$("m-0 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 border-0 p-0 text-sm",ae&&"hidden lg:flex"),children:[e.jsx("legend",{className:"sr-only",children:"Show on the map"}),Ke.map(({key:m,label:y})=>{const T=`memory-map-show-${m}`,A=l[m]&&!K[m]&&Ke.filter(({key:E})=>l[E]&&!K[E]).length===1;return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Kt,{id:T,checked:l[m],disabled:A,style:{borderColor:`var(${Ce[m]})`,backgroundColor:l[m]?`var(${Ce[m]})`:void 0},onCheckedChange:E=>c(Y=>({...Y,[m]:E===!0}))}),e.jsx("label",{htmlFor:T,className:"inline-flex cursor-pointer select-none items-center",children:y})]},m)})]});return e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[n(xt),e.jsxs("div",{ref:ut,className:"relative flex min-h-0 min-w-0 flex-1 flex-col gap-3 lg:-mr-6 lg:-mb-8 lg:flex-row lg:gap-0",children:[e.jsx("div",{className:$("flex min-w-0 flex-1 flex-col lg:pb-8",ae&&"hidden lg:flex"),children:e.jsx("div",{ref:b,className:"min-h-[420px] min-w-0 flex-1 overflow-hidden rounded-lg bg-background",children:e.jsx(Un,{boxes:se,edges:ue,label:"Data map",onOpenBox:J,openLabel:m=>`Open ${m.title}`,onConnect:a?he:void 0,renderIcon:ge})})}),e.jsx(Ns,{width:Re,maxWidth:mt,onResize:q,onCommit:ht,onReset:gt,className:i||u.kind==="index"?"lg:hidden":void 0}),e.jsx(vs,{width:Re,metric:me,ownerSlug:t,endpointOptions:X,canAuthor:a,mode:u,onModeChange:x,isPeekOpen:i})]})]})}const ze=12,ks=5e3;function Cs(t,n){const s=!!t&&!!n.organizationId&&(n.enabled??!0),o=Bt({enabled:s}),{data:i}=o,d=i??[],a=h.useMemo(()=>d.map(g=>g.agentId),[d]),{threads:l,isLoading:c,isError:u}=Yt(t,a,{enabled:s&&a.length>0,limit:ze}),f=qn({enabled:s,limit:ze,excludeCommandClients:!1,organizationId:n.organizationId,refetchInterval:g=>g?ks:!1}),w=n.organizationId?f.data:void 0;return{items:h.useMemo(()=>[...l.map(g=>({kind:"conversation",at:g.updatedAt,thread:g})),...(w??[]).map(g=>({kind:"mcp",at:g.lastCallAt,conversation:g}))].sort((g,L)=>L.at-g.at),[w,l]),agents:d,isLoading:s&&(o.isLoading||c||f.isLoading),isError:o.isError||u||f.isError}}const Z=(t,n)=>t?{...t,label:n}:void 0;function Ss(t,n){const s=Vt(t,n,[],!1),o=new Map(s.map(c=>[c.key,c])),i=[Z(o.get("agent"),"Connect Claude Code, Codex, or Cursor"),Z(o.get("connection"),"Connect GitHub, your browser, or shell")].filter(c=>c!=null),d=[Z(o.get("connection"),"Connect Gmail or Calendar"),Z(o.get("agent"),"Connect Claude, ChatGPT, or Codex")].filter(c=>c!=null),a=[Z(o.get("connection"),"Connect Gmail, Calendar, or LinkedIn"),Z(o.get("agent"),"Connect Claude, ChatGPT, or Codex")].filter(c=>c!=null),l=(c,u,f,w,x,g)=>({id:c,eyebrow:u,title:f,description:w,icon:x,steps:g,next:g.find(L=>!L.complete)});return[l("coding-memory","For developers","Give your coding agent context","Connect Claude Code, Codex, or Cursor, give it GitHub, your browser, or shell, then let it ask what you decided instead of starting from zero.","code",i),l("inbox-crm","For customer teams","Turn your inbox into a CRM","Connect Gmail and Calendar. Lobu keeps people, companies, and every thread in one live model; your agent turns it into a working CRM.","crm",d),l("personal-network","For you","Remember everyone you meet","Connect Gmail, Calendar, or LinkedIn. Lobu builds a private people graph, and your agent reminds you when it's time to reconnect.","network",a)]}const Ls={code:qt,crm:Qt,network:Xt};function Es({owner:t,onSkip:n}){const s=Ut(t,{requireEntityTypes:!1});if(!s.ready||!s.counts)return e.jsx(Ts,{});const o=Ss(t,s.counts);return e.jsxs("section",{"aria-label":"Start here",className:"flex min-w-0 flex-col gap-4 pt-2 pb-6",children:[e.jsxs("div",{className:"flex flex-col gap-1 px-1",children:[e.jsx("p",{className:"text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:"Start here"}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"Where do you want to start?"}),e.jsx("p",{className:"max-w-2xl text-sm leading-6 text-muted-foreground",children:"Lobu is a live context layer for your agents. Connect the tools you work in; ChatGPT, Claude, Codex, and your own agents resume from the same context. Pick a starting point; everything lands in the same workspace, and you can combine them later."})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:o.map((i,d)=>e.jsx(Ms,{recipe:i,className:$(d===o.length-1&&"md:col-span-2 xl:col-span-1")},i.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:"None of these?"}),e.jsx(H,{to:"/$owner/connectors/create",params:{owner:t},className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground",children:"Browse all connectors"}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:n,className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Skip for now"})]})]})}function Ms({recipe:t,className:n}){const s=Ls[t.icon];return e.jsxs("article",{className:$("flex min-w-0 flex-col gap-3 rounded-lg border bg-card p-4",n),children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-muted text-muted-foreground",children:e.jsx(s,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:t.eyebrow}),e.jsx("h3",{className:"text-sm leading-5 font-semibold",children:t.title})]})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:t.description}),e.jsx("ol",{className:"flex flex-col gap-1",children:t.steps.map(o=>{const i=o===t.next;return e.jsx("li",{children:o.complete?e.jsxs("span",{className:"flex min-h-7 items-center gap-2 px-1.5 text-xs text-muted-foreground",children:[e.jsx(Zt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0",children:o.label})]}):i?e.jsxs(H,{...o.link,"aria-current":"step",className:$("flex min-h-9 items-center gap-2 rounded-md border border-primary/30 bg-primary/10 px-2 text-xs font-medium text-foreground transition-colors","hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),children:[e.jsx(Ae,{className:"h-3.5 w-3.5 shrink-0 text-primary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1",children:o.label}),e.jsx(te,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"})]}):e.jsxs("span",{className:"flex min-h-7 items-center gap-2 px-1.5 text-xs text-muted-foreground",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0",children:o.label})]})},o.key)})})]})}function Ts(){return e.jsxs("section",{"aria-label":"Start here",className:"flex min-w-0 flex-col gap-4 pt-2 pb-6",children:[e.jsxs("div",{className:"flex flex-col gap-2 px-1",children:[e.jsx(W,{className:"h-3 w-16"}),e.jsx(W,{className:"h-6 w-full max-w-lg"}),e.jsx(W,{className:"h-4 w-full max-w-xl"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[0,1,2].map(t=>e.jsxs("div",{className:$("flex flex-col gap-3 rounded-lg border p-4",t===2&&"md:col-span-2 xl:col-span-1"),children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(W,{className:"h-8 w-8 rounded-md"}),e.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[e.jsx(W,{className:"h-3 w-20"}),e.jsx(W,{className:"h-4 w-40"})]})]}),e.jsx(W,{className:"h-3 w-full"}),e.jsx(W,{className:"h-3 w-5/6"}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(W,{className:"h-6 w-full"}),e.jsx(W,{className:"h-6 w-full"}),e.jsx(W,{className:"h-6 w-full"})]})]},t))})]})}function Is({owner:t}){const{orgContext:n}=ne(),s=Jt(),o=Ie(n),i=s.isError||o.isError,d=s.data?.flatMap(a=>{if(a.visibility!=="public"||a.slug===t)return[];const l=(o.data??[]).filter(w=>!en(w)&&(w.organization_id===a.id||w.organization_slug===a.slug));if(!l.length)return[];const c=l.map(w=>w.name).sort((w,x)=>w.localeCompare(x)),u=c.slice(0,3);c.length>u.length&&u.push("more");const f=a.description?.trim()||`Includes ${new Intl.ListFormat("en",{style:"long",type:"conjunction"}).format(u)}.`;return[{...a,description:f}]});return!i&&!d?.length?null:e.jsxs("section",{"aria-label":"Public workspaces",className:"mt-6 space-y-3 pb-6",children:[e.jsxs("div",{className:"space-y-1 px-1",children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"Explore public workspaces"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse what others have shared. Open a workspace to look around."})]}),i?e.jsxs("div",{role:"alert",className:"px-1 text-sm text-muted-foreground",children:["Public workspaces could not be loaded."," ",e.jsx("button",{type:"button",onClick:()=>void Promise.all([s.refetch(),o.refetch()]),className:"rounded underline underline-offset-4 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Try again"})]}):e.jsx("ul",{className:"grid gap-x-6 sm:grid-cols-2",children:d?.map(a=>{const l=tn(a.slug);return e.jsx("li",{className:"min-w-0",children:e.jsxs("a",{href:l.kind==="cross-host"?l.href:l.to,className:"group flex min-h-16 items-center gap-3 rounded-lg px-3 py-3 transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-muted-foreground",children:a.logo?e.jsx("img",{src:a.logo,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):e.jsx(nn,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-sm font-medium",children:a.name}),e.jsx("span",{className:"mt-0.5 block text-xs leading-5 text-muted-foreground",children:a.description})]}),e.jsx(te,{className:"h-4 w-4 shrink-0 text-muted-foreground group-hover:text-foreground","aria-hidden":"true"})]})},a.id)})})]})}const _s={automation:tt,connection:Te,agent:yn,"entity-type":Me},Rs={automation:{to:"/$owner",search:{section:"automation"}},connection:{to:"/$owner/connectors",search:{}},agent:{to:"/$owner",search:{section:"agent"}},"entity-type":{to:"/$owner",search:{section:"entity-type"}}},Ne={automation:{text:"No Automations yet.",action:{to:"/$owner/automations/new",label:"Start with a template"}},connection:{text:"No connections yet.",action:{to:"/$owner/connectors/create",label:"Connect a source"}},agent:{text:"No agents connected yet.",action:{to:"/$owner/agents/connect",label:"Connect an agent"}},"entity-type":{text:"No entity types yet.",action:{to:"/$owner/entity-types/new",label:"Create one"}}};function lt({owner:t,organizationId:n,section:s,layout:o}){const{isMember:i,isPublic:d,isLoading:a}=Se(t),l=d&&!i&&!a,[c,u]=h.useState(""),f=sn({slug:t}),w=k=>k.flatMap(z=>z.href?[z]:w(z.children)),x=(f.data??[]).flatMap(k=>w(k.items)),g=Le(l?null:t),L=re(g.attentionCards).length,r=st(n??void 0,void 0,{includeDetails:!1}),b=qe(n),v=Ze(n),{data:p=[],isLoading:N}=Je(n),j=Cs(t,{organizationId:n,enabled:!l}),S=Qn(null,{enabled:!l}),{visible:I,isTypesLoading:P}=an(t),D=h.useMemo(()=>on({owner:t,automations:r.data??[],connections:b.data??[],feeds:v.data??[],connectors:new Map(p.map(k=>[k.key,k])),recentItems:j.items,roster:j.agents,clientGroups:Zn(S.data??[]).filter(k=>k.connected),entityTypes:I,attention:re(g.attentionCards),now:Date.now()}),[t,r.data,b.data,v.data,p,j.items,j.agents,S.data,I,g.attentionCards]),M=c.trim().toLowerCase(),F=M.length>0,_=x.filter(k=>!M||k.label.toLowerCase().includes(M)),G=h.useMemo(()=>rn(D.filter(k=>!M||k.name.toLowerCase().includes(M)),{filtering:F,expanded:s!=null,kinds:s?[s]:l?["automation","connection","entity-type"]:["automation","connection","agent","entity-type"]}),[D,M,F,l,s]),R=ln(l?null:n,cn()),C={automation:r.isLoading,connection:b.isLoading||v.isLoading||N,agent:!l&&(j.isLoading||S.isLoading),"entity-type":P},K=n==null||r.isLoading||b.isLoading||!l&&(j.isLoading||g.isLoading),O=f.isError||r.isError||b.isError||v.isError||j.isError||g.isError,B=G.every(k=>k.count===0)&&R.length===0,se=`lobu:start-dismissed:${t}`,[ue,me]=h.useState(()=>{try{return window.localStorage.getItem(se)==="1"}catch{return!1}}),V=()=>{me(!0);try{window.localStorage.setItem(se,"1")}catch{}},U=D.some(k=>k.kind!=="entity-type"),X=o==="table",J=X&&i&&!K&&!F&&!l&&!ue&&!U&&x.length===0&&!f.isLoading&&R.length===0,he=X&&!s&&!F&&x.length>0,ge=X&&!s&&_.length>0,ae=D.filter(k=>k.problem).length,oe=e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Home"}),q=k=>e.jsx($s,{title:oe,owner:t,organizationId:n,layout:o,layerToggles:k,query:c,onQueryChange:u,canAdd:i&&!l});return e.jsxs("section",{"aria-label":"Home",className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[X?J?oe:q(null):null,X?e.jsxs(e.Fragment,{children:[O&&!J?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Some of Home could not be loaded. Refresh to try again."}):null,ge?e.jsxs(e.Fragment,{children:[!l&&L>0?e.jsxs(H,{to:"/$owner/events",params:{owner:t},className:"flex min-h-11 items-center justify-between gap-3 rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsxs("span",{children:[L," ",L===1?"item needs":"items need"," your attention"]}),e.jsx(te,{"aria-hidden":!0,className:"size-4 shrink-0"})]}):null,e.jsxs("nav",{"aria-label":"Workspace destinations",className:"pb-4",children:[e.jsx("h2",{className:"mb-2 text-sm font-medium text-muted-foreground",children:"Open your workspace"}),e.jsx("ul",{className:"grid gap-x-6 sm:grid-cols-2",children:_.map(k=>{const z=dn(k);return e.jsx("li",{className:"min-w-0 border-b border-border/60",children:e.jsxs(un,{item:k,active:!1,className:"group flex min-h-16 min-w-0 items-center gap-3 rounded-md px-2 py-3 hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx(z,{"aria-hidden":!0,className:"size-5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"min-w-0 flex-1 break-words text-base font-medium",children:k.label}),e.jsx(te,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"})]})},k.id)})})]})]}):null,e.jsx(As,{pending:f.isLoading,fold:he,problems:ae,children:K&&B?e.jsx(ct,{}):B&&F?_.length?null:e.jsx(Ee,{icon:mn,title:"Nothing matches",description:"Nothing on Home matches this filter."}):J?e.jsx(Es,{owner:t,onSkip:V}):e.jsxs(e.Fragment,{children:[R.length>0?e.jsx("section",{"aria-label":"This page",className:"space-y-1",children:e.jsx(Be,{organizationId:n,feeds:R})}):null,G.map(k=>C[k.kind]?e.jsx(Os,{label:k.label},k.kind):e.jsx(Hs,{owner:t,organizationId:n,section:k,allRows:s===k.kind,connectorDefinitions:p},k.kind))]})}),!F&&!s&&!K&&!O&&B&&x.length===0&&!S.isError?e.jsx(Is,{owner:t}):null]}):e.jsx(ws,{ownerSlug:t,renderToolbar:q})]})}function As({pending:t,fold:n,problems:s,children:o}){const[i,d]=h.useState(!1);return t?e.jsx(ct,{}):n?e.jsxs("details",{open:i,onToggle:a=>d(a.currentTarget.open),className:"border-t border-border pt-3",children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-muted-foreground",children:["Workspace status and setup",s>0?e.jsxs("span",{className:"ml-2 text-destructive",children:[s," ",s===1?"issue":"issues"," to review"]}):null]}),i?e.jsx("div",{className:"space-y-4 pt-4",children:o}):null]}):o}function $s({title:t,owner:n,organizationId:s,layout:o,layerToggles:i,query:d,onQueryChange:a,canAdd:l}){const c=[{key:"table",label:"Table",Icon:xn,search:{}},{key:"graph",label:"Graph",Icon:fn,search:{layout:"graph"}}];return e.jsxs("header",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[t,e.jsxs("nav",{"aria-label":"Home views",className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2",children:[e.jsx("fieldset",{className:"flex items-center rounded-md border p-0.5","aria-label":"Home layout",children:c.map(({key:u,label:f,Icon:w,search:x})=>{const g=o===u;return e.jsx(Q,{asChild:!0,variant:"ghost",size:"sm",className:$("h-7 px-2",g&&"bg-accent text-accent-foreground"),children:e.jsx(H,{to:"/$owner",params:{owner:n},search:x,replace:!0,"aria-label":f,"aria-current":g?"page":void 0,title:f,children:e.jsx(w,{className:"h-4 w-4"})})},u)})}),i,e.jsxs("div",{className:"ml-auto flex min-w-0 flex-1 items-center justify-end gap-2",children:[o==="table"?e.jsxs("div",{className:"relative min-w-40 max-w-64 flex-1",children:[e.jsx(pn,{"aria-hidden":"true",className:"absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Ve,{type:"search","aria-label":"Filter list",placeholder:"Filter…",maxLength:512,value:d,onChange:u=>a(u.target.value),className:"pl-9"})]}):null,l?e.jsx(Ps,{owner:n,organizationId:s}):null]})]})]})}function Ps({owner:t,organizationId:n}){const{isAdmin:s}=Qe(n??void 0),o=[{to:"/$owner/automations/new",label:"Automation",Icon:tt},{to:"/$owner/connectors/create",label:"Connection",Icon:Te},{to:"/$owner/agents/new",label:"Agent",Icon:En},...s?[{to:"/$owner/entity-types/new",label:"Entity type",Icon:Me}]:[]];return e.jsxs(wn,{children:[e.jsx(kn,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx(Cn,{className:"mr-1.5 h-4 w-4"}),"Add",e.jsx(Sn,{className:"ml-1 h-3.5 w-3.5"})]})}),e.jsx(Ln,{align:"end",className:"w-44",children:o.map(({to:i,label:d,Icon:a})=>e.jsx(Mn,{asChild:!0,children:e.jsxs(H,{to:i,params:{owner:t},children:[e.jsx(a,{}),d]})},i))})]})}function ct(){return e.jsx("div",{role:"status","aria-label":"Loading Home",children:[0,1,2].map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"px-1 pt-4 pb-1.5",children:e.jsx(W,{className:"h-4 w-24"})}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2].map(n=>e.jsx(at,{},n))})]},t))})}function Os({label:t}){return e.jsxs("section",{"aria-label":t,className:"min-w-0",children:[e.jsx("div",{className:"px-1 pt-4 pb-1.5",children:e.jsx("h2",{className:"text-sm font-semibold",children:t})}),e.jsx("div",{role:"status","aria-label":`Loading ${t}`,className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2].map(n=>e.jsx(at,{},n))})]})}function Hs({owner:t,organizationId:n,section:s,allRows:o,connectorDefinitions:i}){const d=Rs[s.kind];return e.jsxs("section",{"aria-label":s.label,className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 px-1 pt-4 pb-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold",children:o?e.jsxs(e.Fragment,{children:[s.label,e.jsx("span",{className:"ml-1.5 font-normal text-muted-foreground tabular-nums",children:s.count})]}):e.jsx(H,{to:d.to,params:{owner:t},search:d.search,className:"underline-offset-4 hover:underline",children:s.label})}),o?e.jsxs(H,{to:"/$owner",params:{owner:t},search:{},className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(hn,{"aria-hidden":"true",className:"h-3 w-3"}),"All sections"]}):s.count>s.rows.length?e.jsxs(H,{to:d.to,params:{owner:t},search:d.search,className:"text-xs text-muted-foreground hover:text-foreground",children:["See all ",s.count," →"]}):null]}),s.count===0?e.jsxs("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:[Ne[s.kind].text," ",e.jsxs(H,{to:Ne[s.kind].action.to,params:{owner:t},className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground",children:[Ne[s.kind].action.label," →"]})]}):null,e.jsx("ul",{className:$("overflow-hidden rounded-lg border",s.rows.length===0&&"hidden"),children:s.rows.map(a=>e.jsxs("li",{className:$("flex min-w-0 items-center border-b last:border-b-0",gn),children:[e.jsx(Ws,{owner:t,organizationId:n,source:a,connectorDefinitions:i}),a.attention.length>0?e.jsx(Ds,{owner:t,source:a}):null]},a.key))})]})}function Ws({owner:t,organizationId:n,source:s,connectorDefinitions:o}){const i=_s[s.kind];return e.jsx(Fs,{owner:t,organizationId:n,source:s,className:$(vn,"min-w-0 flex-1"),children:e.jsx(bn,{mark:s.kind==="entity-type"?e.jsx(et,{icon:s.icon??null,className:"h-4 w-4 text-muted-foreground"}):e.jsx(jn,{source:s.mark,connectorDefinitions:o,label:s.name,fallback:e.jsx(i,{className:"h-4 w-4 text-muted-foreground"})}),name:s.name,tone:s.attention.length>0?"amber":s.problem?"destructive":null,details:s.status,at:s.at})})}function Ds({owner:t,source:n}){const s=n.attention.length,o=nt(Nn(t,n));return e.jsxs(H,{to:o.pathname,search:o.search,className:"mr-3 shrink-0 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-700 transition-colors hover:bg-amber-500/20 dark:text-amber-400",children:[s," need",s===1?"s":""," you"]})}function Fs({owner:t,organizationId:n,source:s,className:o,children:i}){const d=Xe(),{open:a}=s,l=nt(a.href),c=u=>{if(!(!d||a.kind==="entity-type"||u.metaKey||u.ctrlKey||u.shiftKey||u.altKey||u.button!==0)&&!(a.kind==="connection"&&!n)){if(u.preventDefault(),a.kind==="automation"||a.kind==="agent"){d.open({href:a.href,title:s.name,owner:t});return}d.open({href:a.href,title:s.name,key:s.key,connectorPanel:{section:"data",connectorKey:a.connectorKey,connectionId:a.connectionId,organizationId:n,ownerSlug:t}})}};return e.jsx(H,{to:l.pathname,search:l.search,className:o,onClick:c,children:i})}function Gs(t){return t.section||t.layout==="graph"?e.jsx(lt,{...t}):e.jsx(Ks,{...t})}function Ks(t){const{owner:n}=t,s=Ue(),o=Se(n),i=Tn({slug:n}),d=Le(o.isMember?n:null),a=re(d.attentionCards).length,l=In(i.data??[]);return i.data===void 0?i.isError?e.jsx($e,{error:i.error,onRetry:()=>void i.refetch()}):e.jsxs("div",{role:"status","aria-label":"Loading Home",className:"space-y-4",children:[e.jsx(W,{className:"h-8 w-24"}),e.jsx(W,{className:"h-64 w-full"})]}):l.length===0&&!i.isError?e.jsx(lt,{...t}):e.jsxs("section",{"aria-label":"Home",className:"flex min-w-0 flex-col gap-4",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Home"}),i.isError?e.jsx($e,{error:i.error,onRetry:()=>void i.refetch()}):null,a>0&&o.isMember?e.jsxs(H,{to:"/$owner/events",params:{owner:n},className:"flex min-h-11 items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsxs("span",{children:[a," ",a===1?"item needs":"items need"," your attention"]}),e.jsx(te,{"aria-hidden":!0,className:"size-4 shrink-0"})]}):null,e.jsx("div",{className:"grid min-w-0 gap-4 lg:grid-cols-2",children:l.map(c=>{const u=`/${n}/data${_n(c.key)}`;return e.jsx(Wn,{view:c,orgSlug:n,scope:{},open:()=>void s({href:u})},c.key)})})]})}function sa({owner:t,search:n,entityScope:s,home:o=!1}){const i=typeof n.type=="string"&&n.type.trim()?we(n.type.trim()):void 0,d=n.section==="automation"||n.section==="agent"||n.section==="entity-type"?n.section:void 0,a=n.layout==="graph"?"graph":"table",l=Object.entries(n).some(([u,f])=>(Rn.includes(u)||u.startsWith("clf_"))&&f!=null&&f!==""),c=o&&!l&&!i&&!s;return e.jsxs(An,{className:"gap-6 pt-2.5 pb-8",children:[e.jsx(Jn,{}),e.jsx($n,{owner:t,children:u=>e.jsx(Dn,{organizationId:u.organizationId,isWorkspaceLoading:u.isWorkspaceLoading,children:e.jsx(Pn,{wide:o,className:$("flex min-h-0 min-w-0 flex-1 flex-col",c&&a==="graph"&&"max-w-none"),children:c?e.jsx(Gs,{owner:u.ownerSlug,organizationId:u.organizationId,section:d,layout:a}):e.jsx(es,{organizationId:u.organizationId,ownerSlug:u.ownerSlug,typeScope:i,entityScope:s})})})})]})}export{sa as A};
2
+ //# sourceMappingURL=activity-route-view-msesKUwn.js.map
@@ -1,4 +1,4 @@
1
- import{j as t,L as h,eI as f,a4 as R,at as C,au as A,dr as M,bd as $,ds as O,dt as S,G as _,r as U,i8 as u,B as v,A as y}from"./index-DByaMzsG.js";import{C as E}from"./connector-page-shell-BFv21yuv.js";import{C as g}from"./copy-button-C3wMMv63.js";import{u as B}from"./clients-xnzZeEdZ.js";import{g as G,c as H}from"./client-rows-vrNA6FLs.js";const D="https://raw.githubusercontent.com/lobu-ai/lobu/main/claude-plugin/skills/lobu/SKILL.md";function d(e){try{const a=new URL(e).hostname;return a==="lobu.ai"||a.endsWith(".lobu.ai")}catch{return!1}}function x(e,a){const n=`npx @lobu/cli@latest connect ${e}`;return d(a)?n:`${n} --url ${a}`}function b(e,a){return`npx @lobu/cli@latest connect ${e} --url ${a}`}const N={label:"Lobu MCP reference",href:"https://lobu.ai/reference/mcp/"};function P(e){return[`Paste the prompt into ${e} and review its proposed setup.`,"Approve Lobu sign-in in your browser or through the email approval link.",`Let ${e} verify access with a harmless read in this workspace.`]}const L=[{id:"claude",label:"Claude",tagline:"Web, desktop, and coding agent for one workspace",description:"Claude web, desktop, and Code apps for this workspace.",installTitle:"Add in one click, or run in your terminal",installLink:e=>({label:"Add Lobu to Claude",href:`https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Lobu&connectorUrl=${encodeURIComponent(e)}`}),installText:e=>x("claude-code",e),promptUrl:e=>`https://claude.ai/new?q=${encodeURIComponent(e)}`,steps:e=>["Claude: open the Add to Claude link above and complete sign-in.",...d(e)?["The CLI adds Lobu's marketplace and installs the shared plugin."]:["The CLI registers this MCP endpoint and installs the Lobu workspace skill."],"Start a fresh Claude Code session, choose this workspace, and complete OAuth when prompted."],guideLinks:[{label:"Claude setup guide",href:"https://lobu.ai/connect-from/claude/"},{label:"Claude Code setup guide",href:"https://lobu.ai/connect-from/claude-code/"}]},{id:"chatgpt",label:"ChatGPT & Codex",tagline:"Web connector and coding agent for one workspace",description:"ChatGPT web connector and Codex coding agent for this workspace.",installTitle:"Pick a surface",installLink:e=>d(e)?{label:"Use Lobu in ChatGPT",href:"https://chatgpt.com/plugins/plugin_asdk_app_6a73b856e4348191a97dc8e3a1e58a94"}:null,promptUrl:e=>`https://chatgpt.com/?q=${encodeURIComponent(e)}`,installText:e=>d(e)?x("codex",e):["ChatGPT web — open Settings -> Connectors -> Create connector","Name: Lobu",`MCP URL: ${e}`,"Authentication: OAuth","",`Codex — ${x("codex",e)}`].join(`
1
+ import{j as t,L as h,eY as f,a4 as R,at as C,au as A,dt as M,bd as $,du as O,dv as S,G as _,r as U,i5 as u,B as v,A as y}from"./index-BoqrvLHQ.js";import{C as E}from"./connector-page-shell-an3SYLim.js";import{C as g}from"./copy-button-Xhh7ZnjO.js";import{u as B}from"./clients-Bf7ZgGro.js";import{g as G,c as H}from"./client-rows-Dd5YV8vn.js";const D="https://raw.githubusercontent.com/lobu-ai/lobu/main/claude-plugin/skills/lobu/SKILL.md";function d(e){try{const a=new URL(e).hostname;return a==="lobu.ai"||a.endsWith(".lobu.ai")}catch{return!1}}function x(e,a){const n=`npx @lobu/cli@latest connect ${e}`;return d(a)?n:`${n} --url ${a}`}function b(e,a){return`npx @lobu/cli@latest connect ${e} --url ${a}`}const N={label:"Lobu MCP reference",href:"https://lobu.ai/reference/mcp/"};function P(e){return[`Paste the prompt into ${e} and review its proposed setup.`,"Approve Lobu sign-in in your browser or through the email approval link.",`Let ${e} verify access with a harmless read in this workspace.`]}const L=[{id:"claude",label:"Claude",tagline:"Web, desktop, and coding agent for one workspace",description:"Claude web, desktop, and Code apps for this workspace.",installTitle:"Add in one click, or run in your terminal",installLink:e=>({label:"Add Lobu to Claude",href:`https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Lobu&connectorUrl=${encodeURIComponent(e)}`}),installText:e=>x("claude-code",e),promptUrl:e=>`https://claude.ai/new?q=${encodeURIComponent(e)}`,steps:e=>["Claude: open the Add to Claude link above and complete sign-in.",...d(e)?["The CLI adds Lobu's marketplace and installs the shared plugin."]:["The CLI registers this MCP endpoint and installs the Lobu workspace skill."],"Start a fresh Claude Code session, choose this workspace, and complete OAuth when prompted."],guideLinks:[{label:"Claude setup guide",href:"https://lobu.ai/connect-from/claude/"},{label:"Claude Code setup guide",href:"https://lobu.ai/connect-from/claude-code/"}]},{id:"chatgpt",label:"ChatGPT & Codex",tagline:"Web connector and coding agent for one workspace",description:"ChatGPT web connector and Codex coding agent for this workspace.",installTitle:"Pick a surface",installLink:e=>d(e)?{label:"Use Lobu in ChatGPT",href:"https://chatgpt.com/plugins/plugin_asdk_app_6a73b856e4348191a97dc8e3a1e58a94"}:null,promptUrl:e=>`https://chatgpt.com/?q=${encodeURIComponent(e)}`,installText:e=>d(e)?x("codex",e):["ChatGPT web — open Settings -> Connectors -> Create connector","Name: Lobu",`MCP URL: ${e}`,"Authentication: OAuth","",`Codex — ${x("codex",e)}`].join(`
2
2
  `),steps:e=>d(e)?["ChatGPT web: open the Lobu listing above and complete sign-in.","Codex: run the command above — the CLI adds Lobu's marketplace and installs the shared plugin.","Codex: start a fresh session, choose this workspace, and complete OAuth when prompted."]:["Codex: run the command above — the CLI registers this MCP endpoint and installs the Lobu workspace skill.","Codex: start a fresh session, choose this workspace, and complete OAuth when prompted."],guideLinks:[{label:"ChatGPT setup guide",href:"https://lobu.ai/connect-from/chatgpt/"},{label:"Codex setup guide",href:"https://lobu.ai/connect-from/codex/"}]},{id:"opencode",label:"OpenCode",tagline:"Native remote MCP plus a global Lobu skill",description:"Connect OpenCode through its native MCP setup and install the Lobu workspace skill globally.",installTitle:"Run in your terminal",installText:e=>b("opencode",e),steps:e=>[`The CLI launches OpenCode's native MCP setup for ${e}.`,"Choose remote and name the server lobu.","Run opencode mcp auth lobu and complete OAuth.","The CLI installs the Lobu skill into OpenCode's global skill directory.","Start a fresh OpenCode session."],guideLinks:[{label:"OpenCode MCP guide",href:"https://opencode.ai/docs/mcp-servers/"}]},{id:"antigravity",label:"Antigravity CLI",tagline:"Native remote MCP plus a global Lobu skill",description:"Connect Antigravity CLI through its native MCP profile and install the Lobu workspace skill globally.",installTitle:"Run in your terminal",installText:e=>b("antigravity",e),steps:()=>["The CLI adds Lobu to Antigravity's global MCP profile using serverUrl.","The CLI installs lobu.md into Antigravity CLI's global skills directory.","Start a fresh session with agy, confirm Lobu in /mcp, and complete OAuth when prompted."],guideLinks:[{label:"Antigravity MCP guide",href:"https://antigravity.google/docs/mcp"}]},{id:"cursor",label:"Cursor",tagline:"Native remote MCP setup",description:"Connect Cursor to shared workspace context and governed actions through its native MCP configuration.",installTitle:"Run in your terminal",installText:e=>b("cursor",e),steps:()=>["The CLI adds or updates the Lobu entry in Cursor's MCP configuration.","Restart Cursor and enable the Lobu MCP server.","Use a Lobu tool and complete OAuth when prompted."],guideLinks:[N]},{id:"openclaw",label:"OpenClaw",tagline:"Connect from your agent's workspace",description:"Let OpenClaw connect to Lobu through MCP or sign in with the Lobu CLI in its terminal.",installTitle:"Paste this into OpenClaw",setupMode:"agent-prompt",terminalLogin:!0,steps:()=>P("OpenClaw"),guideLinks:[{label:"OpenClaw terminal guide",href:"https://docs.openclaw.ai/tools/exec"}]},{id:"hermes",label:"Hermes",tagline:"Remote MCP or Lobu CLI sign-in",description:"Let Hermes configure Lobu with its MCP tools or sign in with the Lobu CLI in its terminal.",installTitle:"Paste this into Hermes",setupMode:"agent-prompt",terminalLogin:!0,steps:()=>P("Hermes"),guideLinks:[{label:"Hermes MCP guide",href:"https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp/"}]},{id:"other",label:"Not listed here",tagline:"Let your agent configure Lobu",description:"Paste a setup prompt into another MCP-compatible agent and let it propose the exact skill and MCP configuration.",installTitle:"Paste this into your agent",setupMode:"agent-prompt",steps:()=>["Paste the prompt into the agent you want to connect.","Review the exact configuration and skill files it proposes before approving changes.","Complete Lobu OAuth and let the agent perform its read-only verification."],guideLinks:[N]}],I=["Connect my Gmail to Lobu.","Create a Lobu automation that sends me a morning briefing.","In Lobu, design a data model with entities and relationships for tracking deals.","Remember in Lobu that I prefer short answers that lead with the key point."],F={codex:"chatgpt","claude-code":"claude","claude-desktop":"claude"};function K(e){const a=F[e]??e;return L.find(n=>n.id===a)}function W(e){const{workspaceName:a,owner:n,mcpUrl:o,clientLabel:r}=e;return[`Connect this${r?` ${r}`:""} agent to the "${a}" Lobu workspace (${n}).`,"",`Use the remote HTTP MCP server ${o}. Detect this agent's native MCP and skill mechanisms. If it supports installable skills, install the Lobu workspace skill from ${D}.`,"Inspect the current client and show the exact proposed installation or configuration changes before applying them. The Lobu CLI may be used as the setup helper, but do not initialize a Lobu project. Do not install the separate project-building starter skill. Do not enable local Automation delivery.",...e.terminalLogin?[`If native remote MCP with OAuth is unavailable, use the Lobu CLI in this agent's persistent terminal environment. Before logging in, inspect CLI help and existing contexts to select the same Lobu server and workspace as the MCP URL above; never silently use the hosted server for a custom endpoint. If no context matches that server, create one with npx @lobu/cli@latest context add <name> --url <server-base-url>. Ask for the user's Lobu email address, then run npx @lobu/cli@latest login --email <address> --context <name> and wait for the user to approve the email link. Keep credentials in the CLI's own persistent storage; never print tokens or paste them into chat. Run npx @lobu/cli@latest memory health --context <name> --org ${n}, then make a harmless read using the CLI with the same --context and --org options.`]:[],"","For native MCP, complete Lobu OAuth in the user's browser, then start a fresh session and confirm Lobu tools are discoverable. After either setup path, make one harmless read-only call in the selected workspace. Use search_sdk before choosing SDK methods. Never fabricate a returned URL or identifier."].join(`
3
- `)}function q(e,a){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${e===a-1?"":"border-b"}`}function z({owner:e,dashed:a=!1}){return t.jsx("div",{className:`overflow-hidden rounded-lg border ${a?"border-dashed":""}`,children:L.map((n,o)=>t.jsxs(h,{to:"/$owner/agents/connect/$clientId",params:{owner:e,clientId:n.id},className:q(o,L.length),children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground",children:t.jsx(f,{name:n.label})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:n.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.tagline})]}),t.jsx("span",{className:"shrink-0 text-xs",children:"Set up"})]},n.id))})}const J="app.lobu.ai";function Q(e,a){const n=a?`/mcp/${a}`:"/mcp";if(!e)return`http://localhost:8787${n}`;try{const o=new URL(e);return o.hostname===J&&(o.hostname="lobu.ai"),o.pathname=n,o.toString()}catch{return`${e}${n}`}}function V(e){return Q(R,e)}const w="gap-3 pt-2.5 pb-8";function X(e,a){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${e===a-1?"":"border-b"}`}function T({owner:e}){return t.jsx(O,{crumbs:[t.jsx(h,{to:"/$owner",params:{owner:e},search:{section:"agent"},className:S,children:"Agents"},"agents")]})}function se({owner:e}){return t.jsx(C,{className:w,children:t.jsxs(A,{className:"flex flex-1 flex-col gap-6",children:[t.jsx(M,{breadcrumb:t.jsx(T,{owner:e}),icon:t.jsx($.agents.icon,{className:"h-6 w-6"}),title:"Connect an agent",caption:"Choose the agent you already use. Install directly where supported, or copy a setup prompt into the agent."}),t.jsx(z,{owner:e})]})})}function ae({owner:e,clientId:a}){const n=K(a),{data:o}=_(e,{slug:e}),{data:r=[]}=B(null,{refetchInterval:2500}),i=U.useMemo(()=>G(r).filter(s=>s.connected),[r]);if(!n)return t.jsx(C,{className:w,children:t.jsxs(A,{className:"space-y-3",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no agent client by that name."}),t.jsx(h,{to:"/$owner/agents/connect",params:{owner:e},className:"text-sm text-primary hover:underline",children:"Back to agent clients"})]})});const l=V(e),p=W({workspaceName:o?.workspace?.name??e,owner:e,mcpUrl:l,clientLabel:n.id==="other"?void 0:n.label,terminalLogin:n.terminalLogin}),m=n.setupMode==="agent-prompt",k=m?p:n.installText?.(l)??p;return t.jsx(C,{className:w,children:t.jsxs(E,{header:t.jsx(M,{breadcrumb:t.jsx(T,{owner:e}),icon:t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:t.jsx(f,{name:n.label})}),title:n.label,caption:n.description}),children:[t.jsx(u,{title:"Set up",children:t.jsxs("div",{className:"space-y-4",children:[(()=>{const s=n.installLink?.(l);return s?t.jsx("div",{children:t.jsx(v,{asChild:!0,children:t.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",children:[s.label,t.jsx(y,{className:"ml-1.5 h-3.5 w-3.5"})]})})}):null})(),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:n.installTitle}),t.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[t.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap font-mono text-xs leading-relaxed",children:k}),t.jsx(g,{text:k,label:m?"Copy setup prompt":"Copy"})]})]}),t.jsx("ol",{className:"space-y-1 text-xs text-muted-foreground",children:n.steps(l).map((s,c)=>t.jsxs("li",{children:[c+1,". ",s]},s))}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[m?null:t.jsx(g,{text:p,label:"Copy setup prompt"}),n.guideLinks.map(s=>t.jsx(v,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 text-xs",children:t.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",children:[s.label,t.jsx(y,{className:"ml-1.5 h-3.5 w-3.5"})]})},s.href))]})]})}),t.jsx(u,{title:"First prompts",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"After setup, start a new chat with Lobu enabled and try one of these."}),t.jsx("div",{className:"overflow-hidden rounded-lg border",children:I.map((s,c)=>{const j=n.promptUrl?.(s);return t.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 ${c===I.length-1?"":"border-b"}`,children:[j?t.jsx("a",{href:j,target:"_blank",rel:"noreferrer",className:"min-w-0 flex-1 text-sm hover:underline",children:s}):t.jsx("p",{className:"min-w-0 flex-1 text-sm",children:s}),t.jsx(g,{text:s,label:"prompt",iconOnly:!0})]},s)})})]})}),t.jsx(u,{title:"Connected agents",count:i.length>0?String(i.length):void 0,children:i.length===0?t.jsx("div",{className:"rounded-lg border border-dashed px-3 py-2.5 text-xs text-muted-foreground",children:"Nothing yet. Finish setup and make an authenticated Lobu MCP request; the agent appears here automatically."}):t.jsx("div",{className:"overflow-hidden rounded-lg border",children:i.map((s,c)=>t.jsxs(h,{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:s.clientId},className:X(c,i.length),children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:t.jsx(f,{name:s.title})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:H(s)})]})]},s.key))})}),t.jsx(u,{title:"Manual MCP details",children:t.jsxs("dl",{className:"grid grid-cols-[5rem_1fr] gap-x-3 gap-y-1 rounded-lg border bg-muted/40 p-3 text-xs",children:[t.jsx("dt",{className:"text-muted-foreground",children:"Name"}),t.jsx("dd",{className:"font-mono",children:"lobu"}),t.jsx("dt",{className:"text-muted-foreground",children:"MCP URL"}),t.jsx("dd",{className:"break-all font-mono",children:l})]})})]})})}export{se as A,ae as a};
4
- //# sourceMappingURL=agent-connect-pages-DoI9UR0a.js.map
3
+ `)}function q(e,a){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${e===a-1?"":"border-b"}`}function z({owner:e,dashed:a=!1}){return t.jsx("div",{className:`overflow-hidden rounded-lg border ${a?"border-dashed":""}`,children:L.map((n,o)=>t.jsxs(h,{to:"/$owner/agents/connect/$clientId",params:{owner:e,clientId:n.id},className:q(o,L.length),children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground",children:t.jsx(f,{name:n.label})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:n.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.tagline})]}),t.jsx("span",{className:"shrink-0 text-xs",children:"Set up"})]},n.id))})}const Y="app.lobu.ai";function J(e,a){const n=a?`/mcp/${a}`:"/mcp";if(!e)return`http://localhost:8787${n}`;try{const o=new URL(e);return o.hostname===Y&&(o.hostname="lobu.ai"),o.pathname=n,o.toString()}catch{return`${e}${n}`}}function Q(e){return J(R,e)}const w="gap-3 pt-2.5 pb-8";function V(e,a){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${e===a-1?"":"border-b"}`}function T({owner:e}){return t.jsx(O,{crumbs:[t.jsx(h,{to:"/$owner",params:{owner:e},search:{section:"agent"},className:S,children:"Agents"},"agents")]})}function se({owner:e}){return t.jsx(C,{className:w,children:t.jsxs(A,{className:"flex flex-1 flex-col gap-6",children:[t.jsx(M,{breadcrumb:t.jsx(T,{owner:e}),icon:t.jsx($.agents.icon,{className:"h-6 w-6"}),title:"Connect an agent",caption:"Choose the agent you already use. Install directly where supported, or copy a setup prompt into the agent."}),t.jsx(z,{owner:e})]})})}function ae({owner:e,clientId:a}){const n=K(a),{data:o}=_(e,{slug:e}),{data:r=[]}=B(null,{refetchInterval:2500}),i=U.useMemo(()=>G(r).filter(s=>s.connected),[r]);if(!n)return t.jsx(C,{className:w,children:t.jsxs(A,{className:"space-y-3",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no agent client by that name."}),t.jsx(h,{to:"/$owner/agents/connect",params:{owner:e},className:"text-sm text-primary hover:underline",children:"Back to agent clients"})]})});const l=Q(e),p=W({workspaceName:o?.workspace?.name??e,owner:e,mcpUrl:l,clientLabel:n.id==="other"?void 0:n.label,terminalLogin:n.terminalLogin}),m=n.setupMode==="agent-prompt",k=m?p:n.installText?.(l)??p;return t.jsx(C,{className:w,children:t.jsxs(E,{header:t.jsx(M,{breadcrumb:t.jsx(T,{owner:e}),icon:t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:t.jsx(f,{name:n.label})}),title:n.label,caption:n.description}),children:[t.jsx(u,{title:"Set up",children:t.jsxs("div",{className:"space-y-4",children:[(()=>{const s=n.installLink?.(l);return s?t.jsx("div",{children:t.jsx(v,{asChild:!0,children:t.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",children:[s.label,t.jsx(y,{className:"ml-1.5 h-3.5 w-3.5"})]})})}):null})(),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:n.installTitle}),t.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[t.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap font-mono text-xs leading-relaxed",children:k}),t.jsx(g,{text:k,label:m?"Copy setup prompt":"Copy"})]})]}),t.jsx("ol",{className:"space-y-1 text-xs text-muted-foreground",children:n.steps(l).map((s,c)=>t.jsxs("li",{children:[c+1,". ",s]},s))}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[m?null:t.jsx(g,{text:p,label:"Copy setup prompt"}),n.guideLinks.map(s=>t.jsx(v,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 text-xs",children:t.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",children:[s.label,t.jsx(y,{className:"ml-1.5 h-3.5 w-3.5"})]})},s.href))]})]})}),t.jsx(u,{title:"First prompts",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"After setup, start a new chat with Lobu enabled and try one of these."}),t.jsx("div",{className:"overflow-hidden rounded-lg border",children:I.map((s,c)=>{const j=n.promptUrl?.(s);return t.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 ${c===I.length-1?"":"border-b"}`,children:[j?t.jsx("a",{href:j,target:"_blank",rel:"noreferrer",className:"min-w-0 flex-1 text-sm hover:underline",children:s}):t.jsx("p",{className:"min-w-0 flex-1 text-sm",children:s}),t.jsx(g,{text:s,label:"prompt",iconOnly:!0})]},s)})})]})}),t.jsx(u,{title:"Connected agents",count:i.length>0?String(i.length):void 0,children:i.length===0?t.jsx("div",{className:"rounded-lg border border-dashed px-3 py-2.5 text-xs text-muted-foreground",children:"Nothing yet. Finish setup and make an authenticated Lobu MCP request; the agent appears here automatically."}):t.jsx("div",{className:"overflow-hidden rounded-lg border",children:i.map((s,c)=>t.jsxs(h,{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:s.clientId},className:V(c,i.length),children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:t.jsx(f,{name:s.title})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:H(s)})]})]},s.key))})}),t.jsx(u,{title:"Manual MCP details",children:t.jsxs("dl",{className:"grid grid-cols-[5rem_1fr] gap-x-3 gap-y-1 rounded-lg border bg-muted/40 p-3 text-xs",children:[t.jsx("dt",{className:"text-muted-foreground",children:"Name"}),t.jsx("dd",{className:"font-mono",children:"lobu"}),t.jsx("dt",{className:"text-muted-foreground",children:"MCP URL"}),t.jsx("dd",{className:"break-all font-mono",children:l})]})})]})})}export{se as A,ae as a};
4
+ //# sourceMappingURL=agent-connect-pages-DVq9nAR7.js.map
@@ -1,2 +1,2 @@
1
- import{aW as ne,aX as ae,j as e,B as S,fz as re,fL as ie,c9 as oe,i as le,gO as de,aO as z,a9 as B,dg as ce,i4 as me,i5 as ue,i6 as ge,hd as fe,i7 as xe,c3 as pe,aY as he,r as be,by as k,dv as U,eC as ve,c8 as je,bR as ye,i8 as V}from"./index-DByaMzsG.js";import{D as Ne,A as we,e as Ce}from"./definition-comparison-4UYMI6BK.js";import{b as Ae,s as Se}from"./model-selector-D3vSMLO2.js";function Me(s){const t=s.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return(t?/^[a-z]/.test(t)&&t.length>=3?t:`agent-${t}`:"agent").slice(0,60).replace(/-+$/g,"")||"agent"}function Ie(s,t){const r=new Set(t),x=Me(s);let f=x,d=2;for(;r.has(f);){const g=`-${d}`;f=`${x.slice(0,Math.max(1,60-g.length)).replace(/-+$/g,"")||"agent"}${g}`,d+=1}return f}const Pe="__unresolved__";function W(s){return s.endsWith(`/${Pe}`)}function G(s){const t=s.indexOf("/");return t===-1?{slug:s,model:""}:{slug:s.slice(0,t),model:s.slice(t+1)}}function Fe(s,t){const{slug:r,model:x}=G(s);return{provider:t.find(g=>g.value===s)?.provider??t.find(g=>G(g.value).slug===r)?.provider??r,model:x}}function ke({value:s,onChange:t,disabled:r}){const{data:x=[]}=ne(),{data:f=[]}=ae(),d=Ae(x,f),g=(n,l)=>{const i=n+l;if(i<0||i>=s.length)return;const u=[...s];[u[n],u[i]]=[u[i],u[n]],t(u)},b=n=>{t(s.filter((l,i)=>i!==n))},c=n=>{s.includes(n)||t([...s,n])},m=d.filter(n=>!s.includes(n.value)&&!W(n.value));return e.jsxs("div",{className:"grid gap-2",children:[s.length===0?e.jsx("p",{className:"rounded-lg border border-dashed bg-muted/20 px-3 py-4 text-center text-[11px] text-muted-foreground",children:"No models pinned — this agent uses the org default."}):e.jsx("ul",{className:"grid gap-1.5",children:s.map((n,l)=>{const i=W(n),{provider:u,model:a}=Fe(n,d);return e.jsxs("li",{className:le("flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2",i&&"opacity-60"),children:[e.jsxs("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm",children:u}),l===0?e.jsx("span",{className:"shrink-0 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"Default"}):null]}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:i?"no model selected":a})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move up",disabled:r||l===0,onClick:()=>g(l,-1),children:e.jsx(re,{className:"h-4 w-4"})}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move down",disabled:r||l===s.length-1,onClick:()=>g(l,1),children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive","aria-label":"Remove model",disabled:r,onClick:()=>b(l),children:e.jsx(oe,{className:"h-4 w-4"})})]})]},n)})}),e.jsx(de,{contentClassName:"w-[--radix-popover-trigger-width] min-w-[280px]",searchPlaceholder:"Search or type a model ref…",emptyText:"Type a full provider/model ref to use it.",trigger:n=>e.jsxs(S,{type:"button",variant:"outline",role:"combobox","aria-expanded":n,disabled:r,className:"w-full justify-start font-normal text-muted-foreground",children:[e.jsx(ce,{className:"mr-2 h-4 w-4 shrink-0"}),"Add model"]}),children:(n,l)=>{const i=l.trim(),u=Se(i,d)&&!s.includes(i);return e.jsxs(e.Fragment,{children:[m.map(a=>e.jsxs(z,{value:`${a.provider} ${a.model} ${a.value}`,onSelect:()=>{c(a.value),n()},className:"cursor-pointer",children:[e.jsx(B,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{className:"truncate",children:[a.provider," ",e.jsx("span",{className:"text-muted-foreground text-xs",children:a.model}),a.isDefault?e.jsx("span",{className:"ml-1.5 text-muted-foreground text-xs",children:"· org default"}):null]})]},a.value)),u?e.jsxs(z,{value:`__custom__ ${i}`,onSelect:()=>{c(i),n()},className:"cursor-pointer",children:[e.jsx(B,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{children:["Use ",e.jsx("span",{className:"font-mono text-xs",children:i})]})]}):null]})}})]})}const Ee=3;function X(s){return Array.from({length:Ee},(t,r)=>s?.[r]??{title:"",message:""})}function Y(s){return s.map(({title:t,message:r})=>({title:t.trim(),message:r.trim()})).filter(({title:t,message:r})=>t&&r)}function q({settings:s,models:t}){return e.jsxs(e.Fragment,{children:[e.jsx(V,{id:"settings",title:"Settings",children:s}),e.jsx(V,{id:"models",title:"Models",children:t})]})}function $e({mode:s,existingAgentIds:t=[],onCreated:r,onCancel:x,onDone:f,reviewMode:d="none",reviewProposal:g=null,reviewControlsDisabled:b=!1}){const c=s.kind==="create",m=s.kind==="edit"?s.agent:null,n=!c&&!!m,l=me(),i=ue(m?.agentId??""),u=ge(m?.agentId??""),{data:a,isLoading:_}=fe(m?.agentId,{enabled:n}),$=!c&&d==="active",j=$?g:null,E=j?xe(j.proposal):void 0,v=a,H=m?.agentId??"create",o=pe(H,{name:E?.name??m?.name??"",description:E?.description??m?.description??"",identityMd:E?.identityMd??a?.identityMd??"",soulMd:a?.soulMd??"",userMd:a?.userMd??"",models:v?.models??v?.settings?.models??[],showToolCalls:v?.showToolCalls??v?.settings?.showToolCalls??!1,sandboxId:v?.sandboxId??v?.settings?.sandboxId??"builtin",starters:X(a?.starters)}),[h]=o.field("name"),[y]=o.field("description"),[M]=o.field("identityMd"),[I]=o.field("soulMd"),[P]=o.field("userMd"),[N,J]=o.field("models"),[F]=o.field("showToolCalls"),[w]=o.field("sandboxId"),[C]=o.field("starters"),{data:K}=he({enabled:!c}),Q=be.useCallback(async A=>{if(A.preventDefault(),!(b||d==="active"||d==="loading"||d==="error"||!o.canSubmit)){if(c){const p=await l.mutateAsync({agentId:Ie(h,t),name:h.trim(),description:y.trim()||void 0});r?await r(p.agentId):f?.();return}if(m){if(!a){k.error("Still loading agent settings — try again in a moment");return}if(C.some(({title:p,message:R})=>!!p.trim()!=!!R.trim())){k.error("Add both a title and a message for each conversation starter");return}try{await Promise.all([i.mutateAsync({name:h.trim()||m.name,description:y.trim()||void 0}),u.mutateAsync({identityMd:M.trim(),soulMd:I.trim(),userMd:P.trim(),models:N,authProfiles:a.authProfiles??[],skillsConfig:a.skillsConfig,showToolCalls:F,sandboxId:w==="builtin"?void 0:w,starters:Y(C)})]),o.accept(o.values,{name:h.trim()||m.name,description:y.trim()||m.description||"",identityMd:M.trim(),soulMd:I.trim(),userMd:P.trim(),models:N,showToolCalls:F,sandboxId:w,starters:X(Y(C))}),k.success("Agent saved"),f?.()}catch(p){k.error(p instanceof Error?p.message:"Failed to save agent")}}}},[a,l,y,o.accept,o.values,o.canSubmit,b,d,w,t,M,c,N,h,r,f,m,F,I,C,i,u,P]),D=l.isPending||i.isPending||u.isPending,Z=c||!!a;if(n&&_)return e.jsx(q,{settings:e.jsx(U,{rows:6}),models:e.jsx(U,{rows:2})});const T=D||b,ee=d==="none"||d==="gone",se=h.trim().length>0&&Z;if($&&j){const{current:A,proposed:p}=ve(j);return e.jsx(Ne,{current:A,proposed:p,render:R=>e.jsx(we,{value:R})},j.runId)}const L=A=>e.jsx(Ce,{value:{name:h,description:y,identityMd:M,soulMd:I,userMd:P,models:N,showToolCalls:F,sandboxId:w,starters:C},onChange:o.setValues,section:A,create:c,disabled:T,loading:_,sandboxes:K?.sandboxes,modelsEditor:e.jsx(ke,{value:N,onChange:J,disabled:T})}),O=L("settings"),te=L("models");return e.jsxs("form",{onSubmit:Q,className:c?"flex min-h-0 flex-col":"space-y-7",children:[e.jsx(je,{visible:o.hasConflict,onReload:o.reset}),c?O:e.jsx(q,{settings:O,models:te}),ee?e.jsx(ye,{className:c?"mt-6":void 0,onCancel:x,cancelDisabled:D,children:e.jsx(S,{type:"submit",disabled:!o.canSubmit||!se||D,children:c?l.isPending?"Creating...":"Create agent":i.isPending||u.isPending?"Saving...":"Save changes"})}):null]})}export{$e as A};
2
- //# sourceMappingURL=agent-editor-form-DlavYg2q.js.map
1
+ import{aW as ne,aX as ae,j as e,B as A,fP as re,fZ as ie,c9 as oe,i as le,gL as de,aO as z,a9 as B,dg as ce,i1 as me,i2 as ue,i3 as ge,ha as fe,i4 as xe,c3 as pe,aY as he,r as be,by as k,dx as U,eS as ve,c8 as je,bR as ye,i5 as V}from"./index-BoqrvLHQ.js";import{D as Ne,A as we,e as Ce}from"./definition-comparison-D_qP25jR.js";import{b as Se,s as Ae}from"./model-selector-D2OpDkwH.js";function Me(s){const t=s.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return(t?/^[a-z]/.test(t)&&t.length>=3?t:`agent-${t}`:"agent").slice(0,60).replace(/-+$/g,"")||"agent"}function Ie(s,t){const r=new Set(t),x=Me(s);let f=x,d=2;for(;r.has(f);){const g=`-${d}`;f=`${x.slice(0,Math.max(1,60-g.length)).replace(/-+$/g,"")||"agent"}${g}`,d+=1}return f}const Pe="__unresolved__";function W(s){return s.endsWith(`/${Pe}`)}function G(s){const t=s.indexOf("/");return t===-1?{slug:s,model:""}:{slug:s.slice(0,t),model:s.slice(t+1)}}function Fe(s,t){const{slug:r,model:x}=G(s);return{provider:t.find(g=>g.value===s)?.provider??t.find(g=>G(g.value).slug===r)?.provider??r,model:x}}function ke({value:s,onChange:t,disabled:r}){const{data:x=[]}=ne(),{data:f=[]}=ae(),d=Se(x,f),g=(n,l)=>{const i=n+l;if(i<0||i>=s.length)return;const u=[...s];[u[n],u[i]]=[u[i],u[n]],t(u)},b=n=>{t(s.filter((l,i)=>i!==n))},c=n=>{s.includes(n)||t([...s,n])},m=d.filter(n=>!s.includes(n.value)&&!W(n.value));return e.jsxs("div",{className:"grid gap-2",children:[s.length===0?e.jsx("p",{className:"rounded-lg border border-dashed bg-muted/20 px-3 py-4 text-center text-[11px] text-muted-foreground",children:"No models pinned — this agent uses the org default."}):e.jsx("ul",{className:"grid gap-1.5",children:s.map((n,l)=>{const i=W(n),{provider:u,model:a}=Fe(n,d);return e.jsxs("li",{className:le("flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2",i&&"opacity-60"),children:[e.jsxs("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm",children:u}),l===0?e.jsx("span",{className:"shrink-0 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"Default"}):null]}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:i?"no model selected":a})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(A,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move up",disabled:r||l===0,onClick:()=>g(l,-1),children:e.jsx(re,{className:"h-4 w-4"})}),e.jsx(A,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move down",disabled:r||l===s.length-1,onClick:()=>g(l,1),children:e.jsx(ie,{className:"h-4 w-4"})}),e.jsx(A,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive","aria-label":"Remove model",disabled:r,onClick:()=>b(l),children:e.jsx(oe,{className:"h-4 w-4"})})]})]},n)})}),e.jsx(de,{contentClassName:"w-[--radix-popover-trigger-width] min-w-[280px]",searchPlaceholder:"Search or type a model ref…",emptyText:"Type a full provider/model ref to use it.",trigger:n=>e.jsxs(A,{type:"button",variant:"outline",role:"combobox","aria-expanded":n,disabled:r,className:"w-full justify-start font-normal text-muted-foreground",children:[e.jsx(ce,{className:"mr-2 h-4 w-4 shrink-0"}),"Add model"]}),children:(n,l)=>{const i=l.trim(),u=Ae(i,d)&&!s.includes(i);return e.jsxs(e.Fragment,{children:[m.map(a=>e.jsxs(z,{value:`${a.provider} ${a.model} ${a.value}`,onSelect:()=>{c(a.value),n()},className:"cursor-pointer",children:[e.jsx(B,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{className:"truncate",children:[a.provider," ",e.jsx("span",{className:"text-muted-foreground text-xs",children:a.model}),a.isDefault?e.jsx("span",{className:"ml-1.5 text-muted-foreground text-xs",children:"· org default"}):null]})]},a.value)),u?e.jsxs(z,{value:`__custom__ ${i}`,onSelect:()=>{c(i),n()},className:"cursor-pointer",children:[e.jsx(B,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{children:["Use ",e.jsx("span",{className:"font-mono text-xs",children:i})]})]}):null]})}})]})}const Ee=3;function X(s){return Array.from({length:Ee},(t,r)=>s?.[r]??{title:"",message:""})}function Y(s){return s.map(({title:t,message:r})=>({title:t.trim(),message:r.trim()})).filter(({title:t,message:r})=>t&&r)}function Z({settings:s,models:t}){return e.jsxs(e.Fragment,{children:[e.jsx(V,{id:"settings",title:"Settings",children:s}),e.jsx(V,{id:"models",title:"Models",children:t})]})}function $e({mode:s,existingAgentIds:t=[],onCreated:r,onCancel:x,onDone:f,reviewMode:d="none",reviewProposal:g=null,reviewControlsDisabled:b=!1}){const c=s.kind==="create",m=s.kind==="edit"?s.agent:null,n=!c&&!!m,l=me(),i=ue(m?.agentId??""),u=ge(m?.agentId??""),{data:a,isLoading:_}=fe(m?.agentId,{enabled:n}),$=!c&&d==="active",j=$?g:null,E=j?xe(j.proposal):void 0,v=a,q=m?.agentId??"create",o=pe(q,{name:E?.name??m?.name??"",description:E?.description??m?.description??"",identityMd:E?.identityMd??a?.identityMd??"",soulMd:a?.soulMd??"",userMd:a?.userMd??"",models:v?.models??v?.settings?.models??[],showToolCalls:v?.showToolCalls??v?.settings?.showToolCalls??!1,sandboxId:v?.sandboxId??v?.settings?.sandboxId??"builtin",starters:X(a?.starters)}),[h]=o.field("name"),[y]=o.field("description"),[M]=o.field("identityMd"),[I]=o.field("soulMd"),[P]=o.field("userMd"),[N,H]=o.field("models"),[F]=o.field("showToolCalls"),[w]=o.field("sandboxId"),[C]=o.field("starters"),{data:J}=he({enabled:!c}),K=be.useCallback(async S=>{if(S.preventDefault(),!(b||d==="active"||d==="loading"||d==="error"||!o.canSubmit)){if(c){const p=await l.mutateAsync({agentId:Ie(h,t),name:h.trim(),description:y.trim()||void 0});r?await r(p.agentId):f?.();return}if(m){if(!a){k.error("Still loading agent settings — try again in a moment");return}if(C.some(({title:p,message:R})=>!!p.trim()!=!!R.trim())){k.error("Add both a title and a message for each conversation starter");return}try{await Promise.all([i.mutateAsync({name:h.trim()||m.name,description:y.trim()||void 0}),u.mutateAsync({identityMd:M.trim(),soulMd:I.trim(),userMd:P.trim(),models:N,authProfiles:a.authProfiles??[],skillsConfig:a.skillsConfig,showToolCalls:F,sandboxId:w==="builtin"?void 0:w,starters:Y(C)})]),o.accept(o.values,{name:h.trim()||m.name,description:y.trim()||m.description||"",identityMd:M.trim(),soulMd:I.trim(),userMd:P.trim(),models:N,showToolCalls:F,sandboxId:w,starters:X(Y(C))}),k.success("Agent saved"),f?.()}catch(p){k.error(p instanceof Error?p.message:"Failed to save agent")}}}},[a,l,y,o.accept,o.values,o.canSubmit,b,d,w,t,M,c,N,h,r,f,m,F,I,C,i,u,P]),D=l.isPending||i.isPending||u.isPending,Q=c||!!a;if(n&&_)return e.jsx(Z,{settings:e.jsx(U,{rows:6}),models:e.jsx(U,{rows:2})});const T=D||b,ee=d==="none"||d==="gone",se=h.trim().length>0&&Q;if($&&j){const{current:S,proposed:p}=ve(j);return e.jsx(Ne,{current:S,proposed:p,render:R=>e.jsx(we,{value:R})},j.runId)}const L=S=>e.jsx(Ce,{value:{name:h,description:y,identityMd:M,soulMd:I,userMd:P,models:N,showToolCalls:F,sandboxId:w,starters:C},onChange:o.setValues,section:S,create:c,disabled:T,loading:_,sandboxes:J?.sandboxes,modelsEditor:e.jsx(ke,{value:N,onChange:H,disabled:T})}),O=L("settings"),te=L("models");return e.jsxs("form",{onSubmit:K,className:c?"flex min-h-0 flex-col":"space-y-7",children:[e.jsx(je,{visible:o.hasConflict,onReload:o.reset}),c?O:e.jsx(Z,{settings:O,models:te}),ee?e.jsx(ye,{className:c?"mt-6":void 0,onCancel:x,cancelDisabled:D,children:e.jsx(A,{type:"submit",disabled:!o.canSubmit||!se||D,children:c?l.isPending?"Creating...":"Create agent":i.isPending||u.isPending?"Saving...":"Save changes"})}):null]})}export{$e as A};
2
+ //# sourceMappingURL=agent-editor-form-DVFyyMyd.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,m as s,i as n}from"./index-DByaMzsG.js";const r="mx-auto w-full max-w-3xl px-4",d="gap-4",i="ml-8 self-end max-w-[80%]",o="mr-8 max-w-[90%]",c="mx-auto w-full max-w-3xl shrink-0 border-t border-border/50 bg-transparent px-4 pb-4 pt-3";function f({rows:l=3}){return e.jsx("div",{className:"space-y-2",role:"status","aria-label":"Loading list",children:Array.from({length:l}).map((a,x)=>e.jsx(s,{className:"h-16 w-full rounded-lg"},x))})}function t({readOnly:l=!1}){return e.jsxs("div",{role:"status","aria-label":l?"Loading run history":"Loading chat",className:l?"flex min-h-[24rem] min-w-0 flex-1 flex-col":"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:l?"flex flex-1 flex-col overflow-hidden":"flex min-h-0 flex-1 flex-col overflow-hidden",children:e.jsxs("div",{className:n(r,"flex flex-1 flex-col overflow-hidden",d),children:[e.jsx("div",{className:i,children:e.jsx(s,{className:"h-12 w-48 rounded-lg"})}),e.jsx("div",{className:o,children:e.jsx(s,{className:n(l?"h-20":"h-16","w-64 rounded-lg")})}),e.jsx("div",{className:i,children:e.jsx(s,{className:"h-10 w-36 rounded-lg"})}),l?e.jsx("div",{className:o,children:e.jsx(s,{className:"h-16 w-52 rounded-lg"})}):null]})}),l?null:e.jsx("div",{className:c,children:e.jsx(s,{className:"h-24 w-full rounded-lg"})})]})}function h(){return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:e.jsx(t,{})})}function u(){return e.jsx("div",{className:"flex h-48 w-full items-end gap-2 px-2 pb-2",role:"status","aria-label":"Loading timeline",children:[40,65,45,80,55,70,50,85,60,75].map((l,a)=>e.jsx(s,{className:"flex-1 rounded-sm",style:{height:`${l}%`}},a))})}export{t as A,h as C,u as E,c as a,d as b,r as c,o as d,i as e,f};
2
- //# sourceMappingURL=agent-loading-shells-DYqQphN7.js.map
1
+ import{j as e,m as s,i as n}from"./index-BoqrvLHQ.js";const r="mx-auto w-full max-w-3xl px-4",d="gap-4",i="ml-8 self-end max-w-[80%]",o="mr-8 max-w-[90%]",c="mx-auto w-full max-w-3xl shrink-0 border-t border-border/50 bg-transparent px-4 pb-4 pt-3";function f({rows:l=3}){return e.jsx("div",{className:"space-y-2",role:"status","aria-label":"Loading list",children:Array.from({length:l}).map((a,x)=>e.jsx(s,{className:"h-16 w-full rounded-lg"},x))})}function t({readOnly:l=!1}){return e.jsxs("div",{role:"status","aria-label":l?"Loading run history":"Loading chat",className:l?"flex min-h-[24rem] min-w-0 flex-1 flex-col":"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:l?"flex flex-1 flex-col overflow-hidden":"flex min-h-0 flex-1 flex-col overflow-hidden",children:e.jsxs("div",{className:n(r,"flex flex-1 flex-col overflow-hidden",d),children:[e.jsx("div",{className:i,children:e.jsx(s,{className:"h-12 w-48 rounded-lg"})}),e.jsx("div",{className:o,children:e.jsx(s,{className:n(l?"h-20":"h-16","w-64 rounded-lg")})}),e.jsx("div",{className:i,children:e.jsx(s,{className:"h-10 w-36 rounded-lg"})}),l?e.jsx("div",{className:o,children:e.jsx(s,{className:"h-16 w-52 rounded-lg"})}):null]})}),l?null:e.jsx("div",{className:c,children:e.jsx(s,{className:"h-24 w-full rounded-lg"})})]})}function h(){return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:e.jsx(t,{})})}function u(){return e.jsx("div",{className:"flex h-48 w-full items-end gap-2 px-2 pb-2",role:"status","aria-label":"Loading timeline",children:[40,65,45,80,55,70,50,85,60,75].map((l,a)=>e.jsx(s,{className:"flex-1 rounded-sm",style:{height:`${l}%`}},a))})}export{t as A,h as C,u as E,c as a,d as b,r as c,o as d,i as e,f};
2
+ //# sourceMappingURL=agent-loading-shells-BLNHIy-r.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,bT as B,i as k,dB as D,dC as R,dD as K,gS as X,y as Y,bN as Z,bM as G,bY as J,gT as ee,E as P,by as F,bZ as se,bU as ne,b_ as te,bV as re,r as S,gU as ae,gV as ie,bQ as le,b$ as oe,L as w,gW as de,gX as ce,cP as W,gY as ue,gZ as me,g_ as ge,g$ as A,aO as L,X as fe,h0 as q,h1 as z,gO as xe,dg as he,h2 as ye,h3 as pe,c2 as be,h4 as je}from"./index-DByaMzsG.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:k("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const y=X({option:l,floor:o}),h=l===t,g=y.disabled&&!h,p=B[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:k("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?k(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:p},l);return g&&y.reason?e.jsxs(D,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(K,{children:y.reason})]},l):f})})}function M({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function Se(n,t,o,a,i=null){const m=q(n.floor,t,o,a,i),u=z(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&ye(n.agent,t,o)?pe(u,A(n,t,o,null)):u}function ke({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:y}){const h=q(t.floor,o,a,i,m),g=z(t.floor,o,a,i,m),p=A(t,o,a,i,m),f=Se(t,o,a,i,m),j=be(o,a),b=e.jsx("div",{className:k("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:p,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:y})});return g?e.jsxs(D,{children:[e.jsx(R,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:b})}),e.jsxs(K,{children:["Org floor ",B[h]," — can only go stricter"]})]}):b}function Ae(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ce(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const $="font-medium text-foreground hover:text-primary hover:underline";function Ee({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function Q({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function Te({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function $e({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=Y(),m=Z(n,t??"",{enabled:!a&&!!t}),u=G(n,{enabled:a}),{data:l,isLoading:y,isError:h,error:g}=a?u:m,p=a?J(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(p,c=>c&&{...c,agent:Ae(c.agent,r)}),i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),b=f.isPending||j.isPending,C=S.useMemo(()=>l?ae(l):[],[l]),E=S.useMemo(()=>{if(!l)return[];const r=new Set(C.map(c=>c.slug));return l.entity_types.filter(c=>!r.has(c.slug))},[l,C]),v=S.useMemo(()=>l?ie(l):[],[l]),N=S.useMemo(()=>{if(!l)return[];const r=new Set(v.map(c=>c.id));return l.agents.filter(c=>(a||c.id!==t)&&!r.has(c.id))},[l,v,t,a]);if(y)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,U=(r,c,T,_,s=null)=>{const d=Ce(x,r,c,s,T,_);f.mutate({resource_class:r,effects:d,entity_type_slug:c,target_agent_id:s})},H=x.entity_types.length===0?"— none yet":E.length===0?"— all covered":null,I=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(w,{to:"/$owner/settings/organization",params:{owner:n},search:{section:"policies",agent:t},className:$,children:"Organization policies"}),"."]}),_e.map(r=>{const c=r.resourceClass==="entity",T=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...c?C.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(w,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:$,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:ce(x,s.slug),diffs:de(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(w,{to:"/$owner/agents/$agentId",params:{owner:n,agentId:s.id},className:$,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(M,{controls:s.owned?e.jsx(Te,{pending:b,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(d=>!s.targetAgentId||d!=="create").map(d=>{const O=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c?"entities":"agents"}`;return e.jsx(M,{controls:e.jsx(ke,{label:`${s.name}: ${O}`,response:x,resourceClass:r.resourceClass,action:d,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&A(x,r.resourceClass,d,s.entityTypeSlug,s.targetAgentId)===A(x,r.resourceClass,d,null),pending:b,onSave:V=>U(r.resourceClass,s.entityTypeSlug,d,V,s.targetAgentId)}),children:O},d)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[c?e.jsx(Q,{label:"Add type",disabled:b||E.length===0,hint:H,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>E.map(d=>e.jsx(L,{value:`${d.name} ${d.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),s()},className:"cursor-pointer",children:e.jsx(Ee,{type:d})},d.slug))}):null,T?e.jsx(Q,{label:"Add agent",disabled:b||N.length===0,hint:I,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(d=>e.jsxs(L,{value:`${d.name} ${d.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},r.resourceClass)})]})}export{$e as A,Ne as P,M as a};
2
- //# sourceMappingURL=agent-permissions-matrix-C1L8IcYR.js.map
1
+ import{j as e,bT as R,i as k,dE as B,dF as D,dG as K,gP as X,y as Y,bN as Z,bM as G,bY as J,gQ as ee,E as P,by as F,bZ as se,bU as ne,b_ as te,bV as re,r as S,gR as ae,gS as ie,bQ as le,b$ as oe,L as w,gT as de,gU as ce,cP as W,gV as ue,gW as me,gX as ge,gY as A,aO as L,X as fe,gZ as q,g_ as z,gL as xe,dg as he,g$ as ye,h0 as pe,c2 as be,h1 as je}from"./index-BoqrvLHQ.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:k("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const y=X({option:l,floor:o}),h=l===t,g=y.disabled&&!h,p=R[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:k("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?k(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:p},l);return g&&y.reason?e.jsxs(B,{children:[e.jsx(D,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(K,{children:y.reason})]},l):f})})}function Q({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function Se(n,t,o,a,i=null){const m=q(n.floor,t,o,a,i),u=z(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&ye(n.agent,t,o)?pe(u,A(n,t,o,null)):u}function ke({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:y}){const h=q(t.floor,o,a,i,m),g=z(t.floor,o,a,i,m),p=A(t,o,a,i,m),f=Se(t,o,a,i,m),j=be(o,a),b=e.jsx("div",{className:k("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:p,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:y})});return g?e.jsxs(B,{children:[e.jsx(D,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:b})}),e.jsxs(K,{children:["Org floor ",R[h]," — can only go stricter"]})]}):b}function Ae(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ee(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const $="font-medium text-foreground hover:text-primary hover:underline";function Ce({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function M({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function Te({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function $e({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=Y(),m=Z(n,t??"",{enabled:!a&&!!t}),u=G(n,{enabled:a}),{data:l,isLoading:y,isError:h,error:g}=a?u:m,p=a?J(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(p,c=>c&&{...c,agent:Ae(c.agent,r)}),i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:p}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),b=f.isPending||j.isPending,E=S.useMemo(()=>l?ae(l):[],[l]),C=S.useMemo(()=>{if(!l)return[];const r=new Set(E.map(c=>c.slug));return l.entity_types.filter(c=>!r.has(c.slug))},[l,E]),v=S.useMemo(()=>l?ie(l):[],[l]),N=S.useMemo(()=>{if(!l)return[];const r=new Set(v.map(c=>c.id));return l.agents.filter(c=>(a||c.id!==t)&&!r.has(c.id))},[l,v,t,a]);if(y)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,U=(r,c,T,_,s=null)=>{const d=Ee(x,r,c,s,T,_);f.mutate({resource_class:r,effects:d,entity_type_slug:c,target_agent_id:s})},H=x.entity_types.length===0?"— none yet":C.length===0?"— all covered":null,I=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(w,{to:"/$owner/settings/organization",params:{owner:n},search:{section:"policies",agent:t},className:$,children:"Organization policies"}),"."]}),_e.map(r=>{const c=r.resourceClass==="entity",T=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...c?E.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(w,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:$,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:ce(x,s.slug),diffs:de(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(w,{to:"/$owner/agents/$agentId",params:{owner:n,agentId:s.id},className:$,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(Q,{controls:s.owned?e.jsx(Te,{pending:b,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(d=>!s.targetAgentId||d!=="create").map(d=>{const O=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c?"entities":"agents"}`;return e.jsx(Q,{controls:e.jsx(ke,{label:`${s.name}: ${O}`,response:x,resourceClass:r.resourceClass,action:d,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&A(x,r.resourceClass,d,s.entityTypeSlug,s.targetAgentId)===A(x,r.resourceClass,d,null),pending:b,onSave:V=>U(r.resourceClass,s.entityTypeSlug,d,V,s.targetAgentId)}),children:O},d)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[c?e.jsx(M,{label:"Add type",disabled:b||C.length===0,hint:H,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>C.map(d=>e.jsx(L,{value:`${d.name} ${d.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),s()},className:"cursor-pointer",children:e.jsx(Ce,{type:d})},d.slug))}):null,T?e.jsx(M,{label:"Add agent",disabled:b||N.length===0,hint:I,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(d=>e.jsxs(L,{value:`${d.name} ${d.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},r.resourceClass)})]})}export{$e as A,Ne as P,Q as a};
2
+ //# sourceMappingURL=agent-permissions-matrix-UBKRR5vs.js.map
@@ -1,2 +1,2 @@
1
- import{r as p,bG as B,hd as ge,hQ as pe,i6 as be,by as F,j as ve}from"./index-DByaMzsG.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as Ae}from"./core.esm-C9QlSrgK.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function G(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=G(n,r,t),o=n[s],i=u[s];return!i||!o?null:{x:i.left-o.left,y:i.top-o.top,scaleX:i.width/o.width,scaleY:i.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const i=(n=u[t])!=null?n:r;if(!i)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(i.top+i.height):f.top-i.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-i.height-m,...M}:s<t&&s>=o?{x:0,y:i.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",Q=B.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Qe(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:i,droppableRects:m,over:f,measureDroppableContainers:a}=Ie(),l=Se(W,t),b=i.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&a(h)},[I,h,k,a]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return B.createElement(Q.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return G(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:i,previousContainerId:m,transition:f}=e;return!f||!r||i!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},J="transform",$e=H.Transition.toString({property:J,duration:0,easing:"linear"}),ze={roleDescription:"sortable"};function Fe(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),i=p.useRef(t);return Y(()=>{if(!n&&t!==i.current&&r.current){const m=s.current;if(m){const f=Ae(r.current,{ignoreTransform:!0}),a={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(a.x||a.y)&&o(a)}}t!==i.current&&(i.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Je(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:i,resizeObserverConfig:m,transition:f=je}=e;const{items:a,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(Q),S=Ge(r,h),c=a.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:a},...s}),[l,s,c,a]),d=p.useMemo(()=>a.slice(a.indexOf(o)),[a,o]),{rect:v,node:y,isOver:A,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:D,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:K,listeners:se,isDragging:$,over:oe,setActivatorNodeRef:ie,transform:ae}=ye({id:o,data:g,attributes:{...ze,...t},disabled:S.draggable}),le=we(L,K),T=!!D,U=T&&!k&&P(b)&&P(C),X=!R&&$,_=X&&U?ae:null,ce=U?_??(i??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:a,activeIndex:b,overIndex:C}):c,N=D?.id,x=p.useRef({activeId:N,items:a,newIndex:O,containerId:l}),ue=a!==x.current.items,q=n({active:D,containerId:l,isDragging:$,isSorting:T,id:o,index:c,items:a,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),z=Fe({disabled:!q,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),a!==x.current.items&&(x.current.items=a)},[T,O,l,a]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:D,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:a,isOver:A,isSorting:T,isDragging:$,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ie,setDroppableNodeRef:L,setDraggableNodeRef:K,transform:z??ce,transition:de()};function de(){if(z||ue&&x.current.newIndex===c)return $e;if(!(X&&!Re(te)||!f)&&(T||q))return H.Transition.toString({...f,property:J})}}function Ge(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Ke=[E.Down,E.Right,E.Up,E.Left],Ze=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:i}}=n;if(Ke.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let a=he(f,"id");if(a===o?.id&&f.length>1&&(a=f[1].id),a!=null){const l=u.get(t.id),b=u.get(a),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>i[v]!==d),R=Z(l,b),I=Ue(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Z(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Ue(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function Xe(e){return{skillsConfig:De(e)}}function _e(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:_e(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function qe(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),i=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),a=m??i,l=p.useCallback(async(c,g)=>{if(!t)return F.error("Still loading agent settings — try again in a moment"),!1;try{const d=Xe(c);return await o.mutateAsync(d),F.success(g),!0}catch(d){return F.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??i;return v.some(y=>y.repo===c)?v:[...v,qe(g)]})},[i,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const A=y??i;return A.some(L=>L.repo===d)?A:[...A,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[i]),k=p.useCallback((c,g)=>{f(d=>(d??i).map(v=>v.repo===c?{...v,...g}:v))},[i]),w=p.useCallback((c,g)=>{f(d=>{const v=d??i,y=v.findIndex(D=>D.repo===c),A=v.findIndex(D=>D.repo===g);if(y<0||A<0||y===A)return v;const L=G(v,y,A);return l(L,"Skill order updated"),L})},[l,i]),C=p.useCallback(async c=>{const g=a.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,a]),R=p.useCallback(async(c,g)=>{const d=a.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,a]),I=p.useCallback(async()=>{await l(a,"Skills saved")},[l,a]),S=p.useMemo(()=>({agentId:e,skillRows:a,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,a,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Qe as S,Ze as a,Je as b,et as c,tt as f,_e as s,rt as u,We as v};
2
- //# sourceMappingURL=agent-skill-context-D1nMrVod.js.map
1
+ import{r as p,bG as B,ha as ge,hN as pe,i3 as be,by as F,j as ve}from"./index-BoqrvLHQ.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as Ae}from"./core.esm-Ctg_pXLe.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function G(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=G(n,r,t),o=n[s],i=u[s];return!i||!o?null:{x:i.left-o.left,y:i.top-o.top,scaleX:i.width/o.width,scaleY:i.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const i=(n=u[t])!=null?n:r;if(!i)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(i.top+i.height):f.top-i.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-i.height-m,...M}:s<t&&s>=o?{x:0,y:i.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",J=B.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Je(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:i,droppableRects:m,over:f,measureDroppableContainers:a}=Ie(),l=Se(W,t),b=i.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&a(h)},[I,h,k,a]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return B.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return G(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:i,previousContainerId:m,transition:f}=e;return!f||!r||i!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},Q="transform",$e=H.Transition.toString({property:Q,duration:0,easing:"linear"}),ze={roleDescription:"sortable"};function Fe(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),i=p.useRef(t);return Y(()=>{if(!n&&t!==i.current&&r.current){const m=s.current;if(m){const f=Ae(r.current,{ignoreTransform:!0}),a={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(a.x||a.y)&&o(a)}}t!==i.current&&(i.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Qe(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:i,resizeObserverConfig:m,transition:f=je}=e;const{items:a,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(J),S=Ge(r,h),c=a.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:a},...s}),[l,s,c,a]),d=p.useMemo(()=>a.slice(a.indexOf(o)),[a,o]),{rect:v,node:y,isOver:A,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:D,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:K,listeners:se,isDragging:$,over:oe,setActivatorNodeRef:ie,transform:ae}=ye({id:o,data:g,attributes:{...ze,...t},disabled:S.draggable}),le=we(L,K),T=!!D,U=T&&!k&&P(b)&&P(C),X=!R&&$,_=X&&U?ae:null,ce=U?_??(i??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:a,activeIndex:b,overIndex:C}):c,N=D?.id,x=p.useRef({activeId:N,items:a,newIndex:O,containerId:l}),ue=a!==x.current.items,q=n({active:D,containerId:l,isDragging:$,isSorting:T,id:o,index:c,items:a,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),z=Fe({disabled:!q,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),a!==x.current.items&&(x.current.items=a)},[T,O,l,a]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:D,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:a,isOver:A,isSorting:T,isDragging:$,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ie,setDroppableNodeRef:L,setDraggableNodeRef:K,transform:z??ce,transition:de()};function de(){if(z||ue&&x.current.newIndex===c)return $e;if(!(X&&!Re(te)||!f)&&(T||q))return H.Transition.toString({...f,property:Q})}}function Ge(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Ke=[E.Down,E.Right,E.Up,E.Left],Ze=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:i}}=n;if(Ke.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let a=he(f,"id");if(a===o?.id&&f.length>1&&(a=f[1].id),a!=null){const l=u.get(t.id),b=u.get(a),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>i[v]!==d),R=Z(l,b),I=Ue(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Z(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Ue(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function Xe(e){return{skillsConfig:De(e)}}function _e(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:_e(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function qe(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),i=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),a=m??i,l=p.useCallback(async(c,g)=>{if(!t)return F.error("Still loading agent settings — try again in a moment"),!1;try{const d=Xe(c);return await o.mutateAsync(d),F.success(g),!0}catch(d){return F.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??i;return v.some(y=>y.repo===c)?v:[...v,qe(g)]})},[i,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const A=y??i;return A.some(L=>L.repo===d)?A:[...A,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[i]),k=p.useCallback((c,g)=>{f(d=>(d??i).map(v=>v.repo===c?{...v,...g}:v))},[i]),w=p.useCallback((c,g)=>{f(d=>{const v=d??i,y=v.findIndex(D=>D.repo===c),A=v.findIndex(D=>D.repo===g);if(y<0||A<0||y===A)return v;const L=G(v,y,A);return l(L,"Skill order updated"),L})},[l,i]),C=p.useCallback(async c=>{const g=a.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,a]),R=p.useCallback(async(c,g)=>{const d=a.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,a]),I=p.useCallback(async()=>{await l(a,"Skills saved")},[l,a]),S=p.useMemo(()=>({agentId:e,skillRows:a,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,a,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Je as S,Ze as a,Qe as b,et as c,tt as f,_e as s,rt as u,We as v};
2
+ //# sourceMappingURL=agent-skill-context-fqedKd0D.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,au as a,i as n}from"./index-DByaMzsG.js";function c({children:t,className:s}){return e.jsx(a,{className:n("pb-8",s),children:t})}function x({title:t,description:s}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:s})]})}export{x as A,c as a};
2
- //# sourceMappingURL=agent-subpage-shell-2w7vTeXw.js.map
1
+ import{j as e,au as a,i as n}from"./index-BoqrvLHQ.js";function c({children:t,className:s}){return e.jsx(a,{className:n("pb-8",s),children:t})}function x({title:t,description:s}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:s})]})}export{x as A,c as a};
2
+ //# sourceMappingURL=agent-subpage-shell-BUCoY2Nf.js.map