@coreplane/switchboard 1.252.0 → 1.254.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/config/config.example.yaml +54 -1
- package/dist/assets/deploy/cloudflare-memory/runMetricsSink.ts +31 -0
- package/dist/assets/deploy/cloudflare-memory/worker.ts +455 -32
- package/dist/assets/deploy/cloudflare-memory/wrangler.template.jsonc +12 -0
- package/dist/assets/deploy/profile.example.json +1 -1
- package/dist/assets/package-lock.json +3 -3
- package/dist/assets/package.json +1 -1
- package/dist/assets/source.json +3 -3
- package/dist/assets/src/core/authz/grants.ts +6 -0
- package/dist/assets/src/core/authz/policy.ts +19 -0
- package/dist/assets/src/core/budgets.ts +25 -0
- package/dist/assets/src/core/coordinator/contract.ts +51 -1
- package/dist/assets/src/core/coordinator/driver.ts +111 -11
- package/dist/assets/src/core/costs.ts +221 -2
- package/dist/assets/src/core/costsSnapshotStore.ts +22 -1
- package/dist/assets/src/core/memory/engine.ts +25 -4
- package/dist/assets/src/core/memory/types.ts +6 -2
- package/dist/assets/src/core/pipelineStanding.ts +294 -0
- package/dist/assets/src/core/plane/decide.ts +203 -0
- package/dist/assets/src/core/provider.ts +11 -0
- package/dist/assets/src/core/runEvents.ts +57 -1
- package/dist/assets/src/core/runFriction.ts +1 -0
- package/dist/assets/src/core/runLedger/transcript.ts +23 -3
- package/dist/assets/src/core/runMetrics.ts +237 -0
- package/dist/assets/src/core/runRecord.ts +61 -0
- package/dist/assets/src/core/runUsage.ts +41 -9
- package/dist/assets/src/core/ship/contract.ts +8 -15
- package/dist/assets/src/core/ship/coordinator.ts +150 -11
- package/dist/assets/src/deploy/profile.ts +16 -0
- package/dist/assets/web/dist/.vite/manifest.json +461 -427
- package/dist/assets/web/dist/assets/{AppShell-DAtHiuI6.js → AppShell-CSXDCV4x.js} +1 -1
- package/dist/assets/web/dist/assets/CostChart-DsuPS2g7.js +2 -0
- package/dist/assets/web/dist/assets/CostsPage-BuKjw3nv.js +1 -0
- package/dist/assets/web/dist/assets/{DeliveryPage-3ELQWM0r.js → DeliveryPage-ngPsO2to.js} +1 -1
- package/dist/assets/web/dist/assets/HomePage-DvxTHzPx.js +3 -0
- package/dist/assets/web/dist/assets/{InputMenu-C6aPpe30.js → InputMenu-BdZXnibG.js} +1 -1
- package/dist/assets/web/dist/assets/MetricsPage-o5fSaCTe.js +1 -0
- package/dist/assets/web/dist/assets/{NotFoundPage-DtE-GgTk.js → NotFoundPage-DHuWyjlq.js} +1 -1
- package/dist/assets/web/dist/assets/PendingTurnRow-ZYIRCCZ2.js +1 -0
- package/dist/assets/web/dist/assets/PlanePage-DpWfiX4C.js +1 -0
- package/dist/assets/web/dist/assets/{ResidentDetailPage-C9y3nbo8.js → ResidentDetailPage-DG86v39Y.js} +1 -1
- package/dist/assets/web/dist/assets/{ResidentsIndexPage-i1RG9e7g.js → ResidentsIndexPage-x6p689VH.js} +1 -1
- package/dist/assets/web/dist/assets/RunFoldRow-DG29LOTs.js +1 -0
- package/dist/assets/web/dist/assets/RunRoutePage-ysJBY8xQ.js +9 -0
- package/dist/assets/web/dist/assets/RunsIndexPage-CuzFchcn.js +1 -0
- package/dist/assets/web/dist/assets/{RunsTabs-YSbUu5py.js → RunsTabs-kHbbxVHx.js} +1 -1
- package/dist/assets/web/dist/assets/{ScheduledPage-DvYwM2TE.js → ScheduledPage-BuLmfcbG.js} +1 -1
- package/dist/assets/web/dist/assets/{SettingSelect-BIzAsLk1.js → SettingSelect-BfID5nF4.js} +1 -1
- package/dist/assets/web/dist/assets/{SettingsPage-Bo6yCyXZ.js → SettingsPage-BujWkdU_.js} +1 -1
- package/dist/assets/web/dist/assets/{StatusDot-CAfS1AUi.js → StatusDot-C8Bc0pTX.js} +1 -1
- package/dist/assets/web/dist/assets/{Tooltip-tZoum_T-.js → Tooltip-BWwJx27K.js} +1 -1
- package/dist/assets/web/dist/assets/{UnitRoutePage-BmdOHwNn.js → UnitRoutePage-B9kjA1AT.js} +1 -1
- package/dist/assets/web/dist/assets/{angular-html-BjeQZdCq.js → angular-html-C8b5YTHf.js} +1 -1
- package/dist/assets/web/dist/assets/{angular-ts-ZGdORrL2.js → angular-ts-C3f4WYNe.js} +1 -1
- package/dist/assets/web/dist/assets/{apl-DhvV_X93.js → apl-DSHxUJc3.js} +1 -1
- package/dist/assets/web/dist/assets/{astro-DiRSE4Ug.js → astro-BSGCCBP6.js} +1 -1
- package/dist/assets/web/dist/assets/{blade-D8Fr5Wvq.js → blade-DFeYrMKk.js} +1 -1
- package/dist/assets/web/dist/assets/{c-BwbC64D4.js → c-L_QOnFVv.js} +1 -1
- package/dist/assets/web/dist/assets/{chapel-DgmqRK97.js → chapel-DLQWUwhu.js} +1 -1
- package/dist/assets/web/dist/assets/{cobol-DJod2RNK.js → cobol-1DlMmrEO.js} +1 -1
- package/dist/assets/web/dist/assets/{coffee-D1Y2CgBY.js → coffee-BTB6os6N.js} +1 -1
- package/dist/assets/web/dist/assets/{cpp-CsO97YOM.js → cpp-BvJI2z3u.js} +1 -1
- package/dist/assets/web/dist/assets/{crystal-CJ7m2tOc.js → crystal-B11wGW_h.js} +1 -1
- package/dist/assets/web/dist/assets/{css-B2M-NKoj.js → css-BiIWx5Pw.js} +1 -1
- package/dist/assets/web/dist/assets/{dist-DfbEpHXR.js → dist-CpnyQGOb.js} +2 -2
- package/dist/assets/web/dist/assets/{edge-CFVW-m9B.js → edge-nSglEXaD.js} +1 -1
- package/dist/assets/web/dist/assets/{elixir-B2mtRgCr.js → elixir-x7o8qMl8.js} +1 -1
- package/dist/assets/web/dist/assets/{elm-2teVAwCi.js → elm-DGrRyqTQ.js} +1 -1
- package/dist/assets/web/dist/assets/{erb-LAbeNqen.js → erb--_dh58Nw.js} +1 -1
- package/dist/assets/web/dist/assets/{git-rebase-DnhzH_sp.js → git-rebase-DbpUXwyg.js} +1 -1
- package/dist/assets/web/dist/assets/{glimmer-js-DPKjXf1-.js → glimmer-js-BG0CuZG5.js} +1 -1
- package/dist/assets/web/dist/assets/{glimmer-ts-CABXnt5z.js → glimmer-ts-CQIl5qyR.js} +1 -1
- package/dist/assets/web/dist/assets/{glsl-Dz4-3-gJ.js → glsl-9PJNQTcw.js} +1 -1
- package/dist/assets/web/dist/assets/{graphql-ByWUD1DL.js → graphql-CzVTzjEI.js} +1 -1
- package/dist/assets/web/dist/assets/{hack-CdmOK2K-.js → hack-BhCmAz3Q.js} +1 -1
- package/dist/assets/web/dist/assets/{haml-DzegMpd2.js → haml-BmI12COR.js} +1 -1
- package/dist/assets/web/dist/assets/{handlebars-B5NeiP0e.js → handlebars-Cib-ISTS.js} +1 -1
- package/dist/assets/web/dist/assets/{html-Zg_NHLv9.js → html-D3lDapvI.js} +1 -1
- package/dist/assets/web/dist/assets/{html-derivative-DZf9JNzh.js → html-derivative-DRPY8vOK.js} +1 -1
- package/dist/assets/web/dist/assets/{http-CVFrQZeN.js → http-B9VttK6m.js} +1 -1
- package/dist/assets/web/dist/assets/{hurl-L5brWAJe.js → hurl-C0saNJYj.js} +1 -1
- package/dist/assets/web/dist/assets/indexRow-DABQtONT.js +1 -0
- package/dist/assets/web/dist/assets/{java-hFphyZ4R.js → java-BCFbtYAj.js} +1 -1
- package/dist/assets/web/dist/assets/{javascript-CAJO1WKX.js → javascript-nwBjnrhh.js} +1 -1
- package/dist/assets/web/dist/assets/{jinja-N4A4srXI.js → jinja-CMYO9byN.js} +1 -1
- package/dist/assets/web/dist/assets/{jison-D3BZa_iU.js → jison-Cko8HnE_.js} +1 -1
- package/dist/assets/web/dist/assets/{json-DxD1Qh8W.js → json-Dzv__YsX.js} +1 -1
- package/dist/assets/web/dist/assets/{jsx-CHhag69S.js → jsx-CTFxagih.js} +1 -1
- package/dist/assets/web/dist/assets/{julia-CrhkZ6Tt.js → julia-_Xvten1-.js} +1 -1
- package/dist/assets/web/dist/assets/{just-D0LFOuhq.js → just-bLps4qOu.js} +1 -1
- package/dist/assets/web/dist/assets/{latex-BHAlwCXK.js → latex-D6UaYsUP.js} +1 -1
- package/dist/assets/web/dist/assets/{liquid-CkaLfCWh.js → liquid-CoDIeULa.js} +1 -1
- package/dist/assets/web/dist/assets/{lua-B1h4aAzP.js → lua-D1KFRnVf.js} +1 -1
- package/dist/assets/web/dist/assets/main-C4QfwybO.css +1 -0
- package/dist/assets/web/dist/assets/main-Comxmwi4.js +28 -0
- package/dist/assets/web/dist/assets/{marko-D6CG4hvX.js → marko-B5N5XcOw.js} +1 -1
- package/dist/assets/web/dist/assets/{mdc-CVQzimAU.js → mdc-uxzjQO3q.js} +1 -1
- package/dist/assets/web/dist/assets/{nginx-h-9Ir54h.js → nginx-BMJxs2TK.js} +1 -1
- package/dist/assets/web/dist/assets/{nim-DHVI30sp.js → nim-DqQ3-8p1.js} +1 -1
- package/dist/assets/web/dist/assets/{org-AasAXfMF.js → org-DsY6LK59.js} +1 -1
- package/dist/assets/web/dist/assets/{perl-BVi5aTEy.js → perl--pq9iJFp.js} +1 -1
- package/dist/assets/web/dist/assets/{php-qOkCeUKr.js → php-RHCMbsM2.js} +1 -1
- package/dist/assets/web/dist/assets/{pug-8TnUGvEX.js → pug-CFNq_FCp.js} +1 -1
- package/dist/assets/web/dist/assets/{qml-CpJbhoxn.js → qml-C9Acx9E8.js} +1 -1
- package/dist/assets/web/dist/assets/{r-JkUNcAJW.js → r-DxlU8FBd.js} +1 -1
- package/dist/assets/web/dist/assets/{razor-CtU4ws5a.js → razor-CLJ2kKih.js} +1 -1
- package/dist/assets/web/dist/assets/{regexp-J2zA6ceN.js → regexp-CzmdGoEp.js} +1 -1
- package/dist/assets/web/dist/assets/{rst-CMCvf-yZ.js → rst-D9yuxBET.js} +1 -1
- package/dist/assets/web/dist/assets/{ruby-ChLBY_iR.js → ruby-CIRcEvnD.js} +1 -1
- package/dist/assets/web/dist/assets/{sas-cwn4x2VY.js → sas-LOl-uUPh.js} +1 -1
- package/dist/assets/web/dist/assets/{scss-jSrJlzLI.js → scss-BX2_sZHY.js} +1 -1
- package/dist/assets/web/dist/assets/{shellscript-D5nAd0gs.js → shellscript-4d-QvKkY.js} +1 -1
- package/dist/assets/web/dist/assets/{shellsession-BZY4-Tdh.js → shellsession-DhB16UGy.js} +1 -1
- package/dist/assets/web/dist/assets/{soy-COppPOKr.js → soy-Cm1xTUBr.js} +1 -1
- package/dist/assets/web/dist/assets/{sql-Blc_6dOA.js → sql-BsfcBJdu.js} +1 -1
- package/dist/assets/web/dist/assets/{sseReplay-DmyMXfRC.js → sseReplay-IzTdD4-3.js} +5 -5
- package/dist/assets/web/dist/assets/{stata-DRv3OY-h.js → stata-Dwat3BSw.js} +1 -1
- package/dist/assets/web/dist/assets/{surrealql-qMv_eeJ6.js → surrealql-P4rtxzAW.js} +1 -1
- package/dist/assets/web/dist/assets/{svelte-d1Edb6Rz.js → svelte-DTcsi8S8.js} +1 -1
- package/dist/assets/web/dist/assets/{templ-CUMSIOXG.js → templ-D-kP0Tg5.js} +1 -1
- package/dist/assets/web/dist/assets/{tex-BGZQA-Ei.js → tex-D-4vuedK.js} +1 -1
- package/dist/assets/web/dist/assets/{ts-tags-Z9ulxVsq.js → ts-tags-jEEWYxsu.js} +1 -1
- package/dist/assets/web/dist/assets/{tsx-oI4bI3Vf.js → tsx-CFnlrVzT.js} +1 -1
- package/dist/assets/web/dist/assets/{twig-D_RXwBIX.js → twig-D5rGrPjs.js} +1 -1
- package/dist/assets/web/dist/assets/{typescript-BgqQDYoN.js → typescript-nYIQ35or.js} +1 -1
- package/dist/assets/web/dist/assets/{typst-5MW-KRDd.js → typst-3-UX8dna.js} +1 -1
- package/dist/assets/web/dist/assets/{vue-CZhHHsPm.js → vue-CLIPIX03.js} +1 -1
- package/dist/assets/web/dist/assets/{vue-html-DlYy2d8v.js → vue-html-Ci9CpkHU.js} +1 -1
- package/dist/assets/web/dist/assets/{vue-vine-CJDnx-qn.js → vue-vine-DL5pEYYk.js} +1 -1
- package/dist/assets/web/dist/assets/{xml-BRBDk65Q.js → xml-bO80qikC.js} +1 -1
- package/dist/assets/web/dist/assets/{xsl-BlCykPxo.js → xsl-BPze60Ej.js} +1 -1
- package/dist/assets/web/dist/assets/{yaml-BqW48szf.js → yaml-BQUSon_o.js} +1 -1
- package/dist/cli.js +36552 -33171
- package/package.json +1 -1
- package/dist/assets/web/dist/assets/CostsPage-BoKzYa4B.js +0 -2
- package/dist/assets/web/dist/assets/HomePage-BG_ok-K2.js +0 -2
- package/dist/assets/web/dist/assets/PendingTurnRow-ChCQOLgZ.js +0 -1
- package/dist/assets/web/dist/assets/RunFoldRow-D3wVpzBa.js +0 -1
- package/dist/assets/web/dist/assets/RunRoutePage-B3IirUVi.js +0 -9
- package/dist/assets/web/dist/assets/RunsIndexPage-DiFmtGaJ.js +0 -1
- package/dist/assets/web/dist/assets/indexRow-BT0cPVRw.js +0 -1
- package/dist/assets/web/dist/assets/main-5Gm_1Gv8.js +0 -28
- package/dist/assets/web/dist/assets/main-zbP_dTjR.css +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreplane/switchboard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.254.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,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./AppShell-DAtHiuI6.js";import{An as t,Cn as n,Cr as r,Ii as i,Li as a,Mn as o,Pi as s,Qr as c,Sn as l,Tr as u,Xr as d,Xt as f,_r as p,bn as m,dr as h,en as g,hr as _,ji as v,kn as y,ln as b,o as x,xi as S,xn as C,yn as w}from"./browser-B6T5hjfR.js";import{d as T,f as E,l as D}from"./delivery-CTdOqpVK.js";import{t as ee}from"./eventSource-Bj_dZf6M.js";import{r as O}from"./settingsApi-Dm6eaQcu.js";import{t as te}from"./wallClock-DmaC1sKA.js";var k=`Durable Objects`;function ne(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;if(n.type!==`status`||typeof n.everyHours!=`number`)return null;let{type:r,...i}=n;return i}var A=e=>e===`schedule`?`on schedule`:`by ${e}`;function j(e,t){let n=[];if(e.inFlight?(n.push(`Taking a snapshot now — started ${T(e.inFlight.startedAt,t)} ${A(e.inFlight.by)}`),e.snapshot&&n.push(`showing the one from ${D(e.snapshot.takenAt)} meanwhile`)):e.snapshot?(n.push(`Snapshot from ${D(e.snapshot.takenAt)}, ${T(e.snapshot.takenAt,t)} ${A(e.snapshot.takenBy)}`),e.nextAt&&n.push(`next ${E(e.nextAt,t)}`)):e.nextAt?n.push(`No snapshot yet — next attempt ${E(e.nextAt,t)}`):n.push(`No snapshot yet — the first one is taken within a minute of startup`),e.lastFailure&&!e.inFlight){let r=e.lastFailure.count>1?` (${e.lastFailure.count} in a row)`:``;n.push(`last attempt ${T(e.lastFailure.at,t)} failed${r}: ${e.lastFailure.message.slice(0,120)}`)}return n.join(` · `)}var M=`Workers · storage · R2`,N=`LLM (Anthropic)`,P=(e,t=2)=>`$${e.toFixed(t)}`,F=e=>e.workersUsd+e.doRowsUsd+e.doStorageUsd+e.r2Usd+e.workflowsUsd;function re(e){let t=[];for(let n of e.days)for(let e of Object.keys(n.containers))t.includes(e)||t.push(e);return e.days.some(e=>Object.keys(e.durableObjects).length>0)&&t.push(k),e.days.some(e=>F(e)>0)&&t.push(M),e.llmAvailable&&t.push(N),t}function I(e,t){return t===`Durable Objects`?Object.values(e.durableObjects).reduce((e,t)=>e+t,0)+e.doRequestsUsd:t===`Workers · storage · R2`?F(e):t===`LLM (Anthropic)`?e.llmUsd:e.containers[t]?.total??0}var ie=30.4;function ae(e){let t=e.range.partialLastDay?e.days.slice(0,-1):e.days,n=e.range.partialLastDay?e.days[e.days.length-1]:void 0,r=t[t.length-1],i=t.slice(-7),a=i.length?i.reduce((e,t)=>e+t.total,0)/i.length:void 0,o=e.account.cloudUsd>0?Math.round(e.totals.cloudUsd/e.account.cloudUsd*100):0;return{...r?{yesterday:{date:r.date,total:r.total}}:{},...n?{today:{date:n.date,total:n.total}}:{},...a===void 0?{}:{avg7:a},projection:z(e,t,n),llm:{range:e.totals.llmUsd,...r?{yesterday:r.llmUsd}:{},...n?{today:{usd:n.llmUsd,estimated:n.llmEstimated}}:{}},accountShare:o}}var L=e=>e.reduce((e,t)=>e+t,0)/e.length;function R(e,t){let n=Date.parse(`${t.date}T00:00:00Z`),r=(e.generatedAt-n)/864e5;return Math.min(1,Math.max(1/24,Number.isFinite(r)?r:1))}function z(e,t,n){let r=n?R(e,n):1,i=t.slice(-7),a=0,o=`full-days`;i.length?a=L(i.map(e=>e.cloudUsd)):n&&(a=n.cloudUsd/r,o=`today`);let s=0,c=`none`,l=0;if(e.llmAvailable){let e=t.findIndex(e=>e.llmUsd>0),i=e===-1?[]:t.slice(e).slice(-7);i.length?(s=L(i.map(e=>e.llmUsd)),c=`closed-days`,l=i.length):n&&n.llmUsd>0&&(s=n.llmUsd/r,c=`today`)}return{monthUsd:(a+s)*ie,cloudRate:a,llmRate:s,cloudBasis:o,llmBasis:c,llmClosedDays:l}}function oe(e){let t=`https://dash.cloudflare.com/${e.account.id}`;return{account:t,billing:`${t}/billing`,containers:`${t}/workers/containers`,durableObjects:`${t}/workers/durable-objects`,workers:`${t}/workers-and-pages`,r2:`${t}/r2/overview`,workflows:`${t}/workers/workflows`,worker:e=>`${t}/workers/services/view/${encodeURIComponent(e)}/production/metrics`,bucket:e=>`${t}/r2/default/buckets/${encodeURIComponent(e)}`,anthropic:`https://platform.claude.com/cost`}}var se=e=>e.account.name??`${e.account.id.slice(0,8)}…`;function B(e,t,n){let r=[`${e.date} · total ${P(e.total)}${n?` (partial day)`:``}`];for(let n of t){let t=I(e,n);t<=0||r.push(`${n} ${P(t)}${n===`LLM (Anthropic)`&&e.llmEstimated?` (estimate)`:``}`)}return r.join(`
|
|
2
|
-
`)}function V(e){let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:`${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getUTCMonth()]} ${t.getUTCDate()}`}function ce(e,t,n){let r=t.map(t=>({series:t,usd:I(e,t),estimated:t===`LLM (Anthropic)`&&e.llmEstimated})).filter(e=>e.usd>0).sort((e,t)=>t.usd-e.usd);return{date:e.date,label:V(e.date),partial:n,total:e.total,rows:r}}function le(e,t){let n={t:12,r:12,b:30,l:48},r=960-n.l-n.r,i=260-n.t-n.b,a=e.days,o=Math.max(1e-9,...a.map(e=>e.total))*1.08,s=r/Math.max(1,a.length),c=Math.min(10,s*.28),l=e=>n.t+i-e/o*i,u=Array.from({length:5},(e,t)=>{let n=o/4*t;return{y:Number(l(n).toFixed(1)),label:P(n)}}),d=[],f=[],p=[];return a.forEach((r,o)=>{let u=0,m=n.l+o*s+c/2,h=s-c;f.push({x:Number((n.l+o*s).toFixed(1)),y:n.t,width:Number(s.toFixed(1)),height:i,title:B(r,t,e.range.partialLastDay&&o===a.length-1),tip:ce(r,t,e.range.partialLastDay&&o===a.length-1)}),t.forEach((e,t)=>{let n=I(r,e);if(n<=0)return;let i=l(u+n),a=l(u),o=Math.max(0,a-i-2);d.push({seriesIndex:t,x:Number(m.toFixed(1)),y:Number(i.toFixed(1)),width:Number(h.toFixed(1)),height:Number(o.toFixed(1))}),u+=n}),(a.length<=16||o%Math.ceil(a.length/16)===0)&&p.push({x:Number((m+h/2).toFixed(1)),label:r.date.slice(5)})}),{width:960,height:260,gridLines:u,segments:d,dayHovers:f,dayLabels:p,axisY:Number(l(0).toFixed(1)),marginLeft:n.l,marginRight:n.r}}function ue(e){let t=e.totals.byResource,n=[[`Memory (provisioned while awake)`,t.memory],[`vCPU (active use only)`,t.cpu],[`Durable Object duration + requests`,t.durableObjects],[`Disk (provisioned while awake)`,t.disk],[`Workers requests + CPU`,t.workers],[`Durable Object SQLite rows`,t.doRows],[`Durable Object SQLite storage`,t.doStorage],[`R2 storage + operations`,t.r2],[`Workflow steps + state`,t.workflows]],r=n.reduce((e,t)=>e+t[1],0)||1;return n.map(([e,t])=>({label:e,usd:t,percent:t/r*100}))}var de=[`fill-[#4478b8] dark:fill-[#7aa7e0]`,`fill-[#c8823b] dark:fill-[#e0a95a]`,`fill-[#4c8c57] dark:fill-[#6fae7a]`,`fill-[#b8963e] dark:fill-[#d4b45a]`,`fill-[#b0568c] dark:fill-[#d489b8]`,`fill-[#6b7bcc] dark:fill-[#98a5e6]`,`fill-[#d05252] dark:fill-[#e07a74]`,`fill-[#3e8e96] dark:fill-[#6fb9c0]`],fe=[`bg-[#4478b8] dark:bg-[#7aa7e0]`,`bg-[#c8823b] dark:bg-[#e0a95a]`,`bg-[#4c8c57] dark:bg-[#6fae7a]`,`bg-[#b8963e] dark:bg-[#d4b45a]`,`bg-[#b0568c] dark:bg-[#d489b8]`,`bg-[#6b7bcc] dark:bg-[#98a5e6]`,`bg-[#d05252] dark:bg-[#e07a74]`,`bg-[#3e8e96] dark:bg-[#6fb9c0]`],pe={class:`overflow-x-auto`},H=[`viewBox`],U=[`x1`,`x2`,`y1`,`y2`],W=[`x`,`y`],G=[`x`,`y`,`width`,`height`],K=[`aria-label`,`x`,`y`,`width`,`height`,`onPointerenter`,`onPointermove`],q=[`x`,`y`],J=[`x1`,`x2`,`y1`,`y2`],me={class:`tip-head mb-1.5 flex items-baseline justify-between gap-3 border-b border-muted pb-1.5`},Y={class:`font-medium text-highlighted`},he={key:0,class:`ml-1.5 font-normal text-dimmed`},X={class:`font-medium text-highlighted`},ge={class:`tip-name truncate text-muted`},_e={class:`text-highlighted`},ve={class:`tip-usd`},ye={key:0,class:`ml-1 text-dimmed`},Z=256,Q=12,be=o({__name:`CostChart`,props:{report:{},series:{}},setup(e){let t=e,o=w(()=>le(t.report,t.series)),c=e=>44+e*20,u=S(null),d=S(null);function f(e,t){let n=d.value,r=n?.getBoundingClientRect(),i=t.clientX-(r?.left??0),a=t.clientY-(r?.top??0),o=n?.clientWidth??0,s=n?.clientHeight??0,l=c(e.tip.rows.length),f=o>0&&i+Q+Z>o,p=s>0&&a+Q+l>s;u.value={x:Math.max(0,f?i-Q-Z:i+Q),y:Math.max(0,p?a-Q-l:a+Q),data:e.tip}}return(e,t)=>(p(),n(`div`,{ref_key:`host`,ref:d,class:`chart-host relative`},[m(`div`,pe,[(p(),n(`svg`,{class:`block h-auto w-full font-mono`,viewBox:`0 0 ${o.value.width} ${o.value.height}`,role:`img`,"aria-label":`Daily cost, stacked by component`},[(p(!0),n(b,null,r(o.value.gridLines,(e,t)=>(p(),n(b,{key:`g${t}`},[m(`line`,{class:`stroke-(--ui-border-muted)`,x1:o.value.marginLeft,x2:o.value.width-o.value.marginRight,y1:e.y,y2:e.y},null,8,U),m(`text`,{class:`fill-(--ui-text-dimmed) text-[11px] tabular-nums`,x:o.value.marginLeft-8,y:e.y+4,"text-anchor":`end`},a(e.label),9,W)],64))),128)),(p(!0),n(b,null,r(o.value.segments,(e,t)=>(p(),n(`rect`,{key:`s${t}`,class:s([`seg hover:opacity-85`,v(de)[e.seriesIndex%v(de).length]]),x:e.x,y:e.y,width:e.width,height:e.height},null,10,G))),128)),(p(!0),n(b,null,r(o.value.dayHovers,(e,r)=>(p(),n(`rect`,{key:`h${r}`,class:`day fill-transparent`,role:`img`,"aria-label":e.title,x:e.x,y:e.y,width:e.width,height:e.height,onPointerenter:t=>f(e,t),onPointermove:t=>f(e,t),onPointerleave:t[0]||=e=>u.value=null},null,40,K))),128)),(p(!0),n(b,null,r(o.value.dayLabels,(e,t)=>(p(),n(`text`,{key:`d${t}`,class:`fill-(--ui-text-dimmed) text-[11px]`,x:e.x,y:o.value.height-10,"text-anchor":`middle`},a(e.label),9,q))),128)),m(`line`,{class:`stroke-(--ui-border)`,x1:o.value.marginLeft,x2:o.value.width-o.value.marginRight,y1:o.value.axisY,y2:o.value.axisY},null,8,J)],8,H))]),u.value?(p(),n(`div`,{key:0,class:`chart-tip pointer-events-none absolute z-10 w-64 rounded-md border border-default bg-elevated px-3 py-2 font-mono text-xs tabular-nums whitespace-nowrap shadow-lg`,role:`tooltip`,style:i({left:`${u.value.x}px`,top:`${u.value.y}px`})},[m(`div`,me,[m(`span`,Y,[y(a(u.value.data.label),1),u.value.data.partial?(p(),n(`span`,he,`partial day`)):l(``,!0)]),m(`span`,X,a(v(P)(u.value.data.total)),1)]),(p(!0),n(b,null,r(u.value.data.rows,e=>(p(),n(`div`,{key:e.series,class:`tip-row flex items-baseline justify-between gap-3 leading-5`},[m(`span`,ge,a(e.series),1),m(`span`,_e,[m(`span`,ve,a(v(P)(e.usd)),1),e.estimated?(p(),n(`span`,ye,`est.`)):l(``,!0)])]))),128))],4)):l(``,!0)],512))}}),$=[`data-dimension`],xe={class:`flex flex-wrap items-center gap-x-4 gap-y-2`},Se={class:`flex items-center gap-2 text-sm text-muted`},Ce=[`placeholder`,`aria-label`],we=[`title`],Te=[`disabled`,`aria-describedby`],Ee={key:0,id:`me-hint`,class:`me-hint text-xs text-dimmed`},De={class:`coverage font-mono text-xs tabular-nums text-muted`},Oe={class:`overflow-x-auto`},ke={class:`by w-full min-w-[40rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},Ae={class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-left text-xs font-medium text-muted`},je={class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},Me={key:0,class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},Ne=[`title`],Pe={class:`text-highlighted`},Fe={key:0,class:`ml-1.5 text-xs text-dimmed`},Ie={key:1,class:`ml-1.5 rounded-xs bg-accented px-1 text-xs text-highlighted`},Le=[`title`],Re={class:`border-b border-muted px-2.5 py-1.5 text-right`},ze={class:`border-b border-muted px-2.5 py-1.5 text-right`},Be={key:0,class:`border-b border-muted px-2.5 py-1.5 text-right`},Ve={class:`border-b border-muted px-2.5 py-1.5 text-right font-medium text-highlighted`},He={class:`border-b border-muted px-2.5 py-1.5 text-right`},Ue={key:0},We=[`colspan`],Ge={key:0},Ke=[`colspan`],qe={class:`px-2.5 py-1.5 text-right text-xs text-muted`},Je={class:`px-2.5 py-1.5 text-right text-xs text-muted`},Ye={class:`reconciliation font-mono text-xs tabular-nums text-muted`},Xe={class:`text-xs text-dimmed`},Ze=o({__name:`CostsByDimension`,props:{report:{}},setup(e){let t=e,i={user:`User`,thread:`Thread`,channel:`Channel`,agent:`Agent`,model:`Model`},o=S(``),u=S(!1),d=w(()=>t.report.dimension),h=w(()=>t.report.viewer!==void 0),_=w(()=>(t.report.viewer?.userIds.length??0)>0),x=w(()=>t.report.cloudAllocated),C=w(()=>d.value===`model`?`Turns`:`Runs`),T=e=>d.value===`model`?e.turns:e.runs,E=w(()=>{let e=o.value.trim().toLowerCase(),n=new Set(t.report.viewer?.userIds??[]);return t.report.rows.filter(t=>u.value&&!n.has(t.key)?!1:!e||t.key.toLowerCase().includes(e)||(t.label??``).toLowerCase().includes(e))}),D=w(()=>t.report.rows.reduce((e,t)=>e+t.totalUsd,0)),ee=w(()=>E.value.reduce((e,t)=>e+t.totalUsd,0)),O=e=>t.report.viewer?.userIds.includes(e.key)??!1,te=w(()=>d.value===`user`||d.value===`thread`||d.value===`channel`),k=e=>e.label?d.value===`channel`?`#${e.label}`:e.label:te.value?e.key.replace(/^[a-z]+:/,``):e.key,ne=e=>te.value&&e.key.includes(`:`)?e.key.split(`:`)[0]:``,A=e=>`${e} day${e===1?``:`s`}`,j=w(()=>x.value?6:5);return(t,S)=>(p(),n(`section`,{class:`by-dimension grid gap-3`,"data-dimension":d.value},[m(`div`,xe,[m(`label`,Se,[S[2]||=m(`span`,null,`Filter`,-1),c(m(`input`,{"onUpdate:modelValue":S[0]||=e=>o.value=e,class:`key-filter rounded-md border border-default bg-elevated px-2.5 py-1 font-mono text-xs text-highlighted`,type:`search`,placeholder:d.value===`user`?`name or id`:i[d.value].toLowerCase(),"aria-label":`Filter by ${i[d.value].toLowerCase()}`},null,8,Ce),[[g,o.value]])]),h.value?(p(),n(`label`,{key:0,class:s([`me-toggle flex items-center gap-2 text-sm`,_.value?`text-muted`:`text-dimmed`]),title:_.value?`Only your own runs`:void 0},[c(m(`input`,{"onUpdate:modelValue":S[1]||=e=>u.value=e,type:`checkbox`,disabled:!_.value,"aria-label":`Only me`,"aria-describedby":_.value?void 0:`me-hint`},null,8,Te),[[f,u.value]]),S[3]||=m(`span`,null,`me`,-1),_.value?l(``,!0):(p(),n(`span`,Ee,`— your sign-in email matched no Slack user in this range`))],10,we)):l(``,!0),m(`p`,De,[e.report.coverage.historyOn?(p(),n(b,{key:1},[y(` runs from `+a(v(V)(e.report.coverage.from))+` to `+a(v(V)(e.report.range.to)),1),e.report.coverage.clamped?(p(),n(b,{key:0},[y(` · earlier days are past the history's `+a(e.report.coverage.retentionDays)+`-day window`,1)],64)):l(``,!0),e.report.pending>0?(p(),n(b,{key:1},[y(` · `+a(e.report.pending)+` run`+a(e.report.pending===1?``:`s`)+` still being priced`,1)],64)):l(``,!0)],64)):(p(),n(b,{key:0},[y(`run history is off — no runs to attribute`)],64))])]),m(`div`,Oe,[m(`table`,ke,[m(`thead`,null,[m(`tr`,null,[m(`th`,Ae,a(i[d.value]),1),m(`th`,je,a(C.value),1),S[5]||=m(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},` LLM `,-1),x.value?(p(),n(`th`,Me,[...S[4]||=[y(` Cloud `,-1),m(`span`,{class:`font-normal text-dimmed`},`allocated`,-1)]])):l(``,!0),S[6]||=m(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},` Total `,-1),S[7]||=m(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},` Share `,-1)])]),m(`tbody`,null,[(p(!0),n(b,null,r(E.value,e=>(p(),n(`tr`,{key:e.key,class:s([`by-row`,O(e)?`is-me`:``])},[m(`td`,{class:`border-b border-muted px-2.5 py-1.5`,title:e.key},[m(`span`,Pe,a(k(e)),1),ne(e)?(p(),n(`span`,Fe,a(ne(e)),1)):l(``,!0),O(e)?(p(),n(`span`,Ie,`me`)):l(``,!0),e.unpricedTokens>0?(p(),n(`span`,{key:2,class:`ml-1.5 text-xs text-warn`,title:`${e.unpricedTokens} tokens ran under a model with no price`},`unpriced tokens`,8,Le)):l(``,!0)],8,Ne),m(`td`,Re,a(T(e)),1),m(`td`,ze,a(v(P)(e.llmUsd)),1),x.value?(p(),n(`td`,Be,a(v(P)(e.cloudUsd)),1)):l(``,!0),m(`td`,Ve,a(v(P)(e.totalUsd)),1),m(`td`,He,a(D.value>0?Math.round(e.totalUsd/D.value*100):0)+`% `,1)],2))),128)),E.value.length===0?(p(),n(`tr`,Ue,[m(`td`,{class:`empty px-2.5 py-3 text-sm text-muted`,colspan:j.value},a(e.report.rows.length===0?`no runs in this range`:`no ${i[d.value].toLowerCase()} matches`),9,We)])):l(``,!0)]),E.value.length>0&&E.value.length<e.report.rows.length?(p(),n(`tfoot`,Ge,[m(`tr`,null,[m(`td`,{class:`px-2.5 py-1.5 text-xs text-muted`,colspan:j.value-2},`shown`,8,Ke),m(`td`,qe,a(v(P)(ee.value)),1),m(`td`,Je,a(D.value>0?Math.round(ee.value/D.value*100):0)+`% `,1)])])):l(``,!0)])]),m(`p`,Ye,[e.report.reconciliation.comparedDays>0?(p(),n(b,{key:0},[y(` LLM attributed `+a(v(P)(e.report.reconciliation.attributedLlmUsd))+` of `+a(v(P)(e.report.reconciliation.workspaceLlmUsd))+` on the workspace over `+a(A(e.report.reconciliation.comparedDays))+` · `,1),e.report.reconciliation.unattributedLlmUsd>=0?(p(),n(b,{key:0},[y(a(v(P)(e.report.reconciliation.unattributedLlmUsd))+` unattributed (router, review abridges, runs without a record, list vs invoice) `,1)],64)):(p(),n(b,{key:1},[y(a(v(P)(-e.report.reconciliation.unattributedLlmUsd))+` more attributed than the workspace figure (list vs invoice, or spend billed outside this workspace on a compared day) `,1)],64))],64)):(p(),n(b,{key:1},[y(`no day in range has a workspace LLM figure to compare against`)],64)),e.report.reconciliation.uncomparedDays>0?(p(),n(b,{key:2},[y(` · `+a(A(e.report.reconciliation.uncomparedDays))+` with `+a(v(P)(e.report.reconciliation.uncomparedLlmUsd))+` of run tokens but no workspace figure (billed outside this workspace) not compared`,1)],64)):l(``,!0),x.value?(p(),n(b,{key:3},[y(` · cloud allocated `+a(v(P)(e.report.reconciliation.cloudAllocatedUsd)),1),e.report.reconciliation.cloudUnallocatedUsd>0?(p(),n(b,{key:0},[y(` · `+a(v(P)(e.report.reconciliation.cloudUnallocatedUsd))+` on days with no runs`,1)],64)):l(``,!0)],64)):l(``,!0)]),m(`p`,Xe,[d.value===`model`?(p(),n(b,{key:0},[y(` A model's LLM is the runs' tokens on it, priced through the price table (the configured rates over Anthropic list; cache writes at the 5-minute rate); a run that spent on two models counts under both, and cloud is not split by model — a container runs a run, not a model. `)],64)):(p(),n(b,{key:1},[y(` A `+a(i[d.value].toLowerCase())+`'s LLM is its runs' tokens priced through the price table (the configured rates over Anthropic list; cache writes at the 5-minute rate); a child run bills to whoever started its parent, in the child's own thread and agent. Cloud is each day's Cloudflare spend split by share of run wall-clock — an allocation, not a meter. `,1)],64))])],8,$))}}),Qe={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},$e={class:`flex items-center gap-1`,"aria-label":`Range`},et={key:0,class:`rounded-md bg-accented px-2.5 py-1 font-mono text-xs font-medium tabular-nums text-highlighted`,"aria-current":`page`},tt={key:0,class:`flex items-center gap-1`,"aria-label":`Cost groups`},nt={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},rt={class:`font-mono text-sm tabular-nums text-muted`},it={key:1,class:`flex basis-full flex-wrap items-center gap-x-3 gap-y-1`},at={class:`font-mono text-xs tabular-nums text-dimmed`,"data-snapshot-status":``},ot=[`disabled`],st={key:1,class:`text-xs text-error`,role:`status`,"data-snapshot-error":``},ct={class:`mb-5 grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-3`},lt={key:0,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},ut={class:`font-mono text-2xl font-medium tabular-nums`},dt={class:`text-xs text-muted`},ft={key:1,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},pt={class:`font-mono text-2xl font-medium tabular-nums`},mt={class:`text-xs text-muted`},ht={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},gt={class:`font-mono text-2xl font-medium tabular-nums`},_t={class:`text-xs text-muted`},vt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},yt={class:`font-mono text-2xl font-medium tabular-nums`},bt={class:`text-xs text-muted`},xt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},St={class:`font-mono text-2xl font-medium tabular-nums`},Ct={class:`text-xs text-muted`},wt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},Tt={class:`font-mono text-2xl font-medium tabular-nums`},Et={class:`text-xs text-muted`},Dt=[`href`,`title`],Ot=[`href`],kt={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},At={class:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2`},jt={class:`legend flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted`},Mt=[`href`,`title`],Nt={key:0,class:`text-xs text-warn`},Pt={key:1,class:`text-xs text-muted`},Ft={class:`mb-3 flex flex-wrap items-center gap-1 border-b border-default`,"aria-label":`View`},It={key:0,class:`-mb-px border-b-2 border-primary px-3 py-1.5 text-sm font-medium text-highlighted`,"aria-current":`page`},Lt={key:0,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Rt={class:`text-[0.9375rem] font-medium`},zt={class:`text-sm text-muted`},Bt={key:1,class:`text-sm text-warn`},Vt={class:`text-xs text-muted`},Ht={class:`rounded bg-accented px-1 py-0.5`},Ut={key:1,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Wt={class:`w-full border-collapse font-mono text-[0.8125rem] tabular-nums`},Gt={class:`px-2.5 py-1.5`},Kt=[`href`],qt={class:`px-2.5 py-1.5 text-right`},Jt={class:`px-2.5 py-1.5 text-right`},Yt={class:`w-2/5 px-2.5 py-1.5`},Xt={key:2,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Zt={open:``},Qt={class:`mt-2.5 overflow-x-auto`},$t={class:`data w-full min-w-[38rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},en=[`title`],tn={key:0,class:`text-xs text-dimmed`},nn={key:1,class:`text-xs text-dimmed`},rn={class:`border-b border-muted px-2.5 py-1.5 text-right font-medium`},an={class:`text-xs text-muted`},on={class:`rounded bg-accented px-1 py-0.5`},sn={class:`border-t border-default pt-3.5 text-xs text-dimmed`},cn={class:`mt-2 grid gap-1.5`},ln=[`href`],un={key:2},dn=[`href`],fn={key:2},pn=[`href`],mn=[`href`],hn={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},gn={key:0,class:`flex items-center gap-1`,"aria-label":`Cost groups`},_n={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},vn={class:`mb-5 grid gap-2 rounded-lg border border-default bg-elevated px-5 py-4`},yn={class:`flex flex-wrap items-center gap-x-3 gap-y-1`},bn={class:`font-mono text-xs tabular-nums text-muted`,"data-snapshot-status":``},xn=[`disabled`],Sn={key:1,class:`text-xs text-error`,role:`status`,"data-snapshot-error":``},Cn=o({__name:`CostsPage`,setup(o){let c=x(`costs`),f=S(c?.report??null),g=w(()=>c?.groups??[]),T=w(()=>c?.group??f.value?.group??``),E=S(c?.snapshot??null),D=te(void 0,6e4),k=w(()=>E.value?j(E.value,D.value):``),A=w(()=>c?.view??`daily`),M=S(c&&c.view!==`daily`?c.by??null:null),N=[{view:`daily`,tab:`Daily`,subtitle:``},{view:`users`,tab:`By user`,subtitle:`Who started the runs · LLM from their tokens through the price table · cloud allocated by wall-clock`},{view:`threads`,tab:`By thread`,subtitle:`The thread each run ran in · LLM from its tokens through the price table · cloud allocated by wall-clock`},{view:`channels`,tab:`By channel`,subtitle:`The channel each run ran in · LLM from its tokens through the price table · cloud allocated by wall-clock`},{view:`agents`,tab:`By agent`,subtitle:`The agent each run ran on · LLM from its tokens through the price table · cloud allocated by wall-clock`},{view:`models`,tab:`By model`,subtitle:`The model each turn ran on · LLM from its tokens through the price table · cloud is not split by model`}],F=w(()=>N.find(e=>e.view===A.value)??N[0]),ie=w(()=>c?.canSnapshot===!0),L=w(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`days`)),R=e=>`/costs/${T.value}${e}${L.value?`?days=${L.value}`:``}`,z=c?.snapshot?.snapshot?.takenAt??null,B=z,V=null;async function ce(){try{let[e,t]=await Promise.all([fetch(R(`.json`),{credentials:`same-origin`}),A.value===`daily`?Promise.resolve(null):fetch(R(`/${A.value}.json`),{credentials:`same-origin`})]);return e.ok?(f.value=await e.json(),t?.ok&&(M.value=await t.json()),!0):!1}catch{return!1}}function le(){if(V||B===null||B===z)return;let e=B;V=ce().then(t=>{t&&(z=e)}).finally(()=>{V=null,B!==e&&le()})}function de(e){E.value=e;let t=e.snapshot?.takenAt??null;t&&(B=t,le())}let pe=ee(),H=null;h(()=>{T.value&&(H=pe(`/costs/${T.value}?stream=1`),H.onmessage=e=>{let t=ne(e.data);t&&de(t)})}),_(()=>H?.close());let U=S(!1),W=S(``);async function G(){U.value=!0,W.value=``;let e=await O(fetch,`costs.snapshot`,{});e.ok||(W.value=e.failure.message),U.value=!1}function K(e,t,n){let r=[`days=${t}`];return n!==`daily`&&r.push(`view=${n}`),`/costs/${e}?${r.join(`&`)}`}let q=w(()=>f.value?re(f.value):[]),J=w(()=>f.value?ae(f.value):null),me=w(()=>f.value?ue(f.value):[]),Y=w(()=>f.value?oe(f.value):null),he=w(()=>f.value?se(f.value):``);function X(e){let t=Y.value;if(t){if(/^(Memory|vCPU|Disk)/.test(e))return t.containers;if(e.startsWith(`Durable Object`))return t.durableObjects;if(e.startsWith(`Workers`))return t.workers;if(e.startsWith(`R2`))return t.r2;if(e.startsWith(`Workflow`))return t.workflows}}function ge(e){let t=Y.value;if(t)return e===`LLM (Anthropic)`?t.anthropic:e===`Durable Objects`?t.durableObjects:e===`Workers · storage · R2`?t.workers:t.containers}let _e=w(()=>{let e=f.value,t=J.value;if(!e||!t)return``;let n=t.projection,r=`cloud ${P(n.cloudRate)}/day`,i=n.cloudBasis===`today`?`cloud from today so far`:`cloud from the last 7 full days`;if(!e.llmAvailable)return`${r} × 30.4 · ${i} · before plan fees and included allowances`;let a=`LLM ${P(n.llmRate)}/day`,o=n.llmBasis===`closed-days`?`LLM from ${n.llmClosedDays} closed day${n.llmClosedDays===1?``:`s`}`:n.llmBasis===`today`?`LLM from today so far`:`no LLM spend in range`;return`${r} + ${a} · × 30.4 · ${n.cloudBasis===`today`&&n.llmBasis===`today`?`both from today so far`:`${i} · ${o}`}`}),ve=w(()=>f.value?[...f.value.days].reverse():[]),ye=[1,7,30],Z=e=>e===1?`today`:`${e}d`,Q=w(()=>{let e=f.value,t=J.value;if(!e||!t)return``;if(!e.llmAvailable)return`LLM spend not configured`;let n=[];return t.llm.yesterday!==void 0&&n.push(`yesterday ${P(t.llm.yesterday)}`),t.llm.today&&n.push(`today ${P(t.llm.today.usd)}${t.llm.today.estimated?` (estimate)`:``}`),n.length?n.join(` · `):`in range`});function $(e){let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:`${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getUTCMonth()]} ${t.getUTCDate()}`}return(o,c)=>{let h=u(`RouterLink`);return f.value&&J.value?(p(),C(e,{key:0,title:`${f.value.label} spend`,nav:`costs`},{default:d(()=>[m(`div`,Qe,[m(`nav`,$e,[(p(),n(b,null,r(ye,e=>(p(),n(b,{key:e},[e===f.value.range.days?(p(),n(`span`,et,a(Z(e)),1)):(p(),C(h,{key:1,class:`rounded-md px-2.5 py-1 font-mono text-xs tabular-nums text-muted no-underline hover:bg-elevated hover:text-highlighted`,to:K(f.value.group,e,A.value)},{default:d(()=>[y(a(Z(e)),1)]),_:2},1032,[`to`]))],64))),64))]),g.value.length>1?(p(),n(`nav`,tt,[(p(!0),n(b,null,r(g.value,e=>(p(),n(b,{key:e},[e===f.value.group?(p(),n(`span`,nt,a(e),1)):(p(),C(h,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,to:K(e,f.value.range.days,A.value)},{default:d(()=>[y(a(e),1)]),_:2},1032,[`to`]))],64))),128))])):l(``,!0),m(`p`,rt,[y(a($(f.value.range.from))+` → `+a($(f.value.range.to))+` · `+a(f.value.range.days)+`d`,1),f.value.range.partialLastDay?(p(),n(b,{key:0},[y(` · today partial`)],64)):l(``,!0)]),k.value?(p(),n(`div`,it,[m(`p`,at,a(k.value),1),ie.value?(p(),n(`button`,{key:0,type:`button`,class:`rounded-md border border-default px-2 py-0.5 text-xs text-muted hover:bg-elevated hover:text-highlighted disabled:cursor-not-allowed disabled:opacity-60`,disabled:U.value||E.value?.inFlight!==null,"data-snapshot-now":``,onClick:G},a(E.value?.inFlight?`Taking…`:`Snapshot now`),9,ot)):l(``,!0),W.value?(p(),n(`span`,st,a(W.value),1)):l(``,!0)])):l(``,!0)]),m(`section`,ct,[J.value.yesterday?(p(),n(`div`,lt,[c[0]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Yesterday`,-1),m(`span`,ut,a(v(P)(J.value.yesterday.total)),1),m(`span`,dt,a(J.value.yesterday.date)+` · last full day`,1)])):(p(),n(`div`,ft,[c[1]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Today so far`,-1),m(`span`,pt,a(J.value.today?v(P)(J.value.today.total):`—`),1),m(`span`,mt,a(J.value.today?`${J.value.today.date} · partial day, UTC`:`no day in range`),1)])),m(`div`,ht,[c[2]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`7-day average`,-1),m(`span`,gt,a(J.value.avg7===void 0?`—`:v(P)(J.value.avg7)),1),m(`span`,_t,a(J.value.avg7===void 0?`no full day yet in this range`:`per day, full days only`),1)]),m(`div`,vt,[c[3]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Projected month`,-1),m(`span`,yt,a(v(P)(J.value.projection.monthUsd,0)),1),m(`span`,bt,a(_e.value),1)]),m(`div`,xt,[c[4]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`LLM spend`,-1),m(`span`,St,a(f.value.llmAvailable?v(P)(J.value.llm.range):`—`),1),m(`span`,Ct,a(Q.value),1)]),m(`div`,wt,[c[6]||=m(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Share of account`,-1),m(`span`,Tt,a(J.value.accountShare)+`%`,1),m(`span`,Et,[y(a(v(P)(f.value.totals.cloudUsd))+` of `+a(v(P)(f.value.account.cloudUsd))+` on `,1),Y.value?(p(),n(`a`,{key:0,class:`text-primary hover:underline`,href:Y.value.account,target:`_blank`,rel:`noopener noreferrer`,title:`Cloudflare account ${f.value.account.id}`},a(he.value),9,Dt)):l(``,!0),c[5]||=y(` · Cloudflare spend in range · `,-1),Y.value?(p(),n(`a`,{key:1,class:`text-primary hover:underline`,href:Y.value.billing,target:`_blank`,rel:`noopener noreferrer`},`billing`,8,Ot)):l(``,!0)])])]),m(`section`,kt,[m(`div`,At,[c[7]||=m(`div`,null,[m(`h2`,{class:`text-[0.9375rem] font-medium`},`Daily cost`),m(`p`,{class:`text-sm text-muted`},`Stacked by component · USD list price`)],-1),m(`div`,jt,[(p(!0),n(b,null,r(q.value,(e,t)=>(p(),n(`a`,{key:e,class:`inline-flex items-center gap-1.5 no-underline hover:text-highlighted hover:underline`,href:ge(e),target:`_blank`,rel:`noopener noreferrer`,title:`Open where ${e} is billed`},[m(`i`,{class:s([`inline-block size-2.5 rounded-xs`,v(fe)[t%v(fe).length]])},null,2),y(a(e),1)],8,Mt))),128))])]),t(be,{report:f.value,series:q.value},null,8,[`report`,`series`]),f.value.llmAvailable?f.value.days.some(e=>e.llmEstimated)?(p(),n(`p`,Pt,[c[9]||=y(` A day the Anthropic cost report has not closed yet (today, and yesterday until a few hours after midnight UTC) shows its LLM figure as an estimate: the hourly usage report priced at list. The closed days are the cost report itself. `,-1),f.value.days.some(e=>e.llmUnpricedTokens>0)?(p(),n(b,{key:0},[y(` Some tokens ran under a model this page has no price for and are not in the estimate. `)],64)):l(``,!0)])):l(``,!0):(p(),n(`p`,Nt,[...c[8]||=[y(` LLM spend not configured — set `,-1),m(`code`,null,`ANTHROPIC_ADMIN_KEY`,-1),y(` and the group's `,-1),m(`code`,null,`anthropicWorkspaceId`,-1),y(` to layer it in. `,-1)]]))]),m(`nav`,Ft,[(p(),n(b,null,r(N,e=>(p(),n(b,{key:e.view},[e.view===A.value?(p(),n(`span`,It,a(e.tab),1)):(p(),C(h,{key:1,class:`-mb-px border-b-2 border-transparent px-3 py-1.5 text-sm text-muted no-underline hover:border-muted hover:text-highlighted`,to:K(f.value.group,f.value.range.days,e.view)},{default:d(()=>[y(a(e.tab),1)]),_:2},1032,[`to`]))],64))),64))]),A.value===`daily`?l(``,!0):(p(),n(`section`,Lt,[m(`div`,null,[m(`h2`,Rt,`Cost `+a(F.value.tab.toLowerCase()),1),m(`p`,zt,a(F.value.subtitle),1)]),M.value?(p(),C(Ze,{key:0,report:M.value},null,8,[`report`])):(p(),n(`p`,Bt,` The `+a(F.value.tab.toLowerCase())+` report did not load with this page. `,1)),m(`p`,Vt,[c[10]||=y(` Machine-readable twin: `,-1),m(`code`,Ht,`GET /costs/`+a(f.value.group)+`/`+a(A.value)+`.json`,1),c[11]||=y(` (same Access gate). `,-1)])])),A.value===`daily`?(p(),n(`section`,Ut,[c[12]||=m(`div`,null,[m(`h2`,{class:`text-[0.9375rem] font-medium`},`What each cloud dollar buys`)],-1),m(`table`,Wt,[m(`tbody`,null,[(p(!0),n(b,null,r(me.value,e=>(p(),n(`tr`,{key:e.label,class:`border-b border-muted`},[m(`td`,Gt,[X(e.label)?(p(),n(`a`,{key:0,class:`no-underline hover:text-highlighted hover:underline`,href:X(e.label),target:`_blank`,rel:`noopener noreferrer`,title:`Open where this is billed on Cloudflare`},a(e.label),9,Kt)):(p(),n(b,{key:1},[y(a(e.label),1)],64))]),m(`td`,qt,a(v(P)(e.usd)),1),m(`td`,Jt,a(Math.round(e.percent))+`%`,1),m(`td`,Yt,[m(`i`,{class:`block h-2.5 rounded-xs bg-primary opacity-75`,style:i({width:`${e.percent.toFixed(1)}%`})},null,4)])]))),128))])])])):l(``,!0),A.value===`daily`?(p(),n(`section`,Xt,[m(`details`,Zt,[c[15]||=m(`summary`,{class:`cursor-pointer text-sm text-muted`},`Table view — daily cost by component (USD)`,-1),m(`div`,Qt,[m(`table`,$t,[m(`thead`,null,[m(`tr`,null,[c[13]||=m(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-left text-xs font-medium text-muted`},` Date `,-1),(p(!0),n(b,null,r(q.value,e=>(p(),n(`th`,{key:e,class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},a(e),1))),128)),c[14]||=m(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},` Total `,-1)])]),m(`tbody`,null,[(p(!0),n(b,null,r(ve.value,e=>(p(),n(`tr`,{key:e.date},[m(`td`,{class:`border-b border-muted px-2.5 py-1.5`,title:e.date},[y(a($(e.date))+` `,1),f.value.range.partialLastDay&&e.date===f.value.range.to?(p(),n(`span`,tn,`(partial day`+a(e.llmEstimated?` · LLM estimated`:``)+`)`,1)):e.llmEstimated?(p(),n(`span`,nn,`(LLM estimated)`)):l(``,!0)],8,en),(p(!0),n(b,null,r(q.value,t=>(p(),n(`td`,{key:t,class:`border-b border-muted px-2.5 py-1.5 text-right`},a(v(P)(v(I)(e,t),3)),1))),128)),m(`td`,rn,a(v(P)(e.total,3)),1)]))),128))])])])]),m(`p`,an,[c[16]||=y(` Machine-readable twin: `,-1),m(`code`,on,`GET /costs/`+a(f.value.group)+`.json`,1),c[17]||=y(` (same Access gate). `,-1)])])):l(``,!0),m(`footer`,sn,[m(`details`,null,[c[25]||=m(`summary`,{class:`cursor-pointer text-muted`},`How these numbers are computed`,-1),m(`div`,cn,[c[23]||=m(`div`,null,[m(`b`,null,`Snapshot.`),y(` Both billing sources and the run history are read once over the widest range this page offers and kept as a snapshot; every figure here, the JSON twins and the dimension tabs are arithmetic over it, with `),m(`em`,null,`today`),y(` the day it was taken. The line under the range says when that was, how old it is and when the next one is due (`),m(`code`,null,`costs.snapshot.everyHours`),y(`, daily by default); `),m(`code`,null,`costs snapshot`),y(` takes one now. Cloudflare bills vCPU on active use only; memory and disk bill on the provisioned size for every second a container is awake. LLM spend is the Anthropic Admin API cost report for this group's workspace (gross, USD); a day the cost report has not closed is the Admin API usage report, hourly, priced at Anthropic list per model (input, output, cache writes, cache reads) and marked as an estimate. `)],-1),c[24]||=m(`div`,null,[m(`b`,null,`Method.`),y(` Cloudflare GraphQL Analytics, every meter a Workers deployment is billed on: `),m(`code`,null,`containersUsageAdaptiveGroups`),y(` (cpuTimeSec, allocatedMemory, allocatedDisk per app per UTC day), `),m(`code`,null,`durableObjectsPeriodicGroups`),y(` (billable `),m(`code`,null,`duration`),y(` GB-s and SQLite rows read and written per namespace), `),m(`code`,null,`durableObjectsInvocationsAdaptiveGroups`),y(` (requests per namespace), `),m(`code`,null,`durableObjectsSqlStorageGroups`),y(` (bytes stored), `),m(`code`,null,`workersInvocationsAdaptive`),y(` (requests, CPU time), `),m(`code`,null,`r2StorageAdaptiveGroups`),y(` and `),m(`code`,null,`r2OperationsAdaptiveGroups`),y(` (bytes stored, class A/B operations). Prices: vCPU $0.000020/s, memory $0.0000025/GiB-s, disk $0.00000007/GB-s, DO duration $12.50 per million GB-s, DO requests $0.15/M, SQLite rows $0.001/M read and $1.00/M written, DO storage $0.20/GB-month, Workers $0.30/M requests and $0.02/M CPU-ms, R2 $0.015/GB-month, $4.50/M class A and $0.36/M class B (deletes free). Storage is the day's peak, prorated over a 30.44-day month. Gross list price — plan fees and included allowances are not subtracted; Workers Logs volume has no analytics dataset and is not priced. `)],-1),m(`div`,null,[c[18]||=m(`b`,null,`Scope.`,-1),c[19]||=y(` Attributed to this group: the Workers `,-1),(p(!0),n(b,null,r(f.value.attribution.workers,(e,t)=>(p(),n(b,{key:e},[t>0?(p(),n(b,{key:0},[y(`, `)],64)):l(``,!0),Y.value?(p(),n(`a`,{key:1,class:`font-mono hover:underline`,href:Y.value.worker(e),target:`_blank`,rel:`noopener noreferrer`},a(e),9,ln)):(p(),n(`code`,un,a(e),1))],64))),128)),y(`, every Durable Object namespace they host (`+a(Object.keys(f.value.attribution.durableObjectNamespaces).length)+`), the R2 buckets named after them (`,1),(p(!0),n(b,null,r(Object.keys(f.value.attribution.r2Buckets),(e,t)=>(p(),n(b,{key:e},[t>0?(p(),n(b,{key:0},[y(`, `)],64)):l(``,!0),Y.value?(p(),n(`a`,{key:1,class:`font-mono hover:underline`,href:Y.value.bucket(e),target:`_blank`,rel:`noopener noreferrer`},a(e),9,dn)):(p(),n(`code`,fn,a(e),1))],64))),128)),Object.keys(f.value.attribution.r2Buckets).length===0?(p(),n(b,{key:0},[y(`none`)],64)):l(``,!0),c[20]||=y(`), and the container apps mapped in `,-1),m(`code`,null,`costs.groups.`+a(f.value.group),1),y(` (`+a(Object.keys(f.value.attribution.containerApps).length)+`). Everything else in the account is priced the same way into the account total, which is what "share of account" divides by. Every figure above links to where it is billed: the `,1),Y.value?(p(),n(`a`,{key:1,class:`hover:underline`,href:Y.value.account,target:`_blank`,rel:`noopener noreferrer`},`Cloudflare dashboard`,8,pn)):l(``,!0),c[21]||=y(` for the account `,-1),m(`code`,null,a(f.value.account.id),1),y(a(f.value.account.name?` (${f.value.account.name})`:``)+`, and `,1),Y.value?(p(),n(`a`,{key:2,class:`hover:underline`,href:Y.value.anthropic,target:`_blank`,rel:`noopener noreferrer`},`Anthropic's cost page`,8,mn)):l(``,!0),c[22]||=y(` for the LLM line. `,-1)])])])])]),_:1},8,[`title`])):(p(),C(e,{key:1,title:`${T.value} spend`,nav:`costs`},{default:d(()=>[m(`div`,hn,[g.value.length>1?(p(),n(`nav`,gn,[(p(!0),n(b,null,r(g.value,e=>(p(),n(b,{key:e},[e===T.value?(p(),n(`span`,_n,a(e),1)):(p(),C(h,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,to:`/costs/${e}`},{default:d(()=>[y(a(e),1)]),_:2},1032,[`to`]))],64))),128))])):l(``,!0)]),m(`section`,vn,[c[26]||=m(`h2`,{class:`text-sm font-medium text-highlighted`},`Nothing to show yet`,-1),m(`div`,yn,[m(`p`,bn,a(k.value),1),ie.value?(p(),n(`button`,{key:0,type:`button`,class:`rounded-md border border-default px-2 py-0.5 text-xs text-muted hover:bg-elevated hover:text-highlighted disabled:cursor-not-allowed disabled:opacity-60`,disabled:U.value||E.value?.inFlight!==null,"data-snapshot-now":``,onClick:G},a(E.value?.inFlight?`Taking…`:`Snapshot now`),9,xn)):l(``,!0),W.value?(p(),n(`span`,Sn,a(W.value),1)):l(``,!0)]),c[27]||=m(`p`,{class:`text-xs text-dimmed`},[y(` The page prices a stored snapshot of both billing sources, never a live read; the figures appear here the moment the first one lands (this page listens for it), or take one now with `),m(`code`,null,`costs snapshot`),y(`. `)],-1)])]),_:1},8,[`title`]))}}});export{Cn as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./AppShell-DAtHiuI6.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 f,Qr as p,Sn as m,Tr as h,Xr as g,_r as _,bn as v,c as y,dr as ee,en as b,hr as x,ir as S,ji as C,kn as w,l as te,ln as T,o as E,rn as D,sr as O,t as k,wr as A,xi as j,xn as M,y as N,yi as P,yn as F,yr as I}from"./browser-B6T5hjfR.js";import{t as L}from"./Tooltip-tZoum_T-.js";import{i as R,n as ne,r as re,t as z}from"./PendingTurnRow-ChCQOLgZ.js";import{b as ie,x as ae}from"./main-5Gm_1Gv8.js";import{t as oe}from"./eventSource-Bj_dZf6M.js";import{t as B}from"./wallClock-DmaC1sKA.js";import{n as V,r as se,t as H}from"./indexFormat-B-pd4r7Y.js";import{C as ce,H as le,a as ue,i as de,t as fe,z as pe}from"./indexRow-BT0cPVRw.js";import{i as me}from"./format-BldUwl_R.js";import{i as he,n as U,t as W}from"./durationTone-U_rOqo6r.js";import{T as ge,a as _e,c as G,d as ve,i as ye,n as be,o as xe,s as Se,t as K,u as q,v as Ce}from"./sseReplay-DmyMXfRC.js";var J=`To run this:`;function we(e,t){return e?t.trim()===``?`stop`:`steer`:`send`}var Te=`↪ Folded into`;function Ee(e){let t=e.trim();return t.startsWith(`To run this:`)?{kind:`handBack`,command:t.slice(J.length).trim()}:t.startsWith(Te)?{kind:`steerAck`,text:t}:{kind:`inline`,text:t}}function De(e){let t=/^\/runs\/([^/?#]+)(\?t=([^&#]+))?$/.exec(e);if(!t)return null;let n=decodeURIComponent(t[1]),r=t[3]?`?t=${t[3]}`:``;return{id:n,eventsUrl:`/runs/${t[1]}/events${r}`,stopUrl:`/runs/${t[1]}/stop${r}`}}function Y(e,t=60){let n=e.split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``;return n.length<=t?n||`New conversation`:`${n.slice(0,t-1).trimEnd()}…`}function Oe(e,t){let n=t-e;if(!(n>45e3))return`now`;let r=Math.floor(n/6e4);if(r<60)return`${Math.max(1,r)}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<7?`${a}d`:V(e,t)}function ke(e,t){let n=e.surface??`web`,r=de[n]??n,i=e.channelName?`${r} #${e.channelName}`:r;return{title:e.excerpt||e.title,when:H(e.lastAt,t),source:n===`web`?r:`${i} · read-only here`,runs:`${e.runs} run${e.runs===1?``:`s`}`,live:e.live}}var X={min:224,default:288,max:448,step:16};function Ae(e){let t=typeof e==`string`?Number(e):e;return typeof t!=`number`||!Number.isFinite(t)?X.default:Math.min(X.max,Math.max(X.min,Math.round(t)))}var Z={width:`sb.rail.width`,collapsed:`sb.rail.collapsed`};function je(e){return{width:Ae(e.width??void 0),collapsed:e.collapsed===`1`}}function Me(e,t){let n=e<5?`Still up`:e<12?`Good morning`:e<18?`Good afternoon`:`Good evening`;return t?`${n}, ${t}.`:`${n}.`}function Ne(e,t){let n=t.trim();for(let t=e.length-1;t>=0;t--){let r=e[t];if(!r.folded&&r.text.trim()===n)return r}return null}function Pe(e,t=60){return e<=t}function Fe(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}function Ie(e,t){let n=e.trim().toLowerCase();if(n===``)return 0;let r=t.toLowerCase(),i=0,a=-1,o=-1;for(let e of n){if(e===` `)continue;let t=r.indexOf(e,i);if(t===-1)return null;a===-1&&(a=t),o=t,i=t+1}return a===-1?0:o-a}function Le(e,t){return t.trim()===``?[...e]:e.map((e,n)=>({row:e,i:n,score:Ie(t,e.title)})).filter(e=>e.score!==null).sort((e,t)=>e.score-t.score||e.i-t.i).map(e=>e.row)}function Re(e){if(!(e.metaKey||e.ctrlKey))return null;let t=e.key.toLowerCase();return t===`o`&&e.shiftKey?`newThread`:t===`k`&&!e.shiftKey?`search`:null}function ze(e,t){return t?``:e===`steer`?`Say what to add — it folds into the run at its next step`:e===`stop`?`A run is working — type to steer it, or stop it`:`Review a pull request, ship a fix, investigate a run… or type / for a command`}function Q(e){let t=new Map;for(let n of e){let[e,r]=n.chat.split(` `,2);if(!e)continue;let i=t.get(e)??{name:e,verbs:[]};r===void 0?i.bare=n:i.verbs.push({verb:r,command:n}),t.set(e,i)}return[...t.values()]}function Be(e,t,n){if(t===``)return[...e];let r=t.toLowerCase(),i=e.filter(e=>n(e)[0].toLowerCase().startsWith(r));return i.length>0?i:e.map((e,r)=>{let i=n(e).map(e=>Ie(t,e)).filter(e=>e!==null);return i.length===0?null:{item:e,i:r,score:Math.min(...i)}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score||e.i-t.i).map(e=>e.item)}function Ve(e,t=0,n=new Set){let r=(e.args??[]).slice(t),i=(e.options??[]).filter(e=>!n.has(He(e.form))).map(e=>`[${e.form}]`);return[...r,...i].join(` `)}var He=e=>e.split(` `,1)[0];function Ue(e,t){let n=new Set,r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.startsWith(`-`)){n.add(a);let t=(e.options??[]).find(e=>He(e.form)===a);t&&t.form.includes(` `)&&i++}else r++}return{positionals:r,flags:n}}function We(e,t){let n=/^\/([^\n]*)$/.exec(e);if(!n||t.length===0)return null;let r=n[1].split(` `),i=r[r.length-1],a=r.slice(0,-1).filter(e=>e!==``),o=e.slice(0,e.length-i.length),s=Q(t);if(a.length===0)return{level:`group`,head:o,partial:i,rows:Be(s,i,e=>[e.name,...e.bare?[e.bare.describe]:[],...e.verbs.map(e=>e.command.describe)]).map(e=>({insert:e.name,label:`/${e.name}`,describe:e.bare?e.verbs.length>0?`${e.bare.describe} · also ${e.verbs.map(e=>e.verb).join(`, `)}`:e.bare.describe:e.verbs.map(e=>e.verb).join(` · `),kind:e.bare&&e.verbs.length===0?`command`:`group`,acceptable:!0}))};let c=s.find(e=>e.name===a[0]);if(!c)return null;if(a.length===1){let e=Be(c.verbs,i,e=>[e.verb,e.command.describe]);if(e.length===0&&c.bare&&i!==``)return Ke(c.bare,o,i,[]);if(e.length===0&&!c.bare)return{level:`verb`,head:o,partial:i,rows:[]};let t=e.map(e=>({insert:e.verb,label:`/${e.command.chat}`,describe:e.command.describe,kind:`command`,acceptable:!0}));return c.bare&&i===``&&t.unshift(Ge(c.bare,0,new Set)),{level:`verb`,head:o,partial:i,rows:t}}let l=c.verbs.find(e=>e.verb===a[1]);return l?Ke(l.command,o,i,a.slice(2)):c.bare?Ke(c.bare,o,i,a.slice(1)):null}function Ge(e,t,n){let r=Ve(e,t,n);return{insert:``,label:`/${e.chat}`,describe:r?`${r} — ${e.describe}`:e.describe,kind:`usage`,acceptable:!1}}function Ke(e,t,n,r){let i=Ue(e,r);return n.startsWith(`-`)?{level:`tail`,head:t,partial:n,rows:Be((e.options??[]).filter(e=>!i.flags.has(He(e.form))),n,e=>[He(e.form),e.describe]).map(e=>({insert:He(e.form),label:e.form,describe:e.describe,kind:`option`,acceptable:!0})),command:e}:{level:`tail`,head:t,partial:n,rows:[Ge(e,i.positionals,i.flags)],command:e}}function qe(e,t){let n=e.rows[t];if(!n)return null;if(n.acceptable){if(!n.insert.toLowerCase().startsWith(e.partial.toLowerCase()))return null;let t=n.insert.slice(e.partial.length);return t===``?null:{text:t,acceptable:!0}}if(e.partial!==``||n.kind!==`usage`)return null;let[r,...i]=n.describe.split(` — `);return i.length===0?null:{text:r,acceptable:!1}}function $(e,t){return`${e.head}${t.insert} `}function Je(e,t){if(!e.startsWith(`/`))return e;let n=e.slice(1),[r,i]=n.split(/\s+/,2);return t.some(e=>e.chat===r||i!==void 0&&e.chat===`${r} ${i}`)?n:e}var Ye={class:`composer-wrap relative`},Xe={key:0,class:`palette absolute bottom-full left-0 right-0 z-20 mb-2 max-h-72 overflow-y-auto rounded-xl border border-default bg-(--ui-bg-elevated) p-1 shadow-sm`,role:`listbox`,"aria-label":`Commands`,"data-testid":`palette`},Ze={key:0,class:`px-3 py-2 font-mono text-xs text-dimmed`},Qe=[`aria-selected`,`data-insert`,`data-kind`,`data-label`,`onClick`,`onMouseenter`],$e={class:`chat shrink-0 font-mono text-[0.8rem] font-medium text-highlighted`},et={class:`describe min-w-0 flex-1 truncate text-[0.8rem] text-muted`},tt={key:0,class:`shrink-0 rounded border border-default px-1 font-mono text-[0.62rem] text-dimmed`,"aria-hidden":`true`},nt=[`data-mode`],rt={class:`relative min-w-0 flex-1`},it=[`data-acceptable`],at={class:`invisible`},ot={class:`text-dimmed`},st=[`rows`,`value`,`placeholder`,`autofocus`,`aria-expanded`],ct=[`aria-hidden`,`data-hint`,`data-shown`],lt=u({__name:`ChatComposer`,props:{modelValue:{},mode:{},hint:{},autofocus:{type:Boolean},sweepOnMount:{type:Boolean},commands:{}},emits:[`update:modelValue`,`submit`,`stop`],setup(e,{expose:t,emit:n}){let o=e,c=n,u=j(null),p=j(!1),h=j(!1),y=F(()=>Math.min(8,Math.max(1,o.modelValue.split(`
|
|
2
|
-
`).length))),b={send:{icon:`i-lucide-arrow-up`,label:`Send`},steer:{icon:`i-lucide-corner-down-right`,label:`Steer the run`},stop:{icon:`i-lucide-square`,label:`Stop the run`}},x=F(()=>b[o.mode]),C=F(()=>ze(o.mode,o.hint)),w=F(()=>o.hint?o.hint:o.mode===`steer`?`Enter folds this into the run in flight`:o.mode===`stop`?`A run is in flight · type to steer it, or stop it`:`Enter to send · Shift+Enter for a new line · / for a command`),E=F(()=>p.value||o.hint!==void 0||o.mode!==`send`),O=F(()=>We(o.modelValue,o.commands??[])),k=F(()=>O.value?.rows??[]),A=j(!1),P=j(0),I=F(()=>O.value!==null&&!A.value),L=F(()=>I.value&&O.value?qe(O.value,P.value):null);s(()=>`${O.value?.level??``}|${O.value?.head??``}`,()=>{A.value=!1,P.value=0}),s(k,e=>{P.value>=e.length&&(P.value=Math.max(0,e.length-1))});function R(e){O.value&&e.acceptable&&(c(`update:modelValue`,$(O.value,e)),B())}function ne(){let e=u.value;return!e||e.selectionStart===e.value.length&&e.selectionEnd===e.value.length}function re(e){c(`update:modelValue`,e.target.value)}function z(e){if(I.value){if(e.key===`ArrowDown`){e.preventDefault(),k.value.length>0&&(P.value=(P.value+1)%k.value.length);return}if(e.key===`ArrowUp`){e.preventDefault(),k.value.length>0&&(P.value=(P.value-1+k.value.length)%k.value.length);return}if(e.key===`Escape`){e.preventDefault(),A.value=!0;return}let t=k.value[P.value];if(e.key===`Tab`&&t?.acceptable){e.preventDefault(),R(t);return}if(e.key===`ArrowRight`&&L.value?.acceptable&&t&&ne()){e.preventDefault(),R(t);return}if(e.key===`Enter`&&!e.shiftKey&&t?.acceptable){e.preventDefault(),R(t);return}}Fe(e)&&(e.preventDefault(),ie())}function ie(){o.mode===`stop`?c(`stop`):o.modelValue.trim()!==``&&c(`submit`)}function ae(){h.value=!1,S().then(()=>{h.value=!0})}function oe(){p.value=!0,ae()}function B(){S().then(()=>{let e=u.value;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),document.activeElement===e&&!p.value&&oe())})}return s(()=>o.hint,e=>{e&&B()}),ee(()=>{o.autofocus&&B(),o.sweepOnMount&&ae()}),t({focus:B}),(t,n)=>{let o=N,s=te;return _(),i(`div`,Ye,[r(f,{name:`sb-rise`},{default:g(()=>[I.value?(_(),i(`div`,Xe,[k.value.length===0?(_(),i(`p`,Ze,` No command matches "`+l(e.modelValue)+`". `,1)):m(``,!0),(_(!0),i(T,null,a(k.value,(e,t)=>(_(),i(`button`,{key:e.label,type:`button`,role:`option`,class:d([`item flex w-full items-baseline gap-3 rounded-lg px-3 py-1.5 text-left transition-colors duration-150 ease-out`,t===P.value?`bg-(--ui-bg-accented)`:`hover:bg-(--ui-bg-muted)`]),"aria-selected":t===P.value?`true`:`false`,"data-insert":e.insert,"data-kind":e.kind,"data-label":e.label,onMousedown:n[0]||=D(()=>{},[`prevent`]),onClick:t=>R(e),onMouseenter:e=>P.value=t},[v(`span`,$e,l(e.label),1),v(`span`,et,l(e.describe),1),t===P.value&&e.acceptable?(_(),i(`kbd`,tt,`Tab`)):m(``,!0)],42,Qe))),128))])):m(``,!0)]),_:1}),v(`div`,{class:d([`ring relative rounded-2xl`,h.value?`ring-sweep`:``]),onAnimationend:n[2]||=e=>h.value=!1},[v(`form`,{class:d([`composer relative flex items-end gap-2 rounded-2xl border bg-default px-3 py-2 transition-colors duration-150 ease-out`,p.value?`border-primary`:`border-default hover:border-accented`]),"data-mode":e.mode,onSubmit:D(ie,[`prevent`])},[v(`div`,rt,[L.value?(_(),i(`div`,{key:0,class:`ghost composer-text pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap break-words`,"aria-hidden":`true`,"data-testid":`ghost`,"data-acceptable":L.value.acceptable?`1`:`0`},[v(`span`,at,l(e.modelValue),1),v(`span`,ot,l(L.value.text),1)],8,it)):m(``,!0),v(`textarea`,{ref_key:`box`,ref:u,class:`box composer-text relative block min-h-6 w-full resize-none bg-transparent text-highlighted outline-none placeholder:text-dimmed`,rows:y.value,value:e.modelValue,placeholder:C.value,autofocus:e.autofocus,"aria-label":`Message`,"aria-expanded":I.value?`true`:void 0,autocomplete:`off`,spellcheck:`true`,onInput:re,onKeydown:z,onFocus:oe,onBlur:n[1]||=e=>p.value=!1},null,40,st)]),r(s,{type:`submit`,class:`control shrink-0 rounded-full transition-transform duration-150 ease-out active:scale-95`,color:e.mode===`stop`?`neutral`:`primary`,variant:e.mode===`stop`?`outline`:`solid`,size:`sm`,"aria-label":x.value.label,title:x.value.label,disabled:e.mode===`send`&&e.modelValue.trim()===``,"data-mode":e.mode},{default:g(()=>[r(f,{name:`sb-fade`,mode:`out-in`},{default:g(()=>[(_(),M(o,{key:x.value.icon,name:x.value.icon,class:`size-4`,"aria-hidden":`true`},null,8,[`name`]))]),_:1})]),_:1},8,[`color`,`variant`,`aria-label`,`title`,`disabled`,`data-mode`])],42,nt)],34),v(`p`,{class:d([`hint mt-1.5 min-h-[1.1rem] select-none px-3 font-mono text-[0.7rem] text-dimmed transition-opacity duration-150 ease-out`,E.value?`opacity-100`:`opacity-0`]),"aria-hidden":E.value?void 0:`true`,"data-hint":e.hint?`handback`:e.mode,"data-shown":E.value?`1`:`0`},l(w.value),11,ct)])}}}),ut={class:`thread-tip flex max-w-xs flex-col gap-1 text-xs`},dt={class:`tip-title leading-snug text-highlighted`},ft={class:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 font-mono text-[0.68rem] text-muted`},pt={class:`tip-when tabular-nums`},mt={class:`tip-source inline-flex items-center gap-1`},ht={class:`tip-runs`},gt={key:0,class:`tip-live inline-flex items-center gap-1 text-toned`},_t=u({__name:`ThreadTip`,props:{row:{},now:{}},setup(e){let t=e,n=F(()=>ke(t.row,t.now));return(t,r)=>(_(),i(`div`,ut,[v(`p`,dt,l(n.value.title),1),v(`p`,ft,[v(`span`,pt,l(n.value.when),1),r[1]||=v(`span`,{"aria-hidden":`true`},`·`,-1),v(`span`,mt,[e.row.surface===`slack`?(_(),M(he,{key:0})):m(``,!0),w(l(n.value.source),1)]),r[2]||=v(`span`,{"aria-hidden":`true`},`·`,-1),v(`span`,ht,l(n.value.runs),1),n.value.live?(_(),i(`span`,gt,[...r[0]||=[v(`span`,{class:`size-1.5 rounded-full bg-ok`,"aria-hidden":`true`},null,-1),w(`live`,-1)]])):m(``,!0)])]))}}),vt={class:`rail flex flex-col gap-1 text-[0.8rem]`,"aria-label":`Recent threads`},yt={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`},bt={key:0,class:`rounded border border-default px-1 font-mono text-[0.65rem] text-dimmed`},xt={key:0,class:`empty px-3 py-1 text-xs text-dimmed`},St={key:1,class:`nomatch px-3 py-1 text-xs text-dimmed`},Ct={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`},wt={class:`title min-w-0 flex-1 truncate text-toned group-hover:text-highlighted group-aria-[current=page]:text-highlighted`},Tt={class:`when shrink-0 font-mono text-[0.7rem] tabular-nums text-dimmed`},Et={class:`retention px-3 pt-1 text-[0.7rem] leading-relaxed text-dimmed`},Dt={class:`model px-3 pt-2 text-[0.7rem] leading-relaxed text-dimmed`,"data-testid":`what-is-a-thread`},Ot=500,kt=u({__name:`ConversationRail`,props:{rows:{},current:{},now:{},retention:{}},setup(e,{expose:t}){let n=e,s=j(``),c=j(null),u=F(()=>Le(n.rows,s.value));function d(){c.value?.focus(),c.value?.select()}function f(e){e.key===`Escape`&&(s.value=``,c.value?.blur())}return t({focusFilter:d}),(t,n)=>{let d=N,y=h(`RouterLink`),ee=L;return _(),i(`nav`,vt,[r(y,{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:g(()=>[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]||=v(`span`,null,`New thread`,-1),n[2]||=v(`span`,{class:`kbd ml-auto flex gap-0.5 font-mono text-[0.65rem] opacity-70`,"aria-label":`shortcut shift command O`},[v(`kbd`,{class:`rounded border border-current/30 px-1`},`⇧`),v(`kbd`,{class:`rounded border border-current/30 px-1`},`⌘`),v(`kbd`,{class:`rounded border border-current/30 px-1`},`O`)],-1)]),_:1},8,[`aria-current`]),v(`label`,yt,[r(d,{name:`i-lucide-search`,class:`size-3.5 shrink-0 text-dimmed`,"aria-hidden":`true`}),p(v(`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:f},null,544),[[b,s.value]]),s.value?m(``,!0):(_(),i(`kbd`,bt,`⌘K`))]),n[8]||=v(`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?(_(),i(`p`,xt,`Nothing yet. Ask something.`)):u.value.length===0?(_(),i(`p`,St,`Nothing matches "`+l(s.value)+`".`,1)):m(``,!0),r(o,{name:`sb-rise`,tag:`div`,class:`rows flex flex-col gap-0.5`},{default:g(()=>[(_(!0),i(T,null,a(u.value,t=>(_(),i(`div`,{key:t.id},[r(ee,{"delay-duration":Ot,content:{side:`right`,sideOffset:12,align:`start`},ui:{content:`h-auto max-w-xs px-2.5 py-2`}},{content:g(()=>[r(_t,{row:t,now:e.now},null,8,[`row`,`now`])]),default:g(()=>[r(y,{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:g(()=>[n[3]||=v(`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?(_(),i(`span`,Ct)):m(``,!0),v(`span`,wt,l(t.title),1),v(`span`,Tt,l(C(Oe)(t.lastAt,e.now)),1)]),_:2},1032,[`to`,`aria-current`,`data-surface`])]),_:2},1024)]))),128))]),_:1}),r(y,{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:g(()=>[n[4]||=w(` 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}),v(`p`,Et,l(e.retention),1),v(`p`,Dt,[n[6]||=w(` A thread is a conversation; each message you send is a run. `,-1),r(y,{class:`text-muted hover:text-highlighted`,to:`/runs`},{default:g(()=>[...n[5]||=[w(`Runs`,-1)]]),_:1}),n[7]||=w(` lists every run across everyone's threads. `,-1)])])}}}),At={class:`empty mx-auto flex w-full max-w-2xl flex-col items-center gap-5 px-3 py-6 text-center`},jt={class:`flex flex-col gap-1.5`},Mt={class:`greeting sb-stagger text-xl font-medium tracking-tight text-highlighted`,style:{"--sb-i":`1`}},Nt={class:`sb-stagger w-full text-left`,style:{"--sb-i":`3`}},Pt={key:0,class:`chips flex flex-wrap justify-center gap-2`,"aria-label":`Suggestions`},Ft=[`onClick`],It=u({__name:`EmptyState`,props:{name:{},hour:{},suggestions:{}},emits:[`pick`],setup(e,{emit:n}){let o=n;return(n,s)=>(_(),i(`section`,At,[r(t,{draw:``,idle:``,class:`mark-lg sb-stagger text-highlighted`,style:{"font-size":`3.25rem`,"--sb-i":`0`}}),v(`div`,jt,[v(`h2`,Mt,l(C(Me)(e.hour,e.name)),1),s[0]||=v(`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)]),v(`div`,Nt,[A(n.$slots,`default`)]),e.suggestions.length>0?(_(),i(`ul`,Pt,[(_(!0),i(T,null,a(e.suggestions,(e,t)=>(_(),i(`li`,{key:e,class:`sb-stagger`,style:c({"--sb-i":t+4})},[v(`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,Ft)],4))),128))])):m(``,!0)]))}}),Lt=[`data-pending`],Rt={class:`meta flex items-baseline gap-2 pr-1 font-mono text-[0.7rem] text-dimmed`},zt={key:0,class:`failed text-bad`},Bt={key:0,class:`folded text-muted`},Vt=[`title`],Ht=u({__name:`PersonTurn`,props:{text:{},at:{},now:{},pending:{type:Boolean},folded:{},failed:{}},setup(e){let t=e,n=F(()=>H(t.at,t.now));return(t,a)=>(_(),i(`div`,{class:`turn person flex flex-col items-end gap-1`,"data-pending":e.pending?`1`:void 0},[v(`div`,{class:d([`bubble max-w-[min(42rem,88%)] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-(--ui-bg-accented) px-4 py-2.5 text-[0.875rem] leading-normal text-highlighted transition-opacity duration-150 ease-out`,e.pending?`opacity-70`:``])},l(e.text),3),v(`div`,Rt,[e.failed?(_(),i(`span`,zt,l(e.failed),1)):m(``,!0),r(f,{name:`sb-fade`},{default:g(()=>[e.folded?(_(),i(`span`,Bt,`↪ folded in `+l(e.folded),1)):m(``,!0)]),_:1}),v(`span`,{class:`ts select-none`,title:C(me)(e.at)},l(n.value),9,Vt)])],8,Lt))}}),Ut=[`title`],Wt={class:`preset font-medium`},Gt={class:`reason truncate font-normal opacity-80`},Kt=u({__name:`ReceiptChip`,props:{route:{}},setup(e){let t=e,n=F(()=>fe[ue(t.route.preset)]);return(t,r)=>(_(),i(`span`,{class:d([`receipt inline-flex max-w-full items-baseline gap-1.5 rounded border px-1.5 py-px font-mono text-[0.7rem] leading-relaxed`,n.value]),title:`routed: ${e.route.reason}`,"data-testid":`receipt`},[v(`span`,Wt,l(e.route.preset),1),v(`span`,Gt,`· `+l(e.route.reason),1)],10,Ut))}}),qt=[`data-phase`,`data-run-id`,`data-live`],Jt={class:`head flex flex-wrap items-baseline gap-2 font-mono text-[0.7rem] text-dimmed`},Yt={key:0,class:`model`},Xt={key:1,class:`elapsed ml-auto tabular-nums`,"data-testid":`elapsed`},Zt={key:0,class:`disconnected flex items-baseline gap-2 rounded-lg border border-dashed border-bad/40 px-3 py-2 font-mono text-xs text-bad`,"data-testid":`disconnected`},Qt=[`open`],$t={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2 font-mono text-[0.7rem] text-dimmed hover:text-toned [&::-webkit-details-marker]:hidden`},en={class:`summary`},tn={class:`pl-1 pt-1`},nn={key:0,class:`py-2 font-mono text-xs text-dimmed`},rn={key:1,class:`py-2 font-mono text-xs text-warn`},an={key:2,class:`m-0 list-none p-0`},on={key:0,class:`reply`,"data-testid":`reply`},sn={key:1,class:`outcome font-mono text-xs text-warn`,"data-testid":`outcome`},cn={key:2,class:`facts flex flex-wrap items-baseline gap-x-3 font-mono text-[0.7rem] text-dimmed`},ln=u({__name:`AssistantTurn`,props:{turn:{},now:{},live:{},fetch:{}},emits:[`ended`,`input`,`stop`],setup(e,{emit:t}){let n=e,u=t,p=G();n.live?.serverNow&&p.seedClock(n.live.serverNow);let y=p.state,b=j(n.live?`connecting`:`ended`),S=j(n.turn.route??null),te=j(!0),E=F(()=>y.reply?.text??n.turn.answer??``),D=F(()=>y.meta?.agent??n.turn.agent??``),O=F(()=>{let e=y.meta?.model??n.turn.model;return e?ve(e):``}),k=F(()=>n.live!==null&&n.live!==void 0&&b.value!==`ended`),A=F(()=>b.value===`disconnected`),N=n.live?.serverNow?Se({startedAt:n.turn.startedAt,receivedAt:n.turn.receivedAt,serverNow:n.live.serverNow},n.now):null,P=n.now,L=j(void 0),R=F(()=>n.turn.finished&&n.turn.finishedAt!==void 0?Math.max(0,n.turn.finishedAt-(n.turn.receivedAt??n.turn.startedAt)):L.value===void 0?N?N.elapsedMs(n.now):Math.max(0,n.now-P):L.value),ie=F(()=>le(R.value,`clock`)),ae=F(()=>W(k.value?void 0:R.value,`run`)),B=F(()=>U(ae.value)),V=F(()=>k.value?Ce(y,n.now):null);I(xe,V),I(ye,null),I(_e,F(()=>y.reply!==null));let se=F(()=>k.value?q(y,p.pendingCall(),n.now):null),H=F(()=>{let e=se.value;return A.value||!e||e.kind===`call`?null:e.kind===`starting`?{verb:`Starting`,elapsedMs:R.value,slow:!1}:{verb:ne(e.elapsedMs),elapsedMs:e.elapsedMs,slow:e.slow}}),de=F(()=>y.log.filter(e=>e.kind===`step`)),me=F(()=>de.value.length>0?de.value.length:n.turn.stepCount??0),he=F(()=>n.turn.finished&&n.turn.status&&n.turn.status!==`completed`?ce(n.turn.status):``),J=F(()=>`/runs/${encodeURIComponent(n.turn.id)}`),we=oe(),Te=null;function Ee(e){let t=e;t.type===`route`&&typeof t.preset==`string`&&(S.value={preset:t.preset,reason:typeof t.reason==`string`?t.reason:``}),t.type===`input`&&typeof t.text==`string`&&(te.value?te.value=!1:u(`input`,t.text,t.at)),p.handle(e)}ee(()=>{n.live&&(u(`stop`,n.live.stopUrl),Te=re({url:n.live.eventsUrl,factory:we,model:p,handle:Ee,onFinished:e=>{L.value=N&&e?N.elapsedAt(e.finishedAt):R.value},onEnd:()=>{L.value??=R.value,u(`ended`)},onDisconnected:()=>{L.value??=R.value}}),s(Te.phase,e=>b.value=e,{immediate:!0}))}),x(()=>Te?.close());let De=j(n.live!==null&&n.live!==void 0),Y=j(n.live?`ready`:`none`);s(k,e=>{e||(De.value=!1)});async function Oe(e){if(De.value=e.target.open,!De.value||Y.value!==`none`)return;Y.value=`loading`;let t=n.fetch??((...e)=>globalThis.fetch(...e));try{let e=await t(`/runs/${encodeURIComponent(n.turn.id)}/events`,{credentials:`same-origin`});if(!e.ok)throw Error(`HTTP ${e.status}`);let r=K(await e.text()).filter(e=>e.type!==`replay_note`);for(let e of(n.turn.schema??0)>=2?pe(r):r)p.handle(e);p.closePhases(),Y.value=`ready`}catch{Y.value=`failed`}}let ke=F(()=>{let e=me.value;return e>0?`${e} step${e===1?``:`s`}`:k.value?`starting`:`no steps recorded`});return(t,n)=>{let s=h(`RouterLink`);return _(),i(`div`,{class:`turn assistant flex flex-col gap-2`,"data-phase":b.value,"data-run-id":e.turn.id,"data-live":k.value?`1`:void 0},[v(`div`,Jt,[r(f,{name:`sb-rise`},{default:g(()=>[S.value?(_(),M(Kt,{key:`receipt`,route:S.value},null,8,[`route`])):D.value?(_(),i(`span`,{key:`agent`,class:d([`agent rounded border px-1.5 py-px font-medium`,C(fe)[C(ue)(D.value)]])},l(D.value),3)):m(``,!0)]),_:1}),O.value?(_(),i(`span`,Yt,l(O.value),1)):m(``,!0),k.value?(_(),i(`span`,Xt,l(ie.value),1)):m(``,!0)]),r(f,{name:`sb-fade`},{default:g(()=>[k.value&&H.value?(_(),M(z,{key:0,tag:`div`,verb:H.value.verb,"elapsed-ms":H.value.elapsedMs,slow:H.value.slow,model:C(y).meta?.model??e.turn.model??null},null,8,[`verb`,`elapsed-ms`,`slow`,`model`])):m(``,!0)]),_:1}),A.value?(_(),i(`p`,Zt,[n[1]||=v(`span`,null,`stream disconnected · the run may still be working`,-1),r(s,{class:`ml-auto text-primary no-underline hover:underline`,to:J.value},{default:g(()=>[...n[0]||=[w(`open the run`,-1)]]),_:1},8,[`to`])])):m(``,!0),k.value||me.value>0||Y.value!==`none`?(_(),i(`details`,{key:1,class:`work group`,open:De.value,"data-testid":`work`,onToggle:Oe},[v(`summary`,$t,[n[2]||=v(`span`,{class:`chev select-none transition-transform duration-150 ease-out group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),v(`span`,en,l(ke.value),1)]),v(`div`,tn,[Y.value===`loading`?(_(),i(`p`,nn,`reading the run's record…`)):Y.value===`failed`?(_(),i(`p`,rn,[n[4]||=w(` the run's record could not be read — `,-1),r(s,{class:`text-primary no-underline hover:underline`,to:J.value},{default:g(()=>[...n[3]||=[w(`open the run`,-1)]]),_:1},8,[`to`])])):(_(),i(`ol`,an,[r(o,{name:`sb-rise`},{default:g(()=>[(_(!0),i(T,null,a(de.value,e=>(_(),M(be,{key:e.key,step:e,class:`mt-3 first:mt-0`,onToggleGroup:t=>C(p).toggleGroup(e)},null,8,[`step`,`onToggleGroup`]))),128))]),_:1})]))])],40,Qt)):m(``,!0),r(f,{name:`sb-rise`},{default:g(()=>[E.value?(_(),i(`div`,on,[r(ge,{text:E.value},null,8,[`text`])])):he.value?(_(),i(`p`,sn,l(he.value),1)):m(``,!0)]),_:1}),k.value?m(``,!0):(_(),i(`div`,cn,[v(`span`,{class:d([`dur tabular-nums`,B.value?`heat`:``]),style:c(B.value)},l(ie.value),7),r(s,{class:`open text-dimmed no-underline hover:text-primary hover:underline`,to:J.value},{default:g(()=>[...n[5]||=[w(`open run`,-1)]]),_:1},8,[`to`])]))],8,qt)}}}),un={class:`turn silent flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-1 font-mono text-[0.7rem] text-dimmed`,"data-testid":`silent-receipt`},dn={class:`reason text-muted`},fn=[`title`],pn=u({__name:`SilentTurn`,props:{reason:{},decidedAt:{},now:{}},setup(e){let t=e,n=F(()=>H(t.decidedAt,t.now));return(t,r)=>(_(),i(`div`,un,[r[0]||=v(`span`,{class:`glyph select-none`,"aria-hidden":`true`},`◌`,-1),r[1]||=v(`span`,{class:`label`},`Read, not answered`,-1),v(`span`,dn,`— `+l(e.reason),1),v(`span`,{class:`ts ml-auto select-none`,title:C(me)(e.decidedAt)},l(n.value),9,fn)]))}});function mn(){return{runs:new Map,connected:!1}}function hn(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 gn(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 _n(e,t){return t.includes(`:`)?t:`${e}:${t}`}function vn(e){let t=e.indexOf(`:`);return t>0?e.slice(0,t):`unknown`}function yn(e,t,n){if(!t.connected)return[...e];let r=gn(t),i=new Set,a=e.map(e=>{let t=_n(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?se(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:vn(r.channelId??e)})}return o.sort((e,t)=>t.lastAt-e.lastAt),[...o,...a]}var bn={key:0,class:`mx-auto my-12 max-w-xl text-center text-toned`},xn=[`data-rail`],Sn={key:0,class:`relative hidden md:block`},Cn=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`],wn={class:`thread mx-auto flex min-h-[calc(100vh-8rem)] w-full max-w-3xl flex-col`},Tn={key:3,class:`inline text-[0.875rem] text-toned`,"data-testid":`inline`},En={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`},Dn=[`href`],On={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`},kn=`(min-width: 48rem)`,An=u({__name:`HomePage`,setup(t){let u=E(`home`),p=B(u?.now),h=u?.conversation??``,b=y(u?.retentionDays??null),D=0,A=e=>`${e}-${++D}`,N=P([]);for(let e of u?.turns??[]){if(`kind`in e){N.push({key:A(`s`),kind:`silent`,reason:e.reason,at:e.decidedAt});continue}N.push({key:A(`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;N.push({key:A(`a`),kind:`assistant`,turn:e,live:t,ended:e.finished})}let L=F(()=>{for(let e=N.length-1;e>=0;e--){let t=N[e];if(t.kind===`assistant`&&t.live&&!t.ended&&t.turn.hosted!==!0)return t}return null}),ne=j(null),re=j(0);I(e,re);let z=j(``),V=j(void 0),se=F(()=>we(L.value!==null,z.value)),H=j(!1);s(z,()=>{V.value&&z.value===``&&(V.value=void 0)});function ce(e){z.value=e,ue()}async function ue(){if(!u||H.value)return;let e=Je(z.value.trim(),u.commands);if(e===``)return;let t=P({key:A(`p`),kind:`person`,text:e,at:p.value,pending:!0});N.push(t),z.value=``,V.value=void 0,H.value=!0,re.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=De(r.viewPath);if(!n)throw Error(`the run's view path was not one`);t.pending=!1,k.pathname()===`/threads`&&k.replaceUrl(`/threads/${encodeURIComponent(h)}`),N.push({key:A(`a`),kind:`assistant`,turn:{id:r.runId,request:e,startedAt:p.value,receivedAt:p.value,finished:!1,eventCount:0},live:{eventsUrl:n.eventsUrl,stopUrl:n.stopUrl},ended:!1});return}if(n.ok&&typeof r.reply==`string`){t.pending=!1;let e=Ee(r.reply);e.kind===`handBack`?(z.value=e.command,V.value=`Enter runs it`):e.kind===`inline`&&N.push({key:A(`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{H.value=!1}}function fe(){let e=ne.value;e&&fetch(`${e}${e.includes(`?`)?`&`:`?`}mode=soft`,{method:`POST`,credentials:`same-origin`})}function pe(e,t,n){let r=Ne(N.filter(e=>e.kind===`person`).map(e=>({text:e.text,folded:e.folded!==void 0,ref:e})),t);if(!r)return;let i=e.turn.receivedAt??e.turn.startedAt;r.ref.folded=n===void 0?``:`at ${le(Math.max(0,n-i),`clock`)}`}function me(e){e.ended=!0,ne.value=null}let he=je({width:k.readPref(Z.width),collapsed:k.readPref(Z.collapsed)}),U=j(he.width),W=j(he.collapsed),_e=j(!1),G=j(k.mediaMatches(kn)),ve=k.onMediaChange(kn,e=>{G.value=e}),ye=j(null),be=j(null),xe=F(()=>G.value?W.value?`Show recent threads`:`Hide recent threads`:`Recent threads`);function Se(){if(G.value=k.mediaMatches(kn),G.value){W.value=!W.value,k.writePref(Z.collapsed,W.value?`1`:`0`);return}_e.value=!0}function K(e,t){U.value=Ae(e),t&&k.writePref(Z.width,String(U.value))}let q=null;function Ce(e){q&&K(q.startWidth+(e.clientX-q.startX),!1)}function J(){window.removeEventListener(`pointermove`,Ce),q&&(q=null,k.writePref(Z.width,String(U.value)))}function Te(e){e.button===0&&(e.preventDefault(),q={startX:e.clientX,startWidth:U.value},e.currentTarget?.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,Ce),window.addEventListener(`pointerup`,J,{once:!0}))}function Oe(e){if(e.key===`ArrowRight`)K(U.value+X.step,!0);else if(e.key===`ArrowLeft`)K(U.value-X.step,!0);else if(e.key===`Home`)K(X.min,!0);else if(e.key===`End`)K(X.max,!0);else return;e.preventDefault()}O(()=>{window.removeEventListener(`pointermove`,Ce),window.removeEventListener(`pointerup`,J),ve()});function ke(e){let t=Re(e);if(t){if(e.preventDefault(),t===`newThread`){k.navigate(`/threads`);return}if(ye.value){ye.value.focusFilter();return}if(W.value&&k.mediaMatches(kn)){W.value=!1,k.writePref(Z.collapsed,`0`),S().then(()=>ye.value?.focusFilter());return}_e.value=!0,S().then(()=>be.value?.focusFilter())}}let Me=j(null),Fe=j(!1);function Ie(){return document.body.scrollHeight-(window.innerHeight+window.scrollY)}s(()=>N.length,()=>{let e=Pe(Ie());S().then(()=>{e?Me.value?.scrollIntoView?.({block:`end`}):Fe.value=!0})});function Le(){Pe(Ie())&&(Fe.value=!1)}function ze(){Me.value?.scrollIntoView?.({block:`end`,behavior:`smooth`}),Fe.value=!1}ee(()=>{window.addEventListener(`scroll`,Le,{passive:!0}),window.addEventListener(`keydown`,ke),u&&We()}),x(()=>{window.removeEventListener(`scroll`,Le),window.removeEventListener(`keydown`,ke),Ue?.close()});let Q=P(mn()),Be=F(()=>yn(u?.conversations??[],Q,u?.lane??``)),Ve=F(()=>{let e=L.value?.turn.id;return Q.runs.size+(e&&!Q.runs.has(e)?1:0)}),He=oe(),Ue=null;function We(){Ue=He(`/runs?stream=1&mine=1`);let e=!1;Ue.onopen=()=>{e&&Q.runs.clear(),e=!0,Q.connected=!0},Ue.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}hn(Q,t)}}let Ge=F(()=>{let e=N.find(e=>e.kind===`person`);return e?Y(e.text):`Switchboard`});s([Ge,Ve],([e,t])=>{k.setTitle(t>0?`(${t}) ${e}`:e),k.setFavicon(t>0?ae:ie)},{immediate:!0});let Ke=F(()=>new Date(p.value).getHours()),qe=F(()=>N.length===0),$=u?.elsewhere,Ye=$?$.surface===`web`?`This thread is another person's conversation. You can read it here.`:`This thread lives in ${de[$.surface]??$.surface}.`:``;return(e,t)=>{let s=te,y=R;return _(),M(n,{title:`Threads`,nav:`home`},{leading:g(()=>[r(s,{class:`rail-toggle -ml-1`,size:`xs`,color:`neutral`,variant:`ghost`,icon:G.value&&!W.value?`i-lucide-panel-left-close`:`i-lucide-panel-left`,"aria-label":xe.value,"aria-expanded":G.value?!W.value:void 0,onClick:Se},null,8,[`icon`,`aria-label`,`aria-expanded`])]),default:g(()=>[C(u)?(_(),i(`div`,{key:1,class:d([`home gap-8 md:grid`,W.value?`md:grid-cols-[minmax(0,1fr)]`:`md:grid-cols-[var(--rail-w)_minmax(0,1fr)]`]),style:c({"--rail-w":`${U.value}px`}),"data-rail":W.value?`hidden`:`shown`},[W.value?m(``,!0):(_(),i(`aside`,Sn,[r(kt,{ref_key:`rail`,ref:ye,class:`sticky top-20`,rows:Be.value,current:C(h),now:C(p),retention:C(b)},null,8,[`rows`,`current`,`now`,`retention`]),v(`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":C(X).min,"aria-valuemax":C(X).max,"aria-valuenow":U.value,tabindex:`0`,"data-testid":`rail-handle`,onPointerdown:Te,onKeydown:Oe,onDblclick:t[0]||=e=>K(C(X).default,!0)},[...t[5]||=[v(`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,Cn)])),r(y,{open:_e.value,"onUpdate:open":t[1]||=e=>_e.value=e,side:`left`,title:`Recent threads`,ui:{content:`max-w-xs`}},{body:g(()=>[r(kt,{ref_key:`sheetRail`,ref:be,rows:Be.value,current:C(h),now:C(p),retention:C(b)},null,8,[`rows`,`current`,`now`,`retention`])]),_:1},8,[`open`]),v(`section`,wn,[qe.value?(_(),M(It,{key:0,class:`mb-auto mt-[clamp(1.5rem,14vh,9rem)]`,name:C(u).viewer.name,hour:Ke.value,suggestions:C(u).suggestions,onPick:ce},{default:g(()=>[r(lt,{modelValue:z.value,"onUpdate:modelValue":t[2]||=e=>z.value=e,mode:se.value,hint:V.value,commands:C(u).commands,autofocus:``,"sweep-on-mount":``,onSubmit:ue,onStop:fe},null,8,[`modelValue`,`mode`,`hint`,`commands`])]),_:1},8,[`name`,`hour`,`suggestions`])):(_(),M(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:g(()=>[(_(!0),i(T,null,a(N,e=>(_(),i(`li`,{key:e.key},[e.kind===`person`?(_(),M(Ht,{key:0,text:e.text,at:e.at,now:C(p),pending:e.pending,folded:e.folded,failed:e.failed},null,8,[`text`,`at`,`now`,`pending`,`folded`,`failed`])):e.kind===`assistant`?(_(),M(ln,{key:1,turn:e.turn,live:e.live,now:C(p),onInput:(t,n)=>pe(e,t,n),onEnded:t=>me(e),onStop:t[3]||=e=>ne.value=e},null,8,[`turn`,`live`,`now`,`onInput`,`onEnded`])):e.kind===`silent`?(_(),M(pn,{key:2,reason:e.reason,"decided-at":e.at,now:C(p)},null,8,[`reason`,`decided-at`,`now`])):(_(),i(`div`,Tn,[r(ge,{text:e.text},null,8,[`text`])]))]))),128))]),_:1})),v(`div`,{ref_key:`end`,ref:Me,class:`end`,"aria-hidden":`true`},null,512),!qe.value&&C($)?(_(),i(`p`,En,[w(l(C(Ye))+` `,1),C($).url?(_(),i(`a`,{key:0,href:C($).url,target:`_blank`,rel:`noopener`,class:`text-highlighted`},`Reply there ↗`,8,Dn)):C($).surface===`web`?m(``,!0):(_(),i(T,{key:1},[w(`Reply there.`)],64))])):qe.value?m(``,!0):(_(),i(`div`,On,[r(f,{name:`sb-rise`},{default:g(()=>[Fe.value?(_(),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:ze},` ↓ new `)):m(``,!0)]),_:1}),r(lt,{modelValue:z.value,"onUpdate:modelValue":t[4]||=e=>z.value=e,mode:se.value,hint:V.value,commands:C(u).commands,autofocus:``,onSubmit:ue,onStop:fe},null,8,[`modelValue`,`mode`,`hint`,`commands`])]))])],14,xn)):(_(),i(`div`,bn,`This page needs its seed.`))]),_:1})}}});export{An as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,D as t,O as n,P as r,T as i,w as a}from"./AppShell-DAtHiuI6.js";import{An as o,B as s,Br as c,Cn as l,Ct as u,D as d,Di as f,Dr as p,Fi as m,G as h,Gr as g,Hn as _,I as v,J as y,K as b,L as x,Li as S,Mn as C,Oi as ee,Pi as w,Pr as T,Qr as E,S as D,Sn as O,T as k,Xr as A,_r as j,b as te,bn as M,dr as N,gt as P,ji as F,kn as I,l as ne,m as re,rn as ie,rr as L,rt as ae,tn as R,w as oe,wr as z,x as B,xi as V,xn as H,yn as U,z as W}from"./browser-B6T5hjfR.js";import{H as G}from"./indexRow-BT0cPVRw.js";import"./format-BldUwl_R.js";import{d as K,f as q,m as se,p as ce}from"./sseReplay-DmyMXfRC.js";var[J,le]=b(`DialogRoot`),ue=C({inheritAttrs:!1,__name:`DialogRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=P(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=V(),a=V(),{modal:o,unmountOnHide:s}=ee(n);return le({open:r,modal:o,unmountOnHide:s,openModal:()=>{r.value=!0},onOpenChange:e=>{r.value=e},onOpenToggle:()=>{r.value=!r.value},contentId:``,titleId:``,descriptionId:``,triggerElement:i,contentElement:a}),(e,t)=>z(e.$slots,`default`,{open:F(r),close:()=>r.value=!1})}}),de=C({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=J();return(e,r)=>(j(),H(F(v),L(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>F(n).onOpenChange(!1)}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`type`]))}}),Y=C({__name:`DialogContentImpl`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(n,{emit:r}){let s=n,c=r,l=J(),{forwardRef:u,currentElement:d}=W();return l.titleId||=t(void 0,`reka-dialog-title`),l.descriptionId||=t(void 0,`reka-dialog-description`),N(()=>{l.contentElement=d,h()!==document.body&&(l.triggerElement.value=h())}),(t,n)=>(j(),H(F(a),{"as-child":``,loop:``,trapped:s.trapFocus,present:s.present,onMountAutoFocus:n[5]||=e=>c(`openAutoFocus`,e),onUnmountAutoFocus:n[6]||=e=>c(`closeAutoFocus`,e)},{default:A(()=>[o(F(i),L({id:F(l).contentId,ref:F(u),as:t.as,"as-child":t.asChild,present:s.present,"disable-outside-pointer-events":t.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":F(l).descriptionId,"aria-labelledby":F(l).titleId,"data-state":F(e)(F(l).open.value)},t.$attrs,{onDismiss:n[0]||=e=>F(l).onOpenChange(!1),onEscapeKeyDown:n[1]||=e=>c(`escapeKeyDown`,e),onFocusOutside:n[2]||=e=>c(`focusOutside`,e),onInteractOutside:n[3]||=e=>c(`interactOutside`,e),onPointerDownOutside:n[4]||=e=>c(`pointerDownOutside`,e)}),{default:A(()=>[z(t.$slots,`default`)]),_:3},16,[`id`,`as`,`as-child`,`present`,`disable-outside-pointer-events`,`aria-describedby`,`aria-labelledby`,`data-state`])]),_:3},8,[`trapped`,`present`]))}}),fe=C({__name:`DialogContentModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let r=e,i=t,a=J(),o=s(i),{forwardRef:c,currentElement:l}=W(),u=U(()=>r.present?l.value:void 0);n(u);let d=U(()=>{let{present:e,...t}=r;return t});return g(()=>r.present,(e,t)=>{!e&&t&&a.triggerElement.value?.focus()}),(e,t)=>(j(),H(Y,L({...d.value,...F(o)},{ref:F(c),present:e.present,"trap-focus":F(a).open.value,"disable-outside-pointer-events":r.disableOutsidePointerEvents,onCloseAutoFocus:t[0]||=e=>{e.defaultPrevented||(e.preventDefault(),F(a).triggerElement.value?.focus())},onPointerDownOutside:t[1]||=e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()},onFocusOutside:t[2]||=e=>{e.preventDefault()}}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`present`,`trap-focus`,`disable-outside-pointer-events`]))}}),pe=C({__name:`DialogContentNonModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=s(t);W();let i=J(),a=V(!1),o=V(!1),c=U(()=>{let{present:e,...t}=n;return t});return g(()=>n.present,(e,t)=>{!e&&t&&(a.value||i.triggerElement.value?.focus(),a.value=!1,o.value=!1)}),(e,t)=>(j(),H(Y,L({...c.value,...F(r)},{present:e.present,"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:t[0]||=e=>{e.defaultPrevented||(a.value||F(i).triggerElement.value?.focus(),e.preventDefault()),a.value=!1,o.value=!1},onInteractOutside:t[1]||=e=>{e.defaultPrevented||(a.value=!0,e.detail.originalEvent.type===`pointerdown`&&(o.value=!0));let t=e.target;F(i).triggerElement.value?.contains(t)&&e.preventDefault(),e.detail.originalEvent.type===`focusin`&&o.value&&e.preventDefault()}}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`present`]))}}),me=C({__name:`DialogContent`,props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=J(),a=s(r),{forwardRef:o}=W();return(e,t)=>(j(),H(F(x),{present:e.forceMount||F(i).open.value,"force-mount":e.forceMount||!F(i).unmountOnHide.value},{default:A(({present:t})=>[F(i).modal.value?E((j(),H(fe,L({key:0,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:A(()=>[z(e.$slots,`default`)]),_:2},1040,[`present`])),[[R,F(i).unmountOnHide.value||t]]):E((j(),H(pe,L({key:1,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:A(()=>[z(e.$slots,`default`)]),_:2},1040,[`present`])),[[R,F(i).unmountOnHide.value||t]])]),_:3},8,[`present`,`force-mount`]))}}),X=C({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let t=e;W();let n=J();return(e,r)=>(j(),H(F(v),L(t,{id:F(n).descriptionId}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`id`]))}}),he=C({__name:`DialogOverlayImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},setup(e){let t=e,n=J(),i=r(t.present);return g(()=>t.present,e=>i.value=e),W(),(e,t)=>(j(),H(F(v),{as:e.as,"as-child":e.asChild,"data-state":F(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`},onPointerdown:t[0]||=ie(()=>{},[`left`,`self`,`prevent`])},{default:A(()=>[z(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),ge=C({__name:`DialogOverlay`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=J(),{forwardRef:n}=W();return(e,r)=>F(t)?.modal.value?(j(),H(F(x),{key:0,present:e.forceMount||F(t).open.value,"force-mount":e.forceMount||!F(t).unmountOnHide.value},{default:A(({present:r})=>[E(o(he,L(e.$attrs,{ref:F(n),as:e.as,"as-child":e.asChild,present:F(t).unmountOnHide.value||r}),{default:A(()=>[z(e.$slots,`default`)]),_:2},1040,[`as`,`as-child`,`present`]),[[R,F(t).unmountOnHide.value||r]])]),_:3},8,[`present`,`force-mount`])):O(`v-if`,!0)}}),_e=C({__name:`DialogPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(j(),H(F(d),m(_(t)),{default:A(()=>[z(e.$slots,`default`)]),_:3},16))}}),Z=C({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let t=e,n=J();return W(),(e,r)=>(j(),H(F(v),L(t,{id:F(n).titleId}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`id`]))}}),ve=C({__name:`DialogTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e,r=J(),{forwardRef:i,currentElement:a}=W();return r.contentId||=t(void 0,`reka-dialog-content`),N(()=>{r.triggerElement.value=a.value}),(e,t)=>(j(),H(F(v),L(n,{ref:F(i),type:e.as===`button`?`button`:void 0,"aria-haspopup":`dialog`,"aria-expanded":F(r).open.value||!1,"aria-controls":F(r).open.value?F(r).contentId:void 0,"data-state":F(r).open.value?`open`:`closed`,onClick:F(r).onOpenToggle}),{default:A(()=>[z(e.$slots,`default`)]),_:3},16,[`type`,`aria-expanded`,`aria-controls`,`data-state`,`onClick`]))}});function ye(e,t={}){let n=e.detail.originalEvent,r=n.target;if(!r?.isConnected){e.preventDefault();return}t.scrollable&&(n.offsetX>r.clientWidth||n.offsetY>r.clientHeight)&&e.preventDefault()}var be={slots:{overlay:`fixed inset-0 bg-elevated/75`,content:`fixed bg-default divide-y divide-default sm:ring ring-default sm:shadow-lg flex flex-col focus:outline-none`,header:`flex items-center gap-1.5 p-4 sm:px-6 min-h-(--ui-header-height)`,wrapper:``,body:`flex-1 overflow-y-auto p-4 sm:p-6`,footer:`flex items-center gap-1.5 p-4 sm:px-6`,title:`text-highlighted font-semibold`,description:`mt-1 text-muted text-sm`,close:`absolute top-4 end-4`},variants:{side:{top:{content:``},right:{content:`max-w-md`},bottom:{content:``},left:{content:`max-w-md`}},inset:{true:{content:`rounded-lg`}},transition:{true:{overlay:`data-[state=open]:animate-[fade-in_200ms_var(--ease-out)] data-[state=closed]:animate-[fade-out_200ms_var(--ease-out)]`}}},compoundVariants:[{side:`top`,inset:!0,class:{content:`max-h-[calc(100%-2rem)] inset-x-4 top-4`}},{side:`top`,inset:!1,class:{content:`max-h-full inset-x-0 top-0`}},{side:`right`,inset:!0,class:{content:`w-[calc(100%-2rem)] inset-y-4 right-4`}},{side:`right`,inset:!1,class:{content:`w-full inset-y-0 right-0`}},{side:`bottom`,inset:!0,class:{content:`max-h-[calc(100%-2rem)] inset-x-4 bottom-4`}},{side:`bottom`,inset:!1,class:{content:`max-h-full inset-x-0 bottom-0`}},{side:`left`,inset:!0,class:{content:`w-[calc(100%-2rem)] inset-y-4 left-4`}},{side:`left`,inset:!1,class:{content:`w-full inset-y-0 left-0`}},{transition:!0,side:`top`,class:{content:`data-[state=open]:animate-[slide-in-from-top_200ms_var(--ease-out)] data-[state=closed]:animate-[slide-out-to-top_200ms_var(--ease-out)]`}},{transition:!0,side:`right`,class:{content:`data-[state=open]:animate-[slide-in-from-right_200ms_var(--ease-out)] data-[state=closed]:animate-[slide-out-to-right_200ms_var(--ease-out)]`}},{transition:!0,side:`bottom`,class:{content:`data-[state=open]:animate-[slide-in-from-bottom_200ms_var(--ease-out)] data-[state=closed]:animate-[slide-out-to-bottom_200ms_var(--ease-out)]`}},{transition:!0,side:`left`,class:{content:`data-[state=open]:animate-[slide-in-from-left_200ms_var(--ease-out)] data-[state=closed]:animate-[slide-out-to-left_200ms_var(--ease-out)]`}}]},xe={__name:`Slideover`,props:{title:{type:String,required:!1},description:{type:String,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},transition:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1,default:`right`},inset:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},dismissible:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1}},emits:[`leave`,`after:leave`,`enter`,`after:enter`,`close:prevent`,`update:open`],setup(e,{emit:t}){let n=e,r=t,i=c(),a=D(`slideover`,n),{t:s}=y(),d=ae(),p=B(u(a,`open`,`defaultOpen`,`modal`,`unmountOnHide`),r),h=oe(f(()=>a.portal)),g=f(()=>a.content),v=U(()=>a.dismissible?{pointerDownOutside:ye}:[`interactOutside`,`escapeKeyDown`].reduce((e,t)=>(e[t]=e=>{e.preventDefault(),r(`close:prevent`)},e),{})),b=U(()=>te({extend:be,...d.ui?.slideover||{}})({transition:a.transition,side:a.side,inset:a.inset}));return(e,t)=>(j(),H(F(ue),m(_(F(p))),{default:A(({open:n,close:c})=>[i.default?(j(),H(F(ve),{key:0,"as-child":``,class:w(F(a).class)},{default:A(()=>[z(e.$slots,`default`,{open:n})]),_:2},1032,[`class`])):O(``,!0),o(F(_e),L(F(h),{"force-mount":F(h).disabled&&F(a).unmountOnHide===!1||void 0}),{default:A(()=>[o(F(re),null,{default:A(()=>[F(a).overlay?(j(),H(F(ge),{key:0,"data-slot":`overlay`,class:w(b.value.overlay({class:F(a).ui?.overlay}))},null,8,[`class`])):O(``,!0),o(F(me),L({"data-side":F(a).side,"data-slot":`content`,class:b.value.content({class:[!i.default&&F(a).class,F(a).ui?.content]})},g.value,{onEnter:t[0]||=e=>r(`enter`),onAfterEnter:t[1]||=e=>r(`after:enter`),onLeave:t[2]||=e=>r(`leave`),onAfterLeave:t[3]||=e=>r(`after:leave`)},T(v.value)),{default:A(()=>[!F(a).title&&!i.title||!F(a).description&&!i.description||i.content?(j(),H(F(k),{key:0},{default:A(()=>[!F(a).title&&!i.title?(j(),H(F(Z),{key:0})):i.content?(j(),H(F(Z),{key:1},{default:A(()=>[z(e.$slots,`title`,{},()=>[I(S(F(a).title),1)])]),_:3})):O(``,!0),!F(a).description&&!i.description?(j(),H(F(X),{key:2})):i.content?(j(),H(F(X),{key:3},{default:A(()=>[z(e.$slots,`description`,{},()=>[I(S(F(a).description),1)])]),_:3})):O(``,!0)]),_:3})):O(``,!0),z(e.$slots,`content`,{close:c},()=>[i.header||F(a).title||i.title||F(a).description||i.description||F(a).close||i.close?(j(),l(`div`,{key:0,"data-slot":`header`,class:w(b.value.header({class:F(a).ui?.header}))},[z(e.$slots,`header`,{close:c},()=>[F(a).title||i.title||F(a).description||i.description?(j(),l(`div`,{key:0,"data-slot":`wrapper`,class:w(b.value.wrapper({class:F(a).ui?.wrapper}))},[F(a).title||i.title?(j(),H(F(Z),{key:0,"data-slot":`title`,class:w(b.value.title({class:F(a).ui?.title}))},{default:A(()=>[z(e.$slots,`title`,{},()=>[I(S(F(a).title),1)])]),_:3},8,[`class`])):O(``,!0),F(a).description||i.description?(j(),H(F(X),{key:1,"data-slot":`description`,class:w(b.value.description({class:F(a).ui?.description}))},{default:A(()=>[z(e.$slots,`description`,{},()=>[I(S(F(a).description),1)])]),_:3},8,[`class`])):O(``,!0)],2)):O(``,!0),z(e.$slots,`actions`),F(a).close||i.close?(j(),H(F(de),{key:1,"as-child":``},{default:A(()=>[z(e.$slots,`close`,{ui:b.value},()=>[F(a).close?(j(),H(ne,L({key:0,icon:F(a).closeIcon||F(d).ui.icons.close,color:`neutral`,variant:`ghost`,"aria-label":F(s)(`slideover.close`)},typeof F(a).close==`object`?F(a).close:{},{"data-slot":`close`,class:b.value.close({class:F(a).ui?.close})}),null,16,[`icon`,`aria-label`,`class`])):O(``,!0)])]),_:2},1024)):O(``,!0)])],2)):O(``,!0),M(`div`,{"data-slot":`body`,class:w(b.value.body({class:F(a).ui?.body}))},[z(e.$slots,`body`,{close:c})],2),i.footer?(j(),l(`div`,{key:1,"data-slot":`footer`,class:w(b.value.footer({class:F(a).ui?.footer}))},[z(e.$slots,`footer`,{close:c})],2)):O(``,!0)])]),_:2},1040,[`data-side`,`class`])]),_:2},1024)]),_:2},1040,[`force-mount`])]),_:3},16))}};function Q(e){let t=V(`connecting`),n=e.factory(e.url);n.onopen=()=>{t.value===`connecting`&&!e.model.state.stopMode&&(t.value=`running`)};let r=0;return n.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}if(n.type!==`replay_note`){let e=Number(t.lastEventId);if(e>0){if(e<=r)return;r=e}}e.handle(n)},n.addEventListener(`replay_elided`,t=>{let n=se(t);n&&e.model.noteElided(n)}),n.addEventListener(`finished`,n=>{e.onFinished?.(ce(n)),(t.value===`connecting`||t.value===`running`)&&(t.value=`finished`)}),n.addEventListener(`end`,r=>{e.model.flushPendingTurn(`the run ended here`),e.model.closePhases(),t.value=`ended`,n.close(),e.onEnd?.(q(r))}),n.onerror=()=>{n.readyState===2&&(t.value=`disconnected`,e.onDisconnected?.())},{phase:t,close:()=>n.close()}}var $=[`Thinking`,`Pondering`,`Mulling it over`,`Reasoning`,`Cogitating`,`Weighing options`,`Puzzling`,`Deliberating`,`Noodling`,`Chewing on it`,`Ruminating`,`Reticulating splines`];function Se(e){return $[Math.floor(Math.max(0,e)/6e3)%$.length]}var Ce=[`title`],we={class:`verb min-w-0 truncate text-toned`},Te=C({__name:`PendingTurnRow`,props:{verb:{},elapsedMs:{},slow:{type:Boolean},model:{},tag:{},id:{}},setup(e){return(t,n)=>(j(),H(p(e.tag??`li`),{id:e.id,class:`pending flex items-center gap-3 rounded-md border border-dashed border-accented pl-3 pr-[calc(var(--sb-gutter)-1px)] py-2 text-sm`,"aria-live":`off`,title:`the model is working on its next turn — nothing back yet (since the last event, runner clock)`,"data-testid":`pending`},{default:A(()=>[n[0]||=M(`span`,{class:`pulse text-[1.1em] leading-none text-info motion-safe:animate-pulse`},`∿`,-1),e.model?(j(),l(`span`,{key:0,class:`badge shrink-0 rounded bg-accented px-1.5 font-mono text-[0.68rem] font-medium leading-normal tracking-wider text-muted`,title:e.model},S(F(K)(e.model)),9,Ce)):O(``,!0),M(`span`,we,S(e.verb)+`…`,1),M(`span`,{class:w([`since ml-auto shrink-0 font-mono text-xs tabular-nums`,e.slow?`text-warn`:`text-dimmed`])},S(F(G)(e.elapsedMs,`clock`)),3)]),_:1},8,[`id`]))}});export{xe as i,Se as n,Q as r,Te as t};
|
|
@@ -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{C as T,F as E,H as D,I as O,M as k,N as A,P as ee,S as te,V as ne,a as j,b as M,c as N,k as P,l as F,o as I,t as L,v as re,w as R,z as ie}from"./indexRow-BT0cPVRw.js";import"./format-BldUwl_R.js";import{a as ae,n as oe,t as se}from"./durationTone-U_rOqo6r.js";import{c as ce,l as le,n as ue,t as de,w as z}from"./sseReplay-DmyMXfRC.js";import{t as B}from"./StatusDot-CAfS1AUi.js";var fe={},pe={viewBox:`0 0 16 16`,class:`inline-block size-[1em] shrink-0`,"aria-hidden":`true`};function me(e,n){return d(),t(`svg`,pe,[...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 he=ae(fe,[[`render`,me]]),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`},ge={getting_ready:`getting ready`,finishing_up:`finishing up`};function _e(e){return V[ge[e]]}var ve={id:`timeline`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,"data-testid":`timeline`},ye={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},be={class:`ml-auto flex items-baseline gap-3 font-normal normal-case tracking-normal`},xe=[`href`],Se={class:`lede font-mono text-sm text-toned`},Ce={class:`shape tabular-nums`},we={key:0,class:`current text-muted`},Te={key:0,class:`note mt-0.5 text-xs text-muted`},Ee=[`aria-label`],De=[`title`,`data-term`],Oe={class:`legend mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs`},ke=[`title`,`data-term`],Ae={class:`term text-muted`},je={class:`ms tabular-nums text-toned`},Me=[`title`],Ne={class:`ranked mt-1 flex flex-col gap-1 font-mono text-xs`},Pe={class:`ms w-14 shrink-0 tabular-nums text-toned`},Fe=[`href`,`data-anchor`,`onClick`],Ie=[`title`],Le={class:`cut mt-1 flex flex-col gap-1 font-mono text-xs`},Re={class:`ms w-14 shrink-0 tabular-nums text-toned`},ze=[`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`${D(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`,ve,[f(`h2`,ye,[o[0]||=f(`span`,null,`Where the time went`,-1),f(`span`,be,[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,xe)):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`,Se,[f(`span`,Ce,a(e.vm.shown?e.vm.total:e.vm.lede),1),e.vm.current?(d(),t(`span`,we,` · `+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`,Te,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,De))),128))],8,Ee),f(`ul`,Oe,[(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`,Ae,a(e.term),1),f(`span`,je,a(e.text),1)],8,ke))),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,Me),f(`ol`,Ne,[(d(!0),t(_,null,n(e.vm.ranked,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Pe,a(h(D)(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,Fe),(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,Ie),f(`ol`,Le,[(d(!0),t(_,null,n(e.vm.cut,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Re,a(h(D)(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,ze),(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 Be(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 Ve=`currently delivering`,He=`getting ready: not recorded (too large)`,Ue=`no timing data`,We=`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=E(a),s=D(o.totalS*1e3,`clock`),c=t.find(e=>e.name===`request`&&e.parentSpanId===void 0),l=e.phase===`live`?Ke(t,r,n):void 0,u=qe(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:Ue};let p=Ge(c,`restartOfRunId`),m={total:s,current:u,openStep:d,captions:[p===void 0?void 0:`restarted from run ${p}`,k(`before`,J(c,`queuedBeforeMs`)),p===void 0?k(`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?He:``};let h=t=>t===`not recorded`?`not recorded${e.truncated?` (too large)`:``}`:t===`not loaded`?We:t,g=A(a)&&o.items.length>0,_=g?`${s} — ${o.items.map(({term:e,s:t})=>`${D(t*1e3,`clock`)} ${h(e)}`).join(` · `)}`:a.windowMs>0?`${s} — ${h(Je(a))}`:s,v=g?o.items.map(({term:t,s:n})=>({term:t,text:D(n*1e3,`clock`),definition:t===`not recorded`&&e.truncated?`${U[t]} (too large)`:U[t]})):[],y=g?Xe(t,c,r,n,e.callTitle,e.phase===`ended`,Be(e.endedBy)):{ranked:[],cut:[]};return{...m,lede:_,shown:g,bar:g?Ye(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 Ge(e,t){let n=e?.attrs[t];return typeof n==`string`&&n!==``?n:void 0}function Ke(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=O(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),O(r.name,n)?.kind===`background`)return!0;r=r.parentSpanId?t.get(r.parentSpanId):void 0}return!1}function qe(e,t){return e.phase===`delivering`?Ve:e.phase===`ended`?le(e.delivery??{}):t?`currently ${K[t.bucket]} ${D(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 Je(e){let t=[`getting ready`,-1];for(let n of X(e))n[1]>t[1]&&(t=n);return t[0]}function Ye(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 Xe(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`||O(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-Ze(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 Ze(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 ${D(t.timeoutMs,`clock`)}`),typeof t.waitedMs==`number`&&n.push(`waited ${D(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 Qe=[`data-state`],$e={key:0,class:`loading py-2 font-mono text-xs text-dimmed`},et={key:1,class:`failed py-2 font-mono text-xs text-warn`},tt=[`data-turn`,`data-anchor`],nt={class:`landing-head flex flex-wrap items-baseline gap-x-2 font-mono text-xs text-muted`},rt={class:`turn tabular-nums`},it={class:`what min-w-0 truncate text-toned`},at={key:0,class:`m-0 mt-1 list-none p-0`},ot=o({__name:`RunTimeline`,props:{run:{},land:{},fetch:{}},setup(n){let i=n,o=b(`loading`),s=ce(),v=S(()=>{if(o.value!==`ready`)return null;s.state.traceVersion;let e=i.run,t=e.receivedAt??e.startedAt,n=ne(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=de(await t.text()).filter(e=>e.type!==`replay_note`);for(let e of(i.run.schema??0)>=2?ie(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`,$e,`reading the run's record…`)):o.value===`failed`?(d(),t(`p`,et,[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`,nt,[f(`span`,rt,`turn `+a(n.land),1),f(`span`,it,`· `+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`,at,[e(ue,{step:T.value.step,onToggleGroup:i[0]||=e=>h(s).toggleGroup(T.value.step)},null,8,[`step`])])):c(``,!0)],8,tt)):c(``,!0)],64)):c(``,!0)],8,Qe)}}}),st=[`id`,`data-run-id`,`data-round`,`data-thread`],ct=[`open`],lt={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`},ut={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},dt={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},ft={key:3,class:`scope min-w-0 flex-1 truncate text-toned`},$=[`title`],pt=[`data-heat`],mt={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},ht={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)`},gt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},_t={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},vt={key:3,class:`scope min-w-0 flex-1 truncate text-highlighted`},yt=[`title`],bt={class:`elapsed shrink-0 text-right font-mono text-xs tabular-nums text-ok sm:min-w-[4.5em]`,title:`running for`},xt={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},St=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||M(o.run.id))),_=S(()=>te(o.run)),y=S(()=>re(o.run)),E=S(()=>o.run.finished),D=S(()=>o.run.finished&&o.run.status&&o.run.status!==`completed`?T(o.run.status):``),O=S(()=>se(o.run.finished&&typeof o.run.finishedAt==`number`?o.run.finishedAt-o.run.startedAt:void 0,`run`)),k=S(()=>oe(O.value));function A(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},[E.value?(d(),t(`details`,{key:0,class:`group/fold`,open:p.value,onToggle:A},[f(`summary`,lt,[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(R)(n.run),tip:h(N)(n.run)},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,ut,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(L)[h(j)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,ft,a(m.value.scope),1)):(d(),t(`span`,dt,a(m.value.snippet),1)),D.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(D.value),3)):c(``,!0),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-dimmed`,title:h(P)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,$),f(`span`,{class:s([`elapsed shrink-0 text-right font-mono text-xs tabular-nums sm:min-w-[4.5em]`,[k.value?`heat`:`text-muted`,O.value.level>=2?`font-medium`:``]]),style:i(k.value),"data-heat":O.value.level,title:`start to finish`},a(h(F)(n.run,n.now)),15,pt),f(`span`,mt,a(h(I)(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(M)(n.run.id)}`,onClick:o[0]||=v(()=>{},[`stop`])},{default:u(()=>[...o[1]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]),p.value?(d(),x(ot,{key:0,run:n.run,land:n.land},null,8,[`run`,`land`])):c(``,!0)],40,ct)):(d(),t(`div`,ht,[o[4]||=f(`span`,{class:`chev select-none text-xs text-transparent`,"aria-hidden":`true`},`❯`,-1),e(B,{tone:_.value,label:h(R)(n.run),tip:h(N)(n.run),pulse:``},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,gt,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(L)[h(j)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,vt,a(m.value.scope),1)):(d(),t(`span`,_t,a(m.value.snippet),1)),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-muted`,title:h(P)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,yt),f(`span`,bt,a(h(F)(n.run,n.now)),1),f(`span`,xt,a(h(I)(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(M)(n.run.id)}`},{default:u(()=>[...o[3]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]))],10,st)}}});export{_e as a,H as i,Q as n,he as o,q as r,St as t};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DfbEpHXR.js","assets/AppShell-DAtHiuI6.js","assets/browser-B6T5hjfR.js","assets/main-5Gm_1Gv8.js","assets/main-zbP_dTjR.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{D as e,M as t,b as n,d as r,f as i,t as a,v as o,y as s}from"./AppShell-DAtHiuI6.js";import{An as c,Br as l,Cn as u,Cr as d,Ct as f,E as p,Gr as m,I as h,Ii as g,K as _,L as v,Li as y,Mn as b,Oi as x,Pi as S,S as C,Sn as w,Tr as ee,Vr as T,X as E,Xr as D,Zn as O,_ as te,_r as k,b as A,bn as j,dr as M,ft as ne,g as re,gt as N,h as ie,hr as ae,ht as oe,ir as se,ji as P,kn as F,l as ce,ln as I,lt as le,nn as ue,o as de,qr as fe,r as pe,rn as me,rr as L,rt as he,sr as R,st as ge,t as _e,wi as ve,wr as z,x as B,xi as V,xn as H,y as U,yi as ye,yn as W,yr as be,z as G}from"./browser-B6T5hjfR.js";import{t as xe}from"./Tooltip-tZoum_T-.js";import{i as Se,n as Ce,r as we,t as Te}from"./PendingTurnRow-ChCQOLgZ.js";import{b as Ee,t as De,x as Oe}from"./main-5Gm_1Gv8.js";import{t as ke}from"./eventSource-Bj_dZf6M.js";import{t as Ae}from"./wallClock-DmaC1sKA.js";import{t as je}from"./indexFormat-B-pd4r7Y.js";import{C as Me,H as Ne,O as Pe,j as Fe}from"./indexRow-BT0cPVRw.js";import{i as Ie,n as Le,r as Re}from"./format-BldUwl_R.js";import{a as ze,i as Be,n as Ve,t as He}from"./durationTone-U_rOqo6r.js";import{C as Ue,S as We,T as K,_ as Ge,a as Ke,b as qe,c as Je,d as Ye,g as Xe,h as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,u as it,v as at,x as ot,y as st}from"./sseReplay-DmyMXfRC.js";import{t as q}from"./NotFoundPage-DtE-GgTk.js";import{a as ct,i as lt,n as ut,o as dt,r as ft,t as pt}from"./RunFoldRow-D3wVpzBa.js";var mt=b({__name:`RovingFocusItem`,props:{tabStopId:{type:String,required:!1},focusable:{type:Boolean,required:!1,default:!0},active:{type:Boolean,required:!1},allowShiftKey:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(t){let r=t,a=i(),l=e(),u=W(()=>r.tabStopId||l),d=W(()=>a.currentTabStopId.value===u.value),{getItems:f,CollectionItem:g}=p();M(()=>{r.focusable&&a.onFocusableItemAdd()}),ae(()=>{r.focusable&&a.onFocusableItemRemove()}),m(()=>r.focusable,(e,t)=>{e!==t&&(e?a.onFocusableItemAdd():a.onFocusableItemRemove())});function _(e){if(e.key===`Tab`&&e.shiftKey){a.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=s(e,a.orientation.value,a.dir.value);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||!r.allowShiftKey&&e.shiftKey)return;e.preventDefault();let i=[...f().map(e=>e.ref).filter(e=>e.dataset.disabled!==``)];if(t===`last`)i.reverse();else if(t===`prev`||t===`next`){t===`prev`&&i.reverse();let r=i.indexOf(e.currentTarget);i=a.loop.value?n(i,r+1):i.slice(r+1)}se(()=>o(i))}}return(e,t)=>(k(),H(P(g),null,{default:D(()=>[c(P(h),{tabindex:d.value?0:-1,"data-orientation":P(a).orientation.value,"data-active":e.active?``:void 0,"data-disabled":e.focusable?void 0:``,as:e.as,"as-child":e.asChild,onMousedown:t[0]||=t=>{e.focusable?P(a).onItemFocus(u.value):t.preventDefault()},onFocus:t[1]||=e=>P(a).onItemFocus(u.value),onKeydown:_},{default:D(()=>[z(e.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`data-active`,`data-disabled`,`as`,`as-child`])]),_:3}))}}),[J,ht]=_(`TabsRoot`),gt=b({__name:`TabsRoot`,props:{defaultValue:{type:null,required:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},activationMode:{type:String,required:!1,default:`automatic`},modelValue:{type:null,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`],setup(n,{emit:r}){let i=n,a=r,{orientation:o,unmountOnHide:s,dir:c}=x(i),l=t(c);G();let u=N(i,`modelValue`,a,{defaultValue:i.defaultValue,passive:i.modelValue===void 0}),d=V(),f=ve(new Set);return ht({modelValue:u,changeModelValue:e=>{u.value=e},orientation:o,dir:l,unmountOnHide:s,activationMode:i.activationMode,baseId:e(void 0,`reka-tabs`),tabsList:d,contentIds:f,registerContent:e=>{f.value=new Set([...f.value,e])},unregisterContent:e=>{let t=new Set(f.value);t.delete(e),f.value=t}}),(e,t)=>(k(),H(P(h),{dir:P(l),"data-orientation":P(o),"as-child":e.asChild,as:e.as},{default:D(()=>[z(e.$slots,`default`,{modelValue:P(u)})]),_:3},8,[`dir`,`data-orientation`,`as-child`,`as`]))}});function _t(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}var vt=b({__name:`TabsContent`,props:{value:{type:[String,Number],required:!0},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:n}=G(),r=J(),i=W(()=>_t(r.baseId,t.value)),a=W(()=>Y(r.baseId,t.value)),o=W(()=>t.value===r.modelValue.value),s=V(o.value);return M(()=>{r.registerContent(t.value),requestAnimationFrame(()=>{s.value=!1})}),R(()=>{r.unregisterContent(t.value)}),(e,t)=>(k(),H(P(v),{present:e.forceMount||o.value,"force-mount":``},{default:D(({present:t})=>[c(P(h),{id:a.value,ref:P(n),"as-child":e.asChild,as:e.as,role:`tabpanel`,"data-state":o.value?`active`:`inactive`,"data-orientation":P(r).orientation.value,"aria-labelledby":i.value,hidden:!t,tabindex:`0`,style:g({animationDuration:s.value?`0s`:void 0})},{default:D(()=>[!P(r).unmountOnHide.value||t?z(e.$slots,`default`,{key:0}):w(`v-if`,!0)]),_:2},1032,[`id`,`as-child`,`as`,`data-state`,`data-orientation`,`aria-labelledby`,`hidden`,`style`])]),_:3},8,[`present`]))}}),yt=b({__name:`TabsIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let n=e,r=J();t({updateIndicatorStyle:s}),G();let i=ne(),a=V({size:null,thickness:null,position:null}),o=V([]);m(()=>[r.modelValue.value,r?.dir.value],()=>{s()},{immediate:!0,flush:`post`}),fe(()=>{o.value=Array.from(r.tabsList.value?.querySelectorAll(`[role="tab"]`)||[])}),oe(W(()=>[r.tabsList.value,...o.value]),s);function s(){let e=r.tabsList.value?.querySelector(`[role="tab"][data-state="active"]`);e&&(r.orientation.value===`horizontal`?a.value={size:e.offsetWidth,thickness:e.offsetHeight,position:e.offsetLeft}:a.value={size:e.offsetHeight,thickness:e.offsetWidth,position:e.offsetTop})}return(e,t)=>P(i)&&typeof a.value.size==`number`?(k(),H(P(h),L({key:0},n,{style:{"--reka-tabs-indicator-size":`${a.value.size}px`,"--reka-tabs-indicator-thickness":`${a.value.thickness}px`,"--reka-tabs-indicator-position":`${a.value.position}px`}}),{default:D(()=>[z(e.$slots,`default`)]),_:3},16,[`style`])):w(`v-if`,!0)}}),bt=b({__name:`TabsList`,props:{loop:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{loop:t}=x(e),{forwardRef:n,currentElement:i}=G(),a=J();return a.tabsList=i,(e,i)=>(k(),H(P(r),{"as-child":``,orientation:P(a).orientation.value,dir:P(a).dir.value,loop:P(t)},{default:D(()=>[c(P(h),{ref:P(n),role:`tablist`,"as-child":e.asChild,as:e.as,"aria-orientation":P(a).orientation.value},{default:D(()=>[z(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`aria-orientation`])]),_:3},8,[`orientation`,`dir`,`loop`]))}}),xt=b({__name:`TabsTrigger`,props:{value:{type:[String,Number],required:!0},disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:n}=G(),r=J(),i=W(()=>_t(r.baseId,t.value)),a=W(()=>r.contentIds.value.has(t.value)?Y(r.baseId,t.value):void 0),o=W(()=>t.value===r.modelValue.value);return(e,t)=>(k(),H(P(mt),{"as-child":``,focusable:!e.disabled,active:o.value},{default:D(()=>[c(P(h),{id:i.value,ref:P(n),role:`tab`,type:e.as===`button`?`button`:void 0,as:e.as,"as-child":e.asChild,"aria-selected":o.value?`true`:`false`,"aria-controls":a.value,"data-state":o.value?`active`:`inactive`,disabled:e.disabled,"data-disabled":e.disabled?``:void 0,"data-orientation":P(r).orientation.value,onMousedown:t[0]||=me(t=>{!e.disabled&&t.ctrlKey===!1?P(r).changeModelValue(e.value):t.preventDefault()},[`left`]),onKeydown:t[1]||=ue(t=>P(r).changeModelValue(e.value),[`enter`,`space`]),onFocus:t[2]||=()=>{let t=P(r).activationMode!==`manual`;!o.value&&!e.disabled&&t&&P(r).changeModelValue(e.value)}},{default:D(()=>[z(e.$slots,`default`)]),_:3},8,[`id`,`type`,`as`,`as-child`,`aria-selected`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`data-orientation`])]),_:3},8,[`focusable`,`active`]))}}),St=[`data-expanded`,`data-overflowing`],Ct={key:0,class:`fade pointer-events-none absolute inset-x-0 bottom-6 h-10`},wt={key:1,class:`mt-1 flex justify-start`},Tt=[`aria-expanded`],Et=ze(b({__name:`ExpandableText`,props:{lines:{default:5}},setup(e){let t=e,n=V(!1),r=V(!1),i=V(null),a=`expandable-${Math.random().toString(36).slice(2,8)}`;function o(){let e=i.value;e&&!n.value&&(r.value=e.scrollHeight>e.clientHeight+1)}let s=null;M(()=>{o(),typeof ResizeObserver<`u`&&i.value&&(s=new ResizeObserver(()=>o()),s.observe(i.value))}),R(()=>s?.disconnect()),m(n,e=>{e||Promise.resolve().then(o)});function c(){n.value=!n.value}function l(e){!n.value&&r.value&&(e.target?.closest?.(`a`)||(n.value=!0))}return(e,o)=>(k(),u(`div`,{class:S([`expandable group relative`,!n.value&&r.value?`cursor-pointer`:``]),"data-expanded":n.value?`1`:`0`,"data-overflowing":r.value?`1`:`0`,onClick:l},[j(`div`,{id:a,ref_key:`body`,ref:i,class:S([`body`,n.value?``:`clamped`]),style:g(n.value?void 0:{"--expandable-lines":String(t.lines)})},[z(e.$slots,`default`,{},void 0,!0)],6),!n.value&&r.value?(k(),u(`div`,Ct)):w(``,!0),r.value||n.value?(k(),u(`div`,wt,[j(`button`,{type:`button`,class:`more cursor-pointer text-xs text-dimmed group-hover:text-primary hover:underline focus-visible:outline-2 focus-visible:outline-primary`,"aria-expanded":n.value?`true`:`false`,"aria-controls":a,onClick:me(c,[`stop`])},y(n.value?`Show less`:`Show more`),9,Tt)])):w(``,!0)],10,St))}}),[[`__scopeId`,`data-v-ce3bfa89`]]),X=[`id`],Dt={class:`what`},Ot={key:0,class:`text-dimmed`},Z={key:1,class:`dur tabular-nums text-dimmed`},Q=[`title`],kt=b({__name:`SpanRow`,props:{item:{}},setup(e){return(t,n)=>(k(),u(`li`,{id:`span-${e.item.spanId}`,class:`span flex items-baseline gap-2 py-0.5 pr-(--sb-gutter) font-mono text-xs text-muted`},[j(`span`,{class:S([`glyph select-none`,e.item.status===`error`?`text-bad`:`text-dimmed`])},y(e.item.open?`◌`:e.item.status===`error`?`✗`:`◷`),3),j(`span`,Dt,y(e.item.text),1),e.item.open?(k(),u(`span`,Ot,`…`)):e.item.durationMs===void 0?w(``,!0):(k(),u(`span`,Z,y(P(Ne)(e.item.durationMs,`precise`)),1)),e.item.at===void 0?w(``,!0):(k(),u(`span`,{key:2,class:`ts ml-auto select-none text-dimmed`,title:P(Ie)(e.item.at)},y(P(Le)(e.item.at)),9,Q))],8,X))}}),At=[`data-position`],jt={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-ok`},Mt=[`href`],Nt={key:1,class:`caption font-normal normal-case tracking-normal text-dimmed`},Pt=[`title`],Ft=b({__name:`ReplyBlock`,props:{text:{},caption:{},when:{},whenTitle:{},position:{},files:{}},setup(e){return(t,n)=>(k(),u(`section`,{id:`reply`,class:S([`block rounded-lg border border-ok/40 bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,e.position===`first`?`mb-4`:`mt-6`]),"data-position":e.position},[j(`h2`,jt,[n[0]||=j(`span`,null,`Reply`,-1),e.caption.href?(k(),u(`a`,{key:0,class:`caption font-normal normal-case tracking-normal text-dimmed no-underline hover:text-primary hover:underline`,href:e.caption.href,target:`_blank`,rel:`noopener noreferrer`},y(e.caption.text),9,Mt)):(k(),u(`span`,Nt,y(e.caption.text),1)),j(`span`,{class:`ts ml-auto select-none text-xs font-normal normal-case tracking-normal text-dimmed`,title:e.whenTitle},y(e.when),9,Pt)]),c(K,{text:e.text},null,8,[`text`]),e.files.length>0?(k(),H(nt,{key:0,files:e.files},null,8,[`files`])):w(``,!0)],10,At))}}),It={id:`units`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},Lt={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},Rt={class:`count font-normal normal-case tracking-normal text-dimmed`},zt={class:`m-0 list-none p-0`},Bt=[`data-unit`],Vt=[`href`],Ht=b({__name:`RunUnitsBlock`,props:{units:{}},setup(e){let t={merged:`border-ok/30 text-ok`,merge_ready:`border-ok/30 text-ok`,done:`border-ok/30 text-ok`};function n(e){return e.ending?e.ending.kind:e.threads.coding===void 0?`not started`:`round ${e.rounds.at(-1)?.index??0} · ${e.rounds.at(-1)?.agent??`in flight`}`}return(r,i)=>{let a=ee(`RouterLink`);return k(),u(`section`,It,[j(`h2`,Lt,[i[0]||=j(`span`,null,`Units`,-1),j(`span`,Rt,`· `+y(e.units.length)+` unit`+y(e.units.length===1?``:`s`)+` — each opens to its runs in round order`,1)]),j(`ol`,zt,[(k(!0),u(I,null,d(e.units,e=>(k(),u(`li`,{key:e.unit,class:`unit flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 border-t border-default py-1.5 first:border-t-0`,"data-unit":e.unit},[c(a,{class:`key shrink-0 rounded border border-accented px-1.5 font-mono text-[0.72rem] font-medium text-toned no-underline hover:border-primary hover:text-primary`,to:`/runs/unit/${encodeURIComponent(e.unit)}`},{default:D(()=>[F(y(e.id),1)]),_:2},1032,[`to`]),c(a,{class:`title min-w-0 flex-1 truncate text-sm text-highlighted no-underline hover:underline`,to:`/runs/unit/${encodeURIComponent(e.unit)}`},{default:D(()=>[F(y(e.title??e.branch),1)]),_:2},1032,[`to`]),j(`span`,{class:S([`standing shrink-0 rounded border px-1.5 font-mono text-[0.7rem]`,t[e.ending?.kind??``]??`border-accented text-muted`])},y(n(e)),3),e.pr?(k(),u(`a`,{key:0,class:`prlink shrink-0 whitespace-nowrap font-mono text-xs text-primary no-underline hover:underline`,href:e.pr.url,target:`_blank`,rel:`noopener noreferrer`},[c(dt,{class:`mr-1 align-[-0.125em]`}),F(`#`+y(e.pr.number),1)],8,Vt)):w(``,!0)],8,Bt))),128))])])}}}),Ut={id:`children`,class:`block mb-4 px-(--sb-gutter)`},Wt={class:`mb-1 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},Gt={class:`count font-normal normal-case tracking-normal text-dimmed`},Kt={class:`m-0 list-none border-t border-muted p-0`},qt=b({__name:`RunChildrenBlock`,props:{children:{},now:{}},setup(e){return(t,n)=>(k(),u(`section`,Ut,[j(`h2`,Wt,[n[0]||=j(`span`,null,`Spawned runs`,-1),j(`span`,Gt,`· `+y(e.children.length)+` run`+y(e.children.length===1?``:`s`)+`, in the order they started`,1)]),j(`ol`,Kt,[(k(!0),u(I,null,d(e.children,t=>(k(),H(pt,{key:t.id,run:t,now:e.now},null,8,[`run`,`now`]))),128))])]))}});function Jt(e){return e.description?.title?e.description.title:e.pr.repo&&e.pr.number!==void 0?`${e.pr.repo}#${e.pr.number}`:e.pr.repo??`PR review`}var Yt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,Xt=/^[0-9a-f]{7,40}$/;function Zt(e){if(!e.repo||!Yt.test(e.repo))return{};let t=`https://github.com/${e.repo}`,n={};return e.number!==void 0&&Number.isInteger(e.number)&&e.number>0&&(n.pr=`${t}/pull/${e.number}`,n.files=`${t}/pull/${e.number}/files`),e.headSha&&Xt.test(e.headSha)&&(n.commit=e.number!==void 0&&n.pr?`${t}/pull/${e.number}/commits/${e.headSha}`:`${t}/commit/${e.headSha}`),n}function Qt(e){return e.find(e=>e.poweredBy===`meat`)??e.find(e=>e.poweredBy===`git`)??null}function $t(e){return e===`meat`?`An abridged reading of the change: a model dropped what a reviewer need not read (style, imports, boilerplate) and kept the concepts`:`The complete change, base…head, as git reports it`}function en(e){return`The recorded diff was cut at ${e.toLocaleString(`en-US`)} characters; open the full diff on GitHub for the rest`}function tn(e){return e===`meat`?`reading diff · meat`:`full diff · git`}function nn(e){let t=[];return e.origin===`parsed`&&!e.complete&&t.push(`read back from the PR body`),e.truncated&&t.push(`the body was cut before it was read`),t.length>0?t.join(`; `):void 0}var rn=e=>typeof e==`object`&&!!e,$=e=>typeof e==`string`&&e!==``,an=e=>typeof e==`number`&&Number.isInteger(e)&&e>0;function on(e){for(let t of e.split(/\n\s*\n/)){let e=t.split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(e=>e!==``);if(!(e.length===0||e.every(e=>e.startsWith(`#`))))return e.join(`
|
|
4
|
-
`)}}function sn(e,t){let n=t.trim().toLowerCase(),r=[],i=!1,a=!1;for(let t of e.split(`
|
|
5
|
-
`)){/^\s*```/.test(t)&&(i=!i);let e=i?null:/^##\s+(.+?)\s*$/.exec(t);if(e){if(a)break;a=e[1].toLowerCase()===n;continue}a&&r.push(t)}let o=r.join(`
|
|
6
|
-
`).trim();return o===``?void 0:o}function cn(e,t){let n=t.trim().toLowerCase(),r=[],i=!1,a=!1;for(let t of e.split(`
|
|
7
|
-
`)){/^\s*```/.test(t)&&(i=!i);let e=t.trim();if(!i&&a&&e===`<details>`)break;let o=i?null:/^\*\*([^*]+?):?\*\*\s*(.*)$/.exec(e);if(o){let e=o[1].trim().toLowerCase(),t=[`why`,`where to look`,`feedback wanted`,`risk`,`verified`].includes(e);if(a&&t)break;if(e===n){a=!0,o[2]&&r.push(o[2]);continue}}a&&r.push(t)}let o=r.join(`
|
|
8
|
-
`).trim();return o===``?void 0:o}function ln(e){if(!$(e.title)||e.origin!==`submitted`&&e.origin!==`parsed`)return;let t=typeof e.body==`string`?e.body:``,n=$(e.tldr)?e.tldr:on(t),r=$(e.why)?e.why:cn(t,`Why`)??sn(t,`What & why`);return{title:e.title,...n===void 0?{}:{tldr:n},...r===void 0?{}:{why:r},origin:e.origin,complete:e.complete===!0,truncated:e.truncated===!0}}function un(){let e=ye({pr:{},readingDiffs:[],ready:!1});return{state:e,handle(t){if(!rn(t))return;let n=t;if(n.type===`run_meta`)$(n.repo)&&(e.pr.repo=n.repo),an(n.pr)&&(e.pr.number=n.pr),typeof n.headSha==`string`&&Xt.test(n.headSha)&&(e.pr.headSha=n.headSha);else if(n.type===`review_artifact`&&n.artifact===`reading_diff`){if(!$(n.diff)||n.poweredBy!==`git`&&n.poweredBy!==`meat`)return;let t={poweredBy:n.poweredBy,baseRef:$(n.baseRef)?n.baseRef:`HEAD`,diff:n.diff,truncated:n.truncated===!0,...$(n.summary)?{summary:n.summary}:{}},r=e.readingDiffs.findIndex(e=>e.poweredBy===t.poweredBy);r>=0?e.readingDiffs.splice(r,1,t):e.readingDiffs.push(t),e.ready=!0}else if(n.type===`review_artifact`&&n.artifact===`pr_description`){let t=ln(n);t&&(e.description=t)}}}}var dn=3e3,fn={fetch:(...e)=>globalThis.fetch(...e),delay:e=>new Promise(t=>setTimeout(t,e))};function pn(e,t,n={}){let{fetch:r,delay:i}={...fn,...n},a=ye({state:{state:`absent`}}),o=!1,s=!1;async function c(t){let n=await r(`/api/review.abridge`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e,...t?{force:!0}:{}})}),i=await n.json().catch(()=>null);if(!n.ok)throw Error(typeof i?.error==`string`?i.error:`HTTP ${n.status}`);return i??{}}async function l(){let n=!1,i;for(let a=0;a<50;a++){let a=`id=${encodeURIComponent(e)}${i===void 0?``:`&after-seq=${i}`}`,s=await r(`/api/runs.events?${a}`,{credentials:`same-origin`});if(o)return`disposed`;if(!s.ok)throw Error(`HTTP ${s.status}`);let c=await s.json();if(o)return`disposed`;for(let e of c.events??[]){t(e);let r=e;r.type===`review_artifact`&&r.artifact===`reading_diff`&&r.poweredBy===`meat`&&(n=!0)}if(typeof c.nextAfterSeq!=`number`)return n?`found`:`missing`;if(i!==void 0&&c.nextAfterSeq<=i)return`stuck`;i=c.nextAfterSeq}return`stuck`}async function u(e){try{let t=await c(e);for(let e=0;t.state===`running`;e++){if(e>=200){s=!1,a.state={state:`failed`,reason:`still running after the page stopped waiting; ask again later`};return}if(await i(dn),o)return;t=await c(!1)}if(o)return;if(t.state===`failed`)s=!0,a.state={state:`failed`,reason:typeof t.reason==`string`?t.reason:`unknown reason`};else if(t.state===`done`){let e=await l();if(e===`disposed`)return;s=!1,a.state=e===`found`?{state:`done`}:{state:`failed`,reason:e===`stuck`?`the run's record did not page to its end`:`the abridged diff did not appear on the run's record`}}else s=!1,a.state={state:`failed`,reason:`unexpected answer: ${String(t.state)}`}}catch(e){if(o)return;s=!1,a.state={state:`failed`,reason:e instanceof Error?e.message:String(e)}}}return{get state(){return a.state},start(){if(a.state.state===`running`||o)return;let e=a.state.state===`failed`&&s;a.state={state:`running`},u(e)},dispose(){o=!0}}}var mn={slots:{base:`font-medium inline-flex items-center`,label:`truncate`,leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailingIcon:`shrink-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{base:`text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},sm:{base:`text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm`,leadingIcon:`size-3`,leadingAvatarSize:`3xs`,trailingIcon:`size-3`},md:{base:`text-xs px-2 py-1 gap-1 rounded-md`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`},lg:{base:`text-sm px-2 py-1 gap-1.5 rounded-md`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`},xl:{base:`text-base px-2.5 py-1 gap-1.5 rounded-md`,leadingIcon:`size-6`,leadingAvatarSize:`2xs`,trailingIcon:`size-6`}},square:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:`bg-primary text-inverted`},{color:`secondary`,variant:`solid`,class:`bg-secondary text-inverted`},{color:`success`,variant:`solid`,class:`bg-success text-inverted`},{color:`info`,variant:`solid`,class:`bg-info text-inverted`},{color:`warning`,variant:`solid`,class:`bg-warning text-inverted`},{color:`error`,variant:`solid`,class:`bg-error text-inverted`},{color:`primary`,variant:`outline`,class:`text-primary ring ring-inset ring-primary/50`},{color:`secondary`,variant:`outline`,class:`text-secondary ring ring-inset ring-secondary/50`},{color:`success`,variant:`outline`,class:`text-success ring ring-inset ring-success/50`},{color:`info`,variant:`outline`,class:`text-info ring ring-inset ring-info/50`},{color:`warning`,variant:`outline`,class:`text-warning ring ring-inset ring-warning/50`},{color:`error`,variant:`outline`,class:`text-error ring ring-inset ring-error/50`},{color:`primary`,variant:`soft`,class:`bg-primary/10 text-primary`},{color:`secondary`,variant:`soft`,class:`bg-secondary/10 text-secondary`},{color:`success`,variant:`soft`,class:`bg-success/10 text-success`},{color:`info`,variant:`soft`,class:`bg-info/10 text-info`},{color:`warning`,variant:`soft`,class:`bg-warning/10 text-warning`},{color:`error`,variant:`soft`,class:`bg-error/10 text-error`},{color:`primary`,variant:`subtle`,class:`bg-primary/10 text-primary ring ring-inset ring-primary/25`},{color:`secondary`,variant:`subtle`,class:`bg-secondary/10 text-secondary ring ring-inset ring-secondary/25`},{color:`success`,variant:`subtle`,class:`bg-success/10 text-success ring ring-inset ring-success/25`},{color:`info`,variant:`subtle`,class:`bg-info/10 text-info ring ring-inset ring-info/25`},{color:`warning`,variant:`subtle`,class:`bg-warning/10 text-warning ring ring-inset ring-warning/25`},{color:`error`,variant:`subtle`,class:`bg-error/10 text-error ring ring-inset ring-error/25`},{color:`neutral`,variant:`solid`,class:`text-inverted bg-inverted`},{color:`neutral`,variant:`outline`,class:`ring ring-inset ring-accented text-default bg-default`},{color:`neutral`,variant:`soft`,class:`text-default bg-elevated`},{color:`neutral`,variant:`subtle`,class:`ring ring-inset ring-accented text-default bg-elevated`},{size:`xs`,square:!0,class:`p-0.5`},{size:`sm`,square:!0,class:`p-1`},{size:`md`,square:!0,class:`p-1`},{size:`lg`,square:!0,class:`p-1`},{size:`xl`,square:!0,class:`p-1`}],defaultVariants:{color:`primary`,variant:`solid`,size:`md`}},hn={__name:`Badge`,props:{as:{type:null,required:!1,default:`span`},label:{type:[String,Number],required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1}},setup(e){let t=e,n=l(),r=C(`badge`,t),i=he(),{orientation:a,size:o}=ie(t),{isLeading:s,isTrailing:c,leadingIconName:d,trailingIconName:f}=re(r),p=W(()=>A({extend:mn,...i.ui?.badge||{}})({color:r.color,variant:r.variant,size:o.value??r.size,square:r.square||!n.default&&!r.label,fieldGroup:a.value}));return(e,t)=>(k(),H(P(h),{as:P(r).as,"data-slot":`base`,class:S(p.value.base({class:[P(r).ui?.base,P(r).class]}))},{default:D(()=>[z(e.$slots,`leading`,{ui:p.value},()=>[P(s)&&P(d)?(k(),H(U,{key:0,name:P(d),"data-slot":`leadingIcon`,class:S(p.value.leadingIcon({class:P(r).ui?.leadingIcon}))},null,8,[`name`,`class`])):P(r).avatar?(k(),H(te,L({key:1,size:P(r).ui?.leadingAvatarSize||p.value.leadingAvatarSize()},P(r).avatar,{"data-slot":`leadingAvatar`,class:p.value.leadingAvatar({class:P(r).ui?.leadingAvatar})}),null,16,[`size`,`class`])):w(``,!0)]),z(e.$slots,`default`,{ui:p.value},()=>[P(r).label!==void 0&&P(r).label!==null?(k(),u(`span`,{key:0,"data-slot":`label`,class:S(p.value.label({class:P(r).ui?.label}))},y(P(r).label),3)):w(``,!0)]),z(e.$slots,`trailing`,{ui:p.value},()=>[P(c)&&P(f)?(k(),H(U,{key:0,name:P(f),"data-slot":`trailingIcon`,class:S(p.value.trailingIcon({class:P(r).ui?.trailingIcon}))},null,8,[`name`,`class`])):w(``,!0)])]),_:3},8,[`as`,`class`]))}},gn={slots:{root:`flex items-center gap-2`,list:`relative flex p-1 group`,indicator:`absolute transition-[translate,width] duration-200 ease-out motion-reduce:transition-none`,trigger:[`group relative inline-flex items-center min-w-0 data-[state=inactive]:text-muted hover:data-[state=inactive]:not-disabled:text-default font-medium rounded-md disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leadingIcon:`shrink-0`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,label:`truncate`,trailingBadge:`shrink-0`,trailingBadgeSize:`sm`,content:`w-full rounded-md focus-visible:outline-3`},variants:{color:{primary:{content:`outline-primary/25`},secondary:{content:`outline-secondary/25`},success:{content:`outline-success/25`},info:{content:`outline-info/25`},warning:{content:`outline-warning/25`},error:{content:`outline-error/25`},neutral:{content:`outline-inverted/25`}},variant:{pill:{list:`bg-elevated rounded-lg`,trigger:[`grow`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-md in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:shadow-xs in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:isolate`],indicator:`rounded-md shadow-xs`},link:{list:`border-default`,indicator:`rounded-full`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:rounded-full`}},orientation:{horizontal:{root:`flex-col`,list:`w-full`,indicator:`left-0 w-(--reka-tabs-indicator-size) translate-x-(--reka-tabs-indicator-position)`,trigger:`justify-center`},vertical:{list:`flex-col`,indicator:`top-0 h-(--reka-tabs-indicator-size) translate-y-(--reka-tabs-indicator-position)`}},size:{xs:{trigger:`px-2 py-1 text-xs gap-1`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},sm:{trigger:`px-2.5 py-1.5 text-xs gap-1.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`},md:{trigger:`px-3 py-1.5 text-sm gap-1.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},lg:{trigger:`px-3 py-2 text-sm gap-2`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`},xl:{trigger:`px-3 py-2 text-base gap-2`,leadingIcon:`size-6`,leadingAvatarSize:`xs`}}},compoundVariants:[{orientation:`horizontal`,variant:`pill`,class:{indicator:`inset-y-1`}},{orientation:`horizontal`,variant:`link`,class:{list:`border-b -mb-px`,indicator:`-bottom-px h-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-x-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-bottom-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-px`}},{orientation:`vertical`,variant:`pill`,class:{indicator:`inset-x-1`,list:`items-center`,trigger:`w-full justify-center`}},{orientation:`vertical`,variant:`link`,class:{list:`border-s -ms-px`,indicator:`-start-px w-px`,trigger:`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:inset-y-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:-start-[calc(var(--spacing)+1px)] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-px`}},{color:`primary`,variant:`pill`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-inverted outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-primary`]}},{color:`secondary`,variant:`pill`,class:{indicator:`bg-secondary`,trigger:[`data-[state=active]:text-inverted outline-secondary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-secondary`]}},{color:`success`,variant:`pill`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-inverted outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-success`]}},{color:`info`,variant:`pill`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-inverted outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-info`]}},{color:`warning`,variant:`pill`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-inverted outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning`]}},{color:`error`,variant:`pill`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-inverted outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-error`]}},{color:`neutral`,variant:`pill`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-inverted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-inverted`]}},{color:`primary`,variant:`link`,class:{indicator:`bg-primary`,trigger:[`data-[state=active]:text-primary outline-primary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-primary`]}},{color:`secondary`,variant:`link`,class:{indicator:`bg-secondary`,trigger:[`data-[state=active]:text-secondary outline-secondary/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-secondary`]}},{color:`success`,variant:`link`,class:{indicator:`bg-success`,trigger:[`data-[state=active]:text-success outline-success/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-success`]}},{color:`info`,variant:`link`,class:{indicator:`bg-info`,trigger:[`data-[state=active]:text-info outline-info/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-info`]}},{color:`warning`,variant:`link`,class:{indicator:`bg-warning`,trigger:[`data-[state=active]:text-warning outline-warning/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning`]}},{color:`error`,variant:`link`,class:{indicator:`bg-error`,trigger:[`data-[state=active]:text-error outline-error/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-error`]}},{color:`neutral`,variant:`link`,class:{indicator:`bg-inverted`,trigger:[`data-[state=active]:text-highlighted outline-inverted/25 focus-visible:outline-3`,`in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-inverted`]}}],defaultVariants:{color:`primary`,variant:`pill`,size:`md`}},_n={__name:`Tabs`,props:{as:{type:null,required:!1},items:{type:Array,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},content:{type:Boolean,required:!1,default:!0},valueKey:{type:null,required:!1,default:`value`},labelKey:{type:null,required:!1,default:`label`},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultValue:{type:[String,Number],required:!1,default:`0`},modelValue:{type:[String,Number],required:!1},activationMode:{type:String,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=l(),o=C(`tabs`,r),s=he(),p=B(f(o,`as`,`unmountOnHide`),i),m=W(()=>A({extend:gn,...s.ui?.tabs||{}})({color:o.color,variant:o.variant,size:o.size,orientation:o.orientation})),h=V([]);function g(e,t){h.value[e]=t}return t({triggersRef:h}),(e,t)=>(k(),H(P(gt),L(P(p),{"model-value":P(o).modelValue,"default-value":P(o).defaultValue,orientation:P(o).orientation,"activation-mode":P(o).activationMode,"data-slot":`root`,class:m.value.root({class:[P(o).ui?.root,P(o).class]})}),{default:D(()=>[c(P(bt),{"data-slot":`list`,class:S(m.value.list({class:P(o).ui?.list}))},{default:D(()=>[c(P(yt),{"data-slot":`indicator`,class:S(m.value.indicator({class:P(o).ui?.indicator}))},null,8,[`class`]),z(e.$slots,`list-leading`),(k(!0),u(I,null,d(P(o).items,(t,n)=>(k(),H(P(xt),{key:P(E)(t,P(o).valueKey)??n,ref_for:!0,ref:e=>g(n,e),value:P(E)(t,P(o).valueKey)??String(n),disabled:t.disabled,"data-slot":`trigger`,class:S(m.value.trigger({class:[P(o).ui?.trigger,t.ui?.trigger]}))},{default:D(()=>[z(e.$slots,`leading`,{item:t,index:n,ui:m.value},()=>[t.icon?(k(),H(U,{key:0,name:t.icon,"data-slot":`leadingIcon`,class:S(m.value.leadingIcon({class:[P(o).ui?.leadingIcon,t.ui?.leadingIcon]}))},null,8,[`name`,`class`])):t.avatar?(k(),H(te,L({key:1,size:t.ui?.leadingAvatarSize||P(o).ui?.leadingAvatarSize||m.value.leadingAvatarSize()},{ref_for:!0},t.avatar,{"data-slot":`leadingAvatar`,class:m.value.leadingAvatar({class:[P(o).ui?.leadingAvatar,t.ui?.leadingAvatar]})}),null,16,[`size`,`class`])):w(``,!0)]),P(E)(t,P(o).labelKey)||a.default?(k(),u(`span`,{key:0,"data-slot":`label`,class:S(m.value.label({class:[P(o).ui?.label,t.ui?.label]}))},[z(e.$slots,`default`,{item:t,index:n},()=>[F(y(P(E)(t,P(o).labelKey)),1)])],2)):w(``,!0),z(e.$slots,`trailing`,{item:t,index:n,ui:m.value},()=>[t.badge||t.badge===0?(k(),H(hn,L({key:0,color:`neutral`,variant:`outline`,size:t.ui?.trailingBadgeSize||P(o).ui?.trailingBadgeSize||m.value.trailingBadgeSize()},{ref_for:!0},typeof t.badge==`string`||typeof t.badge==`number`?{label:t.badge}:t.badge,{"data-slot":`trailingBadge`,class:m.value.trailingBadge({class:[P(o).ui?.trailingBadge,t.ui?.trailingBadge]})}),null,16,[`size`,`class`])):w(``,!0)])]),_:2},1032,[`value`,`disabled`,`class`]))),128)),z(e.$slots,`list-trailing`)]),_:3},8,[`class`]),P(o).content?(k(!0),u(I,{key:0},d(P(o).items,(t,n)=>(k(),H(P(vt),{key:P(E)(t,P(o).valueKey)??n,value:P(E)(t,P(o).valueKey)??String(n),"data-slot":`content`,class:S(m.value.content({class:[P(o).ui?.content,t.ui?.content,t.class]}))},{default:D(()=>[z(e.$slots,t.slot||`content`,{item:t,index:n,ui:m.value},()=>[F(y(t.content),1)])]),_:2},1032,[`value`,`class`]))),128)):w(``,!0)]),_:3},16,[`model-value`,`default-value`,`orientation`,`activation-mode`,`class`]))}},vn;function yn(){return vn??=De(()=>import(`./dist-DfbEpHXR.js`),__vite__mapDeps([0,1,2,3,4])),vn}var bn={key:0,class:`overflow-x-auto rounded-lg border border-(--ui-border) p-3 font-mono text-xs whitespace-pre text-(--ui-text)`,"data-testid":`diff-raw`},xn=b({__name:`FileDiffs`,props:{diff:{},theme:{},diffStyle:{}},setup(e){let t=e,n=V(null),r=V(!1),i=[],a=0;function o(){for(let e of i)try{e.cleanUp()}catch{}i=[],n.value&&(n.value.innerHTML=``)}async function s(){let e=++a;r.value=!1;try{let{FileDiff:r,parsePatchFiles:s}=await yn();if(e!==a||!n.value)return;o();let c=s(t.diff).flatMap(e=>e.files);for(let e of c){let a=document.createElement(`diffs-container`);a.dataset.file=e.name,n.value.appendChild(a);let o=new r({themeType:t.theme,diffStyle:t.diffStyle??`unified`});o.render({fileDiff:e,fileContainer:a}),i.push(o)}}catch{e===a&&(r.value=!0)}}return M(s),m(()=>t.diff,s),m(()=>t.theme,s),m(()=>t.diffStyle,s),ae(()=>{a++,o()}),(t,i)=>r.value?(k(),u(`pre`,bn,y(e.diff),1)):(k(),u(`div`,{key:1,ref_key:`container`,ref:n,class:`space-y-4`,"data-testid":`file-diffs`},null,512))}});async function Sn(e){let{parsePatchFiles:t}=await yn(),n=t(e).flatMap(e=>e.files).map(e=>({path:e.name,additions:e.hunks.reduce((e,t)=>e+t.additionLines,0),deletions:e.hunks.reduce((e,t)=>e+t.deletionLines,0)}));return{files:n,additions:n.reduce((e,t)=>e+t.additions,0),deletions:n.reduce((e,t)=>e+t.deletions,0)}}function Cn(e,t){if(e.length<=t)return e;let n=Math.max(1,t-1),r=Math.ceil(n/2),i=Math.floor(n/2);return`${e.slice(0,r)}…${e.slice(e.length-i)}`}var wn={dockerfile:`docker`,makefile:`makefile`,"go.mod":`go`,"go.sum":`go`,".gitignore":`gitignore`,".dockerignore":`dockerignore`},Tn={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,vue:`vue`,svelte:`svelte`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,scala:`scala`,ex:`elixir`,exs:`elixir`,json:`json`,jsonc:`json`,yaml:`yaml`,yml:`yaml`,toml:`toml`,xml:`xml`,html:`html`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,md:`markdown`,mdx:`mdx`,sh:`bash`,bash:`bash`,zsh:`zsh`,sql:`sql`,tf:`terraform`,hcl:`hcl`,dockerfile:`docker`};function En(e){let t=(e.split(`/`).pop()||e).toLowerCase(),n=wn[t];if(n)return n;let r=t.lastIndexOf(`.`);return r===-1?`text`:Tn[t.slice(r+1)]??`text`}var Dn={javascript:`i-simple-icons-javascript`,typescript:`i-simple-icons-typescript`,vue:`i-simple-icons-vuedotjs`,jsx:`i-simple-icons-react`,tsx:`i-simple-icons-react`,svelte:`i-simple-icons-svelte`,html:`i-simple-icons-html5`,css:`i-simple-icons-css`,scss:`i-simple-icons-sass`,sass:`i-simple-icons-sass`,less:`i-simple-icons-less`,python:`i-simple-icons-python`,go:`i-simple-icons-go`,rust:`i-simple-icons-rust`,java:`i-simple-icons-openjdk`,c:`i-simple-icons-c`,cpp:`i-simple-icons-cplusplus`,csharp:`i-simple-icons-csharp`,php:`i-simple-icons-php`,ruby:`i-simple-icons-ruby`,elixir:`i-simple-icons-elixir`,scala:`i-simple-icons-scala`,swift:`i-simple-icons-swift`,kotlin:`i-simple-icons-kotlin`,json:`i-simple-icons-json`,yaml:`i-simple-icons-yaml`,toml:`i-simple-icons-toml`,xml:`i-simple-icons-xml`,sql:`i-lucide-database`,markdown:`i-simple-icons-markdown`,mdx:`i-simple-icons-mdx`,bash:`i-simple-icons-gnubash`,zsh:`i-simple-icons-gnubash`,docker:`i-simple-icons-docker`,dockerignore:`i-simple-icons-docker`,terraform:`i-simple-icons-terraform`,hcl:`i-simple-icons-terraform`,makefile:`i-lucide-hammer`,gitignore:`i-simple-icons-git`,text:`i-lucide-file-text`};function On(e){return Dn[e]??Dn.text}function kn(e){return On(En(e))}var An={key:0,class:`flex items-center gap-2 p-4 text-sm text-(--ui-text-muted) sm:p-5`,"data-testid":`files-loading`},jn={key:1,class:`p-4 text-sm text-(--ui-text-muted) sm:p-5`,"data-testid":`no-files`},Mn={class:`shrink-0 border-b border-(--ui-border) @2xl:w-72 @2xl:border-b-0 @2xl:border-r`,"data-testid":`file-list`},Nn={class:`@2xl:sticky @2xl:top-0 @2xl:max-h-[calc(100dvh-11rem)] @2xl:overflow-y-auto @2xl:py-3`},Pn=[`aria-expanded`],Fn={class:`ml-auto tabular-nums`,"data-testid":`pr-totals`},In={class:`text-(--ui-success)`},Ln={class:`text-(--ui-error)`},Rn={key:1,class:`flex items-center justify-between gap-2 px-3 pb-2 text-xs text-(--ui-text-dimmed)`},zn={"data-testid":`file-count`},Bn={class:`tabular-nums`,"data-testid":`pr-totals`},Vn={class:`text-(--ui-success)`},Hn={class:`text-(--ui-error)`},Un=[`title`,`aria-current`,`onClick`],Wn={class:`min-w-0 flex-1 whitespace-nowrap`},Gn={class:`shrink-0 text-[11px] tabular-nums`},Kn={class:`text-(--ui-success)`},qn={class:`text-(--ui-error)`},Jn=34,Yn=b({__name:`FilesChanged`,props:{diff:{},notes:{},diffStyle:{}},setup(e){let t=e,n=ge(),r=W(()=>n.value===`dark`?`dark`:`light`),i=V([]),a=V(!0),o=V(null),s=T(`panel`),l=T(`root`),{width:f}=le(l);m(l,e=>{e&&(f.value=e.getBoundingClientRect().width)});let p=W(()=>f.value>0&&f.value<672),h=V(!1),g=W(()=>p.value?`unified`:t.diffStyle??`unified`),_=0;async function v(){let e=++_;a.value=!0;let n=await Sn(t.diff);e===_&&(i.value=n.files,o.value=null,a.value=!1)}m(()=>t.diff,v,{immediate:!0});let b=W(()=>i.value.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}));function x(e){o.value=e,p.value&&(h.value=!1);let t=s.value?.querySelectorAll(`[data-file]`)??[];Array.from(t).find(t=>t.dataset.file===e)?.scrollIntoView({block:`start`,behavior:`smooth`})}return(t,n)=>{let f=U;return a.value?(k(),u(`div`,An,[c(f,{name:`i-lucide-loader-circle`,class:`size-4 animate-spin`}),n[1]||=j(`span`,null,`Loading diff…`,-1)])):i.value.length===0?(k(),u(`p`,jn,` Nothing in this diff parsed as a file. `)):(k(),u(`div`,{key:2,ref_key:`root`,ref:l,class:`@container flex min-h-full flex-col @2xl:flex-row`,"data-testid":`files-changed`},[j(`aside`,Mn,[j(`div`,Nn,[p.value?(k(),u(`button`,{key:0,type:`button`,class:`flex w-full items-center gap-2 px-3 py-2.5 text-xs text-(--ui-text-muted)`,"aria-expanded":h.value,"data-testid":`files-fold`,onClick:n[0]||=e=>h.value=!h.value},[c(f,{name:h.value?`i-lucide-chevron-down`:`i-lucide-chevron-right`,class:`size-3.5 shrink-0 text-(--ui-text-dimmed)`},null,8,[`name`]),j(`span`,null,y(i.value.length)+` `+y(i.value.length===1?`file`:`files`)+` changed`,1),j(`span`,Fn,[j(`span`,In,`+`+y(b.value.additions),1),j(`span`,Ln,`−`+y(b.value.deletions),1)])],8,Pn)):(k(),u(`div`,Rn,[j(`span`,zn,y(i.value.length)+` `+y(i.value.length===1?`file`:`files`),1),j(`span`,Bn,[j(`span`,Vn,`+`+y(b.value.additions),1),j(`span`,Hn,`−`+y(b.value.deletions),1)])])),!p.value||h.value?(k(),u(`ul`,{key:2,class:S([`flex flex-col`,p.value?`pb-2`:``])},[(k(!0),u(I,null,d(i.value,e=>(k(),u(`li`,{key:e.path},[j(`button`,{type:`button`,class:S([`flex w-full min-w-0 items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-accented/50 dark:hover:bg-(--ui-bg)`,o.value===e.path?`bg-accented/50 text-(--ui-text) dark:bg-(--ui-bg)`:`text-(--ui-text-muted)`]),title:e.path,"aria-current":o.value===e.path?`true`:void 0,"data-testid":`file-entry`,onClick:t=>x(e.path)},[c(f,{name:P(kn)(e.path),class:`size-3.5 shrink-0`},null,8,[`name`]),j(`span`,Wn,y(P(Cn)(e.path,Jn)),1),j(`span`,Gn,[j(`span`,Kn,`+`+y(e.additions),1),j(`span`,qn,`−`+y(e.deletions),1)])],10,Un)]))),128))],2)):w(``,!0)])]),j(`div`,{ref_key:`panel`,ref:s,class:`min-w-0 flex-1 overflow-x-auto`,"data-testid":`diff-column`},[(k(!0),u(I,null,d(e.notes,e=>(k(),u(`p`,{key:e,class:`px-3 pt-3 text-xs text-(--ui-text-muted)`,"data-testid":`diff-note`},y(e),1))),128)),c(xn,{diff:e.diff,theme:r.value,"diff-style":g.value},null,8,[`diff`,`theme`,`diff-style`])],512)],512))}}}),Xn=b({__name:`LabelTip`,props:{text:{},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>{let r=xe;return k(),H(r,{text:e.text,disabled:e.disabled,"delay-duration":250,content:{side:`bottom`,align:`end`,sideOffset:6,collisionPadding:8},ui:{content:`h-auto max-w-[28rem] px-2.5 py-1.5`,text:`text-clip whitespace-normal leading-snug`}},{default:D(()=>[z(t.$slots,`default`)]),_:3},8,[`text`,`disabled`])}}}),Zn={class:`pr-review-panel @container flex h-full min-h-0 min-w-0 flex-col`,"data-testid":`pr-review-panel`},Qn={class:`shrink-0 border-b border-(--ui-border) px-4 pt-5 pb-4 sm:px-6`},$n={class:`flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4`},er={class:`min-w-0`},tr={class:`line-clamp-2 text-lg leading-snug font-semibold text-(--ui-text) @2xl:line-clamp-none @2xl:truncate`,"data-testid":`pr-title`},nr={class:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-(--ui-text-muted)`,"data-testid":`pr-facts`},rr=[`href`],ir={key:1,class:`inline-flex items-center gap-1.5`},ar=[`href`],or={title:`the base the diff is against`},sr={"data-testid":`producer-label`},cr={class:`inline-flex items-center gap-1 text-(--ui-warning)`,"data-testid":`truncated-label`},lr={class:`flex shrink-0 flex-wrap items-center gap-2`},ur={key:1,class:`inline-flex shrink-0 items-center gap-1.5 text-xs text-(--ui-text-muted)`,"data-testid":`abridge-running`},dr={key:2,class:`inline-flex min-w-0 shrink items-center gap-1.5 text-xs text-(--ui-error)`,"data-testid":`abridge-failed`},fr=[`title`],pr={key:0,class:`flex shrink-0 items-center justify-between gap-3 border-b border-(--ui-border) px-4 py-2 sm:px-6`},mr={class:`tabs-scroll min-w-0 overflow-x-auto`},hr={class:`min-h-0 flex-1 overflow-y-auto`},gr={key:1,class:`mx-auto max-w-3xl p-4 sm:p-6`,"data-testid":`pr-description`},_r={key:2,class:`mt-4 text-xs text-(--ui-text-dimmed) italic`,"data-testid":`description-origin`},vr={key:2,class:`px-4 py-3 text-sm text-(--ui-text-muted) sm:px-6`,"data-testid":`no-diff`},yr=`switchboard:diffStyle`,br=`Abridge the full diff with meat.dev: a model keeps the concepts and drops what a reviewer need not read. One model call; usually a minute or three.`,xr=b({__name:`PrReviewPanel`,props:{data:{},closable:{type:Boolean,default:!1},abridge:{default:void 0}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>Zt(n.data.pr)),a=W(()=>Jt(n.data)),o=W(()=>n.data.readingDiffs),s=W(()=>n.data.description),l=W(()=>o.value.find(e=>e.poweredBy===`git`)),d=W(()=>o.value.find(e=>e.poweredBy===`meat`)),f=W(()=>n.data.pr.headSha?.slice(0,7)),p=W(()=>{let e=[];return l.value&&e.push({label:`Files changed`,value:`files`}),d.value&&e.push({label:`Reading diff`,value:`reading`}),(s.value?.tldr||s.value?.why)&&e.push({label:`Description`,value:`description`}),e}),h=()=>Qt(o.value)?.poweredBy===`meat`?`reading`:`files`,g=V(h());m(()=>Qt(o.value),()=>g.value=h()),m(p,e=>{e.some(e=>e.value===g.value)||(g.value=e[0]?.value??`files`)},{immediate:!0});let _=W(()=>g.value===`files`?l.value:g.value===`reading`?d.value:void 0),v=W(()=>{let e=_.value;if(!e)return[];let t=[];return e.summary&&t.push(e.summary),e.truncated&&t.push(`${en(e.diff.length)}.`),t}),b=W(()=>s.value?nn(s.value):void 0),x=[{label:`Inline`,value:`unified`,icon:`i-lucide-rows-3`},{label:`Side by side`,value:`split`,icon:`i-lucide-columns-2`}],S=V(`unified`);M(()=>{try{localStorage.getItem(yr)===`split`&&(S.value=`split`)}catch{}});function C(e){S.value=e===`split`?`split`:`unified`;try{localStorage.setItem(yr,S.value)}catch{}}let ee=W(()=>n.abridge!==void 0&&n.abridge.state.state!==`done`&&l.value!==void 0&&!d.value);return(t,n)=>{let o=U,l=ce,d=_n;return k(),u(`div`,Zn,[j(`header`,Qn,[j(`div`,$n,[j(`div`,er,[j(`h1`,tr,y(a.value),1),j(`div`,nr,[i.value.pr?(k(),u(`a`,{key:0,href:i.value.pr,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center gap-1.5 hover:text-(--ui-text)`,"data-testid":`pr-link`},[c(o,{name:`i-simple-icons-github`,class:`size-3.5 shrink-0`}),j(`span`,null,y(e.data.pr.repo)+`#`+y(e.data.pr.number),1)],8,rr)):e.data.pr.repo?(k(),u(`span`,ir,[c(o,{name:`i-simple-icons-github`,class:`size-3.5 shrink-0`}),j(`span`,null,y(e.data.pr.repo),1)])):w(``,!0),i.value.commit?(k(),u(`a`,{key:2,href:i.value.commit,target:`_blank`,rel:`noopener noreferrer`,class:`font-mono hover:text-(--ui-text)`,"data-testid":`commit-link`},y(f.value),9,ar)):w(``,!0),_.value?(k(),u(I,{key:3},[j(`span`,or,`against origin/`+y(_.value.baseRef),1),c(Xn,{text:P($t)(_.value.poweredBy)},{default:D(()=>[j(`span`,sr,y(P(tn)(_.value.poweredBy)),1)]),_:1},8,[`text`]),_.value.truncated?(k(),H(Xn,{key:0,text:P(en)(_.value.diff.length)},{default:D(()=>[j(`span`,cr,[c(o,{name:`i-lucide-scissors`,class:`size-3.5`}),n[4]||=F(`truncated `,-1)])]),_:1},8,[`text`])):w(``,!0)],64)):w(``,!0)])]),j(`div`,lr,[i.value.pr?(k(),H(l,{key:0,label:`View on GitHub`,icon:`i-simple-icons-github`,color:`neutral`,variant:`ghost`,size:`sm`,to:i.value.pr,target:`_blank`,"data-testid":`github-button`},null,8,[`to`])):w(``,!0),ee.value&&e.abridge?(k(),u(I,{key:1},[e.abridge.state.state===`absent`?(k(),H(Xn,{key:0,text:br},{default:D(()=>[c(l,{label:`Abridge with meat`,icon:`i-lucide-scissors`,size:`sm`,"data-testid":`abridge-button`,onClick:n[0]||=t=>e.abridge.start()})]),_:1})):e.abridge.state.state===`running`?(k(),u(`span`,ur,[c(o,{name:`i-lucide-loader-circle`,class:`size-3.5 animate-spin`}),n[5]||=F(` Abridging… usually 1–3 minutes `,-1)])):e.abridge.state.state===`failed`?(k(),u(`span`,dr,[c(o,{name:`i-lucide-circle-alert`,class:`size-3.5 shrink-0`}),j(`span`,{class:`truncate`,title:e.abridge.state.reason},`Abridging failed: `+y(e.abridge.state.reason),9,fr),c(l,{size:`xs`,color:`neutral`,variant:`outline`,label:`Retry`,"data-testid":`abridge-retry`,onClick:n[1]||=t=>e.abridge.start()})])):w(``,!0)],64)):w(``,!0),e.closable?(k(),H(l,{key:2,icon:`i-lucide-x`,color:`neutral`,variant:`ghost`,size:`sm`,"aria-label":`Close`,"data-testid":`panel-close`,onClick:n[2]||=e=>r(`close`)})):w(``,!0)])])]),p.value.length>0?(k(),u(`div`,pr,[j(`div`,mr,[c(d,{modelValue:g.value,"onUpdate:modelValue":n[3]||=e=>g.value=e,items:p.value,size:`sm`,class:`w-fit gap-0`,content:!1,"data-testid":`panel-tabs`},null,8,[`modelValue`,`items`])]),_.value?(k(),H(d,{key:0,"model-value":S.value,items:x,color:`neutral`,size:`xs`,content:!1,class:`hidden w-fit @2xl:flex`,"data-testid":`diff-style`,"onUpdate:modelValue":C},null,8,[`model-value`])):w(``,!0)])):w(``,!0),j(`div`,hr,[_.value?(k(),H(Yn,{key:_.value.poweredBy,diff:_.value.diff,notes:v.value,"diff-style":S.value},null,8,[`diff`,`notes`,`diff-style`])):g.value===`description`&&s.value?(k(),u(`div`,gr,[n[7]||=j(`div`,{class:`mb-2 text-xs font-medium text-(--ui-text-dimmed)`},`What the pull request says about itself`,-1),s.value.tldr?(k(),H(K,{key:0,text:s.value.tldr,class:`text-sm`,"data-testid":`description-tldr`},null,8,[`text`])):w(``,!0),s.value.why?(k(),u(I,{key:1},[n[6]||=j(`div`,{class:`mt-4 mb-2 text-xs font-medium text-(--ui-text-dimmed)`},`Why`,-1),c(K,{text:s.value.why,class:`text-sm`,"data-testid":`description-why`},null,8,[`text`])],64)):w(``,!0),b.value?(k(),u(`p`,_r,y(b.value),1)):w(``,!0)])):(k(),u(`p`,vr,` No reading diff was produced for this review. `))])])}}}),Sr={class:`conn flex items-center gap-2 font-mono`},Cr={key:0,class:`ok text-ok`,role:`img`,"aria-label":`succeeded`},wr=[`data-heat`],Tr=[`title`],Er={key:3,id:`delivery`,class:`text-xs text-muted`},Dr=[`title`],Or={key:0,id:`actions`,class:`actions flex gap-1.5`},kr={class:`mx-auto max-w-6xl`},Ar={key:0,id:`runmeta`,class:`runmeta facts mb-3 flex flex-wrap items-baseline gap-x-3 gap-y-1.5 px-(--sb-gutter) font-mono text-xs text-dimmed`},jr={class:`agent text-[0.68rem] font-medium uppercase tracking-wider text-toned`},Mr={class:`model`},Nr={key:0,class:`effort`},Pr={key:1,class:`harness`},Fr=[`href`],Ir={key:3,class:`repo`},Lr=[`href`],Rr={key:5,class:`reftag rounded border border-accented px-1.5 text-[0.75rem] text-toned`},zr=[`href`,`title`],Br=[`href`],Vr={key:1,id:`request`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},Hr={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},Ur={key:0,class:`source flex items-center gap-2 font-normal normal-case tracking-normal text-dimmed`},Wr=[`href`],Gr={key:1},Kr={key:1},qr=[`href`],Jr=[`title`],Yr={key:5,id:`references`,class:`group mb-4 px-(--sb-gutter)`},Xr={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted hover:text-toned [&::-webkit-details-marker]:hidden`},Zr={class:`count font-normal normal-case tracking-normal text-dimmed`},Qr={id:`referencedthreads`,class:`pb-1 pl-5`},$r={class:`flex items-baseline gap-2 font-mono text-xs text-dimmed`},ei=[`href`],ti=[`title`],ni={class:`quoted mt-1 whitespace-pre-wrap break-words font-mono text-xs opacity-85`},ri={key:6,id:`context`,class:`group mb-4 px-(--sb-gutter)`},ii={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted hover:text-toned [&::-webkit-details-marker]:hidden`},ai={class:`count font-normal normal-case tracking-normal text-dimmed`},oi={id:`contextturns`,class:`pb-1 pl-5`},si=[`title`],ci={id:`thisrun`,class:`mb-2 flex items-baseline gap-2.5 px-(--sb-gutter) font-mono text-xs font-medium uppercase tracking-wider text-muted`},li={key:0,class:`count font-normal normal-case tracking-normal text-dimmed`},ui=[`aria-pressed`,`data-open`,`title`],di={id:`log`,class:`m-0 list-none p-0`},fi={key:0,id:`placeholder`,class:`empty text-muted`},pi=[`id`],mi={class:`meta flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 pr-(--sb-gutter) font-mono text-xs tabular-nums text-dimmed`},hi=[`title`],gi=[`title`],_i=[`title`],vi=[`href`],yi={key:3,class:`nonar font-sans italic`},bi=[`title`],xi=[`data-phase`],Si=[`aria-expanded`,`onClick`],Ci={class:`glyph select-none text-dimmed`},wi={class:`what`},Ti={key:0,class:`m-0 list-none p-0 pl-4`},Ei={key:4,class:`followup block mt-5 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},Di={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},Oi={key:0,class:`source flex items-center gap-2 font-normal normal-case tracking-normal text-dimmed`},ki=[`href`],Ai={key:1},ji=[`title`],Mi={key:5,class:`mt-5`},Ni=[`open`],Pi={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted hover:text-toned [&::-webkit-details-marker]:hidden`},Fi={key:0,class:`font-normal normal-case tracking-normal text-dimmed`},Ii=[`title`],Li=[`title`],Ri=b({__name:`RunPage`,setup(e){let t=de(`run`),n=t?.mode===`history`,r=n?`Run`:`Live run`,i=n,o=t?.artifacts??null,s=t?.children??[],l=(t?.mode===`history`?t.units:void 0)??[],f=t?.mode===`history`?t.findingsLedger:void 0,p=W(()=>f?`/runs/unit/${encodeURIComponent(f.unit)}#findings`:void 0),h=typeof window<`u`?new URLSearchParams(window.location.search).get(`open`):null,_=Je({openTags:h?h.split(`,`).map(e=>e.trim()).filter(Boolean):void 0});t?.mode===`live`&&_.seedClock(t.serverNow);let v=_.state,b=V(n?`ended`:`connecting`),x=V(``),C=Ae(),T=t?.mode===`live`?rt(t,C.value):null,E=V(void 0),O=V({}),te=W(()=>{if(n&&t?.mode===`history`)return t.status===`completed`?{ok:!0,cls:``,word:`succeeded`}:t.provisional?{ok:!1,cls:`amber`,word:Fe}:{ok:!1,cls:t.status===`failed`||t.status===`stopped_hard`||t.status===`interrupted`?`red`:t.status===`stopped_soft`?`amber`:`grey`,word:t.status?Me(t.status):`ended`};let e=v.stopMode;return{ok:!1,cls:e===`hard`?`red`:e===`soft`?`amber`:`grey`,word:e===`hard`?`killed`:e===`soft`?`stopped early`:`ended`}}),A=W(()=>n&&t?.mode===`history`?t.durationMs:E.value),ne=W(()=>$e(n&&t?.mode===`history`?{finishedAt:t.finishedAt,sealedAt:t.sealedAt,replyOk:t.replyOk}:O.value)),re=W(()=>A.value===void 0?``:Ne(A.value,`clock`)),N=W(()=>n&&t?.mode===`history`?t.cost:void 0),ie=e=>e===null?`unpriced`:Re(e),oe=W(()=>N.value?ie(N.value.usd):``),le=W(()=>N.value?Object.entries(N.value.byModel).map(([e,t])=>`${e} ${ie(t.usd)}`).join(`
|
|
9
|
-
`):void 0),ue=W(()=>He(A.value,`run`)),fe=W(()=>Ve(ue.value)),pe={red:`border-bad/30 text-bad`,amber:`border-warn/30 text-warn`,grey:`border-accented text-muted`},L=W(()=>x.value?x.value:b.value===`connecting`?`connecting…`:b.value===`disconnected`?`disconnected`:b.value===`stopping`?`stopping (${v.stopMode??`soft`})`:b.value===`finished`?E.value===void 0?`delivering…`:`delivering… · ${Ne(E.value,`clock`)}`:T?`running · ${Ne(T.elapsedMs(C.value),`clock`)}`:`running`),he=W(()=>x.value||b.value===`disconnected`?`text-bad`:b.value===`running`?`text-ok motion-safe:animate-pulse`:b.value===`finished`?`text-ok`:`text-warn motion-safe:animate-pulse`),R=W(()=>{if(!t||t.mode!==`live`&&t.mode!==`history`)return null;v.traceVersion;let e=t.receivedAt??t.startedAt,n=ut(v.meta?.agent);if(t.mode===`history`){let r=t.durationMs??(t.finishedAt===void 0?0:Math.max(0,t.finishedAt-e));return ft({spans:_.spanSet(),losses:_.losses(e),window:{start:e,end:e+r},owner:n,totalMs:r,phase:`ended`,delivery:{finishedAt:t.finishedAt,sealedAt:t.sealedAt,replyOk:t.replyOk},...t.status?{endedBy:t.status}:{},...t.truncated===void 0?{}:{truncated:t.truncated},...t.untimed?{untimed:!0}:{},callTitle:_.callHeadline})}if(!T)return null;let r=b.value===`ended`?`ended`:b.value===`finished`?`delivering`:`live`,i=r===`live`?T.elapsedMs(C.value):E.value??T.elapsedMs(C.value);return ft({spans:_.spanSet(),losses:_.losses(e),window:{start:e,end:e+i},owner:n,totalMs:i,phase:r,delivery:O.value,...r===`ended`&&v.stopMode?{endedBy:`stopped_${v.stopMode}`}:{},callTitle:_.callHeadline})}),ge=n&&t?.mode===`history`?`/runs/${encodeURIComponent(t.id)}/events`:void 0;function ve(e){_.reveal(e)&&se().then(()=>{let t=document.getElementById(e);t&&(t.scrollIntoView?.({block:`center`}),t.classList.add(`revealed`),setTimeout(()=>t.classList.remove(`revealed`),1500))})}let z=V(n||t?.mode!==`live`||t.stopUrl===void 0),B=V(!1);function ye(e){t?.mode===`live`&&t.stopUrl!==void 0&&(e!==`hard`||_e.confirm(`Hard stop: abort the run now with no summary and free its sandbox?`))&&(B.value=!0,fetch(`${t.stopUrl}&mode=${encodeURIComponent(e)}`,{method:`POST`,credentials:`same-origin`}).then(async t=>{if(!t.ok){let e=await t.json?.().catch(()=>null);throw Error(typeof e?.message==`string`?e.message:`HTTP ${t.status}`)}G(e)}).catch(e=>{B.value=!1,x.value=`stop failed: ${e instanceof Error?e.message:`error`}`}))}function G(e){_.markStopping(e),z.value=!0,(b.value===`connecting`||b.value===`running`)&&(b.value=`stopping`)}m(()=>v.stopMode,e=>{e&&b.value!==`ended`&&b.value!==`disconnected`&&b.value!==`finished`&&G(e)}),n||m(b,e=>_e.setFavicon(e===`ended`||e===`disconnected`||e===`finished`?Ee:Oe),{immediate:!0});let De=W(()=>!n&&b.value!==`ended`&&b.value!==`disconnected`&&b.value!==`finished`),ze=W(()=>De.value?at(v,C.value):null);be(tt,ze),be(Qe,o),be(Ke,W(()=>v.reply!==null));let q=W(()=>De.value?it(v,_.pendingCall(),C.value):null),pt=W(()=>q.value?.kind===`thinking`?R.value?.openStep||Ce(q.value.elapsedMs):``);function mt(){_.setAllOpen(!v.allOpen)}let J=W(()=>v.log.filter(e=>e.kind===`step`).length),ht=W(()=>{for(let e=v.log.length-1;e>=0;e--){let t=v.log[e];if(t.kind===`note`&&t.noteKind===`notes`)return t.key}}),gt=V(null);function _t(){return window.innerHeight+window.scrollY>=document.body.scrollHeight-60}let Y=un(),vt=V(!1),yt=t?.mode===`history`&&t.capabilities.readingDiffAbridge?pn(t.id,e=>Y.handle(e)):void 0;ae(()=>yt?.dispose());function bt(e){let t=_t();_.handle(e),Y.handle(e),t&&requestAnimationFrame(()=>gt.value?.scrollIntoView?.({block:`nearest`}))}let xt=ke(),St=null;if(t?.mode===`history`){for(let e of t.events)_.handle(e),Y.handle(e);_.closePhases()}M(()=>{t?.mode===`live`&&(St=we({url:t.eventsUrl,factory:xt,model:_,handle:bt,onFinished:e=>{z.value=!0,e&&(T&&(E.value=T.elapsedAt(e.finishedAt)),O.value={...O.value,finishedAt:e.finishedAt})},onEnd:e=>{z.value=!0,E.value??=T?.elapsedMs(C.value),O.value={...O.value,...e}}}),m(St.phase,e=>{(b.value!==`stopping`||e!==`running`&&e!==`connecting`)&&(b.value=e)},{immediate:!0}))}),ae(()=>{St?.close()});function Ct(e){return e&&/^https?:\/\//.test(e)?e:``}let wt=W(()=>Ct(v.request?.source?.url)),Tt=W(()=>t&&(t.mode===`live`||t.mode===`history`)&&t.threadKey?Pe(t.threadKey):null),X=W(()=>{let e=v.meta;return{repo:ot(e?.repo),tree:We(e?.repo,e?.ref),commit:st(e?.repo,e?.headSha),pr:qe(e?.repo,e?.pr)}}),Dt=W(()=>{let e=v.meta;if(!e?.harness)return``;let t=e.harnessScope===`defaults`?`defaults`:e.harnessScope?`${e.harnessScope} scope`:``;return t?`${e.harness} harness (${t})`:`${e.harness} harness`}),Ot=W(()=>Ge({meta:v.meta,requestText:v.request?.text??``,prOpened:v.prOpened}));function Z(e){return typeof e==`number`?je(e,C.value):``}function Q(e){return typeof e==`number`?Ie(e):void 0}return(e,t)=>{let n=ee(`RouterLink`),o=ce,m=xe,h=U,T=Se;return k(),H(a,{title:P(r),nav:`runs`},{leading:D(()=>[c(n,{class:`back text-sm text-primary no-underline hover:underline`,to:`/runs`},{default:D(()=>[...t[4]||=[F(`← All runs`,-1)]]),_:1})]),status:D(()=>[j(`span`,Sr,[b.value===`ended`?(k(),u(I,{key:0},[te.value.ok?(k(),u(`span`,Cr,`✓`)):(k(),u(`span`,{key:1,class:S([`chip rounded border px-1.5 text-[0.7rem]`,pe[te.value.cls]])},y(te.value.word),3)),j(`span`,{id:`state`,class:S([`dur text-xs tabular-nums`,[fe.value?`heat`:`text-muted`,ue.value.level>=2?`font-medium`:``]]),style:g(fe.value),"data-heat":ue.value.level},y(re.value),15,wr),oe.value?(k(),u(`span`,{key:2,id:`cost`,class:`cost text-xs tabular-nums text-muted`,title:le.value},`· `+y(oe.value),9,Tr)):w(``,!0),ne.value?(k(),u(`span`,Er,`· `+y(ne.value),1)):w(``,!0)],64)):(k(),u(I,{key:1},[j(`span`,{id:`statedot`,class:S([`pulse text-[1.1em] leading-none`,he.value])},`∿`,2),j(`span`,{id:`state`,class:S([`text-xs tabular-nums`,x.value?`text-bad`:`text-muted`]),title:b.value===`running`&&!x.value?`the whole run, since we received the message`:b.value===`finished`?`the agent stopped; the reply is being posted`:void 0},y(L.value),11,Dr)],64))])]),actions:D(()=>[z.value?w(``,!0):(k(),u(`span`,Or,[c(m,{text:`Soft stop: no new steps, the agent writes up what it has`},{default:D(()=>[c(o,{size:`xs`,color:`neutral`,variant:`outline`,label:`Stop`,disabled:B.value,onClick:t[0]||=e=>ye(`soft`)},null,8,[`disabled`])]),_:1}),c(m,{text:`Hard stop: abort now, no summary, free the sandbox`},{default:D(()=>[c(o,{size:`xs`,color:`error`,variant:`outline`,label:`Kill`,disabled:B.value,onClick:t[1]||=e=>ye(`hard`)},null,8,[`disabled`])]),_:1})]))]),default:D(()=>[j(`div`,kr,[P(v).meta?(k(),u(`div`,Ar,[j(`span`,jr,y(P(v).meta.agent),1),j(`span`,Mr,y(P(v).meta.model),1),P(v).meta.effort?(k(),u(`span`,Nr,y(P(v).meta.effort)+` effort`,1)):w(``,!0),Dt.value?(k(),u(`span`,Pr,y(Dt.value),1)):w(``,!0),X.value.repo?(k(),u(`a`,{key:2,class:`text-primary no-underline hover:underline`,href:X.value.repo,target:`_blank`,rel:`noopener noreferrer`},y(P(v).meta.repo),9,Fr)):P(v).meta.repo?(k(),u(`span`,Ir,y(P(v).meta.repo),1)):w(``,!0),X.value.tree?(k(),u(`a`,{key:4,class:`reftag rounded border border-accented px-1.5 text-[0.75rem] text-toned no-underline hover:border-primary hover:text-primary`,href:X.value.tree,target:`_blank`,rel:`noopener noreferrer`,title:`the branch on GitHub`},y(P(v).meta.ref),9,Lr)):P(v).meta.ref?(k(),u(`span`,Rr,y(P(v).meta.ref),1)):w(``,!0),X.value.commit&&P(v).meta.headSha?(k(),u(`a`,{key:6,class:`sha tabular-nums text-toned no-underline hover:text-primary hover:underline`,href:X.value.commit,target:`_blank`,rel:`noopener noreferrer`,title:`the head commit ${P(v).meta.headSha}`},y(P(Ue)(P(v).meta.headSha)),9,zr)):w(``,!0),X.value.pr?(k(),u(`a`,{key:7,class:`prlink whitespace-nowrap text-primary no-underline hover:underline`,href:X.value.pr,target:`_blank`,rel:`noopener noreferrer`},[c(dt,{class:`mr-1 align-[-0.125em]`}),F(`#`+y(P(v).meta.pr),1)],8,Br)):w(``,!0),p.value&&P(f)?(k(),H(n,{key:8,class:`findings whitespace-nowrap text-primary no-underline hover:underline`,to:p.value,title:`the pull request's findings ledger on its unit's page`},{default:D(()=>[F(`Findings · `+y(P(f).rows),1)]),_:1},8,[`to`])):w(``,!0),P(Y).state.ready?(k(),u(`button`,{key:9,type:`button`,class:`reading-diff ml-auto inline-flex cursor-pointer items-center gap-1 whitespace-nowrap text-primary hover:underline focus-visible:outline-2 focus-visible:outline-primary`,"data-testid":`reading-diff-button`,onClick:t[2]||=e=>vt.value=!0},[c(h,{name:`i-lucide-git-compare`,class:`size-3.5 shrink-0`,"aria-hidden":`true`}),t[5]||=F(` Reading diff `,-1)])):w(``,!0)])):w(``,!0),P(v).request?(k(),u(`section`,Vr,[j(`h2`,Hr,[t[6]||=j(`span`,null,`Request`,-1),P(v).request.source?(k(),u(`span`,Ur,[P(v).request.source.channel?(k(),u(I,{key:0},[c(Be),wt.value?(k(),u(`a`,{key:0,class:`text-muted no-underline hover:text-primary hover:underline`,href:wt.value,target:`_blank`,rel:`noopener noreferrer`,title:`open the thread`},`#`+y(P(v).request.source.channel),9,Wr)):(k(),u(`span`,Gr,`#`+y(P(v).request.source.channel),1))],64)):w(``,!0),P(v).request.source.user?(k(),u(`span`,Kr,y(P(v).request.source.user),1)):w(``,!0)])):w(``,!0),Tt.value?(k(),u(`a`,{key:1,class:`thread font-normal normal-case tracking-normal text-muted no-underline hover:text-primary hover:underline`,href:Tt.value,title:`the thread this run is a turn of`,"data-testid":`thread-link`},`in thread ›`,8,qr)):w(``,!0),j(`span`,{class:`ts ml-auto select-none text-xs font-normal normal-case tracking-normal text-dimmed`,title:Q(P(v).request.at)},y(Z(P(v).request.at)),9,Jr)]),c(Et,{lines:3},{default:D(()=>[c(K,{text:P(v).request.text},null,8,[`text`])]),_:1}),P(v).request.files.length>0?(k(),H(nt,{key:0,files:P(v).request.files},null,8,[`files`])):w(``,!0)])):w(``,!0),P(v).reply&&P(i)?(k(),H(Ft,{key:2,position:`first`,text:P(v).reply.text,caption:Ot.value,when:Z(P(v).reply.at),"when-title":Q(P(v).reply.at),files:P(v).reply.files},null,8,[`text`,`caption`,`when`,`when-title`,`files`])):w(``,!0),P(l).length>0?(k(),H(Ht,{key:3,units:P(l)},null,8,[`units`])):w(``,!0),P(s).length>0?(k(),H(qt,{key:4,children:P(s),now:P(C)},null,8,[`children`,`now`])):w(``,!0),P(v).references.length>0?(k(),u(`details`,Yr,[j(`summary`,Xr,[t[7]||=j(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),j(`span`,null,`Referenced thread`+y(P(v).references.length===1?``:`s`),1),j(`span`,Zr,`· `+y(P(v).references.length)+` thread`+y(P(v).references.length===1?``:`s`),1)]),j(`div`,Qr,[(k(!0),u(I,null,d(P(v).references,e=>(k(),u(`div`,{key:e.key,class:`reference border-t border-default py-1.5 first-of-type:border-t-0`},[j(`div`,$r,[j(`a`,{class:`text-muted no-underline hover:text-primary hover:underline`,href:e.url,target:`_blank`,rel:`noopener noreferrer`},`#`+y(e.channelName),9,ei),j(`span`,null,`· `+y(e.messages)+` message`+y(e.messages===1?``:`s`),1),j(`span`,{class:`ts ml-auto shrink-0 select-none`,title:Q(e.at)},y(Z(e.at)),9,ti)]),j(`div`,ni,[(k(!0),u(I,null,d(P(Xe)(e.text),(e,t)=>(k(),u(`div`,{key:t},y(e),1))),128))])]))),128))])])):w(``,!0),P(v).context.length>0?(k(),u(`details`,ri,[j(`summary`,ii,[t[8]||=j(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),t[9]||=j(`span`,null,`Earlier in this thread`,-1),j(`span`,ai,`· `+y(P(v).context.length)+` turn`+y(P(v).context.length===1?``:`s`),1)]),j(`div`,oi,[(k(!0),u(I,null,d(P(v).context,e=>(k(),u(`div`,{key:e.key,class:`turn flex items-baseline gap-3 border-t border-default py-1.5 opacity-85 first-of-type:border-t-0`},[c(K,{text:e.text},null,8,[`text`]),j(`span`,{class:`ts ml-auto shrink-0 select-none font-mono text-xs text-dimmed`,title:Q(e.at)},y(Z(e.at)),9,si)]))),128))])])):w(``,!0),j(`h2`,ci,[t[10]||=j(`span`,null,`This run`,-1),J.value>0?(k(),u(`span`,li,`· `+y(J.value)+` step`+y(J.value===1?``:`s`),1)):w(``,!0),j(`button`,{id:`fold`,type:`button`,class:`ml-auto cursor-pointer font-normal normal-case tracking-normal text-dimmed hover:text-toned focus-visible:outline-2 focus-visible:outline-primary`,"aria-pressed":P(v).allOpen?`true`:`false`,"data-open":P(v).allOpen?`1`:`0`,title:P(v).allOpen?`Close every call card`:`Open every call card`,onClick:mt},y(P(v).allOpen?`Collapse all`:`Expand all`),9,ui)]),R.value?(k(),H(lt,{key:7,vm:R.value,"events-href":P(ge),onReveal:ve},null,8,[`vm`,`events-href`])):w(``,!0),j(`ol`,di,[P(v).placeholder?(k(),u(`li`,fi,`Waiting for activity…`)):w(``,!0),(k(!0),u(I,null,d(P(v).log,e=>(k(),u(I,{key:e.key},[e.kind===`step`?(k(),H(et,{key:0,step:e,class:`mt-5 first:mt-0`,onToggleGroup:t=>P(_).toggleGroup(e)},null,8,[`step`,`onToggleGroup`])):e.kind===`turn`?(k(),u(`li`,{key:1,id:`span-${e.turn.spanId}`,class:`turn mt-5 border-l-2 border-(--ui-border-accented)/50 pb-3 pl-3 pt-2`},[j(`div`,mi,[j(`span`,{class:S([`thought`,e.turn.quick?``:`text-warn`]),title:e.turn.label},`thought `+y(e.turn.chip),11,hi),e.turn.switched?(k(),u(`span`,{key:0,class:`model-switch order-first rounded border border-warn/40 bg-warn/10 px-1.5 font-medium text-warn`,title:`model changed: this turn ran on ${e.turn.model}`},`⇄ `+y(P(Ye)(e.turn.model)),9,gi)):e.turn.showModel?(k(),u(`span`,{key:1,class:`model-badge order-first rounded bg-accented px-1.5 text-[0.68rem] font-medium leading-normal tracking-wider text-muted`,title:e.turn.model},y(P(Ye)(e.turn.model)),9,_i)):w(``,!0),(k(!0),u(I,null,d(e.turn.facts,(e,t)=>(k(),u(`span`,{key:t,class:`fact`},y(e),1))),128)),e.note&&e.noteHref?(k(),u(`a`,{key:2,class:`nonar font-sans italic text-dimmed no-underline hover:text-primary hover:underline`,href:e.noteHref},y(e.note),9,vi)):e.note?(k(),u(`span`,yi,y(e.note),1)):w(``,!0),e.turn.at===void 0?w(``,!0):(k(),u(`span`,{key:4,class:`ts ml-auto select-none`,title:P(Ie)(e.turn.at)},y(P(Le)(e.turn.at)),9,bi))])],8,pi)):e.kind===`span`?(k(),H(kt,{key:2,item:e},null,8,[`item`])):e.kind===`phase`?(k(),u(`li`,{key:3,class:`phase py-0.5 font-mono text-xs`,"data-phase":e.phase},[j(`button`,{type:`button`,class:`phase-head flex w-full cursor-pointer items-baseline gap-2 text-left text-muted hover:text-toned`,"aria-expanded":e.open,onClick:me(t=>P(_).togglePhase(e),[`prevent`])},[j(`span`,Ci,y(e.open?`▾`:`▸`),1),j(`span`,{class:S([`swatch inline-block size-2 shrink-0 self-center rounded-[2px]`,P(ct)(e.phase)]),"aria-hidden":`true`},null,2),j(`span`,wi,y(P(Ze)(e)),1)],8,Si),e.open?(k(),u(`ul`,Ti,[(k(!0),u(I,null,d(e.rows,e=>(k(),H(kt,{key:e.key,item:e},null,8,[`item`]))),128))])):w(``,!0)],8,xi)):e.kind===`followup`?(k(),u(`li`,Ei,[j(`h2`,Di,[t[11]||=j(`span`,null,`↪ Follow-up`,-1),e.input.source?.user?(k(),u(`span`,Oi,[Ct(e.input.source.url)?(k(),u(`a`,{key:0,class:`text-muted no-underline hover:text-primary hover:underline`,href:e.input.source.url,target:`_blank`,rel:`noopener noreferrer`,title:`open the message`},y(e.input.source.user),9,ki)):(k(),u(`span`,Ai,y(e.input.source.user),1))])):w(``,!0),j(`span`,{class:`ts ml-auto select-none text-xs font-normal normal-case tracking-normal text-dimmed`,title:Q(e.input.at)},y(Z(e.input.at)),9,ji)]),c(K,{text:e.input.text},null,8,[`text`]),e.input.files.length>0?(k(),H(nt,{key:0,files:e.input.files},null,8,[`files`])):w(``,!0)])):e.noteKind===`notes`?(k(),u(`li`,Mi,[j(`details`,{class:`notepad group rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-2`,open:e.key===ht.value},[j(`summary`,Pi,[t[12]||=j(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),t[13]||=j(`span`,null,`📝 Notes for this thread`,-1),e.key===ht.value?w(``,!0):(k(),u(`span`,Fi,`· superseded`)),e.at===void 0?w(``,!0):(k(),u(`span`,{key:1,class:`ts ml-auto select-none font-normal normal-case tracking-normal text-dimmed`,title:P(Ie)(e.at)},y(P(Le)(e.at)),9,Ii))]),c(K,{text:e.text,class:`mt-1 [&_h1]:mb-1.5 [&_h1]:mt-4 [&_h1]:font-mono [&_h1]:text-xs [&_h1]:font-medium [&_h1]:uppercase [&_h1]:tracking-wider [&_h1]:text-muted [&_h2]:mb-1.5 [&_h2]:mt-4 [&_h2]:font-mono [&_h2]:text-xs [&_h2]:font-medium [&_h2]:uppercase [&_h2]:tracking-wider [&_h2]:text-muted [&_h3]:mb-1.5 [&_h3]:mt-4 [&_h3]:font-mono [&_h3]:text-xs [&_h3]:font-medium [&_h3]:uppercase [&_h3]:tracking-wider [&_h3]:text-muted [&>:first-child]:mt-1`},null,8,[`text`])],8,Ni)])):(k(),u(`li`,{key:6,class:S([`note mt-4 flex items-baseline gap-3 rounded-md pl-3 pr-(--sb-gutter) py-1.5`,e.replay?`text-dimmed`:`bg-warn/10 text-warn`])},[j(`span`,null,y((e.replay?`… `:`⏱ `)+e.text),1),e.at===void 0?w(``,!0):(k(),u(`span`,{key:0,class:`ts ml-auto select-none font-mono text-xs text-dimmed`,title:P(Ie)(e.at)},y(P(Le)(e.at)),9,Li))],2))],64))),128)),q.value?.kind===`thinking`?(k(),H(Te,{key:1,id:`thinking`,class:`ml-3.5 mt-5 first:mt-0`,verb:pt.value,"elapsed-ms":q.value.elapsedMs,slow:q.value.slow,model:P(v).model},null,8,[`verb`,`elapsed-ms`,`slow`,`model`])):w(``,!0),j(`li`,{ref_key:`logEnd`,ref:gt,"aria-hidden":`true`},null,512)]),P(v).reply&&!P(i)?(k(),H(Ft,{key:8,position:`last`,text:P(v).reply.text,caption:Ot.value,when:Z(P(v).reply.at),"when-title":Q(P(v).reply.at),files:P(v).reply.files},null,8,[`text`,`caption`,`when`,`when-title`,`files`])):w(``,!0)]),c(T,{open:vt.value,"onUpdate:open":t[3]||=e=>vt.value=e,title:P(Jt)(P(Y).state),ui:{overlay:`z-30`,content:`z-30 w-[min(96vw,90rem)] max-w-none`}},{content:D(({close:e})=>[c(xr,{data:P(Y).state,abridge:P(yt),closable:``,onClose:t=>e()},null,8,[`data`,`abridge`,`onClose`])]),_:1},8,[`open`,`title`])]),_:1},8,[`title`])}}}),zi=b({__name:`RunRoutePage`,setup(e){let t=O(pe,null);return(e,n)=>!P(t)||P(t).page===`runNotFound`?(k(),H(q,{key:0})):(k(),H(Ri,{key:1}))}});export{zi as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./AppShell-DAtHiuI6.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 te,ji as _,kn as v,l as y,ln as b,o as x,t as S,xi as C,xn as w,yi as T,yn as E}from"./browser-B6T5hjfR.js";import{t as D}from"./Tooltip-tZoum_T-.js";import{t as O}from"./InputMenu-C6aPpe30.js";import{b as k,x as A}from"./main-5Gm_1Gv8.js";import{t as j}from"./eventSource-Bj_dZf6M.js";import{t as M}from"./wallClock-DmaC1sKA.js";import{n as ne,r as N,t as re}from"./indexFormat-B-pd4r7Y.js";import{A as P,C as F,D as I,E as L,O as R,S as z,T as B,_ as V,a as H,b as U,c as W,d as G,f as K,g as q,h as ie,i as J,k as ae,l as oe,m as Y,o as se,p as ce,r as X,s as le,t as ue,u as de,v as fe,w as pe,x as me,y as he}from"./indexRow-BT0cPVRw.js";import{i as ge}from"./format-BldUwl_R.js";import{i as Z,n as _e,t as ve}from"./durationTone-U_rOqo6r.js";import{t as Q}from"./RunsTabs-YSbUu5py.js";import{t as ye}from"./StatusDot-CAfS1AUi.js";var $={class:`flex items-baseline gap-1.5 whitespace-pre-line px-2 py-1 text-xs`},be=[`data-kind`,`aria-label`,`href`],xe=[`data-kind`],Se=l({__name:`SourceMark`,props:{kind:{},tip:{},url:{}},setup(e){let t=e,n=()=>J[t.kind]??t.kind;return(t,r)=>{let a=D;return e.url?(p(),w(a,{key:0},{content:f(()=>[m(`span`,$,[e.kind===`slack`?(p(),w(Z,{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,be)]),_:1})):(p(),i(`span`,{key:1,class:`source w-[1.6em] shrink-0`,"data-kind":e.kind,"aria-hidden":`true`},null,8,xe))}}}),Ce=[`data-run-id`,`data-started-at`,`data-persisted`,`data-stalled`,`data-expires-at`],we={class:`pointer-events-auto flex items-center max-sm:order-1`},Te=[`data-user-id`,`data-surface`],Ee={class:`surface mr-1.5 inline-block w-[3.6em] rounded border border-accented text-center font-mono text-[0.62rem] text-dimmed`},De={class:`name`},Oe={key:1,class:`who shrink-0 max-sm:hidden sm:w-[14em]`,"aria-hidden":`true`},ke=[`data-agent-hue`],Ae=[`href`],je={class:`owner font-normal text-dimmed`},Me={class:`name`},Ne={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`},Pe={class:`hidden sm:contents`},Fe={class:`expires pointer-events-auto shrink-0 font-mono text-xs tabular-nums text-warn max-sm:order-11`},Ie=[`data-heat`],Le={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`},Re={class:`actions flex shrink-0 justify-end max-sm:order-5 sm:w-[2em]`},ze=l({__name:`RunRow`,props:{run:{},now:{},retentionMs:{}},setup(e){let n=e,a=E(()=>N(n.run.label||U(n.run.id))),o=E(()=>Y(n.run,a.value.scope)),l=E(()=>z(n.run)),h=E(()=>fe(n.run)),g=E(()=>I(n.run)),te=E(()=>P(n.run)),v=E(()=>he(n.run)),b=E(()=>n.run.threadKey?R(n.run.threadKey):null),x=E(()=>de(n.run,n.retentionMs)),C=E(()=>x.value!==void 0&&x.value-n.now<=864e5),O=E(()=>!n.run.finished&&!n.run.stop),k=E(()=>ve(n.run.finished&&typeof n.run.finishedAt==`number`?n.run.finishedAt-n.run.startedAt:void 0,`run`)),A=E(()=>_e(k.value)),j=E(()=>n.run.finished&&n.run.status&&n.run.status!==`completed`?F(n.run.status):``),M=E(()=>n.run.stop&&!(n.run.finished&&n.run.status)?L(n.run.stop):``),G=E(()=>ie(n.run,n.now)),K=E(()=>G.value??q(n.run,n.now)),X=E(()=>V(n.run,n.now)),Z=T({soft:!1,hard:!1}),Q=E(()=>[...b.value?[{label:`Open thread`,icon:`i-lucide-messages-square`,to:b.value}]:[],...v.value?[{label:`Open in ${J[g.value.kind]??g.value.kind}`,icon:`i-lucide-external-link`,to:v.value,target:`_blank`}]:[],...O.value?[{label:`Stop (soft)`,icon:`i-lucide-octagon-pause`,disabled:Z.soft,onSelect:()=>$(`soft`)},{label:`Kill (hard)`,icon:`i-lucide-octagon-x`,color:`error`,disabled:Z.hard,onSelect:()=>$(`hard`)}]:[]]);function $(e){(e!==`hard`||S.confirm(`Hard stop: abort this run now with no summary and free its sandbox?`))&&(Z[e]=!0,fetch(B(n.run,e),{method:`POST`,credentials:`same-origin`}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>{Z[e]=!1}))}function be(e){e.target?.closest(`a, button`)||S.navigate(h.value)}return(n,b)=>{let S=ee(`RouterLink`),T=D,E=y,O=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`,C.value?`leaving`:``]]),"data-run-id":e.run.id,"data-started-at":String(e.run.startedAt),"data-persisted":e.run.persisted?`1`:void 0,"data-stalled":X.value?`1`:void 0,"data-expires-at":x.value===void 0?void 0:String(x.value),onClick:be},[r(S,{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||_(U)(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`:``,C.value?`opacity-85`:``]])},[m(`span`,we,[r(ye,{tone:l.value,label:_(pe)(e.run),tip:_(W)(e.run),pulse:!e.run.finished},null,8,[`tone`,`label`,`tip`,`pulse`])]),r(T,{text:_(ae)(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(_(ne)(e.run.startedAt,e.now)),3)]),_:1},8,[`text`]),te.value?(p(),w(T,{key:0,text:_(me)(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`,Ee,c(g.value.kind),1),m(`span`,De,c(te.value),1)],10,Te)]),_:1},8,[`text`])):(p(),i(`span`,Oe)),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`,[_(ue)[_(H)(a.value.agent)],e.run.finished?`opacity-55`:``]]),"data-agent-hue":_(H)(a.value.agent)},c(a.value.agent),11,ke)):d(``,!0),o.value?(p(),w(T,{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`,je,c(o.value.slice(0,o.value.indexOf(`/`)+1)),1),m(`span`,Me,c(o.value.slice(o.value.indexOf(`/`)+1)),1)],8,Ae)]),_: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`,Ne,c(a.value.snippet),1)),j.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(j.value),3)):d(``,!0),M.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(M.value),3)):d(``,!0),X.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`,G.value?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},`stalled`,2)):d(``,!0),m(`span`,Pe,[r(Se,{kind:g.value.kind,tip:_(me)(e.run),url:v.value||void 0},null,8,[`kind`,`tip`,`url`])]),C.value&&x.value!==void 0?(p(),w(T,{key:9,text:`removed at ${_(ge)(x.value)}`},{default:f(()=>[m(`span`,Fe,`gone `+c(_(re)(x.value,e.now)),1)]),_:1},8,[`text`])):d(``,!0),r(T,{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?[A.value?`heat`:`text-muted`,k.value.level>=2?`font-medium`:``]:`text-ok`]),style:s(e.run.finished?A.value:void 0),"data-heat":e.run.finished?k.value.level:void 0},c(_(oe)(e.run,e.now)),15,Ie)]),_:1},8,[`text`]),b[0]||=m(`span`,{class:`hidden text-xs text-dimmed max-sm:order-8 max-sm:inline`,"aria-hidden":`true`},`·`,-1),r(T,{text:_(le)(e.run)},{default:f(()=>[m(`span`,Le,c(_(se)(e.run)),1)]),_:1},8,[`text`]),K.value?(p(),w(T,{key:10,text:_(ce)(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`,G.value?`text-bad font-medium`:X.value?`text-warn`:`text-dimmed`])},c(K.value),3)]),_:1},8,[`text`])):d(``,!0),m(`span`,Re,[Q.value.length>0?(p(),w(O,{key:0,items:Q.value,content:{align:`end`}},{default:f(()=>[r(E,{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,Ce)}}}),Be={class:`view-as-picker inline-flex items-center gap-2`},Ve={key:0,class:`ml-2 truncate font-mono text-[0.6875rem] text-dimmed`},He={class:`font-mono`},Ue={key:0,class:`text-bad`},We=l({__name:`ViewAsPicker`,props:{people:{}},setup(t){let n=t,a=C(!1),o=C(``),s=E(()=>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=O;return p(),i(`span`,Be,[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`,Ve,c(e.suffix),1)):d(``,!0)]),"create-item-label":f(({item:e})=>[t[0]||=v(` View as `,-1),m(`span`,He,c(e),1)]),_:1},8,[`items`,`disabled`]),o.value?(p(),i(`span`,Ue,c(o.value),1)):d(``,!0)])}}}),Ge={class:`conn flex items-center gap-1.5`},Ke={id:`state`,class:`text-xs text-muted`},qe={class:`toolbar mb-1.5 flex items-center gap-4 px-2 text-xs text-muted`},Je={id:`livecount`,class:`count font-mono tabular-nums`},Ye={class:`filter ml-auto inline-flex items-center gap-4`},Xe={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},Ze=[`checked`],Qe={id:`minehint`,class:`sr-only`},$e={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},et=[`checked`],tt={id:`retention`,class:`sr-only`},nt={key:0,class:`banner mb-3 rounded-md border border-warn px-2.5 py-1.5 text-[0.8rem] text-warn`,role:`status`},rt={id:`runs`,class:`m-0 list-none border-t border-muted p-0`},it={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`},at={key:1,id:`empty`,class:`empty px-2 py-2 text-muted`},ot={key:1,class:`pager mt-3 flex items-baseline gap-2 px-2 text-[0.8rem] text-muted`,"aria-label":`Completed runs pages`},st={class:`range font-mono tabular-nums text-dimmed`},ct=l({__name:`RunsIndexPage`,setup(e){let t=x(`runs`),s=t?.all??!1,l=t?.mine??!1,u=new URLSearchParams(S.search());if(!u.has(`mine`)&&!u.has(`all`)&&t){let e=S.readPref(X.mine)===`1`,t=S.readPref(X.all)===`1`;(e||t)&&S.navigate(O(t,e))}let y=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 O(e,t){let n=[e?`all=1`:``,t?`mine=1`:``].filter(Boolean).join(`&`);return n?`/runs?${n}`:`/runs`}let ne=t?.olderThan!==void 0,N=t?.retentionDays??null,P=N===null?void 0:N*864e5,F=h(N),I=T(new Map);for(let e of t?.rows??[])I.set(e.id,e);let L=M(t?.now),R=C({tone:`amber`,text:`connecting…`}),z=E(()=>[...I.values()].sort((e,t)=>Number(V(t,L.value))-Number(V(e,L.value))||t.startedAt-e.startedAt)),B=E(()=>z.value.filter(e=>!e.finished).length),H=E(()=>P===void 0?-1:z.value.findIndex(e=>{let t=de(e,P);return t!==void 0&&t-L.value<=864e5})),U=E(()=>H.value===-1?z.value:z.value.slice(0,H.value)),W=E(()=>H.value===-1?[]:z.value.slice(H.value)),q=s?`All runs`:`Live runs`;o(B,e=>{S.setTitle((e>0?`(${e}) `:``)+q),S.setFavicon(e>0?A:k)},{immediate:!0});function ie(e){let t=e.target.checked;S.writePref(X.all,t?`1`:`0`),S.navigate(O(t,l))}function J(e){let t=e.target.checked;S.writePref(X.mine,t?`1`:`0`),S.navigate(O(s,t))}let ae=E(()=>t?.olderThan===void 0?``:re(t.olderThan,L.value)),oe=j(),Y=null;return g(()=>{Y=oe(`/runs?stream=1${s?`&all=1`:``}${l?`&mine=1`:``}`);let e=!1;Y.onopen=()=>{if(e){S.reload();return}e=!0,R.value={tone:`green`,text:`connected`}},Y.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let n=t.type===`removed`?t.id:t.run?.id,r=n?I.get(n):void 0;if(ne&&!r)return;let i=G(t,s,r?.persisted===!0);i.op===`upsert`?I.set(i.run.id,K(I.get(i.run.id),i.run)):i.op===`remove`&&I.delete(i.id)},Y.onerror=()=>{Y&&Y.readyState===2?R.value={tone:`red`,text:`disconnected`}:R.value={tone:`amber`,text:`connecting…`}}}),te(()=>{Y?.close()}),(e,o)=>{let u=D,h=ee(`RouterLink`);return p(),w(n,{title:_(q),nav:`runs`},{status:f(()=>[m(`span`,Ge,[r(ye,{tone:R.value.tone,label:R.value.text},null,8,[`tone`,`label`]),m(`span`,Ke,c(R.value.text),1)])]),default:f(()=>[r(Q,{current:`runs`}),m(`div`,qe,[m(`span`,Je,c(B.value)+` running`,1),m(`span`,Ye,[_(t)?.viewAs?(p(),w(We,{key:0,people:_(t).viewAs.people},null,8,[`people`])):d(``,!0),r(u,{text:_(y)},{default:f(()=>[m(`label`,Xe,[m(`input`,{id:`showmine`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:_(l),"aria-describedby":`minehint`,onChange:J},null,40,Ze),o[0]||=v(` Show only mine `,-1)])]),_:1},8,[`text`]),m(`span`,Qe,c(_(y)),1),m(`label`,$e,[m(`input`,{id:`showdone`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:_(s),"aria-describedby":`retention`,onChange:ie},null,40,et),o[1]||=v(` Show completed `,-1)]),r(u,{text:_(F)},{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`,tt,c(_(F)),1)])]),_(t)?.storeUnavailable?(p(),i(`p`,nt,c(_(t).storeUnavailable),1)):d(``,!0),m(`ul`,rt,[(p(!0),i(b,null,a(U.value,e=>(p(),w(ze,{key:e.id,run:e,now:_(L),"retention-ms":_(P)},null,8,[`run`,`now`,`retention-ms`]))),128)),W.value.length>0?(p(),i(`li`,it,[...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(b,null,a(W.value,e=>(p(),w(ze,{key:e.id,run:e,now:_(L),"retention-ms":_(P)},null,8,[`run`,`now`,`retention-ms`]))),128)),z.value.length===0?(p(),i(`li`,at,c(_(l)?_(s)?`No runs of yours.`:`No active runs of yours.`:_(s)?`No runs.`:`No active runs.`),1)):d(``,!0)]),_(s)&&(_(t)?.olderHref||_(t)?.olderThan!==void 0)?(p(),i(`nav`,ot,[_(t)?.olderThan===void 0?d(``,!0):(p(),i(b,{key:0},[r(h,{class:`text-primary hover:underline`,to:O(!0,_(l))},{default:f(()=>[...o[4]||=[v(`← Newest runs`,-1)]]),_:1},8,[`to`]),m(`span`,st,`· runs finished before `+c(ae.value),1)],64)),_(t)?.olderHref?(p(),w(h,{key:1,class:`older ml-auto text-primary hover:underline`,to:_(t).olderHref},{default:f(()=>[...o[5]||=[v(`Older runs →`,-1)]]),_:1},8,[`to`])):d(``,!0)])):d(``,!0)]),_:1},8,[`title`])}}});export{ct as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./budgets-CbIyPAER.js";import{i as r}from"./format-BldUwl_R.js";function i(e,t){if(e===void 0)return``;switch(t){case`precise`:return a(e);case`clock`:return o(e);case`report`:return s(e)}}function a(e){if(!(e>=0))return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let n=Math.round(e/1e3);return`${Math.floor(n/60)}m ${c(n%60)}s`}function o(e){if(!(e>0))return`0s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${c(t%60)}s`:`${Math.floor(n/60)}h ${c(n%60)}m`}function s(e){if(!(e>=0))return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${c(t%60)}s`:`${Math.floor(n/60)}h ${c(n%60)}m`}function c(e){return e<10?`0${e}`:String(e)}function l(e,t){let n=e.finishedAt??t;if(n!==void 0)return Math.max(0,n-(e.receivedAt??e.startedAt))}var u=t(5);function d(e,t){if(e.eventsLast5m===void 0)return;let n=t-(e.lastToolCallAt??e.startedAt);return n>=u?n:void 0}function f(e,t){if(e.eventsLast5m===void 0)return``;let r=d(e,t);if(r!==void 0)return`no tool call for ${Math.floor(r/n)} min`;let i=Math.min(u,Math.max(n,t-e.startedAt))/n;return`${Math.round(e.eventsLast5m/i*10)/10}/min`}function p(e,t){if(!(e.boundMs===void 0||t-e.since<=e.boundMs))return`${e.tool} ${Math.round((t-e.since)/1e3)}s, bound ${Math.round(e.boundMs/1e3)}s`}var m=`A-Za-z0-9:@._-`;RegExp(`^[${m}]{1,128}$`),RegExp(`[^${m}]`,`g`);function h(e){return e.type===`span_start`||e.type===`span_end`}[`quiet`,`verbose`,`debug`].join(`, `);var g=n;e.marginMinutes*g,e.chunkMinutes*g,e.mergeChunkMinutes*g,e.busyRetryMinutes*g;function _(e,t){return/^[A-Za-z0-9_-]{1,64}$/.test(e)?`synth:${e}`:`synth:${t}`}function v(e){let t=[];for(let n of e)n.type===`span_end`&&n.name===`run.agent`&&t.push({spanId:n.spanId,startedAt:n.startedAt,endedAt:n.startedAt+n.durationMs});return t}function y(e,t){let n;for(let r of e)r.startedAt<=t&&t<=r.endedAt&&(!n||r.endedAt-r.startedAt<n.endedAt-n.startedAt)&&(n=r);return n?.spanId}function b(e){let t=v(e),n=new Set;for(let t of e){if(!h(t))continue;let e=t.attrs??{};t.name.startsWith(`tool.`)&&typeof e.callId==`string`&&n.add(e.callId)}let r=[],i=new Map;return e.forEach((e,a)=>{switch(e.type){case`tool_call`:{let o=e.callId;if(o===void 0||e.at===void 0||n.has(o)){r.push(e);return}let s=_(o,a);r.push(x(s,`tool.${e.tool}`,e.at,y(t,e.at),{callId:o}),e),i.set(o,{spanId:s,startedAt:e.at});return}case`tool_result`:{if(r.push(e),e.callId===void 0)return;let n=i.get(e.callId);if(!n)return;i.delete(e.callId);let a=e.at??n.startedAt,o={ok:e.ok,callId:e.callId};e.exitCode!==void 0&&(o.exitCode=e.exitCode),e.infra&&(o.infra=!0),r.push(S(n.spanId,`tool.${e.tool}`,n.startedAt,Math.max(0,a-n.startedAt),y(t,n.startedAt),o,e.ok?`ok`:`error`));return}default:r.push(e)}}),r}function x(e,t,n,r,i){return{type:`span_start`,spanId:e,...r===void 0?{}:{parentSpanId:r},name:t,...i?{attrs:i}:{},at:n}}function S(e,t,n,r,i,a,o=`ok`){return{type:`span_end`,spanId:e,...i===void 0?{}:{parentSpanId:i},name:t,startedAt:n,durationMs:r,status:o,...a?{attrs:a}:{},at:n+r}}function C(e,t,n){let r=e.get(t.spanId);if(t.type===`span_start`){if(r)return;e.set(t.spanId,{traceId:n,spanId:t.spanId,...t.parentSpanId===void 0?{}:{parentSpanId:t.parentSpanId},name:t.name,startedAt:t.at??0,attrs:t.attrs??{}});return}e.set(t.spanId,{traceId:n,spanId:t.spanId,...t.parentSpanId===void 0?r?.parentSpanId===void 0?{}:{parentSpanId:r.parentSpanId}:{parentSpanId:t.parentSpanId},name:t.name,startedAt:t.startedAt,endedAt:t.startedAt+t.durationMs,durationMs:t.durationMs,status:t.status,...t.error===void 0?{}:{errorMessage:t.error},attrs:{...r?.attrs??{},...t.attrs??{}}})}function w(){let e,t,n=[];return{push(r){e?t&&r.seq!==void 0&&t.seq!==void 0&&r.seq>t.seq+1&&t.at!==void 0&&r.at!==void 0&&n.push({kind:`gap`,fromSeq:t.seq+1,toSeq:r.seq-1,from:Math.min(t.at,r.at),to:Math.max(t.at,r.at)}):e={seq:r.seq??1,at:r.at},r.type===`run_note`&&r.kind===`spans_dropped`&&r.from!==void 0&&r.to!==void 0&&r.to>=r.from&&n.push({kind:`note`,from:r.from,to:r.to}),t={seq:r.seq,at:r.at}},losses(t={}){let r=t.elided??[],i=(e,t)=>r.some(n=>n.fromSeq<=e&&t<=n.toSeq),a=[];e&&e.seq>1&&t.windowStart!==void 0&&e.at!==void 0&&e.at>t.windowStart&&a.push({from:t.windowStart,to:e.at,kind:`lost`});for(let e of n)a.push(e.kind===`note`?{from:e.from,to:e.to,kind:`lost`}:{from:e.from,to:e.to,kind:i(e.fromSeq,e.toSeq)?`elided`:`lost`});return a}}}new Set(`request,slack.receive,dispatch.history,dispatch.admission,dispatch.ack_card,dispatch.gate.repo,dispatch.gate.pr_head,dispatch.workspace.attach,dispatch.gate.attached_head,dispatch.mcp_discovery,dispatch.compose,dispatch.channel_visibility,dispatch.repo_context,dispatch.memory_read,dispatch.refuse,dispatch.ship_preflight,dispatch.ledger_claim,dispatch.route,run.agent,run.command,run.reading_diff,run.settle_reviewed_head,run.description_turn,run.verdict_turn,run.observe_workspace,run.pr_post_step,run.review_post_step,run.reading_diff_join,run.pr_description_join,model.turn,ship.round,post.card_close,post.reply`.split(`,`));var T=new Set([`slack.receive`,`dispatch.history`,`dispatch.admission`,`dispatch.ack_card`,`dispatch.gate.repo`,`dispatch.gate.pr_head`,`dispatch.workspace.attach`,`dispatch.gate.attached_head`,`dispatch.mcp_discovery`,`dispatch.compose`,`dispatch.channel_visibility`,`dispatch.repo_context`,`dispatch.memory_read`,`dispatch.refuse`,`dispatch.ship_preflight`,`dispatch.ledger_claim`,`dispatch.route`]),ee=new Set([`run.observe_workspace`,`run.pr_post_step`,`run.review_post_step`,`run.reading_diff_join`,`run.pr_description_join`]),E=new Set([`request`,`run.agent`,`ship.round`,`run.settle_reviewed_head`,`run.description_turn`,`run.verdict_turn`,`post.card_close`,`post.reply`]),D=new Set([`run.reading_diff`]);function O(e,t){if(D.has(e))return{kind:`background`};if(E.has(e))return{kind:`uncounted`};if(e===`model.turn`)return{kind:`counted`,bucket:`thinking`};if(e===`run.command`||e.startsWith(`run.command.`))return{kind:`counted`,bucket:t===`command`?`tools`:`getting_ready`};if(T.has(e)||e.startsWith(`dispatch.workspace.attach.`))return{kind:`counted`,bucket:`getting_ready`};if(ee.has(e))return{kind:`counted`,bucket:`finishing_up`};if(e.startsWith(`tool.`)||e.startsWith(`mcp.`))return{kind:`counted`,bucket:`tools`}}function te(e,t){let{window:n,owner:r,finished:i}=t,a=Math.max(0,n.end-n.start),o=new Map(e.map(e=>[e.spanId,e])),s=new Map,c=e=>{let t=s.get(e.spanId);if(t!==void 0)return t;s.set(e.spanId,1);let n=e.parentSpanId?o.get(e.parentSpanId):void 0,r=n?c(n)+1:1;return s.set(e.spanId,r),r},l=e=>{let t=e,n=new Set;for(;t&&!n.has(t.spanId);){if(n.add(t.spanId),O(t.name,r)?.kind===`background`)return!0;t=t.parentSpanId?o.get(t.parentSpanId):void 0}return!1},u=t.losses.map(e=>Math.max(n.start,e.from)).sort((e,t)=>e-t),d=e=>{if(e.endedAt!==void 0)return Math.min(n.end,e.endedAt);if(!i)return n.end;let t=u.find(t=>t>e.startedAt);return t===void 0?n.end:Math.min(n.end,t)},f=[],p=[];for(let t of e){let e=O(t.name,r);if(!e)continue;let i=Math.max(n.start,t.startedAt);if(e.kind===`background`){let e=Math.min(n.end,t.endedAt??n.end);e>i&&p.push([i,e]);continue}if(e.kind!==`counted`||l(t))continue;let a=d(t);a<=i||f.push({start:i,end:a,bucket:e.bucket,depth:c(t),startedAt:t.startedAt,spanId:t.spanId})}f.sort((e,t)=>t.depth-e.depth||e.startedAt-t.startedAt||(e.spanId<t.spanId?-1:+(e.spanId>t.spanId)));let m=new Set([n.start,n.end]);for(let e of f)m.add(e.start),m.add(e.end);for(let e of t.losses)m.add(k(e.from,n)),m.add(k(e.to,n));for(let[e,t]of p)m.add(e),m.add(t);let h=[...m].filter(e=>e>=n.start&&e<=n.end).sort((e,t)=>e-t),g={getting_ready:0,thinking:0,tools:0,finishing_up:0},_=0,v=0,y=0;for(let e=0;e+1<h.length;e++){let r=h[e],i=h[e+1],a=i-r;if(a<=0)continue;let o=f.find(e=>e.start<=r&&e.end>=i);if(o){g[o.bucket]+=a;continue}if(t.losses.some(e=>e.kind===`lost`&&k(e.from,n)<=r&&k(e.to,n)>=i)){_+=a;continue}if(t.losses.some(e=>e.kind===`elided`&&k(e.from,n)<=r&&k(e.to,n)>=i)){v+=a;continue}p.some(([e,t])=>e<=r&&t>=i)&&(y+=a)}let b=g.getting_ready+g.thinking+g.tools+g.finishing_up;return{windowMs:a,gettingReadyMs:g.getting_ready,thinkingMs:g.thinking,toolsMs:g.tools,finishingUpMs:g.finishing_up,overheadMs:Math.max(0,a-b-_-v),notRecordedMs:_,notLoadedMs:v,backgroundOnlyMs:y}}function k(e,t){return Math.min(t.end,Math.max(t.start,e))}function A(e){let t=Math.floor(e.windowMs/1e3),n=[[`getting ready`,Math.floor(e.gettingReadyMs/1e3)],[`thinking`,Math.floor(e.thinkingMs/1e3)],[`in tools`,Math.floor(e.toolsMs/1e3)],[`finishing up`,Math.floor(e.finishingUpMs/1e3)],[`not recorded`,Math.floor(e.notRecordedMs/1e3)],[`not loaded`,Math.floor(e.notLoadedMs/1e3)]],r=n.reduce((e,[,t])=>e+t,0),i=n.filter(([,e])=>e>0).map(([e,t])=>({term:e,s:t})),a=t-r;a>0&&i.push({term:`Switchboard overhead`,s:a});let o=[`getting ready`,`thinking`,`in tools`,`finishing up`,`Switchboard overhead`,`not recorded`,`not loaded`];return i.sort((e,t)=>o.indexOf(e.term)-o.indexOf(t.term)),{totalS:t,items:i}}function j(e){return[e.gettingReadyMs,e.thinkingMs,e.toolsMs,e.finishingUpMs,e.overheadMs,e.notRecordedMs,e.notLoadedMs].filter(t=>t>=2e3||e.windowMs>0&&t/e.windowMs>=.05).length>=2}function M(e,t){if(t===void 0||t<6e4)return;let n=i(t,`clock`);return e===`before`?`queued ${n} before we saw it`:`queued ${n} behind the previous run`}var N=`unfinished — no finish recorded`,P=1024,F=1024*P,I=1024*F;2*I,200*F,16*F,8*I,16*F,2*I,1.5*F,64*P,new TextEncoder;function L(e){return e===`completed`?`succeeded`:e===`stopped_soft`?`stopped early`:e===`stopped_hard`?`killed`:e}function R(e){return e.state===`stopped`?L(`stopped_${e.mode}`):`${e.state} (${e.mode})`}function z(e){return e.finished?e.provisional?N:e.status?L(e.status):`finished`:`live`}function B(e){return e.finished&&!e.persisted&&e.sealedAt===void 0}function V(e){return e.finished?B(e)||e.provisional?`amber`:e.status===`failed`||e.status===`stopped_hard`||e.status===`interrupted`?`red`:e.status===`stopped_soft`?`amber`:`grey`:`green`}function H(e){return e===`coding`||e===`review`||e===`research`||e===`general`?e:`other`}var U={coding:`text-ok bg-ok/8 border-ok/25`,review:`text-review bg-review/8 border-review/25`,research:`text-research bg-research/8 border-research/25`,general:`text-info bg-info/8 border-info/25`,other:`text-toned bg-accented/60 border-accented`};function W(e){let t=e.stepCount??e.eventCount;return`${t} event${t===1?``:`s`}`}function G(e){return e.stepCount===void 0?`events published, span records included`:`content events; span records excluded`}function K(e,t){return e.finished?``:f(e,t)}function q(e,t){return!e.finished&&d(e,t)!==void 0}function J(e,t){return!e.finished&&e.inFlight?p(e.inFlight,t):void 0}function ne(e,t){return J(e,t)?`this call ran past the bound it declared — it should have been cut`:q(e,t)?`time since the run's last tool call`:`events per minute over the last five minutes`}function Y(e){return`/runs/${encodeURIComponent(e.id)}${!e.finished&&e.token?`?t=${encodeURIComponent(e.token)}`:``}`}function X(e,t){return`/runs/${encodeURIComponent(e.id)}/stop?t=${encodeURIComponent(e.token??``)}&mode=${encodeURIComponent(t)}`}function Z(e){return e.length>8?`${e.slice(0,8)}…`:e}function re(e,t){let n=l(e,e.finished?void 0:t);return n===void 0?``:i(n,`clock`)}function ie(e){return typeof e.receivedAt==`number`?` (received to finish)`:``}function Q(e){let t=e.channelId??``,n=t.indexOf(`:`),r=n===-1?`unknown`:t.slice(0,n);if(e.userName)return{kind:r,identity:e.userName};let i=e.userId??``,a=i.indexOf(`:`);return{kind:r,identity:a===-1?i:i.slice(a+1)}}function ae(e){return`/threads/${encodeURIComponent(e)}`}var oe={mine:`sb.runs.mine`,all:`sb.runs.all`},$={slack:`Slack`,http:`HTTP ingress`,mcp:`MCP`,cli:`CLI`,web:`Web`};function se(e){if(!e.finished)return e.activity?`now: ${e.activity}`:`starting…`;let t=z(e),n=l(e);return n!==void 0&&(t+=` in ${i(n,`clock`)}${ie(e)}`),B(e)&&(t+=` · delivering the reply`),e.status&&e.status!==`completed`&&e.activity&&(t+=`\n${e.activity}`),t}function ce(e){let t=typeof e.receivedAt==`number`?`received ${r(e.receivedAt)}\n`:``;return t+=`started ${r(e.startedAt)}`,e.finished&&typeof e.finishedAt==`number`&&(t+=`\nfinished ${r(e.finishedAt)}`),t}function le(e){let t=Q(e);return`via ${$[t.kind]??t.kind}${t.identity?` · ${t.identity}`:``}`}function ue(e){return Q(e).identity}function de(e,t){return e.repo??(/^[\w.-]+\/[\w.-]+$/.test(t)?t:``)}function fe(e){return e.sourceUrl&&/^https?:\/\//.test(e.sourceUrl)?e.sourceUrl:``}function pe(e,t,n){return e.type===`upsert`&&e.run?!t&&e.run.finished?{op:`remove`,id:e.run.id}:{op:`upsert`,run:e.run}:e.type===`removed`&&e.id?t&&n?{op:`keep`}:{op:`remove`,id:e.id}:{op:`keep`}}function me(e,t){if(!e||!e.finished)return t;let n={...t};return n.finishedAt===void 0&&e.finishedAt!==void 0&&(n.finishedAt=e.finishedAt),n.status===void 0&&e.status!==void 0&&(n.status=e.status),n.receivedAt===void 0&&e.receivedAt!==void 0&&(n.receivedAt=e.receivedAt),n.sealedAt===void 0&&e.sealedAt!==void 0&&(n.sealedAt=e.sealedAt),n.replyOk===void 0&&e.replyOk!==void 0&&(n.replyOk=e.replyOk),n}function he(e,t){return e.finished&&typeof e.finishedAt==`number`&&typeof t==`number`?e.finishedAt+t:void 0}var ge=864e5;export{ue as A,h as B,L as C,Q as D,R as E,A as F,i as H,O as I,w as L,M,j as N,ae as O,te as P,C as R,V as S,X as T,l as V,q as _,H as a,Z as b,se as c,pe as d,me as f,K as g,J as h,$ as i,N as j,ce as k,re as l,de as m,ge as n,W as o,ne as p,oe as r,G as s,U as t,he as u,Y as v,z as w,le as x,fe as y,b as z};
|