@lobu/runtime-server 24.7.0 → 24.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalogs/connectors.json +282 -322
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +6 -2
- package/dist/connectors/github.ts +16 -3
- package/dist/connectors/imessage.ts +953 -0
- package/dist/connectors/linkedin.ts +20 -377
- package/dist/connectors/market_quotes.ts +388 -91
- package/dist/connectors/postgres.ts +21 -14
- package/dist/connectors/x-dm-adapter.js +55 -21
- package/dist/connectors/x.ts +1 -1
- package/dist/db/migrations/20261109010000_workspace_navigation.sql +14 -0
- package/dist/db/migrations/20261110010000_view_resources.sql +11 -0
- package/dist/dependencies.bun.lock +135 -103
- package/dist/embeddings-server.mjs +14 -2
- package/dist/owletto/dist/assets/_-B2C9B2RM.js +2 -0
- package/dist/owletto/dist/assets/_-CjyiGzwB.js +3 -0
- package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +2 -0
- package/dist/owletto/dist/assets/_agentId-bna2tPsW.js +2 -0
- package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-zcs-S3dY.js +2 -0
- package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +2 -0
- package/dist/owletto/dist/assets/_owner-DsvIC94q.js +3 -0
- package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +2 -0
- package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-CX7Egv-p.js → accept-invitation-k1u3zBcn.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +4 -0
- package/dist/owletto/dist/assets/agent-editor-form-Bnc_q5WD.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-DHvKiEUB.js → agent-loading-shells-xteN-pyK.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DF5q0Dfr.js → agent-skill-context-r0O0BVOu.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-Pi5cECga.js → agent-subpage-shell-C2KpYdu3.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-B1ZepGZc.js → agent-thread-Bv_chdPy.js} +4 -4
- package/dist/owletto/dist/assets/agent-thread-storage-Bx2-WBHQ.js +2 -0
- package/dist/owletto/dist/assets/app._appId-BUcNaSMS.js +2 -0
- package/dist/owletto/dist/assets/assist-composer-B1LykXpD.js +2 -0
- package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +2 -0
- package/dist/owletto/dist/assets/{callback-Ckrxv0eo.js → callback-kSLa4n5s.js} +2 -2
- package/dist/owletto/dist/assets/{card-DT9mSjSp.js → card-C01y1O-W.js} +2 -2
- package/dist/owletto/dist/assets/{claim-Bzby28tT.js → claim-Dnux9Lqf.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-DoIErdUy.js → client-activity-scopes-BBIq16tG.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-BbVQy5Ti.js → client-rows-DGh1O-Fu.js} +2 -2
- package/dist/owletto/dist/assets/clients-BCvjAJDT.js +2 -0
- package/dist/owletto/dist/assets/code-editor-BdRMYojw.js +26 -0
- package/dist/owletto/dist/assets/connect-DZeFSGIH.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-D4w-JhJW.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-BsDzltNz.js +2 -0
- package/dist/owletto/dist/assets/{connection-BOaMa324.js → connection-C7glVpPE.js} +2 -2
- package/dist/owletto/dist/assets/connection-feed-detail-CJju0qiw.js +2 -0
- package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +2 -0
- package/dist/owletto/dist/assets/connector-provenance-B2C2cjBg.js +2 -0
- package/dist/owletto/dist/assets/{connectors-D5F5rHxX.js → connectors-DSQ5AWPf.js} +2 -2
- package/dist/owletto/dist/assets/consent-B6Aw_89N.js +2 -0
- package/dist/owletto/dist/assets/copy-button-BhXeXLIm.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-BIE97rfo.js → core.esm-CJUp2aNZ.js} +3 -3
- package/dist/owletto/dist/assets/create-CWcza8NT.js +2 -0
- package/dist/owletto/dist/assets/{create-BPxsKwk7.js → create-DUlRsFNn.js} +2 -2
- package/dist/owletto/dist/assets/{create-automation-form-B12yTrmj.js → create-automation-form-D141prEG.js} +3 -3
- package/dist/owletto/dist/assets/create-bGOYifof.js +2 -0
- package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-B9plaLBN.js → custom-guardrail-edits-DuQ28xv3.js} +2 -2
- package/dist/owletto/dist/assets/definition-comparison-BUDNuAN_.js +2 -0
- package/dist/owletto/dist/assets/{detail-page-skeleton-I5_7FkKx.js → detail-page-skeleton-BRHaq5Sj.js} +2 -2
- package/dist/owletto/dist/assets/{device-CadaiNF4.js → device-D3fzoIrM.js} +2 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-BIM-ziCH.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-BnPqTgK1.js +2 -0
- package/dist/owletto/dist/assets/dynamic-schema-form-OkIZImgp.js +2 -0
- package/dist/owletto/dist/assets/entity-options-CpeX7iiX.js +2 -0
- package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +2 -0
- package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-MgZ7_0oh.js +2 -0
- package/dist/owletto/dist/assets/event-detail-D6AH6a2C.js +2 -0
- package/dist/owletto/dist/assets/event-kind-options-fHAIXu24.js +2 -0
- package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-DDTwyYt0.js +3 -0
- package/dist/owletto/dist/assets/{full-page-spinner-CCU4PkRv.js → full-page-spinner-DWo519BU.js} +2 -2
- package/dist/owletto/dist/assets/index-9tTjJo_J.css +1 -0
- package/dist/owletto/dist/assets/{index-pmr1WUoG.js → index-BW7IFKXC.js} +2 -2
- package/dist/owletto/dist/assets/index-BYcFrinP.js +2 -0
- package/dist/owletto/dist/assets/index-BhJsTy-C.js +2 -0
- package/dist/owletto/dist/assets/index-CEcsgXDj.js +2 -0
- package/dist/owletto/dist/assets/index-CPscKk2u.js +2 -0
- package/dist/owletto/dist/assets/{index-B72KYdN1.js → index-Cd8jMsz8.js} +2 -2
- package/dist/owletto/dist/assets/index-CdDNNAx2.js +7906 -0
- package/dist/owletto/dist/assets/index-CfJ2-EpK.js +2 -0
- package/dist/owletto/dist/assets/index-D1UCJQl1.js +2 -0
- package/dist/owletto/dist/assets/index-D5DM4g2w.js +2 -0
- package/dist/owletto/dist/assets/index-DmqnKGqW.js +2 -0
- package/dist/owletto/dist/assets/index-DznAbTOF.js +2 -0
- package/dist/owletto/dist/assets/json-diff-C-WQqyIf.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-BAqT0vxo.js → list-skeleton-0B1bTrAK.js} +2 -2
- package/dist/owletto/dist/assets/{login-D5bIjMtf.js → login-CH7P2AyR.js} +2 -2
- package/dist/owletto/dist/assets/{logout-JYZvxz8v.js → logout-D474YsYQ.js} +2 -2
- package/dist/owletto/dist/assets/member-scope-gate-CH_0jHiM.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +74 -0
- package/dist/owletto/dist/assets/model-selector-XYmk7Iru.js +2 -0
- package/dist/owletto/dist/assets/needs-you-list-Bd4iiiqm.js +2 -0
- package/dist/owletto/dist/assets/new-BOsrRqp8.js +2 -0
- package/dist/owletto/dist/assets/new-CJ6TF3Vc.js +2 -0
- package/dist/owletto/dist/assets/{new-B-Jd-vBl.js → new-DGPOjak2.js} +2 -2
- package/dist/owletto/dist/assets/new-Q0XqiZq2.js +2 -0
- package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-Cc8YX1oy.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-CoFPQ835.js → pending-seed-D7-ld7as.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-BWRJidwb.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +2 -0
- package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +2 -0
- package/dist/owletto/dist/assets/{record-session-Bpx4_LGk.js → record-session-ClKBr1_C.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-CgaQKMoG.js → renderer-DZ0w2k2r.js} +2 -2
- package/dist/owletto/dist/assets/{reset-password-C-4Jnuqk.js → reset-password-D2RfrEVZ.js} +2 -2
- package/dist/owletto/dist/assets/run-initiator-B8IRlRd-.js +2 -0
- package/dist/owletto/dist/assets/runs-CuC7WMtd.js +2 -0
- package/dist/owletto/dist/assets/runs-list-8gUPWjP4.js +2 -0
- package/dist/owletto/dist/assets/{schema-value-BUgC0Ro8.js → schema-value-k19Ata7u.js} +3 -3
- package/dist/owletto/dist/assets/scoped-feed-bar-L7h-Ca4u.js +2 -0
- package/dist/owletto/dist/assets/{settings-DYYvrrZ4.js → settings-BZqntV3E.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-DT61YfsU.js → status-variants-BR_iGWN5.js} +2 -2
- package/dist/owletto/dist/assets/subDays-hOwerOLo.js +2 -0
- package/dist/owletto/dist/assets/{table-B6yimlsZ.js → table-C3DMoL4K.js} +2 -2
- package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +2 -0
- package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +2 -0
- package/dist/owletto/dist/assets/use-mention-search-CtbixPEE.js +91 -0
- package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-BVtMfgLh.js → views-access-required-CvIIxdS_.js} +2 -2
- package/dist/owletto/dist/index.html +19 -12
- package/dist/server-main.bundle.mjs +4518 -2567
- package/npm-shrinkwrap.json +644 -551
- package/package.json +4 -2
- package/vendor/connector-sdk/dist/connector-types.d.ts +23 -2
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.d.ts +3 -4
- package/vendor/core/dist/classify-error.js +8 -8
- package/vendor/core/dist/connector-query-errors.d.ts +6 -0
- package/vendor/core/dist/connector-query-errors.js +4 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +17 -1
- package/vendor/core/dist/contracts/tools/collection-presentation.js +27 -3
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +39 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +11 -1
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +7 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +249 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +83 -21
- package/vendor/core/dist/contracts/tools/navigation.d.ts +248 -0
- package/vendor/core/dist/contracts/tools/navigation.js +284 -0
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +7 -0
- package/vendor/core/dist/contracts/tools/view-attach.js +15 -0
- package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +4 -1
- package/vendor/core/dist/contracts/tools/view-content-hash.js +4 -2
- package/vendor/core/dist/contracts/tools/view-definition.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/view-definition.js +52 -0
- package/vendor/core/dist/contracts/tools/view-host.d.ts +68 -0
- package/vendor/core/dist/contracts/tools/view-host.js +30 -1
- package/vendor/core/dist/contracts/tools/view-scope.d.ts +31 -0
- package/vendor/core/dist/contracts/tools/view-scope.js +45 -0
- package/vendor/core/dist/error-report.js +1 -0
- package/vendor/core/dist/errors.d.ts +17 -24
- package/vendor/core/dist/errors.js +17 -24
- package/vendor/core/dist/types.d.ts +0 -6
- package/vendor/core/package.json +11 -1
- package/vendor/views/dist/api.d.ts +30 -5
- package/vendor/views/dist/api.js +22 -8
- package/vendor/views/dist/bridge.d.ts +17 -0
- package/vendor/views/dist/bridge.js +49 -1
- package/vendor/views/dist/components.d.ts +27 -5
- package/vendor/views/dist/components.js +57 -7
- package/vendor/views/dist/embed.d.ts +98 -0
- package/vendor/views/dist/embed.js +418 -0
- package/vendor/views/dist/index.d.ts +3 -1
- package/vendor/views/dist/index.js +1 -0
- package/vendor/views/package.json +1 -1
- package/dist/connectors/linkedin-takeout.ts +0 -577
- package/dist/connectors/takeout-utils.ts +0 -240
- package/dist/owletto/dist/assets/_-CZgmjLR9.js +0 -2
- package/dist/owletto/dist/assets/_-Cm5OgtYD.js +0 -3
- package/dist/owletto/dist/assets/_-DtqBFgK5.js +0 -2
- package/dist/owletto/dist/assets/_agentId-Cci6NFc1.js +0 -2
- package/dist/owletto/dist/assets/_agentId-GhWTlPO2.js +0 -2
- package/dist/owletto/dist/assets/_automationId-KUlxSTK2.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-Zpy7Hvml.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-CYDRp9UX.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-NNqDdije.js +0 -2
- package/dist/owletto/dist/assets/_eventId-0BSX6VHj.js +0 -2
- package/dist/owletto/dist/assets/_owner-C-CD22NB.js +0 -3
- package/dist/owletto/dist/assets/_shape-CvXp4omb.js +0 -2
- package/dist/owletto/dist/assets/_slug-DgK7zpKA.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-cH54P0zY.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-m0B5j7L9.js +0 -2
- package/dist/owletto/dist/assets/activity-link-rXNpmppV.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-B0m7_g9q.js +0 -2
- package/dist/owletto/dist/assets/agent-client-setup-list-BmD3-_Ox.js +0 -4
- package/dist/owletto/dist/assets/agent-connect-pages-BtOTCsTU.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-CirqCpcM.js +0 -2
- package/dist/owletto/dist/assets/agent-list-row-SyACVYX7.js +0 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-Dsc26dyW.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -2
- package/dist/owletto/dist/assets/agents-D1FHZ0jR.js +0 -2
- package/dist/owletto/dist/assets/app._appId-01I0CJal.js +0 -2
- package/dist/owletto/dist/assets/assist-composer-BD9msDk3.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-BFv1TglZ.js +0 -2
- package/dist/owletto/dist/assets/automation-row-CmTpAD4r.js +0 -2
- package/dist/owletto/dist/assets/automation-source-list-D8ZSavQU.js +0 -2
- package/dist/owletto/dist/assets/automations-D1FHZ0jR.js +0 -2
- package/dist/owletto/dist/assets/change-summary-CGrKEJ04.js +0 -2
- package/dist/owletto/dist/assets/clients-6aJvabvS.js +0 -2
- package/dist/owletto/dist/assets/connect-BmDziBzI.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-Bs8mxsga.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-t5aKu3aa.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-DswMAw8l.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-BLCjhP-H.js +0 -2
- package/dist/owletto/dist/assets/connector-boxes-BAP_f77M.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-ClOmVPJr.js +0 -2
- package/dist/owletto/dist/assets/connector-provenance-wmYu5jwO.js +0 -2
- package/dist/owletto/dist/assets/consent-RqHNkmm8.js +0 -2
- package/dist/owletto/dist/assets/copy-button-D6zpsZLi.js +0 -2
- package/dist/owletto/dist/assets/create-GT8_yF0R.js +0 -2
- package/dist/owletto/dist/assets/create-Yx2qBMBy.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-CzXqSkuI.js +0 -2
- package/dist/owletto/dist/assets/definition-comparison-C3k6Wa9B.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-U7Bx05P6.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-DTZqj1HS.js +0 -2
- package/dist/owletto/dist/assets/dynamic-schema-form-DyT_9iVE.js +0 -2
- package/dist/owletto/dist/assets/entity-options-CGTjLlcS.js +0 -2
- package/dist/owletto/dist/assets/entity-page-DHHMmA8V.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-eYbG2FDT.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-CjFqxSdL.js +0 -2
- package/dist/owletto/dist/assets/event-card-BtTUuf2q.js +0 -2
- package/dist/owletto/dist/assets/event-detail-8xHiplt_.js +0 -2
- package/dist/owletto/dist/assets/events-feed-zFnTSE27.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Dd5R2Etd.js +0 -2
- package/dist/owletto/dist/assets/home-stream-IVsNEkwp.js +0 -2
- package/dist/owletto/dist/assets/index-2oaMOFKe.js +0 -2
- package/dist/owletto/dist/assets/index-B-Ab8srM.js +0 -7899
- package/dist/owletto/dist/assets/index-B4RZgvvI.js +0 -2
- package/dist/owletto/dist/assets/index-BBZM53p8.js +0 -2
- package/dist/owletto/dist/assets/index-BOb0a5f9.js +0 -2
- package/dist/owletto/dist/assets/index-BYFDMIQC.js +0 -2
- package/dist/owletto/dist/assets/index-BwnFQcMe.js +0 -2
- package/dist/owletto/dist/assets/index-CvYsWYlF.js +0 -2
- package/dist/owletto/dist/assets/index-DIXIvtnM.js +0 -2
- package/dist/owletto/dist/assets/index-DLwokXHW.js +0 -2
- package/dist/owletto/dist/assets/index-_nlPHus1.js +0 -2
- package/dist/owletto/dist/assets/index-cwOgj4-i.js +0 -2
- package/dist/owletto/dist/assets/index-pp4qmhkA.js +0 -2
- package/dist/owletto/dist/assets/index-tTbno-PX.css +0 -1
- package/dist/owletto/dist/assets/json-diff-B-1Swv_y.js +0 -28
- package/dist/owletto/dist/assets/member-scope-gate-Lj9m4RL2.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-rAKfVdQ_.js +0 -74
- package/dist/owletto/dist/assets/model-selector-onvGA9Ww.js +0 -2
- package/dist/owletto/dist/assets/new-BmehH1uR.js +0 -2
- package/dist/owletto/dist/assets/new-KDi15LWZ.js +0 -2
- package/dist/owletto/dist/assets/organization-B9bh20Xo.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-Bqus80Mq.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-CnACXCUg.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-Dlh-eWz0.js +0 -2
- package/dist/owletto/dist/assets/record-activity-6CfR95Ul.js +0 -2
- package/dist/owletto/dist/assets/run-initiator-BvruBM5H.js +0 -2
- package/dist/owletto/dist/assets/runs-BMzp7j7j.js +0 -2
- package/dist/owletto/dist/assets/runs-list-DVhrTr3v.js +0 -2
- package/dist/owletto/dist/assets/schema-type-editor-panel-Bdeumkux.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-CBV9tsR3.js +0 -2
- package/dist/owletto/dist/assets/use-automations-II_YJWtN.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-BqtEilid.js +0 -2
- package/dist/owletto/dist/assets/use-mention-search-Bxlpd6Dp.js +0 -96
- package/dist/owletto/dist/assets/view-param-filters-DYlqBocg.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ad as ge,r as v,bN as Ie,bO as Be,bP as Ke,bQ as Me,bR as be,j as e,bS as Y,B as N,bT as Ve,bd as Ue,bU as Ge,bV as He,bW as Ye,bX as Je,bY as Ze,bZ as Xe,b_ as es,b$ as ve,bz as ie,c0 as ss,c1 as ts,c2 as ns,c3 as me,c4 as is,c5 as as,c as os,a8 as We,G as rs,c6 as cs,c7 as ne,c8 as ls,T as je,U as Ne,c9 as ds,ca as us,cb as ms,ai as Ce,cc as hs,m as z,V as le,cd as ps,ce as _e,cf as ke,cg as gs,W as xs,ch as Se,ar as fs,as as ys,S as bs,i as vs,ci as js}from"./index-CdDNNAx2.js";import{P as he,a as De,A as Ns}from"./agent-permissions-matrix-C_ayr0pd.js";import{C as we,a as Ae,b as Oe,c as ze}from"./card-C01y1O-W.js";const Pe=["auto","approval","deny"],Cs={matched_rule:"Matching policy rules apply.",default_approval:"No rule matches; approval is required.",unresolved_principal:"The requesting agent or Automation could not be identified.",parent_approval:"Approval is inherited from the parent action.",unavailable_operation:"This action is unavailable on the connection."},Le={read:"Reads",write:"Writes",destructive:"Destructive writes",non_destructive:"Non-destructive writes",unknown:"Unclassified writes"};function 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:a,children:c,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:r=>a(r.target.value),disabled:h,className:"h-9 w-full rounded-lg border bg-background px-2 text-foreground",children:c})]})}function _s(s,n){const a=n.connections?.find(c=>c.id===s.connection_id);return s.connection_id?`Connection: ${a?.display_name||a?.connector_key||"Unavailable"} (#${s.connection_id})`:s.connector_key?`Connector: ${n.connectors?.find(c=>c.key===s.connector_key)?.name||s.connector_key}`:"All connectors"}function ks(s,n){return s.operation_key?n.connector_operations.find(a=>a.operation_key===s.operation_key)?.name||s.operation_key:s.operation_category?Le[s.operation_category]:"All actions"}function ue(s,n){return`${_s(s,n)} · ${ks(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 Ss({label:s,ariaLabel:n,disabled:a,onRemove:c}){const[h,r]=v.useState(!1);return h?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(N,{type:"button",variant:"destructive",size:"sm",disabled:a,"aria-label":"Confirm removal",onClick:async()=>{await c()&&r(!1)},children:"Confirm"}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",disabled:a,onClick:()=>r(!1),children:"Cancel"})]}):e.jsx(N,{type:"button",variant:"ghost",size:"sm",disabled:a,"aria-label":n,onClick:()=>r(!0),children:s})}function ws({owner:s,connector:n,connection:a,agent:c}){const h=ge(),[r,y]=v.useState(c??""),C=Ie(s),l=C.data,u=l?.agents.some(t=>t.id===r)?r:"",m=Be(s,u),i=Ke(s,!u),[P,_]=v.useState(a?`connection:${a}`:n?`connector:${n}`:"all"),[M,J]=v.useState(P),[I,W]=v.useState(!1),[k,D]=v.useState(""),[A,V]=v.useState("all"),[Z,E]=v.useState("approval"),[g,S]=v.useState(!1),[L,T]=v.useState(null),[U,X]=v.useState(a?String(a):""),[G,Q]=v.useState(""),R=l?.connections?.some(t=>String(t.id)===U)?U:"",w=Me(s,R?Number(R):void 0,G,u||void 0);async function H(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=C.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 b=t=>t==="all"||l.connectors?.some(f=>`connector:${f.key}`===t)||l.connections?.some(f=>`connection:${f.id}`===t)?t:"all",o=b(P),p=b(M),j=l.connections?.find(t=>`connection:${t.id}`===p),$=j?.connector_key??(p.startsWith("connector:")?p.slice(10):void 0),x=t=>p==="all"||Ee(t)==="all"?!0:t.connection_id?j?t.connection_id===j.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=o.startsWith("connector:")?o.slice(10):o.startsWith("connection:")?l.connections?.find(t=>t.id===Number(o.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:o.startsWith("connector:")?o.slice(10):o==="all"&&A==="specific"?O.find(t=>t.operation_key===k)?.connector_key??null:null,connection_id:o.startsWith("connection:")?Number(o.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"),D(""),E("approval"),W(!0)}const ye=(t,f=!1)=>e.jsx("div",{className:"divide-y rounded-lg border",children:t.map(d=>{const K=!f&&B(d);return e.jsxs(De,{controls:e.jsxs(e.Fragment,{children:[e.jsx(he,{options:Pe,value:d.effect,floor:"auto",compact:!0,disabled:g||!K,ariaLabel:`Policy for ${ue(d,l)}`,onChange:ce=>void H(d,ce)}),K&&e.jsx(Ss,{label:"Remove",disabled:g,ariaLabel:`Remove rule: ${ue(d,l)}`,onRemove:()=>H(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!==r)&&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:y,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(N,{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)&&H(Qe,Z).then(f=>{f&&(W(!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:o,onChange:t=>{_(t),V("all"),D("")},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:Le[t]},t))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),A==="specific"&&e.jsxs(F,{label:"Specific action",value:k,onChange:D,disabled:g,children:[e.jsx("option",{value:"",children:"Choose action"}),O.map(t=>e.jsxs("option",{value:t.operation_key,children:[t.connector_name,": ",t.name]},t.operation_key))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(he,{options:Pe,value:Z,floor:"auto",compact:!0,disabled:g,ariaLabel:"New rule decision",onChange:E}),e.jsx(Ve,{onCancel:()=>W(!1),cancelDisabled:g,children:e.jsx(N,{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(Ue,{icon:Ge,title:"No saved rules in this scope",description:"Add a rule for all actions, a category, or a specific action.",actionLabel:"Add rule",onAction:fe})]}),L&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:L}),e.jsxs("details",{className:"space-y-3 border-t pt-4",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Check an action"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(F,{label:"Check connection",value:R,onChange:t=>{X(t),Q("")},children:[e.jsx("option",{value:"",children:"Choose connection"}),l.connections?.map(t=>e.jsxs("option",{value:String(t.id),children:[t.display_name||t.connector_key," (#",t.id,")"]},t.id))]}),e.jsxs(F,{label:"Check action",value:G,onChange:Q,disabled:!R,children:[e.jsx("option",{value:"",children:"Choose action"}),ae.map(t=>e.jsx("option",{value:t.operation_key.slice(t.connector_key.length+2),children:t.name},t.operation_key))]})]}),w.error?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not check policy. ",String(w.error)]}):e.jsx("p",{"aria-live":"polite",className:"text-sm",children:G?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:He[w.data.effect]})," ·"," ",Cs[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(t=>`#${t}`).join(", ")}`:""]}):"":""})]})]})}const As=[{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."}],Os=[{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 zs(s){return s.agent.find(xe)}function Ps(s,n){return{...s,agent:[...s.agent.filter(a=>!xe(a)),n]}}function $s(s){return{...s,agent:s.agent.filter(n=>!xe(n))}}function Es({label:s,description:n,action:a,value:c,pending:h,onChange:r}){return e.jsxs(De,{controls:e.jsx(he,{options:as("entity_schema",a),value:c,floor:"auto",disabled:h,compact:!0,ariaLabel:s,onChange:r}),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:a,pending:c,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:r,label:y,description:C})=>e.jsx(Es,{action:r,label:y,description:C,value:a[r]??me.entity_schema[r]??"deny",pending:c,onChange:l=>h(r,l)},r))})]})}function Ts({owner:s}){const n=ge(),a=es(s),c=Ie(s),h=ve({mutationFn:m=>ss(s,{resource_class:"entity_schema",effects:m}),onSuccess:m=>{n.setQueryData(a,i=>i&&Ps(i,m)),n.invalidateQueries({queryKey:a})},onError:m=>{ie.error(m instanceof Error?m.message:"Failed to save schema policy")}}),r=ve({mutationFn:()=>ts(s,{resource_class:"entity_schema"}),onSuccess:()=>{n.setQueryData(a,m=>m&&$s(m)),n.invalidateQueries({queryKey:a})},onError:m=>{ie.error(m instanceof Error?m.message:"Failed to reset schema policy")}});if(c.isLoading)return e.jsx(Y,{label:"schema policy",variant:"cards",cards:1});if(c.isError||!c.data)return e.jsx(ns,{label:"schema policy"});const y=zs(c.data),C=y?.effects??me.entity_schema,l=h.isPending||r.isPending,u=(m,i)=>{h.mutate({...y?.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:y?"Custom policy":"Workspace defaults"}),y?e.jsxs(N,{type:"button",variant:"outline",size:"sm",disabled:l,onClick:()=>r.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:As,effects:C,pending:l,onChange:u}),e.jsx(Re,{title:"Relationship types",actions:Os,effects:C,pending:l,onChange:u})]})]})}function Fe(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Rs(s,n,a){const c=s.split("/");return c[1]===n?(c[1]=a,c.join("/")||"/"):`/${a}`}function Fs({section:s}){return s==="policies"?e.jsx(Y,{label:"policies",rows:2}):s==="governance"?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Agent write defaults"}),e.jsx(Y,{label:"agent write defaults",variant:"table",rows:3})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Schema governance"}),e.jsx(Y,{label:"schema governance",rows:3})]})]}):e.jsxs("div",{role:"status","aria-label":"Loading general settings","aria-busy":"true",className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Identity"}),e.jsxs("div",{"aria-hidden":"true",className:"space-y-4",children:[["name","slug"].map(n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(z,{className:"h-3.5 w-12 rounded-none"}),e.jsx("div",{className:"flex h-9 items-center border border-input bg-background px-3",children:e.jsx(z,{className:"h-4 w-32 rounded-none"})})]},n)),e.jsx(z,{className:"h-3 w-4/5 rounded-none"})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Workspace visibility"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose who can browse this workspace and its public pages."})]}),e.jsx("div",{"aria-hidden":"true",className:"grid gap-2 sm:grid-cols-2",children:["private","public"].map(n=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border p-3",children:[e.jsx(z,{className:"mt-0.5 h-4 w-4 shrink-0 rounded-none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(z,{className:"h-4 w-16 rounded-none"}),e.jsx(z,{className:"h-3 w-full rounded-none"}),e.jsx(z,{className:"h-3 w-2/3 rounded-none"})]})]},n))})]}),e.jsxs("div",{"aria-hidden":"true",className:"flex justify-end gap-2",children:[e.jsx(z,{className:"h-9 w-20 rounded-none"}),e.jsx(z,{className:"h-9 w-28 rounded-none"})]})]})}function Is({owner:s,section:n="general",connector:a,connection:c,agent:h}){const r=os(),y=ge(),{data:C,error:l}=We(),{activeOrg:u,urlOrgSlug:m}=rs(),i=(C??[]).find(o=>o.slug===s&&o.is_member)??null,P=i?.id??s,_=cs(P,{name:i?.name??"",slug:i?.slug??"",visibility:i?.visibility??"private"}),[M,J]=_.field("name"),[I,W]=_.field("slug"),[k,D]=_.field("visibility"),[A,V]=ne(P,!!i),[Z,E]=ne(P,!1),[g,S]=ne(P,null),[L,T]=v.useState(!1),[U,X]=v.useState(!1),[G,Q]=ne(P,!1);if(ls(l)&&C===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(C===void 0)return e.jsx(Fs,{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(ws,{owner:s,connector:a,connection:c,agent:h},`${s}:${h??""}:${a??""}:${c??""}`)]})});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(Ns,{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(Ts,{owner:s})]})]});const R=o=>{const p=xs(o);if(p.kind==="cross-host"){window.location.assign(p.href);return}r({to:p.to})},w=o=>{if(o==="public"&&i.visibility!=="public"){E(!0);return}D(o),E(!1)},H=async()=>{if(!_.canSubmit)return;const o=M.trim();if(!o){S("Name is required");return}const p=I.trim()||Fe(o);if(!p){S("Slug is required");return}T(!0),S(null);try{const j=o!==i.name||p!==i.slug,$=k!==i.visibility;let x=i.slug;if(j){const O=await le.update({organizationId:i.id,data:{name:o,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),(j||$)&&(_.accept(_.values,{name:o,slug:x,visibility:k}),await y.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=Rs(window.location.pathname,i.slug,x);r({to:`${ae}${window.location.search}${window.location.hash}`});return}}catch(j){S(j instanceof Error?j.message:"Failed to update organization")}finally{T(!1)}},q=async()=>{X(!0),S(null);try{const o=await le.delete({organizationId:i.id});if(o.error){S(o.error.message||"Failed to delete organization");return}await y.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization deleted");const j=(C??[]).filter(x=>x.is_member).find(x=>x.id!==i.id)??null,$=u?.id===i.id||m===i.slug;if($&&j){await le.setActive({organizationId:j.id}),R(j.slug);return}if($){const x=_e(),B=ke();if(x===i.slug&&B){window.location.assign(`${window.location.protocol}//app.${B}/`);return}r({to:"/"});return}r({to:"/"})}catch(o){S(o instanceof Error?o.message:"Failed to delete organization")}finally{X(!1),Q(!1)}},b=L||U;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:o=>{J(o.target.value),A||W(Fe(o.target.value))},placeholder:"e.g. My Team",disabled:b})]}),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:o=>{V(!0),W(o.target.value)},placeholder:"e.g. my-team",disabled:b}),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:b,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:b,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(N,{type:"button",size:"sm",onClick:()=>{D("public"),E(!1)},disabled:b,children:"Confirm public"}),e.jsx(N,{type:"button",size:"sm",variant:"ghost",onClick:()=>E(!1),disabled:b,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(N,{variant:"outline",onClick:()=>void r({to:`/${s}`}),disabled:b,children:"Cancel"}),e.jsxs(N,{onClick:H,disabled:b||!_.canSubmit,children:[L?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,L?"Saving...":"Save changes"]})]}),e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:i.is_personal?"Personal workspace":"Delete this organization"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.is_personal?"Your personal workspace can't be deleted — your devices and personal connections are bound to it.":"Permanently removes the organization and all members' workspace access. This cannot be undone."}),!i.is_personal&&e.jsx("div",{className:"mt-3",children:G?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N,{variant:"destructive",size:"sm",onClick:q,disabled:b,children:[U?e.jsx(Ce,{className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>Q(!1),disabled:b,children:"Cancel"})]}):e.jsxs(N,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>Q(!0),disabled:b,children:[e.jsx(hs,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete organization"]})})]})]})}function Qs(){const{owner:s}=Se.useParams(),n=Se.useSearch(),a=n.section??"general",c={general:"General",policies:"Policies",governance:"Governance"}[a],{data:h}=We(),r=(h??[]).find(y=>y.slug===s&&y.is_member)?.name;return e.jsx(fs,{className:"pt-2.5 pb-8",children:e.jsxs(ys,{className:vs("flex flex-1 flex-col gap-6",js(a)),children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bs,{className:"h-7 w-7"}),e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:c})]}),r?e.jsx("p",{className:"text-base font-medium text-foreground",children:r}):null]}),e.jsx(Is,{owner:s,...n,section:a})]})})}export{Qs as component};
|
|
2
|
+
//# sourceMappingURL=organization-hD_Z6TSd.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,el as de,jV as z,jW as ue,jX as ee,jY as me,jZ as pe,r as g,j_ as xe,u as D,aV as he,cO as fe,m as $,iC as ge,jq as ye,B as w,j$ as je,k0 as K,k1 as ve,dZ as Ne,k2 as ke,y as L,ai as R,ax as te,cu as se,G as ne,dr as we,bS as be,c2 as Ae,ds as Ce,cN as Se,x as Ie,gh as $e,H as Le,L as H,k3 as Re,cS as Te,gk as Pe,db as _e,k4 as Ee,gr as G,fn as Oe,aT as ze,k5 as De,n as Me,w as Fe,gG as Be,eY as Ke,fl as He,fo as Ve,fu as E,p as Ue,k6 as We,k7 as qe,ex as Ge,k8 as Ye,f2 as Ze,a7 as Qe,k9 as Xe,A as Je,ka as et}from"./index-CdDNNAx2.js";import{b as re,u as tt,a as st,A as nt}from"./automation-run-now-CjkJIkaZ.js";import{A as rt}from"./agent-loading-shells-xteN-pyK.js";import{s as it,h as at,R as ot,A as ct}from"./agent-thread-Bv_chdPy.js";import{C as lt,a as dt,c as ut,A as mt}from"./connection-feed-detail-CJju0qiw.js";import{O as pt}from"./connect-menu-D4w-JhJW.js";import{E as T,R as xt,b as ht,s as Y,p as Z,e as ft,f as gt}from"./events-feed-BI7wNRUY.js";import{S as yt}from"./source-record-panels-C4UItfdk.js";import{E as Q}from"./entity-type-page-MgZ7_0oh.js";import{c as jt,s as vt,k as Nt}from"./renderer-DZ0w2k2r.js";import{E as kt}from"./event-detail-D6AH6a2C.js";import{V as wt,R as bt}from"./views-access-required-CvIIxdS_.js";import{V as At,a as Ct}from"./view-param-filters-BdN8OU35.js";import{S as St,g as It}from"./status-variants-BR_iGWN5.js";import{a as $t}from"./runs-CuC7WMtd.js";import{a as ie}from"./use-automations-CdtiVLCv.js";import"./needs-you-list-Bd4iiiqm.js";import"./scoped-feed-bar-L7h-Ca4u.js";import"./event-kind-options-fHAIXu24.js";import"./filter-editors-DDTwyYt0.js";import"./subDays-hOwerOLo.js";import"./create-automation-form-D141prEG.js";import"./entity-options-CpeX7iiX.js";import"./device-automation-Dp3faMvp.js";import"./model-selector-XYmk7Iru.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-BdRMYojw.js";import"./index-Vcq4gwWv.js";import"./json-diff-C-WQqyIf.js";import"./use-mention-search-CtbixPEE.js";import"./proposal-review-shell-BWRJidwb.js";import"./definition-comparison-BUDNuAN_.js";import"./schema-value-k19Ata7u.js";import"./runs-list-8gUPWjP4.js";import"./run-initiator-B8IRlRd-.js";import"./list-skeleton-0B1bTrAK.js";import"./clients-BCvjAJDT.js";import"./app-bridge-C4nPtae3.js";import"./pending-seed-D7-ld7as.js";import"./feed-event-kinds-BYuZCoU4.js";import"./copy-button-BhXeXLIm.js";import"./card-C01y1O-W.js";import"./table-C3DMoL4K.js";import"./dynamic-schema-form-OkIZImgp.js";import"./record-session-ClKBr1_C.js";function Lt(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 Rt({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 M({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(de,{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=Lt(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(Rt,{fields:i})]},n.title)})]}):null}function Tt({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(z,{entries:s,label:"actions",renderDetail:({name:r,action:n})=>e.jsx(M,{hideHeading:!0,item:{href:"",title:r,schemaSections:ee(n)}})})}function Pt({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(z,{entries:s,label:"feed types",renderDetail:({name:r,feed:n})=>e.jsx(M,{hideHeading:!0,item:{href:"",title:r,schemaSections:ue(n)}})})}function _t(t){const s=[];return t.forEach((r,n)=>{s.push({id:`sep:${r.runId}`,role:"system",parts:[{type:"text",text:Et(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 Et(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 ae=Symbol("trusted-automation-interaction");function Ot(t){return Object.defineProperty(t,ae,{value:!0}),t}function zt(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 Dt=new Set(["automation-approval-batch"]);function Mt(t){return new Promise(s=>{t({onSettled:(r,n)=>s(!!n)})})}function Ft(){const t=me(),s=pe();return g.useMemo(()=>({toolNames:Dt,resolve:(r,n)=>{if(!n||typeof n!="object"||n[ae]!==!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:zt(c),handlers:{manage_operations:d=>d.action!=="approve"&&d.action!=="reject"?Promise.resolve(!0):Mt(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 Bt=/(?:^|\n)Run this Automation now/;function Kt(t){return t.role==="user"&&t.parts.some(s=>s.type==="text"&&Bt.test(s.text))}function Ht(t){return`history-interaction:${t.runId}:${t.eventId??"error"}`}function Vt({agentId:t,automationId:s,ownerSlug:r,runId:n}){const{data:i,isLoading:o}=xe(t,s,{orgSlug:r,...n!=null?{runId:n}:{}}),c=Ft(),a=D(),d=g.useCallback(m=>{a?.open({href:`/${r}/automations/${s}?view=activity&run_id=${m}`,title:`Automation run #${m}`,runId:m})},[a,r,s]),p=g.useMemo(()=>{const m=i?.runs??[],b=(n!=null?m.filter(x=>x.runId===n):m).slice().reverse();return _t(b.map(x=>{const y=x.messages.map(u=>it(u,{showToolCalls:!0})).filter(u=>u!==null&&!Kt(u));x.task?.trim()&&y.unshift({id:"task",role:"user",parts:[{type:"text",text:x.task.trim()}]});const N=x.actions??[],j=N.filter(u=>u.status==="pending");if(j.length>1){const u=j.map(h=>h.runId).sort((h,C)=>h-C);y.push({id:"approval-batch",role:"assistant",parts:[{type:"tool-call",toolCallId:`approval-batch-${x.runId}`,toolName:"automation-approval-batch",args:Ot({runId:x.runId,count:j.length,runIds:u})}]})}for(const u of N){const h=at([u],{workspaceSlug:r,agentId:t,webOrigin:typeof window>"u"?null:window.location.origin});h&&y.push({...h,id:Ht(u)})}return{runId:x.runId,completedAt:x.completedAt,status:x.status,pendingActionCount:x.pendingActionCount,autoAppliedCount:x.autoAppliedCount,messages:y}}))},[t,i,r,n]);return o?e.jsx(rt,{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(ot,{messages:p,workspaceSlug:r,children:e.jsx(ct,{readOnly:!0,readerPositionMode:"runs",interactionExtension:c,onRunSelect:n==null&&a?d:void 0})})})}function Ut({panel:t}){const s=he(t.organizationId),r=t.section==="connections"||!!t.connectionId,n=fe(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($,{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(ge,{connections:n.data??[],connector:i,connectorKey:t.connectorKey,ownerSlug:t.ownerSlug}):o&&t.section==="data"?e.jsx(lt,{connection:o,ownerSlug:t.ownerSlug}):o?e.jsx(Gt,{connection:o,connector:i,panel:t}):i?t.section==="oauth-apps"?e.jsx(pt,{connector:i,organizationId:t.organizationId,newApp:!!t.newApp}):t.section==="feeds"?e.jsx(Wt,{connector:i}):i.installed===!1?e.jsx(qt,{connector:i,ownerSlug:t.ownerSlug}):e.jsx(Zt,{connector:i,ownerSlug:t.ownerSlug}):null},`${t.connectorKey}:${t.connectionId??"connector"}:${t.section}`)}function Wt({connector:t}){return e.jsx(Pt,{feeds:t.feeds_schema??{}})}function qt({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(K,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(Tt,{actions:t.actions_schema??{}})]})}function Gt({connection:t,connector:s,panel:r}){const[n,i]=g.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:r.section==="feeds"?e.jsx(Yt,{connection:t,connector:s,ownerSlug:r.ownerSlug}):e.jsx(ye,{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(w,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(je,{connection:t,connectorDef:s})]})]})}function Yt({connection:t,connector:s,ownerSlug:r}){const{data:n=[],isLoading:i,isError:o}=Ne(t.id),[c,a]=g.useState(!1),d=t.facets?.chat??!1;if(i)return e.jsx($,{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(m=>({id:String(m.id),name:m.display_name||m.feed_key,status:ke(m)??(m.operations.includes("sync")?"Sync enabled":"Live access"),feed:m}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:c,children:e.jsx(z,{entries:p,label:d?"channels":"feeds",action:Object.keys(s?.feeds_schema??{}).length>0?e.jsx(w,{size:"sm",variant:"outline",onClick:()=>a(!0),children:d?"Add channel":"Add feed"}):void 0,renderDetail:({feed:m})=>m.store==="channel_messages"?e.jsx(dt,{feed:m,hideHeader:!0}):e.jsx(ut,{feed:m,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(mt,{organizationId:t.organization_id,connections:[t],connectorDefinitions:[s],onClose:()=>a(!1)})]})]})}function Zt({connector:t,ownerSlug:s}){const{data:r=[],isLoading:n,isError:i}=ve(t.key);if(n)return e.jsx($,{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(K,{ownerSlug:s,connectorKey:t.key})]}),e.jsx(z,{entries:c,label:"actions",renderControl:()=>e.jsx(K,{ownerSlug:s,connectorKey:t.key}),renderDetail:({operation:a,name:d})=>o[a.operation_key]?e.jsx(M,{hideHeading:!0,item:{href:"",title:d,schemaSections:ee(o[a.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})})]})}function Qt({owner:t,name:s,agentId:r,clientIds:n}){const{data:i,isLoading:o}=L(t==="me"?null:t,{slug:t}),c=i?.workspace,a=t!=="me"&&c?.type==="organization"?c.id:null,d=n?.join(",")??"",p=g.useMemo(()=>({sortBy:"date",sortOrder:"desc",...r?{agentId:r}:{clientIds:d.split(",").filter(Boolean)}}),[r,d]);return t!=="me"&&o?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(R,{className:"mr-2"})," Loading…"]}):e.jsx("div",{className:"space-y-3 px-4 py-4",children:e.jsx(T,{organizationId:a,ownerSlug:t,filters:p,hideOriginator:!0,groupStretches:!0,emptyState:e.jsxs("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:["No activity from ",s," yet."]})})})}function Xt({owner:t,path:s}){const{data:r,isLoading:n}=L(t,{slug:t}),i=r?.workspace,o=i?.type==="organization"?i.id:null,c=o?{slug:t}:void 0,{data:a,isLoading:d}=te(`/${t}/${se(s)}`,c),p=a?.entity,m=p?.id;return n||d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(R,{className:"mr-2"})," Loading…"]}):o?m==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(yt,{record:{type:p.entity_type,key:p.slug},orgContext:c}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(T,{organizationId:o,ownerSlug:t,entityId:typeof m=="number"?m: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 Jt({slug:t,onClose:s}){const{orgContext:r}=ne(),{data:n=[],isLoading:i,isError:o}=we(r);if(t===null)return e.jsx(Q,{entityType:null,orgContext:r,onClose:s,compact:!0});if(i)return e.jsx(be,{label:"entity type",variant:"panel"});if(o)return e.jsx(Ae,{label:"entity type"});const c=n.find(a=>a.slug===t)??null;return c?e.jsx(Q,{entityType:c,orgContext:r,hideDelete:Ce(c),onClose:s,compact:!0}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Entity type not found."})}function es(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 ts({owner:t,typeSlug:s,view:r}){const{data:n,isLoading:i}=L(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:m}=Ie(d),v=(p??[]).find(A=>A.slug===s),b=m&&!v,x=`/${t}/${$e(s)}`,{pathname:y}=Le(),N=y===x||y===`${x}/`||y.startsWith(`${x}/-/`),j=g.useMemo(()=>jt(v?.metadata_schema),[v?.metadata_schema]),u=D(),h=u?.close;g.useEffect(()=>{b&&h?.()},[b,h]);const C=g.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(R,{className:"mr-2"})," Loading…"]});if(b)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 P=v?.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:[N?null:e.jsx(w,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs(H,{...Te(t,s),children:[e.jsx(Re,{className:"mr-1.5 h-3.5 w-3.5"}),"Browse records"]})}),v&&!N&&!Pe(v)&&v.entity_count!==0?e.jsx(w,{asChild:!0,variant:"outline",size:"sm",className:"h-8 text-xs",children:e.jsxs(H,{to:"/$owner/$entityType/-/$shape",params:{owner:t,entityType:s,shape:"graph"},search:Ee(G(t,s)),children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5"}),"Graph"]})}):null,r!=="activity"&&u?e.jsxs(w,{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:G(t,s,"activity"),title:`${P} activity`}),children:[e.jsx(Oe,{className:"h-3.5 w-3.5"}),"Activity"]}):null]}),r==="activity"?e.jsx("div",{className:"px-4 py-4",children:e.jsx(T,{organizationId:c,ownerSlug:t,filters:C,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(Jt,{slug:s,onClose:()=>h?.()})}):j.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:j.map(A=>e.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-1.5",title:A.prop.description,children:[e.jsx("dt",{className:"min-w-0 truncate",children:vt(A)}),e.jsx("dd",{className:"shrink-0 text-xs text-muted-foreground",children:es(A.prop)})]},A.key))})]}):e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This type has no fields yet."})]})}function ss({owner:t,eventId:s,viewKey:r}){const n=D(),i=(o,c)=>e.jsx(kt,{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(ze,{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 ns({owner:t,feedId:s,semanticTypes:r}){const{data:n,isLoading:i}=L(t==="me"?null:t,{slug:t}),o=n?.workspace,c=t!=="me"&&o?.type==="organization"?o.id:null,a=g.useMemo(()=>({feedIds:[s],...r?.length?{semanticTypes:r}:{},sortBy:"date",sortOrder:"desc"}),[s,r]);return t!=="me"&&i?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(R,{className:"mr-2"})," Loading…"]}):c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(T,{organizationId:c,ownerSlug:t,filters:a,showEntityLinks:!0,hideOriginator:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:r?.length===1?`No ${r[0]} events from this feed yet.`:"No matching events from this feed yet."})})})}function O({owner:t,runId:s,runIds:r,contentIds:n}){const{data:i,isLoading:o}=L(t==="me"?null:t,{slug:t}),c=i?.workspace,a=t!=="me"&&c?.type==="organization"?c.id:null,d=g.useMemo(()=>{if(t==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const m=r??(s!=null?[s]:void 0);if(!(!m?.length&&!n?.length))return{...m?.length?{runIds:m}:{},...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(R,{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(T,{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 F=25;function rs({target:t}){const[s,r]=g.useState(0),{data:n,isLoading:i,isError:o,refetch:c}=De(t.entityId,t.orgContext,{relationshipType:t.relationshipType,limit:F,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(xt,{count:n?.failures?.length??0,onRetry:()=>void c()}),i?e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{className:"h-6 w-full"}),e.jsx($,{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(ht,{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(w,{type:"button",variant:"outline",size:"sm",disabled:s===0,onClick:()=>r(Math.max(0,s-F)),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(w,{type:"button",variant:"outline",size:"sm",disabled:!n.hasMore,onClick:()=>r(s+F),children:"Next"})]}):null]})}function is({owner:t,path:s,viewKey:r}){const[n,i]=g.useState({}),{data:o,isLoading:c}=L(t,{slug:t}),a=o?.workspace,d=a?.type==="organization"?a.id:null,p=d?{slug:t,organizationId:d}:void 0,{data:m,isLoading:v}=te(`/${t}/${se(s)}`,p),{isMember:b,isPublic:x,isLoading:y}=Me(t),N=b||x,j=Fe({slug:t,organizationId:b?d:null}),u=m?.entity;if(c||v||y||N&&j.isLoading)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(R,{className:"mr-2"})," Loading…"]});if(!N)return e.jsx(wt,{});if(j.isError)return e.jsx(At,{onRetry:()=>void j.refetch()});const h=u?Be(j.data??[],{type:u.entity_type,id:u.id??u.slug}).find(C=>C.key===r):void 0;return!d||!u||!h?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(Ct,{orgSlug:t,viewKey:h.key,scope:{type:u.entity_type,entity:u.is_derived?u.slug:u.id??u.slug},params:n,onParamsChange:i,paramDecls:h.params,contentHash:h.content_hash,title:h.name,minHeight:320})})}function oe({owner:t,runId:s}){const r=$t(t,s);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(St,{status:It(n.status),children:n.status}),e.jsx("time",{dateTime:n.created_at,className:"text-xs text-muted-foreground",children:Ke(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]})}const X=30;function I({label:t,children:s}){return e.jsxs("section",{className:"border-t px-4 py-3 first:border-t-0",children:[e.jsx("h3",{className:"mb-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:t}),s]})}function B({label:t,detail:s}){return e.jsxs("div",{className:"flex items-baseline gap-3 py-0.5 text-sm",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),e.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:s})]})}function as({stretch:t,ownerSlug:s,connectorDefinitions:r,connectionName:n,sourceConnection:i,showEntity:o}){const c=D(),a=g.useMemo(()=>He(t),[t]),d=g.useMemo(()=>Ve(t),[t]),[p,m]=g.useState(!1),[v,b]=g.useState(new Set),x=l=>e.jsx("li",{children:e.jsx(gt,{content:l,ownerSlug:s,connectorDefinitions:r,connectionName:n,showEntity:o})},l.id),y=l=>e.jsx("ul",{className:"-mx-1 divide-y overflow-hidden rounded-lg border",children:l.map(x)}),N=[...a.failedCalls.map(l=>l.content),...a.failedOperations.flatMap(l=>E(l)??[])],j=t.changes.flatMap(l=>E(l)??[]),u=[...t.calls.map(l=>l.content),...t.operations.flatMap(l=>E(l)??[])].sort((l,f)=>new Date(f.occurred_at).getTime()-new Date(l.occurred_at).getTime()),h=p?u:u.slice(0,X),C=(l,f)=>e.jsxs(w,{variant:"ghost",size:"sm",className:"mt-2",onClick:f,children:["Show all ",l]});if(t.source){const{source:l}=t,f=t.flagged.flatMap(k=>E(k)??[]),le=d.reduce((k,W)=>k+W.items.length,0),_=i?.(l.connectionId)??null;return e.jsxs("div",{className:"pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 px-4 pt-3 pb-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:l.name}),e.jsxs("span",{children:["· ",Y(t)]}),e.jsxs("span",{children:["· ",Z(le,"item")]}),f.length>0?e.jsxs("span",{children:["· ",f.length," failed"]}):null,_&&c?e.jsxs(w,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>c.open({href:`/${s}/connectors/${encodeURIComponent(_.connectorKey)}/${l.connectionId}`,key:`connection:${l.connectionId}`,title:l.name,connectorPanel:{section:"data",connectorKey:_.connectorKey,connectionId:l.connectionId,organizationId:_.organizationId,ownerSlug:s}}),children:["All data from ",l.name]}):null]}),f.length>0?e.jsx(I,{label:`Failed · ${f.length}`,children:y(f)}):null,d.map(k=>{const q=v.has(k.type)?k.items:k.items.slice(0,X);return e.jsxs(I,{label:k.label,children:[y(q),k.items.length>q.length?C(k.items.length,()=>b(new Set([...v,k.type]))):null]},k.type)})]})}const P=a.did.reduce((l,f)=>l+f.count,0),A=a.lookedAt.reduce((l,f)=>l+f.count,0),S=t.apps.length===1?t.apps[0]:null,U=S?.key.startsWith("client:")?`/${s}/events?client_ids=${encodeURIComponent(S.key.slice(7))}`:S?.key.startsWith("agent:")?`/${s}/events?agent=${encodeURIComponent(S.key.slice(6))}`:null;return e.jsxs("div",{className:"pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 px-4 pt-3 pb-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:ft(t)}),e.jsxs("span",{children:["· ",Y(t)]}),e.jsxs("span",{children:["· ",Z(t.calls.length,"call")]}),e.jsxs("span",{children:["· ",N.length," failed"]}),U&&S&&c?e.jsxs(w,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>c.open({href:U,title:S.name}),children:["All activity from ",S.name]}):null]}),N.length>0?e.jsx(I,{label:`Failed · ${N.length}`,children:y(N)}):null,t.kind==="background"?null:e.jsxs(I,{label:`Changed · ${j.length||a.changeSteps.reduce((l,f)=>l+f.count,0)}`,children:[j.length>0?y(j):null,a.changeSteps.map(l=>e.jsx(B,{label:l.title,detail:`${l.methods.join(" · ")} · ${l.count}`},l.title)),j.length===0&&a.changeSteps.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing changed."}):null]}),P>0?e.jsx(I,{label:`Did · ${P}`,children:a.did.map(l=>e.jsx(B,{label:l.group,detail:l.items.length>0?l.items.slice(0,5).map(f=>`${f.item} ${f.count}`).join(" · ")+(l.items.length>5?` · ${l.items.length-5} more`:""):String(l.count)},l.group))}):null,A>0?e.jsx(I,{label:`Looked at · ${A}`,children:a.lookedAt.map(l=>e.jsx(B,{label:l.title,detail:`${l.methods.join(" · ")} · ${l.count}`},l.title))}):null,e.jsxs(I,{label:`Raw calls · ${u.length}`,children:[y(h),u.length>h.length?C(u.length,()=>m(!0)):null]})]})}function en({item:t}){if(t.connectorPanel)return e.jsx(Ut,{panel:t.connectorPanel});if(t.schemaSections)return e.jsx(M,{item:t});if(t.recordField)return e.jsx(bt,{target:t.recordField});if(t.recordPeer)return e.jsx(Nt,{target:t.recordPeer});if(t.recordLinks)return e.jsx(rs,{target:t.recordLinks});if(t.workStretch)return e.jsx(as,{...t.workStretch});if(typeof t.browserUrl=="string"&&t.browserUrl.length>0)return e.jsx(J,{item:t});const s=t.href?Ue(t.href):null;return s?s.kind==="memory"?"runId"in s?e.jsxs(e.Fragment,{children:[e.jsx(oe,{owner:s.owner,runId:s.runId}),e.jsx(V,{title:"What it produced",children:e.jsx(O,{owner:s.owner,runId:s.runId})}),e.jsx(ce,{owner:s.owner,runId:s.runId})]}):"runIds"in s?e.jsx(O,{owner:s.owner,runIds:s.runIds}):e.jsx(O,{owner:s.owner,contentIds:s.contentIds}):s.kind==="entity"?e.jsx(Xt,{owner:s.owner,path:s.path}):s.kind==="entity-type"?e.jsx(ts,{owner:s.owner,typeSlug:s.typeSlug,view:s.view}):s.kind==="record-view"?e.jsx(is,{owner:s.owner,path:s.path,viewKey:s.viewKey}):s.kind==="event"?e.jsx(ss,{owner:s.owner,eventId:s.eventId,viewKey:s.viewKey}):s.kind==="feed"?e.jsx(ns,{owner:s.owner,feedId:s.feedId,semanticTypes:s.semanticTypes}):s.kind==="agent"?e.jsx(Qt,{owner:s.owner,name:t.title,agentId:s.agentId,clientIds:s.clientIds}):t.runId?e.jsx(os,{owner:s.owner,automationId:s.automationId,runId:t.runId}):e.jsx(cs,{owner:s.owner,automationId:s.automationId}):e.jsx(J,{item:t})}function J({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:qe(r)}),n?e.jsx("span",{children:Ge(n)}):null]})]}),s?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(Ye,{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(Ze,{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(w,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{Xe(i)},children:[e.jsx(Qe,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function V({title:t,children:s}){return e.jsxs("section",{"aria-label":t,className:"border-b",children:[e.jsx("h2",{className:"px-4 pt-4 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:t}),s]})}function ce({owner:t,runId:s}){return t==="me"?null:e.jsx("div",{className:"px-4 py-3",children:e.jsxs(H,{to:"/$owner/events",params:{owner:t},search:{run_ids:String(s)},className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Open in Activity",e.jsx(Je,{"aria-hidden":"true",className:"h-3.5 w-3.5"})]})})}function os({owner:t,automationId:s,runId:r}){const{organizationId:n}=re(t),i=ie(s,void 0,n),o=et(i.data?.automation);return e.jsxs(e.Fragment,{children:[e.jsx(oe,{owner:t,runId:r}),e.jsx(V,{title:"What it produced",children:e.jsx(O,{owner:t,runId:r})}),o?e.jsx(V,{title:"How it ran",children:e.jsx(Vt,{agentId:o,automationId:s,ownerSlug:t,runId:r})}):i.isLoading?e.jsx($,{className:"m-4 h-24 rounded-lg"}):null,e.jsx(ce,{owner:t,runId:r})]})}function cs({owner:t,automationId:s}){const{organizationId:r}=re(t),n=ie(s,void 0,r),i=tt(t,s,n.data?.automation);return e.jsxs("div",{className:"flex flex-col gap-4 px-4 py-4",children:[e.jsx(st,{runNow:i}),e.jsx(nt,{owner:t,agentId:null,automationId:s,view:"activity",onDone:()=>{}})]})}export{en as PeekPaneContent};
|
|
2
|
+
//# sourceMappingURL=peek-pane-content-Cc8YX1oy.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-CdDNNAx2.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-D7-ld7as.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h$ as f,hx as w,hy as y,r as C,j as e,a3 as N,B as d,T as P,f5 as k}from"./index-CdDNNAx2.js";import{b as A}from"./runs-CuC7WMtd.js";function B({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{B as P};
|
|
2
|
+
//# sourceMappingURL=proposal-review-shell-BWRJidwb.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aU as ds,j as e,r as j,c as K,H as te,dN as us,dA as bt,dM as jt,L as ke,a7 as ms,dP as fs,S as kt,dQ as ps,d7 as hs,aN as Ct,aP as T,bp as rt,dR as vs,dS as ys,av as gs,dT as xs,au as bs,d2 as js,dU as ee,cv as ks,dV as St,dW as Cs,ax as Ss,dX as Ns,s as _s,dl as Es,aC as ge,dY as Is,dZ as Ts,n as Nt,cP as _t,d_ as As,cB as ct,d$ as Fs,cT as Rs,cU as Et,e0 as Ps,e1 as ws,cy as Ms,aQ as Ls,dc as $s,U as Os,i as xe,X as Ds,e2 as Bs,e3 as Ks,bU as Gs,e4 as Us,e5 as Vs,e6 as It,br as Qs,bs as Ws,bt as Hs,bu as zs,bv as Ys,e7 as Zs,e8 as Tt,e9 as lt,z as qs,ea as Xs,eb as Re,ec as dt,cQ as Js,ed as en,x as tn,cO as sn,ee as nn,ef as on,t as an,eg as rn,eh as cn,ei as ln,c2 as dn,ej as un,ek as mn,dE as fn,bd as ut,el as mt,em as At,en as Pe,dn as Ft,B as Rt,eo as pn,ep as we}from"./index-CdDNNAx2.js";import{S as D,F as ft,o as X,d as hn,r as vn,f as yn,a as gn}from"./filter-editors-DDTwyYt0.js";import{u as xn}from"./runs-CuC7WMtd.js";import{e as bn,f as Ae,C as Pt,c as jn}from"./event-kind-options-fHAIXu24.js";import{S as kn}from"./source-record-panels-C4UItfdk.js";import{u as Cn}from"./clients-BCvjAJDT.js";import{u as Sn}from"./client-activity-scopes-BBIq16tG.js";import{g as Nn}from"./client-rows-DGh1O-Fu.js";import{E as _n}from"./events-feed-BI7wNRUY.js";import{E as En}from"./run-initiator-B8IRlRd-.js";import{L as In,u as Tn}from"./renderer-DZ0w2k2r.js";import{E as An}from"./agent-loading-shells-xteN-pyK.js";import{M as Fn}from"./member-scope-gate-CH_0jHiM.js";const Oe=j.createContext(null);function Rn({organizationId:t,isWorkspaceLoading:s,children:a}){const{data:n=[],isLoading:o}=ds(t);return e.jsx(Oe.Provider,{value:{groups:n,isLoading:!!s||o},children:a})}function Pn(){const t=j.useContext(Oe);if(!t)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return t}function wn(){return j.useContext(Oe)}function wt(t){const{parse:s,serialize:a,filterKeys:n,clearClassifications:o=!0,replace:i=!0,merge:l}=t,y=K(),d=te(),r=j.useMemo(()=>{const u=new URLSearchParams;for(const[f,p]of Object.entries(d.search||{}))p!=null&&u.set(f,typeof p=="object"&&!Array.isArray(p)?JSON.stringify(p):String(p));return s(u)},[d.search,s]),c=j.useCallback((u,f)=>{const p=l?l(r,u):{...r,...u},v=a(p),k={};for(const[x,S]of Object.entries(d.search||{}))S!=null&&(k[x]=S);for(const x of n)delete k[x];if(o)for(const x of Object.keys(k))x.startsWith("clf_")&&delete k[x];for(const[x,S]of Object.entries(v))S!==void 0&&(k[x]=S);y({to:d.pathname,search:k,replace:f?.replace??i})},[r,a,n,o,l,y,d,i]),g=j.useCallback(()=>{const u={};for(const[f,p]of Object.entries(d.search||{}))p!=null&&(n.includes(f)||o&&f.startsWith("clf_")||(u[f]=p));y({to:d.pathname,search:u,replace:i})},[y,d.pathname,d.search,n,o,i]);return{filters:r,updateFilters:c,clearFilters:g}}function Mn(t){const{slug:s}=us();return bt({queryKey:["schedules",s,t],queryFn:async()=>((await jt("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(n=>n.action_args?.agent_id===t),enabled:!!s&&!!t,staleTime:3e4})}function Ln(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.connection_id)},search:{feedId:s.id}}}function $n(t,s){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:s.connector_key,connectionId:String(s.id)}}}function On(t,s){return{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:s}}}function Dn(t,s){return{to:"/$owner/automations/$automationId",params:{owner:t,automationId:s}}}function Bn(t,s,a){return{to:"/$owner/events",params:{owner:t},search:{agent:s,schedule:a}}}function fe({id:t,label:s,value:a,sourceLink:n,details:o,onRemove:i}){return{id:t,label:s,op:"is",value:a,onRemove:i,editor:n||o?{kind:"custom",className:"w-80",render:()=>e.jsxs("div",{className:"flex flex-col gap-2 p-3 text-sm",children:[n?e.jsxs(ke,{to:n.to,params:n.params,search:n.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(ms,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):e.jsx("span",{className:"font-medium",children:a}),o]})}:void 0}}function Kn({ownerSlug:t,clientIds:s,linkedUser:a,linkedUserEntitySlug:n}){const o=t&&n?fs(t,[{entity_type:"$member",slug:n}]):null;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:s.length===1?"Client ID":"Client IDs"}),s.map(i=>e.jsx("code",{className:"break-all text-foreground",children:i},i))]}),a?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",o?e.jsx(ke,{to:o,className:"font-medium text-foreground hover:underline",children:a}):e.jsx("span",{className:"font-medium text-foreground",children:a})]}):null]})}function Gn(t,s=!0){return bt({queryKey:["automations-list","activity",t],queryFn:async()=>{const a=await Promise.all(["active","archived"].map(n=>jt("manage_automations",{action:"list",status:n,include_details:!1},{slug:t})));return[...new Map(a.flatMap(n=>n.automations).map(n=>[Number(n.automation_id),n])).values()].sort((n,o)=>n.name.localeCompare(o.name))},enabled:s&&!!t,staleTime:3e4})}function J({to:t,params:s,search:a,label:n}){return e.jsx(ke,{to:t,params:s,search:a,onClick:o=>o.stopPropagation(),onPointerDown:o=>o.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 ${n}`,children:e.jsx(kt,{className:"h-3.5 w-3.5"})})}const Me=["produced","analyzed"],be=t=>t==="produced"?"Produced by":"Analyzed by";function Un({enabled:t,...s}){const a=Vn(s,t);if(!t)return{fields:[],chips:[]};const n=Qn(s);return{fields:[a.field,n.field],chips:[...a.chips,...n.chips]}}function Vn({ownerSlug:t,filters:s,onFiltersChange:a},n){const o=Gn(t,n),i=o.data??[],l=c=>c==="produced"?s.producedByAutomationId:s.automationId,y=c=>i.find(g=>Number(g.automation_id)===c)?.name??`#${c}`,d=Me.flatMap(c=>{const g=l(c);return g==null?[]:[{id:`automation-${c}`,field:"automation",label:be(c),value:y(g),onRemove:()=>a(c==="produced"?{producedByAutomationId:null}:{automationId:null})}]}),r={kind:"list",className:"w-80",searchPlaceholder:"Search Automations...",emptyText:o.isLoading?"Loading Automations...":"No Automations found",items:c=>e.jsxs(e.Fragment,{children:[Me.map(g=>{const u=l(g),f=i.map(v=>({id:Number(v.automation_id),label:`${v.name}${v.status==="archived"?" (archived)":""}`}));u!=null&&!f.some(v=>v.id===u)&&f.unshift({id:u,label:`Automation #${u} (selected)`});const p=v=>{a(g==="produced"?{producedByAutomationId:v}:{automationId:v}),c()};return e.jsx(Ct,{heading:be(g),children:f.map(v=>e.jsxs(T,{"aria-label":v.label,value:`${g} ${v.label} ${v.id}`,onSelect:()=>p(v.id),className:"group",children:[e.jsx(D,{selected:u===v.id}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.label}),e.jsx(J,{...Dn(t,String(v.id)),label:v.label})]},v.id))},g)}),o.isError?e.jsx(T,{forceMount:!0,onSelect:()=>void o.refetch(),children:"Could not load Automations. Retry"}):null]})};return{chips:d,field:{key:"automation",label:"Automation",group:"Scope",icon:e.jsx(ps,{className:"h-4 w-4"}),editor:r}}}function Qn(t){const{filters:s,onFiltersChange:a}=t,n=[];s.runIds?.length&&n.push({id:"run-produced",field:"run",label:"Produced by run",value:s.runIds.map(i=>`#${i}`).join(", "),onRemove:()=>a({runIds:null})}),s.runId!=null&&n.push({id:"run-analyzed",field:"run",label:"Analyzed by run",value:`#${s.runId}`,onRemove:()=>a({runId:null})});const o={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,l)=>Me.map(y=>e.jsx(Wn,{...t,mode:y,query:l,close:i},y))};return{chips:n,field:{key:"run",label:"Run",group:"Scope",icon:e.jsx(hs,{className:"h-4 w-4"}),editor:o}}}function Wn({ownerSlug:t,filters:s,onFiltersChange:a,mode:n,query:o,close:i}){const l=n==="produced"?s.producedByAutomationId:s.automationId,y=xn({workspace:!0},{automationIds:l==null?void 0:[l],runTypes:n==="analyzed"?["automation"]:void 0,connectionIds:n==="produced"?s.connectionIds??void 0:void 0,feedIds:n==="produced"?s.feedIds??void 0:void 0},t),d=n==="produced"?s.runIds??[]:s.runId==null?[]:[s.runId],r=y.data?.pages.flatMap(f=>f.runs)??[],c=[...new Map(r.map(f=>[f.id,{id:f.id,label:`Run #${f.id} · ${f.feed_display_name??f.operation_key??f.run_type} · ${f.status}`}])).values()];for(const f of d)c.some(p=>p.id===f)||c.unshift({id:f,label:`Run #${f} (selected)`});const g=f=>{if(n==="produced"){const p=d.includes(f)?d.filter(v=>v!==f):[...d,f];a({runIds:p.length?p:null})}else a({runId:f}),i()},u=/^\d+$/.test(o.trim())?Number(o.trim()):0;return e.jsxs(Ct,{heading:be(n),children:[c.map(f=>e.jsxs(T,{value:`${n} ${f.label}`,onSelect:()=>g(f.id),children:[e.jsx(D,{selected:d.includes(f.id)}),e.jsx("span",{className:"truncate",children:f.label})]},f.id)),Number.isSafeInteger(u)&&u>0&&!c.some(f=>f.id===u)?e.jsxs(T,{value:`${n} ${u}`,onSelect:()=>g(u),children:[be(n)," run #",u]}):null,y.isLoading?e.jsx(T,{disabled:!0,forceMount:!0,children:"Loading runs..."}):null,y.isError?e.jsx(T,{forceMount:!0,onSelect:()=>void(y.isFetchNextPageError?y.fetchNextPage():y.refetch()),children:"Could not load runs. Retry"}):null,!y.isLoading&&!y.isError&&!c.length?e.jsx(T,{disabled:!0,forceMount:!0,children:"No runs found"}):null,y.hasNextPage?e.jsx(T,{forceMount:!0,disabled:y.isFetching,onSelect:()=>void y.fetchNextPage(),children:y.isFetchingNextPage?"Loading more runs...":"Load more runs"}):null]})}const De="Scope",Fe="Source",V="h-4 w-4";function se(){return te().search??{}}function Mt(t){const{pathname:s}=te(),a=s.startsWith(`/${t}/events/`),n=gs(s,a?1:0),o=!!(n&&!a&&!xs(n.split("/")[0]));return{pathname:s,embedded:o,recordPath:o?bs(n)?.entityPath:a?n:void 0}}function Lt(t){const s=se(),{recordPath:a,pathname:n,embedded:o}=Mt(t);return i=>{const l=ee(t,s,i,a);return o?{to:n,search:l.search}:l}}const pt=t=>new Set((t??"").split(",").map(s=>s.trim()).filter(Boolean));function Hn({ownerSlug:t,sourceRead:s=!1,filters:a,onFiltersChange:n}){const o=se(),{recordPath:i,embedded:l}=Mt(t),y=i?i.split("/").at(-2):void 0,d=typeof o.type=="string"&&o.type.trim()?o.type.trim():void 0,r=(y?rt(y):void 0)??(d?rt(d):void 0),c=vs(o),g=ys(o),u=typeof o.feed_ids=="string"?o.feed_ids:typeof o.feed_ids=="number"?String(o.feed_ids):void 0,f=zn(t,r,!l),p=Yn(t,r,i,l),v=Zn(t,c,!s),k=Un({ownerSlug:t,filters:a,onFiltersChange:n,enabled:!s}),x=qn(t,g,u);return[f,p,v,k,x].reduce((S,M)=>({fields:[...S.fields,...M.fields],chips:[...S.chips,...M.chips]}),{fields:[],chips:[]})}function zn(t,s,a){const n=K(),o=se(),{visible:i}=js(t);if(!a)return{fields:[],chips:[]};const l=i.find(d=>d.slug===s),y={kind:"list",searchPlaceholder:"Search types...",emptyText:"No entity types",items:d=>e.jsxs(e.Fragment,{children:[i.map(r=>e.jsxs(T,{onSelect:()=>{n(ee(t,o,{entity:void 0,create:void 0,type:r.slug})),d()},className:"group gap-2",children:[e.jsx(D,{selected:r.slug===s}),e.jsx(Rs,{icon:r.icon,className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),typeof r.entity_count=="number"?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:r.entity_count}):null,e.jsx(J,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:r.slug},label:r.name})]},r.id)),e.jsxs(T,{onSelect:()=>{n(Ps(t)),d()},className:"text-muted-foreground",children:[e.jsx(Et,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})};return{fields:[{key:"type",label:"Entity type",group:De,icon:e.jsx(ks,{className:V}),editor:y}],chips:s?[{id:"type",label:"Entity type",op:"is",value:l?.name??s,onRemove:()=>void n(ee(t,o,{type:void 0}))}]:[]}}function Yn(t,s,a,n){const o=K(),i=se(),[l,y]=j.useState(""),[d,r]=j.useState(0),c=St(l,250),g={slug:t},{data:u,isLoading:f,isError:p,refetch:v}=Cs(s??"",g,{search:c,offset:d,limit:30,enabled:!n&&!!s}),{data:k}=Ss(a?`/${t}/${a}`:"",g),x=a?k?.entity:void 0,S=x?.name??(a?a.split("/").at(-1):void 0);if(n)return{fields:[],chips:S?[{id:"entity",label:"Entity",op:"is",value:S}]:[]};if(!s)return{fields:[],chips:[]};const M={kind:"list",searchPlaceholder:"Search entities...",emptyText:f?"Loading entities...":"No matching entities",className:"w-80",onQueryChange:F=>{y(F),r(0)},items:F=>e.jsxs(e.Fragment,{children:[p?e.jsx(T,{onSelect:()=>void v(),children:"Could not load entities. Retry"}):u?.entities.map(E=>e.jsxs(T,{value:E.slug,onSelect:()=>{const R=ws([...E.parent_slug&&E.parent_entity_type?[{entity_type:E.parent_entity_type,slug:E.parent_slug}]:[],{entity_type:E.entity_type,slug:E.slug}]);o(ee(t,i,{type:s},R)),F()},children:[e.jsx(D,{selected:x?.slug===E.slug}),E.name]},E.slug)),d>0&&e.jsx(T,{onSelect:()=>r(Math.max(0,d-30)),children:"Previous entities"}),u?.metadata.has_more&&e.jsx(T,{disabled:f,onSelect:()=>r(d+30),children:"More entities"})]})};return{fields:[{key:"entity",label:"Entity",group:De,icon:e.jsx(Ns,{className:V}),editor:M}],chips:S?[{id:"entity",label:"Entity",op:"is",value:S,onRemove:()=>void o(ee(t,i,{type:s}))}]:[]}}function Zn(t,s,a){const n=K(),o=Lt(t),{data:i=[]}=_s(),l=j.useMemo(()=>[...i].sort((r,c)=>r.name.localeCompare(c.name)),[i]);if(!a)return{fields:[],chips:[]};const y=l.find(r=>r.agentId===s),d={kind:"list",searchPlaceholder:"Search agents...",emptyText:"No agents",items:r=>l.map(c=>e.jsxs(T,{onSelect:()=>{n(o({agent:c.agentId,schedule:void 0})),r()},className:"gap-2",children:[e.jsx(D,{selected:c.agentId===s}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:c.name.trim().charAt(0).toUpperCase()||"?"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name})]},c.agentId))};return{fields:[{key:"agent",label:"Agent",group:De,icon:e.jsx(Es,{className:V}),editor:d}],chips:s?[{id:"agent",label:"Agent",op:"is",value:y?.name??s,onRemove:()=>void n(o({agent:void 0,schedule:void 0}))}]:[]}}function qn(t,s,a){const n=K(),o=Lt(t),{groups:i}=Pn(),l=se(),y=ge({platforms:String(l.platforms??l.platform??"")}).platforms??[],d=j.useMemo(()=>pt(s),[s]),r=j.useMemo(()=>pt(a),[a]),c=y.length===1?y[0]:Is(i,d),g=i.find(I=>I.connector_key===c),u=d.size===1?Number([...d][0]):void 0,f=Ts(u),{org:p}=Nt(),v=_t(p?.id,{feedIds:[...r].map(Number),enabled:u==null&&r.size>0}),k=u==null?v:f,x=k.data??[],S={platforms:void 0,platform:void 0,connection_ids:void 0,feed_ids:void 0},M={kind:"list",searchPlaceholder:"Search connectors...",emptyText:"No connectors",items:I=>e.jsxs(e.Fragment,{children:[i.map(N=>{const A=N.connector_name??N.connector_key;return e.jsxs(T,{disabled:N.connections.length===0,onSelect:()=>{n(o({...S,platforms:N.connector_key})),I()},className:"group gap-2",children:[e.jsx(D,{selected:N.connector_key===g?.connector_key}),e.jsx(Ls,{plain:!0,name:A,faviconDomain:N.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:A}),N.connection_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:N.connection_count}):null,e.jsx(J,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:N.connector_key},label:A})]},N.connector_key)}),e.jsx(T,{asChild:!0,onSelect:I,className:"text-muted-foreground",children:e.jsxs(ke,{to:"/$owner/connectors/create",params:{owner:t},className:"flex items-center gap-2",children:[e.jsx(Et,{className:"h-4 w-4 shrink-0"}),"Add connector"]})})]})},F=[{key:"connector",label:"Connector",group:Fe,icon:e.jsx(Ms,{className:V}),editor:M}],E=[],R=g?.connector_name??g?.connector_key??(y.join(", ")||(d.size?`Connections ${[...d].join(", ")}`:void 0));if(R&&E.push({id:"connector",label:"Connector",op:"is",value:R,onRemove:()=>void n(o(S))}),g){F.push({key:"connection",label:"Connection",group:Fe,icon:e.jsx(As,{className:V}),editor:Q(g)});const I=d.size===1?g.connections.find(N=>d.has(String(N.id))):void 0;I&&E.push({id:"connection",label:"Connection",op:"is",value:ct({display_name:I.display_name,connector_name:g.connector_name,connector_key:g.connector_key}),onRemove:()=>void n(o({...S,platforms:g.connector_key}))})}if((u||a)&&F.push({key:"feed",label:"Feed",group:Fe,icon:e.jsx(Fs,{className:V}),editor:G()}),r.size>0){const I=r.size===1?x.find(N=>r.has(String(N.id))):void 0;E.push({id:"feed",label:"Feed",op:"is",value:I?pe(I):`#${a}`,onRemove:()=>void n(o({...u!=null?{connection_ids:String(u)}:{},feed_ids:void 0}))})}return{fields:F,chips:E};function Q(I){return{kind:"list",searchPlaceholder:"Search connections...",emptyText:"No connections",items:N=>I.connections.map(A=>{const b=ct({display_name:A.display_name,connector_name:I.connector_name,connector_key:I.connector_key});return e.jsxs(T,{onSelect:()=>{n(o({connection_ids:String(A.id),feed_ids:void 0})),N()},className:"group gap-2",children:[e.jsx(D,{selected:d.has(String(A.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:b}),A.feed_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:A.feed_count}):null,e.jsx(J,{...$n(t,{id:A.id,connector_key:I.connector_key}),label:b})]},A.id)})}}function G(){return{kind:"list",searchPlaceholder:"Search feeds...",emptyText:k.isLoading?"Loading feeds...":"No feeds",items:I=>x.map(N=>e.jsxs(T,{"aria-label":pe(N),onSelect:()=>{n(o({...u!=null?{connection_ids:String(u)}:{},feed_ids:String(N.id)})),I()},className:"group gap-2",children:[e.jsx(D,{selected:r.has(String(N.id))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:pe(N)}),e.jsx(J,{...Ln(t,N),label:pe(N)})]},N.id))}}}function pe(t){return t.display_name?.trim()||t.feed_key}const je=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}];function Xn({value:t,onChange:s}){const a=je.find(n=>n.value===t)?.label??"Newest first";return e.jsxs(Qs,{value:t,onValueChange:s,children:[e.jsxs(Ws,{"aria-label":"Sort",className:"h-8 w-auto shrink-0 gap-2 bg-muted px-2.5",children:[e.jsx(It,{"aria-hidden":"true",className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(Hs,{children:a})]}),e.jsx(zs,{align:"end",className:"min-w-40",children:je.map(n=>e.jsx(Ys,{value:n.value,children:n.label},n.value))})]})}const ht=[{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],vt=[{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],he=0,ve=100,q="Event",U="h-4 w-4";function Jn(t,s,a){const n=t.engagementRange??[he,ve],o=t.reviewStatus,i=t.interactionStatus,l=t.semanticTypes??[],y=[{key:"kind",label:"Event kind",group:q,icon:e.jsx(Bs,{className:U}),editor:X({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:bn(a,l).map(c=>({value:c,label:Ae(c)})),selected:l,multiple:!0,onSelect:c=>{const g=l.includes(c)?l.filter(u=>u!==c):[...l,c];s({semanticTypes:g.length>0?g:void 0})}})},{key:"date",label:"Date",group:q,icon:e.jsx(Ks,{className:U}),editor:hn({value:t.dateRange??void 0,onApply:c=>s({dateRange:c})})},{key:"approval",label:"Approval",group:q,icon:e.jsx(Gs,{className:U}),editor:X({searchPlaceholder:"Search statuses...",options:[...vt],selected:i?[i]:[],onSelect:c=>s({interactionStatus:c})})},{key:"review",label:"Reviewed by",group:q,icon:e.jsx(Us,{className:U}),editor:X({searchPlaceholder:"Search reviewers...",options:[...ht],selected:o&&o!=="all"?[o]:[],onSelect:c=>s({reviewStatus:c})})},{key:"score",label:"Engagement score",group:q,icon:e.jsx(Vs,{className:U}),editor:vn({value:n,min:he,max:ve,onApply:c=>s({engagementRange:c})})}],d=[],r=t.eventCategory!=null&&l.length===1&&l[0]===Pt;return l.length&&!r&&d.push({id:"kind",label:"Kind",value:l.length<=2?l.map(Ae).join(", "):`${l.length} kinds`,title:l.map(Ae).join(", "),onRemove:()=>s({semanticTypes:void 0})}),t.dateRange&&d.push({id:"date",label:"Date",op:"is",value:yn(t.dateRange),onRemove:()=>s({dateRange:null})}),i&&d.push({id:"approval",label:"Approval",op:"is",value:vt.find(c=>c.value===i)?.label??i,onRemove:()=>s({interactionStatus:null})}),o&&o!=="all"&&d.push({id:"review",label:"Reviewed by",op:"is",value:ht.find(c=>c.value===o)?.label??o,onRemove:()=>s({reviewStatus:void 0})}),(n[0]!==he||n[1]!==ve)&&d.push({id:"score",label:"Engagement score",value:gn(n,he,ve),onRemove:()=>s({engagementRange:void 0})}),{fields:y,chips:d}}function $t({filters:t,onFiltersChange:s,eventKinds:a=[],searchQuery:n,onSearchChange:o,scope:i,extraFields:l=[],drillChips:y=[],sourceRead:d=!1,filterTrailing:r,filterActions:c,quickFilters:g,toolbar:u=!1,onClearFilters:f}){const p=n.trim().length>0,v=d?{fields:[],chips:[]}:Jn(t,s,a),k=`${t.sortBy??"date"}-${t.sortOrder??"desc"}`,x=R=>{const[Q,G]=R.split("-");s({sortBy:Q,sortOrder:G})},S=u&&!d?{fields:[{key:"sort",label:"Order",group:"Order",icon:e.jsx(It,{className:U}),editor:X({searchPlaceholder:"Search orders...",options:[...je],selected:[k],onSelect:x})}],chips:k==="date-desc"?[]:[{id:"sort",label:"Order",value:je.find(R=>R.value===k)?.label??k,onRemove:()=>s({sortBy:"date",sortOrder:"desc"})}]}:{fields:[],chips:[]},M=[...g?.fields??[],...v.fields,...i?.fields??[],...l,...S.fields],F=[...g?.chips??[],...i?.chips??[],...y,...v.chips,...S.chips],E=d?null:e.jsxs("div",{className:xe("relative min-w-0",u?"w-64 max-w-full":"flex-1"),children:[e.jsx($s,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Os,{type:"search","aria-label":"Search events",placeholder:"Search events...",value:n,onChange:R=>o(R.target.value),className:xe("h-8 pl-9",p&&"pr-9")}),p&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>o(""),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:e.jsx(Ds,{className:"h-3.5 w-3.5"})})]});return u?e.jsx(ft,{label:"Event filters",clearAllMin:2,fields:M,chips:F,actions:c,trailing:e.jsxs(e.Fragment,{children:[r,E]}),onClearAll:f,hasClearableState:p,className:"w-full"}):e.jsxs("div",{className:"w-full space-y-2.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[E,!d&&e.jsx(Xn,{value:k,onChange:x})]}),e.jsx(ft,{label:"Event filters",fields:M,chips:F,actions:c,trailing:r,onClearAll:f,hasClearableState:p})]})}function Ot({ownerSlug:t,...s}){const a=Hn({ownerSlug:t,sourceRead:s.sourceRead,filters:s.filters,onFiltersChange:s.onFiltersChange});return e.jsx($t,{...s,scope:a})}const Le=3600*1e3,yt=24*Le;function gt(t){const s=t instanceof Date?t:new Date(String(t));return Number.isNaN(s.getTime())?null:s}function xt(t){return t.toISOString().split("T")[0]}function $e(t){return t.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",day:"numeric"})}function eo(t){const a=t[t.length-1].date.getTime()-t[0].date.getTime()>180*yt,n=new Map;for(const o of t){const i=new Date(o.date);a&&i.setUTCDate(i.getUTCDate()-i.getUTCDay()),n.set(i.getTime(),(n.get(i.getTime())??0)+o.count)}return[...n.entries()].sort(([o],[i])=>o-i).map(([o,i])=>{const l=new Date(o);return{start:l,end:new Date(o+(a?7:1)*yt),count:i,label:`${l.getUTCMonth()+1}/${l.getUTCDate()}`,tooltip:a?`Week of ${$e(l)}`:$e(l)}})}function to(t){const s=l=>{const y=new Date(l);return y.setMinutes(0,0,0),y.getTime()},a=new Map;for(const l of t)a.set(s(l),(a.get(s(l))??0)+1);const n=Math.min(...a.keys()),o=Math.max(...a.keys()),i=[];for(let l=n;l<=o;l+=Le){const y=new Date(l);i.push({start:y,end:new Date(l+Le),count:a.get(l)??0,label:lt(y,"HH:mm"),tooltip:lt(y,"MMM d, HH:mm")})}return i}function so({entityId:t,organizationId:s,ownerSlug:a,eventTimes:n,selectedRange:o,onSelectRange:i}){const{data:l,isLoading:y,error:d}=Zs(s,{entityId:t},{slug:a}),r=j.useMemo(()=>(l??[]).map(p=>{const v=gt(p.date);return v?{date:v,count:p.count}:null}).filter(p=>p!==null).sort((p,v)=>p.date.getTime()-v.date.getTime()),[l]),c=j.useMemo(()=>{if(r.length===0)return[];if(r.length>1)return eo(r);const[p]=r,v=xt(p.date),k=(n??[]).map(gt).filter(x=>x!==null&&xt(x)===v);return k.length===p.count?to(k):[]},[r,n]),g=j.useCallback(p=>{const v=c[p.dataIndex];v&&i&&i(v.start,v.end)},[c,i]),u=j.useCallback(p=>{if(i&&p.startValue!==void 0&&p.endValue!==void 0){const v=new Date(p.startValue),k=new Date(p.endValue);i(v,k)}},[i]),f=j.useMemo(()=>{if(c.length<2)return null;let p;if(o){const[v,k]=o,x=c.filter(S=>S.start<k&&S.end>v);x.length>0&&(p=[[{xAxis:x[0].label},{xAxis:x[x.length-1].label}]])}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:v=>{const k=v[0];return`${c[k.dataIndex]?.tooltip}: ${k.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:c.map(v=>v.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 In(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:c.map(v=>v.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:p?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:p}:void 0}]}},[c,o]);if(y||d)return e.jsx("div",{className:xe(Tt,"p-4"),children:e.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:y?e.jsx(An,{}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})});if(r.length===0)return null;if(!f){const[p]=r;return e.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.count===1?"1 event":`All ${p.count} events`," on"," ",$e(p.date),"."]})}return e.jsx(no,{option:f,onClick:g,onDataZoom:u})}function no({option:t,onClick:s,onDataZoom:a}){const{chartRef:n,setOption:o}=Tn({onClick:s,onDataZoom:a});return j.useEffect(()=>{o(t,!0)},[t,o]),e.jsx("div",{"data-testid":"events-timeline",className:xe(Tt,"p-4 relative"),children:e.jsx("div",{ref:n,className:"h-48 w-full"})})}const ye={config:"Configuration",deployment:"Applies"};function oo({organizationId:t,ownerSlug:s,entityId:a,hideSourceFilter:n=!1,scopedEntityTypes:o,pinned:i,emptyState:l,toolbar:y=!1}){const{isAuthenticated:d,isReady:r}=qs(),{isMember:c,isLoading:g}=Nt(),u=r&&d&&c,f=r&&(!d||!g&&!c),p=K(),v=te(),k=Xs(),{filters:x,updateFilters:S,clearFilters:M}=wt({parse:ge,serialize:Pe,filterKeys:Ft,replace:!1,merge:At}),[F,E]=j.useState(x.searchQuery||""),[R,Q]=j.useState(Re(x)||n&&(a!=null||!!o?.length)),G=F.trim(),I=G.length>=3?G:void 0,N=St(I,1e3),A=j.useRef(!1);j.useEffect(()=>k.history.subscribe(({location:m,action:h})=>{const C=ge(new URLSearchParams(m.search)).searchQuery??"";!(h.type==="BACK"||h.type==="FORWARD"||h.type==="GO")&&A.current&&(C===(x.searchQuery??"")||C===(I??""))||(A.current=!1,E(C))}),[k.history,I,x.searchQuery]);const b=j.useMemo(()=>{const{afterOccurredAt:m,afterId:h,...C}=x;return dt({...C,...o?.length?{entityTypes:o}:{}})},[x,o]),P=S;j.useEffect(()=>{A.current&&(x.searchQuery||void 0)!==N&&S({searchQuery:N})},[N,S,x.searchQuery]);const Be=()=>{A.current=!1,E(""),n&&s?p({...we(s,v.search??{}),...a!==void 0&&!v.pathname.startsWith(`/${s}/events/`)?{to:v.pathname}:{}}):M()},ne=Re(dt(x)),Ce=a===void 0,{data:Dt=[]}=Js(r&&u?t:null),{data:Bt=[]}=en(f?s:null),Ke=u?Dt:Bt,{data:Ge=[]}=tn(u&&t?{organizationId:t}:void 0),oe=wn(),ae=b.connectionIds,Se=(ae?.length??0)>0,{data:Ue=[]}=sn(r&&u?t??"":"",{connectionIds:ae??void 0,enabled:!oe&&r&&u&&Se}),Ve=b.feedIds,Ne=(Ve?.length??0)>0,{data:Qe=[]}=_t(r&&u?t:null,{feedIds:Ve??void 0,enabled:r&&u&&Ne}),We=j.useMemo(()=>oe?oe.groups.flatMap(m=>m.connections.map(h=>({id:h.id,display_name:h.display_name,connector_name:m.connector_name,connector_key:m.connector_key}))):Ue,[Ue,oe]),_e=j.useMemo(()=>{const m=new Set(ae??[]);return[...new Set([...b.platforms??[],...We.filter(h=>m.has(h.id)).map(h=>h.connector_key)])]},[ae,We,b.platforms]),Ee=j.useMemo(()=>Qe.map(m=>({connectorKey:m.connector_key,feedKey:m.feed_key})),[Qe]),Kt=j.useMemo(()=>Se&&_e.length===0||Ne&&Ee.length===0?[]:jn({connectors:Ke,entityTypes:Ge,selectedPlatforms:_e,selectedFeeds:Ee,selectedEntityTypes:b.entityTypes}),[Ke,b.entityTypes,Se,Ne,_e,Ee,Ge]),w=b.clientIds,ie=(w?.length??0)>0,{data:He=[]}=Cn(null,{enabled:r&&u&&ie}),re=j.useMemo(()=>{if(!w)return[];const m=new Set(w);return Nn(He).filter(h=>h.clientIds.some(C=>m.has(C)))},[w,He]),ze=j.useMemo(()=>{if(!ie||!w)return null;const m=re.map(h=>h.title);return m.length>0?m.join(", "):w.length>1?`${w.length} client registrations`:"Client registration"},[re,w,ie]),ce=re.length===1?re[0]:null,Gt=s&&ce?On(s,ce.clientId):void 0,le=b.mcpActivityId??null,{data:Ye=[]}=Sn({enabled:r&&u&&ie&&!!le,clientIds:w??[],limit:100}),Ze=j.useMemo(()=>{if(!le)return null;const m=Ye.find(C=>C.activityId===le);if(!m)return"Selected conversation";const h=m.title?.trim();return h||(m.activityKind==="session"?"MCP session":m.clientId)},[le,Ye]),W=b.agentId,H=b.schedule,{data:qe=[]}=Mn(W??void 0),Xe=j.useMemo(()=>!H||!W?null:qe.find(h=>h.id===H)?.description?.trim()||"Scheduled task",[W,H,qe]),{data:Ut}=nn(r&&u?t:null,a),{data:Vt}=on(f&&!Ce?s:null,a),Je=u?Ut:Vt,de=j.useMemo(()=>{const m=new Map;for(const h of Je||[]){const C=h.automation_name??"__global__";let _=m.get(C);_||(_={automationName:h.automation_name??null,classifiers:[]},m.set(C,_));const $=h.attribute_values||{},L=Object.keys($);let me=null;const z={};for(const[Y,B]of Object.entries($))if(B.parent)for(const[Te,Z]of Object.entries(B.parent))me=Te,z[Z]||(z[Z]=[]),z[Z].push(Y);const O=_.classifiers.find(Y=>Y.slug===h.slug);if(O){const Y=new Set([...O.values,...L]);O.values=[...Y];for(const[B,Te]of Object.entries(z)){O.valuesByParentValue[B]||(O.valuesByParentValue[B]=[]);const Z=new Set([...O.valuesByParentValue[B],...Te]);O.valuesByParentValue[B]=[...Z]}me&&(O.parentSlug=me)}else _.classifiers.push({slug:h.slug,name:h.name,values:L,parentSlug:me,valuesByParentValue:z})}for(const h of m.values())h.classifiers.sort((C,_)=>C.parentSlug===null&&_.parentSlug!==null?-1:C.parentSlug!==null&&_.parentSlug===null?1:0);return[...m.values()]},[Je]),Qt=an(r&&u?t:null,a,b,s),Wt=rn(f?s:null,a,b),Ht=f?Wt:Qt,{data:Ie,isLoading:zt,error:Yt}=Ht,Zt=j.useMemo(()=>Ie?.pages.flatMap(m=>m.content.map(h=>h.occurred_at)),[Ie]),et=Ie?.pages[0],qt=(et?.content.length??0)>0,tt=de.some(m=>m.classifiers.length>0),Xt=cn(r&&u&&tt?t:null,a,b,s),Jt=ln(f&&tt?s:null,a,b),es=(f?Jt:Xt).data?.classification_stats,ts=j.useCallback(()=>{P({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[P]),ss=(m,h)=>{P({dateRange:[m,h]})},st=(m,h)=>{const C={...b.classificationFilters||{}};if(h.length>0)C[m]=h;else{delete C[m];for(const _ of de)for(const $ of _.classifiers)$.parentSlug===m&&delete C[$.slug]}P({classificationFilters:C})},ns=(m,h)=>{const C=b.classificationFilters?.[m]||[];st(m,C.includes(h)?C.filter(_=>_!==h):[...C,h])},os=m=>st(m,[]);if(Yt)return e.jsx(dn,{label:"knowledge"});const nt=!r||d&&g||u&&!t||zt,ue={fields:[],chips:[]};for(const m of de)for(const h of m.classifiers){const C=b.classificationFilters?.[h.slug]??[],_=h.parentSlug?b.classificationFilters?.[h.parentSlug]??[]:void 0,$=_?[...new Set(_.flatMap(L=>h.valuesByParentValue[L]??[]))]:h.values;$.length>0&&ue.fields.push({key:`clf:${h.slug}`,label:h.name,group:m.automationName??"Classifiers",icon:e.jsx(un,{className:"h-4 w-4"}),editor:X({searchPlaceholder:`Search ${h.name.toLowerCase()}...`,options:$.map(L=>({value:L,label:L,count:es?.[h.slug]?.[L]})),selected:C,multiple:!0,onSelect:L=>ns(h.slug,L)})})}for(const[m,h]of Object.entries(b.classificationFilters??{})){if(h.length===0)continue;const C=de.flatMap(_=>_.classifiers).find(_=>_.slug===m);ue.chips.push({id:`clf:${m}`,field:`clf:${m}`,label:C?.name??m,op:h.length>1?"is any of":"is",value:h.join(", "),onRemove:()=>os(m)})}const as=[b.contentIds?.length?fe({id:"contentIds",label:b.contentIds.length>1?"Events":"Event",value:`#${b.contentIds.join(", #")}`,onRemove:()=>P({contentIds:void 0})}):null,Ze?fe({id:"mcpActivityId",label:"Conversation",value:Ze,onRemove:()=>P({mcpActivityId:void 0})}):null,ze?fe({id:"clientIds",label:"Connected app",value:ze,sourceLink:Gt,details:w&&w.length>0?e.jsx(Kn,{ownerSlug:s,clientIds:w,linkedUser:ce?.linkedUser,linkedUserEntitySlug:ce?.linkedUserEntitySlug}):void 0,onRemove:()=>P({clientIds:void 0})}):null,Xe?fe({id:"schedule",label:"Schedule",value:Xe,sourceLink:s&&W&&H?Bn(s,W,H):void 0,onRemove:()=>P({schedule:void 0,runIds:void 0})}):null,...b.eventCategory?[ye[b.eventCategory]?{id:"event-category",label:ye[b.eventCategory],value:"",onRemove:()=>P({eventCategory:void 0,semanticTypes:void 0})}:{id:"event-category",label:"Category",op:"is",value:b.eventCategory,onRemove:()=>P({eventCategory:void 0})}]:[],...b.resourceKind||b.resourceId?[{id:"resource",label:"Resource",op:"is",value:`${b.resourceKind}: ${b.resourceId}`,onRemove:()=>P({resourceKind:void 0,resourceId:void 0})}]:[],...ue.chips].filter(m=>m!=null),is=!!(u&&a&&t),rs=ne?null:i?.rows,ot={fields:[],chips:[]};if(Ce&&u)for(const[m,h,C]of[["config",ye.config,kt],["deployment",ye.deployment,mn]]){const _=x.eventCategory===m;ot.fields.push({key:`category:${m}`,label:h,icon:e.jsx(C,{className:"h-4 w-4"}),editor:{kind:"toggle",checked:_,onToggle:()=>P({eventCategory:_?void 0:m,semanticTypes:_?void 0:[Pt],resourceKind:void 0,resourceId:void 0})}})}const at={quickFilters:ot,toolbar:y,filterTrailing:is?e.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground","aria-pressed":R,onClick:()=>Q(m=>!m),children:[e.jsx(pn,{className:"mr-1.5 h-3.5 w-3.5"}),"Timeline"]}):void 0,onClearFilters:Be,filters:b,onFiltersChange:P,eventKinds:Kt,searchQuery:F,onSearchChange:m=>{A.current=!0,E(m)},extraFields:ue.fields,drillChips:as},cs=!nt&&!!et&&!qt&&!ne,ls=d?u?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",it=!!(u&&s);return e.jsx(fn,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:n?"sticky top-0 z-10 -mx-4 bg-background px-4 pb-2 lg:-mx-6 lg:px-6":void 0,children:n&&s?e.jsx(Ot,{...at,ownerSlug:s}):e.jsx($t,{...at})}),R&&u&&a&&t&&e.jsx(so,{entityId:a,organizationId:t,ownerSlug:s||"",eventTimes:Zt,selectedRange:b.dateRange||void 0,onSelectRange:ss}),i?.needsYou,rs,nt?e.jsx(En,{}):cs?l??e.jsx(ut,{icon:mt,title:"No activity yet",description:ls,actionLabel:it?"Add a connector":void 0,onAction:it&&s?()=>void p({to:"/$owner/connectors/create",params:{owner:s}}):void 0}):e.jsx(_n,{organizationId:t,ownerSlug:s,entityId:a,filters:b,showEntityLinks:Ce,groupStretches:!0,onGoToLatest:b.beforeOccurredAt?ts:void 0,hiddenPinned:i?.hidden,emptyState:e.jsx(ut,{icon:mt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:ne?"Clear filters":void 0,onAction:ne?Be:void 0})})]})})}function ao({record:t,ownerSlug:s}){const a=te(),n=K(),{filters:o,updateFilters:i}=wt({parse:ge,serialize:Pe,filterKeys:Ft,replace:!1,merge:At}),l=Re({...o,platforms:void 0,connectionIds:void 0,feedIds:void 0})||o.sortBy!=null&&o.sortBy!=="date"||o.sortOrder!=null&&o.sortOrder!=="desc",y=()=>{n({...we(s,a.search??{}),...a.pathname.startsWith(`/${s}/events/`)?{}:{to:a.pathname}})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ot,{ownerSlug:s,sourceRead:!0,filters:o,onFiltersChange:i,searchQuery:o.searchQuery??"",onSearchChange:d=>i({searchQuery:d}),onClearFilters:y}),e.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."}),l?e.jsxs("div",{role:"alert",className:"space-y-2 rounded-md border p-3 text-sm",children:[e.jsx("p",{children:"Some selected filters aren't supported for live activity. Clear them to see results."}),e.jsx(Rt,{variant:"outline",size:"sm",onClick:()=>{const d=Pe({platforms:o.platforms,connectionIds:o.connectionIds,feedIds:o.feedIds}),r={...we(s,a.search??{}).search,...d};n({to:a.pathname,search:r})},children:"Clear unsupported filters"})]}):e.jsx(kn,{record:t,orgContext:{slug:s},filters:o})]})}function ko({entity:t,organizationId:s,ownerSlug:a}){const n=t.is_derived?e.jsx(ao,{ownerSlug:a,record:{type:t.entity_type,key:t.slug}}):e.jsx(oo,{organizationId:s,ownerSlug:a,entityId:typeof t.id=="number"?t.id:void 0,hideSourceFilter:!0});return e.jsx(Rn,{organizationId:s,children:t.entity_type==="$member"?e.jsx(Fn,{children:n}):n})}export{oo as E,Rn as M,ko as R};
|
|
2
|
+
//# sourceMappingURL=record-activity-9ux6SfCd.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-CdDNNAx2.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-ClKBr1_C.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fd as iB,ex as oB,j as V,dF as kI,dG as OI,bU as sB,dH as NI,fI as F_,dE as lB,i as pd,fJ as uB,r as ze,dW as fB,fK as vB,fL as cB,dP as hB,fg as vm,ax as BI,L as dB,c as pB,u as gB,eH as yB,eI as mB,m as pp,B as Wu,A as _B,fM as SB,a7 as VI,fB as xB,fN as wB,fO as bB,k as CB,C as TB,e8 as AB,eW as MB,bH as DB}from"./index-CdDNNAx2.js";import{S as cm,i as hm,t as dm,f as IB}from"./schema-value-k19Ata7u.js";import{c as LB,d as PB,b as RB,a as EB,C as kB}from"./card-C01y1O-W.js";import{T as OB,a as NB,b as gp,c as BB,d as VB,e as Rx}from"./table-C3DMoL4K.js";function zB(r){return String(r??"").split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function FB(r,e){return e.title||e.description||zB(r)}function GB(r){return r.title&&r.description&&r.description!==r.title?r.description:void 0}function HB({control:r}){const e=[r.set_by,r.set_at?oB(r.set_at):null].filter(Boolean).join(" · ");return V.jsxs(kI,{children:[V.jsx(OI,{asChild:!0,children:V.jsx("button",{type:"button",className:"shrink-0 text-emerald-600 hover:text-emerald-500 dark:text-emerald-400","aria-label":"Set by a person",children:V.jsx(sB,{className:"h-3 w-3"})})}),V.jsxs(NI,{className:"max-w-xs space-y-1",children:[V.jsx("div",{className:"text-xs font-medium",children:"Set by a person"}),V.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:"Automations ask for approval before changing it."}),r.note?V.jsx("div",{className:"text-xs text-primary-foreground/90",children:r.note}):null,e?V.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:e}):null]})]})}function UB(r){const e=iB(r);return e===null||e===""?void 0:e}function WB(r){return r.parent_id&&r.parent_slug&&r.parent_entity_type?[{entity_type:r.parent_entity_type,slug:r.parent_slug},{entity_type:r.entity_type,slug:r.slug}]:[{entity_type:r.entity_type,slug:r.slug}]}function Une(r){return typeof r=="string"?JSON.parse(r):r??{}}function $B(r){return r.type==="array"&&!!r.items&&(r.items?.type==="object"||!!r.items?.properties)}function zI(r){return(r.type==="object"||!!r.properties)&&Object.keys(r.properties??{}).length>0}function YB(r){const e=r?.properties;return F_(e).filter(([,t])=>!("x-measure"in t)&&!("x-dimension"in t)).map(([t,n])=>({key:t,prop:n}))}function pm(r){return r.label??r.prop["x-table-label"]??FB(r.key,r.prop)}function FI(r){try{return UB(r)}catch{return r instanceof uB?r.text:r}}function gm(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ym(r,e){const t=FI(e);return t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:gm(t)?zI(r.prop)?F_(r.prop.properties).some(([n,a])=>ym({prop:a},t[n])):Object.entries(t).some(([n,a])=>ym({prop:{}},a)):!0}function GI(r,e){return r.filter(t=>ym(t,e[t.key]))}function XB({value:r,prop:e,ownerSlug:t,orgContext:n}){const a=e["x-link-entity-type"],i=e["x-link-lookup-field"]||"slug",{data:o}=fB(a,n,{limit:vB}),s=c=>{const h=o?.entities.find(d=>{const p=i==="slug"?d.slug:d.metadata?.[i];return p!=null&&String(p)===c});return h?{label:h.name,to:hB(t,WB(h))}:void 0},l=Array.isArray(r)?r:[r],u=c=>i==="slug"&&o!==void 0&&ZB(c)&&!s(String(c));if(!l.some(u))return V.jsx(cm,{value:r,prop:e,resolveLink:s});const f=[...new Set(l.map(String))],v=new Map(l.map(c=>[String(c),c]));return V.jsx("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:f.map(c=>v.get(c)).map(c=>u(c)?V.jsx(jB,{entityType:a,recordKey:String(c),ownerSlug:t},String(c)):V.jsx(cm,{value:c,prop:Array.isArray(r)?e.items??e:e,resolveLink:s},String(c)))})}function ZB(r){const e=typeof r=="number"?String(r):r;return typeof e=="string"&&e.trim()!==""&&!/[/?#]/.test(e)}function jB({entityType:r,recordKey:e,ownerSlug:t}){const n=vm(t,[{entity_type:r,slug:e}]),{data:a,isError:i}=BI(n,{slug:t}),o=a?.entity,s=o&&o.entity_type===r&&o.slug===e;return i||a&&!s?V.jsx("span",{className:"text-muted-foreground",title:"This record is not available",children:e}):V.jsx(dB,{to:n,className:"text-primary hover:underline",onClick:l=>l.stopPropagation(),children:s?o.name:e})}function qB({field:r,value:e,context:t}){if($B(r.prop)&&(e==null||Array.isArray(e))){const n=Array.isArray(e)?e.length:0,a=`${n} ${n===1?"item":"items"}`,i=t.dirtyKeys?.includes(r.key)??!1,o="inline-flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs tabular-nums";if(!t.openField)return V.jsx("span",{className:o,children:a});const s=t.openFieldKey===r.key;return V.jsxs("button",{type:"button","aria-pressed":s,"aria-label":`${pm(r)}: ${a}${i?", unsaved changes":""}`,className:pd(o,"hover:bg-muted/70 hover:text-foreground",s&&"ring-1 ring-primary"),onClick:()=>t.openField?.(r),children:[a,i?V.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"· edited"}):null]})}return r.prop["x-link-entity-type"]&&t.orgContext&&e!=null?V.jsx(XB,{value:e,prop:r.prop,ownerSlug:t.ownerSlug,orgContext:t.orgContext}):V.jsx(cm,{value:e,prop:r.prop})}function Ex({field:r,control:e,labelId:t}){const n=GB(r.prop);return V.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5",children:[V.jsx("span",{id:t,className:"min-w-0 break-words",children:pm(r)}),n?V.jsxs(kI,{children:[V.jsx(OI,{asChild:!0,children:V.jsx("button",{type:"button",className:"shrink-0 text-muted-foreground/70 hover:text-foreground","aria-label":`About ${pm(r)}: ${n}`,children:V.jsx(cB,{className:"h-3 w-3"})})}),V.jsx(NI,{className:"max-w-xs",children:n})]}):null,e?V.jsx(HB,{control:e}):null]})}function HI({field:r,value:e,context:t,nested:n}){const a=ze.useId(),i=n?void 0:t.controls?.[r.key],o=FI(e);if(zI(r.prop)&&(o==null||gm(o))){const s=gm(o)?o:{},l=GI(F_(r.prop.properties).map(([u,f])=>({key:u,prop:f})),s);return V.jsxs("fieldset",{"aria-labelledby":a,className:"m-0 min-w-0 space-y-2 border-0 p-0",children:[V.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:V.jsx(Ex,{field:r,control:i,labelId:a})}),V.jsx("dl",{className:"space-y-2 border-l border-border pl-3",children:l.map(u=>V.jsx(HI,{field:u,value:s[u.key],context:t,nested:!0},u.key))})]})}return V.jsxs("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-baseline gap-x-3",children:[V.jsx("dt",{className:"text-muted-foreground",children:V.jsx(Ex,{field:r,control:i,labelId:a})}),V.jsx("dd",{"aria-labelledby":a,className:pd("min-w-0 [overflow-wrap:anywhere]",r.numeric&&"tabular-nums"),children:V.jsx(qB,{field:r,value:o,context:t})})]})}function KB({fields:r,values:e,context:t,fieldLimit:n}){const a=GI(r,e);return a.length===0?V.jsx("p",{className:"text-sm text-muted-foreground",children:r.length===0?"This type declares no fields.":"No details have been added yet."}):V.jsx(lB,{delayDuration:200,children:V.jsx("dl",{className:"space-y-2.5 text-sm leading-5",children:(n===void 0?a:a.slice(0,n)).map(i=>V.jsx(HI,{field:i,value:e[i.key],context:t,nested:!1},i.key))})})}function JB(r,e){if(typeof r!="string"||!e||e.length===0)return r;const t=r.trim();if(e.includes(t))return t;try{const n=JSON.parse(t);if(typeof n=="string"&&e.includes(n))return n}catch{}return r}function QB(r,e){if(!r)return{};const t=e?.properties;return t?Object.fromEntries(Object.entries(r).map(([n,a])=>[n,JB(a,t[n]?.enum)])):{...r}}function Wne(r){return{href:"",key:`record-peer:${r.record?JSON.stringify([r.record.type,r.record.key]):r.entityId}`,title:r.name?.trim()||"Record",recordPeer:{...r.record?{record:r.record}:{entityId:r.entityId},ownerSlug:r.ownerSlug,orgContext:r.orgContext}}}function $ne({target:r}){const e=pB(),t=gB(),n=yB(r.entityId,r.orgContext),a=r.record?vm(r.ownerSlug,[{entity_type:r.record.type,slug:r.record.key}]):"",i=BI(a,r.orgContext),o=r.record?i.data?.entity:n.data,{isLoading:s,isError:l}=r.record?i:n,{data:u}=mB(o?.entity_type??"",r.orgContext),[f,v]=ze.useState(!1),[c,h]=ze.useState(!1);if(s)return V.jsxs("div",{className:"space-y-3 px-5 py-5",children:[V.jsx(pp,{className:"h-5 w-2/3"}),V.jsx(pp,{className:"h-4 w-full"}),V.jsx(pp,{className:"h-4 w-full"})]});if(l||!o)return V.jsx("p",{className:"px-5 py-5 text-sm text-muted-foreground",children:"This record is not available. It may have been deleted, or you may not have access to it."});const d=u?.metadata_schema,p=async()=>{v(!0),h(!1);try{const g=r.record?[{entity_type:r.record.type,slug:r.record.key}]:await SB(r.entityId,r.orgContext);t?.close(),await e({to:vm(r.ownerSlug,g)})}catch{h(!0)}finally{v(!1)}};return V.jsxs("article",{className:"space-y-4 px-5 py-4",children:[V.jsxs("div",{className:"flex items-start justify-between gap-3",children:[V.jsxs("div",{className:"min-w-0",children:[V.jsx("p",{className:"truncate text-sm font-medium",children:o.name}),V.jsx("p",{className:"text-xs text-muted-foreground",children:u?.name??o.entity_type})]}),V.jsxs(Wu,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1 px-2 text-muted-foreground hover:text-foreground",disabled:f,"aria-busy":f,onClick:()=>void p(),children:["Open record",V.jsx(_B,{className:"h-3.5 w-3.5"})]})]}),c?V.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not open this record. Try again."}):null,V.jsx(KB,{fields:YB(d),values:QB(o.metadata??{},d),context:{ownerSlug:r.ownerSlug,orgContext:r.orgContext}})]})}const eV=r=>r!=null;function tV(r,e,t=eV){let n=r;for(const a of e.replace(/\[(\d+)\]/g,".$1").split(".")){if(!t(n))return;n=n[a]}return n}function rV(r,e,t){return typeof r!="string"?r:r.startsWith("@")?e?.[r.slice(1)]:r.startsWith("{{")&&r.endsWith("}}")&&r.indexOf("}}")===r.length-2?t(r.slice(2,-2).trim()):r.replace(/\{\{(.+?)\}\}/g,(n,a)=>{const i=t(a.trim());return i===void 0?"":String(i)})}const nV=new Set(["type","children","props","path","fallback","key"]);function aV(r,e){const t={};for(const[n,a]of Object.entries(r))nV.has(n)||(t[n]=a);return Object.assign(t,e)}/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -93,4 +93,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
93
93
|
* @license MIT
|
|
94
94
|
*/function sm(r,e){return r?Tne(r)?ze.createElement(r,e):r:null}function Tne(r){return Ane(r)||typeof r=="function"||Mne(r)}function Ane(r){return typeof r=="function"&&(()=>{const e=Object.getPrototypeOf(r);return e.prototype&&e.prototype.isReactComponent})()}function Mne(r){return typeof r=="object"&&typeof r.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(r.$$typeof.description)}function Dne(r){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...r},[t]=ze.useState(()=>({current:Sne(e)})),[n,a]=ze.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...r,state:{...n,...r.state},onStateChange:o=>{a(o),r.onStateChange==null||r.onStateChange(o)}})),t.current}const PI=12;function lm(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function um(r){return r.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Ine(r){try{return JSON.stringify(r,null,2)}catch{return String(r)}}function $i(r){return r===null?"null":r===void 0?"—":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):Ine(r)}const RI=({value:r,openLink:e})=>{if(!hm(r))return V.jsx("span",{className:"break-words",children:r});let t=r;try{const n=new URL(r);t=`${n.host}${n.pathname==="/"?"":n.pathname}`}catch{}return V.jsxs(Wu,{type:"button",variant:"ghost",size:"sm",className:"h-auto max-w-full justify-start px-1 py-0 text-left font-normal text-xs",onClick:()=>e(r),children:[V.jsx(VI,{className:"mr-1 h-3 w-3 shrink-0"}),V.jsx("span",{className:"truncate",children:t})]})};function Lne({page:r,pageCount:e,onChange:t}){return V.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1.5",children:[V.jsxs(Wu,{type:"button",size:"sm",variant:"outline",disabled:r===0,onClick:()=>t(r-1),children:[V.jsx(CB,{className:"h-3.5 w-3.5"}),V.jsx("span",{className:"sr-only",children:"Previous page"})]}),V.jsxs("span",{className:"text-muted-foreground text-xs",children:[r+1," / ",e]}),V.jsxs(Wu,{type:"button",size:"sm",variant:"outline",disabled:r+1>=e,onClick:()=>t(r+1),children:[V.jsx(TB,{className:"h-3.5 w-3.5"}),V.jsx("span",{className:"sr-only",children:"Next page"})]})]})}function Pne({rows:r,columns:e,openLink:t,stateKey:n="table",viewState:a,onViewStateChange:i,renderCell:o,renderStructuredValue:s,pageSize:l}){const u=ze.useMemo(()=>e?null:[...new Set(r.flatMap(L=>Object.keys(L)))],[e,r]),f=ze.useMemo(()=>e?.map(L=>L.name)??(u??[]).slice(0,PI),[e,u]),v=u?u.slice(PI):[],c=a?.[`${n}.sort.column`],h=a?.[`${n}.sort.desc`],d=typeof c=="string"&&c?[{id:c,desc:h===!0}]:[],[p,g]=ze.useState(d),[y,m]=ze.useState(null);ze.useEffect(()=>{g(d)},[c,h]);function _(L){const I=new Set(f);return Object.keys(L).filter(P=>!I.has(P))}const S=ze.useMemo(()=>f.map(L=>({id:L,accessorFn:I=>I[L],header:um(L),enableSorting:L!=="open",sortDescFirst:!1,sortingFn:(I,P,R)=>{const E=I.getValue(R),O=P.getValue(R);return typeof E=="number"&&typeof O=="number"?E-O:$i(E).localeCompare($i(O),void 0,{numeric:!0,sensitivity:"base"})},cell:({getValue:I,row:P})=>{const R=I(),E=P.index===y;if(lm(R)||Array.isArray(R))return E?V.jsx("div",{className:"max-w-md break-words",children:s?s(R,t):$i(R)}):V.jsx("span",{className:"text-muted-foreground",children:Array.isArray(R)?"[…]":"{…}"});const O=o?.(R,L);if(O!=null)return O;if(L==="open"&&typeof R=="string")return V.jsxs(Wu,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:z=>{z.stopPropagation(),t(R)},children:[V.jsx(VI,{className:"mr-1 h-3.5 w-3.5"}),"Open"]});if(typeof R=="string"&&hm(R))return V.jsx(RI,{value:R,openLink:t});if(E)return V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(R)});const k=$i(R);return V.jsx("span",{className:"block max-w-80 truncate",title:k,children:k})}})),[f,t,y,o,s]),x=a?.[`${n}.page`],[w,b]=ze.useState(typeof x=="number"?Math.max(0,x):0);ze.useEffect(()=>{b(typeof x=="number"?Math.max(0,x):0)},[x]);const T=l?Math.max(1,Math.ceil(r.length/l)):1,C=typeof x=="number"?Math.max(0,x):w,A=Math.min(C,T-1),D=Dne({data:r,columns:S,state:{sorting:p,...l?{pagination:{pageIndex:A,pageSize:l}}:{}},onSortingChange:L=>{const I=typeof L=="function"?L(p):L;g(I),i?.(`${n}.sort.column`,I[0]?.id??""),i?.(`${n}.sort.desc`,I[0]?.desc??!1)},getCoreRowModel:xne(),getSortedRowModel:Cne(),...l?{getPaginationRowModel:bne(),onPaginationChange:L=>{const I=typeof L=="function"?L({pageIndex:A,pageSize:l}):L;b(I.pageIndex),i?.(`${n}.page`,I.pageIndex)}}:{}});return V.jsxs("div",{children:[V.jsx("div",{className:"overflow-hidden rounded-md border border-border/70",children:V.jsxs(OB,{className:"text-xs",children:[V.jsx(NB,{className:"bg-muted/50",children:D.getHeaderGroups().map(L=>V.jsx(gp,{className:"hover:bg-transparent",children:L.headers.map(I=>{const P=I.column.getIsSorted(),R=String(I.column.columnDef.header),E=I.column.getCanSort();return V.jsx(BB,{"aria-sort":E?P==="asc"?"ascending":P==="desc"?"descending":"none":void 0,className:"h-8 whitespace-nowrap px-2",children:E?V.jsxs("button",{type:"button","aria-label":`Sort by ${R}`,className:"flex w-full items-center gap-1.5 text-left",onClick:I.column.getToggleSortingHandler(),children:[sm(I.column.columnDef.header,I.getContext()),P==="asc"?V.jsx(xB,{className:"h-3 w-3"}):P==="desc"?V.jsx(wB,{className:"h-3 w-3"}):V.jsx(bB,{className:"h-3 w-3 opacity-45"})]}):sm(I.column.columnDef.header,I.getContext())},I.id)})},L.id))}),V.jsx(VB,{children:D.getRowModel().rows.map(L=>{const I=L.index===y,P=_(L.original),R=P.length>0||f.some(E=>{const O=L.original[E];return lm(O)||Array.isArray(O)});return V.jsxs(ze.Fragment,{children:[V.jsx(gp,{className:pd("transition-colors",R&&"cursor-pointer",I?"bg-muted/20":R&&"hover:bg-muted/30"),onClick:R?()=>m(I?null:L.index):void 0,children:L.getVisibleCells().map(E=>V.jsx(Rx,{className:"p-2 align-top",children:sm(E.column.columnDef.cell,E.getContext())},E.id))}),I&&P.length>0?V.jsx(gp,{className:"border-b last:border-b-0 bg-muted/10",children:V.jsx(Rx,{colSpan:L.getVisibleCells().length,className:"p-2",children:V.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:P.map(E=>{const O=L.original[E];return V.jsxs("div",{children:[V.jsxs("span",{className:"text-muted-foreground capitalize",children:[um(E),":"]})," ",lm(O)||Array.isArray(O)?s?s(O,t):V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}):(()=>{const k=o?.(O,E);return k??(typeof O=="string"&&hm(O)?V.jsx(RI,{value:O,openLink:t}):V.jsx("span",{className:"break-words whitespace-pre-wrap",children:$i(O)}))})()]},E)})})})}):null]},L.id)})})]})}),v.length>0?V.jsxs("p",{className:"mt-2 text-muted-foreground text-xs",children:[v.length," additional"," ",v.length===1?"column":"columns"," available in expanded rows:"," ",v.slice(0,4).map(um).join(", "),v.length>4?`, +${v.length-4} more`:""]}):null,l&&T>1?V.jsx(Lne,{page:A,pageCount:T,onChange:L=>D.setPageIndex(L)}):null]})}function Rne(r,e,t){const n=e[0];let a=t;if(n&&typeof n=="object"&&!Array.isArray(n)){const i=n,o=i.currentTarget&&typeof i.currentTarget=="object"?i.currentTarget:i.target&&typeof i.target=="object"?i.target:null;o&&o.value!==void 0&&(o.value!==""||t==null)&&(a=o.value)}else(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(a=n);return dm(r,a)}function fm(r,e,t){const n=r;return Array.isArray(n)?!e&&!t?n:n.map(a=>({label:String(a[e??"label"]??""),value:Number(a[t??"value"]??0)})):[]}function Ene(r,e,t){const n=r;return Array.isArray(n)?!e&&!t?n:n.map(a=>({name:String(a[e??"name"]??""),value:Number(a[t??"value"]??0)})):[]}const EI={div:({children:r,...e})=>V.jsx("div",{...e,children:r}),span:({children:r,...e})=>V.jsx("span",{...e,children:r}),p:({children:r,...e})=>V.jsx("p",{...e,children:r}),h1:({children:r,...e})=>V.jsx("h1",{...e,children:r}),h2:({children:r,...e})=>V.jsx("h2",{...e,children:r}),h3:({children:r,...e})=>V.jsx("h3",{...e,children:r}),h4:({children:r,...e})=>V.jsx("h4",{...e,children:r}),ul:({children:r,...e})=>V.jsx("ul",{...e,children:r}),ol:({children:r,...e})=>V.jsx("ol",{...e,children:r}),li:({children:r,...e})=>V.jsx("li",{...e,children:r}),table:({children:r,...e})=>V.jsx("table",{...e,children:r}),thead:({children:r,...e})=>V.jsx("thead",{...e,children:r}),tbody:({children:r,...e})=>V.jsx("tbody",{...e,children:r}),tr:({children:r,...e})=>V.jsx("tr",{...e,children:r}),th:({children:r,...e})=>V.jsx("th",{...e,children:r}),td:({children:r,...e})=>V.jsx("td",{...e,children:r}),card:({children:r,className:e,...t})=>V.jsx(kB,{className:e,...t,children:r}),"card-header":({children:r,className:e,...t})=>V.jsx(EB,{className:e,...t,children:r}),"card-title":({children:r,className:e,...t})=>V.jsx(RB,{asChild:!0,className:e,children:V.jsx("h3",{...t,children:r})}),"card-description":({children:r,className:e,...t})=>V.jsx(PB,{className:e,...t,children:r}),"card-content":({children:r,className:e,...t})=>V.jsx(LB,{className:e,...t,children:r}),badge:({children:r,className:e,variant:t="default",...n})=>{const a={default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-destructive-foreground",outline:"border border-input bg-background"},i=s=>typeof s=="string"?s.replace(/[_-]/g," ").replace(/\b\w/g,l=>l.toUpperCase()):typeof s=="number"||typeof s=="boolean"||s==null||DB.isValidElement(s)?s:Array.isArray(s)?s.map(i):String(s),o=i(r);return V.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${a[t]||a.default} ${e||""}`,...n,children:o})},button:({children:r,className:e,variant:t="default",type:n="button",label:a,...i})=>{const o={default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground"};return V.jsx("button",{type:n,className:`inline-flex items-center justify-center rounded-md text-sm font-medium h-10 px-4 py-2 ${o[t]||o.default} ${e||""}`,...i,children:r??String(a??"")})},select:({className:r,label:e,placeholder:t,options:n,onChange:a,onSelect:i,...o})=>V.jsxs("label",{className:`flex flex-col gap-1 text-sm ${r||""}`,children:[e?V.jsx("span",{className:"font-medium",children:String(e)}):null,V.jsxs("select",{className:"h-10 rounded-md border border-input bg-background px-3",onChange:a??i,defaultValue:"",...o,children:[t?V.jsx("option",{value:"",disabled:!0,children:String(t)}):null,Array.isArray(n)?n.map(s=>{const l=s,u=String(l.value??l.label??"");return V.jsx("option",{value:u,children:String(l.label??u)},JSON.stringify(l))}):null]})]}),alert:({children:r,className:e,variant:t="default",...n})=>{const a={default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive"};return V.jsx("div",{role:"alert",className:`relative w-full rounded-lg border p-4 ${a[t]||a.default} ${e||""}`,...n,children:r})},"alert-title":({children:r,className:e,...t})=>V.jsx("h5",{className:`mb-1 font-medium leading-none tracking-tight ${e||""}`,...t,children:r}),"alert-description":({children:r,className:e,...t})=>V.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${e||""}`,...t,children:r}),progress:({className:r,value:e=0,label:t,...n})=>{const a=Math.round(e);return V.jsxs("div",{className:`flex items-center gap-2 ${r||""}`,...n,children:[V.jsx("div",{className:"relative h-4 flex-1 overflow-hidden rounded-full bg-secondary",children:V.jsx("div",{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-a}%)`}})}),V.jsx("span",{className:"text-xs font-medium tabular-nums text-muted-foreground shrink-0",children:t?String(t):`${a}%`})]})},strong:({children:r,...e})=>V.jsx("strong",{...e,children:r}),b:({children:r,...e})=>V.jsx("strong",{...e,children:r}),em:({children:r,...e})=>V.jsx("em",{...e,children:r}),link:({children:r,className:e,href:t,...n})=>{const a=String(t??""),i=/^https?:\/\//i.test(a);return V.jsx("a",{href:a,className:`text-primary underline underline-offset-2 hover:no-underline ${e||""}`,...i?{target:"_blank",rel:"noreferrer"}:{},...n,children:r})},a:({children:r,className:e,href:t,...n})=>V.jsx("a",{href:String(t??""),className:`text-primary underline underline-offset-2 hover:no-underline ${e||""}`,...n,children:r}),context:({children:r,className:e,...t})=>V.jsx("div",{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground ${e||""}`,...t,children:r}),fields:({children:r,className:e,...t})=>V.jsx("div",{className:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2 ${e||""}`,...t,children:r}),field:({children:r,className:e,label:t,value:n,...a})=>V.jsxs("div",{className:`flex flex-col gap-0.5 ${e||""}`,...a,children:[V.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:String(t??"")}),V.jsx("span",{className:"text-sm break-words",children:r??(n==null?"—":String(n))})]}),separator:({className:r,...e})=>V.jsx("div",{className:`shrink-0 bg-border h-[1px] w-full ${r||""}`,...e}),markdown:({content:r,className:e})=>V.jsx("div",{className:`max-w-none text-sm space-y-2 ${e||""}`,children:V.jsx(MB,{text:String(r??"")})}),layout:({children:r,className:e,direction:t="vertical"})=>V.jsx("div",{className:`flex ${t==="horizontal"?"flex-row":"flex-col"} gap-4 ${e||""}`,children:r}),columns:({children:r,className:e})=>{const t=Array.isArray(r)?r.filter(n=>n!=null).length:r?1:0;return V.jsx("div",{className:`grid gap-4 ${e||""}`,style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`},children:r})},metric:({label:r,value:e,className:t})=>V.jsxs("div",{className:pd(AB,"p-4",t),children:[V.jsx("p",{className:"text-sm text-muted-foreground",children:String(r??"")}),V.jsx("p",{className:"mt-1 text-2xl font-bold",children:String(e??"")})]}),"bar-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>V.jsx(Lre,{data:fm(r,a,i),height:e,xLabel:t,yLabel:n}),"line-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>V.jsx(Pre,{data:fm(r,a,i),height:e,xLabel:t,yLabel:n}),"area-chart":({data:r,height:e,xLabel:t,yLabel:n,labelField:a,valueField:i})=>V.jsx(Ire,{data:fm(r,a,i),height:e,xLabel:t,yLabel:n}),"pie-chart":({data:r,height:e,showLabel:t,showLegend:n,radius:a,highlightName:i,nameField:o,valueField:s})=>V.jsx(Rre,{data:Ene(r,o,s),height:e,showLabel:t,showLegend:n,radius:a,highlightName:i}),sparkline:({data:r,height:e,width:t,color:n,trend:a})=>V.jsx(Ere,{data:r,height:e,width:t,color:n,trend:a}),"stacked-area-chart":({data:r,series:e,height:t,xLabel:n,yLabel:a,onSeriesClick:i,onDateRangeSelect:o})=>V.jsx(kre,{data:r,series:e,height:t,xLabel:n,yLabel:a,onSeriesClick:i,onDateRangeSelect:o})},kne=new Set(["urgency","severity","sentiment","trend","status","priority"]),One={critical:"bg-red-500/15 text-red-400 border-red-500/30",high:"bg-orange-500/15 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",low:"bg-green-500/15 text-green-400 border-green-500/30"};function Nne(r,e){if(r==null)return V.jsx("span",{className:"text-muted-foreground",children:"–"});const t=String(r);if(t.startsWith("http://")||t.startsWith("https://"))return V.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e==="url"?"↗ Link":t});if(e==="subreddit"&&typeof r=="string")return V.jsxs("a",{href:`https://reddit.com/r/${r}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:["r/",r]});if(kne.has(e)&&typeof r=="string"){const n=One[r.toLowerCase()]??"bg-secondary text-secondary-foreground border-border",a=r.replace(/[_-]/g," ").replace(/\b\w/g,i=>i.toUpperCase());return V.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${n}`,children:a})}return typeof r=="number"?V.jsx("span",{className:"font-mono tabular-nums",children:r}):typeof r=="boolean"?V.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${r?"bg-green-500/15 text-green-400 border-green-500/30":"bg-secondary text-secondary-foreground border-border"}`,children:r?"Yes":"No"}):V.jsx("span",{className:"whitespace-pre-wrap",children:t})}function Bne({rows:r,columns:e,title:t}){return V.jsxs("div",{className:"space-y-2",children:[t&&V.jsx("h4",{className:"text-sm font-semibold",children:t}),V.jsx(Pne,{rows:r,columns:e.map(n=>({name:n})),openLink:()=>{},renderCell:(n,a)=>Nne(n,a)})]})}const wc=tV;function Du(r,e,t){if(r.type==="text")return r.content;if(r.type==="data"){const u=r,f=wc(e.data,u.path),v=f!==void 0?f:u.fallback,c=IB(v,u.format);if(c.length>100&&(c.includes(`
|
|
95
95
|
`)||/[#*-]/.test(c))){const h=EI.markdown;return h?V.jsx(h,{content:c}):c}return c}if(r.type==="if"){const u=r;return wc(e.data,u.condition)?Du(u.then,e,t):u.else?Du(u.else,e,t):null}if(r.type==="each"){const u=r,f=wc(e.data,u.items);return Array.isArray(f)?f.map((v,c)=>{const h=u.as,d={...e,data:{...e.data,[h]:v,[`${h}Index`]:c}};if(typeof u.render=="string"){const p=`{{${h}}}`,g=typeof v=="string"?v:JSON.stringify(v);return u.render.split(p).join(g)}return Du(u.render,d,c)}):null}const n=r,a=e.components?.[n.type]??EI[n.type];if(!a)return console.warn(`Unknown component type: ${n.type}`),null;const i=u=>rV(u,e.actions,f=>wc(e.data,f)),o=aV(r,n.props),s={};for(const[u,f]of Object.entries(o)){if(/^on[A-Z]/.test(u))continue;const v=i(f);s[u]=v}for(const[u,f]of Object.entries(o)){if(!/^on[A-Z]/.test(u))continue;if(e.actionsDisabled){s.disabled=!0;continue}let v=i(f);if(typeof v!="function"&&e.onAction){const c=dm(f,s.value);c&&e.interactions?.[c.action]&&(v=(...h)=>e.onAction?.(Rne(f,h,s.value)??c))}if(typeof v!="function"){dm(f,s.value)&&(s.disabled=!0),f!==void 0&&console.warn(`Ignoring non-function handler for "${u}" (got ${typeof v}). Bind actions as "@actionName".`);continue}s[u]=v}if(n.type==="table"&&Array.isArray(s.data)&&Array.isArray(s.columns)){const u=s.data,f=s.columns,v=s.title;return V.jsx(Bne,{rows:u,columns:f,title:v},t)}const l=n.children?.map((u,f)=>Du(u,e,f));return V.jsx(a,{...s,children:l},t)}function Vne(r,e,t,n,a,i,o){const s={data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o};return Du(r.root,s)}function Yne({template:r,data:e,actions:t,onAction:n,interactions:a,components:i,actionsDisabled:o}){return V.jsx(V.Fragment,{children:Vne(r,e,t,n,a,i,o)})}export{HB as F,Yne as J,bl as L,KB as R,Ere as S,Pre as a,Dne as b,YB as c,FB as d,WB as e,sm as f,xne as g,GB as h,zB as i,UB as j,$ne as k,Wne as l,QB as m,JB as n,GI as o,Une as p,$B as q,qB as r,pm as s,Mx as u};
|
|
96
|
-
//# sourceMappingURL=renderer-
|
|
96
|
+
//# sourceMappingURL=renderer-DZ0w2k2r.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=reset-password-
|
|
1
|
+
import{a9 as v,r as a,j as e,L as h,aa as j,$ as y,ab as N}from"./index-CdDNNAx2.js";import{C as k,a as C,b as S,c as L}from"./card-C01y1O-W.js";function R(){const{token:n,error:x}=v.useSearch(),[o,p]=a.useState(""),[i,f]=a.useState(""),[d,s]=a.useState(null),[l,c]=a.useState(!1),[u,g]=a.useState(!1),w=async t=>{if(t.preventDefault(),!n){s("This reset link is invalid or expired.");return}if(o.length<8){s("Password must be at least 8 characters.");return}if(o!==i){s("Passwords do not match.");return}c(!0),s(null);try{const r=await j(`${y}/api/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n,newPassword:o})});if(!r.ok)throw await N(r);g(!0)}catch(r){s(r instanceof Error?r.message:"Failed to reset password")}finally{c(!1)}},b=!n||x==="INVALID_TOKEN",m={callbackUrl:void 0,mode:void 0,error:void 0,errorDescription:void 0,loginHint:void 0,invitationOrg:void 0,intent:void 0};return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md p-8",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsxs(k,{children:[e.jsx(C,{children:e.jsx(S,{asChild:!0,children:e.jsx("h1",{className:"text-center text-2xl",children:"Reset your password"})})}),e.jsx(L,{children:b&&!u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-destructive",children:"This reset link is invalid or expired."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Back to sign in"})]}):u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your password has been reset successfully."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Continue to sign in"})]}):e.jsxs("form",{onSubmit:w,className:"mt-6 space-y-4",children:[d&&e.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-lg",children:d}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"new-password",className:"block text-sm font-medium",children:"New password"}),e.jsx("input",{id:"new-password",type:"password",value:o,onChange:t=>p(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium",children:"Confirm new password"}),e.jsx("input",{id:"confirm-password",type:"password",value:i,onChange:t=>f(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsx("button",{type:"submit",disabled:l,className:"flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",children:l?"Resetting password...":"Reset password"})]})})]})]})})}export{R as component};
|
|
2
|
+
//# sourceMappingURL=reset-password-D2RfrEVZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{fC as M,fD as w,fE as k,fq as L,r as h,j as n,m as j,bd as S,el as A,ai as C,B as I,e9 as R,G as D,cN as E,L as _,eK as T}from"./index-CdDNNAx2.js";import{a as F}from"./list-skeleton-0B1bTrAK.js";import{s as O}from"./subDays-hOwerOLo.js";import{u as Y}from"./use-automations-CdtiVLCv.js";import{u as z}from"./clients-BCvjAJDT.js";function B(e,s){return M(k(e,e),w(e))}function V(e,s){return L(k(e,e),w(e))}function q(e,s){return L(k(e,e),O(w(e),1))}function G({onIntersect:e,onLeave:s,enabled:t,rootMargin:r="400px"}){const a=h.useRef(null),o=h.useRef(e);o.current=e;const u=h.useRef(s);return u.current=s,h.useEffect(()=>{const c=a.current;if(!c||!t)return;const f=new IntersectionObserver(l=>{l[0]?.isIntersecting?o.current():u.current?.()},{rootMargin:r});return f.observe(c),()=>f.disconnect()},[t,r]),a}function K({groupByDate:e=!0}){return n.jsx("div",{role:"status","aria-label":"Loading activity","aria-busy":"true",children:n.jsxs("div",{"aria-hidden":"true",children:[e?n.jsx("div",{className:"px-3 pb-2",children:n.jsx(j,{className:"h-4 w-28 rounded-none"})}):null,["first","second","third","fourth","fifth"].map(s=>n.jsxs("div",{className:"flex items-start gap-3 px-3 py-3",children:[n.jsx(j,{className:"h-8 w-8 shrink-0 rounded-none"}),n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx(j,{className:"h-4 w-3/5 max-w-sm rounded-none"}),n.jsxs("div",{className:"flex gap-3",children:[n.jsx(j,{className:"h-3 w-20 rounded-none"}),n.jsx(j,{className:"h-3 w-12 rounded-none"})]})]})]},s))]})})}function $(e){if(e==null||e==="")return null;const s=new Date(e);return Number.isNaN(s.getTime())?null:R(s,"d MMMM yyyy")}function U(e){if(e==null||e==="")return null;const s=new Date(e);return Number.isNaN(s.getTime())?null:V(s)?"Today":q(s)?"Yesterday":R(s,B(s)?"d MMM":"d MMM yyyy")}function W({items:e}){const s=[];for(const t of e){const r=U(t.occurredAt)??"Undated",a=s.at(-1);a?.day===r?a.items.push(t):s.push({day:r,items:[t]})}return n.jsx(n.Fragment,{children:s.map(({day:t,items:r},a)=>n.jsxs("section",{"aria-label":t,className:"min-w-0",children:[n.jsx("div",{className:a===0?"px-1 pb-1.5":"px-1 pt-4 pb-1.5",children:n.jsx("h2",{className:"text-sm font-semibold",children:t})}),n.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:r.map(o=>n.jsx("li",{children:o.content},o.key))})]},`${t}:${a}`))})}const X=3;function se({items:e,isLoading:s,emptyState:t,hasNextPage:r,isFetching:a,isFetchingNextPage:o,onLoadMore:u,autoLoadMore:c=!0,groupByDate:f=!0,rows:l=!1}){const[N,x]=h.useState(0),g=N>=X,b=G({onIntersect:()=>{x(i=>i+1),u()},onLeave:()=>x(0),enabled:c&&r&&!a&&!g}),y=()=>{x(0),u()};return s&&e.length===0?l?n.jsx("div",{role:"status","aria-label":"Loading activity",className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2,3].map(i=>n.jsx(F,{},i))}):n.jsx(K,{groupByDate:f}):n.jsxs("div",{children:[e.length===0?r?null:t!==void 0?t:n.jsx(S,{icon:A,title:"Nothing here yet",description:"No events match this view."}):l?n.jsx(W,{items:e}):e.map((i,m)=>{const p=$(i.occurredAt),v=m>0?$(e[m-1].occurredAt):null;return n.jsxs(h.Fragment,{children:[f&&p&&p!==v&&n.jsx("p",{className:"px-3 pb-2 pt-4 text-xs text-muted-foreground first:pt-0",children:p}),n.jsx("div",{className:"mb-1",children:i.content})]},i.key)}),n.jsx("div",{ref:b,className:"h-1"}),o?n.jsx("div",{role:"status","aria-label":"Loading earlier activity",className:"flex justify-center py-3",children:n.jsx(C,{className:"text-muted-foreground"})}):r?c?g?n.jsx("div",{className:"flex justify-center py-3",children:n.jsx(I,{variant:"link",size:"sm",className:"h-auto p-0 text-xs font-normal text-muted-foreground",disabled:a,onClick:y,children:"Show earlier activity"})}):null:n.jsx(I,{size:"sm",variant:"outline",className:l?"mt-3":void 0,disabled:a,onClick:y,children:"Load more"}):null]})}function H(e,s,t){return e?.kind==="agent_session"&&e.agent_id?e.client_id?`${e.agent_id} via ${e.client_id}`:e.agent_id:e?.kind==="user"?"a person":s==="agent"?"an agent":t?`Automation ${t}`:"an Automation"}function ne({ownerSlug:e,initiator:s,clientName:t,fallback:r}){const a=s?.client_id??t,{allOrgs:o,isAuthenticated:u}=D(),c=u&&o?.some(d=>d.slug===e),l=z(void 0,{ownerSlug:e,enabled:!!(a&&c)}).data?.find(d=>d.id===a)?.title,N=c?o.find(d=>d.slug===e)?.id:void 0,x=s?.kind==="automation"&&s.automation_id?String(s.automation_id):void 0,b=Y(x?N:void 0,void 0,{includeDetails:!1}).data?.find(d=>d.automation_id===x)?.name,{members:y}=E(s?.kind==="user"&&s.user_id?N:void 0),i=y.find(d=>d.userId===s?.user_id)?.user.name,m=s&&s.kind!=="user"?b??H(s,void 0,s.automation_id===void 0?void 0:String(s.automation_id)):i??r,p="font-medium text-foreground",v=`${p} underline-offset-4 hover:underline`;return s?.kind==="automation"&&s.automation_id?n.jsx(_,{to:"/$owner/automations/$automationId",params:{owner:e,automationId:String(s.automation_id)},search:{view:"definition",run_id:void 0},className:v,children:m}):s?.kind==="agent_session"&&s.agent_id?n.jsx(_,{to:"/$owner/agents/$agentId",params:{owner:e,agentId:String(s.agent_id)},className:v,children:m}):a?n.jsxs(_,{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:a},className:`${v} inline-flex items-center gap-1 align-middle`,children:[n.jsx(T,{name:l??t??a}),l??m]}):n.jsx("span",{className:p,children:m})}export{K as E,ne as R,se as a,B as b,V as i,H as p};
|
|
2
|
+
//# sourceMappingURL=run-initiator-B8IRlRd-.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g0 as l,dM as r,dA as d,dN as g,aa as f,g1 as I}from"./index-CdDNNAx2.js";const m=30,s=new Set(["running","pending","claimed"]);function y(n){return"workspace"in n?["workspace"]:"connectionId"in n?["connection",n.connectionId]:"deviceId"in n?["device",n.deviceId]:"connectorKey"in n?["connector",n.connectorKey]:["feed",n.feedId]}function _(n){return"workspace"in n?{}:"connectionId"in n?{connection_ids:[n.connectionId]}:"deviceId"in n?{device_worker_id:n.deviceId}:"connectorKey"in n?{connector_key:n.connectorKey}:{feed_ids:[n.feedId]}}function T(n,e,t){return l({queryKey:["runs-infinite",t??null,n?y(n):null,e.runTypes??null,e.status??null,e.automationIds??null,e.connectionIds??null,e.feedIds??null],queryFn:async({pageParam:a})=>{const i=a;return r("manage_operations",{action:"list_runs",..._(n),...e.runTypes&&e.runTypes.length>0?{run_types:e.runTypes}:{},...e.status?{status:e.status}:{},...e.automationIds?.length?{automation_ids:e.automationIds}:{},...e.connectionIds?.length?{connection_ids:e.connectionIds}:{},...e.feedIds?.length?{feed_ids:e.feedIds}:{},...i?{before_id:i.before_id,before_created_at:i.before_created_at}:{},limit:m},t?{slug:t}:void 0)},initialPageParam:null,getNextPageParam:a=>{if(!a.has_more)return;const i=a.runs[a.runs.length-1];if(i)return{before_id:i.id,before_created_at:i.created_at}},refetchInterval:a=>(a.state.data?.pages??[]).some(u=>u.runs.some(c=>s.has(c.status)))?5e3:!1,enabled:!!n,staleTime:15e3})}function h(n){return s.has(n??"")}function b(n,e){return d({queryKey:["run-outcome",n,e],queryFn:async()=>{const t=await r("manage_operations",{action:"get_run",run_id:e},{slug:n});if(!t.run)throw new Error(t.error||"Run not found");return t.run},enabled:n!=="me",staleTime:15e3,refetchInterval:t=>h(t.state.data?.status)?5e3:!1})}function p(n,e){return n.kind==="agent"?n.agentId?`/${n.agentId}/config/pending/${e}`:null:n.agentId&&n.automationId?`/${n.agentId}/automations/${n.automationId}/pending/${e}`:null}function K(n,e){const{slug:t}=g(),a=e!=null?p(n,e):null,i=n.kind==="agent"?["agent",n.agentId]:["automation",n.agentId,n.automationId];return d({queryKey:["pending-proposal",t,...i,e],queryFn:async()=>{const o=await f(I(t,a),{credentials:"include"});if(o.status===404)return{status:"gone"};if(!o.ok)throw new Error(`Failed to fetch pending proposal: ${o.status}`);return{status:"pending",proposal:await o.json()}},enabled:!!t&&!!a&&!!e,staleTime:0,retry:!1})}export{b as a,K as b,h as i,T as u};
|
|
2
|
+
//# sourceMappingURL=runs-CuC7WMtd.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as t,B as k,L as v,dc as B,i as h,dF as F,dG as D,dH as I,i0 as M,i1 as A,u as E,i2 as p,i3 as K,bg as y,bl as w,eY as P,r as x,aF as b,aG as N,aI as C,f0 as V,aq as z,ai as O,i4 as G,i5 as U,i6 as _,bh as q,C as J,e9 as Y}from"./index-CdDNNAx2.js";import{R as H,a as Q}from"./run-initiator-B8IRlRd-.js";function W(e,s){switch(s.kind){case"connection":return A(e,s.id);case"feed":return M(e,s.id);case"run":return{to:"/$owner/events",params:{owner:e},search:{run_ids:String(s.id)}}}}function X({ownerSlug:e,scope:s,variant:i="outline",iconOnly:a=!1,label:o,className:c,title:n}){const l=W(e,s),r=n??o??"View in memory",u=t.jsx(k,{asChild:!0,variant:i,size:a?"icon":"sm",className:h(a&&"h-7 w-7",c),children:t.jsxs(v,{to:l.to,params:l.params,search:l.search,children:[t.jsx(B,{className:h("h-3.5 w-3.5",!a&&"mr-1.5")}),!a&&(o??"View in memory")]})});return a?t.jsxs(F,{children:[t.jsx(D,{asChild:!0,children:u}),t.jsx(I,{children:r})]}):u}function Z({status:e}){return e==="completed"?t.jsx(V,{className:"h-4 w-4 text-green-500"}):e==="failed"?t.jsx(z,{className:"h-4 w-4 text-destructive"}):e==="running"?t.jsx(O,{className:"text-blue-500"}):t.jsx(G,{className:"h-4 w-4 text-muted-foreground"})}const ee={completed:"Completed",failed:"Failed",running:"Running",pending:"Queued",claimed:"Starting",timeout:"Timed out",cancelled:"Cancelled"};function $(e){const s=e.split("_").join(" ");return s.charAt(0).toUpperCase()+s.slice(1)}function te({error:e}){const[s,i]=x.useState(!1);return e.length<=80?t.jsx("span",{className:"text-destructive",children:e}):t.jsxs(b,{open:s,onOpenChange:i,children:[t.jsx(N,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-left text-destructive hover:underline",children:e})}),t.jsx(C,{className:"max-h-64 w-96 overflow-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs text-destructive",children:e})})]})}function se({checkpoint:e}){return t.jsxs(b,{children:[t.jsx(N,{asChild:!0,children:t.jsx(k,{variant:"ghost",size:"icon",title:"Checkpoint","aria-label":"Checkpoint",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground",children:t.jsx(U,{className:"h-4 w-4","aria-hidden":"true"})})}),t.jsx(C,{className:"max-h-64 w-80 overflow-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs",children:JSON.stringify(e,null,2)})})]})}function R(e){if(e.initiator_kind)return{kind:e.initiator_kind,...e.initiator_ref};if(e.automation_id)return{kind:"automation",automation_id:e.automation_id};if(e.created_by_user_id)return{kind:"user",user_id:e.created_by_user_id}}function ie({run:e,ownerSlug:s}){const i=R(e);return i?i.kind==="system"?t.jsx(t.Fragment,{children:"by the system"}):t.jsxs(t.Fragment,{children:["by"," ",t.jsx(H,{ownerSlug:s,initiator:i,clientName:void 0,fallback:"a person"})]}):null}function ne({parts:e}){return t.jsx(t.Fragment,{children:e.map(([s,i],a)=>t.jsxs(x.Fragment,{children:[a>0?" · ":"",i]},s))})}function j(e,s){return[e.run_type?$(e.run_type):"Run",s.connection?e.connection_display_name:null,s.feed?e.feed_display_name??e.feed_key:null].filter(Boolean).join(" · ")}const ae=3;function g(e,s){const i=p(e.created_at);return e.status==="completed"&&i!=null?`${j(e,s)}|${Y(i,"yyyy-MM-dd")}`:null}function re(e,s){const i=new Map;for(const c of e){const n=g(c,s);n&&i.set(n,[...i.get(n)??[],c])}const a=[],o=new Set;for(const c of e){const n=g(c,s),l=n?i.get(n):void 0;!n||!l||l.length<ae?a.push({kind:"run",run:c}):o.has(n)||(o.add(n),a.push({kind:"group",name:j(c,s),runs:l}))}return a}function oe({name:e,runs:s,ownerSlug:i,columns:a}){const[o,c]=x.useState(!1),n=p(s[0].created_at),l=p(s[s.length-1].created_at),r=Date.now(),u=s.reduce((m,T)=>m+(T.items_collected??0),0),d=l!=null?_(l,r):null,f=n!=null?_(n,r):null,S=d&&f&&d!==f?`${d}–${f}`:f;return t.jsxs("div",{children:[t.jsx("button",{type:"button","aria-expanded":o,onClick:()=>c(m=>!m),className:h(w,"rounded-lg transition-colors hover:bg-accent/40"),children:t.jsx(y,{mark:t.jsx(J,{"aria-hidden":"true",className:h("h-4 w-4 text-muted-foreground transition-transform",o&&"rotate-90")}),name:e,details:t.jsx(q,{parts:[`${s.length} runs`,S,"all completed",u>0?`${u} ${u===1?"item":"items"}`:null]}),at:n})}),o?t.jsx("div",{className:"ml-6 border-l pl-2",children:s.map(m=>t.jsx("div",{className:"mb-1",children:t.jsx(L,{run:m,ownerSlug:i,columns:a})},m.id))}):null]})}function L({run:e,ownerSlug:s,columns:i={}}){const a=E(),o=p(e.created_at),c=p(e.completed_at),n=o!=null&&c!=null?Math.round((c-o)/1e3):null,l=j(e,i),r=i.startedBy&&R(e)?t.jsx(ie,{run:e,ownerSlug:s}):null,u=[["status",ee[e.status]??$(e.status)],e.error_message?["error",t.jsx(te,{error:e.error_message},"error")]:null,e.items_collected!=null&&(e.run_type==="sync"||e.items_collected>0)?["items",`${e.items_collected} ${e.items_collected===1?"item":"items"}`]:null,n!=null?["duration",K(n)]:null,r?["by",r]:null,e.connector_version?["version",`v${e.connector_version}`]:null,["id",`#${e.id}`]].filter(d=>d!==null);return t.jsxs("article",{"aria-label":`Run #${e.id}`,title:P(e.created_at),className:"group relative flex items-center rounded-lg transition-colors hover:bg-accent/40",children:[t.jsx("div",{className:h(w,"min-w-0 flex-1"),children:t.jsx(y,{mark:t.jsx(Z,{status:e.status}),name:t.jsx(v,{to:"/$owner/events",params:{owner:s},search:{run_ids:String(e.id)},"aria-label":`${l} · Run #${e.id}`,className:"hover:underline",onClick:d=>{!a||d.button!==0||d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||(d.preventDefault(),a.open({href:e.run_type==="automation"&&e.automation_id!=null?`/${s}/automations/${e.automation_id}?view=activity&run_id=${e.id}`:`/${s}/events?run_ids=${e.id}`,title:`Run #${e.id}`,runId:e.id}))},children:l}),tone:e.status==="failed"||e.status==="timeout"?"destructive":null,details:t.jsx(ne,{parts:u}),at:o,atClassName:"group-hover:invisible group-focus-within:invisible"})}),t.jsxs("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",children:[e.checkpoint?t.jsx(se,{checkpoint:e.checkpoint}):null,t.jsx(X,{ownerSlug:s,scope:{kind:"run",id:e.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})]})]})}function de({runs:e,ownerSlug:s,columns:i={},emptyState:a,hasNextPage:o=!1,isFetching:c=!1,isFetchingNextPage:n=!1,onLoadMore:l=()=>{}}){return t.jsx(Q,{items:re(e,i).map(r=>r.kind==="run"?{key:String(r.run.id),occurredAt:r.run.created_at,content:t.jsx(L,{run:r.run,ownerSlug:s,columns:i})}:{key:`group:${r.runs[0].id}`,occurredAt:r.runs[0].created_at,content:t.jsx(oe,{name:r.name,runs:r.runs,ownerSlug:s,columns:i})}),isLoading:!1,emptyState:a,hasNextPage:o,isFetching:c,isFetchingNextPage:n,onLoadMore:l})}export{L as R,X as V,de as a};
|
|
2
|
+
//# sourceMappingURL=runs-list-8gUPWjP4.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as i,
|
|
2
|
-
`):JSON.stringify(t):typeof t=="object"?Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,e])=>`${N(n)}: ${m(e)}`).join("; "):JSON.stringify(t)}function d(t,r){if(t==null)return"";if(typeof t=="boolean")return t?"Yes":"No";if(typeof t=="number")return r==="currency"?p(t):r===void 0||r==="text"?String(t):h(t);if(typeof t!="string")return m(t);switch(r){case"currency":return p(Number(t));case"date":return b(t);case"url":return g(t);case"enum":return N(t);case"number":return h(Number(t));case"auto":return S(t)?g(t):T(t)?b(t):t;default:return t}}function E(t){return t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):null}function R(t,r){return typeof t!="string"||!t.startsWith("@")||t.length===1?null:{action:t.slice(1),value:E(r)}}function k(t){return i.jsx("a",{...t})}const F=/^\d{4}-\d{2}-\d{2}$/;function I(t){if(F.test(t)){const[r,n,e]=t.split("-").map(Number),s=new Date(0);return s.setHours(0,0,0,0),s.setFullYear(r,n-1,e),s}return new Date(t)}function
|
|
3
|
-
//# sourceMappingURL=schema-value-
|
|
1
|
+
import{j as i,e9 as w,i as L,L as A,fZ as D,f_ as $}from"./index-CdDNNAx2.js";const U=/^\d{4}-\d{2}-\d{2}(?:[tT ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,O=/^\d{4}-\d{2}-\d{2}$/;function T(t){return U.test(t)}function S(t){if(!/^https?:\/\//i.test(t))return!1;try{const r=new URL(t);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function N(t){return t.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,r=>r.toUpperCase())}function p(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:t>=1e3?"compact":"standard",maximumFractionDigits:t>=1e9?1:0}).format(t)}function h(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(t)?0:2}).format(t)}function b(t){const r=new Date(O.test(t)?`${t}T00:00:00`:t);return Number.isNaN(r.getTime())?t:r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function g(t){try{const r=new URL(t),n=r.hostname.replace(/^www\./i,""),e=r.pathname&&r.pathname!=="/"?r.pathname.replace(/\/$/,""):"";return`${n}${e}`}catch{return t}}function m(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(d(t)):Array.isArray(t)?t.some(r=>typeof r=="object"&&r!==null)?t.map((r,n)=>`${n+1}. ${m(r)}`).join(`
|
|
2
|
+
`):JSON.stringify(t):typeof t=="object"?Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,e])=>`${N(n)}: ${m(e)}`).join("; "):JSON.stringify(t)}function d(t,r){if(t==null)return"";if(typeof t=="boolean")return t?"Yes":"No";if(typeof t=="number")return r==="currency"?p(t):r===void 0||r==="text"?String(t):h(t);if(typeof t!="string")return m(t);switch(r){case"currency":return p(Number(t));case"date":return b(t);case"url":return g(t);case"enum":return N(t);case"number":return h(Number(t));case"auto":return S(t)?g(t):T(t)?b(t):t;default:return t}}function E(t){return t==null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):null}function R(t,r){return typeof t!="string"||!t.startsWith("@")||t.length===1?null:{action:t.slice(1),value:E(r)}}function k(t){return i.jsx("a",{...t})}const F=/^\d{4}-\d{2}-\d{2}$/;function I(t){if(F.test(t)){const[r,n,e]=t.split("-").map(Number),s=new Date(0);return s.setHours(0,0,0,0),s.setFullYear(r,n-1,e),s}return new Date(t)}function _(t,r){const n=I(t);return Number.isNaN(n.getTime())?t:r?n.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):w(n,"LLL dd, y")}function x(t){return t?t["x-currency"]||t.format==="currency"?"currency":t.format==="uri"||t.format==="url"?"url":t.enum?.length?"enum":t.type==="number"||t.type==="integer"?"number":t.type==="boolean"?"boolean":"auto":"auto"}function j(t){return t==null||t===""||Array.isArray(t)&&t.length===0}function C(t){return Array.isArray(t)&&t.some(r=>typeof r=="object"&&r!==null)}function V(t,r,n){const e=$(r,t);return e!==void 0?e:typeof t=="string"&&(r?.format==="date"||r?.format==="date-time")?_(t,r.format==="date-time"):d(t,n)}function y(t,r){return!r||t===null||typeof t!="object"?t:Array.isArray(t)?t.map(n=>y(n,r.items)):Object.fromEntries(Object.entries(t).filter(([n])=>!D(r.properties?.[n])).map(([n,e])=>[n,y(e,r.properties?.[n])]))}function l({value:t,prop:r,format:n,resolveLink:e,className:s}){const c=String(t),o=e?.(c);if(o)return i.jsx(A,{to:o.to,className:"text-primary hover:underline",onClick:a=>a.stopPropagation(),children:o.label});const u=typeof t=="string"&&S(t),f=n==="url"&&!u?c:V(t,r,n);return u?i.jsx(k,{href:t,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline [overflow-wrap:anywhere]",onClick:a=>a.stopPropagation(),children:f}):i.jsx("span",{className:s,children:f})}function Y({value:t,prop:r,format:n,resolveLink:e,empty:s="-",className:c}){if(j(t))return i.jsx("span",{className:"text-muted-foreground",children:s});if(C(t)){const o=t.length;return i.jsxs("span",{className:c,children:[o," ",o===1?"item":"items"]})}if(Array.isArray(t)){const o=t.filter(f=>!j(f)),u=r?.items??r;return i.jsx("span",{className:L("inline-flex flex-wrap gap-x-1",c),children:o.map((f,a)=>i.jsxs("span",{children:[i.jsx(l,{value:f,prop:u,format:n??x(u),resolveLink:e}),a<o.length-1&&","]},`${a}:${String(f)}`))})}return typeof t=="object"?i.jsx("span",{className:c,children:d(y(t,r))}):i.jsx(l,{value:t,prop:r,format:n??x(r),resolveLink:e,className:c})}export{Y as S,_ as a,d as f,S as i,I as p,R as t};
|
|
3
|
+
//# sourceMappingURL=schema-value-k19Ata7u.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as t,L as m,A as u,n as p,cQ as x,x as f,r as h,e2 as v}from"./index-CdDNNAx2.js";import{e as g,f as c,c as j}from"./event-kind-options-fHAIXu24.js";import{o as b,F as N,b as y}from"./filter-editors-DDTwyYt0.js";const F="h-8 rounded-md border border-input bg-muted text-sm";function E(i,{platforms:e}={}){const{isMember:o}=p(),n=o?i:null,{data:r=[]}=x(n),{data:a=[]}=f(n?{organizationId:n}:void 0);return h.useMemo(()=>j({connectors:r,entityTypes:a,selectedPlatforms:e}),[r,a,e])}function L({owner:i,organizationId:e,activitySearch:o,kinds:n,onKindsChange:r,platforms:a}){const l=n??[],s=l.length>0?{semantic_types:l.join(",")}:{};return t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r?t.jsx(O,{organizationId:e,kinds:l,onKindsChange:r,platforms:a}):t.jsx("span",{className:"flex-1"}),t.jsxs(m,{to:"/$owner/events",params:{owner:i},search:{...o,...s},className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Open in Activity",t.jsx(u,{"aria-hidden":"true",className:"h-3.5 w-3.5"})]})]})}function O({organizationId:i,kinds:e,onKindsChange:o,platforms:n}){const r=E(i,{platforms:n}),a={key:"kind",label:"Event kind",icon:t.jsx(v,{className:"h-4 w-4"}),editor:b({searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",options:g(r,e).map(s=>({value:s,label:c(s)})),selected:e,multiple:!0,onSelect:s=>o(e.includes(s)?e.filter(d=>d!==s):[...e,s])})},l=e.length>0?[{id:"kind",label:"Kind",value:e.length<=2?e.map(c).join(", "):`${e.length} kinds`,title:e.map(c).join(", "),onRemove:()=>o([])}]:[];return t.jsxs(t.Fragment,{children:[t.jsx(N,{label:"Feed filters",menu:!1,fields:[a],chips:l,className:"flex-1"}),t.jsx(y,{fields:[a],triggerClassName:F})]})}export{L as S};
|
|
2
|
+
//# sourceMappingURL=scoped-feed-bar-L7h-Ca4u.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=settings-
|
|
1
|
+
import{z as l,j as e,B as i,L as t,J as c,ar as o,as as d}from"./index-CdDNNAx2.js";import{F as m}from"./full-page-spinner-DWo519BU.js";function h(){const{session:a,isReady:n}=l();if(!n)return e.jsx(m,{});if(!a?.user)return e.jsxs("div",{className:"mx-auto w-full max-w-md space-y-4 px-4 py-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Account settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Sign in to view your profile and account details."}),e.jsx(i,{asChild:!0,children:e.jsx(t,{to:"/auth/login",search:c({intent:"sign-in",callbackUrl:"/account/settings"}),children:"Sign in"})})]});const{user:s}=a,r=s.name?.trim()||"User";return e.jsx(o,{className:"py-8",children:e.jsxs(d,{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Account settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your personal profile and sign-in details."})]}),e.jsxs("section",{"aria-labelledby":"account-profile-heading",className:"space-y-5 border-b border-border pb-8",children:[e.jsx("h2",{id:"account-profile-heading",className:"text-sm font-medium",children:"Profile"}),e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[s.image?e.jsx("img",{src:s.image,alt:"",referrerPolicy:"no-referrer",className:"h-12 w-12 shrink-0 rounded-full object-cover"}):e.jsx("div",{"aria-hidden":"true",className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-muted text-lg font-medium",children:(s.name?.trim()||s.email||"U").charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"break-words font-medium",children:r}),e.jsx("p",{className:"break-all text-sm text-muted-foreground",children:s.email})]})]}),e.jsxs("details",{className:"space-y-3",children:[e.jsx("summary",{className:"w-fit cursor-pointer rounded-sm text-sm text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Account details"}),e.jsxs("dl",{className:"space-y-1 text-sm",children:[e.jsx("dt",{className:"text-muted-foreground",children:"User ID"}),e.jsx("dd",{className:"break-all font-mono text-xs",children:s.id})]})]})]}),e.jsxs("section",{"aria-labelledby":"account-session-heading",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{id:"account-session-heading",className:"text-sm font-medium",children:"Session"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign out of your account on this device."})]}),e.jsx(i,{variant:"outline",asChild:!0,children:e.jsx(t,{to:"/auth/logout",children:"Sign out"})})]})]})})}export{h as component};
|
|
2
|
+
//# sourceMappingURL=settings-BZqntV3E.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{G as y,dA as b,fP as R,j as e,B as j,fQ as v,m as _,bR as C,L,fg as F,I as E}from"./index-CdDNNAx2.js";import{a as P,R as $,b as A}from"./events-feed-BI7wNRUY.js";import{a as S}from"./run-initiator-B8IRlRd-.js";function f({failures:o,onRetry:c,isError:l=!1,isFetching:d=!1}){return o.length===0&&!l?null:e.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-3 rounded-md border border-destructive/40 px-3 py-2 text-xs",children:[e.jsxs("span",{children:[o.length<=1?"A source":`${o.length} sources`," could not be read, so some items may be missing."]}),e.jsx(j,{size:"sm",variant:"outline",className:"h-7",onClick:c,disabled:d,children:"Retry"})]})}function z({record:o,orgContext:c,filters:l}){const{orgContext:d}=y(),t=c??d,{data:p}=b({queryKey:["connector-definitions","source-record",t.organizationId,t.slug],queryFn:()=>E(t),enabled:!!(t.organizationId||t.slug),staleTime:6e4}),{data:i,isLoading:u,isError:n,refetch:x,fetchNextPage:a,hasNextPage:h,isFetching:g,isFetchingNextPage:s}=R(o,t,l),N=i?.pages.flatMap(r=>r.events)??[],m=i?.pages.flatMap(r=>r.failures)??[];return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(f,{failures:m,isError:n,isFetching:g,onRetry:()=>void x()}),e.jsx(S,{isLoading:u,hasNextPage:!!h&&!n,autoLoadMore:m.length===0,isFetching:g,isFetchingNextPage:s,onLoadMore:()=>void a(),emptyState:n||m.length>0||h?null:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No activity for this record in its connected sources."}),items:N.map(r=>({key:`${r.feed_id}:${r.origin_id}`,occurredAt:r.occurred_at,content:e.jsx("div",{className:"p-3",children:e.jsx(P,{ownerSlug:t.slug,connectorDefinitions:p,content:{...r,title:r.title||r.origin_type||r.origin_id,text_content:r.payload_text??""}})})}))})]})}function B({record:o,ownerSlug:c,orgContext:l}){const{orgContext:d}=y(),{data:t,isLoading:p,isError:i,refetch:u,hasNextPage:n,fetchNextPage:x,isFetching:a,isFetchNextPageError:h,error:g}=v(o,l??d);return p?e.jsx(_,{className:"h-12 w-full rounded-lg"}):t?e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{count:t.relationshipFailures?.length??0,onRetry:()=>void u()}),e.jsx(f,{failures:t.failures,isError:i,isFetching:a,onRetry:()=>{if(a)return;const s=g instanceof C&&g.status===400;h&&!s||!i&&n?x():u()}}),t.links.length===0&&(t.relationships?.length??0)===0&&t.failures.length===0&&(t.relationshipFailures?.length??0)===0&&!n&&!i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this record in its connected sources."}),t.links.length===0&&(t.relationships?.length??0)===0&&n&&!i&&t.failures.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"More source records remain to check for relationships."}),e.jsxs("ul",{className:"space-y-1",children:[(t.relationships??[]).map(s=>e.jsx("li",{className:"rounded-lg border px-3 py-2",children:e.jsx(A,{row:s,entityId:o.key,entityType:o.type,ownerSlug:c,orgContext:l??d})},`authored:${s.id}`)),t.links.map(s=>e.jsx("li",{children:e.jsx(L,{to:F(c,[{entity_type:s.entity_type,slug:s.key}]),className:"flex items-center justify-between rounded-lg border px-3 py-2 text-sm hover:bg-muted/50",children:e.jsxs("span",{children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.relationship_type.replaceAll("_"," "),s.direction==="incoming"?" (from)":""," ·"," ",s.entity_type," ·"," "]}),s.name]})})},`${s.relationship_type}:${s.direction}:${s.entity_type}:${s.key}`))]}),n&&!i&&t.failures.length===0&&e.jsx(j,{variant:"outline",size:"sm",disabled:a,onClick:()=>void x(),children:a?"Loading…":"Load more"})]}):e.jsx(f,{failures:[],isError:!0,isFetching:a,onRetry:()=>void u()})}export{z as S,B as a};
|
|
2
|
+
//# sourceMappingURL=source-record-panels-C4UItfdk.js.map
|