@lobu/runtime-server 24.4.0 → 24.6.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 (305) hide show
  1. package/dist/catalogs/connectors.json +342 -4
  2. package/dist/catalogs/skills.json +2 -2
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/linkedin-identity.ts +43 -0
  5. package/dist/connectors/linkedin.ts +154 -3
  6. package/dist/connectors/postgres.ts +77 -48
  7. package/dist/connectors/x-like-follow.ts +329 -0
  8. package/dist/connectors/x.ts +709 -80
  9. package/dist/dependencies.bun.lock +104 -135
  10. package/dist/owletto/dist/assets/_-DT3E3BmS.js +3 -0
  11. package/dist/owletto/dist/assets/_-c1xy7bLu.js +2 -0
  12. package/dist/owletto/dist/assets/_agentId-CTfoi0-7.js +2 -0
  13. package/dist/owletto/dist/assets/_agentId-DV8utajn.js +2 -0
  14. package/dist/owletto/dist/assets/_automationId-DvP3qyYL.js +2 -0
  15. package/dist/owletto/dist/assets/_connectorKey._connectionId-CL5SivCn.js +2 -0
  16. package/dist/owletto/dist/assets/_connectorKey.index-tnMwC67b.js +2 -0
  17. package/dist/owletto/dist/assets/_conversationId-DXN_8m88.js +2 -0
  18. package/dist/owletto/dist/assets/_eventId-SdpFT7jB.js +2 -0
  19. package/dist/owletto/dist/assets/_name-CM1AMywz.js +2 -0
  20. package/dist/owletto/dist/assets/_owner-CaGsXXBW.js +3 -0
  21. package/dist/owletto/dist/assets/_shape-DGAkETDp.js +2 -0
  22. package/dist/owletto/dist/assets/_skillKey-Dd4ZHPY8.js +2 -0
  23. package/dist/owletto/dist/assets/_slug-cRvJQtNo.js +2 -0
  24. package/dist/owletto/dist/assets/_view-B5I7mmkl.js +2 -0
  25. package/dist/owletto/dist/assets/_viewKey-Bwn0dyLo.js +2 -0
  26. package/dist/owletto/dist/assets/_viewKey-YjSYD0wc.js +2 -0
  27. package/dist/owletto/dist/assets/accept-invitation-CQZQ0wwC.js +2 -0
  28. package/dist/owletto/dist/assets/activity-route-view-CZykJXQp.js +2 -0
  29. package/dist/owletto/dist/assets/{agent-card-controls-99mG6H5k.js → agent-card-controls-DuQJhtqp.js} +2 -2
  30. package/dist/owletto/dist/assets/{agent-client-setup-list-kMmqQSrf.js → agent-client-setup-list-CpUTAjXf.js} +2 -2
  31. package/dist/owletto/dist/assets/agent-connect-pages-Br_ycC0z.js +2 -0
  32. package/dist/owletto/dist/assets/agent-editor-form-BXQBFHSv.js +2 -0
  33. package/dist/owletto/dist/assets/agent-guardrails-route-CN7vpC0X.js +2 -0
  34. package/dist/owletto/dist/assets/agent-list-row-BnP6r4pm.js +2 -0
  35. package/dist/owletto/dist/assets/{agent-loading-shells-Dnmb6W5Y.js → agent-loading-shells-_18OREnx.js} +2 -2
  36. package/dist/owletto/dist/assets/{agent-permissions-matrix-CbhXlbgY.js → agent-permissions-matrix-DSjidWHL.js} +2 -2
  37. package/dist/owletto/dist/assets/{agent-skill-context-V__2i6Vl.js → agent-skill-context-1DBn7Xc_.js} +2 -2
  38. package/dist/owletto/dist/assets/agent-skills-route-d5jh3oBR.js +2 -0
  39. package/dist/owletto/dist/assets/agent-tab-intro-DKrC3SQt.js +2 -0
  40. package/dist/owletto/dist/assets/agent-thread-FyEO-y44.js +6 -0
  41. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +2 -0
  42. package/dist/owletto/dist/assets/agents-kXojozTU.js +2 -0
  43. package/dist/owletto/dist/assets/agents-workbench-CDpJmUVN.js +2 -0
  44. package/dist/owletto/dist/assets/app._appId-DwNeXRJp.js +2 -0
  45. package/dist/owletto/dist/assets/assist-composer-Mn9EfX4X.js +2 -0
  46. package/dist/owletto/dist/assets/automation-detail-content-Bs3vwAPd.js +2 -0
  47. package/dist/owletto/dist/assets/automation-row-B5Q1B10y.js +2 -0
  48. package/dist/owletto/dist/assets/automation-source-list-Dhucq1sI.js +2 -0
  49. package/dist/owletto/dist/assets/automations-kXojozTU.js +2 -0
  50. package/dist/owletto/dist/assets/{callback-B-CAz-bK.js → callback-9xSHyA12.js} +2 -2
  51. package/dist/owletto/dist/assets/{card-SFtxv9f2.js → card-g4yxo4Hr.js} +2 -2
  52. package/dist/owletto/dist/assets/change-summary-DeuXQEpb.js +2 -0
  53. package/dist/owletto/dist/assets/{claim-DrxIRWKt.js → claim-B98IhDra.js} +2 -2
  54. package/dist/owletto/dist/assets/{client-activity-scopes-boZOHuPW.js → client-activity-scopes-BD2HBo-_.js} +2 -2
  55. package/dist/owletto/dist/assets/{client-rows-BJ2PxM4J.js → client-rows-x_CxeWkP.js} +2 -2
  56. package/dist/owletto/dist/assets/{clients-C7Lnuc3S.js → clients-Cmp0LmOp.js} +2 -2
  57. package/dist/owletto/dist/assets/connect-menu-CezOH3s7.js +2 -0
  58. package/dist/owletto/dist/assets/connect-zUot_0kG.js +2 -0
  59. package/dist/owletto/dist/assets/connect._clientId-nsGxe6yO.js +2 -0
  60. package/dist/owletto/dist/assets/connected._clientId-DnclRRXk.js +2 -0
  61. package/dist/owletto/dist/assets/connected._clientId.activity-CDB8atTX.js +2 -0
  62. package/dist/owletto/dist/assets/connected._clientId.index-DBNP2mZo.js +2 -0
  63. package/dist/owletto/dist/assets/connection-B6fM2KHN.js +2 -0
  64. package/dist/owletto/dist/assets/{connection-feed-detail-D7pnWaFB.js → connection-feed-detail-Ckq-qEbD.js} +2 -2
  65. package/dist/owletto/dist/assets/{connections-browser-DDJQh8Na.js → connections-browser-BXsJqieG.js} +2 -2
  66. package/dist/owletto/dist/assets/{connector-boxes-DDX7Ebc4.js → connector-boxes-CbqSFeVm.js} +2 -2
  67. package/dist/owletto/dist/assets/connector-page-shell-Di6XzkVo.js +2 -0
  68. package/dist/owletto/dist/assets/connector-provenance-BrnasBW4.js +2 -0
  69. package/dist/owletto/dist/assets/{connector-scope-lists-BibdzKl1.js → connector-scope-lists-dQnZARCD.js} +2 -2
  70. package/dist/owletto/dist/assets/connectors-DnOUxX_U.js +2 -0
  71. package/dist/owletto/dist/assets/consent-Byli4yMs.js +2 -0
  72. package/dist/owletto/dist/assets/copy-button-Ddf7lBjZ.js +2 -0
  73. package/dist/owletto/dist/assets/{core.esm-CHnfRiEM.js → core.esm-BsXtvNoI.js} +3 -3
  74. package/dist/owletto/dist/assets/create-B34eskZ_.js +2 -0
  75. package/dist/owletto/dist/assets/create-DLB9sXgU.js +2 -0
  76. package/dist/owletto/dist/assets/create-YdAnh3ml.js +2 -0
  77. package/dist/owletto/dist/assets/create-automation-form-C9PMX7N8.js +3 -0
  78. package/dist/owletto/dist/assets/create._connectorKey-Bz4OYRiC.js +2 -0
  79. package/dist/owletto/dist/assets/definition-comparison-B5WgZILB.js +2 -0
  80. package/dist/owletto/dist/assets/device-DdCoCj-Q.js +2 -0
  81. package/dist/owletto/dist/assets/device-pin-tombstone-B06J7Af1.js +2 -0
  82. package/dist/owletto/dist/assets/device._deviceId-Bh9S4bFp.js +2 -0
  83. package/dist/owletto/dist/assets/dynamic-schema-form-qWSRtOAv.js +2 -0
  84. package/dist/owletto/dist/assets/entity-options-BkU_En_f.js +2 -0
  85. package/dist/owletto/dist/assets/entity-page-BPFDHY8q.js +2 -0
  86. package/dist/owletto/dist/assets/entity-pages-DxgbjLMt.js +2 -0
  87. package/dist/owletto/dist/assets/entity-type-page-D0ghgRgq.js +2 -0
  88. package/dist/owletto/dist/assets/event-card-CjA_dLzq.js +2 -0
  89. package/dist/owletto/dist/assets/event-detail-CmC-DVrK.js +2 -0
  90. package/dist/owletto/dist/assets/{events-feed-BysC9HgU.js → events-feed-CGzA1w3R.js} +2 -2
  91. package/dist/owletto/dist/assets/filter-bar-CQ_oE7a9.js +2 -0
  92. package/dist/owletto/dist/assets/{full-page-spinner-BMiXl54z.js → full-page-spinner-B5xXnKtV.js} +2 -2
  93. package/dist/owletto/dist/assets/guardrails-DkXatmea.js +2 -0
  94. package/dist/owletto/dist/assets/identity-BwJy3ixB.js +2 -0
  95. package/dist/owletto/dist/assets/index-35ehGReZ.js +2 -0
  96. package/dist/owletto/dist/assets/index-B9hYiwBw.js +2 -0
  97. package/dist/owletto/dist/assets/index-BDl1_w6U.js +53 -0
  98. package/dist/owletto/dist/assets/{index-C-WaHj1Y.js → index-BdNR51Ua.js} +2 -2
  99. package/dist/owletto/dist/assets/index-BjcZVe7n.js +7899 -0
  100. package/dist/owletto/dist/assets/{index-B4wXJwQY.js → index-BqAVebvY.js} +2 -2
  101. package/dist/owletto/dist/assets/index-BvK1fS1J.js +2 -0
  102. package/dist/owletto/dist/assets/index-CNEpTkgw.css +1 -0
  103. package/dist/owletto/dist/assets/index-CRc73k1t.js +2 -0
  104. package/dist/owletto/dist/assets/index-CYGaSD3y.js +2 -0
  105. package/dist/owletto/dist/assets/index-CfZGe-zn.js +2 -0
  106. package/dist/owletto/dist/assets/{index-CzoK57xp.js → index-CkiyxW4w.js} +2 -2
  107. package/dist/owletto/dist/assets/index-CzLDNB2E.js +2 -0
  108. package/dist/owletto/dist/assets/index-D-o5iOVd.js +2 -0
  109. package/dist/owletto/dist/assets/index-DjYVV1Ml.js +2 -0
  110. package/dist/owletto/dist/assets/{index-D4-uel59.js → index-TkPy_P_u.js} +2 -2
  111. package/dist/owletto/dist/assets/index-Vcq4gwWv.js +2 -0
  112. package/dist/owletto/dist/assets/index-VyAX-asP.js +2 -0
  113. package/dist/owletto/dist/assets/json-diff-DtZtra_g.js +28 -0
  114. package/dist/owletto/dist/assets/{list-skeleton-Bp4HNgJ9.js → list-skeleton-CIHWCi2a.js} +2 -2
  115. package/dist/owletto/dist/assets/login-TWR0vF4_.js +2 -0
  116. package/dist/owletto/dist/assets/{logout-DxmfsVKD.js → logout-BA5kojS0.js} +2 -2
  117. package/dist/owletto/dist/assets/manage-gear-C-0BAMbC.js +2 -0
  118. package/dist/owletto/dist/assets/{member-scope-gate-vp3FihBD.js → member-scope-gate-BQiRAqtx.js} +2 -2
  119. package/dist/owletto/dist/assets/memory-browse-page-Ba32-vVL.js +74 -0
  120. package/dist/owletto/dist/assets/model-C2q7WDcS.js +2 -0
  121. package/dist/owletto/dist/assets/model-selector-B2cjCn0V.js +2 -0
  122. package/dist/owletto/dist/assets/models-CZkH5gtj.js +2 -0
  123. package/dist/owletto/dist/assets/nav-pill-Bam6s3jj.js +2 -0
  124. package/dist/owletto/dist/assets/new-BJst6K0b.js +2 -0
  125. package/dist/owletto/dist/assets/{new-CvX8_gIb.js → new-Dc5Bbotb.js} +2 -2
  126. package/dist/owletto/dist/assets/new-DgbivfDe.js +2 -0
  127. package/dist/owletto/dist/assets/organization-B9U1L-56.js +2 -0
  128. package/dist/owletto/dist/assets/peek-pane-content-Cq8P38s3.js +2 -0
  129. package/dist/owletto/dist/assets/pending-seed-BP3xHM2d.js +2 -0
  130. package/dist/owletto/dist/assets/permissions-BVlbeY4u.js +2 -0
  131. package/dist/owletto/dist/assets/proposal-review-shell-BED-DO9C.js +2 -0
  132. package/dist/owletto/dist/assets/public-shell-ready-Diq15_QW.js +2 -0
  133. package/dist/owletto/dist/assets/record-activity-CTLwq8s1.js +2 -0
  134. package/dist/owletto/dist/assets/{record-session-CWXnCVln.js → record-session-DOFgdd43.js} +2 -2
  135. package/dist/owletto/dist/assets/renderer-CHPS-1vD.js +96 -0
  136. package/dist/owletto/dist/assets/{reset-password-CFUzxH7m.js → reset-password-BmNM-apc.js} +2 -2
  137. package/dist/owletto/dist/assets/run-activity-link-Dh1YyCfk.js +2 -0
  138. package/dist/owletto/dist/assets/run-initiator-CCxNv0rK.js +2 -0
  139. package/dist/owletto/dist/assets/{runs-BPtQBTRN.js → runs-BntGAKQG.js} +2 -2
  140. package/dist/owletto/dist/assets/runs-panel-BwTVaRsE.js +2 -0
  141. package/dist/owletto/dist/assets/runs-table-CYS1jDdL.js +2 -0
  142. package/dist/owletto/dist/assets/{schema-type-editor-panel-CAhOB648.js → schema-type-editor-panel-v3nR2Oa2.js} +2 -2
  143. package/dist/owletto/dist/assets/schema-value-BFb7jCBo.js +3 -0
  144. package/dist/owletto/dist/assets/settings-DBgT60nY.js +2 -0
  145. package/dist/owletto/dist/assets/settings-DubSpJfg.js +2 -0
  146. package/dist/owletto/dist/assets/skills-DDoeRGhJ.js +2 -0
  147. package/dist/owletto/dist/assets/{source-record-panels-Bh5F4C5K.js → source-record-panels-m8gECt82.js} +2 -2
  148. package/dist/owletto/dist/assets/{status-dot-D3FoDRcc.js → status-dot-BnQPFrcU.js} +2 -2
  149. package/dist/owletto/dist/assets/{table-DFcJRNk7.js → table-DALHuXPE.js} +2 -2
  150. package/dist/owletto/dist/assets/{use-automations-BHoV0dLs.js → use-automations-D9hKpufo.js} +2 -2
  151. package/dist/owletto/dist/assets/use-login-redirect-ciwfc-7A.js +2 -0
  152. package/dist/owletto/dist/assets/{use-mention-search-C3rWLuKm.js → use-mention-search-CJGCatFS.js} +3 -3
  153. package/dist/owletto/dist/assets/use-scroll-sentinel-BWCrmNIB.js +2 -0
  154. package/dist/owletto/dist/assets/view-param-filters-CDvwie_f.js +2 -0
  155. package/dist/owletto/dist/assets/views-access-required-CZ1fvAks.js +2 -0
  156. package/dist/owletto/dist/index.html +2 -2
  157. package/dist/server-main.bundle.mjs +56428 -52475
  158. package/dist/server.bundle.mjs +5 -5
  159. package/dist/verify.mjs +1 -1
  160. package/npm-shrinkwrap.json +277 -311
  161. package/package.json +3 -4
  162. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +8 -2
  163. package/vendor/connector-sdk/dist/reaction-sdk.d.ts +5 -1
  164. package/vendor/connector-sdk/package.json +1 -1
  165. package/vendor/core/dist/contracts/agent-settings.d.ts +61 -6
  166. package/vendor/core/dist/contracts/agent-settings.js +10 -7
  167. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +473 -98
  168. package/vendor/core/dist/contracts/tools/manage-agents.js +111 -2
  169. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +21 -18
  170. package/vendor/core/dist/contracts/tools/manage-automations.js +15 -15
  171. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
  172. package/vendor/core/dist/contracts/tools/manage-inference-providers.d.ts +445 -0
  173. package/vendor/core/dist/contracts/tools/manage-inference-providers.js +133 -0
  174. package/vendor/core/dist/contracts/tools/manage-views.d.ts +4 -4
  175. package/vendor/core/dist/contracts/tools/manage-views.js +5 -3
  176. package/vendor/core/dist/contracts/tools/view-host.d.ts +7 -0
  177. package/vendor/core/dist/contracts/tools/view-host.js +28 -0
  178. package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -4
  179. package/vendor/core/dist/contracts/tools/view-runtime.js +19 -7
  180. package/vendor/core/dist/contracts/worker/device-automation.js +4 -2
  181. package/vendor/core/dist/error-report.d.ts +73 -0
  182. package/vendor/core/dist/error-report.js +346 -0
  183. package/vendor/core/dist/index.d.ts +3 -1
  184. package/vendor/core/dist/index.js +4 -1
  185. package/vendor/core/dist/logger.js +7 -4
  186. package/vendor/core/dist/otel-fetch.d.ts +19 -0
  187. package/vendor/core/dist/otel-fetch.js +96 -0
  188. package/vendor/core/dist/otel.d.ts +9 -0
  189. package/vendor/core/dist/otel.js +28 -7
  190. package/vendor/core/dist/reserved.d.ts +1 -1
  191. package/vendor/core/dist/reserved.js +6 -4
  192. package/vendor/core/dist/tool-result.d.ts +8 -0
  193. package/vendor/core/dist/tool-result.js +61 -0
  194. package/vendor/core/dist/utils/diagnostic-scrubber.js +1 -1
  195. package/vendor/core/dist/worker/auth.js +4 -0
  196. package/vendor/core/package.json +16 -1
  197. package/vendor/views/dist/api.d.ts +9 -4
  198. package/vendor/views/dist/api.js +33 -2
  199. package/vendor/views/dist/bridge.d.ts +8 -0
  200. package/vendor/views/dist/bridge.js +12 -2
  201. package/vendor/views/dist/components.d.ts +4 -2
  202. package/vendor/views/dist/components.js +29 -14
  203. package/vendor/views/dist/index.d.ts +1 -1
  204. package/vendor/views/dist/index.js +1 -1
  205. package/vendor/views/dist/native.d.ts +327 -0
  206. package/vendor/views/dist/native.js +57 -0
  207. package/vendor/views/package.json +1 -1
  208. package/dist/owletto/dist/assets/_-DIK0ae_S.js +0 -2
  209. package/dist/owletto/dist/assets/_-gTbcArpS.js +0 -3
  210. package/dist/owletto/dist/assets/_agentId-DOmcJZfk.js +0 -2
  211. package/dist/owletto/dist/assets/_agentId-DW6wRCVC.js +0 -2
  212. package/dist/owletto/dist/assets/_automationId-B9IcDYBu.js +0 -2
  213. package/dist/owletto/dist/assets/_connectorKey._connectionId-C6PmMPTA.js +0 -2
  214. package/dist/owletto/dist/assets/_connectorKey.index-BrJ8Pzze.js +0 -2
  215. package/dist/owletto/dist/assets/_conversationId-BpJAeYYW.js +0 -2
  216. package/dist/owletto/dist/assets/_eventId-DarQJo0G.js +0 -2
  217. package/dist/owletto/dist/assets/_name-DtmNTcUm.js +0 -2
  218. package/dist/owletto/dist/assets/_owner-Db8at3hk.js +0 -3
  219. package/dist/owletto/dist/assets/_shape-6iFA8A86.js +0 -2
  220. package/dist/owletto/dist/assets/_skillKey-CXkHn3Nl.js +0 -2
  221. package/dist/owletto/dist/assets/_slug-DBOuBLoX.js +0 -2
  222. package/dist/owletto/dist/assets/_viewKey-DC27aIN9.js +0 -2
  223. package/dist/owletto/dist/assets/_viewKey-DuYDieln.js +0 -2
  224. package/dist/owletto/dist/assets/accept-invitation-BbDCVvur.js +0 -2
  225. package/dist/owletto/dist/assets/activity-route-view-V4ftmSN7.js +0 -2
  226. package/dist/owletto/dist/assets/agent-connect-pages-B-NPTFs6.js +0 -2
  227. package/dist/owletto/dist/assets/agent-editor-form-DfMTSIvj.js +0 -2
  228. package/dist/owletto/dist/assets/agent-guardrails-route-BvGgfd-h.js +0 -2
  229. package/dist/owletto/dist/assets/agent-skills-route-DFXr_bHp.js +0 -2
  230. package/dist/owletto/dist/assets/agent-subpage-shell-DWzljvFb.js +0 -2
  231. package/dist/owletto/dist/assets/agent-thread-DQIr20H-.js +0 -6
  232. package/dist/owletto/dist/assets/agents-CLbeiqTR.js +0 -2
  233. package/dist/owletto/dist/assets/agents-workbench-C8bTa2rv.js +0 -2
  234. package/dist/owletto/dist/assets/app._appId-Bsq40nak.js +0 -2
  235. package/dist/owletto/dist/assets/automation-detail-content-C9Cgr5Zj.js +0 -2
  236. package/dist/owletto/dist/assets/automations-CLbeiqTR.js +0 -2
  237. package/dist/owletto/dist/assets/calendar-DMq3Dtqy.js +0 -2
  238. package/dist/owletto/dist/assets/code-editor-rX0t1g5C.js +0 -16
  239. package/dist/owletto/dist/assets/connect-BcwgytDV.js +0 -2
  240. package/dist/owletto/dist/assets/connect-menu-BF-AlunU.js +0 -2
  241. package/dist/owletto/dist/assets/connect._clientId-sDypRDeN.js +0 -2
  242. package/dist/owletto/dist/assets/connected._clientId-C9OkW1tv.js +0 -2
  243. package/dist/owletto/dist/assets/connected._clientId.activity-Dc6HYr55.js +0 -2
  244. package/dist/owletto/dist/assets/connected._clientId.index-C6qbqgwF.js +0 -2
  245. package/dist/owletto/dist/assets/connection-88YzIBK9.js +0 -2
  246. package/dist/owletto/dist/assets/connector-provenance-Th8ymGec.js +0 -2
  247. package/dist/owletto/dist/assets/connectors-BqwgLUUK.js +0 -2
  248. package/dist/owletto/dist/assets/consent-BR5U7dwb.js +0 -2
  249. package/dist/owletto/dist/assets/copy-button-2swYh4jb.js +0 -2
  250. package/dist/owletto/dist/assets/create-BsPVnRpG.js +0 -2
  251. package/dist/owletto/dist/assets/create-CVPYVOR5.js +0 -2
  252. package/dist/owletto/dist/assets/create-QFjmhOEU.js +0 -2
  253. package/dist/owletto/dist/assets/create-automation-form-DmCOFbRT.js +0 -3
  254. package/dist/owletto/dist/assets/create._connectorKey-DLDDVtLS.js +0 -2
  255. package/dist/owletto/dist/assets/cronstrue-CKwjNYgj.js +0 -2
  256. package/dist/owletto/dist/assets/device-CKup7kvB.js +0 -2
  257. package/dist/owletto/dist/assets/device-pin-tombstone-xGhCTU5_.js +0 -2
  258. package/dist/owletto/dist/assets/device._deviceId-B1H_ivDT.js +0 -2
  259. package/dist/owletto/dist/assets/entity-avatar-HloBoalJ.js +0 -2
  260. package/dist/owletto/dist/assets/entity-options-BSW_EG0W.js +0 -2
  261. package/dist/owletto/dist/assets/entity-page-D-WDWrAe.js +0 -2
  262. package/dist/owletto/dist/assets/entity-type-page-BCBdFndu.js +0 -2
  263. package/dist/owletto/dist/assets/event-card-Mcxv56DG.js +0 -2
  264. package/dist/owletto/dist/assets/event-detail-DXifj49J.js +0 -2
  265. package/dist/owletto/dist/assets/filter-bar-BQm-ubB1.js +0 -2
  266. package/dist/owletto/dist/assets/guardrails-D7W80sJO.js +0 -2
  267. package/dist/owletto/dist/assets/identity-N0cAO9BR.js +0 -2
  268. package/dist/owletto/dist/assets/index-4gCDI7m4.js +0 -7950
  269. package/dist/owletto/dist/assets/index-BNaI5GpS.js +0 -2
  270. package/dist/owletto/dist/assets/index-BUUrHuJJ.js +0 -2
  271. package/dist/owletto/dist/assets/index-BqrvJmLh.js +0 -2
  272. package/dist/owletto/dist/assets/index-CnvQEA5V.js +0 -2
  273. package/dist/owletto/dist/assets/index-Cq7P2c_E.js +0 -2
  274. package/dist/owletto/dist/assets/index-D3omC3Us.js +0 -2
  275. package/dist/owletto/dist/assets/index-DDGdlQrt.css +0 -1
  276. package/dist/owletto/dist/assets/index-DFEW7hMg.js +0 -2
  277. package/dist/owletto/dist/assets/index-DVV-WWuT.js +0 -2
  278. package/dist/owletto/dist/assets/index-DduQ_e9q.js +0 -2
  279. package/dist/owletto/dist/assets/index-DutlI1d-.js +0 -2
  280. package/dist/owletto/dist/assets/index-wHFQv1aT.js +0 -12
  281. package/dist/owletto/dist/assets/json-diff-E5D-NGYT.js +0 -4
  282. package/dist/owletto/dist/assets/login-7F48UJGx.js +0 -2
  283. package/dist/owletto/dist/assets/memory-browse-page-CfDmjhDl.js +0 -74
  284. package/dist/owletto/dist/assets/model-Dn40BUzs.js +0 -2
  285. package/dist/owletto/dist/assets/model-selector-88PJnyTq.js +0 -2
  286. package/dist/owletto/dist/assets/models-BBK_n2RP.js +0 -2
  287. package/dist/owletto/dist/assets/new-4ruWHLR5.js +0 -2
  288. package/dist/owletto/dist/assets/new-gMD1PHTL.js +0 -2
  289. package/dist/owletto/dist/assets/oauth-workspace-access-D9BNmyMY.js +0 -2
  290. package/dist/owletto/dist/assets/organization-BHcp5Pzg.js +0 -2
  291. package/dist/owletto/dist/assets/peek-pane-content-0sa10jER.js +0 -2
  292. package/dist/owletto/dist/assets/permissions-hhxosugv.js +0 -2
  293. package/dist/owletto/dist/assets/proposal-review-shell-B4CSiyLB.js +0 -2
  294. package/dist/owletto/dist/assets/public-shell-ready-CsenJeXa.js +0 -2
  295. package/dist/owletto/dist/assets/record-activity-D7bRaMk2.js +0 -2
  296. package/dist/owletto/dist/assets/renderer-7EGgTVX0.js +0 -97
  297. package/dist/owletto/dist/assets/runs-panel-Bj63_hb9.js +0 -2
  298. package/dist/owletto/dist/assets/settings-Dg6nxKyw.js +0 -2
  299. package/dist/owletto/dist/assets/settings-KJJ6WihO.js +0 -2
  300. package/dist/owletto/dist/assets/skills-ayt06_o2.js +0 -2
  301. package/dist/owletto/dist/assets/use-scroll-sentinel-Ct-jt7O0.js +0 -2
  302. package/dist/owletto/dist/assets/view-param-filters-mKoqDsaD.js +0 -2
  303. package/dist/owletto/dist/assets/views-access-required-DHrDO333.js +0 -2
  304. /package/vendor/@better-auth-kysely-adapter/{.bun-tag-abf95749a412716 → .bun-tag-654b3a002b271269} +0 -0
  305. /package/vendor/postgres/{.bun-tag-22d644c2873790db → .bun-tag-c81dacd34e959a7a} +0 -0
