PageSourceSearch

https://86proof.ai/js/app.6cbf0b35.js

js 86proof.ai collected 2026-10-05 14:15:38 UTC 311,455 bytes, 2 lines download raw bytes

1(()=>{"use strict";var e={557(e,a,t){var s=t(751),l=t(641),n=t(33),o=t(953),r=t(29);const i=[{slug:"overview",path:"/",label:"Overview",title:"Overview"},{slug:"system",path:"/system",label:"Deep Dive",title:"Deep Dive"},{slug:"demo",path:"/demo",label:"Demo",title:"Demo"},{slug:"console",path:"/console",label:"Console",title:"Console"},{slug:"login",path:"/login",label:"Login/Logout",title:"Login/Logout"}],u=Symbol("frontend-logger");class c{info(e,...a){}warn(e,...a){}error(e,...a){}debug(e,...a){}child(e){return new d(this,e)}}class d extends c{constructor(e,a){super(),this.parent=e,this.prefix=a}info(e,...a){this.parent.info(this.format(e),...a)}warn(e,...a){this.parent.warn(this.format(e),...a)}error(e,...a){this.parent.error(this.format(e),...a)}debug(e,...a){this.parent.debug(this.format(e),...a)}format(e){return`${this.prefix} ${e}`}}class p extends c{info(e,...a){console.info(e,...a)}warn(e,...a){console.warn(e,...a)}error(e,...a){console.error(e,...a)}debug(e,...a){console.debug(e,...a)}}const v=new p;function k(){return(0,l.WQ)(u,v)}const g=Symbol("frontend-storage");class b{isAvailable(){return!1}getItem(){return null}setItem(){}removeItem(){}}class m extends b{constructor({storageAccessor:e=()=>"undefined"!==typeof window?window.localStorage:void 0,logger:a=v.child("[FrontendStorage]")}={}){super(),this.storageAccessor=e,this.logger=a}getStorage(){try{return this.storageAccessor?.()??null}catch(e){return this.logger.warn("Failed to access browser storage",e),null}}isAvailable(){const e=this.getStorage();if(!e)return!1;try{const a="__frontend_storage_test__";return e.setItem(a,a),e.removeItem(a),!0}catch{return!1}}getItem(e){const a=this.getStorage();if(!a)return null;try{return a.getItem(e)}catch(t){return this.logger.warn(`Failed to read storage key: ${e}`,t),null}}setItem(e,a){const t=this.getStorage();if(t)try{t.setItem(e,a)}catch(s){this.logger.warn(`Failed to write storage key: ${e}`,s)}}removeItem(e){const a=this.getStorage();if(a)try{a.removeItem(e)}catch(t){this.logger.warn(`Failed to remove storage key: ${e}`,t)}}}const _=new m;function h(){return(0,l.nI)()?(0,l.WQ)(g,_):_}const y="beads-auth-token",f=new Map;function w(e){try{const a=e.split(".");if(3!==a.length)return null;const t=JSON.parse(atob(a[1]));return t}catch{return null}}function L(e){let a=f.get(e);return a||(a={token:(0,o.KR)(e.getItem(y))},f.set(e,a),a)}function C(){const e=h(),a=L(e),t=(0,l.EW)(()=>{if(!a.token.value)return!1;const e=w(a.token.value);return!(!e||!e.exp)&&e.exp>Date.now()/1e3}),s=(0,l.EW)(()=>{if(!a.token.value)return null;const e=w(a.token.value);return e?.tenantId??null}),n=(0,l.EW)(()=>{if(!a.token.value)return null;const e=w(a.token.value);return e?.username??null});function o(t){a.token.value=t,e.setItem(y,t)}function r(){a.token.value=null,e.removeItem(y)}function i(){if(!a.token.value)return{};const e=s.value,t={Authorization:`Bearer ${a.token.value}`};return e&&(t["x-tenant-id"]=e),t}return{isAuthenticated:t,tenantId:s,username:n,token:a.token,setToken:o,clearToken:r,getAuthHeaders:i}}const E={class:"app-menu","aria-label":"Primary"},R={class:"app-menu__content"},I="mailto:[email protected]",j={__name:"AppMenuBar",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{isAuthenticated:s,clearToken:u}=C(),c=(0,o.KR)(!1),d=(0,l.EW)(()=>i.filter(e=>!["overview","login"].includes(e.slug))),p=(0,l.EW)(()=>"/");function v(e){return"/"===e?"/"===a.path:a.path===e||a.path.startsWith(`${e}/`)}function k(){u(),t.push("/")}return(e,t)=>{const r=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("nav",E,[(0,l.Lk)("div",R,[(0,l.bF)(r,{to:p.value,class:"app-menu__brand"},{default:(0,l.k6)(()=>[...t[1]||(t[1]=[(0,l.eW)("86 Proof",-1)])]),_:1},8,["to"]),(0,l.Lk)("button",{class:"app-menu__toggle","aria-label":"Toggle navigation",onClick:t[0]||(t[0]=e=>c.value=!c.value)},[...t[2]||(t[2]=[(0,l.Lk)("span",{class:"app-menu__toggle-bar"},null,-1),(0,l.Lk)("span",{class:"app-menu__toggle-bar"},null,-1),(0,l.Lk)("span",{class:"app-menu__toggle-bar"},null,-1)])]),(0,l.Lk)("div",{class:(0,n.C4)(["app-menu__links",{"app-menu__links--open":c.value}])},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(d.value,e=>((0,l.uX)(),(0,l.Wv)(r,{key:e.slug,to:e.path,class:(0,n.C4)(["app-menu__link",{"app-menu__link--active":v(e.path)}])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1032,["to","class"]))),128)),(0,o.R1)(s)?((0,l.uX)(),(0,l.CE)("button",{key:0,class:"app-menu__link app-menu__link--button",onClick:k}," Logout ")):((0,l.uX)(),(0,l.Wv)(r,{key:1,to:"/login",class:(0,n.C4)(["app-menu__link",{"app-menu__link--active":"/login"===(0,o.R1)(a).path}])},{default:(0,l.k6)(()=>[...t[3]||(t[3]=[(0,l.eW)(" Login ",-1)])]),_:1},8,["class"])),(0,l.Lk)("a",{href:I,class:"app-menu__link"}," Contact ")],2)])])}}},A=j,W=A,S={class:"app-shell"},X={class:"app-shell__header"},x={class:"app-shell__main"},T={class:"app-shell__footer"},P={class:"app-shell__build"},$={key:0},F={__name:"AppShell",setup(e){const a=(0,l.EW)(()=>{const e="undefined"!==typeof window?window.__BUILD_VERSION__:void 0;return e&&"object"===typeof e?e:{sha:"dev",timestamp:"",version:"0.0.0"}}
1),t=(0,l.EW)(()=>{const e=a.value.sha;return e.length>12?e.slice(0,12):e});return(e,s)=>{const o=(0,l.g2)("router-view");return(0,l.uX)(),(0,l.CE)("div",S,[(0,l.Lk)("header",X,[(0,l.bF)(W)]),(0,l.Lk)("main",x,[(0,l.bF)(o)]),(0,l.Lk)("footer",T,[(0,l.Lk)("span",P,[(0,l.eW)("v"+(0,n.v_)(a.value.version)+" · "+(0,n.v_)(t.value),1),a.value.timestamp?((0,l.uX)(),(0,l.CE)("span",$," · "+(0,n.v_)(a.value.timestamp),1)):(0,l.Q3)("",!0)])])])}}},K=F,O=K,D={__name:"App",setup(e){return(e,a)=>((0,l.uX)(),(0,l.Wv)(O))}},N=D,U=N,q={class:"page-section"},Q={key:0,class:"label"},J={key:1,class:"page-section__heading"},B={key:2,class:"page-section__heading"},M={key:3,class:"page-section__lede"},V={__name:"PageSection",props:{label:String,heading:{type:[String,Array],default:""},lede:String},setup(e){return(a,t)=>((0,l.uX)(),(0,l.CE)("section",q,[e.label?((0,l.uX)(),(0,l.CE)("span",Q,(0,n.v_)(e.label),1)):(0,l.Q3)("",!0),"string"===typeof e.heading?((0,l.uX)(),(0,l.CE)("h2",J,(0,n.v_)(e.heading),1)):Array.isArray(e.heading)&&e.heading.length?((0,l.uX)(),(0,l.CE)("h2",B,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.heading,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"page-section__heading-line"},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0),e.lede?((0,l.uX)(),(0,l.CE)("p",M,(0,n.v_)(e.lede),1)):(0,l.Q3)("",!0),(0,l.RG)(a.$slots,"default")]))}},G=V,H=G,z=["src","alt"],Y=["src","alt"],Z={__name:"ImageLightbox",props:{src:{type:String,required:!0},alt:{type:String,required:!0}},setup(e){const a=(0,o.KR)(!1);return(t,s)=>((0,l.uX)(),(0,l.CE)(l.FK,null,[(0,l.Lk)("figure",{class:"lightbox-trigger",onClick:s[0]||(s[0]=e=>a.value=!0)},[(0,l.Lk)("img",{src:e.src,alt:e.alt},null,8,z),s[2]||(s[2]=(0,l.Lk)("span",{class:"lightbox-trigger__hint"},"Tap to expand",-1))]),((0,l.uX)(),(0,l.Wv)(l.Im,{to:"body"},[a.value?((0,l.uX)(),(0,l.CE)("div",{key:0,class:"lightbox-overlay",onClick:s[1]||(s[1]=e=>a.value=!1)},[(0,l.Lk)("img",{src:e.src,alt:e.alt,class:"lightbox-overlay__image"},null,8,Y)])):(0,l.Q3)("",!0)]))],64))}},ee=Z,ae=ee,te={hero:{title:"AI writes code fast. You spend the next hour fixing what it got wrong.",subline:"Standards become constraints. Plans become contracts. Execution becomes visible. Patterns surface across runs.",actions:[{label:"See a real run →",to:"/demo"},{label:"Open console →",to:"/console",primary:!0}]},pillars:{label:"",heading:"What Proof Does",panels:[{title:"Your standards enforced, not suggested.",copy:"Before writing code, the AI looks up your project’s standards and works against a checklist it must satisfy.",screenshot:{src:"/demo/landing-standards.svg",alt:"Standards lookup returning structured requirements."}},{title:"Plan approved before code written.",copy:"Unlike chat planning mode, the approved plan is the execution contract. Not a suggestion.",screenshot:{src:"/demo/landing-control.svg",alt:"Approval gate between plan and execution."}},{title:"Patterns across runs, not just one.",copy:"What keeps breaking, which standards are working: surfaced, not buried in chat history.",screenshot:{src:"/demo/landing-cross-run.svg",alt:"Recurring gaps from recent runs aggregated into a single cross-run signal."}}]},howItWorks:{label:"How It Works",heading:"Describe. Plan. Execute. Review.",steps:[{number:"01",title:"Describe the work",copy:"A feature, a bug fix, a design doc. Or a plan you’ve already drafted in Claude Code or Cursor.",screenshot:{src:"/demo/landing-step-1.svg",alt:"Request submission with workspace context."}},{number:"02",title:"Review the plan",copy:"Proof turns the request into ordered steps. You approve before anything runs.",screenshot:{src:"/demo/landing-step-2.svg",alt:"Plan with step types, dependencies, and approval control."}},{number:"03",title:"Watch it execute",copy:"Each step runs with the standards and tools it needs. If step five fails, steps one through four are preserved.",screenshot:{src:"/demo/landing-step-3.svg",alt:"Execution view with steps in different states."}},{number:"04",title:"Review the result",copy:"Diffs, tests, transcripts, diagnostics. Attached to the run, reviewable months later.",screenshot:{src:"/demo/landing-step-4.svg",alt:"Results view with code changes, tests, and diagnostics."}}]},learningSignals:{label:"Show Me",heading:"Recurring gaps don’t recur silently.",copy:"If catch-log-continue appears in 7 of your last 20 runs, Proof surfaces it. You write the standard. Future runs show whether it keeps recurring.",screenshot:{src:"/demo/landing-learning-signals.png",alt:"Learning Signals panel listing recurring gap topics seen across recent runs."}},close:{thesis:["Standards become constraints.","Plans become contracts.","Execution becomes visible.","Patterns surface across runs."],actions:[{label:"Open the console →",to:"/console",primary:!0},{label:"Go deeper →",to:"/system"}]}},se={class:"content-page"},le={class:"landing-hero"},ne={class:"landing-hero__content"},oe={class:"landing-hero__title"},re={class:"landing-hero__subline"},ie={class:"landing-hero__actions"},ue={class:"shift-panels"},ce={class:"shift-panel__question"},de={class:"shift-panel__answer"},pe={class:"steps-grid"},ve={class:"step-card__number"},ke={class:"step-card__title"},ge={class:"step-card__copy"},be={class:"learning-signals"},me={class:"learning-signals__copy"},_e={class:"landing-close"},he={class:"landing-close__thesis"},ye={class:"landing-close__actions"},fe={__name:"OverviewPage",setup(e){function a(e){return"string"===typeof e.to&&e.to.startsWith("#")}function t(e){return a(e)?"a":e.to?"router-link":"a"}function s(e){return a(e)?{href:e.to}:e.to?{to:e.to}:{href:e.href}}return(e,a)=>{const r=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",se,[(0,l.Lk)("section",le,[(0,l.Lk)("div",ne,[(0,l.Lk)("h1",oe,(0,n.v_)((0,o.R1)(te).hero.title),1),(0,l.Lk)("p",re,(0,n.v_)((0,o.R1)(te).hero.subline),1),(0,l.Lk)("div",ie,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(te).hero.actions,e=>
1((0,l.uX)(),(0,l.Wv)((0,l.$y)(t(e)),(0,l.v6)({key:e.label},{ref_for:!0},s(e),{class:["button",e.primary?"button--primary":"button--ghost"]}),{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1040,["class"]))),128))])])]),(0,l.bF)(H,{label:(0,o.R1)(te).pillars.label,heading:(0,o.R1)(te).pillars.heading},{default:(0,l.k6)(()=>[(0,l.Lk)("div",ue,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(te).pillars.panels,e=>((0,l.uX)(),(0,l.CE)("article",{key:e.title,class:"shift-panel"},[(0,l.Lk)("h3",ce,(0,n.v_)(e.title),1),(0,l.Lk)("p",de,(0,n.v_)(e.copy),1),(0,l.bF)(ae,{src:e.screenshot.src,alt:e.screenshot.alt},null,8,["src","alt"])]))),128))])]),_:1},8,["label","heading"]),(0,l.bF)(H,{id:"how-it-works",label:(0,o.R1)(te).howItWorks.label,heading:(0,o.R1)(te).howItWorks.heading},{default:(0,l.k6)(()=>[(0,l.Lk)("div",pe,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(te).howItWorks.steps,e=>((0,l.uX)(),(0,l.CE)("article",{key:e.number,class:"step-card"},[(0,l.Lk)("span",ve,(0,n.v_)(e.number),1),(0,l.Lk)("h3",ke,(0,n.v_)(e.title),1),(0,l.Lk)("p",ge,(0,n.v_)(e.copy),1),(0,l.bF)(ae,{src:e.screenshot.src,alt:e.screenshot.alt},null,8,["src","alt"])]))),128))])]),_:1},8,["label","heading"]),(0,l.bF)(H,{label:(0,o.R1)(te).learningSignals.label,heading:(0,o.R1)(te).learningSignals.heading},{default:(0,l.k6)(()=>[(0,l.Lk)("div",be,[(0,l.Lk)("p",me,(0,n.v_)((0,o.R1)(te).learningSignals.copy),1),(0,l.bF)(ae,{src:(0,o.R1)(te).learningSignals.screenshot.src,alt:(0,o.R1)(te).learningSignals.screenshot.alt},null,8,["src","alt"])])]),_:1},8,["label","heading"]),(0,l.Lk)("section",_e,[(0,l.Lk)("div",he,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(te).close.thesis,e=>((0,l.uX)(),(0,l.CE)("p",{key:e,class:"landing-close__thesis-line"},(0,n.v_)(e),1))),128))]),(0,l.Lk)("div",ye,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(te).close.actions,e=>((0,l.uX)(),(0,l.Wv)(r,{key:e.label,to:e.to,class:(0,n.C4)(["button",e.primary?"button--primary":"button--ghost"])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1032,["to","class"]))),128))])])])}}},we=fe,Le=we,Ce={class:"page-hero"},Ee={class:"page-hero__panel"},Re={class:"label page-hero__eyebrow"},Ie={class:"page-hero__title"},je={class:"page-hero__lede"},Ae={key:0,class:"page-hero__lede-emphasis"},We={key:1,class:"page-hero__lede-emphasis"},Se={key:0,class:"page-hero__note"},Xe={class:"page-hero__actions"},xe={class:"page-hero__aside"},Te={class:"page-hero__aside-mark"},Pe={class:"page-hero__aside-title"},$e={class:"label"},Fe={key:0},Ke={key:1,class:"page-hero__list"},Oe={__name:"PageHero",props:{eyebrow:String,title:String,lede:String,ledeEmphasis:{type:[String,Array],default:""},note:String,actions:Array,aside:Object},setup(e){return(a,t)=>{const s=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("section",Ce,[(0,l.Lk)("article",Ee,[(0,l.Lk)("span",Re,(0,n.v_)(e.eyebrow),1),(0,l.Lk)("h1",Ie,(0,n.v_)(e.title),1),(0,l.Lk)("p",je,[(0,l.eW)((0,n.v_)(e.lede)+" ",1),"string"===typeof e.ledeEmphasis?((0,l.uX)(),(0,l.CE)("strong",Ae,(0,n.v_)(e.ledeEmphasis),1)):Array.isArray(e.ledeEmphasis)&&e.ledeEmphasis.length?((0,l.uX)(),(0,l.CE)("strong",We,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.ledeEmphasis,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"page-hero__lede-emphasis-line"},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0)]),e.note?((0,l.uX)(),(0,l.CE)("p",Se,(0,n.v_)(e.note),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",Xe,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.actions,e=>((0,l.uX)(),(0,l.Wv)(s,{key:e.label,to:e.to,class:(0,n.C4)(["button page-hero__action",e.primary?"button--primary":"button--ghost"])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1032,["to","class"]))),128))])]),(0,l.Lk)("aside",xe,[(0,l.Lk)("div",Te,[(0,l.Lk)("div",null,[(0,l.Lk)("h2",Pe,(0,n.v_)(e.aside.title),1),(0,l.Lk)("p",null,(0,n.v_)(e.aside.copy),1)])]),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.aside.blocks,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"page-hero__aside-block"},[(0,l.Lk)("span",$e,(0,n.v_)(e.label),1),e.text?((0,l.uX)(),(0,l.CE)("p",Fe,(0,n.v_)(e.text),1)):(0,l.Q3)("",!0),e.items?((0,l.uX)(),(0,l.CE)("ul",Ke,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.items,e=>((0,l.uX)(),(0,l.CE)("li",{key:e},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0),e.action?((0,l.uX)(),(0,l.Wv)(s,{key:2,to:e.action.to,class:(0,n.C4)(["button page-hero__action page-hero__block-action",e.action.primary?"button--primary":"button--ghost"])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.action.label),1)]),_:2},1032,["to","class"])):(0,l.Q3)("",!0)]))),128))])])}}},De=Oe,Ne=De,Ue={eyebrow:"How It Works",title:"Rules become constraints. Execution becomes visible. Patterns surface across runs.",lede:"AI in a chat window leaves a trail you can’t audit. Proof treats the work as a controlled system instead.",actions:[{label:"See a real run →",to:"/demo"},{label:"Open the console →",to:"/console",primary:!0}],overviewImage:{src:"/demo/architecture-overview.svg",alt:"Overview diagram showing how requests flow through standards, planning, approval, execution, and evidence capture."},sections:[{pillar:"Standards",question:"How do you make AI actually follow the rules?",tag:"Rules become tools the AI must use, not prose it can ignore.",philosophy:"You’ve written your coding standards. You’ve documented every convention. The AI reads them and still takes shortcuts. The problem isn’t that the rules don’t exist. They’re suggestions, not constraints.",body:["Proof turns your rules into a tool the AI calls before writing code. The AI calls <strong>search_standards('error handling')</strong> and gets back structured requirements. Not prose to skim, but a checklist it must satisfy.","That checklist stays attached to the step through implementation and verification."],list:["<strong>Search</strong> — the AI looks up your project’s standards for patterns relevant to the current task","<strong>Extract</strong> — structured requirements come back: MUST use AppError subclasses, NEVER catch-log-continue","<strong>Implement</strong> — the AI writes code against that checklist","<strong>Verify</strong> — compliance is checked before the step declares done"],punchline:"The difference is not whether the model read your rules. The difference is whether it is allowed to ignore them.",image:{src:"/demo/harness-engineering.svg",alt:"Diagram showing a step shaped by knowledge retrieval, standards requirements, workspace rules, and delivery controls."},references:[{title:"My AI Adoption Journey",href:"https://mitchellh.com/writing/my-ai-adoption-journey",note:"Step 5: engineer the harness around the model."}]},{pillar:"Control",question:"What happens between your approval and the result?",tag:"You approve the plan. The system turns it into controlled execution.",philosophy:"A planning mode can sketch an outline. Repository work needs more than an outline. Proof puts a gate between the plan and the code.",body:["After you approve the plan, the system breaks your request into typed steps — research, code, test, review — each with explicit scope and declared dependencies.","That is the difference from ordinary planning mode: the plan is not just text in a chat window. It becomes the execution contract for the run."],list:["<strong>Dependency ordering</strong> — later steps build on earlier steps’ verified output, not on fading context","<strong>Isolated execution</strong> — each step gets its own workspace and tool configuration, so failure stays local","<strong>Controlled delivery</strong> — steps cannot push, delete branches, or access credentials directly","<strong>
1Failure containment</strong> — if step 5 of 7 fails, steps 1–4 are complete and preserved"],punchline:"You approve before risk, not after failure. Your repository stays coherent even when a step goes wrong.",image:{src:"/demo/control-flow.svg",alt:"Control flow diagram showing an approved plan entering controlled execution with isolated workspaces and failure containment."}},{pillar:"Evidence",question:"How do you know what the AI actually did, across one run and across many?",tag:"You can inspect any single run. You can also see patterns across recent runs.",philosophy:"Chat sessions end. The reasoning disappears. Three months later, you need to understand why a choice was made and the context is gone. Proof preserves every run and analyzes patterns across them.",body:["Inside a single run: every step’s tool calls, standards lookups, diffs, tests, and outputs are captured. You can inspect any decision the AI surfaced.","Across recent runs: the system aggregates outcomes, evidence coverage, and recurring guidance gaps. Patterns that would otherwise live only in your head become visible.","What other tools don’t have: tenant-scoped run history, plus the Learning Signals analytics that surface patterns across it."],list:["<strong>Run record</strong> — plan, steps, conversations, tool calls, outputs, tests, failures, diagnostics, corrections","<strong>Standards evidence</strong> — which standards were consulted and which requirements were verified","<strong>Diagnostics</strong> — token usage, duration, cost, model selection per step","<strong>Cross-run analytics</strong> — outcome distribution, evidence coverage, and recurring gap topics across your recent runs","<strong>Tenant scope</strong> — your records, your patterns, your insights. No cross-tenant aggregation"],punchline:"Other tools show you the last diff. Proof keeps each run inspectable and analyzes patterns across many.",image:{src:"/demo/experience-capture.svg",alt:"Diagram showing run artifacts being captured, explained, and made available for review."},references:[{title:"Exactly Why and How AI Will Replace Knowledge Work",href:"https://danielmiessler.com/blog/exactly-why-and-how-ai-will-replace-knowledge-work",note:"The articulation gap and expertise ratchet."}]},{pillar:"Compound",question:"Do corrections actually stick?",tag:"Every correction becomes a constraint the AI can’t ignore next time.",philosophy:"Today: you correct the AI, you write the lesson as a rule, you hope the next session reads it. With Proof, the writing is still manual. But enforcement is not.",body:["You identify the gap during review. You write the correction as a standard. Proof provides the format. From that point, every run that touches that pattern finds the standard, extracts the requirements, and verifies compliance.","The Learning Signals panel shows whether corrections are working. If the same gap reappears across runs, it’s visible. If recurrence drops, that’s visible too."],list:["<strong>Run 1</strong> — review finds the AI used catch-log-continue. You correct it and add an error handling standard.","<strong>Run 2</strong> — the AI searches standards, finds the new rule, follows it. Review finds another gap.","<strong>Run 3</strong> — both standards enforced. Clean first pass."],punchline:"Not because the model got smarter. Because the system kept the lesson and enforced it.",image:{src:"/demo/compound-engineering.svg",alt:"Diagram showing three runs where corrections become standards and later runs start stronger."},references:[{title:"Compound Engineering: How Every Codes with Agents",href:"https://every.to/chain-of-thought/compound-engineering-how-every-codes-with-agents",note:"The plan, work, review, compound loop."}]},{pillar:"Planning",question:"How does the system build the plan?",tag:"Context discovered when needed, not dumped upfront.",philosophy:"You’ve seen it: the AI nails the first step, then by the fourth it’s forgotten the conventions it followed earlier. A single long session fills up and early decisions drop out. Proof’s planner avoids this by building the plan in stages, pulling only what each stage needs.",body:["The planner works through five stages. Each produces an artifact you can inspect. If stage 3 fails, stages 1–2 are preserved.","If you already have a plan from Claude Code, Cursor, or your own review, that plan can be the input. Proof still shapes it into typed steps with standards, scope, and verification before execution starts."],list:["<strong>Understand</strong> — extract what you asked for, what constraints apply, and how to tell when it’s done","<strong>Generate</strong> — produce the step list with types, dependencies, and descriptions","<strong>Shape</strong> — attach relevant standards to each step","<strong>
1Ground</strong> — resolve file paths, verify code references, anchor the plan to your actual codebase","<strong>Validate</strong> — check that the plan covers your request and every step has standards attached"],punchline:"Planning is useful only if execution stays faithful to it. The planner’s job is to produce a plan the system can actually enforce.",image:{src:"/demo/progressive-disclosure.svg",alt:"Diagram comparing dumping all context upfront with staged planning that pulls context on demand."},references:[{title:"Context Engineering for Coding Agents",href:"https://martinfowler.com/articles/exploring-gen-ai/context-engineering-coding-agents.html",note:"Why retrieval shape and timing change execution quality."}]}]},qe={class:"content-page"},Qe={key:0,class:"deep-dive-overview"},Je={class:"deep-dive-section__pillar"},Be={class:"deep-dive-section__heading"},Me={key:0,class:"deep-dive-section__tag"},Ve={key:1,class:"deep-dive-section__philosophy"},Ge={key:2,class:"deep-dive-section__image-wrap"},He={class:"deep-dive-section__body"},ze=["innerHTML"],Ye={key:0},Ze=["innerHTML"],ea={key:3,class:"deep-dive-section__callout"},aa={class:"deep-dive-section__callout-title"},ta={key:4,class:"deep-dive-section__punchline"},sa={key:5,class:"deep-dive-section__references"},la=["href"],na={key:0},oa={__name:"SystemPage",setup(e){const a={title:"Five Pillars",copy:"Each pillar addresses a specific failure mode in AI-assisted code.",blocks:[{label:"Pillars",items:Ue.sections.map(e=>`${e.pillar} — ${e.question}`)}]};return(e,t)=>((0,l.uX)(),(0,l.CE)("div",qe,[(0,l.bF)(Ne,{eyebrow:(0,o.R1)(Ue).eyebrow,title:(0,o.R1)(Ue).title,lede:(0,o.R1)(Ue).lede,"lede-emphasis":(0,o.R1)(Ue).ledeEmphasis,actions:(0,o.R1)(Ue).actions,aside:a},null,8,["eyebrow","title","lede","lede-emphasis","actions"]),(0,o.R1)(Ue).overviewImage?((0,l.uX)(),(0,l.CE)("div",Qe,[(0,l.bF)(ae,{src:(0,o.R1)(Ue).overviewImage.src,alt:(0,o.R1)(Ue).overviewImage.alt},null,8,["src","alt"])])):(0,l.Q3)("",!0),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(Ue).sections,e=>((0,l.uX)(),(0,l.CE)("section",{key:e.pillar,class:"deep-dive-section"},[(0,l.Lk)("p",Je,(0,n.v_)(e.pillar),1),(0,l.Lk)("h2",Be,(0,n.v_)(e.question),1),e.tag?((0,l.uX)(),(0,l.CE)("p",Me,(0,n.v_)(e.tag),1)):(0,l.Q3)("",!0),e.philosophy?((0,l.uX)(),(0,l.CE)("p",Ve,(0,n.v_)(e.philosophy),1)):(0,l.Q3)("",!0),e.image?((0,l.uX)(),(0,l.CE)("div",Ge,[(0,l.bF)(ae,{src:e.image.src,alt:e.image.alt},null,8,["src","alt"])])):(0,l.Q3)("",!0),(0,l.Lk)("div",He,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.body,(e,a)=>((0,l.uX)(),(0,l.CE)("p",{key:a,innerHTML:e},null,8,ze))),128)),e.list?((0,l.uX)(),(0,l.CE)("ul",Ye,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.list,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:a,innerHTML:e},null,8,Ze))),128))])):(0,l.Q3)("",!0)]),e.callout?((0,l.uX)(),(0,l.CE)("div",ea,[(0,l.Lk)("h4",aa,(0,n.v_)(e.callout.title),1),(0,l.Lk)("ul",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.callout.items,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:a},(0,n.v_)(e),1))),128))])])):(0,l.Q3)("",!0),e.punchline?((0,l.uX)(),(0,l.CE)("div",ta,(0,n.v_)(e.punchline),1)):(0,l.Q3)("",!0),e.references&&e.references.length?((0,l.uX)(),(0,l.CE)("footer",sa,[t[0]||(t[0]=(0,l.Lk)("p",{class:"deep-dive-section__references-label"},"Further reading",-1)),(0,l.Lk)("ul",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.references,e=>((0,l.uX)(),(0,l.CE)("li",{key:e.href},[(0,l.Lk)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer"},(0,n.v_)(e.title),9,la),e.note?((0,l.uX)(),(0,l.CE)("span",na," — "+(0,n.v_)(e.note),1)):(0,l.Q3)("",!0)]))),128))])])):(0,l.Q3)("",!0)]))),128))]))}},ra=oa,ia=ra,ua=JSON.parse('{"version":1,"capture":{"title":"Docs remap and transcript fidelity walkthrough","capturedAt":"2026-04-07","sanitized":true,"notes":["This is a curated demo session assembled from a real product-development workflow.","Identifiers and repo references can be sanitized or swapped without changing the demo components.","The walkthrough is intentionally read-only and does not call live console APIs."]},"featuredWorkspaceId":"captured-docs-remap","featuredJobId":"job-docs-remap-captured","landingPage":{"hero":{"eyebrow":"Recorded Demo","title":"See what a real 86 Proof run looks like.","lede":"This is a captured run from a real project. You can open the workspace, inspect the plan, expand individual tasks, and read the AI’s full reasoning.","actions":[{"label":"Open the workspace","to":"/demo/workspaces
1/captured-docs-remap","primary":true}],"aside":{"title":"What you’re looking at.","copy":"Nothing is mocked. The transcripts, tool calls, and diagnostics are what the AI actually did.","blocks":[{"label":"Workspace","text":"The project this run was submitted against. Its history and prior runs are already visible."},{"label":"Run","text":"A request to restore missing content after a refactor. Broken into tasks, executed against standards, reviewed with evidence."},{"label":"What to try","items":["Open the workspace to see its history","Click the run to see the plan and execution","Expand a task to see its output and the AI’s reasoning"]}]}},"highlights":[{"label":"Context","title":"The workspace already has history","text":"Prior runs, project description, and accumulated guidance are visible before any new work begins. Starting fresh is the part you don’t actually want."},{"label":"Plan","title":"You see the plan before anything executes","text":"The request becomes a list of tasks you can inspect and approve. Not a prompt that disappears into a black box."},{"label":"Evidence","title":"Every task leaves a trail","text":"Output, the AI’s full reasoning, and diagnostics are captured at the task level. When something goes wrong, you can see exactly where."}]},"workspaces":[{"id":"captured-docs-remap","name":"86 Proof Public Site","status":"ready","sourceLabel":"GitHub","description":"Captured product workspace for the 86 Proof public site and replacement operator console.","repoUrl":"","branch":"","createdAtLabel":"Created April 6, 2026","lastSyncedLabel":"Synced April 7, 2026","stats":[{"label":"Total Runs","value":"14","note":"Recent runs attached to this workspace.","tone":"ready"},{"label":"Active","value":"1","note":"One recorded run was live during this capture.","tone":"active"},{"label":"Failed","value":"1","note":"A transcript/debug fidelity issue triggered one retry path.","tone":"attention"}],"guidance":{"summary":"This workspace already follows strong rules: shared styles, clean routes, and verified changes.","gapTags":["Missing standard: 1","Degraded search: 1","Wrong results: 1"],"recurringTopics":[{"topic":"Transcript fidelity and execution evidence","count":"2x","tags":["missing standard","degraded search"]},{"topic":"Docs IA drift during refactors","count":"2x","tags":["wrong results"]}]},"jobs":[{"id":"job-docs-remap-captured","title":"Restore missing content after site restructure","updatedAt":"Updated 23 minutes before capture","statusLabel":"completed with follow-up","tone":"ready","note":"The main recorded walkthrough."},{"id":"job-shell-theme-split","title":"Split console theme from the public site theme","updatedAt":"Updated 4 hours before capture","statusLabel":"completed","tone":"ready","note":"Established the console visual system boundary."}
1,{"id":"job-workspace-create","title":"Bring in workspace creation flow","updatedAt":"Updated 7 hours before capture","statusLabel":"completed","tone":"ready","note":"Added GitHub and future S3 creation paths."}]}],"jobs":[{"id":"job-docs-remap-captured","workspaceId":"captured-docs-remap","workspaceTitle":"86 Proof Public Site","title":"Restore missing content after site restructure","statusLabel":"completed with follow-up","tone":"ready","updatedAtLabel":"Updated 23 minutes before capture","createdAtLabel":"Created April 7, 2026","runtime":"Claude Code","beadsSummary":"5/6 steps completed cleanly, 1 step retried once","description":"Continue from a known commit. Restore the missing product/frontend content. Preserve the new route structure. Avoid page-specific styling drift. Verify with e2e, unit, and build checks.","plan":[{"index":0,"title":"Audit legacy docs against the new IA","task":"Compare the legacy docs content with the new Overview, System, Docs hub, and Getting Started routes. Identify what argument, onboarding, and control-model material was lost.","deps":""},{"index":1,"title":"Restore the public docs content","task":"Remap the missing overview argument, system material, onboarding analogy, and concrete examples back into the current information architecture without reintroducing the deep-dive route.","deps":"#0"},{"index":2,"title":"Repair system-page visuals and references","task":"Bring back strong visuals for the architectural pillars and restore explicit external article references where the section depends on them.","deps":"#1"},{"index":3,"title":"Align navigation and affordances","task":"Remove redundant public navigation entries, make external links more obvious, and keep everything on shared styling primitives.","deps":"#1, #2"},{"index":4,"title":"Repair transcript and execution-detail fidelity","task":"Track down why transcript access is failing or rendering blank assistant turns, then repair the UI contract without regressing the cleaner execution-centered run-detail structure.","deps":"#2, #3"},{"index":5,"title":"Verify and close","task":"Run the full verification stack, refresh any expected snapshots, and close the run with acceptance and diagnostics.","deps":"#1, #2, #3, #4"}],"beads":[{"index":0,"phase":0,"title":"Audit docs remap gaps","fullTitle":"Audit the legacy docs and identify exactly which Overview, System, and Getting Started material was over-trimmed.","statusLabel":"completed","tone":"ready","usageLabel":"1,240 in / 410 out","dependsOnLabel":"","blockedByLabel":"","updatedAtLabel":"Updated 1h before completion","role":"research","beadType":"analysis","model":"claude-3.7-sonnet","durationLabel":"3m 12s","costLabel":"$0.31","budgetLabel":"$2.00","output":"Mapped the missing content back into the current IA and identified the exact routes where the public argument and onboarding flow had been weakened.","transcript":{"systemPrompt":"Act as a repository-focused coding agent. Audit the docs IA before proposing code changes.","messages":[{"role":"user","content":"Continue from the specified commit and show the exact remap plan first."},{"role":"assistant","content":"[Tool rg] locate overview/system/docs/getting-started content seams in the new app"},{"role":"assistant","content":"[Result rg] found route structure and current content configuration files"},{"role":"assistant","content":"The remap is clear: Overview carries the product argument, System carries control model and pillars, and Getting Started carries the practical Tier1 onboarding material."}]},"usage":{"inputTokens":1240,"outputTokens":410}},{"index":1,"phase":1,"title":"Restore IA content","fullTitle":"Reintroduce the lost docs and frontend material into the current route structure without bringing back the old architecture deep-dive page.","statusLabel":"completed","tone":"ready","usageLabel":"1,880 in / 690 out","dependsOnLabel":"#0","blockedByLabel":"","updatedAtLabel":"Updated 48m before completion","role":"implementation","beadType":"docs","model":"claude-3.7-sonnet","durationLabel":"6m 04s","costLabel":"$0.49","budgetLabel":"$3.00","output":"Overview, System, and Getting Started regained the missing material while Docs remained a thin hub.","transcript":{"systemPrompt":"Preserve the new route structure and shared styling system while restoring the missing public content.","messages":[{"role":"user","content":"Do not bring back Tier2 as a docs page."},{"role":"assistant","content":"Restoring the argument and onboarding material into the existing routes only. Deep architecture content remains out of scope."}]},"usage":{"inputTokens":1880,"outputTokens":690}},{"index":2,"phase":2,"title":"System-page visuals and sources","fullTitle":"Replace weak text-only pillar explanation with stronger visual
1s and explicit source references.","statusLabel":"completed","tone":"ready","usageLabel":"1,120 in / 360 out","dependsOnLabel":"#1","blockedByLabel":"","updatedAtLabel":"Updated 39m before completion","role":"implementation","beadType":"frontend","model":"claude-3.7-sonnet","durationLabel":"4m 26s","costLabel":"$0.28","budgetLabel":"$2.50","output":"Added architectural SVGs and made source links visually explicit so the control layer reads as grounded, not asserted.","transcript":{"systemPrompt":"Favor visual explanation over prose where the product already has strong diagrams available.","messages":[{"role":"user","content":"Experience capture looks weak compared with the other pillars."},{"role":"assistant","content":"Creating a proper diagram so the section matches the rest stylistically instead of relying on text chips."}]},"usage":{"inputTokens":1120,"outputTokens":360}},{"index":3,"phase":3,"title":"Navigation and affordance cleanup","fullTitle":"Remove redundant nav entries and clarify external/off-site references without introducing styling drift.","statusLabel":"completed","tone":"ready","usageLabel":"920 in / 290 out","dependsOnLabel":"#1, #2","blockedByLabel":"","updatedAtLabel":"Updated 31m before completion","role":"implementation","beadType":"frontend","model":"claude-3.7-sonnet","durationLabel":"2m 58s","costLabel":"$0.19","budgetLabel":"$1.50","output":"Removed the redundant Overview nav item and made external references read like explicit outbound links.","transcript":{"systemPrompt":"Preserve the site shell while improving wayfinding and source affordances.","messages":[{"role":"user","content":"Overview should not be in the menu if it is the landing page."},{"role":"assistant","content":"Agreed. Leaving home on the brand and keeping the primary nav focused on secondary destinations."}]},"usage":{"inputTokens":920,"outputTokens":290}},{"index":4,"phase":4,"title":"Transcript fidelity repair","fullTitle":"Repair transcript fetches and rendering so execution evidence stays trustworthy on the new run-detail page.","statusLabel":"retried once","tone":"attention","usageLabel":"2,040 in / 710 out","dependsOnLabel":"#2, #3","blockedByLabel":"","updatedAtLabel":"Updated 24m before completion","role":"debug","beadType":"frontend","model":"claude-3.7-sonnet","durationLabel":"8m 14s","costLabel":"$0.58","budgetLabel":"$3.00","output":"Fixed run-id derivation, switched transcript fetches to the composite artifact step id, and rendered assistant tool activity instead of blank rows.","transcript":{"systemPrompt":"Diagnose transcript unavailability and blank assistant turns without regressing the execution-centered layout.","messages":[{"role":"user","content":"Transcript is not available for this step."},{"role":"assistant","content":"[Tool rg] search runId, run_count, conversation, composite step ids"},{"role":"assistant","content":"[Result rg] transcripts are stored by composite step id and numeric run id; step state exposes run_count"},{"role":"assistant","content":"Derived runId from run_count - 1 and switched the conversation fetch to the composite artifact step id."},{"role":"assistant","content":"[Tool rg] inspect BeadConversation contract for assistant tool turns"},{"role":"assistant","content":"[Result rg] assistant messages may carry toolUse/toolResult with empty text content"},{"role":"assistant","content":"Rendering tool activity explicitly now so assistant rows stop appearing empty."}]},"usage":{"inputTokens":2040,"outputTokens":710}},{"index":5,"phase":5,"title":"Verification and closeout","fullTitle":"Run unit, e2e, and build checks, refresh expected snapshots where needed, and close the run with explicit acceptance tracking.","statusLabel":"completed","tone":"ready","usageLabel":"880 in / 210 out","dependsOnLabel":"#1, #2, #3, #4","blockedByLabel":"","updatedAtLabel":"Updated at completion","role":"verification","beadType":"verification","model":"claude-3.7-sonnet","durationLabel":"5m 18s","costLabel":"$0.17","budgetLabel":"$1.00","output":"Verification passed across unit tests, build, and e2e. The only persistent warning is the known webpack entry-size notice.","transcript":{"systemPrompt":"Treat verification as part of the run, not as optional cleanup after code changes.","messages":[{"role":"user","content":"Verify with npm.cmd test, npm.cmd run build, and npm.cmd run test:e2e."},{"role":"assistant","content":"Verification passed. Remaining output is limited to the existing webpack size warning."}]},"usage":{"inputTokens":880,"outputTokens":210}}],"results":{"summary":"The repo regained the missing public content. The system page became diagram-led again. Transcript fidelity improved. The replacement console stayed on its cleaner route and styling boundaries.","acceptance":[{"label":"Public IA restored","tone":"ready"},{"label":"No route regression","tone":"ready"},{"label":"Transcript bug repaired","tone":"ready"},{"label":"Verification complete","tone":"ready"}],"diagnostics":["One retry path came from transcript contract drift between step state and artifact storage.","Assistant transcript rows looked empty because structured tool turns were being flattened incorrectly.","The remaining omitted surfaces are better suited to a future admin a
1pp than to the main alpha operator console."]}}]}');function ca(e,a){if("string"!==typeof e||!e.trim())throw new Error(`Invalid demo session: ${a} must be a non-empty string.`)}function da(e,a){if(!Array.isArray(e)||0===e.length)throw new Error(`Invalid demo session: ${a} must be a non-empty array.`)}function pa(e){if(!e||"object"!==typeof e)throw new Error("Invalid demo session: root object is required.");ca(e.featuredWorkspaceId,"featuredWorkspaceId"),ca(e.featuredJobId,"featuredJobId"),da(e.workspaces,"workspaces"),da(e.jobs,"jobs");const a=new Set(e.workspaces.map(e=>e.id)),t=new Set(e.jobs.map(e=>e.id));if(!a.has(e.featuredWorkspaceId))throw new Error("Invalid demo session: featuredWorkspaceId does not match a workspace.");if(!t.has(e.featuredJobId))throw new Error("Invalid demo session: featuredJobId does not match a run.")}pa(ua);const va=ua.featuredWorkspaceId,ka=ua.featuredJobId,ga=ua.landingPage,ba=(ua.capture,ua.workspaces),ma=ua.jobs,_a=(ba.find(e=>e.id===va),ma.find(e=>e.id===ka)||null);function ha(e){return ba.find(a=>a.id===e)||null}function ya(e){return ma.find(a=>a.id===e)||null}const fa={class:"console demo-layout"},wa={class:"console__tabs","aria-label":"Demo"},La={class:"console__content"},Ca={__name:"DemoLayout",setup(e){const a=(0,r.lq)(),t=[{label:"Walkthrough",to:"/demo",match:"/demo"},{label:"Workspace",to:`/demo/workspaces/${va}`,match:"/demo/workspaces/"},{label:"Run",to:`/demo/jobs/${ka}`,match:"/demo/jobs/"}];function s(e){return"/demo"===e.to?"/demo"===a.path:a.path.startsWith(e.match)}return(e,a)=>{const o=(0,l.g2)("router-link"),r=(0,l.g2)("router-view");return(0,l.uX)(),(0,l.CE)("div",fa,[a[0]||(a[0]=(0,l.Lk)("div",{class:"demo-layout__banner"},[(0,l.Lk)("span",{class:"label"},"Public Demo"),(0,l.Lk)("p",null,"This is a recorded, read-only walkthrough built from frozen data. Nothing on these routes mutates state.")],-1)),(0,l.Lk)("nav",wa,[((0,l.uX)(),(0,l.CE)(l.FK,null,(0,l.pI)(t,e=>(0,l.bF)(o,{key:e.label,to:e.to,class:(0,n.C4)(["console__tab",{"console__tab--active":s(e)}])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1032,["to","class"])),64))]),(0,l.Lk)("div",La,[(0,l.bF)(r)])])}}};var Ea=t(262);const Ra=(0,Ea.A)(Ca,[["__scopeId","data-v-6bd306fc"]]),Ia=Ra,ja={class:"content-page demo-page"},Aa={class:"shift-panels"},Wa={class:"label"},Sa={class:"shift-panel__question"},Xa={class:"shift-panel__answer"},xa={__name:"DemoLandingPage",setup(e){return(e,a)=>((0,l.uX)(),(0,l.CE)("div",ja,[(0,l.bF)(Ne,{eyebrow:(0,o.R1)(ga).hero.eyebrow,title:(0,o.R1)(ga).hero.title,lede:(0,o.R1)(ga).hero.lede,note:(0,o.R1)(ga).hero.note,actions:(0,o.R1)(ga).hero.actions,aside:(0,o.R1)(ga).hero.aside},null,8,["eyebrow","title","lede","note","actions","aside"]),(0,o.R1)(ga).highlights&&(0,o.R1)(ga).highlights.length?((0,l.uX)(),(0,l.Wv)(H,{key:0,heading:"What to notice"},{default:(0,l.k6)(()=>[(0,l.Lk)("div",Aa,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(ga).highlights,e=>((0,l.uX)(),(0,l.CE)("article",{key:e.title,class:"shift-panel"},[(0,l.Lk)("span",Wa,(0,n.v_)(e.label),1),(0,l.Lk)("h3",Sa,(0,n.v_)(e.title),1),(0,l.Lk)("p",Xa,(0,n.v_)(e.text),1)]))),128))])]),_:1})):(0,l.Q3)("",!0)]))}},Ta=xa,Pa=Ta,$a={class:"console-page"},Fa={class:"console-page__header"},Ka={class:"console-page__title"},Oa={class:"console-page__placeholder"},Da={class:"console-badge console-badge--small console-badge--ready"},Na={class:"console-detail__stat"},Ua={class:"console-detail__stat"},qa={class:"console-page__demo-intro"},Qa={class:"console-panel console-panel--ready"},Ja={class:"console-module",open:""},Ba={class:"console-detail__overview"},Ma={class:"console-text-block"},Va={key:0,class:"console-text-block"},Ga=["href"],Ha={key:0},za={class:"console-text-block"},Ya={class:"console-signal-strip"},Za={class:"console-signal__label"},et={class:"console-signal__value"},at={class:"console-signal__note"},tt={class:"console-module",open:""},st={class:"console-text-block"},lt={class:"console-tag-row"},nt={class:"console-topic-list"},ot={class:"console-topic__header"},rt={class:"console-tag-row"},it={class:"console-module",open:""},ut={class:"console-module__summary"},ct={class:"console-module__count"},dt={class:"console-stream"},pt={class:"console-stream__title"},vt={class:"console-stream__meta"},kt={class:"console-stream__aside"},gt={class:"console-module"},bt={class:"console-meta-list"},mt={class:"console-mono"},_t={key:0},ht={class:"console-mono"},yt={key:1},ft={class:"console-mono"},wt={__name:"DemoWorkspaceDetailPage",setup(e){const a=(0,r.lq)(),t=(0,l.
1EW)(()=>ha(a.params.id)||ha("captured-docs-remap")),s=_a;return(e,a)=>{const r=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",$a,[(0,l.Lk)("div",Fa,[(0,l.Lk)("div",null,[a[0]||(a[0]=(0,l.Lk)("span",{class:"label"},"Workspace",-1)),(0,l.Lk)("h1",Ka,(0,n.v_)(t.value.name),1),(0,l.Lk)("p",Oa,[(0,l.Lk)("span",Da,(0,n.v_)(t.value.status),1),(0,l.Lk)("span",Na,(0,n.v_)(t.value.sourceLabel),1),(0,l.Lk)("span",Ua,(0,n.v_)(t.value.createdAtLabel),1)])])]),(0,l.Lk)("div",qa,[a[2]||(a[2]=(0,l.Lk)("p",{class:"console-page__intro"},"A workspace is a project connected to a source: a GitHub repo or an uploaded archive. When the AI runs against the workspace, it picks up the standards and corrections previous runs left behind. This is how corrections compound instead of resetting every session.",-1)),(0,l.bF)(r,{to:{path:"/demo/jobs/"+(0,o.R1)(s).id},class:"button button--primary"},{default:(0,l.k6)(()=>[...a[1]||(a[1]=[(0,l.eW)("View run",-1)])]),_:1},8,["to"])]),(0,l.Lk)("section",Qa,[(0,l.Lk)("details",Ja,[a[3]||(a[3]=(0,l.Lk)("summary",{class:"console-module__summary"},"Overview",-1)),(0,l.Lk)("div",Ba,[(0,l.Lk)("div",null,[(0,l.Lk)("p",Ma,(0,n.v_)(t.value.description),1),t.value.repoUrl?((0,l.uX)(),(0,l.CE)("p",Va,[(0,l.Lk)("a",{href:t.value.repoUrl,target:"_blank",rel:"noopener",class:"external-link"},(0,n.v_)(t.value.repoUrl),9,Ga),t.value.branch?((0,l.uX)(),(0,l.CE)("span",Ha," @ "+(0,n.v_)(t.value.branch),1)):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0),(0,l.Lk)("p",za,(0,n.v_)(t.value.lastSyncedLabel),1)]),(0,l.Lk)("div",Ya,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.stats,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:(0,n.C4)(["console-signal",`console-signal--${e.tone}`])},[(0,l.Lk)("span",Za,(0,n.v_)(e.label),1),(0,l.Lk)("span",et,(0,n.v_)(e.value),1),(0,l.Lk)("span",at,(0,n.v_)(e.note),1)],2))),128))])])]),(0,l.Lk)("details",tt,[a[4]||(a[4]=(0,l.Lk)("summary",{class:"console-module__summary"},"Guidance Gaps",-1)),(0,l.Lk)("p",st,(0,n.v_)(t.value.guidance.summary),1),(0,l.Lk)("div",lt,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.guidance.gapTags,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"console-badge console-badge--neutral"},(0,n.v_)(e),1))),128))]),(0,l.Lk)("div",nt,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.guidance.recurringTopics,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.topic,class:"console-topic"},[(0,l.Lk)("div",ot,[(0,l.Lk)("strong",null,(0,n.v_)(e.topic),1),(0,l.Lk)("span",null,(0,n.v_)(e.count),1)]),(0,l.Lk)("div",rt,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.tags,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"console-badge console-badge--small console-badge--neutral"},(0,n.v_)(e),1))),128))])]))),128))])]),(0,l.Lk)("details",it,[(0,l.Lk)("summary",ut,[a[5]||(a[5]=(0,l.eW)("Recent Runs ",-1)),(0,l.Lk)("span",ct,(0,n.v_)(t.value.jobs.length),1)]),(0,l.Lk)("div",dt,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.jobs,e=>((0,l.uX)(),(0,l.Wv)(r,{key:e.id,to:e.id===(0,o.R1)(s).id?{path:"/demo/jobs/"+e.id}:{path:"/demo/jobs/"+(0,o.R1)(s).id},class:"console-stream__item"},{default:(0,l.k6)(()=>[(0,l.Lk)("div",null,[(0,l.Lk)("p",pt,(0,n.v_)(e.title),1),(0,l.Lk)("p",vt,(0,n.v_)(e.updatedAt)+" | "+(0,n.v_)(e.note),1)]),(0,l.Lk)("div",kt,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.statusLabel),3)])]),_:2},1032,["to"]))),128))])]),(0,l.Lk)("details",gt,[a[10]||(a[10]=(0,l.Lk)("summary",{class:"console-module__summary"},"Details",-1)),(0,l.Lk)("dl",bt,[(0,l.Lk)("div",null,[a[6]||(a[6]=(0,l.Lk)("dt",null,"Workspace ID",-1)),(0,l.Lk)("dd",mt,(0,n.v_)(t.value.id),1)]),(0,l.Lk)("div",null,[a[7]||(a[7]=(0,l.Lk)("dt",null,"Status",-1)),(0,l.Lk)("dd",null,(0,n.v_)(t.value.status),1)]),t.value.repoUrl?((0,l.uX)(),(0,l.CE)("div",_t,[a[8]||(a[8]=(0,l.Lk)("dt",null,"Repository",-1)),(0,l.Lk)("dd",ht,(0,n.v_)(t.value.repoUrl),1)])):(0,l.Q3)("",!0),t.value.branch?((0,l.uX)(),(0,l.CE)("div",yt,[a[9]||(a[9]=(0,l.Lk)("dt",null,"Branch",-1)),(0,l.Lk)("dd",ft,(0,n.v_)(t.value.branch),1)])):(0,l.Q3)("",!0)])])])])}}},Lt=wt,Ct=Lt,Et={class:"console-page"},Rt={class:"console-page__header"},It={class:"console-page__title"},jt={class:"console-page__placeholder"},At={class:"job-detail__stat"},Wt={class:"job-detail__stat"},St={class:"console-page__actions"},Xt={class:"console-module",open:""},xt={class:"job-detail__prose"},Tt={class:"console-module",open:""},Pt={class:"console-module__summary"},$t={class:"console-module__count"},Ft={class:"job-detail__plan-list"},Kt={class:"job-detail__plan-summary"},Ot={class:"job-detail__plan-index"},Dt={class:"job-detail__plan-title"},Nt={key:0,class:"job-detail__plan-deps"},Ut={class:"job-detail__prose job-detail__prose--nested"},qt={class:"console-module",open:""},Qt={class:"console-module__summary"},Jt={class:"console-module__count"},Bt={class:"dag"},Mt={class:"dag__phase-row"},Vt={class:"dag__phase-label"},Gt=["onClick"],Ht={class:"dag__node-index"},zt={class:"dag__node-label"},Yt={key:0,class:"dag__node-usage"},Zt={key:0,class:"dag__detail"},es={class:"dag__detail-header"},as={class:"dag__detail-title-row"},ts={class:"dag__detail-index"},ss={class:"dag__detail-title"},ls={class:"job-detail__prose"},ns={class:"job-detail__diag-grid"},os={class:"job-detail__diag-item"},rs={key:0,class:"job-detail__diag-item"},is={key:1,class:"job-detail__diag-item"},us={key:2,class:"job-detail__diag-item"},cs={key:3,class:"job-detail__diag-item"},ds={key:4,class:"job-detail__diag-item"}
1,ps={key:5,class:"job-detail__diag-item"},vs={key:6,class:"job-detail__diag-item"},ks={key:7,class:"job-detail__diag-item"},gs={key:8,class:"job-detail__diag-item"},bs={class:"job-detail__subsection"},ms={class:"job-detail__prose job-detail__prose--boxed"},_s=["open"],hs={class:"job-detail__conversation-body"},ys={class:"job-detail__conversation-system"},fs={class:"job-detail__conversation-pre"},ws={class:"job-detail__conversation-role"},Ls={class:"job-detail__conversation-pre"},Cs={key:0,class:"job-detail__status-line"},Es={class:"console-module",open:""},Rs={class:"job-detail__prose"},Is={class:"job-detail__acceptance"},js={class:"console-module"},As={class:"job-detail__diagnostic-list"},Ws={class:"console-module"},Ss={class:"job-detail__meta-list"},Xs={class:"job-detail__mono"},xs={__name:"DemoJobDetailPage",setup(e){const a=(0,r.lq)(),t=(0,l.EW)(()=>ya(a.params.id)||_a),s=(0,o.KR)(null),i=(0,o.KR)(null),u=(0,l.EW)(()=>t.value.beads.filter(e=>"ready"===e.tone).length),c=(0,l.EW)(()=>t.value.beads.find(e=>e.index===s.value)||null),d=(0,l.EW)(()=>{const e=new Map;for(const a of t.value.beads){const t=a.phase??0,s=e.get(t)??[];s.push(a),e.set(t,s)}return[...e.entries()].sort((e,a)=>e[0]-a[0]).map(([e,a])=>({depth:e,items:a.map((e,a)=>({...e,colStart:a+1,colEnd:a+2}))}))}),p=(0,l.EW)(()=>Math.max(...d.value.map(e=>e.items.length),1));function v(e){s.value=s.value===e?null:e,s.value!==e&&(i.value=null)}function k(e,a){i.value=a.target.open?e:null}return(e,a)=>{const o=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",Et,[(0,l.Lk)("div",Rt,[(0,l.Lk)("div",null,[a[2]||(a[2]=(0,l.Lk)("span",{class:"label"},"Run",-1)),(0,l.Lk)("h1",It,(0,n.v_)(t.value.title),1),(0,l.Lk)("p",jt,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${t.value.tone}`])},(0,n.v_)(t.value.statusLabel),3),(0,l.Lk)("span",At,(0,n.v_)(t.value.beadsSummary),1),(0,l.Lk)("span",Wt,(0,n.v_)(t.value.updatedAtLabel),1)])]),(0,l.Lk)("div",St,[(0,l.bF)(o,{to:{path:"/demo/workspaces/"+t.value.workspaceId},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[3]||(a[3]=[(0,l.eW)("Workspace",-1)])]),_:1},8,["to"])])]),a[28]||(a[28]=(0,l.Lk)("div",{class:"console-page__demo-intro"},[(0,l.Lk)("p",{class:"console-page__intro"},"A run is one request executed against a workspace. You describe the work. 86 Proof builds the plan. You approve. Each step executes against the workspace's standards. A workspace can have many runs. Each one starts with the standards and corrections previous runs left behind.")],-1)),(0,l.Lk)("section",{class:(0,n.C4)(["console-panel",`console-panel--${t.value.tone}`])},[(0,l.Lk)("details",Xt,[a[4]||(a[4]=(0,l.Lk)("summary",{class:"console-module__summary"},"Request",-1)),(0,l.Lk)("div",xt,[(0,l.Lk)("p",null,(0,n.v_)(t.value.description),1)])]),(0,l.Lk)("details",Tt,[(0,l.Lk)("summary",Pt,[a[5]||(a[5]=(0,l.eW)(" Plan ",-1)),(0,l.Lk)("span",$t,(0,n.v_)(t.value.plan.length)+" steps",1)]),(0,l.Lk)("div",Ft,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.plan,e=>((0,l.uX)(),(0,l.CE)("details",{key:e.index,class:"job-detail__plan-entry"},[(0,l.Lk)("summary",Kt,[(0,l.Lk)("span",Ot,"#"+(0,n.v_)(e.index),1),(0,l.Lk)("span",Dt,(0,n.v_)(e.title),1),e.deps?((0,l.uX)(),(0,l.CE)("span",Nt,"depends on "+(0,n.v_)(e.deps),1)):(0,l.Q3)("",!0)]),(0,l.Lk)("div",Ut,[(0,l.Lk)("p",null,(0,n.v_)(e.task),1)])]))),128))])]),(0,l.Lk)("details",qt,[(0,l.Lk)("summary",Qt,[a[6]||(a[6]=(0,l.eW)(" Execution ",-1)),(0,l.Lk)("span",Jt,(0,n.v_)(u.value)+"/"+(0,n.v_)(t.value.beads.length),1)]),(0,l.Lk)("div",Bt,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(d.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.depth,class:"dag__phase"},[(0,l.Lk)("div",Mt,[(0,l.Lk)("div",Vt,[(0,l.Lk)("span",null,"Phase "+(0,n.v_)(e.depth),1)]),(0,l.Lk)("div",{class:"dag__nodes",style:(0,n.Tr)({"grid-template-columns":`repeat(${p.value}, 1fr)`})},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.items,e=>((0,l.uX)(),(0,l.CE)("button",{key:e.index,type:"button",class:(0,n.C4)(["dag__node",[`dag__node--${e.tone}`,{"dag__node--selected":s.value===e.index}]]),style:(0,n.Tr)({"grid-column":`${e.colStart} / ${e.colEnd}`}),onClick:a=>v(e.index)},[(0,l.Lk)("span",Ht,"#"+(0,n.v_)(e.index),1),(0,l.Lk)("span",zt,(0,n.v_)(e.title),
11),e.usageLabel?((0,l.uX)(),(0,l.CE)("span",Yt,(0,n.v_)(e.usageLabel),1)):(0,l.Q3)("",!0),(0,l.Lk)("span",{class:(0,n.C4)(["dag__node-dot",`dag__node-dot--${e.tone}`])},null,2)],14,Gt))),128))],4)]),c.value&&e.items.some(e=>e.index===c.value.index)?((0,l.uX)(),(0,l.CE)("section",Zt,[(0,l.Lk)("div",es,[(0,l.Lk)("div",null,[(0,l.Lk)("div",as,[(0,l.Lk)("span",ts,"#"+(0,n.v_)(c.value.index),1),(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${c.value.tone}`])},(0,n.v_)(c.value.statusLabel),3)]),(0,l.Lk)("p",ss,(0,n.v_)(c.value.title),1)]),(0,l.Lk)("button",{type:"button",class:"button button--ghost job-detail__close-button",onClick:a[0]||(a[0]=e=>s.value=null)},"Close")]),(0,l.Lk)("div",ls,[(0,l.Lk)("p",null,(0,n.v_)(c.value.fullTitle),1)]),(0,l.Lk)("div",ns,[(0,l.Lk)("div",os,[a[7]||(a[7]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"State",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.statusLabel),1)]),c.value.role?((0,l.uX)(),(0,l.CE)("div",rs,[a[8]||(a[8]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Role",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.role),1)])):(0,l.Q3)("",!0),c.value.beadType?((0,l.uX)(),(0,l.CE)("div",is,[a[9]||(a[9]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Type",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.beadType),1)])):(0,l.Q3)("",!0),c.value.dependsOnLabel?((0,l.uX)(),(0,l.CE)("div",us,[a[10]||(a[10]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Depends on",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.dependsOnLabel),1)])):(0,l.Q3)("",!0),c.value.updatedAtLabel?((0,l.uX)(),(0,l.CE)("div",cs,[a[11]||(a[11]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Updated",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.updatedAtLabel),1)])):(0,l.Q3)("",!0),c.value.model?((0,l.uX)(),(0,l.CE)("div",ds,[a[12]||(a[12]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Model",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.model),1)])):(0,l.Q3)("",!0),c.value.usageLabel?((0,l.uX)(),(0,l.CE)("div",ps,[a[13]||(a[13]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Tokens",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.usageLabel),1)])):(0,l.Q3)("",!0),c.value.durationLabel?((0,l.uX)(),(0,l.CE)("div",vs,[a[14]||(a[14]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Duration",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.durationLabel),1)])):(0,l.Q3)("",!0),c.value.costLabel?((0,l.uX)(),(0,l.CE)("div",ks,[a[15]||(a[15]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Cost",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.costLabel),1)])):(0,l.Q3)("",!0),c.value.budgetLabel?((0,l.uX)(),(0,l.CE)("div",gs,[a[16]||(a[16]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Budget",-1)),(0,l.Lk)("span",null,(0,n.v_)(c.value.budgetLabel),1)])):(0,l.Q3)("",!0)]),(0,l.Lk)("div",bs,[a[17]||(a[17]=(0,l.Lk)("div",{class:"job-detail__subsection-header"},[(0,l.Lk)("span",{class:"job-detail__diag-label"},"Output")],-1)),(0,l.Lk)("div",ms,[(0,l.Lk)("p",null,(0,n.v_)(c.value.output),1)])]),(0,l.Lk)("details",{class:"job-detail__conversation",open:Boolean(i.value===c.value.index),onToggle:a[1]||(a[1]=e=>k(c.value.index,e))},[a[19]||(a[19]=(0,l.Lk)("summary",{class:"job-detail__conversation-summary"},"Transcript",-1)),(0,l.Lk)("div",hs,[(0,l.Lk)("div",ys,[a[18]||(a[18]=(0,l.Lk)("div",{class:"job-detail__diag-label"},"System Prompt",-1)),(0,l.Lk)("pre",fs,(0,n.v_)(c.value.transcript.systemPrompt),1)]),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(c.value.transcript.messages,(e,a)=>((0,l.uX)(),(0,l.CE)("div",{key:`${c.value.index}-${a}`,class:(0,n.C4)(["job-detail__conversation-message",`job-detail__conversation-message--${e.role}`])},[(0,l.Lk)("div",ws,(0,n.v_)(e.role),1),(0,l.Lk)("pre",Ls,(0,n.v_)(e.content),1)],2))),128))])],40,_s)])):(0,l.Q3)("",!0)]))),128))]),c.value?(0,l.Q3)("",!0):((0,l.uX)(),(0,l.CE)("p",Cs,"Select a step to inspect output and conversation evidence."))]),(0,l.Lk)("details",Es,[a[20]||(a[20]=(0,l.Lk)("summary",{class:"console-module__summary"},"Results",-1)),(0,l.Lk)("div",Rs,[(0,l.Lk)("p",null,(0,n.v_)(t.value.results.summary),1)]),(0,l.Lk)("div",Is,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.results.acceptance,e=>((0,l.uX)(),(0,l.CE)("span",{key:e.label,class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.label),3))),128))])]),(0,l.Lk)("details",js,[a[21]||(a[21]=(0,l.Lk)("summary",{class:"console-module__summary"},"Diagnostics",-1)),(0,l.Lk)("ul",As,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value.results.diagnostics,e=>((0,l.uX)(),(0,l.CE)("li",{key:e},(0,n.v_)(e),1))),128))])]),(0,l.Lk)("details",Ws,[a[27]||(a[27]=(0,l.Lk)("summary",{class:"console-module__summary"},"Details",-1)),(0,l.Lk)("dl",Ss,[(0,l.Lk)("div",null,[a[22]||(a[22]=(0,l.Lk)("dt",null,"Run ID",-1)),(0,l.Lk)("dd",Xs,(0,n.v_)(t.value.id),1)]),(0,l.Lk)("div",null,[a[23]||(a[23]=(0,l.Lk)("dt",null,"Workspace",-1)),(0,l.Lk)("dd",null,(0,n.v_)(t.value.workspaceTitle),1)]),(0,l.Lk)("div",null,[a[24]||(a[24]=(0,l.Lk)("dt",null,"Created",-1)),(0,l.Lk)("dd",null,(0,n.v_)(t.value.createdAtLabel),1)]),(0,l.Lk)("div",null,[a[25]||(a[25]=(0,l.Lk)("dt",null,"Updated",-1)),(0,l.Lk)("dd",null,(0,n.v_)(t.value.updatedAtLabel),1)]),(0,l.Lk)("div",null,[a[26]||(a[26]=(0,l.Lk)("dt",null,"Runtime",-1)),(0,l.Lk)("dd",null,(0,n.v_)(t.value.runtime),1)])])])],2)])}}},Ts=xs,Ps=Ts,$s=Symbol("frontend-environment");class Fs{getEnvVar(){}getHostname(){return""}}class Ks extends Fs{constructor({envAccessor:e=()=>{}
1,processEnvAccessor:a=()=>({VUE_APP_BUILD_VERSION:"0.1.0",VUE_APP_API_KEY:"FRUkVGoTJo18k0tCz31oLfCB9U6LOCC4UZ1td0r4",VUE_APP_BUILD_SHA:"a8629184850263434f51bc278ad7d3ff1d9f0ea4",VUE_APP_BUILD_TIMESTAMP:"2026-07-11T16:49:11Z",VUE_APP_ORCHESTRATOR_URL:"https://api.86proof.ai",VUE_APP_GA_MEASUREMENT_ID:"G-P79243V6VK",NODE_ENV:"production",BASE_URL:"/"}),locationAccessor:t=()=>"undefined"!==typeof window?window.location:void 0}={}){super(),this.envAccessor=e,this.processEnvAccessor=a,this.locationAccessor=t}getEnvVar(e){try{const a=this.envAccessor?.();if(a&&Object.prototype.hasOwnProperty.call(a,e))return a[e]}catch(a){return}try{const a=this.processEnvAccessor?.();if(a&&Object.prototype.hasOwnProperty.call(a,e))return a[e]}catch(a){return}}getHostname(){try{return this.locationAccessor?.()?.hostname??""}catch{return""}}}const Os=new Ks;function Ds(){return(0,l.nI)()?(0,l.WQ)($s,Os):Os}function Ns(){const{tenantId:e,getAuthHeaders:a}=C(),t=Ds(),s=(0,l.EW)(()=>{const e=t.getEnvVar("VUE_APP_ORCHESTRATOR_URL");if(e)return e;const a=t.getHostname();return"localhost"===a||"127.0.0.1"===a?"/_proxy/orchestrator":a.includes("staging")?"https://staging-api.beads.j2clark.info":"https://api.86proof.ai"}),n=(0,l.EW)(()=>e.value||"local"),o=(0,l.EW)(()=>{const e=a(),s=Object.keys(e).length>0?{...e}:{"x-tenant-id":n.value},l=t.getEnvVar("VUE_APP_API_KEY");return l&&(s["x-api-key"]=l),s});function r(e,a){return`${s.value}/jobs/${e}/${a}`}return{orchestratorBaseUrl:s,apiHeaders:o,tenantId:n,jobUrl:r}}function Us(e,a){return e&&"string"===typeof e.message&&e.message.trim()?e.message:e&&"string"===typeof e.error&&e.error.trim()?e.error:`HTTP ${a}`}const qs={class:"page-template login-page"},Qs={class:"page-template__panel login-page__panel"},Js={key:0,class:"alert alert--error login-page__error"},Bs={class:"form-field"},Ms=["disabled"],Vs={class:"form-field"},Gs=["disabled"],Hs=["disabled"],zs={__name:"LoginPage",setup(e){const a=(0,r.rd)(),t=(0,r.lq)(),{setToken:i}=C(),{orchestratorBaseUrl:u,apiHeaders:c}=Ns(),d=(0,o.KR)(""),p=(0,o.KR)(""),v=(0,o.KR)(!1),k=(0,o.KR)(""),g=(0,o.KR)(null),b=(0,o.KR)(null);async function m(){const e=d.value||g.value?.value||"",s=p.value||b.value?.value||"";if(e.trim()&&s){v.value=!0,k.value="";try{const l=await fetch(`${u.value}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json",...c.value},body:JSON.stringify({username:e,password:s})});if(l.ok){const e=await l.json();i(e.token);const s=Array.isArray(t.query.redirect)?t.query.redirect[0]:t.query.redirect||"/console",n="string"===typeof s&&s.startsWith("/")&&!s.startsWith("//")?s:"/console";a.push(n)}else if(401===l.status)k.value="Invalid credentials";else{const e=await l.json().catch(()=>({}));k.value=Us(e,l.status)}}catch{k.value="Unable to connect to server"}finally{v.value=!1}}else k.value="Enter a username and password"}return(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("section",qs,[(0,l.Lk)("div",Qs,[a[5]||(a[5]=(0,l.Lk)("span",{class:"label"},"Console Access",-1)),a[6]||(a[6]=(0,l.Lk)("h1",{class:"page-template__title login-page__title"},"Sign in",-1)),a[7]||(a[7]=(0,l.Lk)("p",{class:"page-template__copy login-page__subtitle"},"Use your console credentials to access the operator surface.",-1)),k.value?((0,l.uX)(),(0,l.CE)("div",Js,(0,n.v_)(k.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("form",{class:"form-stack login-page__form",onSubmit:(0,s.D$)(m,["prevent"])},[(0,l.Lk)("div",Bs,[a[2]||(a[2]=(0,l.Lk)("label",{for:"username",class:"form-label"},"Username",-1)),(0,l.bo)((0,l.Lk)("input",{id:"username",name:"username",ref_key:"usernameInput",ref:g,"onUpdate:modelValue":a[0]||(a[0]=e=>d.value=e),type:"text",class:"form-input",autocomplete:"username",disabled:v.value},null,8,Ms),[[s.Jo,d.value]])]),(0,l.Lk)("div",Vs,[a[3]||(a[3]=(0,l.Lk)("label",{for:"password",class:"form-label"},"Password",-1)),(0,l.bo)((0,l.Lk)("input",{id:"password",name:"password",ref_key:"passwordInput",ref:b,"onUpdate:modelValue":a[1]||(a[1]=e=>p.value=e),type:"password",class:"form-input",autocomplete:"current-password",disabled:v.value},null,8,Gs),[[s.Jo,p.value]])]),(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:v.value},(0,n.v_)(v.value?"Signing in...":"Sign In"),9,Hs)],32),(0,l.bF)(t,{to:"/",class:"link-muted login-page__back"},{default:(0,l.k6)(()=>[...a[4]||(a[4]=[(0,l.eW)("Back to overview",-1)])]),_:1})])])}}},Ys=zs,Zs=Ys;function el(){const{orchestratorBaseUrl:e,apiHeaders:a}=Ns();async function t(t,s={}){const l=await fetch(`${e.value}${t}`,{...s,headers:{...a.value,...s.headers||{}}}),n=await l.json().catch(()=>({}));return{ok:l.ok,status:l.status,data:n}}async function s(e,a={}){const s=await t(e,a);if(!s.ok)throw new Error(Us(s.data,s.status));return s.data}return{request:t,requestJson:s}}function al(e){return{...e,proposedBeads:Array.isArray(e?.proposedBeads)?e.proposedBeads:[]}}async function tl(e,{limit:a=50,cursor:t,status:s="pending_approval",jobId:l}={}){const n=new URLSearchParams({pagination:"cursor",limit:String(a)});t&&n.set("cursor",t),s&&n.set("status",s),l&&n.set("jobId",l);const o=await e(`/plans?${n}`),r=Array.isArray(o?.items)?o.items:Array.isArray(o?.plans)?o.plans:[];return{items:r.map(al),limit:"number"===typeof o?.limit&&o.limit>0?o.limit:a,hasMore:!0===o?.hasMore,nextCursor:"string"===typeof o?.nextCursor?o.nextCursor:null}}async function sl(e,{limit:a=100,maxPages:t=10,status:s="pending_approval",jobId:l}={}){const n=[];let o,r=0;while(r<t){r+=1;const t=await tl(e,{limit:a,cursor:o,status:s,jobId:l});if(n.push(...t.items),!t.hasMore||!t.nextCursor)return n;o=t.nextCursor}throw new Error(`Plan summary pagination exceeded ${t} pages`)}async function ll(e){const a=await e("/plans/counts"),t=a?.counts||{};return{totalPlans:Number(t.totalPlans||0),pendingApprovalPlans:Number(t.pendingApprovalPlans||0),approvedPlans:Number(t.approvedPlans||0),rejectedPlans:Number(t.rejectedPlans||0),modifiedPlans:Number(t.modifiedPlans||0),autoRejectedPlans:Number(t.autoRejectedPlans||0)}}const nl={class:"console"},ol={key:1,class:"console__tab-badge"},rl={class:"console__pending-plan-live",role:"status","aria-live":"polite"},il={class:"console__content"},ul={__name:"ConsoleLayout",setup(e){const a=(0,r.lq)(),{requestJson:t}=el(),s=(0,o.KR)(null),i=(0,o.KR)(0),u=(0,o.KR)(!1);let c=null;const d=[{name:"ConsoleOverview",label:"Overview",pathPrefix:"/console"},{name:"ConsolePlans",label:"Plans",pathPrefix:"/console/plans"},{name:"ConsoleWorkspaces",label:"Workspaces",pathPrefix:"/console/workspaces"},{name:"ConsoleJobs",label:"Runs",pathPrefix:"/console/jobs"},{name:"ConsoleAnalytics",label:"Analytics",pathPrefix:"/console/analytics"},{name:"ToolsIndex",label:"Tools",pathPrefix:"/console/tools"},{name:"ConsoleSettings",label:"Settings",pathPrefix:"/console/settings"}];function p(e){return"ConsoleOverview"===e.name?"/console"===a.path||"/console/"===a.path:a.path.startsWith(e.pathPrefix)}function v(e){return"ConsolePlans"===e.name&&i.value>0?`${e.label}, ${i.value} pending approval`:null}async function k(){u.value=!0;try{const e=await ll(t);i.value=e.pendingApprovalPlans}catch{}finally{u.value=!1}}function g(){(0,l.dY)(()=>{const e=s.value?.querySelector(".console__tab--active");e&&e.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})})}return(0,l.wB)(()=>a.path,g),(0,l.sV)(()=>{g(),k(),c=setInterval(()=>{k()},3e4)}),(0,l.xo)(()=>{c&&(clearInterval(c),c=null)}),(e,a)=>{const t=(0,l.g2)("router-link"),o=(0,l.g2)("router-view");return(0,l.uX)(),(0,l.CE)("div",nl,[(0,l.Lk)("nav",{ref_key:"tabsEl",ref:s,class:"console__tabs","aria-label":"Console sections"},[((0,l.uX)(),(0,l.CE)(l.FK,null,(0,l.pI)(d,e=>(0,l.bF)(t,{key:e.name,to:{name:e.name},class:(0,n.C4)(["console__tab",{"console__tab--active":p(e)}]),"aria-label":v(e)},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label)+" ",1),"ConsolePlans"===e.name?((0,l.uX)(),(0,l.CE)("span",{key:0,class:(0,n.C4)(["console__tab-live-dot",{"console__tab-live-dot--busy":u.value}]),"aria-hidden":"true"},null,2)):(0,l.Q3)("",!0),"ConsolePlans"===e.name&&i.value>0?((0,l.uX)(),(0,l.CE)("span",ol,(0,n.v_)(i.value),1)):(0,l.Q3)("",!0)]),_:2},1032,["to","class","aria-label"])),64))],512),(0,l.Lk)("div",rl,(0,n.v_)(i.value)+" "+(0,n.v_)(1===i.value?"plan":"plans")+" pending approval ",1),(0,l.Lk)("div",il,[(0,l.bF)(o)])])}}},cl=(0,Ea.A)(ul,[["__scopeId","data-v-18124b4c"]]),dl=cl,pl={key:0,class:"console-state"},vl={class:"console-page__placeholder"},kl={key:1,class:"alert alert--error"},gl={key:2,class:"console-state"},bl={class:"console-page__placeholder"},ml={__name:"ConsoleListState",props:{loading:{type:Boolean,default:!1},error:{type:String,default:""},isEmpty:{type:Boolean,default:!1},loadingMessage:{type:String,default:"Loading..."},emptyMessage:{type:String,default:"No results found."}},setup(e){return(a,t)=>e.loading?((0,l.uX)(),(0,l.CE)("div",pl,[(0,l.Lk)("p",vl,(0,n.v_)(e.loadingMessage),1)])):e.error?((0,l.uX)(),(0,l.CE)("div",kl,(0,n.v_)(e.error),1)):e.isEmpty?((0,l.uX)(),(0,l.CE)("div",gl,[(0,l.Lk)("p",bl,(0,n.v_)(e.emptyMessage),1)])):(0,l.RG)(a.$slots,"default",{key:3})}},_l=ml,hl=_l,yl={class:"console-polling-status__text"},fl={__name:"ConsolePollingStatus",props:{active:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},idleLabel:{type:String,required:!0},busyLabel:{type:String,required:!0},tone:{type:String,default:"active"}}
1,setup(e){return(a,t)=>e.active?((0,l.uX)(),(0,l.CE)("div",{key:0,class:(0,n.C4)(["console-polling-status",[`console-polling-status--${e.tone}`,{"console-polling-status--busy":e.busy}]]),role:"status","aria-live":"polite"},[t[0]||(t[0]=(0,l.Lk)("span",{class:"console-polling-status__dot"},null,-1)),(0,l.Lk)("span",yl,(0,n.v_)(e.busy?e.busyLabel:e.idleLabel),1)],2)):(0,l.Q3)("",!0)}},wl=(0,Ea.A)(fl,[["__scopeId","data-v-4469a2b9"]]),Ll=wl;function Cl(e,a){if("DONE"===e&&"FAILED"===a)return"failed";const t={PLANNING:"planning",AWAITING_INPUT:"awaiting_input",PENDING_APPROVAL:"pending_approval",APPROVED:"approved",EXECUTING:"running",DELIVERING:"delivering",WAITING_CREDENTIALS:"waiting_credentials",SYNTHESIZING:"synthesizing",DONE:"completed",ERRORED:"failed",CANCELLED:"cancelled"};return t[e]??e?.toLowerCase()??"unknown"}function El(e){const a={planning:"neutral",awaiting_input:"pending",pending_approval:"pending",approved:"approved",running:"active",delivering:"active",waiting_credentials:"pending",synthesizing:"active",completed:"ready",failed:"failed",cancelled:"neutral"};return a[e]??"neutral"}function Rl(e){return e?e.replace(/_/g," "):""}function Il(e){const a=Cl(e.phase,e.jobStatus);return{...e,jobId:e.id,status:a,statusLabel:Rl(a),tone:El(a),updatedAt:e.completedAt??e.planClaimedAt??e.synthesisClaimedAt??e.createdAt}}function jl(e,a,t=88){if("string"!==typeof e||!e.trim())return a;const s=e.split("\n").map(e=>e.trim()).filter(Boolean);for(const l of s){if(!l||/^[-*_]{3,}$/.test(l))continue;const e=l.match(/^#{1,6}\s+(.+)$/);if(e)return Al(e[1],t);if(/^```/.test(l)||/^>/.test(l))continue;let a=l.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").trim();if(a){if(a.length>1.5*t){const e=a.search(/[.!?]\s/);e>0&&e<t&&(a=a.slice(0,e+1))}return Al(a,t)}}return a}function Al(e,a){if(e.length<=a)return e;const t=Math.max(1,a-3);return`${e.slice(0,t)}...`}function Wl(e){return["planning","awaiting_input","pending_approval","approved","running","delivering","waiting_credentials","synthesizing"].includes(e)}function Sl(e){return["awaiting_input","pending_approval","waiting_credentials"].includes(e)}function Xl(e,a=Date.now()){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const s=a-t.getTime(),l=Math.floor(s/6e4);if(l<1)return"just now";if(l<60)return`${l}m ago`;const n=Math.floor(l/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}async function xl(e,{recentJobLimit:a=10,analyticsLimit:t=20}={}){const s=new URLSearchParams({recentJobLimit:String(a),analyticsLimit:String(t)}),l=await e(`/overview/summary?${s}`);return{summary:l?.summary||{},recentJobs:Array.isArray(l?.recentJobs)?l.recentJobs.map(Il):[],stalePlans:Array.isArray(l?.stalePlans)?l.stalePlans:[],analytics:l?.analytics||null}}function Tl(e){return{...e,workspaceId:e.workspaceId??e.id}}async function Pl(e,{limit:a=50,cursor:t,q:s,status:l,source:n,includeArchived:o=!1}={}){const r=new URLSearchParams({pagination:"cursor",limit:String(a)});t&&r.set("cursor",t),s?.trim()&&r.set("q",s.trim()),l?r.set("status",l):r.set("includeArchived",o?"true":"false"),n&&r.set("source",n);const i=await e(`/workspaces/summary?${r}`),u=Array.isArray(i?.items)?i.items:Array.isArray(i?.workspaces)?i.workspaces:[];return{items:u.map(Tl),limit:"number"===typeof i?.limit&&i.limit>0?i.limit:a,hasMore:!0===i?.hasMore,nextCursor:"string"===typeof i?.nextCursor?i.nextCursor:null}}const $l=Object.freeze({total:0,visible:0,byStatus:Object.freeze({creating:0,ready:0,failed:0,archived:0,deleting:0}),bySource:Object.freeze({github:0,upload:0})});function Fl(e){return"number"===typeof e&&Number.isFinite(e)&&e>=0?e:0}function Kl(e){const a=e&&"object"===typeof e?e:{};return{creating:Fl(a.creating),ready:Fl(a.ready),failed:Fl(a.failed),archived:Fl(a.archived),deleting:Fl(a.deleting)}}function Ol(e){const a=e&&"object"===typeof e?e:{};return{github:Fl(a.github),upload:Fl(a.upload)}}function Dl(e){return e&&"object"===typeof e?{total:Fl(e.total),visible:Fl(e.visible),byStatus:Kl(e.byStatus),bySource:Ol(e.bySource)}:{...$l,byStatus:{...$l.byStatus},bySource:{...$l.bySource}}}
1async function Nl(e){const a=await e("/workspaces/counts");return Dl(a)}async function Ul(e,{includeArchived:a=!1,q:t}={}){const s=new URLSearchParams;a&&s.set("includeArchived","true"),t?.trim()&&s.set("q",t.trim());const l=s.toString()?`?${s}`:"",n=await e(`/workspaces/options${l}`),o=Array.isArray(n?.items)?n.items:[];return o.map(e=>({workspaceId:e.workspaceId??e.id,...e.name?{name:e.name}:{},...e.status?{status:e.status}:{}}))}async function ql(e,{limit:a=50,cursor:t,group:s,workspaceId:l}={}){const n=new URLSearchParams({pagination:"cursor",limit:String(a)});t&&n.set("cursor",t),s&&"all"!==s&&n.set("group",s),l&&n.set("workspaceId",l);const o=await e(`/jobs?${n}`),r=Array.isArray(o?.items)?o.items:Array.isArray(o?.jobs)?o.jobs:[];return{items:r.map(Il),limit:"number"===typeof o?.limit&&o.limit>0?o.limit:a,hasMore:!0===o?.hasMore,nextCursor:"string"===typeof o?.nextCursor?o.nextCursor:null}}async function Ql(e,{limit:a=200,maxPages:t=25,group:s,workspaceId:l}={}){const n=[];let o,r=0;while(r<t){r+=1;const t=await ql(e,{limit:a,cursor:o,group:s,workspaceId:l});if(n.push(...t.items),!t.hasMore||!t.nextCursor)return n;o=t.nextCursor}throw new Error(`Run summary pagination exceeded ${t} pages`)}const Jl={class:"console-page"},Bl={class:"console-page__header"},Ml={class:"console-page__actions"},Vl=["disabled"],Gl={class:"console-panel"},Hl={key:0,class:"overview-alerts"},zl={key:0,class:"overview-alert-list"},Yl={class:"overview-alert__title"},Zl={class:"overview-alert__copy"},en={class:"overview-alert__action"},an={class:"console-signal-strip overview-summary-strip"},tn={class:"console-signal__label"},sn={class:"console-signal__value"},ln={class:"console-signal__note"},nn={class:"console-module",open:""},on={class:"console-module__summary"},rn={class:"console-module__count"},un={class:"overview-module__header"},cn={class:"console-metric-list"},dn={class:"console-module",open:""},pn={class:"console-module__summary"},vn={class:"console-module__count"},kn={class:"overview-module__header"},gn={key:0,class:"console-metric-list"},bn={key:1,class:"overview-empty"},mn={key:2,class:"console-stream overview-topic-stream"},_n={class:"console-stream__title"},hn={class:"console-stream__meta"},yn={class:"console-stream__aside"},fn={class:"console-module",open:""},wn={class:"console-module__summary"},Ln={class:"console-module__count"},Cn={class:"overview-module__header"},En={key:0,class:"console-stream"},Rn={class:"console-stream__title"},In={class:"console-stream__meta"},jn={key:0},An={class:"console-stream__aside"},Wn={class:"console-stream__meta overview-stream__time"},Sn={key:1,class:"overview-empty"},Xn={class:"console-module",open:""},xn={class:"console-module__summary"},Tn={class:"console-module__count"},Pn={class:"overview-module__header"},$n={key:0,class:"console-stream"},Fn={class:"console-stream__title"},Kn={class:"console-stream__meta"},On={key:0},Dn={class:"console-stream__aside"},Nn={class:"console-badge console-badge--neutral"},Un={class:"console-stream__meta overview-stream__time"},qn={key:1,class:"overview-empty"},Qn=15e3,Jn={__name:"ConsoleOverview",setup(e){const{requestJson:a}=el(),t=k().child("[ConsoleOverview]"),s=(0,o.KR)(!0),r=(0,o.KR)(""),i=(0,o.KR)([]),u=(0,o.KR)({workspaceCount:0,activeJobs:0,pendingPlans:0,runningBeads:0,failedJobs:0,workspaces:{total:0,visible:0,byStatus:{creating:0,ready:0,failed:0,archived:0,deleting:0},bySource:{github:0,upload:0}}}),c=(0,o.KR)([]),d=(0,o.KR)([]),p=(0,o.KR)(null),v=(0,o.KR)([]),g=(0,o.KR)([]),b=(0,o.KR)([]),m=(0,o.KR)(!1);let _=null;const h=(0,l.EW)(()=>{const e=new Map;for(const a of b.value)e.set(a.workspaceId,a.name||a.workspaceId);for(const a of g.value)e.set(a.workspaceId,a.name||a.workspaceId);return e}),y=(0,l.EW)(()=>d.value.filter(e=>Sl(e.status)).length),f=(0,l.EW)(()=>{const e=d.value.filter(e=>"awaiting_input"===e.status).length,a=d.value.filter(e=>"pending_approval"===e.status).length,t=d.value.filter(e=>"waiting_credentials"===e.status).length,s=d.value.filter(e=>"approved"===e.status).length;return[{label:"Awaiting input",value:e},{label:"Pending approval",value:a},{label:"Waiting credentials",value:t},{label:"Approved to run",value:s}]}),w=(0,l.EW)(()=>p.value?[{label:"Runs with analytics",value:p.value.scope.jobs_with_analytics},{label:"Runs with gaps",value:p.value.guidance_gaps.jobs_with_gaps},{label:"Mismatch hotspots",value:p.value.mismatch_hotspots.total_mismatches},{label:"Runtime-evidenced runs",value:p.value.evidence_coverage.jobs_with_runtime_evidence}]:[]),L=(0,l.EW)(()=>p.value?.guidance_gaps?.recurring_topics?.slice(0,3)??[]),C=(0,l.EW)(()=>{const e=p.value?.guidance_gaps?.jobs_with_gaps??0,a=p.value?.scope?.jobs_with_analytics??0;return[{label:"Workspaces",value:u.value.workspaceCount,copy:`${u.value.workspaces.byStatus.failed} failed - ${u.value.workspaces.bySource.github} on GitHub`,link:{name:"ConsoleWorkspaces"},tone:u.value.workspaces.byStatus.failed>0?"attention":"ready"},{label:"Active Runs",value:u.value.activeJobs,copy:`${u.value.runningBeads} running step${1===u.value.runningBeads?"":"s"} in flight`,link:{name:"ConsoleJobs"},tone:u.value.activeJobs>0?"active":"pending"},{label:"Pending Plans",value:u.value.pendingPlans,copy:"Operator decisions queued for review",link:{name:"ConsolePlans"},tone:u.value.pendingPlans>0?"attention":"ready"},{label:"Failed Runs",value:u.value.failedJobs,copy:"Recent failures requiring follow-up",link:{name:"ConsoleJobs",query:{status:"failed"}},tone:u.value.failedJobs>0?"failed":"ready"},{label:"Runs With Gaps",value:e,copy:"Recent analytics reporting guidance gaps",link:{name:"ConsoleAnalytics"},tone:e>0?"attention":"ready"},{label:"Runs With Analytics",value:a,copy:"Recent runs carrying stored analytics summaries",link:{name:"ConsoleAnalytics"},tone:"active"}]}),E=(0,l.EW)(()=>{const e=[];return y.value>0&&e.push({id:"operator-queue",tone:"warning",title:`${y.value} run${1===y.value?" needs":"s need"} operator attention`,copy:"There are runs waiting on input, approval, or updated credentials.",action:"Review runs",link:{name:"ConsoleJobs",query:{status:"attention"}}}),u.value.failedJobs>0&&e.push({id:"failed-runs",tone:"error",title:`${u.value.failedJobs} failed run${1===u.value.failedJobs?"":"s"} in the current window`,copy:"Review the most recent failed executions and open the records that need attention.",action:"Inspect failures",link:{name:"ConsoleJobs",query:{status:"failed"}}}),v.value.length>0&&e.push({id:"stale-plans",tone:"warning",title:`${v.value.length} plan${1===v.value.length?" has":"s have"} been pending for more than 12 hours`,copy:"These plans have sat in the queue long enough to merit operator review.",action:"Open plans",link:{name:"ConsolePlans"}}),(p.value?.guidance_gaps?.jobs_with_gaps??0)>0&&e.push({id:"guidance-gaps",tone:"neutral",title:`${p.value.guidance_gaps.jobs_with_gaps} recent run${1===p.value.guidance_gaps.jobs_with_gaps?"":"s"} reported guidance gaps`,copy:"Use analytics to see recurring topics and where evidence or standards supp
1ort is weak.",action:"Open analytics",link:{name:"ConsoleAnalytics"}}),e});function R(e){const a=e.workspaceId??e.id,t="public-github"===e.type||"private-github"===e.type||"github"===e.source;return{...e,workspaceId:a,sourceLabel:t?"GitHub":"Upload"}}function I(e){return Rl(e)}function j(e){return e?h.value.get(e)||e:"No workspace"}async function A(){const e=await xl(a,{recentJobLimit:10,analyticsLimit:20});u.value={workspaceCount:Number(e.summary?.workspaceCount||0),activeJobs:Number(e.summary?.activeJobs||0),pendingPlans:Number(e.summary?.pendingPlans||0),runningBeads:Number(e.summary?.runningBeads||0),failedJobs:Number(e.summary?.failedJobs||0),workspaces:W(e.summary?.workspaces)},c.value=e.recentJobs,v.value=e.stalePlans,p.value=e.analytics}function W(e){const a=e&&"object"===typeof e?e:{},t=a.byStatus&&"object"===typeof a.byStatus?a.byStatus:{},s=a.bySource&&"object"===typeof a.bySource?a.bySource:{},l=e=>"number"===typeof e&&Number.isFinite(e)&&e>=0?e:0;return{total:l(a.total),visible:l(a.visible),byStatus:{creating:l(t.creating),ready:l(t.ready),failed:l(t.failed),archived:l(t.archived),deleting:l(t.deleting)},bySource:{github:l(s.github),upload:l(s.upload)}}}async function S(){const e=await Pl(a,{limit:6,includeArchived:!0});g.value=e.items.map(R)}async function X(){b.value=await Ul(a,{includeArchived:!0})}async function x(){d.value=await Ql(a,{group:"active"})}async function T({showLoading:e=!1,background:a=!1}={}){e&&(s.value=!0),a&&(m.value=!0),r.value="",i.value=[];const[l,n,o,k]=await Promise.allSettled([A(),S(),X(),x()]);"rejected"===l.status&&(a||(u.value={workspaceCount:0,activeJobs:0,pendingPlans:0,runningBeads:0,failedJobs:0,workspaces:{total:0,visible:0,byStatus:{creating:0,ready:0,failed:0,archived:0,deleting:0},bySource:{github:0,upload:0}}},c.value=[],v.value=[],p.value=null),i.value.push("Overview summary could not be loaded."),t.warn("Failed to fetch overview summary",l.reason)),"rejected"===n.status&&(a||(g.value=[]),i.value.push("Recent workspace summaries could not be loaded for the overview."),t.warn("Failed to fetch workspace summaries for overview",n.reason)),"rejected"===o.status&&(a||(b.value=[]),i.value.push("Workspace labels could not be loaded for overview run links."),t.warn("Failed to fetch workspace options for overview",o.reason)),"rejected"===k.status&&(a||(d.value=[]),i.value.push("Operator queue detail could not be loaded for the overview."),t.warn("Failed to fetch active run summaries for overview",k.reason)),a||"rejected"!==l.status||"rejected"!==n.status||"rejected"!==o.status||"rejected"!==k.status||(r.value="Failed to load overview."),s.value=!1,m.value=!1}function P(){_&&clearInterval(_),_=setInterval(()=>{T({background:!0})},Qn)}return(0,l.sV)(()=>{T({showLoading:!0}),P()}),(0,l.hi)(()=>{_&&(clearInterval(_),_=null)}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",Jl,[(0,l.Lk)("div",Bl,[(0,l.Lk)("div",null,[a[1]||(a[1]=(0,l.Lk)("h1",{class:"console-page__title"},"Overview",-1)),a[2]||(a[2]=(0,l.Lk)("p",{class:"console-page__placeholder"}," See the current operating picture across workspaces, runs, and recent learning signals. ",-1)),(0,l.bF)(Ll,{active:"",busy:m.value,"idle-label":"Auto-refresh every 15s","busy-label":"Refreshing overview...",tone:"active"},null,8,["busy"])]),(0,l.Lk)("div",Ml,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:s.value,onClick:a[0]||(a[0]=e=>T({showLoading:!0}))}," Refresh ",8,Vl),(0,l.bF)(t,{to:{name:"ConsoleJobCreate"},class:"button button--primary"},{default:(0,l.k6)(()=>[...a[3]||(a[3]=[(0,l.eW)(" Submit Request ",-1)])]),_:1})])]),(0,l.Lk)("section",Gl,[i.value.length?((0,l.uX)(),(0,l.CE)("div",Hl,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(i.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e,class:"alert alert--error"},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0),(0,l.bF)(hl,{loading:s.value,error:r.value,"is-empty":!1},{default:(0,l.k6)(()=>[E.value.length?((0,l.uX)(),(0,l.CE)("div",zl,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(E.value,e=>((0,l.uX)(),(0,l.Wv)(t,{key:e.id,to:e.link,class:(0,n.C4)(["overview-alert",`overview-alert--${e.tone}`])},{default:(0,l.k6)(()=>
1[(0,l.Lk)("div",null,[(0,l.Lk)("h2",Yl,(0,n.v_)(e.title),1),(0,l.Lk)("p",Zl,(0,n.v_)(e.copy),1)]),(0,l.Lk)("span",en,(0,n.v_)(e.action),1)]),_:2},1032,["to","class"]))),128))])):(0,l.Q3)("",!0),(0,l.Lk)("div",an,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(C.value,e=>((0,l.uX)(),(0,l.Wv)(t,{key:e.label,to:e.link,class:(0,n.C4)(["console-signal",e.tone?`console-signal--${e.tone}`:""])},{default:(0,l.k6)(()=>[(0,l.Lk)("span",tn,(0,n.v_)(e.label),1),(0,l.Lk)("span",sn,(0,n.v_)(e.value),1),(0,l.Lk)("span",ln,(0,n.v_)(e.copy),1)]),_:2},1032,["to","class"]))),128))]),(0,l.Lk)("details",nn,[(0,l.Lk)("summary",on,[a[4]||(a[4]=(0,l.eW)(" Operator Queue ",-1)),(0,l.Lk)("span",rn,(0,n.v_)(y.value),1)]),(0,l.Lk)("div",un,[a[6]||(a[6]=(0,l.Lk)("p",{class:"overview-module__copy"},"Runs currently waiting for operator action or progress decisions.",-1)),(0,l.bF)(t,{to:{name:"ConsoleJobs"},class:"link-muted"},{default:(0,l.k6)(()=>[...a[5]||(a[5]=[(0,l.eW)("Open runs",-1)])]),_:1})]),(0,l.Lk)("dl",cn,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(f.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",dn,[(0,l.Lk)("summary",pn,[a[7]||(a[7]=(0,l.eW)(" Learning Signals ",-1)),(0,l.Lk)("span",vn,(0,n.v_)(L.value.length),1)]),(0,l.Lk)("div",kn,[a[9]||(a[9]=(0,l.Lk)("p",{class:"overview-module__copy"},"Recent analytics signals for gaps, evidence, and mismatch risk.",-1)),(0,l.bF)(t,{to:{name:"ConsoleAnalytics"},class:"link-muted"},{default:(0,l.k6)(()=>[...a[8]||(a[8]=[(0,l.eW)("Open analytics",-1)])]),_:1})]),w.value.length?((0,l.uX)(),(0,l.CE)("dl",gn,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(w.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])):((0,l.uX)(),(0,l.CE)("p",bn,"Analytics data is not available yet.")),L.value.length?((0,l.uX)(),(0,l.CE)("div",mn,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(L.value,e=>((0,l.uX)(),(0,l.CE)("article",{key:e.topic,class:"console-stream__item"},[(0,l.Lk)("div",null,[(0,l.Lk)("h3",_n,(0,n.v_)(e.topic),1),(0,l.Lk)("p",hn,"Seen in "+(0,n.v_)(e.count)+" "+(0,n.v_)(1===e.count?"run":"runs"),1)]),(0,l.Lk)("div",yn,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.gap_types,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"console-badge console-badge--neutral"},(0,n.v_)(I(e)),1))),128))])]))),128))])):(0,l.Q3)("",!0)]),(0,l.Lk)("details",fn,[(0,l.Lk)("summary",wn,[a[10]||(a[10]=(0,l.eW)(" Recent Runs ",-1)),(0,l.Lk)("span",Ln,(0,n.v_)(c.value.length),1)]),(0,l.Lk)("div",Cn,[a[12]||(a[12]=(0,l.Lk)("p",{class:"overview-module__copy"},"Latest completed or failed run activity from the overview summary feed.",-1)),(0,l.bF)(t,{to:{name:"ConsoleJobs"},class:"link-muted"},{default:(0,l.k6)(()=>[...a[11]||(a[11]=[(0,l.eW)("Open runs",-1)])]),_:1})]),c.value.length?((0,l.uX)(),(0,l.CE)("div",En,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(c.value,e=>((0,l.uX)(),(0,l.Wv)(t,{key:e.jobId,to:{name:"ConsoleJobDetail",params:{id:e.jobId}},class:(0,n.C4)(["console-stream__item overview-stream__item",`overview-stream__item--${e.tone}`])},{default:(0,l.k6)(()=>[(0,l.Lk)("div",null,[(0,l.Lk)("h3",Rn,(0,n.v_)((0,o.R1)(jl)(e.description,e.jobId,72)),1),(0,l.Lk)("p",In,[(0,l.eW)((0,n.v_)(j(e.workspaceId))+" ",1),e.runtime?((0,l.uX)(),(0,l.CE)("span",jn," · "+(0,n.v_)(e.runtime),1)):(0,l.Q3)("",!0)])]),(0,l.Lk)("div",An,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge",`console-badge--${e.tone}`])},(0,n.v_)(e.statusLabel),3),(0,l.Lk)("span",Wn,(0,n.v_)((0,o.R1)(Xl)(e.updatedAt)),1)])]),_:2},1032,["to","class"]))),128))])):((0,l.uX)(),(0,l.CE)("p",Sn,"No recent runs found yet."))]),(0,l.Lk)("details",Xn,[(0,l.Lk)("summary",xn,[a[13]||(a[13]=(0,l.eW)(" Recent Workspaces ",-1)),(0,l.Lk)("span",Tn,(0,n.v_)(g.value.length),1)]),(0,l.Lk)("div",Pn,[a[15]||(a[15]=(0,l.Lk)("p",{class:"overview-module__copy"},"Newest workspaces and the run load currently attached to them.",-1)),(0,l.bF)(t,{to:{name:"ConsoleWorkspaces"},class:"link-muted"},{default:(0,l.k6)(()=>[...a[14]||(a[14]=[(0,l.eW)("Open workspaces",-1)])]),_:1})]),g.value.length?((0,l.uX)(),(0,l.CE)("div",$n,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(g.value,e=>((0,l.uX)(),(0,l.Wv)(t,{key:e.workspaceId,to:{name:"ConsoleWorkspaceDetail",params:{id:e.workspaceId}},class:"console-stream__item overview-stream__item"},{default:(0,l.k6)(()=>[(0,l.Lk)("div",null,[(0,l.Lk)("h3",Fn,(0,n.v_)(e.name||e.workspaceId),1),(0,l.Lk)("p",Kn,[(0,l.eW)((0,n.v_)(e.jobSummary?.total||0)+" run"+(0,n.v_)(1===(e.jobSummary?.total||0)?"":"s")+" ",1),e.jobSummary?.failed?((0,l.uX)(),(0,l.CE)("span",On," · "+(0,n.v_)(e.jobSummary.failed)+" failed",1)):(0,l.Q3)("",!0)])]),(0,l.Lk)("div",Dn,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge",`console-badge--${e.status||"ready"}`])},(0,n.v_)(e.status||"ready"),3),(0,l.Lk)("span",Nn,(0,n.v_)(e.sourceLabel),1),(0,l.Lk)("span",Un,"Created "+(0,n.v_)((0,o.R1)(Xl)(e.createdAt)),1)])]),_:2},1032,["to"]))),128))])):((0,l.uX)(),(0,l.CE)("p",qn,"No workspaces found yet."))])]),_:1},8,["loading","error"])])])}}},Bn=(0,Ea.A)(Jn,[["__scopeId","data-v-1bd1eeb4"]]),Mn=Bn;function Vn(e){if(!e||"string"!==typeof e)return null;try{const a=e.replace(/-/g,"+").replace(/_/g,"/"),t=a+"=".repeat((4-a.length%4)%4),s=atob(t),l=s.indexOf("/");return l<=0||l===s.length-1?null:{workspaceId:s.slice(0,l),jobId:s.slice(l+1)}}catch{return null}}const Gn="beads-console-recent-rejection-reasons",Hn=8,zn=["Stale — no longer relevant","Duplicate plan","Obsolete by newer plan","Worker offline at plan time"];function Yn(){try{const e=window.localStorage.getItem(Gn);if(!e)return[];const a=JSON.parse(e);return Array.isArray(a)?a.filter(e=>"string"===typeof e&&e.trim()).slice(0,Hn):[]}catch{return[]}}function Zn(e){try{window.localStorage.setItem(Gn,JSON.stringify(e))}catch{}}function eo(){const e=(0,o.KR)(Yn());function a(a){const t="string"===typeof a?a.trim():"";if(!t)return;const s=[t,...e.value.filter(e=>e!==t)].slice(0,Hn);e.value=s,Zn(s)}return{presetReasons:zn,recentReasons:e,recordReason:a}}async function ao(e,a,{reason:t}={}){const s=Array.isArray(a)?a:[],l="string"===typeof t?t.trim():"",n=await Promise.allSettled(s.map(async a=>{if("string"!==typeof a||!a)throw new Error("Invalid plan id.");const t=await e(`/plans/${a}/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:"reject",...l?{reason:l}:{}})});if(!t?.ok)throw new Error(Us(t?.data,t?.status));return a})),o=[],r=[];
1return n.forEach((e,a)=>{const t=s[a];if("fulfilled"===e.status)o.push(e.value);else{const a="string"===typeof t?t:String(t??""),s=e.reason instanceof Error?e.reason.message:String(e.reason);r.push({planId:a,error:s||"Failed to reject plan."})}}),{succeeded:o,failed:r}}const to=864e5,so=["newest","oldest"],lo=[0,1,4,7,14,30];function no(e){const a=Date.parse(e?.jobCreatedAt??"");return Number.isNaN(a)?null:a}function oo(e,{olderThanDays:a=0,sortOrder:t="newest"}={},s=Date.now()){const l=Array.isArray(e)?e:[],n=Number(a)>0?Number(a):0,o=n>0?l.filter(e=>{const a=no(e);return null!==a&&s-a>=n*to}):[...l],r="oldest"===t?1:-1;return o.sort((e,a)=>{const t=no(e),s=no(a);return null===t&&null===s?0:null===t?1:null===s?-1:(t-s)*r})}const ro={class:"console-page"},io={class:"console-page__header"},uo={class:"console-page__actions"},co=["disabled"],po={class:"console-panel"},vo={class:"console-signal-strip plans-summary-strip"},ko={class:"console-signal__value"},go={class:"console-signal__value"},bo={class:"console-signal__value plans-summary-strip__value"},mo={class:"console-filters plans-filters"},_o={class:"console-filter"},ho=["disabled"],yo=["value"],fo={class:"console-filter"},wo=["disabled"],Lo=["value"],Co={class:"console-results plans-results"},Eo={class:"plans-select-all"},Ro=["checked","disabled"],Io={class:"console-results__count"},jo={key:0,class:"plans-bulk-bar"},Ao={class:"plans-bulk-bar__summary"},Wo={class:"console-badge console-badge--small console-badge--active"},So=["disabled"],Xo={class:"plans-bulk-bar__actions"},xo=["disabled"],To={key:1,class:"plans-bulk-reject"},Po={class:"console-filter"},$o={class:"console-filter__label"},Fo={id:"plans-bulk-reject-reasons"},Ko=["value"],Oo=["disabled"],Do={class:"plans-bulk-result__message"},No={key:0,class:"plans-bulk-result__failures"},Uo={key:3,class:"console-results__count plans-empty-filter"},qo={class:"console-stream"},Qo=["checked","aria-label","onChange"],Jo={class:"console-stream__title"},Bo={class:"console-stream__meta"},Mo={key:0},Vo={key:1},Go={class:"console-stream__aside"},Ho={class:"plans-list__mono"},zo=3e4,Yo={__name:"ConsolePlans",setup(e){const{request:a,requestJson:t}=el(),r=k().child("[ConsolePlans]"),{presetReasons:i,recentReasons:u,recordReason:c}=eo(),d=(0,o.KR)(!0),p=(0,o.KR)(""),v=(0,o.KR)([]),g=(0,o.KR)(new Map),b=(0,o.KR)(!1);let m=null;const _=(0,o.KR)(0),h=(0,o.KR)("newest"),y=lo.map(e=>({value:e,label:0===e?"Any age":`${e} day${1===e?"":"s"}`})),f=so.map(e=>({value:e,label:"oldest"===e?"Oldest first":"Newest first"})),w=(0,o.KR)(new Set),L=(0,o.KR)(!1),C=(0,o.KR)(""),E=(0,o.KR)(!1),R=(0,o.KR)(null),I=(0,l.EW)(()=>v.value.filter(e=>"pending_approval"===e.status).map(e=>{const a=Vn(e.planId)??{},t=e.jobId||a.jobId||"",s=e.workspaceId||a.workspaceId||"",l=g.value.get(t)??null,n=l?.description||`Plan ${P(t||e.planId)}`;return{...e,workspaceId:s,jobId:t,jobCreatedAt:l?.createdAt||e.createdAt||"",proposedBeadCount:e.proposedBeads?.length??0,title:jl(n,P(t||e.planId),72)}})),j=(0,l.EW)(()=>oo(I.value,{olderThanDays:_.value,sortOrder:h.value})),A=(0,l.EW)(()=>new Set(I.value.map(e=>e.jobId).filter(Boolean)).size),W=(0,l.EW)(()=>{const e=I.value.map(e=>e.jobCreatedAt).filter(Boolean).sort();return e.length?Xl(e[0]):"none"}),S=(0,l.EW)(()=>j.value.map(e=>e.planId).filter(e=>w.value.has(e))),X=(0,l.EW)(()=>S.value.length),x=(0,l.EW)(()=>j.value.length>0&&j.value.every(e=>w.value.has(e.planId))),T=(0,l.EW)(()=>{const e=u.value,a=i.filter(a=>!e.includes(a));return[...e,...a]});function P(e){return e?e.length>12?`${e.slice(0,12)}...`:e:""}function $(e){const a=new Set(w.value);a.has(e)?a.delete(e):a.add(e),w.value=a}function F(){x.value?w.value=new Set:w.value=new Set(j.value.map(e=>e.planId))}function K(){w.value=new Set,L.value=!1}function O(){L.value=!L.value,L.value&&(R.value=null)}async function D(){if(E.value)return;const e=[...S.value];if(e.length){E.value=!0,R.value=null;try{const{succeeded:t,failed:s}=await ao(a,e,{reason:C.value});t.length&&C.value.trim()&&c(C.value),0===s.length?R.value={tone:"success",message:`Rejected ${t.length} ${1===t.length?"plan":"plans"}.`,failures:[]}:0===t.length?R.value={tone:"error",message:`Failed to reject ${s.length} ${1===s.length?"plan":"plans"}.`,failures:s}:R.value={tone:"warning",message:`Rejected ${t.length} of ${e.length} plans. ${s.length} failed.`,failures:s};const l=new Set(s.map(e=>e.planId));w.value=new Set([...w.value].filter(e=>l.has(e))),0===s.length&&(L.value=!1,C.value=""),await q({background:!0})}catch(t){R.value={tone:"error",message:t.message||"Bulk reject failed.",failures:[]},r.warn("Bulk reject failed",t)}finally{E.value=!1}}}async function N(){v.value=await sl(t,{status:"pending_approval"})}async function U(e){const a=[...new Set(e.map(e=>
1e.jobId).filter(Boolean))];if(!a.length)return void(g.value=new Map);const s=await Promise.allSettled(a.map(async e=>{const a=await t(`/jobs/${e}`);return[e,a]}));g.value=new Map(s.filter(e=>"fulfilled"===e.status).map(e=>e.value));const l=s.filter(e=>"rejected"===e.status);l.length&&r.warn("Failed to fetch some run context for plans inbox",l[0].reason)}async function q({showLoading:e=!1,background:a=!1}={}){e&&(d.value=!0),a&&(b.value=!0),a||(p.value="");try{await N()}catch(t){return a||(v.value=[],p.value="Failed to load plans."),r.warn("Failed to fetch plans inbox",t),d.value=!1,void(b.value=!1)}p.value="";try{await U(v.value)}catch(s){a||(g.value=new Map),r.warn("Failed to fetch runs for plans inbox",s)}d.value=!1,b.value=!1}function Q(){m&&clearInterval(m),m=setInterval(()=>{q({background:!0})},zo)}return(0,l.wB)(j,e=>{const a=new Set(e.map(e=>e.planId)),t=new Set([...w.value].filter(e=>a.has(e)));t.size!==w.value.size&&(w.value=t),0===t.size&&(L.value=!1)}),(0,l.sV)(()=>{q({showLoading:!0}),Q()}),(0,l.hi)(()=>{m&&(clearInterval(m),m=null)}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",ro,[(0,l.Lk)("div",io,[(0,l.Lk)("div",null,[a[5]||(a[5]=(0,l.Lk)("h1",{class:"console-page__title"},"Plans",-1)),a[6]||(a[6]=(0,l.Lk)("p",{class:"console-page__placeholder"}," Review and decide queued execution plans before work starts. ",-1)),(0,l.bF)(Ll,{active:"",busy:b.value,"idle-label":"Auto-refresh every 30s","busy-label":"Refreshing plans...",tone:"active"},null,8,["busy"])]),(0,l.Lk)("div",uo,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:d.value,onClick:a[0]||(a[0]=e=>q({showLoading:!0}))}," Refresh ",8,co)])]),(0,l.Lk)("section",po,[(0,l.Lk)("div",vo,[(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",I.value.length>0?"console-signal--attention":"console-signal--ready"])},[a[7]||(a[7]=(0,l.Lk)("span",{class:"console-signal__label"},"Pending Approval",-1)),(0,l.Lk)("span",ko,(0,n.v_)(I.value.length),1),a[8]||(a[8]=(0,l.Lk)("span",{class:"console-signal__note"},"Plans waiting for an operator decision.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",A.value>0?"console-signal--active":"console-signal--pending"])},[a[9]||(a[9]=(0,l.Lk)("span",{class:"console-signal__label"},"Distinct Runs",-1)),(0,l.Lk)("span",go,(0,n.v_)(A.value),1),a[10]||(a[10]=(0,l.Lk)("span",{class:"console-signal__note"},"Runs currently represented in the inbox.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal","none"===W.value?"console-signal--ready":"console-signal--pending"])},[a[11]||(a[11]=(0,l.Lk)("span",{class:"console-signal__label"},"Oldest Plan",-1)),(0,l.Lk)("span",bo,(0,n.v_)(W.value),1),a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__note"},"Age is derived from the related run timestamp when available.",-1))],2)]),(0,l.bF)(hl,{loading:d.value,error:p.value,"is-empty":0===I.value.length,"loading-message":"Loading plans...","empty-message":"No plans are waiting for approval."},{default:(0,l.k6)(()=>[(0,l.Lk)("div",mo,[(0,l.Lk)("label",_o,[a[13]||(a[13]=(0,l.Lk)("span",{class:"console-filter__label"},"Older than",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[1]||(a[1]=e=>_.value=e),class:"form-input",disabled:E.value},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(y),e=>((0,l.uX)(),(0,l.CE)("option",{key:e.value,value:e.value},(0,n.v_)(e.label),9,yo))),128))],8,ho),[[s.u1,_.value,void 0,{number:!0}]])]),(0,l.Lk)("label",fo,[a[14]||(a[14]=(0,l.Lk)("span",{class:"console-filter__label"},"Sort",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[2]||(a[2]=e=>h.value=e),class:"form-input",disabled:E.value},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)((0,o.R1)(f),e=>((0,l.uX)(),(0,l.CE)("option",{key:e.value,value:e.value},(0,n.v_)(e.label),9,Lo))),128))],8,wo),[[s.u1,h.value]])])]),(0,l.Lk)("div",Co,[(0,l.Lk)("label",Eo,[(0,l.Lk)("input",{type:"checkbox",checked:x.value,disabled:E.value||0===j.value.length,"aria-label":"Select all visible plans",onChange:F},null,40,Ro),a[15]||(a[15]=(0,l.Lk)("span",null,"Select all",-1))]),(0,l.Lk)("p",Io,[_.value>0?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.eW)(" Showing "+(0,n.v_)(j.value.length)+" of "+(0,n.v_)(I.value.length)+" pending "+(0,n.v_)(1===I.value.length?"plan":"plans"),1)],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.eW)((0,n.v_)(I.value.length)+" pending "+(0,n.v_)(1===I.value.length?"plan":"plans"),1)],64))])]),X.value>0?((0,l.uX)(),(0,l.CE)("div",jo,[(0,l.Lk)("div",Ao,[(0,l.Lk)("span",Wo,(0,n.v_)(X.value)+" selected",1),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:E.value,onClick:K}," Clear ",8,So)]),(0,l.Lk)("div",Xo,[(0,l.Lk)("button",{type:"button",class:"button button--ghost button--danger",disabled:E.value,onClick:O},(0,n.v_)(L.value?"Cancel":`Reject ${X.value} selected`),9,xo)])])):(0,l.Q3)("",!0),L.value?((0,l.uX)(),(0,l.CE)("div",To,[(0,l.Lk)("label",Po,[(0,l.Lk)("span",$o,"Rejection Reason (applied to all "+(0,n.v_)(X.value)+")",1),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[3]||(a[3]=e=>C.value=e),type:"text",class:"form-input",list:"plans-bulk-reject-reasons",placeholder:"Why are these plans being rejected?"},null,512),[[s.Jo,C.value]]),(0,l.Lk)("datalist",Fo,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(T.value,e=>((0,l.uX)(),(0,l.CE)("option",{key:e,value:e},null,8,Ko))),128))])]),(0,l.Lk)("button",{type:"button",class:"button button--primary plans-bulk-reject__confirm",disabled:E.value||0===X.value,onClick:D},(0,n.v_)(E.value?"Rejecting...":`Confirm Reject ${X.value} ${1===X.value?"Plan":"Plans"}`),9,Oo)])):(0,l.Q3)("",!0),R.value?((0,l.uX)(),(0,l.CE)("div",{key:2,class:(0,n.C4)(["alert plans-bulk-result",`alert--${R.value.tone}`])},[(0,l.Lk)("p",Do,(0,n.v_)(R.value.message),1),R.value.failures.length?((0,l.uX)(),(0,l.CE)("ul",No,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(R.value.failures,e=>((0,l.uX)(),(0,l.CE)("li",{key:e.planId},(0,n.v_)(P(e.planId))+": "+(0,n.v_)(e.error),1))),128))])):(0,l.Q3)("",!0)],2)):(0,l.Q3)("",!0),0===j.value.length?((0,l.uX)(),(0,l.CE)("p",Uo," No plans are older than the selected age filter. ")):(0,l.Q3)("",!0),(0,l.Lk)("div",qo,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(j.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.planId,class:(0,n.C4)(["console-stream__item plans-list__row",{"plans-list__row--selected":w.value.has(e.planId)}])},[(0,l.Lk)("label",{class:"plans-list__select",onClick:a[4]||(a[4]=(0,s.D$)(()=>{},["stop"]))},[(0,l.Lk)("input",{type:"checkbox",checked:w.value.has(e.planId),"aria-label":`Select plan ${e.title}`,onChange:a=>$(e.planId)},null,40,Qo)]),(0,l.bF)(t,{to:{name:"ConsolePlanDetail",params:{id:e.planId}},class:"plans-list__link"},{default:(0,l.k6)(()=>
1[(0,l.Lk)("div",null,[(0,l.Lk)("h2",Jo,(0,n.v_)(e.title),1),(0,l.Lk)("p",Bo,[(0,l.eW)((0,n.v_)(e.proposedBeadCount)+" proposed "+(0,n.v_)(1===e.proposedBeadCount?"step":"steps")+" ",1),e.workspaceId?((0,l.uX)(),(0,l.CE)("span",Mo," / workspace "+(0,n.v_)(e.workspaceId),1)):(0,l.Q3)("",!0),e.jobCreatedAt?((0,l.uX)(),(0,l.CE)("span",Vo," / "+(0,n.v_)((0,o.R1)(Xl)(e.jobCreatedAt)),1)):(0,l.Q3)("",!0)])]),(0,l.Lk)("div",Go,[a[16]||(a[16]=(0,l.Lk)("span",{class:"console-badge console-badge--small console-badge--pending"}," pending approval ",-1)),(0,l.Lk)("span",Ho,(0,n.v_)(P(e.jobId)),1)])]),_:2},1032,["to"])],2))),128))])]),_:1},8,["loading","error","is-empty"])])])}}},Zo=(0,Ea.A)(Yo,[["__scopeId","data-v-0c60cc5a"]]),er=Zo;var ar=t(23),tr=t(418);ar.xI.setOptions({gfm:!0,breaks:!0});const sr="(?:UNTRUSTED_USER_TEXT|OPERATOR_PROVIDED_TEXT|PRIOR_BEAD_OUTPUT)",lr=`(?:<<<|«««[<\\uFF1C\\uFE64\\u200B\\u200C\\u200D\\u2060\\uFEFF]*)${sr}_(?:START|END)>>>`,nr=new RegExp(lr,"g"),or=new RegExp(`^[^\\S\\r\\n]*${lr}[^\\S\\r\\n]*(?:\\r?\\n|$)`,"gm");function rr(e){return e.replace(or,"").replace(nr,"")}function ir(e){if(!e||"string"!==typeof e)return"";let a=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n");a=rr(a);const t=a.includes("\n"),s=!t&&a.length>200&&(/\d+\.\s+[A-Z]/.test(a)||/\s-\s+[A-Z]/.test(a));s&&(a=a.replace(/(^|[.!?])\s*(Steps|Context|Constraints|Changes|Notes|Summary|Description|Requirements|Acceptance|Modified|New file):\s*/gi,"$1\n\n**$2:**\n").replace(/([.!?:,])\s+(\d+)\.\s+/g,"$1\n$2. ").replace(/([.!?:])\s+-\s+/g,"$1\n- ").replace(/([a-z])\s+-\s+([A-Z])/g,"$1\n- $2").replace(/\n{3,}/g,"\n\n").trim());const l=ar.xI.parse(a);return tr.A.sanitize(l)}class ur{constructor(){this.pollIntervalMs=1e3,this.defaultTimeoutMs=3e5}async wait(e){return new Promise(a=>setTimeout(a,e))}async pollTask({request:e,workspaceId:a,taskId:t,timeoutMs:s=this.defaultTimeoutMs}){const l=Date.now()+s;while(Date.now()<l){const s=await e(`/workspaces/${a}/tasks/${t}`);if(202!==s.status){if(!s.ok)throw new Error(s.data.message||s.data.error||`HTTP ${s.status}`);if("failed"===s.data.status)throw new Error(s.data.error||"Task failed");return s.data.result??s.data}await this.wait(this.pollIntervalMs)}throw new Error("Operation timed out")}async resolveTaskResponse({request:e,workspaceId:a,response:t,timeoutMs:s=this.defaultTimeoutMs}){if(202===t.status&&t.data?.taskId)return this.pollTask({request:e,workspaceId:a,taskId:t.data.taskId,timeoutMs:s});if(!t.ok)throw new Error(t.data.message||t.data.error||`HTTP ${t.status}`);return t.data}}const cr=new ur,dr={class:"console-page"},pr={class:"console-page__header"},vr={class:"console-page__placeholder"},kr={key:0,class:"plan-detail__stat"},gr={key:1,class:"plan-detail__stat"},br={class:"console-page__actions"},mr={key:0,class:"plan-detail__action-block"},_r={class:"button-row"},hr=["disabled"],yr=["disabled"],fr=["disabled"],wr={key:0,class:"plan-detail__decision-shell"},Lr={class:"console-filter"},Cr=["disabled"],Er={class:"console-module",open:""},Rr={class:"console-metric-list"},Ir={class:"console-metric"},jr={class:"plan-detail__mono"},Ar={class:"console-metric"},Wr={class:"console-metric"},Sr={class:"console-metric"},Xr={class:"console-module",open:""},xr={class:"console-module__summary"},Tr={class:"console-module__count"},Pr={class:"plan-detail__bead-list"},$r={class:"plan-detail__bead-header"},Fr={class:"plan-detail__bead-index"},Kr={key:0,class:"plan-detail__bead-deps"},Or={class:"console-filter"},Dr=["onUpdate:modelValue"],Nr={class:"console-filter"},Ur=["onUpdate:modelValue"],qr={class:"button-row plan-detail__bead-actions"},Qr=["disabled","onClick"],Jr=["disabled","onClick"],Br=["onClick"],Mr=["innerHTML"],Vr={key:0,class:"plan-detail__acceptance"},Gr=["innerHTML"],Hr={key:0,class:"button-row"},zr=["disabled"],Yr={key:1,class:"alert alert--error"},Zr={__name:"ConsolePlanDetail",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{request:i,requestJson:u}=el(),c=k().child("[ConsolePlanDetail]"),d=a.params.id,p=Vn(d)??{},v=p.workspaceId||"",g=p.jobId||"",b=(0,o.KR)(!0),m=(0,o.KR)(""),_=(0,o.KR)(!1),h=(0,o.KR)(""),y=(0,o.KR)(""),f=(0,o.KR)({status:"pending_approval",proposedBeads:[]}),w=(0,o.KR)(""),L=(0,o.KR)(!1),C=(0,o.KR)(""),E=(0,o.KR)(!1),R=(0,o.KR)([]),I=(0,l.EW)(()=>{const e=f.value.status;return"approved"===e?"console-badge console-badge--ready":"rejected"===e||"auto_rejected"===e?"console-badge console-badge--failed":"modified"===e?"console-badge console-badge--active":"console-badge console-badge--pending"}),j=(0,l.EW)(()=>R.value.some(e=>e.prompt.trim()));function A(e){return String(e||"").replace(/_/g," ").trim()}function W(e){return(Array.isArray(e)?e:[]).map(e=>({prompt:"string"===typeof e.prompt?e.prompt:"",acceptanceCriteria:"string"===typeof e.acceptanceCriteria?e.acceptanceCriteria:"",dependsOn:Array.isArray(e.dependsOn)?[...e.dependsOn]:[],dependsOnLabel:Array.isArray(e.dependsOn)&&e.dependsOn.length?e.dependsOn.map(e=>`#${e}`).join(", "):""}))}async function S(){const e=await u(`/plans/${d}`);f.value={...e,proposedBeads:Array.isArray(e.proposedBeads)?e.proposedBeads:[]},R.value=W(f.value.proposedBeads)}async function X(){if(g)try{const e=await u(`/jobs/${g}`);w.value=e.description||""}catch(e){w.value="",c.warn("Failed to fetch run context for plan detail",e)}}async function x({showLoading:e=!1}={}){e&&(b.value=!0),m.value="",h.value="";try{await Promise.all([S(),X()])}catch(a){m.value="Failed to load plan.",c.warn("Failed to fetch plan detail",a)}finally{b.value=!1}}function T(){E.value=!E.value,L.value=!1,E.value||(R.value=W(f.value.proposedBeads))}function P(e,a){const t=e+a,s=[...R.value],l=s[e];s[e]=s[t],s[t]=l,R.value=s}function $(e){R.value=R.value.filter((a,t)=>t!==e)}function F(){R.value=[...R.value,{prompt:"",acceptanceCriteria:"",dependsOn:[],dependsOnLabel:""}]}async function K(){if(v){_.value=!0,y.value="approve",h.value="";
1try{const e=await i(`/plans/${d}/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:"approve"})});if(409===e.status&&e.data?.stale)return void await t.push({name:"ConsoleWorkspaceDetail",params:{id:e.data.workspaceId||v},query:{reason:"stale-approval",source:"plan",jobId:g}});const a=await cr.resolveTaskResponse({request:i,workspaceId:v,response:e});if(a?.stale&&(a.workspaceId||v))return void await t.push({name:"ConsoleWorkspaceDetail",params:{id:a.workspaceId||v},query:{reason:"stale-approval",source:"plan",jobId:g}});await t.push({name:"ConsoleJobDetail",params:{id:g}})}catch(e){h.value=e.message||"Failed to approve plan.",c.warn("Failed to approve plan",e)}finally{_.value=!1,y.value=""}}}async function O(){_.value=!0,y.value="reject",h.value="";try{await u(`/plans/${d}/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:"reject",...C.value.trim()?{reason:C.value.trim()}:{}})}),await t.push({name:"ConsolePlans"})}catch(e){h.value=e.message||"Failed to reject plan.",c.warn("Failed to reject plan",e)}finally{_.value=!1,y.value=""}}async function D(){_.value=!0,y.value="modify",h.value="";try{const e=R.value.filter(e=>e.prompt.trim()).map(e=>({prompt:e.prompt.trim(),...e.acceptanceCriteria.trim()?{acceptanceCriteria:e.acceptanceCriteria.trim()}:{}}));await u(`/plans/${d}/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:"modify",modifiedBeads:e})}),await t.push({name:"ConsolePlans"})}catch(e){h.value=e.message||"Failed to submit modified plan.",c.warn("Failed to modify plan",e)}finally{_.value=!1,y.value=""}}return(0,l.sV)(()=>{x({showLoading:!0})}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",dr,[(0,l.Lk)("div",pr,[(0,l.Lk)("div",null,[a[2]||(a[2]=(0,l.Lk)("h1",{class:"console-page__title"},"Plan",-1)),(0,l.Lk)("p",vr,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",I.value])},(0,n.v_)(f.value.status||"unknown"),3),(0,o.R1)(v)?((0,l.uX)(),(0,l.CE)("span",kr,"workspace "+(0,n.v_)((0,o.R1)(v)),1)):(0,l.Q3)("",!0),w.value?((0,l.uX)(),(0,l.CE)("span",gr,(0,n.v_)((0,o.R1)(jl)(w.value,(0,o.R1)(g),56)),1)):(0,l.Q3)("",!0)])]),(0,l.Lk)("div",br,[(0,l.bF)(t,{to:{name:"ConsolePlans"},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[3]||(a[3]=[(0,l.eW)(" Back to Plans ",-1)])]),_:1}),(0,o.R1)(g)?((0,l.uX)(),(0,l.Wv)(t,{key:0,to:{name:"ConsoleJobDetail",params:{id:(0,o.R1)(g)}},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[4]||(a[4]=[(0,l.eW)(" Run ",-1)])]),_:1},8,["to"])):(0,l.Q3)("",!0)])]),(0,l.Lk)("section",{class:(0,n.C4)(["console-panel",I.value.replace("console-badge","console-panel")])},[(0,l.bF)(hl,{loading:b.value,error:m.value,"is-empty":!1,"loading-message":"Loading plan..."},{default:(0,l.k6)(()=>["pending_approval"===f.value.status?((0,l.uX)(),(0,l.CE)("div",mr,[a[6]||(a[6]=(0,l.Lk)("p",null,[(0,l.Lk)("strong",null,"Decision required."),(0,l.eW)(" Review the proposed steps and choose approve, reject, or modify.")],-1)),(0,l.Lk)("div",_r,[(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:_.value,onClick:K},(0,n.v_)(_.value&&"approve"===y.value?"Approving...":"Approve"),9,hr),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:_.value,onClick:a[0]||(a[0]=e=>L.value=!L.value)}," Reject ",8,yr),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:_.value,onClick:T},(0,n.v_)(E.value?"Cancel Modify":"Modify"),9,fr)]),L.value?((0,l.uX)(),(0,l.CE)("div",wr,[(0,l.Lk)("label",Lr,[a[5]||(a[5]=(0,l.Lk)("span",{class:"console-filter__label"},"Rejection Reason",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a[1]||(a[1]=e=>C.value=e),class:"form-input plan-detail__textarea",rows:"4",placeholder:"Why should this plan be rejected?"},null,512),[[s.Jo,C.value]])]),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:_.value,onClick:O},(0,n.v_)(_.value&&"reject"===y.value?"Rejecting...":"Confirm Reject"),9,Cr)])):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0),(0,l.Lk)("details",Er,[a[11]||(a[11]=(0,l.Lk)("summary",{class:"console-module__summary"},"Context",-1)),(0,l.Lk)("dl",Rr,[(0,l.Lk)("div",Ir,[a[7]||(a[7]=(0,l.Lk)("dt",null,"Plan ID",-1)),(0,l.Lk)("dd",jr,(0,n.v_)((0,o.R1)(d)),1)]),(0,l.Lk)("div",Ar,[a[8]||(a[8]=(0,l.Lk)("dt",null,"Workspace",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(v)||"Unknown"),1)]),(0,l.Lk)("div",Wr,[a[9]||(a[9]=(0,l.Lk)("dt",null,"Run",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(g)||"Unknown"),1)]),(0,l.Lk)("div",Sr,[a[10]||(a[10]=(0,l.Lk)("dt",null,"Status",-1)),(0,l.Lk)("dd",null,(0,n.v_)(A(f.value.status||"unknown")),1)])])]),(0,l.Lk)("details",Xr,[(0,l.Lk)("summary",xr,[a[12]||(a[12]=(0,l.eW)(" Proposed Steps ",-1)),(0,l.Lk)("span",Tr,(0,n.v_)(R.value.length),1)]),(0,l.Lk)("div",Pr,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(R.value,(e,t)=>((0,l.uX)(),(0,l.CE)("article",{key:`bead-${t}`,class:"plan-detail__bead"},[(0,l.Lk)("div",$r,[(0,l.Lk)("span",Fr,"#"+(0,n.v_)(t),1),e.dependsOnLabel?((0,l.uX)(),(0,l.CE)("span",Kr,"depends on "+(0,n.v_)(e.dependsOnLabel),1)):(0,l.Q3)("",!0)]),E.value?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.Lk)("label",Or,[a[13]||(a[13]=(0,l.Lk)("span",{class:"console-filter__label"},"Prompt",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a=>e.prompt=a,class:"form-input plan-detail__textarea",rows:"4"},null,8,Dr),[[s.Jo,e.prompt]])]),(0,l.Lk)("label",Nr,[a[14]||(a[14]=(0,l.Lk)("span",{class:"console-filter__label"},"Acceptance Criteria",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a=>e.acceptanceCriteria=a,class:"form-input plan-detail__textarea",rows:"3",placeholder:"Optional"},null,8,Ur),[[s.Jo,e.acceptanceCriteria]])]),(0,l.Lk)("div",qr,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:0===t,onClick:e=>P(t,-1)},"Move Up",8,Qr),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:t===R.value.length-1,onClick:e=>P(t,1)},"Move Down",8,Jr),(0,l.Lk)("button",{type:"button",class:"button button--ghost plan-detail__danger",onClick:e=>$(t)},"Remove",8,Br)])],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.Lk)("div",{class:"plan-detail__prose",innerHTML:(0,o.R1)(ir)(e.prompt)},null,8,Mr),e.acceptanceCriteria?((0,l.uX)(),(0,l.CE)("div",Vr,[a[15]||(a[15]=(0,l.Lk)("div",{class:"plan-detail__acceptance-label"},"Acceptance Criteria",-1)),(0,l.Lk)("div",{class:"plan-detail__prose",innerHTML:(0,o.R1)(ir)(e.acceptanceCriteria)},null,8,Gr)])):(0,l.Q3)("",!0)],64))]))),128))]),E.value?((0,l.uX)(),(0,l.CE)("div",Hr,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",onClick:F},"Add Step"),(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:_.value||!j.value,onClick:D},(0,n.v_)(_.value&&"modify"===y.value?"Submitting...":"Submit Modified Plan"),9,zr)])):(0,l.Q3)("",!0)]),h.value?((0,l.uX)(),(0,l.CE)("div",Yr,(0,n.v_)(h.value),1)):(0,l.Q3)("",!0)]),_:1},8,["loading","error"])],2)])}}},ei=(0,Ea.A)(Zr,[["__scopeId","data-v-0d09d5d9"]]),ai=ei,ti={class:"console-page"},si={class:"console-page__header"},li={class:"console-page__actions"},ni=["disabled"],oi={class:"console-panel"},ri={class:"console-filters"},ii={class:"console-filter"},ui={class:"console-filter"}
1,ci={class:"console-filter"},di={class:"console-signal-strip workspace-summary-strip"},pi={class:"console-signal console-signal--ready"},vi={class:"console-signal__value"},ki={class:"console-signal__note"},gi={class:"console-signal__value"},bi={class:"console-signal__value"},mi={class:"console-signal__value"},_i={class:"console-list workspace-list"},hi=["onClick"],yi={class:"console-card__header workspace-card__header"},fi={class:"workspace-card__title"},wi={key:0,class:"workspace-card__id"},Li={class:"console-card__meta workspace-card__meta"},Ci={key:0,class:"console-badge workspace-badge console-badge--neutral"},Ei={key:0,class:"workspace-card__description"},Ri={key:1,class:"workspace-card__repo"},Ii={key:0},ji={class:"console-card__footer workspace-card__footer"},Ai={class:"workspace-card__summary"},Wi={key:0},Si={key:0,class:"workspace-card__date"},Xi={key:0,class:"console-pagination console-pagination--cursor"},xi=["disabled"],Ti={class:"console-pagination__label"},Pi=["disabled"],$i=3e3,Fi=5,Ki={__name:"ConsoleWorkspaces",setup(e){const a=(0,r.rd)(),{requestJson:t}=el(),i=k().child("[ConsoleWorkspaces]"),u=new Set(["ready","failed","archived"]),c=(0,o.KR)(!0),d=(0,o.KR)(""),p=(0,o.KR)([]),v=(0,o.KR)(""),g=(0,o.KR)(""),b=(0,o.KR)(""),m=(0,o.KR)(1),_=(0,o.KR)(12),h=(0,o.KR)([void 0]),y=(0,o.KR)(!1),f=(0,o.KR)(!1);let w=null,L=null,C=0;const E=(0,l.EW)(()=>m.value>1),R=(0,l.EW)(()=>f.value||P()),I=(0,o.KR)(Dl(void 0)),j=((0,l.EW)(()=>I.value.total),(0,l.EW)(()=>I.value.visible)),A=(0,l.EW)(()=>I.value.byStatus.ready+I.value.byStatus.creating),W=(0,l.EW)(()=>I.value.byStatus.failed),S=(0,l.EW)(()=>I.value.bySource.github),X=(0,l.EW)(()=>v.value||g.value||b.value?"No workspaces match the current filters.":"No workspaces found.");function x(e){const a=e.workspaceId??e.id,t="public-github"===e.type||"private-github"===e.type||"github"===e.source;return{...e,workspaceId:a,sourceLabel:t?"GitHub":"Upload"}}function T(e){return!u.has(e||"ready")}function P(){return p.value.some(e=>T(e.status))}function $(){null!==L&&(clearTimeout(L),L=null),C=0}function F(){null===L&&P()&&(L=setTimeout(async()=>{L=null,await K()},$i))}async function K(){f.value=!0;try{await D({background:!0}),C=0,P()?F():$()}catch(e){C+=1,i.warn("Failed to poll workspaces",e),C<Fi&&F()}finally{f.value=!1}}async function O({background:e=!1}={}){try{I.value=await Nl(t)}catch(a){e||i.warn("Failed to fetch workspace counts",a)}}async function D({showLoading:e=!1,background:a=!1}={}){e&&(c.value=!0),a||($(),d.value="");try{const[e]=await Promise.all([Pl(t,{limit:_.value,cursor:h.value[m.value-1],q:v.value,status:g.value,source:b.value,includeArchived:!1}),O({background:a})]);p.value=e.items.map(x),_.value=e.limit,y.value=e.hasMore,e.hasMore&&e.nextCursor?h.value[m.value]=e.nextCursor:h.value=h.value.slice(0,m.value),P()?F():$()}catch(s){if(a)throw s;p.value=[],y.value=!1,d.value="Failed to load workspaces.",i.warn("Failed to fetch workspaces",s)}finally{a||(c.value=!1)}}function N(){m.value=1,h.value=[void 0],y.value=!1}function U(){E.value&&(m.value-=1,D({showLoading:!0}))}function q(){y.value&&(m.value+=1,D({showLoading:!0}))}function Q(e){a.push({name:"ConsoleWorkspaceDetail",params:{id:e}})}return(0,l.wB)([v,g,b],()=>{N(),clearTimeout(w),w=setTimeout(()=>{D({showLoading:!0})},250)}),(0,l.sV)(()=>{D({showLoading:!0})}),(0,l.hi)(()=>{clearTimeout(w),$()}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",ti,[(0,l.Lk)("div",si,[(0,l.Lk)("div",null,[a[4]||(a[4]=(0,l.Lk)("h1",{class:"console-page__title"},"Workspaces",-1)),a[5]||(a[5]=(0,l.Lk)("p",{class:"console-page__placeholder"}," Browse repository workspaces, filter by source and status, and open a workspace record. ",-1)),(0,l.bF)(Ll,{active:R.value,busy:f.value,"idle-label":"Watching workspace status every 3s","busy-label":"Refreshing workspace status...",tone:"pending"},null,8,["active","busy"])]),(0,l.Lk)("div",li,[(0,l.bF)(t,{to:{name:"ConsoleWorkspaceCreate"},class:"button button--primary"},{default:(0,l.k6)(()=>[...a[6]||(a[6]=[(0,l.eW)(" Create Workspace ",-1)])]),_:1}),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:c.value,onClick:a[0]||(a[0]=e=>D({showLoading:!0}))}," Refresh ",8,ni)])]),(0,l.Lk)("section",oi,[(0,l.Lk)("div",ri,[(0,l.Lk)("label",ii,[a[7]||(a[7]=(0,l.Lk)("span",{class:"console-filter__label"},"Search",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[1]||(a[1]=e=>v.value=e),type:"text",class:"form-input",placeholder:"Name or description"},null,512),[[s.Jo,v.value]])]),(0,l.Lk)("label",ui,[a[9]||(a[9]=(0,l.Lk)("span",{class:"console-filter__label"},"Status",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[2]||(a[2]=e=>g.value=e),class:"form-input"},[...a[8]||(a[8]=[(0,l.Fv)('<option value="" data-v-9c08fbe6>Active</option><option value="ready" data-v-9c08fbe6>Ready</option><option value="assembling" data-v-9c08fbe6>Assembling</option><option value="pending" data-v-9c08fbe6>Pending</option><option value="failed" data-v-9c08fbe6>Failed</option><option value="archived" data-v-9c08fbe6>Archived</option>',6)])],512),[[s.u1,g.value]])]),(0,l.Lk)("label",ci,[a[11]||(a[11]=(0,l.Lk)("span",{class:"console-filter__label"},"Source",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[3]||(a[3]=e=>b.value=e),class:"form-input"},[...a[10]||(a[10]=[(0,l.Lk)("option",{value:""},"All",-1),(0,l.Lk)("option",{value:"github"},"GitHub",-1),(0,l.Lk)("option",{value:"upload"},"Upload",-1)])],512),[[s.u1,b.value]])])]),(0,l.bF)(hl,{loading:c.value,error:d.value,"is-empty":0===p.value.length,"loading-message":"Loading workspaces...","empty-message":X.value},{default:(0,l.k6)(()=>[(0,l.Lk)("div",di,[(0,l.Lk)("div",pi,[a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__label"},"Total Workspaces",-1)),(0,l.Lk)("span",vi,(0,n.v_)(j.value),1),(0,l.Lk)("span",ki," Visible across the fleet. Showing "+(0,n.v_)(p.value.length)+" on this page. ",1)]),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",A.value>0?"console-signal--active":"console-signal--pending"])},[a[13]||(a[13]=(0,l.Lk)("span",{class:"console-signal__label"},"Active",-1)),(0,l.Lk)("span",gi,(0,n.v_)(A.value),1),a[14]||(a[14]=(0,l.Lk)("span",{class:"console-signal__note"},"Ready or creating across the fleet.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",W.value>0?"console-signal--failed":"console-signal--ready"])},[a[15]||(a[15]=(0,l.Lk)("span",{class:"console-signal__label"},"Failed",-1)),(0,l.Lk)("span",bi,(0,n.v_)(W.value),1),a[16]||(a[16]=(0,l.Lk)("span",{class:"console-signal__note"},"Workspaces needing operator attention across the fleet.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",S.value>0?"console-signal--active":"console-signal--pending"])},[a[17]||(a[17]=(0,l.Lk)("span",{class:"console-signal__label"},"GitHub Sources",-1)),(0,l.Lk)("span",mi,(0,n.v_)(S.value),1),a[18]||(a[18]=(0,l.Lk)("span",{class:"console-signal__note"},"Visible workspaces backed by GitHub across the fleet.",-1))],2)]),(0,l.Lk)("div",_i,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(p.value,e=>((0,l.uX)(),(0,l.CE)("button",{key:e.workspaceId,type:"button",class:"console-card 
1workspace-card",onClick:a=>Q(e.workspaceId)},[(0,l.Lk)("div",yi,[(0,l.Lk)("div",null,[(0,l.Lk)("h2",fi,(0,n.v_)(e.name||e.workspaceId),1),e.name?((0,l.uX)(),(0,l.CE)("p",wi,(0,n.v_)(e.workspaceId),1)):(0,l.Q3)("",!0)]),(0,l.Lk)("div",Li,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge workspace-badge",`console-badge--${e.status||"ready"}`])},(0,n.v_)(e.status||"ready"),3),e.sourceLabel?((0,l.uX)(),(0,l.CE)("span",Ci,(0,n.v_)(e.sourceLabel),1)):(0,l.Q3)("",!0)])]),e.description?((0,l.uX)(),(0,l.CE)("p",Ei,(0,n.v_)(e.description),1)):(0,l.Q3)("",!0),e.repoUrl?((0,l.uX)(),(0,l.CE)("p",Ri,[(0,l.eW)((0,n.v_)(e.repoUrl),1),e.branch?((0,l.uX)(),(0,l.CE)("span",Ii," @ "+(0,n.v_)(e.branch),1)):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0),(0,l.Lk)("div",ji,[(0,l.Lk)("span",Ai,[(0,l.eW)((0,n.v_)(e.jobSummary?.total||0)+" runs ",1),e.jobSummary?.failed?((0,l.uX)(),(0,l.CE)("span",Wi," - "+(0,n.v_)(e.jobSummary.failed)+" failed",1)):(0,l.Q3)("",!0)]),e.createdAt?((0,l.uX)(),(0,l.CE)("span",Si,[e.lastSyncedAt?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.eW)(" Created "+(0,n.v_)((0,o.R1)(Xl)(e.createdAt))+" / Synced "+(0,n.v_)((0,o.R1)(Xl)(e.lastSyncedAt)),1)],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.eW)(" Created "+(0,n.v_)((0,o.R1)(Xl)(e.createdAt)),1)],64))])):(0,l.Q3)("",!0)])],8,hi))),128))]),E.value||y.value?((0,l.uX)(),(0,l.CE)("div",Xi,[(0,l.Lk)("button",{class:"button button--ghost",disabled:!E.value,onClick:U}," Previous ",8,xi),(0,l.Lk)("span",Ti,"Page "+(0,n.v_)(m.value),1),(0,l.Lk)("button",{class:"button button--ghost",disabled:!y.value,onClick:q}," Next ",8,Pi)])):(0,l.Q3)("",!0)]),_:1},8,["loading","error","is-empty","empty-message"])])])}}},Oi=(0,Ea.A)(Ki,[["__scopeId","data-v-9c08fbe6"]]),Di=Oi;function Ni(){const{orchestratorBaseUrl:e,apiHeaders:a}=Ns();async function t(t,s={}){const l=await fetch(`${e.value}${t}`,{...s,headers:{...a.value,...s.headers||{}}}),n=await l.json().catch(()=>({}));if(!l.ok)throw new Error(Us(n,l.status));return n}async function s(e,a){const t=await fetch(e,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:a});if(!t.ok)throw new Error(`Upload to S3 failed: HTTP ${t.status}`)}async function l(e){return t("/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"github",type:"private"===e.visibility?"private-github":"public-github",repoUrl:e.repoUrl,name:e.name,...e.description?{description:e.description}:{},...e.branch?{branch:e.branch}:{},..."private"===e.visibility&&e.githubToken?{credentials:{github_token:e.githubToken}}:{}})})}
1async function n(e){const a=await t("/workspaces/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,archiveFilename:e.file.name,archiveSize:e.file.size,...e.description?{description:e.description}:{}})});if(!a?.upload?.url)throw new Error("Server response missing upload URL");await s(a.upload.url,e.file);const l=await t(`/workspaces/${a.id}/assemble`,{method:"POST",headers:{"Content-Type":"application/json"}});return{...a,status:l.status??"creating",...l.taskId?{taskId:l.taskId}:{}}}return{createGithubWorkspace:l,createUploadWorkspace:n}}const Ui={class:"console-page"},qi={class:"console-page__header"},Qi={class:"console-page__actions"},Ji={class:"console-panel"},Bi={class:"console-signal-strip workspace-create__summary-strip"},Mi={class:"console-signal__value workspace-create__signal-value"},Vi={class:"console-signal__note"},Gi={class:"console-signal__value workspace-create__signal-value"},Hi={class:"console-signal__note"},zi={id:"workspace-create-workspace-section",class:"console-module",open:""},Yi={class:"workspace-create__stack"},Zi={class:"console-filter"},eu={class:"console-filter"},au={class:"workspace-create__stack"},tu={class:"workspace-create__mode-toggle",role:"radiogroup","aria-label":"Workspace source"},su={class:"workspace-create__mode-option"},lu={class:"workspace-create__mode-option"},nu={class:"console-filter"},ou={key:0,class:"workspace-create__error"},ru={class:"console-filter"},iu={key:1,class:"workspace-create__error"},uu={class:"workspace-create__mode-toggle",role:"radiogroup","aria-label":"Repository visibility"},cu={class:"workspace-create__mode-option"},du={class:"workspace-create__mode-option"},pu={key:2,class:"console-filter"},vu={class:"console-filter"},ku={key:0,class:"workspace-create__hint"},gu={class:"workspace-create__mono"},bu={class:"console-metric-list"},mu={class:"console-metric"},_u={class:"console-metric"},hu={key:0,class:"alert alert--error"},yu={key:1,class:"workspace-create__message"},fu={class:"button-row"},wu=["disabled"],Lu={__name:"ConsoleWorkspaceCreate",setup(e){const a=(0,r.rd)(),{createGithubWorkspace:t,createUploadWorkspace:i}=Ni(),u=k().child("[ConsoleWorkspaceCreate]"),c=(0,o.KR)(""),d=(0,o.KR)(""),p=(0,o.KR)("github"),v=(0,o.KR)(""),g=(0,o.KR)(""),b=(0,o.KR)("public"),m=(0,o.KR)(""),_=(0,o.KR)(null),h=(0,o.KR)(!1),y=(0,o.KR)(""),f=(0,o.KR)(""),w=(0,o.KR)(null),L=(0,o.KR)(null),C=(0,o.KR)(null),E=(0,o.KR)(null),R=(0,o.KR)(null),I=(0,o.KR)(null),j=(0,o.KR)(null),A=/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+(\.git)?$/,W=/^git@github\.com:[\w.-]+\/[\w.-]+(\.git)?$/,S=(0,l.EW)(()=>"github"===p.value?"GitHub":"Archive Upload"),X=(0,l.EW)(()=>"github"===p.value?"Clone a repository and create a managed workspace branch.":"Upload an archive for S3-backed workspace assembly."),x=(0,l.EW)(()=>"upload"===p.value?"Archive":"private"===b.value?"Private":"Public"),T=(0,l.EW)(()=>"upload"===p.value?"Archive uploads bypass repository credential setup.":"private"===b.value?"Private repositories require a GitHub token.":"Public repositories do not require stored credentials."),P=(0,l.
1EW)(()=>"upload"===p.value?"upload":"private"===b.value?"private-github":"public-github"),$=(0,l.EW)(()=>_.value?.name||""),F=(0,l.EW)(()=>{if("github"!==p.value)return"";const e=v.value.trim();return e?A.test(e)||W.test(e)?"":"Expected https://github.com/owner/repo or [email protected]:owner/repo.":""}),K=(0,l.EW)(()=>"github"!==p.value?"":v.value.trim()?g.value.trim()?"":"Branch is required. Enter the branch to clone, for example main.":""),O=(0,l.EW)(()=>!h.value&&(!!c.value.trim()&&("github"===p.value?!!v.value.trim()&&(!F.value&&(!K.value&&!("private"===b.value&&!m.value.trim()))):Boolean(_.value))));function D(e){const a=e.target.files?.[0];_.value=a||null}function N(e,a){e.value?.setAttribute("open",""),e.value?.scrollIntoView?.({block:"start",behavior:"smooth"}),a?.value?.focus?.()}function U(){N(w,"github"===p.value?C:j)}function q(){"upload"!==p.value?"private"!==b.value?N(w,E):N(w,I.value?I:R):N(w,j)}function Q(){N(L,null)}async function J(){if(O.value){h.value=!0,y.value="",f.value="";try{const e="github"===p.value?await t({repoUrl:v.value.trim(),branch:g.value.trim(),visibility:b.value,githubToken:m.value.trim(),name:c.value.trim(),description:d.value.trim()}):await i({name:c.value.trim(),description:d.value.trim(),file:_.value}),s=e.workspaceId??e.id;f.value="Workspace created. Opening detail view...",await a.push({name:"ConsoleWorkspaceDetail",params:{id:s}})}catch(e){y.value=e.message||"Failed to create workspace.",u.warn("Failed to create workspace",e)}finally{h.value=!1}}}return(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",Ui,[(0,l.Lk)("div",qi,[a[10]||(a[10]=(0,l.Lk)("div",null,[(0,l.Lk)("h1",{class:"console-page__title"},"Create Workspace"),(0,l.Lk)("p",{class:"console-page__placeholder"}," Provision a repository workspace for console operations using GitHub or an uploaded archive. ")],-1)),(0,l.Lk)("div",Qi,[(0,l.bF)(t,{to:{name:"ConsoleWorkspaces"},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[9]||(a[9]=[(0,l.eW)(" Back to Workspaces ",-1)])]),_:1})])]),(0,l.Lk)("section",Ji,[(0,l.Lk)("div",Bi,[(0,l.Lk)("button",{type:"button",class:(0,n.C4)(["console-signal console-signal--button","github"===p.value?"console-signal--active":"console-signal--pending"]),"aria-controls":"workspace-create-source-section",onClick:U},[a[11]||(a[11]=(0,l.Lk)("span",{class:"console-signal__label"},"Source",-1)),(0,l.Lk)("span",Mi,(0,n.v_)(S.value),1),(0,l.Lk)("span",Vi,(0,n.v_)(X.value),1)],2),(0,l.Lk)("button",{type:"button",class:(0,n.C4)(["console-signal console-signal--button","github"===p.value&&"private"===b.value?"console-signal--attention":"console-signal--ready"]),"aria-controls":"workspace-create-source-section",onClick:q},[a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__label"},"Access",-1)),(0,l.Lk)("span",Gi,(0,n.v_)(x.value),1),(0,l.Lk)("span",Hi,(0,n.v_)(T.value),1)],2),(0,l.Lk)("button",{type:"button",class:"console-signal console-signal--button console-signal--pending","aria-controls":"workspace-create-contract-section",onClick:Q},[...a[13]||(a[13]=[(0,l.Lk)("span",{class:"console-signal__label"},"Assembly",-1),(0,l.Lk)("span",{class:"console-signal__value workspace-create__signal-value"},"Async",-1),(0,l.Lk)("span",{class:"console-signal__note"},"After create, the console opens workspace detail while assembly continues in the background.",-1)])])]),(0,l.Lk)("details",zi,[a[16]||(a[16]=(0,l.Lk)("summary",{class:"console-module__summary"},"Workspace",-1)),(0,l.Lk)("div",Yi,[(0,l.Lk)("label",Zi,[a[14]||(a[14]=(0,l.Lk)("span",{class:"console-filter__label"},"Name",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[0]||(a[0]=e=>c.value=e),type:"text",class:"form-input",placeholder:"e.g. 86proof-site"},null,512),[[s.Jo,c.value]])]),(0,l.Lk)("label",eu,[a[15]||(a[15]=(0,l.Lk)("span",{class:"console-filter__label"},"Description",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a[1]||(a[1]=e=>d.value=e),class:"form-input workspace-create__textarea workspace-create__textarea--short",rows:"3",placeholder:"Optional operator-facing description of the workspace."},null,512),[[s.Jo,d.value]])])])]),(0,l.Lk)("details",{id:"workspace-create-source-section",ref_key:"sourceSection",ref:w,class:"console-module",open:""},[a[28]||(a[28]=(0,l.Lk)("summary",{class:"console-module__summary"},"Source",-1)),(0,l.Lk)("div",au,[(0,l.Lk)("div",tu,[(0,l.Lk)("label",su,[(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[2]||(a[2]=e=>p.value=e),type:"radio",value:"github"},null,512),[[s.XL,p.value]]),a[17]||(a[17]=(0,l.Lk)("span",null,"GitHub Repository",-1))]),(0,l.Lk)("label",lu,[(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[3]||(a[3]=e=>p.value=e),type:"radio",value:"upload"},null,512),[[s.XL,p.value]]),a[18]||(a[18]=(0,l.Lk)("span",null,"S3 Archive Upload",-1))])]),"github"===p.value?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.Lk)("label",nu,[a[19]||(a[19]=(0,l.Lk)("span",{class:"console-filter__label"},"Repository URL",-1)),(0,l.bo)((0,l.Lk)("input",{ref_key:"repoUrlInput",ref:C,"onUpdate:modelValue":a[4]||(a[4]=e=>v.value=e),type:"text",class:"form-input workspace-create__mono",placeholder:"https://github.com/owner/repo"},null,512),[[s.Jo,v.value]])]),F.value?((0,l.uX)(),(0,l.CE)("p",ou,(0,n.v_)(F.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("label",ru,[a[20]||(a[20]=(0,l.Lk)("span",{class:"console-filter__label"},"Branch",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[5]||(a[5]=e=>g.value=e),type:"text",class:"form-input",placeholder:"main"},null,512),[[s.Jo,g.value]])]),K.value?((0,l.uX)(),(0,l.CE)("p",iu,(0,n.v_)(K.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",uu,[(0,l.Lk)("label",cu,[(0,l.bo)((0,l.Lk)("input",{ref_key:"publicVisibilityInput",ref:E,"onUpdate:modelValue":a[6]||(a[6]=e=>b.value=e),type:"radio",value:"public"},null,512),[[s.XL,b.value]]),a[21]||(a[21]=(0,l.Lk)("span",null,"Public",-1))]),(0,l.Lk)("label",du,[(0,l.bo)((0,l.Lk)("input",{ref_key:"privateVisibilityInput",ref:R,"onUpdate:modelValue":a[7]||(a[7]=e=>b.value=e),type:"radio",value:"private"},null,512),[[s.XL,b.value]]),a[22]||(a[22]=(0,l.Lk)("span",null,"Private (PAT)",-1))])]),a[24]||(a[24]=(0,l.Lk)("p",{class:"workspace-create__hint"}," Public repositories clone without stored credentials. Private repositories require a GitHub personal access token for assembly. ",-1)),"private"===b.value?((0,l.uX)(),(0,l.CE)("label",pu,[a[23]||(a[23]=(0,l.Lk)("span",{class:"console-filter__label"},"GitHub Token",-1)),(0,l.bo)((0,l.Lk)("input",{ref_key:"githubTokenInput",ref:I,"onUpdate:modelValue":a[8]||(a[8]=e=>m.value=e),type:"password",class:"form-input workspace-create__mono",placeholder:"ghp_..."},null,512),[[s.Jo,m.value]])])):(0,l.Q3)("",!0)],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.Lk)("label",vu,[a[25]||(a[25]=(0,l.Lk)("span",{class:"console-filter__label"},"Archive File",-1)),(0,l.Lk)("input",{ref_key:"archiveInput",ref:j,t
1ype:"file",class:"form-input workspace-create__file-input",accept:".zip,.tar.gz,.tgz",onChange:D},null,544)]),a[27]||(a[27]=(0,l.Lk)("p",{class:"workspace-create__hint"}," Upload a `.zip`, `.tar.gz`, or `.tgz` archive. The console assumes the backend exposes the archive upload endpoint for workspace assembly. ",-1)),$.value?((0,l.uX)(),(0,l.CE)("p",ku,[a[26]||(a[26]=(0,l.eW)(" Selected archive: ",-1)),(0,l.Lk)("span",gu,(0,n.v_)($.value),1)])):(0,l.Q3)("",!0)],64))])],512),(0,l.Lk)("details",{id:"workspace-create-contract-section",ref_key:"contractSection",ref:L,class:"console-module"},[a[32]||(a[32]=(0,l.Lk)("summary",{class:"console-module__summary"},"Create Contract",-1)),(0,l.Lk)("dl",bu,[(0,l.Lk)("div",mu,[a[29]||(a[29]=(0,l.Lk)("dt",null,"Source",-1)),(0,l.Lk)("dd",null,(0,n.v_)(S.value),1)]),(0,l.Lk)("div",_u,[a[30]||(a[30]=(0,l.Lk)("dt",null,"Workspace Type",-1)),(0,l.Lk)("dd",null,(0,n.v_)(P.value),1)]),a[31]||(a[31]=(0,l.Lk)("div",{class:"console-metric"},[(0,l.Lk)("dt",null,"Assembly"),(0,l.Lk)("dd",null,"Background handoff to detail page")],-1))])],512),y.value?((0,l.uX)(),(0,l.CE)("div",hu,(0,n.v_)(y.value),1)):(0,l.Q3)("",!0),f.value?((0,l.uX)(),(0,l.CE)("div",yu,(0,n.v_)(f.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",fu,[(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:!O.value,onClick:J},(0,n.v_)(h.value?"Creating...":"Create Workspace"),9,wu)])])])}}},Cu=(0,Ea.A)(Lu,[["__scopeId","data-v-abda5a66"]]),Eu=Cu,Ru={class:"console-page"},Iu={class:"console-page__header"},ju={class:"console-page__title"},Au={class:"console-page__placeholder"},Wu={key:0,class:"workspace-detail__stat"},Su={key:1,class:"workspace-detail__stat"},Xu={class:"workspace-detail__stat"},xu={class:"console-page__actions"},Tu=["disabled"],Pu={key:0,class:"workspace-detail__warnings"},$u={key:1,class:"workspace-detail__action-block"},Fu={key:0,class:"workspace-detail__action-note"},Ku={class:"workspace-detail__mono"},Ou={class:"button-row"},Du=["disabled"],Nu=["disabled"],Uu=["disabled"],qu={class:"console-module",open:""},Qu={class:"workspace-detail__overview"},Ju={class:"workspace-detail__overview-main"},Bu={key:0,class:"workspace-detail__description"},Mu={key:1,class:"workspace-detail__description workspace-detail__description--placeholder"},Vu={key:2,class:"workspace-detail__repo"},Gu=["href"],Hu={key:0},zu={class:"console-signal-strip workspace-detail__metrics-grid"},Yu={class:"console-signal console-signal--ready"},Zu={class:"console-signal__value"},ec={class:"console-signal__value"},ac={class:"console-signal__value"},tc=["open"],sc={class:"workspace-detail__admin-grid"},lc={class:"workspace-detail__admin-block"},nc={class:"workspace-detail__admin-header"},oc=["disabled"],rc={class:"button-row"},ic=["disabled"],uc=["disabled"],cc={key:1,class:"workspace-detail__admin-value"},dc={class:"workspace-detail__admin-block"},pc={class:"workspace-detail__admin-header"},vc=["disabled"],kc={class:"button-row"},gc=["disabled"],bc=["disabled"],mc={key:0,class:"workspace-detail__admin-block"},_c={class:"workspace-detail__admin-header"},hc=["disabled"],yc={class:"workspace-detail__admin-value"},fc={class:"workspace-detail__admin-field"},wc={class:"workspace-detail__admin-field"},Lc={class:"workspace-detail__admin-field"},Cc={class:"button-row"},Ec=["disabled"],Rc=["disabled"],Ic={key:1,class:"workspace-detail__admin-message"},jc={key:2,class:"workspace-detail__admin-error"},Ac={key:0,class:"workspace-detail__admin-message"},Wc={key:1,class:"workspace-detail__admin-error"},Sc=["open"],Xc={class:"console-module__summary"},xc={class:"console-module__count"},Tc={key:0,class:"console-stream workspace-detail__job-list"},Pc={class:"console-stream__title"},$c={class:"console-stream__meta"},Fc={class:"console-stream__aside"},Kc={key:1,class:"workspace-detail__empty"},Oc=["open"],Dc={class:"console-module__summary"},Nc={key:0,class:"console-module__count"},Uc={key:0},qc={key:0,class:"workspace-detail__gap-tags"},Qc={key:1,class:"workspace-detail__topic-list"},Jc={class:"workspace-detail__topic-header"},Bc={class:"workspace-detail__topic-title"},Mc={class:"workspace-detail__topic-count"},Vc={class:"workspace-detail__topic-types"},Gc={key:2,class:"workspace-detail__empty"},Hc={key:1,class:"workspace-detail__empty"},zc={key:4,class:"console-module"},Yc={class:"workspace-detail__meta-list"},Zc={class:"console-module"},ed={class:"workspace-detail__meta-list"},ad={class:"workspace-detail__mono"},td={key:0},sd={key:1},ld={class:"workspace-detail__mono"},nd={key:2},od={class:"workspace-detail__mono"}
1,rd={key:3},id={key:0,class:"workspace-detail__source-block"},ud={class:"workspace-detail__source-list"},cd={class:"workspace-detail__mono"},dd={class:"workspace-detail__actions"},pd=["disabled"],vd=["disabled"],kd=["disabled"],gd={key:1,class:"workspace-detail__delete-confirm",role:"alert"},bd={key:0,class:"workspace-detail__delete-branch-list"},md={class:"workspace-detail__mono"},_d={class:"workspace-detail__delete-source"},hd={key:1,class:"workspace-detail__empty"},yd={key:2,class:"workspace-detail__delete-warnings"},fd={key:3,class:"workspace-detail__admin-error"},wd={class:"button-row"},Ld=["disabled"],Cd=["disabled"],Ed={key:5,class:"workspace-detail__message"},Rd=3e3,Id=5,jd={__name:"ConsoleWorkspaceDetail",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{request:i,requestJson:u}=el(),c=k().child("[ConsoleWorkspaceDetail]"),d=a.params.id,p=(0,o.KR)(!0),v=(0,o.KR)(""),g=(0,o.KR)([]),b=(0,o.KR)({}),m=(0,o.KR)([]),_=(0,o.KR)(!1),h=(0,o.KR)(null),y=(0,o.KR)(!1),f=(0,o.KR)(null),w=(0,o.KR)(!1),L=(0,o.KR)(!1),C=(0,o.KR)(""),E=(0,o.KR)(!1),R=(0,o.KR)(null),I=(0,o.KR)(""),j=(0,o.KR)(!1),A=(0,o.KR)(!1),W=(0,o.KR)(""),S=(0,o.KR)(""),X=(0,o.KR)(!1),x=(0,o.KR)(""),T=(0,o.KR)(!1),P=(0,o.KR)(""),$=(0,o.KR)(!1),F=(0,o.KR)(!1),K=(0,o.KR)(""),O=(0,o.KR)(""),D=(0,o.KR)(""),N=(0,o.KR)(!1),U=(0,o.KR)(""),q=(0,o.KR)(""),Q=(0,l.EW)(()=>K.value.trim().length>0||O.value.trim().length>0||D.value.trim().length>0);let J=null,B=0;function M(e){return{...e,workspaceId:e.workspaceId??e.id}}function V(e){g.value.includes(e)||g.value.push(e)}function G(e){return"creating"===e}const H=(0,l.EW)(()=>Array.isArray(b.value.sources)?b.value.sources:[]),z=(0,l.EW)(()=>{const e=b.value.type;return"public-github"===e||"private-github"===e||H.value.some(e=>"github"===e.type)}),Y=(0,l.EW)(()=>z.value),Z=(0,l.EW)(()=>"string"===typeof a.query.reason?a.query.reason:""),ee=(0,l.EW)(()=>"string"===typeof a.query.source?a.query.source:""),ae=(0,l.EW)(()=>"string"===typeof a.query.jobId?a.query.jobId:""),te=(0,l.EW)(()=>"stale-approval"===Z.value&&Boolean(ae.value)),se=(0,l.EW)(()=>te.value&&Boolean(f.value)),le=(0,l.EW)(()=>b.value.name?.trim()||d),ne=(0,l.EW)(()=>"plan"===ee.value?"plan":"run"),oe=(0,l.EW)(()=>$.value||G(b.value.status)),re=(0,l.EW)(()=>z.value?"GitHub":b.value.type?b.value.type.replace(/[-_]/g," "):""),ie=(0,l.EW)(()=>{const e={ready:"ready",creating:"pending",archived:"neutral",failed:"failed"};return e[b.value.status]??"neutral"}),ue=(0,l.EW)(()=>m.value.filter(e=>"failed"===e.status).length),ce=(0,l.EW)(()=>m.value.filter(e=>Wl(e.status)).length),de=(0,l.EW)(()=>h.value?.guidance_gaps?.recurring_topics??[]),pe=(0,l.EW)(()=>Array.isArray(R.value?.branches)?R.value.branches:[]),ve=(0,l.EW)(()=>Array.isArray(R.value?.warnings)?R.value.warnings:[]),ke=(0,l.EW)(()=>{const e=h.value?.guidance_gaps?.by_type;return e?Object.entries(e).map(([e,a])=>({label:Rl(e),value:a})).filter(e=>e.value>0):[]});function ge(){W.value="",S.value=""}function be(){U.value="",q.value=""}function me(){E.value=!1,R.value=null,I.value="",j.value=!1}function _e(e){b.value=M(e)}function he(){null!==J&&(clearTimeout(J),J=null),B=0}function ye(){null===J&&(J=setTimeout(async()=>{J=null,await Xe()},Rd))}function fe(e){if(!e||"object"!==typeof e)return"Unknown source";if("github"===e.type){const a=e.repoUrl||e.repoName||"GitHub source";return e.branch?`${a} @ ${e.branch}`:a}return e.s3Uri||e.repoName||e.type||"Source"}async function we(e){const a=await u(`/workspaces/${d}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return _e(a),a}function Le(){ge(),x.value=b.value.name??"",X.value=!0}function Ce(){X.value=!1,x.value="",ge()}async function Ee(){if(A.value)return;const e=x.value.trim();if(e){A.value=!0,ge();try{await we({name:e}),X.value=!1,W.value="Workspace name updated."}catch(a){S.value=`Failed to update name: ${a.message}`,c.warn("Failed to update workspace name",a)}finally{A.value=!1}}else S.value="Name cannot be empty."}function Re(){ge(),P.value=b.value.description??"",T.value=!0}function Ie(){T.value=!1,P.value="",ge()}async function je(){if(A.value)return;const e=P.value.trim();A.value=!0,ge();try{await we({description:e}),T.value=!1,W.value=e?"Workspace description updated.":"Workspace description cleared."}catch(a){S.value=`Failed to update description: ${a.message}`,c.warn("Failed to update workspace description",a)}finally{A.value=!1}}function Ae(){F.value=!F.value,F.value||(K.value="",O.value="",D.value=""),be()}async function We(){if(N.value)return;const e={};if(K.value.trim()&&(e.github_token=K.value.trim()),O.value.trim()&&(e.ssh_private_key=O.value),D.value.trim()&&(e.github_oauth_token=D.value.trim()),0!==Object.keys(e).length){N.value=!0,be();try{await we({credentials:e}),K.value="",O.value="",D.value="",F.value=!1,q.value="Credentials saved. Bead-paused, delivery-paused, and synthesis-paused runs on this workspace will resume automatically.",xe()}catch(a){U.value=`Failed to update credentials: ${a.message}`,c.warn("Failed to update workspace credentials",a)}finally{N.value=!1}}else U.value="Enter at least one credential value."}async function Se(){const e=b.value.status,a=await u(`/workspaces
1/${d}`);return _e(a),{previousStatus:e,currentStatus:b.value.status}}async function Xe(){$.value=!0;try{const{previousStatus:e,currentStatus:a}=await Se();if(B=0,G(a))return void ye();he(),e!==a&&"ready"===a&&Fe()}catch(e){if(B+=1,c.warn("Failed to poll workspace status",e),B>=Id)return void V("Workspace status could not be refreshed automatically.");ye()}finally{$.value=!1}}async function xe(){_.value=!0;const e=await Ql(u,{workspaceId:d});m.value=e.sort((e,a)=>new Date(a.updatedAt).getTime()-new Date(e.updatedAt).getTime()),_.value=!1}async function Te(){y.value=!0;const e=await u(`/jobs/analytics?workspaceId=${encodeURIComponent(d)}&limit=20`);h.value=e.analytics??null,y.value=!1}async function Pe(){w.value=!0;try{const e=await u(`/workspaces/${d}/staleness?mode=cached`);f.value=e.stale?e.staleness:null,"none"!==e.cache?.source&&!1!==e.cache?.fresh||$e()}catch(e){f.value=null,V("Staleness information is not available for this workspace."),c.warn("Failed to fetch workspace staleness",e)}finally{w.value=!1}}async function $e(){try{const e=await u(`/workspaces/${d}/staleness?mode=refresh`);f.value=e.stale?e.staleness:null}catch(U){c.warn("Failed to refresh workspace staleness",U)}}async function Fe(){_.value=!0,y.value=!0,w.value=!0,g.value=[];const[e,a]=await Promise.allSettled([xe(),Te()]);"rejected"===e.status&&(m.value=[],_.value=!1,V("Runs for this workspace could not be loaded."),c.warn("Failed to fetch workspace runs",e.reason)),"rejected"===a.status&&(h.value=null,y.value=!1,V("Analytics for this workspace could not be loaded."),c.warn("Failed to fetch workspace analytics",a.reason)),await Pe()}async function Ke({showLoading:e=!1}={}){he(),e&&(p.value=!0),v.value="",g.value=[],C.value="",me(),m.value=[],h.value=null,f.value=null;try{const{currentStatus:e}=await Se();p.value=!1,G(e)&&ye(),Fe()}catch(a){b.value={},v.value="Failed to load workspace.",c.warn("Failed to fetch workspace detail",a),p.value=!1}}async function Oe(e,a){L.value=!0,C.value="";try{await we(e),C.value=a,await Ke()}catch(t){C.value=`Action failed: ${t.message}`,c.warn("Failed to update workspace",t)}finally{L.value=!1}}async function De(e){L.value=!0,C.value="";try{const a=await i(`/workspaces/${d}/staleness/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:e,...ae.value?{jobId:ae.value}:{}})}),s=await cr.resolveTaskResponse({request:i,workspaceId:d,response:a});if("new-workspace"===e&&s.newWorkspaceId)return void t.push({name:"ConsoleWorkspaceDetail",params:{id:s.newWorkspaceId}});if(s?.approvalResult&&ae.value)return C.value=s.message||"Plan approved.",void await t.push({name:"ConsoleJobDetail",params:{id:ae.value}});C.value=s.message||("sync"===e?"Workspace sync requested.":"Fresh workspace creation requested."),await Ke()}catch(a){C.value=`Action failed: ${a.message}`,c.warn("Failed to submit staleness decision",a)}finally{L.value=!1}}async function Ne(){L.value=!0,C.value="",I.value="",j.value=!1;try{R.value=await u(`/workspaces/${d}/delete-impact`),E.value=!0}catch(e){I.value=`Delete review failed: ${e.message}`,C.value=I.value,c.warn("Failed to load workspace delete impact",e)}finally{L.value=!1}}function Ue(){me(),C.value=""}async function qe(){L.value=!0,C.value="",I.value="";try{const e=await i(`/workspaces/${d}`,{method:"DELETE"}),a=await cr.resolveTaskResponse({request:i,workspaceId:d,response:e}),s=Array.isArray(a?.branchCleanup?.warnings)?a.branchCleanup.warnings:[];if(s.length)return s.forEach(V),E.value=!1,j.value=!0,void(C.value="Workspace deleted, but remote branch cleanup reported warnings.");await t.push({name:"ConsoleWorkspaces"})}catch(e){C.value=`Delete failed: ${e.message}`,c.warn("Failed to delete workspace",e)}finally{L.value=!1}}return(0,l.sV)(()=>{"1"===a.query.refreshCredentials&&(F.value=!0),Ke({showLoading:!0})}),(0,l.hi)(()=>{he()}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",Ru,[(0,l.Lk)("div",Iu,[(0,l.Lk)("div",null,[(0,l.Lk)("h1",ju,(0,n.v_)(le.value),1),(0,l.Lk)("p",Au,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${ie.value}`])},(0,n.v_)(b.value.status||"unknown"),3),re.value?((0,l.uX)(),(0,l.CE)("span",Wu,(0,n.v_)(re.value),1)):(0,l.Q3)("",!0),b.value.hasCredentials?((0,l.uX)(),(0,l.CE)("span",Su,"Credentials attached")):(0,l.Q3)("",!0),(0,l.Lk)("span",Xu,(0,n.v_)((0,o.R1)(Xl)(b.value.createdAt)),1)]),(0,l.bF)(Ll,{active:oe.value,busy:$.value,"idle-label":"Watching workspace status every 3s","busy-label":"Refreshing workspace status...",tone:"pending"},null,8,["active","busy"])]),(0,l.Lk)("div",xu,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:p.value||L.value,onClick:a[0]||(a[0]=e=>Ke({showLoading:!0}))},"Refresh",8,Tu),(0,l.bF)(t,{to:{name:"ConsoleJobCreate",query:{workspaceId:(0,o.R1)(d)}},class:"button button--primary"},{default:(0,l.k6)(()=>[...a[13]||(a[13]=[(0,l.eW)("Submit Request",-1)])]),_:1},8,["to"])])]),(0,l.Lk)("section",{class:(0,n.C4)(["console-panel",`console-panel--${ie.value}`])},[(0,l.bF)(hl,{loading:p.value,error:v.value,"is-empty":!1,"loading-message":"Loading workspace..."},{default:(0,l.k6)(()=>[g.value.length?((0,l.uX)(),(0,l.CE)("div",Pu,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(g.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e,class:"alert alert--error"},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0),f.value?((0,l.uX)(),(0,l.CE)("div",$u,[(0,l.Lk)("p",null,[a[14]||(a[14]=(0,l.Lk)("strong",null,"Workspace is stale.",-1)),(0,l.eW)(" Behind "+(0,n.v_)(f.value.targetBranch)+" by "+(0,n.v_)(f.value.behindByCommits)+" commits.",1)]),te.value?((0,l.uX)(),(0,l.CE)("p",Fu,[(0,l.eW)(" Approval for "+(0,n.v_)(ne.value)+" run ",1),(0,l.Lk)("span",Ku,(0,n.v_)(ae.value),1),a[15]||(a[15]=(0,l.eW)(" paused because this workspace is behind its target branch. Choose how to continue. ",-1))])):(0,l.Q3)("",!0),(0,l.Lk)("div",Ou,[se.value?((0,l.uX)(),(0,l.CE)("button",{key:0,t
1ype:"button",class:"button button--ghost",disabled:L.value,onClick:a[1]||(a[1]=e=>De("continue"))},(0,n.v_)(L.value?"Working...":"Continue Anyway"),9,Du)):(0,l.Q3)("",!0),f.value.canSyncInPlace?((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:"button button--primary",disabled:L.value,onClick:a[2]||(a[2]=e=>De("sync"))},(0,n.v_)(L.value?"Working...":"Sync Workspace"),9,Nu)):(0,l.Q3)("",!0),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:L.value,onClick:a[3]||(a[3]=e=>De("new-workspace"))},(0,n.v_)(L.value?"Working...":"Create Fresh Workspace"),9,Uu)])])):(0,l.Q3)("",!0),(0,l.Lk)("details",qu,[a[22]||(a[22]=(0,l.Lk)("summary",{class:"console-module__summary"},"Overview",-1)),(0,l.Lk)("div",Qu,[(0,l.Lk)("div",Ju,[b.value.description?((0,l.uX)(),(0,l.CE)("p",Bu,(0,n.v_)(b.value.description),1)):((0,l.uX)(),(0,l.CE)("p",Mu,"No description is stored for this workspace yet.")),b.value.repoUrl?((0,l.uX)(),(0,l.CE)("p",Vu,[(0,l.Lk)("a",{href:b.value.repoUrl,target:"_blank",rel:"noopener",class:"external-link"},(0,n.v_)(b.value.repoUrl),9,Gu),b.value.branch?((0,l.uX)(),(0,l.CE)("span",Hu," @ "+(0,n.v_)(b.value.branch),1)):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0)]),(0,l.Lk)("div",zu,[(0,l.Lk)("div",Yu,[a[16]||(a[16]=(0,l.Lk)("span",{class:"console-signal__label"},"Total Runs",-1)),(0,l.Lk)("span",Zu,(0,n.v_)(m.value.length),1),a[17]||(a[17]=(0,l.Lk)("span",{class:"console-signal__note"},"Runs currently attached to this workspace.",-1))]),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",ce.value>0?"console-signal--active":"console-signal--pending"])},[a[18]||(a[18]=(0,l.Lk)("span",{class:"console-signal__label"},"Active",-1)),(0,l.Lk)("span",ec,(0,n.v_)(ce.value),1),a[19]||(a[19]=(0,l.Lk)("span",{class:"console-signal__note"},"Running or assembling work in this workspace.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",ue.value>0?"console-signal--failed":"console-signal--ready"])},[a[20]||(a[20]=(0,l.Lk)("span",{class:"console-signal__label"},"Failed",-1)),(0,l.Lk)("span",ac,(0,n.v_)(ue.value),1),a[21]||(a[21]=(0,l.Lk)("span",{class:"console-signal__note"},"Recent failures that may need follow-up.",-1))],2)])])]),(0,l.Lk)("details",{class:"console-module",open:X.value||T.value||F.value||Boolean(q.value)||Boolean(U.value)},[a[29]||(a[29]=(0,l.Lk)("summary",{class:"console-module__summary"},"Administration",-1)),(0,l.Lk)("div",sc,[(0,l.Lk)("section",lc,[(0,l.Lk)("div",nc,[a[23]||(a[23]=(0,l.Lk)("div",null,[(0,l.Lk)("h2",{class:"workspace-detail__admin-title"},"Workspace Name"),(0,l.Lk)("p",{class:"workspace-detail__admin-note"},"Operator-facing name used in lists and overview surfaces.")],-1)),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:A.value,onClick:a[4]||(a[4]=e=>X.value?Ce():Le())},(0,n.v_)(X.value?"Cancel":"Edit Name"),9,oc)]),X.value?((0,l.uX)(),(0,l.CE)("form",{key:0,class:"workspace-detail__admin-form",onSubmit:(0,s.D$)(Ee,["prevent"])},[(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[5]||(a[5]=e=>x.value=e),type:"text",class:"form-input workspace-detail__input",placeholder:"Main Workspace"},null,512),[[s.Jo,x.value]]),(0,l.Lk)("div",rc,[(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:A.value},(0,n.v_)(A.value?"Saving...":"Save Name"),9,ic),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:A.value,onClick:Ce},"Cancel",8,uc)])],32)):((0,l.uX)(),(0,l.CE)("p",cc,(0,n.v_)(le.value),1))]),(0,l.Lk)("section",dc,[(0,l.Lk)("div",pc,[a[24]||(a[24]=(0,l.Lk)("div",null,[(0,l.Lk)("h2",{class:"workspace-detail__admin-title"},"Description"),(0,l.Lk)("p",{class:"workspace-detail__admin-note"},"Short repository context for operators launching work.")],-1)),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:A.value,onClick:a[6]||(a[6]=e=>T.value?Ie():Re())},(0,n.v_)(T.value?"Cancel":"Edit Description"),9,vc)]),T.value?((0,l.uX)(),(0,l.CE)("form",{key:0,class:"workspace-detail__admin-form",onSubmit:(0,s.D$)(je,["prevent"])},[(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a[7]||(a[7]=e=>P.value=e),rows:"4",class:"form-input workspace-detail__textarea",placeholder:"Primary repository context"},null,512),[[s.Jo,P.value]]),(0,l.Lk)("div",kc,[(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:A.value},(0,n.v_)(A.value?"Saving...":"Save Description"),9,gc),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:A.value,onClick:Ie},"Cancel",8,bc)])],32)):((0,l.uX)(),(0,l.CE)("p",{key:1,class:(0,n.C4)(["workspace-detail__admin-value",{"workspace-detail__admin-value--placeholder":!b.value.description}])},(0,n.v_)(b.value.description||"No description stored."),3))]),Y.value?((0,l.uX)(),(0,l.CE)("section",mc,[(0,l.Lk)("div",_c,[a[25]||(a[25]=(0,l.Lk)("div",null,[(0,l.Lk)("h2",{class:"workspace-detail__admin-title"},"GitHub Credentials"),(0,l.Lk)("p",{class:"workspace-detail__admin-note"},"Add or update one or more credential fields. The runtime uses GitHub PAT first, then SSH key (with OAuth token as the REST API accessory). Resubmit a value (even unchanged) to retry paused jobs after granting permission server-side.")],-1)),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:N.value,onClick:Ae},(0,n.v_)(F.value?"Cancel":b.value.hasCredentials?"Update Credentials":"Add Credentials"),9,hc)]),(0,l.Lk)("p",yc,(0,n.v_)(b.value.hasCredentials?"GitHub credentials are currently attached to this workspace.":"No GitHub credentials attached. Add a PAT or SSH key so runs that depend on git authentication can succeed."),1),F.value?((0,l.uX)(),(0,l.CE)("form",{key:0,class:"workspace-detail__admin-form",onSubmit:(0,s.D$)(We,["prevent"])},[(0,l.Lk)("label",fc,[a[26]||(a[26]=(0,l.Lk)("span",{class:"workspace-detail__admin-field-label"},"GitHub Personal Access Token (PAT)",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[8]||(a[8]=e=>K.value=e),type:"password",class:"form-input workspace-detail__input workspace-detail__input--mono",placeholder:"ghp_... or github_pat_...",autocomplete:"off"},null,512),[[s.Jo,K.value]])]),(0,l.Lk)("label",wc,[a[27]||(a[27]=(0,l.Lk)("span",{class:"workspace-detail__admin-field-label"},"SSH Private Key",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a[9]||(a[9]=e=>O.value=e),rows:"3",class:"form-input workspace-detail__textarea workspace-detail__input--mono",placeholder:"-----BEGIN OPENSSH PRIVATE KEY-----",autocomplete:"off"},null,512),[[s.Jo,O.value]])]),(0,l.Lk)("label",Lc,[a[28]||(a[28]=(0,l.Lk)("span",{class:"workspace-detail__admin-field-label"},"GitHub OAuth Token (REST API for SSH workspaces)",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[10]||(a[10]=e=>D.value=e),type:"password",class:"form-input workspace-detail__input workspace-detail__input--mono",placeholder:"gho_...",autocomplete:"off"},null,512),[[s.Jo,D.value]])]),(0,l.Lk)("div",Cc,[(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:N.value||!Q.value},(0,n.v_)(N.value?"Updating...":"Update Credentials"),9,Ec),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:N.value,onClick:Ae},"Cancel",8,Rc)])],32)):(0,l.Q3)("",!0),q.value?((0,l.uX)(),(0,l.CE)("p",Ic,(0,n.v_)(q.value),1)):(0,l.Q3)("",!0),U.value?((0,l.uX)(),(0,l.CE)("p",jc,(0,n.v_)(U.value),1)):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0)]),W.value?((0,l.uX)(),(0,l.CE)("p",Ac,(0,n.v_)(W.value),1)):(0,l.Q3)("",!0),S.value?((0,l.uX)(),(0,l.CE)("p",Wc,(0,n.v_)(S.value),1)):(0,l.Q3)("",!0)],8,tc),!_.value||m.value.length?((0,l.uX)(),(0,l.CE)("details",{key:2,class:"console-module",open:m.value.length>0&&m.value.length<=5}
1,[(0,l.Lk)("summary",Xc,[a[30]||(a[30]=(0,l.eW)("Recent Runs ",-1)),(0,l.Lk)("span",xc,(0,n.v_)(m.value.length),1)]),m.value.length?((0,l.uX)(),(0,l.CE)("div",Tc,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(m.value.slice(0,10),e=>((0,l.uX)(),(0,l.Wv)(t,{key:e.jobId,to:{name:"ConsoleJobDetail",params:{id:e.jobId}},class:"console-stream__item"},{default:(0,l.k6)(()=>[(0,l.Lk)("div",null,[(0,l.Lk)("p",Pc,(0,n.v_)((0,o.R1)(jl)(e.description,e.jobId,60)),1),(0,l.Lk)("p",$c,(0,n.v_)((0,o.R1)(Xl)(e.updatedAt)),1)]),(0,l.Lk)("div",Fc,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.statusLabel),3)])]),_:2},1032,["to"]))),128))])):((0,l.uX)(),(0,l.CE)("p",Kc,"No runs for this workspace yet.")),m.value.length>10?((0,l.uX)(),(0,l.Wv)(t,{key:2,to:{name:"ConsoleJobs",query:{workspaceId:(0,o.R1)(d)}},class:"workspace-detail__view-all"},{default:(0,l.k6)(()=>[(0,l.eW)("View all "+(0,n.v_)(m.value.length)+" runs",1)]),_:1},8,["to"])):(0,l.Q3)("",!0)],8,Sc)):(0,l.Q3)("",!0),!y.value||h.value?((0,l.uX)(),(0,l.CE)("details",{key:3,class:"console-module",open:Boolean(de.value.length||ke.value.length)},[(0,l.Lk)("summary",Dc,[a[31]||(a[31]=(0,l.eW)("Guidance Gaps ",-1)),h.value?((0,l.uX)(),(0,l.CE)("span",Nc,(0,n.v_)(h.value.guidance_gaps.total_gaps)+" gaps",1)):(0,l.Q3)("",!0)]),h.value?((0,l.uX)(),(0,l.CE)("div",Uc,[ke.value.length?((0,l.uX)(),(0,l.CE)("div",qc,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(ke.value,e=>((0,l.uX)(),(0,l.CE)("span",{key:e.label,class:"console-badge console-badge--neutral"},(0,n.v_)(e.label)+": "+(0,n.v_)(e.value),1))),128))])):(0,l.Q3)("",!0),de.value.length?((0,l.uX)(),(0,l.CE)("div",Qc,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(de.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.topic,class:"workspace-detail__topic"},[(0,l.Lk)("div",Jc,[(0,l.Lk)("span",Bc,(0,n.v_)(e.topic),1),(0,l.Lk)("span",Mc,(0,n.v_)(e.count)+"x",1)]),(0,l.Lk)("div",Vc,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.gap_types,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"console-badge console-badge--small console-badge--neutral"},(0,n.v_)((0,o.R1)(Rl)(e)),1))),128))])]))),128))])):((0,l.uX)(),(0,l.CE)("p",Gc,"No recurring guidance gaps."))])):((0,l.uX)(),(0,l.CE)("p",Hc,"Analytics not available.")),(0,l.bF)(t,{to:{name:"ConsoleAnalytics",query:{workspaceId:(0,o.R1)(d)}},class:"workspace-detail__view-all"},{default:(0,l.k6)(()=>[...a[32]||(a[32]=[(0,l.eW)("Open full analytics",-1)])]),_:1},8,["to"])],8,Oc)):(0,l.Q3)("",!0),h.value?((0,l.uX)(),(0,l.CE)("details",zc,[a[37]||(a[37]=(0,l.Lk)("summary",{class:"console-module__summary"},"Analytics Scope",-1)),(0,l.Lk)("dl",Yc,[(0,l.Lk)("div",null,[a[33]||(a[33]=(0,l.Lk)("dt",null,"Runs with analytics",-1)),(0,l.Lk)("dd",null,(0,n.v_)(h.value.scope.jobs_with_analytics),1)]),(0,l.Lk)("div",null,[a[34]||(a[34]=(0,l.Lk)("dt",null,"Runs with gaps",-1)),(0,l.Lk)("dd",null,(0,n.v_)(h.value.guidance_gaps.jobs_with_gaps),1)]),(0,l.Lk)("div",null,[a[35]||(a[35]=(0,l.Lk)("dt",null,"Total mismatches",-1)),(0,l.Lk)("dd",null,(0,n.v_)(h.value.mismatch_hotspots.total_mismatches),1)]),(0,l.Lk)("div",null,[a[36]||(a[36]=(0,l.Lk)("dt",null,"Runtime-evidenced runs",-1)),(0,l.Lk)("dd",null,(0,n.v_)(h.value.evidence_coverage.jobs_with_runtime_evidence),1)])])])):(0,l.Q3)("",!0),(0,l.Lk)("details",Zc,[a[48]||(a[48]=(0,l.Lk)("summary",{class:"console-module__summary"},"Details",-1)),(0,l.Lk)("dl",ed,[(0,l.Lk)("div",null,[a[38]||(a[38]=(0,l.Lk)("dt",null,"Workspace ID",-1)),(0,l.Lk)("dd",ad,(0,n.v_)((0,o.R1)(d)),1)]),(0,l.Lk)("div",null,[a[39]||(a[39]=(0,l.Lk)("dt",null,"Status",-1)),(0,l.Lk)("dd",null,(0,n.v_)(b.value.status||"unknown"),1)]),(0,l.Lk)("div",null,[a[40]||(a[40]=(0,l.Lk)("dt",null,"Created",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(Xl)(b.value.createdAt)),1)]),b.value.lastSyncedAt?((0,l.uX)(),(0,l.CE)("div",td,[a[41]||(a[41]=(0,l.Lk)("dt",null,"Last synced",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(Xl)(b.value.lastSyncedAt)),1)])):(0,l.Q3)("",!0),b.value.repoUrl?((0,l.uX)(),(0,l.CE)("div",sd,[a[42]||(a[42]=(0,l.Lk)("dt",null,"Repository",-1)),(0,l.Lk)("dd",ld,(0,n.v_)(b.value.repoUrl),1)])):(0,l.Q3)("",!0),b.value.branch?((0,l.uX)(),(0,l.CE)("div",nd,[a[43]||(a[43]=(0,l.Lk)("dt",null,"Branch",-1)),(0,l.Lk)("dd",od,(0,n.v_)(b.value.branch),1)])):(0,l.Q3)("",!0),b.value.failureReason?((0,l.uX)(),(0,l.CE)("div",rd,[a[44]||(a[44]=(0,l.Lk)("dt",null,"Failure",-1)),(0,l.Lk)("dd",null,(0,n.v_)(b.value.failureReason),1)])):(0,l.Q3)("",!0)]),H.value.length?((0,l.uX)(),(0,l.CE)("div",id,[a[45]||(a[45]=(0,l.Lk)("p",{class:"workspace-detail__source-heading"},"Sources",-1)),(0,l.Lk)("ul",ud,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(H.value,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:`${e.type||"source"}-${a}`},[(0,l.Lk)("span",cd,(0,n.v_)(fe(e)),1)]))),128))])])):(0,l.Q3)("",!0),(0,l.Lk)("div",dd,["archived"!==b.value.status?((0,l.uX)(),(0,l.CE)("button",{key:0,t
1ype:"button",class:"button button--ghost",disabled:L.value,onClick:a[11]||(a[11]=e=>Oe({status:"archived"},"Workspace archived."))},(0,n.v_)(L.value?"Working...":"Archive"),9,pd)):((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:"button button--ghost",disabled:L.value,onClick:a[12]||(a[12]=e=>Oe({status:"ready"},"Workspace restored."))},(0,n.v_)(L.value?"Working...":"Restore"),9,vd)),(0,l.Lk)("button",{type:"button",class:"button button--ghost workspace-detail__delete",disabled:L.value,onClick:Ne},(0,n.v_)(L.value?"Working...":"Delete Workspace"),9,kd)]),E.value?((0,l.uX)(),(0,l.CE)("div",gd,[a[46]||(a[46]=(0,l.Lk)("h3",{class:"workspace-detail__delete-title"},"Confirm workspace deletion",-1)),a[47]||(a[47]=(0,l.Lk)("p",null,"Deleting this workspace permanently removes workspace metadata and deletes workspace-owned remote branches.",-1)),pe.value.length?((0,l.uX)(),(0,l.CE)("ul",bd,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(pe.value,e=>((0,l.uX)(),(0,l.CE)("li",{key:`${e.source}-${e.name}`},[(0,l.Lk)("span",md,(0,n.v_)(e.name),1),(0,l.Lk)("span",_d,(0,n.v_)("job"===e.source?"Run branch"+(e.jobId?`: ${e.jobId}`:""):"Workspace branch"),1)]))),128))])):((0,l.uX)(),(0,l.CE)("p",hd,"No workspace-owned remote branches are recorded for cleanup.")),ve.value.length?((0,l.uX)(),(0,l.CE)("div",yd,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(ve.value,e=>((0,l.uX)(),(0,l.CE)("p",{key:e},(0,n.v_)(e),1))),128))])):(0,l.Q3)("",!0),I.value?((0,l.uX)(),(0,l.CE)("p",fd,(0,n.v_)(I.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",wd,[(0,l.Lk)("button",{type:"button",class:"button button--ghost workspace-detail__delete",disabled:L.value,onClick:qe},(0,n.v_)(L.value?"Deleting...":"Confirm Delete"),9,Ld),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:L.value,onClick:Ue},"Cancel",8,Cd)])])):(0,l.Q3)("",!0)]),C.value?((0,l.uX)(),(0,l.CE)("p",Ed,(0,n.v_)(C.value),1)):(0,l.Q3)("",!0),j.value?((0,l.uX)(),(0,l.Wv)(t,{key:6,to:{name:"ConsoleWorkspaces"},class:"workspace-detail__view-all"},{default:(0,l.k6)(()=>[...a[49]||(a[49]=[(0,l.eW)("Return to Workspaces",-1)])]),_:1})):(0,l.Q3)("",!0)]),_:1},8,["loading","error"])],2)])}}},Ad=(0,Ea.A)(jd,[["__scopeId","data-v-6c566856"]]),Wd=Ad,Sd={class:"console-page"},Xd={class:"console-page__header"},xd={class:"console-page__actions"},Td=["disabled"],Pd={class:"console-panel"},$d={class:"console-filters analytics-filters"},Fd={class:"console-filter analytics-filter--wide"},Kd=["value"],Od={class:"console-filter"},Dd={key:0,class:"alert alert--error"},Nd={class:"console-results"},Ud={class:"console-results__count"},qd={key:0},Qd={class:"console-signal-strip analytics-summary-strip"},Jd={class:"console-signal console-signal--active"},Bd={class:"console-signal__value"},Md={class:"console-signal__value"},Vd={class:"console-signal__value"},Gd={class:"console-signal__value"},Hd={class:"console-module",open:""},zd={class:"console-module__summary"},Yd={class:"console-module__count"},Zd={class:"console-metric-list"},ep={class:"console-module",open:""},ap={class:"console-module__summary"},tp={class:"console-module__count"},sp={class:"console-metric-list"},lp={class:"console-module"},np={class:"console-metric-list"},op={class:"console-module"},rp={class:"console-metric-list"},ip={class:"console-module",open:""},up={class:"console-module__summary"},cp={class:"console-module__count"},dp={class:"console-metric-list"},pp={key:0,class:"analytics-gap-tags"},vp={class:"console-module"},kp={class:"console-metric-list"},gp=["open"],bp={class:"console-module__summary"},mp={class:"console-module__count"},_p={key:0,class:"console-stream"},hp={class:"console-stream__title"},yp={class:"console-stream__meta"},fp={class:"console-stream__aside"},wp={key:1,class:"console-state"},Lp={__name:"ConsoleAnalytics",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{requestJson:i}=el(),u=k().child("[ConsoleAnalytics]"),c=(0,o.KR)(!0),d=(0,o.KR)(""),p=(0,o.KR)(""),v=(0,o.KR)(null),g=(0,o.KR)([]),b=(0,o.KR)(""),m=(0,o.KR)(20),_=(0,o.KR)(!1),h=(0,l.EW)(()=>[...g.value].sort((e,a)=>e.name.localeCompare(a.name))),y=(0,l.EW)(()=>
1!v.value||0===(v.value.scope?.matching_jobs??0)),f=(0,l.EW)(()=>b.value?"No analytics are available for the selected workspace.":"No analytics are available yet."),w=(0,l.EW)(()=>v.value?.guidance_gaps?.recurring_topics??[]),L=(0,l.EW)(()=>{const e=v.value?.scope;return e?[{label:"Matching runs",value:e.matching_jobs},{label:"Runs considered",value:e.jobs_considered},{label:"Runs with analytics",value:e.jobs_with_analytics},{label:"Recent run limit",value:e.recent_job_limit}]:[]}),C=(0,l.EW)(()=>S(v.value?.outcome_counts)),E=(0,l.EW)(()=>S(v.value?.acceptance_closure_counts)),R=(0,l.EW)(()=>{const e=v.value?.evidence_coverage;return e?[{label:"Runs with planner evidence",value:e.jobs_with_planner_evidence},{label:"Runs with runtime evidence",value:e.jobs_with_runtime_evidence},{label:"Planner evidence records",value:e.planner_evidence_records},{label:"Runtime evidence records",value:e.runtime_evidence_records}]:[]}),I=(0,l.EW)(()=>{const e=v.value?.guidance_gaps;return e?[{label:"Runs with gaps",value:e.jobs_with_gaps},{label:"Total gaps",value:e.total_gaps},{label:"Recurring topics",value:w.value.length}]:[]}),j=(0,l.EW)(()=>{const e=S(v.value?.guidance_gaps?.by_type);return e.filter(e=>e.value>0)}),A=(0,l.EW)(()=>{const e=v.value?.mismatch_hotspots;return e?[{label:"Runs with mismatches",value:e.jobs_with_mismatches},{label:"Total mismatches",value:e.total_mismatches}]:[]});function W(e){const a=e.id??e.workspaceId;return{workspaceId:a,name:e.name||a}}function S(e){return e&&"object"===typeof e?Object.entries(e).map(([e,a])=>({label:X(e),value:a})):[]}function X(e){return e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function x(e){const a=g.value.find(a=>a.workspaceId===e);return a?.name||e}async function T(){const e=new URLSearchParams({limit:String(m.value)});b.value&&e.set("workspaceId",b.value);const a=await i(`/jobs/analytics?${e}`);v.value=a.analytics??null}async function P(){const e=await Ul(i,{includeArchived:!0});g.value=e.map(W)}async function $({showLoading:e=!1}={}){e&&(c.value=!0),d.value="",p.value="";const[a,t]=await Promise.allSettled([T(),P()]);"rejected"===a.status&&(v.value=null,d.value="Failed to load analytics.",u.warn("Failed to fetch analytics",a.reason)),"rejected"===t.status&&(g.value=[],p.value="Workspace names could not be loaded. Showing workspace IDs instead.",u.warn("Failed to fetch workspaces for analytics page",t.reason)),c.value=!1}async function F({showLoading:e=!1}={}){e&&(c.value=!0),d.value="";try{await T()}catch(a){v.value=null,d.value="Failed to load analytics.",u.warn("Failed to refresh analytics",a)}finally{c.value=!1}}return(0,l.wB)(()=>a.query.workspaceId,e=>{b.value="string"===typeof e?e:""},{immediate:!0}),(0,l.wB)([b,m],()=>{if(!_.value)return;const e={...a.query};b.value?e.workspaceId=b.value:delete e.workspaceId,a.query.workspaceId!==e.workspaceId&&t.replace({query:e}),F({showLoading:!0})}),(0,l.sV)(()=>{$({showLoading:!0}).finally(()=>{_.value=!0})}),(e,a)=>((0,l.uX)(),(0,l.CE)("div",Sd,[(0,l.Lk)("div",Xd,[a[3]||(a[3]=(0,l.Lk)("div",null,[(0,l.Lk)("h1",{class:"console-page__title"},"Analytics"),(0,l.Lk)("p",{class:"console-page__placeholder"}," Track recent run outcomes, guidance gaps, and evidence coverage across the console. ")],-1)),(0,l.Lk)("div",xd,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:c.value,onClick:a[0]||(a[0]=e=>$({showLoading:!0}))}," Refresh ",8,Td)])]),(0,l.Lk)("section",Pd,[(0,l.Lk)("div",$d,[(0,l.Lk)("label",Fd,[a[5]||(a[5]=(0,l.Lk)("span",{class:"console-filter__label"},"Workspace",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[1]||(a[1]=e=>b.value=e),class:"form-input"},[a[4]||(a[4]=(0,l.Lk)("option",{value:""},"All workspaces",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(h.value,e=>((0,l.uX)(),(0,l.CE)("option",{key:e.workspaceId,value:e.workspaceId},(0,n.v_)(e.name),9,Kd))),128))],512),[[s.u1,b.value]])]),(0,l.Lk)("label",Od,[a[7]||(a[7]=(0,l.Lk)("span",{class:"console-filter__label"},"Recent Runs",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[2]||(a[2]=e=>m.value=e),class:"form-input"},[...a[6]||(a[6]=[(0,l.Lk)("option",{value:20},"20",-1),(0,l.Lk)("option",{value:50},"50",-1),(0,l.Lk)("option",{value:100},"100",-1)])],512),[[s.u1,m.value,void 0,{number:!0}]])])]),p.value&&!d.value?((0,l.uX)(),(0,l.CE)("div",Dd,(0,n.v_)(p.value),1)):(0,l.Q3)("",!0),(0,l.bF)(hl,{loading:c.value,error:d.value,"is-empty":y.value,"loading-message":"Loading analytics...","empty-message":f.value},{default:(0,l.k6)(()=>[(0,l.Lk)("div",Nd,[(0,l.Lk)("p",Ud,[(0,l.eW)(" Generated "+(0,n.v_)((0,o.R1)(Xl)(v.value.generated_at))+" ",1),v.value.scope.workspace_id?((0,l.uX)(),(0,l.CE)("span",qd," for "+(0,n.v_)(x(v.value.scope.workspace_id)),1)):(0,l.Q3)("",!0)])]),(0,l.Lk)("div",Qd,[(0,l.Lk)("div",Jd,[a[8]||(a[8]=(0,l.Lk)("span",{class:"console-signal__label"},"Matching Runs",-1)),(0,l.Lk)("span",Bd,(0,n.v_)(v.value.scope.matching_jobs),1),a[9]||(a[9]=(0,l.Lk)("span",{class:"console-signal__note"},"Recent runs included in the current analytics window.",-1))]),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",v.value.scope.jobs_with_analytics>0?"console-signal--ready":"console-signal--pending"])},[a[10]||(a[10]=(0,l.Lk)("span",{class:"console-signal__label"},"Runs With Analytics",-1)),(0,l.Lk)("span",Md,(0,n.v_)(v.value.scope.jobs_with_analytics),1),a[11]||(a[11]=(0,l.Lk)("span",{class:"console-signal__note"},"Runs carrying stored analytics summaries.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",v.value.guidance_gaps.jobs_with_gaps>0?"console-signal--attention":"console-signal--ready"])},[a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__label"},"Runs With Gaps",-1)),(0,l.Lk)("span",Vd,(0,n.v_)(v.value.guidance_gaps.jobs_with_gaps),1),a[13]||(a[13]=(0,l.Lk)("span",{class:"console-signal__note"},"Recent runs that reported guidance gaps.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",v.value.mismatch_hotspots.total_mismatches>0?"console-signal--failed":"console-signal--ready"])},[a[14]||(a[14]=(0,l.Lk)("span",{class:"console-signal__label"},"Mismatches",-1)),(0,l.Lk)("span",Gd,(0,n.v_)(v.value.mismatch_hotspots.total_mismatches),1),a[15]||(a[15]=(0,l.Lk)("span",{class:"console-signal__note"},"Recorded mismatch hotspots in the current window.",-1))],2)]),(0,l.Lk)("details",Hd,[(0,l.Lk)("summary",zd,[a[16]||(a[16]=(0,l.eW)(" Scope ",-1)),(0,l.Lk)("span",Yd,(0,n.v_)(v.value.scope.recent_job_limit),1)]),(0,l.Lk)("dl",Zd,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(L.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",ep,[(0,l.Lk)("summary",ap,[a[17]||(a[17]=(0,l.eW)(" Outcomes ",-1)),(0,l.Lk)("span",tp,(0,n.v_)(v.value.scope.matching_jobs),1)]),(0,l.Lk)("dl",sp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(C.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",lp,[a[18]||(a[18]=(0,l.Lk)("summary",{class:"console-module__summary"},"Acceptance Closure",-1)),(0,l.Lk)("dl",np,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(E.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",op,[a[19]||(a[19]=(0,l.Lk)("summary",{class:"console-module__summary"},"Evidence Coverage",-1)),(0,l.Lk)("dl",rp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(R.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",ip,[(0,l.Lk)("summary",up,[a[20]||(a[20]=(0,l.eW)(" Guidance Gaps ",-1)),(0,l.Lk)("span",cp,(0,n.v_)(v.value.guidance_gaps.total_gaps),1)]),(0,l.Lk)("dl",dp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(I.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))]),j.value.length?((0,l.uX)(),(0,l.CE)("div",pp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(j.value,e=>((0,l.uX)(),(0,l.CE)("span",{key:e.label,class:"console-badge console-badge--neutral"},(0,n.v_)(e.label)+": "+(0,n.v_)(e.value),1))),128))])):(0,l.Q3)("",!0)]),(0,l.Lk)("details",vp,[a[21]||(a[21]=(0,l.Lk)("summary",{class:"console-module__summary"},"Mismatch Hotspots",-1)),(0,l.Lk)("dl",kp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(A.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.label,class:"console-metric"},[(0,l.Lk)("dt",null,(0,n.v_)(e.label),1),(0,l.Lk)("dd",null,(0,n.v_)(e.value),1)]))),128))])]),(0,l.Lk)("details",{class:"console-module",open:w.value.length>0},[(0,l.Lk)("summary",bp,[a[22]||(a[22]=(0,l.eW)(" Recurring Gap Topics ",-1)),(0,l.Lk)("span",mp,(0,n.v_)(w.value.length),1)]),w.value.length?((0,l.uX)(),(0,l.CE)("div",_p,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(w.value,e=>((0,l.uX)(),(0,l.CE)("article",{key:e.topic,class:"console-stream__item"},[(0,l.Lk)("div",null,[(0,l.Lk)("h2",hp,(0,n.v_)(e.topic),1),(0,l.Lk)("p",yp," Seen in "+(0,n.v_)(e.count)+" "+(0,n.v_)(1===e.count?"run":"runs"),1)]),(0,l.Lk)("div",fp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.gap_types,e=>((0,l.uX)(),(0,l.CE)("span",{key:e,class:"console-badge console-badge--neutral"},(0,n.v_)(X(e)),1))),128))])]))),128))])):((0,l.uX)(),(0,l.CE)("div",wp,[...a[23]||(a[23]=[(0,l.Lk)("p",{class:"console-page__placeholder"},"No recurring guidance gaps in this recent window.",-1)])]))],8,gp)]),_:1},8,["loading","error","is-empty","empty-message"])])]))}}
1,Cp=(0,Ea.A)(Lp,[["__scopeId","data-v-42ac2980"]]),Ep=Cp,Rp={class:"console-page"},Ip={class:"console-page__header"},jp={class:"console-page__placeholder"},Ap={class:"console-panel"},Wp={key:0,class:"alert alert--info"},Sp={class:"settings__field"},Xp=["disabled"],xp={class:"settings__field"},Tp=["disabled"],Pp={key:0,class:"settings__hint settings__hint--warn"},$p={class:"settings__field"},Fp=["disabled"],Kp={key:0,class:"settings__hint settings__hint--warn"},Op={key:0,class:"alert alert--error"},Dp={key:1,class:"alert alert--success"},Np={class:"settings__actions"},Up=["disabled"],qp={__name:"ConsoleSettings",setup(e){const{username:a}=C(),{request:t}=el(),r=(0,o.KR)(""),i=(0,o.KR)(""),u=(0,o.KR)(""),c=(0,o.KR)(!1),d=(0,o.KR)(""),p=(0,o.KR)(""),v=(0,l.EW)(()=>"demo"===a.value),k=(0,l.EW)(()=>r.value.length>0&&i.value.length>=8&&i.value===u.value);async function g(){if(d.value="",p.value="",i.value===u.value)if(i.value.length<8)d.value="New password must be at least 8 characters.";else{c.value=!0;try{const e=await t("/auth/change-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:r.value,newPassword:i.value})});e.ok?(p.value="Password changed successfully.",r.value="",i.value="",u.value=""):403===e.status?d.value="This account is not allowed to change its password.":404===e.status?d.value="Current password is incorrect.":d.value=e.data?.message||"Failed to change password."}catch(e){d.value="Network error. Please try again."}finally{c.value=!1}}else d.value="New passwords do not match."}return(e,t)=>((0,l.uX)(),(0,l.CE)("div",Rp,[(0,l.Lk)("div",Ip,[(0,l.Lk)("div",null,[t[4]||(t[4]=(0,l.Lk)("h1",{class:"console-page__title"},"Settings",-1)),(0,l.Lk)("p",jp,[t[3]||(t[3]=(0,l.eW)(" Account settings for ",-1)),(0,l.Lk)("strong",null,(0,n.v_)((0,o.R1)(a)),1)])])]),(0,l.Lk)("section",Ap,[t[8]||(t[8]=(0,l.Lk)("h2",{class:"settings__section-title"},"Change Password",-1)),v.value?((0,l.uX)(),(0,l.CE)("div",Wp," Password changes are not available for the demo account. ")):((0,l.uX)(),(0,l.CE)("form",{key:1,class:"settings__form",onSubmit:(0,s.D$)(g,["prevent"])},[(0,l.Lk)("label",Sp,[t[5]||(t[5]=(0,l.Lk)("span",{class:"console-filter__label"},"Current Password",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>r.value=e),type:"password",class:"form-input",autocomplete:"current-password",required:"",disabled:c.value},null,8,Xp),[[s.Jo,r.value]])]),(0,l.Lk)("label",xp,[t[6]||(t[6]=(0,l.Lk)("span",{class:"console-filter__label"},"New Password",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>i.value=e),type:"password",class:"form-input",autocomplete:"new-password",minlength:"8",required:"",disabled:c.value},null,8,Tp),[[s.Jo,i.value]]),i.value&&i.value.length<8?((0,l.uX)(),(0,l.CE)("span",Pp," Must be at least 8 characters ("+(0,n.v_)(i.value.length)+"/8) ",1)):(0,l.Q3)("",!0)]),(0,l.Lk)("label",$p,[t[7]||(t[7]=(0,l.Lk)("span",{class:"console-filter__label"},"Confirm New Password",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":t[2]||(t[2]=e=>u.value=e),type:"password",class:"form-input",autocomplete:"new-password",minlength:"8",required:"",disabled:c.value},null,8,Fp),[[s.Jo,u.value]]),u.value&&i.value!==u.value?((0,l.uX)(),(0,l.CE)("span",Kp," Passwords do not match ")):(0,l.Q3)("",!0)]),d.value?((0,l.uX)(),(0,l.CE)("div",Op,(0,n.v_)(d.value),1)):(0,l.Q3)("",!0),p.value?((0,l.uX)(),(0,l.CE)("div",Dp,(0,n.v_)(p.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",Np,[(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:c.value||!k.value},(0,n.v_)(c.value?"Changing...":"Change Password"),9,Up)])],32))])]))}},Qp=(0,Ea.A)(qp,[["__scopeId","data-v-183a389e"]]),Jp=Qp,Bp={key:0,class:"console-pagination"},Mp=["disabled"],Vp={class:"console-pagination__pages","aria-label":"Pagination"},Gp={key:0,class:"console-pagination__ellipsis","aria-hidden":"true"},Hp=["aria-current","onClick"],zp={class:"console-pagination__label"},Yp=["disabled"],Zp={__name:"ConsolePagination",props:{currentPage:{type:Number,required:!0},totalPages:{type:Number,required:!0}},emits:["navigate"],setup(e,{emit:a}){const t=e,s=a,o=(0,l.EW)(()=>{const e=t.totalPages;let a=[];a=e<=7?Array.from({length:e},(e,a)=>a+1):t.currentPage<=4?[1,2,3,4,5,e]:t.currentPage>=e-3?[1,e-4,e-3,e-2,e-1,e]:[1,t.currentPage-2,t.currentPage-1,t.currentPage,t.currentPage+1,t.currentPage+2,e];const s=[];for(let t=0;t<a.length;t+=1){const e=a[t],l=a[t-1];l&&e-l>1&&s.push({type:"ellipsis",key:`ellipsis-${l}-${e}`}),s.push({type:"page",key:`page-${e}`,page:e})}return s});function r(e){e<1||e>t.totalPages||e===t.currentPage||s("navigate",e)}return(a,t)=>e.totalPages>1?((0,l.uX)(),(0,l.CE)("div",Bp,[(0,l.Lk)("button",{class:"button button--ghost",disabled:e.currentPage<=1,onClick:t[0]||(t[0]=a=>r(e.currentPage-1))}," Previous ",8,Mp),(0,l.Lk)("div",Vp,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(o.value,a=>((0,l.uX)(),(0,l.CE)(l.FK,{key:a.key},["ellipsis"===a.type?((0,l.uX)(),(0,l.CE)("span",Gp," ... ")):((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:(0,n.C4)(["console-pagination__page",{"console-pagination__page--active":a.page===e.currentPage}]),"aria-current":a.page===e.currentPage?"page":void 0,onClick:e=>r(a.page)},(0,n.v_)(a.page),11,Hp))],64))),128))]),(0,l.Lk)("span",zp,"Page "+(0,n.v_)(e.currentPage)+" of "+(0,n.v_)(e.totalPages),1),(0,l.Lk)("button",{class:"button button--ghost",disabled:e.currentPage>=e.totalPages,onClick:t[1]||(t[1]=a=>r(e.currentPage+1))}," Next ",8,Yp)])):(0,l.Q3)("",!0)}},ev=(0,Ea.A)(Zp,[["__scopeId","data-v-11cb3337"]]),av=ev,tv=["aria-expanded","aria-activedescendant","aria-labelledby","aria-label","placeholder","onKeydown"],sv={key:0,class:"workspace-filter__panel"},lv=["id","aria-selected","onKeydown"],nv={key:1,role:"group","aria-label":"Named workspaces",class:"workspace-filter__group"},ov=["id","aria-selected","onClick","onKeydown"],rv={class:"workspace-filter__option-name"},iv={class:"workspace-filter__option-id"},uv={key:2,role:"group","aria-label":"Workspace IDs",class:"workspace-filter__group"},cv=["id","aria-selected","onClick","onKeydown"],dv={class:"workspace-filter__option-id"},pv={key:0,class:"workspace-filter__empty"},vv="runs-workspace-filter-input",kv="runs-workspace-filter-listbox",gv={__name:"RunsWorkspaceFilter",props:{modelValue:{type:String,required:!0},workspaces:{type:Array,required:!0},placeholder:{type:String,default:"Search workspaces by name or ID"},labelledBy:{type:String,default:void 0}},emits:["update:modelValue"],setup(e,{emit:a}){const t=e,r=a;function i(e){return`runs-workspace-filter-option-${e}`}const u=(0,o.KR)(null),c=(0,o.KR)(""),d=(0,o.KR)(!1),p=(0,o.KR)(-1),v=(0,l.EW)(()=>t.modelValue),k=(0,l.EW)(()=>
1{if(!t.modelValue)return"";const e=t.workspaces.find(e=>e.workspaceId===t.modelValue);return e?g(e)?e.name:e.workspaceId:t.modelValue});function g(e){const a=e.name?.trim()??"";return""!==a&&a!==e.workspaceId}function b(e,a){if(!a)return!0;const t=a.toLowerCase(),s=e.name?.toLowerCase().includes(t)??!1,l=e.workspaceId.toLowerCase().includes(t);return s||l}(0,l.wB)(()=>t.modelValue,()=>{d.value||(c.value=k.value)},{immediate:!0}),(0,l.wB)(()=>t.workspaces,()=>{d.value||(c.value=k.value)});const m=(0,l.EW)(()=>c.value.trim()),_=(0,l.EW)(()=>t.workspaces.filter(g).filter(e=>b(e,m.value)).slice().sort((e,a)=>e.name.localeCompare(a.name))),h=(0,l.EW)(()=>t.workspaces.filter(e=>!g(e)).filter(e=>b(e,m.value)).slice().sort((e,a)=>e.workspaceId.localeCompare(a.workspaceId))),y=(0,l.EW)(()=>""===m.value),f=(0,l.EW)(()=>!_.value.length&&!h.value.length&&!y.value),w=(0,l.EW)(()=>{const e=[];y.value&&e.push({id:i("all"),option:null});for(const a of _.value)e.push({id:i(`named-${a.workspaceId}`),option:a});for(const a of h.value)e.push({id:i(`raw-${a.workspaceId}`),option:a});return e}),L=(0,l.EW)(()=>{const e=p.value;return e<0||e>=w.value.length?null:w.value[e].id});function C(){d.value=!0,c.value===k.value&&(c.value="")}function E(){d.value=!1,p.value=-1,c.value=k.value}function R(){d.value=!0,p.value=-1}function I(e){const a=e.relatedTarget,t=e.currentTarget;t&&a&&t.contains(a)||(d.value=!1,p.value=-1,c.value=k.value)}function j(e){d.value||C();const a=w.value.length;if(0===a)return void(p.value=-1);let t=p.value+e;t<0?t=a-1:t>=a&&(t=0),p.value=t}function A(){j(1)}function W(){j(-1)}function S(e){d.value&&0!==w.value.length&&(e.preventDefault(),p.value=0)}function X(e){d.value&&0!==w.value.length&&(e.preventDefault(),p.value=w.value.length-1)}function x(){if(!d.value)return;const e=p.value;if(e<0||e>=w.value.length)return;const a=w.value[e];a.option?P(a.option):T()}function T(){r("update:modelValue",""),c.value="",d.value=!1,p.value=-1}function P(e){r("update:modelValue",e.workspaceId),c.value=g(e)?e.name:e.workspaceId,d.value=!1,p.value=-1}return(0,l.wB)(w,e=>{p.value>=e.length&&(p.value=e.length-1)}),(a,t)=>((0,l.uX)(),(0,l.CE)("div",{class:"workspace-filter",onFocusout:I},[(0,l.bo)((0,l.Lk)("input",{id:vv,ref_key:"inputRef",ref:u,"onUpdate:modelValue":t[0]||(t[0]=e=>c.value=e),type:"text",class:"form-input workspace-filter__input",role:"combobox",autocomplete:"off","aria-autocomplete":"list","aria-expanded":d.value,"aria-controls":kv,"aria-activedescendant":L.value||void 0,"aria-labelledby":e.labelledBy||void 0,"aria-label":e.labelledBy?void 0:"Filter runs by workspace",placeholder:e.placeholder,onFocus:C,onInput:R,onKeydown:[(0,s.jR)((0,s.D$)(A,["prevent"]),["down"]),(0,s.jR)((0,s.D$)(W,["prevent"]),["up"]),(0,s.jR)(S,["home"]),(0,s.jR)(X,["end"]),(0,s.jR)((0,s.D$)(x,["prevent"]),["enter"]),(0,s.jR)((0,s.D$)(E,["prevent"]),["escape"])]},null,40,tv),[[s.Jo,c.value]]),d.value?((0,l.uX)(),(0,l.CE)("div",sv,[(0,l.Lk)("div",{id:kv,class:"workspace-filter__listbox",role:"listbox","aria-label":"Workspaces"},[y.value?((0,l.uX)(),(0,l.CE)("button",{key:0,id:i("all"),type:"button",role:"option",class:(0,n.C4)(["workspace-filter__option workspace-filter__option--all",{"workspace-filter__option--active":L.value===i("all")}]),"aria-selected":""===v.value,"data-testid":"workspace-option-all",onMousedown:t[1]||(t[1]=(0,s.D$)(()=>{},["prevent"])),onClick:T,onKeydown:[(0,s.jR)((0,s.D$)(T,["prevent"]),["enter"]),(0,s.jR)((0,s.D$)(T,["prevent"]),["space"])]}," All workspaces ",42,lv)):(0,l.Q3)("",!0),_.value.length?((0,l.uX)(),(0,l.CE)("div",nv,[t[4]||(t[4]=(0,l.Lk)("p",{class:"workspace-filter__group-label","aria-hidden":"true"},"Named workspaces",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(_.value,e=>((0,l.uX)(),(0,l.CE)("button",{key:`named-${e.workspaceId}`,id:i(`named-${e.workspaceId}`),type:"button",role:"option",class:(0,n.C4)(["workspace-filter__option workspace-filter__option--named",{"workspace-filter__option--selected":e.workspaceId===v.value,"workspace-filter__option--active":L.value===i(`named-${e.workspaceId}`)}]),"aria-selected":e.workspaceId===v.value,"data-testid":"workspace-option-named",onMousedown:t[2]||(t[2]=(0,s.D$)(()=>{},["prevent"])),onClick:a=>P(e),onKeydown:[(0,s.jR)((0,s.D$)(a=>P(e),["prevent"]),["enter"]),(0,s.jR)((0,s.D$)(a=>P(e),["prevent"]),["space"])]},[(0,l.Lk)("span",rv,(0,n.v_)(e.name),1),(0,l.Lk)("span",iv,(0,n.v_)(e.workspaceId),1)],42,ov))),128))])):(0,l.Q3)("",!0),h.value.length?((0,l.uX)(),(0,l.CE)("div",uv,[t[5]||(t[5]=(0,l.Lk)("p",{class:"workspace-filter__group-label","aria-hidden":"true"},"Workspace IDs",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(h.value,e=>((0,l.uX)(),(0,l.CE)("button",{key:`raw-${e.workspaceId}`,id:i(`raw-${e.workspaceId}`),type:"button",role:"option",class:(0,n.C4)(["workspace-filter__option workspace-filter__option--raw",{"workspace-filter__option--selected":e.workspaceId===v.value,"workspace-filter__option--active":L.value===i(`raw-${e.workspaceId}`)}]),"aria-selected":e.workspaceId===v.value,"data-testid":"workspace-option-raw",onMousedown:t[3]||(t[3]=(0,s.D$)(()=>{},["prevent"])),onClick:a=>P(e),onKeydown:[(0,s.jR)((0,s.D$)(a=>P(e),["prevent"]),["enter"]),(0,s.jR)((0,s.D$)(a=>P(e),["prevent"]),["space"])]},[(0,l.Lk)("span",dv,(0,n.v_)(e.workspaceId),1)],42,cv))),128))])):(0,l.Q3)("",!0)]),f.value?((0,l.uX)(),(0,l.CE)("p",pv,"No matching workspaces.")):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0)],32))}},bv=(0,Ea.A)(gv,[["__scopeId","data-v-34c2c392"]]),mv=bv,_v={class:"console-page"},hv={class:"console-page__header"},yv={class:"console-page__actions"},fv=["disabled"],wv={class:"console-panel"},Lv={class:"console-filters"},Cv={class:"console-filter console-filter--wide"},Ev={class:"console-filter"},Rv={class:"console-filter"},Iv={key:0,class:"alert alert--error"},jv={class:"console-signal-strip job-summary-strip"},Av={class:"console-signal console-signal--active"},Wv={class:"console-signal__value"},Sv={class:"console-signal__value"},Xv={class:"console-signal__value"},xv={class:"console-signal__value"},Tv={class:"console-results"},Pv={class:"console-results__count"},$v={class:"console-list job-list"},Fv=["onClick"],Kv={class:"console-card__header job-card__header"},Ov={class:"job-card__title"},Dv={class:"job-card__id"},Nv={class:"console-card__meta job-card__meta"},Uv={class:"console-card__footer job-card__footer"},qv={class:"job-card__summary"},Qv={class:"job-card__date"},Jv=1e4,Bv={__name:"ConsoleJobs",setup(e){const a=(0,r.rd)(),t=(0,r.lq)(),{requestJson:i}=el(),u=k().child("[ConsoleJobs]"),c=(0,o.KR)(!0),d=(0,o.KR)(""),p=(0,o.KR)(""),v=(0,o.KR)([]),g=(0,o.KR)([]),b=(0,o.KR)(""),m=(0,o.KR)(""),_=(0,o.KR)(""),h=(0,o.KR)(1),y=(0,o.KR)(12),f=(0,o.KR)(!1);let w=null;const L=["awaiting_input","pending_approval","waiting_credentials"],C=(0,l.EW)(()=>[...g.value].sort((e,a)=>e.name.localeCompare(a.name))),E=(0,l.EW)(()=>{const e=b.value.trim().toLowerCase();return v.value.filter(a=>{if("attention"===m.value){if(!L.includes(a.status))return!1}else if(m.value&&a.status!==m.value)return!1;if(_.value&&a.workspaceId!==_.value)return!1;if(!e)return!0;const t=[a.jobId,a.description??"",D(a.workspaceId)].join("\n").toLowerCase();return t.includes(e)})}),R=(0,l.EW)(()=>E.value.filter(e=>L.includes(e.status)).length),I=(0,l.EW)(()=>E.value.filter(e=>["running","delivering","synthesizing"].includes(e.status)).length),j=(0,l.EW)(()=>E.value.filter(e=>"failed"===e.status).length),A=(0,l.EW)(()=>
1Math.max(1,Math.ceil(E.value.length/y.value))),W=(0,l.EW)(()=>{const e=(h.value-1)*y.value;return E.value.slice(e,e+y.value)}),S=(0,l.EW)(()=>b.value||m.value||_.value?"No runs match the current filters.":"No runs found.");function X(e){const a=e.id??e.workspaceId;return{workspaceId:a,name:e.name||a}}function x(e){return"completed"===e?"completed":"failed"===e?"failed":["attention","planning","awaiting_input","pending_approval","approved","running","delivering","synthesizing","waiting_credentials"].includes(e)?"active":void 0}async function T(){const e=x(m.value);v.value=await Ql(i,{...e?{group:e}:{},..._.value?{workspaceId:_.value}:{}})}async function P(){const e=await Ul(i,{includeArchived:!0});g.value=e.map(X)}async function $({showLoading:e=!1,background:a=!1}={}){e&&(c.value=!0),a&&(f.value=!0),a||(d.value="",p.value="");const[t,s]=await Promise.allSettled([T(),P()]);"rejected"===t.status?(a||(v.value=[],d.value="Failed to load runs."),u.warn("Failed to fetch runs",t.reason)):d.value="","rejected"===s.status?(a||(g.value=[],p.value="Workspace names could not be loaded. Showing workspace IDs instead."),u.warn("Failed to fetch workspaces for runs page",s.reason)):p.value="",h.value>A.value&&(h.value=A.value),c.value=!1,f.value=!1}function F(){w&&clearInterval(w),w=setInterval(()=>{$({background:!0})},Jv)}function K(e){e<1||e>A.value||(h.value=e)}function O(e){a.push({name:"ConsoleJobDetail",params:{id:e}})}function D(e){const a=g.value.find(a=>a.workspaceId===e);return a?.name||e}function N(e){const a="string"===typeof e?e.trim():"",t=["","attention","planning","awaiting_input","pending_approval","approved","running","delivering","synthesizing","completed","failed","cancelled"];return t.includes(a)?a:""}function U(e){return"string"===typeof e?e.trim():""}function q(){const e={...t.query};m.value?e.status=m.value:delete e.status,_.value?e.workspaceId=_.value:delete e.workspaceId,t.query.status===e.status&&t.query.workspaceId===e.workspaceId||a.replace({query:e})}return(0,l.wB)(()=>t.query.status,e=>{m.value=N(e)},{immediate:!0}),(0,l.wB)(()=>t.query.workspaceId,e=>{_.value=U(e)},{immediate:!0}),(0,l.wB)(b,()=>{h.value=1}),(0,l.wB)([m,_],([e,a],[t,s])=>{h.value=1,e===t&&a===s||(q(),$({showLoading:!0}))}),(0,l.sV)(()=>{$({showLoading:!0}),F()}),(0,l.hi)(()=>{w&&(clearInterval(w),w=null)}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",_v,[(0,l.Lk)("div",hv,[(0,l.Lk)("div",null,[a[4]||(a[4]=(0,l.Lk)("h1",{class:"console-page__title"},"Runs",-1)),a[5]||(a[5]=(0,l.Lk)("p",{class:"console-page__placeholder"}," Review queued and completed work across the console, then open a run record for details. ",-1)),(0,l.bF)(Ll,{active:"",busy:f.value,"idle-label":"Auto-refresh every 10s","busy-label":"Refreshing runs...",tone:"active"},null,8,["busy"])]),(0,l.Lk)("div",yv,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:c.value,onClick:a[0]||(a[0]=e=>$({showLoading:!0}))}," Refresh ",8,fv),(0,l.bF)(t,{to:{name:"ConsoleJobCreate"},class:"button button--primary"},{default:(0,l.k6)(()=>[...a[6]||(a[6]=[(0,l.eW)(" Submit Request ",-1)])]),_:1})])]),(0,l.Lk)("section",wv,[(0,l.Lk)("div",Lv,[(0,l.Lk)("label",Cv,[a[7]||(a[7]=(0,l.Lk)("span",{class:"console-filter__label"},"Search",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[1]||(a[1]=e=>b.value=e),type:"text",class:"form-input",placeholder:"Run ID, request, or workspace"},null,512),[[s.Jo,b.value]])]),(0,l.Lk)("label",Ev,[a[9]||(a[9]=(0,l.Lk)("span",{class:"console-filter__label"},"Status",-1)),(0,l.bo)((0,l.Lk)("select",{"onUpdate:modelValue":a[2]||(a[2]=e=>m.value=e),class:"form-input"},[...a[8]||(a[8]=[(0,l.Fv)('<option value="" data-v-6ae80a9c>All</option><option value="attention" data-v-6ae80a9c>Needs Attention</option><option value="planning" data-v-6ae80a9c>Planning</option><option value="awaiting_input" data-v-6ae80a9c>Awaiting Input</option><option value="pending_approval" data-v-6ae80a9c>Pending Approval</option><option value="approved" data-v-6ae80a9c>Approved</option><option value="running" data-v-6ae80a9c>Running</option><option value="delivering" data-v-6ae80a9c>Delivering</option><option value="synthesizing" data-v-6ae80a9c>Synthesizing</option><option value="completed" data-v-6ae80a9c>Completed</option><option value="failed" data-v-6ae80a9c>Failed</option><option value="cancelled" data-v-6ae80a9c>Cancelled</option>',12)])],512),[[s.u1,m.value]])]),(0,l.Lk)("div",Rv,[a[10]||(a[10]=(0,l.Lk)("span",{id:"runs-workspace-filter-label",class:"console-filter__label"},"Workspace",-1)),(0,l.bF)(mv,{modelValue:_.value,"onUpdate:modelValue":a[3]||(a[3]=e=>_.value=e),workspaces:C.value,"labelled-by":"runs-workspace-filter-label"}
1,null,8,["modelValue","workspaces"])])]),p.value&&!d.value?((0,l.uX)(),(0,l.CE)("div",Iv,(0,n.v_)(p.value),1)):(0,l.Q3)("",!0),(0,l.bF)(hl,{loading:c.value,error:d.value,"is-empty":0===E.value.length,"loading-message":"Loading runs...","empty-message":S.value},{default:(0,l.k6)(()=>[(0,l.Lk)("div",jv,[(0,l.Lk)("div",Av,[a[11]||(a[11]=(0,l.Lk)("span",{class:"console-signal__label"},"Matching Runs",-1)),(0,l.Lk)("span",Wv,(0,n.v_)(E.value.length),1),a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__note"},"Current search and filter result set.",-1))]),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",R.value>0?"console-signal--attention":"console-signal--pending"])},[a[13]||(a[13]=(0,l.Lk)("span",{class:"console-signal__label"},"Needs Attention",-1)),(0,l.Lk)("span",Sv,(0,n.v_)(R.value),1),a[14]||(a[14]=(0,l.Lk)("span",{class:"console-signal__note"},"Awaiting input, approval, or credentials.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",I.value>0?"console-signal--active":"console-signal--pending"])},[a[15]||(a[15]=(0,l.Lk)("span",{class:"console-signal__label"},"Active",-1)),(0,l.Lk)("span",Xv,(0,n.v_)(I.value),1),a[16]||(a[16]=(0,l.Lk)("span",{class:"console-signal__note"},"Running, delivering, or synthesizing runs.",-1))],2),(0,l.Lk)("div",{class:(0,n.C4)(["console-signal",j.value>0?"console-signal--failed":"console-signal--ready"])},[a[17]||(a[17]=(0,l.Lk)("span",{class:"console-signal__label"},"Failed",-1)),(0,l.Lk)("span",xv,(0,n.v_)(j.value),1),a[18]||(a[18]=(0,l.Lk)("span",{class:"console-signal__note"},"Runs requiring follow-up.",-1))],2)]),(0,l.Lk)("div",Tv,[(0,l.Lk)("p",Pv," Showing "+(0,n.v_)(W.value.length)+" of "+(0,n.v_)(E.value.length)+" matching runs ",1)]),(0,l.Lk)("div",$v,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(W.value,e=>((0,l.uX)(),(0,l.CE)("button",{key:e.jobId,type:"button",class:(0,n.C4)(["console-card job-card",`console-card--${e.tone}`]),onClick:a=>O(e.jobId)},[(0,l.Lk)("div",Kv,[(0,l.Lk)("div",null,[(0,l.Lk)("h2",Ov,(0,n.v_)((0,o.R1)(jl)(e.description,e.jobId)),1),(0,l.Lk)("p",Dv,(0,n.v_)(e.jobId),1)]),(0,l.Lk)("div",Nv,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge job-badge",`console-badge--${e.tone}`])},(0,n.v_)(e.statusLabel),3)])]),(0,l.Lk)("div",Uv,[(0,l.Lk)("span",qv,(0,n.v_)(D(e.workspaceId)),1),(0,l.Lk)("span",Qv,[e.updatedAt&&e.updatedAt!==e.createdAt?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.eW)(" Updated "+(0,n.v_)((0,o.R1)(Xl)(e.updatedAt)),1)],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.eW)(" Created "+(0,n.v_)((0,o.R1)(Xl)(e.createdAt)),1)],64))])])],10,Fv))),128))]),(0,l.bF)(av,{"current-page":h.value,"total-pages":A.value,onNavigate:K},null,8,["current-page","total-pages"])]),_:1},8,["loading","error","is-empty","empty-message"])])])}}},Mv=(0,Ea.A)(Bv,[["__scopeId","data-v-6ae80a9c"]]),Vv=Mv,Gv={class:"worker-setup"},Hv={key:0,class:"worker-setup__heading"},zv={class:"worker-setup__steps"},Yv={class:"worker-setup__downloads"},Zv=["disabled","onClick"],ek={class:"worker-setup__code"},ak={__name:"WorkerSetupInstructions",props:{showHeading:{type:Boolean,default:!0}},setup(e){const{orchestratorBaseUrl:a,apiHeaders:t}=Ns(),s=(0,o.KR)(""),r=[{id:"linux-amd64",label:"Linux (amd64)"},{id:"darwin-arm64",label:"macOS (Apple Silicon)"},{id:"windows-amd64",label:"Windows (amd64)"}];async function i(e){s.value=e;try{const s=await fetch(`${a.value}/worker/download/${e}`,{headers:t.value}),l=await s.json();if(!s.ok)throw new Error(Us(l,s.status));window.location.assign(l.url)}catch(l){window.alert(`Download failed: ${l.message}`)}finally{s.value=""}}return(t,u)=>((0,l.uX)(),(0,l.CE)("div",Gv,[e.showHeading?((0,l.uX)(),(0,l.CE)("h4",Hv,"Local Worker Setup")):(0,l.Q3)("",!0),(0,l.Lk)("ol",zv,[(0,l.Lk)("li",null,[u[0]||(u[0]=(0,l.Lk)("strong",null,"Download the worker binary.",-1)),(0,l.Lk)("div",Yv,[((0,l.uX)(),(0,l.CE)(l.FK,null,(0,l.pI)(r,e=>(0,l.Lk)("button",{key:e.id,type:"button",class:"button button--ghost worker-setup__download",disabled:s.value===e.id,onClick:a=>i(e.id)},(0,n.v_)(s.value===e.id?"Downloading...":e.label),9,Zv)),64))]),u[1]||(u[1]=(0,l.Lk)("p",{class:"worker-setup__note"},"Or build from source with `cd worker && make build`.",-1))]),(0,l.Lk)("li",null,[u[2]||(u[2]=(0,l.Lk)("strong",null,"Run the worker.",-1)),(0,l.Lk)("pre",ek,"API_KEY=YOUR_API_KEY beads-worker --api-url "+(0,n.v_)((0,o.R1)(a)),1)])]),u[3]||(u[3]=(0,l.Lk)("p",{class:"worker-setup__note"}," The worker polls for queued runs and executes them through your local `claude` CLI. Make sure `claude` is available in `PATH`. ",-1))]))}}
1,tk=(0,Ea.A)(ak,[["__scopeId","data-v-a554c5f0"]]),sk=tk,lk={class:"console-page"},nk={class:"console-page__header"},ok={class:"console-page__actions"},rk={class:"console-panel"},ik={key:0,class:"console-signal-strip job-create__summary-strip"},uk={class:"console-signal__value job-create__signal-value"},ck={class:"console-signal__note"},dk={class:"console-signal__value job-create__signal-value"},pk={class:"console-signal__value job-create__signal-value"},vk={class:"console-signal__note"},kk={key:1,class:"alert alert--error"},gk={class:"job-create__stack"},bk={class:"console-filter"},mk={class:"console-filter"},_k=["value"],hk={key:0,class:"job-create__hint"},yk={key:1,class:"job-create__hint"},fk={class:"job-create__stack"},wk={class:"job-create__mode-toggle",role:"radiogroup","aria-label":"Request input mode"},Lk={class:"job-create__mode-option"},Ck={class:"job-create__mode-option"},Ek={key:0,class:"console-filter"},Rk={class:"console-filter"},Ik={class:"console-filter"},jk={class:"job-create__stack"},Ak={class:"console-filter"},Wk={class:"job-create__hint"},Sk={key:0,class:"job-create__setup-shell"},Xk={class:"console-module"},xk={class:"console-metric-list"},Tk={class:"console-metric"},Pk={class:"console-metric"},$k={class:"console-metric"},Fk={key:2,class:"alert alert--error"},Kk={key:3,class:"job-create__message"},Ok={class:"button-row"},Dk=["disabled"],Nk=3e3,Uk=5,qk={__name:"ConsoleJobCreate",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{orchestratorBaseUrl:i,apiHeaders:u}=Ns(),c=k().child("[ConsoleJobCreate]"),d=new Set(["ready","failed","archived"]),p=(0,o.KR)(!0),v=(0,o.KR)(""),g=(0,o.KR)(""),b=(0,o.KR)(!1),m=(0,o.KR)(""),_=(0,o.KR)(""),h=(0,o.KR)([]),y=(0,o.KR)(""),f=(0,o.KR)(""),w=(0,o.KR)("freeform"),L=(0,o.KR)(""),C=(0,o.KR)(""),E=(0,o.KR)(""),R=(0,o.KR)("claude-code"),I=(0,o.KR)(null),j=(0,o.KR)(null),A=(0,o.KR)(null),W=(0,o.KR)(null),S=(0,o.KR)(null),X=(0,o.KR)(null),x=(0,o.KR)(null),T=(0,o.KR)(!1);let P=null,$=0;const F=(0,l.EW)(()=>h.value.filter(e=>"archived"!==e.status).sort((e,a)=>e.name.localeCompare(a.name))),K=(0,l.EW)(()=>{const e=y.value.trim().toLowerCase();if(!e)return F.value;const a=f.value;return F.value.filter(t=>{if(a&&t.workspaceId===a)return!0;const s=`${t.name} - ${t.status}`;return s.toLowerCase().includes(e)})}),O=(0,l.EW)(()=>T.value||h.value.some(e=>te(e.status))),D=(0,l.EW)(()=>F.value.find(e=>e.workspaceId===f.value)??null),N=(0,l.EW)(()=>D.value?.name||"Select a workspace"),U=(0,l.EW)(()=>D.value?.description||""),q=(0,l.EW)(()=>{if(!D.value)return"A ready workspace is required before you can submit a request.";const e=[];return D.value.sourceLabel&&e.push(D.value.sourceLabel),D.value.branch&&e.push(`branch ${D.value.branch}`),e.push(`status ${D.value.status||"unknown"}`),e.join(" / ")}),Q=(0,l.EW)(()=>{const e=D.value?.status;return"failed"===e?"console-signal--failed":"assembling"===e||"creating"===e||"pending"===e?"console-signal--pending":"console-signal--ready"}),J=(0,l.EW)(()=>"issue"===w.value?"GitHub Issue":"Custom Spec"),B=(0,l.EW)(()=>"claude-code"===R.value?"Local Worker (Claude Code)":"Bedrock"),M=(0,l.EW)(()=>"claude-code"===R.value?"Uses the local worker path. Download the worker and run it alongside your local Claude Code CLI.":"Uses the shared Bedrock-backed runtime path when it is configured on the server."),V=(0,l.EW)(()=>"claude-code"===R.value?"Local worker path with download and run instructions below.":"Shared server-side runtime path."),G=(0,l.EW)(()=>{const e=Number.parseInt(C.value,10);return Number.isInteger(e)&&e>0?e:null}),H=(0,l.EW)(()=>!p.value&&!b.value&&(!!D.value&&("ready"===D.value.status&&("issue"===w.value?null!==G.value:L.value.trim().length>0))));function z(e,a){e.value?.setAttribute("open",""),e.value?.scrollIntoView?.({block:"start",behavior:"smooth"}),a?.value?.focus?.()}function Y(){z(I,W)}function Z(){z(j,"issue"===w.value?X:S)}function ee(){z(A,x)}function ae(e){const a=e.id??e.workspaceId,t="public-github"===e.type||"private-github"===e.type||"github"===e.source,s=e.sourceLabel||(t?"GitHub":e.type||e.source?"Upload":"Workspace");return{...e,workspaceId:a,name:e.name||a,sourceLabel:s}}function te(e){return!d.has(e||"ready")}function se(){null!==P&&(clearTimeout(P),P=null),$=0}
1function le(){null===P&&h.value.some(e=>te(e.status))&&(P=setTimeout(async()=>{P=null,await ne()},Nk))}async function ne(){T.value=!0;try{await re({background:!0}),$=0,h.value.some(e=>te(e.status))?le():se()}catch(e){$+=1,c.warn("Failed to poll workspace options",e),$<Uk&&le()}finally{T.value=!1}}async function oe(e,a={}){const t=await fetch(`${i.value}${e}`,{...a,headers:{...u.value,...a.headers||{}}}),s=await t.json().catch(()=>({}));if(!t.ok)throw new Error(Us(s,t.status));return s}async function re({background:e=!1}={}){e||se();const a=await Ul(oe,{includeArchived:!0});h.value=a.map(ae),h.value.some(e=>te(e.status))?le():se()}async function ie({showLoading:e=!1}={}){e&&(p.value=!0),v.value="",g.value="";try{await re()}catch(a){h.value=[],v.value="Failed to load workspaces.",c.warn("Failed to fetch workspaces for request submission",a)}finally{p.value=!1}}async function ue(){if(H.value){b.value=!0,m.value="",_.value="";try{const e={workspaceId:f.value,runtime:R.value,..."issue"===w.value?{issueNumber:G.value,...E.value.trim()?{operatorConstraints:{notes:E.value.trim()}}:{}}:{description:L.value.trim()}},a=await oe("/jobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});_.value="Request submitted.",await t.push({name:"ConsoleJobDetail",params:{id:a.jobId}})}catch(e){m.value=e.message||"Failed to submit request.",c.warn("Failed to submit request",e)}finally{b.value=!1}}}return(0,l.wB)(()=>a.query.workspaceId,e=>{f.value="string"===typeof e?e:""},{immediate:!0}),(0,l.sV)(()=>{ie({showLoading:!0})}),(0,l.hi)(()=>{se()}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",lk,[(0,l.Lk)("div",nk,[(0,l.Lk)("div",null,[a[8]||(a[8]=(0,l.Lk)("h1",{class:"console-page__title"},"Submit Request",-1)),a[9]||(a[9]=(0,l.Lk)("p",{class:"console-page__placeholder"}," Select a workspace, choose the input shape, and submit a request for planning. ",-1)),(0,l.bF)(Ll,{active:O.value,busy:T.value,"idle-label":"Watching workspace readiness every 3s","busy-label":"Refreshing workspace choices...",tone:"pending"},null,8,["active","busy"])]),(0,l.Lk)("div",ok,[(0,l.bF)(t,{to:{name:"ConsoleJobs"},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[10]||(a[10]=[(0,l.eW)(" Back to Runs ",-1)])]),_:1})])]),(0,l.Lk)("section",rk,[(0,l.bF)(hl,{loading:p.value,error:v.value,"is-empty":!1,"loading-message":"Loading workspaces..."},{default:(0,l.k6)(()=>[F.value.length?((0,l.uX)(),(0,l.CE)("div",ik,[(0,l.Lk)("button",{type:"button",class:(0,n.C4)(["console-signal console-signal--button",Q.value]),"aria-controls":"job-create-workspace-section",onClick:Y},[a[11]||(a[11]=(0,l.Lk)("span",{class:"console-signal__label"},"Workspace",-1)),(0,l.Lk)("span",uk,(0,n.v_)(N.value),1),(0,l.Lk)("span",ck,(0,n.v_)(q.value),1)],2),(0,l.Lk)("button",{type:"button",class:"console-signal console-signal--button console-signal--active","aria-controls":"job-create-input-section",onClick:Z},[a[12]||(a[12]=(0,l.Lk)("span",{class:"console-signal__label"},"Input Mode",-1)),(0,l.Lk)("span",dk,(0,n.v_)(J.value),1),a[13]||(a[13]=(0,l.Lk)("span",{class:"console-signal__note"},"Choose freeform instructions or a GitHub issue-backed plan input.",-1))]),(0,l.Lk)("button",{type:"button",class:(0,n.C4)(["console-signal console-signal--button","claude-code"===R.value?"console-signal--pending":"console-signal--active"]),"aria-controls":"job-create-runtime-section",onClick:ee},[a[14]||(a[14]=(0,l.Lk)("span",{class:"console-signal__label"},"Runtime",-1)),(0,l.Lk)("span",pk,(0,n.v_)(B.value),1),(0,l.Lk)("span",vk,(0,n.v_)(V.value),1)],2)])):(0,l.Q3)("",!0),g.value?((0,l.uX)(),(0,l.CE)("div",kk,(0,n.v_)(g.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("details",{id:"job-create-workspace-section",ref_key:"workspaceSection",ref:I,class:"console-module",open:""},[a[18]||(a[18]=(0,l.Lk)("summary",{class:"console-module__summary"},"Workspace",-1)),(0,l.Lk)("div",gk,[(0,l.Lk)("label",bk,[a[15]||(a[15]=(0,l.Lk)("span",{class:"console-filter__label"},"Filter",-1)),(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[0]||(a[0]=e=>y.value=e),type:"search",class:"form-input",placeholder:"Filter workspaces"},null,512),[[s.Jo,y.value]])]),(0,l.Lk)("label",mk,[a[17]||(a[17]=(0,l.Lk)("span",{class:"console-filter__label"},"Workspace",-1)),(0,l.bo)((0,l.Lk)("select",{ref_key:"workspaceSelect",ref:W,"onUpdate:modelValue":a[1]||(a[1]=e=>f.value=e),class:"form-input"},[a[16]||(a[16]=(0,l.Lk)("option",{value:""},"Select a workspace",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(K.value,e=>((0,l.uX)(),(0,l.CE)("option",{key:e.workspaceId,value:e.workspaceId},(0,n.v_)(e.name)+" - "+(0,n.v_)(e.status),9,_k))),128))],512),[[s.u1,f.value]])]),U.value?((0,l.uX)(),(0,l.CE)("p",hk,(0,n.v_)(U.value),1)):((0,l.uX)(),(0,l.CE)("p",yk," Workspace creation is not part of this screen yet. Use an existing ready workspace. "))])],512),(0,l.Lk)("details",{id:"job-create-input-section",ref_key:"inputSection",ref:j,class:"console-module",open:""},[a[24]||(a[24]=(0,l.Lk)("summary",{class:"console-module__summary"},"Input",-1)),(0,l.Lk)("div",fk,[(0,l.Lk)("div",wk,[(0,l.Lk)("label",Lk,[(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[2]||(a[2]=e=>w.value=e),type:"radio",value:"freeform"},null,512),[[s.XL,w.value]]),a[19]||(a[19]=(0,l.Lk)("span",null,"Custom Spec",-1))]),(0,l.Lk)("label",Ck,[(0,l.bo)((0,l.Lk)("input",{"onUpdate:modelValue":a[3]||(a[3]=e=>w.value=e),type:"radio",value:"issue"},null,512),[[s.XL,w.value]]),a[20]||(a[20]=(0,l.Lk)("span",null,"GitHub Issue",-1))])]),"freeform"===w.value?((0,l.uX)(),(0,l.CE)("label",Ek,[a[21]||(a[21]=(0,l.Lk)("span",{class:"console-filter__label"},"Request",-1)),(0,l.bo)((0,l.Lk)("textarea",{ref_key:"jobDescriptionField",ref:S,"onUpdate:modelValue":a[4]||(a[4]=e=>L.value=e),class:"form-input job-create__textarea",rows:"8",placeholder:"Describe the engineering request, constraints, and expected outcome."},null,512),[[s.Jo,L.value]])])):((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[(0,l.Lk)("label",Rk,[a[22]||(a[22]=(0,l.Lk)("span",{class:"console-filter__label"},"Issue Number",-1)),(0,l.bo)((0,l.Lk)("input",{ref_key:"issueNumberField",ref:X,"onUpdate:modelValue":a[5]||(a[5]=e=>C.value=e),type:"number",min:"1",step:"1",class:"form-input",placeholder:"e.g. 211"},null,512),[[s.Jo,C.value]])]),(0,l.Lk)("label",Ik,[a[23]||(a[23]=(0,l.Lk)("span",{class:"console-filter__label"},"Operator Notes",-1)),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a[6]||(a[6]=e=>E.value=e),class:"form-input job-create__textarea",rows:"5",placeholder:"Optional operator constraints that stay secondary to the issue requirements."},null,512),[[s.Jo,E.value]])])],64))])],512),(0,l.Lk)("details",{id:"job-create-runtime-section",ref_key:"runtimeSection",ref:A,class:"console-module",open:""},[a[27]||(a[27]=(0,l.Lk)("summary",{class:"console-module__summary"},"Runtime",-1)),(0,l.Lk)("div",jk,[(0,l.Lk)("label",Ak,[a[26]||(a[26]=(0,l.Lk)("span",{class:"console-filter__label"},"Runtime",-1)),(0,l.bo)((0,l.Lk)("select",{ref_key:"runtimeSelect",ref:x,"onUpdate:modelValue":a[7]||(a[7]=e=>R.value=e),class:"form-input"},[...a[25]||(a[25]=[(0,l.Lk)("option",{value:"claude-code"},"Local Worker (Claude Code)",-1),(0,l.Lk)("option",{value:"bedrock"},"Bedrock",-1)])],512),[[s.u1,R.value]])]),(0,l.Lk)("p",Wk,(0,n.v_)(M.value),1),"claude-code"===R.value?((0,l.uX)(),(0,l.CE)("div",Sk,[(0,l.bF)(sk,{"show-heading":!1})])):(0,l.Q3)("",!0)])],512),(0,l.Lk)("details",Xk,[a[31]||(a[31]=(0,l.Lk)("summary",{class:"console-module__summary"}
1,"Launch Contract",-1)),(0,l.Lk)("dl",xk,[(0,l.Lk)("div",Tk,[a[28]||(a[28]=(0,l.Lk)("dt",null,"Runtime",-1)),(0,l.Lk)("dd",null,(0,n.v_)(B.value),1)]),(0,l.Lk)("div",Pk,[a[29]||(a[29]=(0,l.Lk)("dt",null,"Workspace Source",-1)),(0,l.Lk)("dd",null,(0,n.v_)(D.value?.sourceLabel||"Select a workspace"),1)]),(0,l.Lk)("div",$k,[a[30]||(a[30]=(0,l.Lk)("dt",null,"Submission Kind",-1)),(0,l.Lk)("dd",null,(0,n.v_)("issue"===w.value?"issue":"freeform"),1)])])]),m.value?((0,l.uX)(),(0,l.CE)("div",Fk,(0,n.v_)(m.value),1)):(0,l.Q3)("",!0),_.value?((0,l.uX)(),(0,l.CE)("div",Kk,(0,n.v_)(_.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",Ok,[(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:!H.value,onClick:ue},(0,n.v_)(b.value?"Submitting...":"Submit Request"),9,Dk)])]),_:1},8,["loading","error"])])])}}},Qk=(0,Ea.A)(qk,[["__scopeId","data-v-6d262b34"]]),Jk=Qk,Bk={class:"console-page"},Mk={class:"console-page__header"},Vk={class:"console-page__title"},Gk={class:"console-page__placeholder"},Hk={key:0,class:"job-detail__stat"},zk={class:"job-detail__stat"},Yk={class:"console-page__actions"},Zk=["disabled"],eg={class:"console-signal__label"},ag={class:"console-signal__note"},tg={key:1,class:"job-detail__failure-block"},sg={class:"job-detail__failure-text"},lg={key:2,class:"job-detail__action-block"},ng=["disabled"],og={key:3,class:"job-detail__action-block","data-testid":"staleness-decision",role:"alert"},rg={class:"alert alert--warning"},ig={class:"button-row"},ug=["disabled"],cg=["disabled"],dg=["disabled"],pg=["disabled"],vg={key:4,class:"job-detail__action-block","data-testid":"paused-run"},kg={key:0,class:"job-detail__failure-text"},gg=["disabled"],bg={key:0,class:"job-detail__failure-text"},mg=["disabled"],_g={key:0,class:"job-detail__failure-text"},hg={key:5,class:"job-detail__action-block"},yg={class:"job-detail__question-label"},fg=["onUpdate:modelValue"],wg=["disabled"],Lg={key:6,class:"console-module",open:""},Cg={class:"console-module__summary"},Eg={class:"job-detail__status-line"},Rg={key:0,class:"job-detail__preflight-list"},Ig={class:"job-detail__preflight-name"},jg={class:"job-detail__preflight-message"},Ag={key:1,class:"job-detail__status-line"},Wg={key:7,class:"console-module"},Sg={key:8,class:"console-module",open:""},Xg={class:"console-module__summary"},xg={key:0,class:"console-module__count"},Tg={key:0,class:"planner-progress"},Pg={class:"planner-progress__indicator"},$g={class:"job-detail__subheading"},Fg={key:0,class:"planner-progress__bar"},Kg={key:1,class:"job-detail__status-line"},Og={key:1},Dg=["open"],Ng=["innerHTML"],Ug=["open"],qg={class:"console-module__summary"},Qg={class:"console-module__count"},Jg={class:"job-detail__plan-list"},Bg={class:"job-detail__plan-summary"},Mg={class:"job-detail__plan-index"},Vg={class:"job-detail__plan-title"},Gg={key:0,class:"job-detail__plan-deps"},Hg=["innerHTML"],zg=["open"],Yg={class:"console-module__summary"},Zg={class:"console-module__count"},eb={key:0,class:"job-detail__status-line"},ab={key:1,class:"job-detail__status-line job-detail__status-line--error"},tb={class:"dag"},sb={class:"dag__phase-row"},lb={class:"dag__phase-label"},nb=["onClick"],ob={class:"dag__node-index"},rb={class:"dag__node-label"},ib={key:0,class:"console-badge console-badge--small console-badge--attention",title:"Added after approval — not part of the approved plan"},ub={key:1,class:"dag__node-usage"},cb={key:0,class:"dag__detail"},db={class:"dag__detail-header"},pb={class:"dag__detail-title-row"},vb={class:"dag__detail-index"},kb={key:0,class:"console-badge console-badge--small console-badge--attention"},gb={class:"dag__detail-title"},bb=["innerHTML"],mb={class:"job-detail__diag-grid"},_b={class:"job-detail__diag-item"},hb={key:0,class:"job-detail__diag-item"},yb={key:1,class:"job-detail__diag-item"},fb={key:2,class:"job-detail__diag-item"},wb={key:3,class:"job-detail__diag-item"},Lb={key:4,class:"job-detail__diag-item"},Cb={key:5,class:"job-detail__diag-item"},Eb={key:6,class:"job-detail__diag-item"},Rb={key:7,class:"job-detail__diag-item"},Ib={key:8,class:"job-detail__diag-item"},jb={key:9,class:"job-detail__diag-item"},Ab={key:10,class:"job-detail__diag-item"},Wb={key:0,class:"job-detail__failure-block"},Sb={class:"job-detail__failure-text"},Xb={key:1,class:"job-detail__stalled-note"},xb={key:2,class:"job-detail__actions-row"},Tb=["disabled"],Pb=["disabled"],$b={class:"job-detail__actions-row"},Fb=["disabled"],Kb={key:4,class:"job-detail__status-line job-detail__status-line--error"},Ob={class:"job-detail__subsection"},Db={class:"job-detail__subsection-header"},Nb=["disabled"],Ub={key:0,class:"job-detail__status-line job-detail__status-line--error"},qb={key:1,class:"job-detail__status-line"},Qb=["innerHTML"],Jb={key:3,class:"job-detail__status-line"},Bb=["open"],Mb={key:0,class:"job-detail__status-line"},Vb={key:1,class:"job-detail__status-line"},Gb={key:2,class:"job-detail__status-line"},Hb={key:3,class:"job-detail__status-line job-detail__status-line--error"}
1,zb={key:4,class:"job-detail__conversation-body"},Yb={key:0,class:"job-detail__conversation-system"},Zb={class:"job-detail__conversation-pre"},em={class:"job-detail__conversation-role"},am={class:"job-detail__conversation-pre"},tm={key:1,class:"job-detail__status-line"},sm={key:5,class:"job-detail__status-line"},lm={key:2,class:"job-detail__status-line"},nm=["open"],om={key:0,class:"job-detail__status-line"},rm=["innerHTML"],im={key:2,class:"job-detail__acceptance"},um={key:3,class:"job-detail__findings"},cm={class:"job-detail__finding-body"},dm={class:"job-detail__finding-meta"},pm={class:"job-detail__finding-location"},vm={key:0,class:"job-detail__finding-rule"},km={class:"job-detail__finding-description"},gm={key:13,class:"console-module"},bm={class:"job-detail__diagnostics-grid"},mm={key:0,class:"job-detail__diagnostic-block"},_m={class:"job-detail__diagnostic-list"},hm={key:1,class:"job-detail__diagnostic-block"},ym={class:"job-detail__diagnostic-list"},fm={key:2,class:"job-detail__diagnostic-block"},wm={class:"job-detail__diagnostic-list"},Lm={class:"console-module"},Cm={class:"job-detail__meta-list"},Em={class:"job-detail__mono"},Rm={key:0},Im=["disabled"],jm={key:14,class:"job-detail__message"},Am=5e3,Wm=5,Sm=67108864,Xm=245760,xm={__name:"ConsoleJobDetail",setup(e){const a=(0,r.lq)(),t=(0,r.rd)(),{request:i,requestJson:u}=el(),c=k().child("[ConsoleJobDetail]"),d=new Set(["planning","awaiting_input","pending_approval","approved","running","delivering","waiting_credentials","synthesizing"]),p=a.params.id,v=(0,o.KR)(!0),g=(0,o.KR)(""),b=(0,o.KR)(!1),m=(0,o.KR)(""),_=(0,o.KR)(null),h=(0,o.KR)(!1),y=(0,o.KR)(!1),f=(0,o.KR)(!1),w=(0,o.KR)(0),L=(0,l.EW)(()=>{const e=_.value?.recommendation;return"new-workspace"===e?"create a new workspace":"sync"===e?"sync to latest":"continue"===e?"continue with current":e||"create a new workspace"}),C=(0,l.EW)(()=>{const e=Number(_.value?.commitsBehind??0);return`${e} commit${1===e?"":"s"} behind`});function E(e){const a=_.value?.recommendation||"new-workspace";return a===e?"button button--primary":"button"}const R=(0,o.KR)(Il({id:p,phase:"PLANNING",createdAt:(new Date).toISOString()})),I=(0,o.KR)(null),j=(0,o.KR)([]),A=(0,o.KR)(!1),W=(0,o.KR)(""),S=(0,o.KR)(null),X=(0,o.KR)([]),x=(0,o.KR)({}),T=(0,o.KR)({}),P=(0,o.KR)({}),$=(0,o.KR)({}),F=(0,o.KR)({}),K=(0,o.KR)({}),O=(0,o.KR)({}),D=(0,o.KR)(null),N=(0,o.KR)(null),U=(0,o.KR)(null),q=(0,o.KR)(null),Q=(0,o.KR)(""),J=(0,o.KR)(""),B=(0,o.KR)(!1);let M=null,V=0;const G=(0,l.EW)(()=>R.value.workspace??{}),H=(0,l.EW)(()=>R.value.workspaceId??G.value.id??""),z=(0,l.EW)(()=>G.value.name||H.value||"Unknown"),Y=(0,l.EW)(()=>jl(R.value.description,p,60)),Z=(0,l.EW)(()=>B.value||wa(R.value.status)),ee=[{phase:"bootstrap",display:"Reading requirements"},{phase:"s2",display:"Mapping dependencies"},{phase:"s3",display:"Drafting steps"},{phase:"s4",display:"Grounding files & finalizing the plan"}],ae=(0,l.EW)(()=>"planning"===R.value.status),te=(0,l.EW)(()=>{const e=(R.value.plannerPhase||"").replace(/^planner-/,"").toLowerCase();if(!e)return null;const a=ee.findIndex(a=>a.phase===e),t=a>=0?ee[a].display:`Planning (${e})`;return{current:a>=0?a+1:ee.length,total:ee.length,display:t,content:t}}),se=(0,l.EW)(()=>"synthesizing"===R.value.status),le=(0,l.EW)(()=>["running","delivering","synthesizing","approved"].includes(R.value.status)),ne=(0,l.EW)(()=>"claude-code"===R.value.runtime),oe=(0,l.EW)(()=>ne.value&&Wl(R.value.status)&&"pending_approval"!==R.value.status),re=(0,l.EW)(()=>We.value.some(e=>"string"===typeof e.failureReason&&e.failureReason.trim().length>0)),ie=(0,l.EW)(()=>"failed"!==R.value.status||re.value?"":"string"===typeof R.value.error?R.value.error.trim():""),ue=(0,l.EW)(()=>
1"waiting_credentials"!==R.value.status?"":"string"===typeof R.value.error?R.value.error.trim():""),ce=new Set(["git_expired","git_insufficient_scope","claude_auth","claude_quota"]),de=(0,l.EW)(()=>{const e=R.value.pauseAuthFailure;return"string"===typeof e&&ce.has(e)?e:null}),pe=new Set(["PLANNING","EXECUTING","DELIVERING","SYNTHESIZING"]),ve=(0,l.EW)(()=>{const e=R.value.resumePhase;return"string"===typeof e&&pe.has(e)?e:null}),ke=(0,l.EW)(()=>{const e=R.value.status;if("planning"===e)return{label:"Planning",text:"Planner is building the execution plan.",tone:"active"};if("awaiting_input"===e)return{label:"Input Required",text:"Waiting for your input before planning can continue.",tone:"attention"};if("pending_approval"===e)return{label:"Review",text:"Plan is ready for your review and approval.",tone:"attention"};if("approved"===e||"running"===e){const e=R.value.completedBeads??0,a=R.value.totalBeads??0;return{label:"Executing",text:`Running steps — ${e}/${a} complete.`,tone:"active"}}return"delivering"===e?{label:"Delivering",text:"All steps complete. Delivering results to the target branch.",tone:"active"}:"waiting_credentials"===e?{label:"Credentials Needed",text:"This run is paused waiting for updated workspace credentials.",tone:"attention"}:"synthesizing"===e?{label:"Synthesizing",text:"All steps complete. Synthesizing results.",tone:"active"}:"completed"===e?{label:"Complete",text:"Run completed successfully.",tone:"ready"}:"failed"===e?{label:"Failed",text:"Run failed.",tone:"failed"}:null}),ge={passed:"Passed",failed:"Failed",degraded:"Degraded",skipped:"Skipped"};function be(e){return"passed"===e?"ready":"degraded"===e?"attention":"failed"===e?"failed":"neutral"}const me=(0,l.EW)(()=>{const e=R.value.preflight;if(!e||"object"!==typeof e||Array.isArray(e))return null;const a="string"===typeof e.verdict?e.verdict:"";if("degraded"!==a&&"blocked"!==a)return null;const t=Array.isArray(e.checks)?e.checks:[],s=t.map(e=>({name:"string"===typeof e?.name?e.name:"unknown",tone:be(e?.status),statusLabel:ge[e?.status]??(e?.status||"unknown"),message:"string"===typeof e?.message?e.message:""}));return{verdict:a,verdictLabel:"blocked"===a?"Blocked":"Degraded",verdictTone:"blocked"===a?"failed":"attention",summary:"blocked"===a?"This run was blocked before planning and stopped. Resolve the failed preflight checks below, then resubmit.":"Planning will proceed, but these preflight checks are degraded. Review each one below — its message has the specifics.",checks:s}}),_e=(0,l.EW)(()=>["completed","failed","cancelled"].includes(R.value.status)),he=(0,l.EW)(()=>(R.value.description?.length??0)<200),ye=(0,l.EW)(()=>Array.isArray(R.value.plan)&&R.value.plan.length>0),fe=(0,l.EW)(()=>{const e=I.value?.summary;return"string"===typeof e?e.trim():""}
1),we=(0,l.EW)(()=>ir(R.value.description??"")),Le=(0,l.EW)(()=>ir(fe.value)),Ce=(0,l.EW)(()=>{const e=I.value?.analytics;return e&&"object"===typeof e?e:null}),Ee=(0,l.EW)(()=>Array.isArray(Ce.value?.evidence_used?.standards)?Ce.value.evidence_used.standards:[]),Re=(0,l.EW)(()=>Array.isArray(Ce.value?.guidance_gaps)?Ce.value.guidance_gaps:[]),Ie=(0,l.EW)(()=>Array.isArray(Ce.value?.trouble_spots)?Ce.value.trouble_spots:[]),je=(0,l.EW)(()=>Ee.value.length>0||Re.value.length>0||Ie.value.length>0),Ae=(0,l.EW)(()=>{const e=Array.isArray(R.value.plan)?R.value.plan:[];return e.filter(e=>"number"===typeof e?.index).map(e=>({index:e.index,title:jl("string"===typeof e.task?e.task:"",`#${e.index}`,60),task:"string"===typeof e.task?e.task:`Step #${e.index}`,deps:Array.isArray(e.depends_on)&&e.depends_on.length?e.depends_on.map(e=>`#${e}`).join(", "):""})).sort((e,a)=>e.index-a.index)}),We=(0,l.EW)(()=>{const e=new Map,a=new Set(Ae.value.map(e=>e.index));for(const t of Ae.value)e.set(t.index,{index:t.index,beadId:String(t.index),title:t.title,fullTitle:t.task,prompt:t.task,status:"planned",statusLabel:"planned",tone:"neutral",dependsOn:Ne(t.deps),dependsOnLabel:t.deps,blockedBy:[],blockedByLabel:"",isLive:!1,canKill:!1,canRetry:!1,canSkip:!1,usageLabel:"",durationLabel:"",costLabel:"",budgetLabel:"",runId:null,isStalled:!1});for(const t of j.value){const a=e.get(t.index)??{};e.set(t.index,{...a,...t,title:t.title,fullTitle:t.fullTitle,prompt:t.prompt,dependsOnLabel:t.dependsOn.length?t.dependsOn.map(e=>`#${e}`).join(", "):"",blockedByLabel:t.blockedBy.length?t.blockedBy.map(e=>`#${e}`).join(", "):"",usageLabel:ea(t.usage),durationLabel:aa(t.usage?.durationMs),costLabel:ta(t.usage?.estimatedCostUSD),budgetLabel:ta(t.maxCostUSD),isStalled:sa(t)})}return[...e.values()].map(e=>({...e,addedAfterApproval:a.size>0&&!a.has(e.index)})).sort((e,a)=>e.index-a.index)}),Se=(0,l.EW)(()=>We.value.filter(e=>"completed"===e.status).length),Xe=(0,l.EW)(()=>We.value.length>0&&"pending_approval"!==R.value.status),xe=(0,l.EW)(()=>fe.value||De.value.length>0||Ve.value.length>0),Te=(0,l.EW)(()=>null==S.value?null:We.value.find(e=>e.index===S.value)??null),Pe=(0,l.EW)(()=>{if(!Te.value)return null;const e=Te.value.beadId;if(void 0!==x.value[e])return x.value[e];if(void 0!==Te.value.outputInline&&null!==Te.value.outputInline)return Te.value.outputInline;const a=Array.isArray(I.value?.beadOutputs)?I.value.beadOutputs.find(a=>String(a.beadId??a.index??"")===e):null;return a??null}),$e=(0,l.EW)(()=>Te.value?$.value[Te.value.beadId]??null:null),Fe=(0,l.EW)(()=>{const e=We.value;if(!e.length)return{columns:1,phases:[]};const a=new Map;function t(s){if(a.has(s.index))return a.get(s.index);if(!s.dependsOn.length)return a.set(s.index,0),0;let l=0;for(const a of s.dependsOn){const s=e.find(e=>e.index===a);s&&(l=Math.max(l,t(s)+1))}return a.set(s.index,l),l}for(const r of e)t(r);const s=new Map;for(const r of e){const e=a.get(r.index);s.has(e)||s.set(e,[]),s.get(e).push(r)}const l=[...s.keys()].sort((e,a)=>e-a);let n=1;for(const r of s.values())n=Math.max(n,r.length);const o=new Map;for(const r of l){const e=[...s.get(r)].sort((e,a)=>e.index-a.index);if(0===r){for(let a=0;a<e.length;a+=1){const t=Math.round(a*n/e.length)+1,s=Math.max(t+1,Math.round((a+1)*n/e.length)+1);o.set(e[a].index,{colStart:t,colEnd:s})}continue}const a=e.map(e=>{let a=n+1,t=0,s=0,l=0;for(const n of e.dependsOn){const e=o.get(n);e&&(a=Math.min(a,e.colStart),t=Math.max(t,e.colEnd),s+=(e.colStart+e.colEnd)/2,l+=1)}return a>t&&(a=1,t=n+1),{entry:e,minCol:a,maxCol:t,barycenter:l>0?s/l:(n+1)/2}}).sort((e,a)=>e.barycenter-a.barycenter);for(let t=0;t<a.length;t+=1){const e=Math.round(a[t].minCol+(a[t].maxCol-a[t].minCol)*t/a.length),s=Math.max(e+1,Math.round(a[t].minCol+(a[t].maxCol-a[t].minCol)*(t+1)/a.length));o.set(a[t].entry.index,{colStart:e,colEnd:s})}}return{columns:n,phases:l.map(e=>({depth:e,items:[...s.get(e)].sort((e,a)=>(o.get(e.index)?.colStart??0)-(o.get(a.index)?.colStart??0)).map(e=>({bead:e,...o.get(e.index)}))}))}}),Ke=(0,l.EW)(()=>{const e=Array.isArray(R.value.questions)?R.value.questions:[],a=qe(R.value.answers
1);return e.map((e,t)=>({index:t,label:e,answer:a.get(String(t))||""}))}),Oe=(0,l.EW)(()=>Ke.value.length>0&&Ke.value.every(e=>{const a=X.value[e.index];return"string"===typeof a&&a.trim().length>0})),De=(0,l.EW)(()=>{const e=Array.isArray(I.value?.acceptanceClosure)?I.value.acceptanceClosure:[];return e.map(e=>({item:Ue(e?.item),label:Rl(e?.status||"unreported"),tone:Qe(e?.status)})).filter(e=>e.item)});function Ne(e){return e?String(e).split(",").map(e=>Number(e.replace("#","").trim())).filter(e=>Number.isFinite(e)):[]}function Ue(e){return"string"===typeof e?e.replace(/\s+/g," ").trim():""}function qe(e){if(!e||"object"!==typeof e)return new Map;const a=Array.isArray(e)?e.map((e,a)=>[String(a),e]):Object.entries(e);return new Map(a.filter(([,e])=>"string"===typeof e).map(([e,a])=>[String(e),a.trim()]))}function Qe(e){return"satisfied"===e?"ready":"partial"===e?"pending":"unmet"===e?"failed":"neutral"}const Je={BLOCKING:"failed",HIGH:"attention",MEDIUM:"pending",SUGGESTION:"neutral"};function Be(e){return Je[e]??"neutral"}function Me(e){const a="string"===typeof e.file?e.file.trim():"",t="number"===typeof e.line||"string"===typeof e.line?String(e.line).trim():"";return a&&t?`${a}:${t}`:a||t||"unknown location"}const Ve=(0,l.EW)(()=>{const e=Array.isArray(I.value?.beadOutputs)?I.value.beadOutputs:[],a=[];return e.forEach((e,t)=>{if("review"!==e?.type)return;const s=e?.output?.reviewFindings;Array.isArray(s)&&s.forEach((s,l)=>{if(!s||"object"!==typeof s)return;const n="string"===typeof s.severity?s.severity:null,o="string"===typeof s.description?s.description.trim():"";n&&o&&a.push({key:`${e.index??t}-${l}`,severity:n,tone:Be(n),location:Me(s),rule:"string"===typeof s.rule?s.rule.trim():"",description:o})})}),a});function Ge(e){const a=(e?.state||e?.status||"").toUpperCase();return"RUNNING"===a||"CLAIMED"===a||"READY"===a||"WAITING"===a}function He(e){const a={WAITING:"queued",READY:"queued",RUNNING:"in_progress",COMPLETED:"completed",FAILED:"failed",BLOCKED:"blocked",SKIPPED:"skipped"};return a[e]??(String(e||"").toLowerCase()||"unknown")}function ze(e){return"completed"===e?"ready":"in_progress"===e?"active":"failed"===e||"blocked"===e?"failed":"queued"===e||"skipped"===e?"pending":"neutral"}function Ye(e){const a=Number(e.index),t=He(e.state),s="string"===typeof e.task&&e.task.trim()?e.task:`${e.type??"step"} #${a}`,l=Array.isArray(e.depends_on)?e.depends_on.map(e=>Number(e)).filter(e=>Number.isFinite(e)):[],n=Array.isArray(e.blocks)?e.blocks.map(e=>String(e)):[],o=String(a),r=`${p}-${a}`,i=e.runId??e.currentRunId??e.run_id??e.current_run_id,u=Number(e.run_count),c=Number.isFinite(Number(i))?Number(i):Number.isFinite(u)&&u>0?u-1:null,d="string"===typeof e.error?e.error:"";return{...e,index:a,beadId:o,artifactBeadId:r,title:jl(s,`#${a}`,42),fullTitle:s,prompt:s,role:e.type??e.role??"",beadType:e.type??e.beadType??"",status:t,statusLabel:Rl(t),tone:ze(t),dependsOn:l,blockedBy:n,failureReason:d,updatedAt:e.updatedAt??e.completedAt??e.startedAt??e.createdAt??R.value.updatedAt,lastTelemetryAt:Ze(e.lastTelemetryAt??e.last_telemetry_at??e.latestTelemetryAt??e.latest_telemetry_at??e.telemetryUpdatedAt??e.telemetry_updated_at),usage:e.usage??null,maxCostUSD:"number"===typeof e.maxCostUSD?e.maxCostUSD:null,outputInline:e.output??null,runId:c,isLive:!0,canKill:["queued","in_progress"].includes(t),canRetry:"failed"===t&&!d.startsWith("Dependency"),canSkip:"failed"===t&&!d.startsWith("Dependency")}}function Ze(e){if("number"===typeof e&&Number.isFinite(e)){const a=new Date(e);return Number.isFinite(a.getTime())?a.toISOString():""}if("string"===typeof e){const a=Date.parse(e);if(!Number.isFinite(a))return"";const t=new Date(a);return Number.isFinite(t.getTime())?t.toISOString():""}return""}function ea(e){if(!e)return"";const a=[];return e.inputTokens&&a.push(`${Number(e.inputTokens).toLocaleString()} in`),e.outputTokens&&a.push(`${Number(e.outputTokens).toLocaleString()} out`),a.join(" / ")}function aa(e){if(!e)return"";const a=Number(e);if(!Number.isFinite(a)||a<=0)return"";if(a<1e3)return`${a}ms`;const t=Math.round(a/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function ta(e){return"number"!==typeof e||Number.isNaN(e)?"":`$${e.toFixed(2)}`}function sa(e){if("in_progress"!==e.status)return!1;if(e.usage)return!1;if(e.lastTelemetryAt){const a=Date.now()-new Date(e.lastTelemetryAt).getTime();if(Number.isFinite(a)&&a<18e5)return!1}if(!e.updatedAt)return!1;const a=Date.now()-new Date(e.updatedAt).getTime();return Number.isFinite(a)&&a>18e5}function la(e){const a="string"===typeof e?e:JSON.stringify(e,null,2);return na(a)?`\`\`\`\n${a}\n\`\`\``:a}function na(e){if(!e||"string"!==typeof e)return!1;const a=e.trim();return!(!a.startsWith("{")&&!a.startsWith("["))||a.includes("\n")&&!/^#{1,6}\s/m.test(a)}function oa(e){return"string"===typeof e?e:Array.isArray(e)?e.map(e=>"string"===typeof e?e:e?.text?e.text:e?.toolUse?`[Tool ${e.toolUse.name}] ${JSON.stringify(e.toolUse.input,null,2)}`:e?.toolResult?`[Result] ${JSON.stringify(e.toolResult,null,2)}`:"tool_use"===e?.type?`[Tool ${e.name}] ${JSON.stringify(e.input,null,2)}`:"tool_result"===e?.type?`[Result] ${JSON.stringify(e.content,null,2)}`:JSON.stringify(e,null,2)).join("\n"):JSON.stringify(e,null,2)}function ra(e){if(!e||"object"!==typeof e)return"";const a=[],t=oa(e.content);if(t&&a.push(t),e.toolUse&&"object"===typeof e.toolUse){const t=e.toolUse.toolName||e.toolUse.name||"tool",s=e.toolUse.argsJson??e.toolUse.input??"";a.push(`[Tool ${t}] ${"string"===typeof s?s:JSON.stringify(s,null,2)}`)}if(e.toolResult&&"object"===typeof e.toolResult){const t=e.toolResult.toolName||e.toolResult.name||"tool",s=e.toolResult.resultJson??e.toolResult.content??"";a.push(`[Result ${t}] ${"string"===typeof s?s:JSON.stringify(s,null,2)}`)}
1return a.filter(Boolean).join("\n\n")}function ia(e){return e&&"object"===typeof e?{systemPrompt:"string"===typeof e.systemPrompt?e.systemPrompt:"",messages:Array.isArray(e.messages)?e.messages.map(e=>({role:"string"===typeof e?.role?e.role:"unknown",content:ra(e)})):[]}:null}const ua=/^[0-9a-f]{64}$/;function ca(e){return"string"===typeof e&&e.length>0}function da(e,a){return"number"===typeof e&&Number.isInteger(e)&&e>0&&e<=a}function pa(e){return"string"===typeof e&&ua.test(e)}function va(e){return"string"===typeof e&&e.length>0&&Number.isFinite(Date.parse(e))}function ka(e){return"number"===typeof e&&Number.isFinite(e)&&e>=0}function ga(e,a){return!e||"object"!==typeof e||Array.isArray(e)?`messages[${a}]: expected a message object`:"user"!==e.role&&"assistant"!==e.role&&"system"!==e.role?`messages[${a}].role: expected "user" | "assistant" | "system"`:"string"!==typeof e.content?`messages[${a}].content: expected a string`:""}function ba(e,a){if(!e||"object"!==typeof e||Array.isArray(e))return`${a}: expected a BeadConversation object`;if("string"!==typeof e.systemPrompt)return`${a}.systemPrompt: expected a string`;if(!Array.isArray(e.messages))return`${a}.messages: expected an array`;if(!Array.isArray(e.tokenUsage))return`${a}.tokenUsage: expected an array`;if("completed"!==e.status&&"failed"!==e.status)return`${a}.status: expected "completed" | "failed"`;if(!ka(e.totalDurationMs))return`${a}.totalDurationMs: expected a non-negative number`;if("boolean"!==typeof e.partial)return`${a}.partial: expected a boolean`;for(let t=0;t<e.messages.length;t+=1){const s=ga(e.messages[t],t);if(s)return`${a}.${s}`}for(let t=0;t<e.tokenUsage.length;t+=1){const s=e.tokenUsage[t];if(!s||"object"!==typeof s||!ka(s.inputTokens)||!ka(s.outputTokens))return`${a}.tokenUsage[${t}]: expected { inputTokens >= 0, outputTokens >= 0 }`}return""}function ma(e){if(!e||"object"!==typeof e||Array.isArray(e))return'response is not an object with kind "inline" | "download"';if("inline"===e.kind){const a=ba(e.conversation,"conversation");return a||(da(e.byteLength,Xm)?pa(e.sha256)?"":'sha256: kind "inline" response must carry a 64-char lowercase hex sha256':`byteLength: kind "inline" response must carry a positive integer byte count <= ${Xm} (CONVERSATION_INLINE_BYTE_CAP)`)}return"download"===e.kind?ca(e.downloadUrl)?da(e.byteLength,Sm)?pa(e.sha256)?va(e.expiresAt)?"":'expiresAt: kind "download" response must carry an ISO 8601 timestamp':'sha256: kind "download" response must carry a 64-char lowercase hex sha256':`byteLength: kind "download" response must carry a positive integer byte count <= ${Sm} (CONVERSATION_ARTIFACT_BYTE_CAP)`:'downloadUrl: kind "download" response must carry a non-empty downloadUrl string':`kind: unrecognized conversation response kind ${JSON.stringify(e.kind)} (expected "inline" or "download")`}async function _a(e){const a=ma(e);if(a)throw new Error(`Malformed transcript response (${a})`);if("inline"===e.kind)return e.conversation;let t,s;try{t=await fetch(e.downloadUrl)}catch(n){throw new Error(`Could not reach transcript storage (network or CORS error): ${n?.message??n}`)}if(!t.ok)throw new Error(`Failed to download transcript (HTTP ${t.status})`);try{s=await t.json()}catch(o){throw new Error(`Malformed transcript download (body is not valid JSON: ${o?.message??o})`)}const l=ba(s,"downloaded transcript");if(l)throw new Error(`Malformed transcript download (${l})`);return s}function ha(e){return e&&"object"===typeof e?e.label||e.summary||e.query||e.topic||Rl(e.kind||e.gap_type||"unknown"):"Unknown diagnostic"}function ya(e){if(!e||"object"!==typeof e)return"Evidence";const a=[e.query||e.title||e.standard_id||"Evidence"];return e.source&&a.push(`(${Rl(e.source)})`),a.join(" ")}function fa(){if(!Ke.value.length)return void(X.value=[]);const e=X.value.some(e=>"string"===typeof e&&e.trim().length>0);if(e)return;const a=qe(R.value.answers);X.value=Ke.value.map(e=>a.get(String(e.index))||"")}function wa(e){return d.has(e)}function La(){null!==M&&(clearTimeout(M),M=null),V=0}function Ca(){null===M&&wa(R.value.status)&&(M=setTimeout(async()=>{M=null,await Wa()},Am))}function Ea(){wa(R.value.status)?Ca():La()}async function Ra(){const e=await u(`/jobs/${p}`);R.value=Il(e),fa()}async function Ia({background:e=!1}={}){if(H.value){e||(A.value=!0,W.value="");try{const e=await u(`/jobs/${H.value}/${p}/beads`),a=Array.isArray(e)?e:e.beads??[];j.value=a.map(Ye),W.value=""}catch(a){e||(j.value=[],W.value="Step state is not available for this run.",c.warn("Failed to fetch run steps",a))}finally{e||(A.value=!1)}}}async function ja({background:e=!1}={}){if(H.value)try{const e=await u(`/jobs/${H.value}/${p}/results`);I.value=e.results??null}catch(a){e||(I.value=null,c.warn("Failed to fetch run results",a))}}async function Aa({showLoading:e=!1}={}){e&&(v.value=!0),La(),g.value="",m.value="",W.value="";try{await Ra(),Ea(),v.value=!1;const e=ae.value?[]:[Ia(),ja()];Promise.allSettled(e)}catch(a){g.value="Failed to load run.",c.warn("Failed to fetch run detail",a),v.value=!1}}async function Wa(){B.value=!0;try{await Ra(),V=0;const e=ae.value?[]:[Ia({background:!0}),ja({background:!0})];await Promise.allSettled(e),Ea()}catch(e){V+=1,c.warn("Failed to poll run detail",e),V<Wm&&Ca()}finally{B.value=!1}}
1function Sa(e){if(J.value="",S.value=S.value===e?null:e,null!==S.value){const e=We.value.find(e=>e.index===S.value);e?.isLive&&Xa(e)}}async function Xa(e){if(!H.value||!e?.isLive)return;const a=e.beadId;if(!T.value[a]){T.value={...T.value,[a]:!0},P.value={...P.value,[a]:""};try{const t=await i(`/jobs/${H.value}/${p}/beads/${e.index}/output`);if(!t.ok){if(404===t.status)return void(x.value={...x.value,[a]:{_noOutput:!0}});throw new Error(t.data?.error||t.data?.message||`HTTP ${t.status}`)}x.value={...x.value,[a]:t.data.output}}catch(t){P.value={...P.value,[a]:t.message}}finally{T.value={...T.value,[a]:!1}}}}async function xa(e,a){if(!a.target.open||!H.value||null==e?.runId)return;const t=e.beadId;if(!$.value[t]&&!F.value[t]){F.value={...F.value,[t]:!0},K.value={...K.value,[t]:""},O.value={...O.value,[t]:""};try{const a=await i(`/beads/${H.value}/${p}/${e.artifactBeadId}/runs/${e.runId}/conversation`);if(!a.ok){const e=a.data?.error||a.data?.message||`HTTP ${a.status}`;K.value={...K.value,[t]:e};const s=404===a.status?"unavailable":"load-failed";return void(O.value={...O.value,[t]:s})}const s=await _a(a.data);$.value={...$.value,[t]:ia(s)}}catch(s){K.value={...K.value,[t]:s.message},O.value={...O.value,[t]:"load-failed"}}finally{F.value={...F.value,[t]:!1}}}}function Ta(e){return`${p}-${e.beadId}`}function Pa(e){q.value=e.index,Q.value=Fa(e),J.value=""}function $a(){q.value=null,Q.value="",J.value=""}function Fa(e){const a="number"===typeof e.usage?.estimatedCostUSD?e.usage.estimatedCostUSD:0,t="number"===typeof e.maxCostUSD?e.maxCostUSD:2;return Math.max(1.5*a,1.5*t,.5).toFixed(1)}async function Ka(){I.value=null,await Promise.allSettled([Ra(),Ia(),ja()]),Ea()}async function Oa(e){U.value=e.index,J.value="";try{const a={},t=Number(Q.value);Number.isFinite(t)&&t>0&&(a.maxCostUSD=t),await u(`/beads/${Ta(e)}/run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),$a(),await Ka()}catch(a){J.value=a.message||"Failed to retry step.",c.warn("Failed to retry step",a)}finally{U.value=null}}async function Da(e){D.value=e.index,J.value="";try{await u(`/beads/${Ta(e)}/kill`,{method:"POST"}),await Ka()}catch(a){J.value=a.message||"Failed to kill step.",c.warn("Failed to kill step",a)}finally{D.value=null}}async function Na(e){N.value=e.index,J.value="";try{await u(`/beads/${Ta(e)}/skip`,{method:"POST"}),await Ka()}catch(a){J.value=a.message||"Failed to skip step.",c.warn("Failed to skip step",a)}finally{N.value=null}}async function Ua(){if(H.value){b.value=!0,m.value="";try{const e=Object.fromEntries(Ke.value.map(e=>[String(e.index),X.value[e.index].trim()]));await u(`/jobs/${H.value}/${p}/answers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:e})}),m.value="Answers submitted.",await Aa()}catch(e){m.value=`Failed: ${e.message}`,c.warn("Failed to submit answers",e)}finally{b.value=!1}}}async function qa(){if(H.value&&ve.value){b.value=!0,m.value="";try{const e=await u(`/jobs/${H.value}/${p}/resume`,{method:"POST"}),a=e&&"object"===typeof e?e.phase:void 0;m.value=a?`Resume requested — run returning to ${a}.`:"Resume requested.",await Aa()}catch(e){m.value=`Failed: ${e.message}`,c.warn("Failed to resume run",e)}finally{b.value=!1}}}async function Qa(){if(H.value){b.value=!0,m.value="",_.value=null;try{const e=await i(`/jobs/${H.value}/${p}/approve`,{method:"POST"}),a=await cr.resolveTaskResponse({request:i,workspaceId:H.value,response:e});if(a&&!0===a.stale&&a.staleness)return _.value=a.staleness,void(m.value="Workspace is behind the target branch — choose how to proceed.");m.value="Plan approved.",await Aa()}catch(e){m.value=`Failed: ${e.message}`,c.warn("Failed to approve run plan",e)}finally{b.value=!1}}}async function Ja(e){if(H.value&&!h.value){h.value=!0,m.value="";try{const a=await i(`/workspaces/${H.value}/staleness/decide`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jobId:p,decision:e})}),s=await cr.resolveTaskResponse({request:i,workspaceId:H.value,response:a});if(_.value=null,"new-workspace"===e&&s&&s.newWorkspaceId)return void t.push({name:"ConsoleWorkspaceDetail",params:{id:s.newWorkspaceId}});await Aa(),m.value="continue"===e?"Plan approved against the current workspace baseline.":"Workspace updated — execution is starting."}catch(a){m.value=`Failed: ${a.message}`,c.warn("Failed to submit staleness decision",a)}finally{h.value=!1}}}async function Ba(){if(!H.value)return;const e=w.value+=1;
1try{const a=await i(`/workspaces/${H.value}/staleness`),t=await cr.resolveTaskResponse({request:i,workspaceId:H.value,response:a});if(w.value!==e||"pending_approval"!==R.value.status||f.value)return;_.value=t&&!0===t.stale&&t.staleness?t.staleness:null}catch(a){if(c.warn("Failed to perform upfront staleness check",a),w.value!==e||"pending_approval"!==R.value.status)return;y.value=!1,_.value||(m.value="Could not check workspace freshness automatically — click Approve Plan to continue.")}}function Ma(){_.value=null,f.value=!0,m.value=""}async function Va(){if(H.value){b.value=!0,m.value="";try{await u(`/jobs/${H.value}/${p}`,{method:"DELETE"}),t.push({name:"ConsoleJobs"})}catch(e){m.value=`Delete failed: ${e.message}`,c.warn("Failed to delete run",e)}finally{b.value=!1}}}return(0,l.wB)(()=>R.value.status,e=>{"pending_approval"===e?y.value||(y.value=!0,Ba()):(y.value=!1,f.value=!1)}),(0,l.wB)(()=>R.value.status,e=>{e&&"pending_approval"!==e&&(_.value=null)}),(0,l.sV)(()=>{Aa({showLoading:!0})}),(0,l.hi)(()=>{La()}),(e,a)=>{const t=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("div",Bk,[(0,l.Lk)("div",Mk,[(0,l.Lk)("div",null,[(0,l.Lk)("h1",Vk,(0,n.v_)(Y.value),1),(0,l.Lk)("p",Gk,[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${R.value.tone}`])},(0,n.v_)(R.value.statusLabel),3),Xe.value?((0,l.uX)(),(0,l.CE)("span",Hk,(0,n.v_)(R.value.completedBeads??0)+"/"+(0,n.v_)(R.value.totalBeads??We.value.length)+" steps",1)):(0,l.Q3)("",!0),(0,l.Lk)("span",zk,(0,n.v_)((0,o.R1)(Xl)(R.value.updatedAt)),1)]),(0,l.bF)(Ll,{active:Z.value,busy:B.value,"idle-label":"Watching run status every 5s","busy-label":"Refreshing run status...",tone:"pending"},null,8,["active","busy"])]),(0,l.Lk)("div",Yk,[(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:v.value||b.value||h.value,onClick:a[0]||(a[0]=e=>Aa({showLoading:!0}))}," Refresh ",8,Zk),H.value?((0,l.uX)(),(0,l.Wv)(t,{key:0,to:{name:"ConsoleWorkspaceDetail",params:{id:H.value}},class:"button button--ghost"},{default:(0,l.k6)(()=>[...a[12]||(a[12]=[(0,l.eW)(" Workspace ",-1)])]),_:1},8,["to"])):(0,l.Q3)("",!0)])]),(0,l.Lk)("section",{class:(0,n.C4)(["console-panel",`console-panel--${R.value.tone}`])},[(0,l.bF)(hl,{loading:v.value,error:g.value,"is-empty":!1,"loading-message":"Loading run..."},{default:(0,l.k6)(()=>[ke.value?((0,l.uX)(),(0,l.CE)("div",{key:0,class:(0,n.C4)(["console-signal",`console-signal--${ke.value.tone}`]),style:{"margin-bottom":"16px"}},[(0,l.Lk)("span",eg,(0,n.v_)(ke.value.label),1),(0,l.Lk)("span",ag,(0,n.v_)(ke.value.text),1)],2)):(0,l.Q3)("",!0),ie.value?((0,l.uX)(),(0,l.CE)("div",tg,[a[13]||(a[13]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Failure details",-1)),(0,l.Lk)("pre",sg,(0,n.v_)(ie.value),1)])):(0,l.Q3)("",!0),"pending_approval"!==R.value.status||_.value?(0,l.Q3)("",!0):((0,l.uX)(),(0,l.CE)("div",lg,[a[14]||(a[14]=(0,l.Lk)("p",null,[(0,l.Lk)("strong",null,"Plan ready for review."),(0,l.eW)(" Approve to begin execution.")],-1)),(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:b.value,onClick:Qa},(0,n.v_)(b.value?"Working...":"Approve Plan"),9,ng)])),_.value?((0,l.uX)(),(0,l.CE)("div",og,[(0,l.Lk)("p",rg,[(0,l.Lk)("strong",null,"Workspace is behind "+(0,n.v_)(_.value.targetBranch||"the target branch")+".",1),(0,l.eW)(" This plan cannot run yet because this workspace is "+(0,n.v_)(C.value),1),_.value.hasConflicts?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[(0,l.eW)(" and has conflicts")],64)):(0,l.Q3)("",!0),(0,l.eW)(". Choose how to proceed (recommended: "+(0,n.v_)(L.value)+"). ",1)]),(0,l.Lk)("div",ig,[(0,l.Lk)("button",{type:"button",class:(0,n.C4)(E("new-workspace")),disabled:h.value,onClick:a[1]||(a[1]=e=>Ja("new-workspace"))},(0,n.v_)(h.value?"Working...":"Create new workspace"),11,ug),_.value.canSyncInPlace?((0,l.uX)(),(0,l.CE)("button",{key:0,type:"button",class:(0,n.C4)(E("sync")),disabled:h.value,onClick:a[2]||(a[2]=e=>Ja("sync"))}," Sync workspace to latest ",10,cg)):(0,l.Q3)("",!0),(0,l.Lk)("button",{type:"button",class:(0,n.C4)(E("continue")),disabled:h.value,onClick:a[3]||(a[3]=e=>Ja("continue"))}," Continue with current ",10,dg),(0,l.Lk)("button",{type:"button",class:"button button--ghost",disabled:h.value,onClick:Ma}," Cancel ",8,pg)])])):"waiting_credentials"===R.value.status?((0,l.uX)(),(0,l.CE)("div",vg,["claude_quota"===de.value?((0,l.uX)(),(0,l.CE)(l.FK,{key:0},[a[17]||(a[17]=(0,l.Lk)("p",{"data-testid":"paused-run-message"},[(0,l.Lk)("strong",null,"Claude usage quota exhausted."),(0,l.eW)(" This run is paused because the Claude Code account hit its usage/weekly quota. Wait for the quota window to reset or switch the workspace to a different Claude account, then resume this run manually. ")],-1)),ue.value?((0,l.uX)(),(0,l.CE)("pre",kg,(0,n.v_)(ue.value),1)):(0,l.Q3)("",!0),ve.value?((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:"button button--primary","data-testid":"paused-run-resume",disabled:b.value,onClick:qa},(0,n.v_)(b.value?"Working...":"Resume Run"),9,gg)):((0,l.uX)(),(0,l.CE)(l.FK,{key:2},[a[16]||(a[16]=(0,l.Lk)("p",{"data-testid":"paused-run-resume-un
1available"}," This run cannot be resumed automatically because it did not record which phase to resume to. Open the workspace to review its credentials and restart the run from there. ",-1)),H.value?((0,l.uX)(),(0,l.Wv)(t,{key:0,to:{name:"ConsoleWorkspaceDetail",params:{id:H.value}},class:"button button--primary","data-testid":"paused-run-resume-unavailable-workspace"},{default:(0,l.k6)(()=>[...a[15]||(a[15]=[(0,l.eW)(" Open Workspace ",-1)])]),_:1},8,["to"])):(0,l.Q3)("",!0)],64))],64)):"claude_auth"===de.value?((0,l.uX)(),(0,l.CE)(l.FK,{key:1},[a[20]||(a[20]=(0,l.Lk)("p",{"data-testid":"paused-run-message"},[(0,l.Lk)("strong",null,"Claude authentication needed."),(0,l.eW)(" This run is paused because the Claude Code account is unauthenticated. Re-authenticate the Claude account on the worker (or switch this workspace to a Claude account that is signed in), then resume this run manually. ")],-1)),ue.value?((0,l.uX)(),(0,l.CE)("pre",bg,(0,n.v_)(ue.value),1)):(0,l.Q3)("",!0),ve.value?((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:"button button--primary","data-testid":"paused-run-resume",disabled:b.value,onClick:qa},(0,n.v_)(b.value?"Working...":"Resume Run"),9,mg)):((0,l.uX)(),(0,l.CE)(l.FK,{key:2},[a[19]||(a[19]=(0,l.Lk)("p",{"data-testid":"paused-run-resume-unavailable"}," This run cannot be resumed automatically because it did not record which phase to resume to. Open the workspace to review its credentials and restart the run from there. ",-1)),H.value?((0,l.uX)(),(0,l.Wv)(t,{key:0,to:{name:"ConsoleWorkspaceDetail",params:{id:H.value}},class:"button button--primary","data-testid":"paused-run-resume-unavailable-workspace"},{default:(0,l.k6)(()=>[...a[18]||(a[18]=[(0,l.eW)(" Open Workspace ",-1)])]),_:1},8,["to"])):(0,l.Q3)("",!0)],64))],64)):((0,l.uX)(),(0,l.CE)(l.FK,{key:2},[a[22]||(a[22]=(0,l.Lk)("p",{"data-testid":"paused-run-message"},[(0,l.Lk)("strong",null,"Credentials needed."),(0,l.eW)(" Update GitHub credentials on the workspace to resume this run.")],-1)),ue.value?((0,l.uX)(),(0,l.CE)("pre",_g,(0,n.v_)(ue.value),1)):(0,l.Q3)("",!0),H.value?((0,l.uX)(),(0,l.Wv)(t,{key:1,to:{name:"ConsoleWorkspaceDetail",params:{id:H.value},query:{refreshCredentials:"1"}},class:"button button--primary","data-testid":"paused-run-update-credentials"},{default:(0,l.k6)(()=>[...a[21]||(a[21]=[(0,l.eW)(" Update Credentials on Workspace ",-1)])]),_:1},8,["to"])):(0,l.Q3)("",!0)],64))])):"awaiting_input"===R.value.status&&Ke.value.length?((0,l.uX)(),(0,l.CE)("div",hg,[a[23]||(a[23]=(0,l.Lk)("p",null,[(0,l.Lk)("strong",null,"Input required.")],-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Ke.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.index,class:"job-detail__question"},[(0,l.Lk)("label",yg,(0,n.v_)(e.label),1),(0,l.bo)((0,l.Lk)("textarea",{"onUpdate:modelValue":a=>X.value[e.index]=a,class:"form-input",rows:"2"},null,8,fg),[[s.Jo,X.value[e.index]]])]))),128)),(0,l.Lk)("button",{type:"button",class:"button button--primary",disabled:b.value||!Oe.value,onClick:Ua},(0,n.v_)(b.value?"Working...":"Submit"),9,wg)])):(0,l.Q3)("",!0),me.value?((0,l.uX)(),(0,l.CE)("details",Lg,[(0,l.Lk)("summary",Cg,[a[24]||(a[24]=(0,l.eW)(" Preflight ",-1)),(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${me.value.verdictTone}`])},(0,n.v_)(me.value.verdictLabel),3)]),(0,l.Lk)("p",Eg,(0,n.v_)(me.value.summary),1),me.value.checks.length?((0,l.uX)(),(0,l.CE)("ul",Rg,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(me.value.checks,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:`${a}-${e.name}`,class:"job-detail__preflight-row"},[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.statusLabel),3),(0,l.Lk)("span",Ig,(0,n.v_)(e.name),1),(0,l.Lk)("span",jg,(0,n.v_)(e.message),1)]))),128))])):((0,l.uX)(),(0,l.CE)("p",Ag,"No individual check details were reported."))])):(0,l.Q3)("",!0),oe.value?((0,l.uX)(),(0,l.CE)("details",Wg,[a[25]||(a[25]=(0,l.Lk)("summary",{class:"console-module__summary"}," Local Worker Setup ",-1)),a[26]||(a[26]=(0,l.Lk)("p",{class:"job-detail__status-line"},[(0,l.eW)(" This run uses the Local Worker (Claude Code) runtime — it executes only while a "),(0,l.Lk)("code",null,"beads-worker"),(0,l.eW)(" process is polling for it. If nothing is progressing, download and run the worker below. ")],-1)),(0,l.bF)(sk,{"show-heading":!1})])):(0,l.Q3)("",!0),ae.value?((0,l.uX)(),(0,l.CE)("details",Sg,[(0,l.Lk)("summary",Xg,[a[27]||(a[27]=(0,l.eW)(" Planner Progress ",-1)),te.value?.current?((0,l.uX)(),(0,l.CE)("span",xg,(0,n.v_)(te.value.current)+" / "+(0,n.v_)(te.value.total),1)):(0,l.Q3)("",!0)]),te.value?((0,l.uX)(),(0,l.CE)("div",Tg,[(0,l.Lk)("div",Pg,[(0,l.Lk)("span",$g,(0,n.v_)(te.value.display),1)]),te.value.current?((0,l.uX)(),(0,l.CE)("div",Fg,[(0,l.Lk)("div",{class:"planner-progress__fill",style:(0,n.Tr)({width:te.value.current/te.value.total*100+"%"})},null,4)])):(0,l.Q3)("",!0),te.value.content?((0,l.uX)(),(0,l.CE)("p",Kg,(0,n.v_)(te.value.content),1)):(0,l.Q3)("",!0)])):((0,l.uX)(),(0,l.CE)("div",Og,[...a[28]||(a[28]=[(0,l.Lk)("span",{class:"job-detail__status-line"},"Starting planner...",-1)])]))])):(0,l.Q3)("",!0),R.value.description?((0,l.uX)(),(0,l.CE)("details",{key:9,class:"console-module",open:he.value},[a[29]||(a[29]=(0,l.Lk)("summary",{class:"console-module__summary"},"Request",-1)),(0,l.Lk)("div",{class:"job-detail__prose",innerHTML:we.value},null,8,Ng)],8,Dg)):(0,l.Q3)("",!0),ye.value?((0,l.uX)(),(0,l.CE)("details",{key:10,class:"console-module",open:"pending_approval"===R.value.status},[(0,l.Lk)("summary",qg,[a[30]||(a[30]=(0,l.eW)(" Plan ",-1)),(0,l.Lk)("span",Qg,(0,n.v_)(Ae.value.length)+" steps",1)]),(0,l.Lk)("div",Jg,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Ae.value,e=>((0,l.uX)(),(0,l.CE)("details",{key:e.index,class:"job-detail__plan-entry"},[(0,l.Lk)("summary",Bg,[(0,l.Lk)("span",Mg,"#"+(0,n.v_)(e.index),1),(0,l.Lk)("span",Vg,(0,n.v_)(e.title),
11),e.deps?((0,l.uX)(),(0,l.CE)("span",Gg,"depends on "+(0,n.v_)(e.deps),1)):(0,l.Q3)("",!0)]),(0,l.Lk)("div",{class:"job-detail__prose job-detail__prose--nested",innerHTML:(0,o.R1)(ir)(e.task)},null,8,Hg)]))),128))])],8,Ug)):(0,l.Q3)("",!0),Xe.value?((0,l.uX)(),(0,l.CE)("details",{key:11,class:"console-module",open:le.value||Boolean(Te.value)},[(0,l.Lk)("summary",Yg,[a[31]||(a[31]=(0,l.eW)(" Execution ",-1)),(0,l.Lk)("span",Zg,(0,n.v_)(Se.value)+"/"+(0,n.v_)(We.value.length),1)]),A.value?((0,l.uX)(),(0,l.CE)("div",eb,"Loading step state...")):W.value?((0,l.uX)(),(0,l.CE)("div",ab,(0,n.v_)(W.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",tb,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Fe.value.phases,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.depth,class:"dag__phase"},[(0,l.Lk)("div",sb,[(0,l.Lk)("div",lb,[(0,l.Lk)("span",null,"Phase "+(0,n.v_)(e.depth),1)]),(0,l.Lk)("div",{class:"dag__nodes",style:(0,n.Tr)({"grid-template-columns":`repeat(${Fe.value.columns}, 1fr)`})},[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.items,e=>((0,l.uX)(),(0,l.CE)("button",{key:e.bead.index,type:"button",class:(0,n.C4)(["dag__node",[`dag__node--${e.bead.tone}`,{"dag__node--selected":S.value===e.bead.index}]]),style:(0,n.Tr)({"grid-column":`${e.colStart} / ${e.colEnd}`}),onClick:a=>Sa(e.bead.index)},[(0,l.Lk)("span",ob,"#"+(0,n.v_)(e.bead.index),1),(0,l.Lk)("span",rb,(0,n.v_)(e.bead.title),1),e.bead.addedAfterApproval?((0,l.uX)(),(0,l.CE)("span",ib,"added after approval")):(0,l.Q3)("",!0),e.bead.usageLabel?((0,l.uX)(),(0,l.CE)("span",ub,(0,n.v_)(e.bead.usageLabel),1)):(0,l.Q3)("",!0),(0,l.Lk)("span",{class:(0,n.C4)(["dag__node-dot",`dag__node-dot--${e.bead.tone}`])},null,2)],14,nb))),128))],4)]),Te.value&&e.items.some(e=>e.bead.index===Te.value.index)?((0,l.uX)(),(0,l.CE)("section",cb,[(0,l.Lk)("div",db,[(0,l.Lk)("div",null,[(0,l.Lk)("div",pb,[(0,l.Lk)("span",vb,"#"+(0,n.v_)(Te.value.index),1),(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${Te.value.tone}`])},(0,n.v_)(Te.value.statusLabel),3),Te.value.addedAfterApproval?((0,l.uX)(),(0,l.CE)("span",kb,"Added after approval")):(0,l.Q3)("",!0)]),(0,l.Lk)("p",gb,(0,n.v_)(Te.value.title),1)]),(0,l.Lk)("button",{type:"button",class:"button button--ghost job-detail__close-button",onClick:a[4]||(a[4]=e=>S.value=null)}," Close ")]),(0,l.Lk)("div",{class:"job-detail__prose",innerHTML:(0,o.R1)(ir)(Te.value.fullTitle)},null,8,bb),(0,l.Lk)("div",mb,[(0,l.Lk)("div",_b,[a[32]||(a[32]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"State",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.statusLabel),1)]),Te.value.role?((0,l.uX)(),(0,l.CE)("div",hb,[a[33]||(a[33]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Role",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.role),1)])):(0,l.Q3)("",!0),Te.value.beadType?((0,l.uX)(),(0,l.CE)("div",yb,[a[34]||(a[34]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Type",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.beadType),1)])):(0,l.Q3)("",!0),Te.value.dependsOnLabel?((0,l.uX)(),(0,l.CE)("div",fb,[a[35]||(a[35]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Depends on",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.dependsOnLabel),1)])):(0,l.Q3)("",!0),Te.value.blockedByLabel?((0,l.uX)(),(0,l.CE)("div",wb,[a[36]||(a[36]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Blocking",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.blockedByLabel),1)])):(0,l.Q3)("",!0),Te.value.updatedAt?((0,l.uX)(),(0,l.CE)("div",Lb,[a[37]||(a[37]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Updated",-1)),(0,l.Lk)("span",null,(0,n.v_)((0,o.R1)(Xl)(Te.value.updatedAt)),1)])):(0,l.Q3)("",!0),Te.value.usage?.model?((0,l.uX)(),(0,l.CE)("div",Cb,[a[38]||(a[38]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Model",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.usage.model),1)])):(0,l.Q3)("",!0),Te.value.usage?.inputTokens?((0,l.uX)(),(0,l.CE)("div",Eb,[a[39]||(a[39]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Input tokens",-1)),(0,l.Lk)("span",null,(0,n.v_)(Number(Te.value.usage.inputTokens).toLocaleString()),1)])):(0,l.Q3)("",!0),Te.value.usage?.outputTokens?((0,l.uX)(),(0,l.CE)("div",Rb,[a[40]||(a[40]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Output tokens",-1)),(0,l.Lk)("span",null,(0,n.v_)(Number(Te.value.usage.outputTokens).toLocaleStr
1ing()),1)])):(0,l.Q3)("",!0),Te.value.durationLabel?((0,l.uX)(),(0,l.CE)("div",Ib,[a[41]||(a[41]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Duration",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.durationLabel),1)])):(0,l.Q3)("",!0),Te.value.costLabel?((0,l.uX)(),(0,l.CE)("div",jb,[a[42]||(a[42]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Cost",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.costLabel),1)])):(0,l.Q3)("",!0),Te.value.budgetLabel?((0,l.uX)(),(0,l.CE)("div",Ab,[a[43]||(a[43]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Budget",-1)),(0,l.Lk)("span",null,(0,n.v_)(Te.value.budgetLabel),1)])):(0,l.Q3)("",!0)]),Te.value.failureReason?((0,l.uX)(),(0,l.CE)("div",Wb,[a[44]||(a[44]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Failure",-1)),(0,l.Lk)("pre",Sb,(0,n.v_)(Te.value.failureReason),1)])):(0,l.Q3)("",!0),Te.value.isStalled?((0,l.uX)(),(0,l.CE)("div",Xb," This step looks stalled based on its last update time and missing live usage. ")):(0,l.Q3)("",!0),Te.value.canKill||Te.value.canRetry||Te.value.canSkip?((0,l.uX)(),(0,l.CE)("div",xb,[Te.value.canKill?((0,l.uX)(),(0,l.CE)("button",{key:0,type:"button",class:"button button--ghost",disabled:D.value===Te.value.index,onClick:a[5]||(a[5]=e=>Da(Te.value))},(0,n.v_)(D.value===Te.value.index?"Killing...":"Kill"),9,Tb)):(0,l.Q3)("",!0),Te.value.canRetry&&q.value!==Te.value.index?((0,l.uX)(),(0,l.CE)("button",{key:1,type:"button",class:"button button--ghost",onClick:a[6]||(a[6]=e=>Pa(Te.value))}," Retry ")):(0,l.Q3)("",!0),Te.value.canSkip?((0,l.uX)(),(0,l.CE)("button",{key:2,type:"button",class:"button button--ghost",disabled:N.value===Te.value.index,onClick:a[7]||(a[7]=e=>Na(Te.value))},(0,n.v_)(N.value===Te.value.index?"Skipping...":"Skip"),9,Pb)):(0,l.Q3)("",!0)])):(0,l.Q3)("",!0),q.value===Te.value.index?((0,l.uX)(),(0,l.CE)("form",{key:3,class:"job-detail__retry-form",onSubmit:a[9]||(a[9]=(0,s.D$)(e=>Oa(Te.value),["prevent"]))},[a[45]||(a[45]=(0,l.Lk)("label",{class:"job-detail__diag-label",for:"retry-budget"},"Budget override (USD)",-1)),(0,l.bo)((0,l.Lk)("input",{id:"retry-budget","onUpdate:modelValue":a[8]||(a[8]=e=>Q.value=e),type:"number",min:"0.5",step:"0.5",class:"form-input job-detail__retry-input"},null,512),[[s.Jo,Q.value]]),(0,l.Lk)("div",$b,[(0,l.Lk)("button",{type:"submit",class:"button button--primary",disabled:U.value===Te.value.index},(0,n.v_)(U.value===Te.value.index?"Retrying...":"Confirm Retry"),9,Fb),(0,l.Lk)("button",{type:"button",class:"button button--ghost",onClick:$a},"Cancel")])],32)):(0,l.Q3)("",!0),J.value?((0,l.uX)(),(0,l.CE)("p",Kb,(0,n.v_)(J.value),1)):(0,l.Q3)("",!0),(0,l.Lk)("div",Ob,[(0,l.Lk)("div",Db,[a[46]||(a[46]=(0,l.Lk)("span",{class:"job-detail__diag-label"},"Output",-1)),Te.value.isLive?((0,l.uX)(),(0,l.CE)("button",{key:0,type:"button",class:"button button--ghost",disabled:T.value[Te.value.beadId],onClick:a[10]||(a[10]=e=>Xa(Te.value))},(0,n.v_)(T.value[Te.value.beadId]?"Loading...":"Reload Output"),9,Nb)):(0,l.Q3)("",!0)]),P.value[Te.value.beadId]?((0,l.uX)(),(0,l.CE)("p",Ub," Failed to load output: "+(0,n.v_)(P.value[Te.value.beadId]),1)):Pe.value&&Pe.value._noOutput?((0,l.uX)(),(0,l.CE)("p",qb,"No output available.")):Pe.value?((0,l.uX)(),(0,l.CE)("div",{key:2,class:"job-detail__prose job-detail__prose--boxed",innerHTML:(0,o.R1)(ir)(la(Pe.value))},null,8,Qb)):((0,l.uX)(),(0,l.CE)("p",Jb,"Select reload to inspect the persisted step output."))]),(0,l.Lk)("details",{class:"job-detail__conversation",open:Boolean($e.value),onToggle:a[11]||(a[11]=e=>xa(Te.value,e))},[a[48]||(a[48]=(0,l.Lk)("summary",{class:"job-detail__conversation-summary"},"Transcript",-1)),null==Te.value.runId?((0,l.uX)(),(0,l.CE)("div",Mb,"Transcript is not available for this step.")):F.value[Te.value.beadId]?((0,l.uX)(),(0,l.CE)("div",Vb,"Loading transcript...")):K.value[Te.value.beadId]&&"unavailable"===O.value[Te.value.beadId]&&Ge(Te.value)?((0,l.uX)(),(0,l.CE)("p",Gb," Transcript will be available when this step completes. ")):K.value[Te.value.beadId]?((0,l.uX)(),(0,l.CE)("p",Hb," Failed to load transcript: "+(0,n.v_)(K.value[Te.value.beadId]),1)):$e.value?((0,l.uX)(),(0,l.CE)("div",zb,[$e.value.systemPrompt?((0,l.uX)(),(0,l.CE)("div",Yb,[a[47]||(a[47]=(0,l.Lk)("div",{class:"job-detail__diag-label"},"System Prompt",-1)),(0,l.Lk)("pre",Zb,(0,n.v_)($e.value.systemPrompt),1)])):(0,l.Q3)("",!0),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)($e.value.messages,(e,a)=>((0,l.uX)(),(0,l.CE)("div",{key:`${Te.value.beadId}-${a}
1`,class:(0,n.C4)(["job-detail__conversation-message",`job-detail__conversation-message--${e.role}`])},[(0,l.Lk)("div",em,(0,n.v_)(e.role),1),(0,l.Lk)("pre",am,(0,n.v_)(e.content),1)],2))),128)),$e.value.messages.length?(0,l.Q3)("",!0):((0,l.uX)(),(0,l.CE)("p",tm,"No messages recorded for this step."))])):((0,l.uX)(),(0,l.CE)("div",sm,"Open this section to load the transcript."))],40,Bb)])):(0,l.Q3)("",!0)]))),128))]),Te.value?(0,l.Q3)("",!0):((0,l.uX)(),(0,l.CE)("p",lm,"Select a step to inspect controls, output, transcript, and live diagnostics."))],8,zg)):(0,l.Q3)("",!0),xe.value||se.value?((0,l.uX)(),(0,l.CE)("details",{key:12,class:"console-module",open:_e.value||se.value},[a[51]||(a[51]=(0,l.Lk)("summary",{class:"console-module__summary"},"Results",-1)),se.value&&!xe.value?((0,l.uX)(),(0,l.CE)("div",om," Synthesizing results from completed steps... ")):(0,l.Q3)("",!0),fe.value?((0,l.uX)(),(0,l.CE)("div",{key:1,class:"job-detail__prose",innerHTML:Le.value},null,8,rm)):(0,l.Q3)("",!0),De.value.length?((0,l.uX)(),(0,l.CE)("div",im,[a[49]||(a[49]=(0,l.Lk)("h4",{class:"job-detail__subheading"},"Acceptance",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(De.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.item,class:"job-detail__acceptance-row"},[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.label),3),(0,l.Lk)("span",null,(0,n.v_)(e.item),1)]))),128))])):(0,l.Q3)("",!0),Ve.value.length?((0,l.uX)(),(0,l.CE)("div",um,[a[50]||(a[50]=(0,l.Lk)("h4",{class:"job-detail__subheading"},"Review Findings",-1)),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Ve.value,e=>((0,l.uX)(),(0,l.CE)("div",{key:e.key,class:"job-detail__finding-row"},[(0,l.Lk)("span",{class:(0,n.C4)(["console-badge console-badge--small",`console-badge--${e.tone}`])},(0,n.v_)(e.severity),3),(0,l.Lk)("div",cm,[(0,l.Lk)("div",dm,[(0,l.Lk)("span",pm,(0,n.v_)(e.location),1),e.rule?((0,l.uX)(),(0,l.CE)("span",vm,(0,n.v_)(e.rule),1)):(0,l.Q3)("",!0)]),(0,l.Lk)("div",km,(0,n.v_)(e.description),1)])]))),128))])):(0,l.Q3)("",!0)],8,nm)):(0,l.Q3)("",!0),je.value?((0,l.uX)(),(0,l.CE)("details",gm,[a[55]||(a[55]=(0,l.Lk)("summary",{class:"console-module__summary"},"Diagnostics",-1)),(0,l.Lk)("div",bm,[Ie.value.length?((0,l.uX)(),(0,l.CE)("section",mm,[a[52]||(a[52]=(0,l.Lk)("h4",{class:"job-detail__subheading"},"Trouble Spots",-1)),(0,l.Lk)("ul",_m,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Ie.value,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:`spot-${a}`},(0,n.v_)(ha(e)),1))),128))])])):(0,l.Q3)("",!0),Re.value.length?((0,l.uX)(),(0,l.CE)("section",hm,[a[53]||(a[53]=(0,l.Lk)("h4",{class:"job-detail__subheading"},"Guidance Gaps",-1)),(0,l.Lk)("ul",ym,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Re.value,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:`gap-${a}`},(0,n.v_)(ha(e)),1))),128))])])):(0,l.Q3)("",!0),Ee.value.length?((0,l.uX)(),(0,l.CE)("section",fm,[a[54]||(a[54]=(0,l.Lk)("h4",{class:"job-detail__subheading"},"Evidence Used",-1)),(0,l.Lk)("ul",wm,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(Ee.value,(e,a)=>((0,l.uX)(),(0,l.CE)("li",{key:`evidence-${a}`},(0,n.v_)(ya(e)),1))),128))])])):(0,l.Q3)("",!0)])])):(0,l.Q3)("",!0),(0,l.Lk)("details",Lm,[a[61]||(a[61]=(0,l.Lk)("summary",{class:"console-module__summary"},"Details",-1)),(0,l.Lk)("dl",Cm,[(0,l.Lk)("div",null,[a[56]||(a[56]=(0,l.Lk)("dt",null,"Run ID",-1)),(0,l.Lk)("dd",Em,(0,n.v_)((0,o.R1)(p)),1)]),(0,l.Lk)("div",null,[a[57]||(a[57]=(0,l.Lk)("dt",null,"Workspace",-1)),(0,l.Lk)("dd",null,(0,n.v_)(z.value),1)]),(0,l.Lk)("div",null,[a[58]||(a[58]=(0,l.Lk)("dt",null,"Created",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(Xl)(R.value.createdAt)),1)]),(0,l.Lk)("div",null,[a[59]||(a[59]=(0,l.Lk)("dt",null,"Updated",-1)),(0,l.Lk)("dd",null,(0,n.v_)((0,o.R1)(Xl)(R.value.updatedAt)),1)]),R.value.runtime?((0,l.uX)(),(0,l.CE)("div",Rm,[a[60]||(a[60]=(0,l.Lk)("dt",null,"Runtime",-1)),(0,l.Lk)("dd",null,(0,n.v_)(R.value.runtime),1)])):(0,l.Q3)("",!0)]),(0,l.Lk)("button",{type:"button",class:"button button--ghost job-detail__delete",disabled:b.value||h.value,onClick:Va}," Delete Run ",8,Im)]),m.value?((0,l.uX)(),(0,l.CE)("p",jm,(0,n.v_)(m.value),1)):(0,l.Q3)("",!0)]),_:1},8,["loading","error"])],2)])}}},Tm=(0,Ea.A)(xm,[["__scopeId","data-v-138cee08"]]),Pm=Tm,$m={class:"console tools-layout"},Fm={class:"console__tabs","aria-label":"Tools"},Km={class:"console__content"},Om={__name:"ToolsLayout",setup(e){const a=(0,r.lq)(),t=[{label:"All tools",to:"/console/tools",match:"/console/tools"}];function s(e){return"/console/tools"===e.to?"/console/tools"===a.path:a.path.startsWith(e.match)}return(e,a)=>{const o=(0,l.g2)("router-link"),r=(0,l.g2)("router-view");return(0,l.uX)(),(0,l.CE)("div",$m,[(0,l.Lk)("nav",Fm,[((0,l.uX)(),(0,l.CE)(l.FK,null,(0,l.pI)(t,e=>(0,l.bF)(o,{key:e.label,to:e.to,class:(0,n.C4)(["console__tab",{"console__tab--active":s(e)}])},{default:(0,l.k6)(()=>[(0,l.eW)((0,n.v_)(e.label),1)]),_:2},1032,["to","class"])),64))]),(0,l.Lk)("div",Km,[(0,l.bF)(r)])])}}},Dm=Om,Nm=Dm,Um={class:"tools-index"},qm={class:"tools-index__list"},Qm={class:"tools-index__card-title"},Jm={class:"tools-index__card-summary"},Bm={class:"tools-index__card-meta"},Mm={class:"console-badge console-badge--neutral console-badge--small"},Vm={__name:"ToolsIndex",setup(e){const a=[{slug:"job-description-prompt",path:"/console/tools/job-description-prompt",title:"Job-description prompt",kind:"Public HTTP API",summary:"Paste-ready prompt that teaches an external LLM agent how to author a beads-conformant GitHub issue or JobSubmission payload, covering the nine job archetypes the planner already models."},{slug:"standards",path:"/console/tools/standards",title:"Standards",kind:"MCP server + HTTP API",summary:"Searchable library of coding standards and design patterns. One-liner installer registers an MCP server for Claude Code, Copilot, Cursor, Amazon Q, and Codex;
1 every tool is also reachable as plain HTTP."},{slug:"knowledge-base",path:"/console/tools/knowledge-base",title:"Knowledge base",kind:"Public HTTP API",summary:"RAG search across curated articles and research notes. POST a query, get a synthesized answer plus the underlying sources, ready to drop into an agent’s context."}];return(e,t)=>{const s=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("section",Um,[t[1]||(t[1]=(0,l.Lk)("header",{class:"tools-index__header"},[(0,l.Lk)("h1",null,"Tools for AI agents working with beads"),(0,l.Lk)("p",{class:"tools-index__subline"}," Endpoints and helpers external LLM agents can call directly. Each tool is paste-friendly, self-describing, and works without auth. ")],-1)),(0,l.Lk)("ul",qm,[((0,l.uX)(),(0,l.CE)(l.FK,null,(0,l.pI)(a,e=>(0,l.Lk)("li",{key:e.slug,class:"tools-index__card"},[(0,l.bF)(s,{to:e.path,class:"tools-index__card-link"},{default:(0,l.k6)(()=>[(0,l.Lk)("h2",Qm,(0,n.v_)(e.title),1),(0,l.Lk)("p",Jm,(0,n.v_)(e.summary),1),(0,l.Lk)("div",Bm,[(0,l.Lk)("span",Mm,(0,n.v_)(e.kind),1),t[0]||(t[0]=(0,l.Lk)("span",{class:"tools-index__card-cta"},"Read →",-1))])]),_:2},1032,["to"])])),64))])])}}},Gm=(0,Ea.A)(Vm,[["__scopeId","data-v-a5ce97bc"]]),Hm=Gm,zm={class:"code-block"},Ym={class:"code-block__header"},Zm={class:"code-block__language"},e_={class:"code-block__pre"},a_={__name:"CodeBlock",props:{language:{type:String,default:"text"},code:{type:String,required:!0}},setup(e){const a=e,t=(0,o.KR)("idle"),s=(0,o.KR)("Copy");async function r(){if("undefined"===typeof navigator||!navigator.clipboard)return t.value="error",void(s.value="Copy unavailable");try{await navigator.clipboard.writeText(a.code),t.value="success",s.value="Copied",setTimeout(()=>{t.value="idle",s.value="Copy"},1800)}catch{t.value="error",s.value="Copy failed",setTimeout(()=>{t.value="idle",s.value="Copy"},2400)}}return(a,o)=>((0,l.uX)(),(0,l.CE)("div",zm,[(0,l.Lk)("div",Ym,[(0,l.Lk)("span",Zm,(0,n.v_)(e.language),1),(0,l.Lk)("button",{type:"button",class:(0,n.C4)(["code-block__copy",{"code-block__copy--success":"success"===t.value}]),onClick:r},(0,n.v_)(s.value),3)]),(0,l.Lk)("pre",e_,[(0,l.Lk)("code",null,(0,n.v_)(e.code),1)])]))}},t_=(0,Ea.A)(a_,[["__scopeId","data-v-c6d22278"]]),s_=t_,l_={class:"tool-page"},n_={class:"tool-page__breadcrumbs","aria-label":"Breadcrumb"},o_={class:"tool-page__section"},r_={class:"tool-page__section"},i_={key:0,class:"tool-page__placeholder"},u_={key:1,class:"alert alert--error"},c_={key:2,class:"tool-page__archetypes"},d_={class:"tool-page__archetype-id"},p_=["href"],v_={class:"tool-page__archetype-label"},k_={key:0},g_={class:"tool-page__section"},b_={class:"tool-page__sequence"},m_={class:"tool-page__section"},__="[paste the contents of guide.txt]\n\nNow: I want to file an issue for adding a Cancel button to the\njob-detail page that confirms before cancelling. Produce a\ncomplete GitHub issue body I can paste into `gh issue create`.",h_='{\n  "error": "INVALID_ARCHETYPE",\n  "message": "Unknown archetype \\"bug\\"",\n  "defects": [{\n    "fieldPath": "query.archetype",\n    "value": "bug",\n    "expected": "one of: research-only | repo-audit | defect | feature | …",\n    "hint": "Pick the archetype matching your goal. Fetch /prompt/job-description/manifest …"\n  }],\n  "_links": {\n    "self": "/prompt/job-description",\n    "manifest": "/prompt/job-description/manifest",\n    "fullPrompt": "/prompt/job-description",\n    "schema": "/prompt/job-description/schema.json",\n    "submit": "/jobs"\n  }\n}',y_={__name:"JobDescriptionPromptPage",setup(e){const{orchestratorBaseUrl:a}=Ns(),t=(0,l.EW)(()=>a.value),s=(0,l.EW)(()=>`${t.value}/prompt/job-description/manifest`),r=(0,l.EW)(()=>`${t.value}/prompt/job-description`),i=(0,o.KR)({archetypes:[]}),u=(0,o.KR)("loading"),c=(0,o.KR)("");function d(e){return`${t.value}/prompt/job-description?archetype=${e}`}const p=(0,l.EW)(()=>`curl ${r.value}`),v=(0,l.EW)(()=>`curl ${r.value} > guide.txt`),k=(0,l.EW)(()=>`curl '${t.value}/prompt/job-description?archetype=feature' > guide.txt`),g=(0,l.EW)(()=>`You have access to the beads issue-authoring API at\n${t.value}.\n\nWhen the user asks to file an issue, fetch:\n\n  1. GET /prompt/job-description/manifest  — JSON list of issue archetypes.\n     Each entry has a "summary" starting with "Use when …" and a "detailUrl".\n  2. Pick the archetype matching the user's intent.\n     If unsure, ask the user to choose.\n  3. GET <detailUrl>  — focused guidance for that archetype.\n  4. Produce a GitHub issue body OR a JobSubmission JSON ready to\n     POST to /jobs.`),b=(0,l.
1EW)(()=>`import Anthropic from '@anthropic-ai/sdk';\n\nconst client = new Anthropic({\n  defaultHeaders: { 'anthropic-beta': 'structured-outputs-2025-11-13' },\n});\n\nconst guideText = await fetch(\n  '${t.value}/prompt/job-description?archetype=defect',\n).then(r => r.text());\n\nconst jobSchema = await fetch(\n  '${t.value}/prompt/job-description/schema.json',\n).then(r => r.json());\n\nconst result = await client.messages.create({\n  model: 'claude-opus-4-7',\n  max_tokens: 2048,\n  system: guideText,\n  messages: [{ role: 'user', content: userTaskDescription }],\n  response_format: { type: 'json_schema', schema: jobSchema },\n});\n\n// result.content is guaranteed to match the JobSubmission shape.\nconst submission = JSON.parse(result.content[0].text);\n\nawait fetch('${t.value}/jobs', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'x-tenant-id': YOUR_TENANT,\n  },\n  body: JSON.stringify(submission),\n});`);return(0,l.sV)(async()=>{try{const e=await fetch(s.value,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`HTTP ${e.status}`);i.value=await e.json(),u.value="ready"}catch(e){c.value=e instanceof Error?e.message:String(e),u.value="error"}}),(e,a)=>{const o=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("article",l_,[(0,l.Lk)("nav",n_,[(0,l.bF)(o,{to:"/console/tools"},{default:(0,l.k6)(()=>[...a[0]||(a[0]=[(0,l.eW)("All tools",-1)])]),_:1}),a[1]||(a[1]=(0,l.Lk)("span",{class:"tool-page__breadcrumb-separator"},"/",-1)),a[2]||(a[2]=(0,l.Lk)("span",null,"Job-description prompt",-1))]),a[33]||(a[33]=(0,l.Lk)("header",{class:"tool-page__header"},[(0,l.Lk)("h1",null,"Job-description prompt"),(0,l.Lk)("p",{class:"tool-page__lead"},[(0,l.eW)(" A paste-ready prompt that teaches an external LLM agent (Claude, GPT, etc.) how to author a beads-conformant GitHub issue or "),(0,l.Lk)("code",null,"JobSubmission"),(0,l.eW)(" payload. The prompt covers nine job archetypes the planner already models, the universal rules every plan is validated against, and the JobSubmission schema. Public, no auth, designed for curl-and-paste workflows. ")])],-1)),(0,l.Lk)("section",o_,[a[3]||(a[3]=(0,l.Lk)("h2",null,"Quick start",-1)),a[4]||(a[4]=(0,l.Lk)("p",null,"Paste this into your agent's chat window, then describe what you want to build:",-1)),(0,l.bF)(s_,{language:"bash",code:p.value},null,8,["code"]),a[5]||(a[5]=(0,l.Lk)("p",null,[(0,l.eW)("The response is a self-describing Markdown document. Your agent now has full context and produces a complete GitHub issue body or a "),(0,l.Lk)("code",null,"JobSubmission"),(0,l.eW)(" JSON.")],-1))]),(0,l.Lk)("section",r_,[a[10]||(a[10]=(0,l.Lk)("h2",null,"Available archetypes",-1)),(0,l.Lk)("p",null,[a[6]||(a[6]=(0,l.eW)(" Every issue you file maps to one of nine archetypes. Each entry below is fetched live from the manifest endpoint at ",-1)),(0,l.Lk)("code",null,(0,n.v_)(s.value),1),a[7]||(a[7]=(0,l.eW)(" — if a new archetype ships, it appears here without a site redeploy. ",-1))]),"loading"===u.value?((0,l.uX)(),(0,l.CE)("div",i_," Loading archetypes… ")):"error"===u.value?((0,l.uX)(),(0,l.CE)("div",u_,[a[8]||(a[8]=(0,l.eW)(" Could not fetch archetypes from ",-1)),(0,l.Lk)("code",null,(0,n.v_)(s.value),1),(0,l.eW)(": "+(0,n.v_)(c.value),1)])):((0,l.uX)(),(0,l.CE)("table",c_,[a[9]||(a[9]=(0,l.Lk)("thead",null,[(0,l.Lk)("tr",null,[(0,l.Lk)("th",{scope:"col"},"Archetype"),(0,l.Lk)("th",{scope:"col"},"Use when"),(0,l.Lk)("th",{scope:"col"},"Bead sequence")])],-1)),(0,l.Lk)("tbody",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(i.value.archetypes,e=>((0,l.uX)(),(0,l.CE)("tr",{key:e.id},[(0,l.Lk)("td",d_,[(0,l.Lk)("a",{href:d(e.id),target:"_blank",rel:"noopener"},[(0,l.Lk)("code",null,(0,n.v_)(e.id),1)],8,p_),(0,l.Lk)("div",v_,(0,n.v_)(e.label),1)]),(0,l.Lk)("td",null,(0,n.v_)(e.summary),1),(0,l.Lk)("td",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(e.beadSequence,(a,t)=>((0,l.uX)(),(0,l.CE)("code",{key:t,class:"tool-page__bead-step"},[(0,l.eW)((0,n.v_)(a),1),t<e.beadSequence.length-1?((0,l.uX)(),(0,l.CE)("span",k_," → ")):(0,l.Q3)("",!0)]))),128))])]))),128))])]))]),(0,l.Lk)("section",g_,[a[20]||(a[20]=(0,l.Lk)("h2",null,"Integration patterns",-1)),a[21]||(a[21]=(0,l.Lk)("p",null," Three patterns depending on how much agent-side glue you want. Pattern 1 is zero-glue: you, an agent chat, one issue at a time. Pattern 2 is for agents that should pick the archetype themselves. Pattern 3 is for automated submission via a script or CI job. ",-1)),a[22]||(a[22]=(0,l.Lk)("h3",null,"Pattern 1 — Manual paste",-1)),a[23]||(a[23]=(0,l.Lk)("p",null,"The simplest. Curl the URL, copy the response, paste into your agent.",-1)),(0,l.bF)(s_,{language:"bash",code:v.value},null,8,["code"]),a[24]||(a[24]=(0,l.Lk)("p",null,"Then in your agent chat window, paste the file contents and describe the work:",-1)),(0,l.bF)(s_,{language:"markdown",code:__}),a[25]||(a[25]=(0,l.Lk)("p",null,"If you already know the archetype, fetch the focused subset to save tokens:",-1)),(0,l.bF)(s_,{language:"bash",code:k.value},null,8,["code"]),a[26]||(a[26]=(0,l.Lk)("h3",null,"Pattern 2 — Agent-driven navigation",-1)),a[27]||(a[27]=(0,l.Lk)("p",null,[(0,l.eW)(" Tell the agent about the API in its system prompt; let it fetch the manifest, pick the right archetype, and pull focused guidance on demand. The manifest's "),(0,l.Lk)("code",null,"detailUrl"),
1(0,l.eW)(" for each archetype, plus the "),(0,l.Lk)("code",null,"_links"),(0,l.eW)(" object on every JSON response, give the agent everything it needs to navigate. ")],-1)),(0,l.bF)(s_,{language:"markdown",code:g.value},null,8,["code"]),a[28]||(a[28]=(0,l.Lk)("p",null,"A typical back-and-forth:",-1)),(0,l.Lk)("ol",b_,[a[17]||(a[17]=(0,l.Lk)("li",null,'User: "There\'s a bug where job submissions with long operator notes return 500 instead of 400. Can you write the issue?"',-1)),(0,l.Lk)("li",null,[a[11]||(a[11]=(0,l.eW)("Agent fetches ",-1)),(0,l.Lk)("code",null,(0,n.v_)(s.value),1),a[12]||(a[12]=(0,l.eW)(", sees archetypes. Reasons: known symptom, known reproduction → archetype is ",-1)),a[13]||(a[13]=(0,l.Lk)("code",null,"defect",-1)),a[14]||(a[14]=(0,l.eW)(".",-1))]),(0,l.Lk)("li",null,[a[15]||(a[15]=(0,l.eW)("Agent fetches ",-1)),(0,l.Lk)("code",null,(0,n.v_)(t.value)+"/prompt/job-description?archetype=defect",1),a[16]||(a[16]=(0,l.eW)(" for the focused worked example.",-1))]),a[18]||(a[18]=(0,l.Lk)("li",null,[(0,l.eW)("Agent produces a complete defect-shaped issue body with "),(0,l.Lk)("code",null,"## Symptom"),(0,l.eW)(", "),(0,l.Lk)("code",null,"## Reproduction"),(0,l.eW)(", and acceptance criteria as "),(0,l.Lk)("code",null,"- [ ]"),(0,l.eW)(" items.")],-1)),a[19]||(a[19]=(0,l.Lk)("li",null,[(0,l.eW)("User reviews and runs "),(0,l.Lk)("code",null,"gh issue create"),(0,l.eW)(".")],-1))]),a[29]||(a[29]=(0,l.Lk)("h3",null,"Pattern 3 — Programmatic with structured outputs",-1)),a[30]||(a[30]=(0,l.Lk)("p",null,[(0,l.eW)(" For automated submission, fetch the JSON Schema once and feed it directly to a JSON-Schema-aware decoder — Anthropic Structured Outputs (Nov 2025 beta), "),(0,l.Lk)("code",null,"instructor"),(0,l.eW)(", OpenAI's "),(0,l.Lk)("code",null,"response_format"),(0,l.eW)(", etc. The decoder enforces shape at token-emission time, so the agent literally cannot return malformed output. ")],-1)),(0,l.bF)(s_,{language:"typescript",code:b.value},null,8,["code"])]),a[34]||(a[34]=(0,l.Fv)('<section class="tool-page__section" data-v-b20b224e><h2 data-v-b20b224e>Endpoints</h2><table class="tool-page__endpoints" data-v-b20b224e><thead data-v-b20b224e><tr data-v-b20b224e><th scope="col" data-v-b20b224e>Method &amp; path</th><th scope="col" data-v-b20b224e>Default Content-Type</th><th scope="col" data-v-b20b224e>Purpose</th></tr></thead><tbody data-v-b20b224e><tr data-v-b20b224e><td data-v-b20b224e><code data-v-b20b224e>GET /prompt/job-description</code></td><td data-v-b20b224e><code data-v-b20b224e>text/plain</code></td><td data-v-b20b224e>Full guide covering all 9 archetypes</td></tr><tr data-v-b20b224e><td data-v-b20b224e><code data-v-b20b224e>GET /prompt/job-description?archetype=&lt;id&gt;</code></td><td data-v-b20b224e><code data-v-b20b224e>text/plain</code></td><td data-v-b20b224e>Focused guide + sibling-navigation footer</td></tr><tr data-v-b20b224e><td data-v-b20b224e><code data-v-b20b224e>GET /prompt/job-description?format=json</code></td><td data-v-b20b224e><code data-v-b20b224e>application/json</code></td><td data-v-b20b224e>Envelope <code data-v-b20b224e>{ version, generatedAt, archetype, guidance, schema, _links }</code></td></tr><tr data-v-b20b224e><td data-v-b20b224e><code data-v-b20b224e>GET /prompt/job-description/manifest</code></td><td data-v-b20b224e><code data-v-b20b224e>application/json</code></td><td data-v-b20b224e>Discovery index of every archetype with detailUrl</td></tr><tr data-v-b20b224e><td data-v-b20b224e><code data-v-b20b224e>GET /prompt/job-description/schema.json</code></td><td data-v-b20b224e><code data-v-b20b224e>application/schema+json</code></td><td data-v-b20b224e>JSON Schema 2020-12 for <code data-v-b20b224e>JobSubmission</code></td></tr></tbody></table><p class="tool-page__note" data-v-b20b224e> Format negotiation precedence: <code data-v-b20b224e>?format=json</code> or <code data-v-b20b224e>?format=text</code> wins; otherwise <code data-v-b20b224e>Accept: application/json</code> or <code data-v-b20b224e>Accept: text/plain</code>; default <code data-v-b20b224e>text/plain</code>. Every JSON response also carries an HTTP <code data-v-b20b224e>Link:</code> header (RFC 8288) with named relations <code data-v-b20b224e>self</code>, <code data-v-b20b224e>manifest</code>, <code data-v-b20b224e>fullPrompt</code>, <code data-v-b20b224e>schema</code>, <code data-v-b20b224e>submit</code>. </p></section>',1)),(0,l.Lk)("section",m_,[a[31]||(a[31]=(0,l.Lk)("h2",null,"Defect responses",-1)),a[32]||(a[32]=(0,l.Lk)("p",null," Invalid input returns a structured defect array (or labeled text lines for plain text) naming the field, the offending value, and the valid alternatives — agents can self-correct without whack-a-mole retries. ",-1)),(0,l.bF)(s_,{language:"json",code:h_})])])}}},f_=(0,Ea.A)(y_,[["__scopeId","data-v-b20b224e"]]),w_=f_,L_={class:"tool-page"},C_={class:"tool-page__breadcrumbs","aria-label":"Breadcrumb"},E_={class:"tool-page__section"},R_={class:"tool-page__section"},I_={class:"tool-page__section"},j_={key:0,class:"tool-page__placeholder"},A_={key:1,class:"alert alert--error"},W_={key:2,class:"tool-page__endpoints"},S_={class:"tool-page__section"},X_={class:"tool-page__section"},x_="https://agentic.j2clark.info",T_={__name:"StandardsPage",setup(e){const a=`${x_}/mcp/tools`,t=(0,o.KR)([]),s=(0,o.KR)("loading"),r=(0,o.KR)(""),i=`curl -sSL ${x_}/install.sh | bash`,u=`# GitHub Copilot\ncurl -sSL ${x_}/install.sh | bash -s -- --assistant copilot\n\n# Amazon Q\ncurl -sSL ${x_}/install.sh | bash -s -- --assistant amazonq\n\n# Cursor\ncurl -sSL ${x_}/install.sh | bash -s -- --assistant cursor\n\n# OpenAI Codex\ncurl -sSL ${x_}/install.sh | bash -s -- --assistant codex`,c=`curl '${x_}/search?q=dependency+injection'`,d=`# List every standard\ncurl ${x_}/standards\n\n# Get a single standard by its chunk_id\ncurl ${x_}/standards/testing-stubs-vs-mocks`,p=`You have access to the agentic-standards API at ${x_}.\n\nBefore writing code, search for relevant standards and patterns:\n\n  GET ${x_}/search?q=<keywords>\n\nThe response includes a synthesized "answer" plus a list of source chunks\nwith chunk_ids. For the full text of any cited standard:\n\n  GET ${x_}/standards/<chunk_id>\n\nOther useful endpoints:\n  GET  ${x_}/skills            — list Claude Code / Copilot skill templates\n  POST ${x_}/skills/generate   — generate a skill from a template\n  POST ${x_}/claudemd/generate — generate a project CLAUDE.md for a tech stack\n  GET  ${x_}/prompts           — list prompt templates (code-review, security, etc.)\n\nIf the user runs Claude Code or another MCP-aware assistant, suggest they install\nthe MCP server with a one-liner so these tools light up natively:\n\n  curl -sSL ${x_}/install.sh | bash\n\nAlways cite the chunk_id(s) you used so the user can verify the source.`,v=p,k=`import Anthropic from '@anthropic-ai/sdk';\n\nconst client = new Anthropic();\n\n// Fetch a prompt template that already knows about the user's tech stack\nconst prompt = await fetch(\n  '${x_}/prompts/code-review?technologies=typescript,vue',\n).then(r => r.json());\n\nconst result = await client.messages.create({\n  model: 'claude-opus-4-7',\n  max_tokens: 4096,\n  system: prompt.content,\n  messages: [{ role: 'user', content: diffToReview }],\n});`;function g(e){if(!e)return"";const a=e.replace(/^\*\*[^*]+\*\*\s*/,""),t=a.split(/\.(?:\s|$)/)[0].trim();return t?`${t}.`:a}return(0,l.sV)(async()=>{try{const e=await fetch(a,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`HTTP ${e.status}`);const l=await e.json();t.value=(l.tools||[]).map(e=>({name:e.name,summary:g(e.description)})),s.value="ready"}catch(e){r.value=e instanceof Error?e.message:String(e),s.value="error"}}),(e,g)=>{const b=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("article",L_,[(0,l.Lk)("nav",C_,[(0,l.bF)(b,{to:"/console/tools"},{default:(0,l.k6)(()=>[...g[0]||(g[0]=[(0,l.eW)("All tools",-1)])]),_:1}),g[1]||(g[1]=(0,l.Lk)("span",{class:"tool-page__breadcrumb-separator"},"/",-1)),g[2]||(g[2]=(0,l.Lk)("span",null,"Standards",-1))]),g[27]||(g[27]=(0,l.Lk)("header",{class:"tool-page__header"},[(0,l.Lk)("div",{class:"tool-page__title-row"},[(0,l.Lk)("h1",null,"Standards"),(0,l.Lk)("span",{class:"console-badge console-badge--neutral console-badge--small"},"Free during beta")]),(0,l.Lk)("p",{class:"tool-page__lead"}," A searchable library of coding standards, design patterns, and operational guidelines that external LLM agents can consult before they write code. Includes a one-line installer that registers an MCP server for Claude Code, Copilot, Cursor, Amazon Q, and Codex. ")],-1)),(0,l.Lk)("section",E_,[g[3]||(g[3]=(0,l.Lk)("h2",null,"Quick start — install the MCP server",-1)),g[4]||(g[4]=(0,l.Lk)("p",null,"One-liner for Claude Code (the default):",-1)),(0,l.bF)(s_,{language:"bash",code:i}),g[5]||(g[5]=(0,l.Lk)("p",null,[(0,l.eW)("For other assistants, add an "),(0,l.Lk)("code",null,"--assistant"),(0,l.eW)(" flag:")],-1)),(0,l.bF)(s_,{language:"bash",code:u}),g[6]||(g[6]=(0,l.Lk)("p",null,[(0,l.eW)(" The installer downloads a thin Python client, verifies SHA256 checksums, and registers the MCP server with your assistant. After install, tools like "),(0,l.Lk)("code",null,"search_standards"),(0,l.eW)(", "),(0,l.Lk)("code",null,"list_standards"),(0,l.eW)(", and "),(0,l.Lk)("code",null,"generate_claudemd"),(0,l.eW)(" are immediately available in your agent. ")
1],-1))]),(0,l.Lk)("section",R_,[g[7]||(g[7]=(0,l.Lk)("h2",null,"Paste this into your agent",-1)),g[8]||(g[8]=(0,l.Lk)("p",null," If you'd rather not install anything, paste the block below into your agent's chat window (or system prompt). The agent will know how to search standards, fetch the full text of any cited standard, and generate project-level scaffolding on demand. ",-1)),g[9]||(g[9]=(0,l.Lk)("p",{class:"tool-page__note"},[(0,l.Lk)("strong",null,"Tradeoff:"),(0,l.eW)(" the pasted instructions and every search result the agent pulls in sit in conversation context and get re-billed every turn. The MCP install keeps the tool surface outside the conversation — only the actual call and response cost tokens. Use paste-mode for one-off sessions; install the MCP for sustained work. ")],-1)),(0,l.bF)(s_,{language:"markdown",code:p})]),(0,l.Lk)("section",I_,[g[14]||(g[14]=(0,l.Lk)("h2",null,"Available MCP tools",-1)),(0,l.Lk)("p",null,[g[10]||(g[10]=(0,l.eW)(" Every entry below is fetched live from ",-1)),(0,l.Lk)("code",null,(0,n.v_)(a)),g[11]||(g[11]=(0,l.eW)(" — if a tool ships or is renamed, it appears here without a site redeploy. ",-1))]),"loading"===s.value?((0,l.uX)(),(0,l.CE)("div",j_," Loading tools… ")):"error"===s.value?((0,l.uX)(),(0,l.CE)("div",A_,[g[12]||(g[12]=(0,l.eW)(" Could not fetch tools from ",-1)),(0,l.Lk)("code",null,(0,n.v_)(a)),(0,l.eW)(": "+(0,n.v_)(r.value),1)])):((0,l.uX)(),(0,l.CE)("table",W_,[g[13]||(g[13]=(0,l.Lk)("thead",null,[(0,l.Lk)("tr",null,[(0,l.Lk)("th",{scope:"col"},"Tool"),(0,l.Lk)("th",{scope:"col"},"When to use")])],-1)),(0,l.Lk)("tbody",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value,e=>((0,l.uX)(),(0,l.CE)("tr",{key:e.name},[(0,l.Lk)("td",null,[(0,l.Lk)("code",null,(0,n.v_)(e.name),1)]),(0,l.Lk)("td",null,(0,n.v_)(e.summary),1)]))),128))])]))]),(0,l.Lk)("section",S_,[g[15]||(g[15]=(0,l.Lk)("h2",null,"Direct HTTP — no install required",-1)),g[16]||(g[16]=(0,l.Lk)("p",null," Every MCP tool is also reachable as a plain HTTP endpoint. Agents that don't speak MCP can call these from any runtime. ",-1)),g[17]||(g[17]=(0,l.Lk)("h3",null,"Search",-1)),(0,l.bF)(s_,{language:"bash",code:c}),g[18]||(g[18]=(0,l.Lk)("p",null,[(0,l.eW)(" Returns a synthesized answer plus the underlying standard chunks. Query params: "),(0,l.Lk)("code",null,"top_k"),(0,l.eW)(" (1–20, default 10), "),(0,l.Lk)("code",null,"synthesize"),(0,l.eW)(" (bool, default true), "),(0,l.Lk)("code",null,"min_score"),(0,l.eW)(" (0–1, default 0.25). ")],-1)),g[19]||(g[19]=(0,l.Lk)("h3",null,"List and get",-1)),(0,l.bF)(s_,{language:"bash",code:d})]),g[28]||(g[28]=(0,l.Fv)('<section class="tool-page__section"><h2>Endpoints</h2><table class="tool-page__endpoints"><thead><tr><th scope="col">Method &amp; path</th><th scope="col">Purpose</th></tr></thead><tbody><tr><td><code>GET /search?q=&lt;query&gt;</code></td><td>Semantic search across all standards (synthesized answer + sources)</td></tr><tr><td><code>GET /standards</code></td><td>List every indexed standard (filter with <code>?technologies=node,lambda</code>)</td></tr><tr><td><code>GET /standards/{chunk_id}</code></td><td>Full content of a single standard</td></tr><tr><td><code>GET /prompts</code></td><td>List prompt templates (code-review, security-trifecta, etc.)</td></tr><tr><td><code>GET /prompts/{prompt_id}</code></td><td>Full prompt content with optional tech-stack filtering</td></tr><tr><td><code>GET /skills</code></td><td>List Claude Code / Copilot skill templates</td></tr><tr><td><code>POST /skills/generate</code></td><td>Generate a skill from a template, customized to a tech stack</td></tr><tr><td><code>POST /claudemd/generate</code></td><td>Generate a project <code>CLAUDE.md</code> tailored to a tech stack</td></tr><tr><td><code>POST /gaps</code></td><td>Report a missing or incomplete standard</td></tr><tr><td><code>GET /mcp/tools</code></td><td>Dynamic registry consumed by the thin client</td></tr><tr><td><code>GET /health</code></td><td>Dependency readiness (s3-vectors, embeddings, cache)</td></tr></tbody></table><p class="tool-page__note"> All endpoints are public during beta. Geo-restricted to US/CA (returns <code>403 ERROR_GEO_BLOCKED</code> elsewhere). Free-tier query limits: 300 chars for <code>?q=</code>, 2000 chars for POST bodies. </p></section>',1)),(0,l.Lk)("section",X_,[g[20]||(g[20]=(0,l.Lk)("h2",null,"Integration patterns",-1)),g[21]||(g[21]=(0,l.Lk)("h3",null,"Pattern 1 — Install the MCP server",-1)),g[22]||(g[22]=(0,l.Lk)("p",null," Default for Claude Code and any assistant with native MCP support. Run the installer above; the MCP tools light up inside your agent and the API surface stays hidden behind them. Best for interactive coding sessions. ",-1)),g[23]||(g[23]=(0,l.Lk)("h3",null,"Pattern 2 — Curl from inside any agent",-1)),g[24]||(g[24]=(0,l.Lk)("p",null,"If your agent doesn't speak MCP, teach it to hit the search endpoint directly:",-1)),(0,l.bF)(s_,{language:"markdown",code:(0,o.R1)(v)},null,8,["code"]),g[25]||(g[25]=(0,l.Lk)("h3",null,"Pattern 3 — Programmatic with structured outputs",-1)),g[26]||(g[26]=(0,l.Lk)("p",null," For automated pipelines (CI checks, batch code review), fetch a prompt template and feed it to a JSON-Schema-aware decoder. The standards content stays in one place; your pipeline gets the version updates for free. ",-1)),(0,l.bF)(s_,{language:"typescript",code:k})])])}}},P_=T_,$_=P_,F_={class:"tool-page"},K_={class:"tool-page__breadcrumbs","aria-label":"Breadcrumb"},O_={class:"tool-page__section"},D_={class:"tool-page__section"},N_={class:"tool-page__section"},U_={key:0,class:"tool-page__placeholder"},q_={key:1,class:"alert alert--error"},Q_={key:2,class:"tool-page__endpoints"},J_={class:"tool-page__section"},B_={class:"tool-page__section"},M_="https://kb.j2clark.info",V_='{\n  "status": "ok",\n  "kind": "synthesis",\n  "answer": "Prompt caching stores frequently used context to eliminate redundant token processing, reducing inference cost by up to 75% for repetitive prompt patterns.",\n  "sources": [\n    {\n      "articleId": "2e3471c6-...",\n      "title": "The FinOps of GenAI",\n      "section": "Key Strategies for GenAI FinOps",\n      "relevance": 0.9\n    }\n  ],\n  "metadata": {\n    "latencyMs": 2500,\n    "candidatesRetrieved": 20,\n    "chunksAfterRerank": 5\n  }\n}',G_={__name:"KnowledgeBasePage",setup(e){const a=`${M_}/articles`,t=(0,o.KR)([]),s=(0,o.KR)("loading"),r=(0,o.KR)(""),i=`curl -X POST ${M_}/articles/search \\\n  -H 'Content-Type: application/json' \\\n  -d '{"query": "prompt c
1aching strategies"}'`,u=`curl -sX POST ${M_}/articles/search \\\n  -H 'Content-Type: application/json' \\\n  -d '{"query": "system prompt optimization"}' > kb-answer.json`,c=`You have access to a curated knowledge base at ${M_}.\n\nWhen the user asks a question that might be answered by published research,\npatterns, or learnings, search the knowledge base:\n\n  POST ${M_}/articles/search\n  Content-Type: application/json\n  Body: {"query": "<the user's question or keywords>"}\n\nThe response includes:\n  - "answer":  a synthesized answer over the top-reranked chunks\n  - "sources": each with articleId, title, section, and a relevance score\n\nIf you need the full text of a cited source, fetch it:\n\n  GET ${M_}/articles/<articleId>\n\nFollow the "contentUrl" field in the response (presigned S3) for the body.\n\nAlways cite the source title(s) so the user can verify the answer.`,d=c,p=`// Use the KB synthesis as inline context for a downstream model call.\nconst search = await fetch('${M_}/articles/search', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ query: userQuestion }),\n}).then(r => r.json());\n\nconst context = [\n  search.answer,\n  ...search.sources.map(s => \`- \${s.title}\${s.section ? ' / ' + s.section : ''}\`),\n].join('\\n');\n\nconst result = await client.messages.create({\n  model: 'claude-opus-4-7',\n  max_tokens: 2048,\n  system: \`You answer questions using the supplied knowledge-base context.\nCite sources by title.\n\nContext:\n\${context}\`,\n  messages: [{ role: 'user', content: userQuestion }],\n});`;return(0,l.sV)(async()=>{try{const e=await fetch(a,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`HTTP ${e.status}`);const l=await e.json(),n=Array.isArray(l.articles)?l.articles:[];t.value=n.slice(0,8).map(e=>({articleId:e.articleId,title:e.title,author:e.author,status:e.status})),s.value="ready"}catch(e){r.value=e instanceof Error?e.message:String(e),s.value="error"}}),(e,v)=>{const k=(0,l.g2)("router-link");return(0,l.uX)(),(0,l.CE)("article",F_,[(0,l.Lk)("nav",K_,[(0,l.bF)(k,{to:"/console/tools"},{default:(0,l.k6)(()=>[...v[0]||(v[0]=[(0,l.eW)("All tools",-1)])]),_:1}),v[1]||(v[1]=(0,l.Lk)("span",{class:"tool-page__breadcrumb-separator"},"/",-1)),v[2]||(v[2]=(0,l.Lk)("span",null,"Knowledge base",-1))]),v[24]||(v[24]=(0,l.Lk)("header",{class:"tool-page__header"},[(0,l.Lk)("h1",null,"Knowledge base"),(0,l.Lk)("p",{class:"tool-page__lead"}," A retrieval-augmented library of curated articles, learnings, and research notes. Hit the search endpoint, get a synthesized answer plus the underlying sources, and feed both into your agent. ")],-1)),v[25]||(v[25]=(0,l.Lk)("p",{class:"tool-page__callout"},[(0,l.Lk)("strong",null,"MCP server coming soon."),(0,l.eW)(" A "),(0,l.Lk)("code",null,"search_kb"),(0,l.eW)(" tool that drops into Claude Code and other MCP-aware assistants is on the roadmap. Until it ships, the curl-and-paste patterns below give agents the same capability through direct HTTP. ")],-1)),(0,l.Lk)("section",O_,[v[3]||(v[3]=(0,l.Lk)("h2",null,"Quick start",-1)),v[4]||(v[4]=(0,l.Lk)("p",null,"Search the knowledge base — one POST, synthesized answer back:",-1)),(0,l.bF)(s_,{language:"bash",code:i}),v[5]||(v[5]=(0,l.Fv)("<p> The response includes a synthesized <code>answer</code> (Bedrock Sonnet over the top reranked chunks) plus a <code>sources</code> array of <code>articleId</code>, <code>title</code>, <code>section</code>, and <code>relevance</code> score. Latency is ~2–5s because each request runs a full RAG pipeline. </p>",1))]),(0,l.Lk)("section",D_,[v[6]||(v[6]=(0,l.Lk)("h2",null,"Paste this into your agent",-1)),v[7]||(v[7]=(0,l.Lk)("p",null," Drop the block below into your agent's chat window (or system prompt). The agent will know how to search the knowledge base, follow each cited source, and surface citations the user can verify. ",-1)),v[8]||(v[8]=(0,l.Lk)("p",{class:"tool-page__note"},[(0,l.Lk)("strong",null,"Tradeoff:"),(0,l.eW)(" the pasted instructions, every synthesized answer, and every source the agent fetches sit in conversation context and get re-billed every turn. Once the MCP server ships (see the callout above) the tool surface will move outside the conversation and only the actual call and response will c
1ost tokens. ")],-1)),(0,l.bF)(s_,{language:"markdown",code:c})]),(0,l.Lk)("section",N_,[v[13]||(v[13]=(0,l.Lk)("h2",null,"Recent articles",-1)),(0,l.Lk)("p",null,[v[9]||(v[9]=(0,l.eW)(" A sample of what's indexed today — fetched live from ",-1)),(0,l.Lk)("code",null,(0,n.v_)(a)),v[10]||(v[10]=(0,l.eW)(". ",-1))]),"loading"===s.value?((0,l.uX)(),(0,l.CE)("div",U_," Loading articles… ")):"error"===s.value?((0,l.uX)(),(0,l.CE)("div",q_,[v[11]||(v[11]=(0,l.eW)(" Could not fetch articles from ",-1)),(0,l.Lk)("code",null,(0,n.v_)(a)),(0,l.eW)(": "+(0,n.v_)(r.value),1)])):((0,l.uX)(),(0,l.CE)("table",Q_,[v[12]||(v[12]=(0,l.Lk)("thead",null,[(0,l.Lk)("tr",null,[(0,l.Lk)("th",{scope:"col"},"Title"),(0,l.Lk)("th",{scope:"col"},"Author"),(0,l.Lk)("th",{scope:"col"},"Status")])],-1)),(0,l.Lk)("tbody",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(t.value,e=>((0,l.uX)(),(0,l.CE)("tr",{key:e.articleId},[(0,l.Lk)("td",null,(0,n.v_)(e.title),1),(0,l.Lk)("td",null,(0,n.v_)(e.author||"—"),1),(0,l.Lk)("td",null,[(0,l.Lk)("code",null,(0,n.v_)(e.status),1)])]))),128))])]))]),v[26]||(v[26]=(0,l.Fv)('<section class="tool-page__section"><h2>Endpoints</h2><table class="tool-page__endpoints"><thead><tr><th scope="col">Method &amp; path</th><th scope="col">Purpose</th></tr></thead><tbody><tr><td><code>POST /articles/search</code></td><td>RAG search; body <code>{&quot;query&quot;: &quot;&lt;text&gt;&quot;}</code>. Returns synthesized answer + sources.</td></tr><tr><td><code>GET /articles</code></td><td>List indexed articles (filter with <code>?status=indexed</code>, etc.)</td></tr><tr><td><code>GET /articles/{id}</code></td><td>Article metadata plus a presigned URL for the full content body</td></tr><tr><td><code>POST /articles/ingest</code></td><td>Submit a URL for ingestion; returns <code>202</code> while the pipeline runs</td></tr><tr><td><code>GET /health</code></td><td>Dependency readiness (S3 Vectors, Bedrock, DynamoDB)</td></tr></tbody></table></section>',1)),(0,l.Lk)("section",J_,[v[14]||(v[14]=(0,l.Lk)("h2",null,"Search response shape",-1)),v[15]||(v[15]=(0,l.Lk)("p",null,[(0,l.eW)(" Successful synthesis is "),(0,l.Lk)("code",null,'kind: "synthesis"'),(0,l.eW)("; an empty index returns "),(0,l.Lk)("code",null,'kind: "empty"'),(0,l.eW)(" with no answer. Errors return "),(0,l.Lk)("code",null,'kind: "error"'),(0,l.eW)(" plus a structured "),(0,l.Lk)("code",null,"error"),(0,l.eW)(" object naming the field and message. ")],-1)),(0,l.bF)(s_,{language:"json",code:V_})]),(0,l.Lk)("section",B_,[v[16]||(v[16]=(0,l.Lk)("h2",null,"Integration patterns",-1)),v[17]||(v[17]=(0,l.Lk)("h3",null,"Pattern 1 — Manual paste",-1)),v[18]||(v[18]=(0,l.Lk)("p",null,"Run the search and paste both the answer and the sources into your agent's context:",-1)),(0,l.bF)(s_,{language:"bash",code:u}),v[19]||(v[19]=(0,l.Lk)("p",null,[(0,l.eW)(" Then drop the response into your chat window. The "),(0,l.Lk)("code",null,"sources"),(0,l.eW)(" array carries "),(0,l.Lk)("code",null,"articleId"),(0,l.eW)("s so the agent can cite them back, and you can pull the full body for any of them via "),(0,l.Lk)("code",null,"GET /articles/{id}"),(0,l.eW)(". ")],-1)),v[20]||(v[20]=(0,l.Lk)("h3",null,"Pattern 2 — Agent-driven search",-1)),v[21]||(v[21]=(0,l.Lk)("p",null," Add this to your agent's system prompt so it can search whenever a question would benefit from the library: ",-1)),(0,l.bF)(s_,{language:"markdown",code:(0,o.R1)(d)},null,8,["code"]),v[22]||(v[22]=(0,l.Lk)("h3",null,"Pattern 3 — Programmatic RAG augmentation",-1)),v[23]||(v[23]=(0,l.Lk)("p",null," Use the synthesized answer as inline context for a larger model task — for example, as part of a Claude system prompt that already has a JSON schema for the final response. ",-1)),(0,l.bF)(s_,{language:"typescript",code:p})])])}}},H_=G_,z_=H_;Symbol("frontend-exception-reporter");class Y_{capture(e,a={}){}child(e){return new Z_(this,e)}}class Z_ extends Y_{constructor(e,a){super(),this.parent=e,this.scope=a}capture(e,a={}){const t=a.scope?`${this.scope}:${a.scope}`:this.scope;this.parent.capture(e,{...a,scope:t})}}function eh(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:"string"===typeof e?{name:"Error",message:e,stack:void 0}:{name:"NonErrorThrowable",message:"A non-Error value was thrown",stack:void 0,thrown:e}}function ah(e,a={},t={}){const{now:s=Date.now(),href:l=("undefined"!==typeof window?window.location.href:void 0),userAgent:n=("undefined"!==typeof navigator?navigator.userAgent:void 0)}=t;return{timestampMs:s,href:l,userAgent:n,...a,error:eh(e)}}class th extends Y_{constructor({logger:e=v.child("[FrontendException]"),now:a=()=>Date.now(),href:t=()=>"undefined"!==typeof window?window.location.href:void 0,userAgent:s=()=>"undefined"!==typeof navigator?navigator.userAgent:void 0}={}){super(),this.logger=e,this.now=a,this.href=t,this.userAgent=s}capture(e,a={}){const t=ah(e,a,{now:this.now(),href:this.href(),userAgent:this.userAgent()});this.logger.error("Captured frontend exception",t)}}const sh=new th;function lh({app:e,reporter:a=sh,eventTarget:t=("undefined"!==typeof window?window:null),getRoutePath:s=()=>{}}={}){if(!e?.config)throw new Error("installGlobalFrontendExceptionHandling requires a Vue app with config");const l=e.config.errorHandler;if(e.config.errorHandler=(e,t,n)=>{a.capture(e,{source:"vue-error",routePath:s(),componentName:t?.$options?.name??t?.type?.name,vueInfo:n}),"function"===typeof l&&l(e,t,n)},!t?.addEventListener)return()=>{};const n=e=>{a.capture(e.error??e.message??"Unknown window error",{source:"window-error",routePath:s(),filename:e.filename,lineno:e.lineno,colno:e.colno})},o=e=>{a.capture(e.reason??"Unhandled promise rejection",{source:"unhandled-rejection",routePath:s()})};return t.addEventListener("error",n),t.addEventListener("unhandledrejection",o),()=>{t.removeEventListener("error",n),t.removeEventListener("unhandledrejection",o)}}const nh=v.child("[router]"),oh=sh.child("router"),rh=[{path:"/",name:"overview",component:Le,meta:{requiresAuth:!1}},{path:"/system",name:"system",component:ia,meta:{requiresAuth:!1}},{path:"/demo",component:Ia,meta:{requiresAuth:!1},children:[{path:"",name:"demo",component:Pa}
1,{path:"workspaces/:id",name:"demo-workspace-detail",component:Ct},{path:"jobs/:id",name:"demo-job-detail",component:Ps}]},{path:"/login",name:"login",component:Zs,meta:{requiresAuth:!1}},{path:"/docs/getting-started",redirect:"/",meta:{requiresAuth:!1}},{path:"/docs",redirect:"/",meta:{requiresAuth:!1}},{path:"/console",component:dl,children:[{path:"",name:"ConsoleOverview",component:Mn},{path:"plans",name:"ConsolePlans",component:er},{path:"plans/:id",name:"ConsolePlanDetail",component:ai},{path:"workspaces",name:"ConsoleWorkspaces",component:Di},{path:"workspaces/create",name:"ConsoleWorkspaceCreate",component:Eu},{path:"workspaces/:id",name:"ConsoleWorkspaceDetail",component:Wd},{path:"jobs",name:"ConsoleJobs",component:Vv},{path:"jobs/create",name:"ConsoleJobCreate",component:Jk},{path:"jobs/:id",name:"ConsoleJobDetail",component:Pm},{path:"analytics",name:"ConsoleAnalytics",component:Ep},{path:"settings",name:"ConsoleSettings",component:Jp},{path:"runs",redirect:e=>({name:"ConsoleJobs",query:e.query})},{path:":pathMatch(.*)*",redirect:"/console"}]},{path:"/console/tools",component:Nm,meta:{requiresAuth:!1},children:[{path:"",name:"ToolsIndex",component:Hm},{path:"job-description-prompt",name:"ToolJobDescriptionPrompt",component:w_},{path:"standards",name:"ToolStandards",component:$_},{path:"knowledge-base",name:"ToolKnowledgeBase",component:z_},{path:":pathMatch(.*)*",redirect:"/console/tools"}]},{path:"/:pathMatch(.*)*",redirect:"/"}],ih=(0,r.aE)({history:(0,r.LA)(),routes:rh});ih.beforeEach(e=>{const{isAuthenticated:a}=C();return!1===e.meta.requiresAuth?"login"!==e.name||!a.value||{path:"/console"}:!!a.value||{path:"/login",query:{redirect:e.fullPath}}}),ih.onError((e,a)=>{const t=e.message?.includes("Failed to fetch dynamically imported module")||e.message?.includes("Loading chunk")||e.message?.includes("Loading CSS chunk")||"ChunkLoadError"===e.name;if(t){const t=a?.fullPath||window.location.pathname;oh.capture(e,{source:"router-chunk-error",routePath:t}),nh.warn(`Chunk load error detected, reloading to ${t}`);const s="chunk-reload-"+t;sessionStorage.getItem(s)||(sessionStorage.setItem(s,"true"),setTimeout(()=>sessionStorage.removeItem(s),1e4),window.location.href=t)}});const uh=ih,ch=new Set(["86proof.ai"]);function dh(){if("undefined"===typeof window||"undefined"===typeof navigator)return!1;const e=navigator,a=window;return"1"===e.doNotTrack||"yes"===e.doNotTrack||"1"===a.doNotTrack||"1"===e.msDoNotTrack}function ph(){const e="G-P79243V6VK";return!!e&&("undefined"!==typeof window&&(!!ch.has(window.location.hostname)&&!dh()))}function vh(e){const a=document.createElement("script");a.async=!0,a.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,document.head.appendChild(a),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",e,{send_page_view:!1})}let kh=!1;function gh(e){if(kh)return;if(!ph())return;kh=!0;const a="G-P79243V6VK";vh(a),e.afterEach(e=>{"function"===typeof window.gtag&&window.gtag("event","page_view",{page_path:e.fullPath,page_title:document.title,page_location:window.location.href})})}const bh={sha:"a8629184850263434f51bc278ad7d3ff1d9f0ea4",timestamp:"2026-07-11T16:49:11Z",version:"0.1.0"};window.__BUILD_VERSION__=bh,console.info(`[build] 86proof-site v${bh.version} (${bh.sha})${bh.timestamp?" "+bh.timestamp:""}`);const mh=(0,s.Ef)(U);mh.use(uh),lh({app:mh,getRoutePath:()=>uh.currentRoute.value?.fullPath}),gh(uh),mh.mount("#app")}},a={};function t(s){var l=a[s];if(void 0!==l)return l.exports;var n=a[s]={exports:{}};return e[s](n,n.exports,t),n.exports}t.m=e,(()=>{var e=[];t.O=(a,s,l,n)=>{if(!s){var o=1/0;for(c=0;c<e.length;c++){for(var[s,l,n]=e[c],r=!0,i=0;i<s.length;i++)(!1&n||o>=n)&&Object.keys(t.O).every(e=>t.O[e](s[i]))?s.splice(i--,1):(r=!1,n<o&&(o=n));if(r){e.splice(c--,1);var u=l();void 0!==u&&(a=u)}}return a}n=n||0;for(var c=e.length;c>0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[s,l,n]}})(),(()=>{t.d=(e,a)=>{for(var s in a)t.o(a,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:a[s]})}})(),(()=>{t.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}
1}()})(),(()=>{t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a)})(),(()=>{var e={524:0};t.O.j=a=>0===e[a];var a=(a,s)=>{var l,n,[o,r,i]=s,u=0;if(o.some(a=>0!==e[a])){for(l in r)t.o(r,l)&&(t.m[l]=r[l]);if(i)var c=i(t)}for(a&&a(s);u<o.length;u++)n=o[u],t.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return t.O(c)},s=self["webpackChunk_86proof_site"]=self["webpackChunk_86proof_site"]||[];s.forEach(a.bind(null,0)),s.push=a.bind(null,s.push.bind(s))})();var s=t.O(void 0,[504],()=>t(557));s=t.O(s)})();
2//# sourceMappingURL=app.6cbf0b35.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.