@lobu/runtime-server 23.0.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/catalogs/connectors.json +70 -6
  2. package/dist/catalogs/skills.json +1 -1
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +1 -1
  5. package/dist/connectors/linkedin-inbox-adapter.js +4 -7
  6. package/dist/connectors/linkedin.ts +53 -34
  7. package/dist/connectors/reddit.ts +92 -20
  8. package/dist/connectors/slack.ts +1 -0
  9. package/dist/connectors/whatsapp-web-adapter.js +41 -11
  10. package/dist/connectors/whatsapp-web-helpers.ts +1 -1
  11. package/dist/connectors/whatsapp_web.ts +2 -2
  12. package/dist/connectors/x-identity.ts +5 -3
  13. package/dist/db/migrations/20261019120000_retire_identities_of_deleted_entities.sql +21 -0
  14. package/dist/db/migrations/20261020120000_entities_live_metadata_domain.sql +66 -0
  15. package/dist/db/migrations/20261020130000_agents_starters.sql +14 -0
  16. package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +71 -0
  17. package/dist/dependencies.bun.lock +63 -60
  18. package/dist/guest.bundle.js +362 -300
  19. package/dist/owletto/dist/assets/_-CC8cTmRg.js +3 -0
  20. package/dist/owletto/dist/assets/_-ksFp4zVf.js +2 -0
  21. package/dist/owletto/dist/assets/_agentId-DWUFSrVp.js +2 -0
  22. package/dist/owletto/dist/assets/_agentId-MENLoohA.js +2 -0
  23. package/dist/owletto/dist/assets/_automationId-BnHqdXOC.js +2 -0
  24. package/dist/owletto/dist/assets/_connectorKey._connectionId-CefXIqy2.js +2 -0
  25. package/dist/owletto/dist/assets/_connectorKey.index-C1QPGf9E.js +2 -0
  26. package/dist/owletto/dist/assets/_conversationId-DinuPCUp.js +2 -0
  27. package/dist/owletto/dist/assets/{_deploymentId-BuUzGtVL.js → _deploymentId-BeyzVjRm.js} +2 -2
  28. package/dist/owletto/dist/assets/_eventId-3L_qeL_l.js +2 -0
  29. package/dist/owletto/dist/assets/_name-Dgedji78.js +2 -0
  30. package/dist/owletto/dist/assets/_owner-DbrKma4e.js +3 -0
  31. package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +2 -0
  32. package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +2 -0
  33. package/dist/owletto/dist/assets/_slug-ndDr_CUg.js +2 -0
  34. package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +2 -0
  35. package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +2 -0
  36. package/dist/owletto/dist/assets/{accept-invitation-w17IFTtf.js → accept-invitation-CRKbM2Xy.js} +2 -2
  37. package/dist/owletto/dist/assets/activity-route-view-CFLNukhD.js +2 -0
  38. package/dist/owletto/dist/assets/{agent-card-controls-mnTN2AZt.js → agent-card-controls-Be1Okb2C.js} +2 -2
  39. package/dist/owletto/dist/assets/{agent-client-setup-list-Bg3hBfUV.js → agent-client-setup-list-BA8dU_C6.js} +2 -2
  40. package/dist/owletto/dist/assets/agent-connect-pages-CAV-yXus.js +2 -0
  41. package/dist/owletto/dist/assets/agent-editor-form-Bi6WvYX-.js +2 -0
  42. package/dist/owletto/dist/assets/{agent-guardrails-route-BOrCXcAl.js → agent-guardrails-route-DMOjG1D4.js} +2 -2
  43. package/dist/owletto/dist/assets/{agent-loading-shells-Dqcvky-k.js → agent-loading-shells-De_2d8Lr.js} +2 -2
  44. package/dist/owletto/dist/assets/{agent-permissions-matrix-BOo_4r_4.js → agent-permissions-matrix-gZWl6mAe.js} +2 -2
  45. package/dist/owletto/dist/assets/{agent-skill-context-CCdvtlmH.js → agent-skill-context-JLaTamGR.js} +2 -2
  46. package/dist/owletto/dist/assets/{agent-skills-route-BUxIswuq.js → agent-skills-route-DcK41PWj.js} +2 -2
  47. package/dist/owletto/dist/assets/agent-subpage-shell-BBJoyTuC.js +2 -0
  48. package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +6 -0
  49. package/dist/owletto/dist/assets/agents-C-ReckCa.js +2 -0
  50. package/dist/owletto/dist/assets/agents-workbench-CqaKGggb.js +2 -0
  51. package/dist/owletto/dist/assets/app._appId-Cl1fTuIt.js +2 -0
  52. package/dist/owletto/dist/assets/automation-detail-content-BMLL4lxO.js +2 -0
  53. package/dist/owletto/dist/assets/automations-C-ReckCa.js +2 -0
  54. package/dist/owletto/dist/assets/callback-DTKKsfkz.js +2 -0
  55. package/dist/owletto/dist/assets/{card-Djgp00r_.js → card-yU0TmNRH.js} +2 -2
  56. package/dist/owletto/dist/assets/{claim-BYUZnyMp.js → claim-DJfTvlT2.js} +2 -2
  57. package/dist/owletto/dist/assets/client-rows--FrZfJol.js +2 -0
  58. package/dist/owletto/dist/assets/{clients-D3Zbjxin.js → clients-L4K1UT8c.js} +2 -2
  59. package/dist/owletto/dist/assets/{code-editor-DHeyRGZI.js → code-editor-U54Gwjit.js} +2 -2
  60. package/dist/owletto/dist/assets/connect-4zqtnDHb.js +2 -0
  61. package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +2 -0
  62. package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +2 -0
  63. package/dist/owletto/dist/assets/connected._clientId.activity-DTpSW1Xy.js +2 -0
  64. package/dist/owletto/dist/assets/connected._clientId.index-h9X5H1x8.js +2 -0
  65. package/dist/owletto/dist/assets/{connection-C3XXFEqh.js → connection-ByvKkyFm.js} +2 -2
  66. package/dist/owletto/dist/assets/{connection-feed-detail-CIJJLDP8.js → connection-feed-detail-DWM9lTao.js} +2 -2
  67. package/dist/owletto/dist/assets/connections-browser-CEwYrYqt.js +2 -0
  68. package/dist/owletto/dist/assets/{connector-provenance-8-d8hl10.js → connector-provenance-BocTm__v.js} +2 -2
  69. package/dist/owletto/dist/assets/connector-scope-lists-OYDOydtz.js +2 -0
  70. package/dist/owletto/dist/assets/connectors-CyZpcE5f.js +2 -0
  71. package/dist/owletto/dist/assets/{consent-CdSvVCgx.js → consent-DdfINrVp.js} +2 -2
  72. package/dist/owletto/dist/assets/{conversations-table-BdXoZAfc.js → conversations-table-BSznfdYt.js} +2 -2
  73. package/dist/owletto/dist/assets/{core.esm-CYvgWCuv.js → core.esm-Dr7tcIB-.js} +2 -2
  74. package/dist/owletto/dist/assets/create-CBGwASon.js +2 -0
  75. package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +2 -0
  76. package/dist/owletto/dist/assets/create-CwThQtd3.js +2 -0
  77. package/dist/owletto/dist/assets/{create-automation-form-CtSSeYj3.js → create-automation-form-9T5WnoUs.js} +3 -3
  78. package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +2 -0
  79. package/dist/owletto/dist/assets/{cronstrue-n4qGUraE.js → cronstrue-BWFEyy_P.js} +2 -2
  80. package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +2 -0
  81. package/dist/owletto/dist/assets/{deployments-body-BMp7UsMo.js → deployments-body-2xKS8gRo.js} +2 -2
  82. package/dist/owletto/dist/assets/{deployments-RvUdVkj3.js → deployments-wG_8QzOF.js} +2 -2
  83. package/dist/owletto/dist/assets/{device-CPU6CjkJ.js → device-6z-xgsoW.js} +2 -2
  84. package/dist/owletto/dist/assets/device-pin-tombstone-Cwq88RMU.js +2 -0
  85. package/dist/owletto/dist/assets/device._deviceId-BDerBfD9.js +2 -0
  86. package/dist/owletto/dist/assets/entity-avatar-Cc1CuI-0.js +2 -0
  87. package/dist/owletto/dist/assets/entity-options-DHdMC1Lx.js +2 -0
  88. package/dist/owletto/dist/assets/entity-page--OkXmlNP.js +2 -0
  89. package/dist/owletto/dist/assets/entity-type-page-89RoK_-P.js +2 -0
  90. package/dist/owletto/dist/assets/event-detail-D4YZRtrA.js +2 -0
  91. package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +2 -0
  92. package/dist/owletto/dist/assets/filter-editors-B1_QUpg_.js +2 -0
  93. package/dist/owletto/dist/assets/{full-page-spinner-DqpH99np.js → full-page-spinner-Cqih-8IW.js} +2 -2
  94. package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +2 -0
  95. package/dist/owletto/dist/assets/identity-B0nH4yiC.js +2 -0
  96. package/dist/owletto/dist/assets/index-4TSkcsth.js +2 -0
  97. package/dist/owletto/dist/assets/index-BSH07yVD.css +1 -0
  98. package/dist/owletto/dist/assets/index-BgkhXElB.js +2 -0
  99. package/dist/owletto/dist/assets/index-CoW4Bz3w.js +2 -0
  100. package/dist/owletto/dist/assets/index-Codw-Qqi.js +2 -0
  101. package/dist/owletto/dist/assets/{index-BQVliQW1.js → index-DAOyXG1X.js} +2 -2
  102. package/dist/owletto/dist/assets/{index-B9uPN6FC.js → index-DKPwCasf.js} +2 -2
  103. package/dist/owletto/dist/assets/index-DMyXd3bJ.js +2 -0
  104. package/dist/owletto/dist/assets/index-DYCqXaMf.js +7950 -0
  105. package/dist/owletto/dist/assets/index-DYYZLcJ0.js +2 -0
  106. package/dist/owletto/dist/assets/index-DYzWV5_z.js +2 -0
  107. package/dist/owletto/dist/assets/index-Da6CrGEu.js +2 -0
  108. package/dist/owletto/dist/assets/{index-Hio-HRfo.js → index-DfyDUpuI.js} +2 -2
  109. package/dist/owletto/dist/assets/index-DneshLbf.js +2 -0
  110. package/dist/owletto/dist/assets/index-TgRS2v_F.js +2 -0
  111. package/dist/owletto/dist/assets/{index-ICgKp3YK.js → index-ZNlrDc_f.js} +2 -2
  112. package/dist/owletto/dist/assets/{json-diff-DBoag_OS.js → json-diff-DFvYINBT.js} +3 -3
  113. package/dist/owletto/dist/assets/{list-skeleton-C_GuoxAH.js → list-skeleton-DFsEqLU1.js} +2 -2
  114. package/dist/owletto/dist/assets/login-DO0j-AYr.js +2 -0
  115. package/dist/owletto/dist/assets/{logout-CLGgeZB7.js → logout-BmNwoAf7.js} +2 -2
  116. package/dist/owletto/dist/assets/member-scope-gate-B2LrMWBU.js +2 -0
  117. package/dist/owletto/dist/assets/memory-browse-page-Cjpl8EbB.js +103 -0
  118. package/dist/owletto/dist/assets/{model-selector-dAbDgJvx.js → model-selector-TQcA93xm.js} +2 -2
  119. package/dist/owletto/dist/assets/models-D7aED5Sa.js +2 -0
  120. package/dist/owletto/dist/assets/new-BMrFy5Qa.js +2 -0
  121. package/dist/owletto/dist/assets/{new-BkdULx2r.js → new-ByBhteWA.js} +2 -2
  122. package/dist/owletto/dist/assets/new-DWp3deoW.js +2 -0
  123. package/dist/owletto/dist/assets/{oauth-workspace-access-BxsjwgdH.js → oauth-workspace-access-D_5uESuz.js} +2 -2
  124. package/dist/owletto/dist/assets/{organization-gxGeDjIV.js → organization-DTFoYP4V.js} +2 -2
  125. package/dist/owletto/dist/assets/peek-pane-content-DF5iGC3c.js +2 -0
  126. package/dist/owletto/dist/assets/{permissions-aPHaKLec.js → permissions-C_auqxfP.js} +2 -2
  127. package/dist/owletto/dist/assets/proposal-review-shell-DsNiavG_.js +2 -0
  128. package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +2 -0
  129. package/dist/owletto/dist/assets/{recent-D-65Pgu-.js → recent-3d99S2IE.js} +2 -2
  130. package/dist/owletto/dist/assets/record-activity-C9KfBkXb.js +2 -0
  131. package/dist/owletto/dist/assets/record-field-peek-BBZcRuGT.js +2 -0
  132. package/dist/owletto/dist/assets/record-session-BizRugWs.js +2 -0
  133. package/dist/owletto/dist/assets/{reset-password-uX_V6bip.js → reset-password-DqfcSn8M.js} +2 -2
  134. package/dist/owletto/dist/assets/runs-panel-T1ZxTVz6.js +2 -0
  135. package/dist/owletto/dist/assets/runs-table-D_8QlCCN.js +2 -0
  136. package/dist/owletto/dist/assets/schema-value-normalization-CylKX3PK.js +97 -0
  137. package/dist/owletto/dist/assets/settings-B_ClYztB.js +2 -0
  138. package/dist/owletto/dist/assets/settings-DgX1-xo7.js +2 -0
  139. package/dist/owletto/dist/assets/skills-Drw5tcZw.js +2 -0
  140. package/dist/owletto/dist/assets/{source-record-panels-CPyzlfD1.js → source-record-panels-Cg249m1S.js} +2 -2
  141. package/dist/owletto/dist/assets/{use-mention-search-By8RZyKW.js → use-mention-search-BYbFvHbJ.js} +2 -2
  142. package/dist/owletto/dist/assets/view-param-filters-DMSqkN2J.js +2 -0
  143. package/dist/owletto/dist/index.html +2 -2
  144. package/dist/server-main.bundle.mjs +3881 -3215
  145. package/npm-shrinkwrap.json +277 -261
  146. package/package.json +6 -5
  147. package/vendor/connector-sdk/package.json +1 -1
  148. package/vendor/core/dist/agent-policy.js +0 -3
  149. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  150. package/vendor/core/dist/agent-tooling.js +3 -1
  151. package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
  152. package/vendor/core/dist/contracts/agent-settings.js +12 -1
  153. package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
  154. package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
  155. package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
  156. package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
  157. package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
  158. package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
  159. package/vendor/core/dist/contracts/worker/protocol.d.ts +39 -2
  160. package/vendor/core/dist/contracts/worker/protocol.js +24 -1
  161. package/vendor/core/dist/index.d.ts +1 -1
  162. package/vendor/core/dist/index.js +2 -1
  163. package/vendor/core/dist/suggestions.d.ts +15 -2
  164. package/vendor/core/dist/suggestions.js +48 -3
  165. package/vendor/core/dist/types.d.ts +26 -0
  166. package/vendor/core/dist/types.js +5 -0
  167. package/vendor/core/package.json +11 -5
  168. package/vendor/postgres/cf/src/connection.js +18 -0
  169. package/vendor/postgres/cjs/src/connection.js +18 -0
  170. package/vendor/postgres/src/connection.js +18 -0
  171. package/vendor/views/dist/api.d.ts +71 -17
  172. package/vendor/views/dist/api.js +200 -35
  173. package/vendor/views/dist/bridge.d.ts +3 -0
  174. package/vendor/views/dist/bridge.js +9 -1
  175. package/vendor/views/dist/components.d.ts +170 -0
  176. package/vendor/views/dist/components.js +361 -0
  177. package/vendor/views/dist/index.d.ts +1 -1
  178. package/vendor/views/package.json +11 -1
  179. package/dist/owletto/dist/assets/_-3J-IrxWk.js +0 -2
  180. package/dist/owletto/dist/assets/_-DYUE3ix4.js +0 -3
  181. package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +0 -2
  182. package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +0 -2
  183. package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +0 -2
  184. package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +0 -2
  185. package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +0 -2
  186. package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +0 -2
  187. package/dist/owletto/dist/assets/_eventId-B0662F8h.js +0 -2
  188. package/dist/owletto/dist/assets/_name-CwWePlOl.js +0 -2
  189. package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +0 -3
  190. package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +0 -2
  191. package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +0 -2
  192. package/dist/owletto/dist/assets/_slug-DQHutM41.js +0 -2
  193. package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +0 -2
  194. package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +0 -2
  195. package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +0 -2
  196. package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +0 -2
  197. package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +0 -2
  198. package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +0 -2
  199. package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +0 -6
  200. package/dist/owletto/dist/assets/agents-9XjpDj_S.js +0 -2
  201. package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +0 -2
  202. package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +0 -2
  203. package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +0 -2
  204. package/dist/owletto/dist/assets/automations-9XjpDj_S.js +0 -2
  205. package/dist/owletto/dist/assets/callback-BRgcL8gz.js +0 -2
  206. package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +0 -2
  207. package/dist/owletto/dist/assets/connect-CfsFsy9P.js +0 -2
  208. package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +0 -2
  209. package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +0 -2
  210. package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +0 -2
  211. package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +0 -2
  212. package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +0 -2
  213. package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +0 -2
  214. package/dist/owletto/dist/assets/connectors-lvLJ30lo.js +0 -2
  215. package/dist/owletto/dist/assets/create-0xW9eXxG.js +0 -2
  216. package/dist/owletto/dist/assets/create-B0qhrrX4.js +0 -2
  217. package/dist/owletto/dist/assets/create-CAfF-yI1.js +0 -2
  218. package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +0 -2
  219. package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +0 -2
  220. package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +0 -2
  221. package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +0 -2
  222. package/dist/owletto/dist/assets/entity-options-uXjgT7y9.js +0 -2
  223. package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +0 -2
  224. package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +0 -2
  225. package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +0 -2
  226. package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +0 -2
  227. package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +0 -2
  228. package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +0 -2
  229. package/dist/owletto/dist/assets/identity-BigVSBCl.js +0 -2
  230. package/dist/owletto/dist/assets/index-BLEcy9-T.css +0 -1
  231. package/dist/owletto/dist/assets/index-BfedB4Rc.js +0 -2
  232. package/dist/owletto/dist/assets/index-CUw3aKBI.js +0 -2
  233. package/dist/owletto/dist/assets/index-CXhxUkv3.js +0 -2
  234. package/dist/owletto/dist/assets/index-Cr5hwh-C.js +0 -7950
  235. package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +0 -2
  236. package/dist/owletto/dist/assets/index-DKSx8JN_.js +0 -2
  237. package/dist/owletto/dist/assets/index-DVk7Ug0d.js +0 -2
  238. package/dist/owletto/dist/assets/index-DmZuKGf8.js +0 -2
  239. package/dist/owletto/dist/assets/index-cPcroOH0.js +0 -2
  240. package/dist/owletto/dist/assets/index-n7sTbNv4.js +0 -2
  241. package/dist/owletto/dist/assets/index-xiFpcWKv.js +0 -2
  242. package/dist/owletto/dist/assets/login-Ci6ixHuL.js +0 -2
  243. package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +0 -2
  244. package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +0 -103
  245. package/dist/owletto/dist/assets/models-DpVP7ZwX.js +0 -2
  246. package/dist/owletto/dist/assets/new-BUb7AnEW.js +0 -2
  247. package/dist/owletto/dist/assets/new-CHOr-EcI.js +0 -2
  248. package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +0 -2
  249. package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +0 -2
  250. package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +0 -2
  251. package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +0 -2
  252. package/dist/owletto/dist/assets/renderer-mEDnVW0O.js +0 -97
  253. package/dist/owletto/dist/assets/runs-C0rCgGwX.js +0 -2
  254. package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +0 -2
  255. package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +0 -2
  256. package/dist/owletto/dist/assets/settings-9NkNA1G1.js +0 -2
  257. package/dist/owletto/dist/assets/settings-E-10sLQX.js +0 -2
  258. package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +0 -2
  259. package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +0 -2
  260. package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +0 -2
  261. package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.js +0 -2
  262. /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
