@lobu/runtime-server 21.2.1 → 23.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/dist/catalogs/automations.json +40 -13
  2. package/dist/catalogs/connectors.json +18435 -1259
  3. package/dist/catalogs/skills.json +1 -1
  4. package/dist/component.json +1 -1
  5. package/dist/connectors/README.md +21 -6
  6. package/dist/connectors/_google/actions.ts +270 -0
  7. package/dist/connectors/_google/discovery/calendar_v3.json +1 -0
  8. package/dist/connectors/_google/discovery/chat_v1.json +1 -0
  9. package/dist/connectors/_google/discovery/docs_v1.json +1 -0
  10. package/dist/connectors/_google/discovery/drive_v3.json +1 -0
  11. package/dist/connectors/_google/discovery/gmail_v1.json +1 -0
  12. package/dist/connectors/_google/discovery/people_v1.json +1 -0
  13. package/dist/connectors/_google/discovery/sheets_v4.json +1 -0
  14. package/dist/connectors/_google/discovery/tasks_v1.json +1 -0
  15. package/dist/connectors/_google/discovery/youtube_v3.json +1 -0
  16. package/dist/connectors/_google/discovery.ts +442 -0
  17. package/dist/connectors/_google/errors.ts +91 -0
  18. package/dist/connectors/_google/list-feed.ts +223 -0
  19. package/dist/connectors/_google/policies.ts +127 -0
  20. package/dist/connectors/agentid.ts +43 -0
  21. package/dist/connectors/chat-user-identity.ts +2 -1
  22. package/dist/connectors/github-automation-events.ts +9 -0
  23. package/dist/connectors/github-identity.ts +28 -3
  24. package/dist/connectors/github.ts +101 -59
  25. package/dist/connectors/google_calendar.ts +207 -719
  26. package/dist/connectors/google_drive.ts +16 -2
  27. package/dist/connectors/google_gmail.ts +52 -33
  28. package/dist/connectors/herdr.ts +406 -0
  29. package/dist/connectors/jira-helpers.ts +313 -0
  30. package/dist/connectors/jira.ts +35 -227
  31. package/dist/connectors/linear.ts +7 -4
  32. package/dist/connectors/linkedin-browser-script.ts +13 -0
  33. package/dist/connectors/linkedin-draft-page.js +104 -0
  34. package/dist/connectors/linkedin-drafts.ts +73 -0
  35. package/dist/connectors/linkedin-identity.ts +32 -0
  36. package/dist/connectors/linkedin-inbox-adapter.js +1185 -0
  37. package/dist/connectors/linkedin-inbox.ts +156 -0
  38. package/dist/connectors/linkedin-like.ts +114 -0
  39. package/dist/connectors/linkedin-takeout.ts +577 -0
  40. package/dist/connectors/linkedin.ts +3998 -0
  41. package/dist/connectors/postgres.ts +27 -2
  42. package/dist/connectors/takeout-utils.ts +240 -0
  43. package/dist/connectors/tiktok-inbox-page.js +230 -0
  44. package/dist/connectors/tiktok-web-page.js +217 -0
  45. package/dist/connectors/tiktok_web.ts +319 -0
  46. package/dist/connectors/whatsapp-web-adapter.js +285 -567
  47. package/dist/connectors/whatsapp-web-helpers.ts +74 -455
  48. package/dist/connectors/whatsapp-web-identity.ts +135 -0
  49. package/dist/connectors/whatsapp_web.ts +159 -618
  50. package/dist/connectors/x-dm-adapter.js +556 -0
  51. package/dist/connectors/x-identity.ts +31 -2
  52. package/dist/connectors/x.ts +539 -253
  53. package/dist/db/migrations/20261005150000_retire_agent_tool_config.sql +31 -0
  54. package/dist/db/migrations/20261005173700_drop_retired_agent_tool_config.sql +29 -0
  55. package/dist/db/migrations/20261007010000_identity_association_guards.sql +242 -0
  56. package/dist/db/migrations/20261007010001_identity_association_indexes.sql +35 -0
  57. package/dist/db/migrations/20261007012000_connector_browser_requirement.sql +7 -0
  58. package/dist/db/migrations/20261009010000_identity_member_decision_indexes.sql +22 -0
  59. package/dist/db/migrations/20261009015900_retire_remaining_physical_merges.sql +196 -0
  60. package/dist/db/migrations/20261009020000_retire_physical_entity_merge.sql +82 -0
  61. package/dist/db/migrations/20261009030000_retire_physical_merge_indexes.sql +39 -0
  62. package/dist/db/migrations/20261009030001_drop_physical_entity_redirect.sql +62 -0
  63. package/dist/db/migrations/20261009040000_normalize_identity_decisions.sql +60 -0
  64. package/dist/db/migrations/20261010220000_notification_targets_user_event_order.sql +53 -0
  65. package/dist/db/migrations/20261010223000_device_workers_user_fresh_cover.sql +39 -0
  66. package/dist/db/migrations/20261010223001_runs_org_default_view.sql +41 -0
  67. package/dist/db/migrations/20261010223002_events_org_guidance.sql +42 -0
  68. package/dist/db/migrations/20261011002000_finish_product_eval_retirement.sql +37 -0
  69. package/dist/db/migrations/20261011160000_mcp_conversation_workspaces.sql +97 -0
  70. package/dist/db/migrations/20261013120000_events_live_org_effective_date.sql +42 -0
  71. package/dist/db/migrations/20261013150000_events_live_linked_org_ids_gin.sql +41 -0
  72. package/dist/db/migrations/20261014120000_clear_team_device_auto_pause.sql +34 -0
  73. package/dist/db/migrations/20261014150000_connector_webhook_event_type_backfill.sql +30 -0
  74. package/dist/db/migrations/20261014170000_retire_atlassian_mcp_webhook_refresh.sql +51 -0
  75. package/dist/db/migrations/20261015010000_connection_auth_profile_fk_set_null_column.sql +53 -0
  76. package/dist/db/migrations/20261015120000_personal_org_connector_auto_policy.sql +38 -0
  77. package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
  78. package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
  79. package/dist/db/migrations/preconditions/20261005150000_retire_agent_tool_config.sql +22 -0
  80. package/dist/db/migrations/preconditions/20261005173700_drop_retired_agent_tool_config.sql +13 -0
  81. package/dist/db/migrations/preconditions/20261009020000_retire_physical_entity_merge.sql +26 -0
  82. package/dist/db/migrations/preconditions/20261011002000_finish_product_eval_retirement.sql +14 -0
  83. package/dist/dependencies.bun.lock +144 -137
  84. package/dist/guest.bundle.js +416 -330
  85. package/dist/owletto/dist/assets/_-3J-IrxWk.js +2 -0
  86. package/dist/owletto/dist/assets/_-DYUE3ix4.js +3 -0
  87. package/dist/owletto/dist/assets/_-DtqBFgK5.js +1 -0
  88. package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +2 -0
  89. package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +2 -0
  90. package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +2 -0
  91. package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +2 -0
  92. package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +2 -0
  93. package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +2 -0
  94. package/dist/owletto/dist/assets/_deploymentId-BuUzGtVL.js +2 -0
  95. package/dist/owletto/dist/assets/_eventId-B0662F8h.js +2 -0
  96. package/dist/owletto/dist/assets/_name-CwWePlOl.js +2 -0
  97. package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +3 -0
  98. package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +2 -0
  99. package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +2 -0
  100. package/dist/owletto/dist/assets/_slug-DQHutM41.js +2 -0
  101. package/dist/owletto/dist/assets/_threadId-DtqBFgK5.js +1 -0
  102. package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +2 -0
  103. package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +2 -0
  104. package/dist/owletto/dist/assets/accept-invitation-w17IFTtf.js +2 -0
  105. package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +2 -0
  106. package/dist/owletto/dist/assets/agent-card-controls-mnTN2AZt.js +2 -0
  107. package/dist/owletto/dist/assets/{agent-client-setup-list-BFtgRwe8.js → agent-client-setup-list-Bg3hBfUV.js} +4 -3
  108. package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +2 -0
  109. package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +2 -0
  110. package/dist/owletto/dist/assets/agent-guardrails-route-BOrCXcAl.js +2 -0
  111. package/dist/owletto/dist/assets/agent-loading-shells-Dqcvky-k.js +2 -0
  112. package/dist/owletto/dist/assets/agent-permissions-matrix-BOo_4r_4.js +2 -0
  113. package/dist/owletto/dist/assets/{agent-skill-context-BAr2Dw3F.js → agent-skill-context-CCdvtlmH.js} +2 -1
  114. package/dist/owletto/dist/assets/agent-skills-route-BUxIswuq.js +2 -0
  115. package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +2 -0
  116. package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +6 -0
  117. package/dist/owletto/dist/assets/agents-9XjpDj_S.js +2 -0
  118. package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +2 -0
  119. package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +128 -0
  120. package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +2 -0
  121. package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +2 -0
  122. package/dist/owletto/dist/assets/automations-9XjpDj_S.js +2 -0
  123. package/dist/owletto/dist/assets/{callback-CaRe2TOT.js → callback-BRgcL8gz.js} +2 -1
  124. package/dist/owletto/dist/assets/{card-CMmh2mzo.js → card-Djgp00r_.js} +2 -1
  125. package/dist/owletto/dist/assets/claim-BYUZnyMp.js +2 -0
  126. package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +1 -0
  127. package/dist/owletto/dist/assets/clients-D3Zbjxin.js +2 -0
  128. package/dist/owletto/dist/assets/code-editor-DHeyRGZI.js +16 -0
  129. package/dist/owletto/dist/assets/connect-CfsFsy9P.js +2 -0
  130. package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +2 -0
  131. package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +2 -0
  132. package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +2 -0
  133. package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +2 -0
  134. package/dist/owletto/dist/assets/connection-C3XXFEqh.js +2 -0
  135. package/dist/owletto/dist/assets/connection-feed-detail-CIJJLDP8.js +2 -0
  136. package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +1 -0
  137. package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +2 -0
  138. package/dist/owletto/dist/assets/{connector-provenance-BjKiUhYE.js → connector-provenance-8-d8hl10.js} +2 -1
  139. package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +2 -0
  140. package/dist/owletto/dist/assets/{connectors-Baejya0T.js → connectors-lvLJ30lo.js} +2 -1
  141. package/dist/owletto/dist/assets/consent-CdSvVCgx.js +2 -0
  142. package/dist/owletto/dist/assets/conversations-table-BdXoZAfc.js +2 -0
  143. package/dist/owletto/dist/assets/{core.esm-QA7BQgiK.js → core.esm-CYvgWCuv.js} +2 -1
  144. package/dist/owletto/dist/assets/create-0xW9eXxG.js +2 -0
  145. package/dist/owletto/dist/assets/create-B0qhrrX4.js +2 -0
  146. package/dist/owletto/dist/assets/create-CAfF-yI1.js +2 -0
  147. package/dist/owletto/dist/assets/create-automation-form-CtSSeYj3.js +3 -0
  148. package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +2 -0
  149. package/dist/owletto/dist/assets/{cronstrue-2GHCtD7h.js → cronstrue-n4qGUraE.js} +2 -1
  150. package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +2 -0
  151. package/dist/owletto/dist/assets/deployments-RvUdVkj3.js +2 -0
  152. package/dist/owletto/dist/assets/{deployments-body-Bm2upStd.js → deployments-body-BMp7UsMo.js} +2 -1
  153. package/dist/owletto/dist/assets/device-CPU6CjkJ.js +2 -0
  154. package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +2 -0
  155. package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +2 -0
  156. package/dist/owletto/dist/assets/{entity-options-CrbS6K-i.js → entity-options-uXjgT7y9.js} +2 -1
  157. package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +2 -0
  158. package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +2 -0
  159. package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +2 -0
  160. package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +2 -0
  161. package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +2 -0
  162. package/dist/owletto/dist/assets/full-page-spinner-DqpH99np.js +2 -0
  163. package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +2 -0
  164. package/dist/owletto/dist/assets/identity-BigVSBCl.js +2 -0
  165. package/dist/owletto/dist/assets/index-B9uPN6FC.js +2 -0
  166. package/dist/owletto/dist/assets/index-BLEcy9-T.css +1 -0
  167. package/dist/owletto/dist/assets/index-BQVliQW1.js +2 -0
  168. package/dist/owletto/dist/assets/index-BfedB4Rc.js +2 -0
  169. package/dist/owletto/dist/assets/index-CDz3-ieP.js +1 -0
  170. package/dist/owletto/dist/assets/index-CUw3aKBI.js +2 -0
  171. package/dist/owletto/dist/assets/index-CXhxUkv3.js +2 -0
  172. package/dist/owletto/dist/assets/index-Cr5hwh-C.js +7950 -0
  173. package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +2 -0
  174. package/dist/owletto/dist/assets/index-DKSx8JN_.js +2 -0
  175. package/dist/owletto/dist/assets/index-DVk7Ug0d.js +2 -0
  176. package/dist/owletto/dist/assets/index-DmZuKGf8.js +2 -0
  177. package/dist/owletto/dist/assets/index-DtqBFgK5.js +1 -0
  178. package/dist/owletto/dist/assets/index-Hio-HRfo.js +2 -0
  179. package/dist/owletto/dist/assets/{index-Cf0GJoiG.js → index-ICgKp3YK.js} +2 -1
  180. package/dist/owletto/dist/assets/index-Vcq4gwWv.js +1 -0
  181. package/dist/owletto/dist/assets/index-cPcroOH0.js +2 -0
  182. package/dist/owletto/dist/assets/{index-DlepU3cY.js → index-n7sTbNv4.js} +2 -1
  183. package/dist/owletto/dist/assets/index-rrnUF981.js +1 -0
  184. package/dist/owletto/dist/assets/index-xiFpcWKv.js +2 -0
  185. package/dist/owletto/dist/assets/json-diff-DBoag_OS.js +4 -0
  186. package/dist/owletto/dist/assets/{list-skeleton-BtWn2eo2.js → list-skeleton-C_GuoxAH.js} +2 -1
  187. package/dist/owletto/dist/assets/login-Ci6ixHuL.js +2 -0
  188. package/dist/owletto/dist/assets/logout-CLGgeZB7.js +2 -0
  189. package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +2 -0
  190. package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +103 -0
  191. package/dist/owletto/dist/assets/model-selector-dAbDgJvx.js +2 -0
  192. package/dist/owletto/dist/assets/models-DpVP7ZwX.js +2 -0
  193. package/dist/owletto/dist/assets/new-BUb7AnEW.js +2 -0
  194. package/dist/owletto/dist/assets/new-BkdULx2r.js +2 -0
  195. package/dist/owletto/dist/assets/new-CHOr-EcI.js +2 -0
  196. package/dist/owletto/dist/assets/oauth-workspace-access-BxsjwgdH.js +2 -0
  197. package/dist/owletto/dist/assets/organization-gxGeDjIV.js +2 -0
  198. package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +2 -0
  199. package/dist/owletto/dist/assets/{permissions-h_qSft1A.js → permissions-aPHaKLec.js} +2 -1
  200. package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +2 -0
  201. package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +2 -0
  202. package/dist/owletto/dist/assets/{recent-JiBNvZzD.js → recent-D-65Pgu-.js} +2 -1
  203. package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +2 -0
  204. package/dist/owletto/dist/assets/{renderer-DgPLyEbx.js → renderer-mEDnVW0O.js} +28 -27
  205. package/dist/owletto/dist/assets/reset-password-uX_V6bip.js +2 -0
  206. package/dist/owletto/dist/assets/runs-C0rCgGwX.js +2 -0
  207. package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +2 -0
  208. package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +2 -0
  209. package/dist/owletto/dist/assets/settings-9NkNA1G1.js +2 -0
  210. package/dist/owletto/dist/assets/settings-E-10sLQX.js +2 -0
  211. package/dist/owletto/dist/assets/skill-editor-D_W3QlRz.js +1 -0
  212. package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +2 -0
  213. package/dist/owletto/dist/assets/source-record-panels-CPyzlfD1.js +2 -0
  214. package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +2 -0
  215. package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +2 -0
  216. package/dist/owletto/dist/assets/{use-mention-search-B4DfZFm5.js → use-mention-search-By8RZyKW.js} +3 -2
  217. package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.js +2 -0
  218. package/dist/owletto/dist/assets/workspace-label-o_QfBuCM.js +2 -0
  219. package/dist/owletto/dist/index.html +46 -4
  220. package/dist/providers.json +1 -1
  221. package/dist/server-main.bundle.mjs +137029 -133673
  222. package/npm-shrinkwrap.json +612 -645
  223. package/package.json +4 -3
  224. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  225. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  226. package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
  227. package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
  228. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  229. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  230. package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
  231. package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
  232. package/vendor/connector-sdk/dist/connector-types.d.ts +169 -45
  233. package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
  234. package/vendor/connector-sdk/dist/define-connector.js +3 -0
  235. package/vendor/connector-sdk/dist/index.d.ts +8 -2
  236. package/vendor/connector-sdk/dist/index.js +3 -0
  237. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
  238. package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
  239. package/vendor/connector-sdk/package.json +13 -1
  240. package/vendor/core/dist/agent-policy.js +1 -1
  241. package/vendor/core/dist/agent-store.d.ts +2 -0
  242. package/vendor/core/dist/agent-tooling.d.ts +1 -1
  243. package/vendor/core/dist/agent-tooling.js +1 -1
  244. package/vendor/core/dist/capabilities.d.ts +1 -1
  245. package/vendor/core/dist/capabilities.js +2 -1
  246. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  247. package/vendor/core/dist/connector-query-errors.js +41 -1
  248. package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
  249. package/vendor/core/dist/contracts/agent-settings.js +1 -7
  250. package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
  251. package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
  252. package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
  253. package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
  254. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
  255. package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
  256. package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
  257. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
  258. package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
  259. package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
  260. package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
  261. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  262. package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
  263. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
  264. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
  265. package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
  266. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  267. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  268. package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
  269. package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
  270. package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
  271. package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
  272. package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
  273. package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
  274. package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
  275. package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
  276. package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
  277. package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
  278. package/vendor/core/dist/contracts/worker/protocol.d.ts +130 -159
  279. package/vendor/core/dist/contracts/worker/protocol.js +88 -76
  280. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  281. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  282. package/vendor/core/dist/index.d.ts +5 -5
  283. package/vendor/core/dist/index.js +4 -6
  284. package/vendor/core/dist/json-template.d.ts +6 -10
  285. package/vendor/core/dist/json-template.js +5 -9
  286. package/vendor/core/dist/logger.js +17 -26
  287. package/vendor/core/dist/shell-safety.d.ts +9 -0
  288. package/vendor/core/dist/shell-safety.js +154 -0
  289. package/vendor/core/dist/suggestions.d.ts +1 -1
  290. package/vendor/core/dist/suggestions.js +1 -1
  291. package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
  292. package/vendor/core/dist/tool-trace-summary.js +1 -1
  293. package/vendor/core/dist/types.d.ts +1 -3
  294. package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
  295. package/vendor/core/dist/utils/diagnostic-scrubber.js +437 -0
  296. package/vendor/core/dist/worker/auth.d.ts +44 -6
  297. package/vendor/core/dist/worker/auth.js +44 -11
  298. package/vendor/core/dist/worker/wire.d.ts +0 -10
  299. package/vendor/core/package.json +20 -11
  300. package/vendor/views/dist/api.d.ts +39 -29
  301. package/vendor/views/dist/api.js +110 -83
  302. package/vendor/views/dist/bridge.d.ts +4 -0
  303. package/vendor/views/dist/bridge.js +15 -0
  304. package/vendor/views/dist/index.d.ts +1 -0
  305. package/vendor/views/dist/index.js +0 -7
  306. package/vendor/views/package.json +4 -1
  307. package/dist/owletto/dist/assets/_-CLhipgJI.js +0 -1
  308. package/dist/owletto/dist/assets/_-D0ZVGAIA.js +0 -2
  309. package/dist/owletto/dist/assets/_agentId-BLXUf3ot.js +0 -1
  310. package/dist/owletto/dist/assets/_agentId-DnI66MF3.js +0 -1
  311. package/dist/owletto/dist/assets/_automationId-ziwseLb7.js +0 -1
  312. package/dist/owletto/dist/assets/_connectorKey._connectionId-B6V3ySFK.js +0 -1
  313. package/dist/owletto/dist/assets/_connectorKey.index-CR5u_dtt.js +0 -1
  314. package/dist/owletto/dist/assets/_conversationId-FBMYmOl8.js +0 -1
  315. package/dist/owletto/dist/assets/_deploymentId-DNTXbT_m.js +0 -1
  316. package/dist/owletto/dist/assets/_name-B37LKIxH.js +0 -1
  317. package/dist/owletto/dist/assets/_owner-BxYumqC2.js +0 -1
  318. package/dist/owletto/dist/assets/_shape-Bxz-04jR.js +0 -1
  319. package/dist/owletto/dist/assets/_skillKey-D5MFbiw2.js +0 -1
  320. package/dist/owletto/dist/assets/_slug-Dlhit09k.js +0 -1
  321. package/dist/owletto/dist/assets/_viewKey-C6535i-t.js +0 -1
  322. package/dist/owletto/dist/assets/_viewKey-CQCtY3Y8.js +0 -1
  323. package/dist/owletto/dist/assets/_viewKey-CxKfKbRa.js +0 -1
  324. package/dist/owletto/dist/assets/accept-invitation-BQQwec3R.js +0 -1
  325. package/dist/owletto/dist/assets/activity-route-view-BwThvdGs.js +0 -1
  326. package/dist/owletto/dist/assets/agent-card-controls-B3RhzsPz.js +0 -1
  327. package/dist/owletto/dist/assets/agent-connect-pages-BO4wQn4L.js +0 -1
  328. package/dist/owletto/dist/assets/agent-editor-form-BYC4uSNz.js +0 -1
  329. package/dist/owletto/dist/assets/agent-guardrails-route-Dp02G1AQ.js +0 -1
  330. package/dist/owletto/dist/assets/agent-loading-shells-OagauQzV.js +0 -1
  331. package/dist/owletto/dist/assets/agent-permissions-matrix-B9Ho3P1t.js +0 -1
  332. package/dist/owletto/dist/assets/agent-skills-route-B4VUnVi0.js +0 -1
  333. package/dist/owletto/dist/assets/agent-subpage-shell-Dz8I-GUt.js +0 -1
  334. package/dist/owletto/dist/assets/agent-thread-B9-cdkaV.js +0 -8
  335. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -1
  336. package/dist/owletto/dist/assets/agents-D0CIg4b9.js +0 -1
  337. package/dist/owletto/dist/assets/agents-workbench-C2sr5h82.js +0 -1
  338. package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +0 -127
  339. package/dist/owletto/dist/assets/app._appId-DLsJ_QWS.js +0 -1
  340. package/dist/owletto/dist/assets/automation-detail-content-9Rjb_I9j.js +0 -1
  341. package/dist/owletto/dist/assets/automations-D0CIg4b9.js +0 -1
  342. package/dist/owletto/dist/assets/calendar-DAiyi1ZL.js +0 -1
  343. package/dist/owletto/dist/assets/claim-CYHnUF7G.js +0 -1
  344. package/dist/owletto/dist/assets/clients-Cp1BJ28u.js +0 -1
  345. package/dist/owletto/dist/assets/code-editor-CYsR2VBP.js +0 -15
  346. package/dist/owletto/dist/assets/connect-CZip2g_B.js +0 -1
  347. package/dist/owletto/dist/assets/connect._clientId-CEKY8Dnv.js +0 -1
  348. package/dist/owletto/dist/assets/connected._clientId-C5xRjxNO.js +0 -1
  349. package/dist/owletto/dist/assets/connection-C06HZ241.js +0 -1
  350. package/dist/owletto/dist/assets/connection-feed-detail-D1whY5hL.js +0 -1
  351. package/dist/owletto/dist/assets/consent-CfYDldcF.js +0 -1
  352. package/dist/owletto/dist/assets/create-C3P-3_8O.js +0 -1
  353. package/dist/owletto/dist/assets/create-CwnrPUEw.js +0 -1
  354. package/dist/owletto/dist/assets/create-DOScS9Gl.js +0 -1
  355. package/dist/owletto/dist/assets/create-automation-form-CuxiIRCF.js +0 -2
  356. package/dist/owletto/dist/assets/create._connectorKey-Bjv3lCf8.js +0 -1
  357. package/dist/owletto/dist/assets/deployments-ByBv1DW-.js +0 -1
  358. package/dist/owletto/dist/assets/deployments-C-_ECORv.js +0 -1
  359. package/dist/owletto/dist/assets/device-B0i7Xp8y.js +0 -1
  360. package/dist/owletto/dist/assets/device-automation-BIjs7DZJ.js +0 -1
  361. package/dist/owletto/dist/assets/device-pin-tombstone-Bd6vS2zu.js +0 -1
  362. package/dist/owletto/dist/assets/device-rows-Bwf8qDte.js +0 -1
  363. package/dist/owletto/dist/assets/device._deviceId-DJLAesm3.js +0 -1
  364. package/dist/owletto/dist/assets/entity-page-ijZe_1-6.js +0 -1
  365. package/dist/owletto/dist/assets/entity-type-page-onp2Tk_E.js +0 -1
  366. package/dist/owletto/dist/assets/event-page-C0B2UDY-.js +0 -1
  367. package/dist/owletto/dist/assets/events-feed-DK35T4g7.js +0 -1
  368. package/dist/owletto/dist/assets/full-page-spinner-Dd8eEaxq.js +0 -1
  369. package/dist/owletto/dist/assets/guardrails-DKO8_J-G.js +0 -1
  370. package/dist/owletto/dist/assets/identity-CKM54vrM.js +0 -1
  371. package/dist/owletto/dist/assets/index--VmN5WxW.js +0 -1
  372. package/dist/owletto/dist/assets/index-B2AmRqYh.js +0 -7898
  373. package/dist/owletto/dist/assets/index-B_rcEgFX.js +0 -1
  374. package/dist/owletto/dist/assets/index-BmAuAhub.css +0 -1
  375. package/dist/owletto/dist/assets/index-BmhGe6-Z.js +0 -1
  376. package/dist/owletto/dist/assets/index-C1dJSGrL.js +0 -1
  377. package/dist/owletto/dist/assets/index-CAFw4qCb.js +0 -1
  378. package/dist/owletto/dist/assets/index-CCcc_xBw.js +0 -52
  379. package/dist/owletto/dist/assets/index-CLU3gXVm.js +0 -1
  380. package/dist/owletto/dist/assets/index-CqQVnAY-.js +0 -1
  381. package/dist/owletto/dist/assets/index-CxT0uyIe.js +0 -1
  382. package/dist/owletto/dist/assets/index-DR08e6Ec.js +0 -1
  383. package/dist/owletto/dist/assets/index-DYb9L5FC.js +0 -1
  384. package/dist/owletto/dist/assets/index-SUUcQGT-.js +0 -1
  385. package/dist/owletto/dist/assets/index-SdiFOfR1.js +0 -1
  386. package/dist/owletto/dist/assets/index-zcfi5r1l.js +0 -1
  387. package/dist/owletto/dist/assets/json-diff-ClBBYBQD.js +0 -3
  388. package/dist/owletto/dist/assets/login-d3PdO-qV.js +0 -1
  389. package/dist/owletto/dist/assets/logout-DgckxwLn.js +0 -1
  390. package/dist/owletto/dist/assets/member-scope-gate-DXOCfx-v.js +0 -1
  391. package/dist/owletto/dist/assets/memory-browse-page-CeAnKoTR.js +0 -101
  392. package/dist/owletto/dist/assets/missing-view-DrZ8m8yo.js +0 -1
  393. package/dist/owletto/dist/assets/model-selector-CapL1ARf.js +0 -1
  394. package/dist/owletto/dist/assets/models-CB8mhq7j.js +0 -1
  395. package/dist/owletto/dist/assets/new-BBUb-VR4.js +0 -1
  396. package/dist/owletto/dist/assets/new-CBLJ25_w.js +0 -1
  397. package/dist/owletto/dist/assets/new-tTXB4qBW.js +0 -1
  398. package/dist/owletto/dist/assets/oauth-workspace-access-DearynqZ.js +0 -1
  399. package/dist/owletto/dist/assets/organization-BgdBg-PJ.js +0 -1
  400. package/dist/owletto/dist/assets/pending-seed-CPbfgnLX.js +0 -1
  401. package/dist/owletto/dist/assets/proposal-review-shell-D4YNrrye.js +0 -1
  402. package/dist/owletto/dist/assets/reset-password-B8tWPtIj.js +0 -1
  403. package/dist/owletto/dist/assets/runs-oHveuEUB.js +0 -1
  404. package/dist/owletto/dist/assets/runs-panel-C56GDaJm.js +0 -1
  405. package/dist/owletto/dist/assets/runs-table-BUKDjiBc.js +0 -1
  406. package/dist/owletto/dist/assets/schema-value-normalization-3JuM_r1H.js +0 -1
  407. package/dist/owletto/dist/assets/settings-DaKg6U5O.js +0 -1
  408. package/dist/owletto/dist/assets/settings-DhnRi2nq.js +0 -1
  409. package/dist/owletto/dist/assets/skills-BpQncuMC.js +0 -1
  410. package/dist/owletto/dist/assets/switch-BQ40_DMb.js +0 -1
  411. package/dist/owletto/dist/assets/use-applied-views-B-Z-Weji.js +0 -1
  412. package/dist/owletto/dist/assets/view-frame-C7ciEoLo.js +0 -1
  413. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  414. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
  415. package/vendor/core/dist/sentry.d.ts +0 -26
  416. package/vendor/core/dist/sentry.js +0 -133
  417. package/vendor/core/dist/tool-policy.d.ts +0 -74
  418. package/vendor/core/dist/tool-policy.js +0 -305
  419. package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
  420. package/vendor/core/dist/utils/sentry-scrubber.js +0 -228
