spexcode 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -149
- package/package.json +1 -1
- package/spec-cli/hooks/harness.sh +26 -6
- package/spec-cli/src/anchors.ts +27 -5
- package/spec-cli/src/cli.ts +171 -28
- package/spec-cli/src/client.ts +112 -13
- package/spec-cli/src/delivery-queue.ts +62 -4
- package/spec-cli/src/execution-trace.ts +444 -0
- package/spec-cli/src/gateway-hub.ts +10 -8
- package/spec-cli/src/gateway.ts +99 -6
- package/spec-cli/src/git.ts +477 -101
- package/spec-cli/src/graph.ts +56 -6
- package/spec-cli/src/graphCache.ts +86 -17
- package/spec-cli/src/graphStream.ts +1 -1
- package/spec-cli/src/guide.ts +93 -4
- package/spec-cli/src/harness-select.ts +2 -2
- package/spec-cli/src/harness.ts +344 -66
- package/spec-cli/src/help.ts +22 -10
- package/spec-cli/src/host-resources.ts +62 -7
- package/spec-cli/src/identity-presets.js +16 -6
- package/spec-cli/src/index.ts +101 -13
- package/spec-cli/src/layout.ts +116 -33
- package/spec-cli/src/lint.ts +37 -7
- package/spec-cli/src/materialize.ts +10 -5
- package/spec-cli/src/plugin-harness.ts +10 -10
- package/spec-cli/src/reviews.ts +57 -28
- package/spec-cli/src/session-execution.ts +68 -0
- package/spec-cli/src/session-files.ts +121 -0
- package/spec-cli/src/session-follow.ts +4 -4
- package/spec-cli/src/session-reparent.ts +33 -0
- package/spec-cli/src/session-timeline.ts +163 -14
- package/spec-cli/src/session-web.ts +135 -0
- package/spec-cli/src/sessions.ts +584 -104
- package/spec-cli/src/uninstall.ts +1 -1
- package/spec-cli/templates/spec/project/.plugins/core/comment-altitude/spec.md +2 -21
- package/spec-cli/templates/spec/project/.plugins/core/spec.md +12 -13
- package/spec-cli/templates/spec/project/.plugins/prompts/atomic-landing/spec.md +5 -22
- package/spec-cli/templates/spec/project/.plugins/prompts/forge-link/spec.md +2 -1
- package/spec-cli/templates/spec/project/.plugins/prompts/memory-hygiene/spec.md +4 -6
- package/spec-cli/templates/spec/project/.plugins/prompts/reproduce-before-fix/spec.md +3 -9
- package/spec-dashboard/dist/assets/{App-F9uaAVcH.js → App-B6IbFbGu.js} +2 -2
- package/spec-dashboard/dist/assets/Dashboard-_sDk7Rcg.js +27 -0
- package/spec-dashboard/dist/assets/EvalsPage-BT357Lyt.js +2 -0
- package/spec-dashboard/dist/assets/{IssuesPage-CuKLFhH3.js → IssuesPage-BG9rNOgV.js} +1 -1
- package/spec-dashboard/dist/assets/MobileApp-D9yPMR3A.js +2 -0
- package/spec-dashboard/dist/assets/{Modal-CQgYymmr.js → Modal-B3EcgeA3.js} +1 -1
- package/spec-dashboard/dist/assets/{PageScroll-hT7UTLvD.js → PageScroll-CNZOugWV.js} +1 -1
- package/spec-dashboard/dist/assets/{ProjectsPage-CtXxakF9.js → ProjectsPage-C2CRHmvs.js} +1 -1
- package/spec-dashboard/dist/assets/SessionInterface-DOEjuT3l.js +40 -0
- package/spec-dashboard/dist/assets/{SessionWindow-CixDi4PI.js → SessionWindow-1nYgZ4CL.js} +1 -1
- package/spec-dashboard/dist/assets/Settings-7WeTJn0V.js +1 -0
- package/spec-dashboard/dist/assets/Thread-CEbzAFQn.js +13 -0
- package/spec-dashboard/dist/assets/data-SlvxNA2r.js +1 -0
- package/spec-dashboard/dist/assets/{index-DrVao0Ep.js → index-DLVeOHL-.js} +10 -10
- package/spec-dashboard/dist/assets/index-DYLGfPjx.css +1 -0
- package/spec-dashboard/dist/assets/{launch-BBH02b1v.js → launch-yxCYr64x.js} +29 -29
- package/spec-dashboard/dist/assets/sessionSurface--7l69h4F.js +1 -0
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-eval/src/cli.ts +6 -1
- package/spec-eval/src/evaltab.ts +7 -5
- package/spec-eval/src/freshness.ts +383 -104
- package/spec-eval/src/scenariofresh.ts +2 -2
- package/spec-eval/src/sessioneval.ts +126 -132
- package/spec-dashboard/dist/assets/Dashboard-Ba_jhxp1.js +0 -27
- package/spec-dashboard/dist/assets/EvalsPage-FixoOg_n.js +0 -2
- package/spec-dashboard/dist/assets/MobileApp-CHgEHORJ.js +0 -2
- package/spec-dashboard/dist/assets/SessionInterface-Bpie-9fs.js +0 -39
- package/spec-dashboard/dist/assets/Settings-C2MsucfE.js +0 -1
- package/spec-dashboard/dist/assets/Thread-C6Go8HRh.js +0 -13
- package/spec-dashboard/dist/assets/data-B-RQmit6.js +0 -1
- package/spec-dashboard/dist/assets/index-CsI8DElI.css +0 -1
- package/spec-dashboard/dist/assets/terminalFont-C6oGNKrf.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as U,E as re,c as J,j as s,s as Cs,I as Z,r as c,d as ke,e as be,f as Ts,g as es,n as Fs,q as As,h as Ps}from"./index-DrVao0Ep.js";import{E as ss,R as ds,a as q,L as Os,S as Is,F as ns,s as ts,k as as,e as Ks,r as zs,p as Bs,b as _s,c as Te,d as W,f as G,O as qs,g as Us,D as Fe,m as we,h as Vs,i as ls,u as Hs,j as Xs,l as Ys,n as Qs,o as ye,q as Gs,t as Ae,v as hs,w as Js}from"./Thread-C6Go8HRh.js";import{b as Zs,c as Ds,d as Ws,e as en}from"./data-B-RQmit6.js";import"./PageScroll-hT7UTLvD.js";const rs={video:"vid",image:"img",transcript:"txt",data:"data"},sn=["is","state","verdict","freshness","evidence","node","filer","session","scope"],vs=e=>`eval:${e.node}·${e.scenario}`;function nn({e}){const a=U(),r=e.humanOk&&a("evalsFeed.okdTip",{by:e.humanOk.by,at:new Date(e.humanOk.ts).toLocaleString()});return s.jsx(ds,{state:s.jsx(q,{kind:"eval",state:e.state}),title:e.scenario,meta:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ef-node",style:{color:`hsl(${e.hue??210} 60% 70%)`},children:e.node}),e.by&&s.jsx("span",{children:a("evalsFeed.filedBy",{by:e.by})}),s.jsx("span",{children:a("evalsFeed.filedAt",{at:tn(e.ts)})})]}),aside:s.jsxs(s.Fragment,{children:[e.inSession&&s.jsx("span",{className:"rl-tag in-session",children:a("evalsFeed.sessionTag")}),as(e).some(i=>rs[i])&&s.jsx("span",{className:"rl-tag",children:as(e).map(i=>rs[i]).filter(Boolean).join("·")}),e.humanOk&&s.jsx("span",{role:"img",className:"ef-okd","data-tip":r,"aria-label":r,children:s.jsx(Z,{name:"check",size:11})})]})})}const tn=e=>{const a=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return a<3600?`${Math.max(1,Math.floor(a/60))}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`},ee=(e,a,r,i=b=>b)=>{var b,v;return(((v=(b=e==null?void 0:e.facets)==null?void 0:b[a])==null?void 0:v.options)??[]).map(x=>({value:x.value,label:x.value===""?r:i(x.value)}))};function an({pageData:e,loading:a=!1,sessions:r=[],queryText:i="",onQueryText:b,hrefFor:v,notice:x=null,leading:m=null,error:j=null,empty:E=null,pagination:R=null}){var M,se,ie;const u=U(),d=String(i??"").trim()||re,p=(o,K)=>b(Cs(d,o,K)),L=Array.isArray(e==null?void 0:e.items)?e.items:[],N=((M=e==null?void 0:e.counts)==null?void 0:M.fail)||{},S=((se=e==null?void 0:e.counts)==null?void 0:se.pass)||{},P=((ie=e==null?void 0:e.counts)==null?void 0:ie.unmeasured)||0,y=o=>o>0?{text:`+${o} ${u("reviewList.freshness.stale")}`,compact:`+${o}`}:null,C=J(d,"verdict"),O=L.flatMap(o=>o.filterKind===ss.BLIND?[{key:`blind:${o.node}·${o.scenario}`,cls:"se-blind",content:s.jsx(ds,{state:s.jsx(q,{kind:"eval",state:"missing"}),title:o.scenario,meta:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ef-node",style:{color:`hsl(${o.hue??210} 60% 70%)`},children:o.node}),s.jsx("span",{children:u("sessionEval.unmeasured")})]})})}]:o.filterKind===ss.RESULT?[{key:vs(o),href:v(o),content:s.jsx(nn,{e:o})}]:[]),I={label:u("reviewList.facetReview"),value:J(d,"state"),options:ee(e,"review",u("reviewList.all"),o=>u(o==="reviewed"?"reviewList.reviewed":"reviewList.needsReview"))},f={label:u("reviewList.facetFreshness"),value:J(d,"freshness"),options:ee(e,"freshness",u("reviewList.all"),o=>u(`reviewList.freshness.${o}`))},T={label:u("reviewList.facetKind"),value:J(d,"evidence")||"all",options:ee(e,"kind",u("evalsFeed.kind.all"),o=>u(`evalsFeed.kind.${o}`))},B={label:u("reviewList.facetSession"),value:J(d,"session"),options:ee(e,"session",u("reviewList.all"),o=>u(o==="present"?"reviewList.sessionPresent":"reviewList.sessionMissing"))},_=J(d,"evidence");return s.jsx(Os,{notice:x,leading:m,error:j,loading:a,title:u("evalsFeed.title"),search:{value:String(i??"").trim()?i:re,onSubmit:b,placeholder:u("reviewList.searchEvals"),label:u("reviewList.search"),keys:sn,suggest:{node:ee(e,"node",u("reviewList.all")).filter(o=>o.value),filer:ee(e,"filer",u("reviewList.all")).filter(o=>o.value).map(({value:o})=>{const K=r.find(V=>V.id===o);return{value:o,label:K?ts(K):null}}),scope:r.map(o=>({value:o.id,label:ts(o)}))}},sections:[{key:"fail",label:s.jsx(q,{kind:"eval",state:"fail",title:u("reviewList.verdict.fail"),showLabel:!0}),count:N.fresh||0,countSuffix:y(N.stale||0),active:C==="fail",onSelect:()=>p("verdict",C==="fail"?"":"fail")},{key:"pass",label:s.jsx(q,{kind:"eval",state:"pass",title:u("reviewList.verdict.pass"),showLabel:!0}),count:S.fresh||0,countSuffix:y(S.stale||0),active:C==="pass",onSelect:()=>p("verdict",C==="pass"?"":"pass")},{key:"unmeasured",label:s.jsx(q,{kind:"eval",state:"missing",title:u("reviewList.verdict.unmeasured"),showLabel:!0}),count:P,active:C==="unmeasured",onSelect:()=>p("verdict",C==="unmeasured"?"":"unmeasured")}],sectionMode:"filters",facets:s.jsxs(s.Fragment,{children:[s.jsx(ns,{label:f.label,value:f.value,options:f.options,clearLabel:u("reviewList.all"),onChange:o=>p("freshness",o)}),s.jsx(ns,{label:T.label,value:T.value,options:T.options,onChange:o=>p("evidence",o==="all"?"":o)})]}),secondaryFilters:s.jsx(Is,{label:u("reviewList.filters"),clearLabel:u("reviewList.all"),groups:[{label:I.label,value:I.value,active:!!I.value,options:I.options,onChange:o=>p("state",o)},{label:B.label,value:B.value,active:!!B.value,options:B.options,onChange:o=>p("session",o)},{label:f.label,value:f.value,active:!!f.value,options:f.options,onChange:o=>p("freshness",o),mobileOnly:!0},{label:T.label,value:T.value,active:!!_,options:T.options,clearLabel:null,onChange:o=>p("evidence",o==="all"?"":o),mobileOnly:!0}]}),rows:O,pagination:R,empty:E||{hasData:((e==null?void 0:e.sourceTotal)??0)>0,dataset:u("evalsFeed.datasetEmpty"),filtered:u("evalsFeed.noMatches")}})}const ln=[{name:"ok",color:"green",when:e=>!e.okd&&e.isLatest,descKey:"annotator.cmd.okDesc"}];function rn(e,a){return ln.filter(r=>r.when(e)).map(r=>({...r,run:a[r.name]}))}function on(e,a){return(e||"").replace(/\{(\w+)\}/g,(r,i)=>a[i]!=null?String(a[i]):r)}const is=(e,a)=>{let r=null;for(const i of e)if(i.at<=a)r=i;else break;return r},cn=e=>{if(!e||!Array.isArray(e.events))return null;const a=e.v===1?"time":typeof e.axis=="string"?e.axis:"time",r=e.v===1?i=>i.tMs:i=>i.at;return{axis:a,events:e.events.map(i=>({at:r(i),step:i.step,...i.node?{node:i.node}:{}}))}},un=(e,a,r)=>e==="time"?we(a):e==="frame"?`#${a}`:e==="line"?`L${a}`:e==="index"?r?`${a}/${r}`:`${a}`:String(a);function os({events:e,axis:a,extent:r,activeStepIdx:i,onSeek:b}){return s.jsx("div",{className:"an-ruler",children:e.map((v,x)=>s.jsxs("button",{className:`an-step ${i===x?"on":""}`,onClick:()=>b(v.at),"data-tip":v.node?`→ ${v.node}`:void 0,children:[un(a,v.at,r)," ",v.step]},x))})}const xe=8;function dn({hidden:e,total:a,histIdx:r,onPick:i}){const b=U(),v=Hs(),x=b("annotator.abMore",{n:e.length});return s.jsxs("div",{className:"an-ab-more",ref:v.ref,children:[s.jsx(be,{icon:"ellipsis",size:14,className:"an-ab-morebtn",label:x,"aria-haspopup":"menu","aria-expanded":v.open,onClick:m=>v.toggle(m.currentTarget),onKeyDown:v.onTriggerKeyDown}),v.open&&s.jsx("div",{className:"rl-menu an-ab-menu",role:"menu","aria-label":x,ref:v.menuRef,onKeyDown:v.onMenuKeyDown,children:e.map(m=>{const j=Te(m);return s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m.idx===r,tabIndex:-1,className:"rl-menu-item an-ab-menuitem",onFocus:v.onItemFocus,onClick:()=>{v.close(!0),i(m.idx)},children:[s.jsx(q,{kind:"eval",state:j,size:13}),s.jsxs("span",{className:"an-ab-menupos",children:[a-m.idx,"/",a]}),s.jsx("span",{className:"an-ab-menudate",children:new Date(m.ts).toLocaleString()})]},`${m.ts}-${m.idx}`)})})]})}function hn({entry:e,history:a,sourceKey:r="project",specs:i=[],sessions:b=[],onWrite:v,onOpenSession:x,onFocusNode:m=null,listHref:j=null,backHref:E=null,backLabel:R=null,queue:u={prev:[],next:[]}}){var Qe,Ge,Je,Ze,De,We;const d=U(),p=c.useRef(null),L=c.useRef(null),N=c.useRef(null),S=c.useRef(null),P=c.useRef(0),[y,C]=c.useState([]),[O,I]=c.useState("time"),[f,T]=c.useState(null),[B,_]=c.useState(""),[M,se]=c.useState(!1),[ie,o]=c.useState(null),K=c.useRef(null),V=c.useRef(null),ne=c.useRef(null),ge=c.useRef(0),[fs,Pe]=c.useState(0),[je,Oe]=c.useState(-1),[Ie,Ke]=c.useState(null),[oe,Ee]=c.useState(!1),[ze,Le]=c.useState(!1),[Se,Me]=c.useState(null),[ce,$e]=c.useState(null),[F,Be]=c.useState(null),[A,te]=c.useState(0),w=F&&F[A]||e,ms=`${A}:${w.ts||w.codeSha||w.blob||"reading"}`,xs=`${r}·${e.node}·${e.scenario}·${ms}`,[ps,bs]=c.useState([]);c.useEffect(()=>{let n=!0;return Zs().then(t=>{n&&Array.isArray(t)&&bs(t)}).catch(()=>{}),()=>{n=!1}},[]),c.useEffect(()=>{T(null),_(""),C([]),o(null),te(0),Be(null),Be(Array.isArray(a)?a:[e])},[e.node,e.scenario,e.ts,e.blob,(Qe=e.humanOk)==null?void 0:Qe.ts,a]),c.useEffect(()=>{T(null),o(null)},[A]);const ae=Ks(w),H=ae.find(n=>n.kind==="video"&&n.state==="present"),ue=ae.filter(n=>n.kind==="image"),ws=ae.filter(n=>n.kind!=="video"&&n.kind!=="image"),X=!!H,de=e.thread??null,Ne=c.useMemo(()=>((de==null?void 0:de.replies)??[]).filter(n=>n.rid!==void 0),[de]),_e=F&&((Ge=F[0])==null?void 0:Ge.by)||e.by||null,z=c.useMemo(()=>Ne.map((n,t)=>{const l=zs(Bs(n.body),y);return l&&l.seekable?{i:t,tMs:l.tMs,step:l.step,label:l.label}:null}).filter(Boolean).sort((n,t)=>n.tMs-t.tMs),[Ne,y]),qe=c.useRef(y);qe.current=y;const Ue=c.useRef(z);Ue.current=z;const he=c.useCallback(()=>{const n=ge.current,t=qe.current;let l=-1;for(let g=0;g<t.length&&t[g].at<=n;g++)l=g;Oe(g=>g===l?g:l);let h=null;for(const g of Ue.current)if(g.tMs<=n)h=g.i;else break;Ke(g=>g===h?g:h)},[]);c.useEffect(()=>{he()},[z,y,he]),c.useEffect(()=>{ge.current=0,K.current&&(K.current.style.width="0%"),V.current&&(V.current.style.left="0%"),ne.current&&(ne.current.textContent=""),Oe(-1),Ke(null),Pe(0),Ee(!1),Le(!1),Me(null),$e(null)},[e.blob,e.scenario,e.node]),c.useEffect(()=>{if(C([]),I("time"),!w.timelineBlob)return;let n=!0;return fetch(ke(`/api/evidence/${w.timelineBlob}`)).then(t=>t.ok?t.json():null).then(t=>{const l=n&&cn(t);l&&(C(l.events),I(l.axis))}).catch(()=>{}),()=>{n=!1}},[w.timelineBlob]),c.useEffect(()=>{const n=p.current;if(!n)return;const t=()=>{const k=Math.round((n.currentTime||0)*1e3),$=Math.round((n.duration||0)*1e3);ge.current=k;const Q=$?k/$*100:0;K.current&&(K.current.style.width=`${Q}%`),V.current&&(V.current.style.left=`${Q}%`),ne.current&&(ne.current.textContent=`${we(k)} / ${we($)}`),he()},l=()=>{Pe(n.duration||0),t()},h=()=>Ee(!0),g=()=>Ee(!1);return n.addEventListener("timeupdate",t),n.addEventListener("seeked",t),n.addEventListener("loadedmetadata",l),n.addEventListener("durationchange",l),n.addEventListener("play",h),n.addEventListener("pause",g),l(),()=>{n.removeEventListener("timeupdate",t),n.removeEventListener("seeked",t),n.removeEventListener("loadedmetadata",l),n.removeEventListener("durationchange",l),n.removeEventListener("play",h),n.removeEventListener("pause",g)}},[H==null?void 0:H.hash,e.node,e.scenario,A,he]);const Y=Math.round(fs*1e3),ve=y[je]||null,Ve=O==="time"?Y:O==="frame"?ue.length:O==="index"?y.length:0,D=c.useCallback(n=>{const t=p.current;t&&(t.currentTime=n/1e3)},[]),fe=c.useCallback(()=>{const n=p.current;n&&(n.paused?n.play():n.pause())},[]),He=(n,t)=>{$e(n),t!=null&&D(t)},me=c.useCallback(async n=>{const t=p.current;if(!(t!=null&&t.videoWidth))return null;se(!0),_(d("annotator.capturing"));try{t.seeking&&await new Promise($=>t.addEventListener("seeked",$,{once:!0}));const l=document.createElement("canvas");l.width=t.videoWidth,l.height=t.videoHeight;const h=l.getContext("2d");h.drawImage(t,0,0,l.width,l.height),n&&(h.strokeStyle="#ff9a3c",h.lineWidth=Math.max(2,l.width/300),h.strokeRect(n.x/100*l.width,n.y/100*l.height,n.w/100*l.width,n.h/100*l.height));const g=await new Promise($=>l.toBlob($,"image/png")),{hash:k}=await Ds(g);if(!k)throw new Error("no hash");return _(""),k}catch{return _(d("annotator.failed")),null}finally{se(!1)}},[d]),ks=c.useCallback(async()=>{var l;const n=p.current;if(!n)return null;n.pause();const t=Math.round((n.currentTime??0)*1e3);return{tMs:t,step:((l=is(y,t))==null?void 0:l.step)??null,frame:await me(null)}},[y,me]),Re=c.useCallback(async n=>{const t=p.current;if(!t)return;t.pause();const l=Math.round((t.currentTime||0)*1e3),h=is(y,l),g=await me(n),k=[_s(l,h==null?void 0:h.step)];g&&k.push(``),h!=null&&h.node&&h.node!==e.node&&k.push(`re: [[${h.node}]]`),k.push(""),o({seq:++P.current,body:k.join(`
|
|
2
|
-
`)})},[y,e.node,me]),Ce=c.useCallback(n=>{var h;if(!z.length)return;let t=z.findIndex(g=>g.i===ce);if(t<0){const g=Math.round((((h=p.current)==null?void 0:h.currentTime)||0)*1e3);t=z.reduce((k,$,Q)=>$.tMs<=g?Q:k,-1)}t=Math.min(z.length-1,Math.max(0,t+n));const l=z[t];$e(l.i),D(l.tMs)},[z,ce,D]);c.useEffect(()=>{if(!X)return;const n=t=>{const l=document.activeElement;if(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.isContentEditable))return;const h=p.current;h&&(t.key===" "?(t.preventDefault(),fe()):t.key==="ArrowRight"?(t.preventDefault(),h.currentTime=Math.min(h.duration||h.currentTime,h.currentTime+(t.shiftKey?1:5))):t.key==="ArrowLeft"?(t.preventDefault(),h.currentTime=Math.max(0,h.currentTime-(t.shiftKey?1:5))):t.key===","?(t.preventDefault(),h.currentTime=Math.max(0,h.currentTime-1/30)):t.key==="."?(t.preventDefault(),h.duration&&(h.currentTime=Math.min(h.duration,h.currentTime+1/30))):t.key==="ArrowDown"?(t.preventDefault(),Ce(1)):t.key==="ArrowUp"?(t.preventDefault(),Ce(-1)):(t.key==="a"||t.key==="A")&&(t.preventDefault(),Re(null)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[X,fe,Ce,Re]);const Xe=n=>{var h;const t=(h=N.current)==null?void 0:h.getBoundingClientRect(),l=p.current;!t||!t.width||!l||!l.duration||(l.currentTime=Math.min(1,Math.max(0,(n-t.left)/t.width))*l.duration)},ys=n=>{n.preventDefault(),Le(!0),Xe(n.clientX)},gs=n=>{var l;const t=(l=N.current)==null?void 0:l.getBoundingClientRect();t!=null&&t.width&&Me(Math.min(100,Math.max(0,(n.clientX-t.left)/t.width*100)))};c.useEffect(()=>{if(!ze)return;const n=l=>Xe(l.clientX),t=()=>Le(!1);return window.addEventListener("mousemove",n),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",t)}},[ze]);const Ye=n=>{const t=L.current.getBoundingClientRect();return{x:(n.clientX-t.left)/t.width*100,y:(n.clientY-t.top)/t.height*100}},js=n=>{if(n.button!==0||M)return;const t=Ye(n);T({x0:t.x,y0:t.y,x:t.x,y:t.y})},Es=n=>{var l,h;if(!f)return;const t=Ye(n);!((l=p.current)!=null&&l.paused)&&(Math.abs(t.x-f.x0)>1||Math.abs(t.y-f.y0)>1)&&((h=p.current)==null||h.pause()),T({...f,x:t.x,y:t.y})},Ls=()=>{if(!f)return;const n={x:Math.min(f.x0,f.x),y:Math.min(f.y0,f.y),w:Math.abs(f.x-f.x0),h:Math.abs(f.y-f.y0)};if(T(null),n.w<1&&n.h<1){fe();return}Re(n)},le=f&&{x:Math.min(f.x0,f.x),y:Math.min(f.y0,f.y),w:Math.abs(f.x-f.x0),h:Math.abs(f.y-f.y0)},Ss=async()=>{const n=await en(e.node,e.scenario).catch(t=>({error:String(t)}));v==null||v((n==null?void 0:n.error)||"")},Ms=[...rn({okd:!!w.humanOk,isLatest:!F||A===0},{ok:Ss}).map(n=>({name:n.name,description:d(n.descKey),ui:!0,color:n.color,run:n.run})),...ps.map(n=>({name:n.name,description:n.desc||n.title,source:"review",prefill:()=>on(n.body,{node:e.node,scenario:e.scenario,expected:w.expected||""})}))],$s=s.jsxs(s.Fragment,{children:[s.jsx(q,{kind:"eval",state:Te(w),showLabel:!0,className:"an-verdict-badge",size:16}),w.humanOk&&s.jsxs("span",{className:"an-okd","data-tip":d("annotator.okBy",{by:w.humanOk.by,at:new Date(w.humanOk.ts).toLocaleString()}),children:[s.jsx(Z,{name:"circle-check",size:14})," ",d("annotator.okd")]}),F&&F.length>1&&(()=>{const n=F.length,t=Math.min(xe,n),l=A<xe?Array.from({length:t},(k,$)=>t-1-$):[A,...Array.from({length:xe-1},(k,$)=>xe-2-$)],h=new Set(l),g=F.map((k,$)=>({...k,idx:$})).filter(k=>!h.has(k.idx));return s.jsxs("div",{className:"an-ab",children:[s.jsx(be,{icon:"chevron-left",size:13,className:"an-ab-nav",disabled:A>=F.length-1,onClick:()=>te(k=>Math.min(F.length-1,k+1)),label:d("annotator.abOlder")}),g.length>0&&s.jsx(dn,{hidden:g,total:n,histIdx:A,onPick:te}),s.jsx("div",{className:"an-ab-track",children:l.map(k=>{const $=F[k],Q=Te($);return s.jsx("button",{type:"button",className:`an-ab-pip ${k===A?"on":""}`,"aria-current":k===A?"true":void 0,onClick:()=>te(k),"aria-label":`${n-k}/${n} · ${d(`score.${Q}`)} · ${new Date($.ts).toLocaleString()}`,children:s.jsx(q,{kind:"eval",state:Q,size:13})},`${$.ts}-${k}`)})}),s.jsx(be,{icon:"chevron-right",size:13,className:"an-ab-nav",disabled:A<=0,onClick:()=>te(k=>Math.max(0,k-1)),label:d("annotator.abNewer")}),s.jsx("span",{className:"an-ab-pos",children:A===0?d("annotator.abLatest"):d("annotator.abPos",{i:F.length-A,n:F.length})})]})})()]}),Ns=s.jsxs(s.Fragment,{children:[s.jsxs(W,{label:d("detail.sideReading"),children:[w.evaluator&&s.jsx(G,{text:w.evaluator}),s.jsx(G,{text:new Date(w.ts).toLocaleString()})]}),s.jsx(W,{label:d("detail.sideNode"),children:s.jsx(G,{text:e.node,mono:!0,tip:m?d("session.issuesFocusNode"):e.node,onClick:m?()=>m(e.node):null})}),_e&&s.jsx(W,{label:d("detail.sideFiler"),children:s.jsx(qs,{originator:_e,sessions:b,kind:"eval",onOpenSession:x})}),w.humanOk&&s.jsxs(W,{label:d("detail.sideOk"),children:[s.jsx(G,{text:`☑ ${w.humanOk.by}`}),s.jsx(G,{text:new Date(w.humanOk.ts).toLocaleString(),dim:!0})]}),!w.fresh&&(((Je=w.staleAxes)==null?void 0:Je.length)??0)>0&&s.jsxs(W,{label:d("nodeView.eval.staleLabel"),children:[s.jsx(G,{text:w.staleAxes.join(" · "),tip:d("nodeView.eval.staleReadoutTitle")}),(((Ze=w.codeDrift)==null?void 0:Ze.length)??0)>0&&s.jsx(G,{text:w.codeDrift.map(n=>`${n.file.split("/").pop()} +${n.behind}`).join(", "),dim:!0})]}),(u.prev.length>0||u.next.length>0)&&s.jsx(W,{label:d("detail.sideQueue"),children:[["prev",d("detail.queuePrev")],["next",d("detail.queueNext")]].map(([n,t])=>u[n].length>0&&s.jsxs("div",{className:"ds-queue-group",children:[s.jsx("span",{className:"ds-queue-group-label",children:t}),u[n].map(l=>s.jsxs("a",{className:"ds-queue-row",href:l.href,"data-tip":`${l.node} · ${l.scenario}`,children:[s.jsx(q,{kind:"eval",state:l.state,size:13}),s.jsx("span",{className:"ds-queue-scenario",children:l.scenario}),s.jsx("span",{className:"ds-queue-node",children:l.node})]},l.key))]},n))})]}),Rs=s.jsx(Us,{onSend:(n,t)=>Ws({node:e.node,scenario:e.scenario,body:n,codeSha:w.codeSha,evidence:t}),specs:i,sessions:b,focusId:e.node,onDone:v,anchorNow:X?ks:null,draft:ie,commands:Ms},xs);return s.jsxs(Fe,{title:e.scenario,titleMeta:s.jsx("span",{className:"an-node",children:e.node}),status:$s,side:Ns,composer:Rs,listHref:j,backHref:E,backLabel:R,children:[w.expected&&s.jsxs("div",{className:"an-expected",children:[s.jsx("b",{children:d("nodeView.eval.expected")})," ",w.expected]}),ae.length>0&&((De=w.verdict)==null?void 0:De.note)&&s.jsxs("div",{className:"an-expected an-prior-note",children:[s.jsx("b",{children:d("nodeView.eval.noteLabel")})," ",w.verdict.note]}),H&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"an-player",ref:S,children:[s.jsxs("div",{className:`an-stage ${oe?"playing":"paused"}`,ref:L,onMouseDown:js,onMouseMove:Es,onMouseUp:Ls,children:[s.jsx("video",{className:"an-video",ref:p,src:ke(`/api/evidence/${H.hash}`),preload:"metadata",playsInline:!0}),le&&s.jsx("div",{className:"an-rect live",style:{left:`${le.x}%`,top:`${le.y}%`,width:`${le.w}%`,height:`${le.h}%`}}),!oe&&!f&&s.jsx("div",{className:"an-bigplay","aria-hidden":!0,children:s.jsx(Z,{name:"play",size:22})})]}),s.jsxs("div",{className:"an-bar",children:[s.jsx(be,{icon:oe?"pause":"play",size:14,className:"an-play",label:d(oe?"annotator.pause":"annotator.play"),onClick:fe}),s.jsxs("div",{className:"an-seek",ref:N,onMouseDown:ys,onMouseMove:gs,onMouseLeave:()=>Me(null),children:[s.jsx("div",{className:"an-seek-trk"}),Y>0&&O==="time"&&y.map((n,t)=>s.jsx("div",{className:"an-band",style:{left:`${n.at/Y*100}%`},"data-tip":n.step},`band-${t}`)),s.jsx("div",{className:"an-seek-play",ref:K}),Y>0&&z.map(n=>s.jsx("button",{type:"button",className:`an-mk ${ce===n.i?"on":""} ${Ie===n.i?"active":""}`,style:{left:`${n.tMs/Y*100}%`},"data-tip":n.label,onMouseDown:t=>t.stopPropagation(),onClick:t=>{t.stopPropagation(),He(n.i,n.tMs)}},`mk-${n.i}`)),s.jsx("div",{className:"an-knob",ref:V}),Se!=null&&Y>0&&s.jsx("div",{className:"an-seek-hov",style:{left:`${Se}%`},children:we(Se/100*Y)})]}),s.jsx("span",{className:"an-time",ref:ne}),ve&&s.jsx("span",{className:"an-curstep","data-tip":ve.node?`→ ${ve.node}`:void 0,children:ve.step}),s.jsx(Vs,{target:S})]})]}),y.length>0&&s.jsx(os,{events:y,axis:O,extent:Ve,activeStepIdx:je,onSeek:D}),B&&s.jsx("div",{className:"an-flash",children:B})]}),!H&&y.length>0&&s.jsx(os,{events:y,axis:O,extent:Ve,activeStepIdx:je,onSeek:D}),ue.length>0&&s.jsx("div",{className:"an-gallery",children:ue.map((n,t)=>s.jsx(ls,{e:n,alt:e.scenario},`${n.hash}-${t}`))}),ws.map((n,t)=>s.jsx(ls,{e:n,alt:e.scenario,collapsed:X||ue.length>0},`${n.hash}-${t}`)),ae.length===0&&((We=w.verdict)!=null&&We.note?s.jsx("pre",{className:"eval-transcript",children:w.verdict.note}):s.jsx("div",{className:"an-hint",children:d("nodeView.eval.noImage")})),s.jsx(vn,{entry:e,comments:Ne,seekMs:X?D:null,selIdx:ce,activeIdx:Ie,onSelect:X?He:null,events:X?y:null,onWrite:v})]})}function vn({entry:e,comments:a,seekMs:r,selIdx:i,activeIdx:b,onSelect:v,events:x,onWrite:m}){var E;const j=U();return s.jsxs("section",{className:"an-thread",children:[s.jsx("div",{className:"an-comments-head",children:s.jsx("span",{children:j("annotator.comments",{n:a.length})})}),s.jsx(Xs,{replies:a,onSeek:r,selIdx:i,activeIdx:b,onSelect:v,events:x,threadId:((E=e.thread)==null?void 0:E.id)??null,onRemarkChange:()=>m==null?void 0:m("")})]})}const pe=new Map,fn=[];function cs(e,a){if(!(e!=null&&e.evalRevision)||!(a!=null&&a.epoch))return!0;const r=e.evalRevision;return r.epoch!==a.epoch||r.generation<a.generation?!1:r.generation!==a.generation?!0:!(a.revision&&r.content!==a.revision||a.value&&e.summary&&["measured","total","pass","fail","review","blind","unknown"].some(b=>e.summary[b]!==a.value[b]))}function us(e,a,r){const i=`${r||""}\0${e}\0${a}`;if(pe.has(i))return pe.get(i);const b=new URLSearchParams({node:e,scenario:a});r&&b.set("scope",r);const v=fetch(ke(`/api/evals/detail?${b}`),{cache:"no-store"}).then(x=>x.ok?x.json():x.status===404?!1:Promise.reject(new Error(`HTTP ${x.status}`))).finally(()=>pe.delete(i));return pe.set(i,v),v}function mn(e,a,r,i=!0,b=null){const v=String(e||"").indexOf("/"),x=v>0?e.slice(0,v):e,m=v>0?e.slice(v+1):"",j=`${a||""}\0${x}\0${m}`,[E,R]=c.useState({identity:"",data:null,error:null}),u=c.useRef(0),d=c.useRef(r);d.current=r;const p=c.useCallback(()=>{if(!i||!x||!m)return Promise.resolve();const N=++u.current;return R(S=>S.identity===j?{...S,error:null}:{identity:j,data:null,error:null}),us(x,m,a).then(async S=>{if(N===u.current){if(S&&!cs(S,d.current)){const P=await us(x,m,a);if(N!==u.current)return;if(P&&!cs(P,d.current))throw new Error("stale session eval detail");S=P}R({identity:j,data:S,error:null})}}).catch(S=>{if(N!==u.current)return;const P=S instanceof Error?S.message:String(S);R(y=>({identity:j,data:y.identity===j&&y.data?y.data:!1,error:P}))})},[i,j,x,m,a]);c.useEffect(()=>{i&&p()},[i,x,m,a,b,r==null?void 0:r.epoch,r==null?void 0:r.generation,r==null?void 0:r.revision]);const L=E.identity===j?E:{data:null,error:null};return{data:L.data,error:L.error,reload:p}}function xn({sessionId:e}){const r=U()("sessionEval.scopeDoor");return s.jsx("a",{className:"se-door",href:ye(Js(e)),"data-tip":r,"aria-label":r,children:s.jsx(Z,{name:"arrow-left",size:16})})}function pn({sessionId:e,pageData:a,loading:r,error:i,sessions:b,queryText:v,onQueryText:x,hrefFor:m,hrefForPage:j,notice:E}){const R=U(),u=(a==null?void 0:a.unknown)||0,d=e&&!r&&!i&&((a==null?void 0:a.sourceTotal)??0)===0?R("sessionEval.none"):null,p=e?s.jsxs("div",{className:"se-gates",children:[s.jsx(xn,{sessionId:e}),a&&a.gates.map(L=>s.jsxs("span",{className:`se-gate ${L.ok?"ok":"bad"}`,"data-tip":L.detail,children:[s.jsx(Z,{name:L.ok?"check":"x",size:11})," ",L.label]},L.label)),u>0&&s.jsxs("span",{className:"se-gate bad","data-tip":R("sessionEval.unknownCoverage",{n:u}),children:[s.jsx(Z,{name:"info",size:11})," ",u]}),a&&s.jsx("span",{className:"se-acts",children:s.jsx("a",{className:"se-export",href:ke(`/api/sessions/${encodeURIComponent(e)}/evals?format=html`),target:"_blank",rel:"noreferrer","data-tip":R("sessionEval.exportTitle"),"aria-label":R("sessionEval.export"),children:s.jsx(Z,{name:"download",size:13})})})]}):null;return s.jsx(an,{pageData:a,loading:r,sessions:b,queryText:v,onQueryText:x,hrefFor:m,notice:E,leading:p,error:i?R("sessionEval.loadFailed",{reason:i}):null,empty:d,pagination:a?{page:a.page,pageCount:a.pageCount,prev:a.prev,next:a.next,hrefFor:j}:null})}function bn({param:e,detail:a,sessionId:r,loading:i=!1,error:b,specs:v,sessions:x,listHref:m,backHref:j,backLabel:E,onOpenSession:R,onFocusNode:u,onWrite:d,notice:p}){const L=U(),N=e.indexOf("/"),S=N>0?e.slice(0,N):e,P=N>0?e.slice(N+1):null,y=c.useMemo(()=>{const O=f=>({key:vs(f),node:f.node,scenario:f.scenario,state:f.state,href:ye(r?Ae(r,f.node,f.scenario):hs(f.node,f.scenario))}),I=(a==null?void 0:a.neighbors)||{prev:[],next:[]};return{prev:I.prev.map(O),next:I.next.map(O)}},[a==null?void 0:a.neighbors,r]);if(b)return s.jsx(Fe,{failure:L("sessionEval.loadFailed",{reason:b}),listHref:m,listLabel:L("reviewShell.backToEvals")});if(i)return s.jsx("div",{className:"fv-note",children:L("common.loading")});const C=(a==null?void 0:a.selected)||null;return C?s.jsxs("div",{className:"page-detail-stack",children:[p&&s.jsx("div",{className:"fv-notice",children:p}),s.jsx(hn,{entry:C,history:a.history,sourceKey:r||"project",specs:v,sessions:x,onOpenSession:R,onFocusNode:u,onWrite:d,listHref:m,backHref:j,backLabel:E,queue:y})]}):s.jsx(Fe,{missing:L("reviewShell.evalNotFound",{node:S,scenario:P||""}),listHref:m,listLabel:L("reviewShell.backToEvals")})}function En({specs:e=fn,sessions:a=[],issuesStamp:r=null,reloadBoard:i,onOpenSession:b,onFocusNode:v=null}){var _;const x=U(),{param:m,query:j}=Ts(),E=J(j.q||"","scope")||null,R=((_=a.find(M=>M.id===E))==null?void 0:_.evalSummary)||null,u=mn(m,E,R,!!m,r),d=String(j.q??"").trim()||re,p=Ys(j.page),L=Qs("evals",d,p,{enabled:!m,refreshKey:e}),[N,S]=c.useState(""),P=M=>{M&&(S(M),setTimeout(()=>S(""),6e3))},y=async M=>{P(M),await(i==null?void 0:i()),await u.reload()},C=M=>ye(E?Ae(E,M.node,M.scenario):hs(M.node,M.scenario)),O=E?ye(Ae(E)):es("evals"),I=Gs("evals",E),f=x("detail.backToEvals"),T=M=>Fs("evals",null,{query:As(M,re)}),B=M=>es("evals",null,Ps(d,re,M));return m?s.jsx(bn,{param:m,detail:u.data&&u.data!==!1?u.data:null,sessionId:E,loading:u.data===null,error:u.error,specs:e,sessions:a,listHref:O,backHref:I,backLabel:f,onOpenSession:b,onFocusNode:v,onWrite:y,notice:N}):s.jsx(pn,{sessionId:E,pageData:L.data,loading:L.loading,error:L.error,sessions:a,queryText:j.q||"",onQueryText:T,hrefFor:C,hrefForPage:B,notice:N})}export{bn as EvalDetailPage,xn as EvalScopeDoor,pn as EvalsListPage,En as default,cs as detailMatchesProjection};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EvalsPage-FixoOg_n.js","assets/index-DrVao0Ep.js","assets/index-CsI8DElI.css","assets/Thread-C6Go8HRh.js","assets/PageScroll-hT7UTLvD.js","assets/data-B-RQmit6.js","assets/IssuesPage-CuKLFhH3.js","assets/Settings-C2MsucfE.js","assets/bindings-BC9vqpYU.js","assets/terminalFont-C6oGNKrf.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as E,r as o,f as D,j as s,n as y,_ as O}from"./index-DrVao0Ep.js";import{A as L,u as H,S as $,R as B,a as U,F as Q,b as A}from"./SessionWindow-CixDi4PI.js";import{H as G,I as J,J as M,K,N as W,P as X,Q as Z,U as q,V as Y,W as ss,G as es,s as as,X as ns,o as ls,t as ts}from"./Thread-C6Go8HRh.js";import{u as is,T as cs,c as os}from"./launch-BBH02b1v.js";import"./PageScroll-hT7UTLvD.js";import"./data-B-RQmit6.js";const rs=o.lazy(()=>O(()=>import("./EvalsPage-FixoOg_n.js"),__vite__mapDeps([0,1,2,3,4,5]))),ms=o.lazy(()=>O(()=>import("./IssuesPage-CuKLFhH3.js"),__vite__mapDeps([6,1,2,5,3,4]))),ds=o.lazy(()=>O(()=>import("./Settings-C2MsucfE.js"),__vite__mapDeps([7,1,2,8,4,9]))),us={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},R=(e,l)=>l.filter(r=>{var m;return(m=r.ops)==null?void 0:m.some(t=>t.nodeId===e.id)});function V({status:e}){const l=A[e]||A.pending;return s.jsx("span",{className:"m-dot",style:{background:l.color}})}function hs({node:e,kids:l,editors:r,onTap:m}){return s.jsxs("button",{className:"m-row",onClick:m,children:[s.jsx(V,{status:e.status}),s.jsx("span",{className:"m-row-title",children:e.title}),r.length>0&&s.jsx("span",{className:"m-row-faces",children:r.slice(0,3).map(t=>s.jsx(L,{seed:t.id,status:t.status,title:M(t)},t.id))}),e.version?s.jsxs("span",{className:"m-row-ver",children:["v",e.version]}):null,l>0&&s.jsxs("span",{className:"m-row-kids",children:["▸",l]}),s.jsx("span",{className:"m-row-chev",children:"›"})]})}function bs({node:e,childrenOf:l,sessions:r,onOpenChild:m}){const t=E(),d=l(e.id),h=G(e),f=[...d.length?[{key:"children",label:t("mobile.childrenTab",{n:d.length})}]:[],...h.map(a=>({key:a.key,label:t(us[a.key])}))],[x,b]=o.useState(null),[N,j]=o.useState({issues:{},eval:{}});o.useEffect(()=>{b(null),j({issues:{},eval:{}})},[e.id]);const g=(a,w)=>j(p=>({...p,[a]:ss(p[a],w)})),i=x&&f.some(a=>a.key===x)?x:f[0].key,k=J(e.id,i==="history"),c=R(e,r);return s.jsxs("div",{className:"m-node",children:[s.jsxs("div",{className:"m-node-head",children:[s.jsx(V,{status:e.status}),s.jsx("span",{className:"m-node-title",children:e.title}),e.version?s.jsxs("span",{className:"m-node-ver",children:["v",e.version]}):null,s.jsx("span",{className:"m-node-status",children:t(`status.${e.status}`)}),c.length>0&&s.jsx("span",{className:"m-node-faces",title:t("mobile.liveEditors",{n:c.length}),children:c.map(a=>s.jsx(L,{seed:a.id,status:a.status,title:M(a)},a.id))})]}),e.desc&&s.jsx("div",{className:"m-node-desc",children:e.desc}),s.jsx("div",{className:"m-tabs",children:f.map(a=>s.jsx("button",{className:a.key===i?"m-tab on":"m-tab",onClick:()=>b(a.key),children:a.label},a.key))}),s.jsxs("div",{className:i==="history"?"m-pane-host fixed":"m-pane-host",children:[i==="children"&&s.jsx("div",{className:"m-children",children:d.map(a=>s.jsx(hs,{node:a,kids:l(a.id).length,editors:R(a,r),onTap:()=>m(a.id)},a.id))}),i==="spec"&&s.jsx(K,{node:e}),i==="history"&&s.jsx(W,{node:e,rows:k}),i==="issues"&&s.jsx(X,{node:e,sessions:r,filter:N.issues,onFilter:a=>g("issues",a)}),i==="eval"&&s.jsx(Z,{node:e,sessions:r,filter:N.eval,onFilter:a=>g("eval",a)}),i==="edit"&&s.jsx(q,{node:e})]})]})}function ps({s:e,sessions:l,onBack:r}){const m=E();return s.jsxs("div",{className:"m-sessdetail chat",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:r,"aria-label":m("mobile.back"),children:"‹"}),s.jsxs("div",{className:"m-sess-meta",children:[s.jsx("span",{className:"m-sess-name",children:as(e)}),s.jsxs("span",{className:"m-sess-status",style:{color:ns[e.status]},children:[m(`status.${e.status}`),e.merges?` · ×${e.merges}`:""," · ",s.jsx("span",{className:"m-sess-id8",children:e.id.slice(0,8)})]})]}),s.jsx("a",{className:"m-sess-evalbtn",href:ls(ts(e.id)),title:m("sessionEval.btnTitle"),children:m("sessionEval.btn")})]}),s.jsx(cs,{s:e,sessions:l})]})}function xs({draft:e,setDraft:l,onBack:r,onLaunched:m}){const t=E(),{launchers:d,launcher:h,pickLauncher:f}=is(),[x,b]=o.useState(!1),[N,j]=o.useState(null),g=async()=>{const i=e.trim();if(!i||x)return;b(!0),j(null);const k=await os(i,h);b(!1),k.ok?(l(""),m()):j(k.error||t("mobile.launchFailed"))};return s.jsxs("div",{className:"m-sessdetail m-new",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:r,"aria-label":t("mobile.back"),children:"‹"}),s.jsx("div",{className:"m-sess-meta",children:s.jsx("span",{className:"m-sess-name",children:t("mobile.newSession")})})]}),s.jsxs("div",{className:"m-new-body",children:[s.jsx(es,{className:"m-input m-new-input",rows:5,placeholder:t("mobile.newPlaceholder"),value:e,onChange:i=>l(i.target.value)}),d.length>0&&s.jsxs("label",{className:"m-new-launcher",children:[s.jsx("span",{className:"m-new-launcher-label",children:t("session.launcherLabel")}),s.jsx("select",{className:"m-new-launcher-select",value:h,onChange:i=>f(i.target.value),children:d.map(i=>s.jsx("option",{value:i.name,children:i.name},i.name))})]}),N&&s.jsx("div",{className:"m-senderr",children:N}),s.jsx("button",{className:"m-send m-new-go",disabled:!e.trim()||x,onClick:g,children:t(x?"mobile.launching":"mobile.launch")})]})]})}function js({specs:e,sessions:l,openId:r,setOpenId:m,creating:t,setCreating:d,newDraft:h,setNewDraft:f}){const x=E(),b=r?l.find(c=>c.id===r):null,{expanded:N,toggle:j}=H(),[g,i]=o.useState(!1),k=o.useMemo(()=>Y(l,c=>N.has(c),{zoneFolded:c=>c==="offline"&&!g}),[l,N,g]);return t?s.jsx(xs,{draft:h,setDraft:f,onBack:()=>d(!1),onLaunched:()=>d(!1)}):b?s.jsx(ps,{s:b,sessions:l,onBack:()=>m(null)}):s.jsxs("div",{className:"m-sesslist",children:[s.jsxs("button",{className:"m-new-btn",onClick:()=>d(!0),children:[s.jsx("span",{className:"m-new-btn-plus",children:"+"}),x("mobile.newSession")]}),!l.length&&s.jsx("div",{className:"m-empty big",children:x("mobile.noSessions")}),k.map(c=>{if(c.type==="zone")return s.jsx($,{item:c,baseClass:"m-zone",onToggle:()=>i(p=>!p)},`z-${c.zone}`);const a=c.s,w=c.expandable||c.depth?s.jsx(B,{guides:c.guides,expandable:c.expandable,kin:c.kin}):null;return s.jsxs("div",{className:"sess-tree-row m-sess-tree-row",style:{"--sess-fold-indent":`${c.depth*14}px`},children:[s.jsx("button",{type:"button",className:"m-sess-row",onClick:()=>m(a.id),children:s.jsx(U,{s:a,locked:!1,showAvatar:!1,lead:w})}),c.expandable&&s.jsx(Q,{expanded:c.expanded,rollup:c.rollup,kin:c.kin,onToggle:()=>j(a.id)})]},a.id)})]})}function Ss({specs:e,sessions:l,issuesStamp:r,reloadBoard:m}){const t=E(),d=o.useMemo(()=>Object.fromEntries(e.map(n=>[n.id,n])),[e]),h=o.useMemo(()=>e.find(n=>!n.parent)||e[0],[e]),f=o.useMemo(()=>{const n={};return e.forEach(u=>{var _;u.parent&&(n[_=u.parent]??(n[_]=[])).push(u)}),u=>n[u]||[]},[e]),[x,b]=o.useState("specs"),[N,j]=o.useState(()=>h?[h.id]:[]),[g,i]=o.useState(null),[k,c]=o.useState(!1),[a,w]=o.useState(""),{page:p,param:C}=D(),v=p==="evals"||p==="issues"||p==="settings"?p:x;o.useEffect(()=>{p==="sessions"&&C&&(b("sessions"),i(C))},[p,C]);const T=n=>{if(n==="evals"||n==="issues"){y(n);return}b(n),(p==="evals"||p==="issues"||p==="settings")&&y(n==="specs"?"graph":"sessions")},F=n=>{b("sessions"),i(n),y("sessions",n)},S=N.filter(n=>d[n]),I=S[S.length-1]||(h==null?void 0:h.id),P=I?d[I]:null,z=n=>j(u=>[...u.filter(_=>d[_]),n]);return s.jsxs("div",{className:"m-app",children:[s.jsx("main",{className:"m-main",children:v==="evals"||v==="issues"||v==="settings"?s.jsx("div",{className:"m-review",children:s.jsx(o.Suspense,{fallback:s.jsx("div",{className:"m-empty",children:t("common.loading")}),children:v==="settings"?s.jsx(ds,{}):v==="evals"?s.jsx(rs,{specs:e,sessions:l,issuesStamp:r,reloadBoard:m,onOpenSession:F,onFocusNode:n=>{b("specs"),j([h.id,n].filter(u=>d[u])),y("graph")}}):s.jsx(ms,{specs:e,sessions:l,issuesStamp:r,onOpenSession:F,onFocusNode:n=>{b("specs"),j([h.id,n].filter(u=>d[u])),y("graph")}})})}):v==="specs"?s.jsxs("div",{className:"m-specs",children:[s.jsx("nav",{className:"m-crumbs",children:S.map((n,u)=>s.jsxs("span",{className:"m-crumb",children:[u>0&&s.jsx("span",{className:"m-crumb-sep",children:"›"}),s.jsx("button",{className:u===S.length-1?"m-crumb-btn cur":"m-crumb-btn",onClick:()=>j(S.slice(0,u+1)),children:d[n].title})]},n))}),P&&s.jsx(bs,{node:P,childrenOf:f,sessions:l,onOpenChild:z},P.id)]}):s.jsx(js,{specs:e,sessions:l,openId:g,setOpenId:i,creating:k,setCreating:c,newDraft:a,setNewDraft:w})}),s.jsxs("nav",{className:"m-tabbar",children:[s.jsxs("button",{className:v==="specs"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("specs"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"❯_"}),t("mobile.specsTab")]}),s.jsxs("button",{className:v==="sessions"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("sessions"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◐"}),t("mobile.sessionsTab"),l.length>0&&s.jsx("span",{className:"m-tabbar-badge",children:l.length})]}),s.jsxs("button",{className:v==="evals"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("evals"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"✓"}),t("mobile.evalsTab")]}),s.jsxs("button",{className:v==="issues"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("issues"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◎"}),t("mobile.issuesTab")]})]})]})}export{Ss as default};
|