@coreplane/switchboard 1.241.0 → 1.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/assets/config/config.example.yaml +25 -12
  2. package/dist/assets/deploy/cloudflare-resident/worker.ts +197 -15
  3. package/dist/assets/deploy/cloudflare-sandbox/worker.ts +38 -5
  4. package/dist/assets/package-lock.json +3 -3
  5. package/dist/assets/package.json +1 -1
  6. package/dist/assets/project.json +2 -2
  7. package/dist/assets/source.json +3 -3
  8. package/dist/assets/src/agents/registry.ts +31 -14
  9. package/dist/assets/src/core/authz/actor.ts +12 -9
  10. package/dist/assets/src/core/authz/authorize.ts +17 -4
  11. package/dist/assets/src/core/authz/types.ts +12 -0
  12. package/dist/assets/src/core/coordinator/contract.ts +3 -1
  13. package/dist/assets/src/core/costs.ts +12 -4
  14. package/dist/assets/src/core/harness/scope.ts +21 -0
  15. package/dist/assets/src/core/runEvents.ts +20 -1
  16. package/dist/assets/src/core/runLedger/types.ts +2 -0
  17. package/dist/assets/src/core/runRecord.ts +4 -0
  18. package/dist/assets/src/core/ship/contract.ts +4 -2
  19. package/dist/assets/src/execution/residentAutoRebuild.ts +4 -2
  20. package/dist/assets/src/execution/residentHead.ts +23 -10
  21. package/dist/assets/src/execution/residentInfraStreak.ts +89 -0
  22. package/dist/assets/src/execution/residentRefresh.ts +15 -1
  23. package/dist/assets/src/execution/residentSteps.ts +1 -0
  24. package/dist/assets/src/execution/sandboxErrors.ts +6 -0
  25. package/dist/assets/src/execution/seedPlan.ts +17 -0
  26. package/dist/assets/web/dist/.vite/manifest.json +419 -425
  27. package/dist/assets/web/dist/assets/{AppShell-DEy5jRuS.js → AppShell-IDMGG6yi.js} +1 -1
  28. package/dist/assets/web/dist/assets/{CostsPage-BuHD-Bv7.js → CostsPage-CtmKhhOF.js} +1 -1
  29. package/dist/assets/web/dist/assets/{DeliveryPage-BGpPr5xr.js → DeliveryPage-n1tz5I_v.js} +1 -1
  30. package/dist/assets/web/dist/assets/HomePage-QtH1EwYF.js +2 -0
  31. package/dist/assets/web/dist/assets/{NotFoundPage-DtmQM2gD.js → NotFoundPage-C97EhJcQ.js} +1 -1
  32. package/dist/assets/web/dist/assets/{PendingTurnRow-CrEAWx5b.js → PendingTurnRow-BZA_vQt3.js} +1 -1
  33. package/dist/assets/web/dist/assets/{ResidentDetailPage-C-48fxat.js → ResidentDetailPage-DTMBgnIW.js} +1 -1
  34. package/dist/assets/web/dist/assets/{ResidentsIndexPage-CBBIjPOa.js → ResidentsIndexPage-CaDvXhzJ.js} +1 -1
  35. package/dist/assets/web/dist/assets/RunFoldRow-mgyLW0oV.js +1 -0
  36. package/dist/assets/web/dist/assets/RunRoutePage-DypJYMQa.js +6 -0
  37. package/dist/assets/web/dist/assets/RunsIndexPage-DYraPoWD.js +1 -0
  38. package/dist/assets/web/dist/assets/{RunsTabs-CtNGNnhN.js → RunsTabs-BUfdk0lH.js} +1 -1
  39. package/dist/assets/web/dist/assets/{ScheduledPage-Ci1Ygqnc.js → ScheduledPage-DXD2gLJk.js} +1 -1
  40. package/dist/assets/web/dist/assets/SettingsPage-BIGio8Y0.js +1 -0
  41. package/dist/assets/web/dist/assets/{StatusDot-DPWE1JmO.js → StatusDot-ELoXHlFt.js} +1 -1
  42. package/dist/assets/web/dist/assets/{Tooltip-DKhSRH9t.js → Tooltip-BoeFwYP2.js} +1 -1
  43. package/dist/assets/web/dist/assets/UnitRoutePage-jhCrWW3i.js +1 -0
  44. package/dist/assets/web/dist/assets/{angular-html-DgSK1qvr.js → angular-html-oBNfPJR0.js} +1 -1
  45. package/dist/assets/web/dist/assets/{angular-ts-D3gNdiSG.js → angular-ts-BvNwsyWA.js} +1 -1
  46. package/dist/assets/web/dist/assets/{apl-CkHCYM8I.js → apl-CNUdRlYf.js} +1 -1
  47. package/dist/assets/web/dist/assets/{astro-DLm45axt.js → astro-Zb0NriSe.js} +1 -1
  48. package/dist/assets/web/dist/assets/{blade-BKa-VE-c.js → blade-qPRVheqq.js} +1 -1
  49. package/dist/assets/web/dist/assets/{c-C8NCNWai.js → c-D8Awx4YO.js} +1 -1
  50. package/dist/assets/web/dist/assets/{chapel-DqDQ7IKH.js → chapel-Bt72Mhsx.js} +1 -1
  51. package/dist/assets/web/dist/assets/{cobol-j4vCD6AJ.js → cobol-BOBacexg.js} +1 -1
  52. package/dist/assets/web/dist/assets/{coffee-C6oDVH-0.js → coffee-E4u0liHW.js} +1 -1
  53. package/dist/assets/web/dist/assets/{cpp-Bd3A1Rtc.js → cpp-q2sLNlul.js} +1 -1
  54. package/dist/assets/web/dist/assets/{crystal-CUOgOw0d.js → crystal-DyWqUnlb.js} +1 -1
  55. package/dist/assets/web/dist/assets/{css-RYljyv7G.js → css-CQY0hFsD.js} +1 -1
  56. package/dist/assets/web/dist/assets/{dist-BnJXKHCY.js → dist-BU5UivXC.js} +2 -2
  57. package/dist/assets/web/dist/assets/durationTone-BobbycC-.js +1 -0
  58. package/dist/assets/web/dist/assets/{edge-BJhNdQDc.js → edge-C1MwhJkX.js} +1 -1
  59. package/dist/assets/web/dist/assets/{elixir-g1AWOAfT.js → elixir-Bb3YbHfn.js} +1 -1
  60. package/dist/assets/web/dist/assets/{elm-CER5e4Dz.js → elm-DAN9IGQw.js} +1 -1
  61. package/dist/assets/web/dist/assets/{erb-D5aOmMQf.js → erb-BEB8Xlsj.js} +1 -1
  62. package/dist/assets/web/dist/assets/{git-rebase-D6rfV8jp.js → git-rebase-tqpjRfxO.js} +1 -1
  63. package/dist/assets/web/dist/assets/{glimmer-js-BvDH3-mC.js → glimmer-js-Ccbo65zR.js} +1 -1
  64. package/dist/assets/web/dist/assets/{glimmer-ts-DChtNs9V.js → glimmer-ts-B6WBVMpE.js} +1 -1
  65. package/dist/assets/web/dist/assets/{glsl-BHlsWrxf.js → glsl-tRec3Fcu.js} +1 -1
  66. package/dist/assets/web/dist/assets/{graphql-BsaBHb53.js → graphql-P8kbxT4F.js} +1 -1
  67. package/dist/assets/web/dist/assets/{hack-0lbDosCd.js → hack-H9Zhkagy.js} +1 -1
  68. package/dist/assets/web/dist/assets/{haml-BKtco2vr.js → haml-DtEnpn7Z.js} +1 -1
  69. package/dist/assets/web/dist/assets/{handlebars-BE_cj04z.js → handlebars-DkgPfoAz.js} +1 -1
  70. package/dist/assets/web/dist/assets/{html-BNcr8EVd.js → html-D30RXpIs.js} +1 -1
  71. package/dist/assets/web/dist/assets/{html-derivative-BsJt2Kei.js → html-derivative-DwozLrEx.js} +1 -1
  72. package/dist/assets/web/dist/assets/{http-BR5P8ER_.js → http-DXuzBAPm.js} +1 -1
  73. package/dist/assets/web/dist/assets/{hurl-CtHalpWS.js → hurl-d1UUJIt_.js} +1 -1
  74. package/dist/assets/web/dist/assets/{java-BXVdhN11.js → java-DL0gWf34.js} +1 -1
  75. package/dist/assets/web/dist/assets/{javascript-CyoShgNQ.js → javascript-Cl7vavnS.js} +1 -1
  76. package/dist/assets/web/dist/assets/{jinja-BQYZzHex.js → jinja-CfQOWMX9.js} +1 -1
  77. package/dist/assets/web/dist/assets/{jison-DqrUa1Eq.js → jison-KdYirlqm.js} +1 -1
  78. package/dist/assets/web/dist/assets/{json-CQiTF9Jj.js → json-C9cDQ-Qj.js} +1 -1
  79. package/dist/assets/web/dist/assets/{jsx-Y16MkCYQ.js → jsx-CRx5NItd.js} +1 -1
  80. package/dist/assets/web/dist/assets/{julia-zn16YONe.js → julia-CmsQsZQl.js} +1 -1
  81. package/dist/assets/web/dist/assets/{just-DcVeN_MN.js → just-CsM3Q8TE.js} +1 -1
  82. package/dist/assets/web/dist/assets/{latex-BNNoF-WP.js → latex-BXCh5YRX.js} +1 -1
  83. package/dist/assets/web/dist/assets/{liquid-DAi6qHzn.js → liquid-BF2vwK8p.js} +1 -1
  84. package/dist/assets/web/dist/assets/{lua-BswS0axw.js → lua-DcMBATrl.js} +1 -1
  85. package/dist/assets/web/dist/assets/main-B2fX10aW.css +1 -0
  86. package/dist/assets/web/dist/assets/{main-B3is4sk6.js → main-D4EA1g6n.js} +2 -2
  87. package/dist/assets/web/dist/assets/{marko-C-4hkmQZ.js → marko-88MndKvG.js} +1 -1
  88. package/dist/assets/web/dist/assets/{mdc-0ZaHUkS7.js → mdc-DJ4kVAd8.js} +1 -1
  89. package/dist/assets/web/dist/assets/{nginx-DBDg5tOR.js → nginx-CP6mRgtV.js} +1 -1
  90. package/dist/assets/web/dist/assets/{nim-BVMz49Yw.js → nim-QQfj3fpF.js} +1 -1
  91. package/dist/assets/web/dist/assets/{org-1hO_K6ya.js → org-Bke3eBzc.js} +1 -1
  92. package/dist/assets/web/dist/assets/{perl-CVRQLvVk.js → perl-Bkh0N7Kz.js} +1 -1
  93. package/dist/assets/web/dist/assets/{php-K9nCrB9n.js → php-Dnv1Piya.js} +1 -1
  94. package/dist/assets/web/dist/assets/{pug-CTxOcmO3.js → pug-D6peFFI7.js} +1 -1
  95. package/dist/assets/web/dist/assets/{qml-CmCkfG5q.js → qml-D8PEs-C-.js} +1 -1
  96. package/dist/assets/web/dist/assets/{r-pP47Xn1X.js → r-B1EL9b_j.js} +1 -1
  97. package/dist/assets/web/dist/assets/{razor-BpW6r3tC.js → razor-BsMTIh2b.js} +1 -1
  98. package/dist/assets/web/dist/assets/{regexp-CINgdY4N.js → regexp-HhvC8spD.js} +1 -1
  99. package/dist/assets/web/dist/assets/{rst-BZIUEq2Q.js → rst-D5paAxpg.js} +1 -1
  100. package/dist/assets/web/dist/assets/{ruby-nzAOxz6r.js → ruby-BrQwhLrl.js} +1 -1
  101. package/dist/assets/web/dist/assets/{sas-QIS1bFth.js → sas-afot2B1o.js} +1 -1
  102. package/dist/assets/web/dist/assets/{scss-BuhBBVNt.js → scss-Efm-mwuG.js} +1 -1
  103. package/dist/assets/web/dist/assets/{shellscript-CQc1vXbk.js → shellscript-BK0Vv5fT.js} +1 -1
  104. package/dist/assets/web/dist/assets/{shellsession-CoubCAUv.js → shellsession-BGqlMC7N.js} +1 -1
  105. package/dist/assets/web/dist/assets/{soy-CPRzlder.js → soy-M0b4UwGM.js} +1 -1
  106. package/dist/assets/web/dist/assets/{sql-W9krb8-9.js → sql-sxe6IE9j.js} +1 -1
  107. package/dist/assets/web/dist/assets/sseReplay-g7ml86LM.js +9 -0
  108. package/dist/assets/web/dist/assets/{stata-CuISJEC0.js → stata-nPF_ddLP.js} +1 -1
  109. package/dist/assets/web/dist/assets/{surrealql-CSet7584.js → surrealql-D_GrC6u7.js} +1 -1
  110. package/dist/assets/web/dist/assets/{svelte-ChXTSYwK.js → svelte-DwL1AtNP.js} +1 -1
  111. package/dist/assets/web/dist/assets/{templ-Bm55v62k.js → templ-7s7LTDkc.js} +1 -1
  112. package/dist/assets/web/dist/assets/{tex-CICMX8Gj.js → tex-Bx-5fMxe.js} +1 -1
  113. package/dist/assets/web/dist/assets/{ts-tags-CA1UzWyB.js → ts-tags-DUMJnke_.js} +1 -1
  114. package/dist/assets/web/dist/assets/{tsx-Dy04HNbv.js → tsx-BN8biPDe.js} +1 -1
  115. package/dist/assets/web/dist/assets/{twig-BBHsVnVD.js → twig-8nIu84TN.js} +1 -1
  116. package/dist/assets/web/dist/assets/{typescript-Dvc-wVBT.js → typescript-BooSPq_S.js} +1 -1
  117. package/dist/assets/web/dist/assets/{typst-Dvlqx3_q.js → typst-CTBiBsem.js} +1 -1
  118. package/dist/assets/web/dist/assets/{vue-zWi1MNU2.js → vue-C6Ft4Lea.js} +1 -1
  119. package/dist/assets/web/dist/assets/{vue-html-D4YxT3An.js → vue-html-Ba36dD5D.js} +1 -1
  120. package/dist/assets/web/dist/assets/{vue-vine-0YE7uQlH.js → vue-vine-NkFexVo2.js} +1 -1
  121. package/dist/assets/web/dist/assets/{xml-gm-iksZB.js → xml-C_THnHXZ.js} +1 -1
  122. package/dist/assets/web/dist/assets/{xsl-D_W5BcrY.js → xsl-D8G5xqjY.js} +1 -1
  123. package/dist/assets/web/dist/assets/{yaml-CHmZ21wZ.js → yaml-jAMIJzge.js} +1 -1
  124. package/dist/cli.js +1390 -484
  125. package/package.json +1 -1
  126. package/dist/assets/web/dist/assets/HomePage-dKBvWh-E.js +0 -2
  127. package/dist/assets/web/dist/assets/RunFoldRow-B6vxjcBI.js +0 -1
  128. package/dist/assets/web/dist/assets/RunRoutePage-CQjd3Cz-.js +0 -6
  129. package/dist/assets/web/dist/assets/RunsIndexPage-Cy9G6D0p.js +0 -1
  130. package/dist/assets/web/dist/assets/SettingsPage-DxmJvAmT.js +0 -1
  131. package/dist/assets/web/dist/assets/SlackMark-VDNs7Vjh.js +0 -1
  132. package/dist/assets/web/dist/assets/UnitRoutePage-DEN5bSQf.js +0 -1
  133. package/dist/assets/web/dist/assets/durationTone-DXG-3R7_.js +0 -1
  134. package/dist/assets/web/dist/assets/main-DP_zSemY.css +0 -1
  135. package/dist/assets/web/dist/assets/sseReplay-yji8a1wM.js +0 -9
