@coreplane/switchboard 1.259.0 → 1.260.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/assets/config/config.example.yaml +16 -24
  2. package/dist/assets/deploy/cloudflare-memory/worker.ts +178 -27
  3. package/dist/assets/deploy/cloudflare-resident/worker.ts +74 -52
  4. package/dist/assets/deploy/cloudflare-sandbox/Dockerfile +6 -3
  5. package/dist/assets/package-lock.json +3 -3
  6. package/dist/assets/package.json +1 -1
  7. package/dist/assets/source.json +3 -3
  8. package/dist/assets/src/agents/registry.ts +3 -5
  9. package/dist/assets/src/core/authz/policy.ts +5 -0
  10. package/dist/assets/src/core/budgets.ts +7 -0
  11. package/dist/assets/src/core/coordinator/contract.ts +93 -5
  12. package/dist/assets/src/core/coordinator/driver.ts +386 -124
  13. package/dist/assets/src/core/memory/types.ts +5 -0
  14. package/dist/assets/src/core/pipelineStanding.ts +11 -4
  15. package/dist/assets/src/core/plane/decide.ts +53 -12
  16. package/dist/assets/src/core/provider.ts +5 -0
  17. package/dist/assets/src/core/runEvents.ts +14 -15
  18. package/dist/assets/src/core/runRecord.ts +36 -3
  19. package/dist/assets/src/core/ship/coordinator.ts +58 -18
  20. package/dist/assets/src/core/ship/renewal.ts +21 -8
  21. package/dist/assets/src/core/types.ts +11 -0
  22. package/dist/assets/web/dist/.vite/manifest.json +67 -67
  23. package/dist/assets/web/dist/assets/{DeliveryPage-DadntjSp.js → DeliveryPage-DvMrWUg7.js} +1 -1
  24. package/dist/assets/web/dist/assets/HomePage-CcGEJ4w0.js +1 -0
  25. package/dist/assets/web/dist/assets/{PendingTurnRow-DBPMLVsm.js → PendingTurnRow-BzGVxDYs.js} +1 -1
  26. package/dist/assets/web/dist/assets/{PlanePage-DLusMGQ0.js → PlanePage-Arj9cyd5.js} +1 -1
  27. package/dist/assets/web/dist/assets/{ResidentDetailPage-CPnHnrxy.js → ResidentDetailPage-CBPPe4Sj.js} +1 -1
  28. package/dist/assets/web/dist/assets/{ResidentsIndexPage-C9hASwHL.js → ResidentsIndexPage-CEpXgGo7.js} +1 -1
  29. package/dist/assets/web/dist/assets/RunFoldRow-BJq7tnLr.js +1 -0
  30. package/dist/assets/web/dist/assets/{RunRoutePage-o1xzkTGZ.js → RunRoutePage-DWiny7LN.js} +4 -4
  31. package/dist/assets/web/dist/assets/RunsIndexPage-Cxufw5sV.js +1 -0
  32. package/dist/assets/web/dist/assets/{ScheduledPage-BIdfC0V3.js → ScheduledPage-SBcuDdVg.js} +1 -1
  33. package/dist/assets/web/dist/assets/{SettingsPage-CnqWAjl3.js → SettingsPage-DrD_vWdp.js} +1 -1
  34. package/dist/assets/web/dist/assets/{SilentTurn-DGNg0sIZ.js → SilentTurn-Bjl7EPEN.js} +1 -1
  35. package/dist/assets/web/dist/assets/{StatusDot-D_D_iJS8.js → StatusDot-BqteQTav.js} +1 -1
  36. package/dist/assets/web/dist/assets/{Tooltip-DVFmM7on.js → Tooltip-KRqJXEPN.js} +1 -1
  37. package/dist/assets/web/dist/assets/{UnitRoutePage-7fAXFoB_.js → UnitRoutePage-Cv28FV4I.js} +1 -1
  38. package/dist/assets/web/dist/assets/{budgets-BRLm6oID.js → budgets-DQXVllsm.js} +1 -1
  39. package/dist/assets/web/dist/assets/{dist-C1VX-_mm.js → dist-CTASUSno.js} +1 -1
  40. package/dist/assets/web/dist/assets/{indexRow-BO_GIdF6.js → indexRow-B1YBy_IL.js} +1 -1
  41. package/dist/assets/web/dist/assets/{main-Cl7xHG34.js → main-eTAe9-hk.js} +2 -2
  42. package/dist/assets/web/dist/assets/{sseReplay-BjlKmQsY.js → sseReplay-BcsNbn2j.js} +1 -1
  43. package/dist/cli.js +8299 -7929
  44. package/package.json +1 -1
  45. package/dist/assets/web/dist/assets/HomePage-BEEpTnVT.js +0 -1
  46. package/dist/assets/web/dist/assets/RunFoldRow-OPe7Z0Cz.js +0 -1
  47. package/dist/assets/web/dist/assets/RunsIndexPage-0YAClYQh.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreplane/switchboard",
3
- "version": "1.259.0",
3
+ "version": "1.260.0",
4
4
  "description": "Mention it in Slack and an agent reviews the PR, ships the fix, or answers the question — on the model you choose, with its tools running where you decide.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://openswitchboard.dev",