@@ -0,0 +1,361 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useId, useRef, useState } from "react";
3
+ import { resolveViewHref, useHost } from "./api.js";
4
+ const FONT_STACK = 'var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)';
5
+ const INK = {
6
+ color: "var(--fg, #0a0a0a)",
7
+ fontFamily: FONT_STACK,
8
+ fontSize: 13,
9
+ lineHeight: 1.45,
10
+ };
11
+ /** Section container: title row, optional description and action slot. */
12
+ export function Card({ title, description, actions, children }) {
13
+ return (_jsxs("section", { style: {
14
+ ...INK,
15
+ border: "1px solid var(--border, #e5e7eb)",
16
+ borderRadius: "var(--radius-lg, 8px)",
17
+ padding: "12px 14px",
18
+ background: "transparent",
19
+ }, children: [(title || actions) && (_jsxs("header", { style: {
20
+ display: "flex",
21
+ alignItems: "baseline",
22
+ justifyContent: "space-between",
23
+ gap: 12,
24
+ marginBottom: description || children ? 4 : 0,
25
+ }, children: [title && (_jsx("h3", { style: { margin: 0, fontSize: 14, fontWeight: 600 }, children: title })), actions] })), description && (_jsx("p", { style: { margin: "0 0 8px", color: "var(--muted, #6b7280)" }, children: description })), children] }));
26
+ }
27
+ const CELL = {
28
+ padding: "6px 8px",
29
+ borderBottom: "1px solid var(--border, #e5e7eb)",
30
+ textAlign: "left",
31
+ verticalAlign: "top",
32
+ overflowWrap: "anywhere",
33
+ };
34
+ /**
35
+ * Server-driven table. The view owns state (page/sort live in `useParams`,
36
+ * rows come from `useQuery`); the table only renders and reports intent.
37
+ * Pass query loading/error state explicitly; render TruncatedNotice beside
38
+ * the table when the query reports partial results.
39
+ */
40
+ export function DataTable({ columns, rows, keyOf, loading = false, error = null, onRetry, emptyText = "No rows.", sort, onSort, pagination, caption, }) {
41
+ const labelId = useId();
42
+ const pageCount = pagination && pagination.total != null
43
+ ? Math.max(1, Math.ceil(pagination.total / pagination.pageSize))
44
+ : null;
45
+ return (_jsxs("div", { style: INK, children: [caption && (_jsx("p", { id: labelId, style: { margin: "0 0 6px", color: "var(--muted, #6b7280)" }, children: caption })), _jsx("div", { style: { overflowX: "auto" }, children: _jsxs("table", { "aria-labelledby": caption ? labelId : undefined, style: { borderCollapse: "collapse", width: "100%" }, children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((col) => (_jsx("th", { "aria-sort": sort?.key === col.key
46
+ ? sort.dir === "asc"
47
+ ? "ascending"
48
+ : "descending"
49
+ : undefined, style: {
50
+ ...CELL,
51
+ fontWeight: 600,
52
+ whiteSpace: "nowrap",
53
+ textAlign: col.align ?? "left",
54
+ }, children: col.sortable && onSort ? (_jsxs("button", { type: "button", onClick: () => onSort(col.key), title: `Sort by ${col.header}`, style: {
55
+ border: 0,
56
+ padding: 0,
57
+ background: "transparent",
58
+ font: "inherit",
59
+ cursor: "pointer",
60
+ color: "var(--accent, #2563eb)",
61
+ }, children: [col.header, sort?.key === col.key
62
+ ? sort.dir === "asc"
63
+ ? " ▲"
64
+ : " ▼"
65
+ : ""] })) : (col.header) }, col.key))) }) }), _jsx("tbody", { children: rows.map((row, i) => (_jsx("tr", { children: columns.map((col) => (_jsx("td", { style: { ...CELL, textAlign: col.align ?? "left" }, children: col.render
66
+ ? col.render(row)
67
+ : String(row[col.key] ?? "") }, col.key))) }, keyOf(row, i)))) })] }) }), loading && _jsx(LoadingState, { text: "Loading rows\u2026" }), error && !loading && _jsx(ErrorState, { message: error, onRetry: onRetry }), !loading && !error && rows.length === 0 && (_jsx(EmptyState, { title: emptyText })), pagination &&
68
+ (pageCount == null || pageCount > 1 || pagination.page > 1) && (_jsxs("nav", { "aria-label": "Table pages", style: {
69
+ display: "flex",
70
+ alignItems: "center",
71
+ gap: 8,
72
+ marginTop: 8,
73
+ }, children: [_jsx(PageButton, { disabled: pagination.page <= 1, onClick: () => pagination.onPage(pagination.page - 1), label: "Previous page" }), _jsxs("span", { style: { color: "var(--muted, #6b7280)" }, children: ["Page ", pagination.page, pageCount != null ? ` of ${pageCount}` : ""] }), _jsx(PageButton, { disabled: pageCount == null
74
+ ? rows.length < pagination.pageSize
75
+ : pagination.page >= pageCount, onClick: () => pagination.onPage(pagination.page + 1), label: "Next page" })] }))] }));
76
+ }
77
+ function PageButton({ disabled, onClick, label, }) {
78
+ return (_jsx("button", { type: "button", disabled: disabled, onClick: onClick, "aria-label": label, style: {
79
+ cursor: disabled ? "default" : "pointer",
80
+ opacity: disabled ? 0.45 : 1,
81
+ border: "1px solid var(--border, #e5e7eb)",
82
+ borderRadius: "var(--radius, 6px)",
83
+ background: "transparent",
84
+ color: "var(--fg, #0a0a0a)",
85
+ padding: "2px 10px",
86
+ font: "inherit",
87
+ }, children: label === "Previous page" ? "‹ Prev" : "Next ›" }));
88
+ }
89
+ /* ------------------------------------------------------------------ */
90
+ /* Filters */
91
+ /* ------------------------------------------------------------------ */
92
+ /** Layout row for filter controls; wrap `SearchField`/`SelectField`. */
93
+ export function FilterBar({ children }) {
94
+ return (_jsx("search", { style: {
95
+ display: "flex",
96
+ flexWrap: "wrap",
97
+ alignItems: "end",
98
+ gap: 8,
99
+ marginBottom: 8,
100
+ }, children: children }));
101
+ }
102
+ const FIELD_LABEL = {
103
+ display: "block",
104
+ fontSize: 12,
105
+ color: "var(--muted, #6b7280)",
106
+ marginBottom: 2,
107
+ };
108
+ const FIELD_BOX = {
109
+ border: "1px solid var(--border, #e5e7eb)",
110
+ borderRadius: "var(--radius, 6px)",
111
+ background: "transparent",
112
+ color: "var(--fg, #0a0a0a)",
113
+ padding: "4px 8px",
114
+ font: "inherit",
115
+ maxWidth: "100%",
116
+ };
117
+ /**
118
+ * Controlled search box. The view owns the value (usually a `useParams`
119
+ * entry); pushing every keystroke into params re-renders the whole view, so
120
+ * debounce at the call site when the backing query is expensive.
121
+ */
122
+ export function SearchField({ label = "Search", value, onChange, placeholder = "", }) {
123
+ const id = useId();
124
+ return (_jsxs("label", { style: { ...INK, display: "block" }, children: [_jsx("span", { style: FIELD_LABEL, children: label }), _jsx("input", { id: id, type: "search", value: value, placeholder: placeholder, onChange: (e) => onChange(e.target.value), style: { ...FIELD_BOX, minWidth: 180 } })] }));
125
+ }
126
+ /** Controlled select. `value === ""` means "no filter". */
127
+ export function SelectField({ label, value, options, onChange, }) {
128
+ const id = useId();
129
+ return (_jsxs("label", { style: { ...INK, display: "block" }, children: [_jsx("span", { style: FIELD_LABEL, children: label }), _jsxs("select", { id: id, value: value, onChange: (e) => onChange(e.target.value), style: FIELD_BOX, children: [_jsx("option", { value: "", children: "All" }), options.map((o) => (_jsx("option", { value: o.value, children: o.label }, o.value)))] })] }));
130
+ }
131
+ const CHART_BAR = "var(--accent, #2563eb)";
132
+ const CHART_GRID = "var(--border, #e5e7eb)";
133
+ const CHART_TEXT = "var(--muted, #6b7280)";
134
+ function niceMax(value) {
135
+ if (!Number.isFinite(value) || value <= 0)
136
+ return 1;
137
+ const power = 10 ** Math.floor(Math.log10(value));
138
+ const scaled = value / power;
139
+ const nice = scaled <= 1 ? 1 : scaled <= 2 ? 2 : scaled <= 5 ? 5 : 10;
140
+ return nice * power;
141
+ }
142
+ const CHART_FALLBACK_WIDTH = 320;
143
+ /** Width of the chart's own box, so the SVG draws at its real size instead of
144
+ * letterboxing a fixed viewBox inside a wider card. */
145
+ function useChartWidth() {
146
+ const ref = useRef(null);
147
+ const [width, setWidth] = useState(CHART_FALLBACK_WIDTH);
148
+ useEffect(() => {
149
+ const el = ref.current;
150
+ if (!el || typeof ResizeObserver === "undefined")
151
+ return;
152
+ const observer = new ResizeObserver(([entry]) => {
153
+ const next = Math.round(entry.contentRect.width);
154
+ if (next > 0)
155
+ setWidth(next);
156
+ });
157
+ observer.observe(el);
158
+ return () => observer.disconnect();
159
+ }, []);
160
+ return [ref, width];
161
+ }
162
+ function ChartFrame({ title, width, height, frameRef, children, labelledBy, }) {
163
+ return (_jsxs("figure", { ref: frameRef, style: { ...INK, margin: 0 }, children: [title && (_jsx("figcaption", { id: labelledBy, style: { fontWeight: 600, marginBottom: 4 }, children: title })), _jsx("svg", { role: "img", "aria-labelledby": title ? labelledBy : undefined, "aria-label": title ? undefined : "Chart", viewBox: `0 0 ${width} ${height}`, width: "100%", height: height, style: { display: "block" }, children: children })] }));
164
+ }
165
+ /** Vertical bars. Values must already be aggregated — views cannot aggregate history. */
166
+ export function BarChart({ data, title, height = 180, formatValue = (v) => String(v), }) {
167
+ const id = useId();
168
+ const [frameRef, width] = useChartWidth();
169
+ const max = niceMax(Math.max(0, ...data.map((d) => d.value)));
170
+ const min = Math.min(0, ...data.map((d) => d.value));
171
+ const padL = 44;
172
+ const padB = 22;
173
+ const padT = 6;
174
+ const w = width - padL - 8;
175
+ const h = height - padT - padB;
176
+ const y = (value) => padT + h - ((value - min) / (max - min)) * h;
177
+ const zero = y(0);
178
+ const slot = data.length > 0 ? w / data.length : w;
179
+ const bw = Math.max(2, Math.min(28, slot * 0.6));
180
+ return (_jsxs(ChartFrame, { title: title, width: width, height: height, frameRef: frameRef, labelledBy: id, children: [_jsx("line", { x1: padL, y1: padT, x2: padL, y2: padT + h, stroke: CHART_GRID }), _jsx("line", { x1: padL, y1: zero, x2: padL + w, y2: zero, stroke: CHART_GRID }), _jsx("text", { x: padL - 4, y: padT + 8, textAnchor: "end", fontSize: 9, fill: CHART_TEXT, children: formatValue(max) }), _jsx("text", { x: padL - 4, y: padT + h, textAnchor: "end", fontSize: 9, fill: CHART_TEXT, children: formatValue(min) }), data.map((d, i) => {
181
+ const bh = Math.abs(y(d.value) - zero);
182
+ const x = padL + i * slot + (slot - bw) / 2;
183
+ const top = Math.min(y(d.value), zero);
184
+ return (
185
+ // biome-ignore lint/suspicious/noArrayIndexKey: Stateless marks allow repeated labels at different positions.
186
+ _jsxs("g", { children: [_jsx("title", { children: `${d.label}: ${formatValue(d.value)}` }), _jsx("rect", { x: x, y: top, width: bw, height: bh, fill: d.color ?? CHART_BAR, rx: 2 }), _jsx("text", { x: x + bw / 2, y: padT + h + 12, textAnchor: "middle", fontSize: 9, fill: CHART_TEXT, children: d.label.length > 10 ? `${d.label.slice(0, 9)}…` : d.label })] }, `${d.label}-${i}`));
187
+ })] }));
188
+ }
189
+ /** Y-axis bounds for a line: include zero by default; `auto` fits the data's
190
+ * own range, for a series whose movement is small next to its level. */
191
+ function lineBounds(values, baseline) {
192
+ if (baseline === "zero" || values.length === 0) {
193
+ return {
194
+ min: Math.min(0, ...values),
195
+ max: niceMax(Math.max(0, ...values)),
196
+ };
197
+ }
198
+ const lo = Math.min(...values);
199
+ const hi = Math.max(...values);
200
+ const pad = (hi - lo) * 0.1 || Math.abs(hi) * 0.05 || 1;
201
+ return { min: lo - pad, max: hi + pad };
202
+ }
203
+ /** The end points sit on the plot's edges, so a centred label there spills
204
+ * past the frame; anchor the first and last labels inward instead. */
205
+ function edgeAnchor(i, count) {
206
+ if (count < 2)
207
+ return "middle";
208
+ if (i === 0)
209
+ return "start";
210
+ return i === count - 1 ? "end" : "middle";
211
+ }
212
+ /** Single-series line over ordered labels. */
213
+ export function LineChart({ data, title, height = 180, baseline = "zero", formatValue = (v) => String(v), }) {
214
+ const id = useId();
215
+ const [frameRef, width] = useChartWidth();
216
+ const values = data.map((d) => d.value);
217
+ const { min, max } = lineBounds(values, baseline);
218
+ const padL = 44;
219
+ const padB = 22;
220
+ const padT = 6;
221
+ const w = width - padL - 8;
222
+ const h = height - padT - padB;
223
+ const span = max - min || 1;
224
+ const x = (i) => data.length < 2 ? padL + w / 2 : padL + (i / (data.length - 1)) * w;
225
+ const y = (v) => padT + h - ((v - min) / span) * h;
226
+ const points = data.map((d, i) => `${x(i)},${y(d.value)}`).join(" ");
227
+ return (_jsxs(ChartFrame, { title: title, width: width, height: height, frameRef: frameRef, labelledBy: id, children: [_jsx("line", { x1: padL, y1: padT, x2: padL, y2: padT + h, stroke: CHART_GRID }), _jsx("line", { x1: padL, y1: padT + h, x2: padL + w, y2: padT + h, stroke: CHART_GRID }), _jsx("text", { x: padL - 4, y: padT + 8, textAnchor: "end", fontSize: 9, fill: CHART_TEXT, children: formatValue(max) }), min !== 0 && (_jsx("text", { x: padL - 4, y: padT + h, textAnchor: "end", fontSize: 9, fill: CHART_TEXT, children: formatValue(min) })), data.length > 0 && (_jsx("polyline", { points: points, fill: "none", stroke: CHART_BAR, strokeWidth: 2, strokeLinejoin: "round" })), data.map((d, i) => (
228
+ // biome-ignore lint/suspicious/noArrayIndexKey: Stateless marks allow repeated labels at different positions.
229
+ _jsxs("g", { children: [_jsx("title", { children: `${d.label}: ${formatValue(d.value)}` }), _jsx("circle", { cx: x(i), cy: y(d.value), r: 2.5, fill: CHART_BAR }), data.length <= 8 && (_jsx("text", { x: x(i), y: padT + h + 12, textAnchor: edgeAnchor(i, data.length), fontSize: 9, fill: CHART_TEXT, children: d.label.length > 10 ? `${d.label.slice(0, 9)}…` : d.label }))] }, `${d.label}-${i}`)))] }));
230
+ }
231
+ /** Pie with legend. Cap slices upstream (query limit); the chart renders what it gets. */
232
+ export function PieChart({ data, title, size = 180, formatValue = (v) => String(v), }) {
233
+ const id = useId();
234
+ const total = data.reduce((s, d) => s + (d.value > 0 ? d.value : 0), 0);
235
+ const palette = [
236
+ "#2563eb",
237
+ "#16a34a",
238
+ "#d97706",
239
+ "#dc2626",
240
+ "#7c3aed",
241
+ "#0891b2",
242
+ "#db2777",
243
+ "#65a30d",
244
+ ];
245
+ const r = Math.max(0, Math.min(70, size / 2 - 2));
246
+ const cx = 80;
247
+ const cy = size / 2;
248
+ let angle = -Math.PI / 2;
249
+ const slices = data.map((d, i) => {
250
+ const frac = total > 0 ? Math.max(0, d.value) / total : 0;
251
+ const a0 = angle;
252
+ angle += frac * Math.PI * 2;
253
+ const large = frac > 0.5 ? 1 : 0;
254
+ const x0 = cx + r * Math.cos(a0);
255
+ const y0 = cy + r * Math.sin(a0);
256
+ const x1 = cx + r * Math.cos(angle);
257
+ const y1 = cy + r * Math.sin(angle);
258
+ return {
259
+ d,
260
+ i,
261
+ frac,
262
+ path: `M ${cx} ${cy} L ${x0} ${y0} A ${r} ${r} 0 ${large} 1 ${x1} ${y1} Z`,
263
+ };
264
+ });
265
+ return (_jsxs("figure", { style: { ...INK, margin: 0 }, children: [title && (_jsx("figcaption", { id: id, style: { fontWeight: 600, marginBottom: 4 }, children: title })), _jsxs("div", { style: {
266
+ display: "flex",
267
+ flexWrap: "wrap",
268
+ alignItems: "center",
269
+ gap: 12,
270
+ }, children: [_jsx("svg", { role: "img", "aria-labelledby": title ? id : undefined, "aria-label": title ? undefined : "Pie chart", viewBox: `0 0 160 ${size}`, width: 160, height: size, style: { flexShrink: 0 }, children: total === 0 ? (_jsx("circle", { cx: cx, cy: cy, r: r, fill: "none", stroke: CHART_GRID })) : (slices.map((s) => s.frac === 1 ? (_jsx("circle", { cx: cx, cy: cy, r: r, fill: s.d.color ?? palette[s.i % palette.length], children: _jsx("title", { children: `${s.d.label}: ${formatValue(s.d.value)}` }) }, s.i)) : (_jsx("path", { d: s.path, fill: s.d.color ?? palette[s.i % palette.length], children: _jsx("title", { children: `${s.d.label}: ${formatValue(s.d.value)}` }) }, s.i)))) }), _jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: data.map((d, i) => (_jsxs("li", { style: {
271
+ display: "flex",
272
+ alignItems: "center",
273
+ gap: 6,
274
+ marginBottom: 2,
275
+ }, children: [_jsx("span", { "aria-hidden": "true", style: {
276
+ width: 10,
277
+ height: 10,
278
+ borderRadius: 2,
279
+ background: d.color ?? palette[i % palette.length],
280
+ flexShrink: 0,
281
+ } }), _jsxs("span", { children: [d.label, ": ", formatValue(d.value)] })] }, `${d.label}-${i}`))) })] })] }));
282
+ }
283
+ /** Single-series inline trend. Purely presentational — no axes. */
284
+ export function Sparkline({ values, width = 120, height = 32, label, }) {
285
+ const max = Math.max(0, ...values);
286
+ const min = Math.min(0, ...values);
287
+ const span = max - min || 1;
288
+ const x = (i) => values.length < 2 ? width / 2 : (i / (values.length - 1)) * width;
289
+ const y = (v) => height - 2 - ((v - min) / span) * (height - 4);
290
+ return (_jsxs("svg", { role: "img", "aria-label": label ?? "Trend", viewBox: `0 0 ${width} ${height}`, width: width, height: height, style: { display: "block" }, children: [values.length === 1 && (_jsx("circle", { cx: x(0), cy: y(values[0]), r: 1.5, fill: CHART_BAR })), values.length > 1 && (_jsx("polyline", { points: values.map((v, i) => `${x(i)},${y(v)}`).join(" "), fill: "none", stroke: CHART_BAR, strokeWidth: 1.5, strokeLinejoin: "round" }))] }));
291
+ }
292
+ /* ------------------------------------------------------------------ */
293
+ /* Link */
294
+ /* ------------------------------------------------------------------ */
295
+ /**
296
+ * A link the host opens: `href="deal/acme-renewal"` opens that record
297
+ * (relative links resolve against the workspace root, see
298
+ * `useHost().openLink`), a full URL opens a new tab. The sandboxed frame
299
+ * cannot navigate itself, so every click goes through the host, modifier
300
+ * clicks included; the anchor still shows the resolved address on hover.
301
+ */
302
+ export function Link({ href, children, }) {
303
+ const { openLink } = useHost();
304
+ const open = (event) => {
305
+ event.preventDefault();
306
+ openLink(href).catch((error) => console.error("[lobu-views] link not opened", error));
307
+ };
308
+ return (_jsx("a", { href: resolveViewHref(href), onClick: open, onAuxClick: (event) => {
309
+ if (event.button === 1)
310
+ open(event);
311
+ }, style: { color: "var(--accent, #2563eb)", textDecoration: "none" }, children: children }));
312
+ }
313
+ /* ------------------------------------------------------------------ */
314
+ /* Query states — render `useQuery` honestly */
315
+ /* ------------------------------------------------------------------ */
316
+ export function LoadingState({ text = "Loading…" }) {
317
+ return (_jsx("p", { role: "status", style: { ...INK, color: "var(--muted, #6b7280)" }, children: text }));
318
+ }
319
+ export function EmptyState({ title, hint }) {
320
+ return (_jsxs("div", { style: { ...INK, color: "var(--muted, #6b7280)" }, children: [_jsx("p", { style: { margin: "4px 0" }, children: title }), hint && _jsx("p", { style: { margin: "0 0 4px", fontSize: 12 }, children: hint })] }));
321
+ }
322
+ export function ErrorState({ message, errorCode, onRetry, }) {
323
+ return (_jsxs("div", { role: "alert", style: {
324
+ ...INK,
325
+ border: "1px solid var(--border, #e5e7eb)",
326
+ borderRadius: "var(--radius, 6px)",
327
+ padding: "8px 10px",
328
+ }, children: [_jsx("p", { style: { margin: "0 0 4px" }, children: message }), errorCode && (_jsxs("p", { style: {
329
+ margin: "0 0 4px",
330
+ fontSize: 12,
331
+ color: "var(--muted, #6b7280)",
332
+ }, children: ["Code: ", errorCode] })), onRetry && (_jsx("button", { type: "button", onClick: onRetry, style: {
333
+ cursor: "pointer",
334
+ border: "1px solid var(--border, #e5e7eb)",
335
+ borderRadius: "var(--radius, 6px)",
336
+ background: "transparent",
337
+ color: "var(--fg, #0a0a0a)",
338
+ padding: "2px 10px",
339
+ font: "inherit",
340
+ }, children: "Retry" }))] }));
341
+ }
342
+ /**
343
+ * Honest cap notice: the server answered, but not wholly (`query_sql` 500-row
344
+ * ceiling, `query_sdk` oversized return). Rendered data is partial by
345
+ * construction — narrow the query instead of treating it as complete.
346
+ */
347
+ export function TruncatedNotice({ shown, total, }) {
348
+ return (_jsxs("p", { style: { ...INK, color: "var(--muted, #6b7280)", fontSize: 12 }, children: ["Showing ", shown, total != null ? ` of ${total}` : "", " rows \u2014 refine filters to see the rest."] }));
349
+ }
350
+ /** Format large counts compactly (1.2K, 3.4M). Plain numbers pass through. */
351
+ export function formatCompact(value) {
352
+ if (!Number.isFinite(value))
353
+ return String(value);
354
+ const abs = Math.abs(value);
355
+ if (abs >= 1_000_000)
356
+ return `${(value / 1_000_000).toFixed(1)}M`;
357
+ if (abs >= 1_000)
358
+ return `${(value / 1_000).toFixed(1)}K`;
359
+ return String(value);
360
+ }
361
+ //# sourceMappingURL=components.js.map
@@ -9,5 +9,5 @@ export type { AttributeFilter, CollectionSelection, } from "@lobu/core/contracts
9
9
  export { ViewBridge } from "./bridge.js";
