@coreplane/switchboard 1.251.0 → 1.252.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 (74) hide show
  1. package/dist/assets/config/config.example.yaml +4 -2
  2. package/dist/assets/deploy/cloudflare/preflight.mjs +19 -21
  3. package/dist/assets/deploy/cloudflare/worker.ts +6 -3
  4. package/dist/assets/deploy/cloudflare-memory/worker.ts +77 -12
  5. package/dist/assets/deploy/cloudflare-resident/memoryGuard.ts +212 -0
  6. package/dist/assets/deploy/cloudflare-resident/refresh.ts +1 -1
  7. package/dist/assets/deploy/cloudflare-resident/worker.ts +317 -56
  8. package/dist/assets/deploy/cloudflare-sandbox/Dockerfile +4 -2
  9. package/dist/assets/deploy/cloudflare-sandbox/runtime-supervisor.d.mts +31 -0
  10. package/dist/assets/deploy/cloudflare-sandbox/runtime-supervisor.mjs +119 -0
  11. package/dist/assets/package-lock.json +3 -3
  12. package/dist/assets/package.json +3 -2
  13. package/dist/assets/project.json +13 -9
  14. package/dist/assets/source.json +3 -3
  15. package/dist/assets/src/agents/registry.ts +5 -5
  16. package/dist/assets/src/core/budgets.ts +22 -0
  17. package/dist/assets/src/core/coordinator/contract.ts +42 -0
  18. package/dist/assets/src/core/coordinator/driver.ts +134 -10
  19. package/dist/assets/src/core/drain.ts +50 -0
  20. package/dist/assets/src/core/memory/engine.ts +98 -0
  21. package/dist/assets/src/core/memory/scorer.ts +12 -4
  22. package/dist/assets/src/core/memory/types.ts +69 -12
  23. package/dist/assets/src/core/modelCard.ts +32 -4
  24. package/dist/assets/src/core/modelPricing.ts +111 -1
  25. package/dist/assets/src/core/modelProxy/usage.ts +88 -0
  26. package/dist/assets/src/core/modelRegistry.ts +15 -1
  27. package/dist/assets/src/core/refusal.ts +4 -7
  28. package/dist/assets/src/core/reviewVerdict.ts +4 -0
  29. package/dist/assets/src/core/runEvents.ts +51 -2
  30. package/dist/assets/src/core/runFriction.ts +7 -2
  31. package/dist/assets/src/core/runLedger/types.ts +11 -0
  32. package/dist/assets/src/core/runUsage.ts +67 -13
  33. package/dist/assets/src/core/schedules.ts +3 -0
  34. package/dist/assets/src/core/ship/contract.ts +41 -14
  35. package/dist/assets/src/core/ship/coordinator.ts +380 -53
  36. package/dist/assets/src/core/ship/renewal.ts +10 -5
  37. package/dist/assets/src/core/trace/attrs.ts +24 -0
  38. package/dist/assets/src/core/types.ts +5 -5
  39. package/dist/assets/src/core/verbosity.ts +48 -0
  40. package/dist/assets/src/deploy/liveGate.ts +40 -13
  41. package/dist/assets/src/deploy/restart.ts +11 -12
  42. package/dist/assets/src/execution/residentDepCache.ts +50 -1
  43. package/dist/assets/src/execution/residentDepsStore.ts +40 -2
  44. package/dist/assets/src/execution/residentRefresh.ts +55 -3
  45. package/dist/assets/src/execution/residentSteps.ts +4 -0
  46. package/dist/assets/src/execution/sandboxErrors.ts +8 -0
  47. package/dist/assets/web/dist/.vite/manifest.json +55 -55
  48. package/dist/assets/web/dist/assets/{DeliveryPage-DUXd-Sl-.js → DeliveryPage-3ELQWM0r.js} +1 -1
  49. package/dist/assets/web/dist/assets/HomePage-BG_ok-K2.js +2 -0
  50. package/dist/assets/web/dist/assets/{PendingTurnRow-DDhMhrI7.js → PendingTurnRow-ChCQOLgZ.js} +1 -1
  51. package/dist/assets/web/dist/assets/{ResidentDetailPage-BnEoOnGQ.js → ResidentDetailPage-C9y3nbo8.js} +1 -1
  52. package/dist/assets/web/dist/assets/{ResidentsIndexPage-Dxpgf-l-.js → ResidentsIndexPage-i1RG9e7g.js} +1 -1
  53. package/dist/assets/web/dist/assets/RunFoldRow-D3wVpzBa.js +1 -0
  54. package/dist/assets/web/dist/assets/{RunRoutePage-9klVWhSF.js → RunRoutePage-B3IirUVi.js} +4 -4
  55. package/dist/assets/web/dist/assets/RunsIndexPage-DiFmtGaJ.js +1 -0
  56. package/dist/assets/web/dist/assets/{ScheduledPage-B_GgeJrb.js → ScheduledPage-DvYwM2TE.js} +1 -1
  57. package/dist/assets/web/dist/assets/{SettingsPage-BXX4R113.js → SettingsPage-Bo6yCyXZ.js} +1 -1
  58. package/dist/assets/web/dist/assets/{StatusDot-BOaw8le9.js → StatusDot-CAfS1AUi.js} +1 -1
  59. package/dist/assets/web/dist/assets/{Tooltip-DYZZ4l4V.js → Tooltip-tZoum_T-.js} +1 -1
  60. package/dist/assets/web/dist/assets/{UnitRoutePage-BaSW5Odq.js → UnitRoutePage-BmdOHwNn.js} +1 -1
  61. package/dist/assets/web/dist/assets/budgets-CbIyPAER.js +1 -0
  62. package/dist/assets/web/dist/assets/{dist-BCVXeBJ9.js → dist-DfbEpHXR.js} +1 -1
  63. package/dist/assets/web/dist/assets/indexRow-BT0cPVRw.js +1 -0
  64. package/dist/assets/web/dist/assets/{main-Dkcbtu3u.js → main-5Gm_1Gv8.js} +2 -2
  65. package/dist/assets/web/dist/assets/sseReplay-DmyMXfRC.js +11 -0
  66. package/dist/cli.js +2470 -902
  67. package/package.json +1 -1
  68. package/dist/assets/deploy/cloudflare-sandbox/runtime-supervisor.sh +0 -68
  69. package/dist/assets/web/dist/assets/HomePage-mSiqEEcN.js +0 -2
  70. package/dist/assets/web/dist/assets/RunFoldRow-CSo4-vld.js +0 -1
  71. package/dist/assets/web/dist/assets/RunsIndexPage-BplMIgaw.js +0 -1
  72. package/dist/assets/web/dist/assets/budgets-BvWYKPsY.js +0 -1
  73. package/dist/assets/web/dist/assets/indexRow-Bde9OZxG.js +0 -1
  74. package/dist/assets/web/dist/assets/sseReplay-DPwdsaok.js +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreplane/switchboard",
3
- "version": "1.251.0",
3
+ "version": "1.252.0",
4
4
  "description": "Mention it in Slack and an agent reviews the PR, ships the fix, or answers the question — on the model you choose, with its tools running where you decide.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://openswitchboard.dev",