@@ -1 +0,0 @@
1
- import{i as e,r as t,t as n}from"./AppShell-CSXDCV4x.js";import{An as r,Cn as i,Cr as a,Ft as o,Gr as s,Ii as c,Li as l,Mn as u,Pi as d,Pt as ee,Qr as f,Sn as p,Tr as m,Xr as h,_r as g,bn as _,c as v,dr as te,en as ne,hr as re,ir as ie,ji as y,kn as b,l as ae,ln as x,o as oe,sr as se,t as S,wr as ce,xi as C,xn as w,y as T,yi as E,yn as D,yr as le}from"./browser-B6T5hjfR.js";import{t as O}from"./Tooltip-DVFmM7on.js";import{i as ue}from"./PendingTurnRow-DBPMLVsm.js";import{b as de,x as fe}from"./main-Cl7xHG34.js";import{t as pe}from"./eventSource-Bj_dZf6M.js";import{t as me}from"./wallClock-DmaC1sKA.js";import{r as he}from"./indexFormat-B-pd4r7Y.js";import{K as ge,i as _e}from"./indexRow-BO_GIdF6.js";import"./format-BldUwl_R.js";import{S as k,_ as ve,a as ye,b as be,c as A,d as j,f as xe,g as Se,h as M,i as Ce,l as we,m as N,n as Te,o as Ee,p as De,r as Oe,s as P,t as ke,u as Ae,v as je,x as Me,y as Ne}from"./SilentTurn-DGNg0sIZ.js";import{t as F}from"./SlackMark-CtiHrNjr.js";import{T as Pe}from"./sseReplay-BjlKmQsY.js";var I={class:`thread-tip flex max-w-xs flex-col gap-1 text-xs`},Fe={class:`tip-title leading-snug text-highlighted`},L={class:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 font-mono text-[0.68rem] text-muted`},Ie={class:`tip-when tabular-nums`},Le={class:`tip-source inline-flex items-center gap-1`},Re={class:`tip-runs`},ze={key:0,class:`tip-live inline-flex items-center gap-1 text-toned`},R=u({__name:`ThreadTip`,props:{row:{},now:{}},setup(e){let t=e,n=D(()=>k(t.row,t.now));return(t,r)=>(g(),i(`div`,I,[_(`p`,Fe,l(n.value.title),1),_(`p`,L,[_(`span`,Ie,l(n.value.when),1),r[1]||=_(`span`,{"aria-hidden":`true`},`·`,-1),_(`span`,Le,[e.row.surface===`slack`?(g(),w(F,{key:0})):p(``,!0),b(l(n.value.source),1)]),r[2]||=_(`span`,{"aria-hidden":`true`},`·`,-1),_(`span`,Re,l(n.value.runs),1),n.value.live?(g(),i(`span`,ze,[...r[0]||=[_(`span`,{class:`size-1.5 rounded-full bg-ok`,"aria-hidden":`true`},null,-1),b(`live`,-1)]])):p(``,!0)])]))}}),z={class:`rail flex flex-col gap-1 text-[0.8rem]`,"aria-label":`Recent threads`},B={class:`filter mb-2 flex items-center gap-2 rounded-lg border border-default px-2.5 py-1.5 transition-colors duration-150 ease-out focus-within:border-primary hover:border-accented`},V={key:0,class:`rounded border border-default px-1 font-mono text-[0.65rem] text-dimmed`},Be={key:0,class:`empty px-3 py-1 text-xs text-dimmed`},H={key:1,class:`nomatch px-3 py-1 text-xs text-dimmed`},U={key:0,class:`dot mt-px size-1.5 shrink-0 self-center rounded-full bg-ok motion-safe:animate-pulse`,"aria-label":`a run is in flight`},Ve={class:`title min-w-0 flex-1 truncate text-toned group-hover:text-highlighted group-aria-[current=page]:text-highlighted`},He={class:`when shrink-0 font-mono text-[0.7rem] tabular-nums text-dimmed`},W={class:`retention px-3 pt-1 text-[0.7rem] leading-relaxed text-dimmed`},G={class:`model px-3 pt-2 text-[0.7rem] leading-relaxed text-dimmed`,"data-testid":`what-is-a-thread`},K=500,Ue=u({__name:`ConversationRail`,props:{rows:{},current:{},now:{},retention:{}},setup(e,{expose:t}){let n=e,s=C(``),c=C(null),u=D(()=>N(n.rows,s.value));function d(){c.value?.focus(),c.value?.select()}function ee(e){e.key===`Escape`&&(s.value=``,c.value?.blur())}return t({focusFilter:d}),(t,n)=>{let d=T,v=m(`RouterLink`),te=O;return g(),i(`nav`,z,[r(v,{class:`new group mb-3 flex items-center gap-2 rounded-xl bg-inverted px-3 py-2 font-medium text-inverted no-underline transition-[transform,opacity] duration-150 ease-out hover:-translate-y-px hover:opacity-90 active:translate-y-0 active:opacity-100`,to:`/threads`,"aria-current":e.current===``?`page`:void 0,"data-testid":`new-thread`},{default:h(()=>[r(d,{name:`i-lucide-plus`,class:`size-4 shrink-0 transition-transform duration-150 ease-out group-hover:rotate-90`,"aria-hidden":`true`}),n[1]||=_(`span`,null,`New thread`,-1),n[2]||=_(`span`,{class:`kbd ml-auto flex gap-0.5 font-mono text-[0.65rem] opacity-70`,"aria-label":`shortcut shift command O`},[_(`kbd`,{class:`rounded border border-current/30 px-1`},`⇧`),_(`kbd`,{class:`rounded border border-current/30 px-1`},`⌘`),_(`kbd`,{class:`rounded border border-current/30 px-1`},`O`)],-1)]),_:1},8,[`aria-current`]),_(`label`,B,[r(d,{name:`i-lucide-search`,class:`size-3.5 shrink-0 text-dimmed`,"aria-hidden":`true`}),f(_(`input`,{ref_key:`filter`,ref:c,"onUpdate:modelValue":n[0]||=e=>s.value=e,class:`min-w-0 flex-1 bg-transparent text-[0.8rem] text-highlighted outline-none placeholder:text-dimmed`,type:`text`,placeholder:`Filter recent`,"aria-label":`Filter recent threads`,autocomplete:`off`,onKeydown:ee},null,544),[[ne,s.value]]),s.value?p(``,!0):(g(),i(`kbd`,V,`⌘K`))]),n[8]||=_(`p`,{class:`label px-3 pb-1 font-mono text-[0.65rem] font-medium uppercase tracking-wider text-dimmed`},`Recent`,-1),e.rows.length===0?(g(),i(`p`,Be,`Nothing yet. Ask something.`)):u.value.length===0?(g(),i(`p`,H,`Nothing matches "`+l(s.value)+`".`,1)):p(``,!0),r(o,{name:`sb-rise`,tag:`div`,class:`rows flex flex-col gap-0.5`},{default:h(()=>[(g(!0),i(x,null,a(u.value,t=>(g(),i(`div`,{key:t.id},[r(te,{"delay-duration":K,content:{side:`right`,sideOffset:12,align:`start`},ui:{content:`h-auto max-w-xs px-2.5 py-2`}},{content:h(()=>[r(R,{row:t,now:e.now},null,8,[`row`,`now`])]),default:h(()=>[r(v,{class:`row group relative flex items-baseline gap-2 rounded-lg px-3 py-1.5 no-underline transition-colors duration-150 ease-out hover:bg-(--ui-bg-muted) aria-[current=page]:bg-(--ui-bg-accented)`,to:`/threads/${encodeURIComponent(t.id)}`,"aria-current":t.id===e.current?`page`:void 0,"data-surface":t.surface},{default:h(()=>[n[3]||=_(`span`,{class:`bar absolute left-0 top-1/2 h-4 w-0.5 -translate-y-1/2 rounded-full bg-primary opacity-0 transition-opacity duration-150 ease-out group-aria-[current=page]:opacity-100`,"aria-hidden":`true`},null,-1),t.live?(g(),i(`span`,U)):p(``,!0),_(`span`,Ve,l(t.title),1),_(`span`,He,l(y(j)(t.lastAt,e.now)),1)]),_:2},1032,[`to`,`aria-current`,`data-surface`])]),_:2},1024)]))),128))]),_:1}),r(v,{class:`all mt-3 flex items-center gap-1.5 px-3 py-1 text-xs font-medium text-muted no-underline transition-colors duration-150 ease-out hover:text-highlighted`,to:`/runs`,"data-testid":`all-runs`},{default:h(()=>[n[4]||=b(` All runs `,-1),r(d,{name:`i-lucide-arrow-right`,class:`size-3 transition-transform duration-150 ease-out group-hover:translate-x-0.5`,"aria-hidden":`true`})]),_:1}),_(`p`,W,l(e.retention),1),_(`p`,G,[n[6]||=b(` A thread is a conversation; each message you send is a run. `,-1),r(v,{class:`text-muted hover:text-highlighted`,to:`/runs`},{default:h(()=>[...n[5]||=[b(`Runs`,-1)]]),_:1}),n[7]||=b(` lists every run across everyone's threads. `,-1)])])}}}),We={class:`empty mx-auto flex w-full max-w-2xl flex-col items-center gap-5 px-3 py-6 text-center`},Ge={class:`flex flex-col gap-1.5`},Ke={class:`greeting sb-stagger text-xl font-medium tracking-tight text-highlighted`,style:{"--sb-i":`1`}},qe={class:`sb-stagger w-full text-left`,style:{"--sb-i":`3`}},q={key:0,class:`chips flex flex-wrap justify-center gap-2`,"aria-label":`Suggestions`},J=[`onClick`],Je=u({__name:`EmptyState`,props:{name:{},hour:{},suggestions:{}},emits:[`pick`],setup(e,{emit:n}){let o=n;return(n,s)=>(g(),i(`section`,We,[r(t,{draw:``,idle:``,class:`mark-lg sb-stagger text-highlighted`,style:{"font-size":`3.25rem`,"--sb-i":`0`}}),_(`div`,Ge,[_(`h2`,Ke,l(y(M)(e.hour,e.name)),1),s[0]||=_(`p`,{class:`sub sb-stagger text-[0.875rem] text-muted`,style:{"--sb-i":`2`}},` Ask in plain words. The right agent picks it up, and you watch it work here. `,-1)]),_(`div`,qe,[ce(n.$slots,`default`)]),e.suggestions.length>0?(g(),i(`ul`,q,[(g(!0),i(x,null,a(e.suggestions,(e,t)=>(g(),i(`li`,{key:e,class:`sb-stagger`,style:c({"--sb-i":t+4})},[_(`button`,{type:`button`,class:`chip rounded-full border border-default px-3 py-1 text-[0.8rem] text-toned transition-[color,border-color,background-color,transform] duration-150 ease-out hover:-translate-y-px hover:border-accented hover:bg-(--ui-bg-muted) hover:text-highlighted focus-visible:outline-2 focus-visible:outline-primary active:translate-y-0`,onClick:t=>o(`pick`,e)},l(e),9,J)],4))),128))])):p(``,!0)]))}});function Ye(){return{runs:new Map,connected:!1}}function Xe(e,t){t.type===`upsert`&&t.run?t.run.finished||!t.run.threadKey?e.runs.delete(t.run.id):e.runs.set(t.run.id,{threadKey:t.run.threadKey,startedAt:t.run.startedAt,...t.run.label===void 0?{}:{label:t.run.label},...t.run.channelId===void 0?{}:{channelId:t.run.channelId}}):t.type===`removed`&&t.id&&e.runs.delete(t.id)}function Y(e){let t=new Map;for(let n of e.runs.values()){let e=t.get(n.threadKey)??[];e.push(n),t.set(n.threadKey,e)}return t}function Ze(e,t){return t.includes(`:`)?t:`${e}:${t}`}function Qe(e){let t=e.indexOf(`:`);return t>0?e.slice(0,t):`unknown`}function $e(e,t,n){if(!t.connected)return[...e];let r=Y(t),i=new Set,a=e.map(e=>{let t=Ze(n,e.id);i.add(t);let a=r.get(t);if(!a)return e.live?{...e,live:!1}:e;let o=e.live?0:a.length;return{...e,live:!0,runs:e.runs+o,lastAt:Math.max(e.lastAt,...a.map(e=>e.startedAt))}}),o=[];for(let[e,t]of r){if(i.has(e))continue;let r=t.reduce((e,t)=>t.startedAt>e.startedAt?t:e),a=r.label?he(r.label).snippet:void 0;o.push({id:e.startsWith(`${n}:`)?e.slice(n.length+1):e,title:a??r.label??e,excerpt:a??r.label??e,lastAt:r.startedAt,runs:t.length,live:!0,surface:Qe(r.channelId??e)})}return o.sort((e,t)=>t.lastAt-e.lastAt),[...o,...a]}var et={key:0,class:`mx-auto my-12 max-w-xl text-center text-toned`},tt=[`data-rail`],nt={key:0,class:`relative hidden md:block`},rt=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`],it={class:`thread mx-auto flex min-h-[calc(100vh-8rem)] w-full max-w-3xl flex-col`},at={key:4,class:`inline text-[0.875rem] text-toned`,"data-testid":`inline`},ot={key:2,class:`elsewhere sticky bottom-0 z-10 -mx-3 mt-auto bg-default/85 px-3 py-4 text-center text-[0.8rem] text-toned backdrop-blur sm:-mx-5 sm:px-5`,"data-testid":`elsewhere`},st=[`href`],ct={key:3,class:`composer-dock sticky bottom-0 z-10 -mx-3 mt-auto bg-default/85 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-3 backdrop-blur sm:-mx-5 sm:px-5`},X=`(min-width: 48rem)`,Z=u({__name:`HomePage`,setup(t){let u=oe(`home`),f=me(u?.now),m=u?.conversation??``,ne=v(u?.retentionDays??null),ce=0,T=e=>`${e}-${++ce}`,O=E([]);for(let e of u?.turns??[]){if(`kind`in e){e.kind===`receipt`?O.push({key:T(`s`),kind:`silent`,reason:e.reason,at:e.decidedAt}):O.push({key:T(`w`),kind:`parent`,turn:e});continue}O.push({key:T(`p`),kind:`person`,text:e.request,at:e.receivedAt??e.startedAt,pending:!1});let t=!e.finished&&e.token?{eventsUrl:`/runs/${encodeURIComponent(e.id)}/events?t=${e.token}`,stopUrl:`/runs/${encodeURIComponent(e.id)}/stop?t=${e.token}`,serverNow:u?.now}:null;O.push({key:T(`a`),kind:`assistant`,turn:e,live:t,ended:e.finished})}let he=D(()=>{for(let e=O.length-1;e>=0;e--){let t=O[e];if(t.kind===`assistant`&&t.live&&!t.ended&&t.turn.hosted!==!0)return t}return null}),k=C(null),j=C(0);le(e,j);let M=C(``),N=C(void 0),F=D(()=>xe(he.value!==null,M.value)),I=C(!1);s(M,()=>{N.value&&M.value===``&&(N.value=void 0)});function Fe(e){M.value=e,L()}async function L(){if(!u||I.value)return;let e=Ee(M.value.trim(),u.commands);if(e===``)return;let t=E({key:T(`p`),kind:`person`,text:e,at:f.value,pending:!0});O.push(t),M.value=``,N.value=void 0,I.value=!0,j.value++;try{let n=await fetch(u.sendUrl,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e})}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.viewPath==`string`&&typeof r.runId==`string`){let n=Se(r.viewPath);if(!n)throw Error(`the run's view path was not one`);t.pending=!1,S.pathname()===`/threads`&&S.replaceUrl(`/threads/${encodeURIComponent(m)}`),O.push({key:T(`a`),kind:`assistant`,turn:{id:r.runId,request:e,startedAt:f.value,receivedAt:f.value,finished:!1,eventCount:0},live:{eventsUrl:n.eventsUrl,stopUrl:n.stopUrl},ended:!1});return}if(n.ok&&r.offer&&typeof r.offer.line==`string`){t.pending=!1;let e=je({line:r.offer.line,...r.offer});M.value=e.command,N.value=e.hint;return}if(n.ok&&typeof r.reply==`string`){t.pending=!1;let e=Ae(r.reply);e.kind===`inline`&&O.push({key:T(`i`),kind:`inline`,text:e.text});return}throw Error(r.error??`HTTP ${n.status}`)}catch(e){t.pending=!1,t.failed=`not sent: ${e instanceof Error?e.message:`error`}`}finally{I.value=!1}}function Ie(){let e=k.value;e&&fetch(`${e}${e.includes(`?`)?`&`:`?`}mode=soft`,{method:`POST`,credentials:`same-origin`})}function Le(e,t,n){let r=O.filter(e=>e.kind===`person`),i=ve(r.map(e=>({text:e.text,folded:e.folded!==void 0,ref:e})),t);if(!i)return;let a=e.turn.receivedAt??e.turn.startedAt;i.ref.folded=n===void 0?``:`at ${ge(Math.max(0,n-a),`clock`)}`}function Re(e){e.ended=!0,k.value=null}let ze=Ne({width:S.readPref(P.width),collapsed:S.readPref(P.collapsed)}),R=C(ze.width),z=C(ze.collapsed),B=C(!1),V=C(S.mediaMatches(X)),Be=S.onMediaChange(X,e=>{V.value=e}),H=C(null),U=C(null),Ve=D(()=>V.value?z.value?`Show recent threads`:`Hide recent threads`:`Recent threads`);function He(){if(V.value=S.mediaMatches(X),V.value){z.value=!z.value,S.writePref(P.collapsed,z.value?`1`:`0`);return}B.value=!0}function W(e,t){R.value=we(e),t&&S.writePref(P.width,String(R.value))}let G=null;function K(e){G&&W(G.startWidth+(e.clientX-G.startX),!1)}function We(){window.removeEventListener(`pointermove`,K),G&&(G=null,S.writePref(P.width,String(R.value)))}function Ge(e){e.button===0&&(e.preventDefault(),G={startX:e.clientX,startWidth:R.value},e.currentTarget?.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,K),window.addEventListener(`pointerup`,We,{once:!0}))}function Ke(e){if(e.key===`ArrowRight`)W(R.value+A.step,!0);else if(e.key===`ArrowLeft`)W(R.value-A.step,!0);else if(e.key===`Home`)W(A.min,!0);else if(e.key===`End`)W(A.max,!0);else return;e.preventDefault()}se(()=>{window.removeEventListener(`pointermove`,K),window.removeEventListener(`pointerup`,We),Be()});function qe(e){let t=be(e);if(t){if(e.preventDefault(),t===`newThread`){S.navigate(`/threads`);return}if(H.value){H.value.focusFilter();return}if(z.value&&S.mediaMatches(X)){z.value=!1,S.writePref(P.collapsed,`0`),ie().then(()=>H.value?.focusFilter());return}B.value=!0,ie().then(()=>U.value?.focusFilter())}}let q=C(null),J=C(!1);function Y(){return document.body.scrollHeight-(window.innerHeight+window.scrollY)}s(()=>O.length,()=>{let e=Me(Y());ie().then(()=>{e?q.value?.scrollIntoView?.({block:`end`}):J.value=!0})});function Ze(){Me(Y())&&(J.value=!1)}function Qe(){q.value?.scrollIntoView?.({block:`end`,behavior:`smooth`}),J.value=!1}te(()=>{window.addEventListener(`scroll`,Ze,{passive:!0}),window.addEventListener(`keydown`,qe),u&&ft()}),re(()=>{window.removeEventListener(`scroll`,Ze),window.removeEventListener(`keydown`,qe),Q?.close()});let Z=E(Ye()),lt=D(()=>$e(u?.conversations??[],Z,u?.lane??``)),ut=D(()=>{let e=he.value?.turn.id;return Z.runs.size+(e&&!Z.runs.has(e)?1:0)}),dt=pe(),Q=null;function ft(){Q=dt(`/runs?stream=1&mine=1`);let e=!1;Q.onopen=()=>{e&&Z.runs.clear(),e=!0,Z.connected=!0},Q.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}Xe(Z,t)}}let pt=D(()=>{let e=O.find(e=>e.kind===`person`);return e?De(e.text):`Switchboard`});s([pt,ut],([e,t])=>{S.setTitle(t>0?`(${t}) ${e}`:e),S.setFavicon(t>0?fe:de)},{immediate:!0});let mt=D(()=>new Date(f.value).getHours()),ht=D(()=>O.length===0),$=u?.elsewhere,gt=$?$.surface===`web`?`This thread is another person's conversation. You can read it here.`:`This thread lives in ${_e[$.surface]??$.surface}.`:``;return(e,t)=>{let s=ae,v=ue;return g(),w(n,{title:`Threads`,nav:`home`},{leading:h(()=>[r(s,{class:`rail-toggle -ml-1`,size:`xs`,color:`neutral`,variant:`ghost`,icon:V.value&&!z.value?`i-lucide-panel-left-close`:`i-lucide-panel-left`,"aria-label":Ve.value,"aria-expanded":V.value?!z.value:void 0,onClick:He},null,8,[`icon`,`aria-label`,`aria-expanded`])]),default:h(()=>[y(u)?(g(),i(`div`,{key:1,class:d([`home gap-8 md:grid`,z.value?`md:grid-cols-[minmax(0,1fr)]`:`md:grid-cols-[var(--rail-w)_minmax(0,1fr)]`]),style:c({"--rail-w":`${R.value}px`}),"data-rail":z.value?`hidden`:`shown`},[z.value?p(``,!0):(g(),i(`aside`,nt,[r(Ue,{ref_key:`rail`,ref:H,class:`sticky top-20`,rows:lt.value,current:y(m),now:y(f),retention:y(ne)},null,8,[`rows`,`current`,`now`,`retention`]),_(`div`,{class:`handle group/handle absolute inset-y-0 -right-5 flex w-3 cursor-col-resize touch-none select-none justify-center outline-none`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the recent threads column`,"aria-valuemin":y(A).min,"aria-valuemax":y(A).max,"aria-valuenow":R.value,tabindex:`0`,"data-testid":`rail-handle`,onPointerdown:Ge,onKeydown:Ke,onDblclick:t[0]||=e=>W(y(A).default,!0)},[...t[5]||=[_(`span`,{class:`w-px rounded-full bg-(--ui-border-accented) opacity-0 transition-opacity duration-150 ease-out group-hover/handle:opacity-100 group-focus-visible/handle:opacity-100`,"aria-hidden":`true`},null,-1)]],40,rt)])),r(v,{open:B.value,"onUpdate:open":t[1]||=e=>B.value=e,side:`left`,title:`Recent threads`,ui:{content:`max-w-xs`}},{body:h(()=>[r(Ue,{ref_key:`sheetRail`,ref:U,rows:lt.value,current:y(m),now:y(f),retention:y(ne)},null,8,[`rows`,`current`,`now`,`retention`])]),_:1},8,[`open`]),_(`section`,it,[ht.value?(g(),w(Je,{key:0,class:`mb-auto mt-[clamp(1.5rem,14vh,9rem)]`,name:y(u).viewer.name,hour:mt.value,suggestions:y(u).suggestions,onPick:Fe},{default:h(()=>[r(ye,{modelValue:M.value,"onUpdate:modelValue":t[2]||=e=>M.value=e,mode:F.value,hint:N.value,commands:y(u).commands,autofocus:``,"sweep-on-mount":``,onSubmit:L,onStop:Ie},null,8,[`modelValue`,`mode`,`hint`,`commands`])]),_:1},8,[`name`,`hour`,`suggestions`])):(g(),w(o,{key:1,name:`sb-rise`,"move-class":`sb-move-move`,tag:`ol`,class:`transcript m-0 flex list-none flex-col gap-6 p-0 pb-32 pt-2`},{default:h(()=>[(g(!0),i(x,null,a(O,e=>(g(),i(`li`,{key:e.key},[e.kind===`person`?(g(),w(Ce,{key:0,text:e.text,at:e.at,now:y(f),pending:e.pending,folded:e.folded,failed:e.failed},null,8,[`text`,`at`,`now`,`pending`,`folded`,`failed`])):e.kind===`assistant`?(g(),w(Oe,{key:1,turn:e.turn,live:e.live,now:y(f),onInput:(t,n)=>Le(e,t,n),onEnded:t=>Re(e),onStop:t[3]||=e=>k.value=e},null,8,[`turn`,`live`,`now`,`onInput`,`onEnded`])):e.kind===`silent`?(g(),w(ke,{key:2,reason:e.reason,"decided-at":e.at,now:y(f)},null,8,[`reason`,`decided-at`,`now`])):e.kind===`parent`?(g(),w(Te,{key:3,turn:e.turn,now:y(f)},null,8,[`turn`,`now`])):(g(),i(`div`,at,[r(Pe,{text:e.text},null,8,[`text`])]))]))),128))]),_:1})),_(`div`,{ref_key:`end`,ref:q,class:`end`,"aria-hidden":`true`},null,512),!ht.value&&y($)?(g(),i(`p`,ot,[b(l(y(gt))+` `,1),y($).url?(g(),i(`a`,{key:0,href:y($).url,target:`_blank`,rel:`noopener`,class:`text-highlighted`},`Reply there ↗`,8,st)):y($).surface===`web`?p(``,!0):(g(),i(x,{key:1},[b(`Reply there.`)],64))])):ht.value?p(``,!0):(g(),i(`div`,ct,[r(ee,{name:`sb-rise`},{default:h(()=>[J.value?(g(),i(`button`,{key:0,type:`button`,class:`new-pill absolute -top-9 left-1/2 -translate-x-1/2 rounded-full border border-default bg-(--ui-bg-elevated) px-3 py-1 font-mono text-[0.7rem] text-toned shadow-sm hover:text-highlighted`,onClick:Qe},` ↓ new `)):p(``,!0)]),_:1}),r(ye,{modelValue:M.value,"onUpdate:modelValue":t[4]||=e=>M.value=e,mode:F.value,hint:N.value,commands:y(u).commands,autofocus:``,onSubmit:L,onStop:Ie},null,8,[`modelValue`,`mode`,`hint`,`commands`])]))])],14,tt)):(g(),i(`div`,et,`This page needs its seed.`))]),_:1})}}});export{Z as default};
@@ -1 +0,0 @@
1
- import{An as e,Cn as t,Cr as n,Gr as r,Ii as i,Li as a,Mn as o,Pi as s,Sn as c,Tr as l,Xr as u,_r as d,bn as f,dr as p,ir as m,ji as h,kn as g,ln as _,rn as v,t as y,xi as b,xn as x,yn as S}from"./browser-B6T5hjfR.js";import{r as C,t as w}from"./indexFormat-B-pd4r7Y.js";import{B as T,C as E,D,E as O,G as k,I as A,K as j,L as M,M as N,R as ee,T as te,U as ne,a as P,c as F,l as I,o as L,t as R,x as re,z as ie}from"./indexRow-BO_GIdF6.js";import"./format-BldUwl_R.js";import{n as ae}from"./SlackMark-CtiHrNjr.js";import{c as oe,l as se,n as ce,t as le,w as z}from"./sseReplay-BjlKmQsY.js";import{n as ue,t as de}from"./durationTone-CVpX_yIk.js";import{t as B}from"./StatusDot-D_D_iJS8.js";var fe={merged:`merged`,already_landed:`merged`,merge_ready:`merge-ready`,held:`held`,merge_refused:`not merged`,round_cap:`round cap reached`,wall_clock_cap:`out of budget`,review_pending:`review pending`,stopped:`stopped`,aborted:`aborted`,transient:`aborted`,continued:`continuing`,no_verdict:`no verdict`,interrupted:`interrupted`,refused:`refused`,idle:`idle`,blocked:`blocked`};function pe(e){return fe[e]??e}var me={},he={viewBox:`0 0 16 16`,class:`inline-block size-[1em] shrink-0`,"aria-hidden":`true`};function ge(e,n){return d(),t(`svg`,he,[...n[0]||=[f(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z`},null,-1)]])}var _e=ae(me,[[`render`,ge]]),V={"getting ready":`paint-ready`,thinking:`paint-thinking`,"in tools":`paint-tools`,"finishing up":`paint-finishing`,"Switchboard overhead":`paint-overhead`,"not recorded":`paint-lost`,"not loaded":`paint-elided`},ve={getting_ready:`getting ready`,finishing_up:`finishing up`};function ye(e){return V[ve[e]]}var be={id:`timeline`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,"data-testid":`timeline`},xe={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},Se={class:`ml-auto flex items-baseline gap-3 font-normal normal-case tracking-normal`},Ce=[`href`],we={class:`lede font-mono text-sm text-toned`},Te={class:`shape tabular-nums`},Ee={key:0,class:`current text-muted`},De={key:0,class:`note mt-0.5 text-xs text-muted`},Oe=[`aria-label`],ke=[`title`,`data-term`],Ae={class:`legend mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs`},je=[`title`,`data-term`],Me={class:`term text-muted`},Ne={class:`ms tabular-nums text-toned`},Pe=[`title`],Fe={class:`ranked mt-1 flex flex-col gap-1 font-mono text-xs`},Ie={class:`ms w-14 shrink-0 tabular-nums text-toned`},Le=[`href`,`data-anchor`,`onClick`],Re=[`title`],ze={class:`cut mt-1 flex flex-col gap-1 font-mono text-xs`},Be={class:`ms w-14 shrink-0 tabular-nums text-toned`},Ve=[`href`,`data-anchor`,`onClick`],H=o({__name:`TimelineSection`,props:{vm:{},eventsHref:{}},emits:[`reveal`],setup(e,{emit:r}){let o=e,l=r;function u(e){return`${j(e.ms,`clock`)} ${e.term}${e.hatched?` (in flight)`:``}`}function p(){y.copyText(JSON.stringify(o.vm.debug,null,2))}return(r,o)=>(d(),t(`section`,be,[f(`h2`,xe,[o[0]||=f(`span`,null,`Where the time went`,-1),f(`span`,Se,[e.eventsHref?(d(),t(`a`,{key:0,class:`text-dimmed no-underline hover:text-primary hover:underline`,href:e.eventsHref,title:`the stored events, as JSON lines`},`raw events`,8,Ce)):c(``,!0),f(`button`,{type:`button`,class:`debug cursor-pointer text-dimmed hover:text-toned`,title:`the partition and the raw span names, for a bug report`,onClick:p},` Copy debug JSON `)])]),f(`p`,we,[f(`span`,Te,a(e.vm.shown?e.vm.total:e.vm.lede),1),e.vm.current?(d(),t(`span`,Ee,` · `+a(e.vm.current),1)):c(``,!0)]),(d(!0),t(_,null,n(e.vm.captions,e=>(d(),t(`p`,{key:e,class:`caption mt-0.5 text-xs text-muted`},a(e),1))),128)),e.vm.note?(d(),t(`p`,De,a(e.vm.note),1)):c(``,!0),e.vm.shown?(d(),t(_,{key:1},[f(`div`,{class:`bar mt-2.5 flex h-2 w-full overflow-hidden rounded-sm`,role:`img`,"aria-label":e.vm.lede},[(d(!0),t(_,null,n(e.vm.bar,(e,n)=>(d(),t(`div`,{key:n,class:s([`seg h-full`,[h(V)[e.term],e.hatched?`paint-hatched hatched`:``]]),style:i({width:`${e.pct}%`}),title:u(e),"data-term":e.term},null,14,ke))),128))],8,Oe),f(`ul`,Ae,[(d(!0),t(_,null,n(e.vm.legend,e=>(d(),t(`li`,{key:e.term,class:`flex items-baseline gap-1.5 cursor-help`,title:e.definition,"data-term":e.term},[f(`span`,{class:s([`swatch inline-block size-2 shrink-0 self-center rounded-[2px]`,h(V)[e.term]])},null,2),f(`span`,Me,a(e.term),1),f(`span`,Ne,a(e.text),1)],8,je))),128))]),e.vm.ranked.length>0?(d(),t(_,{key:0},[f(`h3`,{class:`ranked-head mt-3 inline-block cursor-help text-xs font-medium text-muted underline decoration-dotted decoration-(--ui-border-accented) underline-offset-2`,title:e.vm.rankedNote},` Longest steps `,8,Pe),f(`ol`,Fe,[(d(!0),t(_,null,n(e.vm.ranked,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Ie,a(h(j)(e.ms,`clock`)),1),f(`a`,{class:`label min-w-0 truncate text-muted no-underline hover:text-primary hover:underline`,href:`#${e.anchor}`,"data-anchor":e.anchor,title:`scroll to this step`,onClick:v(t=>l(`reveal`,e.anchor),[`prevent`])},a(e.label),9,Le),(d(!0),t(_,null,n(e.facts,e=>(d(),t(`span`,{key:e,class:`fact shrink-0 rounded border border-accented px-1 text-dimmed`},a(e),1))),128))]))),128))])],64)):c(``,!0),e.vm.cut.length>0?(d(),t(_,{key:1},[f(`h3`,{class:`cut-head mt-3 block cursor-help text-xs font-medium text-muted underline decoration-dotted decoration-(--ui-border-accented) underline-offset-2`,title:e.vm.cutNote},` Cut steps `,8,Re),f(`ol`,ze,[(d(!0),t(_,null,n(e.vm.cut,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Be,a(h(j)(e.ms,`clock`)),1),f(`a`,{class:`label min-w-0 truncate text-muted no-underline hover:text-primary hover:underline`,href:`#${e.anchor}`,"data-anchor":e.anchor,title:`scroll to this step`,onClick:v(t=>l(`reveal`,e.anchor),[`prevent`])},a(e.label),9,Ve),(d(!0),t(_,null,n(e.facts,e=>(d(),t(`span`,{key:e,class:`fact shrink-0 rounded border border-accented px-1 text-dimmed`},a(e),1))),128))]))),128))])],64)):c(``,!0)],64)):c(``,!0)]))}}),U={"getting ready":`before the agent's first turn: reading the thread, finding the repo, checking out, loading tools`,thinking:`the model's turns — from a request to the model until its reply came back`,"in tools":`the commands and tool calls the model ran`,"finishing up":`after the agent's last turn: posting the PR, checking the workspace`,"Switchboard overhead":`orchestration between steps, and moments when only a background read was running — the time no step claims`,"not recorded":`a stretch of the run the record does not carry`,"not loaded":`a stretch of the run this page did not load — the record has the full shape`},W=`Ranked by each step's own time, its children excluded — the bar counts every instant once.`,G=`Steps still open when the run ended: closed at the run's terminal event and left out of the ranking — the time shown is the cut, not a measurement.`;function He(e){let t=e===`interrupted`?`the interruption`:e===`failed`?`the failure`:e===`stopped_hard`?`the hard stop`:e===`stopped_soft`?`the stop`:void 0;return t?`cut by ${t}`:`cut at the run's end`}var Ue=`currently delivering`,We=`getting ready: not recorded (too large)`,Ge=`no timing data`,Ke=`not loaded (the record has the full shape)`,K={getting_ready:`getting ready`,thinking:`thinking`,tools:`in tools`,finishing_up:`finishing up`};function q(e){let{spans:t,window:n,owner:r}=e,i=e.phase!==`live`,a=ee(t,{window:n,owner:r,finished:i,losses:e.losses}),o=ie(a),s=j(o.totalS*1e3,`clock`),c=t.find(e=>e.name===`request`&&e.parentSpanId===void 0),l=e.phase===`live`?Je(t,r,n):void 0,u=Ye(e,l),d=l?z(l.name):``,f={window:n,owner:r,phase:e.phase,partition:a,spans:t.map(e=>({spanId:e.spanId,parentSpanId:e.parentSpanId,name:e.name,startedAt:e.startedAt,endedAt:e.endedAt,status:e.status,attrs:e.attrs}))};if(e.untimed)return{total:s,current:u,openStep:d,captions:[],rankedNote:W,cut:[],cutNote:G,debug:f,lede:s,shown:!1,bar:[],legend:[],ranked:[],note:Ge};let p=qe(c,`restartOfRunId`),m={total:s,current:u,openStep:d,captions:[p===void 0?void 0:`restarted from run ${p}`,A(`before`,J(c,`queuedBeforeMs`)),p===void 0?A(`behind`,J(c,`queuedBehindMs`)):void 0].filter(e=>e!==void 0),rankedNote:W,cutNote:G,debug:f};if(!c)return{...m,lede:s,shown:!1,bar:[],legend:[],ranked:[],cut:[],note:i?We:``};let h=t=>t===`not recorded`?`not recorded${e.truncated?` (too large)`:``}`:t===`not loaded`?Ke:t,g=M(a)&&o.items.length>0,_=g?`${s} — ${o.items.map(({term:e,s:t})=>`${j(t*1e3,`clock`)} ${h(e)}`).join(` · `)}`:a.windowMs>0?`${s} — ${h(Xe(a))}`:s,v=g?o.items.map(({term:t,s:n})=>({term:t,text:j(n*1e3,`clock`),definition:t===`not recorded`&&e.truncated?`${U[t]} (too large)`:U[t]})):[],y=g?Qe(t,c,r,n,e.callTitle,e.phase===`ended`,He(e.endedBy)):{ranked:[],cut:[]};return{...m,lede:_,shown:g,bar:g?Ze(a,l):[],legend:v,ranked:y.ranked,cut:y.cut,note:``}}function J(e,t){let n=e?.attrs[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function qe(e,t){let n=e?.attrs[t];return typeof n==`string`&&n!==``?n:void 0}function Je(e,t,n){let r=new Map(e.map(e=>[e.spanId,e])),i=e=>{let t=1,n=new Set([e.spanId]),i=e.parentSpanId?r.get(e.parentSpanId):void 0;for(;i&&!n.has(i.spanId);)n.add(i.spanId),t++,i=i.parentSpanId?r.get(i.parentSpanId):void 0;return t},a;for(let o of e){if(o.endedAt!==void 0||o.startedAt>=n.end)continue;let e=T(o.name,t);if(e?.kind!==`counted`||Y(o,r,t))continue;let s=i(o);(!a||s>a.depth||s===a.depth&&o.startedAt>a.span.startedAt)&&(a={span:o,depth:s,bucket:e.bucket})}if(a)return{bucket:a.bucket,name:a.span.name,elapsedMs:Math.max(0,n.end-Math.max(n.start,a.span.startedAt))}}function Y(e,t,n){let r=e,i=new Set;for(;r&&!i.has(r.spanId);){if(i.add(r.spanId),T(r.name,n)?.kind===`background`)return!0;r=r.parentSpanId?t.get(r.parentSpanId):void 0}return!1}function Ye(e,t){return e.phase===`delivering`?Ue:e.phase===`ended`?se(e.delivery??{}):t?`currently ${K[t.bucket]} ${j(t.elapsedMs,`clock`)}`:``}function X(e){return[[`getting ready`,e.gettingReadyMs],[`thinking`,e.thinkingMs],[`in tools`,e.toolsMs],[`finishing up`,e.finishingUpMs],[`Switchboard overhead`,e.overheadMs],[`not recorded`,e.notRecordedMs],[`not loaded`,e.notLoadedMs]]}function Xe(e){let t=[`getting ready`,-1];for(let n of X(e))n[1]>t[1]&&(t=n);return t[0]}function Ze(e,t){let n=[],r=t=>e.windowMs>0?t/e.windowMs*100:0;for(let[i,a]of X(e))if(!(a<=0)){if(t&&K[t.bucket]===i){let e=Math.min(t.elapsedMs,a);a-e>0&&n.push({term:i,ms:a-e,pct:r(a-e),hatched:!1}),e>0&&n.push({term:i,ms:e,pct:r(e),hatched:!0});continue}n.push({term:i,ms:a,pct:r(a),hatched:!1})}return n}function Qe(e,t,n,r,i,a,o){let s=new Map(e.map(e=>[e.spanId,e])),c=new Map;for(let t of e){if(t.parentSpanId===void 0)continue;let e=c.get(t.parentSpanId);e?e.push(t):c.set(t.parentSpanId,[t])}let l=e=>[Math.max(r.start,e.startedAt),Math.min(r.end,e.endedAt??r.end)],u=[],d=[];for(let r of e){if(r===t||r.name===`run.agent`||T(r.name,n)===void 0||Y(r,s,n))continue;let[e,f]=l(r);if(f<=e)continue;let p=(c.get(r.spanId)??[]).map(l).map(([t,n])=>[Math.max(e,t),Math.min(f,n)]).filter(([e,t])=>t>e),m=f-e-$e(p);if(m<=0)continue;let h=r.name.startsWith(`tool.`)&&typeof r.attrs.callId==`string`?r.attrs.callId:void 0,g=h?i?.(h):void 0,_=a&&r.endedAt===void 0;(_?d:u).push({label:g??z(r.name),ms:m,facts:_?[o,...Z(r)]:Z(r),anchor:h?`call-${h}`:`span-${r.spanId}`,startedAt:r.startedAt})}let f=(e,t)=>t.ms-e.ms||e.startedAt-t.startedAt;u.sort(f),d.sort(f);let p=({label:e,ms:t,facts:n,anchor:r})=>({label:e,ms:t,facts:n,anchor:r});return{ranked:u.slice(0,3).map(p),cut:d.map(p)}}function $e(e){let t=[...e].sort((e,t)=>e[0]-t[0]),n=0,r;for(let[e,i]of t)!r||e>r[1]?(r&&(n+=r[1]-r[0]),r=[e,i]):i>r[1]&&(r[1]=i);return r&&(n+=r[1]-r[0]),n}function Z(e){let t=e.attrs,n=[];return(t.token===`expired`||t.token===`expiring`)&&n.push(`token ${t.token}`),t.budget===`clipped`&&n.push(`budget clipped`),typeof t.timeoutMs==`number`&&n.push(`timeout ${j(t.timeoutMs,`clock`)}`),typeof t.waitedMs==`number`&&n.push(`waited ${j(t.waitedMs,`clock`)}`),typeof t.exitCode==`number`&&t.exitCode!==0&&n.push(`exit ${t.exitCode}`),t.timedOut===!0&&n.push(`timed out`),typeof t.attempts==`number`&&t.attempts>1&&n.push(`${t.attempts} attempts`),e.status===`error`&&n.length===0&&n.push(`failed`),n}function Q(e){return e===`command`?`command`:`agent`}var et=[`data-state`],tt={key:0,class:`loading py-2 font-mono text-xs text-dimmed`},nt={key:1,class:`failed py-2 font-mono text-xs text-warn`},rt=[`data-turn`,`data-anchor`],it={class:`landing-head flex flex-wrap items-baseline gap-x-2 font-mono text-xs text-muted`},at={class:`turn tabular-nums`},ot={class:`what min-w-0 truncate text-toned`},st={key:0,class:`m-0 mt-1 list-none p-0`},ct=o({__name:`RunTimeline`,props:{run:{},land:{},fetch:{}},setup(n){let i=n,o=b(`loading`),s=oe(),v=S(()=>{if(o.value!==`ready`)return null;s.state.traceVersion;let e=i.run,t=e.receivedAt??e.startedAt,n=k(e)??(e.finishedAt===void 0?0:Math.max(0,e.finishedAt-t));return q({spans:s.spanSet(),losses:s.losses(t),window:{start:t,end:t+n},owner:Q(e.agent),totalMs:n,phase:`ended`,delivery:{finishedAt:e.finishedAt,sealedAt:e.sealedAt,replyOk:e.replyOk},...e.truncated===void 0?{}:{truncated:e.truncated},...(e.schema??0)>=2?{}:{untimed:!0},callTitle:s.callHeadline})}),x=S(()=>`/runs/${encodeURIComponent(i.run.id)}/events`),C=e=>`/runs/${encodeURIComponent(i.run.id)}#${e}`;function w(e){y.navigate(C(e))}let T=S(()=>{if(o.value!==`ready`||i.land===void 0)return null;s.state.traceVersion;let e=i.land,t=i.run.session;if(t&&e===t.request)return{anchor:`request`,what:`the request`};let n=t&&t.range!==`broken`?t.range.to:void 0;if(n!==void 0&&e===n&&s.state.reply)return{anchor:`reply`,what:`the reply`};let r=s.landing(e);return r?{anchor:r.anchor,what:E(r.step),step:r.step}:null});function E(e){let t=e.items.find(e=>e.kind===`call`),n=t?.kind===`call`?t.call.headline:void 0;return[e.turn?`thought ${e.turn.chip}`:void 0,n].filter(e=>e!==void 0).join(` · `)||`step ${e.index+1}`}let D=b(null),O=S(()=>T.value?`${i.land}@${T.value.anchor}`:null);return r(O,e=>{e!==null&&m().then(()=>{let e=(T.value?.step?D.value?.querySelector(`li.step`):null)??D.value;e&&(e.scrollIntoView?.({block:`center`}),e.classList.add(`revealed`),setTimeout(()=>e.classList.remove(`revealed`),1500))})}),p(async()=>{let e=i.fetch??((...e)=>globalThis.fetch(...e));try{let t=await e(x.value,{credentials:`same-origin`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=le(await t.text()).filter(e=>e.type!==`replay_note`);for(let e of(i.run.schema??0)>=2?ne(n):n)s.handle(e);s.closePhases(),o.value=`ready`}catch{o.value=`failed`}}),(r,i)=>{let p=l(`RouterLink`);return d(),t(`div`,{class:`runtimeline pl-5`,"data-state":o.value},[o.value===`loading`?(d(),t(`p`,tt,`reading the run's record…`)):o.value===`failed`?(d(),t(`p`,nt,[i[2]||=g(` the run's record could not be read — `,-1),e(p,{class:`text-primary no-underline hover:underline`,to:`/runs/${encodeURIComponent(n.run.id)}`},{default:u(()=>[...i[1]||=[g(`open the run`,-1)]]),_:1},8,[`to`])])):v.value?(d(),t(_,{key:2},[e(H,{vm:v.value,"events-href":x.value,onReveal:w},null,8,[`vm`,`events-href`]),T.value?(d(),t(`div`,{key:0,ref_key:`landingEl`,ref:D,class:`landing mb-4 rounded-lg border border-default px-(--sb-gutter) py-2`,"data-turn":n.land,"data-anchor":T.value.anchor},[f(`p`,it,[f(`span`,at,`turn `+a(n.land),1),f(`span`,ot,`· `+a(T.value.what),1),e(p,{class:`page ml-auto shrink-0 text-primary no-underline hover:underline`,to:C(T.value.anchor),title:`the same step on the run's own page`},{default:u(()=>[...i[3]||=[g(`open on the run's page ↗`,-1)]]),_:1},8,[`to`])]),T.value.step?(d(),t(`ol`,st,[e(ce,{step:T.value.step,onToggleGroup:i[0]||=e=>h(s).toggleGroup(T.value.step)},null,8,[`step`])])):c(``,!0)],8,rt)):c(``,!0)],64)):c(``,!0)],8,et)}}}),lt=[`id`,`data-run-id`,`data-round`,`data-thread`],ut=[`open`],dt={class:`row flex min-w-0 cursor-pointer list-none flex-wrap items-center gap-x-2.5 gap-y-1 px-2 py-2 hover:bg-(--ui-bg-muted) [&::-webkit-details-marker]:hidden`},ft={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},$={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},pt={key:3,class:`scope min-w-0 flex-1 truncate text-toned`},mt=[`title`],ht=[`data-heat`],gt={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},_t={key:1,class:`row flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 px-2 py-2 hover:bg-(--ui-bg-muted)`},vt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},yt={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},bt={key:3,class:`scope min-w-0 flex-1 truncate text-highlighted`},xt=[`title`],St={class:`elapsed shrink-0 text-right font-mono text-xs tabular-nums text-ok sm:min-w-[4.5em]`,title:`running for`},Ct={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},wt=o({__name:`RunFoldRow`,props:{run:{},now:{},label:{},open:{type:Boolean},land:{}},setup(n){let o=n,p=b(o.open===!0);r(()=>o.open,e=>{e&&(p.value=!0)});let m=S(()=>C(o.run.label||E(o.run.id))),_=S(()=>te(o.run)),y=S(()=>re(o.run)),T=S(()=>o.run.finished),k=S(()=>o.run.finished&&o.run.status&&o.run.status!==`completed`?O(o.run.status):``),A=S(()=>de(o.run.finished&&typeof o.run.finishedAt==`number`?o.run.finishedAt-o.run.startedAt:void 0,`run`)),j=S(()=>ue(A.value));function M(e){p.value=e.target.open}return(r,o)=>{let b=l(`RouterLink`);return d(),t(`li`,{id:`run-${n.run.id}`,class:s([`fold group border-b border-muted`,n.run.finished?`finished`:`live`]),"data-run-id":n.run.id,"data-round":n.run.round,"data-thread":n.run.thread},[T.value?(d(),t(`details`,{key:0,class:`group/fold`,open:p.value,onToggle:M},[f(`summary`,dt,[o[2]||=f(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open/fold:rotate-90 motion-reduce:transition-none`,"aria-hidden":`true`},`❯`,-1),e(B,{tone:_.value,label:h(D)(n.run),tip:h(F)(n.run)},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,ft,a(n.label),1)):c(``,!0),m.value.agent?(d(),t(`span`,{key:1,class:s([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider opacity-55`,h(R)[h(P)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,pt,a(m.value.scope),1)):(d(),t(`span`,$,a(m.value.snippet),1)),k.value?(d(),t(`span`,{key:4,class:s([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem]`,_.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},a(k.value),3)):c(``,!0),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-dimmed`,title:h(N)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,mt),f(`span`,{class:s([`elapsed shrink-0 text-right font-mono text-xs tabular-nums sm:min-w-[4.5em]`,[j.value?`heat`:`text-muted`,A.value.level>=2?`font-medium`:``]]),style:i(j.value),"data-heat":A.value.level,title:`start to finish`},a(h(I)(n.run,n.now)),15,ht),f(`span`,gt,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(E)(n.run.id)}`,onClick:o[0]||=v(()=>{},[`stop`])},{default:u(()=>[...o[1]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]),p.value?(d(),x(ct,{key:0,run:n.run,land:n.land},null,8,[`run`,`land`])):c(``,!0)],40,ut)):(d(),t(`div`,_t,[o[4]||=f(`span`,{class:`chev select-none text-xs text-transparent`,"aria-hidden":`true`},`❯`,-1),e(B,{tone:_.value,label:h(D)(n.run),tip:h(F)(n.run),pulse:``},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,vt,a(n.label),1)):c(``,!0),m.value.agent?(d(),t(`span`,{key:1,class:s([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider`,h(R)[h(P)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,bt,a(m.value.scope),1)):(d(),t(`span`,yt,a(m.value.snippet),1)),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-muted`,title:h(N)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,xt),f(`span`,St,a(h(I)(n.run,n.now)),1),f(`span`,Ct,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(E)(n.run.id)}`},{default:u(()=>[...o[3]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]))],10,lt)}}});export{ye as a,H as i,Q as n,_e as o,q as r,pe as s,wt as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./AppShell-CSXDCV4x.js";import{An as r,Cn as i,Cr as a,Gr as o,Ii as s,Li as c,Mn as l,Pi as u,Sn as d,Tr as ee,Xr as f,_r as p,bn as m,c as h,dr as g,hr as _,ji as v,kn as y,l as b,ln as x,o as S,t as C,xi as w,xn as T,yi as E,yn as D}from"./browser-B6T5hjfR.js";import{t as O}from"./Tooltip-DVFmM7on.js";import{t as k}from"./InputMenu-BdZXnibG.js";import{b as A,x as j}from"./main-Cl7xHG34.js";import{t as M}from"./eventSource-Bj_dZf6M.js";import{t as N}from"./wallClock-DmaC1sKA.js";import{n as te,r as P,t as ne}from"./indexFormat-B-pd4r7Y.js";import{A as F,C as I,D as L,E as R,M as z,N as B,O as re,S as V,T as ie,_ as H,a as U,b as ae,c as oe,d as W,f as G,g as se,h as K,i as q,j as J,k as ce,l as le,m as ue,o as de,p as fe,r as Y,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./indexRow-BO_GIdF6.js";import{i as be}from"./format-BldUwl_R.js";import{t as X}from"./SlackMark-CtiHrNjr.js";import{n as xe,t as Se}from"./durationTone-CVpX_yIk.js";import{t as Z}from"./RunsTabs-kHbbxVHx.js";import{t as Ce}from"./StatusDot-D_D_iJS8.js";var Q={class:`flex items-baseline gap-1.5 whitespace-pre-line px-2 py-1 text-xs`},we=[`data-kind`,`aria-label`,`href`],Te=[`data-kind`],Ee=l({__name:`SourceMark`,props:{kind:{},tip:{},url:{}},setup(e){let t=e,n=()=>q[t.kind]??t.kind;return(t,r)=>{let a=O;return e.url?(p(),T(a,{key:0},{content:f(()=>[m(`span`,Q,[e.kind===`slack`?(p(),T(X,{key:0})):d(``,!0),m(`span`,null,c(e.tip),1)])]),default:f(()=>[m(`a`,{class:`source linked pointer-events-auto w-[1.6em] shrink-0 rounded border border-transparent text-center text-[0.8rem] text-toned opacity-0 transition-opacity hover:border-primary/30 hover:bg-primary/10 hover:text-primary focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none`,"data-kind":e.kind,"aria-label":`open the ${n()} thread (new tab)`,href:e.url,target:`_blank`,rel:`noopener noreferrer`},`↗`,8,we)]),_:1})):(p(),i(`span`,{key:1,class:`source w-[1.6em] shrink-0`,"data-kind":e.kind,"aria-hidden":`true`},null,8,Te))}}}),De=[`data-run-id`,`data-parent-id`,`data-started-at`,`data-persisted`,`data-stalled`,`data-expires-at`],Oe={class:`pointer-events-auto flex items-center max-sm:order-1`},ke=[`data-user-id`,`data-surface`],Ae={class:`surface mr-1.5 inline-block w-[3.6em] rounded border border-accented text-center font-mono text-[0.62rem] text-dimmed`},je={class:`name`},Me={key:1,class:`who shrink-0 max-sm:hidden sm:w-[14em]`,"aria-hidden":`true`},Ne=[`data-agent-hue`],Pe=[`href`],Fe={class:`owner font-normal text-dimmed`},Ie={class:`name`},Le={key:5,class:`snippet min-w-0 truncate text-muted max-sm:order-6 max-sm:basis-full max-sm:whitespace-normal max-sm:pl-5 max-sm:text-[0.8rem] max-sm:leading-snug max-sm:line-clamp-2 sm:flex-1`},Re={class:`hidden sm:contents`},ze={class:`expires pointer-events-auto shrink-0 font-mono text-xs tabular-nums text-warn max-sm:order-11`},Be=[`data-heat`],Ve={class:`count shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-9 max-sm:text-dimmed sm:min-w-[6em] sm:text-muted`},He=[`data-inherited`],Ue={class:`actions flex shrink-0 justify-end max-sm:order-5 sm:w-[2em]`},$=l({__name:`RunRow`,props:{run:{},now:{},retentionMs:{},nestedUnder:{},children:{}},setup(e){let n=e,a=D(()=>P(n.run.label||I(n.run.id))),o=D(()=>H(n.run,a.value.scope)),l=D(()=>ie(n.run)),h=D(()=>ve(n.run)),g=D(()=>F(n.run)),_=D(()=>B(n.run)),y=D(()=>V(n.run)),x=D(()=>n.run.threadKey?J(n.run.threadKey):null),S=D(()=>he(n.run,n.retentionMs)),w=D(()=>S.value!==void 0&&S.value-n.now<=864e5),k=D(()=>!n.run.finished&&!n.run.stop),A=D(()=>Se(n.run.finished&&typeof n.run.finishedAt==`number`?n.run.finishedAt-n.run.startedAt:void 0,`run`)),j=D(()=>xe(A.value)),M=D(()=>n.run.finished&&n.run.status&&n.run.status!==`completed`?R(n.run.status):``),N=D(()=>n.run.stop&&!(n.run.finished&&n.run.status)?ce(n.run.stop):``),W=D(()=>ge(n.run,n.now)),G=D(()=>n.run.hosted&&n.children!==void 0?fe({head:n.run,children:n.children},n.now):void 0),K=D(()=>W.value??G.value?.text??ye(n.run,n.now)),Y=D(()=>ae(n.run,n.now)),X=E({soft:!1,hard:!1}),Z=D(()=>[...x.value?[{label:`Open thread`,icon:`i-lucide-messages-square`,to:x.value}]:[],...y.value?[{label:`Open in ${q[g.value.kind]??g.value.kind}`,icon:`i-lucide-external-link`,to:y.value,target:`_blank`}]:[],...k.value?[{label:`Stop (soft)`,icon:`i-lucide-octagon-pause`,disabled:X.soft,onSelect:()=>Q(`soft`)},{label:`Kill (hard)`,icon:`i-lucide-octagon-x`,color:`error`,disabled:X.hard,onSelect:()=>Q(`hard`)}]:[]]);function Q(e){(e!==`hard`||C.confirm(`Hard stop: abort this run now with no summary and free its sandbox?`))&&(X[e]=!0,fetch(re(n.run,e),{method:`POST`,credentials:`same-origin`}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>{X[e]=!1}))}function we(e){e.target?.closest(`a, button`)||C.navigate(h.value)}return(n,x)=>{let C=ee(`RouterLink`),E=O,D=b,k=t;return p(),i(`li`,{class:u([`run group relative isolate rounded-md border-b border-muted hover:bg-(--ui-bg-muted) focus-within:bg-(--ui-bg-muted)`,[e.run.finished?`finished`:`live`,w.value?`leaving`:``,e.nestedUnder?`nested ml-4 border-l-2 border-accented sm:ml-6`:``]]),"data-run-id":e.run.id,"data-parent-id":e.nestedUnder,"data-started-at":String(e.run.startedAt),"data-persisted":e.run.persisted?`1`:void 0,"data-stalled":Y.value?`1`:void 0,"data-expires-at":S.value===void 0?void 0:String(S.value),onClick:we},[r(C,{class:`row absolute inset-0 rounded-md focus-visible:outline-2 focus-visible:outline-primary`,to:h.value,"aria-label":`open run ${e.run.label||v(I)(e.run.id)}`},null,8,[`to`,`aria-label`]),m(`div`,{class:u([`body pointer-events-none relative z-[1] flex min-w-0 flex-wrap items-center gap-x-2.5 px-2 max-sm:gap-y-1.5 max-sm:py-3 sm:flex-nowrap sm:py-2`,[e.run.finished?`text-muted`:``,w.value?`opacity-85`:``]])},[m(`span`,Oe,[r(Ce,{tone:l.value,label:v(L)(e.run),tip:v(oe)(e.run),pulse:!e.run.finished},null,8,[`tone`,`label`,`tip`,`pulse`])]),r(E,{text:v(z)(e.run),ui:{text:`whitespace-pre-line`}},{default:f(()=>[m(`span`,{class:u([`when pointer-events-auto shrink-0 font-mono tabular-nums max-sm:order-7 max-sm:pl-5 max-sm:text-xs max-sm:text-dimmed sm:min-w-[8.5em] sm:text-[0.8rem]`,e.run.finished?`text-dimmed`:`text-muted`])},c(v(te)(e.run.startedAt,e.now)),3)]),_:1},8,[`text`]),_.value?(p(),T(E,{key:0,text:v(_e)(e.run)},{default:f(()=>[m(`span`,{class:u([`who pointer-events-auto min-w-0 shrink-0 truncate text-[0.8rem] max-sm:order-7 max-sm:text-xs sm:w-[14em]`,e.run.finished?`text-dimmed`:`text-muted`]),"data-user-id":e.run.userId,"data-surface":g.value.kind},[m(`span`,Ae,c(g.value.kind),1),m(`span`,je,c(_.value),1)],10,ke)]),_:1},8,[`text`])):(p(),i(`span`,Me)),a.value.agent?(p(),i(`span`,{key:2,class:u([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider max-sm:order-2`,[v(me)[v(U)(a.value.agent)],e.run.finished?`opacity-55`:``]]),"data-agent-hue":v(U)(a.value.agent)},c(a.value.agent),11,Ne)):d(``,!0),o.value?(p(),T(E,{key:3,text:o.value},{default:f(()=>[m(`a`,{class:`repo pointer-events-auto min-w-0 shrink-0 rounded border border-accented bg-accented/50 px-1.5 font-mono text-[0.72rem] font-medium leading-normal text-toned no-underline hover:border-(--ui-text-dimmed) hover:text-highlighted max-sm:order-3`,href:`https://github.com/${o.value}`,target:`_blank`,rel:`noopener noreferrer`},[m(`span`,Fe,c(o.value.slice(0,o.value.indexOf(`/`)+1)),1),m(`span`,Ie,c(o.value.slice(o.value.indexOf(`/`)+1)),1)],8,Pe)]),_:1},8,[`text`])):(p(),i(`span`,{key:4,class:u([`scope min-w-0 shrink-0 truncate font-medium max-sm:order-3`,e.run.finished?`text-toned`:`text-highlighted`])},c(a.value.scope),3)),a.value.snippet===void 0?d(``,!0):(p(),i(`span`,Le,c(a.value.snippet),1)),M.value?(p(),i(`span`,{key:6,class:u([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,l.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},c(M.value),3)):d(``,!0),N.value?(p(),i(`span`,{key:7,class:u([`stopbadge shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,e.run.stop?.state===`stopped`?`border-accented text-muted`:`border-warn/30 text-warn`])},c(N.value),3)):d(``,!0),Y.value?(p(),i(`span`,{key:8,class:u([`stalled shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,W.value?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},`stalled`,2)):d(``,!0),m(`span`,Re,[r(Ee,{kind:g.value.kind,tip:v(_e)(e.run),url:y.value||void 0},null,8,[`kind`,`tip`,`url`])]),w.value&&S.value!==void 0?(p(),T(E,{key:9,text:`removed at ${v(be)(S.value)}`},{default:f(()=>[m(`span`,ze,`gone `+c(v(ne)(S.value,e.now)),1)]),_:1},8,[`text`])):d(``,!0),r(E,{text:e.run.finished?`start to finish`:`running for`},{default:f(()=>[m(`span`,{class:u([`elapsed pointer-events-auto ml-auto shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-4 sm:min-w-[4.5em]`,e.run.finished?[j.value?`heat`:`text-muted`,A.value.level>=2?`font-medium`:``]:`text-ok`]),style:s(e.run.finished?j.value:void 0),"data-heat":e.run.finished?A.value.level:void 0},c(v(le)(e.run,e.now)),15,Be)]),_:1},8,[`text`]),x[0]||=m(`span`,{class:`hidden text-xs text-dimmed max-sm:order-8 max-sm:inline`,"aria-hidden":`true`},`·`,-1),r(E,{text:v(pe)(e.run)},{default:f(()=>[m(`span`,Ve,c(v(de)(e.run)),1)]),_:1},8,[`text`]),K.value?(p(),T(E,{key:10,text:G.value&&!W.value?v(ue)(G.value):v(se)(e.run,e.now)},{default:f(()=>[m(`span`,{class:u([`pace pointer-events-auto shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-9`,W.value?`text-bad font-medium`:Y.value?`text-warn`:`text-dimmed`]),"data-inherited":G.value&&!W.value?G.value.child?`child`:`waiting`:void 0},c(K.value),11,He)]),_:1},8,[`text`])):d(``,!0),m(`span`,Ue,[Z.value.length>0?(p(),T(k,{key:0,items:Z.value,content:{align:`end`}},{default:f(()=>[r(D,{class:`pointer-events-auto -my-1.5 -mr-1`,size:`sm`,color:`neutral`,variant:`ghost`,icon:`i-lucide-ellipsis-vertical`,"aria-label":`Run actions`})]),_:1},8,[`items`])):d(``,!0)])],2)],10,De)}}}),We={class:`view-as-picker inline-flex items-center gap-2`},Ge={key:0,class:`ml-2 truncate font-mono text-[0.6875rem] text-dimmed`},Ke={class:`font-mono`},qe={key:0,class:`text-bad`},Je=l({__name:`ViewAsPicker`,props:{people:{}},setup(t){let n=t,a=w(!1),o=w(``),s=D(()=>n.people.map(e=>({label:e.name??e.id,value:e.id,...e.name?{suffix:e.id}:{}})));async function l(t){let n=typeof t==`string`?t.trim():``;if(!n)return;a.value=!0,o.value=``;let r=await e(n);r.ok||(a.value=!1,o.value=r.message)}return(e,t)=>{let n=k;return p(),i(`span`,We,[r(n,{id:`view-as-pick`,"model-value":``,items:s.value,"value-key":`value`,"filter-fields":[`label`,`value`],"create-item":``,placeholder:`View as…`,"aria-label":`view the dashboard as a person`,disabled:a.value,size:`xs`,class:`w-60 text-xs`,ui:{itemTrailing:`min-w-0`},"onUpdate:modelValue":l,onCreate:l},{"item-trailing":f(({item:e})=>[e.suffix?(p(),i(`span`,Ge,c(e.suffix),1)):d(``,!0)]),"create-item-label":f(({item:e})=>[t[0]||=y(` View as `,-1),m(`span`,Ke,c(e),1)]),_:1},8,[`items`,`disabled`]),o.value?(p(),i(`span`,qe,c(o.value),1)):d(``,!0)])}}}),Ye={class:`conn flex items-center gap-1.5`},Xe={id:`state`,class:`text-xs text-muted`},Ze={class:`toolbar mb-1.5 flex items-center gap-4 px-2 text-xs text-muted`},Qe={id:`livecount`,class:`count font-mono tabular-nums`},$e={class:`filter ml-auto inline-flex items-center gap-4`},et={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},tt=[`checked`],nt={id:`minehint`,class:`sr-only`},rt={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},it=[`checked`],at={id:`retention`,class:`sr-only`},ot={key:0,class:`banner mb-3 rounded-md border border-warn px-2.5 py-1.5 text-[0.8rem] text-warn`,role:`status`},st={id:`runs`,class:`m-0 list-none border-t border-muted p-0`},ct={key:0,id:`leaving`,class:`divider flex items-baseline gap-2 border-b border-dashed border-warn/40 px-2 pb-1.5 pt-3 font-mono text-[0.72rem] uppercase tracking-wider text-warn`,role:`separator`},lt={key:1,id:`empty`,class:`empty px-2 py-2 text-muted`},ut={key:1,class:`pager mt-3 flex items-baseline gap-2 px-2 text-[0.8rem] text-muted`,"aria-label":`Completed runs pages`},dt={class:`range font-mono tabular-nums text-dimmed`},ft=l({__name:`RunsIndexPage`,setup(e){let t=S(`runs`),s=t?.all??!1,l=t?.mine??!1,u=new URLSearchParams(C.search());if(!u.has(`mine`)&&!u.has(`all`)&&t){let e=C.readPref(Y.mine)===`1`,t=C.readPref(Y.all)===`1`;(e||t)&&C.navigate(k(t,e))}let b=t?.asUser?`Only the runs ${t.asUser.name??`you`} requested`:`Only the runs this session requested from Threads. Sign in with the email of your Slack account to see your Slack runs too.`;function k(e,t){let n=[e?`all=1`:``,t?`mine=1`:``].filter(Boolean).join(`&`);return n?`/runs?${n}`:`/runs`}let te=t?.olderThan!==void 0,P=t?.retentionDays??null,F=P===null?void 0:P*864e5,I=h(P),L=E(new Map);for(let e of t?.rows??[])L.set(e.id,e);let R=N(t?.now),z=w({tone:`amber`,text:`connecting…`}),B=D(()=>G([...L.values()],R.value)),re=D(()=>[...L.values()].filter(e=>!e.finished).length),V=D(()=>F===void 0?-1:B.value.findIndex(e=>{let t=he(e.head,F);return t!==void 0&&t-R.value<=864e5})),ie=D(()=>V.value===-1?B.value:B.value.slice(0,V.value)),H=D(()=>V.value===-1?[]:B.value.slice(V.value)),U=s?`All runs`:`Live runs`;o(re,e=>{C.setTitle((e>0?`(${e}) `:``)+U),C.setFavicon(e>0?j:A)},{immediate:!0});function ae(e){let t=e.target.checked;C.writePref(Y.all,t?`1`:`0`),C.navigate(k(t,l))}function oe(e){let t=e.target.checked;C.writePref(Y.mine,t?`1`:`0`),C.navigate(k(s,t))}let se=D(()=>t?.olderThan===void 0?``:ne(t.olderThan,R.value)),q=M(),J=null;return g(()=>{J=q(`/runs?stream=1${s?`&all=1`:``}${l?`&mine=1`:``}`);let e=!1;J.onopen=()=>{if(e){C.reload();return}e=!0,z.value={tone:`green`,text:`connected`}},J.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let n=t.type===`removed`?t.id:t.run?.id,r=n?L.get(n):void 0;if(te&&!r)return;let i=W(t,s,r?.persisted===!0);i.op===`upsert`?L.set(i.run.id,K(L.get(i.run.id),i.run)):i.op===`remove`&&L.delete(i.id)},J.onerror=()=>{J&&J.readyState===2?z.value={tone:`red`,text:`disconnected`}:z.value={tone:`amber`,text:`connecting…`}}}),_(()=>{J?.close()}),(e,o)=>{let u=O,h=ee(`RouterLink`);return p(),T(n,{title:v(U),nav:`runs`},{status:f(()=>[m(`span`,Ye,[r(Ce,{tone:z.value.tone,label:z.value.text},null,8,[`tone`,`label`]),m(`span`,Xe,c(z.value.text),1)])]),default:f(()=>[r(Z,{current:`runs`}),m(`div`,Ze,[m(`span`,Qe,c(re.value)+` running`,1),m(`span`,$e,[v(t)?.viewAs?(p(),T(Je,{key:0,people:v(t).viewAs.people},null,8,[`people`])):d(``,!0),r(u,{text:v(b)},{default:f(()=>[m(`label`,et,[m(`input`,{id:`showmine`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:v(l),"aria-describedby":`minehint`,onChange:oe},null,40,tt),o[0]||=y(` Show only mine `,-1)])]),_:1},8,[`text`]),m(`span`,nt,c(v(b)),1),m(`label`,rt,[m(`input`,{id:`showdone`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:v(s),"aria-describedby":`retention`,onChange:ae},null,40,it),o[1]||=y(` Show completed `,-1)]),r(u,{text:v(I)},{default:f(()=>[...o[2]||=[m(`span`,{class:`help inline-flex size-[1.1em] cursor-help items-center justify-center rounded-full border border-accented text-[0.7rem] leading-none text-dimmed hover:border-(--ui-text-dimmed) hover:text-toned`,tabindex:`0`},`?`,-1)]]),_:1},8,[`text`]),m(`span`,at,c(v(I)),1)])]),v(t)?.storeUnavailable?(p(),i(`p`,ot,c(v(t).storeUnavailable),1)):d(``,!0),m(`ul`,st,[(p(!0),i(x,null,a(ie.value,e=>(p(),i(x,{key:e.head.id},[r($,{run:e.head,now:v(R),"retention-ms":v(F),children:e.children},null,8,[`run`,`now`,`retention-ms`,`children`]),(p(!0),i(x,null,a(e.children,t=>(p(),T($,{key:t.id,run:t,now:v(R),"retention-ms":v(F),"nested-under":e.head.id},null,8,[`run`,`now`,`retention-ms`,`nested-under`]))),128))],64))),128)),H.value.length>0?(p(),i(`li`,ct,[...o[3]||=[m(`span`,{"aria-hidden":`true`,class:`text-sm tracking-normal`},`⏳`,-1),m(`span`,{class:`whitespace-nowrap`},`Leaving within a day`,-1),m(`span`,{class:`normal-case tracking-normal text-dimmed max-sm:hidden`},`— each row says when it is removed`,-1)]])):d(``,!0),(p(!0),i(x,null,a(H.value,e=>(p(),i(x,{key:e.head.id},[r($,{run:e.head,now:v(R),"retention-ms":v(F),children:e.children},null,8,[`run`,`now`,`retention-ms`,`children`]),(p(!0),i(x,null,a(e.children,t=>(p(),T($,{key:t.id,run:t,now:v(R),"retention-ms":v(F),"nested-under":e.head.id},null,8,[`run`,`now`,`retention-ms`,`nested-under`]))),128))],64))),128)),B.value.length===0?(p(),i(`li`,lt,c(v(l)?v(s)?`No runs of yours.`:`No active runs of yours.`:v(s)?`No runs.`:`No active runs.`),1)):d(``,!0)]),v(s)&&(v(t)?.olderHref||v(t)?.olderThan!==void 0)?(p(),i(`nav`,ut,[v(t)?.olderThan===void 0?d(``,!0):(p(),i(x,{key:0},[r(h,{class:`text-primary hover:underline`,to:k(!0,v(l))},{default:f(()=>[...o[4]||=[y(`← Newest runs`,-1)]]),_:1},8,[`to`]),m(`span`,dt,`· runs finished before `+c(se.value),1)],64)),v(t)?.olderHref?(p(),T(h,{key:1,class:`older ml-auto text-primary hover:underline`,to:v(t).olderHref},{default:f(()=>[...o[5]||=[y(`Older runs →`,-1)]]),_:1},8,[`to`])):d(``,!0)])):d(``,!0)]),_:1},8,[`title`])}}});export{ft as default};