@lobu/runtime-server 24.8.0 → 24.10.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/automations.json +2 -2
- package/dist/catalogs/connectors.json +99 -10
- 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/market_quotes.ts +388 -91
- package/dist/connectors/postgres.ts +60 -38
- package/dist/connectors/whatsapp-web-adapter.js +41 -10
- package/dist/connectors/whatsapp-web-helpers.ts +12 -2
- package/dist/connectors/whatsapp_web.ts +18 -2
- 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/db/migrations/20261112210000_instance_identity.sql +18 -0
- package/dist/dependencies.bun.lock +88 -86
- package/dist/embeddings-server.mjs +38 -5
- package/dist/owletto/dist/assets/_-CYvj1y65.js +3 -0
- package/dist/owletto/dist/assets/_-CeLTSYYY.js +2 -0
- package/dist/owletto/dist/assets/_agentId-BB5E-L6T.js +2 -0
- package/dist/owletto/dist/assets/_agentId-DN0EwMAC.js +2 -0
- package/dist/owletto/dist/assets/_automationId-DvUl9CSd.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CVKfL9AG.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-Cv6FzK1v.js +2 -0
- package/dist/owletto/dist/assets/{_conversationId-OJrZjd0o.js → _conversationId-CPpNySjO.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-DZKicuq6.js +2 -0
- package/dist/owletto/dist/assets/_owner-Dauk3YuD.js +3 -0
- package/dist/owletto/dist/assets/_shape-cKrEID3T.js +2 -0
- package/dist/owletto/dist/assets/_slug-DJx_8fsV.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CPVzVKEf.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CW8gexOQ.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-Dwq1GAnG.js +2 -0
- package/dist/owletto/dist/assets/activity-route-location-C1jcXC7v.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-D78Wj0RH.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-DoI9UR0a.js +4 -0
- package/dist/owletto/dist/assets/{agent-editor-form-CDAHRNWl.js → agent-editor-form-DlavYg2q.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-BupiSjR-.js → agent-loading-shells-DYqQphN7.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-C1L8IcYR.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-B0ZYVE3n.js → agent-skill-context-D1nMrVod.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-ByU0xhXn.js → agent-subpage-shell-2w7vTeXw.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-DiVKn1WX.js → agent-thread-BopD-2k1.js} +2 -2
- package/dist/owletto/dist/assets/{app._appId-BQWElSoP.js → app._appId-BXeFXW1w.js} +2 -2
- package/dist/owletto/dist/assets/{assist-composer-igTXq3DL.js → assist-composer-CL5x8pNt.js} +2 -2
- package/dist/owletto/dist/assets/automation-run-now-MtxUTfzd.js +2 -0
- package/dist/owletto/dist/assets/{callback-Dmaio9CX.js → callback-BgfwP1Eo.js} +2 -2
- package/dist/owletto/dist/assets/{card-rE4Ctuy6.js → card-DtLIFq7D.js} +2 -2
- package/dist/owletto/dist/assets/{claim-BN17CPYh.js → claim-CT3hYVMF.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-B7xVaUA-.js → client-activity-scopes-BPbRX-Pe.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-B3LULJxW.js → client-rows-vrNA6FLs.js} +2 -2
- package/dist/owletto/dist/assets/clients-xnzZeEdZ.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-UppEMWpt.js → code-editor-mrKkAfcE.js} +2 -2
- package/dist/owletto/dist/assets/connect-NUCSay8X.js +2 -0
- package/dist/owletto/dist/assets/{connect-menu-B9u86bb2.js → connect-menu-C6iVtuSo.js} +2 -2
- package/dist/owletto/dist/assets/connect._clientId-Cp-d9Q5b.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId-CaF-ZWlZ.js → connected._clientId-ROfVgp9h.js} +2 -2
- package/dist/owletto/dist/assets/connection-BMz740Wi.js +2 -0
- package/dist/owletto/dist/assets/{connection-feed-detail-CJYqryAV.js → connection-feed-detail-0VAJiZTP.js} +2 -2
- package/dist/owletto/dist/assets/connector-page-shell-BFv21yuv.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-CW4CXtCz.js → connector-provenance-b59RfBtk.js} +2 -2
- package/dist/owletto/dist/assets/connectors-nYS31lO2.js +2 -0
- package/dist/owletto/dist/assets/consent-cPRF9JQv.js +2 -0
- package/dist/owletto/dist/assets/{copy-button-1ALlvZU1.js → copy-button-C3wMMv63.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-6koO33th.js → core.esm-C9QlSrgK.js} +3 -3
- package/dist/owletto/dist/assets/{create-kUevP9Xx.js → create-ASRN3Obq.js} +2 -2
- package/dist/owletto/dist/assets/create-CBcodaSO.js +2 -0
- package/dist/owletto/dist/assets/create-CGOWfMk4.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-BhujNbRr.js → create-automation-form-CLicoPH5.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-s4xkktTC.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-B_aCgvoZ.js → custom-guardrail-edits-BUL7nmuO.js} +2 -2
- package/dist/owletto/dist/assets/{definition-comparison-3zKUSTt8.js → definition-comparison-4UYMI6BK.js} +2 -2
- package/dist/owletto/dist/assets/{detail-page-skeleton-BmxqqIsH.js → detail-page-skeleton-C8v3rJXK.js} +2 -2
- package/dist/owletto/dist/assets/device-BBwsOi7q.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-Bcpe7nAA.js +2 -0
- package/dist/owletto/dist/assets/{device._deviceId-Dqtmb1Xp.js → device._deviceId-DLT4jh0Z.js} +2 -2
- package/dist/owletto/dist/assets/{dynamic-schema-form-D3KnzCsW.js → dynamic-schema-form-BDT8x0Vg.js} +2 -2
- package/dist/owletto/dist/assets/entity-options-B9hm9V87.js +2 -0
- package/dist/owletto/dist/assets/entity-page-DZjzQ2V4.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-BWBpttz3.js +2 -0
- package/dist/owletto/dist/assets/entity-schema-graph-lMMx3HhR.js +2 -0
- package/dist/owletto/dist/assets/{entity-type-page-CouHZbc9.js → entity-type-page-CkQm0yEu.js} +2 -2
- package/dist/owletto/dist/assets/event-detail-CkzfakTK.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DmRzikZW.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-CQoSj-20.js +3 -0
- package/dist/owletto/dist/assets/{full-page-spinner-B7A6Ycyi.js → full-page-spinner-CYyCnKve.js} +2 -2
- package/dist/owletto/dist/assets/index-BE7eb2kE.js +2 -0
- package/dist/owletto/dist/assets/index-BFR0uiKY.js +2 -0
- package/dist/owletto/dist/assets/{index-DXfYVs5m.js → index-BS5Ty3tf.js} +2 -2
- package/dist/owletto/dist/assets/index-C38OzBpB.js +2 -0
- package/dist/owletto/dist/assets/{index-BztXeLBN.js → index-C3hz9tzx.js} +2 -2
- package/dist/owletto/dist/assets/index-CDyFQ32o.js +2 -0
- package/dist/owletto/dist/assets/{index-B-dZruj6.js → index-CUndAH6o.js} +2 -2
- package/dist/owletto/dist/assets/index-CiKysEhV.js +2 -0
- package/dist/owletto/dist/assets/index-DByaMzsG.js +7906 -0
- package/dist/owletto/dist/assets/index-DfdinB7B.js +2 -0
- package/dist/owletto/dist/assets/index-DgMM4Zt5.css +1 -0
- package/dist/owletto/dist/assets/index-Xk711gVC.js +2 -0
- package/dist/owletto/dist/assets/index-ittfA0k8.js +2 -0
- package/dist/owletto/dist/assets/{json-diff-CJK-gzCt.js → json-diff-mcDgyct_.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-bQAZ0hQp.js → list-skeleton-DsYGUHxi.js} +2 -2
- package/dist/owletto/dist/assets/login-EoLq136v.js +2 -0
- package/dist/owletto/dist/assets/{logout-H0F3IfiO.js → logout-gLgEQOiX.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-Doic_6qX.js → member-scope-gate-vvkgSAb2.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-DvDtwrEI.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-BrfaDwIg.js → model-selector-D3vSMLO2.js} +2 -2
- package/dist/owletto/dist/assets/needs-you-list-B5Bgd05M.js +2 -0
- package/dist/owletto/dist/assets/new-BPW3V0Y1.js +2 -0
- package/dist/owletto/dist/assets/new-Bk_flKQO.js +2 -0
- package/dist/owletto/dist/assets/new-C5HtQdM_.js +2 -0
- package/dist/owletto/dist/assets/new-dLXsCHBd.js +2 -0
- package/dist/owletto/dist/assets/organization-DBfgBkzq.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-c2PG3TEX.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-DYYOoCvj.js → pending-seed-CBhx2Ql-.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-BVwOMoq9.js → proposal-review-shell-B-jYcKfB.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-D8TijlRY.js +2 -0
- package/dist/owletto/dist/assets/record-activity-DnRVOrG2.js +2 -0
- package/dist/owletto/dist/assets/{record-session-KuEDuF3S.js → record-session-CAmGHMyM.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-ucwCQmBk.js → renderer-olRv_HMI.js} +3 -3
- package/dist/owletto/dist/assets/reset-password-B9_xi8Pq.js +2 -0
- package/dist/owletto/dist/assets/{run-initiator-8vdkq-3o.js → run-initiator-DhE5v4z0.js} +2 -2
- package/dist/owletto/dist/assets/runs-C8sZQr4o.js +2 -0
- package/dist/owletto/dist/assets/runs-list-CwtH-wmk.js +2 -0
- package/dist/owletto/dist/assets/{schema-value-CefbtPIY.js → schema-value-zTJGE4eh.js} +3 -3
- package/dist/owletto/dist/assets/scoped-feed-bar-BKyJSa3_.js +2 -0
- package/dist/owletto/dist/assets/{settings-DvzkRYQy.js → settings-z02cvVS3.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-CGmKIJdN.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-BxHtpMOj.js → status-variants-DyRCXBzM.js} +2 -2
- package/dist/owletto/dist/assets/subDays-D8nHthaS.js +2 -0
- package/dist/owletto/dist/assets/{table-1O-ik4_O.js → table-C637cQxG.js} +2 -2
- package/dist/owletto/dist/assets/use-automations-CgWNoYio.js +2 -0
- package/dist/owletto/dist/assets/use-login-redirect-tDdhXTpt.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-CA-evCDf.js → use-mention-search-D-kIKchD.js} +2 -2
- package/dist/owletto/dist/assets/view-param-filters-CUCj9Df-.js +2 -0
- package/dist/owletto/dist/assets/views-access-required-C35Dyt91.js +2 -0
- package/dist/owletto/dist/index.html +19 -12
- package/dist/server-main.bundle.mjs +6964 -4213
- package/npm-shrinkwrap.json +423 -406
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +29 -2
- package/vendor/connector-sdk/dist/index.d.ts +1 -0
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
- package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
- package/vendor/connector-sdk/dist/logger.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +1 -1
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
- package/vendor/connector-sdk/dist/retry.d.ts +1 -1
- package/vendor/connector-sdk/dist/retry.js +1 -1
- package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
- package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.d.ts +4 -5
- package/vendor/core/dist/classify-error.js +10 -10
- 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 +67 -3
- package/vendor/core/dist/contracts/tools/manage-automations.js +38 -9
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
- 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/save-memory.d.ts +11 -1
- package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
- package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
- 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 +28 -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/credentials.d.ts +12 -0
- package/vendor/core/dist/credentials.js +1 -0
- package/vendor/core/dist/errors.d.ts +17 -24
- package/vendor/core/dist/errors.js +19 -26
- package/vendor/core/dist/types.d.ts +0 -6
- package/vendor/core/dist/worker/auth.d.ts +5 -0
- package/vendor/core/dist/worker/auth.js +15 -4
- package/vendor/core/package.json +11 -1
- package/vendor/postgres/cf/src/connection.js +7 -2
- package/vendor/postgres/cjs/src/connection.js +7 -2
- package/vendor/postgres/src/connection.js +7 -2
- 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/dist/native.d.ts +33 -1
- package/vendor/views/dist/native.js +3 -0
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-B0tmXZ86.js +0 -2
- package/dist/owletto/dist/assets/_-DwXULq4r.js +0 -3
- package/dist/owletto/dist/assets/_agentId-B1dNkhnr.js +0 -2
- package/dist/owletto/dist/assets/_agentId-sYjvnBaB.js +0 -2
- package/dist/owletto/dist/assets/_automationId-Bnw_CnT_.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-D7Z8DQ-B.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-DM5MTO8c.js +0 -2
- package/dist/owletto/dist/assets/_eventId-CfB0_2zK.js +0 -2
- package/dist/owletto/dist/assets/_owner-BDvTUY0a.js +0 -3
- package/dist/owletto/dist/assets/_shape-BZidoJMB.js +0 -2
- package/dist/owletto/dist/assets/_slug-R989vOiM.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BDUSrpe5.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BnFqh5-t.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-BC-ZIsrf.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-CN2dOiCD.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-CdDjrHjn.js +0 -4
- package/dist/owletto/dist/assets/agent-permissions-matrix-ju7L2M0l.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-BJwRU6qT.js +0 -2
- package/dist/owletto/dist/assets/clients-CydgUHrc.js +0 -2
- package/dist/owletto/dist/assets/connect-OdHpIVV9.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-EI1tcdSE.js +0 -2
- package/dist/owletto/dist/assets/connection-D8ZAMHBT.js +0 -2
- package/dist/owletto/dist/assets/connector-boxes-BWPXijAk.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-C23dWdKz.js +0 -2
- package/dist/owletto/dist/assets/connectors-Bp08_KPq.js +0 -2
- package/dist/owletto/dist/assets/consent-_PpYI1cT.js +0 -2
- package/dist/owletto/dist/assets/create-DULVO0HS.js +0 -2
- package/dist/owletto/dist/assets/create-Drx9tcnG.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-N6fhcIPy.js +0 -2
- package/dist/owletto/dist/assets/device-D2eUt_nr.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-BFPbTM_o.js +0 -2
- package/dist/owletto/dist/assets/entity-options-IUdQ-64R.js +0 -2
- package/dist/owletto/dist/assets/entity-page-B3Im65EI.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-DJNSQrfB.js +0 -2
- package/dist/owletto/dist/assets/event-detail-CvaRN1qB.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DwOkLk6A.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-DQ5V4Cvh.js +0 -2
- package/dist/owletto/dist/assets/home-stream-Bg97PUBJ.js +0 -2
- package/dist/owletto/dist/assets/home-toolbar-CpCcHA6z.js +0 -2
- package/dist/owletto/dist/assets/index-9PGnv4-5.js +0 -2
- package/dist/owletto/dist/assets/index-C2TCKJDP.js +0 -7901
- package/dist/owletto/dist/assets/index-C7QM3aqU.js +0 -2
- package/dist/owletto/dist/assets/index-CWn46a4y.js +0 -2
- package/dist/owletto/dist/assets/index-CxJONizf.js +0 -2
- package/dist/owletto/dist/assets/index-DJhb3li3.js +0 -2
- package/dist/owletto/dist/assets/index-DY-YGnCe.js +0 -2
- package/dist/owletto/dist/assets/index-j3v7ITPb.js +0 -2
- package/dist/owletto/dist/assets/index-oiy6ygaI.js +0 -2
- package/dist/owletto/dist/assets/index-pEgtAY1t.js +0 -2
- package/dist/owletto/dist/assets/index-xAvK3IyQ.css +0 -1
- package/dist/owletto/dist/assets/login-DLqL54Rk.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-CUea2Llz.js +0 -74
- package/dist/owletto/dist/assets/new-5GkxlOuQ.js +0 -2
- package/dist/owletto/dist/assets/new-BiA4DGoN.js +0 -2
- package/dist/owletto/dist/assets/new-M-MX_T5C.js +0 -2
- package/dist/owletto/dist/assets/organization-CLrcmgNK.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-B29OcHwm.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-BbjPgh3k.js +0 -2
- package/dist/owletto/dist/assets/record-activity-BCpNKaUo.js +0 -2
- package/dist/owletto/dist/assets/reset-password-BkiAmXZW.js +0 -2
- package/dist/owletto/dist/assets/runs-B_iywKWb.js +0 -2
- package/dist/owletto/dist/assets/runs-list-CJJFRhTl.js +0 -2
- package/dist/owletto/dist/assets/schema-type-editor-panel-C4e8pq1A.js +0 -2
- package/dist/owletto/dist/assets/scoped-feed-bar-CapleZvS.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-LJIWGtHb.js +0 -2
- package/dist/owletto/dist/assets/subDays-DwIOMzYC.js +0 -2
- package/dist/owletto/dist/assets/use-automations-lV8PuE8L.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-CfCbEeJR.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-Bp84PUMd.js +0 -2
- package/dist/owletto/dist/assets/views-access-required-BerT4Z1d.js +0 -2
- /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{eh as xn,j as t,aa as hn,$ as gn,cR as yn,u as Pe,ei as jn,i as G,cZ as $t,ej as ct,r as j,ek as Ot,el as vn,d3 as bn,a2 as H,dk as Je,L as W,b4 as Le,b5 as Qe,em as _n,co as Nn,en as wn,eo as kn,dj as Pt,ep as Cn,eq as An,b9 as Rn,er as Sn,dC as $n,q as In,es as Tn,bG as Re,z as et,et as gt,cC as Ye,I as En,cP as Ae,eu as Bt,ev as Ut,ew as Ge,ex as zt,c8 as Kt,ey as Mn,ez as Dn,eA as Fn,eB as Ln,B as O,eC as dt,e6 as ut,eD as qt,eE as Vt,eF as On,e3 as Ht,e4 as Wt,e7 as Jt,cH as Pn,cI as Bn,a7 as Qt,cK as Un,eG as zn,c as Kn,H as qn,G as Vn,bo as Ue,eH as Hn,ad as Wn,eI as mt,eJ as Jn,U as Qn,eK as Yn,bI as Gn,ai as Ne,eL as Yt,dl as yt,e5 as Zn,eM as Xn,eN as es,eO as ts,eP as ns,bX as ss,eQ as rs,c0 as as,eR as is,a4 as os,eS as ls,X as cs,cL as ds,c1 as us,eT as ms,eU as ps,eV as fs,v as xs,eW as hs,dO as Se,eX as Gt,eY as gs,eZ as ys,e_ as js,e$ as vs,f0 as bs,f1 as _s,f2 as Ns,n as ws,d5 as ks,dS as Cs,ct as As,s as Rs,t as Ss,dV as $s,f3 as Is,f4 as Ts,f5 as Es,f6 as It,f7 as Ms,f8 as Ds,f9 as Fs,bT as Ls,fa as ze,fb as Os,fc as Ps,fd as Bs}from"./index-C2TCKJDP.js";import{D as Us,A as zs,a as Ks,T as qs,b as Vs,c as Hs,d as Ws}from"./definition-comparison-3zKUSTt8.js";import{R as Js,p as Qs,a as Ys,i as Gs,b as Zs}from"./run-initiator-8vdkq-3o.js";import{a as Zt}from"./use-automations-lV8PuE8L.js";import{l as Xs,s as er,J as tr}from"./renderer-ucwCQmBk.js";import{S as nr}from"./schema-value-CefbtPIY.js";import{J as We}from"./json-diff-CJK-gzCt.js";import{C as Tt}from"./copy-button-1ALlvZU1.js";import{A as Et}from"./device-automation-Dp3faMvp.js";function Xt(e){const n=Array.isArray(e?.records)?e.records:Array.isArray(e?.current)?e.current:[];return[e?.from_entity_id??e?.entity_id,e?.to_entity_id].map(s=>{const a=n.find(i=>i&&typeof i=="object"&&"id"in i&&i.id===s);return{id:String(s??"unknown"),name:typeof a?.name=="string"?a.name:`Record ${String(s??"unknown")}`}})}function en(e,n){return n==="rejected"?"The proposed relationship change was rejected. Both records remain available.":n==="failed"?"The relationship change failed. Both records remain available.":n==="completed"?e==="link"?"The records were linked. Both records remain available.":"The relationship was removed. Both records remain available.":n==="approved"||n==="confirmed"?"The relationship change was approved. Both records remain available.":e==="link"?"If approved, these records will be linked. Both records remain available.":"If approved, this relationship will be removed. Both records remain available."}function za(e){const n=Xt(e.proposal);return{title:e.action==="link"?"Link records":"Unlink records",icon:"entity",impact:{level:"normal"},tone:"default",blocks:[...n.map((s,r)=>({type:"text",label:r===0?"From":"To",value:s.name})),{type:"text",label:"Relationship",value:String(e.proposal?.relationship_type??e.proposal?.relationship_type_slug??"Relationship")},{type:"text",value:en(e.action,typeof e.status=="string"?e.status:void 0),muted:!0},...typeof e.reason=="string"&&e.reason?[{type:"text",label:"Why this needs approval",value:e.reason}]:[]],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",confirm:e.action==="unlink",confirmPrompt:"Remove this relationship? Both records will remain available.",tool:"manage_operations",args:{action:"approve"},resolvedLabel:"Approval submitted."},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this relationship change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:"Relationship change rejected."}]}}function rt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function sr(e){const n=rt(e.proposal);if(!n)return null;const s=rt(e.current);if(e.tool==="manage_agents"){if(!["create","update","delete"].includes(String(n.action)))return null;const r=xn({current:s,proposal:n});return{kind:"agent",current:n.action==="create"?null:r.current,proposed:n.action==="delete"?null:r.proposed}}if(e.tool==="manage_automations"){const r=rt(n.args);if(!r||!["create","update","create_version","set_reaction_script"].includes(String(r.action)))return null;const{action:a,automation_id:i,expected_version:c,...o}=r;return{kind:"automation",current:a==="create"?null:s,proposed:{...a==="create"?null:s,...o}}}return null}function rr({proposal:e}){return t.jsxs("div",{className:"space-y-3",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Recorded configuration and requested changes. Fields absent from the snapshot are not shown; creation uses the normal defaults."}),t.jsx(Us,{current:e.current,proposed:e.proposed,render:n=>e.kind==="agent"?t.jsx(zs,{value:n}):t.jsx(Ks,{value:n})})]})}async function ar(e,n,s,r){const a=await hn(`${gn}/api/${encodeURIComponent(e)}/events/${n}/actions/${encodeURIComponent(s.action)}`,{method:"POST",timeoutMs:9e4,credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s.value,interaction_id:r})});return await yn(a,"Could not record interaction"),a.json()}function U(e){if(typeof e!="string")return;const n=e.trim();return n.length>0?n:void 0}function at(e){return typeof e=="boolean"?e:void 0}function ir(e,n,s){const r=(s??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||n?.prepared===!0||typeof n?.verified=="boolean"||U(n?.reason_preview)&&U(n?.message)||U(e?.body)&&(U(e?.post_url)||U(e?.activity_id)))}function or(e,n,s){if(!ir(e,n,s))return null;const r=(s??"").toLowerCase(),a=U(n?.body)??U(e?.body),i=U(n?.reason_preview)??U(e?.reason),c=U(n?.post_url)??U(e?.post_url)??(U(e?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${U(e?.activity_id)}`:void 0),o=at(n?.prepared),l=at(n?.verified),d=at(n?.banner_shown),p=U(n?.message),u=n?.match&&typeof n.match=="object"?n.match:null,m=U(u?.text_preview),_=U(u?.author);let w="generic";r==="verify_staged_comment"||r.includes("verify")||typeof l=="boolean"?w="verify":(r==="prepare_comment"||r.includes("prepare")||o===!0||a&&c)&&(w="prepare");const h=[];return o===!0&&h.push("Staged — not posted"),o===!1&&h.push("Not staged"),l===!0&&h.push("Verified posted"),l===!1&&h.push("Not verified as posted"),d===!0&&h.push("In-page banner"),d===!1&&h.push("No banner"),{kind:w,message:p,reason:i,body:a,postUrl:c,prepared:o,bannerShown:d,verified:l,matchPreview:m,matchAuthor:_,chips:h}}const Ke="inline-flex max-w-full items-center truncate rounded-md border border-border px-1.5 py-0.5 text-xs";function tn({peer:e,ownerSlug:n,orgContext:s}){const r=Pe();if(e.url&&!e.self&&e.type){const i=jn(e.url);return i?t.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:G(Ke,"hover:bg-muted"),title:e.type,onClick:c=>c.stopPropagation(),children:t.jsx("span",{className:"truncate",children:e.name})}):t.jsx("span",{className:G(Ke,"text-muted-foreground"),children:e.name})}if(e.self||!e.type||!r)return t.jsx("span",{className:G(Ke,"text-muted-foreground"),children:e.name});const a=r.item?.recordPeer?.entityId===e.id;return t.jsx("button",{type:"button","aria-pressed":a,title:e.type,className:G(Ke,"hover:bg-muted",a&&"ring-1 ring-primary"),onClick:i=>{i.stopPropagation(),r.open(Xs({...typeof e.id=="number"?{entityId:e.id}:{record:{type:e.type,key:e.id}},ownerSlug:n,orgContext:s,name:e.name}))},children:t.jsx("span",{className:"truncate",children:e.name})})}function Ka(e,n=e.relationship_type_name){const s=e.from_entity_name??`Record #${e.from_entity_id}`,r=e.to_entity_name??`Record #${e.to_entity_id}`;return e.is_symmetric?`${s} ${n} ${r}`:`${s} → ${n} → ${r}`}function qa({row:e,entityId:n,entityType:s,ownerSlug:r,orgContext:a,label:i=e.relationship_type_name}){const c=(o,l,d,p)=>t.jsx(tn,{peer:{id:o,name:l??`Record #${o}`,type:d,url:p,self:!p&&o===n&&(typeof o=="number"||d===s)},ownerSlug:r,orgContext:a});return t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-xs",children:[c(e.from_entity_id,e.from_entity_name,e.from_entity_type,e.from_entity_url),!e.is_symmetric&&t.jsx($t,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:i}),!e.is_symmetric&&t.jsx($t,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),c(e.to_entity_id,e.to_entity_name,e.to_entity_type,e.to_entity_url)]})}function Va({count:e,onRetry:n}){return e?t.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:["Some linked records could not be read."," ",t.jsx("button",{type:"button",className:"underline",onClick:n,children:"Retry"})]}):null}const nn={name:"Name",slug:"URL slug",parent_id:"Parent",content:"Content changed"};function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qe(e){return e==null||e===""}function lr(e,n){return ct(e??null)===ct(n??null)}function cr(e){return!!(e?.type==="array"&&(e.items?.type==="object"||e.items?.properties))}function dr(e){return!!(e&&(e.type==="object"||e.properties)&&e.type!=="array")}function jt(e,n){return er({key:e,prop:n??{}})}function ur(e,n){return e?.properties?.[n]}function pt(e,n,s,r,a){if(lr(n,s))return;const i=l=>Array.isArray(l)?l:[];if((Array.isArray(n)||qe(n))&&(Array.isArray(s)||qe(s))&&(Array.isArray(n)||Array.isArray(s)||r?.type==="array")){const l=i(n),d=i(s);if(cr(r)||[...l,...d].some(v=>be(v))){const v=Math.min(l.length,d.length);for(let R=0;R<v;R++)pt([...e,`item ${R+1}`],l[R],d[R],r?.items,a);const N=Math.max(0,d.length-l.length),k=Math.max(0,l.length-d.length);(N||k)&&a.push({kind:"items",path:e,added:N,removed:k});return}const u=v=>ct(v),m=new Set(l.map(u)),_=new Set(d.map(u)),w=d.filter(v=>!m.has(u(v))),h=l.filter(v=>!_.has(u(v)));a.push(w.length||h.length?{kind:"values",path:e,added:w,removed:h,prop:r?.items}:{kind:"reordered",path:e});return}if((be(n)||qe(n))&&(be(s)||qe(s))&&(be(n)||be(s)||dr(r))){const l=be(n)?n:{},d=be(s)?s:{},p=[...new Set([...Object.keys(r?.properties??{}),...Object.keys(l),...Object.keys(d)])];for(const u of p){const m=ur(r,u);pt([...e,jt(u,m)],l[u],d[u],m,a)}return}a.push({kind:"set",path:e,old:n,new:s,prop:r})}function mr(e,n){const s=nn[e.field];if(s)return e.field==="content"?[{kind:"note",path:[s]}]:e.field==="parent_id"?[{kind:"parent",path:[s],old:e.old,new:e.new}]:[{kind:"set",path:[s],old:e.old,new:e.new}];const r=n?.properties?.[e.field],a=[];return pt([jt(e.field,r)],e.old,e.new,r,a),a}function pr(e,n){const s=n?.properties;return e.map(r=>r.field==="content"?"Content":nn[r.field]??jt(r.field,s?.[r.field]))}const fr="entity.updated",xr=new Set(["link","unlink","update_link"]);function Mt(e){const n=typeof e=="string"||typeof e=="number"?Number(e):Number.NaN;return Number.isSafeInteger(n)&&n>0?n:null}function hr(e){const n=e.split("_").join(" ").trim();return n?`${n.charAt(0).toUpperCase()}${n.slice(1)}`:e}function gr(e){const n=e.metadata;if(e.semantic_type!=="change"||!n||n._lobu_relationship_change!==!0||typeof n.op!="string"||!xr.has(n.op))return null;const s=Mt(n.fromEntityId),r=Mt(n.toEntityId);if(s==null||r==null)return null;const a=typeof n.relationshipTypeSlug=="string"?n.relationshipTypeSlug:null,i=Array.isArray(n.changes)?n.changes:[];return{op:n.op,fromId:s,toId:r,typeLabel:a?hr(a):"relationship",changedFields:i.flatMap(c=>c&&typeof c=="object"&&typeof c.field=="string"?[c.field]:[])}}function ft({id:e,ownerSlug:n}){const s={slug:n},{data:r,isLoading:a,isError:i}=Ot(e,s);return a?t.jsxs("span",{className:"text-xs text-muted-foreground",children:["Record #",e]}):i||!r?t.jsx("span",{className:"text-xs text-muted-foreground",title:"Deleted, or you do not have access to it",children:"Unavailable record"}):t.jsx(tn,{peer:{id:e,name:r.name,type:r.entity_type},ownerSlug:n,orgContext:s})}function yr({change:e,ownerSlug:n}){const s=e.op==="link"?`Linked as ${e.typeLabel}`:e.op==="unlink"?`Unlinked ${e.typeLabel}`:`Updated ${e.typeLabel} link`;return t.jsxs("span",{"data-testid":"relationship-change",className:"inline-flex flex-wrap items-center gap-1.5",children:[t.jsx(ft,{id:e.fromId,ownerSlug:n}),t.jsx("span",{children:s}),t.jsx("span",{"aria-hidden":"true",children:"→"}),t.jsx(ft,{id:e.toId,ownerSlug:n}),e.op==="update_link"&&e.changedFields.length>0?t.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",e.changedFields.join(", ")]}):null]})}function jr(e){if(!Array.isArray(e)||e.length===0)return null;const n=[];for(const s of e){if(!s||typeof s!="object"||typeof s.field!="string")return null;const{field:r,old:a,new:i}=s;n.push({field:r,old:a??null,new:i??null})}return n}function vr(e){const n=gr(e);if(n)return{kind:"relationship",change:n};const s=e.metadata;if(e.semantic_type!=="change"||!s)return null;const r=s._lobu_event_type;if(r!==fr&&(r!==void 0||s.category))return null;const a=jr(s.changes);if(!a)return null;const i=e.entity_ids?.[0];return{kind:"fields",entityId:typeof i=="number"?i:null,changes:a}}function sn(e,n){const s={slug:n},{data:r}=Ot(e.entityType?void 0:e.entityId??void 0,s),{data:a}=vn(e.entityType??r?.entity_type??"",s);return a?.metadata_schema}const br=4;function Ve({value:e,prop:n}){return t.jsx("span",{className:"inline-block max-w-[18rem] truncate align-bottom",title:typeof e=="string"?e:void 0,children:t.jsx(nr,{value:e,prop:n,empty:t.jsx("span",{className:"italic",children:"empty"})})})}function Dt({id:e,ownerSlug:n}){const s=typeof e=="number"||typeof e=="string"?Number(e):Number.NaN;return Number.isSafeInteger(s)&&s>0?t.jsx(ft,{id:s,ownerSlug:n}):t.jsx("span",{className:"italic text-muted-foreground",children:"empty"})}function xt(e,n){return`${e} ${n}${e===1?"":"s"}`}function _r({line:e,ownerSlug:n}){const s=t.jsx("span",{className:"text-muted-foreground",children:e.path.join(" · ")});switch(e.kind){case"note":return s;case"set":return t.jsxs(t.Fragment,{children:[s,": ",t.jsx(Ve,{value:e.old,prop:e.prop})," ",t.jsx("span",{"aria-hidden":"true",children:"→"})," ",t.jsx(Ve,{value:e.new,prop:e.prop})]});case"parent":return t.jsxs(t.Fragment,{children:[s,": ",t.jsx(Dt,{id:e.old,ownerSlug:n})," ",t.jsx("span",{"aria-hidden":"true",children:"→"})," ",t.jsx(Dt,{id:e.new,ownerSlug:n})]});case"items":return t.jsxs(t.Fragment,{children:[s,":"," ",[e.added?`${xt(e.added,"item")} added`:null,e.removed?`${xt(e.removed,"item")} removed`:null].filter(Boolean).join(", ")]});case"values":return t.jsxs(t.Fragment,{children:[s,":",e.added.map((r,a)=>t.jsxs("span",{className:"ml-1.5",children:["+",t.jsx(Ve,{value:r,prop:e.prop})]},`+${a}`)),e.removed.map((r,a)=>t.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["−",t.jsx(Ve,{value:r,prop:e.prop})]},`-${a}`))]});case"reordered":return t.jsxs(t.Fragment,{children:[s,": reordered"]})}}function Nr({change:e,ownerSlug:n}){const s=sn(e,n);return t.jsxs(t.Fragment,{children:["Updated ",pr(e.changes,s).join(", ")]})}function vt({changes:e,entityId:n,entityType:s,ownerSlug:r,showAll:a=!1}){const i=sn({entityId:n,entityType:s},r),[c,o]=j.useState(a),l=e.flatMap(u=>mr(u,i)),d=c?l:l.slice(0,br),p=l.length-d.length;return t.jsxs("ul",{"data-testid":"field-changes",className:"space-y-0.5 text-sm",children:[d.map((u,m)=>t.jsx("li",{className:"min-w-0 truncate",children:t.jsx(_r,{line:u,ownerSlug:r})},m)),p>0?t.jsx("li",{children:t.jsxs("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:u=>{u.stopPropagation(),o(!0)},children:["+",xt(p,"more change")]})}):null]})}function wr({event:e,ownerSlug:n}){return e.kind==="relationship"?t.jsx(yr,{change:e.change,ownerSlug:n}):t.jsx(Nr,{change:e,ownerSlug:n})}function kr({event:e,ownerSlug:n}){return e.kind==="fields"?t.jsx(vt,{changes:e.changes,entityId:e.entityId,ownerSlug:n}):null}function Cr({operation:e}){switch(e){case"create":case"created":return t.jsx(H,{variant:"default",children:"Created"});case"update":case"updated":return t.jsx(H,{variant:"secondary",children:"Updated"});case"delete":case"deleted":return t.jsx(H,{variant:"destructive",children:"Deleted"});default:return t.jsx(H,{variant:"outline",children:e||"Change"})}}function Ar({operation:e,actor:n,createdAt:s,resource:r,changedFields:a}){return t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r?t.jsx("span",{className:"break-words text-sm font-medium",children:r}):null,t.jsx(Cr,{operation:e}),t.jsx("time",{dateTime:s,title:s,className:"ml-auto text-xs text-muted-foreground",children:bn(s)})]}),t.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["by ",n||"unknown"]}),a?.length?t.jsxs("p",{className:"break-words text-xs text-muted-foreground",children:["Changed: ",a.join(", ")]}):null]})}function Rr(e){return e.semantic_type==="change"&&(e.metadata?.category==="config"||e.metadata?.category==="deployment")}function _e(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Sr({content:e}){const n=e.metadata??{},s=e.payload_data??{},r=n.category==="deployment",a=typeof n.apply_id=="string"?n.apply_id:null,i=_e(s.manifest),c=a&&/^apl_[A-Za-z0-9-]{1,48}$/.test(a)&&e.origin_type==="deployment"&&e.origin_id===`deployment_${a}`&&(n.status==="succeeded"||n.status==="partial_failure")&&_e(i?.state);return t.jsxs("div",{className:"space-y-3","data-testid":"config-change-event",children:[t.jsx(Ar,{operation:r?String(n.status??"Apply"):typeof n.op=="string"?n.op:null,actor:e.author_name??(typeof n.actor_source=="string"?n.actor_source:null),createdAt:e.occurred_at??e.created_at,resource:r?"Configuration apply":`${n.resource_kind??"Configuration"} · ${n.resource_id??""}`,changedFields:Array.isArray(n.changed_fields)?n.changed_fields.filter(o=>typeof o=="string"):void 0}),a?t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"break-all",children:["Apply ",a]}),t.jsx(Tt,{text:a,label:"Copy apply ID"})]}):null,r?t.jsxs(t.Fragment,{children:[typeof n.rollback_of=="string"?t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:["Restores apply ",n.rollback_of]}):null,_e(n.counts)?t.jsx("dl",{className:"flex flex-wrap gap-4 text-xs",children:Object.entries(_e(n.counts)??{}).map(([o,l])=>t.jsxs("div",{children:[t.jsx("dt",{className:"text-muted-foreground",children:o}),t.jsx("dd",{children:String(l)})]},o))}):null,typeof s.error=="string"?t.jsx("p",{className:"text-sm text-destructive",children:s.error}):null,c?t.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Restore this deployment"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Preview restoring this saved configuration with the CLI. Secret values stay unchanged."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("code",{className:"break-all text-xs",children:["lobu rollback ",a]}),t.jsx(Tt,{text:`lobu rollback ${a}`,label:"restore command",iconOnly:!0})]})]}):null,t.jsx(We,{before:null,after:i})]}):Object.hasOwn(s,"before")?t.jsx(We,{before:_e(s.before),after:_e(s.state)}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"The earlier state was not recorded for this change."}),t.jsx(We,{before:null,after:_e(s.state)})]})]})}const $r={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",gchat:"Google Chat",teams:"Microsoft Teams",web:"Web"};function Ir(e){return $r[e]??null}function Tr(e){return e?e.kind==="automation"?`Ran ${e.automationName}`:e.platform==="web"?"Chatted in Lobu":`Replied on ${Ir(e.platform)??e.platform}`:"No activity yet"}function Er({owner:e,item:n,last:s,appearance:r="row"}){const a=r==="inline",i=a?"inline-flex items-center gap-1.5 rounded-md bg-accent px-1.5 py-0.5 text-sm font-medium":G(Je,!s&&"border-b");if(n.kind==="managed"){const l=n.agent,d=[l.lastActivity===void 0?null:Tr(l.lastActivity),l.connectionCount===void 0?null:`${l.connectionCount} ${l.connectionCount===1?"connection":"connections"}`,l.userCount===void 0?null:`${l.userCount} ${l.userCount===1?"user":"users"}`].filter(u=>!!u),p=t.jsx(Nn,{className:"h-4 w-4 text-muted-foreground"});return t.jsx(W,{to:"/$owner/agents/$agentId",params:{owner:e,agentId:l.agentId},className:i,children:a?t.jsxs(t.Fragment,{children:[p,l.name]}):t.jsx(Le,{mark:p,name:l.name,details:t.jsx(Qe,{parts:d.length>0?d:[l.description]}),at:l.lastActivity?Date.parse(l.lastActivity.at):void 0})})}const c=n.group,o=t.jsx(_n,{name:c.title});return t.jsx(W,{to:"/$owner/agents/connected/$clientId",params:{owner:e,clientId:c.clientId},className:i,children:a?t.jsxs(t.Fragment,{children:[o,c.title]}):t.jsx(Le,{mark:o,name:c.title,details:t.jsx(Qe,{parts:[c.connected?"Connected app":"Disconnected",c.linkedUser,c.drivenBy&&c.drivenBy!==c.title?`via ${c.drivenBy}`:null]}),at:c.lastSeenAt})})}const Mr={event:{label:"Event",icon:Pt},schedule:{label:"Schedule",icon:kn},manual:{label:"Manual",icon:wn}};function Dr(e,n,s){switch(Sn(e)){case"script":return["Script"];case"external":case"manual":return["Outside client"];case"device":{const r=e.agent_kind,a=r&&r in Et?Et[r]:r;return[n,s,a].filter(i=>!!i)}case"agent":return[n??"Agent","Hosted"]}}function Fr({automation:e,agentName:n,deviceLabel:s,connectorDisplay:r,owner:a,actions:i,rowClass:c,appearance:o="row"}){const l=e.automation,d=l.automation_id,p=Mr[e.kind];if(o==="inline")return t.jsxs(W,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:d},search:{view:"definition",run_id:void 0},className:"inline-flex items-center gap-1.5 rounded-md bg-accent px-1.5 py-0.5 text-sm font-medium",children:[t.jsx(p.icon,{className:"h-3.5 w-3.5 shrink-0"}),e.does,l.status==="archived"?t.jsx(H,{variant:"outline",children:"Archived"}):null]});const u=Cn(e,Date.now()),m=l.processing_client_count??0,_=l.entity_name&&l.entity_type?`${l.entity_name} · ${l.entity_type}`:null;return t.jsxs("div",{className:c,children:[t.jsx(W,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:d},search:{view:"definition",run_id:void 0},className:"flex min-w-0 flex-1 items-center gap-3",children:t.jsx(Le,{mark:r?t.jsx(Rn,{icon:r.icon,iconUrl:r.iconUrl,name:r.name,faviconDomain:r.faviconDomain,className:"h-7 w-7 text-[10px]"}):t.jsx(p.icon,{className:"h-4 w-4 text-muted-foreground"}),name:e.does,badge:l.status==="archived"?t.jsx(H,{variant:"outline",children:"Archived"}):null,tone:u.problem?"destructive":null,details:t.jsx(Qe,{parts:[u.text,...Dr(l,n,s),m>0?`${m} ${m===1?"client":"clients"}`:null,An(e.when),_]}),at:u.at})}),i]})}function Lr({record:e,workspace:n,appearance:s}){return t.jsx(Fr,{automation:In(e),owner:n,agentName:e.managed_agent_id??null,deviceLabel:e.device_worker_id?"Device-pinned":null,connectorDisplay:null,appearance:s,rowClass:"flex items-center gap-3 rounded-lg border px-3 py-2.5"})}function Or({agent:e,workspace:n,appearance:s}){return t.jsx(Er,{owner:n,appearance:s,last:!0,item:{kind:"managed",key:e.id,agent:{agentId:e.id,name:e.name,description:e.description??void 0}}})}function Pr({connector:e,connection:n,workspace:s,appearance:r}){const a=e.key,i=t.jsx(Tn,{connector:e,showDescription:r!=="inline"});return t.jsx("div",{className:r==="inline"?"inline-flex items-center gap-2":"rounded-lg border p-3",children:n?t.jsxs(W,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:s,connectorKey:a,connectionId:String(n.id)},search:{},children:[i,t.jsx("span",{className:"text-xs text-muted-foreground",children:$n(n)})]}):t.jsx(W,{to:"/$owner/connectors/$connectorKey",params:{owner:s,connectorKey:a},children:i})})}function He(e,n){return typeof e=="string"&&e.trim().length>0&&e.length<=n}function bt(e,n){if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n;if(s.mode!=="live"||!He(s.workspace,128)||!/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(s.workspace)||s.appearance!==void 0&&s.appearance!=="inline"&&s.appearance!=="row")return null;const r={mode:"live",workspace:s.workspace,appearance:s.appearance??"row"};return e==="automation-ref"?!He(s.automationId,128)||!/^[1-9][0-9]*$/.test(s.automationId)||!Number.isSafeInteger(Number(s.automationId))?null:{...r,automationId:s.automationId}:e==="connector-ref"?!He(s.connectorKey,128)||s.connectionId!==void 0&&(typeof s.connectionId!="number"||!Number.isSafeInteger(s.connectionId)||s.connectionId<=0)?null:{...r,connectorKey:s.connectorKey,...s.connectionId!==void 0?{connectionId:s.connectionId}:{}}:He(s.agentId,128)?{...r,agentId:s.agentId}:null}const Br=4,Ur=128;let it=0;const De=[];async function zr(e,n){if(e.aborted)throw e.reason;await new Promise((s,r)=>{const a=()=>{const c=De.indexOf(i);c>=0&&De.splice(c,1),r(e.reason)},i=()=>{e.removeEventListener("abort",a),it++,s()};it<Br?i():De.length>=Ur?r(new Error("Reference read capacity exceeded")):(De.push(i),e.addEventListener("abort",a,{once:!0}))});try{if(e.aborted)throw e.reason;return await n()}finally{it--,De.shift()?.()}}const Ze={retry:!1,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:"always",refetchOnReconnect:"always"};function we({error:e}){const n=e instanceof Re&&(e.status===401||e.status===403)?"Access required to view this reference.":e instanceof Re&&e.status===404?"Reference not found.":"Reference unavailable.";return t.jsx("span",{role:"status",className:"text-sm text-muted-foreground",children:n})}function _t(){return t.jsx("span",{role:"status",className:"text-sm text-muted-foreground",children:"Loading reference…"})}function Kr({workspace:e,automationId:n,appearance:s}){const{session:r,isReady:a}=et(),i=gt(),c=Ye({...Ze,enabled:a&&!i,queryKey:["automations-list",e,"native-reference",r?.user.id??null,n],queryFn:({signal:l})=>zr(l,async()=>{let d;for(const u of["active","archived"])if(d=(await Ae("manage_automations",{action:"list",automation_id:n,status:u,include_details:!1,limit:1},{slug:e},{signal:l})).automations?.find(_=>_.automation_id===n),d)break;if(!d)throw new Re("Reference not found",404);const p=d.execution_config?.executor;return d={automation_id:d.automation_id,name:d.name,status:d.status,triggers:d.triggers,next_run_at:d.next_run_at,last_fired_at:d.last_fired_at,last_run_completed_at:d.last_run_completed_at,managed_agent_id:d.managed_agent_id,device_worker_id:d.device_worker_id,health:d.health,health_reasons:d.health_reasons,processing_client_count:d.processing_client_count,execution_config:p&&typeof p=="object"?{executor:{kind:p.kind}}:void 0},d})});if(i)return t.jsx("span",{role:"status",children:"Unavailable in visitor preview."});if(c.isPending||c.isFetching)return t.jsx(_t,{});if(c.error||!c.data)return t.jsx(we,{error:c.error});const o=c.data;return t.jsx(Lr,{record:o,workspace:e,appearance:s})}function qr({workspace:e,connectorKey:n,connectionId:s,appearance:r}){const{session:a,isReady:i}=et(),c=gt(),o=Ye({...Ze,enabled:i&&!c,queryKey:["connector-definitions",e,"native-reference",a?.user.id??null],queryFn:async({signal:u})=>(await En({slug:e},{signal:u})).map(m=>({key:m.key,name:m.name,description:m.description,icon:m.icon}))}),l=Ye({...Ze,enabled:i&&!c&&s!==void 0,queryKey:["connections",e,"native-reference",a?.user.id??null,n,s??null],queryFn:async({signal:u})=>{const m=s===void 0?void 0:(await Ae("manage_connections",{action:"list",connection_ids:[s],connector_key:n,limit:1},{slug:e},{signal:u})).connections?.find(_=>_.id===s);if(s!==void 0&&(!m||m.id!==s||m.connector_key!==n))throw new Re("Reference not found",404);return{connection:m?{id:m.id,connector_key:m.connector_key,display_name:m.display_name,connector_name:m.connector_name,auth_profile_name:m.auth_profile_name,auth_profile_slug:m.auth_profile_slug}:void 0}}});if(c)return t.jsx("span",{role:"status",children:"Unavailable in visitor preview."});if(o.isPending||o.isFetching||s!==void 0&&(l.isPending||l.isFetching))return t.jsx(_t,{});if(o.error||s!==void 0&&(l.error||!l.data))return t.jsx(we,{error:o.error||l.error});const d=o.data?.find(u=>u.key===n);if(!d)return t.jsx(we,{error:new Re("Reference not found",404)});const p=l.data?.connection;return t.jsx(Pr,{connector:d,connection:p,workspace:e,appearance:r})}function Vr({workspace:e,agentId:n,appearance:s}){const{session:r,isReady:a}=et(),i=gt(),c=Ye({...Ze,enabled:a&&!i,queryKey:["agents",e,"native-reference",r?.user.id??null,n],queryFn:async({signal:l})=>{const d=await Ae("manage_agents",{action:"get",agent_id:n},{slug:e},{signal:l});if(d.agent?.id!==n)throw new Re("Reference not found",404);return{id:d.agent.id,name:d.agent.name,description:d.agent.description}}});if(i)return t.jsx("span",{role:"status",children:"Unavailable in visitor preview."});if(c.isPending||c.isFetching)return t.jsx(_t,{});if(c.error||!c.data)return t.jsx(we,{error:c.error});const o=c.data;return t.jsx(Or,{agent:o,workspace:e,appearance:s})}function Hr(e){const n=bt("automation-ref",e);return n?t.jsx(Kr,{...n}):t.jsx(we,{})}function Wr(e){const n=bt("connector-ref",e);return n?t.jsx(qr,{...n}):t.jsx(we,{})}function Jr(e){const n=bt("agent-ref",e);return n?t.jsx(Vr,{...n}):t.jsx(we,{})}const ot=e=>typeof e=="string"&&e.trim().length>0&&e.length<=128,Qr={tabs:({defaultValue:e,children:n})=>ot(e)?t.jsx(Ws,{defaultValue:e,children:n}):null,"tabs-list":({label:e,children:n})=>t.jsx(Hs,{label:typeof e=="string"&&e.length<=200?e:void 0,children:n}),"tabs-trigger":({value:e,children:n})=>ot(e)?t.jsx(Vs,{value:e,children:n}):null,"tabs-content":({value:e,children:n})=>ot(e)?t.jsx(qs,{value:e,children:n}):null,"automation-ref":Hr,"connector-ref":Wr,"agent-ref":Jr,"json-diff":(({before:e,after:n})=>{const s=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?r:null;return t.jsx(We,{before:s(e),after:s(n)})})};function Fe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Yr({template:e,data:n,onAction:s}){const[r,a]=j.useState(null),[i,c]=j.useState(!1),[o,l]=j.useState(null),[d,p]=j.useState(!1),u=j.useRef(!1),m=j.useRef(!0);j.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);const _=async w=>{if(!(!s||u.current)){u.current=!0,c(!0),l(null),p(!1);try{const h=await s(w);if(!m.current)return;if(Fe(h)&&h.kind==="sdk"){const v=h.result;if(!Fe(v)||v.success!==!0){const N=Fe(v)&&Fe(v.error)?v.error.message:null;throw new Error(typeof N=="string"?N:"Could not update this event.")}if(v.return_truncated||!Fe(v.return_value))throw new Error("The update did not return a complete data object.");a(v.return_value),p(!0)}}catch(h){m.current&&l(h instanceof Error?h.message:"Could not update this event.")}finally{u.current=!1,m.current&&c(!1)}}};return t.jsxs("div",{className:"space-y-2",children:[i?t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Updating…"}):null,d?t.jsx("p",{role:"status",className:"sr-only",children:"Updated"}):null,o?t.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[o," Previous data is still shown."]}):null,t.jsx("div",{"aria-busy":i,className:"min-w-0",children:t.jsx(tr,{template:{root:e.root},data:r??n,onAction:s?_:void 0,interactions:e.interactions,components:Qr,actionsDisabled:!s||i})})]})}function rn(e){return{audit:Yt(e),operation:e.interaction_type==="approval"||e.semantic_type==="operation",changeSet:e.semantic_type==="change_set"}}const Gr={},Zr={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function Xr(e){return e.author_name?e.author_name:e.platform?Ge(e.platform):e.origin_type?Zr[e.origin_type]??Ge(e.origin_type):null}function ea(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):Array.isArray(e)?e.length===0?"":e.every(n=>typeof n!="object")?e.map(n=>String(n)).join(", "):t.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(e,null,2)}):t.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(e,null,2)})}const lt=1e5;function Ft({value:e}){const n=JSON.stringify(e,null,2)??"null",s=n.length>lt;return t.jsxs(t.Fragment,{children:[t.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 font-mono text-xs",children:s?n.slice(0,lt):n}),s&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",lt.toLocaleString()," of"," ",n.length.toLocaleString()," characters."]})]})}function ta(e){return Object.entries(e).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim().length>0:Array.isArray(n)?n.length>0:typeof n=="object"?Object.keys(n).length>0:!0).sort(([n],[s])=>n.localeCompare(s))}function na({breakdown:e}){if(!e)return null;const n=[{label:"Engagement",value:e.engagement,max:100},{label:"Criticality",value:e.criticality,max:100},{label:"Depth",value:e.depth,max:100},{label:"Authority",value:e.authority,max:100},{label:"Recency",value:e.recency,max:100},{label:"Quality",value:e.quality,max:100}];return t.jsx("div",{className:"space-y-2 text-sm",children:n.map(s=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-20 text-muted-foreground",children:s.label}),t.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-primary",style:{width:`${s.value/s.max*100}%`}})}),t.jsx("span",{className:"w-8 text-right",children:s.value})]},s.label))})}function sa({slug:e,value:n,isManual:s}){return t.jsxs(H,{variant:"secondary",className:"text-xs",children:[e,": ",n,s&&t.jsx(zt,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function ra(e){if(e&&typeof e=="object"){const n=e;if(Array.isArray(n.values))return{values:n.values.map(s=>String(s)).filter(s=>s.length>0),isManual:n.is_manual===!0};if(n.value!==void 0&&n.value!==null)return{values:[String(n.value)],isManual:n.is_manual===!0};if(typeof n.values=="string"&&n.values.length>0)return{values:[n.values],isManual:n.is_manual===!0}}return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?{values:[String(e)],isManual:!1}:{values:[],isManual:!1}}function an(e,n){if(e)switch(e){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return e}return n||"pending_approval"}function ht(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function aa(e){return e.replace(/\s+[—-]\s+pending approval$/i,"")}function Xe(e){return e.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase())}function ia(e){const n=Object.keys(e.fields),s=n.map(Xe).join(", ")||"field",r=n.length===1?"field":"fields";return`Update ${e.entityType?Xe(e.entityType).toLowerCase():"entity"} ${r}: ${s}`}function oa(e,n){const s=ht(n.fields);if(!s||Object.keys(s).length===0||n.action_key!=="entity_field_change"&&n.tool!=="entity_field_change")return null;const r=ht(n.current)??{},a=e;return{fields:s,current:r,reason:typeof n.reason=="string"?n.reason:void 0,automationId:n.automation_id!=null?String(n.automation_id):void 0,automationName:typeof n.automation_name=="string"?n.automation_name:void 0,automationAgentId:typeof n.automation_agent_id=="string"?n.automation_agent_id:void 0,entityType:typeof n.entity_type=="string"?n.entity_type:void 0,entityName:(typeof n.entity_name=="string"?n.entity_name:void 0)??a.entity_name??void 0,entitySlug:typeof n.entity_slug=="string"?n.entity_slug:void 0,parentSlug:typeof n.parent_slug=="string"?n.parent_slug:void 0,parentEntityType:typeof n.parent_entity_type=="string"?n.parent_entity_type:void 0,attribution:typeof n.attribution=="string"?n.attribution:void 0,initiator:n.initiator&&typeof n.initiator=="object"?n.initiator:void 0}}function la(e){const n=e.entityType?Xe(e.entityType).toLowerCase():"entity";return`${Xe(e.operation)} ${n}`}function ca(e,n){if(n.action_key!=="entity_change"&&n.tool!=="entity_change")return null;const s=n.action;if(s!=="create"&&s!=="delete"&&s!=="link"&&s!=="unlink")return null;const r=e;return{operation:s,proposal:ht(n.proposal),reason:typeof n.reason=="string"?n.reason:void 0,automationId:n.automation_id!=null?String(n.automation_id):void 0,automationName:typeof n.automation_name=="string"?n.automation_name:void 0,automationAgentId:typeof n.automation_agent_id=="string"?n.automation_agent_id:void 0,entityType:typeof n.entity_type=="string"?n.entity_type:void 0,entityName:(typeof n.entity_name=="string"?n.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof n.entity_slug=="string"?n.entity_slug:void 0,parentSlug:typeof n.parent_slug=="string"?n.parent_slug:void 0,parentEntityType:typeof n.parent_entity_type=="string"?n.parent_entity_type:void 0,attribution:typeof n.attribution=="string"?n.attribution:void 0,proposerRationale:typeof n.proposer_rationale=="string"?n.proposer_rationale:void 0,initiator:n.initiator&&typeof n.initiator=="object"?n.initiator:void 0}}function da(e,n){return!n.entityType||!n.entitySlug?null:fs(e,n.parentEntityType&&n.parentSlug?[{entity_type:n.parentEntityType,slug:n.parentSlug},{entity_type:n.entityType,slug:n.entitySlug}]:[{entity_type:n.entityType,slug:n.entitySlug}])}function on({ownerSlug:e,runId:n,details:s}){const a=Zt(s.automationId,void 0,void 0,{ownerSlug:e,includeVersions:!1}).data?.automation,i=Pe(),c=Qs(s.initiator,s.attribution,s.automationId),o=a?.automation_name??s.automationName??c;return t.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",s.automationId?t.jsx(W,{to:"/$owner/automations/$automationId",params:{owner:e,automationId:s.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:o}):t.jsx("span",{className:"font-medium text-foreground",children:o}),n&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:" · "}),t.jsxs(W,{to:"/$owner/events",params:{owner:e},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",onClick:l=>{!i||l.button!==0||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||(l.preventDefault(),i.open({href:`/${e}/events?run_ids=${n}`,title:`Run #${n}`,runId:n}))},children:["Run #",n]})]})]})}function ln({ownerSlug:e,details:n}){const s=da(e,n);return n.entityName?t.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Entity"}),t.jsx("div",{className:"mt-1 text-sm font-medium",children:s?t.jsx(W,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function ua({ownerSlug:e,runId:n,details:s}){return t.jsxs("div",{className:"space-y-3",children:[t.jsx(on,{ownerSlug:e,runId:n,details:s}),t.jsx(ln,{ownerSlug:e,details:s}),t.jsx("div",{className:"rounded-md border border-border/70 px-3 py-2",children:t.jsx(vt,{changes:Object.entries(s.fields).map(([r,a])=>({field:r,old:s.current[r]??null,new:a??null})),entityType:s.entityType,ownerSlug:e,showAll:!0})}),s.reason&&t.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Reasoning"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.reason})]})]})}function ma({ownerSlug:e,runId:n,details:s,status:r}){const{operation:a}=s,i=a==="link"||a==="unlink";return t.jsxs("div",{className:"space-y-3",children:[t.jsx(on,{ownerSlug:e,runId:n,details:s}),!i&&t.jsx(ln,{ownerSlug:e,details:s}),t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Change"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:i?en(a,r):a==="create"?"Create a new entity after approval.":"Delete this entity after approval."}),i&&t.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[Xt(s.proposal).map((c,o)=>t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:o===0?"From: ":"To: "}),c.name]},c.id)),t.jsxs("div",{className:"text-muted-foreground",children:["Relationship:"," ",String(s.proposal?.relationship_type??s.proposal?.relationship_type_slug??"Relationship")]})]})]}),!i&&s.proposal&&t.jsxs("div",{className:"rounded-lg border border-border/70 p-3",children:[t.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Proposal"}),t.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(s.proposal,null,2)})]}),s.proposerRationale&&t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.proposerRationale})]}),s.reason&&t.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Why this needs approval"}),t.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.reason})]})]})}function pa({summary:e}){return t.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[e.chips.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.chips.map(n=>t.jsx(H,{variant:"outline",className:"text-[10px] font-normal",children:n},n))}),e.message&&t.jsx("p",{className:"leading-relaxed text-foreground",children:e.message}),e.reason&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Why"}),t.jsx("div",{className:"mt-0.5 leading-relaxed",children:e.reason})]}),e.body&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e.kind==="verify"?"Expected comment":"Draft"}),t.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:e.body})]}),e.matchPreview&&t.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[t.jsxs("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Matched comment",e.matchAuthor?` · ${e.matchAuthor}`:""]}),t.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:e.matchPreview})]}),e.postUrl&&t.jsxs("a",{href:e.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",t.jsx(Qt,{className:"h-3 w-3"})]})]})}function fa({ownerSlug:e,content:n,batchReview:s}){const r=n.metadata||{},a=n.run_id??void 0,i=sr(r),c=oa(n,r),o=ca(n,r),l=(c?ia(c):o?la(o):void 0)||r.operation_name||r.action_name||(n.title?aa(n.title):void 0)||"Action",d=r.connection_name,p=r.operation_key||r.action_key||null,u=n.interaction_input_schema||r.input_schema||null,m=j.useMemo(()=>n.interaction_input||r.action_input||r.operation_input||Gr,[n.interaction_input,r.action_input,r.operation_input]),_=n.interaction_output||r.action_output||void 0,w=or(m,_??null,p),h=n.interaction_error||r.error_message||void 0,v=an(n.interaction_status,r.status),N=r.reviewed_by_name||r.reviewed_by_id||void 0,k=r.reject_reason||void 0,R=r.initiator,A=ts({slug:e}),T=ns({slug:e}),E=ss(n.id,rs(u,m),u),{values:M,setValues:S}=E,[D,x]=j.useState(null),[B,V]=j.useState(!1),[P,y]=j.useState(""),L=v==="pending_approval"&&D?D:v,F=L==="pending_approval",Z=typeof r.source_run_id=="number";return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Pt,{className:"h-4 w-4 text-yellow-500"}),t.jsx("span",{className:"font-medium",children:l}),d&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",d]}),L==="confirmed"&&t.jsx(H,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:"Approved"}),L==="completed"&&t.jsx(H,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),L==="failed"&&t.jsx(H,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),L==="rejected"&&t.jsx(H,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!c&&!o&&(n.author_name||N)&&t.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[n.author_name&&t.jsxs("span",{children:["Requested by"," ",t.jsx(Js,{ownerSlug:e,initiator:R,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&N&&t.jsx("span",{children:"·"}),N&&t.jsxs("span",{children:[L==="rejected"?"Rejected":"Approved"," by"," ",t.jsx("span",{className:"font-medium text-foreground",children:N})]})]}),c&&t.jsx(ua,{ownerSlug:e,runId:a,details:c}),!c&&o&&t.jsx(ma,{ownerSlug:e,runId:a,details:o,status:L}),L==="rejected"&&k&&t.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-xs text-muted-foreground",children:[t.jsx("span",{className:"font-medium text-foreground",children:"Reason:"})," ",k]}),w&&t.jsx(pa,{summary:w}),i&&t.jsx(rr,{proposal:i}),!i&&(F?E.revision:u)&&(F||Object.keys(m).length>0)&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:w?"Full input":"Input"}),F?t.jsxs(t.Fragment,{children:[t.jsx(as,{visible:E.hasConflict,onReload:E.reset}),t.jsx(is,{schema:E.revision,values:M,onValuesChange:S,fieldIdPrefix:`action-${n.id}-`},`action-${n.id}`)]}):w?t.jsxs("details",{className:"text-xs",children:[t.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw input"}),t.jsx("pre",{className:"mt-1 bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}):t.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}),L==="completed"&&_&&Object.keys(_).length>0&&!w&&t.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[t.jsx(Vt,{className:"h-3.5 w-3.5"}),"Output"]}),t.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap",children:JSON.stringify(_,null,2)})]}),L==="completed"&&_&&Object.keys(_).length>0&&w&&t.jsxs("details",{className:"text-xs",children:[t.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw output"}),t.jsx("pre",{className:"mt-1 rounded bg-green-50 p-2 font-mono dark:bg-green-950/30 overflow-auto max-h-32",children:JSON.stringify(_,null,2)})]}),L==="failed"&&h&&t.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[t.jsx(qt,{className:"h-3.5 w-3.5"}),"Error"]}),t.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:h})]}),F&&!D&&Z&&t.jsxs("div",{className:"pt-1 text-xs text-muted-foreground",children:["Review this proposal with the other changes in its Automation run.",s]}),F&&a&&!D&&!Z&&t.jsx("div",{className:"flex items-center gap-2 pt-1",children:B?t.jsxs("div",{className:"flex items-center gap-2 w-full",children:[t.jsx("input",{type:"text",placeholder:"Reason (optional)",value:P,onChange:le=>y(le.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),t.jsxs(O,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>T.mutate({run_id:a,reason:P||void 0},{onSuccess:()=>{x("rejected")}}),disabled:T.isPending,children:[T.isPending&&t.jsx(Ne,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),t.jsx(O,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{V(!1),y("")},children:"Cancel"})]}):t.jsxs(t.Fragment,{children:[t.jsxs(O,{size:"sm",className:"h-7 text-xs",onClick:()=>A.mutate({run_id:a,...i?{}:{input:ls(M)}},{onSuccess:()=>{x("confirmed")}}),disabled:!i&&!E.canSubmit||A.isPending||T.isPending,children:[A.isPending?t.jsx(Ne,{size:"sm",className:"mr-1"}):t.jsx(os,{className:"h-3 w-3 mr-1"}),i?"Approve":"Confirm"]}),t.jsxs(O,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>V(!0),disabled:A.isPending||T.isPending,children:[t.jsx(cs,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function xa({content:e,ownerSlug:n}){const s=e.metadata||{},r=s.kind,a=e.run_id??null,i=typeof s.automation_id=="number"?s.automation_id:null,l=Zt(i!=null?String(i):void 0,void 0,void 0,{includeVersions:!1,ownerSlug:n}).data?.automation?.automation_name??(i!=null?`Automation ${i}`:"An Automation"),d=Xn({slug:n}),p=es({slug:n}),[u,m]=j.useState(!1),[_,w]=j.useState(""),[h,v]=j.useState(null);if(r==="automation_batch_reject"){const x=s.reason||void 0;return t.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3",children:[t.jsx("div",{className:"text-sm font-medium",children:"Proposals rejected"}),x&&t.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:x}),t.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const N=Array.isArray(s.changes)?s.changes:[],k=typeof s.created_count=="number"?s.created_count:N.filter(x=>x.kind==="created").length,R=typeof s.updated_count=="number"?s.updated_count:N.filter(x=>x.kind==="updated").length,A=typeof s.denied_count=="number"?s.denied_count:N.filter(x=>x.kind==="denied").length,T=N.filter(x=>x.kind==="denied"),E=N.filter(x=>x.kind==="updated"&&Object.keys(x.applied||{}).length>0),M=typeof s.pending_proposal_count=="number"?s.pending_proposal_count:null,S=M==null||M>0,D=S?"proposed":"applied";return t.jsxs("div",{className:"rounded-md border p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[t.jsxs("div",{className:"text-sm font-medium",children:[D==="proposed"?"Proposed":"Applied"," ",k," ","new + ",R," updated",A>0&&t.jsxs(t.Fragment,{children:[" + ",A," denied"]})]}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[i!=null?t.jsx(W,{to:"/$owner/automations/$automationId",params:{owner:n,automationId:String(i)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:l}):t.jsx("span",{className:"font-medium text-foreground",children:l}),a!=null&&t.jsxs("span",{children:[" · run #",a]}),M!=null&&M>0&&t.jsxs("span",{children:[" · ",M," pending"]})]})]}),E.length>0&&t.jsx("div",{className:"mt-3 space-y-2",children:E.map(x=>t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:x.name}),t.jsx(vt,{changes:Object.entries(x.applied).map(([B,V])=>({field:B,old:V.old??null,new:V.new??null})),entityId:x.entityId,ownerSlug:n,showAll:!0})]},x.entityId))}),T.length>0&&t.jsx("div",{className:"mt-3 space-y-1.5",children:T.map(x=>t.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-2.5 py-2",children:[t.jsxs("div",{className:"text-xs font-medium",children:[x.name," — not written"]}),x.denied&&t.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[x.denied.reason,t.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",x.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${x.entityId}-${x.name}`))}),a!=null&&h==null&&S&&t.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:u?t.jsxs("div",{className:"flex items-center gap-2 w-full",children:[t.jsx("input",{type:"text",placeholder:"What should the agent change?",value:_,onChange:x=>w(x.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),t.jsxs(O,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>p.mutate({run_id:a,reason:_||void 0},{onSuccess:()=>v("rejected")}),disabled:p.isPending,children:[p.isPending&&t.jsx(Ne,{size:"sm",className:"mr-1"}),"Reject all"]}),t.jsx(O,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{m(!1),w("")},children:"Cancel"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(O,{size:"sm",className:"h-7 text-xs",onClick:()=>d.mutate({run_id:a},{onSuccess:()=>v("approved")}),disabled:d.isPending||p.isPending,children:[d.isPending&&t.jsx(Ne,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),t.jsx(O,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>m(!0),disabled:d.isPending||p.isPending,children:"Reject with feedback"})]})}),h==="approved"&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),h==="rejected"&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),a!=null&&h==null&&!S&&t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function ha(e){if(!e)return;const n={};for(const[s,r]of Object.entries(e))s==="_lobu_idempotency_key"||s==="agent_id"||(n[s]=r);return Object.keys(n).length>0?n:void 0}function ga({renderDetail:e,ownerSlug:n,content:s,connectorDefinitions:r,hideDetails:a=!1}){const[i,c]=j.useState(null),[o,l]=j.useState(!1),[d,p]=j.useState(!1),[u,m]=j.useState(!1),[_,w]=j.useState(!1),[h,v]=j.useState(!1),[N,k]=j.useState(null),[R,A]=j.useState(s.title??""),[T,E]=j.useState(s.text_content??""),M=Kn(),S=qn(),D=Pe(),{currentOwner:x,allOrgs:B,isAuthenticated:V}=Vn(),P=n??x,y=P==="me"?null:P,L=j.useCallback(async g=>{if(!y){Ue.error("Open this event inside a workspace to interact with it.");return}const $=await ar(y,Number(s.id),g,crypto.randomUUID());return"event_id"in $&&Ue.success("Recorded"),$},[s.id,y]),F=s.payload_data??{},{audit:Z,operation:le,changeSet:J}=rn(s),pe=Z&&(F.request!==void 0||F.request_status==="too_large"),Q=Z&&Array.isArray(F.sdk_call_trace)&&F.sdk_call_trace.length>0,X=V&&y?(B??[]).find(g=>g.slug===y):void 0,ce=s.semantic_type==="guidance",{isAdmin:fe,isLoading:ee}=Hn(ce?X?.id:void 0),ne=Wn(),je=Rr(s),Y=mt(D?.item?.href.split(/[?#]/)[0]??""),se=Y?.owner===P&&Y?.eventId===Number(s.id),re=(g,$,K)=>{D?D.open({href:g,title:$,...K==null?{}:{runId:K}}):M({to:g})},ae=(g,$)=>{if(!y)return null;const K=`/${y}/events?run_ids=${g}`;if(D?.item?.href===K)return null;const ge=()=>re(K,`Run #${g}`,g),Me="Show everything this run recorded";return $?t.jsxs(O,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:ge,title:Me,children:[t.jsx(Zn,{className:"h-3.5 w-3.5"}),$]}):t.jsxs("button",{type:"button",className:"hover:text-foreground hover:underline",onClick:ge,title:Me,children:["Run #",g]})},ie=s.run_id!=null&&!(D&&y&&s.automation_id!=null)?ae(s.run_id):null,de=Jn(s),ue=s.automation_id,xe=D&&y&&de!=null&&ue!=null?()=>D.open({href:`/${y}/automations/${ue}?view=activity&run_id=${de}`,title:`${s.automation_name??`Automation ${ue}`} · Run #${de}`,runId:de}):void 0,te=s.metadata?.source_run_id,z=vr(s),ve=(!s.platform||s.platform==="lobu")&&s.connection_id==null&&s.feed_id==null&&s.origin_type==null&&s.automation_id==null&&!Z&&!le&&!J&&!je&&z==null&&s.semantic_type!=="tombstone"&&s.semantic_type!=="notification"&&s.metadata?.tombstone!==!0&&s.interaction_type!=="approval"&&s.interaction_status==null&&!s.is_superseded&&s.superseded_by==null,ke=!!(y&&X&&ve&&(!ce||!ee&&fe)),b=ke&&s.payload_type!=="json_template"&&s.payload_type!=="media",I=()=>{ne.invalidateQueries({queryKey:[ms]}),ne.invalidateQueries({queryKey:[ps]}),ne.invalidateQueries({queryKey:["search-memory"]})},me=async()=>{if(!(!y||!b)){if(w(!1),k(null),s.payload_truncated){p(!0);try{const $=(await Ae("read_knowledge",{content_ids:[Number(s.id)]},{slug:y})).content?.find(K=>Number(K.id)===Number(s.id));A($?.title??s.title??""),E($?.text_content??$?.payload_text??s.text_content??""),l(!0)}catch(g){k(g instanceof Error?g.message:"Failed to load full memory.")}finally{p(!1)}return}A(s.title??""),E(s.text_content??""),l(!0)}},$e=async()=>{if(!y||u)return;if(!T.trim()){k("Memory content cannot be empty.");return}m(!0),k(null);try{const $=s.payload_type==="markdown"||s.payload_type==="text"?s.payload_type:"text",K=ha(s.metadata);await Ae("save_memory",{supersedes_event_id:Number(s.id),semantic_type:s.semantic_type||"note",payload_type:$,title:R.trim()||void 0,content:T,...Array.isArray(s.entity_ids)&&s.entity_ids.length>0?{entity_ids:s.entity_ids}:{},...s.source_url?{source_url:s.source_url}:{},...s.author_name?{author:s.author_name}:{},...s.occurred_at?{occurred_at:s.occurred_at}:{},...s.payload_data&&Object.keys(s.payload_data).length>0?{payload_data:s.payload_data}:{},...K?{metadata:K}:{}},{slug:y}),l(!1),I(),Ue.success("Memory updated")}catch($){k($ instanceof Error?$.message:"Failed to update memory.")}finally{m(!1)}},Ie=async()=>{if(!(!y||h)){v(!0),k(null);try{const g=Number(s.id),$=await Ae("run_sdk",{title:"Delete memory",script:`export default async (_ctx, client) => client.knowledge.delete(${JSON.stringify({content_id:g,reason:"Deleted from web UI"})});`},{slug:y});if($?.success===!1){const ge=typeof $.error=="string"?$.error:$.error?.message||"Failed to delete memory.";throw new Error(ge)}w(!1),se&&D?.close();const K=mt(S.pathname);K?.owner===y&&K.eventId===g&&M({to:"/$owner/events",params:{owner:y}}),I(),Ue.success("Memory deleted")}catch(g){k(g instanceof Error?g.message:"Failed to delete memory.")}finally{v(!1)}}},Te=ke&&!o?_?t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsxs(O,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2.5 text-xs",disabled:h,onClick:()=>void Ie(),children:[h&&t.jsx(Ne,{size:"xs",className:"mr-1.5"}),h?"Deleting...":"Delete"]}),t.jsx(O,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:h,onClick:()=>{w(!1),k(null)},children:"Cancel"})]}):t.jsxs(t.Fragment,{children:[b&&t.jsxs(O,{type:"button",variant:"ghost",size:"sm","aria-label":"Edit memory",className:"h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-foreground",disabled:d||h,onClick:()=>void me(),children:[d?t.jsx(Ne,{size:"xs"}):t.jsx(ds,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:d?"Loading...":"Edit"})]}),t.jsxs(O,{type:"button",variant:"ghost",size:"sm","aria-label":"Delete memory",className:"h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-destructive",disabled:d,onClick:()=>{k(null),w(!0)},children:[t.jsx(us,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:"Delete"})]})]}):null,tt=o?t.jsxs("form",{className:"mt-2 space-y-3 rounded-lg border bg-background p-3 text-foreground",onSubmit:g=>{g.preventDefault(),$e()},children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{htmlFor:`memory-title-${s.id}`,className:"block text-xs font-medium text-muted-foreground",children:"Title"}),t.jsx(Qn,{id:`memory-title-${s.id}`,"aria-label":"Memory title",value:R,onChange:g=>A(g.target.value),placeholder:"Optional short summary",disabled:u})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{htmlFor:`memory-content-${s.id}`,className:"block text-xs font-medium text-muted-foreground",children:["Content",t.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),t.jsx(Yn,{id:`memory-content-${s.id}`,"aria-label":"Memory content",value:T,onChange:g=>E(g.target.value),rows:5,disabled:u})]}),N&&t.jsx("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}),t.jsx(Gn,{onCancel:()=>{l(!1),k(null)},cancelDisabled:u,children:t.jsxs(O,{type:"submit",disabled:u||T.trim().length===0,children:[u&&t.jsx(Ne,{size:"xs",className:"mr-1.5"}),u?"Saving...":"Save"]})})]}):null,Be=!o&&N?t.jsx("div",{role:"alert",className:"mt-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,Ee=je?t.jsx(Sr,{content:s}):y?J?t.jsx(xa,{content:s,ownerSlug:y}):le?t.jsx(fa,{ownerSlug:y,content:s,batchReview:typeof te=="number"?ae(te,"Review run"):null}):void 0:void 0,he=e?e(Ee):{content:Ee,nativeHeading:Ee!=null};return t.jsx(va,{primaryContent:he.content,nativeHeading:he.nativeHeading,heading:z&&y?t.jsx(wr,{event:z,ownerSlug:y}):void 0,body:tt??(z&&y?t.jsx(kr,{event:z,ownerSlug:y}):void 0),detailLinks:he.links,headingAside:he.headingAside,hideDetails:a,presentation:"detail",content:s,ownerSlug:P??void 0,connectorDefinitions:r,onRenderedAction:y?L:void 0,runAction:ie,memoryActions:Te,memoryFeedback:Be,runId:de??s.run_id??null,onRunSelect:xe,auditDetails:(pe||Q)&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"request",label:"Request",available:pe},{key:"calls",label:"SDK calls",available:Q}].map(g=>g.available?t.jsxs(O,{variant:"outline",size:"sm","aria-expanded":i===g.key,onClick:()=>c($=>$===g.key?null:g.key),children:[i===g.key?t.jsx(dt,{className:"h-3.5 w-3.5"}):t.jsx(ut,{className:"h-3.5 w-3.5"}),g.label]},g.key):null)}),i==="request"&&(F.request_status==="too_large"?t.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof F.request_bytes=="number"?` (${F.request_bytes.toLocaleString()} bytes).`:"."]}):t.jsx(Ft,{value:F.request})),i==="calls"&&t.jsx(Ft,{value:F.sdk_call_trace})]})})}function ya(e,n){const s=e.payload_data??{},r=e.metadata??{};if(n.audit&&typeof s.success=="boolean")return s.success?"completed":"failed";if(n.changeSet)return r.kind==="automation_batch_reject"?"rejected":typeof r.pending_proposal_count!="number"?void 0:r.pending_proposal_count>0?"pending_approval":"completed";if(n.operation)return an(e.interaction_status,typeof r.status=="string"?r.status:void 0)}function ja(e){return e==="pending_approval"?"Needs approval":e==="confirmed"?"Approved":e?Ge(e):null}function va({presentation:e,primaryContent:n,nativeHeading:s=!1,heading:r,body:a,detailLinks:i,headingAside:c,content:o,ownerSlug:l,connectorDefinitions:d,onRenderedAction:p,runAction:u,memoryActions:m,memoryFeedback:_,auditDetails:w,runId:h,onRunSelect:v,hideDetails:N=!1}){const[k,R]=j.useState(!1),A=o.metadata??{},T=typeof o.score=="number"&&Number.isFinite(o.score)?Math.round(o.score):"-",E=o.payload_type||"text",M=E==="text"&&(o.semantic_type==="notification"||o.automation_id!=null)?"markdown":E,S=o.text_content||"",D=e==null&&(M==="text"||M==="markdown")&&S.length>500,x=D&&!k?`${S.slice(0,500)}...`:S,B=o.payload_data??{},V=rn(o),{audit:P,operation:y}=V,L=ya(o,V),F=ja(L),Z=(P?Bt(o).title:null)??o.title,le=P&&B.error&&typeof B.error=="object"?B.error.message:void 0,[J,pe]=j.useState(P&&n==null&&i==null),Q=P?B.duration_ms:A.duration_ms,X=typeof Q=="number"&&Number.isFinite(Q)&&Q>=0?Q:null,ce=P&&typeof B.sdk_call_count=="number"&&Number.isSafeInteger(B.sdk_call_count)&&B.sdk_call_count>=0?B.sdk_call_count:null,fe=A.thumbnail_url||A.thumbnail,ee=A.media_url,ne=ta(A),je=Object.entries(o.classifications||{}).flatMap(([b,I])=>{const me=ra(I);return me.values.map($e=>({slug:b,value:$e,isManual:me.isManual}))}),Y=(()=>{const b=o.platform||(typeof A.platform=="string"?A.platform:null),I=o.connection_id!=null?o.connection_id:A.source_connection_id!=null?Number(A.source_connection_id):null;return{...o,platform:b,connection_id:I!=null&&Number.isFinite(I)?I:null}})(),se=(()=>{const b=o.source_url??A.browser_url;if(typeof b!="string"||!URL.canParse(b))return null;const I=new URL(b);return I.protocol==="https:"||I.protocol==="http:"?I:null})(),re=o.occurred_at?new Date(o.occurred_at):null,{KindIcon:ae,kindLabel:ie}=Ut(o),de=t.jsx(yt,{source:Y,connectorDefinitions:d,sourceUrl:se,label:ie,fallback:t.jsx(ae,{className:"h-4 w-4"})}),ue=ne.length>0?t.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:ne.map(([b,I])=>t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-muted-foreground",children:Ge(b)}),t.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:ea(I)})]},b))}):null,xe=a?t.jsx("div",{className:"mt-1",children:a}):t.jsxs(t.Fragment,{children:[o.rating&&t.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(b=>t.jsx(zt,{className:`h-4 w-4 ${b<=Number(o.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},b))}),fe&&t.jsx("a",{href:ee||o.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:t.jsx("img",{src:fe,alt:"",className:`rounded-md object-cover ${M==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(M){case"markdown":if(x)return t.jsx("div",{className:"max-w-none text-sm space-y-2",children:t.jsx(Mn,{text:x})});break;case"json_template":{const b=o.payload_data;if(b?._truncated===!0&&typeof b.bytes=="number")return t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsx("p",{role:"status",children:"This report is too large for the feed preview. Open the full event to view its complete data."}),l?t.jsx(W,{to:Kt(l,Number(o.id)),className:"underline underline-offset-4",children:"Open full report"}):null]});const I=o.payload_template;if(I?.root)return t.jsx(Yr,{template:I,data:o.payload_data||{},onAction:n?void 0:p},`${l}:${o.id}`);if(x)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:x});break}case"media":return t.jsxs("div",{className:"space-y-3",children:[!fe&&ee&&t.jsx("a",{href:ee,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:ee}),x&&t.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:x})]});case"empty":return t.jsxs("div",{className:"space-y-3",children:[w,ue??(w?null:t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"}))]});default:if(x)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:x});break}return t.jsxs("div",{className:"space-y-3",children:[ee&&!fe&&t.jsx("a",{href:ee,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:ee}),ue]})})()]}),te=n!=null||e==="detail"&&P,z=c!==void 0,ve=te||i!=null,ke=!!(F&&!s||ce!=null||X!=null||!z&&m!=null||T!=="-"&&o.score_breakdown!=null||se!=null);return j.useEffect(()=>{if(!z||!J)return;const b=I=>{I.key==="Escape"&&(I.preventDefault(),pe(!1))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[z,J]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:G("flex gap-3",e==="detail"&&"mb-5",z&&"relative"),children:[t.jsx(Dn,{children:de}),t.jsxs("div",{className:"min-w-0 flex-1",children:[e==="detail"&&(()=>{const b={semantic_types:o.semantic_type,...typeof o.automation_id=="number"?{produced_by:String(o.automation_id)}:{},...typeof o.run_id=="number"?{run_ids:String(o.run_id)}:{}};return t.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[o.semantic_type?l?t.jsx(W,{to:"/$owner/events",params:{owner:l},search:b,className:"hover:underline",title:`Show all ${ie} events`,children:ie}):t.jsx("span",{children:ie}):t.jsx("span",{children:ie}),re&&t.jsx("time",{dateTime:re.toISOString(),children:Fn(re)}),u]})})(),t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[(r??Z)&&!s&&t.jsx("h4",{className:G("min-w-0 font-medium",e==="detail"?"text-xl leading-snug":"line-clamp-2 text-sm"),children:r??Z}),e!=="detail"&&re&&t.jsx(Ln,{at:re}),z&&t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1 pt-0.5",children:[c,m,ve&&t.jsxs(O,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-muted-foreground hover:text-foreground","aria-expanded":J,onClick:()=>pe(b=>!b),children:["Details",J?t.jsx(dt,{className:"h-3.5 w-3.5"}):t.jsx(ut,{className:"h-3.5 w-3.5"})]})]})]}),ke&&t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[F&&!s&&t.jsxs(H,{variant:L==="failed"?"destructive":"secondary",className:"gap-1 text-xs",children:[L==="failed"?t.jsx(qt,{className:"h-3 w-3"}):L==="completed"?t.jsx(Vt,{className:"h-3 w-3"}):null,F]}),ce!=null&&t.jsxs("span",{children:[ce," SDK ",ce===1?"call":"calls"]}),X!=null&&t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(On,{className:"h-3 w-3"}),X<1e3?`${Math.round(X)}ms`:`${Number((X/1e3).toFixed(2))}s`]}),T==="-"?null:o.score_breakdown?t.jsxs(Ht,{children:[t.jsx(Wt,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 px-2",children:t.jsx("span",{className:"font-medium",children:T})})}),t.jsx(Jt,{className:"w-64",align:"end",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"font-medium",children:"Score Breakdown"}),t.jsx(na,{breakdown:o.score_breakdown})]})})]}):null,se&&t.jsxs(Pn,{children:[t.jsx(Bn,{asChild:!0,children:t.jsx(O,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1",asChild:!0,children:t.jsxs("a",{href:se.href,target:"_blank",rel:"noopener noreferrer",children:[t.jsx(Qt,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:"View original"})]})})}),t.jsx(Un,{children:"View original"})]}),!z&&m]}),_,l&&!(e==="detail"&&y)&&t.jsx(zn,{owner:l,source:Y,connectorDefinitions:d,variant:"chips",className:"mt-2 text-xs",runId:h,onRunSelect:v}),(o.author_name||!l)&&!(e==="detail"&&y)&&t.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:o.author_name||Xr(o)})]}),z&&J&&ve&&t.jsxs("div",{className:"absolute inset-x-0 top-full z-20 mt-2 max-h-[65vh] space-y-3 overflow-y-auto rounded-lg border bg-background p-3 shadow-lg",children:[i,te&&xe]})]}),typeof le=="string"&&t.jsx("p",{className:"mb-2 text-sm whitespace-pre-wrap text-destructive",children:le}),n,!te&&xe,(te||i!=null)&&c===void 0&&!(N&&n!=null)&&t.jsxs("details",{className:"mt-5 border-t pt-3",open:J,onToggle:b=>pe(b.currentTarget.open),children:[t.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Details"}),J&&t.jsxs("div",{className:"mt-3 space-y-3",children:[i,te&&xe]})]}),D&&t.jsx(O,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>R(!k),children:k?t.jsxs(t.Fragment,{children:[t.jsx(dt,{className:"h-3 w-3 mr-1"})," Show less"]}):t.jsxs(t.Fragment,{children:[t.jsx(ut,{className:"h-3 w-3 mr-1"})," Show more"]})}),je.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:je.map(b=>t.jsx(sa,{slug:b.slug,value:b.value||"",isManual:b.isManual},b.slug))})]})}function ba(e,n){const s=e.metadata??{},r=Yt(e)?Bt(e,n):null,{KindIcon:a,kindLabel:i}=Ut(e),c=xs(e,n),o=e.interaction_error??(typeof s.error_message=="string"?s.error_message:r?.failed?"Failed":null),l=e.platform||(typeof s.platform=="string"?s.platform:null);return{title:c,kindLabel:i,error:o,KindIcon:a,platform:l}}function _a(e,n){const s=hs(e);return s&&n?n(s):null}function Na({content:e,ownerSlug:n,connectorDefinitions:s,hideOriginator:r=!1,showEntity:a=!1,connectionName:i,callerName:c,extra:o,unread:l=!1,onOpen:d}){const p=Pe(),{title:u,kindLabel:m,error:_,KindIcon:w,platform:h}=ba(e,i),v=e.interaction_status==="pending",N=!!_||e.interaction_status==="failed",k=n?Kt(n,Number(e.id)):null,R=mt(p?.item?.href.split(/[?#]/)[0]??""),A=R!=null&&R.owner===n&&R.eventId===Number(e.id),T=[m,a?e.entity_name:null,e.automation_name,r?null:e.connection_name??e.feed_name,e.agent_name??e.client_name??e.device_label??_a(e,c),o],E=t.jsx(Le,{mark:t.jsx(yt,{source:{...e,platform:h},connectorDefinitions:s,label:m,fallback:t.jsx(w,{className:"h-4 w-4 text-muted-foreground"})}),name:u,badge:l&&!N?t.jsx("span",{className:"sr-only",children:"Unread"}):null,tone:v||l&&!N?"amber":N?"destructive":null,details:t.jsx(Qe,{parts:T}),at:e.occurred_at?new Date(e.occurred_at).getTime():null});if(!k)return t.jsx("div",{className:G(Je,"cursor-default"),children:E});const M=S=>{d?.(),!(!p||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey||S.button!==0)&&(S.preventDefault(),p.open({href:k,title:u}))};return t.jsx(W,{to:k,"aria-current":A?"true":void 0,className:G(Je,A&&"bg-accent"),onClick:M,children:E})}function Oe(e,n,s=`${n}s`){return`${e} ${e===1?n:s}`}function Nt(e){const n=[...new Set(e.apps.map(r=>r.name))];if(n.length>1)return Oe(e.apps.length,"app");const s=n[0]??"Unknown app";return e.apps.length>1?`${s} (${e.apps.length})`:s}function Lt(e){const{oldestAt:n,newestAt:s}=e;if(n==null||s==null)return null;const r=Ns(n,s),a=Se(n,r?"p":"d MMM p"),i=Se(s,r?"p":"d MMM p");return a===i?a:`${a}–${i}`}function cn(e){const n=new Map;for(const s of e.calls)n.set(s.call.title,(n.get(s.call.title)??0)+1);return[...n].map(([s,r])=>({title:s,count:r})).sort((s,r)=>r.count-s.count)}function dn(e){const n=cn(e)[0]?.title??"Ran background checks";return`${Nt(e)} ${n.charAt(0).toLowerCase()}${n.slice(1)}`}function un(e){return cn(e).slice(1).map(n=>`${n.title.charAt(0).toLowerCase()}${n.title.slice(1)} ${n.count}×`)}function wa(e,n){if(e.source)return e.source.name;if(e.kind==="background")return dn(e);if(n.idle)return"Looked around, changed nothing";const{topAction:s}=n;return n.changed[0]??(s?`${s.title}${s.count>1?` · ${s.count}×`:""}`:null)??n.explicitTitles[0]??Nt(e)}function ka(e){return[e.reads>0?Oe(e.reads,"read"):null,e.actions>0?Oe(e.actions,"action"):null].filter(Boolean).join(" · ")}function Ca({summary:e,headline:n}){const s=ka(e),r=e.changed[0]===n?e.changed.slice(1):e.changed;if(r.length===0){const c=e.idle?e.explicitTitles.slice(0,2):[];return t.jsx("span",{className:"block truncate",children:[...c,s].filter(Boolean).join(" · ")})}const a=r.slice(0,2),i=r.length-a.length;return t.jsxs("span",{className:"block truncate text-foreground/80",children:["Changed: ",a.join(" · "),i>0?` · ${i} more`:"",s?t.jsxs("span",{className:"text-muted-foreground",children:[" — ",s]}):null]})}function Aa({stretch:e,ownerSlug:n,connectorDefinitions:s,connectionName:r,sourceConnection:a,showEntity:i=!1},c){const o=Pe();return!o||!n?{open:null,selected:!1}:{selected:o.item?.key===e.key,open:()=>o.open({href:"",key:e.key,title:c,workStretch:{stretch:e,ownerSlug:n,connectorDefinitions:s,connectionName:r,sourceConnection:a,showEntity:i}})}}function Ra(e){if(e.length<2)return null;const n=Math.max(...e)-Math.min(...e),s=Math.round(n/(e.length-1)/1e3);return s<1?null:s<90?`every ${s}s`:`every ${Math.round(s/60)} min`}function Sa(e){const n=new Map;for(const s of e.calls){const r=_s(s.content),a=n.get(r.key)??{name:r.name,titles:new Map,ats:[]};a.titles.set(s.call.title,(a.titles.get(s.call.title)??0)+1),s.at!=null&&a.ats.push(s.at),n.set(r.key,a)}return[...n].map(([s,{name:r,titles:a,ats:i}])=>({key:s,name:r,checks:[...a].sort((c,o)=>o[1]-c[1]).map(([c,o])=>`${c} · ${o}×`),every:Ra(i),lastAt:i.length>0?Math.max(...i):null}))}function $a({stretch:e}){const n=dn(e),s=un(e),r=[`${n} · ${e.calls.length}×`,e.oldestAt!=null?`since ${Se(e.oldestAt,"p")}`:null,...s].filter(Boolean).join(" · ");return t.jsxs(Ht,{children:[t.jsx(Wt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-muted-foreground hover:bg-accent/50 data-[state=open]:bg-accent data-[state=open]:text-foreground",children:[t.jsx(Gt,{"aria-hidden":"true",className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:r})]})}),t.jsxs(Jt,{align:"start",className:"w-80 p-0",children:[t.jsx("p",{className:"border-b border-border px-3 py-2 text-xs text-muted-foreground",children:"Apps checking in today. Background, not work they did."}),t.jsx("ul",{className:"divide-y divide-border",children:Sa(e).map(a=>t.jsxs("li",{className:"px-3 py-2",children:[t.jsx("div",{className:"text-sm font-medium",children:a.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:[...a.checks,a.every,a.lastAt!=null?`last checked ${gs(a.lastAt,{addSuffix:!0})}`:null].filter(Boolean).join(" · ")})]},a.key))})]})]})}function Ia({hideOriginator:e=!1,...n}){const{stretch:s,connectorDefinitions:r,sourceConnection:a}=n,i=j.useMemo(()=>ys(s),[s]),c=wa(s,i),{open:o,selected:l}=Aa(n,c),d=s.kind==="background",{source:p}=s,u=i.failedCalls.length+i.failedOperations.length+s.flagged.length,m=!u&&!p&&(d||i.idle),_=d?Gt:i.idle&&!p?js:vs,w=p?[Lt(s),Oe(s.items.length,"item"),u>0?`${u} failed`:null]:d?[s.oldestAt!=null?`since ${Se(s.oldestAt,"p")}`:null,...un(s)]:[e?null:Nt(s),Oe(s.calls.length,"call"),Lt(s),u>0?`${u} failed`:null],h=t.jsx(Le,{mark:p?t.jsx(yt,{source:{platform:a?.(p.connectionId)?.connectorKey??s.items[0]?.group.root?.platform??null},connectorDefinitions:r,label:p.name,fallback:t.jsx(_,{className:"h-4 w-4 text-muted-foreground"})}):t.jsx(_,{className:"h-4 w-4 text-muted-foreground"}),name:c,badge:d?t.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[s.calls.length,"×"]}):null,tone:u>0?"destructive":null,details:t.jsxs(t.Fragment,{children:[p?t.jsx("span",{className:"block truncate text-foreground/80",children:bs(s).map(N=>N.label).join(" · ")}):d?null:t.jsx(Ca,{summary:i,headline:c}),t.jsx("span",{className:"block truncate",children:w.filter(Boolean).join(" · ")})]}),at:s.newestAt}),v=G(Je,m&&"opacity-60");return o?t.jsx("button",{type:"button","aria-current":l?"true":void 0,className:G(v,l&&"bg-accent opacity-100"),onClick:o,children:h}):t.jsx("div",{className:G(v,"cursor-default"),children:h})}function Ha({presentation:e="summary",renderDetail:n,hideDetails:s=!1,organizationId:r,ownerSlug:a,entityId:i,filters:c,showEntityLinks:o=!1,hideOriginator:l=!1,emptyState:d,groupStretches:p=!1,foldRunSatellites:u=!0,renderLead:m,hiddenApprovalRunIds:_,unreadNotices:w,onMarkRead:h,extraRows:v,onGoToLatest:N}){const{isAuthenticated:k,isReady:R,session:A}=et(),{isMember:T,isLoading:E}=ws(),M=a==="me",S=!M&&R&&k&&T,D=!M&&R&&(!k||!E&&!T),{data:x=[]}=ks(R&&S?r:null),{data:B=[]}=Cs(D?a:null),V=S?x:B,{data:P}=As(p&&R&&S?r:null),y=j.useMemo(()=>{const f=new Map((P??[]).map(C=>[C.id,C.display_name??C.connector_name]));return C=>f.get(C)??null},[P]),{data:L}=Rs({enabled:R&&S}),F=A?.user?.id??null,Z=j.useCallback(f=>f.kind==="user"?f.userId===F?"You":null:L?.find(C=>C.agentId===f.agentId)?.name??f.agentId,[L,F]),le=j.useMemo(()=>{const f=new Map((P??[]).map(C=>[C.id,C.connector_key]));return C=>{const q=f.get(C);return q&&r?{connectorKey:q,organizationId:r}:null}},[P,r]),J=Ss(R&&S?r:null,i,c,a),pe=$s(D?a:null,i,c),Q=D?pe:J,{data:X,isLoading:ce,error:fe,fetchNextPage:ee,hasNextPage:ne,isFetchingNextPage:je}=Q,Y=j.useMemo(()=>X?.pages.flatMap(f=>f.content)??[],[X]),se=j.useMemo(()=>{const f=Is(Y,{foldRunSatellites:u}),C=f.map(oe=>oe.head),q=new Map(f.map(oe=>[oe.head.id,oe])),ye=Ts(C),Ce=Array.from(ye.entries()).map(([oe,st])=>{const Rt=st.root||st.replies[0],St=Rt?q.get(Rt.id):void 0;return{rootId:oe,group:st,history:St?.history??[],runId:St?.runId??null}});return _?Es(Ce,_):Ce},[Y,u,_]),re=m?se[0]:void 0,ae=re?It(re)??void 0:void 0,ie=ae?se.slice(1):se,de=f=>w?.(f)??[],ue=p&&Ms(c),xe=`${r}:${i}:${JSON.stringify(Ds(c))}:${c.beforeOccurredAt}:${c.beforeId}`,[te,z]=j.useState(null),ve=()=>{let f=Number.NEGATIVE_INFINITY;for(const C of Y){const q=Date.parse(C.occurred_at);q>f&&(f=q)}z({scope:xe,ids:new Set(Y.map(C=>C.id)),newestAt:f})},ke=ue&&Y.length>0&&!Q.isFetching,b=te?.scope!==xe;j.useEffect(()=>{ke&&b&&ve()});const I=j.useRef(null),me=ue?Fs(ie,b?null:te,f=>Os(f,{connectionName:y,groupSources:!Ps(c,i)})):{entries:ie.map(f=>({kind:"single",node:f})),pending:[]},$e=new Date().toDateString(),Ie=f=>f.kind==="stretch"&&f.stretch.kind==="background"&&f.stretch.newestAt!=null&&new Date(f.stretch.newestAt).toDateString()===$e,Te=[...me.entries,...me.pending].find(Ie),tt=me.entries.filter(f=>!Ie(f)),Be=me.pending.filter(f=>!Ie(f)).length,Ee=!M&&(!R||k&&E||S&&Q.isPending);if(fe)return t.jsx(Ls,{label:"events"});const he=e==="detail",g=(f,C,q={})=>{const ye=de(f);return{key:C,occurredAt:f.occurred_at,content:t.jsx(Na,{content:f,ownerSlug:a,connectorDefinitions:V,connectionName:y,callerName:Z,hideOriginator:l,showEntity:o,extra:q.extra,unread:ye.length>0,onOpen:ye.length>0&&h?()=>h(ye):void 0})}},$=f=>{if(f.kind==="stretch"){const{stretch:oe}=f;return[{key:oe.key,occurredAt:oe.newestAt,content:t.jsx(Ia,{stretch:oe,ownerSlug:a,connectorDefinitions:V,connectionName:y,sourceConnection:le,hideOriginator:l,showEntity:o})}]}const{rootId:C,group:q}=f.node,ye=q.root||q.replies[0];if(!ye)return[];const Ce=q.root?q.replies.length:q.replies.length-1;return[g(ye,C,{extra:Ce>0?`${Ce} ${Ce===1?"reply":"replies"}`:null})]},K=f=>{if(f.kind!=="single")return[];const C=It(f.node);return C?[{key:f.node.rootId,occurredAt:C.occurred_at,content:t.jsx(ga,{ownerSlug:a,content:C,renderDetail:n,connectorDefinitions:V,hideDetails:s})}]:[]},ge=tt.flatMap(he?K:$),Me=Y.at(-1)?.occurred_at,wt=(v??[]).filter(f=>!ne||Me==null||(ze(f.occurredAt)??0)>=(ze(Me)??0)),kt=wt.length>0&&(ge.length>0||ae)?[...ge,...wt].sort((f,C)=>(ze(C.occurredAt)??0)-(ze(f.occurredAt)??0)):ge,mn=t.jsx(Ys,{rows:!he,groupByDate:!he,isLoading:ce||Ee,emptyState:ae||Te?.kind==="stretch"?null:d,hasNextPage:!!ne,isFetching:Q.isFetching,isFetchingNextPage:je,onLoadMore:()=>void ee(),items:kt}),pn=Be>0?t.jsx("div",{className:"pointer-events-none sticky top-2 z-10 flex h-0 justify-center overflow-visible",children:t.jsxs(O,{size:"sm",className:"pointer-events-auto h-7 rounded-full px-3 text-xs shadow-md",onClick:()=>{ve(),I.current?.scrollIntoView?.({block:"start",behavior:"smooth"})},children:[Be," new"]})}):null,Ct=Te?.kind==="stretch"?t.jsx($a,{stretch:Te.stretch}):null,nt=c.beforeOccurredAt?Ta(c.beforeOccurredAt):null,fn=Ct||nt||N?t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:Ct}),nt?t.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:["From ",nt]}):null,N&&t.jsxs(O,{variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1.5 px-2 text-xs font-normal text-muted-foreground",onClick:N,children:[t.jsx(Bs,{"aria-hidden":"true",className:"h-3.5 w-3.5"}),"Back to latest"]})]}):null,At=t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:I,className:"scroll-mt-4"}),pn,fn,mn]});return!ae||!m?At:t.jsxs(t.Fragment,{children:[m(ae,{hasEarlier:kt.length>0||!!ne}),At]})}function Ta(e){const n=new Date(e);return Number.isNaN(n.getTime())?null:Gs(n)?Se(n,"p"):Se(n,Zs(n)?"d MMM, p":"d MMM yyyy, p")}export{Ha as E,Va as R,va as a,qa as b,za as c,Ir as d,Nt as e,Na as f,Oe as p,Ka as r,Lt as s};
|
|
2
|
-
//# sourceMappingURL=events-feed-DwOkLk6A.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as f,j as e,e3 as C,e4 as S,e5 as w,e6 as B,i as b,B as g,e7 as F,k as I,e8 as D,e9 as E,ea as L,eb as $,dp as R,dq as M,a4 as T,X as _,a6 as Q,dO as v,ec as U,ed as N,ee as p,U as y,ef as q}from"./index-C2TCKJDP.js";import{s as k}from"./subDays-DwIOMzYC.js";function O(s){return s&&s.kind!=="toggle"?s:void 0}const P="w-72";function z({editor:s,close:t,header:r,footer:i}){const[u,a]=f.useState("");return e.jsxs(e.Fragment,{children:[r,s.kind==="list"?e.jsxs(D,{shouldFilter:!s.onQueryChange,children:[e.jsx(E,{autoFocus:!0,placeholder:s.searchPlaceholder,value:u,onValueChange:d=>{a(d),s.onQueryChange?.(d)}}),e.jsxs(L,{children:[e.jsx($,{children:s.emptyText}),e.jsx(R,{children:s.items(t,u)})]})]}):s.render(t),i]})}function H({chip:s,editor:t}){const[r,i]=f.useState(!1),u=s.onRemove!=null,a=s.value?s.op?[s.label,s.op,s.value].join(" "):`${s.label}: ${s.value}`:s.label,d=s.value?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:s.op?s.label:`${s.label}:`}),s.op?e.jsx("span",{className:"text-muted-foreground",children:s.op}):null,e.jsx("span",{className:"min-w-0 truncate font-medium",children:s.value})]}):e.jsx("span",{className:"min-w-0 truncate font-medium",children:s.label}),l=t?e.jsx(S,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Edit filter: ${a}`,className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1 focus-visible:outline-none",children:d})}):e.jsx("span",{className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1",children:d});return e.jsxs(C,{open:r,onOpenChange:i,children:[e.jsxs("div",{"data-filter-chip":s.id,title:s.title,className:b("inline-flex h-8 max-w-full items-stretch rounded-md border text-sm",s.tone==="warning"?"border-amber-500/60 bg-amber-500/10":u?"bg-muted":"border-dashed bg-transparent",r&&"ring-1 ring-ring",!u&&"pr-1.5"),children:[l,u?e.jsx("button",{type:"button","aria-label":`Remove filter: ${a}`,onClick:s.onRemove,className:"flex w-7 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(_,{className:"h-3.5 w-3.5"})}):null]}),t?e.jsx(F,{align:"start",className:b("p-0",P,t.className),children:e.jsx(z,{editor:t,close:()=>i(!1),footer:u?e.jsx("div",{className:"border-t p-1",children:e.jsx(g,{variant:"ghost",size:"sm",className:"w-full justify-start text-destructive hover:text-destructive",onClick:()=>{i(!1),s.onRemove?.()},children:"Remove filter"})}):null})}):null]})}function V({fields:s,triggerClassName:t}){const r=s.filter(o=>o.inMenu!==!1),[i,u]=f.useState(!1),[a,d]=f.useState(),l=r.find(o=>o.key===a),c=O(l?.editor),x=r.filter(o=>o.editor.kind==="toggle"&&o.editor.checked).length,m=[...new Set(r.map(o=>o.group??""))],h=()=>{u(!1),d(void 0)};return e.jsxs(C,{open:i,onOpenChange:o=>{u(o),o||d(void 0)},children:[e.jsx(S,{asChild:!0,children:t?e.jsxs("button",{type:"button",className:b("flex shrink-0 items-center gap-1.5 px-2.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t),children:[e.jsx(w,{"aria-hidden":"true",className:"h-3.5 w-3.5"}),"Filter",x>0?e.jsx("span",{className:"tabular-nums text-foreground",children:x}):null,e.jsx(B,{"aria-hidden":"true",className:"h-3.5 w-3.5"})]}):e.jsxs(g,{variant:"outline",size:"sm",className:"h-8 gap-1.5 font-normal text-muted-foreground",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(F,{align:t?"end":"start",className:b("p-0",P,c?.className),children:l&&c?e.jsx(z,{editor:c,close:h,header:e.jsxs("div",{className:"flex items-center gap-1 border-b px-1 py-1 text-sm font-medium",children:[e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Back to filters",onClick:()=>d(void 0),children:e.jsx(I,{className:"h-4 w-4"})}),l.label]})},l.key):e.jsxs(D,{children:[e.jsx(E,{autoFocus:!0,placeholder:"Filter by…"}),e.jsxs(L,{children:[e.jsx($,{children:"No matching filter"}),m.map(o=>e.jsx(R,{heading:o||void 0,children:r.filter(n=>(n.group??"")===o).map(n=>e.jsxs(M,{value:`${n.label} ${n.key}`,onSelect:()=>n.editor.kind==="toggle"?n.editor.onToggle():d(n.key),"aria-checked":n.editor.kind==="toggle"?n.editor.checked:void 0,className:"gap-2",children:[n.icon?e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",children:n.icon}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.label}),n.editor.kind==="toggle"?e.jsxs(e.Fragment,{children:[n.editor.count!=null?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:n.editor.count.toLocaleString()}):null,e.jsx(T,{"aria-hidden":"true",className:b("h-4 w-4 shrink-0",!n.editor.checked&&"invisible")})]}):null]},n.key))},o))]})]})})]})}function Z({fields:s,chips:t,meta:r,actions:i,trailing:u,onClearAll:a,hasClearableState:d=!1,className:l,label:c="Filters",menu:x=!0,clearAllMin:m=1}){const h=s.filter(n=>n.inMenu!==!1),o=t.filter(n=>n.onRemove).length;return e.jsxs("div",{role:"search","aria-label":c,className:b("flex min-w-0 flex-wrap items-center gap-2",l),children:[t.map(n=>e.jsx(H,{chip:n,editor:O(n.editor??s.find(j=>j.key===(n.field??n.id))?.editor)},n.id)),x&&h.length>0?e.jsx(V,{fields:h}):null,i,e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[r?e.jsx("span",{className:"text-sm text-muted-foreground",children:r}):null,a&&o+(d?1:0)>=m?e.jsx(g,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground",onClick:a,children:"Clear all"}):null,u]})]})}function A({selected:s}){return e.jsx(T,{className:b("h-4 w-4 shrink-0",s?"opacity-100":"opacity-0")})}function ee({searchPlaceholder:s,emptyText:t="No options",options:r,selected:i,multiple:u=!1,onSelect:a}){return{kind:"list",searchPlaceholder:s,emptyText:t,items:d=>r.map(l=>{const c=i.includes(l.value);return e.jsxs(M,{value:`${l.label} ${l.keywords??l.value}`,onSelect:()=>{a(l.value),u||d()},"aria-label":l.label,className:"group gap-2",children:[u?e.jsx(Q,{checked:c,className:"mr-1"}):e.jsx(A,{selected:c}),l.icon,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.label}),l.count!=null?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:l.count.toLocaleString()}):null,l.action]},l.value)})}}function se([s,t],r,i){return s<=r?`≤ ${t}`:t>=i?`≥ ${s}`:`${s}–${t}`}function G({value:s,min:t,max:r,onApply:i,close:u}){const[a,d]=f.useState(String(s?.[0]??t)),[l,c]=f.useState(String(s?.[1]??r)),[x,m]=f.useState(),h=o=>{o.preventDefault();const n=Number(a),j=Number(l);if(!Number.isFinite(n)||!Number.isFinite(j)){m("Enter a number.");return}if(n<t||j>r){m(`Use values between ${t} and ${r}.`);return}if(n>j){m("The lower bound must not exceed the upper bound.");return}i([n,j]),u()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:h,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2",children:[e.jsx(y,{"aria-label":"From",type:"number",min:t,max:r,value:a,onChange:o=>d(o.target.value)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"to"}),e.jsx(y,{"aria-label":"To",type:"number",min:t,max:r,value:l,onChange:o=>c(o.target.value)})]}),x?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:x}):null,e.jsx(g,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function te(s){return{kind:"custom",render:t=>e.jsx(G,{...s,close:t})}}const W=[{label:"Today",range:()=>[N(new Date),p(new Date)]},{label:"Last 7 days",range:()=>[N(k(new Date,6)),p(new Date)]},{label:"Last 30 days",range:()=>[N(k(new Date,29)),p(new Date)]},{label:"This month",range:()=>[q(new Date),p(new Date)]}];function ne([s,t]){return v(s,"yyyy-MM-dd")===v(t,"yyyy-MM-dd")?v(s,"LLL d, y"):`${v(s,"LLL d")} – ${v(t,"LLL d, y")}`}function X({value:s,onApply:t,close:r}){const[i,u]=f.useState(s?{from:s[0],to:s[1]}:void 0);return e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsx("div",{className:"flex flex-col gap-0.5 border-b p-2 sm:w-36 sm:border-b-0 sm:border-r",children:W.map(a=>e.jsx(g,{variant:"ghost",size:"sm",className:"justify-start font-normal",onClick:()=>{t(a.range()),r()},children:a.label},a.label))}),e.jsx(U,{mode:"range",defaultMonth:i?.from,selected:i,onSelect:a=>{u(a),a?.from&&a.to&&a.from!==a.to&&(t([N(a.from),p(a.to)]),r())},numberOfMonths:1})]})}function ae(s){return{kind:"custom",className:"w-auto",render:t=>e.jsx(X,{...s,close:t})}}function J({type:s,label:t,value:r,onApply:i,close:u}){const[a,d]=f.useState(r==null?"":String(r)),[l,c]=f.useState(),x=m=>{if(m.preventDefault(),s==="number"){const h=Number(a);if(a.trim()===""||!Number.isFinite(h)){c("Enter a number.");return}i(h)}else i(a);u()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:x,children:[e.jsx(y,{autoFocus:!0,"aria-label":t,type:s,step:s==="number"?"any":void 0,value:a,onChange:m=>d(m.target.value),placeholder:"Enter a value…"}),l?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:l}):null,e.jsx(g,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function re(s){return{kind:"custom",render:t=>e.jsx(J,{...s,close:t})}}export{V as F,A as S,Z as a,se as b,ae as d,ne as f,ee as o,te as r,re as v};
|
|
2
|
-
//# sourceMappingURL=filter-editors-DQ5V4Cvh.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{s as ce,r as f,cS as de,cT as me,j as e,cU as ue,i as C,L as b,m as h,cV as xe,cW as he,cX as pe,a4 as V,cY as Z,cZ as ge,c_ as fe,c$ as je,d0 as K,G as Ne,d1 as be,d2 as we,d3 as _,B as z,bo as J,n as ve,ce as ke,ct as ye,d4 as Ce,d5 as Se,d6 as Re,d7 as Le,d8 as Ae,cf as Me,d9 as Ie,da as Ee,U as $e,db as Te,dc as He,dd as Pe,de as Oe,b0 as De,cJ as _e,ci as Be,df as Fe,dg as Ke,dh as Ye,ck as Ge,di as We,cn as Ue,dj as qe,dk as Xe,b4 as Ze,dl as Je,u as Qe,d as Ve}from"./index-C2TCKJDP.js";import{F as ze,a as es}from"./filter-editors-DQ5V4Cvh.js";import{a as ee}from"./list-skeleton-bQAZ0hQp.js";import{u as ss}from"./use-automations-lV8PuE8L.js";import{u as ts}from"./clients-CydgUHrc.js";import{u as ns}from"./client-activity-scopes-B7xVaUA-.js";import{g as as}from"./client-rows-B3LULJxW.js";import{T as B,H as os}from"./home-toolbar-CpCcHA6z.js";const Q=12,rs=5e3;function is(s,n){const t=!!s&&!!n.organizationId&&(n.enabled??!0),i=ce({enabled:t}),{data:a}=i,u=a??[],x=f.useMemo(()=>u.map(d=>d.agentId),[u]),{threads:c,isLoading:r,isError:l}=de(s,x,{enabled:t&&x.length>0,limit:Q}),j=ns({enabled:t,limit:Q,excludeCommandClients:!1,organizationId:n.organizationId,refetchInterval:d=>d?rs:!1}),w=n.organizationId?j.data:void 0;return{items:f.useMemo(()=>[...c.map(d=>({kind:"conversation",at:d.updatedAt,thread:d})),...(w??[]).map(d=>({kind:"mcp",at:d.lastCallAt,conversation:d}))].sort((d,N)=>N.at-d.at),[w,c]),agents:u,isLoading:t&&(i.isLoading||r||j.isLoading),isError:i.isError||l||j.isError}}const ls={code:pe,crm:he,network:xe};function cs({owner:s,onSkip:n}){const t=me(s,{requireEntityTypes:!1});if(!t.ready||!t.counts)return e.jsx(ms,{});const i=ue(s,t.counts);return e.jsxs("section",{"aria-label":"Start here",className:"flex min-w-0 flex-col gap-4 pt-2 pb-6",children:[e.jsxs("div",{className:"flex flex-col gap-1 px-1",children:[e.jsx("p",{className:"text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:"Start here"}),e.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Where do you want to start?"}),e.jsx("p",{className:"max-w-2xl text-sm leading-6 text-muted-foreground",children:"Lobu is a live context layer for your agents. Connect the tools you work in; ChatGPT, Claude, Codex, and your own agents resume from the same context. Pick a starting point; everything lands in the same workspace, and you can combine them later."})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:i.map((a,u)=>e.jsx(ds,{recipe:a,className:C(u===i.length-1&&"md:col-span-2 xl:col-span-1")},a.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:"None of these?"}),e.jsx(b,{to:"/$owner/connectors/create",params:{owner:s},className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground",children:"Browse all connectors"}),n?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",onClick:n,className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Skip for now"})]}):null]})]})}function ds({recipe:s,className:n}){const t=ls[s.icon];return e.jsxs("article",{className:C("flex min-w-0 flex-col gap-3 rounded-lg border bg-card p-4",n),children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-muted text-muted-foreground",children:e.jsx(t,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:s.eyebrow}),e.jsx("h3",{className:"text-sm leading-5 font-semibold",children:s.title})]})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s.description}),e.jsx("ol",{className:"flex flex-col gap-1",children:s.steps.map(i=>{const a=i===s.next;return e.jsx("li",{children:i.complete?e.jsxs("span",{className:"flex min-h-7 items-center gap-2 px-1.5 text-xs text-muted-foreground",children:[e.jsx(V,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0",children:i.label})]}):a?e.jsxs(b,{...i.link,"aria-current":"step",className:C("flex min-h-9 items-center gap-2 rounded-md border border-primary/30 bg-primary/10 px-2 text-xs font-medium text-foreground transition-colors","hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),children:[e.jsx(Z,{className:"h-3.5 w-3.5 shrink-0 text-primary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1",children:i.label}),e.jsx(ge,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"})]}):e.jsxs("span",{className:"flex min-h-7 items-center gap-2 px-1.5 text-xs text-muted-foreground",children:[e.jsx(Z,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0",children:i.label})]})},i.key)})}),e.jsxs("div",{className:"mt-auto flex flex-col gap-1.5 border-t border-border/60 pt-3",children:[e.jsx("p",{className:"text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:"Then ask your agent"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s.prompt}),e.jsx(fe,{text:s.prompt})]})]})}function ms(){return e.jsxs("section",{"aria-label":"Start here",className:"flex min-w-0 flex-col gap-4 pt-2 pb-6",children:[e.jsxs("div",{className:"flex flex-col gap-2 px-1",children:[e.jsx(h,{className:"h-3 w-16"}),e.jsx(h,{className:"h-6 w-full max-w-lg"}),e.jsx(h,{className:"h-4 w-full max-w-xl"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[0,1,2].map(s=>e.jsxs("div",{className:C("flex flex-col gap-3 rounded-lg border p-4",s===2&&"md:col-span-2 xl:col-span-1"),children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(h,{className:"h-8 w-8 rounded-md"}),e.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[e.jsx(h,{className:"h-3 w-20"}),e.jsx(h,{className:"h-4 w-40"})]})]}),e.jsx(h,{className:"h-3 w-full"}),e.jsx(h,{className:"h-3 w-5/6"}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{className:"h-6 w-full"}),e.jsx(h,{className:"h-6 w-full"}),e.jsx(h,{className:"h-6 w-full"})]})]},s))})]})}const us=5;function xs({owner:s,entries:n,showMark:t=!0}){const i=je(n);return i.length===0?null:e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:i.map(a=>e.jsx("li",{children:a.entries.length>1?e.jsx(hs,{owner:s,group:a}):e.jsx(K,{owner:s,item:a.entries[0].item,variant:"row",showMark:t,tag:a.entries[0].repeats>1?`${a.entries[0].repeats}×`:void 0})},a.key))})}function hs({owner:s,group:n}){const[t,i]=f.useState(!1),{orgContext:a}=Ne(),u=be(),x=we(a),{entries:c}=n,r=c[0],l=c[c.length-1],j=new Set(c.map(({card:m})=>m.run_id)).size,w=t?c:c.slice(0,us),p=c.length-w.length,d=c.flatMap(({item:m})=>m.approvalRunId!=null?[m.approvalRunId]:[]),N=u.isPending||x.isPending,S=r.card.automation_name?.trim(),R=r.card.at===l.card.at?_(r.card.at):`${_(l.card.at)} – ${_(r.card.at)}`,$=async()=>{const m=await u.mutateAsync({decision:"approve",runIds:d}),L=new Set(m.failedRunIds),v=c.flatMap(({item:k})=>k.approvalRunId!=null&&!L.has(k.approvalRunId)&&k.notificationId!=null?[k.notificationId]:[]);v.length>0&&await x.mutateAsync(v),m.failed>0?J.error(`${m.succeeded} approved; ${m.failed} failed.`):J.success(`${m.succeeded} approved.`)};return e.jsxs("section",{"aria-label":`${c.length} approvals`,className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-3 pt-2.5 pb-1.5",children:[e.jsxs("h3",{className:"text-sm font-medium",children:[c.length," approvals waiting"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Proposed by ",S??"this Automation"," ·"," ",j===1?"1 run":`${j} runs`," · ",R]})]}),e.jsx("ul",{className:"divide-y border-t",children:w.map(m=>e.jsx("li",{children:e.jsx(K,{owner:s,item:m.item,variant:"row",showMark:!1})},m.item.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t px-3 py-2 text-xs",children:[p>0?e.jsxs("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>i(!0),children:[p," more · Review all"]}):null,d.length>1?e.jsxs(z,{type:"button",size:"sm",className:"ml-auto h-7 text-xs",disabled:N,onClick:()=>void $(),children:[e.jsx(V,{className:"mr-1 h-3 w-3"}),"Approve all ",d.length]}):null]})]})}const ps={automation:qe,connection:Ue,agent:We},gs={automation:[{to:"/$owner/automations/new",label:"New Automation"}],connection:[{to:"/$owner/connectors/create",label:"Add connection"}],agent:[{to:"/$owner/agents/new",label:"New agent"},{to:"/$owner/agents/connect",label:"Connect an app"}]},F={automation:{text:"No Automations yet.",action:{to:"/$owner/automations/new",label:"Start with a template"}},connection:{text:"No connections yet.",action:{to:"/$owner/connectors/create",label:"Connect a source"}},agent:{text:"No agents connected yet.",action:{to:"/$owner/agents/connect",label:"Connect an agent"}}};function Es({owner:s,organizationId:n,needsYou:t,onNeedsYouChange:i,section:a}){const{isMember:u,isPublic:x,isLoading:c}=ve(s),r=x&&!u&&!c,l=t&&!r,[j,w]=f.useState(""),p=ke(r?null:s),d=ss(n??void 0,void 0,{includeDetails:!1}),N=ye(n),S=Ce(n),{data:R=[],isLoading:$}=Se(n),m=is(s,{organizationId:n,enabled:!r}),L=ts(null,{enabled:!r}),{sources:v,unattached:k}=f.useMemo(()=>Re({owner:s,automations:d.data??[],connections:N.data??[],feeds:S.data??[],connectors:new Map(R.map(o=>[o.key,o])),recentItems:m.items,roster:m.agents,clientGroups:as(L.data??[]).filter(o=>o.connected),attention:p.attentionCards.map(o=>({card:o,item:Le(o)})),now:Date.now()}),[s,d.data,N.data,S.data,R,m.items,m.agents,L.data,p.attentionCards]),Y=o=>{o.length>0&&p.markManyRead.mutateAsync(o)},g=j.trim().toLowerCase(),A=l||g.length>0,G=f.useMemo(()=>Ae(v.filter(o=>(!l||o.attention.length>0)&&(!g||o.name.toLowerCase().includes(g))),{filtering:A,expanded:a!=null,kinds:a?[a]:r?["automation","connection"]:["automation","connection","agent"]}),[v,l,g,A,r,a]),T=f.useMemo(()=>a?[]:k.filter(({item:o})=>!g||o.title.toLowerCase().includes(g)),[k,g,a]),te=f.useMemo(()=>T.map(({item:o})=>o),[T]),y=Me(r?null:n,te),ne=new Set(y.pageRows.map(({item:o})=>o.id)),M=l?T.filter(({card:o,item:E})=>Ie(o)&&!ne.has(E.id)):[],ae={automation:d.isLoading,connection:N.isLoading||S.isLoading||$,agent:!r&&(m.isLoading||L.isLoading)},H=n==null||d.isLoading||N.isLoading||!r&&(m.isLoading||p.isLoading),oe=d.isError||N.isError||S.isError||m.isError||p.isError,P=G.every(o=>o.count===0)&&y.pageRows.length===0&&y.feeds.length===0&&M.length===0,W=`lobu:start-dismissed:${s}`,[U,re]=f.useState(()=>{try{return window.localStorage.getItem(W)==="1"}catch{return!1}}),[ie,O]=f.useState(!1),q=()=>{re(!0);try{window.localStorage.setItem(W,"1")}catch{}},D=v.some(o=>o.kind==="connection"),X=v.some(o=>o.kind==="agent"),I=u&&!H&&!A&&!r&&!U&&!D&&!X&&P,le=u&&!H&&!A&&!r&&!U&&!I&&(!D||!X);return e.jsxs("section",{"aria-label":"Home",className:"flex min-w-0 flex-col gap-3",children:[le?e.jsx(fs,{owner:s,hasConnection:D,onOpenPrompts:()=>O(!0),onHide:q}):null,I?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(Ee,{"aria-hidden":"true",className:"absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx($e,{type:"search","aria-label":"Search sources",placeholder:"Search sources",maxLength:512,value:j,onChange:o=>w(o.target.value),className:C(B,"pl-9")})]}),e.jsx(os,{owner:s,mode:"sources"}),r?null:e.jsxs("button",{type:"button",onClick:()=>O(!0),className:C(B,"flex shrink-0 items-center gap-1.5 px-2.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),children:[e.jsx(Te,{className:"h-4 w-4","aria-hidden":"true"}),"Prompts"]}),r?null:e.jsx(ze,{triggerClassName:B,fields:[{key:"needs-you",label:"Needs you",icon:e.jsx(Pe,{className:"h-4 w-4"}),editor:{kind:"toggle",checked:l,count:He(p.attentionCards),onToggle:()=>i(!l)}}]})]}),l?e.jsx(es,{label:"Source filters",menu:!1,fields:[],chips:[{id:"needs-you",label:"Needs you",value:"",onRemove:()=>i(!1)}]}):null,l&&!g?e.jsx(Oe,{owner:s,showMarkRead:!1}):null]}),oe&&!I?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Some activity could not be loaded. Refresh to try again."}):null,H&&P?e.jsx(js,{}):P&&A?e.jsx(De,{icon:_e,title:l&&!g?"All caught up":"Nothing matches",description:l&&!g?"Nothing needs you right now.":"No source matches this search."}):I?e.jsx(cs,{owner:s,onSkip:q}):e.jsxs(e.Fragment,{children:[y.pageRows.length>0||y.feeds.length>0?e.jsx("section",{"aria-label":"This page",className:"space-y-1",children:e.jsx(Be,{owner:s,organizationId:n,feeds:y.feeds,rows:y.pageRows})}):null,G.map(o=>ae[o.kind]?e.jsx(Ns,{label:o.label},o.kind):e.jsx(bs,{owner:s,organizationId:n,section:o,expanded:l,allRows:a===o.kind,onMarkRead:Y,connectorDefinitions:R},o.kind)),M.length>0?e.jsxs("section",{"aria-label":"Other",className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 px-1 pt-4 pb-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Other"}),e.jsx(se,{entries:M,onMarkRead:Y})]}),e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:M.map(({item:o,repeats:E})=>e.jsx("li",{children:e.jsx(K,{owner:s,item:o,variant:"row",tag:E>1?`${E}×`:void 0})},o.id))})]}):null]}),r?null:e.jsx(Fe,{owner:s,open:ie,onOpenChange:O})]})}function se({entries:s,onMarkRead:n,disabled:t=!1}){const i=s.filter(a=>a.unreadIds.length>0);return i.length===0?null:e.jsxs("button",{type:"button",disabled:t,className:"ml-auto inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>n(i.flatMap(a=>a.unreadIds)),children:[e.jsx(Ge,{"aria-hidden":"true",className:"h-3.5 w-3.5"}),"Mark ",i.length," read"]})}function fs({owner:s,hasConnection:n,onOpenPrompts:t,onHide:i}){const a=!n;return e.jsxs("div",{"aria-label":"Next step",className:"flex flex-wrap items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:a?"Next: connect a source":"Next: connect an agent"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a?"Your agent is ready. Give Lobu a source to work from.":"Your source is connected. Connect Claude, ChatGPT, or Codex to use it."})]}),e.jsx(z,{asChild:!0,size:"sm",children:e.jsx(b,{to:a?"/$owner/connectors/create":"/$owner/agents/connect",params:{owner:s},children:a?"Connect a source":"Connect an agent"})}),e.jsx("button",{type:"button",onClick:t,className:"text-xs text-muted-foreground underline decoration-border underline-offset-4 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Starter prompts"}),e.jsx("button",{type:"button",onClick:i,className:"text-xs text-muted-foreground underline decoration-border underline-offset-4 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:"Hide"})]})}function js(){return e.jsx("div",{role:"status","aria-label":"Loading Home",children:[0,1,2].map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"px-1 pt-4 pb-1.5",children:e.jsx(h,{className:"h-4 w-24"})}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2].map(n=>e.jsx(ee,{},n))})]},s))})}function Ns({label:s}){return e.jsxs("section",{"aria-label":s,className:"min-w-0",children:[e.jsx("div",{className:"px-1 pt-4 pb-1.5",children:e.jsx("h2",{className:"text-sm font-semibold",children:s})}),e.jsx("div",{role:"status","aria-label":`Loading ${s}`,className:"divide-y overflow-hidden rounded-lg border",children:[0,1,2].map(n=>e.jsx(ee,{},n))})]})}function bs({owner:s,organizationId:n,section:t,expanded:i,allRows:a,onMarkRead:u,connectorDefinitions:x}){const c=i?t.rows.flatMap(r=>r.attention):[];return e.jsxs("section",{"aria-label":t.label,className:"min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 px-1 pt-4 pb-1.5",children:[e.jsxs("h2",{className:"text-sm font-semibold",children:[t.label,a?e.jsx("span",{className:"ml-1.5 font-normal text-muted-foreground tabular-nums",children:t.count}):null]}),a?e.jsxs(e.Fragment,{children:[e.jsxs(b,{to:"/$owner",params:{owner:s},search:r=>({...r,section:void 0}),className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(Ke,{"aria-hidden":"true",className:"h-3 w-3"}),"All sections"]}),gs[t.kind].map(r=>e.jsxs(b,{to:r.to,params:{owner:s},className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[e.jsx(Ye,{"aria-hidden":"true",className:"h-3 w-3"}),r.label]},r.to))]}):t.count>t.rows.length?e.jsxs(b,{to:"/$owner",params:{owner:s},search:r=>({...r,section:t.kind}),className:"text-xs text-muted-foreground hover:text-foreground",children:["See all ",t.count," →"]}):null,e.jsx(se,{entries:c,onMarkRead:u})]}),t.count===0?e.jsxs("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:[F[t.kind].text," ",e.jsxs(b,{to:F[t.kind].action.to,params:{owner:s},className:"underline decoration-border underline-offset-4 transition-colors hover:text-foreground",children:[F[t.kind].action.label," →"]})]}):null,e.jsx("ul",{className:C("overflow-hidden rounded-lg border",t.rows.length===0&&"hidden"),children:t.rows.map(r=>e.jsxs("li",{className:"border-b last:border-b-0",children:[e.jsx(ws,{owner:s,organizationId:n,source:r,itemsShown:i,connectorDefinitions:x}),i&&r.attention.length>0?e.jsx("div",{className:"border-t py-2 pr-2 pl-10",children:e.jsx(xs,{owner:s,entries:r.attention,showMark:!1})}):null]},r.key))})]})}function ws({owner:s,organizationId:n,source:t,itemsShown:i,connectorDefinitions:a}){const u=ps[t.kind];return e.jsx(ks,{owner:s,organizationId:n,source:t,className:Xe,children:e.jsx(Ze,{mark:e.jsx(Je,{source:t.mark,connectorDefinitions:a,label:t.name,fallback:e.jsx(u,{className:"h-4 w-4 text-muted-foreground"})}),name:t.name,tone:t.attention.length>0?"amber":t.problem?"destructive":null,details:e.jsxs(e.Fragment,{children:[t.status,i?null:e.jsx(vs,{attention:t.attention})]}),at:t.at})})}function vs({attention:s}){const n=s[0];if(!n)return null;const t=s.length-1;return e.jsxs("span",{children:[" · Needs you: ",n.card.title,n.repeats>1?` (${n.repeats}×)`:"",t>0?` +${t} more`:""]})}function ks({owner:s,organizationId:n,source:t,className:i,children:a}){const u=Qe(),{open:x}=t,c=Ve(x.href),r=l=>{if(!(!u||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||l.button!==0)&&!(x.kind==="connection"&&!n)){if(l.preventDefault(),x.kind==="automation"||x.kind==="agent"){u.open({href:x.href,title:t.name,owner:s});return}u.open({href:x.href,title:t.name,key:t.key,connectorPanel:{section:"data",connectorKey:x.connectorKey,connectionId:x.connectionId,organizationId:n,ownerSlug:s}})}};return e.jsx(b,{to:c.pathname,search:c.search,className:i,onClick:r,children:a})}export{Es as H,se as M,xs as N};
|
|
2
|
-
//# sourceMappingURL=home-stream-Bg97PUBJ.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as r,L as i,i as o}from"./index-C2TCKJDP.js";const a="h-8 rounded-md border border-input bg-muted text-sm";function u({owner:t,mode:e}){const s=n=>o("flex h-full items-center rounded-[5px] px-2.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",n?"bg-background font-medium text-foreground":"text-muted-foreground hover:text-foreground");return r.jsxs("nav",{"aria-label":"Home view",className:o(a,"flex shrink-0 items-center p-0.5"),children:[r.jsx(i,{to:"/$owner",params:{owner:t},"aria-current":e==="sources"?"page":void 0,className:s(e==="sources"),children:"Sources"}),r.jsx(i,{to:"/$owner/events",params:{owner:t},"aria-current":e==="activity"?"page":void 0,className:s(e==="activity"),children:"Activity"})]})}export{u as H,a as T};
|
|
2
|
-
//# sourceMappingURL=home-toolbar-CpCcHA6z.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{bd as t,j as m,be as i}from"./index-C2TCKJDP.js";import{M as e}from"./memory-browse-page-CUea2Llz.js";import"./public-shell-ready-BbjPgh3k.js";import"./connector-boxes-BWPXijAk.js";import"./use-automations-lV8PuE8L.js";import"./feed-event-kinds-BYuZCoU4.js";import"./schema-type-editor-panel-C4e8pq1A.js";import"./entity-type-page-CouHZbc9.js";import"./event-kind-options-fHAIXu24.js";import"./code-editor-UppEMWpt.js";import"./index-Vcq4gwWv.js";import"./dynamic-schema-form-D3KnzCsW.js";import"./renderer-ucwCQmBk.js";import"./schema-value-CefbtPIY.js";import"./card-rE4Ctuy6.js";import"./table-1O-ik4_O.js";import"./entity-pages-DJNSQrfB.js";import"./filter-editors-DQ5V4Cvh.js";import"./subDays-DwIOMzYC.js";import"./core.esm-6koO33th.js";import"./view-param-filters-Bp84PUMd.js";import"./app-bridge-C4nPtae3.js";import"./member-scope-gate-Doic_6qX.js";function k(){const{owner:o,entityType:r}=t.useParams(),{create:p}=t.useSearch();return m.jsx(e,{ownerSlug:o,typeScope:i(r),create:p??!1})}export{k as component};
|
|
2
|
-
//# sourceMappingURL=index-9PGnv4-5.js.map
|