@lobu/runtime-server 24.3.0 → 24.5.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 (290) hide show
  1. package/dist/catalogs/skills.json +2 -2
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/postgres.ts +77 -48
  4. package/dist/db/migrations/20261101010000_public_source_type_references.sql +157 -0
  5. package/dist/dependencies.bun.lock +115 -144
  6. package/dist/owletto/dist/assets/_-CCWuGXtQ.js +2 -0
  7. package/dist/owletto/dist/assets/_-DOJW1D-I.js +3 -0
  8. package/dist/owletto/dist/assets/_agentId-CJhQbi6k.js +2 -0
  9. package/dist/owletto/dist/assets/_agentId-DD4K1i6V.js +2 -0
  10. package/dist/owletto/dist/assets/_automationId-Cbd7B0mP.js +2 -0
  11. package/dist/owletto/dist/assets/_connectorKey._connectionId-DFpPep9B.js +2 -0
  12. package/dist/owletto/dist/assets/_connectorKey.index-n3iSDT74.js +2 -0
  13. package/dist/owletto/dist/assets/_conversationId-B1yGIGA9.js +2 -0
  14. package/dist/owletto/dist/assets/_eventId-B1H0-vD7.js +2 -0
  15. package/dist/owletto/dist/assets/_name-D30_V03t.js +2 -0
  16. package/dist/owletto/dist/assets/_owner-Be8O41u8.js +3 -0
  17. package/dist/owletto/dist/assets/_shape-C6YbloRh.js +2 -0
  18. package/dist/owletto/dist/assets/_skillKey-BMPvvoOI.js +2 -0
  19. package/dist/owletto/dist/assets/_slug-Bc4YIEA2.js +2 -0
  20. package/dist/owletto/dist/assets/_view-aoFDwEld.js +2 -0
  21. package/dist/owletto/dist/assets/_viewKey-DuNHc3cc.js +2 -0
  22. package/dist/owletto/dist/assets/_viewKey-rJ7A1zNx.js +2 -0
  23. package/dist/owletto/dist/assets/accept-invitation-pUl-c1KQ.js +2 -0
  24. package/dist/owletto/dist/assets/activity-route-view-DN0ZEAzr.js +2 -0
  25. package/dist/owletto/dist/assets/{agent-card-controls-DiU7Un5w.js → agent-card-controls-C5jNWgfq.js} +2 -2
  26. package/dist/owletto/dist/assets/agent-client-setup-list-DbXtJTsO.js +4 -0
  27. package/dist/owletto/dist/assets/agent-connect-pages-DcTuiSt9.js +2 -0
  28. package/dist/owletto/dist/assets/agent-editor-form-CdA5vLr8.js +2 -0
  29. package/dist/owletto/dist/assets/agent-guardrails-route-BJyfalBY.js +2 -0
  30. package/dist/owletto/dist/assets/agent-list-row-rF5LH-3k.js +2 -0
  31. package/dist/owletto/dist/assets/{agent-loading-shells-CamDtzHY.js → agent-loading-shells-ClY_O6lb.js} +2 -2
  32. package/dist/owletto/dist/assets/{agent-permissions-matrix-CgsQ8BK_.js → agent-permissions-matrix-bP1Qihv7.js} +2 -2
  33. package/dist/owletto/dist/assets/{agent-skill-context-lWbXKEm1.js → agent-skill-context-BAaGpvfS.js} +2 -2
  34. package/dist/owletto/dist/assets/agent-skills-route-Bv5luNdw.js +2 -0
  35. package/dist/owletto/dist/assets/agent-tab-intro-ednTs4WF.js +2 -0
  36. package/dist/owletto/dist/assets/agent-thread-WNk2HapT.js +6 -0
  37. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +2 -0
  38. package/dist/owletto/dist/assets/agents-DY2S2SGE.js +2 -0
  39. package/dist/owletto/dist/assets/agents-workbench-bPTjdVS1.js +2 -0
  40. package/dist/owletto/dist/assets/app._appId-DrL5H5lB.js +2 -0
  41. package/dist/owletto/dist/assets/assist-composer-ClfFEVx7.js +2 -0
  42. package/dist/owletto/dist/assets/automation-detail-content-dFy1Huas.js +2 -0
  43. package/dist/owletto/dist/assets/automation-row-DCHM--aD.js +2 -0
  44. package/dist/owletto/dist/assets/automations-DY2S2SGE.js +2 -0
  45. package/dist/owletto/dist/assets/{calendar-DDCCSPW6.js → calendar-Ck0yOLYu.js} +2 -2
  46. package/dist/owletto/dist/assets/{callback-DFciMR8u.js → callback-DRABUOha.js} +2 -2
  47. package/dist/owletto/dist/assets/{card-BCsbrdGs.js → card-Bdi7VEwo.js} +2 -2
  48. package/dist/owletto/dist/assets/change-summary-PBoM6Asb.js +2 -0
  49. package/dist/owletto/dist/assets/{claim-BRua2b_7.js → claim-CUIG1Oc-.js} +2 -2
  50. package/dist/owletto/dist/assets/client-activity-scopes-CXOWB5co.js +2 -0
  51. package/dist/owletto/dist/assets/{client-rows-DiJQ5D1z.js → client-rows-36VnmgMK.js} +2 -2
  52. package/dist/owletto/dist/assets/clients-BJRcMk1A.js +2 -0
  53. package/dist/owletto/dist/assets/code-editor-DNuRKde1.js +16 -0
  54. package/dist/owletto/dist/assets/connect-CMcEQWls.js +2 -0
  55. package/dist/owletto/dist/assets/connect-menu-C-B-1xGR.js +2 -0
  56. package/dist/owletto/dist/assets/connect._clientId-tGipxP5a.js +2 -0
  57. package/dist/owletto/dist/assets/connected._clientId-DSGU78eV.js +2 -0
  58. package/dist/owletto/dist/assets/connected._clientId.activity-CPLbry8R.js +2 -0
  59. package/dist/owletto/dist/assets/connected._clientId.index-jSnGvzYs.js +2 -0
  60. package/dist/owletto/dist/assets/connection-feed-detail-BIlkK0Pd.js +2 -0
  61. package/dist/owletto/dist/assets/connection-q1bdnxCN.js +2 -0
  62. package/dist/owletto/dist/assets/{connections-browser-BMV8bf54.js → connections-browser-V-3td9DB.js} +2 -2
  63. package/dist/owletto/dist/assets/{connector-boxes-DqZA-FdG.js → connector-boxes-lFc-WP83.js} +2 -2
  64. package/dist/owletto/dist/assets/connector-page-shell-Cs1SjrYB.js +2 -0
  65. package/dist/owletto/dist/assets/{connector-provenance-BIg8P8WY.js → connector-provenance-aJFeeRIC.js} +2 -2
  66. package/dist/owletto/dist/assets/{connector-scope-lists-CJYz53YF.js → connector-scope-lists--vNdbOn0.js} +2 -2
  67. package/dist/owletto/dist/assets/connectors-BsvDMdsQ.js +2 -0
  68. package/dist/owletto/dist/assets/consent-DJV78pnz.js +2 -0
  69. package/dist/owletto/dist/assets/copy-button-DjMWgrBf.js +2 -0
  70. package/dist/owletto/dist/assets/{core.esm-A1UnFbGs.js → core.esm-CQzL3ObT.js} +3 -3
  71. package/dist/owletto/dist/assets/create-BmKx5vq3.js +2 -0
  72. package/dist/owletto/dist/assets/create-Rt0RbiD4.js +2 -0
  73. package/dist/owletto/dist/assets/create-automation-form-PEmSLMD6.js +3 -0
  74. package/dist/owletto/dist/assets/create-jBEuveV1.js +2 -0
  75. package/dist/owletto/dist/assets/create._connectorKey-DcxhYIYC.js +2 -0
  76. package/dist/owletto/dist/assets/device-Ba3RsIgb.js +2 -0
  77. package/dist/owletto/dist/assets/device-pin-tombstone-C79KIAIK.js +2 -0
  78. package/dist/owletto/dist/assets/device._deviceId-CIaoq9co.js +2 -0
  79. package/dist/owletto/dist/assets/{entity-avatar-CEV4ttUQ.js → entity-avatar-TVKjZxWQ.js} +2 -2
  80. package/dist/owletto/dist/assets/entity-options-daOOQo7O.js +2 -0
  81. package/dist/owletto/dist/assets/entity-page-BfJXvbxn.js +2 -0
  82. package/dist/owletto/dist/assets/entity-type-page-BLwH6qa7.js +2 -0
  83. package/dist/owletto/dist/assets/event-card-DVUB8my6.js +2 -0
  84. package/dist/owletto/dist/assets/event-detail-DkY95e5b.js +2 -0
  85. package/dist/owletto/dist/assets/{events-feed-VfU4csn2.js → events-feed-B9CZHI_P.js} +2 -2
  86. package/dist/owletto/dist/assets/filter-bar-wPaR12SS.js +2 -0
  87. package/dist/owletto/dist/assets/{full-page-spinner-C1Q_jEzD.js → full-page-spinner-BqmckkOf.js} +2 -2
  88. package/dist/owletto/dist/assets/guardrails-Csusrok2.js +2 -0
  89. package/dist/owletto/dist/assets/identity-Dmg3STO8.js +2 -0
  90. package/dist/owletto/dist/assets/index--ZWegctR.js +2 -0
  91. package/dist/owletto/dist/assets/{index-DFyBbp7b.js → index-B0kw2lFL.js} +2 -2
  92. package/dist/owletto/dist/assets/index-BKrdVwW9.js +2 -0
  93. package/dist/owletto/dist/assets/index-BUBcNNUY.js +2 -0
  94. package/dist/owletto/dist/assets/index-BUDr4-Yv.js +2 -0
  95. package/dist/owletto/dist/assets/index-BYPQWVwD.js +2 -0
  96. package/dist/owletto/dist/assets/index-BfpaPJPj.js +2 -0
  97. package/dist/owletto/dist/assets/index-BicNFLBW.js +2 -0
  98. package/dist/owletto/dist/assets/index-Bsdv5aks.js +2 -0
  99. package/dist/owletto/dist/assets/index-C186T2Rw.js +53 -0
  100. package/dist/owletto/dist/assets/index-CX0pJ9j9.js +2 -0
  101. package/dist/owletto/dist/assets/{index-DQxzeM37.js → index-CsrT07TJ.js} +2 -2
  102. package/dist/owletto/dist/assets/index-DdBTTN3y.js +7899 -0
  103. package/dist/owletto/dist/assets/index-DdYWarql.css +1 -0
  104. package/dist/owletto/dist/assets/index-JYEIN8nM.js +2 -0
  105. package/dist/owletto/dist/assets/index-Vcq4gwWv.js +2 -0
  106. package/dist/owletto/dist/assets/{index-DNtYqkiA.js → index-ijqrJaRB.js} +2 -2
  107. package/dist/owletto/dist/assets/{index-yIub2xUM.js → index-ikp_mTsf.js} +2 -2
  108. package/dist/owletto/dist/assets/json-diff-BaLL4Fsu.js +14 -0
  109. package/dist/owletto/dist/assets/{list-skeleton-Kzxi2OXB.js → list-skeleton-CXDLkYTg.js} +2 -2
  110. package/dist/owletto/dist/assets/login-u6LCgDYG.js +2 -0
  111. package/dist/owletto/dist/assets/{logout-Dt_VDilG.js → logout-JhmuWJEH.js} +2 -2
  112. package/dist/owletto/dist/assets/manage-gear-D8LMhehh.js +2 -0
  113. package/dist/owletto/dist/assets/{member-scope-gate-De75CR7W.js → member-scope-gate-4FQ0aanZ.js} +2 -2
  114. package/dist/owletto/dist/assets/memory-browse-page-CNZJbCJC.js +74 -0
  115. package/dist/owletto/dist/assets/model-jL871x2J.js +2 -0
  116. package/dist/owletto/dist/assets/model-selector-CgU8SJMF.js +2 -0
  117. package/dist/owletto/dist/assets/models-jdemgIZk.js +2 -0
  118. package/dist/owletto/dist/assets/nav-pill-DrFkuyUQ.js +2 -0
  119. package/dist/owletto/dist/assets/new-CcJOd5aH.js +2 -0
  120. package/dist/owletto/dist/assets/{new-BbdwuJPm.js → new-DgE1pVV0.js} +2 -2
  121. package/dist/owletto/dist/assets/new-OWwrYckd.js +2 -0
  122. package/dist/owletto/dist/assets/organization-CKM_oFX3.js +2 -0
  123. package/dist/owletto/dist/assets/peek-pane-content-D68BjguQ.js +2 -0
  124. package/dist/owletto/dist/assets/pending-seed-sml8Uf6e.js +2 -0
  125. package/dist/owletto/dist/assets/permissions-BvA9SATv.js +2 -0
  126. package/dist/owletto/dist/assets/proposal-review-shell-D6KABxah.js +2 -0
  127. package/dist/owletto/dist/assets/public-shell-ready-BIVCHQHe.js +2 -0
  128. package/dist/owletto/dist/assets/record-activity-C9gVBbF0.js +2 -0
  129. package/dist/owletto/dist/assets/{record-session-D07szzqN.js → record-session-R-uHNuby.js} +2 -2
  130. package/dist/owletto/dist/assets/{renderer-AJxSmE3-.js → renderer-DXfJaCCa.js} +23 -23
  131. package/dist/owletto/dist/assets/reset-password-Mx3baeNc.js +2 -0
  132. package/dist/owletto/dist/assets/run-activity-link-CaIBSRQj.js +2 -0
  133. package/dist/owletto/dist/assets/run-initiator-BvzQJYW9.js +2 -0
  134. package/dist/owletto/dist/assets/runs-fFJ1lPnw.js +2 -0
  135. package/dist/owletto/dist/assets/runs-panel-DEnZHTa5.js +2 -0
  136. package/dist/owletto/dist/assets/runs-table-XGnxJl7S.js +2 -0
  137. package/dist/owletto/dist/assets/{schema-type-editor-panel-C_Es0qDf.js → schema-type-editor-panel-C0_9VcSs.js} +2 -2
  138. package/dist/owletto/dist/assets/settings-CP4PjMQA.js +2 -0
  139. package/dist/owletto/dist/assets/settings-CgaUJMHH.js +2 -0
  140. package/dist/owletto/dist/assets/skills-D-e_h3a9.js +2 -0
  141. package/dist/owletto/dist/assets/{source-record-panels-CjFPgKKJ.js → source-record-panels-Bh0n4gGw.js} +2 -2
  142. package/dist/owletto/dist/assets/{status-dot-CSBtKT4g.js → status-dot-Cpq63I7p.js} +2 -2
  143. package/dist/owletto/dist/assets/{table-DHM-vCxP.js → table-BUqshjxa.js} +2 -2
  144. package/dist/owletto/dist/assets/{use-automations-C4TSie1i.js → use-automations-BLNjxq2K.js} +2 -2
  145. package/dist/owletto/dist/assets/use-login-redirect-CmyQW7GT.js +2 -0
  146. package/dist/owletto/dist/assets/{use-mention-search-PfZrNbu_.js → use-mention-search-dn3ws1WB.js} +3 -3
  147. package/dist/owletto/dist/assets/use-scroll-sentinel-DRyBMueA.js +2 -0
  148. package/dist/owletto/dist/assets/view-param-filters-CER47Tlz.js +2 -0
  149. package/dist/owletto/dist/assets/{views-access-required-2ubIf_3N.js → views-access-required-C_b9itZ2.js} +2 -2
  150. package/dist/owletto/dist/index.html +2 -2
  151. package/dist/server-main.bundle.mjs +54218 -51082
  152. package/dist/server.bundle.mjs +5 -5
  153. package/dist/verify.mjs +1 -1
  154. package/npm-shrinkwrap.json +351 -371
  155. package/package.json +3 -4
  156. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +8 -2
  157. package/vendor/connector-sdk/dist/reaction-sdk.d.ts +5 -1
  158. package/vendor/connector-sdk/package.json +1 -1
  159. package/vendor/core/dist/contracts/agent-settings.d.ts +61 -6
  160. package/vendor/core/dist/contracts/agent-settings.js +10 -7
  161. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +473 -98
  162. package/vendor/core/dist/contracts/tools/manage-agents.js +111 -2
  163. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +21 -18
  164. package/vendor/core/dist/contracts/tools/manage-automations.js +15 -15
  165. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
  166. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +45 -20
  167. package/vendor/core/dist/contracts/tools/manage-entity.js +17 -5
  168. package/vendor/core/dist/contracts/tools/manage-inference-providers.d.ts +445 -0
  169. package/vendor/core/dist/contracts/tools/manage-inference-providers.js +133 -0
  170. package/vendor/core/dist/contracts/tools/manage-views.d.ts +4 -4
  171. package/vendor/core/dist/contracts/tools/manage-views.js +5 -3
  172. package/vendor/core/dist/contracts/worker/device-automation.js +4 -2
  173. package/vendor/core/dist/error-report.d.ts +73 -0
  174. package/vendor/core/dist/error-report.js +346 -0
  175. package/vendor/core/dist/index.d.ts +4 -1
  176. package/vendor/core/dist/index.js +7 -1
  177. package/vendor/core/dist/logger.js +15 -6
  178. package/vendor/core/dist/otel-fetch.d.ts +19 -0
  179. package/vendor/core/dist/otel-fetch.js +96 -0
  180. package/vendor/core/dist/otel.d.ts +22 -2
  181. package/vendor/core/dist/otel.js +95 -48
  182. package/vendor/core/dist/reserved.d.ts +1 -1
  183. package/vendor/core/dist/reserved.js +6 -4
  184. package/vendor/core/dist/tool-result.d.ts +8 -0
  185. package/vendor/core/dist/tool-result.js +61 -0
  186. package/vendor/core/dist/trace-context.d.ts +12 -0
  187. package/vendor/core/dist/trace-context.js +50 -0
  188. package/vendor/core/dist/utils/diagnostic-scrubber.js +1 -1
  189. package/vendor/core/dist/worker/auth.js +4 -0
  190. package/vendor/core/package.json +6 -1
  191. package/vendor/views/package.json +1 -1
  192. package/dist/owletto/dist/assets/_-XKF0m81R.js +0 -3
  193. package/dist/owletto/dist/assets/_-e8MbEBtw.js +0 -2
  194. package/dist/owletto/dist/assets/_agentId-Cv9goIFf.js +0 -2
  195. package/dist/owletto/dist/assets/_agentId-emObu67X.js +0 -2
  196. package/dist/owletto/dist/assets/_automationId-CfFFAYK1.js +0 -2
  197. package/dist/owletto/dist/assets/_connectorKey._connectionId-D6NKXSOE.js +0 -2
  198. package/dist/owletto/dist/assets/_connectorKey.index-DFrkLLTU.js +0 -2
  199. package/dist/owletto/dist/assets/_conversationId-D3vuAQPe.js +0 -2
  200. package/dist/owletto/dist/assets/_eventId-BV5SQaUA.js +0 -2
  201. package/dist/owletto/dist/assets/_name-DjtJMop4.js +0 -2
  202. package/dist/owletto/dist/assets/_owner-oBX68rb9.js +0 -3
  203. package/dist/owletto/dist/assets/_shape-C4lLPAwI.js +0 -2
  204. package/dist/owletto/dist/assets/_skillKey-Cw-7q6hI.js +0 -2
  205. package/dist/owletto/dist/assets/_slug-B2g5qzn3.js +0 -2
  206. package/dist/owletto/dist/assets/_viewKey-CIKGCtdK.js +0 -2
  207. package/dist/owletto/dist/assets/_viewKey-Dx4kJo7o.js +0 -2
  208. package/dist/owletto/dist/assets/accept-invitation-38lHBvjO.js +0 -2
  209. package/dist/owletto/dist/assets/activity-route-view-voRYSM3a.js +0 -2
  210. package/dist/owletto/dist/assets/agent-client-setup-list-Bkyw22GW.js +0 -5
  211. package/dist/owletto/dist/assets/agent-connect-pages-CpBxQCpx.js +0 -2
  212. package/dist/owletto/dist/assets/agent-editor-form-QrIDroFL.js +0 -2
  213. package/dist/owletto/dist/assets/agent-guardrails-route-CyoGSxcZ.js +0 -2
  214. package/dist/owletto/dist/assets/agent-skills-route-D-w3tY_2.js +0 -2
  215. package/dist/owletto/dist/assets/agent-subpage-shell-CLqpn5Tb.js +0 -2
  216. package/dist/owletto/dist/assets/agent-thread-CsRexwTv.js +0 -6
  217. package/dist/owletto/dist/assets/agents-DzH_FFKU.js +0 -2
  218. package/dist/owletto/dist/assets/agents-workbench-CmGrMvPC.js +0 -2
  219. package/dist/owletto/dist/assets/app._appId-BO7G38fL.js +0 -2
  220. package/dist/owletto/dist/assets/automation-detail-content-DMYxs6F6.js +0 -2
  221. package/dist/owletto/dist/assets/automations-DzH_FFKU.js +0 -2
  222. package/dist/owletto/dist/assets/client-activity-scopes-BLIy1Zc3.js +0 -2
  223. package/dist/owletto/dist/assets/clients-8-EpRjsm.js +0 -2
  224. package/dist/owletto/dist/assets/code-editor-BFZa4EIt.js +0 -16
  225. package/dist/owletto/dist/assets/connect-C0cHE9Xl.js +0 -2
  226. package/dist/owletto/dist/assets/connect-menu-D2K4tmvW.js +0 -2
  227. package/dist/owletto/dist/assets/connect._clientId-D4EG5a0v.js +0 -2
  228. package/dist/owletto/dist/assets/connected._clientId-DhoCT6sT.js +0 -2
  229. package/dist/owletto/dist/assets/connected._clientId.activity-Dn4qw2Us.js +0 -2
  230. package/dist/owletto/dist/assets/connected._clientId.index-BTI5JXA3.js +0 -2
  231. package/dist/owletto/dist/assets/connection-X9VU9Ijm.js +0 -2
  232. package/dist/owletto/dist/assets/connection-feed-detail-B6ydKasK.js +0 -2
  233. package/dist/owletto/dist/assets/connectors-BroKpwhB.js +0 -2
  234. package/dist/owletto/dist/assets/consent-fzLN-Qy7.js +0 -2
  235. package/dist/owletto/dist/assets/copy-button-Df7QXE0w.js +0 -2
  236. package/dist/owletto/dist/assets/create-BjwsYarn.js +0 -2
  237. package/dist/owletto/dist/assets/create-Dzr4mlr0.js +0 -2
  238. package/dist/owletto/dist/assets/create-automation-form-DHW6OUoS.js +0 -3
  239. package/dist/owletto/dist/assets/create-c94SPL21.js +0 -2
  240. package/dist/owletto/dist/assets/create._connectorKey-DLLn2nej.js +0 -2
  241. package/dist/owletto/dist/assets/cronstrue-xxpD1P2-.js +0 -2
  242. package/dist/owletto/dist/assets/device-C3AEoL5c.js +0 -2
  243. package/dist/owletto/dist/assets/device-pin-tombstone-B_te59GE.js +0 -2
  244. package/dist/owletto/dist/assets/device._deviceId-ZU09qrot.js +0 -2
  245. package/dist/owletto/dist/assets/entity-options-DJv2EhVV.js +0 -2
  246. package/dist/owletto/dist/assets/entity-page-BUghWZ1s.js +0 -2
  247. package/dist/owletto/dist/assets/entity-type-page-Lf6ONdpf.js +0 -2
  248. package/dist/owletto/dist/assets/event-card-CBlsG32u.js +0 -2
  249. package/dist/owletto/dist/assets/event-detail-BKSGEOdW.js +0 -2
  250. package/dist/owletto/dist/assets/filter-bar-COU0sBFQ.js +0 -2
  251. package/dist/owletto/dist/assets/guardrails-6ZJv1uzM.js +0 -2
  252. package/dist/owletto/dist/assets/identity-BaFLmbSo.js +0 -2
  253. package/dist/owletto/dist/assets/index-008wj-Pz.js +0 -7950
  254. package/dist/owletto/dist/assets/index-BaetvYLa.js +0 -2
  255. package/dist/owletto/dist/assets/index-BiEf5xOE.css +0 -1
  256. package/dist/owletto/dist/assets/index-BrDP4PCs.js +0 -2
  257. package/dist/owletto/dist/assets/index-BuXIeK7D.js +0 -2
  258. package/dist/owletto/dist/assets/index-CAVcR9za.js +0 -2
  259. package/dist/owletto/dist/assets/index-CMLfWGPU.js +0 -2
  260. package/dist/owletto/dist/assets/index-D0YEYP7N.js +0 -2
  261. package/dist/owletto/dist/assets/index-DkO0nPex.js +0 -2
  262. package/dist/owletto/dist/assets/index-KlRId0g6.js +0 -2
  263. package/dist/owletto/dist/assets/index-Ywnqi4A6.js +0 -2
  264. package/dist/owletto/dist/assets/index-wHFQv1aT.js +0 -12
  265. package/dist/owletto/dist/assets/index-xnxhf3Op.js +0 -2
  266. package/dist/owletto/dist/assets/json-diff-LE_vNZrM.js +0 -4
  267. package/dist/owletto/dist/assets/login-DWOT6jtS.js +0 -2
  268. package/dist/owletto/dist/assets/memory-browse-page-p2vIbfkC.js +0 -74
  269. package/dist/owletto/dist/assets/model-selector-3l9lY50C.js +0 -2
  270. package/dist/owletto/dist/assets/model-udnQ_S43.js +0 -2
  271. package/dist/owletto/dist/assets/models-CQj7GIOp.js +0 -2
  272. package/dist/owletto/dist/assets/new-BOwIHkre.js +0 -2
  273. package/dist/owletto/dist/assets/new-DTuFCQhV.js +0 -2
  274. package/dist/owletto/dist/assets/oauth-workspace-access-QPo4YwRX.js +0 -2
  275. package/dist/owletto/dist/assets/organization-BDzjnqPf.js +0 -2
  276. package/dist/owletto/dist/assets/peek-pane-content-D7yt0PrA.js +0 -2
  277. package/dist/owletto/dist/assets/permissions-CfoY4WFY.js +0 -2
  278. package/dist/owletto/dist/assets/proposal-review-shell-CVkLnnKo.js +0 -2
  279. package/dist/owletto/dist/assets/public-shell-ready-DXUTTGGp.js +0 -2
  280. package/dist/owletto/dist/assets/record-activity-BXhvJbd9.js +0 -2
  281. package/dist/owletto/dist/assets/reset-password-kRYyQuTY.js +0 -2
  282. package/dist/owletto/dist/assets/runs-lG2ChtOt.js +0 -2
  283. package/dist/owletto/dist/assets/runs-panel-LnGpHCAQ.js +0 -2
  284. package/dist/owletto/dist/assets/settings-CEAOg7fr.js +0 -2
  285. package/dist/owletto/dist/assets/settings-gGYXbFfd.js +0 -2
  286. package/dist/owletto/dist/assets/skills-BOL5c_Tk.js +0 -2
  287. package/dist/owletto/dist/assets/use-scroll-sentinel-D-fJx_Md.js +0 -2
  288. package/dist/owletto/dist/assets/view-param-filters-DkX4YdDT.js +0 -2
  289. /package/vendor/@better-auth-kysely-adapter/{.bun-tag-abf95749a412716 → .bun-tag-654b3a002b271269} +0 -0
  290. /package/vendor/postgres/{.bun-tag-22d644c2873790db → .bun-tag-c81dacd34e959a7a} +0 -0
