@lobu/runtime-server 24.1.1 → 24.3.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.
- package/dist/catalogs/connectors.json +175 -39
- package/dist/catalogs/skills.json +2 -2
- package/dist/component.json +1 -1
- package/dist/connectors/gchat.ts +31 -1
- package/dist/connectors/google_gmail.ts +70 -41
- package/dist/connectors/google_gmail_references.ts +406 -0
- package/dist/connectors/linkedin-inbox-adapter.js +107 -36
- package/dist/connectors/linkedin-inbox.ts +13 -0
- package/dist/connectors/linkedin.ts +1 -1
- package/dist/connectors/postgres.ts +14 -8
- package/dist/connectors/reddit.ts +171 -5
- package/dist/connectors/whatsapp-web-adapter.js +147 -61
- package/dist/connectors/whatsapp-web-helpers.ts +6 -2
- package/dist/connectors/whatsapp_web.ts +48 -17
- package/dist/connectors/x-dm-adapter.js +252 -35
- package/dist/connectors/x.ts +189 -13
- package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +3 -1
- package/dist/db/migrations/20261024050000_events_source_reference_arrival.sql +27 -0
- package/dist/db/migrations/20261026000000_turn_write_receipts.sql +36 -0
- package/dist/db/migrations/20261026190000_federated_relationship_endpoints.sql +143 -0
- package/dist/dependencies.bun.lock +137 -202
- package/dist/embeddings-server.mjs +81 -11
- package/dist/guest.bundle.js +62 -25
- package/dist/owletto/dist/assets/_-XKF0m81R.js +3 -0
- package/dist/owletto/dist/assets/_-e8MbEBtw.js +2 -0
- package/dist/owletto/dist/assets/_agentId-Cv9goIFf.js +2 -0
- package/dist/owletto/dist/assets/_agentId-emObu67X.js +2 -0
- package/dist/owletto/dist/assets/_automationId-CfFFAYK1.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-D6NKXSOE.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-DFrkLLTU.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-D3vuAQPe.js +2 -0
- package/dist/owletto/dist/assets/_eventId-BV5SQaUA.js +2 -0
- package/dist/owletto/dist/assets/_name-DjtJMop4.js +2 -0
- package/dist/owletto/dist/assets/_owner-oBX68rb9.js +3 -0
- package/dist/owletto/dist/assets/_shape-C4lLPAwI.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-Cw-7q6hI.js +2 -0
- package/dist/owletto/dist/assets/_slug-B2g5qzn3.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CIKGCtdK.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-Dx4kJo7o.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-38lHBvjO.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-voRYSM3a.js +2 -0
- package/dist/owletto/dist/assets/agent-card-controls-DiU7Un5w.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-BlXB4SE5.js → agent-client-setup-list-Bkyw22GW.js} +4 -4
- package/dist/owletto/dist/assets/agent-connect-pages-CpBxQCpx.js +2 -0
- package/dist/owletto/dist/assets/{agent-editor-form-DsSoeQeF.js → agent-editor-form-QrIDroFL.js} +2 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-CyoGSxcZ.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-B7v6Cffw.js → agent-loading-shells-CamDtzHY.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-CgsQ8BK_.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DFucg4c4.js → agent-skill-context-lWbXKEm1.js} +2 -2
- package/dist/owletto/dist/assets/agent-skills-route-D-w3tY_2.js +2 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-CLqpn5Tb.js +2 -0
- package/dist/owletto/dist/assets/{agent-thread-D38STyeu.js → agent-thread-CsRexwTv.js} +4 -4
- package/dist/owletto/dist/assets/agents-DzH_FFKU.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-CmGrMvPC.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +121 -0
- package/dist/owletto/dist/assets/app._appId-BO7G38fL.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-DMYxs6F6.js +2 -0
- package/dist/owletto/dist/assets/automations-DzH_FFKU.js +2 -0
- package/dist/owletto/dist/assets/calendar-DDCCSPW6.js +2 -0
- package/dist/owletto/dist/assets/callback-DFciMR8u.js +2 -0
- package/dist/owletto/dist/assets/{card-jzhQrMDP.js → card-BCsbrdGs.js} +2 -2
- package/dist/owletto/dist/assets/{claim-B-wq745Q.js → claim-BRua2b_7.js} +2 -2
- package/dist/owletto/dist/assets/client-activity-scopes-BLIy1Zc3.js +2 -0
- package/dist/owletto/dist/assets/client-rows-DiJQ5D1z.js +2 -0
- package/dist/owletto/dist/assets/clients-8-EpRjsm.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-CEqoCky-.js → code-editor-BFZa4EIt.js} +3 -3
- package/dist/owletto/dist/assets/connect-C0cHE9Xl.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-D2K4tmvW.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-D4EG5a0v.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-DhoCT6sT.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-Dn4qw2Us.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-BTI5JXA3.js +2 -0
- package/dist/owletto/dist/assets/connection-X9VU9Ijm.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-B6ydKasK.js +2 -0
- package/dist/owletto/dist/assets/connections-browser-BMV8bf54.js +2 -0
- package/dist/owletto/dist/assets/connector-boxes-DqZA-FdG.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-D-ECOlMJ.js → connector-provenance-BIg8P8WY.js} +2 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CJYz53YF.js +2 -0
- package/dist/owletto/dist/assets/{connectors-CH4KBZyT.js → connectors-BroKpwhB.js} +2 -2
- package/dist/owletto/dist/assets/{consent-C9ZpHb7V.js → consent-fzLN-Qy7.js} +2 -2
- package/dist/owletto/dist/assets/copy-button-Df7QXE0w.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-BupT3V0i.js → core.esm-A1UnFbGs.js} +2 -2
- package/dist/owletto/dist/assets/create-BjwsYarn.js +2 -0
- package/dist/owletto/dist/assets/create-Dzr4mlr0.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-DHW6OUoS.js +3 -0
- package/dist/owletto/dist/assets/create-c94SPL21.js +2 -0
- package/dist/owletto/dist/assets/create._connectorKey-DLLn2nej.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-CWImw-kf.js → cronstrue-xxpD1P2-.js} +2 -2
- package/dist/owletto/dist/assets/{device-D-7WBe9E.js → device-C3AEoL5c.js} +2 -2
- package/dist/owletto/dist/assets/{device-pin-tombstone-2U0UMu3_.js → device-pin-tombstone-B_te59GE.js} +2 -2
- package/dist/owletto/dist/assets/device._deviceId-ZU09qrot.js +2 -0
- package/dist/owletto/dist/assets/elk-worker.min-BENGc9gn.js +23 -0
- package/dist/owletto/dist/assets/{entity-avatar-mdh7Kq5D.js → entity-avatar-CEV4ttUQ.js} +2 -2
- package/dist/owletto/dist/assets/entity-options-DJv2EhVV.js +2 -0
- package/dist/owletto/dist/assets/entity-page-BUghWZ1s.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-Lf6ONdpf.js +2 -0
- package/dist/owletto/dist/assets/event-card-CBlsG32u.js +2 -0
- package/dist/owletto/dist/assets/event-detail-BKSGEOdW.js +2 -0
- package/dist/owletto/dist/assets/events-feed-VfU4csn2.js +2 -0
- package/dist/owletto/dist/assets/feed-event-kinds-BYuZCoU4.js +2 -0
- package/dist/owletto/dist/assets/filter-bar-COU0sBFQ.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-BVbcpW3R.js → full-page-spinner-C1Q_jEzD.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-6ZJv1uzM.js +2 -0
- package/dist/owletto/dist/assets/identity-BaFLmbSo.js +2 -0
- package/dist/owletto/dist/assets/index-008wj-Pz.js +7950 -0
- package/dist/owletto/dist/assets/index-BaetvYLa.js +2 -0
- package/dist/owletto/dist/assets/index-BiEf5xOE.css +1 -0
- package/dist/owletto/dist/assets/{index-CxF2XXzl.js → index-BrDP4PCs.js} +2 -2
- package/dist/owletto/dist/assets/index-BuXIeK7D.js +2 -0
- package/dist/owletto/dist/assets/index-CAVcR9za.js +2 -0
- package/dist/owletto/dist/assets/index-CMLfWGPU.js +2 -0
- package/dist/owletto/dist/assets/index-D0YEYP7N.js +2 -0
- package/dist/owletto/dist/assets/index-DFyBbp7b.js +2 -0
- package/dist/owletto/dist/assets/{index-D7gHOpfg.js → index-DNtYqkiA.js} +2 -2
- package/dist/owletto/dist/assets/index-DQxzeM37.js +2 -0
- package/dist/owletto/dist/assets/index-DkO0nPex.js +2 -0
- package/dist/owletto/dist/assets/index-KlRId0g6.js +2 -0
- package/dist/owletto/dist/assets/index-Ywnqi4A6.js +2 -0
- package/dist/owletto/dist/assets/index-wHFQv1aT.js +12 -0
- package/dist/owletto/dist/assets/index-xnxhf3Op.js +2 -0
- package/dist/owletto/dist/assets/{index-BTlx9K_t.js → index-yIub2xUM.js} +2 -2
- package/dist/owletto/dist/assets/json-diff-LE_vNZrM.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-CepswBka.js → list-skeleton-Kzxi2OXB.js} +2 -2
- package/dist/owletto/dist/assets/login-DWOT6jtS.js +2 -0
- package/dist/owletto/dist/assets/logout-Dt_VDilG.js +2 -0
- package/dist/owletto/dist/assets/{member-scope-gate-DD4YBFn-.js → member-scope-gate-De75CR7W.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-p2vIbfkC.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-CDrAjH31.js → model-selector-3l9lY50C.js} +2 -2
- package/dist/owletto/dist/assets/model-udnQ_S43.js +2 -0
- package/dist/owletto/dist/assets/models-CQj7GIOp.js +2 -0
- package/dist/owletto/dist/assets/new-BOwIHkre.js +2 -0
- package/dist/owletto/dist/assets/{new-ktz9Cs_P.js → new-BbdwuJPm.js} +2 -2
- package/dist/owletto/dist/assets/new-DTuFCQhV.js +2 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-lZNZ9gul.js → oauth-workspace-access-QPo4YwRX.js} +2 -2
- package/dist/owletto/dist/assets/organization-BDzjnqPf.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-D7yt0PrA.js +2 -0
- package/dist/owletto/dist/assets/permissions-CfoY4WFY.js +2 -0
- package/dist/owletto/dist/assets/proposal-review-shell-CVkLnnKo.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-DXUTTGGp.js +2 -0
- package/dist/owletto/dist/assets/record-activity-BXhvJbd9.js +2 -0
- package/dist/owletto/dist/assets/{record-session-Pbr5czGw.js → record-session-D07szzqN.js} +2 -2
- package/dist/owletto/dist/assets/renderer-AJxSmE3-.js +97 -0
- package/dist/owletto/dist/assets/reset-password-kRYyQuTY.js +2 -0
- package/dist/owletto/dist/assets/runs-lG2ChtOt.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-LnGpHCAQ.js +2 -0
- package/dist/owletto/dist/assets/schema-type-editor-panel-C_Es0qDf.js +2 -0
- package/dist/owletto/dist/assets/settings-CEAOg7fr.js +2 -0
- package/dist/owletto/dist/assets/settings-gGYXbFfd.js +2 -0
- package/dist/owletto/dist/assets/skills-BOL5c_Tk.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CjFPgKKJ.js +2 -0
- package/dist/owletto/dist/assets/status-dot-CSBtKT4g.js +2 -0
- package/dist/owletto/dist/assets/table-DHM-vCxP.js +2 -0
- package/dist/owletto/dist/assets/use-automations-C4TSie1i.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-Dcunv4L0.js → use-mention-search-PfZrNbu_.js} +4 -4
- package/dist/owletto/dist/assets/use-scroll-sentinel-D-fJx_Md.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-DkX4YdDT.js +2 -0
- package/dist/owletto/dist/assets/views-access-required-2ubIf_3N.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +137007 -132255
- package/npm-shrinkwrap.json +723 -1095
- package/package.json +7 -10
- package/vendor/@better-auth-kysely-adapter/LICENSE.md +20 -0
- package/vendor/@better-auth-kysely-adapter/README.md +17 -0
- package/vendor/@better-auth-kysely-adapter/dist/bun-sqlite-dialect-DoOVo4ja.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/d1-sqlite-dialect-Cru74LbR.mjs +133 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.d.mts +116 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.mjs +719 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.d.mts +27 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/sqlite-introspector-DSCAP82F.mjs +90 -0
- package/vendor/@better-auth-kysely-adapter/package.json +52 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +34 -1
- package/vendor/connector-sdk/dist/index.d.ts +3 -1
- package/vendor/connector-sdk/dist/index.js +4 -0
- package/vendor/connector-sdk/dist/redact.d.ts +10 -0
- package/vendor/connector-sdk/dist/redact.js +130 -0
- package/vendor/connector-sdk/dist/types.d.ts +2 -1
- package/vendor/connector-sdk/package.json +6 -1
- package/vendor/core/dist/agent-tooling.d.ts +8 -0
- package/vendor/core/dist/agent-tooling.js +9 -1
- package/vendor/core/dist/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +5 -0
- package/vendor/core/dist/connector-query-errors.d.ts +6 -0
- package/vendor/core/dist/connector-query-errors.js +4 -0
- package/vendor/core/dist/contracts/entity-reference.d.ts +3 -0
- package/vendor/core/dist/contracts/entity-reference.js +31 -0
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +3 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +4 -1
- package/vendor/core/dist/contracts/tools/manage-connections.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +117 -34
- package/vendor/core/dist/contracts/tools/manage-entity.js +47 -14
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +13 -4
- package/vendor/core/dist/contracts/tools/manage-operations.js +19 -7
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +6 -1
- package/vendor/core/dist/contracts/tools/read-knowledge.js +20 -1
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/view-runtime.js +3 -1
- package/vendor/core/dist/contracts/worker/device-automation.d.ts +4 -9
- package/vendor/core/dist/contracts/worker/device-automation.js +10 -15
- package/vendor/core/dist/contracts/worker/protocol.d.ts +20 -0
- package/vendor/core/dist/contracts/worker/protocol.js +20 -0
- package/vendor/core/dist/errors.d.ts +0 -20
- package/vendor/core/dist/errors.js +1 -25
- package/vendor/core/dist/otel.js +38 -10
- package/vendor/core/dist/reserved.d.ts +6 -3
- package/vendor/core/dist/reserved.js +6 -3
- package/vendor/core/dist/utils/ajv.js +3 -1
- package/vendor/core/dist/worker/auth.d.ts +3 -2
- package/vendor/core/package.json +31 -5
- package/vendor/postgres/.bun-tag-22d644c2873790db +0 -0
- package/vendor/postgres/cf/src/query.js +3 -1
- package/vendor/postgres/cjs/src/query.js +3 -1
- package/vendor/postgres/src/query.js +3 -1
- package/vendor/views/dist/api.js +31 -7
- package/vendor/views/dist/bridge.d.ts +2 -1
- package/vendor/views/dist/bridge.js +10 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-BorucF19.js +0 -3
- package/dist/owletto/dist/assets/_-CkGyNi0G.js +0 -2
- package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +0 -2
- package/dist/owletto/dist/assets/_agentId-DgRrCE2B.js +0 -2
- package/dist/owletto/dist/assets/_automationId-DSrZIYcs.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DWxv1uoi.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-BTP5ijdT.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-98Y3RuRO.js +0 -2
- package/dist/owletto/dist/assets/_deploymentId-B1UWPY0i.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BAnr8g8z.js +0 -2
- package/dist/owletto/dist/assets/_name-BUfFO_A0.js +0 -2
- package/dist/owletto/dist/assets/_owner-C79BwQ0I.js +0 -3
- package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +0 -2
- package/dist/owletto/dist/assets/_slug-DbPdDc-5.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-UXU5Fx2G.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-D7ORHntE.js +0 -2
- package/dist/owletto/dist/assets/agent-card-controls-CplnPhbv.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-BmknviTI.js +0 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-TdvvIc_J.js +0 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-BkZu1LYE.js +0 -2
- package/dist/owletto/dist/assets/agent-skills-route-B3vvvZZe.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-CZJvnjNC.js +0 -2
- package/dist/owletto/dist/assets/agents-DAOln24A.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-DJ67GZ93.js +0 -2
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +0 -128
- package/dist/owletto/dist/assets/app._appId-Cp78oEZ9.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-DSwbRpbx.js +0 -2
- package/dist/owletto/dist/assets/automations-DAOln24A.js +0 -2
- package/dist/owletto/dist/assets/callback-CBexCo3F.js +0 -2
- package/dist/owletto/dist/assets/client-rows-BYbsXGy9.js +0 -2
- package/dist/owletto/dist/assets/clients-BhNl1tVq.js +0 -2
- package/dist/owletto/dist/assets/connect-wx-qqLir.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-BqprYeOX.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-DhRoSzBr.js +0 -2
- package/dist/owletto/dist/assets/connection-CNm2ukrI.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-WcGCA6qY.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-CrtnAs0Q.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CRFEpSvk.js +0 -2
- package/dist/owletto/dist/assets/conversations-table-D_HOe1jN.js +0 -2
- package/dist/owletto/dist/assets/create-C4lptGWj.js +0 -2
- package/dist/owletto/dist/assets/create-CCjZxIkK.js +0 -2
- package/dist/owletto/dist/assets/create-DkgUQAbB.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-Bpy92SM5.js +0 -3
- package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +0 -2
- package/dist/owletto/dist/assets/deployments-C5hvipQh.js +0 -2
- package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +0 -2
- package/dist/owletto/dist/assets/deployments-body-DGII20dQ.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-Bn37UpWH.js +0 -2
- package/dist/owletto/dist/assets/entity-options-Clz_WXK-.js +0 -2
- package/dist/owletto/dist/assets/entity-page-D3e4iPle.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-DebN1vCM.js +0 -2
- package/dist/owletto/dist/assets/event-detail-DV_zfWnC.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Bwhqj7lY.js +0 -2
- package/dist/owletto/dist/assets/guardrails-BiJollCA.js +0 -2
- package/dist/owletto/dist/assets/identity-HCFWtdaI.js +0 -2
- package/dist/owletto/dist/assets/index-8wxsyxqt.js +0 -2
- package/dist/owletto/dist/assets/index-9YuSRymd.js +0 -7950
- package/dist/owletto/dist/assets/index-B3c-0eZG.js +0 -2
- package/dist/owletto/dist/assets/index-B64PGxQm.js +0 -2
- package/dist/owletto/dist/assets/index-BSH07yVD.css +0 -1
- package/dist/owletto/dist/assets/index-BX0EA_oB.js +0 -2
- package/dist/owletto/dist/assets/index-CDz3-ieP.js +0 -12
- package/dist/owletto/dist/assets/index-CdJJaQDX.js +0 -2
- package/dist/owletto/dist/assets/index-CfT_W8Vo.js +0 -2
- package/dist/owletto/dist/assets/index-D3WHeGql.js +0 -2
- package/dist/owletto/dist/assets/index-DB1iWI_a.js +0 -2
- package/dist/owletto/dist/assets/index-DMNzF8Lf.js +0 -2
- package/dist/owletto/dist/assets/index-DyB3IzOA.js +0 -2
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +0 -2
- package/dist/owletto/dist/assets/index-fgAJydgX.js +0 -2
- package/dist/owletto/dist/assets/json-diff-DIN5Jhfx.js +0 -4
- package/dist/owletto/dist/assets/login-DxGYyE4n.js +0 -2
- package/dist/owletto/dist/assets/logout-Bkzc7J44.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-BnuhLJ6X.css +0 -1
- package/dist/owletto/dist/assets/memory-browse-page-D_UlBa27.js +0 -103
- package/dist/owletto/dist/assets/models-BAVeysNq.js +0 -2
- package/dist/owletto/dist/assets/new-C2av0diq.js +0 -2
- package/dist/owletto/dist/assets/new-snm1ctHn.js +0 -2
- package/dist/owletto/dist/assets/organization-Cb0W823y.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-BNR9ImQY.js +0 -2
- package/dist/owletto/dist/assets/permissions-Dv39zWKt.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-CFhOqCLf.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +0 -2
- package/dist/owletto/dist/assets/recent-QhnLDU1_.js +0 -2
- package/dist/owletto/dist/assets/record-activity-ZJntBfN_.js +0 -2
- package/dist/owletto/dist/assets/record-field-peek-Brh1IQGy.js +0 -2
- package/dist/owletto/dist/assets/reset-password-CzZw6RcC.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-C0_DNTcq.js +0 -2
- package/dist/owletto/dist/assets/runs-table-B1APZv7d.js +0 -2
- package/dist/owletto/dist/assets/schema-value-normalization-CKdPjdPC.js +0 -97
- package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +0 -2
- package/dist/owletto/dist/assets/settings-VDNiffKU.js +0 -2
- package/dist/owletto/dist/assets/skills-DgDGscm5.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-BdfOVPWn.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-B0quibBi.js +0 -2
- /package/vendor/{postgres/.bun-tag-2f292c6554a8475e → @better-auth-kysely-adapter/.bun-tag-abf95749a412716} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=new-
|
|
1
|
+
import{v as z,o as F,G as L,r,j as e,H as w,I as S,B as U,J as N,K as E}from"./index-008wj-Pz.js";import{C as I,a as A,b as T,c as k}from"./card-BCsbrdGs.js";import{F as B}from"./full-page-spinner-C1Q_jEzD.js";function c(l){return l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function q(){const l=z(),{session:u,isReady:d}=F(),{slug:n,name:i}=L.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=E(a);if(s.kind==="cross-host"){window.location.assign(s.href);return}l({to:s.to})},R=async a=>{a.preventDefault(),o(null);const s=m.trim(),v=(g.trim()||c(s)).trim();if(!s){o("Name is required");return}if(!v){o("Slug is required");return}p(!0);try{const t=await N.create({name:s,slug:v});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:R,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(w,{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(w,{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(U,{type:"submit",disabled:f,children:f?"Creating…":"Create organization"})})]})})]})})}export{q as component};
|
|
2
|
+
//# sourceMappingURL=new-BbdwuJPm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{hg as o,v as p,a2 as x,o as h,ap as b,b8 as f,j as a,aG as w,gr as A,b0 as L,gs as j,L as C,gt as S,fn as N,a$ as k,bY as y}from"./index-008wj-Pz.js";import{A as E}from"./agent-editor-form-QrIDroFL.js";import"./model-selector-3l9lY50C.js";const v="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-2.5 pb-8 lg:px-6";function _(){const{owner:e}=o.useParams(),t=o.useSearch(),r=p(),i=x(),{isAuthenticated:c}=h(),{isMember:g,isLoading:m}=b(),n=c&&g,{data:u=[],isLoading:d}=f({enabled:n});return a.jsx("div",{className:v,children:a.jsxs(w,{className:"flex flex-1 flex-col gap-6",children:[a.jsx(A,{breadcrumb:a.jsx(j,{crumbs:[a.jsx(C,{to:"/$owner/agents",params:{owner:e},className:S,children:"Agents"},"agents")]}),icon:a.jsx(L.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&&d?a.jsx(N,{rows:1}):n?a.jsx(E,{mode:{kind:"create"},existingAgentIds:u.map(s=>s.agentId),onCreated:async s=>{const l=["agents",e];if(await i.refetchQueries({queryKey:l,exact:!0}),t.platform&&t.listen){await r({to:"/$owner/automations/new",params:{owner:e},search:{...t,agent:s}});return}await r({to:"/$owner/agents/$agentId/settings",params:{owner:e,agentId:s},search:{run_id:void 0}})}}):a.jsx(k,{icon:y,title:"Workspace membership required",description:"Only workspace members can build managed agents."})]})})}export{_ as component};
|
|
2
|
+
//# sourceMappingURL=new-DTuFCQhV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,P as y,Q as $,T as E,B as R,r as u,U as z}from"./index-9YuSRymd.js";const W=["mcp:read","mcp:write","mcp:admin"],P=[{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:P.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}=z(),[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)),U=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:U,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-
|
|
1
|
+
import{j as e,V as y,h as W,W as $,B as R,r as u,Y as U}from"./index-008wj-Pz.js";const E=["mcp:read","mcp:write","mcp:admin"],F=[{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=>!E.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=>!E.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:F.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:W("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($,{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 V({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:W("flex items-start gap-3 rounded-md border p-3 transition-colors",h&&"border-primary/40 bg-primary/5"),children:[e.jsx($,{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 P(s,a){return s.length===a.length&&s.every((r,i)=>r===a[i])}function T(s={}){const{requireDeviceHome:a=!1,deviceHomeOrgId:r=null,allowMultiple:i=!0}=s,{data:x,error:v,isPending:g,refetch:b}=U(),[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,P(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,V as W,I as a,q as b,K as g,D as s,T as u};
|
|
2
|
+
//# sourceMappingURL=oauth-workspace-access-QPo4YwRX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a2 as ge,r as j,bA as Ie,bB as Be,bC as Ke,bD as Me,bE as be,j as e,bF as Y,B as C,bG as He,a$ as Ve,bH as Ge,bI as Ue,bJ as Ye,bK as Je,bL as Ze,bM as Xe,bN as es,bO as ve,bP as ie,bQ as ss,bR as ts,bS as ns,bT as me,bU as is,bV as as,v as os,Y as Le,t as rs,bW as cs,bX as ne,q as ls,H as je,I as Ne,bY as ds,bZ as us,b_ as ms,a5 as Ce,b9 as hs,S as z,J as le,b$ as ps,c0 as _e,c1 as ke,c2 as gs,K as xs,c3 as Se,w as fs,c4 as ys,c5 as bs}from"./index-008wj-Pz.js";import{P as he,a as De,A as vs}from"./agent-permissions-matrix-CgsQ8BK_.js";import{C as we,a as Ae,b as Oe,c as ze}from"./card-BCsbrdGs.js";const Pe=["auto","approval","deny"],js={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."},We={read:"Reads",write:"Writes",destructive:"Destructive writes",non_destructive:"Non-destructive writes",unknown:"Unclassified writes"};function pe(s){return{operation_key:s.operation_key??null,connector_key:s.connector_key??null,connection_id:s.connection_id??null,operation_category:s.operation_category??null}}const de=s=>JSON.stringify(pe(s)),$e=s=>({...s,effect:s.effects.execute??"approval"});function F({label:s,value:n,onChange:o,children:r,disabled:h}){return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:s}),e.jsx("select",{"aria-label":s,value:n,onChange:c=>o(c.target.value),disabled:h,className:"h-9 w-full rounded-lg border bg-background px-2 text-foreground",children:r})]})}function Ns(s,n){const o=n.connections?.find(r=>r.id===s.connection_id);return s.connection_id?`Connection: ${o?.display_name||o?.connector_key||"Unavailable"} (#${s.connection_id})`:s.connector_key?`Connector: ${n.connectors?.find(r=>r.key===s.connector_key)?.name||s.connector_key}`:"All connectors"}function Cs(s,n){return s.operation_key?n.connector_operations.find(o=>o.operation_key===s.operation_key)?.name||s.operation_key:s.operation_category?We[s.operation_category]:"All actions"}function ue(s,n){return`${Ns(s,n)} · ${Cs(s,n)}`}function Ee(s){return s.connection_id?`connection:${s.connection_id}`:s.connector_key?`connector:${s.connector_key}`:"all"}function Te({catalog:s}){return e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"all",children:"All connectors"}),e.jsx("optgroup",{label:"Connectors",children:s.connectors?.map(n=>e.jsx("option",{value:`connector:${n.key}`,children:n.name},n.key))}),e.jsx("optgroup",{label:"Connections",children:s.connections?.map(n=>e.jsxs("option",{value:`connection:${n.id}`,children:[n.display_name||n.connector_key," (#",n.id,")"]},n.id))})]})}function _s({label:s,ariaLabel:n,disabled:o,onRemove:r}){const[h,c]=j.useState(!1);return h?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(C,{type:"button",variant:"destructive",size:"sm",disabled:o,"aria-label":"Confirm removal",onClick:async()=>{await r()&&c(!1)},children:"Confirm"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>c(!1),children:"Cancel"})]}):e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:o,"aria-label":n,onClick:()=>c(!0),children:s})}function ks({owner:s,connector:n,connection:o,agent:r}){const h=ge(),[c,b]=j.useState(r??""),y=Ie(s),l=y.data,u=l?.agents.some(t=>t.id===c)?c:"",m=Be(s,u),i=Ke(s,!u),[P,_]=j.useState(o?`connection:${o}`:n?`connector:${n}`:"all"),[M,J]=j.useState(P),[I,L]=j.useState(!1),[k,D]=j.useState(""),[A,H]=j.useState("all"),[Z,E]=j.useState("approval"),[g,S]=j.useState(!1),[W,T]=j.useState(null),[V,X]=j.useState(o?String(o):""),[G,q]=j.useState(""),R=l?.connections?.some(t=>String(t.id)===V)?V:"",w=Me(s,R?Number(R):void 0,G,u||void 0);async function U(t,f){S(!0),T(null);try{if(u){const d={resource_class:"connector_action",...pe(t)};f?await Ye(s,u,{...d,effects:{execute:f}}):await Je(s,u,d)||T("This rule was already removed. The list has been refreshed.")}else{const d=i.data;if(!d)return;const K=d.rules.filter(Qe=>de(Qe)!==de(t));f&&K.push({...pe(t),effect:f});const ce=await Ze(s,{revision:d.revision,rules:K});h.setQueryData(Xe(s),ce)}return await Promise.all(["write-permissions","agent-permissions","available-operations","connector-operations","policy-explanation"].map(d=>h.invalidateQueries({queryKey:[d]}))),t}catch(d){d instanceof be&&d.status===409?(T("Policies changed in another session. Review the refreshed rules before saving again."),await i.refetch()):T(d instanceof Error?d.message:"Could not save policy.")}finally{S(!1)}}const Q=y.error||(u?m.error:i.error);if(Q instanceof be&&Q.status===403)return e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Only organization owners and admins can manage policies."});if(Q)return e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not load policies. ",String(Q)]});if(!l||(u?!m.data:!i.data))return e.jsx(Y,{label:"policies",rows:2});const v=t=>t==="all"||l.connectors?.some(f=>`connector:${f.key}`===t)||l.connections?.some(f=>`connection:${f.id}`===t)?t:"all",a=v(P),p=v(M),N=l.connections?.find(t=>`connection:${t.id}`===p),$=N?.connector_key??(p.startsWith("connector:")?p.slice(10):void 0),x=t=>p==="all"||Ee(t)==="all"?!0:t.connection_id?N?t.connection_id===N.id:l.connections?.some(f=>f.id===t.connection_id&&f.connector_key===$):t.connector_key===$;function B(t){return u?t.principal_kind==="agent"&&t.principal_id===u:!t.principal_kind}const ee=a.startsWith("connector:")?a.slice(10):a.startsWith("connection:")?l.connections?.find(t=>t.id===Number(a.slice(11)))?.connector_key:void 0,O=l.connector_operations.filter(t=>!ee||t.connector_key===ee),se=l.connections?.find(t=>t.id===Number(R))?.connector_key,ae=l.connector_operations.filter(t=>t.connector_key===se),oe=u?(m.data?.agent??[]).filter(t=>t.resource_class==="connector_action").map($e):i.data?.rules??[],te=(m.data?.floor??[]).filter(t=>t.resource_class==="connector_action"&&x(t)).map($e),qe={connector_key:a.startsWith("connector:")?a.slice(10):a==="all"&&A==="specific"?O.find(t=>t.operation_key===k)?.connector_key??null:null,connection_id:a.startsWith("connection:")?Number(a.slice(11)):null,operation_key:A==="specific"?k:null,operation_category:A.startsWith("category:")?A.slice(9):null},re=oe.filter(x);function fe(){_(p),H("all"),D(""),E("approval"),L(!0)}const ye=(t,f=!1)=>e.jsx("div",{className:"divide-y rounded-lg border",children:t.map(d=>{const K=!f&&B(d);return e.jsxs(De,{controls:e.jsxs(e.Fragment,{children:[e.jsx(he,{options:Pe,value:d.effect,floor:"auto",compact:!0,disabled:g||!K,ariaLabel:`Policy for ${ue(d,l)}`,onChange:ce=>void U(d,ce)}),K&&e.jsx(_s,{label:"Remove",disabled:g,ariaLabel:`Remove rule: ${ue(d,l)}`,onRemove:()=>U(d)})]}),children:[e.jsx("p",{className:"text-sm break-words",children:ue(d,l)}),!K&&e.jsx("p",{className:"text-xs text-muted-foreground",children:d.principal_kind==="agent"&&!d.principal_id?"All agents":"Inherited restriction"})]},JSON.stringify([d.principal_kind,d.principal_id,de(d)]))})});return e.jsxs("div",{className:"space-y-4",children:[(p!==M||u!==c)&&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:b,disabled:g,children:[e.jsx("option",{value:"",children:"Organization"}),l.agents.map(t=>e.jsxs("option",{value:t.id,children:["Agent: ",t.name]},t.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:p,onChange:J,disabled:g,children:e.jsx(Te,{catalog:l})}),u&&te.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Inherited organization rules"}),ye(te,!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&&re.length>0&&e.jsx(C,{variant:"outline",size:"sm",disabled:g,onClick:fe,children:"Add rule"})]}),I&&e.jsxs("form",{className:"space-y-3 border-t pt-4",onSubmit:t=>{t.preventDefault(),!g&&(A!=="specific"||k)&&U(qe,Z).then(f=>{f&&(L(!1),J(Ee(f)))})},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:a,onChange:t=>{_(t),H("all"),D("")},disabled:g,children:e.jsx(Te,{catalog:l})}),e.jsxs(F,{label:"Actions",value:A,onChange:H,disabled:g,children:[e.jsx("option",{value:"all",children:"All actions"}),e.jsx("optgroup",{label:"Categories",children:l.operation_categories?.map(t=>e.jsx("option",{value:`category:${t}`,children:We[t]},t))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),A==="specific"&&e.jsxs(F,{label:"Specific action",value:k,onChange:D,disabled:g,children:[e.jsx("option",{value:"",children:"Choose action"}),O.map(t=>e.jsxs("option",{value:t.operation_key,children:[t.connector_name,": ",t.name]},t.operation_key))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(he,{options:Pe,value:Z,floor:"auto",compact:!0,disabled:g,ariaLabel:"New rule decision",onChange:E}),e.jsx(He,{onCancel:()=>L(!1),cancelDisabled:g,children:e.jsx(C,{type:"submit",disabled:g||A==="specific"&&!k,children:g?"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."})]}),re.length?ye(re):!I&&e.jsx(Ve,{icon:Ge,title:"No saved rules in this scope",description:"Add a rule for all actions, a category, or a specific action.",actionLabel:"Add rule",onAction:fe})]}),W&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:W}),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:R,onChange:t=>{X(t),q("")},children:[e.jsx("option",{value:"",children:"Choose connection"}),l.connections?.map(t=>e.jsxs("option",{value:String(t.id),children:[t.display_name||t.connector_key," (#",t.id,")"]},t.id))]}),e.jsxs(F,{label:"Check action",value:G,onChange:q,disabled:!R,children:[e.jsx("option",{value:"",children:"Choose action"}),ae.map(t=>e.jsx("option",{value:t.operation_key.slice(t.connector_key.length+2),children:t.name},t.operation_key))]})]}),w.error?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not check policy. ",String(w.error)]}):e.jsx("p",{"aria-live":"polite",className:"text-sm",children:G?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ue[w.data.effect]})," ·"," ",js[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(t=>`#${t}`).join(", ")}`:""]}):"":""})]})]})}const Ss=[{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."}],ws=[{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 xe(s){return s.resource_class==="entity_schema"&&s.principal_kind===null&&s.entity_type_slug===null&&s.operation_key===null&&s.target_agent_id===null}function As(s){return s.agent.find(xe)}function Os(s,n){return{...s,agent:[...s.agent.filter(o=>!xe(o)),n]}}function zs(s){return{...s,agent:s.agent.filter(n=>!xe(n))}}function Ps({label:s,description:n,action:o,value:r,pending:h,onChange:c}){return e.jsxs(De,{controls:e.jsx(he,{options:as("entity_schema",o),value:r,floor:"auto",disabled:h,compact:!0,ariaLabel:s,onChange:c}),children:[e.jsx("p",{children:s}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:n})]})}function Re({title:s,actions:n,effects:o,pending:r,onChange:h}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:s}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:n.map(({action:c,label:b,description:y})=>e.jsx(Ps,{action:c,label:b,description:y,value:o[c]??me.entity_schema[c]??"deny",pending:r,onChange:l=>h(c,l)},c))})]})}function $s({owner:s}){const n=ge(),o=es(s),r=Ie(s),h=ve({mutationFn:m=>ss(s,{resource_class:"entity_schema",effects:m}),onSuccess:m=>{n.setQueryData(o,i=>i&&Os(i,m)),n.invalidateQueries({queryKey:o})},onError:m=>{ie.error(m instanceof Error?m.message:"Failed to save schema policy")}}),c=ve({mutationFn:()=>ts(s,{resource_class:"entity_schema"}),onSuccess:()=>{n.setQueryData(o,m=>m&&zs(m)),n.invalidateQueries({queryKey:o})},onError:m=>{ie.error(m instanceof Error?m.message:"Failed to reset schema policy")}});if(r.isLoading)return e.jsx(Y,{label:"schema policy",variant:"cards",cards:1});if(r.isError||!r.data)return e.jsx(ns,{label:"schema policy"});const b=As(r.data),y=b?.effects??me.entity_schema,l=h.isPending||c.isPending,u=(m,i)=>{h.mutate({...b?.effects??me.entity_schema,[m]:i})};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:b?"Custom policy":"Workspace defaults"}),b?e.jsxs(C,{type:"button",variant:"outline",size:"sm",disabled:l,onClick:()=>c.mutate(),children:[e.jsx(is,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove custom policy"]}):null]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Re,{title:"Entity types",actions:Ss,effects:y,pending:l,onChange:u}),e.jsx(Re,{title:"Relationship types",actions:ws,effects:y,pending:l,onChange:u})]})]})}function Fe(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Es(s,n,o){const r=s.split("/");return r[1]===n?(r[1]=o,r.join("/")||"/"):`/${o}`}function Ts({section:s}){return s==="policies"?e.jsx(Y,{label:"policies",rows:2}):s==="governance"?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Agent write defaults"}),e.jsx(Y,{label:"agent write defaults",variant:"table",rows:3})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Schema governance"}),e.jsx(Y,{label:"schema governance",rows:3})]})]}):e.jsxs("div",{role:"status","aria-label":"Loading general settings","aria-busy":"true",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",{"aria-hidden":"true",className:"space-y-4",children:[["name","slug"].map(n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(z,{className:"h-3.5 w-12 rounded-none"}),e.jsx("div",{className:"flex h-9 items-center border border-input bg-background px-3",children:e.jsx(z,{className:"h-4 w-32 rounded-none"})})]},n)),e.jsx(z,{className:"h-3 w-4/5 rounded-none"})]})]}),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.jsx("div",{"aria-hidden":"true",className:"grid gap-2 sm:grid-cols-2",children:["private","public"].map(n=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border p-3",children:[e.jsx(z,{className:"mt-0.5 h-4 w-4 shrink-0 rounded-none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(z,{className:"h-4 w-16 rounded-none"}),e.jsx(z,{className:"h-3 w-full rounded-none"}),e.jsx(z,{className:"h-3 w-2/3 rounded-none"})]})]},n))})]}),e.jsxs("div",{"aria-hidden":"true",className:"flex justify-end gap-2",children:[e.jsx(z,{className:"h-9 w-20 rounded-none"}),e.jsx(z,{className:"h-9 w-28 rounded-none"})]})]})}function Rs({owner:s,section:n="general",connector:o,connection:r,agent:h}){const c=os(),b=ge(),{data:y,error:l}=Le(),{activeOrg:u,urlOrgSlug:m}=rs(),i=(y??[]).find(a=>a.slug===s&&a.is_member)??null,P=i?.id??s,_=cs(P,{name:i?.name??"",slug:i?.slug??"",visibility:i?.visibility??"private"}),[M,J]=_.field("name"),[I,L]=_.field("slug"),[k,D]=_.field("visibility"),[A,H]=ne(P,!!i),[Z,E]=ne(P,!1),[g,S]=ne(P,null),[W,T]=j.useState(!1),[V,X]=j.useState(!1),[G,q]=ne(P,!1);if(ls(l)&&y===void 0)return e.jsxs(we,{role:"alert",children:[e.jsx(Ae,{children:e.jsx(Oe,{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(y===void 0)return e.jsx(Ts,{section:n});if(!i)return e.jsxs(we,{children:[e.jsx(Ae,{children:e.jsx(Oe,{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:s}),", or it has been deleted."]})})]});if(n==="policies")return e.jsx("div",{className:"space-y-6",children:e.jsxs("section",{id:"policies",className:"scroll-mt-6 space-y-4",children:[e.jsx("div",{className:"space-y-1",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control connector actions across the organization. Changes to existing rules save automatically."})}),e.jsx(ks,{owner:s,connector:o,connection:r,agent:h},`${s}:${h??""}:${o??""}:${r??""}`)]})});if(n==="governance")return e.jsxs("div",{className:"space-y-6",children:[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(vs,{owner:s,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($s,{owner:s})]})]});const R=a=>{const p=xs(a);if(p.kind==="cross-host"){window.location.assign(p.href);return}c({to:p.to})},w=a=>{if(a==="public"&&i.visibility!=="public"){E(!0);return}D(a),E(!1)},U=async()=>{if(!_.canSubmit)return;const a=M.trim();if(!a){S("Name is required");return}const p=I.trim()||Fe(a);if(!p){S("Slug is required");return}T(!0),S(null);try{const N=a!==i.name||p!==i.slug,$=k!==i.visibility;let x=i.slug;if(N){const O=await le.update({organizationId:i.id,data:{name:a,slug:p}});if(O.error){S(O.error.message||"Failed to update organization");return}x=O.data?.slug??p}$&&(x=(await ps(x,k)).slug),(N||$)&&(_.accept(_.values,{name:a,slug:x,visibility:k}),await b.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization updated"));const B=u?.id===i.id||m===i.slug,ee=x!==i.slug;if(B&&ee){const O=_e(),se=ke();if(O===i.slug&&se){const oe=gs(window.location.pathname,i.slug)||"/",te=`${window.location.protocol}//${x}.${se}${oe}${window.location.search}${window.location.hash}`;window.location.assign(te);return}const ae=Es(window.location.pathname,i.slug,x);c({to:`${ae}${window.location.search}${window.location.hash}`});return}}catch(N){S(N instanceof Error?N.message:"Failed to update organization")}finally{T(!1)}},Q=async()=>{X(!0),S(null);try{const a=await le.delete({organizationId:i.id});if(a.error){S(a.error.message||"Failed to delete organization");return}await b.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization deleted");const N=(y??[]).filter(x=>x.is_member).find(x=>x.id!==i.id)??null,$=u?.id===i.id||m===i.slug;if($&&N){await le.setActive({organizationId:N.id}),R(N.slug);return}if($){const x=_e(),B=ke();if(x===i.slug&&B){window.location.assign(`${window.location.protocol}//app.${B}/`);return}c({to:"/"});return}c({to:"/"})}catch(a){S(a instanceof Error?a.message:"Failed to delete organization")}finally{X(!1),q(!1)}},v=W||V;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(je,{htmlFor:"org-name",children:"Name"}),e.jsx(Ne,{id:"org-name",value:M,onChange:a=>{J(a.target.value),A||L(Fe(a.target.value))},placeholder:"e.g. My Team",disabled:v})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(je,{htmlFor:"org-slug",children:"Slug"}),e.jsx(Ne,{id:"org-slug",value:I,onChange:a=>{H(!0),L(a.target.value)},placeholder:"e.g. my-team",disabled:v}),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:["/",i.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:()=>w("private"),disabled:v,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${k==="private"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(ds,{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:()=>w("public"),disabled:v,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${k==="public"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(us,{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."})]})]})]}),Z&&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(C,{type:"button",size:"sm",onClick:()=>{D("public"),E(!1)},disabled:v,children:"Confirm public"}),e.jsx(C,{type:"button",size:"sm",variant:"ghost",onClick:()=>E(!1),disabled:v,children:"Cancel"})]})]})]}),g&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:g}),e.jsx(ms,{visible:_.hasConflict,onReload:_.reset}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>void c({to:`/${s}`}),disabled:v,children:"Cancel"}),e.jsxs(C,{onClick:U,disabled:v||!_.canSubmit,children:[W?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,W?"Saving...":"Save changes"]})]}),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:i.is_personal?"Personal workspace":"Delete this organization"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.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."}),!i.is_personal&&e.jsx("div",{className:"mt-3",children:G?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"destructive",size:"sm",onClick:Q,disabled:v,children:[V?e.jsx(Ce,{className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>q(!1),disabled:v,children:"Cancel"})]}):e.jsxs(C,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>q(!0),disabled:v,children:[e.jsx(hs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete organization"]})})]})]})}function Ds(){const{owner:s}=Se.useParams(),n=Se.useSearch(),{hash:o}=fs(),r=ys(n,o),h={general:"General",policies:"Policies",governance:"Governance"}[r],{data:c}=Le(),b=(c??[]).find(y=>y.slug===s&&y.is_member)?.name;return e.jsx("div",{className:"flex flex-1 flex-col px-4 pt-2.5 pb-8 lg:px-6",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-1 flex-col gap-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bs,{className:"h-7 w-7"}),e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:h})]}),b?e.jsx("p",{className:"text-base font-medium text-foreground",children:b}):null]}),e.jsx(Rs,{owner:s,...n,section:r})]})})}export{Ds as component};
|
|
2
|
+
//# sourceMappingURL=organization-BDzjnqPf.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j9 as H,ja as V,r as f,he as q,u as T,j as e,dz as U,ax as G,aD as W,S as b,is as Q,B as N,jb as Z,jc as k,jd as Y,je as L,jf as z,jg as J,d6 as X,n as A,am as D,cy as F,a5 as C,et as ee,t as te,k as se,fF as ne,w as re,L as $,jh as ie,fk as oe,fI as ae,fA as ce,ji as de,fO as E,iw as le,av as ue,jj as me,ap as pe,i as xe,jk as he,co as fe,dZ as ye,cT as ge,p as je,eo as ve,jl as Ne,bk as we,jm as be,es as ke,cU as Ae,jn as Ce,bg as Se}from"./index-008wj-Pz.js";import{u as Ie,A as Pe}from"./automation-detail-content-DMYxs6F6.js";import{A as _e}from"./agent-loading-shells-CamDtzHY.js";import{s as Le,h as Te,R as Re,A as $e}from"./agent-thread-CsRexwTv.js";import{C as Ee,b as Oe,A as ze}from"./connection-feed-detail-B6ydKasK.js";import{R as De,S as Fe,g as Me}from"./runs-panel-LnGpHCAQ.js";import{O as Be}from"./connect-menu-D2K4tmvW.js";import{a as Ke}from"./connections-browser-BMV8bf54.js";import{f as He}from"./connector-scope-lists-CJYz53YF.js";import{S as Ve}from"./source-record-panels-CjFPgKKJ.js";import{E as R}from"./events-feed-VfU4csn2.js";import{S as qe}from"./schema-type-editor-panel-C_Es0qDf.js";import{h as Ue,s as Ge,i as We}from"./renderer-AJxSmE3-.js";import{E as Qe}from"./event-detail-BKSGEOdW.js";import{V as Ze,R as Ye}from"./views-access-required-2ubIf_3N.js";import{R as Je,b as Xe}from"./event-card-CBlsG32u.js";import{V as et,a as tt}from"./view-param-filters-DkX4YdDT.js";import{b as st}from"./use-automations-C4TSie1i.js";import"./create-automation-form-DHW6OUoS.js";import"./cronstrue-xxpD1P2-.js";import"./entity-options-DJv2EhVV.js";import"./connection-label-BobuYiAG.js";import"./model-selector-3l9lY50C.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-BFZa4EIt.js";import"./index-wHFQv1aT.js";import"./use-mention-search-PfZrNbu_.js";import"./proposal-review-shell-CVkLnnKo.js";import"./runs-lG2ChtOt.js";import"./json-diff-LE_vNZrM.js";import"./app-bridge-C4nPtae3.js";import"./feed-event-kinds-BYuZCoU4.js";import"./use-scroll-sentinel-D-fJx_Md.js";import"./clients-8-EpRjsm.js";import"./filter-bar-COU0sBFQ.js";import"./calendar-DDCCSPW6.js";import"./table-DHM-vCxP.js";import"./status-dot-CSBtKT4g.js";import"./client-activity-scopes-BLIy1Zc3.js";import"./client-rows-DiJQ5D1z.js";import"./entity-type-page-Lf6ONdpf.js";import"./card-BCsbrdGs.js";import"./record-session-D07szzqN.js";import"./copy-button-Df7QXE0w.js";const M=Symbol("trusted-automation-interaction");function nt(t){return Object.defineProperty(t,M,{value:!0}),t}function rt(t){return{title:`${t} 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 ${t} proposals?`,tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved all ${t} proposals.`},{id:"reject-all",label:"Reject all",variant:"outline",icon:"x",confirm:!0,confirmPrompt:`Reject all ${t} proposals?`,tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected all ${t} proposals.`}]}}const it=new Set(["automation-approval-batch"]);function ot(t){return new Promise(s=>{t({onSettled:(i,n)=>s(!!n)})})}function at(){const t=H(),s=V();return f.useMemo(()=>({toolNames:it,resolve:(i,n)=>{if(!n||typeof n!="object"||n[M]!==!0)return null;const r=n;if(i==="automation-approval-batch"){const o=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(d=>typeof d=="number"&&Number.isSafeInteger(d)&&d>0):[];return o===null||a===null||c.length!==a||new Set(c).size!==a?null:{view:rt(a),handlers:{manage_operations:d=>d.action!=="approve"&&d.action!=="reject"?Promise.resolve(!0):ot(m=>d.action==="approve"?t.mutate({run_id:o,run_ids:c},m):s.mutate({run_id:o,run_ids:c},m))}}}return null}}),[t,s])}function ct(t){const s=[];return t.forEach((i,n)=>{s.push({id:`sep:${i.runId}`,role:"system",parts:[{type:"text",text:dt(i,n)}],createdAt:i.completedAt?new Date(i.completedAt).getTime():void 0});for(const r of i.messages)s.push({...r,id:`r${i.runId}:${r.id}`})}),s}function dt(t,s){const i=(t.pendingActionCount??0)>0?`Waiting for you (${t.pendingActionCount})`:t.status==="completed"?"Completed":t.status??"Completed",n=(t.autoAppliedCount??0)>0?` · ${t.autoAppliedCount} applied automatically`:"",r=t.completedAt?new Date(t.completedAt).toLocaleString():null;return r?`Run ${s+1} · ${i}${n} · ${r}`:`Run ${s+1} · ${i}${n}`}const lt=/(?:^|\n)Run this Automation now/;function ut(t){return t.role==="user"&&t.parts.some(s=>s.type==="text"&<.test(s.text))}function mt(t){return`history-interaction:${t.runId}:${t.eventId??"error"}`}function pt({agentId:t,automationId:s,ownerSlug:i,runId:n}){const{data:r,isLoading:o}=q(t,s,{orgSlug:i,...n!=null?{runId:n}:{}}),a=at(),c=T(),d=f.useCallback(l=>{c?.open({href:`/${i}/automations/${s}?run_id=${l}`,title:`Automation run #${l}`,runId:l})},[c,i,s]),m=f.useMemo(()=>{const l=r?.runs??[],v=(n!=null?l.filter(u=>u.runId===n):l).slice().reverse();return ct(v.map(u=>{const h=u.messages.map(p=>Le(p,{showToolCalls:!0})).filter(p=>p!==null&&!ut(p));u.task?.trim()&&h.unshift({id:"task",role:"user",parts:[{type:"text",text:u.task.trim()}]});const x=u.actions??[],y=x.filter(p=>p.status==="pending");if(y.length>1){const p=y.map(j=>j.runId).sort((j,I)=>j-I);h.push({id:"approval-batch",role:"assistant",parts:[{type:"tool-call",toolCallId:`approval-batch-${u.runId}`,toolName:"automation-approval-batch",args:nt({runId:u.runId,count:y.length,runIds:p})}]})}for(const p of x){const j=Te([p],{workspaceSlug:i,agentId:t,webOrigin:typeof window>"u"?null:window.location.origin});j&&h.push({...j,id:mt(p)})}return{runId:u.runId,completedAt:u.completedAt,status:u.status,pendingActionCount:u.pendingActionCount,autoAppliedCount:u.autoAppliedCount,messages:h}}))},[t,r,i,n]);return o?e.jsx(_e,{readOnly:!0}):m.length===0?e.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)."}):e.jsx("div",{className:"flex h-[calc(100dvh-12rem)] min-h-[24rem] min-w-0 flex-1 flex-col",children:e.jsx(Re,{messages:m,workspaceSlug:i,children:e.jsx($e,{readOnly:!0,readerPositionMode:"runs",interactionExtension:a,onRunSelect:n==null&&c?d:void 0})})})}function xt(t){if(!t||typeof t!="object")return[];const s=t.properties;if(!s)return[];const i=Array.isArray(t.required)?new Set(t.required.map(String)):new Set;return Object.entries(s).map(([n,r])=>({name:n,type:String(r.type??"any"),required:i.has(n),description:typeof r.description=="string"?r.description:void 0}))}function ht({fields:t}){return t.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):e.jsx("ul",{className:"space-y-2",children:t.map(s=>e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[e.jsx("code",{className:"text-xs font-medium text-foreground",children:s.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:s.type}),s.required?e.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),s.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}):null]},s.name))})}function S({item:t,hideHeading:s=!1}){const i=t.schemaSections;return i?e.jsxs("article",{className:s?"space-y-4":"space-y-4 px-5 py-5",children:[!s&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(U,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h2",{className:"text-base font-medium text-foreground",children:t.title}),i.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description}):null]})]}),i.sections.map(n=>{const r=xt(n.schema);return e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n.title}),n.description?e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}):null]}),e.jsx(ht,{fields:r})]},n.title)})]}):null}function ft({panel:t}){const s=G(t.organizationId),i=t.section==="connections"||!!t.connectionId,n=W(t.organizationId,{connectorKey:t.connectorKey,connectionIds:t.connectionId?[t.connectionId]:void 0,enabled:i}),r=s.data?.find(a=>a.key===t.connectorKey),o=n.data?.find(a=>a.id===t.connectionId&&a.connector_key===t.connectorKey);return s.isLoading||i&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(b,{className:"h-28 w-full"})}):s.isError||i&&n.isError?e.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):t.connectionId&&!o||!r&&!o&&t.section!=="connections"?e.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):e.jsx("div",{className:"p-5",children:t.section==="runs"?e.jsx(De,{scope:{connectorKey:t.connectorKey},ownerSlug:t.ownerSlug}):t.section==="connections"?e.jsx(Ke,{connections:n.data??[],connector:r,connectorKey:t.connectorKey,ownerSlug:t.ownerSlug}):o?e.jsx(jt,{connection:o,connector:r,panel:t}):r?t.section==="oauth-apps"?e.jsx(Be,{connector:r,organizationId:t.organizationId,newApp:!!t.newApp}):t.section==="feeds"?e.jsx(yt,{connector:r}):r.installed===!1?e.jsx(gt,{connector:r,ownerSlug:t.ownerSlug}):e.jsx(Nt,{connector:r,ownerSlug:t.ownerSlug}):null},`${t.connectorKey}:${t.connectionId??"connector"}:${t.section}`)}function yt({connector:t}){const s=Object.entries(t.feeds_schema??{}).map(([i,n])=>{const r=n;return{id:i,name:r.name??i,description:r.description,feed:r}});return e.jsx(k,{entries:s,label:"feed types",renderDetail:({name:i,feed:n})=>e.jsx(S,{item:{href:"",title:i,schemaSections:Y(n)},hideHeading:!0})})}function gt({connector:t,ownerSlug:s}){const i=Object.entries(t.actions_schema??{}).map(([n,r])=>{const o=r;return{id:n,name:o.name??n,description:o.description,action:o}});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection."," ",e.jsx(L,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(k,{entries:i,label:"actions",renderDetail:({name:n,action:r})=>e.jsx(S,{hideHeading:!0,item:{href:"",title:n,schemaSections:z(r)}})})]})}function jt({connection:t,connector:s,panel:i}){const[n,r]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:i.section==="feeds"?e.jsx(vt,{connection:t,connector:s,ownerSlug:i.ownerSlug}):e.jsx(Q,{connection:t,ownerSlug:i.ownerSlug,inPeek:!0,onReviewPermissions:s?()=>r(!0):void 0})}),n&&s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(Z,{connection:t,connectorDef:s})]})]})}function vt({connection:t,connector:s,ownerSlug:i}){const{data:n=[],isLoading:r,isError:o}=X(t.id),[a,c]=f.useState(!1),d=t.facets?.chat??!1;if(r)return e.jsx(b,{className:"h-28 w-full"});if(o)return e.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const m=n.map(l=>({id:String(l.id),name:l.display_name||l.feed_key,status:He(l)??(l.operations.includes("sync")?"Sync enabled":"Live access"),feed:l}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:a,children:e.jsx(k,{entries:m,label:d?"channels":"feeds",action:Object.keys(s?.feeds_schema??{}).length>0?e.jsx(N,{size:"sm",variant:"outline",onClick:()=>c(!0),children:d?"Add channel":"Add feed"}):void 0,renderDetail:({feed:l})=>l.store==="channel_messages"?e.jsx(Ee,{feed:l,hideHeader:!0}):e.jsx(Oe,{feed:l,connectorDef:s,ownerSlug:i})})}),a&&s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold",children:d?"Add channel":"Add feed"}),e.jsx(ze,{organizationId:t.organization_id,connections:[t],connectorDefinitions:[s],onClose:()=>c(!1)})]})]})}function Nt({connector:t,ownerSlug:s}){const{data:i=[],isLoading:n,isError:r}=J(t.key);if(n)return e.jsx(b,{className:"h-28 w-full"});if(r)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const o=t.actions_schema??{},a=i.map(c=>({id:c.operation_key,name:c.name??c.operation_key,description:c.description,operation:c}));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Policy depends on connection. Click an action to inspect its inputs."," ",e.jsx(L,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(k,{entries:a,label:"actions",renderControl:()=>e.jsx(L,{ownerSlug:s,connectorKey:t.key}),renderDetail:({operation:c,name:d})=>o[c.operation_key]?e.jsx(S,{hideHeading:!0,item:{href:"",title:d,schemaSections:z(o[c.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function wt({owner:t,path:s}){const{data:i,isLoading:n}=A(t,{slug:t}),r=i?.workspace,o=r?.type==="organization"?r.id:null,a=o?{slug:t}:void 0,{data:c,isLoading:d}=D(`/${t}/${F(s)}`,a),m=c?.entity,l=m?.id;return n||d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]}):o?l==null?e.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."}):m?.is_derived?e.jsx(Ve,{record:{type:m.entity_type,key:m.slug},orgContext:a}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(R,{organizationId:o,ownerSlug:t,entityId:typeof l=="number"?l:void 0,filters:{sortBy:"date",sortOrder:"desc"},emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})}):e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."})}function bt(t){if(Array.isArray(t.enum))return`One of ${t.enum.length}`;if(t.format==="date"||t.format==="date-time")return"Date";if(t.format==="uri")return"Link";if(t.format==="email")return"Email";const s=Array.isArray(t.type)?t.type[0]:t.type;return s==="array"?"List":s==="object"?"Group":s==="integer"||s==="number"?"Number":s==="boolean"?"Yes / no":"Text"}function kt({owner:t,typeSlug:s,view:i}){const{data:n,isLoading:r}=A(t,{slug:t}),o=n?.workspace,a=o?.type==="organization"?o.id:null,{isAdmin:c}=ee(a??void 0),{orgContext:d}=te(),{data:m,isSuccess:l}=se(d),g=(m??[]).find(w=>w.slug===s),v=l&&!g,u=`/${t}/${ne(s)}`,{pathname:h}=re(),x=h===u||h===`${u}/`||h.startsWith(`${u}/-/`),y=f.useMemo(()=>Ue(g?.metadata_schema),[g?.metadata_schema]),p=T(),j=p?.close;f.useEffect(()=>{v&&j?.()},[v,j]);const I=f.useMemo(()=>({entityTypes:[s],sortBy:"date",sortOrder:"desc"}),[s]);if(r)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]});if(v)return e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This entity type no longer exists."});if(!a)return e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."});const K=g?.name??s;return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-2.5",children:[x?null:e.jsx(N,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs($,{...oe(t,s),children:[e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5"}),"Browse records"]})}),g&&!x&&!ae(g)&&g.entity_count!==0?e.jsx(N,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs($,{to:"/$owner/$entityType/-/$shape",params:{owner:t,entityType:s,shape:"graph"},search:de(E(t,s)),children:[e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5"}),"Graph"]})}):null,i!=="activity"&&p?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"ml-auto h-8 gap-1.5 text-xs text-muted-foreground hover:text-foreground",onClick:()=>p.open({href:E(t,s,"activity"),title:`${K} activity`}),children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Activity"]}):null]}),i==="activity"?e.jsx("div",{className:"px-4 py-4",children:e.jsx(R,{organizationId:a,ownerSlug:t,filters:I,showEntityLinks:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to these records yet."})})}):c?e.jsx("div",{className:"p-4",children:e.jsx(qe,{slug:s,onClose:()=>j?.()})}):y.length>0?e.jsxs("section",{"aria-labelledby":"entity-type-peek-fields",className:"px-4 py-4",children:[e.jsx("h3",{id:"entity-type-peek-fields",className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Fields"}),e.jsx("dl",{className:"divide-y divide-border/60 text-sm",children:y.map(w=>e.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-1.5",title:w.prop.description,children:[e.jsx("dt",{className:"min-w-0 truncate",children:Ge(w)}),e.jsx("dd",{className:"shrink-0 text-xs text-muted-foreground",children:bt(w.prop)})]},w.key))})]}):e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This type has no fields yet."})]})}function At({owner:t,eventId:s,viewKey:i}){const n=T(),r=(o,a)=>e.jsx(Qe,{owner:a,organizationId:o,eventId:s,viewKey:i,dense:!0,onSelectView:n?c=>n.retarget(c):void 0},`${a}/${s}/${i??""}`);return e.jsx("div",{className:"px-4 py-4",children:t==="me"?r(null,t):e.jsx(ue,{owner:t,children:({organizationId:o,ownerSlug:a})=>o?r(o,a):e.jsx("div",{className:"h-40 animate-pulse rounded-md bg-muted/40"})})})}function P({owner:t,runId:s,runIds:i,contentIds:n}){const{data:r,isLoading:o}=A(t==="me"?null:t,{slug:t}),a=r?.workspace,c=t!=="me"&&a?.type==="organization"?a.id:null,d=f.useMemo(()=>{if(t==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const l=i??(s!=null?[s]:void 0);if(!(!l?.length&&!n?.length))return{...l?.length?{runIds:l}:{},...n?.length?{contentIds:n}:{}}},[t,n,s,i]),m=d!=null;return t!=="me"&&o?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]}):t!=="me"&&c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):m?e.jsx("div",{className:"px-4 py-4",children:e.jsx(R,{presentation:"detail",organizationId:c,ownerSlug:t,filters:d,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:s!=null||i?.length?"No matching events from this run yet.":"No matching events yet."})})}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}const _=25;function Ct({target:t}){const[s,i]=f.useState(0),{data:n,isLoading:r,isError:o,refetch:a}=me(t.entityId,t.orgContext,{relationshipType:t.relationshipType,limit:_,offset:s}),c=n?.total;return e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.label," · ",t.entityName,c!==void 0?` · ${c} current ${c===1?"link":"links"}`:n?` · ${n.rows.length} shown`:""]}),e.jsx(Je,{count:n?.failures?.length??0,onRetry:()=>void a()}),r?e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{className:"h-6 w-full"}),e.jsx(b,{className:"h-6 w-full"})]}):o||!n?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Could not load these links."," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>void a(),children:"Retry"})]}):n.rows.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No links on this page."}):e.jsx("ul",{className:"divide-y divide-border",children:n.rows.map(d=>e.jsx("li",{className:"flex items-center justify-between gap-3 py-1.5",children:e.jsx(Xe,{row:d,entityId:t.entityId,ownerSlug:t.ownerSlug,orgContext:t.orgContext})},d.id))}),n&&(s>0||n.hasMore)?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:s===0,onClick:()=>i(Math.max(0,s-_)),children:"Previous"}),e.jsxs("span",{className:"text-xs tabular-nums text-muted-foreground",children:[n.rows.length," shown",c===void 0?"":` of ${c}`]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!n.hasMore,onClick:()=>i(s+_),children:"Next"})]}):null]})}function St({owner:t,path:s,viewKey:i}){const[n,r]=f.useState({}),{data:o,isLoading:a}=A(t,{slug:t}),c=o?.workspace,d=c?.type==="organization"?c.id:null,m=d?{slug:t,organizationId:d}:void 0,{data:l,isLoading:g}=D(`/${t}/${F(s)}`,m),{isMember:v,isLoading:u}=pe(t),h=xe({slug:t,organizationId:v?d:null}),x=l?.entity;if(a||g||u||v&&h.isLoading)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]});if(!v)return e.jsx(Ze,{});if(h.isError)return e.jsx(et,{onRetry:()=>void h.refetch()});const y=x?he(h.data??[],{type:x.entity_type,id:x.id??x.slug}).find(p=>p.key===i):void 0;return!d||!x||!y?e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This view isn't attached to this record any more."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(tt,{orgSlug:t,viewKey:y.key,scope:{type:x.entity_type,entity:x.is_derived?x.slug:x.id??x.slug},params:n,onParamsChange:r,contentHash:y.content_hash,title:y.name,minHeight:320})})}function B({owner:t,runId:s}){const i=fe({queryKey:["run-outcome",t,s],queryFn:async()=>{const r=await ge("manage_operations",{action:"get_run",run_id:s},{slug:t});if(!r.run)throw new Error(r.error||"Run not found");return r.run},enabled:t!=="me",staleTime:15e3,refetchInterval:r=>["pending","claimed","running"].includes(r.state.data?.status??"")?5e3:!1});if(t==="me")return null;if(i.isLoading)return e.jsx("p",{role:"status",className:"px-4 pt-4 text-xs text-muted-foreground",children:"Loading run…"});if(!i.data)return e.jsx("p",{role:"alert",className:"px-4 pt-4 text-sm text-destructive",children:"Could not load this run."});const n=i.data;return e.jsxs("section",{"aria-label":"Run outcome",className:"space-y-2 border-b px-4 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Fe,{status:Me(n.status),children:n.status}),e.jsx("time",{dateTime:n.created_at,className:"text-xs text-muted-foreground",children:ye(n.created_at)})]}),n.connection_display_name?e.jsx("p",{className:"text-sm",children:n.connection_display_name}):null,n.error_message?e.jsx("p",{className:"whitespace-pre-wrap break-words text-sm text-destructive",children:n.error_message}):null,i.isError?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not refresh this run. Showing its last known outcome."}):null]})}function vs({item:t}){if(t.connectorPanel)return e.jsx(ft,{panel:t.connectorPanel});if(t.schemaSections)return e.jsx(S,{item:t});if(t.recordField)return e.jsx(Ye,{target:t.recordField});if(t.recordPeer)return e.jsx(We,{target:t.recordPeer});if(t.recordLinks)return e.jsx(Ct,{target:t.recordLinks});if(typeof t.browserUrl=="string"&&t.browserUrl.length>0)return e.jsx(O,{item:t});const s=t.href?je(t.href):null;return s?s.kind==="memory"?"runId"in s?e.jsxs(e.Fragment,{children:[e.jsx(B,{owner:s.owner,runId:s.runId}),e.jsx(P,{owner:s.owner,runId:s.runId})]}):"runIds"in s?e.jsx(P,{owner:s.owner,runIds:s.runIds}):e.jsx(P,{owner:s.owner,contentIds:s.contentIds}):s.kind==="entity"?e.jsx(wt,{owner:s.owner,path:s.path}):s.kind==="entity-type"?e.jsx(kt,{owner:s.owner,typeSlug:s.typeSlug,view:s.view}):s.kind==="record-view"?e.jsx(St,{owner:s.owner,path:s.path,viewKey:s.viewKey}):s.kind==="event"?e.jsx(At,{owner:s.owner,eventId:s.eventId,viewKey:s.viewKey}):t.runId?e.jsx(It,{owner:s.owner,automationId:s.automationId,runId:t.runId}):e.jsx(Pt,{owner:s.owner,automationId:s.automationId,initialView:s.view??"activity",runId:s.runId}):e.jsx(O,{item:t})}function O({item:t}){const s=t.body,i=t.notificationType??"generic",n=t.createdAt,r=t.browserUrl??null,o=t.browserHandoff??null;return e.jsxs("article",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ve,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:Ne(i)}),n?e.jsx("span",{children:we(n)}):null]})]}),s?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(be,{text:s,linkPolicy:i==="action_approval_needed"?"app-links":"strip"})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),t.owner&&t.sourceAttribution?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),e.jsx(ke,{owner:t.owner,source:t.sourceAttribution,className:"text-xs"})]}):null,r?e.jsx("div",{className:"space-y-2",children:o?.state==="expired"?e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:o.error_message??"This draft expired before the page was opened."}):o?.state==="completed"||o?.state==="preparing"?e.jsx("p",{className:"text-sm text-muted-foreground",children:o.state==="preparing"?"Preparing draft — keep your browser tab open.":"Draft prepared — review and post in your browser."}):e.jsxs(N,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{Ce(r)},children:[e.jsx(Ae,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function It({owner:t,automationId:s,runId:i}){const{organizationId:n}=Ie(t),r=st(s,void 0,n),o=r.data?.automation?.managed_agent_id??null;return o?e.jsx(pt,{agentId:o,automationId:s,ownerSlug:t,runId:i}):r.isLoading?e.jsx(b,{className:"h-24 w-full rounded-lg"}):e.jsx(B,{owner:t,runId:i})}function Pt({owner:t,automationId:s,initialView:i,runId:n}){const[r,o]=f.useState(i),a=r==="definition";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>o(a?"activity":"definition"),children:a?"Done":e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"h-3.5 w-3.5"}),"Edit"]})})}),e.jsx(Pe,{owner:t,agentId:null,automationId:s,view:r,runId:n,onDone:()=>o("activity")})]})}export{vs as PeekPaneContent};
|
|
2
|
+
//# sourceMappingURL=peek-pane-content-D7yt0PrA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as r,et as i,j as e,iO as m}from"./index-008wj-Pz.js";import{A as c}from"./agent-permissions-matrix-CgsQ8BK_.js";import{A as l}from"./agent-subpage-shell-CLqpn5Tb.js";function x({owner:t,agentId:s}){const{orgContext:n}=r(),{isAdmin:o,isLoading:a}=i(n.organizationId);return e.jsx(l,{children:o?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:t,agentId:s})})]}):a?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:t,agentId:s}=m.useParams();return e.jsx(x,{owner:t,agentId:s})}export{p as component};
|
|
2
|
+
//# sourceMappingURL=permissions-CfoY4WFY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{hf as w,gO as R,gP as y,r as N,j as e,bf as P,B as d,H as k,ew as C}from"./index-008wj-Pz.js";import{a as A}from"./runs-lG2ChtOt.js";function B({resource:g,runId:t,children:h,onDone:l}){const c=!!t,{data:a,isLoading:E,isError:u,refetch:v}=A(g,c?t:void 0),s=w({isReview:c,isError:u,status:a?.status}),m=a?.status==="pending"?a.proposal:null,n=R(),i=y(),[p,x]=N.useState(""),o=n.isPending||i.isPending,j=s==="active"||s==="loading"||s==="error",b=()=>{t&&n.mutate({run_id:t},{onSuccess:()=>l?.()})},f=()=>{if(!t)return;const r=p.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(P,{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(k,{htmlFor:"review-reject-reason",children:"Reason (optional)"}),e.jsx(C,{id:"review-reject-reason",rows:2,value:p,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:f,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-CVkLnnKo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aw as vn,j as n,r as b,v as G,w as ie,cS as yn,co as It,cT as At,L as Ne,cU as gn,cV as xn,c5 as bn,cW as jn,cJ as kn,cX as Et,cY as A,bt as ft,cZ as Cn,c_ as Sn,ak as Nn,c$ as _n,aj as In,d0 as An,d1 as ae,cz as En,d2 as Tt,d3 as Tn,am as Fn,d4 as wn,b8 as Rn,bi as Mn,as as Ce,d5 as Pn,d6 as $n,ap as Ft,aE as wt,d7 as On,cP as Ln,d8 as Dn,d9 as Rt,da as Kn,db as Bn,bm as Vn,b5 as Un,bv as Gn,bw as Qn,dc as zn,bx as Wn,by as Hn,bz as Yn,S as qn,dd as Zn,I as Xn,h as _e,X as Jn,B as W,de as es,df as ts,dg as ns,bH as ss,dh as os,di as as,dj as is,dk as Mt,dl as pt,o as rs,dm as cs,dn as Oe,dp as ht,cn as ls,dq as ds,k as us,aD as ms,dr as fs,ds as ps,dt as hs,du as vs,dv as ys,dw as gs,dx as xs,bS as bs,dy as js,aV as ks,a$ as vt,dz as yt,dA as Pt,cB as Le,cR as $t,dB as Cs,dC as De}from"./index-008wj-Pz.js";import{S as K,F as Ss,d as Ns,o as ke,r as _s,f as Is,a as As}from"./filter-bar-COU0sBFQ.js";import{c as gt}from"./connection-label-BobuYiAG.js";import{u as Es}from"./runs-lG2ChtOt.js";import{S as Ts}from"./source-record-panels-CjFPgKKJ.js";import{u as Fs}from"./clients-8-EpRjsm.js";import{u as ws}from"./client-activity-scopes-BLIy1Zc3.js";import{g as Rs}from"./client-rows-DiJQ5D1z.js";import{a as Ms,E as Ps}from"./events-feed-VfU4csn2.js";import{L as $s,u as Os}from"./renderer-AJxSmE3-.js";import{E as Ls}from"./agent-loading-shells-CamDtzHY.js";import{M as Ds}from"./member-scope-gate-De75CR7W.js";const Ue=b.createContext(null);function Ks({organizationId:e,isWorkspaceLoading:t,children:o}){const{data:s=[],isLoading:a}=vn(e);return n.jsx(Ue.Provider,{value:{groups:s,isLoading:!!t||a},children:o})}function Bs(){const e=b.useContext(Ue);if(!e)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return e}function Vs(){return b.useContext(Ue)}function Ot(e){const{parse:t,serialize:o,filterKeys:s,clearClassifications:a=!0,replace:r=!0,merge:f}=e,m=G(),u=ie(),c=b.useMemo(()=>{const g=new URLSearchParams;for(const[l,h]of Object.entries(u.search||{}))h!=null&&g.set(l,typeof h=="object"&&!Array.isArray(h)?JSON.stringify(h):String(h));return t(g)},[u.search,t]),i=b.useCallback((g,l)=>{const h=f?f(c,g):{...c,...g},y=o(h),C={};for(const[S,x]of Object.entries(u.search||{}))x!=null&&(C[S]=x);for(const S of s)delete C[S];if(a)for(const S of Object.keys(C))S.startsWith("clf_")&&delete C[S];for(const[S,x]of Object.entries(y))x!==void 0&&(C[S]=x);m({to:u.pathname,search:C,replace:l?.replace??r})},[c,o,s,a,f,m,u,r]),d=b.useCallback(()=>{const g={};for(const[l,h]of Object.entries(u.search||{}))h!=null&&(s.includes(l)||a&&l.startsWith("clf_")||(g[l]=h));m({to:u.pathname,search:g,replace:r})},[m,u.pathname,u.search,s,a,r]);return{filters:c,updateFilters:i,clearFilters:d}}function Us(e){const{slug:t}=yn();return It({queryKey:["schedules",t,e],queryFn:async()=>((await At("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 Gs(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 Qs(e,t){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:e,connectorKey:t.connector_key,connectionId:String(t.id)}}}function zs(e,t){return{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:t}}}function Ws(e,t){return{to:"/$owner/automations/$automationId",params:{owner:e,automationId:t}}}function Hs(e,t,o){return{to:"/$owner/events",params:{owner:e},search:{agent:t,schedule:o}}}function ye({id:e,label:t,value:o,sourceLink:s,details:a,onRemove:r}){return{id:e,label:t,op:"is",value:o,onRemove:r,editor:s||a?{kind:"custom",className:"w-80",render:()=>n.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[s?n.jsxs(Ne,{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(gn,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):n.jsx("span",{className:"font-medium",children:o}),a]})}:void 0}}function Ys({ownerSlug:e,clientIds:t,linkedUser:o,linkedUserEntitySlug:s}){const a=e&&s?xn(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(r=>n.jsx("code",{className:"break-all text-foreground",children:r},r))]}),o?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",a?n.jsx(Ne,{to:a,className:"font-medium text-foreground hover:underline",children:o}):n.jsx("span",{className:"font-medium text-foreground",children:o})]}):null]})}function ee(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function ge(e,t,o){const s=new Set;for(const[a,r]of Object.entries(e.feeds_schema??{})){if(o&&!o.has(a))continue;const f=ee(ee(r)?.eventKinds);if(f)for(const[m,u]of Object.entries(f)){if(!t){s.add(m);continue}const c=ee(u)?.attributions;Array.isArray(c)&&c.some(i=>{const d=ee(ee(i)?.target);return typeof d?.entityType=="string"&&t.has(d.entityType)})&&s.add(m)}}return s}function qs({connectors:e,entityTypes:t,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:a=[]}){const r=new Set,f=new Set(o),m=new Set(a),u=new Map;for(const c of s){const i=u.get(c.connectorKey)??new Set;i.add(c.feedKey),u.set(c.connectorKey,i)}if(u.size>0)for(const c of e){const i=u.get(c.key);if(i)for(const d of ge(c,void 0,i))r.add(d)}else if(f.size>0){for(const c of e)if(f.has(c.key))for(const i of ge(c))r.add(i)}else if(m.size>0){for(const c of t)if(m.has(c.slug))for(const i of Object.keys(c.event_kinds??{}))r.add(i);for(const c of e)for(const i of ge(c,m))r.add(i)}else{for(const c of t)for(const i of Object.keys(c.event_kinds??{}))r.add(i);for(const c of e)for(const i of ge(c))r.add(i)}return[...r].sort((c,i)=>c.localeCompare(i))}function oe({to:e,params:t,search:o,label:s}){return n.jsx(Ne,{to:e,params:t,search:o,onClick:a=>a.stopPropagation(),onPointerDown:a=>a.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(bn,{className:"h-3.5 w-3.5"})})}const Ke=["produced","analyzed"],Se=e=>e==="produced"?"Produced by":"Analyzed by";function Zs({enabled:e,...t}){const o=Xs(t,e);if(!e)return{fields:[],chips:[]};const s=Js(t);return{fields:[o.field,s.field],chips:[...o.chips,...s.chips]}}function Xs({ownerSlug:e,filters:t,onFiltersChange:o},s){const a=It({queryKey:["automations-list","activity",e],queryFn:async()=>{const i=await Promise.all(["active","archived"].map(d=>At("manage_automations",{action:"list",status:d,include_details:!1},{slug:e})));return[...new Map(i.flatMap(d=>d.automations).map(d=>[Number(d.automation_id),d])).values()].sort((d,g)=>d.name.localeCompare(g.name))},enabled:s&&!!e,staleTime:3e4}),r=a.data??[],f=i=>i==="produced"?t.producedByAutomationId:t.automationId,m=i=>r.find(d=>Number(d.automation_id)===i)?.name??`#${i}`,u=Ke.flatMap(i=>{const d=f(i);return d==null?[]:[{id:`automation-${i}`,field:"automation",label:Se(i),value:m(d),onRemove:()=>o(i==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),c={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:a.isLoading?"Loading Automations...":"No Automations found",items:i=>n.jsxs(n.Fragment,{children:[Ke.map(d=>{const g=f(d),l=r.map(y=>({id:Number(y.automation_id),label:`${y.name}${y.status==="archived"?" (archived)":""}`}));g!=null&&!l.some(y=>y.id===g)&&l.unshift({id:g,label:`Automation #${g} (selected)`});const h=y=>{o(d==="produced"?{producedByAutomationId:y}:{automationId:y}),i()};return n.jsx(Et,{heading:Se(d),children:l.map(y=>n.jsxs(A,{"aria-label":y.label,value:`${d} ${y.label} ${y.id}`,onSelect:()=>h(y.id),className:"group",children:[n.jsx(K,{selected:g===y.id}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.label}),n.jsx(oe,{...Ws(e,String(y.id)),label:y.label})]},y.id))},d)}),a.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void a.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:u,field:{key:"automation",label:"Automation",group:"Scope",icon:n.jsx(jn,{className:"h-4 w-4"}),editor:c}}}function Js(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(r=>`#${r}`).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 a={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:(r,f)=>Ke.map(m=>n.jsx(eo,{...e,mode:m,query:f,close:r},m))};return{chips:s,field:{key:"run",label:"Run",group:"Scope",icon:n.jsx(kn,{className:"h-4 w-4"}),editor:a}}}function eo({ownerSlug:e,filters:t,onFiltersChange:o,mode:s,query:a,close:r}){const f=s==="produced"?t.producedByAutomationId:t.automationId,m=Es({workspace:!0},{automationIds:f==null?void 0:[f],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),u=s==="produced"?t.runIds??[]:t.runId==null?[]:[t.runId],c=m.data?.pages.flatMap(l=>l.runs)??[],i=[...new Map(c.map(l=>[l.id,{id:l.id,label:`Run #${l.id} · ${l.feed_display_name??l.operation_key??l.run_type} · ${l.status}`}])).values()];for(const l of u)i.some(h=>h.id===l)||i.unshift({id:l,label:`Run #${l} (selected)`});const d=l=>{if(s==="produced"){const h=u.includes(l)?u.filter(y=>y!==l):[...u,l];o({runIds:h.length?h:null})}else o({runId:l}),r()},g=/^\d+$/.test(a.trim())?Number(a.trim()):0;return n.jsxs(Et,{heading:Se(s),children:[i.map(l=>n.jsxs(A,{value:`${s} ${l.label}`,onSelect:()=>d(l.id),children:[n.jsx(K,{selected:u.includes(l.id)}),n.jsx("span",{className:"truncate",children:l.label})]},l.id)),Number.isSafeInteger(g)&&g>0&&!i.some(l=>l.id===g)?n.jsxs(A,{value:`${s} ${g}`,onSelect:()=>d(g),children:[Se(s)," run #",g]}):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&&!i.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 Ge="Scope",$e="Source",z="h-4 w-4";function re(){return ie().search??{}}function Lt(e){const{pathname:t}=ie(),o=t.startsWith(`/${e}/events/`),s=Nn(t,o?1:0),a=!!(s&&!o&&!_n(s.split("/")[0]));return{pathname:t,embedded:a,recordPath:a?In(s)?.entityPath:o?s:void 0}}function Dt(e){const t=re(),{recordPath:o,pathname:s,embedded:a}=Lt(e);return r=>{const f=ae(e,t,r,o);return a?{to:s,search:f.search}:f}}const xt=e=>new Set((e??"").split(",").map(t=>t.trim()).filter(Boolean));function to({ownerSlug:e,sourceRead:t=!1,filters:o,onFiltersChange:s}){const a=re(),{recordPath:r,embedded:f}=Lt(e),m=r?r.split("/").at(-2):void 0,u=typeof a.type=="string"&&a.type.trim()?a.type.trim():void 0,c=(m?ft(m):void 0)??(u?ft(u):void 0),i=Cn(a),d=Sn(a),g=typeof a.feed_ids=="string"?a.feed_ids:typeof a.feed_ids=="number"?String(a.feed_ids):void 0,l=no(e,c,!f),h=so(e,c,r,f),y=oo(e,i,!t),C=Zs({ownerSlug:e,filters:o,onFiltersChange:s,enabled:!t}),S=ao(e,d,g);return[l,h,y,C,S].reduce((x,F)=>({fields:[...x.fields,...F.fields],chips:[...x.chips,...F.chips]}),{fields:[],chips:[]})}function no(e,t,o){const s=G(),a=re(),{visible:r}=An(e);if(!o)return{fields:[],chips:[]};const f=r.find(u=>u.slug===t),m={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:u=>n.jsxs(n.Fragment,{children:[r.map(c=>n.jsxs(A,{onSelect:()=>{s(ae(e,a,{entity:void 0,create:void 0,type:c.slug})),u()},className:"group gap-2",children:[n.jsx(K,{selected:c.slug===t}),n.jsx(Dn,{icon:c.icon,className:"h-4 w-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name}),typeof c.entity_count=="number"?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:c.entity_count}):null,n.jsx(oe,{to:"/$owner/entity-types/$slug",params:{owner:e,slug:c.slug},label:c.name})]},c.id)),n.jsxs(A,{onSelect:()=>{s(Kn(e)),u()},className:"text-muted-foreground",children:[n.jsx(Rt,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:Ge,icon:n.jsx(En,{className:z}),editor:m}],chips:t?[{id:"type",label:"Entity type",op:"is",value:f?.name??t,onRemove:()=>void s(ae(e,a,{type:void 0}))}]:[]}}function so(e,t,o,s){const a=G(),r=re(),[f,m]=b.useState(""),[u,c]=b.useState(0),i=Tt(f,250),d={slug:e},{data:g,isLoading:l,isError:h,refetch:y}=Tn(t??"",d,{search:i,offset:u,limit:30,enabled:!s&&!!t}),{data:C}=Fn(o?`/${e}/${o}`:"",d),S=o?C?.entity:void 0,x=S?.name??(o?o.split("/").at(-1):void 0);if(s)return{fields:[],chips:x?[{id:"entity",label:"Entity",op:"is",value:x}]:[]};if(!t)return{fields:[],chips:[]};const F={kind:"list",searchPlaceholder:"Search entities...",emptyText:l?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:M=>{m(M),c(0)},items:M=>n.jsxs(n.Fragment,{children:[h?n.jsx(A,{onSelect:()=>void y(),children:"Could not load entities. Retry"}):g?.entities.map(I=>n.jsxs(A,{value:I.slug,onSelect:()=>{const P=Bn([...I.parent_slug&&I.parent_entity_type?[{entity_type:I.parent_entity_type,slug:I.parent_slug}]:[],{entity_type:I.entity_type,slug:I.slug}]);a(ae(e,r,{type:t},P)),M()},children:[n.jsx(K,{selected:S?.slug===I.slug}),I.name]},I.slug)),u>0&&n.jsx(A,{onSelect:()=>c(Math.max(0,u-30)),children:"Previous entities"}),g?.metadata.has_more&&n.jsx(A,{disabled:l,onSelect:()=>c(u+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:Ge,icon:n.jsx(wn,{className:z}),editor:F}],chips:x?[{id:"entity",label:"Entity",op:"is",value:x,onRemove:()=>void a(ae(e,r,{type:t}))}]:[]}}function oo(e,t,o){const s=G(),a=Dt(e),{data:r=[]}=Rn(),f=b.useMemo(()=>[...r].sort((c,i)=>c.name.localeCompare(i.name)),[r]);if(!o)return{fields:[],chips:[]};const m=f.find(c=>c.agentId===t),u={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:c=>f.map(i=>n.jsxs(A,{onSelect:()=>{s(a({agent:i.agentId,schedule:void 0})),c()},className:"gap-2",children:[n.jsx(K,{selected:i.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:i.name.trim().charAt(0).toUpperCase()||"?"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.name})]},i.agentId))};return{fields:[{key:"agent",label:"Agent",group:Ge,icon:n.jsx(Mn,{className:z}),editor:u}],chips:t?[{id:"agent",label:"Agent",op:"is",value:m?.name??t,onRemove:()=>void s(a({agent:void 0,schedule:void 0}))}]:[]}}function ao(e,t,o){const s=G(),a=Dt(e),{groups:r}=Bs(),f=re(),m=Ce({platforms:String(f.platforms??f.platform??"")}).platforms??[],u=b.useMemo(()=>xt(t),[t]),c=b.useMemo(()=>xt(o),[o]),i=m.length===1?m[0]:Pn(r,u),d=r.find(_=>_.connector_key===i),g=u.size===1?Number([...u][0]):void 0,l=$n(g),{org:h}=Ft(),y=wt(h?.id,{feedIds:[...c].map(Number),enabled:g==null&&c.size>0}),C=g==null?y:l,S=C.data??[],x={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},F={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:_=>n.jsxs(n.Fragment,{children:[r.map(k=>{const E=k.connector_name??k.connector_key;return n.jsxs(A,{disabled:k.connections.length===0,onSelect:()=>{s(a({...x,platforms:k.connector_key})),_()},className:"group gap-2",children:[n.jsx(K,{selected:k.connector_key===d?.connector_key}),n.jsx(Un,{plain:!0,name:E,faviconDomain:k.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:E}),k.connection_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:k.connection_count}):null,n.jsx(oe,{to:"/$owner/connectors/$connectorKey",params:{owner:e,connectorKey:k.connector_key},label:E})]},k.connector_key)}),n.jsx(A,{asChild:!0,onSelect:_,className:"text-muted-foreground",children:n.jsxs(Ne,{to:"/$owner/connectors/create",params:{owner:e},className:"flex items-center gap-2",children:[n.jsx(Rt,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},M=[{key:"connector",label:"Connector",group:$e,icon:n.jsx(Vn,{className:z}),editor:F}],I=[],P=d?.connector_name??d?.connector_key??(m.join(", ")||(u.size?`Connections ${[...u].join(", ")}`:void 0));if(P&&I.push({id:"connector",label:"Connector",op:"is",value:P,onRemove:()=>void s(a(x))}),d){M.push({key:"connection",label:"Connection",group:$e,icon:n.jsx(On,{className:z}),editor:Q(d)});const _=u.size===1?d.connections.find(k=>u.has(String(k.id))):void 0;_&&I.push({id:"connection",label:"Connection",op:"is",value:gt({display_name:_.display_name,connector_name:d.connector_name,connector_key:d.connector_key}),onRemove:()=>void s(a({...x,platforms:d.connector_key}))})}if((g||o)&&M.push({key:"feed",label:"Feed",group:$e,icon:n.jsx(Ln,{className:z}),editor:H()}),c.size>0){const _=c.size===1?S.find(k=>c.has(String(k.id))):void 0;I.push({id:"feed",label:"Feed",op:"is",value:_?xe(_):`#${o}`,onRemove:()=>void s(a({...g!=null?{connection_ids:String(g)}:{},feed_ids:void 0}))})}return{fields:M,chips:I};function Q(_){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:k=>_.connections.map(E=>{const O=gt({display_name:E.display_name,connector_name:_.connector_name,connector_key:_.connector_key});return n.jsxs(A,{onSelect:()=>{s(a({connection_ids:String(E.id),feed_ids:void 0})),k()},className:"group gap-2",children:[n.jsx(K,{selected:u.has(String(E.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:O}),E.feed_count>0?n.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:E.feed_count}):null,n.jsx(oe,{...Qs(e,{id:E.id,connector_key:_.connector_key}),label:O})]},E.id)})}}function H(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:C.isLoading?"Loading feeds...":"No feeds",items:_=>S.map(k=>n.jsxs(A,{"aria-label":xe(k),onSelect:()=>{s(a({...g!=null?{connection_ids:String(g)}:{},feed_ids:String(k.id)})),_()},className:"group gap-2",children:[n.jsx(K,{selected:c.has(String(k.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:xe(k)}),n.jsx(oe,{...Gs(e,k),label:xe(k)})]},k.id))}}}function xe(e){return e.display_name?.trim()||e.feed_key}const io=["notification"],ro=["note","summary","decision","observation","fact","change","preference","identity"],co=[...io,...ro],bt=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}],Kt={value:"notifications",label:"Notifications"};function lo({value:e,onChange:t,withNotifications:o=!1}){const s=o?[Kt,...bt]:bt,a=s.find(r=>r.value===e)?.label??"Newest first";return n.jsxs(Gn,{value:e,onValueChange:t,children:[n.jsxs(Qn,{"aria-label":"Sort",className:"h-9 w-auto shrink-0 gap-2 bg-background px-2.5",children:[n.jsx(zn,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx(Wn,{children:a})]}),n.jsx(Hn,{align:"end",className:"min-w-40",children:s.map(r=>n.jsx(Yn,{value:r.value,children:r.label},r.value))})]})}const jt=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],kt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],be=0,je=100,te="Event",ne="h-4 w-4";function se(e){const t=e.replace(/[_-]+/g," ").trim();return t.length>0?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e}function uo(e,t,o){const s=e.semanticTypes??[],a=o.length>0?o:co,r=[...new Set([...a,...s])].sort((d,g)=>se(d).localeCompare(se(g))).map(d=>({value:d,label:se(d)})),f=e.engagementRange??[be,je],m=e.reviewStatus,u=e.interactionStatus,c=[{key:"date",label:"Date",group:te,icon:n.jsx(ts,{className:ne}),editor:Ns({value:e.dateRange??void 0,onApply:d=>t({dateRange:d})})},{key:"kind",label:"Event kind",group:te,icon:n.jsx(ns,{className:ne}),editor:ke({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:r,selected:s,multiple:!0,onSelect:d=>{const g=s.includes(d)?s.filter(l=>l!==d):[...s,d];t({semanticTypes:g.length>0?g:void 0})}})},{key:"approval",label:"Approval",group:te,icon:n.jsx(ss,{className:ne}),editor:ke({searchPlaceholder:"Search statuses...",options:[...kt],selected:u?[u]:[],onSelect:d=>t({interactionStatus:d})})},{key:"review",label:"Reviewed by",group:te,icon:n.jsx(os,{className:ne}),editor:ke({searchPlaceholder:"Search reviewers...",options:[...jt],selected:m&&m!=="all"?[m]:[],onSelect:d=>t({reviewStatus:d})})},{key:"score",label:"Engagement score",group:te,icon:n.jsx(as,{className:ne}),editor:_s({value:f,min:be,max:je,onApply:d=>t({engagementRange:d})})}],i=[];return e.dateRange&&i.push({id:"date",label:"Date",op:"is",value:Is(e.dateRange),onRemove:()=>t({dateRange:null})}),s.length&&i.push({id:"kind",label:"Event kind",op:s.length>1?"is any of":"is",value:s.length<=2?s.map(se).join(", "):`${s.length} kinds`,title:s.map(se).join(", "),onRemove:()=>t({semanticTypes:void 0})}),u&&i.push({id:"approval",label:"Approval",op:"is",value:kt.find(d=>d.value===u)?.label??u,onRemove:()=>t({interactionStatus:null})}),m&&m!=="all"&&i.push({id:"review",label:"Reviewed by",op:"is",value:jt.find(d=>d.value===m)?.label??m,onRemove:()=>t({reviewStatus:void 0})}),(f[0]!==be||f[1]!==je)&&i.push({id:"score",label:"Engagement score",value:As(f,be,je),onRemove:()=>t({engagementRange:void 0})}),{fields:c,chips:i}}function Bt({filters:e,onFiltersChange:t,eventKinds:o=[],searchQuery:s,onSearchChange:a,scope:r,extraFields:f=[],drillChips:m=[],total:u,isListLoading:c=!1,isTotalLoading:i=!1,hasCursorInUrl:d=!1,onGoToLatest:g,onShowNotifications:l,sourceRead:h=!1,filterTrailing:y,filterActions:C,onClearFilters:S}){const x=s.trim().length>0,F=h?{fields:[],chips:[]}:uo(e,t,o),M=[...r?.fields??[],...F.fields,...f],I=[...r?.chips??[],...m,...F.chips],P=I.length>0||x,Q=`${e.sortBy??"date"}-${e.sortOrder??"desc"}`,H=c||i?n.jsx(qn,{className:"h-4 w-20"}):u==null?null:P?`${u.toLocaleString()} ${u===1?"match":"matches"}`:`${u.toLocaleString()} ${u===1?"item":"items"}`;return n.jsxs("div",{className:"w-full space-y-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[!h&&n.jsxs("div",{className:"relative min-w-0 flex-1",children:[n.jsx(Zn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Xn,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:s,onChange:_=>a(_.target.value),className:_e("bg-background pl-9",x&&"pr-9")}),x&&n.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>a(""),className:"absolute right-0.5 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:n.jsx(Jn,{className:"h-3.5 w-3.5"})})]}),!h&&n.jsx(lo,{value:Q,withNotifications:l!=null,onChange:_=>{if(_===Kt.value){l?.();return}const[k,E]=_.split("-");t({sortBy:k,sortOrder:E})}})]}),n.jsx(Ss,{label:"Event filters",fields:M,chips:I,meta:H,actions:C,trailing:n.jsxs(n.Fragment,{children:[y,!c&&d&&g&&n.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 font-normal text-muted-foreground",onClick:g,children:[n.jsx(es,{className:"h-3.5 w-3.5"}),"Back to latest"]})]}),onClearAll:S,hasClearableState:x})]})}function Vt({ownerSlug:e,...t}){const o=to({ownerSlug:e,sourceRead:t.sourceRead,filters:t.filters,onFiltersChange:t.onFiltersChange});return n.jsx(Bt,{...t,scope:o})}const Be=3600*1e3,Ct=24*Be;function St(e){const t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t}function Nt(e){return e.toISOString().split("T")[0]}function Ve(e){return e.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",day:"numeric"})}function mo(e){const o=e[e.length-1].date.getTime()-e[0].date.getTime()>180*Ct,s=new Map;for(const a of e){const r=new Date(a.date);o&&r.setUTCDate(r.getUTCDate()-r.getUTCDay()),s.set(r.getTime(),(s.get(r.getTime())??0)+a.count)}return[...s.entries()].sort(([a],[r])=>a-r).map(([a,r])=>{const f=new Date(a);return{start:f,end:new Date(a+(o?7:1)*Ct),count:r,label:`${f.getUTCMonth()+1}/${f.getUTCDate()}`,tooltip:o?`Week of ${Ve(f)}`:Ve(f)}})}function fo(e){const t=f=>{const m=new Date(f);return m.setMinutes(0,0,0),m.getTime()},o=new Map;for(const f of e)o.set(t(f),(o.get(t(f))??0)+1);const s=Math.min(...o.keys()),a=Math.max(...o.keys()),r=[];for(let f=s;f<=a;f+=Be){const m=new Date(f);r.push({start:m,end:new Date(f+Be),count:o.get(f)??0,label:pt(m,"HH:mm"),tooltip:pt(m,"MMM d, HH:mm")})}return r}function po({entityId:e,organizationId:t,ownerSlug:o,eventTimes:s,selectedRange:a,onSelectRange:r}){const{data:f,isLoading:m,error:u}=is(t,{entityId:e},{slug:o}),c=b.useMemo(()=>(f??[]).map(h=>{const y=St(h.date);return y?{date:y,count:h.count}:null}).filter(h=>h!==null).sort((h,y)=>h.date.getTime()-y.date.getTime()),[f]),i=b.useMemo(()=>{if(c.length===0)return[];if(c.length>1)return mo(c);const[h]=c,y=Nt(h.date),C=(s??[]).map(St).filter(S=>S!==null&&Nt(S)===y);return C.length===h.count?fo(C):[]},[c,s]),d=b.useCallback(h=>{const y=i[h.dataIndex];y&&r&&r(y.start,y.end)},[i,r]),g=b.useCallback(h=>{if(r&&h.startValue!==void 0&&h.endValue!==void 0){const y=new Date(h.startValue),C=new Date(h.endValue);r(y,C)}},[r]),l=b.useMemo(()=>{if(i.length<2)return null;let h;if(a){const[y,C]=a,S=i.filter(x=>x.start<C&&x.end>y);S.length>0&&(h=[[{xAxis:S[0].label},{xAxis:S[S.length-1].label}]])}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:y=>{const C=y[0];return`${i[C.dataIndex]?.tooltip}: ${C.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:i.map(y=>y.label)},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 $s(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:i.map(y=>y.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:h?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:h}:void 0}]}},[i,a]);if(m||u)return n.jsx("div",{className:_e(Mt,"p-4"),children:n.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:m?n.jsx(Ls,{}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})});if(c.length===0)return null;if(!l){const[h]=c;return n.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.count===1?"1 event":`All ${h.count} events`," on"," ",Ve(h.date),"."]})}return n.jsx(ho,{option:l,onClick:d,onDataZoom:g})}function ho({option:e,onClick:t,onDataZoom:o}){const{chartRef:s,setOption:a}=Os({onClick:t,onDataZoom:o});return b.useEffect(()=>{a(e,!0)},[e,a]),n.jsx("div",{"data-testid":"events-timeline",className:_e(Mt,"p-4 relative"),children:n.jsx("div",{ref:s,className:"h-48 w-full"})})}const _t="change";function vo({kinds:e,onFiltersChange:t}){const o=!e?.length,s=e?.length===1&&e[0]===_t,a=r=>_e("h-7 px-2.5 text-xs",r?"bg-muted text-foreground":"text-muted-foreground");return n.jsxs("fieldset",{"aria-label":"Show",className:"m-0 inline-flex min-w-0 items-center rounded-md border border-border p-0.5",children:[n.jsx(W,{type:"button",variant:"ghost",size:"sm",className:a(o),"aria-pressed":o,onClick:()=>t({semanticTypes:void 0}),children:"All"}),n.jsx(W,{type:"button",variant:"ghost",size:"sm",className:a(s),"aria-pressed":s,onClick:()=>t({semanticTypes:[_t]}),children:"Changes"})]})}function yo({organizationId:e,ownerSlug:t,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:a,pinned:r,onShowNotifications:f,emptyState:m,changesShortcut:u=!1}){const{isAuthenticated:c,isReady:i}=rs(),{isMember:d,isLoading:g}=Ft(),l=i&&c&&d,h=i&&(!c||!g&&!d),y=G(),C=ie(),S=cs(),{filters:x,updateFilters:F,clearFilters:M}=Ot({parse:Ce,serialize:Le,filterKeys:$t,replace:!1,merge:Pt}),[I,P]=b.useState(x.searchQuery||""),[Q,H]=b.useState(Oe(x)||s&&(o!=null||!!a?.length)),_=I.trim(),k=_.length>=3?_:void 0,E=Tt(k,1e3),O=b.useRef(!1);b.useEffect(()=>S.history.subscribe(({location:p,action:v})=>{const N=Ce(new URLSearchParams(p.search)).searchQuery??"";!(v.type==="BACK"||v.type==="FORWARD"||v.type==="GO")&&O.current&&(N===(x.searchQuery??"")||N===(k??""))||(O.current=!1,P(N))}),[S.history,k,x.searchQuery]);const j=b.useMemo(()=>ht({...x,...a?.length?{entityTypes:a}:{}}),[x,a]),w=F;b.useEffect(()=>{O.current&&(x.searchQuery||void 0)!==E&&F({searchQuery:E})},[E,F,x.searchQuery]);const Qe=()=>{O.current=!1,P(""),s&&t?y({...De(t,C.search??{}),...o!==void 0&&!C.pathname.startsWith(`/${t}/events/`)?{to:C.pathname}:{}}):M()},ce=Oe(ht(x)),Ie=o===void 0,{data:Ut=[]}=ls(i&&l?e:null),{data:Gt=[]}=ds(h?t:null),ze=l?Ut:Gt,{data:We=[]}=us(l&&e?{organizationId:e}:void 0),le=Vs(),de=j.connectionIds,Ae=(de?.length??0)>0,{data:He=[]}=ms(i&&l?e??"":"",{connectionIds:de??void 0,enabled:!le&&i&&l&&Ae}),Ye=j.feedIds,Ee=(Ye?.length??0)>0,{data:qe=[]}=wt(i&&l?e:null,{feedIds:Ye??void 0,enabled:i&&l&&Ee}),Ze=b.useMemo(()=>le?le.groups.flatMap(p=>p.connections.map(v=>({id:v.id,display_name:v.display_name,connector_name:p.connector_name,connector_key:p.connector_key}))):He,[He,le]),Te=b.useMemo(()=>{const p=new Set(de??[]);return[...new Set([...j.platforms??[],...Ze.filter(v=>p.has(v.id)).map(v=>v.connector_key)])]},[de,Ze,j.platforms]),Fe=b.useMemo(()=>qe.map(p=>({connectorKey:p.connector_key,feedKey:p.feed_key})),[qe]),Qt=b.useMemo(()=>Ae&&Te.length===0||Ee&&Fe.length===0?[]:qs({connectors:ze,entityTypes:We,selectedPlatforms:Te,selectedFeeds:Fe,selectedEntityTypes:j.entityTypes}),[ze,j.entityTypes,Ae,Ee,Te,Fe,We]),R=j.clientIds,ue=(R?.length??0)>0,{data:Xe=[]}=Fs(null,{enabled:i&&l&&ue}),me=b.useMemo(()=>{if(!R)return[];const p=new Set(R);return Rs(Xe).filter(v=>v.clientIds.some(N=>p.has(N)))},[R,Xe]),Je=b.useMemo(()=>{if(!ue||!R)return null;const p=me.map(v=>v.title);return p.length>0?p.join(", "):R.length>1?`${R.length} client registrations`:"Client registration"},[me,R,ue]),fe=me.length===1?me[0]:null,zt=t&&fe?zs(t,fe.clientId):void 0,pe=j.mcpActivityId??null,{data:et=[]}=ws({enabled:i&&l&&ue&&!!pe,clientIds:R??[],limit:100}),tt=b.useMemo(()=>{if(!pe)return null;const p=et.find(N=>N.activityId===pe);if(!p)return"Selected conversation";const v=p.title?.trim();return v||(p.activityKind==="session"?"MCP session":p.clientId)},[pe,et]),Y=j.agentId,q=j.schedule,{data:nt=[]}=Us(Y??void 0),st=b.useMemo(()=>!q||!Y?null:nt.find(v=>v.id===q)?.description?.trim()||"Scheduled task",[Y,q,nt]),{data:Wt}=fs(i&&l?e:null,o),{data:Ht}=ps(h&&!Ie?t:null,o),ot=l?Wt:Ht,we=b.useMemo(()=>{const p=new Map;for(const v of ot||[]){const N=v.automation_name??"__global__";p.has(N)||p.set(N,{automationName:v.automation_name??null,classifiers:[]});const T=p.get(N),L=v.attribute_values||{},$=Object.keys(L);let ve=null;const Z={};for(const[X,U]of Object.entries(L))if(U.parent)for(const[Pe,J]of Object.entries(U.parent))ve=Pe,Z[J]||(Z[J]=[]),Z[J].push(X);const D=T.classifiers.find(X=>X.slug===v.slug);if(D){const X=new Set([...D.values,...$]);D.values=[...X];for(const[U,Pe]of Object.entries(Z)){D.valuesByParentValue[U]||(D.valuesByParentValue[U]=[]);const J=new Set([...D.valuesByParentValue[U],...Pe]);D.valuesByParentValue[U]=[...J]}ve&&(D.parentSlug=ve)}else T.classifiers.push({slug:v.slug,name:v.name,values:$,parentSlug:ve,valuesByParentValue:Z})}for(const v of p.values())v.classifiers.sort((N,T)=>N.parentSlug===null&&T.parentSlug!==null?-1:N.parentSlug!==null&&T.parentSlug===null?1:0);return[...p.values()]},[ot]),Yt=hs(i&&l?e:null,o,j,t),qt=vs(h?t:null,o,j),Zt=h?qt:Yt,{data:B,isLoading:Xt,error:Jt}=Zt,en=b.useMemo(()=>B?.pages.flatMap(p=>p.content.map(v=>v.occurred_at)),[B]),at=B?.pages[0],it=(at?.content.length??0)>0,tn=ys(i&&l?e:null,o,j,t),nn=gs(h?t:null,o,j),Re=h?nn:tn,sn=Re.data?.total??void 0,on=Re.data?.classification_stats,an=Re.isLoading,rn=!!(j.beforeOccurredAt||j.afterOccurredAt),rt=xs(j),ct=B?.pages[B.pages.length-1],V=ct?.content[ct.content.length-1];b.useEffect(()=>{!rt||!V||B?.pages.length===1||x.beforeOccurredAt===V.occurred_at&&x.beforeId===V.id||F({beforeOccurredAt:V.occurred_at,beforeId:V.id},{replace:!0})},[V?.id,rt,F,B?.pages.length,V,x.beforeOccurredAt,x.beforeId]);const cn=b.useCallback(()=>{w({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[w]),ln=(p,v)=>{w({dateRange:[p,v]})},lt=(p,v)=>{const N={...j.classificationFilters||{}};if(v.length>0)N[p]=v;else{delete N[p];for(const T of we)for(const L of T.classifiers)L.parentSlug===p&&delete N[L.slug]}w({classificationFilters:N})},dn=(p,v)=>{const N=j.classificationFilters?.[p]||[];lt(p,N.includes(v)?N.filter(T=>T!==v):[...N,v])},un=p=>lt(p,[]);if(Jt)return n.jsx(bs,{label:"knowledge"});const Me=!i||c&&g||l&&!e||Xt,he={fields:[],chips:[]};for(const p of we)for(const v of p.classifiers){const N=j.classificationFilters?.[v.slug]??[],T=v.parentSlug?j.classificationFilters?.[v.parentSlug]??[]:void 0,L=T?[...new Set(T.flatMap($=>v.valuesByParentValue[$]??[]))]:v.values;L.length>0&&he.fields.push({key:`clf:${v.slug}`,label:v.name,group:p.automationName??"Classifiers",icon:n.jsx(js,{className:"h-4 w-4"}),editor:ke({searchPlaceholder:`Search ${v.name.toLowerCase()}...`,options:L.map($=>({value:$,label:$,count:on?.[v.slug]?.[$]})),selected:N,multiple:!0,onSelect:$=>dn(v.slug,$)})})}for(const[p,v]of Object.entries(j.classificationFilters??{})){if(v.length===0)continue;const N=we.flatMap(T=>T.classifiers).find(T=>T.slug===p);he.chips.push({id:`clf:${p}`,field:`clf:${p}`,label:N?.name??p,op:v.length>1?"is any of":"is",value:v.join(", "),onRemove:()=>un(p)})}const mn=[j.contentIds?.length?ye({id:"contentIds",label:j.contentIds.length>1?"Events":"Event",value:`#${j.contentIds.join(", #")}`,onRemove:()=>w({contentIds:void 0})}):null,tt?ye({id:"mcpActivityId",label:"Conversation",value:tt,onRemove:()=>w({mcpActivityId:void 0})}):null,Je?ye({id:"clientIds",label:"Connected app",value:Je,sourceLink:zt,details:R&&R.length>0?n.jsx(Ys,{ownerSlug:t,clientIds:R,linkedUser:fe?.linkedUser,linkedUserEntitySlug:fe?.linkedUserEntitySlug}):void 0,onRemove:()=>w({clientIds:void 0})}):null,st?ye({id:"schedule",label:"Schedule",value:st,sourceLink:t&&Y&&q?Hs(t,Y,q):void 0,onRemove:()=>w({schedule:void 0,runIds:void 0})}):null,...j.eventCategory?[{id:"event-category",label:"Category",op:"is",value:j.eventCategory,onRemove:()=>w({eventCategory:void 0})}]:[],...j.resourceKind||j.resourceId?[{id:"resource",label:"Resource",op:"is",value:`${j.resourceKind}: ${j.resourceId}`,onRemove:()=>w({resourceKind:void 0,resourceId:void 0})}]:[],...he.chips].filter(p=>p!=null),fn=!!(l&&o&&e),dt=r&&!ce?r:void 0,ut={filterActions:u?n.jsx(vo,{kinds:x.semanticTypes,onFiltersChange:w}):Ie&&l?n.jsx("div",{className:"flex items-center gap-1",children:[["config","Configuration"],["deployment","Applies"]].map(([p,v])=>n.jsx(W,{type:"button",variant:x.eventCategory===p?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs","aria-pressed":x.eventCategory===p,onClick:()=>w({eventCategory:x.eventCategory===p?void 0:p,semanticTypes:x.eventCategory===p?void 0:["change"],resourceKind:void 0,resourceId:void 0}),children:v},p))}):void 0,filterTrailing:fn?n.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":Q,onClick:()=>H(p=>!p),children:[n.jsx(Cs,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Qe,onShowNotifications:f,filters:j,onFiltersChange:w,eventKinds:Qt,searchQuery:I,onSearchChange:p=>{O.current=!0,P(p)},extraFields:he.fields,drillChips:mn,total:sn,isListLoading:Me,isTotalLoading:an,hasCursorInUrl:rn&&it,onGoToLatest:cn},pn=!Me&&!!at&&!it&&!ce,hn=c?l?"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",mt=!!(l&&t);return n.jsx(ks,{children:n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:s?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-2 lg:-mx-6 lg:px-6":void 0,children:s&&t?n.jsx(Vt,{...ut,ownerSlug:t}):n.jsx(Bt,{...ut})}),Q&&l&&o&&e&&n.jsx(po,{entityId:o,organizationId:e,ownerSlug:t||"",eventTimes:en,selectedRange:j.dateRange||void 0,onSelectRange:ln}),dt?.rows,Me?n.jsx(Ms,{}):pn?m??n.jsx(vt,{icon:yt,title:"No activity yet",description:hn,actionLabel:mt?"Add a connector":void 0,onAction:mt&&t?()=>void y({to:"/$owner/connectors/create",params:{owner:t}}):void 0}):n.jsx(Ps,{onFiltersChange:w,organizationId:e,ownerSlug:t,entityId:o,filters:j,showEntityLinks:Ie,foldConsecutiveCalls:!0,groupByConversation:!0,hiddenApprovalRunIds:dt?.hiddenApprovalRunIds,emptyState:n.jsx(vt,{icon:yt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ce?"Clear filters":void 0,onAction:ce?Qe:void 0})})]})})}function go({record:e,ownerSlug:t}){const o=ie(),s=G(),{filters:a,updateFilters:r}=Ot({parse:Ce,serialize:Le,filterKeys:$t,replace:!1,merge:Pt}),f=Oe({...a,platforms:void 0,connectionIds:void 0,feedIds:void 0})||a.sortBy!=null&&a.sortBy!=="date"||a.sortOrder!=null&&a.sortOrder!=="desc",m=()=>{s({...De(t,o.search??{}),...o.pathname.startsWith(`/${t}/events/`)?{}:{to:o.pathname}})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(Vt,{ownerSlug:t,sourceRead:!0,filters:a,onFiltersChange:r,searchQuery:a.searchQuery??"",onSearchChange:u=>r({searchQuery:u}),onClearFilters:m}),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."}),f?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(W,{variant:"outline",size:"sm",onClick:()=>{const u=Le({platforms:a.platforms,connectionIds:a.connectionIds,feedIds:a.feedIds}),c={...De(t,o.search??{}).search,...u};s({to:o.pathname,search:c})},children:"Clear unsupported filters"})]}):n.jsx(Ts,{record:e,orgContext:{slug:t},filters:a})]})}function wo({entity:e,organizationId:t,ownerSlug:o}){const s=e.is_derived?n.jsx(go,{ownerSlug:o,record:{type:e.entity_type,key:e.slug}}):n.jsx(yo,{organizationId:t,ownerSlug:o,entityId:typeof e.id=="number"?e.id:void 0,hideSourceFilter:!0,changesShortcut:!0});return n.jsx(Ks,{organizationId:t,children:e.entity_type==="$member"?n.jsx(Ds,{children:s}):s})}export{yo as E,Ks as M,Kt as N,wo as R,lo as S};
|
|
2
|
+
//# sourceMappingURL=record-activity-BXhvJbd9.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as s,j as c}from"./index-
|
|
2
|
-
//# sourceMappingURL=record-session-
|
|
1
|
+
import{r as s,j as c}from"./index-008wj-Pz.js";function u(){const o=new Map,e=new Set,n=()=>{for(const t of e)t()};return{get:t=>o.get(t),set:t=>{o.get(t.entity.id)!==t&&(o.set(t.entity.id,t),n())},remove:t=>{o.delete(t)&&n()},subscribe:t=>(e.add(t),()=>e.delete(t))}}const r=s.createContext(null);function d({children:o}){const[e]=s.useState(u);return c.jsx(r.Provider,{value:e,children:o})}function f(o){const e=s.useContext(r);s.useLayoutEffect(()=>{e?.set(o)});const n=o.entity.id;s.useEffect(()=>()=>e?.remove(n),[e,n])}const i=()=>()=>{};function S(o){const e=s.useContext(r);return s.useSyncExternalStore(e?.subscribe??i,()=>e?.get(o),()=>e?.get(o))}export{d as R,f as a,S as u};
|
|
2
|
+
//# sourceMappingURL=record-session-D07szzqN.js.map
|