@coreplane/switchboard 1.253.0 → 1.254.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/assets/config/config.example.yaml +40 -11
  2. package/dist/assets/deploy/cloudflare-memory/worker.ts +310 -7
  3. package/dist/assets/package-lock.json +3 -3
  4. package/dist/assets/package.json +1 -1
  5. package/dist/assets/source.json +3 -3
  6. package/dist/assets/src/core/authz/grants.ts +6 -0
  7. package/dist/assets/src/core/authz/policy.ts +11 -0
  8. package/dist/assets/src/core/budgets.ts +8 -0
  9. package/dist/assets/src/core/coordinator/driver.ts +9 -0
  10. package/dist/assets/src/core/costs.ts +221 -2
  11. package/dist/assets/src/core/costsSnapshotStore.ts +22 -1
  12. package/dist/assets/src/core/pipelineStanding.ts +294 -0
  13. package/dist/assets/src/core/plane/decide.ts +203 -0
  14. package/dist/assets/src/core/provider.ts +11 -0
  15. package/dist/assets/src/core/runEvents.ts +27 -1
  16. package/dist/assets/src/core/runLedger/transcript.ts +23 -3
  17. package/dist/assets/src/core/runRecord.ts +15 -0
  18. package/dist/assets/src/core/runUsage.ts +41 -9
  19. package/dist/assets/src/core/ship/coordinator.ts +45 -9
  20. package/dist/assets/web/dist/.vite/manifest.json +450 -430
  21. package/dist/assets/web/dist/assets/{AppShell-Bmz8nzz3.js → AppShell-CSXDCV4x.js} +1 -1
  22. package/dist/assets/web/dist/assets/CostChart-DsuPS2g7.js +2 -0
  23. package/dist/assets/web/dist/assets/CostsPage-BuKjw3nv.js +1 -0
  24. package/dist/assets/web/dist/assets/{DeliveryPage-C7jaEJip.js → DeliveryPage-ngPsO2to.js} +1 -1
  25. package/dist/assets/web/dist/assets/{HomePage-cWbupQzy.js → HomePage-DvxTHzPx.js} +3 -3
  26. package/dist/assets/web/dist/assets/{InputMenu-C9E7YoII.js → InputMenu-BdZXnibG.js} +1 -1
  27. package/dist/assets/web/dist/assets/MetricsPage-o5fSaCTe.js +1 -0
  28. package/dist/assets/web/dist/assets/{NotFoundPage-4nlrq7DP.js → NotFoundPage-DHuWyjlq.js} +1 -1
  29. package/dist/assets/web/dist/assets/PendingTurnRow-ZYIRCCZ2.js +1 -0
  30. package/dist/assets/web/dist/assets/{PlanePage-BNy4tSgJ.js → PlanePage-DpWfiX4C.js} +1 -1
  31. package/dist/assets/web/dist/assets/{ResidentDetailPage-Dbtiq6_J.js → ResidentDetailPage-DG86v39Y.js} +1 -1
  32. package/dist/assets/web/dist/assets/{ResidentsIndexPage-CKtz9H1o.js → ResidentsIndexPage-x6p689VH.js} +1 -1
  33. package/dist/assets/web/dist/assets/RunFoldRow-DG29LOTs.js +1 -0
  34. package/dist/assets/web/dist/assets/{RunRoutePage-Clh68nw9.js → RunRoutePage-ysJBY8xQ.js} +4 -4
  35. package/dist/assets/web/dist/assets/RunsIndexPage-CuzFchcn.js +1 -0
  36. package/dist/assets/web/dist/assets/{RunsTabs-DotpuCSP.js → RunsTabs-kHbbxVHx.js} +1 -1
  37. package/dist/assets/web/dist/assets/{ScheduledPage-C8FYoZy5.js → ScheduledPage-BuLmfcbG.js} +1 -1
  38. package/dist/assets/web/dist/assets/{SettingSelect-CSiBQCSX.js → SettingSelect-BfID5nF4.js} +1 -1
  39. package/dist/assets/web/dist/assets/{SettingsPage-CkYIhLUl.js → SettingsPage-BujWkdU_.js} +1 -1
  40. package/dist/assets/web/dist/assets/{StatusDot-C0TUgnC1.js → StatusDot-C8Bc0pTX.js} +1 -1
  41. package/dist/assets/web/dist/assets/{Tooltip-CN5cZdl3.js → Tooltip-BWwJx27K.js} +1 -1
  42. package/dist/assets/web/dist/assets/{UnitRoutePage-D_EtAl8r.js → UnitRoutePage-B9kjA1AT.js} +1 -1
  43. package/dist/assets/web/dist/assets/{angular-html-qW40ZL9x.js → angular-html-C8b5YTHf.js} +1 -1
  44. package/dist/assets/web/dist/assets/{angular-ts-PUtZU8Cq.js → angular-ts-C3f4WYNe.js} +1 -1
  45. package/dist/assets/web/dist/assets/{apl-D3fC7Qjd.js → apl-DSHxUJc3.js} +1 -1
  46. package/dist/assets/web/dist/assets/{astro-Bi3JFHhh.js → astro-BSGCCBP6.js} +1 -1
  47. package/dist/assets/web/dist/assets/{blade-CSpsf9Z9.js → blade-DFeYrMKk.js} +1 -1
  48. package/dist/assets/web/dist/assets/{c-DE_b1oWP.js → c-L_QOnFVv.js} +1 -1
  49. package/dist/assets/web/dist/assets/{chapel-CWXd9giL.js → chapel-DLQWUwhu.js} +1 -1
  50. package/dist/assets/web/dist/assets/{cobol-CnMOmWNF.js → cobol-1DlMmrEO.js} +1 -1
  51. package/dist/assets/web/dist/assets/{coffee-B9WvURu8.js → coffee-BTB6os6N.js} +1 -1
  52. package/dist/assets/web/dist/assets/{cpp-BZAJXlWI.js → cpp-BvJI2z3u.js} +1 -1
  53. package/dist/assets/web/dist/assets/{crystal-Bm48wAlb.js → crystal-B11wGW_h.js} +1 -1
  54. package/dist/assets/web/dist/assets/{css-WtMeC3ab.js → css-BiIWx5Pw.js} +1 -1
  55. package/dist/assets/web/dist/assets/{dist-B1Mf2JbM.js → dist-CpnyQGOb.js} +2 -2
  56. package/dist/assets/web/dist/assets/{edge-BmwNa6Ss.js → edge-nSglEXaD.js} +1 -1
  57. package/dist/assets/web/dist/assets/{elixir-BotfP-Mn.js → elixir-x7o8qMl8.js} +1 -1
  58. package/dist/assets/web/dist/assets/{elm-DAFc6laN.js → elm-DGrRyqTQ.js} +1 -1
  59. package/dist/assets/web/dist/assets/{erb-QkOON3bB.js → erb--_dh58Nw.js} +1 -1
  60. package/dist/assets/web/dist/assets/{git-rebase-BPs-dd73.js → git-rebase-DbpUXwyg.js} +1 -1
  61. package/dist/assets/web/dist/assets/{glimmer-js-D8eooepk.js → glimmer-js-BG0CuZG5.js} +1 -1
  62. package/dist/assets/web/dist/assets/{glimmer-ts-B0bRiDVg.js → glimmer-ts-CQIl5qyR.js} +1 -1
  63. package/dist/assets/web/dist/assets/{glsl-Bv6bMe1n.js → glsl-9PJNQTcw.js} +1 -1
  64. package/dist/assets/web/dist/assets/{graphql-Bh9y-n9o.js → graphql-CzVTzjEI.js} +1 -1
  65. package/dist/assets/web/dist/assets/{hack-DSEbn7Ir.js → hack-BhCmAz3Q.js} +1 -1
  66. package/dist/assets/web/dist/assets/{haml-0NW1-z1f.js → haml-BmI12COR.js} +1 -1
  67. package/dist/assets/web/dist/assets/{handlebars-BfgCHFbK.js → handlebars-Cib-ISTS.js} +1 -1
  68. package/dist/assets/web/dist/assets/{html-CQHc0gQ5.js → html-D3lDapvI.js} +1 -1
  69. package/dist/assets/web/dist/assets/{html-derivative-B0Tm7wLP.js → html-derivative-DRPY8vOK.js} +1 -1
  70. package/dist/assets/web/dist/assets/{http-GAuU3aOF.js → http-B9VttK6m.js} +1 -1
  71. package/dist/assets/web/dist/assets/{hurl-CrDFbF5B.js → hurl-C0saNJYj.js} +1 -1
  72. package/dist/assets/web/dist/assets/{indexRow-BxKswdlK.js → indexRow-DABQtONT.js} +1 -1
  73. package/dist/assets/web/dist/assets/{java-DYv5KhUe.js → java-BCFbtYAj.js} +1 -1
  74. package/dist/assets/web/dist/assets/{javascript-32SiLGg0.js → javascript-nwBjnrhh.js} +1 -1
  75. package/dist/assets/web/dist/assets/{jinja--gJDUGYa.js → jinja-CMYO9byN.js} +1 -1
  76. package/dist/assets/web/dist/assets/{jison-BlKLGzZH.js → jison-Cko8HnE_.js} +1 -1
  77. package/dist/assets/web/dist/assets/{json-BICanD1N.js → json-Dzv__YsX.js} +1 -1
  78. package/dist/assets/web/dist/assets/{jsx-CgW3-uFT.js → jsx-CTFxagih.js} +1 -1
  79. package/dist/assets/web/dist/assets/{julia-BErRpwwL.js → julia-_Xvten1-.js} +1 -1
  80. package/dist/assets/web/dist/assets/{just-CordHv0h.js → just-bLps4qOu.js} +1 -1
  81. package/dist/assets/web/dist/assets/{latex-D7LVPLbi.js → latex-D6UaYsUP.js} +1 -1
  82. package/dist/assets/web/dist/assets/{liquid-3ehz2i4U.js → liquid-CoDIeULa.js} +1 -1
  83. package/dist/assets/web/dist/assets/{lua-C9ppSVrm.js → lua-D1KFRnVf.js} +1 -1
  84. package/dist/assets/web/dist/assets/main-C4QfwybO.css +1 -0
  85. package/dist/assets/web/dist/assets/main-Comxmwi4.js +28 -0
  86. package/dist/assets/web/dist/assets/{marko-xBZLUBEJ.js → marko-B5N5XcOw.js} +1 -1
  87. package/dist/assets/web/dist/assets/{mdc-BJxGoVgD.js → mdc-uxzjQO3q.js} +1 -1
  88. package/dist/assets/web/dist/assets/{nginx-B-sZmpsb.js → nginx-BMJxs2TK.js} +1 -1
  89. package/dist/assets/web/dist/assets/{nim--s9wRABK.js → nim-DqQ3-8p1.js} +1 -1
  90. package/dist/assets/web/dist/assets/{org-DoUvssoI.js → org-DsY6LK59.js} +1 -1
  91. package/dist/assets/web/dist/assets/{perl-B-vGHKOy.js → perl--pq9iJFp.js} +1 -1
  92. package/dist/assets/web/dist/assets/{php-CerWx_Xb.js → php-RHCMbsM2.js} +1 -1
  93. package/dist/assets/web/dist/assets/{pug-CzKrBMb1.js → pug-CFNq_FCp.js} +1 -1
  94. package/dist/assets/web/dist/assets/{qml-Bs8L8I6k.js → qml-C9Acx9E8.js} +1 -1
  95. package/dist/assets/web/dist/assets/{r-w6uG6mob.js → r-DxlU8FBd.js} +1 -1
  96. package/dist/assets/web/dist/assets/{razor-dz2oj2bd.js → razor-CLJ2kKih.js} +1 -1
  97. package/dist/assets/web/dist/assets/{regexp-CfQdprnY.js → regexp-CzmdGoEp.js} +1 -1
  98. package/dist/assets/web/dist/assets/{rst-DAOaX2tb.js → rst-D9yuxBET.js} +1 -1
  99. package/dist/assets/web/dist/assets/{ruby-QcCe4udB.js → ruby-CIRcEvnD.js} +1 -1
  100. package/dist/assets/web/dist/assets/{sas-BrM4lAAc.js → sas-LOl-uUPh.js} +1 -1
  101. package/dist/assets/web/dist/assets/{scss-DVbJXoUb.js → scss-BX2_sZHY.js} +1 -1
  102. package/dist/assets/web/dist/assets/{shellscript-09fP2hZf.js → shellscript-4d-QvKkY.js} +1 -1
  103. package/dist/assets/web/dist/assets/{shellsession-Qgr8xjZF.js → shellsession-DhB16UGy.js} +1 -1
  104. package/dist/assets/web/dist/assets/{soy-DIYeNTuz.js → soy-Cm1xTUBr.js} +1 -1
  105. package/dist/assets/web/dist/assets/{sql-CzLR9msV.js → sql-BsfcBJdu.js} +1 -1
  106. package/dist/assets/web/dist/assets/{sseReplay-BYo2EZKy.js → sseReplay-IzTdD4-3.js} +6 -6
  107. package/dist/assets/web/dist/assets/{stata-zCY1ZzH0.js → stata-Dwat3BSw.js} +1 -1
  108. package/dist/assets/web/dist/assets/{surrealql-CJIjTRV4.js → surrealql-P4rtxzAW.js} +1 -1
  109. package/dist/assets/web/dist/assets/{svelte-C5OTPFZg.js → svelte-DTcsi8S8.js} +1 -1
  110. package/dist/assets/web/dist/assets/{templ-DYj-UICF.js → templ-D-kP0Tg5.js} +1 -1
  111. package/dist/assets/web/dist/assets/{tex-xcie-3Gd.js → tex-D-4vuedK.js} +1 -1
  112. package/dist/assets/web/dist/assets/{ts-tags-CoN86VTt.js → ts-tags-jEEWYxsu.js} +1 -1
  113. package/dist/assets/web/dist/assets/{tsx-n3-No_Br.js → tsx-CFnlrVzT.js} +1 -1
  114. package/dist/assets/web/dist/assets/{twig-DPiJ7Vp1.js → twig-D5rGrPjs.js} +1 -1
  115. package/dist/assets/web/dist/assets/{typescript-BP6HBaOp.js → typescript-nYIQ35or.js} +1 -1
  116. package/dist/assets/web/dist/assets/{typst-Do9ZjsVP.js → typst-3-UX8dna.js} +1 -1
  117. package/dist/assets/web/dist/assets/{vue-CzAeXNRY.js → vue-CLIPIX03.js} +1 -1
  118. package/dist/assets/web/dist/assets/{vue-html-D7iYmYjd.js → vue-html-Ci9CpkHU.js} +1 -1
  119. package/dist/assets/web/dist/assets/{vue-vine-DtrMRsJx.js → vue-vine-DL5pEYYk.js} +1 -1
  120. package/dist/assets/web/dist/assets/{xml-DGJHo1c0.js → xml-bO80qikC.js} +1 -1
  121. package/dist/assets/web/dist/assets/{xsl-Q00kvNgW.js → xsl-BPze60Ej.js} +1 -1
  122. package/dist/assets/web/dist/assets/{yaml-F-UGKaiO.js → yaml-BQUSon_o.js} +1 -1
  123. package/dist/cli.js +35752 -33944
  124. package/package.json +1 -1
  125. package/dist/assets/web/dist/assets/CostsPage-CxTKdpzU.js +0 -2
  126. package/dist/assets/web/dist/assets/PendingTurnRow-C-pUgyyX.js +0 -1
  127. package/dist/assets/web/dist/assets/RunFoldRow-sYFtuK2G.js +0 -1
  128. package/dist/assets/web/dist/assets/RunsIndexPage-DPDbcOA_.js +0 -1
  129. package/dist/assets/web/dist/assets/main-Cv0q9y56.js +0 -28
  130. package/dist/assets/web/dist/assets/main-DKFCM-sy.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreplane/switchboard",