10
10
  export type { BridgeOptions, HostContext, ToolResult, ViewHandoff, } from "./bridge.js";
11
11
  export { coerceParams, defaultsFor, defineView, escapeLiteral, mintInteractionId, mountView, Provider, sql, tool, useAction, useHost, useParams, useQuery, useScope, } from "./api.js";
12
- export type { ActionResult, Attachment, MountOptions, ParamDef, Params, ParamValue, QueryState, Scope, SqlQuery, ToolQuery, ViewDefinition, } from "./api.js";
12
+ export type { ActionResult, Attachment, Container, DisplayMode, MountOptions, ParamDef, Params, ParamValue, QueryOptions, QueryState, Scope, SqlQuery, ToolQuery, ViewDefinition, } from "./api.js";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/views",
3
- "version": "23.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "Authoring runtime for Lobu views — React modules rendered in the sandboxed MCP Apps frame",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,6 +15,16 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "default": "./dist/index.js"
17
17
  }
18
+ },
19
+ "./components": {
20
+ "import": {
21
+ "types": "./dist/components.d.ts",
22
+ "default": "./dist/components.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/components.d.ts",
26
+ "default": "./dist/components.js"
27
+ }
18
28
  }
19
29
  },
20
30
  "files": [
@@ -1,2 +0,0 @@
1
- import{c1 as t,j as p,c2 as m}from"./index-Cr5hwh-C.js";import{A as e}from"./activity-route-view-CMqYiiKM.js";import"./record-activity-CBXH6v1d.js";import"./filter-editors-Cj-v6NtH.js";import"./connection-label-BobuYiAG.js";import"./runs-C0rCgGwX.js";import"./source-record-panels-CPyzlfD1.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.js";import"./client-rows-EJSKR6z1.js";import"./agent-loading-shells-Dqcvky-k.js";import"./member-scope-gate-B44INDPY.js";import"./public-shell-ready-DcnlADmj.js";function E(){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{E as component};
2
- //# sourceMappingURL=_-3J-IrxWk.js.map
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entity-page-Dc0LGr5U.js","assets/index-Cr5hwh-C.js","assets/index-BLEcy9-T.css","assets/record-activity-CBXH6v1d.js","assets/filter-editors-Cj-v6NtH.js","assets/connection-label-BobuYiAG.js","assets/runs-C0rCgGwX.js","assets/source-record-panels-CPyzlfD1.js","assets/events-feed-BtvhZF1f.js","assets/conversations-table-BdXoZAfc.js","assets/renderer-mEDnVW0O.js","assets/card-Djgp00r_.js","assets/clients-D3Zbjxin.js","assets/client-rows-EJSKR6z1.js","assets/agent-loading-shells-Dqcvky-k.js","assets/member-scope-gate-B44INDPY.js","assets/tabs-DqIIkCX-.js","assets/view-param-filters-CqLZQrnO.js","assets/app-bridge-BCm4muqj.js"])))=>i.map(i=>d[i]);
2
- import{ak as x,al as m,am as p,an as y,g as j,h as g,j as e,r as P,ao as R,l as f,_ as v}from"./index-Cr5hwh-C.js";import{P as r}from"./public-shell-ready-DcnlADmj.js";const E=f(async()=>({default:(await v(async()=>{const{EntityPage:s}=await import("./entity-page-Dc0LGr5U.js");return{EntityPage:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).EntityPage}));function l(){return e.jsx("div",{"data-public-loading":"true",children:e.jsx(R,{})})}function S(){const{owner:s,_splat:c}=x.useParams(),a=m(c||""),d=a?.viewKey,{path:u}=p(s,a?.entityPath),{data:t,isLoading:n,error:i}=y(u,{slug:s},{includeBootstrap:!0}),{session:h,isReady:o}=j();return g({active:!n&&o&&!h&&(!!i||!t),owner:s}),n||!o&&!t?e.jsx(l,{}):i||!t||!t.entity?e.jsxs(e.Fragment,{children:[e.jsx(r,{}),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."})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(r,{}),e.jsx(P.Suspense,{fallback:e.jsx(l,{}),children:e.jsx(E,{namespace:t.workspace,path:t.path,entity:t.entity,viewKey:d})})]})}export{S as component};
3
- //# sourceMappingURL=_-DYUE3ix4.js.map
@@ -1,2 +0,0 @@
1
- import{gM as r,j as e}from"./index-Cr5hwh-C.js";import{A as n}from"./agents-workbench-Bt5QCYQ7.js";import"./agent-editor-form-hTs7eO_U.js";import"./model-selector-dAbDgJvx.js";import"./proposal-review-shell-UcZr87_Q.js";import"./runs-C0rCgGwX.js";function c(){const{owner:o,agentId:t}=r.useParams();return e.jsx(n,{owner:o,agentId:t})}export{c as component};
2
- //# sourceMappingURL=_agentId-Bn2IAjIy.js.map
@@ -1,2 +0,0 @@
1
- import{m as S,fP as P,r as u,fQ as L,j as n,P as w,fR as b,g as D,t as R,aZ as E,aQ as M,ba as N,cc as O,fS as Q,fT as $,bm as B,v as z}from"./index-Cr5hwh-C.js";import{L as F,A as H}from"./agent-thread-BJOijbT0.js";import{A as U,C as W}from"./agent-loading-shells-Dqcvky-k.js";import"./app-bridge-BCm4muqj.js";import"./use-mention-search-By8RZyKW.js";import"./index-Vcq4gwWv.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.js";function Z({owner:t,agent:s,threadId:e,afterMessagesContent:d,className:r,initialDraft:p,newChatRequested:m=!1,preventAutoNavigate:h}){const o=S(),i=s.agentId,{data:a=[]}=P(i,{orgSlug:t}),[l,x]=u.useState(()=>L()),[g,A]=u.useState(null);u.useEffect(()=>{!m||e||(x(L()),A(null),o({to:".",search:(f=>{const{new:C,...k}=f;return k}),replace:!0}))},[m,e,o]);const v=u.useMemo(()=>!g||a.some(f=>f.id===g.id)?a:[g,...a],[a,g]),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=b(t,i,c);o({...f,replace:!0})},[v,c,o,t,i]),y=u.useCallback(()=>{T&&!h&&j()},[T,j,h]);return n.jsx("div",{className:w("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(F,{agentId:i,workspaceSlug:t,thread:c,loadHistory:!!e,onFirstUserMessage:y,initialDraft:p,children:n.jsx(H,{afterMessagesContent:d})},`${i}:${c}`)})})}function _({owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:p,preventAutoNavigate:m}){const{isAuthenticated:h}=D(),{isMember:o,isLoading:i}=R(),a=h&&o,{data:l=[],isLoading:x}=E({enabled:a}),g=s??null,A=l.find(c=>c.agentId===g)??null;return a&&x||i?n.jsx(U,{}):A?n.jsx(Z,{owner:t,agent:A,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:p,preventAutoNavigate:m,className:"min-h-0 flex-1 overflow-hidden"}):n.jsx(M,{icon:N,title:"Agent not found",description:"This agent may have been removed."})}function q(t){return[...t].sort((s,e)=>e.updatedAt-s.updatedAt)[0]}function G({owner:t,agentId:s,threadId:e,initialDraft:d,forceComposer:r=!1,newChatRequested:p=!1,afterMessagesContent:m,preventAutoNavigate:h}){const o=S(),{data:i=[],isLoading:a}=O(Q(t,s,{strict:!1})),l=u.useMemo(()=>q(i),[i]);return u.useEffect(()=>{if(e||r||a||!l)return;const x=b(t,s,l.id);o({...x,replace:!0})},[s,a,l,o,t,e,r]),!e&&!r&&(a||l)?n.jsx(W,{}):n.jsx(_,{owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:p,afterMessagesContent:m,preventAutoNavigate:h})}function ie(){const{owner:t,agentId:s}=$.useParams(),{threadId:e}=B({strict:!1}),{new:d,prompt:r}=z({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(G,{owner:t,agentId:s,threadId:e,initialDraft:r,forceComposer:!e,newChatRequested:!!d})})})}export{ie as component};
2
- //# sourceMappingURL=_agentId-Cam7Z0N7.js.map
@@ -1,2 +0,0 @@
1
- import{m as N,k,an as A,g as L,t as C,dG as b,j as t,B as n,gj as y,ba as D,S as R,L as _,b8 as $,gD as u,ah as O}from"./index-Cr5hwh-C.js";import{A as z}from"./automation-detail-content-vUwVumXf.js";import"./create-automation-form-CtSSeYj3.js";import"./cronstrue-n4qGUraE.js";import"./entity-options-uXjgT7y9.js";import"./connection-label-BobuYiAG.js";import"./model-selector-dAbDgJvx.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-DHeyRGZI.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-By8RZyKW.js";import"./proposal-review-shell-UcZr87_Q.js";import"./runs-C0rCgGwX.js";import"./json-diff-DBoag_OS.js";import"./deployments-RvUdVkj3.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.js";function P({owner:a,automationId:e,view:o,runId:s}){const r=N(),{orgContext:p,hasOrgContext:x}=k(),{data:g,isLoading:m}=A(`/${a}`,p),{isAuthenticated:h}=L(),{isLoading:c}=C(),f=g?.workspace?.id??"",v=h?!x||m||c:m||c,i=b(e,void 0,f).data?.automation,j=i?.automation_name??"Automation",d=()=>void r({to:"/$owner/automations",params:{owner:a}}),l=()=>void r({to:"/$owner/automations/$automationId",params:{owner:a,automationId:e},search:{view:"activity",run_id:void 0}}),w=!s&&o==="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:d,children:[t.jsx(y,{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(D,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),v&&!i?t.jsx(R,{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:l,children:"Done"}):t.jsx(n,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 gap-1.5",children:t.jsxs(_,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:e},search:{view:"definition",run_id:void 0},children:[t.jsx($,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx(z,{owner:a,agentId:i?.managed_agent_id??null,automationId:e,view:o,runId:s,onDone:s?d:l})]})})}function ot(){const{owner:a,automationId:e}=u.useParams(),o=u.useSearch();return t.jsx(O,{owner:a,children:()=>t.jsx(P,{owner:a,automationId:e,view:o.view,runId:o.run_id})})}export{ot as component};
2
- //# sourceMappingURL=_automationId-CXEiKVZJ.js.map
@@ -1,2 +0,0 @@
1
- import{i7 as I,j as e,ah as z,m as G,az as q,cN as J,cL as Q,ct as X,S as A,B as Y,L as p,aA as Z,hT as K,hU as ee,aO as ne,fN as u,hO as se,fL as ae,aV as te,hD as oe,fM as ce,h0 as E,aI as ie,w as re}from"./index-Cr5hwh-C.js";import{R as de,c as le,C as me}from"./device-pin-tombstone-CrjG7gPo.js";import{a as pe}from"./connector-provenance-8-d8hl10.js";import{f as he,C as ue,F as xe,a as fe,b as ve,A as je,c as Ce}from"./connection-feed-detail-CIJJLDP8.js";import{S as Ne,g as De}from"./runs-table-syPJ6r6T.js";import{c as $e}from"./connection-label-BobuYiAG.js";import"./runs-panel-Du1JMjg5.js";import"./runs-C0rCgGwX.js";import"./filter-editors-Cj-v6NtH.js";import"./connector-scope-lists-CadPVsI3.js";import"./status-dot-B-EWMgq6.js";import"./entity-options-uXjgT7y9.js";function Me(){const{owner:l,connectorKey:n,connectionId:v}=I.useParams(),{addFeed:t,feedId:i,settings:x,auth_result:o}=I.useSearch();return e.jsx(z,{owner:l,children:m=>e.jsx(ge,{organizationId:m.organizationId,ownerSlug:m.ownerSlug,isWorkspaceLoading:m.isWorkspaceLoading,connectorKey:n,connectionId:Number(v),showAddFeed:t===!0,feedId:i,openSettings:x===!0,authResult:o})})}function ge({organizationId:l,ownerSlug:n,isWorkspaceLoading:v,connectorKey:t,connectionId:i,showAddFeed:x,feedId:o,openSettings:m,authResult:R}){const y=G(),{data:B=[]}=q(),{data:M=[],isLoading:T,isError:j,refetch:O}=J(l??"",{connectorKey:t,connectionIds:[i]}),{data:$=[]}=Q(l??""),{data:P=[],isLoading:W,isError:S,refetch:H}=X(o?i:null),s=M.find(c=>c.id===i),a=$.find(c=>c.key===t),r=o?P.find(c=>c.id===o):null;if(v||T||o&&W||!l)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(A,{className:"h-7 w-56"}),e.jsx(A,{className:"h-4 w-24"})]}),e.jsx(de,{})]});if(j||o&&S)return e.jsxs("div",{role:"alert",className:"space-y-2",children:[e.jsxs("p",{children:["Could not load this ",j?"connection":"feed","."]}),e.jsx(Y,{variant:"outline",size:"sm",onClick:()=>void(j?O():H()),children:"Retry"})]});if(!s)return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connection not found."}),e.jsxs(p,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},className:"mt-2 inline-block text-sm text-primary hover:underline",children:["Back to ",a?.name??t]})]});const g=$e({...s,connector_name:s.connector_name??a?.name??null}),C=!o&&!x,V=()=>void y({to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:n,connectorKey:t,connectionId:String(i)},search:{},replace:!0});let h,f=g,w,_,N;o?r?(f=he(r,a),r.store==="channel_messages"?(h=e.jsx(ue,{feed:r,hideHeader:!0}),N="chat channel"):(w=e.jsx(xe,{feed:r,ownerSlug:n}),_=e.jsx(fe,{feed:r}),h=e.jsx(ve,{feed:r,connectorDef:a,ownerSlug:n}))):(h=e.jsx("p",{className:"text-sm text-muted-foreground",children:"Feed not found."}),f="Feed"):x&&(h=e.jsx(je,{onClose:V,organizationId:l,connections:[s],connectorDefinitions:$}),f="Add feed",N=Ce);const d=B.find(c=>c.id===s.device_worker_id&&Z(c,n)),k=d?K(d):void 0,D=k?ee(n,k,ne()):void 0,F=[e.jsx(p,{to:"/$owner/connectors",params:{owner:n},className:u,children:"Connectors"},"connectors"),...d&&D?[e.jsx(p,{to:"/$owner/connectors/app/$appId",params:{owner:n,appId:D.id},className:u,children:D.name},"app"),e.jsx(p,{to:"/$owner/connectors/device/$deviceId",params:{owner:n,deviceId:d.id},className:u,children:se(d)},"device")]:[e.jsx(p,{to:"/$owner/connectors/$connectorKey",params:{owner:n,connectorKey:t},search:{},className:u,children:a?.name??t},"connector")]];C||F.push(e.jsx(p,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:n,connectorKey:t,connectionId:String(i)},search:{},className:u,children:g},"connection"));const L=C?le(s):null,U=N??L??void 0,b=e.jsx(ae,{breadcrumb:e.jsx(ce,{crumbs:F}),icon:a?e.jsx(te,{icon:a.icon,name:a.name,faviconDomain:a.favicon_domain??oe(a.auth_schema)}):null,title:f,status:w??e.jsx(Ne,{status:De(s.status),showDot:!0,children:s.status}),meta:_,caption:U,captionTone:L?"error":"muted"});return C?d&&a&&ie(a)?e.jsx(re,{to:"/$owner/connectors/device/$deviceId",params:{owner:n,deviceId:d.id},search:{connection:s.id,settings:m||void 0},hash:`connection-${s.id}`,replace:!0}):e.jsxs(E,{header:b,children:[e.jsx(pe,{connectorDef:a,connectorKey:t,ownerSlug:n,deviceWorkerId:s.device_worker_id,deviceLabel:s.device_label}),e.jsx(me,{embedded:!0,connection:s,connectorDef:a,ownerSlug:n,openSettings:m,authResult:R},s.id)]}):e.jsx(E,{header:b,children:e.jsx("div",{className:"mt-0",children:h})})}export{Me as component};
2
- //# sourceMappingURL=_connectorKey._connectionId-CS85l61t.js.map
@@ -1,2 +0,0 @@
1
- import{aw as Pe,ax as De,ay as Ee,aG as me,aD as ae,g_ as ls,g$ as os,j as e,h0 as le,B as g,L as K,aF as he,fL as oe,fM as ce,fN as X,h1 as cs,Z as ds,h2 as te,r as p,h3 as we,h4 as Fe,cb as us,h5 as Ae,bH as Y,h6 as _e,y as $,bn as Le,bo as Re,bp as Oe,bq as Be,br as Ke,gT as ms,I as F,by as H,a1 as V,A as Se,h7 as hs,h8 as xs,bc as ps,h9 as fs,a_ as xe,ha as gs,hb as js,hc as Ue,hd as Ie,he as ze,ae as ne,M as U,b7 as de,hf as vs,eW as ys,hg as Ns,eq as Z,hh as bs,S as D,hi as B,g as Cs,hj as ks,hk as ws,hl as As,hm as _s,hn as Ss,ho as $s,hp as Ps,hq as Ds,bP as se,hr as Es,hs as Fs,bO as Ls,dL as Rs,gA as Os,P as re,dM as Bs,bS as Ks,cy as Me,ht as Q,hu as Us,ah as Is,hv as Te,av as ie,u as qe,hw as Ve,aJ as zs,hx as We,hy as Ms,hz as Ye,hA as Ts,dN as qs,au as Vs,cN as Ws,aR as Ys,aB as M,hB as Xe,m as G,aW as Ge,aV as pe,aS as Xs,hC as Gs,hD as Hs}from"./index-Cr5hwh-C.js";import{C as Qs,a as He}from"./connections-browser-CKZjzRz6.js";import{C as Zs}from"./connector-provenance-8-d8hl10.js";import{R as Js}from"./runs-panel-Du1JMjg5.js";import"./status-dot-B-EWMgq6.js";import"./connection-label-BobuYiAG.js";import"./runs-C0rCgGwX.js";import"./filter-editors-Cj-v6NtH.js";import"./runs-table-syPJ6r6T.js";function et({ownerSlug:s,familyKind:t,familyId:a}){const n=t==="inference",r=Pe({enabled:n}),i=De({enabled:n}),h=Ee({enabled:!n}),o=n?r:h,l=n?i.data?.find(c=>c.slug===a)?.displayName??a:me(a),x=(n?(r.data??[]).filter(c=>c.kind===a).map(c=>({key:`${ae}${c.slug}`,name:c.displayName||c.slug,status:[c.isDefault?"Default":null,c.status].filter(Boolean).join(" · ")})):(h.data?.sandboxes??[]).filter(c=>c.providerKind===a).map(c=>({key:`${ls}${c.id}`,name:c.name,status:c.connected?"Connected":"Needs credentials"}))).map(c=>({id:c.key,name:c.name,description:c.status,tone:null,link:os({to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:c.key},search:{}})})),u=`${n?ae:he}${a}`;return e.jsx(le,{header:e.jsx(oe,{title:l,breadcrumb:e.jsx(ce,{crumbs:[e.jsx(K,{to:"/$owner/connectors",params:{owner:s},className:X,children:"Connectors"},"connectors")]})}),children:e.jsx(Qs,{entries:x,isLoading:o.isLoading,isError:o.isError,onRetry:()=>void o.refetch(),action:e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:n?e.jsx(K,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:u},search:{addAccount:!0},children:"Add connection"}):e.jsx(K,{to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:u},children:"Add connection"})})})})}function st({catalog:s,initialProvider:t,initialSlug:a,allowOAuth:n=!0,initialModel:r,onDone:i}){const h=cs(),o=ds(),l=s.find(d=>d.slug===t)??s[0],x=n&&l&&te(l)?"oauth":"api-key",[u,c]=p.useState(l?.slug??""),[j,N]=p.useState(a??l?.slug??""),[m,y]=p.useState(l?.displayName??""),[b,P]=p.useState(l?.baseUrl??""),[w,k]=p.useState(r??l?.defaultModel??""),[E,_]=p.useState(""),[z,R]=p.useState(l?.apiKeyPlaceholder??""),[I,O]=p.useState(x),[v,f]=p.useState(""),[A,W]=p.useState(null),[T,q]=p.useState(!1),[fe,ge]=p.useState(!1),C=s.find(d=>d.slug===u),J=we(C?.modalities??[]),je=n&&!!C&&te(C),ve=C?Fe(C):!1,ye=je&&I==="oauth",Ne=ve&&!ye,L=us().slug,ee=p.useCallback(()=>{ge(!0),o.invalidateQueries({queryKey:["inference-providers"]})},[o]),Je=p.useCallback(()=>{o.invalidateQueries({queryKey:["inference-providers"]}),i()},[o,i]),es=p.useCallback(async()=>{if(!(!L||!C)){q(!0);try{const d=await Ae(L,C.slug);if(d.mode!=="redirect")throw new Error("Unexpected sign-in mode");window.open(d.authorizeUrl,"_blank","noreferrer")}catch(d){Y.error(d instanceof Error?d.message:"Failed to start sign-in")}finally{q(!1)}}},[L,C]),ss=p.useCallback(async()=>{if(!(!L||!C||!v.trim())){q(!0);try{const d=await _e(L,C.slug,{code:v.trim()});if(d.status!=="success")throw new Error(d.error||"Sign-in not complete");ee(),Y.success(`Signed in with ${C.displayName}`)}catch(d){Y.error(d instanceof Error?d.message:"Failed to complete sign-in")}finally{q(!1)}}},[L,C,v,ee]),ts=p.useCallback(async()=>{if(!(!L||!C)){q(!0);try{const d=await Ae(L,C.slug);if(d.mode!=="device")throw new Error("Unexpected sign-in mode");W({userCode:d.userCode,deviceAuthId:d.deviceAuthId,verificationUrl:d.verificationUrl}),window.open(d.verificationUrl,"_blank","noreferrer")}catch(d){Y.error(d instanceof Error?d.message:"Failed to start sign-in")}finally{q(!1)}}},[L,C]),as=p.useCallback(async()=>{if(!(!L||!C||!A)){q(!0);try{const d=await _e(L,C.slug,{deviceAuthId:A.deviceAuthId,userCode:A.userCode});if(d.status==="success"){ee(),Y.success(`Signed in with ${C.displayName}`);return}W(S=>S&&{...S,message:d.error||"Waiting for approval..."})}catch(d){Y.error(d instanceof Error?d.message:"Failed to check status")}finally{q(!1)}}},[L,C,A,ee]),ns=C?.supportedAuthTypes.includes("device-code")??!1,rs=d=>{c(d);const S=s.find(ue=>ue.slug===d);S&&(N(S.slug),y(S.displayName),P(S.baseUrl),k(S.slug===t&&r?r:S.defaultModel??""),R(S.apiKeyPlaceholder),O(n&&te(S)?"oauth":"api-key"),f(""),W(null),ge(!1))},be=/^[a-z0-9][a-z0-9-]*$/.test(j),Ce=be&&Ne&&E.trim().length>0&&!h.isPending,is=d=>{if(d.preventDefault(),!Ce)return;const S={};b.trim()&&(S.base_url=b.trim()),w.trim()&&(S.model=w.trim());const ue=Object.keys(S).length>0?{text:S}:void 0;h.mutate({slug:j.trim(),kind:u,displayName:m.trim()||void 0,apiKey:E.trim(),capabilities:ue},{onSuccess:()=>i()})},ke=!!(t&&s.some(d=>d.slug===t));return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:ke&&C?`Connect ${C.displayName}`:"Add an inference provider"}),e.jsxs("form",{onSubmit:is,className:"grid max-w-md gap-3",children:[ke&&C?e.jsx("p",{className:"text-xs text-muted-foreground",children:J.length>0?`Serves text, plus ${J.join(", ").toLowerCase()}.`:"Serves text (chat)."}):e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"ip-provider",children:"Provider"}),e.jsxs(Le,{value:u,onValueChange:rs,children:[e.jsx(Re,{id:"ip-provider",className:"w-full",children:e.jsx(Oe,{})}),e.jsx(Be,{children:s.map(d=>{const S=we(d.modalities);return e.jsx(Ke,{value:d.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[d.iconUrl?e.jsx("img",{src:d.iconUrl,alt:"",className:"h-4 w-4 shrink-0 rounded-sm",loading:"lazy"}):e.jsx(ms,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),d.displayName,S.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",S.join(", ")]}):null]})},d.slug)})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:J.length>0?`Serves text, plus ${J.join(", ").toLowerCase()}.`:"Serves text (chat)."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"ip-display",children:"Name"}),e.jsx(F,{id:"ip-display",placeholder:"Friendly name",value:m,onChange:d=>y(d.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs($,{htmlFor:"ip-slug",children:["Slug ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(F,{id:"ip-slug",placeholder:"my-provider",value:j,onChange:d=>N(d.target.value),autoComplete:"off",required:!0}),j&&!be?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."})]}),je&&ve?e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{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:I==="oauth"?"secondary":"ghost",onClick:()=>O("oauth"),children:"Sign in"}),e.jsx(g,{type:"button",size:"sm",variant:I==="api-key"?"secondary":"ghost",onClick:()=>O("api-key"),children:"API key"})]})]}):null,Ne?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"ip-base-url",children:"Base URL"}),e.jsx(F,{id:"ip-base-url",placeholder:"https://api.example.com/v1",value:b,onChange:d=>P(d.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($,{htmlFor:"ip-model",children:"Default model"}),e.jsx(F,{id:"ip-model",placeholder:"gpt-4o-mini",value:w,onChange:d=>k(d.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs($,{htmlFor:"ip-key",children:["API key ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(F,{id:"ip-key",type:"password",placeholder:z||void 0,value:E,onChange:d=>_(d.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(H,{onCancel:i,children:e.jsx(g,{type:"submit",disabled:!Ce,children:h.isPending?e.jsxs(e.Fragment,{children:[e.jsx(V,{size:"lg",className:"mr-2"}),"Creating..."]}):"Create provider"})})]}):ye?e.jsxs("div",{className:"grid gap-3",children:[fe?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Signed in with ",C?.displayName??"provider",". This covers your agents in this org."]}):ns?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void ts(),disabled:T||!L,children:A?"Get a new code":"Get device code"}),A?e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"ip-device-code",children:"Device code"}),e.jsx(F,{id:"ip-device-code",readOnly:!0,value:A.userCode}),e.jsx(g,{type:"button",variant:"default",className:"justify-self-start",asChild:!0,children:e.jsxs("a",{href:A.verificationUrl,target:"_blank",rel:"noreferrer",children:["Open ",C?.displayName??"provider"," to approve",e.jsx(Se,{className:"h-4 w-4"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A.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 as(),disabled:T,children:T?"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 es(),disabled:T||!L,children:["Sign in with ",C?.displayName??"provider",e.jsx(Se,{className:"h-4 w-4"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:"ip-oauth-code",children:"Paste code#state"}),e.jsx(F,{id:"ip-oauth-code",placeholder:"code#state",value:v,onChange:d=>f(d.target.value),autoComplete:"off"})]}),e.jsx(g,{type:"button",className:"justify-self-start",onClick:()=>void ss(),disabled:T||!v.trim(),children:T?"Finishing...":"Finish sign-in"})]}),e.jsx(H,{onCancel:i,children:e.jsx(g,{type:"button",onClick:Je,disabled:!fe,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(H,{onCancel:i})]})]})]})}const tt={text:"Text",image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function at({provider:s,catalog:t,autoOpenEdit:a}){const n=hs(),[r,i]=p.useState(a?"edit":null),h=xs(s.kind,t);p.useEffect(()=>{a&&i("edit")},[a]);const l=(t.find(c=>c.slug===s.kind)?.modalities??["text"]).filter(c=>c!=="text"),x=h&&l.length>0,u=c=>i(j=>j===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 ${ps(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(rt,{provider:s,supportsUpstreamConfig:h,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."})]}),l.map(c=>e.jsx(it,{providerSlug:s.slug,modality:c,block:s.capabilities[c]??{}},c))]})}):null]})}function nt({provider:s,onDeleted:t}){const a=fs(),[n,r]=p.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(V,{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(xe,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete provider"]})})]})}function rt({provider:s,supportsUpstreamConfig:t,onDone:a}){const n=gs(),r=js(),i=Ue(),[h,o]=p.useState(s.displayName??""),[l,x]=p.useState(""),u=s.capabilities.text??{},[c,j]=p.useState(u.base_url??""),[N,m]=p.useState(u.model??""),[y,b]=p.useState(null),P=h.trim().length>0&&h.trim()!==(s.displayName??""),w=t&&l.trim().length>0,k=c.trim()!==(u.base_url??""),E=N.trim()!==(u.model??""),_=t&&(k||E),z={base_url:c.trim()||void 0,model:N.trim()||void 0,models_endpoint:u.models_endpoint},R=Ie(z),I=t&&_&&ze(R),O=n.isPending||r.isPending||i.isPending,v=(P||w||_)&&!I&&!O,f=async A=>{if(A.preventDefault(),!!v){b(null);try{await Promise.all([P?n.mutateAsync({providerSlug:s.slug,displayName:h.trim()}):Promise.resolve(),_?i.mutateAsync({providerSlug:s.slug,modality:"text",block:z}):Promise.resolve(),w?r.mutateAsync({providerSlug:s.slug,value:l.trim()}):Promise.resolve()]),a()}catch{b("Some changes could not be saved. Review the fields and try again.")}}};return e.jsxs("form",{onSubmit:f,className:"grid max-w-md gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:`edit-name-${s.slug}`,children:"Name"}),e.jsx(F,{id:`edit-name-${s.slug}`,value:h,onChange:A=>o(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($,{htmlFor:`edit-base-${s.slug}`,children:"Base URL"}),e.jsx(F,{id:`edit-base-${s.slug}`,placeholder:"https://api.example.com/v1",value:c,onChange:A=>j(A.target.value),autoComplete:"off"}),R.base_url?e.jsx("p",{className:"text-xs text-destructive",children:R.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:`edit-model-${s.slug}`,children:"Default model"}),e.jsx(F,{id:`edit-model-${s.slug}`,placeholder:"gpt-4o-mini",value:N,onChange:A=>m(A.target.value),autoComplete:"off"}),R.model?e.jsx("p",{className:"text-xs text-destructive",children:R.model}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:`edit-key-${s.slug}`,children:"New API key"}),e.jsx(F,{id:`edit-key-${s.slug}`,type:"password",value:l,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,y?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:y}):null,e.jsx(H,{onCancel:a,children:e.jsx(g,{type:"submit",disabled:!v,children:O?e.jsxs(e.Fragment,{children:[e.jsx(V,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]})}function it({providerSlug:s,modality:t,block:a}){const n=Ue(),[r,i]=p.useState(!1),[h,o]=p.useState(a.base_url??""),[l,x]=p.useState(a.model??""),[u,c]=p.useState(a.models_endpoint??""),[j,N]=p.useState(!!a.models_endpoint),m=!!(a.base_url||a.model||a.models_endpoint),y={base_url:h.trim()||void 0,model:l.trim()||void 0,models_endpoint:u.trim()||void 0},b=Ie(y),P=ze(b),w=()=>{P||n.mutate({providerSlug:s,modality:t,block:y})};return e.jsxs("div",{className:ne,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:tt[t]}),m?e.jsx(U,{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($,{htmlFor:`base-${s}-${t}`,children:"Base URL"}),e.jsx(F,{id:`base-${s}-${t}`,placeholder:"https://api.example.com/v1",value:h,onChange:k=>o(k.target.value),autoComplete:"off"}),b.base_url?e.jsx("p",{className:"text-xs text-destructive",children:b.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:`model-${s}-${t}`,children:"Model"}),e.jsx(F,{id:`model-${s}-${t}`,placeholder:"gpt-4o-mini",value:l,onChange:k=>x(k.target.value),autoComplete:"off"}),b.model?e.jsx("p",{className:"text-xs text-destructive",children:b.model}):null]}),j?e.jsxs("div",{className:"grid gap-2",children:[e.jsx($,{htmlFor:`endpoint-${s}-${t}`,children:"Models endpoint"}),e.jsx(F,{id:`endpoint-${s}-${t}`,placeholder:"/v1/models",value:u,onChange:k=>c(k.target.value),autoComplete:"off"}),b.models_endpoint?e.jsx("p",{className:"text-xs text-destructive",children:b.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:()=>N(!0),children:"Advanced"}),e.jsx(H,{onCancel:()=>i(!1),children:e.jsx(g,{size:"sm",disabled:P||n.isPending,onClick:w,children:n.isPending?e.jsxs(e.Fragment,{children:[e.jsx(V,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]}):null]})}function lt({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(ct,{kind:s.providerKind}),e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx(U,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] uppercase tracking-wide",children:s.providerKind}),s.connected?e.jsx(U,{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(U,{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(de,{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 ot({sandbox:s,onDeleted:t}){const a=vs(),[n,r]=p.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(xe,{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(V,{}):"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 ct({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(ys,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(Ns,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}const dt={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},ut={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function It(){const{owner:s,connectorKey:t}=Q.useParams(),{instances:a}=Q.useSearch(),{kind:n,id:r}=Us(t);return e.jsx(Is,{owner:s,children:({ownerSlug:i,organizationId:h,isWorkspaceLoading:o})=>{if(a&&(n==="inference"||n==="sandbox-provider"))return e.jsx(et,{ownerSlug:i,familyKind:n,familyId:r});switch(n){case"inference":return e.jsx(xt,{ownerSlug:i,providerSlug:r});case"sandbox":return e.jsx(ht,{ownerSlug:i,sandboxId:r});case"sandbox-provider":return e.jsx(mt,{ownerSlug:i,providerKind:r});default:return e.jsx(jt,{ownerSlug:i,organizationId:h,isWorkspaceLoading:o,connectorKey:t})}}})}function mt({ownerSlug:s,providerKind:t}){const a=G();return p.useEffect(()=>{a({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:`${he}${t}`},replace:!0})},[a,s,t]),null}function ht({ownerSlug:s,sandboxId:t}){const a=G(),{data:n,isLoading:r,isError:i,refetch:h}=Ee(),o=n?.sandboxes.find(x=>x.id===t)??null;if(r)return e.jsxs(M,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-6 w-6 rounded"}),e.jsx(D,{className:"h-5 w-40"})]}),e.jsx(D,{className:"h-24 w-full rounded-lg"})]});if(i)return e.jsx(M,{children:e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load this instance."}),e.jsx(g,{variant:"outline",onClick:()=>void h(),children:"Retry"})]})});if(!o)return e.jsxs(M,{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 l=o.name||me(o.providerKind);return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:e.jsx(oe,{breadcrumb:e.jsx(ce,{crumbs:[e.jsx(K,{to:"/$owner/connectors",params:{owner:s},className:X,children:"Connectors"},"connectors"),e.jsx(K,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${he}${o.providerKind}`},search:{instances:!0},className:X,children:me(o.providerKind)},"family")]}),icon:e.jsx(pe,{name:l,faviconDomain:Xs(o.providerKind)}),title:l,badge:e.jsxs(e.Fragment,{children:[e.jsx(U,{variant:"secondary",children:o.providerKind}),o.connected?e.jsx(U,{className:"border-transparent bg-emerald-500/10 text-emerald-500",children:"Connected"}):e.jsx(U,{variant:"destructive",children:"No credential"})]}),status:e.jsx(Ge,{facets:ut})}),children:[e.jsx(lt,{sandbox:o}),e.jsx(B,{title:"Settings",muted:!0,children:e.jsx(ot,{sandbox:o,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})})]})})}function xt({ownerSlug:s,providerSlug:t}){const a=G(),{model:n,reason:r,agentId:i,addAccount:h}=Q.useSearch(),{data:o=[],isLoading:l,isError:x,refetch:u}=Pe(),c=De(),{data:j=[],isLoading:N}=c,m=h?null:o.find(E=>E.slug===t)??null,y=j.find(E=>E.slug===(m?.kind??t))??null;if(l||N)return e.jsx("div",{children:e.jsxs(M,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-6 w-6 rounded"}),e.jsx(D,{className:"h-5 w-40"})]}),e.jsx(D,{className:"h-16 w-full rounded-lg"}),e.jsx(D,{className:"h-24 w-full rounded-lg"}),e.jsx(D,{className:"h-32 w-full rounded-lg"})]})});if(x)return e.jsx(M,{children:e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load this account."}),e.jsx(g,{variant:"outline",onClick:()=>void u(),children:"Retry"})]})});if(!m&&!y&&!c.isError)return e.jsxs(M,{className:"space-y-3",children:[e.jsx(Xe,{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 b=m?m.displayName||m.slug:y?.displayName||t,P=m!==null,w=r?e.jsx(gt,{agentId:i,model:n,providerName:b}):n?e.jsx(ft,{providerName:b,model:n,isConnected:P}):null,k=e.jsx(oe,{breadcrumb:e.jsx(ce,{crumbs:[e.jsx(K,{to:"/$owner/connectors",params:{owner:s},className:X,children:"Connectors"},"connectors"),...m?[e.jsx(K,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${ae}${m.kind}`},search:{instances:!0},className:X,children:y?.displayName??m.kind},"family")]:[]]}),icon:e.jsx(pe,{iconUrl:y?.iconUrl,name:b}),title:b,badge:m?e.jsxs(e.Fragment,{children:[m.isDefault?e.jsx(U,{variant:"secondary",children:"Default"}):null,m.status?e.jsx(U,{variant:"outline",children:m.status}):null,m.hasCustomUpstream?e.jsx(U,{variant:"outline",children:"Custom upstream"}):null]}):null,status:e.jsx(Ge,{facets:dt})});return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(le,{header:k,children:[w,e.jsx("div",{className:"space-y-6",children:m?e.jsx(at,{provider:m,catalog:j,autoOpenEdit:!!n}):e.jsx(pt,{ownerSlug:s,providerSlug:t,existingSlugs:o.map(E=>E.slug),catalog:j,catalogError:c.isError?c.error:null,model:n})}),m?e.jsx(B,{title:"Settings",muted:!0,children:e.jsx(nt,{provider:m,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})}):null]})})}function pt({ownerSlug:s,providerSlug:t,existingSlugs:a,catalog:n,catalogError:r,model:i}){const h=G(),o=n.find(u=>u.slug===t),l=a.includes(t)&&!!o&&te(o);let x=t;for(let u=2;a.includes(x);u++)x=`${t}-${u}`;return r?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(de,{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:r instanceof Error?r.message:"Check the workspace URL and try again."})]})]})}):e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[l&&e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Subscription sign-in is managed on the existing connection."}),e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(K,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${ae}${t}`},search:{},children:"Open existing connection"})})]}),(!l||o&&Fe(o))&&e.jsx(st,{catalog:n,initialProvider:t,initialSlug:x,allowOAuth:!l,initialModel:i?.includes("/")?i.split("/").slice(1).join("/"):i,onDone:()=>void h({to:"/$owner/connectors",params:{owner:s}})},`${n.length}:${t}`)]})}function ft({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(de,{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 gt({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(de,{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 jt({ownerSlug:s,organizationId:t,isWorkspaceLoading:a,connectorKey:n}){const{data:r=[],isLoading:i,isError:h,refetch:o}=Vs(t??""),{data:l=[],isLoading:x,isError:u,refetch:c}=Ws(t??"",{connectorKey:n}),j=p.useMemo(()=>r.find(y=>y.key===n),[r,n]),N=p.useMemo(()=>Ys(n,r,{name:l[0]?.connector_name??n}),[n,r,l]);if(a||i)return e.jsx("div",{children:e.jsxs(M,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-6 w-6 rounded"}),e.jsx(D,{className:"h-5 w-40"})]}),e.jsx(D,{className:"h-16 w-full rounded-lg"}),e.jsx(D,{className:"h-24 w-full rounded-lg"}),e.jsx(D,{className:"h-32 w-full rounded-lg"})]})});if(h||u)return e.jsx(M,{children:e.jsxs("div",{role:"alert",className:"space-y-2",children:[e.jsx("p",{children:"Could not load this connector."}),e.jsx(g,{variant:"outline",onClick:()=>{o(),c()},children:"Retry"})]})});const m=j?e.jsx(yt,{connector:j,ownerSlug:s}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Xe,{connector:N,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.",l.length>0?" Existing connections keep working.":""]})]});return e.jsx("div",{className:"flex flex-1 flex-col",children:j&&t?e.jsx(vt,{hero:m,connector:j,organizationId:t,ownerSlug:s,connectorKey:n,connections:l,isLoading:x,refetchConnections:c}):e.jsxs(M,{className:"space-y-6",children:[m,l.length>0&&!x?e.jsx(He,{section:!0,connections:l,ownerSlug:s,connectorKey:n}):e.jsx(Qe,{organizationId:t??"",ownerSlug:s,connectorKey:n,connections:l,isLoading:x})]})})}function vt({hero:s,connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:h,refetchConnections:o}){const{isAdmin:l,isLoading:x}=Z(a),u=(t.operations_summary?.total??0)>0;return e.jsxs(le,{header:s,children:[e.jsx(bs,{organizationId:a,connectorKey:r}),e.jsx(At,{connector:t,organizationId:a,ownerSlug:n,connectorKey:r,connections:i,isLoading:h,refetchConnections:o}),i.length>0?e.jsx(He,{section:!0,connections:i,connector:t,ownerSlug:n,connectorKey:r}):null,e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:auto-cols-fr sm:grid-flow-col",children:[e.jsx(St,{connector:t,organizationId:a,ownerSlug:n}),u&&x?e.jsx(D,{className:"h-20 w-full rounded-lg"}):u&&l?e.jsx(Ct,{connector:t,organizationId:a,ownerSlug:n}):u&&!l?e.jsx(B,{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(Nt,{connector:t,organizationId:a,ownerSlug:n,connectionCount:i.length}),!h&&i.length>0?e.jsx(B,{title:"Recent activity",children:e.jsx(Js,{scope:{connectorKey:r},ownerSlug:n})}):null]})}function yt({connector:s,ownerSlug:t}){return e.jsx(oe,{breadcrumb:e.jsx(ce,{crumbs:[e.jsx(K,{to:"/$owner/connectors",params:{owner:t},className:X,children:"Connectors"},"connectors")]}),icon:e.jsx(pe,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??Hs(s.auth_schema),className:"h-10 w-10"}),title:s.name,badge:e.jsx(Zs,{connectorDef:s,ownerSlug:t}),caption:s.description})}function Nt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=Te(s.auth_schema),i=zs(s.auth_schema),h=r.find(w=>w.type==="oauth"),o=We(s.auth_schema),l=r.some(w=>w.type==="env_keys"),x=r.some(w=>w.type==="browser"),u=i.some(w=>w.type==="interactive"),c=!!(h||o||l||x),j=Ms(s),{isAdmin:N}=Z(t),{data:m=[]}=ie(t,{connectorKey:s.key,profileKind:"env"}),{data:y=[]}=ie(t,{profileKind:"browser_session",connectorKey:s.key}),b=N&&s.installed!==!1;return!!(h||o)||l&&m.length>0||x&&y.length>0||!c||b?e.jsxs("div",{className:"space-y-6",children:[h?e.jsx(kt,{connector:s,organizationId:t,oauthMethod:h}):null,o?e.jsx(B,{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(Ye,{organizationId:t,connectorKey:s.key,provider:o.provider,providerLabel:s.name,installShape:o.installShape,variant:"outline"})]})}):null,l&&m.length>0?e.jsx($e,{profiles:m,type:"env"}):null,x&&y.length>0?e.jsx($e,{profiles:y,type:"browser_session"}):null,c?null:j?e.jsx(B,{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(K,{to:"/$owner/connectors",params:{owner:a},search:{},children:"View devices"})})]})}):u?e.jsx(B,{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(B,{title:"Authentication",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connector doesn't need workspace credentials. Create a connection above to get started."})}),e.jsx(bt,{connector:s,organizationId:t,ownerSlug:a,connectionCount:n})]}):null}function bt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const r=G(),{isAdmin:i}=Z(t),h=Gs(),[o,l]=p.useState(!1),[x,u]=p.useState(null),c=s.installed!==!1;if(!i||!c)return null;const j=n>0,N=h.isPending,m=()=>{u(null),h.mutate({connector_key:s.key},{onSuccess:()=>{r({to:"/$owner/connectors",params:{owner:a}})},onError:y=>{u(y instanceof Error?y.message:"Failed to remove connector"),l(!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."]}),j?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:o?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(g,{variant:"destructive",size:"sm",disabled:N,onClick:m,children:[N?e.jsx(V,{size:"md",className:"mr-1.5"}):null,"Confirm remove"]}),e.jsx(g,{variant:"ghost",size:"sm",disabled:N,onClick:()=>l(!1),children:"Cancel"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:N||j,onClick:()=>l(!0),children:[e.jsx(xe,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove connector"]})})]})}function Ct({connector:s,organizationId:t,ownerSlug:a}){const n=qe();return e.jsx(Ve,{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 kt({connector:s,organizationId:t,oauthMethod:a}){const{isAdmin:n,isLoading:r}=Z(t),{setup:i}=Q.useSearch(),h=Q.useNavigate(),{data:o=[],refetch:l,isLoading:x,isError:u}=ie(t,{connectorKey:s.key,provider:a.provider}),c=o.filter(j=>j.profile_kind==="oauth_app");return r||x?e.jsx(D,{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(wt,{connector:s,oauthMethod:a,appProfiles:c,isAdmin:n,initialOpen:i==="oauth_app",onClose:()=>{i==="oauth_app"&&h({search:j=>({...j,setup:void 0}),hash:"",replace:!0})},refetchProfiles:l})}function wt({initialOpen:s=!1,onClose:t,connector:a,oauthMethod:n,appProfiles:r,isAdmin:i,refetchProfiles:h}){const o=Ps(),l=Ds(),[x,u]=se(a.key,s&&i),[c,j]=p.useState(!1);p.useEffect(()=>{s&&i&&u(!0)},[s,i,u]);const N=`${Es()}/connect/oauth/callback`,[m,y]=se(a.key,`${a.name} OAuth App`),[b,P]=se(a.key,""),[w,k]=se(a.key,null),E=Fs(n),_=Ls(`${a.key}:${x}`,Rs(E),E),{values:z,setValues:R}=_,I=r.find(v=>v.is_default_for_connector&&v.connector_key===a.key),O=()=>{_.canSubmit&&(k(null),o.mutate({connector_key:a.key,profile_kind:"oauth_app",display_name:m.trim()||`${a.name} OAuth App`,slug:b.trim()||void 0,credentials:Pt(qs(z))},{onSuccess:v=>{const f=v.auth_profile?.slug;f&&!I&&l.mutate({connector_key:a.key,auth_profile_slug:f}),u(!1),t?.(),y(`${a.name} OAuth App`),P(""),h()},onError:v=>{k(v instanceof Error?v.message:"Failed to add OAuth app")}}))};return e.jsxs(B,{id:"connector-oauth-apps",title:`${$t(n.provider)} app configuration`,action:i&&!x?e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>u(!0),children:[e.jsx(Me,{className:"size-3.5"}),"Add OAuth app"]}):null,children:[i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{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:N}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(N).then(()=>j(!0)).catch(()=>k("Could not copy the callback URL. Select and copy it above."))},children:[e.jsx(Os,{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(v=>e.jsxs("div",{className:re(ne,"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:v.display_name}),v.is_default_for_connector&&v.connector_key===a.key?e.jsx(U,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,e.jsx(Ze,{status:v.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:v.slug})]}),i&&!v.is_default_for_connector&&v.connector_key===a.key&&v.status==="active"?e.jsx(g,{variant:"outline",size:"sm",disabled:l.isPending,onClick:()=>l.mutate({connector_key:a.key,auth_profile_slug:v.slug}),children:"Set default"}):null]},v.slug))}),i&&x?e.jsxs("div",{className:re(ne,"space-y-3 p-3"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"oauth-app-name",children:"Display name"}),e.jsx(F,{id:"oauth-app-name",value:m,onChange:v=>y(v.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"oauth-app-slug",children:"Slug"}),e.jsx(F,{id:"oauth-app-slug",placeholder:"optional",value:b,onChange:v=>P(v.target.value)})]}),e.jsx(Bs,{schema:_.revision??void 0,values:z,onValuesChange:R,fieldIdPrefix:"oauth-app-"}),e.jsx(Ks,{visible:_.hasConflict,onReload:_.reset}),w?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:w}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",disabled:o.isPending,onClick:()=>{u(!1),t?.()},children:"Cancel"}),e.jsxs(g,{size:"sm",disabled:o.isPending||!_.canSubmit,onClick:O,children:[o.isPending?e.jsx(V,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):null]})}function At({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i,refetchConnections:h}){const l=Te(s.auth_schema).find(N=>N.type==="oauth"),{data:x=[],refetch:u,isLoading:c,isError:j}=ie(t,{connectorKey:s.key,provider:l?.provider});if(l){if(j)return e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load accounts. Reload the page to try again."});const N=x.filter(y=>y.profile_kind==="oauth_app"),m=x.filter(y=>y.profile_kind==="oauth_account");return e.jsx(_t,{connector:s,organizationId:t,oauthMethod:l,appProfiles:N,accounts:m,connections:r,isLoading:i||c,refetchProfiles:u,refetchConnections:h})}return e.jsx(Qe,{connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i})}function _t({connector:s,organizationId:t,oauthMethod:a,appProfiles:n,accounts:r,connections:i,isLoading:h,refetchProfiles:o,refetchConnections:l}){const{session:x}=Cs(),{isAdmin:u,isLoading:c}=Z(t),j=ks(),N=ws(),m=As(),[y,b]=p.useState(""),[P,w]=p.useState([]),k=n.filter(f=>f.status==="active"),E=k.find(f=>f.is_default_for_connector&&f.connector_key===s.key),_=(u?k.find(f=>f.slug===y):void 0)??E??(u&&k.length===1?k[0]:void 0),z=new Set(i.map(f=>f.auth_profile_slug)),R=r.filter(f=>f.created_by===x?.user?.id),I=R.filter(f=>!z.has(f.slug)),O=!i.some(f=>f.created_by===x?.user?.id)&&R.length===0;if(h||c||!x?.user?.id||!O&&I.length===0&&!m.error&&!m.continueUrl)return null;const v=f=>m.begin(async()=>{const A=await j.mutateAsync({connector_key:s.key,app_auth_profile_slug:f,requested_scopes:Ts(a,P)});return o(),l(),A});return e.jsxs(B,{title:O?"Connect your account":"Your accounts",children:[O&&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($,{children:"App used for this account"}),e.jsxs(Le,{value:_?.slug??"",onValueChange:b,children:[e.jsx(Re,{"aria-label":"App used for this account",children:e.jsx(Oe,{placeholder:"Choose an OAuth app"})}),e.jsx(Be,{children:k.map(f=>e.jsxs(Ke,{value:f.slug,children:[f.display_name,f.is_default_for_connector&&f.connector_key===s.key?" (workspace default)":""]},f.slug))})]})]}):_?e.jsxs("p",{className:"text-sm",children:["App: ",_.display_name,_.is_default_for_connector&&_.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."}),_&&e.jsx(_s,{requiredScopes:$s(a),optionalScopes:Ss(a),selectedOptionalScopes:P,onToggleOptionalScope:(f,A)=>w(W=>A?[...new Set([...W,f])]:W.filter(T=>T!==f))}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{size:"sm",disabled:!_||m.pending,onClick:()=>{_&&v(_.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"})})]})]}),I.map(f=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2",children:[e.jsx("span",{className:"text-sm",children:f.display_name}),e.jsx(g,{variant:"outline",size:"sm",disabled:m.pending,onClick:()=>void m.begin(()=>f.status==="active"?j.mutateAsync({connector_key:s.key,auth_profile_slug:f.slug}):N.mutateAsync({auth_profile_slug:f.slug})),children:f.status==="active"?"Use this account":"Reconnect"})]},f.slug)),m.error&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:m.error}),m.continueUrl&&e.jsx("a",{href:m.continueUrl,target:"_blank",rel:"noreferrer",className:"text-sm underline",children:"Continue authorization in your browser"})]})}function $e({profiles:s,type:t}){const a=t==="env"?"Credentials":"Browser sessions";return e.jsx(B,{title:a,children:e.jsx("div",{className:"space-y-2",children:s.map(n=>e.jsxs("div",{className:re(ne,"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(Ze,{status:n.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.slug})]},n.slug))})})}function St({connector:s,organizationId:t,ownerSlug:a}){const n=qe(),r=Object.keys(s.feeds_schema??{}).length;return r?e.jsx(Ve,{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 Qe({connector:s,organizationId:t,ownerSlug:a,connectorKey:n,connections:r,isLoading:i}){const h=G(),o=We(s?.auth_schema);if(i)return e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-4 w-24"}),e.jsx(D,{className:"h-16 w-full rounded-lg"})]});if(r.length===0){const l=s&&o?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ye,{organizationId:t,connectorKey:n,provider:o.provider,providerLabel:s.name,installShape:o.installShape,size:"default",label:`Install ${s.name}`}),e.jsx(g,{asChild:!0,variant:"outline",children:e.jsx(K,{to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n},children:"Use your own app"})})]}):e.jsxs(g,{size:"default",onClick:()=>h({to:"/$owner/connectors/create/$connectorKey",params:{owner:a,connectorKey:n}}),children:[e.jsx(Me,{className:"mr-1.5 h-4 w-4"}),"Create connection"]});return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:l})}return null}function Ze({status:s}){const t=s==="active"?"text-green-500":s==="error"||s==="revoked"?"text-destructive":"text-amber-500";return e.jsxs("span",{className:re("text-xs",t),children:["· ",s]})}function $t(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Pt(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{vt as ConnectorDetailShell,_t as OAuthAccountsSection,wt as OAuthAppProfilesSection,It as component};
2
- //# sourceMappingURL=_connectorKey.index-clVDIyW0.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,dW as M,P as h,iA as w,r as j,t as z,cN as C,iB as N}from"./index-Cr5hwh-C.js";import{A as k}from"./agent-loading-shells-Dqcvky-k.js";import{s as b,R as y,A as L}from"./agent-thread-BJOijbT0.js";import"./app-bridge-BCm4muqj.js";import"./use-mention-search-By8RZyKW.js";import"./index-Vcq4gwWv.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.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"},p={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"},d={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:`#${p.hex}`,path:p.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:`#${d.hex}`,path:d.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 P(s,t,a){return s==="slack"&&a?.teamId&&t?`https://app.slack.com/client/${a.teamId}/${t}`:null}function R({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:A=[]}=C(f?.id??"",{connectorKey:o}),v=A[0]?.config?.chatMetadata,l=P(o,g,v);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(k,{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 q(){const{owner:s,agentId:t,conversationId:a}=N.useParams();return e.jsx(R,{owner:s,agentId:t,conversationId:a})}export{q as component};
2
- //# sourceMappingURL=_conversationId-Ci2k-BuN.js.map
@@ -1,2 +0,0 @@
1
- import{v as u,m as v,j as t,ah as x,bZ as d,b_ as f,b$ as h,bm as w,c0 as j}from"./index-Cr5hwh-C.js";import{E as P}from"./event-detail-ve2d6Gbb.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.js";import"./view-param-filters-CqLZQrnO.js";import"./app-bridge-BCm4muqj.js";import"./filter-editors-Cj-v6NtH.js";function g({owner:e,eventId:a,viewKey:r}){const o=u({strict:!1}),i=v(),m=(n,s)=>t.jsx(P,{owner:s,organizationId:n,eventId:a,viewKey:r,params:r?f(o):{},onParamsChange:(l,p,c)=>void i({to:d(s,a,l),search:p,replace:c?.replace??!0}),fullBleed:!0},`${s}/${a}`);return t.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:e==="me"?m(null,e):t.jsx(x,{owner:e,children:({organizationId:n,ownerSlug:s})=>n?m(n,s):t.jsx("div",{className:"mx-auto h-40 w-full max-w-3xl animate-pulse rounded-md bg-muted/40"})})})}function D(){const{owner:e,eventId:a}=h.useParams(),r=w({from:"/$owner/events/$eventId/-/views/$viewKey",shouldThrow:!1}),o=j(a);return o===null?null:t.jsx(g,{owner:e,eventId:o,viewKey:r?.viewKey})}export{D as component};
2
- //# sourceMappingURL=_eventId-B0662F8h.js.map