@lobu/runtime-server 20.0.0 → 20.0.1
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 +165 -15
- package/dist/component.json +1 -1
- package/dist/connectors/chat-automation-events.ts +33 -0
- package/dist/connectors/discord.ts +2 -0
- package/dist/connectors/gchat.ts +2 -0
- package/dist/connectors/google_drive.ts +210 -40
- package/dist/connectors/slack-automation-events.ts +0 -31
- package/dist/connectors/slack.ts +2 -2
- package/dist/connectors/teams.ts +2 -0
- package/dist/connectors/telegram.ts +2 -0
- package/dist/connectors/whatsapp.ts +2 -0
- package/dist/dependencies.bun.lock +4 -4
- package/dist/guest.bundle.js +13 -1
- package/dist/owletto/dist/apple-touch-icon.png +0 -0
- package/dist/owletto/dist/assets/{_-WVpKI9q9.js → _-BTmsEMQo.js} +2 -2
- package/dist/owletto/dist/assets/_-ea0K1u_g.js +1 -0
- package/dist/owletto/dist/assets/{_agentId-U2D1yGV_.js → _agentId-DON3NuNk.js} +1 -1
- package/dist/owletto/dist/assets/_agentId-qF8hi8Cf.js +1 -0
- package/dist/owletto/dist/assets/{_automationId-BggDSfkK.js → _automationId-Bprfhhg8.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-BalfcgLi.js → _connectorKey._connectionId-75LMK1pB.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey.index-IRfifXtO.js → _connectorKey.index-N0fJPz8N.js} +1 -1
- package/dist/owletto/dist/assets/{_conversationId-1GSbJquw.js → _conversationId-BY5q9MHG.js} +1 -1
- package/dist/owletto/dist/assets/{_deploymentId-DpMLDfMN.js → _deploymentId-DFh2d5Pm.js} +1 -1
- package/dist/owletto/dist/assets/_name-OY_X_Zm-.js +1 -0
- package/dist/owletto/dist/assets/{_owner-CZwj2Fc5.js → _owner-B92z-CVu.js} +1 -1
- package/dist/owletto/dist/assets/_skillKey-CeEE23_w.js +1 -0
- package/dist/owletto/dist/assets/{_slug-5SDJ_Zlr.js → _slug-CvHxtUEf.js} +1 -1
- package/dist/owletto/dist/assets/accept-invitation-CXSrxBJN.js +1 -0
- package/dist/owletto/dist/assets/activity-route-view-C9W2Ipni.js +1 -0
- package/dist/owletto/dist/assets/{agent-card-controls-Duh-6QNV.js → agent-card-controls-CLupkefQ.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-u6MIKBDe.js → agent-client-setup-list-DgFv4h0W.js} +1 -1
- package/dist/owletto/dist/assets/{agent-connect-pages-22bJIutE.js → agent-connect-pages-DT8R_qnj.js} +1 -1
- package/dist/owletto/dist/assets/{agent-editor-form-DIo7SWp4.js → agent-editor-form-ayUg3Ws1.js} +1 -1
- package/dist/owletto/dist/assets/{agent-guardrails-route-Duv7Rpd9.js → agent-guardrails-route-D-b6CIt2.js} +1 -1
- package/dist/owletto/dist/assets/{agent-loading-shells-D6mLqg3d.js → agent-loading-shells-DjMpSoub.js} +1 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-BuGatiEq.js +1 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DjPLOCBS.js → agent-skill-context-DKpIFmCh.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skills-route-CdCVU8ZJ.js → agent-skills-route-DqIMttMK.js} +1 -1
- package/dist/owletto/dist/assets/{agent-subpage-shell-BfomD6m2.js → agent-subpage-shell-Bojgj1uq.js} +1 -1
- package/dist/owletto/dist/assets/{agent-thread-COEinkFo.js → agent-thread-R8Pego9t.js} +2 -2
- package/dist/owletto/dist/assets/agents-C9x76gSX.js +1 -0
- package/dist/owletto/dist/assets/{agents-workbench-BuIaYVFK.js → agents-workbench-BojDv6gX.js} +1 -1
- package/dist/owletto/dist/assets/{app._appId-BULz-FRp.js → app._appId-DNNB5FaI.js} +1 -1
- package/dist/owletto/dist/assets/{automation-detail-content-Ck6YhKpX.js → automation-detail-content-CzqrHc4P.js} +1 -1
- package/dist/owletto/dist/assets/automations-C9x76gSX.js +1 -0
- package/dist/owletto/dist/assets/{calendar-BZSx-Jno.js → calendar-VAaxHxss.js} +1 -1
- package/dist/owletto/dist/assets/{callback-DTbt2OS1.js → callback-0VB9tUCF.js} +1 -1
- package/dist/owletto/dist/assets/{card-BsWGRkun.js → card-HMQT7vU5.js} +1 -1
- package/dist/owletto/dist/assets/{claim-6BXg-jBt.js → claim-C2-YTMw-.js} +1 -1
- package/dist/owletto/dist/assets/{clients-CJI4gT-V.js → clients-C0I3V7XE.js} +1 -1
- package/dist/owletto/dist/assets/{code-editor-C104Bzj2.js → code-editor-hOZHdlxM.js} +1 -1
- package/dist/owletto/dist/assets/connect-DSr_gD8x.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-CTamwGrw.js +1 -0
- package/dist/owletto/dist/assets/{connected._clientId-L6cpG1ip.js → connected._clientId-BFuU4-8j.js} +1 -1
- package/dist/owletto/dist/assets/{connection-CqXJ7EAc.js → connection-De_2AD46.js} +1 -1
- package/dist/owletto/dist/assets/{connection-feed-detail-DgZF0nux.js → connection-feed-detail-Cbn85fG9.js} +1 -1
- package/dist/owletto/dist/assets/{connector-provenance-DyEHCwrM.js → connector-provenance-B17-ze5S.js} +1 -1
- package/dist/owletto/dist/assets/{connectors-zM9Yv-LM.js → connectors-KnNED_-4.js} +1 -1
- package/dist/owletto/dist/assets/{consent-CvL2QShm.js → consent-BOYb4pNu.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-DUExfZp5.js → core.esm-COW6Pfy6.js} +1 -1
- package/dist/owletto/dist/assets/{create-BiERXyJD.js → create-BFpUZ_mU.js} +1 -1
- package/dist/owletto/dist/assets/create-CblXKFGZ.js +1 -0
- package/dist/owletto/dist/assets/create-ChUbSYvl.js +1 -0
- package/dist/owletto/dist/assets/create-automation-form-CRenA7Ix.js +1 -0
- package/dist/owletto/dist/assets/{create._connectorKey-DWUsdgk7.js → create._connectorKey-D4dIDQIQ.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-Bmga7mGH.js → cronstrue-BrlFh5Jy.js} +1 -1
- package/dist/owletto/dist/assets/deployments-DTFrUY7p.js +1 -0
- package/dist/owletto/dist/assets/{deployments-body-Cw9tB9-c.js → deployments-body-CXqfjLqj.js} +1 -1
- package/dist/owletto/dist/assets/{device-Dy4u9FiS.js → device-B0BBIdVx.js} +1 -1
- package/dist/owletto/dist/assets/{device-pin-tombstone-CmAxFq2z.js → device-pin-tombstone-BBYes4en.js} +1 -1
- package/dist/owletto/dist/assets/{device-rows-CVv5-okl.js → device-rows-E63OZ9Cp.js} +1 -1
- package/dist/owletto/dist/assets/{device._deviceId-DNKPNnE2.js → device._deviceId-JN0cUCGe.js} +1 -1
- package/dist/owletto/dist/assets/{entity-options-C5Mj2ZVk.js → entity-options-qan9-Ycm.js} +1 -1
- package/dist/owletto/dist/assets/{entity-page-BdTxty8B.js → entity-page-CozUOlVP.js} +1 -1
- package/dist/owletto/dist/assets/{entity-type-page-jhiER8wM.js → entity-type-page-xISySjVW.js} +1 -1
- package/dist/owletto/dist/assets/{events-feed-CEQj2uAu.js → events-feed-DmZ3Ig3X.js} +1 -1
- package/dist/owletto/dist/assets/{full-page-spinner-BSp5F0ls.js → full-page-spinner-Q_J5Wcop.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-BB9iOxE3.js +1 -0
- package/dist/owletto/dist/assets/identity-DYbfG4hU.js +1 -0
- package/dist/owletto/dist/assets/index-7d9B918E.js +1 -0
- package/dist/owletto/dist/assets/{index-C2YGEKPo.js → index-BKZMzuMS.js} +7 -7
- package/dist/owletto/dist/assets/index-BsDA0XzK.js +1 -0
- package/dist/owletto/dist/assets/{index-1D5YJuZt.js → index-BwN9pHNs.js} +1 -1
- package/dist/owletto/dist/assets/{index-DFD8r981.js → index-BwVojwkg.js} +1 -1
- package/dist/owletto/dist/assets/index-C4Lz_gB-.js +1 -0
- package/dist/owletto/dist/assets/{index-BO8P4P_v.js → index-C78ucWDF.js} +1 -1
- package/dist/owletto/dist/assets/{index-D6nIYLM-.js → index-C9Dtjaoi.js} +1 -1
- package/dist/owletto/dist/assets/{index-CKWRiFJL.js → index-CGx4og7r.js} +1 -1
- package/dist/owletto/dist/assets/index-CO65Rkad.js +1 -0
- package/dist/owletto/dist/assets/index-CT_kxGkR.js +1 -0
- package/dist/owletto/dist/assets/index-ChcQMdod.css +1 -0
- package/dist/owletto/dist/assets/index-CrKgNtiq.js +1 -0
- package/dist/owletto/dist/assets/{index-CLQ-2wO3.js → index-DLZbFRSM.js} +1 -1
- package/dist/owletto/dist/assets/index-DUIbfL6x.js +1 -0
- package/dist/owletto/dist/assets/{index-DtRraJyI.js → index-DmB-3GhU.js} +1 -1
- package/dist/owletto/dist/assets/{index-CyT-Rwip.js → index-pKfsEvLt.js} +1 -1
- package/dist/owletto/dist/assets/{json-diff-gsOHOgl7.js → json-diff-1FNS_wGA.js} +1 -1
- package/dist/owletto/dist/assets/{list-skeleton-Cs18bNnk.js → list-skeleton-B6gjzr8t.js} +1 -1
- package/dist/owletto/dist/assets/login-S9EGV_EA.js +1 -0
- package/dist/owletto/dist/assets/{logout-DKUiKENJ.js → logout-BOXPSr57.js} +1 -1
- package/dist/owletto/dist/assets/{member-scope-gate-g7uB6GYE.js → member-scope-gate-yGr4lrGD.js} +1 -1
- package/dist/owletto/dist/assets/{memory-browse-page-BUwnO2o2.js → memory-browse-page-5n3MvqdS.js} +2 -2
- package/dist/owletto/dist/assets/{model-selector-DfsEq1db.js → model-selector-9ZRlR7Sa.js} +1 -1
- package/dist/owletto/dist/assets/models-LOhfJ0sb.js +1 -0
- package/dist/owletto/dist/assets/{new-BWw3u5jE.js → new-BeZJOJgR.js} +1 -1
- package/dist/owletto/dist/assets/{new-CW9MfqPX.js → new-D4wlbvAZ.js} +1 -1
- package/dist/owletto/dist/assets/{new-BSo83s7P.js → new-Dxn1qrmS.js} +1 -1
- package/dist/owletto/dist/assets/{oauth-workspace-access-DM3uXXPM.js → oauth-workspace-access-DoE-9F42.js} +1 -1
- package/dist/owletto/dist/assets/{organization-DJtG7bUJ.js → organization-BezNEJK7.js} +1 -1
- package/dist/owletto/dist/assets/{permissions-DcYSiYWQ.js → permissions-GkKtC6a5.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-CLrF2OFP.js → proposal-review-shell-Bk9D_9YN.js} +1 -1
- package/dist/owletto/dist/assets/{recent-BAuh77AP.js → recent-BVvscz1V.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-BdAH16jE.js → renderer-CAyr3B3s.js} +2 -2
- package/dist/owletto/dist/assets/reset-password-atCMI5uQ.js +1 -0
- package/dist/owletto/dist/assets/{runs-tK0NlrM5.js → runs-CftQDTkq.js} +1 -1
- package/dist/owletto/dist/assets/runs-panel-BkRtr_C4.js +1 -0
- package/dist/owletto/dist/assets/{runs-table-BQACrHq5.js → runs-table-CWCl38L5.js} +1 -1
- package/dist/owletto/dist/assets/{schema-value-normalization-Dr5Osu6u.js → schema-value-normalization-C9Lm83-q.js} +1 -1
- package/dist/owletto/dist/assets/settings-BKMOjfYf.js +1 -0
- package/dist/owletto/dist/assets/{settings-D9ezdxp8.js → settings-CgTgofgd.js} +1 -1
- package/dist/owletto/dist/assets/skills-DWr8qR3U.js +1 -0
- package/dist/owletto/dist/assets/{switch-C1vQiKIo.js → switch-BOGbkDQb.js} +1 -1
- package/dist/owletto/dist/assets/{use-mention-search-CCqN_8wM.js → use-mention-search-C9ckRw0s.js} +2 -2
- package/dist/owletto/dist/favicon.ico +0 -0
- package/dist/owletto/dist/favicon.svg +5 -6
- package/dist/owletto/dist/fonts/dm-mono-latin-500-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/dm-sans-latin-400-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/dm-sans-latin-600-normal.woff2 +0 -0
- package/dist/owletto/dist/index.html +8 -8
- package/dist/owletto/dist/lobu-logo.svg +16 -0
- package/dist/server-main.bundle.mjs +2415 -1268
- package/npm-shrinkwrap.json +17 -17
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/index.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +4 -1
- package/vendor/connector-sdk/dist/reaction-sdk.d.ts +9 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +16 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +12 -3
- package/vendor/core/dist/contracts/worker/protocol.d.ts +9 -0
- package/vendor/core/dist/contracts/worker/protocol.js +10 -1
- package/vendor/core/dist/logger.js +4 -2
- package/vendor/core/package.json +1 -1
- package/dist/owletto/dist/assets/_-BjTOSrPW.js +0 -1
- package/dist/owletto/dist/assets/_agentId-E5FuvQ_W.js +0 -1
- package/dist/owletto/dist/assets/_name-Ca5sRv2h.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-BnDO8aEk.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-tMqF2W59.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-DSJj0TBg.js +0 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-QvA6xL8Q.js +0 -1
- package/dist/owletto/dist/assets/agents-DztpCplG.js +0 -1
- package/dist/owletto/dist/assets/automations-DztpCplG.js +0 -1
- package/dist/owletto/dist/assets/connect-9tegWawc.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-Dh6e0n6A.js +0 -1
- package/dist/owletto/dist/assets/create-BL_WcDoF.js +0 -1
- package/dist/owletto/dist/assets/create-Dyz5QbON.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-DCYFtK4q.js +0 -1
- package/dist/owletto/dist/assets/deployments-h8jIWEVy.js +0 -1
- package/dist/owletto/dist/assets/guardrails-DrOhJHr5.js +0 -1
- package/dist/owletto/dist/assets/identity-BTE8ZlL9.js +0 -1
- package/dist/owletto/dist/assets/index-Be4XiWxU.js +0 -1
- package/dist/owletto/dist/assets/index-CPqabIYs.css +0 -1
- package/dist/owletto/dist/assets/index-CS1UPepo.js +0 -1
- package/dist/owletto/dist/assets/index-DGinfBZr.js +0 -1
- package/dist/owletto/dist/assets/index-DJs1EEbu.js +0 -1
- package/dist/owletto/dist/assets/index-DZb_utnT.js +0 -1
- package/dist/owletto/dist/assets/index-RH7aiqHs.js +0 -1
- package/dist/owletto/dist/assets/index-xwlLZWva.js +0 -1
- package/dist/owletto/dist/assets/login-B3RTCs3p.js +0 -1
- package/dist/owletto/dist/assets/models-CZZt4VcZ.js +0 -1
- package/dist/owletto/dist/assets/reset-password-DjgDJAYG.js +0 -1
- package/dist/owletto/dist/assets/runs-panel-Dqq-0G9H.js +0 -1
- package/dist/owletto/dist/assets/settings-DZifZxa5.js +0 -1
- package/dist/owletto/dist/assets/skills-CNtoLPU_.js +0 -1
- package/dist/owletto/dist/fonts/geist-pixel-square.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizBRFtNs2ka5fXjeivQ4LroWlx-6zUTjnTLgNs.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizBRFtNs2ka5fXjeivQ4LroWlx-6zsTjnTLgNuZ5w.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizHRFtNs2ka5fXjeivQ4LroWlx-6zAjgn7Motmp5r61.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizHRFtNs2ka5fXjeivQ4LroWlx-6zAjjH7Motmp5g.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD0OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD1OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD2OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD4OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD7OwGtT0rU.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD_OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-Cw2nSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-Cw6nSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwCnSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwOnSGjW7BA.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwenSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwynSGjW7BDEAQ.woff2 +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as N,j as e,L as B,dU as $e,cx as ve,an as Pe,ag as Oe,eJ as Ie,J as De,a1 as Fe,aD as le,t as Me,af as J,z as Le,ci as ze,cj as Be,B as k,ck as Ue,dl as qe,dm as He,E as Ne,dn as Je,eK as be,eL as ae,cP as oe,eM as Ve,aj as We,bM as Y,G as _e,eN as Ke,eO as Qe,s as K,eP as Ge,eQ as Ye,k as Xe,eR as Ze,bE as et,F as tt,en as nt,cs as st,eS as rt,aO as it,eT as at,X as ot,bP as lt,Y as dt,dI as ct,dJ as ut,dQ as mt,dR as pt,eU as xt,eV as ht,S as gt,c8 as ft,bm as yt,I as jt,dz as xe,dB as he,aW as vt,dC as ge,x as we,eW as ke,eX as Nt}from"./index-C2YGEKPo.js";import{u as bt}from"./clients-CJI4gT-V.js";import{J as _t}from"./renderer-BdAH16jE.js";function wt({onIntersect:n,enabled:t,rootMargin:s="400px"}){const r=N.useRef(null),a=N.useRef(n);return a.current=n,N.useEffect(()=>{const m=r.current;if(!m||!t)return;const y=new IntersectionObserver(o=>{o[0]?.isIntersecting&&a.current()},{rootMargin:s});return y.observe(m),()=>y.disconnect()},[t,s]),r}function kt(n,t){const s=t.parentEntityType&&t.parentEntitySlug?[{entity_type:t.parentEntityType,slug:t.parentEntitySlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}];return ve(n,s)}function Ct({ownerSlug:n,entity:t,className:s}){const r=kt(n,t);return e.jsxs(B,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${s??""}`,children:[e.jsx("span",{className:"font-medium",children:t.entityName}),e.jsx($e,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}async function St(n,t,s,r){const a=await Pe(`${Oe}/api/${encodeURIComponent(n)}/events/${t}/actions/${encodeURIComponent(s.action)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s.value,interaction_id:r})});return await Ie(a,"Could not record interaction"),a.json()}function w(n){if(typeof n!="string")return;const t=n.trim();return t.length>0?t:void 0}function de(n){return typeof n=="boolean"?n:void 0}function Rt(n,t,s){const r=(s??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||t?.prepared===!0||typeof t?.verified=="boolean"||w(t?.reason_preview)&&w(t?.message)||w(n?.body)&&(w(n?.post_url)||w(n?.activity_id)))}function At(n,t,s){if(!Rt(n,t,s))return null;const r=(s??"").toLowerCase(),a=w(t?.body)??w(n?.body),m=w(t?.reason_preview)??w(n?.reason),y=w(t?.post_url)??w(n?.post_url)??(w(n?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${w(n?.activity_id)}`:void 0),o=de(t?.prepared),x=de(t?.verified),p=de(t?.banner_shown),f=w(t?.message),d=t?.match&&typeof t.match=="object"?t.match:null,b=w(d?.text_preview),c=w(d?.author);let h="generic";r==="verify_staged_comment"||r.includes("verify")||typeof x=="boolean"?h="verify":(r==="prepare_comment"||r.includes("prepare")||o===!0||a&&y)&&(h="prepare");const g=[];return o===!0&&g.push("Staged — not posted"),o===!1&&g.push("Not staged"),x===!0&&g.push("Verified posted"),x===!1&&g.push("Not verified as posted"),p===!0&&g.push("In-page banner"),p===!1&&g.push("No banner"),{kind:h,message:f,reason:m,body:a,postUrl:y,prepared:o,bannerShown:p,verified:x,matchPreview:b,matchAuthor:c,chips:g}}const Tt={};function te(n){return n.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}const Et={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function $t(n){return n.author_name?n.author_name:n.platform?te(n.platform):n.origin_type?Et[n.origin_type]??te(n.origin_type):null}function fe(n){return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?String(n):Array.isArray(n)?n.length===0?"":n.every(t=>typeof t!="object")?n.map(t=>String(t)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(n,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(n,null,2)})}const ce=1e5;function Pt({value:n}){const t=JSON.stringify(n,null,2)??"null",s=t.length>ce;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?t.slice(0,ce):t}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",ce.toLocaleString()," of"," ",t.length.toLocaleString()," characters."]})]})}function Ot(n){return Object.entries(n).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0).sort(([t],[s])=>t.localeCompare(s))}function It({breakdown:n}){if(!n)return null;const t=[{label:"Engagement",value:n.engagement,max:100},{label:"Criticality",value:n.criticality,max:100},{label:"Depth",value:n.depth,max:100},{label:"Authority",value:n.authority,max:100},{label:"Recency",value:n.recency,max:100},{label:"Quality",value:n.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:t.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 Dt({slug:n,value:t,isManual:s}){return e.jsxs(J,{variant:"secondary",className:"text-xs",children:[n,": ",t,s&&e.jsx(be,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Ft(n){if(n&&typeof n=="object"){const t=n;if(Array.isArray(t.values))return{values:t.values.map(s=>String(s)).filter(s=>s.length>0),isManual:t.is_manual===!0};if(t.value!==void 0&&t.value!==null)return{values:[String(t.value)],isManual:t.is_manual===!0};if(typeof t.values=="string"&&t.values.length>0)return{values:[t.values],isManual:t.is_manual===!0}}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?{values:[String(n)],isManual:!1}:{values:[],isManual:!1}}function Mt(n,t){if(n)switch(n){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return n}return t||"pending_approval"}function O(n){return!n||typeof n!="object"||Array.isArray(n)?null:n}function ye(n){return n==null||n===""?"Not set":typeof n=="string"?n:JSON.stringify(n,null,2)}function Lt(n){return n.replace(/\s+[—-]\s+pending approval$/i,"")}function W(n){return n.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}function Ce(n,t,s){return n?.kind==="agent_session"&&n.agent_id?n.client_id?`${n.agent_id} via ${n.client_id}`:n.agent_id:n?.kind==="user"?"a person":t==="agent"?"an agent":s?`Automation ${s}`:"an Automation"}function zt({initiator:n,clientName:t,fallback:s}){const{org:r}=Y(),a=r?.slug,m=n?.client_id??t,o=bt(void 0,{enabled:!!(a&&m)}).data?.find(d=>d.id===m)?.title,x=n&&n.kind!=="user"?Ce(n,void 0,n.automation_id===void 0?void 0:String(n.automation_id)):s,p="font-medium text-foreground",f=`${p} underline-offset-4 hover:underline`;return a&&n?.kind==="automation"&&n.automation_id?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:String(n.automation_id)},search:{view:"definition",run_id:void 0},className:f,children:x}):a&&n?.kind==="agent_session"&&n.agent_id?e.jsx(B,{to:"/$owner/agents/$agentId",params:{owner:a,agentId:String(n.agent_id)},className:f,children:x}):a&&m?e.jsxs(B,{to:"/$owner/agents/connected/$clientId",params:{owner:a,clientId:m},className:`${f} inline-flex items-center gap-1 align-middle`,children:[e.jsx(lt,{name:o??t??m}),o??x]}):e.jsx("span",{className:p,children:x})}function Bt(n){const t=Object.keys(n.fields),s=t.map(W).join(", ")||"field",r=t.length===1?"field":"fields";return`Update ${n.entityType?W(n.entityType).toLowerCase():"entity"} ${r}: ${s}`}function Ut(n,t){const s=O(t.fields);if(!s||Object.keys(s).length===0||t.action_key!=="entity_field_change"&&t.tool!=="entity_field_change")return null;const r=O(t.current)??{},a=n;return{fields:s,current:r,reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??a.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function qt(n){return!n||!Array.isArray(n.evidence)?[]:n.evidence.flatMap(t=>{const s=O(t),r=s?.kind,a=s?.identifier;return typeof r=="string"&&typeof a=="string"?[{kind:r,identifier:a}]:[]})}function je(n){return Array.isArray(n)?n.flatMap(t=>{const s=O(t),r=s?.kind,a=s?.identifier;return typeof r=="string"&&typeof a=="string"?[{kind:r,identifier:a}]:[]}):[]}function Ht(n){const t=O(n?.evidence_change);if(t&&!(!Array.isArray(t.dropped)||!Array.isArray(t.gained)))return{dropped:je(t.dropped),gained:je(t.gained)}}function P(n){return typeof n=="string"?n:void 0}function Jt(n){const t=O(n.current),s=O(n.proposal),r=O(t?.winner),a=O(t?.loser),m=Array.isArray(t?.duplicates)?t.duplicates.map(O):[],o=(m.length>0?m:a?[a]:[]).flatMap(c=>{const h=P(c?.name),g=c?.id;return h&&(typeof g=="string"||typeof g=="number")?[{key:String(g),name:h,slug:P(c?.slug),entityType:P(c?.entity_type),parentSlug:P(c?.parent_slug),parentEntityType:P(c?.parent_entity_type)}]:[]}),x=Array.isArray(s?.entity_ids)?s.entity_ids:[],p=Array.isArray(s?.names)?s.names.flatMap((c,h)=>{const g=x[h];return typeof c=="string"&&(typeof g=="string"||typeof g=="number")?[{key:String(g),name:c}]:[]}):[],f=P(s?.name),d=s?.entity_id,b=o.length>0?o:p.length>0?p:f&&(typeof d=="string"||typeof d=="number")?[{key:String(d),name:f}]:[];return{winnerName:P(r?.name)??P(s?.winner_name),winnerSlug:P(r?.slug),winnerEntityType:P(r?.entity_type),winnerParentSlug:P(r?.parent_slug),winnerParentEntityType:P(r?.parent_entity_type),losers:b,matchEvidence:qt(s),evidenceChange:Ht(s)}}function Vt(n){const t=n.entityType?W(n.entityType).toLowerCase():"entity";if(n.operation==="merge"){const s=n.merge?.losers??[];return s.length>1?`Merge ${s.length} duplicate ${t}s`:`Merge duplicate ${t}`}return`${W(n.operation)} ${t}`}function Wt(n,t){if(t.action_key!=="entity_change"&&t.tool!=="entity_change")return null;const s=t.action;if(s!=="create"&&s!=="delete"&&s!=="merge")return null;const r=n;return{operation:s,merge:s==="merge"?Jt(t):void 0,proposal:O(t.proposal),current:O(t.current),reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,proposerRationale:typeof t.proposer_rationale=="string"?t.proposer_rationale:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function ue(n,t){return!n||!t.entityType||!t.entitySlug?null:ve(n,t.parentEntityType&&t.parentSlug?[{entity_type:t.parentEntityType,slug:t.parentSlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}])}function Se({runId:n,details:t}){const{org:s}=Y(),a=_e(t.automationId,void 0,s?.id,{includeVersions:!1}).data?.automation,m=Ce(t.initiator,t.attribution,t.automationId),y=a?.automation_name??t.automationName??m,o=s?.slug;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",o&&t.automationId?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:o,automationId:t.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:y}):e.jsx("span",{className:"font-medium text-foreground",children:y}),o&&n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(B,{to:"/$owner/events",params:{owner:o},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",n]})]})]})}function Re({details:n}){const{org:t}=Y(),s=ue(t?.slug,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(B,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function Ae({label:n,before:t,after:s}){return e.jsxs("div",{className:"rounded-md border border-border/70 overflow-hidden",children:[e.jsx("div",{className:"border-b border-border/70 px-3 py-2 text-xs font-medium",children:n}),e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Current"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ye(t)})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposed"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ye(s)})]})]})]})}function Kt({runId:n,details:t}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Se,{runId:n,details:t}),e.jsx(Re,{details:t}),Object.entries(t.fields).map(([s,r])=>e.jsx(Ae,{label:W(s),before:t.current[s],after:r},s)),t.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:t.reason})]})]})}function Qt({merge:n,status:t}){const{org:s}=Y(),r=ue(s?.slug,{entityType:n.winnerEntityType,entitySlug:n.winnerSlug,parentEntityType:n.winnerParentEntityType,parentSlug:n.winnerParentSlug}),a=n.losers.length,m=t==="rejected"||t==="failed",y=t==="completed";return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg border border-border/70 overflow-hidden",children:e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:m?"Would have kept":"Kept"}),e.jsx("div",{className:"text-sm font-medium leading-relaxed",children:n.winnerName?r?e.jsx(B,{to:r,className:"underline-offset-4 hover:underline",children:n.winnerName}):n.winnerName:e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:m?a>1?`Kept separate (${a})`:"Kept separate":y?a>1?`Merged away (${a})`:"Merged away":a>1?`To merge away (${a})`:"To merge away"}),e.jsx("div",{className:"space-y-0.5 text-sm leading-relaxed",children:a>0?n.losers.map(o=>{const x=ue(s?.slug,{entityType:o.entityType,entitySlug:o.slug,parentEntityType:o.parentEntityType,parentSlug:o.parentSlug}),p=y?"line-through decoration-muted-foreground/60":"";return e.jsx("div",{className:"break-words",children:x?e.jsx(B,{to:x,className:`${p} underline-offset-4 hover:underline`,children:o.name}):e.jsx("span",{className:p,children:o.name})},o.key)}):e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]})]})}),n.evidenceChange&&e.jsxs("div",{className:n.evidenceChange.dropped.length>0?"rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2":"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:n.evidenceChange.dropped.length>0?"What changed since you reviewed this":"Evidence re-checked"}),e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1",children:[n.evidenceChange.dropped.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-amber-700 dark:text-amber-400",children:"No longer proven"}),W(o.kind),": ",o.identifier]},`dropped-${o.kind}:${o.identifier}`)),n.evidenceChange.gained.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-emerald-700 dark:text-emerald-400",children:"Newly proven"}),W(o.kind),": ",o.identifier]},`gained-${o.kind}:${o.identifier}`)),n.evidenceChange.dropped.length===0&&n.evidenceChange.gained.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"The recorded match evidence did not change."})]})]}),n.matchEvidence.length>0&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Match evidence"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:n.matchEvidence.map(o=>e.jsxs(J,{variant:"outline",className:"text-[10px] font-normal",children:[W(o.kind),": ",o.identifier]},`${o.kind}:${o.identifier}`))})]})]})}function Gt({runId:n,details:t,status:s}){const r=t.operation==="merge";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Se,{runId:n,details:t}),r&&t.merge?e.jsx(Qt,{merge:t.merge,status:s}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{details:t}),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:"Change"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.operation==="create"?"Create a new entity after approval.":"Delete this entity after approval."})]})]}),!r&&t.proposal&&e.jsxs("div",{className:"rounded-md border border-border/70 p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposal"}),e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(t.proposal,null,2)})]}),t.proposerRationale&&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:t.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.proposerRationale})]}),t.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:r?"Why this needs approval":"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.reason})]})]})}function Yt({summary:n}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[n.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.chips.map(t=>e.jsx(J,{variant:"outline",className:"text-[10px] font-normal",children:t},t))}),n.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:n.message}),n.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:n.reason})]}),n.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:n.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:n.body})]}),n.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",n.matchAuthor?` · ${n.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:n.matchPreview})]}),n.postUrl&&e.jsxs("a",{href:n.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(Ne,{className:"h-3 w-3"})]})]})}function Xt({content:n}){const t=n.metadata||{},s=n.run_id??void 0,r=Ut(n,t),a=Wt(n,t),m=(r?Bt(r):a?Vt(a):void 0)||t.operation_name||t.action_name||(n.title?Lt(n.title):void 0)||"Action",y=t.connection_name,o=t.operation_key||t.action_key||null,x=n.interaction_input_schema||t.input_schema||null,p=N.useMemo(()=>n.interaction_input||t.action_input||t.operation_input||Tt,[n.interaction_input,t.action_input,t.operation_input]),f=n.interaction_output||t.action_output||void 0,d=At(p,f??null,o),b=n.interaction_error||t.error_message||void 0,c=Mt(n.interaction_status,t.status),h=t.reviewed_by_name||t.reviewed_by_id||void 0,g=t.reject_reason||void 0,R=t.initiator,D=Ge(),v=Ye(),A=Xe(n.id,Ze(x,p),x),{values:F,setValues:U}=A,[I,q]=N.useState(null),[_,M]=N.useState(!1),[E,l]=N.useState(""),S=c==="pending_approval",L=typeof t.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(et,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:m}),y&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",y]}),c==="confirmed"&&e.jsxs(J,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:[e.jsx(K,{size:"xs",className:"mr-1"}),"Executing"]}),c==="completed"&&e.jsx(J,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),c==="failed"&&e.jsx(J,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),c==="rejected"&&e.jsx(J,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!r&&!a&&(n.author_name||h)&&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(zt,{initiator:R,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&h&&e.jsx("span",{children:"·"}),h&&e.jsxs("span",{children:[c==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:h})]})]}),r&&e.jsx(Kt,{runId:s,details:r}),!r&&a&&e.jsx(Gt,{runId:s,details:a,status:c}),c==="rejected"&&g&&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:"})," ",g]}),d&&e.jsx(Yt,{summary:d}),(S?A.revision:x)&&(S||Object.keys(p).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:d?"Full input":"Input"}),S?e.jsxs(e.Fragment,{children:[e.jsx(tt,{visible:A.hasConflict,onReload:A.reset}),e.jsx(nt,{schema:A.revision,values:F,onValuesChange:U,fieldIdPrefix:`action-${n.id}-`},`action-${n.id}`)]}):d?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(p,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(p,null,2)})]}),c==="completed"&&f&&Object.keys(f).length>0&&!d&&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(st,{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(f,null,2)})]}),c==="completed"&&f&&Object.keys(f).length>0&&d&&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(f,null,2)})]}),c==="failed"&&b&&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(rt,{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:b})]}),I==="confirmed"&&e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-blue-700 dark:text-blue-400 font-medium",children:[e.jsx(K,{size:"md"}),"Confirmed — executing..."]}),e.jsx("p",{className:"text-xs text-blue-800 dark:text-blue-300 mt-1",children:"The worker will execute this action shortly. Redirecting..."})]}),I==="rejected"&&e.jsx(J,{variant:"outline",className:"text-muted-foreground text-xs",children:"Rejected — redirecting..."}),S&&!I&&L&&e.jsx("div",{className:"pt-1 text-xs text-muted-foreground",children:"Part of an Automation run — approve or reject it from the run's change-set above."}),S&&s&&!I&&!L&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:_?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:E,onChange:$=>l($.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>v.mutate({run_id:s,reason:E||void 0},{onSuccess:()=>{q("rejected")}}),disabled:v.isPending,children:[v.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{M(!1),l("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>D.mutate({run_id:s,input:at(F)},{onSuccess:()=>{q("confirmed")}}),disabled:!A.canSubmit||D.isPending||v.isPending,children:[D.isPending?e.jsx(K,{size:"sm",className:"mr-1"}):e.jsx(it,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>M(!0),disabled:D.isPending||v.isPending,children:[e.jsx(ot,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function Zt({content:n}){const t=n.metadata||{},s=t.kind,r=n.run_id??null,a=typeof t.automation_id=="number"?t.automation_id:null,{org:m}=Y(),y=m?.slug,p=_e(a!=null?String(a):void 0,void 0,m?.id,{includeVersions:!1}).data?.automation?.automation_name??(a!=null?`Automation ${a}`:"An Automation"),f=Ke(),d=Qe(),[b,c]=N.useState(!1),[h,g]=N.useState(""),[R,D]=N.useState(null);if(s==="automation_batch_reject"){const l=t.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"}),l&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:l}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const v=Array.isArray(t.changes)?t.changes:[],A=typeof t.created_count=="number"?t.created_count:v.filter(l=>l.kind==="created").length,F=typeof t.updated_count=="number"?t.updated_count:v.filter(l=>l.kind==="updated").length,U=typeof t.denied_count=="number"?t.denied_count:v.filter(l=>l.kind==="denied").length,I=v.filter(l=>l.kind==="denied"),q=v.filter(l=>l.kind==="updated"&&Object.keys(l.applied||{}).length>0),_=typeof t.pending_proposal_count=="number"?t.pending_proposal_count:null,M=_==null||_>0,E=M?"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:[E==="proposed"?"Proposed":"Applied"," ",A," ","new + ",F," updated",U>0&&e.jsxs(e.Fragment,{children:[" + ",U," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[y&&a!=null?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:y,automationId:String(a)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:p}):e.jsx("span",{className:"font-medium text-foreground",children:p}),r!=null&&e.jsxs("span",{children:[" · run #",r]}),_!=null&&_>0&&e.jsxs("span",{children:[" · ",_," pending"]})]})]}),q.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:q.map(l=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.name}),Object.entries(l.applied).map(([S,L])=>e.jsx(Ae,{label:S,before:L.old,after:L.new},S))]},l.entityId))}),I.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:I.map(l=>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:[l.name," — not written"]}),l.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[l.denied.reason,e.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",l.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${l.entityId}-${l.name}`))}),r!=null&&R==null&&M&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:b?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"What should the agent change?",value:h,onChange:l=>g(l.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>d.mutate({run_id:r,reason:h||void 0},{onSuccess:()=>D("rejected")}),disabled:d.isPending,children:[d.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{c(!1),g("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>f.mutate({run_id:r},{onSuccess:()=>D("approved")}),disabled:f.isPending||d.isPending,children:[f.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>c(!0),disabled:f.isPending||d.isPending,children:"Reject with feedback"})]})}),R==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),R==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),r!=null&&R==null&&!M&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function ie({ownerSlug:n,content:t,isReply:s,showParentContext:r,connectorDefinitions:a}){const[m,y]=N.useState(!1),[o,x]=N.useState(!1),p=De(),{currentOwner:f}=Fe(),d=n??f,b=d==="me"?null:d,c=N.useCallback(async i=>{if(!b){le.error("Open this event inside a workspace to interact with it.");return}try{await St(b,Number(t.id),i,crypto.randomUUID()),le.success("Recorded")}catch(u){le.error(u instanceof Error?u.message:"Could not record that interaction.")}},[t.id,b]),h=t.payload_data??{},g=t.semantic_type==="audit"&&t.origin_type==="tool_invocation",R=g&&(h.request!==void 0||h.request_status==="too_large"),v=g&&h.request_status==="complete"&&d?`/${d}/events?content_ids=${t.id}`:!d||d==="me"?null:t.run_id!=null?`/${d}/events?run_ids=${t.run_id}`:null,A=!!(p&&v&&Me(v)),F=()=>{!p||!v||p.open({href:v,title:t.title??(t.run_id!=null?`Run #${t.run_id}`:"Event"),runId:t.run_id??void 0})},U=i=>{const u=i.target;if(!(u instanceof Element))return!1;const j=u.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return j!==null&&j!==i.currentTarget},I=i=>{U(i)||F()},q=i=>{i.key!=="Enter"&&i.key!==" "||U(i)||(i.preventDefault(),F())},_=t.metadata||{};if(t.semantic_type==="change_set")return e.jsx(Zt,{content:t});if(t.interaction_type==="approval"||t.semantic_type==="operation"||_.status!=null||_.action_key!=null)return e.jsx(Xt,{content:t});const E=Number.isFinite(t.score)?Math.round(t.score):"-",l=t.payload_type||"text",S=t.text_content||"",L=(l==="text"||l==="markdown")&&S.length>500,$=L&&!m?`${S.slice(0,500)}...`:S,Q=_.thumbnail_url||_.thumbnail,H=_.media_url,G=Ot(_),ne=Object.entries(t.classifications||{}).flatMap(([i,u])=>{const j=Ft(u);return j.values.map(T=>({slug:i,value:T,isManual:j.isManual}))}),X=(()=>{const i=t.metadata??{},u=t.platform||(typeof i.platform=="string"?i.platform:null),j=t.connection_id!=null?t.connection_id:i.source_connection_id!=null?Number(i.source_connection_id):null;return{...t,platform:u,connection_id:j!=null&&Number.isFinite(j)?j:null}})();return e.jsxs("div",{className:We(s?"border-l-2 border-l-muted pl-4":"",A&&"-mx-2 cursor-pointer rounded-lg px-2 py-1 transition-colors hover:bg-accent/40"),...A?{role:"button",tabIndex:0,onClick:I,onKeyDown:q}:{},children:[r&&t.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:t.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:t.parent_context.text_content})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.title&&e.jsx("h4",{className:"font-medium line-clamp-2 mb-1",children:t.title}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(()=>{const i=$t(t),u=!!t.platform&&i!==te(t.platform);return e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"font-medium",children:i}),u&&e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{children:"·"}),e.jsx(J,{variant:"outline",className:"text-xs",children:t.platform})]})]})})()}),d?e.jsx(Le,{owner:d,source:X,connectorDefinitions:a,className:"mt-0.5 text-xs"}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.score_breakdown?e.jsxs(ze,{children:[e.jsx(Be,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:E})})}),e.jsx(Ue,{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(It,{breakdown:t.score_breakdown})]})})]}):e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",disabled:!0,children:e.jsx("span",{className:"font-medium",children:E})}),t.source_url&&e.jsxs(qe,{children:[e.jsx(He,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7",asChild:!0,children:e.jsx("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Ne,{className:"h-3.5 w-3.5"})})})}),e.jsx(Je,{children:"View original"})]})]})]}),t.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(i=>e.jsx(be,{className:`h-4 w-4 ${i<=Number(t.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},i))}),Q&&e.jsx("a",{href:H||t.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:Q,alt:"",className:`rounded-md object-cover ${l==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),t.excerpt&&e.jsx("div",{className:"text-sm italic text-muted-foreground border-l-2 border-primary/40 pl-2 mb-1",children:t.excerpt}),(()=>{switch(l){case"markdown":if($)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(Ve,{text:$})});break;case"json_template":{const i=t.payload_template;if(i?.root)return e.jsx(_t,{template:{root:i.root},data:t.payload_data||{},onAction:c,interactions:i.interactions});if($)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:$});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!Q&&H&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:H}),$&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:$})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[R&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{variant:"outline",size:"sm","aria-expanded":o,onClick:()=>x(i=>!i),children:[o?e.jsx(ae,{className:"h-3.5 w-3.5"}):e.jsx(oe,{className:"h-3.5 w-3.5"}),"Request"]}),o&&(h.request_status==="too_large"?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof h.request_bytes=="number"?` (${h.request_bytes.toLocaleString()} bytes).`:"."]}):e.jsx(Pt,{value:h.request}))]}),G.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:G.map(([i,u])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:te(i)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:fe(u)})]},i))}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"})]});default:if($)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:$});break}return e.jsxs("div",{className:"space-y-3",children:[H&&!Q&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:H}),G.length>0&&e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:G.map(([i,u])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:te(i)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:fe(u)})]},i))})]})})(),L&&e.jsx(k,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>y(!m),children:m?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3 w-3 mr-1"})," Show more"]})}),ne.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:ne.map(i=>e.jsx(Dt,{slug:i.slug,value:i.value||"",isManual:i.isManual},i.slug))})]})}function en({occurredAt:n,isLast:t,children:s}){return e.jsxs("div",{className:"relative flex gap-4 pb-6",children:[e.jsxs("div",{className:"relative flex w-2.5 shrink-0 justify-center",children:[!t&&e.jsx("div",{className:"absolute top-1 bottom-[-1.5rem] left-1/2 w-px -translate-x-1/2 bg-border","aria-hidden":!0}),e.jsx("div",{className:"relative z-10 mt-1 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground/60"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[n&&e.jsx("time",{dateTime:new Date(n).toISOString(),title:ke(n),className:"mb-1 block text-xs leading-none text-muted-foreground",children:we(n)}),s]})]})}function rn({organizationId:n,ownerSlug:t,entityId:s,filters:r,showEntityLinks:a=!1,emptyState:m,dense:y=!1}){const{isAuthenticated:o,isReady:x}=dt(),{isMember:p,isLoading:f}=Y(),d=t==="me",b=!d&&x&&o&&p,c=!d&&x&&(!o||!f&&!p),{data:h=[]}=ct(x&&b?n:null),{data:g=[]}=ut(c?t:null),R=b?h:g,D=mt(x&&b?n:null,s,r,t),v=pt(c?t:null,s,r),A=c?v:D,{data:F,isLoading:U,error:I,fetchNextPage:q,hasNextPage:_,isFetchingNextPage:M}=A,E=N.useMemo(()=>F?.pages.flatMap(i=>i.content)??[],[F]),l=wt({onIntersect:()=>q(),enabled:!!_&&!M}),S=N.useMemo(()=>{const i=xt(E),u=i.map(V=>V.head),j=new Map(i.map(V=>[V.head.id,V])),T=ht(u);return Array.from(T.entries()).map(([V,Z])=>{const se=Z.root||Z.replies[0],ee=se?j.get(se.id):void 0;return{rootId:V,group:Z,history:ee?.history??[],runId:ee?.runId??null}})},[E]),[L,$]=N.useState(new Set),[Q,H]=N.useState(new Set),[G,ne]=N.useState(new Set),X=(i,u)=>i(j=>{const T=new Set(j);return T.has(u)?T.delete(u):T.add(u),T});return U&&E.length===0?e.jsx("div",{className:"space-y-4",children:["s1","s2","s3"].map(i=>e.jsx(gt,{className:"h-32 rounded-lg"},i))}):I?e.jsx(ft,{label:"events"}):E.length===0?m??e.jsx(yt,{icon:jt,title:"Nothing here yet",description:"No events match this view."}):e.jsxs("div",{className:y?"":"pt-1",children:[S.map(({rootId:i,group:u,history:j,runId:T},V,Z)=>{const se=u.replies.length>0,ee=L.has(i),me=G.has(i),pe=Q.has(i),Te=u.replies.filter(C=>C.depth<=3),re=u.replies.filter(C=>C.depth>3),Ee=!u.root&&u.replies.length>0,z=u.root||u.replies[0];return z?e.jsxs(en,{occurredAt:z.occurred_at,isLast:V===Z.length-1,children:[a&&t&&z.entity_name&&z.entity_type&&z.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(Ct,{ownerSlug:t,entity:{entityName:z.entity_name,entityType:z.entity_type,entitySlug:z.entity_slug}})}),e.jsx(ie,{ownerSlug:t,content:z,showParentContext:Ee&&!!z.parent_context,connectorDefinitions:R}),j.length>0&&e.jsxs(xe,{open:pe,children:[e.jsx(he,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>X(H,i),children:[e.jsx(vt,{className:"h-3.5 w-3.5"}),pe?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Hide ",T!=null?`run #${T} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),T!=null?`Run #${T} · ${j.length===1?"1 earlier step":`${j.length} earlier steps`}`:j.length===1?"1 earlier state":`${j.length} earlier states`]})]})}),e.jsx(ge,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:j.map(C=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(C.occurred_at).toISOString(),title:ke(C.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:we(C.occurred_at)}),e.jsx(ie,{ownerSlug:t,content:C,connectorDefinitions:R})]},C.id))})]}),se&&e.jsxs(xe,{open:ee,children:[e.jsx(he,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>X($,i),children:[e.jsx(Nt,{className:"h-3.5 w-3.5"}),ee?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Hide ",u.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Show ",u.replies.length," replies"]})]})}),e.jsxs(ge,{className:"space-y-2 mt-2",children:[Te.map(C=>e.jsx(ie,{ownerSlug:t,content:C,isReply:!0,connectorDefinitions:R},C.id)),re.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>X(ne,i),children:me?e.jsxs(e.Fragment,{children:["Hide ",re.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",re.length," nested replies"]})}),me&&re.map(C=>e.jsx(ie,{ownerSlug:t,content:C,isReply:!0,connectorDefinitions:R},C.id))]})]})]})]},i):null}),e.jsx("div",{ref:l,className:"h-1"}),M&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(K,{size:"xl",className:"text-muted-foreground"})})]})}export{rn as E};
|
|
1
|
+
import{r as N,j as e,L as B,dU as $e,cx as ve,an as Pe,ag as Oe,eJ as Ie,J as De,a1 as Fe,aD as le,t as Me,af as J,z as Le,ci as ze,cj as Be,B as k,ck as Ue,dl as qe,dm as He,E as Ne,dn as Je,eK as be,eL as ae,cP as oe,eM as Ve,aj as We,bM as Y,G as _e,eN as Ke,eO as Qe,s as K,eP as Ge,eQ as Ye,k as Xe,eR as Ze,bE as et,F as tt,en as nt,cs as st,eS as rt,aO as it,eT as at,X as ot,bP as lt,Y as dt,dI as ct,dJ as ut,dQ as mt,dR as pt,eU as xt,eV as ht,S as gt,c8 as ft,bm as yt,I as jt,dz as xe,dB as he,aW as vt,dC as ge,x as we,eW as ke,eX as Nt}from"./index-BKZMzuMS.js";import{u as bt}from"./clients-C0I3V7XE.js";import{J as _t}from"./renderer-CAyr3B3s.js";function wt({onIntersect:n,enabled:t,rootMargin:s="400px"}){const r=N.useRef(null),a=N.useRef(n);return a.current=n,N.useEffect(()=>{const m=r.current;if(!m||!t)return;const y=new IntersectionObserver(o=>{o[0]?.isIntersecting&&a.current()},{rootMargin:s});return y.observe(m),()=>y.disconnect()},[t,s]),r}function kt(n,t){const s=t.parentEntityType&&t.parentEntitySlug?[{entity_type:t.parentEntityType,slug:t.parentEntitySlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}];return ve(n,s)}function Ct({ownerSlug:n,entity:t,className:s}){const r=kt(n,t);return e.jsxs(B,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${s??""}`,children:[e.jsx("span",{className:"font-medium",children:t.entityName}),e.jsx($e,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}async function St(n,t,s,r){const a=await Pe(`${Oe}/api/${encodeURIComponent(n)}/events/${t}/actions/${encodeURIComponent(s.action)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s.value,interaction_id:r})});return await Ie(a,"Could not record interaction"),a.json()}function w(n){if(typeof n!="string")return;const t=n.trim();return t.length>0?t:void 0}function de(n){return typeof n=="boolean"?n:void 0}function Rt(n,t,s){const r=(s??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||t?.prepared===!0||typeof t?.verified=="boolean"||w(t?.reason_preview)&&w(t?.message)||w(n?.body)&&(w(n?.post_url)||w(n?.activity_id)))}function At(n,t,s){if(!Rt(n,t,s))return null;const r=(s??"").toLowerCase(),a=w(t?.body)??w(n?.body),m=w(t?.reason_preview)??w(n?.reason),y=w(t?.post_url)??w(n?.post_url)??(w(n?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${w(n?.activity_id)}`:void 0),o=de(t?.prepared),x=de(t?.verified),p=de(t?.banner_shown),f=w(t?.message),d=t?.match&&typeof t.match=="object"?t.match:null,b=w(d?.text_preview),c=w(d?.author);let h="generic";r==="verify_staged_comment"||r.includes("verify")||typeof x=="boolean"?h="verify":(r==="prepare_comment"||r.includes("prepare")||o===!0||a&&y)&&(h="prepare");const g=[];return o===!0&&g.push("Staged — not posted"),o===!1&&g.push("Not staged"),x===!0&&g.push("Verified posted"),x===!1&&g.push("Not verified as posted"),p===!0&&g.push("In-page banner"),p===!1&&g.push("No banner"),{kind:h,message:f,reason:m,body:a,postUrl:y,prepared:o,bannerShown:p,verified:x,matchPreview:b,matchAuthor:c,chips:g}}const Tt={};function te(n){return n.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}const Et={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function $t(n){return n.author_name?n.author_name:n.platform?te(n.platform):n.origin_type?Et[n.origin_type]??te(n.origin_type):null}function fe(n){return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?String(n):Array.isArray(n)?n.length===0?"":n.every(t=>typeof t!="object")?n.map(t=>String(t)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(n,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(n,null,2)})}const ce=1e5;function Pt({value:n}){const t=JSON.stringify(n,null,2)??"null",s=t.length>ce;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?t.slice(0,ce):t}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",ce.toLocaleString()," of"," ",t.length.toLocaleString()," characters."]})]})}function Ot(n){return Object.entries(n).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0).sort(([t],[s])=>t.localeCompare(s))}function It({breakdown:n}){if(!n)return null;const t=[{label:"Engagement",value:n.engagement,max:100},{label:"Criticality",value:n.criticality,max:100},{label:"Depth",value:n.depth,max:100},{label:"Authority",value:n.authority,max:100},{label:"Recency",value:n.recency,max:100},{label:"Quality",value:n.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:t.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 Dt({slug:n,value:t,isManual:s}){return e.jsxs(J,{variant:"secondary",className:"text-xs",children:[n,": ",t,s&&e.jsx(be,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Ft(n){if(n&&typeof n=="object"){const t=n;if(Array.isArray(t.values))return{values:t.values.map(s=>String(s)).filter(s=>s.length>0),isManual:t.is_manual===!0};if(t.value!==void 0&&t.value!==null)return{values:[String(t.value)],isManual:t.is_manual===!0};if(typeof t.values=="string"&&t.values.length>0)return{values:[t.values],isManual:t.is_manual===!0}}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?{values:[String(n)],isManual:!1}:{values:[],isManual:!1}}function Mt(n,t){if(n)switch(n){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return n}return t||"pending_approval"}function O(n){return!n||typeof n!="object"||Array.isArray(n)?null:n}function ye(n){return n==null||n===""?"Not set":typeof n=="string"?n:JSON.stringify(n,null,2)}function Lt(n){return n.replace(/\s+[—-]\s+pending approval$/i,"")}function W(n){return n.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}function Ce(n,t,s){return n?.kind==="agent_session"&&n.agent_id?n.client_id?`${n.agent_id} via ${n.client_id}`:n.agent_id:n?.kind==="user"?"a person":t==="agent"?"an agent":s?`Automation ${s}`:"an Automation"}function zt({initiator:n,clientName:t,fallback:s}){const{org:r}=Y(),a=r?.slug,m=n?.client_id??t,o=bt(void 0,{enabled:!!(a&&m)}).data?.find(d=>d.id===m)?.title,x=n&&n.kind!=="user"?Ce(n,void 0,n.automation_id===void 0?void 0:String(n.automation_id)):s,p="font-medium text-foreground",f=`${p} underline-offset-4 hover:underline`;return a&&n?.kind==="automation"&&n.automation_id?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:String(n.automation_id)},search:{view:"definition",run_id:void 0},className:f,children:x}):a&&n?.kind==="agent_session"&&n.agent_id?e.jsx(B,{to:"/$owner/agents/$agentId",params:{owner:a,agentId:String(n.agent_id)},className:f,children:x}):a&&m?e.jsxs(B,{to:"/$owner/agents/connected/$clientId",params:{owner:a,clientId:m},className:`${f} inline-flex items-center gap-1 align-middle`,children:[e.jsx(lt,{name:o??t??m}),o??x]}):e.jsx("span",{className:p,children:x})}function Bt(n){const t=Object.keys(n.fields),s=t.map(W).join(", ")||"field",r=t.length===1?"field":"fields";return`Update ${n.entityType?W(n.entityType).toLowerCase():"entity"} ${r}: ${s}`}function Ut(n,t){const s=O(t.fields);if(!s||Object.keys(s).length===0||t.action_key!=="entity_field_change"&&t.tool!=="entity_field_change")return null;const r=O(t.current)??{},a=n;return{fields:s,current:r,reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??a.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function qt(n){return!n||!Array.isArray(n.evidence)?[]:n.evidence.flatMap(t=>{const s=O(t),r=s?.kind,a=s?.identifier;return typeof r=="string"&&typeof a=="string"?[{kind:r,identifier:a}]:[]})}function je(n){return Array.isArray(n)?n.flatMap(t=>{const s=O(t),r=s?.kind,a=s?.identifier;return typeof r=="string"&&typeof a=="string"?[{kind:r,identifier:a}]:[]}):[]}function Ht(n){const t=O(n?.evidence_change);if(t&&!(!Array.isArray(t.dropped)||!Array.isArray(t.gained)))return{dropped:je(t.dropped),gained:je(t.gained)}}function P(n){return typeof n=="string"?n:void 0}function Jt(n){const t=O(n.current),s=O(n.proposal),r=O(t?.winner),a=O(t?.loser),m=Array.isArray(t?.duplicates)?t.duplicates.map(O):[],o=(m.length>0?m:a?[a]:[]).flatMap(c=>{const h=P(c?.name),g=c?.id;return h&&(typeof g=="string"||typeof g=="number")?[{key:String(g),name:h,slug:P(c?.slug),entityType:P(c?.entity_type),parentSlug:P(c?.parent_slug),parentEntityType:P(c?.parent_entity_type)}]:[]}),x=Array.isArray(s?.entity_ids)?s.entity_ids:[],p=Array.isArray(s?.names)?s.names.flatMap((c,h)=>{const g=x[h];return typeof c=="string"&&(typeof g=="string"||typeof g=="number")?[{key:String(g),name:c}]:[]}):[],f=P(s?.name),d=s?.entity_id,b=o.length>0?o:p.length>0?p:f&&(typeof d=="string"||typeof d=="number")?[{key:String(d),name:f}]:[];return{winnerName:P(r?.name)??P(s?.winner_name),winnerSlug:P(r?.slug),winnerEntityType:P(r?.entity_type),winnerParentSlug:P(r?.parent_slug),winnerParentEntityType:P(r?.parent_entity_type),losers:b,matchEvidence:qt(s),evidenceChange:Ht(s)}}function Vt(n){const t=n.entityType?W(n.entityType).toLowerCase():"entity";if(n.operation==="merge"){const s=n.merge?.losers??[];return s.length>1?`Merge ${s.length} duplicate ${t}s`:`Merge duplicate ${t}`}return`${W(n.operation)} ${t}`}function Wt(n,t){if(t.action_key!=="entity_change"&&t.tool!=="entity_change")return null;const s=t.action;if(s!=="create"&&s!=="delete"&&s!=="merge")return null;const r=n;return{operation:s,merge:s==="merge"?Jt(t):void 0,proposal:O(t.proposal),current:O(t.current),reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,proposerRationale:typeof t.proposer_rationale=="string"?t.proposer_rationale:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function ue(n,t){return!n||!t.entityType||!t.entitySlug?null:ve(n,t.parentEntityType&&t.parentSlug?[{entity_type:t.parentEntityType,slug:t.parentSlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}])}function Se({runId:n,details:t}){const{org:s}=Y(),a=_e(t.automationId,void 0,s?.id,{includeVersions:!1}).data?.automation,m=Ce(t.initiator,t.attribution,t.automationId),y=a?.automation_name??t.automationName??m,o=s?.slug;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",o&&t.automationId?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:o,automationId:t.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:y}):e.jsx("span",{className:"font-medium text-foreground",children:y}),o&&n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(B,{to:"/$owner/events",params:{owner:o},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",n]})]})]})}function Re({details:n}){const{org:t}=Y(),s=ue(t?.slug,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(B,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function Ae({label:n,before:t,after:s}){return e.jsxs("div",{className:"rounded-md border border-border/70 overflow-hidden",children:[e.jsx("div",{className:"border-b border-border/70 px-3 py-2 text-xs font-medium",children:n}),e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Current"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ye(t)})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposed"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:ye(s)})]})]})]})}function Kt({runId:n,details:t}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Se,{runId:n,details:t}),e.jsx(Re,{details:t}),Object.entries(t.fields).map(([s,r])=>e.jsx(Ae,{label:W(s),before:t.current[s],after:r},s)),t.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:t.reason})]})]})}function Qt({merge:n,status:t}){const{org:s}=Y(),r=ue(s?.slug,{entityType:n.winnerEntityType,entitySlug:n.winnerSlug,parentEntityType:n.winnerParentEntityType,parentSlug:n.winnerParentSlug}),a=n.losers.length,m=t==="rejected"||t==="failed",y=t==="completed";return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg border border-border/70 overflow-hidden",children:e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:m?"Would have kept":"Kept"}),e.jsx("div",{className:"text-sm font-medium leading-relaxed",children:n.winnerName?r?e.jsx(B,{to:r,className:"underline-offset-4 hover:underline",children:n.winnerName}):n.winnerName:e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:m?a>1?`Kept separate (${a})`:"Kept separate":y?a>1?`Merged away (${a})`:"Merged away":a>1?`To merge away (${a})`:"To merge away"}),e.jsx("div",{className:"space-y-0.5 text-sm leading-relaxed",children:a>0?n.losers.map(o=>{const x=ue(s?.slug,{entityType:o.entityType,entitySlug:o.slug,parentEntityType:o.parentEntityType,parentSlug:o.parentSlug}),p=y?"line-through decoration-muted-foreground/60":"";return e.jsx("div",{className:"break-words",children:x?e.jsx(B,{to:x,className:`${p} underline-offset-4 hover:underline`,children:o.name}):e.jsx("span",{className:p,children:o.name})},o.key)}):e.jsx("span",{className:"text-muted-foreground",children:"Unknown"})})]})]})}),n.evidenceChange&&e.jsxs("div",{className:n.evidenceChange.dropped.length>0?"rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2":"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:n.evidenceChange.dropped.length>0?"What changed since you reviewed this":"Evidence re-checked"}),e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1",children:[n.evidenceChange.dropped.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-amber-700 dark:text-amber-400",children:"No longer proven"}),W(o.kind),": ",o.identifier]},`dropped-${o.kind}:${o.identifier}`)),n.evidenceChange.gained.map(o=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"mr-1.5 font-medium text-emerald-700 dark:text-emerald-400",children:"Newly proven"}),W(o.kind),": ",o.identifier]},`gained-${o.kind}:${o.identifier}`)),n.evidenceChange.dropped.length===0&&n.evidenceChange.gained.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"The recorded match evidence did not change."})]})]}),n.matchEvidence.length>0&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Match evidence"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:n.matchEvidence.map(o=>e.jsxs(J,{variant:"outline",className:"text-[10px] font-normal",children:[W(o.kind),": ",o.identifier]},`${o.kind}:${o.identifier}`))})]})]})}function Gt({runId:n,details:t,status:s}){const r=t.operation==="merge";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Se,{runId:n,details:t}),r&&t.merge?e.jsx(Qt,{merge:t.merge,status:s}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{details:t}),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:"Change"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.operation==="create"?"Create a new entity after approval.":"Delete this entity after approval."})]})]}),!r&&t.proposal&&e.jsxs("div",{className:"rounded-md border border-border/70 p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposal"}),e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(t.proposal,null,2)})]}),t.proposerRationale&&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:t.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.proposerRationale})]}),t.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:r?"Why this needs approval":"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:t.reason})]})]})}function Yt({summary:n}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[n.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.chips.map(t=>e.jsx(J,{variant:"outline",className:"text-[10px] font-normal",children:t},t))}),n.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:n.message}),n.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:n.reason})]}),n.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:n.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:n.body})]}),n.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",n.matchAuthor?` · ${n.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:n.matchPreview})]}),n.postUrl&&e.jsxs("a",{href:n.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(Ne,{className:"h-3 w-3"})]})]})}function Xt({content:n}){const t=n.metadata||{},s=n.run_id??void 0,r=Ut(n,t),a=Wt(n,t),m=(r?Bt(r):a?Vt(a):void 0)||t.operation_name||t.action_name||(n.title?Lt(n.title):void 0)||"Action",y=t.connection_name,o=t.operation_key||t.action_key||null,x=n.interaction_input_schema||t.input_schema||null,p=N.useMemo(()=>n.interaction_input||t.action_input||t.operation_input||Tt,[n.interaction_input,t.action_input,t.operation_input]),f=n.interaction_output||t.action_output||void 0,d=At(p,f??null,o),b=n.interaction_error||t.error_message||void 0,c=Mt(n.interaction_status,t.status),h=t.reviewed_by_name||t.reviewed_by_id||void 0,g=t.reject_reason||void 0,R=t.initiator,D=Ge(),v=Ye(),A=Xe(n.id,Ze(x,p),x),{values:F,setValues:U}=A,[I,q]=N.useState(null),[_,M]=N.useState(!1),[E,l]=N.useState(""),S=c==="pending_approval",L=typeof t.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(et,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:m}),y&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",y]}),c==="confirmed"&&e.jsxs(J,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:[e.jsx(K,{size:"xs",className:"mr-1"}),"Executing"]}),c==="completed"&&e.jsx(J,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),c==="failed"&&e.jsx(J,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),c==="rejected"&&e.jsx(J,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!r&&!a&&(n.author_name||h)&&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(zt,{initiator:R,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&h&&e.jsx("span",{children:"·"}),h&&e.jsxs("span",{children:[c==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:h})]})]}),r&&e.jsx(Kt,{runId:s,details:r}),!r&&a&&e.jsx(Gt,{runId:s,details:a,status:c}),c==="rejected"&&g&&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:"})," ",g]}),d&&e.jsx(Yt,{summary:d}),(S?A.revision:x)&&(S||Object.keys(p).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:d?"Full input":"Input"}),S?e.jsxs(e.Fragment,{children:[e.jsx(tt,{visible:A.hasConflict,onReload:A.reset}),e.jsx(nt,{schema:A.revision,values:F,onValuesChange:U,fieldIdPrefix:`action-${n.id}-`},`action-${n.id}`)]}):d?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(p,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(p,null,2)})]}),c==="completed"&&f&&Object.keys(f).length>0&&!d&&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(st,{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(f,null,2)})]}),c==="completed"&&f&&Object.keys(f).length>0&&d&&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(f,null,2)})]}),c==="failed"&&b&&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(rt,{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:b})]}),I==="confirmed"&&e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-blue-700 dark:text-blue-400 font-medium",children:[e.jsx(K,{size:"md"}),"Confirmed — executing..."]}),e.jsx("p",{className:"text-xs text-blue-800 dark:text-blue-300 mt-1",children:"The worker will execute this action shortly. Redirecting..."})]}),I==="rejected"&&e.jsx(J,{variant:"outline",className:"text-muted-foreground text-xs",children:"Rejected — redirecting..."}),S&&!I&&L&&e.jsx("div",{className:"pt-1 text-xs text-muted-foreground",children:"Part of an Automation run — approve or reject it from the run's change-set above."}),S&&s&&!I&&!L&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:_?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:E,onChange:$=>l($.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>v.mutate({run_id:s,reason:E||void 0},{onSuccess:()=>{q("rejected")}}),disabled:v.isPending,children:[v.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{M(!1),l("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>D.mutate({run_id:s,input:at(F)},{onSuccess:()=>{q("confirmed")}}),disabled:!A.canSubmit||D.isPending||v.isPending,children:[D.isPending?e.jsx(K,{size:"sm",className:"mr-1"}):e.jsx(it,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>M(!0),disabled:D.isPending||v.isPending,children:[e.jsx(ot,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function Zt({content:n}){const t=n.metadata||{},s=t.kind,r=n.run_id??null,a=typeof t.automation_id=="number"?t.automation_id:null,{org:m}=Y(),y=m?.slug,p=_e(a!=null?String(a):void 0,void 0,m?.id,{includeVersions:!1}).data?.automation?.automation_name??(a!=null?`Automation ${a}`:"An Automation"),f=Ke(),d=Qe(),[b,c]=N.useState(!1),[h,g]=N.useState(""),[R,D]=N.useState(null);if(s==="automation_batch_reject"){const l=t.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"}),l&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:l}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const v=Array.isArray(t.changes)?t.changes:[],A=typeof t.created_count=="number"?t.created_count:v.filter(l=>l.kind==="created").length,F=typeof t.updated_count=="number"?t.updated_count:v.filter(l=>l.kind==="updated").length,U=typeof t.denied_count=="number"?t.denied_count:v.filter(l=>l.kind==="denied").length,I=v.filter(l=>l.kind==="denied"),q=v.filter(l=>l.kind==="updated"&&Object.keys(l.applied||{}).length>0),_=typeof t.pending_proposal_count=="number"?t.pending_proposal_count:null,M=_==null||_>0,E=M?"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:[E==="proposed"?"Proposed":"Applied"," ",A," ","new + ",F," updated",U>0&&e.jsxs(e.Fragment,{children:[" + ",U," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[y&&a!=null?e.jsx(B,{to:"/$owner/automations/$automationId",params:{owner:y,automationId:String(a)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:p}):e.jsx("span",{className:"font-medium text-foreground",children:p}),r!=null&&e.jsxs("span",{children:[" · run #",r]}),_!=null&&_>0&&e.jsxs("span",{children:[" · ",_," pending"]})]})]}),q.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:q.map(l=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:l.name}),Object.entries(l.applied).map(([S,L])=>e.jsx(Ae,{label:S,before:L.old,after:L.new},S))]},l.entityId))}),I.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:I.map(l=>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:[l.name," — not written"]}),l.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[l.denied.reason,e.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",l.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${l.entityId}-${l.name}`))}),r!=null&&R==null&&M&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:b?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"What should the agent change?",value:h,onChange:l=>g(l.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(k,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>d.mutate({run_id:r,reason:h||void 0},{onSuccess:()=>D("rejected")}),disabled:d.isPending,children:[d.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{c(!1),g("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{size:"sm",className:"h-7 text-xs",onClick:()=>f.mutate({run_id:r},{onSuccess:()=>D("approved")}),disabled:f.isPending||d.isPending,children:[f.isPending&&e.jsx(K,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx(k,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>c(!0),disabled:f.isPending||d.isPending,children:"Reject with feedback"})]})}),R==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),R==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),r!=null&&R==null&&!M&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function ie({ownerSlug:n,content:t,isReply:s,showParentContext:r,connectorDefinitions:a}){const[m,y]=N.useState(!1),[o,x]=N.useState(!1),p=De(),{currentOwner:f}=Fe(),d=n??f,b=d==="me"?null:d,c=N.useCallback(async i=>{if(!b){le.error("Open this event inside a workspace to interact with it.");return}try{await St(b,Number(t.id),i,crypto.randomUUID()),le.success("Recorded")}catch(u){le.error(u instanceof Error?u.message:"Could not record that interaction.")}},[t.id,b]),h=t.payload_data??{},g=t.semantic_type==="audit"&&t.origin_type==="tool_invocation",R=g&&(h.request!==void 0||h.request_status==="too_large"),v=g&&h.request_status==="complete"&&d?`/${d}/events?content_ids=${t.id}`:!d||d==="me"?null:t.run_id!=null?`/${d}/events?run_ids=${t.run_id}`:null,A=!!(p&&v&&Me(v)),F=()=>{!p||!v||p.open({href:v,title:t.title??(t.run_id!=null?`Run #${t.run_id}`:"Event"),runId:t.run_id??void 0})},U=i=>{const u=i.target;if(!(u instanceof Element))return!1;const j=u.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return j!==null&&j!==i.currentTarget},I=i=>{U(i)||F()},q=i=>{i.key!=="Enter"&&i.key!==" "||U(i)||(i.preventDefault(),F())},_=t.metadata||{};if(t.semantic_type==="change_set")return e.jsx(Zt,{content:t});if(t.interaction_type==="approval"||t.semantic_type==="operation"||_.status!=null||_.action_key!=null)return e.jsx(Xt,{content:t});const E=Number.isFinite(t.score)?Math.round(t.score):"-",l=t.payload_type||"text",S=t.text_content||"",L=(l==="text"||l==="markdown")&&S.length>500,$=L&&!m?`${S.slice(0,500)}...`:S,Q=_.thumbnail_url||_.thumbnail,H=_.media_url,G=Ot(_),ne=Object.entries(t.classifications||{}).flatMap(([i,u])=>{const j=Ft(u);return j.values.map(T=>({slug:i,value:T,isManual:j.isManual}))}),X=(()=>{const i=t.metadata??{},u=t.platform||(typeof i.platform=="string"?i.platform:null),j=t.connection_id!=null?t.connection_id:i.source_connection_id!=null?Number(i.source_connection_id):null;return{...t,platform:u,connection_id:j!=null&&Number.isFinite(j)?j:null}})();return e.jsxs("div",{className:We(s?"border-l-2 border-l-muted pl-4":"",A&&"-mx-2 cursor-pointer rounded-lg px-2 py-1 transition-colors hover:bg-accent/40"),...A?{role:"button",tabIndex:0,onClick:I,onKeyDown:q}:{},children:[r&&t.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:t.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:t.parent_context.text_content})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.title&&e.jsx("h4",{className:"font-medium line-clamp-2 mb-1",children:t.title}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(()=>{const i=$t(t),u=!!t.platform&&i!==te(t.platform);return e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"font-medium",children:i}),u&&e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{children:"·"}),e.jsx(J,{variant:"outline",className:"text-xs",children:t.platform})]})]})})()}),d?e.jsx(Le,{owner:d,source:X,connectorDefinitions:a,className:"mt-0.5 text-xs"}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.score_breakdown?e.jsxs(ze,{children:[e.jsx(Be,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:E})})}),e.jsx(Ue,{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(It,{breakdown:t.score_breakdown})]})})]}):e.jsx(k,{variant:"ghost",size:"sm",className:"h-7 px-2",disabled:!0,children:e.jsx("span",{className:"font-medium",children:E})}),t.source_url&&e.jsxs(qe,{children:[e.jsx(He,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"icon",className:"h-7 w-7",asChild:!0,children:e.jsx("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Ne,{className:"h-3.5 w-3.5"})})})}),e.jsx(Je,{children:"View original"})]})]})]}),t.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(i=>e.jsx(be,{className:`h-4 w-4 ${i<=Number(t.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},i))}),Q&&e.jsx("a",{href:H||t.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:Q,alt:"",className:`rounded-md object-cover ${l==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),t.excerpt&&e.jsx("div",{className:"text-sm italic text-muted-foreground border-l-2 border-primary/40 pl-2 mb-1",children:t.excerpt}),(()=>{switch(l){case"markdown":if($)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(Ve,{text:$})});break;case"json_template":{const i=t.payload_template;if(i?.root)return e.jsx(_t,{template:{root:i.root},data:t.payload_data||{},onAction:c,interactions:i.interactions});if($)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:$});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!Q&&H&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:H}),$&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:$})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[R&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(k,{variant:"outline",size:"sm","aria-expanded":o,onClick:()=>x(i=>!i),children:[o?e.jsx(ae,{className:"h-3.5 w-3.5"}):e.jsx(oe,{className:"h-3.5 w-3.5"}),"Request"]}),o&&(h.request_status==="too_large"?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof h.request_bytes=="number"?` (${h.request_bytes.toLocaleString()} bytes).`:"."]}):e.jsx(Pt,{value:h.request}))]}),G.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:G.map(([i,u])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:te(i)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:fe(u)})]},i))}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"})]});default:if($)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:$});break}return e.jsxs("div",{className:"space-y-3",children:[H&&!Q&&e.jsx("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:H}),G.length>0&&e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:G.map(([i,u])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:te(i)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:fe(u)})]},i))})]})})(),L&&e.jsx(k,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>y(!m),children:m?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3 w-3 mr-1"})," Show more"]})}),ne.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:ne.map(i=>e.jsx(Dt,{slug:i.slug,value:i.value||"",isManual:i.isManual},i.slug))})]})}function en({occurredAt:n,isLast:t,children:s}){return e.jsxs("div",{className:"relative flex gap-4 pb-6",children:[e.jsxs("div",{className:"relative flex w-2.5 shrink-0 justify-center",children:[!t&&e.jsx("div",{className:"absolute top-1 bottom-[-1.5rem] left-1/2 w-px -translate-x-1/2 bg-border","aria-hidden":!0}),e.jsx("div",{className:"relative z-10 mt-1 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground/60"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[n&&e.jsx("time",{dateTime:new Date(n).toISOString(),title:ke(n),className:"mb-1 block text-xs leading-none text-muted-foreground",children:we(n)}),s]})]})}function rn({organizationId:n,ownerSlug:t,entityId:s,filters:r,showEntityLinks:a=!1,emptyState:m,dense:y=!1}){const{isAuthenticated:o,isReady:x}=dt(),{isMember:p,isLoading:f}=Y(),d=t==="me",b=!d&&x&&o&&p,c=!d&&x&&(!o||!f&&!p),{data:h=[]}=ct(x&&b?n:null),{data:g=[]}=ut(c?t:null),R=b?h:g,D=mt(x&&b?n:null,s,r,t),v=pt(c?t:null,s,r),A=c?v:D,{data:F,isLoading:U,error:I,fetchNextPage:q,hasNextPage:_,isFetchingNextPage:M}=A,E=N.useMemo(()=>F?.pages.flatMap(i=>i.content)??[],[F]),l=wt({onIntersect:()=>q(),enabled:!!_&&!M}),S=N.useMemo(()=>{const i=xt(E),u=i.map(V=>V.head),j=new Map(i.map(V=>[V.head.id,V])),T=ht(u);return Array.from(T.entries()).map(([V,Z])=>{const se=Z.root||Z.replies[0],ee=se?j.get(se.id):void 0;return{rootId:V,group:Z,history:ee?.history??[],runId:ee?.runId??null}})},[E]),[L,$]=N.useState(new Set),[Q,H]=N.useState(new Set),[G,ne]=N.useState(new Set),X=(i,u)=>i(j=>{const T=new Set(j);return T.has(u)?T.delete(u):T.add(u),T});return U&&E.length===0?e.jsx("div",{className:"space-y-4",children:["s1","s2","s3"].map(i=>e.jsx(gt,{className:"h-32 rounded-lg"},i))}):I?e.jsx(ft,{label:"events"}):E.length===0?m??e.jsx(yt,{icon:jt,title:"Nothing here yet",description:"No events match this view."}):e.jsxs("div",{className:y?"":"pt-1",children:[S.map(({rootId:i,group:u,history:j,runId:T},V,Z)=>{const se=u.replies.length>0,ee=L.has(i),me=G.has(i),pe=Q.has(i),Te=u.replies.filter(C=>C.depth<=3),re=u.replies.filter(C=>C.depth>3),Ee=!u.root&&u.replies.length>0,z=u.root||u.replies[0];return z?e.jsxs(en,{occurredAt:z.occurred_at,isLast:V===Z.length-1,children:[a&&t&&z.entity_name&&z.entity_type&&z.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(Ct,{ownerSlug:t,entity:{entityName:z.entity_name,entityType:z.entity_type,entitySlug:z.entity_slug}})}),e.jsx(ie,{ownerSlug:t,content:z,showParentContext:Ee&&!!z.parent_context,connectorDefinitions:R}),j.length>0&&e.jsxs(xe,{open:pe,children:[e.jsx(he,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>X(H,i),children:[e.jsx(vt,{className:"h-3.5 w-3.5"}),pe?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Hide ",T!=null?`run #${T} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),T!=null?`Run #${T} · ${j.length===1?"1 earlier step":`${j.length} earlier steps`}`:j.length===1?"1 earlier state":`${j.length} earlier states`]})]})}),e.jsx(ge,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:j.map(C=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(C.occurred_at).toISOString(),title:ke(C.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:we(C.occurred_at)}),e.jsx(ie,{ownerSlug:t,content:C,connectorDefinitions:R})]},C.id))})]}),se&&e.jsxs(xe,{open:ee,children:[e.jsx(he,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>X($,i),children:[e.jsx(Nt,{className:"h-3.5 w-3.5"}),ee?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Hide ",u.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Show ",u.replies.length," replies"]})]})}),e.jsxs(ge,{className:"space-y-2 mt-2",children:[Te.map(C=>e.jsx(ie,{ownerSlug:t,content:C,isReply:!0,connectorDefinitions:R},C.id)),re.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>X(ne,i),children:me?e.jsxs(e.Fragment,{children:["Hide ",re.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",re.length," nested replies"]})}),me&&re.map(C=>e.jsx(ie,{ownerSlug:t,content:C,isReply:!0,connectorDefinitions:R},C.id))]})]})]})]},i):null}),e.jsx("div",{ref:l,className:"h-1"}),M&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(K,{size:"xl",className:"text-muted-foreground"})})]})}export{rn as E};
|
package/dist/owletto/dist/assets/{full-page-spinner-BSp5F0ls.js → full-page-spinner-Q_J5Wcop.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as t,aj as u}from"./index-
|
|
1
|
+
import{r,j as t,aj as u}from"./index-BKZMzuMS.js";function l({className:i,delayMs:e=500}){const[s,n]=r.useState(e<=0);return r.useEffect(()=>{if(e<=0)return;const a=setTimeout(()=>n(!0),e);return()=>clearTimeout(a)},[e]),s?t.jsx("div",{className:u("flex min-h-[50vh] items-center justify-center",i),role:"status","aria-label":"Loading",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):null}export{l as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,a0 as o}from"./index-BKZMzuMS.js";function a(){return t.jsx(o,{})}export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ht as t,j as n}from"./index-BKZMzuMS.js";import{a as i}from"./agents-workbench-BojDv6gX.js";import"./agent-editor-form-ayUg3Ws1.js";import"./model-selector-9ZRlR7Sa.js";import"./proposal-review-shell-Bk9D_9YN.js";import"./runs-CftQDTkq.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a6 as t,j as i}from"./index-BKZMzuMS.js";import{A as m}from"./activity-route-view-C9W2Ipni.js";import"./device-automation-BIjs7DZJ.js";import"./agent-thread-storage-U6htL3ad.js";import"./pending-seed-CPbfgnLX.js";import"./clients-C0I3V7XE.js";import"./client-rows-EJSKR6z1.js";import"./connection-label-BobuYiAG.js";import"./events-feed-DmZ3Ig3X.js";import"./renderer-CAyr3B3s.js";import"./card-HMQT7vU5.js";import"./calendar-VAaxHxss.js";import"./agent-loading-shells-DjMpSoub.js";import"./member-scope-gate-yGr4lrGD.js";function w(){const{owner:o}=t.useParams(),r=t.useSearch();return i.jsx(m,{owner:o,search:r,attentionLens:!0})}export{w as component};
|