@coreplane/switchboard 1.248.0 → 1.249.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/assets/config/config.example.yaml +44 -18
  2. package/dist/assets/deploy/cloudflare/preflight.mjs +21 -19
  3. package/dist/assets/deploy/cloudflare-memory/worker.ts +31 -0
  4. package/dist/assets/deploy/cloudflare-resident/drain.ts +109 -0
  5. package/dist/assets/deploy/cloudflare-resident/refresh.ts +5 -3
  6. package/dist/assets/deploy/cloudflare-resident/threadErr.ts +32 -3
  7. package/dist/assets/deploy/cloudflare-resident/worker.ts +235 -13
  8. package/dist/assets/deploy/cloudflare-sandbox/worker.ts +56 -9
  9. package/dist/assets/deploy/secrets.manifest.json +6 -0
  10. package/dist/assets/package-lock.json +3 -3
  11. package/dist/assets/package.json +1 -1
  12. package/dist/assets/source.json +3 -3
  13. package/dist/assets/src/agents/registry.ts +4 -4
  14. package/dist/assets/src/core/budgets.ts +24 -0
  15. package/dist/assets/src/core/coordinator/contract.ts +4 -3
  16. package/dist/assets/src/core/coordinator/driver.ts +40 -7
  17. package/dist/assets/src/core/modelCard.ts +348 -0
  18. package/dist/assets/src/core/modelPricing.ts +14 -5
  19. package/dist/assets/src/core/modelRegistry.ts +51 -0
  20. package/dist/assets/src/core/provider.ts +103 -0
  21. package/dist/assets/src/core/refusal.ts +181 -0
  22. package/dist/assets/src/core/runEvents.ts +43 -0
  23. package/dist/assets/src/core/ship/coordinator.ts +80 -12
  24. package/dist/assets/src/core/ship/handoff.ts +54 -19
  25. package/dist/assets/src/core/trace/workerTrace.ts +9 -3
  26. package/dist/assets/src/core/types.ts +327 -0
  27. package/dist/assets/src/deploy/liveGate.ts +35 -0
  28. package/dist/assets/src/deploy/restart.ts +12 -11
  29. package/dist/assets/src/execution/residentRefresh.ts +26 -1
  30. package/dist/assets/src/execution/sandboxErrors.ts +122 -4
  31. package/dist/assets/web/dist/.vite/manifest.json +30 -30
  32. package/dist/assets/web/dist/assets/DeliveryPage-DF4aQypG.js +1 -0
  33. package/dist/assets/web/dist/assets/{HomePage-DYxC0izY.js → HomePage-BpQRky8B.js} +1 -1
  34. package/dist/assets/web/dist/assets/{ResidentDetailPage-DLIpWYOc.js → ResidentDetailPage-BIUXyz6K.js} +1 -1
  35. package/dist/assets/web/dist/assets/{ResidentsIndexPage-6LipuDjR.js → ResidentsIndexPage-BZymgSAb.js} +1 -1
  36. package/dist/assets/web/dist/assets/{RunFoldRow-V-iSy64e.js → RunFoldRow-3m4CPRI4.js} +1 -1
  37. package/dist/assets/web/dist/assets/{RunRoutePage-DUalB1u2.js → RunRoutePage-bgkjkA0p.js} +3 -3
  38. package/dist/assets/web/dist/assets/{RunsIndexPage-B9Ba1KdD.js → RunsIndexPage-8S944AzB.js} +1 -1
  39. package/dist/assets/web/dist/assets/{ScheduledPage-KdjLtD_7.js → ScheduledPage-8bBtG9y3.js} +1 -1
  40. package/dist/assets/web/dist/assets/{SettingsPage-IT5l_NaL.js → SettingsPage-DQeNvfaV.js} +1 -1
  41. package/dist/assets/web/dist/assets/{StatusDot-DBHAl4Il.js → StatusDot-BPE5syBa.js} +1 -1
  42. package/dist/assets/web/dist/assets/{Tooltip-_LEjptLV.js → Tooltip-DkoeZfTs.js} +1 -1
  43. package/dist/assets/web/dist/assets/UnitRoutePage-BUzw--Ii.js +1 -0
  44. package/dist/assets/web/dist/assets/{dist-BcYPGOBL.js → dist-D11y9ZJ4.js} +1 -1
  45. package/dist/assets/web/dist/assets/{main-DUfSE0dj.js → main-B6LcgNM6.js} +2 -2
  46. package/dist/cli.js +2475 -1021
  47. package/package.json +1 -1
  48. package/dist/assets/web/dist/assets/DeliveryPage-NP4g6bQd.js +0 -1
  49. package/dist/assets/web/dist/assets/UnitRoutePage-DPBsvGPR.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreplane/switchboard",
3
- "version": "1.248.0",
3
+ "version": "1.249.1",
4
4
  "description": "Mention it in Slack and an agent reviews the PR, ships the fix, or answers the question — on the model you choose, with its tools running where you decide.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://openswitchboard.dev",