@@ -1,2 +1,2 @@
1
- import{t as e}from"./AppShell-DEy5jRuS.js";import{Ci as t,Lr as n,Lt as r,Qn as i,Vt as a,Xt as o,_n as s,ci as c,cn as l,gn as u,ir as d,ln as f,nr as p,on as m,r as h,sn as g,un as _,ur as v,vi as y,wi as b,xi as x,yn as S,zr as C}from"./seed-DeKSHrt2.js";import{d as w,f as T,l as E}from"./delivery-CTdOqpVK.js";import{t as ee}from"./eventSource-tRprhqm7.js";import{i as te}from"./settingsApi-priOPiwu.js";import{t as ne}from"./wallClock-61NpVkY6.js";var D=`Durable Objects`;function re(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 O=e=>e===`schedule`?`on schedule`:`by ${e}`;function ie(e,t){let n=[];return e.inFlight?(n.push(`Taking a snapshot now — started ${w(e.inFlight.startedAt,t)} ${O(e.inFlight.by)}`),e.snapshot&&n.push(`showing the one from ${E(e.snapshot.takenAt)} meanwhile`)):e.snapshot?(n.push(`Snapshot from ${E(e.snapshot.takenAt)}, ${w(e.snapshot.takenAt,t)} ${O(e.snapshot.takenBy)}`),e.nextAt&&n.push(`next ${T(e.nextAt,t)}`)):n.push(`No snapshot yet — the first one is taken within a minute of startup`),e.lastFailure&&!e.inFlight&&n.push(`last attempt ${w(e.lastFailure.at,t)} failed: ${e.lastFailure.message.slice(0,120)}`),n.join(` · `)}var k=`Workers · storage · R2`,A=`LLM (Anthropic)`,j=(e,t=2)=>`$${e.toFixed(t)}`,M=e=>e.workersUsd+e.doRowsUsd+e.doStorageUsd+e.r2Usd+e.workflowsUsd;function ae(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(D),e.days.some(e=>M(e)>0)&&t.push(k),e.llmAvailable&&t.push(A),t}function N(e,t){return t===`Durable Objects`?Object.values(e.durableObjects).reduce((e,t)=>e+t,0)+e.doRequestsUsd:t===`Workers · storage · R2`?M(e):t===`LLM (Anthropic)`?e.llmUsd:e.containers[t]?.total??0}var P=30.4;function oe(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:L(e,t,n),llm:{range:e.totals.llmUsd,...r?{yesterday:r.llmUsd}:{},...n?{today:{usd:n.llmUsd,estimated:n.llmEstimated}}:{}},accountShare:o}}var F=e=>e.reduce((e,t)=>e+t,0)/e.length;function I(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 L(e,t,n){let r=n?I(e,n):1,i=t.slice(-7),a=0,o=`full-days`;i.length?a=F(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=F(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)*P,cloudRate:a,llmRate:s,cloudBasis:o,llmBasis:c,llmClosedDays:l}}function se(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 ce=e=>e.account.name??`${e.account.id.slice(0,8)}…`;function le(e,t,n){let r=[`${e.date} · total ${j(e.total)}${n?` (partial day)`:``}`];for(let n of t){let t=N(e,n);t<=0||r.push(`${n} ${j(t)}${n===`LLM (Anthropic)`&&e.llmEstimated?` (estimate)`:``}`)}return r.join(`
1
+ import{t as e}from"./AppShell-IDMGG6yi.js";import{Ci as t,Lr as n,Lt as r,Qn as i,Vt as a,Xt as o,_n as s,ci as c,cn as l,gn as u,ir as d,ln as f,nr as p,on as m,r as h,sn as g,un as _,ur as v,vi as y,wi as b,xi as x,yn as S,zr as C}from"./seed-DeKSHrt2.js";import{d as w,f as T,l as E}from"./delivery-CTdOqpVK.js";import{t as ee}from"./eventSource-tRprhqm7.js";import{i as te}from"./settingsApi-priOPiwu.js";import{t as ne}from"./wallClock-61NpVkY6.js";var D=`Durable Objects`;function re(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 O=e=>e===`schedule`?`on schedule`:`by ${e}`;function ie(e,t){let n=[];if(e.inFlight?(n.push(`Taking a snapshot now — started ${w(e.inFlight.startedAt,t)} ${O(e.inFlight.by)}`),e.snapshot&&n.push(`showing the one from ${E(e.snapshot.takenAt)} meanwhile`)):e.snapshot?(n.push(`Snapshot from ${E(e.snapshot.takenAt)}, ${w(e.snapshot.takenAt,t)} ${O(e.snapshot.takenBy)}`),e.nextAt&&n.push(`next ${T(e.nextAt,t)}`)):e.nextAt?n.push(`No snapshot yet — next attempt ${T(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 ${w(e.lastFailure.at,t)} failed${r}: ${e.lastFailure.message.slice(0,120)}`)}return n.join(` · `)}var k=`Workers · storage · R2`,A=`LLM (Anthropic)`,j=(e,t=2)=>`$${e.toFixed(t)}`,M=e=>e.workersUsd+e.doRowsUsd+e.doStorageUsd+e.r2Usd+e.workflowsUsd;function ae(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(D),e.days.some(e=>M(e)>0)&&t.push(k),e.llmAvailable&&t.push(A),t}function N(e,t){return t===`Durable Objects`?Object.values(e.durableObjects).reduce((e,t)=>e+t,0)+e.doRequestsUsd:t===`Workers · storage · R2`?M(e):t===`LLM (Anthropic)`?e.llmUsd:e.containers[t]?.total??0}var P=30.4;function oe(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:L(e,t,n),llm:{range:e.totals.llmUsd,...r?{yesterday:r.llmUsd}:{},...n?{today:{usd:n.llmUsd,estimated:n.llmEstimated}}:{}},accountShare:o}}var F=e=>e.reduce((e,t)=>e+t,0)/e.length;function I(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 L(e,t,n){let r=n?I(e,n):1,i=t.slice(-7),a=0,o=`full-days`;i.length?a=F(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=F(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)*P,cloudRate:a,llmRate:s,cloudBasis:o,llmBasis:c,llmClosedDays:l}}function se(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 ce=e=>e.account.name??`${e.account.id.slice(0,8)}…`;function le(e,t,n){let r=[`${e.date} · total ${j(e.total)}${n?` (partial day)`:``}`];for(let n of t){let t=N(e,n);t<=0||r.push(`${n} ${j(t)}${n===`LLM (Anthropic)`&&e.llmEstimated?` (estimate)`:``}`)}return r.join(`
2
2
  `)}function R(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 ue(e,t,n){let r=t.map(t=>({series:t,usd:N(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:R(e.date),partial:n,total:e.total,rows:r}}function z(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:j(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:le(r,t,e.range.partialLastDay&&o===a.length-1),tip:ue(r,t,e.range.partialLastDay&&o===a.length-1)}),t.forEach((e,t)=>{let n=N(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 de(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 B=[`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]`],V=[`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]`],H={class:`overflow-x-auto`},U=[`viewBox`],W=[`x1`,`x2`,`y1`,`y2`],G=[`x`,`y`],K=[`x`,`y`,`width`,`height`],q=[`aria-label`,`x`,`y`,`width`,`height`,`onPointerenter`,`onPointermove`],J=[`x`,`y`],Y=[`x1`,`x2`,`y1`,`y2`],fe={class:`tip-head mb-1.5 flex items-baseline justify-between gap-3 border-b border-muted pb-1.5`},X={class:`font-medium text-highlighted`},pe={key:0,class:`ml-1.5 font-normal text-dimmed`},me={class:`font-medium text-highlighted`},he={class:`tip-name truncate text-muted`},ge={class:`text-highlighted`},Z={class:`tip-usd`},_e={key:0,class:`ml-1 text-dimmed`},Q=256,$=12,ve=S({__name:`CostChart`,props:{report:{},series:{}},setup(e){let n=e,r=m(()=>z(n.report,n.series)),i=e=>44+e*20,a=c(null),s=c(null);function l(e,t){let n=s.value,r=n?.getBoundingClientRect(),o=t.clientX-(r?.left??0),c=t.clientY-(r?.top??0),l=n?.clientWidth??0,u=n?.clientHeight??0,d=i(e.tip.rows.length),f=l>0&&o+$+Q>l,p=u>0&&c+$+d>u;a.value={x:Math.max(0,f?o-$-Q:o+$),y:Math.max(0,p?c-$-d:c+$),data:e.tip}}return(e,n)=>(d(),_(`div`,{ref_key:`host`,ref:s,class:`chart-host relative`},[g(`div`,H,[(d(),_(`svg`,{class:`block h-auto w-full font-mono`,viewBox:`0 0 ${r.value.width} ${r.value.height}`,role:`img`,"aria-label":`Daily cost, stacked by component`},[(d(!0),_(o,null,v(r.value.gridLines,(e,t)=>(d(),_(o,{key:`g${t}`},[g(`line`,{class:`stroke-(--ui-border-muted)`,x1:r.value.marginLeft,x2:r.value.width-r.value.marginRight,y1:e.y,y2:e.y},null,8,W),g(`text`,{class:`fill-(--ui-text-dimmed) text-[11px] tabular-nums`,x:r.value.marginLeft-8,y:e.y+4,"text-anchor":`end`},b(e.label),9,G)],64))),128)),(d(!0),_(o,null,v(r.value.segments,(e,t)=>(d(),_(`rect`,{key:`s${t}`,class:x([`seg hover:opacity-85`,y(B)[e.seriesIndex%y(B).length]]),x:e.x,y:e.y,width:e.width,height:e.height},null,10,K))),128)),(d(!0),_(o,null,v(r.value.dayHovers,(e,t)=>(d(),_(`rect`,{key:`h${t}`,class:`day fill-transparent`,role:`img`,"aria-label":e.title,x:e.x,y:e.y,width:e.width,height:e.height,onPointerenter:t=>l(e,t),onPointermove:t=>l(e,t),onPointerleave:n[0]||=e=>a.value=null},null,40,q))),128)),(d(!0),_(o,null,v(r.value.dayLabels,(e,t)=>(d(),_(`text`,{key:`d${t}`,class:`fill-(--ui-text-dimmed) text-[11px]`,x:e.x,y:r.value.height-10,"text-anchor":`middle`},b(e.label),9,J))),128)),g(`line`,{class:`stroke-(--ui-border)`,x1:r.value.marginLeft,x2:r.value.width-r.value.marginRight,y1:r.value.axisY,y2:r.value.axisY},null,8,Y)],8,U))]),a.value?(d(),_(`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:t({left:`${a.value.x}px`,top:`${a.value.y}px`})},[g(`div`,fe,[g(`span`,X,[u(b(a.value.data.label),1),a.value.data.partial?(d(),_(`span`,pe,`partial day`)):f(``,!0)]),g(`span`,me,b(y(j)(a.value.data.total)),1)]),(d(!0),_(o,null,v(a.value.data.rows,e=>(d(),_(`div`,{key:e.series,class:`tip-row flex items-baseline justify-between gap-3 leading-5`},[g(`span`,he,b(e.series),1),g(`span`,ge,[g(`span`,Z,b(y(j)(e.usd)),1),e.estimated?(d(),_(`span`,_e,`est.`)):f(``,!0)])]))),128))],4)):f(``,!0)],512))}}),ye={class:`by-user grid gap-3`},be={class:`flex flex-wrap items-center gap-x-4 gap-y-2`},xe={class:`flex items-center gap-2 text-sm text-muted`},Se=[`title`],Ce=[`disabled`,`aria-describedby`],we={key:0,id:`me-hint`,class:`me-hint text-xs text-dimmed`},Te={class:`coverage font-mono text-xs tabular-nums text-muted`},Ee={class:`overflow-x-auto`},De={class:`users w-full min-w-[40rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},Oe=[`title`],ke={class:`text-highlighted`},Ae={class:`ml-1.5 text-xs text-dimmed`},je={key:0,class:`ml-1.5 rounded-xs bg-accented px-1 text-xs text-highlighted`},Me=[`title`],Ne={class:`border-b border-muted px-2.5 py-1.5 text-right`},Pe={class:`border-b border-muted px-2.5 py-1.5 text-right`},Fe={class:`border-b border-muted px-2.5 py-1.5 text-right`},Ie={class:`border-b border-muted px-2.5 py-1.5 text-right font-medium text-highlighted`},Le={class:`border-b border-muted px-2.5 py-1.5 text-right`},Re={key:0},ze={class:`empty px-2.5 py-3 text-sm text-muted`,colspan:`6`},Be={key:0},Ve={class:`px-2.5 py-1.5 text-right text-xs text-muted`},He={class:`px-2.5 py-1.5 text-right text-xs text-muted`},Ue={class:`reconciliation font-mono text-xs tabular-nums text-muted`},We=S({__name:`CostsByUser`,props:{report:{}},setup(e){let t=e,n=c(``),i=c(!1),s=m(()=>t.report.viewer.userIds.length>0),l=m(()=>{let e=n.value.trim().toLowerCase(),r=new Set(t.report.viewer.userIds);return t.report.users.filter(t=>i.value&&!r.has(t.userId)?!1:!e||t.userId.toLowerCase().includes(e)||(t.userName??``).toLowerCase().includes(e))}),p=m(()=>t.report.users.reduce((e,t)=>e+t.totalUsd,0)),h=m(()=>l.value.reduce((e,t)=>e+t.totalUsd,0)),S=e=>t.report.viewer.userIds.includes(e.userId),w=e=>e.userName??e.userId.replace(/^[a-z]+:/,``),T=e=>e.userId.split(`:`)[0]??``,E=e=>`${e} day${e===1?``:`s`}`;return(t,c)=>(d(),_(`section`,ye,[g(`div`,be,[g(`label`,xe,[c[2]||=g(`span`,null,`Filter`,-1),C(g(`input`,{"onUpdate:modelValue":c[0]||=e=>n.value=e,class:`user-filter rounded-md border border-default bg-elevated px-2.5 py-1 font-mono text-xs text-highlighted`,type:`search`,placeholder:`name or id`,"aria-label":`Filter users`},null,512),[[a,n.value]])]),g(`label`,{class:x([`me-toggle flex items-center gap-2 text-sm`,s.value?`text-muted`:`text-dimmed`]),title:s.value?`Only your own runs`:void 0},[C(g(`input`,{"onUpdate:modelValue":c[1]||=e=>i.value=e,type:`checkbox`,disabled:!s.value,"aria-label":`Only me`,"aria-describedby":s.value?void 0:`me-hint`},null,8,Ce),[[r,i.value]]),c[3]||=g(`span`,null,`me`,-1),s.value?f(``,!0):(d(),_(`span`,we,`— your sign-in email matched no Slack user in this range`))],10,Se),g(`p`,Te,[e.report.coverage.historyOn?(d(),_(o,{key:1},[u(` runs from `+b(y(R)(e.report.coverage.from))+` to `+b(y(R)(e.report.range.to)),1),e.report.coverage.clamped?(d(),_(o,{key:0},[u(` · earlier days are past the history's `+b(e.report.coverage.retentionDays)+`-day window`,1)],64)):f(``,!0),e.report.pending>0?(d(),_(o,{key:1},[u(` · `+b(e.report.pending)+` run`+b(e.report.pending===1?``:`s`)+` still being priced`,1)],64)):f(``,!0)],64)):(d(),_(o,{key:0},[u(`run history is off — no runs to attribute`)],64))])]),g(`div`,Ee,[g(`table`,De,[c[5]||=g(`thead`,null,[g(`tr`,null,[g(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-left text-xs font-medium text-muted`},` User `),g(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},` Runs `),g(`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 `),g(`th`,{class:`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-right text-xs font-medium text-muted`},[u(` Cloud `),g(`span`,{class:`font-normal text-dimmed`},`allocated`)]),g(`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 `),g(`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),g(`tbody`,null,[(d(!0),_(o,null,v(l.value,e=>(d(),_(`tr`,{key:e.userId,class:x([`user-row`,S(e)?`is-me`:``])},[g(`td`,{class:`border-b border-muted px-2.5 py-1.5`,title:e.userId},[g(`span`,ke,b(w(e)),1),g(`span`,Ae,b(T(e)),1),S(e)?(d(),_(`span`,je,`me`)):f(``,!0),e.unpricedTokens>0?(d(),_(`span`,{key:1,class:`ml-1.5 text-xs text-warn`,title:`${e.unpricedTokens} tokens ran under a model with no list price`},`unpriced tokens`,8,Me)):f(``,!0)],8,Oe),g(`td`,Ne,b(e.runs),1),g(`td`,Pe,b(y(j)(e.llmUsd)),1),g(`td`,Fe,b(y(j)(e.cloudUsd)),1),g(`td`,Ie,b(y(j)(e.totalUsd)),1),g(`td`,Le,b(p.value>0?Math.round(e.totalUsd/p.value*100):0)+`% `,1)],2))),128)),l.value.length===0?(d(),_(`tr`,Re,[g(`td`,ze,b(e.report.users.length===0?`no runs in this range`:`no user matches`),1)])):f(``,!0)]),l.value.length>0&&l.value.length<e.report.users.length?(d(),_(`tfoot`,Be,[g(`tr`,null,[c[4]||=g(`td`,{class:`px-2.5 py-1.5 text-xs text-muted`,colspan:`4`},`shown`,-1),g(`td`,Ve,b(y(j)(h.value)),1),g(`td`,He,b(p.value>0?Math.round(h.value/p.value*100):0)+`% `,1)])])):f(``,!0)])]),g(`p`,Ue,[e.report.reconciliation.comparedDays>0?(d(),_(o,{key:0},[u(` LLM attributed `+b(y(j)(e.report.reconciliation.attributedLlmUsd))+` of `+b(y(j)(e.report.reconciliation.workspaceLlmUsd))+` on the workspace over `+b(E(e.report.reconciliation.comparedDays))+` · `,1),e.report.reconciliation.unattributedLlmUsd>=0?(d(),_(o,{key:0},[u(b(y(j)(e.report.reconciliation.unattributedLlmUsd))+` unattributed (router, review abridges, runs without a record, list vs invoice) `,1)],64)):(d(),_(o,{key:1},[u(b(y(j)(-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)):(d(),_(o,{key:1},[u(`no day in range has a workspace LLM figure to compare against`)],64)),e.report.reconciliation.uncomparedDays>0?(d(),_(o,{key:2},[u(` · `+b(E(e.report.reconciliation.uncomparedDays))+` with `+b(y(j)(e.report.reconciliation.uncomparedLlmUsd))+` of run tokens but no workspace figure (billed outside this workspace) not compared`,1)],64)):f(``,!0),u(` · cloud allocated `+b(y(j)(e.report.reconciliation.cloudAllocatedUsd)),1),e.report.reconciliation.cloudUnallocatedUsd>0?(d(),_(o,{key:3},[u(` · `+b(y(j)(e.report.reconciliation.cloudUnallocatedUsd))+` on days with no runs`,1)],64)):f(``,!0)]),c[6]||=g(`p`,{class:`text-xs text-dimmed`},` A user's LLM is their runs' tokens at Anthropic list (cache writes at the 5-minute rate); a child run bills to whoever started its parent. Cloud is each day's Cloudflare spend split by share of run wall-clock — an allocation, not a meter. `,-1)]))}}),Ge={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},Ke={class:`flex items-center gap-1`,"aria-label":`Range`},qe={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`},Je=[`href`],Ye={key:0,class:`flex items-center gap-1`,"aria-label":`Cost groups`},Xe={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},Ze=[`href`],Qe={class:`font-mono text-sm tabular-nums text-muted`},$e={key:1,class:`flex basis-full flex-wrap items-center gap-x-3 gap-y-1`},et={class:`font-mono text-xs tabular-nums text-dimmed`,"data-snapshot-status":``},tt=[`disabled`],nt={key:1,class:`text-xs text-error`,role:`status`,"data-snapshot-error":``},rt={class:`mb-5 grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-3`},it={key:0,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},at={class:`font-mono text-2xl font-medium tabular-nums`},ot={class:`text-xs text-muted`},st={key:1,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},ct={class:`font-mono text-2xl font-medium tabular-nums`},lt={class:`text-xs text-muted`},ut={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},dt={class:`font-mono text-2xl font-medium tabular-nums`},ft={class:`text-xs text-muted`},pt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},mt={class:`font-mono text-2xl font-medium tabular-nums`},ht={class:`text-xs text-muted`},gt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},_t={class:`font-mono text-2xl font-medium tabular-nums`},vt={class:`text-xs text-muted`},yt={class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},bt={class:`font-mono text-2xl font-medium tabular-nums`},xt={class:`text-xs text-muted`},St=[`href`,`title`],Ct=[`href`],wt={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Tt={class:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2`},Et={class:`legend flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted`},Dt=[`href`,`title`],Ot={key:0,class:`text-xs text-warn`},kt={key:1,class:`text-xs text-muted`},At={class:`mb-3 flex items-center gap-1 border-b border-default`,"aria-label":`View`},jt={key:0,class:`-mb-px border-b-2 border-primary px-3 py-1.5 text-sm font-medium text-highlighted`,"aria-current":`page`},Mt=[`href`],Nt={key:0,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Pt={key:1,class:`text-sm text-warn`},Ft={class:`text-xs text-muted`},It={class:`rounded bg-accented px-1 py-0.5`},Lt={key:1,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Rt={class:`w-full border-collapse font-mono text-[0.8125rem] tabular-nums`},zt={class:`px-2.5 py-1.5`},Bt=[`href`],Vt={class:`px-2.5 py-1.5 text-right`},Ht={class:`px-2.5 py-1.5 text-right`},Ut={class:`w-2/5 px-2.5 py-1.5`},Wt={key:2,class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},Gt={open:``},Kt={class:`mt-2.5 overflow-x-auto`},qt={class:`data w-full min-w-[38rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},Jt=[`title`],Yt={key:0,class:`text-xs text-dimmed`},Xt={key:1,class:`text-xs text-dimmed`},Zt={class:`border-b border-muted px-2.5 py-1.5 text-right font-medium`},Qt={class:`text-xs text-muted`},$t={class:`rounded bg-accented px-1 py-0.5`},en={class:`border-t border-default pt-3.5 text-xs text-dimmed`},tn={class:`mt-2 grid gap-1.5`},nn=[`href`],rn={key:2},an=[`href`],on={key:2},sn=[`href`],cn=[`href`],ln={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},un={key:0,class:`flex items-center gap-1`,"aria-label":`Cost groups`},dn={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},fn=[`href`],pn={class:`mb-5 grid gap-2 rounded-lg border border-default bg-elevated px-5 py-4`},mn={class:`flex flex-wrap items-center gap-x-3 gap-y-1`},hn={class:`font-mono text-xs tabular-nums text-muted`,"data-snapshot-status":``},gn=[`disabled`],_n={key:1,class:`text-xs text-error`,role:`status`,"data-snapshot-error":``},vn=S({__name:`CostsPage`,setup(r){let a=h(`costs`),S=c(a?.report??null),C=m(()=>a?.groups??[]),w=m(()=>a?.group??S.value?.group??``),T=c(a?.snapshot??null),E=ne(void 0,6e4),D=m(()=>T.value?ie(T.value,E.value):``),O=m(()=>a?.view??`daily`),k=c(a?.view===`users`?a?.users??null:null),A=m(()=>a?.canSnapshot===!0),M=m(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`days`)),P=e=>`/costs/${w.value}${e}${M.value?`?days=${M.value}`:``}`,F=a?.snapshot?.snapshot?.takenAt??null,I=F,L=null;async function le(){try{let[e,t]=await Promise.all([fetch(P(`.json`),{credentials:`same-origin`}),O.value===`users`?fetch(P(`/users.json`),{credentials:`same-origin`}):Promise.resolve(null)]);return e.ok?(S.value=await e.json(),t?.ok&&(k.value=await t.json()),!0):!1}catch{return!1}}function R(){if(L||I===null||I===F)return;let e=I;L=le().then(t=>{t&&(F=e)}).finally(()=>{L=null,I!==e&&R()})}function ue(e){T.value=e;let t=e.snapshot?.takenAt??null;t&&(I=t,R())}let z=ee(),B=null;i(()=>{w.value&&(B=z(`/costs/${w.value}?stream=1`),B.onmessage=e=>{let t=re(e.data);t&&ue(t)})}),p(()=>B?.close());let H=c(!1),U=c(``);async function W(){H.value=!0,U.value=``;let e=await te(fetch,`costs.snapshot`,{});e.ok||(U.value=e.failure.message),H.value=!1}function G(e,t,n){let r=[`days=${t}`];return n===`users`&&r.push(`view=users`),`/costs/${e}?${r.join(`&`)}`}let K=m(()=>S.value?ae(S.value):[]),q=m(()=>S.value?oe(S.value):null),J=m(()=>S.value?de(S.value):[]),Y=m(()=>S.value?se(S.value):null),fe=m(()=>S.value?ce(S.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 pe(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 me=m(()=>{let e=S.value,t=q.value;if(!e||!t)return``;let n=t.projection,r=`cloud ${j(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 ${j(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}`}`}),he=m(()=>S.value?[...S.value.days].reverse():[]),ge=[1,7,30],Z=e=>e===1?`today`:`${e}d`,_e=m(()=>{let e=S.value,t=q.value;if(!e||!t)return``;if(!e.llmAvailable)return`LLM spend not configured`;let n=[];return t.llm.yesterday!==void 0&&n.push(`yesterday ${j(t.llm.yesterday)}`),t.llm.today&&n.push(`today ${j(t.llm.today.usd)}${t.llm.today.estimated?` (estimate)`:``}`),n.length?n.join(` · `):`in range`});function Q(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(r,i)=>S.value&&q.value?(d(),l(e,{key:0,title:`${S.value.label} spend`,nav:`costs`},{default:n(()=>[g(`div`,Ge,[g(`nav`,Ke,[(d(),_(o,null,v(ge,e=>(d(),_(o,{key:e},[e===S.value.range.days?(d(),_(`span`,qe,b(Z(e)),1)):(d(),_(`a`,{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`,href:G(S.value.group,e,O.value)},b(Z(e)),9,Je))],64))),64))]),C.value.length>1?(d(),_(`nav`,Ye,[(d(!0),_(o,null,v(C.value,e=>(d(),_(o,{key:e},[e===S.value.group?(d(),_(`span`,Xe,b(e),1)):(d(),_(`a`,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,href:G(e,S.value.range.days,O.value)},b(e),9,Ze))],64))),128))])):f(``,!0),g(`p`,Qe,[u(b(Q(S.value.range.from))+` → `+b(Q(S.value.range.to))+` · `+b(S.value.range.days)+`d`,1),S.value.range.partialLastDay?(d(),_(o,{key:0},[u(` · today partial`)],64)):f(``,!0)]),D.value?(d(),_(`div`,$e,[g(`p`,et,b(D.value),1),A.value?(d(),_(`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:H.value||T.value?.inFlight!==null,"data-snapshot-now":``,onClick:W},b(T.value?.inFlight?`Taking…`:`Snapshot now`),9,tt)):f(``,!0),U.value?(d(),_(`span`,nt,b(U.value),1)):f(``,!0)])):f(``,!0)]),g(`section`,rt,[q.value.yesterday?(d(),_(`div`,it,[i[0]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Yesterday`,-1),g(`span`,at,b(y(j)(q.value.yesterday.total)),1),g(`span`,ot,b(q.value.yesterday.date)+` · last full day`,1)])):(d(),_(`div`,st,[i[1]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Today so far`,-1),g(`span`,ct,b(q.value.today?y(j)(q.value.today.total):`—`),1),g(`span`,lt,b(q.value.today?`${q.value.today.date} · partial day, UTC`:`no day in range`),1)])),g(`div`,ut,[i[2]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`7-day average`,-1),g(`span`,dt,b(q.value.avg7===void 0?`—`:y(j)(q.value.avg7)),1),g(`span`,ft,b(q.value.avg7===void 0?`no full day yet in this range`:`per day, full days only`),1)]),g(`div`,pt,[i[3]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Projected month`,-1),g(`span`,mt,b(y(j)(q.value.projection.monthUsd,0)),1),g(`span`,ht,b(me.value),1)]),g(`div`,gt,[i[4]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`LLM spend`,-1),g(`span`,_t,b(S.value.llmAvailable?y(j)(q.value.llm.range):`—`),1),g(`span`,vt,b(_e.value),1)]),g(`div`,yt,[i[6]||=g(`span`,{class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},`Share of account`,-1),g(`span`,bt,b(q.value.accountShare)+`%`,1),g(`span`,xt,[u(b(y(j)(S.value.totals.cloudUsd))+` of `+b(y(j)(S.value.account.cloudUsd))+` on `,1),Y.value?(d(),_(`a`,{key:0,class:`text-primary hover:underline`,href:Y.value.account,target:`_blank`,rel:`noopener noreferrer`,title:`Cloudflare account ${S.value.account.id}`},b(fe.value),9,St)):f(``,!0),i[5]||=u(` · Cloudflare spend in range · `,-1),Y.value?(d(),_(`a`,{key:1,class:`text-primary hover:underline`,href:Y.value.billing,target:`_blank`,rel:`noopener noreferrer`},`billing`,8,Ct)):f(``,!0)])])]),g(`section`,wt,[g(`div`,Tt,[i[7]||=g(`div`,null,[g(`h2`,{class:`text-[0.9375rem] font-medium`},`Daily cost`),g(`p`,{class:`text-sm text-muted`},`Stacked by component · USD list price`)],-1),g(`div`,Et,[(d(!0),_(o,null,v(K.value,(e,t)=>(d(),_(`a`,{key:e,class:`inline-flex items-center gap-1.5 no-underline hover:text-highlighted hover:underline`,href:pe(e),target:`_blank`,rel:`noopener noreferrer`,title:`Open where ${e} is billed`},[g(`i`,{class:x([`inline-block size-2.5 rounded-xs`,y(V)[t%y(V).length]])},null,2),u(b(e),1)],8,Dt))),128))])]),s(ve,{report:S.value,series:K.value},null,8,[`report`,`series`]),S.value.llmAvailable?S.value.days.some(e=>e.llmEstimated)?(d(),_(`p`,kt,[i[9]||=u(` 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),S.value.days.some(e=>e.llmUnpricedTokens>0)?(d(),_(o,{key:0},[u(` Some tokens ran under a model this page has no price for and are not in the estimate. `)],64)):f(``,!0)])):f(``,!0):(d(),_(`p`,Ot,[...i[8]||=[u(` LLM spend not configured — set `,-1),g(`code`,null,`ANTHROPIC_ADMIN_KEY`,-1),u(` and the group's `,-1),g(`code`,null,`anthropicWorkspaceId`,-1),u(` to layer it in. `,-1)]]))]),g(`nav`,At,[(d(),_(o,null,v([`daily`,`users`],e=>(d(),_(o,{key:e},[e===O.value?(d(),_(`span`,jt,b(e===`daily`?`Daily`:`By user`),1)):(d(),_(`a`,{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`,href:G(S.value.group,S.value.range.days,e)},b(e===`daily`?`Daily`:`By user`),9,Mt))],64))),64))]),O.value===`users`?(d(),_(`section`,Nt,[i[12]||=g(`div`,null,[g(`h2`,{class:`text-[0.9375rem] font-medium`},`Cost by user`),g(`p`,{class:`text-sm text-muted`},` Who started the runs · LLM at list from their tokens · cloud allocated by wall-clock `)],-1),k.value?(d(),l(We,{key:0,report:k.value},null,8,[`report`])):(d(),_(`p`,Pt,`The by-user report did not load with this page.`)),g(`p`,Ft,[i[10]||=u(` Machine-readable twin: `,-1),g(`code`,It,`GET /costs/`+b(S.value.group)+`/users.json`,1),i[11]||=u(` (same Access gate). `,-1)])])):f(``,!0),O.value===`daily`?(d(),_(`section`,Lt,[i[13]||=g(`div`,null,[g(`h2`,{class:`text-[0.9375rem] font-medium`},`What each cloud dollar buys`)],-1),g(`table`,Rt,[g(`tbody`,null,[(d(!0),_(o,null,v(J.value,e=>(d(),_(`tr`,{key:e.label,class:`border-b border-muted`},[g(`td`,zt,[X(e.label)?(d(),_(`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`},b(e.label),9,Bt)):(d(),_(o,{key:1},[u(b(e.label),1)],64))]),g(`td`,Vt,b(y(j)(e.usd)),1),g(`td`,Ht,b(Math.round(e.percent))+`%`,1),g(`td`,Ut,[g(`i`,{class:`block h-2.5 rounded-xs bg-primary opacity-75`,style:t({width:`${e.percent.toFixed(1)}%`})},null,4)])]))),128))])])])):f(``,!0),O.value===`daily`?(d(),_(`section`,Wt,[g(`details`,Gt,[i[16]||=g(`summary`,{class:`cursor-pointer text-sm text-muted`},`Table view — daily cost by component (USD)`,-1),g(`div`,Kt,[g(`table`,qt,[g(`thead`,null,[g(`tr`,null,[i[14]||=g(`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),(d(!0),_(o,null,v(K.value,e=>(d(),_(`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`},b(e),1))),128)),i[15]||=g(`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)])]),g(`tbody`,null,[(d(!0),_(o,null,v(he.value,e=>(d(),_(`tr`,{key:e.date},[g(`td`,{class:`border-b border-muted px-2.5 py-1.5`,title:e.date},[u(b(Q(e.date))+` `,1),S.value.range.partialLastDay&&e.date===S.value.range.to?(d(),_(`span`,Yt,`(partial day`+b(e.llmEstimated?` · LLM estimated`:``)+`)`,1)):e.llmEstimated?(d(),_(`span`,Xt,`(LLM estimated)`)):f(``,!0)],8,Jt),(d(!0),_(o,null,v(K.value,t=>(d(),_(`td`,{key:t,class:`border-b border-muted px-2.5 py-1.5 text-right`},b(y(j)(y(N)(e,t),3)),1))),128)),g(`td`,Zt,b(y(j)(e.total,3)),1)]))),128))])])])]),g(`p`,Qt,[i[17]||=u(` Machine-readable twin: `,-1),g(`code`,$t,`GET /costs/`+b(S.value.group)+`.json`,1),i[18]||=u(` (same Access gate). `,-1)])])):f(``,!0),g(`footer`,en,[g(`details`,null,[i[26]||=g(`summary`,{class:`cursor-pointer text-muted`},`How these numbers are computed`,-1),g(`div`,tn,[i[24]||=g(`div`,null,[g(`b`,null,`Snapshot.`),u(` 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 By user tab are arithmetic over it, with `),g(`em`,null,`today`),u(` 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 (`),g(`code`,null,`costs.snapshot.everyHours`),u(`, daily by default); `),g(`code`,null,`costs snapshot`),u(` 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),i[25]||=g(`div`,null,[g(`b`,null,`Method.`),u(` Cloudflare GraphQL Analytics, every meter a Workers deployment is billed on: `),g(`code`,null,`containersUsageAdaptiveGroups`),u(` (cpuTimeSec, allocatedMemory, allocatedDisk per app per UTC day), `),g(`code`,null,`durableObjectsPeriodicGroups`),u(` (billable `),g(`code`,null,`duration`),u(` GB-s and SQLite rows read and written per namespace), `),g(`code`,null,`durableObjectsInvocationsAdaptiveGroups`),u(` (requests per namespace), `),g(`code`,null,`durableObjectsSqlStorageGroups`),u(` (bytes stored), `),g(`code`,null,`workersInvocationsAdaptive`),u(` (requests, CPU time), `),g(`code`,null,`r2StorageAdaptiveGroups`),u(` and `),g(`code`,null,`r2OperationsAdaptiveGroups`),u(` (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),g(`div`,null,[i[19]||=g(`b`,null,`Scope.`,-1),i[20]||=u(` Attributed to this group: the Workers `,-1),(d(!0),_(o,null,v(S.value.attribution.workers,(e,t)=>(d(),_(o,{key:e},[t>0?(d(),_(o,{key:0},[u(`, `)],64)):f(``,!0),Y.value?(d(),_(`a`,{key:1,class:`font-mono hover:underline`,href:Y.value.worker(e),target:`_blank`,rel:`noopener noreferrer`},b(e),9,nn)):(d(),_(`code`,rn,b(e),1))],64))),128)),u(`, every Durable Object namespace they host (`+b(Object.keys(S.value.attribution.durableObjectNamespaces).length)+`), the R2 buckets named after them (`,1),(d(!0),_(o,null,v(Object.keys(S.value.attribution.r2Buckets),(e,t)=>(d(),_(o,{key:e},[t>0?(d(),_(o,{key:0},[u(`, `)],64)):f(``,!0),Y.value?(d(),_(`a`,{key:1,class:`font-mono hover:underline`,href:Y.value.bucket(e),target:`_blank`,rel:`noopener noreferrer`},b(e),9,an)):(d(),_(`code`,on,b(e),1))],64))),128)),Object.keys(S.value.attribution.r2Buckets).length===0?(d(),_(o,{key:0},[u(`none`)],64)):f(``,!0),i[21]||=u(`), and the container apps mapped in `,-1),g(`code`,null,`costs.groups.`+b(S.value.group),1),u(` (`+b(Object.keys(S.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?(d(),_(`a`,{key:1,class:`hover:underline`,href:Y.value.account,target:`_blank`,rel:`noopener noreferrer`},`Cloudflare dashboard`,8,sn)):f(``,!0),i[22]||=u(` for the account `,-1),g(`code`,null,b(S.value.account.id),1),u(b(S.value.account.name?` (${S.value.account.name})`:``)+`, and `,1),Y.value?(d(),_(`a`,{key:2,class:`hover:underline`,href:Y.value.anthropic,target:`_blank`,rel:`noopener noreferrer`},`Anthropic's cost page`,8,cn)):f(``,!0),i[23]||=u(` for the LLM line. `,-1)])])])])]),_:1},8,[`title`])):(d(),l(e,{key:1,title:`${w.value} spend`,nav:`costs`},{default:n(()=>[g(`div`,ln,[C.value.length>1?(d(),_(`nav`,un,[(d(!0),_(o,null,v(C.value,e=>(d(),_(o,{key:e},[e===w.value?(d(),_(`span`,dn,b(e),1)):(d(),_(`a`,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,href:`/costs/${e}`},b(e),9,fn))],64))),128))])):f(``,!0)]),g(`section`,pn,[i[27]||=g(`h2`,{class:`text-sm font-medium text-highlighted`},`Nothing to show yet`,-1),g(`div`,mn,[g(`p`,hn,b(D.value),1),A.value?(d(),_(`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:H.value||T.value?.inFlight!==null,"data-snapshot-now":``,onClick:W},b(T.value?.inFlight?`Taking…`:`Snapshot now`),9,gn)):f(``,!0),U.value?(d(),_(`span`,_n,b(U.value),1)):f(``,!0)]),i[28]||=g(`p`,{class:`text-xs text-dimmed`},[u(` 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 `),g(`code`,null,`costs snapshot`),u(`. `)],-1)])]),_:1},8,[`title`]))}});export{vn as default};
