@wjarka/cezarion 0.14.8 → 0.14.9-dev.1009
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/README.md +131 -2
- package/dist/application-update/bin-recovery.d.ts +5 -0
- package/dist/application-update/bin-recovery.js +96 -0
- package/dist/application-update/bin-recovery.js.map +1 -0
- package/dist/application-update/discovery.d.ts +22 -0
- package/dist/application-update/discovery.js +91 -0
- package/dist/application-update/discovery.js.map +1 -0
- package/dist/application-update/helper.d.ts +57 -0
- package/dist/application-update/helper.js +374 -0
- package/dist/application-update/helper.js.map +1 -0
- package/dist/application-update/launcher.d.ts +8 -0
- package/dist/application-update/launcher.js +53 -0
- package/dist/application-update/launcher.js.map +1 -0
- package/dist/application-update/lock.d.ts +4 -0
- package/dist/application-update/lock.js +70 -0
- package/dist/application-update/lock.js.map +1 -0
- package/dist/application-update/npm-process.d.ts +17 -0
- package/dist/application-update/npm-process.js +133 -0
- package/dist/application-update/npm-process.js.map +1 -0
- package/dist/application-update/service.d.ts +69 -0
- package/dist/application-update/service.js +456 -0
- package/dist/application-update/service.js.map +1 -0
- package/dist/artifacts/cli.d.ts +1 -0
- package/dist/artifacts/cli.js +32 -0
- package/dist/artifacts/cli.js.map +1 -0
- package/dist/artifacts/lifecycle.d.ts +4 -0
- package/dist/artifacts/lifecycle.js +42 -0
- package/dist/artifacts/lifecycle.js.map +1 -0
- package/dist/artifacts/resolve.d.ts +18 -0
- package/dist/artifacts/resolve.js +102 -0
- package/dist/artifacts/resolve.js.map +1 -0
- package/dist/artifacts/store.d.ts +8 -0
- package/dist/artifacts/store.js +323 -0
- package/dist/artifacts/store.js.map +1 -0
- package/dist/automations/scheduler.d.ts +6 -0
- package/dist/automations/scheduler.js +45 -17
- package/dist/automations/scheduler.js.map +1 -1
- package/dist/automations/store.d.ts +12 -4
- package/dist/automations/store.js +199 -22
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/types.d.ts +2 -0
- package/dist/automations/types.js +1 -0
- package/dist/automations/types.js.map +1 -1
- package/dist/ci-wait/mcp.d.ts +3 -0
- package/dist/ci-wait/mcp.js +14 -3
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/contract/application-update.d.ts +32 -0
- package/dist/contract/artifacts.d.ts +83 -0
- package/dist/contract/ask-schema.d.ts +32 -0
- package/dist/contract/ask.d.ts +2 -32
- package/dist/contract/automations.d.ts +6 -0
- package/dist/contract/conversations.d.ts +165 -0
- package/dist/contract/delegation.d.ts +68 -0
- package/dist/contract/discovery.d.ts +134 -0
- package/dist/contract/events.d.ts +49 -0
- package/dist/contract/health.d.ts +12 -0
- package/dist/contract/index.d.ts +3 -0
- package/dist/contract/index.js +1654 -1454
- package/dist/contract/projects.d.ts +40 -0
- package/dist/contract/runs.d.ts +186 -0
- package/dist/contract/skills.d.ts +33 -0
- package/dist/core/agent-runner.d.ts +33 -4
- package/dist/core/agent-runner.js +5 -0
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +6 -12
- package/dist/core/claude-cli-runner.js +90 -20
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.d.ts +2 -1
- package/dist/core/codex-app-server-runner.js +327 -92
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +13 -1
- package/dist/core/codex-app-server-transport.js +58 -17
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/cursor-acp-runner.d.ts +6 -1
- package/dist/core/cursor-acp-runner.js +162 -26
- package/dist/core/cursor-acp-runner.js.map +1 -1
- package/dist/core/cursor-provider-error.d.ts +3 -0
- package/dist/core/cursor-provider-error.js +16 -1
- package/dist/core/cursor-provider-error.js.map +1 -1
- package/dist/core/input-submissions.d.ts +14 -0
- package/dist/core/input-submissions.js +26 -0
- package/dist/core/input-submissions.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +4 -1
- package/dist/core/opencode-server-runner.js +156 -26
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.d.ts +2 -1
- package/dist/core/pi-runner.js +88 -10
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +99 -1
- package/dist/core/provider-auth.js +203 -2
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/delegation/cli.d.ts +1 -0
- package/dist/delegation/cli.js +103 -7
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/conversations.js +13 -5
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/input.d.ts +2 -1
- package/dist/delegation/input.js +6 -1
- package/dist/delegation/input.js.map +1 -1
- package/dist/delegation/policy.d.ts +3 -2
- package/dist/delegation/policy.js +3 -1
- package/dist/delegation/policy.js.map +1 -1
- package/dist/delegation/process-liveness.d.ts +66 -0
- package/dist/delegation/process-liveness.js +215 -0
- package/dist/delegation/process-liveness.js.map +1 -0
- package/dist/delegation/provision.d.ts +1 -1
- package/dist/delegation/provision.js +10 -5
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/questions.d.ts +19 -0
- package/dist/delegation/questions.js +45 -0
- package/dist/delegation/questions.js.map +1 -0
- package/dist/delegation/results.d.ts +1 -1
- package/dist/delegation/results.js +33 -19
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +185 -11
- package/dist/delegation/routes.js +6 -2
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/service.d.ts +23 -5
- package/dist/delegation/service.js +240 -17
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +178 -15
- package/dist/delegation/workspace.d.ts +1 -1
- package/dist/delegation/workspace.js +13 -6
- package/dist/delegation/workspace.js.map +1 -1
- package/dist/discovery/catalog.d.ts +14 -0
- package/dist/discovery/catalog.js +31 -0
- package/dist/discovery/catalog.js.map +1 -0
- package/dist/discovery/cli.d.ts +8 -0
- package/dist/discovery/cli.js +104 -0
- package/dist/discovery/cli.js.map +1 -0
- package/dist/git-worktree.d.ts +3 -1
- package/dist/git-worktree.js +26 -4
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +93 -26
- package/dist/index.js.map +1 -1
- package/dist/open-url.d.ts +2 -0
- package/dist/open-url.js +20 -0
- package/dist/open-url.js.map +1 -0
- package/dist/release/snapshot.d.ts +3 -3
- package/dist/release/snapshot.js +6 -6
- package/dist/release/snapshot.js.map +1 -1
- package/dist/runs/agent-tmpdir.d.ts +2 -0
- package/dist/runs/agent-tmpdir.js +5 -2
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/client-request.d.ts +11 -0
- package/dist/runs/client-request.js +26 -0
- package/dist/runs/client-request.js.map +1 -0
- package/dist/runs/delegation-state.d.ts +17 -0
- package/dist/runs/event-history.js +6 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.d.ts +7 -2
- package/dist/runs/retention.js +39 -7
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +100 -6
- package/dist/runs/store.js +245 -2
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/webhook.d.ts +125 -0
- package/dist/runs/webhook.js +256 -0
- package/dist/runs/webhook.js.map +1 -0
- package/dist/server/project-context.d.ts +2 -0
- package/dist/server/project-context.js +1 -0
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/provider-auth-runtime.d.ts +30 -4
- package/dist/server/provider-auth-runtime.js +71 -6
- package/dist/server/provider-auth-runtime.js.map +1 -1
- package/dist/server/server.d.ts +8226 -4860
- package/dist/server/server.js +311 -15
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps.d.ts +5 -1
- package/dist/server-install/platforms/ubuntu-vps.js +160 -18
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
- package/dist/server-install/steps.d.ts +4 -2
- package/dist/server-install/steps.js +5 -4
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills-remote.d.ts +30 -5
- package/dist/skills-remote.js +122 -32
- package/dist/skills-remote.js.map +1 -1
- package/dist/skills.js +15 -6
- package/dist/skills.js.map +1 -1
- package/dist/task-cli/cli.d.ts +38 -0
- package/dist/task-cli/cli.js +580 -0
- package/dist/task-cli/cli.js.map +1 -0
- package/dist/task-cli/discovery.d.ts +22 -0
- package/dist/task-cli/discovery.js +96 -0
- package/dist/task-cli/discovery.js.map +1 -0
- package/dist/task-cli/http.d.ts +46 -0
- package/dist/task-cli/http.js +101 -0
- package/dist/task-cli/http.js.map +1 -0
- package/dist/task-cli/projections.d.ts +40 -0
- package/dist/task-cli/projections.js +45 -0
- package/dist/task-cli/projections.js.map +1 -0
- package/dist/task-cli/watch.d.ts +78 -0
- package/dist/task-cli/watch.js +336 -0
- package/dist/task-cli/watch.js.map +1 -0
- package/dist/workflows/run.d.ts +160 -2
- package/dist/workflows/run.js +1141 -108
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/agent-profiles.d.ts +22 -0
- package/dist/workspace/agent-profiles.js +15 -0
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +9 -0
- package/dist/workspace/config.js +13 -1
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +1 -1
- package/dist/workspace/projects.d.ts +24 -1
- package/dist/workspace/projects.js +14 -1
- package/dist/workspace/projects.js.map +1 -1
- package/package.json +5 -5
- package/scripts/mock-claude.mjs +64 -2
- package/scripts/mock-codex-app-server.mjs +124 -1
- package/scripts/mock-cursor-acp.mjs +54 -3
- package/scripts/mock-cursor-hang-stdin-late.mjs +35 -0
- package/scripts/mock-cursor-hang-stdin.mjs +30 -0
- package/scripts/mock-opencode-serve.mjs +102 -2
- package/scripts/mock-pi-rpc.mjs +82 -3
- package/web/dist/assets/agent-accounts-CerclGiO.js +1 -0
- package/web/dist/assets/centered-state-DH8qtCz-.js +43 -0
- package/web/dist/assets/collapsible-De2G0xqQ.js +1 -0
- package/web/dist/assets/commit-list-s6JPY3qv.js +1 -0
- package/web/dist/assets/compare-variants-BQu_t-_g.js +1 -0
- package/web/dist/assets/{diff-tRE59UNb2.js → diff-8M5HlDxq2.js} +2 -2
- package/web/dist/assets/diff-controls-B6ok0TtQ.js +1 -0
- package/web/dist/assets/{diff-stat-Cgnl_hYF.js → diff-stat-D1AODN2a.js} +1 -1
- package/web/dist/assets/{diff-view-DN1ort7Q.js → diff-view-Bs5Gh7UF.js} +2 -2
- package/web/dist/assets/dropdown-menu-7KGQMoFj.js +1 -0
- package/web/dist/assets/git-toolbar-DqbapMXr.js +1 -0
- package/web/dist/assets/github-DCkk6sBm.js +1 -0
- package/web/dist/assets/{image-preview-C2JGcBlC.js → image-preview-jzHoEyLM.js} +1 -1
- package/web/dist/assets/index-Bnva-ttR.js +7 -0
- package/web/dist/assets/index-D5NkwqY7.css +1 -0
- package/web/dist/assets/markdown-DvbymqXz.js +2 -0
- package/web/dist/assets/pill-BL6ugwXo.js +1 -0
- package/web/dist/assets/project-router-ChC5Rb-Y.js +1 -0
- package/web/dist/assets/prompt-templates-j8qlK7c-.js +15 -0
- package/web/dist/assets/repo-git-_h1NjOVt.js +1 -0
- package/web/dist/assets/{run-diff-CyG0Nciv.js → run-diff-BuATgZpx.js} +2 -2
- package/web/dist/assets/run-header-DuAWswYM.js +1 -0
- package/web/dist/assets/skills-C-fq5BrZ.js +1 -0
- package/web/dist/assets/{tab-link-BWNp3mLY.js → tab-link-BmGKj9Rt.js} +1 -1
- package/web/dist/assets/task-changes-CHa6JWOS.js +1 -0
- package/web/dist/assets/task-commits-BqCqyWm1.js +1 -0
- package/web/dist/assets/task-files-BSA0l-YP.js +2 -0
- package/web/dist/assets/task-thread-Bw_nQuTx.css +1 -0
- package/web/dist/assets/task-thread-Q7Nj33DH.js +9 -0
- package/web/dist/assets/textarea-ByZ-txS7.js +1 -0
- package/web/dist/assets/thread-loading-DHT9p5o5.js +1 -0
- package/web/dist/assets/token-metrics-k4XoovDS.js +1 -0
- package/web/dist/assets/utils-BTFBhZ55.js +64 -0
- package/web/dist/assets/workflows-HJOd3lVi.js +11 -0
- package/web/dist/assets/{zoomable-image-Z3JDnm0b.js → zoomable-image-Ba6y6Wyl.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/assets/agent-accounts-BZm_2WAv.js +0 -1
- package/web/dist/assets/alert-dialog-B422RI-k.js +0 -43
- package/web/dist/assets/collapsible-Cy_Fmkrd.js +0 -1
- package/web/dist/assets/commit-list-Dcnk7TnI.js +0 -1
- package/web/dist/assets/compare-variants-Ciqwvd_f.js +0 -1
- package/web/dist/assets/diff-controls-BGrXGi7O.js +0 -1
- package/web/dist/assets/dropdown-menu-dwDGT8MM.js +0 -1
- package/web/dist/assets/git-toolbar-UiHnGvE0.js +0 -1
- package/web/dist/assets/github-D-MrkbJ7.js +0 -1
- package/web/dist/assets/ibm-plex-mono-regular-BF3vfe7_.ttf +0 -0
- package/web/dist/assets/index-BszfYvBq.js +0 -7
- package/web/dist/assets/index-CWh4pKP3.css +0 -1
- package/web/dist/assets/markdown-C_IcKVQd.js +0 -2
- package/web/dist/assets/pill-BsbO6G7y.js +0 -1
- package/web/dist/assets/project-router-DbLkll25.js +0 -1
- package/web/dist/assets/prompt-templates-BlTGJB5W.js +0 -15
- package/web/dist/assets/repo-git-Bm3s6Why.js +0 -1
- package/web/dist/assets/run-header-IFyIGCey.js +0 -1
- package/web/dist/assets/skills-C-C4DVFY.js +0 -1
- package/web/dist/assets/task-changes-D2PHtWUW.js +0 -1
- package/web/dist/assets/task-commits-N5u9U0_R.js +0 -1
- package/web/dist/assets/task-files-BS7c7CFm.js +0 -2
- package/web/dist/assets/task-thread-BQFdz1dJ.css +0 -1
- package/web/dist/assets/task-thread-DGM2dZV-.js +0 -9
- package/web/dist/assets/textarea-FjaU370i.js +0 -1
- package/web/dist/assets/thread-loading-77sJ8Yu_.js +0 -1
- package/web/dist/assets/token-metrics-Clxh03bE.js +0 -1
- package/web/dist/assets/utils-PYYcpCFZ.js +0 -64
- package/web/dist/assets/workflows-Czl0ZfXH.js +0 -11
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ba as i,Br as a,Ci as o,Di as s,Dt as c,Et as l,Ga as u,H as d,Ha as f,Hn as p,Ia as m,In as h,J as g,Jt as _,Mi as v,Oa as y,Or as b,Pt as x,Q as S,Ra as C,Rn as w,Rt as T,Ui as E,Va as D,Vr as O,Wi as k,X as A,Xa as j,Y as M,Ya as N,Z as P,Zn as F,_i as ee,at as te,d as I,dr as ne,en as L,et as R,fr as re,hr as ie,ht as ae,ii as oe,in as z,it as se,jn as ce,mn as le,n as ue,nr as de,nt as fe,qa as B,qt as pe,t as me,ui as he,vi as ge,vn as _e,wa as ve,xt as ye,ya as V}from"./centered-state-DH8qtCz-.js";import{C as be,S as xe,b as Se,c as Ce,i as we,n as Te,s as Ee,t as H,v as De,w as Oe,x as ke}from"./utils-BTFBhZ55.js";import{n as U,r as Ae,t as je}from"./collapsible-De2G0xqQ.js";import{n as Me,s as Ne,t as Pe}from"./agent-accounts-CerclGiO.js";import{t as Fe}from"./textarea-ByZ-txS7.js";import{t as Ie}from"./createLucideIcon-BHp8sXmF.js";import{A as Le,M as Re,O as ze,S as Be,c as Ve,d as He,f as Ue,g as We,h as Ge,u as Ke,v as qe}from"./pill-BL6ugwXo.js";import{a as Je,c as Ye,d as Xe,f as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as at}from"./run-header-DuAWswYM.js";import{t as ot}from"./external-link-BE6y205O.js";import{L as st,S as ct,_ as lt,b as ut,c as dt,g as ft,l as pt,v as mt,x as ht}from"./prompt-templates-j8qlK7c-.js";import{s as gt,t as W,u as _t}from"./project-router-ChC5Rb-Y.js";import{t as vt}from"./message-square-B-MD-8rD.js";import{t as yt}from"./search-x-I9Q8pgUa.js";import{t as bt}from"./square-terminal-B6RYYieR.js";import{t as xt}from"./markdown-DvbymqXz.js";import{c as St,i as Ct,l as wt,n as Tt,o as Et,s as Dt,t as Ot}from"./thread-loading-DHT9p5o5.js";import{t as kt}from"./use-submit-shortcut-KWJsC906.js";import{t as At}from"./lib-BQXq3kEf.js";import{t as jt}from"./zoomable-image-Ba6y6Wyl.js";import{t as Mt}from"./run-diff-BuATgZpx.js";import{t as Nt}from"./use-desktop-BaYgO7YW.js";var Pt=120;function Ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function It(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Pt?`${t.slice(0,Pt-1)}…`:t}function G(e,...t){if(Ft(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return It(t)}}function Lt(e){if(!Ft(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return It(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return It(e.join(` `))}}function Rt(e){if(!Ft(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Ft(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function zt(e){return G(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function K(e,t){return t?`${e} ${t}`:e}function Bt(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:K(`Ran`,Lt(t)),subtitle:G(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:K(`Write`,G(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Rt(t);return{toolKind:`edit`,title:K(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:K(`Read`,G(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:K(`View image`,G(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:K(`Search`,G(t,`pattern`,`query`)),subtitle:G(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:K(`Fetch`,G(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:K(`Web search`,G(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=G(t,`subagent_type`,`subagentType`),i=G(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=G(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:G(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=G(t,`server`),n=G(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:zt(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?It(e):`Tool`,subtitle:zt(t)}}var Vt=class extends B{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:N(t,n.data),hasPreviousPage:j(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Ht(e,t){return f(e,Vt,t)}var Ut=Ie(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Wt=Ie(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Gt=Ie(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Kt=Ie(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),qt=Ie(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),q=e(t(),1),Jt=[`run-event`,`ui-event`];function Yt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function Xt(e,t={}){let[n,r]=(0,q.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,q.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=Yt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(we(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Jt)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var Zt=5,Qt=200,$t=5e3;function en(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function tn(e){let t=Ee(),n=u(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=Ht({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>E(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Zt,retry:1}),o=D({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>k(e,{signal:t}),retry:1}),s=a.isError||o.isError,c=Xt(s?e:void 0),l=a.data?.pages??[],d=l.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,q.useRef)(!1),p=(0,q.useCallback)(()=>{e===void 0||f.current||(f.current=!0,E(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>Zt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=Xt(!s&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:$t,compactAt:Qt,onCompact:p}),h=(0,q.useMemo)(()=>en(...l.map(e=>e.events)),[l]),g=(0,q.useMemo)(()=>s?c:en(h,m),[s,c,h,m]),_=(0,q.useMemo)(()=>{if(s)return c;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return en(e,g.filter(({seq:e})=>e>t))},[o.data,s,c,g]),v=(0,q.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),y=(0,q.useCallback)(async()=>{s||await n.resetQueries({queryKey:r,exact:!0})},[s,r,n]);return{visibleEvents:g,currentEvents:_,isPending:!s&&a.isPending,contextPending:!s&&o.isPending,fallback:s,hasOlder:!s&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:v,jumpToLatest:y,retainedPages:l.length}}var J=n();function nn({run:e}){let t=u(),n=i({mutationFn:()=>ee(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,J.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(Le,{tone:`pending`,pulse:!0}),(0,J.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,J.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,J.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,J.jsx)(y,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var rn=e=>e.kind===`tool`,an=e=>e.kind===`conversation`,on=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,sn=(e,t,n)=>`${e} ${e===1?t:n}`;function cn(e,t){let n=[];return e>0&&n.push(sn(e,`file`,`files`)),t>0&&n.push(sn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ln(e){return`${e} earlier tool call${e===1?``:`s`}`}var un=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dn(e){for(let t of un)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function fn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(rn).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:cn(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of pn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(an(e)){s(),c.push(e);continue}l(),rn(e)&&on(e)&&!r.has(e.id)?o.push(e):(s(),rn(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function pn(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var mn=new Map,hn=(0,q.createContext)(null);function gn(){return(0,q.useContext)(hn)}function _n({runId:e,children:t}){let n=(0,q.useMemo)(()=>({get:t=>mn.get(e)?.get(t),set:(t,n)=>{let r=mn.get(e)??new Map;r.set(t,n),mn.set(e,r)}}),[e]);return(0,J.jsx)(hn.Provider,{value:n,children:t})}var vn=(0,q.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function yn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function bn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function xn(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Sn(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Cn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var wn=new Map;function Tn(e,t){wn.set(e,t)}function En(e){return wn.get(e)}var Dn=new Map;function On(e,t){Dn.set(e,t)}function kn(e,t){let n=Dn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var An=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),jn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Mn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Nn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Pn=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Fn(e){let t=Y(e);return t===void 0?void 0:An.format(t)}function In(e){let t=Y(e);return t===void 0?void 0:jn.format(t)}var Ln=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Rn(e){let t=Y(e);return t===void 0?void 0:Ln(t)}function zn(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Ln(n);return r===Ln(t)?`Today`:r===Ln(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Mn:Nn).format(n)}function Bn(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Vn({ts:e}){let t=Fn(e);return t===void 0?null:(0,J.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:In(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Hn({startedAt:e,completedAt:t}){let n=Fn(t);if(n===void 0)return null;let r=Bn(e,t);return(0,J.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,J.jsx)(`time`,{dateTime:t,title:In(t),children:n}),r===void 0?null:(0,J.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Un({ts:e}){let t=zn(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Pn.format(n);return(0,J.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,J.jsx)(`time`,{dateTime:Rn(e),title:r,children:t}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function Wn(e,t){let n={};for(let r of[...t??[],e])n[r.id]=r.steps.find(e=>e.id===r.currentStepId)?.backend??r.runner;return n}function Gn(e,t){let n={[e.id]:r(e)};for(let e of t??[])n[e.id]=r(e);return n}function X(e,t){return t?.[e]??`Task`}function Kn(e,t){return e.senderRunId===t?`outbound`:`inbound`}function qn(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`;default:return e}}function Jn(e){switch(e){case`pending`:return`Pending`;case`replied`:return`Replied`;case`timed-out`:return`Timed out`;case`cancelled`:return`Cancelled`;case`completed-without-reply`:return`Completed without reply`;case`failed`:return`Failed`;case`destroyed`:return`Destroyed`;case`sender-closed`:return`Sender closed`;case`human-fallback`:return`Sent to a human`;default:return e}}function Yn(e){if(e.outcome)return Jn(e.outcome.status);if(e.delivery===`not-delivered`)return Xn(`not-delivered`)}function Xn(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`;default:return e}}var Zn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg`,accent:`text-message-agent-accent`,body:`max-w-[65ch] text-[15px] md:text-[14px]`}};function Qn({role:e,children:t,className:n,ts:r,...i}){let a=Zn[e];return(0,J.jsxs)(`article`,{...i,"data-role":e,"aria-label":a.speaker,className:H(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes,n),children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex w-full min-w-0 items-start justify-between gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(vt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),a.label]}),r!==void 0&&Fn(r)!==void 0?(0,J.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,J.jsx)(Vn,{ts:r})}):null]}),(0,J.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,a.body,`leading-[1.6]`),children:t})]})}function $n({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:o=`Edit message`,removeLabel:s=`Remove message`}){let c=t-n.length,[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(e),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(),v=()=>{f(e),g(void 0),u(!0)},y=async()=>{let t=d.trim();if(!t||t===e){u(!1);return}m(!0),g(void 0);try{await i?.(t),u(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},b=async()=>{m(!0),g(void 0);try{await a?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return l?(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,J.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),u(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,J.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(!1),disabled:p,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void y(),disabled:p,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:p?(0,J.jsx)(_t,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,J.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,J.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,J.jsx)(`button`,{type:`button`,"aria-label":o,onClick:v,disabled:p,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,J.jsx)(qt,{className:`size-3.5`})}):null,a?(0,J.jsx)(`button`,{type:`button`,"aria-label":s,onClick:()=>void b(),disabled:p,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,J.jsx)(_,{className:`size-3.5`})}):null]}):null,h?(0,J.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,J.jsx)(xt,{breaks:!0,children:e}),n.length>0?(0,J.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>De(e.split(`/`).pop()??``)?(0,J.jsx)(jt,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,J.jsxs)(`a`,{href:Ce(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,J.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,c>0?(0,J.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[c,` image`,c>1?`s`:``,` attached`]}):null]})}function er({text:e,ts:t}){return(0,J.jsx)(Qn,{role:`agent`,ts:t,"data-slot":`assistant-message`,children:(0,J.jsx)(xt,{children:e})})}var tr={outbound:{classes:`border-message-outbound-border bg-message-outbound-bg`,accent:`text-message-outbound-accent`},inbound:{classes:`border-message-inbound-border bg-message-inbound-bg`,accent:`text-message-inbound-accent`}},nr=`inline-flex min-h-11 max-w-full items-center break-words underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function rr({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,J.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,J.jsx)(ir,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function ir({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let i=Kn(e.messages[0]??{senderRunId:e.senderRunId},t),a=tr[i],o=cr(e.messages.map(e=>i===`outbound`?e.recipientRunId:e.senderRunId)),s=i===`outbound`?`SENT to`:`RECEIVED from`,c=`${s} ${o.map(e=>X(e,n)).join(`, `)}`,l=e.messages[0],u=l?.createdAt??l?.recordedAt,d=l?Yn(l):void 0;return(0,J.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":i,"data-kind":e.kind,className:H(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes),children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsx)(`span`,{children:s}),o.map((e,t)=>(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,J.jsx)(W,{className:nr,to:`/tasks/${e}`,"aria-label":`${s} ${X(e,n)}`,children:X(e,n)})]},e))]}),(0,J.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:qn(e.kind)}),e.messages.length===1&&d?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:d}):null]}),u!==void 0&&Fn(u)!==void 0?(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-[11px] text-soft-foreground`,children:[e.messages.length>1?`First sent`:null,(0,J.jsx)(Vn,{ts:u})]}):null]}),(0,J.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,J.jsx)(xt,{breaks:!0,children:e.text})}),[...new Set(e.messages.map(e=>e.instruction??(e.delivery===`queued`?`${r?.[e.recipientRunId]===`cursor`?`Queued for delivery. If Cursor is in a turn, delivery waits for that turn to end.`:r?.[e.recipientRunId]?`Queued for delivery. This agent can receive messages during its current turn.`:`Queued for delivery. Timing depends on the recipient agent.`} Pending messages are batched within the size limit; human questions and scheduler capacity can delay delivery.`:e.state===`continuation-required`?`Not delivered. The recipient needs a new instruction to resume. A parent can resume its owned worker with --resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0)))].map(e=>e?(0,J.jsx)(`p`,{"data-slot":`conversation-delivery-explanation`,className:`min-w-0 text-xs leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:e},e):null),e.kind===`request`&&e.messages.length>1?(0,J.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=Yn(e),i=e.createdAt??e.recordedAt;return(0,J.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(W,{className:nr,to:`/tasks/${e.recipientRunId}`,"aria-label":`${X(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:X(e.recipientRunId,n)}),r?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,J.jsx)(ar,{message:e,runId:t,taskTitles:n}),i!==void 0&&Fn(i)!==void 0?(0,J.jsx)(`span`,{className:`ml-auto whitespace-nowrap`,children:(0,J.jsx)(Vn,{ts:i})}):null]},e.id)})}):null,e.messages.length===1&&l?(0,J.jsx)(ar,{message:l,runId:t,taskTitles:n}):null,(0,J.jsx)(or,{batch:e,heading:c})]})}function ar({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,q.useContext)(vn),o=e.requestId?r.get(e.requestId):void 0,s=e.requestId?o?[o]:[]:i.get(e.messageId)??[],c=e.requestId?`request`:`reply`;return s.length===0?e.requestId||e.outcome?.replyId?(0,J.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,c,` is outside loaded history.`]}):null:s.map(e=>{let r=Kn(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(nr,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,X(i,n)]},e.message.messageId)})}function or({batch:e,heading:t}){return(0,J.jsxs)(je,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,J.jsxs)(Ae,{type:`button`,className:`inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-left text-xs font-medium text-muted-foreground hover:bg-background/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,J.jsx)(U,{children:(0,J.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>sr(e)).map((e,t)=>(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,J.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function sr(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:Xn(e.delivery)}];return e.requestId&&t.push({label:`Request`,value:e.requestId}),e.outcome?.replyId&&t.push({label:`Reply`,value:e.outcome.replyId}),e.state&&t.push({label:`State`,value:e.state}),e.createdAt&&t.push({label:`Created`,value:e.createdAt}),e.deliveredAt&&t.push({label:e.resumed?`Opening turn completed`:`Delivery acknowledged`,value:e.deliveredAt}),e.recordedAt&&t.push({label:`Event recorded`,value:e.recordedAt}),e.resumed&&t.push({label:`Continuation`,value:`Requested by parent with this instruction`}),e.deadline&&t.push({label:`Deadline`,value:e.deadline}),e.requestHash&&t.push({label:`Hash`,value:e.requestHash}),t}function cr(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function lr({note:e}){return e.icon===`handoff`?(0,J.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,J.jsx)(Xe,{className:`size-3`})}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,J.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:H(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var ur={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function dr({incident:e}){let t=ur[e.provider];return(0,J.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,J.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function fr({text:e}){let t=(0,q.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
+
`,1)[0]??``,r=n.length<e.length;return(0,J.jsxs)(je,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,J.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,J.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,J.jsx)(xt,{inline:!0,children:n})}),r?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,J.jsx)(Ae,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,J.jsx)(U,{children:(0,J.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,J.jsx)(xt,{children:e})})})]})}function pr(){return(0,J.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,J.jsx)(_t,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var mr={read:Ze,edit:qt,delete:_,move:Gt,search:T,execute:bt,think:Ut,fetch:Re,task:g,plan:c,other:L},hr=e=>e.split(`
|
|
3
|
+
`).length;function gr({text:e,streaming:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null),a=(0,q.useRef)(!0);(0,q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=hr(e),s=!t&&!n&&o>12;return(0,J.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Sn(e.currentTarget)}:void 0,className:H(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,J.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,J.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,J.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function _r({diffs:e}){return(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>(0,J.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,J.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...vr(e.oldText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...vr(e.newText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
+
`).map((e,t)=>(0,J.jsx)(yr,{text:e},t))})]},`${e.path}:${t}`))})}function vr(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
+
`)}function yr({text:e}){return(0,J.jsx)(`span`,{className:H(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function br(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function xr({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=gn(),[a,o]=(0,q.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=dn(e.title),{verb:u,detail:d}=e.toolKind===`execute`&&l.detail===void 0?{verb:`Ran`,detail:e.title}:l,f=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,p=d!==void 0||f,m=p&&(a??(f&&br(e))),h=mr[e.toolKind]??L;return(0,J.jsxs)(je,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:m,onOpenChange:s,className:H(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,J.jsxs)(Ae,{disabled:!p,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,J.jsx)(P,{"aria-hidden":!0,className:H(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!p&&`invisible`)}),(0,J.jsx)(h,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:H(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,J.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,J.jsx)(_t,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,J.jsx)(`span`,{"data-slot":`tool-exit`,className:H(`rounded-full px-2 py-px font-mono text-[11px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,J.jsx)(U,{children:(0,J.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[d===void 0?null:(0,J.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:d}),e.error!==void 0&&e.error!==``?(0,J.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,J.jsx)(_r,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,J.jsx)(gr,{text:e.output,streaming:c}):null,t.length>0?(0,J.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function Sr({group:e,scope:t}){return(0,J.jsxs)(je,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,J.jsxs)(Ae,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,J.jsx)(U,{children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,J.jsx)(xr,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Cr({count:e,children:t}){return(0,J.jsxs)(je,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,J.jsxs)(Ae,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),ln(e)]}),(0,J.jsx)(U,{children:(0,J.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function wr({image:e}){return(0,J.jsx)(jt,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function Tr(e,t=null){let n=p(),r=le(),i=Ue(e),a=i&&!e.runner,o=ve(n.data),s=e.runner??(i?r.data?.defaultRunner:void 0)??`claude`,c=ct(t,o,s),l=o.includes(s),u=(i?Se(e.workflowDef,c):[c]).filter(e=>!o.includes(e)),d=n.isSuccess&&(!a||r.isSuccess)&&u.length===0,f=a&&r.isPending?`Checking task settings…`:a&&r.isError?`Task settings could not be loaded.`:n.isPending?`Checking agent providers…`:n.isError?`Provider authentication could not be verified.`:d?void 0:i?`Connect the required workflow providers (${u.join(`, `)}) to continue.`:`Connect an agent provider to continue.`;return{runners:o,currentRunner:s,runner:c,currentRunnerConnected:l,canContinue:d,providerPending:n.isPending||a&&r.isPending,providerError:n.isError,reason:f,runnerOverride:t!==null||!l?c:void 0}}function Er(e){let t=u(),n=qe(e).continueRun,r=le(),[a,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(e.id);h!==e.id&&(g(e.id),s(null),l(null),f(null),m(null));let _=Tr(e,a),{runners:v,canContinue:y,currentRunner:b,runner:x}=_,S=ne(x,n),C=r.data?.modelsLocked===!0,w=x!==b,T=!C&&!w&&e.model?{...r.data?.defaultModels,[x]:e.model}:r.data?.defaultModels,E=C?null:c,D=mt(x,S.data,[E,T?.[x]]),O=ht(E,x,T,S.data),k=ft(x,O,S.data),A=C?``:d??e.effort??``,j=ut(A,k),M=!C&&d===null&&A!==``&&j===``,{accounts:N,repoAccount:P}=Me(),F=[...e.steps].reverse().find(e=>e.sessionId),ee=F?.profileId??e.agentProfile??`default`,I=w?P:{...P,[b]:ee},L=N.some(e=>e.provider===x&&e.id===p)?p:null,R=i({mutationFn:({text:t,images:n})=>y?o(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:_.runnerOverride,model:!C&&(c!==null||w)?O:void 0,effort:!C&&(d!==null||w)?j:M?``:void 0,agentProfile:L??void 0}):Promise.reject(Error(_.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:z.runs.all}),onError:e=>{e instanceof he&&e.status===409&&t.invalidateQueries({queryKey:z.runs.all})}});return{available:n,canContinue:y,startsNewConversation:!!F&&(x!==(F.backend??b)||(L??e.agentProfile??F.profileId??`default`)!==(F.profileId??`default`)),reason:_.reason,providerPending:_.providerPending,pills:(0,J.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`session-engine-controls`,children:[v.length>1||v.some(e=>Pe(N,e))?(0,J.jsx)(pt,{icon:(0,J.jsx)(pe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:v,value:x,accounts:N,account:L,repoAccount:I,onPick:(e,t)=>{m(t),e!==x&&(s(e),l(null))}}):(0,J.jsx)(dt,{icon:(0,J.jsx)(pe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,slot:`session-runner-value`,ariaLabel:`Runner`,label:x,value:x,onPick:()=>{},options:[{value:x,label:x}]}),(0,J.jsx)(dt,{icon:(0,J.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:D.find(e=>e.id===O)?.label??`auto`,value:O,readOnly:C,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{l(e);let t=ft(x,e,S.data);j!==``&&ut(j,t)===``&&f(``)},options:D.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:lt(x,S.data,S.isError,S.isFetching)}),(0,J.jsx)(dt,{icon:(0,J.jsx)(ae,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:k.find(e=>e.value===j)?.label??`auto`,value:j,readOnly:C,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>f(e),options:k.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]}),continueWith:(e,t)=>R.mutateAsync({text:e,images:t})}}var Dr=120,Or=e=>e!==`pending`&&e!==`running`,kr=e=>e.kind===`tool`&&e.toolKind===`task`,Z=e=>kr(e)&&e.parentItemId===void 0,Ar=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function jr(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Z(e)&&t.has(e.id)))return n;return 0}function Mr(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function Nr(e){if(e.kind===`tool`)return Pr(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
6
|
+
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return Pr(n)}}}function Pr(e){return e.length>Dr?`${e.slice(0,Dr-1).trimEnd()}…`:e}function Fr(e,t=!1){let n=zr(e,e=>e.items.some(Z));if(n===-1)return[];let r=e=>!t&&!Or(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Z);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Z)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?jr(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!Ar(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>Ir(e,c.get(e.id)??[],t))}function Ir(e,t,n){let r={id:e.id,title:dn(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=Mr(e);i!==void 0&&(r.agentType=i),n&&!Or(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=Nr(t[e]);if(n!==void 0){r.activity=n;break}}return r}function Lr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function Rr(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function zr(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function Br(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Z(e));if(i!==void 0)return Ir(i,Vr(e,t),n)}}function Vr(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Z(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)Ar(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}function Hr(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,q.useRef)(e);o.current=e;let s=(0,q.useRef)(null),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(!1),f=(0,q.useRef)(!0),p=(0,q.useRef)(0),m=(0,q.useRef)(null),h=(0,q.useRef)(null),g=(0,q.useRef)(null),_=(0,q.useCallback)(e=>{let t=s.current;if(!t)return;let n=g.current;n?n.scrollTo(e):t.scrollTop=e},[]),v=(0,q.useCallback)(()=>{let e=s.current;e&&_(e.scrollHeight-e.clientHeight)},[_]),y=(0,q.useCallback)(()=>{if(s.current){if(h.current!==e){h.current=e;let t=En(e);t&&!t.atBottom?(f.current=!1,m.current=t.top):(f.current=!0,m.current=null)}m.current===null?f.current&&v():_(m.current)}},[e,_,v]),x=(0,q.useCallback)(e=>{l(e),e&&(s.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),y())},[n,y]),S=(0,q.useCallback)(()=>{f.current&&v()},[v]),C=(0,q.useRef)(!1),w=(0,q.useRef)(0),T=(0,q.useRef)(!1),E=(0,q.useRef)(void 0),D=(0,q.useRef)(!1),O=(0,q.useRef)(!1),k=(0,q.useRef)(a);k.current=a;let A=(0,q.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),j=(0,q.useRef)(null),M=(0,q.useRef)(0);(0,q.useEffect)(()=>{if(!b())return;let e=e=>{m.current=null,M.current+=1,j.current=null,f.current=!1,_(e)};return window.__cezThreadScrollTo=e,()=>{window.__cezThreadScrollTo===e&&delete window.__cezThreadScrollTo}},[_]);let N=(0,q.useCallback)(()=>{let e=j.current,t=s.current;if(!e||!t)return;j.current=null;let n=e.beforeTop+Math.max(0,t.scrollHeight-e.beforeHeight),r=t.getBoundingClientRect().top,i=e.anchor===void 0?-1:k.current.indexOf(e.anchor.key),a=g.current;a&&i>=0?a.scrollToIndex(i,{align:`start`,offset:-e.anchor.offset}):_(xn(t.scrollTop,r,e.anchor,A(t),n))},[A,_]),P=(0,q.useCallback)(()=>{let e=s.current;if(!e||!r||C.current)return;m.current=null,f.current=!1,C.current=!0;let t=w.current+1;w.current=t;let n=e.scrollHeight,i=e.scrollTop,a=e.getBoundingClientRect().top,c=bn(a,A(e)),l=c===void 0?-1:k.current.indexOf(c.key),u=o.current,d=M.current;r().then(()=>{o.current===u&&M.current===d&&(j.current={beforeHeight:n,beforeTop:i,anchor:c,anchorIndex:l})},()=>{}).finally(()=>{w.current===t&&(C.current=!1)})},[A,r]);(0,q.useEffect)(()=>()=>clearTimeout(E.current),[]);let F=(0,q.useRef)(null);(0,q.useEffect)(()=>()=>F.current?.disconnect(),[e,c]);let ee=(0,q.useCallback)((t,n)=>{let r=s.current;if(!r||!c)return;m.current=null,M.current+=1,j.current=null,f.current=!1,p.current=0,d(!0),F.current?.disconnect();let i=()=>[...c.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===t),a=()=>{let e=i();return!e||getComputedStyle(e).visibility===`hidden`||(e.tabIndex=-1,e.focus({preventScroll:!0}),document.activeElement!==e)?!1:(F.current?.disconnect(),!0)},o=r.querySelector(`[data-slot="run-header"]`),l=o&&getComputedStyle(o).position===`sticky`?o.getBoundingClientRect().height:0,u=g.current;if(u)u.scrollToIndex(n,{align:`start`,...l>0?{offset:-l}:{}});else{let e=i();e&&_(r.scrollTop+e.getBoundingClientRect().top-r.getBoundingClientRect().top-l)}a()||(F.current=new MutationObserver(()=>{a()}),F.current.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]})),Tn(e,{top:r.scrollTop,atBottom:!1})},[c,_,e]),te=(0,q.useCallback)(()=>{F.current?.disconnect();let t=s.current;if(!t)return;m.current=null,M.current+=1,j.current=null,f.current=!0,Tn(e,{top:t.scrollHeight-t.clientHeight,atBottom:!0});let n=()=>{f.current&&v()};(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{n(),requestAnimationFrame(n)})})},[i,e,v]),I=a.at(-1),ne=a.length;return(0,q.useLayoutEffect)(()=>{M.current+=1,j.current=null,C.current=!1},[e]),(0,q.useLayoutEffect)(()=>{let e=j.current;e?(e.anchor===void 0?-1:k.current.indexOf(e.anchor.key))>e.anchorIndex?N():j.current=null:f.current&&v()},[I,ne,N,v]),(0,q.useLayoutEffect)(()=>{!s.current||!c||y()},[c,y]),(0,q.useEffect)(()=>{let t=s.current,n=c;if(!t||!n)return;p.current=0;let r=null,i=!1,a=t.scrollTop,o=()=>{F.current?.disconnect(),m.current=null,M.current+=1,j.current=null,f.current=!1,p.current=0},l=()=>{M.current+=1,j.current=null,p.current=Date.now()},u=e=>{if(e.deltaY<0){o();let e=!T.current;T.current=!0,clearTimeout(E.current),E.current=setTimeout(()=>{T.current=!1},180),e&&yn(t)&&P()}else l()},h=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(o(),!e.repeat&&yn(t)&&P()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&l()},g=()=>{i=!0,O.current=!1,a=t.scrollTop,Sn(t,80)||(o(),l())},y=()=>{i=!1},b=e=>{D.current=!1,r=e.touches[0]?.clientY??null},x=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(r!==null&&n>r+1?(o(),!D.current&&yn(t)&&(D.current=!0,P())):r!==null&&n<r-1&&l(),r=n)},S=()=>{i&&!O.current&&t.scrollTop<a&&yn(t)&&(O.current=!0,P()),a=t.scrollTop;let n=Sn(t,80);n&&m.current===null&&(f.current||Date.now()-p.current<2e3)&&(f.current=!0),d(!n),m.current===null&&Tn(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,S,{passive:!0}),t.addEventListener(`wheel`,u,{passive:!0}),t.addEventListener(`touchstart`,b,{passive:!0}),t.addEventListener(`touchmove`,x,{passive:!0}),t.addEventListener(`pointerdown`,g,{passive:!0}),window.addEventListener(`pointerup`,y,{passive:!0}),t.addEventListener(`keydown`,h);let C;if(typeof ResizeObserver<`u`){C=new ResizeObserver(()=>{let e=m.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;_(Math.min(e,n)),n>=e&&(m.current=null)}else f.current&&v()}),C.observe(n);let e=n.closest(`[data-route="task-thread"]`),r=e?.querySelector(`[data-slot="run-header"]`),i=e?.querySelector(`[data-slot="thread-dock"]`);r&&C.observe(r),i&&C.observe(i)}return()=>{t.removeEventListener(`scroll`,S),t.removeEventListener(`wheel`,u),t.removeEventListener(`touchstart`,b),t.removeEventListener(`touchmove`,x),t.removeEventListener(`pointerdown`,g),window.removeEventListener(`pointerup`,y),t.removeEventListener(`keydown`,h),C?.disconnect()}},[e,c,P,_,v]),{attachContent:x,scrollElRef:s,virtualizerRef:g,pillVisible:u,jumpToLatest:te,jumpToRow:ee,loadOlder:P,restickIfStuck:S}}function Ur({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,J.jsx)(Wr,{runId:e,rows:t,controls:r}):(0,J.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,children:t.map(e=>(0,J.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function Wr({runId:e,rows:t,controls:n}){return(0,J.jsx)(Gr,{runId:e,rows:t,controls:n},e)}function Gr({runId:e,rows:t,controls:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(t),a=t[0]?.key,o=i.current[0]?.key,s=a!==o&&(t.some(e=>e.key===o)||i.current.some(e=>e.key===a));(0,q.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,q.useState)(()=>kn(e,t.length)),l=(0,q.useRef)(t.length);l.current=t.length;let u=(0,q.useRef)(null),d=(0,q.useCallback)(t=>{n.virtualizerRef.current=t,t?u.current=t:u.current&&=(On(e,{rows:l.current,cache:u.current.cache}),null)},[e,n.virtualizerRef]),[f,p]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||p(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,J.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,className:`[overflow-anchor:none]`,children:(0,J.jsx)(At,{ref:d,scrollRef:n.scrollElRef,startMargin:f,shift:s,...c===void 0?{}:{cache:c},children:t.map(e=>(0,J.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function Kr({onJump:e}){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,J.jsx)(d,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function qr(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images,...e.userMessage.ts===void 0?{}:{ts:e.userMessage.ts}}},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.completed?.ts===void 0?{}:{completedAt:e.completed.ts},entries:e.items});return n}function Jr(e,t){return[{id:`agent:${e}`,entries:t}]}function Yr(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function Xr(e,t){let n=[],r;for(let t of e){let e=Yr(t),i=Rn(e);i!==void 0&&e!==void 0&&(r===void 0||i>r)&&(r!==void 0&&n.push({key:`${t.id}:day-separator`,scope:t.id,content:{kind:`day-separator`,ts:e}}),r=i),t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of fn([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}});t.completedAt!==void 0&&n.push({key:`${t.id}:turn-time`,scope:t.id,content:{kind:`turn-time`,completedAt:t.completedAt,...t.startedAt===void 0?{}:{startedAt:t.startedAt}}})}return n}function Zr({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c,taskTitles:l,recipientBackends:u}){let d=(0,q.useMemo)(()=>Xr(n,e),[n,e]),f=Hr(`${e}:${t}`,{surface:r}),p=s??f,m=(0,q.useMemo)(()=>{let e=new Map;d.forEach((t,n)=>{if(!(t.content.kind!==`block`||t.content.block.kind!==`worker-conversation`))for(let r of t.content.block.batches)for(let i of r.messages)e.set(i.messageId,{message:i,rowKey:t.key,rowIndex:n})});let t=new Map;for(let n of e.values()){let{message:e}=n;if(e.messageKind!==`reply`||!e.requestId)continue;let r=t.get(e.requestId)??[];r.push(n),t.set(e.requestId,r)}return{targets:e,replies:t,navigate:e=>p.jumpToRow(e.rowKey,e.rowIndex)}},[d,p.jumpToRow]),h=(0,q.useMemo)(()=>d.map(t=>({key:t.key,node:Qr(t,o?.[t.key],a,e,l,u)})),[o,a,d,e,l,u]),g=c??Cn(``,h.length),_=h.length===0?i??null:(0,J.jsx)(Ur,{runId:`${e}:${t}`,rows:h,mode:g,controls:p});return(0,J.jsx)($e,{runId:e,children:(0,J.jsx)(_n,{runId:e,children:(0,J.jsx)(vn.Provider,{value:m,children:r===`panel`?(0,J.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:_}),p.pillVisible?(0,J.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,J.jsx)(Kr,{onJump:p.jumpToLatest})}):null]}):_})})})}function Qr(e,t,n,r,i,a){switch(e.content.kind){case`user-message`:return(0,J.jsx)($r,{message:e.content.message,actions:t});case`day-separator`:return(0,J.jsx)(Un,{ts:e.content.ts});case`turn-time`:return(0,J.jsx)(Hn,{completedAt:e.content.completedAt,...e.content.startedAt===void 0?{}:{startedAt:e.content.startedAt}});case`block`:return(0,J.jsx)(ei,{block:e.content.block,scope:e.scope,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a});default:return ri(e.content)}}function $r({message:e,actions:t}){return(0,J.jsx)($n,{text:e.text,imageCount:e.imageCount,images:e.images,...e.ts===void 0?{}:{ts:e.ts},onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function ei({block:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a}){switch(e.kind){case`entry`:return(0,J.jsx)(ni,{entry:e.entry,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a});case`tool-card`:return(0,J.jsx)(xr,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,J.jsx)(ti,{entries:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a})});case`context-group`:return(0,J.jsx)(Sr,{group:e,scope:t});case`streak`:return(0,J.jsx)(Cr,{count:e.count,children:e.blocks.map(e=>(0,J.jsx)(ei,{block:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a},e.id))});case`worker-conversation`:return(0,J.jsx)(rr,{block:e,runId:r,taskTitles:i,recipientBackends:a});default:return ri(e)}}function ti({entries:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a}){return fn([...e]).map(e=>(0,J.jsx)(ei,{block:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a},e.id))}function ni({entry:e,scope:t,renderAsk:n,runId:r,taskTitles:i,recipientBackends:a}){switch(e.kind){case`message`:return e.role===`assistant`?(0,J.jsx)(er,{text:e.text,ts:e.ts}):(0,J.jsx)($n,{text:e.text,ts:e.ts});case`reasoning`:return(0,J.jsx)(fr,{text:e.text});case`tool`:return(0,J.jsx)(xr,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return e.attribution?(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,J.jsx)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:e.attribution.source===`agent`?`Agent input from parent ${e.attribution.parentRunId}`:`Worker lifecycle context for parent ${e.attribution.parentRunId}`}),(0,J.jsx)(lr,{note:e})]}):(0,J.jsx)(lr,{note:e});case`conversation`:return(0,J.jsx)(rr,{runId:r,taskTitles:i,recipientBackends:a,block:{kind:`worker-conversation`,id:e.id,batches:[{id:e.id,kind:e.messageKind,text:e.text,senderRunId:e.senderRunId,messages:[e]}]}});case`image`:return(0,J.jsx)(wr,{image:e});case`ask`:return n===void 0?(0,J.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,J.jsx)(dr,{incident:e});default:return ri(e)}}function ri(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function ii({runId:e,renderAsk:t,agent:n,entries:r,onClose:i,taskTitles:a,recipientBackends:o}){return(0,J.jsx)(Ct,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,J.jsx)(Et,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,J.jsx)(ai,{runId:e,renderAsk:t,agent:n,entries:r,taskTitles:a,recipientBackends:o})})})}function ai({runId:e,renderAsk:t,agent:n,entries:r,taskTitles:i,recipientBackends:a}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(St,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,J.jsxs)(wt,{className:`flex min-w-0 items-center gap-2 pr-8 text-[16px]`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,J.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,J.jsxs)(Dt,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(oi,{status:n.status}),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,J.jsx)(Zr,{runId:e,viewId:`agent:${n.id}`,sections:Jr(n.id,r),mode:`panel`,renderAsk:t,taskTitles:i,recipientBackends:a,empty:(0,J.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function oi({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,J.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:H(`rounded-full px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function si(e){let t=u();return i({mutationFn:()=>v(e),onSuccess:()=>t.invalidateQueries({queryKey:z.runs.all}),onError:e=>V(e.message,{tone:`danger`})})}function ci({run:e}){return(0,J.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-accent-strong/30 bg-accent-strong/10 px-3.5 py-2.5`,children:[(0,J.jsx)(st,{className:`size-4 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,J.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,J.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,J.jsx)(Mt,{runId:e.id}),(0,J.jsx)(li,{run:e})]})}function li({run:e}){let t=u(),n=(0,q.useRef)(null),[r,a]=(0,q.useState)(``),[c,l]=(0,q.useState)(null),d=si(e.id),f=Tr(e),p=()=>t.invalidateQueries({queryKey:z.runs.all}),m=i({mutationFn:async t=>f.canContinue?o(e.id,{text:`Review feedback:\n${t}`,runner:f.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),p())},onError:e=>V(e.message,{tone:`danger`})}),h=i({mutationFn:()=>s(e.id),onSuccess:e=>{V(`Draft PR created — ${e.url}`),p()},onError:e=>{e instanceof he&&e.manual!==void 0&&l(e.manual),V(e.message,{tone:`danger`})}}),g=()=>{let e=r.trim();if(e.length===0){V(`Write what to change first.`),n.current?.focus();return}m.mutate(e)};return(0,J.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(Fe,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{kt({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),g())},className:`min-h-[52px] text-[13px]`}),f.canContinue?null:(0,J.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:f.reason}),f.providerPending?null:(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(I,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:f.reason??`Send the notes back into the agent's session`,"aria-describedby":f.canContinue?void 0:`review-provider-guidance`,disabled:m.isPending||!f.canContinue,onClick:g,children:[(0,J.jsx)(Wt,{"aria-hidden":`true`}),`Send back`]}),Te(e.pullRequestUrl)?(0,J.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,J.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,J.jsx)(ot,{"aria-hidden":`true`}),`PR ↗`]})}):(0,J.jsxs)(I,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,J.jsx)(ye,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,J.jsxs)(I,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`ml-auto`,title:Ke(`review`),disabled:d.isPending,onClick:()=>d.mutate(),children:[(0,J.jsx)(M,{"aria-hidden":`true`}),`Accept`]}):null]}),c===null?null:(0,J.jsx)(ui,{command:c})]})}function ui({command:e}){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>V(`Command copied to clipboard.`)).catch(()=>V(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,J.jsx)(se,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function di(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var fi=1500;function pi({status:e}){let t=(0,q.useRef)(e),[n,r]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||di())return;r(!0);let i=setTimeout(()=>r(!1),fi);return()=>clearTimeout(i)},[e]),n?(0,J.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,J.jsx)(ue,{}),(0,J.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,J.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}function mi(e){let t=u(),[n,r]=(0,q.useState)(),a=He(e.status);(0,q.useEffect)(()=>{(!a||n&&n!==e.id)&&r(void 0)},[a,e.id,n]);let o=i({mutationFn:async()=>{r(e.id);try{if(!(await ge(e.id)).cancelled)throw Error(`The task changed before Stop was accepted. Check its status and retry.`)}catch(e){throw r(void 0),e}},onSettled:()=>t.invalidateQueries({queryKey:z.runs.all})});return{stopping:!!e.stopping||o.isPending||a&&n===e.id,stop:()=>o.mutateAsync()}}function hi({agents:e,onSelect:t}){return e.length===0?null:(0,J.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map(e=>(0,J.jsx)(gi,{agent:e,onSelect:t},e.id))})}function gi({agent:e,onSelect:t}){let n=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_i,{status:e.status,stalled:e.stalled===!0}),(0,J.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,J.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,J.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:Rr(e)}),(0,J.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,J.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,J.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function _i({status:e,stalled:t=!1}){return t?(0,J.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,J.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,J.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,J.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}function vi(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function yi({entries:e}){return e.length===0?null:(0,J.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map((e,t)=>(0,J.jsx)(bi,{entry:e},`${t}:${e.content}`))})}function bi({entry:e}){return(0,J.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:H(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,J.jsx)(xi,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,J.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function xi({status:e}){return e===`cancelled`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,J.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,J.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,J.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,J.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,J.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,J.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}var Si={"not-delivered":0,queued:1,delivered:2,consumed:3};function Ci(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function wi(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function Ti(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function Ei(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Di(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function Q(e){return typeof e==`string`?e:void 0}function $(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Oi(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`||e===`cursor`?e:void 0}function ki(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+[\s\S]*$/,``)),n.includes(`CEZ:`)?n.split(`
|
|
7
|
+
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
8
|
+
`):n}function Ai(e){let t=e=>ki(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function ji(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var Mi=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,Ni=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Pi(e){if(!Ei(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Ei(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:Ni.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function Fi(e,t={}){let n=[],r=new Map,i,a=0,o,s=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=Q(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n,i)=>{let a=t.kind===`message`&&i!==void 0?{...t,ts:i}:{...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let o=r.get(n);if(o&&o.turn===e){o.entry.entry=a,r.set(n,o);return}let s={origin:`v2`,entry:a};e.entries.push(s),r.set(n,{turn:e,entry:s})},d=new Map,f=new Map,p=new Set,m=e=>{if(e.messageKind!==`request`)return;let t=f.get(e.messageId);t&&(e.outcome={status:t.status,...t.replyId===void 0?{}:{replyId:t.replyId},observedAt:t.observedAt})},h=(e,t,n)=>{let r=d.get(e.id);if(r)return(Si[r.delivery]<Si.delivered||Si[t]>Si[r.delivery])&&(r.delivery=t),e.text!==``&&(r.text=e.text),e.state!==void 0&&(r.state=e.state),e.createdAt!==void 0&&(r.createdAt=e.createdAt),e.requestHash!==void 0&&(r.requestHash=e.requestHash),e.deadline!==void 0&&(r.deadline=e.deadline),e.requestId!==void 0&&(r.requestId=e.requestId),e.instruction!==void 0&&(r.instruction=e.instruction),e.resumed!==void 0&&(r.resumed=e.resumed),n?.deliveredAt!==void 0&&(r.deliveredAt=n.deliveredAt),n?.consumedAt!==void 0&&(r.consumedAt=n.consumedAt),n?.recordedAt!==void 0&&(t===`delivered`||r.delivery!==`delivered`)&&(r.recordedAt=n.recordedAt),m(r),r;let i={kind:`conversation`,id:`conversation-message:${e.id}`,messageId:e.id,text:e.text,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,messageKind:e.kind,delivery:t,...n,...e.instruction===void 0?{}:{instruction:e.instruction},...e.resumed===void 0?{}:{resumed:e.resumed},...e.requestId===void 0?{}:{requestId:e.requestId},...e.state===void 0?{}:{state:e.state},...e.createdAt===void 0?{}:{createdAt:e.createdAt},...e.requestHash===void 0?{}:{requestHash:e.requestHash},...e.deadline===void 0?{}:{deadline:e.deadline}};return m(i),d.set(e.id,i),c().entries.push({origin:`meta`,entry:i}),i},g=!1;for(let t of e)switch(t.type){case`handoff`:{let e=Di(t.ts),n=Q(t.message),r=t.notify===!1?`Stopped notifying the webhook${e}`:`${g?`Note sent to webhook`:`Handed off to webhook`}${e}${n?` — ${n}`:``}`;g=t.notify!==!1,c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`,icon:`handoff`}});break}case`webhook.failed`:{let e=typeof t.attempts==`number`?t.attempts:void 0,n=`Webhook delivery failed${Q(t.event)?` (${Q(t.event)})`:``}${e?` after ${e} attempt${e===1?``:`s`}`:``}: ${Q(t.error)??`unknown error`}`;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:n,tone:`danger`}});break}case`webhook.dry-run`:{let e=t.payload??{},n=`Webhook (dry run, nothing sent): ${Q(t.event)??`delivery`}${Q(e.status)?` · ${Q(e.status)}`:``}`;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:n,tone:`dim`}});break}case`conversation-message`:{let e=be.safeParse(t);if(!e.success)break;h(e.data.message,e.data.delivery,{deliveredAt:e.data.deliveredAt,consumedAt:e.data.consumedAt,recordedAt:e.data.ts});break}case`request-outcome`:{let e=Oe.safeParse(t);if(!e.success||f.has(e.data.outcome.requestId))break;let{outcome:n}=e.data;f.set(n.requestId,n);let r=d.get(n.requestId);r&&m(r);break}case`agent-input`:{let e=xe.safeParse(t);if(!e.success)break;let{input:n}=e.data;if(p.has(n.id))break;if(p.add(n.id),n.conversation){h({id:n.id,text:n.text,createdAt:n.createdAt,...n.conversation},`delivered`,{deliveredAt:n.deliveredAt,recordedAt:e.data.ts});break}c().entries.push({origin:`meta`,entry:{kind:`note`,id:`agent-input:${n.id}`,text:n.text,tone:`dim`,attribution:{source:n.source,parentRunId:n.parentRunId}}});break}case`user-message`:{let e=Q(t.text)??``;o&&!o.resolved&&(o.resolved=!0,o.answeredBy=`human`,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq),r=$(t.ts);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...r===void 0?{}:{ts:r}},r!==void 0&&(n.startedAt=r);break}case`turn.started`:{let e=Q(t.turnId),r=n.at(-1),i=r&&r.turnId===void 0&&!r.v2Items?r:s(t.seq);i.turnId=e;let a=$(t.ts);i.startedAt===void 0&&a!==void 0&&(i.startedAt=a);break}case`turn.completed`:{let e=Q(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);if(i){let e=$(t.ts);i.completed={stopReason:Q(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...e===void 0?{}:{ts:e}}}break}case`item.started`:case`item.updated`:case`item.completed`:{if(!Ei(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a,t.type===`item.completed`?$(t.ts):void 0);break}case`item.delta`:{let e=Q(t.itemId)??``,n=r.get(l(t,e)),i=Q(t.delta)??``;if(!n||i===``||!Mi(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=Q(t.text)??``;if(n===``)break;let r=$(t.ts);e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n,...r===void 0?{}:{ts:r}}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=Q(t.tool)??`Tool`;if(Ii.has(n))break;let i=Bt(n,t.input);if(i.toolKind===`plan`){let n=Pi(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:Q(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get(Q(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=ji(t.result);break}case`note`:case`lifecycle`:{let e=Q(t.message)??``;if(e===``)break;let n=t.tone===`danger`?`danger`:`dim`;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:n}});break}case`error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=Q(t.error)?` — ${Q(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${Q(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=Q(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:Q(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=Oi(t.provider),n=Q(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=Q(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=Q(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:Q(t.reason)??`end_turn`,...Q(t.message)===void 0?{}:{message:Q(t.message)}};break;case`ask.requested`:{let e=Q(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>Ei(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1,askSeq:t.seq};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`worker-question-routed`:if(o&&!o.resolved&&o.askSeq===t.askSeq){o.routedToParent=!0;let e=Q(t.parentRunId);e!==void 0&&(o.parentRunId=e)}break;case`worker-question-fallback`:o&&!o.resolved&&o.askSeq===t.askSeq&&(o.routedToParent=!1);break;case`human-input-delivered`:t.source===`parent`&&o&&!o.resolved&&o.askSeq===t.askSeq&&(o.resolved=!0,o.answeredBy=`parent`,o=void 0);break;case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(ki(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(ki(e.entry.text,!0).trim()))),Ai(e))}for(let e of d.values())e.messageKind!==`request`||e.outcome!==void 0||e.delivery!==`not-delivered`&&(e.state!==void 0&&e.state!==`accepted`||(e.outcome={status:`pending`}));return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:ki(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var Ii=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]),Li=new Map,Ri=new Map;function zi({run:e,currentThread:t,onOpenWorker:n}){let r=Nt(),[i,a]=(0,q.useState)(()=>Li.get(e.id)??r),[o,s]=(0,q.useState)({}),u=!(e.status===`running`||e.status===`waiting`)&&e.status!==`queued`,d=e.steps,f=(0,q.useMemo)(()=>Fr(t.turns,u),[t.turns,u]),p=Ci(t)??[],m=e.delegation!==void 0&&e.delegation.role!==`invalid`,h=tt(e),_=d.length===0||d.every(e=>e.status===`done`||e.status===`skipped`),v=Lr(f),y=vi(p),b=[d.length>0?`workflow`:void 0,f.length>0?`subagents`:void 0,m?`workers`:void 0,p.length>0?`plan`:void 0].filter(e=>e!==void 0);if(b.length===0)return null;let x=t=>o[t]??Ri.get(`${e.id}:${t}`)??t===`workers`,C=t=>{let n=!x(t);Ri.set(`${e.id}:${t}`,n),s(e=>({...e,[t]:n}))},w=e.status===`done`&&_&&h===`complete`&&v.done===v.total&&y.done===y.total,T=h===`pending`,E=w?`All complete`:e.status===`failed`?`Failed`:e.status===`cancelled`?`Cancelled`:e.status===`running`?`Working`:e.status===`done`?h===`unknown`?`Workers unavailable`:T?`In progress`:`Incomplete`:`In progress`,D=e.status===`failed`||e.status===`cancelled`;return(0,J.jsxs)(`section`,{"data-slot":`run-activity-dock`,"data-state":i?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>{Li.set(e.id,!i),a(!i)},className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-left text-[14px] hover:bg-muted/40`,children:[(0,J.jsx)(l,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,J.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Run activity`}),(0,J.jsxs)(`span`,{"data-slot":`run-activity-count`,className:`shrink-0 text-[13px] text-muted-foreground tabular-nums`,children:[`· `,b.length,` `,b.length===1?`section`:`sections`]}),(0,J.jsxs)(`span`,{"data-slot":`run-activity-status`,className:H(`ml-auto flex min-w-0 shrink items-center gap-1.5 truncate text-[13px]`,w?`text-success`:D?`text-danger`:`text-muted-foreground`),children:[w?(0,J.jsx)(S,{"aria-hidden":!0,className:`size-3.5 shrink-0`}):null,(0,J.jsx)(`span`,{className:`truncate`,children:E})]}),(0,J.jsx)(A,{"aria-hidden":!0,className:H(`size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[d.length>0?(0,J.jsx)(rt,{slot:`workflow`,icon:(0,J.jsx)(Bi,{steps:d}),title:d[nt(d)].name,meta:Ye(nt(d)+1,d.length,r,`step`),open:x(`workflow`),onToggle:()=>C(`workflow`),children:(0,J.jsx)(et,{steps:d})}):null,f.length>0?(0,J.jsx)(rt,{slot:`subagents`,icon:(0,J.jsx)(g,{className:`size-4`}),title:`Subagents`,meta:Ye(v.done,v.total,r),open:x(`subagents`),onToggle:()=>C(`subagents`),children:(0,J.jsx)(hi,{agents:f,onSelect:n})}):null,m?(0,J.jsx)(Je,{run:e,open:x(`workers`),onToggle:()=>C(`workers`)}):null,p.length>0?(0,J.jsx)(rt,{slot:`plan`,icon:(0,J.jsx)(c,{className:`size-4`}),title:`Plan`,meta:Ye(y.done,y.total,r),open:x(`plan`),onToggle:()=>C(`plan`),children:(0,J.jsx)(yi,{entries:p})}):null]}):null]})}function Bi({steps:e}){let t=Qe(e[nt(e)].status),n=`size-4 shrink-0`;switch(t){case`active`:return(0,J.jsx)(_t,{role:`status`,"aria-label":`Step running`,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,J.jsx)(fe,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-danger`)});case`pending`:return(0,J.jsx)(R,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-soft-foreground`)});case`done`:return(0,J.jsx)(S,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-success`)})}}function Vi(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Hi({ask:e,run:t}){return e.resolved?(0,J.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`text-soft-foreground`,children:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),e.answer?(0,J.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):e.routedToParent?(0,J.jsx)(Ui,{ask:e}):(0,J.jsx)(Wi,{ask:e,run:t})}function Ui({ask:e}){return(0,J.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-routed":`parent`,className:`rounded-lg border border-border bg-card px-4 pt-3.5 pb-3.5`,children:[(0,J.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`})}),(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,J.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,J.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,J.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,J.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,J.jsxs)(`li`,{className:`break-words`,children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,J.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))})]},e.id??t))}),(0,J.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`mt-3 text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,J.jsx)(W,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]})]})}function Wi({ask:e,run:t}){let n=Ve(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,q.useState)({}),[c,l]=(0,q.useState)({}),u=(e,t)=>s(n=>({...n,[e]:t})),d=e=>l(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),f=e=>{u(e,[]),l(t=>({...t,[e]:t[e]??``}))},p=i.some((e,t)=>c[t]!==void 0),m=i.every((e,t)=>(o[t]?.length??0)>0||!!c[t]?.trim()),h=()=>void n.send(i.map((e,t)=>Vi(e,o[t]??[],c[t])).join(`
|
|
9
|
+
`)),g=n.mode===`resume`;return(0,J.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-accent-strong/25 bg-accent-strong/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,J.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking`})}),(0,J.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,J.jsx)(Gi,{question:e,disabled:n.isPending||r,selected:o[t]??[],isOther:c[t]!==void 0,otherAnswer:c[t]??``,onSelect:i=>{r||(d(t),a?n.send(Vi(e,i)):u(t,i))},onOtherToggle:()=>{r||(c[t]===void 0?f(t):d(t))},onOtherChange:e=>l(n=>({...n,[t]:e}))},e.id??t))}),a&&!p?g?(0,J.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,J.jsx)(I,{size:`sm`,className:`min-h-11`,disabled:n.isPending||r||!m,onClick:h,children:g?`Send answer & reopen`:`Send answer`}),(0,J.jsx)(`span`,{"data-slot":g?`ask-resume-hint`:`ask-hint`,className:`text-[11px] text-soft-foreground`,children:g?`the session has ended — sending reopens it`:p?`${i.length>1?`answer each question above`:`enter your answer above`} — or type a reply below`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,J.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:n.reason}),(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,J.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,J.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function Gi({question:e,disabled:t,selected:n,isOther:r,otherAnswer:i,onSelect:a,onOtherToggle:o,onOtherChange:s}){let c=(0,q.useId)(),l=e.multiSelect===!0,u=e=>{if(!l){a([e]);return}a(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,J.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,J.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`rounded-md bg-accent-strong px-1.5 py-0.5 text-[12px] font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),l?(0,J.jsx)(`span`,{className:`ml-auto text-[11px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,J.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,J.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>u(e.label),className:H(`flex min-h-11 w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-accent-strong/50 hover:bg-accent-strong/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong/60 bg-accent-strong/[0.06]`:`border-border bg-card`),children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[14px] font-semibold text-foreground`,children:[l?(0,J.jsx)(`span`,{"aria-hidden":!0,className:H(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})}),(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(I,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?c:void 0,disabled:t,onClick:o,className:H(`w-full justify-start text-left`,r&&`border-accent-strong/60 bg-accent-strong/[0.06]`),children:`Other`}),r?(0,J.jsxs)(`div`,{className:`mt-2.5`,children:[(0,J.jsx)(`label`,{htmlFor:c,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,J.jsx)(Fe,{id:c,rows:2,value:i,disabled:t,onChange:e=>s(e.target.value),className:`bg-card`})]}):null]})]})}var Ki=2e3;function qi(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Ji(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`turn-end`&&r.seq>t&&(t=r.seq),(r.type===`turn.started`||r.type===`session.started`||r.type===`user-message`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Yi(e,t){let n=u(),r=(0,q.useMemo)(()=>qi(t),[t]),i=(0,q.useMemo)(()=>Ji(t),[t]),a=e?.id,o=e?.status,s=e?.activity;(0,q.useEffect)(()=>{if(!(r!==0&&(o===`running`||o===`waiting`))&&!(i!==0&&o===`running`&&s!==`monitoring`)||a===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:z.runs.detail(a)}),n.invalidateQueries({queryKey:z.runs.list()})},Ki);return()=>clearTimeout(e)},[r,i,a,o,s,n])}function Xi(){let{id:e}=C(),t=de(e),n=tn(e),r=t.data?.status,i=(0,q.useMemo)(()=>Fi(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,q.useMemo)(()=>Fi(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,q.useRef)(void 0),s=(0,q.useCallback)(e=>{o.current=e},[]),{mutate:c}=ce();if((0,q.useEffect)(()=>{t.data&&o.current!==t.data.id&&ze(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Yi(t.data,n.visibleEvents),t.isPending)return(0,J.jsx)(Ot,{});if(t.isError){let e=t.error instanceof he&&t.error.status===404;return(0,J.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(me,{icon:e?(0,J.jsx)(yt,{}):(0,J.jsx)(Kt,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,J.jsx)(I,{asChild:!0,variant:`outline`,children:(0,J.jsx)(W,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,J.jsx)(Ot,{}):(0,J.jsx)(Zi,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}function Zi({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){gt();let o=re(),s=r?ke(r.currentEvents)!==void 0:n.turns.some(e=>e.items.some(e=>e.kind===`ask`&&!e.resolved)),c=oe(e,s),l=Ti(e.status,e.error),u=e.status===`running`||e.status===`waiting`,d=!u&&e.status!==`queued`,f=e.status===`queued`,p=Er(e),g=mi(e),_=si(e.id),v=s||e.hasPendingHumanAsk===!0,y=!u&&!f&&p.available,b=y&&p.canContinue,[x,S]=(0,q.useState)(void 0),[C,T]=(0,q.useState)(e.id);C!==e.id&&(T(e.id),S(void 0));let E=(0,q.useMemo)(()=>x===void 0?void 0:Br(n.turns,x,d),[n.turns,x,d]),D=(0,q.useMemo)(()=>x===void 0?[]:Vr(n.turns,x),[n.turns,x]),k=ie(e.id),A=Ve(e),j=Be(e),M=u&&!j.usable,N=y&&!p.canContinue,P=M||N,ee=M?j.reason:p.reason,{mutateAsync:te}=h(e.id),{mutateAsync:I}=_e(e.id),{mutateAsync:ne}=F(e.id),L=(0,q.useMemo)(()=>f?{onEditTask:async e=>{await te({task:e})},onEditMessage:(e,t)=>I({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ne(e).then(()=>void 0)}:void 0,[f,te,I,ne]),R=(0,q.useMemo)(()=>qr(e,t),[e,t]),ae=(0,q.useMemo)(()=>Xr(R,e.id),[R,e.id]),z=(0,q.useMemo)(()=>Gn(e,o.data),[e,o.data]),se=(0,q.useMemo)(()=>Wn(e,o.data),[e,o.data]),ce=(0,q.useCallback)(t=>(0,J.jsx)(Hi,{ask:t,run:e}),[e]),le=(0,q.useMemo)(()=>{if(L===void 0)return;let t={task:{onEdit:L.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>L.onEditMessage(n.id,e),onRemove:()=>L.onRemoveMessage(n.id)};return t},[L,e.queuedMessages]),ue=a(e,w()),{search:de}=m(),fe=Cn(de,ae.length),B=Hr(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:ae.map(({key:e})=>e)});return Ne(B.restickIfStuck),(0,J.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(it,{run:e,hasPendingHumanAsk:s,onMarkedUnread:()=>i?.(e.id)}),(0,J.jsxs)(`div`,{"data-slot":`session-conversation`,className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-[18px] py-3 md:gap-3.5 md:px-16 md:py-5`,children:[r?(0,J.jsx)(Qi,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:B.loadOlder}):null,(0,J.jsx)(Zr,{runId:e.id,viewId:`main`,sections:R,mode:`document`,renderAsk:ce,messageActions:le,scrollControls:B,renderMode:fe,taskTitles:z,recipientBackends:se}),t.turns.length===0?e.status===`queued`?(0,J.jsx)($i,{run:e}):(0,J.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`&&e.activity!==`monitoring`?(0,J.jsx)(pr,{}):null,l&&l.state===`closed`?(0,J.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":l.state,className:H(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,l.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[l.label,Te(O(e))?(0,J.jsx)(`a`,{"data-slot":`pr-link`,href:O(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,Te(ue)?(0,J.jsx)(`a`,{"data-slot":`issue-link`,href:ue,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,J.jsx)(ci,{run:e}):null]}),(0,J.jsx)(pi,{status:e.status}),(0,J.jsx)(ii,{runId:e.id,renderAsk:ce,agent:E,entries:D,taskTitles:z,recipientBackends:se,onClose:()=>S(void 0)}),(0,J.jsxs)(`div`,{"data-slot":`thread-dock`,className:`relative z-10 bg-background pt-1 pb-2 md:pt-1.5 md:pb-4`,children:[B.pillVisible?(0,J.jsx)(`div`,{className:`pointer-events-none fixed right-6 bottom-[calc(24px+env(safe-area-inset-bottom))] z-30 flex justify-center`,children:(0,J.jsx)(Kr,{onJump:B.jumpToLatest})}):null,(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-1.5 px-[14px] md:gap-2.5 md:px-16`,children:[(0,J.jsx)(zi,{run:e,currentThread:n,onOpenWorker:S},e.id),(0,J.jsx)(nn,{run:e}),e.status===`waiting`?(0,J.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(Le,{tone:c.tone,pulse:c.pulse}),c.bucket===`waiting`?`The agent is paused, waiting for your reply`:`${c.label.charAt(0).toUpperCase()}${c.label.slice(1)} — you can send a message to resume`]}):null,f?(0,J.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(Le,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,b&&p.startsNewConversation?(0,J.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null,(0,J.jsx)(Tt,{onStop:qe(e).cancel?g.stop:void 0,onFinish:Ge(e,s)?()=>_.mutateAsync().catch(()=>void 0):void 0,finishing:_.isPending,secondaryAction:qe(e).archive?(0,J.jsx)(at,{run:e,compactOnMobile:!0}):void 0,stopOnEmpty:e.status===`queued`||e.status===`running`||e.status===`waiting`&&c.bucket===`none`&&!v,stopping:g.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:b?`Continuing…`:`Sending…`,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:b?p.pills:void 0,onSubmit:b?(e,t)=>p.continueWith(e,t):f?(e,t)=>k.mutateAsync({text:e,images:t}):async(e,t)=>{let n=await A.send(e,t);if(n!==void 0)throw Error(n)},disabled:P||!u&&!f&&!b,disabledReason:P?ee:`Session closed — no session to resume.`,footerEnd:P&&!p.providerPending?(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:b&&!v,emptySubmitLabel:b&&!v?`Continue`:void 0,placeholder:f?`Add to the prompt — sent when the run starts…`:b?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>wi(t)})]})]}),(0,J.jsx)(`div`,{"data-slot":`thread-tail-anchor`,"aria-hidden":`true`,className:`h-px shrink-0 md:hidden`})]})}function Qi({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,J.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,J.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,J.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function $i({run:e}){let t=We(re().data??[],e.id);return(0,J.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,J.jsx)(Le,{tone:`pending`,pulse:!0}),(0,J.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,J.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Xi as TaskThreadRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{_ as n,d as r,f as i,g as a,h as o,m as s,p as c,tn as l,v as u}from"./centered-state-DH8qtCz-.js";import{t as d}from"./utils-BTFBhZ55.js";e();var f=t();function p({...e}){return(0,f.jsx)(i,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(n,{"data-slot":`dialog-portal`,...e})}function h({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:d(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function g({className:e,children:t,showCloseButton:n=!0,...r}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(h,{}),(0,f.jsxs)(s,{"data-slot":`dialog-content`,className:d(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,f.jsxs)(c,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(l,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function _({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:d(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function v({className:e,showCloseButton:t=!1,children:n,...i}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:d(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...i,children:[n,t&&(0,f.jsx)(c,{asChild:!0,children:(0,f.jsx)(r,{variant:`outline`,children:`Close`})})]})}function y({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:d(`text-lg leading-none font-semibold`,e),...t})}function b({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:d(`text-sm text-muted-foreground`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(`textarea`,{"data-slot":`textarea`,className:d(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-base shadow-none transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{v as a,b as i,p as n,_ as o,g as r,y as s,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,G as i,Ga as a,Gt as o,Or as s,Pt as ee,X as te,Y as ne,_ as c,br as re,d as l,f as ie,g as ae,gr as oe,h as u,ia as se,in as ce,m as d,p as f,qt as le,t as ue,tn as de,v as fe,y as pe,ya as p}from"./centered-state-DH8qtCz-.js";import{_ as me,g as m,t as h,y as he}from"./utils-BTFBhZ55.js";import{a as ge,i as _e,r as ve}from"./agent-accounts-CerclGiO.js";import{D as ye,I as be,M as xe,N as Se,r as Ce}from"./prompt-templates-j8qlK7c-.js";import{u as we}from"./project-router-ChC5Rb-Y.js";import{i as Te,n as Ee,r as De,t as Oe}from"./skills-DFBiAuJG.js";import{t as ke}from"./use-submit-shortcut-KWJsC906.js";var g=n(),_=e(t(),1);function Ae(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function je(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function v(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target)&&!je(e.target))}function Me(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{v(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Ne(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target))}function y(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function b(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{Ne(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function x({...e}){return(0,g.jsx)(ie,{"data-slot":`sheet`,...e})}function Pe({...e}){return(0,g.jsx)(pe,{"data-slot":`sheet-trigger`,...e})}function Fe({...e}){return(0,g.jsx)(f,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,g.jsx)(c,{"data-slot":`sheet-portal`,...e})}function Ie({className:e,...t}){return(0,g.jsx)(ae,{"data-slot":`sheet-overlay`,className:h(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function C({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,g.jsxs)(S,{children:[(0,g.jsx)(Ie,{className:i}),(0,g.jsxs)(d,{"data-slot":`sheet-content`,className:h(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,g.jsxs)(f,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,g.jsx)(de,{className:`size-4`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Le({className:e,...t}){return(0,g.jsx)(`div`,{"data-slot":`sheet-header`,className:h(`flex flex-col gap-1.5 p-4`,e),...t})}function Re({className:e,...t}){return(0,g.jsx)(fe,{"data-slot":`sheet-title`,className:h(`font-semibold text-foreground`,e),...t})}function w({className:e,...t}){return(0,g.jsx)(u,{"data-slot":`sheet-description`,className:h(`text-sm text-muted-foreground`,e),...t})}function T(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(s())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var E={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function ze(e){return me(e.type)?e.type:E[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function Be(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=ze(e)??`application/octet-stream`,a=he(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${m(i)}`),isImage:a}}function Ve(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(ze(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var He=new Set([`/`,`@`]);function Ue(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(He.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function We(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Ge(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function D(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ke(e){let[t,n]=_.useState(null),r=_.useRef(null),i=_.useRef(``),[a]=_.useState(()=>Ge()!==void 0),o=_.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return _.useEffect(()=>o,[o]),{supported:a,recording:t,start:_.useCallback(()=>{if(r.current)return;let t=Ge();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=D(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:_.useCallback(()=>o(),[o]),finish:_.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function O(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var qe=new Map,Je={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Ye({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:s,finishing:c=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:f=!1,idleFeedback:ue,pendingLabel:fe=`Starting task…`,failureHint:pe=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:me=!0,onPendingChange:m,value:he,onValueChange:we,autoFocus:je=!1,mobileCollapsible:v=!1,mobileDisclosureKey:Me,footerStart:Ne,footerEnd:y,sessionControls:b,executionOptions:x,agentOptions:Pe,sendAriaLabel:Fe=`Send`,disabled:S=!1,disabledReason:Ie=`Session closed — Continue to reopen.`,allowEmptySubmit:C=!1,placeholder:Le=`Reply — / for skills, @ for files…`,ariaLabel:Re=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:T=!1,getMentionCandidates:E,ref:ze}){let[He,Ge]=(0,_.useState)(``),D=he??He,O=(0,_.useRef)(D);O.current=D;let Ye=(0,_.useRef)(we);Ye.current=we;let k=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;Ge(t),Ye.current?.(t)},[]),[A,j]=(0,_.useState)([]),Qe=(0,_.useRef)(A);Qe.current=A;let[$e,et]=(0,_.useState)(!1),M=u||$e,N=(0,_.useRef)(M);N.current=M;let P=D.trim()!==``||A.length>0,tt=!P&&(n!==void 0&&ae||M),nt=!P&&!tt&&s!==void 0,rt=tt||nt||!P&&d!==void 0,it=!P&&d?d:Fe,[F,I]=(0,_.useState)(!1),L=(0,_.useRef)(!1),at=(0,_.useRef)(0),R=(0,_.useRef)(!0);(0,_.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]);let[z,B]=(0,_.useState)(null),V=M||t&&F,H=()=>N.current||t&&L.current,[U,W]=(0,_.useState)(null),[ot,st]=(0,_.useState)(``),[ct,lt]=(0,_.useState)(!1),G=(0,_.useRef)(null),K=(0,_.useId)(),ut=(0,_.useId)(),dt=(0,_.useRef)(new Map),ft=Me===void 0?dt.current:qe,pt=Me??`default`,[,mt]=(0,_.useReducer)(e=>e+1,0),q=ft.get(pt)??!1,ht=v&&!q,gt=(0,_.useRef)(null),_t=(0,_.useRef)(null),J=(0,_.useRef)(null),vt=oe(w&&ct),Y=re(),yt=a(),X=Ke(e=>p(e,{tone:`danger`}));(0,_.useEffect)(()=>{je&&G.current?.focus()},[]),(0,_.useImperativeHandle)(ze,()=>({insertAtCaret:e=>{if(H())return;let t=G.current,n=Ce(O.current,t?.selectionStart??O.current.length,e);k(n.text),J.current=n.caret,t?.focus()}}),[k,t]);let bt=(0,_.useCallback)(()=>{let e=G.current;if(!e||S||H()){W(null);return}let t=Ue(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&E===void 0)return W(null);t?.trigger===`/`&<(!0),W(t)},[w,S,E,t]),Z=(0,_.useMemo)(()=>U===null?[]:U.trigger===`/`?Ee(vt.data??[],U.query,Y.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:Te(e)})):(E?.()??[]).filter(e=>De(e,U.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[E,vt.data,U,Y.data?.skillUsage]),Q=Z.some(e=>e.value===ot)?ot:Z[0]?.value,xt=U!==null;(0,_.useLayoutEffect)(()=>{!xt||!Q||[..._t.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===Q)?.scrollIntoView({block:`nearest`})},[Q,xt]);let St=(0,_.useCallback)(()=>W(null),[]),Ct=e=>{let t=G.current;if(!t||U===null||H())return;let n=t.selectionStart??t.value.length,r=We(t.value,U,n,e.insert);U.trigger===`/`&&Y.data!==void 0&&se({skillUsage:Oe(Y.data.skillUsage,e.insert)}).then(()=>yt.invalidateQueries({queryKey:ce.uiState})).catch(()=>{}),k(r.text),J.current=r.caret,W(null),t.focus()};(0,_.useLayoutEffect)(()=>{let e=J.current,t=G.current;e!==null&&t&&(t.setSelectionRange(e,e),J.current=null)},[D]),(0,_.useLayoutEffect)(()=>{let e=G.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D,q]);let wt=(0,_.useCallback)(e=>{if(S||H())return;let n=at.current,r=Ve(e,Qe.current.length);for(let e of r.rejected)p(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!R.current||t&&L.current&&!N.current||n!==at.current||j(t=>t.length>=4?t:[...t,e])},()=>p(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[S,t]),Tt=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),wt(t))},Et=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),wt(t))},$=(0,_.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(S||u||L.current)&&!(a===``&&r.length===0&&!C)){L.current=!0,t&&(at.current+=1),I(!0),B(null),m?.(!0),W(null),i&&!t&&(k(``),j([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),R.current&&t&&me&&(O.current===n&&k(``),Qe.current===r&&j([]))}catch(e){if(!R.current&&t)return;let a=e instanceof Error?e.message:String(e);t?B(a):(p(a,{tone:`danger`}),i&&(k(e=>e===``?n:`${n}\n${e}`),j(e=>[...r,...e].slice(0,4))))}finally{L.current=!1,R.current&&(m?.(!1),I(!1))}}},[C,S,u,e,t,me,m,k]),Dt=(0,_.useCallback)(()=>{S||u||L.current||$(O.current,Qe.current,!0)},[S,u,$]),Ot=async()=>{if(!(!n||u||L.current)){L.current=!0,I(!0),et(!0),B(null);try{await n()}catch(e){R.current&&B(e instanceof Error?e.message:String(e))}finally{L.current=!1,R.current&&(I(!1),et(!1))}}},kt=e=>{if(xt){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Z.length===0)return;let t=Z.findIndex(e=>e.value===Q),n=e.key===`ArrowDown`?1:-1,r=Z[(t+n+Z.length)%Z.length];st(r.value);return}if(e.key===`Escape`){e.preventDefault(),St();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Z.find(e=>e.value===Q);if(t){e.preventDefault(),Ct(t);return}St()}}ke({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Dt())};(0,_.useEffect)(()=>{if(!T||S)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Ae(e.target))return;let t=Je[e.code];t!==void 0&&(e.preventDefault(),$(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,T,$]);let At=e=>{if(S||N.current||L.current&&(e||t))return;let n=X.finish();if(n===``)return;let r=D.trim()===``?n:`${D.replace(/\s*$/,``)} ${n}`;if(e){t&&k(r),$(r,A,!0);return}k(r),J.current=r.length,G.current?.focus()},jt=X.recording,Mt=X.supported?(0,g.jsxs)(l,{type:`button`,variant:`ghost`,size:`sm`,disabled:S||V,"aria-label":`Start dictation`,title:`Dictation`,className:h(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,ht&&`hidden md:inline-flex`),onClick:()=>{H()||X.start()},children:[(0,g.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),x||b?null:`Dictation`]}):null,Nt=nt?(0,g.jsxs)(l,{type:`button`,"data-slot":`composer-finish`,"aria-label":c?`Finishing…`:`Finish`,"aria-busy":c||void 0,title:`Close the session and mark this task done`,disabled:F||M||c,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void s?.(),children:[(0,g.jsx)(ne,{"aria-hidden":`true`}),c?`Finishing…`:`Finish`]}):null,Pt=n||M?(0,g.jsxs)(l,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":M?`Stopping…`:`Stop`,"aria-busy":M||void 0,title:M?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:F||M,className:h(`h-11 min-w-11 active:opacity-80`,rt?`w-auto px-3`:`w-11`),onClick:()=>void Ot(),children:[(0,g.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),rt?M?`Stopping…`:`Stop`:null]}):null,Ft=M||F||z!==null||ue!=null,It=(0,g.jsx)(g.Fragment,{children:t||n||u?(0,g.jsx)(`div`,{className:h(`overflow-y-auto text-xs leading-5 text-muted-foreground`,f&&!Ft?`h-0`:`px-3 pb-2 md:px-4`,f?Ft&&`min-h-6`:`h-24 md:h-20`),children:(0,g.jsx)(`div`,{id:`${K}-submission`,role:z===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:z===null?void 0:0,className:`break-words`,children:M?`Stopping execution. Your draft is kept.`:F?fe:z===null?ue??null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground`,children:z}),(0,g.jsx)(`p`,{children:pe})]})})}):null}),Lt=(0,g.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:h(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,x&&`new-task-submission`),children:[x||b?null:Mt,y?(0,g.jsx)(`div`,{id:ut,"data-slot":`composer-footer-end`,className:h(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,x&&`mr-auto`,v&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,ht?`hidden md:flex`:`flex`),children:(0,g.jsx)(`div`,{className:`contents`,inert:V||void 0,children:y})}):null,(0,g.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Pt??ie,Nt,!tt&&!nt?(0,g.jsxs)(l,{type:`button`,size:`icon-sm`,"aria-label":it,"aria-busy":F&&!M||void 0,disabled:S||F||M||!P&&!C,className:h(x?`h-12 w-full gap-2 px-6`:b?`h-11 w-auto gap-2 px-5`:`size-11`,!P&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Dt,children:[!b&&!P&&d?(0,g.jsx)(be,{"aria-hidden":`true`}):null,x||b||!P&&d?it:null,b||P||!d?(0,g.jsx)(i,{"aria-hidden":`true`}):null]}):null]})]});return(0,g.jsxs)(ve,{open:xt,onOpenChange:e=>e?void 0:St(),children:[(0,g.jsx)(_e,{asChild:!0,children:(0,g.jsxs)(`div`,{ref:gt,"data-slot":`composer`,"data-disabled":S||void 0,onDrop:Et,onDragOver:e=>e.preventDefault(),className:h(x&&`new-task-composer`,b&&`session-composer`,S&&`opacity-80`),children:[(0,g.jsxs)(`div`,{"data-slot":`composer-editor`,className:h(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,x&&`new-task-editor`),children:[A.length>0?(0,g.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pt-3 md:flex-wrap md:overflow-visible`,children:A.map((e,t)=>(0,g.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:V?`Attachment submitted`:`Click to remove`,disabled:V,className:h(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{H()||j(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,g.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,g.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,g.jsx)(de,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,g.jsx)(`label`,{htmlFor:K,className:x?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:x?`Task description`:Re}),(0,g.jsx)(`textarea`,{ref:G,id:K,autoComplete:`off`,rows:1,value:D,disabled:S,readOnly:V,"aria-busy":V||void 0,"aria-describedby":t?`${K}-submission`:void 0,"aria-label":Re,placeholder:S?Ie:Le,className:h(`block min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,ht?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,x&&`md:text-base`),onChange:e=>{H()||(k(e.target.value),bt())},onKeyDown:kt,onSelect:bt,onPaste:Tt}),x?(0,g.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pt-3 pb-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(le,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,b&&jt?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:V||void 0,children:b}):null,jt?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Ze,{transcript:jt.transcript,startedAt:jt.startedAt,insertionDisabled:V,onCancel:X.cancel,onInsert:()=>At(!1),onInsertAndSend:()=>At(!0)}),Pt?(0,g.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Pt}):null]}):(0,g.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[b?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:V||void 0,children:b}):null,(0,g.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:h(`flex min-w-0 flex-wrap items-center gap-1`,x&&`w-full`),children:[(0,g.jsx)(Xe,{disabled:S||V,onFiles:wt}),v?(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":q?`Collapse composer`:`Expand composer`,"aria-expanded":q,"aria-controls":y?`${K} ${ut}`:K,onClick:()=>{ft.set(pt,!q),mt()},children:(0,g.jsx)(te,{"aria-hidden":`true`,className:h(`transition-transform motion-reduce:transition-none`,!q&&`rotate-180`)})}):null,(0,g.jsx)(`div`,{className:`contents`,inert:V||void 0,children:Ne}),x||b?(0,g.jsx)(`div`,{children:Mt}):null]}),x?null:Lt]}),x?null:It]}),x?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:V||void 0,children:Pe}),(0,g.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:V||void 0,children:x}),Lt,(0,g.jsx)(`div`,{"data-slot":`composer-feedback`,children:It})]}):null]})}),(0,g.jsx)(ge,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{gt.current?.contains(e.target)&&e.preventDefault()},children:(0,g.jsx)(ye,{shouldFilter:!1,value:Q??``,onValueChange:st,children:(0,g.jsx)(Se,{ref:_t,"data-slot":`composer-menu`,"data-trigger":U?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Z.length===0?(0,g.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:U?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:vt.isPending?`Loading skills…`:`No matching skills.`}):Z.map(e=>(0,g.jsxs)(xe,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>Ct(e),children:[(0,g.jsx)(`span`,{className:h(`shrink-0 truncate`,e.emphasized&&`font-semibold`,U?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,g.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Xe({disabled:e,onFiles:t}){let n=(0,_.useRef)(null);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,g.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ze({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:a,onInsertAndSend:o}){let s=T(1e3);return(0,g.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,g.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:O(t,s)}),(0,g.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,g.jsx)(de,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:a,children:(0,g.jsx)(ne,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,g.jsx)(i,{"aria-hidden":`true`})})]})}function k(){return(0,g.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,g.jsx)(ue,{icon:(0,g.jsx)(we,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{Fe as a,Le as c,y as d,Me as f,x as i,Re as l,Ye as n,C as o,b as p,T as r,w as s,k as t,Pe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-BTFBhZ55.js";import{r as n}from"./markdown-DvbymqXz.js";var r=e();function i(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function a(e,t){return`Input tokens: ${i(e)}; output tokens: ${i(t)}`}function o(e,t,r=`compact`){let i=e===void 0?`—`:n(e),a=t===void 0?`—`:n(t);return r===`table`?`${i} / ${a}`:`IN ${i} · OUT ${a}`}function s({inputTokens:e,outputTokens:n,variant:i=`compact`,omitWhenUnknown:s=!0,className:c,title:l}){return s&&e===void 0&&n===void 0?null:(0,r.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":a(e,n),title:l,className:t(`font-mono tabular-nums`,c),children:o(e,n,i)})}function c(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}export{o as i,s as n,a as r,c as t};
|