@@ -1,2 +0,0 @@
1
- import{j as e,t as W,f9 as me,fS as xe,fc as K,bF as ae,r as x,fa as he,fb as pe,dI as ge,dK as fe,B as f,d9 as V,dJ as je,H as C,bv as q,bw as P,bx as M,by as L,bz as R,I as T,a5 as ve,fi as Ne,fT as ye,V as Y,ej as be,X as $,cL as ne,C as re,W as we,b9 as le,fU as ie,fV as Se,bf as oe,fW as Ce,fK as ke,bW as Ee,bX as X,b_ as _e,ew as Re,bG as Te,fX as Oe,fY as De,h as G,L as Ae}from"./index-008wj-Pz.js";import{C as Fe,J as U}from"./json-diff-LE_vNZrM.js";import{C as ce}from"./code-editor-BFZa4EIt.js";function ze({entry:s}){return e.jsxs("div",{className:"relative pl-6 pb-6 last:pb-0",children:[e.jsx("div",{className:"absolute left-0 top-1.5 h-3 w-3 rounded-full border-2 border-border bg-background"}),e.jsx("div",{className:"absolute left-[5px] top-5 bottom-0 w-px bg-border last:hidden"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Fe,{operation:s.action,actor:s.actor,createdAt:s.created_at}),s.action==="update"&&e.jsx(U,{before:s.before_payload,after:s.after_payload}),s.action==="create"&&s.after_payload&&e.jsx(U,{before:null,after:s.after_payload}),s.action==="delete"&&s.before_payload&&e.jsx(U,{before:s.before_payload,after:null})]})]})}function qe({entityType:s}){const{orgContext:a}=W(),{data:c,isLoading:n}=me(a),{data:r}=xe(a),t=(c||[]).filter(m=>m.status==="active"),i=t.filter(m=>!m.organization_slug||m.organization_slug===a?.slug),o=i.filter(m=>m.purpose!==K),d=i.filter(m=>m.purpose===K),h=t.filter(m=>m.organization_slug&&m.organization_slug!==a?.slug);return e.jsx("div",{className:"space-y-4 py-4",children:n?e.jsx(ae,{label:"relationships",variant:"rows",rows:4}):e.jsxs(e.Fragment,{children:[e.jsx(B,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]}),d.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Managed by access control"}),e.jsx(B,{entityTypeSlug:s.slug,relationshipTypes:d,allEntityTypes:r||[],readOnly:!0})]}),h.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"From public catalogs"}),e.jsx(B,{entityTypeSlug:s.slug,relationshipTypes:h,allEntityTypes:r||[],readOnly:!0})]}),e.jsx(Le,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]})]})})}function B({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c,readOnly:n=!1}){return e.jsx("div",{className:"space-y-2",children:a.map(r=>e.jsx(Pe,{relationshipType:r,entityTypeSlug:s,allEntityTypes:c,readOnly:n},r.id))})}function Pe({relationshipType:s,entityTypeSlug:a,allEntityTypes:c,readOnly:n=!1}){const{orgContext:r}=W(),{data:t}=Ne(s.slug,r),i=ye(),o=(t||[]).filter(h=>h.source_entity_type_slug===a||h.target_entity_type_slug===a);if(o.length===0)return null;const d=new Map(c.map(h=>[h.slug,h.name]));return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:s.slug}),s.is_symmetric&&e.jsx(Y,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"symmetric"}),n&&e.jsx(Y,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"read-only"})]}),o.map(h=>e.jsx(Me,{rule:h,entityTypeSlug:a,entityTypeNameMap:d,onRemove:()=>i.mutate(h.id),isRemoving:i.isPending,readOnly:n},h.id))]})}function Me({rule:s,entityTypeSlug:a,entityTypeNameMap:c,onRemove:n,isRemoving:r,readOnly:t=!1}){const[i,o]=x.useState(!1),d=s.source_entity_type_slug===a,h=d?s.target_entity_type_slug:s.source_entity_type_slug,m=c.get(h)||h;return e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-3 rounded-md border border-border bg-muted/30 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:d?"this":m}),e.jsx(be,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:d?m:"this"}),t?null:i?e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsx(f,{variant:"destructive",size:"sm",className:"h-6 px-2 text-xs",onClick:n,disabled:r,children:r?"Removing...":"Remove"}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsx("div",{className:"ml-auto",children:e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>o(!0),disabled:r,children:e.jsx($,{className:"h-3 w-3"})})})]})}function Le({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c}){const{orgContext:n}=W(),r=c.filter(l=>!l.organization_slug||l.organization_slug===n?.slug),[t,i]=x.useState(!1),[o,d]=x.useState("existing"),[h,m]=x.useState(""),[S,N]=x.useState(""),[y,b]=x.useState("source"),[g,j]=x.useState(""),[k,E]=x.useState(""),[D,w]=x.useState(!1),[A,_]=x.useState(null),u=he(),p=pe(),v=()=>{d("existing"),m(""),N(""),b("source"),j(""),E(""),w(!1),_(null)},O=l=>{i(l),l||v()},F=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),J=async()=>{_(null);try{let l=h;if(o==="new"){if(!g.trim()){_("Name is required");return}const H=k.trim()||F(g);if(!H){_("Slug is required");return}l=(await u.mutateAsync({slug:H,name:g.trim(),is_symmetric:D})).relationship_type.slug}if(!l){_("Select a relationship type");return}if(!S){_("Select a target entity type");return}const I=y==="source"?s:S,ue=y==="source"?S:s;await p.mutateAsync({slug:l,source_entity_type_slug:I,target_entity_type_slug:ue}),O(!1)}catch(l){_(l instanceof Error?l.message:"An error occurred")}},z=u.isPending||p.isPending;return e.jsxs(ge,{open:t,onOpenChange:O,children:[e.jsx(fe,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",children:[e.jsx(V,{className:"h-3.5 w-3.5 mr-1.5"}),"Add Relationship Rule"]})}),e.jsx(je,{className:"w-80 p-4",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Relationship Type"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(f,{variant:o==="existing"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("existing"),children:"Existing"}),e.jsx(f,{variant:o==="new"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("new"),children:"Create New"})]})]}),o==="existing"?e.jsxs(q,{value:h,onValueChange:m,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select relationship type..."})}),e.jsxs(L,{children:[a.map(l=>e.jsx(R,{value:l.slug,children:l.name},l.slug)),a.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No relationship types yet. Create one."})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{placeholder:"Name (e.g. Integrates With)",className:"h-8 text-sm",value:g,onChange:l=>{j(l.target.value),k||E("")}}),e.jsx(T,{placeholder:g?F(g)||"slug":"Slug (auto-generated)",className:"h-8 text-sm",value:k,onChange:l=>E(l.target.value)}),e.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:l=>w(l.target.checked),className:"rounded"}),"Symmetric (A↔B = B↔A)"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Direction"}),e.jsxs(q,{value:y,onValueChange:l=>b(l),children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"source",children:"This type → other"}),e.jsx(R,{value:"target",children:"Other → this type"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{className:"text-xs",children:[y==="source"?"Target":"Source"," Entity Type"]}),e.jsxs(q,{value:S,onValueChange:N,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select entity type..."})}),e.jsx(L,{children:r.map(l=>e.jsxs(R,{value:l.slug,children:[l.icon?`${l.icon} `:"",l.name]},l.slug))})]})]}),A&&e.jsx("p",{className:"text-xs text-destructive",children:A}),e.jsx(f,{size:"sm",className:"w-full",onClick:J,disabled:z,children:z?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"mr-1.5"}),"Saving..."]}):"Add Rule"})]})})]})}function Ie({options:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const i=c.trim();i&&!s.includes(i)&&(a([...s,i]),n(""))},t=i=>{a(s.filter((o,d)=>d!==i))};return e.jsxs("div",{className:"space-y-2 pl-4 border-l-2 border-muted",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((i,o)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-sm px-2 py-0.5 rounded",children:[i,e.jsx("button",{type:"button",onClick:()=>t(o),className:"text-muted-foreground hover:text-foreground",children:e.jsx($,{className:"h-3 w-3"})})]},i))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),r())},placeholder:"Add option...",className:"h-7 text-sm"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(V,{className:"h-3 w-3"})})]})]})}const Ve=[{value:"string",label:"Text"},{value:"number",label:"Number"},{value:"integer",label:"Whole number"},{value:"boolean",label:"Yes/No"},{value:"enum",label:"Choice"}];function Je({examples:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const t=c.trim();t&&!s.includes(t)&&(a([...s,t]),n(""))};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((t,i)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-xs px-2 py-0.5 rounded",children:[t,e.jsx("button",{type:"button",onClick:()=>a(s.filter((o,d)=>d!==i)),className:"text-muted-foreground hover:text-foreground",children:e.jsx($,{className:"h-3 w-3"})})]},t))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:t=>n(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),r())},placeholder:"Add example...",className:"h-7 text-xs"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(V,{className:"h-3 w-3"})})]})]})}function Ue({field:s,onChange:a,onDelete:c}){const[n,r]=x.useState(!!(s.description||s.default||s.role||s.examples&&s.examples.length>0));return e.jsxs("div",{className:"rounded-md border border-border p-2.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!n),className:"text-muted-foreground hover:text-foreground shrink-0",children:n?e.jsx(ne,{className:"h-3.5 w-3.5"}):e.jsx(re,{className:"h-3.5 w-3.5"})}),e.jsx(T,{value:s.name,onChange:t=>a({...s,name:t.target.value}),placeholder:"Field name",className:"h-8 flex-1"}),e.jsxs(q,{value:s.type,onValueChange:t=>a({...s,type:t,enumOptions:t==="enum"?s.enumOptions||[]:void 0,role:t==="enum"||s.role!=="workflowState"?s.role:void 0}),children:[e.jsx(P,{className:"h-8 w-32",children:e.jsx(M,{})}),e.jsx(L,{children:Ve.map(t=>e.jsx(R,{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground whitespace-nowrap",children:[e.jsx(we,{checked:s.required,onCheckedChange:t=>a({...s,required:t===!0})}),e.jsx("span",{children:"Required"})]}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",onClick:c,children:e.jsx(le,{className:"h-3.5 w-3.5"})})]}),s.type==="enum"&&e.jsx("div",{className:"pl-6",children:e.jsx(Ie,{options:s.enumOptions||[],onChange:t=>a({...s,enumOptions:t})})}),n&&e.jsxs("div",{className:"pl-6 space-y-2 pt-1",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Description"}),e.jsx(T,{value:s.description||"",onChange:t=>a({...s,description:t.target.value||void 0}),placeholder:"Field description",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default"}),e.jsx(T,{value:s.default||"",onChange:t=>a({...s,default:t.target.value||void 0}),placeholder:s.type==="boolean"?"true / false":"Default value",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"View role"}),e.jsxs(q,{value:s.role||"none",onValueChange:t=>a({...s,role:t==="workflowState"||t==="sortRank"?t:void 0}),children:[e.jsx(P,{className:"h-7 text-xs mt-0.5",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"none",children:"None"}),e.jsx(R,{value:"workflowState",disabled:s.type!=="enum",children:"Workflow state (board)"}),e.jsx(R,{value:"sortRank",children:"Sort rank"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Examples"}),e.jsx("div",{className:"mt-0.5",children:e.jsx(Je,{examples:s.examples||[],onChange:t=>a({...s,examples:t.length>0?t:void 0})})})]})]})]})}function Q({value:s,onChange:a,readonly:c,error:n}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{value:s,onChange:a,readonly:c,placeholder:'{ "type": "object", "properties": {} }',minHeight:"200px"}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n})]})}function Z(s){if(s.type!=="object")return!1;const a=s.properties;if(!a||typeof a!="object")return Object.keys(s).length<=1;for(const c of Object.values(a)){if(!c||typeof c!="object")return!1;const n=c,r=n.type;if(!n.enum&&(!r||!["string","number","integer","boolean"].includes(r)||n.properties||n.items||n.allOf||n.oneOf||n.anyOf))return!1}return!0}function de(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`field-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ee(s){const a=s.properties||{},c=s.required||[];return Object.entries(a).map(([n,r])=>{const t=r["x-lobu"]?.role||r["x-lobu-role"],i=t==="workflowState"?"workflowState":t==="sortRank"?"sortRank":void 0,o={id:de(),name:n,required:c.includes(n),description:r.description||void 0,default:r.default!==void 0?String(r.default):void 0,examples:Array.isArray(r.examples)?r.examples.map(String):void 0,role:i};return r.enum?{...o,type:"enum",enumOptions:r.enum||[]}:{...o,type:r.type||"string"}})}function se(s,a){if(a==="number"||a==="integer"){const c=Number(s);return Number.isNaN(c)?s:c}return a==="boolean"?s==="true"?!0:s==="false"?!1:s:s}function Be(s,a="auto"){const c={},n=[];for(const t of s){if(!t.name.trim())continue;const i={};t.type==="enum"?i.enum=t.enumOptions||[]:i.type=t.type,t.description?.trim()&&(i.description=t.description.trim()),t.default!==void 0&&t.default!==""&&(i.default=se(t.default,t.type)),t.examples&&t.examples.length>0&&(i.examples=t.examples.map(o=>se(o,t.type))),t.role&&(i["x-lobu"]={role:t.role,...t.role==="workflowState"&&t.type==="enum"?{states:(t.enumOptions||[]).map(o=>({value:o,label:o.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase()),terminal:["done","complete","completed","closed","archived"].includes(o.toLowerCase())}))}:{}}),c[t.name]=i,t.required&&n.push(t.name)}const r={type:"object",properties:c};return n.length>0&&(r.required=n),a&&a!=="auto"&&(r["x-lobu"]={defaultView:a}),r}function te(s){const a=s["x-lobu"]?.defaultView;return a==="table"||a==="board"?a:"auto"}function We({value:s,onChange:a,readonly:c=!1}){const[n,r]=x.useState("visual"),[t,i]=x.useState([]),[o,d]=x.useState("auto"),[h,m]=x.useState(""),[S,N]=x.useState(null),[y,b]=x.useState(!1),g=x.useRef(!1);x.useEffect(()=>{if(g.current){g.current=!1;return}if(!s||Object.keys(s).length===0){i([]),d("auto"),m(""),b(!1);return}const u=JSON.stringify(s,null,2);m(u),d(te(s)),Z(s)?(i(ee(s)),b(!1)):(b(!0),r("json"))},[s]);const j=x.useCallback((u,p)=>{g.current=!0;const v=Be(u,p),O=u.some(F=>F.name.trim());m(O?JSON.stringify(v,null,2):""),a(O?v:void 0)},[a]),k=x.useCallback(u=>{i(u),j(u,o)},[j,o]),E=x.useCallback(u=>{d(u),j(t,u)},[j,t]),D=x.useCallback(u=>{if(g.current=!0,m(u),!u.trim()){N(null),i([]),d("auto"),a(void 0);return}try{const p=JSON.parse(u);N(null),d(te(p)),Z(p)?(i(ee(p)),b(!1)):b(!0),a(p)}catch(p){N(p instanceof Error?p.message:"Invalid JSON")}},[a]),w=()=>{k([...t,{id:de(),name:"",type:"string",required:!1}])},A=(u,p)=>{const v=[...t];v[u]=p,k(v)},_=u=>{k(t.filter((p,v)=>v!==u))};return c?e.jsx(Q,{value:h,onChange:()=>{},readonly:!0}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{type:"button",variant:n==="visual"?"default":"outline",size:"sm",onClick:()=>!y&&r("visual"),disabled:y,className:"h-7 text-xs",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Visual"]}),e.jsxs(f,{type:"button",variant:n==="json"?"default":"outline",size:"sm",onClick:()=>r("json"),className:"h-7 text-xs",children:[e.jsx(Se,{className:"h-3 w-3 mr-1"}),"JSON"]})]}),y&&e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-md bg-amber-500/10 text-amber-600 text-xs",children:[e.jsx(oe,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),e.jsx("span",{children:"This schema uses advanced features (nested objects, allOf, etc.) that can only be edited in JSON mode."})]}),n==="visual"?e.jsxs("div",{className:"space-y-3",children:[t.map((u,p)=>e.jsx(Ue,{field:u,onChange:v=>A(p,v),onDelete:()=>_(p)},u.id)),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:w,className:"w-full",children:[e.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"Add Field"]}),t.some(u=>u.name.trim())&&e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border p-2.5",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default view"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Which view this type opens in. Auto picks from your fields (a workflow field → board, otherwise table)."})]}),e.jsxs(q,{value:o,onValueChange:u=>E(u),children:[e.jsx(P,{className:"h-8 w-32 text-xs",children:e.jsx(M,{})}),e.jsxs(L,{children:[e.jsx(R,{value:"auto",children:"Auto"}),e.jsx(R,{value:"table",children:"Table"}),e.jsx(R,{value:"board",children:"Board"})]})]})]})]}):e.jsx(Q,{value:h,onChange:D,error:S})]})}function $e(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function He({entityType:s,onCancel:a,onSaved:c}){const n=!!s,r=Ce(),t=ke(),i=s?.slug??"new",o=Ee(i,{name:s?.name??"",slug:s?.slug??"",description:s?.description??"",icon:s?.icon??"",color:s?.color??"",metadataSchema:s?.metadata_schema??void 0,backingSql:s?.backing_sql??""}),[d,h]=o.field("name"),[m,S]=o.field("slug"),[N,y]=o.field("description"),[b,g]=o.field("icon"),[j,k]=o.field("color"),[E,D]=o.field("metadataSchema"),[w,A]=o.field("backingSql"),[_,u]=X(i,n),[p,v]=X(i,null),O=w.trim().length>0,F=l=>{h(l),!n&&!_&&S($e(l))},J=async()=>{if(!o.canSubmit)return;if(v(null),!d.trim()){v("Name is required");return}if(!n&&!m.trim()){v("Slug is required");return}const l=O?{sql:w.trim()}:null;try{n?await t.mutateAsync({slug:s.slug,name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}):await r.mutateAsync({slug:m.trim(),name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}),c()}catch(I){v(I instanceof Error?I.message:"An error occurred")}},z=r.isPending||t.isPending;return e.jsxs("div",{className:"space-y-5",children:[e.jsx(_e,{visible:o.hasConflict,onReload:o.reset}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-name",children:"Name"}),e.jsx(T,{id:"et-name",value:d,onChange:l=>F(l.target.value),placeholder:"e.g. Product"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-slug",children:"Slug"}),e.jsx(T,{id:"et-slug",value:m,onChange:l=>{u(!0),S(l.target.value)},placeholder:"e.g. topic",disabled:n}),n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-desc",children:"Description"}),e.jsx(Re,{id:"et-desc",value:N,onChange:l=>y(l.target.value),placeholder:"Optional description...",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-icon",children:"Icon (emoji)"}),e.jsx(T,{id:"et-icon",value:b,onChange:l=>g(l.target.value),placeholder:"e.g. 📦"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-color",children:"Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{id:"et-color",value:j,onChange:l=>k(l.target.value),placeholder:"e.g. #6366f1",className:"flex-1"}),j&&e.jsx("div",{className:"h-9 w-9 rounded-md border border-border shrink-0",style:{backgroundColor:j}})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Backing query (SQL)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. A read-only SELECT turns this into a derived (view) type — rows are computed from the query, not stored. Leave empty for a normal stored type. Table references are auto-scoped to your organization."}),e.jsx(ce,{value:w,onChange:A,minHeight:"120px",placeholder:"SELECT (metadata->>'vendor') AS vendor, SUM((metadata->>'amount')::numeric) AS total FROM events GROUP BY 1"})]}),O?e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("span",{children:"Derived view — columns are computed from the query, so there's no stored-row schema to define."})]}),s?.measure_columns&&s.measure_columns.length>0&&e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx(C,{children:"Measure columns"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.measure_columns.map(l=>e.jsx("span",{className:"rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:l},l))})]})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Metadata Schema"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define the structure of metadata fields for entities of this type."}),e.jsx(We,{value:E,onChange:D})]}),n&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Relationships"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define how this entity type relates to others."}),e.jsx(qe,{entityType:s})]}),p&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:p}),e.jsx(Te,{onCancel:a,cancelDisabled:z,className:"pt-2",children:e.jsx(f,{onClick:J,disabled:z,children:z?"Saving...":n?"Update":"Create"})})]})}function Qe({entityType:s,onClose:a,orgContext:c,hideDelete:n=!1,compact:r=!1}){const t=!!s,[i,o]=x.useState(!1),[d,h]=x.useState(!1),[m,S]=x.useState(null),N=Oe(),{data:y,isLoading:b}=De(i&&s?s.slug:null,c),g=s?.entity_count??0,j=g>0,k=async()=>{if(s){S(null);try{await N.mutateAsync(s.slug),a()}catch(w){S(w instanceof Error?w.message:"Failed to delete")}}},E=t?`${s?.icon||"📄"} ${s?.name}`:"Create Entity Type",D=t?"Edit entity type configuration.":"Define a new entity type for your workspace.";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:G("space-y-1.5",!t&&!r&&"text-center"),children:[e.jsx("h1",{className:G("font-semibold leading-tight",r?"text-lg":"text-2xl"),children:E}),e.jsx("p",{className:"text-sm text-muted-foreground",children:D})]}),e.jsx("div",{className:"py-4",children:e.jsx(He,{entityType:s,onCancel:a,onSaved:a})}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[c.slug&&s?e.jsx(Ae,{to:"/$owner/events",params:{owner:c.slug},search:{semantic_types:"change",event_category:"config",resource_kind:"entity-type",resource_id:s.slug},className:"text-sm text-primary underline underline-offset-4",children:"View configuration history in Events"}):null,e.jsxs("button",{type:"button",onClick:()=>o(!i),className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors w-full",children:[i?e.jsx(ne,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),"Schema audit records"]}),i&&e.jsx("div",{className:"mt-3",children:b?e.jsx(ae,{label:"history",variant:"rows",rows:4}):y&&y.length>0?e.jsx("div",{className:"relative ml-1.5",children:y.map(w=>e.jsx(ze,{entry:w},w.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No audit history found."})})]}),!n&&e.jsx("div",{className:"border-t border-border pt-4 mt-4",children:d?e.jsxs("div",{className:"space-y-3",children:[j?e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md bg-amber-500/10 text-amber-600",children:[e.jsx(oe,{className:"h-5 w-5 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium",children:"Cannot delete this entity type"}),e.jsxs("p",{className:"mt-1 text-amber-600/80",children:["There ",g===1?"is":"are"," ",g," entit",g===1?"y":"ies",' of type "',s.name,'". Migrate or delete them first.']})]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:['Are you sure you want to delete "',s.name,'"? This action will soft-delete the entity type. It can be restored by a database administrator.']}),m&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{variant:"outline",size:"sm",onClick:()=>{h(!1),S(null)},children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"sm",onClick:k,disabled:j||N.isPending,children:N.isPending?"Deleting...":"Delete"})]})]}):e.jsxs(f,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>h(!0),children:[e.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete entity type"]})})]})]})}export{Qe as E};
2
- //# sourceMappingURL=entity-type-page-Lf6ONdpf.js.map
@@ -1,2 +0,0 @@
1
- import{cT as $e,bE as zt,i as ct,r as g,eh as ut,ei as Ut,$ as Vt,Q as qt,dQ as Jt,u as mt,j as t,h as xe,ej as st,ek as ze,el as pt,em as Qt,dT as Ht,be as xt,en as Kt,eo as Wt,d4 as Yt,ep as ft,eq as Gt,cq as Zt,L as _e,dZ as Xt,er as es,B as E,dV as Ue,cL as Ve,V as ie,cN as ht,dW as yt,dX as ts,dI as ss,dK as ns,dJ as rs,aY as as,aZ as is,cU as gt,a_ as os,es as ls,v as ds,w as cs,t as us,bP as Ee,c6 as nt,et as ms,a2 as ps,eu as rt,ev as xs,I as fs,ew as hs,bG as ys,a5 as oe,cs as gs,cQ as vs,ex as js,ey as _s,ez as bs,eA as Ns,bW as ws,eB as ks,b_ as Cs,eC as Ss,dF as As,eD as Rs,X as Es,bg as Is,b9 as Ts,eE as $s,eF as Os,dR as Ps}from"./index-008wj-Pz.js";import{R as Ms,p as Ds}from"./use-scroll-sentinel-D-fJx_Md.js";import{b as vt}from"./use-automations-C4TSie1i.js";import{l as Fs,s as Ls,S as Bs,J as zs}from"./renderer-AJxSmE3-.js";import{C as Us,J as Fe}from"./json-diff-LE_vNZrM.js";import{C as at}from"./copy-button-Df7QXE0w.js";function Vs(e,s){if(!e||typeof e!="object"||Array.isArray(e))return null;const n=e.title;if(typeof n!="string")return null;const a=n.trim();return a&&a!==s?a:null}function jt(e){const s=Array.isArray(e?.records)?e.records:Array.isArray(e?.current)?e.current:[];return[e?.from_entity_id??e?.entity_id,e?.to_entity_id].map(n=>{const r=s.find(o=>o&&typeof o=="object"&&"id"in o&&o.id===n);return{id:String(n??"unknown"),name:typeof r?.name=="string"?r.name:`Record ${String(n??"unknown")}`}})}function _t(e,s){return s==="rejected"?"The proposed relationship change was rejected. Both records remain available.":s==="failed"?"The relationship change failed. Both records remain available.":s==="completed"?e==="link"?"The records were linked. Both records remain available.":"The relationship was removed. Both records remain available.":s==="approved"||s==="confirmed"?"The relationship change was approved. Both records remain available.":e==="link"?"If approved, these records will be linked. Both records remain available.":"If approved, this relationship will be removed. Both records remain available."}function Jn(e){const s=jt(e.proposal);return{title:e.action==="link"?"Link records":"Unlink records",icon:"entity",impact:{level:"normal"},tone:"default",blocks:[...s.map((n,a)=>({type:"text",label:a===0?"From":"To",value:n.name})),{type:"text",label:"Relationship",value:String(e.proposal?.relationship_type??e.proposal?.relationship_type_slug??"Relationship")},{type:"text",value:_t(e.action,typeof e.status=="string"?e.status:void 0),muted:!0},...typeof e.reason=="string"&&e.reason?[{type:"text",label:"Why this needs approval",value:e.reason}]:[]],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",confirm:e.action==="unlink",confirmPrompt:"Remove this relationship? Both records will remain available.",tool:"manage_operations",args:{action:"approve"},resolvedLabel:"Approval submitted."},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this relationship change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:"Relationship change rejected."}]}}function bt(e,s,n){return{queryKey:["event-view-match",e,s.key,s.content_hash,n],queryFn:async()=>{try{const r=(await $e("open_view",{key:s.key,scope:{event:n}},{slug:e})).scope?.event;if(!Number.isSafeInteger(r)||(r??0)<1)throw new Error("The view did not resolve its event subject");return r}catch(a){if(a instanceof zt&&(a.status===400||a.status===404))return null;throw a}},staleTime:6e4}}function Qn(e,s){const n=ct(e??{slug:null,organizationId:null}),a=e?.slug??null,r=g.useMemo(()=>a?ut(n.data??[]):[],[a,n.data]),o=Ut({queries:r.map(l=>bt(a,l,s))});return a?{views:r.flatMap((l,h)=>{const i=o[h]?.data;return i?[{...l,eventId:i}]:[]}),isLoading:n.data===void 0?!n.isError:o.some(l=>l.isPending),isError:n.isError||o.some(l=>l.isError),refetch:()=>{n.refetch();for(const l of o)l.isError&&l.refetch()}}:{views:[],isLoading:!1,isError:!1,refetch:()=>{}}}async function qs(e,s,n,a){const r=await Promise.all(n.map(o=>e.fetchQuery(bt(s,o,a))));return n.find((o,l)=>r[l])??null}async function Js(e,s,n,a){const r=await Vt(`${qt}/api/${encodeURIComponent(e)}/events/${s}/actions/${encodeURIComponent(n.action)}`,{method:"POST",timeoutMs:9e4,credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n.value,interaction_id:a})});return await Jt(r,"Could not record interaction"),r.json()}function P(e){if(typeof e!="string")return;const s=e.trim();return s.length>0?s:void 0}function Le(e){return typeof e=="boolean"?e:void 0}function Qs(e,s,n){const a=(n??"").toLowerCase();return!!(a==="prepare_comment"||a==="verify_staged_comment"||a.includes("prepare_")||a.includes("verify_staged")||s?.prepared===!0||typeof s?.verified=="boolean"||P(s?.reason_preview)&&P(s?.message)||P(e?.body)&&(P(e?.post_url)||P(e?.activity_id)))}function Hs(e,s,n){if(!Qs(e,s,n))return null;const a=(n??"").toLowerCase(),r=P(s?.body)??P(e?.body),o=P(s?.reason_preview)??P(e?.reason),l=P(s?.post_url)??P(e?.post_url)??(P(e?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${P(e?.activity_id)}`:void 0),h=Le(s?.prepared),i=Le(s?.verified),u=Le(s?.banner_shown),_=P(s?.message),m=s?.match&&typeof s.match=="object"?s.match:null,v=P(m?.text_preview),w=P(m?.author);let I="generic";a==="verify_staged_comment"||a.includes("verify")||typeof i=="boolean"?I="verify":(a==="prepare_comment"||a.includes("prepare")||h===!0||r&&l)&&(I="prepare");const y=[];return h===!0&&y.push("Staged — not posted"),h===!1&&y.push("Not staged"),i===!0&&y.push("Verified posted"),i===!1&&y.push("Not verified as posted"),u===!0&&y.push("In-page banner"),u===!1&&y.push("No banner"),{kind:I,message:_,reason:o,body:r,postUrl:l,prepared:h,bannerShown:u,verified:i,matchPreview:v,matchAuthor:w,chips:y}}const it="inline-flex max-w-full items-center truncate rounded-md border border-border px-1.5 py-0.5 text-xs";function qe({peer:e,ownerSlug:s,orgContext:n}){const a=mt();if(e.self||!e.type||!a)return t.jsx("span",{className:xe(it,"text-muted-foreground"),children:e.name});const r=a.item?.recordPeer?.entityId===e.id;return t.jsx("button",{type:"button","aria-pressed":r,title:e.type,className:xe(it,"hover:bg-muted",r&&"ring-1 ring-primary"),onClick:o=>{o.stopPropagation(),a.open(Fs({...typeof e.id=="number"?{entityId:e.id}:{record:{type:e.type,key:e.id}},ownerSlug:s,orgContext:n,name:e.name}))},children:t.jsx("span",{className:"truncate",children:e.name})})}function Hn(e,s=e.relationship_type_name){const n=e.from_entity_name??`Record #${e.from_entity_id}`,a=e.to_entity_name??`Record #${e.to_entity_id}`;return e.is_symmetric?`${n} ${s} ${a}`:`${n} → ${s} → ${a}`}function Kn({row:e,entityId:s,entityType:n,ownerSlug:a,orgContext:r,label:o=e.relationship_type_name}){const l=(h,i,u)=>t.jsx(qe,{peer:{id:h,name:i??`Record #${h}`,type:u,self:h===s&&(typeof h=="number"||u===n)},ownerSlug:a,orgContext:r});return t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-xs",children:[l(e.from_entity_id,e.from_entity_name,e.from_entity_type),!e.is_symmetric&&t.jsx(st,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:o}),!e.is_symmetric&&t.jsx(st,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),l(e.to_entity_id,e.to_entity_name,e.to_entity_type)]})}function Wn({count:e,onRetry:s}){return e?t.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:["Some linked records could not be read."," ",t.jsx("button",{type:"button",className:"underline",onClick:s,children:"Retry"})]}):null}const Nt={name:"Name",slug:"URL slug",parent_id:"Parent",content:"Content changed"};function re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ie(e){return e==null||e===""}function Ks(e,s){return ze(e??null)===ze(s??null)}function Ws(e){return!!(e?.type==="array"&&(e.items?.type==="object"||e.items?.properties))}function Ys(e){return!!(e&&(e.type==="object"||e.properties)&&e.type!=="array")}function Ke(e,s){return Ls({key:e,prop:s??{}})}function Gs(e,s){return e?.properties?.[s]}function Je(e,s,n,a,r){if(Ks(s,n))return;const o=i=>Array.isArray(i)?i:[];if((Array.isArray(s)||Ie(s))&&(Array.isArray(n)||Ie(n))&&(Array.isArray(s)||Array.isArray(n)||a?.type==="array")){const i=o(s),u=o(n);if(Ws(a)||[...i,...u].some(p=>re(p))){const p=Math.min(i.length,u.length);for(let k=0;k<p;k++)Je([...e,`item ${k+1}`],i[k],u[k],a?.items,r);const C=Math.max(0,u.length-i.length),q=Math.max(0,i.length-u.length);(C||q)&&r.push({kind:"items",path:e,added:C,removed:q});return}const m=p=>ze(p),v=new Set(i.map(m)),w=new Set(u.map(m)),I=u.filter(p=>!v.has(m(p))),y=i.filter(p=>!w.has(m(p)));r.push(I.length||y.length?{kind:"values",path:e,added:I,removed:y,prop:a?.items}:{kind:"reordered",path:e});return}if((re(s)||Ie(s))&&(re(n)||Ie(n))&&(re(s)||re(n)||Ys(a))){const i=re(s)?s:{},u=re(n)?n:{},_=[...new Set([...Object.keys(a?.properties??{}),...Object.keys(i),...Object.keys(u)])];for(const m of _){const v=Gs(a,m);Je([...e,Ke(m,v)],i[m],u[m],v,r)}return}r.push({kind:"set",path:e,old:s,new:n,prop:a})}function Zs(e,s){const n=Nt[e.field];if(n)return e.field==="content"?[{kind:"note",path:[n]}]:e.field==="parent_id"?[{kind:"parent",path:[n],old:e.old,new:e.new}]:[{kind:"set",path:[n],old:e.old,new:e.new}];const a=s?.properties?.[e.field],r=[];return Je([Ke(e.field,a)],e.old,e.new,a,r),r}function Xs(e,s){const n=s?.properties;return e.map(a=>a.field==="content"?"Content":Nt[a.field]??Ke(a.field,n?.[a.field]))}const en="entity.updated",tn=new Set(["link","unlink","update_link"]);function ot(e){const s=typeof e=="string"||typeof e=="number"?Number(e):Number.NaN;return Number.isSafeInteger(s)&&s>0?s:null}function sn(e){const s=e.split("_").join(" ").trim();return s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:e}function nn(e){const s=e.metadata;if(e.semantic_type!=="change"||!s||s._lobu_relationship_change!==!0||typeof s.op!="string"||!tn.has(s.op))return null;const n=ot(s.fromEntityId),a=ot(s.toEntityId);if(n==null||a==null)return null;const r=typeof s.relationshipTypeSlug=="string"?s.relationshipTypeSlug:null,o=Array.isArray(s.changes)?s.changes:[];return{op:s.op,fromId:n,toId:a,typeLabel:r?sn(r):"relationship",changedFields:o.flatMap(l=>l&&typeof l=="object"&&typeof l.field=="string"?[l.field]:[])}}function Oe({id:e,recordId:s,ownerSlug:n}){const a=e===s,r={slug:n},{data:o,isLoading:l,isError:h}=pt(a?void 0:e,r);return a?t.jsx(qe,{peer:{id:e,name:"this record",type:null,self:!0},ownerSlug:n,orgContext:r}):l?t.jsxs("span",{className:"text-xs text-muted-foreground",children:["Record #",e]}):h||!o?t.jsx("span",{className:"text-xs text-muted-foreground",title:"Deleted, or you do not have access to it",children:"Unavailable record"}):t.jsx(qe,{peer:{id:e,name:o.name,type:o.entity_type},ownerSlug:n,orgContext:r})}function rn({change:e,recordId:s,ownerSlug:n}){const a=e.op==="link"?`Linked as ${e.typeLabel}`:e.op==="unlink"?`Unlinked ${e.typeLabel}`:`Updated ${e.typeLabel} link`,r=s===e.toId&&s!==e.fromId,o=s===e.fromId;return t.jsxs("span",{"data-testid":"relationship-change",className:"inline-flex flex-wrap items-center gap-1.5",children:[!o&&!r?t.jsx(Oe,{id:e.fromId,ownerSlug:n}):null,t.jsx("span",{children:r?`${a} from`:a}),r?t.jsx(Oe,{id:e.fromId,recordId:s,ownerSlug:n}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",children:"→"}),t.jsx(Oe,{id:e.toId,recordId:s,ownerSlug:n})]}),e.op==="update_link"&&e.changedFields.length>0?t.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",e.changedFields.join(", ")]}):null]})}function an(e){if(!Array.isArray(e)||e.length===0)return null;const s=[];for(const n of e){if(!n||typeof n!="object"||typeof n.field!="string")return null;const{field:a,old:r,new:o}=n;s.push({field:a,old:r??null,new:o??null})}return s}function on(e){const s=nn(e);if(s)return{kind:"relationship",change:s};const n=e.metadata;if(e.semantic_type!=="change"||!n)return null;const a=n._lobu_event_type;if(a!==en&&(a!==void 0||n.category))return null;const r=an(n.changes);if(!r)return null;const o=e.entity_ids?.[0];return{kind:"fields",entityId:typeof o=="number"?o:null,changes:r}}function wt(e,s){const n={slug:s},{data:a}=pt(e.entityType?void 0:e.entityId??void 0,n),{data:r}=Qt(e.entityType??a?.entity_type??"",n);return r?.metadata_schema}const ln=4;function Te({value:e,prop:s}){return t.jsx("span",{className:"inline-block max-w-[18rem] truncate align-bottom",title:typeof e=="string"?e:void 0,children:t.jsx(Bs,{value:e,prop:s,empty:t.jsx("span",{className:"italic",children:"empty"})})})}function lt({id:e,ownerSlug:s}){const n=typeof e=="number"||typeof e=="string"?Number(e):Number.NaN;return Number.isSafeInteger(n)&&n>0?t.jsx(Oe,{id:n,ownerSlug:s}):t.jsx("span",{className:"italic text-muted-foreground",children:"empty"})}function Qe(e,s){return`${e} ${s}${e===1?"":"s"}`}function dn({line:e,ownerSlug:s}){const n=t.jsx("span",{className:"text-muted-foreground",children:e.path.join(" · ")});switch(e.kind){case"note":return n;case"set":return t.jsxs(t.Fragment,{children:[n,": ",t.jsx(Te,{value:e.old,prop:e.prop})," ",t.jsx("span",{"aria-hidden":"true",children:"→"})," ",t.jsx(Te,{value:e.new,prop:e.prop})]});case"parent":return t.jsxs(t.Fragment,{children:[n,": ",t.jsx(lt,{id:e.old,ownerSlug:s})," ",t.jsx("span",{"aria-hidden":"true",children:"→"})," ",t.jsx(lt,{id:e.new,ownerSlug:s})]});case"items":return t.jsxs(t.Fragment,{children:[n,":"," ",[e.added?`${Qe(e.added,"item")} added`:null,e.removed?`${Qe(e.removed,"item")} removed`:null].filter(Boolean).join(", ")]});case"values":return t.jsxs(t.Fragment,{children:[n,":",e.added.map((a,r)=>t.jsxs("span",{className:"ml-1.5",children:["+",t.jsx(Te,{value:a,prop:e.prop})]},`+${r}`)),e.removed.map((a,r)=>t.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["−",t.jsx(Te,{value:a,prop:e.prop})]},`-${r}`))]});case"reordered":return t.jsxs(t.Fragment,{children:[n,": reordered"]})}}function cn({change:e,ownerSlug:s}){const n=wt(e,s);return t.jsxs(t.Fragment,{children:["Updated ",Xs(e.changes,n).join(", ")]})}function We({changes:e,entityId:s,entityType:n,ownerSlug:a,showAll:r=!1}){const o=wt({entityId:s,entityType:n},a),[l,h]=g.useState(r),i=e.flatMap(m=>Zs(m,o)),u=l?i:i.slice(0,ln),_=i.length-u.length;return t.jsxs("ul",{"data-testid":"field-changes",className:"space-y-0.5 text-sm",children:[u.map((m,v)=>t.jsx("li",{className:"min-w-0 truncate",children:t.jsx(dn,{line:m,ownerSlug:a})},v)),_>0?t.jsx("li",{children:t.jsxs("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:m=>{m.stopPropagation(),h(!0)},children:["+",Qe(_,"more change")]})}):null]})}function un({event:e,recordId:s,ownerSlug:n}){return e.kind==="relationship"?t.jsx(rn,{change:e.change,recordId:s,ownerSlug:n}):t.jsx(cn,{change:e,ownerSlug:n})}function mn({event:e,ownerSlug:s}){return e.kind==="fields"?t.jsx(We,{changes:e.changes,entityId:e.entityId,ownerSlug:s}):null}function pn(e){return e.semantic_type==="change"&&(e.metadata?.category==="config"||e.metadata?.category==="deployment")}function ae(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function xn({content:e,detail:s=!1}){const n=e.metadata??{},a=e.payload_data??{},r=n.category==="deployment",o=typeof n.apply_id=="string"?n.apply_id:null,l=ae(a.manifest),h=o&&/^apl_[A-Za-z0-9-]{1,48}$/.test(o)&&e.origin_type==="deployment"&&e.origin_id===`deployment_${o}`&&(n.status==="succeeded"||n.status==="partial_failure")&&ae(l?.state);return t.jsxs("div",{className:"space-y-3","data-testid":"config-change-event",children:[t.jsx(Us,{showAttribution:s,operation:r?String(n.status??"Apply"):typeof n.op=="string"?n.op:null,actor:e.author_name??(typeof n.actor_source=="string"?n.actor_source:null),createdAt:e.occurred_at??e.created_at,resource:r?"Configuration apply":`${n.resource_kind??"Configuration"} · ${n.resource_id??""}`,changedFields:Array.isArray(n.changed_fields)?n.changed_fields.filter(i=>typeof i=="string"):void 0}),o?t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"break-all",children:["Apply ",o]}),t.jsx(at,{text:o,label:"Copy apply ID"})]}):null,s?r?t.jsxs(t.Fragment,{children:[typeof n.rollback_of=="string"?t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:["Restores apply ",n.rollback_of]}):null,ae(n.counts)?t.jsx("dl",{className:"flex flex-wrap gap-4 text-xs",children:Object.entries(ae(n.counts)??{}).map(([i,u])=>t.jsxs("div",{children:[t.jsx("dt",{className:"text-muted-foreground",children:i}),t.jsx("dd",{children:String(u)})]},i))}):null,typeof a.error=="string"?t.jsx("p",{className:"text-sm text-destructive",children:a.error}):null,h?t.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Restore this deployment"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Preview restoring this saved configuration with the CLI. Secret values stay unchanged."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("code",{className:"break-all text-xs",children:["lobu rollback ",o]}),t.jsx(at,{text:`lobu rollback ${o}`,label:"restore command",iconOnly:!0})]})]}):null,t.jsx(Fe,{before:null,after:l})]}):Object.hasOwn(a,"before")?t.jsx(Fe,{before:ae(a.before),after:ae(a.state)}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"The earlier state was not recorded for this change."}),t.jsx(Fe,{before:null,after:ae(a.state)})]}):null]})}function je(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function fn({template:e,data:s,onAction:n}){const[a,r]=g.useState(null),[o,l]=g.useState(!1),[h,i]=g.useState(null),[u,_]=g.useState(!1),m=g.useRef(!1),v=g.useRef(!0);g.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const w=async I=>{if(!(!n||m.current)){m.current=!0,l(!0),i(null),_(!1);try{const y=await n(I);if(!v.current)return;if(je(y)&&y.kind==="sdk"){const p=y.result;if(!je(p)||p.success!==!0){const C=je(p)&&je(p.error)?p.error.message:null;throw new Error(typeof C=="string"?C:"Could not update this event.")}if(p.return_truncated||!je(p.return_value))throw new Error("The update did not return a complete data object.");r(p.return_value),_(!0)}}catch(y){v.current&&i(y instanceof Error?y.message:"Could not update this event.")}finally{m.current=!1,v.current&&l(!1)}}};return t.jsxs("div",{className:"space-y-2",children:[o?t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Updating…"}):null,u?t.jsx("p",{role:"status",className:"sr-only",children:"Updated"}):null,h?t.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[h," Previous data is still shown."]}):null,t.jsx("fieldset",{disabled:!n||o,"aria-busy":o,className:"min-w-0",children:t.jsx(zs,{template:{root:e.root},data:a??s,onAction:n?w:void 0,interactions:e.interactions})})]})}function kt(e){return{audit:e.semantic_type==="audit"&&e.origin_type==="tool_invocation",operation:e.interaction_type==="approval"||e.semantic_type==="operation",changeSet:e.semantic_type==="change_set"}}const hn={};function fe(e){return e.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase())}const yn={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function gn(e){return e.author_name?e.author_name:e.platform?fe(e.platform):e.origin_type?yn[e.origin_type]??fe(e.origin_type):null}function vn(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):Array.isArray(e)?e.length===0?"":e.every(s=>typeof s!="object")?e.map(s=>String(s)).join(", "):t.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(e,null,2)}):t.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(e,null,2)})}const Be=1e5;function dt({value:e}){const s=JSON.stringify(e,null,2)??"null",n=s.length>Be;return t.jsxs(t.Fragment,{children:[t.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 font-mono text-xs",children:n?s.slice(0,Be):s}),n&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",Be.toLocaleString()," of"," ",s.length.toLocaleString()," characters."]})]})}function jn(e){return Object.entries(e).filter(([,s])=>s==null?!1:typeof s=="string"?s.trim().length>0:Array.isArray(s)?s.length>0:typeof s=="object"?Object.keys(s).length>0:!0).sort(([s],[n])=>s.localeCompare(n))}function _n({breakdown:e}){if(!e)return null;const s=[{label:"Engagement",value:e.engagement,max:100},{label:"Criticality",value:e.criticality,max:100},{label:"Depth",value:e.depth,max:100},{label:"Authority",value:e.authority,max:100},{label:"Recency",value:e.recency,max:100},{label:"Quality",value:e.quality,max:100}];return t.jsx("div",{className:"space-y-2 text-sm",children:s.map(n=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-20 text-muted-foreground",children:n.label}),t.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-primary",style:{width:`${n.value/n.max*100}%`}})}),t.jsx("span",{className:"w-8 text-right",children:n.value})]},n.label))})}function bn({slug:e,value:s,isManual:n}){return t.jsxs(ie,{variant:"secondary",className:"text-xs",children:[e,": ",s,n&&t.jsx(ft,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Nn(e){if(e&&typeof e=="object"){const s=e;if(Array.isArray(s.values))return{values:s.values.map(n=>String(n)).filter(n=>n.length>0),isManual:s.is_manual===!0};if(s.value!==void 0&&s.value!==null)return{values:[String(s.value)],isManual:s.is_manual===!0};if(typeof s.values=="string"&&s.values.length>0)return{values:[s.values],isManual:s.is_manual===!0}}return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?{values:[String(e)],isManual:!1}:{values:[],isManual:!1}}function Ct(e,s){if(e)switch(e){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return e}return s||"pending_approval"}function He(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function wn(e){return e.replace(/\s+[—-]\s+pending approval$/i,"")}function Pe(e){return e.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,s=>s.toUpperCase())}function kn(e){const s=Object.keys(e.fields),n=s.map(Pe).join(", ")||"field",a=s.length===1?"field":"fields";return`Update ${e.entityType?Pe(e.entityType).toLowerCase():"entity"} ${a}: ${n}`}function Cn(e,s){const n=He(s.fields);if(!n||Object.keys(n).length===0||s.action_key!=="entity_field_change"&&s.tool!=="entity_field_change")return null;const a=He(s.current)??{},r=e;return{fields:n,current:a,reason:typeof s.reason=="string"?s.reason:void 0,automationId:s.automation_id!=null?String(s.automation_id):void 0,automationName:typeof s.automation_name=="string"?s.automation_name:void 0,automationAgentId:typeof s.automation_agent_id=="string"?s.automation_agent_id:void 0,entityType:typeof s.entity_type=="string"?s.entity_type:void 0,entityName:(typeof s.entity_name=="string"?s.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof s.entity_slug=="string"?s.entity_slug:void 0,parentSlug:typeof s.parent_slug=="string"?s.parent_slug:void 0,parentEntityType:typeof s.parent_entity_type=="string"?s.parent_entity_type:void 0,attribution:typeof s.attribution=="string"?s.attribution:void 0,initiator:s.initiator&&typeof s.initiator=="object"?s.initiator:void 0}}function Sn(e){const s=e.entityType?Pe(e.entityType).toLowerCase():"entity";return`${Pe(e.operation)} ${s}`}function An(e,s){if(s.action_key!=="entity_change"&&s.tool!=="entity_change")return null;const n=s.action;if(n!=="create"&&n!=="delete"&&n!=="link"&&n!=="unlink")return null;const a=e;return{operation:n,proposal:He(s.proposal),reason:typeof s.reason=="string"?s.reason:void 0,automationId:s.automation_id!=null?String(s.automation_id):void 0,automationName:typeof s.automation_name=="string"?s.automation_name:void 0,automationAgentId:typeof s.automation_agent_id=="string"?s.automation_agent_id:void 0,entityType:typeof s.entity_type=="string"?s.entity_type:void 0,entityName:(typeof s.entity_name=="string"?s.entity_name:void 0)??a.entity_name??void 0,entitySlug:typeof s.entity_slug=="string"?s.entity_slug:void 0,parentSlug:typeof s.parent_slug=="string"?s.parent_slug:void 0,parentEntityType:typeof s.parent_entity_type=="string"?s.parent_entity_type:void 0,attribution:typeof s.attribution=="string"?s.attribution:void 0,proposerRationale:typeof s.proposer_rationale=="string"?s.proposer_rationale:void 0,initiator:s.initiator&&typeof s.initiator=="object"?s.initiator:void 0}}function Rn(e,s){return!s.entityType||!s.entitySlug?null:Ps(e,s.parentEntityType&&s.parentSlug?[{entity_type:s.parentEntityType,slug:s.parentSlug},{entity_type:s.entityType,slug:s.entitySlug}]:[{entity_type:s.entityType,slug:s.entitySlug}])}function St({ownerSlug:e,runId:s,details:n}){const r=vt(n.automationId,void 0,void 0,{ownerSlug:e,includeVersions:!1}).data?.automation,o=Ds(n.initiator,n.attribution,n.automationId),l=r?.automation_name??n.automationName??o;return t.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",n.automationId?t.jsx(_e,{to:"/$owner/automations/$automationId",params:{owner:e,automationId:n.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:l}):t.jsx("span",{className:"font-medium text-foreground",children:l}),s&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:" · "}),t.jsxs(_e,{to:"/$owner/events",params:{owner:e},search:{run_ids:String(s)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",s]})]})]})}function At({ownerSlug:e,details:s}){const n=Rn(e,s);return s.entityName?t.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Entity"}),t.jsx("div",{className:"mt-1 text-sm font-medium",children:n?t.jsx(_e,{to:n,className:"underline-offset-4 hover:underline",children:s.entityName}):s.entityName})]}):null}function En({ownerSlug:e,runId:s,details:n}){return t.jsxs("div",{className:"space-y-3",children:[t.jsx(St,{ownerSlug:e,runId:s,details:n}),t.jsx(At,{ownerSlug:e,details:n}),t.jsx("div",{className:"rounded-md border border-border/70 px-3 py-2",children:t.jsx(We,{changes:Object.entries(n.fields).map(([a,r])=>({field:a,old:n.current[a]??null,new:r??null})),entityType:n.entityType,ownerSlug:e,showAll:!0})}),n.reason&&t.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Reasoning"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.reason})]})]})}function In({ownerSlug:e,runId:s,details:n,status:a}){const{operation:r}=n,o=r==="link"||r==="unlink";return t.jsxs("div",{className:"space-y-3",children:[t.jsx(St,{ownerSlug:e,runId:s,details:n}),!o&&t.jsx(At,{ownerSlug:e,details:n}),t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Change"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:o?_t(r,a):r==="create"?"Create a new entity after approval.":"Delete this entity after approval."}),o&&t.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[jt(n.proposal).map((l,h)=>t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:h===0?"From: ":"To: "}),l.name]},l.id)),t.jsxs("div",{className:"text-muted-foreground",children:["Relationship:"," ",String(n.proposal?.relationship_type??n.proposal?.relationship_type_slug??"Relationship")]})]})]}),!o&&n.proposal&&t.jsxs("div",{className:"rounded-lg border border-border/70 p-3",children:[t.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Proposal"}),t.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(n.proposal,null,2)})]}),n.proposerRationale&&t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.proposerRationale})]}),n.reason&&t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Why this needs approval"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.reason})]})]})}function Tn({summary:e}){return t.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[e.chips.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.chips.map(s=>t.jsx(ie,{variant:"outline",className:"text-[10px] font-normal",children:s},s))}),e.message&&t.jsx("p",{className:"leading-relaxed text-foreground",children:e.message}),e.reason&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Why"}),t.jsx("div",{className:"mt-0.5 leading-relaxed",children:e.reason})]}),e.body&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e.kind==="verify"?"Expected comment":"Draft"}),t.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:e.body})]}),e.matchPreview&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsxs("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Matched comment",e.matchAuthor?` · ${e.matchAuthor}`:""]}),t.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:e.matchPreview})]}),e.postUrl&&t.jsxs("a",{href:e.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",t.jsx(gt,{className:"h-3 w-3"})]})]})}function $n({ownerSlug:e,content:s,batchReview:n}){const a=s.metadata||{},r=s.run_id??void 0,o=Cn(s,a),l=An(s,a),h=(o?kn(o):l?Sn(l):void 0)||a.operation_name||a.action_name||(s.title?wn(s.title):void 0)||"Action",i=a.connection_name,u=a.operation_key||a.action_key||null,_=s.interaction_input_schema||a.input_schema||null,m=g.useMemo(()=>s.interaction_input||a.action_input||a.operation_input||hn,[s.interaction_input,a.action_input,a.operation_input]),v=s.interaction_output||a.action_output||void 0,w=Hs(m,v??null,u),I=s.interaction_error||a.error_message||void 0,y=Ct(s.interaction_status,a.status),p=a.reviewed_by_name||a.reviewed_by_id||void 0,C=a.reject_reason||void 0,q=a.initiator,k=bs({slug:e}),D=Ns({slug:e}),F=ws(s.id,ks(_,m),_),{values:M,setValues:$}=F,[b,B]=g.useState(null),[c,z]=g.useState(!1),[T,H]=g.useState(""),N=y==="pending_approval"&&b?b:y,S=N==="pending_approval",X=typeof a.source_run_id=="number";return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(xt,{className:"h-4 w-4 text-yellow-500"}),t.jsx("span",{className:"font-medium",children:h}),i&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",i]}),N==="confirmed"&&t.jsx(ie,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:"Approved"}),N==="completed"&&t.jsx(ie,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),N==="failed"&&t.jsx(ie,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),N==="rejected"&&t.jsx(ie,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!o&&!l&&(s.author_name||p)&&t.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[s.author_name&&t.jsxs("span",{children:["Requested by"," ",t.jsx(Ms,{ownerSlug:e,initiator:q,clientName:s.author_name,fallback:s.author_name})]}),s.author_name&&p&&t.jsx("span",{children:"·"}),p&&t.jsxs("span",{children:[N==="rejected"?"Rejected":"Approved"," by"," ",t.jsx("span",{className:"font-medium text-foreground",children:p})]})]}),o&&t.jsx(En,{ownerSlug:e,runId:r,details:o}),!o&&l&&t.jsx(In,{ownerSlug:e,runId:r,details:l,status:N}),N==="rejected"&&C&&t.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-xs text-muted-foreground",children:[t.jsx("span",{className:"font-medium text-foreground",children:"Reason:"})," ",C]}),w&&t.jsx(Tn,{summary:w}),(S?F.revision:_)&&(S||Object.keys(m).length>0)&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:w?"Full input":"Input"}),S?t.jsxs(t.Fragment,{children:[t.jsx(Cs,{visible:F.hasConflict,onReload:F.reset}),t.jsx(Ss,{schema:F.revision,values:M,onValuesChange:$,fieldIdPrefix:`action-${s.id}-`},`action-${s.id}`)]}):w?t.jsxs("details",{className:"text-xs",children:[t.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw input"}),t.jsx("pre",{className:"mt-1 bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}):t.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}),N==="completed"&&v&&Object.keys(v).length>0&&!w&&t.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[t.jsx(yt,{className:"h-3.5 w-3.5"}),"Output"]}),t.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap",children:JSON.stringify(v,null,2)})]}),N==="completed"&&v&&Object.keys(v).length>0&&w&&t.jsxs("details",{className:"text-xs",children:[t.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw output"}),t.jsx("pre",{className:"mt-1 rounded bg-green-50 p-2 font-mono dark:bg-green-950/30 overflow-auto max-h-32",children:JSON.stringify(v,null,2)})]}),N==="failed"&&I&&t.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[t.jsx(ht,{className:"h-3.5 w-3.5"}),"Error"]}),t.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:I})]}),S&&!b&&X&&t.jsxs("div",{className:"pt-1 text-xs text-muted-foreground",children:["Review this proposal with the other changes in its Automation run.",n]}),S&&r&&!b&&!X&&t.jsx("div",{className:"flex items-center gap-2 pt-1",children:c?t.jsxs("div",{className:"flex items-center gap-2 w-full",children:[t.jsx("input",{type:"text",placeholder:"Reason (optional)",value:T,onChange:A=>H(A.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),t.jsxs(E,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>D.mutate({run_id:r,reason:T||void 0},{onSuccess:()=>{B("rejected")}}),disabled:D.isPending,children:[D.isPending&&t.jsx(oe,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),t.jsx(E,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{z(!1),H("")},children:"Cancel"})]}):t.jsxs(t.Fragment,{children:[t.jsxs(E,{size:"sm",className:"h-7 text-xs",onClick:()=>k.mutate({run_id:r,input:Rs(M)},{onSuccess:()=>{B("confirmed")}}),disabled:!F.canSubmit||k.isPending||D.isPending,children:[k.isPending?t.jsx(oe,{size:"sm",className:"mr-1"}):t.jsx(As,{className:"h-3 w-3 mr-1"}),"Confirm"]}),t.jsxs(E,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>z(!0),disabled:k.isPending||D.isPending,children:[t.jsx(Es,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function On({content:e,ownerSlug:s}){const n=e.metadata||{},a=n.kind,r=e.run_id??null,o=typeof n.automation_id=="number"?n.automation_id:null,i=vt(o!=null?String(o):void 0,void 0,void 0,{includeVersions:!1,ownerSlug:s}).data?.automation?.automation_name??(o!=null?`Automation ${o}`:"An Automation"),u=js({slug:s}),_=_s({slug:s}),[m,v]=g.useState(!1),[w,I]=g.useState(""),[y,p]=g.useState(null);if(a==="automation_batch_reject"){const c=n.reason||void 0;return t.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3",children:[t.jsx("div",{className:"text-sm font-medium",children:"Proposals rejected"}),c&&t.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:c}),t.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const C=Array.isArray(n.changes)?n.changes:[],q=typeof n.created_count=="number"?n.created_count:C.filter(c=>c.kind==="created").length,k=typeof n.updated_count=="number"?n.updated_count:C.filter(c=>c.kind==="updated").length,D=typeof n.denied_count=="number"?n.denied_count:C.filter(c=>c.kind==="denied").length,F=C.filter(c=>c.kind==="denied"),M=C.filter(c=>c.kind==="updated"&&Object.keys(c.applied||{}).length>0),$=typeof n.pending_proposal_count=="number"?n.pending_proposal_count:null,b=$==null||$>0,B=b?"proposed":"applied";return t.jsxs("div",{className:"rounded-md border p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[t.jsxs("div",{className:"text-sm font-medium",children:[B==="proposed"?"Proposed":"Applied"," ",q," ","new + ",k," updated",D>0&&t.jsxs(t.Fragment,{children:[" + ",D," denied"]})]}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[o!=null?t.jsx(_e,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:String(o)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:i}):t.jsx("span",{className:"font-medium text-foreground",children:i}),r!=null&&t.jsxs("span",{children:[" · run #",r]}),$!=null&&$>0&&t.jsxs("span",{children:[" · ",$," pending"]})]})]}),M.length>0&&t.jsx("div",{className:"mt-3 space-y-2",children:M.map(c=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:c.name}),t.jsx(We,{changes:Object.entries(c.applied).map(([z,T])=>({field:z,old:T.old??null,new:T.new??null})),entityId:c.entityId,ownerSlug:s,showAll:!0})]},c.entityId))}),F.length>0&&t.jsx("div",{className:"mt-3 space-y-1.5",children:F.map(c=>t.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-2.5 py-2",children:[t.jsxs("div",{className:"text-xs font-medium",children:[c.name," — not written"]}),c.denied&&t.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[c.denied.reason,t.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",c.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${c.entityId}-${c.name}`))}),r!=null&&y==null&&b&&t.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:m?t.jsxs("div",{className:"flex items-center gap-2 w-full",children:[t.jsx("input",{type:"text",placeholder:"What should the agent change?",value:w,onChange:c=>I(c.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),t.jsxs(E,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>_.mutate({run_id:r,reason:w||void 0},{onSuccess:()=>p("rejected")}),disabled:_.isPending,children:[_.isPending&&t.jsx(oe,{size:"sm",className:"mr-1"}),"Reject all"]}),t.jsx(E,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{v(!1),I("")},children:"Cancel"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(E,{size:"sm",className:"h-7 text-xs",onClick:()=>u.mutate({run_id:r},{onSuccess:()=>p("approved")}),disabled:u.isPending||_.isPending,children:[u.isPending&&t.jsx(oe,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),t.jsx(E,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>v(!0),disabled:u.isPending||_.isPending,children:"Reject with feedback"})]})}),y==="approved"&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),y==="rejected"&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),r!=null&&y==null&&!b&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function Pn(e){if(!e)return;const s={};for(const[n,a]of Object.entries(e))n==="_lobu_idempotency_key"||n==="agent_id"||(s[n]=a);return Object.keys(s).length>0?s:void 0}function Yn({presentation:e="summary",renderDetail:s,onFiltersChange:n,ownerSlug:a,content:r,isReply:o,showParentContext:l,connectorDefinitions:h,hideOriginator:i=!1,hideRunAction:u=!1,hideAttribution:_=!1,hideDetails:m=!1,recordId:v}){const[w,I]=g.useState(null),[y,p]=g.useState(!1),[C,q]=g.useState(!1),[k,D]=g.useState(!1),[F,M]=g.useState(!1),[$,b]=g.useState(!1),[B,c]=g.useState(null),[z,T]=g.useState(r.title??""),[H,N]=g.useState(r.text_content??""),S=ds(),X=cs(),A=e==="detail",U=mt(),{currentOwner:be,allOrgs:le,isAuthenticated:Ne}=us(),W=a??be,x=W==="me"?null:W,we=g.useCallback(async d=>{if(!x){Ee.error("Open this event inside a workspace to interact with it.");return}const j=await Js(x,Number(r.id),d,crypto.randomUUID());return"event_id"in j&&Ee.success("Recorded"),j},[r.id,x]),V=r.payload_data??{},{audit:L,operation:ee,changeSet:Y}=kt(r),te=L&&(V.request!==void 0||V.request_status==="too_large"),de=L&&Array.isArray(V.sdk_call_trace)&&V.sdk_call_trace.length>0,G=W?nt(W,Number(r.id)):null,J=Ne&&x?(le??[]).find(d=>d.slug===x):void 0,ce=A?void 0:J,he=r.semantic_type==="guidance",{isAdmin:ke,isLoading:ye}=ms(he?J?.id:void 0),Q=ce?{slug:ce.slug,organizationId:ce.id}:null,Ce=ct(Q??{slug:null,organizationId:null}),K=Q?.slug??null,Se=g.useMemo(()=>K&&!L?ut(Ce.data??[],r.semantic_type):[],[K,L,Ce.data,r.semantic_type]),se=ps(),Z=pn(r),ne=!!(!(ee||Y||Z)&&Q&&Se.length>0),me=!A&&!y&&!!G,f=rt(U?.item?.href.split(/[?#]/)[0]??""),R=f?.owner===W&&f?.eventId===Number(r.id),pe=(d,j,O)=>{U?U.open({href:d,title:j,...O==null?{}:{runId:O}}):S({to:d})},Ae=(d,j)=>{if(!x)return null;const O=`/${x}/events?run_ids=${d}`;return U?.item?.href===O?null:t.jsxs(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>n?n({runIds:[d]}):pe(O,"Run activity",d),title:n?"Filter by this run":"Open run activity",children:[t.jsx(vs,{className:"h-3.5 w-3.5"}),j]})},Rt=r.run_id!=null&&(n||!(U&&x&&r.automation_id!=null))?Ae(r.run_id,n?"Run":"Open run"):null,ge=xs(r),Me=r.automation_id,Et=U&&x&&ge!=null&&Me!=null?()=>U.open({href:`/${x}/automations/${Me}?run_id=${ge}`,title:`${r.automation_name??`Automation ${Me}`} · Run #${ge}`,runId:ge}):void 0,Ye=()=>{if(ne&&Q&&x){const d=Number(r.id);qs(se,Q.slug,Se,d).catch(()=>null).then(j=>pe(nt(x,d,j?.key),r.title??"Event"));return}G&&pe(G,r.title??"Event")},Ge=d=>{const j=d.target;if(!(j instanceof Element))return!1;const O=j.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return O!==null&&O!==d.currentTarget},It=d=>{Ge(d)||Ye()},Tt=d=>{d.key!=="Enter"&&d.key!==" "||Ge(d)||(d.preventDefault(),Ye())},Ze=r.metadata?.source_run_id,ve=on(r),$t=(!r.platform||r.platform==="lobu")&&r.connection_id==null&&r.feed_id==null&&r.origin_type==null&&r.automation_id==null&&!L&&!ee&&!Y&&!Z&&ve==null&&r.semantic_type!=="tombstone"&&r.semantic_type!=="notification"&&r.metadata?.tombstone!==!0&&r.interaction_type!=="approval"&&r.interaction_status==null&&!r.is_superseded&&r.superseded_by==null,Xe=!!(x&&J&&$t&&(!he||!ye&&ke)),et=Xe&&r.payload_type!=="json_template"&&r.payload_type!=="media",tt=()=>{se.invalidateQueries({queryKey:[$s]}),se.invalidateQueries({queryKey:[Os]}),se.invalidateQueries({queryKey:["search-memory"]})},Ot=async()=>{if(!(!x||!et)){if(M(!1),c(null),r.payload_truncated){q(!0);try{const j=(await $e("read_knowledge",{content_ids:[Number(r.id)]},{slug:x})).content?.find(O=>Number(O.id)===Number(r.id));T(j?.title??r.title??""),N(j?.text_content??j?.payload_text??r.text_content??""),p(!0)}catch(d){c(d instanceof Error?d.message:"Failed to load full memory.")}finally{q(!1)}return}T(r.title??""),N(r.text_content??""),p(!0)}},Pt=async()=>{if(!x||k)return;if(!H.trim()){c("Memory content cannot be empty.");return}D(!0),c(null);try{const j=r.payload_type==="markdown"||r.payload_type==="text"?r.payload_type:"text",O=Pn(r.metadata);await $e("save_memory",{supersedes_event_id:Number(r.id),semantic_type:r.semantic_type||"note",payload_type:j,title:z.trim()||void 0,content:H,...Array.isArray(r.entity_ids)&&r.entity_ids.length>0?{entity_ids:r.entity_ids}:{},...r.source_url?{source_url:r.source_url}:{},...r.author_name?{author:r.author_name}:{},...r.occurred_at?{occurred_at:r.occurred_at}:{},...r.payload_data&&Object.keys(r.payload_data).length>0?{payload_data:r.payload_data}:{},...O?{metadata:O}:{}},{slug:x}),p(!1),tt(),Ee.success("Memory updated")}catch(j){c(j instanceof Error?j.message:"Failed to update memory.")}finally{D(!1)}},Mt=async()=>{if(!(!x||$)){b(!0),c(null);try{const d=Number(r.id),j=await $e("run_sdk",{title:"Delete memory",script:`export default async (_ctx, client) => client.knowledge.delete(${JSON.stringify({content_id:d,reason:"Deleted from web UI"})});`},{slug:x});if(j?.success===!1){const Bt=typeof j.error=="string"?j.error:j.error?.message||"Failed to delete memory.";throw new Error(Bt)}M(!1),R&&U?.close();const O=rt(X.pathname);O?.owner===x&&O.eventId===d&&S({to:"/$owner/events",params:{owner:x}}),tt(),Ee.success("Memory deleted")}catch(d){c(d instanceof Error?d.message:"Failed to delete memory.")}finally{b(!1)}}},Dt=Xe&&!y?F?t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsxs(E,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2.5 text-xs",disabled:$,onClick:()=>void Mt(),children:[$&&t.jsx(oe,{size:"xs",className:"mr-1.5"}),$?"Deleting...":"Delete"]}),t.jsx(E,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:$,onClick:()=>{M(!1),c(null)},children:"Cancel"})]}):t.jsxs(t.Fragment,{children:[et&&t.jsxs(E,{type:"button",variant:"ghost",size:"sm","aria-label":"Edit memory",className:"h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-foreground",disabled:C||$,onClick:()=>void Ot(),children:[C?t.jsx(oe,{size:"xs"}):t.jsx(Is,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:C?"Loading...":"Edit"})]}),t.jsxs(E,{type:"button",variant:"ghost",size:"sm","aria-label":"Delete memory",className:"h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-destructive",disabled:C,onClick:()=>{c(null),M(!0)},children:[t.jsx(Ts,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:"Delete"})]})]}):null,Ft=y?t.jsxs("form",{className:"mt-2 space-y-3 rounded-lg border bg-background p-3 text-foreground",onSubmit:d=>{d.preventDefault(),Pt()},children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{htmlFor:`memory-title-${r.id}`,className:"block text-xs font-medium text-muted-foreground",children:"Title"}),t.jsx(fs,{id:`memory-title-${r.id}`,"aria-label":"Memory title",value:z,onChange:d=>T(d.target.value),placeholder:"Optional short summary",disabled:k})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{htmlFor:`memory-content-${r.id}`,className:"block text-xs font-medium text-muted-foreground",children:["Content",t.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),t.jsx(hs,{id:`memory-content-${r.id}`,"aria-label":"Memory content",value:H,onChange:d=>N(d.target.value),rows:5,disabled:k})]}),B&&t.jsx("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:B}),t.jsx(ys,{onCancel:()=>{p(!1),c(null)},cancelDisabled:k,children:t.jsxs(E,{type:"submit",disabled:k||H.trim().length===0,children:[k&&t.jsx(oe,{size:"xs",className:"mr-1.5"}),k?"Saving...":"Save"]})})]}):null,Lt=!y&&B?t.jsx("div",{role:"alert",className:"mt-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:B}):null,De=Z?t.jsx(xn,{content:r,detail:A}):A&&x?Y?t.jsx(On,{content:r,ownerSlug:x}):ee?t.jsx($n,{ownerSlug:x,content:r,batchReview:typeof Ze=="number"?Ae(Ze,"Review run"):null}):void 0:void 0,Re=A&&s?s(De):{content:De,nativeHeading:De!=null};return t.jsx("div",{className:xe(o?"border-l-2 border-l-muted pl-4":"",me&&"cursor-pointer rounded-lg p-3 transition-colors hover:bg-accent/40",me&&R&&"bg-accent ring-1 ring-inset ring-primary/20"),...me?{role:"button","aria-current":R?"true":void 0,tabIndex:0,onClick:It,onKeyDown:Tt}:{},children:t.jsx(Fn,{primaryContent:Re.content,nativeHeading:Re.nativeHeading,heading:ve&&x?t.jsx(un,{event:ve,recordId:v,ownerSlug:x}):void 0,body:Ft??(ve&&x?t.jsx(mn,{event:ve,ownerSlug:x}):void 0),detailLinks:Re.links,headingAside:Re.headingAside,hideDetails:m,onFiltersChange:n,presentation:e,content:r,ownerSlug:W??void 0,showParentContext:l,connectorDefinitions:h,onRenderedAction:x?we:void 0,runAction:u?null:Rt,memoryActions:Dt,memoryFeedback:Lt,hideOriginator:i,hideAttribution:_,runId:ge??r.run_id??null,onRunSelect:Et,auditDetails:A&&(te||de)&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"request",label:"Request",available:te},{key:"calls",label:"SDK calls",available:de}].map(d=>d.available?t.jsxs(E,{variant:"outline",size:"sm","aria-expanded":w===d.key,onClick:()=>I(j=>j===d.key?null:d.key),children:[w===d.key?t.jsx(Ue,{className:"h-3.5 w-3.5"}):t.jsx(Ve,{className:"h-3.5 w-3.5"}),d.label]},d.key):null)}),w==="request"&&(V.request_status==="too_large"?t.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof V.request_bytes=="number"?` (${V.request_bytes.toLocaleString()} bytes).`:"."]}):t.jsx(dt,{value:V.request})),w==="calls"&&t.jsx(dt,{value:V.sdk_call_trace})]})})})}function Mn(e,s){const n=e.payload_data??{},a=e.metadata??{};if(s.audit&&typeof n.success=="boolean")return n.success?"completed":"failed";if(s.changeSet)return a.kind==="automation_batch_reject"?"rejected":typeof a.pending_proposal_count!="number"?void 0:a.pending_proposal_count>0?"pending_approval":"completed";if(s.operation)return Ct(e.interaction_status,typeof a.status=="string"?a.status:void 0)}function Dn(e){return e==="pending_approval"?"Needs approval":e==="confirmed"?"Approved":e?fe(e):null}function Fn({presentation:e,primaryContent:s,nativeHeading:n=!1,heading:a,body:r,detailLinks:o,headingAside:l,onFiltersChange:h,content:i,ownerSlug:u,showParentContext:_,connectorDefinitions:m,onRenderedAction:v,runAction:w,memoryActions:I,memoryFeedback:y,auditDetails:p,hideOriginator:C=!1,hideAttribution:q=!1,runId:k,onRunSelect:D,hideDetails:F=!1}){const[M,$]=g.useState(!1),b=i.metadata??{},B=typeof i.score=="number"&&Number.isFinite(i.score)?Math.round(i.score):"-",c=i.payload_type||"text",z=i.text_content||"",T=e==="summary",H=e==null&&(c==="text"||c==="markdown")&&z.length>500,N=H&&!M?`${z.slice(0,500)}...`:z,S=i.payload_data??{},X=kt(i),{audit:A,operation:U,changeSet:be}=X,le=Mn(i,X),Ne=Dn(le),W=(A?Vs(S,S.tool_name):null)??(T&&A&&typeof S.tool_name=="string"?fe(S.tool_name):i.title),x=A&&S.error&&typeof S.error=="object"?S.error.message:void 0,we=(typeof x=="string"?x:void 0)??i.interaction_error??(typeof b.error_message=="string"?b.error_message:void 0),V=we||(A?"":z),[L,ee]=g.useState(e!=="summary"&&A&&s==null&&o==null),Y=A?S.duration_ms:b.duration_ms,te=typeof Y=="number"&&Number.isFinite(Y)&&Y>=0?Y:null,de=A&&typeof S.sdk_call_count=="number"&&Number.isSafeInteger(S.sdk_call_count)&&S.sdk_call_count>=0?S.sdk_call_count:null,G=b.thumbnail_url||b.thumbnail,J=b.media_url,ce=T?[]:jn(b),he=Object.entries(i.classifications||{}).flatMap(([f,R])=>{const pe=Nn(R);return pe.values.map(Ae=>({slug:f,value:Ae,isManual:pe.isManual}))}),ke=(()=>{const f=i.platform||(typeof b.platform=="string"?b.platform:null),R=i.connection_id!=null?i.connection_id:b.source_connection_id!=null?Number(b.source_connection_id):null;return{...i,platform:f,connection_id:R!=null&&Number.isFinite(R)?R:null}})(),ye=(()=>{const f=i.source_url??b.browser_url;if(typeof f!="string"||!URL.canParse(f))return null;const R=new URL(f);return R.protocol==="https:"||R.protocol==="http:"?R:null})(),Q=i.occurred_at?new Date(i.occurred_at):null,Ce=A?Ht:U?xt:be?Kt:i.semantic_type==="notification"?Wt:Yt,K=A?"SDK call":fe(i.semantic_type||i.origin_type||"Event"),Se=t.jsx(gs,{source:ke,connectorDefinitions:m,sourceUrl:ye,label:K,fallback:t.jsx(Ce,{className:"h-4 w-4"})}),se=ce.length>0?t.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:ce.map(([f,R])=>t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-muted-foreground",children:fe(f)}),t.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:vn(R)})]},f))}):null,Z=r?t.jsx("div",{className:"mt-1",children:r}):T?V?t.jsx("p",{className:xe("line-clamp-2 text-sm whitespace-pre-wrap",we&&"text-destructive"),children:V.slice(0,320)}):null:t.jsxs(t.Fragment,{children:[i.rating&&t.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(f=>t.jsx(ft,{className:`h-4 w-4 ${f<=Number(i.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},f))}),G&&t.jsx("a",{href:J||i.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:t.jsx("img",{src:G,alt:"",className:`rounded-md object-cover ${c==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(c){case"markdown":if(N)return t.jsx("div",{className:"max-w-none text-sm space-y-2",children:t.jsx(Gt,{text:N})});break;case"json_template":{const f=i.payload_template;if(f?.root)return t.jsx(fn,{template:f,data:i.payload_data||{},onAction:s?void 0:v},`${u}:${i.id}`);if(N)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:N});break}case"media":return t.jsxs("div",{className:"space-y-3",children:[!G&&J&&t.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:J}),N&&t.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:N})]});case"empty":return t.jsxs("div",{className:"space-y-3",children:[p,se??(p?null:t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"}))]});default:if(N)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:N});break}return t.jsxs("div",{className:"space-y-3",children:[J&&!G&&t.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:J}),se]})})()]}),ue=s!=null||e==="detail"&&A,ne=l!==void 0,me=ue||o!=null;return g.useEffect(()=>{if(!ne||!L)return;const f=R=>{R.key==="Escape"&&(R.preventDefault(),ee(!1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[ne,L]),t.jsxs(t.Fragment,{children:[_&&i.parent_context&&t.jsxs("div",{className:"mb-3 p-2 bg-muted/50 rounded-md text-sm",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Replying to:"}),t.jsx("div",{className:"font-medium",children:i.parent_context.author_name}),t.jsx("div",{className:"text-muted-foreground line-clamp-2",children:i.parent_context.text_content})]}),t.jsxs("div",{className:xe("flex gap-3",e==="detail"&&"mb-5",ne&&"relative"),children:[t.jsx(Zt,{children:Se}),t.jsxs("div",{className:"min-w-0 flex-1",children:[e==="detail"&&(()=>{const f={semanticTypes:[i.semantic_type],...typeof i.automation_id=="number"?{producedByAutomationId:i.automation_id}:{},...typeof i.run_id=="number"?{runIds:[i.run_id]}:{}},R={semantic_types:i.semantic_type,...typeof i.automation_id=="number"?{produced_by:String(i.automation_id)}:{},...typeof i.run_id=="number"?{run_ids:String(i.run_id)}:{}};return t.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[i.semantic_type?h?t.jsx("button",{type:"button",className:"hover:underline",title:`Show all ${K} events`,onClick:()=>h(f),children:K}):u?t.jsx(_e,{to:"/$owner/events",params:{owner:u},search:R,className:"hover:underline",title:`Show all ${K} events`,children:K}):t.jsx("span",{children:K}):t.jsx("span",{children:K}),Q&&t.jsx("time",{dateTime:Q.toISOString(),children:Xt(Q)})]})})(),t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[(a??W)&&!n&&t.jsx("h4",{className:xe("min-w-0 font-medium",e==="detail"?"text-xl leading-snug":"line-clamp-2 text-sm"),children:a??W}),e!=="detail"&&Q&&t.jsx(es,{at:Q}),ne&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1 pt-0.5",children:[l,me&&t.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-muted-foreground hover:text-foreground","aria-expanded":L,onClick:()=>ee(f=>!f),children:["Details",L?t.jsx(Ue,{className:"h-3.5 w-3.5"}):t.jsx(Ve,{className:"h-3.5 w-3.5"})]})]})]}),T&&t.jsx("div",{className:"mt-1 text-muted-foreground",children:Z}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[Ne&&!n&&t.jsxs(ie,{variant:le==="failed"?"destructive":"secondary",className:"gap-1 text-xs",children:[le==="failed"?t.jsx(ht,{className:"h-3 w-3"}):le==="completed"?t.jsx(yt,{className:"h-3 w-3"}):null,Ne]}),de!=null&&t.jsxs("span",{children:[de," SDK ",de===1?"call":"calls"]}),te!=null&&t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(ts,{className:"h-3 w-3"}),te<1e3?`${Math.round(te)}ms`:`${Number((te/1e3).toFixed(2))}s`]}),w,B==="-"||T&&(A||U||be)?null:i.score_breakdown?t.jsxs(ss,{children:[t.jsx(ns,{asChild:!0,children:t.jsx(E,{variant:"ghost",size:"sm",className:"h-7 px-2",children:t.jsx("span",{className:"font-medium",children:B})})}),t.jsx(rs,{className:"w-64",align:"end",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"font-medium",children:"Score Breakdown"}),t.jsx(_n,{breakdown:i.score_breakdown})]})})]}):null,ye&&t.jsxs(as,{children:[t.jsx(is,{asChild:!0,children:t.jsx(E,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1",asChild:!0,children:t.jsxs("a",{href:ye.href,target:"_blank",rel:"noopener noreferrer",children:[t.jsx(gt,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:T?"sr-only":void 0,children:"View original"})]})})}),t.jsx(os,{children:"View original"})]}),I]}),y,u&&!q&&t.jsx(ls,{owner:u,source:ke,connectorDefinitions:m,onFiltersChange:h,variant:"chips",className:"mt-2 text-xs",hideOriginator:C,runId:k,onRunSelect:D}),(i.author_name||!u)&&!(e==="detail"&&U)&&t.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:i.author_name||gn(i)})]}),ne&&L&&me&&t.jsxs("div",{className:"absolute inset-x-0 top-full z-20 mt-2 max-h-[65vh] space-y-3 overflow-y-auto rounded-lg border bg-background p-3 shadow-lg",children:[o,ue&&Z]})]}),!T&&typeof x=="string"&&t.jsx("p",{className:"mb-2 text-sm whitespace-pre-wrap text-destructive",children:x}),s,!T&&!ue&&Z,(ue||o!=null)&&l===void 0&&!(F&&s!=null)&&t.jsxs("details",{className:"mt-5 border-t pt-3",open:L,onToggle:f=>ee(f.currentTarget.open),children:[t.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Details"}),L&&t.jsxs("div",{className:"mt-3 space-y-3",children:[o,ue&&Z]})]}),H&&t.jsx(E,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>$(!M),children:M?t.jsxs(t.Fragment,{children:[t.jsx(Ue,{className:"h-3 w-3 mr-1"})," Show less"]}):t.jsxs(t.Fragment,{children:[t.jsx(Ve,{className:"h-3 w-3 mr-1"})," Show more"]})}),he.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:he.map(f=>t.jsx(bn,{slug:f.slug,value:f.value||"",isManual:f.isManual},f.slug))})]})}export{Yn as E,Wn as R,Fn as a,Kn as b,Jn as c,Hn as r,fe as s,Vs as t,Qn as u};
2
- //# sourceMappingURL=event-card-CBlsG32u.js.map
@@ -1,2 +0,0 @@
1
- import{o as Y,Y as q,r as D,gp as I,f$ as J,j as s,c6 as M,L as Q}from"./index-008wj-Pz.js";import{E as W}from"./events-feed-VfU4csn2.js";import{b as X,a as Z,V as z,M as K}from"./view-param-filters-DkX4YdDT.js";import{u as ee}from"./event-card-CBlsG32u.js";const se={},te="calc(100dvh - 120px)";function oe({owner:n,organizationId:o,eventId:c,viewKey:r,params:p,onParamsChange:d,onSelectView:g,dense:h=!1,fullBleed:k=!1}){const{isAuthenticated:y,isReady:E}=Y(),{data:O,isLoading:w}=q(),P=O?.some(t=>t.id===o&&t.is_member),i=n!=="me"&&o!==null&&E&&y&&!w&&P,a=ee(i?{slug:n,organizationId:o}:null,c),[j,L]=D.useState(se),[T,b]=D.useState(null),m=I(a.views,r),e=i&&!a.isLoading&&!a.isError&&m.kind==="view"?m.view:null,v=e?`${J(n,e.key)}/${e.content_hash}/${e.eventId}`:null,f=e!==null&&T===v,V=M(n,c),F=n!=="me"&&(!E||y&&(w||a.isLoading)),H=e!==null&&!f&&!F,u=k&&H,U=(k||h)&&H,N=F?s.jsx("div",{role:"status",className:"py-8 text-sm text-muted-foreground",children:"Loading event view…"}):e&&!f?s.jsxs(s.Fragment,{children:[s.jsx(X,{decls:e.params,params:p??j,onParamsChange:t=>d?d(e.key,t,{replace:!1}):L(t)}),s.jsx(Z,{orgSlug:n,viewKey:e.key,scope:{event:e.eventId},params:p??j,onParamsChange:t=>d?d(e.key,t):L(t),onLoadError:()=>b(v),contentHash:e.content_hash,title:e.name,minHeight:h?240:320,fixedHeight:U?te:void 0},v)]}):void 0;return s.jsxs("div",{className:u?"w-full space-y-3":"mx-auto w-full max-w-3xl space-y-3",...u?{"data-testid":"event-view-fullbleed"}:{},children:[i&&a.isError&&s.jsx(z,{onRetry:a.refetch}),(i||n==="me"&&r)&&!a.isLoading&&!a.isError&&m.kind==="missing"&&s.jsx(K,{viewKey:m.key,backTo:V,backLabel:"Back to the event"}),f&&s.jsxs("div",{role:"alert",className:"rounded-md border p-3 text-sm",children:[s.jsx("p",{children:"The custom view couldn’t load. The event content is shown below."}),s.jsx("button",{type:"button",className:"mt-2 underline",onClick:()=>b(null),children:"Retry custom view"})]}),s.jsx(W,{presentation:"detail",organizationId:o,ownerSlug:n,filters:{contentIds:[c],...n==="me"?{sortBy:"date",sortOrder:"desc"}:{}},hideDetails:h,renderDetail:t=>{const x=N!=null&&(t==null||!!r),A=(i?a.views:[]).filter(l=>!x||l.key!==e?.key).map(l=>({key:l.key,name:l.name,href:M(n,c,l.key)})),S=l=>l.length?s.jsx("nav",{"aria-label":"Event views",className:"flex flex-wrap gap-3 text-sm",children:l.map(({key:R,name:C,href:B})=>s.jsx(Q,{to:B,className:"underline",onClick:g?G=>{G.preventDefault(),g(B)}:void 0,children:C},R))}):null,$=[...A],_=[...A];return i&&r&&t!=null&&_.unshift({key:":event",name:"Event details",href:V}),{content:x?N:t,nativeHeading:!x&&t!=null,headingAside:u?S($):void 0,links:u?null:S(_)}}})]})}export{oe as E};
2
- //# sourceMappingURL=event-detail-BKSGEOdW.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,cY as C,W as T,dl as j,dF as O,h as g,r as m,B as h,dG as N,dH as b,I as y,dI as k,X as z,dJ as S,dK as D,dL as B,l as I,dM as F,dN as E,dO as L,dP as $,cX as R}from"./index-008wj-Pz.js";import{a as _,C as H,s as Q}from"./calendar-DDCCSPW6.js";function w(s,t,n){return _(s,-t,n)}function A({selected:s}){return e.jsx(O,{className:g("h-4 w-4 shrink-0",s?"opacity-100":"opacity-0")})}function Y({searchPlaceholder:s,emptyText:t="No options",options:n,selected:o,multiple:r=!1,onSelect:a}){return{kind:"list",searchPlaceholder:s,emptyText:t,items:u=>n.map(l=>{const i=o.includes(l.value);return e.jsxs(C,{value:`${l.label} ${l.keywords??l.value}`,onSelect:()=>{a(l.value),r||u()},className:"gap-2",children:[r?e.jsx(T,{checked:i,className:"mr-1"}):e.jsx(A,{selected:i}),l.icon,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.label}),l.count!=null?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:l.count.toLocaleString()}):null]},l.value)})}}function Z([s,t],n,o){return s<=n?`≤ ${t}`:t>=o?`≥ ${s}`:`${s}–${t}`}function G({value:s,min:t,max:n,onApply:o,close:r}){const[a,u]=m.useState(String(s?.[0]??t)),[l,i]=m.useState(String(s?.[1]??n)),[c,f]=m.useState(),d=x=>{x.preventDefault();const p=Number(a),v=Number(l);if(!Number.isFinite(p)||!Number.isFinite(v)){f("Enter a number.");return}if(p<t||v>n){f(`Use values between ${t} and ${n}.`);return}if(p>v){f("The lower bound must not exceed the upper bound.");return}o([p,v]),r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:d,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2",children:[e.jsx(y,{"aria-label":"From",type:"number",min:t,max:n,value:a,onChange:x=>u(x.target.value)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"to"}),e.jsx(y,{"aria-label":"To",type:"number",min:t,max:n,value:l,onChange:x=>i(x.target.value)})]}),c?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:c}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ee(s){return{kind:"custom",render:t=>e.jsx(G,{...s,close:t})}}const U=[{label:"Today",range:()=>[N(new Date),b(new Date)]},{label:"Last 7 days",range:()=>[N(w(new Date,6)),b(new Date)]},{label:"Last 30 days",range:()=>[N(w(new Date,29)),b(new Date)]},{label:"This month",range:()=>[Q(new Date),b(new Date)]}];function se([s,t]){return j(s,"yyyy-MM-dd")===j(t,"yyyy-MM-dd")?j(s,"LLL d, y"):`${j(s,"LLL d")} – ${j(t,"LLL d, y")}`}function V({value:s,onApply:t,close:n}){const[o,r]=m.useState(s?{from:s[0],to:s[1]}:void 0);return e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsx("div",{className:"flex flex-col gap-0.5 border-b p-2 sm:w-36 sm:border-b-0 sm:border-r",children:U.map(a=>e.jsx(h,{variant:"ghost",size:"sm",className:"justify-start font-normal",onClick:()=>{t(a.range()),n()},children:a.label},a.label))}),e.jsx(H,{mode:"range",defaultMonth:o?.from,selected:o,onSelect:a=>{r(a),a?.from&&a.to&&a.from!==a.to&&(t([N(a.from),b(a.to)]),n())},numberOfMonths:1})]})}function te(s){return{kind:"custom",className:"w-auto",render:t=>e.jsx(V,{...s,close:t})}}function W({type:s,label:t,value:n,onApply:o,close:r}){const[a,u]=m.useState(n==null?"":String(n)),[l,i]=m.useState(),c=f=>{if(f.preventDefault(),s==="number"){const d=Number(a);if(a.trim()===""||!Number.isFinite(d)){i("Enter a number.");return}o(d)}else o(a);r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:c,children:[e.jsx(y,{autoFocus:!0,"aria-label":t,type:s,step:s==="number"?"any":void 0,value:a,onChange:f=>u(f.target.value),placeholder:"Enter a value…"}),l?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:l}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ae(s){return{kind:"custom",render:t=>e.jsx(W,{...s,close:t})}}const M="w-72";function P({editor:s,close:t,header:n,footer:o}){const[r,a]=m.useState("");return e.jsxs(e.Fragment,{children:[n,s.kind==="list"?e.jsxs(F,{shouldFilter:!s.onQueryChange,children:[e.jsx(E,{autoFocus:!0,placeholder:s.searchPlaceholder,value:r,onValueChange:u=>{a(u),s.onQueryChange?.(u)}}),e.jsxs(L,{children:[e.jsx($,{children:s.emptyText}),e.jsx(R,{children:s.items(t,r)})]})]}):s.render(t),o]})}function X({chip:s,editor:t}){const[n,o]=m.useState(!1),r=s.onRemove!=null,a=[s.label,s.op,s.value].filter(Boolean).join(" "),u=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:s.label}),s.op?e.jsx("span",{className:"text-muted-foreground",children:s.op}):null,e.jsx("span",{className:"min-w-0 truncate font-medium",children:s.value})]}),l=t?e.jsx(D,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Edit filter: ${a}`,className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1 focus-visible:outline-none",children:u})}):e.jsx("span",{className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1",children:u});return e.jsxs(k,{open:n,onOpenChange:o,children:[e.jsxs("div",{"data-filter-chip":s.id,title:s.title,className:g("inline-flex h-8 max-w-full items-stretch rounded-md border text-sm",s.tone==="warning"?"border-amber-500/60 bg-amber-500/10":r?"bg-muted":"border-dashed bg-transparent",n&&"ring-1 ring-ring",!r&&"pr-1.5"),children:[l,r?e.jsx("button",{type:"button","aria-label":`Remove filter: ${a}`,onClick:s.onRemove,className:"flex w-7 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(z,{className:"h-3.5 w-3.5"})}):null]}),t?e.jsx(S,{align:"start",className:g("p-0",M,t.className),children:e.jsx(P,{editor:t,close:()=>o(!1),footer:r?e.jsx("div",{className:"border-t p-1",children:e.jsx(h,{variant:"ghost",size:"sm",className:"w-full justify-start text-destructive hover:text-destructive",onClick:()=>{o(!1),s.onRemove?.()},children:"Remove filter"})}):null})}):null]})}function q({fields:s}){const[t,n]=m.useState(!1),[o,r]=m.useState(),a=s.find(i=>i.key===o),u=[...new Set(s.map(i=>i.group??""))],l=()=>{n(!1),r(void 0)};return e.jsxs(k,{open:t,onOpenChange:i=>{n(i),i||r(void 0)},children:[e.jsx(D,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"h-8 gap-1.5 font-normal text-muted-foreground",children:[e.jsx(B,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(S,{align:"start",className:g("p-0",M,a?.editor.className),children:a?e.jsx(P,{editor:a.editor,close:l,header:e.jsxs("div",{className:"flex items-center gap-1 border-b px-1 py-1 text-sm font-medium",children:[e.jsx(h,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Back to filters",onClick:()=>r(void 0),children:e.jsx(I,{className:"h-4 w-4"})}),a.label]})},a.key):e.jsxs(F,{children:[e.jsx(E,{autoFocus:!0,placeholder:"Filter by…"}),e.jsxs(L,{children:[e.jsx($,{children:"No matching filter"}),u.map(i=>e.jsx(R,{heading:i||void 0,children:s.filter(c=>(c.group??"")===i).map(c=>e.jsxs(C,{value:`${c.label} ${c.key}`,onSelect:()=>r(c.key),className:"gap-2",children:[c.icon?e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",children:c.icon}):null,c.label]},c.key))},i))]})]})})]})}function ne({fields:s,chips:t,meta:n,actions:o,trailing:r,onClearAll:a,hasClearableState:u=!1,className:l,label:i="Filters"}){const c=s.filter(d=>d.inMenu!==!1),f=t.filter(d=>d.onRemove).length;return e.jsxs("div",{role:"search","aria-label":i,className:g("flex min-w-0 flex-wrap items-center gap-2",l),children:[t.map(d=>e.jsx(X,{chip:d,editor:d.editor??s.find(x=>x.key===(d.field??d.id))?.editor},d.id)),c.length>0?e.jsx(q,{fields:c}):null,o,e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[n?e.jsx("span",{className:"text-sm text-muted-foreground",children:n}):null,a&&(f>0||u)?e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground",onClick:a,children:"Clear all"}):null,r]})]})}export{ne as F,A as S,Z as a,te as d,se as f,Y as o,ee as r,ae as v};
2
- //# sourceMappingURL=filter-bar-COU0sBFQ.js.map
@@ -1,2 +0,0 @@
1
- import{j as t,O as o}from"./index-008wj-Pz.js";function n(){return t.jsx(o,{})}export{n as component};
2
- //# sourceMappingURL=guardrails-6ZJv1uzM.js.map
@@ -1,2 +0,0 @@
1
- import{iQ as t,j as n}from"./index-008wj-Pz.js";import{a as i}from"./agents-workbench-CmGrMvPC.js";import"./agent-editor-form-QrIDroFL.js";import"./model-selector-3l9lY50C.js";import"./proposal-review-shell-CVkLnnKo.js";import"./runs-lG2ChtOt.js";function d(){const{owner:o,agentId:r}=t.useParams(),e=t.useSearch();return n.jsx(i,{owner:o,agentId:r,tab:"identity",runId:e.run_id})}export{d as component};
2
- //# sourceMappingURL=identity-BaFLmbSo.js.map