@@ -1,2 +0,0 @@
1
- import{aE as Pe,aF as Se,aG as De,aQ as le,aN as ee,hp as Ye,fY as Qe,j as e,hq as se,B as j,L as B,aP as oe,gk as te,gl as ne,gm as U,hr as Ze,a5 as Je,hs as J,r as m,ht as be,hu as Ee,cH as es,hv as Ce,bT as M,hw as ke,H as w,bz as ss,bA as ts,bB as ns,bC as as,bD as rs,hl as is,I as S,bK as q,aa as z,A as we,hx as ls,hy as os,bo as _e,hz as cs,be as ce,hA as ds,hB as us,hC as Fe,hD as Be,hE as Le,d9 as Re,V as _,W as ae,hF as ms,fG as hs,hG as xs,em as Ke,S as k,fZ as T,v as H,hH as ps,dx as js,dz as fs,dy as gs,hI as G,hJ as vs,aA as Ns,u as de,f$ as ue,hK as ys,aT as bs,hL as Cs,hM as ks,fX as ws,aD as Ae,aC as As,aI as $s,b6 as Ps,aL as F,hN as Oe,bb as Ie,ba as me,b7 as Ss,h as Ds,hO as Es}from"./index-4gCDI7m4.js";import{C as _s,A as Fs}from"./connect-menu-BF-AlunU.js";import{C as Bs,A as Me,a as Ue}from"./connections-browser-DDJQh8Na.js";import{C as Ls}from"./connector-provenance-Th8ymGec.js";import{u as Rs}from"./runs-BPtQBTRN.js";import"./connection-label-BobuYiAG.js";import"./status-dot-D3FoDRcc.js";function Ks({ownerSlug:s,familyKind:t,familyId:a}){const n=t==="inference",l=Pe({enabled:n}),d=Se({enabled:n}),u=De({enabled:!n}),c=n?l:u,o=n?d.data?.find(r=>r.slug===a)?.displayName??a:le(a),p=(n?(l.data??[]).filter(r=>r.kind===a).map(r=>({key:`${ee}${r.slug}`,name:r.displayName||r.slug,status:[r.isDefault?"Default":null,r.status].filter(Boolean).join(" · ")})):(u.data?.sandboxes??[]).filter(r=>r.providerKind===a).map(r=>({key:`${Ye}${r.id}`,name:r.name,status:r.connected?"Connected":"Needs credentials"}))).map(r=>({id:r.key,name:r.name,description:r.status,tone:null,link:Qe({to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:r.key},search:{}})})),h=`${n?ee:oe}${a}`;return e.jsx(se,{header:e.jsx(te,{title:o,breadcrumb:e.jsx(ne,{crumbs:[e.jsx(B,{to:"/$owner/connectors",params:{owner:s},className:U,children:"Connectors"},"connectors")]})}),children:e.jsx(Bs,{entries:p,isLoading:c.isLoading,isError:c.isError,onRetry:()=>void c.refetch(),action:n?e.jsx(j,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(B,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:h},search:{addAccount:!0},children:"Add connection"})}):e.jsx(Me,{ownerSlug:s,connectorKey:h})})})}function Os({catalog:s,initialProvider:t,initialSlug:a,allowOAuth:n=!0,initialModel:l,onDone:d}){const u=Ze(),c=Je(),o=s.find(i=>i.slug===t)??s[0],p=n&&o&&J(o)?"oauth":"api-key",[h,r]=m.useState(o?.slug??""),[g,b]=m.useState(a??o?.slug??""),[x,N]=m.useState(o?.displayName??""),[v,A]=m.useState(o?.baseUrl??""),[E,$]=m.useState(l??o?.defaultModel??""),[D,V]=m.useState(""),[X,K]=m.useState(o?.apiKeyPlaceholder??""),[W,O]=m.useState(p),[L,Y]=m.useState(""),[C,re]=m.useState(null),[I,R]=m.useState(!1),[he,xe]=m.useState(!1),f=s.find(i=>i.slug===h),Q=be(f?.modalities??[]),pe=n&&!!f&&J(f),je=f?Ee(f):!1,fe=pe&&W==="oauth",ge=je&&!fe,P=es().slug,Z=m.useCallback(()=>{xe(!0),c.invalidateQueries({queryKey:["inference-providers"]})},[c]),Te=m.useCallback(()=>{c.invalidateQueries({queryKey:["inference-providers"]}),d()},[c,d]),ze=m.useCallback(async()=>{if(!(!P||!f)){R(!0);try{const i=await Ce(P,f.slug);if(i.mode!=="redirect")throw new Error("Unexpected sign-in mode");window.open(i.authorizeUrl,"_blank","noreferrer")}catch(i){M.error(i instanceof Error?i.message:"Failed to start sign-in")}finally{R(!1)}}},[P,f]),Ve=m.useCallback(async()=>{if(!(!P||!f||!L.trim())){R(!0);try{const i=await ke(P,f.slug,{code:L.trim()});if(i.status!=="success")throw new Error(i.error||"Sign-in not complete");Z(),M.success(`Signed in with ${f.displayName}`)}catch(i){M.error(i instanceof Error?i.message:"Failed to complete sign-in")}finally{R(!1)}}},[P,f,L,Z]),We=m.useCallback(async()=>{if(!(!P||!f)){R(!0);try{const i=await Ce(P,f.slug);if(i.mode!=="device")throw new Error("Unexpected sign-in mode");re({userCode:i.userCode,deviceAuthId:i.deviceAuthId,verificationUrl:i.verificationUrl}),window.open(i.verificationUrl,"_blank","noreferrer")}catch(i){M.error(i instanceof Error?i.message:"Failed to start sign-in")}finally{R(!1)}}},[P,f]),qe=m.useCallback(async()=>{if(!(!P||!f||!C)){R(!0);try{const i=await ke(P,f.slug,{deviceAuthId:C.deviceAuthId,userCode:C.userCode});if(i.status==="success"){Z(),M.success(`Signed in with ${f.displayName}`);return}re(y=>y&&{...y,message:i.error||"Waiting for approval..."})}catch(i){M.error(i instanceof Error?i.message:"Failed to check status")}finally{R(!1)}}},[P,f,C,Z]),Ge=f?.supportedAuthTypes.includes("device-code")??!1,He=i=>{r(i);const y=s.find(ie=>ie.slug===i);y&&(b(y.slug),N(y.displayName),A(y.baseUrl),$(y.slug===t&&l?l:y.defaultModel??""),K(y.apiKeyPlaceholder),O(n&&J(y)?"oauth":"api-key"),Y(""),re(null),xe(!1))},ve=/^[a-z0-9][a-z0-9-]*$/.test(g),Ne=ve&&ge&&D.trim().length>0&&!u.isPending,Xe=i=>{if(i.preventDefault(),!Ne)return;const y={};v.trim()&&(y.base_url=v.trim()),E.trim()&&(y.model=E.trim());const ie=Object.keys(y).length>0?{text:y}:void 0;u.mutate({slug:g.trim(),kind:h,displayName:x.trim()||void 0,apiKey:D.trim(),capabilities:ie},{onSuccess:()=>d()})},ye=!!(t&&s.some(i=>i.slug===t));return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:ye&&f?`Connect ${f.displayName}`:"Add an inference provider"}),e.jsxs("form",{onSubmit:Xe,className:"grid max-w-md gap-3",children:[ye&&f?e.jsx("p",{className:"text-xs text-muted-foreground",children:Q.length>0?`Serves text, plus ${Q.join(", ").toLowerCase()}.`:"Serves text (chat)."}):e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"ip-provider",children:"Provider"}),e.jsxs(ss,{value:h,onValueChange:He,children:[e.jsx(ts,{id:"ip-provider",className:"w-full",children:e.jsx(ns,{})}),e.jsx(as,{children:s.map(i=>{const y=be(i.modalities);return e.jsx(rs,{value:i.slug,children:e.jsxs("span",{className:"flex items-center gap-2",children:[i.iconUrl?e.jsx("img",{src:i.iconUrl,alt:"",className:"h-4 w-4 shrink-0 rounded-sm",loading:"lazy"}):e.jsx(is,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),i.displayName,y.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",y.join(", ")]}):null]})},i.slug)})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Q.length>0?`Serves text, plus ${Q.join(", ").toLowerCase()}.`:"Serves text (chat)."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"ip-display",children:"Name"}),e.jsx(S,{id:"ip-display",placeholder:"Friendly name",value:x,onChange:i=>N(i.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"ip-slug",children:["Slug ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"ip-slug",placeholder:"my-provider",value:g,onChange:i=>b(i.target.value),autoComplete:"off",required:!0}),g&&!ve?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."})]}),pe&&je?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{children:"Auth method"}),e.jsxs("div",{className:"inline-flex w-fit rounded-md border border-border p-1",children:[e.jsx(j,{type:"button",size:"sm",variant:W==="oauth"?"secondary":"ghost",onClick:()=>O("oauth"),children:"Sign in"}),e.jsx(j,{type:"button",size:"sm",variant:W==="api-key"?"secondary":"ghost",onClick:()=>O("api-key"),children:"API key"})]})]}):null,ge?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"ip-base-url",children:"Base URL"}),e.jsx(S,{id:"ip-base-url",placeholder:"https://api.example.com/v1",value:v,onChange:i=>A(i.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(w,{htmlFor:"ip-model",children:"Default model"}),e.jsx(S,{id:"ip-model",placeholder:"gpt-4o-mini",value:E,onChange:i=>$(i.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"ip-key",children:["API key ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"ip-key",type:"password",placeholder:X||void 0,value:D,onChange:i=>V(i.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(q,{onCancel:d,children:e.jsx(j,{type:"submit",disabled:!Ne,children:u.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:"lg",className:"mr-2"}),"Creating..."]}):"Create provider"})})]}):fe?e.jsxs("div",{className:"grid gap-3",children:[he?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Signed in with ",f?.displayName??"provider",". This covers your agents in this org."]}):Ge?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void We(),disabled:I||!P,children:C?"Get a new code":"Get device code"}),C?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"ip-device-code",children:"Device code"}),e.jsx(S,{id:"ip-device-code",readOnly:!0,value:C.userCode}),e.jsx(j,{type:"button",variant:"default",className:"justify-self-start",asChild:!0,children:e.jsxs("a",{href:C.verificationUrl,target:"_blank",rel:"noreferrer",children:["Open ",f?.displayName??"provider"," to approve",e.jsx(we,{className:"h-4 w-4"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:C.message||"We opened the approval page. Enter the code above if asked, approve, then check status."}),e.jsx(j,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void qe(),disabled:I,children:I?"Checking...":"Check status"})]}):null]}):e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(j,{type:"button",variant:"outline",className:"justify-self-start",onClick:()=>void ze(),disabled:I||!P,children:["Sign in with ",f?.displayName??"provider",e.jsx(we,{className:"h-4 w-4"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"ip-oauth-code",children:"Paste code#state"}),e.jsx(S,{id:"ip-oauth-code",placeholder:"code#state",value:L,onChange:i=>Y(i.target.value),autoComplete:"off"})]}),e.jsx(j,{type:"button",className:"justify-self-start",onClick:()=>void Ve(),disabled:I||!L.trim(),children:I?"Finishing...":"Finish sign-in"})]}),e.jsx(q,{onCancel:d,children:e.jsx(j,{type:"button",onClick:Te,disabled:!he,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(q,{onCancel:d})]})]})]})}const Is={text:"Text",image:"Image",stt:"Speech-to-text",tts:"Text-to-speech"};function Ms({provider:s,catalog:t,autoOpenEdit:a}){const n=ls(),[l,d]=m.useState(a?"edit":null),u=os(s.kind,t);m.useEffect(()=>{a&&d("edit")},[a]);const o=(t.find(r=>r.slug===s.kind)?.modalities??["text"]).filter(r=>r!=="text"),p=u&&o.length>0,h=r=>d(g=>g===r?null:r);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 ${_e(s.createdAt)}`:""]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.isDefault?null:e.jsx(j,{variant:"outline",size:"sm",className:"h-8 text-xs",disabled:n.isPending,onClick:()=>n.mutate({providerSlug:s.slug}),children:"Set as default"}),p?e.jsx(j,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>h("capabilities"),children:"Configure"}):null,e.jsx(j,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>h("edit"),children:"Edit"})]})]}),l==="edit"?e.jsx("div",{className:"border-t px-3 py-3",children:e.jsx(Ts,{provider:s,supportsUpstreamConfig:u,onDone:()=>d(null)})}):null,l==="capabilities"&&p?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."})]}),o.map(r=>e.jsx(zs,{providerSlug:s.slug,modality:r,block:s.capabilities[r]??{}},r))]})}):null]})}function Us({provider:s,onDeleted:t}){const a=cs(),[n,l]=m.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(j,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({providerSlug:s.slug},{onSuccess:t,onSettled:()=>l(!1)}),children:[a.isPending?e.jsx(z,{size:"md",className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(j,{variant:"ghost",size:"sm",disabled:a.isPending,onClick:()=>l(!1),children:"Cancel"})]}):e.jsxs(j,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",disabled:a.isPending,onClick:()=>l(!0),children:[e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete provider"]})})]})}function Ts({provider:s,supportsUpstreamConfig:t,onDone:a}){const n=ds(),l=us(),d=Fe(),[u,c]=m.useState(s.displayName??""),[o,p]=m.useState(""),h=s.capabilities.text??{},[r,g]=m.useState(h.base_url??""),[b,x]=m.useState(h.model??""),[N,v]=m.useState(null),A=u.trim().length>0&&u.trim()!==(s.displayName??""),E=t&&o.trim().length>0,$=r.trim()!==(h.base_url??""),D=b.trim()!==(h.model??""),V=t&&($||D),X={base_url:r.trim()||void 0,model:b.trim()||void 0,models_endpoint:h.models_endpoint},K=Be(X),W=t&&V&&Le(K),O=n.isPending||l.isPending||d.isPending,L=(A||E||V)&&!W&&!O,Y=async C=>{if(C.preventDefault(),!!L){v(null);try{await Promise.all([A?n.mutateAsync({providerSlug:s.slug,displayName:u.trim()}):Promise.resolve(),V?d.mutateAsync({providerSlug:s.slug,modality:"text",block:X}):Promise.resolve(),E?l.mutateAsync({providerSlug:s.slug,value:o.trim()}):Promise.resolve()]),a()}catch{v("Some changes could not be saved. Review the fields and try again.")}}};return e.jsxs("form",{onSubmit:Y,className:"grid max-w-md gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`edit-name-${s.slug}`,children:"Name"}),e.jsx(S,{id:`edit-name-${s.slug}`,value:u,onChange:C=>c(C.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(w,{htmlFor:`edit-base-${s.slug}`,children:"Base URL"}),e.jsx(S,{id:`edit-base-${s.slug}`,placeholder:"https://api.example.com/v1",value:r,onChange:C=>g(C.target.value),autoComplete:"off"}),K.base_url?e.jsx("p",{className:"text-xs text-destructive",children:K.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`edit-model-${s.slug}`,children:"Default model"}),e.jsx(S,{id:`edit-model-${s.slug}`,placeholder:"gpt-4o-mini",value:b,onChange:C=>x(C.target.value),autoComplete:"off"}),K.model?e.jsx("p",{className:"text-xs text-destructive",children:K.model}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`edit-key-${s.slug}`,children:"New API key"}),e.jsx(S,{id:`edit-key-${s.slug}`,type:"password",value:o,onChange:C=>p(C.target.value),autoComplete:"off",placeholder:"Leave blank to keep the current key"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter a value only to replace the stored key. The old key is discarded."})]})]}):null,N?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,e.jsx(q,{onCancel:a,children:e.jsx(j,{type:"submit",disabled:!L,children:O?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]})}function zs({providerSlug:s,modality:t,block:a}){const n=Fe(),[l,d]=m.useState(!1),[u,c]=m.useState(a.base_url??""),[o,p]=m.useState(a.model??""),[h,r]=m.useState(a.models_endpoint??""),[g,b]=m.useState(!!a.models_endpoint),x=!!(a.base_url||a.model||a.models_endpoint),N={base_url:u.trim()||void 0,model:o.trim()||void 0,models_endpoint:h.trim()||void 0},v=Be(N),A=Le(v),E=()=>{A||n.mutate({providerSlug:s,modality:t,block:N})};return e.jsxs("div",{className:Re,children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-left",onClick:()=>d($=>!$),children:[e.jsx("span",{className:"text-sm font-medium",children:Is[t]}),x?e.jsx(_,{variant:"outline",children:"Custom"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Static"})]}),l?e.jsxs("div",{className:"grid gap-3 border-t px-3 py-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`base-${s}-${t}`,children:"Base URL"}),e.jsx(S,{id:`base-${s}-${t}`,placeholder:"https://api.example.com/v1",value:u,onChange:$=>c($.target.value),autoComplete:"off"}),v.base_url?e.jsx("p",{className:"text-xs text-destructive",children:v.base_url}):null]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`model-${s}-${t}`,children:"Model"}),e.jsx(S,{id:`model-${s}-${t}`,placeholder:"gpt-4o-mini",value:o,onChange:$=>p($.target.value),autoComplete:"off"}),v.model?e.jsx("p",{className:"text-xs text-destructive",children:v.model}):null]}),g?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:`endpoint-${s}-${t}`,children:"Models endpoint"}),e.jsx(S,{id:`endpoint-${s}-${t}`,placeholder:"/v1/models",value:h,onChange:$=>r($.target.value),autoComplete:"off"}),v.models_endpoint?e.jsx("p",{className:"text-xs text-destructive",children:v.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:()=>b(!0),children:"Advanced"}),e.jsx(q,{onCancel:()=>d(!1),children:e.jsx(j,{size:"sm",disabled:A||n.isPending,onClick:E,children:n.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{size:"lg",className:"mr-2"}),"Saving..."]}):"Save"})})]}):null]})}function Vs({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(qs,{kind:s.providerKind}),e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx(_,{variant:"secondary",className:"h-4 px-1.5 py-0 text-[10px] uppercase tracking-wide",children:s.providerKind}),s.connected?e.jsx(_,{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(_,{variant:"destructive",className:"h-4 border-transparent bg-destructive/10 px-1.5 py-0 text-[10px] uppercase tracking-wide text-destructive",children:"No credential"})]}),t.length>0?e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:t.map(([a,n])=>`${a}: ${n}`).join(" | ")}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remote sandbox agents execute in instead of the built-in local runtime."}),s.connected?null:e.jsxs("div",{className:"flex gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("p",{children:"This sandbox has no vault credential. Delete it and re-add the provider with a valid key, or set the credential via the API."})]})]})})}function Ws({sandbox:s,onDeleted:t}){const a=ms(),[n,l]=m.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(ce,{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(j,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate({id:s.id},{onSuccess:t}),children:a.isPending?e.jsx(z,{}):"Delete permanently"}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>l(!1),children:"Cancel"})]}):e.jsx(j,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>l(!0),children:"Delete sandbox"})]})})}function qs({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(hs,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(xs,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}const Gs={data:!1,chat:!1,actions:!1,audience:!1,inference:!0,runtime:!1},Hs={data:!1,chat:!1,actions:!1,audience:!1,inference:!1,runtime:!0};function jt(){const{owner:s,connectorKey:t}=G.useParams(),{instances:a}=G.useSearch(),{kind:n,id:l}=vs(t);return e.jsx(Ns,{owner:s,children:({ownerSlug:d,organizationId:u,isWorkspaceLoading:c})=>{if(a&&(n==="inference"||n==="sandbox-provider"))return e.jsx(Ks,{ownerSlug:d,familyKind:n,familyId:l});switch(n){case"inference":return e.jsx(Qs,{ownerSlug:d,providerSlug:l});case"sandbox":return e.jsx(Ys,{ownerSlug:d,sandboxId:l});case"sandbox-provider":return e.jsx(Xs,{ownerSlug:d,providerKind:l});default:return e.jsx(st,{ownerSlug:d,organizationId:u,isWorkspaceLoading:c,connectorKey:t})}}})}function Xs({ownerSlug:s,providerKind:t}){const a=H();return m.useEffect(()=>{a({to:"/$owner/connectors/create/$connectorKey",params:{owner:s,connectorKey:`${oe}${t}`},replace:!0})},[a,s,t]),null}function Ys({ownerSlug:s,sandboxId:t}){const a=H(),{data:n,isLoading:l,isError:d,refetch:u}=De(),c=n?.sandboxes.find(p=>p.id===t)??null;if(l)return e.jsxs(F,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-6 w-6 rounded"}),e.jsx(k,{className:"h-5 w-40"})]}),e.jsx(k,{className:"h-24 w-full rounded-lg"})]});if(d)return e.jsx(F,{children:e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load this instance."}),e.jsx(j,{variant:"outline",onClick:()=>void u(),children:"Retry"})]})});if(!c)return e.jsxs(F,{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(j,{variant:"outline",size:"sm",onClick:()=>void a({to:"/$owner/connectors",params:{owner:s}}),children:"Back to connectors"})]});const o=c.name||le(c.providerKind);return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(se,{header:e.jsx(te,{breadcrumb:e.jsx(ne,{crumbs:[e.jsx(B,{to:"/$owner/connectors",params:{owner:s},className:U,children:"Connectors"},"connectors"),e.jsx(B,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${oe}${c.providerKind}`},search:{instances:!0},className:U,children:le(c.providerKind)},"family")]}),icon:e.jsx(me,{name:o,faviconDomain:Ss(c.providerKind)}),title:o,badge:e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"secondary",children:c.providerKind}),c.connected?e.jsx(_,{className:"border-transparent bg-emerald-500/10 text-emerald-500",children:"Connected"}):e.jsx(_,{variant:"destructive",children:"No credential"})]}),status:e.jsx(Ie,{facets:Hs})}),children:[e.jsx(Vs,{sandbox:c}),e.jsx(T,{title:"Settings",muted:!0,children:e.jsx(Ws,{sandbox:c,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})})]})})}function Qs({ownerSlug:s,providerSlug:t}){const a=H(),{model:n,reason:l,agentId:d,addAccount:u}=G.useSearch(),{data:c=[],isLoading:o,isError:p,refetch:h}=Pe(),r=Se(),{data:g=[],isLoading:b}=r,x=u?null:c.find(D=>D.slug===t)??null,N=g.find(D=>D.slug===(x?.kind??t))??null;if(o||b)return e.jsx("div",{children:e.jsxs(F,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-6 w-6 rounded"}),e.jsx(k,{className:"h-5 w-40"})]}),e.jsx(k,{className:"h-16 w-full rounded-lg"}),e.jsx(k,{className:"h-24 w-full rounded-lg"}),e.jsx(k,{className:"h-32 w-full rounded-lg"})]})});if(p)return e.jsx(F,{children:e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load this account."}),e.jsx(j,{variant:"outline",onClick:()=>void h(),children:"Retry"})]})});if(!x&&!N&&!r.isError)return e.jsxs(F,{className:"space-y-3",children:[e.jsx(Oe,{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 v=x?x.displayName||x.slug:N?.displayName||t,A=x!==null,E=l?e.jsx(et,{agentId:d,model:n,providerName:v}):n?e.jsx(Js,{providerName:v,model:n,isConnected:A}):null,$=e.jsx(te,{breadcrumb:e.jsx(ne,{crumbs:[e.jsx(B,{to:"/$owner/connectors",params:{owner:s},className:U,children:"Connectors"},"connectors"),...x?[e.jsx(B,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${ee}${x.kind}`},search:{instances:!0},className:U,children:N?.displayName??x.kind},"family")]:[]]}),icon:e.jsx(me,{iconUrl:N?.iconUrl,name:v}),title:v,badge:x?e.jsxs(e.Fragment,{children:[x.isDefault?e.jsx(_,{variant:"secondary",children:"Default"}):null,x.status?e.jsx(_,{variant:"outline",children:x.status}):null,x.hasCustomUpstream?e.jsx(_,{variant:"outline",children:"Custom upstream"}):null]}):null,status:e.jsx(Ie,{facets:Gs})});return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(se,{header:$,children:[E,e.jsx("div",{className:"space-y-6",children:x?e.jsx(Ms,{provider:x,catalog:g,autoOpenEdit:!!n}):e.jsx(Zs,{ownerSlug:s,providerSlug:t,existingSlugs:c.map(D=>D.slug),catalog:g,catalogError:r.isError?r.error:null,model:n})}),x?e.jsx(T,{title:"Settings",muted:!0,children:e.jsx(Us,{provider:x,onDeleted:()=>void a({to:"/$owner/connectors",params:{owner:s}})})}):null]})})}function Zs({ownerSlug:s,providerSlug:t,existingSlugs:a,catalog:n,catalogError:l,model:d}){const u=H(),c=n.find(h=>h.slug===t),o=a.includes(t)&&!!c&&J(c);let p=t;for(let h=2;a.includes(p);h++)p=`${t}-${h}`;return l?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load provider catalog."}),e.jsx("p",{className:"mt-1 text-xs",children:l instanceof Error?l.message:"Check the workspace URL and try again."})]})]})}):e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[o&&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(j,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(B,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:`${ee}${t}`},search:{},children:"Open existing connection"})})]}),(!o||c&&Ee(c))&&e.jsx(Os,{catalog:n,initialProvider:t,initialSlug:p,allowOAuth:!o,initialModel:d?.includes("/")?d.split("/").slice(1).join("/"):d,onDone:()=>void u({to:"/$owner/connectors",params:{owner:s}})},`${n.length}:${t}`)]})}function Js({providerName:s,model:t,isConnected:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review ",e.jsx("strong",{children:s})," for model"," ",e.jsx("strong",{children:t}),"."," ",a?"Its edit controls are open.":"It is not connected yet; add it to continue."]})]})})}function et({agentId:s,model:t,providerName:a}){return e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"This agent needs a model provider before it can reply."}),e.jsxs("p",{children:[s?e.jsxs("span",{children:["Agent ",e.jsx("strong",{children:s})," is"," "]}):null,"configured to use ",t?e.jsx("strong",{children:t}):"a model"," ","from ",e.jsx("strong",{children:a}),", but that provider is not ready in this workspace."]}),e.jsx("p",{children:"Connect the provider below, then retry the message."})]})]})})}function st({ownerSlug:s,organizationId:t,isWorkspaceLoading:a,connectorKey:n}){const{data:l=[],isLoading:d,isError:u,refetch:c}=As(t??""),{data:o=[],isLoading:p,isError:h,refetch:r}=$s(t??"",{connectorKey:n}),{setup:g}=G.useSearch(),b=G.useNavigate(),x=m.useMemo(()=>l.find(A=>A.key===n),[l,n]),N=m.useMemo(()=>Ps(n,l,{name:o[0]?.connector_name??n}),[n,l,o]);if(a||d)return e.jsx("div",{children:e.jsxs(F,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-6 w-6 rounded"}),e.jsx(k,{className:"h-5 w-40"})]}),e.jsx(k,{className:"h-16 w-full rounded-lg"}),e.jsx(k,{className:"h-24 w-full rounded-lg"}),e.jsx(k,{className:"h-32 w-full rounded-lg"})]})});if(u||h)return e.jsx(F,{children:e.jsxs("div",{role:"alert",className:"space-y-2",children:[e.jsx("p",{children:"Could not load this connector."}),e.jsx(j,{variant:"outline",onClick:()=>{c(),r()},children:"Retry"})]})});const v=x?e.jsx(nt,{connector:x,ownerSlug:s,organizationId:t??void 0,connectionCount:o.length}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Oe,{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.",o.length>0?" Existing connections keep working.":""]})]});return e.jsx("div",{className:"flex flex-1 flex-col",children:x&&t?e.jsx(tt,{hero:v,connector:x,organizationId:t,ownerSlug:s,connectorKey:n,connections:o,isLoading:p,openNewApp:g==="oauth_app",onNewAppHandled:()=>void b({search:A=>({...A,setup:void 0}),replace:!0})}):e.jsxs(F,{className:"space-y-6",children:[v,o.length>0&&!p?e.jsx(Ue,{section:!0,connections:o,ownerSlug:s,connectorKey:n}):p?e.jsx(k,{className:"h-8 w-40"}):e.jsx("div",{children:e.jsx(Me,{ownerSlug:s,connectorKey:n})})]})})}function tt({hero:s,connector:t,organizationId:a,ownerSlug:n,connectorKey:l,connections:d,isLoading:u,openNewApp:c,onNewAppHandled:o}){const{isAdmin:p,isLoading:h}=Ke(a),r=(t.operations_summary?.total??0)>0,g=e.jsx(_s,{connector:t,organizationId:a,ownerSlug:n,connections:d,openNewApp:c,onNewAppHandled:o});return e.jsxs(se,{header:s,children:[u?e.jsx(k,{className:"h-8 w-40"}):d.length>0?e.jsx(Ue,{section:!0,connections:d,connector:t,ownerSlug:n,connectorKey:l,action:g}):g,e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:auto-cols-fr sm:grid-flow-col",children:[e.jsx(ot,{connector:t,organizationId:a,ownerSlug:n}),r&&h?e.jsx(k,{className:"h-20 w-full rounded-lg"}):r&&p?e.jsx(lt,{connector:t,organizationId:a,ownerSlug:n}):r&&!p?e.jsx(T,{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,!u&&d.length>0?e.jsx(it,{connectorKey:l,organizationId:a,ownerSlug:n}):null]}),e.jsx(at,{connector:t,organizationId:a,ownerSlug:n})]})}function nt({connector:s,ownerSlug:t,organizationId:a,connectionCount:n}){return e.jsx(te,{breadcrumb:e.jsx(ne,{crumbs:[e.jsx(B,{to:"/$owner/connectors",params:{owner:t},className:U,children:"Connectors"},"connectors")]}),icon:e.jsx(me,{icon:s.icon,name:s.name,faviconDomain:s.favicon_domain??Es(s.auth_schema),className:"h-10 w-10"}),title:s.name,badge:e.jsxs(e.Fragment,{children:[e.jsx(Ls,{connectorDef:s,ownerSlug:t}),a?e.jsx(rt,{connector:s,organizationId:a,ownerSlug:t,connectionCount:n}):null]}),caption:s.description})}function at({connector:s,organizationId:t,ownerSlug:a}){const n=ys(s.auth_schema),l=bs(s.auth_schema),d=Cs(s.auth_schema),u=ks(s.auth_schema),c=n.some(N=>N.type==="env_keys"),o=n.some(N=>N.type==="browser"),p=l.some(N=>N.type==="interactive"),h=!!(d||u||c||o),r=ws(s),{data:g=[]}=Ae(t,{connectorKey:s.key,profileKind:"env"}),{data:b=[]}=Ae(t,{profileKind:"browser_session",connectorKey:s.key});return c&&g.length>0||o&&b.length>0||!h&&(r||p)?e.jsxs("div",{className:"space-y-6",children:[c&&g.length>0?e.jsx($e,{profiles:g,type:"env"}):null,o&&b.length>0?e.jsx($e,{profiles:b,type:"browser_session"}):null,h?null:r?e.jsx(T,{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(j,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(B,{to:"/$owner/connectors",params:{owner:a},search:{},children:"View devices"})})]})}):p?e.jsx(T,{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."]})}):null]}):null}function rt({connector:s,organizationId:t,ownerSlug:a,connectionCount:n}){const l=H(),{isAdmin:d}=Ke(t),u=ps(),[c,o]=m.useState(null),p=s.installed!==!1;if(!d||!p)return null;const h=n>0,r=u.isPending,g=()=>{o(null),u.mutate({connector_key:s.key},{onSuccess:()=>{l({to:"/$owner/connectors",params:{owner:a}})},onError:b=>{o(b instanceof Error?b.message:"Failed to remove connector")}})};return e.jsxs(js,{onOpenChange:()=>o(null),children:[e.jsx(fs,{asChild:!0,children:e.jsx(j,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive","aria-label":"Remove connector",title:"Remove connector",children:e.jsx(ce,{className:"h-3.5 w-3.5"})})}),e.jsxs(gs,{align:"start",className:"space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Remove ",s.name,"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Archives it in this workspace. Existing synced data stays in memory."}),h?e.jsxs("p",{className:"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,c?e.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:c}):null,e.jsxs(j,{variant:"destructive",size:"sm",disabled:r||h,onClick:g,children:[r?e.jsx(z,{size:"md",className:"mr-1.5"}):null,"Remove connector"]})]})]})}function it({connectorKey:s,organizationId:t,ownerSlug:a}){const n=de(),{data:l,isLoading:d}=Rs({connectorKey:s},{runTypes:void 0,status:void 0},a);if(d)return e.jsx(k,{className:"h-[62px] w-full rounded-lg"});const u=l?.pages[0],c=u?.total??0,o=u?.runs[0]?.created_at;return e.jsx(ue,{title:"Runs",summary:c===0?"No runs yet":`${c.toLocaleString()} ${c===1?"run":"runs"}${o?` · last ${_e(o)}`:""}`,onOpen:()=>n?.open({href:"",title:"Runs",connectorPanel:{section:"runs",connectorKey:s,organizationId:t,ownerSlug:a}})})}function lt({connector:s,organizationId:t,ownerSlug:a}){const n=de();return e.jsx(ue,{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 $e({profiles:s,type:t}){const a=t==="env"?"Credentials":"Browser sessions";return e.jsx(T,{title:a,children:e.jsx("div",{className:"space-y-2",children:s.map(n=>e.jsxs("div",{className:Ds(Re,"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(Fs,{status:n.status})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:n.slug})]},n.slug))})})}function ot({connector:s,organizationId:t,ownerSlug:a}){const n=de(),l=Object.keys(s.feeds_schema??{}).length;return l?e.jsx(ue,{title:"Feeds",summary:`${l} ${l===1?"feed type":"feed types"}`,onOpen:()=>n?.open({href:"",title:"Feeds",connectorPanel:{section:"feeds",connectorKey:s.key,organizationId:t,ownerSlug:a}})}):null}export{tt as ConnectorDetailShell,rt as ConnectorRemoveButton,jt as component};
2
- //# sourceMappingURL=_connectorKey.index-BrJ8Pzze.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,cu as j,h as m,iX as h,iY as p,iZ as d,i_ as u,i$ as w,r as M,au as C,aI as k,j0 as z}from"./index-4gCDI7m4.js";import{A as N}from"./agent-loading-shells-Dnmb6W5Y.js";import{s as b,R as y,A as I}from"./agent-thread-DQIr20H-.js";import"./app-bridge-C4nPtae3.js";import"./use-mention-search-C3rWLuKm.js";import"./index-wHFQv1aT.js";import"./use-automations-BHoV0dLs.js";import"./event-card-Mcxv56DG.js";import"./use-scroll-sentinel-Ct-jt7O0.js";import"./clients-C7Lnuc3S.js";import"./renderer-7EGgTVX0.js";import"./calendar-DMq3Dtqy.js";import"./table-DFcJRNk7.js";import"./card-SFtxv9f2.js";import"./json-diff-E5D-NGYT.js";import"./copy-button-2swYh4jb.js";import"./events-feed-BysC9HgU.js";import"./client-activity-scopes-boZOHuPW.js";import"./client-rows-BJ2PxM4J.js";const O={discord:{hex:`#${u.hex}`,path:u.path},gchat:{hex:`#${d.hex}`,path:d.path},slack:{hex:"#4A154B",path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},teams:{imgSrc:"https://www.google.com/s2/favicons?domain=teams.microsoft.com&sz=64"},telegram:{hex:`#${p.hex}`,path:p.path},whatsapp:{hex:`#${h.hex}`,path:h.path}};function T({platform:s,className:a}){const t=s?O[s]:null;return t?"imgSrc"in t?e.jsx("img",{src:t.imgSrc,alt:"","aria-hidden":"true",className:m("rounded-sm",a),loading:"lazy"}):e.jsx("svg",{viewBox:t.viewBox??"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:a,style:{color:t.hex},children:e.jsx("path",{d:t.path})}):e.jsx(j,{className:m("text-muted-foreground",a),"aria-hidden":"true"})}const L={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",web:"Web"};function R(s,a,t){return s==="slack"&&t?.teamId&&a?`https://app.slack.com/client/${t.teamId}/${a}`:null}function S({owner:s,agentId:a,conversationId:t}){const{data:n=[],isLoading:x}=w(a,t,{orgSlug:s}),i=M.useMemo(()=>n.map(o=>b(o,{showToolCalls:!0})).filter(o=>o!==null),[n]),[r,g]=t.split(":"),l=L[r]??"the source app",{org:f}=C(),{data:v=[]}=k(f?.id??"",{connectorKey:r}),A=v[0]?.config?.chatMetadata,c=R(r,g,A);return e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col pb-6",children:x?e.jsx(N,{readOnly:!0}):i.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:i,children:e.jsx(I,{readOnly:!0})}),c?e.jsxs("a",{href:c,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:r,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 ",l,"."]}),e.jsxs("span",{className:"ml-auto shrink-0 whitespace-nowrap font-medium text-foreground",children:["Open ",l," →"]})]}):null]})})}function e2(){const{owner:s,agentId:a,conversationId:t}=z.useParams();return e.jsx(S,{owner:s,agentId:a,conversationId:t})}export{e2 as component};
2
- //# sourceMappingURL=_conversationId-BpJAeYYW.js.map
@@ -1,2 +0,0 @@
1
- import{E as u,v,j as r,aA as x,ca as d,cb as f,cc as h,by as w,cd as j}from"./index-4gCDI7m4.js";import{E}from"./event-detail-DXifj49J.js";import"./events-feed-BysC9HgU.js";import"./event-card-Mcxv56DG.js";import"./use-scroll-sentinel-Ct-jt7O0.js";import"./use-automations-BHoV0dLs.js";import"./clients-C7Lnuc3S.js";import"./renderer-7EGgTVX0.js";import"./calendar-DMq3Dtqy.js";import"./table-DFcJRNk7.js";import"./card-SFtxv9f2.js";import"./json-diff-E5D-NGYT.js";import"./index-wHFQv1aT.js";import"./copy-button-2swYh4jb.js";import"./client-activity-scopes-boZOHuPW.js";import"./client-rows-BJ2PxM4J.js";import"./view-param-filters-mKoqDsaD.js";import"./app-bridge-C4nPtae3.js";import"./filter-bar-BQm-ubB1.js";function P({owner:e,eventId:t,viewKey:s}){const o=u({strict:!1}),p=v(),m=(i,a)=>r.jsx(E,{owner:a,organizationId:i,eventId:t,viewKey:s,params:s?f(o):{},onParamsChange:(n,l,c)=>void p({to:d(a,t,n),search:l,replace:c?.replace??!0}),fullBleed:!0},`${a}/${t}`);return r.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 pt-2.5 pb-8 lg:px-6",children:e==="me"?m(null,e):r.jsx(x,{owner:e,children:({organizationId:i,ownerSlug:a})=>i?m(i,a):r.jsx("div",{className:"mx-auto h-40 w-full max-w-3xl animate-pulse rounded-md bg-muted/40"})})})}function q(){const{owner:e,eventId:t}=h.useParams(),s=w({from:"/$owner/events/$eventId/-/views/$viewKey",shouldThrow:!1}),o=j(t);return o===null?null:r.jsx(P,{owner:e,eventId:o,viewKey:s?.viewKey})}export{q as component};
2
- //# sourceMappingURL=_eventId-DarQJo0G.js.map
@@ -1,2 +0,0 @@
1
- import{iW as a,j as e}from"./index-4gCDI7m4.js";import{b as i}from"./agent-guardrails-route-BvGgfd-h.js";import"./model-selector-88PJnyTq.js";import"./agent-subpage-shell-DWzljvFb.js";import"./table-DFcJRNk7.js";import"./agent-loading-shells-Dnmb6W5Y.js";import"./agent-card-controls-99mG6H5k.js";function x(){const{owner:t,agentId:r,name:o}=a.useParams();return e.jsx(i,{owner:t,agentId:r,name:o})}export{x as component};
2
- //# sourceMappingURL=_name-DtmNTcUm.js.map
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peek-pane-content-0sa10jER.js","assets/index-4gCDI7m4.js","assets/index-DDGdlQrt.css","assets/automation-detail-content-C9Cgr5Zj.js","assets/create-automation-form-DmCOFbRT.js","assets/cronstrue-CKwjNYgj.js","assets/entity-options-BSW_EG0W.js","assets/connection-label-BobuYiAG.js","assets/use-automations-BHoV0dLs.js","assets/model-selector-88PJnyTq.js","assets/skill-editor-D_W3QlRz.js","assets/code-editor-rX0t1g5C.js","assets/index-wHFQv1aT.js","assets/use-mention-search-C3rWLuKm.js","assets/proposal-review-shell-B4CSiyLB.js","assets/runs-BPtQBTRN.js","assets/events-feed-BysC9HgU.js","assets/event-card-Mcxv56DG.js","assets/use-scroll-sentinel-Ct-jt7O0.js","assets/clients-C7Lnuc3S.js","assets/renderer-7EGgTVX0.js","assets/calendar-DMq3Dtqy.js","assets/table-DFcJRNk7.js","assets/card-SFtxv9f2.js","assets/json-diff-E5D-NGYT.js","assets/copy-button-2swYh4jb.js","assets/client-activity-scopes-boZOHuPW.js","assets/client-rows-BJ2PxM4J.js","assets/agent-loading-shells-Dnmb6W5Y.js","assets/agent-thread-DQIr20H-.js","assets/app-bridge-C4nPtae3.js","assets/connection-feed-detail-D7pnWaFB.js","assets/runs-panel-Bj63_hb9.js","assets/filter-bar-BQm-ubB1.js","assets/feed-event-kinds-BYuZCoU4.js","assets/connect-menu-BF-AlunU.js","assets/connections-browser-DDJQh8Na.js","assets/status-dot-D3FoDRcc.js","assets/connector-scope-lists-BibdzKl1.js","assets/source-record-panels-Bh5F4C5K.js","assets/schema-type-editor-panel-CAhOB648.js","assets/entity-type-page-BCBdFndu.js","assets/event-detail-DXifj49J.js","assets/view-param-filters-mKoqDsaD.js","assets/views-access-required-DHrDO333.js","assets/record-session-CWXnCVln.js"])))=>i.map(i=>d[i]);
2
- import{p as x,j as e,r as u,C as b,L as g,u as w,a as k,b as v,c as y,D as j,d as N,e as P,f as R,g as _,h as I,i as E,k as D,B as f,l as S,A,X as C,m as L,_ as z,S as h,R as O,n as T,o as B,q as W,s as $,N as H,O as K}from"./index-4gCDI7m4.js";import{R as U}from"./record-session-CWXnCVln.js";function p({item:s}){const n=s.href?x(s.href):null;if(!n)return null;const t=n.owner,i=n.kind==="automation"?n.automationId:s.sourceAttribution?.automation_id??null,o=s.sourceAttribution,a=[{label:t,to:"/$owner",params:{owner:t}}];return o?.agent_id&&o.agent_name&&a.push({label:o.agent_name,to:"/$owner/agents/$agentId/settings",params:{owner:t,agentId:o.agent_id}}),i!=null&&a.push({label:o?.automation_name??"Automation",to:"/$owner/automations/$automationId",params:{owner:t,automationId:String(i)}}),(n.kind==="memory"||n.kind==="automation")&&"runId"in n&&n.runId!=null?a.push({label:"Run details"}):n.kind==="event"?a.push({label:"Event details"}):n.kind==="memory"&&"contentIds"in n&&a.push({label:"Details"}),a.length<2?null:e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-3 py-1.5 text-xs text-muted-foreground",children:a.map((r,l)=>{const c=l===a.length-1,d=e.jsx("span",{className:c?"truncate font-medium text-foreground":"whitespace-nowrap",children:r.label});return e.jsxs(u.Fragment,{children:[l>0?e.jsx(b,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}):null,r.to&&!c?e.jsx(g,{to:r.to,params:r.params,className:"whitespace-nowrap transition-colors hover:text-foreground",children:r.label}):d]},r.to??r.label)})})}const V=L(async()=>({default:(await z(async()=>{const{PeekPaneContent:s}=await import("./peek-pane-content-0sa10jER.js");return{PeekPaneContent:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]))).PeekPaneContent}));function q(){return e.jsxs("div",{"data-testid":"peek-pane-body-loading",className:"space-y-3 p-4",children:[e.jsx(h,{className:"h-5 w-2/3"}),e.jsx(h,{className:"h-4 w-full"}),e.jsx(h,{className:"h-24 w-full rounded-lg"})]})}const F=460,G=480;function M({children:s}){const n=u.useRef(null),t=w(),i=k(),o=v(n,F+G),a=!i&&o&&t?.item!=null;return e.jsxs("div",{ref:n,className:"relative flex min-h-0 flex-1 flex-row",children:[e.jsx("div",{inert:a,className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:s}),e.jsx(Q,{covers:a})]})}function Q({covers:s=!1}){const n=w(),t=k();return n?.item?e.jsx(J,{item:n.item,onClose:n.close,onBack:n.back,isNarrow:t,covers:s}):null}function X(s){const n=s.href?x(s.href):null,t=n?.kind==="record-view"?n.viewKey:null,i=n?.kind==="entity-type"?n:null,o=i?.typeSlug??null,a=E({slug:t?n?.owner:void 0}),{data:r}=D(o?n?.owner??null:null),l=o?r?.find(c=>c.slug===o)?.name:void 0;return t&&a.data?.find(c=>c.key===t)?.name||l&&(i?.view==="activity"?`${l} activity`:l)||s.title}function J({item:s,onClose:n,onBack:t,isNarrow:i,covers:o}){const a=s.href?y(s.href):null,r=X(s);u.useEffect(()=>{if(i)return;const d=m=>{m.key==="Escape"&&(m.preventDefault(),n())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n,i]);const l=d=>e.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[t||d?e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:t??n,children:e.jsx(S,{className:"h-4 w-4"})}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:r}),a?e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:e.jsx(g,{to:a.pathname,search:a.search??{},onClick:n,children:e.jsx(A,{className:"h-4 w-4"})})}):null,e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:n,children:e.jsx(C,{className:"h-4 w-4"})})]}),c=e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(u.Suspense,{fallback:e.jsx(q,{}),children:e.jsx(V,{item:s})})});return i?e.jsx(j,{open:!0,onOpenChange:d=>{d||n()},children:e.jsxs(N,{children:[e.jsx(P,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),e.jsxs(R,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[e.jsx(_,{className:"sr-only",children:r}),l(!0),e.jsx(p,{item:s}),c]})]})}):e.jsxs("aside",{className:I("flex flex-col border-l border-border bg-background",o?"absolute inset-0 z-30 w-full":"w-[460px] max-w-[45vw] shrink-0"),children:[l(!1),e.jsx(p,{item:s}),c]})}function ee(){const{owner:s}=O.useParams(),{data:n,isLoading:t,error:i}=T(s==="me"?null:s,{slug:s}),{session:o,isReady:a}=B(),r=W(i)&&!n?.workspace;return $({active:!t&&!r&&a&&!o&&!n?.workspace,owner:s})?null:e.jsx(H,{children:e.jsx(U,{children:e.jsx(M,{children:e.jsx(K,{})})})})}export{ee as component};
3
- //# sourceMappingURL=_owner-Db8at3hk.js.map
@@ -1,2 +0,0 @@
1
- import{iK as p,j as m,bx as i}from"./index-4gCDI7m4.js";import{M as e}from"./memory-browse-page-CfDmjhDl.js";import"./public-shell-ready-CsenJeXa.js";import"./connector-boxes-DDX7Ebc4.js";import"./connection-label-BobuYiAG.js";import"./connections-browser-DDJQh8Na.js";import"./status-dot-D3FoDRcc.js";import"./connector-scope-lists-BibdzKl1.js";import"./use-automations-BHoV0dLs.js";import"./model-Dn40BUzs.js";import"./cronstrue-CKwjNYgj.js";import"./feed-event-kinds-BYuZCoU4.js";import"./schema-type-editor-panel-CAhOB648.js";import"./entity-type-page-BCBdFndu.js";import"./json-diff-E5D-NGYT.js";import"./index-wHFQv1aT.js";import"./code-editor-rX0t1g5C.js";import"./renderer-7EGgTVX0.js";import"./calendar-DMq3Dtqy.js";import"./table-DFcJRNk7.js";import"./card-SFtxv9f2.js";import"./entity-avatar-HloBoalJ.js";import"./filter-bar-BQm-ubB1.js";import"./core.esm-CHnfRiEM.js";import"./view-param-filters-mKoqDsaD.js";import"./app-bridge-C4nPtae3.js";import"./member-scope-gate-vp3FihBD.js";function A(){const{owner:t,entityType:o,shape:r}=p.useParams();return m.jsx(e,{ownerSlug:t,typeScope:i(o),create:!1,shape:r})}export{A as component};
2
- //# sourceMappingURL=_shape-6iFA8A86.js.map
@@ -1,2 +0,0 @@
1
- import{iU as r,j as e}from"./index-4gCDI7m4.js";import{b as m}from"./agent-skills-route-DFXr_bHp.js";import"./agent-skill-context-V__2i6Vl.js";import"./core.esm-CHnfRiEM.js";import"./skill-editor-D_W3QlRz.js";import"./agent-subpage-shell-DWzljvFb.js";import"./agent-loading-shells-Dnmb6W5Y.js";import"./agent-card-controls-99mG6H5k.js";function c(){const{owner:t,agentId:o,skillKey:i}=r.useParams();return e.jsx(m,{owner:t,agentId:o,skillKey:i})}export{c as component};
2
- //# sourceMappingURL=_skillKey-CXkHn3Nl.js.map
@@ -1,2 +0,0 @@
1
- import{gj as m,t as d,v as x,fL as y,f1 as c,j as t,bJ as g}from"./index-4gCDI7m4.js";import{E as u}from"./entity-type-page-BCBdFndu.js";import"./json-diff-E5D-NGYT.js";import"./index-wHFQv1aT.js";import"./code-editor-rX0t1g5C.js";function b(){const{owner:a,slug:n}=m.useParams(),{orgContext:s}=d(),o=x(),{data:i=[],isLoading:p}=y(s),e=i.find(l=>l.slug===n)??null,r=e?c(e):!1;return t.jsx("div",{className:"flex flex-1 flex-col gap-4 px-4 pt-2.5 pb-8 lg:px-6",children:t.jsx("div",{className:"max-w-3xl",children:p?t.jsx(g,{label:"entity type",variant:"panel"}):e?t.jsx(u,{entityType:e,orgContext:s,hideDelete:r,onClose:()=>{o({to:"/$owner/data",params:{owner:a}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{b as component};
2
- //# sourceMappingURL=_slug-DBOuBLoX.js.map
@@ -1,2 +0,0 @@
1
- import{iR as t,j as m}from"./index-4gCDI7m4.js";import{M as i}from"./memory-browse-page-CfDmjhDl.js";import"./public-shell-ready-CsenJeXa.js";import"./connector-boxes-DDX7Ebc4.js";import"./connection-label-BobuYiAG.js";import"./connections-browser-DDJQh8Na.js";import"./status-dot-D3FoDRcc.js";import"./connector-scope-lists-BibdzKl1.js";import"./use-automations-BHoV0dLs.js";import"./model-Dn40BUzs.js";import"./cronstrue-CKwjNYgj.js";import"./feed-event-kinds-BYuZCoU4.js";import"./schema-type-editor-panel-CAhOB648.js";import"./entity-type-page-BCBdFndu.js";import"./json-diff-E5D-NGYT.js";import"./index-wHFQv1aT.js";import"./code-editor-rX0t1g5C.js";import"./renderer-7EGgTVX0.js";import"./calendar-DMq3Dtqy.js";import"./table-DFcJRNk7.js";import"./card-SFtxv9f2.js";import"./entity-avatar-HloBoalJ.js";import"./filter-bar-BQm-ubB1.js";import"./core.esm-CHnfRiEM.js";import"./view-param-filters-mKoqDsaD.js";import"./app-bridge-C4nPtae3.js";import"./member-scope-gate-vp3FihBD.js";function k(){const{owner:o,viewKey:r}=t.useParams();return m.jsx(i,{ownerSlug:o,create:!1,viewKey:r})}export{k as component};
2
- //# sourceMappingURL=_viewKey-DC27aIN9.js.map
@@ -1,2 +0,0 @@
1
- import{j1 as p,j as i,bx as m}from"./index-4gCDI7m4.js";import{M as e}from"./memory-browse-page-CfDmjhDl.js";import"./public-shell-ready-CsenJeXa.js";import"./connector-boxes-DDX7Ebc4.js";import"./connection-label-BobuYiAG.js";import"./connections-browser-DDJQh8Na.js";import"./status-dot-D3FoDRcc.js";import"./connector-scope-lists-BibdzKl1.js";import"./use-automations-BHoV0dLs.js";import"./model-Dn40BUzs.js";import"./cronstrue-CKwjNYgj.js";import"./feed-event-kinds-BYuZCoU4.js";import"./schema-type-editor-panel-CAhOB648.js";import"./entity-type-page-BCBdFndu.js";import"./json-diff-E5D-NGYT.js";import"./index-wHFQv1aT.js";import"./code-editor-rX0t1g5C.js";import"./renderer-7EGgTVX0.js";import"./calendar-DMq3Dtqy.js";import"./table-DFcJRNk7.js";import"./card-SFtxv9f2.js";import"./entity-avatar-HloBoalJ.js";import"./filter-bar-BQm-ubB1.js";import"./core.esm-CHnfRiEM.js";import"./view-param-filters-mKoqDsaD.js";import"./app-bridge-C4nPtae3.js";import"./member-scope-gate-vp3FihBD.js";function z(){const{owner:t,entityType:o,viewKey:r}=p.useParams();return i.jsx(e,{ownerSlug:t,typeScope:m(o),create:!1,viewKey:r})}export{z as component};
2
- //# sourceMappingURL=_viewKey-DuYDieln.js.map
@@ -1,2 +0,0 @@
1
- import{o as l,ai as u,r as c,Q as m,j as e,aj as d,ak as h,al as f,a5 as v,am as x,ag as g}from"./index-4gCDI7m4.js";import{F as p}from"./full-page-spinner-BMiXl54z.js";function j({alt:t="",...n}){return e.jsx("img",{alt:t,...n,referrerPolicy:"no-referrer"})}function w({children:t}){const n=v(),a=async i=>{await n.invalidateQueries({queryKey:["organizations"]}),i()};return e.jsx(x,{authClient:g,navigate:i=>{a(()=>{window.location.href=i})},replace:i=>{a(()=>window.location.replace(i))},Link:({href:i,children:s,className:r})=>e.jsx("a",{href:i,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:j},children:t})}function y(){const{session:t,sessionResult:n}=l(),{invitationId:a}=u.useSearch(),i=c.useRef(!1);return c.useEffect(()=>{n.isPending||t||!a||i.current||(i.current=!0,(async()=>{let s=null;try{const o=await fetch(`${m}/api/invitation-preview?id=${encodeURIComponent(a)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(a)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[t,n.isPending,a]),t&&!a?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):t?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(w,{children:e.jsx(h,{children:e.jsx(f,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{y as component};
2
- //# sourceMappingURL=accept-invitation-BbDCVvur.js.map
@@ -1,2 +0,0 @@
1
- import{t as at,au as H,cg as C,bx as R,ch as W,r as y,v as V,ar as it,ci as ot,j as t,bJ as D,b4 as A,cj as ct,ck as z,cl as lt,cm as U,B as _,L as g,cn as G,co as rt,bq as dt,bt as ut,bd as mt,cp as xt,cq as ht,cr as L,cs as pt,ct as K,cu as q,cv as Y,bj as J,cw as ft,aI as gt,cx as vt,h as Z,cy as jt,cz as bt,cA as Q,cB as wt,u as yt,cC as kt,cD as Nt,c as X,cE as It,cF as $t,cG as _t,aA as At}from"./index-4gCDI7m4.js";import{R as Et,E as Rt,S as Ct,N as P,M as Lt}from"./record-activity-D7bRaMk2.js";import{M as Mt}from"./member-scope-gate-vp3FihBD.js";import{u as St}from"./client-activity-scopes-boZOHuPW.js";import{a as Tt}from"./client-rows-BJ2PxM4J.js";import{P as Pt}from"./public-shell-ready-CsenJeXa.js";function Ft({organizationId:s,ownerSlug:n,typeScope:c,entityScope:i,attentionOnly:l=!1}){const{orgContext:r}=at(),{isMember:o,isLoading:a}=H(),p=o&&!!s,{attentionItems:e,isError:u}=C(n),d=c?R(c):void 0,m=!i&&!d,{feeds:x,rows:f,pageRows:v}=W(s,e),N=y.useMemo(()=>new Set(v.flatMap(({item:T})=>T.approvalRunId!=null?[T.approvalRunId]:[])),[v]),E=V(),I=()=>void E({to:"/$owner",params:{owner:n},search:{attention:"1"}}),{data:b,isLoading:h,error:k}=it(i?`/${n}/${ot(i)}`:`/${n}`,r),w=i?b?.entity:void 0,j=(i?w?.entity_type??R(i.split("/").at(-2)??""):d)==="$member",et=i!=null&&!h&&(k!=null||b?.entity==null),$=i?void 0:b?.counts,nt=$?$.connections>0||$.agents>0:!1,st=p&&!a&&!h&&$!=null&&!nt,S=i&&h?t.jsx(D,{label:"Loading record…"}):et?t.jsx(A,{icon:ct,title:"Record not found",description:"It may have been deleted, or it may live in a workspace you can't access."}):l&&m?t.jsx(Ot,{owner:n,items:f,isError:u}):w?t.jsx(Et,{ownerSlug:n,entity:w,organizationId:s}):t.jsx(Rt,{organizationId:s,ownerSlug:n,hideSourceFilter:!0,scopedEntityTypes:d?[d]:void 0,pinned:m&&(v.length>0||x.length>0)?{rows:t.jsx(z,{owner:n,organizationId:s,feeds:x,rows:v}),hiddenApprovalRunIds:N}:void 0,onShowNotifications:m?I:void 0,emptyState:st?t.jsx(Ht,{ownerSlug:n}):void 0});return t.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:j?t.jsx(Mt,{children:S}):S})}function Ot({owner:s,items:n,isError:c}){const i=V();return t.jsxs("section",{"aria-label":"Notifications",className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2.5",children:[t.jsx("span",{className:"mr-auto text-sm text-muted-foreground tabular-nums",children:n.length>0?`${n.length} ${n.length===1?"notification":"notifications"}`:null}),t.jsx(Bt,{owner:s}),t.jsx(Ct,{value:P.value,withNotifications:!0,onChange:l=>{if(l===P.value)return;const[r,o]=l.split("-");i({to:"/$owner",params:{owner:s},search:lt({sortBy:r,sortOrder:o})})}})]}),c?t.jsx("p",{className:"px-3 text-sm text-destructive",children:"Could not load notifications."}):n.length===0?t.jsx(A,{icon:U,title:"All caught up",description:"Nothing needs you right now.",children:t.jsx(_,{asChild:!0,variant:"outline",className:"mt-4",children:t.jsx(g,{to:"/$owner",params:{owner:s},children:"See all activity"})})}):t.jsx(G,{owner:s,rows:n})]})}function Bt({owner:s}){const{visibleUnreadIds:n,markVisibleRead:c,bulkPending:i}=C(s);return n.length===0?null:t.jsxs(_,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-muted-foreground",disabled:i,onClick:()=>void c(),children:[t.jsx(U,{className:"mr-1.5 h-3.5 w-3.5"}),"Mark all as read"]})}function Ht({ownerSlug:s}){return t.jsx("div",{className:"px-6",children:t.jsx(A,{icon:rt,title:"Nothing to catch up on — yet",description:"No notifications here. Add a connector to bring in data, or bring your agent to Lobu and give it something to work with.",children:t.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[t.jsx(_,{asChild:!0,children:t.jsxs(g,{to:"/$owner/connectors/create",params:{owner:s},children:[t.jsx(dt,{className:"mr-2 h-4 w-4"}),"Add a connector"]})}),t.jsx(_,{asChild:!0,variant:"outline",children:t.jsxs(g,{to:"/$owner/agents",params:{owner:s},children:[t.jsx(ut,{className:"mr-2 h-4 w-4"}),"Connect agent"]})})]})})})}const F=12,Wt=5e3;function Vt(s,n){const c=!!s&&!!n.organizationId&&(n.enabled??!0),i=mt({enabled:c}),{data:l}=i,r=l??[],o=y.useMemo(()=>r.map(x=>x.agentId),[r]),{threads:a,isLoading:p,isError:e}=xt(s,o,{enabled:c&&o.length>0,limit:F}),u=St({enabled:c,limit:F,excludeCommandClients:!1,organizationId:n.organizationId,refetchInterval:x=>x?Wt:!1}),d=n.organizationId?u.data:void 0;return{items:y.useMemo(()=>[...a.map(x=>({kind:"conversation",at:x.updatedAt,thread:x})),...(d??[]).map(x=>({kind:"mcp",at:x.lastCallAt,conversation:x}))].sort((x,f)=>f.at-x.at),[d,a]),agents:r,isLoading:c&&(i.isLoading||p||u.isLoading),isError:i.isError||e||u.isError}}function Dt(s){return s==="attention"?{attention:"1"}:s==="all"?{}:{tab:s}}function zt(s,n,c,i=[]){const l=new Map(i.map(e=>[e.id,e])),r=new Map;for(const e of[...n.filter(u=>u.kind==="notification"),...c])r.set(e.notification_id!=null?`n:${e.notification_id}`:e.id,e);const o=new Set([...r.values()].flatMap(e=>e.run_id!=null?[e.run_id]:[])),a=new Map,p=new Set(n.flatMap(e=>e.kind==="automation_due"&&e.run_id!=null?[e.run_id]:[]));for(const e of[...n.filter(u=>u.kind!=="notification"&&(u.kind==="automation_due"||u.run_id==null||!p.has(u.run_id))&&(u.run_id==null||!o.has(u.run_id))),...r.values()])a.set(e.id,e);return[...a.values()].map(e=>{const u=e.connection_id!=null?l.get(e.connection_id):void 0,d={...e,platform:e.platform||u?.connector_key,connection_name:e.connection_name||u?.display_name},m=e.kind==="notification"?"notification":e.kind==="sync"?"feed":e.kind==="automation_run"||e.kind==="automation_due"?"automation":"run",x=m==="automation"&&e.automation_id!=null?`automation:${e.automation_id}`:(m==="feed"||m==="run")&&e.connection_id!=null?`connection:${e.connection_id}`:null;return{id:e.id,at:new Date(e.at).getTime(),title:e.title,detail:e.kind==="run"&&e.status&&!L(e.status)?e.status:e.body||e.status,kind:m,subject:x,subjectLabel:e.automation_name||d.connection_name||e.title,href:m!=="notification"&&e.run_id!=null?m==="automation"&&e.automation_id!=null?`/${s}/automations/${e.automation_id}?run_id=${e.run_id}`:`/${s}/events?run_ids=${e.run_id}`:e.href,card:e,source:d}})}function Ut(s,n,c){return n.map(i=>{if(i.kind==="mcp"){const e=i.conversation,u=s==="me"||e.organizationId==null?"/me/events":`/${s}/agents/connected/${encodeURIComponent(e.clientId)}/activity`,d=new URLSearchParams({mcp_activity_id:e.activityId});return(s==="me"||e.organizationId==null)&&d.set("client_ids",e.clientId),{id:`client:${e.clientId}:${e.activityId}`,at:i.at,title:Tt(e),detail:`${e.clientName||"Connected app"} · ${e.callCount} ${e.callCount===1?"call":"calls"}${e.isLive?" · Active":""}`,href:`${u}?${d}`,kind:"session",subject:`client:${e.clientId}`,subjectLabel:e.clientName||"Connected app",source:{client_id:e.clientId,client_name:e.clientName}}}const l=i.thread,r=c.get(l.agentId)||"Agent",o=l.platform||"web",a=ht(s,l.agentId,l.id),p=o==="web"?Object.entries(a.params).reduce((e,[u,d])=>e.replace(`$${u}`,encodeURIComponent(d)),a.to):`/${s}/agents/${encodeURIComponent(l.agentId)}/conversations/${encodeURIComponent(l.conversationId??l.id)}`;return{id:`thread:${l.agentId}:${l.id}`,at:i.at,title:l.title||"Conversation",detail:`${r} · ${o==="web"?"Chat":o}${l.isRunning?" · Active":""}`,href:p,kind:"session",subject:`agent:${l.agentId}`,subjectLabel:r,source:{agent_id:l.agentId,agent_name:r,platform:o==="web"?null:o}}})}function Gt(s){const n=new Map;for(const c of[...s].sort((i,l)=>l.at-i.at||i.id.localeCompare(l.id))){const i=new Date(c.at),l=`${i.getFullYear()}-${i.getMonth()}-${i.getDate()}`,r=c.subject?`${c.kind}:${c.subject}:${l}`:c.id,o=n.get(r)??{key:r,entries:[]};o.entries.push(c),n.set(r,o)}return[...n.values()]}const O=[{view:"all",label:"Activity",icon:pt},{view:"attention",label:"Needs attention",icon:K},{view:"sessions",label:"Sessions",icon:q},{view:"feeds",label:"Feeds",icon:Y},{view:"automations",label:"Automations",icon:J}];function Kt({owner:s,view:n,organizationId:c}){const{isMember:i,isPublic:l,isLoading:r}=H(s),o=l&&!i&&!r,a=o&&(n==="attention"||n==="sessions")?"all":n,p=o?O.filter(h=>h.view!=="attention"&&h.view!=="sessions"):O,{data:e=[]}=ft(c),{data:u=[]}=gt(a==="all"||a==="feeds"||a==="automations"?c:null),d=C(o?null:s),m=W(o?null:c,d.attentionItems),x=a==="all"&&(m.feeds.length>0||m.pageRows.length>0),f=Vt(s,{organizationId:c,enabled:!o&&(a==="all"||a==="sessions")}),v=vt(a==="attention"||a==="sessions"?null:s,{limit:50,aggregate:!1,includeRuns:!0,includeNotifications:!1,kinds:a==="feeds"?["sync"]:a==="automations"?["automation","automation_due"]:void 0}),N=y.useMemo(()=>{const h=new Map(f.agents.map(j=>[j.agentId,j.name])),k=a==="all"||a==="sessions"?Ut(s,f.items,h):[],w=a==="attention"?[]:zt(s,[...v.data??[],...a==="all"?d.notificationCards:[]],a==="all"?d.attentionCards:[],u),M=new Set(a==="all"?m.pageRows.map(({item:j})=>j.id):[]);return Gt([...w,...k].filter(j=>!M.has(j.id)))},[s,m.pageRows,a,f.agents,f.items,v.data,u,d.attentionCards,d.notificationCards]),E=c==null||(a==="attention"?d.isLoading:a!=="sessions"&&v.isLoading||(a==="all"||a==="sessions")&&f.isLoading||a==="all"&&d.isLoading),I=a==="attention"?d.isError:a!=="sessions"&&v.isError||(a==="all"||a==="sessions")&&f.isError||a==="all"&&d.isError,b=a==="attention"?d.attentionItems.length===0:N.length===0&&!x;return t.jsxs("section",{"aria-label":"Home activity",className:"flex min-w-0 flex-col gap-4",children:[t.jsx("nav",{"aria-label":"Activity views",className:"flex flex-wrap items-center gap-1.5",children:p.map(({view:h,label:k,icon:w})=>t.jsxs(g,{to:"/$owner",params:{owner:s},search:Dt(h),activeOptions:{exact:!0},"aria-current":a===h?"page":void 0,className:Z("inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors",a===h?"bg-secondary text-secondary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[t.jsx(w,{"aria-hidden":"true",className:"size-3.5"}),k,h==="attention"&&d.attentionItems.length>0?t.jsx("span",{className:"text-xs tabular-nums",children:d.attentionItems.length}):null]},h))}),a==="attention"?t.jsx(jt,{owner:s}):null,I?t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Some activity could not be loaded. Refresh to try again."}):null,E&&b?t.jsx(D,{label:"activity"}):b?I?null:t.jsx(A,{icon:bt,title:a==="attention"?"All caught up":o?"No public activity":"No recent activity",description:a==="attention"?"Nothing needs you right now.":o?"Runs on this workspace's public connections show up here.":"New activity will appear here as your agents, apps, and feeds work."}):a==="attention"?t.jsx(G,{owner:s,rows:m.rows}):t.jsxs(t.Fragment,{children:[x?t.jsx("div",{className:"space-y-1",children:t.jsx(z,{owner:s,organizationId:c,feeds:m.feeds,rows:m.pageRows})}):null,t.jsx("ul",{className:"divide-y divide-border/60",children:N.map(h=>t.jsx("li",{children:t.jsx(qt,{owner:s,group:h,connectorDefinitions:e})},h.key))})]}),!b&&a!=="attention"?t.jsxs("div",{className:"flex flex-wrap gap-4 pt-2 text-xs text-muted-foreground",children:[o&&a==="all"?t.jsx(g,{to:"/$owner/data",params:{owner:s},children:"Browse memory"}):null,a==="all"||a==="feeds"?t.jsx(g,{to:"/$owner/connectors",params:{owner:s},children:"Browse feeds"}):null,a==="all"||a==="automations"?t.jsx(g,{to:"/$owner/automations",params:{owner:s},children:"Automation history"}):null,a==="sessions"?t.jsx(g,{to:"/$owner/agents",params:{owner:s},children:"Browse agents and apps"}):null]}):null]})}function qt({owner:s,group:n,connectorDefinitions:c}){const[i,l]=y.useState(!1),r=y.useId(),o=n.entries[0];if(n.entries.length===1)return t.jsx(B,{owner:s,entry:o,connectorDefinitions:c});const a=n.entries.filter(e=>L(e.card?.status??"")).length,p=o.kind==="session"?"sessions":o.kind==="feed"?"syncs":o.kind==="run"?"operations":"runs";return t.jsxs("div",{children:[t.jsxs("button",{type:"button","aria-expanded":i,"aria-controls":r,onClick:()=>l(!i),className:"flex w-full items-center gap-3 rounded-md px-2 py-3 text-left hover:bg-accent/60",children:[t.jsx(tt,{entry:o,connectorDefinitions:c}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium",children:o.subjectLabel}),t.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[n.entries.length," recent ",p,a>0?t.jsxs("span",{className:"text-destructive",children:[" · ",a," failed"]}):null,o.kind==="session"?null:` · ${o.detail??""}`]})]}),t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Q(o.at)}),t.jsx(wt,{"aria-hidden":!0,className:Z("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",i&&"rotate-180")})]}),t.jsxs("ul",{id:r,hidden:!i,className:"ml-4 border-l pl-3",children:[i?n.entries.map(e=>t.jsx("li",{children:t.jsx(B,{owner:s,entry:e,connectorDefinitions:c})},e.id)):null,i&&o.card?.href?t.jsx("li",{children:t.jsx(Yt,{entry:o})}):null]})]})}function Yt({entry:s}){const n=X(s.card?.href??"");return t.jsx(g,{to:n.pathname,search:n.search,className:"inline-block px-2 py-2 text-xs text-muted-foreground hover:text-foreground",children:s.kind==="automation"?"View Automation history":"View connection history"})}function tt({entry:s,connectorDefinitions:n}){const c=s.kind==="session"?q:s.kind==="feed"?Y:s.kind==="automation"?J:It;return t.jsx("span",{"aria-hidden":!0,className:"flex h-5 w-5 shrink-0 items-center justify-center",children:t.jsx($t,{source:s.source,connectorDefinitions:n,label:s.subjectLabel,fallback:t.jsx(c,{className:"h-4 w-4 text-muted-foreground"})})})}function B({owner:s,entry:n,connectorDefinitions:c}){const i=yt();if(n.kind==="notification"&&n.card)return t.jsx(kt,{owner:s,item:Nt({...n.card,...n.source})});const l=t.jsxs(t.Fragment,{children:[t.jsx(tt,{entry:n,connectorDefinitions:c}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium",children:n.title}),t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[L(n.card?.status??"")?t.jsx(K,{"aria-label":"Failed",className:"h-3 w-3 shrink-0 text-destructive"}):null,t.jsx("span",{className:"truncate",children:n.detail})]})]}),t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Q(n.at)})]}),r="flex w-full items-center gap-3 rounded-md px-2 py-3 text-left hover:bg-accent/60";if(!n.href)return t.jsx("div",{className:r,children:l});const o=X(n.href);return t.jsx(g,{to:o.pathname,search:o.search,className:r,onClick:a=>{!i||!n.card||n.kind==="session"||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey||a.button!==0||(a.preventDefault(),i.open({href:n.href??"",title:n.title,runId:n.card.run_id??void 0,body:n.card.body,createdAt:n.card.at,owner:s,sourceAttribution:n.source??n.card}))},children:l})}function ne({owner:s,search:n,entityScope:c,home:i=!1}){const l=typeof n.type=="string"&&n.type.trim()?R(n.type.trim()):void 0,r=typeof n.tab=="string"?n.tab:"events",o=r==="sessions"||r==="feeds"||r==="automations"?r:"events",a=String(n.attention)==="1",p=Object.entries(n).some(([e,u])=>(_t.includes(e)||e.startsWith("clf_"))&&u!=null&&u!=="");return t.jsxs("div",{className:"flex flex-1 flex-col gap-6 px-4 pt-2.5 pb-8 lg:px-6",children:[t.jsx(Pt,{}),t.jsx(At,{owner:s,children:e=>t.jsx(Lt,{organizationId:e.organizationId,isWorkspaceLoading:e.isWorkspaceLoading,children:t.jsx("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col",children:(i||o!=="events")&&!p&&!l&&!c?t.jsx(Kt,{owner:e.ownerSlug,organizationId:e.organizationId,view:a?"attention":o==="events"?"all":o}):t.jsx(Ft,{organizationId:e.organizationId,ownerSlug:e.ownerSlug,typeScope:l,entityScope:c,attentionOnly:a})})})})]})}export{ne as A};
2
- //# sourceMappingURL=activity-route-view-V4ftmSN7.js.map
@@ -1,2 +0,0 @@
1
- import{Q as w,j as e,aL as y,gk as v,b5 as L,gl as k,L as h,gm as P,n as S,r as R,hq as _,fZ as o,B as j,A as b,bu as N}from"./index-4gCDI7m4.js";import{A as I,f as M,b as $,F as C}from"./agent-client-setup-list-kMmqQSrf.js";import{C as m}from"./copy-button-2swYh4jb.js";import{u as B}from"./clients-C7Lnuc3S.js";import{g as T,c as E}from"./client-rows-BJ2PxM4J.js";const O="app.lobu.ai";function U(s,a){const n=a?`/mcp/${a}`:"/mcp";if(!s)return`http://localhost:8787${n}`;try{const r=new URL(s);return r.hostname===O&&(r.hostname="lobu.ai"),r.pathname=n,r.toString()}catch{return`${s}${n}`}}function F(s){return U(w,s)}const p="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-2.5 pb-8 lg:px-6";function D(s,a){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${s===a-1?"":"border-b"}`}function A({owner:s}){return e.jsx(k,{crumbs:[e.jsx(h,{to:"/$owner/agents",params:{owner:s},className:P,children:"Agents"},"agents")]})}function K({owner:s}){return e.jsx("div",{className:p,children:e.jsxs(y,{className:"flex flex-1 flex-col gap-6",children:[e.jsx(v,{breadcrumb:e.jsx(A,{owner:s}),icon:e.jsx(L.agents.icon,{className:"h-6 w-6"}),title:"Connect an agent",caption:"Choose the agent you already use. Install directly where supported, or copy a setup prompt into the agent."}),e.jsx(I,{owner:s})]})})}function Q({owner:s,clientId:a}){const n=M(a),{data:r}=S(s,{slug:s}),{data:u=[]}=B(null,{refetchInterval:2500}),l=R.useMemo(()=>T(u).filter(t=>t.connected),[u]);if(!n)return e.jsx("div",{className:p,children:e.jsxs(y,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no agent client by that name."}),e.jsx(h,{to:"/$owner/agents/connect",params:{owner:s},className:"text-sm text-primary hover:underline",children:"Back to agent clients"})]})});const c=F(s),d=$({workspaceName:r?.workspace?.name??s,owner:s,mcpUrl:c,clientLabel:n.id==="other"?void 0:n.label,terminalLogin:n.terminalLogin}),x=n.setupMode==="agent-prompt",g=x?d:n.installText?.(c)??d;return e.jsx("div",{className:p,children:e.jsxs(_,{header:e.jsx(v,{breadcrumb:e.jsx(A,{owner:s}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(N,{name:n.label})}),title:n.label,caption:n.description}),children:[e.jsx(o,{title:"Set up",children:e.jsxs("div",{className:"space-y-4",children:[(()=>{const t=n.installLink?.(c);return t?e.jsx("div",{children:e.jsx(j,{asChild:!0,children:e.jsxs("a",{href:t.href,target:"_blank",rel:"noreferrer",children:[t.label,e.jsx(b,{className:"ml-1.5 h-3.5 w-3.5"})]})})}):null})(),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.installTitle}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap font-mono text-xs leading-relaxed",children:g}),e.jsx(m,{text:g,label:x?"Copy setup prompt":"Copy"})]})]}),e.jsx("ol",{className:"space-y-1 text-xs text-muted-foreground",children:n.steps(c).map((t,i)=>e.jsxs("li",{children:[i+1,". ",t]},t))}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[x?null:e.jsx(m,{text:d,label:"Copy setup prompt"}),n.guideLinks.map(t=>e.jsx(j,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 text-xs",children:e.jsxs("a",{href:t.href,target:"_blank",rel:"noreferrer",children:[t.label,e.jsx(b,{className:"ml-1.5 h-3.5 w-3.5"})]})},t.href))]})]})}),e.jsx(o,{title:"First prompts",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"After setup, start a new chat with Lobu enabled and try one of these."}),e.jsx("div",{className:"overflow-hidden rounded-lg border",children:C.map((t,i)=>{const f=n.promptUrl?.(t);return e.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 ${i===C.length-1?"":"border-b"}`,children:[f?e.jsx("a",{href:f,target:"_blank",rel:"noreferrer",className:"min-w-0 flex-1 text-sm hover:underline",children:t}):e.jsx("p",{className:"min-w-0 flex-1 text-sm",children:t}),e.jsx(m,{text:t,label:"prompt",iconOnly:!0})]},t)})})]})}),e.jsx(o,{title:"Connected agents",count:l.length>0?String(l.length):void 0,children:l.length===0?e.jsx("div",{className:"rounded-lg border border-dashed px-3 py-2.5 text-xs text-muted-foreground",children:"Nothing yet. Finish setup and make an authenticated Lobu MCP request; the agent appears here automatically."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:l.map((t,i)=>e.jsxs(h,{to:"/$owner/agents/connected/$clientId",params:{owner:s,clientId:t.clientId},className:D(i,l.length),children:[e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(N,{name:t.title})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:t.title}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:E(t)})]})]},t.key))})}),e.jsx(o,{title:"Manual MCP details",children:e.jsxs("dl",{className:"grid grid-cols-[5rem_1fr] gap-x-3 gap-y-1 rounded-lg border bg-muted/40 p-3 text-xs",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Name"}),e.jsx("dd",{className:"font-mono",children:"lobu"}),e.jsx("dt",{className:"text-muted-foreground",children:"MCP URL"}),e.jsx("dd",{className:"break-all font-mono",children:c})]})})]})})}export{K as A,Q as a};
2
- //# sourceMappingURL=agent-connect-pages-B-NPTFs6.js.map
@@ -1,2 +0,0 @@
1
- import{aE as ye,aF as Ne,j as e,B as j,d3 as Ce,eQ as Se,be as Me,h as Ae,eI as ke,cN as Y,du as K,c_ as Ie,h9 as Pe,ha as Te,hb as Fe,hc as De,gt as _e,hd as Ee,b_ as Re,b$ as $e,aG as Le,r as Q,bT as $,fg as J,c2 as Be,H as b,ep as L,I as U,Y as ze,bz as Oe,bA as Ue,bB as Ge,bC as Ve,bD as Z}from"./index-4gCDI7m4.js";import{b as qe,s as He}from"./model-selector-88PJnyTq.js";function We(a){const t=a.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return(t?/^[a-z]/.test(t)&&t.length>=3?t:`agent-${t}`:"agent").slice(0,60).replace(/-+$/g,"")||"agent"}function Xe(a,t){const r=new Set(t),x=We(a);let v=x,u=2;for(;r.has(v);){const g=`-${u}`;v=`${x.slice(0,Math.max(1,60-g.length)).replace(/-+$/g,"")||"agent"}${g}`,u+=1}return v}const Ye="__unresolved__";function ee(a){return a.endsWith(`/${Ye}`)}function se(a){const t=a.indexOf("/");return t===-1?{slug:a,model:""}:{slug:a.slice(0,t),model:a.slice(t+1)}}function Ke(a,t){const{slug:r,model:x}=se(a);return{provider:t.find(g=>g.value===a)?.provider??t.find(g=>se(g.value).slug===r)?.provider??r,model:x}}function Qe({value:a,onChange:t,disabled:r}){const{data:x=[]}=ye(),{data:v=[]}=Ne(),u=qe(x,v),g=(s,c)=>{const l=s+c;if(l<0||l>=a.length)return;const m=[...a];[m[s],m[l]]=[m[l],m[s]],t(m)},k=s=>{t(a.filter((c,l)=>l!==s))},I=s=>{a.includes(s)||t([...a,s])},o=u.filter(s=>!a.includes(s.value)&&!ee(s.value));return e.jsxs("div",{className:"grid gap-2",children:[a.length===0?e.jsx("p",{className:"rounded-lg border border-dashed bg-muted/20 px-3 py-4 text-center text-[11px] text-muted-foreground",children:"No models pinned — this agent uses the org default."}):e.jsx("ul",{className:"grid gap-1.5",children:a.map((s,c)=>{const l=ee(s),{provider:m,model:i}=Ke(s,u);return e.jsxs("li",{className:Ae("flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2",l&&"opacity-60"),children:[e.jsxs("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm",children:m}),c===0?e.jsx("span",{className:"shrink-0 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"Default"}):null]}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:l?"no model selected":i})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move up",disabled:r||c===0,onClick:()=>g(c,-1),children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move down",disabled:r||c===a.length-1,onClick:()=>g(c,1),children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive","aria-label":"Remove model",disabled:r,onClick:()=>k(c),children:e.jsx(Me,{className:"h-4 w-4"})})]})]},s)})}),e.jsx(ke,{contentClassName:"w-[--radix-popover-trigger-width] min-w-[280px]",searchPlaceholder:"Search or type a model ref…",emptyText:"Type a full provider/model ref to use it.",trigger:s=>e.jsxs(j,{type:"button",variant:"outline",role:"combobox","aria-expanded":s,disabled:r,className:"w-full justify-start font-normal text-muted-foreground",children:[e.jsx(Ie,{className:"mr-2 h-4 w-4 shrink-0"}),"Add model"]}),children:(s,c)=>{const l=c.trim(),m=He(l,u)&&!a.includes(l);return e.jsxs(e.Fragment,{children:[o.map(i=>e.jsxs(Y,{value:`${i.provider} ${i.model} ${i.value}`,onSelect:()=>{I(i.value),s()},className:"cursor-pointer",children:[e.jsx(K,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{className:"truncate",children:[i.provider," ",e.jsx("span",{className:"text-muted-foreground text-xs",children:i.model}),i.isDefault?e.jsx("span",{className:"ml-1.5 text-muted-foreground text-xs",children:"· org default"}):null]})]},i.value)),m?e.jsxs(Y,{value:`__custom__ ${l}`,onSelect:()=>{I(l),s()},className:"cursor-pointer",children:[e.jsx(K,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{children:["Use ",e.jsx("span",{className:"font-mono text-xs",children:l})]})]}):null]})}})]})}const Je=3,Ze=72,es=2e3;function te(a){return Array.from({length:Je},(t,r)=>a?.[r]??{title:"",message:""})}function ae(a){return a.map(({title:t,message:r})=>({title:t.trim(),message:r.trim()})).filter(({title:t,message:r})=>t&&r)}function ns({mode:a,section:t="identity",existingAgentIds:r=[],onCreated:x,onCancel:v,onDone:u,reviewMode:g="none",reviewProposal:k=null,reviewControlsDisabled:I=!1}){const o=a.kind==="create",s=a.kind==="edit"?a.agent:null,c=!o&&t!=="platforms"&&t!=="skills"&&!!s,l=Pe(),m=Te(s?.agentId??""),i=Fe(s?.agentId??""),P=De(s?.agentId??""),{data:p,isLoading:G}=_e(s?.agentId,{enabled:c}),V=!o&&g==="active"?k:null,B=V?Ee(V.proposal):void 0,N=p,q=s?.agentId??"create",d=Re(q,{name:B?.name??s?.name??"",description:B?.description??s?.description??"",identityMd:B?.identityMd??p?.identityMd??"",soulMd:p?.soulMd??"",userMd:p?.userMd??"",models:N?.models??N?.settings?.models??[],showToolCalls:N?.showToolCalls??N?.settings?.showToolCalls??!1,sandboxId:N?.sandboxId??N?.settings?.sandboxId??"builtin",starters:te(p?.starters)}),[w,ne]=d.field("name"),[C,le]=d.field("description"),[T,re]=d.field("identityMd"),[F,ie]=d.field("soulMd"),[D,de]=d.field("userMd"),[_,oe]=d.field("models"),[E,ce]=d.field("showToolCalls"),[S,me]=d.field("sandboxId"),[y,H]=d.field("starters"),[ue,R]=$e(q,!1),{data:ge}=Le({enabled:t==="models"&&!o}),he=Q.useCallback(async n=>{if(n.preventDefault(),!!d.canSubmit){if(o){const h=await l.mutateAsync({agentId:Xe(w,r),name:w.trim(),description:C.trim()||void 0});x?await x(h.agentId):u?.();return}if(s){if(!p){$.error("Still loading agent settings — try again in a moment");return}if(y.some(({title:h,message:M})=>!!h.trim()!=!!M.trim())){$.error("Add both a title and a message for each conversation starter");return}try{await Promise.all([m.mutateAsync({name:w.trim()||s.name,description:C.trim()||void 0}),P.mutateAsync({identityMd:T.trim(),soulMd:F.trim(),userMd:D.trim(),models:_,authProfiles:p.authProfiles??[],skillsConfig:p.skillsConfig,showToolCalls:E,sandboxId:S==="builtin"?void 0:S,starters:ae(y)})]),d.accept(d.values,{name:w.trim()||s.name,description:C.trim()||s.description||"",identityMd:T.trim(),soulMd:F.trim(),userMd:D.trim(),models:_,showToolCalls:E,sandboxId:S,starters:te(ae(y))}),$.success("Agent saved"),u?.()}catch(h){$.error(h instanceof Error?h.message:"Failed to save agent")}}}},[p,l,C,d.accept,d.values,d.canSubmit,S,r,T,o,_,w,x,u,s,E,F,y,m,P,D]),xe=Q.useCallback(async()=>{s&&(await i.mutateAsync(),R(!1),u?.())},[i,u,s,R]),z=l.isPending||m.isPending||i.isPending||P.isPending,pe=o||!!p;if(c&&G)return e.jsx(J,{rows:6});const f=z||I,fe=g==="none"||g==="gone",ve=w.trim().length>0&&pe,be=o||t==="settings",je=!o&&(t==="identity"||t==="settings"),we=!o&&t==="settings",W=!o&&t==="settings",X=!o&&t==="models";return e.jsxs("form",{onSubmit:he,className:"flex min-h-0 flex-col",children:[e.jsx(Be,{visible:d.hasConflict,onReload:d.reset}),e.jsxs("div",{className:"grid content-start gap-4 py-2",children:[je?G?e.jsx(J,{rows:4}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"identity-md",children:"Identity"}),e.jsx(L,{id:"identity-md",rows:6,value:T,onChange:n=>re(n.target.value),disabled:f,placeholder:"You are a market intelligence agent. Track competitors, analyze launches and signals, and surface concise, decision-ready insights."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"soul-md",children:"Soul"}),e.jsx(L,{id:"soul-md",rows:6,value:F,onChange:n=>ie(n.target.value),disabled:f,placeholder:"Be rigorous, skeptical of weak signals, and calm under ambiguity. Prefer crisp summaries, explicit evidence, and clear confidence levels."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"user-md",children:"User prompt"}),e.jsx(L,{id:"user-md",rows:6,value:D,onChange:n=>de(n.target.value),disabled:f,placeholder:"Monitor the market for notable competitor moves, pricing changes, launches, partnerships, and customer sentiment shifts. Summarize what changed, why it matters, and what to watch next."})]})]}):null,be?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(b,{htmlFor:"agent-name",children:["Name ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(U,{id:"agent-name",placeholder:"Support Bot",value:w,onChange:n=>ne(n.target.value),disabled:f,required:!0}),o?e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent ID will be generated automatically from the name."}):null]}),o?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-description",children:"Description"}),e.jsx(L,{id:"agent-description",placeholder:"Handles customer support and triage across channels.",value:C,onChange:n=>le(n.target.value),disabled:f,rows:3})]})]}):null,W?e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-muted/20 p-3",children:[e.jsx(ze,{id:"show-tool-calls",checked:E,onCheckedChange:n=>ce(n===!0),disabled:f,className:"mt-0.5"}),e.jsxs("div",{className:"grid gap-0.5",children:[e.jsx(b,{htmlFor:"show-tool-calls",className:"cursor-pointer",children:"Show tool calls in chat"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Render the agent's tool invocations (name, arguments, and result) as cards in the web chat. Off by default."})]})]}):null,W?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{children:"Conversation starters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to three prompts offered on a new chat, on the web and in Slack. The message is sent as the user when tapped."}),y.map((n,h)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[12rem_1fr]",children:[e.jsx(U,{"aria-label":`Starter ${h+1} title`,placeholder:"Plan this week",maxLength:Ze,value:n.title,onChange:M=>H(y.map((A,O)=>O===h?{...A,title:M.target.value}:A)),disabled:f}),e.jsx(U,{"aria-label":`Starter ${h+1} message`,placeholder:"Plan this week's posts from what's trending",maxLength:es,value:n.message,onChange:M=>H(y.map((A,O)=>O===h?{...A,message:M.target.value}:A)),disabled:f})]},h))]}):null,X?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{children:"Models"}),e.jsx(Qe,{value:_,onChange:oe,disabled:f}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Ordered list; the first is the default. Only these models may be used — a request for anything else falls back to the first available one. Leave empty to use the org default."})]}):null,X?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-sandbox",children:"Run in sandbox"}),e.jsxs(Oe,{value:S,onValueChange:me,disabled:f,children:[e.jsx(Ue,{id:"agent-sandbox",className:"w-full",children:e.jsx(Ge,{placeholder:"Built-in"})}),e.jsxs(Ve,{children:[e.jsx(Z,{value:"builtin",children:"Built-in (default)"}),(ge?.sandboxes??[]).map(n=>e.jsxs(Z,{value:n.id,children:[n.name," (",n.providerKind,")",n.connected?"":" — no credential"]},n.id))]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Where this agent's commands execute. Built-in runs in-process; sandboxes run on a connected provider. Manage sandboxes under Connect › Runtime."})]}):null]}),fe?e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[we?ue?e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(j,{type:"button",variant:"destructive",onClick:()=>void xe(),disabled:i.isPending,children:i.isPending?"Deleting...":"Delete agent"}),e.jsx(j,{type:"button",variant:"outline",onClick:()=>R(!1),disabled:i.isPending,children:"Cancel"})]}):e.jsx(j,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>R(!0),disabled:i.isPending,children:"Delete agent"}):e.jsx("span",{}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[v?e.jsx(j,{type:"button",variant:"outline",onClick:v,disabled:z,children:"Cancel"}):null,e.jsx(j,{type:"submit",disabled:!d.canSubmit||!ve||z,children:o?l.isPending?"Creating...":"Create agent":m.isPending||P.isPending?"Saving...":"Save changes"})]})]}):null]})}export{ns as A};
2
- //# sourceMappingURL=agent-editor-form-DfMTSIvj.js.map
@@ -1,2 +0,0 @@
1
- import{r as N,j as e,H as w,I as k,bz as K,bA as X,bB as Y,bC as ee,bD as ae,ep as te,B as S,v as B,gt as G,iP as T,iQ as U,hc as F,fg as se,bT as j,gA as I,bJ as ne,bW as re,b4 as $,gC as ie,V as oe,ie as le,bL as q,c_ as de,h as E,iN as ue}from"./index-4gCDI7m4.js";import{M as ce}from"./model-selector-88PJnyTq.js";import{a as me,A as J}from"./agent-subpage-shell-DWzljvFb.js";import{T as ge,a as he,b as M,c as D,d as xe,e as R}from"./table-DFcJRNk7.js";import{f as pe}from"./agent-loading-shells-Dnmb6W5Y.js";import{A as fe}from"./agent-card-controls-99mG6H5k.js";const je=[{value:"input",label:"Input",hint:"the user message, before the agent runs"},{value:"output",label:"Output",hint:"the agent's reply, before the user sees it"},{value:"pre-tool",label:"Pre-tool",hint:"a tool call, before it executes"},{value:"egress",label:"Egress",hint:"an outbound request to a judged domain"}];function z({initial:a,judgeModelDefault:t,submitLabel:n,submitting:s,onSubmit:o,onCancel:r}){const[i,d]=N.useState(a?.name??""),[h,b]=N.useState(a?.stage??"input"),[x,y]=N.useState(a?.policy??""),[p,C]=N.useState(a?.model??""),[f,u]=N.useState((a?.tools??[]).join(", ")),[l,m]=N.useState((a?.domains??[]).join(", ")),g=a?.kind,v=g==="require-tool",Q=c=>{c.preventDefault();const _=f.split(",").map(L=>L.trim()).filter(Boolean);o({name:i,stage:h,...g?{kind:g}:{},policy:x,model:p.trim()||void 0,tools:(v||h==="pre-tool")&&_.length>0?_:void 0,domains:h==="egress"&&l.trim()?l.split(",").map(L=>L.trim()).filter(Boolean):void 0,enabled:a?.enabled??!0})};return e.jsxs("form",{onSubmit:Q,className:"space-y-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-name",children:["Name ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(k,{id:"guardrail-name",value:i,onChange:c=>d(c.target.value),placeholder:"no-competitor-mentions",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Shown in the list and on every trip. Must be unique."})]}),v?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-stage",children:"Stage"}),e.jsxs(K,{value:h,onValueChange:c=>b(c),disabled:s,children:[e.jsx(X,{id:"guardrail-stage",children:e.jsx(Y,{})}),e.jsx(ee,{children:je.map(c=>e.jsxs(ae,{value:c.value,children:[c.label," — ",c.hint]},c.value))})]})]}),v?e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-required-tools",children:["Required tools ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(k,{id:"guardrail-required-tools",value:f,onChange:c=>u(c.target.value),placeholder:"suggest_actions",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Comma-separated. The turn trips if the agent finishes without calling every one of these. No judge model runs — this is a lookup against the tools the turn actually used."})]}):null,v?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-policy",children:["Policy ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(te,{id:"guardrail-policy",rows:5,value:x,onChange:c=>y(c.target.value),placeholder:"Deny any response that names a competitor (Acme, Globex) or quotes their pricing.",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"A judge model reads this and the text at the chosen stage, then allows or denies. Write it as an instruction to a reviewer."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-model",children:["Judge model",t?null:e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(ce,{value:p,onChange:C,placeholder:t?`Default (${t})`:"Select a model",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t?"Optional. Leave blank to use the gateway's default judge model.":"Required: the gateway has no default judge model (EGRESS_JUDGE_MODEL is unset)."})]})]}),!v&&h==="pre-tool"?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-tools",children:"Tool scope"}),e.jsx(k,{id:"guardrail-tools",value:f,onChange:c=>u(c.target.value),placeholder:"github.delete_repo, fs.delete",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Optional, comma-separated. Leave blank to judge every tool call."})]}):null,h==="egress"?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-domains",children:"Domains"}),e.jsx(k,{id:"guardrail-domains",value:l,onChange:c=>m(c.target.value),placeholder:"api.github.com, .slack.com",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Comma-separated hostnames this judge gates — exact (api.github.com) or wildcard (.slack.com). Leave blank to route nothing."})]}):null,e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[r?e.jsx(S,{type:"button",variant:"outline",onClick:r,disabled:s,children:"Cancel"}):null,e.jsx(S,{type:"submit",disabled:s,children:s?"Saving…":n})]})]})}function H(a){return a.kind==="require-tool"}function W(a,t,n,s,o){const r=a.name.trim();return r?/^[a-zA-Z0-9][a-zA-Z0-9 _-]*$/.test(r)?n.includes(r)?`"${r}" is a built-in guardrail name — pick another.`:t.some(d=>d.name===r&&d.name!==o)?`A custom guardrail named "${r}" already exists.`:H(a)?a.stage!=="output"?"A required-tool guardrail only runs at the output stage.":a.tools?.some(d=>d.trim())?null:"List at least one tool that must be used.":a.policy.trim()?!s&&!a.model?.trim()?"Judge model is required — the gateway has no default (EGRESS_JUDGE_MODEL is unset).":null:"Policy is required.":"Name may use letters, numbers, spaces, hyphens, and underscores.":"Name is required."}function V(a){const t=H(a),s=(t||a.stage==="pre-tool")&&a.tools&&a.tools.length>0?a.tools.map(d=>d.trim()).filter(Boolean):void 0,o=a.stage==="egress"&&a.domains&&a.domains.length>0?a.domains.map(d=>d.trim()).filter(Boolean):void 0,r=a.model?.trim()||void 0,i=a.policy.trim();return{name:a.name.trim(),enabled:a.enabled,stage:a.stage,...t?{kind:"require-tool"}:{},...t?i?{policy:i}:{}:{policy:i},...r?{model:r}:{},...s&&s.length>0?{tools:s}:{},...o&&o.length>0?{domains:o}:{}}}function be(a,t){return[...a,V(t)]}function ve(a,t,n){return a.map(s=>s.name===t?V(n):s)}function Ne(a,t){return a.filter(n=>n.name!==t)}function ye(a,t,n){return a.map(s=>s.name===t?{...s,enabled:n}:s)}function Ce({owner:a,agentId:t}){const n=B(),{data:s,isLoading:o}=G(t),{data:r,isLoading:i}=T(t),{data:d=null,isLoading:h}=U(t),b=o||i||h,x=F(t),y=s?.guardrailsInline??[],p=(r??[]).map(u=>u.name),C=async u=>{if(!s){j.error("Still loading agent settings — try again in a moment");return}const l=W(u,y,p,d);if(l){j.error(l);return}try{await x.mutateAsync({guardrailsInline:be(y,u)}),j.success("Guardrail created"),n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}})}catch(m){j.error(m instanceof Error?m.message:"Failed to create guardrail")}},f=()=>void n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(me,{title:"New custom guardrail",description:"A custom guardrail judges text at one stage against a policy you write."}),b?e.jsx(se,{rows:4}):e.jsx(z,{judgeModelDefault:d,submitLabel:"Create guardrail",submitting:x.isPending,onSubmit:C,onCancel:f})]})}function P(a,t){const n=new Set(a?.guardrails??[]),s=new Set(t.map(i=>i.name)),o=t.map(i=>({name:i.name,stages:i.stages,description:i.description,enabled:n.has(i.name),unknown:!1})),r=(a?.guardrails??[]).filter(i=>!s.has(i)).map(i=>({name:i,stages:[],enabled:!0,unknown:!0}));return[...o,...r]}function we(a){return a.filter(t=>t.enabled||t.unknown).map(t=>t.name)}function Se(a,t,n){return we(a.map(s=>s.name===t&&!s.unknown?{...s,enabled:n}:s))}const A={input:"Input",output:"Output","pre-tool":"Pre-tool",egress:"Egress"};function ke(a){const t=new Date(a);return Number.isNaN(t.getTime())?a:le(t,{addSuffix:!0})}function Ae({owner:a,agentId:t,name:n}){const{data:s}=G(t),{data:o}=T(t),r=N.useMemo(()=>P(s,o??[]).find(d=>d.name===n)??null,[s,o,n]),i=(s?.guardrailsInline??[]).find(d=>d.name===n);return i?e.jsx(Te,{owner:a,agentId:t,guardrail:i}):r?e.jsx(Ge,{agentId:t,name:n,row:r}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Guardrail not found."})}function Ge({agentId:a,name:t,row:n}){return e.jsxs("div",{className:"space-y-8",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description??(n.stages.length>0?`Built-in. Short-circuits this agent's ${n.stages.map(s=>A[s].toLowerCase()).join(", ")} stage${n.stages.length>1?"s":""} when it matches.`:"Configured out of band — toggling is managed via lobu apply.")}),e.jsx(Z,{agentId:a,guardrail:t})]})}function Te({owner:a,agentId:t,guardrail:n}){const s=B(),{data:o}=G(t),{data:r}=T(t),{data:i=null}=U(t),d=F(t),[h,b]=N.useState(!1),x=o?.guardrailsInline??[],y=(r??[]).map(u=>u.name),p=async(u,l)=>{if(!o)return j.error("Still loading agent settings — try again in a moment"),!1;try{return await d.mutateAsync({guardrailsInline:u}),j.success(l),!0}catch(m){return j.error(m instanceof Error?m.message:"Failed to save guardrail"),!1}},C=async u=>{const l=W(u,x,y,i,n.name);if(l){j.error(l);return}await p(ve(x,n.name,u),"Guardrail saved")&&u.name.trim()!==n.name&&s({to:"/$owner/agents/$agentId/guardrails/$name",params:{owner:a,agentId:t,name:encodeURIComponent(u.name.trim())}})},f=async()=>{await p(Ne(x,n.name),"Guardrail deleted")&&s({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}})};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:n.kind==="require-tool"?"Required tools":"Policy"}),e.jsx(z,{initial:n,judgeModelDefault:i,submitLabel:"Save changes",submitting:d.isPending,onSubmit:C})]}),e.jsx("div",{className:"flex justify-end",children:h?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"button",variant:"destructive",onClick:()=>void f(),disabled:d.isPending,children:"Delete guardrail"}),e.jsx(S,{type:"button",variant:"outline",onClick:()=>b(!1),disabled:d.isPending,children:"Cancel"})]}):e.jsxs(S,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>b(!0),children:["Delete ",n.name]})}),e.jsx(Z,{agentId:t,guardrail:n.name})]})}function Z({agentId:a,guardrail:t}){const{data:n=[],isLoading:s,isError:o}=I(a,{guardrail:t});return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Recent catches"}),s?e.jsx(ne,{label:"catches",variant:"table",rows:4}):o?e.jsx(re,{label:"catches"}):n.length===0?e.jsx($,{icon:ie,title:"No catches yet",description:"This guardrail hasn't short-circuited anything on this agent."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.jsxs(ge,{children:[e.jsx(he,{children:e.jsxs(M,{children:[e.jsx(D,{className:"w-[180px]",children:"When"}),e.jsx(D,{className:"w-[120px]",children:"Stage"}),e.jsx(D,{children:"Reason"})]})}),e.jsx(xe,{children:n.map(r=>e.jsxs(M,{children:[e.jsx(R,{className:"text-xs text-muted-foreground",title:r.occurredAt,children:ke(r.occurredAt)}),e.jsx(R,{children:e.jsx(oe,{variant:"outline",className:"text-[10px]",children:A[r.stage]})}),e.jsx(R,{className:"text-sm text-muted-foreground",children:r.reason??e.jsx("span",{className:"italic",children:"no reason recorded"})})]},r.id))})]})})]})}function Le({description:a,action:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-center text-sm text-muted-foreground",children:a}),t?e.jsx("div",{className:"shrink-0",children:t}):null]})}function O(a,t){return a.get(t)??0}function Ee(a,t,n){const s=a.map(r=>{const i=r.stages.map(d=>A[d]);return r.unknown&&i.push("Unknown"),{id:r.name,name:r.name,kind:"builtin",description:r.description,stages:r.stages,enabled:r.enabled,unknown:r.unknown,badges:i,tripCount:O(n,r.name)}}),o=t.map(r=>{const i=[A[r.stage],"Custom"];return{id:r.name,name:r.name,kind:"custom",description:r.policy,stages:[r.stage],enabled:r.enabled,unknown:!1,badges:i,tripCount:O(n,r.name)}});return[...s,...o]}function De({owner:a,agentId:t,expandedName:n}){const s=B(),{data:o,isLoading:r}=G(t),{data:i,isLoading:d}=T(t),{data:h=[]}=I(t),b=F(t),x=async(l,m)=>{if(!o){j.error("Still loading agent settings — try again in a moment");return}try{if(l.kind==="custom")await b.mutateAsync({guardrailsInline:ye(o.guardrailsInline??[],l.name,m)});else{const g=P(o,i??[]);await b.mutateAsync({guardrails:Se(g,l.name,m)})}j.success(m?"Guardrail enabled":"Guardrail disabled")}catch(g){j.error(g instanceof Error?g.message:"Failed to save guardrail")}},y=i===null,p=N.useMemo(()=>{const l=P(o,i??[]),m=o?.guardrailsInline??[],g=new Map;for(const v of h)g.set(v.guardrailName,(g.get(v.guardrailName)??0)+1);return Ee(l,m,g)},[o,i,h]),C=l=>{if(l===n){s({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}});return}s({to:"/$owner/agents/$agentId/guardrails/$name",params:{owner:a,agentId:t,name:encodeURIComponent(l)}})},f=()=>{s({to:"/$owner/agents/$agentId/guardrails/create",params:{owner:a,agentId:t}})},u=r||d;return!u&&p.length===0?e.jsx("div",{className:"space-y-6",children:y?e.jsx($,{icon:q,title:"Guardrails catalog unavailable",description:"Guardrails will appear here once the gateway publishes its catalog.",actionLabel:"New guardrail",onAction:f}):e.jsx($,{icon:q,title:"No guardrails yet",description:"Enable a built-in in lobu.toml or write a custom policy guardrail.",actionLabel:"New guardrail",onAction:f})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(Le,{description:"Each guardrail short-circuits this agent's input, output, or tool-call stages. Built-ins are toggle-only; add a custom guardrail to judge messages against a policy you write.",action:u?void 0:e.jsxs(S,{type:"button",onClick:f,children:[e.jsx(de,{className:"mr-1.5 h-4 w-4"}),"New guardrail"]})}),u?e.jsx(pe,{rows:3}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:p.map((l,m)=>{const g=l.name===n;return e.jsx(Re,{card:l,expanded:g,isLast:m===p.length-1,onToggle:()=>C(l.name),onToggleEnabled:v=>void x(l,v),toggleDisabled:l.unknown||b.isPending,children:g?e.jsx(Ae,{owner:a,agentId:t,name:l.name}):null},l.id)})})]})}function Re({card:a,expanded:t,isLast:n,onToggle:s,onToggleEnabled:o,toggleDisabled:r,children:i}){return e.jsxs("div",{className:E("bg-background",!n||t?"border-b":""),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsxs("button",{type:"button",onClick:s,"aria-expanded":t,className:E("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!a.enabled&&!a.unknown&&!t&&"opacity-70"),children:[e.jsx(q,{className:"ml-2 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:E("truncate text-sm text-foreground",a.unknown&&"font-mono text-xs"),children:a.name}),a.kind==="custom"&&a.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:a.description}):e.jsx("p",{className:"text-xs text-muted-foreground",children:a.tripCount>0?`${a.tripCount} recent ${a.tripCount===1?"catch":"catches"}`:"No recent catches"}),e.jsx(ue,{badges:a.badges})]})]}),e.jsx(fe,{enabled:a.enabled,name:a.name,expanded:t,onToggleEnabled:o,toggleDisabled:r,onToggle:s})]}),t&&i?e.jsx("div",{className:"border-t border-border px-4 py-4",children:i}):null]})}function $e({owner:a,agentId:t,expandedName:n}){return e.jsx(J,{children:e.jsx(De,{owner:a,agentId:t,expandedName:n})})}function Oe({owner:a,agentId:t}){return e.jsx(J,{children:e.jsx(Ce,{owner:a,agentId:t})})}function Ue({owner:a,agentId:t,name:n}){return e.jsx($e,{owner:a,agentId:t,expandedName:decodeURIComponent(n)})}export{$e as A,Oe as a,Ue as b};
2
- //# sourceMappingURL=agent-guardrails-route-BvGgfd-h.js.map
@@ -1,2 +0,0 @@
1
- import{v as D,r as g,j as e,c_ as K,H as C,I as L,ep as P,bK as O,B as N,h as R,d9 as _,h3 as H,h4 as z,b4 as G,hj as Q,fv as Y,iN as V}from"./index-4gCDI7m4.js";import{u as A,b as X,f as q,s as J,a as U,S as W,v as Z,c as ee}from"./agent-skill-context-V__2i6Vl.js";import{a as se,A as E}from"./agent-subpage-shell-DWzljvFb.js";import{f as te}from"./agent-loading-shells-Dnmb6W5Y.js";import{u as ae,a as F,m as ne,P as le,D as ie,n as oe,C as re}from"./core.esm-CHnfRiEM.js";import{A as ce}from"./agent-card-controls-99mG6H5k.js";const T=":";function w(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function de({owner:s,agentId:t}){const a=D(),[n,i]=g.useState(""),[o,d]=g.useState(!1),[x,k]=g.useState(""),[r,v]=g.useState(""),{skillRows:m,catalog:p,isLoading:u,addSkillFromCatalog:h,addCustomSkill:S}=A(),b=g.useMemo(()=>new Set(m.map(c=>c.repo)),[m]),f=g.useMemo(()=>X(p?.catalog??[],b),[p?.catalog,b]),l=g.useMemo(()=>q(f,n),[f,n]),y=c=>{h(c),a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(c)}})},j=()=>{const c=S({name:x,instructions:r});c&&a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(c)}})},$=e.jsx(se,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."});return e.jsxs("div",{className:"space-y-6",children:[$,e.jsx("div",{className:R(_,"w-full"),children:o?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(L,{id:"custom-skill-name",value:x,onChange:c=>k(c.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:r,onChange:c=>v(c.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(O,{onCancel:()=>d(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:j,disabled:!x.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>d(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(K,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),u?e.jsx(H,{}):e.jsx(z,{items:l,searchQuery:n,onSearchChange:i,onSelect:c=>y(c.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:n.trim()?`No skills match "${n}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function me({row:s}){const{isSaving:t,updateSkillRow:a}=A(),n=s.system===!0;return e.jsx("div",{className:"space-y-6",children:n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"System skill metadata is managed by Lobu. You can enable or disable it and change its position in the skill list."}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-name",children:"Name"}),e.jsx(L,{id:"skill-name",value:s.name,onChange:i=>a(s.repo,{name:i.target.value}),disabled:t})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-instructions",children:"Instructions"}),e.jsx(P,{id:"skill-instructions",value:s.instructions??"",onChange:i=>{const o=i.target.value;a(s.repo,{instructions:o,content:o.trim()||s.name})},rows:4,disabled:t})]})]})})}function ue({owner:s,agentId:t,skillKey:a}){const n=D(),[i,o]=g.useState(!1),d=B(a),{skillRows:x,catalog:k,isSaving:r,saveSkills:v,removeSkillAndSave:m,addSkillFromCatalog:p}=A(),u=x.find(f=>f.repo===d)??null,h=k?.catalog.find(f=>f.repo===d);g.useEffect(()=>{!u&&h&&p(d)},[p,h,d,u]);const S=async()=>{await m(d)&&(o(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!u)return h?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const b=!u.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(me,{row:u}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[b?i?e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(N,{type:"button",variant:"outline",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>o(!0),disabled:r,children:["Remove ",u.name]}):null,e.jsx(N,{type:"button",onClick:()=>void v(),disabled:r||i,children:r?"Saving...":"Save changes"})]})]})}function ge(s){return s.map(t=>{const a=J(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const I="Skills bundle instructions, tools, and knowledge an agent can reuse. Add one from the catalog or write your own; drag to set which the agent reaches for first.";function M({owner:s,agentId:t,expandedRepo:a}){const n=D(),{skillRows:i,catalog:o,isLoading:d,isSaving:x,reorderSkills:k,setSkillEnabledAndSave:r,addSkillFromCatalog:v}=A();g.useEffect(()=>{a&&(i.some(l=>l.repo===a)||o?.catalog.some(l=>l.repo===a)&&v(a))},[a,i,o,v]);const m=g.useMemo(()=>ge(i),[i]),p=g.useMemo(()=>m.map(l=>l.repo),[m]),u=ae(F(le,{activationConstraint:{distance:8}}),F(ne,{coordinateGetter:U})),h=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:h,children:[e.jsx(K,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),b=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(l)}})},f=l=>{const{active:y,over:j}=l;!j||y.id===j.id||k(String(y.id),String(j.id))};return d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:I}),e.jsx(te,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:I}),e.jsx(G,{icon:Q,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:h})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-sm text-muted-foreground",children:I}),S]}),e.jsx(ie,{sensors:u,collisionDetection:oe,onDragEnd:f,children:e.jsx(W,{items:p,strategy:Z,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,y)=>{const j=l.repo===a;return e.jsx(xe,{card:l,rank:y+1,disabled:x,expanded:j,isLast:y===m.length-1,onToggle:()=>b(l.repo),onToggleEnabled:$=>void r(l.repo,$),toggleDisabled:x,children:j?e.jsx(ue,{owner:s,agentId:t,skillKey:w(l.repo)}):null},l.id)})})})})]})}function xe({card:s,rank:t,disabled:a,expanded:n,isLast:i,onToggle:o,onToggleEnabled:d,toggleDisabled:x,children:k}){const r=a||n,{attributes:v,listeners:m,setNodeRef:p,transform:u,transition:h,isDragging:S}=ee({id:s.repo,disabled:r}),b={transform:re.Transform.toString(u),transition:h};return e.jsxs("div",{ref:p,style:b,className:R("bg-background",!i||n?"border-b":"",S&&"z-10 bg-card opacity-80 "),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsx("button",{type:"button",className:"flex shrink-0 cursor-grab touch-none items-center px-2 text-muted-foreground hover:text-foreground active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Reorder ${s.name}`,disabled:r,...v,...m,children:e.jsx(Y,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",className:R("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!s.enabled&&!n&&"opacity-70"),onClick:o,"aria-expanded":n,children:[e.jsx("span",{className:"w-4 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:t}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:s.description}):null,e.jsx(V,{badges:s.badges})]})]}),e.jsx(ce,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:d,toggleDisabled:x,onToggle:o})]}),n&&k?e.jsx("div",{className:"border-t border-border px-4 py-4",children:k}):null]})}function je({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t})})}function Se({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(de,{owner:s,agentId:t})})}function ye({owner:s,agentId:t,skillKey:a}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{je as A,Se as a,ye as b};
2
- //# sourceMappingURL=agent-skills-route-DFXr_bHp.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,h as a}from"./index-4gCDI7m4.js";function r({children:t,className:s}){return e.jsx("div",{className:a("mx-auto w-full max-w-3xl pb-8",s),children:t})}function x({title:t,description:s}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:s})]})}export{r as A,x as a};
2
- //# sourceMappingURL=agent-subpage-shell-DWzljvFb.js.map
@@ -1,6 +0,0 @@
1
- import{j as s,r as a,aN as Vt,a5 as Bt,gs as Ht,gt as zt,a2 as Ze,Q as Ve,a3 as et,c5 as Wt,gu as tt,gv as Kt,gw as qt,L as mt,h as P,gx as Gt,dH as ht,dJ as Qt,gy as Jt,cB as Yt,dN as Xt,gz as Zt,aA as en,B as pe,eQ as tn,gA as nn,gB as Be,X as rn,aa as on,d3 as sn,d9 as Ne,gC as ln,gD as an,dx as cn,dz as un,gE as dn,dy as fn,bn as pn,gF as mn,gG as hn,ei as gn,W as bn,gH as xn,gI as vn}from"./index-4gCDI7m4.js";import{D as yn,E as Rn}from"./app-bridge-C4nPtae3.js";import{A as wn,a as Sn,b as Cn,c as qe,d as gt,e as Tn}from"./agent-loading-shells-Dnmb6W5Y.js";import{h as jn,t as Nn,R as En,i as An,u as kn,M as In,a as _n}from"./use-mention-search-C3rWLuKm.js";import{t as nt,c as On}from"./event-card-Mcxv56DG.js";import{E as Pn}from"./events-feed-BysC9HgU.js";const bt=a.createContext(null);function Mn({extension:e,children:t}){return s.jsx(bt.Provider,{value:e??null,children:t})}function Ge(){return a.useContext(bt)}var Qe=(e=>(e.PROVIDER_QUOTA_EXHAUSTED="PROVIDER_QUOTA_EXHAUSTED",e.PROVIDER_AUTH="PROVIDER_AUTH",e.PROVIDER_UNKNOWN_MODEL="PROVIDER_UNKNOWN_MODEL",e.PROVIDER_BASE_URL_UNRESOLVED="PROVIDER_BASE_URL_UNRESOLVED",e.NO_MODEL_CONFIGURED="NO_MODEL_CONFIGURED",e.WORKER_UNRESPONSIVE="WORKER_UNRESPONSIVE",e.WORKER_DIED="WORKER_DIED",e.WORKER_STARTUP_FAILED="WORKER_STARTUP_FAILED",e.PROVIDER_TOOL_CALL_FAILED="PROVIDER_TOOL_CALL_FAILED",e.SESSION_TIMEOUT="SESSION_TIMEOUT",e))(Qe||{});const Ln={PROVIDER_QUOTA_EXHAUSTED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_AUTH:{cta:"provider-management",ctaLabel:"Reconnect provider"},PROVIDER_UNKNOWN_MODEL:{cta:"agent-settings",ctaLabel:"Choose model"},PROVIDER_BASE_URL_UNRESOLVED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_TOOL_CALL_FAILED:{message:"The model provider rejected its own tool call and ended the turn. This is usually temporary — please try again.",cta:"none"},NO_MODEL_CONFIGURED:{message:"No model is configured for this agent. Choose a model in agent settings.",cta:"agent-settings",ctaLabel:"Choose a model"},WORKER_UNRESPONSIVE:{message:"The agent didn't finish responding in time. This is usually temporary — please try again.",cta:"none"},WORKER_DIED:{message:"The agent stopped unexpectedly before it could reply. This is usually temporary — please try again.",cta:"none"},WORKER_STARTUP_FAILED:{message:"The agent couldn't start, so your request wasn't processed. Please try again in a moment.",cta:"none"},SESSION_TIMEOUT:{cta:"none",silent:!0}};function $n(e){if(typeof e=="string")return Object.values(Qe).includes(e)?e:void 0}const Dn=Object.freeze(Object.defineProperty({__proto__:null,AGENT_ERRORS:Ln,AgentErrorCode:Qe,toAgentErrorCode:$n},Symbol.toStringTag,{value:"Module"})),{AGENT_ERRORS:Un,toAgentErrorCode:Fn}=Dn;function rt(e,t){if(!t)return null;try{const n=new URL(t);return n.protocol!=="http:"&&n.protocol!=="https:"?null:new URL(e,`${n.origin}/`).toString()}catch{return null}}function xt(e,t){const n=Fn(e);if(!n)return null;const r=Un[n];if(r.cta==="none"||!t.workspaceSlug)return null;const o=encodeURIComponent(t.workspaceSlug);if(r.cta==="provider-connect"||r.cta==="provider-management"){const i=t.provider?`/${o}/connectors/${encodeURIComponent(`${Vt}${t.provider}`)}`:`/${o}/connectors`,c=rt(i,t.webOrigin);if(!c)return null;const u=new URL(c);return t.provider&&t.model&&u.searchParams.set("model",t.model),{label:r.ctaLabel??"Connect a provider",href:u.toString()}}if(!t.agentId)return null;const l=rt(`/${o}/agents/${encodeURIComponent(t.agentId)}/settings`,t.webOrigin);return l?{label:r.ctaLabel??"Open settings",href:l}:null}function vt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.subscribable;if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t;if(typeof n.connector_key!="string"||!n.connector_key||typeof n.resource_type!="string"||!n.resource_type||typeof n.resource_ref!="string"||!n.resource_ref||typeof n.label!="string"||!n.label)return null;const r=Array.isArray(n.suggested_event_keys)?n.suggested_event_keys.filter(o=>typeof o=="string"&&!!o):void 0;return{connector_key:n.connector_key,resource_type:n.resource_type,resource_ref:n.resource_ref,label:n.label,...r?.length?{suggested_event_keys:r}:{}}}const ot=new Set(["localhost","127.0.0.1","::1","[::1]"]);function Vn(e){return e?.trim().toLowerCase().replace(/^\.+|\.+$/g,"")||null}function st(e,t){const n=Vn(t);if(!n)return!1;const r=e.toLowerCase().replace(/\.$/,"");return r===n||r.endsWith(`.${n}`)}function lt(e,t,n){try{const r=new URL(t),o=new URL(e,t),l=ot.has(o.hostname)&&ot.has(r.hostname),i=o.protocol===r.protocol&&(o.protocol==="https:"||o.protocol==="http:")&&st(o.hostname,n)&&st(r.hostname,n);return o.origin!==r.origin&&(l||i)&&(o.protocol=r.protocol,o.host=r.host),o.origin===r.origin&&o.pathname.startsWith("/api/v1/agents")&&(o.pathname=`/lobu${o.pathname}`),o.toString()}catch{return e}}const Bn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,yt=new Set(["suggest_actions"]),Pe="Thinking…";function Hn(e){const{textOut:t,statusLine:n,errorText:r,toolCalls:o}=e,l=[];n===Pe&&l.push({type:"reasoning"}),r&&l.push({type:"error",text:r});let i=t;return n&&n!==Pe&&(i=t?`${t}
2
-
3
- ${n}`:n),i&&l.push({type:"text",text:i}),l.push(...o),l}const Rt=[];function zn(e,t,n){return e?.length?e:n===0?t:[]}const Je=a.createContext(null);function Ee(){const e=a.useContext(Je);if(!e)throw new Error("useLobuChat must be used within <LobuChatProvider>");return e}function Lo({messages:e,workspaceSlug:t=null,children:n}){const r=a.useMemo(()=>({messages:e,running:!1,append:()=>{},cancel:()=>{},pendingAttachments:[],addAttachments:()=>{},removeAttachment:()=>{},agentId:null,conversationId:"",workspaceSlug:t,currentSuggestions:null,starters:Rt}),[e,t]);return s.jsx(Je.Provider,{value:r,children:n})}const wt=/\[([^\]]*)\]\((\S*?\/api\/v1\/files\/[^)\s]+)\)/g;function at(e){return e.replace(/<lobu_internal_context>[\s\S]*?<\/lobu_internal_context>\n*/g,"").replace(wt,"").replace(/\n{3,}/g,`
4
-
5
- `).trim()}function Wn(e){const t=[];for(const n of e.matchAll(wt)){const r=n[1]?.trim()||"file",o=n[2];o&&t.push({name:r,url:o})}return t}function Kn(e,t={}){if(typeof e=="string"){const r=at(e);return r?[{type:"text",text:r}]:[]}if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="text"&&typeof o.text=="string"){const l=at(o.text);l&&n.push({type:"text",text:l})}else t.showToolCalls&&o.type==="toolCall"&&typeof o.name=="string"&&!yt.has(o.name)?n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.arguments??{},...o.result!==void 0?{result:o.result}:{}}):t.showToolCalls&&o.type==="tool_use"&&typeof o.name=="string"&&n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.input??{},...o.result!==void 0?{result:o.result}:{}})}return n}function qn(e){const t=[],n=r=>{for(const{name:o,url:l}of Wn(r))t.push({id:`file-${t.length}`,name:o,url:l,isImage:Bn.test(o)})};if(typeof e=="string")return n(e),t.length>0?t:void 0;if(Array.isArray(e)){for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="image"&&typeof o.data=="string"){const l=o.mimeType||"image/png";t.push({id:`img-${t.length}`,name:`image-${t.length+1}`,imageDataUrl:`data:${l};base64,${o.data}`,isImage:!0})}else o.type==="text"&&typeof o.text=="string"&&n(o.text)}return t.length>0?t:void 0}}function Gn(e,t){if(e.type==="bashExecution"){const r=e.content??{},o=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:"user",parts:[{type:"bash",command:r.command??"",output:r.output??"",exitCode:r.exitCode,cancelled:r.cancelled??!1}],createdAt:o&&!Number.isNaN(o)?o:void 0}}if(e.type!=="message"||e.isVerbose||e.role!=="assistant"&&e.role!=="user"&&e.role!=="system")return null;const n=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:e.role,parts:Kn(e.content,t),attachments:qn(e.content),createdAt:n&&!Number.isNaN(n)?n:void 0}}const Qn=[],Jn=[];function Yn(e){let t=null;for(const n of e)n.type==="suggestion"&&(t=n.prompts.length>0?n.prompts:null);return t}function Xn(e,t){if(e.length===0)return null;const n=[];for(const r of e)if(r.type!=="suggestion"){if(r.type==="agent-error"){n.push({type:"error",text:String(r.error??"Agent reported an error.")});const o=xt(r.errorCode,{...t,provider:r.errorContext?.provider,model:r.errorContext?.model});o&&n.push({type:"tool-call",toolCallId:`error-run-${r.runId}`,toolName:"link-button",args:{label:o.label,url:o.href}});continue}n.push({type:"tool-call",toolCallId:`approval-event-${r.eventId}`,toolName:"tool-approval",args:{runId:r.runId,action:r.action,proposal:r.proposal,current:r.current,fields:r.fields??null,attribution:r.attribution??null,resourceKind:r.resourceKind??null,reason:r.reason??null,status:r.status??"pending",reviewedByName:r.reviewedByName??null}})}return n.length===0?null:{id:"history-interactions",role:"assistant",parts:n}}const Zn=3e4,er=3*Zn,tr=15e3;function it(e){try{return JSON.parse(e.data)}catch{return{content:e.data}}}const ye=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;function nr(e){const t=[],n=new Set;for(const r of e){if(!r||typeof r!="object")continue;const{title:o,message:l}=r;if(typeof o!="string"||typeof l!="string")continue;const i=o.trim(),c=l.trim();if(i.length===0||c.length===0)continue;const u=`${i}\0${c}`;n.has(u)||(n.add(u),t.push({title:i,message:c}))}return t.length>0?t:null}function $o({agentId:e,workspaceSlug:t,thread:n="agent-panel",loadHistory:r=!0,ephemeralContext:o,onFirstUserMessage:l,children:i,initialDraft:c}){const u=Bt(),d=a.useRef(null),p=a.useRef(null),v=a.useRef(!1),m=a.useRef(o),g=a.useRef(!1),R=a.useRef(null);m.current=o;const{data:A,isLoading:x}=Ht(e,n,{orgSlug:t,enabled:r&&!!e&&!!n}),T=A?.messages??Qn,W=A?.interactions??Jn,{data:U}=zt(e,{enabled:!!e}),G=U?.starters??Rt,K=!!(U?.showToolCalls??U?.settings?.showToolCalls),[E,$]=a.useState([]),[J,ae]=a.useState(!1),[D,Q]=a.useState([]),[Y,y]=a.useState(null),w=a.useRef(!1);w.current=J;const j=a.useMemo(()=>T.map(I=>Gn(I,{showToolCalls:K})).filter(I=>I!==null),[T,K]),O=a.useRef(!1);a.useEffect(()=>{if(O.current||x||w.current)return;O.current=!0;const I=Xn(W,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});$(I?[...j,I]:j),y(Yn(W))},[e,x,j,W,t]);const k=a.useCallback(()=>{u.invalidateQueries({queryKey:["agent-thread-messages",t,e,n]}),u.invalidateQueries({queryKey:["agent-threads",t,e]})},[u,t,e,n]),Z=a.useCallback(async()=>{if(d.current)return d.current;if(p.current)return p.current;if(!e)throw new Error("No agent selected");const I=(async()=>{const M=await Ze(`${Ve}/lobu/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json",...t?{"x-lobu-org":t}:{}},credentials:"include",body:JSON.stringify({agentId:e,thread:n}),timeoutMs:2e4});if(!M.ok)throw await et(M);const V=await M.json(),N=Wt(),z={sessionId:V.agentId,sseUrl:lt(V.sseUrl,Ve,N),messagesUrl:lt(V.messagesUrl,Ve,N)};return d.current=z,z})();p.current=I;try{return await I}catch(M){throw d.current=null,M}finally{p.current=null}},[e,t,n]),te=a.useCallback(async(I,M,V)=>{const N=new AbortController;R.current=N;const z=S=>{$(q=>q.map(f=>f.id===V?{...f,parts:S}:f))};let ee;try{ee=await Z()}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Could not start a session."}`}]);return}let B=await tt(ee.sseUrl,{throwOnFailure:!0});const oe=[];let me=null;const ue=()=>{const S=me;me=null,S?.()},he=S=>{oe.push(S),ue()};let ge=!1,be=null;const ke=new Promise(S=>{be=S});let xe=0,ve=Date.now();const de=S=>{ve=Date.now();const q=Number(S.lastEventId);Number.isFinite(q)&&q>xe&&(xe=q)},Ie=["output","status","complete","closed","agent-error","question","link-button","tool-approval","tool_use"],Ce=S=>{S.addEventListener("open",()=>{ge=!0,be?.()}),S.addEventListener("connected",f=>{de(f),ge||(ge=!0,be?.())}),S.addEventListener("ping",de);const q=f=>h=>{de(h);const C=h;typeof C.data=="string"&&he({kind:f,payload:it(C)})};for(const f of Ie)S.addEventListener(f,q(f));S.addEventListener("error",f=>{const h=f;if(typeof h.data=="string"&&h.data){de(f),he({kind:"error",payload:it(h)});return}S.readyState===EventSource.CLOSED&&he({kind:"error",payload:{error:"Connection closed"}})})};Ce(B);const _e=async()=>{B.close();let S=ee.sseUrl;if(xe){const q=new URL(ee.sseUrl,window.location.origin);q.searchParams.set("since",String(xe)),S=q.toString()}B=await tt(S,{throwOnFailure:!1}),Ce(B),ve=Date.now()};await Promise.race([ke,new Promise(S=>setTimeout(S,1500))]);const Te=()=>{B.close(),ue()};N.signal.addEventListener("abort",Te,{once:!0});try{const S=m.current?.trim(),q=!!S&&!g.current;q&&(g.current=!0);let f;if(M.length>0){const b=new FormData;b.set("content",I),q&&S&&b.set("ephemeralContext",S);for(const _ of M)b.append("files",_,_.name);f={method:"POST",credentials:"include",body:b,timeoutMs:12e4}}else{const b={content:I};q&&S&&(b.ephemeralContext=S),f={method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(b),timeoutMs:2e4}}const h=await Ze(ee.messagesUrl,f);if(!h.ok)throw d.current=null,await et(h);let C="",L=Pe,ce=null;const H=[],fe=()=>Hn({textOut:C,statusLine:L,errorText:ce,toolCalls:H});for(z(fe());!N.signal.aborted;){if(oe.length===0){let _;const ne=await Promise.race([new Promise(Fe=>{me=()=>Fe(!0)}),new Promise(Fe=>{_=setTimeout(()=>Fe(!1),tr)})]);_&&clearTimeout(_),!ne&&Date.now()-ve>=er&&(await _e(),k());continue}const b=oe.shift();if(b){if(b.kind==="output")L=null,C+=String(b.payload.content??"");else if(b.kind==="status")L=Pe;else if(b.kind==="complete"){L=null;const _=b.payload.finalText;typeof _=="string"&&_.length>0&&(C=_);const ne=b.payload.suggestions;ne!==void 0&&y(Array.isArray(ne)?nr(ne):null),k(),z(fe());return}else if(b.kind==="closed"){d.current=null;const _=b.payload.reason;L=`Session ended${_?`: ${_}`:""}.`,k(),z(fe());return}else if(b.kind==="error"||b.kind==="agent-error"){L=null,ce=typeof b.payload.error=="string"&&b.payload.error?b.payload.error:"Agent reported an error.";const _=b.payload.errorContext&&typeof b.payload.errorContext=="object"?b.payload.errorContext:void 0,ne=xt(b.payload.errorCode,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin,provider:typeof _?.provider=="string"?_.provider:void 0,model:typeof _?.model=="string"?_.model:void 0});ne&&H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:ne.label,url:ne.href}}),k(),z(fe());return}else if(b.kind==="question")H.push({type:"tool-call",toolCallId:ye("q"),toolName:"question",args:{question:b.payload.question??"",options:b.payload.options??[]}});else if(b.kind==="tool_use"){if(L=null,yt.has(b.payload.name??"")){z(fe());continue}const _=b.payload.result_summary,ne=vt(_);if(!K&&!ne){z(fe());continue}H.push({type:"tool-call",toolCallId:b.payload.toolCallId??ye("t"),toolName:K?b.payload.name??"tool":"subscription-candidate",args:K?b.payload.input??{}:null,result:_,isError:b.payload.isError})}else if(b.kind==="link-button")H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:b.payload.label??"Open link",url:b.payload.url??""}});else if(b.kind==="tool-approval"){const _=b.payload.runId;if(typeof _!="number")continue;H.push({type:"tool-call",toolCallId:`run-${_}`,toolName:"tool-approval",args:{runId:_,action:b.payload.action??null,proposal:b.payload.proposal??null,current:b.payload.current??null,fields:b.payload.fields??null,attribution:b.payload.attribution??null,resourceKind:b.payload.resourceKind??null}})}z(fe())}}}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Send failed."}`}])}finally{N.signal.removeEventListener("abort",Te),B.close()}},[e,Z,k,K,t]),re=a.useCallback(I=>{const M=I.trim(),V=D.map(B=>B.file);if(!M&&V.length===0||w.current||!e)return;v.current||(v.current=!0,l?.(M||V[0]?.name||""));const N={id:ye("u"),role:"user",parts:M?[{type:"text",text:M}]:[],attachments:D.map(B=>({id:B.id,name:B.name,isImage:B.isImage,imageDataUrl:B.isImage?URL.createObjectURL(B.file):void 0})),createdAt:Date.now()},z=ye("asst"),ee={id:z,role:"assistant",parts:[{type:"reasoning"}],createdAt:Date.now()};$(B=>[...B,N,ee]),Q([]),ae(!0),w.current=!0,te(M,V,z).finally(()=>{ae(!1),w.current=!1,R.current=null})},[e,l,D,te]),le=a.useCallback(()=>{R.current?.abort()},[]),Se=a.useCallback(I=>{const M=Array.from(I);Q(V=>[...V,...M.map(N=>({id:crypto.randomUUID(),name:N.name,file:N,isImage:N.type.startsWith("image/")}))])},[]),X=a.useCallback(I=>{Q(M=>M.filter(V=>V.id!==I))},[]),ie=a.useRef(!1);a.useEffect(()=>{if(ie.current)return;const I=Kt(n);I&&(ie.current=!0,re(I))},[n,re]);const F=a.useMemo(()=>({messages:E,running:J,append:re,cancel:le,pendingAttachments:D,addAttachments:Se,removeAttachment:X,initialDraft:c,agentId:e,conversationId:n,workspaceSlug:t,currentSuggestions:Y,starters:G}),[E,J,re,le,D,Se,X,c,e,n,t,Y,G]);return r&&x?s.jsx(wn,{}):s.jsx(Je.Provider,{value:F,children:i})}const ct="mx-0.5 inline-flex items-center gap-1 rounded-md bg-accent px-1.5 py-0.5 align-baseline font-medium text-[0.9em] text-accent-foreground no-underline";function rr({refItem:e}){const t=En[e.kind]??qt;return An(e.path)?s.jsxs("span",{className:ct,children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]}):s.jsxs(mt,{to:e.path,className:P(ct,"hover:bg-accent/80"),children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]})}const Ye=({text:e,renderText:t})=>jn(e)?s.jsx(s.Fragment,{children:Nn(e).map((n,r)=>n.type==="ref"?s.jsx(rr,{refItem:n.ref},`r${r}`):s.jsx("span",{children:t(n.text)},`t${r}`))}):s.jsx(s.Fragment,{children:t(e)}),or=({label:e="Thinking"})=>s.jsx("span",{className:"aui-thinking-shimmer inline-block text-sm","aria-live":"polite","aria-busy":"true",children:e}),St=a.createContext(null),Ct=()=>{const e=a.useContext(St);if(!e)throw new Error("ChainOfThought components must be used within ChainOfThought");return e},Tt=a.memo(({className:e,open:t,defaultOpen:n=!1,onOpenChange:r,children:o,...l})=>{const[i,c]=Gt({prop:t,defaultProp:n,onChange:r}),u=a.useMemo(()=>({isOpen:i,setIsOpen:c}),[i,c]);return s.jsx(St.Provider,{value:u,children:s.jsx("div",{className:P("not-prose max-w-prose space-y-4",e),...l,children:o})})}),jt=a.memo(({className:e,children:t,...n})=>{const{isOpen:r,setIsOpen:o}=Ct();return s.jsx(ht,{onOpenChange:o,open:r,children:s.jsxs(Qt,{className:P("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:[s.jsx(Jt,{className:"size-4"}),s.jsx("span",{className:"flex-1 text-left",children:t??"Chain of Thought"}),s.jsx(Yt,{className:P("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),Nt=a.memo(({className:e,icon:t=Zt,label:n,description:r,status:o="complete",children:l,...i})=>{const c={complete:"text-muted-foreground",active:"text-foreground",pending:"text-muted-foreground/50"};return s.jsxs("div",{className:P("flex gap-2 text-sm",c[o],"fade-in-0 slide-in-from-top-2 animate-in",e),...i,children:[s.jsxs("div",{className:"relative mt-0.5",children:[s.jsx(t,{className:"size-4"}),s.jsx("div",{className:"-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border"})]}),s.jsxs("div",{className:"flex-1 space-y-2 overflow-hidden",children:[s.jsx("div",{children:n}),r&&s.jsx("div",{className:"text-muted-foreground text-xs",children:r}),l]})]})}),Et=a.memo(({className:e,children:t,...n})=>{const{isOpen:r}=Ct();return s.jsx(ht,{open:r,children:s.jsx(Xt,{className:P("mt-2 space-y-3","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t})})});Tt.displayName="ChainOfThought";jt.displayName="ChainOfThoughtHeader";Nt.displayName="ChainOfThoughtStep";Et.displayName="ChainOfThoughtContent";function sr(e){return{contentIds:e.filter(n=>Number.isSafeInteger(n)&&n>0),sortBy:"date",sortOrder:"asc"}}function lr({ownerSlug:e,eventIds:t}){const n=t.join(","),r=a.useMemo(()=>sr(n.split(",").map(Number)),[n]);return r.contentIds.length===0?null:s.jsx(en,{owner:e,children:({organizationId:o,ownerSlug:l})=>o?s.jsx(Pn,{organizationId:o,ownerSlug:l,filters:r,hideOriginator:!0}):null})}function ar({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=He(ir(r,o),t);if(!n)return a.createElement(e,l);if(typeof n=="function")return n(l,r);if(!a.isValidElement(n))return null;let i=n.props,c={...He(l,i),ref:Ae(l.ref,i.ref)};return a.cloneElement(n,c)}function He(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let l=r[o];if(l===void 0)continue;let i=t[o];o==="className"?t[o]=[i,l].filter(Boolean).join(" "):o==="style"?t[o]={...i,...l}:o==="ref"?t[o]=Ae(i,l):ur(o)&&typeof i=="function"&&typeof l=="function"?t[o]=cr(l,i):t[o]=l}}return t}function ir(e,t){let n={};for(let r of Object.keys(e)){let o=e[r],l=t?.[r]?.(o);if(l){Object.assign(n,l);continue}if(r==="slot"){n["data-slot"]=o;continue}let i=`data-${String(r).replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`;typeof o=="boolean"?n[i]=o?"":void 0:o!=null&&(n[i]=String(o))}return n}function cr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function ur(e){return/^on[A-Z]/.test(e)}function Ae(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var dr=8,fr=64,pr=0,Me=.5,mr=180,hr=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),At={start:!1,end:!1},gr=[],Le={currentAnchorId:null,visibleMessageIds:gr};function br({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return At;let o=Xe({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function xr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return Le;let i=o.getBoundingClientRect(),c=i.top+t+n,u=typeof IntersectionObserver>"u",d=[],p=null;for(let v of je(e,r)){let m=v.dataset.messageId;if(!m)continue;let g=v.dataset.scrollAnchor==="true",R=g||u?v.getBoundingClientRect():null;(u&&R?R.bottom>c&&R.top<i.bottom:l.has(m))&&d.push(m),g&&R&&R.top<=c+Me&&(p=m)}return d.length===0&&p===null?Le:{currentAnchorId:p,visibleMessageIds:d}}function je(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function vr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r?.dataset.scrollAnchor==="true")return r}return null}function yr(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function Rr(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor==="true"&&(n+=1,n>1))return!0;return!1}function wr(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor==="true")return n}return null}function Sr({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of je(e,t)){if(!o.dataset.messageId)continue;let l=o.getBoundingClientRect();if(l.bottom>r.top&&l.top<r.bottom)return o}return null}function Cr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=kt(t,o),i=t.getBoundingClientRect().height,c=Nr(r);if(e==="center"){let u=Math.max(0,o.clientHeight-c.start-c.end);return l-c.start-(u-i)/2-n}if(e==="end")return l-o.clientHeight+i+c.end+n;if(e==="nearest"){let u=l+i,d=o.scrollTop+c.start,p=o.scrollTop+o.clientHeight-c.end;return l>=d&&u<=p?o.scrollTop:l<d?l-c.start-n:u-o.clientHeight+c.end+n}return l-c.start-n}function kt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Oe(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Tr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Xe({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Xe({content:e,spacer:t,viewport:n}){let r=je(e,t),o=It(e),l=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let u of r){let d=u.getBoundingClientRect();c=Math.max(c,d.bottom-l.top+i+o.end)}return c}function jr(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function It(e){let t=window.getComputedStyle(e);return{end:ze(t.paddingBlockEnd||t.paddingBottom),start:ze(t.paddingBlockStart||t.paddingTop)}}function Nr(e){let t=e?.parentElement;return t?It(t):{end:0,start:0}}function Er(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return ze(n)}function ze(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Ar({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:u,defaultScrollPositionAppliedRef:d,itemCountRef:p,messageElementsRef:v,modeRef:m,pendingScrollToMessageRef:g,prependRestoreRef:R,scrollMarginRef:A,scrollPreviousItemPeekRef:x,spacerGapRef:T,spacerHeightRef:W,spacerRef:U,viewportRef:G}=e,K=a.useCallback(y=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==y&&(i.current=y,t()),y&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},mr))},[t]),E=a.useCallback(y=>{let w=U.current;if(!w)return;let j=Math.max(0,Math.ceil(y));W.current!==j&&(W.current=j,w.hidden=j===0,w.style.height=`${j}px`,w.style.marginTop=j>0?`${-T.current}px`:"")},[]),$=a.useCallback((y,{behavior:w="auto",autoscrolling:j=!1}={})=>{let O=G.current;if(!O)return;let k=Math.max(0,y);if(Math.abs(O.scrollTop-k)<=Me){O.scrollTop=k,t();return}j&&K(!0),O.scrollTo({top:k,behavior:w}),n()},[t,n,K]),J=a.useCallback(({behavior:y="auto"}={})=>G.current?(E(0),o.current=null,m.current="free-scrolling",$(0,{behavior:y}),r(),!0):!1,[r,$,E]),ae=a.useCallback(({behavior:y="auto"}={})=>{let w=G.current;return w?(E(0),o.current=null,m.current=l.current?"following-bottom":"free-scrolling",$(jr(w),{autoscrolling:!0,behavior:y}),r(),!0):!1},[r,$,E]),D=a.useCallback((y,{align:w="start",behavior:j="auto",scrollMargin:O=A.current}={},{keepPreviousPeek:k=!1}={})=>{let Z=u.current,te=G.current;if(!Z||!te||!Z.contains(y))return!1;let re=Cr({align:w,element:y,scrollMargin:k?O+x.current:O,spacer:U.current,viewport:te}),le=Tr({content:Z,scrollTop:re,spacer:U.current,viewport:te});return E(le),R.current={element:y,viewportTop:Oe(y,te)},m.current=k?"anchored-to-message":"settling-jump",o.current=k?y:null,$(re,{behavior:j}),r(),!0},[r,$,E]),Q=a.useCallback(()=>{let y=o.current;return!y||!y.isConnected||m.current!=="anchored-to-message"?!1:D(y,{align:"start"},{keepPreviousPeek:!0})},[D]),Y=a.useCallback((y,w)=>{let j=v.current.get(y);return j?(d.current=!0,D(j,w)?(g.current=null,!0):(g.current={messageId:y,options:w},!0)):p.current===0?(g.current={messageId:y,options:w},d.current=!0,!0):!1},[D]);return{flushPendingScrollToMessage:a.useCallback(()=>{let y=g.current;if(!y)return!1;let w=v.current.get(y.messageId);return!w||!D(w,y.options)?!1:(g.current=null,d.current=!0,!0)},[D]),reanchorToAnchoredMessage:Q,scrollToElement:D,scrollToEnd:ae,scrollToMessage:Y,scrollToStart:J}}function _t(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(l=>l()))},subscribe:(o,l,i)=>{let c=r.size===0;return r.add(o),c&&l?.(),()=>{r.delete(o),r.size===0&&i?.()}}}}function kr(e,t){return _t(e,t)}function Ir(){return _t(Le,Or)}function _r(e,t){return e.start===t.start&&e.end===t.end}function Or(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Pr({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let o=a.useRef(e),l=a.useRef(!1),i=a.useRef(null),c=a.useRef(!1),u=a.useRef(t),d=a.useRef(0),p=a.useRef(null),v=a.useRef(0),m=a.useRef(e?"following-bottom":"free-scrolling"),g=a.useRef(new Map),R=a.useRef(null),A=a.useRef(null),x=a.useRef(null),T=a.useRef(r),W=a.useRef(!0),U=a.useRef(null),G=a.useRef(n),K=a.useRef(null),E=a.useRef(0),$=a.useRef(0),J=a.useRef(null),ae=a.useRef(null),D=a.useRef(null),Q=a.useRef(null),Y=a.useRef(null),y=a.useRef(null),w=a.useRef(null),j=a.useRef(null),O=a.useRef(new Set),k=a.useRef(new WeakSet);return D.current===null&&(D.current=kr(At,_r)),j.current===null&&(j.current=Ir()),o.current=e,u.current=t,G.current=n,T.current=r,{autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:Q,streamingTurnRef:x,contentRef:i,defaultScrollPositionAppliedRef:c,firstItemRef:p,itemCountRef:d,lastScrollTopRef:v,messageElementsRef:g,modeRef:m,pendingScrollFrameRef:K,pendingScrollToMessageRef:R,prependRestoreRef:A,preserveScrollOnPrependRef:W,rootRef:U,scrollEdgeThresholdRef:u,scrollMarginRef:G,scrollPreviousItemPeekRef:T,spacerGapRef:E,spacerHeightRef:$,spacerRef:J,stateFrameRef:ae,stateStore:D.current,viewportRef:Y,visibilityFrameRef:y,visibilityObserverRef:w,visibilityStore:j.current,visibleMessageIdsRef:O,handledScrollAnchorsRef:k}}function ut(e,t){return a.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Mr({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=dr,scrollPreviousItemPeek:r=fr,scrollMargin:o=pr}){let l=Pr({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:u,autoscrollingTimeoutRef:d,contentRef:p,defaultScrollPositionAppliedRef:v,firstItemRef:m,itemCountRef:g,lastScrollTopRef:R,messageElementsRef:A,modeRef:x,pendingScrollFrameRef:T,pendingScrollToMessageRef:W,prependRestoreRef:U,preserveScrollOnPrependRef:G,rootRef:K,scrollEdgeThresholdRef:E,scrollMarginRef:$,scrollPreviousItemPeekRef:J,spacerGapRef:ae,spacerHeightRef:D,spacerRef:Q,stateFrameRef:Y,stateStore:y,viewportRef:w,visibilityFrameRef:j,visibilityObserverRef:O,visibilityStore:k,visibleMessageIdsRef:Z,handledScrollAnchorsRef:te}=l,re=a.useRef(t);re.current!==t&&(re.current=t,v.current=!1);let le=a.useCallback(f=>{let h=K.current,C=w.current,L=[f.start&&"start",f.end&&"end"].filter(Boolean).join(" "),ce=u.current;for(let H of[h,C])H&&(L?H.setAttribute("data-scrollable",L):H.removeAttribute("data-scrollable"),H.toggleAttribute("data-autoscrolling",ce))},[]),Se=a.useCallback(f=>{let h=w.current?.scrollTop??0,C=h<R.current-Me;R.current=h,c.current&&!f.end&&x.current!=="settling-jump"&&x.current!=="anchored-to-message"?x.current="following-bottom":x.current==="following-bottom"&&f.end&&C&&!u.current&&(x.current="free-scrolling")},[]),X=a.useCallback(()=>{let f=br({content:p.current,scrollEdgeThreshold:E.current,spacer:Q.current,viewport:w.current});Se(f);let h=x.current==="following-bottom"?{...f,end:!1}:f;le(h),y.setSnapshot(h)},[Se,y,le]),ie=a.useCallback(()=>{Y.current===null&&(Y.current=window.requestAnimationFrame(()=>{Y.current=null,X()}))},[X]),F=a.useCallback(()=>{k.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,k.hasListeners()&&k.setSnapshot(xr({content:p.current,scrollMargin:$.current,scrollPreviousItemPeek:J.current,spacer:Q.current,viewport:w.current,visibleMessageIds:Z.current}))}))},[k]),{flushPendingScrollToMessage:I,reanchorToAnchoredMessage:M,scrollToElement:V,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee}=Ar({refs:l,commitScrollState:X,scheduleStateCommit:ie,scheduleVisibilitySync:F}),B=a.useCallback(()=>{let f=U.current,h=w.current;if(!f||!h||!f.element.isConnected)return!1;let C=Oe(f.element,h)-f.viewportTop;return Math.abs(C)<=Me?!1:(h.scrollTop+=C,f.viewportTop=Oe(f.element,h),ie(),F(),!0)},[ie,F]),oe=a.useCallback(()=>{let f=p.current,h=w.current;if(!f||!h){U.current=null;return}let C=Sr({content:f,spacer:Q.current,viewport:h});U.current=C?{element:C,viewportTop:Oe(C,h)}:null},[]),me=a.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,I()&&oe()}))},[oe,I]),ue=a.useCallback(()=>{if(!t||v.current||g.current===0)return!1;let f=!1;if(t==="last-anchor"){let h=p.current,C=w.current,L=h&&C?wr(je(h,Q.current)):null;if(!h||!C||!L)f=N({behavior:"auto"});else{let ce=kt(L,C);f=Xe({content:h,spacer:Q.current,viewport:C})-ce<=C.clientHeight?N({behavior:"auto"}):V(L,{align:"start"},{keepPreviousPeek:!0})}}else f=t==="end"?N({behavior:"auto"}):ee({behavior:"auto"});return f?(v.current=!0,!0):!1},[t,V,N,ee]),he=a.useCallback(()=>{let f=p.current;if(!f)return;let h=je(f,Q.current),C=g.current,L=m.current;g.current=h.length,m.current=h[0]??null,(()=>{if(I())return;if(C===0){if(ue()||h.length>0&&c.current&&N({behavior:"auto"}))return;X(),F();return}let ce=L?h.indexOf(L):-1;if(G.current&&ce>0){B();return}if(h.length>C){let H=vr(h,C);if(H){if(c.current&&x.current==="following-bottom"&&Rr(h,C)){N({behavior:"auto"});return}V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}if(h.length===C){let H=yr(h,te.current);if(H){V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}x.current==="following-bottom"&&c.current?N({behavior:"auto"}):(X(),F())})(),oe()},[ue,oe,X,I,B,F,V,N]),ge=a.useCallback(()=>{if(x.current==="following-bottom"&&c.current){N({behavior:"auto"});return}let f=D.current;if(M()){c.current&&f>0&&D.current===0&&N({behavior:"auto"});return}ie(),F()},[M,ie,F,N]),be=a.useCallback(()=>{let f=w.current;if(!(!f||!k.hasListeners())){if(typeof IntersectionObserver>"u"){F();return}O.current||(O.current=new IntersectionObserver(h=>{for(let C of h){let L=C.target.dataset.messageId;L&&(C.isIntersecting?Z.current.add(L):Z.current.delete(L))}F()},{root:f,rootMargin:`${-($.current+J.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),A.current.forEach(h=>{O.current?.observe(h)}),F()}},[F,k]),ke=a.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),O.current?.disconnect(),O.current=null,Z.current.clear(),k.setSnapshot(Le)},[k]),xe=a.useCallback((f,h,C)=>{if(h){A.current.set(f,h),O.current?.observe(h),F(),W.current?.messageId===f&&me();return}C&&A.current.get(f)===C&&(A.current.delete(f),Z.current.delete(f),O.current?.unobserve(C),F())},[me,F]),ve=a.useCallback(()=>{(x.current==="following-bottom"||x.current==="anchored-to-message"||x.current==="settling-jump")&&(i.current=null,x.current="free-scrolling")},[]),de=a.useCallback(()=>le(y.getSnapshot()),[y,le]),Ie=ut(K,de),Ce=ut(w,de),_e=a.useCallback(f=>{p.current=f},[]),Te=a.useCallback(f=>{Q.current=f,ae.current=Er(f?.parentElement??null)},[]),S=a.useCallback(()=>{X(),F(),oe()},[oe,X,F]),q=a.useMemo(()=>({handleContentChange:he,handleResize:ge,observeVisibility:be,preserveScrollOnPrependRef:G,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee,setContentElement:_e,setRootElement:Ie,setSpacerElement:Te,setViewportElement:Ce,stateStore:y,syncAfterScroll:S,unobserveVisibility:ke,userScrollIntent:ve,viewportRef:w,visibilityStore:k}),[he,ge,be,N,z,ee,_e,Ie,Te,Ce,y,S,ke,ve,k]);return a.useLayoutEffect(()=>{ue()},[ue]),a.useEffect(()=>()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),T.current!==null&&(window.cancelAnimationFrame(T.current),T.current=null),O.current?.disconnect(),O.current=null},[]),a.useLayoutEffect(()=>{if(e&&x.current==="following-bottom"&&g.current>0){N({behavior:"auto"});return}X()},[e,X,N]),{context:q,registerMessage:xe}}function Lr(e){let t=a.useRef(e);return t.current=e,t}var Ot=a.createContext(null),Pt=a.createContext(null);function Re(){let e=a.useContext(Ot);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function $r(){let e=a.useContext(Pt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Mt(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=Re();return a.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function Lt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:n}=Re(),r=a.useCallback(o=>n.subscribe(o,e,t),[e,t,n]);return a.useSyncExternalStore(r,n.getSnapshot,n.getSnapshot)}function Dr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:i,registerMessage:c}=Mr({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(Ot.Provider,{value:i,children:s.jsx(Pt.Provider,{value:c,children:t})})}function Ur({children:e,...t}){let{setRootElement:n}=Re();return s.jsx("div",{ref:n,...t,children:e})}function Fr({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:i=!0,ref:c,role:u,tabIndex:d,...p}){let{handleResize:v,preserveScrollOnPrependRef:m,setViewportElement:g,syncAfterScroll:R,userScrollIntent:A,viewportRef:x}=Re();m.current=i;let T=a.useCallback(E=>{g(E),Ae(c)?.(E)},[c,g]);function W(E){R(),r?.(E)}function U(E){A(),l?.(E)}function G(E){A(),o?.(E)}function K(E){hr.has(E.key)&&A(),n?.(E)}return a.useEffect(()=>{let E=x.current;if(!E||typeof ResizeObserver>"u")return;let $=0,J=new ResizeObserver(()=>{window.cancelAnimationFrame($),$=window.requestAnimationFrame(v)});return J.observe(E),()=>{window.cancelAnimationFrame($),J.disconnect()}},[v,x]),s.jsx("div",{ref:T,role:u??"region","aria-label":e??"Messages",tabIndex:d??0,onKeyDown:K,onScroll:W,onTouchMove:G,onWheel:U,...p,children:t})}function Vr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:i,handleResize:c,setContentElement:u,setSpacerElement:d}=Re(),p=a.useRef(null),v=a.useCallback(m=>{p.current=m,u(m),Ae(n)?.(m)},[n,u]);return a.useLayoutEffect(()=>{let m=p.current;if(!m||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(m,{childList:!0}),()=>g.disconnect()},[i]),a.useEffect(()=>{let m=p.current;if(!m||typeof ResizeObserver>"u")return;let g=0,R=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return R.observe(m),()=>{window.cancelAnimationFrame(g),R.disconnect()}},[c]),s.jsxs("div",{ref:v,role:r??"log","aria-relevant":e??"additions",...l,children:[t,s.jsx("div",{ref:d,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Br({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=$r(),l=a.useRef(null),i=a.useCallback(c=>{let u=l.current;l.current=c,e&&o(e,c,u),Ae(t)?.(c)},[e,t,o]);return s.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Hr({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:i="button",...c}){let{scrollToEnd:u,scrollToStart:d,stateStore:p}=Re(),v=Lr(r),m=a.useCallback(x=>p.subscribe(x),[p]),g=a.useCallback(()=>{let x=p.getSnapshot();return n==="start"?x.start:x.end},[n,p]),R=a.useSyncExternalStore(m,g,g),A=a.useCallback(x=>{R&&(v.current?.(x),x.defaultPrevented||(x.currentTarget.blur(),n==="start"?d({behavior:e}):u({behavior:e})))},[e,n,R,v,u,d]);return ar({defaultTagName:"button",props:He({type:i,inert:!R,tabIndex:R?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:A},c),render:o,state:{active:R,direction:n},stateAttributesMapping:{active:x=>({"data-active":x?"true":"false"})}})}var we={Provider:Dr,Root:Ur,Viewport:Fr,Content:Vr,Item:Br,Button:Hr};const zr=we.Provider;function Wr({className:e,...t}){return s.jsx(we.Root,{className:P("relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function Kr({className:e,...t}){return s.jsx(we.Viewport,{className:P("size-full min-h-0 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",e),...t})}function qr({className:e,...t}){return s.jsx(we.Content,{className:P("flex h-max min-h-full flex-col",e),...t})}function Gr({className:e,...t}){return s.jsx(we.Item,{className:P("min-w-0 shrink-0",e),...t})}function Qr({className:e,...t}){return s.jsx(we.Button,{direction:"end",behavior:"smooth",render:({active:n,...r})=>n?s.jsx(pe,{...r,type:"button",variant:"outline",size:"icon",className:P("absolute right-4 bottom-4 z-20 rounded-full bg-background ",e),"aria-label":"Scroll to latest message",children:s.jsx(tn,{})}):null,...t})}function Jr(e){if(!e)return"";const t=e.startsWith("?")?e.slice(1):e,n=new URLSearchParams(t);return n.get("message_id")?.trim()||n.get("message")?.trim()||""}function Yr(e){const t=e.scrollTarget.trim();return t?e.alreadyScrolledTo===t?{scroll:!1}:e.messageIds.includes(t)?{scroll:!0,id:t}:{scroll:!1}:{scroll:!1}}const Xr="lobu-spa";function dt(e){return typeof e=="string"&&/^https?:\/\//i.test(e.trim())}function $e(e,t){return t.type==="tool-call"?`tc-${t.toolCallId}`:t.type==="reasoning"?`${e.id}-reasoning`:t.type==="bash"?`${e.id}-bash-${t.command.slice(0,24)}`:t.type==="error"?`${e.id}-error`:`${e.id}-text-${t.text.slice(0,24)}`}const Do=({afterMessagesContent:e,readOnly:t=!1,readerPositionMode:n="messages",interactionExtension:r,onRunSelect:o})=>{const{messages:l,agentId:i,conversationId:c}=Ee(),{data:u=[]}=nn(i,{conversationId:c});return s.jsx(Mn,{extension:r,children:s.jsxs("div",{"data-agent-thread":!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsx(Zr,{messages:l,trips:u,mode:n,afterMessagesContent:e,onRunSelect:o}),t?null:s.jsx("div",{className:Sn,children:s.jsx(Eo,{})})]})})},Zr=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>s.jsx(zr,{autoScroll:!0,defaultScrollPosition:n==="runs"?"last-anchor":"end",scrollPreviousItemPeek:48,children:s.jsx(to,{messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})});function eo(e){if(!e.startsWith("sep:"))return null;const t=Number(e.slice(4));return Number.isFinite(t)&&t>0?t:null}const to=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>{const{currentAnchorId:l}=Lt(),{scrollToMessage:i}=Mt(),c=a.useRef(null);a.useEffect(()=>{if(e.length===0||typeof window>"u")return;const d=Yr({messageIds:e.map(p=>p.id),scrollTarget:Jr(window.location.search),alreadyScrolledTo:c.current});d.scroll&&(c.current=d.id,i(d.id,{align:"start",behavior:"smooth"}))},[e,i]);const u=d=>n==="runs"?d.id.startsWith("sep:"):d.role==="user";return s.jsxs(Wr,{children:[s.jsx(Kr,{"aria-label":n==="runs"?"Automation run history":"Conversation",children:s.jsxs(qr,{className:P(qe,Cn),children:[e.map(d=>{const p=n==="runs"&&o?eo(d.id):null;return s.jsx(Gr,{messageId:d.id,scrollAnchor:u(d),"aria-current":d.id===l?"location":void 0,className:P("flex flex-col",n==="runs"&&u(d)&&"border-l-2 border-transparent pl-2 transition-colors",n==="runs"&&d.id===l&&"border-primary"),children:p!=null?s.jsx(go,{message:d,onClick:()=>o?.(p)}):s.jsx(so,{message:d})},d.id)}),t.map(d=>s.jsx(ro,{trip:d},d.id)),s.jsx(oo,{}),r?s.jsx("div",{className:"mt-auto shrink-0 py-2",children:r}):null]})}),e.length>0?s.jsx(no,{messages:e,mode:n}):null,s.jsx(Qr,{})]})},no=({messages:e,mode:t})=>{const{scrollToMessage:n}=Mt(),{currentAnchorId:r,visibleMessageIds:o}=Lt(),l=t==="runs"?e.flatMap(c=>c.parts).filter(c=>c.type==="tool-call"&&c.toolName==="tool-approval"&&c.args!==null&&typeof c.args=="object"&&c.args.status==="pending").length:0,i=e.flatMap(c=>{if(!(t==="runs"?c.id.startsWith("sep:"):c.role==="user"))return[];const d=c.parts.find(p=>p.type==="text");return[{id:c.id,label:d?.type==="text"?d.text:"Automation run"}]});return i.length===0?null:s.jsxs(cn,{children:[s.jsx(un,{asChild:!0,children:s.jsxs(pe,{type:"button",variant:"outline",size:"icon",className:P("absolute top-1/2 right-4 z-20 -translate-y-1/2 rounded-full bg-background/95 ",l>0&&"w-auto px-3"),"aria-label":l>0?`Open transcript outline, ${l} ${l===1?"approval":"approvals"} waiting`:"Open transcript outline",children:[s.jsx(dn,{}),l>0?s.jsxs("span",{className:"text-xs tabular-nums",children:[l," waiting"]}):null]})}),s.jsxs(fn,{side:"left",align:"center",className:"w-80 space-y-3 p-3",children:[s.jsxs("div",{className:"px-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"Transcript outline"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:t==="runs"?"Track and jump between Automation runs.":"Track and jump between your messages."})]}),s.jsx("div",{className:"max-h-80 space-y-1 overflow-y-auto",children:i.map(c=>{const u=c.id===r,d=o.includes(c.id);return s.jsxs(pe,{type:"button",variant:u?"secondary":"ghost",className:"h-auto w-full justify-start gap-2 px-2 py-2 text-left text-xs font-normal","aria-current":u?"location":void 0,onClick:()=>n(c.id,{align:"start",behavior:"smooth"}),children:[s.jsx("span",{className:P("size-1.5 shrink-0 rounded-full bg-muted-foreground/30",d&&"bg-primary/60",u&&"bg-primary")}),s.jsx("span",{className:"line-clamp-2",children:c.label})]},c.id)})})]})]})},ro=({trip:e})=>s.jsxs("div",{className:P(qe,"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive"),children:[s.jsx(ln,{className:"mt-0.5 size-4 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-medium",children:["Guardrail blocked: ",e.guardrailName," ",s.jsxs("span",{className:"font-normal opacity-70",children:["(",e.stage,")"]})]}),e.reason?s.jsx("div",{className:"mt-0.5 break-words opacity-80",children:e.reason}):null]})]}),oo=()=>{const{currentSuggestions:e,starters:t,messages:n,running:r,append:o}=Ee(),l=zn(e,t,n.length);return r||l.length===0?null:s.jsx(an,{prompts:l,className:P(qe,n.length===0&&"mt-auto"),onPick:i=>o(i)})},so=({message:e})=>e.role==="user"?s.jsx(lo,{message:e}):e.role==="system"?s.jsx(bo,{message:e}):s.jsx(co,{message:e}),$t=({attachment:e})=>{const t=e.isImage?e.imageDataUrl??e.url:void 0;if(t)return s.jsx("a",{href:e.url??t,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:t,alt:e.name,className:"max-h-64 rounded-lg border object-contain"})});const n=s.jsxs(s.Fragment,{children:[s.jsx(Be,{className:"h-3 w-3 shrink-0"}),s.jsx("span",{className:"max-w-[14rem] truncate",children:e.name})]});return s.jsx("div",{className:"flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 text-xs",children:e.url?s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1.5 hover:underline",children:n}):n})},lo=({message:e})=>{const t=e.parts.filter(n=>n.type==="bash");return t.length>0?s.jsx("div",{className:gt,children:s.jsx("div",{className:"space-y-2",children:t.map(n=>s.jsx(ao,{part:n},$e(e,n)))})}):s.jsx("div",{className:Tn,children:s.jsxs("div",{className:P(Ne,"px-3 py-2 text-sm"),children:[e.attachments&&e.attachments.length>0?s.jsx("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:e.attachments.map(n=>s.jsx($t,{attachment:n},n.id))}):null,e.parts.map(n=>n.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Ye,{text:n.text,renderText:r=>r})},$e(e,n)):null)]})})},ao=({part:e})=>{const t=e.cancelled||e.exitCode!==void 0&&e.exitCode!==0;return s.jsxs("div",{className:P(Ne,"overflow-hidden text-xs"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 border-border/60 border-b px-3 py-1.5",children:[s.jsx(pn,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-foreground/90",children:e.command}),e.cancelled?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-medium text-[10px] text-muted-foreground",children:"cancelled"}):t?s.jsxs("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:["exit ",e.exitCode]}):null]}),e.output.trim()?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-foreground/80",children:e.output}):null]})},Dt=new Set(["question","link-button","tool-approval"]),io="subscription-candidate",co=({message:e})=>{const t=Ge(),{agentId:n,workspaceSlug:r}=Ee(),o=u=>u.type==="tool-call"&&(Dt.has(u.toolName)||t?.toolNames.has(u.toolName)),l=e.parts.filter(u=>u.type==="tool-call"&&!o(u)&&u.toolName!==io),i=e.parts.filter(u=>u.type!=="tool-call"||o(u)),c=e.parts.flatMap(u=>{if(u.type!=="tool-call")return[];const d=vt(u.result);return d?[d]:[]});return s.jsx("div",{className:gt,children:s.jsxs("div",{className:"space-y-2 text-sm",children:[l.length>0?s.jsx(po,{tools:l,workspaceSlug:r}):null,n&&r?c.map(u=>s.jsx(uo,{candidate:u,agentId:n,workspaceSlug:r},`${u.connector_key}:${u.resource_ref}`)):null,i.map(u=>s.jsx(ho,{part:u},$e(e,u))),e.attachments&&e.attachments.length>0?s.jsx("div",{className:"flex flex-wrap gap-2",children:e.attachments.map(u=>s.jsx($t,{attachment:u},u.id))}):null]})})},uo=({candidate:e,agentId:t,workspaceSlug:n})=>s.jsxs("div",{className:P(Ne,"flex items-center justify-between gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:e.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Run this agent when the resource changes."})]}),s.jsx(pe,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:s.jsxs(mt,{to:"/$owner/automations/new",params:{owner:n},search:{agent:t,platform:e.connector_key,resource_type:e.resource_type,resource:e.resource_ref,events:e.suggested_event_keys?.join(","),label:e.label},children:[s.jsx(hn,{className:"mr-1.5 h-4 w-4"}),"Add automation"]})})]});function fo(e){try{return JSON.parse(e)}catch{return null}}function Ut(e){if(Array.isArray(e)){const o=e.flatMap(l=>l?.type==="text"&&typeof l.text=="string"?Ut(l.text)??[]:[]);return o.length>0?[...new Set(o)]:null}const t=typeof e=="string"&&e.trimStart().startsWith("{")?fo(e):e;if(!t||typeof t!="object")return null;const n=t.events_persisted;if(!Array.isArray(n))return null;const r=n.flatMap(o=>{const l=o&&typeof o=="object"?o.id:null;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?[l]:[]});return r.length>0?r:null}const po=({tools:e,workspaceSlug:t})=>s.jsxs(Tt,{defaultOpen:!1,children:[s.jsx(jt,{children:e.length===1?nt(e[0].args,e[0].toolName)??e[0].toolName:`${e.length} tool calls`}),s.jsx(Et,{children:e.map(n=>{const r=nt(n.args,n.toolName),o=n.args!==void 0&&n.args!==null,l=n.result!==void 0&&n.result!==null,i=Ut(n.result);return s.jsxs(Nt,{icon:mn,label:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-medium",children:r??n.toolName}),r?s.jsx("span",{className:"text-muted-foreground",children:n.toolName}):null,n.isError?s.jsx("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:"error"}):null]}),status:n.isError?"active":"complete",children:[o?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.args)}):null,l?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.result)}):null,i&&t?s.jsx(lr,{ownerSlug:t,eventIds:i}):null]},n.toolCallId)})})]}),mo=({text:e})=>{let t=e,n=null;const r=e.match(/\{[\s\S]*\}/);if(r)try{const l=JSON.parse(r[0])?.error?.message;typeof l=="string"&&l.trim()&&(t=l,n=e)}catch{}return s.jsxs("div",{className:"flex gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm",children:[s.jsx(bn,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground/80",children:t}),n&&s.jsxs("details",{className:"text-xs text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer select-none hover:text-foreground",children:"Technical details"}),s.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-all font-mono",children:n})]})]})]})},ho=({part:e})=>{const t=Ge();return e.type==="reasoning"?s.jsx(or,{}):e.type==="error"?s.jsx(mo,{text:e.text}):e.type==="text"?e.text.trim()?s.jsx(Ye,{text:e.text,renderText:n=>s.jsx(gn,{text:n})}):null:e.type!=="tool-call"?null:Dt.has(e.toolName)||t?.toolNames.has(e.toolName)?s.jsx(No,{toolName:e.toolName,args:e.args}):null},go=({message:e,onClick:t})=>{const n=e.parts.find(r=>r.type==="text");return s.jsx("button",{type:"button",onClick:t,className:P(Ne,"block w-full cursor-pointer whitespace-pre-wrap break-words px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/50"),children:n?.type==="text"?n.text:"Automation run"})},bo=({message:e})=>s.jsx("div",{className:"self-stretch",children:s.jsx("div",{className:P(Ne,"px-3 py-2 text-xs text-muted-foreground"),children:e.parts.map(t=>t.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Ye,{text:t.text,renderText:n=>n})},$e(e,t)):null)})}),xo="/mcp-apps/interaction/index.html";function ft(e){return new Promise(t=>{e({onSettled:(n,r)=>t(!!r)})})}const vo=({src:e,title:t,renderPayload:n,onToolCall:r,onOpenLink:o})=>{const l=a.useRef(null),[i,c]=a.useState(48),u=a.useRef({renderPayload:n,onToolCall:r,onOpenLink:o});return u.current={renderPayload:n,onToolCall:r,onOpenLink:o},a.useEffect(()=>{const d=l.current;if(!d?.contentWindow)return;const p=new yn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{}},{hostContext:{theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"}});p.addEventListener("sizechange",({height:g})=>{typeof g=="number"&&c(Math.max(32,Math.ceil(g)))}),p.oncalltool=async({name:g,arguments:R})=>{const A=await u.current.onToolCall(g,R??{});return{isError:A,content:[{type:"text",text:A?"Action failed.":"Action completed."}]}},p.onopenlink=async({url:g})=>({isError:await u.current.onOpenLink(g)}),p.addEventListener("initialized",()=>{(async()=>(await p.sendToolInput({arguments:{}}),await p.sendToolResult({content:[],structuredContent:{...u.current.renderPayload,version:1,source:Xr}})))()});const v=new Rn(d.contentWindow,d.contentWindow);p.connect(v).catch(g=>{console.error("[mcp-app-host] failed to initialize",g)});const m=new MutationObserver(()=>{p.setHostContext({theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"})});return m.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{m.disconnect(),v.close()}},[]),s.jsx("iframe",{ref:l,title:t,src:e,sandbox:"allow-scripts",style:{width:"100%",height:i,border:"none",display:"block"}})},yo=new Set(["action"]),Ro=["name","description","identity_md"];function se(e){return e==null||e===""?"":typeof e=="string"?e:Ue(e)}function pt(e){return e===null?"(cleared)":e===void 0?"":typeof e=="string"?e===""?"":e:Ue(e)}function De(e){return e.length>0?e[0].toUpperCase()+e.slice(1):e}const Ft=new Set(["delete","disconnect","remove","remove_rule","reset","revoke"]);function We(e){return e&&Ft.has(e)?"warning":"default"}function Ke(e,t){return e&&Ft.has(e)?{level:"high",reason:t}:{level:"normal"}}function wo(e,t){const n=e.attribution==="automation"?"An Automation":"An agent",r=Object.keys(t),o=r.map(l=>({label:l,before:se(e.current?.[l]),after:se(t[l])}));return{title:`${n} proposes a change`,icon:"entity",impact:{level:"normal"},tone:"default",blocks:o.length>0?[{type:"diff",fields:o}]:[{type:"text",value:"No field changes.",muted:!0}],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r.join(", ")} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r.join(", ")} was not applied.`}]}}function So(e){const t=e.action??"change",n=e.proposal?.slug??e.proposal?.name??(e.proposal?.automation_id!=null?String(e.proposal.automation_id):void 0)??e.current?.slug??e.current?.name??"automation",r=[];e.action==="delete"&&r.push({type:"text",value:"This will archive the Automation.",muted:!0});const o=e.proposal??{},l=Object.keys(o).filter(i=>!yo.has(i)&&o[i]!==void 0).map(i=>({label:i,...e.action==="update"&&e.current?.[i]!==void 0?{before:pt(e.current?.[i])}:{},after:pt(o[i])}));return r.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0}),{title:`${De(t)} Automation ${n}`,icon:"automation",impact:Ke(e.action,"This archives the Automation and stops future runs."),tone:We(e.action),blocks:r,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${t} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${t} ${n} was not applied.`}]}}function Co(e){if(e.resourceKind==="automation")return So(e);if(e.fields&&Object.keys(e.fields).length>0)return wo(e,e.fields);const t=e.resourceKind==="entity"||e.proposal?.entity_id!==void 0||e.current?.entity_type!==void 0||e.proposal?.entity_type!==void 0;if(t&&(e.action==="link"||e.action==="unlink"))return On({...e,action:e.action});if(t){const l=e.proposal?.name??e.current?.name??e.proposal?.entity_id??e.current?.id??"entity",i=e.action??"change",c=[];if(e.action==="delete")c.push({type:"text",value:"This will delete the entity.",muted:!0});else{const u=Object.keys(e.proposal??{}).filter(d=>!["entity_id","id"].includes(d)&&e.proposal?.[d]!==void 0&&se(e.proposal?.[d])!==se(e.current?.[d])).map(d=>({label:d,...e.action==="update"?{before:se(e.current?.[d])}:{},after:se(e.proposal?.[d])}));c.push(u.length>0?{type:"diff",fields:u}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(i)} entity ${l}`,icon:"entity",impact:Ke(e.action,"This deletes the entity."),tone:We(e.action),blocks:c,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${i} ${l} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${i} ${l} was not applied.`}]}}const n=e.proposal?.agent_id??e.current?.id??"agent",r=e.action??"change",o=[];if(e.action==="delete")o.push({type:"text",value:"This will permanently delete the agent.",muted:!0});else{const l=Ro.filter(i=>e.proposal?.[i]!==void 0&&se(e.proposal?.[i])!==se(e.current?.[i])).map(i=>({label:i,...e.action==="update"?{before:se(e.current?.[i])}:{},after:se(e.proposal?.[i])}));o.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(r)} agent ${n}`,icon:"agent",impact:Ke(e.action,"This permanently deletes the agent and its configuration."),tone:We(e.action),blocks:o,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r} ${n} was not applied.`}]}}function To(e){const t=Array.isArray(e.options)?e.options.filter(o=>typeof o=="string"):[],n=[{type:"text",value:e.question||"The agent has a question."}];t.length===0&&n.push({type:"text",value:"Reply below to answer.",muted:!0});const r=t.map(o=>({id:o,label:o,variant:"outline",tool:"answer_question",args:{answer:o},resolvedLabel:`Answered: ${o}`}));return{title:"Input needed",icon:"question",tone:"default",blocks:n,actions:r}}function jo(e,t){return{tone:"bare",actions:[{id:"open",label:e.label??"Open link",variant:"outline",icon:"external",terminal:!1,href:t}]}}const No=({toolName:e,args:t})=>{const n=xn(),r=vn(),{append:o}=Ee(),l=Ge(),i=t??{},c=l?.resolve(e,t)??null;let u=c?.view??null;const d={...c?.handlers??{}},p=new Set;if(!c){if(e==="tool-approval"&&typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0){const v=i.runId,m=typeof i.status=="string"?i.status:"pending",g=m==="pending",R=Co(i),A=m==="confirmed"?"Approved":De(m);u=g?R:{...R,title:`${R.title??"Approval"} · ${A}`,tone:m==="failed"?"warning":"default",blocks:[...R.blocks??[],{type:"text",value:typeof i.reviewedByName=="string"?`${m==="rejected"?"Rejected":"Approved"} by ${i.reviewedByName}.`:`${A}.`,muted:!0}],actions:(R.actions??[]).filter(x=>x.terminal===!1)},g&&(d.manage_operations=x=>{if(x.action==="approve")return ft(T=>n.mutate({run_id:v},T));if(x.action==="reject"){const T=typeof x.reason=="string"?x.reason:void 0;return ft(W=>r.mutate({run_id:v,...T?{reason:T}:{}},W))}return Promise.resolve(!0)})}else if(e==="question"){const v=Array.isArray(i.options)?i.options.filter(m=>typeof m=="string"):[];u=To(i),d.answer_question=m=>{const g=typeof m.answer=="string"?m.answer:"";return v.includes(g)?(o(g),Promise.resolve(!1)):Promise.resolve(!0)}}else if(e==="link-button"){if(!dt(i.url))return null;const v=i.url;p.add(v),u=jo(i,v)}}return u?s.jsx(vo,{src:xo,title:u.title??"Interaction",renderPayload:u,onToolCall:(v,m)=>d[v]?d[v](m):Promise.resolve(!0),onOpenLink:v=>!p.has(v)||!dt(v)?Promise.resolve(!0):(window.open(v,"_blank","noopener,noreferrer"),Promise.resolve(!1))}):null};function Ue(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Eo=()=>{const{running:e,append:t,cancel:n,pendingAttachments:r,addAttachments:o,removeAttachment:l,initialDraft:i,currentSuggestions:c}=Ee(),u=Ao({suggestions:e?null:c}),[d,p]=a.useState(i??""),v=a.useRef(null),m=a.useRef(null),g=kn(_n),R=a.useRef(i??"");a.useEffect(()=>{const T=i??"";if(T===R.current)return;const W=R.current;R.current=T,T!==""&&p(U=>U===""||U===W?T:U)},[i]);const A=a.useRef(d);A.current=d;const x=()=>{e||(t(A.current),p(""),m.current?.clear())};return s.jsxs("div",{className:"rounded-2xl border bg-background transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r.length>0?s.jsx("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3",children:r.map(T=>s.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border bg-muted/50 px-2 py-1 text-xs",children:[s.jsx(Be,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"max-w-[12rem] truncate",children:T.name}),s.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground","aria-label":"Remove attachment",onClick:()=>l(T.id),children:s.jsx(rn,{className:"h-3 w-3"})})]},T.id))}):null,s.jsx(In,{value:d,onChange:p,onSubmit:x,searchRefs:g,handleRef:m,placeholder:u,className:"max-h-48 overflow-y-auto"}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[s.jsx("input",{ref:v,type:"file",multiple:!0,className:"hidden",onChange:T=>{T.target.files&&o(T.target.files),T.target.value=""}}),s.jsxs(pe,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>v.current?.click(),children:[s.jsx(Be,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Attach files"})]}),e?s.jsxs(pe,{type:"button",size:"icon",variant:"secondary",className:"h-8 w-8 rounded-full",onClick:n,children:[s.jsx(on,{size:"lg"}),s.jsx("span",{className:"sr-only",children:"Cancel"})]}):s.jsxs(pe,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",onClick:x,children:[s.jsx(sn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})};function Ao({suggestions:e}){const t=e?.find(n=>n.message.trim().length>0)?.message;return t?`Recommended: ${t.trim()}`:"Chat… (@ to mention, / for commands)"}export{Do as A,$o as L,Lo as R,Xn as h,Gn as s};
6
- //# sourceMappingURL=agent-thread-DQIr20H-.js.map
@@ -1,2 +0,0 @@
1
- import{j as t,O as o}from"./index-4gCDI7m4.js";const n=()=>t.jsx(o,{});export{n as component};
2
- //# sourceMappingURL=agents-CLbeiqTR.js.map