@lobu/runtime-server 24.6.0 → 24.7.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/component.json +1 -1
- package/dist/owletto/dist/assets/_-CZgmjLR9.js +2 -0
- package/dist/owletto/dist/assets/_-Cm5OgtYD.js +3 -0
- package/dist/owletto/dist/assets/_agentId-Cci6NFc1.js +2 -0
- package/dist/owletto/dist/assets/_agentId-GhWTlPO2.js +2 -0
- package/dist/owletto/dist/assets/_automationId-KUlxSTK2.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-Zpy7Hvml.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-CYDRp9UX.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-NNqDdije.js +2 -0
- package/dist/owletto/dist/assets/_eventId-0BSX6VHj.js +2 -0
- package/dist/owletto/dist/assets/_owner-C-CD22NB.js +3 -0
- package/dist/owletto/dist/assets/_shape-CvXp4omb.js +2 -0
- package/dist/owletto/dist/assets/_slug-DgK7zpKA.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-cH54P0zY.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-m0B5j7L9.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-CQZQ0wwC.js → accept-invitation-CX7Egv-p.js} +2 -2
- package/dist/owletto/dist/assets/activity-link-rXNpmppV.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-B0m7_g9q.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-CpUTAjXf.js → agent-client-setup-list-BmD3-_Ox.js} +2 -2
- package/dist/owletto/dist/assets/{agent-connect-pages-Br_ycC0z.js → agent-connect-pages-BtOTCsTU.js} +2 -2
- package/dist/owletto/dist/assets/agent-editor-form-CirqCpcM.js +2 -0
- package/dist/owletto/dist/assets/agent-list-row-SyACVYX7.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-_18OREnx.js → agent-loading-shells-DHvKiEUB.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-Dsc26dyW.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-1DBn7Xc_.js → agent-skill-context-DF5q0Dfr.js} +2 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-Pi5cECga.js +2 -0
- package/dist/owletto/dist/assets/{agent-thread-FyEO-y44.js → agent-thread-B1ZepGZc.js} +4 -4
- package/dist/owletto/dist/assets/agents-D1FHZ0jR.js +2 -0
- package/dist/owletto/dist/assets/app._appId-01I0CJal.js +2 -0
- package/dist/owletto/dist/assets/{assist-composer-Mn9EfX4X.js → assist-composer-BD9msDk3.js} +2 -2
- package/dist/owletto/dist/assets/automation-detail-content-BFv1TglZ.js +2 -0
- package/dist/owletto/dist/assets/automation-row-CmTpAD4r.js +2 -0
- package/dist/owletto/dist/assets/{automation-source-list-Dhucq1sI.js → automation-source-list-D8ZSavQU.js} +2 -2
- package/dist/owletto/dist/assets/automations-D1FHZ0jR.js +2 -0
- package/dist/owletto/dist/assets/{callback-9xSHyA12.js → callback-Ckrxv0eo.js} +2 -2
- package/dist/owletto/dist/assets/{card-g4yxo4Hr.js → card-DT9mSjSp.js} +2 -2
- package/dist/owletto/dist/assets/{change-summary-DeuXQEpb.js → change-summary-CGrKEJ04.js} +2 -2
- package/dist/owletto/dist/assets/{claim-B98IhDra.js → claim-Bzby28tT.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-BD2HBo-_.js → client-activity-scopes-DoIErdUy.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-x_CxeWkP.js → client-rows-BbVQy5Ti.js} +2 -2
- package/dist/owletto/dist/assets/{clients-Cmp0LmOp.js → clients-6aJvabvS.js} +2 -2
- package/dist/owletto/dist/assets/connect-BmDziBzI.js +2 -0
- package/dist/owletto/dist/assets/{connect-menu-CezOH3s7.js → connect-menu-Bs8mxsga.js} +2 -2
- package/dist/owletto/dist/assets/connect._clientId-t5aKu3aa.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-DswMAw8l.js +2 -0
- package/dist/owletto/dist/assets/{connection-B6fM2KHN.js → connection-BOaMa324.js} +2 -2
- package/dist/owletto/dist/assets/connection-feed-detail-BLCjhP-H.js +2 -0
- package/dist/owletto/dist/assets/connector-boxes-BAP_f77M.js +2 -0
- package/dist/owletto/dist/assets/{connector-page-shell-Di6XzkVo.js → connector-page-shell-ClOmVPJr.js} +2 -2
- package/dist/owletto/dist/assets/{connector-provenance-BrnasBW4.js → connector-provenance-wmYu5jwO.js} +2 -2
- package/dist/owletto/dist/assets/{connectors-DnOUxX_U.js → connectors-D5F5rHxX.js} +2 -2
- package/dist/owletto/dist/assets/{consent-Byli4yMs.js → consent-RqHNkmm8.js} +2 -2
- package/dist/owletto/dist/assets/{copy-button-Ddf7lBjZ.js → copy-button-D6zpsZLi.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-BsXtvNoI.js → core.esm-BIE97rfo.js} +3 -3
- package/dist/owletto/dist/assets/create-BPxsKwk7.js +2 -0
- package/dist/owletto/dist/assets/{create-YdAnh3ml.js → create-GT8_yF0R.js} +2 -2
- package/dist/owletto/dist/assets/create-Yx2qBMBy.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-B12yTrmj.js +3 -0
- package/dist/owletto/dist/assets/create._connectorKey-CzXqSkuI.js +2 -0
- package/dist/owletto/dist/assets/custom-guardrail-edits-B9plaLBN.js +2 -0
- package/dist/owletto/dist/assets/{definition-comparison-B5WgZILB.js → definition-comparison-C3k6Wa9B.js} +2 -2
- package/dist/owletto/dist/assets/detail-page-skeleton-I5_7FkKx.js +2 -0
- package/dist/owletto/dist/assets/{device-DdCoCj-Q.js → device-CadaiNF4.js} +2 -2
- package/dist/owletto/dist/assets/device-automation-Dp3faMvp.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-U7Bx05P6.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-DTZqj1HS.js +2 -0
- package/dist/owletto/dist/assets/dynamic-schema-form-DyT_9iVE.js +2 -0
- package/dist/owletto/dist/assets/entity-options-CGTjLlcS.js +2 -0
- package/dist/owletto/dist/assets/entity-page-DHHMmA8V.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-eYbG2FDT.js +2 -0
- package/dist/owletto/dist/assets/{entity-type-page-D0ghgRgq.js → entity-type-page-CjFqxSdL.js} +2 -2
- package/dist/owletto/dist/assets/event-card-BtTUuf2q.js +2 -0
- package/dist/owletto/dist/assets/event-detail-8xHiplt_.js +2 -0
- package/dist/owletto/dist/assets/events-feed-zFnTSE27.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-Dd5R2Etd.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-B5xXnKtV.js → full-page-spinner-CCU4PkRv.js} +2 -2
- package/dist/owletto/dist/assets/home-stream-IVsNEkwp.js +2 -0
- package/dist/owletto/dist/assets/index-2oaMOFKe.js +2 -0
- package/dist/owletto/dist/assets/index-B-Ab8srM.js +7899 -0
- package/dist/owletto/dist/assets/index-B4RZgvvI.js +2 -0
- package/dist/owletto/dist/assets/{index-BDl1_w6U.js → index-B72KYdN1.js} +2 -2
- package/dist/owletto/dist/assets/index-BBZM53p8.js +2 -0
- package/dist/owletto/dist/assets/index-BOb0a5f9.js +2 -0
- package/dist/owletto/dist/assets/{index-BdNR51Ua.js → index-BYFDMIQC.js} +2 -2
- package/dist/owletto/dist/assets/index-BwnFQcMe.js +2 -0
- package/dist/owletto/dist/assets/index-CvYsWYlF.js +2 -0
- package/dist/owletto/dist/assets/{index-CkiyxW4w.js → index-DIXIvtnM.js} +2 -2
- package/dist/owletto/dist/assets/index-DLwokXHW.js +2 -0
- package/dist/owletto/dist/assets/index-_nlPHus1.js +2 -0
- package/dist/owletto/dist/assets/index-cwOgj4-i.js +2 -0
- package/dist/owletto/dist/assets/{index-TkPy_P_u.js → index-pmr1WUoG.js} +2 -2
- package/dist/owletto/dist/assets/index-pp4qmhkA.js +2 -0
- package/dist/owletto/dist/assets/index-tTbno-PX.css +1 -0
- package/dist/owletto/dist/assets/{json-diff-DtZtra_g.js → json-diff-B-1Swv_y.js} +2 -2
- package/dist/owletto/dist/assets/list-skeleton-BAqT0vxo.js +2 -0
- package/dist/owletto/dist/assets/{login-TWR0vF4_.js → login-D5bIjMtf.js} +2 -2
- package/dist/owletto/dist/assets/{logout-BA5kojS0.js → logout-JYZvxz8v.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-BQiRAqtx.js → member-scope-gate-Lj9m4RL2.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-rAKfVdQ_.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-B2cjCn0V.js → model-selector-onvGA9Ww.js} +2 -2
- package/dist/owletto/dist/assets/{new-Dc5Bbotb.js → new-B-Jd-vBl.js} +2 -2
- package/dist/owletto/dist/assets/new-BmehH1uR.js +2 -0
- package/dist/owletto/dist/assets/new-KDi15LWZ.js +2 -0
- package/dist/owletto/dist/assets/{organization-B9U1L-56.js → organization-B9bh20Xo.js} +2 -2
- package/dist/owletto/dist/assets/peek-pane-content-Bqus80Mq.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-BP3xHM2d.js → pending-seed-CoFPQ835.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-BED-DO9C.js → proposal-review-shell-CnACXCUg.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-Dlh-eWz0.js +2 -0
- package/dist/owletto/dist/assets/record-activity-6CfR95Ul.js +2 -0
- package/dist/owletto/dist/assets/{record-session-DOFgdd43.js → record-session-Bpx4_LGk.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-CHPS-1vD.js → renderer-CgaQKMoG.js} +26 -26
- package/dist/owletto/dist/assets/{reset-password-BmNM-apc.js → reset-password-C-4Jnuqk.js} +2 -2
- package/dist/owletto/dist/assets/run-initiator-BvruBM5H.js +2 -0
- package/dist/owletto/dist/assets/{runs-BntGAKQG.js → runs-BMzp7j7j.js} +2 -2
- package/dist/owletto/dist/assets/runs-list-DVhrTr3v.js +2 -0
- package/dist/owletto/dist/assets/{schema-type-editor-panel-v3nR2Oa2.js → schema-type-editor-panel-Bdeumkux.js} +2 -2
- package/dist/owletto/dist/assets/{schema-value-BFb7jCBo.js → schema-value-BUgC0Ro8.js} +2 -2
- package/dist/owletto/dist/assets/{settings-DubSpJfg.js → settings-DYYvrrZ4.js} +2 -2
- package/dist/owletto/dist/assets/skill-route-key-sF006xiz.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CBV9tsR3.js +2 -0
- package/dist/owletto/dist/assets/status-variants-DT61YfsU.js +2 -0
- package/dist/owletto/dist/assets/{table-DALHuXPE.js → table-B6yimlsZ.js} +2 -2
- package/dist/owletto/dist/assets/{use-automations-D9hKpufo.js → use-automations-II_YJWtN.js} +2 -2
- package/dist/owletto/dist/assets/{use-login-redirect-ciwfc-7A.js → use-login-redirect-BqtEilid.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-CJGCatFS.js → use-mention-search-Bxlpd6Dp.js} +3 -3
- package/dist/owletto/dist/assets/view-param-filters-DYlqBocg.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-CZ1fvAks.js → views-access-required-BVtMfgLh.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +84 -5
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-DT3E3BmS.js +0 -3
- package/dist/owletto/dist/assets/_-c1xy7bLu.js +0 -2
- package/dist/owletto/dist/assets/_agentId-CTfoi0-7.js +0 -2
- package/dist/owletto/dist/assets/_agentId-DV8utajn.js +0 -2
- package/dist/owletto/dist/assets/_automationId-DvP3qyYL.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CL5SivCn.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-tnMwC67b.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-DXN_8m88.js +0 -2
- package/dist/owletto/dist/assets/_eventId-SdpFT7jB.js +0 -2
- package/dist/owletto/dist/assets/_name-CM1AMywz.js +0 -2
- package/dist/owletto/dist/assets/_owner-CaGsXXBW.js +0 -3
- package/dist/owletto/dist/assets/_shape-DGAkETDp.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-Dd4ZHPY8.js +0 -2
- package/dist/owletto/dist/assets/_slug-cRvJQtNo.js +0 -2
- package/dist/owletto/dist/assets/_view-B5I7mmkl.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-Bwn0dyLo.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-YjSYD0wc.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-CZykJXQp.js +0 -2
- package/dist/owletto/dist/assets/agent-card-controls-DuQJhtqp.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-BXQBFHSv.js +0 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-CN7vpC0X.js +0 -2
- package/dist/owletto/dist/assets/agent-list-row-BnP6r4pm.js +0 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-DSjidWHL.js +0 -2
- package/dist/owletto/dist/assets/agent-skills-route-d5jh3oBR.js +0 -2
- package/dist/owletto/dist/assets/agent-tab-intro-DKrC3SQt.js +0 -2
- package/dist/owletto/dist/assets/agents-kXojozTU.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-CDpJmUVN.js +0 -2
- package/dist/owletto/dist/assets/app._appId-DwNeXRJp.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-Bs3vwAPd.js +0 -2
- package/dist/owletto/dist/assets/automation-row-B5Q1B10y.js +0 -2
- package/dist/owletto/dist/assets/automations-kXojozTU.js +0 -2
- package/dist/owletto/dist/assets/connect-zUot_0kG.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-nsGxe6yO.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-DnclRRXk.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-CDB8atTX.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-DBNP2mZo.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-Ckq-qEbD.js +0 -2
- package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-BXsJqieG.js +0 -2
- package/dist/owletto/dist/assets/connector-boxes-CbqSFeVm.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-dQnZARCD.js +0 -2
- package/dist/owletto/dist/assets/create-B34eskZ_.js +0 -2
- package/dist/owletto/dist/assets/create-DLB9sXgU.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-C9PMX7N8.js +0 -3
- package/dist/owletto/dist/assets/create._connectorKey-Bz4OYRiC.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-B06J7Af1.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-Bh9S4bFp.js +0 -2
- package/dist/owletto/dist/assets/dynamic-schema-form-qWSRtOAv.js +0 -2
- package/dist/owletto/dist/assets/entity-options-BkU_En_f.js +0 -2
- package/dist/owletto/dist/assets/entity-page-BPFDHY8q.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-DxgbjLMt.js +0 -2
- package/dist/owletto/dist/assets/event-card-CjA_dLzq.js +0 -2
- package/dist/owletto/dist/assets/event-detail-CmC-DVrK.js +0 -2
- package/dist/owletto/dist/assets/events-feed-CGzA1w3R.js +0 -2
- package/dist/owletto/dist/assets/filter-bar-CQ_oE7a9.js +0 -2
- package/dist/owletto/dist/assets/guardrails-DkXatmea.js +0 -2
- package/dist/owletto/dist/assets/identity-BwJy3ixB.js +0 -2
- package/dist/owletto/dist/assets/index-35ehGReZ.js +0 -2
- package/dist/owletto/dist/assets/index-B9hYiwBw.js +0 -2
- package/dist/owletto/dist/assets/index-BjcZVe7n.js +0 -7899
- package/dist/owletto/dist/assets/index-BqAVebvY.js +0 -2
- package/dist/owletto/dist/assets/index-BvK1fS1J.js +0 -2
- package/dist/owletto/dist/assets/index-CNEpTkgw.css +0 -1
- package/dist/owletto/dist/assets/index-CRc73k1t.js +0 -2
- package/dist/owletto/dist/assets/index-CYGaSD3y.js +0 -2
- package/dist/owletto/dist/assets/index-CfZGe-zn.js +0 -2
- package/dist/owletto/dist/assets/index-CzLDNB2E.js +0 -2
- package/dist/owletto/dist/assets/index-D-o5iOVd.js +0 -2
- package/dist/owletto/dist/assets/index-DjYVV1Ml.js +0 -2
- package/dist/owletto/dist/assets/index-VyAX-asP.js +0 -2
- package/dist/owletto/dist/assets/list-skeleton-CIHWCi2a.js +0 -2
- package/dist/owletto/dist/assets/manage-gear-C-0BAMbC.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-Ba32-vVL.js +0 -74
- package/dist/owletto/dist/assets/model-C2q7WDcS.js +0 -2
- package/dist/owletto/dist/assets/models-CZkH5gtj.js +0 -2
- package/dist/owletto/dist/assets/nav-pill-Bam6s3jj.js +0 -2
- package/dist/owletto/dist/assets/new-BJst6K0b.js +0 -2
- package/dist/owletto/dist/assets/new-DgbivfDe.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-Cq8P38s3.js +0 -2
- package/dist/owletto/dist/assets/permissions-BVlbeY4u.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-Diq15_QW.js +0 -2
- package/dist/owletto/dist/assets/record-activity-CTLwq8s1.js +0 -2
- package/dist/owletto/dist/assets/run-activity-link-Dh1YyCfk.js +0 -2
- package/dist/owletto/dist/assets/run-initiator-CCxNv0rK.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-BwTVaRsE.js +0 -2
- package/dist/owletto/dist/assets/runs-table-CYS1jDdL.js +0 -2
- package/dist/owletto/dist/assets/settings-DBgT60nY.js +0 -2
- package/dist/owletto/dist/assets/skills-DDoeRGhJ.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-m8gECt82.js +0 -2
- package/dist/owletto/dist/assets/status-dot-BnQPFrcU.js +0 -2
- package/dist/owletto/dist/assets/use-scroll-sentinel-BWCrmNIB.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-CDvwie_f.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a6 as ge,r as j,bJ as Ie,bK as Be,bL as Ke,bM as Me,bN as be,j as e,bO as J,B as C,bP as Ve,b2 as He,bQ as Ue,bR as Ge,bS as Je,bT as Ye,bU as Ze,bV as Xe,bW as es,bX as ve,bt as ie,bY as ss,bZ as ts,b_ as ns,b$ as me,c0 as is,c1 as as,c as os,a1 as Le,v as rs,c2 as cs,c3 as ne,c4 as ls,H as je,I as Ne,c5 as ds,c6 as us,c7 as ms,ab as Ce,bc as hs,S as z,J as le,c8 as ps,c9 as _e,ca as ke,cb as gs,K as xs,cc as Se,w as fs,cd as ys,ak as bs,al as vs,ce as js,i as Ns,cf as Cs}from"./index-BjcZVe7n.js";import{P as he,a as We,A as _s}from"./agent-permissions-matrix-DSjidWHL.js";import{C as we,a as Ae,b as Oe,c as ze}from"./card-g4yxo4Hr.js";const Pe=["auto","approval","deny"],ks={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."},De={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 Ss(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 ws(s,n){return s.operation_key?n.connector_operations.find(o=>o.operation_key===s.operation_key)?.name||s.operation_key:s.operation_category?De[s.operation_category]:"All actions"}function ue(s,n){return`${Ss(s,n)} · ${ws(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 As({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 Os({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,Y]=j.useState(P),[I,L]=j.useState(!1),[k,W]=j.useState(""),[A,V]=j.useState("all"),[Z,E]=j.useState("approval"),[g,S]=j.useState(!1),[D,T]=j.useState(null),[H,X]=j.useState(o?String(o):""),[U,Q]=j.useState(""),R=l?.connections?.some(t=>String(t.id)===H)?H:"",w=Me(s,R?Number(R):void 0,U,u||void 0);async function G(t,f){S(!0),T(null);try{if(u){const d={resource_class:"connector_action",...pe(t)};f?await Je(s,u,{...d,effects:{execute:f}}):await Ye(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(J,{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),V("all"),W(""),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(We,{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 G(d,ce)}),K&&e.jsx(As,{label:"Remove",disabled:g,ariaLabel:`Remove rule: ${ue(d,l)}`,onRemove:()=>G(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:Y,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)&&G(Qe,Z).then(f=>{f&&(L(!1),Y(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),V("all"),W("")},disabled:g,children:e.jsx(Te,{catalog:l})}),e.jsxs(F,{label:"Actions",value:A,onChange:V,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:De[t]},t))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),A==="specific"&&e.jsxs(F,{label:"Specific action",value:k,onChange:W,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(Ve,{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(He,{icon:Ue,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})]}),D&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}),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:U,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:U?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ge[w.data.effect]})," ·"," ",ks[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(t=>`#${t}`).join(", ")}`:""]}):"":""})]})]})}const zs=[{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."}],Ps=[{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 $s(s){return s.agent.find(xe)}function Es(s,n){return{...s,agent:[...s.agent.filter(o=>!xe(o)),n]}}function Ts(s){return{...s,agent:s.agent.filter(n=>!xe(n))}}function Rs({label:s,description:n,action:o,value:r,pending:h,onChange:c}){return e.jsxs(We,{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(Rs,{action:c,label:b,description:y,value:o[c]??me.entity_schema[c]??"deny",pending:r,onChange:l=>h(c,l)},c))})]})}function Fs({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&&Es(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&&Ts(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(J,{label:"schema policy",variant:"cards",cards:1});if(r.isError||!r.data)return e.jsx(ns,{label:"schema policy"});const b=$s(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:zs,effects:y,pending:l,onChange:u}),e.jsx(Re,{title:"Relationship types",actions:Ps,effects:y,pending:l,onChange:u})]})]})}function Fe(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Is(s,n,o){const r=s.split("/");return r[1]===n?(r[1]=o,r.join("/")||"/"):`/${o}`}function Ls({section:s}){return s==="policies"?e.jsx(J,{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(J,{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(J,{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 Ws({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,Y]=_.field("name"),[I,L]=_.field("slug"),[k,W]=_.field("visibility"),[A,V]=ne(P,!!i),[Z,E]=ne(P,!1),[g,S]=ne(P,null),[D,T]=j.useState(!1),[H,X]=j.useState(!1),[U,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(Ls,{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(Os,{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(_s,{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(Fs,{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}W(a),E(!1)},G=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=Is(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=D||H;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=>{Y(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=>{V(!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:()=>{W("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:G,disabled:v||!_.canSubmit,children:[D?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,D?"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:U?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"destructive",size:"sm",onClick:q,disabled:v,children:[H?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 Bs(){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(bs,{className:"pt-2.5 pb-8",children:e.jsxs(vs,{className:Ns("flex flex-1 flex-col gap-6",Cs(r)),children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(js,{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(Ws,{owner:s,...n,section:r})]})})}export{Bs as component};
|
|
2
|
-
//# sourceMappingURL=organization-
|
|
1
|
+
import{a6 as ge,r as j,bP as Ie,bQ as Be,bR as Ke,bS as Me,bT as be,j as e,bU as Y,B as C,bV as Ve,b2 as He,bW as Ue,bX as Ge,bY as Ye,bZ as Je,b_ as Ze,b$ as Xe,c0 as es,c1 as ve,bB as ie,c2 as ss,c3 as ts,c4 as ns,c5 as me,c6 as is,c7 as as,c as os,a1 as Le,v as rs,c8 as cs,c9 as ne,ca as ls,H as je,I as Ne,cb as ds,cc as us,cd as ms,ab as Ce,bg as hs,S as O,J as le,ce as ps,cf as _e,cg as ke,ch as gs,K as xs,ci as Se,w as fs,cj as ys,ak as bs,al as vs,ck as js,i as Ns,cl as Cs}from"./index-B-Ab8srM.js";import{P as he,a as We,A as _s}from"./agent-permissions-matrix-Dsc26dyW.js";import{C as we,a as Ae,b as ze,c as Oe}from"./card-DT9mSjSp.js";const Pe=["auto","approval","deny"],ks={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."},De={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 Ss(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 ws(s,n){return s.operation_key?n.connector_operations.find(o=>o.operation_key===s.operation_key)?.name||s.operation_key:s.operation_category?De[s.operation_category]:"All actions"}function ue(s,n){return`${Ss(s,n)} · ${ws(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 As({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 zs({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,W]=j.useState(""),[A,V]=j.useState("all"),[Z,E]=j.useState("approval"),[g,S]=j.useState(!1),[D,T]=j.useState(null),[H,X]=j.useState(o?String(o):""),[U,Q]=j.useState(""),R=l?.connections?.some(t=>String(t.id)===H)?H:"",w=Me(s,R?Number(R):void 0,U,u||void 0);async function G(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,z=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"?z.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),V("all"),W(""),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(We,{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 G(d,ce)}),K&&e.jsx(As,{label:"Remove",disabled:g,ariaLabel:`Remove rule: ${ue(d,l)}`,onRemove:()=>G(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)&&G(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),V("all"),W("")},disabled:g,children:e.jsx(Te,{catalog:l})}),e.jsxs(F,{label:"Actions",value:A,onChange:V,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:De[t]},t))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),A==="specific"&&e.jsxs(F,{label:"Specific action",value:k,onChange:W,disabled:g,children:[e.jsx("option",{value:"",children:"Choose action"}),z.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(Ve,{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(He,{icon:Ue,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})]}),D&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}),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:U,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:U?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ge[w.data.effect]})," ·"," ",ks[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(t=>`#${t}`).join(", ")}`:""]}):"":""})]})]})}const Os=[{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."}],Ps=[{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 $s(s){return s.agent.find(xe)}function Es(s,n){return{...s,agent:[...s.agent.filter(o=>!xe(o)),n]}}function Ts(s){return{...s,agent:s.agent.filter(n=>!xe(n))}}function Rs({label:s,description:n,action:o,value:r,pending:h,onChange:c}){return e.jsxs(We,{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(Rs,{action:c,label:b,description:y,value:o[c]??me.entity_schema[c]??"deny",pending:r,onChange:l=>h(c,l)},c))})]})}function Fs({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&&Es(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&&Ts(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=$s(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:Os,effects:y,pending:l,onChange:u}),e.jsx(Re,{title:"Relationship types",actions:Ps,effects:y,pending:l,onChange:u})]})]})}function Fe(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Is(s,n,o){const r=s.split("/");return r[1]===n?(r[1]=o,r.join("/")||"/"):`/${o}`}function Ls({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(O,{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(O,{className:"h-4 w-32 rounded-none"})})]},n)),e.jsx(O,{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(O,{className:"mt-0.5 h-4 w-4 shrink-0 rounded-none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(O,{className:"h-4 w-16 rounded-none"}),e.jsx(O,{className:"h-3 w-full rounded-none"}),e.jsx(O,{className:"h-3 w-2/3 rounded-none"})]})]},n))})]}),e.jsxs("div",{"aria-hidden":"true",className:"flex justify-end gap-2",children:[e.jsx(O,{className:"h-9 w-20 rounded-none"}),e.jsx(O,{className:"h-9 w-28 rounded-none"})]})]})}function Ws({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,W]=_.field("visibility"),[A,V]=ne(P,!!i),[Z,E]=ne(P,!1),[g,S]=ne(P,null),[D,T]=j.useState(!1),[H,X]=j.useState(!1),[U,Q]=ne(P,!1);if(ls(l)&&y===void 0)return e.jsxs(we,{role:"alert",children:[e.jsx(Ae,{children:e.jsx(ze,{children:"Couldn't load organizations"})}),e.jsx(Oe,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please try again in a moment."})})]});if(y===void 0)return e.jsx(Ls,{section:n});if(!i)return e.jsxs(we,{children:[e.jsx(Ae,{children:e.jsx(ze,{children:"Organization not found"})}),e.jsx(Oe,{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(zs,{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(_s,{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(Fs,{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}W(a),E(!1)},G=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 z=await le.update({organizationId:i.id,data:{name:a,slug:p}});if(z.error){S(z.error.message||"Failed to update organization");return}x=z.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 z=_e(),se=ke();if(z===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=Is(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=D||H;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=>{V(!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:()=>{W("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:G,disabled:v||!_.canSubmit,children:[D?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,D?"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:U?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"destructive",size:"sm",onClick:q,disabled:v,children:[H?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 Bs(){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(bs,{className:"pt-2.5 pb-8",children:e.jsxs(vs,{className:Ns("flex flex-1 flex-col gap-6",Cs(r)),children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(js,{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(Ws,{owner:s,...n,section:r})]})})}export{Bs as component};
|
|
2
|
+
//# sourceMappingURL=organization-B9bh20Xo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,dB as q,jq as A,jr as H,js as D,jt as V,ju as U,r as f,jv as G,u as T,aB as W,aH as Q,S as b,hW as Y,iW as Z,B as N,jw as J,jx as _,jy as X,d7 as ee,gb as te,o as C,aq as z,cu as B,ab as S,ed as se,v as ne,l as re,fH as ie,w as oe,L as R,jz as ae,fp as ce,fK as de,fD as le,jA as ue,fS as E,iq as me,az as pe,jB as xe,at as he,k as fe,jC as ye,cT as ge,e5 as je,cU as ve,p as Ne,eq as we,jD as be,ec as ke,er as Ae,ex as Ce,a0 as Se,jE as Ie,jF as Pe}from"./index-B-Ab8srM.js";import{u as Le,A as _e}from"./automation-detail-content-BFv1TglZ.js";import{A as Te}from"./agent-loading-shells-DHvKiEUB.js";import{s as $e,h as Re,R as Ee,A as Oe}from"./agent-thread-B1ZepGZc.js";import{C as De,b as ze,A as Be}from"./connection-feed-detail-BLCjhP-H.js";import{O as Fe}from"./connect-menu-Bs8mxsga.js";import{S as Me}from"./source-record-panels-CBV9tsR3.js";import{E as $}from"./events-feed-zFnTSE27.js";import{S as Ke}from"./schema-type-editor-panel-Bdeumkux.js";import{c as qe,s as He,k as Ve}from"./renderer-CgaQKMoG.js";import{E as Ue}from"./event-detail-8xHiplt_.js";import{V as Ge,R as We}from"./views-access-required-BVtMfgLh.js";import{R as Qe,b as Ye}from"./event-card-BtTUuf2q.js";import{V as Ze,a as Je}from"./view-param-filters-DYlqBocg.js";import{S as Xe,g as et}from"./status-variants-DT61YfsU.js";import{b as tt}from"./use-automations-II_YJWtN.js";import"./home-stream-IVsNEkwp.js";import"./list-skeleton-BAqT0vxo.js";import"./clients-6aJvabvS.js";import"./client-activity-scopes-DoIErdUy.js";import"./client-rows-BbVQy5Ti.js";import"./create-automation-form-B12yTrmj.js";import"./entity-options-CGTjLlcS.js";import"./device-automation-Dp3faMvp.js";import"./model-selector-onvGA9Ww.js";import"./skill-editor-D_W3QlRz.js";import"./json-diff-B-1Swv_y.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-Bxlpd6Dp.js";import"./automation-source-list-D8ZSavQU.js";import"./proposal-review-shell-CnACXCUg.js";import"./runs-BMzp7j7j.js";import"./definition-comparison-C3k6Wa9B.js";import"./schema-value-BUgC0Ro8.js";import"./app-bridge-C4nPtae3.js";import"./pending-seed-CoFPQ835.js";import"./runs-list-DVhrTr3v.js";import"./run-initiator-BvruBM5H.js";import"./feed-event-kinds-BYuZCoU4.js";import"./entity-type-page-CjFqxSdL.js";import"./change-summary-CGrKEJ04.js";import"./card-DT9mSjSp.js";import"./table-B6yimlsZ.js";import"./dynamic-schema-form-DyT_9iVE.js";import"./record-session-Bpx4_LGk.js";import"./copy-button-D6zpsZLi.js";import"./agent-list-row-SyACVYX7.js";import"./automation-row-CmTpAD4r.js";import"./filter-editors-Dd5R2Etd.js";function st(t){if(!t||typeof t!="object")return[];const s=t.properties;if(!s)return[];const r=Array.isArray(t.required)?new Set(t.required.map(String)):new Set;return Object.entries(s).map(([n,i])=>({name:n,type:String(i.type??"any"),required:r.has(n),description:typeof i.description=="string"?i.description:void 0}))}function nt({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 I({item:t,hideHeading:s=!1}){const r=t.schemaSections;return r?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(q,{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}),r.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:r.description}):null]})]}),r.sections.map(n=>{const i=st(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(nt,{fields:i})]},n.title)})]}):null}function rt({actions:t}){const s=Object.entries(t).map(([r,n])=>{const i=n;return{id:r,name:i.name??r,description:i.description,action:i}});return e.jsx(A,{entries:s,label:"actions",renderDetail:({name:r,action:n})=>e.jsx(I,{hideHeading:!0,item:{href:"",title:r,schemaSections:D(n)}})})}function it({feeds:t}){const s=Object.entries(t).map(([r,n])=>{const i=n;return{id:r,name:i.name??r,description:i.description,feed:i}});return e.jsx(A,{entries:s,label:"feed types",renderDetail:({name:r,feed:n})=>e.jsx(I,{hideHeading:!0,item:{href:"",title:r,schemaSections:H(n)}})})}function ot(t){const s=[];return t.forEach((r,n)=>{s.push({id:`sep:${r.runId}`,role:"system",parts:[{type:"text",text:at(r,n)}],createdAt:r.completedAt?new Date(r.completedAt).getTime():void 0});for(const i of r.messages)s.push({...i,id:`r${r.runId}:${i.id}`})}),s}function at(t,s){const r=(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`:"",i=t.completedAt?new Date(t.completedAt).toLocaleString():null;return i?`Run ${s+1} · ${r}${n} · ${i}`:`Run ${s+1} · ${r}${n}`}const F=Symbol("trusted-automation-interaction");function ct(t){return Object.defineProperty(t,F,{value:!0}),t}function dt(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 lt=new Set(["automation-approval-batch"]);function ut(t){return new Promise(s=>{t({onSettled:(r,n)=>s(!!n)})})}function mt(){const t=V(),s=U();return f.useMemo(()=>({toolNames:lt,resolve:(r,n)=>{if(!n||typeof n!="object"||n[F]!==!0)return null;const i=n;if(r==="automation-approval-batch"){const o=typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0?i.runId:null,c=typeof i.count=="number"&&Number.isSafeInteger(i.count)&&i.count>1?i.count:null,a=Array.isArray(i.runIds)?i.runIds.filter(d=>typeof d=="number"&&Number.isSafeInteger(d)&&d>0):[];return o===null||c===null||a.length!==c||new Set(a).size!==c?null:{view:dt(c),handlers:{manage_operations:d=>d.action!=="approve"&&d.action!=="reject"?Promise.resolve(!0):ut(p=>d.action==="approve"?t.mutate({run_id:o,run_ids:a},p):s.mutate({run_id:o,run_ids:a},p))}}}return null}}),[t,s])}const pt=/(?:^|\n)Run this Automation now/;function xt(t){return t.role==="user"&&t.parts.some(s=>s.type==="text"&&pt.test(s.text))}function ht(t){return`history-interaction:${t.runId}:${t.eventId??"error"}`}function ft({agentId:t,automationId:s,ownerSlug:r,runId:n}){const{data:i,isLoading:o}=G(t,s,{orgSlug:r,...n!=null?{runId:n}:{}}),c=mt(),a=T(),d=f.useCallback(l=>{a?.open({href:`/${r}/automations/${s}?view=activity&run_id=${l}`,title:`Automation run #${l}`,runId:l})},[a,r,s]),p=f.useMemo(()=>{const l=i?.runs??[],j=(n!=null?l.filter(m=>m.runId===n):l).slice().reverse();return ot(j.map(m=>{const g=m.messages.map(u=>$e(u,{showToolCalls:!0})).filter(u=>u!==null&&!xt(u));m.task?.trim()&&g.unshift({id:"task",role:"user",parts:[{type:"text",text:m.task.trim()}]});const v=m.actions??[],h=v.filter(u=>u.status==="pending");if(h.length>1){const u=h.map(x=>x.runId).sort((x,k)=>x-k);g.push({id:"approval-batch",role:"assistant",parts:[{type:"tool-call",toolCallId:`approval-batch-${m.runId}`,toolName:"automation-approval-batch",args:ct({runId:m.runId,count:h.length,runIds:u})}]})}for(const u of v){const x=Re([u],{workspaceSlug:r,agentId:t,webOrigin:typeof window>"u"?null:window.location.origin});x&&g.push({...x,id:ht(u)})}return{runId:m.runId,completedAt:m.completedAt,status:m.status,pendingActionCount:m.pendingActionCount,autoAppliedCount:m.autoAppliedCount,messages:g}}))},[t,i,r,n]);return o?e.jsx(Te,{readOnly:!0}):p.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(Ee,{messages:p,workspaceSlug:r,children:e.jsx(Oe,{readOnly:!0,readerPositionMode:"runs",interactionExtension:c,onRunSelect:n==null&&a?d:void 0})})})}function yt({panel:t}){const s=W(t.organizationId),r=t.section==="connections"||!!t.connectionId,n=Q(t.organizationId,{connectorKey:t.connectorKey,connectionIds:t.connectionId?[t.connectionId]:void 0,enabled:r}),i=s.data?.find(c=>c.key===t.connectorKey),o=n.data?.find(c=>c.id===t.connectionId&&c.connector_key===t.connectorKey);return s.isLoading||r&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(b,{className:"h-28 w-full"})}):s.isError||r&&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||!i&&!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==="connections"?e.jsx(Y,{connections:n.data??[],connector:i,connectorKey:t.connectorKey,ownerSlug:t.ownerSlug}):o?e.jsx(vt,{connection:o,connector:i,panel:t}):i?t.section==="oauth-apps"?e.jsx(Fe,{connector:i,organizationId:t.organizationId,newApp:!!t.newApp}):t.section==="feeds"?e.jsx(gt,{connector:i}):i.installed===!1?e.jsx(jt,{connector:i,ownerSlug:t.ownerSlug}):e.jsx(wt,{connector:i,ownerSlug:t.ownerSlug}):null},`${t.connectorKey}:${t.connectionId??"connector"}:${t.section}`)}function gt({connector:t}){return e.jsx(it,{feeds:t.feeds_schema??{}})}function jt({connector:t,ownerSlug:s}){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(_,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(rt,{actions:t.actions_schema??{}})]})}function vt({connection:t,connector:s,panel:r}){const[n,i]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:r.section==="feeds"?e.jsx(Nt,{connection:t,connector:s,ownerSlug:r.ownerSlug}):e.jsx(Z,{connection:t,ownerSlug:r.ownerSlug,inPeek:!0,onReviewPermissions:s?()=>i(!0):void 0})}),n&&s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(J,{connection:t,connectorDef:s})]})]})}function Nt({connection:t,connector:s,ownerSlug:r}){const{data:n=[],isLoading:i,isError:o}=ee(t.id),[c,a]=f.useState(!1),d=t.facets?.chat??!1;if(i)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 p=n.map(l=>({id:String(l.id),name:l.display_name||l.feed_key,status:te(l)??(l.operations.includes("sync")?"Sync enabled":"Live access"),feed:l}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:c,children:e.jsx(A,{entries:p,label:d?"channels":"feeds",action:Object.keys(s?.feeds_schema??{}).length>0?e.jsx(N,{size:"sm",variant:"outline",onClick:()=>a(!0),children:d?"Add channel":"Add feed"}):void 0,renderDetail:({feed:l})=>l.store==="channel_messages"?e.jsx(De,{feed:l,hideHeader:!0}):e.jsx(ze,{feed:l,connectorDef:s,ownerSlug:r})})}),c&&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(Be,{organizationId:t.organization_id,connections:[t],connectorDefinitions:[s],onClose:()=>a(!1)})]})]})}function wt({connector:t,ownerSlug:s}){const{data:r=[],isLoading:n,isError:i}=X(t.key);if(n)return e.jsx(b,{className:"h-28 w-full"});if(i)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const o=t.actions_schema??{},c=r.map(a=>({id:a.operation_key,name:a.name??a.operation_key,description:a.description,operation:a}));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(_,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(A,{entries:c,label:"actions",renderControl:()=>e.jsx(_,{ownerSlug:s,connectorKey:t.key}),renderDetail:({operation:a,name:d})=>o[a.operation_key]?e.jsx(I,{hideHeading:!0,item:{href:"",title:d,schemaSections:D(o[a.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function bt({owner:t,path:s}){const{data:r,isLoading:n}=C(t,{slug:t}),i=r?.workspace,o=i?.type==="organization"?i.id:null,c=o?{slug:t}:void 0,{data:a,isLoading:d}=z(`/${t}/${B(s)}`,c),p=a?.entity,l=p?.id;return n||d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(S,{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."}):p?.is_derived?e.jsx(Me,{record:{type:p.entity_type,key:p.slug},orgContext:c}):e.jsx("div",{className:"px-4 py-4",children:e.jsx($,{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 kt(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 At({owner:t,typeSlug:s,view:r}){const{data:n,isLoading:i}=C(t,{slug:t}),o=n?.workspace,c=o?.type==="organization"?o.id:null,{isAdmin:a}=se(c??void 0),{orgContext:d}=ne(),{data:p,isSuccess:l}=re(d),y=(p??[]).find(w=>w.slug===s),j=l&&!y,m=`/${t}/${ie(s)}`,{pathname:g}=oe(),v=g===m||g===`${m}/`||g.startsWith(`${m}/-/`),h=f.useMemo(()=>qe(y?.metadata_schema),[y?.metadata_schema]),u=T(),x=u?.close;f.useEffect(()=>{j&&x?.()},[j,x]);const k=f.useMemo(()=>({entityTypes:[s],sortBy:"date",sortOrder:"desc"}),[s]);if(i)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(S,{className:"mr-2"})," Loading…"]});if(j)return e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This entity type no longer exists."});if(!c)return e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."});const K=y?.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:[v?null:e.jsx(N,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs(R,{...ce(t,s),children:[e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5"}),"Browse records"]})}),y&&!v&&!de(y)&&y.entity_count!==0?e.jsx(N,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs(R,{to:"/$owner/$entityType/-/$shape",params:{owner:t,entityType:s,shape:"graph"},search:ue(E(t,s)),children:[e.jsx(le,{className:"mr-1.5 h-3.5 w-3.5"}),"Graph"]})}):null,r!=="activity"&&u?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:()=>u.open({href:E(t,s,"activity"),title:`${K} activity`}),children:[e.jsx(me,{className:"h-3.5 w-3.5"}),"Activity"]}):null]}),r==="activity"?e.jsx("div",{className:"px-4 py-4",children:e.jsx($,{organizationId:c,ownerSlug:t,filters:k,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."})})}):a?e.jsx("div",{className:"p-4",children:e.jsx(Ke,{slug:s,onClose:()=>x?.()})}):h.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:h.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:He(w)}),e.jsx("dd",{className:"shrink-0 text-xs text-muted-foreground",children:kt(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 Ct({owner:t,eventId:s,viewKey:r}){const n=T(),i=(o,c)=>e.jsx(Ue,{owner:c,organizationId:o,eventId:s,viewKey:r,dense:!0,onSelectView:n?a=>n.retarget(a):void 0},`${c}/${s}/${r??""}`);return e.jsx("div",{className:"px-4 py-4",children:t==="me"?i(null,t):e.jsx(pe,{owner:t,children:({organizationId:o,ownerSlug:c})=>o?i(o,c):e.jsx("div",{className:"h-40 animate-pulse rounded-md bg-muted/40"})})})}function P({owner:t,runId:s,runIds:r,contentIds:n}){const{data:i,isLoading:o}=C(t==="me"?null:t,{slug:t}),c=i?.workspace,a=t!=="me"&&c?.type==="organization"?c.id:null,d=f.useMemo(()=>{if(t==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const l=r??(s!=null?[s]:void 0);if(!(!l?.length&&!n?.length))return{...l?.length?{runIds:l}:{},...n?.length?{contentIds:n}:{}}},[t,n,s,r]),p=d!=null;return t!=="me"&&o?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(S,{className:"mr-2"})," Loading…"]}):t!=="me"&&a==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):p?e.jsx("div",{className:"px-4 py-4",children:e.jsx($,{presentation:"detail",organizationId:a,ownerSlug:t,filters:d,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:s!=null||r?.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 L=25;function St({target:t}){const[s,r]=f.useState(0),{data:n,isLoading:i,isError:o,refetch:c}=xe(t.entityId,t.orgContext,{relationshipType:t.relationshipType,limit:L,offset:s}),a=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,a!==void 0?` · ${a} current ${a===1?"link":"links"}`:n?` · ${n.rows.length} shown`:""]}),e.jsx(Qe,{count:n?.failures?.length??0,onRetry:()=>void c()}),i?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 c(),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(Ye,{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:()=>r(Math.max(0,s-L)),children:"Previous"}),e.jsxs("span",{className:"text-xs tabular-nums text-muted-foreground",children:[n.rows.length," shown",a===void 0?"":` of ${a}`]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!n.hasMore,onClick:()=>r(s+L),children:"Next"})]}):null]})}function It({owner:t,path:s,viewKey:r}){const[n,i]=f.useState({}),{data:o,isLoading:c}=C(t,{slug:t}),a=o?.workspace,d=a?.type==="organization"?a.id:null,p=d?{slug:t,organizationId:d}:void 0,{data:l,isLoading:y}=z(`/${t}/${B(s)}`,p),{isMember:j,isPublic:m,isLoading:g}=he(t),v=j||m,h=fe({slug:t,organizationId:j?d:null}),u=l?.entity;if(c||y||g||v&&h.isLoading)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(S,{className:"mr-2"})," Loading…"]});if(!v)return e.jsx(Ge,{});if(h.isError)return e.jsx(Ze,{onRetry:()=>void h.refetch()});const x=u?ye(h.data??[],{type:u.entity_type,id:u.id??u.slug}).find(k=>k.key===r):void 0;return!d||!u||!x?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(Je,{orgSlug:t,viewKey:x.key,scope:{type:u.entity_type,entity:u.is_derived?u.slug:u.id??u.slug},params:n,onParamsChange:i,contentHash:x.content_hash,title:x.name,minHeight:320})})}function M({owner:t,runId:s}){const r=ge({queryKey:["run-outcome",t,s],queryFn:async()=>{const i=await ve("manage_operations",{action:"get_run",run_id:s},{slug:t});if(!i.run)throw new Error(i.error||"Run not found");return i.run},enabled:t!=="me",staleTime:15e3,refetchInterval:i=>["pending","claimed","running"].includes(i.state.data?.status??"")?5e3:!1});if(t==="me")return null;if(r.isLoading)return e.jsx("p",{role:"status",className:"px-4 pt-4 text-xs text-muted-foreground",children:"Loading run…"});if(!r.data)return e.jsx("p",{role:"alert",className:"px-4 pt-4 text-sm text-destructive",children:"Could not load this run."});const n=r.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(Xe,{status:et(n.status),children:n.status}),e.jsx("time",{dateTime:n.created_at,className:"text-xs text-muted-foreground",children:je(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,r.isError?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not refresh this run. Showing its last known outcome."}):null]})}function Cs({item:t}){if(t.connectorPanel)return e.jsx(yt,{panel:t.connectorPanel});if(t.schemaSections)return e.jsx(I,{item:t});if(t.recordField)return e.jsx(We,{target:t.recordField});if(t.recordPeer)return e.jsx(Ve,{target:t.recordPeer});if(t.recordLinks)return e.jsx(St,{target:t.recordLinks});if(typeof t.browserUrl=="string"&&t.browserUrl.length>0)return e.jsx(O,{item:t});const s=t.href?Ne(t.href):null;return s?s.kind==="memory"?"runId"in s?e.jsxs(e.Fragment,{children:[e.jsx(M,{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(bt,{owner:s.owner,path:s.path}):s.kind==="entity-type"?e.jsx(At,{owner:s.owner,typeSlug:s.typeSlug,view:s.view}):s.kind==="record-view"?e.jsx(It,{owner:s.owner,path:s.path,viewKey:s.viewKey}):s.kind==="event"?e.jsx(Ct,{owner:s.owner,eventId:s.eventId,viewKey:s.viewKey}):t.runId?e.jsx(Pt,{owner:s.owner,automationId:s.automationId,runId:t.runId}):e.jsx(Lt,{owner:s.owner,automationId:s.automationId}):e.jsx(O,{item:t})}function O({item:t}){const s=t.body,r=t.notificationType??"generic",n=t.createdAt,i=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(we,{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:be(r)}),n?e.jsx("span",{children:ke(n)}):null]})]}),s?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(Ae,{text:s,linkPolicy:r==="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(Ce,{owner:t.owner,source:t.sourceAttribution,className:"text-xs"})]}):null,i?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:()=>{Ie(i)},children:[e.jsx(Se,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function Pt({owner:t,automationId:s,runId:r}){const{organizationId:n}=Le(t),i=tt(s,void 0,n),o=Pe(i.data?.automation);return o?e.jsx(ft,{agentId:o,automationId:s,ownerSlug:t,runId:r}):i.isLoading?e.jsx(b,{className:"h-24 w-full rounded-lg"}):e.jsx(M,{owner:t,runId:r})}function Lt({owner:t,automationId:s}){return e.jsx("div",{className:"px-4 py-4",children:e.jsx(_e,{owner:t,agentId:null,automationId:s,view:"activity",onDone:()=>{}})})}export{Cs as PeekPaneContent};
|
|
2
|
+
//# sourceMappingURL=peek-pane-content-Bqus80Mq.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as a,B as l,i as u}from"./index-
|
|
2
|
-
//# sourceMappingURL=pending-seed-
|
|
1
|
+
import{j as a,B as l,i as u}from"./index-B-Ab8srM.js";const c=({prompts:e,onPick:s,className:n})=>e.length===0?null:a.jsx("div",{className:u("flex flex-wrap gap-2",n),children:e.map(t=>a.jsx(l,{type:"button",variant:"outline",size:"sm",className:"h-auto rounded-full whitespace-normal px-3.5 py-1.5 text-left",title:t.message,"aria-label":`${t.title}: ${t.message}`,onClick:()=>s(t.message),children:t.title},`${t.title}\0${t.message}`))}),i=new Map;function d(e,s){const n=s.trim();n&&i.set(e,n)}function o(e){const s=i.get(e);return s===void 0?null:(i.delete(e),s)}export{c as P,d as s,o as t};
|
|
2
|
+
//# sourceMappingURL=pending-seed-CoFPQ835.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=proposal-review-shell-
|
|
1
|
+
import{hs as f,g_ as w,g$ as y,r as C,j as e,W as N,B as d,H as P,eA as k}from"./index-B-Ab8srM.js";import{a as A}from"./runs-BMzp7j7j.js";function _({resource:g,runId:r,children:h,onDone:l}){const c=!!r,{data:a,isLoading:E,isError:u,refetch:v}=A(g,c?r:void 0),s=f({isReview:c,isError:u,status:a?.status}),m=a?.status==="pending"?a.proposal:null,n=w(),i=y(),[p,x]=C.useState(""),o=n.isPending||i.isPending,j=s==="active"||s==="loading"||s==="error",b=()=>{r&&n.mutate({run_id:r},{onSuccess:()=>l?.()})},R=()=>{if(!r)return;const t=p.trim();i.mutate({run_id:r,...t?{reason:t}:{}},{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(N,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review the change the builder agent proposed. Compare Current and Proposed, then ",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(P,{htmlFor:"review-reject-reason",children:"Reason (optional)"}),e.jsx(k,{id:"review-reject-reason",rows:2,value:p,onChange:t=>x(t.target.value),placeholder:"Why you're rejecting — shared back to the requester.",disabled:o})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[e.jsx(d,{type:"button",variant:"outline",onClick:R,disabled:o,children:i.isPending?"Rejecting...":"Reject"}),e.jsx(d,{type:"button",onClick:b,disabled:o,children:n.isPending?"Approving...":"Approve"})]})]}):null]})}export{_ as P};
|
|
2
|
+
//# sourceMappingURL=proposal-review-shell-CnACXCUg.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aA as vn,j as n,r as b,c as G,w as ie,cS as yn,cT as It,cU as At,L as Ne,a0 as gn,cV as xn,ck as bn,cW as jn,cM as kn,cX as Et,cY as A,br as ft,cZ as Cn,c_ as Sn,ao as Nn,c$ as _n,an as In,d0 as An,d1 as ae,cv as En,d2 as Tt,d3 as Tn,aq as Fn,d4 as wn,bf as Rn,d5 as Mn,aw as Ce,d6 as On,d7 as Pn,at as Ft,aI as wt,d8 as $n,d9 as pt,da as Ln,db as Dn,dc as Rt,dd as Kn,de as Bn,cB as Un,bb as Vn,bt as Gn,bu as Qn,df as Wn,bv as zn,bw as Hn,bx as qn,S as Yn,cK as Zn,I as Xn,i as _e,X as Jn,B as z,dg as es,dh as ts,di as ns,bW as ss,dj as os,dk as as,dl as is,dm as Mt,dn as ht,q as rs,dp as cs,dq as $e,dr as vt,cF as ls,ds,l as us,aH as ms,dt as fs,du as ps,dv as hs,dw as vs,dx as ys,dy as gs,dz as xs,c4 as bs,dA as js,aY as ks,b2 as yt,dB as gt,dC as Ot,cx as Le,cD as Pt,dD as Cs,dE as De}from"./index-B-Ab8srM.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-editors-Dd5R2Etd.js";import{u as Es}from"./runs-BMzp7j7j.js";import{S as Ts}from"./source-record-panels-CBV9tsR3.js";import{u as Fs}from"./clients-6aJvabvS.js";import{u as ws}from"./client-activity-scopes-DoIErdUy.js";import{g as Rs}from"./client-rows-BbVQy5Ti.js";import{E as Ms}from"./events-feed-zFnTSE27.js";import{E as Os}from"./run-initiator-BvruBM5H.js";import{L as Ps,u as $s}from"./renderer-CgaQKMoG.js";import{E as Ls}from"./agent-loading-shells-DHvKiEUB.js";import{M as Ds}from"./member-scope-gate-Lj9m4RL2.js";const Ve=b.createContext(null);function Ks({organizationId:e,isWorkspaceLoading:t,children:o}){const{data:s=[],isLoading:a}=vn(e);return n.jsx(Ve.Provider,{value:{groups:s,isLoading:!!t||a},children:o})}function Bs(){const e=b.useContext(Ve);if(!e)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return e}function Us(){return b.useContext(Ve)}function $t(e){const{parse:t,serialize:o,filterKeys:s,clearClassifications:a=!0,replace:i=!0,merge:m}=e,u=G(),d=ie(),c=b.useMemo(()=>{const g=new URLSearchParams;for(const[l,h]of Object.entries(d.search||{}))h!=null&&g.set(l,typeof h=="object"&&!Array.isArray(h)?JSON.stringify(h):String(h));return t(g)},[d.search,t]),r=b.useCallback((g,l)=>{const h=m?m(c,g):{...c,...g},y=o(h),C={};for(const[S,x]of Object.entries(d.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);u({to:d.pathname,search:C,replace:l?.replace??i})},[c,o,s,a,m,u,d,i]),f=b.useCallback(()=>{const g={};for(const[l,h]of Object.entries(d.search||{}))h!=null&&(s.includes(l)||a&&l.startsWith("clf_")||(g[l]=h));u({to:d.pathname,search:g,replace:i})},[u,d.pathname,d.search,s,a,i]);return{filters:c,updateFilters:r,clearFilters:f}}function Vs(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 Ws(e,t){return{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:t}}}function zs(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:i}){return{id:e,label:t,op:"is",value:o,onRemove:i,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 qs({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(i=>n.jsx("code",{className:"break-all text-foreground",children:i},i))]}),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,i]of Object.entries(e.feeds_schema??{})){if(o&&!o.has(a))continue;const m=ee(ee(i)?.eventKinds);if(m)for(const[u,d]of Object.entries(m)){if(!t){s.add(u);continue}const c=ee(d)?.attributions;Array.isArray(c)&&c.some(r=>{const f=ee(ee(r)?.target);return typeof f?.entityType=="string"&&t.has(f.entityType)})&&s.add(u)}}return s}function Ys({connectors:e,entityTypes:t,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:a=[]}){const i=new Set,m=new Set(o),u=new Set(a),d=new Map;for(const c of s){const r=d.get(c.connectorKey)??new Set;r.add(c.feedKey),d.set(c.connectorKey,r)}if(d.size>0)for(const c of e){const r=d.get(c.key);if(r)for(const f of ge(c,void 0,r))i.add(f)}else if(m.size>0){for(const c of e)if(m.has(c.key))for(const r of ge(c))i.add(r)}else if(u.size>0){for(const c of t)if(u.has(c.slug))for(const r of Object.keys(c.event_kinds??{}))i.add(r);for(const c of e)for(const r of ge(c,u))i.add(r)}else{for(const c of t)for(const r of Object.keys(c.event_kinds??{}))i.add(r);for(const c of e)for(const r of ge(c))i.add(r)}return[...i].sort((c,r)=>c.localeCompare(r))}function Zs(e,t=!0){return It({queryKey:["automations-list","activity",e],queryFn:async()=>{const o=await Promise.all(["active","archived"].map(s=>At("manage_automations",{action:"list",status:s,include_details:!1},{slug:e})));return[...new Map(o.flatMap(s=>s.automations).map(s=>[Number(s.automation_id),s])).values()].sort((s,a)=>s.name.localeCompare(a.name))},enabled:t&&!!e,staleTime:3e4})}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 Xs({enabled:e,...t}){const o=Js(t,e);if(!e)return{fields:[],chips:[]};const s=eo(t);return{fields:[o.field,s.field],chips:[...o.chips,...s.chips]}}function Js({ownerSlug:e,filters:t,onFiltersChange:o},s){const a=Zs(e,s),i=a.data??[],m=r=>r==="produced"?t.producedByAutomationId:t.automationId,u=r=>i.find(f=>Number(f.automation_id)===r)?.name??`#${r}`,d=Ke.flatMap(r=>{const f=m(r);return f==null?[]:[{id:`automation-${r}`,field:"automation",label:Se(r),value:u(f),onRemove:()=>o(r==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),c={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:a.isLoading?"Loading Automations...":"No Automations found",items:r=>n.jsxs(n.Fragment,{children:[Ke.map(f=>{const g=m(f),l=i.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(f==="produced"?{producedByAutomationId:y}:{automationId:y}),r()};return n.jsx(Et,{heading:Se(f),children:l.map(y=>n.jsxs(A,{"aria-label":y.label,value:`${f} ${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,{...zs(e,String(y.id)),label:y.label})]},y.id))},f)}),a.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void a.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:n.jsx(jn,{className:"h-4 w-4"}),editor:c}}}function eo(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(i=>`#${i}`).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:(i,m)=>Ke.map(u=>n.jsx(to,{...e,mode:u,query:m,close:i},u))};return{chips:s,field:{key:"run",label:"Run",group:"Scope",icon:n.jsx(kn,{className:"h-4 w-4"}),editor:a}}}function to({ownerSlug:e,filters:t,onFiltersChange:o,mode:s,query:a,close:i}){const m=s==="produced"?t.producedByAutomationId:t.automationId,u=Es({workspace:!0},{automationIds:m==null?void 0:[m],runTypes:s==="analyzed"?["automation"]:void 0,connectionIds:s==="produced"?t.connectionIds??void 0:void 0,feedIds:s==="produced"?t.feedIds??void 0:void 0},e),d=s==="produced"?t.runIds??[]:t.runId==null?[]:[t.runId],c=u.data?.pages.flatMap(l=>l.runs)??[],r=[...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 d)r.some(h=>h.id===l)||r.unshift({id:l,label:`Run #${l} (selected)`});const f=l=>{if(s==="produced"){const h=d.includes(l)?d.filter(y=>y!==l):[...d,l];o({runIds:h.length?h:null})}else o({runId:l}),i()},g=/^\d+$/.test(a.trim())?Number(a.trim()):0;return n.jsxs(Et,{heading:Se(s),children:[r.map(l=>n.jsxs(A,{value:`${s} ${l.label}`,onSelect:()=>f(l.id),children:[n.jsx(K,{selected:d.includes(l.id)}),n.jsx("span",{className:"truncate",children:l.label})]},l.id)),Number.isSafeInteger(g)&&g>0&&!r.some(l=>l.id===g)?n.jsxs(A,{value:`${s} ${g}`,onSelect:()=>f(g),children:[Se(s)," run #",g]}):null,u.isLoading?n.jsx(A,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,u.isError?n.jsx(A,{forceMount:!0,onSelect:()=>void(u.isFetchNextPageError?u.fetchNextPage():u.refetch()),children:"Could not load runs. Retry"}):null,!u.isLoading&&!u.isError&&!r.length?n.jsx(A,{disabled:!0,forceMount:!0,children:"No runs found"}):null,u.hasNextPage?n.jsx(A,{forceMount:!0,disabled:u.isFetching,onSelect:()=>void u.fetchNextPage(),children:u.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const Ge="Scope",Pe="Source",W="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 i=>{const m=ae(e,t,i,o);return a?{to:s,search:m.search}:m}}const xt=e=>new Set((e??"").split(",").map(t=>t.trim()).filter(Boolean));function no({ownerSlug:e,sourceRead:t=!1,filters:o,onFiltersChange:s}){const a=re(),{recordPath:i,embedded:m}=Lt(e),u=i?i.split("/").at(-2):void 0,d=typeof a.type=="string"&&a.type.trim()?a.type.trim():void 0,c=(u?ft(u):void 0)??(d?ft(d):void 0),r=Cn(a),f=Sn(a),g=typeof a.feed_ids=="string"?a.feed_ids:typeof a.feed_ids=="number"?String(a.feed_ids):void 0,l=so(e,c,!m),h=oo(e,c,i,m),y=ao(e,r,!t),C=Xs({ownerSlug:e,filters:o,onFiltersChange:s,enabled:!t}),S=io(e,f,g);return[l,h,y,C,S].reduce((x,F)=>({fields:[...x.fields,...F.fields],chips:[...x.chips,...F.chips]}),{fields:[],chips:[]})}function so(e,t,o){const s=G(),a=re(),{visible:i}=An(e);if(!o)return{fields:[],chips:[]};const m=i.find(d=>d.slug===t),u={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>n.jsxs(n.Fragment,{children:[i.map(c=>n.jsxs(A,{onSelect:()=>{s(ae(e,a,{entity:void 0,create:void 0,type:c.slug})),d()},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)),d()},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:W}),editor:u}],chips:t?[{id:"type",label:"Entity type",op:"is",value:m?.name??t,onRemove:()=>void s(ae(e,a,{type:void 0}))}]:[]}}function oo(e,t,o,s){const a=G(),i=re(),[m,u]=b.useState(""),[d,c]=b.useState(0),r=Tt(m,250),f={slug:e},{data:g,isLoading:l,isError:h,refetch:y}=Tn(t??"",f,{search:r,offset:d,limit:30,enabled:!s&&!!t}),{data:C}=Fn(o?`/${e}/${o}`:"",f),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=>{u(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 O=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,i,{type:t},O)),M()},children:[n.jsx(K,{selected:S?.slug===I.slug}),I.name]},I.slug)),d>0&&n.jsx(A,{onSelect:()=>c(Math.max(0,d-30)),children:"Previous entities"}),g?.metadata.has_more&&n.jsx(A,{disabled:l,onSelect:()=>c(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:Ge,icon:n.jsx(wn,{className:W}),editor:F}],chips:x?[{id:"entity",label:"Entity",op:"is",value:x,onRemove:()=>void a(ae(e,i,{type:t}))}]:[]}}function ao(e,t,o){const s=G(),a=Dt(e),{data:i=[]}=Rn(),m=b.useMemo(()=>[...i].sort((c,r)=>c.name.localeCompare(r.name)),[i]);if(!o)return{fields:[],chips:[]};const u=m.find(c=>c.agentId===t),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:c=>m.map(r=>n.jsxs(A,{onSelect:()=>{s(a({agent:r.agentId,schedule:void 0})),c()},className:"gap-2",children:[n.jsx(K,{selected:r.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:r.name.trim().charAt(0).toUpperCase()||"?"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name})]},r.agentId))};return{fields:[{key:"agent",label:"Agent",group:Ge,icon:n.jsx(Mn,{className:W}),editor:d}],chips:t?[{id:"agent",label:"Agent",op:"is",value:u?.name??t,onRemove:()=>void s(a({agent:void 0,schedule:void 0}))}]:[]}}function io(e,t,o){const s=G(),a=Dt(e),{groups:i}=Bs(),m=re(),u=Ce({platforms:String(m.platforms??m.platform??"")}).platforms??[],d=b.useMemo(()=>xt(t),[t]),c=b.useMemo(()=>xt(o),[o]),r=u.length===1?u[0]:On(i,d),f=i.find(_=>_.connector_key===r),g=d.size===1?Number([...d][0]):void 0,l=Pn(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:[i.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===f?.connector_key}),n.jsx(Vn,{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:Pe,icon:n.jsx(Un,{className:W}),editor:F}],I=[],O=f?.connector_name??f?.connector_key??(u.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(O&&I.push({id:"connector",label:"Connector",op:"is",value:O,onRemove:()=>void s(a(x))}),f){M.push({key:"connection",label:"Connection",group:Pe,icon:n.jsx($n,{className:W}),editor:Q(f)});const _=d.size===1?f.connections.find(k=>d.has(String(k.id))):void 0;_&&I.push({id:"connection",label:"Connection",op:"is",value:pt({display_name:_.display_name,connector_name:f.connector_name,connector_key:f.connector_key}),onRemove:()=>void s(a({...x,platforms:f.connector_key}))})}if((g||o)&&M.push({key:"feed",label:"Feed",group:Pe,icon:n.jsx(Ln,{className:W}),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 $=pt({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:d.has(String(E.id))}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:$}),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:$})]},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 ro=["notification"],co=["note","summary","decision","observation","fact","change","preference","identity"],lo=[...ro,...co],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 uo({value:e,onChange:t,withNotifications:o=!1}){const s=o?[Kt,...bt]:bt,a=s.find(i=>i.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(Wn,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx(zn,{children:a})]}),n.jsx(Hn,{align:"end",className:"min-w-40",children:s.map(i=>n.jsx(qn,{value:i.value,children:i.label},i.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 mo(e,t,o){const s=e.semanticTypes??[],a=o.length>0?o:lo,i=[...new Set([...a,...s])].sort((f,g)=>se(f).localeCompare(se(g))).map(f=>({value:f,label:se(f)})),m=e.engagementRange??[be,je],u=e.reviewStatus,d=e.interactionStatus,c=[{key:"date",label:"Date",group:te,icon:n.jsx(ts,{className:ne}),editor:Ns({value:e.dateRange??void 0,onApply:f=>t({dateRange:f})})},{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:i,selected:s,multiple:!0,onSelect:f=>{const g=s.includes(f)?s.filter(l=>l!==f):[...s,f];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:d?[d]:[],onSelect:f=>t({interactionStatus:f})})},{key:"review",label:"Reviewed by",group:te,icon:n.jsx(os,{className:ne}),editor:ke({searchPlaceholder:"Search reviewers...",options:[...jt],selected:u&&u!=="all"?[u]:[],onSelect:f=>t({reviewStatus:f})})},{key:"score",label:"Engagement score",group:te,icon:n.jsx(as,{className:ne}),editor:_s({value:m,min:be,max:je,onApply:f=>t({engagementRange:f})})}],r=[];return e.dateRange&&r.push({id:"date",label:"Date",op:"is",value:Is(e.dateRange),onRemove:()=>t({dateRange:null})}),s.length&&r.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})}),d&&r.push({id:"approval",label:"Approval",op:"is",value:kt.find(f=>f.value===d)?.label??d,onRemove:()=>t({interactionStatus:null})}),u&&u!=="all"&&r.push({id:"review",label:"Reviewed by",op:"is",value:jt.find(f=>f.value===u)?.label??u,onRemove:()=>t({reviewStatus:void 0})}),(m[0]!==be||m[1]!==je)&&r.push({id:"score",label:"Engagement score",value:As(m,be,je),onRemove:()=>t({engagementRange:void 0})}),{fields:c,chips:r}}function Bt({filters:e,onFiltersChange:t,eventKinds:o=[],searchQuery:s,onSearchChange:a,scope:i,extraFields:m=[],drillChips:u=[],total:d,isListLoading:c=!1,isTotalLoading:r=!1,hasCursorInUrl:f=!1,onGoToLatest:g,onShowNotifications:l,sourceRead:h=!1,filterTrailing:y,filterActions:C,onClearFilters:S}){const x=s.trim().length>0,F=h?{fields:[],chips:[]}:mo(e,t,o),M=[...i?.fields??[],...F.fields,...m],I=[...i?.chips??[],...u,...F.chips],O=I.length>0||x,Q=`${e.sortBy??"date"}-${e.sortOrder??"desc"}`,H=c||r?n.jsx(Yn,{className:"h-4 w-20"}):d==null?null:O?`${d.toLocaleString()} ${d===1?"match":"matches"}`:`${d.toLocaleString()} ${d===1?"item":"items"}`;return n.jsxs("div",{className:"w-full space-y-2.5",children:[n.jsxs("div",{className:"flex 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(uo,{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&&f&&g&&n.jsxs(z,{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 Ut({ownerSlug:e,...t}){const o=no({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 Ue(e){return e.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",day:"numeric"})}function fo(e){const o=e[e.length-1].date.getTime()-e[0].date.getTime()>180*Ct,s=new Map;for(const a of e){const i=new Date(a.date);o&&i.setUTCDate(i.getUTCDate()-i.getUTCDay()),s.set(i.getTime(),(s.get(i.getTime())??0)+a.count)}return[...s.entries()].sort(([a],[i])=>a-i).map(([a,i])=>{const m=new Date(a);return{start:m,end:new Date(a+(o?7:1)*Ct),count:i,label:`${m.getUTCMonth()+1}/${m.getUTCDate()}`,tooltip:o?`Week of ${Ue(m)}`:Ue(m)}})}function po(e){const t=m=>{const u=new Date(m);return u.setMinutes(0,0,0),u.getTime()},o=new Map;for(const m of e)o.set(t(m),(o.get(t(m))??0)+1);const s=Math.min(...o.keys()),a=Math.max(...o.keys()),i=[];for(let m=s;m<=a;m+=Be){const u=new Date(m);i.push({start:u,end:new Date(m+Be),count:o.get(m)??0,label:ht(u,"HH:mm"),tooltip:ht(u,"MMM d, HH:mm")})}return i}function ho({entityId:e,organizationId:t,ownerSlug:o,eventTimes:s,selectedRange:a,onSelectRange:i}){const{data:m,isLoading:u,error:d}=is(t,{entityId:e},{slug:o}),c=b.useMemo(()=>(m??[]).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()),[m]),r=b.useMemo(()=>{if(c.length===0)return[];if(c.length>1)return fo(c);const[h]=c,y=Nt(h.date),C=(s??[]).map(St).filter(S=>S!==null&&Nt(S)===y);return C.length===h.count?po(C):[]},[c,s]),f=b.useCallback(h=>{const y=r[h.dataIndex];y&&i&&i(y.start,y.end)},[r,i]),g=b.useCallback(h=>{if(i&&h.startValue!==void 0&&h.endValue!==void 0){const y=new Date(h.startValue),C=new Date(h.endValue);i(y,C)}},[i]),l=b.useMemo(()=>{if(r.length<2)return null;let h;if(a){const[y,C]=a,S=r.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`${r[C.dataIndex]?.tooltip}: ${C.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:r.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 Ps(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:r.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}]}},[r,a]);if(u||d)return n.jsx("div",{className:_e(Mt,"p-4"),children:n.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:u?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"," ",Ue(h.date),"."]})}return n.jsx(vo,{option:l,onClick:f,onDataZoom:g})}function vo({option:e,onClick:t,onDataZoom:o}){const{chartRef:s,setOption:a}=$s({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 yo({kinds:e,onFiltersChange:t}){const o=!e?.length,s=e?.length===1&&e[0]===_t,a=i=>_e("h-7 px-2.5 text-xs",i?"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(z,{type:"button",variant:"ghost",size:"sm",className:a(o),"aria-pressed":o,onClick:()=>t({semanticTypes:void 0}),children:"All"}),n.jsx(z,{type:"button",variant:"ghost",size:"sm",className:a(s),"aria-pressed":s,onClick:()=>t({semanticTypes:[_t]}),children:"Changes"})]})}function go({organizationId:e,ownerSlug:t,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:a,pinned:i,onShowNotifications:m,emptyState:u,changesShortcut:d=!1}){const{isAuthenticated:c,isReady:r}=rs(),{isMember:f,isLoading:g}=Ft(),l=r&&c&&f,h=r&&(!c||!g&&!f),y=G(),C=ie(),S=cs(),{filters:x,updateFilters:F,clearFilters:M}=$t({parse:Ce,serialize:Le,filterKeys:Pt,replace:!1,merge:Ot}),[I,O]=b.useState(x.searchQuery||""),[Q,H]=b.useState($e(x)||s&&(o!=null||!!a?.length)),_=I.trim(),k=_.length>=3?_:void 0,E=Tt(k,1e3),$=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")&&$.current&&(N===(x.searchQuery??"")||N===(k??""))||($.current=!1,O(N))}),[S.history,k,x.searchQuery]);const j=b.useMemo(()=>vt({...x,...a?.length?{entityTypes:a}:{}}),[x,a]),w=F;b.useEffect(()=>{$.current&&(x.searchQuery||void 0)!==E&&F({searchQuery:E})},[E,F,x.searchQuery]);const Qe=()=>{$.current=!1,O(""),s&&t?y({...De(t,C.search??{}),...o!==void 0&&!C.pathname.startsWith(`/${t}/events/`)?{to:C.pathname}:{}}):M()},ce=$e(vt(x)),Ie=o===void 0,{data:Vt=[]}=ls(r&&l?e:null),{data:Gt=[]}=ds(h?t:null),We=l?Vt:Gt,{data:ze=[]}=us(l&&e?{organizationId:e}:void 0),le=Us(),de=j.connectionIds,Ae=(de?.length??0)>0,{data:He=[]}=ms(r&&l?e??"":"",{connectionIds:de??void 0,enabled:!le&&r&&l&&Ae}),qe=j.feedIds,Ee=(qe?.length??0)>0,{data:Ye=[]}=wt(r&&l?e:null,{feedIds:qe??void 0,enabled:r&&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(()=>Ye.map(p=>({connectorKey:p.connector_key,feedKey:p.feed_key})),[Ye]),Qt=b.useMemo(()=>Ae&&Te.length===0||Ee&&Fe.length===0?[]:Ys({connectors:We,entityTypes:ze,selectedPlatforms:Te,selectedFeeds:Fe,selectedEntityTypes:j.entityTypes}),[We,j.entityTypes,Ae,Ee,Te,Fe,ze]),R=j.clientIds,ue=(R?.length??0)>0,{data:Xe=[]}=Fs(null,{enabled:r&&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,Wt=t&&fe?Ws(t,fe.clientId):void 0,pe=j.mcpActivityId??null,{data:et=[]}=ws({enabled:r&&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]),q=j.agentId,Y=j.schedule,{data:nt=[]}=Vs(q??void 0),st=b.useMemo(()=>!Y||!q?null:nt.find(v=>v.id===Y)?.description?.trim()||"Scheduled task",[q,Y,nt]),{data:zt}=fs(r&&l?e:null,o),{data:Ht}=ps(h&&!Ie?t:null,o),ot=l?zt: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||{},P=Object.keys(L);let ve=null;const Z={};for(const[X,V]of Object.entries(L))if(V.parent)for(const[Oe,J]of Object.entries(V.parent))ve=Oe,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,...P]);D.values=[...X];for(const[V,Oe]of Object.entries(Z)){D.valuesByParentValue[V]||(D.valuesByParentValue[V]=[]);const J=new Set([...D.valuesByParentValue[V],...Oe]);D.valuesByParentValue[V]=[...J]}ve&&(D.parentSlug=ve)}else T.classifiers.push({slug:v.slug,name:v.name,values:P,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]),qt=hs(r&&l?e:null,o,j,t),Yt=vs(h?t:null,o,j),Zt=h?Yt:qt,{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(r&&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],U=ct?.content[ct.content.length-1];b.useEffect(()=>{!rt||!U||B?.pages.length===1||x.beforeOccurredAt===U.occurred_at&&x.beforeId===U.id||F({beforeOccurredAt:U.occurred_at,beforeId:U.id},{replace:!0})},[U?.id,rt,F,B?.pages.length,U,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=!r||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(P=>v.valuesByParentValue[P]??[]))]: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(P=>({value:P,label:P,count:on?.[v.slug]?.[P]})),selected:N,multiple:!0,onSelect:P=>dn(v.slug,P)})})}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:Wt,details:R&&R.length>0?n.jsx(qs,{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&&q&&Y?Hs(t,q,Y):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=i&&!ce?i:void 0,ut={filterActions:d?n.jsx(yo,{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(z,{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(z,{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:m,filters:j,onFiltersChange:w,eventKinds:Qt,searchQuery:I,onSearchChange:p=>{$.current=!0,O(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(Ut,{...ut,ownerSlug:t}):n.jsx(Bt,{...ut})}),Q&&l&&o&&e&&n.jsx(ho,{entityId:o,organizationId:e,ownerSlug:t||"",eventTimes:en,selectedRange:j.dateRange||void 0,onSelectRange:ln}),dt?.rows,Me?n.jsx(Os,{}):pn?u??n.jsx(yt,{icon:gt,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(Ms,{onFiltersChange:w,organizationId:e,ownerSlug:t,entityId:o,filters:j,showEntityLinks:Ie,foldConsecutiveCalls:!0,groupByConversation:!0,hiddenApprovalRunIds:dt?.hiddenApprovalRunIds,emptyState:n.jsx(yt,{icon:gt,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 xo({record:e,ownerSlug:t}){const o=ie(),s=G(),{filters:a,updateFilters:i}=$t({parse:Ce,serialize:Le,filterKeys:Pt,replace:!1,merge:Ot}),m=$e({...a,platforms:void 0,connectionIds:void 0,feedIds:void 0})||a.sortBy!=null&&a.sortBy!=="date"||a.sortOrder!=null&&a.sortOrder!=="desc",u=()=>{s({...De(t,o.search??{}),...o.pathname.startsWith(`/${t}/events/`)?{}:{to:o.pathname}})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(Ut,{ownerSlug:t,sourceRead:!0,filters:a,onFiltersChange:i,searchQuery:a.searchQuery??"",onSearchChange:d=>i({searchQuery:d}),onClearFilters:u}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Live activity supports connector, connection and feed filters. Search and other event filters are available for saved activity."}),m?n.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[n.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),n.jsx(z,{variant:"outline",size:"sm",onClick:()=>{const d=Le({platforms:a.platforms,connectionIds:a.connectionIds,feedIds:a.feedIds}),c={...De(t,o.search??{}).search,...d};s({to:o.pathname,search:c})},children:"Clear unsupported filters"})]}):n.jsx(Ts,{record:e,orgContext:{slug:t},filters:a})]})}function Ro({entity:e,organizationId:t,ownerSlug:o}){const s=e.is_derived?n.jsx(xo,{ownerSlug:o,record:{type:e.entity_type,key:e.slug}}):n.jsx(go,{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{go as E,Ks as M,Kt as N,Ro as R,uo as S};
|
|
2
|
+
//# sourceMappingURL=record-activity-6CfR95Ul.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-B-Ab8srM.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-Bpx4_LGk.js.map
|