@@ -1 +0,0 @@
1
- import{t as e}from"./AppShell-DAtHiuI6.js";import{An as t,Cn as n,Cr as r,Li as i,Mn as a,Pi as o,Sn as s,Tr as ee,Xr as c,_r as l,bn as u,ji as d,kn as f,ln as p,o as m,xn as h,yn as g}from"./browser-B6T5hjfR.js";import{a as _,c as te,d as ne,i as re,l as v,n as y,o as b,r as x,s as S,t as C,u as ie}from"./delivery-CTdOqpVK.js";import{t as ae}from"./wallClock-DmaC1sKA.js";var w=6e4;1440*w,10*w,5*w;var T={general:2,coding:15,review:5,research:3,explore:15,conductor:15};T.coding,T.coding,T.review;function E(e,t){return e.truncated&&e.completeFrom!==void 0&&Date.parse(`${t}T00:00:00Z`)<Date.parse(e.completeFrom)}Object.freeze({reviewers:[],agentLogins:[],agentCoauthors:[]}),Object.freeze({default:60,min:5,max:1440});var D={class:`text-xs text-muted`},O={key:1,class:`text-highlighted`},k={class:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`},A={key:0,class:`flex items-center gap-1`,"aria-label":`Repositories`},j={key:0,class:`rounded-md bg-accented px-2.5 py-1 text-xs font-medium text-highlighted`,"aria-current":`page`},M={class:`font-mono text-sm tabular-nums text-muted`},N={class:`mb-5 grid gap-3`},P={key:0,class:`text-sm text-muted`},F={class:`grid grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-3`},I={class:`font-mono text-[0.6875rem] font-medium uppercase tracking-widest text-dimmed`},L={class:`font-mono text-2xl font-medium tabular-nums`},R={class:`text-xs text-muted`},z={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},B={class:`overflow-x-auto`},V={class:`weeks w-full min-w-[52rem] border-collapse whitespace-nowrap font-mono text-[0.8125rem] tabular-nums`},H=[`title`],U={key:0,class:`ml-1 text-xs`},oe={key:0,class:`text-xs text-muted`},W={class:`mb-5 grid gap-3 rounded-lg border border-default bg-elevated px-5 py-4`},G={key:0,class:`text-sm text-muted`},K={key:1,class:`overflow-x-auto`},q={class:`units w-full min-w-[52rem] border-collapse font-mono text-[0.8125rem] tabular-nums`},se=[`href`],ce={key:1,class:`text-dimmed`},le=[`title`],ue=[`href`],de={class:`text-xs text-muted`},fe={class:`rounded bg-accented px-1 py-0.5`},pe={class:`border-t border-default pt-3.5 text-xs text-dimmed`},me={key:0,class:`mb-2 font-mono tabular-nums text-muted`},he={class:`mt-2 grid gap-1.5`},J=`border-b border-muted bg-(--ui-bg-muted) px-2.5 py-1.5 text-xs font-medium text-muted whitespace-nowrap`,Y=`border-b border-muted px-2.5 py-1.5`,X=a({__name:`DeliveryPage`,setup(a){let w=m(`delivery`),T=g(()=>w?.report??null),X=g(()=>w?.repos??[]),Z=g(()=>T.value?ie(T.value):[]),Q=g(()=>T.value?y(T.value):void 0),$=e=>T.value?E(T.value,e):!1,ge=g(()=>T.value?.weeks.some(e=>$(e.week))??!1),_e=[1,2,4,8,13],ve=ae(void 0,6e4),ye=typeof window>`u`?``:window.location.search;return(a,m)=>{let g=ee(`RouterLink`);return T.value?(l(),h(e,{key:0,title:`${T.value.repo} delivery`,nav:`delivery`},{actions:c(()=>[u(`span`,D,[(l(),n(p,null,r(_e,(e,t)=>(l(),n(p,{key:e},[t>0?(l(),n(p,{key:0},[f(` · `)],64)):s(``,!0),e===T.value.range.weeks?(l(),n(`b`,O,i(e)+`w`,1)):(l(),h(g,{key:2,class:`text-primary hover:underline`,to:`/delivery/${T.value.repo}?weeks=${e}`},{default:c(()=>[f(i(e)+`w`,1)]),_:2},1032,[`to`]))],64))),64))])]),default:c(()=>[u(`div`,k,[X.value.length>1?(l(),n(`nav`,A,[(l(!0),n(p,null,r(X.value,e=>(l(),n(p,{key:e},[e===T.value.repo?(l(),n(`span`,j,i(e),1)):(l(),h(g,{key:1,class:`rounded-md px-2.5 py-1 text-xs text-muted no-underline hover:bg-elevated hover:text-highlighted`,to:`/delivery/${e}`},{default:c(()=>[f(i(e),1)]),_:2},1032,[`to`]))],64))),128))])):s(``,!0),u(`p`,M,i(d(b)(T.value.range.since))+` → `+i(d(b)(T.value.range.until))+` · `+i(T.value.range.weeks)+`w · weeks start Monday, UTC `,1)]),u(`section`,N,[Q.value?(l(),n(`p`,P,i(Q.value),1)):s(``,!0),u(`div`,F,[(l(!0),n(p,null,r(Z.value,e=>(l(),n(`div`,{key:e.label,class:`grid gap-0.5 rounded-lg border border-default bg-elevated px-4 py-3.5`},[u(`span`,I,i(e.label),1),u(`span`,L,i(e.value),1),u(`span`,R,i(e.note),1)]))),128))])]),u(`section`,z,[m[0]||=u(`div`,null,[u(`h2`,{class:`text-[0.9375rem] font-medium`},`By week`),u(`p`,{class:`text-sm text-muted`},`One row per Monday-start week · merged pull requests only`)],-1),u(`div`,B,[u(`table`,V,[u(`thead`,null,[u(`tr`,null,[u(`th`,{class:o([J,`text-left`])},`Week`,2),u(`th`,{class:o([J,`text-right`])},`Merged`,2),u(`th`,{class:o([J,`text-right`])},`Agent-authored`,2),u(`th`,{class:o([J,`text-right`])},`Issue → merge`,2),u(`th`,{class:o([J,`text-right`])},`First-pass CI`,2),u(`th`,{class:o([J,`text-right`])},`Rounds / PR`,2),u(`th`,{class:o([J,`text-right`])},`Findings`,2),u(`th`,{class:o([J,`text-right`])},`No human edit`,2),u(`th`,{class:o([J,`text-right`])},`Agent run min`,2)])]),u(`tbody`,null,[(l(!0),n(p,null,r(T.value.weeks,e=>(l(),n(`tr`,{key:e.week,class:o($(e.week)?`text-dimmed`:``)},[u(`td`,{class:o(Y),title:`${e.week} → ${e.until}`},[f(i(d(b)(e.week))+` – `+i(d(b)(e.until))+` `,1),$(e.week)?(l(),n(`span`,U,`(incomplete)`)):s(``,!0)],8,H),u(`td`,{class:o([Y,`text-right font-medium`])},i(e.prsMerged),3),u(`td`,{class:o([Y,`text-right`])},i(e.agentAuthoredPrs),3),u(`td`,{class:o([Y,`text-right`])},i(d(_)(e.leadTimeHours.median)),3),u(`td`,{class:o([Y,`text-right`])},i(d(C)(e)),3),u(`td`,{class:o([Y,`text-right`])},i(d(te)(e.reviewRounds.perPr)),3),u(`td`,{class:o([Y,`text-right`])},i(d(x)(e)),3),u(`td`,{class:o([Y,`text-right`])},i(d(S)(e.findings.noHumanEditShare)),3),u(`td`,{class:o([Y,`text-right`])},i(e.agentRuns.minutes.toFixed(0)),3)],2))),128))])])]),ge.value&&T.value.completeFrom?(l(),n(`p`,oe,` Incomplete weeks hold the newest pull requests the read reached — it is complete from `+i(d(v)(T.value.completeFrom))+` — so their numbers are a floor on the merges, not the week's. `,1)):s(``,!0)]),u(`section`,W,[m[3]||=u(`div`,null,[u(`h2`,{class:`text-[0.9375rem] font-medium`},`By unit`),u(`p`,{class:`text-sm text-muted`},` One row per board issue the pull requests link · the issue's opening starts the clock `)],-1),T.value.units.length===0?(l(),n(`p`,G,`Nothing merged in range.`)):(l(),n(`div`,K,[u(`table`,q,[u(`thead`,null,[u(`tr`,null,[u(`th`,{class:o([J,`text-left`])},`Issue`,2),u(`th`,{class:o([J,`text-left`])},`Unit`,2),u(`th`,{class:o([J,`text-left`])},`PRs`,2),u(`th`,{class:o([J,`text-right`])},`Issue → merge`,2),u(`th`,{class:o([J,`text-right`])},`First-pass CI`,2),u(`th`,{class:o([J,`text-right`])},`Rounds`,2),u(`th`,{class:o([J,`text-right`])},`Findings`,2),u(`th`,{class:o([J,`text-right`])},`No human edit`,2)])]),u(`tbody`,null,[(l(!0),n(p,null,r(T.value.units,e=>(l(),n(`tr`,{key:e.issue??`none`},[u(`td`,{class:o([Y,`whitespace-nowrap`])},[e.issue===null?(l(),n(`span`,ce,`—`)):(l(),n(`a`,{key:0,class:`text-primary hover:underline`,href:`https://github.com/${T.value.repo}/issues/${e.issue}`},`#`+i(e.issue),9,se))],2),u(`td`,{class:o([Y,`max-w-[28rem] truncate font-sans`]),title:e.title},i(e.title),11,le),u(`td`,{class:o([Y,`whitespace-nowrap`])},[(l(!0),n(p,null,r(e.prs,(e,t)=>(l(),n(p,{key:e},[t>0?(l(),n(p,{key:0},[f(`, `)],64)):s(``,!0),u(`a`,{class:`text-primary hover:underline`,href:`https://github.com/${T.value.repo}/pull/${e}`},i(e),9,ue)],64))),128))],2),u(`td`,{class:o([Y,`text-right`])},i(d(_)(e.leadTimeHours.median)),3),u(`td`,{class:o([Y,`text-right`])},i(d(C)(e)),3),u(`td`,{class:o([Y,`text-right`])},i(e.reviewRounds.verdicts),3),u(`td`,{class:o([Y,`text-right`])},i(d(x)(e)),3),u(`td`,{class:o([Y,`text-right`])},i(d(S)(e.findings.noHumanEditShare)),3)]))),128))])])])),u(`p`,de,[m[1]||=f(` Machine-readable twin: `,-1),u(`code`,fe,`GET /delivery/`+i(T.value.repo)+`.json`,1),m[2]||=f(` (same gate). `,-1)])]),u(`footer`,pe,[T.value.snapshotAt?(l(),n(`p`,me,[f(` As of `+i(d(v)(T.value.snapshotAt))+`, `+i(d(ne)(T.value.snapshotAt,d(ve)))+` · `,1),t(g,{class:`text-primary hover:underline`,to:`/delivery/${T.value.repo}${d(re)(d(ye))}`},{default:c(()=>[...m[4]||=[f(`read GitHub now`,-1)]]),_:1},8,[`to`])])):s(``,!0),u(`details`,null,[m[14]||=u(`summary`,{class:`cursor-pointer text-muted`},`How these numbers are computed`,-1),u(`div`,he,[m[12]||=u(`div`,null,[u(`b`,null,`Snapshot.`),f(` GitHub's record of the merged pull requests (each one's timeline and its branch's workflow runs, the board issue its body links) is read on an interval and kept as a snapshot the page, its JSON twin and `),u(`code`,null,`delivery report`),f(` serve; `),u(`code`,null,`?fresh=1`),f(` reads GitHub now. The run history you may see joins on every load. `)],-1),m[13]||=u(`div`,null,[u(`b`,null,`Issue → merge`),f(` runs from the linked board issue's opening (a closing keyword or a `),u(`code`,null,`board item`),f(` reference in the body) to the merge; a pull request that links no issue counts from its own opening. `),u(`b`,null,`First-pass CI`),f(` is green when every pull-request-triggered workflow run (`),u(`code`,null,`pull_request`),f(`, `),u(`code`,null,`pull_request_target`),f(`) on the first head succeeded at its first attempt — a rerun or a red run fails it; a head with no such run is not counted. `),u(`b`,null,`Review rounds`),f(` are the review agent's verdicts; a `),u(`i`,null,`fix round`),f(` is a verdict that followed a push. `),u(`b`,null,`No human edit`),f(` is the share of the agent's findings on pull requests where every push after the first verdict was an agent's: a bot login, or a commit co-authored by an agent. `),u(`b`,null,`Agent run minutes`),f(` are the finished runs of this repository that named a pull request. `)],-1),u(`div`,null,[m[6]||=u(`b`,null,`Identities.`,-1),m[7]||=f(` Verdicts by `,-1),u(`code`,null,i(T.value.identities.reviewers.join(`, `)||`(none configured)`),1),m[8]||=f(`; agent logins end in `,-1),m[9]||=u(`code`,null,`[bot]`,-1),T.value.identities.agentLogins.length?(l(),n(p,{key:0},[m[5]||=f(`, plus `,-1),u(`code`,null,i(T.value.identities.agentLogins.join(`, `)),1)],64)):s(``,!0),m[10]||=f(`; agent co-authors named `,-1),u(`code`,null,i(T.value.identities.agentCoauthors.join(`, `)||`(none)`),1),m[11]||=f(`. `,-1)])])])])]),_:1},8,[`title`])):s(``,!0)}}});export{X as default};
@@ -1 +0,0 @@
1
- import{t as e}from"./AppShell-DAtHiuI6.js";import{An as t,Cn as n,Cr as r,Li as i,Mn as a,Pi as o,Qr as s,Sn as c,Tr as l,Xr as u,Zn as d,_r as f,bn as p,dr as m,en as h,ir as g,ji as _,kn as v,l as y,ln as b,o as x,r as S,rn as C,xi as w,xn as T,yi as E,yn as D}from"./browser-B6T5hjfR.js";import{t as O}from"./SettingSelect-BIzAsLk1.js";import{t as k}from"./wallClock-DmaC1sKA.js";import{t as A}from"./indexFormat-B-pd4r7Y.js";import{i as ee}from"./format-BldUwl_R.js";import{i as j}from"./durationTone-U_rOqo6r.js";import{S as M,b as N,x as te}from"./sseReplay-DXC7kGbN.js";import{t as P}from"./NotFoundPage-DtE-GgTk.js";import{o as F,t as I}from"./RunFoldRow-V-iSy64e.js";var L=[`open`,`awaiting re-review`,`fixed`,`conceded`,`re-raised`,`not re-raised`,`unknown id`],R={id:`findings`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},z={class:`mb-2 flex flex-wrap items-baseline gap-x-2.5 gap-y-1 font-mono text-xs font-medium uppercase tracking-wider text-muted`},B={class:`count font-normal normal-case tracking-normal text-dimmed`},V=[`href`],H={key:0,class:`tally mb-2 font-mono text-[0.72rem] text-dimmed`},U={class:`m-0 list-none p-0`},W=[`data-finding-id`,`data-status`],G={class:`fid shrink-0 rounded border border-accented px-1.5 font-mono text-[0.72rem] font-medium text-toned`},K={key:1,class:`where shrink-0 font-mono text-xs text-toned`},q={key:2,class:`title min-w-0 flex-1 text-sm text-highlighted`},J={class:`trail flex basis-full flex-wrap items-baseline gap-x-1.5 font-mono text-[0.72rem] text-dimmed`},Y={key:0,"aria-hidden":`true`},X=[`href`,`data-run-id`,`onClick`],Z={key:3,class:`note basis-full text-sm text-toned`},Q={key:0,class:`empty py-1.5 text-sm text-muted`},ne=a({__name:`FindingsBlock`,props:{ledger:{},runs:{}},emits:[`open`],setup(e,{emit:a}){let s=e,d=a,m={open:`border-warn/30 text-warn`,"awaiting re-review":`border-accented text-toned`,fixed:`border-ok/30 text-ok`,conceded:`border-ok/30 text-ok`,"re-raised":`border-warn/30 text-warn`,"not re-raised":`border-accented text-muted`,"unknown id":`border-accented text-muted`},h={blocking:`text-bad`,major:`text-warn`,minor:`text-toned`,nit:`text-muted`},g=D(()=>s.ledger.findings),_=D(()=>{let e=new Map;for(let t of g.value)e.set(t.status,(e.get(t.status)??0)+1);return L.filter(t=>e.has(t)).map(t=>`${e.get(t)} ${t}`).join(` · `)}),y=D(()=>new Map(s.runs.map(e=>[e.id,e])));function x(e){return e.status===`re-raised`&&e.reRaisedAfter?`re-raised after ${e.reRaisedAfter}`:e.status}function S(e){if(e.file!==void 0)return e.line===void 0?e.file:`${e.file}:${e.line}`}function w(e){let t=[],n=(e,n)=>{if(!e||t.some(t=>t.runId===e.runId))return;let r=y.value.get(e.runId),i=r&&r.round!==void 0&&r.thread?`round ${r.round} · ${r.thread}`:e.round===void 0?e.runId:`round ${e.round}`;t.push({runId:e.runId,what:n,label:i,onPage:r!==void 0})};return n(e.raised,`raised`),n(e.disposition,e.disposition?.kind??``),n(e.lastSeen,e.status===`re-raised`?`re-raised`:`seen`),t}function E(e){d(`open`,e.runId)}return(a,s)=>{let d=l(`RouterLink`);return f(),n(`section`,R,[p(`h2`,z,[s[0]||=p(`span`,null,`Findings`,-1),p(`span`,B,`· `+i(g.value.length)+` finding`+i(g.value.length===1?``:`s`)+` — what each review raised, what the coding run recorded against it, whether the next review agreed`,1),p(`a`,{class:`prlink ml-auto whitespace-nowrap font-normal normal-case tracking-normal text-primary no-underline hover:underline`,href:e.ledger.pr.url??`https://github.com/${e.ledger.repo}/pull/${e.ledger.pr.number}`,target:`_blank`,rel:`noopener noreferrer`},[t(F,{class:`mr-1 align-[-0.125em]`}),v(i(e.ledger.repo)+`#`+i(e.ledger.pr.number),1)],8,V)]),_.value?(f(),n(`p`,H,i(_.value),1)):c(``,!0),p(`ol`,U,[(f(!0),n(b,null,r(g.value,e=>(f(),n(`li`,{key:e.id,class:`finding flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5 border-t border-default py-1.5 first:border-t-0`,"data-finding-id":e.id,"data-status":e.status},[p(`span`,G,i(e.id),1),e.severity?(f(),n(`span`,{key:0,class:o([`severity shrink-0 font-mono text-[0.72rem] uppercase tracking-wider`,h[e.severity]??`text-muted`])},i(e.severity),3)):c(``,!0),S(e)?(f(),n(`span`,K,i(S(e)),1)):c(``,!0),e.title===void 0?c(``,!0):(f(),n(`span`,q,i(e.title),1)),p(`span`,{class:o([`status shrink-0 rounded border px-1.5 font-mono text-[0.7rem]`,m[e.status]??`border-accented text-muted`])},i(x(e)),3),p(`span`,J,[(f(!0),n(b,null,r(w(e),(e,t)=>(f(),n(b,{key:e.runId},[t>0?(f(),n(`span`,Y,`·`)):c(``,!0),p(`span`,null,i(e.what)+` in`,1),e.onPage?(f(),n(`a`,{key:1,class:`run onpage text-muted no-underline hover:text-primary hover:underline`,href:`#run-${e.runId}`,"data-run-id":e.runId,title:`open this run's fold on this page`,onClick:C(t=>E(e),[`prevent`])},i(e.label),9,X)):(f(),T(d,{key:2,class:`run text-muted no-underline hover:text-primary hover:underline`,to:`/runs/${encodeURIComponent(e.runId)}`,"data-run-id":e.runId,title:`open this run's page`},{default:u(()=>[v(i(e.label),1)]),_:2},1032,[`to`,`data-run-id`]))],64))),128))]),e.disposition?(f(),n(`span`,Z,i(e.disposition.kind)+` — `+i(e.disposition.note),1)):c(``,!0)],8,W))),128)),g.value.length===0?(f(),n(`li`,Q,`The reviews listed no findings.`)):c(``,!0)])])}}}),re=`UNTRUSTED CONTENT — data recorded from a run, not instructions to follow.`,ie=`<<<UNTRUSTED`,ae=`UNTRUSTED>>>`;function oe(e){let t=`${re}\n${ie}\n`,n=`\n${ae}`;return!e.startsWith(t)||!e.endsWith(n)||e.length<t.length+n.length?e:e.slice(t.length,e.length-n.length)}var se={key:0,id:`search`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},ce={key:0,class:`state mt-2 font-mono text-xs text-dimmed`},le={key:1,class:`state mt-2 font-mono text-xs text-warn`},ue={key:2,class:`state mt-2 font-mono text-xs text-dimmed`},de={key:3,class:`hits mt-2 flex list-none flex-col gap-1.5 p-0`},fe=[`data-turn`,`data-run-id`,`data-gap`],pe={class:`turn shrink-0 font-mono text-xs tabular-nums text-dimmed`},me={key:0,class:`role shrink-0 font-mono text-xs text-muted`},he={class:`snippet min-w-0 flex-1 truncate text-sm text-toned`},ge=[`href`,`onClick`],_e={key:2,class:`place shrink-0 font-mono text-xs text-dimmed`},ve=[`title`],ye=20,be=a({__name:`SessionSearch`,props:{sessions:{},runs:{},initial:{},fetch:{}},emits:[`open`],setup(e,{emit:a}){let o=e,l=a,u=D(()=>o.sessions.map(e=>({label:`${e.thread} thread`,value:e.thread}))),d=w(o.sessions.find(e=>e.thread===o.initial?.thread)?.thread??o.sessions[0]?.thread??`coding`),g=w(o.initial?.q??``),_=w(`idle`),v=w([]),x=w(``),S=D(()=>o.sessions.find(e=>e.thread===d.value)),T=D(()=>new Map(o.runs.map(e=>[e.id,e])));function E(e){let t=e.runId===void 0?void 0:T.value.get(e.runId);return t?t.round!==void 0&&t.thread?`round ${t.round} · ${t.thread}`:t.agent??`its run`:e.runId===void 0?`before any recorded run`:`a run outside this unit`}async function k(){let e=g.value.trim(),t=S.value?.key;if(!t||e===``)return;_.value=`searching`;let n=o.fetch??((...e)=>globalThis.fetch(...e));try{let r=await n(`/api/runs.search?${`session=${encodeURIComponent(t)}&query=${encodeURIComponent(e)}&limit=${ye}`}`,{credentials:`same-origin`});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();v.value=(i.hits??[]).map(e=>({...e,snippet:oe(String(e.snippet??``))})),x.value=e,_.value=`done`}catch{v.value=[],_.value=`failed`}}return m(()=>{o.initial?.q&&S.value&&k()}),(a,o)=>{let m=y;return e.sessions.length>0?(f(),n(`section`,se,[o[2]||=p(`h2`,{class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},[p(`span`,null,`Search the conversation`),p(`span`,{class:`font-normal normal-case tracking-normal text-dimmed`},`· one thread's log at a time`)],-1),p(`form`,{class:`flex flex-wrap items-center gap-2`,onSubmit:C(k,[`prevent`])},[t(O,{id:`search-session`,modelValue:d.value,"onUpdate:modelValue":o[0]||=e=>d.value=e,items:u.value,class:`session`,"aria-label":`which thread's log to search`},null,8,[`modelValue`,`items`]),s(p(`input`,{id:`search-words`,"onUpdate:modelValue":o[1]||=e=>g.value=e,type:`search`,class:`words min-w-0 flex-1 rounded border border-accented bg-default px-2 py-1 text-sm text-highlighted placeholder:text-dimmed`,placeholder:`words the conversation used — a file, an error, a decision`,"aria-label":`words to search for`},null,512),[[h,g.value]]),t(m,{type:`submit`,size:`xs`,color:`neutral`,variant:`outline`,label:`Search`,disabled:_.value===`searching`},null,8,[`disabled`])],32),_.value===`searching`?(f(),n(`p`,ce,`searching…`)):_.value===`failed`?(f(),n(`p`,le,`the search could not be run`)):_.value===`done`&&v.value.length===0?(f(),n(`p`,ue,` nothing in the `+i(d.value)+` thread's log says “`+i(x.value)+`” `,1)):_.value===`done`?(f(),n(`ol`,de,[(f(!0),n(b,null,r(v.value,e=>(f(),n(`li`,{key:`${e.turn}-${e.runId??``}`,class:`hit flex flex-wrap items-baseline gap-x-2 gap-y-0.5 border-t border-default pt-1.5 first:border-t-0 first:pt-0`,"data-turn":e.turn,"data-run-id":e.runId,"data-gap":e.gap},[p(`span`,pe,`turn `+i(e.turn),1),e.role?(f(),n(`span`,me,i(e.role),1)):c(``,!0),p(`span`,he,i(e.snippet),1),e.runId&&T.value.has(e.runId)?(f(),n(`a`,{key:1,class:`place shrink-0 font-mono text-xs text-primary no-underline hover:underline`,href:`#run-${e.runId}`,title:`open this run's fold at the step this turn lives in`,onClick:C(t=>l(`open`,e.runId,e.turn),[`prevent`])},i(E(e))+` ↓`,9,ge)):(f(),n(`span`,_e,i(E(e)),1)),e.gap===void 0?c(``,!0):(f(),n(`span`,{key:3,class:`gap basis-full font-mono text-xs text-warn`,title:`the log before turn ${e.gap} was folded into a summary; this turn is after it`},`past a compaction gap at turn `+i(e.gap),9,ve))],8,fe))),128))])):c(``,!0)])):c(``,!0)}}}),xe={key:0,id:`standing`,class:`flex items-center gap-2 font-mono`},Se=[`title`],Ce={key:0,class:`mx-auto max-w-6xl`},we={id:`unitmeta`,class:`facts mb-3 flex flex-wrap items-baseline gap-x-3 gap-y-1.5 px-(--sb-gutter) font-mono text-xs text-dimmed`},Te={class:`unit text-[0.68rem] font-medium uppercase tracking-wider text-toned`},Ee=[`href`],De={key:1,class:`repo`},Oe=[`href`],ke={key:3,class:`reftag rounded border border-accented px-1.5 text-[0.75rem] text-toned`},Ae=[`href`],je=[`href`],Me={class:`thread flex items-center gap-1.5`,"data-thread":`coding`},Ne=[`href`],Pe=[`title`],Fe={key:2,class:`text-dimmed`},Ie={class:`thread flex items-center gap-1.5`,"data-thread":`review`},Le=[`href`],Re=[`title`],ze={key:2,class:`text-dimmed`},Be={class:`rounds tabular-nums`},Ve={id:`contract`,class:`block mb-4 rounded-lg border border-default bg-(--ui-bg-muted) px-(--sb-gutter) py-3`},$={class:`mb-2 flex items-baseline gap-2.5 font-mono text-xs font-medium uppercase tracking-wider text-muted`},He={class:`plan font-normal normal-case tracking-normal text-dimmed`},Ue={class:`font-mono`},We={key:0,class:`title text-sm text-highlighted`},Ge={key:1,class:`title text-sm text-muted`},Ke={key:2,class:`report mt-2 whitespace-pre-wrap break-words text-sm text-toned`},qe={id:`rounds`,class:`mb-1 flex items-baseline gap-2.5 px-(--sb-gutter) font-mono text-xs font-medium uppercase tracking-wider text-muted`},Je={class:`count font-normal normal-case tracking-normal text-dimmed`},Ye={id:`unitruns`,class:`m-0 list-none border-t border-muted p-0`},Xe={key:0,id:`empty`,class:`empty px-2 py-2 text-sm text-muted`},Ze=a({__name:`UnitPage`,setup(a){let s=x(`unit`),d=s?.view,m=k(s?.now),h=typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams,y=E(new Set((h.get(`open`)??``).split(`,`).map(e=>e.trim()).filter(Boolean))),S=E(new Map),C=h.get(`turn`);C!==null&&/^\d+$/.test(C)&&y.size===1&&S.set([...y][0],Number(C));let w={thread:h.get(`session`)??void 0,q:h.get(`q`)??void 0},O=D(()=>d?`Unit ${d.id}`:`Unit`),P=D(()=>te(d?.instance.repo)),L=D(()=>M(d?.instance.repo,d?.branch)),R=D(()=>d?.pr?N(d.instance.repo,d.pr.number)??void 0:void 0),z=D(()=>d?.issue!==void 0&&P.value?`${P.value}/issues/${d.issue}`:void 0),B=e=>e&&/^https?:\/\//.test(e)?e:void 0,V=D(()=>B(d?.sourceUrls.coding)),H=D(()=>B(d?.sourceUrls.review)),U=D(()=>d?.instance.runId===void 0?void 0:`/runs/${encodeURIComponent(d.instance.runId)}`),W=D(()=>{if(!d)return{cls:`grey`,text:``};if(d.ending)return{cls:d.ending.kind===`merged`||d.ending.kind===`merge_ready`||d.ending.kind===`done`?`ok`:`grey`,text:d.ending.kind,at:d.ending.at};let e=d.runs.find(e=>!e.finished);if(e)return{cls:`live`,text:`round ${e.round} · ${e.thread} running`};let t=d.runs.at(-1);return t?{cls:`grey`,text:`round ${t.round} · ${t.thread} ended`}:{cls:`grey`,text:`not started`}}),G={ok:`border-ok/30 text-ok`,live:`border-ok/30 text-ok motion-safe:animate-pulse`,grey:`border-accented text-muted`},K=D(()=>new Set(d?.rounds.map(e=>e.index)??[]).size),q=D(()=>{if(!d)return[];let e=[],t=(t,n)=>{if(n===void 0)return;let r=d.runs.find(e=>e.thread===t&&e.session?.key!==void 0)?.session?.key;e.push({thread:t,key:r??`${n}:${t}`})};return t(`coding`,d.threads.coding),t(`review`,d.threads.review),e});function J(e,t){t!==void 0&&S.set(e,t),y.add(e),g().then(()=>{let t=document.getElementById(`run-${e}`);t?.scrollIntoView?.({block:`center`}),t?.classList.add(`revealed`),setTimeout(()=>t?.classList.remove(`revealed`),1500)})}function Y(e){return typeof e==`number`?A(e,m.value):``}function X(e){return typeof e==`number`?ee(e):void 0}return(a,s)=>{let h=l(`RouterLink`);return f(),T(e,{title:O.value,nav:`runs`},{leading:u(()=>[t(h,{class:`back text-sm text-primary no-underline hover:underline`,to:`/runs`},{default:u(()=>[...s[0]||=[v(`← All runs`,-1)]]),_:1})]),status:u(()=>[_(d)?(f(),n(`span`,xe,[p(`span`,{class:o([`chip rounded border px-1.5 text-[0.7rem]`,G[W.value.cls]])},i(W.value.text),3),W.value.at===void 0?c(``,!0):(f(),n(`span`,{key:0,class:`text-xs text-muted`,title:X(W.value.at)},i(Y(W.value.at)),9,Se))])):c(``,!0)]),default:u(()=>[_(d)?(f(),n(`div`,Ce,[p(`div`,we,[p(`span`,Te,`unit `+i(_(d).id),1),P.value?(f(),n(`a`,{key:0,class:`repo text-primary no-underline hover:underline`,href:P.value,target:`_blank`,rel:`noopener noreferrer`},i(_(d).instance.repo),9,Ee)):(f(),n(`span`,De,i(_(d).instance.repo),1)),L.value?(f(),n(`a`,{key:2,class:`reftag rounded border border-accented px-1.5 text-[0.75rem] text-toned no-underline hover:border-primary hover:text-primary`,href:L.value,target:`_blank`,rel:`noopener noreferrer`,title:`the unit's branch on GitHub`},i(_(d).branch),9,Oe)):(f(),n(`span`,ke,i(_(d).branch),1)),_(d).pr&&R.value?(f(),n(`a`,{key:4,class:`prlink whitespace-nowrap text-primary no-underline hover:underline`,href:R.value,target:`_blank`,rel:`noopener noreferrer`},[t(F,{class:`mr-1 align-[-0.125em]`}),v(`#`+i(_(d).pr.number),1)],8,Ae)):c(``,!0),_(d).issue!==void 0&&z.value?(f(),n(`a`,{key:5,class:`issue whitespace-nowrap text-muted no-underline hover:text-primary hover:underline`,href:z.value,target:`_blank`,rel:`noopener noreferrer`,title:`the unit's board issue`},`issue #`+i(_(d).issue),9,je)):c(``,!0),p(`span`,Me,[t(j),V.value?(f(),n(`a`,{key:0,class:`text-muted no-underline hover:text-primary hover:underline`,href:V.value,target:`_blank`,rel:`noopener noreferrer`,title:`open the coding thread`},`coding thread`,8,Ne)):_(d).threads.coding?(f(),n(`span`,{key:1,class:`text-muted`,title:_(d).threads.coding},`coding thread`,8,Pe)):(f(),n(`span`,Fe,`coding thread not opened yet`))]),p(`span`,Ie,[t(j),H.value?(f(),n(`a`,{key:0,class:`text-muted no-underline hover:text-primary hover:underline`,href:H.value,target:`_blank`,rel:`noopener noreferrer`,title:`open the review thread`},`review thread`,8,Le)):_(d).threads.review?(f(),n(`span`,{key:1,class:`text-muted`,title:_(d).threads.review},`review thread`,8,Re)):(f(),n(`span`,ze,`review thread not opened yet`))]),p(`span`,Be,i(K.value)+` round`+i(K.value===1?``:`s`),1)]),p(`section`,Ve,[p(`h2`,$,[p(`span`,null,`Unit `+i(_(d).id),1),p(`span`,He,[_(d).instance.plan?(f(),n(b,{key:0},[s[1]||=v(` of plan `,-1),p(`span`,Ue,i(_(d).instance.plan.id),1),_(d).instance.attempt===void 0?c(``,!0):(f(),n(b,{key:0},[v(` · attempt `+i(_(d).instance.attempt),1)],64))],64)):(f(),n(b,{key:1},[v(`of a ship request`)],64))]),U.value?(f(),T(h,{key:0,class:`parent ml-auto font-normal normal-case tracking-normal text-primary no-underline hover:underline`,to:U.value,title:`the pipeline's own record — its card, its summary, every unit`},{default:u(()=>[...s[2]||=[v(`the plan's record →`,-1)]]),_:1},8,[`to`])):c(``,!0)]),_(d).title?(f(),n(`p`,We,i(_(d).title),1)):(f(),n(`p`,Ge,` The plan gave this unit no title; its branch is `+i(_(d).branch)+`. `,1)),_(d).ending?(f(),n(`p`,Ke,i(_(d).ending.report),1)):c(``,!0)]),_(d).findings?(f(),T(ne,{key:0,ledger:_(d).findings,runs:_(d).runs,onOpen:J},null,8,[`ledger`,`runs`])):c(``,!0),q.value.length>0?(f(),T(be,{key:1,sessions:q.value,runs:_(d).runs,initial:w,onOpen:J},null,8,[`sessions`,`runs`])):c(``,!0),p(`h2`,qe,[s[3]||=p(`span`,null,`Runs by round`,-1),p(`span`,Je,` · `+i(_(d).runs.length)+` run`+i(_(d).runs.length===1?``:`s`)+` — the coding thread's and the review thread's, as the rounds happened `,1)]),p(`ol`,Ye,[(f(!0),n(b,null,r(_(d).runs,e=>(f(),T(I,{key:e.id,run:e,now:_(m),label:`round ${e.round} · ${e.thread}`,open:y.has(e.id),land:S.get(e.id)},null,8,[`run`,`now`,`label`,`open`,`land`]))),128)),_(d).runs.length===0?(f(),n(`li`,Xe,` No runs yet — the runner has not started this unit. `)):c(``,!0)])])):c(``,!0)]),_:1},8,[`title`])}}}),Qe=a({__name:`UnitRoutePage`,setup(e){let t=d(S,null);return(e,n)=>!_(t)||_(t).page!==`unit`?(f(),T(P,{key:0})):(f(),T(Ze,{key:1}))}});export{Qe as default};