@lobu/runtime-server 24.2.0 → 24.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalogs/connectors.json +24 -2
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/gchat.ts +31 -1
- package/dist/connectors/postgres.ts +9 -5
- package/dist/db/migrations/20261101010000_public_source_type_references.sql +157 -0
- package/dist/dependencies.bun.lock +117 -178
- package/dist/owletto/dist/assets/_-DIK0ae_S.js +2 -0
- package/dist/owletto/dist/assets/_-gTbcArpS.js +3 -0
- package/dist/owletto/dist/assets/_agentId-DOmcJZfk.js +2 -0
- package/dist/owletto/dist/assets/_agentId-DW6wRCVC.js +2 -0
- package/dist/owletto/dist/assets/_automationId-B9IcDYBu.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-C6PmMPTA.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-BrJ8Pzze.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-BpJAeYYW.js +2 -0
- package/dist/owletto/dist/assets/_eventId-DarQJo0G.js +2 -0
- package/dist/owletto/dist/assets/_name-DtmNTcUm.js +2 -0
- package/dist/owletto/dist/assets/_owner-Db8at3hk.js +3 -0
- package/dist/owletto/dist/assets/_shape-6iFA8A86.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-CXkHn3Nl.js +2 -0
- package/dist/owletto/dist/assets/{_slug-MHQU8ftJ.js → _slug-DBOuBLoX.js} +2 -2
- package/dist/owletto/dist/assets/_viewKey-DC27aIN9.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-DuYDieln.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-D2T_a2dj.js → accept-invitation-BbDCVvur.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-V4ftmSN7.js +2 -0
- package/dist/owletto/dist/assets/{agent-card-controls-ColL5rdd.js → agent-card-controls-99mG6H5k.js} +2 -2
- package/dist/owletto/dist/assets/agent-client-setup-list-kMmqQSrf.js +4 -0
- package/dist/owletto/dist/assets/agent-connect-pages-B-NPTFs6.js +2 -0
- package/dist/owletto/dist/assets/{agent-editor-form-C24p9LLg.js → agent-editor-form-DfMTSIvj.js} +2 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-BvGgfd-h.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-jkf9DjdO.js → agent-loading-shells-Dnmb6W5Y.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-C8j8kRB1.js → agent-permissions-matrix-CbhXlbgY.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-B9giw2u2.js → agent-skill-context-V__2i6Vl.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-BMZ3r1bP.js → agent-skills-route-DFXr_bHp.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-D49f-bzP.js → agent-subpage-shell-DWzljvFb.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-BGHYHWDO.js → agent-thread-DQIr20H-.js} +4 -4
- package/dist/owletto/dist/assets/agents-CLbeiqTR.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-C8bTa2rv.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +121 -0
- package/dist/owletto/dist/assets/{app._appId-A51tx2jU.js → app._appId-Bsq40nak.js} +2 -2
- package/dist/owletto/dist/assets/{automation-detail-content-DCAZBKle.js → automation-detail-content-C9Cgr5Zj.js} +2 -2
- package/dist/owletto/dist/assets/automations-CLbeiqTR.js +2 -0
- package/dist/owletto/dist/assets/calendar-DMq3Dtqy.js +2 -0
- package/dist/owletto/dist/assets/{callback-WmyCei3R.js → callback-B-CAz-bK.js} +2 -2
- package/dist/owletto/dist/assets/{card-Cspo-4M6.js → card-SFtxv9f2.js} +2 -2
- package/dist/owletto/dist/assets/{claim-CCKdBtFt.js → claim-DrxIRWKt.js} +2 -2
- package/dist/owletto/dist/assets/client-activity-scopes-boZOHuPW.js +2 -0
- package/dist/owletto/dist/assets/client-rows-BJ2PxM4J.js +2 -0
- package/dist/owletto/dist/assets/clients-C7Lnuc3S.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-C8FJbT2P.js → code-editor-rX0t1g5C.js} +2 -2
- package/dist/owletto/dist/assets/connect-BcwgytDV.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-BF-AlunU.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-sDypRDeN.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-C9OkW1tv.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-Dc6HYr55.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-C6qbqgwF.js +2 -0
- package/dist/owletto/dist/assets/connection-88YzIBK9.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-D7pnWaFB.js +2 -0
- package/dist/owletto/dist/assets/connections-browser-DDJQh8Na.js +2 -0
- package/dist/owletto/dist/assets/connector-boxes-DDX7Ebc4.js +2 -0
- package/dist/owletto/dist/assets/connector-provenance-Th8ymGec.js +2 -0
- package/dist/owletto/dist/assets/{connector-scope-lists-B44Q9W-j.js → connector-scope-lists-BibdzKl1.js} +2 -2
- package/dist/owletto/dist/assets/{connectors-CTWPDH8f.js → connectors-BqwgLUUK.js} +2 -2
- package/dist/owletto/dist/assets/consent-BR5U7dwb.js +2 -0
- package/dist/owletto/dist/assets/{copy-button-kcjg8Giw.js → copy-button-2swYh4jb.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CoJ5Splc.js → core.esm-CHnfRiEM.js} +2 -2
- package/dist/owletto/dist/assets/{create-CQE5rD0i.js → create-BsPVnRpG.js} +2 -2
- package/dist/owletto/dist/assets/create-CVPYVOR5.js +2 -0
- package/dist/owletto/dist/assets/create-QFjmhOEU.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-DmCOFbRT.js +3 -0
- package/dist/owletto/dist/assets/create._connectorKey-DLDDVtLS.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-CeUS_78Q.js → cronstrue-CKwjNYgj.js} +2 -2
- package/dist/owletto/dist/assets/device-CKup7kvB.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-xGhCTU5_.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-B1H_ivDT.js +2 -0
- package/dist/owletto/dist/assets/{entity-avatar-BZIa-7i5.js → entity-avatar-HloBoalJ.js} +2 -2
- package/dist/owletto/dist/assets/entity-options-BSW_EG0W.js +2 -0
- package/dist/owletto/dist/assets/entity-page-D-WDWrAe.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-BCBdFndu.js +2 -0
- package/dist/owletto/dist/assets/event-card-Mcxv56DG.js +2 -0
- package/dist/owletto/dist/assets/event-detail-DXifj49J.js +2 -0
- package/dist/owletto/dist/assets/events-feed-BysC9HgU.js +2 -0
- package/dist/owletto/dist/assets/feed-event-kinds-BYuZCoU4.js +2 -0
- package/dist/owletto/dist/assets/filter-bar-BQm-ubB1.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-DtmqQmgl.js → full-page-spinner-BMiXl54z.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-D7W80sJO.js +2 -0
- package/dist/owletto/dist/assets/identity-N0cAO9BR.js +2 -0
- package/dist/owletto/dist/assets/index-4gCDI7m4.js +7950 -0
- package/dist/owletto/dist/assets/index-B4wXJwQY.js +2 -0
- package/dist/owletto/dist/assets/index-BNaI5GpS.js +2 -0
- package/dist/owletto/dist/assets/index-BUUrHuJJ.js +2 -0
- package/dist/owletto/dist/assets/index-BqrvJmLh.js +2 -0
- package/dist/owletto/dist/assets/{index-DRbaESbJ.js → index-C-WaHj1Y.js} +2 -2
- package/dist/owletto/dist/assets/index-CnvQEA5V.js +2 -0
- package/dist/owletto/dist/assets/index-Cq7P2c_E.js +2 -0
- package/dist/owletto/dist/assets/{index-BhBYXtEN.js → index-CzoK57xp.js} +2 -2
- package/dist/owletto/dist/assets/index-D3omC3Us.js +2 -0
- package/dist/owletto/dist/assets/{index-Bhop_otG.js → index-D4-uel59.js} +2 -2
- package/dist/owletto/dist/assets/index-DDGdlQrt.css +1 -0
- package/dist/owletto/dist/assets/index-DFEW7hMg.js +2 -0
- package/dist/owletto/dist/assets/index-DVV-WWuT.js +2 -0
- package/dist/owletto/dist/assets/index-DduQ_e9q.js +2 -0
- package/dist/owletto/dist/assets/index-DutlI1d-.js +2 -0
- package/dist/owletto/dist/assets/{json-diff-4sMmayDd.js → json-diff-E5D-NGYT.js} +4 -4
- package/dist/owletto/dist/assets/{list-skeleton-BafzvpOM.js → list-skeleton-Bp4HNgJ9.js} +2 -2
- package/dist/owletto/dist/assets/login-7F48UJGx.js +2 -0
- package/dist/owletto/dist/assets/logout-DxmfsVKD.js +2 -0
- package/dist/owletto/dist/assets/{member-scope-gate-Dit3MXBQ.js → member-scope-gate-vp3FihBD.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-CfDmjhDl.js +74 -0
- package/dist/owletto/dist/assets/model-Dn40BUzs.js +2 -0
- package/dist/owletto/dist/assets/{model-selector-BeFuFH7p.js → model-selector-88PJnyTq.js} +2 -2
- package/dist/owletto/dist/assets/models-BBK_n2RP.js +2 -0
- package/dist/owletto/dist/assets/new-4ruWHLR5.js +2 -0
- package/dist/owletto/dist/assets/{new-ChwqLmVY.js → new-CvX8_gIb.js} +2 -2
- package/dist/owletto/dist/assets/new-gMD1PHTL.js +2 -0
- package/dist/owletto/dist/assets/oauth-workspace-access-D9BNmyMY.js +2 -0
- package/dist/owletto/dist/assets/organization-BHcp5Pzg.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-0sa10jER.js +2 -0
- package/dist/owletto/dist/assets/{permissions-C6UFdvz2.js → permissions-hhxosugv.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-B4CSiyLB.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-CsenJeXa.js +2 -0
- package/dist/owletto/dist/assets/record-activity-D7bRaMk2.js +2 -0
- package/dist/owletto/dist/assets/{record-session-CJzFoVKc.js → record-session-CWXnCVln.js} +2 -2
- package/dist/owletto/dist/assets/{linked-record-peek-B0_B4PnF.js → renderer-7EGgTVX0.js} +30 -30
- package/dist/owletto/dist/assets/reset-password-CFUzxH7m.js +2 -0
- package/dist/owletto/dist/assets/runs-BPtQBTRN.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-Bj63_hb9.js +2 -0
- package/dist/owletto/dist/assets/{schema-type-editor-panel-DcJqbCrU.js → schema-type-editor-panel-CAhOB648.js} +2 -2
- package/dist/owletto/dist/assets/{settings-Dg0D_l_w.js → settings-Dg6nxKyw.js} +2 -2
- package/dist/owletto/dist/assets/settings-KJJ6WihO.js +2 -0
- package/dist/owletto/dist/assets/skills-ayt06_o2.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-Bh5F4C5K.js +2 -0
- package/dist/owletto/dist/assets/{status-dot-_LQZmEIX.js → status-dot-D3FoDRcc.js} +2 -2
- package/dist/owletto/dist/assets/table-DFcJRNk7.js +2 -0
- package/dist/owletto/dist/assets/use-automations-BHoV0dLs.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-CAFbh-Dk.js → use-mention-search-C3rWLuKm.js} +2 -2
- package/dist/owletto/dist/assets/use-scroll-sentinel-Ct-jt7O0.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-mKoqDsaD.js +2 -0
- package/dist/owletto/dist/assets/views-access-required-DHrDO333.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +100623 -98589
- package/npm-shrinkwrap.json +615 -960
- package/package.json +7 -10
- package/vendor/@better-auth-kysely-adapter/.bun-tag-abf95749a412716 +0 -0
- package/vendor/@better-auth-kysely-adapter/LICENSE.md +20 -0
- package/vendor/@better-auth-kysely-adapter/README.md +17 -0
- package/vendor/@better-auth-kysely-adapter/dist/bun-sqlite-dialect-DoOVo4ja.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/d1-sqlite-dialect-Cru74LbR.mjs +133 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.d.mts +116 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.mjs +719 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.d.mts +27 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/sqlite-introspector-DSCAP82F.mjs +90 -0
- package/vendor/@better-auth-kysely-adapter/package.json +52 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +29 -0
- package/vendor/connector-sdk/dist/index.d.ts +3 -1
- package/vendor/connector-sdk/dist/index.js +4 -0
- package/vendor/connector-sdk/dist/redact.d.ts +10 -0
- package/vendor/connector-sdk/dist/redact.js +130 -0
- package/vendor/connector-sdk/dist/types.d.ts +2 -1
- package/vendor/connector-sdk/package.json +6 -1
- package/vendor/core/dist/connector-query-errors.d.ts +6 -0
- package/vendor/core/dist/connector-query-errors.js +4 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +49 -20
- package/vendor/core/dist/contracts/tools/manage-entity.js +23 -5
- package/vendor/core/dist/contracts/worker/device-automation.d.ts +1 -1
- package/vendor/core/dist/contracts/worker/device-automation.js +1 -1
- package/vendor/core/dist/errors.d.ts +0 -20
- package/vendor/core/dist/errors.js +1 -25
- package/vendor/core/dist/index.d.ts +1 -0
- package/vendor/core/dist/index.js +4 -1
- package/vendor/core/dist/logger.js +8 -2
- package/vendor/core/dist/otel.d.ts +13 -2
- package/vendor/core/dist/otel.js +98 -44
- package/vendor/core/dist/trace-context.d.ts +12 -0
- package/vendor/core/dist/trace-context.js +50 -0
- package/vendor/core/dist/utils/ajv.js +3 -1
- package/vendor/core/package.json +26 -5
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-Cjvw31gU.js +0 -2
- package/dist/owletto/dist/assets/_-iToIRRFt.js +0 -3
- package/dist/owletto/dist/assets/_agentId-CLdj0X7j.js +0 -2
- package/dist/owletto/dist/assets/_agentId-D5cAWjrP.js +0 -2
- package/dist/owletto/dist/assets/_automationId-BhEZmkJU.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DZtLc3WW.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-BoYpah_l.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-ML2TjCwN.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BYc3I2EL.js +0 -2
- package/dist/owletto/dist/assets/_name-BsOZmvlH.js +0 -2
- package/dist/owletto/dist/assets/_owner-UuyQLJ-0.js +0 -3
- package/dist/owletto/dist/assets/_shape-BpnVAYWH.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-CYrGvNn-.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-CGAJ1ucr.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-CMkhfs1k.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-_G_lDz5K.js +0 -2
- package/dist/owletto/dist/assets/agent-client-setup-list-BgyLhJCo.js +0 -5
- package/dist/owletto/dist/assets/agent-connect-pages-BryZas7Z.js +0 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-D9PpDgR-.js +0 -2
- package/dist/owletto/dist/assets/agents-C05k-Xw6.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-D1YL3VAB.js +0 -2
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +0 -128
- package/dist/owletto/dist/assets/automations-C05k-Xw6.js +0 -2
- package/dist/owletto/dist/assets/client-activity-scopes-CmK3DkSP.js +0 -2
- package/dist/owletto/dist/assets/client-rows-fFuxzFtE.js +0 -2
- package/dist/owletto/dist/assets/connect-BmCUJ3lr.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-B6StGCPK.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-CPiMA6Bx.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-BialEDmu.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-X1wVi6v0.js +0 -2
- package/dist/owletto/dist/assets/connection-DJd9bnEc.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-IO6G5QjL.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-CzdcZeiU.js +0 -2
- package/dist/owletto/dist/assets/connector-provenance-bmBJJ9B4.js +0 -2
- package/dist/owletto/dist/assets/consent-C_WBfmQ8.js +0 -2
- package/dist/owletto/dist/assets/create-DQNlRTUX.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-y3tq2QIJ.js +0 -3
- package/dist/owletto/dist/assets/create-lOFSQV_5.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-icyNicvn.js +0 -2
- package/dist/owletto/dist/assets/device-Br9JHadR.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-7UpeD4Sq.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-DGMmjr01.js +0 -2
- package/dist/owletto/dist/assets/entity-options-BcTafZ2e.js +0 -2
- package/dist/owletto/dist/assets/entity-page-CY7PF3X9.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-BzMZttzh.js +0 -2
- package/dist/owletto/dist/assets/event-detail-C25TvOb_.js +0 -2
- package/dist/owletto/dist/assets/events-feed-C4VrjIc1.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-oNjBX9a2.js +0 -2
- package/dist/owletto/dist/assets/guardrails-Acfam-JF.js +0 -2
- package/dist/owletto/dist/assets/identity-BkK8ggdp.js +0 -2
- package/dist/owletto/dist/assets/index-Bw5iV_J7.js +0 -2
- package/dist/owletto/dist/assets/index-C3dpyynY.js +0 -2
- package/dist/owletto/dist/assets/index-C3zAbslo.js +0 -2
- package/dist/owletto/dist/assets/index-CGKN_WN_.js +0 -2
- package/dist/owletto/dist/assets/index-CgRaCOzW.js +0 -2
- package/dist/owletto/dist/assets/index-DfIoxD5Q.js +0 -2
- package/dist/owletto/dist/assets/index-DijuudSs.js +0 -2
- package/dist/owletto/dist/assets/index-Dr7bouPX.css +0 -1
- package/dist/owletto/dist/assets/index-JmEl29py.js +0 -7950
- package/dist/owletto/dist/assets/index-NK2VKPoL.js +0 -2
- package/dist/owletto/dist/assets/index-_5qsmBkt.js +0 -2
- package/dist/owletto/dist/assets/index-qkOKpRYs.js +0 -2
- package/dist/owletto/dist/assets/index-wzYkECAe.js +0 -2
- package/dist/owletto/dist/assets/login-XL5XxN6y.js +0 -2
- package/dist/owletto/dist/assets/logout-CMxdhLbM.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-DTlM_9MY.js +0 -74
- package/dist/owletto/dist/assets/models-BAVaDnKN.js +0 -2
- package/dist/owletto/dist/assets/new-1QLuS1o-.js +0 -2
- package/dist/owletto/dist/assets/new-D21LGMl6.js +0 -2
- package/dist/owletto/dist/assets/oauth-workspace-access-D15LYKSe.js +0 -2
- package/dist/owletto/dist/assets/organization-CoUJYXx7.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-BvkYk72J.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-CmLy1MZf.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-_awBxu2Y.js +0 -2
- package/dist/owletto/dist/assets/record-activity-Doeu5kPO.js +0 -2
- package/dist/owletto/dist/assets/reset-password-Y-WO77iR.js +0 -2
- package/dist/owletto/dist/assets/runs-B0zVYb-w.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-Dkyybqos.js +0 -2
- package/dist/owletto/dist/assets/runs-table-9OVdfPXZ.js +0 -2
- package/dist/owletto/dist/assets/settings-Cfy9tCOF.js +0 -2
- package/dist/owletto/dist/assets/skills-oxA7P5Fe.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-BeAZeMLy.js +0 -2
- package/dist/owletto/dist/assets/use-automations-DS3uz3pb.js +0 -2
- package/dist/owletto/dist/assets/use-scroll-sentinel-BpQ70c28.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-FuOZyjMg.js +0 -2
- package/dist/owletto/dist/assets/views-access-required-CWwlobOd.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k as q,V as I,r as D,gb as J,fU as Q,j as s,b_ as M,L as W}from"./index-JmEl29py.js";import{u as X,E as Y}from"./events-feed-C4VrjIc1.js";import{b as Z,a as z,V as K,M as ee}from"./view-param-filters-FuOZyjMg.js";const se={},te="calc(100dvh - 120px)";function ie({owner:n,organizationId:o,eventId:c,viewKey:r,params:g,onParamsChange:d,onSelectView:p,dense:h=!1,fullBleed:k=!1}){const{isAuthenticated:y,isReady:E}=q(),{data:U,isLoading:w}=I(),O=U?.some(t=>t.id===o&&t.is_member),i=n!=="me"&&o!==null&&E&&y&&!w&&O,a=X(i?{slug:n,organizationId:o}:null,c),[b,j]=D.useState(se),[P,L]=D.useState(null),m=J(a.views,r),e=i&&!a.isLoading&&!a.isError&&m.kind==="view"?m.view:null,v=e?`${Q(n,e.key)}/${e.content_hash}/${e.eventId}`:null,x=e!==null&&P===v,V=M(n,c),F=n!=="me"&&(!E||y&&(w||a.isLoading)),H=e!==null&&!x&&!F,u=k&&H,T=(k||h)&&H,N=F?s.jsx("div",{role:"status",className:"py-8 text-sm text-muted-foreground",children:"Loading event view…"}):e&&!x?s.jsxs(s.Fragment,{children:[s.jsx(Z,{decls:e.params,params:g??b,onParamsChange:t=>d?d(e.key,t,{replace:!1}):j(t)}),s.jsx(z,{orgSlug:n,viewKey:e.key,scope:{event:e.eventId},params:g??b,onParamsChange:t=>d?d(e.key,t):j(t),onLoadError:()=>L(v),contentHash:e.content_hash,title:e.name,minHeight:h?240:320,fixedHeight:T?te:void 0},v)]}):void 0;return s.jsxs("div",{className:u?"w-full space-y-3":"mx-auto w-full max-w-3xl space-y-3",...u?{"data-testid":"event-view-fullbleed"}:{},children:[i&&a.isError&&s.jsx(K,{onRetry:a.refetch}),(i||n==="me"&&r)&&!a.isLoading&&!a.isError&&m.kind==="missing"&&s.jsx(ee,{viewKey:m.key,backTo:V,backLabel:"Back to the event"}),x&&s.jsxs("div",{role:"alert",className:"rounded-md border p-3 text-sm",children:[s.jsx("p",{children:"The custom view couldn’t load. The event content is shown below."}),s.jsx("button",{type:"button",className:"mt-2 underline",onClick:()=>L(null),children:"Retry custom view"})]}),s.jsx(Y,{presentation:"detail",organizationId:o,ownerSlug:n,filters:{contentIds:[c],...n==="me"?{sortBy:"date",sortOrder:"desc"}:{}},hideDetails:h,renderDetail:t=>{const f=N!=null&&(t==null||!!r),_=(i?a.views:[]).filter(l=>!f||l.key!==e?.key).map(l=>({key:l.key,name:l.name,href:M(n,c,l.key)})),A=l=>l.length?s.jsx("nav",{"aria-label":"Event views",className:"flex flex-wrap gap-3 text-sm",children:l.map(({key:$,name:C,href:B})=>s.jsx(W,{to:B,className:"underline",onClick:p?G=>{G.preventDefault(),p(B)}:void 0,children:C},$))}):null,R=[..._],S=[..._];return i&&r&&t!=null&&S.unshift({key:":event",name:"Event details",href:V}),{content:f?N:t,nativeHeading:!f&&t!=null,headingAside:u?A(R):void 0,links:u?null:A(S)}}})]})}export{ie as E};
|
|
2
|
-
//# sourceMappingURL=event-detail-C25TvOb_.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,L as ie,C as Vt,dQ as ht,cN as qt,bw as Kt,g as ft,r as _,dR as gt,dS as Jt,Y as Qt,K as Wt,dP as Gt,u as yt,T as Se,dT as rt,dU as Qe,dV as jt,dW as Yt,dX as vt,b6 as Nt,dY as Xt,dZ as Zt,c_ as en,d_ as _t,d$ as tn,cj as nn,e0 as $e,e1 as sn,B as $,e2 as ve,cF as Ne,Q as xe,cH as bt,e3 as Ze,e4 as wt,dC as rn,dE as an,dD as on,e5 as ln,e6 as dn,cO as kt,e7 as cn,e8 as un,q as mn,o as Ct,bH as at,b_ as it,a0 as pn,e9 as xn,ea as hn,cl as fn,cK as gn,eb as yn,ec as jn,a3 as Pe,ed as vn,ee as Nn,bO as _n,ef as bn,bS as wn,eg as kn,dK as Cn,eh as Sn,X as An,bi as St,ei as Be,ej as ze,ek as Ue,df as Le,S as Re,aR as In,dv as Rn,k as En,an as Tn,cf as $n,dj as Pn,dn as Dn,dp as Fn,el as On,em as Ln,en as Mn,eo as Bn,ep as zn,bK as Un,eq as Hn,cI as Ve,bc as ot,cD as Vn}from"./index-JmEl29py.js";import{u as qn}from"./client-activity-scopes-CmK3DkSP.js";import{u as Kn,a as Jn}from"./client-rows-fFuxzFtE.js";import{b as At}from"./use-automations-DS3uz3pb.js";import{C as Qn,J as qe}from"./json-diff-4sMmayDd.js";import{C as lt}from"./copy-button-kcjg8Giw.js";import{J as Wn,l as Gn,s as Yn,S as Xn}from"./linked-record-peek-B0_B4PnF.js";import{u as Zn}from"./use-scroll-sentinel-BpQ70c28.js";function It(t,n){if(!t||typeof t!="object"||Array.isArray(t))return null;const s=t.title;if(typeof s!="string")return null;const r=s.trim();return r&&r!==n?r:null}function es(t,n){const s=n.parentEntityType&&n.parentEntitySlug?[{entity_type:n.parentEntityType,slug:n.parentEntitySlug},{entity_type:n.entityType,slug:n.entitySlug}]:[{entity_type:n.entityType,slug:n.entitySlug}];return ht(t,s)}function ts({ownerSlug:t,entity:n,className:s}){const r=es(t,n);return e.jsxs(ie,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${s??""}`,children:[e.jsx("span",{className:"font-medium",children:n.entityName}),e.jsx(Vt,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Rt(t){const n=Array.isArray(t?.records)?t.records:Array.isArray(t?.current)?t.current:[];return[t?.from_entity_id??t?.entity_id,t?.to_entity_id].map(s=>{const a=n.find(o=>o&&typeof o=="object"&&"id"in o&&o.id===s);return{id:String(s??"unknown"),name:typeof a?.name=="string"?a.name:`Record ${String(s??"unknown")}`}})}function Et(t,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"?t==="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.":t==="link"?"If approved, these records will be linked. Both records remain available.":"If approved, this relationship will be removed. Both records remain available."}function cr(t){const n=Rt(t.proposal);return{title:t.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(t.proposal?.relationship_type??t.proposal?.relationship_type_slug??"Relationship")},{type:"text",value:Et(t.action,typeof t.status=="string"?t.status:void 0),muted:!0},...typeof t.reason=="string"&&t.reason?[{type:"text",label:"Why this needs approval",value:t.reason}]:[]],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",confirm:t.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 Tt(t,n,s){return{queryKey:["event-view-match",t,n.key,n.content_hash,s],queryFn:async()=>{try{const a=(await qt("open_view",{key:n.key,scope:{event:s}},{slug:t})).scope?.event;if(!Number.isSafeInteger(a)||(a??0)<1)throw new Error("The view did not resolve its event subject");return a}catch(r){if(r instanceof Kt&&(r.status===400||r.status===404))return null;throw r}},staleTime:6e4}}function ur(t,n){const s=ft(t??{slug:null,organizationId:null}),r=t?.slug??null,a=_.useMemo(()=>r?gt(s.data??[]):[],[r,s.data]),o=Jt({queries:a.map(l=>Tt(r,l,n))});return r?{views:a.flatMap((l,p)=>{const i=o[p]?.data;return i?[{...l,eventId:i}]:[]}),isLoading:s.data===void 0?!s.isError:o.some(l=>l.isPending),isError:s.isError||o.some(l=>l.isError),refetch:()=>{s.refetch();for(const l of o)l.isError&&l.refetch()}}:{views:[],isLoading:!1,isError:!1,refetch:()=>{}}}async function ns(t,n,s,r){const a=await Promise.all(s.map(o=>t.fetchQuery(Tt(n,o,r))));return s.find((o,l)=>a[l])??null}async function ss(t,n,s,r){const a=await Qt(`${Wt}/api/${encodeURIComponent(t)}/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 Gt(a,"Could not record interaction"),a.json()}function z(t){if(typeof t!="string")return;const n=t.trim();return n.length>0?n:void 0}function Ke(t){return typeof t=="boolean"?t:void 0}function rs(t,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"||z(n?.reason_preview)&&z(n?.message)||z(t?.body)&&(z(t?.post_url)||z(t?.activity_id)))}function as(t,n,s){if(!rs(t,n,s))return null;const r=(s??"").toLowerCase(),a=z(n?.body)??z(t?.body),o=z(n?.reason_preview)??z(t?.reason),l=z(n?.post_url)??z(t?.post_url)??(z(t?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${z(t?.activity_id)}`:void 0),p=Ke(n?.prepared),i=Ke(n?.verified),c=Ke(n?.banner_shown),v=z(n?.message),m=n?.match&&typeof n.match=="object"?n.match:null,h=z(m?.text_preview),N=z(m?.author);let A="generic";r==="verify_staged_comment"||r.includes("verify")||typeof i=="boolean"?A="verify":(r==="prepare_comment"||r.includes("prepare")||p===!0||a&&l)&&(A="prepare");const b=[];return p===!0&&b.push("Staged — not posted"),p===!1&&b.push("Not staged"),i===!0&&b.push("Verified posted"),i===!1&&b.push("Not verified as posted"),c===!0&&b.push("In-page banner"),c===!1&&b.push("No banner"),{kind:A,message:v,reason:o,body:a,postUrl:l,prepared:p,bannerShown:c,verified:i,matchPreview:h,matchAuthor:N,chips:b}}function is(t){return t.semantic_type==="change"&&(t.metadata?.category==="config"||t.metadata?.category==="deployment")}function ye(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null}function os({content:t,detail:n=!1}){const s=t.metadata??{},r=t.payload_data??{},a=s.category==="deployment",o=typeof s.apply_id=="string"?s.apply_id:null,l=ye(r.manifest),p=o&&/^apl_[A-Za-z0-9-]{1,48}$/.test(o)&&t.origin_type==="deployment"&&t.origin_id===`deployment_${o}`&&(s.status==="succeeded"||s.status==="partial_failure")&&ye(l?.state);return e.jsxs("div",{className:"space-y-3","data-testid":"config-change-event",children:[e.jsx(Qn,{showAttribution:n,operation:a?String(s.status??"Apply"):typeof s.op=="string"?s.op:null,actor:t.author_name??(typeof s.actor_source=="string"?s.actor_source:null),createdAt:t.occurred_at??t.created_at,resource:a?"Configuration apply":`${s.resource_kind??"Configuration"} · ${s.resource_id??""}`,changedFields:Array.isArray(s.changed_fields)?s.changed_fields.filter(i=>typeof i=="string"):void 0}),o?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"break-all",children:["Apply ",o]}),e.jsx(lt,{text:o,label:"Copy apply ID"})]}):null,n?a?e.jsxs(e.Fragment,{children:[typeof s.rollback_of=="string"?e.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:["Restores apply ",s.rollback_of]}):null,ye(s.counts)?e.jsx("dl",{className:"flex flex-wrap gap-4 text-xs",children:Object.entries(ye(s.counts)??{}).map(([i,c])=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground",children:i}),e.jsx("dd",{children:String(c)})]},i))}):null,typeof r.error=="string"?e.jsx("p",{className:"text-sm text-destructive",children:r.error}):null,p?e.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Restore this deployment"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Preview restoring this saved configuration with the CLI. Secret values stay unchanged."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"break-all text-xs",children:["lobu rollback ",o]}),e.jsx(lt,{text:`lobu rollback ${o}`,label:"restore command",iconOnly:!0})]})]}):null,e.jsx(qe,{before:null,after:l})]}):Object.hasOwn(r,"before")?e.jsx(qe,{before:ye(r.before),after:ye(r.state)}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"The earlier state was not recorded for this change."}),e.jsx(qe,{before:null,after:ye(r.state)})]}):null]})}function Ee(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ls({template:t,data:n,onAction:s}){const[r,a]=_.useState(null),[o,l]=_.useState(!1),[p,i]=_.useState(null),[c,v]=_.useState(!1),m=_.useRef(!1),h=_.useRef(!0);_.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const N=async A=>{if(!(!s||m.current)){m.current=!0,l(!0),i(null),v(!1);try{const b=await s(A);if(!h.current)return;if(Ee(b)&&b.kind==="sdk"){const f=b.result;if(!Ee(f)||f.success!==!0){const w=Ee(f)&&Ee(f.error)?f.error.message:null;throw new Error(typeof w=="string"?w:"Could not update this event.")}if(f.return_truncated||!Ee(f.return_value))throw new Error("The update did not return a complete data object.");a(f.return_value),v(!0)}}catch(b){h.current&&i(b instanceof Error?b.message:"Could not update this event.")}finally{m.current=!1,h.current&&l(!1)}}};return e.jsxs("div",{className:"space-y-2",children:[o?e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Updating…"}):null,c?e.jsx("p",{role:"status",className:"sr-only",children:"Updated"}):null,p?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[p," Previous data is still shown."]}):null,e.jsx("fieldset",{disabled:!s||o,"aria-busy":o,className:"min-w-0",children:e.jsx(Wn,{template:{root:t.root},data:r??n,onAction:s?N:void 0,interactions:t.interactions})})]})}const dt="inline-flex max-w-full items-center truncate rounded-md border border-border px-1.5 py-0.5 text-xs";function We({peer:t,ownerSlug:n,orgContext:s}){const r=yt();if(t.self||!t.type||!r)return e.jsx("span",{className:Se(dt,"text-muted-foreground"),children:t.name});const a=r.item?.recordPeer?.entityId===t.id;return e.jsx("button",{type:"button","aria-pressed":a,title:t.type,className:Se(dt,"hover:bg-muted",a&&"ring-1 ring-primary"),onClick:o=>{o.stopPropagation(),r.open(Gn({...typeof t.id=="number"?{entityId:t.id}:{record:{type:t.type,key:t.id}},ownerSlug:n,orgContext:s,name:t.name}))},children:e.jsx("span",{className:"truncate",children:t.name})})}function mr(t,n=t.relationship_type_name){const s=t.from_entity_name??`Record #${t.from_entity_id}`,r=t.to_entity_name??`Record #${t.to_entity_id}`;return t.is_symmetric?`${s} ${n} ${r}`:`${s} → ${n} → ${r}`}function pr({row:t,entityId:n,entityType:s,ownerSlug:r,orgContext:a,label:o=t.relationship_type_name}){const l=(p,i,c)=>e.jsx(We,{peer:{id:p,name:i??`Record #${p}`,type:c,self:p===n&&(typeof p=="number"||c===s)},ownerSlug:r,orgContext:a});return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-xs",children:[l(t.from_entity_id,t.from_entity_name,t.from_entity_type),!t.is_symmetric&&e.jsx(rt,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:o}),!t.is_symmetric&&e.jsx(rt,{"aria-hidden":"true",className:"size-3 shrink-0 text-muted-foreground"}),l(t.to_entity_id,t.to_entity_name,t.to_entity_type)]})}function xr({count:t,onRetry:n}){return t?e.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:["Some linked records could not be read."," ",e.jsx("button",{type:"button",className:"underline",onClick:n,children:"Retry"})]}):null}const $t={name:"Name",slug:"URL slug",parent_id:"Parent",content:"Content changed"};function je(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Fe(t){return t==null||t===""}function ds(t,n){return Qe(t??null)===Qe(n??null)}function cs(t){return!!(t?.type==="array"&&(t.items?.type==="object"||t.items?.properties))}function us(t){return!!(t&&(t.type==="object"||t.properties)&&t.type!=="array")}function et(t,n){return Yn({key:t,prop:n??{}})}function ms(t,n){return t?.properties?.[n]}function Ge(t,n,s,r,a){if(ds(n,s))return;const o=i=>Array.isArray(i)?i:[];if((Array.isArray(n)||Fe(n))&&(Array.isArray(s)||Fe(s))&&(Array.isArray(n)||Array.isArray(s)||r?.type==="array")){const i=o(n),c=o(s);if(cs(r)||[...i,...c].some(f=>je(f))){const f=Math.min(i.length,c.length);for(let P=0;P<f;P++)Ge([...t,`item ${P+1}`],i[P],c[P],r?.items,a);const w=Math.max(0,c.length-i.length),q=Math.max(0,i.length-c.length);(w||q)&&a.push({kind:"items",path:t,added:w,removed:q});return}const m=f=>Qe(f),h=new Set(i.map(m)),N=new Set(c.map(m)),A=c.filter(f=>!h.has(m(f))),b=i.filter(f=>!N.has(m(f)));a.push(A.length||b.length?{kind:"values",path:t,added:A,removed:b,prop:r?.items}:{kind:"reordered",path:t});return}if((je(n)||Fe(n))&&(je(s)||Fe(s))&&(je(n)||je(s)||us(r))){const i=je(n)?n:{},c=je(s)?s:{},v=[...new Set([...Object.keys(r?.properties??{}),...Object.keys(i),...Object.keys(c)])];for(const m of v){const h=ms(r,m);Ge([...t,et(m,h)],i[m],c[m],h,a)}return}a.push({kind:"set",path:t,old:n,new:s,prop:r})}function ps(t,n){const s=$t[t.field];if(s)return t.field==="content"?[{kind:"note",path:[s]}]:t.field==="parent_id"?[{kind:"parent",path:[s],old:t.old,new:t.new}]:[{kind:"set",path:[s],old:t.old,new:t.new}];const r=n?.properties?.[t.field],a=[];return Ge([et(t.field,r)],t.old,t.new,r,a),a}function xs(t,n){const s=n?.properties;return t.map(r=>r.field==="content"?"Content":$t[r.field]??et(r.field,s?.[r.field]))}const hs="entity.updated",fs=new Set(["link","unlink","update_link"]);function ct(t){const n=typeof t=="string"||typeof t=="number"?Number(t):Number.NaN;return Number.isSafeInteger(n)&&n>0?n:null}function gs(t){const n=t.split("_").join(" ").trim();return n?`${n.charAt(0).toUpperCase()}${n.slice(1)}`:t}function ys(t){const n=t.metadata;if(t.semantic_type!=="change"||!n||n._lobu_relationship_change!==!0||typeof n.op!="string"||!fs.has(n.op))return null;const s=ct(n.fromEntityId),r=ct(n.toEntityId);if(s==null||r==null)return null;const a=typeof n.relationshipTypeSlug=="string"?n.relationshipTypeSlug:null,o=Array.isArray(n.changes)?n.changes:[];return{op:n.op,fromId:s,toId:r,typeLabel:a?gs(a):"relationship",changedFields:o.flatMap(l=>l&&typeof l=="object"&&typeof l.field=="string"?[l.field]:[])}}function Me({id:t,recordId:n,ownerSlug:s}){const r=t===n,a={slug:s},{data:o,isLoading:l,isError:p}=jt(r?void 0:t,a);return r?e.jsx(We,{peer:{id:t,name:"this record",type:null,self:!0},ownerSlug:s,orgContext:a}):l?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Record #",t]}):p||!o?e.jsx("span",{className:"text-xs text-muted-foreground",title:"Deleted, or you do not have access to it",children:"Unavailable record"}):e.jsx(We,{peer:{id:t,name:o.name,type:o.entity_type},ownerSlug:s,orgContext:a})}function js({change:t,recordId:n,ownerSlug:s}){const r=t.op==="link"?`Linked as ${t.typeLabel}`:t.op==="unlink"?`Unlinked ${t.typeLabel}`:`Updated ${t.typeLabel} link`,a=n===t.toId&&n!==t.fromId,o=n===t.fromId;return e.jsxs("span",{"data-testid":"relationship-change",className:"inline-flex flex-wrap items-center gap-1.5",children:[!o&&!a?e.jsx(Me,{id:t.fromId,ownerSlug:s}):null,e.jsx("span",{children:a?`${r} from`:r}),a?e.jsx(Me,{id:t.fromId,recordId:n,ownerSlug:s}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsx(Me,{id:t.toId,recordId:n,ownerSlug:s})]}),t.op==="update_link"&&t.changedFields.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",t.changedFields.join(", ")]}):null]})}function vs(t){if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const s of t){if(!s||typeof s!="object"||typeof s.field!="string")return null;const{field:r,old:a,new:o}=s;n.push({field:r,old:a??null,new:o??null})}return n}function Ns(t){const n=ys(t);if(n)return{kind:"relationship",change:n};const s=t.metadata;if(t.semantic_type!=="change"||!s)return null;const r=s._lobu_event_type;if(r!==hs&&(r!==void 0||s.category))return null;const a=vs(s.changes);if(!a)return null;const o=t.entity_ids?.[0];return{kind:"fields",entityId:typeof o=="number"?o:null,changes:a}}function Pt(t,n){const s={slug:n},{data:r}=jt(t.entityType?void 0:t.entityId??void 0,s),{data:a}=Yt(t.entityType??r?.entity_type??"",s);return a?.metadata_schema}const _s=4;function Oe({value:t,prop:n}){return e.jsx("span",{className:"inline-block max-w-[18rem] truncate align-bottom",title:typeof t=="string"?t:void 0,children:e.jsx(Xn,{value:t,prop:n,empty:e.jsx("span",{className:"italic",children:"empty"})})})}function ut({id:t,ownerSlug:n}){const s=typeof t=="number"||typeof t=="string"?Number(t):Number.NaN;return Number.isSafeInteger(s)&&s>0?e.jsx(Me,{id:s,ownerSlug:n}):e.jsx("span",{className:"italic text-muted-foreground",children:"empty"})}function Ye(t,n){return`${t} ${n}${t===1?"":"s"}`}function bs({line:t,ownerSlug:n}){const s=e.jsx("span",{className:"text-muted-foreground",children:t.path.join(" · ")});switch(t.kind){case"note":return s;case"set":return e.jsxs(e.Fragment,{children:[s,": ",e.jsx(Oe,{value:t.old,prop:t.prop})," ",e.jsx("span",{"aria-hidden":"true",children:"→"})," ",e.jsx(Oe,{value:t.new,prop:t.prop})]});case"parent":return e.jsxs(e.Fragment,{children:[s,": ",e.jsx(ut,{id:t.old,ownerSlug:n})," ",e.jsx("span",{"aria-hidden":"true",children:"→"})," ",e.jsx(ut,{id:t.new,ownerSlug:n})]});case"items":return e.jsxs(e.Fragment,{children:[s,":"," ",[t.added?`${Ye(t.added,"item")} added`:null,t.removed?`${Ye(t.removed,"item")} removed`:null].filter(Boolean).join(", ")]});case"values":return e.jsxs(e.Fragment,{children:[s,":",t.added.map((r,a)=>e.jsxs("span",{className:"ml-1.5",children:["+",e.jsx(Oe,{value:r,prop:t.prop})]},`+${a}`)),t.removed.map((r,a)=>e.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["−",e.jsx(Oe,{value:r,prop:t.prop})]},`-${a}`))]});case"reordered":return e.jsxs(e.Fragment,{children:[s,": reordered"]})}}function ws({change:t,ownerSlug:n}){const s=Pt(t,n);return e.jsxs(e.Fragment,{children:["Updated ",xs(t.changes,s).join(", ")]})}function tt({changes:t,entityId:n,entityType:s,ownerSlug:r,showAll:a=!1}){const o=Pt({entityId:n,entityType:s},r),[l,p]=_.useState(a),i=t.flatMap(m=>ps(m,o)),c=l?i:i.slice(0,_s),v=i.length-c.length;return e.jsxs("ul",{"data-testid":"field-changes",className:"space-y-0.5 text-sm",children:[c.map((m,h)=>e.jsx("li",{className:"min-w-0 truncate",children:e.jsx(bs,{line:m,ownerSlug:r})},h)),v>0?e.jsx("li",{children:e.jsxs("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:m=>{m.stopPropagation(),p(!0)},children:["+",Ye(v,"more change")]})}):null]})}function ks({event:t,recordId:n,ownerSlug:s}){return t.kind==="relationship"?e.jsx(js,{change:t.change,recordId:n,ownerSlug:s}):e.jsx(ws,{change:t,ownerSlug:s})}function Cs({event:t,ownerSlug:n}){return t.kind==="fields"?e.jsx(tt,{changes:t.changes,entityId:t.entityId,ownerSlug:n}):null}function Dt(t){return{audit:t.semantic_type==="audit"&&t.origin_type==="tool_invocation",operation:t.interaction_type==="approval"||t.semantic_type==="operation",changeSet:t.semantic_type==="change_set"}}const Ss={};function he(t){return t.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase())}const As={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function Is(t){return t.author_name?t.author_name:t.platform?he(t.platform):t.origin_type?As[t.origin_type]??he(t.origin_type):null}function Rs(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):Array.isArray(t)?t.length===0?"":t.every(n=>typeof n!="object")?t.map(n=>String(n)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(t,null,2)}):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(t,null,2)})}const Je=1e5;function mt({value:t}){const n=JSON.stringify(t,null,2)??"null",s=n.length>Je;return e.jsxs(e.Fragment,{children:[e.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,Je):n}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",Je.toLocaleString()," of"," ",n.length.toLocaleString()," characters."]})]})}function Es(t){return Object.entries(t).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 Ts({breakdown:t}){if(!t)return null;const n=[{label:"Engagement",value:t.engagement,max:100},{label:"Criticality",value:t.criticality,max:100},{label:"Depth",value:t.depth,max:100},{label:"Authority",value:t.authority,max:100},{label:"Recency",value:t.recency,max:100},{label:"Quality",value:t.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:n.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-muted-foreground",children:s.label}),e.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${s.value/s.max*100}%`}})}),e.jsx("span",{className:"w-8 text-right",children:s.value})]},s.label))})}function $s({slug:t,value:n,isManual:s}){return e.jsxs(xe,{variant:"secondary",className:"text-xs",children:[t,": ",n,s&&e.jsx(_t,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Ps(t){if(t&&typeof t=="object"){const n=t;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 t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?{values:[String(t)],isManual:!1}:{values:[],isManual:!1}}function Ft(t,n){if(t)switch(t){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return t}return n||"pending_approval"}function Xe(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Ds(t){return t.replace(/\s+[—-]\s+pending approval$/i,"")}function He(t){return t.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase())}function Ot(t,n,s){return t?.kind==="agent_session"&&t.agent_id?t.client_id?`${t.agent_id} via ${t.client_id}`:t.agent_id:t?.kind==="user"?"a person":n==="agent"?"an agent":s?`Automation ${s}`:"an Automation"}function Fs({ownerSlug:t,initiator:n,clientName:s,fallback:r}){const a=n?.client_id??s,{allOrgs:o,isAuthenticated:l}=Ct(),p=l&&o?.some(N=>N.slug===t),c=Kn(void 0,{ownerSlug:t,enabled:!!(a&&p)}).data?.find(N=>N.id===a)?.title,v=n&&n.kind!=="user"?Ot(n,void 0,n.automation_id===void 0?void 0:String(n.automation_id)):r,m="font-medium text-foreground",h=`${m} underline-offset-4 hover:underline`;return n?.kind==="automation"&&n.automation_id?e.jsx(ie,{to:"/$owner/automations/$automationId",params:{owner:t,automationId:String(n.automation_id)},search:{view:"definition",run_id:void 0},className:h,children:v}):n?.kind==="agent_session"&&n.agent_id?e.jsx(ie,{to:"/$owner/agents/$agentId",params:{owner:t,agentId:String(n.agent_id)},className:h,children:v}):a?e.jsxs(ie,{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:a},className:`${h} inline-flex items-center gap-1 align-middle`,children:[e.jsx(St,{name:c??s??a}),c??v]}):e.jsx("span",{className:m,children:v})}function Os(t){const n=Object.keys(t.fields),s=n.map(He).join(", ")||"field",r=n.length===1?"field":"fields";return`Update ${t.entityType?He(t.entityType).toLowerCase():"entity"} ${r}: ${s}`}function Ls(t,n){const s=Xe(n.fields);if(!s||Object.keys(s).length===0||n.action_key!=="entity_field_change"&&n.tool!=="entity_field_change")return null;const r=Xe(n.current)??{},a=t;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 Ms(t){const n=t.entityType?He(t.entityType).toLowerCase():"entity";return`${He(t.operation)} ${n}`}function Bs(t,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=t;return{operation:s,proposal:Xe(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 zs(t,n){return!n.entityType||!n.entitySlug?null:ht(t,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 Lt({ownerSlug:t,runId:n,details:s}){const a=At(s.automationId,void 0,void 0,{ownerSlug:t,includeVersions:!1}).data?.automation,o=Ot(s.initiator,s.attribution,s.automationId),l=a?.automation_name??s.automationName??o;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",s.automationId?e.jsx(ie,{to:"/$owner/automations/$automationId",params:{owner:t,automationId:s.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:l}):e.jsx("span",{className:"font-medium text-foreground",children:l}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(ie,{to:"/$owner/events",params:{owner:t},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",n]})]})]})}function Mt({ownerSlug:t,details:n}){const s=zs(t,n);return n.entityName?e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Entity"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:s?e.jsx(ie,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function Us({ownerSlug:t,runId:n,details:s}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Lt,{ownerSlug:t,runId:n,details:s}),e.jsx(Mt,{ownerSlug:t,details:s}),e.jsx("div",{className:"rounded-md border border-border/70 px-3 py-2",children:e.jsx(tt,{changes:Object.entries(s.fields).map(([r,a])=>({field:r,old:s.current[r]??null,new:a??null})),entityType:s.entityType,ownerSlug:t,showAll:!0})}),s.reason&&e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.reason})]})]})}function Hs({ownerSlug:t,runId:n,details:s,status:r}){const{operation:a}=s,o=a==="link"||a==="unlink";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Lt,{ownerSlug:t,runId:n,details:s}),!o&&e.jsx(Mt,{ownerSlug:t,details:s}),e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Change"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:o?Et(a,r):a==="create"?"Create a new entity after approval.":"Delete this entity after approval."}),o&&e.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[Rt(s.proposal).map((l,p)=>e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:p===0?"From: ":"To: "}),l.name]},l.id)),e.jsxs("div",{className:"text-muted-foreground",children:["Relationship:"," ",String(s.proposal?.relationship_type??s.proposal?.relationship_type_slug??"Relationship")]})]})]}),!o&&s.proposal&&e.jsxs("div",{className:"rounded-lg border border-border/70 p-3",children:[e.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Proposal"}),e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(s.proposal,null,2)})]}),s.proposerRationale&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.proposerRationale})]}),s.reason&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Why this needs approval"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.reason})]})]})}function Vs({summary:t}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[t.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.chips.map(n=>e.jsx(xe,{variant:"outline",className:"text-[10px] font-normal",children:n},n))}),t.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:t.message}),t.reason&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Why"}),e.jsx("div",{className:"mt-0.5 leading-relaxed",children:t.reason})]}),t.body&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:t.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:t.body})]}),t.matchPreview&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsxs("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Matched comment",t.matchAuthor?` · ${t.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:t.matchPreview})]}),t.postUrl&&e.jsxs("a",{href:t.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(kt,{className:"h-3 w-3"})]})]})}function qs({ownerSlug:t,content:n,batchReview:s}){const r=n.metadata||{},a=n.run_id??void 0,o=Ls(n,r),l=Bs(n,r),p=(o?Os(o):l?Ms(l):void 0)||r.operation_name||r.action_name||(n.title?Ds(n.title):void 0)||"Action",i=r.connection_name,c=r.operation_key||r.action_key||null,v=n.interaction_input_schema||r.input_schema||null,m=_.useMemo(()=>n.interaction_input||r.action_input||r.operation_input||Ss,[n.interaction_input,r.action_input,r.operation_input]),h=n.interaction_output||r.action_output||void 0,N=as(m,h??null,c),A=n.interaction_error||r.error_message||void 0,b=Ft(n.interaction_status,r.status),f=r.reviewed_by_name||r.reviewed_by_id||void 0,w=r.reject_reason||void 0,q=r.initiator,P=vn({slug:t}),D=Nn({slug:t}),E=_n(n.id,bn(v,m),v),{values:g,setValues:B}=E,[k,L]=_.useState(null),[x,Y]=_.useState(!1),[R,F]=_.useState(""),O=b==="pending_approval"&&k?k:b,I=O==="pending_approval",U=typeof r.source_run_id=="number";return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Nt,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:p}),i&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",i]}),O==="confirmed"&&e.jsx(xe,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:"Approved"}),O==="completed"&&e.jsx(xe,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),O==="failed"&&e.jsx(xe,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),O==="rejected"&&e.jsx(xe,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!o&&!l&&(n.author_name||f)&&e.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&&e.jsxs("span",{children:["Requested by"," ",e.jsx(Fs,{ownerSlug:t,initiator:q,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&f&&e.jsx("span",{children:"·"}),f&&e.jsxs("span",{children:[O==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:f})]})]}),o&&e.jsx(Us,{ownerSlug:t,runId:a,details:o}),!o&&l&&e.jsx(Hs,{ownerSlug:t,runId:a,details:l,status:O}),O==="rejected"&&w&&e.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Reason:"})," ",w]}),N&&e.jsx(Vs,{summary:N}),(I?E.revision:v)&&(I||Object.keys(m).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:N?"Full input":"Input"}),I?e.jsxs(e.Fragment,{children:[e.jsx(wn,{visible:E.hasConflict,onReload:E.reset}),e.jsx(kn,{schema:E.revision,values:g,onValuesChange:B,fieldIdPrefix:`action-${n.id}-`},`action-${n.id}`)]}):N?e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw input"}),e.jsx("pre",{className:"mt-1 bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}),O==="completed"&&h&&Object.keys(h).length>0&&!N&&e.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),"Output"]}),e.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap",children:JSON.stringify(h,null,2)})]}),O==="completed"&&h&&Object.keys(h).length>0&&N&&e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw output"}),e.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(h,null,2)})]}),O==="failed"&&A&&e.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[e.jsx(bt,{className:"h-3.5 w-3.5"}),"Error"]}),e.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:A})]}),I&&!k&&U&&e.jsxs("div",{className:"pt-1 text-xs text-muted-foreground",children:["Review this proposal with the other changes in its Automation run.",s]}),I&&a&&!k&&!U&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:x?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:R,onChange:ne=>F(ne.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs($,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>D.mutate({run_id:a,reason:R||void 0},{onSuccess:()=>{L("rejected")}}),disabled:D.isPending,children:[D.isPending&&e.jsx(Pe,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{Y(!1),F("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs($,{size:"sm",className:"h-7 text-xs",onClick:()=>P.mutate({run_id:a,input:Sn(g)},{onSuccess:()=>{L("confirmed")}}),disabled:!E.canSubmit||P.isPending||D.isPending,children:[P.isPending?e.jsx(Pe,{size:"sm",className:"mr-1"}):e.jsx(Cn,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>Y(!0),disabled:P.isPending||D.isPending,children:[e.jsx(An,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function Ks({content:t,ownerSlug:n}){const s=t.metadata||{},r=s.kind,a=t.run_id??null,o=typeof s.automation_id=="number"?s.automation_id:null,i=At(o!=null?String(o):void 0,void 0,void 0,{includeVersions:!1,ownerSlug:n}).data?.automation?.automation_name??(o!=null?`Automation ${o}`:"An Automation"),c=yn({slug:n}),v=jn({slug:n}),[m,h]=_.useState(!1),[N,A]=_.useState(""),[b,f]=_.useState(null);if(r==="automation_batch_reject"){const x=s.reason||void 0;return e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals rejected"}),x&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:x}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const w=Array.isArray(s.changes)?s.changes:[],q=typeof s.created_count=="number"?s.created_count:w.filter(x=>x.kind==="created").length,P=typeof s.updated_count=="number"?s.updated_count:w.filter(x=>x.kind==="updated").length,D=typeof s.denied_count=="number"?s.denied_count:w.filter(x=>x.kind==="denied").length,E=w.filter(x=>x.kind==="denied"),g=w.filter(x=>x.kind==="updated"&&Object.keys(x.applied||{}).length>0),B=typeof s.pending_proposal_count=="number"?s.pending_proposal_count:null,k=B==null||B>0,L=k?"proposed":"applied";return e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[L==="proposed"?"Proposed":"Applied"," ",q," ","new + ",P," updated",D>0&&e.jsxs(e.Fragment,{children:[" + ",D," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[o!=null?e.jsx(ie,{to:"/$owner/automations/$automationId",params:{owner:n,automationId:String(o)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:i}):e.jsx("span",{className:"font-medium text-foreground",children:i}),a!=null&&e.jsxs("span",{children:[" · run #",a]}),B!=null&&B>0&&e.jsxs("span",{children:[" · ",B," pending"]})]})]}),g.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:g.map(x=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:x.name}),e.jsx(tt,{changes:Object.entries(x.applied).map(([Y,R])=>({field:Y,old:R.old??null,new:R.new??null})),entityId:x.entityId,ownerSlug:n,showAll:!0})]},x.entityId))}),E.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:E.map(x=>e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-2.5 py-2",children:[e.jsxs("div",{className:"text-xs font-medium",children:[x.name," — not written"]}),x.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[x.denied.reason,e.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&&b==null&&k&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:m?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"What should the agent change?",value:N,onChange:x=>A(x.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs($,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>v.mutate({run_id:a,reason:N||void 0},{onSuccess:()=>f("rejected")}),disabled:v.isPending,children:[v.isPending&&e.jsx(Pe,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{h(!1),A("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{size:"sm",className:"h-7 text-xs",onClick:()=>c.mutate({run_id:a},{onSuccess:()=>f("approved")}),disabled:c.isPending||v.isPending,children:[c.isPending&&e.jsx(Pe,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx($,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>h(!0),disabled:c.isPending||v.isPending,children:"Reject with feedback"})]})}),b==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),b==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),a!=null&&b==null&&!k&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function Te({presentation:t="summary",renderDetail:n,onFiltersChange:s,ownerSlug:r,content:a,isReply:o,showParentContext:l,connectorDefinitions:p,hideOriginator:i=!1,hideRunAction:c=!1,hideAttribution:v=!1,hideDetails:m=!1,recordId:h}){const[N,A]=_.useState(null),b=mn(),f=t==="detail",w=yt(),{currentOwner:q,allOrgs:P,isAuthenticated:D}=Ct(),E=r??q,g=E==="me"?null:E,B=_.useCallback(async y=>{if(!g){at.error("Open this event inside a workspace to interact with it.");return}const T=await ss(g,Number(a.id),y,crypto.randomUUID());return"event_id"in T&&at.success("Recorded"),T},[a.id,g]),k=a.payload_data??{},{audit:L,operation:x,changeSet:Y}=Dt(a),R=L&&(k.request!==void 0||k.request_status==="too_large"),F=L&&Array.isArray(k.sdk_call_trace)&&k.sdk_call_trace.length>0,O=E?it(E,Number(a.id)):null,I=!f&&D?(P??[]).find(y=>y.slug===g):void 0,U=I?{slug:I.slug,organizationId:I.id}:null,ne=ft(U??{slug:null,organizationId:null}),se=U?.slug??null,fe=_.useMemo(()=>se&&!L?gt(ne.data??[],a.semantic_type):[],[se,L,ne.data,a.semantic_type]),_e=pn(),re=is(a),oe=!!(!(x||Y||re)&&U&&fe.length>0),Q=!f&&!!O,le=xn(w?.item?.href.split(/[?#]/)[0]??""),ae=le?.owner===E&&le?.eventId===Number(a.id),X=(y,T,u)=>{w?w.open({href:y,title:T,...u==null?{}:{runId:u}}):b({to:y})},de=(y,T)=>{if(!g)return null;const u=`/${g}/events?run_ids=${y}`;return w?.item?.href===u?null:e.jsxs($,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>s?s({runIds:[y]}):X(u,"Run activity",y),title:s?"Filter by this run":"Open run activity",children:[e.jsx(gn,{className:"h-3.5 w-3.5"}),T]})},ce=a.run_id!=null&&(s||!(w&&g&&a.automation_id!=null))?de(a.run_id,s?"Run":"Open run"):null,H=hn(a),ue=a.automation_id,we=w&&g&&H!=null&&ue!=null?()=>w.open({href:`/${g}/automations/${ue}?run_id=${H}`,title:`${a.automation_name??`Automation ${ue}`} · Run #${H}`,runId:H}):void 0,ge=()=>{if(oe&&U&&g){const y=Number(a.id);ns(_e,U.slug,fe,y).catch(()=>null).then(T=>X(it(g,y,T?.key),a.title??"Event"));return}O&&X(O,a.title??"Event")},Z=y=>{const T=y.target;if(!(T instanceof Element))return!1;const u=T.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return u!==null&&u!==y.currentTarget},ee=y=>{Z(y)||ge()},ke=y=>{y.key!=="Enter"&&y.key!==" "||Z(y)||(y.preventDefault(),ge())},W=a.metadata?.source_run_id,me=Ns(a),pe=re?e.jsx(os,{content:a,detail:f}):f&&g?Y?e.jsx(Ks,{content:a,ownerSlug:g}):x?e.jsx(qs,{ownerSlug:g,content:a,batchReview:typeof W=="number"?de(W,"Review run"):null}):void 0:void 0,K=f&&n?n(pe):{content:pe,nativeHeading:pe!=null};return e.jsx("div",{className:Se(o?"border-l-2 border-l-muted pl-4":"",Q&&"cursor-pointer rounded-lg p-3 transition-colors hover:bg-accent/40",Q&&ae&&"bg-accent ring-1 ring-inset ring-primary/20"),...Q?{role:"button","aria-current":ae?"true":void 0,tabIndex:0,onClick:ee,onKeyDown:ke}:{},children:e.jsx(Ws,{primaryContent:K.content,nativeHeading:K.nativeHeading,heading:me&&g?e.jsx(ks,{event:me,recordId:h,ownerSlug:g}):void 0,body:me&&g?e.jsx(Cs,{event:me,ownerSlug:g}):void 0,detailLinks:K.links,headingAside:K.headingAside,hideDetails:m,onFiltersChange:s,presentation:t,content:a,ownerSlug:E??void 0,showParentContext:l,connectorDefinitions:p,onRenderedAction:g?B:void 0,runAction:c?null:ce,hideOriginator:i,hideAttribution:v,runId:H??a.run_id??null,onRunSelect:we,auditDetails:f&&(R||F)&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"request",label:"Request",available:R},{key:"calls",label:"SDK calls",available:F}].map(y=>y.available?e.jsxs($,{variant:"outline",size:"sm","aria-expanded":N===y.key,onClick:()=>A(T=>T===y.key?null:y.key),children:[N===y.key?e.jsx(ve,{className:"h-3.5 w-3.5"}):e.jsx(Ne,{className:"h-3.5 w-3.5"}),y.label]},y.key):null)}),N==="request"&&(k.request_status==="too_large"?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof k.request_bytes=="number"?` (${k.request_bytes.toLocaleString()} bytes).`:"."]}):e.jsx(mt,{value:k.request})),N==="calls"&&e.jsx(mt,{value:k.sdk_call_trace})]})})})}function Js(t,n){const s=t.payload_data??{},r=t.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 Ft(t.interaction_status,typeof r.status=="string"?r.status:void 0)}function Qs(t){return t==="pending_approval"?"Needs approval":t==="confirmed"?"Approved":t?he(t):null}function Ws({presentation:t,primaryContent:n,nativeHeading:s=!1,heading:r,body:a,detailLinks:o,headingAside:l,onFiltersChange:p,content:i,ownerSlug:c,showParentContext:v,connectorDefinitions:m,onRenderedAction:h,runAction:N,auditDetails:A,hideOriginator:b=!1,hideAttribution:f=!1,runId:w,onRunSelect:q,hideDetails:P=!1}){const[D,E]=_.useState(!1),g=i.metadata??{},B=typeof i.score=="number"&&Number.isFinite(i.score)?Math.round(i.score):"-",k=i.payload_type||"text",L=i.text_content||"",x=t==="summary",Y=t==null&&(k==="text"||k==="markdown")&&L.length>500,R=Y&&!D?`${L.slice(0,500)}...`:L,F=i.payload_data??{},O=Dt(i),{audit:I,operation:U,changeSet:ne}=O,se=Js(i,O),fe=Qs(se),_e=(I?It(F,F.tool_name):null)??(x&&I&&typeof F.tool_name=="string"?he(F.tool_name):i.title),re=I&&F.error&&typeof F.error=="object"?F.error.message:void 0,be=(typeof re=="string"?re:void 0)??i.interaction_error??(typeof g.error_message=="string"?g.error_message:void 0),oe=be||(I?"":L),[Q,le]=_.useState(t!=="summary"&&I&&n==null&&o==null),ae=I?F.duration_ms:g.duration_ms,X=typeof ae=="number"&&Number.isFinite(ae)&&ae>=0?ae:null,de=I&&typeof F.sdk_call_count=="number"&&Number.isSafeInteger(F.sdk_call_count)&&F.sdk_call_count>=0?F.sdk_call_count:null,ce=g.thumbnail_url||g.thumbnail,H=g.media_url,ue=x?[]:Es(g),we=Object.entries(i.classifications||{}).flatMap(([d,j])=>{const S=Ps(j);return S.values.map(J=>({slug:d,value:J,isManual:S.isManual}))}),ge=(()=>{const d=i.platform||(typeof g.platform=="string"?g.platform:null),j=i.connection_id!=null?i.connection_id:g.source_connection_id!=null?Number(g.source_connection_id):null;return{...i,platform:d,connection_id:j!=null&&Number.isFinite(j)?j:null}})(),Z=(()=>{const d=i.source_url??g.browser_url;if(typeof d!="string"||!URL.canParse(d))return null;const j=new URL(d);return j.protocol==="https:"||j.protocol==="http:"?j:null})(),ee=i.occurred_at?new Date(i.occurred_at):null,ke=I?vt:U?Nt:ne?Xt:i.semantic_type==="notification"?Zt:en,W=I?"SDK call":he(i.semantic_type||i.origin_type||"Event"),me=e.jsx(fn,{source:ge,connectorDefinitions:m,sourceUrl:Z,label:W,fallback:e.jsx(ke,{className:"h-4 w-4"})}),pe=ue.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:ue.map(([d,j])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:he(d)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:Rs(j)})]},d))}):null,K=a?e.jsx("div",{className:"mt-1",children:a}):x?oe?e.jsx("p",{className:Se("line-clamp-2 text-sm whitespace-pre-wrap",be&&"text-destructive"),children:oe.slice(0,320)}):null:e.jsxs(e.Fragment,{children:[i.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(d=>e.jsx(_t,{className:`h-4 w-4 ${d<=Number(i.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},d))}),ce&&e.jsx("a",{href:H||i.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:ce,alt:"",className:`rounded-md object-cover ${k==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(k){case"markdown":if(R)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(tn,{text:R})});break;case"json_template":{const d=i.payload_template;if(d?.root)return e.jsx(ls,{template:d,data:i.payload_data||{},onAction:n?void 0:h},`${c}:${i.id}`);if(R)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:R});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!ce&&H&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:H}),R&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:R})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[A,pe??(A?null:e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"}))]});default:if(R)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:R});break}return e.jsxs("div",{className:"space-y-3",children:[H&&!ce&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:H}),pe]})})()]}),y=n!=null||t==="detail"&&I,T=l!==void 0,u=y||o!=null;return _.useEffect(()=>{if(!T||!Q)return;const d=j=>{j.key==="Escape"&&(j.preventDefault(),le(!1))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[T,Q]),e.jsxs(e.Fragment,{children:[v&&i.parent_context&&e.jsxs("div",{className:"mb-3 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Replying to:"}),e.jsx("div",{className:"font-medium",children:i.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:i.parent_context.text_content})]}),e.jsxs("div",{className:Se("flex gap-3",t==="detail"&&"mb-5",T&&"relative"),children:[e.jsx(nn,{children:me}),e.jsxs("div",{className:"min-w-0 flex-1",children:[t==="detail"&&(()=>{const d={semanticTypes:[i.semantic_type],...typeof i.automation_id=="number"?{producedByAutomationId:i.automation_id}:{},...typeof i.run_id=="number"?{runIds:[i.run_id]}:{}},j={semantic_types:i.semantic_type,...typeof i.automation_id=="number"?{produced_by:String(i.automation_id)}:{},...typeof i.run_id=="number"?{run_ids:String(i.run_id)}:{}};return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[i.semantic_type?p?e.jsx("button",{type:"button",className:"hover:underline",title:`Show all ${W} events`,onClick:()=>p(d),children:W}):c?e.jsx(ie,{to:"/$owner/events",params:{owner:c},search:j,className:"hover:underline",title:`Show all ${W} events`,children:W}):e.jsx("span",{children:W}):e.jsx("span",{children:W}),ee&&e.jsx("time",{dateTime:ee.toISOString(),children:$e(ee)})]})})(),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[(r??_e)&&!s&&e.jsx("h4",{className:Se("min-w-0 font-medium",t==="detail"?"text-xl leading-snug":"line-clamp-2 text-sm"),children:r??_e}),t!=="detail"&&ee&&e.jsx(sn,{at:ee}),T&&e.jsxs("div",{className:"flex shrink-0 items-center gap-1 pt-0.5",children:[l,u&&e.jsxs($,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-muted-foreground hover:text-foreground","aria-expanded":Q,onClick:()=>le(d=>!d),children:["Details",Q?e.jsx(ve,{className:"h-3.5 w-3.5"}):e.jsx(Ne,{className:"h-3.5 w-3.5"})]})]})]}),x&&e.jsx("div",{className:"mt-1 text-muted-foreground",children:K}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[fe&&!s&&e.jsxs(xe,{variant:se==="failed"?"destructive":"secondary",className:"gap-1 text-xs",children:[se==="failed"?e.jsx(bt,{className:"h-3 w-3"}):se==="completed"?e.jsx(Ze,{className:"h-3 w-3"}):null,fe]}),de!=null&&e.jsxs("span",{children:[de," SDK ",de===1?"call":"calls"]}),X!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(wt,{className:"h-3 w-3"}),X<1e3?`${Math.round(X)}ms`:`${Number((X/1e3).toFixed(2))}s`]}),N,B==="-"||x&&(I||U||ne)?null:i.score_breakdown?e.jsxs(rn,{children:[e.jsx(an,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:B})})}),e.jsx(on,{className:"w-64",align:"end",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Score Breakdown"}),e.jsx(Ts,{breakdown:i.score_breakdown})]})})]}):null,Z&&e.jsxs(ln,{children:[e.jsx(dn,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1",asChild:!0,children:e.jsxs("a",{href:Z.href,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(kt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:x?"sr-only":void 0,children:"View original"})]})})}),e.jsx(cn,{children:"View original"})]})]}),c&&!f&&e.jsx(un,{owner:c,source:ge,connectorDefinitions:m,onFiltersChange:p,variant:"chips",className:"mt-2 text-xs",hideOriginator:b,runId:w,onRunSelect:q}),(i.author_name||!c)&&!(t==="detail"&&U)&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:i.author_name||Is(i)})]}),T&&Q&&u&&e.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:[o,y&&K]})]}),!x&&typeof re=="string"&&e.jsx("p",{className:"mb-2 text-sm whitespace-pre-wrap text-destructive",children:re}),n,!x&&!y&&K,(y||o!=null)&&l===void 0&&!(P&&n!=null)&&e.jsxs("details",{className:"mt-5 border-t pt-3",open:Q,onToggle:d=>le(d.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Details"}),Q&&e.jsxs("div",{className:"mt-3 space-y-3",children:[o,y&&K]})]}),Y&&e.jsx($,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>E(!D),children:D?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3 w-3 mr-1"})," Show more"]})}),we.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:we.map(d=>e.jsx($s,{slug:d.slug,value:d.value||"",isManual:d.isManual},d.slug))})]})}function Gs({toolName:t,count:n,titles:s=[],totalDurationMs:r,totalSdkCalls:a,newestAt:o,oldestAt:l,expanded:p,onToggle:i,children:c}){return e.jsx("div",{children:e.jsxs(Be,{open:p,children:[e.jsx("div",{className:"rounded-lg p-3",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{"aria-hidden":!0,className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",children:e.jsx(vt,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(ze,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:i,children:[e.jsxs("span",{className:"min-w-0 truncate font-medium text-foreground",children:[he(t)," × ",n]}),p?e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(Ne,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(Bt,{newestAt:o,oldestAt:l})]}),s.length>0&&e.jsx("p",{className:"mt-0.5 truncate text-sm text-muted-foreground",children:s.join(" · ")}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[e.jsxs(xe,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Ze,{className:"h-3 w-3"}),"Completed"]}),a!=null&&e.jsxs("span",{children:[a," SDK ",a===1?"call":"calls"]}),r!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(wt,{className:"h-3 w-3"}),Ys(r)]})]})]})]})}),e.jsx(Ue,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:c})]})})}function Ys(t){return t<1e3?`${Math.round(t)}ms`:`${Number((t/1e3).toFixed(2))}s`}function Bt({newestAt:t,oldestAt:n}){const s=pt(t),r=pt(n);return s!=null&&r!=null&&s.getTime()-r.getTime()>Xs&&r?e.jsxs("time",{dateTime:s.toISOString(),title:`${$e(r)} – ${$e(s)}`,className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:[Le(r,"HH:mm"),"–",Le(s,"HH:mm")]}):s?e.jsx("time",{dateTime:s.toISOString(),title:$e(s),className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:Le(s,"HH:mm")}):null}const Xs=300*1e3;function pt(t){if(t==null||t==="")return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:n}function Zs({organizationId:t,clientId:n,activityId:s,activityKind:r,callCount:a,newestAt:o,oldestAt:l,expanded:p,onToggle:i,children:c}){const{data:v=[]}=qn({limit:100,organizationId:t??null}),m=v.find(A=>A.activityId===s&&(n==null||A.clientId===n))??null,h=m?Jn(m):r==="session"?"MCP session":"Conversation",N=m?.clientName??null;return e.jsx("div",{children:e.jsxs(Be,{open:p,children:[e.jsx("div",{className:"rounded-lg border bg-muted/40 p-3",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-background",children:e.jsx(St,{name:N})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(ze,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:i,children:[e.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:h}),p?e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(Ne,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(Bt,{newestAt:o,oldestAt:l})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[`${a} ${a===1?"call":"calls"}`,N?` · ${N}`:null]})]})]})}),e.jsx(Ue,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:c})]})})}function er({groupByDate:t=!0}){return e.jsx("div",{role:"status","aria-label":"Loading activity","aria-busy":"true",children:e.jsxs("div",{"aria-hidden":"true",children:[t?e.jsx("div",{className:"px-3 pb-2",children:e.jsx(Re,{className:"h-4 w-28 rounded-none"})}):null,["first","second","third","fourth","fifth"].map(n=>e.jsxs("div",{className:"flex items-start gap-3 px-3 py-3",children:[e.jsx(Re,{className:"h-8 w-8 shrink-0 rounded-none"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsx(Re,{className:"h-4 w-3/5 max-w-sm rounded-none"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(Re,{className:"h-3 w-20 rounded-none"}),e.jsx(Re,{className:"h-3 w-12 rounded-none"})]})]})]},n))]})})}function xt(t){if(t==null||t==="")return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:Le(n,"d MMMM yyyy")}function tr({items:t,isLoading:n,emptyState:s,hasNextPage:r,isFetching:a,isFetchingNextPage:o,onLoadMore:l,autoLoadMore:p=!0,groupByDate:i=!0}){const c=Zn({onIntersect:l,enabled:p&&r&&!a});return n&&t.length===0?e.jsx(er,{groupByDate:i}):e.jsxs("div",{children:[t.length===0?s!==void 0?s:e.jsx(In,{icon:Rn,title:"Nothing here yet",description:"No events match this view."}):t.map((v,m)=>{const h=xt(v.occurredAt),N=m>0?xt(t[m-1].occurredAt):null;return e.jsxs(_.Fragment,{children:[i&&h&&h!==N&&e.jsx("p",{className:"px-3 pb-2 pt-4 text-xs text-muted-foreground first:pt-0",children:h}),e.jsx("div",{className:"mb-1",children:v.content})]},v.key)}),e.jsx("div",{ref:c,className:"h-1"}),o?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Pe,{size:"xl",className:"text-muted-foreground"})}):r&&e.jsx($,{size:"sm",variant:"outline",disabled:a,onClick:l,children:"Load more"})]})}function hr({presentation:t="summary",renderDetail:n,onFiltersChange:s,hideDetails:r=!1,organizationId:a,ownerSlug:o,entityId:l,filters:p,showEntityLinks:i=!1,hideOriginator:c=!1,emptyState:v,foldConsecutiveCalls:m=!1,groupByConversation:h=!1,groupByRun:N=!1,onRunSelect:A,runs:b,hideRunAction:f=!1,hideAttribution:w=!1,hiddenApprovalRunIds:q}){const{isAuthenticated:P,isReady:D}=En(),{isMember:E,isLoading:g}=Tn(),B=o==="me",k=!B&&D&&P&&E,L=!B&&D&&(!P||!g&&!E),{data:x=[]}=$n(D&&k?a:null),{data:Y=[]}=Pn(L?o:null),R=k?x:Y,F=Dn(D&&k?a:null,l,p,o),O=Fn(L?o:null,l,p),I=L?O:F,{data:U,isLoading:ne,error:se,fetchNextPage:fe,hasNextPage:_e,isFetchingNextPage:re}=I,be=_.useMemo(()=>U?.pages.flatMap(u=>u.content)??[],[U]),oe=_.useMemo(()=>{const u=On(be,{foldRunSatellites:!N}),d=u.map(V=>V.head),j=new Map(u.map(V=>[V.head.id,V])),S=Ln(d,{groupByRun:N}),J=Array.from(S.entries()).map(([V,M])=>{const G=M.root||M.replies[0],Ae=G?j.get(G.id):void 0;return{rootId:V,group:M,history:Ae?.history??[],runId:Ae?.runId??null}});return q?Mn(J,q):J},[be,N,q]),[Q,le]=_.useState(new Set),[ae,X]=_.useState(new Set),[de,ce]=_.useState(new Set),[H,ue]=_.useState(new Set),[we,ge]=_.useState(new Set),Z=(u,d)=>u(j=>{const S=new Set(j);return S.has(d)?S.delete(d):S.add(d),S}),ee=(u,d)=>d.some(j=>u.has(j)),ke=(u,d)=>u(j=>{const S=new Set(j),J=d.some(V=>S.has(V));for(const V of d)J?S.delete(V):S.add(V);return S}),W=m?Bn(oe):oe.map(u=>({kind:"single",node:u})),me=h?zn(W):W,pe=!B&&(!D||P&&g||k&&I.isPending);if(se)return e.jsx(Un,{label:"events"});const K=u=>{if(u.kind==="fold"){const{fold:C}=u,nt=C.nodes.map(Ie=>Ie.rootId),Ht=ee(ae,nt);return[{key:C.key,occurredAt:C.newestAt,content:e.jsx(Gs,{toolName:C.toolName,count:C.nodes.length,titles:[...new Set(C.nodes.flatMap(Ie=>{const Ce=Ie.group.root?.payload_data,st=It(Ce,Ce?.tool_name);return st?[st]:[]}))],totalDurationMs:C.totalDurationMs,totalSdkCalls:C.totalSdkCalls,newestAt:C.newestAt,oldestAt:C.oldestAt,expanded:Ht,onToggle:()=>ke(X,nt),children:C.nodes.map(Ie=>{const Ce=Ie.group.root;return Ce?e.jsx(Te,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:o,content:Ce,renderDetail:n,connectorDefinitions:R,hideOriginator:c,hideRunAction:f,hideAttribution:w,hideDetails:r},Ce.id):null})})}]}const{rootId:d,group:j,history:S,runId:J}=u.node,V=j.replies.length>0,M=Q.has(d),G=we.has(d),Ae=H.has(d),zt=j.replies.filter(C=>C.depth<=3),De=j.replies.filter(C=>C.depth>3),Ut=!j.root&&j.replies.length>0,te=j.root||j.replies[0];return te?[{key:d,occurredAt:te.occurred_at,content:e.jsxs(e.Fragment,{children:[i&&o&&te.entity_name&&te.entity_type&&te.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(ts,{ownerSlug:o,entity:{entityName:te.entity_name,entityType:te.entity_type,entitySlug:te.entity_slug}})}),e.jsx(Te,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:o,content:te,renderDetail:n,showParentContext:Ut&&!!te.parent_context,connectorDefinitions:R,hideOriginator:c,hideRunAction:f,hideAttribution:w,hideDetails:r}),S.length>0&&e.jsxs(Be,{open:Ae,children:[e.jsx(ze,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>Z(ue,d),children:[e.jsx(Vn,{className:"h-3.5 w-3.5"}),Ae?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Hide ",J!=null?`run #${J} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),J!=null?`Run #${J} · ${S.length===1?"1 earlier step":`${S.length} earlier steps`}`:S.length===1?"1 earlier state":`${S.length} earlier states`]})]})}),e.jsx(Ue,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:S.map(C=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(C.occurred_at).toISOString(),title:$e(C.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:ot(C.occurred_at)}),e.jsx(Te,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:o,content:C,connectorDefinitions:R,hideOriginator:c,hideRunAction:f,hideAttribution:w})]},C.id))})]}),V&&e.jsxs(Be,{open:M,children:[e.jsx(ze,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>Z(le,d),children:[e.jsx(Ve,{className:"h-3.5 w-3.5"}),M?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Hide ",j.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),"Show ",j.replies.length," replies"]})]})}),e.jsxs(Ue,{className:"space-y-2 mt-2",children:[zt.map(C=>e.jsx(Te,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:o,content:C,isReply:!0,connectorDefinitions:R,hideOriginator:c,hideRunAction:f,hideAttribution:w},C.id)),De.length>0&&e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>Z(ge,d),children:G?e.jsxs(e.Fragment,{children:["Hide ",De.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",De.length," nested replies"]})}),G&&De.map(C=>e.jsx(Te,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:o,content:C,isReply:!0,connectorDefinitions:R,hideOriginator:c,hideRunAction:f,hideAttribution:w},C.id))]})]})]})]})}]:[]},y=u=>{const d=u.nodes.length;return{key:u.key,occurredAt:u.newestAt,content:e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[A?e.jsxs($,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1 text-xs font-medium",onClick:()=>A(u.runId),title:`Open run #${u.runId} conversation`,children:[e.jsx(Ve,{className:"h-3.5 w-3.5"}),"Run #",u.runId]}):e.jsxs("span",{className:"inline-flex h-7 items-center gap-1 px-1 text-xs font-medium",children:[e.jsx(Ve,{className:"h-3.5 w-3.5"}),"Run #",u.runId]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.status!=null?`· ${he(u.status)} · `:"· ",d===1?"1 event":`${d} events`,u.newestAt!=null?` · ${ot(u.newestAt)}`:""]})]}),e.jsx("div",{className:"mt-2 space-y-2 border-l-2 border-l-muted pl-4",children:u.nodes.flatMap(j=>K({kind:"single",node:j}).map(S=>e.jsx(_.Fragment,{children:S.content},S.key)))})]})}},T=u=>{const{block:d}=u,j=d.entries.flatMap(M=>M.kind==="fold"?M.fold.nodes.map(G=>G.rootId):[M.node.rootId]),S=ee(de,j),J=d.entries.flatMap(M=>K(M).map(G=>({key:G.key,content:G.content})));if(J.length===0)return[];const V=d.entries.reduce((M,G)=>M+(G.kind==="fold"?G.fold.nodes.length:1),0);return[{key:d.key,occurredAt:d.newestAt,content:e.jsx(Zs,{organizationId:a,clientId:d.clientId,activityId:d.activityId,activityKind:d.activityKind,callCount:V,newestAt:d.newestAt,oldestAt:d.oldestAt,expanded:S,onToggle:()=>ke(ce,j),children:J.map(M=>e.jsx(_.Fragment,{children:M.content},M.key))})}]};return e.jsx(tr,{groupByDate:t==="summary",isLoading:ne||pe,emptyState:v,hasNextPage:!!_e,isFetching:I.isFetching,isFetchingNextPage:re,onLoadMore:()=>void fe(),items:N?Hn(oe,b).map(u=>"nodes"in u?y(u):K({kind:"single",node:u})[0]).filter(u=>u!=null):me.flatMap(u=>u.kind==="context"?T(u):K(u))})}export{hr as E,xr as R,er as a,tr as b,Ws as c,pr as d,cr as e,mr as r,It as t,ur as u};
|
|
2
|
-
//# sourceMappingURL=events-feed-C4VrjIc1.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{dB as O,j as e,B as h,T as g,r as m,dC as C,X as P,dD as k,dE as S,dF as z,h as B,dG as D,dH as F,dI as E,dJ as L,cR as $,cS as R,U as I,df as j,dK as _,dL as H,dM as N,dN as b,I as y,dO as Q}from"./index-JmEl29py.js";function w(s,t,n){return O(s,-t,n)}const M="w-72";function T({editor:s,close:t,header:n,footer:o}){const[r,a]=m.useState("");return e.jsxs(e.Fragment,{children:[n,s.kind==="list"?e.jsxs(D,{shouldFilter:!s.onQueryChange,children:[e.jsx(F,{autoFocus:!0,placeholder:s.searchPlaceholder,value:r,onValueChange:d=>{a(d),s.onQueryChange?.(d)}}),e.jsxs(E,{children:[e.jsx(L,{children:s.emptyText}),e.jsx($,{children:s.items(t,r)})]})]}):s.render(t),o]})}function U({chip:s,editor:t}){const[n,o]=m.useState(!1),r=s.onRemove!=null,a=[s.label,s.op,s.value].filter(Boolean).join(" "),d=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children: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})]}),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:n,onOpenChange:o,children:[e.jsxs("div",{"data-filter-chip":s.id,title:s.title,className:g("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":r?"bg-muted":"border-dashed bg-transparent",n&&"ring-1 ring-ring",!r&&"pr-1.5"),children:[l,r?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(P,{className:"h-3.5 w-3.5"})}):null]}),t?e.jsx(k,{align:"start",className:g("p-0",M,t.className),children:e.jsx(T,{editor:t,close:()=>o(!1),footer:r?e.jsx("div",{className:"border-t p-1",children:e.jsx(h,{variant:"ghost",size:"sm",className:"w-full justify-start text-destructive hover:text-destructive",onClick:()=>{o(!1),s.onRemove?.()},children:"Remove filter"})}):null})}):null]})}function A({fields:s}){const[t,n]=m.useState(!1),[o,r]=m.useState(),a=s.find(i=>i.key===o),d=[...new Set(s.map(i=>i.group??""))],l=()=>{n(!1),r(void 0)};return e.jsxs(C,{open:t,onOpenChange:i=>{n(i),i||r(void 0)},children:[e.jsx(S,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"h-8 gap-1.5 font-normal text-muted-foreground",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(k,{align:"start",className:g("p-0",M,a?.editor.className),children:a?e.jsx(T,{editor:a.editor,close:l,header:e.jsxs("div",{className:"flex items-center gap-1 border-b px-1 py-1 text-sm font-medium",children:[e.jsx(h,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Back to filters",onClick:()=>r(void 0),children:e.jsx(B,{className:"h-4 w-4"})}),a.label]})},a.key):e.jsxs(D,{children:[e.jsx(F,{autoFocus:!0,placeholder:"Filter by…"}),e.jsxs(E,{children:[e.jsx(L,{children:"No matching filter"}),d.map(i=>e.jsx($,{heading:i||void 0,children:s.filter(c=>(c.group??"")===i).map(c=>e.jsxs(R,{value:`${c.label} ${c.key}`,onSelect:()=>r(c.key),className:"gap-2",children:[c.icon?e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",children:c.icon}):null,c.label]},c.key))},i))]})]})})]})}function X({fields:s,chips:t,meta:n,actions:o,trailing:r,onClearAll:a,hasClearableState:d=!1,className:l,label:i="Filters"}){const c=s.filter(u=>u.inMenu!==!1),f=t.filter(u=>u.onRemove).length;return e.jsxs("div",{role:"search","aria-label":i,className:g("flex min-w-0 flex-wrap items-center gap-2",l),children:[t.map(u=>e.jsx(U,{chip:u,editor:u.editor??s.find(x=>x.key===(u.field??u.id))?.editor},u.id)),c.length>0?e.jsx(A,{fields:c}):null,o,e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[n?e.jsx("span",{className:"text-sm text-muted-foreground",children:n}):null,a&&(f>0||d)?e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground",onClick:a,children:"Clear all"}):null,r]})]})}function G({selected:s}){return e.jsx(_,{className:g("h-4 w-4 shrink-0",s?"opacity-100":"opacity-0")})}function Y({searchPlaceholder:s,emptyText:t="No options",options:n,selected:o,multiple:r=!1,onSelect:a}){return{kind:"list",searchPlaceholder:s,emptyText:t,items:d=>n.map(l=>{const i=o.includes(l.value);return e.jsxs(R,{value:`${l.label} ${l.keywords??l.value}`,onSelect:()=>{a(l.value),r||d()},className:"gap-2",children:[r?e.jsx(I,{checked:i,className:"mr-1"}):e.jsx(G,{selected:i}),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.value)})}}function Z([s,t],n,o){return s<=n?`≤ ${t}`:t>=o?`≥ ${s}`:`${s}–${t}`}function V({value:s,min:t,max:n,onApply:o,close:r}){const[a,d]=m.useState(String(s?.[0]??t)),[l,i]=m.useState(String(s?.[1]??n)),[c,f]=m.useState(),u=x=>{x.preventDefault();const p=Number(a),v=Number(l);if(!Number.isFinite(p)||!Number.isFinite(v)){f("Enter a number.");return}if(p<t||v>n){f(`Use values between ${t} and ${n}.`);return}if(p>v){f("The lower bound must not exceed the upper bound.");return}o([p,v]),r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:u,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:n,value:a,onChange:x=>d(x.target.value)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"to"}),e.jsx(y,{"aria-label":"To",type:"number",min:t,max:n,value:l,onChange:x=>i(x.target.value)})]}),c?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:c}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ee(s){return{kind:"custom",render:t=>e.jsx(V,{...s,close:t})}}const q=[{label:"Today",range:()=>[N(new Date),b(new Date)]},{label:"Last 7 days",range:()=>[N(w(new Date,6)),b(new Date)]},{label:"Last 30 days",range:()=>[N(w(new Date,29)),b(new Date)]},{label:"This month",range:()=>[Q(new Date),b(new Date)]}];function se([s,t]){return j(s,"yyyy-MM-dd")===j(t,"yyyy-MM-dd")?j(s,"LLL d, y"):`${j(s,"LLL d")} – ${j(t,"LLL d, y")}`}function J({value:s,onApply:t,close:n}){const[o,r]=m.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:q.map(a=>e.jsx(h,{variant:"ghost",size:"sm",className:"justify-start font-normal",onClick:()=>{t(a.range()),n()},children:a.label},a.label))}),e.jsx(H,{mode:"range",defaultMonth:o?.from,selected:o,onSelect:a=>{r(a),a?.from&&a.to&&a.from!==a.to&&(t([N(a.from),b(a.to)]),n())},numberOfMonths:1})]})}function te(s){return{kind:"custom",className:"w-auto",render:t=>e.jsx(J,{...s,close:t})}}function K({type:s,label:t,value:n,onApply:o,close:r}){const[a,d]=m.useState(n==null?"":String(n)),[l,i]=m.useState(),c=f=>{if(f.preventDefault(),s==="number"){const u=Number(a);if(a.trim()===""||!Number.isFinite(u)){i("Enter a number.");return}o(u)}else o(a);r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:c,children:[e.jsx(y,{autoFocus:!0,"aria-label":t,type:s,step:s==="number"?"any":void 0,value:a,onChange:f=>d(f.target.value),placeholder:"Enter a value…"}),l?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:l}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ae(s){return{kind:"custom",render:t=>e.jsx(K,{...s,close:t})}}export{X as F,G as S,Z as a,te as d,se as f,Y as o,ee as r,ae as v};
|
|
2
|
-
//# sourceMappingURL=filter-editors-oNjBX9a2.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{iX as t,j as n}from"./index-JmEl29py.js";import{a as i}from"./agents-workbench-D1YL3VAB.js";import"./agent-editor-form-C24p9LLg.js";import"./model-selector-BeFuFH7p.js";import"./proposal-review-shell-CmLy1MZf.js";import"./runs-B0zVYb-w.js";function d(){const{owner:o,agentId:r}=t.useParams(),e=t.useSearch();return n.jsx(i,{owner:o,agentId:r,tab:"identity",runId:e.run_id})}export{d as component};
|
|
2
|
-
//# sourceMappingURL=identity-BkK8ggdp.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{w as t,j as i}from"./index-JmEl29py.js";import{A as m}from"./activity-route-view-_G_lDz5K.js";import"./record-activity-Doeu5kPO.js";import"./filter-editors-oNjBX9a2.js";import"./connection-label-BobuYiAG.js";import"./runs-B0zVYb-w.js";import"./source-record-panels-BeAZeMLy.js";import"./events-feed-C4VrjIc1.js";import"./client-activity-scopes-CmK3DkSP.js";import"./client-rows-fFuxzFtE.js";import"./use-automations-DS3uz3pb.js";import"./json-diff-4sMmayDd.js";import"./index-wHFQv1aT.js";import"./copy-button-kcjg8Giw.js";import"./linked-record-peek-B0_B4PnF.js";import"./card-Cspo-4M6.js";import"./use-scroll-sentinel-BpQ70c28.js";import"./agent-loading-shells-jkf9DjdO.js";import"./member-scope-gate-Dit3MXBQ.js";import"./public-shell-ready-_awBxu2Y.js";function S(){const{owner:o}=t.useParams(),r=t.useSearch();return i.jsx(m,{owner:o,search:r,home:!0})}export{S as component};
|
|
2
|
-
//# sourceMappingURL=index-Bw5iV_J7.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{im as n,j as o,at as r}from"./index-JmEl29py.js";import{A as a}from"./agent-connect-pages-BryZas7Z.js";import"./agent-client-setup-list-BgyLhJCo.js";import"./copy-button-kcjg8Giw.js";import"./client-rows-fFuxzFtE.js";function g(){const{owner:t}=n.useParams();return o.jsx(r,{owner:t,children:({ownerSlug:e})=>o.jsx(a,{owner:e})})}export{g as component};
|
|
2
|
-
//# sourceMappingURL=index-C3dpyynY.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i_ as r,j as e}from"./index-JmEl29py.js";import{A as i}from"./agent-skills-route-BMZ3r1bP.js";import"./agent-skill-context-B9giw2u2.js";import"./core.esm-CoJ5Splc.js";import"./skill-editor-D_W3QlRz.js";import"./agent-subpage-shell-D49f-bzP.js";import"./agent-loading-shells-jkf9DjdO.js";import"./agent-card-controls-ColL5rdd.js";function l(){const{owner:t,agentId:o}=r.useParams();return e.jsx(i,{owner:t,agentId:o})}export{l as component};
|
|
2
|
-
//# sourceMappingURL=index-C3zAbslo.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{bk as t,j as p,bl as m}from"./index-JmEl29py.js";import{M as i}from"./memory-browse-page-DTlM_9MY.js";import"./public-shell-ready-_awBxu2Y.js";import"./schema-type-editor-panel-DcJqbCrU.js";import"./entity-type-page-BzMZttzh.js";import"./json-diff-4sMmayDd.js";import"./index-wHFQv1aT.js";import"./code-editor-C8FJbT2P.js";import"./linked-record-peek-B0_B4PnF.js";import"./card-Cspo-4M6.js";import"./entity-avatar-BZIa-7i5.js";import"./filter-editors-oNjBX9a2.js";import"./core.esm-CoJ5Splc.js";import"./view-param-filters-FuOZyjMg.js";import"./app-bridge-BCm4muqj.js";import"./member-scope-gate-Dit3MXBQ.js";function b(){const{owner:o,entityType:r}=t.useParams(),{create:e}=t.useSearch();return p.jsx(i,{ownerSlug:o,typeScope:m(r),create:e??!1})}export{b as component};
|
|
2
|
-
//# sourceMappingURL=index-CGKN_WN_.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{as as z,j as n,at as Y,au as Q,av as V,aw as H,ax as J,ay as Z,az as ee,aA as ne,r as D,aB as se,aC as G,B as W,q as oe,aD as ae,aE as te,aF as re,aG as ie,aH as ce,aI as de,aJ as le,aK as ue,aL as pe,aM as me,aN as U,aO as he,aP as fe,S as T,aQ as xe,L,aR as X,aS as q,aT as ve,aU as ge,aV as ye,aW as _e,aX as Ne,aY as je,Q as be,aZ as ke}from"./index-JmEl29py.js";function Le(){const{owner:a}=z.useParams(),{filter:c}=z.useSearch();return n.jsx(Y,{owner:a,children:r=>n.jsx(Ce,{ownerSlug:r.ownerSlug,organizationId:r.organizationId,isWorkspaceLoading:r.isWorkspaceLoading,requestedFilter:c})})}function Ce({ownerSlug:a,organizationId:c,isWorkspaceLoading:r,requestedFilter:m}){const{data:h=[],isLoading:d,isError:E,refetch:j}=Q(c??""),{data:y=[],isLoading:S,isError:K,refetch:R}=V(c??""),{data:b=[]}=H(c,{}),{data:k=[],isLoading:f,isError:C,refetch:O}=J(),{data:I=[]}=Z(),{data:P,isLoading:M,isError:s,refetch:t}=ee(),{data:x=[],isLoading:p,isError:w,refetch:v}=ne(),e=r||d||S||f||M||p,o=P?.sandboxes??[],i=D.useMemo(()=>x.filter(l=>se(l,a)),[x,a]);return E||K||C||s||w?n.jsx(G,{children:n.jsxs("div",{role:"alert",className:"space-y-2",children:[n.jsx("p",{children:"Could not load the connector inventory."}),n.jsx(W,{variant:"outline",size:"sm",onClick:()=>{Promise.all([j(),R(),O(),t(),v()])},children:"Retry"})]})}):n.jsx(G,{className:"flex flex-1 flex-col gap-6",children:n.jsx(Ie,{ownerSlug:a,isContentLoading:e,groups:h,installedDefs:y,authProfiles:b,inferenceProviders:k,inferenceCatalog:I,sandboxes:o,devices:i,requestedFilter:m})})}function Ie({ownerSlug:a,isContentLoading:c,groups:r,installedDefs:m,authProfiles:h,inferenceProviders:d,inferenceCatalog:E,sandboxes:j,devices:y,requestedFilter:S}){const K=oe(),R=S??"all",b=D.useMemo(()=>{const s=new Map(r.map(e=>[e.connector_key,e])),t=new Map;for(const e of m)t.set(e.key,e);for(const e of r)t.has(e.connector_key)||t.set(e.connector_key,{key:e.connector_key,name:e.connector_name??e.connector_key,description:null,version:"",auth_schema:null,feeds_schema:null,actions_schema:null,options_schema:null,status:"active",login_enabled:!1,favicon_domain:e.favicon_domain,facets:e.facets});const x=ae(d).filter((e,o,i)=>i.findIndex(l=>l.provider.kind===e.provider.kind)===o).map(e=>({connector:{...e.connector,key:`${te}${e.provider.kind}`,name:E.find(o=>o.slug===e.provider.kind)?.displayName??e.provider.kind},group:void 0,profileCounts:{env:0,oauth_app:0,oauth_account:0,browser_session:0},facets:e.facets,needsSetup:!1,provider:e.provider,sandbox:void 0,device:void 0,deviceFamily:void 0})),p=re(j).filter((e,o,i)=>i.findIndex(l=>l.sandbox.providerKind===e.sandbox.providerKind)===o).map(e=>({connector:{...e.connector,key:`${ie}${e.sandbox.providerKind}`,name:ce(e.sandbox.providerKind)},group:void 0,profileCounts:{env:0,oauth_app:0,oauth_account:0,browser_session:0},facets:e.facets,needsSetup:j.some(o=>o.providerKind===e.sandbox.providerKind&&!o.connected),provider:void 0,sandbox:e.sandbox,device:void 0,deviceFamily:void 0})),w=de(y,r,a).map(e=>({connector:e.connector,group:void 0,profileCounts:{env:0,oauth_app:0,oauth_account:0,browser_session:0},facets:e.facets,needsSetup:!1,isDevice:!0,provider:void 0,sandbox:void 0,device:e.device,deviceFamily:e}));return[...Array.from(t.values()).filter(e=>e.installed||(s.get(e.key)?.connection_count??0)>0).filter(e=>!le(e)).map(e=>{const o=s.get(e.key),i=ue(e.auth_schema),l=h.reduce((g,N)=>(N.connector_key!==e.key||(g[N.profile_kind]+=1),g),{env:0,oauth_app:0,oauth_account:0,browser_session:0}),A=pe(e,o),_=y.some(g=>g.connectors.some(N=>N.organization_slug===a&&N.connector_key===e.key)),$=we(e,o,i,l);return{connector:e,group:o,profileCounts:l,facets:A,needsSetup:$,isDevice:_,provider:void 0,sandbox:void 0,device:void 0,deviceFamily:void 0}}),...x,...p,...w].sort((e,o)=>e.needsSetup&&!o.needsSetup?-1:!e.needsSetup&&o.needsSetup?1:e.connector.name.localeCompare(o.connector.name))},[a,h,y,r,m,d,E,j]),k=D.useMemo(()=>{const s=me.filter(t=>t!=="all"&&b.some(x=>U(x,t)));return s.length>1?["all",...s]:[]},[b]),f=k.includes(R)?R:"all",C=D.useMemo(()=>b.filter(s=>U(s,f)),[b,f]),O=C.length,I=D.useMemo(()=>f==="all"?he(a,y,fe()):[],[f,a,y]),P=n.jsx(W,{asChild:!0,size:"sm",className:"h-8 shrink-0 text-xs",children:n.jsxs(L,{to:"/$owner/connectors/create",params:{owner:a},children:[n.jsx(ke,{className:"mr-1.5 h-3.5 w-3.5"}),"Add connector"]})});if(c)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:P}),n.jsx("div",{className:"overflow-hidden rounded-lg border",role:"status","aria-label":"Loading connectors",children:Array.from({length:6}).map((s,t)=>n.jsxs("div",{className:`flex items-center gap-3 px-3 py-2.5 ${t===5?"":"border-b"}`,children:[n.jsx(T,{className:"h-7 w-7 shrink-0 rounded-md"}),n.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[n.jsx(T,{className:"h-4 w-40"}),n.jsx(T,{className:"h-3 w-24"})]})]},t))})]});const M=s=>{K({to:"/$owner/connectors",params:{owner:a},search:t=>({...t,filter:s==="all"?void 0:s}),replace:!0})};return n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"What your agents can reach — data, tools, models, and runtimes."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:[k.map(s=>n.jsx(W,{type:"button",variant:f===s?"secondary":"ghost","aria-pressed":f===s,size:"sm",className:"h-7 px-2 text-xs",onClick:()=>M(s),children:xe[s]},s)),k.length===0&&C.length===0&&I.length>0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing connected yet — set up one of the apps below."}):null]}),n.jsx("div",{className:"ml-auto shrink-0",children:P})]}),I.length>0?n.jsx("div",{className:"grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-dashed bg-border sm:grid-cols-[repeat(auto-fit,minmax(10rem,1fr))]",children:I.map(s=>n.jsxs(L,{to:"/$owner/connectors/app/$appId",params:{owner:a,appId:s.id},title:s.tagline,className:"flex min-w-0 items-center gap-2 bg-background px-3 py-2.5 text-muted-foreground transition-colors last:odd:col-span-2 hover:bg-accent/50 hover:text-foreground sm:last:odd:col-span-1",children:[n.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground",children:s.icon}),n.jsx("span",{className:"truncate text-sm font-medium",children:s.name})]},s.id))}):null,C.length===0?k.length>0?n.jsx(X,{icon:q.connectors.icon,title:"No connectors match this filter",description:"Try another capability.",secondaryActionLabel:"Show all",secondaryOnAction:()=>M("all")}):I.length>0?null:n.jsx(X,{icon:q.connectors.icon,title:"No connectors yet",description:"Connect your first connector to this workspace."}):n.jsx("div",{className:"overflow-hidden rounded-lg border",children:C.map(({connector:s,group:t,facets:x,profileCounts:p,needsSetup:w,provider:v,sandbox:e,device:o,deviceFamily:i},l)=>{const A=new Map(m.map(u=>[u.key,u])),_=ve(s.key,A,{name:s.name,iconUrl:v?E.find(u=>u.slug===v.kind)?.iconUrl:void 0,faviconDomain:s.favicon_domain??t?.favicon_domain??(e?ge(e.providerKind):void 0)}),$=p.oauth_account+p.browser_session,g=t?.connection_count??0,N=o?`${i?.devices.length??1} ${o.platform==="chrome-extension"?i?.devices.length===1?"profile":"profiles":i?.devices.length===1?"device":"devices"} · ${i?.devices.filter(u=>u.online).length??0} online`:v?`${d.filter(u=>u.kind===v.kind).length} configured accounts`:e?`${j.filter(u=>u.providerKind===e.providerKind).length} instances`:[`${g} ${g===1?"connection":"connections"}`,$>0?`${$} ${$===1?"saved authorization":"saved authorizations"}`:null,p.oauth_app>0?`${p.oauth_app} OAuth app${p.oauth_app===1?"":"s"}`:null].filter(Boolean).join(" · "),F=Ee(l,O),B=n.jsxs(n.Fragment,{children:[o?n.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:n.jsx(ye,{platform:_e(o)})}):n.jsx(Ne,{icon:_.icon,iconUrl:_.iconUrl,name:_.name,faviconDomain:_.faviconDomain,className:"h-7 w-7 shrink-0 rounded-md text-[10px]"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:_.name}),n.jsx(je,{facets:x})]}),n.jsx("p",{className:"truncate text-xs text-muted-foreground",children:N})]}),w?n.jsx(be,{variant:"secondary",className:"shrink-0 text-[10px]",children:"Needs setup"}):null]});return i?.appId?n.jsx(L,{to:"/$owner/connectors/app/$appId",params:{owner:a,appId:i.appId},className:F,children:B},s.key):o?n.jsx(L,{to:"/$owner/connectors/device/$deviceId",params:{owner:a,deviceId:o.id},className:F,children:B},s.key):n.jsx(L,{to:"/$owner/connectors/$connectorKey",params:{owner:a,connectorKey:s.key},search:v||e?{instances:!0}:{},className:F,children:B},s.key)})})]})}function Ee(a,c){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${a===c-1?"":"border-b"}`}function we(a,c,r,m){if((c?.connection_count??0)>0)return!1;const h=r.some(d=>d.type==="none");return!!(!h&&r.some(d=>d.type==="oauth")&&m.oauth_app===0||!h&&r.some(d=>d.type==="env_keys")&&m.env===0||!h&&r.some(d=>d.type==="app_installation")&&!c||a.required_capability&&!c)}export{Le as component};
|
|
2
|
-
//# sourceMappingURL=index-CgRaCOzW.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ar as r,j as e}from"./index-JmEl29py.js";import{M as m}from"./memory-browse-page-DTlM_9MY.js";import"./public-shell-ready-_awBxu2Y.js";import"./schema-type-editor-panel-DcJqbCrU.js";import"./entity-type-page-BzMZttzh.js";import"./json-diff-4sMmayDd.js";import"./index-wHFQv1aT.js";import"./code-editor-C8FJbT2P.js";import"./linked-record-peek-B0_B4PnF.js";import"./card-Cspo-4M6.js";import"./entity-avatar-BZIa-7i5.js";import"./filter-editors-oNjBX9a2.js";import"./core.esm-CoJ5Splc.js";import"./view-param-filters-FuOZyjMg.js";import"./app-bridge-BCm4muqj.js";import"./member-scope-gate-Dit3MXBQ.js";function M(){const{owner:t}=r.useParams(),o=r.useSearch();return e.jsx(m,{ownerSlug:t,create:!1,createType:o.create_type==="true"})}export{M as component};
|
|
2
|
-
//# sourceMappingURL=index-DfIoxD5Q.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as x,j as n,B as p,b0 as T,b1 as C,a$ as S,aA as L,av as E,aR as N,b2 as R,aS as M,aT as I,L as j,b3 as D,b4 as P,b5 as B,b6 as O,aX as W,Q as v,b7 as z,b8 as U,b9 as F,ba as K,bb as H,bc as A,bd as G,be as Q,bf as X,at as Z}from"./index-JmEl29py.js";import{L as q}from"./list-skeleton-BafzvpOM.js";import{u as J,a as V}from"./use-automations-DS3uz3pb.js";import{c as Y}from"./cronstrue-CeUS_78Q.js";const ee=[{value:"all",label:"All"},{value:"event",label:"Event"},{value:"schedule",label:"Schedule"},{value:"manual",label:"Manual"}];function te({pending:e,onConfirm:t}){const[s,o]=x.useState(!1);return s?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(p,{type:"button",variant:"destructive",size:"sm",disabled:e,onClick:t,children:"Delete"}),n.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(!1),children:"Cancel"})]}):n.jsx(p,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive","aria-label":"Delete",onClick:()=>o(!0),children:n.jsx(T,{className:"h-4 w-4"})})}function ne(e){try{return Y.toString(e.trim(),{throwExceptionOnParseError:!0})}catch{return`On schedule ${e.trim()}`}}function se(e){return e.toLowerCase()==="github"?"GitHub":C(e)}function ae(e){return C(e.replace(/^\$/,""))}function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return"";const t=e;return typeof t.repository=="string"?` in ${t.repository}`:typeof t.channel_id=="string"?` in #${t.channel_id}`:typeof t.resource_ref=="string"?` for ${t.resource_ref}`:""}function re(e){return Array.isArray(e.triggers)?e.triggers.filter(t=>!!t&&typeof t=="object"):[]}function ie(e){if(e.kind==="schedule"&&typeof e.cron=="string")return ne(e.cron);if(e.kind==="event"&&e.source!=="workspace"&&typeof e.connector_key=="string"){const t=Array.isArray(e.event_types)?e.event_types.filter(o=>typeof o=="string"):[],s=t.length>0?t.join(" or "):"an event";return`${se(e.connector_key)} sends ${s}${oe(e.match)}`}if(e.kind==="event"&&e.source==="workspace"){const t=Array.isArray(e.event_types)?e.event_types.filter(l=>typeof l=="string"):[],s=t.length>0?t.join(" or "):"an event",o=typeof e.entity_type=="string"?` on ${ae(e.entity_type)}`:"";return`another Automation writes ${s}${o}`}return null}function le(e){return e.health==="degraded"?"error":"enabled"}function ce(e){const t=re(e),s=e.name?.trim()||"Untitled automation",o=t.some(r=>r.kind==="event"),l=t.some(r=>r.kind==="schedule"),m=o?"event":l?"schedule":"manual",u=t.map(ie).filter(r=>!!r);let d="When started manually";u.length===1?d=`When ${u[0]}`:u.length>1&&(d=`When ${u[0]}${u.slice(1).map(r=>`, or when ${r}`).join("")}`);const i=t.some(r=>r.kind==="event"&&r.output==="reply_to_source")?"source":"silent";return{key:`automation:${e.automation_id}`,kind:m,when:d,does:s,output:{destination:i},state:le(e),sortTime:e.next_run_at?Date.parse(e.next_run_at):null,automation:e}}const y={event:0,schedule:1,manual:2};function ue(e){return e.map(ce).sort((t,s)=>t.state!==s.state?t.state==="enabled"?-1:1:y[t.kind]!==y[s.kind]?y[t.kind]-y[s.kind]:t.sortTime!==s.sortTime?t.sortTime===null?1:s.sortTime===null?-1:t.sortTime-s.sortTime:t.when.localeCompare(s.when)||t.key.localeCompare(s.key))}const de={kind:"all",output:"any",state:"any"};function me(e,t){return e.filter(s=>(t.kind==="all"||s.kind===t.kind)&&(t.output==="any"||(t.output==="reply"?s.output.destination==="source":s.output.destination==="silent"))&&(t.state==="any"||(t.state==="active"?s.state==="enabled":s.state==="error")))}const w="bg-muted text-muted-foreground",fe={event:{label:"Event",icon:O},schedule:{label:"Schedule",icon:B},manual:{label:"Manual",icon:P}};function he({agentName:e,deviceLabel:t}){const s=t?{label:t,icon:F}:e?{label:e,icon:K}:{label:"Manual · any client",icon:H},{label:o,icon:l}=s;return n.jsxs(v,{variant:"secondary",className:w,children:[n.jsx(l,{className:"h-3 w-3"}),o]})}function xe({lastRunAt:e,nextRunAt:t}){const s=e?`Ran ${A(e)}`:t?`Next run ${A(t)}`:"Never run";return n.jsxs(v,{variant:"secondary",className:w,children:[n.jsx(G,{className:"h-3 w-3"}),s]})}function pe({count:e}){return e<=0?null:n.jsxs(v,{variant:"secondary",className:w,children:[n.jsx(Q,{className:"h-3 w-3"}),e," ",e===1?"client":"clients"]})}function ye(e){const t=Array.isArray(e.triggers)?e.triggers:[];for(const s of t)if(s&&typeof s=="object"&&s.kind==="event"&&s.source!=="workspace"&&typeof s.connector_key=="string")return s.connector_key;return null}function ve(e,t){return`flex items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-accent/50 ${e===t-1?"":"border-b"}`}function ge({automation:e,agentName:t,deviceLabel:s,connectorDisplay:o,owner:l,onRemove:m,removing:u,rowClass:d}){const i=e.automation,r=i.automation_id,g=fe[e.kind],b=i.entity_name&&i.entity_type?`${i.entity_name} · ${i.entity_type}`:null,f=[e.when,b].filter(Boolean).join(" — "),h=i.health==="degraded"?i.health_reasons?.[0]||"Needs attention":null;return n.jsxs("div",{className:d,children:[n.jsxs(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:r},search:{view:"activity",run_id:void 0},className:"flex min-w-0 flex-1 items-center gap-3",children:[o?n.jsx(W,{icon:o.icon,iconUrl:o.iconUrl,name:o.name,faviconDomain:o.faviconDomain,className:"h-7 w-7 shrink-0 rounded-md text-[10px]"}):n.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:n.jsx(g.icon,{className:"h-3.5 w-3.5 text-muted-foreground"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:e.does}),n.jsx(he,{agentName:t,deviceLabel:s}),n.jsx(xe,{lastRunAt:i.last_run_completed_at??i.last_fired_at??null,nextRunAt:i.next_run_at??null}),n.jsx(pe,{count:i.processing_client_count??0}),h?n.jsxs(v,{variant:"secondary",className:"max-w-full whitespace-normal bg-amber-500/10 text-left text-amber-700 dark:text-amber-400",children:[n.jsx(z,{className:"h-3 w-3 shrink-0"}),h]}):null]}),f?n.jsx("p",{className:"truncate text-xs text-muted-foreground",children:f}):null]})]}),n.jsx(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:r},search:{view:"definition",run_id:void 0},className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground","aria-label":"Edit",children:n.jsx(U,{className:"h-3.5 w-3.5"})}),n.jsx(te,{pending:u,onConfirm:m})]})}function be({owner:e,organizationId:t,isWorkspaceLoading:s}){const[o,l]=x.useState(de),m=J(t??void 0),{data:u=[]}=S({enabled:!!t}),{data:d=[]}=L(),{data:i=[]}=E(t),r=V(),g=x.useMemo(()=>{const a=new Map;for(const c of u)a.set(c.agentId,c.name);return a},[u]),b=x.useMemo(()=>{const a=new Map;for(const c of d)a.set(c.id,c.label||c.platform||c.id);return a},[d]),f=x.useMemo(()=>ue(m.data??[]),[m.data]),h=x.useMemo(()=>me(f,o),[f,o]),$=s||m.isLoading,k=n.jsx(p,{asChild:!0,size:"sm",className:"h-8 shrink-0 text-xs",children:n.jsxs(j,{to:"/$owner/automations/new",params:{owner:e},children:[n.jsx(D,{className:"mr-1.5 h-3.5 w-3.5"}),"New automation"]})});return $?n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:k}),n.jsx(q,{label:"Loading automations",actions:!0})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"What runs on its own — on a schedule, on an event, or when you ask."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[n.jsx("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:ee.map(a=>n.jsx(p,{type:"button",variant:o.kind===a.value?"secondary":"ghost","aria-pressed":o.kind===a.value,size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(c=>({...c,kind:a.value})),children:a.label},a.value))}),n.jsx("div",{className:"ml-auto shrink-0",children:k})]}),f.length===0?n.jsx(N,{icon:R,title:"No automations yet",description:"Automations act on their own — reply to a message, run a nightly summary, react to a ticket. Use New automation to create one."}):h.length===0?n.jsx(N,{icon:M.automations.icon,title:"No automations match this filter",description:"Try another trigger type.",secondaryActionLabel:"Show all",secondaryOnAction:()=>l(a=>({...a,kind:"all"}))}):n.jsx("div",{className:"overflow-hidden rounded-lg border",children:h.map((a,c)=>n.jsx(ge,{automation:a,agentName:a.automation.managed_agent_id?g.get(a.automation.managed_agent_id)??a.automation.managed_agent_id:null,deviceLabel:a.automation.device_worker_id?b.get(a.automation.device_worker_id)??a.automation.device_worker_id:null,connectorDisplay:(()=>{const _=ye(a.automation);return _?I(_,i):null})(),owner:e,rowClass:ve(c,h.length),removing:r.isPending,onRemove:()=>r.mutate(a.automation.automation_id)},a.key))})]})}function Ne(){const{owner:e}=X.useParams();return n.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-2.5 pb-8 lg:px-6",children:n.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:n.jsx(Z,{owner:e,children:t=>n.jsx("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col",children:n.jsx(be,{owner:t.ownerSlug,organizationId:t.organizationId,isWorkspaceLoading:t.isWorkspaceLoading})})})})})}export{Ne as component};
|
|
2
|
-
//# sourceMappingURL=index-DijuudSs.js.map
|