Files
archie/ui/dist/assets/HarnessPage.js
T
sam cf2942c97a feat(workflow): render a PRD's generated view on the plan approval card
agent.run gains views: the agent may return an OpenUI Lang view of its
answer through an optional view tool, read as steps.<id>.view. human.approve
stores it as the task's plan_view, and the approval card renders it with
the dashboard's own components, falling back to the plan text when there
is no view or it does not parse. The feasibility prd step uses it.
2026-10-25 16:33:04 +11:00

1 line
6.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{A as e,C as t,Ct as n,M as r,S as i,Xt as a,_t as o,b as s,dt as c,ir as l,jn as u,k as d,l as f,st as p,t as m,x as h,xn as g}from"./PageHeader.js";import{M as _,n as v,r as y}from"./createLucideIcon.js";import{t as b}from"./badge.js";import{A as x,C as S,D as C,M as w,O as T,S as E,T as D,a as O,c as k,d as A,f as j,g as M,i as N,j as ee,k as P,l as F,m as I,n as L,o as R,s as z,t as B,u as V,w as H,x as U}from"./index.js";function W(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function G(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=r({__name:`SetupTerminal`,props:{profile:{}},setup(e){let n=e,r=g(null),a=g(`connecting`),l=null,u=null,m=null,h=null;function _(){try{m?.fit()}catch{}}return c(()=>{let e=r.value;if(!e)return;l=new L({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),m=new B,l.loadAddon(m),l.open(e),_(),l.focus();let t=new WebSocket(G(n.profile,window.location,l?.cols??80,l?.rows??24));u=t,t.binaryType=`arraybuffer`,t.onopen=()=>{a.value=`open`},t.onmessage=e=>{l&&(typeof e.data==`string`?l.write(e.data):l.write(new Uint8Array(e.data)))},t.onerror=()=>{a.value=`failed`},t.onclose=()=>{a.value=`closed`},l.onData(e=>{t.readyState===WebSocket.OPEN&&t.send(e)}),h=new ResizeObserver(_),h.observe(e)}),p(()=>{h?.disconnect(),h=null,u?.close(),u=null,l?.dispose(),l=null,m=null}),(e,n)=>(o(),t(`div`,K,[a.value===`open`?i(``,!0):(o(),t(`p`,q,[a.value===`connecting`?(o(),t(f,{key:0},[d(`Connecting…`)],64)):a.value===`closed`?(o(),t(f,{key:1},[d(`The terminal session ended.`)],64)):(o(),t(f,{key:2},[d(`Could not open the setup terminal.`)],64))])),s(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=r({__name:`HarnessPage`,setup(r){let p=g(null),L=g(!0),B=g(null),G=g(!1),K=g(``),q=g(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};c(te);async function te(){L.value=!0,B.value=null,G.value=!1;try{let e=await y.harnessBindings();p.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=p.value.profiles[0]??``}catch(e){let t=e instanceof v?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),p.value=null}finally{L.value=!1}}function ne(){p.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(r,c)=>(o(),t(`div`,null,[e(m,{title:`Harness`}),B.value?(o(),h(u(S),{key:0,variant:`destructive`,class:`mb-4`},{default:a(()=>[e(u(U),null,{default:a(()=>[...c[1]||=[d(`Could not load the harness`,-1)]]),_:1}),e(u(E),null,{default:a(()=>[d(l(B.value),1)]),_:1})]),_:1})):i(``,!0),L.value?(o(),t(`div`,Y,[e(u(D),{class:`h-24 w-full`}),e(u(D),{class:`h-40 w-full`})])):G.value?(o(),h(u(I),{key:2},{default:a(()=>[e(u(j),null,{default:a(()=>[e(u(A),null,{default:a(()=>[...c[2]||=[d(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):p.value?(o(),t(f,{key:3},[p.value.terminal?(o(),h(u(M),{key:1},{default:a(()=>[s(`div`,X,[s(`div`,Z,[e(u(N),{for:`harness-profile`,class:`text-fg-muted`},{default:a(()=>[...c[5]||=[d(`Profile`,-1)]]),_:1}),e(u(w),{modelValue:K.value,"onUpdate:modelValue":c[0]||=e=>K.value=e,disabled:!p.value.profiles.length},{default:a(()=>[e(u(T),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:a(()=>[e(u(C),{placeholder:`No profiles configured`})]),_:1}),e(u(ee),null,{default:a(()=>[e(u(x),null,{default:a(()=>[(o(!0),t(f,null,n(p.value.profiles,e=>(o(),h(u(P),{key:e,value:e},{default:a(()=>[d(l(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),e(u(_),{disabled:!K.value,onClick:ne},{default:a(()=>[...c[6]||=[d(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(o(),h(u(S),{key:0,class:`mb-4`},{default:a(()=>[e(u(U),null,{default:a(()=>[...c[3]||=[d(`Setup terminal unavailable`,-1)]]),_:1}),e(u(E),null,{default:a(()=>[...c[4]||=[d(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(o(),h(u(M),{key:2},{default:a(()=>[s(`div`,Q,[e(J,{profile:K.value},null,8,[`profile`])])]),_:1})):i(``,!0),e(u(M),null,{default:a(()=>[e(u(V),null,{default:a(()=>[e(u(O),null,{default:a(()=>[e(u(z),null,{default:a(()=>[e(u(R),null,{default:a(()=>[...c[7]||=[d(`Service`,-1)]]),_:1}),e(u(R),null,{default:a(()=>[...c[8]||=[d(`Status`,-1)]]),_:1}),e(u(R),null,{default:a(()=>[...c[9]||=[d(`Expires`,-1)]]),_:1}),e(u(R),null,{default:a(()=>[...c[10]||=[d(`Scopes`,-1)]]),_:1}),e(u(R),null,{default:a(()=>[...c[11]||=[d(`Updated`,-1)]]),_:1})]),_:1})]),_:1}),e(u(F),null,{default:a(()=>[p.value.bindings.length?i(``,!0):(o(),h(u(z),{key:0},{default:a(()=>[e(u(k),{colspan:`5`,class:`text-fg-muted`},{default:a(()=>[...c[12]||=[d(`No credential bindings.`,-1)]]),_:1})]),_:1})),(o(!0),t(f,null,n(p.value.bindings,t=>(o(),h(u(z),{key:t.service},{default:a(()=>[e(u(k),{class:`font-medium`},{default:a(()=>[d(l(t.service),1)]),_:2},1024),e(u(k),null,{default:a(()=>[e(u(b),{variant:$[u(W)(t)].variant},{default:a(()=>[d(l($[u(W)(t)].label),1)]),_:2},1032,[`variant`])]),_:2},1024),e(u(k),null,{default:a(()=>[e(u(H),{at:t.expires_at,absolute:``},null,8,[`at`])]),_:2},1024),e(u(k),{class:`text-fg-muted`},{default:a(()=>[d(l(re(t)),1)]),_:2},1024),e(u(k),{class:`text-fg-muted`},{default:a(()=>[e(u(H),{at:t.updated_at},null,8,[`at`])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1})],64)):i(``,!0)]))}});export{$ as default};