@@ -1 +1 @@
1
- import{t as e}from"./AppShell-DEy5jRuS.js";import{Lr as t,Xt as n,cn as ee,gn as r,ir as i,ln as a,on as o,r as s,sn as c,un as l,ur as u,vi as d,wi as f,xi as p,yn as te}from"./seed-DeKSHrt2.js";import{a as m,c as ne,d as re,i as h,l as g,n as ie,o as _,r as v,s as y,t as b,u as ae}from"./delivery-CTdOqpVK.js";import{t as oe}from"./wallClock-61NpVkY6.js";function x(e,t){return e.truncated&&e.completeFrom!==void 0&&Date.parse(`${t}T00:00:00Z`)<Date.parse(e.completeFrom)}Object.freeze({reviewers:[],agentLogins:[],agentCoauthors:[]}),Object.freeze({default:60,min:5,max:1440});var S={class:`text-xs text-muted`},C={key:1,class:`text-highlighted`},w=[`href`],T={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},E={key:0,class:`flex items-center gap-1`,"aria-label":`Repositories`},D={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},O=[`href`],k={class:`font-mono text-sm tabular-nums text-muted`},A={class:`mb-5 grid gap-3`},j={key:0,class:`text-sm text-muted`},M={class:`grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-3`},N={class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},P={class:`font-mono text-2xl font-medium tabular-nums`},F={class:`text-xs text-muted`},I={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},L={class:`overflow-x-auto`},R={class:`weeks w-full min-w-[52rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},z=[`title`],B={key:0,class:`ml-1 text-xs`},se={key:0,class:`text-xs text-muted`},V={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},H={key:0,class:`text-sm text-muted`},U={key:1,class:`overflow-x-auto`},W={class:`units w-full min-w-[52rem] border-collapse font-mono text-[0.8125rem] tabular-nums`},G=[`href`],K={key:1,class:`text-dimmed`},ce=[`title`],le=[`href`],ue={class:`text-xs text-muted`},de={class:`rounded bg-accented px-1 py-0.5`},fe={class:`border-t border-default pt-3.5 text-xs text-dimmed`},pe={key:0,class:`mb-2 font-mono tabular-nums text-muted`},me=[`href`],he={class:`mt-2 grid gap-1.5`},q=`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-xs font-medium text-muted whitespace-nowrap`,J=`border-b border-muted px-2.5 py-1.5`,Y=te({__name:`DeliveryPage`,setup(te){let Y=s(`delivery`),X=o(()=>Y?.report??null),Z=o(()=>Y?.repos??[]),ge=o(()=>X.value?ae(X.value):[]),Q=o(()=>X.value?ie(X.value):void 0),$=e=>X.value?x(X.value,e):!1,_e=o(()=>X.value?.weeks.some(e=>$(e.week))??!1),ve=[1,2,4,8,13],ye=oe(void 0,6e4),be=typeof window>`u`?``:window.location.search;return(o,s)=>X.value?(i(),ee(e,{key:0,title:`${X.value.repo} delivery`,nav:`delivery`},{actions:t(()=>[c(`span`,S,[(i(),l(n,null,u(ve,(e,t)=>(i(),l(n,{key:e},[t>0?(i(),l(n,{key:0},[r(` · `)],64)):a(``,!0),e===X.value.range.weeks?(i(),l(`b`,C,f(e)+`w`,1)):(i(),l(`a`,{key:2,class:`text-primary hover:underline`,href:`/delivery/${X.value.repo}?weeks=${e}`},f(e)+`w`,9,w))],64))),64))])]),default:t(()=>[c(`div`,T,[Z.value.length>1?(i(),l(`nav`,E,[(i(!0),l(n,null,u(Z.value,e=>(i(),l(n,{key:e},[e===X.value.repo?(i(),l(`span`,D,f(e),1)):(i(),l(`a`,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,href:`/delivery/${e}`},f(e),9,O))],64))),128))])):a(``,!0),c(`p`,k,f(d(_)(X.value.range.since))+` → `+f(d(_)(X.value.range.until))+` · `+f(X.value.range.weeks)+`w · weeks start Monday, UTC `,1)]),c(`section`,A,[Q.value?(i(),l(`p`,j,f(Q.value),1)):a(``,!0),c(`div`,M,[(i(!0),l(n,null,u(ge.value,e=>(i(),l(`div`,{key:e.label,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},[c(`span`,N,f(e.label),1),c(`span`,P,f(e.value),1),c(`span`,F,f(e.note),1)]))),128))])]),c(`section`,I,[s[0]||=c(`div`,null,[c(`h2`,{class:`text-[0.9375rem] font-medium`},`By week`),c(`p`,{class:`text-sm text-muted`},`One row per Monday-start week · merged pull requests only`)],-1),c(`div`,L,[c(`table`,R,[c(`thead`,null,[c(`tr`,null,[c(`th`,{class:p([q,`text-left`])},`Week`,2),c(`th`,{class:p([q,`text-right`])},`Merged`,2),c(`th`,{class:p([q,`text-right`])},`Agent-authored`,2),c(`th`,{class:p([q,`text-right`])},`Issue → merge`,2),c(`th`,{class:p([q,`text-right`])},`First-pass CI`,2),c(`th`,{class:p([q,`text-right`])},`Rounds / PR`,2),c(`th`,{class:p([q,`text-right`])},`Findings`,2),c(`th`,{class:p([q,`text-right`])},`No human edit`,2),c(`th`,{class:p([q,`text-right`])},`Agent run min`,2)])]),c(`tbody`,null,[(i(!0),l(n,null,u(X.value.weeks,e=>(i(),l(`tr`,{key:e.week,class:p($(e.week)?`text-dimmed`:``)},[c(`td`,{class:p(J),title:`${e.week} → ${e.until}`},[r(f(d(_)(e.week))+` – `+f(d(_)(e.until))+` `,1),$(e.week)?(i(),l(`span`,B,`(incomplete)`)):a(``,!0)],8,z),c(`td`,{class:p([J,`text-right font-medium`])},f(e.prsMerged),3),c(`td`,{class:p([J,`text-right`])},f(e.agentAuthoredPrs),3),c(`td`,{class:p([J,`text-right`])},f(d(m)(e.leadTimeHours.median)),3),c(`td`,{class:p([J,`text-right`])},f(d(b)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(ne)(e.reviewRounds.perPr)),3),c(`td`,{class:p([J,`text-right`])},f(d(v)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(y)(e.findings.noHumanEditShare)),3),c(`td`,{class:p([J,`text-right`])},f(e.agentRuns.minutes.toFixed(0)),3)],2))),128))])])]),_e.value&&X.value.completeFrom?(i(),l(`p`,se,` Incomplete weeks hold the newest pull requests the read reached — it is complete from `+f(d(g)(X.value.completeFrom))+` — so their numbers are a floor on the merges, not the week's. `,1)):a(``,!0)]),c(`section`,V,[s[3]||=c(`div`,null,[c(`h2`,{class:`text-[0.9375rem] font-medium`},`By unit`),c(`p`,{class:`text-sm text-muted`},` One row per board issue the pull requests link · the issue's opening starts the clock `)],-1),X.value.units.length===0?(i(),l(`p`,H,`Nothing merged in range.`)):(i(),l(`div`,U,[c(`table`,W,[c(`thead`,null,[c(`tr`,null,[c(`th`,{class:p([q,`text-left`])},`Issue`,2),c(`th`,{class:p([q,`text-left`])},`Unit`,2),c(`th`,{class:p([q,`text-left`])},`PRs`,2),c(`th`,{class:p([q,`text-right`])},`Issue → merge`,2),c(`th`,{class:p([q,`text-right`])},`First-pass CI`,2),c(`th`,{class:p([q,`text-right`])},`Rounds`,2),c(`th`,{class:p([q,`text-right`])},`Findings`,2),c(`th`,{class:p([q,`text-right`])},`No human edit`,2)])]),c(`tbody`,null,[(i(!0),l(n,null,u(X.value.units,e=>(i(),l(`tr`,{key:e.issue??`none`},[c(`td`,{class:p([J,`whitespace-nowrap`])},[e.issue===null?(i(),l(`span`,K,`—`)):(i(),l(`a`,{key:0,class:`text-primary hover:underline`,href:`https://github.com/${X.value.repo}/issues/${e.issue}`},`#`+f(e.issue),9,G))],2),c(`td`,{class:p([J,`max-w-[28rem] truncate font-sans`]),title:e.title},f(e.title),11,ce),c(`td`,{class:p([J,`whitespace-nowrap`])},[(i(!0),l(n,null,u(e.prs,(e,t)=>(i(),l(n,{key:e},[t>0?(i(),l(n,{key:0},[r(`, `)],64)):a(``,!0),c(`a`,{class:`text-primary hover:underline`,href:`https://github.com/${X.value.repo}/pull/${e}`},f(e),9,le)],64))),128))],2),c(`td`,{class:p([J,`text-right`])},f(d(m)(e.leadTimeHours.median)),3),c(`td`,{class:p([J,`text-right`])},f(d(b)(e)),3),c(`td`,{class:p([J,`text-right`])},f(e.reviewRounds.verdicts),3),c(`td`,{class:p([J,`text-right`])},f(d(v)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(y)(e.findings.noHumanEditShare)),3)]))),128))])])])),c(`p`,ue,[s[1]||=r(` Machine-readable twin: `,-1),c(`code`,de,`GET /delivery/`+f(X.value.repo)+`.json`,1),s[2]||=r(` (same gate). `,-1)])]),c(`footer`,fe,[X.value.snapshotAt?(i(),l(`p`,pe,[r(` As of `+f(d(g)(X.value.snapshotAt))+`, `+f(d(re)(X.value.snapshotAt,d(ye)))+` · `,1),c(`a`,{class:`text-primary hover:underline`,href:d(h)(d(be))},`read GitHub now`,8,me)])):a(``,!0),c(`details`,null,[s[13]||=c(`summary`,{class:`cursor-pointer text-muted`},`How these numbers are computed`,-1),c(`div`,he,[s[11]||=c(`div`,null,[c(`b`,null,`Snapshot.`),r(` GitHub's record of the merged pull requests (each one's timeline and its branch's workflow runs, the board issue its body links) is read on an interval and kept as a snapshot the page, its JSON twin and `),c(`code`,null,`delivery report`),r(` serve; `),c(`code`,null,`?fresh=1`),r(` reads GitHub now. The run history you may see joins on every load. `)],-1),s[12]||=c(`div`,null,[c(`b`,null,`Issue → merge`),r(` runs from the linked board issue's opening (a closing keyword or a `),c(`code`,null,`board item`),r(` reference in the body) to the merge; a pull request that links no issue counts from its own opening. `),c(`b`,null,`First-pass CI`),r(` is green when every pull-request-triggered workflow run (`),c(`code`,null,`pull_request`),r(`, `),c(`code`,null,`pull_request_target`),r(`) on the first head succeeded at its first attempt — a rerun or a red run fails it; a head with no such run is not counted. `),c(`b`,null,`Review rounds`),r(` are the review agent's verdicts; a `),c(`i`,null,`fix round`),r(` is a verdict that followed a push. `),c(`b`,null,`No human edit`),r(` is the share of the agent's findings on pull requests where every push after the first verdict was an agent's: a bot login, or a commit co-authored by an agent. `),c(`b`,null,`Agent run minutes`),r(` are the finished runs of this repository that named a pull request. `)],-1),c(`div`,null,[s[5]||=c(`b`,null,`Identities.`,-1),s[6]||=r(` Verdicts by `,-1),c(`code`,null,f(X.value.identities.reviewers.join(`, `)||`(none configured)`),1),s[7]||=r(`; agent logins end in `,-1),s[8]||=c(`code`,null,`[bot]`,-1),X.value.identities.agentLogins.length?(i(),l(n,{key:0},[s[4]||=r(`, plus `,-1),c(`code`,null,f(X.value.identities.agentLogins.join(`, `)),1)],64)):a(``,!0),s[9]||=r(`; agent co-authors named `,-1),c(`code`,null,f(X.value.identities.agentCoauthors.join(`, `)||`(none)`),1),s[10]||=r(`. `,-1)])])])])]),_:1},8,[`title`])):a(``,!0)}});export{Y as default};
1
+ import{t as e}from"./AppShell-IDMGG6yi.js";import{Lr as t,Xt as n,cn as ee,gn as r,ir as i,ln as a,on as o,r as s,sn as c,un as l,ur as u,vi as d,wi as f,xi as p,yn as te}from"./seed-DeKSHrt2.js";import{a as m,c as ne,d as re,i as h,l as g,n as ie,o as _,r as v,s as y,t as b,u as ae}from"./delivery-CTdOqpVK.js";import{t as oe}from"./wallClock-61NpVkY6.js";function x(e,t){return e.truncated&&e.completeFrom!==void 0&&Date.parse(`${t}T00:00:00Z`)<Date.parse(e.completeFrom)}Object.freeze({reviewers:[],agentLogins:[],agentCoauthors:[]}),Object.freeze({default:60,min:5,max:1440});var S={class:`text-xs text-muted`},C={key:1,class:`text-highlighted`},w=[`href`],T={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},E={key:0,class:`flex items-center gap-1`,"aria-label":`Repositories`},D={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},O=[`href`],k={class:`font-mono text-sm tabular-nums text-muted`},A={class:`mb-5 grid gap-3`},j={key:0,class:`text-sm text-muted`},M={class:`grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-3`},N={class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},P={class:`font-mono text-2xl font-medium tabular-nums`},F={class:`text-xs text-muted`},I={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},L={class:`overflow-x-auto`},R={class:`weeks w-full min-w-[52rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},z=[`title`],B={key:0,class:`ml-1 text-xs`},se={key:0,class:`text-xs text-muted`},V={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},H={key:0,class:`text-sm text-muted`},U={key:1,class:`overflow-x-auto`},W={class:`units w-full min-w-[52rem] border-collapse font-mono text-[0.8125rem] tabular-nums`},G=[`href`],K={key:1,class:`text-dimmed`},ce=[`title`],le=[`href`],ue={class:`text-xs text-muted`},de={class:`rounded bg-accented px-1 py-0.5`},fe={class:`border-t border-default pt-3.5 text-xs text-dimmed`},pe={key:0,class:`mb-2 font-mono tabular-nums text-muted`},me=[`href`],he={class:`mt-2 grid gap-1.5`},q=`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-xs font-medium text-muted whitespace-nowrap`,J=`border-b border-muted px-2.5 py-1.5`,Y=te({__name:`DeliveryPage`,setup(te){let Y=s(`delivery`),X=o(()=>Y?.report??null),Z=o(()=>Y?.repos??[]),ge=o(()=>X.value?ae(X.value):[]),Q=o(()=>X.value?ie(X.value):void 0),$=e=>X.value?x(X.value,e):!1,_e=o(()=>X.value?.weeks.some(e=>$(e.week))??!1),ve=[1,2,4,8,13],ye=oe(void 0,6e4),be=typeof window>`u`?``:window.location.search;return(o,s)=>X.value?(i(),ee(e,{key:0,title:`${X.value.repo} delivery`,nav:`delivery`},{actions:t(()=>[c(`span`,S,[(i(),l(n,null,u(ve,(e,t)=>(i(),l(n,{key:e},[t>0?(i(),l(n,{key:0},[r(` · `)],64)):a(``,!0),e===X.value.range.weeks?(i(),l(`b`,C,f(e)+`w`,1)):(i(),l(`a`,{key:2,class:`text-primary hover:underline`,href:`/delivery/${X.value.repo}?weeks=${e}`},f(e)+`w`,9,w))],64))),64))])]),default:t(()=>[c(`div`,T,[Z.value.length>1?(i(),l(`nav`,E,[(i(!0),l(n,null,u(Z.value,e=>(i(),l(n,{key:e},[e===X.value.repo?(i(),l(`span`,D,f(e),1)):(i(),l(`a`,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,href:`/delivery/${e}`},f(e),9,O))],64))),128))])):a(``,!0),c(`p`,k,f(d(_)(X.value.range.since))+` → `+f(d(_)(X.value.range.until))+` · `+f(X.value.range.weeks)+`w · weeks start Monday, UTC `,1)]),c(`section`,A,[Q.value?(i(),l(`p`,j,f(Q.value),1)):a(``,!0),c(`div`,M,[(i(!0),l(n,null,u(ge.value,e=>(i(),l(`div`,{key:e.label,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},[c(`span`,N,f(e.label),1),c(`span`,P,f(e.value),1),c(`span`,F,f(e.note),1)]))),128))])]),c(`section`,I,[s[0]||=c(`div`,null,[c(`h2`,{class:`text-[0.9375rem] font-medium`},`By week`),c(`p`,{class:`text-sm text-muted`},`One row per Monday-start week · merged pull requests only`)],-1),c(`div`,L,[c(`table`,R,[c(`thead`,null,[c(`tr`,null,[c(`th`,{class:p([q,`text-left`])},`Week`,2),c(`th`,{class:p([q,`text-right`])},`Merged`,2),c(`th`,{class:p([q,`text-right`])},`Agent-authored`,2),c(`th`,{class:p([q,`text-right`])},`Issue → merge`,2),c(`th`,{class:p([q,`text-right`])},`First-pass CI`,2),c(`th`,{class:p([q,`text-right`])},`Rounds / PR`,2),c(`th`,{class:p([q,`text-right`])},`Findings`,2),c(`th`,{class:p([q,`text-right`])},`No human edit`,2),c(`th`,{class:p([q,`text-right`])},`Agent run min`,2)])]),c(`tbody`,null,[(i(!0),l(n,null,u(X.value.weeks,e=>(i(),l(`tr`,{key:e.week,class:p($(e.week)?`text-dimmed`:``)},[c(`td`,{class:p(J),title:`${e.week} → ${e.until}`},[r(f(d(_)(e.week))+` – `+f(d(_)(e.until))+` `,1),$(e.week)?(i(),l(`span`,B,`(incomplete)`)):a(``,!0)],8,z),c(`td`,{class:p([J,`text-right font-medium`])},f(e.prsMerged),3),c(`td`,{class:p([J,`text-right`])},f(e.agentAuthoredPrs),3),c(`td`,{class:p([J,`text-right`])},f(d(m)(e.leadTimeHours.median)),3),c(`td`,{class:p([J,`text-right`])},f(d(b)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(ne)(e.reviewRounds.perPr)),3),c(`td`,{class:p([J,`text-right`])},f(d(v)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(y)(e.findings.noHumanEditShare)),3),c(`td`,{class:p([J,`text-right`])},f(e.agentRuns.minutes.toFixed(0)),3)],2))),128))])])]),_e.value&&X.value.completeFrom?(i(),l(`p`,se,` Incomplete weeks hold the newest pull requests the read reached — it is complete from `+f(d(g)(X.value.completeFrom))+` — so their numbers are a floor on the merges, not the week's. `,1)):a(``,!0)]),c(`section`,V,[s[3]||=c(`div`,null,[c(`h2`,{class:`text-[0.9375rem] font-medium`},`By unit`),c(`p`,{class:`text-sm text-muted`},` One row per board issue the pull requests link · the issue's opening starts the clock `)],-1),X.value.units.length===0?(i(),l(`p`,H,`Nothing merged in range.`)):(i(),l(`div`,U,[c(`table`,W,[c(`thead`,null,[c(`tr`,null,[c(`th`,{class:p([q,`text-left`])},`Issue`,2),c(`th`,{class:p([q,`text-left`])},`Unit`,2),c(`th`,{class:p([q,`text-left`])},`PRs`,2),c(`th`,{class:p([q,`text-right`])},`Issue → merge`,2),c(`th`,{class:p([q,`text-right`])},`First-pass CI`,2),c(`th`,{class:p([q,`text-right`])},`Rounds`,2),c(`th`,{class:p([q,`text-right`])},`Findings`,2),c(`th`,{class:p([q,`text-right`])},`No human edit`,2)])]),c(`tbody`,null,[(i(!0),l(n,null,u(X.value.units,e=>(i(),l(`tr`,{key:e.issue??`none`},[c(`td`,{class:p([J,`whitespace-nowrap`])},[e.issue===null?(i(),l(`span`,K,`—`)):(i(),l(`a`,{key:0,class:`text-primary hover:underline`,href:`https://github.com/${X.value.repo}/issues/${e.issue}`},`#`+f(e.issue),9,G))],2),c(`td`,{class:p([J,`max-w-[28rem] truncate font-sans`]),title:e.title},f(e.title),11,ce),c(`td`,{class:p([J,`whitespace-nowrap`])},[(i(!0),l(n,null,u(e.prs,(e,t)=>(i(),l(n,{key:e},[t>0?(i(),l(n,{key:0},[r(`, `)],64)):a(``,!0),c(`a`,{class:`text-primary hover:underline`,href:`https://github.com/${X.value.repo}/pull/${e}`},f(e),9,le)],64))),128))],2),c(`td`,{class:p([J,`text-right`])},f(d(m)(e.leadTimeHours.median)),3),c(`td`,{class:p([J,`text-right`])},f(d(b)(e)),3),c(`td`,{class:p([J,`text-right`])},f(e.reviewRounds.verdicts),3),c(`td`,{class:p([J,`text-right`])},f(d(v)(e)),3),c(`td`,{class:p([J,`text-right`])},f(d(y)(e.findings.noHumanEditShare)),3)]))),128))])])])),c(`p`,ue,[s[1]||=r(` Machine-readable twin: `,-1),c(`code`,de,`GET /delivery/`+f(X.value.repo)+`.json`,1),s[2]||=r(` (same gate). `,-1)])]),c(`footer`,fe,[X.value.snapshotAt?(i(),l(`p`,pe,[r(` As of `+f(d(g)(X.value.snapshotAt))+`, `+f(d(re)(X.value.snapshotAt,d(ye)))+` · `,1),c(`a`,{class:`text-primary hover:underline`,href:d(h)(d(be))},`read GitHub now`,8,me)])):a(``,!0),c(`details`,null,[s[13]||=c(`summary`,{class:`cursor-pointer text-muted`},`How these numbers are computed`,-1),c(`div`,he,[s[11]||=c(`div`,null,[c(`b`,null,`Snapshot.`),r(` GitHub's record of the merged pull requests (each one's timeline and its branch's workflow runs, the board issue its body links) is read on an interval and kept as a snapshot the page, its JSON twin and `),c(`code`,null,`delivery report`),r(` serve; `),c(`code`,null,`?fresh=1`),r(` reads GitHub now. The run history you may see joins on every load. `)],-1),s[12]||=c(`div`,null,[c(`b`,null,`Issue → merge`),r(` runs from the linked board issue's opening (a closing keyword or a `),c(`code`,null,`board item`),r(` reference in the body) to the merge; a pull request that links no issue counts from its own opening. `),c(`b`,null,`First-pass CI`),r(` is green when every pull-request-triggered workflow run (`),c(`code`,null,`pull_request`),r(`, `),c(`code`,null,`pull_request_target`),r(`) on the first head succeeded at its first attempt — a rerun or a red run fails it; a head with no such run is not counted. `),c(`b`,null,`Review rounds`),r(` are the review agent's verdicts; a `),c(`i`,null,`fix round`),r(` is a verdict that followed a push. `),c(`b`,null,`No human edit`),r(` is the share of the agent's findings on pull requests where every push after the first verdict was an agent's: a bot login, or a commit co-authored by an agent. `),c(`b`,null,`Agent run minutes`),r(` are the finished runs of this repository that named a pull request. `)],-1),c(`div`,null,[s[5]||=c(`b`,null,`Identities.`,-1),s[6]||=r(` Verdicts by `,-1),c(`code`,null,f(X.value.identities.reviewers.join(`, `)||`(none configured)`),1),s[7]||=r(`; agent logins end in `,-1),s[8]||=c(`code`,null,`[bot]`,-1),X.value.identities.agentLogins.length?(i(),l(n,{key:0},[s[4]||=r(`, plus `,-1),c(`code`,null,f(X.value.identities.agentLogins.join(`, `)),1)],64)):a(``,!0),s[9]||=r(`; agent co-authors named `,-1),c(`code`,null,f(X.value.identities.agentCoauthors.join(`, `)||`(none)`),1),s[10]||=r(`. `,-1)])])])])]),_:1},8,[`title`])):a(``,!0)}});export{Y as default};
@@ -0,0 +1,2 @@
1
+ import{i as e,n as t,r as n,t as r}from"./AppShell-IDMGG6yi.js";import{Ci as i,Gn as a,Jn as o,Lr as s,Mr as c,Qn as l,St as u,Vt as d,Wt as f,Xt as p,_n as m,a as ee,ci as h,cn as g,dr as _,gn as v,i as y,ir as b,ln as x,m as S,nr as te,oi as C,on as w,or as T,r as E,sn as D,un as O,ur as ne,vi as k,wi as A,xi as j,xt as M,yn as N,zr as P}from"./seed-DeKSHrt2.js";import{t as F}from"./Tooltip-BoeFwYP2.js";import{i as I,n as L,r as re,t as ie}from"./PendingTurnRow-BZA_vQt3.js";import{t as R}from"./eventSource-tRprhqm7.js";import{t as ae}from"./wallClock-61NpVkY6.js";import{n as oe,r as se}from"./favicon-D1hkyC5j.js";import{n as z,t as ce}from"./indexFormat-B-pd4r7Y.js";import{E as le,i as ue,r as B,t as de,v as fe}from"./indexRow-BD1VT8o8.js";import{t as V}from"./localIso-L06jV29p.js";import{D as pe,E as me,a as he,c as ge,d as H,i as U,n as _e,o as W,s as ve,t as ye,u as be,v as xe}from"./sseReplay-g7ml86LM.js";import{i as Se,n as G,t as K}from"./durationTone-BobbycC-.js";var q=`To run this:`;function Ce(e,t){return e?t.trim()===``?`stop`:`steer`:`send`}var we=`↪ Folded into`;function Te(e){let t=e.trim();return t.startsWith(`To run this:`)?{kind:`handBack`,command:t.slice(q.length).trim()}:t.startsWith(we)?{kind:`steerAck`,text:t}:{kind:`inline`,text:t}}function Ee(e){let t=/^\/runs\/([^/?#]+)(\?t=([^&#]+))?$/.exec(e);if(!t)return null;let n=decodeURIComponent(t[1]),r=t[3]?`?t=${t[3]}`:``;return{id:n,eventsUrl:`/runs/${t[1]}/events${r}`,stopUrl:`/runs/${t[1]}/stop${r}`}}function De(e,t=60){let n=e.split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``;return n.length<=t?n||`New conversation`:`${n.slice(0,t-1).trimEnd()}…`}function J(e,t){let n=t-e;if(!(n>45e3))return`now`;let r=Math.floor(n/6e4);if(r<60)return`${Math.max(1,r)}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<7?`${a}d`:z(e,t)}function Oe(e,t){let n=e.surface??`web`,r=B[n]??n;return{title:e.excerpt||e.title,when:ce(e.lastAt,t),source:n===`web`?r:`${r} · read-only here`,runs:`${e.runs} run${e.runs===1?``:`s`}`,live:e.live}}var Y={min:224,default:288,max:448,step:16};function ke(e){let t=typeof e==`string`?Number(e):e;return typeof t!=`number`||!Number.isFinite(t)?Y.default:Math.min(Y.max,Math.max(Y.min,Math.round(t)))}var X={width:`sb.rail.width`,collapsed:`sb.rail.collapsed`};function Ae(e){return{width:ke(e.width??void 0),collapsed:e.collapsed===`1`}}function je(e,t){let n=e<5?`Still up`:e<12?`Good morning`:e<18?`Good afternoon`:`Good evening`;return t?`${n}, ${t}.`:`${n}.`}function Me(e,t){let n=t.trim();for(let t=e.length-1;t>=0;t--){let r=e[t];if(!r.folded&&r.text.trim()===n)return r}return null}function Ne(e,t=60){return e<=t}function Pe(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}function Z(e,t){let n=e.trim().toLowerCase();if(n===``)return 0;let r=t.toLowerCase(),i=0,a=-1,o=-1;for(let e of n){if(e===` `)continue;let t=r.indexOf(e,i);if(t===-1)return null;a===-1&&(a=t),o=t,i=t+1}return a===-1?0:o-a}function Fe(e,t){return t.trim()===``?[...e]:e.map((e,n)=>({row:e,i:n,score:Z(t,e.title)})).filter(e=>e.score!==null).sort((e,t)=>e.score-t.score||e.i-t.i).map(e=>e.row)}function Ie(e){if(!(e.metaKey||e.ctrlKey))return null;let t=e.key.toLowerCase();return t===`o`&&e.shiftKey?`newThread`:t===`k`&&!e.shiftKey?`search`:null}function Le(e,t){return t?``:e===`steer`?`Say what to add — it folds into the run at its next step`:e===`stop`?`A run is working — type to steer it, or stop it`:`Review a pull request, ship a fix, investigate a run… or type / for a command`}function Re(e){let t=new Map;for(let n of e){let[e,r]=n.chat.split(` `,2);if(!e)continue;let i=t.get(e)??{name:e,verbs:[]};r===void 0?i.bare=n:i.verbs.push({verb:r,command:n}),t.set(e,i)}return[...t.values()]}function ze(e,t,n){if(t===``)return[...e];let r=t.toLowerCase(),i=e.filter(e=>n(e)[0].toLowerCase().startsWith(r));return i.length>0?i:e.map((e,r)=>{let i=n(e).map(e=>Z(t,e)).filter(e=>e!==null);return i.length===0?null:{item:e,i:r,score:Math.min(...i)}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score||e.i-t.i).map(e=>e.item)}function Be(e,t=0,n=new Set){let r=(e.args??[]).slice(t),i=(e.options??[]).filter(e=>!n.has(Q(e.form))).map(e=>`[${e.form}]`);return[...r,...i].join(` `)}var Q=e=>e.split(` `,1)[0];function $(e,t){let n=new Set,r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.startsWith(`-`)){n.add(a);let t=(e.options??[]).find(e=>Q(e.form)===a);t&&t.form.includes(` `)&&i++}else r++}return{positionals:r,flags:n}}function Ve(e,t){let n=/^\/([^\n]*)$/.exec(e);if(!n||t.length===0)return null;let r=n[1].split(` `),i=r[r.length-1],a=r.slice(0,-1).filter(e=>e!==``),o=e.slice(0,e.length-i.length),s=Re(t);if(a.length===0)return{level:`group`,head:o,partial:i,rows:ze(s,i,e=>[e.name,...e.bare?[e.bare.describe]:[],...e.verbs.map(e=>e.command.describe)]).map(e=>({insert:e.name,label:`/${e.name}`,describe:e.bare?e.verbs.length>0?`${e.bare.describe} · also ${e.verbs.map(e=>e.verb).join(`, `)}`:e.bare.describe:e.verbs.map(e=>e.verb).join(` · `),kind:e.bare&&e.verbs.length===0?`command`:`group`,acceptable:!0}))};let c=s.find(e=>e.name===a[0]);if(!c)return null;if(a.length===1){let e=ze(c.verbs,i,e=>[e.verb,e.command.describe]);if(e.length===0&&c.bare&&i!==``)return Ue(c.bare,o,i,[]);if(e.length===0&&!c.bare)return{level:`verb`,head:o,partial:i,rows:[]};let t=e.map(e=>({insert:e.verb,label:`/${e.command.chat}`,describe:e.command.describe,kind:`command`,acceptable:!0}));return c.bare&&i===``&&t.unshift(He(c.bare,0,new Set)),{level:`verb`,head:o,partial:i,rows:t}}let l=c.verbs.find(e=>e.verb===a[1]);return l?Ue(l.command,o,i,a.slice(2)):c.bare?Ue(c.bare,o,i,a.slice(1)):null}function He(e,t,n){let r=Be(e,t,n);return{insert:``,label:`/${e.chat}`,describe:r?`${r} — ${e.describe}`:e.describe,kind:`usage`,acceptable:!1}}function Ue(e,t,n,r){let i=$(e,r);return n.startsWith(`-`)?{level:`tail`,head:t,partial:n,rows:ze((e.options??[]).filter(e=>!i.flags.has(Q(e.form))),n,e=>[Q(e.form),e.describe]).map(e=>({insert:Q(e.form),label:e.form,describe:e.describe,kind:`option`,acceptable:!0})),command:e}:{level:`tail`,head:t,partial:n,rows:[He(e,i.positionals,i.flags)],command:e}}function We(e,t){let n=e.rows[t];if(!n)return null;if(n.acceptable){if(!n.insert.toLowerCase().startsWith(e.partial.toLowerCase()))return null;let t=n.insert.slice(e.partial.length);return t===``?null:{text:t,acceptable:!0}}if(e.partial!==``||n.kind!==`usage`)return null;let[r,...i]=n.describe.split(` — `);return i.length===0?null:{text:r,acceptable:!1}}function Ge(e,t){return`${e.head}${t.insert} `}function Ke(e,t){if(!e.startsWith(`/`))return e;let n=e.slice(1),[r,i]=n.split(/\s+/,2);return t.some(e=>e.chat===r||i!==void 0&&e.chat===`${r} ${i}`)?n:e}var qe={class:`composer-wrap relative`},Je={key:0,class:`palette absolute bottom-full left-0 right-0 z-20 mb-2 max-h-72 overflow-y-auto rounded-xl border border-default bg-(--ui-bg-elevated) p-1 shadow-sm`,role:`listbox`,"aria-label":`Commands`,"data-testid":`palette`},Ye={key:0,class:`px-3 py-2 font-mono text-xs text-dimmed`},Xe=[`aria-selected`,`data-insert`,`data-kind`,`data-label`,`onClick`,`onMouseenter`],Ze={class:`chat shrink-0 font-mono text-[0.8rem] font-medium text-highlighted`},Qe={class:`describe min-w-0 flex-1 truncate text-[0.8rem] text-muted`},$e={key:0,class:`shrink-0 rounded border border-default px-1 font-mono text-[0.62rem] text-dimmed`,"aria-hidden":`true`},et=[`data-mode`],tt={class:`relative min-w-0 flex-1`},nt=[`data-acceptable`],rt={class:`invisible`},it={class:`text-dimmed`},at=[`rows`,`value`,`placeholder`,`autofocus`,`aria-expanded`],ot=[`aria-hidden`,`data-hint`,`data-shown`],st=N({__name:`ChatComposer`,props:{modelValue:{},mode:{},hint:{},autofocus:{type:Boolean},sweepOnMount:{type:Boolean},commands:{}},emits:[`update:modelValue`,`submit`,`stop`],setup(e,{expose:t,emit:n}){let r=e,i=n,o=h(null),u=h(!1),d=h(!1),_=w(()=>Math.min(8,Math.max(1,r.modelValue.split(`
2
+ `).length))),v={send:{icon:`i-lucide-arrow-up`,label:`Send`},steer:{icon:`i-lucide-corner-down-right`,label:`Steer the run`},stop:{icon:`i-lucide-square`,label:`Stop the run`}},y=w(()=>v[r.mode]),te=w(()=>Le(r.mode,r.hint)),C=w(()=>r.hint?r.hint:r.mode===`steer`?`Enter folds this into the run in flight`:r.mode===`stop`?`A run is in flight · type to steer it, or stop it`:`Enter to send · Shift+Enter for a new line · / for a command`),T=w(()=>u.value||r.hint!==void 0||r.mode!==`send`),E=w(()=>Ve(r.modelValue,r.commands??[])),k=w(()=>E.value?.rows??[]),N=h(!1),P=h(0),F=w(()=>E.value!==null&&!N.value),I=w(()=>F.value&&E.value?We(E.value,P.value):null);c(()=>`${E.value?.level??``}|${E.value?.head??``}`,()=>{N.value=!1,P.value=0}),c(k,e=>{P.value>=e.length&&(P.value=Math.max(0,e.length-1))});function L(e){E.value&&e.acceptable&&(i(`update:modelValue`,Ge(E.value,e)),z())}function re(){let e=o.value;return!e||e.selectionStart===e.value.length&&e.selectionEnd===e.value.length}function ie(e){i(`update:modelValue`,e.target.value)}function R(e){if(F.value){if(e.key===`ArrowDown`){e.preventDefault(),k.value.length>0&&(P.value=(P.value+1)%k.value.length);return}if(e.key===`ArrowUp`){e.preventDefault(),k.value.length>0&&(P.value=(P.value-1+k.value.length)%k.value.length);return}if(e.key===`Escape`){e.preventDefault(),N.value=!0;return}let t=k.value[P.value];if(e.key===`Tab`&&t?.acceptable){e.preventDefault(),L(t);return}if(e.key===`ArrowRight`&&I.value?.acceptable&&t&&re()){e.preventDefault(),L(t);return}if(e.key===`Enter`&&!e.shiftKey&&t?.acceptable){e.preventDefault(),L(t);return}}Pe(e)&&(e.preventDefault(),ae())}function ae(){r.mode===`stop`?i(`stop`):r.modelValue.trim()!==``&&i(`submit`)}function oe(){d.value=!1,a().then(()=>{d.value=!0})}function se(){u.value=!0,oe()}function z(){a().then(()=>{let e=o.value;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),document.activeElement===e&&!u.value&&se())})}return c(()=>r.hint,e=>{e&&z()}),l(()=>{r.autofocus&&z(),r.sweepOnMount&&oe()}),t({focus:z}),(t,n)=>{let r=S,i=ee;return b(),O(`div`,qe,[m(M,{name:`sb-rise`},{default:s(()=>[F.value?(b(),O(`div`,Je,[k.value.length===0?(b(),O(`p`,Ye,` No command matches "`+A(e.modelValue)+`". `,1)):x(``,!0),(b(!0),O(p,null,ne(k.value,(e,t)=>(b(),O(`button`,{key:e.label,type:`button`,role:`option`,class:j([`item flex w-full items-baseline gap-3 rounded-lg px-3 py-1.5 text-left transition-colors duration-150 ease-out`,t===P.value?`bg-(--ui-bg-accented)`:`hover:bg-(--ui-bg-muted)`]),"aria-selected":t===P.value?`true`:`false`,"data-insert":e.insert,"data-kind":e.kind,"data-label":e.label,onMousedown:n[0]||=f(()=>{},[`prevent`]),onClick:t=>L(e),onMouseenter:e=>P.value=t},[D(`span`,Ze,A(e.label),1),D(`span`,Qe,A(e.describe),1),t===P.value&&e.acceptable?(b(),O(`kbd`,$e,`Tab`)):x(``,!0)],42,Xe))),128))])):x(``,!0)]),_:1}),D(`div`,{class:j([`ring relative rounded-2xl`,d.value?`ring-sweep`:``]),onAnimationend:n[2]||=e=>d.value=!1},[D(`form`,{class:j([`composer relative flex items-end gap-2 rounded-2xl border bg-default px-3 py-2 transition-colors duration-150 ease-out`,u.value?`border-primary`:`border-default hover:border-accented`]),"data-mode":e.mode,onSubmit:f(ae,[`prevent`])},[D(`div`,tt,[I.value?(b(),O(`div`,{key:0,class:`ghost pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap break-words py-1 text-[0.875rem] leading-normal`,"aria-hidden":`true`,"data-testid":`ghost`,"data-acceptable":I.value.acceptable?`1`:`0`},[D(`span`,rt,A(e.modelValue),1),D(`span`,it,A(I.value.text),1)],8,nt)):x(``,!0),D(`textarea`,{ref_key:`box`,ref:o,class:`box relative min-h-6 w-full resize-none bg-transparent py-1 text-[0.875rem] leading-normal text-highlighted outline-none placeholder:text-dimmed`,rows:_.value,value:e.modelValue,placeholder:te.value,autofocus:e.autofocus,"aria-label":`Message`,"aria-expanded":F.value?`true`:void 0,autocomplete:`off`,spellcheck:`true`,onInput:ie,onKeydown:R,onFocus:se,onBlur:n[1]||=e=>u.value=!1},null,40,at)]),m(i,{type:`submit`,class:`control shrink-0 rounded-full transition-transform duration-150 ease-out active:scale-95`,color:e.mode===`stop`?`neutral`:`primary`,variant:e.mode===`stop`?`outline`:`solid`,size:`sm`,"aria-label":y.value.label,title:y.value.label,disabled:e.mode===`send`&&e.modelValue.trim()===``,"data-mode":e.mode},{default:s(()=>[m(M,{name:`sb-fade`,mode:`out-in`},{default:s(()=>[(b(),g(r,{key:y.value.icon,name:y.value.icon,class:`size-4`,"aria-hidden":`true`},null,8,[`name`]))]),_:1})]),_:1},8,[`color`,`variant`,`aria-label`,`title`,`disabled`,`data-mode`])],42,et)],34),D(`p`,{class:j([`hint mt-1.5 min-h-[1.1rem] select-none px-3 font-mono text-[0.7rem] text-dimmed transition-opacity duration-150 ease-out`,T.value?`opacity-100`:`opacity-0`]),"aria-hidden":T.value?void 0:`true`,"data-hint":e.hint?`handback`:e.mode,"data-shown":T.value?`1`:`0`},A(C.value),11,ot)])}}}),ct={class:`thread-tip flex max-w-xs flex-col gap-1 text-xs`},lt={class:`tip-title leading-snug text-highlighted`},ut={class:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 font-mono text-[0.68rem] text-muted`},dt={class:`tip-when tabular-nums`},ft={class:`tip-source inline-flex items-center gap-1`},pt={class:`tip-runs`},mt={key:0,class:`tip-live inline-flex items-center gap-1 text-toned`},ht=N({__name:`ThreadTip`,props:{row:{},now:{}},setup(e){let t=e,n=w(()=>Oe(t.row,t.now));return(t,r)=>(b(),O(`div`,ct,[D(`p`,lt,A(n.value.title),1),D(`p`,ut,[D(`span`,dt,A(n.value.when),1),r[1]||=D(`span`,{"aria-hidden":`true`},`·`,-1),D(`span`,ft,[e.row.surface===`slack`?(b(),g(Se,{key:0})):x(``,!0),v(A(n.value.source),1)]),r[2]||=D(`span`,{"aria-hidden":`true`},`·`,-1),D(`span`,pt,A(n.value.runs),1),n.value.live?(b(),O(`span`,mt,[...r[0]||=[D(`span`,{class:`size-1.5 rounded-full bg-ok`,"aria-hidden":`true`},null,-1),v(`live`,-1)]])):x(``,!0)])]))}}),gt={class:`rail flex flex-col gap-1 text-[0.8rem]`,"aria-label":`Recent threads`},_t=[`aria-current`],vt={class:`filter mb-2 flex items-center gap-2 rounded-lg border border-default px-2.5 py-1.5 transition-colors duration-150 ease-out focus-within:border-primary hover:border-accented`},yt={key:0,class:`rounded border border-default px-1 font-mono text-[0.65rem] text-dimmed`},bt={key:0,class:`empty px-3 py-1 text-xs text-dimmed`},xt={key:1,class:`nomatch px-3 py-1 text-xs text-dimmed`},St=[`href`,`aria-current`,`data-surface`],Ct={key:0,class:`dot mt-px size-1.5 shrink-0 self-center rounded-full bg-ok motion-safe:animate-pulse`,"aria-label":`a run is in flight`},wt={class:`title min-w-0 flex-1 truncate text-toned group-hover:text-highlighted group-aria-[current=page]:text-highlighted`},Tt={class:`when shrink-0 font-mono text-[0.7rem] tabular-nums text-dimmed`},Et={class:`all mt-3 flex items-center gap-1.5 px-3 py-1 text-xs font-medium text-muted no-underline transition-colors duration-150 ease-out hover:text-highlighted`,href:`/runs`,"data-testid":`all-runs`},Dt={class:`retention px-3 pt-1 text-[0.7rem] leading-relaxed text-dimmed`},Ot=500,kt=N({__name:`ConversationRail`,props:{rows:{},current:{},now:{},retention:{}},setup(e,{expose:t}){let n=e,r=h(``),i=h(null),a=w(()=>Fe(n.rows,r.value));function o(){i.value?.focus(),i.value?.select()}function c(e){e.key===`Escape`&&(r.value=``,i.value?.blur())}return t({focusFilter:o}),(t,n)=>{let o=S,l=F;return b(),O(`nav`,gt,[D(`a`,{class:`new group mb-3 flex items-center gap-2 rounded-xl bg-inverted px-3 py-2 font-medium text-inverted no-underline transition-[transform,opacity] duration-150 ease-out hover:-translate-y-px hover:opacity-90 active:translate-y-0 active:opacity-100`,href:`/threads`,"aria-current":e.current===``?`page`:void 0,"data-testid":`new-thread`},[m(o,{name:`i-lucide-plus`,class:`size-4 shrink-0 transition-transform duration-150 ease-out group-hover:rotate-90`,"aria-hidden":`true`}),n[1]||=D(`span`,null,`New thread`,-1),n[2]||=D(`span`,{class:`kbd ml-auto flex gap-0.5 font-mono text-[0.65rem] opacity-70`,"aria-label":`shortcut shift command O`},[D(`kbd`,{class:`rounded border border-current/30 px-1`},`⇧`),D(`kbd`,{class:`rounded border border-current/30 px-1`},`⌘`),D(`kbd`,{class:`rounded border border-current/30 px-1`},`O`)],-1)],8,_t),D(`label`,vt,[m(o,{name:`i-lucide-search`,class:`size-3.5 shrink-0 text-dimmed`,"aria-hidden":`true`}),P(D(`input`,{ref_key:`filter`,ref:i,"onUpdate:modelValue":n[0]||=e=>r.value=e,class:`min-w-0 flex-1 bg-transparent text-[0.8rem] text-highlighted outline-none placeholder:text-dimmed`,type:`text`,placeholder:`Filter recent`,"aria-label":`Filter recent threads`,autocomplete:`off`,onKeydown:c},null,544),[[d,r.value]]),r.value?x(``,!0):(b(),O(`kbd`,yt,`⌘K`))]),n[5]||=D(`p`,{class:`label px-3 pb-1 font-mono text-[0.65rem] font-medium uppercase tracking-wider text-dimmed`},`Recent`,-1),e.rows.length===0?(b(),O(`p`,bt,`Nothing yet. Ask something.`)):a.value.length===0?(b(),O(`p`,xt,`Nothing matches "`+A(r.value)+`".`,1)):x(``,!0),m(u,{name:`sb-rise`,tag:`div`,class:`rows flex flex-col gap-0.5`},{default:s(()=>[(b(!0),O(p,null,ne(a.value,t=>(b(),O(`div`,{key:t.id},[m(l,{"delay-duration":Ot,content:{side:`right`,sideOffset:12,align:`start`},ui:{content:`h-auto max-w-xs px-2.5 py-2`}},{content:s(()=>[m(ht,{row:t,now:e.now},null,8,[`row`,`now`])]),default:s(()=>[D(`a`,{class:`row group relative flex items-baseline gap-2 rounded-lg px-3 py-1.5 no-underline transition-colors duration-150 ease-out hover:bg-(--ui-bg-muted) aria-[current=page]:bg-(--ui-bg-accented)`,href:`/threads/${encodeURIComponent(t.id)}`,"aria-current":t.id===e.current?`page`:void 0,"data-surface":t.surface},[n[3]||=D(`span`,{class:`bar absolute left-0 top-1/2 h-4 w-0.5 -translate-y-1/2 rounded-full bg-primary opacity-0 transition-opacity duration-150 ease-out group-aria-[current=page]:opacity-100`,"aria-hidden":`true`},null,-1),t.live?(b(),O(`span`,Ct)):x(``,!0),D(`span`,wt,A(t.title),1),D(`span`,Tt,A(k(J)(t.lastAt,e.now)),1)],8,St)]),_:2},1024)]))),128))]),_:1}),D(`a`,Et,[n[4]||=v(` All runs `,-1),m(o,{name:`i-lucide-arrow-right`,class:`size-3 transition-transform duration-150 ease-out group-hover:translate-x-0.5`,"aria-hidden":`true`})]),D(`p`,Dt,A(e.retention),1)])}}}),At={class:`empty mx-auto flex w-full max-w-2xl flex-col items-center gap-5 px-3 py-6 text-center`},jt={class:`flex flex-col gap-1.5`},Mt={class:`greeting sb-stagger text-xl font-medium tracking-tight text-highlighted`,style:{"--sb-i":`1`}},Nt={class:`sb-stagger w-full text-left`,style:{"--sb-i":`3`}},Pt={key:0,class:`chips flex flex-wrap justify-center gap-2`,"aria-label":`Suggestions`},Ft=[`onClick`],It=N({__name:`EmptyState`,props:{name:{},hour:{},suggestions:{}},emits:[`pick`],setup(e,{emit:t}){let r=t;return(t,a)=>(b(),O(`section`,At,[m(n,{draw:``,idle:``,class:`mark-lg sb-stagger text-highlighted`,style:{"font-size":`3.25rem`,"--sb-i":`0`}}),D(`div`,jt,[D(`h2`,Mt,A(k(je)(e.hour,e.name)),1),a[0]||=D(`p`,{class:`sub sb-stagger text-[0.875rem] text-muted`,style:{"--sb-i":`2`}},` Ask in plain words. The right agent picks it up, and you watch it work here. `,-1)]),D(`div`,Nt,[_(t.$slots,`default`)]),e.suggestions.length>0?(b(),O(`ul`,Pt,[(b(!0),O(p,null,ne(e.suggestions,(e,t)=>(b(),O(`li`,{key:e,class:`sb-stagger`,style:i({"--sb-i":t+4})},[D(`button`,{type:`button`,class:`chip rounded-full border border-default px-3 py-1 text-[0.8rem] text-toned transition-[color,border-color,background-color,transform] duration-150 ease-out hover:-translate-y-px hover:border-accented hover:bg-(--ui-bg-muted) hover:text-highlighted focus-visible:outline-2 focus-visible:outline-primary active:translate-y-0`,onClick:t=>r(`pick`,e)},A(e),9,Ft)],4))),128))])):x(``,!0)]))}}),Lt=[`data-pending`],Rt={class:`meta flex items-baseline gap-2 pr-1 font-mono text-[0.7rem] text-dimmed`},zt={key:0,class:`failed text-bad`},Bt={key:0,class:`folded text-muted`},Vt=[`title`],Ht=N({__name:`PersonTurn`,props:{text:{},at:{},now:{},pending:{type:Boolean},folded:{},failed:{}},setup(e){let t=e,n=w(()=>ce(t.at,t.now));return(t,r)=>(b(),O(`div`,{class:`turn person flex flex-col items-end gap-1`,"data-pending":e.pending?`1`:void 0},[D(`div`,{class:j([`bubble max-w-[min(42rem,88%)] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-(--ui-bg-accented) px-4 py-2.5 text-[0.875rem] leading-normal text-highlighted transition-opacity duration-150 ease-out`,e.pending?`opacity-70`:``])},A(e.text),3),D(`div`,Rt,[e.failed?(b(),O(`span`,zt,A(e.failed),1)):x(``,!0),m(M,{name:`sb-fade`},{default:s(()=>[e.folded?(b(),O(`span`,Bt,`↪ folded in `+A(e.folded),1)):x(``,!0)]),_:1}),D(`span`,{class:`ts select-none`,title:k(V)(e.at)},A(n.value),9,Vt)])],8,Lt))}}),Ut=[`title`],Wt={class:`preset font-medium`},Gt={class:`reason truncate font-normal opacity-80`},Kt=N({__name:`ReceiptChip`,props:{route:{}},setup(e){let t=e,n=w(()=>de[ue(t.route.preset)]);return(t,r)=>(b(),O(`span`,{class:j([`receipt inline-flex max-w-full items-baseline gap-1.5 rounded border px-1.5 py-px font-mono text-[0.7rem] leading-relaxed`,n.value]),title:`routed: ${e.route.reason}`,"data-testid":`receipt`},[D(`span`,Wt,A(e.route.preset),1),D(`span`,Gt,`· `+A(e.route.reason),1)],10,Ut))}}),qt=[`data-phase`,`data-run-id`,`data-live`],Jt={class:`head flex flex-wrap items-baseline gap-2 font-mono text-[0.7rem] text-dimmed`},Yt={key:0,class:`model`},Xt={key:1,class:`elapsed ml-auto tabular-nums`,"data-testid":`elapsed`},Zt={key:0,class:`disconnected flex items-baseline gap-2 rounded-lg border border-dashed border-bad/40 px-3 py-2 font-mono text-xs text-bad`,"data-testid":`disconnected`},Qt=[`href`],$t=[`open`],en={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2 font-mono text-[0.7rem] text-dimmed hover:text-toned [&::-webkit-details-marker]:hidden`},tn={class:`summary`},nn={class:`pl-1 pt-1`},rn={key:0,class:`py-2 font-mono text-xs text-dimmed`},an={key:1,class:`py-2 font-mono text-xs text-warn`},on=[`href`],sn={key:2,class:`m-0 list-none p-0`},cn={key:0,class:`reply`,"data-testid":`reply`},ln={key:1,class:`outcome font-mono text-xs text-warn`,"data-testid":`outcome`},un={key:2,class:`facts flex flex-wrap items-baseline gap-x-3 font-mono text-[0.7rem] text-dimmed`},dn=[`href`],fn=N({__name:`AssistantTurn`,props:{turn:{},now:{},live:{},fetch:{}},emits:[`ended`,`input`,`stop`],setup(e,{emit:t}){let n=e,r=t,a=ge(),o=a.state,d=h(n.live?`connecting`:`ended`),f=h(n.turn.route??null),ee=h(!0),_=w(()=>o.reply?.text??n.turn.answer??``),y=w(()=>o.meta?.agent??n.turn.agent??``),S=w(()=>{let e=o.meta?.model??n.turn.model;return e?H(e):``}),C=w(()=>n.live!==null&&n.live!==void 0&&d.value!==`ended`),E=w(()=>d.value===`disconnected`),N=n.live?.serverNow?ve({startedAt:n.turn.startedAt,receivedAt:n.turn.receivedAt,serverNow:n.live.serverNow},n.now):null,P=n.now,F=h(void 0),I=w(()=>n.turn.finished&&n.turn.finishedAt!==void 0?Math.max(0,n.turn.finishedAt-(n.turn.receivedAt??n.turn.startedAt)):F.value===void 0?N?N.elapsedMs(n.now):Math.max(0,n.now-P):F.value),ae=w(()=>le(I.value,`clock`)),oe=w(()=>K(C.value?void 0:I.value,`run`)),se=w(()=>G(oe.value)),z=w(()=>C.value?xe(o,n.now):null);T(W,z),T(U,null),T(he,w(()=>o.reply!==null));let ce=w(()=>C.value?be(o,a.pendingCall(),n.now):null),B=w(()=>{let e=ce.value;return E.value||!e||e.kind===`call`?null:e.kind===`starting`?{verb:`Starting`,elapsedMs:I.value,slow:!1}:{verb:L(e.elapsedMs),elapsedMs:e.elapsedMs,slow:e.slow}}),V=w(()=>o.log.filter(e=>e.kind===`step`)),Se=w(()=>V.value.length>0?V.value.length:n.turn.stepCount??0),q=w(()=>n.turn.finished&&n.turn.status&&n.turn.status!==`completed`?fe(n.turn.status):``),Ce=w(()=>`/runs/${encodeURIComponent(n.turn.id)}`),we=R(),Te=null;function Ee(e){let t=e;t.type===`route`&&typeof t.preset==`string`&&(f.value={preset:t.preset,reason:typeof t.reason==`string`?t.reason:``}),t.type===`input`&&typeof t.text==`string`&&(ee.value?ee.value=!1:r(`input`,t.text,t.at)),a.handle(e)}l(()=>{n.live&&(r(`stop`,n.live.stopUrl),Te=re({url:n.live.eventsUrl,factory:we,model:a,handle:Ee,onFinished:e=>{F.value=N&&e?N.elapsedAt(e.finishedAt):I.value},onEnd:()=>{F.value??=I.value,r(`ended`)},onDisconnected:()=>{F.value??=I.value}}),c(Te.phase,e=>d.value=e,{immediate:!0}))}),te(()=>Te?.close());let De=h(n.live!==null&&n.live!==void 0),J=h(n.live?`ready`:`none`);c(C,e=>{e||(De.value=!1)});async function Oe(e){if(De.value=e.target.open,!De.value||J.value!==`none`)return;J.value=`loading`;let t=n.fetch??((...e)=>globalThis.fetch(...e));try{let e=await t(`/runs/${encodeURIComponent(n.turn.id)}/events`,{credentials:`same-origin`});if(!e.ok)throw Error(`HTTP ${e.status}`);let r=ye(await e.text()).filter(e=>e.type!==`replay_note`);for(let e of(n.turn.schema??0)>=2?pe(r):r)a.handle(e);a.closePhases(),J.value=`ready`}catch{J.value=`failed`}}let Y=w(()=>{let e=Se.value;return e>0?`${e} step${e===1?``:`s`}`:C.value?`starting`:`no steps recorded`});return(t,n)=>(b(),O(`div`,{class:`turn assistant flex flex-col gap-2`,"data-phase":d.value,"data-run-id":e.turn.id,"data-live":C.value?`1`:void 0},[D(`div`,Jt,[m(M,{name:`sb-rise`},{default:s(()=>[f.value?(b(),g(Kt,{key:`receipt`,route:f.value},null,8,[`route`])):y.value?(b(),O(`span`,{key:`agent`,class:j([`agent rounded border px-1.5 py-px font-medium`,k(de)[k(ue)(y.value)]])},A(y.value),3)):x(``,!0)]),_:1}),S.value?(b(),O(`span`,Yt,A(S.value),1)):x(``,!0),C.value?(b(),O(`span`,Xt,A(ae.value),1)):x(``,!0)]),m(M,{name:`sb-fade`},{default:s(()=>[C.value&&B.value?(b(),g(ie,{key:0,tag:`div`,verb:B.value.verb,"elapsed-ms":B.value.elapsedMs,slow:B.value.slow,model:k(o).meta?.model??e.turn.model??null},null,8,[`verb`,`elapsed-ms`,`slow`,`model`])):x(``,!0)]),_:1}),E.value?(b(),O(`p`,Zt,[n[0]||=D(`span`,null,`stream disconnected · the run may still be working`,-1),D(`a`,{class:`ml-auto text-primary no-underline hover:underline`,href:Ce.value},`open the run`,8,Qt)])):x(``,!0),C.value||Se.value>0||J.value!==`none`?(b(),O(`details`,{key:1,class:`work group`,open:De.value,"data-testid":`work`,onToggle:Oe},[D(`summary`,en,[n[1]||=D(`span`,{class:`chev select-none transition-transform duration-150 ease-out group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),D(`span`,tn,A(Y.value),1)]),D(`div`,nn,[J.value===`loading`?(b(),O(`p`,rn,`reading the run's record…`)):J.value===`failed`?(b(),O(`p`,an,[n[2]||=v(` the run's record could not be read — `,-1),D(`a`,{class:`text-primary no-underline hover:underline`,href:Ce.value},`open the run`,8,on)])):(b(),O(`ol`,sn,[m(u,{name:`sb-rise`},{default:s(()=>[(b(!0),O(p,null,ne(V.value,e=>(b(),g(_e,{key:e.key,step:e,class:`mt-3 first:mt-0`,onToggleGroup:t=>k(a).toggleGroup(e)},null,8,[`step`,`onToggleGroup`]))),128))]),_:1})]))])],40,$t)):x(``,!0),m(M,{name:`sb-rise`},{default:s(()=>[_.value?(b(),O(`div`,cn,[m(me,{text:_.value},null,8,[`text`])])):q.value?(b(),O(`p`,ln,A(q.value),1)):x(``,!0)]),_:1}),C.value?x(``,!0):(b(),O(`div`,un,[D(`span`,{class:j([`dur tabular-nums`,se.value?`heat`:``]),style:i(se.value)},A(ae.value),7),D(`a`,{class:`open text-dimmed no-underline hover:text-primary hover:underline`,href:Ce.value},`open run`,8,dn)]))],8,qt))}}),pn={key:0,class:`mx-auto my-12 max-w-xl text-center text-toned`},mn=[`data-rail`],hn={key:0,class:`relative hidden md:block`},gn=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`],_n={class:`thread mx-auto flex min-h-[calc(100vh-8rem)] w-full max-w-3xl flex-col`},vn={key:2,class:`inline text-[0.875rem] text-toned`,"data-testid":`inline`},yn={key:2,class:`elsewhere sticky bottom-0 z-10 -mx-3 mt-auto bg-default/85 px-3 py-4 text-center text-[0.8rem] text-toned backdrop-blur sm:-mx-5 sm:px-5`,"data-testid":`elsewhere`},bn=[`href`],xn={key:3,class:`composer-dock sticky bottom-0 z-10 -mx-3 mt-auto bg-default/85 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-3 backdrop-blur sm:-mx-5 sm:px-5`},Sn=`(min-width: 48rem)`,Cn=N({__name:`HomePage`,setup(n){let d=E(`home`),f=ae(d?.now),_=d?.conversation??``,S=y(d?.retentionDays??null),N=0,P=e=>`${e}-${++N}`,F=C([]);for(let e of d?.turns??[]){F.push({key:P(`p`),kind:`person`,text:e.request,at:e.receivedAt??e.startedAt,pending:!1});let t=!e.finished&&e.token?{eventsUrl:`/runs/${encodeURIComponent(e.id)}/events?t=${e.token}`,stopUrl:`/runs/${encodeURIComponent(e.id)}/stop?t=${e.token}`,serverNow:d?.now}:null;F.push({key:P(`a`),kind:`assistant`,turn:e,live:t,ended:e.finished})}let L=w(()=>{for(let e=F.length-1;e>=0;e--){let t=F[e];if(t.kind===`assistant`&&t.live&&!t.ended)return t}return null}),re=h(null),ie=h(0);T(e,ie);let R=h(``),z=h(void 0),ce=w(()=>Ce(L.value!==null,R.value)),ue=h(!1);c(R,()=>{z.value&&R.value===``&&(z.value=void 0)});function de(e){R.value=e,fe()}async function fe(){if(!d||ue.value)return;let e=Ke(R.value.trim(),d.commands);if(e===``)return;let n=C({key:P(`p`),kind:`person`,text:e,at:f.value,pending:!0});F.push(n),R.value=``,z.value=void 0,ue.value=!0,ie.value++;try{let r=await fetch(d.sendUrl,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e})}),i=await r.json().catch(()=>({}));if(r.status===202&&typeof i.viewPath==`string`&&typeof i.runId==`string`){let r=Ee(i.viewPath);if(!r)throw Error(`the run's view path was not one`);n.pending=!1,t.pathname()===`/threads`&&t.replaceUrl(`/threads/${encodeURIComponent(_)}`),F.push({key:P(`a`),kind:`assistant`,turn:{id:i.runId,request:e,startedAt:f.value,receivedAt:f.value,finished:!1,eventCount:0},live:{eventsUrl:r.eventsUrl,stopUrl:r.stopUrl},ended:!1});return}if(r.ok&&typeof i.reply==`string`){n.pending=!1;let e=Te(i.reply);e.kind===`handBack`?(R.value=e.command,z.value=`Enter runs it`):e.kind===`inline`&&F.push({key:P(`i`),kind:`inline`,text:e.text});return}throw Error(i.error??`HTTP ${r.status}`)}catch(e){n.pending=!1,n.failed=`not sent: ${e instanceof Error?e.message:`error`}`}finally{ue.value=!1}}function V(){let e=re.value;e&&fetch(`${e}${e.includes(`?`)?`&`:`?`}mode=soft`,{method:`POST`,credentials:`same-origin`})}function pe(e,t,n){let r=Me(F.filter(e=>e.kind===`person`).map(e=>({text:e.text,folded:e.folded!==void 0,ref:e})),t);if(!r)return;let i=e.turn.receivedAt??e.turn.startedAt;r.ref.folded=n===void 0?``:`at ${le(Math.max(0,n-i),`clock`)}`}function he(e){e.ended=!0,re.value=null}let ge=Ae({width:t.readPref(X.width),collapsed:t.readPref(X.collapsed)}),H=h(ge.width),U=h(ge.collapsed),_e=h(!1),W=h(t.mediaMatches(Sn)),ve=t.onMediaChange(Sn,e=>{W.value=e}),ye=h(null),be=h(null),xe=w(()=>W.value?U.value?`Show recent threads`:`Hide recent threads`:`Recent threads`);function Se(){if(W.value=t.mediaMatches(Sn),W.value){U.value=!U.value,t.writePref(X.collapsed,U.value?`1`:`0`);return}_e.value=!0}function G(e,n){H.value=ke(e),n&&t.writePref(X.width,String(H.value))}let K=null;function q(e){K&&G(K.startWidth+(e.clientX-K.startX),!1)}function we(){window.removeEventListener(`pointermove`,q),K&&(K=null,t.writePref(X.width,String(H.value)))}function J(e){e.button===0&&(e.preventDefault(),K={startX:e.clientX,startWidth:H.value},e.currentTarget?.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,q),window.addEventListener(`pointerup`,we,{once:!0}))}function Oe(e){if(e.key===`ArrowRight`)G(H.value+Y.step,!0);else if(e.key===`ArrowLeft`)G(H.value-Y.step,!0);else if(e.key===`Home`)G(Y.min,!0);else if(e.key===`End`)G(Y.max,!0);else return;e.preventDefault()}o(()=>{window.removeEventListener(`pointermove`,q),window.removeEventListener(`pointerup`,we),ve()});function je(e){let n=Ie(e);if(n){if(e.preventDefault(),n===`newThread`){t.navigate(`/threads`);return}if(ye.value){ye.value.focusFilter();return}if(U.value&&t.mediaMatches(Sn)){U.value=!1,t.writePref(X.collapsed,`0`),a().then(()=>ye.value?.focusFilter());return}_e.value=!0,a().then(()=>be.value?.focusFilter())}}let Pe=h(null),Z=h(!1);function Fe(){return document.body.scrollHeight-(window.innerHeight+window.scrollY)}c(()=>F.length,()=>{let e=Ne(Fe());a().then(()=>{e?Pe.value?.scrollIntoView?.({block:`end`}):Z.value=!0})});function Le(){Ne(Fe())&&(Z.value=!1)}function Re(){Pe.value?.scrollIntoView?.({block:`end`,behavior:`smooth`}),Z.value=!1}l(()=>{window.addEventListener(`scroll`,Le,{passive:!0}),window.addEventListener(`keydown`,je)}),te(()=>{window.removeEventListener(`scroll`,Le),window.removeEventListener(`keydown`,je)});let ze=w(()=>{let e=F.find(e=>e.kind===`person`);return e?De(e.text):`Switchboard`});c([ze,L],([e,n])=>{t.setTitle(n?`(1) ${e}`:e),t.setFavicon(n?se:oe)},{immediate:!0});let Be=w(()=>new Date(f.value).getHours()),Q=w(()=>F.length===0),$=d?.elsewhere,Ve=$?$.surface===`web`?`This thread is another person's conversation. You can read it here.`:`This thread lives in ${B[$.surface]??$.surface}.`:``;return(e,t)=>{let n=ee,a=I;return b(),g(r,{title:`Threads`,nav:`home`},{leading:s(()=>[m(n,{class:`rail-toggle -ml-1`,size:`xs`,color:`neutral`,variant:`ghost`,icon:W.value&&!U.value?`i-lucide-panel-left-close`:`i-lucide-panel-left`,"aria-label":xe.value,"aria-expanded":W.value?!U.value:void 0,onClick:Se},null,8,[`icon`,`aria-label`,`aria-expanded`])]),default:s(()=>[k(d)?(b(),O(`div`,{key:1,class:j([`home gap-8 md:grid`,U.value?`md:grid-cols-[minmax(0,1fr)]`:`md:grid-cols-[var(--rail-w)_minmax(0,1fr)]`]),style:i({"--rail-w":`${H.value}px`}),"data-rail":U.value?`hidden`:`shown`},[U.value?x(``,!0):(b(),O(`aside`,hn,[m(kt,{ref_key:`rail`,ref:ye,class:`sticky top-20`,rows:k(d).conversations,current:k(_),now:k(f),retention:k(S)},null,8,[`rows`,`current`,`now`,`retention`]),D(`div`,{class:`handle group/handle absolute inset-y-0 -right-5 flex w-3 cursor-col-resize touch-none select-none justify-center outline-none`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the recent threads column`,"aria-valuemin":k(Y).min,"aria-valuemax":k(Y).max,"aria-valuenow":H.value,tabindex:`0`,"data-testid":`rail-handle`,onPointerdown:J,onKeydown:Oe,onDblclick:t[0]||=e=>G(k(Y).default,!0)},[...t[5]||=[D(`span`,{class:`w-px rounded-full bg-(--ui-border-accented) opacity-0 transition-opacity duration-150 ease-out group-hover/handle:opacity-100 group-focus-visible/handle:opacity-100`,"aria-hidden":`true`},null,-1)]],40,gn)])),m(a,{open:_e.value,"onUpdate:open":t[1]||=e=>_e.value=e,side:`left`,title:`Recent threads`,ui:{content:`max-w-xs`}},{body:s(()=>[m(kt,{ref_key:`sheetRail`,ref:be,rows:k(d).conversations,current:k(_),now:k(f),retention:k(S)},null,8,[`rows`,`current`,`now`,`retention`])]),_:1},8,[`open`]),D(`section`,_n,[Q.value?(b(),g(It,{key:0,class:`mb-auto mt-[clamp(1.5rem,14vh,9rem)]`,name:k(d).viewer.name,hour:Be.value,suggestions:k(d).suggestions,onPick:de},{default:s(()=>[m(st,{modelValue:R.value,"onUpdate:modelValue":t[2]||=e=>R.value=e,mode:ce.value,hint:z.value,commands:k(d).commands,autofocus:``,"sweep-on-mount":``,onSubmit:fe,onStop:V},null,8,[`modelValue`,`mode`,`hint`,`commands`])]),_:1},8,[`name`,`hour`,`suggestions`])):(b(),g(u,{key:1,name:`sb-rise`,"move-class":`sb-move-move`,tag:`ol`,class:`transcript m-0 flex list-none flex-col gap-6 p-0 pb-32 pt-2`},{default:s(()=>[(b(!0),O(p,null,ne(F,e=>(b(),O(`li`,{key:e.key},[e.kind===`person`?(b(),g(Ht,{key:0,text:e.text,at:e.at,now:k(f),pending:e.pending,folded:e.folded,failed:e.failed},null,8,[`text`,`at`,`now`,`pending`,`folded`,`failed`])):e.kind===`assistant`?(b(),g(fn,{key:1,turn:e.turn,live:e.live,now:k(f),onInput:(t,n)=>pe(e,t,n),onEnded:t=>he(e),onStop:t[3]||=e=>re.value=e},null,8,[`turn`,`live`,`now`,`onInput`,`onEnded`])):(b(),O(`div`,vn,[m(me,{text:e.text},null,8,[`text`])]))]))),128))]),_:1})),D(`div`,{ref_key:`end`,ref:Pe,class:`end`,"aria-hidden":`true`},null,512),!Q.value&&k($)?(b(),O(`p`,yn,[v(A(k(Ve))+` `,1),k($).url?(b(),O(`a`,{key:0,href:k($).url,target:`_blank`,rel:`noopener`,class:`text-highlighted`},`Reply there ↗`,8,bn)):k($).surface===`web`?x(``,!0):(b(),O(p,{key:1},[v(`Reply there.`)],64))])):Q.value?x(``,!0):(b(),O(`div`,xn,[m(M,{name:`sb-rise`},{default:s(()=>[Z.value?(b(),O(`button`,{key:0,type:`button`,class:`new-pill absolute -top-9 left-1/2 -translate-x-1/2 rounded-full border border-default bg-(--ui-bg-elevated) px-3 py-1 font-mono text-[0.7rem] text-toned shadow-sm hover:text-highlighted`,onClick:Re},` ↓ new `)):x(``,!0)]),_:1}),m(st,{modelValue:R.value,"onUpdate:modelValue":t[4]||=e=>R.value=e,mode:ce.value,hint:z.value,commands:k(d).commands,autofocus:``,onSubmit:fe,onStop:V},null,8,[`modelValue`,`mode`,`hint`,`commands`])]))])],14,mn)):(b(),O(`div`,pn,`This page needs its seed.`))]),_:1})}}});export{Cn as default};
@@ -1 +1 @@
1
- import{T as e,t}from"./AppShell-DEy5jRuS.js";import{Lr as n,_n as r,a as i,cn as a,i as o,ir as s,r as c,sn as l,vi as u,wi as d,yn as f}from"./seed-DeKSHrt2.js";import{t as p}from"./RunsTabs-CtNGNnhN.js";var m={class:`notfound mx-auto my-12 max-w-xl text-center text-toned`},h={class:`why text-[0.8rem] text-muted`},g=f({__name:`NotFoundPage`,setup(e){let f=c(`runNotFound`),g=o(f?.retentionDays??null);return(e,o)=>{let c=i;return s(),a(t,{title:`Run not found`,nav:`runs`},{default:n(()=>[r(p,{current:`runs`}),l(`section`,m,[o[0]||=l(`p`,{class:`code mb-3 font-mono text-4xl font-medium tracking-wide text-dimmed`},`404`,-1),o[1]||=l(`h2`,{class:`mb-3 text-lg font-medium tracking-tight text-highlighted`},`That run isn't here.`,-1),o[2]||=l(`p`,{class:`mb-2.5 leading-relaxed`},` It may have finished and aged out, the link may be missing its token, or it never existed — this page says the same thing in every case. `,-1),l(`p`,h,d(u(g)),1),r(c,{class:`back mt-4`,color:`neutral`,variant:`outline`,to:`/runs`,label:`← All runs`})])]),_:1})}}}),_=e({default:()=>v}),v=g;export{_ as n,v as t};
1
+ import{T as e,t}from"./AppShell-IDMGG6yi.js";import{Lr as n,_n as r,a as i,cn as a,i as o,ir as s,r as c,sn as l,vi as u,wi as d,yn as f}from"./seed-DeKSHrt2.js";import{t as p}from"./RunsTabs-BUfdk0lH.js";var m={class:`notfound mx-auto my-12 max-w-xl text-center text-toned`},h={class:`why text-[0.8rem] text-muted`},g=f({__name:`NotFoundPage`,setup(e){let f=c(`runNotFound`),g=o(f?.retentionDays??null);return(e,o)=>{let c=i;return s(),a(t,{title:`Run not found`,nav:`runs`},{default:n(()=>[r(p,{current:`runs`}),l(`section`,m,[o[0]||=l(`p`,{class:`code mb-3 font-mono text-4xl font-medium tracking-wide text-dimmed`},`404`,-1),o[1]||=l(`h2`,{class:`mb-3 text-lg font-medium tracking-tight text-highlighted`},`That run isn't here.`,-1),o[2]||=l(`p`,{class:`mb-2.5 leading-relaxed`},` It may have finished and aged out, the link may be missing its token, or it never existed — this page says the same thing in every case. `,-1),l(`p`,h,d(u(g)),1),r(c,{class:`back mt-4`,color:`neutral`,variant:`outline`,to:`/runs`,label:`← All runs`})])]),_:1})}}}),_=e({default:()=>v}),v=g;export{_ as n,v as t};
@@ -1 +1 @@
1
- import{_ as e,b as t,v as n,w as r,x as i,y as a}from"./AppShell-DEy5jRuS.js";import{A as o,B as s,Dr as c,H as l,Ht as u,J as d,Lr as f,Mr as p,N as m,P as h,Qn as g,Si as _,Wn as v,Wt as y,_ as b,_n as x,a as ee,at as te,ci as S,cn as C,dr as w,ft as T,g as ne,gn as E,h as re,hi as ie,ir as D,j as O,kn as k,ln as A,mi as j,mr as ae,on as M,sn as N,u as oe,un as P,vi as F,wi as I,x as L,xi as R,xr as z,y as B,yn as V,z as H,zr as U}from"./seed-DeKSHrt2.js";import{r as W}from"./main-B3is4sk6.js";import{E as G}from"./indexRow-BD1VT8o8.js";import{d as K,f as q,m as se,p as ce}from"./sseReplay-yji8a1wM.js";var[J,le]=s(`DialogRoot`),ue=V({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=te(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=S(),a=S(),{modal:o,unmountOnHide:s}=ie(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)=>w(e.$slots,`default`,{open:F(r),close:()=>r.value=!1})}}),de=V({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;m();let n=J();return(e,r)=>(D(),C(F(o),v(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>F(n).onOpenChange(!1)}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`type`]))}}),Y=V({__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(r,{emit:i}){let o=r,s=i,c=J(),{forwardRef:l,currentElement:u}=m();return c.titleId||=t(void 0,`reka-dialog-title`),c.descriptionId||=t(void 0,`reka-dialog-description`),g(()=>{c.contentElement=u,H()!==document.body&&(c.triggerElement.value=H())}),(t,r)=>(D(),C(F(n),{"as-child":``,loop:``,trapped:o.trapFocus,present:o.present,onMountAutoFocus:r[5]||=e=>s(`openAutoFocus`,e),onUnmountAutoFocus:r[6]||=e=>s(`closeAutoFocus`,e)},{default:f(()=>[x(F(a),v({id:F(c).contentId,ref:F(l),as:t.as,"as-child":t.asChild,present:o.present,"disable-outside-pointer-events":t.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":F(c).descriptionId,"aria-labelledby":F(c).titleId,"data-state":F(e)(F(c).open.value)},t.$attrs,{onDismiss:r[0]||=e=>F(c).onOpenChange(!1),onEscapeKeyDown:r[1]||=e=>s(`escapeKeyDown`,e),onFocusOutside:r[2]||=e=>s(`focusOutside`,e),onInteractOutside:r[3]||=e=>s(`interactOutside`,e),onPointerDownOutside:r[4]||=e=>s(`pointerDownOutside`,e)}),{default:f(()=>[w(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=V({__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 n=e,r=t,a=J(),o=h(r),{forwardRef:s,currentElement:c}=m(),l=M(()=>n.present?c.value:void 0);i(l);let u=M(()=>{let{present:e,...t}=n;return t});return p(()=>n.present,(e,t)=>{!e&&t&&a.triggerElement.value?.focus()}),(e,t)=>(D(),C(Y,v({...u.value,...F(o)},{ref:F(s),present:e.present,"trap-focus":F(a).open.value,"disable-outside-pointer-events":n.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:f(()=>[w(e.$slots,`default`)]),_:3},16,[`present`,`trap-focus`,`disable-outside-pointer-events`]))}}),pe=V({__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=h(t);m();let i=J(),a=S(!1),o=S(!1),s=M(()=>{let{present:e,...t}=n;return t});return p(()=>n.present,(e,t)=>{!e&&t&&(a.value||i.triggerElement.value?.focus(),a.value=!1,o.value=!1)}),(e,t)=>(D(),C(Y,v({...s.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:f(()=>[w(e.$slots,`default`)]),_:3},16,[`present`]))}}),me=V({__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=h(r),{forwardRef:o}=m();return(e,t)=>(D(),C(F(O),{present:e.forceMount||F(i).open.value,"force-mount":e.forceMount||!F(i).unmountOnHide.value},{default:f(({present:t})=>[F(i).modal.value?U((D(),C(fe,v({key:0,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`present`])),[[u,F(i).unmountOnHide.value||t]]):U((D(),C(pe,v({key:1,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`present`])),[[u,F(i).unmountOnHide.value||t]])]),_:3},8,[`present`,`force-mount`]))}}),X=V({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let t=e;m();let n=J();return(e,r)=>(D(),C(F(o),v(t,{id:F(n).descriptionId}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`id`]))}}),he=V({__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 p(()=>t.present,e=>i.value=e),m(),(e,t)=>(D(),C(F(o),{as:e.as,"as-child":e.asChild,"data-state":F(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`},onPointerdown:t[0]||=y(()=>{},[`left`,`self`,`prevent`])},{default:f(()=>[w(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),ge=V({__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}=m();return(e,r)=>F(t)?.modal.value?(D(),C(F(O),{key:0,present:e.forceMount||F(t).open.value,"force-mount":e.forceMount||!F(t).unmountOnHide.value},{default:f(({present:r})=>[U(x(he,v(e.$attrs,{ref:F(n),as:e.as,"as-child":e.asChild,present:F(t).unmountOnHide.value||r}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`as`,`as-child`,`present`]),[[u,F(t).unmountOnHide.value||r]])]),_:3},8,[`present`,`force-mount`])):A(`v-if`,!0)}}),_e=V({__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)=>(D(),C(F(L),_(k(t)),{default:f(()=>[w(e.$slots,`default`)]),_:3},16))}}),Z=V({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let t=e,n=J();return m(),(e,r)=>(D(),C(F(o),v(t,{id:F(n).titleId}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`id`]))}}),ve=V({__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}=m();return r.contentId||=t(void 0,`reka-dialog-content`),g(()=>{r.triggerElement.value=a.value}),(e,t)=>(D(),C(F(o),v(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:f(()=>[w(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=b(`slideover`,n),{t:o}=l(),s=d(),u=ne(T(a,`open`,`defaultOpen`,`modal`,`unmountOnHide`),r),p=B(j(()=>a.portal)),m=j(()=>a.content),h=M(()=>a.dismissible?{pointerDownOutside:ye}:[`interactOutside`,`escapeKeyDown`].reduce((e,t)=>(e[t]=e=>{e.preventDefault(),r(`close:prevent`)},e),{})),g=M(()=>re({extend:be,...s.ui?.slideover||{}})({transition:a.transition,side:a.side,inset:a.inset}));return(e,t)=>(D(),C(F(ue),_(k(F(u))),{default:f(({open:n,close:c})=>[i.default?(D(),C(F(ve),{key:0,"as-child":``,class:R(F(a).class)},{default:f(()=>[w(e.$slots,`default`,{open:n})]),_:2},1032,[`class`])):A(``,!0),x(F(_e),v(F(p),{"force-mount":F(p).disabled&&F(a).unmountOnHide===!1||void 0}),{default:f(()=>[x(F(oe),null,{default:f(()=>[F(a).overlay?(D(),C(F(ge),{key:0,"data-slot":`overlay`,class:R(g.value.overlay({class:F(a).ui?.overlay}))},null,8,[`class`])):A(``,!0),x(F(me),v({"data-side":F(a).side,"data-slot":`content`,class:g.value.content({class:[!i.default&&F(a).class,F(a).ui?.content]})},m.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`)},z(h.value)),{default:f(()=>[!F(a).title&&!i.title||!F(a).description&&!i.description||i.content?(D(),C(F(W),{key:0},{default:f(()=>[!F(a).title&&!i.title?(D(),C(F(Z),{key:0})):i.content?(D(),C(F(Z),{key:1},{default:f(()=>[w(e.$slots,`title`,{},()=>[E(I(F(a).title),1)])]),_:3})):A(``,!0),!F(a).description&&!i.description?(D(),C(F(X),{key:2})):i.content?(D(),C(F(X),{key:3},{default:f(()=>[w(e.$slots,`description`,{},()=>[E(I(F(a).description),1)])]),_:3})):A(``,!0)]),_:3})):A(``,!0),w(e.$slots,`content`,{close:c},()=>[i.header||F(a).title||i.title||F(a).description||i.description||F(a).close||i.close?(D(),P(`div`,{key:0,"data-slot":`header`,class:R(g.value.header({class:F(a).ui?.header}))},[w(e.$slots,`header`,{close:c},()=>[F(a).title||i.title||F(a).description||i.description?(D(),P(`div`,{key:0,"data-slot":`wrapper`,class:R(g.value.wrapper({class:F(a).ui?.wrapper}))},[F(a).title||i.title?(D(),C(F(Z),{key:0,"data-slot":`title`,class:R(g.value.title({class:F(a).ui?.title}))},{default:f(()=>[w(e.$slots,`title`,{},()=>[E(I(F(a).title),1)])]),_:3},8,[`class`])):A(``,!0),F(a).description||i.description?(D(),C(F(X),{key:1,"data-slot":`description`,class:R(g.value.description({class:F(a).ui?.description}))},{default:f(()=>[w(e.$slots,`description`,{},()=>[E(I(F(a).description),1)])]),_:3},8,[`class`])):A(``,!0)],2)):A(``,!0),w(e.$slots,`actions`),F(a).close||i.close?(D(),C(F(de),{key:1,"as-child":``},{default:f(()=>[w(e.$slots,`close`,{ui:g.value},()=>[F(a).close?(D(),C(ee,v({key:0,icon:F(a).closeIcon||F(s).ui.icons.close,color:`neutral`,variant:`ghost`,"aria-label":F(o)(`slideover.close`)},typeof F(a).close==`object`?F(a).close:{},{"data-slot":`close`,class:g.value.close({class:F(a).ui?.close})}),null,16,[`icon`,`aria-label`,`class`])):A(``,!0)])]),_:2},1024)):A(``,!0)])],2)):A(``,!0),N(`div`,{"data-slot":`body`,class:R(g.value.body({class:F(a).ui?.body}))},[w(e.$slots,`body`,{close:c})],2),i.footer?(D(),P(`div`,{key:1,"data-slot":`footer`,class:R(g.value.footer({class:F(a).ui?.footer}))},[w(e.$slots,`footer`,{close:c})],2)):A(``,!0)])]),_:2},1040,[`data-side`,`class`])]),_:2},1024)]),_:2},1040,[`force-mount`])]),_:3},16))}};function Q(e){let t=S(`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=V({__name:`PendingTurnRow`,props:{verb:{},elapsedMs:{},slow:{type:Boolean},model:{},tag:{},id:{}},setup(e){return(t,n)=>(D(),C(ae(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:f(()=>[n[0]||=N(`span`,{class:`pulse text-[1.1em] leading-none text-info motion-safe:animate-pulse`},`∿`,-1),e.model?(D(),P(`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},I(F(K)(e.model)),9,Ce)):A(``,!0),N(`span`,we,I(e.verb)+`…`,1),N(`span`,{class:R([`since ml-auto shrink-0 font-mono text-xs tabular-nums`,e.slow?`text-warn`:`text-dimmed`])},I(F(G)(e.elapsedMs,`clock`)),3)]),_:1},8,[`id`]))}});export{xe as i,Se as n,Q as r,Te as t};
1
+ import{_ as e,b as t,v as n,w as r,x as i,y as a}from"./AppShell-IDMGG6yi.js";import{A as o,B as s,Dr as c,H as l,Ht as u,J as d,Lr as f,Mr as p,N as m,P as h,Qn as g,Si as _,Wn as v,Wt as y,_ as b,_n as x,a as ee,at as te,ci as S,cn as C,dr as w,ft as T,g as ne,gn as E,h as re,hi as ie,ir as D,j as O,kn as k,ln as A,mi as j,mr as ae,on as M,sn as N,u as oe,un as P,vi as F,wi as I,x as L,xi as R,xr as z,y as B,yn as V,z as H,zr as U}from"./seed-DeKSHrt2.js";import{r as W}from"./main-D4EA1g6n.js";import{E as G}from"./indexRow-BD1VT8o8.js";import{d as K,f as q,m as se,p as ce}from"./sseReplay-g7ml86LM.js";var[J,le]=s(`DialogRoot`),ue=V({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=te(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=S(),a=S(),{modal:o,unmountOnHide:s}=ie(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)=>w(e.$slots,`default`,{open:F(r),close:()=>r.value=!1})}}),de=V({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;m();let n=J();return(e,r)=>(D(),C(F(o),v(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>F(n).onOpenChange(!1)}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`type`]))}}),Y=V({__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(r,{emit:i}){let o=r,s=i,c=J(),{forwardRef:l,currentElement:u}=m();return c.titleId||=t(void 0,`reka-dialog-title`),c.descriptionId||=t(void 0,`reka-dialog-description`),g(()=>{c.contentElement=u,H()!==document.body&&(c.triggerElement.value=H())}),(t,r)=>(D(),C(F(n),{"as-child":``,loop:``,trapped:o.trapFocus,present:o.present,onMountAutoFocus:r[5]||=e=>s(`openAutoFocus`,e),onUnmountAutoFocus:r[6]||=e=>s(`closeAutoFocus`,e)},{default:f(()=>[x(F(a),v({id:F(c).contentId,ref:F(l),as:t.as,"as-child":t.asChild,present:o.present,"disable-outside-pointer-events":t.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":F(c).descriptionId,"aria-labelledby":F(c).titleId,"data-state":F(e)(F(c).open.value)},t.$attrs,{onDismiss:r[0]||=e=>F(c).onOpenChange(!1),onEscapeKeyDown:r[1]||=e=>s(`escapeKeyDown`,e),onFocusOutside:r[2]||=e=>s(`focusOutside`,e),onInteractOutside:r[3]||=e=>s(`interactOutside`,e),onPointerDownOutside:r[4]||=e=>s(`pointerDownOutside`,e)}),{default:f(()=>[w(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=V({__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 n=e,r=t,a=J(),o=h(r),{forwardRef:s,currentElement:c}=m(),l=M(()=>n.present?c.value:void 0);i(l);let u=M(()=>{let{present:e,...t}=n;return t});return p(()=>n.present,(e,t)=>{!e&&t&&a.triggerElement.value?.focus()}),(e,t)=>(D(),C(Y,v({...u.value,...F(o)},{ref:F(s),present:e.present,"trap-focus":F(a).open.value,"disable-outside-pointer-events":n.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:f(()=>[w(e.$slots,`default`)]),_:3},16,[`present`,`trap-focus`,`disable-outside-pointer-events`]))}}),pe=V({__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=h(t);m();let i=J(),a=S(!1),o=S(!1),s=M(()=>{let{present:e,...t}=n;return t});return p(()=>n.present,(e,t)=>{!e&&t&&(a.value||i.triggerElement.value?.focus(),a.value=!1,o.value=!1)}),(e,t)=>(D(),C(Y,v({...s.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:f(()=>[w(e.$slots,`default`)]),_:3},16,[`present`]))}}),me=V({__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=h(r),{forwardRef:o}=m();return(e,t)=>(D(),C(F(O),{present:e.forceMount||F(i).open.value,"force-mount":e.forceMount||!F(i).unmountOnHide.value},{default:f(({present:t})=>[F(i).modal.value?U((D(),C(fe,v({key:0,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`present`])),[[u,F(i).unmountOnHide.value||t]]):U((D(),C(pe,v({key:1,ref:F(o),present:F(i).unmountOnHide.value||t},{...n,...F(a),...e.$attrs}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`present`])),[[u,F(i).unmountOnHide.value||t]])]),_:3},8,[`present`,`force-mount`]))}}),X=V({__name:`DialogDescription`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`p`}},setup(e){let t=e;m();let n=J();return(e,r)=>(D(),C(F(o),v(t,{id:F(n).descriptionId}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`id`]))}}),he=V({__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 p(()=>t.present,e=>i.value=e),m(),(e,t)=>(D(),C(F(o),{as:e.as,"as-child":e.asChild,"data-state":F(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`},onPointerdown:t[0]||=y(()=>{},[`left`,`self`,`prevent`])},{default:f(()=>[w(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),ge=V({__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}=m();return(e,r)=>F(t)?.modal.value?(D(),C(F(O),{key:0,present:e.forceMount||F(t).open.value,"force-mount":e.forceMount||!F(t).unmountOnHide.value},{default:f(({present:r})=>[U(x(he,v(e.$attrs,{ref:F(n),as:e.as,"as-child":e.asChild,present:F(t).unmountOnHide.value||r}),{default:f(()=>[w(e.$slots,`default`)]),_:2},1040,[`as`,`as-child`,`present`]),[[u,F(t).unmountOnHide.value||r]])]),_:3},8,[`present`,`force-mount`])):A(`v-if`,!0)}}),_e=V({__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)=>(D(),C(F(L),_(k(t)),{default:f(()=>[w(e.$slots,`default`)]),_:3},16))}}),Z=V({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let t=e,n=J();return m(),(e,r)=>(D(),C(F(o),v(t,{id:F(n).titleId}),{default:f(()=>[w(e.$slots,`default`)]),_:3},16,[`id`]))}}),ve=V({__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}=m();return r.contentId||=t(void 0,`reka-dialog-content`),g(()=>{r.triggerElement.value=a.value}),(e,t)=>(D(),C(F(o),v(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:f(()=>[w(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=b(`slideover`,n),{t:o}=l(),s=d(),u=ne(T(a,`open`,`defaultOpen`,`modal`,`unmountOnHide`),r),p=B(j(()=>a.portal)),m=j(()=>a.content),h=M(()=>a.dismissible?{pointerDownOutside:ye}:[`interactOutside`,`escapeKeyDown`].reduce((e,t)=>(e[t]=e=>{e.preventDefault(),r(`close:prevent`)},e),{})),g=M(()=>re({extend:be,...s.ui?.slideover||{}})({transition:a.transition,side:a.side,inset:a.inset}));return(e,t)=>(D(),C(F(ue),_(k(F(u))),{default:f(({open:n,close:c})=>[i.default?(D(),C(F(ve),{key:0,"as-child":``,class:R(F(a).class)},{default:f(()=>[w(e.$slots,`default`,{open:n})]),_:2},1032,[`class`])):A(``,!0),x(F(_e),v(F(p),{"force-mount":F(p).disabled&&F(a).unmountOnHide===!1||void 0}),{default:f(()=>[x(F(oe),null,{default:f(()=>[F(a).overlay?(D(),C(F(ge),{key:0,"data-slot":`overlay`,class:R(g.value.overlay({class:F(a).ui?.overlay}))},null,8,[`class`])):A(``,!0),x(F(me),v({"data-side":F(a).side,"data-slot":`content`,class:g.value.content({class:[!i.default&&F(a).class,F(a).ui?.content]})},m.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`)},z(h.value)),{default:f(()=>[!F(a).title&&!i.title||!F(a).description&&!i.description||i.content?(D(),C(F(W),{key:0},{default:f(()=>[!F(a).title&&!i.title?(D(),C(F(Z),{key:0})):i.content?(D(),C(F(Z),{key:1},{default:f(()=>[w(e.$slots,`title`,{},()=>[E(I(F(a).title),1)])]),_:3})):A(``,!0),!F(a).description&&!i.description?(D(),C(F(X),{key:2})):i.content?(D(),C(F(X),{key:3},{default:f(()=>[w(e.$slots,`description`,{},()=>[E(I(F(a).description),1)])]),_:3})):A(``,!0)]),_:3})):A(``,!0),w(e.$slots,`content`,{close:c},()=>[i.header||F(a).title||i.title||F(a).description||i.description||F(a).close||i.close?(D(),P(`div`,{key:0,"data-slot":`header`,class:R(g.value.header({class:F(a).ui?.header}))},[w(e.$slots,`header`,{close:c},()=>[F(a).title||i.title||F(a).description||i.description?(D(),P(`div`,{key:0,"data-slot":`wrapper`,class:R(g.value.wrapper({class:F(a).ui?.wrapper}))},[F(a).title||i.title?(D(),C(F(Z),{key:0,"data-slot":`title`,class:R(g.value.title({class:F(a).ui?.title}))},{default:f(()=>[w(e.$slots,`title`,{},()=>[E(I(F(a).title),1)])]),_:3},8,[`class`])):A(``,!0),F(a).description||i.description?(D(),C(F(X),{key:1,"data-slot":`description`,class:R(g.value.description({class:F(a).ui?.description}))},{default:f(()=>[w(e.$slots,`description`,{},()=>[E(I(F(a).description),1)])]),_:3},8,[`class`])):A(``,!0)],2)):A(``,!0),w(e.$slots,`actions`),F(a).close||i.close?(D(),C(F(de),{key:1,"as-child":``},{default:f(()=>[w(e.$slots,`close`,{ui:g.value},()=>[F(a).close?(D(),C(ee,v({key:0,icon:F(a).closeIcon||F(s).ui.icons.close,color:`neutral`,variant:`ghost`,"aria-label":F(o)(`slideover.close`)},typeof F(a).close==`object`?F(a).close:{},{"data-slot":`close`,class:g.value.close({class:F(a).ui?.close})}),null,16,[`icon`,`aria-label`,`class`])):A(``,!0)])]),_:2},1024)):A(``,!0)])],2)):A(``,!0),N(`div`,{"data-slot":`body`,class:R(g.value.body({class:F(a).ui?.body}))},[w(e.$slots,`body`,{close:c})],2),i.footer?(D(),P(`div`,{key:1,"data-slot":`footer`,class:R(g.value.footer({class:F(a).ui?.footer}))},[w(e.$slots,`footer`,{close:c})],2)):A(``,!0)])]),_:2},1040,[`data-side`,`class`])]),_:2},1024)]),_:2},1040,[`force-mount`])]),_:3},16))}};function Q(e){let t=S(`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=V({__name:`PendingTurnRow`,props:{verb:{},elapsedMs:{},slow:{type:Boolean},model:{},tag:{},id:{}},setup(e){return(t,n)=>(D(),C(ae(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:f(()=>[n[0]||=N(`span`,{class:`pulse text-[1.1em] leading-none text-info motion-safe:animate-pulse`},`∿`,-1),e.model?(D(),P(`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},I(F(K)(e.model)),9,Ce)):A(``,!0),N(`span`,we,I(e.verb)+`…`,1),N(`span`,{class:R([`since ml-auto shrink-0 font-mono text-xs tabular-nums`,e.slow?`text-warn`:`text-dimmed`])},I(F(G)(e.elapsedMs,`clock`)),3)]),_:1},8,[`id`]))}});export{xe as i,Se as n,Q as r,Te as t};
@@ -1 +1 @@
1
- import{t as e}from"./AppShell-DEy5jRuS.js";import{Lr as t,Xt as n,_n as r,cn as i,gn as a,ir as o,ln as ee,on as s,r as c,sn as l,un as u,ur as d,vi as f,wi as p,yn as te}from"./seed-DeKSHrt2.js";import{t as m}from"./StatusDot-DPWE1JmO.js";import{_ as h,a as g,c as ne,g as _,h as re,i as ie,l as ae,o as oe,p as v,s as se,t as ce,u as le}from"./residentsModel-By1fThvk.js";var ue={class:`mt-4 first:mt-0`},de={class:`w-full border-collapse font-mono text-[0.8125rem]`},fe={class:`border-t border-muted`},pe={class:`px-2 py-1 align-top`},me={class:`ml-1.5 font-medium`},y={class:`border-t border-muted`},b={class:`break-all px-2 py-1 align-top`},x={key:0},S={key:1,class:`text-dimmed`},C={class:`border-t border-muted`},w={class:`break-all px-2 py-1 align-top`},T={key:0},E={key:1,class:`text-dimmed`},D={class:`border-t border-muted`},O={class:`break-all px-2 py-1 align-top`},k={key:0},A={key:1,class:`text-dimmed`},j={class:`border-t border-muted`},M={class:`break-all px-2 py-1 align-top`},N={key:0},P={key:1,class:`text-dimmed`},F={class:`border-t border-muted`},I={class:`break-all px-2 py-1 align-top`},L={key:1,class:`text-dimmed`},R={class:`mt-4`},z={class:`w-full border-collapse font-mono text-[0.8125rem]`},he={class:`border-t border-muted`},ge={class:`break-all px-2 py-1 align-top`},_e=[`href`],ve={key:1},ye={class:`border-t border-muted`},be={class:`break-all px-2 py-1 align-top`},xe={class:`border-t border-muted`},Se={class:`break-all px-2 py-1 align-top`},Ce=[`href`],we={key:1},Te={key:2,class:`text-dimmed`},Ee={class:`border-t border-muted`},De={class:`break-all px-2 py-1 align-top`},Oe={key:0},ke={key:1,class:`text-dimmed`},Ae={class:`border-t border-muted`},je={class:`break-all px-2 py-1 align-top`},Me={key:0},Ne={key:1,class:`text-dimmed`},Pe={class:`border-t border-muted`},Fe={class:`break-all px-2 py-1 align-top`},Ie={key:0},Le={key:1,class:`text-dimmed`},Re={class:`mt-4`},ze={class:`w-full border-collapse font-mono text-[0.8125rem]`},Be={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Ve={class:`break-all px-2 py-1 align-top`},He={class:`w-full border-collapse font-mono text-[0.8125rem]`},Ue={class:`w-32 break-all px-2 py-1 align-top text-muted sm:w-96 sm:break-words`},We={class:`px-2 py-1 align-top`},Ge={key:1,class:`text-xs text-muted`},Ke={class:`mt-4`},qe={key:0,class:`w-full border-collapse font-mono text-[0.8125rem]`},Je={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Ye={class:`break-all px-2 py-1 align-top`},B={key:0},Xe={key:1,class:`text-dimmed`},Ze={key:1,class:`text-xs text-muted`},Qe={class:`mt-4`},$e={class:`mb-1 text-xs text-muted`},et={class:`overflow-x-auto`},tt={class:`w-full border-collapse font-mono text-[0.8125rem]`},nt={class:`break-all px-2 py-1 align-top`},rt={key:0,class:`text-xs text-muted`},it={class:`break-all px-2 py-1 align-top`},at=[`href`],ot={key:1},st={key:2,class:`text-dimmed`},ct={class:`break-all px-2 py-1 align-top`},lt={key:0},ut={key:1,class:`text-dimmed`},dt={key:2},ft={key:3,class:`text-dimmed`},pt={class:`break-all px-2 py-1 align-top`},mt={key:0},ht={key:1,class:`text-dimmed`},gt={key:2},_t={key:3,class:`text-dimmed`},vt={key:1,class:`text-xs text-muted`},yt={class:`mt-4`},bt={class:`w-full border-collapse font-mono text-[0.8125rem]`},xt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},St={class:`px-2 py-1 align-top`},Ct={class:`mt-4`},wt={key:0,class:`w-full border-collapse font-mono text-[0.8125rem]`},Tt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Et={class:`break-all px-2 py-1 align-top`},Dt={class:`text-xs text-muted`},Ot={key:1,class:`text-xs text-muted`},kt={class:`mt-4`},At={class:`w-full border-collapse font-mono text-[0.8125rem]`},jt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Mt={class:`break-all px-2 py-1 align-top`},Nt={key:0},Pt={key:1,class:`text-dimmed`},Ft={class:`mt-4 text-xs text-muted`},It={class:`rounded bg-elevated px-1 py-0.5`},Lt={class:`rounded bg-elevated px-1 py-0.5`},Rt={class:`rounded bg-elevated px-1 py-0.5`},V=te({__name:`ResidentDetailPage`,setup(te){let V=c(`resident`),H=s(()=>V?.record??{}),U=s(()=>se(H.value)),W=s(()=>ne(H.value)||(V?.slug??``)),G=s(()=>v(U.value.sha)),K=s(()=>ce.test(W.value)?`https://github.com/${W.value}`:void 0),q=s(()=>K.value&&/^[0-9a-f]{7,40}$/.test(G.value)?`${K.value}/commit/${G.value}`:void 0),J=s(()=>{let e=U.value.snapshot;return e&&typeof e==`object`?g(e):void 0}),zt=s(()=>g(U.value.schedules)),Y=s(()=>{let e=g(H.value.commands),t=g(H.value.effects);return Object.keys(e).sort().map(n=>({name:n,command:v(e[n]),effect:v(t[n])||`readonly`}))}),X=s(()=>le(H.value).map(e=>({...e,threadKey:e.threadKey||`?`,ref:e.ref||`?`,sha:e.sha?e.sha.slice(0,8):``,commitHref:K.value&&/^[0-9a-f]{7,40}$/.test(e.sha)?`${K.value}/commit/${e.sha}`:void 0}))),Z=s(()=>X.value.filter(e=>!e.evicted).length),Q=s(()=>{let e=U.value.lastRestore;return e?JSON.stringify(e):``}),$=s(()=>oe(H.value)),Bt=s(()=>typeof H.value.diskBudgetMb==`number`?H.value.diskBudgetMb:void 0),Vt=s(()=>{let e=$.value;if(!e)return[];let t=ie(e,Bt.value),n=n=>{let r=t.room[n];return r===null?h(e.parts,n)===null?`? (checkout not measured)`:`?`:`${r} more (${_(h(e.parts,n))} each)`};return[[`used / total`,re(e)],[`free`,`${_(t.freeKiB)}${t.capped?` under the ${_(t.capacityKiB)} diskBudgetMb cap`:``}`],[`reserve`,`${_(t.reserve.totalKiB)} (snapshot staging ${_(t.reserve.stagingKiB)} + floor ${_(t.reserve.floorKiB)})`],[`headroom`,`${_(t.headroomKiB)} — room for ${n(`hardlink`)} hardlinked trees, ${n(`reconcile`)} lockfile-diverged (reconciling)`],[`measured`,e.at||`—`]]}),Ht=s(()=>{let e=$.value;if(!e)return[];let t=[[`mirror`,_(e.parts.mirror)],[`checkout deps (node_modules)`,_(e.parts.deps)],[`checkout (history + tree + build)`,_(e.parts.checkout)]];for(let[n,r]of Object.entries(e.parts.threads).sort((e,t)=>t[1]-e[1]))t.push([`thread ${n}`,_(r)]);for(let[n,r]of Object.entries(e.parts.homes).sort((e,t)=>t[1]-e[1]))r>=1024&&t.push([`home ${n}`,_(r)]);return t.push([`other (image, /tmp, …)`,_(e.parts.other)]),t});return(s,c)=>(o(),i(e,{title:W.value||`Resident`,nav:`residents`},{leading:t(()=>[...c[0]||=[l(`a`,{class:`back text-sm text-muted no-underline hover:text-primary`,href:`/residents`},`← All residents`,-1)]]),default:t(()=>[l(`section`,ue,[c[8]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Lifecycle`,-1),l(`table`,de,[l(`tbody`,null,[l(`tr`,fe,[c[1]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`state`,-1),l(`td`,pe,[r(m,{tone:f(ae)(U.value.state),label:U.value.state},null,8,[`tone`,`label`]),l(`span`,me,p(U.value.state),1)])]),l(`tr`,y,[c[2]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`reason`,-1),l(`td`,b,[U.value.reason?(o(),u(`span`,x,p(U.value.reason),1)):(o(),u(`span`,S,`—`))])]),l(`tr`,C,[c[3]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last refresh error`,-1),l(`td`,w,[f(v)(U.value.lastRefreshError)?(o(),u(`span`,T,p(f(v)(U.value.lastRefreshError)),1)):(o(),u(`span`,E,`—`))])]),l(`tr`,D,[c[4]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last restore`,-1),l(`td`,O,[Q.value?(o(),u(`span`,k,p(Q.value),1)):(o(),u(`span`,A,`—`))])]),l(`tr`,j,[c[5]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`state updated`,-1),l(`td`,M,[f(v)(U.value.updatedAt)?(o(),u(`span`,N,p(f(v)(U.value.updatedAt)),1)):(o(),u(`span`,P,`—`))])]),l(`tr`,F,[c[7]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`idle since`,-1),l(`td`,I,[f(v)(U.value.idleSince)?(o(),u(n,{key:0},[a(p(f(v)(U.value.idleSince))+` `,1),c[6]||=l(`span`,{class:`text-xs text-muted`},`(refresh parked; container may sleep)`,-1)],64)):(o(),u(`span`,L,`awake`))])])])])]),l(`section`,R,[c[15]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Pinned facts`,-1),l(`table`,z,[l(`tbody`,null,[l(`tr`,he,[c[9]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`repository`,-1),l(`td`,ge,[K.value?(o(),u(`a`,{key:0,class:`text-primary`,href:K.value},p(K.value),9,_e)):(o(),u(`span`,ve,p(f(v)(H.value.resource)||`—`),1))])]),l(`tr`,ye,[c[10]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`default ref`,-1),l(`td`,be,p(f(v)(U.value.defaultRef)||f(v)(H.value.defaultRef)||`—`),1)]),l(`tr`,xe,[c[11]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`pinned sha`,-1),l(`td`,Se,[q.value?(o(),u(`a`,{key:0,class:`text-primary`,href:q.value},p(G.value),9,Ce)):G.value?(o(),u(`span`,we,p(G.value),1)):(o(),u(`span`,Te,`—`))])]),l(`tr`,Ee,[c[12]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`lockfile hash`,-1),l(`td`,De,[f(v)(U.value.lockfileHash)?(o(),u(`span`,Oe,p(f(v)(U.value.lockfileHash)),1)):(o(),u(`span`,ke,`—`))])]),l(`tr`,Ae,[c[13]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`provisioned`,-1),l(`td`,je,[f(v)(U.value.provisionedAt)?(o(),u(`span`,Me,p(f(v)(U.value.provisionedAt)),1)):(o(),u(`span`,Ne,`—`))])]),l(`tr`,Pe,[c[14]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last refresh`,-1),l(`td`,Fe,[f(v)(U.value.lastRefreshAt)?(o(),u(`span`,Ie,p(f(v)(U.value.lastRefreshAt)),1)):(o(),u(`span`,Le,`—`))])])])])]),l(`section`,Re,[c[17]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Disk`,-1),$.value?(o(),u(n,{key:0},[l(`table`,ze,[l(`tbody`,null,[(o(!0),u(n,null,d(Vt.value,([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Be,p(e),1),l(`td`,Ve,p(t),1)]))),128))])]),c[16]||=l(`p`,{class:`mb-1 mt-2 text-xs text-muted`},` components (one du, hardlinks counted once — a thread tree shows only what it does not share with the checkout) `,-1),l(`table`,He,[l(`tbody`,null,[(o(!0),u(n,null,d(Ht.value,([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Ue,p(e),1),l(`td`,We,p(t),1)]))),128))])])],64)):(o(),u(`p`,Ge,` not measured yet — the first refresh cycle or attach of this container measures it `))]),l(`section`,Ke,[c[18]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Snapshot stamp`,-1),J.value?(o(),u(`table`,qe,[l(`tbody`,null,[(o(),u(n,null,d([`ref`,`sha`,`lockfileHash`,`createdAt`,`mirrorBackupId`,`checkoutBackupId`],e=>l(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Je,p(e),1),l(`td`,Ye,[f(v)(J.value[e])?(o(),u(`span`,B,p(f(v)(J.value[e])),1)):(o(),u(`span`,Xe,`—`))])])),64))])])):(o(),u(`p`,Ze,`no snapshot recorded`))]),l(`section`,Qe,[c[22]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Thread worktrees`,-1),X.value.length>0?(o(),u(n,{key:0},[l(`p`,$e,p(Z.value)+` live · `+p(X.value.length-Z.value)+` evicted`,1),l(`div`,et,[l(`table`,tt,[l(`tbody`,null,[c[21]||=l(`tr`,{class:`text-xs text-muted`},[l(`td`,{class:`px-2 py-1`},`thread`),l(`td`,{class:`px-2 py-1`},`ref · sha`),l(`td`,{class:`px-2 py-1`},`user · deps`),l(`td`,{class:`px-2 py-1`},`bound · last attach`)],-1),(o(!0),u(n,null,d(X.value,e=>(o(),u(`tr`,{key:e.threadKey,class:`border-t border-muted`},[l(`td`,nt,[e.evicted?(o(),u(`span`,rt,[a(`evicted `+p(e.evictedAt||`—`),1),e.evictedWhy?(o(),u(n,{key:0},[a(` · `+p(e.evictedWhy),1)],64)):ee(``,!0)])):(o(),i(m,{key:1,tone:`green`,label:`live`,tip:`live`})),a(` `+p(e.threadKey),1)]),l(`td`,it,[a(p(e.ref)+` · `,1),e.commitHref?(o(),u(`a`,{key:0,class:`text-primary`,href:e.commitHref},p(e.sha),9,at)):e.sha?(o(),u(`span`,ot,p(e.sha),1)):(o(),u(`span`,st,`—`))]),l(`td`,ct,[e.user?(o(),u(`span`,lt,p(e.user),1)):(o(),u(`span`,ut,`—`)),c[19]||=a(` · `,-1),e.deps?(o(),u(`span`,dt,p(e.deps),1)):(o(),u(`span`,ft,`—`))]),l(`td`,pt,[e.boundAt?(o(),u(`span`,mt,p(e.boundAt),1)):(o(),u(`span`,ht,`—`)),c[20]||=a(` · `,-1),e.lastAttachAt?(o(),u(`span`,gt,p(e.lastAttachAt),1)):(o(),u(`span`,_t,`—`))])]))),128))])])])],64)):(o(),u(`p`,vt,`no thread worktrees`))]),l(`section`,yt,[c[23]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Pending schedules`,-1),l(`table`,bt,[l(`tbody`,null,[(o(),u(n,null,d([[`refresh`,`refresh`],[`provision run`,`provisionRun`],[`provision deadline`,`provisionDeadline`]],([e,t])=>l(`tr`,{key:t,class:`border-t border-muted`},[l(`td`,xt,p(e),1),l(`td`,St,p(f(v)(zt.value[t]??0)||`0`),1)])),64))])])]),l(`section`,Ct,[c[25]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Command table`,-1),Y.value.length>0?(o(),u(`table`,wt,[l(`tbody`,null,[(o(!0),u(n,null,d(Y.value,e=>(o(),u(`tr`,{key:e.name,class:`border-t border-muted`},[l(`td`,Tt,p(e.name),1),l(`td`,Et,[l(`code`,null,p(e.command),1),c[24]||=a(),l(`span`,Dt,p(e.effect),1)])]))),128))])])):(o(),u(`p`,Ot,`no command table`))]),l(`section`,kt,[c[26]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Registry settings`,-1),l(`table`,At,[l(`tbody`,null,[(o(!0),u(n,null,d([[`onboarded`,f(v)(H.value.onboardedAt)],[`record updated`,f(v)(H.value.updatedAt)],[`provisioning timeout (ms)`,f(v)(H.value.provisioningTimeoutMs)],[`disk budget (MB)`,f(v)(H.value.diskBudgetMb)],[`worktree TTL (days)`,f(v)(H.value.worktreeTtlDays??7)]],([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,jt,p(e),1),l(`td`,Mt,[t?(o(),u(`span`,Nt,p(t),1)):(o(),u(`span`,Pt,`—`))])]))),128))])])]),l(`p`,Ft,[c[27]||=a(` Manage from chat: `,-1),l(`code`,It,`repo rebuild `+p(W.value),1),c[28]||=a(` · `,-1),l(`code`,Lt,`repo reconfigure `+p(W.value)+` …`,1),c[29]||=a(` · `,-1),l(`code`,Rt,`repo offboard `+p(W.value)+` --dry-run`,1)])]),_:1},8,[`title`]))}});export{V as default};
1
+ import{t as e}from"./AppShell-IDMGG6yi.js";import{Lr as t,Xt as n,_n as r,cn as i,gn as a,ir as o,ln as ee,on as s,r as c,sn as l,un as u,ur as d,vi as f,wi as p,yn as te}from"./seed-DeKSHrt2.js";import{t as m}from"./StatusDot-ELoXHlFt.js";import{_ as h,a as g,c as ne,g as _,h as re,i as ie,l as ae,o as oe,p as v,s as se,t as ce,u as le}from"./residentsModel-By1fThvk.js";var ue={class:`mt-4 first:mt-0`},de={class:`w-full border-collapse font-mono text-[0.8125rem]`},fe={class:`border-t border-muted`},pe={class:`px-2 py-1 align-top`},me={class:`ml-1.5 font-medium`},y={class:`border-t border-muted`},b={class:`break-all px-2 py-1 align-top`},x={key:0},S={key:1,class:`text-dimmed`},C={class:`border-t border-muted`},w={class:`break-all px-2 py-1 align-top`},T={key:0},E={key:1,class:`text-dimmed`},D={class:`border-t border-muted`},O={class:`break-all px-2 py-1 align-top`},k={key:0},A={key:1,class:`text-dimmed`},j={class:`border-t border-muted`},M={class:`break-all px-2 py-1 align-top`},N={key:0},P={key:1,class:`text-dimmed`},F={class:`border-t border-muted`},I={class:`break-all px-2 py-1 align-top`},L={key:1,class:`text-dimmed`},R={class:`mt-4`},z={class:`w-full border-collapse font-mono text-[0.8125rem]`},he={class:`border-t border-muted`},ge={class:`break-all px-2 py-1 align-top`},_e=[`href`],ve={key:1},ye={class:`border-t border-muted`},be={class:`break-all px-2 py-1 align-top`},xe={class:`border-t border-muted`},Se={class:`break-all px-2 py-1 align-top`},Ce=[`href`],we={key:1},Te={key:2,class:`text-dimmed`},Ee={class:`border-t border-muted`},De={class:`break-all px-2 py-1 align-top`},Oe={key:0},ke={key:1,class:`text-dimmed`},Ae={class:`border-t border-muted`},je={class:`break-all px-2 py-1 align-top`},Me={key:0},Ne={key:1,class:`text-dimmed`},Pe={class:`border-t border-muted`},Fe={class:`break-all px-2 py-1 align-top`},Ie={key:0},Le={key:1,class:`text-dimmed`},Re={class:`mt-4`},ze={class:`w-full border-collapse font-mono text-[0.8125rem]`},Be={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Ve={class:`break-all px-2 py-1 align-top`},He={class:`w-full border-collapse font-mono text-[0.8125rem]`},Ue={class:`w-32 break-all px-2 py-1 align-top text-muted sm:w-96 sm:break-words`},We={class:`px-2 py-1 align-top`},Ge={key:1,class:`text-xs text-muted`},Ke={class:`mt-4`},qe={key:0,class:`w-full border-collapse font-mono text-[0.8125rem]`},Je={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Ye={class:`break-all px-2 py-1 align-top`},B={key:0},Xe={key:1,class:`text-dimmed`},Ze={key:1,class:`text-xs text-muted`},Qe={class:`mt-4`},$e={class:`mb-1 text-xs text-muted`},et={class:`overflow-x-auto`},tt={class:`w-full border-collapse font-mono text-[0.8125rem]`},nt={class:`break-all px-2 py-1 align-top`},rt={key:0,class:`text-xs text-muted`},it={class:`break-all px-2 py-1 align-top`},at=[`href`],ot={key:1},st={key:2,class:`text-dimmed`},ct={class:`break-all px-2 py-1 align-top`},lt={key:0},ut={key:1,class:`text-dimmed`},dt={key:2},ft={key:3,class:`text-dimmed`},pt={class:`break-all px-2 py-1 align-top`},mt={key:0},ht={key:1,class:`text-dimmed`},gt={key:2},_t={key:3,class:`text-dimmed`},vt={key:1,class:`text-xs text-muted`},yt={class:`mt-4`},bt={class:`w-full border-collapse font-mono text-[0.8125rem]`},xt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},St={class:`px-2 py-1 align-top`},Ct={class:`mt-4`},wt={key:0,class:`w-full border-collapse font-mono text-[0.8125rem]`},Tt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Et={class:`break-all px-2 py-1 align-top`},Dt={class:`text-xs text-muted`},Ot={key:1,class:`text-xs text-muted`},kt={class:`mt-4`},At={class:`w-full border-collapse font-mono text-[0.8125rem]`},jt={class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},Mt={class:`break-all px-2 py-1 align-top`},Nt={key:0},Pt={key:1,class:`text-dimmed`},Ft={class:`mt-4 text-xs text-muted`},It={class:`rounded bg-elevated px-1 py-0.5`},Lt={class:`rounded bg-elevated px-1 py-0.5`},Rt={class:`rounded bg-elevated px-1 py-0.5`},V=te({__name:`ResidentDetailPage`,setup(te){let V=c(`resident`),H=s(()=>V?.record??{}),U=s(()=>se(H.value)),W=s(()=>ne(H.value)||(V?.slug??``)),G=s(()=>v(U.value.sha)),K=s(()=>ce.test(W.value)?`https://github.com/${W.value}`:void 0),q=s(()=>K.value&&/^[0-9a-f]{7,40}$/.test(G.value)?`${K.value}/commit/${G.value}`:void 0),J=s(()=>{let e=U.value.snapshot;return e&&typeof e==`object`?g(e):void 0}),zt=s(()=>g(U.value.schedules)),Y=s(()=>{let e=g(H.value.commands),t=g(H.value.effects);return Object.keys(e).sort().map(n=>({name:n,command:v(e[n]),effect:v(t[n])||`readonly`}))}),X=s(()=>le(H.value).map(e=>({...e,threadKey:e.threadKey||`?`,ref:e.ref||`?`,sha:e.sha?e.sha.slice(0,8):``,commitHref:K.value&&/^[0-9a-f]{7,40}$/.test(e.sha)?`${K.value}/commit/${e.sha}`:void 0}))),Z=s(()=>X.value.filter(e=>!e.evicted).length),Q=s(()=>{let e=U.value.lastRestore;return e?JSON.stringify(e):``}),$=s(()=>oe(H.value)),Bt=s(()=>typeof H.value.diskBudgetMb==`number`?H.value.diskBudgetMb:void 0),Vt=s(()=>{let e=$.value;if(!e)return[];let t=ie(e,Bt.value),n=n=>{let r=t.room[n];return r===null?h(e.parts,n)===null?`? (checkout not measured)`:`?`:`${r} more (${_(h(e.parts,n))} each)`};return[[`used / total`,re(e)],[`free`,`${_(t.freeKiB)}${t.capped?` under the ${_(t.capacityKiB)} diskBudgetMb cap`:``}`],[`reserve`,`${_(t.reserve.totalKiB)} (snapshot staging ${_(t.reserve.stagingKiB)} + floor ${_(t.reserve.floorKiB)})`],[`headroom`,`${_(t.headroomKiB)} — room for ${n(`hardlink`)} hardlinked trees, ${n(`reconcile`)} lockfile-diverged (reconciling)`],[`measured`,e.at||`—`]]}),Ht=s(()=>{let e=$.value;if(!e)return[];let t=[[`mirror`,_(e.parts.mirror)],[`checkout deps (node_modules)`,_(e.parts.deps)],[`checkout (history + tree + build)`,_(e.parts.checkout)]];for(let[n,r]of Object.entries(e.parts.threads).sort((e,t)=>t[1]-e[1]))t.push([`thread ${n}`,_(r)]);for(let[n,r]of Object.entries(e.parts.homes).sort((e,t)=>t[1]-e[1]))r>=1024&&t.push([`home ${n}`,_(r)]);return t.push([`other (image, /tmp, …)`,_(e.parts.other)]),t});return(s,c)=>(o(),i(e,{title:W.value||`Resident`,nav:`residents`},{leading:t(()=>[...c[0]||=[l(`a`,{class:`back text-sm text-muted no-underline hover:text-primary`,href:`/residents`},`← All residents`,-1)]]),default:t(()=>[l(`section`,ue,[c[8]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Lifecycle`,-1),l(`table`,de,[l(`tbody`,null,[l(`tr`,fe,[c[1]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`state`,-1),l(`td`,pe,[r(m,{tone:f(ae)(U.value.state),label:U.value.state},null,8,[`tone`,`label`]),l(`span`,me,p(U.value.state),1)])]),l(`tr`,y,[c[2]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`reason`,-1),l(`td`,b,[U.value.reason?(o(),u(`span`,x,p(U.value.reason),1)):(o(),u(`span`,S,`—`))])]),l(`tr`,C,[c[3]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last refresh error`,-1),l(`td`,w,[f(v)(U.value.lastRefreshError)?(o(),u(`span`,T,p(f(v)(U.value.lastRefreshError)),1)):(o(),u(`span`,E,`—`))])]),l(`tr`,D,[c[4]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last restore`,-1),l(`td`,O,[Q.value?(o(),u(`span`,k,p(Q.value),1)):(o(),u(`span`,A,`—`))])]),l(`tr`,j,[c[5]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`state updated`,-1),l(`td`,M,[f(v)(U.value.updatedAt)?(o(),u(`span`,N,p(f(v)(U.value.updatedAt)),1)):(o(),u(`span`,P,`—`))])]),l(`tr`,F,[c[7]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`idle since`,-1),l(`td`,I,[f(v)(U.value.idleSince)?(o(),u(n,{key:0},[a(p(f(v)(U.value.idleSince))+` `,1),c[6]||=l(`span`,{class:`text-xs text-muted`},`(refresh parked; container may sleep)`,-1)],64)):(o(),u(`span`,L,`awake`))])])])])]),l(`section`,R,[c[15]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Pinned facts`,-1),l(`table`,z,[l(`tbody`,null,[l(`tr`,he,[c[9]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`repository`,-1),l(`td`,ge,[K.value?(o(),u(`a`,{key:0,class:`text-primary`,href:K.value},p(K.value),9,_e)):(o(),u(`span`,ve,p(f(v)(H.value.resource)||`—`),1))])]),l(`tr`,ye,[c[10]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`default ref`,-1),l(`td`,be,p(f(v)(U.value.defaultRef)||f(v)(H.value.defaultRef)||`—`),1)]),l(`tr`,xe,[c[11]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`pinned sha`,-1),l(`td`,Se,[q.value?(o(),u(`a`,{key:0,class:`text-primary`,href:q.value},p(G.value),9,Ce)):G.value?(o(),u(`span`,we,p(G.value),1)):(o(),u(`span`,Te,`—`))])]),l(`tr`,Ee,[c[12]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`lockfile hash`,-1),l(`td`,De,[f(v)(U.value.lockfileHash)?(o(),u(`span`,Oe,p(f(v)(U.value.lockfileHash)),1)):(o(),u(`span`,ke,`—`))])]),l(`tr`,Ae,[c[13]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`provisioned`,-1),l(`td`,je,[f(v)(U.value.provisionedAt)?(o(),u(`span`,Me,p(f(v)(U.value.provisionedAt)),1)):(o(),u(`span`,Ne,`—`))])]),l(`tr`,Pe,[c[14]||=l(`td`,{class:`w-32 px-2 py-1 align-top text-muted sm:w-48 sm:whitespace-nowrap`},`last refresh`,-1),l(`td`,Fe,[f(v)(U.value.lastRefreshAt)?(o(),u(`span`,Ie,p(f(v)(U.value.lastRefreshAt)),1)):(o(),u(`span`,Le,`—`))])])])])]),l(`section`,Re,[c[17]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Disk`,-1),$.value?(o(),u(n,{key:0},[l(`table`,ze,[l(`tbody`,null,[(o(!0),u(n,null,d(Vt.value,([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Be,p(e),1),l(`td`,Ve,p(t),1)]))),128))])]),c[16]||=l(`p`,{class:`mb-1 mt-2 text-xs text-muted`},` components (one du, hardlinks counted once — a thread tree shows only what it does not share with the checkout) `,-1),l(`table`,He,[l(`tbody`,null,[(o(!0),u(n,null,d(Ht.value,([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Ue,p(e),1),l(`td`,We,p(t),1)]))),128))])])],64)):(o(),u(`p`,Ge,` not measured yet — the first refresh cycle or attach of this container measures it `))]),l(`section`,Ke,[c[18]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Snapshot stamp`,-1),J.value?(o(),u(`table`,qe,[l(`tbody`,null,[(o(),u(n,null,d([`ref`,`sha`,`lockfileHash`,`createdAt`,`mirrorBackupId`,`checkoutBackupId`],e=>l(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,Je,p(e),1),l(`td`,Ye,[f(v)(J.value[e])?(o(),u(`span`,B,p(f(v)(J.value[e])),1)):(o(),u(`span`,Xe,`—`))])])),64))])])):(o(),u(`p`,Ze,`no snapshot recorded`))]),l(`section`,Qe,[c[22]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Thread worktrees`,-1),X.value.length>0?(o(),u(n,{key:0},[l(`p`,$e,p(Z.value)+` live · `+p(X.value.length-Z.value)+` evicted`,1),l(`div`,et,[l(`table`,tt,[l(`tbody`,null,[c[21]||=l(`tr`,{class:`text-xs text-muted`},[l(`td`,{class:`px-2 py-1`},`thread`),l(`td`,{class:`px-2 py-1`},`ref · sha`),l(`td`,{class:`px-2 py-1`},`user · deps`),l(`td`,{class:`px-2 py-1`},`bound · last attach`)],-1),(o(!0),u(n,null,d(X.value,e=>(o(),u(`tr`,{key:e.threadKey,class:`border-t border-muted`},[l(`td`,nt,[e.evicted?(o(),u(`span`,rt,[a(`evicted `+p(e.evictedAt||`—`),1),e.evictedWhy?(o(),u(n,{key:0},[a(` · `+p(e.evictedWhy),1)],64)):ee(``,!0)])):(o(),i(m,{key:1,tone:`green`,label:`live`,tip:`live`})),a(` `+p(e.threadKey),1)]),l(`td`,it,[a(p(e.ref)+` · `,1),e.commitHref?(o(),u(`a`,{key:0,class:`text-primary`,href:e.commitHref},p(e.sha),9,at)):e.sha?(o(),u(`span`,ot,p(e.sha),1)):(o(),u(`span`,st,`—`))]),l(`td`,ct,[e.user?(o(),u(`span`,lt,p(e.user),1)):(o(),u(`span`,ut,`—`)),c[19]||=a(` · `,-1),e.deps?(o(),u(`span`,dt,p(e.deps),1)):(o(),u(`span`,ft,`—`))]),l(`td`,pt,[e.boundAt?(o(),u(`span`,mt,p(e.boundAt),1)):(o(),u(`span`,ht,`—`)),c[20]||=a(` · `,-1),e.lastAttachAt?(o(),u(`span`,gt,p(e.lastAttachAt),1)):(o(),u(`span`,_t,`—`))])]))),128))])])])],64)):(o(),u(`p`,vt,`no thread worktrees`))]),l(`section`,yt,[c[23]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Pending schedules`,-1),l(`table`,bt,[l(`tbody`,null,[(o(),u(n,null,d([[`refresh`,`refresh`],[`provision run`,`provisionRun`],[`provision deadline`,`provisionDeadline`]],([e,t])=>l(`tr`,{key:t,class:`border-t border-muted`},[l(`td`,xt,p(e),1),l(`td`,St,p(f(v)(zt.value[t]??0)||`0`),1)])),64))])])]),l(`section`,Ct,[c[25]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Command table`,-1),Y.value.length>0?(o(),u(`table`,wt,[l(`tbody`,null,[(o(!0),u(n,null,d(Y.value,e=>(o(),u(`tr`,{key:e.name,class:`border-t border-muted`},[l(`td`,Tt,p(e.name),1),l(`td`,Et,[l(`code`,null,p(e.command),1),c[24]||=a(),l(`span`,Dt,p(e.effect),1)])]))),128))])])):(o(),u(`p`,Ot,`no command table`))]),l(`section`,kt,[c[26]||=l(`h2`,{class:`mb-1.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},`Registry settings`,-1),l(`table`,At,[l(`tbody`,null,[(o(!0),u(n,null,d([[`onboarded`,f(v)(H.value.onboardedAt)],[`record updated`,f(v)(H.value.updatedAt)],[`provisioning timeout (ms)`,f(v)(H.value.provisioningTimeoutMs)],[`disk budget (MB)`,f(v)(H.value.diskBudgetMb)],[`worktree TTL (days)`,f(v)(H.value.worktreeTtlDays??7)]],([e,t])=>(o(),u(`tr`,{key:e,class:`border-t border-muted`},[l(`td`,jt,p(e),1),l(`td`,Mt,[t?(o(),u(`span`,Nt,p(t),1)):(o(),u(`span`,Pt,`—`))])]))),128))])])]),l(`p`,Ft,[c[27]||=a(` Manage from chat: `,-1),l(`code`,It,`repo rebuild `+p(W.value),1),c[28]||=a(` · `,-1),l(`code`,Lt,`repo reconfigure `+p(W.value)+` …`,1),c[29]||=a(` · `,-1),l(`code`,Rt,`repo offboard `+p(W.value)+` --dry-run`,1)])]),_:1},8,[`title`]))}});export{V as default};
@@ -1 +1 @@
1
- import{n as e,t}from"./AppShell-DEy5jRuS.js";import{Lr as n,Mr as r,Qn as i,Wt as ee,Xt as a,_n as o,ci as s,cn as c,gn as l,ir as u,ln as d,nr as f,oi as p,on as m,r as h,sn as g,un as _,ur as v,vi as y,wi as b,xi as x,yn as S}from"./seed-DeKSHrt2.js";import{t as C}from"./Tooltip-DKhSRH9t.js";import{t as w}from"./eventSource-tRprhqm7.js";import{t as T}from"./wallClock-61NpVkY6.js";import{t as E}from"./favicon-D1hkyC5j.js";import{n as D,r as O}from"./indexFormat-B-pd4r7Y.js";import{S as k,c as A,h as j,i as M,m as N,p as P,r as te,s as ne,t as re,y as ie}from"./indexRow-BD1VT8o8.js";import{t as F}from"./StatusDot-DPWE1JmO.js";import{c as I,d as L,f as R,g as z,h as ae,i as oe,l as se,m as B,n as V,o as ce,p as H,r as le,s as ue,t as U,u as de}from"./residentsModel-By1fThvk.js";var fe=[`data-slug`,`data-running`],pe=[`open`],me={class:`row flex cursor-pointer list-none flex-wrap items-baseline gap-x-2.5 gap-y-1 rounded-md px-2 py-2 hover:bg-elevated [&::-webkit-details-marker]:hidden`},he={class:`self-center`},ge={class:`font-mono text-[0.9375rem] font-medium text-highlighted`},_e={class:`text-sm text-toned`},ve={key:0,class:`running shrink-0 rounded border border-ok/25 bg-ok/8 px-1.5 font-mono text-[0.68rem] font-medium tabular-nums text-ok`},ye=[`title`],be=[`href`],xe={key:2,class:`basis-full pl-[1.9rem] text-xs text-warn`},Se={class:`fold pb-3 pl-[1.9rem] pr-2 pt-0.5`},Ce={key:0,class:`m-0 list-none divide-y divide-(--ui-border-muted) p-0`},we=[`data-run-id`,`data-thread`],Te={class:`pt-[0.3rem]`},Ee={class:`what min-w-0`},De={class:`flex min-w-0 items-baseline gap-2`},Oe=[`title`],ke={key:0,class:`who block truncate text-xs text-dimmed`},Ae=[`href`],je={key:1,class:`who block text-xs text-dimmed`},Me={class:`min-w-0 font-mono text-xs max-sm:col-span-2 max-sm:col-start-2 max-sm:row-start-2`},Ne=[`title`],Pe=[`href`],Fe={key:1},Ie={key:1,class:`font-sans text-dimmed`},Le={key:0,class:`facts-tree block truncate text-dimmed`},Re={class:`user`},ze={class:`deps`},Be=[`title`],Ve={class:`flex items-baseline gap-3 justify-self-end max-sm:col-start-3 max-sm:row-start-1`},He=[`title`],Ue=[`href`,`aria-label`],W={key:1,class:`py-1 text-xs text-dimmed`},We=[`data-idle`],Ge={key:1},G=S({__name:`ResidentRow`,props:{record:{},runs:{},now:{},open:{type:Boolean}},setup(e){let t=e,n=s(t.open===!0);r(()=>t.open,e=>{e&&(n.value=!0)});function i(e){n.value=e.target.open}let f=m(()=>I(t.record)),p=m(()=>f.value||H(t.record.resource)||`?`),h=m(()=>ue(t.record)),S=m(()=>se(h.value.state)),C=m(()=>U.test(f.value)?`/residents/${f.value}`:null),w=m(()=>U.test(f.value)?`https://github.com/${f.value}`:void 0),T=e=>w.value&&/^[0-9a-f]{7,40}$/.test(e)?`${w.value}/commit/${e}`:void 0,E=m(()=>H(t.record.defaultRef)||`?`),L=m(()=>H(h.value.sha).slice(0,8)),R=m(()=>H(h.value.lastRefreshAt)),V=e=>{let n=e?Date.parse(e):NaN;return Number.isFinite(n)?D(n,t.now):e||`—`},G=m(()=>R.value?V(R.value):``),K=m(()=>ce(t.record)),q=m(()=>K.value?ae(K.value):``),J=m(()=>{let e=K.value;if(!e)return null;let n=typeof t.record.diskBudgetMb==`number`?t.record.diskBudgetMb:void 0;return oe(e,n)}),Y=m(()=>[`ref ${E.value}`,L.value,G.value?`refreshed ${G.value}`:``,q.value?`disk ${q.value}`:``].filter(Boolean).join(` · `)),X=m(()=>[R.value?`refreshed ${R.value}`:``,K.value?.at?`disk measured ${K.value.at}`:``].filter(Boolean).join(` · `)),Z=m(()=>{let e=K.value,t=J.value;if(!e||!t)return``;let n=t.room.hardlink===null?`room not projected (checkout not measured)`:`room for ${t.room.hardlink} more ${t.room.hardlink===1?`tree`:`trees`}`;return[`${z(t.freeKiB)} free${t.capped?` under the ${z(t.capacityKiB)} cap`:``}`,n,`measured ${V(e.at)}`].join(` · `)}),Q=m(()=>de(t.record)),$=m(()=>{let e=t.runs.map(e=>{let n=O(e.label||j(e.id)),r=le(Q.value,e.threadKey),i=k(e);return{key:`run:${e.id}`,run:e,agent:n.agent,text:n.snippet??n.scope,who:i.identity,surface:te[i.kind]??i.kind,threadUrl:N(e),href:P(e),elapsed:A(e,t.now),binding:r,treeKiB:r?B(K.value,r.threadKey):null}}),n=new Set(t.runs.map(e=>e.threadKey));for(let t of Q.value)t.evicted||n.has(t.threadKey)||e.push({key:`idle:${t.threadKey}`,text:`idle`,who:``,surface:``,threadUrl:``,href:``,elapsed:``,binding:t,treeKiB:B(K.value,t.threadKey)});return e}),Ke=m(()=>$.value.filter(e=>!e.run).length);return(t,r)=>(u(),_(`li`,{class:`resident border-b border-muted first:border-t`,"data-slug":f.value,"data-running":e.runs.length},[g(`details`,{class:`group/fold`,open:n.value,onToggle:i},[g(`summary`,me,[r[1]||=g(`span`,{class:`chev w-3 select-none self-center text-xs text-dimmed transition-transform group-open/fold:rotate-90 motion-reduce:transition-none`,"aria-hidden":`true`},`❯`,-1),g(`span`,he,[o(F,{tone:S.value,label:h.value.state,tip:h.value.state},null,8,[`tone`,`label`,`tip`])]),g(`span`,ge,b(p.value),1),g(`span`,_e,b(h.value.state),1),e.runs.length>0?(u(),_(`span`,ve,b(e.runs.length)+` running`,1)):d(``,!0),g(`span`,{class:`facts font-mono text-xs text-muted max-sm:basis-full max-sm:pl-[1.9rem] sm:ml-2`,title:X.value||void 0},b(Y.value),9,ye),C.value?(u(),_(`a`,{key:1,class:`detail ml-auto shrink-0 text-xs text-muted no-underline hover:text-highlighted hover:underline`,href:C.value,onClick:r[0]||=ee(()=>{},[`stop`])},`detail ↗`,8,be)):d(``,!0),h.value.reason?(u(),_(`span`,xe,b(h.value.reason),1)):d(``,!0)]),g(`div`,Se,[$.value.length>0?(u(),_(`ul`,Ce,[(u(!0),_(a,null,v($.value,t=>(u(),_(`li`,{key:t.key,class:x([`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1 py-2 sm:grid-cols-[auto_minmax(0,1fr)_minmax(14rem,22rem)_auto]`,t.run?`run`:`idle`]),"data-run-id":t.run?.id,"data-thread":t.run?void 0:t.binding?.threadKey},[g(`span`,Te,[t.run?(u(),c(F,{key:0,tone:`green`,label:y(ie)(t.run),tip:y(ne)(t.run),pulse:``},null,8,[`label`,`tip`])):(u(),c(F,{key:1,tone:`grey`,label:`idle`,tip:`no run is using this tree`}))]),g(`span`,Ee,[g(`span`,De,[t.agent?(u(),_(`span`,{key:0,class:x([`agent shrink-0 rounded border px-1.5 font-mono text-[0.65rem] font-medium uppercase tracking-wider`,y(re)[y(M)(t.agent)]])},b(t.agent),3)):d(``,!0),g(`span`,{class:x([`text min-w-0 truncate text-[0.8125rem]`,t.run?`text-highlighted`:`text-dimmed`]),title:t.run?t.text:void 0},b(t.text),11,Oe)]),t.run?(u(),_(`span`,ke,[t.who?(u(),_(a,{key:0},[l(`by `+b(t.who),1)],64)):d(``,!0),t.who&&(t.threadUrl||t.surface)?(u(),_(a,{key:1},[l(b(` · `))],64)):d(``,!0),t.threadUrl?(u(),_(`a`,{key:2,class:`text-muted no-underline hover:text-highlighted hover:underline`,href:t.threadUrl,target:`_blank`,rel:`noopener noreferrer`},b(t.surface)+` thread ↗`,9,Ae)):t.surface?(u(),_(a,{key:3},[l(`via `+b(t.surface),1)],64)):d(``,!0)])):t.binding?(u(),_(`span`,je,`last used `+b(V(t.binding.lastAttachAt)),1)):d(``,!0)]),g(`span`,Me,[g(`span`,{class:`tree block truncate text-toned`,title:t.binding&&t.binding.ref||void 0},[t.binding?(u(),_(a,{key:0},[l(b(t.binding.ref||`?`),1),t.binding.sha?(u(),_(a,{key:0},[r[2]||=l(b(` `),-1),r[3]||=g(`span`,{class:`text-dimmed`},`@`,-1),r[4]||=l(b(` `)+` `,-1),T(t.binding.sha)?(u(),_(`a`,{key:0,class:`text-highlighted no-underline hover:underline`,href:T(t.binding.sha)},b(t.binding.sha.slice(0,8)),9,Pe)):(u(),_(`span`,Fe,b(t.binding.sha.slice(0,8)),1))],64)):d(``,!0)],64)):(u(),_(`span`,Ie,`no worktree bound yet`))],8,Ne),t.binding?(u(),_(`span`,Le,[g(`span`,Re,b(t.binding.user||`—`),1),r[5]||=l(` `+b(` · `),-1),g(`span`,ze,b(t.binding.deps||`—`),1),r[6]||=l(` `+b(` · `),-1),g(`span`,{class:x([`size`,t.treeKiB===null?``:`text-muted`]),title:t.treeKiB===null?`size not measured yet`:`on disk`},b(t.treeKiB===null?`—`:y(z)(t.treeKiB)),11,Be)])):d(``,!0)]),g(`span`,Ve,[t.run?(u(),_(`span`,{key:0,class:`elapsed whitespace-nowrap font-mono text-xs tabular-nums text-ok`,title:`running for · started ${y(D)(t.run.startedAt,e.now)}`},b(t.elapsed),9,He)):d(``,!0),t.run?(u(),_(`a`,{key:1,class:`open text-xs text-muted no-underline hover:text-highlighted hover:underline`,href:t.href,"aria-label":`open run ${t.run.label||y(j)(t.run.id)}`},`open ↗`,8,Ue)):d(``,!0)])],10,we))),128))])):(u(),_(`p`,W,`nothing on this resident — no run, no worktree`)),g(`p`,{class:`disk mt-2 font-mono text-xs text-dimmed`,"data-idle":Ke.value},[Z.value?(u(),_(a,{key:0},[l(b(Z.value),1)],64)):(u(),_(`span`,Ge,`disk not measured yet`))],8,We)])],40,pe)],8,fe))}}),K={class:`conn flex items-center gap-1.5`},q={id:`state`,class:`text-xs text-muted`},J={class:`mb-2 text-xs text-muted`},Y={id:`running`,class:`font-mono tabular-nums`},X={id:`residents`,class:`m-0 list-none p-0`},Z={key:1,class:`px-2 py-1.5 text-muted`},Q=`Resident repos`,$=S({__name:`ResidentsIndexPage`,setup(ee){let d=h(`residents`),x=p({cap:d?.cap,count:d?.count,residents:d?.residents??[],runs:new Map((d?.runs??[]).map(e=>[e.id,e]))}),S=T(d?.now),D=s({tone:`amber`,text:`connecting…`}),O=typeof window<`u`?new URLSearchParams(window.location.search).get(`open`):null,k=m(()=>x.residents.map((e,t)=>{let n=e,r=I(n);return{key:`${r||`?`}-${t}`,record:n,slug:r,runs:R(x.runs.values(),r)}})),A=m(()=>H(x.cap)||`?`),j=m(()=>H(x.count)||String(k.value.length)),M=m(()=>k.value.reduce((e,t)=>e+t.runs.length,0));r([M,()=>x.residents],([t,n])=>{e.setTitle((t>0?`(${t}) `:``)+Q),e.setFavicon(E[L(n)])},{immediate:!0});let N=w(),P=null;return i(()=>{P=N(`/residents?stream=1`);let t=!1;P.onopen=()=>{if(t){e.reload();return}t=!0,D.value={tone:`green`,text:`live`}},P.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}V(x,t)},P.onerror=()=>{P&&P.readyState===2?D.value={tone:`red`,text:`disconnected`}:D.value={tone:`amber`,text:`connecting…`}}}),f(()=>{P?.close()}),(e,r)=>{let i=C;return u(),c(t,{title:Q,nav:`residents`},{status:n(()=>[o(i,{text:`runs arrive from the registry feed; the listing is re-read when a run attaches or ends`},{default:n(()=>[g(`span`,K,[o(F,{tone:D.value.tone,label:D.value.text},null,8,[`tone`,`label`]),g(`span`,q,b(D.value.text),1)])]),_:1})]),default:n(()=>[k.value.length>0?(u(),_(a,{key:0},[g(`p`,J,[l(b(`${j.value}/${A.value} resident slots in use · `),1),g(`span`,Y,b(M.value)+` running`,1)]),g(`ul`,X,[(u(!0),_(a,null,v(k.value,e=>(u(),c(G,{key:e.key,record:e.record,runs:e.runs,now:y(S),open:y(O)!==null&&y(O)===e.slug},null,8,[`record`,`runs`,`now`,`open`]))),128))])],64)):(u(),_(`p`,Z,[l(` No repos onboarded (0/`+b(A.value)+`). Onboard one from chat: `,1),r[0]||=g(`code`,{class:`rounded bg-elevated px-1.5 py-0.5`},`repo onboard <owner/name>`,-1),r[1]||=l(`. `,-1)]))]),_:1})}}});export{$ as default};
1
+ import{n as e,t}from"./AppShell-IDMGG6yi.js";import{Lr as n,Mr as r,Qn as i,Wt as ee,Xt as a,_n as o,ci as s,cn as c,gn as l,ir as u,ln as d,nr as f,oi as p,on as m,r as h,sn as g,un as _,ur as v,vi as y,wi as b,xi as x,yn as S}from"./seed-DeKSHrt2.js";import{t as C}from"./Tooltip-BoeFwYP2.js";import{t as w}from"./eventSource-tRprhqm7.js";import{t as T}from"./wallClock-61NpVkY6.js";import{t as E}from"./favicon-D1hkyC5j.js";import{n as D,r as O}from"./indexFormat-B-pd4r7Y.js";import{S as k,c as A,h as j,i as M,m as N,p as P,r as te,s as ne,t as re,y as ie}from"./indexRow-BD1VT8o8.js";import{t as F}from"./StatusDot-ELoXHlFt.js";import{c as I,d as L,f as R,g as z,h as ae,i as oe,l as se,m as B,n as V,o as ce,p as H,r as le,s as ue,t as U,u as de}from"./residentsModel-By1fThvk.js";var fe=[`data-slug`,`data-running`],pe=[`open`],me={class:`row flex cursor-pointer list-none flex-wrap items-baseline gap-x-2.5 gap-y-1 rounded-md px-2 py-2 hover:bg-elevated [&::-webkit-details-marker]:hidden`},he={class:`self-center`},ge={class:`font-mono text-[0.9375rem] font-medium text-highlighted`},_e={class:`text-sm text-toned`},ve={key:0,class:`running shrink-0 rounded border border-ok/25 bg-ok/8 px-1.5 font-mono text-[0.68rem] font-medium tabular-nums text-ok`},ye=[`title`],be=[`href`],xe={key:2,class:`basis-full pl-[1.9rem] text-xs text-warn`},Se={class:`fold pb-3 pl-[1.9rem] pr-2 pt-0.5`},Ce={key:0,class:`m-0 list-none divide-y divide-(--ui-border-muted) p-0`},we=[`data-run-id`,`data-thread`],Te={class:`pt-[0.3rem]`},Ee={class:`what min-w-0`},De={class:`flex min-w-0 items-baseline gap-2`},Oe=[`title`],ke={key:0,class:`who block truncate text-xs text-dimmed`},Ae=[`href`],je={key:1,class:`who block text-xs text-dimmed`},Me={class:`min-w-0 font-mono text-xs max-sm:col-span-2 max-sm:col-start-2 max-sm:row-start-2`},Ne=[`title`],Pe=[`href`],Fe={key:1},Ie={key:1,class:`font-sans text-dimmed`},Le={key:0,class:`facts-tree block truncate text-dimmed`},Re={class:`user`},ze={class:`deps`},Be=[`title`],Ve={class:`flex items-baseline gap-3 justify-self-end max-sm:col-start-3 max-sm:row-start-1`},He=[`title`],Ue=[`href`,`aria-label`],W={key:1,class:`py-1 text-xs text-dimmed`},We=[`data-idle`],Ge={key:1},G=S({__name:`ResidentRow`,props:{record:{},runs:{},now:{},open:{type:Boolean}},setup(e){let t=e,n=s(t.open===!0);r(()=>t.open,e=>{e&&(n.value=!0)});function i(e){n.value=e.target.open}let f=m(()=>I(t.record)),p=m(()=>f.value||H(t.record.resource)||`?`),h=m(()=>ue(t.record)),S=m(()=>se(h.value.state)),C=m(()=>U.test(f.value)?`/residents/${f.value}`:null),w=m(()=>U.test(f.value)?`https://github.com/${f.value}`:void 0),T=e=>w.value&&/^[0-9a-f]{7,40}$/.test(e)?`${w.value}/commit/${e}`:void 0,E=m(()=>H(t.record.defaultRef)||`?`),L=m(()=>H(h.value.sha).slice(0,8)),R=m(()=>H(h.value.lastRefreshAt)),V=e=>{let n=e?Date.parse(e):NaN;return Number.isFinite(n)?D(n,t.now):e||`—`},G=m(()=>R.value?V(R.value):``),K=m(()=>ce(t.record)),q=m(()=>K.value?ae(K.value):``),J=m(()=>{let e=K.value;if(!e)return null;let n=typeof t.record.diskBudgetMb==`number`?t.record.diskBudgetMb:void 0;return oe(e,n)}),Y=m(()=>[`ref ${E.value}`,L.value,G.value?`refreshed ${G.value}`:``,q.value?`disk ${q.value}`:``].filter(Boolean).join(` · `)),X=m(()=>[R.value?`refreshed ${R.value}`:``,K.value?.at?`disk measured ${K.value.at}`:``].filter(Boolean).join(` · `)),Z=m(()=>{let e=K.value,t=J.value;if(!e||!t)return``;let n=t.room.hardlink===null?`room not projected (checkout not measured)`:`room for ${t.room.hardlink} more ${t.room.hardlink===1?`tree`:`trees`}`;return[`${z(t.freeKiB)} free${t.capped?` under the ${z(t.capacityKiB)} cap`:``}`,n,`measured ${V(e.at)}`].join(` · `)}),Q=m(()=>de(t.record)),$=m(()=>{let e=t.runs.map(e=>{let n=O(e.label||j(e.id)),r=le(Q.value,e.threadKey),i=k(e);return{key:`run:${e.id}`,run:e,agent:n.agent,text:n.snippet??n.scope,who:i.identity,surface:te[i.kind]??i.kind,threadUrl:N(e),href:P(e),elapsed:A(e,t.now),binding:r,treeKiB:r?B(K.value,r.threadKey):null}}),n=new Set(t.runs.map(e=>e.threadKey));for(let t of Q.value)t.evicted||n.has(t.threadKey)||e.push({key:`idle:${t.threadKey}`,text:`idle`,who:``,surface:``,threadUrl:``,href:``,elapsed:``,binding:t,treeKiB:B(K.value,t.threadKey)});return e}),Ke=m(()=>$.value.filter(e=>!e.run).length);return(t,r)=>(u(),_(`li`,{class:`resident border-b border-muted first:border-t`,"data-slug":f.value,"data-running":e.runs.length},[g(`details`,{class:`group/fold`,open:n.value,onToggle:i},[g(`summary`,me,[r[1]||=g(`span`,{class:`chev w-3 select-none self-center text-xs text-dimmed transition-transform group-open/fold:rotate-90 motion-reduce:transition-none`,"aria-hidden":`true`},`❯`,-1),g(`span`,he,[o(F,{tone:S.value,label:h.value.state,tip:h.value.state},null,8,[`tone`,`label`,`tip`])]),g(`span`,ge,b(p.value),1),g(`span`,_e,b(h.value.state),1),e.runs.length>0?(u(),_(`span`,ve,b(e.runs.length)+` running`,1)):d(``,!0),g(`span`,{class:`facts font-mono text-xs text-muted max-sm:basis-full max-sm:pl-[1.9rem] sm:ml-2`,title:X.value||void 0},b(Y.value),9,ye),C.value?(u(),_(`a`,{key:1,class:`detail ml-auto shrink-0 text-xs text-muted no-underline hover:text-highlighted hover:underline`,href:C.value,onClick:r[0]||=ee(()=>{},[`stop`])},`detail ↗`,8,be)):d(``,!0),h.value.reason?(u(),_(`span`,xe,b(h.value.reason),1)):d(``,!0)]),g(`div`,Se,[$.value.length>0?(u(),_(`ul`,Ce,[(u(!0),_(a,null,v($.value,t=>(u(),_(`li`,{key:t.key,class:x([`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1 py-2 sm:grid-cols-[auto_minmax(0,1fr)_minmax(14rem,22rem)_auto]`,t.run?`run`:`idle`]),"data-run-id":t.run?.id,"data-thread":t.run?void 0:t.binding?.threadKey},[g(`span`,Te,[t.run?(u(),c(F,{key:0,tone:`green`,label:y(ie)(t.run),tip:y(ne)(t.run),pulse:``},null,8,[`label`,`tip`])):(u(),c(F,{key:1,tone:`grey`,label:`idle`,tip:`no run is using this tree`}))]),g(`span`,Ee,[g(`span`,De,[t.agent?(u(),_(`span`,{key:0,class:x([`agent shrink-0 rounded border px-1.5 font-mono text-[0.65rem] font-medium uppercase tracking-wider`,y(re)[y(M)(t.agent)]])},b(t.agent),3)):d(``,!0),g(`span`,{class:x([`text min-w-0 truncate text-[0.8125rem]`,t.run?`text-highlighted`:`text-dimmed`]),title:t.run?t.text:void 0},b(t.text),11,Oe)]),t.run?(u(),_(`span`,ke,[t.who?(u(),_(a,{key:0},[l(`by `+b(t.who),1)],64)):d(``,!0),t.who&&(t.threadUrl||t.surface)?(u(),_(a,{key:1},[l(b(` · `))],64)):d(``,!0),t.threadUrl?(u(),_(`a`,{key:2,class:`text-muted no-underline hover:text-highlighted hover:underline`,href:t.threadUrl,target:`_blank`,rel:`noopener noreferrer`},b(t.surface)+` thread ↗`,9,Ae)):t.surface?(u(),_(a,{key:3},[l(`via `+b(t.surface),1)],64)):d(``,!0)])):t.binding?(u(),_(`span`,je,`last used `+b(V(t.binding.lastAttachAt)),1)):d(``,!0)]),g(`span`,Me,[g(`span`,{class:`tree block truncate text-toned`,title:t.binding&&t.binding.ref||void 0},[t.binding?(u(),_(a,{key:0},[l(b(t.binding.ref||`?`),1),t.binding.sha?(u(),_(a,{key:0},[r[2]||=l(b(` `),-1),r[3]||=g(`span`,{class:`text-dimmed`},`@`,-1),r[4]||=l(b(` `)+` `,-1),T(t.binding.sha)?(u(),_(`a`,{key:0,class:`text-highlighted no-underline hover:underline`,href:T(t.binding.sha)},b(t.binding.sha.slice(0,8)),9,Pe)):(u(),_(`span`,Fe,b(t.binding.sha.slice(0,8)),1))],64)):d(``,!0)],64)):(u(),_(`span`,Ie,`no worktree bound yet`))],8,Ne),t.binding?(u(),_(`span`,Le,[g(`span`,Re,b(t.binding.user||`—`),1),r[5]||=l(` `+b(` · `),-1),g(`span`,ze,b(t.binding.deps||`—`),1),r[6]||=l(` `+b(` · `),-1),g(`span`,{class:x([`size`,t.treeKiB===null?``:`text-muted`]),title:t.treeKiB===null?`size not measured yet`:`on disk`},b(t.treeKiB===null?`—`:y(z)(t.treeKiB)),11,Be)])):d(``,!0)]),g(`span`,Ve,[t.run?(u(),_(`span`,{key:0,class:`elapsed whitespace-nowrap font-mono text-xs tabular-nums text-ok`,title:`running for · started ${y(D)(t.run.startedAt,e.now)}`},b(t.elapsed),9,He)):d(``,!0),t.run?(u(),_(`a`,{key:1,class:`open text-xs text-muted no-underline hover:text-highlighted hover:underline`,href:t.href,"aria-label":`open run ${t.run.label||y(j)(t.run.id)}`},`open ↗`,8,Ue)):d(``,!0)])],10,we))),128))])):(u(),_(`p`,W,`nothing on this resident — no run, no worktree`)),g(`p`,{class:`disk mt-2 font-mono text-xs text-dimmed`,"data-idle":Ke.value},[Z.value?(u(),_(a,{key:0},[l(b(Z.value),1)],64)):(u(),_(`span`,Ge,`disk not measured yet`))],8,We)])],40,pe)],8,fe))}}),K={class:`conn flex items-center gap-1.5`},q={id:`state`,class:`text-xs text-muted`},J={class:`mb-2 text-xs text-muted`},Y={id:`running`,class:`font-mono tabular-nums`},X={id:`residents`,class:`m-0 list-none p-0`},Z={key:1,class:`px-2 py-1.5 text-muted`},Q=`Resident repos`,$=S({__name:`ResidentsIndexPage`,setup(ee){let d=h(`residents`),x=p({cap:d?.cap,count:d?.count,residents:d?.residents??[],runs:new Map((d?.runs??[]).map(e=>[e.id,e]))}),S=T(d?.now),D=s({tone:`amber`,text:`connecting…`}),O=typeof window<`u`?new URLSearchParams(window.location.search).get(`open`):null,k=m(()=>x.residents.map((e,t)=>{let n=e,r=I(n);return{key:`${r||`?`}-${t}`,record:n,slug:r,runs:R(x.runs.values(),r)}})),A=m(()=>H(x.cap)||`?`),j=m(()=>H(x.count)||String(k.value.length)),M=m(()=>k.value.reduce((e,t)=>e+t.runs.length,0));r([M,()=>x.residents],([t,n])=>{e.setTitle((t>0?`(${t}) `:``)+Q),e.setFavicon(E[L(n)])},{immediate:!0});let N=w(),P=null;return i(()=>{P=N(`/residents?stream=1`);let t=!1;P.onopen=()=>{if(t){e.reload();return}t=!0,D.value={tone:`green`,text:`live`}},P.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}V(x,t)},P.onerror=()=>{P&&P.readyState===2?D.value={tone:`red`,text:`disconnected`}:D.value={tone:`amber`,text:`connecting…`}}}),f(()=>{P?.close()}),(e,r)=>{let i=C;return u(),c(t,{title:Q,nav:`residents`},{status:n(()=>[o(i,{text:`runs arrive from the registry feed; the listing is re-read when a run attaches or ends`},{default:n(()=>[g(`span`,K,[o(F,{tone:D.value.tone,label:D.value.text},null,8,[`tone`,`label`]),g(`span`,q,b(D.value.text),1)])]),_:1})]),default:n(()=>[k.value.length>0?(u(),_(a,{key:0},[g(`p`,J,[l(b(`${j.value}/${A.value} resident slots in use · `),1),g(`span`,Y,b(M.value)+` running`,1)]),g(`ul`,X,[(u(!0),_(a,null,v(k.value,e=>(u(),c(G,{key:e.key,record:e.record,runs:e.runs,now:y(S),open:y(O)!==null&&y(O)===e.slug},null,8,[`record`,`runs`,`now`,`open`]))),128))])],64)):(u(),_(`p`,Z,[l(` No repos onboarded (0/`+b(A.value)+`). Onboard one from chat: `,1),r[0]||=g(`code`,{class:`rounded bg-elevated px-1.5 py-0.5`},`repo onboard <owner/name>`,-1),r[1]||=l(`. `,-1)]))]),_:1})}}});export{$ as default};
@@ -0,0 +1 @@
1
+ import{n as e}from"./AppShell-IDMGG6yi.js";import{Ci as t,Gn as n,Mr as r,Qn as i,Wt as a,Xt as o,_n as s,ci as c,cn as l,gn as u,ir as d,ln as f,on as p,sn as m,un as h,ur as g,vi as _,wi as v,xi as y,yn as b}from"./seed-DeKSHrt2.js";import{r as x,t as S}from"./indexFormat-B-pd4r7Y.js";import{C,E as w,T,_ as E,a as D,c as O,h as k,i as A,p as ee,s as j,t as M,v as te,y as N}from"./indexRow-BD1VT8o8.js";import{D as P,T as F,c as ne,l as re,n as ie,t as ae,w as I}from"./sseReplay-g7ml86LM.js";import{a as oe,n as se,t as ce}from"./durationTone-BobbycC-.js";import{t as L}from"./StatusDot-ELoXHlFt.js";var le={},ue={viewBox:`0 0 16 16`,class:`inline-block size-[1em] shrink-0`,"aria-hidden":`true`};function de(e,t){return d(),h(`svg`,ue,[...t[0]||=[m(`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 fe=oe(le,[[`render`,de]]),R={"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`},z={getting_ready:`getting ready`,finishing_up:`finishing up`};function B(e){return R[z[e]]}var V={id:`timeline`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,"data-testid":`timeline`},pe={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},me={class:`ml-auto flex items-baseline gap-3 font-normal normal-case tracking-normal`},he=[`href`],ge={class:`lede font-mono text-sm text-toned`},_e={class:`shape tabular-nums`},ve={key:0,class:`current text-muted`},ye={key:0,class:`note mt-0.5 text-xs text-muted`},be=[`aria-label`],xe=[`title`,`data-term`],Se={class:`legend mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs`},Ce=[`title`,`data-term`],we={class:`term text-muted`},Te={class:`ms tabular-nums text-toned`},Ee=[`title`],De={class:`ranked mt-1 flex flex-col gap-1 font-mono text-xs`},Oe={class:`ms w-14 shrink-0 tabular-nums text-toned`},ke=[`href`,`data-anchor`,`onClick`],H=b({__name:`TimelineSection`,props:{vm:{},eventsHref:{}},emits:[`reveal`],setup(n,{emit:r}){let i=n,s=r;function c(e){return`${w(e.ms,`clock`)} ${e.term}${e.hatched?` (in flight)`:``}`}function l(){e.copyText(JSON.stringify(i.vm.debug,null,2))}return(e,r)=>(d(),h(`section`,V,[m(`h2`,pe,[r[0]||=m(`span`,null,`Where the time went`,-1),m(`span`,me,[n.eventsHref?(d(),h(`a`,{key:0,class:`text-dimmed no-underline hover:text-primary hover:underline`,href:n.eventsHref,title:`the stored events, as JSON lines`},`raw events`,8,he)):f(``,!0),m(`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:l},` Copy debug JSON `)])]),m(`p`,ge,[m(`span`,_e,v(n.vm.shown?n.vm.total:n.vm.lede),1),n.vm.current?(d(),h(`span`,ve,` · `+v(n.vm.current),1)):f(``,!0)]),(d(!0),h(o,null,g(n.vm.captions,e=>(d(),h(`p`,{key:e,class:`caption mt-0.5 text-xs text-muted`},v(e),1))),128)),n.vm.note?(d(),h(`p`,ye,v(n.vm.note),1)):f(``,!0),n.vm.shown?(d(),h(o,{key:1},[m(`div`,{class:`bar mt-2.5 flex h-2 w-full overflow-hidden rounded-sm`,role:`img`,"aria-label":n.vm.lede},[(d(!0),h(o,null,g(n.vm.bar,(e,n)=>(d(),h(`div`,{key:n,class:y([`seg h-full`,[_(R)[e.term],e.hatched?`paint-hatched hatched`:``]]),style:t({width:`${e.pct}%`}),title:c(e),"data-term":e.term},null,14,xe))),128))],8,be),m(`ul`,Se,[(d(!0),h(o,null,g(n.vm.legend,e=>(d(),h(`li`,{key:e.term,class:`flex items-baseline gap-1.5 cursor-help`,title:e.definition,"data-term":e.term},[m(`span`,{class:y([`swatch inline-block size-2 shrink-0 self-center rounded-[2px]`,_(R)[e.term]])},null,2),m(`span`,we,v(e.term),1),m(`span`,Te,v(e.text),1)],8,Ce))),128))]),n.vm.ranked.length>0?(d(),h(o,{key:0},[m(`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:n.vm.rankedNote},` Longest steps `,8,Ee),m(`ol`,De,[(d(!0),h(o,null,g(n.vm.ranked,(e,t)=>(d(),h(`li`,{key:t,class:`flex items-baseline gap-2`},[m(`span`,Oe,v(_(w)(e.ms,`clock`)),1),m(`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:a(t=>s(`reveal`,e.anchor),[`prevent`])},v(e.label),9,ke),(d(!0),h(o,null,g(e.facts,e=>(d(),h(`span`,{key:e,class:`fact shrink-0 rounded border border-accented px-1 text-dimmed`},v(e),1))),128))]))),128))])],64)):f(``,!0)],64)):f(``,!0)]))}});function Ae(e,t){let{window:n,owner:r,finished:i}=t,a=Math.max(0,n.end-n.start),o=new Map(e.map(e=>[e.spanId,e])),s=new Map,c=e=>{let t=s.get(e.spanId);if(t!==void 0)return t;s.set(e.spanId,1);let n=e.parentSpanId?o.get(e.parentSpanId):void 0,r=n?c(n)+1:1;return s.set(e.spanId,r),r},l=e=>{let t=e,n=new Set;for(;t&&!n.has(t.spanId);){if(n.add(t.spanId),F(t.name,r)?.kind===`background`)return!0;t=t.parentSpanId?o.get(t.parentSpanId):void 0}return!1},u=t.losses.map(e=>Math.max(n.start,e.from)).sort((e,t)=>e-t),d=e=>{if(e.endedAt!==void 0)return Math.min(n.end,e.endedAt);if(!i)return n.end;let t=u.find(t=>t>e.startedAt);return t===void 0?n.end:Math.min(n.end,t)},f=[],p=[];for(let t of e){let e=F(t.name,r);if(!e)continue;let i=Math.max(n.start,t.startedAt);if(e.kind===`background`){let e=Math.min(n.end,t.endedAt??n.end);e>i&&p.push([i,e]);continue}if(e.kind!==`counted`||l(t))continue;let a=d(t);a<=i||f.push({start:i,end:a,bucket:e.bucket,depth:c(t),startedAt:t.startedAt,spanId:t.spanId})}f.sort((e,t)=>t.depth-e.depth||e.startedAt-t.startedAt||(e.spanId<t.spanId?-1:+(e.spanId>t.spanId)));let m=new Set([n.start,n.end]);for(let e of f)m.add(e.start),m.add(e.end);for(let e of t.losses)m.add(U(e.from,n)),m.add(U(e.to,n));for(let[e,t]of p)m.add(e),m.add(t);let h=[...m].filter(e=>e>=n.start&&e<=n.end).sort((e,t)=>e-t),g={getting_ready:0,thinking:0,tools:0,finishing_up:0},_=0,v=0,y=0;for(let e=0;e+1<h.length;e++){let r=h[e],i=h[e+1],a=i-r;if(a<=0)continue;let o=f.find(e=>e.start<=r&&e.end>=i);if(o){g[o.bucket]+=a;continue}if(t.losses.some(e=>e.kind===`lost`&&U(e.from,n)<=r&&U(e.to,n)>=i)){_+=a;continue}if(t.losses.some(e=>e.kind===`elided`&&U(e.from,n)<=r&&U(e.to,n)>=i)){v+=a;continue}p.some(([e,t])=>e<=r&&t>=i)&&(y+=a)}let b=g.getting_ready+g.thinking+g.tools+g.finishing_up;return{windowMs:a,gettingReadyMs:g.getting_ready,thinkingMs:g.thinking,toolsMs:g.tools,finishingUpMs:g.finishing_up,overheadMs:Math.max(0,a-b-_-v),notRecordedMs:_,notLoadedMs:v,backgroundOnlyMs:y}}function U(e,t){return Math.min(t.end,Math.max(t.start,e))}function je(e){let t=Math.floor(e.windowMs/1e3),n=[[`getting ready`,Math.floor(e.gettingReadyMs/1e3)],[`thinking`,Math.floor(e.thinkingMs/1e3)],[`in tools`,Math.floor(e.toolsMs/1e3)],[`finishing up`,Math.floor(e.finishingUpMs/1e3)],[`not recorded`,Math.floor(e.notRecordedMs/1e3)],[`not loaded`,Math.floor(e.notLoadedMs/1e3)]],r=n.reduce((e,[,t])=>e+t,0),i=n.filter(([,e])=>e>0).map(([e,t])=>({term:e,s:t})),a=t-r;a>0&&i.push({term:`Switchboard overhead`,s:a});let o=[`getting ready`,`thinking`,`in tools`,`finishing up`,`Switchboard overhead`,`not recorded`,`not loaded`];return i.sort((e,t)=>o.indexOf(e.term)-o.indexOf(t.term)),{totalS:t,items:i}}function Me(e){return[e.gettingReadyMs,e.thinkingMs,e.toolsMs,e.finishingUpMs,e.overheadMs,e.notRecordedMs,e.notLoadedMs].filter(t=>t>=2e3||e.windowMs>0&&t/e.windowMs>=.05).length>=2}function W(e,t){if(t===void 0||t<6e4)return;let n=w(t,`clock`);return e===`before`?`queued ${n} before we saw it`:`queued ${n} behind the previous run`}var G={"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`},K=`Ranked by each step's own time, its children excluded — the bar counts every instant once.`,Ne=`currently delivering`,Pe=`getting ready: not recorded (too large)`,Fe=`no timing data`,Ie=`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=Ae(t,{window:n,owner:r,finished:i,losses:e.losses}),o=je(a),s=w(o.totalS*1e3,`clock`),c=t.find(e=>e.name===`request`&&e.parentSpanId===void 0),l=e.phase===`live`?Le(t,r,n):void 0,u=Re(e,l),d=l?I(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:K,debug:f,lede:s,shown:!1,bar:[],legend:[],ranked:[],note:Fe};let p={total:s,current:u,openStep:d,captions:[W(`before`,Y(c,`queuedBeforeMs`)),W(`behind`,Y(c,`queuedBehindMs`))].filter(e=>e!==void 0),rankedNote:K,debug:f};if(!c)return{...p,lede:s,shown:!1,bar:[],legend:[],ranked:[],note:i?Pe:``};let m=t=>t===`not recorded`?`not recorded${e.truncated?` (too large)`:``}`:t===`not loaded`?Ie:t,h=Me(a)&&o.items.length>0,g=h?`${s} — ${o.items.map(({term:e,s:t})=>`${w(t*1e3,`clock`)} ${m(e)}`).join(` · `)}`:a.windowMs>0?`${s} — ${m(ze(a))}`:s,_=h?o.items.map(({term:t,s:n})=>({term:t,text:w(n*1e3,`clock`),definition:t===`not recorded`&&e.truncated?`${G[t]} (too large)`:G[t]})):[];return{...p,lede:g,shown:h,bar:h?Be(a,l):[],legend:_,ranked:h?Ve(t,c,r,n,e.callTitle):[],note:``}}function Y(e,t){let n=e?.attrs[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function Le(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=F(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),F(r.name,n)?.kind===`background`)return!0;r=r.parentSpanId?t.get(r.parentSpanId):void 0}return!1}function Re(e,t){return e.phase===`delivering`?Ne:e.phase===`ended`?re(e.delivery??{}):t?`currently ${q[t.bucket]} ${w(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 ze(e){let t=[`getting ready`,-1];for(let n of Z(e))n[1]>t[1]&&(t=n);return t[0]}function Be(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 Ve(e,t,n,r,i){let a=new Map(e.map(e=>[e.spanId,e])),o=new Map;for(let t of e){if(t.parentSpanId===void 0)continue;let e=o.get(t.parentSpanId);e?e.push(t):o.set(t.parentSpanId,[t])}let s=e=>[Math.max(r.start,e.startedAt),Math.min(r.end,e.endedAt??r.end)],c=[];for(let r of e){if(r===t||r.name===`run.agent`||F(r.name,n)===void 0||X(r,a,n))continue;let[e,l]=s(r);if(l<=e)continue;let u=(o.get(r.spanId)??[]).map(s).map(([t,n])=>[Math.max(e,t),Math.min(l,n)]).filter(([e,t])=>t>e),d=l-e-He(u);if(d<=0)continue;let f=r.name.startsWith(`tool.`)&&typeof r.attrs.callId==`string`?r.attrs.callId:void 0,p=f?i?.(f):void 0;c.push({label:p??I(r.name),ms:d,facts:Ue(r),anchor:f?`call-${f}`:`span-${r.spanId}`,startedAt:r.startedAt})}return c.sort((e,t)=>t.ms-e.ms||e.startedAt-t.startedAt),c.slice(0,3).map(({label:e,ms:t,facts:n,anchor:r})=>({label:e,ms:t,facts:n,anchor:r}))}function He(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 Ue(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 ${w(t.timeoutMs,`clock`)}`),typeof t.waitedMs==`number`&&n.push(`waited ${w(t.waitedMs,`clock`)}`),typeof t.exitCode==`number`&&t.exitCode!==0&&n.push(`exit ${t.exitCode}`),t.timedOut===!0&&n.push(`timed out`),typeof t.attempts==`number`&&t.attempts>1&&n.push(`${t.attempts} attempts`),e.status===`error`&&n.length===0&&n.push(`failed`),n}function Q(e){return e===`command`?`command`:`agent`}var We=[`data-state`],Ge={key:0,class:`loading py-2 font-mono text-xs text-dimmed`},Ke={key:1,class:`failed py-2 font-mono text-xs text-warn`},qe=[`href`],Je=[`data-turn`,`data-anchor`],Ye={class:`landing-head flex flex-wrap items-baseline gap-x-2 font-mono text-xs text-muted`},Xe={class:`turn tabular-nums`},Ze={class:`what min-w-0 truncate text-toned`},Qe=[`href`],$e={key:0,class:`m-0 mt-1 list-none p-0`},et=b({__name:`RunTimeline`,props:{run:{},land:{},fetch:{}},setup(t){let a=t,l=c(`loading`),g=ne(),y=p(()=>{if(l.value!==`ready`)return null;g.state.traceVersion;let e=a.run,t=e.receivedAt??e.startedAt,n=T(e)??(e.finishedAt===void 0?0:Math.max(0,e.finishedAt-t));return J({spans:g.spanSet(),losses:g.losses(t),window:{start:t,end:t+n},owner:Q(e.agent),totalMs:n,phase:`ended`,delivery:{finishedAt:e.finishedAt,sealedAt:e.sealedAt,replyOk:e.replyOk},...e.truncated===void 0?{}:{truncated:e.truncated},...(e.schema??0)>=2?{}:{untimed:!0},callTitle:g.callHeadline})}),b=p(()=>`/runs/${encodeURIComponent(a.run.id)}/events`),x=e=>`/runs/${encodeURIComponent(a.run.id)}#${e}`;function S(t){e.navigate(x(t))}let C=p(()=>{if(l.value!==`ready`||a.land===void 0)return null;g.state.traceVersion;let e=a.land,t=a.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&&g.state.reply)return{anchor:`reply`,what:`the reply`};let r=g.landing(e);return r?{anchor:r.anchor,what:w(r.step),step:r.step}:null});function w(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 E=c(null),D=p(()=>C.value?`${a.land}@${C.value.anchor}`:null);return r(D,e=>{e!==null&&n().then(()=>{let e=(C.value?.step?E.value?.querySelector(`li.step`):null)??E.value;e&&(e.scrollIntoView?.({block:`center`}),e.classList.add(`revealed`),setTimeout(()=>e.classList.remove(`revealed`),1500))})}),i(async()=>{let e=a.fetch??((...e)=>globalThis.fetch(...e));try{let t=await e(b.value,{credentials:`same-origin`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=ae(await t.text()).filter(e=>e.type!==`replay_note`);for(let e of(a.run.schema??0)>=2?P(n):n)g.handle(e);g.closePhases(),l.value=`ready`}catch{l.value=`failed`}}),(e,n)=>(d(),h(`div`,{class:`runtimeline pl-5`,"data-state":l.value},[l.value===`loading`?(d(),h(`p`,Ge,`reading the run's record…`)):l.value===`failed`?(d(),h(`p`,Ke,[n[1]||=u(` the run's record could not be read — `,-1),m(`a`,{class:`text-primary no-underline hover:underline`,href:`/runs/${encodeURIComponent(t.run.id)}`},`open the run`,8,qe)])):y.value?(d(),h(o,{key:2},[s(H,{vm:y.value,"events-href":b.value,onReveal:S},null,8,[`vm`,`events-href`]),C.value?(d(),h(`div`,{key:0,ref_key:`landingEl`,ref:E,class:`landing mb-4 rounded-lg border border-default px-(--sb-gutter) py-2`,"data-turn":t.land,"data-anchor":C.value.anchor},[m(`p`,Ye,[m(`span`,Xe,`turn `+v(t.land),1),m(`span`,Ze,`· `+v(C.value.what),1),m(`a`,{class:`page ml-auto shrink-0 text-primary no-underline hover:underline`,href:x(C.value.anchor),title:`the same step on the run's own page`},`open on the run's page ↗`,8,Qe)]),C.value.step?(d(),h(`ol`,$e,[s(ie,{step:C.value.step,onToggleGroup:n[0]||=e=>_(g).toggleGroup(C.value.step)},null,8,[`step`])])):f(``,!0)],8,Je)):f(``,!0)],64)):f(``,!0)],8,We))}}),tt=[`id`,`data-run-id`,`data-round`,`data-thread`],$=[`open`],nt={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`},rt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},it={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},at={key:3,class:`scope min-w-0 flex-1 truncate text-toned`},ot=[`title`],st=[`data-heat`],ct={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},lt=[`href`,`aria-label`],ut={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)`},dt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},ft={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},pt={key:3,class:`scope min-w-0 flex-1 truncate text-highlighted`},mt=[`title`],ht={class:`elapsed shrink-0 text-right font-mono text-xs tabular-nums text-ok sm:min-w-[4.5em]`,title:`running for`},gt={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},_t=[`href`,`aria-label`],vt=b({__name:`RunFoldRow`,props:{run:{},now:{},label:{},open:{type:Boolean},land:{}},setup(e){let n=e,i=c(n.open===!0);r(()=>n.open,e=>{e&&(i.value=!0)});let o=p(()=>x(n.run.label||k(n.run.id))),u=p(()=>E(n.run)),g=p(()=>ee(n.run)),b=p(()=>n.run.finished),w=p(()=>n.run.finished&&n.run.status&&n.run.status!==`completed`?te(n.run.status):``),T=p(()=>ce(n.run.finished&&typeof n.run.finishedAt==`number`?n.run.finishedAt-n.run.startedAt:void 0,`run`)),P=p(()=>se(T.value));function F(e){i.value=e.target.open}return(n,r)=>(d(),h(`li`,{id:`run-${e.run.id}`,class:y([`fold group border-b border-muted`,e.run.finished?`finished`:`live`]),"data-run-id":e.run.id,"data-round":e.run.round,"data-thread":e.run.thread},[b.value?(d(),h(`details`,{key:0,class:`group/fold`,open:i.value,onToggle:F},[m(`summary`,nt,[r[1]||=m(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open/fold:rotate-90 motion-reduce:transition-none`,"aria-hidden":`true`},`❯`,-1),s(L,{tone:u.value,label:_(N)(e.run),tip:_(j)(e.run)},null,8,[`tone`,`label`,`tip`]),e.label?(d(),h(`span`,rt,v(e.label),1)):f(``,!0),o.value.agent?(d(),h(`span`,{key:1,class:y([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider opacity-55`,_(M)[_(A)(o.value.agent)]])},v(o.value.agent),3)):f(``,!0),o.value.snippet===void 0?(d(),h(`span`,at,v(o.value.scope),1)):(d(),h(`span`,it,v(o.value.snippet),1)),w.value?(d(),h(`span`,{key:4,class:y([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem]`,u.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},v(w.value),3)):f(``,!0),m(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-dimmed`,title:_(C)(e.run)},v(_(S)(e.run.startedAt,e.now)),9,ot),m(`span`,{class:y([`elapsed shrink-0 text-right font-mono text-xs tabular-nums sm:min-w-[4.5em]`,[P.value?`heat`:`text-muted`,T.value.level>=2?`font-medium`:``]]),style:t(P.value),"data-heat":T.value.level,title:`start to finish`},v(_(O)(e.run,e.now)),15,st),m(`span`,ct,v(_(D)(e.run)),1),m(`a`,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,href:g.value,"aria-label":`open run ${e.run.label||_(k)(e.run.id)}`,onClick:r[0]||=a(()=>{},[`stop`])},`open ↗`,8,lt)]),i.value?(d(),l(et,{key:0,run:e.run,land:e.land},null,8,[`run`,`land`])):f(``,!0)],40,$)):(d(),h(`div`,ut,[r[2]||=m(`span`,{class:`chev select-none text-xs text-transparent`,"aria-hidden":`true`},`❯`,-1),s(L,{tone:u.value,label:_(N)(e.run),tip:_(j)(e.run),pulse:``},null,8,[`tone`,`label`,`tip`]),e.label?(d(),h(`span`,dt,v(e.label),1)):f(``,!0),o.value.agent?(d(),h(`span`,{key:1,class:y([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider`,_(M)[_(A)(o.value.agent)]])},v(o.value.agent),3)):f(``,!0),o.value.snippet===void 0?(d(),h(`span`,pt,v(o.value.scope),1)):(d(),h(`span`,ft,v(o.value.snippet),1)),m(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-muted`,title:_(C)(e.run)},v(_(S)(e.run.startedAt,e.now)),9,mt),m(`span`,ht,v(_(O)(e.run,e.now)),1),m(`span`,gt,v(_(D)(e.run)),1),m(`a`,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,href:g.value,"aria-label":`open run ${e.run.label||_(k)(e.run.id)}`},`open ↗`,8,_t)]))],10,tt))}});export{B as a,H as i,Q as n,fe as o,J as r,vt as t};