@lobu/runtime-server 24.0.0 → 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/connectors/x-dm-adapter.js +65 -30
  3. package/dist/db/migrations/20261021010000_views_compile_config_hash.sql +16 -0
  4. package/dist/dependencies.bun.lock +1 -1
  5. package/dist/owletto/dist/assets/{_-CC8cTmRg.js → _-BorucF19.js} +3 -3
  6. package/dist/owletto/dist/assets/_-CkGyNi0G.js +2 -0
  7. package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +2 -0
  8. package/dist/owletto/dist/assets/{_agentId-DWUFSrVp.js → _agentId-DgRrCE2B.js} +2 -2
  9. package/dist/owletto/dist/assets/{_automationId-BnHqdXOC.js → _automationId-DSrZIYcs.js} +2 -2
  10. package/dist/owletto/dist/assets/{_connectorKey._connectionId-CefXIqy2.js → _connectorKey._connectionId-DWxv1uoi.js} +2 -2
  11. package/dist/owletto/dist/assets/{_connectorKey.index-C1QPGf9E.js → _connectorKey.index-BTP5ijdT.js} +2 -2
  12. package/dist/owletto/dist/assets/{_conversationId-DinuPCUp.js → _conversationId-98Y3RuRO.js} +2 -2
  13. package/dist/owletto/dist/assets/{_deploymentId-BeyzVjRm.js → _deploymentId-B1UWPY0i.js} +2 -2
  14. package/dist/owletto/dist/assets/{_eventId-3L_qeL_l.js → _eventId-BAnr8g8z.js} +2 -2
  15. package/dist/owletto/dist/assets/_name-BUfFO_A0.js +2 -0
  16. package/dist/owletto/dist/assets/{_owner-DbrKma4e.js → _owner-C79BwQ0I.js} +3 -3
  17. package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +2 -0
  18. package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +2 -0
  19. package/dist/owletto/dist/assets/{_slug-ndDr_CUg.js → _slug-DbPdDc-5.js} +2 -2
  20. package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +2 -0
  21. package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +2 -0
  22. package/dist/owletto/dist/assets/{accept-invitation-CRKbM2Xy.js → accept-invitation-UXU5Fx2G.js} +2 -2
  23. package/dist/owletto/dist/assets/{activity-route-view-CFLNukhD.js → activity-route-view-D7ORHntE.js} +2 -2
  24. package/dist/owletto/dist/assets/{agent-card-controls-Be1Okb2C.js → agent-card-controls-CplnPhbv.js} +2 -2
  25. package/dist/owletto/dist/assets/{agent-client-setup-list-BA8dU_C6.js → agent-client-setup-list-BlXB4SE5.js} +2 -2
  26. package/dist/owletto/dist/assets/{agent-connect-pages-CAV-yXus.js → agent-connect-pages-BmknviTI.js} +2 -2
  27. package/dist/owletto/dist/assets/{agent-editor-form-Bi6WvYX-.js → agent-editor-form-DsSoeQeF.js} +2 -2
  28. package/dist/owletto/dist/assets/{agent-guardrails-route-DMOjG1D4.js → agent-guardrails-route-TdvvIc_J.js} +2 -2
  29. package/dist/owletto/dist/assets/{agent-loading-shells-De_2d8Lr.js → agent-loading-shells-B7v6Cffw.js} +2 -2
  30. package/dist/owletto/dist/assets/{agent-permissions-matrix-gZWl6mAe.js → agent-permissions-matrix-BkZu1LYE.js} +2 -2
  31. package/dist/owletto/dist/assets/{agent-skill-context-JLaTamGR.js → agent-skill-context-DFucg4c4.js} +2 -2
  32. package/dist/owletto/dist/assets/{agent-skills-route-DcK41PWj.js → agent-skills-route-B3vvvZZe.js} +2 -2
  33. package/dist/owletto/dist/assets/{agent-subpage-shell-BBJoyTuC.js → agent-subpage-shell-CZJvnjNC.js} +2 -2
  34. package/dist/owletto/dist/assets/agent-thread-D38STyeu.js +6 -0
  35. package/dist/owletto/dist/assets/agents-DAOln24A.js +2 -0
  36. package/dist/owletto/dist/assets/{agents-workbench-CqaKGggb.js → agents-workbench-DJ67GZ93.js} +2 -2
  37. package/dist/owletto/dist/assets/{app._appId-Cl1fTuIt.js → app._appId-Cp78oEZ9.js} +2 -2
  38. package/dist/owletto/dist/assets/{automation-detail-content-BMLL4lxO.js → automation-detail-content-DSwbRpbx.js} +2 -2
  39. package/dist/owletto/dist/assets/automations-DAOln24A.js +2 -0
  40. package/dist/owletto/dist/assets/{callback-DTKKsfkz.js → callback-CBexCo3F.js} +2 -2
  41. package/dist/owletto/dist/assets/{card-yU0TmNRH.js → card-jzhQrMDP.js} +2 -2
  42. package/dist/owletto/dist/assets/{claim-DJfTvlT2.js → claim-B-wq745Q.js} +2 -2
  43. package/dist/owletto/dist/assets/{client-rows--FrZfJol.js → client-rows-BYbsXGy9.js} +2 -2
  44. package/dist/owletto/dist/assets/{clients-L4K1UT8c.js → clients-BhNl1tVq.js} +2 -2
  45. package/dist/owletto/dist/assets/{code-editor-U54Gwjit.js → code-editor-CEqoCky-.js} +2 -2
  46. package/dist/owletto/dist/assets/connect-wx-qqLir.js +2 -0
  47. package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +2 -0
  48. package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +2 -0
  49. package/dist/owletto/dist/assets/{connected._clientId.activity-DTpSW1Xy.js → connected._clientId.activity-BqprYeOX.js} +2 -2
  50. package/dist/owletto/dist/assets/{connected._clientId.index-h9X5H1x8.js → connected._clientId.index-DhRoSzBr.js} +2 -2
  51. package/dist/owletto/dist/assets/{connection-ByvKkyFm.js → connection-CNm2ukrI.js} +2 -2
  52. package/dist/owletto/dist/assets/{connection-feed-detail-DWM9lTao.js → connection-feed-detail-WcGCA6qY.js} +2 -2
  53. package/dist/owletto/dist/assets/{connections-browser-CEwYrYqt.js → connections-browser-CrtnAs0Q.js} +2 -2
  54. package/dist/owletto/dist/assets/{connector-provenance-BocTm__v.js → connector-provenance-D-ECOlMJ.js} +2 -2
  55. package/dist/owletto/dist/assets/{connector-scope-lists-OYDOydtz.js → connector-scope-lists-CRFEpSvk.js} +2 -2
  56. package/dist/owletto/dist/assets/{connectors-CyZpcE5f.js → connectors-CH4KBZyT.js} +2 -2
  57. package/dist/owletto/dist/assets/{consent-DdfINrVp.js → consent-C9ZpHb7V.js} +2 -2
  58. package/dist/owletto/dist/assets/{conversations-table-BSznfdYt.js → conversations-table-D_HOe1jN.js} +2 -2
  59. package/dist/owletto/dist/assets/{core.esm-Dr7tcIB-.js → core.esm-BupT3V0i.js} +2 -2
  60. package/dist/owletto/dist/assets/create-C4lptGWj.js +2 -0
  61. package/dist/owletto/dist/assets/{create-CBGwASon.js → create-CCjZxIkK.js} +2 -2
  62. package/dist/owletto/dist/assets/create-DkgUQAbB.js +2 -0
  63. package/dist/owletto/dist/assets/{create-automation-form-9T5WnoUs.js → create-automation-form-Bpy92SM5.js} +2 -2
  64. package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +2 -0
  65. package/dist/owletto/dist/assets/{cronstrue-BWFEyy_P.js → cronstrue-CWImw-kf.js} +2 -2
  66. package/dist/owletto/dist/assets/{deployments-wG_8QzOF.js → deployments-C5hvipQh.js} +2 -2
  67. package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +2 -0
  68. package/dist/owletto/dist/assets/{deployments-body-2xKS8gRo.js → deployments-body-DGII20dQ.js} +2 -2
  69. package/dist/owletto/dist/assets/{device-6z-xgsoW.js → device-D-7WBe9E.js} +2 -2
  70. package/dist/owletto/dist/assets/{device-pin-tombstone-Cwq88RMU.js → device-pin-tombstone-2U0UMu3_.js} +2 -2
  71. package/dist/owletto/dist/assets/{device._deviceId-BDerBfD9.js → device._deviceId-Bn37UpWH.js} +2 -2
  72. package/dist/owletto/dist/assets/{entity-avatar-Cc1CuI-0.js → entity-avatar-mdh7Kq5D.js} +2 -2
  73. package/dist/owletto/dist/assets/{entity-options-DHdMC1Lx.js → entity-options-Clz_WXK-.js} +2 -2
  74. package/dist/owletto/dist/assets/{entity-page--OkXmlNP.js → entity-page-D3e4iPle.js} +2 -2
  75. package/dist/owletto/dist/assets/{entity-type-page-89RoK_-P.js → entity-type-page-DebN1vCM.js} +2 -2
  76. package/dist/owletto/dist/assets/{event-detail-D4YZRtrA.js → event-detail-DV_zfWnC.js} +2 -2
  77. package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +2 -0
  78. package/dist/owletto/dist/assets/{filter-editors-B1_QUpg_.js → filter-editors-Bwhqj7lY.js} +2 -2
  79. package/dist/owletto/dist/assets/{full-page-spinner-Cqih-8IW.js → full-page-spinner-BVbcpW3R.js} +2 -2
  80. package/dist/owletto/dist/assets/guardrails-BiJollCA.js +2 -0
  81. package/dist/owletto/dist/assets/identity-HCFWtdaI.js +2 -0
  82. package/dist/owletto/dist/assets/index-8wxsyxqt.js +2 -0
  83. package/dist/owletto/dist/assets/{index-DYCqXaMf.js → index-9YuSRymd.js} +4 -4
  84. package/dist/owletto/dist/assets/index-B3c-0eZG.js +2 -0
  85. package/dist/owletto/dist/assets/{index-TgRS2v_F.js → index-B64PGxQm.js} +2 -2
  86. package/dist/owletto/dist/assets/{index-DfyDUpuI.js → index-BTlx9K_t.js} +2 -2
  87. package/dist/owletto/dist/assets/index-BX0EA_oB.js +2 -0
  88. package/dist/owletto/dist/assets/index-CdJJaQDX.js +2 -0
  89. package/dist/owletto/dist/assets/index-CfT_W8Vo.js +2 -0
  90. package/dist/owletto/dist/assets/{index-DYzWV5_z.js → index-CxF2XXzl.js} +2 -2
  91. package/dist/owletto/dist/assets/index-D3WHeGql.js +2 -0
  92. package/dist/owletto/dist/assets/{index-ZNlrDc_f.js → index-D7gHOpfg.js} +2 -2
  93. package/dist/owletto/dist/assets/{index-DKPwCasf.js → index-DB1iWI_a.js} +2 -2
  94. package/dist/owletto/dist/assets/index-DMNzF8Lf.js +2 -0
  95. package/dist/owletto/dist/assets/index-DyB3IzOA.js +2 -0
  96. package/dist/owletto/dist/assets/{index-DAOyXG1X.js → index-fgAJydgX.js} +2 -2
  97. package/dist/owletto/dist/assets/{json-diff-DFvYINBT.js → json-diff-DIN5Jhfx.js} +2 -2
  98. package/dist/owletto/dist/assets/{list-skeleton-DFsEqLU1.js → list-skeleton-CepswBka.js} +2 -2
  99. package/dist/owletto/dist/assets/{login-DO0j-AYr.js → login-DxGYyE4n.js} +2 -2
  100. package/dist/owletto/dist/assets/{logout-BmNwoAf7.js → logout-Bkzc7J44.js} +2 -2
  101. package/dist/owletto/dist/assets/{member-scope-gate-B2LrMWBU.js → member-scope-gate-DD4YBFn-.js} +2 -2
  102. package/dist/owletto/dist/assets/{memory-browse-page-Cjpl8EbB.js → memory-browse-page-D_UlBa27.js} +2 -2
  103. package/dist/owletto/dist/assets/{model-selector-TQcA93xm.js → model-selector-CDrAjH31.js} +2 -2
  104. package/dist/owletto/dist/assets/models-BAVeysNq.js +2 -0
  105. package/dist/owletto/dist/assets/{new-BMrFy5Qa.js → new-C2av0diq.js} +2 -2
  106. package/dist/owletto/dist/assets/{new-ByBhteWA.js → new-ktz9Cs_P.js} +2 -2
  107. package/dist/owletto/dist/assets/{new-DWp3deoW.js → new-snm1ctHn.js} +2 -2
  108. package/dist/owletto/dist/assets/{oauth-workspace-access-D_5uESuz.js → oauth-workspace-access-lZNZ9gul.js} +2 -2
  109. package/dist/owletto/dist/assets/{organization-DTFoYP4V.js → organization-Cb0W823y.js} +2 -2
  110. package/dist/owletto/dist/assets/{peek-pane-content-DF5iGC3c.js → peek-pane-content-BNR9ImQY.js} +2 -2
  111. package/dist/owletto/dist/assets/{permissions-C_auqxfP.js → permissions-Dv39zWKt.js} +2 -2
  112. package/dist/owletto/dist/assets/{proposal-review-shell-DsNiavG_.js → proposal-review-shell-CFhOqCLf.js} +2 -2
  113. package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +2 -0
  114. package/dist/owletto/dist/assets/{recent-3d99S2IE.js → recent-QhnLDU1_.js} +2 -2
  115. package/dist/owletto/dist/assets/{record-activity-C9KfBkXb.js → record-activity-ZJntBfN_.js} +2 -2
  116. package/dist/owletto/dist/assets/{record-field-peek-BBZcRuGT.js → record-field-peek-Brh1IQGy.js} +2 -2
  117. package/dist/owletto/dist/assets/{record-session-BizRugWs.js → record-session-Pbr5czGw.js} +2 -2
  118. package/dist/owletto/dist/assets/{reset-password-DqfcSn8M.js → reset-password-CzZw6RcC.js} +2 -2
  119. package/dist/owletto/dist/assets/{runs-panel-T1ZxTVz6.js → runs-panel-C0_DNTcq.js} +2 -2
  120. package/dist/owletto/dist/assets/{runs-table-D_8QlCCN.js → runs-table-B1APZv7d.js} +2 -2
  121. package/dist/owletto/dist/assets/{schema-value-normalization-CylKX3PK.js → schema-value-normalization-CKdPjdPC.js} +2 -2
  122. package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +2 -0
  123. package/dist/owletto/dist/assets/{settings-B_ClYztB.js → settings-VDNiffKU.js} +2 -2
  124. package/dist/owletto/dist/assets/skills-DgDGscm5.js +2 -0
  125. package/dist/owletto/dist/assets/{source-record-panels-Cg249m1S.js → source-record-panels-BdfOVPWn.js} +2 -2
  126. package/dist/owletto/dist/assets/{use-mention-search-BYbFvHbJ.js → use-mention-search-Dcunv4L0.js} +2 -2
  127. package/dist/owletto/dist/assets/{view-param-filters-DMSqkN2J.js → view-param-filters-B0quibBi.js} +2 -2
  128. package/dist/owletto/dist/index.html +1 -1
  129. package/dist/server-main.bundle.mjs +354 -142
  130. package/npm-shrinkwrap.json +8 -8
  131. package/package.json +1 -1
  132. package/vendor/connector-sdk/package.json +1 -1
  133. package/vendor/core/dist/contracts/tools/view-runtime.d.ts +74 -0
  134. package/vendor/core/dist/contracts/tools/view-runtime.js +86 -0
  135. package/vendor/core/package.json +6 -1
  136. package/vendor/views/package.json +1 -1
  137. package/dist/owletto/dist/assets/_-ksFp4zVf.js +0 -2
  138. package/dist/owletto/dist/assets/_agentId-MENLoohA.js +0 -2
  139. package/dist/owletto/dist/assets/_name-Dgedji78.js +0 -2
  140. package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +0 -2
  141. package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +0 -2
  142. package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +0 -2
  143. package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +0 -2
  144. package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +0 -6
  145. package/dist/owletto/dist/assets/agents-C-ReckCa.js +0 -2
  146. package/dist/owletto/dist/assets/automations-C-ReckCa.js +0 -2
  147. package/dist/owletto/dist/assets/connect-4zqtnDHb.js +0 -2
  148. package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +0 -2
  149. package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +0 -2
  150. package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +0 -2
  151. package/dist/owletto/dist/assets/create-CwThQtd3.js +0 -2
  152. package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +0 -2
  153. package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +0 -2
  154. package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +0 -2
  155. package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +0 -2
  156. package/dist/owletto/dist/assets/identity-B0nH4yiC.js +0 -2
  157. package/dist/owletto/dist/assets/index-4TSkcsth.js +0 -2
  158. package/dist/owletto/dist/assets/index-BgkhXElB.js +0 -2
  159. package/dist/owletto/dist/assets/index-CoW4Bz3w.js +0 -2
  160. package/dist/owletto/dist/assets/index-Codw-Qqi.js +0 -2
  161. package/dist/owletto/dist/assets/index-DMyXd3bJ.js +0 -2
  162. package/dist/owletto/dist/assets/index-DYYZLcJ0.js +0 -2
  163. package/dist/owletto/dist/assets/index-Da6CrGEu.js +0 -2
  164. package/dist/owletto/dist/assets/index-DneshLbf.js +0 -2
  165. package/dist/owletto/dist/assets/models-D7aED5Sa.js +0 -2
  166. package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +0 -2
  167. package/dist/owletto/dist/assets/settings-DgX1-xo7.js +0 -2
  168. package/dist/owletto/dist/assets/skills-Drw5tcZw.js +0 -2