@@ -1,68 +0,0 @@
1
- #!/bin/sh
2
- # The cold sandbox's process supervisor, run by tini (PID 1): keeps the
3
- # container alive across a crash of the SDK's container server
4
- # (/container-server/sandbox). That server calls process.exit(1) on any
5
- # uncaught exception, and the base image runs it as tini's one child — so one
6
- # uncaught error ended the whole container: /workspace gone, a detached pi
7
- # with it, every later /exec a failure until the platform noticed. Started
8
- # here as a child instead, the server's exit is a restart a second later; the
9
- # disk, the detached processes and the Durable Object's view of a running
10
- # container all survive, and the next command starts a fresh process on the
11
- # new server (docs/reference/specs/execution.md item 21).
12
- #
13
- # A stop from the platform is SIGTERM, which tini forwards here: forwarded to the server, and
14
- # nothing starts again — a stop that lands during the pause between two
15
- # starts, or before the new pid is known, still ends here — and the server's
16
- # own exit status becomes this script's. A terminal's INT is forwarded as
17
- # TERM too: a child started with `&` by a non-interactive shell ignores INT
18
- # (POSIX), so INT itself would stop nothing. A server that cannot stay up —
19
- # QUICK_EXIT_LIMIT exits in a row, each within QUICK_EXIT_SECS of starting —
20
- # ends the container with the last status instead of looping forever.
21
- # src/deploy/sandboxRuntimeSupervisor.test.ts holds the shape and drives it.
22
- set -u
23
- RUNTIME=${SANDBOX_RUNTIME:-/container-server/sandbox}
24
- QUICK_EXIT_SECS=10
25
- QUICK_EXIT_LIMIT=5
26
- pid=
27
- stopping=
28
- quick=0
29
- code=0
30
-
31
- on_signal() {
32
- stopping=1
33
- if [ -n "$pid" ]; then kill -TERM "$pid" 2>/dev/null; fi
34
- }
35
- trap on_signal TERM INT
36
-
37
- while :; do
38
- started=$(date +%s)
39
- "$RUNTIME" "$@" &
40
- pid=$!
41
- # A stop that landed between the start and this line found no pid to
42
- # forward to; the server it missed gets it here.
43
- if [ -n "$stopping" ]; then kill -TERM "$pid" 2>/dev/null; fi
44
- wait "$pid"
45
- code=$?
46
- # A trapped signal ends `wait` early (status > 128) while the server still
47
- # runs; wait again until it is really gone, so the status is its own.
48
- while kill -0 "$pid" 2>/dev/null; do
49
- wait "$pid"
50
- code=$?
51
- done
52
- pid=
53
- if [ -n "$stopping" ]; then exit "$code"; fi
54
- if [ $(( $(date +%s) - started )) -lt "$QUICK_EXIT_SECS" ]; then
55
- quick=$((quick + 1))
56
- else
57
- quick=0
58
- fi
59
- if [ "$quick" -ge "$QUICK_EXIT_LIMIT" ]; then
60
- echo "sandbox-runtime-supervisor: the runtime exited with status $code, $quick times in a row within ${QUICK_EXIT_SECS}s of starting; giving up" >&2
61
- exit "$code"
62
- fi
63
- echo "sandbox-runtime-supervisor: the runtime exited with status $code; starting it again" >&2
64
- sleep 1
65
- # A stop that landed during the pause: the last status is the answer, and
66
- # nothing starts again.
67
- if [ -n "$stopping" ]; then exit "$code"; fi
68
- done
@@ -1,2 +0,0 @@
1
- import{i as e,r as t,t as n}from"./AppShell-DAtHiuI6.js";import{An as r,Cn as i,Cr as a,Ft as o,Gr as s,Ii as c,Li as l,Mn as u,Pi as d,Pt as f,Qr as p,Sn as m,Tr as h,Xr as g,_r as _,bn as v,c as y,dr as ee,en as b,hr as te,ir as x,ji as S,kn as C,l as ne,ln as w,o as T,rn as E,sr as D,t as O,wr as k,xi as A,xn as j,y as M,yi as N,yn as P,yr as F}from"./browser-B6T5hjfR.js";import{t as I}from"./Tooltip-DYZZ4l4V.js";import{i as L,n as re,r as ie,t as R}from"./PendingTurnRow-DDhMhrI7.js";import{b as ae,x as oe}from"./main-Dkcbtu3u.js";import{t as se}from"./eventSource-Bj_dZf6M.js";import{t as z}from"./wallClock-DmaC1sKA.js";import{n as B,r as ce,t as V}from"./indexFormat-B-pd4r7Y.js";import{F as le,R as ue,a as de,i as fe,t as pe,y as me}from"./indexRow-Bde9OZxG.js";import{i as he}from"./format-BldUwl_R.js";import{i as ge,n as H,t as U}from"./durationTone-U_rOqo6r.js";import{T as _e,a as ve,c as W,d as ye,i as be,n as xe,o as Se,s as Ce,t as G,u as K,v as we}from"./sseReplay-DPwdsaok.js";var q=`To run this:`;function Te(e,t){return e?t.trim()===``?`stop`:`steer`:`send`}var Ee=`↪ Folded into`;function De(e){let t=e.trim();return t.startsWith(`To run this:`)?{kind:`handBack`,command:t.slice(q.length).trim()}:t.startsWith(Ee)?{kind:`steerAck`,text:t}:{kind:`inline`,text:t}}function Oe(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 J(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 ke(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`:B(e,t)}function Ae(e,t){let n=e.surface??`web`,r=fe[n]??n,i=e.channelName?`${r} #${e.channelName}`:r;return{title:e.excerpt||e.title,when:V(e.lastAt,t),source:n===`web`?r:`${i} · 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 je(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 Me(e){return{width:je(e.width??void 0),collapsed:e.collapsed===`1`}}function Ne(e,t){let n=e<5?`Still up`:e<12?`Good morning`:e<18?`Good afternoon`:`Good evening`;return t?`${n}, ${t}.`:`${n}.`}function Pe(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 Fe(e,t=60){return e<=t}function Ie(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}function Le(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 Re(e,t){return t.trim()===``?[...e]:e.map((e,n)=>({row:e,i:n,score:Le(t,e.title)})).filter(e=>e.score!==null).sort((e,t)=>e.score-t.score||e.i-t.i).map(e=>e.row)}function ze(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 Be(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 Z(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 Ve(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=>Le(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 He(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 Ue(e,t){let n=new Set,r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.startsWith(`-`)){n.add(a);let t=(e.options??[]).find(e=>Q(e.form)===a);t&&t.form.includes(` `)&&i++}else r++}return{positionals:r,flags:n}}function We(e,t){let n=/^\/([^\n]*)$/.exec(e);if(!n||t.length===0)return null;let r=n[1].split(` `),i=r[r.length-1],a=r.slice(0,-1).filter(e=>e!==``),o=e.slice(0,e.length-i.length),s=Z(t);if(a.length===0)return{level:`group`,head:o,partial:i,rows:Ve(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=Ve(c.verbs,i,e=>[e.verb,e.command.describe]);if(e.length===0&&c.bare&&i!==``)return Ke(c.bare,o,i,[]);if(e.length===0&&!c.bare)return{level:`verb`,head:o,partial:i,rows:[]};let t=e.map(e=>({insert:e.verb,label:`/${e.command.chat}`,describe:e.command.describe,kind:`command`,acceptable:!0}));return c.bare&&i===``&&t.unshift(Ge(c.bare,0,new Set)),{level:`verb`,head:o,partial:i,rows:t}}let l=c.verbs.find(e=>e.verb===a[1]);return l?Ke(l.command,o,i,a.slice(2)):c.bare?Ke(c.bare,o,i,a.slice(1)):null}function Ge(e,t,n){let r=He(e,t,n);return{insert:``,label:`/${e.chat}`,describe:r?`${r} — ${e.describe}`:e.describe,kind:`usage`,acceptable:!1}}function Ke(e,t,n,r){let i=Ue(e,r);return n.startsWith(`-`)?{level:`tail`,head:t,partial:n,rows:Ve((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:[Ge(e,i.positionals,i.flags)],command:e}}function qe(e,t){let n=e.rows[t];if(!n)return null;if(n.acceptable){if(!n.insert.toLowerCase().startsWith(e.partial.toLowerCase()))return null;let t=n.insert.slice(e.partial.length);return t===``?null:{text:t,acceptable:!0}}if(e.partial!==``||n.kind!==`usage`)return null;let[r,...i]=n.describe.split(` — `);return i.length===0?null:{text:r,acceptable:!1}}function $(e,t){return`${e.head}${t.insert} `}function Je(e,t){if(!e.startsWith(`/`))return e;let n=e.slice(1),[r,i]=n.split(/\s+/,2);return t.some(e=>e.chat===r||i!==void 0&&e.chat===`${r} ${i}`)?n:e}var Ye={class:`composer-wrap relative`},Xe={key:0,class:`palette absolute bottom-full left-0 right-0 z-20 mb-2 max-h-72 overflow-y-auto rounded-xl border border-default bg-(--ui-bg-elevated) p-1 shadow-sm`,role:`listbox`,"aria-label":`Commands`,"data-testid":`palette`},Ze={key:0,class:`px-3 py-2 font-mono text-xs text-dimmed`},Qe=[`aria-selected`,`data-insert`,`data-kind`,`data-label`,`onClick`,`onMouseenter`],$e={class:`chat shrink-0 font-mono text-[0.8rem] font-medium text-highlighted`},et={class:`describe min-w-0 flex-1 truncate text-[0.8rem] text-muted`},tt={key:0,class:`shrink-0 rounded border border-default px-1 font-mono text-[0.62rem] text-dimmed`,"aria-hidden":`true`},nt=[`data-mode`],rt={class:`relative min-w-0 flex-1`},it=[`data-acceptable`],at={class:`invisible`},ot={class:`text-dimmed`},st=[`rows`,`value`,`placeholder`,`autofocus`,`aria-expanded`],ct=[`aria-hidden`,`data-hint`,`data-shown`],lt=u({__name:`ChatComposer`,props:{modelValue:{},mode:{},hint:{},autofocus:{type:Boolean},sweepOnMount:{type:Boolean},commands:{}},emits:[`update:modelValue`,`submit`,`stop`],setup(e,{expose:t,emit:n}){let o=e,c=n,u=A(null),p=A(!1),h=A(!1),y=P(()=>Math.min(8,Math.max(1,o.modelValue.split(`
2
- `).length))),b={send:{icon:`i-lucide-arrow-up`,label:`Send`},steer:{icon:`i-lucide-corner-down-right`,label:`Steer the run`},stop:{icon:`i-lucide-square`,label:`Stop the run`}},te=P(()=>b[o.mode]),S=P(()=>Be(o.mode,o.hint)),C=P(()=>o.hint?o.hint:o.mode===`steer`?`Enter folds this into the run in flight`:o.mode===`stop`?`A run is in flight · type to steer it, or stop it`:`Enter to send · Shift+Enter for a new line · / for a command`),T=P(()=>p.value||o.hint!==void 0||o.mode!==`send`),D=P(()=>We(o.modelValue,o.commands??[])),O=P(()=>D.value?.rows??[]),k=A(!1),N=A(0),F=P(()=>D.value!==null&&!k.value),I=P(()=>F.value&&D.value?qe(D.value,N.value):null);s(()=>`${D.value?.level??``}|${D.value?.head??``}`,()=>{k.value=!1,N.value=0}),s(O,e=>{N.value>=e.length&&(N.value=Math.max(0,e.length-1))});function L(e){D.value&&e.acceptable&&(c(`update:modelValue`,$(D.value,e)),z())}function re(){let e=u.value;return!e||e.selectionStart===e.value.length&&e.selectionEnd===e.value.length}function ie(e){c(`update:modelValue`,e.target.value)}function R(e){if(F.value){if(e.key===`ArrowDown`){e.preventDefault(),O.value.length>0&&(N.value=(N.value+1)%O.value.length);return}if(e.key===`ArrowUp`){e.preventDefault(),O.value.length>0&&(N.value=(N.value-1+O.value.length)%O.value.length);return}if(e.key===`Escape`){e.preventDefault(),k.value=!0;return}let t=O.value[N.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}}Ie(e)&&(e.preventDefault(),ae())}function ae(){o.mode===`stop`?c(`stop`):o.modelValue.trim()!==``&&c(`submit`)}function oe(){h.value=!1,x().then(()=>{h.value=!0})}function se(){p.value=!0,oe()}function z(){x().then(()=>{let e=u.value;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),document.activeElement===e&&!p.value&&se())})}return s(()=>o.hint,e=>{e&&z()}),ee(()=>{o.autofocus&&z(),o.sweepOnMount&&oe()}),t({focus:z}),(t,n)=>{let o=M,s=ne;return _(),i(`div`,Ye,[r(f,{name:`sb-rise`},{default:g(()=>[F.value?(_(),i(`div`,Xe,[O.value.length===0?(_(),i(`p`,Ze,` No command matches "`+l(e.modelValue)+`". `,1)):m(``,!0),(_(!0),i(w,null,a(O.value,(e,t)=>(_(),i(`button`,{key:e.label,type:`button`,role:`option`,class:d([`item flex w-full items-baseline gap-3 rounded-lg px-3 py-1.5 text-left transition-colors duration-150 ease-out`,t===N.value?`bg-(--ui-bg-accented)`:`hover:bg-(--ui-bg-muted)`]),"aria-selected":t===N.value?`true`:`false`,"data-insert":e.insert,"data-kind":e.kind,"data-label":e.label,onMousedown:n[0]||=E(()=>{},[`prevent`]),onClick:t=>L(e),onMouseenter:e=>N.value=t},[v(`span`,$e,l(e.label),1),v(`span`,et,l(e.describe),1),t===N.value&&e.acceptable?(_(),i(`kbd`,tt,`Tab`)):m(``,!0)],42,Qe))),128))])):m(``,!0)]),_:1}),v(`div`,{class:d([`ring relative rounded-2xl`,h.value?`ring-sweep`:``]),onAnimationend:n[2]||=e=>h.value=!1},[v(`form`,{class:d([`composer relative flex items-end gap-2 rounded-2xl border bg-default px-3 py-2 transition-colors duration-150 ease-out`,p.value?`border-primary`:`border-default hover:border-accented`]),"data-mode":e.mode,onSubmit:E(ae,[`prevent`])},[v(`div`,rt,[I.value?(_(),i(`div`,{key:0,class:`ghost composer-text pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap break-words`,"aria-hidden":`true`,"data-testid":`ghost`,"data-acceptable":I.value.acceptable?`1`:`0`},[v(`span`,at,l(e.modelValue),1),v(`span`,ot,l(I.value.text),1)],8,it)):m(``,!0),v(`textarea`,{ref_key:`box`,ref:u,class:`box composer-text relative block min-h-6 w-full resize-none bg-transparent text-highlighted outline-none placeholder:text-dimmed`,rows:y.value,value:e.modelValue,placeholder:S.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=>p.value=!1},null,40,st)]),r(s,{type:`submit`,class:`control shrink-0 rounded-full transition-transform duration-150 ease-out active:scale-95`,color:e.mode===`stop`?`neutral`:`primary`,variant:e.mode===`stop`?`outline`:`solid`,size:`sm`,"aria-label":te.value.label,title:te.value.label,disabled:e.mode===`send`&&e.modelValue.trim()===``,"data-mode":e.mode},{default:g(()=>[r(f,{name:`sb-fade`,mode:`out-in`},{default:g(()=>[(_(),j(o,{key:te.value.icon,name:te.value.icon,class:`size-4`,"aria-hidden":`true`},null,8,[`name`]))]),_:1})]),_:1},8,[`color`,`variant`,`aria-label`,`title`,`disabled`,`data-mode`])],42,nt)],34),v(`p`,{class:d([`hint mt-1.5 min-h-[1.1rem] select-none px-3 font-mono text-[0.7rem] text-dimmed transition-opacity duration-150 ease-out`,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`},l(C.value),11,ct)])}}}),ut={class:`thread-tip flex max-w-xs flex-col gap-1 text-xs`},dt={class:`tip-title leading-snug text-highlighted`},ft={class:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 font-mono text-[0.68rem] text-muted`},pt={class:`tip-when tabular-nums`},mt={class:`tip-source inline-flex items-center gap-1`},ht={class:`tip-runs`},gt={key:0,class:`tip-live inline-flex items-center gap-1 text-toned`},_t=u({__name:`ThreadTip`,props:{row:{},now:{}},setup(e){let t=e,n=P(()=>Ae(t.row,t.now));return(t,r)=>(_(),i(`div`,ut,[v(`p`,dt,l(n.value.title),1),v(`p`,ft,[v(`span`,pt,l(n.value.when),1),r[1]||=v(`span`,{"aria-hidden":`true`},`·`,-1),v(`span`,mt,[e.row.surface===`slack`?(_(),j(ge,{key:0})):m(``,!0),C(l(n.value.source),1)]),r[2]||=v(`span`,{"aria-hidden":`true`},`·`,-1),v(`span`,ht,l(n.value.runs),1),n.value.live?(_(),i(`span`,gt,[...r[0]||=[v(`span`,{class:`size-1.5 rounded-full bg-ok`,"aria-hidden":`true`},null,-1),C(`live`,-1)]])):m(``,!0)])]))}}),vt={class:`rail flex flex-col gap-1 text-[0.8rem]`,"aria-label":`Recent threads`},yt={class:`filter mb-2 flex items-center gap-2 rounded-lg border border-default px-2.5 py-1.5 transition-colors duration-150 ease-out focus-within:border-primary hover:border-accented`},bt={key:0,class:`rounded border border-default px-1 font-mono text-[0.65rem] text-dimmed`},xt={key:0,class:`empty px-3 py-1 text-xs text-dimmed`},St={key:1,class:`nomatch px-3 py-1 text-xs text-dimmed`},Ct={key:0,class:`dot mt-px size-1.5 shrink-0 self-center rounded-full bg-ok motion-safe:animate-pulse`,"aria-label":`a run is in flight`},wt={class:`title min-w-0 flex-1 truncate text-toned group-hover:text-highlighted group-aria-[current=page]:text-highlighted`},Tt={class:`when shrink-0 font-mono text-[0.7rem] tabular-nums text-dimmed`},Et={class:`retention px-3 pt-1 text-[0.7rem] leading-relaxed text-dimmed`},Dt={class:`model px-3 pt-2 text-[0.7rem] leading-relaxed text-dimmed`,"data-testid":`what-is-a-thread`},Ot=500,kt=u({__name:`ConversationRail`,props:{rows:{},current:{},now:{},retention:{}},setup(e,{expose:t}){let n=e,s=A(``),c=A(null),u=P(()=>Re(n.rows,s.value));function d(){c.value?.focus(),c.value?.select()}function f(e){e.key===`Escape`&&(s.value=``,c.value?.blur())}return t({focusFilter:d}),(t,n)=>{let d=M,y=h(`RouterLink`),ee=I;return _(),i(`nav`,vt,[r(y,{class:`new group mb-3 flex items-center gap-2 rounded-xl bg-inverted px-3 py-2 font-medium text-inverted no-underline transition-[transform,opacity] duration-150 ease-out hover:-translate-y-px hover:opacity-90 active:translate-y-0 active:opacity-100`,to:`/threads`,"aria-current":e.current===``?`page`:void 0,"data-testid":`new-thread`},{default:g(()=>[r(d,{name:`i-lucide-plus`,class:`size-4 shrink-0 transition-transform duration-150 ease-out group-hover:rotate-90`,"aria-hidden":`true`}),n[1]||=v(`span`,null,`New thread`,-1),n[2]||=v(`span`,{class:`kbd ml-auto flex gap-0.5 font-mono text-[0.65rem] opacity-70`,"aria-label":`shortcut shift command O`},[v(`kbd`,{class:`rounded border border-current/30 px-1`},`⇧`),v(`kbd`,{class:`rounded border border-current/30 px-1`},`⌘`),v(`kbd`,{class:`rounded border border-current/30 px-1`},`O`)],-1)]),_:1},8,[`aria-current`]),v(`label`,yt,[r(d,{name:`i-lucide-search`,class:`size-3.5 shrink-0 text-dimmed`,"aria-hidden":`true`}),p(v(`input`,{ref_key:`filter`,ref:c,"onUpdate:modelValue":n[0]||=e=>s.value=e,class:`min-w-0 flex-1 bg-transparent text-[0.8rem] text-highlighted outline-none placeholder:text-dimmed`,type:`text`,placeholder:`Filter recent`,"aria-label":`Filter recent threads`,autocomplete:`off`,onKeydown:f},null,544),[[b,s.value]]),s.value?m(``,!0):(_(),i(`kbd`,bt,`⌘K`))]),n[8]||=v(`p`,{class:`label px-3 pb-1 font-mono text-[0.65rem] font-medium uppercase tracking-wider text-dimmed`},`Recent`,-1),e.rows.length===0?(_(),i(`p`,xt,`Nothing yet. Ask something.`)):u.value.length===0?(_(),i(`p`,St,`Nothing matches "`+l(s.value)+`".`,1)):m(``,!0),r(o,{name:`sb-rise`,tag:`div`,class:`rows flex flex-col gap-0.5`},{default:g(()=>[(_(!0),i(w,null,a(u.value,t=>(_(),i(`div`,{key:t.id},[r(ee,{"delay-duration":Ot,content:{side:`right`,sideOffset:12,align:`start`},ui:{content:`h-auto max-w-xs px-2.5 py-2`}},{content:g(()=>[r(_t,{row:t,now:e.now},null,8,[`row`,`now`])]),default:g(()=>[r(y,{class:`row group relative flex items-baseline gap-2 rounded-lg px-3 py-1.5 no-underline transition-colors duration-150 ease-out hover:bg-(--ui-bg-muted) aria-[current=page]:bg-(--ui-bg-accented)`,to:`/threads/${encodeURIComponent(t.id)}`,"aria-current":t.id===e.current?`page`:void 0,"data-surface":t.surface},{default:g(()=>[n[3]||=v(`span`,{class:`bar absolute left-0 top-1/2 h-4 w-0.5 -translate-y-1/2 rounded-full bg-primary opacity-0 transition-opacity duration-150 ease-out group-aria-[current=page]:opacity-100`,"aria-hidden":`true`},null,-1),t.live?(_(),i(`span`,Ct)):m(``,!0),v(`span`,wt,l(t.title),1),v(`span`,Tt,l(S(ke)(t.lastAt,e.now)),1)]),_:2},1032,[`to`,`aria-current`,`data-surface`])]),_:2},1024)]))),128))]),_:1}),r(y,{class:`all mt-3 flex items-center gap-1.5 px-3 py-1 text-xs font-medium text-muted no-underline transition-colors duration-150 ease-out hover:text-highlighted`,to:`/runs`,"data-testid":`all-runs`},{default:g(()=>[n[4]||=C(` All runs `,-1),r(d,{name:`i-lucide-arrow-right`,class:`size-3 transition-transform duration-150 ease-out group-hover:translate-x-0.5`,"aria-hidden":`true`})]),_:1}),v(`p`,Et,l(e.retention),1),v(`p`,Dt,[n[6]||=C(` A thread is a conversation; each message you send is a run. `,-1),r(y,{class:`text-muted hover:text-highlighted`,to:`/runs`},{default:g(()=>[...n[5]||=[C(`Runs`,-1)]]),_:1}),n[7]||=C(` lists every run across everyone's threads. `,-1)])])}}}),At={class:`empty mx-auto flex w-full max-w-2xl flex-col items-center gap-5 px-3 py-6 text-center`},jt={class:`flex flex-col gap-1.5`},Mt={class:`greeting sb-stagger text-xl font-medium tracking-tight text-highlighted`,style:{"--sb-i":`1`}},Nt={class:`sb-stagger w-full text-left`,style:{"--sb-i":`3`}},Pt={key:0,class:`chips flex flex-wrap justify-center gap-2`,"aria-label":`Suggestions`},Ft=[`onClick`],It=u({__name:`EmptyState`,props:{name:{},hour:{},suggestions:{}},emits:[`pick`],setup(e,{emit:n}){let o=n;return(n,s)=>(_(),i(`section`,At,[r(t,{draw:``,idle:``,class:`mark-lg sb-stagger text-highlighted`,style:{"font-size":`3.25rem`,"--sb-i":`0`}}),v(`div`,jt,[v(`h2`,Mt,l(S(Ne)(e.hour,e.name)),1),s[0]||=v(`p`,{class:`sub sb-stagger text-[0.875rem] text-muted`,style:{"--sb-i":`2`}},` Ask in plain words. The right agent picks it up, and you watch it work here. `,-1)]),v(`div`,Nt,[k(n.$slots,`default`)]),e.suggestions.length>0?(_(),i(`ul`,Pt,[(_(!0),i(w,null,a(e.suggestions,(e,t)=>(_(),i(`li`,{key:e,class:`sb-stagger`,style:c({"--sb-i":t+4})},[v(`button`,{type:`button`,class:`chip rounded-full border border-default px-3 py-1 text-[0.8rem] text-toned transition-[color,border-color,background-color,transform] duration-150 ease-out hover:-translate-y-px hover:border-accented hover:bg-(--ui-bg-muted) hover:text-highlighted focus-visible:outline-2 focus-visible:outline-primary active:translate-y-0`,onClick:t=>o(`pick`,e)},l(e),9,Ft)],4))),128))])):m(``,!0)]))}}),Lt=[`data-pending`],Rt={class:`meta flex items-baseline gap-2 pr-1 font-mono text-[0.7rem] text-dimmed`},zt={key:0,class:`failed text-bad`},Bt={key:0,class:`folded text-muted`},Vt=[`title`],Ht=u({__name:`PersonTurn`,props:{text:{},at:{},now:{},pending:{type:Boolean},folded:{},failed:{}},setup(e){let t=e,n=P(()=>V(t.at,t.now));return(t,a)=>(_(),i(`div`,{class:`turn person flex flex-col items-end gap-1`,"data-pending":e.pending?`1`:void 0},[v(`div`,{class:d([`bubble max-w-[min(42rem,88%)] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-(--ui-bg-accented) px-4 py-2.5 text-[0.875rem] leading-normal text-highlighted transition-opacity duration-150 ease-out`,e.pending?`opacity-70`:``])},l(e.text),3),v(`div`,Rt,[e.failed?(_(),i(`span`,zt,l(e.failed),1)):m(``,!0),r(f,{name:`sb-fade`},{default:g(()=>[e.folded?(_(),i(`span`,Bt,`↪ folded in `+l(e.folded),1)):m(``,!0)]),_:1}),v(`span`,{class:`ts select-none`,title:S(he)(e.at)},l(n.value),9,Vt)])],8,Lt))}}),Ut=[`title`],Wt={class:`preset font-medium`},Gt={class:`reason truncate font-normal opacity-80`},Kt=u({__name:`ReceiptChip`,props:{route:{}},setup(e){let t=e,n=P(()=>pe[de(t.route.preset)]);return(t,r)=>(_(),i(`span`,{class:d([`receipt inline-flex max-w-full items-baseline gap-1.5 rounded border px-1.5 py-px font-mono text-[0.7rem] leading-relaxed`,n.value]),title:`routed: ${e.route.reason}`,"data-testid":`receipt`},[v(`span`,Wt,l(e.route.preset),1),v(`span`,Gt,`· `+l(e.route.reason),1)],10,Ut))}}),qt=[`data-phase`,`data-run-id`,`data-live`],Jt={class:`head flex flex-wrap items-baseline gap-2 font-mono text-[0.7rem] text-dimmed`},Yt={key:0,class:`model`},Xt={key:1,class:`elapsed ml-auto tabular-nums`,"data-testid":`elapsed`},Zt={key:0,class:`disconnected flex items-baseline gap-2 rounded-lg border border-dashed border-bad/40 px-3 py-2 font-mono text-xs text-bad`,"data-testid":`disconnected`},Qt=[`open`],$t={class:`flex min-h-6 cursor-pointer list-none items-baseline gap-2 font-mono text-[0.7rem] text-dimmed hover:text-toned [&::-webkit-details-marker]:hidden`},en={class:`summary`},tn={class:`pl-1 pt-1`},nn={key:0,class:`py-2 font-mono text-xs text-dimmed`},rn={key:1,class:`py-2 font-mono text-xs text-warn`},an={key:2,class:`m-0 list-none p-0`},on={key:0,class:`reply`,"data-testid":`reply`},sn={key:1,class:`outcome font-mono text-xs text-warn`,"data-testid":`outcome`},cn={key:2,class:`facts flex flex-wrap items-baseline gap-x-3 font-mono text-[0.7rem] text-dimmed`},ln=u({__name:`AssistantTurn`,props:{turn:{},now:{},live:{},fetch:{}},emits:[`ended`,`input`,`stop`],setup(e,{emit:t}){let n=e,u=t,p=W(),y=p.state,b=A(n.live?`connecting`:`ended`),x=A(n.turn.route??null),ne=A(!0),T=P(()=>y.reply?.text??n.turn.answer??``),E=P(()=>y.meta?.agent??n.turn.agent??``),D=P(()=>{let e=y.meta?.model??n.turn.model;return e?ye(e):``}),O=P(()=>n.live!==null&&n.live!==void 0&&b.value!==`ended`),k=P(()=>b.value===`disconnected`),M=n.live?.serverNow?Ce({startedAt:n.turn.startedAt,receivedAt:n.turn.receivedAt,serverNow:n.live.serverNow},n.now):null,N=n.now,I=A(void 0),L=P(()=>n.turn.finished&&n.turn.finishedAt!==void 0?Math.max(0,n.turn.finishedAt-(n.turn.receivedAt??n.turn.startedAt)):I.value===void 0?M?M.elapsedMs(n.now):Math.max(0,n.now-N):I.value),ae=P(()=>ue(L.value,`clock`)),oe=P(()=>U(O.value?void 0:L.value,`run`)),z=P(()=>H(oe.value)),B=P(()=>O.value?we(y,n.now):null);F(Se,B),F(be,null),F(ve,P(()=>y.reply!==null));let ce=P(()=>O.value?K(y,p.pendingCall(),n.now):null),V=P(()=>{let e=ce.value;return k.value||!e||e.kind===`call`?null:e.kind===`starting`?{verb:`Starting`,elapsedMs:L.value,slow:!1}:{verb:re(e.elapsedMs),elapsedMs:e.elapsedMs,slow:e.slow}}),fe=P(()=>y.log.filter(e=>e.kind===`step`)),he=P(()=>fe.value.length>0?fe.value.length:n.turn.stepCount??0),ge=P(()=>n.turn.finished&&n.turn.status&&n.turn.status!==`completed`?me(n.turn.status):``),q=P(()=>`/runs/${encodeURIComponent(n.turn.id)}`),Te=se(),Ee=null;function De(e){let t=e;t.type===`route`&&typeof t.preset==`string`&&(x.value={preset:t.preset,reason:typeof t.reason==`string`?t.reason:``}),t.type===`input`&&typeof t.text==`string`&&(ne.value?ne.value=!1:u(`input`,t.text,t.at)),p.handle(e)}ee(()=>{n.live&&(u(`stop`,n.live.stopUrl),Ee=ie({url:n.live.eventsUrl,factory:Te,model:p,handle:De,onFinished:e=>{I.value=M&&e?M.elapsedAt(e.finishedAt):L.value},onEnd:()=>{I.value??=L.value,u(`ended`)},onDisconnected:()=>{I.value??=L.value}}),s(Ee.phase,e=>b.value=e,{immediate:!0}))}),te(()=>Ee?.close());let Oe=A(n.live!==null&&n.live!==void 0),J=A(n.live?`ready`:`none`);s(O,e=>{e||(Oe.value=!1)});async function ke(e){if(Oe.value=e.target.open,!Oe.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=G(await e.text()).filter(e=>e.type!==`replay_note`);for(let e of(n.turn.schema??0)>=2?le(r):r)p.handle(e);p.closePhases(),J.value=`ready`}catch{J.value=`failed`}}let Ae=P(()=>{let e=he.value;return e>0?`${e} step${e===1?``:`s`}`:O.value?`starting`:`no steps recorded`});return(t,n)=>{let s=h(`RouterLink`);return _(),i(`div`,{class:`turn assistant flex flex-col gap-2`,"data-phase":b.value,"data-run-id":e.turn.id,"data-live":O.value?`1`:void 0},[v(`div`,Jt,[r(f,{name:`sb-rise`},{default:g(()=>[x.value?(_(),j(Kt,{key:`receipt`,route:x.value},null,8,[`route`])):E.value?(_(),i(`span`,{key:`agent`,class:d([`agent rounded border px-1.5 py-px font-medium`,S(pe)[S(de)(E.value)]])},l(E.value),3)):m(``,!0)]),_:1}),D.value?(_(),i(`span`,Yt,l(D.value),1)):m(``,!0),O.value?(_(),i(`span`,Xt,l(ae.value),1)):m(``,!0)]),r(f,{name:`sb-fade`},{default:g(()=>[O.value&&V.value?(_(),j(R,{key:0,tag:`div`,verb:V.value.verb,"elapsed-ms":V.value.elapsedMs,slow:V.value.slow,model:S(y).meta?.model??e.turn.model??null},null,8,[`verb`,`elapsed-ms`,`slow`,`model`])):m(``,!0)]),_:1}),k.value?(_(),i(`p`,Zt,[n[1]||=v(`span`,null,`stream disconnected · the run may still be working`,-1),r(s,{class:`ml-auto text-primary no-underline hover:underline`,to:q.value},{default:g(()=>[...n[0]||=[C(`open the run`,-1)]]),_:1},8,[`to`])])):m(``,!0),O.value||he.value>0||J.value!==`none`?(_(),i(`details`,{key:1,class:`work group`,open:Oe.value,"data-testid":`work`,onToggle:ke},[v(`summary`,$t,[n[2]||=v(`span`,{class:`chev select-none transition-transform duration-150 ease-out group-open:rotate-90 motion-reduce:transition-none`},`❯`,-1),v(`span`,en,l(Ae.value),1)]),v(`div`,tn,[J.value===`loading`?(_(),i(`p`,nn,`reading the run's record…`)):J.value===`failed`?(_(),i(`p`,rn,[n[4]||=C(` the run's record could not be read — `,-1),r(s,{class:`text-primary no-underline hover:underline`,to:q.value},{default:g(()=>[...n[3]||=[C(`open the run`,-1)]]),_:1},8,[`to`])])):(_(),i(`ol`,an,[r(o,{name:`sb-rise`},{default:g(()=>[(_(!0),i(w,null,a(fe.value,e=>(_(),j(xe,{key:e.key,step:e,class:`mt-3 first:mt-0`,onToggleGroup:t=>S(p).toggleGroup(e)},null,8,[`step`,`onToggleGroup`]))),128))]),_:1})]))])],40,Qt)):m(``,!0),r(f,{name:`sb-rise`},{default:g(()=>[T.value?(_(),i(`div`,on,[r(_e,{text:T.value},null,8,[`text`])])):ge.value?(_(),i(`p`,sn,l(ge.value),1)):m(``,!0)]),_:1}),O.value?m(``,!0):(_(),i(`div`,cn,[v(`span`,{class:d([`dur tabular-nums`,z.value?`heat`:``]),style:c(z.value)},l(ae.value),7),r(s,{class:`open text-dimmed no-underline hover:text-primary hover:underline`,to:q.value},{default:g(()=>[...n[5]||=[C(`open run`,-1)]]),_:1},8,[`to`])]))],8,qt)}}});function un(){return{runs:new Map,connected:!1}}function dn(e,t){t.type===`upsert`&&t.run?t.run.finished||!t.run.threadKey?e.runs.delete(t.run.id):e.runs.set(t.run.id,{threadKey:t.run.threadKey,startedAt:t.run.startedAt,...t.run.label===void 0?{}:{label:t.run.label},...t.run.channelId===void 0?{}:{channelId:t.run.channelId}}):t.type===`removed`&&t.id&&e.runs.delete(t.id)}function fn(e){let t=new Map;for(let n of e.runs.values()){let e=t.get(n.threadKey)??[];e.push(n),t.set(n.threadKey,e)}return t}function pn(e,t){return t.includes(`:`)?t:`${e}:${t}`}function mn(e){let t=e.indexOf(`:`);return t>0?e.slice(0,t):`unknown`}function hn(e,t,n){if(!t.connected)return[...e];let r=fn(t),i=new Set,a=e.map(e=>{let t=pn(n,e.id);i.add(t);let a=r.get(t);if(!a)return e.live?{...e,live:!1}:e;let o=e.live?0:a.length;return{...e,live:!0,runs:e.runs+o,lastAt:Math.max(e.lastAt,...a.map(e=>e.startedAt))}}),o=[];for(let[e,t]of r){if(i.has(e))continue;let r=t.reduce((e,t)=>t.startedAt>e.startedAt?t:e),a=r.label?ce(r.label).snippet:void 0;o.push({id:e.startsWith(`${n}:`)?e.slice(n.length+1):e,title:a??r.label??e,excerpt:a??r.label??e,lastAt:r.startedAt,runs:t.length,live:!0,surface:mn(r.channelId??e)})}return o.sort((e,t)=>t.lastAt-e.lastAt),[...o,...a]}var gn={key:0,class:`mx-auto my-12 max-w-xl text-center text-toned`},_n=[`data-rail`],vn={key:0,class:`relative hidden md:block`},yn=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`],bn={class:`thread mx-auto flex min-h-[calc(100vh-8rem)] w-full max-w-3xl flex-col`},xn={key:2,class:`inline text-[0.875rem] text-toned`,"data-testid":`inline`},Sn={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`},Cn=[`href`],wn={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`},Tn=`(min-width: 48rem)`,En=u({__name:`HomePage`,setup(t){let u=T(`home`),p=z(u?.now),h=u?.conversation??``,b=y(u?.retentionDays??null),E=0,k=e=>`${e}-${++E}`,M=N([]);for(let e of u?.turns??[]){M.push({key:k(`p`),kind:`person`,text:e.request,at:e.receivedAt??e.startedAt,pending:!1});let t=!e.finished&&e.token?{eventsUrl:`/runs/${encodeURIComponent(e.id)}/events?t=${e.token}`,stopUrl:`/runs/${encodeURIComponent(e.id)}/stop?t=${e.token}`,serverNow:u?.now}:null;M.push({key:k(`a`),kind:`assistant`,turn:e,live:t,ended:e.finished})}let I=P(()=>{for(let e=M.length-1;e>=0;e--){let t=M[e];if(t.kind===`assistant`&&t.live&&!t.ended)return t}return null}),re=A(null),ie=A(0);F(e,ie);let R=A(``),B=A(void 0),ce=P(()=>Te(I.value!==null,R.value)),V=A(!1);s(R,()=>{B.value&&R.value===``&&(B.value=void 0)});function le(e){R.value=e,de()}async function de(){if(!u||V.value)return;let e=Je(R.value.trim(),u.commands);if(e===``)return;let t=N({key:k(`p`),kind:`person`,text:e,at:p.value,pending:!0});M.push(t),R.value=``,B.value=void 0,V.value=!0,ie.value++;try{let n=await fetch(u.sendUrl,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e})}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.viewPath==`string`&&typeof r.runId==`string`){let n=Oe(r.viewPath);if(!n)throw Error(`the run's view path was not one`);t.pending=!1,O.pathname()===`/threads`&&O.replaceUrl(`/threads/${encodeURIComponent(h)}`),M.push({key:k(`a`),kind:`assistant`,turn:{id:r.runId,request:e,startedAt:p.value,receivedAt:p.value,finished:!1,eventCount:0},live:{eventsUrl:n.eventsUrl,stopUrl:n.stopUrl},ended:!1});return}if(n.ok&&typeof r.reply==`string`){t.pending=!1;let e=De(r.reply);e.kind===`handBack`?(R.value=e.command,B.value=`Enter runs it`):e.kind===`inline`&&M.push({key:k(`i`),kind:`inline`,text:e.text});return}throw Error(r.error??`HTTP ${n.status}`)}catch(e){t.pending=!1,t.failed=`not sent: ${e instanceof Error?e.message:`error`}`}finally{V.value=!1}}function pe(){let e=re.value;e&&fetch(`${e}${e.includes(`?`)?`&`:`?`}mode=soft`,{method:`POST`,credentials:`same-origin`})}function me(e,t,n){let r=Pe(M.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 ${ue(Math.max(0,n-i),`clock`)}`}function he(e){e.ended=!0,re.value=null}let ge=Me({width:O.readPref(X.width),collapsed:O.readPref(X.collapsed)}),H=A(ge.width),U=A(ge.collapsed),ve=A(!1),W=A(O.mediaMatches(Tn)),ye=O.onMediaChange(Tn,e=>{W.value=e}),be=A(null),xe=A(null),Se=P(()=>W.value?U.value?`Show recent threads`:`Hide recent threads`:`Recent threads`);function Ce(){if(W.value=O.mediaMatches(Tn),W.value){U.value=!U.value,O.writePref(X.collapsed,U.value?`1`:`0`);return}ve.value=!0}function G(e,t){H.value=je(e),t&&O.writePref(X.width,String(H.value))}let K=null;function we(e){K&&G(K.startWidth+(e.clientX-K.startX),!1)}function q(){window.removeEventListener(`pointermove`,we),K&&(K=null,O.writePref(X.width,String(H.value)))}function Ee(e){e.button===0&&(e.preventDefault(),K={startX:e.clientX,startWidth:H.value},e.currentTarget?.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,we),window.addEventListener(`pointerup`,q,{once:!0}))}function ke(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()}D(()=>{window.removeEventListener(`pointermove`,we),window.removeEventListener(`pointerup`,q),ye()});function Ae(e){let t=ze(e);if(t){if(e.preventDefault(),t===`newThread`){O.navigate(`/threads`);return}if(be.value){be.value.focusFilter();return}if(U.value&&O.mediaMatches(Tn)){U.value=!1,O.writePref(X.collapsed,`0`),x().then(()=>be.value?.focusFilter());return}ve.value=!0,x().then(()=>xe.value?.focusFilter())}}let Ne=A(null),Ie=A(!1);function Le(){return document.body.scrollHeight-(window.innerHeight+window.scrollY)}s(()=>M.length,()=>{let e=Fe(Le());x().then(()=>{e?Ne.value?.scrollIntoView?.({block:`end`}):Ie.value=!0})});function Re(){Fe(Le())&&(Ie.value=!1)}function Be(){Ne.value?.scrollIntoView?.({block:`end`,behavior:`smooth`}),Ie.value=!1}ee(()=>{window.addEventListener(`scroll`,Re,{passive:!0}),window.addEventListener(`keydown`,Ae),u&&We()}),te(()=>{window.removeEventListener(`scroll`,Re),window.removeEventListener(`keydown`,Ae),Ue?.close()});let Z=N(un()),Ve=P(()=>hn(u?.conversations??[],Z,u?.lane??``)),He=P(()=>{let e=I.value?.turn.id;return Z.runs.size+(e&&!Z.runs.has(e)?1:0)}),Q=se(),Ue=null;function We(){Ue=Q(`/runs?stream=1&mine=1`);let e=!1;Ue.onopen=()=>{e&&Z.runs.clear(),e=!0,Z.connected=!0},Ue.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}dn(Z,t)}}let Ge=P(()=>{let e=M.find(e=>e.kind===`person`);return e?J(e.text):`Switchboard`});s([Ge,He],([e,t])=>{O.setTitle(t>0?`(${t}) ${e}`:e),O.setFavicon(t>0?oe:ae)},{immediate:!0});let Ke=P(()=>new Date(p.value).getHours()),qe=P(()=>M.length===0),$=u?.elsewhere,Ye=$?$.surface===`web`?`This thread is another person's conversation. You can read it here.`:`This thread lives in ${fe[$.surface]??$.surface}.`:``;return(e,t)=>{let s=ne,y=L;return _(),j(n,{title:`Threads`,nav:`home`},{leading:g(()=>[r(s,{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":Se.value,"aria-expanded":W.value?!U.value:void 0,onClick:Ce},null,8,[`icon`,`aria-label`,`aria-expanded`])]),default:g(()=>[S(u)?(_(),i(`div`,{key:1,class:d([`home gap-8 md:grid`,U.value?`md:grid-cols-[minmax(0,1fr)]`:`md:grid-cols-[var(--rail-w)_minmax(0,1fr)]`]),style:c({"--rail-w":`${H.value}px`}),"data-rail":U.value?`hidden`:`shown`},[U.value?m(``,!0):(_(),i(`aside`,vn,[r(kt,{ref_key:`rail`,ref:be,class:`sticky top-20`,rows:Ve.value,current:S(h),now:S(p),retention:S(b)},null,8,[`rows`,`current`,`now`,`retention`]),v(`div`,{class:`handle group/handle absolute inset-y-0 -right-5 flex w-3 cursor-col-resize touch-none select-none justify-center outline-none`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the recent threads column`,"aria-valuemin":S(Y).min,"aria-valuemax":S(Y).max,"aria-valuenow":H.value,tabindex:`0`,"data-testid":`rail-handle`,onPointerdown:Ee,onKeydown:ke,onDblclick:t[0]||=e=>G(S(Y).default,!0)},[...t[5]||=[v(`span`,{class:`w-px rounded-full bg-(--ui-border-accented) opacity-0 transition-opacity duration-150 ease-out group-hover/handle:opacity-100 group-focus-visible/handle:opacity-100`,"aria-hidden":`true`},null,-1)]],40,yn)])),r(y,{open:ve.value,"onUpdate:open":t[1]||=e=>ve.value=e,side:`left`,title:`Recent threads`,ui:{content:`max-w-xs`}},{body:g(()=>[r(kt,{ref_key:`sheetRail`,ref:xe,rows:Ve.value,current:S(h),now:S(p),retention:S(b)},null,8,[`rows`,`current`,`now`,`retention`])]),_:1},8,[`open`]),v(`section`,bn,[qe.value?(_(),j(It,{key:0,class:`mb-auto mt-[clamp(1.5rem,14vh,9rem)]`,name:S(u).viewer.name,hour:Ke.value,suggestions:S(u).suggestions,onPick:le},{default:g(()=>[r(lt,{modelValue:R.value,"onUpdate:modelValue":t[2]||=e=>R.value=e,mode:ce.value,hint:B.value,commands:S(u).commands,autofocus:``,"sweep-on-mount":``,onSubmit:de,onStop:pe},null,8,[`modelValue`,`mode`,`hint`,`commands`])]),_:1},8,[`name`,`hour`,`suggestions`])):(_(),j(o,{key:1,name:`sb-rise`,"move-class":`sb-move-move`,tag:`ol`,class:`transcript m-0 flex list-none flex-col gap-6 p-0 pb-32 pt-2`},{default:g(()=>[(_(!0),i(w,null,a(M,e=>(_(),i(`li`,{key:e.key},[e.kind===`person`?(_(),j(Ht,{key:0,text:e.text,at:e.at,now:S(p),pending:e.pending,folded:e.folded,failed:e.failed},null,8,[`text`,`at`,`now`,`pending`,`folded`,`failed`])):e.kind===`assistant`?(_(),j(ln,{key:1,turn:e.turn,live:e.live,now:S(p),onInput:(t,n)=>me(e,t,n),onEnded:t=>he(e),onStop:t[3]||=e=>re.value=e},null,8,[`turn`,`live`,`now`,`onInput`,`onEnded`])):(_(),i(`div`,xn,[r(_e,{text:e.text},null,8,[`text`])]))]))),128))]),_:1})),v(`div`,{ref_key:`end`,ref:Ne,class:`end`,"aria-hidden":`true`},null,512),!qe.value&&S($)?(_(),i(`p`,Sn,[C(l(S(Ye))+` `,1),S($).url?(_(),i(`a`,{key:0,href:S($).url,target:`_blank`,rel:`noopener`,class:`text-highlighted`},`Reply there ↗`,8,Cn)):S($).surface===`web`?m(``,!0):(_(),i(w,{key:1},[C(`Reply there.`)],64))])):qe.value?m(``,!0):(_(),i(`div`,wn,[r(f,{name:`sb-rise`},{default:g(()=>[Ie.value?(_(),i(`button`,{key:0,type:`button`,class:`new-pill absolute -top-9 left-1/2 -translate-x-1/2 rounded-full border border-default bg-(--ui-bg-elevated) px-3 py-1 font-mono text-[0.7rem] text-toned shadow-sm hover:text-highlighted`,onClick:Be},` ↓ new `)):m(``,!0)]),_:1}),r(lt,{modelValue:R.value,"onUpdate:modelValue":t[4]||=e=>R.value=e,mode:ce.value,hint:B.value,commands:S(u).commands,autofocus:``,onSubmit:de,onStop:pe},null,8,[`modelValue`,`mode`,`hint`,`commands`])]))])],14,_n)):(_(),i(`div`,gn,`This page needs its seed.`))]),_:1})}}});export{En as default};
@@ -1 +0,0 @@
1
- import{An as e,Cn as t,Cr as n,Gr as r,Ii as i,Li as a,Mn as o,Pi as s,Sn as c,Tr as l,Xr as u,_r as d,bn as f,dr as p,ir as m,ji as h,kn as g,ln as _,rn as v,t as y,xi as b,xn as x,yn as S}from"./browser-B6T5hjfR.js";import{r as C,t as w}from"./indexFormat-B-pd4r7Y.js";import{A as T,F as E,L as D,M as O,O as k,R as A,T as j,a as M,b as N,c as P,g as F,j as ee,k as te,l as I,m as ne,o as L,t as R,v as re,y as ie}from"./indexRow-Bde9OZxG.js";import"./format-BldUwl_R.js";import{a as ae,n as oe,t as se}from"./durationTone-U_rOqo6r.js";import{c as ce,l as le,n as ue,t as de,w as z}from"./sseReplay-DPwdsaok.js";import{t as B}from"./StatusDot-BOaw8le9.js";var V={},H={viewBox:`0 0 16 16`,class:`inline-block size-[1em] shrink-0`,"aria-hidden":`true`};function fe(e,n){return d(),t(`svg`,H,[...n[0]||=[f(`path`,{fill:`currentColor`,d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z`},null,-1)]])}var pe=ae(V,[[`render`,fe]]),U={"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`},me={getting_ready:`getting ready`,finishing_up:`finishing up`};function he(e){return U[me[e]]}var ge={id:`timeline`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`,"data-testid":`timeline`},_e={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},ve={class:`ml-auto flex items-baseline gap-3 font-normal normal-case tracking-normal`},ye=[`href`],be={class:`lede font-mono text-sm text-toned`},xe={class:`shape tabular-nums`},Se={key:0,class:`current text-muted`},Ce={key:0,class:`note mt-0.5 text-xs text-muted`},we=[`aria-label`],Te=[`title`,`data-term`],Ee={class:`legend mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs`},De=[`title`,`data-term`],Oe={class:`term text-muted`},ke={class:`ms tabular-nums text-toned`},Ae=[`title`],je={class:`ranked mt-1 flex flex-col gap-1 font-mono text-xs`},Me={class:`ms w-14 shrink-0 tabular-nums text-toned`},Ne=[`href`,`data-anchor`,`onClick`],W=o({__name:`TimelineSection`,props:{vm:{},eventsHref:{}},emits:[`reveal`],setup(e,{emit:r}){let o=e,l=r;function u(e){return`${A(e.ms,`clock`)} ${e.term}${e.hatched?` (in flight)`:``}`}function p(){y.copyText(JSON.stringify(o.vm.debug,null,2))}return(r,o)=>(d(),t(`section`,ge,[f(`h2`,_e,[o[0]||=f(`span`,null,`Where the time went`,-1),f(`span`,ve,[e.eventsHref?(d(),t(`a`,{key:0,class:`text-dimmed no-underline hover:text-primary hover:underline`,href:e.eventsHref,title:`the stored events, as JSON lines`},`raw events`,8,ye)):c(``,!0),f(`button`,{type:`button`,class:`debug cursor-pointer text-dimmed hover:text-toned`,title:`the partition and the raw span names, for a bug report`,onClick:p},` Copy debug JSON `)])]),f(`p`,be,[f(`span`,xe,a(e.vm.shown?e.vm.total:e.vm.lede),1),e.vm.current?(d(),t(`span`,Se,` · `+a(e.vm.current),1)):c(``,!0)]),(d(!0),t(_,null,n(e.vm.captions,e=>(d(),t(`p`,{key:e,class:`caption mt-0.5 text-xs text-muted`},a(e),1))),128)),e.vm.note?(d(),t(`p`,Ce,a(e.vm.note),1)):c(``,!0),e.vm.shown?(d(),t(_,{key:1},[f(`div`,{class:`bar mt-2.5 flex h-2 w-full overflow-hidden rounded-sm`,role:`img`,"aria-label":e.vm.lede},[(d(!0),t(_,null,n(e.vm.bar,(e,n)=>(d(),t(`div`,{key:n,class:s([`seg h-full`,[h(U)[e.term],e.hatched?`paint-hatched hatched`:``]]),style:i({width:`${e.pct}%`}),title:u(e),"data-term":e.term},null,14,Te))),128))],8,we),f(`ul`,Ee,[(d(!0),t(_,null,n(e.vm.legend,e=>(d(),t(`li`,{key:e.term,class:`flex items-baseline gap-1.5 cursor-help`,title:e.definition,"data-term":e.term},[f(`span`,{class:s([`swatch inline-block size-2 shrink-0 self-center rounded-[2px]`,h(U)[e.term]])},null,2),f(`span`,Oe,a(e.term),1),f(`span`,ke,a(e.text),1)],8,De))),128))]),e.vm.ranked.length>0?(d(),t(_,{key:0},[f(`h3`,{class:`ranked-head mt-3 inline-block cursor-help text-xs font-medium text-muted underline decoration-dotted decoration-(--ui-border-accented) underline-offset-2`,title:e.vm.rankedNote},` Longest steps `,8,Ae),f(`ol`,je,[(d(!0),t(_,null,n(e.vm.ranked,(e,r)=>(d(),t(`li`,{key:r,class:`flex items-baseline gap-2`},[f(`span`,Me,a(h(A)(e.ms,`clock`)),1),f(`a`,{class:`label min-w-0 truncate text-muted no-underline hover:text-primary hover:underline`,href:`#${e.anchor}`,"data-anchor":e.anchor,title:`scroll to this step`,onClick:v(t=>l(`reveal`,e.anchor),[`prevent`])},a(e.label),9,Ne),(d(!0),t(_,null,n(e.facts,e=>(d(),t(`span`,{key:e,class:`fact shrink-0 rounded border border-accented px-1 text-dimmed`},a(e),1))),128))]))),128))])],64)):c(``,!0)],64)):c(``,!0)]))}}),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.`,Pe=`currently delivering`,Fe=`getting ready: not recorded (too large)`,Ie=`no timing data`,Le=`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=T(t,{window:n,owner:r,finished:i,losses:e.losses}),o=ee(a),s=A(o.totalS*1e3,`clock`),c=t.find(e=>e.name===`request`&&e.parentSpanId===void 0),l=e.phase===`live`?Re(t,r,n):void 0,u=ze(e,l),d=l?z(l.name):``,f={window:n,owner:r,phase:e.phase,partition:a,spans:t.map(e=>({spanId:e.spanId,parentSpanId:e.parentSpanId,name:e.name,startedAt:e.startedAt,endedAt:e.endedAt,status:e.status,attrs:e.attrs}))};if(e.untimed)return{total:s,current:u,openStep:d,captions:[],rankedNote:K,debug:f,lede:s,shown:!1,bar:[],legend:[],ranked:[],note:Ie};let p={total:s,current:u,openStep:d,captions:[k(`before`,Y(c,`queuedBeforeMs`)),k(`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?Fe:``};let m=t=>t===`not recorded`?`not recorded${e.truncated?` (too large)`:``}`:t===`not loaded`?Le:t,h=te(a)&&o.items.length>0,g=h?`${s} — ${o.items.map(({term:e,s:t})=>`${A(t*1e3,`clock`)} ${m(e)}`).join(` · `)}`:a.windowMs>0?`${s} — ${m(Be(a))}`:s,_=h?o.items.map(({term:t,s:n})=>({term:t,text:A(n*1e3,`clock`),definition:t===`not recorded`&&e.truncated?`${G[t]} (too large)`:G[t]})):[];return{...p,lede:g,shown:h,bar:h?Ve(a,l):[],legend:_,ranked:h?He(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 Re(e,t,n){let r=new Map(e.map(e=>[e.spanId,e])),i=e=>{let t=1,n=new Set([e.spanId]),i=e.parentSpanId?r.get(e.parentSpanId):void 0;for(;i&&!n.has(i.spanId);)n.add(i.spanId),t++,i=i.parentSpanId?r.get(i.parentSpanId):void 0;return t},a;for(let o of e){if(o.endedAt!==void 0||o.startedAt>=n.end)continue;let e=O(o.name,t);if(e?.kind!==`counted`||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),O(r.name,n)?.kind===`background`)return!0;r=r.parentSpanId?t.get(r.parentSpanId):void 0}return!1}function ze(e,t){return e.phase===`delivering`?Pe:e.phase===`ended`?le(e.delivery??{}):t?`currently ${q[t.bucket]} ${A(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 Be(e){let t=[`getting ready`,-1];for(let n of Z(e))n[1]>t[1]&&(t=n);return t[0]}function Ve(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 He(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`||O(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-Ue(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??z(r.name),ms:d,facts:We(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 Ue(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 We(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 ${A(t.timeoutMs,`clock`)}`),typeof t.waitedMs==`number`&&n.push(`waited ${A(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 Ge=[`data-state`],Ke={key:0,class:`loading py-2 font-mono text-xs text-dimmed`},qe={key:1,class:`failed py-2 font-mono text-xs text-warn`},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={key:0,class:`m-0 mt-1 list-none p-0`},$e=o({__name:`RunTimeline`,props:{run:{},land:{},fetch:{}},setup(n){let i=n,o=b(`loading`),s=ce(),v=S(()=>{if(o.value!==`ready`)return null;s.state.traceVersion;let e=i.run,t=e.receivedAt??e.startedAt,n=D(e)??(e.finishedAt===void 0?0:Math.max(0,e.finishedAt-t));return J({spans:s.spanSet(),losses:s.losses(t),window:{start:t,end:t+n},owner:Q(e.agent),totalMs:n,phase:`ended`,delivery:{finishedAt:e.finishedAt,sealedAt:e.sealedAt,replyOk:e.replyOk},...e.truncated===void 0?{}:{truncated:e.truncated},...(e.schema??0)>=2?{}:{untimed:!0},callTitle:s.callHeadline})}),x=S(()=>`/runs/${encodeURIComponent(i.run.id)}/events`),C=e=>`/runs/${encodeURIComponent(i.run.id)}#${e}`;function w(e){y.navigate(C(e))}let T=S(()=>{if(o.value!==`ready`||i.land===void 0)return null;s.state.traceVersion;let e=i.land,t=i.run.session;if(t&&e===t.request)return{anchor:`request`,what:`the request`};let n=t&&t.range!==`broken`?t.range.to:void 0;if(n!==void 0&&e===n&&s.state.reply)return{anchor:`reply`,what:`the reply`};let r=s.landing(e);return r?{anchor:r.anchor,what:O(r.step),step:r.step}:null});function O(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 k=b(null),A=S(()=>T.value?`${i.land}@${T.value.anchor}`:null);return r(A,e=>{e!==null&&m().then(()=>{let e=(T.value?.step?k.value?.querySelector(`li.step`):null)??k.value;e&&(e.scrollIntoView?.({block:`center`}),e.classList.add(`revealed`),setTimeout(()=>e.classList.remove(`revealed`),1500))})}),p(async()=>{let e=i.fetch??((...e)=>globalThis.fetch(...e));try{let t=await e(x.value,{credentials:`same-origin`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=de(await t.text()).filter(e=>e.type!==`replay_note`);for(let e of(i.run.schema??0)>=2?E(n):n)s.handle(e);s.closePhases(),o.value=`ready`}catch{o.value=`failed`}}),(r,i)=>{let p=l(`RouterLink`);return d(),t(`div`,{class:`runtimeline pl-5`,"data-state":o.value},[o.value===`loading`?(d(),t(`p`,Ke,`reading the run's record…`)):o.value===`failed`?(d(),t(`p`,qe,[i[2]||=g(` the run's record could not be read — `,-1),e(p,{class:`text-primary no-underline hover:underline`,to:`/runs/${encodeURIComponent(n.run.id)}`},{default:u(()=>[...i[1]||=[g(`open the run`,-1)]]),_:1},8,[`to`])])):v.value?(d(),t(_,{key:2},[e(W,{vm:v.value,"events-href":x.value,onReveal:w},null,8,[`vm`,`events-href`]),T.value?(d(),t(`div`,{key:0,ref_key:`landingEl`,ref:k,class:`landing mb-4 rounded-lg border border-default px-(--sb-gutter) py-2`,"data-turn":n.land,"data-anchor":T.value.anchor},[f(`p`,Ye,[f(`span`,Xe,`turn `+a(n.land),1),f(`span`,Ze,`· `+a(T.value.what),1),e(p,{class:`page ml-auto shrink-0 text-primary no-underline hover:underline`,to:C(T.value.anchor),title:`the same step on the run's own page`},{default:u(()=>[...i[3]||=[g(`open on the run's page ↗`,-1)]]),_:1},8,[`to`])]),T.value.step?(d(),t(`ol`,Qe,[e(ue,{step:T.value.step,onToggleGroup:i[0]||=e=>h(s).toggleGroup(T.value.step)},null,8,[`step`])])):c(``,!0)],8,Je)):c(``,!0)],64)):c(``,!0)],8,Ge)}}}),et=[`id`,`data-run-id`,`data-round`,`data-thread`],tt=[`open`],$={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`},nt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},rt={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},it={key:3,class:`scope min-w-0 flex-1 truncate text-toned`},at=[`title`],ot=[`data-heat`],st={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},ct={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)`},lt={key:0,class:`round shrink-0 rounded border border-accented px-1.5 font-mono text-[0.7rem] font-medium tabular-nums text-toned`},ut={key:2,class:`snippet min-w-0 flex-1 truncate text-muted`},dt={key:3,class:`scope min-w-0 flex-1 truncate text-highlighted`},ft=[`title`],pt={class:`elapsed shrink-0 text-right font-mono text-xs tabular-nums text-ok sm:min-w-[4.5em]`,title:`running for`},mt={class:`count shrink-0 text-right font-mono text-xs tabular-nums text-dimmed sm:min-w-[6em]`},ht=o({__name:`RunFoldRow`,props:{run:{},now:{},label:{},open:{type:Boolean},land:{}},setup(n){let o=n,p=b(o.open===!0);r(()=>o.open,e=>{e&&(p.value=!0)});let m=S(()=>C(o.run.label||F(o.run.id))),_=S(()=>re(o.run)),y=S(()=>ne(o.run)),T=S(()=>o.run.finished),E=S(()=>o.run.finished&&o.run.status&&o.run.status!==`completed`?ie(o.run.status):``),D=S(()=>se(o.run.finished&&typeof o.run.finishedAt==`number`?o.run.finishedAt-o.run.startedAt:void 0,`run`)),O=S(()=>oe(D.value));function k(e){p.value=e.target.open}return(r,o)=>{let b=l(`RouterLink`);return d(),t(`li`,{id:`run-${n.run.id}`,class:s([`fold group border-b border-muted`,n.run.finished?`finished`:`live`]),"data-run-id":n.run.id,"data-round":n.run.round,"data-thread":n.run.thread},[T.value?(d(),t(`details`,{key:0,class:`group/fold`,open:p.value,onToggle:k},[f(`summary`,$,[o[2]||=f(`span`,{class:`chev select-none text-xs text-dimmed transition-transform group-open/fold:rotate-90 motion-reduce:transition-none`,"aria-hidden":`true`},`❯`,-1),e(B,{tone:_.value,label:h(N)(n.run),tip:h(P)(n.run)},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,nt,a(n.label),1)):c(``,!0),m.value.agent?(d(),t(`span`,{key:1,class:s([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider opacity-55`,h(R)[h(M)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,it,a(m.value.scope),1)):(d(),t(`span`,rt,a(m.value.snippet),1)),E.value?(d(),t(`span`,{key:4,class:s([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem]`,_.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},a(E.value),3)):c(``,!0),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-dimmed`,title:h(j)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,at),f(`span`,{class:s([`elapsed shrink-0 text-right font-mono text-xs tabular-nums sm:min-w-[4.5em]`,[O.value?`heat`:`text-muted`,D.value.level>=2?`font-medium`:``]]),style:i(O.value),"data-heat":D.value.level,title:`start to finish`},a(h(I)(n.run,n.now)),15,ot),f(`span`,st,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(F)(n.run.id)}`,onClick:o[0]||=v(()=>{},[`stop`])},{default:u(()=>[...o[1]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]),p.value?(d(),x($e,{key:0,run:n.run,land:n.land},null,8,[`run`,`land`])):c(``,!0)],40,tt)):(d(),t(`div`,ct,[o[4]||=f(`span`,{class:`chev select-none text-xs text-transparent`,"aria-hidden":`true`},`❯`,-1),e(B,{tone:_.value,label:h(N)(n.run),tip:h(P)(n.run),pulse:``},null,8,[`tone`,`label`,`tip`]),n.label?(d(),t(`span`,lt,a(n.label),1)):c(``,!0),m.value.agent?(d(),t(`span`,{key:1,class:s([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider`,h(R)[h(M)(m.value.agent)]])},a(m.value.agent),3)):c(``,!0),m.value.snippet===void 0?(d(),t(`span`,dt,a(m.value.scope),1)):(d(),t(`span`,ut,a(m.value.snippet),1)),f(`span`,{class:`when shrink-0 font-mono text-xs tabular-nums text-muted`,title:h(j)(n.run)},a(h(w)(n.run.startedAt,n.now)),9,ft),f(`span`,pt,a(h(I)(n.run,n.now)),1),f(`span`,mt,a(h(L)(n.run)),1),e(b,{class:`open shrink-0 font-mono text-xs text-primary no-underline hover:underline`,to:y.value,"aria-label":`open run ${n.run.label||h(F)(n.run.id)}`},{default:u(()=>[...o[3]||=[g(`open ↗`,-1)]]),_:1},8,[`to`,`aria-label`])]))],10,et)}}});export{he as a,W as i,Q as n,pe as o,J as r,ht as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./AppShell-DAtHiuI6.js";import{An as r,Cn as i,Cr as a,Gr as o,Ii as s,Li as c,Mn as l,Pi as u,Sn as d,Tr as f,Xr as p,_r as m,bn as h,c as g,dr as _,hr as v,ji as y,kn as b,l as x,ln as S,o as C,t as w,xi as T,xn as E,yi as D,yn as O}from"./browser-B6T5hjfR.js";import{t as k}from"./Tooltip-DYZZ4l4V.js";import{t as A}from"./InputMenu-C6aPpe30.js";import{b as j,x as M}from"./main-Dkcbtu3u.js";import{t as N}from"./eventSource-Bj_dZf6M.js";import{t as P}from"./wallClock-DmaC1sKA.js";import{n as ee,r as F,t as te}from"./indexFormat-B-pd4r7Y.js";import{C as I,E as L,S as R,T as z,_ as B,a as V,b as H,c as U,d as W,f as G,g as K,h as q,i as J,l as Y,m as X,o as Z,p as ne,r as Q,s as $,t as re,u as ie,v as ae,w as oe,x as se,y as ce}from"./indexRow-Bde9OZxG.js";import{i as le}from"./format-BldUwl_R.js";import{i as ue,n as de,t as fe}from"./durationTone-U_rOqo6r.js";import{t as pe}from"./RunsTabs-YSbUu5py.js";import{t as me}from"./StatusDot-BOaw8le9.js";var he={class:`flex items-baseline gap-1.5 whitespace-pre-line px-2 py-1 text-xs`},ge=[`data-kind`,`aria-label`,`href`],_e=[`data-kind`],ve=l({__name:`SourceMark`,props:{kind:{},tip:{},url:{}},setup(e){let t=e,n=()=>J[t.kind]??t.kind;return(t,r)=>{let a=k;return e.url?(m(),E(a,{key:0},{content:p(()=>[h(`span`,he,[e.kind===`slack`?(m(),E(ue,{key:0})):d(``,!0),h(`span`,null,c(e.tip),1)])]),default:p(()=>[h(`a`,{class:`source linked pointer-events-auto w-[1.6em] shrink-0 rounded border border-transparent text-center text-[0.8rem] text-toned opacity-0 transition-opacity hover:border-primary/30 hover:bg-primary/10 hover:text-primary focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none`,"data-kind":e.kind,"aria-label":`open the ${n()} thread (new tab)`,href:e.url,target:`_blank`,rel:`noopener noreferrer`},`↗`,8,ge)]),_:1})):(m(),i(`span`,{key:1,class:`source w-[1.6em] shrink-0`,"data-kind":e.kind,"aria-hidden":`true`},null,8,_e))}}}),ye=[`data-run-id`,`data-started-at`,`data-persisted`,`data-expires-at`],be={class:`pointer-events-auto flex items-center max-sm:order-1`},xe=[`data-user-id`,`data-surface`],Se={class:`surface mr-1.5 inline-block w-[3.6em] rounded border border-accented text-center font-mono text-[0.62rem] text-dimmed`},Ce={class:`name`},we={key:1,class:`who shrink-0 max-sm:hidden sm:w-[14em]`,"aria-hidden":`true`},Te=[`data-agent-hue`],Ee=[`href`],De={class:`owner font-normal text-dimmed`},Oe={class:`name`},ke={key:5,class:`snippet min-w-0 truncate text-muted max-sm:order-6 max-sm:basis-full max-sm:whitespace-normal max-sm:pl-5 max-sm:text-[0.8rem] max-sm:leading-snug max-sm:line-clamp-2 sm:flex-1`},Ae={class:`hidden sm:contents`},je={class:`expires pointer-events-auto shrink-0 font-mono text-xs tabular-nums text-warn max-sm:order-11`},Me=[`data-heat`],Ne={class:`count shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-9 max-sm:text-dimmed sm:min-w-[6em] sm:text-muted`},Pe={class:`actions flex shrink-0 justify-end max-sm:order-5 sm:w-[2em]`},Fe=l({__name:`RunRow`,props:{run:{},now:{},retentionMs:{}},setup(e){let n=e,a=O(()=>F(n.run.label||K(n.run.id))),o=O(()=>ne(n.run,a.value.scope)),l=O(()=>ae(n.run)),g=O(()=>X(n.run)),_=O(()=>I(n.run)),v=O(()=>L(n.run)),b=O(()=>q(n.run)),S=O(()=>n.run.threadKey?oe(n.run.threadKey):null),C=O(()=>ie(n.run,n.retentionMs)),T=O(()=>C.value!==void 0&&C.value-n.now<=864e5),A=O(()=>!n.run.finished&&!n.run.stop),j=O(()=>fe(n.run.finished&&typeof n.run.finishedAt==`number`?n.run.finishedAt-n.run.startedAt:void 0,`run`)),M=O(()=>de(j.value)),N=O(()=>n.run.finished&&n.run.status&&n.run.status!==`completed`?ce(n.run.status):``),P=O(()=>n.run.stop&&!(n.run.finished&&n.run.status)?R(n.run.stop):``),W=D({soft:!1,hard:!1}),G=O(()=>[...S.value?[{label:`Open thread`,icon:`i-lucide-messages-square`,to:S.value}]:[],...b.value?[{label:`Open in ${J[_.value.kind]??_.value.kind}`,icon:`i-lucide-external-link`,to:b.value,target:`_blank`}]:[],...A.value?[{label:`Stop (soft)`,icon:`i-lucide-octagon-pause`,disabled:W.soft,onSelect:()=>Q(`soft`)},{label:`Kill (hard)`,icon:`i-lucide-octagon-x`,color:`error`,disabled:W.hard,onSelect:()=>Q(`hard`)}]:[]]);function Q(e){(e!==`hard`||w.confirm(`Hard stop: abort this run now with no summary and free its sandbox?`))&&(W[e]=!0,fetch(se(n.run,e),{method:`POST`,credentials:`same-origin`}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>{W[e]=!1}))}function ue(e){e.target?.closest(`a, button`)||w.navigate(g.value)}return(n,S)=>{let w=f(`RouterLink`),D=k,O=x,A=t;return m(),i(`li`,{class:u([`run group relative isolate rounded-md border-b border-muted hover:bg-(--ui-bg-muted) focus-within:bg-(--ui-bg-muted)`,[e.run.finished?`finished`:`live`,T.value?`leaving`:``]]),"data-run-id":e.run.id,"data-started-at":String(e.run.startedAt),"data-persisted":e.run.persisted?`1`:void 0,"data-expires-at":C.value===void 0?void 0:String(C.value),onClick:ue},[r(w,{class:`row absolute inset-0 rounded-md focus-visible:outline-2 focus-visible:outline-primary`,to:g.value,"aria-label":`open run ${e.run.label||y(K)(e.run.id)}`},null,8,[`to`,`aria-label`]),h(`div`,{class:u([`body pointer-events-none relative z-[1] flex min-w-0 flex-wrap items-center gap-x-2.5 px-2 max-sm:gap-y-1.5 max-sm:py-3 sm:flex-nowrap sm:py-2`,[e.run.finished?`text-muted`:``,T.value?`opacity-85`:``]])},[h(`span`,be,[r(me,{tone:l.value,label:y(H)(e.run),tip:y(U)(e.run),pulse:!e.run.finished},null,8,[`tone`,`label`,`tip`,`pulse`])]),r(D,{text:y(z)(e.run),ui:{text:`whitespace-pre-line`}},{default:p(()=>[h(`span`,{class:u([`when pointer-events-auto shrink-0 font-mono tabular-nums max-sm:order-7 max-sm:pl-5 max-sm:text-xs max-sm:text-dimmed sm:min-w-[8.5em] sm:text-[0.8rem]`,e.run.finished?`text-dimmed`:`text-muted`])},c(y(ee)(e.run.startedAt,e.now)),3)]),_:1},8,[`text`]),v.value?(m(),E(D,{key:0,text:y(B)(e.run)},{default:p(()=>[h(`span`,{class:u([`who pointer-events-auto min-w-0 shrink-0 truncate text-[0.8rem] max-sm:order-7 max-sm:text-xs sm:w-[14em]`,e.run.finished?`text-dimmed`:`text-muted`]),"data-user-id":e.run.userId,"data-surface":_.value.kind},[h(`span`,Se,c(_.value.kind),1),h(`span`,Ce,c(v.value),1)],10,xe)]),_:1},8,[`text`])):(m(),i(`span`,we)),a.value.agent?(m(),i(`span`,{key:2,class:u([`agent shrink-0 rounded border px-1.5 font-mono text-[0.68rem] font-medium uppercase tracking-wider max-sm:order-2`,[y(re)[y(V)(a.value.agent)],e.run.finished?`opacity-55`:``]]),"data-agent-hue":y(V)(a.value.agent)},c(a.value.agent),11,Te)):d(``,!0),o.value?(m(),E(D,{key:3,text:o.value},{default:p(()=>[h(`a`,{class:`repo pointer-events-auto min-w-0 shrink-0 rounded border border-accented bg-accented/50 px-1.5 font-mono text-[0.72rem] font-medium leading-normal text-toned no-underline hover:border-(--ui-text-dimmed) hover:text-highlighted max-sm:order-3`,href:`https://github.com/${o.value}`,target:`_blank`,rel:`noopener noreferrer`},[h(`span`,De,c(o.value.slice(0,o.value.indexOf(`/`)+1)),1),h(`span`,Oe,c(o.value.slice(o.value.indexOf(`/`)+1)),1)],8,Ee)]),_:1},8,[`text`])):(m(),i(`span`,{key:4,class:u([`scope min-w-0 shrink-0 truncate font-medium max-sm:order-3`,e.run.finished?`text-toned`:`text-highlighted`])},c(a.value.scope),3)),a.value.snippet===void 0?d(``,!0):(m(),i(`span`,ke,c(a.value.snippet),1)),N.value?(m(),i(`span`,{key:6,class:u([`outcome shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,l.value===`red`?`border-bad/30 text-bad`:`border-warn/30 text-warn`])},c(N.value),3)):d(``,!0),P.value?(m(),i(`span`,{key:7,class:u([`stopbadge shrink-0 rounded border px-1.5 font-mono text-[0.7rem] max-sm:order-10`,e.run.stop?.state===`stopped`?`border-accented text-muted`:`border-warn/30 text-warn`])},c(P.value),3)):d(``,!0),h(`span`,Ae,[r(ve,{kind:_.value.kind,tip:y(B)(e.run),url:b.value||void 0},null,8,[`kind`,`tip`,`url`])]),T.value&&C.value!==void 0?(m(),E(D,{key:8,text:`removed at ${y(le)(C.value)}`},{default:p(()=>[h(`span`,je,`gone `+c(y(te)(C.value,e.now)),1)]),_:1},8,[`text`])):d(``,!0),r(D,{text:e.run.finished?`start to finish`:`running for`},{default:p(()=>[h(`span`,{class:u([`elapsed pointer-events-auto ml-auto shrink-0 text-right font-mono text-xs tabular-nums max-sm:order-4 sm:min-w-[4.5em]`,e.run.finished?[M.value?`heat`:`text-muted`,j.value.level>=2?`font-medium`:``]:`text-ok`]),style:s(e.run.finished?M.value:void 0),"data-heat":e.run.finished?j.value.level:void 0},c(y(Y)(e.run,e.now)),15,Me)]),_:1},8,[`text`]),S[0]||=h(`span`,{class:`hidden text-xs text-dimmed max-sm:order-8 max-sm:inline`,"aria-hidden":`true`},`·`,-1),r(D,{text:y($)(e.run)},{default:p(()=>[h(`span`,Ne,c(y(Z)(e.run)),1)]),_:1},8,[`text`]),h(`span`,Pe,[G.value.length>0?(m(),E(A,{key:0,items:G.value,content:{align:`end`}},{default:p(()=>[r(O,{class:`pointer-events-auto -my-1.5 -mr-1`,size:`sm`,color:`neutral`,variant:`ghost`,icon:`i-lucide-ellipsis-vertical`,"aria-label":`Run actions`})]),_:1},8,[`items`])):d(``,!0)])],2)],10,ye)}}}),Ie={class:`view-as-picker inline-flex items-center gap-2`},Le={key:0,class:`ml-2 truncate font-mono text-[0.6875rem] text-dimmed`},Re={class:`font-mono`},ze={key:0,class:`text-bad`},Be=l({__name:`ViewAsPicker`,props:{people:{}},setup(t){let n=t,a=T(!1),o=T(``),s=O(()=>n.people.map(e=>({label:e.name??e.id,value:e.id,...e.name?{suffix:e.id}:{}})));async function l(t){let n=typeof t==`string`?t.trim():``;if(!n)return;a.value=!0,o.value=``;let r=await e(n);r.ok||(a.value=!1,o.value=r.message)}return(e,t)=>{let n=A;return m(),i(`span`,Ie,[r(n,{id:`view-as-pick`,"model-value":``,items:s.value,"value-key":`value`,"filter-fields":[`label`,`value`],"create-item":``,placeholder:`View as…`,"aria-label":`view the dashboard as a person`,disabled:a.value,size:`xs`,class:`w-60 text-xs`,ui:{itemTrailing:`min-w-0`},"onUpdate:modelValue":l,onCreate:l},{"item-trailing":p(({item:e})=>[e.suffix?(m(),i(`span`,Le,c(e.suffix),1)):d(``,!0)]),"create-item-label":p(({item:e})=>[t[0]||=b(` View as `,-1),h(`span`,Re,c(e),1)]),_:1},8,[`items`,`disabled`]),o.value?(m(),i(`span`,ze,c(o.value),1)):d(``,!0)])}}}),Ve={class:`conn flex items-center gap-1.5`},He={id:`state`,class:`text-xs text-muted`},Ue={class:`toolbar mb-1.5 flex items-center gap-4 px-2 text-xs text-muted`},We={id:`livecount`,class:`count font-mono tabular-nums`},Ge={class:`filter ml-auto inline-flex items-center gap-4`},Ke={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},qe=[`checked`],Je={id:`minehint`,class:`sr-only`},Ye={class:`toggle inline-flex cursor-pointer select-none items-center gap-1.5 text-toned hover:text-highlighted`},Xe=[`checked`],Ze={id:`retention`,class:`sr-only`},Qe={key:0,class:`banner mb-3 rounded-md border border-warn px-2.5 py-1.5 text-[0.8rem] text-warn`,role:`status`},$e={id:`runs`,class:`m-0 list-none border-t border-muted p-0`},et={key:0,id:`leaving`,class:`divider flex items-baseline gap-2 border-b border-dashed border-warn/40 px-2 pb-1.5 pt-3 font-mono text-[0.72rem] uppercase tracking-wider text-warn`,role:`separator`},tt={key:1,id:`empty`,class:`empty px-2 py-2 text-muted`},nt={key:1,class:`pager mt-3 flex items-baseline gap-2 px-2 text-[0.8rem] text-muted`,"aria-label":`Completed runs pages`},rt={class:`range font-mono tabular-nums text-dimmed`},it=l({__name:`RunsIndexPage`,setup(e){let t=C(`runs`),s=t?.all??!1,l=t?.mine??!1,u=new URLSearchParams(w.search());if(!u.has(`mine`)&&!u.has(`all`)&&t){let e=w.readPref(Q.mine)===`1`,t=w.readPref(Q.all)===`1`;(e||t)&&w.navigate(A(t,e))}let x=t?.asUser?`Only the runs ${t.asUser.name??`you`} requested`:`Only the runs this session requested from Threads. Sign in with the email of your Slack account to see your Slack runs too.`;function A(e,t){let n=[e?`all=1`:``,t?`mine=1`:``].filter(Boolean).join(`&`);return n?`/runs?${n}`:`/runs`}let ee=t?.olderThan!==void 0,F=t?.retentionDays??null,I=F===null?void 0:F*864e5,L=g(F),R=D(new Map);for(let e of t?.rows??[])R.set(e.id,e);let z=P(t?.now),B=T({tone:`amber`,text:`connecting…`}),V=O(()=>[...R.values()].sort((e,t)=>t.startedAt-e.startedAt)),H=O(()=>V.value.filter(e=>!e.finished).length),U=O(()=>I===void 0?-1:V.value.findIndex(e=>{let t=ie(e,I);return t!==void 0&&t-z.value<=864e5})),K=O(()=>U.value===-1?V.value:V.value.slice(0,U.value)),q=O(()=>U.value===-1?[]:V.value.slice(U.value)),J=s?`All runs`:`Live runs`;o(H,e=>{w.setTitle((e>0?`(${e}) `:``)+J),w.setFavicon(e>0?M:j)},{immediate:!0});function Y(e){let t=e.target.checked;w.writePref(Q.all,t?`1`:`0`),w.navigate(A(t,l))}function X(e){let t=e.target.checked;w.writePref(Q.mine,t?`1`:`0`),w.navigate(A(s,t))}let Z=O(()=>t?.olderThan===void 0?``:te(t.olderThan,z.value)),ne=N(),$=null;return _(()=>{$=ne(`/runs?stream=1${s?`&all=1`:``}${l?`&mine=1`:``}`);let e=!1;$.onopen=()=>{if(e){w.reload();return}e=!0,B.value={tone:`green`,text:`connected`}},$.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let n=t.type===`removed`?t.id:t.run?.id,r=n?R.get(n):void 0;if(ee&&!r)return;let i=W(t,s,r?.persisted===!0);i.op===`upsert`?R.set(i.run.id,G(R.get(i.run.id),i.run)):i.op===`remove`&&R.delete(i.id)},$.onerror=()=>{$&&$.readyState===2?B.value={tone:`red`,text:`disconnected`}:B.value={tone:`amber`,text:`connecting…`}}}),v(()=>{$?.close()}),(e,o)=>{let u=k,g=f(`RouterLink`);return m(),E(n,{title:y(J),nav:`runs`},{status:p(()=>[h(`span`,Ve,[r(me,{tone:B.value.tone,label:B.value.text},null,8,[`tone`,`label`]),h(`span`,He,c(B.value.text),1)])]),default:p(()=>[r(pe,{current:`runs`}),h(`div`,Ue,[h(`span`,We,c(H.value)+` running`,1),h(`span`,Ge,[y(t)?.viewAs?(m(),E(Be,{key:0,people:y(t).viewAs.people},null,8,[`people`])):d(``,!0),r(u,{text:y(x)},{default:p(()=>[h(`label`,Ke,[h(`input`,{id:`showmine`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:y(l),"aria-describedby":`minehint`,onChange:X},null,40,qe),o[0]||=b(` Show only mine `,-1)])]),_:1},8,[`text`]),h(`span`,Je,c(y(x)),1),h(`label`,Ye,[h(`input`,{id:`showdone`,type:`checkbox`,class:`accent-(--ui-bg-inverted)`,checked:y(s),"aria-describedby":`retention`,onChange:Y},null,40,Xe),o[1]||=b(` Show completed `,-1)]),r(u,{text:y(L)},{default:p(()=>[...o[2]||=[h(`span`,{class:`help inline-flex size-[1.1em] cursor-help items-center justify-center rounded-full border border-accented text-[0.7rem] leading-none text-dimmed hover:border-(--ui-text-dimmed) hover:text-toned`,tabindex:`0`},`?`,-1)]]),_:1},8,[`text`]),h(`span`,Ze,c(y(L)),1)])]),y(t)?.storeUnavailable?(m(),i(`p`,Qe,c(y(t).storeUnavailable),1)):d(``,!0),h(`ul`,$e,[(m(!0),i(S,null,a(K.value,e=>(m(),E(Fe,{key:e.id,run:e,now:y(z),"retention-ms":y(I)},null,8,[`run`,`now`,`retention-ms`]))),128)),q.value.length>0?(m(),i(`li`,et,[...o[3]||=[h(`span`,{"aria-hidden":`true`,class:`text-sm tracking-normal`},`⏳`,-1),h(`span`,{class:`whitespace-nowrap`},`Leaving within a day`,-1),h(`span`,{class:`normal-case tracking-normal text-dimmed max-sm:hidden`},`— each row says when it is removed`,-1)]])):d(``,!0),(m(!0),i(S,null,a(q.value,e=>(m(),E(Fe,{key:e.id,run:e,now:y(z),"retention-ms":y(I)},null,8,[`run`,`now`,`retention-ms`]))),128)),V.value.length===0?(m(),i(`li`,tt,c(y(l)?y(s)?`No runs of yours.`:`No active runs of yours.`:y(s)?`No runs.`:`No active runs.`),1)):d(``,!0)]),y(s)&&(y(t)?.olderHref||y(t)?.olderThan!==void 0)?(m(),i(`nav`,nt,[y(t)?.olderThan===void 0?d(``,!0):(m(),i(S,{key:0},[r(g,{class:`text-primary hover:underline`,to:A(!0,y(l))},{default:p(()=>[...o[4]||=[b(`← Newest runs`,-1)]]),_:1},8,[`to`]),h(`span`,rt,`· runs finished before `+c(Z.value),1)],64)),y(t)?.olderHref?(m(),E(g,{key:1,class:`older ml-auto text-primary hover:underline`,to:y(t).olderHref},{default:p(()=>[...o[5]||=[b(`Older runs →`,-1)]]),_:1},8,[`to`])):d(``,!0)])):d(``,!0)]),_:1},8,[`title`])}}});export{it as default};
@@ -1 +0,0 @@
1
- var e=6e4,t=1440*e;10*e,5*e,60*e,10*e,60*e,30*t;var n={general:2,coding:15,review:5,research:3,explore:15,conductor:15};n.coding,n.coding,n.review;var r={marginMinutes:5,chunkMinutes:5,mergeChunkMinutes:5,busyRetryMinutes:2};export{r as n,e as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./budgets-BvWYKPsY.js";import{i as n}from"./format-BldUwl_R.js";function r(e,t){if(e===void 0)return``;switch(t){case`precise`:return i(e);case`clock`:return a(e);case`report`:return o(e)}}function i(e){if(!(e>=0))return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let n=Math.round(e/1e3);return`${Math.floor(n/60)}m ${s(n%60)}s`}function a(e){if(!(e>0))return`0s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${s(t%60)}s`:`${Math.floor(n/60)}h ${s(n%60)}m`}function o(e){if(!(e>=0))return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${s(t%60)}s`:`${Math.floor(n/60)}h ${s(n%60)}m`}function s(e){return e<10?`0${e}`:String(e)}function c(e,t){let n=e.finishedAt??t;if(n!==void 0)return Math.max(0,n-(e.receivedAt??e.startedAt))}var l=`A-Za-z0-9:@._-`;RegExp(`^[${l}]{1,128}$`),RegExp(`[^${l}]`,`g`);function u(e){return e.type===`span_start`||e.type===`span_end`}var d=t;e.marginMinutes*d,e.chunkMinutes*d,e.mergeChunkMinutes*d,e.busyRetryMinutes*d;function f(e,t){return/^[A-Za-z0-9_-]{1,64}$/.test(e)?`synth:${e}`:`synth:${t}`}function p(e){let t=[];for(let n of e)n.type===`span_end`&&n.name===`run.agent`&&t.push({spanId:n.spanId,startedAt:n.startedAt,endedAt:n.startedAt+n.durationMs});return t}function m(e,t){let n;for(let r of e)r.startedAt<=t&&t<=r.endedAt&&(!n||r.endedAt-r.startedAt<n.endedAt-n.startedAt)&&(n=r);return n?.spanId}function h(e){let t=p(e),n=new Set;for(let t of e){if(!u(t))continue;let e=t.attrs??{};t.name.startsWith(`tool.`)&&typeof e.callId==`string`&&n.add(e.callId)}let r=[],i=new Map;return e.forEach((e,a)=>{switch(e.type){case`tool_call`:{let o=e.callId;if(o===void 0||e.at===void 0||n.has(o)){r.push(e);return}let s=f(o,a);r.push(g(s,`tool.${e.tool}`,e.at,m(t,e.at),{callId:o}),e),i.set(o,{spanId:s,startedAt:e.at});return}case`tool_result`:{if(r.push(e),e.callId===void 0)return;let n=i.get(e.callId);if(!n)return;i.delete(e.callId);let a=e.at??n.startedAt,o={ok:e.ok,callId:e.callId};e.exitCode!==void 0&&(o.exitCode=e.exitCode),e.infra&&(o.infra=!0),r.push(_(n.spanId,`tool.${e.tool}`,n.startedAt,Math.max(0,a-n.startedAt),m(t,n.startedAt),o,e.ok?`ok`:`error`));return}default:r.push(e)}}),r}function g(e,t,n,r,i){return{type:`span_start`,spanId:e,...r===void 0?{}:{parentSpanId:r},name:t,...i?{attrs:i}:{},at:n}}function _(e,t,n,r,i,a,o=`ok`){return{type:`span_end`,spanId:e,...i===void 0?{}:{parentSpanId:i},name:t,startedAt:n,durationMs:r,status:o,...a?{attrs:a}:{},at:n+r}}function v(e,t,n){let r=e.get(t.spanId);if(t.type===`span_start`){if(r)return;e.set(t.spanId,{traceId:n,spanId:t.spanId,...t.parentSpanId===void 0?{}:{parentSpanId:t.parentSpanId},name:t.name,startedAt:t.at??0,attrs:t.attrs??{}});return}e.set(t.spanId,{traceId:n,spanId:t.spanId,...t.parentSpanId===void 0?r?.parentSpanId===void 0?{}:{parentSpanId:r.parentSpanId}:{parentSpanId:t.parentSpanId},name:t.name,startedAt:t.startedAt,endedAt:t.startedAt+t.durationMs,durationMs:t.durationMs,status:t.status,...t.error===void 0?{}:{errorMessage:t.error},attrs:{...r?.attrs??{},...t.attrs??{}}})}function y(){let e,t,n=[];return{push(r){e?t&&r.seq!==void 0&&t.seq!==void 0&&r.seq>t.seq+1&&t.at!==void 0&&r.at!==void 0&&n.push({kind:`gap`,fromSeq:t.seq+1,toSeq:r.seq-1,from:Math.min(t.at,r.at),to:Math.max(t.at,r.at)}):e={seq:r.seq??1,at:r.at},r.type===`run_note`&&r.kind===`spans_dropped`&&r.from!==void 0&&r.to!==void 0&&r.to>=r.from&&n.push({kind:`note`,from:r.from,to:r.to}),t={seq:r.seq,at:r.at}},losses(t={}){let r=t.elided??[],i=(e,t)=>r.some(n=>n.fromSeq<=e&&t<=n.toSeq),a=[];e&&e.seq>1&&t.windowStart!==void 0&&e.at!==void 0&&e.at>t.windowStart&&a.push({from:t.windowStart,to:e.at,kind:`lost`});for(let e of n)a.push(e.kind===`note`?{from:e.from,to:e.to,kind:`lost`}:{from:e.from,to:e.to,kind:i(e.fromSeq,e.toSeq)?`elided`:`lost`});return a}}}new Set(`request,slack.receive,dispatch.history,dispatch.admission,dispatch.ack_card,dispatch.gate.repo,dispatch.gate.pr_head,dispatch.workspace.attach,dispatch.gate.attached_head,dispatch.mcp_discovery,dispatch.compose,dispatch.channel_visibility,dispatch.repo_context,dispatch.memory_read,dispatch.refuse,dispatch.ship_preflight,dispatch.ledger_claim,dispatch.route,run.agent,run.command,run.reading_diff,run.settle_reviewed_head,run.description_turn,run.verdict_turn,run.observe_workspace,run.pr_post_step,run.review_post_step,run.reading_diff_join,run.pr_description_join,model.turn,ship.round,post.card_close,post.reply`.split(`,`));var b=new Set([`slack.receive`,`dispatch.history`,`dispatch.admission`,`dispatch.ack_card`,`dispatch.gate.repo`,`dispatch.gate.pr_head`,`dispatch.workspace.attach`,`dispatch.gate.attached_head`,`dispatch.mcp_discovery`,`dispatch.compose`,`dispatch.channel_visibility`,`dispatch.repo_context`,`dispatch.memory_read`,`dispatch.refuse`,`dispatch.ship_preflight`,`dispatch.ledger_claim`,`dispatch.route`]),x=new Set([`run.observe_workspace`,`run.pr_post_step`,`run.review_post_step`,`run.reading_diff_join`,`run.pr_description_join`]),S=new Set([`request`,`run.agent`,`ship.round`,`run.settle_reviewed_head`,`run.description_turn`,`run.verdict_turn`,`post.card_close`,`post.reply`]),C=new Set([`run.reading_diff`]);function w(e,t){if(C.has(e))return{kind:`background`};if(S.has(e))return{kind:`uncounted`};if(e===`model.turn`)return{kind:`counted`,bucket:`thinking`};if(e===`run.command`||e.startsWith(`run.command.`))return{kind:`counted`,bucket:t===`command`?`tools`:`getting_ready`};if(b.has(e)||e.startsWith(`dispatch.workspace.attach.`))return{kind:`counted`,bucket:`getting_ready`};if(x.has(e))return{kind:`counted`,bucket:`finishing_up`};if(e.startsWith(`tool.`)||e.startsWith(`mcp.`))return{kind:`counted`,bucket:`tools`}}function T(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),w(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=w(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(E(e.from,n)),m.add(E(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`&&E(e.from,n)<=r&&E(e.to,n)>=i)){_+=a;continue}if(t.losses.some(e=>e.kind===`elided`&&E(e.from,n)<=r&&E(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 E(e,t){return Math.min(t.end,Math.max(t.start,e))}function D(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 O(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 k(e,t){if(t===void 0||t<6e4)return;let n=r(t,`clock`);return e===`before`?`queued ${n} before we saw it`:`queued ${n} behind the previous run`}var A=`unfinished — no finish recorded`,j=1024,M=1024*j,N=1024*M;2*N,200*M,16*M,8*N,16*M,2*N,1.5*M,64*j,new TextEncoder;function P(e){return e===`completed`?`succeeded`:e===`stopped_soft`?`stopped early`:e===`stopped_hard`?`killed`:e}function F(e){return e.state===`stopped`?P(`stopped_${e.mode}`):`${e.state} (${e.mode})`}function I(e){return e.finished?e.provisional?A:e.status?P(e.status):`finished`:`live`}function L(e){return e.finished&&!e.persisted&&e.sealedAt===void 0}function R(e){return e.finished?L(e)||e.provisional?`amber`:e.status===`failed`||e.status===`stopped_hard`||e.status===`interrupted`?`red`:e.status===`stopped_soft`?`amber`:`grey`:`green`}function z(e){return e===`coding`||e===`review`||e===`research`||e===`general`?e:`other`}var B={coding:`text-ok bg-ok/8 border-ok/25`,review:`text-review bg-review/8 border-review/25`,research:`text-research bg-research/8 border-research/25`,general:`text-info bg-info/8 border-info/25`,other:`text-toned bg-accented/60 border-accented`};function V(e){let t=e.stepCount??e.eventCount;return`${t} event${t===1?``:`s`}`}function H(e){return e.stepCount===void 0?`events published, span records included`:`content events; span records excluded`}function U(e){return`/runs/${encodeURIComponent(e.id)}${!e.finished&&e.token?`?t=${encodeURIComponent(e.token)}`:``}`}function W(e,t){return`/runs/${encodeURIComponent(e.id)}/stop?t=${encodeURIComponent(e.token??``)}&mode=${encodeURIComponent(t)}`}function G(e){return e.length>8?`${e.slice(0,8)}…`:e}function K(e,t){let n=c(e,e.finished?void 0:t);return n===void 0?``:r(n,`clock`)}function q(e){return typeof e.receivedAt==`number`?` (received to finish)`:``}function J(e){let t=e.channelId??``,n=t.indexOf(`:`),r=n===-1?`unknown`:t.slice(0,n);if(e.userName)return{kind:r,identity:e.userName};let i=e.userId??``,a=i.indexOf(`:`);return{kind:r,identity:a===-1?i:i.slice(a+1)}}function Y(e){return`/threads/${encodeURIComponent(e)}`}var X={mine:`sb.runs.mine`,all:`sb.runs.all`},Z={slack:`Slack`,http:`HTTP ingress`,mcp:`MCP`,cli:`CLI`,web:`Web`};function Q(e){if(!e.finished)return e.activity?`now: ${e.activity}`:`starting…`;let t=I(e),n=c(e);return n!==void 0&&(t+=` in ${r(n,`clock`)}${q(e)}`),L(e)&&(t+=` · delivering the reply`),e.status&&e.status!==`completed`&&e.activity&&(t+=`\n${e.activity}`),t}function $(e){let t=typeof e.receivedAt==`number`?`received ${n(e.receivedAt)}\n`:``;return t+=`started ${n(e.startedAt)}`,e.finished&&typeof e.finishedAt==`number`&&(t+=`\nfinished ${n(e.finishedAt)}`),t}function ee(e){let t=J(e);return`via ${Z[t.kind]??t.kind}${t.identity?` · ${t.identity}`:``}`}function te(e){return J(e).identity}function ne(e,t){return e.repo??(/^[\w.-]+\/[\w.-]+$/.test(t)?t:``)}function re(e){return e.sourceUrl&&/^https?:\/\//.test(e.sourceUrl)?e.sourceUrl:``}function ie(e,t,n){return e.type===`upsert`&&e.run?!t&&e.run.finished?{op:`remove`,id:e.run.id}:{op:`upsert`,run:e.run}:e.type===`removed`&&e.id?t&&n?{op:`keep`}:{op:`remove`,id:e.id}:{op:`keep`}}function ae(e,t){if(!e||!e.finished)return t;let n={...t};return n.finishedAt===void 0&&e.finishedAt!==void 0&&(n.finishedAt=e.finishedAt),n.status===void 0&&e.status!==void 0&&(n.status=e.status),n.receivedAt===void 0&&e.receivedAt!==void 0&&(n.receivedAt=e.receivedAt),n.sealedAt===void 0&&e.sealedAt!==void 0&&(n.sealedAt=e.sealedAt),n.replyOk===void 0&&e.replyOk!==void 0&&(n.replyOk=e.replyOk),n}function oe(e,t){return e.finished&&typeof e.finishedAt==`number`&&typeof t==`number`?e.finishedAt+t:void 0}var se=864e5;export{T as A,J as C,A as D,te as E,h as F,u as I,c as L,w as M,y as N,k as O,v as P,r as R,F as S,$ as T,ee as _,z as a,I as b,Q as c,ie as d,ae as f,G as g,re as h,Z as i,D as j,O as k,K as l,U as m,se as n,V as o,ne as p,X as r,H as s,B as t,oe as u,R as v,Y as w,W as x,P as y};
@@ -1,9 +0,0 @@
1
- import{An as e,Cn as t,Cr as n,Gr as r,Ii as i,Li as a,Mn as o,Pi as s,Sn as c,Zn as l,_r as u,bn as d,dr as f,ji as p,kn as m,ln as h,rn as g,xi as _,xn as v,yi as y,yn as b}from"./browser-B6T5hjfR.js";import{n as x}from"./wallClock-DmaC1sKA.js";import{I as S,L as C,M as w,N as T,P as E,R as D}from"./indexRow-Bde9OZxG.js";import{i as O,n as k,t as A}from"./format-BldUwl_R.js";import{n as j,r as M,t as N}from"./durationTone-U_rOqo6r.js";function ee(e,t){let n=e.ownerDocument;e.textContent=``;let r=String(t??``).replace(/\r\n?/g,`
2
- `).split(`
3
- `),i=/^(\s*)([-*]|\d+[.)])\s+(.*)$/,a=/^(```|#{1,6}\s|>)/;function o(e,t){let r=n.createElement(t);return e.appendChild(r),r}function s(e,t){t&&e.appendChild(n.createTextNode(t))}function c(e){let t=e.trim();return t[0]===`|`&&(t=t.slice(1)),t[t.length-1]===`|`&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function l(e){let t=e.trim();return t.indexOf(`|`)<0||!/^[\s:|-]+$/.test(t)?!1:c(t).every(e=>/^:?-+:?$/.test(e))}function u(e,t){let n=e[t];return n.indexOf(`|`)<0||l(n)||t+1>=e.length||!l(e[t+1])?!1:c(n).length===c(e[t+1]).length}function d(e,t){let n=0,r=``,i=()=>{s(e,r),r=``};for(;n<t.length;){let a=t[n];if(a==="`"){let r=t.indexOf("`",n+1);if(r>n+1){i(),o(e,`code`).textContent=t.slice(n+1,r),n=r+1;continue}}else if(a===`*`&&t[n+1]===`*`){let r=t.indexOf(`**`,n+2);if(r>n+2){i(),d(o(e,`strong`),t.slice(n+2,r)),n=r+2;continue}}else if(a===`*`||a===`_`){let r=n>0?t[n-1]:``;if(/\S/.test(t[n+1]||``)&&!/\w/.test(r)){let r=-1;for(let e=n+2;e<t.length;e++)if(t[e]===a&&/\S/.test(t[e-1])&&!/\w/.test(t[e+1]||``)){r=e;break}if(r>0){i(),d(o(e,`em`),t.slice(n+1,r)),n=r+1;continue}}}else if(a===`[`){let r=/^\[([^\]\n]+)\]\(([^)\s]+)\)/.exec(t.slice(n));if(r&&/^https?:\/\//i.test(r[2])){i();let t=o(e,`a`);t.setAttribute(`href`,r[2]),t.setAttribute(`rel`,`noopener noreferrer`),t.setAttribute(`target`,`_blank`),d(t,r[1]),n+=r[0].length;continue}}r+=a,n++}i()}function f(e,t,n=0){let r=0;for(;r<t.length;){let s=t[r];if(/^\s*$/.test(s)){r++;continue}if(/^```/.test(s)){let n=[];for(r++;r<t.length&&!/^```\s*$/.test(t[r]);)n.push(t[r++]);r++,o(o(e,`pre`),`code`).textContent=n.join(`
4
- `);continue}let l=/^(#{1,6})\s+(\S.*?)\s*$/.exec(s);if(l){d(o(e,`h`+l[1].length),l[2]),r++;continue}if(s[0]===`>`&&n<8){let i=[];for(;r<t.length&&t[r][0]===`>`;)i.push(t[r++].replace(/^>\s?/,``));f(o(e,`blockquote`),i,n+1);continue}if(u(t,r)){let n=c(s),i=o(e,`table`),a=o(o(i,`thead`),`tr`);for(let e of n)d(o(a,`th`),e);r+=2;let l=null;for(;r<t.length&&t[r].indexOf(`|`)>=0&&!u(t,r);){l||=o(i,`tbody`);let e=c(t[r]),a=o(l,`tr`);for(let t=0;t<n.length;t++)d(o(a,`td`),t<e.length?e[t]:``);r++}continue}if(i.test(s)){let n=[],a;for(;r<t.length&&(a=i.exec(t[r]))!==null;)n.push({indent:a[1].length,ordered:/^\d/.test(a[2]),text:a[3]}),r++;let s=n[0].indent,c=o(e,n[0].ordered?`ol`:`ul`),l=null,u=null;for(let e of n)e.indent>s&&l?(u||=o(l,e.ordered?`ol`:`ul`),d(o(u,`li`),e.text)):(l=o(c,`li`),u=null,d(l,e.text));continue}let p=[];for(;r<t.length&&!/^\s*$/.test(t[r])&&!a.test(t[r])&&!i.test(t[r])&&!u(t,r);)p.push(t[r++]);p.length===0&&p.push(t[r++]),d(o(e,`p`),p.join(`
5
- `))}}f(e,r)}var P=o({__name:`MarkdownText`,props:{text:{}},setup(e){let n=e,i=_(null);function a(){let e=i.value;if(e)try{ee(e,n.text)}catch{e.textContent=n.text}}return f(a),r(()=>n.text,a),(e,n)=>(u(),t(`div`,{ref_key:`root`,ref:i,class:`md prose prose-sm prose-neutral dark:prose-invert min-w-0 max-w-none flex-1 whitespace-pre-wrap break-words font-sans text-[0.875rem] leading-normal [&_a]:font-medium [&_a]:decoration-(--ui-text-dimmed) [&_a]:underline-offset-[3px] [&_a:hover]:decoration-current [&_blockquote]:my-1.5 [&_h1]:font-medium [&_h1]:tracking-tight [&_h2]:font-medium [&_h2]:tracking-tight [&_h3]:font-medium [&_h3]:tracking-tight [&_h4]:font-medium [&_strong]:font-medium [&_li>ol]:my-0.5 [&_li>ul]:my-0.5 [&_li]:my-0.5 [&_li]:whitespace-pre-wrap [&_ol]:my-1.5 [&_ol]:whitespace-normal [&_p]:my-1.5 [&_pre]:my-2 [&_pre]:whitespace-pre [&_table]:whitespace-normal [&_ul]:my-1.5 [&_ul]:whitespace-normal`},null,512))}}),F=[`user`,`channel`,`defaults`];function I(e){return typeof e==`string`&&F.includes(e)}function te(){let e=[],t=null,n=0,r=[];function i(e){return typeof e==`number`&&isFinite(e)?e:void 0}function a(e){return typeof e==`string`?e:``}function o(n){let r={index:e.length,calls:[]};return n&&(r.narration=n),e.push(r),t=r,r}function s(e){return e<1e3?String(e):e<1e6?(Math.round(e/100)/10).toFixed(1)+`k`:(Math.round(e/1e5)/10).toFixed(1)+`M`}function c(e){let t=/\((\d+) chars(?:, (\d+) lines)?\)$/.exec(e.summary);if(t)return t[2]?Number(t[2]):1;if(e.output)return e.output.split(`
6
- `).length}function l(e){let t=[],n=e.result;if(!n)return t;n.infra?t.push(`sandbox error`):e.shell?t.push(n.exitCode===void 0?n.ok?`exit 0`:`error`:`exit `+n.exitCode):n.ok||t.push(`error`);let r=c(n);return r!==void 0&&r>1&&t.push(r+` lines`),e.durationMs!==void 0&&t.push(D(e.durationMs,`precise`)),t}function u(e,t){let n={ok:t.ok===!0,infra:t.infra===!0,summary:a(t.summary),output:a(t.output),at:i(t.at)},o=i(t.exitCode);o!==void 0&&(n.exitCode=o),e.result=n;let s=r.indexOf(e);s!==-1&&r.splice(s,1),e.status=n.infra?`infra`:n.ok?`ok`:`failed`,e.status!==`ok`&&(e.tags=e.tags.concat(e.status)),e.startedAt!==void 0&&n.at!==void 0&&n.at>=e.startedAt&&(e.durationMs=n.at-e.startedAt),e.facts=l(e)}let d=[[`tests`,/\b(npm|pnpm|yarn|bun)\s+(run\s+)?test\b|\b(vitest|jest|pytest|mocha|go test|cargo test)\b/],[`build`,/\b(npm|pnpm|yarn|bun)\s+run\s+(build|typecheck|lint)\b|\b(tsc|make|cargo build|go build|eslint|prettier)\b/],[`install`,/\b(npm|pnpm|yarn|bun)\s+(i|install|ci|add)\b|\bpip3?\s+install\b|\bapt(-get)?\s+install\b|\bbrew\s+install\b/],[`git`,/(^|[\s;&|(])(git|gh)\s/],[`network`,/(^|[\s;&|(])(curl|wget)\s/],[`read`,/(^|[\s;&|(])(cat|sed|head|tail|less|ls|find|grep|rg|wc|tree|pwd|echo|env|which|stat|file|diff)\b/]];function f(e){let t=e.replace(/^(\s*cd\s+("[^"]*"|'[^']*'|\S+)\s*(&&|;)\s*)+/,``);return t.trim()?t:e}function p(e){let t=f(e);for(let[e,n]of d)if(n.test(t))return e;return`shell`}function m(e,t){let n=t?f(e):e,r=n.indexOf(`
7
- `),i=r===-1?n:n.slice(0,r).trimEnd();return i.length<e.length?i+` …`:i}function h(e,t){let o=a(e.tool),s=o===`bash`,c=t||o,l=s&&c.startsWith(`$ `)?c.slice(2):!s&&c.startsWith(o+` `)?c.slice(o.length+1):c,u={id:a(e.callId)||`c`+ ++n,tool:o,title:l,headline:m(l,s),shell:s,quiet:o===`update_status`,tags:[s?p(l):o],status:`running`,startedAt:i(e.at),facts:[]};return r.push(u),u}function g(t){for(let n=e.length-1;n>=0;n--)for(let r of e[n].calls)if(r.id===t)return{step:e[n],call:r};return null}function _(t){let n=a(t.callId);if(!n)return null;for(let t=e.length-1;t>=0;t--)for(let r of e[t].calls)if(r.id===n&&!r.result)return{step:e[t],call:r};return null}function v(e){if(!e||typeof e!=`object`)return[];let n=e;switch(n.type){case`input`:{let e={kind:`input`,text:a(n.text),messageId:a(n.messageId),at:i(n.at)},t=n.source;if(t&&typeof t==`object`){let n=t,r={};a(n.url)&&(r.url=a(n.url)),a(n.channel)&&(r.channel=a(n.channel)),a(n.user)&&(r.user=a(n.user)),a(n.run)&&(r.run=a(n.run)),Object.keys(r).length>0&&(e.source=r)}return[e]}case`answer`:return[{kind:`answer`,text:a(n.text),at:i(n.at)}];case`pr_opened`:{let e=i(n.number);return!a(n.url)||e===void 0||!Number.isInteger(e)||e<=0?[]:[{kind:`pr_opened`,url:a(n.url),number:e,created:n.created===!0,at:i(n.at)}]}case`pushed_head`:return!a(n.ref)||!a(n.sha)?[]:[{kind:`pushed_head`,ref:a(n.ref),sha:a(n.sha),at:i(n.at)}];case`run_meta`:{if(!a(n.agent))return[];let e={kind:`meta`,agent:a(n.agent),model:a(n.model),at:i(n.at)};return a(n.effort)&&(e.effort=a(n.effort)),a(n.harness)&&(e.harness=a(n.harness)),I(n.harnessScope)&&(e.harnessScope=n.harnessScope),a(n.repo)&&(e.repo=a(n.repo)),a(n.ref)&&(e.ref=a(n.ref)),i(n.pr)!==void 0&&Number.isInteger(n.pr)&&n.pr>0&&(e.pr=n.pr),/^[0-9a-f]{7,40}$/i.test(a(n.headSha))&&(e.headSha=a(n.headSha)),[e]}case`context`:return[{kind:`context`,text:a(n.text),at:i(n.at)}];case`reference`:{let e=i(n.messages);return!a(n.url)||!a(n.channelName)||e===void 0?[]:[{kind:`reference`,url:a(n.url),channelName:a(n.channelName),messages:e,text:a(n.text),at:i(n.at)}]}case`notes`:return[{kind:`note`,text:a(n.text),noteKind:`notes`,at:i(n.at)}];case`replay_note`:return[{kind:`replay_note`,text:a(n.summary)}];case`run_note`:return[{kind:`note`,text:a(n.summary),noteKind:a(n.kind),mode:a(n.mode)||void 0,at:i(n.at)}];case`assistant`:return[{kind:`step`,step:o({text:a(n.text),at:i(n.at)})}];case`review_artifact`:return[];case`span_start`:{let e=a(n.name),t=a(n.spanId);return!e||!t||e.startsWith(`tool.`)||e.startsWith(`mcp.`)||e===`model.turn`?[]:[{kind:`span`,spanId:t,name:e,open:!0,at:i(n.at)}]}case`span_end`:{let e=a(n.name),r=a(n.spanId),o=i(n.durationMs);if(!e||!r||o===void 0)return[];let c=n.status===`error`?`error`:`ok`,u=typeof n.attrs==`object`&&n.attrs!==null?n.attrs:{};if(e===`model.turn`){t=null;let e=[],c=i(u.inputTokens),l=i(u.outputTokens),d=i(u.cacheReadTokens);c!==void 0&&e.push(s(c)+` in`),l!==void 0&&e.push(s(l)+` out`),d!==void 0&&e.push(s(d)+` cached`);let f=i(u.ttftMs);f!==void 0&&e.push(`first token `+D(f,`precise`));let p=i(u.thinkingMs);p!==void 0&&e.push(`thinking `+D(p,`precise`));let m=i(u.textMs);m!==void 0&&e.push(`writing `+D(m,`precise`));let h=a(u.model);return[{kind:`turn`,spanId:r,label:`Thought for `+D(o,`precise`),facts:e,durationMs:o,...h?{model:h}:{},at:i(n.at)}]}if(e.startsWith(`tool.`)||e.startsWith(`mcp.`)){if(!e.startsWith(`tool.`))return[];let t=a(u.callId);if(!t)return[];let n=g(t);return!n||n.call.durationMs!==void 0?[]:(n.call.durationMs=o,n.call.facts=l(n.call),[{kind:`result`,step:n.step,call:n.call}])}let d=i(n.startedAt);return[{kind:`span`,spanId:r,name:e,open:!1,durationMs:o,status:c,at:i(n.at),...d===void 0?{}:{startedAt:d}}]}case`artifact`:{let e=a(n.key),t=a(n.name);if(!e||!t)return[];let r={key:e,name:t,size:i(n.size)??0,contentType:a(n.contentType),at:i(n.at)},o=a(n.messageId),s=a(n.callId),c=n.direction===`in`&&o?{...r,direction:`in`,messageId:o}:n.direction===`out`&&s?{...r,direction:`out`,callId:s}:void 0;return c?[{kind:`artifact`,artifact:c}]:[]}case`skill_use`:{let e=a(n.skill);if(!e)return[];let r=[];t||r.push({kind:`step`,step:o()});let s=a(n.source),c={name:e,description:a(n.description),agent:a(n.agent),bodyBytes:i(n.bodyBytes)??0,at:i(n.at)};return/^https?:\/\//.test(s)&&(c.source=s),r.push({kind:`skill`,step:t,skill:c}),r}case`tool_call`:{let e=[];t||e.push({kind:`step`,step:o()});let r=h(n,a(n.summary));return t.calls.push(r),e.push({kind:`call`,step:t,call:r}),e}case`tool_result`:{let e=_(n);if(e)return u(e.call,n),[{kind:`result`,step:e.step,call:e.call}];let r=[];t||r.push({kind:`step`,step:o()});let i=h(n,``);return i.startedAt=void 0,u(i,n),t.calls.push(i),r.push({kind:`call`,step:t,call:i}),r}default:return[]}}function y(){return r.length>0?r[0]:null}return{push:v,pending:y,steps:()=>e}}var L={clone:`cloning the repo`,"checkout-clone":`cloning the checkout`,"worktree-clone":`cloning the worktree`,"worktree-detach":`checking out the expected commit`,"op-clone":`cloning the op tree`,fetch:`fetching the branch`,"wake-fetch":`fetching the latest commits`,"reclaim-fetch":`fetching to reclaim the mirror`,"for-each-ref":`listing the branches`,checkout:`checking out the branch`,"checkout-update":`updating the checkout`,"rev-parse":`reading the commit`,"cat-file":`checking the mirror for the commit`,"show-ref":`reading the branch tip`,"detect-default-branch":`detecting the default branch`,git:`a git command`,"git-setup":`configuring git`,"stage-perms":`securing the credential stage`,install:`installing dependencies`,build:`building`,test:`running the tests`,"clear-markers":`clearing the build markers`,"lockfile-key":`hashing the lockfile`,"deps-store-dir":`preparing the dependency store`,"deps-scratch":`cloning a scratch tree for the dependency install`,"deps-install":`installing the dependency store`,"deps-harden":`locking down the installed dependencies`,"deps-commit":`recording the installed dependencies`,"deps-adopt":`adopting the dependency store`,"deps-restore-scratch":`restoring dependencies to scratch`,"deps-restore-chown":`setting the restored dependencies' owner`,"deps-restore-commit":`recording the restored dependencies`,"deps-scratch-chown":`setting the dependency scratch owner`,"deps-evict":`evicting an old dependency store`,"unlink-deps-view":`unlinking the dependency view`,"clear-installing-marker":`clearing the install marker`,chown:`setting the workspace owner`,"worktree-chown":`setting the worktree owner`,"op-chown":`setting the op tree's owner`,"worktree-clean":`cleaning the worktree`,"clean-workspace":`cleaning the workspace`,"clean-before-restore":`cleaning before the restore`,"break-mirror":`removing the mirror's config (fault injection)`,"unmount-restores":`unmounting earlier restores`,"mirror-restore-extract":`extracting the mirror snapshot`,"checkout-restore-extract":`extracting the checkout snapshot`,"deps-restore-extract":`extracting the dependency snapshot`,evict:`evicting a stale tree`,"thread-dir":`preparing a directory`,"threads-dir":`preparing a directory`,"op-dir":`preparing a directory`,"ops-dir":`preparing a directory`,"stage-dir":`preparing a directory`,stat:`checking a file`,"boot-id":`reading the container's identity`,touch:`touching a marker`,nproc:`counting CPUs`,mutex_wait:`waiting for the workspace`,kill:`stopping the previous step`};Object.keys(L);function R(e){return Object.prototype.hasOwnProperty.call(L,e)?e:void 0}function z(e){let t=R(e);if(t!==void 0)return L[t];if(e.endsWith(`-stale-sweep`)){let t=R(e.slice(0,-12));if(t!==void 0)return`clearing leftovers before ${L[t]}`}}var B={request:`the request`,"slack.receive":`receiving`,"dispatch.history":`reading the thread`,"dispatch.admission":`checking the thread`,"dispatch.ack_card":`posting the status card`,"dispatch.gate.repo":`checking the repo`,"dispatch.gate.pr_head":`checking the PR`,"dispatch.workspace.attach":`attaching the workspace`,"dispatch.gate.attached_head":`checking out the branch`,"dispatch.mcp_discovery":`loading tools`,"dispatch.compose":`preparing the prompt`,"dispatch.channel_visibility":`checking the channel`,"dispatch.repo_context":`reading the repo's context`,"dispatch.memory_read":`recalling memory`,"dispatch.refuse":`refusing`,"dispatch.ship_preflight":`checking the ship request`,"dispatch.ledger_claim":`claiming the run's row`,"dispatch.route":`picking the preset`,"run.agent":`the agent loop`,"run.command":`the command`,"run.reading_diff":`reading the diff (in parallel)`,"run.settle_reviewed_head":`re-checking the moved branch`,"run.description_turn":`asking for the PR description`,"run.verdict_turn":`asking for the verdict`,"run.observe_workspace":`checking the workspace`,"run.pr_post_step":`posting the PR`,"run.review_post_step":`posting the review`,"run.reading_diff_join":`waiting for the diff`,"run.pr_description_join":`waiting for the PR description`,"model.turn":`a model turn`,"ship.round":`a ship round`,"post.card_close":`closing the card`,"post.reply":`posting the reply`},V=`a Switchboard step`;function H(e){if(e in B)return B[e];if(e.startsWith(`tool.`))return e.slice(5)||`a Switchboard step`;if(e.startsWith(`mcp.`)){let t=e.slice(e.lastIndexOf(`.`)+1);return t&&t!==`mcp`?t:V}for(let t of[`dispatch.workspace.attach.`,`run.command.`])if(e.startsWith(t))return z(e.slice(t.length))??`a Switchboard step`;return V}var U=[/\bslack[\s-]?only\b/i,/\bpost\s*[:=]\s*(?:off|no|false|none)\b/i,/\bno[\s-]post\b/i,/\b(?:don['’]?t|do\s+not|never|skip|without)\s+(?:\w+\s+){0,2}?(?:post|comment)(?:ing|s)?\b/i,/\bno\s+need\s+to\s+(?:post|comment)\b/i];function W(e){return U.some(t=>t.test(e))}var ne=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,re=/^[0-9a-f]{7,40}$/,ie=/^(?![.-])(?!.*\.\.)(?!.*\/\/)(?!.*@\{)(?!.*\.lock$)(?!.*[./]$)[\w][\w./-]*$/;function G(e){return e&&ne.test(e)?`https://github.com/${e}`:void 0}function K(e,t){let n=G(e);if(!(!n||t===void 0||!Number.isInteger(t)||t<=0))return`${n}/pull/${t}`}function ae(e,t){let n=G(e);if(n&&t&&ie.test(t))return`${n}/tree/${t.split(`/`).map(encodeURIComponent).join(`/`)}`}function oe(e,t){let n=G(e);if(n&&t&&re.test(t))return`${n}/commit/${t}`}function se(e){return e.slice(0,7)}function ce(e){if(e===`slack.receive`||e.startsWith(`dispatch.`))return`getting_ready`;let t=w(e,`agent`);return t?.kind===`counted`&&t.bucket===`finishing_up`?`finishing_up`:void 0}function le(e){return e===`request`||e===`run.agent`}var ue={getting_ready:`Getting ready`,finishing_up:`Finishing up`};function de(e){let t=e.rows.length,n=`${t} step${t===1?``:`s`}`,r=ue[e.phase];if(t===0||e.rows.some(e=>e.open||e.at===void 0||e.durationMs===void 0))return`${r} · ${n}`;let i=Math.min(...e.rows.map(e=>e.at)),a=Math.max(...e.rows.map(e=>e.at+e.durationMs));return`${r} · ${n} · ${D(Math.max(0,a-i),`precise`)}`}function fe(e){let t=e.split(`
8
- `),n=t.indexOf(`<<<UNTRUSTED`),r=t.lastIndexOf(`UNTRUSTED>>>`);return(n>=0&&r>n?t.slice(n+1,r):t.slice(1)).filter(e=>e.length>0)}function pe(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`${e.urlBase}${n}${e.token?`?t=${encodeURIComponent(e.token)}`:``}`}function me(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let{fromSeq:n,toSeq:r}=t,i=e=>typeof e==`number`&&Number.isInteger(e)&&e>0;return!i(n)||!i(r)||n>r?null:{fromSeq:n,toSeq:r}}function he(e){let t=e.toSeq-e.fromSeq+1,n=t===1?`event ${e.fromSeq}`:`events ${e.fromSeq}–${e.toSeq}`;return`${t} ${t===1?`event`:`events`} not loaded (${n}) — the record has them`}function ge(e,t,n){let r=!!e.model&&t!==null&&Q(e.model,t),i=r?t:e.model??t??void 0,a=!!e.model&&t!==null&&!r;return{spanId:e.spanId,label:e.label,chip:e.label.replace(/^Thought for /,``),quick:e.durationMs<6e4,durationMs:e.durationMs,facts:e.facts,...i?{model:i}:{},switched:a,showModel:!!i&&(!n||a),at:e.at}}function _e(e){let t=`${e.n} tool call${e.n===1?``:`s`}`;if(e.n===0)return`no tool calls`;if(e.ok===e.n)return`${t}, all succeeded`;if(e.running===e.n)return`${t}, all running`;let n=[];return e.bad&&n.push(`${e.bad} failed`),e.infra&&n.push(`${e.infra} sandbox error${e.infra===1?``:`s`}`),e.running&&n.push(`${e.running} still running`),`${t}, ${n.join(`, `)}`}function ve(e){let{meta:t,prOpened:n}=e,r=t?.repo&&G(t.repo)?t.repo:void 0;if(t?.agent===`review`){if(W(e.requestText))return{text:`verdict, Slack only`};if(r&&t.pr!==void 0){let e=K(r,t.pr);return e?{text:`verdict for ${r}#${t.pr}`,href:e}:{text:`verdict`}}return{text:`verdict`}}if(t?.agent===`coding`&&n){let e=n.created?`pull request opened`:`pull request updated`,t=r?K(r,n.number):void 0;return t?{text:`${e} ${r}#${n.number}`,href:t}:{text:e}}return t?.agent===`command`?{text:`output`}:{text:`answer`}}function q(e,t){return{id:e.id,tool:e.tool,title:e.title,headline:e.headline,shell:e.shell,status:e.status,facts:[...e.facts],startedAt:e.startedAt,output:e.result?e.result.output||e.result.summary:``,hasResult:e.result!==void 0,chipOnly:!e.shell&&e.title===e.tool,durationMs:e.durationMs,exitCode:e.result?.exitCode,timedOut:M(e.result?.exitCode),open:t}}function ye(e={}){let t=e.openTags&&e.openTags.length>0?e.openTags:[`failed`,`infra`],n=te(),r=y({request:null,meta:null,context:[],references:[],log:[],reply:null,prOpened:null,placeholder:!0,allOpen:!1,stopMode:null,model:null,firstAt:null,lastAt:null,lastAtWall:null,elided:[],traceVersion:0}),i=T(),a=new Map,o=new Map,s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=new Map,p=new Set,m=null,h=!1,g=-1,_=0,v=e=>`${e}-${_++}`;function b(e){return t.includes(`all`)?!0:e.some(e=>t.includes(e))}function C(e){let t=0,n=0,r=0;for(let i of e.items)i.kind===`call`&&(i.call.status===`failed`?t++:i.call.status===`infra`?n++:i.call.status===`running`&&r++);return{bad:t,infra:n,running:r}}function w(e){let{bad:t,infra:n,running:r}=C(e);(t||n||r)&&(e.groupOpen=!0)}function D(e){let t=o.get(g);t&&(t.live=!1),g=e.index;let n=m;m=null;let i=y({kind:`step`,key:v(`step`),index:e.index,at:e.narration?e.narration.at:n?.at,turn:n,narration:e.narration?e.narration.text:null,note:`no commentary`,items:[],live:!0,manual:!1,groupOpen:!0});return o.set(e.index,i),r.log.push(i),i}function O(e){return o.get(e.index)??D(e)}function k(e,t){let n=O(e);if(t.quiet){p.add(t.id),n.items.push({kind:`quiet`,at:t.startedAt,text:`✎ ${t.tool===`update_status`?`status checklist updated`:t.title}`}),w(n);return}let i=y(q(t,r.allOpen||b(t.tags)));u.set(t.id,i),d.set(t.id,n),n.items.push({kind:`call`,call:i}),w(n)}function A(e,t){if(p.has(t.id)){let t=o.get(e.index);t&&w(t);return}let n=u.get(t.id);if(!n){k(e,t);return}Object.assign(n,q(t,n.open)),b(t.tags)&&(n.open=!0);let r=o.get(e.index);r&&w(r)}function j(e,t){m&&=(r.log.push({kind:`turn`,key:v(`turn`),turn:m,note:e,...t===void 0?{}:{noteHref:t}}),null)}let M=new Map,N=y([]);function ee(e){if(e.direction===`in`){M.get(e.messageId)?.files.push(e);return}N.push(e);let t=u.get(e.callId);t&&((t.files??=[]).push(e),t.open=!0)}function P(e){switch(r.placeholder=!1,e.kind){case`input`:{let t={text:e.text,messageId:e.messageId,at:e.at,...e.source?{source:e.source}:{},files:[]};r.request?r.log.push({kind:`followup`,key:v(`followup`),input:t}):r.request=t,M.set(t.messageId,t);return}case`step`:D(e.step);return;case`call`:k(e.step,e.call);return;case`result`:A(e.step,e.call);return;case`turn`:j(``),m=ge(e,r.model,h),m.model&&(h=!0),e.model&&!(r.model!==null&&Q(e.model,r.model))&&(r.model=e.model);return;case`meta`:r.model===null&&e.model&&(r.model=e.model),r.meta={agent:e.agent,model:e.model,...e.effort?{effort:e.effort}:{},...e.harness?{harness:e.harness}:{},...e.harnessScope?{harnessScope:e.harnessScope}:{},...e.repo?{repo:e.repo}:{},...e.ref?{ref:e.ref}:{},...e.pr===void 0?{}:{pr:e.pr},...e.headSha?{headSha:e.headSha}:{}};return;case`pr_opened`:r.prOpened={url:e.url,number:e.number,created:e.created};return;case`skill`:O(e.step).items.push({kind:`skill`,skill:e.skill});return;case`artifact`:ee(e.artifact);return;case`context`:r.context.push({key:v(`ctx`),at:e.at,text:e.text});return;case`reference`:r.references.push({key:v(`ref`),at:e.at,url:e.url,channelName:e.channelName,messages:e.messages,text:e.text});return;case`note`:if(e.noteKind===`follow_up`)return;r.log.push({kind:`note`,key:v(`note`),at:e.at,replay:!1,text:e.text,noteKind:e.noteKind}),(e.noteKind===`stop_requested`||e.noteKind===`stopped`)&&(e.mode===`soft`||e.mode===`hard`)&&U(e.mode);return;case`replay_note`:r.log.push({kind:`note`,key:v(`note`),replay:!0,text:e.text});return;case`span`:{if(le(e.name)){e.name===`run.agent`&&e.open&&F(`getting_ready`);return}e.name.startsWith(`post.`)&&e.open&&F(`finishing_up`);let t=s.get(e.spanId);if(t){t.open=e.open,e.durationMs!==void 0&&(t.durationMs=e.durationMs),e.status&&(t.status=e.status);return}let n=y({kind:`span`,key:v(`span`),spanId:e.spanId,text:H(e.name),open:e.open,...e.durationMs===void 0?{}:{durationMs:e.durationMs},...e.status?{status:e.status}:{},at:e.open?e.at:e.startedAt??e.at});s.set(e.spanId,n);let i=ce(e.name);if(i){let t=l.get(i);t||(t={group:y({kind:`phase`,phase:i,key:v(i),rows:[],open:!0}),toggled:!1},l.set(i,t),r.log.push(t.group)),t.group.rows.push(n),c.set(e.spanId,t.group);return}r.log.push(n);return}case`answer`:j(`wrote the reply`,`#reply`),r.reply={text:e.text,at:e.at,files:N};return}}function F(e){let t=l.get(e);t&&!t.toggled&&(t.group.open=!1)}function I(e){let t=e,s=t?.type===`span_start`||t?.type===`span_end`;if(t&&typeof t.type==`string`){let t=e;i.push(t),S(t)&&E(a,t,``),r.traceVersion++}t&&!s&&typeof t.at==`number`&&((r.firstAt===null||t.at<r.firstAt)&&(r.firstAt=t.at),(r.lastAt===null||t.at>=r.lastAt)&&(r.lastAt=t.at,r.lastAtWall=x()));for(let t of n.push(e))P(t);let c=e;if((c?.type===`tool_call`||c?.type===`tool_result`)&&typeof c.logIndex==`number`&&!f.has(c.logIndex)){let e=(typeof c.callId==`string`?d.get(c.callId):void 0)??o.get(g);e&&f.set(c.logIndex,e)}}function L(e){if(e.turn)return`span-${e.turn.spanId}`;let t=e.items.find(e=>e.kind===`call`);return t?.kind===`call`?`call-${t.call.id}`:void 0}function R(e){let t=f.get(e);if(!t){let n=-1;for(let[r,i]of f)r<e&&r>n&&(n=r,t=i)}if(!t)return;let n=L(t);return n===void 0?void 0:{step:t,anchor:n}}function z(){for(let e of u.values())if(e.status===`running`)return e;return null}function B(e){r.allOpen=e;for(let t of l.values())t.group.open=e,t.toggled=!0;for(let t of u.values())t.open=e}function V(e){if(e.startsWith(`call-`)){let t=e.slice(5),n=d.get(t);return!n||!u.has(t)?!1:(n.manual=!0,n.groupOpen=!0,!0)}if(e.startsWith(`span-`)){let t=e.slice(5),n=c.get(t);if(n){n.open=!0;let e=l.get(n.phase);return e&&(e.toggled=!0),!0}if(s.has(t))return!0;for(let e of r.log)if(e.kind===`step`&&e.turn?.spanId===t||e.kind===`turn`&&e.turn.spanId===t)return!0}return!1}function U(e){r.stopMode=e}function W(e){r.elided.push(e),r.log.push({kind:`note`,key:v(`note`),replay:!0,text:he(e)}),r.placeholder=!1,r.traceVersion++}return{state:r,handle:I,noteElided:W,spanSet:()=>[...a.values()],losses:e=>i.losses({windowStart:e,elided:r.elided}),pendingCall:z,flushPendingTurn:j,closePhases(){F(`getting_ready`),F(`finishing_up`)},setAllOpen:B,togglePhase(e){e.open=!e.open;let t=l.get(e.phase);t&&(t.toggled=!0)},reveal:V,landing:R,callHeadline:e=>u.get(e)?.headline,toggleGroup(e){e.manual=!0,e.groupOpen=!e.groupOpen},toggleCall(e){e.open=!e.open},markStopping:U,opensByDefault:b}}function J(e,t){return e.lastAt===null||e.lastAtWall===null?null:e.lastAt+(t-e.lastAtWall)}function be(e,t){return{now:n=>e.serverNow+(n-t),elapsedMs(t){return C(e,this.now(t))??0},elapsedAt(t){return C({receivedAt:e.receivedAt,startedAt:e.startedAt,finishedAt:t})??0}}}function xe(e){if(typeof e!=`string`)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!=`object`||!t)return{};let{sealedAt:n,replyOk:r}=t;return{...typeof n==`number`&&Number.isFinite(n)&&n>0?{sealedAt:n}:{},...typeof r==`boolean`?{replyOk:r}:{}}}function Se(e){return e.replyOk===!1?`reply failed`:e.replyOk!==!0||e.finishedAt===void 0||e.sealedAt===void 0?``:`delivered in ${D(Math.max(0,e.sealedAt-e.finishedAt),`clock`)}`}function Ce(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let{finishedAt:n}=t;return typeof n==`number`&&Number.isFinite(n)&&n>0?{finishedAt:n}:null}var Y=Symbol(`sb-runner-clock`),X=Symbol(`sb-artifact-links`),Z=Symbol(`sb-reply-landed`);function Q(e,t){return e===t||!e.includes(`/`)!=!t.includes(`/`)&&$(e)===$(t)}function $(e){if(!e)return`model`;let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1))||e}var we=6e4;function Te(e,t,n){let r=J(e,n);if(r===null||e.lastAt===null)return{kind:`starting`};if(t)return{kind:`call`,call:t,elapsedMs:Math.max(0,r-(t.startedAt??e.lastAt))};let i=Math.max(0,r-e.lastAt);return{kind:`thinking`,elapsedMs:i,slow:i>=we}}var Ee=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),De=65536,Oe=new Set([`application/json`,`application/x-ndjson`,`application/xml`,`application/yaml`]);function ke(e){return Ee.has(e)?`image`:e.startsWith(`video/`)?`video`:e.startsWith(`audio/`)?`audio`:e.startsWith(`text/`)||Oe.has(e)?`text`:`other`}var Ae=[`data-open-images`],je={class:`mb-1.5 flex items-baseline gap-2 font-mono text-[0.68rem] font-medium uppercase tracking-wider text-dimmed`},Me={class:`count font-normal normal-case tracking-normal`},Ne={class:`m-0 flex list-none flex-col gap-1.5 p-0`},Pe=[`data-direction`,`data-kind`,`data-open`,`data-expired`],Fe={class:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 font-mono text-xs`},Ie=[`title`],Le=[`aria-expanded`,`aria-controls`,`onClick`],Re={key:1,class:`name font-medium text-toned`},ze={class:`fact text-dimmed`},Be={class:`fact text-dimmed`},Ve={key:2,class:`expired text-warn`},He=[`id`,`aria-hidden`],Ue={class:`min-h-0 overflow-hidden`},We=[`src`,`alt`,`onError`],Ge=[`src`,`onError`],Ke=[`src`,`onError`],qe={key:3,class:`mt-1.5`},Je={key:0,class:`text max-h-96 overflow-auto rounded border border-(--ui-border) bg-elevated p-2.5 font-mono text-xs whitespace-pre-wrap break-words text-toned`},Ye={key:1,class:`text-xs text-bad`},Xe={key:2,class:`mt-1 text-xs text-dimmed`},Ze={key:4,class:`other mt-1.5 flex flex-wrap items-baseline gap-x-3 gap-y-1 font-mono text-xs text-dimmed`},Qe=[`href`,`download`],$e=0,et=o({__name:`MessageFiles`,props:{files:{},openImages:{type:Boolean,default:!0}},setup(e){let o=e,f=l(X,null),m=y(new Set),g=y(new Set),_=y(new Set),v=y(new Map);function x(){for(let e of o.files)o.openImages&&ke(e.contentType)===`image`&&!g.has(e.key)&&!_.has(e.key)&&(g.add(e.key),_.add(e.key))}x(),r(()=>[o.files,o.files.length],x),$e+=1;let S=`files-${$e}`,C=b(()=>o.files.map((e,t)=>({...e,href:f?pe(f,e.key):null,kind:ke(e.contentType),open:g.has(e.key),mounted:_.has(e.key),expired:m.has(e.key),panelId:`${S}-file-${t}`})));function w(e){if(e.href&&!e.expired){if(g.has(e.key)){g.delete(e.key);return}g.add(e.key),_.add(e.key),e.kind===`text`&&!v.has(e.key)&&T(e.key,e.href)}}async function T(e,t){v.set(e,{text:``,truncated:!1});try{let n=await fetch(t,{credentials:`same-origin`});if(n.status===410){m.add(e),v.delete(e);return}if(!n.ok||!n.body)throw Error(`HTTP ${n.status}`);let r=n.body.getReader(),i=new TextDecoder,a=``,o=0,s=!1;for(;;){let{value:e,done:t}=await r.read();if(t)break;let n=De-o,c=e.byteLength>n?e.subarray(0,n):e;if(a+=i.decode(c,{stream:!0}),o+=c.byteLength,o>=65536){s=e.byteLength>n||!(await r.read()).done,await r.cancel();break}}v.set(e,{text:a,truncated:s})}catch(t){v.set(e,{text:``,truncated:!1,error:t instanceof Error?t.message:String(t)})}}function E(e){m.add(e),g.delete(e)}let D=e=>e===`out`?`↑ sent`:`↓ received`,O=e=>e===`out`?`sent by the run`:`received from the thread`;return(r,o)=>(u(),t(`div`,{class:`files mt-3 border-t border-(--ui-border) pt-2`,"data-open-images":e.openImages?`1`:`0`},[d(`h3`,je,[o[0]||=d(`span`,null,`Files`,-1),d(`span`,Me,`· `+a(e.files.length)+` file`+a(e.files.length===1?``:`s`),1)]),d(`ul`,Ne,[(u(!0),t(h,null,n(C.value,e=>(u(),t(`li`,{key:e.key,class:`artifact`,"data-direction":e.direction,"data-kind":e.kind,"data-open":e.open?`1`:`0`,"data-expired":e.expired?`1`:`0`},[d(`div`,Fe,[d(`span`,{class:`dir shrink-0 select-none text-dimmed`,title:O(e.direction)},a(D(e.direction)),9,Ie),e.href&&!e.expired?(u(),t(`button`,{key:0,type:`button`,class:`name flex cursor-pointer items-baseline gap-1.5 border-0 bg-transparent p-0 font-mono text-xs font-medium text-primary hover:underline focus-visible:outline-2 focus-visible:outline-primary`,"aria-expanded":e.open?`true`:`false`,"aria-controls":e.panelId,onClick:t=>w(e)},[d(`span`,{class:s([`chev inline-block select-none text-[0.65rem] text-dimmed transition-transform motion-reduce:transition-none`,e.open?`rotate-90`:``]),"aria-hidden":`true`},`❯`,2),d(`span`,null,a(e.name),1)],8,Le)):(u(),t(`span`,Re,a(e.name),1)),d(`span`,ze,a(p(A)(e.size)),1),d(`span`,Be,a(e.contentType),1),e.expired&&p(f)?(u(),t(`span`,Ve,`expired after `+a(p(f).retentionDays)+` days`,1)):c(``,!0)]),e.href&&!e.expired?(u(),t(`div`,{key:0,id:e.panelId,class:`panel grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`,style:i({gridTemplateRows:e.open?`1fr`:`0fr`}),"aria-hidden":e.open?`false`:`true`},[d(`div`,Ue,[e.mounted?(u(),t(h,{key:0},[e.kind===`image`?(u(),t(`img`,{key:0,class:`preview mt-1.5 max-h-96 max-w-full rounded border border-(--ui-border)`,src:e.href,alt:e.name,loading:`lazy`,onError:t=>E(e.key)},null,40,We)):e.kind===`video`?(u(),t(`video`,{key:1,class:`preview mt-1.5 max-h-96 max-w-full rounded border border-(--ui-border) bg-black`,src:e.href,controls:``,playsinline:``,preload:`auto`,onError:t=>E(e.key)},null,40,Ge)):e.kind===`audio`?(u(),t(`audio`,{key:2,class:`preview mt-1.5 w-full max-w-xl`,src:e.href,controls:``,preload:`auto`,onError:t=>E(e.key)},null,40,Ke)):e.kind===`text`?(u(),t(`div`,qe,[v.get(e.key)&&!v.get(e.key).error?(u(),t(`pre`,Je,a(v.get(e.key).text),1)):c(``,!0),v.get(e.key)?.error?(u(),t(`p`,Ye,` could not read the file: `+a(v.get(e.key).error),1)):v.get(e.key)?.truncated?(u(),t(`p`,Xe,` showing the first `+a(p(A)(p(De)))+` of `+a(p(A)(e.size)),1)):c(``,!0)])):(u(),t(`div`,Ze,[d(`span`,null,`no preview for `+a(e.contentType),1),d(`a`,{class:`download inline-block rounded border border-default px-2 py-0.5 font-medium text-toned no-underline hover:bg-accented hover:text-primary focus-visible:outline-2 focus-visible:outline-primary`,href:e.href,download:e.name},`Download `+a(p(A)(e.size)),9,Qe)]))],64)):c(``,!0)])],12,He)):c(``,!0)],8,Pe))),128))])],8,Ae))}}),tt=[`id`,`open`,`title`,`data-status`,`data-heat`],nt={key:0,class:`spin inline-block size-[0.7em] shrink-0 animate-spin self-center rounded-full border-2 border-accented border-t-info motion-reduce:animate-none`,role:`img`,"aria-label":`running`},rt={key:2,class:`dollar shrink-0 select-none text-dimmed`},it={key:3,class:`tool shrink-0 rounded bg-accented px-1.5 text-xs leading-normal text-muted`},at={key:0,class:`cmd brief min-w-0 flex-1 truncate text-info`},ot={key:1,class:`cmd full min-w-0 flex-1 whitespace-pre-wrap break-words text-info max-sm:order-last max-sm:basis-full`},st={key:5,class:`cmd min-w-0 flex-1`},ct={class:`facts ml-auto flex shrink-0 gap-2.5 text-xs tabular-nums text-muted`},lt={key:0,class:`fact elapsed`,title:`since this call started (runner clock)`},ut={key:0,class:`over rounded bg-bad/15 px-1 font-medium text-bad`},dt={key:1,class:`over rounded bg-bad/15 px-1 font-medium text-bad`},ft={class:`body`},pt={key:1,class:`none px-3 py-1.5 text-xs italic text-dimmed`},mt={key:2,class:`none px-3 py-1.5 text-xs italic text-dimmed`},ht=o({__name:`CallCard`,props:{call:{}},setup(e){let r=e,o=l(Y,null),f=l(Z,null),m=b(()=>{let e=o?.value;return r.call.status!==`running`||typeof e!=`number`||r.call.startedAt===void 0?``:D(Math.max(0,e-r.call.startedAt),`clock`)}),_=b(()=>N(r.call.durationMs,`tool`,r.call.timedOut)),y=b(()=>j(_.value)),x=b(()=>r.call.durationMs===void 0?-1:r.call.facts.length-1);function S(){r.call.open=!r.call.open}return(r,o)=>(u(),t(`details`,{id:`call-${e.call.id}`,class:s([`call rounded-lg border border-default bg-elevated font-mono open:bg-accented`,e.call.status]),open:e.call.open,title:typeof e.call.startedAt==`number`?`started ${p(O)(e.call.startedAt)}`:void 0,"data-status":e.call.status,"data-heat":_.value.level},[d(`summary`,{class:s([`flex min-w-0 cursor-pointer list-none items-baseline gap-3 rounded-lg pl-3 pr-[calc(var(--sb-gutter)-1px)] py-2 hover:bg-accented/60 focus-visible:outline-2 focus-visible:outline-primary max-sm:flex-wrap [&::-webkit-details-marker]:hidden`,e.call.open?`rounded-b-none border-b border-default`:``]),onClick:g(S,[`prevent`])},[d(`span`,{class:s([`chev shrink-0 select-none text-xs text-dimmed transition-transform motion-reduce:transition-none`,e.call.open?`rotate-90`:``])},`❯`,2),e.call.status===`running`?(u(),t(`span`,nt)):(u(),t(`span`,{key:1,class:s([`glyph w-[1em] shrink-0 text-center font-medium`,e.call.status===`ok`?`text-ok`:e.call.status===`failed`?`text-bad`:`text-warn`])},a(e.call.status===`ok`?`✓`:e.call.status===`failed`?`✗`:`⚠`),3)),e.call.shell?(u(),t(`span`,rt,`$`)):(u(),t(`span`,it,a(e.call.tool),1)),e.call.chipOnly?(u(),t(`span`,st)):(u(),t(h,{key:4},[e.call.open?(u(),t(`code`,ot,a(e.call.title),1)):(u(),t(`code`,at,a(e.call.headline),1))],64)),d(`span`,ct,[m.value?(u(),t(`span`,lt,a(m.value),1)):c(``,!0),(u(!0),t(h,null,n(e.call.facts,(n,r)=>(u(),t(h,{key:r},[r===x.value&&_.value.over?(u(),t(`span`,ut,`timed out`)):c(``,!0),d(`span`,{class:s([`fact`,[e.call.status!==`ok`&&r===0?`text-bad`:``,r===x.value&&_.value.over?`font-medium text-bad`:``,r===x.value&&y.value?`heat`:``,r===x.value&&_.value.level>=2&&!_.value.over?`font-medium`:``]]),style:i(r===x.value?y.value:void 0)},a(n),7)],64))),128)),_.value.over&&x.value===-1?(u(),t(`span`,dt,`timed out`)):c(``,!0)])],2),d(`div`,ft,[e.call.hasResult&&e.call.output?(u(),t(`pre`,{key:0,class:s([`out max-h-[28rem] overflow-auto whitespace-pre-wrap break-words px-3.5 py-2.5 font-mono leading-normal`,e.call.status===`failed`?`text-bad`:`text-toned`])},a(e.call.output),3)):e.call.hasResult?(u(),t(`div`,pt,`no output`)):(u(),t(`div`,mt,`no output yet`)),e.call.files&&e.call.files.length>0?(u(),v(et,{key:3,class:`mx-3.5 mb-2.5`,files:e.call.files,"open-images":!p(f)},null,8,[`files`,`open-images`])):c(``,!0)])],10,tt))}}),gt=[`title`],_t=[`title`],vt={class:`skillname whitespace-nowrap font-mono font-medium text-skill`},yt={key:0,class:`skilldesc min-w-0 flex-1 truncate text-xs text-muted`},bt={class:`facts ml-auto flex shrink-0 gap-2.5 font-mono text-xs text-muted`},xt=[`href`],St={class:`fact`},Ct=o({__name:`StepItems`,props:{items:{}},setup(e){return(r,i)=>(u(!0),t(h,null,n(e.items,(e,n)=>(u(),t(h,{key:n},[e.kind===`call`?(u(),v(ht,{key:0,call:e.call},null,8,[`call`])):e.kind===`quiet`?(u(),t(`div`,{key:1,class:`quiet flex items-baseline gap-3 pl-3 pr-(--sb-gutter) py-0.5 font-mono text-xs text-dimmed`,title:e.at===void 0?void 0:p(O)(e.at)},[d(`span`,null,a(e.text),1)],8,gt)):(u(),t(`div`,{key:2,class:`skill flex items-baseline gap-2.5 pl-3 pr-(--sb-gutter) py-0.5`,title:e.skill.at===void 0?void 0:p(O)(e.skill.at)},[i[0]||=d(`span`,{class:`skillmark shrink-0 select-none text-xs`},`📚`,-1),d(`span`,vt,`skill `+a(e.skill.name),1),e.skill.description?(u(),t(`span`,yt,a(e.skill.description),1)):c(``,!0),d(`span`,bt,[e.skill.source?(u(),t(`a`,{key:0,class:`fact text-primary hover:underline`,href:e.skill.source,target:`_blank`,rel:`noopener noreferrer`},`source`,8,xt)):c(``,!0),d(`span`,St,a(p(A)(e.skill.bodyBytes))+` into context`,1)])],8,_t))],64))),128))}}),wt=[`id`,`data-live`],Tt={class:`head flex items-baseline gap-x-6 pb-1.5 pr-(--sb-gutter)`},Et={class:`min-w-0 flex-1`},Dt={key:0,class:`meta flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 font-mono text-xs tabular-nums text-dimmed`},Ot=[`data-heat`,`title`],kt=[`title`],At=[`title`],jt={key:2,class:`nonar font-sans text-sm italic text-dimmed`},Mt=[`title`],Nt={key:0,class:`narration flex items-baseline gap-3 pb-1.5 pr-(--sb-gutter)`},Pt={key:1,class:`narration flex items-baseline gap-3 pb-1.5 pr-(--sb-gutter)`},Ft={class:`nonar flex-1 font-sans text-sm italic text-dimmed`},It={class:`calls flex flex-col gap-2`},Lt=[`open`,`data-group-open`],Rt=[`title`],zt=[`data-ok`,`data-bad`,`data-infra`,`data-running`],Bt=[`data-heat`],Vt={class:`gbody flex flex-col gap-2 pb-1 pt-1.5`},Ht=o({__name:`StepBlock`,props:{step:{}},emits:[`toggleGroup`],setup(r,{emit:o}){let l=r,f=o,_=b(()=>l.step.items.filter(e=>e.kind===`call`)),y=b(()=>_.value.length>=2),x=b(()=>{let e=0,t=0,n=0,r=0,i=0;for(let a of _.value){if(a.kind!==`call`)continue;let o=a.call;o.status===`ok`?e++:o.status===`failed`?t++:o.status===`infra`?n++:r++,typeof o.durationMs==`number`&&(i+=o.durationMs)}return{n:e+t+n+r,ok:e,bad:t,infra:n,running:r,ms:i}}),S=b(()=>_e(x.value)),C=b(()=>_.value.some(e=>e.kind===`call`&&e.call.timedOut)),w=b(()=>N(x.value.ms,`tool`,C.value)),T=b(()=>j(w.value)),E=b(()=>l.step.turn?N(l.step.turn.durationMs,`turn`):void 0),A=b(()=>E.value?j(E.value):void 0),M=b(()=>{let e=_.value[0];return e?.kind===`call`?e.call.startedAt:void 0});return(o,l)=>(u(),t(`li`,{id:r.step.turn?`span-${r.step.turn.spanId}`:void 0,class:s([`step relative border-l-2 pb-3 pl-3 pt-2`,r.step.live?`border-ok/40`:`border-(--ui-border-accented)/50`]),"data-live":r.step.live?`1`:void 0},[d(`div`,Tt,[d(`div`,Et,[r.step.turn?(u(),t(`div`,Dt,[d(`span`,{class:s([`thought`,[A.value?`heat`:``,E.value&&E.value.level>=2?`font-medium`:``]]),style:i(A.value),"data-heat":E.value?.level,title:r.step.turn.label},`thought `+a(r.step.turn.chip),15,Ot),r.step.turn.switched?(u(),t(`span`,{key:0,class:`model-switch order-first rounded border border-warn/40 bg-warn/10 px-1.5 font-medium text-warn`,title:`model changed: this turn ran on ${r.step.turn.model}`},`⇄ `+a(p($)(r.step.turn.model)),9,kt)):r.step.turn.showModel?(u(),t(`span`,{key:1,class:`model-badge order-first rounded bg-accented px-1.5 text-[0.68rem] font-medium leading-normal tracking-wider text-muted`,title:r.step.turn.model},a(p($)(r.step.turn.model)),9,At)):c(``,!0),(u(!0),t(h,null,n(r.step.turn.facts,(e,n)=>(u(),t(`span`,{key:n,class:`fact`},a(e),1))),128))])):r.step.narration===null?(u(),t(`span`,jt,a(r.step.note),1)):(u(),v(P,{key:1,text:r.step.narration},null,8,[`text`]))]),r.step.at===void 0?c(``,!0):(u(),t(`span`,{key:0,class:`ts shrink-0 select-none font-mono text-xs tabular-nums text-dimmed`,title:p(O)(r.step.at)},a(p(k)(r.step.at)),9,Mt))]),r.step.turn&&r.step.narration!==null?(u(),t(`div`,Nt,[e(P,{text:r.step.narration},null,8,[`text`])])):r.step.turn&&r.step.narration===null&&!r.step.turn.facts.length?(u(),t(`div`,Pt,[d(`span`,Ft,a(r.step.note),1)])):c(``,!0),d(`div`,It,[y.value?(u(),t(`details`,{key:1,class:`grp`,open:r.step.groupOpen,"data-group-open":r.step.groupOpen?`1`:`0`},[d(`summary`,{class:`gsummary flex cursor-pointer list-none items-baseline gap-3 rounded-md pl-3 pr-(--sb-gutter) py-1 font-mono text-xs text-dimmed hover:bg-accented/40 hover:text-muted focus-visible:outline-2 focus-visible:outline-primary [&::-webkit-details-marker]:hidden`,title:typeof M.value==`number`?`calls began ${p(O)(M.value)}`:void 0,onClick:l[0]||=g(e=>f(`toggleGroup`),[`prevent`])},[d(`span`,{class:s([`gchev shrink-0 select-none transition-transform motion-reduce:transition-none`,r.step.groupOpen?`rotate-90`:``])},`❯`,2),d(`span`,{class:s([`gcount`,x.value.bad||x.value.infra?`text-bad`:``]),"data-ok":x.value.ok,"data-bad":x.value.bad,"data-infra":x.value.infra,"data-running":x.value.running},a(S.value),11,zt),x.value.ms>0?(u(),t(`span`,{key:0,class:s([`gtime ml-auto tabular-nums`,[T.value?`heat`:``,w.value.over?`font-medium text-bad`:w.value.level>=2?`font-medium`:``]]),style:i(T.value),"data-heat":w.value.level},[w.value.over?(u(),t(h,{key:0},[m(`timed out · `)],64)):c(``,!0),m(a(p(D)(x.value.ms,`clock`)),1)],14,Bt)):c(``,!0)],8,Rt),d(`div`,Vt,[e(Ct,{items:r.step.items},null,8,[`items`])])],8,Lt)):(u(),v(Ct,{key:0,items:r.step.items},null,8,[`items`]))])],10,wt))}});function Ut(e){let t=[];for(let n of e.split(/\r?\n\r?\n/)){let e=n.split(/\r?\n/);if(e.some(e=>e.startsWith(`event:`)))continue;let r=e.filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).replace(/^ /,``)).join(`
9
- `);if(r!==``)try{let e=JSON.parse(r);typeof e==`object`&&e&&typeof e.type==`string`&&t.push(e)}catch{}}return t}export{se as C,ae as S,P as T,ve as _,Z as a,K as b,ye as c,$ as d,xe as f,fe as g,de as h,X as i,Se as l,me as m,Ht as n,Y as o,Ce as p,et as r,be as s,Ut as t,Te as u,J as v,H as w,G as x,oe as y};