@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 +1,2 @@
1
- import{j as e,bM as R,h as k,b1 as B,b2 as D,b3 as K,g3 as J,a5 as V,bF as X,bE as G,bR as Y,g4 as ee,bS as P,bT as F,bU as se,bN as ne,bV as te,bO as re,r as S,g5 as ae,g6 as ie,bJ as le,bW as oe,L as w,g7 as de,g8 as ce,cZ as W,g9 as ue,ga as me,gb as ge,gc as A,cN as L,X as fe,gd as q,ge as z,eI as xe,c_ as he,gf as be,gg as ye,bZ as pe,gh as je}from"./index-4gCDI7m4.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:k("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const b=J({option:l,floor:o}),h=l===t,g=b.disabled&&!h,y=R[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:k("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?k(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:y},l);return g&&b.reason?e.jsxs(B,{children:[e.jsx(D,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(K,{children:b.reason})]},l):f})})}function M({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function Se(n,t,o,a,i=null){const m=q(n.floor,t,o,a,i),u=z(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&be(n.agent,t,o)?ye(u,A(n,t,o,null)):u}function ke({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:b}){const h=q(t.floor,o,a,i,m),g=z(t.floor,o,a,i,m),y=A(t,o,a,i,m),f=Se(t,o,a,i,m),j=pe(o,a),p=e.jsx("div",{className:k("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:y,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:b})});return g?e.jsxs(B,{children:[e.jsx(D,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:p})}),e.jsxs(K,{children:["Org floor ",R[h]," — can only go stricter"]})]}):p}function Ae(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ce(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const O="font-medium text-foreground hover:text-primary hover:underline";function Ee({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function Q({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function Te({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function Oe({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=V(),m=X(n,t??"",{enabled:!a&&!!t}),u=G(n,{enabled:a}),{data:l,isLoading:b,isError:h,error:g}=a?u:m,y=a?Y(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(y,c=>c&&{...c,agent:Ae(c.agent,r)}),i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),p=f.isPending||j.isPending,C=S.useMemo(()=>l?ae(l):[],[l]),E=S.useMemo(()=>{if(!l)return[];const r=new Set(C.map(c=>c.slug));return l.entity_types.filter(c=>!r.has(c.slug))},[l,C]),v=S.useMemo(()=>l?ie(l):[],[l]),N=S.useMemo(()=>{if(!l)return[];const r=new Set(v.map(c=>c.id));return l.agents.filter(c=>(a||c.id!==t)&&!r.has(c.id))},[l,v,t,a]);if(b)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,I=(r,c,T,_,s=null)=>{const d=Ce(x,r,c,s,T,_);f.mutate({resource_class:r,effects:d,entity_type_slug:c,target_agent_id:s})},H=x.entity_types.length===0?"— none yet":E.length===0?"— all covered":null,U=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(w,{to:"/$owner/settings/organization",params:{owner:n},search:{agent:t},hash:"policies",className:O,children:"Organization policies"}),"."]}),_e.map(r=>{const c=r.resourceClass==="entity",T=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...c?C.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(w,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:O,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:ce(x,s.slug),diffs:de(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(w,{to:"/$owner/agents/$agentId/settings",params:{owner:n,agentId:s.id},search:{run_id:void 0},className:O,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(M,{controls:s.owned?e.jsx(Te,{pending:p,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(d=>!s.targetAgentId||d!=="create").map(d=>{const $=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c?"entities":"agents"}`;return e.jsx(M,{controls:e.jsx(ke,{label:`${s.name}: ${$}`,response:x,resourceClass:r.resourceClass,action:d,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&A(x,r.resourceClass,d,s.entityTypeSlug,s.targetAgentId)===A(x,r.resourceClass,d,null),pending:p,onSave:Z=>I(r.resourceClass,s.entityTypeSlug,d,Z,s.targetAgentId)}),children:$},d)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[c?e.jsx(Q,{label:"Add type",disabled:p||E.length===0,hint:H,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>E.map(d=>e.jsx(L,{value:`${d.name} ${d.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),s()},className:"cursor-pointer",children:e.jsx(Ee,{type:d})},d.slug))}):null,T?e.jsx(Q,{label:"Add agent",disabled:p||N.length===0,hint:U,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(d=>e.jsxs(L,{value:`${d.name} ${d.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},r.resourceClass)})]})}export{Oe as A,Ne as P,M as a};
2
- //# sourceMappingURL=agent-permissions-matrix-CbhXlbgY.js.map
1
+ import{j as e,bR as B,i as S,a$ as D,b0 as K,b1 as R,gz as X,a6 as G,bK as Y,bJ as Z,bW as V,gA as ee,bX as P,bt as F,bY as se,bS as ne,bZ as te,bT as re,r as A,gB as ae,gC as ie,bO as le,b_ as oe,L as w,gD as de,gE as ce,d5 as W,gF as ue,gG as me,gH as ge,gI as k,cU as L,X as fe,gJ as q,gK as z,gu as xe,d6 as he,gL as be,gM as ye,c1 as pe,gN as je}from"./index-BjcZVe7n.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:S("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const b=X({option:l,floor:o}),h=l===t,g=b.disabled&&!h,y=B[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:S("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?S(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:y},l);return g&&b.reason?e.jsxs(D,{children:[e.jsx(K,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(R,{children:b.reason})]},l):f})})}function M({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function Ae(n,t,o,a,i=null){const m=q(n.floor,t,o,a,i),u=z(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&be(n.agent,t,o)?ye(u,k(n,t,o,null)):u}function Se({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:b}){const h=q(t.floor,o,a,i,m),g=z(t.floor,o,a,i,m),y=k(t,o,a,i,m),f=Ae(t,o,a,i,m),j=pe(o,a),p=e.jsx("div",{className:S("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:y,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:b})});return g?e.jsxs(D,{children:[e.jsx(K,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:p})}),e.jsxs(R,{children:["Org floor ",B[h]," — can only go stricter"]})]}):p}function ke(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ce(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const $="font-medium text-foreground hover:text-primary hover:underline";function Ee({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function Q({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function Te({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function $e({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=G(),m=Y(n,t??"",{enabled:!a&&!!t}),u=Z(n,{enabled:a}),{data:l,isLoading:b,isError:h,error:g}=a?u:m,y=a?V(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(y,c=>c&&{...c,agent:ke(c.agent,r)}),i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),p=f.isPending||j.isPending,C=A.useMemo(()=>l?ae(l):[],[l]),E=A.useMemo(()=>{if(!l)return[];const r=new Set(C.map(c=>c.slug));return l.entity_types.filter(c=>!r.has(c.slug))},[l,C]),v=A.useMemo(()=>l?ie(l):[],[l]),N=A.useMemo(()=>{if(!l)return[];const r=new Set(v.map(c=>c.id));return l.agents.filter(c=>(a||c.id!==t)&&!r.has(c.id))},[l,v,t,a]);if(b)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,H=(r,c,T,_,s=null)=>{const d=Ce(x,r,c,s,T,_);f.mutate({resource_class:r,effects:d,entity_type_slug:c,target_agent_id:s})},I=x.entity_types.length===0?"— none yet":E.length===0?"— all covered":null,J=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(w,{to:"/$owner/settings/organization",params:{owner:n},search:{agent:t},hash:"policies",className:$,children:"Organization policies"}),"."]}),_e.map(r=>{const c=r.resourceClass==="entity",T=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...c?C.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(w,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:$,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:ce(x,s.slug),diffs:de(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(w,{to:"/$owner/agents/$agentId/settings",params:{owner:n,agentId:s.id},search:{run_id:void 0},className:$,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(M,{controls:s.owned?e.jsx(Te,{pending:p,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(d=>!s.targetAgentId||d!=="create").map(d=>{const O=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c?"entities":"agents"}`;return e.jsx(M,{controls:e.jsx(Se,{label:`${s.name}: ${O}`,response:x,resourceClass:r.resourceClass,action:d,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&k(x,r.resourceClass,d,s.entityTypeSlug,s.targetAgentId)===k(x,r.resourceClass,d,null),pending:p,onSave:U=>H(r.resourceClass,s.entityTypeSlug,d,U,s.targetAgentId)}),children:O},d)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[c?e.jsx(Q,{label:"Add type",disabled:p||E.length===0,hint:I,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>E.map(d=>e.jsx(L,{value:`${d.name} ${d.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),s()},className:"cursor-pointer",children:e.jsx(Ee,{type:d})},d.slug))}):null,T?e.jsx(Q,{label:"Add agent",disabled:p||N.length===0,hint:J,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(d=>e.jsxs(L,{value:`${d.name} ${d.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},r.resourceClass)})]})}export{$e as A,Ne as P,M as a};
2
+ //# sourceMappingURL=agent-permissions-matrix-DSjidWHL.js.map
@@ -1,2 +1,2 @@
1
- import{r as p,e7 as G,gt as ge,h1 as pe,hc as be,bT as F,j as ve}from"./index-4gCDI7m4.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as Ae}from"./core.esm-CHnfRiEM.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function K(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=K(n,r,t),o=n[s],i=u[s];return!i||!o?null:{x:i.left-o.left,y:i.top-o.top,scaleX:i.width/o.width,scaleY:i.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const i=(n=u[t])!=null?n:r;if(!i)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(i.top+i.height):f.top-i.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-i.height-m,...M}:s<t&&s>=o?{x:0,y:i.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",J=G.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Je(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:i,droppableRects:m,over:f,measureDroppableContainers:a}=Ie(),l=Se(W,t),b=i.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&a(h)},[I,h,k,a]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return G.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return K(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:i,previousContainerId:m,transition:f}=e;return!f||!r||i!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},Q="transform",$e=H.Transition.toString({property:Q,duration:0,easing:"linear"}),ze={roleDescription:"sortable"};function Fe(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),i=p.useRef(t);return Y(()=>{if(!n&&t!==i.current&&r.current){const m=s.current;if(m){const f=Ae(r.current,{ignoreTransform:!0}),a={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(a.x||a.y)&&o(a)}}t!==i.current&&(i.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Qe(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:i,resizeObserverConfig:m,transition:f=je}=e;const{items:a,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(J),S=Ke(r,h),c=a.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:a},...s}),[l,s,c,a]),d=p.useMemo(()=>a.slice(a.indexOf(o)),[a,o]),{rect:v,node:y,isOver:A,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:D,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:U,listeners:se,isDragging:$,over:oe,setActivatorNodeRef:ie,transform:ae}=ye({id:o,data:g,attributes:{...ze,...t},disabled:S.draggable}),le=we(L,U),T=!!D,X=T&&!k&&P(b)&&P(C),_=!R&&$,q=_&&X?ae:null,ce=X?q??(i??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:a,activeIndex:b,overIndex:C}):c,N=D?.id,x=p.useRef({activeId:N,items:a,newIndex:O,containerId:l}),ue=a!==x.current.items,B=n({active:D,containerId:l,isDragging:$,isSorting:T,id:o,index:c,items:a,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),z=Fe({disabled:!B,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),a!==x.current.items&&(x.current.items=a)},[T,O,l,a]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:D,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:a,isOver:A,isSorting:T,isDragging:$,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ie,setDroppableNodeRef:L,setDraggableNodeRef:U,transform:z??ce,transition:de()};function de(){if(z||ue&&x.current.newIndex===c)return $e;if(!(_&&!Re(te)||!f)&&(T||B))return H.Transition.toString({...f,property:Q})}}function Ke(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Ue=[E.Down,E.Right,E.Up,E.Left],Ze=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:i}}=n;if(Ue.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let a=he(f,"id");if(a===o?.id&&f.length>1&&(a=f[1].id),a!=null){const l=u.get(t.id),b=u.get(a),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>i[v]!==d),R=Z(l,b),I=Xe(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Z(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Xe(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function _e(e){return{skillsConfig:De(e)}}function qe(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:qe(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function Be(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),i=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),a=m??i,l=p.useCallback(async(c,g)=>{if(!t)return F.error("Still loading agent settings — try again in a moment"),!1;try{const d=_e(c);return await o.mutateAsync(d),F.success(g),!0}catch(d){return F.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??i;return v.some(y=>y.repo===c)?v:[...v,Be(g)]})},[i,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const A=y??i;return A.some(L=>L.repo===d)?A:[...A,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[i]),k=p.useCallback((c,g)=>{f(d=>(d??i).map(v=>v.repo===c?{...v,...g}:v))},[i]),w=p.useCallback((c,g)=>{f(d=>{const v=d??i,y=v.findIndex(D=>D.repo===c),A=v.findIndex(D=>D.repo===g);if(y<0||A<0||y===A)return v;const L=K(v,y,A);return l(L,"Skill order updated"),L})},[l,i]),C=p.useCallback(async c=>{const g=a.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,a]),R=p.useCallback(async(c,g)=>{const d=a.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,a]),I=p.useCallback(async()=>{await l(a,"Skills saved")},[l,a]),S=p.useMemo(()=>({agentId:e,skillRows:a,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,a,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Je as S,Ze as a,et as b,Qe as c,tt as f,qe as s,rt as u,We as v};
2
- //# sourceMappingURL=agent-skill-context-V__2i6Vl.js.map
1
+ import{r as p,bB as q,g_ as ge,hv as pe,hG as be,bt as F,j as ve}from"./index-BjcZVe7n.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as Ae}from"./core.esm-BsXtvNoI.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function _(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=_(n,r,t),o=n[s],i=u[s];return!i||!o?null:{x:i.left-o.left,y:i.top-o.top,scaleX:i.width/o.width,scaleY:i.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const i=(n=u[t])!=null?n:r;if(!i)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(i.top+i.height):f.top-i.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-i.height-m,...M}:s<t&&s>=o?{x:0,y:i.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",J=q.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Je(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:i,droppableRects:m,over:f,measureDroppableContainers:a}=Ie(),l=Se(W,t),b=i.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&a(h)},[I,h,k,a]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return q.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return _(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:i,previousContainerId:m,transition:f}=e;return!f||!r||i!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},Q="transform",$e=H.Transition.toString({property:Q,duration:0,easing:"linear"}),ze={roleDescription:"sortable"};function Fe(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),i=p.useRef(t);return Y(()=>{if(!n&&t!==i.current&&r.current){const m=s.current;if(m){const f=Ae(r.current,{ignoreTransform:!0}),a={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(a.x||a.y)&&o(a)}}t!==i.current&&(i.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Qe(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:i,resizeObserverConfig:m,transition:f=je}=e;const{items:a,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(J),S=_e(r,h),c=a.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:a},...s}),[l,s,c,a]),d=p.useMemo(()=>a.slice(a.indexOf(o)),[a,o]),{rect:v,node:y,isOver:A,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:D,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:B,listeners:se,isDragging:$,over:oe,setActivatorNodeRef:ie,transform:ae}=ye({id:o,data:g,attributes:{...ze,...t},disabled:S.draggable}),le=we(L,B),T=!!D,G=T&&!k&&P(b)&&P(C),K=!R&&$,U=K&&G?ae:null,ce=G?U??(i??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:a,activeIndex:b,overIndex:C}):c,N=D?.id,x=p.useRef({activeId:N,items:a,newIndex:O,containerId:l}),ue=a!==x.current.items,X=n({active:D,containerId:l,isDragging:$,isSorting:T,id:o,index:c,items:a,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),z=Fe({disabled:!X,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),a!==x.current.items&&(x.current.items=a)},[T,O,l,a]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:D,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:a,isOver:A,isSorting:T,isDragging:$,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ie,setDroppableNodeRef:L,setDraggableNodeRef:B,transform:z??ce,transition:de()};function de(){if(z||ue&&x.current.newIndex===c)return $e;if(!(K&&!Re(te)||!f)&&(T||X))return H.Transition.toString({...f,property:Q})}}function _e(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Be=[E.Down,E.Right,E.Up,E.Left],Ze=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:i}}=n;if(Be.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let a=he(f,"id");if(a===o?.id&&f.length>1&&(a=f[1].id),a!=null){const l=u.get(t.id),b=u.get(a),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>i[v]!==d),R=Z(l,b),I=Ge(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Z(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Ge(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function Ke(e){return{skillsConfig:De(e)}}function Ue(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:Ue(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function Xe(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),i=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),a=m??i,l=p.useCallback(async(c,g)=>{if(!t)return F.error("Still loading agent settings — try again in a moment"),!1;try{const d=Ke(c);return await o.mutateAsync(d),F.success(g),!0}catch(d){return F.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??i;return v.some(y=>y.repo===c)?v:[...v,Xe(g)]})},[i,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const A=y??i;return A.some(L=>L.repo===d)?A:[...A,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[i]),k=p.useCallback((c,g)=>{f(d=>(d??i).map(v=>v.repo===c?{...v,...g}:v))},[i]),w=p.useCallback((c,g)=>{f(d=>{const v=d??i,y=v.findIndex(D=>D.repo===c),A=v.findIndex(D=>D.repo===g);if(y<0||A<0||y===A)return v;const L=_(v,y,A);return l(L,"Skill order updated"),L})},[l,i]),C=p.useCallback(async c=>{const g=a.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,a]),R=p.useCallback(async(c,g)=>{const d=a.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,a]),I=p.useCallback(async()=>{await l(a,"Skills saved")},[l,a]),S=p.useMemo(()=>({agentId:e,skillRows:a,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,a,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Je as S,Ze as a,et as b,Qe as c,tt as f,Ue as s,rt as u,We as v};
2
+ //# sourceMappingURL=agent-skill-context-1DBn7Xc_.js.map
@@ -0,0 +1,2 @@
1
+ import{c as D,r as g,j as e,d6 as F,H as N,I as K,eL as P,bP as O,B as C,i as R,dh as _,hx as H,hy as z,b2 as G,hJ as Q,fP as Y,j9 as J}from"./index-BjcZVe7n.js";import{u as w,b as V,f as X,s as q,a as U,S as W,v as Z,c as ee}from"./agent-skill-context-1DBn7Xc_.js";import{b as se,a as te,A as E}from"./agent-tab-intro-DKrC3SQt.js";import{u as ae,a as L,m as ne,P as le,D as ie,n as oe,C as re}from"./core.esm-BsXtvNoI.js";import{f as ce}from"./agent-loading-shells-_18OREnx.js";import{A as de}from"./agent-card-controls-DuQJhtqp.js";const T=":";function A(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function me({owner:s,agentId:t}){const a=D(),[n,i]=g.useState(""),[o,d]=g.useState(!1),[x,k]=g.useState(""),[r,b]=g.useState(""),{skillRows:m,catalog:p,isLoading:u,addSkillFromCatalog:h,addCustomSkill:S}=w(),v=g.useMemo(()=>new Set(m.map(c=>c.repo)),[m]),f=g.useMemo(()=>V(p?.catalog??[],v),[p?.catalog,v]),l=g.useMemo(()=>X(f,n),[f,n]),y=c=>{h(c),a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(c)}})},j=()=>{const c=S({name:x,instructions:r});c&&a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(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(N,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{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(N,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:r,onChange:c=>b(c.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(O,{onCancel:()=>d(!1),children:e.jsx(C,{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(F,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),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 ue({row:s}){const{isSaving:t,updateSkillRow:a}=w(),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(N,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{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(N,{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 ge({owner:s,agentId:t,skillKey:a}){const n=D(),[i,o]=g.useState(!1),d=B(a),{skillRows:x,catalog:k,isSaving:r,saveSkills:b,removeSkillAndSave:m,addSkillFromCatalog:p}=w(),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 v=!u.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ue,{row:u}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[v?i?e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsxs(C,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>o(!0),disabled:r,children:["Remove ",u.name]}):null,e.jsx(C,{type:"button",onClick:()=>void b(),disabled:r||i,children:r?"Saving...":"Save changes"})]})]})}function xe(s){return s.map(t=>{const a=q(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:b}=w();g.useEffect(()=>{a&&(i.some(l=>l.repo===a)||o?.catalog.some(l=>l.repo===a)&&b(a))},[a,i,o,b]);const m=g.useMemo(()=>xe(i),[i]),p=g.useMemo(()=>m.map(l=>l.repo),[m]),u=ae(L(le,{activationConstraint:{distance:8}}),L(ne,{coordinateGetter:U})),h=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(C,{type:"button",onClick:h,children:[e.jsx(F,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),v=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(l)}})},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(ce,{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.jsx(te,{description:I,action: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(he,{card:l,rank:y+1,disabled:x,expanded:j,isLast:y===m.length-1,onToggle:()=>v(l.repo),onToggleEnabled:$=>void r(l.repo,$),toggleDisabled:x,children:j?e.jsx(ge,{owner:s,agentId:t,skillKey:A(l.repo)}):null},l.id)})})})})]})}function he({card:s,rank:t,disabled:a,expanded:n,isLast:i,onToggle:o,onToggleEnabled:d,toggleDisabled:x,children:k}){const r=a||n,{attributes:b,listeners:m,setNodeRef:p,transform:u,transition:h,isDragging:S}=ee({id:s.repo,disabled:r}),v={transform:re.Transform.toString(u),transition:h};return e.jsxs("div",{ref:p,style:v,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,...b,...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(J,{badges:s.badges})]})]}),e.jsx(de,{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 Se({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t})})}function ye({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(me,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t,skillKey:a}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Se as A,ye as a,Ce as b};
2
+ //# sourceMappingURL=agent-skills-route-d5jh3oBR.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,al as n,i as a}from"./index-BjcZVe7n.js";function l({children:t,className:s}){return e.jsx(n,{className:a("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})]})}function c({description:t,action:s}){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-sm text-muted-foreground",children:t}),s?e.jsx("div",{className:"shrink-0",children:s}):null]})}export{l as A,c as a,x as b};
2
+ //# sourceMappingURL=agent-tab-intro-DKrC3SQt.js.map
@@ -0,0 +1,6 @@
1
+ import{j as s,r as a,aL as Ht,a6 as zt,gZ as Wt,g_ as Kt,a3 as tt,Q as Be,a4 as nt,ca as qt,g$ as rt,h0 as Gt,L as gt,i as P,fb as Qt,e5 as bt,e7 as Yt,h1 as Jt,cI as Xt,eb as Zt,h2 as en,az as tn,B as fe,e$ as nn,h3 as rn,h4 as He,X as on,ab as sn,db as ln,dh as Ne,h5 as an,dT as cn,dV as un,h6 as dn,dU as fn,fj as pn,h7 as mn,h8 as hn,eE as gn,W as bn,h9 as xn,ha as vn}from"./index-BjcZVe7n.js";import{D as yn,E as Rn}from"./app-bridge-C4nPtae3.js";import{A as wn,a as Sn,b as Tn,c as Ge,d as xt,e as Cn}from"./agent-loading-shells-_18OREnx.js";import{t as jn,P as Nn}from"./pending-seed-BP3xHM2d.js";import{h as En,t as An,R as In,i as kn,u as _n,M as On,a as Pn}from"./use-mention-search-CJGCatFS.js";import{t as ot,c as Mn}from"./event-card-CjA_dLzq.js";import{E as Ln}from"./events-feed-CGzA1w3R.js";const vt=a.createContext(null);function $n({extension:e,children:t}){return s.jsx(vt.Provider,{value:e??null,children:t})}function Qe(){return a.useContext(vt)}var Ye=(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))(Ye||{});const Dn={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 Un(e){if(typeof e=="string")return Object.values(Ye).includes(e)?e:void 0}const Fn=Object.freeze(Object.defineProperty({__proto__:null,AGENT_ERRORS:Dn,AgentErrorCode:Ye,toAgentErrorCode:Un},Symbol.toStringTag,{value:"Module"})),{AGENT_ERRORS:Vn,toAgentErrorCode:Bn}=Fn;function st(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 yt(e,t){const n=Bn(e);if(!n)return null;const r=Vn[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(`${Ht}${t.provider}`)}`:`/${o}/connectors`,c=st(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=st(`/${o}/agents/${encodeURIComponent(t.agentId)}/settings`,t.webOrigin);return l?{label:r.ctaLabel??"Open settings",href:l}:null}function Rt(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 lt=new Set(["localhost","127.0.0.1","::1","[::1]"]);function Hn(e){return e?.trim().toLowerCase().replace(/^\.+|\.+$/g,"")||null}function at(e,t){const n=Hn(t);if(!n)return!1;const r=e.toLowerCase().replace(/\.$/,"");return r===n||r.endsWith(`.${n}`)}function it(e,t,n){try{const r=new URL(t),o=new URL(e,t),l=lt.has(o.hostname)&&lt.has(r.hostname),i=o.protocol===r.protocol&&(o.protocol==="https:"||o.protocol==="http:")&&at(o.hostname,n)&&at(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 zn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,wt=new Set(["suggest_actions"]),Me="Thinking…";function Wn(e){const{textOut:t,statusLine:n,errorText:r,toolCalls:o}=e,l=[];n===Me&&l.push({type:"reasoning"}),r&&l.push({type:"error",text:r});let i=t;return n&&n!==Me&&(i=t?`${t}
2
+
3
+ ${n}`:n),i&&l.push({type:"text",text:i}),l.push(...o),l}const St=[];function Kn(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 Uo({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:St}),[e,t]);return s.jsx(Je.Provider,{value:r,children:n})}const Tt=/\[([^\]]*)\]\((\S*?\/api\/v1\/files\/[^)\s]+)\)/g;function ct(e){return e.replace(/<lobu_internal_context>[\s\S]*?<\/lobu_internal_context>\n*/g,"").replace(Tt,"").replace(/\n{3,}/g,`
4
+
5
+ `).trim()}function qn(e){const t=[];for(const n of e.matchAll(Tt)){const r=n[1]?.trim()||"file",o=n[2];o&&t.push({name:r,url:o})}return t}function Gn(e,t={}){if(typeof e=="string"){const r=ct(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=ct(o.text);l&&n.push({type:"text",text:l})}else t.showToolCalls&&o.type==="toolCall"&&typeof o.name=="string"&&!wt.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 qn(r))t.push({id:`file-${t.length}`,name:o,url:l,isImage:zn.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 Yn(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:Gn(e.content,t),attachments:Qn(e.content),createdAt:n&&!Number.isNaN(n)?n:void 0}}const Jn=[],Xn=[];function Zn(e){let t=null;for(const n of e)n.type==="suggestion"&&(t=n.prompts.length>0?n.prompts:null);return t}function er(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=yt(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 tr=3e4,nr=3*tr,rr=15e3;function ut(e){try{return JSON.parse(e.data)}catch{return{content:e.data}}}const be=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;function or(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 Fo({agentId:e,workspaceSlug:t,thread:n="agent-panel",loadHistory:r=!0,ephemeralContext:o,onFirstUserMessage:l,children:i,initialDraft:c}){const u=zt(),d=a.useRef(null),m=a.useRef(null),y=a.useRef(!1),h=a.useRef(o),g=a.useRef(!1),w=a.useRef(null);h.current=o;const{data:E,isLoading:v}=Wt(e,n,{orgSlug:t,enabled:r&&!!e&&!!n}),T=E?.messages??Jn,H=E?.interactions??Xn,{data:U}=Kt(e,{enabled:!!e}),K=U?.starters??St,z=!!(U?.showToolCalls??U?.settings?.showToolCalls),[N,L]=a.useState([]),[G,le]=a.useState(!1),[$,q]=a.useState([]),[Q,R]=a.useState(null),S=a.useRef(!1);S.current=G;const C=a.useMemo(()=>T.map(I=>Yn(I,{showToolCalls:z})).filter(I=>I!==null),[T,z]),O=a.useRef(!1);a.useEffect(()=>{if(O.current||v||S.current)return;O.current=!0;const I=er(H,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});L(I?[...C,I]:C),R(Zn(H))},[e,v,C,H,t]);const A=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(m.current)return m.current;if(!e)throw new Error("No agent selected");const I=(async()=>{const M=await tt(`${Be}/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 nt(M);const V=await M.json(),j=qt(),J={sessionId:V.agentId,sseUrl:it(V.sseUrl,Be,j),messagesUrl:it(V.messagesUrl,Be,j)};return d.current=J,J})();m.current=I;try{return await I}catch(M){throw d.current=null,M}finally{m.current=null}},[e,t,n]),te=a.useCallback(async(I,M,V)=>{const j=crypto.randomUUID(),J=new AbortController;w.current=J;const W=f=>{L(p=>p.map(b=>b.id===V?{...b,parts:f}:b))};let B;try{B=await Z()}catch(f){W([{type:"text",text:`Error: ${f instanceof Error?f.message:"Could not start a session."}`}]);return}let X=await rt(B.sseUrl,{throwOnFailure:!0});const pe=[];let ie=null;const Re=()=>{const f=ie;ie=null,f?.()},we=f=>{pe.push(f),Re()},Se=(f,p)=>{const k=["question","link-button","tool-approval"].includes(f)?p.turnMessageId===j:p.messageId===j||Array.isArray(p.processedMessageIds)&&p.processedMessageIds.includes(j);(f==="closed"||k)&&we({kind:f,payload:p})};let me=!1,Te=null;const Ie=new Promise(f=>{Te=f});let ce=0,he=Date.now();const ue=f=>{he=Date.now();const p=Number(f.lastEventId);Number.isFinite(p)&&p>ce&&(ce=p)},ke=["output","status","complete","closed","agent-error","question","link-button","tool-approval","tool_use"],Ce=f=>{f.addEventListener("open",()=>{me=!0,Te?.()}),f.addEventListener("connected",b=>{ue(b),me||(me=!0,Te?.())}),f.addEventListener("ping",ue);const p=b=>k=>{ue(k);const ee=k;typeof ee.data=="string"&&Se(b,ut(ee))};for(const b of ke)f.addEventListener(b,p(b));f.addEventListener("error",b=>{const k=b;if(typeof k.data=="string"&&k.data){ue(b),Se("error",ut(k));return}f.readyState===EventSource.CLOSED&&we({kind:"error",payload:{error:"Connection closed"}})})};Ce(X);const _e=async()=>{X.close();let f=B.sseUrl;if(ce){const p=new URL(B.sseUrl,window.location.origin);p.searchParams.set("since",String(ce)),f=p.toString()}X=await rt(f,{throwOnFailure:!1}),Ce(X),he=Date.now()};await Promise.race([Ie,new Promise(f=>setTimeout(f,1500))]);const Oe=()=>{X.close(),Re()};J.signal.addEventListener("abort",Oe,{once:!0});try{const f=h.current?.trim(),p=!!f&&!g.current;p&&(g.current=!0);let b;if(M.length>0){const x=new FormData;x.set("content",I),x.set("messageId",j),p&&f&&x.set("ephemeralContext",f);for(const _ of M)x.append("files",_,_.name);b={method:"POST",credentials:"include",body:x,timeoutMs:12e4}}else{const x={content:I,messageId:j};p&&f&&(x.ephemeralContext=f),b={method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(x),timeoutMs:2e4}}const k=await tt(B.messagesUrl,b);if(!k.ok)throw d.current=null,await nt(k);let ee="",D=Me,et=null;const ge=[],de=()=>Wn({textOut:ee,statusLine:D,errorText:et,toolCalls:ge});for(W(de());!J.signal.aborted;){if(pe.length===0){let _;const ne=await Promise.race([new Promise(Ve=>{ie=()=>Ve(!0)}),new Promise(Ve=>{_=setTimeout(()=>Ve(!1),rr)})]);_&&clearTimeout(_),!ne&&Date.now()-he>=nr&&(await _e(),A());continue}const x=pe.shift();if(x){if(x.kind==="output")D=null,ee+=String(x.payload.content??"");else if(x.kind==="status")D=Me;else if(x.kind==="complete"){D=null;const _=x.payload.finalText;typeof _=="string"&&_.length>0&&(ee=_);const ne=x.payload.suggestions;ne!==void 0&&R(Array.isArray(ne)?or(ne):null),A(),W(de());return}else if(x.kind==="closed"){d.current=null;const _=x.payload.reason;D=`Session ended${_?`: ${_}`:""}.`,A(),W(de());return}else if(x.kind==="error"||x.kind==="agent-error"){D=null,et=typeof x.payload.error=="string"&&x.payload.error?x.payload.error:"Agent reported an error.";const _=x.payload.errorContext&&typeof x.payload.errorContext=="object"?x.payload.errorContext:void 0,ne=yt(x.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&&ge.push({type:"tool-call",toolCallId:be("l"),toolName:"link-button",args:{label:ne.label,url:ne.href}}),A(),W(de());return}else if(x.kind==="question")ge.push({type:"tool-call",toolCallId:be("q"),toolName:"question",args:{question:x.payload.question??"",options:x.payload.options??[]}});else if(x.kind==="tool_use"){if(D=null,wt.has(x.payload.name??"")){W(de());continue}const _=x.payload.result_summary,ne=Rt(_);if(!z&&!ne){W(de());continue}ge.push({type:"tool-call",toolCallId:x.payload.toolCallId??be("t"),toolName:z?x.payload.name??"tool":"subscription-candidate",args:z?x.payload.input??{}:null,result:_,isError:x.payload.isError})}else if(x.kind==="link-button")ge.push({type:"tool-call",toolCallId:be("l"),toolName:"link-button",args:{label:x.payload.label??"Open link",url:x.payload.url??""}});else if(x.kind==="tool-approval"){const _=x.payload.runId;if(typeof _!="number")continue;ge.push({type:"tool-call",toolCallId:`run-${_}`,toolName:"tool-approval",args:{runId:_,action:x.payload.action??null,proposal:x.payload.proposal??null,current:x.payload.current??null,fields:x.payload.fields??null,attribution:x.payload.attribution??null,resourceKind:x.payload.resourceKind??null}})}W(de())}}}catch(f){W([{type:"text",text:`Error: ${f instanceof Error?f.message:"Send failed."}`}])}finally{J.signal.removeEventListener("abort",Oe),X.close()}},[e,Z,A,z,t]),re=a.useCallback(I=>{const M=I.trim(),V=$.map(B=>B.file);if(!M&&V.length===0||S.current||!e)return;y.current||(y.current=!0,l?.(M||V[0]?.name||""));const j={id:be("u"),role:"user",parts:M?[{type:"text",text:M}]:[],attachments:$.map(B=>({id:B.id,name:B.name,isImage:B.isImage,imageDataUrl:B.isImage?URL.createObjectURL(B.file):void 0})),createdAt:Date.now()},J=be("asst"),W={id:J,role:"assistant",parts:[{type:"reasoning"}],createdAt:Date.now()};L(B=>[...B,j,W]),q([]),le(!0),S.current=!0,te(M,V,J).finally(()=>{le(!1),S.current=!1,w.current=null})},[e,l,$,te]),se=a.useCallback(()=>{w.current?.abort()},[]),ye=a.useCallback(I=>{const M=Array.from(I);q(V=>[...V,...M.map(j=>({id:crypto.randomUUID(),name:j.name,file:j,isImage:j.type.startsWith("image/")}))])},[]),Y=a.useCallback(I=>{q(M=>M.filter(V=>V.id!==I))},[]),ae=a.useRef(!1);a.useEffect(()=>{if(ae.current)return;const I=jn(n);I&&(ae.current=!0,re(I))},[n,re]);const F=a.useMemo(()=>({messages:N,running:G,append:re,cancel:se,pendingAttachments:$,addAttachments:ye,removeAttachment:Y,initialDraft:c,agentId:e,conversationId:n,workspaceSlug:t,currentSuggestions:Q,starters:K}),[N,G,re,se,$,ye,Y,c,e,n,t,Q,K]);return r&&v?s.jsx(wn,{}):s.jsx(Je.Provider,{value:F,children:i})}const dt="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 sr({refItem:e}){const t=In[e.kind]??Gt;return kn(e.path)?s.jsxs("span",{className:dt,children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]}):s.jsxs(gt,{to:e.path,className:P(dt,"hover:bg-accent/80"),children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]})}const Xe=({text:e,renderText:t})=>En(e)?s.jsx(s.Fragment,{children:An(e).map((n,r)=>n.type==="ref"?s.jsx(sr,{refItem:n.ref},`r${r}`):s.jsx("span",{children:t(n.text)},`t${r}`))}):s.jsx(s.Fragment,{children:t(e)}),lr=({label:e="Thinking"})=>s.jsx("span",{className:"aui-thinking-shimmer inline-block text-sm","aria-live":"polite","aria-busy":"true",children:e}),Ct=a.createContext(null),jt=()=>{const e=a.useContext(Ct);if(!e)throw new Error("ChainOfThought components must be used within ChainOfThought");return e},Nt=a.memo(({className:e,open:t,defaultOpen:n=!1,onOpenChange:r,children:o,...l})=>{const[i,c]=Qt({prop:t,defaultProp:n,onChange:r}),u=a.useMemo(()=>({isOpen:i,setIsOpen:c}),[i,c]);return s.jsx(Ct.Provider,{value:u,children:s.jsx("div",{className:P("not-prose max-w-prose space-y-4",e),...l,children:o})})}),Et=a.memo(({className:e,children:t,...n})=>{const{isOpen:r,setIsOpen:o}=jt();return s.jsx(bt,{onOpenChange:o,open:r,children:s.jsxs(Yt,{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(Xt,{className:P("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),At=a.memo(({className:e,icon:t=en,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]})]})}),It=a.memo(({className:e,children:t,...n})=>{const{isOpen:r}=jt();return s.jsx(bt,{open:r,children:s.jsx(Zt,{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})})});Nt.displayName="ChainOfThought";Et.displayName="ChainOfThoughtHeader";At.displayName="ChainOfThoughtStep";It.displayName="ChainOfThoughtContent";function ar(e){return{contentIds:e.filter(n=>Number.isSafeInteger(n)&&n>0),sortBy:"date",sortOrder:"asc"}}function ir({ownerSlug:e,eventIds:t}){const n=t.join(","),r=a.useMemo(()=>ar(n.split(",").map(Number)),[n]);return r.contentIds.length===0?null:s.jsx(tn,{owner:e,children:({organizationId:o,ownerSlug:l})=>o?s.jsx(Ln,{organizationId:o,ownerSlug:l,filters:r,hideOriginator:!0}):null})}function cr({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=ze(ur(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={...ze(l,i),ref:Ae(l.ref,i.ref)};return a.cloneElement(n,c)}function ze(...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):fr(o)&&typeof i=="function"&&typeof l=="function"?t[o]=dr(l,i):t[o]=l}}return t}function ur(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 dr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function fr(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 pr=8,mr=64,hr=0,Le=.5,gr=180,br=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),kt={start:!1,end:!1},xr=[],$e={currentAnchorId:null,visibleMessageIds:xr};function vr({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return kt;let o=Ze({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function yr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return $e;let i=o.getBoundingClientRect(),c=i.top+t+n,u=typeof IntersectionObserver>"u",d=[],m=null;for(let y of je(e,r)){let h=y.dataset.messageId;if(!h)continue;let g=y.dataset.scrollAnchor==="true",w=g||u?y.getBoundingClientRect():null;(u&&w?w.bottom>c&&w.top<i.bottom:l.has(h))&&d.push(h),g&&w&&w.top<=c+Le&&(m=h)}return d.length===0&&m===null?$e:{currentAnchorId:m,visibleMessageIds:d}}function je(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function Rr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r?.dataset.scrollAnchor==="true")return r}return null}function wr(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function Sr(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 Tr(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor==="true")return n}return null}function Cr({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 jr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=_t(t,o),i=t.getBoundingClientRect().height,c=Ar(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,m=o.scrollTop+o.clientHeight-c.end;return l>=d&&u<=m?o.scrollTop:l<d?l-c.start-n:u-o.clientHeight+c.end+n}return l-c.start-n}function _t(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Pe(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Nr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Ze({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Ze({content:e,spacer:t,viewport:n}){let r=je(e,t),o=Ot(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 Er(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Ot(e){let t=window.getComputedStyle(e);return{end:We(t.paddingBlockEnd||t.paddingBottom),start:We(t.paddingBlockStart||t.paddingTop)}}function Ar(e){let t=e?.parentElement;return t?Ot(t):{end:0,start:0}}function Ir(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return We(n)}function We(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function kr({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:u,defaultScrollPositionAppliedRef:d,itemCountRef:m,messageElementsRef:y,modeRef:h,pendingScrollToMessageRef:g,prependRestoreRef:w,scrollMarginRef:E,scrollPreviousItemPeekRef:v,spacerGapRef:T,spacerHeightRef:H,spacerRef:U,viewportRef:K}=e,z=a.useCallback(R=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==R&&(i.current=R,t()),R&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},gr))},[t]),N=a.useCallback(R=>{let S=U.current;if(!S)return;let C=Math.max(0,Math.ceil(R));H.current!==C&&(H.current=C,S.hidden=C===0,S.style.height=`${C}px`,S.style.marginTop=C>0?`${-T.current}px`:"")},[]),L=a.useCallback((R,{behavior:S="auto",autoscrolling:C=!1}={})=>{let O=K.current;if(!O)return;let A=Math.max(0,R);if(Math.abs(O.scrollTop-A)<=Le){O.scrollTop=A,t();return}C&&z(!0),O.scrollTo({top:A,behavior:S}),n()},[t,n,z]),G=a.useCallback(({behavior:R="auto"}={})=>K.current?(N(0),o.current=null,h.current="free-scrolling",L(0,{behavior:R}),r(),!0):!1,[r,L,N]),le=a.useCallback(({behavior:R="auto"}={})=>{let S=K.current;return S?(N(0),o.current=null,h.current=l.current?"following-bottom":"free-scrolling",L(Er(S),{autoscrolling:!0,behavior:R}),r(),!0):!1},[r,L,N]),$=a.useCallback((R,{align:S="start",behavior:C="auto",scrollMargin:O=E.current}={},{keepPreviousPeek:A=!1}={})=>{let Z=u.current,te=K.current;if(!Z||!te||!Z.contains(R))return!1;let re=jr({align:S,element:R,scrollMargin:A?O+v.current:O,spacer:U.current,viewport:te}),se=Nr({content:Z,scrollTop:re,spacer:U.current,viewport:te});return N(se),w.current={element:R,viewportTop:Pe(R,te)},h.current=A?"anchored-to-message":"settling-jump",o.current=A?R:null,L(re,{behavior:C}),r(),!0},[r,L,N]),q=a.useCallback(()=>{let R=o.current;return!R||!R.isConnected||h.current!=="anchored-to-message"?!1:$(R,{align:"start"},{keepPreviousPeek:!0})},[$]),Q=a.useCallback((R,S)=>{let C=y.current.get(R);return C?(d.current=!0,$(C,S)?(g.current=null,!0):(g.current={messageId:R,options:S},!0)):m.current===0?(g.current={messageId:R,options:S},d.current=!0,!0):!1},[$]);return{flushPendingScrollToMessage:a.useCallback(()=>{let R=g.current;if(!R)return!1;let S=y.current.get(R.messageId);return!S||!$(S,R.options)?!1:(g.current=null,d.current=!0,!0)},[$]),reanchorToAnchoredMessage:q,scrollToElement:$,scrollToEnd:le,scrollToMessage:Q,scrollToStart:G}}function Pt(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 _r(e,t){return Pt(e,t)}function Or(){return Pt($e,Mr)}function Pr(e,t){return e.start===t.start&&e.end===t.end}function Mr(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Lr({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),m=a.useRef(null),y=a.useRef(0),h=a.useRef(e?"following-bottom":"free-scrolling"),g=a.useRef(new Map),w=a.useRef(null),E=a.useRef(null),v=a.useRef(null),T=a.useRef(r),H=a.useRef(!0),U=a.useRef(null),K=a.useRef(n),z=a.useRef(null),N=a.useRef(0),L=a.useRef(0),G=a.useRef(null),le=a.useRef(null),$=a.useRef(null),q=a.useRef(null),Q=a.useRef(null),R=a.useRef(null),S=a.useRef(null),C=a.useRef(null),O=a.useRef(new Set),A=a.useRef(new WeakSet);return $.current===null&&($.current=_r(kt,Pr)),C.current===null&&(C.current=Or()),o.current=e,u.current=t,K.current=n,T.current=r,{autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:q,streamingTurnRef:v,contentRef:i,defaultScrollPositionAppliedRef:c,firstItemRef:m,itemCountRef:d,lastScrollTopRef:y,messageElementsRef:g,modeRef:h,pendingScrollFrameRef:z,pendingScrollToMessageRef:w,prependRestoreRef:E,preserveScrollOnPrependRef:H,rootRef:U,scrollEdgeThresholdRef:u,scrollMarginRef:K,scrollPreviousItemPeekRef:T,spacerGapRef:N,spacerHeightRef:L,spacerRef:G,stateFrameRef:le,stateStore:$.current,viewportRef:Q,visibilityFrameRef:R,visibilityObserverRef:S,visibilityStore:C.current,visibleMessageIdsRef:O,handledScrollAnchorsRef:A}}function ft(e,t){return a.useCallback(n=>{e.current=n,n&&t()},[e,t])}function $r({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=pr,scrollPreviousItemPeek:r=mr,scrollMargin:o=hr}){let l=Lr({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:u,autoscrollingTimeoutRef:d,contentRef:m,defaultScrollPositionAppliedRef:y,firstItemRef:h,itemCountRef:g,lastScrollTopRef:w,messageElementsRef:E,modeRef:v,pendingScrollFrameRef:T,pendingScrollToMessageRef:H,prependRestoreRef:U,preserveScrollOnPrependRef:K,rootRef:z,scrollEdgeThresholdRef:N,scrollMarginRef:L,scrollPreviousItemPeekRef:G,spacerGapRef:le,spacerHeightRef:$,spacerRef:q,stateFrameRef:Q,stateStore:R,viewportRef:S,visibilityFrameRef:C,visibilityObserverRef:O,visibilityStore:A,visibleMessageIdsRef:Z,handledScrollAnchorsRef:te}=l,re=a.useRef(t);re.current!==t&&(re.current=t,y.current=!1);let se=a.useCallback(f=>{let p=z.current,b=S.current,k=[f.start&&"start",f.end&&"end"].filter(Boolean).join(" "),ee=u.current;for(let D of[p,b])D&&(k?D.setAttribute("data-scrollable",k):D.removeAttribute("data-scrollable"),D.toggleAttribute("data-autoscrolling",ee))},[]),ye=a.useCallback(f=>{let p=S.current?.scrollTop??0,b=p<w.current-Le;w.current=p,c.current&&!f.end&&v.current!=="settling-jump"&&v.current!=="anchored-to-message"?v.current="following-bottom":v.current==="following-bottom"&&f.end&&b&&!u.current&&(v.current="free-scrolling")},[]),Y=a.useCallback(()=>{let f=vr({content:m.current,scrollEdgeThreshold:N.current,spacer:q.current,viewport:S.current});ye(f);let p=v.current==="following-bottom"?{...f,end:!1}:f;se(p),R.setSnapshot(p)},[ye,R,se]),ae=a.useCallback(()=>{Q.current===null&&(Q.current=window.requestAnimationFrame(()=>{Q.current=null,Y()}))},[Y]),F=a.useCallback(()=>{A.hasListeners()&&C.current===null&&(C.current=window.requestAnimationFrame(()=>{C.current=null,A.hasListeners()&&A.setSnapshot(yr({content:m.current,scrollMargin:L.current,scrollPreviousItemPeek:G.current,spacer:q.current,viewport:S.current,visibleMessageIds:Z.current}))}))},[A]),{flushPendingScrollToMessage:I,reanchorToAnchoredMessage:M,scrollToElement:V,scrollToEnd:j,scrollToMessage:J,scrollToStart:W}=kr({refs:l,commitScrollState:Y,scheduleStateCommit:ae,scheduleVisibilitySync:F}),B=a.useCallback(()=>{let f=U.current,p=S.current;if(!f||!p||!f.element.isConnected)return!1;let b=Pe(f.element,p)-f.viewportTop;return Math.abs(b)<=Le?!1:(p.scrollTop+=b,f.viewportTop=Pe(f.element,p),ae(),F(),!0)},[ae,F]),X=a.useCallback(()=>{let f=m.current,p=S.current;if(!f||!p){U.current=null;return}let b=Cr({content:f,spacer:q.current,viewport:p});U.current=b?{element:b,viewportTop:Pe(b,p)}:null},[]),pe=a.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,I()&&X()}))},[X,I]),ie=a.useCallback(()=>{if(!t||y.current||g.current===0)return!1;let f=!1;if(t==="last-anchor"){let p=m.current,b=S.current,k=p&&b?Tr(je(p,q.current)):null;if(!p||!b||!k)f=j({behavior:"auto"});else{let ee=_t(k,b);f=Ze({content:p,spacer:q.current,viewport:b})-ee<=b.clientHeight?j({behavior:"auto"}):V(k,{align:"start"},{keepPreviousPeek:!0})}}else f=t==="end"?j({behavior:"auto"}):W({behavior:"auto"});return f?(y.current=!0,!0):!1},[t,V,j,W]),Re=a.useCallback(()=>{let f=m.current;if(!f)return;let p=je(f,q.current),b=g.current,k=h.current;g.current=p.length,h.current=p[0]??null,(()=>{if(I())return;if(b===0){if(ie()||p.length>0&&c.current&&j({behavior:"auto"}))return;Y(),F();return}let ee=k?p.indexOf(k):-1;if(K.current&&ee>0){B();return}if(p.length>b){let D=Rr(p,b);if(D){if(c.current&&v.current==="following-bottom"&&Sr(p,b)){j({behavior:"auto"});return}V(D,{align:"start"},{keepPreviousPeek:!0}),te.current.add(D);return}}if(p.length===b){let D=wr(p,te.current);if(D){V(D,{align:"start"},{keepPreviousPeek:!0}),te.current.add(D);return}}v.current==="following-bottom"&&c.current?j({behavior:"auto"}):(Y(),F())})(),X()},[ie,X,Y,I,B,F,V,j]),we=a.useCallback(()=>{if(v.current==="following-bottom"&&c.current){j({behavior:"auto"});return}let f=$.current;if(M()){c.current&&f>0&&$.current===0&&j({behavior:"auto"});return}ae(),F()},[M,ae,F,j]),Se=a.useCallback(()=>{let f=S.current;if(!(!f||!A.hasListeners())){if(typeof IntersectionObserver>"u"){F();return}O.current||(O.current=new IntersectionObserver(p=>{for(let b of p){let k=b.target.dataset.messageId;k&&(b.isIntersecting?Z.current.add(k):Z.current.delete(k))}F()},{root:f,rootMargin:`${-(L.current+G.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),E.current.forEach(p=>{O.current?.observe(p)}),F()}},[F,A]),me=a.useCallback(()=>{C.current!==null&&(window.cancelAnimationFrame(C.current),C.current=null),O.current?.disconnect(),O.current=null,Z.current.clear(),A.setSnapshot($e)},[A]),Te=a.useCallback((f,p,b)=>{if(p){E.current.set(f,p),O.current?.observe(p),F(),H.current?.messageId===f&&pe();return}b&&E.current.get(f)===b&&(E.current.delete(f),Z.current.delete(f),O.current?.unobserve(b),F())},[pe,F]),Ie=a.useCallback(()=>{(v.current==="following-bottom"||v.current==="anchored-to-message"||v.current==="settling-jump")&&(i.current=null,v.current="free-scrolling")},[]),ce=a.useCallback(()=>se(R.getSnapshot()),[R,se]),he=ft(z,ce),ue=ft(S,ce),ke=a.useCallback(f=>{m.current=f},[]),Ce=a.useCallback(f=>{q.current=f,le.current=Ir(f?.parentElement??null)},[]),_e=a.useCallback(()=>{Y(),F(),X()},[X,Y,F]),Oe=a.useMemo(()=>({handleContentChange:Re,handleResize:we,observeVisibility:Se,preserveScrollOnPrependRef:K,scrollToEnd:j,scrollToMessage:J,scrollToStart:W,setContentElement:ke,setRootElement:he,setSpacerElement:Ce,setViewportElement:ue,stateStore:R,syncAfterScroll:_e,unobserveVisibility:me,userScrollIntent:Ie,viewportRef:S,visibilityStore:A}),[Re,we,Se,j,J,W,ke,he,Ce,ue,R,_e,me,Ie,A]);return a.useLayoutEffect(()=>{ie()},[ie]),a.useEffect(()=>()=>{Q.current!==null&&(window.cancelAnimationFrame(Q.current),Q.current=null),C.current!==null&&(window.cancelAnimationFrame(C.current),C.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&&v.current==="following-bottom"&&g.current>0){j({behavior:"auto"});return}Y()},[e,Y,j]),{context:Oe,registerMessage:Te}}function Dr(e){let t=a.useRef(e);return t.current=e,t}var Mt=a.createContext(null),Lt=a.createContext(null);function xe(){let e=a.useContext(Mt);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ur(){let e=a.useContext(Lt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function $t(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=xe();return a.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function Dt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:n}=xe(),r=a.useCallback(o=>n.subscribe(o,e,t),[e,t,n]);return a.useSyncExternalStore(r,n.getSnapshot,n.getSnapshot)}function Fr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:i,registerMessage:c}=$r({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(Mt.Provider,{value:i,children:s.jsx(Lt.Provider,{value:c,children:t})})}function Vr({children:e,...t}){let{setRootElement:n}=xe();return s.jsx("div",{ref:n,...t,children:e})}function Br({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:i=!0,ref:c,role:u,tabIndex:d,...m}){let{handleResize:y,preserveScrollOnPrependRef:h,setViewportElement:g,syncAfterScroll:w,userScrollIntent:E,viewportRef:v}=xe();h.current=i;let T=a.useCallback(N=>{g(N),Ae(c)?.(N)},[c,g]);function H(N){w(),r?.(N)}function U(N){E(),l?.(N)}function K(N){E(),o?.(N)}function z(N){br.has(N.key)&&E(),n?.(N)}return a.useEffect(()=>{let N=v.current;if(!N||typeof ResizeObserver>"u")return;let L=0,G=new ResizeObserver(()=>{window.cancelAnimationFrame(L),L=window.requestAnimationFrame(y)});return G.observe(N),()=>{window.cancelAnimationFrame(L),G.disconnect()}},[y,v]),s.jsx("div",{ref:T,role:u??"region","aria-label":e??"Messages",tabIndex:d??0,onKeyDown:z,onScroll:H,onTouchMove:K,onWheel:U,...m,children:t})}function Hr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:i,handleResize:c,setContentElement:u,setSpacerElement:d}=xe(),m=a.useRef(null),y=a.useCallback(h=>{m.current=h,u(h),Ae(n)?.(h)},[n,u]);return a.useLayoutEffect(()=>{let h=m.current;if(!h||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(h,{childList:!0}),()=>g.disconnect()},[i]),a.useEffect(()=>{let h=m.current;if(!h||typeof ResizeObserver>"u")return;let g=0,w=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return w.observe(h),()=>{window.cancelAnimationFrame(g),w.disconnect()}},[c]),s.jsxs("div",{ref:y,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 zr({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ur(),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 Wr({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:i="button",...c}){let{scrollToEnd:u,scrollToStart:d,stateStore:m}=xe(),y=Dr(r),h=a.useCallback(v=>m.subscribe(v),[m]),g=a.useCallback(()=>{let v=m.getSnapshot();return n==="start"?v.start:v.end},[n,m]),w=a.useSyncExternalStore(h,g,g),E=a.useCallback(v=>{w&&(y.current?.(v),v.defaultPrevented||(v.currentTarget.blur(),n==="start"?d({behavior:e}):u({behavior:e})))},[e,n,w,y,u,d]);return cr({defaultTagName:"button",props:ze({type:i,inert:!w,tabIndex:w?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:E},c),render:o,state:{active:w,direction:n},stateAttributesMapping:{active:v=>({"data-active":v?"true":"false"})}})}var ve={Provider:Fr,Root:Vr,Viewport:Br,Content:Hr,Item:zr,Button:Wr};const Kr=ve.Provider;function qr({className:e,...t}){return s.jsx(ve.Root,{className:P("relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function Gr({className:e,...t}){return s.jsx(ve.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(ve.Content,{className:P("flex h-max min-h-full flex-col",e),...t})}function Yr({className:e,...t}){return s.jsx(ve.Item,{className:P("min-w-0 shrink-0",e),...t})}function Jr({className:e,...t}){return s.jsx(ve.Button,{direction:"end",behavior:"smooth",render:({active:n,...r})=>n?s.jsx(fe,{...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(nn,{})}):null,...t})}function Xr(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 Zr(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 eo="lobu-spa";function pt(e){return typeof e=="string"&&/^https?:\/\//i.test(e.trim())}function De(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 Vo=({afterMessagesContent:e,readOnly:t=!1,readerPositionMode:n="messages",interactionExtension:r,onRunSelect:o})=>{const{messages:l,agentId:i,conversationId:c}=Ee(),{data:u=[]}=rn(i,{conversationId:c});return s.jsx($n,{extension:r,children:s.jsxs("div",{"data-agent-thread":!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsx(to,{messages:l,trips:u,mode:n,afterMessagesContent:e,onRunSelect:o}),t?null:s.jsx("div",{className:Sn,children:s.jsx(Io,{})})]})})},to=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>s.jsx(Kr,{autoScroll:!0,defaultScrollPosition:n==="runs"?"last-anchor":"end",scrollPreviousItemPeek:48,children:s.jsx(ro,{messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})});function no(e){if(!e.startsWith("sep:"))return null;const t=Number(e.slice(4));return Number.isFinite(t)&&t>0?t:null}const ro=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>{const{currentAnchorId:l}=Dt(),{scrollToMessage:i}=$t(),c=a.useRef(null);a.useEffect(()=>{if(e.length===0||typeof window>"u")return;const d=Zr({messageIds:e.map(m=>m.id),scrollTarget:Xr(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(qr,{children:[s.jsx(Gr,{"aria-label":n==="runs"?"Automation run history":"Conversation",children:s.jsxs(Qr,{className:P(Ge,Tn),children:[e.map(d=>{const m=n==="runs"&&o?no(d.id):null;return s.jsx(Yr,{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:m!=null?s.jsx(xo,{message:d,onClick:()=>o?.(m)}):s.jsx(ao,{message:d})},d.id)}),t.map(d=>s.jsx(so,{trip:d},d.id)),s.jsx(lo,{}),r?s.jsx("div",{className:"mt-auto shrink-0 py-2",children:r}):null]})}),e.length>0?s.jsx(oo,{messages:e,mode:n}):null,s.jsx(Jr,{})]})},oo=({messages:e,mode:t})=>{const{scrollToMessage:n}=$t(),{currentAnchorId:r,visibleMessageIds:o}=Dt(),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(m=>m.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(fe,{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(fe,{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)})})]})]})},so=({trip:e})=>s.jsxs("div",{className:P(Ge,"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(an,{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]})]}),lo=()=>{const{currentSuggestions:e,starters:t,messages:n,running:r,append:o}=Ee(),l=Kn(e,t,n.length);return r||l.length===0?null:s.jsx(Nn,{prompts:l,className:P(Ge,n.length===0&&"mt-auto"),onPick:i=>o(i)})},ao=({message:e})=>e.role==="user"?s.jsx(io,{message:e}):e.role==="system"?s.jsx(vo,{message:e}):s.jsx(fo,{message:e}),Ut=({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(He,{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})},io=({message:e})=>{const t=e.parts.filter(n=>n.type==="bash");return t.length>0?s.jsx("div",{className:xt,children:s.jsx("div",{className:"space-y-2",children:t.map(n=>s.jsx(co,{part:n},De(e,n)))})}):s.jsx("div",{className:Cn,children:s.jsxs("div",{className:P(Ne,"px-3 py-2 text-sm"),children:[e.attachments&&e.attachments.length>0?s.jsx("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:e.attachments.map(n=>s.jsx(Ut,{attachment:n},n.id))}):null,e.parts.map(n=>n.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Xe,{text:n.text,renderText:r=>r})},De(e,n)):null)]})})},co=({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]})},Ft=new Set(["question","link-button","tool-approval"]),uo="subscription-candidate",fo=({message:e})=>{const t=Qe(),{agentId:n,workspaceSlug:r}=Ee(),o=u=>u.type==="tool-call"&&(Ft.has(u.toolName)||t?.toolNames.has(u.toolName)),l=e.parts.filter(u=>u.type==="tool-call"&&!o(u)&&u.toolName!==uo),i=e.parts.filter(u=>u.type!=="tool-call"||o(u)),c=e.parts.flatMap(u=>{if(u.type!=="tool-call")return[];const d=Rt(u.result);return d?[d]:[]});return s.jsx("div",{className:xt,children:s.jsxs("div",{className:"space-y-2 text-sm",children:[l.length>0?s.jsx(ho,{tools:l,workspaceSlug:r}):null,n&&r?c.map(u=>s.jsx(po,{candidate:u,agentId:n,workspaceSlug:r},`${u.connector_key}:${u.resource_ref}`)):null,i.map(u=>s.jsx(bo,{part:u},De(e,u))),e.attachments&&e.attachments.length>0?s.jsx("div",{className:"flex flex-wrap gap-2",children:e.attachments.map(u=>s.jsx(Ut,{attachment:u},u.id))}):null]})})},po=({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(fe,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:s.jsxs(gt,{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 mo(e){try{return JSON.parse(e)}catch{return null}}function Vt(e){if(Array.isArray(e)){const o=e.flatMap(l=>l?.type==="text"&&typeof l.text=="string"?Vt(l.text)??[]:[]);return o.length>0?[...new Set(o)]:null}const t=typeof e=="string"&&e.trimStart().startsWith("{")?mo(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 ho=({tools:e,workspaceSlug:t})=>s.jsxs(Nt,{defaultOpen:!1,children:[s.jsx(Et,{children:e.length===1?ot(e[0].args,e[0].toolName)??e[0].toolName:`${e.length} tool calls`}),s.jsx(It,{children:e.map(n=>{const r=ot(n.args,n.toolName),o=n.args!==void 0&&n.args!==null,l=n.result!==void 0&&n.result!==null,i=Vt(n.result);return s.jsxs(At,{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:Fe(n.args)}):null,l?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Fe(n.result)}):null,i&&t?s.jsx(ir,{ownerSlug:t,eventIds:i}):null]},n.toolCallId)})})]}),go=({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})]})]})]})},bo=({part:e})=>{const t=Qe();return e.type==="reasoning"?s.jsx(lr,{}):e.type==="error"?s.jsx(go,{text:e.text}):e.type==="text"?e.text.trim()?s.jsx(Xe,{text:e.text,renderText:n=>s.jsx(gn,{text:n})}):null:e.type!=="tool-call"?null:Ft.has(e.toolName)||t?.toolNames.has(e.toolName)?s.jsx(Ao,{toolName:e.toolName,args:e.args}):null},xo=({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"})},vo=({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(Xe,{text:t.text,renderText:n=>n})},De(e,t)):null)})}),yo="/mcp-apps/interaction/index.html";function mt(e){return new Promise(t=>{e({onSettled:(n,r)=>t(!!r)})})}const Ro=({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 m=new yn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{}},{hostContext:{theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"}});m.addEventListener("sizechange",({height:g})=>{typeof g=="number"&&c(Math.max(32,Math.ceil(g)))}),m.oncalltool=async({name:g,arguments:w})=>{const E=await u.current.onToolCall(g,w??{});return{isError:E,content:[{type:"text",text:E?"Action failed.":"Action completed."}]}},m.onopenlink=async({url:g})=>({isError:await u.current.onOpenLink(g)}),m.addEventListener("initialized",()=>{(async()=>(await m.sendToolInput({arguments:{}}),await m.sendToolResult({content:[],structuredContent:{...u.current.renderPayload,version:1,source:eo}})))()});const y=new Rn(d.contentWindow,d.contentWindow);m.connect(y).catch(g=>{console.error("[mcp-app-host] failed to initialize",g)});const h=new MutationObserver(()=>{m.setHostContext({theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"})});return h.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{h.disconnect(),y.close()}},[]),s.jsx("iframe",{ref:l,title:t,src:e,sandbox:"allow-scripts",style:{width:"100%",height:i,border:"none",display:"block"}})},wo=new Set(["action"]),So=["name","description","identity_md"];function oe(e){return e==null||e===""?"":typeof e=="string"?e:Fe(e)}function ht(e){return e===null?"(cleared)":e===void 0?"":typeof e=="string"?e===""?"":e:Fe(e)}function Ue(e){return e.length>0?e[0].toUpperCase()+e.slice(1):e}const Bt=new Set(["delete","disconnect","remove","remove_rule","reset","revoke"]);function Ke(e){return e&&Bt.has(e)?"warning":"default"}function qe(e,t){return e&&Bt.has(e)?{level:"high",reason:t}:{level:"normal"}}function To(e,t){const n=e.attribution==="automation"?"An Automation":"An agent",r=Object.keys(t),o=r.map(l=>({label:l,before:oe(e.current?.[l]),after:oe(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 Co(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=>!wo.has(i)&&o[i]!==void 0).map(i=>({label:i,...e.action==="update"&&e.current?.[i]!==void 0?{before:ht(e.current?.[i])}:{},after:ht(o[i])}));return r.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0}),{title:`${Ue(t)} Automation ${n}`,icon:"automation",impact:qe(e.action,"This archives the Automation and stops future runs."),tone:Ke(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 jo(e){if(e.resourceKind==="automation")return Co(e);if(e.fields&&Object.keys(e.fields).length>0)return To(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 Mn({...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&&oe(e.proposal?.[d])!==oe(e.current?.[d])).map(d=>({label:d,...e.action==="update"?{before:oe(e.current?.[d])}:{},after:oe(e.proposal?.[d])}));c.push(u.length>0?{type:"diff",fields:u}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${Ue(i)} entity ${l}`,icon:"entity",impact:qe(e.action,"This deletes the entity."),tone:Ke(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=So.filter(i=>e.proposal?.[i]!==void 0&&oe(e.proposal?.[i])!==oe(e.current?.[i])).map(i=>({label:i,...e.action==="update"?{before:oe(e.current?.[i])}:{},after:oe(e.proposal?.[i])}));o.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${Ue(r)} agent ${n}`,icon:"agent",impact:qe(e.action,"This permanently deletes the agent and its configuration."),tone:Ke(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 No(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 Eo(e,t){return{tone:"bare",actions:[{id:"open",label:e.label??"Open link",variant:"outline",icon:"external",terminal:!1,href:t}]}}const Ao=({toolName:e,args:t})=>{const n=xn(),r=vn(),{append:o}=Ee(),l=Qe(),i=t??{},c=l?.resolve(e,t)??null;let u=c?.view??null;const d={...c?.handlers??{}},m=new Set;if(!c){if(e==="tool-approval"&&typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0){const y=i.runId,h=typeof i.status=="string"?i.status:"pending",g=h==="pending",w=jo(i),E=h==="confirmed"?"Approved":Ue(h);u=g?w:{...w,title:`${w.title??"Approval"} · ${E}`,tone:h==="failed"?"warning":"default",blocks:[...w.blocks??[],{type:"text",value:typeof i.reviewedByName=="string"?`${h==="rejected"?"Rejected":"Approved"} by ${i.reviewedByName}.`:`${E}.`,muted:!0}],actions:(w.actions??[]).filter(v=>v.terminal===!1)},g&&(d.manage_operations=v=>{if(v.action==="approve")return mt(T=>n.mutate({run_id:y},T));if(v.action==="reject"){const T=typeof v.reason=="string"?v.reason:void 0;return mt(H=>r.mutate({run_id:y,...T?{reason:T}:{}},H))}return Promise.resolve(!0)})}else if(e==="question"){const y=Array.isArray(i.options)?i.options.filter(h=>typeof h=="string"):[];u=No(i),d.answer_question=h=>{const g=typeof h.answer=="string"?h.answer:"";return y.includes(g)?(o(g),Promise.resolve(!1)):Promise.resolve(!0)}}else if(e==="link-button"){if(!pt(i.url))return null;const y=i.url;m.add(y),u=Eo(i,y)}}return u?s.jsx(Ro,{src:yo,title:u.title??"Interaction",renderPayload:u,onToolCall:(y,h)=>d[y]?d[y](h):Promise.resolve(!0),onOpenLink:y=>!m.has(y)||!pt(y)?Promise.resolve(!0):(window.open(y,"_blank","noopener,noreferrer"),Promise.resolve(!1))}):null};function Fe(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Io=()=>{const{running:e,append:t,cancel:n,pendingAttachments:r,addAttachments:o,removeAttachment:l,initialDraft:i,currentSuggestions:c}=Ee(),u=ko({suggestions:e?null:c}),[d,m]=a.useState(i??""),y=a.useRef(null),h=a.useRef(null),g=_n(On),w=a.useRef(i??"");a.useEffect(()=>{const T=i??"";if(T===w.current)return;const H=w.current;w.current=T,T!==""&&m(U=>U===""||U===H?T:U)},[i]);const E=a.useRef(d);E.current=d;const v=()=>{e||(t(E.current),m(""),h.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(He,{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(on,{className:"h-3 w-3"})})]},T.id))}):null,s.jsx(Pn,{value:d,onChange:m,onSubmit:v,searchRefs:g,handleRef:h,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:y,type:"file",multiple:!0,className:"hidden",onChange:T=>{T.target.files&&o(T.target.files),T.target.value=""}}),s.jsxs(fe,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>y.current?.click(),children:[s.jsx(He,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Attach files"})]}),e?s.jsxs(fe,{type:"button",size:"icon",variant:"secondary",className:"h-8 w-8 rounded-full",onClick:n,children:[s.jsx(sn,{size:"lg"}),s.jsx("span",{className:"sr-only",children:"Cancel"})]}):s.jsxs(fe,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",onClick:v,children:[s.jsx(ln,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})};function ko({suggestions:e}){const t=e?.find(n=>n.message.trim().length>0)?.message;return t?`Recommended: ${t.trim()}`:"Chat… (@ to mention, / for commands)"}export{Vo as A,Fo as L,Uo as R,er as h,Yn as s};
6
+ //# sourceMappingURL=agent-thread-FyEO-y44.js.map
@@ -0,0 +1,2 @@
1
+ function r(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().replace(/-/g,"").slice(0,12):Math.random().toString(36).slice(2,14)}export{r as n};
2
+ //# sourceMappingURL=agent-thread-storage-U6htL3ad.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-BjcZVe7n.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=agents-kXojozTU.js.map
@@ -0,0 +1,2 @@
1
+ import{c as M,w as I,q as L,at as N,bb as w,r as O,hJ as R,hK as W,c5 as E,hL as _,hM as D,j as t,ak as U,al as y,gT as B,L as f,gU as k,O as F,i as G,v as P,eI as q,aq as K}from"./index-BjcZVe7n.js";import{A as z}from"./agent-editor-form-BXQBFHSv.js";import{P as H}from"./proposal-review-shell-BED-DO9C.js";import{n as J}from"./nav-pill-Bam6s3jj.js";const b=[{key:"skills",label:"Skills",icon:R},{key:"guardrails",label:"Guardrails",icon:W},{key:"permissions",label:"Permissions",icon:E,adminOnly:!0},{key:"models",label:"Models",icon:_},{key:"settings",label:"Settings",icon:D}];function T(s){return b.filter(e=>!e.adminOnly||s)}function Q(s,e){if(e===`${s}/conversations`||e.startsWith(`${s}/conversations/`))return null;for(const{key:n}of b)if(e===`${s}/${n}`||e.startsWith(`${s}/${n}/`))return n;return e===`${s}/identity`||e===`${s}/identity/`?"settings":null}function V(s){return s.trim().charAt(0).toUpperCase()||"?"}function X({owner:s,agentId:e,agentName:n,activeDest:a}){const{orgContext:r}=P(),{isAdmin:l}=q(r.organizationId),c=T(!!l);return t.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-2",children:[t.jsxs(f,{to:"/$owner/agents/$agentId/settings",params:{owner:s,agentId:e},search:{run_id:void 0},className:"flex min-w-0 items-center gap-2 rounded-md outline-none transition-colors hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",title:"Agent settings",children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-foreground",children:V(n)}),t.jsx("h1",{className:"min-w-0 truncate text-base font-semibold tracking-tight",children:n})]}),t.jsx("nav",{"aria-label":"Agent sections",className:"flex min-w-0 max-w-full flex-wrap items-center justify-center gap-1",children:c.map(({key:d,label:u,icon:g})=>{const o=d===a;return t.jsxs(f,{to:`/$owner/agents/$agentId/${d}`,params:{owner:s,agentId:e},"aria-current":o?"page":void 0,className:J(o,"shrink-0 gap-1.5 px-2.5 py-1 text-sm"),children:[t.jsx(g,{className:"h-3.5 w-3.5 shrink-0"}),u]},d)})})]})}function ns({owner:s,agentId:e}){const n=M(),{pathname:a}=I(),{isAuthenticated:r}=L(),{isMember:l}=N(),c=r&&l,{data:d=[],isLoading:u}=w({enabled:c}),g=d.find(A=>A.agentId===e)??null,o=!g&&!u&&c,m=`/${s}/agents/${e}`,x=`${m}/conversations`,h=a===x||a.startsWith(`${x}/`),i=Q(m,a);O.useEffect(()=>{o&&n({to:"/$owner",params:{owner:s},replace:!0})},[o,n,s]);const v=g?.name??"Agent",j=b.find(A=>A.key===i)?.label??"Conversations",p=a.slice(m.length+1).split("/")[1],C=i==="settings"&&!p,S=C?v:p?p==="create"?i==="skills"?"Add a skill":"New custom guardrail":i==="skills"?"Skill details":i==="guardrails"?"Guardrail details":"Conversation":j;return t.jsxs(U,{className:"gap-3 overflow-hidden pt-2.5 pb-8",children:[t.jsx(y,{children:t.jsx(B,{crumbs:[t.jsx(f,{to:"/$owner/agents",params:{owner:s},className:k,children:"Agents"},"agents"),...C?[]:[t.jsx(f,{to:"/$owner/agents/$agentId/settings",params:{owner:s,agentId:e},search:{run_id:void 0},className:k,children:v},"agent")],...p&&i?[t.jsx(f,{to:`/$owner/agents/$agentId/${i}`,params:{owner:s,agentId:e},className:k,children:j},"section")]:[]],current:S})}),t.jsx(X,{owner:s,agentId:e,agentName:v,activeDest:i}),t.jsx("div",{className:G("flex min-h-0 min-w-0 flex-1 flex-col",h?"overflow-hidden":"overflow-y-auto"),children:t.jsx(F,{})})]})}function Y({agent:s,tab:e,runId:n}){return t.jsx(y,{className:"pb-6",children:t.jsx(H,{resource:{kind:"agent",agentId:s.agentId},runId:n,children:({reviewMode:a,proposal:r,controlsDisabled:l})=>t.jsx(z,{mode:{kind:"edit",agent:s},section:e,reviewMode:a,reviewProposal:r,reviewControlsDisabled:l},s.agentId)})})}function as({owner:s,agentId:e,tab:n,runId:a}){const{orgContext:r,hasOrgContext:l}=P(),{isLoading:c}=K(`/${s}`,r),{isAuthenticated:d}=L(),{isMember:u,isLoading:g}=N(),o=d&&u,{data:m=[],isLoading:x}=w({enabled:o}),$=o?!l||c||x||g:c||g,h=m.find(i=>i.agentId===e)??null;return $||!h?null:t.jsx(Y,{agent:h,tab:n,runId:a})}export{ns as A,as as a};
2
+ //# sourceMappingURL=agents-workbench-CDpJmUVN.js.map
@@ -0,0 +1,2 @@
1
+ import{r as c,iF as b,aW as w,aG as y,b7 as C,aJ as u,j as e,al as k,L as o,gl as j,B as v,gk as A,iR as P,gi as g,gS as R,gT as B,gU as D,A as $,Y as I,fg as L,iS as M,az as z}from"./index-BjcZVe7n.js";import{C as E}from"./connector-page-shell-Di6XzkVo.js";import{C as O}from"./connections-browser-BXsJqieG.js";import"./connection-label-BobuYiAG.js";import"./status-dot-BnQPFrcU.js";function T({ownerSlug:s,appId:a}){const n=c.useMemo(()=>b(s,a,w()),[s,a]),{data:r=[],isLoading:l,isError:d,refetch:N}=y(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const h=r.filter(i=>{const f=C(i);return f!=null&&t.includes(f)});return[h.filter(i=>u(i,s)),h.filter(i=>!u(i,s))]},[n,r,s]);if(!n)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const p=(n.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(E,{header:e.jsx(R,{breadcrumb:e.jsx(B,{crumbs:[e.jsx(o,{to:"/$owner/connectors",params:{owner:s},search:{},className:D,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:n.icon}),title:n.name,caption:n.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?a==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:n.steps.map(t=>e.jsx(_,{step:t},t.label))})})}),p?e.jsx(O,{entries:m.map(t=>({id:t.id,name:g(t),description:P(t,s),tone:t.online?null:"muted",link:A({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(v,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,p&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(o,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:g(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function _({step:s}){const[a,n]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx($,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-xs leading-relaxed",children:r}),e.jsxs(v,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[a?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(L,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function H(){const{owner:s,appId:a}=M.useParams();return e.jsx(z,{owner:s,children:({ownerSlug:n})=>e.jsx(T,{ownerSlug:n,appId:a})})}export{H as component};
2
+ //# sourceMappingURL=app._appId-DwNeXRJp.js.map
@@ -0,0 +1,2 @@
1
+ import{c as b,bb as k,r as o,jq as v,j as e,L as x,B as M,jr as P,cx as S}from"./index-BjcZVe7n.js";import{u as y,a as R,M as C}from"./use-mention-search-CJGCatFS.js";import{P as I,s as A}from"./pending-seed-BP3xHM2d.js";import{n as E}from"./agent-thread-storage-U6htL3ad.js";import"./index-Vcq4gwWv.js";import"./use-automations-D9hKpufo.js";function $({ownerSlug:i,starters:m,preferredMentionKinds:u,onSent:f}){const g=b(),{data:j=[]}=k(),l=y(C),n=o.useMemo(()=>new Set(u??[]),[u]),N=o.useCallback(async d=>{const t=await l(d);return n.size===0?t:[...t].sort((a,w)=>Number(n.has(w.kind))-Number(n.has(a.kind)))},[n,l]),r=v(j),[s,h]=o.useState(""),p=o.useRef(s);p.current=s;const c=d=>{const t=d.trim();if(!t||!r)return;const a=E();A(a,t),h(""),g(S(i,r.agentId,a)),f?.()};return e.jsxs("div",{className:"rounded-lg border bg-background p-4 transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r?e.jsx(R,{value:s,onChange:h,onSubmit:()=>c(p.current),searchRefs:N,placeholder:"Ask Lobu…",className:"[&_.ProseMirror]:max-h-40 [&_.ProseMirror]:min-h-24 [&_.ProseMirror]:overflow-y-auto"}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Bring your"," ",e.jsx(x,{to:"/$owner/agents/connect",params:{owner:i},className:"text-foreground hover:underline",children:"agent"})," ","or"," ",e.jsx(x,{to:"/$owner/agents/new",params:{owner:i},search:{},className:"text-foreground hover:underline",children:"create a new agent"})," ","to get started."]}),e.jsxs("div",{className:"flex items-end justify-between gap-3 pt-2",children:[r&&m&&!s.trim()?e.jsx(I,{prompts:m,onPick:c}):e.jsx("span",{}),e.jsxs(M,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 rounded-full",disabled:!r||!s.trim(),onClick:()=>c(s),children:[e.jsx(P,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})}export{$ as AssistComposer};
2
+ //# sourceMappingURL=assist-composer-Mn9EfX4X.js.map
@@ -0,0 +1,2 @@
1
+ import{v,j as n,L as N,cp as b,aq as S,q as w,at as D,r as h,cP as R,u as O,hA as T,S as $,cQ as E,bN as F}from"./index-BjcZVe7n.js";import{C as L,A as P}from"./create-automation-form-C9PMX7N8.js";import{P as q}from"./proposal-review-shell-BED-DO9C.js";import{E as J}from"./events-feed-CGzA1w3R.js";import{D as M,a as B}from"./definition-comparison-B5WgZILB.js";import{b as A}from"./use-automations-D9hKpufo.js";import{b as H}from"./model-C2q7WDcS.js";function C({automationId:i}){const{currentOwner:t}=v();return t?n.jsx(N,{to:"/$owner/events",params:{owner:t},search:b({semanticTypes:["change"],eventCategory:"config",resourceKind:"automation",resourceId:i}),className:"text-sm text-primary underline underline-offset-4",children:"View definition history in Events"}):null}function k(i){const{orgContext:t,hasOrgContext:r}=v(),{data:o,isLoading:a}=S(`/${i}`,t),{isAuthenticated:d}=w(),{isMember:u,isLoading:c}=D(),g=d&&u,s=o?.workspace,f=g?!r||a||c:a||c;return{organizationId:s?.id??"",isLoading:f}}function z(i){return k(i)}function K({owner:i,automationId:t,organizationId:r}){const o=Number(t),a=h.useMemo(()=>({producedByAutomationId:o}),[o]),d=O(),u=A(t,void 0,r),c=u.data?.automation?.automation_name?.trim()||null,g=H(u.data?.automation),{data:s}=T(g,t,{orgSlug:i}),f=h.useMemo(()=>(s?.runs??[]).map(e=>({runId:e.runId,status:e.status,completedAt:e.completedAt})),[s]),p=h.useCallback(e=>{d?.open({href:`/${i}/automations/${t}?view=activity&run_id=${e}`,title:c!=null?`${c} · Run #${e}`:`Automation run #${e}`,runId:e})},[d,i,t,c]);return Number.isFinite(o)?n.jsx(J,{organizationId:r,ownerSlug:i,filters:a,groupByRun:!0,onRunSelect:p,runs:f,hideRunAction:!0,hideAttribution:!0,emptyState:n.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"This Automation hasn't written anything yet. Runs appear here with the events they created; clicking a run opens its conversation."})}):null}function Q({agentId:i,automationId:t,runId:r,organizationId:o,onDone:a}){const[d,u]=h.useState({ready:!1,triggers:[]}),c=h.useCallback(l=>{u(m=>JSON.stringify(m)===JSON.stringify(l)?m:l)},[]),g=A(t,void 0,o,{includeVersions:!0}),s=g.data?.automation,{currentOwner:f}=v(),p=R({queryKey:["automations-list",f,"editor",t,s?.status],enabled:!!f&&!!o&&!!s,queryFn:async()=>{const m=(await E("manage_automations",{action:"list",automation_id:t,status:s?.status,include_details:!0,limit:1},{slug:f})).automations.find(y=>y.automation_id===t);if(!m)throw new F("Automation not found",404);return m},staleTime:3e4}),e=p.data,x=h.useMemo(()=>s&&e?{automation_id:s.automation_id,name:e.name,slug:e.slug,description:e.description,prompt:e.prompt,sources:e.sources,reaction_script:s.reaction_script,managed_agent_id:e.managed_agent_id,device_worker_id:e.device_worker_id,agent_kind:e.agent_kind,delivery_target:e.delivery_target??void 0,execution_config:e.execution_config??void 0,model_config:e.model_config,tags:e.tags,keying_config:s.keying_config,reactions_guidance:e.reactions_guidance,triggers:e.triggers}:void 0,[s,e]),_=n.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(l=>n.jsx($,{className:"h-16 w-full rounded-lg"},l))}),j=p.isError?n.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[n.jsx("p",{children:"Could not load the saved Automation definition."}),n.jsx("button",{type:"button",className:"text-primary underline underline-offset-4",onClick:()=>void p.refetch(),children:"Retry"})]}):g.isLoading||s&&p.isPending?_:x?n.jsx(L,{organizationId:o,prefillAgentId:i??void 0,editingAutomation:x,createFields:{triggers:d.triggers},triggerFields:n.jsx(P,{organizationId:o,initialTriggers:x.triggers??[],onChange:c},JSON.stringify(x.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!d.ready,onClose:a}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return i?n.jsxs("div",{className:"space-y-6",children:[n.jsx(q,{resource:{kind:"automation",agentId:i,automationId:t},runId:r,onDone:a,children:({reviewMode:l,proposal:m})=>l==="active"?n.jsx(M,{current:m?.current??null,proposed:{...m?.current??{},...m?.proposedAfter??{}},render:y=>n.jsx(B,{value:y})}):l==="loading"?_:l==="error"?null:j}),n.jsx(C,{automationId:t})]}):n.jsxs("div",{className:"space-y-6",children:[j,n.jsx(C,{automationId:t})]})}function I({owner:i,agentId:t,automationId:r,view:o,runId:a,onDone:d}){const{organizationId:u}=k(i),c=A(r,void 0,u),g=t??c.data?.automation?.managed_agent_id??null;return a||o==="definition"?n.jsx(Q,{agentId:g,automationId:r,runId:a,organizationId:u,onDone:d},`${i}/${r}`):n.jsx(K,{owner:i,automationId:r,organizationId:u})}export{I as A,z as u};
2
+ //# sourceMappingURL=automation-detail-content-Bs3vwAPd.js.map
@@ -0,0 +1,2 @@
1
+ import{fh as b,fi as g,cL as k,j as e,L as j,V as r,b8 as y,W as C,fj as d,fk as A,d1 as $,ek as p,eq as M,ct as I}from"./index-BjcZVe7n.js";const m="bg-muted text-muted-foreground",R={event:{label:"Event",icon:k},schedule:{label:"Schedule",icon:g},manual:{label:"Manual",icon:b}};function S({agentName:n,deviceLabel:s,executorKind:i}){const t=i==="script"?{label:"Script",icon:d}:i==="external"?{label:"External executor",icon:d}:s?{label:s,icon:A}:n?{label:n,icon:$}:{label:"Manual · any client",icon:d},{label:l,icon:c}=t;return e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(c,{className:"h-3 w-3"}),l]})}function E({lastRunAt:n,nextRunAt:s,repliesToSource:i}){const t=n?`Ran ${p(n)}`:s?`Next run ${p(s)}`:i?"Replies to incoming messages":"Never run";return e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(M,{className:"h-3 w-3"}),t]})}function L({count:n}){return n<=0?null:e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(I,{className:"h-3 w-3"}),n," ",n===1?"client":"clients"]})}function B({automation:n,agentName:s,deviceLabel:i,connectorDisplay:t,owner:l,actions:c,rowClass:v,appearance:N="row"}){const a=n.automation,o=a.execution_config?.executor,_=o&&typeof o=="object"?o.kind:void 0,u=a.automation_id,x=R[n.kind],w=a.entity_name&&a.entity_type?`${a.entity_name} · ${a.entity_type}`:null,h=[n.when,w].filter(Boolean).join(" — "),f=a.health==="degraded"?a.health_reasons?.[0]||"Needs attention":null;return N==="inline"?e.jsxs(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:u},search:{view:"definition",run_id:void 0},className:"inline-flex items-center gap-1.5 rounded-md bg-accent px-1.5 py-0.5 text-sm font-medium",children:[e.jsx(x.icon,{className:"h-3.5 w-3.5 shrink-0"}),n.does,a.status==="archived"?e.jsx(r,{variant:"outline",children:"Archived"}):null]}):e.jsxs("div",{className:v,children:[e.jsxs(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:u},search:{view:"definition",run_id:void 0},className:"flex min-w-0 flex-1 items-center gap-3",children:[t?e.jsx(y,{icon:t.icon,iconUrl:t.iconUrl,name:t.name,faviconDomain:t.faviconDomain,className:"h-7 w-7 shrink-0 rounded-md text-[10px]"}):e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(x.icon,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:n.does}),a.status==="archived"?e.jsx(r,{variant:"outline",children:"Archived"}):null,e.jsx(S,{agentName:s,deviceLabel:i,executorKind:_}),e.jsx(E,{lastRunAt:a.last_run_completed_at??a.last_fired_at??null,nextRunAt:a.next_run_at??null,repliesToSource:n.output.destination==="source"}),e.jsx(L,{count:a.processing_client_count??0}),f?e.jsxs(r,{variant:"secondary",className:"max-w-full whitespace-normal bg-amber-500/10 text-left text-amber-700 dark:text-amber-400",children:[e.jsx(C,{className:"h-3 w-3 shrink-0"}),f]}):null]}),h?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h}):null]})]}),c]})}export{B as A};
2
+ //# sourceMappingURL=automation-row-B5Q1B10y.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,B as l,X as i}from"./index-BjcZVe7n.js";function x({sources:a,onRemove:s,disabled:n,wrap:r=!1}){return e.jsx(e.Fragment,{children:a.length>0?e.jsx("ul",{className:"space-y-2",children:a.map(t=>e.jsxs("li",{className:"flex items-start gap-2 rounded-lg border bg-background p-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-xs font-medium",children:t.name}),e.jsx("div",{className:r?"whitespace-pre-wrap break-words text-xs text-muted-foreground":"truncate text-xs text-muted-foreground",children:t.query})]}),s?e.jsx(l,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-label":`Remove source ${t.name}`,disabled:n,onClick:()=>s?.(t),children:e.jsx(i,{className:"h-3.5 w-3.5"})}):null]},t.query))}):null})}export{x as A};
2
+ //# sourceMappingURL=automation-source-list-Dhucq1sI.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-BjcZVe7n.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=automations-kXojozTU.js.map
@@ -1,2 +1,2 @@
1
- import{v as a,o as i,r as n,j as t}from"./index-4gCDI7m4.js";function r(){const s=a(),{isReady:e}=i();return n.useEffect(()=>{e&&setTimeout(()=>{s({to:"/"})},500)},[e,s]),t.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-muted-foreground",children:e?"Redirecting...":"Completing sign in..."})})})}export{r as component};
2
- //# sourceMappingURL=callback-B-CAz-bK.js.map
1
+ import{c as a,q as i,r as n,j as t}from"./index-BjcZVe7n.js";function r(){const s=a(),{isReady:e}=i();return n.useEffect(()=>{e&&setTimeout(()=>{s({to:"/"})},500)},[e,s]),t.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-muted-foreground",children:e?"Redirecting...":"Completing sign in..."})})})}export{r as component};
2
+ //# sourceMappingURL=callback-9xSHyA12.js.map
@@ -1,2 +1,2 @@
1
- import{j as r,eZ as d}from"./index-4gCDI7m4.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:`bg-card text-card-foreground flex flex-col gap-6 rounded-2xl border py-6 ${a||""}`,...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:`grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] ${a||""}`,...t})}function c({className:a,asChild:t=!1,...s}){const o=t?d:"div";return r.jsx(o,{"data-slot":"card-title",className:`leading-none font-semibold ${a||""}`,...s})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:`mt-1 first:mt-0 text-muted-foreground text-sm ${a||""}`,...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:`px-6 ${a||""}`,...t})}export{n as C,i as a,c as b,u as c,l as d};
2
- //# sourceMappingURL=card-SFtxv9f2.js.map
1
+ import{j as r,bE as d}from"./index-BjcZVe7n.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:`bg-card text-card-foreground flex flex-col gap-6 rounded-2xl border py-6 ${a||""}`,...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:`grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] ${a||""}`,...t})}function c({className:a,asChild:t=!1,...s}){const o=t?d:"div";return r.jsx(o,{"data-slot":"card-title",className:`leading-none font-semibold ${a||""}`,...s})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:`mt-1 first:mt-0 text-muted-foreground text-sm ${a||""}`,...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:`px-6 ${a||""}`,...t})}export{n as C,i as a,c as b,u as c,l as d};
2
+ //# sourceMappingURL=card-g4yxo4Hr.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,ek as i,V as t}from"./index-BjcZVe7n.js";function c({operation:a}){switch(a){case"create":case"created":return e.jsx(t,{variant:"default",children:"Created"});case"update":case"updated":return e.jsx(t,{variant:"secondary",children:"Updated"});case"delete":case"deleted":return e.jsx(t,{variant:"destructive",children:"Deleted"});default:return e.jsx(t,{variant:"outline",children:a||"Change"})}}function x({operation:a,actor:l,createdAt:s,resource:r,changedFields:n,showAttribution:d=!0}){return e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r?e.jsx("span",{className:"break-words text-sm font-medium",children:r}):null,e.jsx(c,{operation:a}),d?e.jsx("time",{dateTime:s,title:s,className:"ml-auto text-xs text-muted-foreground",children:i(s)}):null]}),d?e.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["by ",l||"unknown"]}):null,n?.length?e.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["Changed: ",n.join(", ")]}):null]})}export{x as C};
2
+ //# sourceMappingURL=change-summary-DeuXQEpb.js.map
@@ -1,2 +1,2 @@
1
- import{E as e,j as c,F as r}from"./index-4gCDI7m4.js";function n(){const{team:a}=e({from:"/slack/claim"});return c.jsx(r,{to:"/connector/$name/connection",params:{name:"slack"},search:{ref:a},replace:!0})}export{n as component};
2
- //# sourceMappingURL=claim-DrxIRWKt.js.map
1
+ import{E as e,j as c,F as r}from"./index-BjcZVe7n.js";function n(){const{team:a}=e({from:"/slack/claim"});return c.jsx(r,{to:"/connector/$name/connection",params:{name:"slack"},search:{ref:a},replace:!0})}export{n as component};
2
+ //# sourceMappingURL=claim-B98IhDra.js.map
@@ -1,2 +1,2 @@
1
- import{o as m,cI as y,a2 as f,Q as I,dF as v}from"./index-4gCDI7m4.js";function w(t){const{session:o,isReady:u}=m(),c=u?o?.user.id:void 0,l=t?.limit??20,i=(t?.clientIds??[]).join(","),a=t?.activityKind??null,d=t?.excludeCommandClients??!1,n=t?.organizationId??null,s=t?.refetchInterval;return y({queryKey:["client-activity-scopes",c,l,i,a,d,n],queryFn:async()=>{const e=new URLSearchParams({limit:String(l)});i&&e.set("client_ids",i),a&&e.set("activity_kind",a),d&&e.set("exclude_command_clients","true"),n&&e.set("organization_id",n);const r=await f(`${I}/api/me/clients/activity-scopes?${e}`,{credentials:"include"});return await v(r,"Failed to load client activity"),(await r.json()).scopes??[]},enabled:!!c&&(t?.enabled??!0),staleTime:15e3,refetchInterval:typeof s=="function"?e=>s((e.state.data?.length??0)>0):s})}export{w as u};
2
- //# sourceMappingURL=client-activity-scopes-boZOHuPW.js.map
1
+ import{q as m,cP as y,a3 as f,Q as I,e3 as v}from"./index-BjcZVe7n.js";function w(t){const{session:o,isReady:u}=m(),c=u?o?.user.id:void 0,l=t?.limit??20,i=(t?.clientIds??[]).join(","),a=t?.activityKind??null,d=t?.excludeCommandClients??!1,n=t?.organizationId??null,s=t?.refetchInterval;return y({queryKey:["client-activity-scopes",c,l,i,a,d,n],queryFn:async()=>{const e=new URLSearchParams({limit:String(l)});i&&e.set("client_ids",i),a&&e.set("activity_kind",a),d&&e.set("exclude_command_clients","true"),n&&e.set("organization_id",n);const r=await f(`${I}/api/me/clients/activity-scopes?${e}`,{credentials:"include"});return await v(r,"Failed to load client activity"),(await r.json()).scopes??[]},enabled:!!c&&(t?.enabled??!0),staleTime:15e3,refetchInterval:typeof s=="function"?e=>s((e.state.data?.length??0)>0):s})}export{w as u};
2
+ //# sourceMappingURL=client-activity-scopes-BD2HBo-_.js.map
@@ -1,2 +1,2 @@
1
- import{cA as c}from"./index-4gCDI7m4.js";function a(t){const n=new Map;for(const e of t){if(e.kind!=="mcp")continue;const s=e.title?.trim()||e.identifier||"Unknown app",l=e.registrationGroupKey||e.id,i=n.get(l);if(!i){n.set(l,{key:l,clientId:e.id,title:s,drivenBy:e.drivenBy?.trim()||null,clientIds:[e.id],connected:e.status==="connected",lastSeenAt:e.lastSeenAt??null,linkedUser:e.linkedUserName??e.linkedUserEmail??null,linkedUserEntitySlug:e.linkedUserEntitySlug??null});continue}i.clientIds.push(e.id),i.connected=i.connected||e.status==="connected",(e.lastSeenAt??0)>(i.lastSeenAt??0)&&(i.lastSeenAt=e.lastSeenAt??null,i.drivenBy=e.drivenBy?.trim()||null)}return[...n.values()].sort((e,s)=>(s.lastSeenAt??0)-(e.lastSeenAt??0))}function o(t){const n=[t.linkedUser];return n.push(t.connected?`active ${c(t.lastSeenAt)}`:"disconnected"),t.drivenBy&&t.drivenBy!==t.title&&n.push(`via ${t.drivenBy}`),n.filter(Boolean).join(" · ")}function d(t){return t.title?.trim()||t.clientName?.trim()||(t.activityKind==="session"?"MCP session":"App activity")}export{d as a,o as c,a as g};
2
- //# sourceMappingURL=client-rows-BJ2PxM4J.js.map
1
+ import{cH as c}from"./index-BjcZVe7n.js";function a(t){const n=new Map;for(const e of t){if(e.kind!=="mcp")continue;const s=e.title?.trim()||e.identifier||"Unknown app",l=e.registrationGroupKey||e.id,i=n.get(l);if(!i){n.set(l,{key:l,clientId:e.id,title:s,drivenBy:e.drivenBy?.trim()||null,clientIds:[e.id],connected:e.status==="connected",lastSeenAt:e.lastSeenAt??null,linkedUser:e.linkedUserName??e.linkedUserEmail??null,linkedUserEntitySlug:e.linkedUserEntitySlug??null});continue}i.clientIds.push(e.id),i.connected=i.connected||e.status==="connected",(e.lastSeenAt??0)>(i.lastSeenAt??0)&&(i.lastSeenAt=e.lastSeenAt??null,i.drivenBy=e.drivenBy?.trim()||null)}return[...n.values()].sort((e,s)=>(s.lastSeenAt??0)-(e.lastSeenAt??0))}function o(t){const n=[t.linkedUser];return n.push(t.connected?`active ${c(t.lastSeenAt)}`:"disconnected"),t.drivenBy&&t.drivenBy!==t.title&&n.push(`via ${t.drivenBy}`),n.filter(Boolean).join(" · ")}function d(t){return t.title?.trim()||t.clientName?.trim()||(t.activityKind==="session"?"MCP session":"App activity")}export{o as a,d as c,a as g};
2
+ //# sourceMappingURL=client-rows-x_CxeWkP.js.map
@@ -1,2 +1,2 @@
1
- import{cH as c,cI as u,a5 as d,bS as p,bT as r,a2 as o,dF as i,Q as w}from"./index-4gCDI7m4.js";function l(t,s="",e){const n=`${w}/api/${t}/clients${s}`,a=e?.toString();return a?`${n}?${a}`:n}function h(t,s){const e=s?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const a=await o(l(e,"",n),{credentials:"include"});return await i(a,"Failed to load connected clients"),(await a.json()).clients??[]},enabled:!!e&&(s?.enabled??!0),staleTime:15e3,refetchInterval:s?.refetchInterval})}function y(){const{slug:t}=c(),s=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const a=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(a,"Failed to revoke client"),await a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{y as a,h as u};
2
- //# sourceMappingURL=clients-C7Lnuc3S.js.map
1
+ import{cO as c,cP as u,a6 as d,bX as p,bt as r,a3 as o,e3 as i,Q as w}from"./index-BjcZVe7n.js";function l(t,s="",e){const n=`${w}/api/${t}/clients${s}`,a=e?.toString();return a?`${n}?${a}`:n}function h(t,s){const e=s?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const a=await o(l(e,"",n),{credentials:"include"});return await i(a,"Failed to load connected clients"),(await a.json()).clients??[]},enabled:!!e&&(s?.enabled??!0),staleTime:15e3,refetchInterval:s?.refetchInterval})}function y(){const{slug:t}=c(),s=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const a=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(a,"Failed to revoke client"),await a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{y as a,h as u};
2
+ //# sourceMappingURL=clients-Cmp0LmOp.js.map
@@ -0,0 +1,2 @@
1
+ import{q as fe,eI as ie,i8 as ge,i9 as oe,ia as ke,aC as ce,ib as je,ic as ve,id as be,ie as ye,r as j,u as re,ig as Ae,j as s,ih as Ce,ii as _e,V as ue,ij as w,ik as Ne,d6 as X,il as Se,B as f,cI as Oe,i as E,im as ne,hq as De,hr as Le,hs as we,ht as Me,hu as Pe,io as Fe,ip as ae,iq as $e,L as Re,ir as Ue,is as ze,it as Ie,c3 as I,iu as Be,iv as Ee,c2 as qe,eQ as Ke,H as W,fg as Te,dh as Ve,I as le,eR as He,c7 as Qe,ab as We,eS as Xe}from"./index-BjcZVe7n.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:v}=fe(),{isAdmin:u,isLoading:C}=ie(l),M=ge(t.auth_schema),o=oe(t.auth_schema),_=ke(t.auth_schema),N=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=ve(),P=be(),p=ye(),[O,D]=j.useState(null),[b,y]=j.useState(null),[x,F]=j.useState([]),$=re(),k=j.useCallback(e=>$?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[$,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=v?.user?.id;if(!R||C||N.isLoading||m.isPending)return null;const a=(N.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),Y=e=>B(e,t.key),U=A.find(Y),de=new Set(r.map(e=>e.auth_profile_slug)),pe=(N.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),he=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),q=m.data?.options.find(e=>e.kind==="local"),K=m.isError||m.data?.cloud_status==="unavailable",d=[],G=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:Y(e)?"Default":void 0,canLead:!!U||A.length===1}),T=u?A:U?[U]:[],V=U??(T.length===1?T[0]:void 0);V&&d.push(G(V));for(const e of he)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});_&&q?.configured&&q.url&&d.push({key:"install",kind:"link",href:Ae(q.url,{installShape:_.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of T)e!==V&&d.push(G(e));for(const e of pe){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||M.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:_?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,h=d.find(e=>e.canLead)??(d.length?void 0:me),J=e=>p.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,x):[]})),H=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):J(e.slug);else if(e.kind==="account"){const{profile:i}=e;p.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):P.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},Z=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>H(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===h?[]:d,ee=!!(u&&o),Q=z.length>0||K||ee&&(d.length>0||a.length>0),se=s.jsxs(Ce,{align:"end",className:"w-72",children:[z.length?s.jsx(_e,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=Z(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>H(e),children:i},e.key)}),K?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||K?s.jsx(Ne,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(X,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(f,{size:"sm",variant:h?"default":"outline",className:E(h&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":h?"More ways to connect":void 0,children:[h?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[h?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[h.kind==="new-app"||h.kind==="create"?s.jsx(X,{className:"size-3.5"}):null,h.button]}),i=Z(h,e);return s.jsx(f,{size:"sm",disabled:p.pending,className:E(Q&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>H(h),children:i??e})})(),Q?te:null]}),se]}):Q?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(f,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,p.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:p.error}):null,p.continueUrl?s.jsx("a",{href:p.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:b!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Me,{children:"Permissions"}),s.jsxs(Pe,{children:["Choose what ",t.name," may access."]})]}),s.jsx(Fe,{requiredScopes:$e(o),optionalScopes:ae(o),selectedOptionalScopes:x,onToggleOptionalScope:(e,i)=>F(L=>i?[...new Set([...L,e])]:L.filter(xe=>xe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(f,{size:"sm",disabled:p.pending,onClick:()=>{const e=b;y(null),e&&J(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),v=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(Ye,{connector:t,oauthMethod:c,appProfiles:(v.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void v.refetch()}):null}function Ye({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:v}){const u=ze(),C=Ie(),[M,o]=I(n.key,t&&c),[_,N]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Be()}/connect/oauth/callback`,[S,P]=I(n.key,`${n.name} OAuth App`),[p,O]=I(n.key,""),[D,b]=I(n.key,null),y=Ee(r),x=qe(`${n.key}:${M}`,Ke(y),y),{values:F,setValues:$}=x,k=g.find(a=>B(a,n.key)),R=()=>{x.canSubmit&&(b(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:p.trim()||void 0,credentials:Je(Xe(F))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&C.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),P(`${n.name} OAuth App`),O(""),v()},onError:a=>{b(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(W,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>N(!0)).catch(()=>b("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(Te,{className:"mr-1.5 h-3.5 w-3.5"}),_?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:E(Ve,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),B(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Ge,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!B(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(f,{variant:"outline",size:"sm",disabled:C.isPending,onClick:()=>C.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?M?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>P(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(W,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:p,onChange:a=>O(a.target.value)})]}),s.jsx(He,{schema:x.revision??void 0,values:F,onValuesChange:$,fieldIdPrefix:"oauth-app-"}),s.jsx(Qe,{visible:x.hasConflict,onReload:x.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(f,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(f,{size:"sm",disabled:u.isPending||!x.canSubmit,onClick:R,children:[u.isPending?s.jsx(We,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(X,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function B(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Ge({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:E("text-xs",l),children:["· ",t]})}function Je(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Ge as A,es as C,ss as O};
2
+ //# sourceMappingURL=connect-menu-CezOH3s7.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as o}from"./index-BjcZVe7n.js";const n=()=>t.jsx(o,{});export{n as component};
2
+ //# sourceMappingURL=connect-zUot_0kG.js.map
@@ -0,0 +1,2 @@
1
+ import{j0 as n,j as t,az as a}from"./index-BjcZVe7n.js";import{a as i}from"./agent-connect-pages-Br_ycC0z.js";import"./agent-client-setup-list-CpUTAjXf.js";import"./connector-page-shell-Di6XzkVo.js";import"./copy-button-Ddf7lBjZ.js";import"./clients-Cmp0LmOp.js";import"./client-rows-x_CxeWkP.js";function l(){const{owner:o,clientId:e}=n.useParams();return t.jsx(a,{owner:o,children:({ownerSlug:r})=>t.jsx(i,{owner:r,clientId:e})})}export{l as component};
2
+ //# sourceMappingURL=connect._clientId-nsGxe6yO.js.map
@@ -0,0 +1,2 @@
1
+ import{j as t,O as n}from"./index-BjcZVe7n.js";function e(){return t.jsx(n,{})}export{e as component};
2
+ //# sourceMappingURL=connected._clientId-DnclRRXk.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,ak as w,az as N,r as y,gS as p,gT as x,L as r,gU as o,F as _,ed as j,b2 as L,dw as A,B as $,A as k,je as g}from"./index-BjcZVe7n.js";import{C as u}from"./connector-page-shell-Di6XzkVo.js";import{E as B}from"./events-feed-CGzA1w3R.js";import{u as E}from"./client-activity-scopes-BD2HBo-_.js";import{u as P}from"./clients-Cmp0LmOp.js";import{g as S,c as R}from"./client-rows-x_CxeWkP.js";import"./event-card-CjA_dLzq.js";import"./definition-comparison-B5WgZILB.js";import"./automation-source-list-Dhucq1sI.js";import"./schema-value-BFb7jCBo.js";import"./json-diff-DtZtra_g.js";import"./index-Vcq4gwWv.js";import"./run-initiator-CCxNv0rK.js";import"./use-automations-D9hKpufo.js";import"./renderer-CHPS-1vD.js";import"./card-g4yxo4Hr.js";import"./table-DALHuXPE.js";import"./change-summary-DeuXQEpb.js";import"./copy-button-Ddf7lBjZ.js";import"./agent-list-row-BnP6r4pm.js";import"./automation-row-B5Q1B10y.js";import"./model-C2q7WDcS.js";import"./connection-label-BobuYiAG.js";import"./use-scroll-sentinel-BWCrmNIB.js";const T="gap-3 pt-2.5 pb-8";function D({owner:s,clientId:a,mcpActivityId:t}){return e.jsx(w,{className:T,children:e.jsx(N,{owner:s,children:({organizationId:n,ownerSlug:m})=>e.jsx(O,{ownerSlug:m,organizationId:n,clientId:a,mcpActivityId:t})})})}function O({ownerSlug:s,organizationId:a,clientId:t,mcpActivityId:n}){const{data:m=[],isLoading:f}=P(null),i=y.useMemo(()=>S(m).find(h=>h.clientIds.includes(t)),[t,m]),l=i?.clientIds??[],{data:C=[],isLoading:b}=E({enabled:!!i&&!!a,limit:100,clientIds:l,organizationId:a}),c=n?C.find(h=>h.activityId===n)??null:null,d=i?.title??"Connected agent",v=c?R(c):"Conversation";return!a||f||n&&b?e.jsx(u,{header:e.jsx(p,{breadcrumb:e.jsx(x,{crumbs:[e.jsx(r,{to:"/$owner/agents",params:{owner:s},className:o,children:"Agents"},"agents")]}),title:"Conversation"}),children:e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"Loading…"})}):n&&(!i||!c||c.organizationId===null)?e.jsx(_,{to:"/$owner/events",params:{owner:"me"},search:{client_ids:i?l.join(","):t,mcp_activity_id:n},replace:!0}):i?n?e.jsx(u,{header:e.jsx(p,{breadcrumb:e.jsx(x,{crumbs:[e.jsx(r,{to:"/$owner/agents",params:{owner:s},className:o,children:"Agents"},"agents"),e.jsx(r,{to:"/$owner/agents/connected/$clientId",params:{owner:s,clientId:t},className:o,children:d},"app")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(j,{name:c?.clientName??d})}),title:v,meta:e.jsx($,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(r,{to:"/$owner/events",params:{owner:s},search:{client_ids:l.join(","),mcp_activity_id:n},children:["See in Activity",e.jsx(k,{className:"h-3.5 w-3.5"})]})})}),children:e.jsx(B,{organizationId:a,ownerSlug:s,filters:{clientIds:l,mcpActivityId:n,sortBy:"date",sortOrder:"desc"},hideOriginator:!0,foldConsecutiveCalls:!0,emptyState:e.jsx(L,{icon:A,title:"No activity in this conversation yet",description:"Calls this app makes will appear here."})})}):e.jsx(u,{header:e.jsx(p,{breadcrumb:e.jsx(x,{crumbs:[e.jsx(r,{to:"/$owner/agents",params:{owner:s},className:o,children:"Agents"},"agents"),e.jsx(r,{to:"/$owner/agents/connected/$clientId",params:{owner:s,clientId:t},className:o,children:d},"app")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(j,{name:d})}),title:"Conversation"}),children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a conversation on this app's page to see its activity."})}):e.jsx(u,{header:e.jsx(p,{breadcrumb:e.jsx(x,{crumbs:[e.jsx(r,{to:"/$owner/agents",params:{owner:s},className:o,children:"Agents"},"agents")]}),title:"Conversation"}),children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its activity isn't available."})})}function ce(){const{owner:s,clientId:a}=g.useParams(),t=g.useSearch();return e.jsx(D,{owner:s,clientId:a,mcpActivityId:typeof t.mcp_activity_id=="string"?t.mcp_activity_id:null})}export{ce as component};
2
+ //# sourceMappingURL=connected._clientId.activity-CDB8atTX.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,V as R,c as $,L as N,ek as E,A as M,v as _,eI as D,r as u,S as I,cR as H,cH as K,gl as y,B as f,ab as G,ak as O,gS as Q,ed as V,gT as W,gU as q,j7 as F,az as J}from"./index-BjcZVe7n.js";import{T as X,a as Y,b as S,c as d,d as Z,e as x}from"./table-DALHuXPE.js";import{c as w,g as P}from"./client-rows-x_CxeWkP.js";import{u as A}from"./client-activity-scopes-BD2HBo-_.js";import{u as T,a as ee}from"./clients-Cmp0LmOp.js";import{C as se}from"./connector-page-shell-Di6XzkVo.js";function te({isLive:n}){return e.jsx(R,{variant:n?"default":"secondary",className:`shrink-0 text-[10px] ${n?"":"text-muted-foreground"}`,title:n?"Live MCP transport":"No live MCP transport; activity history is retained",children:n?"Active":"Ended"})}function L({scopes:n,ownerSlug:i}){const l=$(),o=s=>s.organizationId===null?{to:"/$owner/events",params:{owner:"me"},search:{client_ids:s.clientId,mcp_activity_id:s.activityId}}:{to:"/$owner/agents/connected/$clientId/activity",params:{owner:i,clientId:s.clientId},search:{mcp_activity_id:s.activityId}},r=s=>{l(o(s))};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(S,{children:[e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(d,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(Z,{children:n.map(s=>e.jsxs(S,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>r(s),children:[e.jsx(x,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{...o(s),onClick:c=>c.stopPropagation(),className:"truncate hover:underline",children:w(s)}),s.activityKind==="session"?e.jsx(te,{isLive:s.isLive}):null,s.unreadNotificationCount>0?e.jsxs(R,{variant:"secondary",className:"shrink-0 text-[10px]",children:[s.unreadNotificationCount," unread"]}):null]})}),e.jsx(x,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:s.callCount}),e.jsx(x,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:s.lastAction||"—"}),e.jsx(x,{className:"px-3 py-2 text-xs text-muted-foreground",children:E(s.lastCallAt)}),e.jsx(x,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${w(s)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx(M,{className:"h-3.5 w-3.5"})})})]},`${s.clientId}:${s.activityId}`))})]})})}function ne({ownerSlug:n,clientId:i}){const{orgContext:l}=_(),{isAdmin:o}=D(l.organizationId),{data:r=[],isLoading:s}=T(null),c=ee(),[z,h]=u.useState(!1),t=u.useMemo(()=>P(r),[r]).find(a=>a.clientIds.includes(i)),b=t?.clientIds??[],g=A({enabled:!!t,limit:100,clientIds:b,activityKind:"conversation",organizationId:l?.organizationId??null}),p=A({enabled:!!t,limit:100,clientIds:b,activityKind:"session",organizationId:l?.organizationId??null,refetchInterval:a=>a?5e3:!1}),m=g.data??[],v=p.data??[],B=u.useMemo(()=>r.filter(a=>t?.clientIds.includes(a.id)),[r,t]);if(s)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-16 w-full rounded-lg"}),e.jsx(I,{className:"h-24 w-full rounded-lg"})]});if(!t)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=B[0],C=j?.details?.redirectUris??[],k=t.linkedUserEntitySlug?H(n,[{entity_type:"$member",slug:t.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:t.title},{label:t.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:t.clientIds.map(a=>e.jsx("code",{className:"block break-all",children:a},a))})},...t.drivenBy&&t.drivenBy!==t.title?[{label:"Driven by",value:t.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:k&&t.linkedUser?e.jsx(N,{to:k,className:"font-medium text-primary hover:underline",children:t.linkedUser}):t.linkedUser??"—"},{label:"Last active",value:t.connected?K(t.lastSeenAt):"disconnected"},{label:"Registrations",value:String(t.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(y,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:a.value})]},a.label))})}),o&&t.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",t.clientIds.length>1?` (${t.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),z?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:c.isPending,onClick:()=>c.mutate({clientId:t.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:c.isPending?"Revoking…":"Confirm revoke"}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:c.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(f,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(y,{title:"Conversations",count:m.length>0?String(m.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(G,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):m.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(L,{scopes:m,ownerSlug:n})}),v.length>0?e.jsx(y,{title:"Sessions",count:String(v.length),children:e.jsx(L,{scopes:v,ownerSlug:n})}):null]})}function ae({owner:n,clientId:i}){const{data:l=[]}=T(null),r=u.useMemo(()=>P(l).find(s=>s.clientIds.includes(i)),[i,l])?.title??"Connected agent";return e.jsx(O,{className:"gap-3 pt-2.5 pb-8",children:e.jsx(se,{header:e.jsx(Q,{breadcrumb:e.jsx(W,{crumbs:[e.jsx(N,{to:"/$owner/agents",params:{owner:n},className:q,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(V,{name:r})}),title:r,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:n,clientId:i},i)})})}function me(){const{owner:n,clientId:i}=F.useParams();return e.jsx(J,{owner:n,children:({ownerSlug:l})=>e.jsx(ae,{owner:l,clientId:i})})}export{me as component};
2
+ //# sourceMappingURL=connected._clientId.index-DBNP2mZo.js.map