@lobu/runtime-server 21.2.0 → 21.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/component.json +1 -1
  2. package/dist/owletto/dist/assets/_-CLhipgJI.js +1 -0
  3. package/dist/owletto/dist/assets/{_-C1iPVDAS.js → _-D0ZVGAIA.js} +2 -2
  4. package/dist/owletto/dist/assets/{_agentId-DvhFYLLv.js → _agentId-BLXUf3ot.js} +1 -1
  5. package/dist/owletto/dist/assets/_agentId-DnI66MF3.js +1 -0
  6. package/dist/owletto/dist/assets/{_automationId-NuFSEFlw.js → _automationId-ziwseLb7.js} +1 -1
  7. package/dist/owletto/dist/assets/{_connectorKey._connectionId-D_FhMGN1.js → _connectorKey._connectionId-B6V3ySFK.js} +1 -1
  8. package/dist/owletto/dist/assets/{_connectorKey.index-B8AZikVg.js → _connectorKey.index-CR5u_dtt.js} +1 -1
  9. package/dist/owletto/dist/assets/{_conversationId-D1Cx42I0.js → _conversationId-FBMYmOl8.js} +1 -1
  10. package/dist/owletto/dist/assets/{_deploymentId-BjtZC8Oo.js → _deploymentId-DNTXbT_m.js} +1 -1
  11. package/dist/owletto/dist/assets/_name-B37LKIxH.js +1 -0
  12. package/dist/owletto/dist/assets/{_owner-c8L8M4FP.js → _owner-BxYumqC2.js} +1 -1
  13. package/dist/owletto/dist/assets/_shape-Bxz-04jR.js +1 -0
  14. package/dist/owletto/dist/assets/_skillKey-D5MFbiw2.js +1 -0
  15. package/dist/owletto/dist/assets/{_slug-Nlm2ziLr.js → _slug-Dlhit09k.js} +1 -1
  16. package/dist/owletto/dist/assets/_viewKey-C6535i-t.js +1 -0
  17. package/dist/owletto/dist/assets/_viewKey-CQCtY3Y8.js +1 -0
  18. package/dist/owletto/dist/assets/_viewKey-CxKfKbRa.js +1 -0
  19. package/dist/owletto/dist/assets/{accept-invitation-BfqbITxp.js → accept-invitation-BQQwec3R.js} +1 -1
  20. package/dist/owletto/dist/assets/{activity-route-view-CTQEg3Us.js → activity-route-view-BwThvdGs.js} +1 -1
  21. package/dist/owletto/dist/assets/{agent-card-controls-49SIdmyU.js → agent-card-controls-B3RhzsPz.js} +1 -1
  22. package/dist/owletto/dist/assets/{agent-client-setup-list-ChwHMq4Q.js → agent-client-setup-list-BFtgRwe8.js} +1 -1
  23. package/dist/owletto/dist/assets/{agent-connect-pages-CJntJskO.js → agent-connect-pages-BO4wQn4L.js} +1 -1
  24. package/dist/owletto/dist/assets/{agent-editor-form-CEEFNek5.js → agent-editor-form-BYC4uSNz.js} +1 -1
  25. package/dist/owletto/dist/assets/{agent-guardrails-route-BF_RvzHv.js → agent-guardrails-route-Dp02G1AQ.js} +1 -1
  26. package/dist/owletto/dist/assets/{agent-loading-shells-Cve_XIMW.js → agent-loading-shells-OagauQzV.js} +1 -1
  27. package/dist/owletto/dist/assets/{agent-permissions-matrix-DEYa123T.js → agent-permissions-matrix-B9Ho3P1t.js} +1 -1
  28. package/dist/owletto/dist/assets/{agent-skill-context-DuS7Ojm_.js → agent-skill-context-BAr2Dw3F.js} +1 -1
  29. package/dist/owletto/dist/assets/{agent-skills-route-BItudd8s.js → agent-skills-route-B4VUnVi0.js} +1 -1
  30. package/dist/owletto/dist/assets/{agent-subpage-shell-BkGzpmv5.js → agent-subpage-shell-Dz8I-GUt.js} +1 -1
  31. package/dist/owletto/dist/assets/{agent-thread-DhCFggHZ.js → agent-thread-B9-cdkaV.js} +1 -1
  32. package/dist/owletto/dist/assets/agents-D0CIg4b9.js +1 -0
  33. package/dist/owletto/dist/assets/{agents-workbench-BZaoiFNY.js → agents-workbench-C2sr5h82.js} +1 -1
  34. package/dist/owletto/dist/assets/{app._appId-0fp8NC9-.js → app._appId-DLsJ_QWS.js} +1 -1
  35. package/dist/owletto/dist/assets/{automation-detail-content-C08Ef137.js → automation-detail-content-9Rjb_I9j.js} +1 -1
  36. package/dist/owletto/dist/assets/automations-D0CIg4b9.js +1 -0
  37. package/dist/owletto/dist/assets/{calendar-CvEqJnKS.js → calendar-DAiyi1ZL.js} +1 -1
  38. package/dist/owletto/dist/assets/{callback-BfjlxUcL.js → callback-CaRe2TOT.js} +1 -1
  39. package/dist/owletto/dist/assets/{card-MXMmjz9G.js → card-CMmh2mzo.js} +1 -1
  40. package/dist/owletto/dist/assets/{claim-B5igXpyF.js → claim-CYHnUF7G.js} +1 -1
  41. package/dist/owletto/dist/assets/{clients-DqMOcwpO.js → clients-Cp1BJ28u.js} +1 -1
  42. package/dist/owletto/dist/assets/{code-editor-bpbaa7f6.js → code-editor-CYsR2VBP.js} +1 -1
  43. package/dist/owletto/dist/assets/connect-CZip2g_B.js +1 -0
  44. package/dist/owletto/dist/assets/connect._clientId-CEKY8Dnv.js +1 -0
  45. package/dist/owletto/dist/assets/{connected._clientId-BWVr-PMm.js → connected._clientId-C5xRjxNO.js} +1 -1
  46. package/dist/owletto/dist/assets/{connection-D-dXA43c.js → connection-C06HZ241.js} +1 -1
  47. package/dist/owletto/dist/assets/{connection-feed-detail-XYK-ubKG.js → connection-feed-detail-D1whY5hL.js} +1 -1
  48. package/dist/owletto/dist/assets/{connector-provenance-RL_DcF2q.js → connector-provenance-BjKiUhYE.js} +1 -1
  49. package/dist/owletto/dist/assets/{connectors-B2_PLuXP.js → connectors-Baejya0T.js} +1 -1
  50. package/dist/owletto/dist/assets/{consent-CMrkyIfi.js → consent-CfYDldcF.js} +1 -1
  51. package/dist/owletto/dist/assets/{core.esm-BrIR85HL.js → core.esm-QA7BQgiK.js} +1 -1
  52. package/dist/owletto/dist/assets/create-C3P-3_8O.js +1 -0
  53. package/dist/owletto/dist/assets/create-CwnrPUEw.js +1 -0
  54. package/dist/owletto/dist/assets/{create-UTXCruIl.js → create-DOScS9Gl.js} +1 -1
  55. package/dist/owletto/dist/assets/{create-automation-form-BHir-pIp.js → create-automation-form-CuxiIRCF.js} +1 -1
  56. package/dist/owletto/dist/assets/{create._connectorKey-qjd3B6p5.js → create._connectorKey-Bjv3lCf8.js} +1 -1
  57. package/dist/owletto/dist/assets/{cronstrue-BwvvZn_Y.js → cronstrue-2GHCtD7h.js} +1 -1
  58. package/dist/owletto/dist/assets/{deployments-DHAx8TBs.js → deployments-ByBv1DW-.js} +1 -1
  59. package/dist/owletto/dist/assets/deployments-C-_ECORv.js +1 -0
  60. package/dist/owletto/dist/assets/{deployments-body-B54mJoZC.js → deployments-body-Bm2upStd.js} +1 -1
  61. package/dist/owletto/dist/assets/{device-Bi_9KNKQ.js → device-B0i7Xp8y.js} +1 -1
  62. package/dist/owletto/dist/assets/{device-pin-tombstone-Dkmmka9d.js → device-pin-tombstone-Bd6vS2zu.js} +1 -1
  63. package/dist/owletto/dist/assets/{device-rows-CkTAaZ3m.js → device-rows-Bwf8qDte.js} +1 -1
  64. package/dist/owletto/dist/assets/{device._deviceId-B_WqDhY5.js → device._deviceId-DJLAesm3.js} +1 -1
  65. package/dist/owletto/dist/assets/{entity-options-Bm1sbpmt.js → entity-options-CrbS6K-i.js} +1 -1
  66. package/dist/owletto/dist/assets/{entity-page-DZUGex-P.js → entity-page-ijZe_1-6.js} +1 -1
  67. package/dist/owletto/dist/assets/{entity-type-page-DSBcVv9e.js → entity-type-page-onp2Tk_E.js} +1 -1
  68. package/dist/owletto/dist/assets/{event-page-B837JclA.js → event-page-C0B2UDY-.js} +1 -1
  69. package/dist/owletto/dist/assets/{events-feed-BgvLTppV.js → events-feed-DK35T4g7.js} +1 -1
  70. package/dist/owletto/dist/assets/{full-page-spinner-ByBsHimW.js → full-page-spinner-Dd8eEaxq.js} +1 -1
  71. package/dist/owletto/dist/assets/guardrails-DKO8_J-G.js +1 -0
  72. package/dist/owletto/dist/assets/identity-CKM54vrM.js +1 -0
  73. package/dist/owletto/dist/assets/{index-DjYcFuq9.js → index--VmN5WxW.js} +1 -1
  74. package/dist/owletto/dist/assets/{index-GZkujXG1.js → index-B2AmRqYh.js} +1589 -1589
  75. package/dist/owletto/dist/assets/{index-Be5BLMwZ.js → index-B_rcEgFX.js} +1 -1
  76. package/dist/owletto/dist/assets/{index-Dpf0I2N4.js → index-BmhGe6-Z.js} +1 -1
  77. package/dist/owletto/dist/assets/index-C1dJSGrL.js +1 -0
  78. package/dist/owletto/dist/assets/index-CAFw4qCb.js +1 -0
  79. package/dist/owletto/dist/assets/{index-DBs2lhwE.js → index-CCcc_xBw.js} +1 -1
  80. package/dist/owletto/dist/assets/{index-DqrjJ9LB.js → index-CLU3gXVm.js} +1 -1
  81. package/dist/owletto/dist/assets/{index-Cane2GT3.js → index-Cf0GJoiG.js} +1 -1
  82. package/dist/owletto/dist/assets/index-CqQVnAY-.js +1 -0
  83. package/dist/owletto/dist/assets/{index-BrT0gBIi.js → index-CxT0uyIe.js} +1 -1
  84. package/dist/owletto/dist/assets/index-DR08e6Ec.js +1 -0
  85. package/dist/owletto/dist/assets/index-DYb9L5FC.js +1 -0
  86. package/dist/owletto/dist/assets/{index-C1MV7ajb.js → index-DlepU3cY.js} +1 -1
  87. package/dist/owletto/dist/assets/index-SUUcQGT-.js +1 -0
  88. package/dist/owletto/dist/assets/index-SdiFOfR1.js +1 -0
  89. package/dist/owletto/dist/assets/index-zcfi5r1l.js +1 -0
  90. package/dist/owletto/dist/assets/{json-diff-D6sv990W.js → json-diff-ClBBYBQD.js} +1 -1
  91. package/dist/owletto/dist/assets/{list-skeleton-B39wKVT1.js → list-skeleton-BtWn2eo2.js} +1 -1
  92. package/dist/owletto/dist/assets/{login-DxnhCvKx.js → login-d3PdO-qV.js} +1 -1
  93. package/dist/owletto/dist/assets/{logout-Lvib6Kk7.js → logout-DgckxwLn.js} +1 -1
  94. package/dist/owletto/dist/assets/{member-scope-gate-CM-GNviT.js → member-scope-gate-DXOCfx-v.js} +1 -1
  95. package/dist/owletto/dist/assets/{memory-browse-page-DKmyI1FJ.js → memory-browse-page-CeAnKoTR.js} +1 -1
  96. package/dist/owletto/dist/assets/{missing-view-CAFqvZpi.js → missing-view-DrZ8m8yo.js} +1 -1
  97. package/dist/owletto/dist/assets/{model-selector-BoudNhPZ.js → model-selector-CapL1ARf.js} +1 -1
  98. package/dist/owletto/dist/assets/models-CB8mhq7j.js +1 -0
  99. package/dist/owletto/dist/assets/{new-Jp_DtYBt.js → new-BBUb-VR4.js} +1 -1
  100. package/dist/owletto/dist/assets/{new-e3C5Yokb.js → new-CBLJ25_w.js} +1 -1
  101. package/dist/owletto/dist/assets/{new-CKSjnGM9.js → new-tTXB4qBW.js} +1 -1
  102. package/dist/owletto/dist/assets/{oauth-workspace-access-DuPiMSr2.js → oauth-workspace-access-DearynqZ.js} +1 -1
  103. package/dist/owletto/dist/assets/{organization-DUPBruFP.js → organization-BgdBg-PJ.js} +1 -1
  104. package/dist/owletto/dist/assets/{permissions-DqkX4mTH.js → permissions-h_qSft1A.js} +1 -1
  105. package/dist/owletto/dist/assets/{proposal-review-shell-C04RG1qM.js → proposal-review-shell-D4YNrrye.js} +1 -1
  106. package/dist/owletto/dist/assets/{recent-BmxCZQ8j.js → recent-JiBNvZzD.js} +1 -1
  107. package/dist/owletto/dist/assets/{renderer-eFSU65zm.js → renderer-DgPLyEbx.js} +1 -1
  108. package/dist/owletto/dist/assets/{reset-password-BinCwene.js → reset-password-B8tWPtIj.js} +1 -1
  109. package/dist/owletto/dist/assets/{runs-DwThk2CI.js → runs-oHveuEUB.js} +1 -1
  110. package/dist/owletto/dist/assets/{runs-panel-DfxWCV7K.js → runs-panel-C56GDaJm.js} +1 -1
  111. package/dist/owletto/dist/assets/{runs-table-Dh7FL3Va.js → runs-table-BUKDjiBc.js} +1 -1
  112. package/dist/owletto/dist/assets/{schema-value-normalization-CPLeOm7K.js → schema-value-normalization-3JuM_r1H.js} +1 -1
  113. package/dist/owletto/dist/assets/settings-DaKg6U5O.js +1 -0
  114. package/dist/owletto/dist/assets/{settings-DLg89oqz.js → settings-DhnRi2nq.js} +1 -1
  115. package/dist/owletto/dist/assets/skills-BpQncuMC.js +1 -0
  116. package/dist/owletto/dist/assets/{switch-Dcx3_8kM.js → switch-BQ40_DMb.js} +1 -1
  117. package/dist/owletto/dist/assets/{use-applied-views-BpvIIgWG.js → use-applied-views-B-Z-Weji.js} +1 -1
  118. package/dist/owletto/dist/assets/{use-mention-search-Vndny_Gd.js → use-mention-search-B4DfZFm5.js} +1 -1
  119. package/dist/owletto/dist/assets/{view-frame-DxiuLSGA.js → view-frame-C7ciEoLo.js} +1 -1
  120. package/dist/owletto/dist/index.html +1 -1
  121. package/dist/server-main.bundle.mjs +2266 -2125
  122. package/npm-shrinkwrap.json +5 -5
  123. package/package.json +1 -1
  124. package/vendor/connector-sdk/package.json +1 -1
  125. package/vendor/core/package.json +1 -1
  126. package/vendor/views/dist/api.d.ts +42 -5
  127. package/vendor/views/dist/api.js +63 -6
  128. package/vendor/views/package.json +1 -1
  129. package/dist/owletto/dist/assets/_-TlzPuBqI.js +0 -1
  130. package/dist/owletto/dist/assets/_agentId-DutmYPK7.js +0 -1
  131. package/dist/owletto/dist/assets/_name-DTlirHDv.js +0 -1
  132. package/dist/owletto/dist/assets/_shape-DQaUs_O7.js +0 -1
  133. package/dist/owletto/dist/assets/_skillKey-CJSEeyG0.js +0 -1
  134. package/dist/owletto/dist/assets/_viewKey-BK9NZs21.js +0 -1
  135. package/dist/owletto/dist/assets/_viewKey-D-Og614G.js +0 -1
  136. package/dist/owletto/dist/assets/_viewKey-DIFCFECi.js +0 -1
  137. package/dist/owletto/dist/assets/agents-BIA5SCAT.js +0 -1
  138. package/dist/owletto/dist/assets/automations-BIA5SCAT.js +0 -1
  139. package/dist/owletto/dist/assets/connect-DpQrbviv.js +0 -1
  140. package/dist/owletto/dist/assets/connect._clientId-A_F-UzTr.js +0 -1
  141. package/dist/owletto/dist/assets/create-DhxcVjNh.js +0 -1
  142. package/dist/owletto/dist/assets/create-jVkf6V76.js +0 -1
  143. package/dist/owletto/dist/assets/deployments-CSJHFlJz.js +0 -1
  144. package/dist/owletto/dist/assets/guardrails-cMGe6IIe.js +0 -1
  145. package/dist/owletto/dist/assets/identity-BORtpi5L.js +0 -1
  146. package/dist/owletto/dist/assets/index-B5lGxbbZ.js +0 -1
  147. package/dist/owletto/dist/assets/index-BGz-9DDG.js +0 -1
  148. package/dist/owletto/dist/assets/index-BrzsfXR-.js +0 -1
  149. package/dist/owletto/dist/assets/index-C31QOVZH.js +0 -1
  150. package/dist/owletto/dist/assets/index-C6USRbY8.js +0 -1
  151. package/dist/owletto/dist/assets/index-Dh8ubWqr.js +0 -1
  152. package/dist/owletto/dist/assets/index-DpgsgDFc.js +0 -1
  153. package/dist/owletto/dist/assets/index-pFFCzVi5.js +0 -1
  154. package/dist/owletto/dist/assets/models-B8BuBmLu.js +0 -1
  155. package/dist/owletto/dist/assets/settings-CSrpSUqR.js +0 -1
  156. package/dist/owletto/dist/assets/skills-PQP0fNxc.js +0 -1
@@ -4,6 +4,6 @@
4
4
  "server": "dist/server.bundle.mjs",
5
5
  "embeddingsServer": "dist/embeddings-server.mjs"
6
6
  },
7
- "version": "21.2.0",
7
+ "version": "21.2.1",
8
8
  "verify": "dist/verify.mjs"
9
9
  }