@@ -0,0 +1,2 @@
1
+ import{aw as v,ax as N,j as s,fe as y,ck as m,dd as p,P as f,B as w,fg as b}from"./index-Cr5hwh-C.js";function M(o,r){const l=new Map(r.map(e=>[e.slug,e])),i=new Map,d=e=>{const a=e.model?.trim();if(!a)return;const t=`${e.slug}/${a}`;i.has(t)||i.set(t,{value:t,provider:e.provider,model:a,isDefault:e.isDefault})};for(const e of o){const a=l.get(e.kind)??l.get(e.slug),t={slug:e.slug,provider:e.displayName||e.slug,isDefault:e.isDefault};d({...t,model:e.capabilities.text?.model}),d({...t,model:a?.defaultModel});for(const x of a?.models??[])d({...t,model:x})}for(const e of r){if(!e.systemAvailable)continue;const a={slug:e.slug,provider:e.displayName||e.slug,isDefault:!1};d({...a,model:e.defaultModel});for(const t of e.models)d({...a,model:t})}return[...i.values()]}function _(o,r){const l=o.trim();return l.length>0&&l!=="auto"&&!r.some(i=>i.value===l)}function S({value:o,onChange:r,placeholder:l,disabled:i,className:d}){const{data:e=[]}=v(),{data:a=[]}=N(),t=M(e,a),x=t.find(c=>c.value===o),h=o==="auto"?"auto":x?.value??o;return s.jsx(y,{contentClassName:"w-[--radix-popover-trigger-width] min-w-[280px]",searchPlaceholder:"Search or type a model ref…",emptyText:"Type a full provider/model ref to use it.",trigger:c=>s.jsxs(w,{type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:i,className:f("w-full justify-between font-normal",o?"":"text-muted-foreground",d),children:[s.jsx("span",{className:"truncate",children:o?h:l}),s.jsx(b,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(c,j)=>{const u=j.trim(),g=_(u,t);return s.jsxs(s.Fragment,{children:[s.jsxs(m,{value:"__inherit__ use default inherit",onSelect:()=>{r(""),c()},className:"cursor-pointer",children:[s.jsx(p,{className:f("mr-2 h-4 w-4",o===""?"opacity-100":"opacity-0")}),s.jsx("span",{className:"text-muted-foreground",children:l})]}),s.jsxs(m,{value:"auto newest latest",onSelect:()=>{r("auto"),c()},className:"cursor-pointer",children:[s.jsx(p,{className:f("mr-2 h-4 w-4",o==="auto"?"opacity-100":"opacity-0")}),s.jsxs("span",{children:["auto"," ",s.jsx("span",{className:"text-muted-foreground text-xs",children:"(newest for the provider)"})]})]}),t.map(n=>s.jsxs(m,{value:`${n.provider} ${n.model} ${n.value}`,onSelect:()=>{r(n.value),c()},className:"cursor-pointer",children:[s.jsx(p,{className:f("mr-2 h-4 w-4",o===n.value?"opacity-100":"opacity-0")}),s.jsxs("span",{className:"truncate",children:[n.provider," ",s.jsx("span",{className:"text-muted-foreground text-xs",children:n.model}),n.isDefault?s.jsx("span",{className:"ml-1.5 text-muted-foreground text-xs",children:"· org default"}):null]})]},n.value)),g?s.jsxs(m,{value:`__custom__ ${u}`,onSelect:()=>{r(u),c()},className:"cursor-pointer",children:[s.jsx(p,{className:"mr-2 h-4 w-4 opacity-0"}),s.jsxs("span",{children:["Use ",s.jsx("span",{className:"font-mono text-xs",children:u})]})]}):null]})}})}export{S as M,M as b,_ as s};
2
+ //# sourceMappingURL=model-selector-dAbDgJvx.js.map
@@ -0,0 +1,2 @@
1
+ import{ik as e,j as r}from"./index-Cr5hwh-C.js";import{a as m}from"./agents-workbench-Bt5QCYQ7.js";import"./agent-editor-form-hTs7eO_U.js";import"./model-selector-dAbDgJvx.js";import"./proposal-review-shell-UcZr87_Q.js";import"./runs-C0rCgGwX.js";function g(){const{owner:o,agentId:t}=e.useParams();return r.jsx(m,{owner:o,agentId:t,tab:"models"})}export{g as component};
2
+ //# sourceMappingURL=models-DpVP7ZwX.js.map
@@ -0,0 +1,2 @@
1
+ import{gG as o,m as p,Z as x,g as f,t as h,aZ as L,j as e,aB as b,fL as w,af as A,fM as j,L as C,fN as N,ex as S,aQ as k,bQ as y}from"./index-Cr5hwh-C.js";import{A as E}from"./agent-editor-form-hTs7eO_U.js";import"./model-selector-dAbDgJvx.js";const _="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6";function B(){const{owner:a}=o.useParams(),t=o.useSearch(),r=p(),i=x(),{isAuthenticated:c}=f(),{isMember:g,isLoading:m}=h(),n=c&&g,{data:u=[],isLoading:l}=L({enabled:n});return e.jsx("div",{className:_,children:e.jsxs(b,{className:"flex flex-1 flex-col gap-6",children:[e.jsx(w,{breadcrumb:e.jsx(j,{crumbs:[e.jsx(C,{to:"/$owner/agents",params:{owner:a},className:N,children:"Agents"},"agents")]}),icon:e.jsx(A.agents.icon,{className:"h-6 w-6"}),title:"Build a managed agent",caption:"Create an agent that Lobu runs and manages for this workspace."}),m||n&&l?e.jsx(S,{rows:1}):n?e.jsx(E,{mode:{kind:"create"},existingAgentIds:u.map(s=>s.agentId),onCreated:async s=>{const d=["agents",a];if(await i.refetchQueries({queryKey:d,exact:!0}),t.platform&&t.listen){await r({to:"/$owner/automations/new",params:{owner:a},search:{...t,agent:s}});return}await r({to:"/$owner/agents/$agentId/settings",params:{owner:a,agentId:s},search:{run_id:void 0}})}}):e.jsx(k,{icon:y,title:"Workspace membership required",description:"Only workspace members can build managed agents."})]})})}export{B as component};
2
+ //# sourceMappingURL=new-BUb7AnEW.js.map
@@ -0,0 +1,2 @@
1
+ import{m as R,g as E,x as F,r,j as e,y as v,I as S,B as L,z as N,E as U}from"./index-Cr5hwh-C.js";import{C as I,a as A,b as T,c as k}from"./card-Djgp00r_.js";import{F as B}from"./full-page-spinner-DqpH99np.js";function c(l){return l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function H(){const l=R(),{session:u,isReady:d}=E(),{slug:n,name:i}=F.useSearch(),[m,y]=r.useState(i||n||""),[g,h]=r.useState(n||(i?c(i):"")),[b,C]=r.useState(!!n),[x,o]=r.useState(null),[f,p]=r.useState(!1),j=r.useRef(!1);if(r.useEffect(()=>{if(!d||u||j.current)return;j.current=!0;const a=new URL("/orgs/new",window.location.origin);n&&a.searchParams.set("slug",n),i&&a.searchParams.set("name",i);const s=new URL("/auth/login",window.location.origin);s.searchParams.set("callbackUrl",`${a.pathname}${a.search}`),window.location.assign(s.toString())},[d,u,n,i]),!d||!u)return e.jsx(B,{});const P=a=>{const s=U(a);if(s.kind==="cross-host"){window.location.assign(s.href);return}l({to:s.to})},z=async a=>{a.preventDefault(),o(null);const s=m.trim(),w=(g.trim()||c(s)).trim();if(!s){o("Name is required");return}if(!w){o("Slug is required");return}p(!0);try{const t=await N.create({name:s,slug:w});if(t.error){o(t.error.message||"Failed to create organization");return}t.data&&(await N.setActive({organizationId:t.data.id}),P(t.data.slug))}catch(t){o(t instanceof Error?t.message:"An error occurred")}finally{p(!1)}};return e.jsx("div",{className:"container mx-auto max-w-md px-4 py-10",children:e.jsxs(I,{children:[e.jsx(A,{children:e.jsx(T,{children:"Create organization"})}),e.jsx(k,{children:e.jsxs("form",{onSubmit:z,className:"space-y-4",children:[x&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:x}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"org-name",children:["Name",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"org-name",value:m,onChange:a=>{y(a.target.value),b||h(c(a.target.value))},placeholder:"Acme Inc.",autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"org-slug",children:["Slug",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"org-slug",value:g,onChange:a=>{C(!0),h(c(a.target.value))},placeholder:"acme"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in URLs and as the org id in ",e.jsx("code",{children:"lobu.toml"}),". Lowercase letters, numbers, and hyphens."]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(L,{type:"submit",disabled:f,children:f?"Creating…":"Create organization"})})]})})]})})}export{H as component};
2
+ //# sourceMappingURL=new-BkdULx2r.js.map
@@ -0,0 +1,2 @@
1
+ import{m as N,t as j,cN as p,r as x,j as e,B as w,gj as y,ba as _,L as b,S as f,gk as v,ah as C}from"./index-Cr5hwh-C.js";import{C as k,A}from"./create-automation-form-CtSSeYj3.js";import"./cronstrue-n4qGUraE.js";import"./entity-options-uXjgT7y9.js";import"./connection-label-BobuYiAG.js";import"./model-selector-dAbDgJvx.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-DHeyRGZI.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-By8RZyKW.js";function S(s){return s.includes(":")?s.slice(s.indexOf(":")+1):s}function T({prefillAgentId:s,onCancel:t,initialTriggers:m}){const{org:g}=j(),[o,i]=x.useState({ready:!1,triggers:[]}),[a,l]=x.useState(),h=x.useCallback(n=>{i(u=>JSON.stringify(u)===JSON.stringify(n)?u:n)},[]),c=a??m;return e.jsx(k,{startFromScratch:!!m,organizationId:g?.id??"",prefillAgentId:s,onClose:t,onPrefillTriggers:n=>l(n.length>0?n:void 0),onSuccess:t,hideHeader:!0,hideCancel:!0,submitLabel:"Create Automation",submitDisabled:!o.ready,createFields:{triggers:o.triggers},triggerFields:e.jsx(A,{organizationId:g?.id??null,initialTriggers:c,onChange:h},JSON.stringify(c??"new"))})}function B({owner:s,prefilled:t}){const m=N(),{org:g}=j(),o=p(g?.id??null,{status:"active",limit:500}),i=!!(t?.platform&&(t.listen||t.resource)),a=x.useMemo(()=>{if(!t?.platform||!t.listen&&!t.resource)return;const c=o.data??[],n=t.connection?c.find(r=>r.slug===t.connection):(()=>{const r=c.filter(d=>d.connector_key!==t.platform?!1:t.resource?!0:d.facets.chat&&(d.external_tenant_id??"")===(t.team??""));return r.length===1?r[0]:void 0})();if(t.connection&&!n)return;const u=t.events?.split(",").map(r=>r.trim()).filter(Boolean)??[];return[{kind:"event",source:"connector",connector_key:t.platform,...n?{connection_id:n.id}:{},event_types:u.length>0?u:t.listen?["message.created"]:[],match:t.resource?{resource_ref:t.resource,...t.resource_type?{resource_type:t.resource_type}:{}}:{channel_id:S(t.listen??"")},execution:"turn",active_run:t.listen?"steer":"queue",output:t.listen?"reply_to_source":"silent",skip_if_unchanged:!t.listen}]},[o.data,t]),l=()=>void m({to:"/$owner/automations",params:{owner:s}}),h=a?t?.resource?`React to changes on ${t.label??t.resource}.`:`React to messages in ${t?.label??t?.listen}.`:i&&!o.isLoading?"Choose the matching connection and event, then define the reaction.":"Start from a template, from scratch, or clone an existing Automation.";return e.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:e.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs(w,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:l,children:[e.jsx(y,{className:"h-3.5 w-3.5"}),"Automations"]}),e.jsxs("h1",{className:"flex min-w-0 items-center gap-2 truncate font-display text-xl font-semibold",children:[e.jsx(_,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),"New automation"]})]})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:h}),t?.listen&&a?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Choose an agent below, or"," ",e.jsx(b,{to:"/$owner/agents/new",params:{owner:s},search:t,className:"underline underline-offset-4",children:"create an agent"})," ","and return to this conversation setup."]}):null,i&&o.isLoading?e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"h-10 w-full"}),e.jsx(f,{className:"h-32 w-full"})]}):i&&t?.connection&&!a?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"This connection is no longer available. Reopen setup from your conversation."}):e.jsx(T,{prefillAgentId:t?.agent,onCancel:l,initialTriggers:a})]})})}function W(){const{owner:s}=v.useParams(),t=v.useSearch();return e.jsx(C,{owner:s,children:()=>e.jsx(B,{owner:s,prefilled:t})})}export{W as component};
2
+ //# sourceMappingURL=new-CHOr-EcI.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,M as y,P as $,Q as E,B as R,r as u,T as P}from"./index-Cr5hwh-C.js";const W=["mcp:read","mcp:write","mcp:admin"],U=[{value:"read",title:"Read only",description:"Search and view authorized workspace data."},{value:"write",title:"Read and make changes",description:"Includes read access. Create and update authorized workspace data."},{value:"admin",title:"Administer workspaces",description:"Includes read and write access. Manage administrator-only settings.",risk:"high"}],S={read:0,write:1,admin:2};function I(s){return s.includes("mcp:admin")?"admin":s.includes("mcp:write")?"write":s.includes("mcp:read")?"read":null}function D(s,a){const r=s.filter(x=>!W.includes(x));if(!a)return r;const i=I(s);return!i||S[a]>S[i]?r:["mcp:read",...a==="write"||a==="admin"?["mcp:write"]:[],...a==="admin"?["mcp:admin"]:[],...r]}function H({idPrefix:s,clientName:a,requestedScopes:r,accessLevel:i,onAccessLevelChange:x,sensitiveScopesAcknowledged:v=!1,onSensitiveScopesAcknowledgedChange:g,disabled:b=!1}){const k=I(r),f=r.includes("profile:read"),p=r.includes("device_worker:run"),o=r.includes("connections:token"),j=p||o,c=r.filter(n=>!W.includes(n)&&n!=="profile:read"&&n!=="device_worker:run"&&n!=="connections:token");return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{"aria-labelledby":`${s}-application`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-application`,className:"text-sm font-medium",children:"Application"}),e.jsx("div",{className:"rounded-lg border p-4",children:e.jsx("span",{className:"text-sm font-semibold text-foreground",children:a||"Unnamed application"})})]}),k&&e.jsxs("fieldset",{className:"space-y-2",disabled:b,children:[e.jsx("legend",{className:"text-sm font-medium",children:"Access level"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose the maximum access this application should receive."}),e.jsx("div",{className:"space-y-2",children:U.filter(n=>S[n.value]<=S[k]).map(n=>{const l=`${s}-access-${n.value}`,h=i===n.value;return e.jsxs("label",{htmlFor:l,className:$("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors",h&&"border-primary bg-primary/5"),children:[e.jsx("input",{id:l,type:"radio",name:`${s}-access-level`,value:n.value,checked:h,onChange:()=>x(n.value),className:"mt-1 h-4 w-4 accent-primary"}),e.jsxs("span",{className:"min-w-0 space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[n.title,n.risk==="high"&&e.jsx(y,{variant:"destructive",children:"High risk"})]}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:n.description})]})]},n.value)})})]}),f&&e.jsxs("section",{"aria-labelledby":`${s}-profile`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-profile`,className:"text-sm font-medium",children:"Account information"}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:["Basic profile",e.jsx(y,{variant:"secondary",children:"Included"})]}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"See your basic Lobu identity and the names and slugs of workspaces you belong to."})]})]}),c.length>0&&e.jsxs("section",{"aria-labelledby":`${s}-additional`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-additional`,className:"text-sm font-medium",children:"Additional permissions"}),e.jsx("ul",{className:"space-y-2",children:c.map(n=>e.jsx("li",{className:"rounded-md border p-3 font-mono text-xs text-foreground",children:n},n))})]}),j&&e.jsxs("section",{className:"space-y-3 rounded-md border border-destructive/40 bg-destructive/5 p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Device capabilities"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"These capabilities are fixed by the device request and cannot be reduced here."})]}),e.jsxs("ul",{className:"space-y-2",children:[p&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Operate this device"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run jobs and Automations through capabilities advertised by this device."})]}),o&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Use connected services"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Request short-lived access for services you connected to Lobu."})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-background p-3",children:[e.jsx(E,{id:`${s}-sensitive-acknowledgement`,checked:v,disabled:b,onCheckedChange:n=>g?.(n===!0),className:"mt-0.5"}),e.jsx("label",{htmlFor:`${s}-sensitive-acknowledgement`,className:"cursor-pointer text-sm font-medium text-foreground",children:"I initiated this request and confirmed that the device code matches."})]})]})]})}function T({idPrefix:s,orgList:a,selectedOrgIds:r,onWorkspaceAccessChange:i,onSelectedOrgChange:x,orgsLoading:v,orgsError:g,onRetry:b,disabled:k=!1,deviceHomeOrgId:f=null,allowMultiple:p}){const o=`${s}-workspace-access-legend`,j=r.length===a.length;return v?e.jsxs("section",{"aria-labelledby":o,className:"space-y-2",children:[e.jsx("p",{id:o,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:"Loading your workspaces..."})]}):g?e.jsxs("section",{"aria-labelledby":o,className:"space-y-2",children:[e.jsx("p",{id:o,className:"text-sm font-medium",children:"Workspace access"}),e.jsxs("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(R,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:b,children:"Retry"})]})]}):a.length===0?e.jsxs("section",{"aria-labelledby":o,className:"space-y-2",children:[e.jsx("p",{id:o,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"No member workspaces are available for this connection."})]}):e.jsxs("fieldset",{className:"space-y-3",disabled:k,children:[e.jsx("legend",{id:o,className:"sr-only",children:"Workspace access"}),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Workspaces"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:p?"Choose where this application can operate.":"Choose one workspace this application can access."})]}),p&&!j&&e.jsxs(R,{type:"button",variant:"outline",size:"sm",onClick:()=>i("all_current"),children:["Select all ",a.length]})]}),f&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p?"The device workspace is always included. Additional workspaces grant MCP access only.":"MCP access follows the device workspace."}),e.jsx("div",{className:"space-y-2",children:a.map(c=>{const n=`${s}-workspace-${c.id}`,l=c.id===f,h=r.includes(c.id);return e.jsxs("div",{className:$("flex items-start gap-3 rounded-md border p-3 transition-colors",h&&"border-primary/40 bg-primary/5"),children:[e.jsx(E,{id:n,checked:h,disabled:k||l||f!==null&&!p,onCheckedChange:N=>x(c.id,N===!0),className:"mt-0.5"}),e.jsxs("label",{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[c.name,c.isPersonal&&e.jsx(y,{variant:"outline",children:"Personal"}),l&&e.jsx(y,{variant:"secondary",children:"Device workspace"})]}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:c.slug})]})]},c.id)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[e.jsxs("p",{"aria-live":"polite",children:[r.length," of ",a.length," workspaces selected."]}),j&&e.jsx(y,{variant:"secondary",children:"All currently available"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Workspaces you join later are not added automatically."}),r.length===0&&e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one workspace."})]})}function q(s,a){u.useEffect(()=>{if(a||s)return;const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",window.location.href),window.location.href=r.toString()},[s,a])}function F(s,a){return s.length===a.length&&s.every((r,i)=>r===a[i])}function V(s={}){const{requireDeviceHome:a=!1,deviceHomeOrgId:r=null,allowMultiple:i=!0}=s,{data:x,error:v,isPending:g,refetch:b}=P(),[k,f]=u.useState("selected"),[p,o]=u.useState([]),j=u.useRef(!1),c=u.useMemo(()=>x?x.filter(t=>t.is_member).map(t=>({id:t.id,name:t.name,slug:t.slug,isPersonal:t.is_personal===!0})):[],[x]),n=c.find(t=>t.isPersonal)?.id??null,l=a?r&&c.some(t=>t.id===r)?r:n:null,h=u.useRef(c);h.current=c;const N=v instanceof Error?v.message:v?"Unable to load workspaces":null;u.useEffect(()=>{if(g||N)return;const t=c.map(d=>d.id),m=new Set(t);o(d=>{const C=j.current?d.filter(A=>m.has(A)):[n??t[0]].filter(A=>!!A);return j.current=!0,F(d,C)?d:C})},[c,N,g,n]);const L=u.useCallback(t=>{if(t==="all_current"){if(!i)return;o(h.current.map(m=>m.id))}f(t)},[i]),M=u.useCallback((t,m)=>{h.current.some(d=>d.id===t)&&(a&&(t===l||!i)||(f("selected"),o(d=>m?i?d.includes(t)?d:[...d,t]:[t]:d.filter(C=>C!==t))))},[i,l,a]),w=u.useMemo(()=>{if(a&&l&&!i)return[l];const t=new Set(p);return a&&l&&t.add(l),c.filter(m=>t.has(m.id)).map(m=>m.id)},[i,p,l,c,a]),_=u.useCallback(()=>{const t=h.current,m=t.find(d=>d.isPersonal)?.id??t[0]?.id;j.current=t.length>0,f("selected"),o(m?[m]:[])},[]),O=!g&&!N&&c.length>0&&w.length>0&&(i||w.length===1)&&(!a||l!==null&&w.includes(l)),z=u.useCallback(()=>{b()},[b]);return{orgList:c,workspaceAccess:k,setWorkspaceAccess:L,selectedOrgIds:w,toggleSelectedOrgId:M,resetWorkspaceSelection:_,personalOrgId:n,deviceHomeOrgId:l,orgsLoading:g,orgsError:N,retryOrgs:z,workspaceSelectionReady:O}}function K(s){if(!s)return null;try{return new URL(s).pathname.match(/^\/mcp\/([^/]+)$/)?.[1]?.trim()||null}catch{return null}}export{H as A,T as W,I as a,q as b,K as g,D as s,V as u};
2
+ //# sourceMappingURL=oauth-workspace-access-BxsjwgdH.js.map
@@ -0,0 +1,2 @@
1
+ import{Z as pe,r as v,bs as Fe,bt as qe,bu as Be,bv as Ke,bw as ye,j as e,bx as Z,B as N,by as Me,aQ as Ve,bz as He,bA as Ue,bB as Ye,bC as Ge,bD as Je,bE as Ze,bF as Xe,bG as be,bH as X,bI as et,bJ as tt,bK as st,bL as de,bM as nt,bN as it,m as at,T as Ie,k as ot,bO as rt,bP as J,i as ct,y as ve,I as je,bQ as lt,bR as dt,bS as ut,a1 as Ne,a_ as mt,z as re,bT as pt,bU as Ce,bV as _e,bW as ht,E as gt,bX as ke,bY as xt}from"./index-Cr5hwh-C.js";import{P as ue,a as De,A as ft}from"./agent-permissions-matrix-BOo_4r_4.js";import{C as Se,a as Ae,b as we,c as ze}from"./card-Djgp00r_.js";const Oe=["auto","approval","deny"],yt={matched_rule:"Matching policy rules apply.",default_approval:"No rule matches; approval is required.",unresolved_principal:"The requesting agent or Automation could not be identified.",parent_approval:"Approval is inherited from the parent action.",unavailable_operation:"This action is unavailable on the connection."},Le={read:"Reads",write:"Writes",destructive:"Destructive writes",non_destructive:"Non-destructive writes",unknown:"Unclassified writes"};function me(t){return{operation_key:t.operation_key??null,connector_key:t.connector_key??null,connection_id:t.connection_id??null,operation_category:t.operation_category??null}}const ce=t=>JSON.stringify(me(t)),Pe=t=>({...t,effect:t.effects.execute??"approval"});function F({label:t,value:i,onChange:a,children:o,disabled:m}){return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("select",{"aria-label":t,value:i,onChange:d=>a(d.target.value),disabled:m,className:"h-9 w-full rounded-lg border bg-background px-2 text-foreground",children:o})]})}function bt(t,i){const a=i.connections?.find(o=>o.id===t.connection_id);return t.connection_id?`Connection: ${a?.display_name||a?.connector_key||"Unavailable"} (#${t.connection_id})`:t.connector_key?`Connector: ${i.connectors?.find(o=>o.key===t.connector_key)?.name||t.connector_key}`:"All connectors"}function vt(t,i){return t.operation_key?i.connector_operations.find(a=>a.operation_key===t.operation_key)?.name||t.operation_key:t.operation_category?Le[t.operation_category]:"All actions"}function le(t,i){return`${bt(t,i)} · ${vt(t,i)}`}function $e(t){return t.connection_id?`connection:${t.connection_id}`:t.connector_key?`connector:${t.connector_key}`:"all"}function Ee({catalog:t}){return e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"all",children:"All connectors"}),e.jsx("optgroup",{label:"Connectors",children:t.connectors?.map(i=>e.jsx("option",{value:`connector:${i.key}`,children:i.name},i.key))}),e.jsx("optgroup",{label:"Connections",children:t.connections?.map(i=>e.jsxs("option",{value:`connection:${i.id}`,children:[i.display_name||i.connector_key," (#",i.id,")"]},i.id))})]})}function jt({label:t,ariaLabel:i,disabled:a,onRemove:o}){const[m,d]=v.useState(!1);return m?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(N,{type:"button",variant:"destructive",size:"sm",disabled:a,"aria-label":"Confirm removal",onClick:async()=>{await o()&&d(!1)},children:"Confirm"}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",disabled:a,onClick:()=>d(!1),children:"Cancel"})]}):e.jsx(N,{type:"button",variant:"ghost",size:"sm",disabled:a,"aria-label":i,onClick:()=>d(!0),children:t})}function Nt({owner:t,connector:i,connection:a,agent:o}){const m=pe(),[d,j]=v.useState(o??""),S=Fe(t),r=S.data,u=r?.agents.some(s=>s.id===d)?d:"",n=qe(t,u),g=Be(t,!u),[C,W]=v.useState(a?`connection:${a}`:i?`connector:${i}`:"all"),[Y,Q]=v.useState(C),[I,A]=v.useState(!1),[O,q]=v.useState(""),[_,B]=v.useState("all"),[$,K]=v.useState("approval"),[p,D]=v.useState(!1),[M,E]=v.useState(null),[V,ee]=v.useState(a?String(a):""),[T,G]=v.useState(""),P=r?.connections?.some(s=>String(s.id)===V)?V:"",k=Ke(t,P?Number(P):void 0,T,u||void 0);async function H(s,b){D(!0),E(null);try{if(u){const l={resource_class:"connector_action",...me(s)};b?await Ye(t,u,{...l,effects:{execute:b}}):await Ge(t,u,l)||E("This rule was already removed. The list has been refreshed.")}else{const l=g.data;if(!l)return;const L=l.rules.filter(Qe=>ce(Qe)!==ce(s));b&&L.push({...me(s),effect:b});const oe=await Je(t,{revision:l.revision,rules:L});m.setQueryData(Ze(t),oe)}return await Promise.all(["write-permissions","agent-permissions","available-operations","connector-operations","policy-explanation"].map(l=>m.invalidateQueries({queryKey:[l]}))),s}catch(l){l instanceof ye&&l.status===409?(E("Policies changed in another session. Review the refreshed rules before saving again."),await g.refetch()):E(l instanceof Error?l.message:"Could not save policy.")}finally{D(!1)}}const f=S.error||(u?n.error:g.error);if(f instanceof ye&&f.status===403)return e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Only organization owners and admins can manage policies."});if(f)return e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not load policies. ",String(f)]});if(!r||(u?!n.data:!g.data))return e.jsx(Z,{label:"policies",rows:2});const c=s=>s==="all"||r.connectors?.some(b=>`connector:${b.key}`===s)||r.connections?.some(b=>`connection:${b.id}`===s)?s:"all",h=c(C),x=c(Y),w=r.connections?.find(s=>`connection:${s.id}`===x),y=w?.connector_key??(x.startsWith("connector:")?x.slice(10):void 0),R=s=>x==="all"||$e(s)==="all"?!0:s.connection_id?w?s.connection_id===w.id:r.connections?.some(b=>b.id===s.connection_id&&b.connector_key===y):s.connector_key===y;function te(s){return u?s.principal_kind==="agent"&&s.principal_id===u:!s.principal_kind}const z=h.startsWith("connector:")?h.slice(10):h.startsWith("connection:")?r.connections?.find(s=>s.id===Number(h.slice(11)))?.connector_key:void 0,U=r.connector_operations.filter(s=>!z||s.connector_key===z),se=r.connections?.find(s=>s.id===Number(P))?.connector_key,ne=r.connector_operations.filter(s=>s.connector_key===se),ie=u?(n.data?.agent??[]).filter(s=>s.resource_class==="connector_action").map(Pe):g.data?.rules??[],ge=(n.data?.floor??[]).filter(s=>s.resource_class==="connector_action"&&R(s)).map(Pe),We={connector_key:h.startsWith("connector:")?h.slice(10):h==="all"&&_==="specific"?U.find(s=>s.operation_key===O)?.connector_key??null:null,connection_id:h.startsWith("connection:")?Number(h.slice(11)):null,operation_key:_==="specific"?O:null,operation_category:_.startsWith("category:")?_.slice(9):null},ae=ie.filter(R);function xe(){W(x),B("all"),q(""),K("approval"),A(!0)}const fe=(s,b=!1)=>e.jsx("div",{className:"divide-y rounded-lg border",children:s.map(l=>{const L=!b&&te(l);return e.jsxs(De,{controls:e.jsxs(e.Fragment,{children:[e.jsx(ue,{options:Oe,value:l.effect,floor:"auto",compact:!0,disabled:p||!L,ariaLabel:`Policy for ${le(l,r)}`,onChange:oe=>void H(l,oe)}),L&&e.jsx(jt,{label:"Remove",disabled:p,ariaLabel:`Remove rule: ${le(l,r)}`,onRemove:()=>H(l)})]}),children:[e.jsx("p",{className:"text-sm break-words",children:le(l,r)}),!L&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.principal_kind==="agent"&&!l.principal_id?"All agents":"Inherited restriction"})]},JSON.stringify([l.principal_kind,l.principal_id,ce(l)]))})});return e.jsxs("div",{className:"space-y-4",children:[(x!==Y||u!==d)&&e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"The requested scope is unavailable. Showing organization rules; install the connector or choose an available scope."}),e.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Auto runs immediately. Ask waits for human approval. Block prevents execution and hides the action from agents. Authentication and guardrails still apply."}),e.jsxs("details",{className:"space-y-2",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:"How rules combine"}),e.jsx("p",{children:"A rule overrides another when it is narrower in target or actions and at least as narrow in the other. When rules are narrower in different ways, or use different categories, the stricter choice wins: Block, then Ask, then Auto. With no matching rule, the result is Ask. Impact categories apply only to writes."}),e.jsx("p",{children:"A connection-wide Auto does not override an organization-wide destructive Block. Add a destructive rule for that connection to make an exception."}),e.jsx("p",{children:"Agents and their Automations can only tighten organization policy. Internal browser steps inherit the parent approval; an explicit browser Block still wins."})]})]}),e.jsxs(F,{label:"Policy owner",value:u,onChange:j,disabled:p,children:[e.jsx("option",{value:"",children:"Organization"}),r.agents.map(s=>e.jsxs("option",{value:s.id,children:["Agent: ",s.name]},s.id))]}),u&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Auto adds no restriction for this agent. It inherits organization policy and cannot bypass Ask or Block."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Without a matching restriction, this agent inherits organization policy.":"Without a matching rule, actions require approval (Ask)."}),e.jsx(F,{label:"Show rules for",value:x,onChange:Q,disabled:p,children:e.jsx(Ee,{catalog:r})}),u&&ge.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Inherited organization rules"}),fe(ge,!0)]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:u?"Saved restrictions":"Saved rules"}),!I&&ae.length>0&&e.jsx(N,{variant:"outline",size:"sm",disabled:p,onClick:xe,children:"Add rule"})]}),I&&e.jsxs("form",{className:"space-y-3 border-t pt-4",onSubmit:s=>{s.preventDefault(),!p&&(_!=="specific"||O)&&H(We,$).then(b=>{b&&(A(!1),Q($e(b)))})},children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add rule"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(F,{label:"Applies to",value:h,onChange:s=>{W(s),B("all"),q("")},disabled:p,children:e.jsx(Ee,{catalog:r})}),e.jsxs(F,{label:"Actions",value:_,onChange:B,disabled:p,children:[e.jsx("option",{value:"all",children:"All actions"}),e.jsx("optgroup",{label:"Categories",children:r.operation_categories?.map(s=>e.jsx("option",{value:`category:${s}`,children:Le[s]},s))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),_==="specific"&&e.jsxs(F,{label:"Specific action",value:O,onChange:q,disabled:p,children:[e.jsx("option",{value:"",children:"Choose action"}),U.map(s=>e.jsxs("option",{value:s.operation_key,children:[s.connector_name,": ",s.name]},s.operation_key))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(ue,{options:Oe,value:$,floor:"auto",compact:!0,disabled:p,ariaLabel:"New rule decision",onChange:K}),e.jsx(Me,{onCancel:()=>A(!1),cancelDisabled:p,children:e.jsx(N,{type:"submit",disabled:p||_==="specific"&&!O,children:p?"Saving…":"Save rule"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Saving an existing scope replaces its decision. Removing a rule reveals the next matching rule."})]}),ae.length?fe(ae):!I&&e.jsx(Ve,{icon:He,title:"No saved rules in this scope",description:"Add a rule for all actions, a category, or a specific action.",actionLabel:"Add rule",onAction:xe})]}),M&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:M}),e.jsxs("details",{className:"space-y-3 border-t pt-4",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Check an action"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(F,{label:"Check connection",value:P,onChange:s=>{ee(s),G("")},children:[e.jsx("option",{value:"",children:"Choose connection"}),r.connections?.map(s=>e.jsxs("option",{value:String(s.id),children:[s.display_name||s.connector_key," (#",s.id,")"]},s.id))]}),e.jsxs(F,{label:"Check action",value:T,onChange:G,disabled:!P,children:[e.jsx("option",{value:"",children:"Choose action"}),ne.map(s=>e.jsx("option",{value:s.operation_key.slice(s.connector_key.length+2),children:s.name},s.operation_key))]})]}),k.error?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not check policy. ",String(k.error)]}):e.jsx("p",{"aria-live":"polite",className:"text-sm",children:T?k.isPending?"Checking…":k.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ue[k.data.effect]})," ·"," ",yt[k.data.reason]??"The server evaluated this action.",k.data.rule_ids.length>0?` · Rules ${k.data.rule_ids.map(s=>`#${s}`).join(", ")}`:""]}):"":""})]})]})}const Ct=[{action:"create_type",label:"Create entity types",description:"Add a new type and its initial fields."},{action:"update_type",label:"Edit entity types",description:"Change fields, write rules, event kinds, or type metadata."},{action:"delete_type",label:"Delete entity types",description:"Remove an entity-type definition."}],_t=[{action:"create_relationship_type",label:"Create relationship types",description:"Add a new kind of link between entity types."},{action:"update_relationship_type",label:"Edit relationship types",description:"Change a definition, or which types it may connect."},{action:"delete_relationship_type",label:"Delete relationship types",description:"Remove a relationship-type definition."}];function he(t){return t.resource_class==="entity_schema"&&t.principal_kind===null&&t.entity_type_slug===null&&t.operation_key===null&&t.target_agent_id===null}function kt(t){return t.agent.find(he)}function St(t,i){return{...t,agent:[...t.agent.filter(a=>!he(a)),i]}}function At(t){return{...t,agent:t.agent.filter(i=>!he(i))}}function wt({label:t,description:i,action:a,value:o,pending:m,onChange:d}){return e.jsxs(De,{controls:e.jsx(ue,{options:it("entity_schema",a),value:o,floor:"auto",disabled:m,compact:!0,ariaLabel:t,onChange:d}),children:[e.jsx("p",{children:t}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:i})]})}function Te({title:t,actions:i,effects:a,pending:o,onChange:m}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:i.map(({action:d,label:j,description:S})=>e.jsx(wt,{action:d,label:j,description:S,value:a[d]??de.entity_schema[d]??"deny",pending:o,onChange:r=>m(d,r)},d))})]})}function zt({owner:t}){const i=pe(),a=Xe(t),o=Fe(t),m=be({mutationFn:n=>et(t,{resource_class:"entity_schema",effects:n}),onSuccess:n=>{i.setQueryData(a,g=>g&&St(g,n)),i.invalidateQueries({queryKey:a})},onError:n=>{X.error(n instanceof Error?n.message:"Failed to save schema policy")}}),d=be({mutationFn:()=>tt(t,{resource_class:"entity_schema"}),onSuccess:()=>{i.setQueryData(a,n=>n&&At(n)),i.invalidateQueries({queryKey:a})},onError:n=>{X.error(n instanceof Error?n.message:"Failed to reset schema policy")}});if(o.isLoading)return e.jsx(Z,{label:"schema policy",variant:"cards",cards:1});if(o.isError||!o.data)return e.jsx(st,{label:"schema policy"});const j=kt(o.data),S=j?.effects??de.entity_schema,r=m.isPending||d.isPending,u=(n,g)=>{m.mutate({...j?.effects??de.entity_schema,[n]:g})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:j?"Custom policy":"Workspace defaults"}),j?e.jsxs(N,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>d.mutate(),children:[e.jsx(nt,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove custom policy"]}):null]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Te,{title:"Entity types",actions:Ct,effects:S,pending:r,onChange:u}),e.jsx(Te,{title:"Relationship types",actions:_t,effects:S,pending:r,onChange:u})]})]})}function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ot(t,i,a){const o=t.split("/");return o[1]===i?(o[1]=a,o.join("/")||"/"):`/${a}`}function Pt({owner:t,connector:i,connection:a,agent:o}){const m=at(),d=pe(),{data:j,error:S}=Ie(),{activeOrg:r,urlOrgSlug:u}=ot(),n=(j??[]).find(c=>c.slug===t&&c.is_member)??null,g=n?.id??t,C=rt(g,{name:n?.name??"",slug:n?.slug??"",visibility:n?.visibility??"private"}),[W,Y]=C.field("name"),[Q,I]=C.field("slug"),[A,O]=C.field("visibility"),[q,_]=J(g,!!n),[B,$]=J(g,!1),[K,p]=J(g,null),[D,M]=v.useState(!1),[E,V]=v.useState(!1),[ee,T]=J(g,!1);if(ct(S)&&j===void 0)return e.jsxs(Se,{role:"alert",children:[e.jsx(Ae,{children:e.jsx(we,{children:"Couldn't load organizations"})}),e.jsx(ze,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please try again in a moment."})})]});if(j===void 0)return e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsx(Z,{label:"organization",variant:"cards",cards:1}),e.jsx(Z,{label:"visibility",variant:"panel"})]});if(!n)return e.jsxs(Se,{children:[e.jsx(Ae,{children:e.jsx(we,{children:"Organization not found"})}),e.jsx(ze,{children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You aren't a member of an organization at"," ",e.jsx("span",{className:"font-mono",children:t}),", or it has been deleted."]})})]});const G=c=>{const h=gt(c);if(h.kind==="cross-host"){window.location.assign(h.href);return}m({to:h.to})},P=c=>{if(c==="public"&&n.visibility!=="public"){$(!0);return}O(c),$(!1)},k=async()=>{if(!C.canSubmit)return;const c=W.trim();if(!c){p("Name is required");return}const h=Q.trim()||Re(c);if(!h){p("Slug is required");return}M(!0),p(null);try{const x=c!==n.name||h!==n.slug,w=A!==n.visibility;let y=n.slug;if(x){const z=await re.update({organizationId:n.id,data:{name:c,slug:h}});if(z.error){p(z.error.message||"Failed to update organization");return}y=z.data?.slug??h}w&&(y=(await pt(y,A)).slug),(x||w)&&(C.accept(C.values,{name:c,slug:y,visibility:A}),await d.invalidateQueries({queryKey:["organizations"]}),X.success("Organization updated"));const R=r?.id===n.id||u===n.slug,te=y!==n.slug;if(R&&te){const z=Ce(),U=_e();if(z===n.slug&&U){const ne=ht(window.location.pathname,n.slug)||"/",ie=`${window.location.protocol}//${y}.${U}${ne}${window.location.search}${window.location.hash}`;window.location.assign(ie);return}const se=Ot(window.location.pathname,n.slug,y);m({to:`${se}${window.location.search}${window.location.hash}`});return}}catch(x){p(x instanceof Error?x.message:"Failed to update organization")}finally{M(!1)}},H=async()=>{V(!0),p(null);try{const c=await re.delete({organizationId:n.id});if(c.error){p(c.error.message||"Failed to delete organization");return}await d.invalidateQueries({queryKey:["organizations"]}),X.success("Organization deleted");const x=(j??[]).filter(y=>y.is_member).find(y=>y.id!==n.id)??null,w=r?.id===n.id||u===n.slug;if(w&&x){await re.setActive({organizationId:x.id}),G(x.slug);return}if(w){const y=Ce(),R=_e();if(y===n.slug&&R){window.location.assign(`${window.location.protocol}//app.${R}/`);return}m({to:"/"});return}m({to:"/"})}catch(c){p(c instanceof Error?c.message:"Failed to delete organization")}finally{V(!1),T(!1)}},f=D||E;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Identity"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ve,{htmlFor:"org-name",children:"Name"}),e.jsx(je,{id:"org-name",value:W,onChange:c=>{Y(c.target.value),q||I(Re(c.target.value))},placeholder:"e.g. My Team",disabled:f})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(ve,{htmlFor:"org-slug",children:"Slug"}),e.jsx(je,{id:"org-slug",value:Q,onChange:c=>{_(!0),I(c.target.value)},placeholder:"e.g. my-team",disabled:f}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Changing the slug rewrites this workspace's URL. Existing links to"," ",e.jsxs("span",{className:"font-mono",children:["/",n.slug]})," redirect for a grace period."]})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Workspace visibility"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose who can browse this workspace and its public pages."})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>P("private"),disabled:f,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${A==="private"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(lt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Private"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members can access this workspace."})]})]}),e.jsxs("button",{type:"button",onClick:()=>P("public"),disabled:f,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${A==="public"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(dt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Public"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone can browse public pages for this workspace."})]})]})]}),B&&e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm",children:[e.jsx("p",{className:"text-foreground",children:"Make this workspace public? Catalog-style content may become visible outside the membership."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(N,{type:"button",size:"sm",onClick:()=>{O("public"),$(!1)},disabled:f,children:"Confirm public"}),e.jsx(N,{type:"button",size:"sm",variant:"ghost",onClick:()=>$(!1),disabled:f,children:"Cancel"})]})]})]}),K&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:K}),e.jsx(ut,{visible:C.hasConflict,onReload:C.reset}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"outline",onClick:()=>void m({to:`/${t}`}),disabled:f,children:"Cancel"}),e.jsxs(N,{onClick:k,disabled:f||!C.canSubmit,children:[D?e.jsx(Ne,{size:"lg",className:"mr-1.5"}):null,D?"Saving...":"Save changes"]})]}),e.jsxs("section",{id:"policies",className:"scroll-mt-6 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Policies"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control connector actions across the organization. Changes to existing rules save automatically."})]}),e.jsx(Nt,{owner:t,connector:i,connection:a,agent:o},`${t}:${o??""}:${i??""}:${a??""}`)]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Agent write defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the defaults agents inherit for entities and agents. Changes save automatically; agents can only tighten them."})]}),e.jsx(ft,{owner:t,variant:"org-floor"})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Schema governance"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control structural changes by agents and connected AI clients. Changes save automatically."})]}),e.jsx(zt,{owner:t})]}),e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:n.is_personal?"Personal workspace":"Delete this organization"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n.is_personal?"Your personal workspace can't be deleted — your devices and personal connections are bound to it.":"Permanently removes the organization and all members' workspace access. This cannot be undone."}),!n.is_personal&&e.jsx("div",{className:"mt-3",children:ee?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N,{variant:"destructive",size:"sm",onClick:H,disabled:f,children:[E?e.jsx(Ne,{className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>T(!1),disabled:f,children:"Cancel"})]}):e.jsxs(N,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>T(!0),disabled:f,children:[e.jsx(mt,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete organization"]})})]})]})}function Rt(){const{owner:t}=ke.useParams(),i=ke.useSearch(),{data:a}=Ie(),o=(a??[]).find(m=>m.slug===t&&m.is_member)?.name;return e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-7 w-7"}),e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Organization settings"})]}),o?e.jsx("p",{className:"text-base font-medium text-foreground",children:o}):null]}),e.jsx(Pt,{owner:t,...i})]})}export{Rt as component};
2
+ //# sourceMappingURL=organization-gxGeDjIV.js.map
@@ -0,0 +1,2 @@
1
+ import{iD as T,iE as L,r as x,gE as E,u as C,j as t,cY as D,au as z,cN as B,S as g,h$ as M,B as j,iF as K,iG as y,iH as F,iI as b,iJ as S,iK as H,ct as q,f as I,an as U,c6 as G,a1 as P,ah as V,iL as W,dq as J,iM as Y,bc as Q,iN as X,dC as Z,ce as ee,iO as te,dG as ne,b8 as se}from"./index-Cr5hwh-C.js";import{u as re,A as oe}from"./automation-detail-content-vUwVumXf.js";import{A as ie}from"./agent-loading-shells-Dqcvky-k.js";import{s as ae,h as ce,R as de,A as le}from"./agent-thread-BJOijbT0.js";import{C as ue,b as pe,A as me}from"./connection-feed-detail-CIJJLDP8.js";import{f as xe}from"./connector-scope-lists-CadPVsI3.js";import{a as fe}from"./connections-browser-CKZjzRz6.js";import{S as he}from"./source-record-panels-CPyzlfD1.js";import{E as _}from"./events-feed-BtvhZF1f.js";import{E as ge}from"./event-detail-ve2d6Gbb.js";import"./create-automation-form-CtSSeYj3.js";import"./cronstrue-n4qGUraE.js";import"./entity-options-uXjgT7y9.js";import"./connection-label-BobuYiAG.js";import"./model-selector-dAbDgJvx.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-DHeyRGZI.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-By8RZyKW.js";import"./proposal-review-shell-UcZr87_Q.js";import"./runs-C0rCgGwX.js";import"./json-diff-DBoag_OS.js";import"./deployments-RvUdVkj3.js";import"./app-bridge-BCm4muqj.js";import"./runs-table-syPJ6r6T.js";import"./status-dot-B-EWMgq6.js";import"./conversations-table-BdXoZAfc.js";import"./renderer-mEDnVW0O.js";import"./card-Djgp00r_.js";import"./clients-D3Zbjxin.js";import"./view-param-filters-CqLZQrnO.js";import"./filter-editors-Cj-v6NtH.js";const $=Symbol("trusted-automation-interaction");function je(e){return Object.defineProperty(e,$,{value:!0}),e}function ye(e){return{title:`${e} items waiting for you`,icon:"entity",impact:{level:"normal"},tone:"default",blocks:[{type:"text",value:"Review the individual proposals below, or decide the whole run at once.",muted:!0}],actions:[{id:"approve-all",label:"Approve all",variant:"primary",icon:"check",confirm:!0,confirmPrompt:`Approve all ${e} proposals?`,tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved all ${e} proposals.`},{id:"reject-all",label:"Reject all",variant:"outline",icon:"x",confirm:!0,confirmPrompt:`Reject all ${e} proposals?`,tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected all ${e} proposals.`}]}}const ve=new Set(["automation-approval-batch"]);function Ne(e){return new Promise(n=>{e({onSettled:(o,s)=>n(!!s)})})}function we(){const e=T(),n=L();return x.useMemo(()=>({toolNames:ve,resolve:(o,s)=>{if(!s||typeof s!="object"||s[$]!==!0)return null;const r=s;if(o==="automation-approval-batch"){const i=typeof r.runId=="number"&&Number.isSafeInteger(r.runId)&&r.runId>0?r.runId:null,a=typeof r.count=="number"&&Number.isSafeInteger(r.count)&&r.count>1?r.count:null,c=Array.isArray(r.runIds)?r.runIds.filter(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0):[];return i===null||a===null||c.length!==a||new Set(c).size!==a?null:{view:ye(a),handlers:{manage_operations:l=>l.action!=="approve"&&l.action!=="reject"?Promise.resolve(!0):Ne(u=>l.action==="approve"?e.mutate({run_id:i,run_ids:c},u):n.mutate({run_id:i,run_ids:c},u))}}}return null}}),[e,n])}function be(e){const n=[];return e.forEach((o,s)=>{n.push({id:`sep:${o.runId}`,role:"system",parts:[{type:"text",text:Ae(o,s)}],createdAt:o.completedAt?new Date(o.completedAt).getTime():void 0});for(const r of o.messages)n.push({...r,id:`r${o.runId}:${r.id}`})}),n}function Ae(e,n){const o=(e.pendingActionCount??0)>0?`Waiting for you (${e.pendingActionCount})`:e.status==="completed"?"Completed":e.status??"Completed",s=(e.autoAppliedCount??0)>0?` · ${e.autoAppliedCount} applied automatically`:"",r=e.completedAt?new Date(e.completedAt).toLocaleString():null;return r?`Run ${n+1} · ${o}${s} · ${r}`:`Run ${n+1} · ${o}${s}`}const ke=/(?:^|\n)Run this Automation now/;function Ce(e){return e.role==="user"&&e.parts.some(n=>n.type==="text"&&ke.test(n.text))}function Se(e){return`history-interaction:${e.runId}:${e.eventId??"error"}`}function Ie({agentId:e,automationId:n,ownerSlug:o,runId:s}){const{data:r,isLoading:i}=E(e,n,{orgSlug:o,...s!=null?{runId:s}:{}}),a=we(),c=C(),l=x.useCallback(d=>{c?.open({href:`/${o}/automations/${n}?run_id=${d}`,title:`Automation run #${d}`,runId:d})},[c,o,n]),u=x.useMemo(()=>{const d=r?.runs??[],O=(s!=null?d.filter(p=>p.runId===s):d).slice().reverse();return be(O.map(p=>{const h=p.messages.map(m=>ae(m,{showToolCalls:!0})).filter(m=>m!==null&&!Ce(m));p.task?.trim()&&h.unshift({id:"task",role:"user",parts:[{type:"text",text:p.task.trim()}]});const A=p.actions??[],N=A.filter(m=>m.status==="pending");if(N.length>1){const m=N.map(f=>f.runId).sort((f,R)=>f-R);h.push({id:"approval-batch",role:"assistant",parts:[{type:"tool-call",toolCallId:`approval-batch-${p.runId}`,toolName:"automation-approval-batch",args:je({runId:p.runId,count:N.length,runIds:m})}]})}for(const m of A){const f=ce([m],{workspaceSlug:o,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});f&&h.push({...f,id:Se(m)})}return{runId:p.runId,completedAt:p.completedAt,status:p.status,pendingActionCount:p.pendingActionCount,autoAppliedCount:p.autoAppliedCount,messages:h}}))},[e,r,o,s]);return i?t.jsx(ie,{readOnly:!0}):u.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No run transcripts yet. Recent runs will show here when the Automation fires (failed runs appear with their prompt even without a full transcript)."}):t.jsx("div",{className:"flex h-[calc(100dvh-12rem)] min-h-[24rem] min-w-0 flex-1 flex-col",children:t.jsx(de,{messages:u,workspaceSlug:o,children:t.jsx(le,{readOnly:!0,readerPositionMode:"runs",interactionExtension:a,onRunSelect:s==null&&c?l:void 0})})})}function Pe(e){if(!e||typeof e!="object")return[];const n=e.properties;if(!n)return[];const o=Array.isArray(e.required)?new Set(e.required.map(String)):new Set;return Object.entries(n).map(([s,r])=>({name:s,type:String(r.type??"any"),required:o.has(s),description:typeof r.description=="string"?r.description:void 0}))}function _e({fields:e}){return e.length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):t.jsx("ul",{className:"space-y-2",children:e.map(n=>t.jsxs("li",{className:"space-y-0.5",children:[t.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[t.jsx("code",{className:"text-xs font-medium text-foreground",children:n.name}),t.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:n.type}),n.required?t.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),n.description?t.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}):null]},n.name))})}function v({item:e,hideHeading:n=!1}){const o=e.schemaSections;return o?t.jsxs("article",{className:n?"space-y-4":"space-y-4 px-5 py-5",children:[!n&&t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(D,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[t.jsx("h2",{className:"text-base font-medium text-foreground",children:e.title}),o.description?t.jsx("p",{className:"text-xs text-muted-foreground",children:o.description}):null]})]}),o.sections.map(s=>{const r=Pe(s.schema);return t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s.title}),s.description?t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.description}):null]}),t.jsx(_e,{fields:r})]},s.title)})]}):null}function $e({panel:e}){const n=z(e.organizationId),o=e.section==="connections"||!!e.connectionId,s=B(e.organizationId,{connectorKey:e.connectorKey,connectionIds:e.connectionId?[e.connectionId]:void 0,enabled:o}),r=n.data?.find(a=>a.key===e.connectorKey),i=s.data?.find(a=>a.id===e.connectionId&&a.connector_key===e.connectorKey);return n.isLoading||o&&s.isLoading?t.jsx("div",{className:"p-5",children:t.jsx(g,{className:"h-28 w-full"})}):n.isError||o&&s.isError?t.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):e.connectionId&&!i||!r&&!i&&e.section!=="connections"?t.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):t.jsx("div",{className:"p-5",children:e.section==="connections"?t.jsx(fe,{connections:s.data??[],connector:r,connectorKey:e.connectorKey,ownerSlug:e.ownerSlug}):i?t.jsx(Te,{connection:i,connector:r,panel:e}):r?e.section==="feeds"?t.jsx(Oe,{connector:r}):r.installed===!1?t.jsx(Re,{connector:r,ownerSlug:e.ownerSlug}):t.jsx(Ee,{connector:r,ownerSlug:e.ownerSlug}):null},`${e.connectorKey}:${e.connectionId??"connector"}:${e.section}`)}function Oe({connector:e}){const n=Object.entries(e.feeds_schema??{}).map(([o,s])=>{const r=s;return{id:o,name:r.name??o,description:r.description,feed:r}});return t.jsx(y,{entries:n,label:"feed types",renderDetail:({name:o,feed:s})=>t.jsx(v,{item:{href:"",title:o,schemaSections:F(s)},hideHeading:!0})})}function Re({connector:e,ownerSlug:n}){const o=Object.entries(e.actions_schema??{}).map(([s,r])=>{const i=r;return{id:s,name:i.name??s,description:i.description,action:i}});return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection."," ",t.jsx(b,{ownerSlug:n,connectorKey:e.key})]}),t.jsx(y,{entries:o,label:"actions",renderDetail:({name:s,action:r})=>t.jsx(v,{hideHeading:!0,item:{href:"",title:s,schemaSections:S(r)}})})]})}function Te({connection:e,connector:n,panel:o}){const[s,r]=x.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{hidden:s,children:o.section==="feeds"?t.jsx(Le,{connection:e,connector:n,ownerSlug:o.ownerSlug}):t.jsx(M,{connection:e,ownerSlug:o.ownerSlug,inPeek:!0,onReviewPermissions:n?()=>r(!0):void 0})}),s&&n&&t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Back to actions"}),t.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),t.jsx(K,{connection:e,connectorDef:n})]})]})}function Le({connection:e,connector:n,ownerSlug:o}){const{data:s=[],isLoading:r,isError:i}=q(e.id),[a,c]=x.useState(!1),l=e.facets?.chat??!1;if(r)return t.jsx(g,{className:"h-28 w-full"});if(i)return t.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const u=s.map(d=>({id:String(d.id),name:d.display_name||d.feed_key,status:xe(d)??(d.operations.includes("sync")?"Sync enabled":"Live access"),feed:d}));return t.jsxs(t.Fragment,{children:[t.jsx("div",{hidden:a,children:t.jsx(y,{entries:u,label:l?"channels":"feeds",action:Object.keys(n?.feeds_schema??{}).length>0?t.jsx(j,{size:"sm",variant:"outline",onClick:()=>c(!0),children:l?"Add channel":"Add feed"}):void 0,renderDetail:({feed:d})=>d.store==="channel_messages"?t.jsx(ue,{feed:d,hideHeader:!0}):t.jsx(pe,{feed:d,connectorDef:n,ownerSlug:o})})}),a&&n&&t.jsxs("div",{className:"space-y-4",children:[t.jsx("h2",{className:"text-base font-semibold",children:l?"Add channel":"Add feed"}),t.jsx(me,{organizationId:e.organization_id,connections:[e],connectorDefinitions:[n],onClose:()=>c(!1)})]})]})}function Ee({connector:e,ownerSlug:n}){const{data:o=[],isLoading:s,isError:r}=H(e.key);if(s)return t.jsx(g,{className:"h-28 w-full"});if(r)return t.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const i=e.actions_schema??{},a=o.map(c=>({id:c.operation_key,name:c.name??c.operation_key,description:c.description,operation:c}));return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection. Click an action to inspect its inputs."," ",t.jsx(b,{ownerSlug:n,connectorKey:e.key})]}),t.jsx(y,{entries:a,label:"actions",renderControl:()=>t.jsx(b,{ownerSlug:n,connectorKey:e.key}),renderDetail:({operation:c,name:l})=>i[c.operation_key]?t.jsx(v,{hideHeading:!0,item:{href:"",title:l,schemaSections:S(i[c.operation_key])}}):t.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function De({owner:e,path:n}){const{data:o,isLoading:s}=I(e,{slug:e}),r=o?.workspace,i=r?.type==="organization"?r.id:null,a=i?{slug:e}:void 0,{data:c,isLoading:l}=U(`/${e}/${G(n)}`,a),u=c?.entity,d=u?.id;return s||l?t.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[t.jsx(P,{className:"mr-2"})," Loading…"]}):i?d==null?t.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't find this record. It may have been deleted, or it may live in a workspace you can't access."}):u?.is_derived?t.jsx(he,{record:{type:u.entity_type,key:u.slug},orgContext:a}):t.jsx("div",{className:"px-4 py-4",children:t.jsx(_,{organizationId:i,ownerSlug:e,entityId:d,filters:{sortBy:"date",sortOrder:"desc"},dense:!0,emptyState:t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})}):t.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."})}function ze({owner:e,eventId:n,viewKey:o}){const s=C(),r=(i,a)=>t.jsx(ge,{owner:a,organizationId:i,eventId:n,viewKey:o,dense:!0,onSelectView:s?c=>s.retarget(c):void 0},`${a}/${n}/${o??""}`);return t.jsx("div",{className:"px-4 py-4",children:e==="me"?r(null,e):t.jsx(V,{owner:e,children:({organizationId:i,ownerSlug:a})=>i?r(i,a):t.jsx("div",{className:"h-40 animate-pulse rounded-md bg-muted/40"})})})}function w({owner:e,runId:n,runIds:o,contentIds:s}){const{data:r,isLoading:i}=I(e==="me"?null:e,{slug:e}),a=r?.workspace,c=e!=="me"&&a?.type==="organization"?a.id:null,l=x.useMemo(()=>{if(e==="me")return s?.length?{contentIds:s,sortBy:"date",sortOrder:"desc"}:void 0;const d=o??(n!=null?[n]:void 0);if(!(!d?.length&&!s?.length))return{...d?.length?{runIds:d}:{},...s?.length?{contentIds:s}:{}}},[e,s,n,o]),u=l!=null;return e!=="me"&&i?t.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[t.jsx(P,{className:"mr-2"})," Loading…"]}):e!=="me"&&c==null?t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):u?t.jsx("div",{className:"px-4 py-4",children:t.jsx(_,{presentation:"detail",organizationId:c,ownerSlug:e,filters:l,dense:!0,emptyState:t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No matching events yet."})})}):t.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}function Nt({item:e}){if(e.connectorPanel)return t.jsx($e,{panel:e.connectorPanel});if(e.schemaSections)return t.jsx(v,{item:e});if(typeof e.browserUrl=="string"&&e.browserUrl.length>0)return t.jsx(k,{item:e});const n=e.href?W(e.href):null;return n?n.kind==="memory"?"runId"in n?t.jsx(w,{owner:n.owner,runId:n.runId}):"runIds"in n?t.jsx(w,{owner:n.owner,runIds:n.runIds}):t.jsx(w,{owner:n.owner,contentIds:n.contentIds}):n.kind==="entity"?t.jsx(De,{owner:n.owner,path:n.path}):n.kind==="event"?t.jsx(ze,{owner:n.owner,eventId:n.eventId,viewKey:n.viewKey}):e.runId?t.jsx(Be,{owner:n.owner,automationId:n.automationId,runId:e.runId}):t.jsx(Me,{owner:n.owner,automationId:n.automationId,initialView:n.view??"activity",runId:n.runId}):t.jsx(k,{item:e})}function k({item:e}){const n=e.body,o=e.notificationType??"generic",s=e.createdAt,r=e.browserUrl??null,i=e.browserHandoff??null;return t.jsxs("article",{className:"space-y-4 px-5 py-5",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(J,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:Y(o)}),s?t.jsx("span",{children:Q(s)}):null]})]}),n?t.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:t.jsx(X,{text:n,linkPolicy:o==="action_approval_needed"?"app-links":"strip"})}):t.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),e.owner&&e.sourceAttribution?t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),t.jsx(Z,{owner:e.owner,source:e.sourceAttribution,className:"text-xs"})]}):null,r?t.jsx("div",{className:"space-y-2",children:i?.state==="expired"?t.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:i.error_message??"This draft expired before the page was opened."}):i?.state==="completed"||i?.state==="preparing"?t.jsx("p",{className:"text-sm text-muted-foreground",children:i.state==="preparing"?"Preparing draft — keep your browser tab open.":"Draft prepared — review and post in your browser."}):t.jsxs(j,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{te(r)},children:[t.jsx(ee,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function Be({owner:e,automationId:n,runId:o}){const{organizationId:s}=re(e),r=ne(n,void 0,s),i=r.data?.automation?.managed_agent_id??null;return i?t.jsx(Ie,{agentId:i,automationId:n,ownerSlug:e,runId:o}):r.isLoading?t.jsx(g,{className:"h-24 w-full rounded-lg"}):t.jsx("p",{className:"text-sm text-muted-foreground",children:"This run has no agent transcript."})}function Me({owner:e,automationId:n,initialView:o,runId:s}){const[r,i]=x.useState(o),a=r==="definition";return t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex justify-end",children:t.jsx(j,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>i(a?"activity":"definition"),children:a?"Done":t.jsxs(t.Fragment,{children:[t.jsx(se,{className:"h-3.5 w-3.5"}),"Edit"]})})}),t.jsx(oe,{owner:e,agentId:null,automationId:n,view:r,runId:s,onDone:()=>i("activity")})]})}export{Nt as PeekPaneContent};
2
+ //# sourceMappingURL=peek-pane-content-CHoQHe2H.js.map
@@ -1 +1,2 @@
1
- import{Z as i,fL as r,j as e,i5 as m}from"./index-B2AmRqYh.js";import{A as c}from"./agent-permissions-matrix-B9Ho3P1t.js";import{A as l}from"./agent-subpage-shell-Dz8I-GUt.js";function x({owner:s,agentId:t}){const{orgContext:n}=i(),{isAdmin:a,isLoading:o}=r(n.organizationId);return e.jsx(l,{owner:s,agentId:t,backLabel:"Permissions",backTo:"/$owner/agents/$agentId/permissions",children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Control which data, agent settings, and connector actions this agent may use automatically, with approval, or not at all."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(c,{owner:s,agentId:t})})]}):o?null:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Only organization admins can view or change agent permissions."})})}function p(){const{owner:s,agentId:t}=m.useParams();return e.jsx(x,{owner:s,agentId:t})}export{p as component};
1
+ import{k as i,eq as r,j as e,ij as m}from"./index-Cr5hwh-C.js";import{A as c}from"./agent-permissions-matrix-BOo_4r_4.js";import{A as l}from"./agent-subpage-shell-D92imvSt.js";function x({owner:s,agentId:t}){const{orgContext:n}=i(),{isAdmin:a,isLoading:o}=r(n.organizationId);return e.jsx(l,{owner:s,agentId:t,backLabel:"Permissions",backTo:"/$owner/agents/$agentId/permissions",children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Control which data, agent settings, and connector actions this agent may use automatically, with approval, or not at all."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(c,{owner:s,agentId:t})})]}):o?null:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Only organization admins can view or change agent permissions."})})}function p(){const{owner:s,agentId:t}=m.useParams();return e.jsx(x,{owner:s,agentId:t})}export{p as component};
2
+ //# sourceMappingURL=permissions-aPHaKLec.js.map
@@ -0,0 +1,2 @@
1
+ import{gF as f,g5 as w,g6 as y,r as N,j as e,b7 as k,B as d,y as C,f3 as P}from"./index-Cr5hwh-C.js";import{a as A}from"./runs-C0rCgGwX.js";function B({resource:p,runId:t,children:h,onDone:l}){const c=!!t,{data:a,isLoading:E,isError:u,refetch:v}=A(p,c?t:void 0),s=f({isReview:c,isError:u,status:a?.status}),m=a?.status==="pending"?a.proposal:null,n=w(),i=y(),[g,x]=N.useState(""),o=n.isPending||i.isPending,j=s==="active"||s==="loading"||s==="error",b=()=>{t&&n.mutate({run_id:t},{onSuccess:()=>l?.()})},R=()=>{if(!t)return;const r=g.trim();i.mutate({run_id:t,...r?{reason:r}:{}},{onSuccess:()=>l?.()})};return e.jsxs("div",{className:"grid content-start gap-4",children:[s==="active"?e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review the change the builder agent proposed. The values below show the proposed change — ",e.jsx("strong",{children:"Approve"})," to apply, or"," ",e.jsx("strong",{children:"Reject"}),"."]})]})}):null,s==="gone"?e.jsx("div",{className:"rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",children:"This change is no longer pending (it may have been approved or rejected already)."}):null,s==="error"?e.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"text-destructive",children:"Couldn't load the proposed change to review. Editing is disabled until it loads — retry, or reopen the link."}),e.jsx(d,{type:"button",variant:"outline",size:"sm",onClick:()=>void v(),children:"Retry"})]})}):null,h({reviewMode:s,proposal:m,controlsDisabled:j}),s==="active"?e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"review-reject-reason",children:"Reason (optional)"}),e.jsx(P,{id:"review-reject-reason",rows:2,value:g,onChange:r=>x(r.target.value),placeholder:"Why you're rejecting — shared back to the requester.",disabled:o})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[e.jsx(d,{type:"button",variant:"outline",onClick:R,disabled:o,children:i.isPending?"Rejecting...":"Reject"}),e.jsx(d,{type:"button",onClick:b,disabled:o,children:n.isPending?"Approving...":"Approve"})]})]}):null]})}export{B as P};
2
+ //# sourceMappingURL=proposal-review-shell-UcZr87_Q.js.map
@@ -0,0 +1,2 @@
1
+ import{r as e,d2 as l}from"./index-Cr5hwh-C.js";function a(){return e.useEffect(()=>{l()},[]),null}export{a as P};
2
+ //# sourceMappingURL=public-shell-ready-DcnlADmj.js.map
@@ -1 +1,2 @@
1
- import{aQ as t,j as e,aR as o,aS as d,aT as m,aU as h}from"./index-B2AmRqYh.js";function p({section:s,icon:a,title:i,description:n,action:l}){const c=s?t[s]:null,x=s!==void 0?t[s].icon:a,r=i??c?.label??"";return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-7 w-7 shrink-0","aria-hidden":!0}),e.jsx("h1",{className:"font-display text-3xl font-semibold leading-tight",children:r})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:n}):null]}),l?e.jsx("div",{className:"shrink-0",children:l}):null]})}function u(){const{owner:s}=o.useParams();return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(d,{owner:s,children:a=>e.jsxs("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col gap-4",children:[e.jsx(p,{icon:m,title:"Recent",description:"Chats, connected apps, and Automations you used last."}),e.jsx(h,{owner:a.ownerSlug,tone:"page",empty:"message"})]})})})})}export{u as component};
1
+ import{af as t,j as e,ag as o,ah as d,ai as m,aj as h}from"./index-Cr5hwh-C.js";function f({section:s,icon:a,title:i,description:n,action:l}){const c=s?t[s]:null,x=s!==void 0?t[s].icon:a,r=i??c?.label??"";return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-7 w-7 shrink-0","aria-hidden":!0}),e.jsx("h1",{className:"font-display text-3xl font-semibold leading-tight",children:r})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:n}):null]}),l?e.jsx("div",{className:"shrink-0",children:l}):null]})}function u(){const{owner:s}=o.useParams();return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(d,{owner:s,children:a=>e.jsxs("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col gap-4",children:[e.jsx(f,{icon:m,title:"Recent",description:"Chats, connected apps, and Automations you used last."}),e.jsx(h,{owner:a.ownerSlug,tone:"page",empty:"message"})]})})})})}export{u as component};
2
+ //# sourceMappingURL=recent-D-65Pgu-.js.map
@@ -0,0 +1,2 @@
1
+ import{at as sn,j as n,r as k,m as V,n as se,cb as on,cc as vt,cd as yt,L as je,ce as an,cf as cn,k as rn,cg as gt,ch as ln,bY as dn,ci as un,ai as mn,cj as xt,ck as A,bl as fn,cl as pn,cm as hn,bm as vn,cn as yn,co as ne,c9 as gn,cp as bt,cq as xn,an as bn,cr as jn,aZ as kn,ba as Sn,aq as xe,cs as Nn,ct as Cn,t as jt,cu as kt,cv as _n,cw as In,cx as En,cy as St,cz as An,c6 as Fn,cA as Tn,be as wn,aV as Rn,S as Nt,cB as Pn,I as Ln,P as Oe,X as On,B as $e,cC as $n,bn as Mn,bo as Dn,bp as Kn,bq as Bn,br as Vn,cD as Gn,cE as Qn,bz as Un,cF as Wn,cG as zn,cH as qn,ae as Ct,g as Yn,cI as Zn,cJ as we,cK as ct,cL as Hn,cM as Xn,cN as Jn,cO as es,cP as ts,cQ as ns,cR as ss,cS as os,cT as as,cU as is,cV as cs,bK as rs,cW as ls,cX as ds,aQ as rt,cY as lt,cZ as _t,c_ as Re,c$ as It,d0 as us,d1 as Pe}from"./index-Cr5hwh-C.js";import{S as $,F as ms,d as fs,o as ge,r as ps,f as hs,a as vs}from"./filter-editors-Cj-v6NtH.js";import{c as dt}from"./connection-label-BobuYiAG.js";import{u as ys}from"./runs-C0rCgGwX.js";import{S as gs}from"./source-record-panels-CPyzlfD1.js";import{u as xs}from"./clients-D3Zbjxin.js";import{g as bs}from"./client-rows-EJSKR6z1.js";import{E as js}from"./events-feed-BtvhZF1f.js";import{L as ks,u as Ss}from"./renderer-mEDnVW0O.js";import{E as Ns}from"./agent-loading-shells-Dqcvky-k.js";import{M as Cs}from"./member-scope-gate-B44INDPY.js";const Me=k.createContext(null);function _s({organizationId:e,isWorkspaceLoading:t,children:o}){const{data:s=[],isLoading:i}=sn(e);return n.jsx(Me.Provider,{value:{groups:s,isLoading:!!t||i},children:o})}function Is(){const e=k.useContext(Me);if(!e)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return e}function Es(){return k.useContext(Me)}function Et(e){const{parse:t,serialize:o,filterKeys:s,clearClassifications:i=!0,replace:l=!0,merge:y}=e,m=V(),d=se(),r=k.useMemo(()=>{const f=new URLSearchParams;for(const[u,g]of Object.entries(d.search||{}))g!=null&&f.set(u,typeof g=="object"&&!Array.isArray(g)?JSON.stringify(g):String(g));return t(f)},[d.search,t]),a=k.useCallback((f,u)=>{const g=y?y(r,f):{...r,...f},x=o(g),_={};for(const[j,b]of Object.entries(d.search||{}))b!=null&&(_[j]=b);for(const j of s)delete _[j];if(i)for(const j of Object.keys(_))j.startsWith("clf_")&&delete _[j];for(const[j,b]of Object.entries(x))b!==void 0&&(_[j]=b);m({to:d.pathname,search:_,replace:u?.replace??l})},[r,o,s,i,y,m,d,l]),c=k.useCallback(()=>{const f={};for(const[u,g]of Object.entries(d.search||{}))g!=null&&(s.includes(u)||i&&u.startsWith("clf_")||(f[u]=g));m({to:d.pathname,search:f,replace:l})},[m,d.pathname,d.search,s,i,l]);return{filters:r,updateFilters:a,clearFilters:c}}function As(e){const{slug:t}=on();return vt({queryKey:["schedules",t,e],queryFn:async()=>((await yt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(s=>s.action_args?.agent_id===e),enabled:!!t&&!!e,staleTime:3e4})}function Fs(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.connection_id)},search:{feedId:t.id}}}function Ts(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.id)}}}function ws(e,t){return{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:t}}}function Rs(e,t){return{to:"/$owner/automations/$automationId",params:{owner:e,automationId:t}}}function Ps(e,t,o){return{to:"/$owner/events",params:{owner:e},search:{agent:t,schedule:o}}}function fe({id:e,label:t,value:o,sourceLink:s,details:i,onRemove:l}){return{id:e,label:t,op:"is",value:o,onRemove:l,editor:s||i?{kind:"custom",className:"w-80",render:()=>n.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[s?n.jsxs(je,{to:s.to,params:s.params,search:s.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[n.jsx("span",{className:"truncate",children:o}),n.jsx(an,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):n.jsx("span",{className:"font-medium",children:o}),i]})}:void 0}}function Ls({ownerSlug:e,clientIds:t,linkedUser:o,linkedUserEntitySlug:s}){const i=e&&s?cn(e,[{entity_type:"$member",slug:s}]):null;return n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[n.jsx("span",{children:t.length===1?"Client ID":"Client IDs"}),t.map(l=>n.jsx("code",{className:"break-all text-foreground",children:l},l))]}),o?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",i?n.jsx(je,{to:i,className:"font-medium text-foreground hover:underline",children:o}):n.jsx("span",{className:"font-medium text-foreground",children:o})]}):null]})}function H(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function pe(e,t,o){const s=new Set;for(const[i,l]of Object.entries(e.feeds_schema??{})){if(o&&!o.has(i))continue;const y=H(H(l)?.eventKinds);if(y)for(const[m,d]of Object.entries(y)){if(!t){s.add(m);continue}const r=H(d)?.attributions;Array.isArray(r)&&r.some(a=>{const c=H(H(a)?.target);return typeof c?.entityType=="string"&&t.has(c.entityType)})&&s.add(m)}}return s}function Os({connectors:e,entityTypes:t,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:i=[]}){const l=new Set,y=new Set(o),m=new Set(i),d=new Map;for(const r of s){const a=d.get(r.connectorKey)??new Set;a.add(r.feedKey),d.set(r.connectorKey,a)}if(d.size>0)for(const r of e){const a=d.get(r.key);if(a)for(const c of pe(r,void 0,a))l.add(c)}else if(y.size>0){for(const r of e)if(y.has(r.key))for(const a of pe(r))l.add(a)}else if(m.size>0){for(const r of t)if(m.has(r.slug))for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r,m))l.add(a)}else{for(const r of t)for(const a of Object.keys(r.event_kinds??{}))l.add(a);for(const r of e)for(const a of pe(r))l.add(a)}return[...l].sort((r,a)=>r.localeCompare(a))}function $s(e){const{orgContext:t}=rn(),{data:o=[],isLoading:s}=gt(t);return{visible:k.useMemo(()=>o.filter(l=>!ln(l)&&(!l.organization_slug||l.organization_slug===e)),[o,e]),isTypesLoading:s}}function te({to:e,params:t,search:o,label:s}){return n.jsx(je,{to:e,params:t,search:o,onClick:i=>i.stopPropagation(),onPointerDown:i=>i.stopPropagation(),className:"shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Manage ${s}`,children:n.jsx(dn,{className:"h-3.5 w-3.5"})})}const Le=["produced","analyzed"],be=e=>e==="produced"?"Produced by":"Analyzed by";function Ms({enabled:e,...t}){const o=Ds(t,e);if(!e)return{fields:[],chips:[]};const s=Ks(t);return{fields:[o.field,s.field],chips:[...o.chips,...s.chips]}}function Ds({ownerSlug:e,filters:t,onFiltersChange:o},s){const i=vt({queryKey:["automations-list","activity",e],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(c=>yt("manage_automations",{action:"list",status:c,include_details:!1},{slug:e})));return[...new Map(a.flatMap(c=>c.automations).map(c=>[Number(c.automation_id),c])).values()].sort((c,f)=>c.name.localeCompare(f.name))},enabled:s&&!!e,staleTime:3e4}),l=i.data??[],y=a=>a==="produced"?t.producedByAutomationId:t.automationId,m=a=>l.find(c=>Number(c.automation_id)===a)?.name??`#${a}`,d=Le.flatMap(a=>{const c=y(a);return c==null?[]:[{id:`automation-${a}`,field:"automation",label:be(a),value:m(c),onRemove:()=>o(a==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),r={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:i.isLoading?"Loading Automations...":"No Automations found",items:a=>n.jsxs(n.Fragment,{children:[Le.map(c=>{const f=y(c),u=l.map(x=>({id:Number(x.automation_id),label:`${x.name}${x.status==="archived"?" (archived)":""}`}));f!=null&&!u.some(x=>x.id===f)&&u.unshift({id:f,label:`Automation #${f} (selected)`});const g=x=>{o(c==="produced"?{producedByAutomationId:x}:{automationId:x}),a()};return n.jsx(xt,{heading:be(c),children:u.map(x=>n.jsxs(A,{"aria-label":x.label,value:`${c} ${x.label} ${x.id}`,onSelect:()=>g(x.id),className:"group",children:[n.jsx($,{selected:f===x.id}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.label}),n.jsx(te,{...Rs(e,String(x.id)),label:x.label})]},x.id))},c)}),i.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void i.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:n.jsx(un,{className:"h-4 w-4"}),editor:r}}}function Ks(e){const{filters:t,onFiltersChange:o}=e,s=[];t.runIds?.length&&s.push({id:"run-produced",field:"run",label:"Produced by run",value:t.runIds.map(l=>`#${l}`).join(", "),onRemove:()=>o({runIds:null})}),t.runId!=null&&s.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${t.runId}`,onRemove:()=>o({runId:null})});const i={kind:"list",className:"w-96",searchPlaceholder:"Search runs or enter a run ID...",emptyText:"No matching runs. Enter an exact run ID or load more.",items:(l,y)=>Le.map(m=>n.jsx(Bs,{...e,mode:m,query:y,close:l},m))};return{chips:s,field:{key:"run",label:"Run",group:"Scope",icon:n.jsx(mn,{className:"h-4 w-4"}),editor:i}}}function Bs({ownerSlug:e,filters:t,onFiltersChange:o,mode:s,query:i,close:l}){const y=s==="produced"?t.producedByAutomationId:t.automationId,m=ys({workspace:!0},{automationIds:y==null?void 0:[y],runTypes:s==="analyzed"?["automation"]:void 0,connectionIds:s==="produced"?t.connectionIds??void 0:void 0,feedIds:s==="produced"?t.feedIds??void 0:void 0},e),d=s==="produced"?t.runIds??[]:t.runId==null?[]:[t.runId],r=m.data?.pages.flatMap(u=>u.runs)??[],a=[...new Map(r.map(u=>[u.id,{id:u.id,label:`Run #${u.id} · ${u.feed_display_name??u.operation_key??u.run_type} · ${u.status}`}])).values()];for(const u of d)a.some(g=>g.id===u)||a.unshift({id:u,label:`Run #${u} (selected)`});const c=u=>{if(s==="produced"){const g=d.includes(u)?d.filter(x=>x!==u):[...d,u];o({runIds:g.length?g:null})}else o({runId:u}),l()},f=/^\d+$/.test(i.trim())?Number(i.trim()):0;return n.jsxs(xt,{heading:be(s),children:[a.map(u=>n.jsxs(A,{value:`${s} ${u.label}`,onSelect:()=>c(u.id),children:[n.jsx($,{selected:d.includes(u.id)}),n.jsx("span",{className:"truncate",children:u.label})]},u.id)),Number.isSafeInteger(f)&&f>0&&!a.some(u=>u.id===f)?n.jsxs(A,{value:`${s} ${f}`,onSelect:()=>c(f),children:[be(s)," run #",f]}):null,m.isLoading?n.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,m.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void(m.isFetchNextPageError?m.fetchNextPage():m.refetch()),children:"Could not load runs. Retry"}):null,!m.isLoading&&!m.isError&&!a.length?n.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,m.hasNextPage?n.jsx(A,{forceMount:!0,disabled:m.isFetching,onSelect:()=>void m.fetchNextPage(),children:m.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const De="Scope",Te="Source",G="h-4 w-4";function oe(){return se().search??{}}function At(e){const{pathname:t}=se(),{_splat:o}=vn({strict:!1}),s=!!(o&&!yn(o.split("/")[0])&&!t.startsWith(`/${e}/events/`));return{pathname:t,embedded:s,recordPath:s||t.startsWith(`/${e}/events/`)?o:void 0}}function Ft(e){const t=oe(),{recordPath:o,pathname:s,embedded:i}=At(e);return l=>{const y=ne(e,t,l,o);return i?{to:s,search:y.search}:y}}const ut=e=>new Set((e??"").split(",").map(t=>t.trim()).filter(Boolean));function Vs({ownerSlug:e,sourceRead:t=!1,filters:o,onFiltersChange:s}){const i=oe(),{recordPath:l,embedded:y}=At(e),m=l?l.split("/").at(-2):void 0,d=typeof i.type=="string"&&i.type.trim()?i.type.trim():void 0,r=m??(d?fn(d):void 0),a=pn(i),c=hn(i),f=typeof i.feed_ids=="string"?i.feed_ids:typeof i.feed_ids=="number"?String(i.feed_ids):void 0,u=Gs(e,r,!y),g=Qs(e,r,l,y),x=Us(e,a,!t),_=Ms({ownerSlug:e,filters:o,onFiltersChange:s,enabled:!t}),j=Ws(e,c,f);return[u,g,x,_,j].reduce((b,I)=>({fields:[...b.fields,...I.fields],chips:[...b.chips,...I.chips]}),{fields:[],chips:[]})}function Gs(e,t,o){const s=V(),i=oe(),{visible:l}=$s(e);if(!o)return{fields:[],chips:[]};const y=l.find(d=>d.slug===t),m={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>n.jsxs(n.Fragment,{children:[l.map(r=>n.jsxs(A,{onSelect:()=>{s(ne(e,i,{entity:void 0,create:void 0,type:r.slug})),d()},className:"group gap-2",children:[n.jsx($,{selected:r.slug===t}),n.jsx(En,{icon:r.icon,className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),typeof r.entity_count=="number"?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r.entity_count}):null,n.jsx(te,{to:"/$owner/entity-types/$slug",params:{owner:e,slug:r.slug},label:r.name})]},r.id)),n.jsxs(A,{onSelect:()=>{s(An(e)),d()},className:"text-muted-foreground",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:De,icon:n.jsx(gn,{className:G}),editor:m}],chips:t?[{id:"type",label:"Entity type",op:"is",value:y?.name??t,onRemove:()=>void s(ne(e,i,{type:void 0}))}]:[]}}function Qs(e,t,o,s){const i=V(),l=oe(),[y,m]=k.useState(""),[d,r]=k.useState(0),a=bt(y,250),c={slug:e},{data:f,isLoading:u,isError:g,refetch:x}=xn(t??"",c,{search:a,offset:d,limit:30,enabled:!s&&!!t}),{data:_}=bn(o?`/${e}/${o}`:"",c),j=o?_?.entity:void 0,b=j?.name??(o?o.split("/").at(-1):void 0);if(s)return{fields:[],chips:b?[{id:"entity",label:"Entity",op:"is",value:b}]:[]};if(!t)return{fields:[],chips:[]};const I={kind:"list",searchPlaceholder:"Search entities...",emptyText:u?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:T=>{m(T),r(0)},items:T=>n.jsxs(n.Fragment,{children:[g?n.jsx(A,{onSelect:()=>void x(),children:"Could not load entities. Retry"}):f?.entities.map(E=>n.jsxs(A,{value:E.slug,onSelect:()=>{const R=Fn(Tn([...E.parent_slug&&E.parent_entity_type?[{entity_type:E.parent_entity_type,slug:E.parent_slug}]:[],{entity_type:E.entity_type,slug:E.slug}]));i(ne(e,l,{type:t},R)),T()},children:[n.jsx($,{selected:j?.slug===E.slug}),E.name]},E.slug)),d>0&&n.jsx(A,{onSelect:()=>r(Math.max(0,d-30)),children:"Previous entities"}),f?.metadata.has_more&&n.jsx(A,{disabled:u,onSelect:()=>r(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:De,icon:n.jsx(jn,{className:G}),editor:I}],chips:b?[{id:"entity",label:"Entity",op:"is",value:b,onRemove:()=>void i(ne(e,l,{type:t}))}]:[]}}function Us(e,t,o){const s=V(),i=Ft(e),{data:l=[]}=kn(),y=k.useMemo(()=>[...l].sort((r,a)=>r.name.localeCompare(a.name)),[l]);if(!o)return{fields:[],chips:[]};const m=y.find(r=>r.agentId===t),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:r=>y.map(a=>n.jsxs(A,{onSelect:()=>{s(i({agent:a.agentId,schedule:void 0})),r()},className:"gap-2",children:[n.jsx($,{selected:a.agentId===t}),n.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:a.name.trim().charAt(0).toUpperCase()||"?"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.name})]},a.agentId))};return{fields:[{key:"agent",label:"Agent",group:De,icon:n.jsx(Sn,{className:G}),editor:d}],chips:t?[{id:"agent",label:"Agent",op:"is",value:m?.name??t,onRemove:()=>void s(i({agent:void 0,schedule:void 0}))}]:[]}}function Ws(e,t,o){const s=V(),i=Ft(e),{groups:l}=Is(),y=oe(),m=xe({platforms:String(y.platforms??y.platform??"")}).platforms??[],d=k.useMemo(()=>ut(t),[t]),r=k.useMemo(()=>ut(o),[o]),a=m.length===1?m[0]:Nn(l,d),c=l.find(S=>S.connector_key===a),f=d.size===1?Number([...d][0]):void 0,u=Cn(f),{org:g}=jt(),x=kt(g?.id,{feedIds:[...r].map(Number),enabled:f==null&&r.size>0}),_=f==null?x:u,j=_.data??[],b={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},I={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:S=>n.jsxs(n.Fragment,{children:[l.map(p=>{const C=p.connector_name??p.connector_key;return n.jsxs(A,{disabled:p.connections.length===0,onSelect:()=>{s(i({...b,platforms:p.connector_key})),S()},className:"group gap-2",children:[n.jsx($,{selected:p.connector_key===c?.connector_key}),n.jsx(Rn,{plain:!0,name:C,faviconDomain:p.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:C}),p.connection_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:p.connection_count}):null,n.jsx(te,{to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:p.connector_key},label:C})]},p.connector_key)}),n.jsx(A,{asChild:!0,onSelect:S,className:"text-muted-foreground",children:n.jsxs(je,{to:"/$owner/connectors/create",params:{owner:e},className:"flex items-center gap-2",children:[n.jsx(St,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},T=[{key:"connector",label:"Connector",group:Te,icon:n.jsx(wn,{className:G}),editor:I}],E=[],R=c?.connector_name??c?.connector_key??(m.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(R&&E.push({id:"connector",label:"Connector",op:"is",value:R,onRemove:()=>void s(i(b))}),c){T.push({key:"connection",label:"Connection",group:Te,icon:n.jsx(_n,{className:G}),editor:M(c)});const S=d.size===1?c.connections.find(p=>d.has(String(p.id))):void 0;S&&E.push({id:"connection",label:"Connection",op:"is",value:dt({display_name:S.display_name,connector_name:c.connector_name,connector_key:c.connector_key}),onRemove:()=>void s(i({...b,platforms:c.connector_key}))})}if((f||o)&&T.push({key:"feed",label:"Feed",group:Te,icon:n.jsx(In,{className:G}),editor:D()}),r.size>0){const S=r.size===1?j.find(p=>r.has(String(p.id))):void 0;E.push({id:"feed",label:"Feed",op:"is",value:S?he(S):`#${o}`,onRemove:()=>void s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:void 0}))})}return{fields:T,chips:E};function M(S){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:p=>S.connections.map(C=>{const Q=dt({display_name:C.display_name,connector_name:S.connector_name,connector_key:S.connector_key});return n.jsxs(A,{onSelect:()=>{s(i({connection_ids:String(C.id),feed_ids:void 0})),p()},className:"group gap-2",children:[n.jsx($,{selected:d.has(String(C.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q}),C.feed_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:C.feed_count}):null,n.jsx(te,{...Ts(e,{id:C.id,connector_key:S.connector_key}),label:Q})]},C.id)})}}function D(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:_.isLoading?"Loading feeds...":"No feeds",items:S=>j.map(p=>n.jsxs(A,{"aria-label":he(p),onSelect:()=>{s(i({...f!=null?{connection_ids:String(f)}:{},feed_ids:String(p.id)})),S()},className:"group gap-2",children:[n.jsx($,{selected:r.has(String(p.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:he(p)}),n.jsx(te,{...Fs(e,p),label:he(p)})]},p.id))}}}function he(e){return e.display_name?.trim()||e.feed_key}const zs=["notification"],qs=["note","summary","decision","observation","fact","change","preference","identity"],Ys=[...zs,...qs],mt=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}],ft=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],pt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],ve=0,ye=100,X="Event",J="h-4 w-4";function ee(e){const t=e.replace(/[_-]+/g," ").trim();return t.length>0?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e}function Zs(e,t,o){const s=e.semanticTypes??[],i=o.length>0?o:Ys,l=[...new Set([...i,...s])].sort((c,f)=>ee(c).localeCompare(ee(f))).map(c=>({value:c,label:ee(c)})),y=e.engagementRange??[ve,ye],m=e.reviewStatus,d=e.interactionStatus,r=[{key:"date",label:"Date",group:X,icon:n.jsx(Gn,{className:J}),editor:fs({value:e.dateRange??void 0,onApply:c=>t({dateRange:c})})},{key:"kind",label:"Event kind",group:X,icon:n.jsx(Qn,{className:J}),editor:ge({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:l,selected:s,multiple:!0,onSelect:c=>{const f=s.includes(c)?s.filter(u=>u!==c):[...s,c];t({semanticTypes:f.length>0?f:void 0})}})},{key:"approval",label:"Approval",group:X,icon:n.jsx(Un,{className:J}),editor:ge({searchPlaceholder:"Search statuses...",options:[...pt],selected:d?[d]:[],onSelect:c=>t({interactionStatus:c})})},{key:"review",label:"Reviewed by",group:X,icon:n.jsx(Wn,{className:J}),editor:ge({searchPlaceholder:"Search reviewers...",options:[...ft],selected:m&&m!=="all"?[m]:[],onSelect:c=>t({reviewStatus:c})})},{key:"score",label:"Engagement score",group:X,icon:n.jsx(zn,{className:J}),editor:ps({value:y,min:ve,max:ye,onApply:c=>t({engagementRange:c})})}],a=[];return e.dateRange&&a.push({id:"date",label:"Date",op:"is",value:hs(e.dateRange),onRemove:()=>t({dateRange:null})}),s.length&&a.push({id:"kind",label:"Event kind",op:s.length>1?"is any of":"is",value:s.length<=2?s.map(ee).join(", "):`${s.length} kinds`,title:s.map(ee).join(", "),onRemove:()=>t({semanticTypes:void 0})}),d&&a.push({id:"approval",label:"Approval",op:"is",value:pt.find(c=>c.value===d)?.label??d,onRemove:()=>t({interactionStatus:null})}),m&&m!=="all"&&a.push({id:"review",label:"Reviewed by",op:"is",value:ft.find(c=>c.value===m)?.label??m,onRemove:()=>t({reviewStatus:void 0})}),(y[0]!==ve||y[1]!==ye)&&a.push({id:"score",label:"Engagement score",value:vs(y,ve,ye),onRemove:()=>t({engagementRange:void 0})}),{fields:r,chips:a}}function Tt({filters:e,onFiltersChange:t,eventKinds:o=[],searchQuery:s,onSearchChange:i,scope:l,extraFields:y=[],drillChips:m=[],total:d,isListLoading:r=!1,isTotalLoading:a=!1,hasCursorInUrl:c=!1,onGoToLatest:f,leading:u,sourceRead:g=!1,filterTrailing:x,onClearFilters:_}){const j=s.trim().length>0,b=g?{fields:[],chips:[]}:Zs(e,t,o),I=[...l?.fields??[],...b.fields,...y],T=[...l?.chips??[],...m,...b.chips],E=T.length>0||j,R=`${e.sortBy??"date"}-${e.sortOrder??"desc"}`,M=mt.find(S=>S.value===R)?.label??"Newest first",D=r||a?n.jsx(Nt,{className:"h-4 w-20"}):d==null?null:E?`${d.toLocaleString()} ${d===1?"match":"matches"}`:`${d.toLocaleString()} ${d===1?"item":"items"}`;return n.jsxs("div",{className:"w-full space-y-2.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[u,!g&&n.jsxs("div",{className:"relative w-full min-w-48 flex-1 sm:max-w-xs",children:[n.jsx(Pn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Ln,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:s,onChange:S=>i(S.target.value),className:Oe("pl-9",j&&"pr-8")}),j&&n.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>i(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:n.jsx(On,{className:"h-3.5 w-3.5"})})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!r&&c&&f&&n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 gap-1",onClick:f,children:[n.jsx($n,{className:"h-3.5 w-3.5"}),"Back to latest"]}),!g&&n.jsxs(Mn,{value:R,onValueChange:S=>{const[p,C]=S.split("-");t({sortBy:p,sortOrder:C})},children:[n.jsx(Dn,{"aria-label":"Sort",className:"h-9 w-[168px] px-2.5",children:n.jsx(Kn,{children:n.jsxs("span",{className:"truncate",children:[n.jsx("span",{className:"text-muted-foreground",children:"Sort: "}),M]})})}),n.jsx(Bn,{children:mt.map(S=>n.jsx(Vn,{value:S.value,children:S.label},S.value))})]})]})]}),n.jsx(ms,{label:"Event filters",fields:I,chips:T,meta:D,trailing:x,onClearAll:_,hasClearableState:j})]})}function wt({ownerSlug:e,...t}){const o=Vs({ownerSlug:e,sourceRead:t.sourceRead,filters:t.filters,onFiltersChange:t.onFiltersChange});return n.jsx(Tt,{...t,scope:o})}function Hs(e){const t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t}function ht(e){return e.toISOString().split("T")[0]}function Xs({entityId:e,organizationId:t,ownerSlug:o,selectedRange:s,onSelectRange:i}){const{data:l,isLoading:y,error:m}=qn(t,{entityId:e},{slug:o}),d=k.useMemo(()=>{if(!l||l.length===0)return[];const f=l.map(j=>{const b=Hs(j.date);return b?{date:b,count:j.count}:null}).filter(j=>j!==null).sort((j,b)=>j.date.getTime()-b.date.getTime());if(f.length===0)return[];const u=f[0].date;if((f[f.length-1].date.getTime()-u.getTime())/(1e3*60*60*24)>180){const j=new Map;for(const b of f){const I=new Date(b.date);I.setDate(b.date.getDate()-b.date.getDay());const T=ht(I);j.set(T,(j.get(T)||0)+b.count)}return Array.from(j.entries()).map(([b,I])=>({date:b,count:I})).sort((b,I)=>new Date(b.date).getTime()-new Date(I.date).getTime())}return f.map(j=>({date:ht(j.date),count:j.count}))},[l]),r=k.useCallback(f=>{if(f.name&&i){const u=new Date(f.name),g=new Date(u);g.setDate(g.getDate()+1),i(u,g)}},[i]),a=k.useCallback(f=>{if(i&&f.startValue!==void 0&&f.endValue!==void 0){const u=new Date(f.startValue),g=new Date(f.endValue);i(u,g)}},[i]),c=k.useMemo(()=>{if(d.length===0)return null;let f;if(s){const u=s[0].toISOString().split("T")[0],g=s[1].toISOString().split("T")[0];f=[[{xAxis:u},{xAxis:g}]]}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:u=>{const g=u[0];return`${new Date(g.name).toLocaleDateString()}: ${g.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:d.map(u=>u.date),axisLabel:{formatter:u=>{const g=new Date(u);return`${g.getMonth()+1}/${g.getDate()}`}}},yAxis:{type:"value",minInterval:1,splitLine:{lineStyle:{color:"rgba(0,0,0,0.05)"}}},dataZoom:[{type:"slider",start:0,end:100,height:20,bottom:10,borderColor:"transparent",backgroundColor:"rgba(0,0,0,0.02)",fillerColor:"rgba(99, 102, 241, 0.1)",handleStyle:{color:"#6366f1"}}],series:[{type:"line",smooth:!0,areaStyle:{opacity:.3,color:new ks(0,0,0,1,[{offset:0,color:"rgba(99, 102, 241, 0.5)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}])},lineStyle:{width:2,color:"#6366f1"},itemStyle:{color:"#6366f1"},showSymbol:!1,data:d.map(u=>u.count),markLine:{silent:!0,symbol:"none",label:{position:"insideEndTop",formatter:"avg: {c}",fontSize:10,color:"#9ca3af"},lineStyle:{color:"#d1d5db",type:"dashed",width:1},data:[{type:"average",name:"Average"}]},markArea:f?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:f}:void 0}]}},[d,s]);return y||m?n.jsx("div",{className:Oe(Ct,"p-4"),children:n.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?n.jsx(Ns,{}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})}):!c||d.length<2?null:n.jsx(Js,{option:c,onClick:r,onDataZoom:a})}function Js({option:e,onClick:t,onDataZoom:o}){const{chartRef:s,setOption:i}=Ss({onClick:t,onDataZoom:o});return k.useEffect(()=>{i(e,!0)},[e,i]),n.jsx("div",{"data-testid":"events-timeline",className:Oe(Ct,"p-4 relative"),children:n.jsx("div",{ref:s,className:"h-48 w-full"})})}function eo({organizationId:e,ownerSlug:t,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:i,filterBarLeading:l}){const{isAuthenticated:y,isReady:m}=Yn(),{isMember:d,isLoading:r}=jt(),a=m&&y&&d,c=m&&(!y||!r&&!d),f=V(),u=se(),g=Zn(),{filters:x,updateFilters:_,clearFilters:j}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),[b,I]=k.useState(x.searchQuery||""),[T,E]=k.useState(we(x)||s&&(o!=null||!!i?.length)),R=b.trim(),M=R.length>=3?R:void 0,D=bt(M,1e3),S=k.useRef(!1);k.useEffect(()=>g.history.subscribe(({location:h,action:v})=>{const N=xe(new URLSearchParams(h.search)).searchQuery??"";!(v.type==="BACK"||v.type==="FORWARD"||v.type==="GO")&&S.current&&(N===(x.searchQuery??"")||N===(M??""))||(S.current=!1,I(N))}),[g.history,M,x.searchQuery]);const p=k.useMemo(()=>ct({...x,...i?.length?{entityTypes:i}:{}}),[x,i]),C=_;k.useEffect(()=>{S.current&&(x.searchQuery||void 0)!==D&&_({searchQuery:D})},[D,_,x.searchQuery]);const Q=()=>{S.current=!1,I(""),s&&t?f({...Pe(t,u.search??{}),...o!==void 0&&!u.pathname.startsWith(`/${t}/events/`)?{to:u.pathname}:{}}):j()},ke=we(ct(x)),Ke=o===void 0,{data:Rt=[]}=Hn(m&&a?e:null),{data:Pt=[]}=Xn(c?t:null),Be=a?Rt:Pt,{data:Ve=[]}=gt(a&&e?{organizationId:e}:void 0),ae=Es(),ie=p.connectionIds,Se=(ie?.length??0)>0,{data:Ge=[]}=Jn(m&&a?e??"":"",{connectionIds:ie??void 0,enabled:!ae&&m&&a&&Se}),Qe=p.feedIds,Ne=(Qe?.length??0)>0,{data:Ue=[]}=kt(m&&a?e:null,{feedIds:Qe??void 0,enabled:m&&a&&Ne}),We=k.useMemo(()=>ae?ae.groups.flatMap(h=>h.connections.map(v=>({id:v.id,display_name:v.display_name,connector_name:h.connector_name,connector_key:h.connector_key}))):Ge,[Ge,ae]),Ce=k.useMemo(()=>{const h=new Set(ie??[]);return[...new Set([...p.platforms??[],...We.filter(v=>h.has(v.id)).map(v=>v.connector_key)])]},[ie,We,p.platforms]),_e=k.useMemo(()=>Ue.map(h=>({connectorKey:h.connector_key,feedKey:h.feed_key})),[Ue]),Lt=k.useMemo(()=>Se&&Ce.length===0||Ne&&_e.length===0?[]:Os({connectors:Be,entityTypes:Ve,selectedPlatforms:Ce,selectedFeeds:_e,selectedEntityTypes:p.entityTypes}),[Be,p.entityTypes,Se,Ne,Ce,_e,Ve]),w=p.clientIds,ce=(w?.length??0)>0,{data:ze=[]}=xs(null,{enabled:m&&a&&ce}),re=k.useMemo(()=>{if(!w)return[];const h=new Set(w);return bs(ze).filter(v=>v.clientIds.some(N=>h.has(N)))},[w,ze]),qe=k.useMemo(()=>{if(!ce||!w)return null;const h=re.map(v=>v.title);return h.length>0?h.join(", "):w.length>1?`${w.length} client registrations`:"Client registration"},[re,w,ce]),le=re.length===1?re[0]:null,Ot=t&&le?ws(t,le.clientId):void 0,de=p.mcpActivityId??null,{data:Ye=[]}=es({enabled:m&&a&&ce&&!!de,clientIds:w??[],limit:100}),Ze=k.useMemo(()=>{if(!de)return null;const h=Ye.find(N=>N.activityId===de);if(!h)return"Selected conversation";const v=h.title?.trim();return v||(h.activityKind==="session"?"MCP session":h.clientId)},[de,Ye]),U=p.agentId,W=p.schedule,{data:He=[]}=As(U??void 0),Xe=k.useMemo(()=>!W||!U?null:He.find(v=>v.id===W)?.description?.trim()||"Scheduled task",[U,W,He]),{data:$t}=ts(m&&a?e:null,o),{data:Mt}=ns(c&&!Ke?t:null,o),Je=a?$t:Mt,Ie=k.useMemo(()=>{const h=new Map;for(const v of Je||[]){const N=v.automation_name??"__global__";h.has(N)||h.set(N,{automationName:v.automation_name??null,classifiers:[]});const F=h.get(N),L=v.attribute_values||{},P=Object.keys(L);let me=null;const q={};for(const[Y,B]of Object.entries(L))if(B.parent)for(const[Fe,Z]of Object.entries(B.parent))me=Fe,q[Z]||(q[Z]=[]),q[Z].push(Y);const O=F.classifiers.find(Y=>Y.slug===v.slug);if(O){const Y=new Set([...O.values,...P]);O.values=[...Y];for(const[B,Fe]of Object.entries(q)){O.valuesByParentValue[B]||(O.valuesByParentValue[B]=[]);const Z=new Set([...O.valuesByParentValue[B],...Fe]);O.valuesByParentValue[B]=[...Z]}me&&(O.parentSlug=me)}else F.classifiers.push({slug:v.slug,name:v.name,values:P,parentSlug:me,valuesByParentValue:q})}for(const v of h.values())v.classifiers.sort((N,F)=>N.parentSlug===null&&F.parentSlug!==null?-1:N.parentSlug!==null&&F.parentSlug===null?1:0);return[...h.values()]},[Je]),Dt=ss(m&&a?e:null,o,p,t),Kt=os(c?t:null,o,p),Bt=c?Kt:Dt,{data:z,isLoading:Vt,error:Gt}=Bt,et=z?.pages[0],tt=(et?.content.length??0)>0,Qt=as(m&&a?e:null,o,p,t),Ut=is(c?t:null,o,p),Ee=c?Ut:Qt,Wt=Ee.data?.total??void 0,zt=Ee.data?.classification_stats,qt=Ee.isLoading,Yt=!!(p.beforeOccurredAt||p.afterOccurredAt),nt=cs(p),st=z?.pages[z.pages.length-1],K=st?.content[st.content.length-1];k.useEffect(()=>{!nt||!K||z?.pages.length===1||x.beforeOccurredAt===K.occurred_at&&x.beforeId===K.id||_({beforeOccurredAt:K.occurred_at,beforeId:K.id},{replace:!0})},[K?.id,nt,_,z?.pages.length,K,x.beforeOccurredAt,x.beforeId]);const Zt=k.useCallback(()=>{C({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[C]),Ht=(h,v)=>{C({dateRange:[h,v]})},ot=(h,v)=>{const N={...p.classificationFilters||{}};if(v.length>0)N[h]=v;else{delete N[h];for(const F of Ie)for(const L of F.classifiers)L.parentSlug===h&&delete N[L.slug]}C({classificationFilters:N})},Xt=(h,v)=>{const N=p.classificationFilters?.[h]||[];ot(h,N.includes(v)?N.filter(F=>F!==v):[...N,v])},Jt=h=>ot(h,[]);if(Gt)return n.jsx(rs,{label:"knowledge"});const Ae=!m||y&&r||a&&!e||Vt,ue={fields:[],chips:[]};for(const h of Ie)for(const v of h.classifiers){const N=p.classificationFilters?.[v.slug]??[],F=v.parentSlug?p.classificationFilters?.[v.parentSlug]??[]:void 0,L=F?[...new Set(F.flatMap(P=>v.valuesByParentValue[P]??[]))]:v.values;L.length>0&&ue.fields.push({key:`clf:${v.slug}`,label:v.name,group:h.automationName??"Classifiers",icon:n.jsx(ls,{className:"h-4 w-4"}),editor:ge({searchPlaceholder:`Search ${v.name.toLowerCase()}...`,options:L.map(P=>({value:P,label:P,count:zt?.[v.slug]?.[P]})),selected:N,multiple:!0,onSelect:P=>Xt(v.slug,P)})})}for(const[h,v]of Object.entries(p.classificationFilters??{})){if(v.length===0)continue;const N=Ie.flatMap(F=>F.classifiers).find(F=>F.slug===h);ue.chips.push({id:`clf:${h}`,field:`clf:${h}`,label:N?.name??h,op:v.length>1?"is any of":"is",value:v.join(", "),onRemove:()=>Jt(h)})}const en=[p.contentIds?.length?fe({id:"contentIds",label:p.contentIds.length>1?"Events":"Event",value:`#${p.contentIds.join(", #")}`,onRemove:()=>C({contentIds:void 0})}):null,Ze?fe({id:"mcpActivityId",label:"Conversation",value:Ze,onRemove:()=>C({mcpActivityId:void 0})}):null,qe?fe({id:"clientIds",label:"Connected app",value:qe,sourceLink:Ot,details:w&&w.length>0?n.jsx(Ls,{ownerSlug:t,clientIds:w,linkedUser:le?.linkedUser,linkedUserEntitySlug:le?.linkedUserEntitySlug}):void 0,onRemove:()=>C({clientIds:void 0})}):null,Xe?fe({id:"schedule",label:"Schedule",value:Xe,sourceLink:t&&U&&W?Ps(t,U,W):void 0,onRemove:()=>C({schedule:void 0,runIds:void 0})}):null,...ue.chips].filter(h=>h!=null),at={filterTrailing:!!(a&&o&&e)?n.jsxs($e,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":T,onClick:()=>E(h=>!h),children:[n.jsx(us,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Q,leading:l,filters:p,onFiltersChange:C,eventKinds:Lt,searchQuery:b,onSearchChange:h=>{S.current=!0,I(h)},extraFields:ue.fields,drillChips:en,total:Wt,isListLoading:Ae,isTotalLoading:qt,hasCursorInUrl:Yt&&tt,onGoToLatest:Zt},tn=!Ae&&!!et&&!tt&&!ke,nn=y?a?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",it=!!(a&&t);return n.jsx(ds,{children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:s?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-3 lg:-mx-6 lg:px-6":void 0,children:s&&t?n.jsx(wt,{...at,ownerSlug:t}):n.jsx(Tt,{...at})}),T&&a&&o&&e&&n.jsx(Xs,{entityId:o,organizationId:e,ownerSlug:t||"",selectedRange:p.dateRange||void 0,onSelectRange:Ht}),Ae?n.jsx("div",{className:"space-y-4",children:["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(h=>n.jsx(Nt,{className:"h-32 rounded-lg"},h))}):tn?n.jsx(rt,{icon:lt,title:"No activity yet",description:nn,actionLabel:it?"Add a connector":void 0,onAction:it&&t?()=>void f({to:"/$owner/connectors/create",params:{owner:t}}):void 0}):n.jsx(js,{onFiltersChange:C,organizationId:e,ownerSlug:t,entityId:o,filters:p,showEntityLinks:Ke,foldConsecutiveCalls:!0,groupByConversation:!0,emptyState:n.jsx(rt,{icon:lt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ke?"Clear filters":void 0,onAction:ke?Q:void 0})})]})})}function to({record:e,ownerSlug:t,filterBarLeading:o}){const s=se(),i=V(),{filters:l,updateFilters:y}=Et({parse:xe,serialize:Re,filterKeys:It,replace:!1,merge:_t}),m=we({...l,platforms:void 0,connectionIds:void 0,feedIds:void 0})||l.sortBy!=null&&l.sortBy!=="date"||l.sortOrder!=null&&l.sortOrder!=="desc",d=()=>{i({...Pe(t,s.search??{}),...s.pathname.startsWith(`/${t}/events/`)?{}:{to:s.pathname}})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(wt,{ownerSlug:t,sourceRead:!0,leading:o,filters:l,onFiltersChange:y,searchQuery:l.searchQuery??"",onSearchChange:r=>y({searchQuery:r}),onClearFilters:d}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Live activity supports connector, connection and feed filters. Search and other event filters are available for saved activity."}),m?n.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[n.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),n.jsx($e,{variant:"outline",size:"sm",onClick:()=>{const r=Re({platforms:l.platforms,connectionIds:l.connectionIds,feedIds:l.feedIds}),a={...Pe(t,s.search??{}).search,...r};i({to:s.pathname,search:a})},children:"Clear unsupported filters"})]}):n.jsx(gs,{record:e,orgContext:{slug:t},filters:l})]})}function vo({entity:e,organizationId:t,ownerSlug:o,filterBarLeading:s}){const i=e.is_derived?n.jsx(to,{ownerSlug:o,record:{type:e.entity_type,key:e.slug},filterBarLeading:s}):n.jsx(eo,{organizationId:t,ownerSlug:o,entityId:e.id,hideSourceFilter:!0,filterBarLeading:s});return n.jsx(_s,{organizationId:t,children:e.entity_type==="$member"?n.jsx(Cs,{children:i}):i})}export{eo as E,_s as M,vo as R};
2
+ //# sourceMappingURL=record-activity-CBXH6v1d.js.map