3
- "version": "1.253.0",
3
+ "version": "1.254.1",
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-Bmz8nzz3.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 +0,0 @@
1
- import{C as e,D as t,O as n,P as r,T as i,w as a}from"./AppShell-Bmz8nzz3.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{U as G}from"./indexRow-BxKswdlK.js";import"./format-BldUwl_R.js";import{d as K,f as q,m as se,p as ce}from"./sseReplay-BYo2EZKy.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{A as T,B as ee,C as E,F as D,H as O,I as k,L as A,N as j,P as te,T as M,U as N,a as P,c as F,l as I,o as L,t as R,w as ne,x as z,y as re}from"./indexRow-BxKswdlK.js";import"./format-BldUwl_R.js";import{a as ie,n as ae,t as oe}from"./durationTone-U_rOqo6r.js";import{c as se,l as ce,n as le,t as ue,w as B}from"./sseReplay-BYo2EZKy.js";import{t as V}from"./StatusDot-C0TUgnC1.js";var de={},fe={viewBox:`0 0 16 16`,class:`inline-block size-[1em] shrink-0`,"aria-hidden":`true`};function pe(e,n){return d(),t(`svg`,fe,[...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 me=ie(de,[[`render`,pe]]),H={"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`},he={getting_ready:`getting ready`,finishing_up:`finishing up`};function ge(e){return H[he[e]]}var _e={id:`timeline`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,"data-testid":`timeline`},ve={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},ye={class:`ml-auto flex items-baseline gap-3 font-normal normal-case tracking-normal`},be=[`href`],xe={class:`lede font-mono text-sm text-toned`},Se={class:`shape tabular-nums`},Ce={key:0,class:`current text-muted`},we={key:0,class:`note mt-0.5 text-xs text-muted`},Te=[`aria-label`],Ee=[`title`,`data-term`],De={class:`legend mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs`},Oe=[`title`,`data-term`],ke={class:`term text-muted`},Ae={class:`ms tabular-nums text-toned`},je=[`title`],Me={class:`ranked mt-1 flex flex-col gap-1 font-mono text-xs`},Ne={class:`ms w-14 shrink-0 tabular-nums text-toned`},Pe=[`href`,`data-anchor`,`onClick`],Fe=[`title`],Ie={class:`cut mt-1 flex flex-col gap-1 font-mono text-xs`},Le={class:`ms w-14 shrink-0 tabular-nums text-toned`},Re=[`href`,`data-anchor`,`onClick`],U=o({__name:`TimelineSection`,props:{vm:{},eventsHref:{}},emits:[`reveal`],setup(e,{emit:r}){let o=e,l=r;function u(e){return`${N(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`,_e,[f(`h2`,ve,[o[0]||=f(`span`,null,`Where the time went`,-1),f(`span`,ye,[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,be)):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`,xe,[f(`span`,Se,a(e.vm.shown?e.vm.total:e.vm.lede),1),e.vm.current?(d(),t(`span`,Ce,` · `+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`,we,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(H)[e.term],e.hatched?`paint-hatched hatched`:``]]),style:i({width:`${e.pct}%`}),title:u(e),"data-term":e.term},null,14,Ee))),128))],8,Te),f(`ul`,De,[(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(H)[e.term]])},null,2),f(`span`,ke,a(e.term),1),f(`span`,Ae,a(e.text),1)],8,Oe))),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,je),f(`ol`,Me,[(d(!0),t(_,null,n(e.vm.ranked,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Ne,a(h(N)(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,Pe),(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,Fe),f(`ol`,Ie,[(d(!0),t(_,null,n(e.vm.cut,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Le,a(h(N)(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,Re),(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)]))}}),W={"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`},G=`Ranked by each step's own time, its children excluded — the bar counts every instant once.`,K=`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 ze(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 Be=`currently delivering`,Ve=`getting ready: not recorded (too large)`,He=`no timing data`,Ue=`not loaded (the record has the full shape)`,q={getting_ready:`getting ready`,thinking:`thinking`,tools:`in tools`,finishing_up:`finishing up`};function J(e){let{spans:t,window:n,owner:r}=e,i=e.phase!==`live`,a=D(t,{window:n,owner:r,finished:i,losses:e.losses}),o=k(a),s=N(o.totalS*1e3,`clock`),c=t.find(e=>e.name===`request`&&e.parentSpanId===void 0),l=e.phase===`live`?Ge(t,r,n):void 0,u=Ke(e,l),d=l?B(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:G,cut:[],cutNote:K,debug:f,lede:s,shown:!1,bar:[],legend:[],ranked:[],note:He};let p=We(c,`restartOfRunId`),m={total:s,current:u,openStep:d,captions:[p===void 0?void 0:`restarted from run ${p}`,j(`before`,Y(c,`queuedBeforeMs`)),p===void 0?j(`behind`,Y(c,`queuedBehindMs`)):void 0].filter(e=>e!==void 0),rankedNote:G,cutNote:K,debug:f};if(!c)return{...m,lede:s,shown:!1,bar:[],legend:[],ranked:[],cut:[],note:i?Ve:``};let h=t=>t===`not recorded`?`not recorded${e.truncated?` (too large)`:``}`:t===`not loaded`?Ue:t,g=te(a)&&o.items.length>0,_=g?`${s} — ${o.items.map(({term:e,s:t})=>`${N(t*1e3,`clock`)} ${h(e)}`).join(` · `)}`:a.windowMs>0?`${s} — ${h(qe(a))}`:s,v=g?o.items.map(({term:t,s:n})=>({term:t,text:N(n*1e3,`clock`),definition:t===`not recorded`&&e.truncated?`${W[t]} (too large)`:W[t]})):[],y=g?Ye(t,c,r,n,e.callTitle,e.phase===`ended`,ze(e.endedBy)):{ranked:[],cut:[]};return{...m,lede:_,shown:g,bar:g?Je(a,l):[],legend:v,ranked:y.ranked,cut:y.cut,note:``}}function Y(e,t){let n=e?.attrs[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function We(e,t){let n=e?.attrs[t];return typeof n==`string`&&n!==``?n:void 0}function Ge(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=A(o.name,t);if(e?.kind!==`counted`||X(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 X(e,t,n){let r=e,i=new Set;for(;r&&!i.has(r.spanId);){if(i.add(r.spanId),A(r.name,n)?.kind===`background`)return!0;r=r.parentSpanId?t.get(r.parentSpanId):void 0}return!1}function Ke(e,t){return e.phase===`delivering`?Be:e.phase===`ended`?ce(e.delivery??{}):t?`currently ${q[t.bucket]} ${N(t.elapsedMs,`clock`)}`:``}function Z(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 qe(e){let t=[`getting ready`,-1];for(let n of Z(e))n[1]>t[1]&&(t=n);return t[0]}function Je(e,t){let n=[],r=t=>e.windowMs>0?t/e.windowMs*100:0;for(let[i,a]of Z(e))if(!(a<=0)){if(t&&q[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 Ye(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`||A(r.name,n)===void 0||X(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-Xe(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??B(r.name),ms:m,facts:_?[o,...Q(r)]:Q(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 Xe(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 Q(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 ${N(t.timeoutMs,`clock`)}`),typeof t.waitedMs==`number`&&n.push(`waited ${N(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 $(e){return e===`command`?`command`:`agent`}var Ze=[`data-state`],Qe={key:0,class:`loading py-2 font-mono text-xs text-dimmed`},$e={key:1,class:`failed py-2 font-mono text-xs text-warn`},et=[`data-turn`,`data-anchor`],tt={class:`landing-head flex flex-wrap items-baseline gap-x-2 font-mono text-xs text-muted`},nt={class:`turn tabular-nums`},rt={class:`what min-w-0 truncate text-toned`},it={key:0,class:`m-0 mt-1 list-none p-0`},at=o({__name:`RunTimeline`,props:{run:{},land:{},fetch:{}},setup(n){let i=n,o=b(`loading`),s=se(),v=S(()=>{if(o.value!==`ready`)return null;s.state.traceVersion;let e=i.run,t=e.receivedAt??e.startedAt,n=O(e)??(e.finishedAt===void 0?0:Math.max(0,e.finishedAt-t));return J({spans:s.spanSet(),losses:s.losses(t),window:{start:t,end:t+n},owner:$(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),k=S(()=>T.value?`${i.land}@${T.value.anchor}`:null);return r(k,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=ue(await t.text()).filter(e=>e.type!==`replay_note`);for(let e of(i.run.schema??0)>=2?ee(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`,Qe,`reading the run's record…`)):o.value===`failed`?(d(),t(`p`,$e,[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(U,{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`,tt,[f(`span`,nt,`turn `+a(n.land),1),f(`span`,rt,`· `+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`,it,[e(le,{step:T.value.step,onToggleGroup:i[0]||=e=>h(s).toggleGroup(T.value.step)},null,8,[`step`])])):c(``,!0)],8,et)):c(``,!0)],64)):c(``,!0)],8,Ze)}}}),ot=[`id`,`data-run-id`,`data-round`,`data-thread`],st=[`open`],ct={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`},lt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},ut={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},dt={key:3,class:`scope min-w-0 flex-1 truncate text-toned`},ft=[`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||z(o.run.id))),_=S(()=>E(o.run)),y=S(()=>re(o.run)),ee=S(()=>o.run.finished),D=S(()=>o.run.finished&&o.run.status&&o.run.status!==`completed`?ne(o.run.status):``),O=S(()=>oe(o.run.finished&&typeof o.run.finishedAt==`number`?o.run.finishedAt-o.run.startedAt:void 0,`run`)),k=S(()=>ae(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},[ee.value?(d(),t(`details`,{key:0,class:`group/fold`,open:p.value,onToggle:A},[f(`summary`,ct,[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(V,{tone:_.value,label:h(M)(n.run),tip:h(F)(n.run)},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,lt,a(n.label),1)):c(``,!0),m.value.agent?(d(),t(`span`,{key:1,class:s([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider opacity-55`,h(R)[h(P)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,dt,a(m.value.scope),1)):(d(),t(`span`,ut,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(T)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,ft),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(I)(n.run,n.now)),15,pt),f(`span`,mt,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(z)(n.run.id)}`,onClick:o[0]||=v(()=>{},[`stop`])},{default:u(()=>[...o[1]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]),p.value?(d(),x(at,{key:0,run:n.run,land:n.land},null,8,[`run`,`land`])):c(``,!0)],40,st)):(d(),t(`div`,ht,[o[4]||=f(`span`,{class:`chev select-none text-xs text-transparent`,"aria-hidden":`true`},`❯`,-1),e(V,{tone:_.value,label:h(M)(n.run),tip:h(F)(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(R)[h(P)(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(T)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,yt),f(`span`,bt,a(h(I)(n.run,n.now)),1),f(`span`,xt,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(z)(n.run.id)}`},{default:u(()=>[...o[3]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]))],10,ot)}}});export{ge as a,U as i,$ as n,me as o,J as r,St as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./AppShell-Bmz8nzz3.js";import{An as r,Cn as i,Cr as a,Gr as o,Ii as s,Li as c,Mn as l,Pi as u,Sn as d,Tr as ee,Xr as f,_r as p,bn as m,c as h,dr as g,hr as _,ji as v,kn as y,l as b,ln as x,o as S,t as C,xi as w,xn as T,yi as E,yn as D}from"./browser-B6T5hjfR.js";import{t as O}from"./Tooltip-CN5cZdl3.js";import{t as k}from"./InputMenu-C9E7YoII.js";import{b as A,x as j}from"./main-Cv0q9y56.js";import{t as M}from"./eventSource-Bj_dZf6M.js";import{t as N}from"./wallClock-DmaC1sKA.js";import{n as te,r as P,t as ne}from"./indexFormat-B-pd4r7Y.js";import{A as F,C as I,D as L,E as R,O as z,S as B,T as V,_ as H,a as U,b as W,c as G,d as K,f as q,g as re,h as ie,i as J,j as ae,k as Y,l as oe,m as se,o as ce,p as X,r as Z,s as le,t as ue,u as de,v as fe,w as pe,x as me,y as he}from"./indexRow-BxKswdlK.js";import{i as ge}from"./format-BldUwl_R.js";import{i as Q,n as _e,t as ve}from"./durationTone-U_rOqo6r.js";import{t as ye}from"./RunsTabs-DotpuCSP.js";import{t as be}from"./StatusDot-C0TUgnC1.js";var xe={class:`flex items-baseline gap-1.5 whitespace-pre-line px-2 py-1 text-xs`},Se=[`data-kind`,`aria-label`,`href`],Ce=[`data-kind`],we=l({__name:`SourceMark`,props:{kind:{},tip:{},url:{}},setup(e){let t=e,n=()=>J[t.kind]??t.kind;return(t,r)=>{let a=O;return e.url?(p(),T(a,{key:0},{content:f(()=>[m(`span`,xe,[e.kind===`slack`?(p(),T(Q,{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,Se)]),_:1})):(p(),i(`span`,{key:1,class:`source w-[1.6em] shrink-0`,"data-kind":e.kind,"aria-hidden":`true`},null,8,Ce))}}}),Te=[`data-run-id`,`data-parent-id`,`data-started-at`,`data-persisted`,`data-stalled`,`data-expires-at`],Ee={class:`pointer-events-auto flex items-center max-sm:order-1`},De=[`data-user-id`,`data-surface`],Oe={class:`surface mr-1.5 inline-block w-[3.6em] rounded border border-accented text-center font-mono text-[0.62rem] text-dimmed`},ke={class:`name`},Ae={key:1,class:`who shrink-0 max-sm:hidden sm:w-[14em]`,"aria-hidden":`true`},je=[`data-agent-hue`],Me=[`href`],Ne={class:`owner font-normal text-dimmed`},Pe={class:`name`},Fe={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`},Ie={class:`hidden sm:contents`},Le={class:`expires pointer-events-auto shrink-0 font-mono text-xs tabular-nums text-warn max-sm:order-11`},Re=[`data-heat`],ze={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`},Be={class:`actions flex shrink-0 justify-end max-sm:order-5 sm:w-[2em]`},$=l({__name:`RunRow`,props:{run:{},now:{},retentionMs:{},nestedUnder:{}},setup(e){let n=e,a=D(()=>P(n.run.label||me(n.run.id))),o=D(()=>ie(n.run,a.value.scope)),l=D(()=>I(n.run)),h=D(()=>he(n.run)),g=D(()=>z(n.run)),_=D(()=>ae(n.run)),y=D(()=>W(n.run)),x=D(()=>n.run.threadKey?Y(n.run.threadKey):null),S=D(()=>de(n.run,n.retentionMs)),w=D(()=>S.value!==void 0&&S.value-n.now<=864e5),k=D(()=>!n.run.finished&&!n.run.stop),A=D(()=>ve(n.run.finished&&typeof n.run.finishedAt==`number`?n.run.finishedAt-n.run.startedAt:void 0,`run`)),j=D(()=>_e(A.value)),M=D(()=>n.run.finished&&n.run.status&&n.run.status!==`completed`?pe(n.run.status):``),N=D(()=>n.run.stop&&!(n.run.finished&&n.run.status)?L(n.run.stop):``),K=D(()=>re(n.run,n.now)),q=D(()=>K.value??H(n.run,n.now)),X=D(()=>fe(n.run,n.now)),Z=E({soft:!1,hard:!1}),Q=D(()=>[...x.value?[{label:`Open thread`,icon:`i-lucide-messages-square`,to:x.value}]:[],...y.value?[{label:`Open in ${J[g.value.kind]??g.value.kind}`,icon:`i-lucide-external-link`,to:y.value,target:`_blank`}]:[],...k.value?[{label:`Stop (soft)`,icon:`i-lucide-octagon-pause`,disabled:Z.soft,onSelect:()=>ye(`soft`)},{label:`Kill (hard)`,icon:`i-lucide-octagon-x`,color:`error`,disabled:Z.hard,onSelect:()=>ye(`hard`)}]:[]]);function ye(e){(e!==`hard`||C.confirm(`Hard stop: abort this run now with no summary and free its sandbox?`))&&(Z[e]=!0,fetch(R(n.run,e),{method:`POST`,credentials:`same-origin`}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>{Z[e]=!1}))}function xe(e){e.target?.closest(`a, button`)||C.navigate(h.value)}return(n,x)=>{let C=ee(`RouterLink`),E=O,D=b,k=t;return p(),i(`li`,{class:u([`run group relative isolate rounded-md border-b border-muted hover:bg-(--ui-bg-muted) focus-within:bg-(--ui-bg-muted)`,[e.run.finished?`finished`:`live`,w.value?`leaving`:``,e.nestedUnder?`nested ml-4 border-l-2 border-accented sm:ml-6`:``]]),"data-run-id":e.run.id,"data-parent-id":e.nestedUnder,"data-started-at":String(e.run.startedAt),"data-persisted":e.run.persisted?`1`:void 0,"data-stalled":X.value?`1`:void 0,"data-expires-at":S.value===void 0?void 0:String(S.value),onClick:xe},[r(C,{class:`row absolute inset-0 rounded-md focus-visible:outline-2 focus-visible:outline-primary`,to:h.value,"aria-label":`open run ${e.run.label||v(me)(e.run.id)}`},null,8,[`to`,`aria-label`]),m(`div`,{class:u([`body pointer-events-none relative z-[1] flex min-w-0 flex-wrap items-center gap-x-2.5 px-2 max-sm:gap-y-1.5 max-sm:py-3 sm:flex-nowrap sm:py-2`,[e.run.finished?`text-muted`:``,w.value?`opacity-85`:``]])},[m(`span`,Ee,[r(be,{tone:l.value,label:v(V)(e.run),tip:v(G)(e.run),pulse:!e.run.finished},null,8,[`tone`,`label`,`tip`,`pulse`])]),r(E,{text:v(F)(e.run),ui:{text:`whitespace-pre-line`}},{default:f(()=>[m(`span`,{class:u([`when pointer-events-auto shrink-0 font-mono tabular-nums max-sm:order-7 max-sm:pl-5 max-sm:text-xs max-sm:text-dimmed sm:min-w-[8.5em] sm:text-[0.8rem]`,e.run.finished?`text-dimmed`:`text-muted`])},c(v(te)(e.run.startedAt,e.now)),3)]),_:1},8,[`text`]),_.value?(p(),T(E,{key:0,text:v(B)(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`,Oe,c(g.value.kind),1),m(`span`,ke,c(_.value),1)],10,De)]),_:1},8,[`text`])):(p(),i(`span`,Ae)),a.value.agent?(p(),i(`span`,{key:2,class:u([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider max-sm:order-2`,[v(ue)[v(U)(a.value.agent)],e.run.finished?`opacity-55`:``]]),"data-agent-hue":v(U)(a.value.agent)},c(a.value.agent),11,je)):d(``,!0),o.value?(p(),T(E,{key:3,text:o.value},{default:f(()=>[m(`a`,{class:`repo pointer-events-auto min-w-0 shrink-0 rounded border border-accented bg-accented/50 px-1.5 font-mono text-[0.72rem] font-medium leading-normal text-toned no-underline hover:border-(--ui-text-dimmed) hover:text-highlighted max-sm:order-3`,href:`https://github.com/${o.value}`,target:`_blank`,rel:`noopener noreferrer`},[m(`span`,Ne,c(o.value.slice(0,o.value.indexOf(`/`)+1)),1),m(`span`,Pe,c(o.value.slice(o.value.indexOf(`/`)+1)),1)],8,Me)]),_: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`,Fe,c(a.value.snippet),1)),M.value?(p(),i(`span`,{key:6,class:u([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,l.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},c(M.value),3)):d(``,!0),N.value?(p(),i(`span`,{key:7,class:u([`stopbadge shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,e.run.stop?.state===`stopped`?`border-accented text-muted`:`border-warn/30 text-warn`])},c(N.value),3)):d(``,!0),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`,K.value?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},`stalled`,2)):d(``,!0),m(`span`,Ie,[r(we,{kind:g.value.kind,tip:v(B)(e.run),url:y.value||void 0},null,8,[`kind`,`tip`,`url`])]),w.value&&S.value!==void 0?(p(),T(E,{key:9,text:`removed at ${v(ge)(S.value)}`},{default:f(()=>[m(`span`,Le,`gone `+c(v(ne)(S.value,e.now)),1)]),_:1},8,[`text`])):d(``,!0),r(E,{text:e.run.finished?`start to finish`:`running for`},{default:f(()=>[m(`span`,{class:u([`elapsed pointer-events-auto ml-auto shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-4 sm:min-w-[4.5em]`,e.run.finished?[j.value?`heat`:`text-muted`,A.value.level>=2?`font-medium`:``]:`text-ok`]),style:s(e.run.finished?j.value:void 0),"data-heat":e.run.finished?A.value.level:void 0},c(v(oe)(e.run,e.now)),15,Re)]),_:1},8,[`text`]),x[0]||=m(`span`,{class:`hidden text-xs text-dimmed max-sm:order-8 max-sm:inline`,"aria-hidden":`true`},`·`,-1),r(E,{text:v(le)(e.run)},{default:f(()=>[m(`span`,ze,c(v(ce)(e.run)),1)]),_:1},8,[`text`]),q.value?(p(),T(E,{key:10,text:v(se)(e.run,e.now)},{default:f(()=>[m(`span`,{class:u([`pace pointer-events-auto shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-9`,K.value?`text-bad font-medium`:X.value?`text-warn`:`text-dimmed`])},c(q.value),3)]),_:1},8,[`text`])):d(``,!0),m(`span`,Be,[Q.value.length>0?(p(),T(k,{key:0,items:Q.value,content:{align:`end`}},{default:f(()=>[r(D,{class:`pointer-events-auto -my-1.5 -mr-1`,size:`sm`,color:`neutral`,variant:`ghost`,icon:`i-lucide-ellipsis-vertical`,"aria-label":`Run actions`})]),_:1},8,[`items`])):d(``,!0)])],2)],10,Te)}}}),Ve={class:`view-as-picker inline-flex items-center gap-2`},He={key:0,class:`ml-2 truncate font-mono text-[0.6875rem] text-dimmed`},Ue={class:`font-mono`},We={key:0,class:`text-bad`},Ge=l({__name:`ViewAsPicker`,props:{people:{}},setup(t){let n=t,a=w(!1),o=w(``),s=D(()=>n.people.map(e=>({label:e.name??e.id,value:e.id,...e.name?{suffix:e.id}:{}})));async function l(t){let n=typeof t==`string`?t.trim():``;if(!n)return;a.value=!0,o.value=``;let r=await e(n);r.ok||(a.value=!1,o.value=r.message)}return(e,t)=>{let n=k;return p(),i(`span`,Ve,[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`,He,c(e.suffix),1)):d(``,!0)]),"create-item-label":f(({item:e})=>[t[0]||=y(` View as `,-1),m(`span`,Ue,c(e),1)]),_:1},8,[`items`,`disabled`]),o.value?(p(),i(`span`,We,c(o.value),1)):d(``,!0)])}}}),Ke={class:`conn flex items-center gap-1.5`},qe={id:`state`,class:`text-xs text-muted`},Je={class:`toolbar mb-1.5 flex items-center gap-4 px-2 text-xs text-muted`},Ye={id:`livecount`,class:`count font-mono tabular-nums`},Xe={class:`filter ml-auto inline-flex items-center gap-4`},Ze={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},Qe=[`checked`],$e={id:`minehint`,class:`sr-only`},et={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},tt=[`checked`],nt={id:`retention`,class:`sr-only`},rt={key:0,class:`banner mb-3 rounded-md border border-warn px-2.5 py-1.5 text-[0.8rem] text-warn`,role:`status`},it={id:`runs`,class:`m-0 list-none border-t border-muted p-0`},at={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`},ot={key:1,id:`empty`,class:`empty px-2 py-2 text-muted`},st={key:1,class:`pager mt-3 flex items-baseline gap-2 px-2 text-[0.8rem] text-muted`,"aria-label":`Completed runs pages`},ct={class:`range font-mono tabular-nums text-dimmed`},lt=l({__name:`RunsIndexPage`,setup(e){let t=S(`runs`),s=t?.all??!1,l=t?.mine??!1,u=new URLSearchParams(C.search());if(!u.has(`mine`)&&!u.has(`all`)&&t){let e=C.readPref(Z.mine)===`1`,t=C.readPref(Z.all)===`1`;(e||t)&&C.navigate(k(t,e))}let b=t?.asUser?`Only the runs ${t.asUser.name??`you`} requested`:`Only the runs this session requested from Threads. Sign in with the email of your Slack account to see your Slack runs too.`;function k(e,t){let n=[e?`all=1`:``,t?`mine=1`:``].filter(Boolean).join(`&`);return n?`/runs?${n}`:`/runs`}let te=t?.olderThan!==void 0,P=t?.retentionDays??null,F=P===null?void 0:P*864e5,I=h(P),L=E(new Map);for(let e of t?.rows??[])L.set(e.id,e);let R=N(t?.now),z=w({tone:`amber`,text:`connecting…`}),B=D(()=>q([...L.values()],R.value)),V=D(()=>[...L.values()].filter(e=>!e.finished).length),H=D(()=>F===void 0?-1:B.value.findIndex(e=>{let t=de(e.head,F);return t!==void 0&&t-R.value<=864e5})),U=D(()=>H.value===-1?B.value:B.value.slice(0,H.value)),W=D(()=>H.value===-1?[]:B.value.slice(H.value)),G=s?`All runs`:`Live runs`;o(V,e=>{C.setTitle((e>0?`(${e}) `:``)+G),C.setFavicon(e>0?j:A)},{immediate:!0});function re(e){let t=e.target.checked;C.writePref(Z.all,t?`1`:`0`),C.navigate(k(t,l))}function ie(e){let t=e.target.checked;C.writePref(Z.mine,t?`1`:`0`),C.navigate(k(s,t))}let J=D(()=>t?.olderThan===void 0?``:ne(t.olderThan,R.value)),ae=M(),Y=null;return g(()=>{Y=ae(`/runs?stream=1${s?`&all=1`:``}${l?`&mine=1`:``}`);let e=!1;Y.onopen=()=>{if(e){C.reload();return}e=!0,z.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?L.get(n):void 0;if(te&&!r)return;let i=K(t,s,r?.persisted===!0);i.op===`upsert`?L.set(i.run.id,X(L.get(i.run.id),i.run)):i.op===`remove`&&L.delete(i.id)},Y.onerror=()=>{Y&&Y.readyState===2?z.value={tone:`red`,text:`disconnected`}:z.value={tone:`amber`,text:`connecting…`}}}),_(()=>{Y?.close()}),(e,o)=>{let u=O,h=ee(`RouterLink`);return p(),T(n,{title:v(G),nav:`runs`},{status:f(()=>[m(`span`,Ke,[r(be,{tone:z.value.tone,label:z.value.text},null,8,[`tone`,`label`]),m(`span`,qe,c(z.value.text),1)])]),default:f(()=>[r(ye,{current:`runs`}),m(`div`,Je,[m(`span`,Ye,c(V.value)+` running`,1),m(`span`,Xe,[v(t)?.viewAs?(p(),T(Ge,{key:0,people:v(t).viewAs.people},null,8,[`people`])):d(``,!0),r(u,{text:v(b)},{default:f(()=>[m(`label`,Ze,[m(`input`,{id:`showmine`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:v(l),"aria-describedby":`minehint`,onChange:ie},null,40,Qe),o[0]||=y(` Show only mine `,-1)])]),_:1},8,[`text`]),m(`span`,$e,c(v(b)),1),m(`label`,et,[m(`input`,{id:`showdone`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:v(s),"aria-describedby":`retention`,onChange:re},null,40,tt),o[1]||=y(` Show completed `,-1)]),r(u,{text:v(I)},{default:f(()=>[...o[2]||=[m(`span`,{class:`help inline-flex size-[1.1em] cursor-help items-center justify-center rounded-full border border-accented text-[0.7rem] leading-none text-dimmed hover:border-(--ui-text-dimmed) hover:text-toned`,tabindex:`0`},`?`,-1)]]),_:1},8,[`text`]),m(`span`,nt,c(v(I)),1)])]),v(t)?.storeUnavailable?(p(),i(`p`,rt,c(v(t).storeUnavailable),1)):d(``,!0),m(`ul`,it,[(p(!0),i(x,null,a(U.value,e=>(p(),i(x,{key:e.head.id},[r($,{run:e.head,now:v(R),"retention-ms":v(F)},null,8,[`run`,`now`,`retention-ms`]),(p(!0),i(x,null,a(e.children,t=>(p(),T($,{key:t.id,run:t,now:v(R),"retention-ms":v(F),"nested-under":e.head.id},null,8,[`run`,`now`,`retention-ms`,`nested-under`]))),128))],64))),128)),W.value.length>0?(p(),i(`li`,at,[...o[3]||=[m(`span`,{"aria-hidden":`true`,class:`text-sm tracking-normal`},`⏳`,-1),m(`span`,{class:`whitespace-nowrap`},`Leaving within a day`,-1),m(`span`,{class:`normal-case tracking-normal text-dimmed max-sm:hidden`},`— each row says when it is removed`,-1)]])):d(``,!0),(p(!0),i(x,null,a(W.value,e=>(p(),i(x,{key:e.head.id},[r($,{run:e.head,now:v(R),"retention-ms":v(F)},null,8,[`run`,`now`,`retention-ms`]),(p(!0),i(x,null,a(e.children,t=>(p(),T($,{key:t.id,run:t,now:v(R),"retention-ms":v(F),"nested-under":e.head.id},null,8,[`run`,`now`,`retention-ms`,`nested-under`]))),128))],64))),128)),B.value.length===0?(p(),i(`li`,ot,c(v(l)?v(s)?`No runs of yours.`:`No active runs of yours.`:v(s)?`No runs.`:`No active runs.`),1)):d(``,!0)]),v(s)&&(v(t)?.olderHref||v(t)?.olderThan!==void 0)?(p(),i(`nav`,st,[v(t)?.olderThan===void 0?d(``,!0):(p(),i(x,{key:0},[r(h,{class:`text-primary hover:underline`,to:k(!0,v(l))},{default:f(()=>[...o[4]||=[y(`← Newest runs`,-1)]]),_:1},8,[`to`]),m(`span`,ct,`· runs finished before `+c(J.value),1)],64)),v(t)?.olderHref?(p(),T(h,{key:1,class:`older ml-auto text-primary hover:underline`,to:v(t).olderHref},{default:f(()=>[...o[5]||=[y(`Older runs →`,-1)]]),_:1},8,[`to`])):d(``,!0)])):d(``,!0)]),_:1},8,[`title`])}}});export{lt as default};