@@ -0,0 +1 @@
1
+ import{cm as t,j as p,cn as m}from"./index-B2AmRqYh.js";import{A as e}from"./activity-route-view-BwThvdGs.js";import"./device-automation-BIjs7DZJ.js";import"./agent-thread-storage-U6htL3ad.js";import"./pending-seed-CPbfgnLX.js";import"./clients-Cp1BJ28u.js";import"./client-rows-EJSKR6z1.js";import"./connection-label-BobuYiAG.js";import"./events-feed-DK35T4g7.js";import"./use-applied-views-B-Z-Weji.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";import"./calendar-DAiyi1ZL.js";import"./agent-loading-shells-OagauQzV.js";import"./member-scope-gate-DXOCfx-v.js";function w(){const{owner:o,_splat:r}=t.useParams(),i=t.useSearch();return p.jsx(e,{owner:o,search:i,attentionLens:!1,entityScope:m(r||"").path})}export{w as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entity-page-DZUGex-P.js","assets/index-GZkujXG1.js","assets/index-BmAuAhub.css","assets/schema-value-normalization-CPLeOm7K.js","assets/calendar-CvEqJnKS.js","assets/view-frame-DxiuLSGA.js","assets/app-bridge-BH3g2mKG.js","assets/missing-view-CAFqvZpi.js","assets/use-applied-views-BpvIIgWG.js"])))=>i.map(i=>d[i]);
2
- import{r as n,aV as j,aW as m,aX as v,aY as P,l as R,p as _,_ as E,V as S,j as e,aZ as w,a_ as b,a$ as N}from"./index-GZkujXG1.js";function h(){return n.useEffect(()=>{j()},[]),null}const F=b(async()=>({default:(await N(async()=>{const{EntityPage:s}=await import("./entity-page-DZUGex-P.js");return{EntityPage:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).EntityPage}));function r(){return e.jsx("div",{"data-public-loading":"true",children:e.jsx(w,{})})}function k(){const{owner:s,_splat:x}=m.useParams(),a=m.useSearch(),i=v(x||""),o=i?.viewKey,{path:f}=P(s,i?.entityPath),{data:t,isLoading:c,error:d}=R(f,{slug:s},{includeBootstrap:!0}),{session:y,isReady:l}=_(),u=E();if(n.useEffect(()=>{t?.redirect&&u({to:t.redirect.to,replace:!0})},[t?.redirect,u]),S({active:!c&&l&&!y&&(!!d||!t),owner:s}),c||!l&&!t)return e.jsx(r,{});if(t?.redirect)return e.jsx(r,{});if(d||!t||!t.entity)return e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not Found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"We couldn't resolve this path."})]})]});const g=!o&&typeof a.merged_from=="string"&&t.entity.merged_records?.some(p=>p.name===a.merged_from)?a.merged_from:void 0;return e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsx(n.Suspense,{fallback:e.jsx(r,{}),children:e.jsx(F,{namespace:t.workspace,path:t.path,entity:t.entity,mergedFrom:g,viewKey:o})})]})}export{k as component};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entity-page-ijZe_1-6.js","assets/index-B2AmRqYh.js","assets/index-BmAuAhub.css","assets/schema-value-normalization-3JuM_r1H.js","assets/calendar-DAiyi1ZL.js","assets/view-frame-C7ciEoLo.js","assets/app-bridge-BH3g2mKG.js","assets/missing-view-DrZ8m8yo.js","assets/use-applied-views-B-Z-Weji.js"])))=>i.map(i=>d[i]);
2
+ import{r as n,aV as j,aW as m,aX as v,aY as P,l as R,p as _,_ as E,V as S,j as e,aZ as w,a_ as b,a$ as N}from"./index-B2AmRqYh.js";function h(){return n.useEffect(()=>{j()},[]),null}const F=b(async()=>({default:(await N(async()=>{const{EntityPage:s}=await import("./entity-page-ijZe_1-6.js");return{EntityPage:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).EntityPage}));function r(){return e.jsx("div",{"data-public-loading":"true",children:e.jsx(w,{})})}function k(){const{owner:s,_splat:x}=m.useParams(),a=m.useSearch(),i=v(x||""),o=i?.viewKey,{path:f}=P(s,i?.entityPath),{data:t,isLoading:c,error:d}=R(f,{slug:s},{includeBootstrap:!0}),{session:y,isReady:l}=_(),u=E();if(n.useEffect(()=>{t?.redirect&&u({to:t.redirect.to,replace:!0})},[t?.redirect,u]),S({active:!c&&l&&!y&&(!!d||!t),owner:s}),c||!l&&!t)return e.jsx(r,{});if(t?.redirect)return e.jsx(r,{});if(d||!t||!t.entity)return e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not Found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"We couldn't resolve this path."})]})]});const g=!o&&typeof a.merged_from=="string"&&t.entity.merged_records?.some(p=>p.name===a.merged_from)?a.merged_from:void 0;return e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsx(n.Suspense,{fallback:e.jsx(r,{}),children:e.jsx(F,{namespace:t.workspace,path:t.path,entity:t.entity,mergedFrom:g,viewKey:o})})]})}export{k as component};
@@ -1 +1 @@
1
- import{_ as L,gE as w,r as u,j as n,af as D,cv as k,p as E,q as P,bt as M,bk as N,bF as R,cx as O,gF as F,gG as Q,bQ as $,a3 as B}from"./index-GZkujXG1.js";import{L as _,A as q}from"./agent-thread-DhCFggHZ.js";import{n as b}from"./agent-thread-storage-U6htL3ad.js";import{A as z,C as G}from"./agent-loading-shells-Cve_XIMW.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-Vndny_Gd.js";import"./index-Vcq4gwWv.js";function H({owner:t,agent:s,threadId:e,afterMessagesContent:d,className:r,initialDraft:x,newChatRequested:m=!1,preventAutoNavigate:g}){const o=L(),i=s.agentId,{data:a=[]}=w(i,{orgSlug:t}),[l,p]=u.useState(()=>b()),[h,A]=u.useState(null);u.useEffect(()=>{!m||e||(p(b()),A(null),o({to:".",search:(f=>{const{new:C,...S}=f;return S}),replace:!0}))},[m,e,o]);const v=u.useMemo(()=>!h||a.some(f=>f.id===h.id)?a:[h,...a],[a,h]),c=e??l,T=!e||!v.some(f=>f.id===e),j=u.useCallback(()=>{if(v.some(C=>C.id===c))return;A({id:c,title:`Conversation ${v.length+1}`,createdAt:Date.now(),updatedAt:Date.now()});const f=k(t,i,c);o({...f,replace:!0})},[v,c,o,t,i]),y=u.useCallback(()=>{T&&!g&&j()},[T,j,g]);return n.jsx("div",{className:D("flex min-h-0 flex-1 flex-col",r),children:n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n.jsx(_,{agentId:i,workspaceSlug:t,thread:c,loadHistory:!!e,onFirstUserMessage:y,initialDraft:x,children:n.jsx(q,{afterMessagesContent:d})},`${i}:${c}`)})})}function U({owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m}){const{isAuthenticated:g}=E(),{isMember:o,isLoading:i}=P(),a=g&&o,{data:l=[],isLoading:p}=M({enabled:a}),h=s??null,A=l.find(c=>c.agentId===h)??null;return a&&p||i?n.jsx(z,{}):A?n.jsx(H,{owner:t,agent:A,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m,className:"min-h-0 flex-1 overflow-hidden"}):n.jsx(N,{icon:R,title:"Agent not found",description:"This agent may have been removed."})}function W(t){return[...t].sort((s,e)=>e.updatedAt-s.updatedAt)[0]}function J({owner:t,agentId:s,threadId:e,initialDraft:d,forceComposer:r=!1,newChatRequested:x=!1,afterMessagesContent:m,preventAutoNavigate:g}){const o=L(),{data:i=[],isLoading:a}=O(F(t,s,{strict:!1})),l=u.useMemo(()=>W(i),[i]);return u.useEffect(()=>{if(e||r||a||!l)return;const p=k(t,s,l.id);o({...p,replace:!0})},[s,a,l,o,t,e,r]),!e&&!r&&(a||l)?n.jsx(G,{}):n.jsx(U,{owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:x,afterMessagesContent:m,preventAutoNavigate:g})}function se(){const{owner:t,agentId:s}=Q.useParams(),{threadId:e}=$({strict:!1}),{new:d,prompt:r}=B({strict:!1});return n.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 lg:px-6 lg:py-6",children:n.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col",children:n.jsx(J,{owner:t,agentId:s,threadId:e,initialDraft:r,forceComposer:!e,newChatRequested:!!d})})})}export{se as component};
1
+ import{_ as L,gE as w,r as u,j as n,af as D,cv as k,p as E,q as P,bt as M,bk as N,bF as R,cx as O,gF as F,gG as Q,bQ as $,a3 as B}from"./index-B2AmRqYh.js";import{L as _,A as q}from"./agent-thread-B9-cdkaV.js";import{n as b}from"./agent-thread-storage-U6htL3ad.js";import{A as z,C as G}from"./agent-loading-shells-OagauQzV.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-B4DfZFm5.js";import"./index-Vcq4gwWv.js";function H({owner:t,agent:s,threadId:e,afterMessagesContent:d,className:r,initialDraft:x,newChatRequested:m=!1,preventAutoNavigate:g}){const o=L(),i=s.agentId,{data:a=[]}=w(i,{orgSlug:t}),[l,p]=u.useState(()=>b()),[h,A]=u.useState(null);u.useEffect(()=>{!m||e||(p(b()),A(null),o({to:".",search:(f=>{const{new:C,...S}=f;return S}),replace:!0}))},[m,e,o]);const v=u.useMemo(()=>!h||a.some(f=>f.id===h.id)?a:[h,...a],[a,h]),c=e??l,T=!e||!v.some(f=>f.id===e),j=u.useCallback(()=>{if(v.some(C=>C.id===c))return;A({id:c,title:`Conversation ${v.length+1}`,createdAt:Date.now(),updatedAt:Date.now()});const f=k(t,i,c);o({...f,replace:!0})},[v,c,o,t,i]),y=u.useCallback(()=>{T&&!g&&j()},[T,j,g]);return n.jsx("div",{className:D("flex min-h-0 flex-1 flex-col",r),children:n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n.jsx(_,{agentId:i,workspaceSlug:t,thread:c,loadHistory:!!e,onFirstUserMessage:y,initialDraft:x,children:n.jsx(q,{afterMessagesContent:d})},`${i}:${c}`)})})}function U({owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m}){const{isAuthenticated:g}=E(),{isMember:o,isLoading:i}=P(),a=g&&o,{data:l=[],isLoading:p}=M({enabled:a}),h=s??null,A=l.find(c=>c.agentId===h)??null;return a&&p||i?n.jsx(z,{}):A?n.jsx(H,{owner:t,agent:A,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m,className:"min-h-0 flex-1 overflow-hidden"}):n.jsx(N,{icon:R,title:"Agent not found",description:"This agent may have been removed."})}function W(t){return[...t].sort((s,e)=>e.updatedAt-s.updatedAt)[0]}function J({owner:t,agentId:s,threadId:e,initialDraft:d,forceComposer:r=!1,newChatRequested:x=!1,afterMessagesContent:m,preventAutoNavigate:g}){const o=L(),{data:i=[],isLoading:a}=O(F(t,s,{strict:!1})),l=u.useMemo(()=>W(i),[i]);return u.useEffect(()=>{if(e||r||a||!l)return;const p=k(t,s,l.id);o({...p,replace:!0})},[s,a,l,o,t,e,r]),!e&&!r&&(a||l)?n.jsx(G,{}):n.jsx(U,{owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:x,afterMessagesContent:m,preventAutoNavigate:g})}function se(){const{owner:t,agentId:s}=Q.useParams(),{threadId:e}=$({strict:!1}),{new:d,prompt:r}=B({strict:!1});return n.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 lg:px-6 lg:py-6",children:n.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col",children:n.jsx(J,{owner:t,agentId:s,threadId:e,initialDraft:r,forceComposer:!e,newChatRequested:!!d})})})}export{se as component};
@@ -0,0 +1 @@
1
+ import{gP as r,j as e}from"./index-B2AmRqYh.js";import{A as n}from"./agents-workbench-C2sr5h82.js";import"./agent-editor-form-BYC4uSNz.js";import"./model-selector-CapL1ARf.js";import"./proposal-review-shell-D4YNrrye.js";import"./runs-oHveuEUB.js";function c(){const{owner:o,agentId:t}=r.useParams();return e.jsx(n,{owner:o,agentId:t})}export{c as component};
@@ -1 +1 @@
1
- import{_ as N,Z as k,l as A,p as L,q as C,D as y,j as t,B as n,eD as D,bF as _,S as b,L as R,F as $,gI as p,aS as O}from"./index-GZkujXG1.js";import{a as S}from"./automation-detail-content-C08Ef137.js";import"./create-automation-form-BHir-pIp.js";import"./cronstrue-BwvvZn_Y.js";import"./entity-options-Bm1sbpmt.js";import"./connection-label-BobuYiAG.js";import"./switch-Dcx3_8kM.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-BoudNhPZ.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-bpbaa7f6.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-Vndny_Gd.js";import"./proposal-review-shell-C04RG1qM.js";import"./runs-DwThk2CI.js";import"./json-diff-D6sv990W.js";import"./deployments-DHAx8TBs.js";import"./agent-loading-shells-Cve_XIMW.js";import"./agent-thread-DhCFggHZ.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./events-feed-BgvLTppV.js";import"./use-applied-views-BpvIIgWG.js";import"./clients-DqMOcwpO.js";import"./renderer-eFSU65zm.js";import"./card-MXMmjz9G.js";function z({owner:o,automationId:e,view:a,runId:s}){const r=N(),{orgContext:u,hasOrgContext:x}=k(),{data:g,isLoading:m}=A(`/${o}`,u),{isAuthenticated:h}=L(),{isLoading:c}=C(),f=g?.workspace?.id??"",v=h?!x||m||c:m||c,i=y(e,void 0,f).data?.automation,j=i?.automation_name??"Automation",l=()=>void r({to:"/$owner/automations",params:{owner:o}}),d=()=>void r({to:"/$owner/automations/$automationId",params:{owner:o,automationId:e},search:{view:"activity",run_id:void 0}}),w=!s&&a==="definition";return t.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:t.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsxs(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:l,children:[t.jsx(D,{className:"h-3.5 w-3.5"}),"Automations"]}),t.jsxs("h1",{className:"flex min-w-0 items-center gap-2 truncate font-display text-xl font-semibold",children:[t.jsx(_,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),v&&!i?t.jsx(b,{className:"h-5 w-40"}):s?"Review change":j]})]}),s?null:w?t.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-muted-foreground hover:text-foreground",onClick:d,children:"Done"}):t.jsx(n,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 gap-1.5",children:t.jsxs(R,{to:"/$owner/automations/$automationId",params:{owner:o,automationId:e},search:{view:"definition",run_id:void 0},children:[t.jsx($,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx(S,{owner:o,agentId:i?.managed_agent_id??null,automationId:e,view:a,runId:s,onDone:s?l:d})]})})}function ct(){const{owner:o,automationId:e}=p.useParams(),a=p.useSearch();return t.jsx(O,{owner:o,children:()=>t.jsx(z,{owner:o,automationId:e,view:a.view,runId:a.run_id})})}export{ct as component};
1
+ import{_ as N,Z as k,l as A,p as L,q as C,D as y,j as t,B as n,eD as D,bF as _,S as b,L as R,F as $,gI as p,aS as O}from"./index-B2AmRqYh.js";import{a as S}from"./automation-detail-content-9Rjb_I9j.js";import"./create-automation-form-CuxiIRCF.js";import"./cronstrue-2GHCtD7h.js";import"./entity-options-CrbS6K-i.js";import"./connection-label-BobuYiAG.js";import"./switch-BQ40_DMb.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-CapL1ARf.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-CYsR2VBP.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-B4DfZFm5.js";import"./proposal-review-shell-D4YNrrye.js";import"./runs-oHveuEUB.js";import"./json-diff-ClBBYBQD.js";import"./deployments-ByBv1DW-.js";import"./agent-loading-shells-OagauQzV.js";import"./agent-thread-B9-cdkaV.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./events-feed-DK35T4g7.js";import"./use-applied-views-B-Z-Weji.js";import"./clients-Cp1BJ28u.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";function z({owner:o,automationId:e,view:a,runId:s}){const r=N(),{orgContext:u,hasOrgContext:x}=k(),{data:g,isLoading:m}=A(`/${o}`,u),{isAuthenticated:h}=L(),{isLoading:c}=C(),f=g?.workspace?.id??"",v=h?!x||m||c:m||c,i=y(e,void 0,f).data?.automation,j=i?.automation_name??"Automation",l=()=>void r({to:"/$owner/automations",params:{owner:o}}),d=()=>void r({to:"/$owner/automations/$automationId",params:{owner:o,automationId:e},search:{view:"activity",run_id:void 0}}),w=!s&&a==="definition";return t.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:t.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsxs(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:l,children:[t.jsx(D,{className:"h-3.5 w-3.5"}),"Automations"]}),t.jsxs("h1",{className:"flex min-w-0 items-center gap-2 truncate font-display text-xl font-semibold",children:[t.jsx(_,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),v&&!i?t.jsx(b,{className:"h-5 w-40"}):s?"Review change":j]})]}),s?null:w?t.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-muted-foreground hover:text-foreground",onClick:d,children:"Done"}):t.jsx(n,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 gap-1.5",children:t.jsxs(R,{to:"/$owner/automations/$automationId",params:{owner:o,automationId:e},search:{view:"definition",run_id:void 0},children:[t.jsx($,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx(S,{owner:o,agentId:i?.managed_agent_id??null,automationId:e,view:a,runId:s,onDone:s?l:d})]})})}function ct(){const{owner:o,automationId:e}=p.useParams(),a=p.useSearch();return t.jsx(O,{owner:o,children:()=>t.jsx(z,{owner:o,automationId:e,view:a.view,runId:a.run_id})})}export{ct as component};
@@ -1 +1 @@
1
- import{h$ as F,j as e,aS as P,_ as W,b9 as H,a as O,d7 as V,i as G,S as L,L as h,gC as v,gA as U,bp as q,de as z,gB as J,hk as A,a4 as Q}from"./index-GZkujXG1.js";import{R as X,c as Y,C as Z}from"./device-pin-tombstone-Dkmmka9d.js";import{a as K}from"./connector-provenance-RL_DcF2q.js";import{f as ee,C as ne,F as se,b as ae,a as oe,A as te,c as ce}from"./connection-feed-detail-XYK-ubKG.js";import{S as ie,g as re}from"./runs-table-Dh7FL3Va.js";import{c as de}from"./connection-label-BobuYiAG.js";import{c as le}from"./device-rows-CkTAaZ3m.js";import"./runs-panel-DfxWCV7K.js";import"./runs-DwThk2CI.js";import"./entity-options-Bm1sbpmt.js";function _e(){const{owner:r,connectorKey:a,connectionId:f}=F.useParams(),{addFeed:o,feedId:d,settings:u,auth_result:c}=F.useSearch();return e.jsx(P,{owner:r,children:l=>e.jsx(me,{organizationId:l.organizationId,ownerSlug:l.ownerSlug,isWorkspaceLoading:l.isWorkspaceLoading,connectorKey:a,connectionId:Number(f),showAddFeed:o===!0,feedId:d,openSettings:u===!0,authResult:c})})}function me({organizationId:r,ownerSlug:a,isWorkspaceLoading:f,connectorKey:o,connectionId:d,showAddFeed:u,feedId:c,openSettings:l,authResult:R}){const S=W(),{data:I=[]}=H(),{data:B=[],isLoading:E}=O(r??"",{connectorKey:o}),{data:C=[]}=V(r??""),{data:M=[]}=G(c?d:null),n=B.find(t=>t.id===d),s=C.find(t=>t.key===o),i=c?M.find(t=>t.id===c):null;if(f||E||!r)return e.jsxs("div",{className:"flex flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[e.jsx(L,{className:"h-7 w-56"}),e.jsx(L,{className:"h-4 w-24"})]}),e.jsx(X,{})]});if(!n)return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connection not found."}),e.jsxs(h,{to:"/$owner/connectors/$connectorKey",params:{owner:a,connectorKey:o},className:"mt-2 inline-block text-sm text-primary hover:underline",children:["Back to ",s?.name??o]})]});const D=de({...n,connector_name:n.connector_name??s?.name??null}),p=!c&&!u,T=()=>void S({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:o,connectionId:String(d)},search:{},replace:!0});let m,x=D,g,_,j;c?i?(x=ee(i,s),i.store==="channel_messages"?(m=e.jsx(ne,{feed:i,hideHeader:!0}),j="chat channel"):(g=e.jsx(se,{feed:i,ownerSlug:a}),_=e.jsx(ae,{feed:i}),m=e.jsx(oe,{feed:i,connectorDef:s,ownerSlug:a}))):(m=e.jsx("p",{className:"text-sm text-muted-foreground",children:"Feed not found."}),x="Feed"):u&&(m=e.jsx(te,{onClose:T,organizationId:r,connections:[n],connectorDefinitions:C}),x="Add feed",j=ce);const N=[e.jsx(h,{to:"/$owner/connectors",params:{owner:a},className:v,children:"Connectors"},"connectors"),e.jsx(h,{to:"/$owner/connectors/$connectorKey",params:{owner:a,connectorKey:o},search:{},className:v,children:s?.name??o},"connector")];p||N.push(e.jsx(h,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:o,connectionId:String(d)},search:{},className:v,children:D},"connection"));const $=p?Y(n):null,y=j??$??void 0,b=e.jsx(U,{breadcrumb:e.jsx(J,{crumbs:N}),icon:s?e.jsx(q,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??z(s.auth_schema)}):null,title:x,status:g??e.jsx(ie,{status:re(n.status),showDot:!0,children:n.status}),meta:_,caption:y,captionTone:$?"error":"muted"});if(!p)return e.jsx(A,{header:b,children:e.jsx("div",{className:"mt-0",children:m})});const k=s&&le(s)?I.find(t=>t.id===n.device_worker_id&&t.connectors.some(w=>w.connection_id===n.id&&w.organization_slug===a)):void 0;return k?e.jsx(Q,{to:"/$owner/connectors/device/$deviceId",params:{owner:a,deviceId:k.id},search:{connection:n.id,settings:l||void 0},hash:`connection-${n.id}`,replace:!0}):e.jsxs(A,{header:b,children:[e.jsx(K,{connectorDef:s,connectorKey:o,ownerSlug:a,deviceWorkerId:n.device_worker_id,deviceLabel:n.device_label}),e.jsx(Z,{connection:n,connectorDef:s,ownerSlug:a,openSettings:l,authResult:R},n.id)]})}export{_e as component};
1
+ import{h$ as F,j as e,aS as P,_ as W,b9 as H,a as O,d7 as V,i as G,S as L,L as h,gC as v,gA as U,bp as q,de as z,gB as J,hk as A,a4 as Q}from"./index-B2AmRqYh.js";import{R as X,c as Y,C as Z}from"./device-pin-tombstone-Bd6vS2zu.js";import{a as K}from"./connector-provenance-BjKiUhYE.js";import{f as ee,C as ne,F as se,b as ae,a as oe,A as te,c as ce}from"./connection-feed-detail-D1whY5hL.js";import{S as ie,g as re}from"./runs-table-BUKDjiBc.js";import{c as de}from"./connection-label-BobuYiAG.js";import{c as le}from"./device-rows-Bwf8qDte.js";import"./runs-panel-C56GDaJm.js";import"./runs-oHveuEUB.js";import"./entity-options-CrbS6K-i.js";function _e(){const{owner:r,connectorKey:a,connectionId:f}=F.useParams(),{addFeed:o,feedId:d,settings:u,auth_result:c}=F.useSearch();return e.jsx(P,{owner:r,children:l=>e.jsx(me,{organizationId:l.organizationId,ownerSlug:l.ownerSlug,isWorkspaceLoading:l.isWorkspaceLoading,connectorKey:a,connectionId:Number(f),showAddFeed:o===!0,feedId:d,openSettings:u===!0,authResult:c})})}function me({organizationId:r,ownerSlug:a,isWorkspaceLoading:f,connectorKey:o,connectionId:d,showAddFeed:u,feedId:c,openSettings:l,authResult:R}){const S=W(),{data:I=[]}=H(),{data:B=[],isLoading:E}=O(r??"",{connectorKey:o}),{data:C=[]}=V(r??""),{data:M=[]}=G(c?d:null),n=B.find(t=>t.id===d),s=C.find(t=>t.key===o),i=c?M.find(t=>t.id===c):null;if(f||E||!r)return e.jsxs("div",{className:"flex flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[e.jsx(L,{className:"h-7 w-56"}),e.jsx(L,{className:"h-4 w-24"})]}),e.jsx(X,{})]});if(!n)return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connection not found."}),e.jsxs(h,{to:"/$owner/connectors/$connectorKey",params:{owner:a,connectorKey:o},className:"mt-2 inline-block text-sm text-primary hover:underline",children:["Back to ",s?.name??o]})]});const D=de({...n,connector_name:n.connector_name??s?.name??null}),p=!c&&!u,T=()=>void S({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:o,connectionId:String(d)},search:{},replace:!0});let m,x=D,g,_,j;c?i?(x=ee(i,s),i.store==="channel_messages"?(m=e.jsx(ne,{feed:i,hideHeader:!0}),j="chat channel"):(g=e.jsx(se,{feed:i,ownerSlug:a}),_=e.jsx(ae,{feed:i}),m=e.jsx(oe,{feed:i,connectorDef:s,ownerSlug:a}))):(m=e.jsx("p",{className:"text-sm text-muted-foreground",children:"Feed not found."}),x="Feed"):u&&(m=e.jsx(te,{onClose:T,organizationId:r,connections:[n],connectorDefinitions:C}),x="Add feed",j=ce);const N=[e.jsx(h,{to:"/$owner/connectors",params:{owner:a},className:v,children:"Connectors"},"connectors"),e.jsx(h,{to:"/$owner/connectors/$connectorKey",params:{owner:a,connectorKey:o},search:{},className:v,children:s?.name??o},"connector")];p||N.push(e.jsx(h,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:o,connectionId:String(d)},search:{},className:v,children:D},"connection"));const $=p?Y(n):null,y=j??$??void 0,b=e.jsx(U,{breadcrumb:e.jsx(J,{crumbs:N}),icon:s?e.jsx(q,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??z(s.auth_schema)}):null,title:x,status:g??e.jsx(ie,{status:re(n.status),showDot:!0,children:n.status}),meta:_,caption:y,captionTone:$?"error":"muted"});if(!p)return e.jsx(A,{header:b,children:e.jsx("div",{className:"mt-0",children:m})});const k=s&&le(s)?I.find(t=>t.id===n.device_worker_id&&t.connectors.some(w=>w.connection_id===n.id&&w.organization_slug===a)):void 0;return k?e.jsx(Q,{to:"/$owner/connectors/device/$deviceId",params:{owner:a,deviceId:k.id},search:{connection:n.id,settings:l||void 0},hash:`connection-${n.id}`,replace:!0}):e.jsxs(A,{header:b,children:[e.jsx(K,{connectorDef:s,connectorKey:o,ownerSlug:a,deviceWorkerId:n.device_worker_id,deviceLabel:n.device_label}),e.jsx(Z,{connection:n,connectorDef:s,ownerSlug:a,openSettings:l,authResult:R},n.id)]})}export{_e as component};
@@ -1 +1 @@
1
- import{h4 as Xe,am as Ze,h5 as re,r as h,h6 as ye,h7 as Je,cw as es,h8 as Ne,aA as K,h9 as be,j as e,a6 as P,bR as we,bS as Se,bT as Ae,bU as _e,bV as Pe,gW as ss,a7 as $,B as g,b_ as Y,n as T,R as Ce,ha as ts,hb as as,x as ns,hc as rs,bu as ie,hd as is,he as ls,hf as De,hg as Le,hh as $e,aP as J,ab as M,bD as ae,hi as os,g1 as cs,hj as ds,fL as W,hk as le,hl as us,S as L,eL as I,p as ms,hm as hs,hn as xs,ho as ps,hp as fs,hq as gs,hr as js,hs as vs,ht as ys,cc as Z,hu as Ns,hv as bs,cb as Cs,eh as ks,e3 as ws,af as ee,dL as Ss,cf as As,P as Fe,hw as se,hx as _s,aS as Ps,hy as Oe,b5 as te,o as Ee,eN as Re,bd as Ds,hz as Be,eM as Ls,hA as Ue,L as G,hB as $s,ek as Fs,u as Os,a as Es,bl as Rs,ba as V,cD as Ie,_ as q,hC as Bs,b8 as Us,hD as Is,gA as oe,bq as Me,bp as ce,bm as Ms,gB as de,gC as ue,b6 as zs,b7 as Ts,hE as Ks,de as Vs}from"./index-GZkujXG1.js";import{C as qs}from"./connector-provenance-RL_DcF2q.js";import{a as Ys}from"./runs-table-Dh7FL3Va.js";import{R as Ws}from"./runs-panel-DfxWCV7K.js";import"./connection-label-BobuYiAG.js";import"./runs-DwThk2CI.js";function Gs({catalog:s,initialProvider:t,initialModel:a,onDone:n}){const r=Xe(),i=Ze(),o=s.find(l=>l.slug===t)??s[0],p=o&&re(o)?"oauth":"api-key",[d,x]=h.useState(o?.slug??""),[u,c]=h.useState(o?.slug??""),[v,y]=h.useState(o?.displayName??""),[j,N]=h.useState(o?.baseUrl??""),[C,D]=h.useState(a??o?.defaultModel??""),[S,k]=h.useState(""),[z,w]=h.useState(o?.apiKeyPlaceholder??""),[R,F]=h.useState(p),[E,B]=h.useState(""),[f,m]=h.useState(null),[A,U]=h.useState(!1),[Q,me]=h.useState(!1),b=s.find(l=>l.slug===d),H=ye(b?.modalities??[]),he=b?re(b):!1,xe=b?Je(b):!1,pe=he&&R==="oauth",fe=xe&&!pe,O=es().slug,X=h.useCallback(()=>{me(!0),i.invalidateQueries({queryKey:["inference-providers"]})},[i]),Ke=h.useCallback(()=>{i.invalidateQueries({queryKey:["inference-providers"]}),n()},[i,n]),Ve=h.useCallback(async()=>{if(!(!O||!b)){U(!0);try{const l=await Ne(O,b.slug);if(l.mode!=="redirect")throw new Error("Unexpected sign-in mode");window.open(l.authorizeUrl,"_blank","noreferrer")}catch(l){K.error(l instanceof Error?l.message:"Failed to start sign-in")}finally{U(!1)}}},[O,b]),qe=h.useCallback(async()=>{if(!(!O||!b||!E.trim())){U(!0);try{const l=await be(O,b.slug,{code:E.trim()});if(l.status!=="success")throw new Error(l.error||"Sign-in not complete");X(),K.success(`Signed in with ${b.displayName}`)}catch(l){K.error(l instanceof Error?l.message:"Failed to complete sign-in")}finally{U(!1)}}},[O,b,E,X]),Ye=h.useCallback(async()=>{if(!(!O||!b)){U(!0);try{const l=await Ne(O,b.slug);if(l.mode!=="device")throw new Error("Unexpected sign-in mode");m({userCode:l.userCode,deviceAuthId:l.deviceAuthId,verificationUrl:l.verificationUrl}),window.open(l.verificationUrl,"_blank","noreferrer")}catch(l){K.error(l instanceof Error?l.message:"Failed to start sign-in")}finally{U(!1)}}},[O,b]),We=h.useCallback(async()=>{if(!(!O||!b||!f)){U(!0);try{const l=await be(O,b.slug,{deviceAuthId:f.deviceAuthId,userCode:f.userCode});if(l.status==="success"){X(),K.success(`Signed in with ${b.displayName}`);return}m(_=>_&&{..._,message:l.error||"Waiting for approval..."})}catch(l){K.error(l instanceof Error?l.message:"Failed to check status")}finally{U(!1)}}},[O,b,f,X]),Ge=b?.supportedAuthTypes.includes("device-code")??!1,Qe=l=>{x(l);const _=s.find(ne=>ne.slug===l);_&&(c(_.slug),y(_.displayName),N(_.baseUrl),D(_.slug===t&&a?a:_.defaultModel??""),w(_.apiKeyPlaceholder),F(re(_)?"oauth":"api-key"),B(""),m(null),me(!1))},ge=/^[a-z0-9][a-z0-9-]*$/.test(u),je=ge&&fe&&S.trim().length>0&&!r.isPending,He=l=>{if(l.preventDefault(),!je)return;const _={};j.trim()&&(_.base_url=j.trim()),C.trim()&&(_.model=C.trim());const ne=Object.keys(_).length>0?{text:_}:void 0;r.mutate({slug:u.trim(),kind:d,displayName:v.trim()||void 0,apiKey:S.trim(),capabilities:ne},{onSuccess:()=>n()})},ve=!!(t&&s.some(l=>l.slug===t));return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:ve&&b?`Connect ${b.displayName}`:"Add an inference provider"}),e.jsxs("form",{onSubmit:He,className:"grid max-w-md gap-3",children:[ve&&b?e.jsx("p",{className:"text-xs text-muted-foreground",children:H.length>0?`Serves text, plus ${H.join(", ").toLowerCase()}.`:"Serves text (chat)."}):e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-provider",children:"Provider"}),e.jsxs(we,{value:d,onValueChange:Qe,children:[e.jsx(Se,{id:"ip-provider",className:"w-full",children:e.jsx(Ae,{})}),e.jsx(_e,{children:s.map(l=>{const _=ye(l.modalities);return e.jsx(Pe,{value:l.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[l.iconUrl?e.jsx("img",{src:l.iconUrl,alt:"",className:"h-4 w-4 shrink-0 rounded-sm",loading:"lazy"}):e.jsx(ss,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),l.displayName,_.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",_.join(", ")]}):null]})},l.slug)})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:H.length>0?`Serves text, plus ${H.join(", ").toLowerCase()}.`:"Serves text (chat)."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-display",children:"Name"}),e.jsx($,{id:"ip-display",placeholder:"Friendly name",value:v,onChange:l=>y(l.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(P,{htmlFor:"ip-slug",children:["Slug ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx($,{id:"ip-slug",placeholder:"my-provider",value:u,onChange:l=>c(l.target.value),autoComplete:"off",required:!0}),u&&!ge?e.jsx("p",{className:"text-xs text-destructive",children:"Lowercase letters, numbers, and hyphens only."}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"A stable identifier agents reference this provider by."})]}),he&&xe?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{children:"Auth method"}),e.jsxs("div",{className:"inline-flex w-fit rounded-md border border-border p-1",children:[e.jsx(g,{type:"button",size:"sm",variant:R==="oauth"?"secondary":"ghost",onClick:()=>F("oauth"),children:"Sign in"}),e.jsx(g,{type:"button",size:"sm",variant:R==="api-key"?"secondary":"ghost",onClick:()=>F("api-key"),children:"API key"})]})]}):null,fe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-base-url",children:"Base URL"}),e.jsx($,{id:"ip-base-url",placeholder:"https://api.example.com/v1",value:j,onChange:l=>N(l.target.value),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the upstream URL — e.g. a self-hosted vLLM, Azure, or LiteLLM endpoint."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-model",children:"Default model"}),e.jsx($,{id:"ip-model",placeholder:"gpt-4o-mini",value:C,onChange:l=>D(l.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(P,{htmlFor:"ip-key",children:["API key ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx($,{id:"ip-key",type:"password",placeholder:z||void 0,value:S,onChange:l=>k(l.target.value),autoComplete:"off",required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored encrypted in the vault. It's never shown again — rotate it here if it changes."})]}),e.jsx(Y,{onCancel:n,children:e.jsx(g,{type:"submit",disabled:!je,children:r.isPending?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Creating..."]}):"Create provider"})})]}):pe?e.jsxs("div",{className:"grid gap-3",children:[Q?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Signed in with ",b?.displayName??"provider",". This covers your agents in this org."]}):Ge?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void Ye(),disabled:A||!O,children:f?"Get a new code":"Get device code"}),f?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-device-code",children:"Device code"}),e.jsx($,{id:"ip-device-code",readOnly:!0,value:f.userCode}),e.jsx(g,{type:"button",variant:"default",className:"justify-self-start",asChild:!0,children:e.jsxs("a",{href:f.verificationUrl,target:"_blank",rel:"noreferrer",children:["Open ",b?.displayName??"provider"," to approve",e.jsx(Ce,{className:"h-4 w-4"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.message||"We opened the approval page. Enter the code above if asked, approve, then check status."}),e.jsx(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void We(),disabled:A,children:A?"Checking...":"Check status"})]}):null]}):e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void Ve(),disabled:A||!O,children:["Sign in with ",b?.displayName??"provider",e.jsx(Ce,{className:"h-4 w-4"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-oauth-code",children:"Paste code#state"}),e.jsx($,{id:"ip-oauth-code",placeholder:"code#state",value:E,onChange:l=>B(l.target.value),autoComplete:"off"})]}),e.jsx(g,{type:"button",className:"justify-self-start",onClick:()=>void qe(),disabled:A||!E.trim(),children:A?"Finishing...":"Finish sign-in"})]}),e.jsx(Y,{onCancel:n,children:e.jsx(g,{type:"button",onClick:Ke,disabled:!Q,children:"Done"})})]}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This provider cannot be added from the catalog yet."}),e.jsx(Y,{onCancel:n})]})]})]})}const Qs={text:"Text",image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function Hs({provider:s,catalog:t,autoOpenEdit:a}){const n=ts(),[r,i]=h.useState(a?"edit":null),o=as(s.kind,t);h.useEffect(()=>{a&&i("edit")},[a]);const d=(t.find(c=>c.slug===s.kind)?.modalities??["text"]).filter(c=>c!=="text"),x=o&&d.length>0,u=c=>i(v=>v===c?null:c);return e.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:"Credential"}),e.jsxs("p",{className:"truncate text-[11px] text-muted-foreground",children:[s.slug,s.createdAt?` · created ${ns(s.createdAt)}`:""]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.isDefault?null:e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",disabled:n.isPending,onClick:()=>n.mutate({providerSlug:s.slug}),children:"Set as default"}),x?e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>u("capabilities"),children:"Configure"}):null,e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>u("edit"),children:"Edit"})]})]}),r==="edit"?e.jsx("div",{className:"border-t px-3 py-3",children:e.jsx(Zs,{provider:s,supportsUpstreamConfig:o,onDone:()=>i(null)})}):null,r==="capabilities"&&x?e.jsx("div",{className:"border-t px-3 py-3",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Other modalities (optional)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This provider's text base URL and model are set under Edit. Only set these if you want a modality routed to a different endpoint — otherwise it uses the provider's defaults."})]}),d.map(c=>e.jsx(Js,{providerSlug:s.slug,modality:c,block:s.capabilities[c]??{}},c))]})}):null]})}function Xs({provider:s,onDeleted:t}){const a=rs(),[n,r]=h.useState(!1);return e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Delete provider"}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Removes ",s.displayName||s.slug," and its stored key from this workspace. Agents referencing it will need another connected provider before they can run."]}),e.jsx("div",{className:"mt-3",children:n?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(g,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({providerSlug:s.slug},{onSuccess:t,onSettled:()=>r(!1)}),children:[a.isPending?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(g,{variant:"ghost",size:"sm",disabled:a.isPending,onClick:()=>r(!1),children:"Cancel"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:a.isPending,onClick:()=>r(!0),children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete provider"]})})]})}function Zs({provider:s,supportsUpstreamConfig:t,onDone:a}){const n=is(),r=ls(),i=De(),[o,p]=h.useState(s.displayName??""),[d,x]=h.useState(""),u=s.capabilities.text??{},[c,v]=h.useState(u.base_url??""),[y,j]=h.useState(u.model??""),[N,C]=h.useState(null),D=o.trim().length>0&&o.trim()!==(s.displayName??""),S=t&&d.trim().length>0,k=c.trim()!==(u.base_url??""),z=y.trim()!==(u.model??""),w=t&&(k||z),R={base_url:c.trim()||void 0,model:y.trim()||void 0,models_endpoint:u.models_endpoint},F=Le(R),E=t&&w&&$e(F),B=n.isPending||r.isPending||i.isPending,f=(D||S||w)&&!E&&!B,m=async A=>{if(A.preventDefault(),!!f){C(null);try{await Promise.all([D?n.mutateAsync({providerSlug:s.slug,displayName:o.trim()}):Promise.resolve(),w?i.mutateAsync({providerSlug:s.slug,modality:"text",block:R}):Promise.resolve(),S?r.mutateAsync({providerSlug:s.slug,value:d.trim()}):Promise.resolve()]),a()}catch{C("Some changes could not be saved. Review the fields and try again.")}}};return e.jsxs("form",{onSubmit:m,className:"grid max-w-md gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-name-${s.slug}`,children:"Name"}),e.jsx($,{id:`edit-name-${s.slug}`,value:o,onChange:A=>p(A.target.value),placeholder:s.slug}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["The slug (",e.jsx("code",{children:s.slug}),") is fixed — agents reference it."]})]}),t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-base-${s.slug}`,children:"Base URL"}),e.jsx($,{id:`edit-base-${s.slug}`,placeholder:"https://api.example.com/v1",value:c,onChange:A=>v(A.target.value),autoComplete:"off"}),F.base_url?e.jsx("p",{className:"text-xs text-destructive",children:F.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-model-${s.slug}`,children:"Default model"}),e.jsx($,{id:`edit-model-${s.slug}`,placeholder:"gpt-4o-mini",value:y,onChange:A=>j(A.target.value),autoComplete:"off"}),F.model?e.jsx("p",{className:"text-xs text-destructive",children:F.model}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-key-${s.slug}`,children:"New API key"}),e.jsx($,{id:`edit-key-${s.slug}`,type:"password",value:d,onChange:A=>x(A.target.value),autoComplete:"off",placeholder:"Leave blank to keep the current key"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter a value only to replace the stored key. The old key is discarded."})]})]}):null,N?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,e.jsx(Y,{onCancel:a,children:e.jsx(g,{type:"submit",disabled:!f,children:B?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]})}function Js({providerSlug:s,modality:t,block:a}){const n=De(),[r,i]=h.useState(!1),[o,p]=h.useState(a.base_url??""),[d,x]=h.useState(a.model??""),[u,c]=h.useState(a.models_endpoint??""),[v,y]=h.useState(!!a.models_endpoint),j=!!(a.base_url||a.model||a.models_endpoint),N={base_url:o.trim()||void 0,model:d.trim()||void 0,models_endpoint:u.trim()||void 0},C=Le(N),D=$e(C),S=()=>{D||n.mutate({providerSlug:s,modality:t,block:N})};return e.jsxs("div",{className:J,children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-left",onClick:()=>i(k=>!k),children:[e.jsx("span",{className:"text-sm font-medium",children:Qs[t]}),j?e.jsx(M,{variant:"outline",children:"Custom"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Static"})]}),r?e.jsxs("div",{className:"grid gap-3 border-t px-3 py-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`base-${s}-${t}`,children:"Base URL"}),e.jsx($,{id:`base-${s}-${t}`,placeholder:"https://api.example.com/v1",value:o,onChange:k=>p(k.target.value),autoComplete:"off"}),C.base_url?e.jsx("p",{className:"text-xs text-destructive",children:C.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`model-${s}-${t}`,children:"Model"}),e.jsx($,{id:`model-${s}-${t}`,placeholder:"gpt-4o-mini",value:d,onChange:k=>x(k.target.value),autoComplete:"off"}),C.model?e.jsx("p",{className:"text-xs text-destructive",children:C.model}):null]}),v?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`endpoint-${s}-${t}`,children:"Models endpoint"}),e.jsx($,{id:`endpoint-${s}-${t}`,placeholder:"/v1/models",value:u,onChange:k=>c(k.target.value),autoComplete:"off"}),C.models_endpoint?e.jsx("p",{className:"text-xs text-destructive",children:C.models_endpoint}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Path used to list this modality's models (e.g. /v1/models)."})]}):e.jsx("button",{type:"button",className:"justify-self-start text-xs text-muted-foreground hover:text-foreground",onClick:()=>y(!0),children:"Advanced"}),e.jsx(Y,{onCancel:()=>i(!1),children:e.jsx(g,{size:"sm",disabled:D||n.isPending,onClick:S,children:n.isPending?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]}):null]})}function et({sandbox:s}){const t=Object.entries(s.details??{});return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(tt,{kind:s.providerKind}),e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx(M,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] uppercase tracking-wide",children:s.providerKind}),s.connected?e.jsx(M,{className:"h-4 border-transparent bg-emerald-500/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-emerald-500",children:"Connected"}):e.jsx(M,{variant:"destructive",className:"h-4 border-transparent bg-destructive/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-destructive",children:"No credential"})]}),t.length>0?e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:t.map(([a,n])=>`${a}: ${n}`).join(" | ")}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remote sandbox agents execute in instead of the built-in local runtime."}),s.connected?null:e.jsxs("div",{className:"flex gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("p",{children:"This sandbox has no vault credential. Delete it and re-add the provider with a valid key, or set the credential via the API."})]})]})})}function st({sandbox:s,onDeleted:t}){const a=os(),[n,r]=h.useState(!1);return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"rounded-lg border border-destructive/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Remove sandbox"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Agents pinned to this runtime fall back to the built-in local sandbox."})]})]}),n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({id:s.id},{onSuccess:t}),children:a.isPending?e.jsx(T,{}):"Delete permanently"}),e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"})]}):e.jsx(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>r(!0),children:"Delete sandbox"})]})})}function tt({kind:s}){return s==="vercel"?e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4 w-4 shrink-0 fill-foreground","aria-hidden":!0,children:[e.jsx("title",{children:"Vercel"}),e.jsx("path",{d:"M12 3 22 20H2L12 3Z"})]}):s==="builtin"?e.jsx(cs,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(ds,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}const at={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},nt={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function Dt(){const{owner:s,connectorKey:t}=se.useParams(),{kind:a,id:n}=_s(t);return e.jsx(Ps,{owner:s,children:({ownerSlug:r,organizationId:i,isWorkspaceLoading:o})=>{switch(a){case"inference":return e.jsx(lt,{ownerSlug:r,providerSlug:n});case"sandbox":return e.jsx(it,{ownerSlug:r,sandboxId:n});case"sandbox-provider":return e.jsx(rt,{ownerSlug:r,providerKind:n});default:return e.jsx(ut,{ownerSlug:r,organizationId:i,isWorkspaceLoading:o,connectorKey:t})}}})}function rt({ownerSlug:s,providerKind:t}){const a=q();return h.useEffect(()=>{a({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:`${Bs}${t}`},replace:!0})},[a,s,t]),null}function it({ownerSlug:s,sandboxId:t}){const a=q(),{data:n,isLoading:r}=Us(),i=n?.sandboxes.find(p=>p.id===t)??null;if(r)return e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-24 w-full rounded-lg"})]});if(!i)return e.jsxs(V,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This sandbox isn't in this workspace, so its details aren't available."}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>void a({to:"/$owner/connectors",params:{owner:s}}),children:"Back to connectors"})]});const o=i.name||Is(i.providerKind);return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:s},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{name:o,faviconDomain:Ms(i.providerKind)}),title:o,badge:e.jsxs(e.Fragment,{children:[e.jsx(M,{variant:"secondary",children:i.providerKind}),i.connected?e.jsx(M,{className:"border-transparent bg-emerald-500/10 text-emerald-500",children:"Connected"}):e.jsx(M,{variant:"destructive",children:"No credential"})]}),status:e.jsx(Me,{facets:nt})}),children:[e.jsx(et,{sandbox:i}),e.jsx(I,{title:"Settings",muted:!0,children:e.jsx(st,{sandbox:i,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})})]})})}function lt({ownerSlug:s,providerSlug:t}){const a=q(),{model:n,reason:r,agentId:i}=se.useSearch(),{data:o=[],isLoading:p}=zs(),d=Ts(),{data:x=[],isLoading:u}=d,c=o.find(D=>D.slug===t)??null,v=x.find(D=>D.slug===(c?.kind??t))??null;if(p||u)return e.jsx("div",{children:e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-16 w-full rounded-lg"}),e.jsx(L,{className:"h-24 w-full rounded-lg"}),e.jsx(L,{className:"h-32 w-full rounded-lg"})]})});if(!c&&!v&&!d.isError)return e.jsxs(V,{className:"space-y-3",children:[e.jsx(Ie,{connector:{key:t,name:t},showDescription:!1,className:"gap-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector isn't installed in this workspace, so its details aren't available."})]});const y=c?.displayName||v?.displayName||t,j=c!==null,N=r?e.jsx(dt,{agentId:i,model:n,providerName:y}):n?e.jsx(ct,{providerName:y,model:n,isConnected:j}):null,C=e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:s},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{iconUrl:v?.iconUrl,name:y}),title:y,badge:c?e.jsxs(e.Fragment,{children:[c.isDefault?e.jsx(M,{variant:"secondary",children:"Default"}):null,c.status?e.jsx(M,{variant:"outline",children:c.status}):null,c.hasCustomUpstream?e.jsx(M,{variant:"outline",children:"Custom upstream"}):null]}):null,status:e.jsx(Me,{facets:at})});return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:C,children:[N,e.jsx("div",{className:"space-y-6",children:c?e.jsx(Hs,{provider:c,catalog:x,autoOpenEdit:!!n}):e.jsx(ot,{ownerSlug:s,providerSlug:t,catalog:x,catalogError:d.isError?d.error:null,model:n})}),c?e.jsx(I,{title:"Settings",muted:!0,children:e.jsx(Xs,{provider:c,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})}):null]})})}function ot({ownerSlug:s,providerSlug:t,catalog:a,catalogError:n,model:r}){const i=q();return n?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load provider catalog."}),e.jsx("p",{className:"mt-1 text-xs",children:n instanceof Error?n.message:"Check the workspace URL and try again."})]})]})}):e.jsx("div",{className:"rounded-lg border p-4",children:e.jsx(Gs,{catalog:a,initialProvider:t,initialModel:r?.includes("/")?r.split("/").slice(1).join("/"):r,onDone:()=>void i({to:"/$owner/connectors",params:{owner:s}})},`${a.length}:${t}`)})}function ct({providerName:s,model:t,isConnected:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review ",e.jsx("strong",{children:s})," for model"," ",e.jsx("strong",{children:t}),"."," ",a?"Its edit controls are open.":"It is not connected yet; add it to continue."]})]})})}function dt({agentId:s,model:t,providerName:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"This agent needs a model provider before it can reply."}),e.jsxs("p",{children:[s?e.jsxs("span",{children:["Agent ",e.jsx("strong",{children:s})," is"," "]}):null,"configured to use ",t?e.jsx("strong",{children:t}):"a model"," ","from ",e.jsx("strong",{children:a}),", but that provider is not ready in this workspace."]}),e.jsx("p",{children:"Connect the provider below, then retry the message."})]})]})})}function ut({ownerSlug:s,organizationId:t,isWorkspaceLoading:a,connectorKey:n}){const{data:r=[],isLoading:i}=Os(t??""),{data:o=[],isLoading:p,refetch:d}=Es(t??"",{connectorKey:n}),x=h.useMemo(()=>r.find(v=>v.key===n),[r,n]),u=h.useMemo(()=>Rs(n,r,{name:o[0]?.connector_name??n}),[n,r,o]);if(a||i)return e.jsx("div",{children:e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-16 w-full rounded-lg"}),e.jsx(L,{className:"h-24 w-full rounded-lg"}),e.jsx(L,{className:"h-32 w-full rounded-lg"})]})});const c=x?e.jsx(ht,{connector:x,ownerSlug:s}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ie,{connector:u,showDescription:!1,className:"gap-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This connector isn't installed in this workspace, so its details aren't available.",o.length>0?" Existing connections keep working.":""]})]});return e.jsx("div",{className:"flex flex-1 flex-col",children:x&&t?e.jsx(mt,{hero:c,connector:x,organizationId:t,ownerSlug:s,connectorKey:n,connections:o,isLoading:p,refetchConnections:d}):e.jsxs(V,{className:"space-y-6",children:[c,e.jsx(ze,{organizationId:t??"",ownerSlug:s,connectorKey:n,connections:o,isLoading:p})]})})}function mt({hero:s,connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:o,refetchConnections:p}){const{isAdmin:d,isLoading:x}=W(a),u=(t.operations_summary?.total??0)>0;return e.jsxs(le,{header:s,children:[e.jsx(us,{organizationId:a,connectorKey:r}),e.jsx(vt,{connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:o,refetchConnections:p}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:auto-cols-fr sm:grid-flow-col",children:[e.jsx(Ys,{connections:i,connectorDef:t,organizationId:a,ownerSlug:n,connectorKey:r,isLoading:o}),e.jsx(Nt,{connector:t,organizationId:a,ownerSlug:n}),u&&x?e.jsx(L,{className:"h-20 w-full rounded-lg"}):u&&d?e.jsx(ft,{connector:t,organizationId:a,ownerSlug:n}):u&&!d?e.jsx(I,{title:"Actions",muted:!0,children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Only workspace admins can view and configure connector actions."})}):null]}),e.jsx(xt,{connector:t,organizationId:a,ownerSlug:n,connectionCount:i.length}),!o&&i.length>0?e.jsx(I,{title:"Recent activity",children:e.jsx(Ws,{scope:{connectorKey:r},ownerSlug:n})}):null]})}function ht({connector:s,ownerSlug:t}){return e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:t},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??Vs(s.auth_schema),className:"h-10 w-10"}),title:s.name,badge:e.jsx(qs,{connectorDef:s,ownerSlug:t}),caption:s.description})}function xt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=Oe(s.auth_schema),i=Ds(s.auth_schema),o=r.find(S=>S.type==="oauth"),p=Be(s.auth_schema),d=r.some(S=>S.type==="env_keys"),x=r.some(S=>S.type==="browser"),u=i.some(S=>S.type==="interactive"),c=!!(o||p||d||x),v=Ls(s),{isAdmin:y}=W(t),{data:j=[]}=te(t,{connectorKey:s.key,profileKind:"env"}),{data:N=[]}=te(t,{profileKind:"browser_session"}),C=y&&s.installed!==!1;return!!(o||p)||d&&j.length>0||x&&N.length>0||!c||C?e.jsxs("div",{className:"space-y-6",children:[o?e.jsx(gt,{connector:s,organizationId:t,oauthMethod:o}):null,p?e.jsx(I,{title:"App installation",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Install the ",s.name," app to create or repair the workspace connection."]}),e.jsx(Ue,{organizationId:t,connectorKey:s.key,provider:p.provider,providerLabel:s.name,installShape:p.installShape,variant:"outline"})]})}):null,d&&j.length>0?e.jsx(ke,{profiles:j,type:"env"}):null,x&&N.length>0?e.jsx(ke,{profiles:N,type:"browser_session"}):null,c?null:v?e.jsx(I,{title:"Device runtime",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.name," runs on a linked device — there are no workspace credentials to configure here. Pair a device, then create a connection pinned to it."]}),e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(G,{to:"/$owner/connectors",params:{owner:a},search:{},children:"View devices"})})]})}):u?e.jsx(I,{title:"Authentication",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.name," pairs when you create a connection — there is no workspace-level credential to configure here."]})}):e.jsx(I,{title:"Authentication",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector doesn't need workspace credentials. Create a connection from Overview to get started."})}),e.jsx(pt,{connector:s,organizationId:t,ownerSlug:a,connectionCount:n})]}):null}function pt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=q(),{isAdmin:i}=W(t),o=Ks(),[p,d]=h.useState(!1),[x,u]=h.useState(null),c=s.installed!==!1;if(!i||!c)return null;const v=n>0,y=o.isPending,j=()=>{u(null),o.mutate({connector_key:s.key},{onSuccess:()=>{r({to:"/$owner/connectors",params:{owner:a}})},onError:N=>{u(N instanceof Error?N.message:"Failed to remove connector"),d(!1)}})};return e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Remove connector"}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Archives ",s.name," in this workspace. Existing synced data stays in memory."]}),v?e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Delete"," ",e.jsxs("span",{className:"font-medium text-foreground",children:[n," connection",n===1?"":"s"]})," ","first — uninstall is blocked while any connection still references this connector."]}):null,x?e.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:x}):null,e.jsx("div",{className:"mt-3",children:p?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(g,{variant:"destructive",size:"sm",disabled:y,onClick:j,children:[y?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Confirm remove"]}),e.jsx(g,{variant:"ghost",size:"sm",disabled:y,onClick:()=>d(!1),children:"Cancel"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:y||v,onClick:()=>d(!0),children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove connector"]})})]})}function ft({connector:s,organizationId:t,ownerSlug:a}){const n=Ee();return e.jsx(Re,{title:"Actions",summary:`${s.operations_summary?.total??0} actions · organization policies`,onOpen:()=>n?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectorKey:s.key,organizationId:t,ownerSlug:a}})})}function gt({connector:s,organizationId:t,oauthMethod:a}){const{isAdmin:n,isLoading:r}=W(t),{setup:i}=se.useSearch(),o=se.useNavigate(),{data:p=[],refetch:d,isLoading:x,isError:u}=te(t,{connectorKey:s.key,provider:a.provider}),c=p.filter(v=>v.profile_kind==="oauth_app");return r||x?e.jsx(L,{className:"h-28 w-full"}):u?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load OAuth apps. Reload the page to try again."}):e.jsx(jt,{connector:s,oauthMethod:a,appProfiles:c,isAdmin:n,initialOpen:i==="oauth_app",onClose:()=>{i==="oauth_app"&&o({search:v=>({...v,setup:void 0}),hash:"",replace:!0})},refetchProfiles:d})}function jt({initialOpen:s=!1,onClose:t,connector:a,oauthMethod:n,appProfiles:r,isAdmin:i,refetchProfiles:o}){const p=vs(),d=ys(),[x,u]=Z(a.key,s&&i),[c,v]=h.useState(!1);h.useEffect(()=>{s&&i&&u(!0)},[s,i,u]);const y=`${Ns()}/connect/oauth/callback`,[j,N]=Z(a.key,`${a.name} OAuth App`),[C,D]=Z(a.key,""),[S,k]=Z(a.key,null),z=bs(n),w=Cs(`${a.key}:${x}`,ks(z),z),{values:R,setValues:F}=w,E=r.find(f=>f.is_default_for_connector&&f.connector_key===a.key),B=()=>{w.canSubmit&&(k(null),p.mutate({connector_key:a.key,profile_kind:"oauth_app",display_name:j.trim()||`${a.name} OAuth App`,slug:C.trim()||void 0,credentials:Ct(Fs(R))},{onSuccess:f=>{const m=f.auth_profile?.slug;m&&!E&&d.mutate({connector_key:a.key,auth_profile_slug:m}),u(!1),t?.(),N(`${a.name} OAuth App`),D(""),o()},onError:f=>{k(f instanceof Error?f.message:"Failed to add OAuth app")}}))};return e.jsxs(I,{id:"connector-oauth-apps",title:`${bt(n.provider)} app configuration`,action:i&&!x?e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>u(!0),children:[e.jsx(Fe,{className:"size-3.5"}),"Add OAuth app"]}):null,children:[i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:"OAuth callback URL"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:y}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(y).then(()=>v(!0)).catch(()=>k("Could not copy the callback URL. Select and copy it above."))},children:[e.jsx(ws,{className:"mr-1.5 h-3.5 w-3.5"}),c?"Copied":"Copy callback URL"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No app configured on this server. Choose a managed option if available, or add your own app here."}):e.jsx("div",{className:"space-y-2",children:r.map(f=>e.jsxs("div",{className:ee(J,"flex flex-wrap items-center gap-3 p-3"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:f.display_name}),f.is_default_for_connector&&f.connector_key===a.key?e.jsx(M,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,e.jsx(Te,{status:f.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f.slug})]}),i&&!f.is_default_for_connector&&f.connector_key===a.key&&f.status==="active"?e.jsx(g,{variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({connector_key:a.key,auth_profile_slug:f.slug}),children:"Set default"}):null]},f.slug))}),i&&x?e.jsxs("div",{className:ee(J,"space-y-3 p-3"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"oauth-app-name",children:"Display name"}),e.jsx($,{id:"oauth-app-name",value:j,onChange:f=>N(f.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"oauth-app-slug",children:"Slug"}),e.jsx($,{id:"oauth-app-slug",placeholder:"optional",value:C,onChange:f=>D(f.target.value)})]}),e.jsx(Ss,{schema:w.revision??void 0,values:R,onValuesChange:F,fieldIdPrefix:"oauth-app-"}),e.jsx(As,{visible:w.hasConflict,onReload:w.reset}),S?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:S}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>{u(!1),t?.()},children:"Cancel"}),e.jsxs(g,{size:"sm",disabled:p.isPending||!w.canSubmit,onClick:B,children:[p.isPending?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):null]})}function vt({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i,refetchConnections:o}){const d=Oe(s.auth_schema).find(y=>y.type==="oauth"),{data:x=[],refetch:u,isLoading:c,isError:v}=te(t,{connectorKey:s.key,provider:d?.provider});if(d){if(v)return e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load accounts. Reload the page to try again."});const y=x.filter(N=>N.profile_kind==="oauth_app"),j=x.filter(N=>N.profile_kind==="oauth_account");return e.jsx(yt,{connector:s,organizationId:t,oauthMethod:d,appProfiles:y,accounts:j,connections:r,isLoading:i||c,refetchProfiles:u,refetchConnections:o})}return e.jsx(ze,{connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i})}function yt({connector:s,organizationId:t,oauthMethod:a,appProfiles:n,accounts:r,connections:i,isLoading:o,refetchProfiles:p,refetchConnections:d}){const{session:x}=ms(),{isAdmin:u,isLoading:c}=W(t),v=hs(),y=xs(),j=ps(),[N,C]=h.useState(""),[D,S]=h.useState([]),k=n.filter(m=>m.status==="active"),z=k.find(m=>m.is_default_for_connector&&m.connector_key===s.key),w=(u?k.find(m=>m.slug===N):void 0)??z??(u&&k.length===1?k[0]:void 0),R=new Set(i.map(m=>m.auth_profile_slug)),F=r.filter(m=>m.created_by===x?.user?.id),E=F.filter(m=>!R.has(m.slug)),B=!i.some(m=>m.created_by===x?.user?.id)&&F.length===0;if(o||c||!x?.user?.id||!B&&E.length===0&&!j.error&&!j.continueUrl)return null;const f=m=>j.begin(async()=>{const A=await v.mutateAsync({connector_key:s.key,app_auth_profile_slug:m,requested_scopes:$s(a,D)});return p(),d(),A});return e.jsxs(I,{title:B?"Connect your account":"Your accounts",children:[B&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your own account to grant access. Your connection is private to you."}),u&&k.length>1?e.jsxs("div",{className:"space-y-1",children:[e.jsx(P,{children:"App used for this account"}),e.jsxs(we,{value:w?.slug??"",onValueChange:C,children:[e.jsx(Se,{"aria-label":"App used for this account",children:e.jsx(Ae,{placeholder:"Choose an OAuth app"})}),e.jsx(_e,{children:k.map(m=>e.jsxs(Pe,{value:m.slug,children:[m.display_name,m.is_default_for_connector&&m.connector_key===s.key?" (workspace default)":""]},m.slug))})]})]}):w?e.jsxs("p",{className:"text-sm",children:["App: ",w.display_name,w.is_default_for_connector&&w.connector_key===s.key?" (workspace default)":""]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Configure an OAuth app below, then connect your account.":"Ask an administrator to configure and set the workspace-default OAuth app."}),w&&e.jsx(fs,{requiredScopes:js(a),optionalScopes:gs(a),selectedOptionalScopes:D,onToggleOptionalScope:(m,A)=>S(U=>A?[...new Set([...U,m])]:U.filter(Q=>Q!==m))}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{size:"sm",disabled:!w||j.pending,onClick:()=>{w&&f(w.slug)},children:"Connect account"}),u&&e.jsx(g,{asChild:!0,size:"sm",variant:"outline",children:e.jsx("a",{href:"#connector-oauth-apps",children:"Manage app"})})]})]}),E.map(m=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2",children:[e.jsx("span",{className:"text-sm",children:m.display_name}),e.jsx(g,{variant:"outline",size:"sm",disabled:j.pending,onClick:()=>void j.begin(()=>m.status==="active"?v.mutateAsync({connector_key:s.key,auth_profile_slug:m.slug}):y.mutateAsync({auth_profile_slug:m.slug})),children:m.status==="active"?"Use this account":"Reconnect"})]},m.slug)),j.error&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:j.error}),j.continueUrl&&e.jsx("a",{href:j.continueUrl,target:"_blank",rel:"noreferrer",className:"text-sm underline",children:"Continue authorization in your browser"})]})}function ke({profiles:s,type:t}){const a=t==="env"?"Credentials":"Browser sessions";return e.jsx(I,{title:a,children:e.jsx("div",{className:"space-y-2",children:s.map(n=>e.jsxs("div",{className:ee(J,"p-3"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:n.display_name}),e.jsx(Te,{status:n.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.slug})]},n.slug))})})}function Nt({connector:s,organizationId:t,ownerSlug:a}){const n=Ee(),r=Object.keys(s.feeds_schema??{}).length;return r?e.jsx(Re,{title:"Feeds",summary:`${r} ${r===1?"feed type":"feed types"}`,onOpen:()=>n?.open({href:"",title:"Feeds",connectorPanel:{section:"feeds",connectorKey:s.key,organizationId:t,ownerSlug:a}})}):null}function ze({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i}){const o=q(),p=Be(s?.auth_schema);if(i)return e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{className:"h-4 w-24"}),e.jsx(L,{className:"h-16 w-full rounded-lg"})]});if(r.length===0){const d=s&&p?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ue,{organizationId:t,connectorKey:n,provider:p.provider,providerLabel:s.name,installShape:p.installShape,size:"default",label:`Install ${s.name}`}),e.jsx(g,{asChild:!0,variant:"outline",children:e.jsx(G,{to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n},children:"Use your own app"})})]}):e.jsxs(g,{size:"default",onClick:()=>o({to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n}}),children:[e.jsx(Fe,{className:"mr-1.5 h-4 w-4"}),"Create connection"]});return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:d})}return null}function Te({status:s}){const t=s==="active"?"text-green-500":s==="error"||s==="revoked"?"text-destructive":"text-amber-500";return e.jsxs("span",{className:ee("text-xs",t),children:["· ",s]})}function bt(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Ct(s){const t={};for(const[a,n]of Object.entries(s))typeof n=="string"&&n.trim()?t[a]=n.trim():(typeof n=="number"||typeof n=="boolean")&&(t[a]=String(n));return t}export{mt as ConnectorDetailShell,yt as OAuthAccountsSection,jt as OAuthAppProfilesSection,Dt as component};
1
+ import{h4 as Xe,am as Ze,h5 as re,r as h,h6 as ye,h7 as Je,cw as es,h8 as Ne,aA as K,h9 as be,j as e,a6 as P,bR as we,bS as Se,bT as Ae,bU as _e,bV as Pe,gW as ss,a7 as $,B as g,b_ as Y,n as T,R as Ce,ha as ts,hb as as,x as ns,hc as rs,bu as ie,hd as is,he as ls,hf as De,hg as Le,hh as $e,aP as J,ab as M,bD as ae,hi as os,g1 as cs,hj as ds,fL as W,hk as le,hl as us,S as L,eL as I,p as ms,hm as hs,hn as xs,ho as ps,hp as fs,hq as gs,hr as js,hs as vs,ht as ys,cc as Z,hu as Ns,hv as bs,cb as Cs,eh as ks,e3 as ws,af as ee,dL as Ss,cf as As,P as Fe,hw as se,hx as _s,aS as Ps,hy as Oe,b5 as te,o as Ee,eN as Re,bd as Ds,hz as Be,eM as Ls,hA as Ue,L as G,hB as $s,ek as Fs,u as Os,a as Es,bl as Rs,ba as V,cD as Ie,_ as q,hC as Bs,b8 as Us,hD as Is,gA as oe,bq as Me,bp as ce,bm as Ms,gB as de,gC as ue,b6 as zs,b7 as Ts,hE as Ks,de as Vs}from"./index-B2AmRqYh.js";import{C as qs}from"./connector-provenance-BjKiUhYE.js";import{a as Ys}from"./runs-table-BUKDjiBc.js";import{R as Ws}from"./runs-panel-C56GDaJm.js";import"./connection-label-BobuYiAG.js";import"./runs-oHveuEUB.js";function Gs({catalog:s,initialProvider:t,initialModel:a,onDone:n}){const r=Xe(),i=Ze(),o=s.find(l=>l.slug===t)??s[0],p=o&&re(o)?"oauth":"api-key",[d,x]=h.useState(o?.slug??""),[u,c]=h.useState(o?.slug??""),[v,y]=h.useState(o?.displayName??""),[j,N]=h.useState(o?.baseUrl??""),[C,D]=h.useState(a??o?.defaultModel??""),[S,k]=h.useState(""),[z,w]=h.useState(o?.apiKeyPlaceholder??""),[R,F]=h.useState(p),[E,B]=h.useState(""),[f,m]=h.useState(null),[A,U]=h.useState(!1),[Q,me]=h.useState(!1),b=s.find(l=>l.slug===d),H=ye(b?.modalities??[]),he=b?re(b):!1,xe=b?Je(b):!1,pe=he&&R==="oauth",fe=xe&&!pe,O=es().slug,X=h.useCallback(()=>{me(!0),i.invalidateQueries({queryKey:["inference-providers"]})},[i]),Ke=h.useCallback(()=>{i.invalidateQueries({queryKey:["inference-providers"]}),n()},[i,n]),Ve=h.useCallback(async()=>{if(!(!O||!b)){U(!0);try{const l=await Ne(O,b.slug);if(l.mode!=="redirect")throw new Error("Unexpected sign-in mode");window.open(l.authorizeUrl,"_blank","noreferrer")}catch(l){K.error(l instanceof Error?l.message:"Failed to start sign-in")}finally{U(!1)}}},[O,b]),qe=h.useCallback(async()=>{if(!(!O||!b||!E.trim())){U(!0);try{const l=await be(O,b.slug,{code:E.trim()});if(l.status!=="success")throw new Error(l.error||"Sign-in not complete");X(),K.success(`Signed in with ${b.displayName}`)}catch(l){K.error(l instanceof Error?l.message:"Failed to complete sign-in")}finally{U(!1)}}},[O,b,E,X]),Ye=h.useCallback(async()=>{if(!(!O||!b)){U(!0);try{const l=await Ne(O,b.slug);if(l.mode!=="device")throw new Error("Unexpected sign-in mode");m({userCode:l.userCode,deviceAuthId:l.deviceAuthId,verificationUrl:l.verificationUrl}),window.open(l.verificationUrl,"_blank","noreferrer")}catch(l){K.error(l instanceof Error?l.message:"Failed to start sign-in")}finally{U(!1)}}},[O,b]),We=h.useCallback(async()=>{if(!(!O||!b||!f)){U(!0);try{const l=await be(O,b.slug,{deviceAuthId:f.deviceAuthId,userCode:f.userCode});if(l.status==="success"){X(),K.success(`Signed in with ${b.displayName}`);return}m(_=>_&&{..._,message:l.error||"Waiting for approval..."})}catch(l){K.error(l instanceof Error?l.message:"Failed to check status")}finally{U(!1)}}},[O,b,f,X]),Ge=b?.supportedAuthTypes.includes("device-code")??!1,Qe=l=>{x(l);const _=s.find(ne=>ne.slug===l);_&&(c(_.slug),y(_.displayName),N(_.baseUrl),D(_.slug===t&&a?a:_.defaultModel??""),w(_.apiKeyPlaceholder),F(re(_)?"oauth":"api-key"),B(""),m(null),me(!1))},ge=/^[a-z0-9][a-z0-9-]*$/.test(u),je=ge&&fe&&S.trim().length>0&&!r.isPending,He=l=>{if(l.preventDefault(),!je)return;const _={};j.trim()&&(_.base_url=j.trim()),C.trim()&&(_.model=C.trim());const ne=Object.keys(_).length>0?{text:_}:void 0;r.mutate({slug:u.trim(),kind:d,displayName:v.trim()||void 0,apiKey:S.trim(),capabilities:ne},{onSuccess:()=>n()})},ve=!!(t&&s.some(l=>l.slug===t));return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:ve&&b?`Connect ${b.displayName}`:"Add an inference provider"}),e.jsxs("form",{onSubmit:He,className:"grid max-w-md gap-3",children:[ve&&b?e.jsx("p",{className:"text-xs text-muted-foreground",children:H.length>0?`Serves text, plus ${H.join(", ").toLowerCase()}.`:"Serves text (chat)."}):e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-provider",children:"Provider"}),e.jsxs(we,{value:d,onValueChange:Qe,children:[e.jsx(Se,{id:"ip-provider",className:"w-full",children:e.jsx(Ae,{})}),e.jsx(_e,{children:s.map(l=>{const _=ye(l.modalities);return e.jsx(Pe,{value:l.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[l.iconUrl?e.jsx("img",{src:l.iconUrl,alt:"",className:"h-4 w-4 shrink-0 rounded-sm",loading:"lazy"}):e.jsx(ss,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),l.displayName,_.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",_.join(", ")]}):null]})},l.slug)})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:H.length>0?`Serves text, plus ${H.join(", ").toLowerCase()}.`:"Serves text (chat)."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-display",children:"Name"}),e.jsx($,{id:"ip-display",placeholder:"Friendly name",value:v,onChange:l=>y(l.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(P,{htmlFor:"ip-slug",children:["Slug ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx($,{id:"ip-slug",placeholder:"my-provider",value:u,onChange:l=>c(l.target.value),autoComplete:"off",required:!0}),u&&!ge?e.jsx("p",{className:"text-xs text-destructive",children:"Lowercase letters, numbers, and hyphens only."}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"A stable identifier agents reference this provider by."})]}),he&&xe?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{children:"Auth method"}),e.jsxs("div",{className:"inline-flex w-fit rounded-md border border-border p-1",children:[e.jsx(g,{type:"button",size:"sm",variant:R==="oauth"?"secondary":"ghost",onClick:()=>F("oauth"),children:"Sign in"}),e.jsx(g,{type:"button",size:"sm",variant:R==="api-key"?"secondary":"ghost",onClick:()=>F("api-key"),children:"API key"})]})]}):null,fe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-base-url",children:"Base URL"}),e.jsx($,{id:"ip-base-url",placeholder:"https://api.example.com/v1",value:j,onChange:l=>N(l.target.value),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the upstream URL — e.g. a self-hosted vLLM, Azure, or LiteLLM endpoint."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-model",children:"Default model"}),e.jsx($,{id:"ip-model",placeholder:"gpt-4o-mini",value:C,onChange:l=>D(l.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(P,{htmlFor:"ip-key",children:["API key ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx($,{id:"ip-key",type:"password",placeholder:z||void 0,value:S,onChange:l=>k(l.target.value),autoComplete:"off",required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored encrypted in the vault. It's never shown again — rotate it here if it changes."})]}),e.jsx(Y,{onCancel:n,children:e.jsx(g,{type:"submit",disabled:!je,children:r.isPending?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Creating..."]}):"Create provider"})})]}):pe?e.jsxs("div",{className:"grid gap-3",children:[Q?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Signed in with ",b?.displayName??"provider",". This covers your agents in this org."]}):Ge?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void Ye(),disabled:A||!O,children:f?"Get a new code":"Get device code"}),f?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-device-code",children:"Device code"}),e.jsx($,{id:"ip-device-code",readOnly:!0,value:f.userCode}),e.jsx(g,{type:"button",variant:"default",className:"justify-self-start",asChild:!0,children:e.jsxs("a",{href:f.verificationUrl,target:"_blank",rel:"noreferrer",children:["Open ",b?.displayName??"provider"," to approve",e.jsx(Ce,{className:"h-4 w-4"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.message||"We opened the approval page. Enter the code above if asked, approve, then check status."}),e.jsx(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void We(),disabled:A,children:A?"Checking...":"Check status"})]}):null]}):e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void Ve(),disabled:A||!O,children:["Sign in with ",b?.displayName??"provider",e.jsx(Ce,{className:"h-4 w-4"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:"ip-oauth-code",children:"Paste code#state"}),e.jsx($,{id:"ip-oauth-code",placeholder:"code#state",value:E,onChange:l=>B(l.target.value),autoComplete:"off"})]}),e.jsx(g,{type:"button",className:"justify-self-start",onClick:()=>void qe(),disabled:A||!E.trim(),children:A?"Finishing...":"Finish sign-in"})]}),e.jsx(Y,{onCancel:n,children:e.jsx(g,{type:"button",onClick:Ke,disabled:!Q,children:"Done"})})]}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This provider cannot be added from the catalog yet."}),e.jsx(Y,{onCancel:n})]})]})]})}const Qs={text:"Text",image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function Hs({provider:s,catalog:t,autoOpenEdit:a}){const n=ts(),[r,i]=h.useState(a?"edit":null),o=as(s.kind,t);h.useEffect(()=>{a&&i("edit")},[a]);const d=(t.find(c=>c.slug===s.kind)?.modalities??["text"]).filter(c=>c!=="text"),x=o&&d.length>0,u=c=>i(v=>v===c?null:c);return e.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:"Credential"}),e.jsxs("p",{className:"truncate text-[11px] text-muted-foreground",children:[s.slug,s.createdAt?` · created ${ns(s.createdAt)}`:""]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.isDefault?null:e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",disabled:n.isPending,onClick:()=>n.mutate({providerSlug:s.slug}),children:"Set as default"}),x?e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>u("capabilities"),children:"Configure"}):null,e.jsx(g,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>u("edit"),children:"Edit"})]})]}),r==="edit"?e.jsx("div",{className:"border-t px-3 py-3",children:e.jsx(Zs,{provider:s,supportsUpstreamConfig:o,onDone:()=>i(null)})}):null,r==="capabilities"&&x?e.jsx("div",{className:"border-t px-3 py-3",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Other modalities (optional)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This provider's text base URL and model are set under Edit. Only set these if you want a modality routed to a different endpoint — otherwise it uses the provider's defaults."})]}),d.map(c=>e.jsx(Js,{providerSlug:s.slug,modality:c,block:s.capabilities[c]??{}},c))]})}):null]})}function Xs({provider:s,onDeleted:t}){const a=rs(),[n,r]=h.useState(!1);return e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Delete provider"}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Removes ",s.displayName||s.slug," and its stored key from this workspace. Agents referencing it will need another connected provider before they can run."]}),e.jsx("div",{className:"mt-3",children:n?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(g,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({providerSlug:s.slug},{onSuccess:t,onSettled:()=>r(!1)}),children:[a.isPending?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(g,{variant:"ghost",size:"sm",disabled:a.isPending,onClick:()=>r(!1),children:"Cancel"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:a.isPending,onClick:()=>r(!0),children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete provider"]})})]})}function Zs({provider:s,supportsUpstreamConfig:t,onDone:a}){const n=is(),r=ls(),i=De(),[o,p]=h.useState(s.displayName??""),[d,x]=h.useState(""),u=s.capabilities.text??{},[c,v]=h.useState(u.base_url??""),[y,j]=h.useState(u.model??""),[N,C]=h.useState(null),D=o.trim().length>0&&o.trim()!==(s.displayName??""),S=t&&d.trim().length>0,k=c.trim()!==(u.base_url??""),z=y.trim()!==(u.model??""),w=t&&(k||z),R={base_url:c.trim()||void 0,model:y.trim()||void 0,models_endpoint:u.models_endpoint},F=Le(R),E=t&&w&&$e(F),B=n.isPending||r.isPending||i.isPending,f=(D||S||w)&&!E&&!B,m=async A=>{if(A.preventDefault(),!!f){C(null);try{await Promise.all([D?n.mutateAsync({providerSlug:s.slug,displayName:o.trim()}):Promise.resolve(),w?i.mutateAsync({providerSlug:s.slug,modality:"text",block:R}):Promise.resolve(),S?r.mutateAsync({providerSlug:s.slug,value:d.trim()}):Promise.resolve()]),a()}catch{C("Some changes could not be saved. Review the fields and try again.")}}};return e.jsxs("form",{onSubmit:m,className:"grid max-w-md gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-name-${s.slug}`,children:"Name"}),e.jsx($,{id:`edit-name-${s.slug}`,value:o,onChange:A=>p(A.target.value),placeholder:s.slug}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["The slug (",e.jsx("code",{children:s.slug}),") is fixed — agents reference it."]})]}),t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-base-${s.slug}`,children:"Base URL"}),e.jsx($,{id:`edit-base-${s.slug}`,placeholder:"https://api.example.com/v1",value:c,onChange:A=>v(A.target.value),autoComplete:"off"}),F.base_url?e.jsx("p",{className:"text-xs text-destructive",children:F.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-model-${s.slug}`,children:"Default model"}),e.jsx($,{id:`edit-model-${s.slug}`,placeholder:"gpt-4o-mini",value:y,onChange:A=>j(A.target.value),autoComplete:"off"}),F.model?e.jsx("p",{className:"text-xs text-destructive",children:F.model}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`edit-key-${s.slug}`,children:"New API key"}),e.jsx($,{id:`edit-key-${s.slug}`,type:"password",value:d,onChange:A=>x(A.target.value),autoComplete:"off",placeholder:"Leave blank to keep the current key"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter a value only to replace the stored key. The old key is discarded."})]})]}):null,N?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,e.jsx(Y,{onCancel:a,children:e.jsx(g,{type:"submit",disabled:!f,children:B?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]})}function Js({providerSlug:s,modality:t,block:a}){const n=De(),[r,i]=h.useState(!1),[o,p]=h.useState(a.base_url??""),[d,x]=h.useState(a.model??""),[u,c]=h.useState(a.models_endpoint??""),[v,y]=h.useState(!!a.models_endpoint),j=!!(a.base_url||a.model||a.models_endpoint),N={base_url:o.trim()||void 0,model:d.trim()||void 0,models_endpoint:u.trim()||void 0},C=Le(N),D=$e(C),S=()=>{D||n.mutate({providerSlug:s,modality:t,block:N})};return e.jsxs("div",{className:J,children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-left",onClick:()=>i(k=>!k),children:[e.jsx("span",{className:"text-sm font-medium",children:Qs[t]}),j?e.jsx(M,{variant:"outline",children:"Custom"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Static"})]}),r?e.jsxs("div",{className:"grid gap-3 border-t px-3 py-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`base-${s}-${t}`,children:"Base URL"}),e.jsx($,{id:`base-${s}-${t}`,placeholder:"https://api.example.com/v1",value:o,onChange:k=>p(k.target.value),autoComplete:"off"}),C.base_url?e.jsx("p",{className:"text-xs text-destructive",children:C.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`model-${s}-${t}`,children:"Model"}),e.jsx($,{id:`model-${s}-${t}`,placeholder:"gpt-4o-mini",value:d,onChange:k=>x(k.target.value),autoComplete:"off"}),C.model?e.jsx("p",{className:"text-xs text-destructive",children:C.model}):null]}),v?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(P,{htmlFor:`endpoint-${s}-${t}`,children:"Models endpoint"}),e.jsx($,{id:`endpoint-${s}-${t}`,placeholder:"/v1/models",value:u,onChange:k=>c(k.target.value),autoComplete:"off"}),C.models_endpoint?e.jsx("p",{className:"text-xs text-destructive",children:C.models_endpoint}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Path used to list this modality's models (e.g. /v1/models)."})]}):e.jsx("button",{type:"button",className:"justify-self-start text-xs text-muted-foreground hover:text-foreground",onClick:()=>y(!0),children:"Advanced"}),e.jsx(Y,{onCancel:()=>i(!1),children:e.jsx(g,{size:"sm",disabled:D||n.isPending,onClick:S,children:n.isPending?e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]}):null]})}function et({sandbox:s}){const t=Object.entries(s.details??{});return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(tt,{kind:s.providerKind}),e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx(M,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] uppercase tracking-wide",children:s.providerKind}),s.connected?e.jsx(M,{className:"h-4 border-transparent bg-emerald-500/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-emerald-500",children:"Connected"}):e.jsx(M,{variant:"destructive",className:"h-4 border-transparent bg-destructive/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-destructive",children:"No credential"})]}),t.length>0?e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:t.map(([a,n])=>`${a}: ${n}`).join(" | ")}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remote sandbox agents execute in instead of the built-in local runtime."}),s.connected?null:e.jsxs("div",{className:"flex gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("p",{children:"This sandbox has no vault credential. Delete it and re-add the provider with a valid key, or set the credential via the API."})]})]})})}function st({sandbox:s,onDeleted:t}){const a=os(),[n,r]=h.useState(!1);return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"rounded-lg border border-destructive/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Remove sandbox"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Agents pinned to this runtime fall back to the built-in local sandbox."})]})]}),n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({id:s.id},{onSuccess:t}),children:a.isPending?e.jsx(T,{}):"Delete permanently"}),e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"})]}):e.jsx(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>r(!0),children:"Delete sandbox"})]})})}function tt({kind:s}){return s==="vercel"?e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4 w-4 shrink-0 fill-foreground","aria-hidden":!0,children:[e.jsx("title",{children:"Vercel"}),e.jsx("path",{d:"M12 3 22 20H2L12 3Z"})]}):s==="builtin"?e.jsx(cs,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(ds,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}const at={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},nt={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function Dt(){const{owner:s,connectorKey:t}=se.useParams(),{kind:a,id:n}=_s(t);return e.jsx(Ps,{owner:s,children:({ownerSlug:r,organizationId:i,isWorkspaceLoading:o})=>{switch(a){case"inference":return e.jsx(lt,{ownerSlug:r,providerSlug:n});case"sandbox":return e.jsx(it,{ownerSlug:r,sandboxId:n});case"sandbox-provider":return e.jsx(rt,{ownerSlug:r,providerKind:n});default:return e.jsx(ut,{ownerSlug:r,organizationId:i,isWorkspaceLoading:o,connectorKey:t})}}})}function rt({ownerSlug:s,providerKind:t}){const a=q();return h.useEffect(()=>{a({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:`${Bs}${t}`},replace:!0})},[a,s,t]),null}function it({ownerSlug:s,sandboxId:t}){const a=q(),{data:n,isLoading:r}=Us(),i=n?.sandboxes.find(p=>p.id===t)??null;if(r)return e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-24 w-full rounded-lg"})]});if(!i)return e.jsxs(V,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This sandbox isn't in this workspace, so its details aren't available."}),e.jsx(g,{variant:"outline",size:"sm",onClick:()=>void a({to:"/$owner/connectors",params:{owner:s}}),children:"Back to connectors"})]});const o=i.name||Is(i.providerKind);return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:s},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{name:o,faviconDomain:Ms(i.providerKind)}),title:o,badge:e.jsxs(e.Fragment,{children:[e.jsx(M,{variant:"secondary",children:i.providerKind}),i.connected?e.jsx(M,{className:"border-transparent bg-emerald-500/10 text-emerald-500",children:"Connected"}):e.jsx(M,{variant:"destructive",children:"No credential"})]}),status:e.jsx(Me,{facets:nt})}),children:[e.jsx(et,{sandbox:i}),e.jsx(I,{title:"Settings",muted:!0,children:e.jsx(st,{sandbox:i,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})})]})})}function lt({ownerSlug:s,providerSlug:t}){const a=q(),{model:n,reason:r,agentId:i}=se.useSearch(),{data:o=[],isLoading:p}=zs(),d=Ts(),{data:x=[],isLoading:u}=d,c=o.find(D=>D.slug===t)??null,v=x.find(D=>D.slug===(c?.kind??t))??null;if(p||u)return e.jsx("div",{children:e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-16 w-full rounded-lg"}),e.jsx(L,{className:"h-24 w-full rounded-lg"}),e.jsx(L,{className:"h-32 w-full rounded-lg"})]})});if(!c&&!v&&!d.isError)return e.jsxs(V,{className:"space-y-3",children:[e.jsx(Ie,{connector:{key:t,name:t},showDescription:!1,className:"gap-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector isn't installed in this workspace, so its details aren't available."})]});const y=c?.displayName||v?.displayName||t,j=c!==null,N=r?e.jsx(dt,{agentId:i,model:n,providerName:y}):n?e.jsx(ct,{providerName:y,model:n,isConnected:j}):null,C=e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:s},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{iconUrl:v?.iconUrl,name:y}),title:y,badge:c?e.jsxs(e.Fragment,{children:[c.isDefault?e.jsx(M,{variant:"secondary",children:"Default"}):null,c.status?e.jsx(M,{variant:"outline",children:c.status}):null,c.hasCustomUpstream?e.jsx(M,{variant:"outline",children:"Custom upstream"}):null]}):null,status:e.jsx(Me,{facets:at})});return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:C,children:[N,e.jsx("div",{className:"space-y-6",children:c?e.jsx(Hs,{provider:c,catalog:x,autoOpenEdit:!!n}):e.jsx(ot,{ownerSlug:s,providerSlug:t,catalog:x,catalogError:d.isError?d.error:null,model:n})}),c?e.jsx(I,{title:"Settings",muted:!0,children:e.jsx(Xs,{provider:c,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})}):null]})})}function ot({ownerSlug:s,providerSlug:t,catalog:a,catalogError:n,model:r}){const i=q();return n?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load provider catalog."}),e.jsx("p",{className:"mt-1 text-xs",children:n instanceof Error?n.message:"Check the workspace URL and try again."})]})]})}):e.jsx("div",{className:"rounded-lg border p-4",children:e.jsx(Gs,{catalog:a,initialProvider:t,initialModel:r?.includes("/")?r.split("/").slice(1).join("/"):r,onDone:()=>void i({to:"/$owner/connectors",params:{owner:s}})},`${a.length}:${t}`)})}function ct({providerName:s,model:t,isConnected:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review ",e.jsx("strong",{children:s})," for model"," ",e.jsx("strong",{children:t}),"."," ",a?"Its edit controls are open.":"It is not connected yet; add it to continue."]})]})})}function dt({agentId:s,model:t,providerName:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"This agent needs a model provider before it can reply."}),e.jsxs("p",{children:[s?e.jsxs("span",{children:["Agent ",e.jsx("strong",{children:s})," is"," "]}):null,"configured to use ",t?e.jsx("strong",{children:t}):"a model"," ","from ",e.jsx("strong",{children:a}),", but that provider is not ready in this workspace."]}),e.jsx("p",{children:"Connect the provider below, then retry the message."})]})]})})}function ut({ownerSlug:s,organizationId:t,isWorkspaceLoading:a,connectorKey:n}){const{data:r=[],isLoading:i}=Os(t??""),{data:o=[],isLoading:p,refetch:d}=Es(t??"",{connectorKey:n}),x=h.useMemo(()=>r.find(v=>v.key===n),[r,n]),u=h.useMemo(()=>Rs(n,r,{name:o[0]?.connector_name??n}),[n,r,o]);if(a||i)return e.jsx("div",{children:e.jsxs(V,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-6 w-6 rounded"}),e.jsx(L,{className:"h-5 w-40"})]}),e.jsx(L,{className:"h-16 w-full rounded-lg"}),e.jsx(L,{className:"h-24 w-full rounded-lg"}),e.jsx(L,{className:"h-32 w-full rounded-lg"})]})});const c=x?e.jsx(ht,{connector:x,ownerSlug:s}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ie,{connector:u,showDescription:!1,className:"gap-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This connector isn't installed in this workspace, so its details aren't available.",o.length>0?" Existing connections keep working.":""]})]});return e.jsx("div",{className:"flex flex-1 flex-col",children:x&&t?e.jsx(mt,{hero:c,connector:x,organizationId:t,ownerSlug:s,connectorKey:n,connections:o,isLoading:p,refetchConnections:d}):e.jsxs(V,{className:"space-y-6",children:[c,e.jsx(ze,{organizationId:t??"",ownerSlug:s,connectorKey:n,connections:o,isLoading:p})]})})}function mt({hero:s,connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:o,refetchConnections:p}){const{isAdmin:d,isLoading:x}=W(a),u=(t.operations_summary?.total??0)>0;return e.jsxs(le,{header:s,children:[e.jsx(us,{organizationId:a,connectorKey:r}),e.jsx(vt,{connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:o,refetchConnections:p}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:auto-cols-fr sm:grid-flow-col",children:[e.jsx(Ys,{connections:i,connectorDef:t,organizationId:a,ownerSlug:n,connectorKey:r,isLoading:o}),e.jsx(Nt,{connector:t,organizationId:a,ownerSlug:n}),u&&x?e.jsx(L,{className:"h-20 w-full rounded-lg"}):u&&d?e.jsx(ft,{connector:t,organizationId:a,ownerSlug:n}):u&&!d?e.jsx(I,{title:"Actions",muted:!0,children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Only workspace admins can view and configure connector actions."})}):null]}),e.jsx(xt,{connector:t,organizationId:a,ownerSlug:n,connectionCount:i.length}),!o&&i.length>0?e.jsx(I,{title:"Recent activity",children:e.jsx(Ws,{scope:{connectorKey:r},ownerSlug:n})}):null]})}function ht({connector:s,ownerSlug:t}){return e.jsx(oe,{breadcrumb:e.jsx(de,{crumbs:[e.jsx(G,{to:"/$owner/connectors",params:{owner:t},className:ue,children:"Connectors"},"connectors")]}),icon:e.jsx(ce,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??Vs(s.auth_schema),className:"h-10 w-10"}),title:s.name,badge:e.jsx(qs,{connectorDef:s,ownerSlug:t}),caption:s.description})}function xt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=Oe(s.auth_schema),i=Ds(s.auth_schema),o=r.find(S=>S.type==="oauth"),p=Be(s.auth_schema),d=r.some(S=>S.type==="env_keys"),x=r.some(S=>S.type==="browser"),u=i.some(S=>S.type==="interactive"),c=!!(o||p||d||x),v=Ls(s),{isAdmin:y}=W(t),{data:j=[]}=te(t,{connectorKey:s.key,profileKind:"env"}),{data:N=[]}=te(t,{profileKind:"browser_session"}),C=y&&s.installed!==!1;return!!(o||p)||d&&j.length>0||x&&N.length>0||!c||C?e.jsxs("div",{className:"space-y-6",children:[o?e.jsx(gt,{connector:s,organizationId:t,oauthMethod:o}):null,p?e.jsx(I,{title:"App installation",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Install the ",s.name," app to create or repair the workspace connection."]}),e.jsx(Ue,{organizationId:t,connectorKey:s.key,provider:p.provider,providerLabel:s.name,installShape:p.installShape,variant:"outline"})]})}):null,d&&j.length>0?e.jsx(ke,{profiles:j,type:"env"}):null,x&&N.length>0?e.jsx(ke,{profiles:N,type:"browser_session"}):null,c?null:v?e.jsx(I,{title:"Device runtime",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.name," runs on a linked device — there are no workspace credentials to configure here. Pair a device, then create a connection pinned to it."]}),e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(G,{to:"/$owner/connectors",params:{owner:a},search:{},children:"View devices"})})]})}):u?e.jsx(I,{title:"Authentication",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.name," pairs when you create a connection — there is no workspace-level credential to configure here."]})}):e.jsx(I,{title:"Authentication",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector doesn't need workspace credentials. Create a connection from Overview to get started."})}),e.jsx(pt,{connector:s,organizationId:t,ownerSlug:a,connectionCount:n})]}):null}function pt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=q(),{isAdmin:i}=W(t),o=Ks(),[p,d]=h.useState(!1),[x,u]=h.useState(null),c=s.installed!==!1;if(!i||!c)return null;const v=n>0,y=o.isPending,j=()=>{u(null),o.mutate({connector_key:s.key},{onSuccess:()=>{r({to:"/$owner/connectors",params:{owner:a}})},onError:N=>{u(N instanceof Error?N.message:"Failed to remove connector"),d(!1)}})};return e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Remove connector"}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Archives ",s.name," in this workspace. Existing synced data stays in memory."]}),v?e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Delete"," ",e.jsxs("span",{className:"font-medium text-foreground",children:[n," connection",n===1?"":"s"]})," ","first — uninstall is blocked while any connection still references this connector."]}):null,x?e.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:x}):null,e.jsx("div",{className:"mt-3",children:p?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(g,{variant:"destructive",size:"sm",disabled:y,onClick:j,children:[y?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Confirm remove"]}),e.jsx(g,{variant:"ghost",size:"sm",disabled:y,onClick:()=>d(!1),children:"Cancel"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:y||v,onClick:()=>d(!0),children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove connector"]})})]})}function ft({connector:s,organizationId:t,ownerSlug:a}){const n=Ee();return e.jsx(Re,{title:"Actions",summary:`${s.operations_summary?.total??0} actions · organization policies`,onOpen:()=>n?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectorKey:s.key,organizationId:t,ownerSlug:a}})})}function gt({connector:s,organizationId:t,oauthMethod:a}){const{isAdmin:n,isLoading:r}=W(t),{setup:i}=se.useSearch(),o=se.useNavigate(),{data:p=[],refetch:d,isLoading:x,isError:u}=te(t,{connectorKey:s.key,provider:a.provider}),c=p.filter(v=>v.profile_kind==="oauth_app");return r||x?e.jsx(L,{className:"h-28 w-full"}):u?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load OAuth apps. Reload the page to try again."}):e.jsx(jt,{connector:s,oauthMethod:a,appProfiles:c,isAdmin:n,initialOpen:i==="oauth_app",onClose:()=>{i==="oauth_app"&&o({search:v=>({...v,setup:void 0}),hash:"",replace:!0})},refetchProfiles:d})}function jt({initialOpen:s=!1,onClose:t,connector:a,oauthMethod:n,appProfiles:r,isAdmin:i,refetchProfiles:o}){const p=vs(),d=ys(),[x,u]=Z(a.key,s&&i),[c,v]=h.useState(!1);h.useEffect(()=>{s&&i&&u(!0)},[s,i,u]);const y=`${Ns()}/connect/oauth/callback`,[j,N]=Z(a.key,`${a.name} OAuth App`),[C,D]=Z(a.key,""),[S,k]=Z(a.key,null),z=bs(n),w=Cs(`${a.key}:${x}`,ks(z),z),{values:R,setValues:F}=w,E=r.find(f=>f.is_default_for_connector&&f.connector_key===a.key),B=()=>{w.canSubmit&&(k(null),p.mutate({connector_key:a.key,profile_kind:"oauth_app",display_name:j.trim()||`${a.name} OAuth App`,slug:C.trim()||void 0,credentials:Ct(Fs(R))},{onSuccess:f=>{const m=f.auth_profile?.slug;m&&!E&&d.mutate({connector_key:a.key,auth_profile_slug:m}),u(!1),t?.(),N(`${a.name} OAuth App`),D(""),o()},onError:f=>{k(f instanceof Error?f.message:"Failed to add OAuth app")}}))};return e.jsxs(I,{id:"connector-oauth-apps",title:`${bt(n.provider)} app configuration`,action:i&&!x?e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>u(!0),children:[e.jsx(Fe,{className:"size-3.5"}),"Add OAuth app"]}):null,children:[i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:"OAuth callback URL"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:y}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(y).then(()=>v(!0)).catch(()=>k("Could not copy the callback URL. Select and copy it above."))},children:[e.jsx(ws,{className:"mr-1.5 h-3.5 w-3.5"}),c?"Copied":"Copy callback URL"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No app configured on this server. Choose a managed option if available, or add your own app here."}):e.jsx("div",{className:"space-y-2",children:r.map(f=>e.jsxs("div",{className:ee(J,"flex flex-wrap items-center gap-3 p-3"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:f.display_name}),f.is_default_for_connector&&f.connector_key===a.key?e.jsx(M,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,e.jsx(Te,{status:f.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f.slug})]}),i&&!f.is_default_for_connector&&f.connector_key===a.key&&f.status==="active"?e.jsx(g,{variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({connector_key:a.key,auth_profile_slug:f.slug}),children:"Set default"}):null]},f.slug))}),i&&x?e.jsxs("div",{className:ee(J,"space-y-3 p-3"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"oauth-app-name",children:"Display name"}),e.jsx($,{id:"oauth-app-name",value:j,onChange:f=>N(f.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(P,{htmlFor:"oauth-app-slug",children:"Slug"}),e.jsx($,{id:"oauth-app-slug",placeholder:"optional",value:C,onChange:f=>D(f.target.value)})]}),e.jsx(Ss,{schema:w.revision??void 0,values:R,onValuesChange:F,fieldIdPrefix:"oauth-app-"}),e.jsx(As,{visible:w.hasConflict,onReload:w.reset}),S?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:S}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>{u(!1),t?.()},children:"Cancel"}),e.jsxs(g,{size:"sm",disabled:p.isPending||!w.canSubmit,onClick:B,children:[p.isPending?e.jsx(T,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):null]})}function vt({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i,refetchConnections:o}){const d=Oe(s.auth_schema).find(y=>y.type==="oauth"),{data:x=[],refetch:u,isLoading:c,isError:v}=te(t,{connectorKey:s.key,provider:d?.provider});if(d){if(v)return e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load accounts. Reload the page to try again."});const y=x.filter(N=>N.profile_kind==="oauth_app"),j=x.filter(N=>N.profile_kind==="oauth_account");return e.jsx(yt,{connector:s,organizationId:t,oauthMethod:d,appProfiles:y,accounts:j,connections:r,isLoading:i||c,refetchProfiles:u,refetchConnections:o})}return e.jsx(ze,{connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i})}function yt({connector:s,organizationId:t,oauthMethod:a,appProfiles:n,accounts:r,connections:i,isLoading:o,refetchProfiles:p,refetchConnections:d}){const{session:x}=ms(),{isAdmin:u,isLoading:c}=W(t),v=hs(),y=xs(),j=ps(),[N,C]=h.useState(""),[D,S]=h.useState([]),k=n.filter(m=>m.status==="active"),z=k.find(m=>m.is_default_for_connector&&m.connector_key===s.key),w=(u?k.find(m=>m.slug===N):void 0)??z??(u&&k.length===1?k[0]:void 0),R=new Set(i.map(m=>m.auth_profile_slug)),F=r.filter(m=>m.created_by===x?.user?.id),E=F.filter(m=>!R.has(m.slug)),B=!i.some(m=>m.created_by===x?.user?.id)&&F.length===0;if(o||c||!x?.user?.id||!B&&E.length===0&&!j.error&&!j.continueUrl)return null;const f=m=>j.begin(async()=>{const A=await v.mutateAsync({connector_key:s.key,app_auth_profile_slug:m,requested_scopes:$s(a,D)});return p(),d(),A});return e.jsxs(I,{title:B?"Connect your account":"Your accounts",children:[B&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your own account to grant access. Your connection is private to you."}),u&&k.length>1?e.jsxs("div",{className:"space-y-1",children:[e.jsx(P,{children:"App used for this account"}),e.jsxs(we,{value:w?.slug??"",onValueChange:C,children:[e.jsx(Se,{"aria-label":"App used for this account",children:e.jsx(Ae,{placeholder:"Choose an OAuth app"})}),e.jsx(_e,{children:k.map(m=>e.jsxs(Pe,{value:m.slug,children:[m.display_name,m.is_default_for_connector&&m.connector_key===s.key?" (workspace default)":""]},m.slug))})]})]}):w?e.jsxs("p",{className:"text-sm",children:["App: ",w.display_name,w.is_default_for_connector&&w.connector_key===s.key?" (workspace default)":""]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Configure an OAuth app below, then connect your account.":"Ask an administrator to configure and set the workspace-default OAuth app."}),w&&e.jsx(fs,{requiredScopes:js(a),optionalScopes:gs(a),selectedOptionalScopes:D,onToggleOptionalScope:(m,A)=>S(U=>A?[...new Set([...U,m])]:U.filter(Q=>Q!==m))}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{size:"sm",disabled:!w||j.pending,onClick:()=>{w&&f(w.slug)},children:"Connect account"}),u&&e.jsx(g,{asChild:!0,size:"sm",variant:"outline",children:e.jsx("a",{href:"#connector-oauth-apps",children:"Manage app"})})]})]}),E.map(m=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2",children:[e.jsx("span",{className:"text-sm",children:m.display_name}),e.jsx(g,{variant:"outline",size:"sm",disabled:j.pending,onClick:()=>void j.begin(()=>m.status==="active"?v.mutateAsync({connector_key:s.key,auth_profile_slug:m.slug}):y.mutateAsync({auth_profile_slug:m.slug})),children:m.status==="active"?"Use this account":"Reconnect"})]},m.slug)),j.error&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:j.error}),j.continueUrl&&e.jsx("a",{href:j.continueUrl,target:"_blank",rel:"noreferrer",className:"text-sm underline",children:"Continue authorization in your browser"})]})}function ke({profiles:s,type:t}){const a=t==="env"?"Credentials":"Browser sessions";return e.jsx(I,{title:a,children:e.jsx("div",{className:"space-y-2",children:s.map(n=>e.jsxs("div",{className:ee(J,"p-3"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:n.display_name}),e.jsx(Te,{status:n.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.slug})]},n.slug))})})}function Nt({connector:s,organizationId:t,ownerSlug:a}){const n=Ee(),r=Object.keys(s.feeds_schema??{}).length;return r?e.jsx(Re,{title:"Feeds",summary:`${r} ${r===1?"feed type":"feed types"}`,onOpen:()=>n?.open({href:"",title:"Feeds",connectorPanel:{section:"feeds",connectorKey:s.key,organizationId:t,ownerSlug:a}})}):null}function ze({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i}){const o=q(),p=Be(s?.auth_schema);if(i)return e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{className:"h-4 w-24"}),e.jsx(L,{className:"h-16 w-full rounded-lg"})]});if(r.length===0){const d=s&&p?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ue,{organizationId:t,connectorKey:n,provider:p.provider,providerLabel:s.name,installShape:p.installShape,size:"default",label:`Install ${s.name}`}),e.jsx(g,{asChild:!0,variant:"outline",children:e.jsx(G,{to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n},children:"Use your own app"})})]}):e.jsxs(g,{size:"default",onClick:()=>o({to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n}}),children:[e.jsx(Fe,{className:"mr-1.5 h-4 w-4"}),"Create connection"]});return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:d})}return null}function Te({status:s}){const t=s==="active"?"text-green-500":s==="error"||s==="revoked"?"text-destructive":"text-amber-500";return e.jsxs("span",{className:ee("text-xs",t),children:["· ",s]})}function bt(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Ct(s){const t={};for(const[a,n]of Object.entries(s))typeof n=="string"&&n.trim()?t[a]=n.trim():(typeof n=="number"||typeof n=="boolean")&&(t[a]=String(n));return t}export{mt as ConnectorDetailShell,yt as OAuthAccountsSection,jt as OAuthAppProfilesSection,Dt as component};
@@ -1 +1 @@
1
- import{j as e,eo as M,af as h,ik as w,r as j,q as z,a as C,il as k}from"./index-GZkujXG1.js";import{A as N}from"./agent-loading-shells-Cve_XIMW.js";import{s as b,R as y,A as L}from"./agent-thread-DhCFggHZ.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-Vndny_Gd.js";import"./index-Vcq4gwWv.js";const m={path:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",hex:"5865F2"},d={path:"M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z",hex:"34A853"},p={path:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",hex:"26A5E4"},x={path:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z",hex:"25D366"},O={discord:{hex:`#${m.hex}`,path:m.path},gchat:{hex:`#${d.hex}`,path:d.path},slack:{hex:"#4A154B",path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},teams:{imgSrc:"https://www.google.com/s2/favicons?domain=teams.microsoft.com&sz=64"},telegram:{hex:`#${p.hex}`,path:p.path},whatsapp:{hex:`#${x.hex}`,path:x.path}};function T({platform:s,className:t}){const a=s?O[s]:null;return a?"imgSrc"in a?e.jsx("img",{src:a.imgSrc,alt:"","aria-hidden":"true",className:h("rounded-sm",t),loading:"lazy"}):e.jsx("svg",{viewBox:a.viewBox??"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,style:{color:a.hex},children:e.jsx("path",{d:a.path})}):e.jsx(M,{className:h("text-muted-foreground",t),"aria-hidden":"true"})}const I={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",web:"Web"};function R(s,t,a){return s==="slack"&&a?.teamId&&t?`https://app.slack.com/client/${a.teamId}/${t}`:null}function S({owner:s,agentId:t,conversationId:a}){const{data:n=[],isLoading:u}=w(t,a,{orgSlug:s}),c=j.useMemo(()=>n.map(r=>b(r,{showToolCalls:!0})).filter(r=>r!==null),[n]),[o,g]=a.split(":"),i=I[o]??"the source app",{org:f}=z(),{data:v=[]}=C(f?.id??"",{connectorKey:o}),A=v[0]?.config?.chatMetadata,l=R(o,g,A);return e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col pb-6",children:u?e.jsx(N,{readOnly:!0}):c.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages in this conversation."}):e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(y,{messages:c,children:e.jsx(L,{readOnly:!0})}),l?e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm transition-colors hover:bg-muted",children:[e.jsx(T,{platform:o,className:"size-5 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground",children:["This is a read-only copy. Continue the conversation with this agent in ",i,"."]}),e.jsxs("span",{className:"ml-auto shrink-0 whitespace-nowrap font-medium text-foreground",children:["Open ",i," →"]})]}):null]})})}function _(){const{owner:s,agentId:t,conversationId:a}=k.useParams();return e.jsx(S,{owner:s,agentId:t,conversationId:a})}export{_ as component};
1
+ import{j as e,eo as M,af as h,ik as w,r as j,q as z,a as C,il as k}from"./index-B2AmRqYh.js";import{A as N}from"./agent-loading-shells-OagauQzV.js";import{s as b,R as y,A as L}from"./agent-thread-B9-cdkaV.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-B4DfZFm5.js";import"./index-Vcq4gwWv.js";const m={path:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",hex:"5865F2"},d={path:"M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z",hex:"34A853"},p={path:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",hex:"26A5E4"},x={path:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z",hex:"25D366"},O={discord:{hex:`#${m.hex}`,path:m.path},gchat:{hex:`#${d.hex}`,path:d.path},slack:{hex:"#4A154B",path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},teams:{imgSrc:"https://www.google.com/s2/favicons?domain=teams.microsoft.com&sz=64"},telegram:{hex:`#${p.hex}`,path:p.path},whatsapp:{hex:`#${x.hex}`,path:x.path}};function T({platform:s,className:t}){const a=s?O[s]:null;return a?"imgSrc"in a?e.jsx("img",{src:a.imgSrc,alt:"","aria-hidden":"true",className:h("rounded-sm",t),loading:"lazy"}):e.jsx("svg",{viewBox:a.viewBox??"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,style:{color:a.hex},children:e.jsx("path",{d:a.path})}):e.jsx(M,{className:h("text-muted-foreground",t),"aria-hidden":"true"})}const I={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",web:"Web"};function R(s,t,a){return s==="slack"&&a?.teamId&&t?`https://app.slack.com/client/${a.teamId}/${t}`:null}function S({owner:s,agentId:t,conversationId:a}){const{data:n=[],isLoading:u}=w(t,a,{orgSlug:s}),c=j.useMemo(()=>n.map(r=>b(r,{showToolCalls:!0})).filter(r=>r!==null),[n]),[o,g]=a.split(":"),i=I[o]??"the source app",{org:f}=z(),{data:v=[]}=C(f?.id??"",{connectorKey:o}),A=v[0]?.config?.chatMetadata,l=R(o,g,A);return e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col pb-6",children:u?e.jsx(N,{readOnly:!0}):c.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages in this conversation."}):e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(y,{messages:c,children:e.jsx(L,{readOnly:!0})}),l?e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm transition-colors hover:bg-muted",children:[e.jsx(T,{platform:o,className:"size-5 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground",children:["This is a read-only copy. Continue the conversation with this agent in ",i,"."]}),e.jsxs("span",{className:"ml-auto shrink-0 whitespace-nowrap font-medium text-foreground",children:["Open ",i," →"]})]}):null]})})}function _(){const{owner:s,agentId:t,conversationId:a}=k.useParams();return e.jsx(S,{owner:s,agentId:t,conversationId:a})}export{_ as component};
@@ -1 +1 @@
1
- import{j as e,L as h,eD as f,c6 as j,c7 as g,bk as d,h1 as y,h0 as N,en as m,x as o,ab as b,af as v,aP as D,e3 as w,aA as S,hX as A}from"./index-GZkujXG1.js";import{c as x,d as C}from"./deployments-body-B54mJoZC.js";import{J as I}from"./json-diff-D6sv990W.js";import{b as k,a as B}from"./deployments-DHAx8TBs.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";const c="change-";function L({owner:t,deploymentId:s}){const a=s.startsWith(c),r=k(a?null:s),l=B(a?s.slice(c.length):null),i=a?l:r;return e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs(h,{to:"/$owner/connectors/deployments",params:{owner:t},className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(f,{className:"h-3 w-3"}),"All deployments"]}),i.isLoading?e.jsx(j,{label:"deployment",variant:"panel"}):i.isError?e.jsx(g,{label:"deployment"}):a?l.data?e.jsx(E,{change:l.data}):e.jsx(d,{icon:y,title:"Change not found",description:"This config change is not in the audit trail, or the server predates the deployments API."}):r.data?e.jsx($,{detail:r.data}):e.jsx(d,{icon:N,title:"Deployment not found",description:"This apply run is not in the audit trail, or the server predates the deployments API."})]})}function $({detail:t}){const{deployment:s,changes:a}=t;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:["Deployment ",s.applyId?.slice(4,12)??s.id]}),C(s.status),s.gitDirty?e.jsx(b,{variant:"outline",children:"Dirty working tree"}):null]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(s.createdAt)," (",o(s.createdAt),")",s.createdBy?` · by ${s.createdBy}`:""]}),e.jsxs("dl",{className:"grid gap-1.5 text-xs",children:[s.applyId?e.jsx(n,{label:"Apply id",value:s.applyId,copyable:!0}):null,s.manifestHash?e.jsx(n,{label:"Manifest hash",value:s.manifestHash,copyable:!0}):null,s.gitSha?e.jsx(n,{label:"Git SHA",value:s.gitDirty?`${s.gitSha} (dirty)`:s.gitSha,copyValue:s.gitSha,copyable:!0}):null,s.cliVersion?e.jsx(n,{label:"CLI version",value:s.cliVersion,copyable:!0}):null]}),s.status==="partial_failure"&&s.error?e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:s.error}):null]}),s.gitSha?e.jsxs("section",{className:v(D,"space-y-2 p-4"),children:[e.jsx("p",{className:"text-sm font-medium",children:"Rollback"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Rollback is git-first: revert the commit that produced this deployment, then re-apply."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"font-mono text-xs",children:["git revert ",s.gitSha," && lobu apply"]}),e.jsx(p,{value:`git revert ${s.gitSha} && lobu apply`,label:"rollback command"})]})]}):null,e.jsxs("section",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-medium",children:["Changes",e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:a.length})]}),a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No config changes in this apply run."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:a.map((r,l)=>e.jsx(u,{change:r,isLast:l===a.length-1},r.id))})]})]})}function E({change:t}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(t.createdAt)," (",o(t.createdAt),")",t.actorSource?` · via ${t.actorSource}`:"",t.createdBy?` · by ${t.createdBy}`:""]})]}),e.jsx("section",{className:"overflow-hidden rounded-lg border",children:e.jsx(u,{change:t,isLast:!0})})]})}function u({change:t,isLast:s}){return e.jsxs("div",{className:`px-3 py-2.5 ${s?"":"border-b"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op),e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:o(t.createdAt)})]}),t.changedFields&&t.changedFields.length>0?e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Changed: ",t.changedFields.join(", ")]}):null,e.jsx(I,{before:t.before,after:t.after})]})}function n({label:t,value:s,copyValue:a,copyable:r}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:t}),e.jsxs("dd",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("span",{className:"truncate font-mono",children:s}),r?e.jsx(p,{value:a??s,label:t}):null]})]})}function p({value:t,label:s}){return e.jsx("button",{type:"button","aria-label":`Copy ${s}`,className:"shrink-0 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>{navigator.clipboard.writeText(t),S.success("Copied to clipboard")},children:e.jsx(w,{className:"h-3 w-3"})})}function X(){const{owner:t,deploymentId:s}=A.useParams();return e.jsx(L,{owner:t,deploymentId:s})}export{X as component};
1
+ import{j as e,L as h,eD as f,c6 as j,c7 as g,bk as d,h1 as y,h0 as N,en as m,x as o,ab as b,af as v,aP as D,e3 as w,aA as S,hX as A}from"./index-B2AmRqYh.js";import{c as x,d as C}from"./deployments-body-Bm2upStd.js";import{J as I}from"./json-diff-ClBBYBQD.js";import{b as k,a as B}from"./deployments-ByBv1DW-.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";const c="change-";function L({owner:t,deploymentId:s}){const a=s.startsWith(c),r=k(a?null:s),l=B(a?s.slice(c.length):null),i=a?l:r;return e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs(h,{to:"/$owner/connectors/deployments",params:{owner:t},className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(f,{className:"h-3 w-3"}),"All deployments"]}),i.isLoading?e.jsx(j,{label:"deployment",variant:"panel"}):i.isError?e.jsx(g,{label:"deployment"}):a?l.data?e.jsx(E,{change:l.data}):e.jsx(d,{icon:y,title:"Change not found",description:"This config change is not in the audit trail, or the server predates the deployments API."}):r.data?e.jsx($,{detail:r.data}):e.jsx(d,{icon:N,title:"Deployment not found",description:"This apply run is not in the audit trail, or the server predates the deployments API."})]})}function $({detail:t}){const{deployment:s,changes:a}=t;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:["Deployment ",s.applyId?.slice(4,12)??s.id]}),C(s.status),s.gitDirty?e.jsx(b,{variant:"outline",children:"Dirty working tree"}):null]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(s.createdAt)," (",o(s.createdAt),")",s.createdBy?` · by ${s.createdBy}`:""]}),e.jsxs("dl",{className:"grid gap-1.5 text-xs",children:[s.applyId?e.jsx(n,{label:"Apply id",value:s.applyId,copyable:!0}):null,s.manifestHash?e.jsx(n,{label:"Manifest hash",value:s.manifestHash,copyable:!0}):null,s.gitSha?e.jsx(n,{label:"Git SHA",value:s.gitDirty?`${s.gitSha} (dirty)`:s.gitSha,copyValue:s.gitSha,copyable:!0}):null,s.cliVersion?e.jsx(n,{label:"CLI version",value:s.cliVersion,copyable:!0}):null]}),s.status==="partial_failure"&&s.error?e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:s.error}):null]}),s.gitSha?e.jsxs("section",{className:v(D,"space-y-2 p-4"),children:[e.jsx("p",{className:"text-sm font-medium",children:"Rollback"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Rollback is git-first: revert the commit that produced this deployment, then re-apply."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"font-mono text-xs",children:["git revert ",s.gitSha," && lobu apply"]}),e.jsx(p,{value:`git revert ${s.gitSha} && lobu apply`,label:"rollback command"})]})]}):null,e.jsxs("section",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-medium",children:["Changes",e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:a.length})]}),a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No config changes in this apply run."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:a.map((r,l)=>e.jsx(u,{change:r,isLast:l===a.length-1},r.id))})]})]})}function E({change:t}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(t.createdAt)," (",o(t.createdAt),")",t.actorSource?` · via ${t.actorSource}`:"",t.createdBy?` · by ${t.createdBy}`:""]})]}),e.jsx("section",{className:"overflow-hidden rounded-lg border",children:e.jsx(u,{change:t,isLast:!0})})]})}function u({change:t,isLast:s}){return e.jsxs("div",{className:`px-3 py-2.5 ${s?"":"border-b"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op),e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:o(t.createdAt)})]}),t.changedFields&&t.changedFields.length>0?e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Changed: ",t.changedFields.join(", ")]}):null,e.jsx(I,{before:t.before,after:t.after})]})}function n({label:t,value:s,copyValue:a,copyable:r}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:t}),e.jsxs("dd",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("span",{className:"truncate font-mono",children:s}),r?e.jsx(p,{value:a??s,label:t}):null]})]})}function p({value:t,label:s}){return e.jsx("button",{type:"button","aria-label":`Copy ${s}`,className:"shrink-0 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>{navigator.clipboard.writeText(t),S.success("Copied to clipboard")},children:e.jsx(w,{className:"h-3 w-3"})})}function X(){const{owner:t,deploymentId:s}=A.useParams();return e.jsx(L,{owner:t,deploymentId:s})}export{X as component};
@@ -0,0 +1 @@
1
+ import{ij as a,j as e}from"./index-B2AmRqYh.js";import{b as i}from"./agent-guardrails-route-Dp02G1AQ.js";import"./model-selector-CapL1ARf.js";import"./agent-subpage-shell-Dz8I-GUt.js";import"./agent-loading-shells-OagauQzV.js";import"./agent-card-controls-B3RhzsPz.js";import"./switch-BQ40_DMb.js";function l(){const{owner:t,agentId:r,name:o}=a.useParams();return e.jsx(i,{owner:t,agentId:r,name:o})}export{l as component};
@@ -1 +1 @@
1
- import{j as e,I as _,u as T,a as O,S as j,r as h,C as R,B as m,L as P,P as K,b as F,c as B,d as y,f as H,e as k,g as I,h as V,i as q,k as v,l as U,m as $,n as L,o as z,p as E,q as M,s as W,t as Q,v as G,w as J,x as X,y as Y,z as Z,E as ee,A as se,D as te,F as ne,G as re,H as ie,J as ae,K as oe,M as ce,N as de,O as le,Q as ue,R as xe,X as me,T as pe,U as he,V as fe,W as ge,Y as je}from"./index-GZkujXG1.js";import{u as ye,A as ve,a as Ne}from"./automation-detail-content-C08Ef137.js";import{C as we,a as ke,A as be}from"./connection-feed-detail-XYK-ubKG.js";import{c as Ce}from"./connection-label-BobuYiAG.js";import{C as Se,f as Ae}from"./runs-table-Dh7FL3Va.js";import{E as D,u as Pe}from"./events-feed-BgvLTppV.js";import{T as Ie,a as Le,b as C,c as S,V as ze}from"./view-frame-DxiuLSGA.js";import"./create-automation-form-BHir-pIp.js";import"./cronstrue-BwvvZn_Y.js";import"./entity-options-Bm1sbpmt.js";import"./switch-Dcx3_8kM.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-BoudNhPZ.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-bpbaa7f6.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-Vndny_Gd.js";import"./proposal-review-shell-C04RG1qM.js";import"./runs-DwThk2CI.js";import"./json-diff-D6sv990W.js";import"./deployments-DHAx8TBs.js";import"./agent-loading-shells-Cve_XIMW.js";import"./agent-thread-DhCFggHZ.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-applied-views-BpvIIgWG.js";import"./clients-DqMOcwpO.js";import"./renderer-eFSU65zm.js";import"./card-MXMmjz9G.js";function Ee(s){if(!s||typeof s!="object")return[];const t=s.properties;if(!t)return[];const i=Array.isArray(s.required)?new Set(s.required.map(String)):new Set;return Object.entries(t).map(([n,r])=>({name:n,type:String(r.type??"any"),required:i.has(n),description:typeof r.description=="string"?r.description:void 0}))}function De({fields:s}){return s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):e.jsx("ul",{className:"space-y-2",children:s.map(t=>e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[e.jsx("code",{className:"text-xs font-medium text-foreground",children:t.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:t.type}),t.required?e.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),t.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null]},t.name))})}function N({item:s,hideHeading:t=!1}){const i=s.schemaSections;return i?e.jsxs("article",{className:t?"space-y-4":"space-y-4 px-5 py-5",children:[!t&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h2",{className:"text-base font-medium text-foreground",children:s.title}),i.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description}):null]})]}),i.sections.map(n=>{const r=Ee(n.schema);return e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n.title}),n.description?e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}):null]}),e.jsx(De,{fields:r})]},n.title)})]}):null}function _e({panel:s}){const t=T(s.organizationId),i=s.section==="connections"||!!s.connectionId,n=O(s.organizationId,{connectorKey:s.connectorKey,connectionIds:s.connectionId?[s.connectionId]:void 0,enabled:i}),r=t.data?.find(o=>o.key===s.connectorKey),a=n.data?.find(o=>o.id===s.connectionId&&o.connector_key===s.connectorKey);return t.isLoading||i&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(j,{className:"h-28 w-full"})}):t.isError||i&&n.isError?e.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):s.connectionId&&!a||!r&&!a&&s.section!=="connections"?e.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):e.jsx("div",{className:"p-5",children:s.section==="connections"?e.jsx(Te,{connections:n.data?.filter(o=>o.connector_key===s.connectorKey)??[],connector:r,connectorKey:s.connectorKey,ownerSlug:s.ownerSlug}):a?e.jsx(Ke,{connection:a,connector:r,panel:s}):r?s.section==="feeds"?e.jsx(Oe,{connector:r}):r.installed===!1?e.jsx(Re,{connector:r,ownerSlug:s.ownerSlug}):e.jsx(Be,{connector:r,ownerSlug:s.ownerSlug}):null},`${s.connectorKey}:${s.connectionId??"connector"}:${s.section}`)}function Te({connections:s,connector:t,connectorKey:i,ownerSlug:n}){const[r,a]=h.useState(""),o=s.filter(c=>Ce({...c,connector_name:c.connector_name??t?.name??null}).toLowerCase().includes(r.trim().toLowerCase()));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(R,{label:"connections",query:r,onQueryChange:a,count:o.length,action:e.jsx(m,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(P,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:i},children:[e.jsx(K,{className:"size-3.5"}),"Add connection"]})})}),e.jsx(Se,{connections:o,connectorDef:t,ownerSlug:n,connectorKey:i}),o.length===0&&e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:r.trim()?"No matches. Try another search.":"No connections yet."})]})}function Oe({connector:s}){const t=Object.entries(s.feeds_schema??{}).map(([i,n])=>{const r=n;return{id:i,name:r.name??i,description:r.description,feed:r}});return e.jsx(y,{entries:t,label:"feed types",renderDetail:({name:i,feed:n})=>e.jsx(N,{item:{href:"",title:i,schemaSections:H(n)},hideHeading:!0})})}function Re({connector:s,ownerSlug:t}){const i=Object.entries(s.actions_schema??{}).map(([n,r])=>{const a=r;return{id:n,name:a.name??n,description:a.description,action:a}});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection."," ",e.jsx(k,{ownerSlug:t,connectorKey:s.key})]}),e.jsx(y,{entries:i,label:"actions",renderDetail:({name:n,action:r})=>e.jsx(N,{hideHeading:!0,item:{href:"",title:n,schemaSections:I(r)}})})]})}function Ke({connection:s,connector:t,panel:i}){const[n,r]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:i.section==="feeds"?e.jsx(Fe,{connection:s,connector:t,ownerSlug:i.ownerSlug}):e.jsx(F,{connection:s,ownerSlug:i.ownerSlug,inPeek:!0,onReviewPermissions:t?()=>r(!0):void 0})}),n&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(B,{connection:s,connectorDef:t})]})]})}function Fe({connection:s,connector:t,ownerSlug:i}){const{data:n=[],isLoading:r,isError:a}=q(s.id),[o,c]=h.useState(!1),l=s.facets?.chat??!1;if(r)return e.jsx(j,{className:"h-28 w-full"});if(a)return e.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const u=n.map(d=>({id:String(d.id),name:d.display_name||d.feed_key,status:Ae(d)??(d.operations.includes("sync")?"Sync enabled":"Live access"),feed:d}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:o,children:e.jsx(y,{entries:u,label:l?"channels":"feeds",action:Object.keys(t?.feeds_schema??{}).length>0?e.jsx(m,{size:"sm",variant:"outline",onClick:()=>c(!0),children:l?"Add channel":"Add feed"}):void 0,renderDetail:({feed:d})=>d.store==="channel_messages"?e.jsx(we,{feed:d,hideHeader:!0}):e.jsx(ke,{feed:d,connectorDef:t,ownerSlug:i})})}),o&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold",children:l?"Add channel":"Add feed"}),e.jsx(be,{organizationId:s.organization_id,connections:[s],connectorDefinitions:[t],onClose:()=>c(!1)})]})]})}function Be({connector:s,ownerSlug:t}){const{data:i=[],isLoading:n,isError:r}=V(s.key);if(n)return e.jsx(j,{className:"h-28 w-full"});if(r)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const a=s.actions_schema??{},o=i.map(c=>({id:c.operation_key,name:c.name??c.operation_key,description:c.description,operation:c}));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection. Click an action to inspect its inputs."," ",e.jsx(k,{ownerSlug:t,connectorKey:s.key})]}),e.jsx(y,{entries:o,label:"actions",renderControl:()=>e.jsx(k,{ownerSlug:t,connectorKey:s.key}),renderDetail:({operation:c,name:l})=>a[c.operation_key]?e.jsx(N,{hideHeading:!0,item:{href:"",title:l,schemaSections:I(a[c.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function He({owner:s,path:t}){const{data:i,isLoading:n}=v(s,{slug:s}),r=i?.workspace,a=r?.type==="organization"?r.id:null,o=a?{slug:s}:void 0,{data:c,isLoading:l}=U(`/${s}/${$(t)}`,o),u=c?.entity?.id;return n||l?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(L,{className:"mr-2"})," Loading…"]}):!a||u==null?e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This record no longer exists."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(D,{organizationId:a,ownerSlug:s,entityId:u,filters:{sortBy:"date",sortOrder:"desc"},dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})})}function g({owner:s,runId:t,runIds:i,contentIds:n}){const{data:r,isLoading:a}=v(s==="me"?null:s,{slug:s}),o=r?.workspace,c=s!=="me"&&o?.type==="organization"?o.id:null,l=h.useMemo(()=>{if(s==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const d=i??(t!=null?[t]:void 0);if(!(!d?.length&&!n?.length))return{...d?.length?{runIds:d}:{},...n?.length?{contentIds:n}:{}}},[s,n,t,i]),u=l!=null;return s!=="me"&&a?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(L,{className:"mr-2"})," Loading…"]}):s!=="me"&&c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):u?e.jsx("div",{className:"px-4 py-4",children:e.jsx(D,{organizationId:c,ownerSlug:s,filters:l,dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No matching events yet."})})}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}const f=":event",Ve={},qe=()=>{};function Ue({owner:s,eventId:t,viewKey:i}){const n=z(),{isAuthenticated:r,isReady:a}=E(),{isMember:o}=M(),{data:c}=v(s==="me"?null:s,{slug:s}),l=c?.workspace,u=l?.type==="organization"?l.id:null,d=s!=="me"&&a&&r&&o&&u!==null,w=Pe(d?{slug:s,organizationId:u}:null,t),b=e.jsx(g,{owner:s,contentIds:[t]});if(!d||w.views.length===0)return b;const p=w.views.find(x=>x.key===i);return e.jsxs(Ie,{className:"px-4 pt-3",value:p?p.key:f,onValueChange:x=>n?.retarget(W(s,t,x===f?void 0:x)),children:[e.jsxs(Le,{children:[e.jsx(C,{value:f,"data-testid":"peek-tab-event",children:"Event"}),w.views.map(x=>e.jsx(C,{value:x.key,"data-testid":`peek-tab-${x.key}`,children:x.name},x.key))]}),e.jsx(S,{value:f,className:"-mx-4",children:b}),p&&e.jsx(S,{value:p.key,children:e.jsx(ze,{orgSlug:s,viewKey:p.key,scope:{event:t},params:Ve,onParamsChange:qe,contentHash:p.content_hash,title:p.name,minHeight:240})})]})}function $e({item:s}){if(s.connectorPanel)return e.jsx(_e,{panel:s.connectorPanel});if(s.schemaSections)return e.jsx(N,{item:s});if(typeof s.browserUrl=="string"&&s.browserUrl.length>0)return e.jsx(A,{item:s});const t=s.href?Q(s.href):null;return t?t.kind==="memory"?"runId"in t?e.jsx(g,{owner:t.owner,runId:t.runId}):"runIds"in t?e.jsx(g,{owner:t.owner,runIds:t.runIds}):e.jsx(g,{owner:t.owner,contentIds:t.contentIds}):t.kind==="entity"?e.jsx(He,{owner:t.owner,path:t.path}):t.kind==="event"?e.jsx(Ue,{owner:t.owner,eventId:t.eventId,viewKey:t.viewKey}):s.runId?e.jsx(Me,{owner:t.owner,automationId:t.automationId,runId:s.runId}):e.jsx(We,{owner:t.owner,automationId:t.automationId,initialView:t.view??"activity",runId:t.runId}):e.jsx(A,{item:s})}function A({item:s}){const t=s.body,i=s.notificationType??"generic",n=s.createdAt,r=s.browserUrl??null,a=s.browserHandoff??null;return e.jsxs("article",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:J(i)}),n?e.jsx("span",{children:X(n)}):null]})]}),t?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(Y,{text:t,linkPolicy:i==="action_approval_needed"?"app-links":"strip"})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),s.owner&&s.sourceAttribution?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),e.jsx(Z,{owner:s.owner,source:s.sourceAttribution,className:"text-xs"})]}):null,r?e.jsx("div",{className:"space-y-2",children:a?.state==="expired"?e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:a.error_message??"This draft expired before the page was opened."}):a?.state==="completed"?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This handoff has already been activated in Chrome."}):e.jsxs(m,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{se(r)},children:[e.jsx(ee,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function Me({owner:s,automationId:t,runId:i}){const{organizationId:n}=ye(s),r=te(t,void 0,n),a=r.data?.automation?.managed_agent_id??null;return a?e.jsx(ve,{agentId:a,automationId:t,ownerSlug:s,runId:i}):r.isLoading?e.jsx(j,{className:"h-24 w-full rounded-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This run has no agent transcript."})}function We({owner:s,automationId:t,initialView:i,runId:n}){const[r,a]=h.useState(i),o=r==="definition";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>a(o?"activity":"definition"),children:o?"Done":e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),"Edit"]})})}),e.jsx(Ne,{owner:s,agentId:null,automationId:t,view:r,runId:n,onDone:()=>a("activity")})]})}function Qe(){const s=z(),t=re();return s?.item?e.jsx(Ge,{item:s.item,onClose:s.close,onBack:s.back,isNarrow:t}):null}function Ge({item:s,onClose:t,onBack:i,isNarrow:n}){const r=s.href?ie(s.href):null;h.useEffect(()=>{if(n)return;const c=l=>{l.key==="Escape"&&(l.preventDefault(),t())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[t,n]);const a=c=>e.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[i||c?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:i??t,children:e.jsx(ue,{className:"h-4 w-4"})}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),r?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:e.jsx(P,{to:r.pathname,search:r.search??{},onClick:t,children:e.jsx(xe,{className:"h-4 w-4"})})}):null,e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:t,children:e.jsx(me,{className:"h-4 w-4"})})]}),o=e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx($e,{item:s})});return n?e.jsx(ae,{open:!0,onOpenChange:c=>{c||t()},children:e.jsxs(oe,{children:[e.jsx(ce,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),e.jsxs(de,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[e.jsx(le,{className:"sr-only",children:s.title}),a(!0),o]})]})}):e.jsxs("aside",{className:"flex w-[460px] max-w-[45vw] shrink-0 flex-col border-l border-border bg-background",children:[a(!1),o]})}function Ss(){const{owner:s}=pe.useParams(),{data:t,isLoading:i,error:n}=v(s==="me"?null:s,{slug:s}),{session:r,isReady:a}=E(),o=he(n)&&!t?.workspace;return fe({active:!i&&!o&&a&&!r&&!t?.workspace,owner:s})?null:e.jsx(ge,{children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:e.jsx(je,{})}),e.jsx(Qe,{})]})})}export{Ss as component};
1
+ import{j as e,I as _,u as T,a as O,S as j,r as h,C as R,B as m,L as P,P as K,b as F,c as B,d as y,f as H,e as k,g as I,h as V,i as q,k as v,l as U,m as $,n as L,o as z,p as E,q as M,s as W,t as Q,v as G,w as J,x as X,y as Y,z as Z,E as ee,A as se,D as te,F as ne,G as re,H as ie,J as ae,K as oe,M as ce,N as de,O as le,Q as ue,R as xe,X as me,T as pe,U as he,V as fe,W as ge,Y as je}from"./index-B2AmRqYh.js";import{u as ye,A as ve,a as Ne}from"./automation-detail-content-9Rjb_I9j.js";import{C as we,a as ke,A as be}from"./connection-feed-detail-D1whY5hL.js";import{c as Ce}from"./connection-label-BobuYiAG.js";import{C as Se,f as Ae}from"./runs-table-BUKDjiBc.js";import{E as D,u as Pe}from"./events-feed-DK35T4g7.js";import{T as Ie,a as Le,b as C,c as S,V as ze}from"./view-frame-C7ciEoLo.js";import"./create-automation-form-CuxiIRCF.js";import"./cronstrue-2GHCtD7h.js";import"./entity-options-CrbS6K-i.js";import"./switch-BQ40_DMb.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-CapL1ARf.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-CYsR2VBP.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-B4DfZFm5.js";import"./proposal-review-shell-D4YNrrye.js";import"./runs-oHveuEUB.js";import"./json-diff-ClBBYBQD.js";import"./deployments-ByBv1DW-.js";import"./agent-loading-shells-OagauQzV.js";import"./agent-thread-B9-cdkaV.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-applied-views-B-Z-Weji.js";import"./clients-Cp1BJ28u.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";function Ee(s){if(!s||typeof s!="object")return[];const t=s.properties;if(!t)return[];const i=Array.isArray(s.required)?new Set(s.required.map(String)):new Set;return Object.entries(t).map(([n,r])=>({name:n,type:String(r.type??"any"),required:i.has(n),description:typeof r.description=="string"?r.description:void 0}))}function De({fields:s}){return s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):e.jsx("ul",{className:"space-y-2",children:s.map(t=>e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[e.jsx("code",{className:"text-xs font-medium text-foreground",children:t.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:t.type}),t.required?e.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),t.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null]},t.name))})}function N({item:s,hideHeading:t=!1}){const i=s.schemaSections;return i?e.jsxs("article",{className:t?"space-y-4":"space-y-4 px-5 py-5",children:[!t&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h2",{className:"text-base font-medium text-foreground",children:s.title}),i.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description}):null]})]}),i.sections.map(n=>{const r=Ee(n.schema);return e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n.title}),n.description?e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}):null]}),e.jsx(De,{fields:r})]},n.title)})]}):null}function _e({panel:s}){const t=T(s.organizationId),i=s.section==="connections"||!!s.connectionId,n=O(s.organizationId,{connectorKey:s.connectorKey,connectionIds:s.connectionId?[s.connectionId]:void 0,enabled:i}),r=t.data?.find(o=>o.key===s.connectorKey),a=n.data?.find(o=>o.id===s.connectionId&&o.connector_key===s.connectorKey);return t.isLoading||i&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(j,{className:"h-28 w-full"})}):t.isError||i&&n.isError?e.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):s.connectionId&&!a||!r&&!a&&s.section!=="connections"?e.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):e.jsx("div",{className:"p-5",children:s.section==="connections"?e.jsx(Te,{connections:n.data?.filter(o=>o.connector_key===s.connectorKey)??[],connector:r,connectorKey:s.connectorKey,ownerSlug:s.ownerSlug}):a?e.jsx(Ke,{connection:a,connector:r,panel:s}):r?s.section==="feeds"?e.jsx(Oe,{connector:r}):r.installed===!1?e.jsx(Re,{connector:r,ownerSlug:s.ownerSlug}):e.jsx(Be,{connector:r,ownerSlug:s.ownerSlug}):null},`${s.connectorKey}:${s.connectionId??"connector"}:${s.section}`)}function Te({connections:s,connector:t,connectorKey:i,ownerSlug:n}){const[r,a]=h.useState(""),o=s.filter(c=>Ce({...c,connector_name:c.connector_name??t?.name??null}).toLowerCase().includes(r.trim().toLowerCase()));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(R,{label:"connections",query:r,onQueryChange:a,count:o.length,action:e.jsx(m,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(P,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:i},children:[e.jsx(K,{className:"size-3.5"}),"Add connection"]})})}),e.jsx(Se,{connections:o,connectorDef:t,ownerSlug:n,connectorKey:i}),o.length===0&&e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:r.trim()?"No matches. Try another search.":"No connections yet."})]})}function Oe({connector:s}){const t=Object.entries(s.feeds_schema??{}).map(([i,n])=>{const r=n;return{id:i,name:r.name??i,description:r.description,feed:r}});return e.jsx(y,{entries:t,label:"feed types",renderDetail:({name:i,feed:n})=>e.jsx(N,{item:{href:"",title:i,schemaSections:H(n)},hideHeading:!0})})}function Re({connector:s,ownerSlug:t}){const i=Object.entries(s.actions_schema??{}).map(([n,r])=>{const a=r;return{id:n,name:a.name??n,description:a.description,action:a}});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection."," ",e.jsx(k,{ownerSlug:t,connectorKey:s.key})]}),e.jsx(y,{entries:i,label:"actions",renderDetail:({name:n,action:r})=>e.jsx(N,{hideHeading:!0,item:{href:"",title:n,schemaSections:I(r)}})})]})}function Ke({connection:s,connector:t,panel:i}){const[n,r]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:i.section==="feeds"?e.jsx(Fe,{connection:s,connector:t,ownerSlug:i.ownerSlug}):e.jsx(F,{connection:s,ownerSlug:i.ownerSlug,inPeek:!0,onReviewPermissions:t?()=>r(!0):void 0})}),n&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(B,{connection:s,connectorDef:t})]})]})}function Fe({connection:s,connector:t,ownerSlug:i}){const{data:n=[],isLoading:r,isError:a}=q(s.id),[o,c]=h.useState(!1),l=s.facets?.chat??!1;if(r)return e.jsx(j,{className:"h-28 w-full"});if(a)return e.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const u=n.map(d=>({id:String(d.id),name:d.display_name||d.feed_key,status:Ae(d)??(d.operations.includes("sync")?"Sync enabled":"Live access"),feed:d}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:o,children:e.jsx(y,{entries:u,label:l?"channels":"feeds",action:Object.keys(t?.feeds_schema??{}).length>0?e.jsx(m,{size:"sm",variant:"outline",onClick:()=>c(!0),children:l?"Add channel":"Add feed"}):void 0,renderDetail:({feed:d})=>d.store==="channel_messages"?e.jsx(we,{feed:d,hideHeader:!0}):e.jsx(ke,{feed:d,connectorDef:t,ownerSlug:i})})}),o&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold",children:l?"Add channel":"Add feed"}),e.jsx(be,{organizationId:s.organization_id,connections:[s],connectorDefinitions:[t],onClose:()=>c(!1)})]})]})}function Be({connector:s,ownerSlug:t}){const{data:i=[],isLoading:n,isError:r}=V(s.key);if(n)return e.jsx(j,{className:"h-28 w-full"});if(r)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const a=s.actions_schema??{},o=i.map(c=>({id:c.operation_key,name:c.name??c.operation_key,description:c.description,operation:c}));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection. Click an action to inspect its inputs."," ",e.jsx(k,{ownerSlug:t,connectorKey:s.key})]}),e.jsx(y,{entries:o,label:"actions",renderControl:()=>e.jsx(k,{ownerSlug:t,connectorKey:s.key}),renderDetail:({operation:c,name:l})=>a[c.operation_key]?e.jsx(N,{hideHeading:!0,item:{href:"",title:l,schemaSections:I(a[c.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function He({owner:s,path:t}){const{data:i,isLoading:n}=v(s,{slug:s}),r=i?.workspace,a=r?.type==="organization"?r.id:null,o=a?{slug:s}:void 0,{data:c,isLoading:l}=U(`/${s}/${$(t)}`,o),u=c?.entity?.id;return n||l?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(L,{className:"mr-2"})," Loading…"]}):!a||u==null?e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This record no longer exists."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(D,{organizationId:a,ownerSlug:s,entityId:u,filters:{sortBy:"date",sortOrder:"desc"},dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})})}function g({owner:s,runId:t,runIds:i,contentIds:n}){const{data:r,isLoading:a}=v(s==="me"?null:s,{slug:s}),o=r?.workspace,c=s!=="me"&&o?.type==="organization"?o.id:null,l=h.useMemo(()=>{if(s==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const d=i??(t!=null?[t]:void 0);if(!(!d?.length&&!n?.length))return{...d?.length?{runIds:d}:{},...n?.length?{contentIds:n}:{}}},[s,n,t,i]),u=l!=null;return s!=="me"&&a?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(L,{className:"mr-2"})," Loading…"]}):s!=="me"&&c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):u?e.jsx("div",{className:"px-4 py-4",children:e.jsx(D,{organizationId:c,ownerSlug:s,filters:l,dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No matching events yet."})})}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}const f=":event",Ve={},qe=()=>{};function Ue({owner:s,eventId:t,viewKey:i}){const n=z(),{isAuthenticated:r,isReady:a}=E(),{isMember:o}=M(),{data:c}=v(s==="me"?null:s,{slug:s}),l=c?.workspace,u=l?.type==="organization"?l.id:null,d=s!=="me"&&a&&r&&o&&u!==null,w=Pe(d?{slug:s,organizationId:u}:null,t),b=e.jsx(g,{owner:s,contentIds:[t]});if(!d||w.views.length===0)return b;const p=w.views.find(x=>x.key===i);return e.jsxs(Ie,{className:"px-4 pt-3",value:p?p.key:f,onValueChange:x=>n?.retarget(W(s,t,x===f?void 0:x)),children:[e.jsxs(Le,{children:[e.jsx(C,{value:f,"data-testid":"peek-tab-event",children:"Event"}),w.views.map(x=>e.jsx(C,{value:x.key,"data-testid":`peek-tab-${x.key}`,children:x.name},x.key))]}),e.jsx(S,{value:f,className:"-mx-4",children:b}),p&&e.jsx(S,{value:p.key,children:e.jsx(ze,{orgSlug:s,viewKey:p.key,scope:{event:t},params:Ve,onParamsChange:qe,contentHash:p.content_hash,title:p.name,minHeight:240})})]})}function $e({item:s}){if(s.connectorPanel)return e.jsx(_e,{panel:s.connectorPanel});if(s.schemaSections)return e.jsx(N,{item:s});if(typeof s.browserUrl=="string"&&s.browserUrl.length>0)return e.jsx(A,{item:s});const t=s.href?Q(s.href):null;return t?t.kind==="memory"?"runId"in t?e.jsx(g,{owner:t.owner,runId:t.runId}):"runIds"in t?e.jsx(g,{owner:t.owner,runIds:t.runIds}):e.jsx(g,{owner:t.owner,contentIds:t.contentIds}):t.kind==="entity"?e.jsx(He,{owner:t.owner,path:t.path}):t.kind==="event"?e.jsx(Ue,{owner:t.owner,eventId:t.eventId,viewKey:t.viewKey}):s.runId?e.jsx(Me,{owner:t.owner,automationId:t.automationId,runId:s.runId}):e.jsx(We,{owner:t.owner,automationId:t.automationId,initialView:t.view??"activity",runId:t.runId}):e.jsx(A,{item:s})}function A({item:s}){const t=s.body,i=s.notificationType??"generic",n=s.createdAt,r=s.browserUrl??null,a=s.browserHandoff??null;return e.jsxs("article",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:J(i)}),n?e.jsx("span",{children:X(n)}):null]})]}),t?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(Y,{text:t,linkPolicy:i==="action_approval_needed"?"app-links":"strip"})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),s.owner&&s.sourceAttribution?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),e.jsx(Z,{owner:s.owner,source:s.sourceAttribution,className:"text-xs"})]}):null,r?e.jsx("div",{className:"space-y-2",children:a?.state==="expired"?e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:a.error_message??"This draft expired before the page was opened."}):a?.state==="completed"?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This handoff has already been activated in Chrome."}):e.jsxs(m,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{se(r)},children:[e.jsx(ee,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function Me({owner:s,automationId:t,runId:i}){const{organizationId:n}=ye(s),r=te(t,void 0,n),a=r.data?.automation?.managed_agent_id??null;return a?e.jsx(ve,{agentId:a,automationId:t,ownerSlug:s,runId:i}):r.isLoading?e.jsx(j,{className:"h-24 w-full rounded-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This run has no agent transcript."})}function We({owner:s,automationId:t,initialView:i,runId:n}){const[r,a]=h.useState(i),o=r==="definition";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>a(o?"activity":"definition"),children:o?"Done":e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),"Edit"]})})}),e.jsx(Ne,{owner:s,agentId:null,automationId:t,view:r,runId:n,onDone:()=>a("activity")})]})}function Qe(){const s=z(),t=re();return s?.item?e.jsx(Ge,{item:s.item,onClose:s.close,onBack:s.back,isNarrow:t}):null}function Ge({item:s,onClose:t,onBack:i,isNarrow:n}){const r=s.href?ie(s.href):null;h.useEffect(()=>{if(n)return;const c=l=>{l.key==="Escape"&&(l.preventDefault(),t())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[t,n]);const a=c=>e.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[i||c?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:i??t,children:e.jsx(ue,{className:"h-4 w-4"})}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),r?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:e.jsx(P,{to:r.pathname,search:r.search??{},onClick:t,children:e.jsx(xe,{className:"h-4 w-4"})})}):null,e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:t,children:e.jsx(me,{className:"h-4 w-4"})})]}),o=e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx($e,{item:s})});return n?e.jsx(ae,{open:!0,onOpenChange:c=>{c||t()},children:e.jsxs(oe,{children:[e.jsx(ce,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),e.jsxs(de,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[e.jsx(le,{className:"sr-only",children:s.title}),a(!0),o]})]})}):e.jsxs("aside",{className:"flex w-[460px] max-w-[45vw] shrink-0 flex-col border-l border-border bg-background",children:[a(!1),o]})}function Ss(){const{owner:s}=pe.useParams(),{data:t,isLoading:i,error:n}=v(s==="me"?null:s,{slug:s}),{session:r,isReady:a}=E(),o=he(n)&&!t?.workspace;return fe({active:!i&&!o&&a&&!r&&!t?.workspace,owner:s})?null:e.jsx(ge,{children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:e.jsx(je,{})}),e.jsx(Qe,{})]})})}export{Ss as component};
@@ -0,0 +1 @@
1
+ import{i8 as p,j as e,bP as m}from"./index-B2AmRqYh.js";import{M as i}from"./memory-browse-page-CeAnKoTR.js";import"./switch-BQ40_DMb.js";import"./entity-type-page-onp2Tk_E.js";import"./json-diff-ClBBYBQD.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-CYsR2VBP.js";import"./schema-value-normalization-3JuM_r1H.js";import"./calendar-DAiyi1ZL.js";import"./core.esm-QA7BQgiK.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";import"./view-frame-C7ciEoLo.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-DrZ8m8yo.js";import"./use-applied-views-B-Z-Weji.js";import"./member-scope-gate-DXOCfx-v.js";function M(){const{owner:t,entityType:o,shape:r}=p.useParams();return e.jsx(i,{ownerSlug:t,typeScope:m(o),create:!1,shape:r})}export{M as component};
@@ -0,0 +1 @@
1
+ import{ih as r,j as e}from"./index-B2AmRqYh.js";import{b as m}from"./agent-skills-route-B4VUnVi0.js";import"./agent-subpage-shell-Dz8I-GUt.js";import"./agent-skill-context-BAr2Dw3F.js";import"./core.esm-QA7BQgiK.js";import"./skill-editor-D_W3QlRz.js";import"./agent-loading-shells-OagauQzV.js";import"./agent-card-controls-B3RhzsPz.js";import"./switch-BQ40_DMb.js";function f(){const{owner:t,agentId:o,skillKey:i}=r.useParams();return e.jsx(m,{owner:t,agentId:o,skillKey:i})}export{f as component};
@@ -1 +1 @@
1
- import{dw as d,Z as m,_ as x,dx as y,cF as c,j as t,c6 as g}from"./index-GZkujXG1.js";import{E as u}from"./entity-type-page-DSBcVv9e.js";import"./json-diff-D6sv990W.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-bpbaa7f6.js";function w(){const{owner:a,slug:n}=d.useParams(),{orgContext:s}=m(),o=x(),{data:i=[],isLoading:r}=y(s),e=i.find(l=>l.slug===n)??null,p=e?c(e):!1;return t.jsx("div",{className:"flex flex-1 flex-col gap-4 px-4 py-6 lg:px-6",children:t.jsx("div",{className:"max-w-3xl",children:r?t.jsx(g,{label:"entity type",variant:"panel"}):e?t.jsx(u,{entityType:e,orgContext:s,hideDelete:p,onClose:()=>{o({to:"/$owner/data",params:{owner:a}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{w as component};
1
+ import{dw as d,Z as m,_ as x,dx as y,cF as c,j as t,c6 as g}from"./index-B2AmRqYh.js";import{E as u}from"./entity-type-page-onp2Tk_E.js";import"./json-diff-ClBBYBQD.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-CYsR2VBP.js";function w(){const{owner:a,slug:n}=d.useParams(),{orgContext:s}=m(),o=x(),{data:i=[],isLoading:r}=y(s),e=i.find(l=>l.slug===n)??null,p=e?c(e):!1;return t.jsx("div",{className:"flex flex-1 flex-col gap-4 px-4 py-6 lg:px-6",children:t.jsx("div",{className:"max-w-3xl",children:r?t.jsx(g,{label:"entity type",variant:"panel"}):e?t.jsx(u,{entityType:e,orgContext:s,hideDelete:p,onClose:()=>{o({to:"/$owner/data",params:{owner:a}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{w as component};
@@ -0,0 +1 @@
1
+ import{io as i,gZ as n,j as m}from"./index-B2AmRqYh.js";import{E as p}from"./event-page-C0B2UDY-.js";import"./events-feed-DK35T4g7.js";import"./use-applied-views-B-Z-Weji.js";import"./clients-Cp1BJ28u.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";import"./view-frame-C7ciEoLo.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-DrZ8m8yo.js";function g(){const{owner:o,eventId:e,viewKey:r}=i.useParams(),t=n(e);return t===null?null:m.jsx(p,{owner:o,eventId:t,viewKey:r})}export{g as component};
@@ -0,0 +1 @@
1
+ import{ie as t,j as m}from"./index-B2AmRqYh.js";import{M as i}from"./memory-browse-page-CeAnKoTR.js";import"./switch-BQ40_DMb.js";import"./entity-type-page-onp2Tk_E.js";import"./json-diff-ClBBYBQD.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-CYsR2VBP.js";import"./schema-value-normalization-3JuM_r1H.js";import"./calendar-DAiyi1ZL.js";import"./core.esm-QA7BQgiK.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";import"./view-frame-C7ciEoLo.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-DrZ8m8yo.js";import"./use-applied-views-B-Z-Weji.js";import"./member-scope-gate-DXOCfx-v.js";function B(){const{owner:o,viewKey:r}=t.useParams();return m.jsx(i,{ownerSlug:o,create:!1,viewKey:r})}export{B as component};
@@ -0,0 +1 @@
1
+ import{im as e,j as i,bP as m}from"./index-B2AmRqYh.js";import{M as p}from"./memory-browse-page-CeAnKoTR.js";import"./switch-BQ40_DMb.js";import"./entity-type-page-onp2Tk_E.js";import"./json-diff-ClBBYBQD.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-CYsR2VBP.js";import"./schema-value-normalization-3JuM_r1H.js";import"./calendar-DAiyi1ZL.js";import"./core.esm-QA7BQgiK.js";import"./renderer-DgPLyEbx.js";import"./card-CMmh2mzo.js";import"./view-frame-C7ciEoLo.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-DrZ8m8yo.js";import"./use-applied-views-B-Z-Weji.js";import"./member-scope-gate-DXOCfx-v.js";function S(){const{owner:t,entityType:o,viewKey:r}=e.useParams();return i.jsx(p,{ownerSlug:t,typeScope:m(o),create:!1,viewKey:r})}export{S as component};
@@ -1 +1 @@
1
- import{p as l,av as m,r as c,ac as u,j as e,aw as d,am as h,at as f}from"./index-GZkujXG1.js";import{S as v,A as x,a as g}from"./index-DBs2lhwE.js";import{F as p}from"./full-page-spinner-ByBsHimW.js";function w({alt:i="",...a}){return e.jsx("img",{alt:i,...a,referrerPolicy:"no-referrer"})}function j({children:i}){const a=h(),n=async t=>{await a.invalidateQueries({queryKey:["organizations"]}),t()};return e.jsx(g,{authClient:f,navigate:t=>{n(()=>{window.location.href=t})},replace:t=>{n(()=>window.location.replace(t))},Link:({href:t,children:s,className:r})=>e.jsx("a",{href:t,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:w},children:i})}function b(){const{session:i,sessionResult:a}=l(),{invitationId:n}=m.useSearch(),t=c.useRef(!1);return c.useEffect(()=>{a.isPending||i||!n||t.current||(t.current=!0,(async()=>{let s=null;try{const o=await fetch(`${u}/api/invitation-preview?id=${encodeURIComponent(n)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(n)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[i,a.isPending,n]),i&&!n?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):i?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(j,{children:e.jsx(v,{children:e.jsx(x,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{b as component};
1
+ import{p as l,av as m,r as c,ac as u,j as e,aw as d,am as h,at as f}from"./index-B2AmRqYh.js";import{S as v,A as x,a as g}from"./index-CCcc_xBw.js";import{F as p}from"./full-page-spinner-Dd8eEaxq.js";function w({alt:i="",...a}){return e.jsx("img",{alt:i,...a,referrerPolicy:"no-referrer"})}function j({children:i}){const a=h(),n=async t=>{await a.invalidateQueries({queryKey:["organizations"]}),t()};return e.jsx(g,{authClient:f,navigate:t=>{n(()=>{window.location.href=t})},replace:t=>{n(()=>window.location.replace(t))},Link:({href:t,children:s,className:r})=>e.jsx("a",{href:t,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:w},children:i})}function b(){const{session:i,sessionResult:a}=l(),{invitationId:n}=m.useSearch(),t=c.useRef(!1);return c.useEffect(()=>{a.isPending||i||!n||t.current||(t.current=!0,(async()=>{let s=null;try{const o=await fetch(`${u}/api/invitation-preview?id=${encodeURIComponent(n)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(n)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[i,a.isPending,n]),i&&!n?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):i?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(j,{children:e.jsx(v,{children:e.jsx(x,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{b as component};