@wjarka/cezarion 0.14.8 → 0.14.9-dev.829
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 +76 -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/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/conversations.d.ts +165 -0
- package/dist/contract/delegation.d.ts +39 -0
- package/dist/contract/events.d.ts +49 -0
- package/dist/contract/health.d.ts +12 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +1374 -1247
- package/dist/contract/runs.d.ts +143 -0
- package/dist/contract/skills.d.ts +28 -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 +89 -19
- 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 +4 -1
- package/dist/core/cursor-acp-runner.js +3 -0
- package/dist/core/cursor-acp-runner.js.map +1 -1
- package/dist/core/cursor-provider-error.js +3 -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 +144 -21
- 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 +72 -7
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/delegation/cli.js +102 -6
- 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/provision.js +5 -3
- 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 +23 -13
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +142 -15
- package/dist/delegation/routes.js +4 -1
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/service.d.ts +9 -5
- package/dist/delegation/service.js +106 -7
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +138 -11
- package/dist/index.js +72 -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/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/store.d.ts +78 -6
- package/dist/runs/store.js +163 -1
- package/dist/runs/store.js.map +1 -1
- package/dist/server/server.d.ts +3761 -1648
- package/dist/server/server.js +170 -4
- package/dist/server/server.js.map +1 -1
- package/dist/task-cli/cli.d.ts +38 -0
- package/dist/task-cli/cli.js +463 -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 +95 -0
- package/dist/task-cli/discovery.js.map +1 -0
- package/dist/task-cli/http.d.ts +43 -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 +93 -0
- package/dist/workflows/run.js +816 -81
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/projects-cli.js +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +38 -2
- package/scripts/mock-codex-app-server.mjs +98 -1
- package/scripts/mock-cursor-acp.mjs +3 -0
- package/scripts/mock-opencode-serve.mjs +69 -2
- package/scripts/mock-pi-rpc.mjs +63 -2
- package/web/dist/assets/agent-accounts-JPfZPgKn.js +1 -0
- package/web/dist/assets/centered-state-HwCqQkH3.js +43 -0
- package/web/dist/assets/collapsible-CTymFdL7.js +1 -0
- package/web/dist/assets/commit-list-BZpYGQl2.js +1 -0
- package/web/dist/assets/compare-variants-9VkybaQ7.js +1 -0
- package/web/dist/assets/{diff-tRE59UNb2.js → diff-CZcD4D1r2.js} +2 -2
- package/web/dist/assets/diff-controls-CpcHG3Mm.js +1 -0
- package/web/dist/assets/{diff-stat-Cgnl_hYF.js → diff-stat-Cn7rzy1H.js} +1 -1
- package/web/dist/assets/{diff-view-DN1ort7Q.js → diff-view-C46nHiP2.js} +2 -2
- package/web/dist/assets/dropdown-menu-_YAzCaoQ.js +1 -0
- package/web/dist/assets/git-toolbar-BvKDz6uS.js +1 -0
- package/web/dist/assets/github-CgjJCGrD.js +1 -0
- package/web/dist/assets/{image-preview-C2JGcBlC.js → image-preview-B618kDBH.js} +1 -1
- package/web/dist/assets/index-BJtve0Pm.js +7 -0
- package/web/dist/assets/index-D0WAgmTQ.css +1 -0
- package/web/dist/assets/markdown-CFWZnvMh.js +2 -0
- package/web/dist/assets/pill-QfwkuR50.js +1 -0
- package/web/dist/assets/project-router-CkAA39N5.js +1 -0
- package/web/dist/assets/prompt-templates-Cfna_S0T.js +15 -0
- package/web/dist/assets/repo-git-DgzgJ0cP.js +1 -0
- package/web/dist/assets/{run-diff-CyG0Nciv.js → run-diff-YbCEQn5I.js} +2 -2
- package/web/dist/assets/run-header-DMgIbr1d.js +1 -0
- package/web/dist/assets/skills-BW79kUTd.js +1 -0
- package/web/dist/assets/{tab-link-BWNp3mLY.js → tab-link-MIHvczEm.js} +1 -1
- package/web/dist/assets/task-changes-C96ekt94.js +1 -0
- package/web/dist/assets/task-commits-DBfcMZyG.js +1 -0
- package/web/dist/assets/task-files-BKpH8dKQ.js +2 -0
- package/web/dist/assets/task-thread-Bw_nQuTx.css +1 -0
- package/web/dist/assets/task-thread-Dnq7Ek6W.js +9 -0
- package/web/dist/assets/textarea-D2vAVgYW.js +1 -0
- package/web/dist/assets/thread-loading-NW8Mthco.js +1 -0
- package/web/dist/assets/token-metrics-D188e6_0.js +1 -0
- package/web/dist/assets/utils-DKheTxGD.js +64 -0
- package/web/dist/assets/workflows-BFY1hgp3.js +11 -0
- package/web/dist/assets/{zoomable-image-Z3JDnm0b.js → zoomable-image-YW3Qdrr_.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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,N as i,R as a,Rt as o,X as s,_ as c,f as l,g as u,m as d}from"./alert-dialog-B422RI-k.js";import{p as f,t as p}from"./utils-PYYcpCFZ.js";import{i as m,l as h,o as g,r as _,s as v,t as y}from"./dropdown-menu-dwDGT8MM.js";import{i as b,n as x,o as S,r as C,s as w}from"./textarea-FjaU370i.js";import{t as T}from"./createLucideIcon-BHp8sXmF.js";var E=T(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),D=T(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),O=e(t(),1),k=1,A=.9,j=.8,ee=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,R=/[\s-]/,z=/[\s-]/g;function te(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?k:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=te(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=k:I.test(e.charAt(l-1))?(d*=j,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):R.test(e.charAt(l-1))?(d*=A,m=e.slice(i,l-1).match(z),m&&i>0&&(d*=N**+m.length)):(d*=ee,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=te(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ne(e){return e.toLowerCase().replace(z,` `)}function re(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,te(e,t,ne(e),ne(t),0,0,{})}var B=`[cmdk-group=""]`,ie=`[cmdk-group-items=""]`,ae=`[cmdk-group-heading=""]`,oe=`[cmdk-item=""]`,se=`${oe}:not([aria-disabled="true"])`,V=`cmdk-item-select`,H=`data-value`,ce=(e,t,n)=>re(e,t,n),le=O.createContext(void 0),U=()=>O.useContext(le),ue=O.createContext(void 0),W=()=>O.useContext(ue),de=O.createContext(void 0),fe=O.forwardRef((e,t)=>{let n=q(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),a=q(()=>new Set),o=q(()=>new Map),s=q(()=>new Map),c=q(()=>new Set),l=Ce(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=r(),x=r(),S=r(),C=O.useRef(null),w=Te();K(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,T.emit()}},[f]),K(()=>{w(6,ee)},[]);let T=O.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)j(),k(),w(1,A);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,ee),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),E=O.useMemo(()=>({value:(e,t,r)=>{t!==s.current.get(e)?.value&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{k(),T.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),w(3,()=>{j(),k(),n.current.value||A(),T.emit()}),()=>{s.current.delete(e),a.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{j(),t?.getAttribute(`id`)===e&&A(),T.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=l.current?.filter??ce;return e?r(e,n.current.search,t):0}function k(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ie);t?t.appendChild(e.parentElement===t?e:e.closest(`${ie} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ie} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${B}[${H}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function A(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(H);T.setState(`value`,e||void 0)}function j(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of a.current){let r=D(s.current.get(t)?.value??``,s.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(B)?.querySelector(ae))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${oe}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(se)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(H))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(H))}function I(e){let t=M()?.closest(B),n;for(;t&&!n;)t=e>0?xe(t,B):Se(t,B),n=t?.querySelector(se);n?T.setState(`value`,n.getAttribute(H)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return O.createElement(i.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(V);t.dispatchEvent(e)}}}}},O.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:De},u),Y(e,e=>O.createElement(ue.Provider,{value:T},O.createElement(le.Provider,{value:E},e))))}),pe=O.forwardRef((e,t)=>{let n=r(),o=O.useRef(null),s=O.useContext(de),c=U(),l=Ce(e),u=l.current?.forceMount??s?.forceMount;K(()=>{if(!u)return c.item(n,s?.id)},[u]);let d=we(n,o,[e.value,e.children,o],e.keywords),f=W(),p=J(e=>e.value&&e.value===d.current),m=J(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);O.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(V,h),()=>t.removeEventListener(V,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return O.createElement(i.div,{ref:a(o,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),me=O.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:s,...c}=e,l=r(),u=O.useRef(null),d=O.useRef(null),f=r(),p=U(),m=J(e=>s||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));K(()=>p.group(l),[]),we(l,u,[e.value,e.heading,d]);let h=O.useMemo(()=>({id:l,forceMount:s}),[s]);return O.createElement(i.div,{ref:a(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&O.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Y(e,e=>O.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},O.createElement(de.Provider,{value:h},e))))}),he=O.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=O.useRef(null),s=J(e=>!e.search);return!n&&!s?null:O.createElement(i.div,{ref:a(o,t),...r,"cmdk-separator":``,role:`separator`})}),ge=O.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=W(),s=J(e=>e.search),c=J(e=>e.selectedItemId),l=U();return O.useEffect(()=>{e.value!=null&&o.setState(`search`,e.value)},[e.value]),O.createElement(i.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:a?e.value:s,onChange:e=>{a||o.setState(`search`,e.target.value),n?.(e.target.value)}})}),_e=O.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...o}=e,s=O.useRef(null),c=O.useRef(null),l=J(e=>e.selectedItemId),u=U();return O.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),O.createElement(i.div,{ref:a(s,t),...o,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},Y(e,e=>O.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),ve=O.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return O.createElement(l,{open:n,onOpenChange:r},O.createElement(c,{container:o},O.createElement(u,{"cmdk-overlay":``,className:i}),O.createElement(d,{"aria-label":e.label,"cmdk-dialog":``,className:a},O.createElement(fe,{ref:t,...s}))))}),ye=O.forwardRef((e,t)=>J(e=>e.filtered.count===0)?O.createElement(i.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),be=O.forwardRef((e,t)=>{let{progress:n,children:r,label:a=`Loading...`,...o}=e;return O.createElement(i.div,{ref:t,...o,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Y(e,e=>O.createElement(`div`,{"aria-hidden":!0},e)))}),G=Object.assign(fe,{List:_e,Item:pe,Input:ge,Group:me,Separator:he,Dialog:ve,Empty:ye,Loading:be});function xe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Se(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ce(e){let t=O.useRef(e);return K(()=>{t.current=e}),t}var K=typeof window>`u`?O.useEffect:O.useLayoutEffect;function q(e){let t=O.useRef();return t.current===void 0&&(t.current=e()),t}function J(e){let t=W(),n=()=>e(t.snapshot());return O.useSyncExternalStore(t.subscribe,n,n)}function we(e,t,n,r=[]){let i=O.useRef(),a=U();return K(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(H,s),i.current=s}),i}var Te=()=>{let[e,t]=O.useState(),n=q(()=>new Map);return K(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ee(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Y({asChild:e,children:t},n){return e&&O.isValidElement(t)?O.cloneElement(Ee(t),{ref:t.ref},n(t.props.children)):n(t)}var De={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},X=n();function Oe({className:e,...t}){return(0,X.jsx)(G,{"data-slot":`command`,className:p(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ke({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,...o}){return(0,X.jsxs)(x,{...o,children:[(0,X.jsxs)(S,{className:`sr-only`,children:[(0,X.jsx)(w,{children:e}),(0,X.jsx)(b,{children:t})]}),(0,X.jsx)(C,{className:p(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,X.jsx)(Oe,{filter:a,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Ae({className:e,...t}){return(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 shrink-0 items-center gap-2 border-b px-3 max-md:h-[44px]`,children:[(0,X.jsx)(o,{className:`size-4 shrink-0 opacity-50`}),(0,X.jsx)(G.Input,{"data-slot":`command-input`,className:p(`flex h-10 w-full rounded-md bg-transparent py-3 text-base md:text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function je({className:e,onPointerMoveCapture:t,...n}){return(0,X.jsx)(G.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:p(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Me({...e}){return(0,X.jsx)(G.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ne({className:e,...t}){return(0,X.jsx)(G.Group,{"data-slot":`command-group`,className:p(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Pe({className:e,...t}){return(0,X.jsx)(G.Separator,{"data-slot":`command-separator`,className:p(`-mx-1 h-px bg-border`,e),...t})}function Fe({className:e,...t}){return(0,X.jsx)(G.Item,{"data-slot":`command-item`,className:p(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Ie({className:e,...t}){return(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:p(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Le=`quick-task`;function Re(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var ze=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI (ACP)`}],Z={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}]},Q=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function Be(e,t,n){let r=e===`cursor`?[Q[0]]:Q,i=f(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[Q[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=Q.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function Ve(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var He=[`opencode`,`pi`];function Ue(e,t){return t===`cursor`||!e||Z[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(Z).some(([n,r])=>n!==t&&!He.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function We(e,t,n=[]){let r=t?.runner===e?t.models:[],i=Z[e]??Z.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(f(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||Ue(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var Ge={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`};function Ke(e,t,n=!1,r=!1){if(!f(e))return;let i=Ge[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function qe(e){let t=ze.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Je(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Ye(e,t,n=!1){return!n&&e===t?void 0:e}function Xe(e,t,n,r){let i=We(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function Ze(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Qe(e,t,n){return e&&Ze(e,t,n)?e:null}function $e(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,variants:u,images:d,worktree:f,autonomous:p,generateFollowups:m,todoId:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Ye(o,c,s),agentProfile:l||void 0,variants:u>1?u:void 0,images:d.length>0?[...d]:void 0,worktree:f===!1&&u<=1?!1:void 0,autonomous:p===!0||void 0,generateFollowups:m!==!1&&void 0,todoId:h||void 0}}function et(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var tt=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,nt=(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`});function rt({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,icon:f,fieldLabel:b=!1}){let x=f?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,S=(0,X.jsxs)(X.Fragment,{children:[f,(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,title:typeof n==`string`?n:void 0,children:[b?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[t,` · `]}):null,n]})]});if(c)return(0,X.jsx)(`span`,{"data-slot":e,"aria-label":t,title:u??l,className:p(tt,x,`cursor-default hover:bg-card hover:text-muted-foreground`),children:S});let C=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?u:l,className:p(tt,x),children:[S,f?(0,X.jsx)(s,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):nt]});return o?(0,X.jsx)(`span`,{title:u,className:`inline-flex`,children:C}):(0,X.jsxs)(y,{children:[(0,X.jsx)(h,{asChild:!0,children:C}),(0,X.jsxs)(_,{align:`start`,"data-testid":`${e}-menu`,children:[(0,X.jsx)(g,{value:r,onValueChange:a,children:i.map(e=>(0,X.jsx)(v,{value:e.value,className:`gap-2.5`,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),d?(0,X.jsx)(m,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function it({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=ze.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,X.jsx)(rt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}var at=80,ot=2e3,st=50,ct=200,lt=50,ut=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function dt(e){return!!e&&typeof e==`object`}function ft(e){if(e===void 0||!Array.isArray(e))return ut.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!dt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=pt(r.skills);if(n.push({id:e,label:i.slice(0,at),text:a.slice(0,ot),...o.length>0?{skills:o}:{}}),n.length>=st)break}return n}function pt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,ct)),t.size>=lt))break}return[...t]}function mt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function ht(e,t){return mt(e,t).map(e=>e.text).join(`
|
|
2
|
-
|
|
3
|
-
`)}function gt(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function _t(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function vt(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
4
|
-
|
|
5
|
-
`)?``:i.endsWith(`
|
|
6
|
-
`)?`
|
|
7
|
-
`:`
|
|
8
|
-
|
|
9
|
-
`);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
|
|
10
|
-
|
|
11
|
-
`)?``:s.startsWith(`
|
|
12
|
-
`)?`
|
|
13
|
-
`:`
|
|
14
|
-
|
|
15
|
-
`),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function yt({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}export{Ae as A,Qe as C,ke as D,Oe as E,D as F,E as I,je as M,Pe as N,Me as O,Ie as P,Je as S,et as T,Ke as _,ft as a,Ve as b,rt as c,tt as d,Le as f,Be as g,$e as h,_t as i,Fe as j,Ne as k,it as l,qe as m,ht as n,gt as o,ze as p,vt as r,yt as s,ut as t,nt as u,We as v,Ye as w,Xe as x,Re as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Ai as i,Ca as a,Ea as o,It as s,Jn as c,Ki as l,Rt as u,Ta as d,U as f,Wi as p,Xn as m,Yn as h,Yt as g,_t as _,a as ee,c as v,d as y,gt as b,hi as x,i as te,in as S,l as C,lt as w,n as T,ni as E,o as D,r as O,s as k,sa as A,t as ne,vn as j,wn as M,xt as N}from"./alert-dialog-B422RI-k.js";import{n as P,t as F}from"./utils-PYYcpCFZ.js";import{t as I}from"./createLucideIcon-BHp8sXmF.js";import{n as L}from"./diff-controls-BGrXGi7O.js";import{i as R,r as z,t as B}from"./git-toolbar-UiHnGvE0.js";import{t as V,u as H}from"./project-router-DbLkll25.js";import{t as U}from"./search-x-I9Q8pgUa.js";import{t as W}from"./diff-stat-Cgnl_hYF.js";import{a as G,h as K}from"./index-BszfYvBq.js";import{t as q}from"./diff-tRE59UNb2.js";import{t as J}from"./tab-link-BWNp3mLY.js";import{t as Y}from"./use-desktop-BaYgO7YW.js";import{t as X}from"./commit-list-Dcnk7TnI.js";var re=I(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Z=e(t(),1),Q=n();function ie({repo:e,info:t}){let n=M(),i=r(),a=e=>A(e.message,{tone:`danger`}),o=d({mutationFn:e=>x({name:e}),onSuccess:async e=>{A(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:S.repo}),i.invalidateQueries({queryKey:S.health})]),i.setQueryData(S.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(S.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),c=d({mutationFn:e=>l({baseBranch:e}),onSuccess:e=>{A(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:S.repo})},onError:a}),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),g=m.trim().toLowerCase(),_=g?e.branches.filter(e=>e.toLowerCase().includes(g)):e.branches;return(0,Q.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(u,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:m,onChange:e=>h(e.target.value),className:`h-11 pl-10`})]}),(0,Q.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[_.map(e=>{let n=e===t.branch;return(0,Q.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,Q.jsx)(`span`,{className:F(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),n?(0,Q.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[10px] font-medium text-accent-text`,children:`Current`}):(0,Q.jsxs)(y,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),_.length===0?(0,Q.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,m.trim(),`”.`]}):null]})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Q.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&o.mutate(t,{onSuccess:()=>p(``)})},children:[(0,Q.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Q.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,Q.jsx)(K,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:f,onChange:e=>p(e.target.value)}),(0,Q.jsxs)(y,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!f.trim()||o.isPending,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Q.jsxs)(`div`,{className:`mt-5`,children:[(0,Q.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-sm font-medium`,children:`Agents’ base branch`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`New task worktrees branch from this.`}),(0,Q.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:c.isPending,onChange:e=>c.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block min-h-11 w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]}),(0,Q.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,Q.jsx)(ae,{}):null]})}function ae(){let e=j({limit:20});return(0,Q.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,Q.jsx)(oe,{pr:e},e.number))}):(0,Q.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function oe({pr:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Q.jsx)(se,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Q.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:P(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:F(n,`hover:bg-muted`),children:t}):(0,Q.jsx)(`span`,{className:n,children:t})})}function se({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:F(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function ce(){let e=h(),t=Y(),[n,r]=(0,Z.useState)(`unified`),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l=e.isError&&e.error instanceof E&&e.error.status===409,u=e.data?.files??[],d=(0,Z.useMemo)(()=>z(u),[u]),f=t?n:`unified`,p=!t||i;return(0,Q.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,Q.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,Q.jsx)(B,{stat:e.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(C,{icon:l?(0,Q.jsx)(w,{size:16}):(0,Q.jsx)(g,{size:16}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):u.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(w,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Q.jsx)(R,{root:d,selected:o,onSelect:e=>{s(e),c.current?.scrollToPath(e)}})]}),(0,Q.jsx)(q,{files:u,viewRef:c,mode:f,wrap:p,className:`min-w-0 flex-1`})]})]})}function $({log:e}){let{sha:t}=a();return t?(0,Q.jsx)(le,{sha:t}):e.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,Q.jsx)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:(0,Q.jsx)(X,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})})}function le({sha:e}){let t=m(e),n=Y(),[r,i]=(0,Z.useState)(`unified`),[a,o]=(0,Z.useState)(!1),s=t.isError&&t.error instanceof E&&t.error.status===409,c=n?r:`unified`,l=!n||a;return(0,Q.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,Q.jsxs)(V,{to:`/git/commits`,children:[(0,Q.jsx)(f,{size:16,"aria-hidden":`true`}),`All commits`]})}),t.data?(0,Q.jsx)(W,{stat:t.data.stat}):null,(0,Q.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,Q.jsx)(L,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,Q.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,Q.jsx)(C,{icon:s?(0,Q.jsx)(U,{}):(0,Q.jsx)(g,{size:16}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,Q.jsx)(C,{icon:(0,Q.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,Q.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,Q.jsx)(q,{files:t.data.files,mode:c,wrap:l,className:`min-w-0`})})]})]})}function ue({repo:e,info:t}){let n=r(),[a,s]=(0,Z.useState)(e.baseBranch??t.branch),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),f=S.repo,m=S.health,h=[...f,`pull`],g=!!t.remote,_=o({queryKey:h,queryFn:({signal:e})=>i({signal:e}),enabled:g}),x=d({mutationFn:p}),C=()=>Promise.all([n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:m})]),w=async(e,t=!1)=>{try{let n=await x.mutateAsync(t?{branch:e,confirm:!0}:{branch:e});if(`risks`in n){l(n);return}l(null),A(n.summary),await C()}catch(e){l(null),A(e instanceof Error?e.message:String(e),{tone:`danger`}),await C()}},E=_.data?.branches??e.branches,j=_.data===void 0||E.includes(a),M=j?E:[a,...E],N=g&&_.isPending,P=g?_.isError?`Could not load local branches: ${_.error.message}`:j?null:`${a} is not a local branch. Choose a local branch to pull.`:`No remote configured. Add a Git remote before pulling.`,F=x.isPending||N||!g||_.isError,I=F||!j,L=a!==t.branch;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`repo-pull`,className:`max-w-full md:w-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`repo-pull-branch`,className:`sr-only`,children:`Branch to pull`}),(0,Q.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Q.jsx)(b,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(`select`,{id:`repo-pull-branch`,value:a,disabled:F,onChange:e=>s(e.target.value),className:`h-11 max-w-full min-w-[88px] appearance-none rounded-lg border border-input bg-card pr-3 pl-9 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,style:{width:`${Math.max(88,a.length*8+56)}px`},children:M.map(e=>(0,Q.jsx)(`option`,{value:e,disabled:!j&&e===a,children:e},e))})]}),(0,Q.jsxs)(y,{ref:u,type:`button`,"data-action":`repo-pull`,className:`h-11 px-4`,disabled:I,title:P??void 0,onClick:()=>void w(a),children:[x.isPending?(0,Q.jsx)(H,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(re,{"aria-hidden":`true`}),L?`Switch & pull`:`Pull`]})]}),P||L?(0,Q.jsx)(`p`,{"data-slot":`repo-pull-note`,className:`mt-1 break-all text-[11px] text-soft-foreground md:text-left`,children:P??`${a} stays checked out after the pull.`}):null]}),(0,Q.jsx)(ne,{open:c!==null,onOpenChange:e=>{!e&&!x.isPending&&l(null)},children:(0,Q.jsxs)(te,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(v,{children:[`Pull `,c?.branch,` anyway?`]}),(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[c?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,c?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the switch or pull to protect them.`}):null,(0,Q.jsxs)(`p`,{children:[c?.branch,` will stay checked out after this attempt.`]})]})})]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(O,{className:`h-11`,disabled:x.isPending,children:`Cancel`}),(0,Q.jsx)(T,{className:`h-11`,disabled:x.isPending||c===null,onClick:e=>{e.preventDefault(),c&&w(c.branch,!0)},children:x.isPending?`Pulling…`:`Pull anyway`})]})]})})]})}function de({tab:e}){let t=c();if(t.isPending)return(0,Q.jsx)(G,{});if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(g,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,Q.jsx)(fe,{repo:t.data,info:n,tab:e}):(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(C,{icon:(0,Q.jsx)(b,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function fe({repo:e,info:t,tab:n}){return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{"data-slot":`repo-header`,className:`px-[18px] pt-[18px] md:px-9 md:pt-9`,children:[(0,Q.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:[`Git · `,n===`changes`?`Changes`:n===`commits`?`Commits`:`Branches`]}),(0,Q.jsxs)(`p`,{"data-slot":`repo-remote`,className:`mt-2 break-all text-[13px] text-muted-foreground`,children:[t.root.split(`/`).filter(Boolean).at(-1),t.remote?` · ${t.remote}`:``,` · `,(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,children:t.branch})]}),(0,Q.jsx)(`div`,{className:`my-[22px] flex min-w-0 items-start gap-2.5`,children:(0,Q.jsx)(ue,{repo:e,info:t})}),(0,Q.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`flex items-end gap-6 border-b border-border [&>a]:min-h-11`,children:[(0,Q.jsx)(J,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,Q.jsx)(J,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,Q.jsx)(J,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,Q.jsx)(ce,{}):n===`commits`?(0,Q.jsx)($,{log:e.log}):(0,Q.jsx)(ie,{repo:e,info:t})]})}export{de as RepoGitRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Fr as i,Ft as a,J as o,Jt as s,K as c,Kr as l,Lr as u,Mn as d,Mr as f,Nn as p,Pn as m,Pr as h,Q as g,Qn as _,Ri as v,Rn as y,Ta as b,V as ee,Vn as te,Wr as ne,X as x,Xr as re,Yr as S,a as C,ar as w,c as T,cr as E,d as D,et as ie,fa as ae,fn as oe,gt as se,i as ce,in as le,ir as ue,it as O,jn as de,kn as fe,kr as pe,n as me,ni as he,nt as k,o as A,oi as ge,r as j,s as M,sa as N,st as _e,t as P,tn as F,tt as ve,un as ye,wn as be,yi as xe,zi as Se,zr as Ce}from"./alert-dialog-B422RI-k.js";import{n as I,t as L}from"./utils-PYYcpCFZ.js";import{a as R,c as we,i as z,l as B,n as Te,r as Ee,t as De}from"./dropdown-menu-dwDGT8MM.js";import{n as Oe,r as ke,t as Ae}from"./collapsible-Cy_Fmkrd.js";import{n as je,t as Me}from"./agent-accounts-BZm_2WAv.js";import{t as V}from"./createLucideIcon-BHp8sXmF.js";import{A as Ne,C as Pe,N as Fe,S as H,_ as U,b as Ie,c as Le,f as Re,g as ze,i as Be,n as Ve,r as He,t as Ue,y as We}from"./pill-BsbO6G7y.js";import{c as Ge,s as Ke,t as W,u as qe}from"./project-router-DbLkll25.js";import{t as Je}from"./square-terminal-B6RYYieR.js";import{t as Ye}from"./markdown-C_IcKVQd.js";import{t as Xe}from"./diff-stat-Cgnl_hYF.js";import{n as Ze,t as Qe}from"./token-metrics-Clxh03bE.js";import{t as G}from"./tab-link-BWNp3mLY.js";import{t as $e}from"./use-desktop-BaYgO7YW.js";var et=V(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),tt=V(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),nt=V(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),K=e(t(),1),q=n();function rt(e){let t=r();return b({mutationFn:t=>ge(e,t),onSuccess:()=>t.invalidateQueries({queryKey:le.runs.all}),onError:e=>N(e.message,{tone:`danger`})})}function it(e){return e.archived?`Unarchive`:`Archive task`}function at({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,q.jsx)(P,{open:t,onOpenChange:n,children:(0,q.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,q.jsxs)(M,{children:[(0,q.jsx)(T,{children:`Archive task?`}),(0,q.jsxs)(C,{children:[`Move “`,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,q.jsxs)(A,{children:[(0,q.jsx)(j,{children:`Cancel`}),(0,q.jsx)(me,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function ot({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,K.useState)(!1),a=rt(e.id),o=it(e);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:L(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,q.jsx)(Fe,{"aria-hidden":`true`}):(0,q.jsx)(ee,{"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:L(n&&`max-md:sr-only`),children:o})]}),(0,q.jsx)(at,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function st(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function ct({slot:e,icon:t,title:n,meta:r,open:i,onToggle:a,children:o}){return(0,q.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":i?`open`:`collapsed`,className:`min-w-0 border-t border-border first:border-t-0`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:a,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-left hover:bg-muted/40`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,q.jsx)(`span`,{className:`min-w-0 shrink truncate text-[13.5px] font-semibold text-foreground`,children:n}),(0,q.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[12.5px] text-muted-foreground tabular-nums`,children:r}),(0,q.jsx)(x,{"aria-hidden":!0,className:L(`ml-auto size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,q.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:o}):null]})}var lt=`flex min-h-11 min-w-0 items-center rounded-md px-2 text-sm text-foreground hover:bg-muted break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function ut({run:e}){return!e.delegation||e.delegation.role===`invalid`?null:(0,q.jsx)(ft,{run:e})}function J(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId):[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])].slice(0,32)}function dt(e){let t=e.delegation,n=t!==void 0&&t.role!==`invalid`,r=w(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=J(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function ft({run:e}){let t=w(e.id),n=$e(),[r,i]=(0,K.useState)(null),a=n||r===e.id,s=(0,K.useId)(),c=E(),u=e.delegation,d=u?.role===`worker`?u.parentRunId:t.data?.parentRunId,f=new Map(t.data?.workers.map(e=>[e.workerId,e])),p=J(u,t.data),m=u&&u.role!==`invalid`?u.wait:void 0,h=S(u);return(0,q.jsxs)(`section`,{"aria-label":`Task relationships`,className:`min-w-0 border-t border-border py-2 text-sm text-muted-foreground`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-2 text-left text-xs md:hidden`,"aria-expanded":a,"aria-controls":s,onClick:()=>i(r===e.id?null:e.id),children:[(0,q.jsx)(se,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),u?.role===`worker`?`Worker session`:`Parent`,(0,q.jsx)(o,{"aria-hidden":`true`,className:`ml-1 size-4`}),u?.role===`worker`?`Parent & workers`:p.length>0?`Workers ${p.length}`:t.isSuccess?`Workers 0`:t.isError?`Workers unavailable`:`Workers…`,(0,q.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-4 ${a?`rotate-180`:``}`})]}),u?.role===`worker`&&u.destroy?(0,q.jsx)(Y,{state:u.destroy}):null,m?(0,q.jsx)(vt,{wait:m,dependencyLabel:h}):null,(0,q.jsxs)(`div`,{id:s,hidden:!a,children:[d?(0,q.jsx)(yt,{id:d}):null,p.length>0?(0,q.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-1 overflow-y-auto`,children:p.map(e=>{let n=f.get(e),r=c.data?.find(t=>t.id===e);return(0,q.jsxs)(`li`,{className:`min-w-0 rounded-md bg-muted/40 px-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(W,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:lt,children:r?l(r):`Worker ${e.slice(0,8)}`}),(0,q.jsx)(`span`,{className:`px-2 text-xs`,children:n?.status??(t.isSuccess?`Record unavailable or deleted`:`Status unavailable`)})]}),n?.destroy?(0,q.jsx)(Y,{state:n.destroy}):null]},e)})}):u?.role===`root`&&t.isSuccess?(0,q.jsx)(`p`,{className:`px-2`,children:`No workers`}):null,t.fetchStatus===`paused`?(0,q.jsx)(`p`,{role:`status`,className:`px-2`,children:`Offline — relationship details will refresh when connected.`}):t.isPending?(0,q.jsx)(`p`,{role:`status`,className:`px-2`,children:`Loading relationships…`}):null,t.isError?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2`,children:[(0,q.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,q.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry relationships`})]}):null]})]})}function pt({run:e,open:t,onToggle:n}){let r=w(e.id),i=E(),a=$e(),o=e.delegation,s=o?.role===`worker`?o.parentRunId:r.data?.parentRunId,u=new Map(r.data?.workers.map(e=>[e.workerId,e])),d=J(o,r.data),f=o&&o.role!==`invalid`?o.wait:void 0,p=S(o);return(0,q.jsx)(ct,{slot:`workers`,icon:(0,q.jsx)(se,{className:`size-4`}),title:`Workers`,meta:mt({ids:d,workers:u,parentId:s,desktop:a,query:r}),open:t,onToggle:n,children:(0,q.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[o?.role===`worker`&&o.destroy?(0,q.jsx)(Y,{state:o.destroy}):null,f?(0,q.jsx)(vt,{wait:f,dependencyLabel:p}):null,s?(0,q.jsx)(yt,{id:s}):null,d.length>0?(0,q.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:d.map(e=>{let t=u.get(e),n=i.data?.find(t=>t.id===e),a=t?gt(t.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,q.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":t?.status,className:`min-w-0`,children:[(0,q.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Worker task ${e}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,q.jsx)(ht,{status:t?.status}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n?l(n):`Worker ${e.slice(0,8)}`}),(0,q.jsx)(`span`,{className:L(`max-w-[45%] shrink-0 truncate text-xs`,_t(t?.status)),children:a}),(0,q.jsx)(c,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),t?.destroy?(0,q.jsx)(Y,{state:t.destroy}):null]},e)})}):o?.role===`root`&&r.isSuccess?(0,q.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,q.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,q.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,q.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,q.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function mt({ids:e,workers:t,parentId:n,desktop:r,query:i}){if(e.length===0)return i.isError?`Unavailable`:i.isPending?`Linking…`:n?`Parent linked`:`No workers`;let a=`${e.length} linked`;if(!r)return a;let o=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&o.set(e,(o.get(e)??0)+1)}return[a,...[...o.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function ht({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,q.jsx)(g,{"aria-hidden":!0,className:L(t,`text-success`)}):e===`failed`?(0,q.jsx)(k,{"aria-hidden":!0,className:L(t,`text-danger`)}):e===`cancelled`?(0,q.jsx)(ve,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,q.jsx)(qe,{role:`status`,"aria-label":`Worker running`,className:L(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,q.jsx)(ie,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)})}function gt(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function _t(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function vt({wait:e,dependencyLabel:t}){return(0,q.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,` `,`Deadline: `,(0,q.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]})}function yt({id:e}){let t=_(e);return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,className:lt,children:t.data?`Parent · ${l(t.data)}`:`Parent task ${e}`}),t.isError?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`px-2 text-xs`,children:`Parent record unavailable or deleted`}),(0,q.jsx)(D,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}function Y({state:e}){return e.phase===`complete`&&e.remaining.length===0&&e.error===void 0?null:(0,q.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${e.error}`:``]})}function X(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function bt(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function Z({steps:e}){if(e.length===0)return null;let t=bt(e)*100;return(0,q.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,q.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":X(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,q.jsx)(xt,{visual:X(t.status)}),(0,q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,q.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,q.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,q.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function xt({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,q.jsx)(g,{"aria-hidden":!0,className:L(t,`text-success`)});case`active`:return(0,q.jsx)(qe,{role:`status`,"aria-label":`Step running`,className:L(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,q.jsx)(k,{"aria-hidden":!0,className:L(t,`text-danger`)});case`pending`:return(0,q.jsx)(ie,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)})}}function St(e){let t=e.findIndex(e=>X(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>X(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function Ct({visual:e}){return(0,q.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:L(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var wt=new Map;function Tt({runId:e,steps:t}){let[n,r]=(0,K.useState)(()=>wt.get(e)??!1);if(t.length===0)return null;let i=t=>{wt.set(e,t),r(t)},a=St(t),o=t[a],s=bt(t)*100;return(0,q.jsxs)(Ae,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,q.jsxs)(ke,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:min-h-[30px] md:gap-2.5`,children:[(0,q.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,q.jsx)(Ct,{visual:X(e.status)},e.id))}),(0,q.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,q.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,q.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,q.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,q.jsx)(x,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,q.jsx)(Oe,{children:(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(Z,{steps:t})})})]})}var Et=new Map;function Dt({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=re(e,n),a=U(e),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(!1),u=kt(e,r),[,d]=(0,K.useReducer)(e=>e+1,0),f=(0,K.useId)(),p=Ke(),m=JSON.stringify([p,e.id]),h=Et.get(m)??!1,g=()=>{Et.set(m,!h),d()},_=E(),v=be(),y=Qe(v.data),b=e.status===`queued`?ne(_.data??[]).get(e.id):void 0;return(0,q.jsxs)(`header`,{"data-slot":`run-header`,className:L(`relative z-20 bg-background px-[18px] pt-[18px] md:px-9 md:pt-7`,t===`session`&&`md:sticky md:top-0`),children:[(0,q.jsxs)(`div`,{className:`w-full`,children:[(0,q.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,q.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[10px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,q.jsx)(At,{run:e}),(0,q.jsxs)(Ue,{dot:i.tone,pulse:i.pulse,children:[i.label,b===void 0?``:` #${b}`]}),(0,q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[(0,q.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":h?`Hide run details`:`Show run details`,"aria-controls":f,"aria-expanded":h,onClick:g,children:(0,q.jsx)(x,{"aria-hidden":`true`,className:L(`transition-transform motion-reduce:transition-none`,h&&`rotate-180`)})}),t!==`session`&&a.archive?(0,q.jsx)(ot,{run:e}):null,(0,q.jsx)(Ft,{run:e,actions:u,onOpenChooser:()=>l(!0),onToggleNotes:()=>s(e=>!e)})]})]}),(0,q.jsx)(`div`,{id:f,"data-slot":`run-details`,className:L(h?`block`:`hidden`,`md:block`),children:(0,q.jsx)(jt,{run:e,showTokens:y.tokens,showCost:y.cost,automationsAvailable:v.data?.capabilities?.automations===!0})}),(0,q.jsx)(Mt,{run:e}),(0,q.jsx)(Nt,{run:e}),(0,q.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:[&>a]:min-h-11`,children:[(0,q.jsx)(G,{to:`/tasks/${e.id}`,active:t===`session`,children:`Session`}),(0,q.jsx)(G,{to:`/tasks/${e.id}/changes`,active:t===`changes`,children:`Changes`}),(0,q.jsx)(G,{to:`/tasks/${e.id}/commits`,active:t===`commits`,children:`Commits`}),(0,q.jsx)(G,{to:`/tasks/${e.id}/files`,active:t===`files`,children:`Files`})]}),t===`session`?null:(0,q.jsx)(ut,{run:e}),t!==`session`&&e.steps.length>0?(0,q.jsx)(`div`,{className:`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,children:(0,q.jsx)(Tt,{runId:e.id,steps:e.steps})}):null,o?(0,q.jsx)(Lt,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,q.jsx)(Ot,{run:e,canResume:U(e).terminal,onResume:()=>u.terminal.mutate(),onClose:()=>l(!1)}):null]}),(0,q.jsx)(It,{run:e,actions:u})]})}function Ot({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let a=de(),o=y(),s=b({mutationFn:t=>v(e.id,t),onError:e=>N(e.message,{tone:`danger`})}),c=ae(o.data),l=e=>!o.isSuccess||c.includes(e??`claude`),u=t&&l(Re(e)),d=e.worktreePath?(a.data?.targets??[]).filter(e=>{let t=We(e.id);return t===void 0||l(t)}).map(t=>({target:t,...Le(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!u&&d.length===0)return null;let f=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>N(`Worktree path copied`)).catch(()=>N(`Path: ${t}`))};if(r)return(0,q.jsx)(z,{onSelect:r,children:`Open in…`});let p=ze(e);return(0,q.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,q.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,q.jsx)(F,{})})]}),e.worktreePath?(0,q.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,q.jsxs)(`div`,{className:`task-open-targets mt-4 flex flex-wrap gap-3`,children:[u?(0,q.jsxs)(D,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,q.jsx)(Je,{}),`Terminal (resume session)`]}):null,d.map(({target:e,suffix:t,title:n})=>{let r=Ie(e);return(0,q.jsxs)(D,{variant:`outline`,"data-target":e.id,title:n,disabled:s.isPending,onClick:()=>s.mutate(e.id),children:[(0,q.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,q.jsxs)(D,{variant:`outline`,onClick:f,children:[(0,q.jsx)(O,{}),`Copy worktree path`]}):null]}),p?(0,q.jsxs)(`div`,{className:`mt-5 border-t border-border pt-5`,children:[(0,q.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,q.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:p}),(0,q.jsxs)(D,{variant:`outline`,onClick:()=>void Q(p,`Command copied to clipboard.`),children:[(0,q.jsx)(O,{}),`Copy resume command`]})]}):null]})}function kt(e,t){let n=r(),i=Ge(),[a,o]=(0,K.useState)(null),s=()=>n.invalidateQueries({queryKey:le.runs.all}),c=e=>N(e.message,{tone:`danger`}),l=p(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},d=fe();return{pin:u,markUnread:{isPending:d.isPending,mutate:()=>{t?.(),d.mutate(e.id,{onError:c})}},delete:b({mutationFn:()=>xe(e.id),onSuccess:()=>{s(),i(`/`)},onError:c}),terminal:b({mutationFn:()=>Se(e.id),onError:e=>{if(e instanceof he&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}c(e)}}),confirming:a,setConfirming:o}}async function Q(e,t){try{await navigator.clipboard.writeText(e),N(t)}catch{N(`Run manually: ${e}`)}}function At({run:e}){let t=d(e.id),n=l(e),r=He(n,e=>t.mutate({title:e},{onError:e=>N(e.message,{tone:`danger`})}));return r.editing?(0,q.jsx)(Ve,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,q.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:n}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:r.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,q.jsx)(Ne,{className:`size-3.5`,"aria-hidden":`true`})})]})}function jt({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let a=m(),o=te(),s=(0,K.useMemo)(()=>u(e,a),[e,a]),c=(0,K.useMemo)(()=>o===void 0?[]:s.map(e=>({projectId:o,kind:e.kind,number:e.number})),[s,o]),d=[(0,q.jsx)(`span`,{className:`min-w-0 max-w-full break-all`,children:Ce(e)},`workflow`)];e.branch&&d.push((0,q.jsx)(`span`,{"data-slot":`branch-chip`,className:`rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium max-md:max-w-full max-md:break-all`,children:e.branch},`branch`));let p=s.filter(e=>e.kind===`PR`);for(let t of p)d.push((0,q.jsx)(H,{reference:t,taskTitle:l(e),className:`h-5`,conflictAction:(0,q.jsx)(Be,{run:e,prNumber:t.number})},`pr-${t.number}`));let g=i(e);g&&I(g)&&!p.some(e=>e.url===g)&&d.push((0,q.jsx)(H,{reference:{kind:`PR`,url:g},taskTitle:l(e),className:`h-5`},`pr`));let _=h(e,a);if(_&&I(_)){let t=f(_);d.push((0,q.jsx)(H,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:_},taskTitle:l(e),className:`h-5`},`issue`))}e.diffStat&&d.push((0,q.jsx)(Xe,{stat:e.diffStat},`diff`)),e.automation&&d.push(r?(0,q.jsx)(W,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,q.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let v=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&v.push((0,q.jsx)(Ze,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&v.push((0,q.jsx)(`span`,{className:`tabular-nums`,children:pe(e.costUsd)},`cost`)),(0,q.jsx)(Pe,{projectId:o,requests:c,children:(0,q.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[d.map((e,t)=>(0,q.jsxs)(K.Fragment,{children:[t>0?(0,q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,q.jsxs)(`span`,{className:`ml-auto flex min-w-0 max-w-full items-center gap-1.5`,children:[v.map((e,t)=>(0,q.jsxs)(K.Fragment,{children:[t>0?(0,q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,q.jsx)(Pt,{run:e})]})]})})}function $(e){let t=e.ciWait;return[`running`,`queued`,`waiting`].includes(e.status)&&t&&t.phase!==`delivered`&&t.phase!==`withdrawn`?t:void 0}function Mt({run:e}){let t=$(e),n=t??e.lastCiWait;if(!t&&e.lastCiWaitError)return(0,q.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.lastCiWaitError});if(!n)return null;let r=n.result,i={passed:`CI checks passed — observed checks only; not merge approval`,failed:`CI checks failed — inspect the PR checks`,cancelled:`CI wait cancelled`,skipped:`CI checks skipped — inspect the PR checks`,no_checks:`No CI checks found — inspect the PR workflows`,deadline:`CI wait timed out — inspect the PR checks`,error:`CI wait unavailable — inspect access and the PR checks`,head_changed:`CI head changed — ${r?.headSha.slice(0,7)} → ${r?.observedHeadSha?.slice(0,7)??`unknown`}`},a=t?n.phase===`wake-pending`?e.status!==`running`||e.activity===`monitoring`?`CI result ready — waiting for capacity`:`CI result ready — current turn still working`:`Waiting for CI`:r?i[r.outcome]:n.phase===`withdrawn`?`CI wait cancelled`:`CI wait unavailable`,o=t?n.deadline:r?.observedAt,s=o?new Date(o):void 0,c=s&&Number.isFinite(s.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(s):void 0,l=`${n.repository}#${n.prNumber}`;return(0,q.jsxs)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1`,children:[(0,q.jsx)(`span`,{children:a}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),I(n.prUrl)?(0,q.jsx)(`a`,{href:n.prUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-11 min-w-11 max-w-full items-center rounded-sm px-1 font-medium text-foreground underline underline-offset-2 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:l}):(0,q.jsx)(`span`,{children:l})]}),c?(0,q.jsxs)(`p`,{children:[t?`Deadline`:`Observed`,` `,(0,q.jsx)(`time`,{dateTime:o,children:c})]}):t?(0,q.jsx)(`p`,{children:`CI deadline unavailable`}):null]})}function Nt({run:e}){if($(e)||e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,q.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,q.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function Pt({run:e}){let t=oe(),n=ye(),{accounts:r}=je(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,s=e.effort||void 0,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??i,d=n.data?.profiles.find(e=>e.id===l),f=l===void 0||n.isPending?void 0:n.isError?l:d?Me(r,u)?l==="default"?`default`:d.label:void 0:`${l} (removed)`,p=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,m=[i,f,a,s].filter(Boolean).join(` · `);return(0,q.jsxs)(De,{children:[(0,q.jsx)(B,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:m,"aria-label":`Agent: ${i}, ${f?`account ${f}, `:``}model ${a}${s?`, effort ${s}`:``}`,className:`flex min-w-0 shrink items-center max-md:min-h-11 gap-1.5 rounded-sm px-1 py-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,q.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:m})]})}),(0,q.jsxs)(Ee,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,q.jsxs)(R,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),f?(0,q.jsxs)(R,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,f]}):null,(0,q.jsxs)(R,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),s?(0,q.jsxs)(R,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,s]}):null,p?(0,q.jsxs)(R,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,p]}):null]})]})}function Ft({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=U(e),o=ze(e);return(0,q.jsxs)(De,{children:[(0,q.jsx)(B,{asChild:!0,children:(0,q.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,q.jsx)(_e,{"aria-hidden":`true`})})}),(0,q.jsxs)(Ee,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,q.jsx)(R,{className:`px-2 py-3 text-[10px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,q.jsxs)(z,{onSelect:n,children:[(0,q.jsx)(et,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,q.jsx)(Ot,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),o?(0,q.jsxs)(z,{onSelect:()=>void Q(o,`Command copied to clipboard.`),children:[(0,q.jsx)(O,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,q.jsxs)(z,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,q.jsx)(tt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,q.jsxs)(Te,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,q.jsx)(nt,{"aria-hidden":`true`}):(0,q.jsx)(a,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,i.deleteRun?(0,q.jsx)(we,{}):null,i.deleteRun?(0,q.jsxs)(z,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,q.jsx)(s,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function It({run:e,actions:t}){let n=t.confirming;return(0,q.jsx)(P,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,q.jsxs)(ce,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,q.jsxs)(M,{children:[(0,q.jsx)(T,{className:`text-danger`,children:`Delete task permanently?`}),(0,q.jsx)(C,{children:(0,q.jsxs)(q.Fragment,{children:[`Delete “`,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,title:l(e),children:l(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,q.jsxs)(A,{children:[(0,q.jsx)(j,{children:`Cancel`}),(0,q.jsx)(me,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function Lt({runId:e,onClose:t}){let n=ue(e);return(0,q.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,q.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,q.jsx)(F,{})})]}),n.isPending?(0,q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,q.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,q.jsx)(Ye,{children:n.data}):(0,q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,q.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,q.jsx)(D,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,q.jsx)(D,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{pt as a,st as c,X as i,ot as l,Z as n,dt as o,St as r,ct as s,Dt as t,et as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,En as i,Gt as a,It as o,Ln as s,Lt as c,Q as l,Rt as u,Sr as d,Ta as f,U as p,Ut as m,Wt as h,Yi as g,Yt as _,Zi as v,br as y,d as b,fr as x,gi as S,in as C,jt as w,l as T,nn as E,ot as D,pr as O,ri as k,sa as A,ti as j,ui as M,vr as N,wa as P}from"./alert-dialog-B422RI-k.js";import{t as F}from"./utils-PYYcpCFZ.js";import{a as ee,i as te,n as ne,o as re,r as ie,s as ae}from"./textarea-FjaU370i.js";import{T as oe}from"./prompt-templates-BlTGJB5W.js";import{c as I,t as L}from"./project-router-DbLkll25.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{c as U,h as W,o as G,t as K}from"./index-BszfYvBq.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function le(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function Y(e,t){return le(e)??[...t]}function X({projectId:e}){let t=r(),n=y(),s=i(),[c,l]=(0,q.useState)(``),f=O(e,!!e),p=s.data??[],m=(0,q.useMemo)(()=>p.map(e=>e.name),[p]),v=(0,q.useRef)([]);v.current=m;let b=(0,q.useMemo)(()=>new Set(Y(n.data,m)),[n.data,m]),x=(0,q.useRef)(Promise.resolve()),S=(0,q.useRef)(0),E=(0,q.useCallback)(e=>{let n=d.uiState,r=t.getQueryData(n),i=e(Y(r,v.current));t.setQueryData(n,{...r,importedSkills:i});let a=++S.current;x.current=x.current.then(async()=>{try{let e=await g({importedSkills:i});a===S.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:C.skills}))}catch(e){A(e instanceof Error?e.message:String(e),{tone:`danger`}),a===S.current&&t.invalidateQueries({queryKey:n})}})},[t]),D=(0,q.useCallback)(e=>{E(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[E]),k=m.length>0&&m.every(e=>b.has(e)),j=(0,q.useCallback)(()=>{if(k){let e=new Set(v.current);E(t=>t.filter(t=>!e.has(t)))}else E(e=>[...new Set([...e,...v.current])])},[k,E]);if(s.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:s.error.message});let M=z(p,c);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[10px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:ce,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:f.data,loadError:f.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:c,onChange:e=>l(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:m.length===0||n.isPending,onClick:j,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[k?(0,J.jsx)(w,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),k?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:s.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):M.length>0?M.map(e=>{let t=b.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:F(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>D(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(h,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(a,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:p.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let i=r(),a=I(),o=(0,q.useRef)(0),[s,u]=(0,q.useState)(!1),p=f({mutationFn:()=>S({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),a(oe(e))},onError:e=>A(e.message,{tone:`danger`})}),m=(t,n)=>{n.seq===o.current&&(i.setQueryData(d.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:C.skills}),A(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},h=(e,t)=>{t.seq===o.current&&A(e.message,{tone:`danger`})},g=f({mutationFn:t=>M(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),_=f({mutationFn:t=>k(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),v=e=>{let n=++o.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):g.mutate({action:e,seq:n})},y=t?.scopes.some(e=>e.skills.length>0)??!1,x=t?.status===`error`,w=y&&(t?.available||x),T=_.isPending||t?.status===`updating`,E=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],D=t?.scopes.filter(e=>e.updatedAt&&!E.includes(e))??[],O=`Checking installed Open Mercato skills…`;return n?O=`Update status is unavailable right now.`:t?.status===`available`?O=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?O=`Updating installed Open Mercato skills…`:t?.status===`current`?O=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?O=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(O=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:O}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,E.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,E.map(e=>Z(e.scope)).join(`, `),D.length?`; updated: ${D.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),w?(0,J.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:T,onClick:()=>v(`apply`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:F(`size-3.5`,T&&`motion-safe:animate-spin`)}),T?`Updating…`:x?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`check`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(l,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(ne,{open:s,onOpenChange:e=>p.isPending?void 0:u(e),children:(0,J.jsxs)(ie,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(re,{children:[(0,J.jsx)(ae,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(te,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(ee,{children:[(0,J.jsx)(b,{type:`button`,variant:`outline`,disabled:p.isPending,onClick:()=>u(!1),children:`No`}),(0,J.jsx)(b,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=x(),t=N(),n=i(),[a]=P(),[o,l]=(0,q.useState)(``),d=r(),h=s(),g=j().projectId??h.data?.bootProject??``,y=f({mutationFn:()=>v(),onSuccess:e=>{d.setQueryData(C.skills,e),A(`Team skills refreshed.`)},onError:e=>A(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let b=V(e.data??[]),S=(n.data?.length??0)>0,w=a.get(`skill`),O=w===Q||w===$||w!==null&&b.some(e=>e.name===w)?w:b[0]?.name??(S?$:Q),k=b.find(e=>e.name===O)??null,M=B(b,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":O===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(D,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(L,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":O===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(E,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:F(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,w===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>l(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:y.isPending,onClick:()=>y.mutate(),className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:F(`size-3`,y.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,w===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):M.length>0?M.map(e=>(0,J.jsx)(pe,{skill:e,active:O===e.name,highlighted:O===$&&e===b[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:b.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,w===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(L,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(p,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),O===$?(0,J.jsx)(X,{projectId:g}):O===Q?(0,J.jsx)(K,{skills:b}):k?(0,J.jsx)(G,{skill:k,usedBy:H(t.data?.workflows??[],k.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(T,{icon:(0,J.jsx)(m,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(L,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:F(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:F(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Aa as i,Ca as a,Gi as o,Jn as s,Kr as c,Li as l,Qn as u,Ta as d,_i as f,_t as p,d as m,di as h,ea as g,in as _,ji as v,l as y,lt as b,ni as x,sa as S,wn as C,zi as w}from"./alert-dialog-B422RI-k.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./textarea-FjaU370i.js";import{p as M,u as ee}from"./pill-BsbO6G7y.js";import{i as N,n as P,r as F}from"./git-toolbar-UiHnGvE0.js";import{t as I}from"./run-header-IFyIGCey.js";import{t as L}from"./use-submit-shortcut-KWJsC906.js";import{n as R,r as z}from"./index-BszfYvBq.js";import{t as B}from"./diff-tRE59UNb2.js";import{t as te}from"./use-desktop-BaYgO7YW.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${U}`)}function G(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var J=n();function Y({run:e,open:t,onOpenChange:n}){let r=i(),[a,o]=(0,V.useState)(``),s=c(e),l=(0,V.useRef)(s);l.current=s,(0,V.useEffect)(()=>{t&&o(l.current)},[t]);let u=d({mutationFn:t=>h(e.id,t),onSuccess:t=>{S(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:_.runs.changes(e.id)}),r.invalidateQueries({queryKey:_.runs.all})},onError:e=>S(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||u.isPending||u.mutate(e)};return(0,J.jsx)(D,{open:t,onOpenChange:n,children:(0,J.jsxs)(k,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(A,{children:`Commit changes`}),(0,J.jsxs)(E,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{L({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(),f())}}),(0,J.jsxs)(T,{children:[(0,J.jsx)(m,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(m,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||u.isPending,onClick:f,children:u.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=a(),t=u(e);return t.isPending?(0,J.jsx)(z,{tab:`changes`}):t.isError?(0,J.jsx)(R,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=C(),n=s(),a=r(e.id,ee(e.status)),c=te(),[u,m]=(0,V.useState)(`unified`),[h,v]=(0,V.useState)(!1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(!1),k=(0,V.useRef)(null),A=i(),j=()=>A.invalidateQueries({queryKey:_.runs.all}),L=e=>S(e.message,{tone:`danger`}),R=d({mutationFn:()=>o(e.id),onSuccess:e=>S(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:L}),z=d({mutationFn:()=>f(e.id),onSuccess:e=>{S(`Draft PR created — ${e.url}`),j()},onError:L}),H=d({mutationFn:()=>w(e.id),onError:e=>{if(e instanceof x&&e.command){navigator.clipboard.writeText(e.command).then(()=>S(`No terminal found — command copied to clipboard.`)).catch(()=>S(`Run manually: ${e.command}`));return}L(e)}}),U=d({mutationFn:t=>l(e.id,t),onError:L}),W=a.isError&&a.error instanceof x&&a.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:a.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:M(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:O(!0);break;case`push`:R.mutate();break;case`create-pr`:z.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=a.data?.files??[],Z=(0,V.useMemo)(()=>F(X),[X]),Q=c?u:`unified`,$=!c||h;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(I,{run:e,tab:`changes`}),(0,J.jsx)(P,{bar:G,branch:e.branch,stat:a.data?.stat,mode:Q,wrap:$,onModeChange:m,onWrapChange:v,onAction:K}),a.data?.repointedHead?(0,J.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,J.jsx)(`code`,{children:a.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:a.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,a.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):a.isError?(0,J.jsx)(y,{icon:W?(0,J.jsx)(b,{size:16}):(0,J.jsx)(p,{size:16}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:a.error.message}):X.length===0?(0,J.jsx)(y,{icon:(0,J.jsx)(b,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,J.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,J.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,J.jsx)(N,{root:Z,selected:T,onSelect:e=>{E(e),k.current?.scrollToPath(e)}})]}),(0,J.jsx)(B,{files:X,viewRef:k,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>g(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:D,onOpenChange:O})]})}async function ne(e,t){try{let n=await v(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Ca as i,Qn as a,U as o,Yt as s,_t as c,ct as l,d as u,er as d,l as f,ni as p,tr as m}from"./alert-dialog-B422RI-k.js";import{u as h}from"./pill-BsbO6G7y.js";import{n as g}from"./diff-controls-BGrXGi7O.js";import{t as _}from"./run-header-IFyIGCey.js";import{t as v}from"./project-router-DbLkll25.js";import{t as y}from"./search-x-I9Q8pgUa.js";import{t as b}from"./diff-stat-Cgnl_hYF.js";import{n as x,r as S}from"./index-BszfYvBq.js";import{t as C}from"./diff-tRE59UNb2.js";import{t as w}from"./use-desktop-BaYgO7YW.js";import{t as T}from"./commit-list-Dcnk7TnI.js";var E=e(t(),1),D=n();function O(){let{id:e}=i(),t=a(e);return t.isPending?(0,D.jsx)(S,{tab:`changes`}):t.isError?(0,D.jsx)(x,{tab:`changes`,error:t.error}):(0,D.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=i(),n=m(e.id,h(e.status));return(0,D.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,D.jsx)(_,{run:e,tab:`commits`}),t?(0,D.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,D.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,D.jsx)(f,{icon:(0,D.jsx)(c,{size:16}),tone:n.error instanceof p&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof p&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,D.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,D.jsx)(T,{slot:`task-commits`,heading:(0,D.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,D.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){let n=d(e,t),r=w(),[i,a]=(0,E.useState)(`unified`),[l,m]=(0,E.useState)(!1),h=n.isError&&n.error instanceof p&&n.error.status===409,_=r?i:`unified`,x=!r||l;return(0,D.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,D.jsx)(u,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,D.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,D.jsx)(o,{size:16,"aria-hidden":`true`}),`All commits`]})}),n.data?(0,D.jsx)(b,{stat:n.data.stat}):null,(0,D.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,D.jsx)(g,{mode:i,wrap:l,onModeChange:a,onWrapChange:m})})]}),n.isPending?(0,D.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,D.jsx)(f,{icon:h?(0,D.jsx)(y,{}):(0,D.jsx)(s,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,D.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,D.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,D.jsx)(f,{icon:(0,D.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,D.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`,children:(0,D.jsx)(C,{files:n.data.files,mode:_,wrap:x,className:`min-w-0`})})]})]})}function j({run:e}){let t=r(e.id,h(e.status));return t.isPending?(0,D.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,D.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,D.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,D.jsxs)(`h2`,{className:`mb-4 text-[15px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,D.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(v,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(l,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,D.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Qn as i,Rt as a,Yt as o,Z as s,ct as c,d as l,dt as u,ea as d,l as f,ni as p,rr as m,ut as h}from"./alert-dialog-B422RI-k.js";import{t as g}from"./utils-PYYcpCFZ.js";import{t as _}from"./createLucideIcon-BHp8sXmF.js";import{t as v}from"./run-header-IFyIGCey.js";import{a as y,i as b,r as x}from"./highlighter-CdHqIwFr.js";import{h as S,n as C,r as w}from"./index-BszfYvBq.js";var T=_(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=_(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=_(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=_(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),k=_(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),A=e(t(),1),j=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function M(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:j.has(t.slice(n+1).toLowerCase())}function N(e){return e.tooLarge?`too-large`:M(e.path)?`image`:e.binary?`binary`:`text`}function P(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var F=n();function I({runId:e,path:t,className:n}){let r=m(e,t??void 0);if(t===null)return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:(0,F.jsx)(h,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,F.jsx)(R,{className:n,children:(0,F.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof p&&r.error.status===409;return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:e?(0,F.jsx)(D,{}):(0,F.jsx)(o,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,F.jsx)(L,{runId:e,entry:r.data,className:n}):(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function L({runId:e,entry:t,className:n}){let r=N(t);return(0,F.jsxs)(R,{className:n,children:[(0,F.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:P(t.size)})]}),r===`image`?(0,F.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,F.jsx)(`img`,{"data-slot":`file-preview-image`,src:d(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,F.jsx)(f,{icon:(0,F.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${P(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,F.jsx)(f,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${P(t.size)} of binary data — no text preview.`}):(0,F.jsx)(V,{path:t.path,text:t.content??``})]})}function R({className:e,children:t}){return(0,F.jsx)(`section`,{"data-slot":`file-preview`,className:g(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,A.useMemo)(()=>t.split(`
|
|
2
|
-
`).map(e=>[{content:e}]),[t]),r=(0,A.useMemo)(()=>y(e),[e]),i=n.length>z,[a,o]=(0,A.useState)(null);return(0,A.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:b(t,r)?.tokens??n}function V({path:e,text:t}){let n=B(e,t);return(0,F.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":y(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex px-4`,children:[(0,F.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,F.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function H({runId:e,selected:t,onSelect:n}){return(0,F.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function U({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=m(e,t);return a.isPending?(0,F.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,F.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,F.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,F.jsx)(F.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,F.jsx)(W,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,F.jsx)(G,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function W({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,c]=(0,A.useState)(!1);return(0,F.jsxs)(`li`,{children:[(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>c(e=>!e),className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,F.jsx)(s,{size:16,"aria-hidden":`true`,className:g(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,o&&`rotate-90`)}),(0,F.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),o?(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function G({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=M(t)?k:c;return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:g(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,F.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,F.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:P(n)})]})})}function K(){let{id:e}=r(),t=i(e);return t.isPending?(0,F.jsx)(w,{tab:`files`}):t.isError?(0,F.jsx)(C,{tab:`files`,error:t.error}):(0,F.jsx)(q,{run:t.data})}function q({run:e}){let t=m(e.id,``),[n,r]=(0,A.useState)(null),[i,s]=(0,A.useState)(``),c=t.isError&&t.error instanceof p&&t.error.status===409;return(0,F.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,F.jsx)(v,{run:e,tab:`files`}),t.isSuccess?(0,F.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),i.trim()&&r(i.trim())},children:[(0,F.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,F.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,F.jsx)(S,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:i,onChange:e=>s(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,F.jsx)(l,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!i.trim(),children:`Open file`})]}):null,t.isPending?(0,F.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading files…`}):t.isError?(0,F.jsx)(f,{icon:c?(0,F.jsx)(O,{}):(0,F.jsx)(o,{size:16}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,F.jsxs)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,F.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),(0,F.jsx)(H,{runId:e.id,selected:n,onSelect:r})]}),(0,F.jsx)(I,{runId:e.id,path:n,className:`min-h-[200px] min-w-0 flex-1 bg-card md:min-h-[400px]`})]}),(0,F.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout.`})]})}export{K as TaskFilesRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.session-composer [data-slot=composer-editor]{border-color:var(--ring);border-radius:12px}.session-composer [data-slot=session-controls]{padding:0 12px 10px}.session-engine-controls{grid-template-columns:192px minmax(0,1fr) 176px;gap:8px;min-width:0;display:grid}.session-engine-controls [data-slot$=pill]{width:100%;min-width:0}.session-engine-controls [data-slot$=pill]>svg:last-child{margin-left:auto}.session-engine-controls [data-slot=session-runner-value]{width:100%;min-width:0}.session-composer [data-slot=composer-toolbar]{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:0 12px 12px;display:grid}.session-composer [data-slot=composer-toolbar]>[data-slot=session-controls]{grid-area:1/1/auto/-1;min-width:0;padding:0}.session-composer [data-slot=composer-footer-start]{flex-wrap:nowrap;grid-area:2/1;gap:8px}.session-composer [aria-label=Attach\ files],.session-composer [aria-label=Start\ dictation]{border:1px solid var(--border);border-radius:9px;width:44px;height:44px}.session-composer [data-slot=follow-up-model-pill]{min-height:44px}.session-composer [data-slot=follow-up-model-pill]>svg:last-child{margin-left:auto}.session-composer [data-slot=composer-submit-row]{flex:none;grid-area:2/2;margin:0}[data-slot=run-actions-menu] [role^=menuitem]{min-height:44px}[data-route=task-thread] [data-slot=thread-dock]{container:thread-dock/inline-size}@media (width>=768px){@container thread-dock (width<=640px){[data-slot=thread-dock]>div{padding-inline:8px}.session-engine-controls{grid-template-columns:112px minmax(0,1fr) 104px}.session-engine-controls :is([data-slot=runner-pill],[data-slot=session-runner-value],[data-slot=follow-up-effort-pill]){gap:6px;padding-inline:8px}.session-engine-controls :is([data-slot=runner-pill],[data-slot=session-runner-value],[data-slot=follow-up-effort-pill])>span>span,.session-engine-controls :is([data-slot=runner-pill],[data-slot=follow-up-effort-pill])>svg:last-child{display:none}}@container thread-dock (width<=400px){.session-engine-controls [data-slot=follow-up-model-pill]>span>span{display:none}.session-composer [data-slot=archive-action]{width:44px;min-width:44px;padding-inline:0}.session-composer [data-slot=archive-action]>span{display:none}}}@media (width<=767px){[data-slot=run-title-row]>.group{max-width:calc(100% - 52px)}.session-engine-controls{grid-template-columns:repeat(2,minmax(0,1fr))}.session-engine-controls [data-slot=follow-up-model-pill]{grid-area:2/1/auto/-1}.session-engine-controls [data-slot=follow-up-effort-pill]{grid-area:1/2}.task-open-targets{flex-direction:column;align-items:flex-start}}[data-route=task-thread] [data-slot=assistant-message] :is(h1,h2,h3,h4,strong,[data-streamdown=strong]){color:var(--foreground)}[data-route=task-thread] [data-slot=assistant-message] h2{font-size:20px;line-height:1.4}@media (width<=767px){[data-route=task-thread] [data-slot=assistant-message] h2{letter-spacing:-.4px;font-size:18px}}[data-route=task-thread] .session-composer [data-slot=composer-editor]{border-color:var(--composer-border)}[data-route=task-thread] [data-slot=session-conversation]{overflow-anchor:none}@media (width<=767px){[data-route=task-thread] [data-slot=thread-dock]{overflow-anchor:none}[data-route=task-thread] [data-slot=thread-tail-anchor]{overflow-anchor:auto}}[data-route=task-thread] [data-slot=session-conversation]{padding-block:calc(var(--spacing) * 5.5) calc(var(--spacing) * 4);gap:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=thread-row]{padding-bottom:calc(var(--spacing) * 4)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:is(p,ul,ol,table,blockquote){margin-block:calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:first-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:first-child{margin-top:0}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>:last-child,[data-route=task-thread] [data-slot=user-bubble] .thread-markdown>:last-child{margin-bottom:0}@media (width<=767px){[data-route=task-thread] [data-slot=session-conversation]{padding-block:calc(var(--spacing) * 4);gap:calc(var(--spacing) * 3.5)}[data-route=task-thread] [data-slot=thread-row]{padding-bottom:calc(var(--spacing) * 3.5)}}[data-route=task-thread] [data-slot=thread-footer][data-state=closed]{border-top:0;margin-top:0;padding-top:0;font-size:10px}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child){margin-bottom:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=assistant-message] .thread-markdown>p:has(>:is(strong,[data-streamdown=strong]):only-child)+p{margin-top:calc(var(--spacing) * 1)}[data-route=task-thread] [data-slot=tool-card]{background:var(--task-brand-bg);border-radius:7px}[data-route=task-thread] [data-slot=tool-card]>button{padding:calc(var(--spacing) * 2.5) calc(var(--spacing) * 3)}[data-route=task-thread] [data-slot=tool-card]>[data-slot=collapsible-content]>div{background:0 0;border-top:0}[data-route=task-thread] [data-slot=tool-output] pre,[data-route=task-thread] [data-slot=tool-error]{padding:calc(var(--spacing) * 2) calc(var(--spacing) * 3) calc(var(--spacing) * 2.5)}[data-route=task-thread] [data-slot=tool-output-fade]{--tw-gradient-to:var(--task-brand-bg)}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,Ca as i,Da as a,Dt as o,Ea as s,Et as c,Fa as l,Fr as u,H as d,J as f,Jt as p,Kr as m,Ma as h,Mi as g,Mn as _,Ni as v,On as y,Pa as b,Pn as x,Pr as S,Pt as C,Q as w,Qn as T,Rn as E,Rt as D,Ta as O,X as k,Xr as A,Y as j,Z as M,_i as N,at as P,ci as F,cr as ee,d as I,dr as L,en as te,et as ne,fa as R,fn as re,gn as ie,ht as ae,in as z,it as oe,l as se,ma as ce,ni as le,nt as ue,pi as B,qn as de,qt as fe,sa as V,si as pe,sr as me,u as he,xa as ge,xi as _e,xt as ve}from"./alert-dialog-B422RI-k.js";import{C as ye,S as be,T as xe,c as Se,i as Ce,n as we,s as Te,t as H,w as Ee,x as De,y as Oe}from"./utils-PYYcpCFZ.js";import{n as U,r as W,t as G}from"./collapsible-Cy_Fmkrd.js";import{n as ke,s as Ae,t as je}from"./agent-accounts-BZm_2WAv.js";import{t as Me}from"./textarea-FjaU370i.js";import{t as Ne}from"./createLucideIcon-BHp8sXmF.js";import{D as Pe,_ as Fe,d as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,s as He,u as Ue,x as We}from"./pill-BsbO6G7y.js";import{t as Ge}from"./external-link-BE6y205O.js";import{I as Ke,S as qe,_ as Je,b as Ye,c as Xe,g as Ze,l as Qe,v as $e,x as et}from"./prompt-templates-BlTGJB5W.js";import{a as tt,c as nt,i as rt,l as it,n as at,o as ot,r as st,s as ct,t as lt,u as ut}from"./run-header-IFyIGCey.js";import{s as dt,t as K,u as ft}from"./project-router-DbLkll25.js";import{t as pt}from"./message-square-B-MD-8rD.js";import{t as mt}from"./search-x-I9Q8pgUa.js";import{t as ht}from"./square-terminal-B6RYYieR.js";import{t as gt}from"./markdown-C_IcKVQd.js";import{c as _t,i as vt,l as yt,n as bt,o as xt,s as St,t as Ct}from"./thread-loading-77sJ8Yu_.js";import{t as wt}from"./use-submit-shortcut-KWJsC906.js";import{t as Tt}from"./lib-BQXq3kEf.js";import{t as Et}from"./zoomable-image-Z3JDnm0b.js";import{t as Dt}from"./run-diff-CyG0Nciv.js";import{t as Ot}from"./use-desktop-BaYgO7YW.js";var kt=120;function At(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jt(e){let t=e.replace(/\s+/g,` `).trim();return t.length>kt?`${t.slice(0,kt-1)}…`:t}function q(e,...t){if(At(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return jt(t)}}function Mt(e){if(!At(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return jt(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return jt(e.join(` `))}}function Nt(e){if(!At(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)At(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function Pt(e){return q(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function J(e,t){return t?`${e} ${t}`:e}function Ft(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:J(`Ran`,Mt(t)),subtitle:q(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:J(`Write`,q(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Nt(t);return{toolKind:`edit`,title:J(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:J(`Read`,q(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:J(`View image`,q(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:J(`Search`,q(t,`pattern`,`query`)),subtitle:q(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:J(`Fetch`,q(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:J(`Web search`,q(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=q(t,`subagent_type`,`subagentType`),i=q(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=q(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:q(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=q(t,`server`),n=q(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:Pt(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()!==``?jt(e):`Tool`,subtitle:Pt(t)}}var It=class extends h{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,u=o&&c===`forward`,d=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!u&&!f,isRefetching:a&&!d&&!p}}};function Lt(e,t){return a(e,It,t)}var Rt=Ne(`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`}]]),zt=Ne(`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`}]]),Bt=Ne(`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`}]]),Vt=Ne(`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`}]]),Ht=Ne(`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`}]]),Y=e(t(),1),Ut=[`run-event`,`ui-event`];function Wt(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 Gt(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,Y.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=Wt(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(Ce(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Ut)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 Kt=5,qt=200,Jt=5e3;function Yt(...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 Xt(e){let t=Te(),n=r(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=Lt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>g(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Kt,retry:1}),c=s({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>v(e,{signal:t}),retry:1}),l=o.isError||c.isError,u=Gt(l?e:void 0),d=o.data?.pages??[],f=d.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),p=(0,Y.useRef)(!1),m=(0,Y.useCallback)(()=>{e===void 0||p.current||(p.current=!0,g(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>Kt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{p.current=!1}))},[n,e,t]),h=Gt(!l&&f?e:void 0,{cursor:f?.liveCursor,afterSeq:f?.asOfSeq,maxEvents:Jt,compactAt:qt,onCompact:m}),_=(0,Y.useMemo)(()=>Yt(...d.map(e=>e.events)),[d]),y=(0,Y.useMemo)(()=>l?u:Yt(_,h),[l,u,_,h]),b=(0,Y.useMemo)(()=>{if(l)return u;let e=c.data?.contextEvents??[],t=c.data?.asOfSeq??0;return Yt(e,y.filter(({seq:e})=>e>t))},[c.data,l,u,y]),x=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),S=(0,Y.useCallback)(async()=>{l||await n.resetQueries({queryKey:i,exact:!0})},[l,i,n]);return{visibleEvents:y,currentEvents:b,isPending:!l&&o.isPending,contextPending:!l&&c.isPending,fallback:l,hasOlder:!l&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:x,jumpToLatest:S,retainedPages:d.length}}var X=n();function Zt({run:e}){let t=r(),n=O({mutationFn:()=>pe(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 i=new Date(e.autoResumeAt);if(!Number.isFinite(i.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(i);return(0,X.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,X.jsx)(ze,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,X.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,X.jsx)(ce,{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 Qt=e=>e.kind===`tool`,$t=e=>e.kind===`conversation`,en=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,tn=(e,t,n)=>`${e} ${e===1?t:n}`;function nn(e,t){let n=[];return e>0&&n.push(tn(e,`file`,`files`)),t>0&&n.push(tn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function rn(e){return`${e} earlier tool call${e===1?``:`s`}`}var an=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function on(e){for(let t of an)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 sn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Qt).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:nn(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 cn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if($t(e)){s(),c.push(e);continue}l(),Qt(e)&&en(e)&&!r.has(e.id)?o.push(e):(s(),Qt(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 cn(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 ln=new Map,un=(0,Y.createContext)(null);function dn(){return(0,Y.useContext)(un)}function fn({runId:e,children:t}){let n=(0,Y.useMemo)(()=>({get:t=>ln.get(e)?.get(t),set:(t,n)=>{let r=ln.get(e)??new Map;r.set(t,n),ln.set(e,r)}}),[e]);return(0,X.jsx)(un.Provider,{value:n,children:t})}var pn=(0,Y.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function mn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function hn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function gn(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 _n(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function vn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var yn=new Map;function bn(e,t){yn.set(e,t)}function xn(e){return yn.get(e)}var Sn=new Map;function Cn(e,t){Sn.set(e,t)}function wn(e,t){let n=Sn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Tn(e,t){let n={[e.id]:m(e)};for(let e of t??[])n[e.id]=m(e);return n}function Z(e,t){return t?.[e]??`Task`}function En(e,t){return e.senderRunId===t?`outbound`:`inbound`}function Dn(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 On(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`;default:return e}}function kn(e){if(e.outcome)return On(e.outcome.status);if(e.delivery===`not-delivered`)return An(`not-delivered`)}function An(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`not-delivered`:return`Not delivered`;default:return e}}var jn={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-md:text-[13px]`}};function Mn({role:e,children:t,className:n,...r}){let i=jn[e];return(0,X.jsxs)(`article`,{...r,"data-role":e,"aria-label":i.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]`,i.classes,n),children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex items-center gap-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(pt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i.label]}),(0,X.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,i.body),children:t})]})}function Nn({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(e),[f,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(),_=()=>{d(e),g(void 0),l(!0)},v=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}m(!0),g(void 0);try{await r?.(t),l(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},y=async()=>{m(!0),g(void 0);try{await i?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return c?(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,X.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,X.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,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,X.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:f,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:f?(0,X.jsx)(ft,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,X.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,className:`group`,children:[r||i?(0,X.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:[r?(0,X.jsx)(`button`,{type:`button`,"aria-label":a,onClick:_,disabled:f,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,X.jsx)(Ht,{className:`size-3.5`})}):null,i?(0,X.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void y(),disabled:f,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,X.jsx)(p,{className:`size-3.5`})}):null]}):null,h?(0,X.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,X.jsx)(gt,{breaks:!0,children:e}),n.length>0?(0,X.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>Oe(e.split(`/`).pop()??``)?(0,X.jsx)(Et,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,X.jsxs)(`a`,{href:Se(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,X.jsx)(C,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,X.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Pn({text:e}){return(0,X.jsx)(Mn,{role:`agent`,"data-slot":`assistant-message`,children:(0,X.jsx)(gt,{children:e})})}var Fn={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`}},In=`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 Ln({block:e,runId:t,taskTitles:n}){return(0,X.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,X.jsx)(Rn,{batch:e,runId:t,taskTitles:n},e.id))})}function Rn({batch:e,runId:t,taskTitles:n}){let r=En(e.messages[0]??{senderRunId:e.senderRunId},t),i=Fn[r],a=Hn(e.messages.map(e=>r===`outbound`?e.recipientRunId:e.senderRunId)),o=r===`outbound`?`SENT to`:`RECEIVED from`,s=`${o} ${a.map(e=>Z(e,n)).join(`, `)}`,c=e.messages[0],l=c?kn(c):void 0;return(0,X.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":r,"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]`,i.classes),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(`span`,{children:o}),a.map((e,t)=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,X.jsx)(K,{className:In,to:`/tasks/${e}`,"aria-label":`${o} ${Z(e,n)}`,children:Z(e,n)})]},e))]}),(0,X.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:Dn(e.kind)}),e.messages.length===1&&l?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:l}):null]}),(0,X.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,X.jsx)(gt,{breaks:!0,children:e.text})}),[...new Set(e.messages.map(e=>e.instruction??(e.delivery===`queued`?`Queued for the next safe turn. Pending messages are delivered together within the batch 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,X.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,X.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=kn(e);return(0,X.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(K,{className:In,to:`/tasks/${e.recipientRunId}`,"aria-label":`${Z(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:Z(e.recipientRunId,n)}),r?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,X.jsx)(zn,{message:e,runId:t,taskTitles:n})]},e.id)})}):null,e.messages.length===1&&c?(0,X.jsx)(zn,{message:c,runId:t,taskTitles:n}):null,(0,X.jsx)(Bn,{batch:e,heading:s})]})}function zn({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,Y.useContext)(pn),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,X.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=En(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(In,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,Z(i,n)]},e.message.messageId)})}function Bn({batch:e,heading:t}){return(0,X.jsxs)(G,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,X.jsxs)(W,{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,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,X.jsx)(U,{children:(0,X.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>Vn(e)).map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,X.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function Vn(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:An(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 Hn(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Un({note:e}){return(0,X.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 Wn={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function Gn({incident:e}){let t=Wn[e.provider];return(0,X.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,X.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,X.jsx)(K,{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 Kn({text:e}){let t=(0,Y.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
-
`,1)[0]??``,r=n.length<e.length;return(0,X.jsxs)(G,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,X.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,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,X.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,X.jsx)(gt,{inline:!0,children:n})}),r?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,X.jsx)(W,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,X.jsx)(U,{children:(0,X.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,X.jsx)(gt,{children:e})})})]})}function qn(){return(0,X.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,X.jsx)(ft,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Jn={read:ut,edit:Ht,delete:p,move:Bt,search:D,execute:ht,think:Rt,fetch:Re,task:f,plan:o,other:te},Yn=e=>e.split(`
|
|
3
|
-
`).length;function Xn({text:e,streaming:t}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(null),a=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Yn(e),s=!t&&!n&&o>12;return(0,X.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=_n(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,X.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,X.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,X.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 Zn({diffs:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,X.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Qn(e.oldText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Qn(e.newText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
-
`).map((e,t)=>(0,X.jsx)($n,{text:e},t))})]},`${e.path}:${t}`))})}function Qn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
-
`)}function $n({text:e}){return(0,X.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 er(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function tr({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=dn(),[a,o]=(0,Y.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=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??er(e)),{verb:d,detail:f}=on(e.title),p=Jn[e.toolKind]??te;return(0,X.jsxs)(G,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:H(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,X.jsxs)(W,{disabled:!l,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,X.jsx)(M,{"aria-hidden":!0,className:H(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,X.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:H(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,X.jsx)(ft,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,X.jsx)(`span`,{"data-slot":`tool-exit`,className:H(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,X.jsx)(U,{children:(0,X.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,X.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,X.jsx)(Zn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,X.jsx)(Xn,{text:e.output,streaming:c}):null,t.length>0?(0,X.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 nr({group:e,scope:t}){return(0,X.jsxs)(G,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,X.jsxs)(W,{className:`group flex h-[34px] 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,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,X.jsx)(U,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,X.jsx)(tr,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function rr({count:e,children:t}){return(0,X.jsxs)(G,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,X.jsxs)(W,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),rn(e)]}),(0,X.jsx)(U,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function ir({image:e}){return(0,X.jsx)(Et,{"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 ar(e,t=null){let n=E(),r=re(),i=Ie(e),a=i&&!e.runner,o=R(n.data),s=e.runner??(i?r.data?.defaultRunner:void 0)??`claude`,c=qe(t,o,s),l=o.includes(s),u=(i?De(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 or(e){let t=r(),n=Fe(e).continueRun,i=re(),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(e.id);p!==e.id&&(m(e.id),o(null),c(null),u(null),f(null));let h=ar(e,a),{runners:g,canContinue:_,currentRunner:v,runner:y}=h,b=me(y,n),x=i.data?.modelsLocked===!0,S=y!==v,C=!x&&!S&&e.model?{...i.data?.defaultModels,[y]:e.model}:i.data?.defaultModels,w=x?null:s,T=$e(y,b.data,[w,C?.[y]]),E=et(w,y,C,b.data),D=Ze(y,E,b.data),k=x?``:l??e.effort??``,A=Ye(k,D),j=!x&&l===null&&k!==``&&A===``,{accounts:M,repoAccount:N}=ke(),F=[...e.steps].reverse().find(e=>e.sessionId),ee=F?.profileId??e.agentProfile??`default`,I=S?N:{...N,[v]:ee},L=M.some(e=>e.provider===y&&e.id===d)?d:null,te=O({mutationFn:({text:t,images:n})=>_?B(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:h.runnerOverride,model:!x&&s!==null?E:void 0,effort:!x&&l!==null?A:j?``:void 0,agentProfile:L??void 0}):Promise.reject(Error(h.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:z.runs.all}),onError:e=>{e instanceof le&&e.status===409&&t.invalidateQueries({queryKey:z.runs.all})}});return{available:n,canContinue:_,startsNewConversation:!!F&&(y!==(F.backend??v)||(L??e.agentProfile??F.profileId??`default`)!==(F.profileId??`default`)),reason:h.reason,providerPending:h.providerPending,pills:(0,X.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`session-engine-controls`,children:[g.length>1||g.some(e=>je(M,e))?(0,X.jsx)(Qe,{icon:(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:g,value:y,accounts:M,account:L,repoAccount:I,onPick:(e,t)=>{f(t),e!==y&&(o(e),c(null))}}):(0,X.jsx)(Xe,{icon:(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,slot:`session-runner-value`,ariaLabel:`Runner`,label:y,value:y,onPick:()=>{},options:[{value:y,label:y}]}),(0,X.jsx)(Xe,{icon:(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:T.find(e=>e.id===E)?.label??`auto`,value:E,readOnly:x,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{c(e);let t=Ze(y,e,b.data);A!==``&&Ye(A,t)===``&&u(``)},options:T.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Je(y,b.data,b.isError,b.isFetching)}),(0,X.jsx)(Xe,{icon:(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:D.find(e=>e.value===A)?.label??`auto`,value:A,readOnly:x,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>u(e),options:D.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]}),continueWith:(e,t)=>te.mutateAsync({text:e,images:t})}}var sr=120,cr=e=>e!==`pending`&&e!==`running`,lr=e=>e.kind===`tool`&&e.toolKind===`task`,Q=e=>lr(e)&&e.parentItemId===void 0,ur=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function dr(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Q(e)&&t.has(e.id)))return n;return 0}function fr(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 pr(e){if(e.kind===`tool`)return mr(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 mr(n)}}}function mr(e){return e.length>sr?`${e.slice(0,sr-1).trimEnd()}…`:e}function hr(e,t=!1){let n=yr(e,e=>e.items.some(Q));if(n===-1)return[];let r=e=>!t&&!cr(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Q);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Q)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?dr(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!ur(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=>gr(e,c.get(e.id)??[],t))}function gr(e,t,n){let r={id:e.id,title:on(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=fr(e);i!==void 0&&(r.agentType=i),n&&!cr(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=pr(t[e]);if(n!==void 0){r.activity=n;break}}return r}function _r(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function vr(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function yr(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&&Q(e));if(i!==void 0)return gr(i,xr(e,t),n)}}function xr(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Q(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)ur(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}function Sr(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Y.useRef)(e);o.current=e;let s=(0,Y.useRef)(null),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(0,Y.useRef)(!0),p=(0,Y.useRef)(0),m=(0,Y.useRef)(null),h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),_=(0,Y.useCallback)(e=>{let t=s.current;if(!t)return;let n=g.current;n?n.scrollTo(e):t.scrollTop=e},[]),v=(0,Y.useCallback)(()=>{let e=s.current;e&&_(e.scrollHeight-e.clientHeight)},[_]),y=(0,Y.useCallback)(()=>{if(s.current){if(h.current!==e){h.current=e;let t=xn(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]),b=(0,Y.useCallback)(e=>{l(e),e&&(s.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),y())},[n,y]),x=(0,Y.useCallback)(()=>{f.current&&v()},[v]),S=(0,Y.useRef)(!1),C=(0,Y.useRef)(0),w=(0,Y.useRef)(!1),T=(0,Y.useRef)(void 0),E=(0,Y.useRef)(!1),D=(0,Y.useRef)(!1),O=(0,Y.useRef)(a);O.current=a;let k=(0,Y.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}}),[]),A=(0,Y.useRef)(null),j=(0,Y.useRef)(0),M=(0,Y.useCallback)(()=>{let e=A.current,t=s.current;if(!e||!t)return;A.current=null;let n=e.beforeTop+Math.max(0,t.scrollHeight-e.beforeHeight),r=t.getBoundingClientRect().top,i=e.anchor===void 0?-1:O.current.indexOf(e.anchor.key),a=g.current;a&&i>=0?a.scrollToIndex(i,{align:`start`,offset:-e.anchor.offset}):_(gn(t.scrollTop,r,e.anchor,k(t),n))},[k,_]),N=(0,Y.useCallback)(()=>{let e=s.current;if(!e||!r||S.current)return;m.current=null,f.current=!1,S.current=!0;let t=C.current+1;C.current=t;let n=e.scrollHeight,i=e.scrollTop,a=e.getBoundingClientRect().top,c=hn(a,k(e)),l=c===void 0?-1:O.current.indexOf(c.key),u=o.current,d=j.current;r().then(()=>{o.current===u&&j.current===d&&(A.current={beforeHeight:n,beforeTop:i,anchor:c,anchorIndex:l})},()=>{}).finally(()=>{C.current===t&&(S.current=!1)})},[k,r]);(0,Y.useEffect)(()=>()=>clearTimeout(T.current),[]);let P=(0,Y.useRef)(null);(0,Y.useEffect)(()=>()=>P.current?.disconnect(),[e,c]);let F=(0,Y.useCallback)((t,n)=>{let r=s.current;if(!r||!c)return;m.current=null,j.current+=1,A.current=null,f.current=!1,p.current=0,d(!0),P.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:(P.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()||(P.current=new MutationObserver(()=>{a()}),P.current.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]})),bn(e,{top:r.scrollTop,atBottom:!1})},[c,_,e]),ee=(0,Y.useCallback)(()=>{P.current?.disconnect();let t=s.current;if(!t)return;m.current=null,j.current+=1,A.current=null,f.current=!0,bn(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),L=a.length;return(0,Y.useLayoutEffect)(()=>{j.current+=1,A.current=null,S.current=!1},[e]),(0,Y.useLayoutEffect)(()=>{let e=A.current;e?(e.anchor===void 0?-1:O.current.indexOf(e.anchor.key))>e.anchorIndex?M():A.current=null:f.current&&v()},[I,L,M,v]),(0,Y.useLayoutEffect)(()=>{!s.current||!c||y()},[c,y]),(0,Y.useEffect)(()=>{let t=s.current,n=c;if(!t||!n)return;p.current=0;let r=null,i=!1,a=t.scrollTop,o=()=>{P.current?.disconnect(),m.current=null,j.current+=1,A.current=null,f.current=!1,p.current=0},l=()=>{j.current+=1,A.current=null,p.current=Date.now()},u=e=>{if(e.deltaY<0){o();let e=!w.current;w.current=!0,clearTimeout(T.current),T.current=setTimeout(()=>{w.current=!1},180),e&&mn(t)&&N()}else l()},h=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(o(),!e.repeat&&mn(t)&&N()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&l()},g=()=>{i=!0,D.current=!1,a=t.scrollTop,_n(t,80)||(o(),l())},y=()=>{i=!1},b=e=>{E.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(),!E.current&&mn(t)&&(E.current=!0,N())):r!==null&&n<r-1&&l(),r=n)},S=()=>{i&&!D.current&&t.scrollTop<a&&mn(t)&&(D.current=!0,N()),a=t.scrollTop;let n=_n(t,80);n&&m.current===null&&(f.current||Date.now()-p.current<2e3)&&(f.current=!0),d(!n),m.current===null&&bn(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,N,_,v]),{attachContent:b,scrollElRef:s,virtualizerRef:g,pillVisible:u,jumpToLatest:ee,jumpToRow:F,loadOlder:N,restickIfStuck:x}}function Cr({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,X.jsx)(wr,{runId:e,rows:t,controls:r}):(0,X.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,children:t.map(e=>(0,X.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,X.jsx)(Tr,{runId:e,rows:t,controls:n},e)}function Tr({runId:e,rows:t,controls:n}){let r=(0,Y.useRef)(null),i=(0,Y.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,Y.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,Y.useState)(()=>wn(e,t.length)),l=(0,Y.useRef)(t.length);l.current=t.length;let u=(0,Y.useRef)(null),d=(0,Y.useCallback)(t=>{n.virtualizerRef.current=t,t?u.current=t:u.current&&=(Cn(e,{rows:l.current,cache:u.current.cache}),null)},[e,n.virtualizerRef]),[f,p]=(0,Y.useState)(0);return(0,Y.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,X.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,className:`[overflow-anchor:none]`,children:(0,X.jsx)(Tt,{ref:d,scrollRef:n.scrollElRef,startMargin:f,shift:s,...c===void 0?{}:{cache:c},children:t.map(e=>(0,X.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 Er({onJump:e}){return(0,X.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,X.jsx)(d,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function Dr(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},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}},entries:e.items});return n}function Or(e,t){return[{id:`agent:${e}`,entries:t}]}function kr(e,t){let n=[];for(let t of e){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 sn([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function Ar({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c,taskTitles:l}){let u=(0,Y.useMemo)(()=>kr(n,e),[n,e]),d=Sr(`${e}:${t}`,{surface:r}),f=s??d,p=(0,Y.useMemo)(()=>{let e=new Map;u.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=>f.jumpToRow(e.rowKey,e.rowIndex)}},[u,f.jumpToRow]),m=(0,Y.useMemo)(()=>u.map(t=>({key:t.key,node:t.content.kind===`user-message`?(0,X.jsx)(jr,{message:t.content.message,actions:o?.[t.key]}):(0,X.jsx)(Mr,{block:t.content.block,scope:t.scope,renderAsk:a,runId:e,taskTitles:l})})),[o,a,u,e,l]),h=c??vn(``,m.length),g=m.length===0?i??null:(0,X.jsx)(Cr,{runId:`${e}:${t}`,rows:m,mode:h,controls:f});return(0,X.jsx)(fn,{runId:e,children:(0,X.jsx)(pn.Provider,{value:p,children:r===`panel`?(0,X.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,X.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:g}),f.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,X.jsx)(Er,{onJump:f.jumpToLatest})}):null]}):g})})}function jr({message:e,actions:t}){return(0,X.jsx)(Nn,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function Mr({block:e,scope:t,renderAsk:n,runId:r,taskTitles:i}){switch(e.kind){case`entry`:return(0,X.jsx)(Pr,{entry:e.entry,scope:t,renderAsk:n,runId:r,taskTitles:i});case`tool-card`:return(0,X.jsx)(tr,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,X.jsx)(Nr,{entries:e,scope:t,renderAsk:n,runId:r,taskTitles:i})});case`context-group`:return(0,X.jsx)(nr,{group:e,scope:t});case`streak`:return(0,X.jsx)(rr,{count:e.count,children:e.blocks.map(e=>(0,X.jsx)(Mr,{block:e,scope:t,renderAsk:n,runId:r,taskTitles:i},e.id))});case`worker-conversation`:return(0,X.jsx)(Ln,{block:e,runId:r,taskTitles:i});default:return Fr(e)}}function Nr({entries:e,scope:t,renderAsk:n,runId:r,taskTitles:i}){return sn([...e]).map(e=>(0,X.jsx)(Mr,{block:e,scope:t,renderAsk:n,runId:r,taskTitles:i},e.id))}function Pr({entry:e,scope:t,renderAsk:n,runId:r,taskTitles:i}){switch(e.kind){case`message`:return e.role===`assistant`?(0,X.jsx)(Pn,{text:e.text}):(0,X.jsx)(Nn,{text:e.text});case`reasoning`:return(0,X.jsx)(Kn,{text:e.text});case`tool`:return(0,X.jsx)(tr,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return e.attribution?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,X.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,X.jsx)(Un,{note:e})]}):(0,X.jsx)(Un,{note:e});case`conversation`:return(0,X.jsx)(Ln,{runId:r,taskTitles:i,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,X.jsx)(ir,{image:e});case`ask`:return n===void 0?(0,X.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,X.jsx)(Gn,{incident:e});default:return Fr(e)}}function Fr(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Ir({runId:e,renderAsk:t,agent:n,entries:r,onClose:i,taskTitles:a}){return(0,X.jsx)(vt,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,X.jsx)(xt,{"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,X.jsx)(Lr,{runId:e,renderAsk:t,agent:n,entries:r,taskTitles:a})})})}function Lr({runId:e,renderAsk:t,agent:n,entries:r,taskTitles:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(_t,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,X.jsxs)(yt,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,X.jsxs)(St,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(Rr,{status:n.status}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,X.jsx)(Ar,{runId:e,viewId:`agent:${n.id}`,sections:Or(n.id,r),mode:`panel`,renderAsk:t,taskTitles:i,empty:(0,X.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 Rr({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,X.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:H(`rounded-full px-2 py-0.5 text-[10.5px] 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 zr(e){let t=r();return O({mutationFn:()=>_e(e),onSuccess:()=>t.invalidateQueries({queryKey:z.runs.all}),onError:e=>V(e.message,{tone:`danger`})})}function Br({run:e}){return(0,X.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,X.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,X.jsx)(Ke,{className:`size-4 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,X.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,X.jsx)(Dt,{runId:e.id}),(0,X.jsx)(Vr,{run:e})]})}function Vr({run:e}){let t=r(),n=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),c=zr(e.id),l=ar(e),u=()=>t.invalidateQueries({queryKey:z.runs.all}),d=O({mutationFn:async t=>l.canContinue?B(e.id,{text:`Review feedback:\n${t}`,runner:l.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),u())},onError:e=>V(e.message,{tone:`danger`})}),f=O({mutationFn:()=>N(e.id),onSuccess:e=>{V(`Draft PR created — ${e.url}`),u()},onError:e=>{e instanceof le&&e.manual!==void 0&&s(e.manual),V(e.message,{tone:`danger`})}}),p=()=>{let e=i.trim();if(e.length===0){V(`Write what to change first.`),n.current?.focus();return}d.mutate(e)};return(0,X.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,X.jsx)(Me,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{wt({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(),p())},className:`min-h-[52px] text-[13px]`}),l.canContinue?null:(0,X.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:l.reason}),l.providerPending?null:(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(I,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:l.reason??`Send the notes back into the agent's session`,"aria-describedby":l.canContinue?void 0:`review-provider-guidance`,disabled:d.isPending||!l.canContinue,onClick:p,children:[(0,X.jsx)(zt,{"aria-hidden":`true`}),`Send back`]}),we(e.pullRequestUrl)?(0,X.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.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,X.jsx)(Ge,{"aria-hidden":`true`}),`PR ↗`]})}):(0,X.jsxs)(I,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,X.jsxs)(I,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`ml-auto`,title:Be(`review`),disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,X.jsx)(j,{"aria-hidden":`true`}),`Accept`]}):null]}),o===null?null:(0,X.jsx)(Hr,{command:o})]})}function Hr({command:e}){return(0,X.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,X.jsx)(oe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Ur(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Wr=1500;function Gr({status:e}){let t=(0,Y.useRef)(e),[n,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Ur())return;r(!0);let i=setTimeout(()=>r(!1),Wr);return()=>clearTimeout(i)},[e]),n?(0,X.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,X.jsx)(he,{}),(0,X.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,X.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 Kr(e){let t=r(),[n,i]=(0,Y.useState)(),a=Ue(e.status);(0,Y.useEffect)(()=>{(!a||n&&n!==e.id)&&i(void 0)},[a,e.id,n]);let o=O({mutationFn:async()=>{i(e.id);try{if(!(await F(e.id)).cancelled)throw Error(`The task changed before Stop was accepted. Check its status and retry.`)}catch(e){throw i(void 0),e}},onSettled:()=>t.invalidateQueries({queryKey:z.runs.all})});return{stopping:!!e.stopping||o.isPending||a&&n===e.id,stop:()=>o.mutateAsync()}}function qr({agents:e,onSelect:t}){return e.length===0?null:(0,X.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map(e=>(0,X.jsx)(Jr,{agent:e,onSelect:t},e.id))})}function Jr({agent:e,onSelect:t}){let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Yr,{status:e.status,stalled:e.stalled===!0}),(0,X.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,X.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:vr(e)}),(0,X.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,X.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,X.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,X.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function Yr({status:e,stalled:t=!1}){return t?(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,X.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,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}function Xr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function Zr({entries:e}){return e.length===0?null:(0,X.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map((e,t)=>(0,X.jsx)(Qr,{entry:e},`${t}:${e.content}`))})}function Qr({entry:e}){return(0,X.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,X.jsx)($r,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,X.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function $r({status:e}){return e===`cancelled`?(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,X.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,X.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,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,X.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,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function ei(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function ti(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 ni(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 ri(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function ii(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`||e===`cursor`?e:void 0}function ai(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 oi(e){let t=e=>ai(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 si(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var ci=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,li=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function ui(e){if(!ri(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!ri(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:li.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function di(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=$(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let 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 a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})},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 r.delivery!==`delivered`&&(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?.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};for(let t of e)switch(t.type){case`conversation-message`:{let e=Ee.safeParse(t);if(!e.success)break;h(e.data.message,e.data.delivery,{deliveredAt:e.data.deliveredAt,recordedAt:e.data.ts});break}case`request-outcome`:{let e=xe.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=ye.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=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s(t.seq).turnId=e;break}case`turn.completed`:{let e=$(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);i&&(i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!ri(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);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(l(t,e)),i=$(t.delta)??``;if(!n||i===``||!ci(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=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(fi.has(n))break;let i=Ft(n,t.input);if(i.toolKind===`plan`){let n=ui(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(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($(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=si(t.result);break}case`note`:case`lifecycle`:{let e=$(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=$(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=$(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=$(t.error)?` — ${$(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(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:$(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=ii(t.provider),n=$(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=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(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:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>ri(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;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(ai(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(ai(e.entry.text,!0).trim()))),oi(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.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:ai(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var fi=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]),pi=new Map,mi=new Map;function hi({run:e,currentThread:t,onOpenWorker:n}){let r=Ot(),[i,a]=(0,Y.useState)(()=>pi.get(e.id)??r),[s,l]=(0,Y.useState)({}),u=!(e.status===`running`||e.status===`waiting`)&&e.status!==`queued`,d=e.steps,p=(0,Y.useMemo)(()=>hr(t.turns,u),[t.turns,u]),m=ei(t)??[],h=e.delegation!==void 0&&e.delegation.role!==`invalid`,g=ot(e),_=d.length===0||d.every(e=>e.status===`done`||e.status===`skipped`),v=_r(p),y=Xr(m),b=[d.length>0?`workflow`:void 0,p.length>0?`subagents`:void 0,h?`workers`:void 0,m.length>0?`plan`:void 0].filter(e=>e!==void 0);if(b.length===0)return null;let x=t=>s[t]??mi.get(`${e.id}:${t}`)??t===`workers`,S=t=>{let n=!x(t);mi.set(`${e.id}:${t}`,n),l(e=>({...e,[t]:n}))},C=e.status===`done`&&_&&g===`complete`&&v.done===v.total&&y.done===y.total,T=g===`pending`,E=C?`All complete`:e.status===`failed`?`Failed`:e.status===`cancelled`?`Cancelled`:e.status===`running`?`Working`:e.status===`done`?g===`unknown`?`Workers unavailable`:T?`In progress`:`Incomplete`:`In progress`,D=e.status===`failed`||e.status===`cancelled`;return(0,X.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,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>{pi.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-[13.5px] hover:bg-muted/40`,children:[(0,X.jsx)(c,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Run activity`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-count`,className:`shrink-0 text-[12.5px] text-muted-foreground tabular-nums`,children:[`· `,b.length,` `,b.length===1?`section`:`sections`]}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-status`,className:H(`ml-auto flex min-w-0 shrink items-center gap-1.5 truncate text-[12.5px]`,C?`text-success`:D?`text-danger`:`text-muted-foreground`),children:[C?(0,X.jsx)(w,{"aria-hidden":!0,className:`size-3.5 shrink-0`}):null,(0,X.jsx)(`span`,{className:`truncate`,children:E})]}),(0,X.jsx)(k,{"aria-hidden":!0,className:H(`size-4 shrink-0 text-soft-foreground transition-transform`,i&&`rotate-180`)})]}),i?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[d.length>0?(0,X.jsx)(ct,{slot:`workflow`,icon:(0,X.jsx)(gi,{steps:d}),title:d[st(d)].name,meta:nt(st(d)+1,d.length,r,`step`),open:x(`workflow`),onToggle:()=>S(`workflow`),children:(0,X.jsx)(at,{steps:d})}):null,p.length>0?(0,X.jsx)(ct,{slot:`subagents`,icon:(0,X.jsx)(f,{className:`size-4`}),title:`Subagents`,meta:nt(v.done,v.total,r),open:x(`subagents`),onToggle:()=>S(`subagents`),children:(0,X.jsx)(qr,{agents:p,onSelect:n})}):null,h?(0,X.jsx)(tt,{run:e,open:x(`workers`),onToggle:()=>S(`workers`)}):null,m.length>0?(0,X.jsx)(ct,{slot:`plan`,icon:(0,X.jsx)(o,{className:`size-4`}),title:`Plan`,meta:nt(y.done,y.total,r),open:x(`plan`),onToggle:()=>S(`plan`),children:(0,X.jsx)(Zr,{entries:m})}):null]}):null]})}function gi({steps:e}){let t=rt(e[st(e)].status),n=`size-4 shrink-0`;switch(t){case`active`:return(0,X.jsx)(ft,{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,X.jsx)(ue,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-danger`)});case`pending`:return(0,X.jsx)(ne,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-soft-foreground`)});case`done`:return(0,X.jsx)(w,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":t,className:H(n,`text-success`)})}}function _i(e,t){return`${e.header}: ${t.join(`, `)}`}function vi({ask:e,run:t}){return e.resolved?(0,X.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,X.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,X.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,X.jsx)(yi,{ask:e,run:t})}function yi({ask:e,run:t}){let n=He(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,Y.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>_i(e,o[t]??[])).join(`
|
|
9
|
-
`)),d=n.mode===`resume`;return(0,X.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,X.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,X.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking`})}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,X.jsx)(bi,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(_i(e,i)):c(t,i))}},e.id??t))}),a?d?(0,X.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,X.jsx)(I,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,X.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,X.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,X.jsx)(`span`,{children:n.reason}),(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,X.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,X.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function bi({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,X.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,X.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-accent-strong px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),i?(0,X.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,X.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,X.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:H(`flex 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,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,X.jsx)(`span`,{"aria-hidden":!0,className:H(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var xi=2e3;function Si(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 Ci(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 wi(e,t){let n=r(),i=(0,Y.useMemo)(()=>Si(t),[t]),a=(0,Y.useMemo)(()=>Ci(t),[t]),o=e?.id,s=e?.status,c=e?.activity;(0,Y.useEffect)(()=>{if(!(i!==0&&(s===`running`||s===`waiting`))&&!(a!==0&&s===`running`&&c!==`monitoring`)||o===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:z.runs.detail(o)}),n.invalidateQueries({queryKey:z.runs.list()})},xi);return()=>clearTimeout(e)},[i,a,o,s,c,n])}function Ti(){let{id:e}=i(),t=T(e),n=Xt(e),r=t.data?.status,a=(0,Y.useMemo)(()=>di(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),o=(0,Y.useMemo)(()=>di(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),s=(0,Y.useRef)(void 0),c=(0,Y.useCallback)(e=>{s.current=e},[]),{mutate:l}=y();if((0,Y.useEffect)(()=>{t.data&&s.current!==t.data.id&&Pe(t.data)&&l(t.data.id)},[l,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),wi(t.data,n.visibleEvents),t.isPending)return(0,X.jsx)(Ct,{});if(t.isError){let e=t.error instanceof le&&t.error.status===404;return(0,X.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(se,{icon:e?(0,X.jsx)(mt,{}):(0,X.jsx)(Vt,{}),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,X.jsx)(I,{asChild:!0,variant:`outline`,children:(0,X.jsx)(K,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,X.jsx)(Ct,{}):(0,X.jsx)(Ei,{run:t.data,thread:a,currentThread:o,history:n,onMarkedUnread:c})}function Ei({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){dt();let a=ee(),o=r?be(r.currentEvents)!==void 0:n.turns.some(e=>e.items.some(e=>e.kind===`ask`&&!e.resolved)),s=A(e,o),c=ni(e.status,e.error),l=e.status===`running`||e.status===`waiting`,d=!l&&e.status!==`queued`,f=e.status===`queued`,p=or(e),m=Kr(e),h=zr(e.id),g=o||e.hasPendingHumanAsk===!0,v=!l&&!f&&p.available,y=v&&p.canContinue,[b,C]=(0,Y.useState)(void 0),[w,T]=(0,Y.useState)(e.id);w!==e.id&&(T(e.id),C(void 0));let E=(0,Y.useMemo)(()=>b===void 0?void 0:br(n.turns,b,d),[n.turns,b,d]),D=(0,Y.useMemo)(()=>b===void 0?[]:xr(n.turns,b),[n.turns,b]),O=L(e.id),k=He(e),j=We(e),M=l&&!j.usable,N=v&&!p.canContinue,P=M||N,F=M?j.reason:p.reason,{mutateAsync:I}=_(e.id),{mutateAsync:te}=ie(e.id),{mutateAsync:ne}=de(e.id),R=(0,Y.useMemo)(()=>f?{onEditTask:async e=>{await I({task:e})},onEditMessage:(e,t)=>te({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ne(e).then(()=>void 0)}:void 0,[f,I,te,ne]),re=(0,Y.useMemo)(()=>Dr(e,t),[e,t]),ae=(0,Y.useMemo)(()=>kr(re,e.id),[re,e.id]),z=(0,Y.useMemo)(()=>Tn(e,a.data),[e,a.data]),oe=(0,Y.useCallback)(t=>(0,X.jsx)(vi,{ask:t,run:e}),[e]),se=(0,Y.useMemo)(()=>{if(R===void 0)return;let t={task:{onEdit:R.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>R.onEditMessage(n.id,e),onRemove:()=>R.onRemoveMessage(n.id)};return t},[R,e.queuedMessages]),ce=S(e,x()),{search:le}=ge(),ue=vn(le,ae.length),B=Sr(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:ae.map(({key:e})=>e)});return Ae(B.restickIfStuck),(0,X.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(lt,{run:e,hasPendingHumanAsk:o,onMarkedUnread:()=>i?.(e.id)}),(0,X.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,X.jsx)(Di,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:B.loadOlder}):null,(0,X.jsx)(Ar,{runId:e.id,viewId:`main`,sections:re,mode:`document`,renderAsk:oe,messageActions:se,scrollControls:B,renderMode:ue,taskTitles:z}),t.turns.length===0?e.status===`queued`?(0,X.jsx)(Oi,{run:e}):(0,X.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,X.jsx)(qn,{}):null,c&&c.state===`closed`?(0,X.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":c.state,className:H(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,c.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[c.label,we(u(e))?(0,X.jsx)(`a`,{"data-slot":`pr-link`,href:u(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,we(ce)?(0,X.jsx)(`a`,{"data-slot":`issue-link`,href:ce,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,X.jsx)(Br,{run:e}):null]}),(0,X.jsx)(Gr,{status:e.status}),(0,X.jsx)(Ir,{runId:e.id,renderAsk:oe,agent:E,entries:D,taskTitles:z,onClose:()=>C(void 0)}),(0,X.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,X.jsx)(`div`,{className:`pointer-events-none fixed right-6 bottom-[calc(24px+env(safe-area-inset-bottom))] z-30 flex justify-center`,children:(0,X.jsx)(Er,{onJump:B.jumpToLatest})}):null,(0,X.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,X.jsx)(hi,{run:e,currentThread:n,onOpenWorker:C},e.id),(0,X.jsx)(Zt,{run:e}),e.status===`waiting`?(0,X.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ze,{tone:s.tone,pulse:s.pulse}),s.bucket===`waiting`?`The agent is paused, waiting for your reply`:`${s.label.charAt(0).toUpperCase()}${s.label.slice(1)} — you can send a message to resume`]}):null,f?(0,X.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ze,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,y&&p.startsNewConversation?(0,X.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null,(0,X.jsx)(bt,{onStop:Fe(e).cancel?m.stop:void 0,onFinish:Ve(e,o)?()=>h.mutateAsync().catch(()=>void 0):void 0,finishing:h.isPending,secondaryAction:Fe(e).archive?(0,X.jsx)(it,{run:e,compactOnMobile:!0}):void 0,stopOnEmpty:e.status===`queued`||e.status===`running`||e.status===`waiting`&&s.bucket===`none`&&!g,stopping:m.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:y?`Continuing…`:`Sending…`,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:y?p.pills:void 0,onSubmit:y?(e,t)=>p.continueWith(e,t):f?(e,t)=>O.mutateAsync({text:e,images:t}):async(e,t)=>{let n=await k.send(e,t);if(n!==void 0)throw Error(n)},disabled:P||!l&&!f&&!y,disabledReason:P?F:`Session closed — no session to resume.`,footerEnd:P&&!p.providerPending?(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:y&&!g,emptySubmitLabel:y&&!g?`Continue`:void 0,placeholder:f?`Add to the prompt — sent when the run starts…`:y?`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:()=>ti(t)})]})]}),(0,X.jsx)(`div`,{"data-slot":`thread-tail-anchor`,"aria-hidden":`true`,className:`h-px shrink-0 md:hidden`})]})}function Di({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,X.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,X.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,X.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,X.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,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Oi({run:e}){let t=Le(ee().data??[],e.id);return(0,X.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,X.jsx)(ze,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Ti as TaskThreadRoute};
|
|
@@ -1 +0,0 @@
|
|
|
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"./alert-dialog-B422RI-k.js";import{t as d}from"./utils-PYYcpCFZ.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};
|