@@ -1,2 +1,2 @@
1
- import{r as p,ex as G,gj as ge,gU as pe,hb as be,bJ as F,j as ve}from"./index-DYCqXaMf.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-Dr7tcIB-.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function U(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=U(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=G.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 G.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return U(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=Ue(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,X=T&&!k&&P(b)&&P(C),_=!R&&$,q=_&&X?ae:null,ce=X?q??(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,B=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:!B,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(!(_&&!Re(te)||!f)&&(T||B))return H.Transition.toString({...f,property:Q})}}function Ue(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=Xe(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 Xe(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function _e(e){return{skillsConfig:De(e)}}function qe(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:qe(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 Be(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=_e(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,Be(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=U(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,et as b,Qe as c,tt as f,qe as s,rt as u,We as v};
2
- //# sourceMappingURL=agent-skill-context-JLaTamGR.js.map
1
+ import{r as p,ex as G,gj as ge,gU as pe,hb as be,bJ as F,j as ve}from"./index-9YuSRymd.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-BupT3V0i.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function U(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=U(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=G.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 G.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return U(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=Ue(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,X=T&&!k&&P(b)&&P(C),_=!R&&$,q=_&&X?ae:null,ce=X?q??(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,B=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:!B,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(!(_&&!Re(te)||!f)&&(T||B))return H.Transition.toString({...f,property:Q})}}function Ue(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=Xe(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 Xe(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function _e(e){return{skillsConfig:De(e)}}function qe(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:qe(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 Be(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=_e(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,Be(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=U(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,et as b,Qe as c,tt as f,qe as s,rt as u,We as v};
2
+ //# sourceMappingURL=agent-skill-context-DFucg4c4.js.map
@@ -1,2 +1,2 @@
1
- import{o as w,r as u,j as e,cT as F,z as C,I as K,fN as P,bA as z,B as N,Q as E,af as Q,h0 as G,h1 as H,aR as Y,hi as V,fj as X,iS as q}from"./index-DYCqXaMf.js";import{a as J,A as U}from"./agent-subpage-shell-BBJoyTuC.js";import{u as $,b as W,f as Z,s as ee,a as se,S as te,v as ae,c as le}from"./agent-skill-context-JLaTamGR.js";import{f as ne}from"./agent-loading-shells-De_2d8Lr.js";import{u as ie,a as L,m as oe,P as re,D as ce,n as de,C as me}from"./core.esm-Dr7tcIB-.js";import{A as ue}from"./agent-card-controls-Be1Okb2C.js";const T=":";function A(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function ge({owner:s,agentId:t,onBack:a,backLabel:n="Skills"}){const o=w(),[i,g]=u.useState(""),[k,h]=u.useState(!1),[r,p]=u.useState(""),[m,v]=u.useState(""),{skillRows:c,catalog:x,isLoading:S,addSkillFromCatalog:y,addCustomSkill:b}=$(),l=u.useMemo(()=>new Set(c.map(d=>d.repo)),[c]),f=u.useMemo(()=>W(x?.catalog??[],l),[x?.catalog,l]),j=u.useMemo(()=>Z(f,i),[f,i]),R=d=>{y(d),o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(d)}})},O=()=>{const d=b({name:r,instructions:m});d&&o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(d)}})},_=a?e.jsx(J,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own.",onBack:a,backLabel:n}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Add a skill"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."})]});return e.jsxs("div",{className:"space-y-6",children:[_,e.jsx("div",{className:E(Q,"w-full"),children:k?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{id:"custom-skill-name",value:r,onChange:d=>p(d.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:m,onChange:d=>v(d.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(z,{onCancel:()=>h(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:O,disabled:!r.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(F,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),S?e.jsx(G,{}):e.jsx(H,{items:j,searchQuery:i,onSearchChange:g,onSelect:d=>R(d.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:i.trim()?`No skills match "${i}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function xe({row:s}){const{isSaving:t,updateSkillRow:a}=$(),n=s.system===!0;return e.jsx("div",{className:"space-y-6",children:n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"System skill metadata is managed by Lobu. You can enable or disable it and change its position in the skill list."}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{id:"skill-name",value:s.name,onChange:o=>a(s.repo,{name:o.target.value}),disabled:t})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-instructions",children:"Instructions"}),e.jsx(P,{id:"skill-instructions",value:s.instructions??"",onChange:o=>{const i=o.target.value;a(s.repo,{instructions:i,content:i.trim()||s.name})},rows:4,disabled:t})]})]})})}function he({owner:s,agentId:t,skillKey:a}){const n=w(),[o,i]=u.useState(!1),g=B(a),{skillRows:k,catalog:h,isSaving:r,saveSkills:p,removeSkillAndSave:m,addSkillFromCatalog:v}=$(),c=k.find(b=>b.repo===g)??null,x=h?.catalog.find(b=>b.repo===g);u.useEffect(()=>{!c&&x&&v(g)},[v,x,g,c]);const S=async()=>{await m(g)&&(i(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!c)return x?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const y=!c.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{row:c}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[y?o?e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(N,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(!0),disabled:r,children:["Remove ",c.name]}):null,e.jsx(N,{type:"button",onClick:()=>void p(),disabled:r||o,children:r?"Saving...":"Save changes"})]})]})}function fe(s){return s.map(t=>{const a=ee(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const D="Skills bundle instructions, tools, and knowledge an agent can reuse. Add one from the catalog or write your own; drag to set which the agent reaches for first.";function M({owner:s,agentId:t,expandedRepo:a}){const n=w(),{skillRows:o,catalog:i,isLoading:g,isSaving:k,reorderSkills:h,setSkillEnabledAndSave:r,addSkillFromCatalog:p}=$();u.useEffect(()=>{a&&(o.some(l=>l.repo===a)||i?.catalog.some(l=>l.repo===a)&&p(a))},[a,o,i,p]);const m=u.useMemo(()=>fe(o),[o]),v=u.useMemo(()=>m.map(l=>l.repo),[m]),c=ie(L(re,{activationConstraint:{distance:8}}),L(oe,{coordinateGetter:se})),x=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:x,children:[e.jsx(F,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),y=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(l)}})},b=l=>{const{active:f,over:j}=l;!j||f.id===j.id||h(String(f.id),String(j.id))};return g?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(ne,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(Y,{icon:V,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:x})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-sm text-muted-foreground",children:D}),S]}),e.jsx(ce,{sensors:c,collisionDetection:de,onDragEnd:b,children:e.jsx(te,{items:v,strategy:ae,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,f)=>{const j=l.repo===a;return e.jsx(ke,{card:l,rank:f+1,disabled:k,expanded:j,isLast:f===m.length-1,onToggle:()=>y(l.repo),onToggleEnabled:R=>void r(l.repo,R),toggleDisabled:k,children:j?e.jsx(he,{owner:s,agentId:t,skillKey:A(l.repo)}):null},l.id)})})})})]})}function ke({card:s,rank:t,disabled:a,expanded:n,isLast:o,onToggle:i,onToggleEnabled:g,toggleDisabled:k,children:h}){const r=a||n,{attributes:p,listeners:m,setNodeRef:v,transform:c,transition:x,isDragging:S}=le({id:s.repo,disabled:r}),y={transform:me.Transform.toString(c),transition:x};return e.jsxs("div",{ref:v,style:y,className:E("bg-background",!o||n?"border-b":"",S&&"z-10 bg-card opacity-80 "),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsx("button",{type:"button",className:"flex shrink-0 cursor-grab touch-none items-center px-2 text-muted-foreground hover:text-foreground active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Reorder ${s.name}`,disabled:r,...p,...m,children:e.jsx(X,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",className:E("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!s.enabled&&!n&&"opacity-70"),onClick:i,"aria-expanded":n,children:[e.jsx("span",{className:"w-4 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:t}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:s.description}):null,e.jsx(q,{badges:s.badges})]})]}),e.jsx(ue,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:g,toggleDisabled:k,onToggle:i})]}),n&&h?e.jsx("div",{className:"border-t border-border px-4 py-4",children:h}):null]})}function I({owner:s,agentId:t,children:a,showBack:n}){return e.jsx(U,{owner:s,agentId:t,showBack:n,backLabel:"Skills",backTo:"/$owner/agents/$agentId/skills",children:a})}function Ne({owner:s,agentId:t}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t}){const a=w();return e.jsx(I,{owner:s,agentId:t,children:e.jsx(ge,{owner:s,agentId:t,onBack:()=>{a({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}})}})})}function Ae({owner:s,agentId:t,skillKey:a}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Ne as A,Ce as a,Ae as b};
2
- //# sourceMappingURL=agent-skills-route-DcK41PWj.js.map
1
+ import{o as w,r as u,j as e,cT as F,z as C,I as K,fN as P,bA as z,B as N,Q as E,af as Q,h0 as G,h1 as H,aR as Y,hi as V,fj as X,iS as q}from"./index-9YuSRymd.js";import{a as J,A as U}from"./agent-subpage-shell-CZJvnjNC.js";import{u as $,b as W,f as Z,s as ee,a as se,S as te,v as ae,c as le}from"./agent-skill-context-DFucg4c4.js";import{f as ne}from"./agent-loading-shells-B7v6Cffw.js";import{u as ie,a as L,m as oe,P as re,D as ce,n as de,C as me}from"./core.esm-BupT3V0i.js";import{A as ue}from"./agent-card-controls-CplnPhbv.js";const T=":";function A(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function ge({owner:s,agentId:t,onBack:a,backLabel:n="Skills"}){const o=w(),[i,g]=u.useState(""),[k,h]=u.useState(!1),[r,p]=u.useState(""),[m,v]=u.useState(""),{skillRows:c,catalog:x,isLoading:S,addSkillFromCatalog:y,addCustomSkill:b}=$(),l=u.useMemo(()=>new Set(c.map(d=>d.repo)),[c]),f=u.useMemo(()=>W(x?.catalog??[],l),[x?.catalog,l]),j=u.useMemo(()=>Z(f,i),[f,i]),R=d=>{y(d),o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(d)}})},O=()=>{const d=b({name:r,instructions:m});d&&o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(d)}})},_=a?e.jsx(J,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own.",onBack:a,backLabel:n}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Add a skill"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."})]});return e.jsxs("div",{className:"space-y-6",children:[_,e.jsx("div",{className:E(Q,"w-full"),children:k?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{id:"custom-skill-name",value:r,onChange:d=>p(d.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:m,onChange:d=>v(d.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(z,{onCancel:()=>h(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:O,disabled:!r.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(F,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),S?e.jsx(G,{}):e.jsx(H,{items:j,searchQuery:i,onSearchChange:g,onSelect:d=>R(d.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:i.trim()?`No skills match "${i}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function xe({row:s}){const{isSaving:t,updateSkillRow:a}=$(),n=s.system===!0;return e.jsx("div",{className:"space-y-6",children:n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"System skill metadata is managed by Lobu. You can enable or disable it and change its position in the skill list."}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{id:"skill-name",value:s.name,onChange:o=>a(s.repo,{name:o.target.value}),disabled:t})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-instructions",children:"Instructions"}),e.jsx(P,{id:"skill-instructions",value:s.instructions??"",onChange:o=>{const i=o.target.value;a(s.repo,{instructions:i,content:i.trim()||s.name})},rows:4,disabled:t})]})]})})}function he({owner:s,agentId:t,skillKey:a}){const n=w(),[o,i]=u.useState(!1),g=B(a),{skillRows:k,catalog:h,isSaving:r,saveSkills:p,removeSkillAndSave:m,addSkillFromCatalog:v}=$(),c=k.find(b=>b.repo===g)??null,x=h?.catalog.find(b=>b.repo===g);u.useEffect(()=>{!c&&x&&v(g)},[v,x,g,c]);const S=async()=>{await m(g)&&(i(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!c)return x?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const y=!c.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{row:c}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[y?o?e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(N,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(!0),disabled:r,children:["Remove ",c.name]}):null,e.jsx(N,{type:"button",onClick:()=>void p(),disabled:r||o,children:r?"Saving...":"Save changes"})]})]})}function fe(s){return s.map(t=>{const a=ee(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const D="Skills bundle instructions, tools, and knowledge an agent can reuse. Add one from the catalog or write your own; drag to set which the agent reaches for first.";function M({owner:s,agentId:t,expandedRepo:a}){const n=w(),{skillRows:o,catalog:i,isLoading:g,isSaving:k,reorderSkills:h,setSkillEnabledAndSave:r,addSkillFromCatalog:p}=$();u.useEffect(()=>{a&&(o.some(l=>l.repo===a)||i?.catalog.some(l=>l.repo===a)&&p(a))},[a,o,i,p]);const m=u.useMemo(()=>fe(o),[o]),v=u.useMemo(()=>m.map(l=>l.repo),[m]),c=ie(L(re,{activationConstraint:{distance:8}}),L(oe,{coordinateGetter:se})),x=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:x,children:[e.jsx(F,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),y=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(l)}})},b=l=>{const{active:f,over:j}=l;!j||f.id===j.id||h(String(f.id),String(j.id))};return g?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(ne,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(Y,{icon:V,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:x})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-sm text-muted-foreground",children:D}),S]}),e.jsx(ce,{sensors:c,collisionDetection:de,onDragEnd:b,children:e.jsx(te,{items:v,strategy:ae,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,f)=>{const j=l.repo===a;return e.jsx(ke,{card:l,rank:f+1,disabled:k,expanded:j,isLast:f===m.length-1,onToggle:()=>y(l.repo),onToggleEnabled:R=>void r(l.repo,R),toggleDisabled:k,children:j?e.jsx(he,{owner:s,agentId:t,skillKey:A(l.repo)}):null},l.id)})})})})]})}function ke({card:s,rank:t,disabled:a,expanded:n,isLast:o,onToggle:i,onToggleEnabled:g,toggleDisabled:k,children:h}){const r=a||n,{attributes:p,listeners:m,setNodeRef:v,transform:c,transition:x,isDragging:S}=le({id:s.repo,disabled:r}),y={transform:me.Transform.toString(c),transition:x};return e.jsxs("div",{ref:v,style:y,className:E("bg-background",!o||n?"border-b":"",S&&"z-10 bg-card opacity-80 "),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsx("button",{type:"button",className:"flex shrink-0 cursor-grab touch-none items-center px-2 text-muted-foreground hover:text-foreground active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Reorder ${s.name}`,disabled:r,...p,...m,children:e.jsx(X,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",className:E("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!s.enabled&&!n&&"opacity-70"),onClick:i,"aria-expanded":n,children:[e.jsx("span",{className:"w-4 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:t}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:s.description}):null,e.jsx(q,{badges:s.badges})]})]}),e.jsx(ue,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:g,toggleDisabled:k,onToggle:i})]}),n&&h?e.jsx("div",{className:"border-t border-border px-4 py-4",children:h}):null]})}function I({owner:s,agentId:t,children:a,showBack:n}){return e.jsx(U,{owner:s,agentId:t,showBack:n,backLabel:"Skills",backTo:"/$owner/agents/$agentId/skills",children:a})}function Ne({owner:s,agentId:t}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t}){const a=w();return e.jsx(I,{owner:s,agentId:t,children:e.jsx(ge,{owner:s,agentId:t,onBack:()=>{a({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}})}})})}function Ae({owner:s,agentId:t,skillKey:a}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Ne as A,Ce as a,Ae as b};
2
+ //# sourceMappingURL=agent-skills-route-B3vvvZZe.js.map
@@ -1,2 +1,2 @@
1
- import{o as m,j as e,Q as h,B as n,gK as o}from"./index-DYCqXaMf.js";function p({owner:t,agentId:a,children:s,showBack:r,backLabel:i,backTo:x,title:c,className:u}){const d=m(),l=()=>{d({to:x,params:{owner:t,agentId:a}})};return e.jsx("div",{className:h("mx-auto w-full max-w-3xl pb-8",u),children:c?e.jsxs(e.Fragment,{children:[e.jsx(j,{title:c,onBack:l,backLabel:i}),s]}):r?e.jsx(g,{onBack:l,backLabel:i,children:s}):s})}function g({onBack:t,backLabel:a,children:s}){return e.jsxs("div",{className:"relative",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"absolute right-full top-0 mr-1 size-8 text-muted-foreground hover:text-foreground","aria-label":`Back to ${a}`,onClick:t,children:e.jsx(o,{className:"h-4 w-4"})}),s]})}function j({title:t,onBack:a,backLabel:s,action:r}){return e.jsx("div",{className:"sticky top-0 z-10 mb-2 bg-background py-2",children:e.jsxs("div",{className:"relative flex items-center justify-center gap-1",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${s}`,onClick:a,children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-base font-semibold",children:t}),r?e.jsx("div",{className:"absolute right-0",children:r}):null]})})}function v({title:t,description:a,onBack:s,backLabel:r}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${r}`,onClick:s,children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-xl font-semibold",children:t})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:a})]})}export{p as A,v as a};
2
- //# sourceMappingURL=agent-subpage-shell-BBJoyTuC.js.map
1
+ import{o as m,j as e,Q as h,B as n,gK as o}from"./index-9YuSRymd.js";function p({owner:t,agentId:a,children:s,showBack:r,backLabel:i,backTo:x,title:c,className:u}){const d=m(),l=()=>{d({to:x,params:{owner:t,agentId:a}})};return e.jsx("div",{className:h("mx-auto w-full max-w-3xl pb-8",u),children:c?e.jsxs(e.Fragment,{children:[e.jsx(j,{title:c,onBack:l,backLabel:i}),s]}):r?e.jsx(g,{onBack:l,backLabel:i,children:s}):s})}function g({onBack:t,backLabel:a,children:s}){return e.jsxs("div",{className:"relative",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"absolute right-full top-0 mr-1 size-8 text-muted-foreground hover:text-foreground","aria-label":`Back to ${a}`,onClick:t,children:e.jsx(o,{className:"h-4 w-4"})}),s]})}function j({title:t,onBack:a,backLabel:s,action:r}){return e.jsx("div",{className:"sticky top-0 z-10 mb-2 bg-background py-2",children:e.jsxs("div",{className:"relative flex items-center justify-center gap-1",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${s}`,onClick:a,children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-base font-semibold",children:t}),r?e.jsx("div",{className:"absolute right-0",children:r}):null]})})}function v({title:t,description:a,onBack:s,backLabel:r}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${r}`,onClick:s,children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-xl font-semibold",children:t})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:a})]})}export{p as A,v as a};
2
+ //# sourceMappingURL=agent-subpage-shell-CZJvnjNC.js.map
@@ -0,0 +1,6 @@
1
+ import{j as s,r as a,aE as Vt,$ as Bt,gi as Ht,gj as zt,W as Ze,J as Ve,Y as et,bX as Wt,gk as tt,gl as Kt,gm as qt,L as mt,Q as P,fw as Gt,ef as ht,eg as Xt,gn as Yt,d$ as Jt,eh as Qt,go as Zt,ai as en,B as pe,et as tn,gp as nn,gq as Be,X as rn,a2 as on,cX as sn,af as Ne,gr as ln,gs as an,dr as cn,dt as un,gt as dn,ds as fn,bc as pn,gu as mn,gv as hn,dX as gn,b8 as bn,gw as xn,gx as vn}from"./index-9YuSRymd.js";import{D as yn,E as Rn}from"./app-bridge-BCm4muqj.js";import{A as wn,a as Sn,b as Tn,c as qe,d as gt,e as Cn}from"./agent-loading-shells-B7v6Cffw.js";import{h as jn,t as Nn,R as En,i as An,u as kn,M as In,a as _n}from"./use-mention-search-Dcunv4L0.js";import{E as On,t as nt,c as Pn}from"./events-feed-DO3IiJO2.js";const bt=a.createContext(null);function Mn({extension:e,children:t}){return s.jsx(bt.Provider,{value:e??null,children:t})}function Ge(){return a.useContext(bt)}var Xe=(e=>(e.PROVIDER_QUOTA_EXHAUSTED="PROVIDER_QUOTA_EXHAUSTED",e.PROVIDER_AUTH="PROVIDER_AUTH",e.PROVIDER_UNKNOWN_MODEL="PROVIDER_UNKNOWN_MODEL",e.PROVIDER_BASE_URL_UNRESOLVED="PROVIDER_BASE_URL_UNRESOLVED",e.NO_MODEL_CONFIGURED="NO_MODEL_CONFIGURED",e.WORKER_UNRESPONSIVE="WORKER_UNRESPONSIVE",e.WORKER_DIED="WORKER_DIED",e.WORKER_STARTUP_FAILED="WORKER_STARTUP_FAILED",e.PROVIDER_TOOL_CALL_FAILED="PROVIDER_TOOL_CALL_FAILED",e.SESSION_TIMEOUT="SESSION_TIMEOUT",e))(Xe||{});const Ln={PROVIDER_QUOTA_EXHAUSTED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_AUTH:{cta:"provider-management",ctaLabel:"Reconnect provider"},PROVIDER_UNKNOWN_MODEL:{cta:"agent-settings",ctaLabel:"Choose model"},PROVIDER_BASE_URL_UNRESOLVED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_TOOL_CALL_FAILED:{message:"The model provider rejected its own tool call and ended the turn. This is usually temporary — please try again.",cta:"none"},NO_MODEL_CONFIGURED:{message:"No model is configured for this agent. Choose a model in agent settings.",cta:"agent-settings",ctaLabel:"Choose a model"},WORKER_UNRESPONSIVE:{message:"The agent didn't finish responding in time. This is usually temporary — please try again.",cta:"none"},WORKER_DIED:{message:"The agent stopped unexpectedly before it could reply. This is usually temporary — please try again.",cta:"none"},WORKER_STARTUP_FAILED:{message:"The agent couldn't start, so your request wasn't processed. Please try again in a moment.",cta:"none"},SESSION_TIMEOUT:{cta:"none",silent:!0}};function $n(e){if(typeof e=="string")return Object.values(Xe).includes(e)?e:void 0}const Dn=Object.freeze(Object.defineProperty({__proto__:null,AGENT_ERRORS:Ln,AgentErrorCode:Xe,toAgentErrorCode:$n},Symbol.toStringTag,{value:"Module"})),{AGENT_ERRORS:Un,toAgentErrorCode:Fn}=Dn;function rt(e,t){if(!t)return null;try{const n=new URL(t);return n.protocol!=="http:"&&n.protocol!=="https:"?null:new URL(e,`${n.origin}/`).toString()}catch{return null}}function xt(e,t){const n=Fn(e);if(!n)return null;const r=Un[n];if(r.cta==="none"||!t.workspaceSlug)return null;const o=encodeURIComponent(t.workspaceSlug);if(r.cta==="provider-connect"||r.cta==="provider-management"){const i=t.provider?`/${o}/connectors/${encodeURIComponent(`${Vt}${t.provider}`)}`:`/${o}/connectors`,c=rt(i,t.webOrigin);if(!c)return null;const u=new URL(c);return t.provider&&t.model&&u.searchParams.set("model",t.model),{label:r.ctaLabel??"Connect a provider",href:u.toString()}}if(!t.agentId)return null;const l=rt(`/${o}/agents/${encodeURIComponent(t.agentId)}/settings`,t.webOrigin);return l?{label:r.ctaLabel??"Open settings",href:l}:null}function vt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.subscribable;if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t;if(typeof n.connector_key!="string"||!n.connector_key||typeof n.resource_type!="string"||!n.resource_type||typeof n.resource_ref!="string"||!n.resource_ref||typeof n.label!="string"||!n.label)return null;const r=Array.isArray(n.suggested_event_keys)?n.suggested_event_keys.filter(o=>typeof o=="string"&&!!o):void 0;return{connector_key:n.connector_key,resource_type:n.resource_type,resource_ref:n.resource_ref,label:n.label,...r?.length?{suggested_event_keys:r}:{}}}const ot=new Set(["localhost","127.0.0.1","::1","[::1]"]);function Vn(e){return e?.trim().toLowerCase().replace(/^\.+|\.+$/g,"")||null}function st(e,t){const n=Vn(t);if(!n)return!1;const r=e.toLowerCase().replace(/\.$/,"");return r===n||r.endsWith(`.${n}`)}function lt(e,t,n){try{const r=new URL(t),o=new URL(e,t),l=ot.has(o.hostname)&&ot.has(r.hostname),i=o.protocol===r.protocol&&(o.protocol==="https:"||o.protocol==="http:")&&st(o.hostname,n)&&st(r.hostname,n);return o.origin!==r.origin&&(l||i)&&(o.protocol=r.protocol,o.host=r.host),o.origin===r.origin&&o.pathname.startsWith("/api/v1/agents")&&(o.pathname=`/lobu${o.pathname}`),o.toString()}catch{return e}}const Bn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,yt=new Set(["suggest_actions"]),Pe="Thinking…";function Hn(e){const{textOut:t,statusLine:n,errorText:r,toolCalls:o}=e,l=[];n===Pe&&l.push({type:"reasoning"}),r&&l.push({type:"error",text:r});let i=t;return n&&n!==Pe&&(i=t?`${t}
2
+
3
+ ${n}`:n),i&&l.push({type:"text",text:i}),l.push(...o),l}const Rt=[];function zn(e,t,n){return e?.length?e:n===0?t:[]}const Ye=a.createContext(null);function Ee(){const e=a.useContext(Ye);if(!e)throw new Error("useLobuChat must be used within <LobuChatProvider>");return e}function Mo({messages:e,workspaceSlug:t=null,children:n}){const r=a.useMemo(()=>({messages:e,running:!1,append:()=>{},cancel:()=>{},pendingAttachments:[],addAttachments:()=>{},removeAttachment:()=>{},agentId:null,conversationId:"",workspaceSlug:t,currentSuggestions:null,starters:Rt}),[e,t]);return s.jsx(Ye.Provider,{value:r,children:n})}const wt=/\[([^\]]*)\]\((\S*?\/api\/v1\/files\/[^)\s]+)\)/g;function at(e){return e.replace(/<lobu_internal_context>[\s\S]*?<\/lobu_internal_context>\n*/g,"").replace(wt,"").replace(/\n{3,}/g,`
4
+
5
+ `).trim()}function Wn(e){const t=[];for(const n of e.matchAll(wt)){const r=n[1]?.trim()||"file",o=n[2];o&&t.push({name:r,url:o})}return t}function Kn(e,t={}){if(typeof e=="string"){const r=at(e);return r?[{type:"text",text:r}]:[]}if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="text"&&typeof o.text=="string"){const l=at(o.text);l&&n.push({type:"text",text:l})}else t.showToolCalls&&o.type==="toolCall"&&typeof o.name=="string"&&!yt.has(o.name)?n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.arguments??{},...o.result!==void 0?{result:o.result}:{}}):t.showToolCalls&&o.type==="tool_use"&&typeof o.name=="string"&&n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.input??{},...o.result!==void 0?{result:o.result}:{}})}return n}function qn(e){const t=[],n=r=>{for(const{name:o,url:l}of Wn(r))t.push({id:`file-${t.length}`,name:o,url:l,isImage:Bn.test(o)})};if(typeof e=="string")return n(e),t.length>0?t:void 0;if(Array.isArray(e)){for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="image"&&typeof o.data=="string"){const l=o.mimeType||"image/png";t.push({id:`img-${t.length}`,name:`image-${t.length+1}`,imageDataUrl:`data:${l};base64,${o.data}`,isImage:!0})}else o.type==="text"&&typeof o.text=="string"&&n(o.text)}return t.length>0?t:void 0}}function Gn(e,t){if(e.type==="bashExecution"){const r=e.content??{},o=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:"user",parts:[{type:"bash",command:r.command??"",output:r.output??"",exitCode:r.exitCode,cancelled:r.cancelled??!1}],createdAt:o&&!Number.isNaN(o)?o:void 0}}if(e.type!=="message"||e.isVerbose||e.role!=="assistant"&&e.role!=="user"&&e.role!=="system")return null;const n=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:e.role,parts:Kn(e.content,t),attachments:qn(e.content),createdAt:n&&!Number.isNaN(n)?n:void 0}}const Xn=[],Yn=[];function Jn(e){let t=null;for(const n of e)n.type==="suggestion"&&(t=n.prompts.length>0?n.prompts:null);return t}function Qn(e,t){if(e.length===0)return null;const n=[];for(const r of e)if(r.type!=="suggestion"){if(r.type==="agent-error"){n.push({type:"error",text:String(r.error??"Agent reported an error.")});const o=xt(r.errorCode,{...t,provider:r.errorContext?.provider,model:r.errorContext?.model});o&&n.push({type:"tool-call",toolCallId:`error-run-${r.runId}`,toolName:"link-button",args:{label:o.label,url:o.href}});continue}n.push({type:"tool-call",toolCallId:`approval-event-${r.eventId}`,toolName:"tool-approval",args:{runId:r.runId,action:r.action,proposal:r.proposal,current:r.current,fields:r.fields??null,attribution:r.attribution??null,resourceKind:r.resourceKind??null,reason:r.reason??null,status:r.status??"pending",reviewedByName:r.reviewedByName??null}})}return n.length===0?null:{id:"history-interactions",role:"assistant",parts:n}}const Zn=3e4,er=3*Zn,tr=15e3;function it(e){try{return JSON.parse(e.data)}catch{return{content:e.data}}}const ye=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;function nr(e){const t=[],n=new Set;for(const r of e){if(!r||typeof r!="object")continue;const{title:o,message:l}=r;if(typeof o!="string"||typeof l!="string")continue;const i=o.trim(),c=l.trim();if(i.length===0||c.length===0)continue;const u=`${i}\0${c}`;n.has(u)||(n.add(u),t.push({title:i,message:c}))}return t.length>0?t:null}function Lo({agentId:e,workspaceSlug:t,thread:n="agent-panel",loadHistory:r=!0,ephemeralContext:o,onFirstUserMessage:l,children:i,initialDraft:c}){const u=Bt(),d=a.useRef(null),p=a.useRef(null),v=a.useRef(!1),m=a.useRef(o),g=a.useRef(!1),R=a.useRef(null);m.current=o;const{data:A,isLoading:x}=Ht(e,n,{orgSlug:t,enabled:r&&!!e&&!!n}),C=A?.messages??Xn,W=A?.interactions??Yn,{data:U}=zt(e,{enabled:!!e}),G=U?.starters??Rt,K=!!(U?.showToolCalls??U?.settings?.showToolCalls),[E,$]=a.useState([]),[Y,ae]=a.useState(!1),[D,X]=a.useState([]),[J,y]=a.useState(null),w=a.useRef(!1);w.current=Y;const j=a.useMemo(()=>C.map(I=>Gn(I,{showToolCalls:K})).filter(I=>I!==null),[C,K]),O=a.useRef(!1);a.useEffect(()=>{if(O.current||x||w.current)return;O.current=!0;const I=Qn(W,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});$(I?[...j,I]:j),y(Jn(W))},[e,x,j,W,t]);const k=a.useCallback(()=>{u.invalidateQueries({queryKey:["agent-thread-messages",t,e,n]}),u.invalidateQueries({queryKey:["agent-threads",t,e]})},[u,t,e,n]),Z=a.useCallback(async()=>{if(d.current)return d.current;if(p.current)return p.current;if(!e)throw new Error("No agent selected");const I=(async()=>{const M=await Ze(`${Ve}/lobu/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json",...t?{"x-lobu-org":t}:{}},credentials:"include",body:JSON.stringify({agentId:e,thread:n}),timeoutMs:2e4});if(!M.ok)throw await et(M);const V=await M.json(),N=Wt(),z={sessionId:V.agentId,sseUrl:lt(V.sseUrl,Ve,N),messagesUrl:lt(V.messagesUrl,Ve,N)};return d.current=z,z})();p.current=I;try{return await I}catch(M){throw d.current=null,M}finally{p.current=null}},[e,t,n]),te=a.useCallback(async(I,M,V)=>{const N=new AbortController;R.current=N;const z=S=>{$(q=>q.map(f=>f.id===V?{...f,parts:S}:f))};let ee;try{ee=await Z()}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Could not start a session."}`}]);return}let B=await tt(ee.sseUrl,{throwOnFailure:!0});const oe=[];let me=null;const ue=()=>{const S=me;me=null,S?.()},he=S=>{oe.push(S),ue()};let ge=!1,be=null;const ke=new Promise(S=>{be=S});let xe=0,ve=Date.now();const de=S=>{ve=Date.now();const q=Number(S.lastEventId);Number.isFinite(q)&&q>xe&&(xe=q)},Ie=["output","status","complete","closed","agent-error","question","link-button","tool-approval","tool_use"],Te=S=>{S.addEventListener("open",()=>{ge=!0,be?.()}),S.addEventListener("connected",f=>{de(f),ge||(ge=!0,be?.())}),S.addEventListener("ping",de);const q=f=>h=>{de(h);const T=h;typeof T.data=="string"&&he({kind:f,payload:it(T)})};for(const f of Ie)S.addEventListener(f,q(f));S.addEventListener("error",f=>{const h=f;if(typeof h.data=="string"&&h.data){de(f),he({kind:"error",payload:it(h)});return}S.readyState===EventSource.CLOSED&&he({kind:"error",payload:{error:"Connection closed"}})})};Te(B);const _e=async()=>{B.close();let S=ee.sseUrl;if(xe){const q=new URL(ee.sseUrl,window.location.origin);q.searchParams.set("since",String(xe)),S=q.toString()}B=await tt(S,{throwOnFailure:!1}),Te(B),ve=Date.now()};await Promise.race([ke,new Promise(S=>setTimeout(S,1500))]);const Ce=()=>{B.close(),ue()};N.signal.addEventListener("abort",Ce,{once:!0});try{const S=m.current?.trim(),q=!!S&&!g.current;q&&(g.current=!0);let f;if(M.length>0){const b=new FormData;b.set("content",I),q&&S&&b.set("ephemeralContext",S);for(const _ of M)b.append("files",_,_.name);f={method:"POST",credentials:"include",body:b,timeoutMs:12e4}}else{const b={content:I};q&&S&&(b.ephemeralContext=S),f={method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(b),timeoutMs:2e4}}const h=await Ze(ee.messagesUrl,f);if(!h.ok)throw d.current=null,await et(h);let T="",L=Pe,ce=null;const H=[],fe=()=>Hn({textOut:T,statusLine:L,errorText:ce,toolCalls:H});for(z(fe());!N.signal.aborted;){if(oe.length===0){let _;const ne=await Promise.race([new Promise(Fe=>{me=()=>Fe(!0)}),new Promise(Fe=>{_=setTimeout(()=>Fe(!1),tr)})]);_&&clearTimeout(_),!ne&&Date.now()-ve>=er&&(await _e(),k());continue}const b=oe.shift();if(b){if(b.kind==="output")L=null,T+=String(b.payload.content??"");else if(b.kind==="status")L=Pe;else if(b.kind==="complete"){L=null;const _=b.payload.finalText;typeof _=="string"&&_.length>0&&(T=_);const ne=b.payload.suggestions;ne!==void 0&&y(Array.isArray(ne)?nr(ne):null),k(),z(fe());return}else if(b.kind==="closed"){d.current=null;const _=b.payload.reason;L=`Session ended${_?`: ${_}`:""}.`,k(),z(fe());return}else if(b.kind==="error"||b.kind==="agent-error"){L=null,ce=typeof b.payload.error=="string"&&b.payload.error?b.payload.error:"Agent reported an error.";const _=b.payload.errorContext&&typeof b.payload.errorContext=="object"?b.payload.errorContext:void 0,ne=xt(b.payload.errorCode,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin,provider:typeof _?.provider=="string"?_.provider:void 0,model:typeof _?.model=="string"?_.model:void 0});ne&&H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:ne.label,url:ne.href}}),k(),z(fe());return}else if(b.kind==="question")H.push({type:"tool-call",toolCallId:ye("q"),toolName:"question",args:{question:b.payload.question??"",options:b.payload.options??[]}});else if(b.kind==="tool_use"){if(L=null,yt.has(b.payload.name??"")){z(fe());continue}const _=b.payload.result_summary,ne=vt(_);if(!K&&!ne){z(fe());continue}H.push({type:"tool-call",toolCallId:b.payload.toolCallId??ye("t"),toolName:K?b.payload.name??"tool":"subscription-candidate",args:K?b.payload.input??{}:null,result:_,isError:b.payload.isError})}else if(b.kind==="link-button")H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:b.payload.label??"Open link",url:b.payload.url??""}});else if(b.kind==="tool-approval"){const _=b.payload.runId;if(typeof _!="number")continue;H.push({type:"tool-call",toolCallId:`run-${_}`,toolName:"tool-approval",args:{runId:_,action:b.payload.action??null,proposal:b.payload.proposal??null,current:b.payload.current??null,fields:b.payload.fields??null,attribution:b.payload.attribution??null,resourceKind:b.payload.resourceKind??null}})}z(fe())}}}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Send failed."}`}])}finally{N.signal.removeEventListener("abort",Ce),B.close()}},[e,Z,k,K,t]),re=a.useCallback(I=>{const M=I.trim(),V=D.map(B=>B.file);if(!M&&V.length===0||w.current||!e)return;v.current||(v.current=!0,l?.(M||V[0]?.name||""));const N={id:ye("u"),role:"user",parts:M?[{type:"text",text:M}]:[],attachments:D.map(B=>({id:B.id,name:B.name,isImage:B.isImage,imageDataUrl:B.isImage?URL.createObjectURL(B.file):void 0})),createdAt:Date.now()},z=ye("asst"),ee={id:z,role:"assistant",parts:[{type:"reasoning"}],createdAt:Date.now()};$(B=>[...B,N,ee]),X([]),ae(!0),w.current=!0,te(M,V,z).finally(()=>{ae(!1),w.current=!1,R.current=null})},[e,l,D,te]),le=a.useCallback(()=>{R.current?.abort()},[]),Se=a.useCallback(I=>{const M=Array.from(I);X(V=>[...V,...M.map(N=>({id:crypto.randomUUID(),name:N.name,file:N,isImage:N.type.startsWith("image/")}))])},[]),Q=a.useCallback(I=>{X(M=>M.filter(V=>V.id!==I))},[]),ie=a.useRef(!1);a.useEffect(()=>{if(ie.current)return;const I=Kt(n);I&&(ie.current=!0,re(I))},[n,re]);const F=a.useMemo(()=>({messages:E,running:Y,append:re,cancel:le,pendingAttachments:D,addAttachments:Se,removeAttachment:Q,initialDraft:c,agentId:e,conversationId:n,workspaceSlug:t,currentSuggestions:J,starters:G}),[E,Y,re,le,D,Se,Q,c,e,n,t,J,G]);return r&&x?s.jsx(wn,{}):s.jsx(Ye.Provider,{value:F,children:i})}const ct="mx-0.5 inline-flex items-center gap-1 rounded-md bg-accent px-1.5 py-0.5 align-baseline font-medium text-[0.9em] text-accent-foreground no-underline";function rr({refItem:e}){const t=En[e.kind]??qt;return An(e.path)?s.jsxs("span",{className:ct,children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]}):s.jsxs(mt,{to:e.path,className:P(ct,"hover:bg-accent/80"),children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]})}const Je=({text:e,renderText:t})=>jn(e)?s.jsx(s.Fragment,{children:Nn(e).map((n,r)=>n.type==="ref"?s.jsx(rr,{refItem:n.ref},`r${r}`):s.jsx("span",{children:t(n.text)},`t${r}`))}):s.jsx(s.Fragment,{children:t(e)}),or=({label:e="Thinking"})=>s.jsx("span",{className:"aui-thinking-shimmer inline-block text-sm","aria-live":"polite","aria-busy":"true",children:e}),St=a.createContext(null),Tt=()=>{const e=a.useContext(St);if(!e)throw new Error("ChainOfThought components must be used within ChainOfThought");return e},Ct=a.memo(({className:e,open:t,defaultOpen:n=!1,onOpenChange:r,children:o,...l})=>{const[i,c]=Gt({prop:t,defaultProp:n,onChange:r}),u=a.useMemo(()=>({isOpen:i,setIsOpen:c}),[i,c]);return s.jsx(St.Provider,{value:u,children:s.jsx("div",{className:P("not-prose max-w-prose space-y-4",e),...l,children:o})})}),jt=a.memo(({className:e,children:t,...n})=>{const{isOpen:r,setIsOpen:o}=Tt();return s.jsx(ht,{onOpenChange:o,open:r,children:s.jsxs(Xt,{className:P("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:[s.jsx(Yt,{className:"size-4"}),s.jsx("span",{className:"flex-1 text-left",children:t??"Chain of Thought"}),s.jsx(Jt,{className:P("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),Nt=a.memo(({className:e,icon:t=Zt,label:n,description:r,status:o="complete",children:l,...i})=>{const c={complete:"text-muted-foreground",active:"text-foreground",pending:"text-muted-foreground/50"};return s.jsxs("div",{className:P("flex gap-2 text-sm",c[o],"fade-in-0 slide-in-from-top-2 animate-in",e),...i,children:[s.jsxs("div",{className:"relative mt-0.5",children:[s.jsx(t,{className:"size-4"}),s.jsx("div",{className:"-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border"})]}),s.jsxs("div",{className:"flex-1 space-y-2 overflow-hidden",children:[s.jsx("div",{children:n}),r&&s.jsx("div",{className:"text-muted-foreground text-xs",children:r}),l]})]})}),Et=a.memo(({className:e,children:t,...n})=>{const{isOpen:r}=Tt();return s.jsx(ht,{open:r,children:s.jsx(Qt,{className:P("mt-2 space-y-3","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t})})});Ct.displayName="ChainOfThought";jt.displayName="ChainOfThoughtHeader";Nt.displayName="ChainOfThoughtStep";Et.displayName="ChainOfThoughtContent";function sr(e){return{contentIds:e.filter(n=>Number.isSafeInteger(n)&&n>0),sortBy:"date",sortOrder:"asc"}}function lr({ownerSlug:e,eventIds:t}){const n=t.join(","),r=a.useMemo(()=>sr(n.split(",").map(Number)),[n]);return r.contentIds.length===0?null:s.jsx(en,{owner:e,children:({organizationId:o,ownerSlug:l})=>o?s.jsx(On,{organizationId:o,ownerSlug:l,filters:r,hideOriginator:!0}):null})}function ar({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=He(ir(r,o),t);if(!n)return a.createElement(e,l);if(typeof n=="function")return n(l,r);if(!a.isValidElement(n))return null;let i=n.props,c={...He(l,i),ref:Ae(l.ref,i.ref)};return a.cloneElement(n,c)}function He(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let l=r[o];if(l===void 0)continue;let i=t[o];o==="className"?t[o]=[i,l].filter(Boolean).join(" "):o==="style"?t[o]={...i,...l}:o==="ref"?t[o]=Ae(i,l):ur(o)&&typeof i=="function"&&typeof l=="function"?t[o]=cr(l,i):t[o]=l}}return t}function ir(e,t){let n={};for(let r of Object.keys(e)){let o=e[r],l=t?.[r]?.(o);if(l){Object.assign(n,l);continue}if(r==="slot"){n["data-slot"]=o;continue}let i=`data-${String(r).replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`;typeof o=="boolean"?n[i]=o?"":void 0:o!=null&&(n[i]=String(o))}return n}function cr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function ur(e){return/^on[A-Z]/.test(e)}function Ae(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var dr=8,fr=64,pr=0,Me=.5,mr=180,hr=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),At={start:!1,end:!1},gr=[],Le={currentAnchorId:null,visibleMessageIds:gr};function br({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return At;let o=Qe({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function xr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return Le;let i=o.getBoundingClientRect(),c=i.top+t+n,u=typeof IntersectionObserver>"u",d=[],p=null;for(let v of je(e,r)){let m=v.dataset.messageId;if(!m)continue;let g=v.dataset.scrollAnchor==="true",R=g||u?v.getBoundingClientRect():null;(u&&R?R.bottom>c&&R.top<i.bottom:l.has(m))&&d.push(m),g&&R&&R.top<=c+Me&&(p=m)}return d.length===0&&p===null?Le:{currentAnchorId:p,visibleMessageIds:d}}function je(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function vr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r?.dataset.scrollAnchor==="true")return r}return null}function yr(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function Rr(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor==="true"&&(n+=1,n>1))return!0;return!1}function wr(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor==="true")return n}return null}function Sr({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of je(e,t)){if(!o.dataset.messageId)continue;let l=o.getBoundingClientRect();if(l.bottom>r.top&&l.top<r.bottom)return o}return null}function Tr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=kt(t,o),i=t.getBoundingClientRect().height,c=Nr(r);if(e==="center"){let u=Math.max(0,o.clientHeight-c.start-c.end);return l-c.start-(u-i)/2-n}if(e==="end")return l-o.clientHeight+i+c.end+n;if(e==="nearest"){let u=l+i,d=o.scrollTop+c.start,p=o.scrollTop+o.clientHeight-c.end;return l>=d&&u<=p?o.scrollTop:l<d?l-c.start-n:u-o.clientHeight+c.end+n}return l-c.start-n}function kt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Oe(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Cr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Qe({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Qe({content:e,spacer:t,viewport:n}){let r=je(e,t),o=It(e),l=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let u of r){let d=u.getBoundingClientRect();c=Math.max(c,d.bottom-l.top+i+o.end)}return c}function jr(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function It(e){let t=window.getComputedStyle(e);return{end:ze(t.paddingBlockEnd||t.paddingBottom),start:ze(t.paddingBlockStart||t.paddingTop)}}function Nr(e){let t=e?.parentElement;return t?It(t):{end:0,start:0}}function Er(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return ze(n)}function ze(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Ar({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:u,defaultScrollPositionAppliedRef:d,itemCountRef:p,messageElementsRef:v,modeRef:m,pendingScrollToMessageRef:g,prependRestoreRef:R,scrollMarginRef:A,scrollPreviousItemPeekRef:x,spacerGapRef:C,spacerHeightRef:W,spacerRef:U,viewportRef:G}=e,K=a.useCallback(y=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==y&&(i.current=y,t()),y&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},mr))},[t]),E=a.useCallback(y=>{let w=U.current;if(!w)return;let j=Math.max(0,Math.ceil(y));W.current!==j&&(W.current=j,w.hidden=j===0,w.style.height=`${j}px`,w.style.marginTop=j>0?`${-C.current}px`:"")},[]),$=a.useCallback((y,{behavior:w="auto",autoscrolling:j=!1}={})=>{let O=G.current;if(!O)return;let k=Math.max(0,y);if(Math.abs(O.scrollTop-k)<=Me){O.scrollTop=k,t();return}j&&K(!0),O.scrollTo({top:k,behavior:w}),n()},[t,n,K]),Y=a.useCallback(({behavior:y="auto"}={})=>G.current?(E(0),o.current=null,m.current="free-scrolling",$(0,{behavior:y}),r(),!0):!1,[r,$,E]),ae=a.useCallback(({behavior:y="auto"}={})=>{let w=G.current;return w?(E(0),o.current=null,m.current=l.current?"following-bottom":"free-scrolling",$(jr(w),{autoscrolling:!0,behavior:y}),r(),!0):!1},[r,$,E]),D=a.useCallback((y,{align:w="start",behavior:j="auto",scrollMargin:O=A.current}={},{keepPreviousPeek:k=!1}={})=>{let Z=u.current,te=G.current;if(!Z||!te||!Z.contains(y))return!1;let re=Tr({align:w,element:y,scrollMargin:k?O+x.current:O,spacer:U.current,viewport:te}),le=Cr({content:Z,scrollTop:re,spacer:U.current,viewport:te});return E(le),R.current={element:y,viewportTop:Oe(y,te)},m.current=k?"anchored-to-message":"settling-jump",o.current=k?y:null,$(re,{behavior:j}),r(),!0},[r,$,E]),X=a.useCallback(()=>{let y=o.current;return!y||!y.isConnected||m.current!=="anchored-to-message"?!1:D(y,{align:"start"},{keepPreviousPeek:!0})},[D]),J=a.useCallback((y,w)=>{let j=v.current.get(y);return j?(d.current=!0,D(j,w)?(g.current=null,!0):(g.current={messageId:y,options:w},!0)):p.current===0?(g.current={messageId:y,options:w},d.current=!0,!0):!1},[D]);return{flushPendingScrollToMessage:a.useCallback(()=>{let y=g.current;if(!y)return!1;let w=v.current.get(y.messageId);return!w||!D(w,y.options)?!1:(g.current=null,d.current=!0,!0)},[D]),reanchorToAnchoredMessage:X,scrollToElement:D,scrollToEnd:ae,scrollToMessage:J,scrollToStart:Y}}function _t(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(l=>l()))},subscribe:(o,l,i)=>{let c=r.size===0;return r.add(o),c&&l?.(),()=>{r.delete(o),r.size===0&&i?.()}}}}function kr(e,t){return _t(e,t)}function Ir(){return _t(Le,Or)}function _r(e,t){return e.start===t.start&&e.end===t.end}function Or(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Pr({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let o=a.useRef(e),l=a.useRef(!1),i=a.useRef(null),c=a.useRef(!1),u=a.useRef(t),d=a.useRef(0),p=a.useRef(null),v=a.useRef(0),m=a.useRef(e?"following-bottom":"free-scrolling"),g=a.useRef(new Map),R=a.useRef(null),A=a.useRef(null),x=a.useRef(null),C=a.useRef(r),W=a.useRef(!0),U=a.useRef(null),G=a.useRef(n),K=a.useRef(null),E=a.useRef(0),$=a.useRef(0),Y=a.useRef(null),ae=a.useRef(null),D=a.useRef(null),X=a.useRef(null),J=a.useRef(null),y=a.useRef(null),w=a.useRef(null),j=a.useRef(null),O=a.useRef(new Set),k=a.useRef(new WeakSet);return D.current===null&&(D.current=kr(At,_r)),j.current===null&&(j.current=Ir()),o.current=e,u.current=t,G.current=n,C.current=r,{autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:X,streamingTurnRef:x,contentRef:i,defaultScrollPositionAppliedRef:c,firstItemRef:p,itemCountRef:d,lastScrollTopRef:v,messageElementsRef:g,modeRef:m,pendingScrollFrameRef:K,pendingScrollToMessageRef:R,prependRestoreRef:A,preserveScrollOnPrependRef:W,rootRef:U,scrollEdgeThresholdRef:u,scrollMarginRef:G,scrollPreviousItemPeekRef:C,spacerGapRef:E,spacerHeightRef:$,spacerRef:Y,stateFrameRef:ae,stateStore:D.current,viewportRef:J,visibilityFrameRef:y,visibilityObserverRef:w,visibilityStore:j.current,visibleMessageIdsRef:O,handledScrollAnchorsRef:k}}function ut(e,t){return a.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Mr({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=dr,scrollPreviousItemPeek:r=fr,scrollMargin:o=pr}){let l=Pr({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:u,autoscrollingTimeoutRef:d,contentRef:p,defaultScrollPositionAppliedRef:v,firstItemRef:m,itemCountRef:g,lastScrollTopRef:R,messageElementsRef:A,modeRef:x,pendingScrollFrameRef:C,pendingScrollToMessageRef:W,prependRestoreRef:U,preserveScrollOnPrependRef:G,rootRef:K,scrollEdgeThresholdRef:E,scrollMarginRef:$,scrollPreviousItemPeekRef:Y,spacerGapRef:ae,spacerHeightRef:D,spacerRef:X,stateFrameRef:J,stateStore:y,viewportRef:w,visibilityFrameRef:j,visibilityObserverRef:O,visibilityStore:k,visibleMessageIdsRef:Z,handledScrollAnchorsRef:te}=l,re=a.useRef(t);re.current!==t&&(re.current=t,v.current=!1);let le=a.useCallback(f=>{let h=K.current,T=w.current,L=[f.start&&"start",f.end&&"end"].filter(Boolean).join(" "),ce=u.current;for(let H of[h,T])H&&(L?H.setAttribute("data-scrollable",L):H.removeAttribute("data-scrollable"),H.toggleAttribute("data-autoscrolling",ce))},[]),Se=a.useCallback(f=>{let h=w.current?.scrollTop??0,T=h<R.current-Me;R.current=h,c.current&&!f.end&&x.current!=="settling-jump"&&x.current!=="anchored-to-message"?x.current="following-bottom":x.current==="following-bottom"&&f.end&&T&&!u.current&&(x.current="free-scrolling")},[]),Q=a.useCallback(()=>{let f=br({content:p.current,scrollEdgeThreshold:E.current,spacer:X.current,viewport:w.current});Se(f);let h=x.current==="following-bottom"?{...f,end:!1}:f;le(h),y.setSnapshot(h)},[Se,y,le]),ie=a.useCallback(()=>{J.current===null&&(J.current=window.requestAnimationFrame(()=>{J.current=null,Q()}))},[Q]),F=a.useCallback(()=>{k.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,k.hasListeners()&&k.setSnapshot(xr({content:p.current,scrollMargin:$.current,scrollPreviousItemPeek:Y.current,spacer:X.current,viewport:w.current,visibleMessageIds:Z.current}))}))},[k]),{flushPendingScrollToMessage:I,reanchorToAnchoredMessage:M,scrollToElement:V,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee}=Ar({refs:l,commitScrollState:Q,scheduleStateCommit:ie,scheduleVisibilitySync:F}),B=a.useCallback(()=>{let f=U.current,h=w.current;if(!f||!h||!f.element.isConnected)return!1;let T=Oe(f.element,h)-f.viewportTop;return Math.abs(T)<=Me?!1:(h.scrollTop+=T,f.viewportTop=Oe(f.element,h),ie(),F(),!0)},[ie,F]),oe=a.useCallback(()=>{let f=p.current,h=w.current;if(!f||!h){U.current=null;return}let T=Sr({content:f,spacer:X.current,viewport:h});U.current=T?{element:T,viewportTop:Oe(T,h)}:null},[]),me=a.useCallback(()=>{C.current===null&&(C.current=window.requestAnimationFrame(()=>{C.current=null,I()&&oe()}))},[oe,I]),ue=a.useCallback(()=>{if(!t||v.current||g.current===0)return!1;let f=!1;if(t==="last-anchor"){let h=p.current,T=w.current,L=h&&T?wr(je(h,X.current)):null;if(!h||!T||!L)f=N({behavior:"auto"});else{let ce=kt(L,T);f=Qe({content:h,spacer:X.current,viewport:T})-ce<=T.clientHeight?N({behavior:"auto"}):V(L,{align:"start"},{keepPreviousPeek:!0})}}else f=t==="end"?N({behavior:"auto"}):ee({behavior:"auto"});return f?(v.current=!0,!0):!1},[t,V,N,ee]),he=a.useCallback(()=>{let f=p.current;if(!f)return;let h=je(f,X.current),T=g.current,L=m.current;g.current=h.length,m.current=h[0]??null,(()=>{if(I())return;if(T===0){if(ue()||h.length>0&&c.current&&N({behavior:"auto"}))return;Q(),F();return}let ce=L?h.indexOf(L):-1;if(G.current&&ce>0){B();return}if(h.length>T){let H=vr(h,T);if(H){if(c.current&&x.current==="following-bottom"&&Rr(h,T)){N({behavior:"auto"});return}V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}if(h.length===T){let H=yr(h,te.current);if(H){V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}x.current==="following-bottom"&&c.current?N({behavior:"auto"}):(Q(),F())})(),oe()},[ue,oe,Q,I,B,F,V,N]),ge=a.useCallback(()=>{if(x.current==="following-bottom"&&c.current){N({behavior:"auto"});return}let f=D.current;if(M()){c.current&&f>0&&D.current===0&&N({behavior:"auto"});return}ie(),F()},[M,ie,F,N]),be=a.useCallback(()=>{let f=w.current;if(!(!f||!k.hasListeners())){if(typeof IntersectionObserver>"u"){F();return}O.current||(O.current=new IntersectionObserver(h=>{for(let T of h){let L=T.target.dataset.messageId;L&&(T.isIntersecting?Z.current.add(L):Z.current.delete(L))}F()},{root:f,rootMargin:`${-($.current+Y.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),A.current.forEach(h=>{O.current?.observe(h)}),F()}},[F,k]),ke=a.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),O.current?.disconnect(),O.current=null,Z.current.clear(),k.setSnapshot(Le)},[k]),xe=a.useCallback((f,h,T)=>{if(h){A.current.set(f,h),O.current?.observe(h),F(),W.current?.messageId===f&&me();return}T&&A.current.get(f)===T&&(A.current.delete(f),Z.current.delete(f),O.current?.unobserve(T),F())},[me,F]),ve=a.useCallback(()=>{(x.current==="following-bottom"||x.current==="anchored-to-message"||x.current==="settling-jump")&&(i.current=null,x.current="free-scrolling")},[]),de=a.useCallback(()=>le(y.getSnapshot()),[y,le]),Ie=ut(K,de),Te=ut(w,de),_e=a.useCallback(f=>{p.current=f},[]),Ce=a.useCallback(f=>{X.current=f,ae.current=Er(f?.parentElement??null)},[]),S=a.useCallback(()=>{Q(),F(),oe()},[oe,Q,F]),q=a.useMemo(()=>({handleContentChange:he,handleResize:ge,observeVisibility:be,preserveScrollOnPrependRef:G,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee,setContentElement:_e,setRootElement:Ie,setSpacerElement:Ce,setViewportElement:Te,stateStore:y,syncAfterScroll:S,unobserveVisibility:ke,userScrollIntent:ve,viewportRef:w,visibilityStore:k}),[he,ge,be,N,z,ee,_e,Ie,Ce,Te,y,S,ke,ve,k]);return a.useLayoutEffect(()=>{ue()},[ue]),a.useEffect(()=>()=>{J.current!==null&&(window.cancelAnimationFrame(J.current),J.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),C.current!==null&&(window.cancelAnimationFrame(C.current),C.current=null),O.current?.disconnect(),O.current=null},[]),a.useLayoutEffect(()=>{if(e&&x.current==="following-bottom"&&g.current>0){N({behavior:"auto"});return}Q()},[e,Q,N]),{context:q,registerMessage:xe}}function Lr(e){let t=a.useRef(e);return t.current=e,t}var Ot=a.createContext(null),Pt=a.createContext(null);function Re(){let e=a.useContext(Ot);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function $r(){let e=a.useContext(Pt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Mt(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=Re();return a.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function Lt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:n}=Re(),r=a.useCallback(o=>n.subscribe(o,e,t),[e,t,n]);return a.useSyncExternalStore(r,n.getSnapshot,n.getSnapshot)}function Dr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:i,registerMessage:c}=Mr({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(Ot.Provider,{value:i,children:s.jsx(Pt.Provider,{value:c,children:t})})}function Ur({children:e,...t}){let{setRootElement:n}=Re();return s.jsx("div",{ref:n,...t,children:e})}function Fr({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:i=!0,ref:c,role:u,tabIndex:d,...p}){let{handleResize:v,preserveScrollOnPrependRef:m,setViewportElement:g,syncAfterScroll:R,userScrollIntent:A,viewportRef:x}=Re();m.current=i;let C=a.useCallback(E=>{g(E),Ae(c)?.(E)},[c,g]);function W(E){R(),r?.(E)}function U(E){A(),l?.(E)}function G(E){A(),o?.(E)}function K(E){hr.has(E.key)&&A(),n?.(E)}return a.useEffect(()=>{let E=x.current;if(!E||typeof ResizeObserver>"u")return;let $=0,Y=new ResizeObserver(()=>{window.cancelAnimationFrame($),$=window.requestAnimationFrame(v)});return Y.observe(E),()=>{window.cancelAnimationFrame($),Y.disconnect()}},[v,x]),s.jsx("div",{ref:C,role:u??"region","aria-label":e??"Messages",tabIndex:d??0,onKeyDown:K,onScroll:W,onTouchMove:G,onWheel:U,...p,children:t})}function Vr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:i,handleResize:c,setContentElement:u,setSpacerElement:d}=Re(),p=a.useRef(null),v=a.useCallback(m=>{p.current=m,u(m),Ae(n)?.(m)},[n,u]);return a.useLayoutEffect(()=>{let m=p.current;if(!m||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(m,{childList:!0}),()=>g.disconnect()},[i]),a.useEffect(()=>{let m=p.current;if(!m||typeof ResizeObserver>"u")return;let g=0,R=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return R.observe(m),()=>{window.cancelAnimationFrame(g),R.disconnect()}},[c]),s.jsxs("div",{ref:v,role:r??"log","aria-relevant":e??"additions",...l,children:[t,s.jsx("div",{ref:d,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Br({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=$r(),l=a.useRef(null),i=a.useCallback(c=>{let u=l.current;l.current=c,e&&o(e,c,u),Ae(t)?.(c)},[e,t,o]);return s.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Hr({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:i="button",...c}){let{scrollToEnd:u,scrollToStart:d,stateStore:p}=Re(),v=Lr(r),m=a.useCallback(x=>p.subscribe(x),[p]),g=a.useCallback(()=>{let x=p.getSnapshot();return n==="start"?x.start:x.end},[n,p]),R=a.useSyncExternalStore(m,g,g),A=a.useCallback(x=>{R&&(v.current?.(x),x.defaultPrevented||(x.currentTarget.blur(),n==="start"?d({behavior:e}):u({behavior:e})))},[e,n,R,v,u,d]);return ar({defaultTagName:"button",props:He({type:i,inert:!R,tabIndex:R?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:A},c),render:o,state:{active:R,direction:n},stateAttributesMapping:{active:x=>({"data-active":x?"true":"false"})}})}var we={Provider:Dr,Root:Ur,Viewport:Fr,Content:Vr,Item:Br,Button:Hr};const zr=we.Provider;function Wr({className:e,...t}){return s.jsx(we.Root,{className:P("relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function Kr({className:e,...t}){return s.jsx(we.Viewport,{className:P("size-full min-h-0 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",e),...t})}function qr({className:e,...t}){return s.jsx(we.Content,{className:P("flex h-max min-h-full flex-col",e),...t})}function Gr({className:e,...t}){return s.jsx(we.Item,{className:P("min-w-0 shrink-0",e),...t})}function Xr({className:e,...t}){return s.jsx(we.Button,{direction:"end",behavior:"smooth",render:({active:n,...r})=>n?s.jsx(pe,{...r,type:"button",variant:"outline",size:"icon",className:P("absolute right-4 bottom-4 z-20 rounded-full bg-background ",e),"aria-label":"Scroll to latest message",children:s.jsx(tn,{})}):null,...t})}function Yr(e){if(!e)return"";const t=e.startsWith("?")?e.slice(1):e,n=new URLSearchParams(t);return n.get("message_id")?.trim()||n.get("message")?.trim()||""}function Jr(e){const t=e.scrollTarget.trim();return t?e.alreadyScrolledTo===t?{scroll:!1}:e.messageIds.includes(t)?{scroll:!0,id:t}:{scroll:!1}:{scroll:!1}}const Qr="lobu-spa";function dt(e){return typeof e=="string"&&/^https?:\/\//i.test(e.trim())}function $e(e,t){return t.type==="tool-call"?`tc-${t.toolCallId}`:t.type==="reasoning"?`${e.id}-reasoning`:t.type==="bash"?`${e.id}-bash-${t.command.slice(0,24)}`:t.type==="error"?`${e.id}-error`:`${e.id}-text-${t.text.slice(0,24)}`}const $o=({afterMessagesContent:e,readOnly:t=!1,readerPositionMode:n="messages",interactionExtension:r,onRunSelect:o})=>{const{messages:l,agentId:i,conversationId:c}=Ee(),{data:u=[]}=nn(i,{conversationId:c});return s.jsx(Mn,{extension:r,children:s.jsxs("div",{"data-agent-thread":!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsx(Zr,{messages:l,trips:u,mode:n,afterMessagesContent:e,onRunSelect:o}),t?null:s.jsx("div",{className:Sn,children:s.jsx(Eo,{})})]})})},Zr=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>s.jsx(zr,{autoScroll:!0,defaultScrollPosition:n==="runs"?"last-anchor":"end",scrollPreviousItemPeek:48,children:s.jsx(to,{messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})});function eo(e){if(!e.startsWith("sep:"))return null;const t=Number(e.slice(4));return Number.isFinite(t)&&t>0?t:null}const to=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>{const{currentAnchorId:l}=Lt(),{scrollToMessage:i}=Mt(),c=a.useRef(null);a.useEffect(()=>{if(e.length===0||typeof window>"u")return;const d=Jr({messageIds:e.map(p=>p.id),scrollTarget:Yr(window.location.search),alreadyScrolledTo:c.current});d.scroll&&(c.current=d.id,i(d.id,{align:"start",behavior:"smooth"}))},[e,i]);const u=d=>n==="runs"?d.id.startsWith("sep:"):d.role==="user";return s.jsxs(Wr,{children:[s.jsx(Kr,{"aria-label":n==="runs"?"Automation run history":"Conversation",children:s.jsxs(qr,{className:P(qe,Tn),children:[e.map(d=>{const p=n==="runs"&&o?eo(d.id):null;return s.jsx(Gr,{messageId:d.id,scrollAnchor:u(d),"aria-current":d.id===l?"location":void 0,className:P("flex flex-col",n==="runs"&&u(d)&&"border-l-2 border-transparent pl-2 transition-colors",n==="runs"&&d.id===l&&"border-primary"),children:p!=null?s.jsx(go,{message:d,onClick:()=>o?.(p)}):s.jsx(so,{message:d})},d.id)}),t.map(d=>s.jsx(ro,{trip:d},d.id)),s.jsx(oo,{}),r?s.jsx("div",{className:"mt-auto shrink-0 py-2",children:r}):null]})}),e.length>0?s.jsx(no,{messages:e,mode:n}):null,s.jsx(Xr,{})]})},no=({messages:e,mode:t})=>{const{scrollToMessage:n}=Mt(),{currentAnchorId:r,visibleMessageIds:o}=Lt(),l=t==="runs"?e.flatMap(c=>c.parts).filter(c=>c.type==="tool-call"&&c.toolName==="tool-approval"&&c.args!==null&&typeof c.args=="object"&&c.args.status==="pending").length:0,i=e.flatMap(c=>{if(!(t==="runs"?c.id.startsWith("sep:"):c.role==="user"))return[];const d=c.parts.find(p=>p.type==="text");return[{id:c.id,label:d?.type==="text"?d.text:"Automation run"}]});return i.length===0?null:s.jsxs(cn,{children:[s.jsx(un,{asChild:!0,children:s.jsxs(pe,{type:"button",variant:"outline",size:"icon",className:P("absolute top-1/2 right-4 z-20 -translate-y-1/2 rounded-full bg-background/95 ",l>0&&"w-auto px-3"),"aria-label":l>0?`Open transcript outline, ${l} ${l===1?"approval":"approvals"} waiting`:"Open transcript outline",children:[s.jsx(dn,{}),l>0?s.jsxs("span",{className:"text-xs tabular-nums",children:[l," waiting"]}):null]})}),s.jsxs(fn,{side:"left",align:"center",className:"w-80 space-y-3 p-3",children:[s.jsxs("div",{className:"px-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"Transcript outline"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:t==="runs"?"Track and jump between Automation runs.":"Track and jump between your messages."})]}),s.jsx("div",{className:"max-h-80 space-y-1 overflow-y-auto",children:i.map(c=>{const u=c.id===r,d=o.includes(c.id);return s.jsxs(pe,{type:"button",variant:u?"secondary":"ghost",className:"h-auto w-full justify-start gap-2 px-2 py-2 text-left text-xs font-normal","aria-current":u?"location":void 0,onClick:()=>n(c.id,{align:"start",behavior:"smooth"}),children:[s.jsx("span",{className:P("size-1.5 shrink-0 rounded-full bg-muted-foreground/30",d&&"bg-primary/60",u&&"bg-primary")}),s.jsx("span",{className:"line-clamp-2",children:c.label})]},c.id)})})]})]})},ro=({trip:e})=>s.jsxs("div",{className:P(qe,"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive"),children:[s.jsx(ln,{className:"mt-0.5 size-4 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-medium",children:["Guardrail blocked: ",e.guardrailName," ",s.jsxs("span",{className:"font-normal opacity-70",children:["(",e.stage,")"]})]}),e.reason?s.jsx("div",{className:"mt-0.5 break-words opacity-80",children:e.reason}):null]})]}),oo=()=>{const{currentSuggestions:e,starters:t,messages:n,running:r,append:o}=Ee(),l=zn(e,t,n.length);return r||l.length===0?null:s.jsx(an,{prompts:l,className:P(qe,n.length===0&&"mt-auto"),onPick:i=>o(i)})},so=({message:e})=>e.role==="user"?s.jsx(lo,{message:e}):e.role==="system"?s.jsx(bo,{message:e}):s.jsx(co,{message:e}),$t=({attachment:e})=>{const t=e.isImage?e.imageDataUrl??e.url:void 0;if(t)return s.jsx("a",{href:e.url??t,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:t,alt:e.name,className:"max-h-64 rounded-lg border object-contain"})});const n=s.jsxs(s.Fragment,{children:[s.jsx(Be,{className:"h-3 w-3 shrink-0"}),s.jsx("span",{className:"max-w-[14rem] truncate",children:e.name})]});return s.jsx("div",{className:"flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 text-xs",children:e.url?s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1.5 hover:underline",children:n}):n})},lo=({message:e})=>{const t=e.parts.filter(n=>n.type==="bash");return t.length>0?s.jsx("div",{className:gt,children:s.jsx("div",{className:"space-y-2",children:t.map(n=>s.jsx(ao,{part:n},$e(e,n)))})}):s.jsx("div",{className:Cn,children:s.jsxs("div",{className:P(Ne,"px-3 py-2 text-sm"),children:[e.attachments&&e.attachments.length>0?s.jsx("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:e.attachments.map(n=>s.jsx($t,{attachment:n},n.id))}):null,e.parts.map(n=>n.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Je,{text:n.text,renderText:r=>r})},$e(e,n)):null)]})})},ao=({part:e})=>{const t=e.cancelled||e.exitCode!==void 0&&e.exitCode!==0;return s.jsxs("div",{className:P(Ne,"overflow-hidden text-xs"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 border-border/60 border-b px-3 py-1.5",children:[s.jsx(pn,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-foreground/90",children:e.command}),e.cancelled?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-medium text-[10px] text-muted-foreground",children:"cancelled"}):t?s.jsxs("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:["exit ",e.exitCode]}):null]}),e.output.trim()?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-foreground/80",children:e.output}):null]})},Dt=new Set(["question","link-button","tool-approval"]),io="subscription-candidate",co=({message:e})=>{const t=Ge(),{agentId:n,workspaceSlug:r}=Ee(),o=u=>u.type==="tool-call"&&(Dt.has(u.toolName)||t?.toolNames.has(u.toolName)),l=e.parts.filter(u=>u.type==="tool-call"&&!o(u)&&u.toolName!==io),i=e.parts.filter(u=>u.type!=="tool-call"||o(u)),c=e.parts.flatMap(u=>{if(u.type!=="tool-call")return[];const d=vt(u.result);return d?[d]:[]});return s.jsx("div",{className:gt,children:s.jsxs("div",{className:"space-y-2 text-sm",children:[l.length>0?s.jsx(po,{tools:l,workspaceSlug:r}):null,n&&r?c.map(u=>s.jsx(uo,{candidate:u,agentId:n,workspaceSlug:r},`${u.connector_key}:${u.resource_ref}`)):null,i.map(u=>s.jsx(ho,{part:u},$e(e,u))),e.attachments&&e.attachments.length>0?s.jsx("div",{className:"flex flex-wrap gap-2",children:e.attachments.map(u=>s.jsx($t,{attachment:u},u.id))}):null]})})},uo=({candidate:e,agentId:t,workspaceSlug:n})=>s.jsxs("div",{className:P(Ne,"flex items-center justify-between gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:e.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Run this agent when the resource changes."})]}),s.jsx(pe,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:s.jsxs(mt,{to:"/$owner/automations/new",params:{owner:n},search:{agent:t,platform:e.connector_key,resource_type:e.resource_type,resource:e.resource_ref,events:e.suggested_event_keys?.join(","),label:e.label},children:[s.jsx(hn,{className:"mr-1.5 h-4 w-4"}),"Add automation"]})})]});function fo(e){try{return JSON.parse(e)}catch{return null}}function Ut(e){if(Array.isArray(e)){const o=e.flatMap(l=>l?.type==="text"&&typeof l.text=="string"?Ut(l.text)??[]:[]);return o.length>0?[...new Set(o)]:null}const t=typeof e=="string"&&e.trimStart().startsWith("{")?fo(e):e;if(!t||typeof t!="object")return null;const n=t.events_persisted;if(!Array.isArray(n))return null;const r=n.flatMap(o=>{const l=o&&typeof o=="object"?o.id:null;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?[l]:[]});return r.length>0?r:null}const po=({tools:e,workspaceSlug:t})=>s.jsxs(Ct,{defaultOpen:!1,children:[s.jsx(jt,{children:e.length===1?nt(e[0].args,e[0].toolName)??e[0].toolName:`${e.length} tool calls`}),s.jsx(Et,{children:e.map(n=>{const r=nt(n.args,n.toolName),o=n.args!==void 0&&n.args!==null,l=n.result!==void 0&&n.result!==null,i=Ut(n.result);return s.jsxs(Nt,{icon:mn,label:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-medium",children:r??n.toolName}),r?s.jsx("span",{className:"text-muted-foreground",children:n.toolName}):null,n.isError?s.jsx("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:"error"}):null]}),status:n.isError?"active":"complete",children:[o?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.args)}):null,l?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.result)}):null,i&&t?s.jsx(lr,{ownerSlug:t,eventIds:i}):null]},n.toolCallId)})})]}),mo=({text:e})=>{let t=e,n=null;const r=e.match(/\{[\s\S]*\}/);if(r)try{const l=JSON.parse(r[0])?.error?.message;typeof l=="string"&&l.trim()&&(t=l,n=e)}catch{}return s.jsxs("div",{className:"flex gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm",children:[s.jsx(bn,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground/80",children:t}),n&&s.jsxs("details",{className:"text-xs text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer select-none hover:text-foreground",children:"Technical details"}),s.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-all font-mono",children:n})]})]})]})},ho=({part:e})=>{const t=Ge();return e.type==="reasoning"?s.jsx(or,{}):e.type==="error"?s.jsx(mo,{text:e.text}):e.type==="text"?e.text.trim()?s.jsx(Je,{text:e.text,renderText:n=>s.jsx(gn,{text:n})}):null:e.type!=="tool-call"?null:Dt.has(e.toolName)||t?.toolNames.has(e.toolName)?s.jsx(No,{toolName:e.toolName,args:e.args}):null},go=({message:e,onClick:t})=>{const n=e.parts.find(r=>r.type==="text");return s.jsx("button",{type:"button",onClick:t,className:P(Ne,"block w-full cursor-pointer whitespace-pre-wrap break-words px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/50"),children:n?.type==="text"?n.text:"Automation run"})},bo=({message:e})=>s.jsx("div",{className:"self-stretch",children:s.jsx("div",{className:P(Ne,"px-3 py-2 text-xs text-muted-foreground"),children:e.parts.map(t=>t.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Je,{text:t.text,renderText:n=>n})},$e(e,t)):null)})}),xo="/mcp-apps/interaction/index.html";function ft(e){return new Promise(t=>{e({onSettled:(n,r)=>t(!!r)})})}const vo=({src:e,title:t,renderPayload:n,onToolCall:r,onOpenLink:o})=>{const l=a.useRef(null),[i,c]=a.useState(48),u=a.useRef({renderPayload:n,onToolCall:r,onOpenLink:o});return u.current={renderPayload:n,onToolCall:r,onOpenLink:o},a.useEffect(()=>{const d=l.current;if(!d?.contentWindow)return;const p=new yn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{}},{hostContext:{theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"}});p.addEventListener("sizechange",({height:g})=>{typeof g=="number"&&c(Math.max(32,Math.ceil(g)))}),p.oncalltool=async({name:g,arguments:R})=>{const A=await u.current.onToolCall(g,R??{});return{isError:A,content:[{type:"text",text:A?"Action failed.":"Action completed."}]}},p.onopenlink=async({url:g})=>({isError:await u.current.onOpenLink(g)}),p.addEventListener("initialized",()=>{(async()=>(await p.sendToolInput({arguments:{}}),await p.sendToolResult({content:[],structuredContent:{...u.current.renderPayload,version:1,source:Qr}})))()});const v=new Rn(d.contentWindow,d.contentWindow);p.connect(v).catch(g=>{console.error("[mcp-app-host] failed to initialize",g)});const m=new MutationObserver(()=>{p.setHostContext({theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"})});return m.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{m.disconnect(),v.close()}},[]),s.jsx("iframe",{ref:l,title:t,src:e,sandbox:"allow-scripts",style:{width:"100%",height:i,border:"none",display:"block"}})},yo=new Set(["action"]),Ro=["name","description","identity_md"];function se(e){return e==null||e===""?"":typeof e=="string"?e:Ue(e)}function pt(e){return e===null?"(cleared)":e===void 0?"":typeof e=="string"?e===""?"":e:Ue(e)}function De(e){return e.length>0?e[0].toUpperCase()+e.slice(1):e}const Ft=new Set(["delete","disconnect","remove","remove_rule","reset","revoke"]);function We(e){return e&&Ft.has(e)?"warning":"default"}function Ke(e,t){return e&&Ft.has(e)?{level:"high",reason:t}:{level:"normal"}}function wo(e,t){const n=e.attribution==="automation"?"An Automation":"An agent",r=Object.keys(t),o=r.map(l=>({label:l,before:se(e.current?.[l]),after:se(t[l])}));return{title:`${n} proposes a change`,icon:"entity",impact:{level:"normal"},tone:"default",blocks:o.length>0?[{type:"diff",fields:o}]:[{type:"text",value:"No field changes.",muted:!0}],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r.join(", ")} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r.join(", ")} was not applied.`}]}}function So(e){const t=e.action??"change",n=e.proposal?.slug??e.proposal?.name??(e.proposal?.automation_id!=null?String(e.proposal.automation_id):void 0)??e.current?.slug??e.current?.name??"automation",r=[];e.action==="delete"&&r.push({type:"text",value:"This will archive the Automation.",muted:!0});const o=e.proposal??{},l=Object.keys(o).filter(i=>!yo.has(i)&&o[i]!==void 0).map(i=>({label:i,...e.action==="update"&&e.current?.[i]!==void 0?{before:pt(e.current?.[i])}:{},after:pt(o[i])}));return r.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0}),{title:`${De(t)} Automation ${n}`,icon:"automation",impact:Ke(e.action,"This archives the Automation and stops future runs."),tone:We(e.action),blocks:r,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${t} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${t} ${n} was not applied.`}]}}function To(e){if(e.resourceKind==="automation")return So(e);if(e.fields&&Object.keys(e.fields).length>0)return wo(e,e.fields);const t=e.resourceKind==="entity"||e.proposal?.entity_id!==void 0||e.current?.entity_type!==void 0||e.proposal?.entity_type!==void 0;if(t&&(e.action==="link"||e.action==="unlink"))return Pn({...e,action:e.action});if(t){const l=e.proposal?.name??e.current?.name??e.proposal?.entity_id??e.current?.id??"entity",i=e.action??"change",c=[];if(e.action==="delete")c.push({type:"text",value:"This will delete the entity.",muted:!0});else{const u=Object.keys(e.proposal??{}).filter(d=>!["entity_id","id"].includes(d)&&e.proposal?.[d]!==void 0&&se(e.proposal?.[d])!==se(e.current?.[d])).map(d=>({label:d,...e.action==="update"?{before:se(e.current?.[d])}:{},after:se(e.proposal?.[d])}));c.push(u.length>0?{type:"diff",fields:u}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(i)} entity ${l}`,icon:"entity",impact:Ke(e.action,"This deletes the entity."),tone:We(e.action),blocks:c,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${i} ${l} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${i} ${l} was not applied.`}]}}const n=e.proposal?.agent_id??e.current?.id??"agent",r=e.action??"change",o=[];if(e.action==="delete")o.push({type:"text",value:"This will permanently delete the agent.",muted:!0});else{const l=Ro.filter(i=>e.proposal?.[i]!==void 0&&se(e.proposal?.[i])!==se(e.current?.[i])).map(i=>({label:i,...e.action==="update"?{before:se(e.current?.[i])}:{},after:se(e.proposal?.[i])}));o.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(r)} agent ${n}`,icon:"agent",impact:Ke(e.action,"This permanently deletes the agent and its configuration."),tone:We(e.action),blocks:o,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r} ${n} was not applied.`}]}}function Co(e){const t=Array.isArray(e.options)?e.options.filter(o=>typeof o=="string"):[],n=[{type:"text",value:e.question||"The agent has a question."}];t.length===0&&n.push({type:"text",value:"Reply below to answer.",muted:!0});const r=t.map(o=>({id:o,label:o,variant:"outline",tool:"answer_question",args:{answer:o},resolvedLabel:`Answered: ${o}`}));return{title:"Input needed",icon:"question",tone:"default",blocks:n,actions:r}}function jo(e,t){return{tone:"bare",actions:[{id:"open",label:e.label??"Open link",variant:"outline",icon:"external",terminal:!1,href:t}]}}const No=({toolName:e,args:t})=>{const n=xn(),r=vn(),{append:o}=Ee(),l=Ge(),i=t??{},c=l?.resolve(e,t)??null;let u=c?.view??null;const d={...c?.handlers??{}},p=new Set;if(!c){if(e==="tool-approval"&&typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0){const v=i.runId,m=typeof i.status=="string"?i.status:"pending",g=m==="pending",R=To(i),A=m==="confirmed"?"Approved":De(m);u=g?R:{...R,title:`${R.title??"Approval"} · ${A}`,tone:m==="failed"?"warning":"default",blocks:[...R.blocks??[],{type:"text",value:typeof i.reviewedByName=="string"?`${m==="rejected"?"Rejected":"Approved"} by ${i.reviewedByName}.`:`${A}.`,muted:!0}],actions:(R.actions??[]).filter(x=>x.terminal===!1)},g&&(d.manage_operations=x=>{if(x.action==="approve")return ft(C=>n.mutate({run_id:v},C));if(x.action==="reject"){const C=typeof x.reason=="string"?x.reason:void 0;return ft(W=>r.mutate({run_id:v,...C?{reason:C}:{}},W))}return Promise.resolve(!0)})}else if(e==="question"){const v=Array.isArray(i.options)?i.options.filter(m=>typeof m=="string"):[];u=Co(i),d.answer_question=m=>{const g=typeof m.answer=="string"?m.answer:"";return v.includes(g)?(o(g),Promise.resolve(!1)):Promise.resolve(!0)}}else if(e==="link-button"){if(!dt(i.url))return null;const v=i.url;p.add(v),u=jo(i,v)}}return u?s.jsx(vo,{src:xo,title:u.title??"Interaction",renderPayload:u,onToolCall:(v,m)=>d[v]?d[v](m):Promise.resolve(!0),onOpenLink:v=>!p.has(v)||!dt(v)?Promise.resolve(!0):(window.open(v,"_blank","noopener,noreferrer"),Promise.resolve(!1))}):null};function Ue(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Eo=()=>{const{running:e,append:t,cancel:n,pendingAttachments:r,addAttachments:o,removeAttachment:l,initialDraft:i,currentSuggestions:c}=Ee(),u=Ao({suggestions:e?null:c}),[d,p]=a.useState(i??""),v=a.useRef(null),m=a.useRef(null),g=kn(_n),R=a.useRef(i??"");a.useEffect(()=>{const C=i??"";if(C===R.current)return;const W=R.current;R.current=C,C!==""&&p(U=>U===""||U===W?C:U)},[i]);const A=a.useRef(d);A.current=d;const x=()=>{e||(t(A.current),p(""),m.current?.clear())};return s.jsxs("div",{className:"rounded-2xl border bg-background transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r.length>0?s.jsx("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3",children:r.map(C=>s.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border bg-muted/50 px-2 py-1 text-xs",children:[s.jsx(Be,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"max-w-[12rem] truncate",children:C.name}),s.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground","aria-label":"Remove attachment",onClick:()=>l(C.id),children:s.jsx(rn,{className:"h-3 w-3"})})]},C.id))}):null,s.jsx(In,{value:d,onChange:p,onSubmit:x,searchRefs:g,handleRef:m,placeholder:u,className:"max-h-48 overflow-y-auto"}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[s.jsx("input",{ref:v,type:"file",multiple:!0,className:"hidden",onChange:C=>{C.target.files&&o(C.target.files),C.target.value=""}}),s.jsxs(pe,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>v.current?.click(),children:[s.jsx(Be,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Attach files"})]}),e?s.jsxs(pe,{type:"button",size:"icon",variant:"secondary",className:"h-8 w-8 rounded-full",onClick:n,children:[s.jsx(on,{size:"lg"}),s.jsx("span",{className:"sr-only",children:"Cancel"})]}):s.jsxs(pe,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",onClick:x,children:[s.jsx(sn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})};function Ao({suggestions:e}){const t=e?.find(n=>n.message.trim().length>0)?.message;return t?`Recommended: ${t.trim()}`:"Chat… (@ to mention, / for commands)"}export{$o as A,Lo as L,Mo as R,Qn as h,Gn as s};
6
+ //# sourceMappingURL=agent-thread-D38STyeu.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-9YuSRymd.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=agents-DAOln24A.js.map
@@ -1,2 +1,2 @@
1
- import{j as s,he as C,hf as N,d$ as L,Q as x,hg as M,hh as S,o as b,q as I,i as j,bh as k,a_ as w,r as O,O as W,hi as D,hj as P,bS as E,hk as R,hl as _,n as y,e_ as F,L as G,ao as H}from"./index-DYCqXaMf.js";import{A as U}from"./agent-editor-form-Bi6WvYX-.js";import{P as q}from"./proposal-review-shell-DsNiavG_.js";function z({identity:e,sections:n,activeSection:t,activeItem:o,onSectionSelect:r,sectionLabel:l,highlightSection:c=!0,className:u}){const a=o??n.find(i=>i.key===t)??n[0];if(!a)return null;const d=a.icon;return s.jsx("div",{className:x("flex shrink-0 flex-col items-center px-4 lg:px-6",u),children:s.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap items-center justify-center gap-x-3 gap-y-2",children:[e,s.jsxs(C,{children:[s.jsx(N,{asChild:!0,children:s.jsxs("button",{type:"button",className:x("inline-flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",c?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-label":l,children:[s.jsx(d,{className:"h-3.5 w-3.5 shrink-0"}),a.label,s.jsx(L,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),s.jsx(M,{align:"center",className:"min-w-[11rem]",children:n.map(({key:i,label:g,icon:m})=>s.jsxs(S,{className:x(i===t&&"bg-accent font-medium"),onSelect:()=>r(i),children:[s.jsx(m,{className:"h-4 w-4"}),s.jsx("span",{children:g})]},i))})]})]})})}const p=[{key:"skills",label:"Skills",icon:D},{key:"guardrails",label:"Guardrails",icon:P},{key:"permissions",label:"Permissions",icon:E,adminOnly:!0},{key:"models",label:"Models",icon:R},{key:"settings",label:"Settings",icon:_}];function Q(e){return p.filter(n=>!n.adminOnly||e)}function T(e,n){if(n===`${e}/conversations`||n.startsWith(`${e}/conversations/`))return null;for(const{key:t}of p)if(n===`${e}/${t}`||n.startsWith(`${e}/${t}/`))return t;return n===`${e}/identity`||n===`${e}/identity/`?"settings":null}function B(e){return e.trim().charAt(0).toUpperCase()||"?"}function J({owner:e,agentId:n,agentName:t,activeDest:o}){const r=b(),{orgContext:l}=y(),{isAdmin:c}=F(l.organizationId),u=Q(!!c),a=o??"settings",d=p.find(i=>i.key===a);return s.jsx(z,{identity:s.jsxs(G,{to:"/$owner/agents/$agentId/settings",params:{owner:e,agentId:n},search:{run_id:void 0},className:"flex min-w-0 items-center gap-2 rounded-md outline-none transition-colors hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",title:"Agent settings",children:[s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-foreground",children:B(t)}),s.jsx("h1",{className:"min-w-0 truncate text-base font-semibold tracking-tight",children:t})]}),sections:u,activeSection:a,activeItem:d,sectionLabel:"Agent section",highlightSection:o!==null,onSectionSelect:i=>{r({to:`/$owner/agents/$agentId/${i}`,params:{owner:e,agentId:n}})}})}function Z({owner:e,agentId:n}){const t=b(),{pathname:o}=I(),{isAuthenticated:r}=j(),{isMember:l}=k(),c=r&&l,{data:u=[],isLoading:a}=w({enabled:c}),d=u.find($=>$.agentId===n)??null,i=!d&&!a&&c,g=`/${e}/agents/${n}`,m=`${g}/conversations`,f=o===m||o.startsWith(`${m}/`),h=T(g,o);O.useEffect(()=>{i&&t({to:"/$owner",params:{owner:e},replace:!0})},[i,t,e]);const A=d?.name??"Agent";return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-hidden py-4 md:py-6",children:[s.jsx(J,{owner:e,agentId:n,agentName:A,activeDest:h}),s.jsx("div",{className:x("flex min-h-0 min-w-0 flex-1 flex-col px-4 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:s.jsx(W,{})})]})}function K({agent:e,tab:n,runId:t}){return s.jsx("div",{className:"mx-auto w-full max-w-3xl pb-6",children:s.jsx(q,{resource:{kind:"agent",agentId:e.agentId},runId:t,children:({reviewMode:o,proposal:r,controlsDisabled:l})=>s.jsx(U,{mode:{kind:"edit",agent:e},section:n,reviewMode:o,reviewProposal:r,reviewControlsDisabled:l},e.agentId)})})}function ee({owner:e,agentId:n,tab:t,runId:o}){const{orgContext:r,hasOrgContext:l}=y(),{isLoading:c}=H(`/${e}`,r),{isAuthenticated:u}=j(),{isMember:a,isLoading:d}=k(),i=u&&a,{data:g=[],isLoading:m}=w({enabled:i}),v=i?!l||c||m||d:c||d,f=g.find(h=>h.agentId===n)??null;return v||!f?null:s.jsx(K,{agent:f,tab:t,runId:o})}export{Z as A,ee as a};
2
- //# sourceMappingURL=agents-workbench-CqaKGggb.js.map
1
+ import{j as s,he as C,hf as N,d$ as L,Q as x,hg as M,hh as S,o as b,q as I,i as j,bh as k,a_ as w,r as O,O as W,hi as D,hj as P,bS as E,hk as R,hl as _,n as y,e_ as F,L as G,ao as H}from"./index-9YuSRymd.js";import{A as U}from"./agent-editor-form-DsSoeQeF.js";import{P as q}from"./proposal-review-shell-CFhOqCLf.js";function z({identity:e,sections:n,activeSection:t,activeItem:o,onSectionSelect:r,sectionLabel:l,highlightSection:c=!0,className:u}){const a=o??n.find(i=>i.key===t)??n[0];if(!a)return null;const d=a.icon;return s.jsx("div",{className:x("flex shrink-0 flex-col items-center px-4 lg:px-6",u),children:s.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap items-center justify-center gap-x-3 gap-y-2",children:[e,s.jsxs(C,{children:[s.jsx(N,{asChild:!0,children:s.jsxs("button",{type:"button",className:x("inline-flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",c?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-label":l,children:[s.jsx(d,{className:"h-3.5 w-3.5 shrink-0"}),a.label,s.jsx(L,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),s.jsx(M,{align:"center",className:"min-w-[11rem]",children:n.map(({key:i,label:g,icon:m})=>s.jsxs(S,{className:x(i===t&&"bg-accent font-medium"),onSelect:()=>r(i),children:[s.jsx(m,{className:"h-4 w-4"}),s.jsx("span",{children:g})]},i))})]})]})})}const p=[{key:"skills",label:"Skills",icon:D},{key:"guardrails",label:"Guardrails",icon:P},{key:"permissions",label:"Permissions",icon:E,adminOnly:!0},{key:"models",label:"Models",icon:R},{key:"settings",label:"Settings",icon:_}];function Q(e){return p.filter(n=>!n.adminOnly||e)}function T(e,n){if(n===`${e}/conversations`||n.startsWith(`${e}/conversations/`))return null;for(const{key:t}of p)if(n===`${e}/${t}`||n.startsWith(`${e}/${t}/`))return t;return n===`${e}/identity`||n===`${e}/identity/`?"settings":null}function B(e){return e.trim().charAt(0).toUpperCase()||"?"}function J({owner:e,agentId:n,agentName:t,activeDest:o}){const r=b(),{orgContext:l}=y(),{isAdmin:c}=F(l.organizationId),u=Q(!!c),a=o??"settings",d=p.find(i=>i.key===a);return s.jsx(z,{identity:s.jsxs(G,{to:"/$owner/agents/$agentId/settings",params:{owner:e,agentId:n},search:{run_id:void 0},className:"flex min-w-0 items-center gap-2 rounded-md outline-none transition-colors hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",title:"Agent settings",children:[s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-foreground",children:B(t)}),s.jsx("h1",{className:"min-w-0 truncate text-base font-semibold tracking-tight",children:t})]}),sections:u,activeSection:a,activeItem:d,sectionLabel:"Agent section",highlightSection:o!==null,onSectionSelect:i=>{r({to:`/$owner/agents/$agentId/${i}`,params:{owner:e,agentId:n}})}})}function Z({owner:e,agentId:n}){const t=b(),{pathname:o}=I(),{isAuthenticated:r}=j(),{isMember:l}=k(),c=r&&l,{data:u=[],isLoading:a}=w({enabled:c}),d=u.find($=>$.agentId===n)??null,i=!d&&!a&&c,g=`/${e}/agents/${n}`,m=`${g}/conversations`,f=o===m||o.startsWith(`${m}/`),h=T(g,o);O.useEffect(()=>{i&&t({to:"/$owner",params:{owner:e},replace:!0})},[i,t,e]);const A=d?.name??"Agent";return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-hidden py-4 md:py-6",children:[s.jsx(J,{owner:e,agentId:n,agentName:A,activeDest:h}),s.jsx("div",{className:x("flex min-h-0 min-w-0 flex-1 flex-col px-4 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:s.jsx(W,{})})]})}function K({agent:e,tab:n,runId:t}){return s.jsx("div",{className:"mx-auto w-full max-w-3xl pb-6",children:s.jsx(q,{resource:{kind:"agent",agentId:e.agentId},runId:t,children:({reviewMode:o,proposal:r,controlsDisabled:l})=>s.jsx(U,{mode:{kind:"edit",agent:e},section:n,reviewMode:o,reviewProposal:r,reviewControlsDisabled:l},e.agentId)})})}function ee({owner:e,agentId:n,tab:t,runId:o}){const{orgContext:r,hasOrgContext:l}=y(),{isLoading:c}=H(`/${e}`,r),{isAuthenticated:u}=j(),{isMember:a,isLoading:d}=k(),i=u&&a,{data:g=[],isLoading:m}=w({enabled:i}),v=i?!l||c||m||d:c||d,f=g.find(h=>h.agentId===n)??null;return v||!f?null:s.jsx(K,{agent:f,tab:t,runId:o})}export{Z as A,ee as a};
2
+ //# sourceMappingURL=agents-workbench-DJ67GZ93.js.map
@@ -1,2 +1,2 @@
1
- import{r as c,io as b,aP as y,aA as C,aV as w,aB as u,j as e,aC as k,L as o,ht as A,hL as j,B as g,hs as P,iB as B,ih as v,g9 as D,ga as L,gb as $,A as I,dy as R,g$ as M,iC as _,ai as E}from"./index-DYCqXaMf.js";import{C as O}from"./connections-browser-CEwYrYqt.js";import"./connection-label-BobuYiAG.js";function T({ownerSlug:s,appId:a}){const n=c.useMemo(()=>b(s,a,y()),[s,a]),{data:r=[],isLoading:l,isError:d,refetch:N}=C(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const p=r.filter(i=>{const f=w(i);return f!=null&&t.includes(f)});return[p.filter(i=>u(i,s)),p.filter(i=>!u(i,s))]},[n,r,s]);if(!n)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const h=(n.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(A,{header:e.jsx(D,{breadcrumb:e.jsx(L,{crumbs:[e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:$,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:n.icon}),title:n.name,caption:n.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?a==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:n.steps.map(t=>e.jsx(z,{step:t},t.label))})})}),h?e.jsx(O,{entries:m.map(t=>({id:t.id,name:v(t),description:B(t,s),tone:t.online?null:"muted",link:P({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,h&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(o,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:v(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function z({step:s}){const[a,n]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx(I,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-xs leading-relaxed",children:r}),e.jsxs(g,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[a?e.jsx(R,{className:"h-3.5 w-3.5"}):e.jsx(M,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function H(){const{owner:s,appId:a}=_.useParams();return e.jsx(E,{owner:s,children:({ownerSlug:n})=>e.jsx(T,{ownerSlug:n,appId:a})})}export{H as component};
2
- //# sourceMappingURL=app._appId-Cl1fTuIt.js.map
1
+ import{r as c,io as b,aP as y,aA as C,aV as w,aB as u,j as e,aC as k,L as o,ht as A,hL as j,B as g,hs as P,iB as B,ih as v,g9 as D,ga as L,gb as $,A as I,dy as R,g$ as M,iC as _,ai as E}from"./index-9YuSRymd.js";import{C as O}from"./connections-browser-CrtnAs0Q.js";import"./connection-label-BobuYiAG.js";function T({ownerSlug:s,appId:a}){const n=c.useMemo(()=>b(s,a,y()),[s,a]),{data:r=[],isLoading:l,isError:d,refetch:N}=C(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const p=r.filter(i=>{const f=w(i);return f!=null&&t.includes(f)});return[p.filter(i=>u(i,s)),p.filter(i=>!u(i,s))]},[n,r,s]);if(!n)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const h=(n.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(A,{header:e.jsx(D,{breadcrumb:e.jsx(L,{crumbs:[e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:$,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:n.icon}),title:n.name,caption:n.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?a==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:n.steps.map(t=>e.jsx(z,{step:t},t.label))})})}),h?e.jsx(O,{entries:m.map(t=>({id:t.id,name:v(t),description:B(t,s),tone:t.online?null:"muted",link:P({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,h&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(o,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:v(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function z({step:s}){const[a,n]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx(I,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-xs leading-relaxed",children:r}),e.jsxs(g,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[a?e.jsx(R,{className:"h-3.5 w-3.5"}):e.jsx(M,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function H(){const{owner:s,appId:a}=_.useParams();return e.jsx(E,{owner:s,children:({ownerSlug:n})=>e.jsx(T,{ownerSlug:n,appId:a})})}export{H as component};
2
+ //# sourceMappingURL=app._appId-Cp78oEZ9.js.map
@@ -1,2 +1,2 @@
1
- import{r as f,j as e,S as p,e7 as y,n as A,ao as _,i as b,bh as C,u as S,h3 as k}from"./index-DYCqXaMf.js";import{C as P,A as D}from"./create-automation-form-9T5WnoUs.js";import{P as E}from"./proposal-review-shell-DsNiavG_.js";import{J as j}from"./json-diff-DFvYINBT.js";import{u as R,a as w}from"./deployments-wG_8QzOF.js";import{E as F}from"./events-feed-DsrkV2ix.js";const L=20;function N({automationId:a}){const t=R({resourceKind:"automation",resourceId:a}),[d,c]=f.useState(null),s=w(d!=null?String(d):null),o=(t.data?.pages.length??0)>=L&&!!t.hasNextPage,r=!!t.isFetchNextPageError;f.useEffect(()=>{!o&&t.hasNextPage&&!t.isFetchingNextPage&&!t.isError&&!r&&t.fetchNextPage()},[o,t.fetchNextPage,t.hasNextPage,t.isFetchingNextPage,t.isError,r]);const l=f.useMemo(()=>(t.data?.pages??[]).flatMap(x=>x.items).filter(x=>x.type==="change"&&x.resourceKind==="automation"&&x.resourceId===String(a)),[t.data,a]),i=!!t.hasNextPage&&!o,m=typeof t.refetch=="function",h=typeof t.fetchNextPage=="function";return t.isLoading?e.jsx(p,{className:"h-20 w-full rounded-lg"}):t.isError&&!r?e.jsxs("section",{className:"space-y-2","aria-label":"Automation definition history","data-testid":"automation-definition-history",children:[e.jsx("h3",{className:"font-medium text-sm",children:"Definition history"}),e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"automation-definition-history-error",children:"Definition history unavailable."}),m?e.jsx("button",{type:"button",className:"text-sm underline","data-testid":"automation-definition-history-retry",onClick:()=>void t.refetch(),children:"Retry"}):null]}):e.jsxs("section",{className:"space-y-2","aria-label":"Automation definition history","data-testid":"automation-definition-history",children:[e.jsx("h3",{className:"font-medium text-sm",children:"Definition history"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Runtime and delivery configuration changes with actor and before/after. Content versions (prompt, sources) are listed separately."}),l.length===0&&!i?e.jsx("p",{className:"py-4 text-sm text-muted-foreground","data-testid":"automation-definition-history-empty",children:"No definition changes recorded yet."}):e.jsx("ul",{className:"space-y-1","data-testid":"automation-definition-history-list",children:l.map(n=>{if(n.type!=="change")return null;const g=n.createdBy??n.agentId??n.actorSource??"unknown";return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"flex w-full flex-wrap items-center justify-between gap-2 rounded-lg border border-border/60 px-3 py-2 text-left text-sm hover:bg-muted/50",onClick:()=>c(x=>x===n.id?null:n.id),"data-testid":`automation-definition-history-item-${n.id}`,children:[e.jsx("span",{className:"font-medium",children:n.action??n.op??"change"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:(n.changedFields??[]).join(", ")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(n.createdAt).toLocaleString()})]})},n.id)})}),i?e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-loading-more",children:"Loading more history…"}):null,o?e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-capped",children:"Showing recent definition changes"}):null,r?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-page-error",children:"Couldn't load more history."}),h?e.jsx("button",{type:"button",className:"text-xs underline","data-testid":"automation-definition-history-retry-next",onClick:()=>void t.fetchNextPage(),children:"Retry"}):null]}):null,d!=null?e.jsx("div",{"data-testid":"automation-definition-history-detail",children:s.isLoading?e.jsx(p,{className:"h-24 w-full rounded-lg"}):s.isError?e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"automation-definition-history-detail-error",children:"Change detail unavailable."}):s.data?e.jsx(j,{before:s.data.before,after:s.data.after}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Change detail unavailable."})}):null]})}function v(a){const{orgContext:t,hasOrgContext:d}=A(),{data:c,isLoading:s}=_(`/${a}`,t),{isAuthenticated:u}=b(),{isMember:o,isLoading:r}=C(),l=u&&o,i=c?.workspace,m=l?!d||s||r:s||r;return{organizationId:i?.id??"",isLoading:m}}function G(a){return v(a)}function O({owner:a,automationId:t,organizationId:d}){const c=Number(t),s=f.useMemo(()=>({producedByAutomationId:c}),[c]),u=S(),o=y(t,void 0,d),r=o.data?.automation?.automation_name?.trim()||null,l=o.data?.automation?.managed_agent_id??null,{data:i}=k(l,t,{orgSlug:a}),m=f.useMemo(()=>(i?.runs??[]).map(n=>({runId:n.runId,status:n.status,completedAt:n.completedAt})),[i]),h=f.useCallback(n=>{u?.open({href:`/${a}/automations/${t}?run_id=${n}`,title:r!=null?`${r} · Run #${n}`:`Automation run #${n}`,runId:n})},[u,a,t,r]);return Number.isFinite(c)?e.jsx(F,{organizationId:d,ownerSlug:a,filters:s,groupByRun:!0,onRunSelect:h,runs:m,hideRunAction:!0,hideAttribution:!0,emptyState:e.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"This Automation hasn't written anything yet. Runs appear here with the events they created; clicking a run opens its conversation."})}):null}function T({agentId:a,automationId:t,runId:d,organizationId:c,onDone:s}){const[u,o]=f.useState({ready:!1,triggers:[]}),r=f.useCallback(n=>{o(g=>JSON.stringify(g)===JSON.stringify(n)?g:n)},[]),l=y(t,void 0,c,{includeVersions:!0}),i=l.data?.automation,m=e.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(n=>e.jsx(p,{className:"h-16 w-full rounded-lg"},n))}),h=l.isLoading?m:i?e.jsx(P,{organizationId:c,prefillAgentId:a??void 0,editingAutomation:{automation_id:i.automation_id,name:i.automation_name,slug:i.slug,description:i.description,prompt:i.prompt,sources:i.sources,reaction_script:i.reaction_script,managed_agent_id:i.managed_agent_id,device_worker_id:i.device_worker_id,agent_kind:i.agent_kind,delivery_target:i.delivery_target??void 0,execution_config:i.execution_config??void 0,keying_config:i.keying_config,reactions_guidance:i.reactions_guidance,triggers:i.triggers},createFields:{triggers:u.triggers},triggerFields:e.jsx(D,{organizationId:c,initialTriggers:i.triggers??[],onChange:r},JSON.stringify(i.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!u.ready,onClose:s,onSuccess:s}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return a?e.jsxs("div",{className:"space-y-6",children:[e.jsx(E,{resource:{kind:"automation",agentId:a,automationId:t},runId:d,onDone:s,children:({reviewMode:n,proposal:g})=>n==="active"?e.jsx(j,{before:g?.current??null,after:{...g?.current??{},...g?.proposedAfter??{}}}):n==="loading"?m:n==="error"?null:h}),e.jsx(N,{automationId:t})]}):e.jsxs("div",{className:"space-y-6",children:[h,e.jsx(N,{automationId:t})]})}function V({owner:a,agentId:t,automationId:d,view:c,runId:s,onDone:u}){const{organizationId:o}=v(a),r=y(d,void 0,o),l=t??r.data?.automation?.managed_agent_id??null;return s||c==="definition"?e.jsx(T,{agentId:l,automationId:d,runId:s,organizationId:o,onDone:u}):e.jsx(O,{owner:a,automationId:d,organizationId:o})}export{V as A,G as u};
2
- //# sourceMappingURL=automation-detail-content-BMLL4lxO.js.map
1
+ import{r as f,j as e,S as p,e7 as y,n as A,ao as _,i as b,bh as C,u as S,h3 as k}from"./index-9YuSRymd.js";import{C as P,A as D}from"./create-automation-form-Bpy92SM5.js";import{P as E}from"./proposal-review-shell-CFhOqCLf.js";import{J as j}from"./json-diff-DIN5Jhfx.js";import{u as R,a as w}from"./deployments-C5hvipQh.js";import{E as F}from"./events-feed-DO3IiJO2.js";const L=20;function N({automationId:a}){const t=R({resourceKind:"automation",resourceId:a}),[d,c]=f.useState(null),s=w(d!=null?String(d):null),o=(t.data?.pages.length??0)>=L&&!!t.hasNextPage,r=!!t.isFetchNextPageError;f.useEffect(()=>{!o&&t.hasNextPage&&!t.isFetchingNextPage&&!t.isError&&!r&&t.fetchNextPage()},[o,t.fetchNextPage,t.hasNextPage,t.isFetchingNextPage,t.isError,r]);const l=f.useMemo(()=>(t.data?.pages??[]).flatMap(x=>x.items).filter(x=>x.type==="change"&&x.resourceKind==="automation"&&x.resourceId===String(a)),[t.data,a]),i=!!t.hasNextPage&&!o,m=typeof t.refetch=="function",h=typeof t.fetchNextPage=="function";return t.isLoading?e.jsx(p,{className:"h-20 w-full rounded-lg"}):t.isError&&!r?e.jsxs("section",{className:"space-y-2","aria-label":"Automation definition history","data-testid":"automation-definition-history",children:[e.jsx("h3",{className:"font-medium text-sm",children:"Definition history"}),e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"automation-definition-history-error",children:"Definition history unavailable."}),m?e.jsx("button",{type:"button",className:"text-sm underline","data-testid":"automation-definition-history-retry",onClick:()=>void t.refetch(),children:"Retry"}):null]}):e.jsxs("section",{className:"space-y-2","aria-label":"Automation definition history","data-testid":"automation-definition-history",children:[e.jsx("h3",{className:"font-medium text-sm",children:"Definition history"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Runtime and delivery configuration changes with actor and before/after. Content versions (prompt, sources) are listed separately."}),l.length===0&&!i?e.jsx("p",{className:"py-4 text-sm text-muted-foreground","data-testid":"automation-definition-history-empty",children:"No definition changes recorded yet."}):e.jsx("ul",{className:"space-y-1","data-testid":"automation-definition-history-list",children:l.map(n=>{if(n.type!=="change")return null;const g=n.createdBy??n.agentId??n.actorSource??"unknown";return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"flex w-full flex-wrap items-center justify-between gap-2 rounded-lg border border-border/60 px-3 py-2 text-left text-sm hover:bg-muted/50",onClick:()=>c(x=>x===n.id?null:n.id),"data-testid":`automation-definition-history-item-${n.id}`,children:[e.jsx("span",{className:"font-medium",children:n.action??n.op??"change"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:(n.changedFields??[]).join(", ")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(n.createdAt).toLocaleString()})]})},n.id)})}),i?e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-loading-more",children:"Loading more history…"}):null,o?e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-capped",children:"Showing recent definition changes"}):null,r?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"automation-definition-history-page-error",children:"Couldn't load more history."}),h?e.jsx("button",{type:"button",className:"text-xs underline","data-testid":"automation-definition-history-retry-next",onClick:()=>void t.fetchNextPage(),children:"Retry"}):null]}):null,d!=null?e.jsx("div",{"data-testid":"automation-definition-history-detail",children:s.isLoading?e.jsx(p,{className:"h-24 w-full rounded-lg"}):s.isError?e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"automation-definition-history-detail-error",children:"Change detail unavailable."}):s.data?e.jsx(j,{before:s.data.before,after:s.data.after}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Change detail unavailable."})}):null]})}function v(a){const{orgContext:t,hasOrgContext:d}=A(),{data:c,isLoading:s}=_(`/${a}`,t),{isAuthenticated:u}=b(),{isMember:o,isLoading:r}=C(),l=u&&o,i=c?.workspace,m=l?!d||s||r:s||r;return{organizationId:i?.id??"",isLoading:m}}function G(a){return v(a)}function O({owner:a,automationId:t,organizationId:d}){const c=Number(t),s=f.useMemo(()=>({producedByAutomationId:c}),[c]),u=S(),o=y(t,void 0,d),r=o.data?.automation?.automation_name?.trim()||null,l=o.data?.automation?.managed_agent_id??null,{data:i}=k(l,t,{orgSlug:a}),m=f.useMemo(()=>(i?.runs??[]).map(n=>({runId:n.runId,status:n.status,completedAt:n.completedAt})),[i]),h=f.useCallback(n=>{u?.open({href:`/${a}/automations/${t}?run_id=${n}`,title:r!=null?`${r} · Run #${n}`:`Automation run #${n}`,runId:n})},[u,a,t,r]);return Number.isFinite(c)?e.jsx(F,{organizationId:d,ownerSlug:a,filters:s,groupByRun:!0,onRunSelect:h,runs:m,hideRunAction:!0,hideAttribution:!0,emptyState:e.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"This Automation hasn't written anything yet. Runs appear here with the events they created; clicking a run opens its conversation."})}):null}function T({agentId:a,automationId:t,runId:d,organizationId:c,onDone:s}){const[u,o]=f.useState({ready:!1,triggers:[]}),r=f.useCallback(n=>{o(g=>JSON.stringify(g)===JSON.stringify(n)?g:n)},[]),l=y(t,void 0,c,{includeVersions:!0}),i=l.data?.automation,m=e.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(n=>e.jsx(p,{className:"h-16 w-full rounded-lg"},n))}),h=l.isLoading?m:i?e.jsx(P,{organizationId:c,prefillAgentId:a??void 0,editingAutomation:{automation_id:i.automation_id,name:i.automation_name,slug:i.slug,description:i.description,prompt:i.prompt,sources:i.sources,reaction_script:i.reaction_script,managed_agent_id:i.managed_agent_id,device_worker_id:i.device_worker_id,agent_kind:i.agent_kind,delivery_target:i.delivery_target??void 0,execution_config:i.execution_config??void 0,keying_config:i.keying_config,reactions_guidance:i.reactions_guidance,triggers:i.triggers},createFields:{triggers:u.triggers},triggerFields:e.jsx(D,{organizationId:c,initialTriggers:i.triggers??[],onChange:r},JSON.stringify(i.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!u.ready,onClose:s,onSuccess:s}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return a?e.jsxs("div",{className:"space-y-6",children:[e.jsx(E,{resource:{kind:"automation",agentId:a,automationId:t},runId:d,onDone:s,children:({reviewMode:n,proposal:g})=>n==="active"?e.jsx(j,{before:g?.current??null,after:{...g?.current??{},...g?.proposedAfter??{}}}):n==="loading"?m:n==="error"?null:h}),e.jsx(N,{automationId:t})]}):e.jsxs("div",{className:"space-y-6",children:[h,e.jsx(N,{automationId:t})]})}function V({owner:a,agentId:t,automationId:d,view:c,runId:s,onDone:u}){const{organizationId:o}=v(a),r=y(d,void 0,o),l=t??r.data?.automation?.managed_agent_id??null;return s||c==="definition"?e.jsx(T,{agentId:l,automationId:d,runId:s,organizationId:o,onDone:u}):e.jsx(O,{owner:a,automationId:d,organizationId:o})}export{V as A,G as u};
2
+ //# sourceMappingURL=automation-detail-content-DSwbRpbx.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-9YuSRymd.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=automations-DAOln24A.js.map
@@ -1,2 +1,2 @@
1
- import{o as a,i,r as n,j as t}from"./index-DYCqXaMf.js";function r(){const s=a(),{isReady:e}=i();return n.useEffect(()=>{e&&setTimeout(()=>{s({to:"/"})},500)},[e,s]),t.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-muted-foreground",children:e?"Redirecting...":"Completing sign in..."})})})}export{r as component};
2
- //# sourceMappingURL=callback-DTKKsfkz.js.map
1
+ import{o as a,i,r as n,j as t}from"./index-9YuSRymd.js";function r(){const s=a(),{isReady:e}=i();return n.useEffect(()=>{e&&setTimeout(()=>{s({to:"/"})},500)},[e,s]),t.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-muted-foreground",children:e?"Redirecting...":"Completing sign in..."})})})}export{r as component};
2
+ //# sourceMappingURL=callback-CBexCo3F.js.map
@@ -1,2 +1,2 @@
1
- import{j as r,eK as d}from"./index-DYCqXaMf.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:`bg-card text-card-foreground flex flex-col gap-6 rounded-2xl border py-6 ${a||""}`,...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:`grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] ${a||""}`,...t})}function c({className:a,asChild:t=!1,...s}){const o=t?d:"div";return r.jsx(o,{"data-slot":"card-title",className:`leading-none font-semibold ${a||""}`,...s})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:`mt-1 first:mt-0 text-muted-foreground text-sm ${a||""}`,...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:`px-6 ${a||""}`,...t})}export{n as C,i as a,c as b,u as c,l as d};
2
- //# sourceMappingURL=card-yU0TmNRH.js.map
1
+ import{j as r,eK as d}from"./index-9YuSRymd.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:`bg-card text-card-foreground flex flex-col gap-6 rounded-2xl border py-6 ${a||""}`,...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:`grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] ${a||""}`,...t})}function c({className:a,asChild:t=!1,...s}){const o=t?d:"div";return r.jsx(o,{"data-slot":"card-title",className:`leading-none font-semibold ${a||""}`,...s})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:`mt-1 first:mt-0 text-muted-foreground text-sm ${a||""}`,...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:`px-6 ${a||""}`,...t})}export{n as C,i as a,c as b,u as c,l as d};
2
+ //# sourceMappingURL=card-jzhQrMDP.js.map
@@ -1,2 +1,2 @@
1
- import{w as e,j as c,x as r}from"./index-DYCqXaMf.js";function n(){const{team:a}=e({from:"/slack/claim"});return c.jsx(r,{to:"/connector/$name/connection",params:{name:"slack"},search:{ref:a},replace:!0})}export{n as component};
2
- //# sourceMappingURL=claim-DJfTvlT2.js.map
1
+ import{w as e,j as c,x as r}from"./index-9YuSRymd.js";function n(){const{team:a}=e({from:"/slack/claim"});return c.jsx(r,{to:"/connector/$name/connection",params:{name:"slack"},search:{ref:a},replace:!0})}export{n as component};
2
+ //# sourceMappingURL=claim-B-wq745Q.js.map
@@ -1,2 +1,2 @@
1
- import{dE as c}from"./index-DYCqXaMf.js";function o(n){const t=new Map;for(const e of n){if(e.kind!=="mcp")continue;const l=e.title?.trim()||e.identifier||"Unknown app",s=e.registrationGroupKey||e.id,i=t.get(s);if(!i){t.set(s,{key:s,clientId:e.id,title:l,drivenBy:e.drivenBy?.trim()||null,clientIds:[e.id],connected:e.status==="connected",lastSeenAt:e.lastSeenAt??null,linkedUser:e.linkedUserName??e.linkedUserEmail??null,linkedUserEntitySlug:e.linkedUserEntitySlug??null});continue}i.clientIds.push(e.id),i.connected=i.connected||e.status==="connected",(e.lastSeenAt??0)>(i.lastSeenAt??0)&&(i.lastSeenAt=e.lastSeenAt??null,i.drivenBy=e.drivenBy?.trim()||null)}return[...t.values()].sort((e,l)=>(l.lastSeenAt??0)-(e.lastSeenAt??0))}function r(n){const t=[n.linkedUser];return t.push(n.connected?`active ${c(n.lastSeenAt)}`:"disconnected"),n.drivenBy&&n.drivenBy!==n.title&&t.push(`via ${n.drivenBy}`),t.filter(Boolean).join(" · ")}export{r as c,o as g};
2
- //# sourceMappingURL=client-rows--FrZfJol.js.map
1
+ import{dE as c}from"./index-9YuSRymd.js";function o(n){const t=new Map;for(const e of n){if(e.kind!=="mcp")continue;const l=e.title?.trim()||e.identifier||"Unknown app",s=e.registrationGroupKey||e.id,i=t.get(s);if(!i){t.set(s,{key:s,clientId:e.id,title:l,drivenBy:e.drivenBy?.trim()||null,clientIds:[e.id],connected:e.status==="connected",lastSeenAt:e.lastSeenAt??null,linkedUser:e.linkedUserName??e.linkedUserEmail??null,linkedUserEntitySlug:e.linkedUserEntitySlug??null});continue}i.clientIds.push(e.id),i.connected=i.connected||e.status==="connected",(e.lastSeenAt??0)>(i.lastSeenAt??0)&&(i.lastSeenAt=e.lastSeenAt??null,i.drivenBy=e.drivenBy?.trim()||null)}return[...t.values()].sort((e,l)=>(l.lastSeenAt??0)-(e.lastSeenAt??0))}function r(n){const t=[n.linkedUser];return t.push(n.connected?`active ${c(n.lastSeenAt)}`:"disconnected"),n.drivenBy&&n.drivenBy!==n.title&&t.push(`via ${n.drivenBy}`),t.filter(Boolean).join(" · ")}export{r as c,o as g};
2
+ //# sourceMappingURL=client-rows-BYbsXGy9.js.map
@@ -1,2 +1,2 @@
1
- import{cx as c,ch as u,$ as d,bI as p,bJ as r,W as o,dD as i,J as w}from"./index-DYCqXaMf.js";function l(t,a="",e){const n=`${w}/api/${t}/clients${a}`,s=e?.toString();return s?`${n}?${s}`:n}function h(t,a){const e=a?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const s=await o(l(e,"",n),{credentials:"include"});return await i(s,"Failed to load connected clients"),(await s.json()).clients??[]},enabled:!!e&&(a?.enabled??!0),staleTime:15e3,refetchInterval:a?.refetchInterval})}function y(){const{slug:t}=c(),a=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const s=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(s,"Failed to revoke client"),await s.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{y as a,h as u};
2
- //# sourceMappingURL=clients-L4K1UT8c.js.map
1
+ import{cx as c,ch as u,$ as d,bI as p,bJ as r,W as o,dD as i,J as w}from"./index-9YuSRymd.js";function l(t,a="",e){const n=`${w}/api/${t}/clients${a}`,s=e?.toString();return s?`${n}?${s}`:n}function h(t,a){const e=a?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const s=await o(l(e,"",n),{credentials:"include"});return await i(s,"Failed to load connected clients"),(await s.json()).clients??[]},enabled:!!e&&(a?.enabled??!0),staleTime:15e3,refetchInterval:a?.refetchInterval})}function y(){const{slug:t}=c(),a=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const s=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(s,"Failed to revoke client"),await s.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{y as a,h as u};
2
+ //# sourceMappingURL=clients-BhNl1tVq.js.map