@atolis-hq/wake 0.4.54 → 0.4.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.55";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -1115,4 +1115,4 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
|
|
|
1115
1115
|
... Falling back to non-web worker version.`);if(!r.workerFactory){var o=e("./elk-worker.min.js").Worker;r.workerFactory=function(e){return new o(e)}}return l(this,n,[r])}return m(n,t),a(n)}(e("./elk-api.js").default);Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports=g,g.default=g},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(e,t,n){t.exports=typeof Worker<`u`?Worker:void 0},{}]},{},[3])(3)})})),bte=qm(),Jm=_te(),xte=vte(),Ste=c(yte(),1);function Cte(){return new Ste.default}var wte=Cte(),Ym=264,Tte=52,Ete=54,Dte=5;function Xm(e){return e===0?Tte:57+e*Ete+(e-1)*Dte}async function Ote(e,t){let n=await wte.layout({id:e.id,layoutOptions:{"elk.algorithm":`layered`,"elk.direction":t,"elk.spacing.nodeNode":`44`,"elk.layered.spacing.nodeNodeBetweenLayers":`88`},children:e.stages.map(e=>({id:e.id,width:Ym,height:Xm(e.children.length)})),edges:e.transitions.map((e,t)=>({id:`${e.from}-${e.to}-${t}`,sources:[e.from],targets:[e.to]}))}),r=(n.children??[]).map(e=>({id:e.id,x:e.x??0,y:t===`RIGHT`?0:e.y??0,width:e.width??Ym,height:e.height??Xm(0)})),i=(n.edges??[]).map((t,n)=>{let r=e.transitions[n];return{id:t.id,label:r?.label??``,from:r?.from??``,to:r?.to??``,...r?.fromChildId===void 0?{}:{fromChildId:r.fromChildId},points:(t.sections??[]).flatMap(e=>[e.startPoint,...e.bendPoints??[],e.endPoint])}});return Object.freeze({width:n.width??Ym,height:n.height??Xm(0),nodes:Object.freeze(r.map(e=>Object.freeze(e))),edges:Object.freeze(i.map(e=>Object.freeze({...e,points:Object.freeze(e.points.map(e=>Object.freeze(e)))})))})}var Zm={diagram:`_diagram_1akxc_1`,dragging:`_dragging_1akxc_45`,canvas:`_canvas_1akxc_50`,canvasLoading:`_canvasLoading_1akxc_56`,edges:`_edges_1akxc_60`,edgeActive:`_edgeActive_1akxc_80`,edgeLabel:`_edgeLabel_1akxc_85`,edgeLabelActive:`_edgeLabelActive_1akxc_101`,stage:`_stage_1akxc_105`,stageCard:`_stageCard_1akxc_116`,stageTitleRow:`_stageTitleRow_1akxc_127`,chips:`_chips_1akxc_137`,metrics:`_metrics_1akxc_138`,stageTotals:`_stageTotals_1akxc_139`,children:`_children_1akxc_152`,childCard:`_childCard_1akxc_158`,childCardWithoutStatus:`_childCardWithoutStatus_1akxc_165`,childStatusDot:`_childStatusDot_1akxc_174`,collapsedStatusDot:`_collapsedStatusDot_1akxc_179`,collapsedStatusDots:`_collapsedStatusDots_1akxc_183`,childTitle:`_childTitle_1akxc_189`,childKindIcon:`_childKindIcon_1akxc_195`,"active-run-pulse":`_active-run-pulse_1akxc_1`,srOnly:`_srOnly_1akxc_258`},Qm={width:0,height:0,nodes:[],edges:[]},kte={activity:xte.faRobot,watch:Jm.faEye,"watch-gate":Jm.faEye,reactor:bte.faBolt};function Ate(e,t){let[n,r]=(0,S.useState)(Qm);return(0,S.useEffect)(()=>{if(t===`DOWN`){r(Qm);return}let n=!0;return Ote(e,t).then(e=>{n&&r(e)}),()=>{n=!1}},[e,t]),n}function jte(){let[e,t]=(0,S.useState)(()=>globalThis.matchMedia?.(`(max-width: 48rem)`).matches?`DOWN`:`RIGHT`);return(0,S.useEffect)(()=>{let e=globalThis.matchMedia?.(`(max-width: 48rem)`);if(e===void 0)return;let n=()=>t(e.matches?`DOWN`:`RIGHT`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Mte(e){let t=(0,S.useRef)(null),n=(0,S.useRef)(new Map),[r,i]=(0,S.useState)(new Map),a=(0,S.useCallback)((e,t)=>{t===null?n.current.delete(e):n.current.set(e,t)},[]);return(0,S.useLayoutEffect)(()=>{let r=t.current;if(r===null||e.nodes.length===0)return;let a=()=>{let e=r.getBoundingClientRect(),t=new Map;for(let[r,i]of n.current){let n=i.getBoundingClientRect();t.set(r,{left:n.left-e.left,top:n.top-e.top,right:n.right-e.left,bottom:n.bottom-e.top});for(let n of i.querySelectorAll(`[data-diagram-child]`)){let i=n.getBoundingClientRect(),a=n.dataset.diagramChild;a!==void 0&&t.set(`${r}:${a}`,{left:i.left-e.left,top:i.top-e.top,right:i.right-e.left,bottom:i.bottom-e.top})}}i(t)};a();let o=globalThis.ResizeObserver===void 0?void 0:new ResizeObserver(a);o?.observe(r);for(let e of n.current.values())o?.observe(e);return()=>o?.disconnect()},[e]),{anchors:r,canvasRef:t,stageRef:a}}function $m(e){return e.totalTokens===void 0?null:(0,w.jsx)(Wm,{usage:{totalTokens:e.totalTokens,...e.inputTokens===void 0?{}:{inputTokens:e.inputTokens},...e.outputTokens===void 0?{}:{outputTokens:e.outputTokens},...e.cacheReadTokens===void 0?{}:{cacheReadTokens:e.cacheReadTokens},...e.cacheWriteTokens===void 0?{}:{cacheWriteTokens:e.cacheWriteTokens}}})}function Nte(e){return e.kind===`reactor`||e.runCount===void 0&&e.totalDurationMs===void 0&&e.totalCostUsd===void 0&&e.totalTokens===void 0?null:(0,w.jsxs)(`div`,{className:Zm.metrics,children:[e.runCount===void 0?null:(0,w.jsxs)(`span`,{children:[e.runCount,` runs`]}),e.totalDurationMs===void 0?null:(0,w.jsx)(`span`,{children:Rm(e.totalDurationMs)}),e.totalCostUsd===void 0?null:(0,w.jsx)(`span`,{children:Im(e.totalCostUsd)}),e.totalTokens===void 0?null:$m(e)]})}function Pte({child:e,onHover:t,showStatus:n}){let r=(e.activeRuns?.length??0)>0,i=eh(e,r);return(0,w.jsxs)(`article`,{className:`${Zm.childCard} ${Pm.childRun} ${n?``:Zm.childCardWithoutStatus}`,"data-diagram-child":e.id,"data-kind":e.kind,onMouseEnter:()=>t(e.id),onMouseLeave:()=>t(void 0),children:[n?(0,w.jsx)(`span`,{"aria-label":r?`active run`:`${i} status`,className:`${Pm.childRunDot} ${Zm.childStatusDot}`,"data-status":i,"data-active-run":r||void 0,"data-testid":`child-status-${e.id}`,role:`img`}):null,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`${Pm.childRunTitle} ${Zm.childTitle}`,children:[(0,w.jsx)(T,{className:Zm.childKindIcon,icon:kte[e.kind]}),(0,w.jsx)(`span`,{children:e.label})]}),Nte(e),e.kind===`reactor`?null:e.activeRuns?.map(e=>(0,w.jsxs)(`div`,{className:Pm.childRunMeta,children:[(0,w.jsxs)(`span`,{children:[e.activity,` running`]}),e.runnerName===void 0?null:(0,w.jsxs)(w.Fragment,{children:[` `,`· `,(0,w.jsx)(`span`,{children:e.runnerName})]}),` · `,(0,w.jsx)(`span`,{children:Rm(Math.max(0,Date.now()-new Date(e.startedAt).getTime()))})]},e.runId))]})]})}function eh(e,t=!1){if(t)return`active`;if(e.lastOutcome===void 0)return e.status??`pending`;switch(Bm(e.lastOutcome)){case`good`:return`completed`;case`warning`:return`blocked`;case`bad`:return`failed`;case`info`:return`needs-clarification`;case`neutral`:return`pending`}}function Fte(e){if(e.length<2)return``;let t=`M ${e[0].x} ${e[0].y}`;for(let n=1;n<e.length;n+=1){let r=e[n-1],i=e[n],a=e[n+1];if(a===void 0){t+=` L ${i.x} ${i.y}`;continue}let o=Math.min(10,Math.hypot(i.x-r.x,i.y-r.y)/2),s=Math.min(10,Math.hypot(a.x-i.x,a.y-i.y)/2),c={x:i.x+(r.x-i.x)*o/Math.hypot(r.x-i.x,r.y-i.y),y:i.y+(r.y-i.y)*o/Math.hypot(r.x-i.x,r.y-i.y)},l={x:i.x+(a.x-i.x)*s/Math.hypot(a.x-i.x,a.y-i.y),y:i.y+(a.y-i.y)*s/Math.hypot(a.x-i.x,a.y-i.y)};t+=` L ${c.x} ${c.y} Q ${i.x} ${i.y} ${l.x} ${l.y}`}return t}function th(e,t){return e.fromChildId===void 0?t.stages.find(t=>t.id===e.from)?.children.find(e=>e.kind===`activity`)?.id:e.fromChildId}function nh(e,t,n,r,i){if(e.points.length===0)return e.points;let a=n.get(e.from),o=t.stages.find(t=>t.id===e.from),s=th(e,t),c=o?.children.findIndex(e=>e.id===s)??-1,l=r.get(s===void 0?e.from:`${e.from}:${s}`),u=r.get(e.to);if(l!==void 0&&u!==void 0){let n=i===`RIGHT`?{x:l.right,y:(l.top+l.bottom)/2}:{x:(l.left+l.right)/2,y:l.bottom},a=i===`RIGHT`?{x:u.left,y:u.top+16}:{x:(u.left+u.right)/2,y:u.top};if(i===`RIGHT`){let i=t.stages.filter(t=>t.id!==e.from&&t.id!==e.to).map(e=>r.get(e.id)).filter(e=>e!==void 0&&e.left>=n.x&&e.right<=a.x);if(i.length>0){let e=Math.max(l.bottom,u.bottom,...i.map(e=>e.bottom))+24,t=n.x+18,r=a.x-18;return[n,{x:t,y:n.y},{x:t,y:e},{x:r,y:e},{x:r,y:a.y},a]}if(n.y===a.y)return[n,a];let o=(n.x+a.x)/2;return[n,{x:o,y:n.y},{x:o,y:a.y},a]}if(n.x===a.x)return[n,a];let o=(n.y+a.y)/2;return[n,{x:n.x,y:o},{x:a.x,y:o},a]}if(s===void 0||a===void 0||c<0)return e.points;let d=57+c*59+27;return[i===`RIGHT`?{x:a.x+a.width,y:a.y+d}:{x:a.x+a.width/2,y:a.y+d+52},...e.points.slice(1)]}function Ite(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y)),n=t.reduce((e,t)=>e+t,0)/2,r=0;for(let i=0;i<t.length;i+=1){let a=t[i];if(r+a>=n){let t=e[i],o=e[i+1],s=(n-r)/a;return{x:t.x+(o.x-t.x)*s,y:t.y+(o.y-t.y)*s}}r+=a}return e.at(-1)}function rh({diagram:e}){let t=jte(),n=Ate(e,t),{anchors:r,canvasRef:i,stageRef:a}=Mte(n),o=(0,S.useRef)(void 0),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(()=>{let t=e.stages.filter(e=>(e.activeRuns?.length??0)>0||e.children.some(e=>(e.activeRuns?.length??0)>0));return new Set(t.map(e=>e.id))}),[d,f]=(0,S.useState)(),p=e.stages.some(e=>e.status!==void 0||e.lastOutcome!==void 0||e.activeRuns!==void 0||e.runCount!==void 0||e.children.some(e=>e.status!==void 0||e.lastOutcome!==void 0||e.activeRuns!==void 0||e.runCount!==void 0)),m=new Map(n.nodes.map(e=>[e.id,e])),h=l.size>0,g=n.width||(t===`RIGHT`?e.stages.length*352:300),_=n.edges.flatMap(n=>nh(n,e,m,r,t)),v=Math.max(0,...Array.from(r.values(),e=>e.bottom),..._.map(e=>e.y)),y=t===`RIGHT`&&v>0?v+20:n.height||(t===`RIGHT`?176:e.stages.length*172),b=t===`DOWN`||n.nodes.length>0&&r.size>0,x=e=>{if(t!==`RIGHT`||e.button!==0)return;let n=e.currentTarget;o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:n.scrollLeft},n.setPointerCapture(e.pointerId),c(!0)},ee=e=>{let t=o.current;t!==void 0&&t.pointerId===e.pointerId&&(e.currentTarget.scrollLeft=t.scrollLeft-(e.clientX-t.startX))},te=e=>{o.current?.pointerId===e.pointerId&&(o.current=void 0,c(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,w.jsx)(`section`,{"aria-label":`Workflow ${e.label}`,className:`${Zm.diagram} ${s?Zm.dragging:``}`,"data-direction":t,onPointerCancel:te,onPointerDown:x,onPointerMove:ee,onPointerUp:te,children:(0,w.jsxs)(`div`,{ref:i,className:`${Zm.canvas} ${b?``:Zm.canvasLoading}`,"data-direction":t,style:{"--graph-width":`${g}px`,"--graph-height":`${y}px`},children:[(0,w.jsxs)(`svg`,{className:Zm.edges,"aria-hidden":`true`,viewBox:`0 0 ${g} ${y}`,preserveAspectRatio:`none`,children:[(0,w.jsx)(`defs`,{children:(0,w.jsx)(`marker`,{id:`workflow-arrow`,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`,children:(0,w.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`context-stroke`})})}),n.edges.map(n=>{let i=nh(n,e,m,r,t),a=th(n,e)===d;return(0,w.jsx)(`g`,{className:a?Zm.edgeActive:Zm.edge,children:(0,w.jsx)(`path`,{d:Fte(i),markerEnd:`url(#workflow-arrow)`})},n.id)})]}),n.edges.map(n=>{let i=Ite(nh(n,e,m,r,t)),a=th(n,e)===d;return i===void 0||n.label.length===0?null:(0,w.jsx)(`span`,{className:`${Zm.edgeLabel} ${a?Zm.edgeLabelActive:``}`,style:{left:`${i.x}px`,top:`${i.y}px`},children:n.label},`${n.id}-label`)}),e.stages.map((e,n)=>{let r=m.get(e.id),i=t===`RIGHT`||l.has(e.id),o=t===`RIGHT`?n*352:18,s=t===`RIGHT`?20:n*172,c=e.runCount!==void 0||e.totalDurationMs!==void 0||e.totalCostUsd!==void 0||e.totalTokens!==void 0,d=()=>u(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n});return(0,w.jsxs)(`div`,{className:`${Zm.stage} ${Pm.card}`,ref:t=>a(e.id,t),role:`group`,"aria-label":`Stage ${e.id}`,style:t===`RIGHT`?{left:`${r?.x??o}px`,top:`${r?.y??s}px`,width:`${r?.width??264}px`}:void 0,children:[(0,w.jsxs)(`div`,{"aria-expanded":t===`DOWN`?i:void 0,className:`${Zm.stageCard} ${Pm.cardLink}`,onClick:t===`DOWN`?d:void 0,onKeyDown:t===`DOWN`?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())}:void 0,role:t===`DOWN`?`button`:void 0,tabIndex:t===`DOWN`?0:void 0,children:[(0,w.jsx)(`div`,{children:(0,w.jsx)(`div`,{className:Zm.stageTitleRow,children:(0,w.jsx)(`strong`,{className:Pm.cardTitle,children:e.label})})}),t===`DOWN`&&p&&!i?(0,w.jsx)(`span`,{className:Zm.collapsedStatusDots,children:e.children.map(t=>(0,w.jsx)(`span`,{"aria-label":`${eh(t,(t.activeRuns?.length??0)>0)} status`,className:`${Pm.childRunDot} ${Zm.childStatusDot} ${Zm.collapsedStatusDot}`,"data-active-run":(t.activeRuns?.length??0)>0||void 0,"data-status":eh(t,(t.activeRuns?.length??0)>0),"data-testid":`collapsed-status-${e.id}-${t.id}`,role:`img`},t.id))}):null,c?(0,w.jsxs)(`div`,{className:Zm.stageTotals,children:[e.runCount===void 0?null:(0,w.jsxs)(`span`,{children:[e.runCount,` runs`]}),e.totalDurationMs===void 0?null:(0,w.jsx)(`span`,{children:Rm(e.totalDurationMs)}),e.totalCostUsd===void 0?null:(0,w.jsx)(`span`,{children:Im(e.totalCostUsd)}),e.totalTokens===void 0?null:$m(e)]}):null]}),i?(0,w.jsx)(`div`,{className:Zm.children,style:t===`DOWN`?{display:`grid`,visibility:`visible`}:void 0,children:e.children.map(e=>(0,w.jsx)(Pte,{child:e,onHover:t===`RIGHT`?f:()=>void 0,showStatus:p},e.id))}):null]},e.id)}),h?null:(0,w.jsx)(`span`,{className:Zm.srOnly,children:`All stages are collapsed.`})]})})}function Lte(){let e=Oc(),[t,n]=(0,S.useState)(`configuration`),r=fi({queryKey:vm.system.configuration,queryFn:({signal:t})=>e.system.configuration(t),refetchInterval:ym.configuration}),i=fi({queryKey:vm.system.commands,queryFn:({signal:t})=>e.system.commands(t),refetchInterval:ym.commands,enabled:t===`commands`}),a=fi({queryKey:vm.workflowDiagrams.get(),queryFn:({signal:t})=>e.workflowDiagrams.get(void 0,t),refetchInterval:ym.workflowDiagrams,enabled:t===`workflows`}),o=fi({queryKey:vm.system.webhooks,queryFn:({signal:t})=>e.system.webhooks(t),refetchInterval:ym.webhooks,enabled:t===`webhooks`}),s=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),r=t.indexOf(e.currentTarget);if(r<0)return;let i=e.key===`ArrowRight`?(r+1)%t.length:e.key===`ArrowLeft`?(r-1+t.length)%t.length:void 0;if(i===void 0)return;e.preventDefault();let a=t[i];a!==void 0&&(n(a.dataset.tab),a.focus())},c=(0,w.jsx)(Cm,{actions:(0,w.jsxs)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void(t===`commands`?i.refetch():t===`workflows`?a.refetch():t===`webhooks`?o.refetch():r.refetch()),children:[`Refresh`,` `,t===`commands`?`commands`:t===`workflows`?`workflows`:t===`webhooks`?`webhooks`:`configuration`]})});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Configuration sections`,children:[(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`configuration`,id:`configuration-tab`,"aria-controls":`configuration-panel`,"aria-selected":t===`configuration`,tabIndex:t===`configuration`?0:-1,onKeyDown:s,onClick:()=>n(`configuration`),children:`Configuration`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`commands`,id:`commands-tab`,"aria-controls":`commands-panel`,"aria-selected":t===`commands`,tabIndex:t===`commands`?0:-1,onKeyDown:s,onClick:()=>n(`commands`),children:`Commands`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`webhooks`,id:`webhooks-tab`,"aria-controls":`webhooks-panel`,"aria-selected":t===`webhooks`,tabIndex:t===`webhooks`?0:-1,onKeyDown:s,onClick:()=>n(`webhooks`),children:`Webhooks`}),(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":`workflows`,id:`workflows-tab`,"aria-controls":`workflows-panel`,"aria-selected":t===`workflows`,tabIndex:t===`workflows`?0:-1,onKeyDown:s,onClick:()=>n(`workflows`),children:`Workflows`})]}),t===`commands`?(0,w.jsxs)(`section`,{id:`commands-panel`,role:`tabpanel`,"aria-labelledby":`commands-tab`,className:Pm.tabPanel,children:[c,i.isPending?(0,w.jsx)(Dm,{label:`Loading commands`}):i.error&&!i.data?(0,w.jsx)(km,{error:i.error,retry:()=>void i.refetch()}):i.data&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{children:`Commands and actions recognized by each configured surface adapter.`}),i.data.data.adapters.length===0?(0,w.jsx)(Om,{children:`No adapters expose commands`}):i.data.data.adapters.map(e=>(0,w.jsxs)(wm,{children:[(0,w.jsx)(`h2`,{children:e.adapter}),e.commands.length===0?(0,w.jsx)(Om,{children:`No commands`}):(0,w.jsx)(`ul`,{children:e.commands.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsx)(`code`,{children:e.syntax})},e.syntax))})]},e.adapter))]})]}):t===`webhooks`?(0,w.jsxs)(`section`,{id:`webhooks-panel`,role:`tabpanel`,"aria-labelledby":`webhooks-tab`,className:Pm.tabPanel,children:[c,o.isPending?(0,w.jsx)(Dm,{label:`Loading webhook setup instructions`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data?.data.adapters.length===0?(0,w.jsx)(Om,{children:`No webhook-enabled adapters are configured`}):o.data?.data.adapters.flatMap(e=>e.hooks.map(t=>(0,w.jsxs)(wm,{children:[(0,w.jsx)(`h2`,{children:t.scope}),(0,w.jsxs)(`p`,{children:[`Configure this webhook manually in `,e.provider,` when Wake cannot manage it.`]}),(0,w.jsxs)(`p`,{children:[`Payload URL: `,(0,w.jsx)(`code`,{children:t.endpoint})]}),(0,w.jsxs)(`p`,{children:[`Content type: `,(0,w.jsx)(`code`,{children:`application/json`})]}),(0,w.jsxs)(`p`,{children:[`Events: `,(0,w.jsx)(`code`,{children:t.events.join(`, `)})]}),(0,w.jsxs)(`p`,{children:[`Signing secret: `,(0,w.jsx)(`code`,{children:t.secret})]})]},`${e.adapter}:${t.scope}`)))]}):t===`workflows`?(0,w.jsxs)(`section`,{id:`workflows-panel`,role:`tabpanel`,"aria-labelledby":`workflows-tab`,className:Pm.tabPanel,children:[c,a.isPending?(0,w.jsx)(Dm,{label:`Loading workflows`}):a.error&&!a.data?(0,w.jsx)(km,{error:a.error,retry:()=>void a.refetch()}):a.data?.data.diagrams.length===0?(0,w.jsx)(Om,{children:`No workflows are configured`}):a.data?.data.diagrams.map(e=>(0,w.jsxs)(`section`,{"aria-labelledby":`workflow-${e.id}`,children:[(0,w.jsx)(`h2`,{id:`workflow-${e.id}`,children:e.label}),(0,w.jsx)(rh,{diagram:e})]},e.id))]}):(0,w.jsxs)(`section`,{id:`configuration-panel`,role:`tabpanel`,"aria-labelledby":`configuration-tab`,className:Pm.tabPanel,children:[c,r.isPending?(0,w.jsx)(Dm,{label:`Loading redacted configuration`}):r.error&&!r.data?(0,w.jsx)(km,{error:r.error,retry:()=>void r.refetch()}):r.data&&(0,w.jsxs)(wm,{children:[(0,w.jsx)(`p`,{children:`Read-only effective configuration. Secrets are redacted by Wake.`}),(0,w.jsx)(Vee,{value:r.data.data.configuration})]})]})]})}function ih(){let[e,t]=Bn(),n=e.get(`cursor`)??void 0,r=e.getAll(`previous`);return{...n===void 0?{}:{cursor:n},hasPrevious:r.length>0,next(r){let i=new URLSearchParams(e);i.append(`previous`,n??``),i.set(`cursor`,r),t(i)},previous(){let n=r.at(-1);if(n===void 0)return;let i=new URLSearchParams(e);i.delete(`previous`);for(let e of r.slice(0,-1))i.append(`previous`,e);n===``?i.delete(`cursor`):i.set(`cursor`,n),t(i)},setFilter(n,r){let i=new URLSearchParams(e);r===``?i.delete(n):i.set(n,r),i.delete(`cursor`),i.delete(`previous`),t(i,{replace:!0})}}}function ah({navigation:e,nextCursor:t,hasMore:n}){return(0,w.jsxs)(`nav`,{className:Sm.pagination,"aria-label":`Collection pages`,children:[(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,disabled:!e.hasPrevious,onClick:e.previous,children:`Previous page`}),(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,disabled:!n||t===null,onClick:()=>t!==null&&e.next(t),children:`Next page`})]})}function oh(e,t,n){let r=new Intl.DateTimeFormat(t??`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`,...n===void 0?{}:{timeZone:n}}),i=Object.fromEntries(r.formatToParts(new Date(e)).map(e=>[e.type,e.value]));return`${i.year}-${i.month}-${i.day} ${i.hour}:${i.minute}`}function sh({value:e,locale:t,timeZone:n}){return(0,w.jsx)(`time`,{dateTime:e,title:e,"aria-label":`${oh(e,t,n)}; exact UTC ${e}`,children:oh(e,t,n)})}function Rte(){let e=Oc(),t=ih();return(0,w.jsx)(zte,{client:e,navigation:t},t.cursor??`initial`)}function zte({client:e,navigation:t}){let n=(0,S.useRef)({page:t.cursor,live:t.cursor}),[r,i]=(0,S.useState)([]),a=fi({queryKey:vm.events.list(t.cursor),queryFn:async({signal:t})=>e.events.list(n.current.live,void 0,t),refetchInterval:e=>e.state.data?.page.hasMore!==!0&&ym.events});return(0,S.useEffect)(()=>{a.data!==void 0&&(i(e=>lh(e,a.data.items)),!a.data.page.hasMore&&a.data.page.nextCursor!==null&&(n.current.live=a.data.page.nextCursor))},[a.data]),(0,w.jsx)(w.Fragment,{children:a.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):a.error&&!a.data?(0,w.jsx)(km,{error:a.error,retry:()=>void a.refetch()}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Bte,{records:r}),a.data&&(0,w.jsx)(ah,{navigation:t,nextCursor:a.data.page.nextCursor,hasMore:a.data.page.hasMore})]})})}function ch({record:e}){let[t,n]=(0,S.useState)(!1);return(0,w.jsxs)(`li`,{className:Pm.event,children:[(0,w.jsxs)(`button`,{type:`button`,className:Pm.eventButton,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsx)(`span`,{className:Pm.eventType,children:e.type}),(0,w.jsx)(`span`,{className:Pm.eventId,children:e.id}),(0,w.jsx)(`span`,{className:Pm.eventChevron,"aria-hidden":`true`,children:t?`v`:`>`})]}),t&&(0,w.jsx)(`div`,{className:Pm.eventPayload,children:(0,w.jsx)(`pre`,{children:JSON.stringify(e,null,2)})})]})}function Bte({records:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(()=>[...e]),[s,c]=(0,S.useState)([]),l=(0,S.useRef)(a.at(-1)?.position??-1),u=t||r;(0,S.useEffect)(()=>{let e=()=>{let e=document.scrollingElement??document.documentElement;i(e.scrollHeight-e.scrollTop-e.clientHeight>1)};return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,S.useEffect)(()=>{let t=e.filter(e=>e.position>l.current);t.length!==0&&(u?c(e=>lh(e,t)):(o(e=>lh(e,t)),l.current=t.at(-1).position))},[e,u]);let d=(0,S.useMemo)(()=>[...a].sort((e,t)=>t.position-e.position),[a]),f=()=>{o(e=>lh(e,s)),l.current=Math.max(l.current,...s.map(e=>e.position)),c([]),n(!1),i(!1)};return(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:Pm.toolbar,children:[(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>u?f():n(!0),children:u?`Resume live view`:`Pause live view`}),s.length>0&&(0,w.jsxs)(Tm,{type:`button`,onClick:f,"aria-live":`polite`,children:[s.length,` new `,s.length===1?`event`:`events`]})]}),d.length===0?(0,w.jsx)(Om,{children:`No events`}):(0,w.jsx)(`ol`,{className:Pm.eventList,children:d.map(e=>(0,w.jsx)(ch,{record:e},e.id))})]})}function lh(e,t,n=200){return[...new Map([...e,...t].map(e=>[e.id,e])).values()].sort((e,t)=>e.position-t.position).slice(-n)}function uh({caption:e,rows:t,rowKey:n,columns:r,tableClassName:i}){return(0,w.jsx)(`div`,{className:Sm.tableWrap,children:(0,w.jsxs)(`table`,{className:[Sm.table,i].filter(Boolean).join(` `),children:[(0,w.jsx)(`caption`,{children:e}),(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{children:r.map(e=>(0,w.jsx)(`th`,{scope:`col`,children:e.label},e.label))})}),(0,w.jsx)(`tbody`,{children:t.map(e=>(0,w.jsx)(`tr`,{children:r.map(t=>(0,w.jsx)(`td`,{"data-label":t.label,children:(0,w.jsx)(`div`,{children:t.render(e)})},t.label))},n(e)))})]})})}function Vte(){let e=Oc(),[t,n]=(0,S.useState)(`overview`),r=[[`overview`,`Overview`],[`adapters`,`Adapter health`],[`runners`,`Runner availability`],[`maintenance`,`Maintenance recovery`]],i=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r!==void 0&&(e.preventDefault(),t[r]?.click(),t[r]?.focus())},a=Qr(),o=fi({queryKey:vm.system.health,queryFn:({signal:t})=>e.system.health(t),refetchInterval:ym.health}),s=fi({queryKey:vm.execution.runners,queryFn:({signal:t})=>e.execution.runners(t),refetchInterval:ym.runners}),c=fi({queryKey:vm.controlPlane.status,queryFn:({signal:t})=>e.controlPlane.status(t),refetchInterval:ym.status}),l=pi({mutationKey:[`control-plane`,`clear-maintenance`],mutationFn:t=>e.controlPlane.clearMaintenance(t,crypto.randomUUID()),onSuccess:()=>{a.invalidateQueries({queryKey:vm.controlPlane.status}),a.invalidateQueries({queryKey:vm.system.health})}}),u=async(t,n)=>{let r=crypto.randomUUID();n?await e.execution.unpauseRunner(t,r):await e.execution.pauseRunner(t,r),await s.refetch()};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Health sections`,children:r.map(([e,r])=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,id:`health-${e}-tab`,"aria-controls":`health-${e}-panel`,"aria-selected":t===e,tabIndex:t===e?0:-1,onKeyDown:i,onClick:()=>n(e),children:r},e))}),(0,w.jsxs)(`section`,{className:Pm.tabPanel,role:`tabpanel`,id:`health-${t}-panel`,"aria-labelledby":`health-${t}-tab`,children:[(0,w.jsx)(Cm,{actions:(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>{o.refetch(),s.refetch(),c.refetch()},children:`Refresh health`})}),t===`overview`&&(0,w.jsx)(w.Fragment,{children:o.isPending?(0,w.jsx)(Dm,{label:`Checking health`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data&&(0,w.jsx)(Hte,{health:o.data.data})}),t===`maintenance`&&(0,w.jsx)(w.Fragment,{children:c.isPending?(0,w.jsx)(Dm,{label:`Checking maintenance`}):c.error&&!c.data?(0,w.jsx)(km,{error:c.error,retry:()=>void c.refetch()}):c.data?.data.maintenanceLease?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Maintenance recovery`}),(0,w.jsxs)(wm,{children:[(0,w.jsx)(Em,{tone:c.data.data.maintenanceLease.phase===`failed`?`bad`:`warning`,children:c.data.data.maintenanceLease.phase}),(0,w.jsxs)(`p`,{children:[`Started: `,c.data.data.maintenanceLease.startedAt]}),c.data.data.maintenanceLease.failure?(0,w.jsxs)(`p`,{children:[`Failure: `,c.data.data.maintenanceLease.failure]}):(0,w.jsx)(Om,{children:`No maintenance lease`}),c.data.data.maintenanceLease.phase===`failed`?(0,w.jsx)(Tm,{type:`button`,disabled:l.isPending,onClick:()=>{window.confirm(`Clear this failed maintenance lease? This immediately resumes intake and dispatch. Confirm the update attempt is abandoned.`)&&l.mutate(c.data.data.maintenanceLease.attemptId)},children:`Clear failed maintenance`}):(0,w.jsx)(`p`,{children:`Maintenance is active and cannot be cleared until the update fails.`})]})]}):(0,w.jsx)(Om,{children:`No maintenance lease`})}),t===`adapters`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Adapter health`}),o.isPending?(0,w.jsx)(Dm,{label:`Checking adapters`}):o.error&&!o.data?(0,w.jsx)(km,{error:o.error,retry:()=>void o.refetch()}):o.data&&(o.data.data.adapters?.length??0)===0?(0,w.jsx)(Om,{children:`No adapter health reported`}):o.data&&(0,w.jsx)(uh,{caption:`Adapter health`,tableClassName:Pm.adapterHealthTable,rows:o.data.data.adapters,rowKey:e=>`${e.adapter}:${e.scope}:${e.channel}`,columns:[{label:`Adapter`,render:e=>e.adapter},{label:`Scope`,render:e=>e.scope},{label:`Channel`,render:e=>e.channel},{label:`Status`,render:e=>(0,w.jsx)(Em,{tone:e.status===`ok`?`good`:`warning`,children:e.status})},{label:`Successes`,render:e=>e.successCount},{label:`Failures`,render:e=>e.failureCount},{label:`Detail`,render:e=>e.detail??`—`}]})]}),t===`runners`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Runner availability`}),s.isPending?(0,w.jsx)(Dm,{label:`Loading runners`}):s.error&&!s.data?(0,w.jsx)(km,{error:s.error,retry:()=>void s.refetch()}):(s.data?.items.length??0)===0?(0,w.jsx)(Om,{children:`No runners configured`}):(0,w.jsx)(uh,{caption:`Runner availability`,rows:s.data.items,rowKey:e=>e.runnerId,columns:[{label:`Runner`,render:e=>e.runnerId},{label:`Availability`,render:e=>(0,w.jsx)(Em,{tone:e.available?`good`:`warning`,children:e.status})},{label:`Detail`,render:e=>e.detail??`—`},{label:`Control`,render:e=>(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void u(e.runnerId,!e.available),children:e.available?`Pause`:`Unpause`})}]})]})]})]})}function Hte({health:e}){let t=e.checks??[],n=t.filter(e=>e.status===`ok`),r=t.filter(e=>e.status===`degraded`),i=[...r,...n];return(0,w.jsxs)(`div`,{className:Pm.healthOverview,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`div`,{className:Pm.healthSummary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:Pm.healthEyebrow,children:`System health`}),(0,w.jsxs)(Em,{tone:e.status===`ok`?`good`:`warning`,children:[`Wake `,e.status]})]}),(0,w.jsxs)(`dl`,{className:Pm.healthMeta,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Version`}),(0,w.jsx)(`dd`,{children:e.version})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last checked`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(`time`,{dateTime:e.checkedAt,children:new Date(e.checkedAt).toLocaleString()})})]})]})]})}),(0,w.jsxs)(wm,{labelledBy:`health-checks-title`,children:[(0,w.jsxs)(`div`,{className:Pm.healthChecksHeader,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:Pm.healthEyebrow,children:`Checks`}),(0,w.jsx)(`h2`,{id:`health-checks-title`,children:`System checks`})]}),(0,w.jsxs)(`div`,{className:Pm.healthCounts,"aria-label":`Health check counts`,children:[(0,w.jsxs)(`span`,{children:[n.length,` healthy`]}),r.length>0&&(0,w.jsxs)(`span`,{children:[r.length,` need attention`]})]})]}),i.length===0?(0,w.jsx)(Om,{children:`No health checks reported`}):(0,w.jsx)(`ul`,{className:Pm.healthCheckList,children:i.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`strong`,{children:e.name}),e.detail&&(0,w.jsx)(`span`,{children:e.detail})]}),(0,w.jsx)(Em,{tone:e.status===`ok`?`good`:`warning`,children:e.status===`ok`?`Healthy`:`Needs attention`})]},e.name))})]})]})}function Ute({label:e,value:t}){return(0,w.jsxs)(`div`,{className:Sm.tile,role:`group`,"aria-label":e,children:[(0,w.jsx)(`div`,{className:Sm.tileValue,children:t}),(0,w.jsx)(`div`,{className:Sm.tileLabel,children:e})]})}function Wte(){let e=Oc(),t=fi({queryKey:vm.observability.metrics(7),queryFn:({signal:t})=>e.observability.metrics(7,t),refetchInterval:ym.observability});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Cm,{actions:(0,w.jsx)(Tm,{type:`button`,variant:`secondary`,onClick:()=>void t.refetch(),children:`Refresh metrics`})}),t.isPending?(0,w.jsx)(Dm,{label:`Loading metrics`}):t.error&&!t.data?(0,w.jsx)(km,{error:t.error,retry:()=>void t.refetch()}):Object.keys(t.data?.data.values??{}).length===0?(0,w.jsx)(Om,{children:`No metrics available`}):(0,w.jsx)(`div`,{className:Pm.tiles,children:Object.entries(t.data.data.values).map(([e,t])=>(0,w.jsx)(Ute,{label:e,value:String(t)},e))})]})}function Gte(){let e=Oc(),t=ih(),n=fi({queryKey:vm.execution.runList(t.cursor),queryFn:({signal:n})=>e.execution.runs(t.cursor,n),refetchInterval:e=>bm.runs(e.state.data?.items)});return(0,w.jsxs)(w.Fragment,{children:[n.isPending?(0,w.jsx)(Dm,{label:`Loading runs`}):n.error&&!n.data?(0,w.jsx)(km,{error:n.error,retry:()=>void n.refetch()}):(n.data?.items.length??0)===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Execution runs`,rows:n.data.items,rowKey:e=>e.runId,columns:dh}),n.data&&(0,w.jsx)(ah,{navigation:t,nextCursor:n.data.page.nextCursor,hasMore:n.data.page.hasMore})]})}var dh=[{label:`Run`,render:e=>(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:e.runId})},{label:`Activity`,render:e=>e.activity},{label:`Workflow`,render:e=>e.workflowName??`?`},{label:`Stage`,render:e=>e.stage??`?`},{label:`Runner`,render:e=>Kte(e)},{label:`Status`,render:e=>fh(e)},{label:`Started`,render:e=>(0,w.jsx)(sh,{value:e.startedAt})},{label:`Duration`,render:e=>qte(e)},{label:`Usage`,render:e=>(0,w.jsx)(Wm,{usage:e})},{label:`Cost`,render:e=>Im(e.totalCostUsd)}];function Kte(e){return e.runnerName===void 0?`?`:e.runnerModel===void 0?e.runnerName:`${e.runnerName} (${e.runnerModel})`}function qte(e){let t=e.active?Date.now():e.finishedAt===void 0?void 0:Date.parse(e.finishedAt);return t===void 0?``:Rm(t-Date.parse(e.startedAt))}function fh(e){return e.status===`starting`?`Starting`:e.status===`started`?`Running`:e.resolution?.sentinel??e.sentinel}function Jte(){let{runId:e=``}=St(),t=Oc(),n=fi({queryKey:vm.execution.run(e),queryFn:({signal:n})=>t.execution.run(e,n),refetchInterval:e=>bm.runs(e.state.data===void 0?void 0:[e.state.data.data])}),r=fi({queryKey:vm.execution.transcript(e),queryFn:({signal:n})=>t.execution.transcript(e,n),refetchInterval:ym.historicalRuns,enabled:e!==``});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`h2`,{children:`Run ${e}`}),n.isPending?(0,w.jsx)(Dm,{label:`Loading run`}):n.error?(0,w.jsx)(km,{error:n.error,retry:()=>void n.refetch()}):n.data&&(0,w.jsxs)(wm,{children:[(0,w.jsx)(Em,{children:fh(n.data.data)}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Activity`}),(0,w.jsx)(`dd`,{children:n.data.data.activity}),(0,w.jsx)(`dt`,{children:`Attempt`}),(0,w.jsx)(`dd`,{children:n.data.data.attempt}),(0,w.jsx)(`dt`,{children:`Started`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(sh,{value:n.data.data.startedAt})}),n.data.data.finishedAt!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`dt`,{children:`Finished`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(sh,{value:n.data.data.finishedAt})})]})]}),(n.data.data.outcome??n.data.data.failure)!==void 0&&(0,w.jsx)(Vee,{value:n.data.data.outcome??n.data.data.failure}),(0,w.jsx)(`h2`,{children:`Transcript`}),r.data?.data.available?(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript`,children:r.data.data.entries.map((e,t)=>(0,w.jsxs)(`li`,{className:Pm.transcriptEntry,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel}),(0,w.jsx)(sh,{value:e.occurredAt})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,children:e.text})]},`${e.occurredAt}-${t}`))}):(0,w.jsx)(Om,{children:`Transcript unavailable`})]})]})}var Yte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fab`,n=`github`,r=512,i=512,a=[],o=`f09b`,s=`M216.5 362.5c-66-8-112.5-55.5-112.5-117 0-25 9-52 24-70-6.5-16.5-5.5-51.5 2-66 20-2.5 47 8 63 22.5 19-6 39-9 63.5-9s44.5 3 62.5 8.5c15.5-14 43-24.5 63-22 7 13.5 8 48.5 1.5 65.5 16 19 24.5 44.5 24.5 70.5 0 61.5-46.5 108-113.5 116.5 17 11 28.5 35 28.5 62.5l0 52C323 491.5 335.5 500 350.5 494 441 459.5 512 369 512 257 512 115.5 397 0 255.5 0S0 115.5 0 257c0 111 70.5 203 165.5 237.5 13.5 5 26.5-4 26.5-17.5l0-40c-7 3-16 5-24 5-33 0-52.5-18-66.5-51.5-5.5-13.5-11.5-21.5-23-23-6-.5-8-3-8-6 0-6 10-10.5 20-10.5 14.5 0 27 9 40 27.5 10 14.5 20.5 21 33 21s20.5-4.5 32-16c8.5-8.5 15-16 21-21z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faGithub=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Xte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fas`,n=`arrow-up-right-from-square`,r=512,i=512,a=[`external-link`],o=`f08e`,s=`M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l82.7 0-201.4 201.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3 448 192c0 17.7 14.3 32 32 32s32-14.3 32-32l0-160c0-17.7-14.3-32-32-32L320 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 80c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-256c0-8.8 7.2-16 16-16l80 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 96z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faArrowUpRightFromSquare=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Zte=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=`fas`,n=`file-lines`,r=384,i=512,a=[128441,128462,61686,`file-alt`,`file-text`],o=`f15c`,s=`M0 64C0 28.7 28.7 0 64 0L213.5 0c17 0 33.3 6.7 45.3 18.7L365.3 125.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm208-5.5l0 93.5c0 13.3 10.7 24 24 24L325.5 176 208 58.5zM120 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z`;e.definition={prefix:t,iconName:n,icon:[r,i,a,o,s]},e.faFileLines=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=i,e.ligatures=a,e.unicode=o,e.svgPathData=s,e.aliases=a})),Qte=Yte(),$te=Xte(),ene=Zte();function tne({className:e}){return(0,w.jsx)(T,{icon:Qte.faGithub,className:e,"aria-hidden":`true`})}function nne({className:e}){return(0,w.jsx)(T,{icon:ene.faFileLines,className:e,"aria-hidden":`true`})}function rne({className:e}){return(0,w.jsx)(T,{icon:$te.faArrowUpRightFromSquare,className:e,"aria-hidden":`true`})}var ine={github:tne};function ane(){let e=Oc(),t=fi({queryKey:vm.board.list(),queryFn:({signal:t})=>e.board.list(void 0,t),refetchInterval:ym.board}),n=t.data?.items??[];return(0,w.jsx)(w.Fragment,{children:t.isPending?(0,w.jsx)(Dm,{label:`Loading work`}):t.error&&!t.data?(0,w.jsx)(km,{error:t.error,retry:()=>void t.refetch()}):n.length===0?(0,w.jsx)(Om,{children:`No matching work items`}):(0,w.jsx)(uh,{caption:`Work items`,rows:n,rowKey:e=>e.workItemKey,columns:ph})})}var ph=[{label:`Ref`,render:e=>e.externalRef??`?`},{label:`Work item`,render:e=>(0,w.jsx)(Pn,{to:`/work/${encodeURIComponent(e.workItemKey)}`,children:e.objective})},{label:`Condition`,render:e=>(0,w.jsx)(Fm,{variant:`outline`,children:e.condition})},{label:`Workflow`,render:e=>e.workflowName??`?`},{label:`Stage`,render:e=>e.stage??`?`},{label:`Runs`,render:e=>e.runCount},{label:`Last run`,render:e=>e.lastRunAt===void 0?`?`:(0,w.jsx)(sh,{value:e.lastRunAt})},{label:`Outcome`,render:e=>e.lastRunOutcome===void 0?`?`:(0,w.jsx)(Um,{outcome:e.lastRunOutcome})},{label:`Cost`,render:e=>Im(e.totalCostUsd)},{label:`Usage`,render:e=>(0,w.jsx)(Wm,{usage:e})}];function mh(){let{workItemKey:e=``}=St();return(0,w.jsx)(one,{workItemKey:e},e)}function one({workItemKey:e}){let t=Oc(),n=bt(),r=Qr(),i=async()=>{await Promise.all([r.invalidateQueries({queryKey:vm.work.all}),r.invalidateQueries({queryKey:vm.board.list()})])},a=pi({mutationFn:n=>t.work.command(e,n,`web:${n}:${globalThis.crypto.randomUUID()}`),onSuccess:async(e,t)=>{await i(),t===`delete`&&n(`/work`)}}),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)(!1),u=(0,S.useRef)(0),d=(0,S.useRef)(null),f=pi({mutationFn:n=>t.work.message(e,n,`web:conversation-message:${globalThis.crypto.randomUUID()}`),onSuccess:async()=>{u.current=oe.filter(e=>e.origin===`agent`).length,l(!0),re.current=!0,ae(!1),s(``),d.current&&(d.current.style.height=``),await i()}}),p=()=>{let e=o.trim();e!==``&&!f.isPending&&f.mutate(e)},m=fi({queryKey:vm.work.detail(e),queryFn:({signal:n})=>t.work.detail(e,n),refetchInterval:ym.openWork,enabled:e!==``}),h=fi({queryKey:vm.workflowDiagrams.get(e),queryFn:({signal:n})=>t.workflowDiagrams.get(e,n),refetchInterval:ym.workflowDiagrams,enabled:e!==``&&m.data?.data.orchestration.primary!==null}),[g,_]=(0,S.useState)(ps.Failed),[v,y]=(0,S.useState)(`Operator determined this run failed.`),[b,x]=(0,S.useState)(`{
|
|
1116
1116
|
"kind": "done",
|
|
1117
1117
|
"data": { "status": "DONE" }
|
|
1118
|
-
}`),ee=pi({mutationFn:async({runId:n,outcome:r,status:i})=>{let a=globalThis.crypto.randomUUID();if(await t.execution.resolveAmbiguousRun(n,i===ps.Failed?{status:ps.Failed,reason:v}:{status:ps.Succeeded,outcome:r},`web:resolve-ambiguous-run:${a}`),i!==ps.Succeeded)return t.work.command(e,`retry`,`web:retry-after-ambiguous-resolution:${globalThis.crypto.randomUUID()}`)},onSuccess:i}),[te,ne]=(0,S.useState)(`overview`),C=(0,S.useRef)(null),re=(0,S.useRef)(!0),[ie,ae]=(0,S.useState)(!1),oe=[...m.data?.data.conversation.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)),se=oe.at(-1),ce=m.data?.data.execution.runs.find(e=>e.active);(0,S.useEffect)(()=>{let e=oe.filter(e=>e.origin===`agent`).length;c&&e>u.current&&l(!1)},[c,oe]),(0,S.useLayoutEffect)(()=>{re.current=!0,ae(!1)},[te]),(0,S.useLayoutEffect)(()=>{te===`conversation`&&re.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[te,se?.entryId,se?.body]);let[le,ue]=(0,S.useState)(),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(),he=fi({queryKey:vm.events.list(``,e),queryFn:({signal:n})=>t.events.list(void 0,e,n),refetchInterval:ym.events,enabled:e!==``}),ge=[...m.data?.data.execution.transcriptGroups??[]].sort((e,t)=>Number(e.kind===`run`)-Number(t.kind===`run`)||t.latestAt.localeCompare(e.latestAt)),_e=m.data?.data.orchestration.primary,ve=[...m.data?.data.execution.runs??[]].filter(e=>e.workflowInstanceId===_e?.workflowInstanceId&&e.status===`ambiguous`).sort((e,t)=>t.startedAt.localeCompare(e.startedAt))[0],ye=_e!=null&&_e.status===`blocked`&&lne(_e.blockReason),be=ge.find(e=>e.groupId===le)??ge[0],xe=fi({queryKey:vm.work.transcript(e,be?.groupId??``),queryFn:({signal:n})=>t.work.transcript(e,be.groupId,n),refetchInterval:ym.historicalRuns,enabled:te===`transcripts`&&e!==``&&be!==void 0}),Se=pe!==void 0&&be?.runIds.includes(pe)?pe:be?.runIds.at(-1),Ce=[...xe.data?.data.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)).filter(e=>!de||e.runId===Se),we=e=>{let t=ge.find(t=>t.groupId===e);ue(e),me(t?.runIds.at(-1)),fe(!1)},Te=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget);if(n<0)return;let r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;if(r===void 0)return;e.preventDefault();let i=t[r];if(i===void 0)return;let a=i.dataset.tab;ne(a),i.focus()};return(0,w.jsx)(`div`,{className:`${Pm.detail} ${te===`conversation`?Pm.detailChat:``}`,children:m.isPending?(0,w.jsx)(Dm,{label:`Loading work detail`}):m.error&&!m.data?(0,w.jsx)(km,{error:m.error,retry:()=>void m.refetch()}):m.data?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Work detail sections`,children:[`overview`,`runs`,`artifacts`,`events`,`transcripts`,`conversation`].map(e=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":e,id:`work-detail-${e}-tab`,"aria-controls":`work-detail-${e}-panel`,"aria-selected":te===e,tabIndex:te===e?0:-1,onKeyDown:Te,onClick:()=>ne(e),children:e===`overview`?`Overview`:e[0].toUpperCase()+e.slice(1)},e))}),(0,w.jsxs)(`h1`,{className:Pm.workTitle,children:[m.data.data.work.externalRef&&(0,w.jsx)(`span`,{children:m.data.data.work.externalRef}),m.data.data.work.objective]}),te!==`conversation`&&te!==`transcripts`&&(0,w.jsxs)(`div`,{className:Pm.workSummary,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Work identity`}),(0,w.jsx)(`dd`,{children:m.data.data.work.workItemId})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`State`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Fm,{variant:`outline`,children:m.data.data.work.state})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Workflow`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.workflowName??`?`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Stage`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.currentStage??`Not started`})]}),ye&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Blocked because`}),(0,w.jsx)(`dd`,{children:`Ambiguous run requires an operator decision`})]})}),m.data.data.work.lastRunOutcome!==void 0&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last run`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Um,{outcome:m.data.data.work.lastRunOutcome,title:`Outcome of the most recent run`})})]})})]})}),(0,w.jsxs)(`div`,{className:Pm.actionBar,children:[m.data.data.orchestration.primary?.retryEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`retry`),children:`Retry`}),m.data.data.orchestration.primary?.extendEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`extend`),children:`Extend`}),(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(m.data.data.work.frozen?`unfreeze`:`freeze`),children:m.data.data.work.frozen?`Unfreeze`:`Freeze`}),(0,w.jsx)(Tm,{type:`button`,className:Pm.dangerButton,disabled:a.isPending,onClick:()=>{window.confirm(`Delete this work item from the board and remove its resource correlations?`)&&a.mutate(`delete`)},children:`Delete`}),(0,w.jsx)(Am,{pending:a.isPending,...a.error===null?{}:{message:a.error?.message}})]})]}),te===`runs`?(0,w.jsx)(`section`,{id:`work-detail-runs-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-runs-tab`,children:m.data.data.execution.runs.length===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Runs`,rows:m.data.data.execution.runs,rowKey:e=>e.runId,columns:dh})}):te===`artifacts`?(0,w.jsx)(`section`,{id:`work-detail-artifacts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-artifacts-tab`,children:m.data.data.artifacts.length===0?(0,w.jsx)(Om,{children:`No published artifacts`}):(0,w.jsx)(uh,{caption:`Published artifacts`,rows:m.data.data.artifacts,rowKey:e=>e.revisionId,columns:[{label:`Producer`,render:e=>e.producer},{label:`Path`,render:e=>(0,w.jsx)(`a`,{href:e.href,children:e.path})},{label:`Type`,render:e=>e.mediaType??`binary`},{label:`Bytes`,render:e=>e.byteLength?.toLocaleString()??`?`}]})}):te===`conversation`?(0,w.jsxs)(`section`,{id:`work-detail-conversation-panel`,className:Pm.conversationPanel,role:`tabpanel`,"aria-labelledby":`work-detail-conversation-tab`,children:[(0,w.jsx)(`div`,{ref:C,className:Pm.conversationViewport,role:`region`,"aria-label":`Message history`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;re.current=t.scrollHeight-t.scrollTop-t.clientHeight<64,ae(!re.current)},children:oe.length===0?(0,w.jsx)(Om,{children:`No conversation messages`}):(0,w.jsx)(`ol`,{className:Pm.conversationTimeline,"aria-label":`Conversation`,children:oe.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.sourceResourceId);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`article`,{className:Pm.conversationEntry,"data-origin":e.origin,children:[(0,w.jsx)(sne,{actorId:e.actorId,sourceAdapter:e.sourceAdapter}),(0,w.jsxs)(`header`,{className:Pm.conversationEntryHead,children:[(0,w.jsx)(`strong`,{children:e.actorId}),(0,w.jsxs)(`span`,{className:Pm.conversationSource,children:[`via `,e.sourceAdapter??e.origin]}),(0,w.jsx)(sh,{value:e.occurredAt}),e.runId!==void 0&&(0,w.jsxs)(`span`,{children:[(0,w.jsxs)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:[`run `,e.runId]}),e.stage===void 0?``:` (${e.stage})`]}),t!==void 0&&(0,w.jsx)(`span`,{children:t.externalUrl===void 0?t.locatorLabel:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:t.locatorLabel})})]}),e.deleted?(0,w.jsx)(`em`,{children:`Message deleted`}):(0,w.jsx)(`div`,{className:Pm.conversationBody,children:e.body}),e.representations.length>0&&(0,w.jsx)(`footer`,{className:Pm.conversationRepresentations,children:e.representations.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.resourceId),n=t?.locatorLabel??e.resourceId;return(0,w.jsxs)(`span`,{children:[`Published to`,` `,t?.externalUrl===void 0?n:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:n})]},`${e.resourceId}:${e.externalId}`)})})]})},e.entryId)})})}),(0,w.jsxs)(`div`,{className:Pm.conversationFooter,children:[c&&(0,w.jsxs)(`div`,{className:Pm.conversationProgress,role:`status`,"aria-live":`polite`,children:[ce===void 0?(0,w.jsx)(T,{icon:zc,className:Pm.conversationWaitingIcon,"aria-hidden":`true`}):(0,w.jsx)(`span`,{className:Pm.conversationProgressDot,"data-active-run":`true`}),(0,w.jsx)(`span`,{className:Pm.conversationProgressTitle,children:ce===void 0?`Queued for Wake`:ce.activity}),ce!==void 0&&(0,w.jsxs)(`span`,{className:Pm.conversationProgressMeta,children:[ce.stage!==void 0&&`Stage: ${ce.stage}`,ce.stage!==void 0&&(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&` · `,(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&`Runner: ${ce.runnerName??ce.runnerModel}`]})]}),ie&&(0,w.jsx)(Tm,{className:Pm.conversationLatest,onClick:()=>{re.current=!0,ae(!1),C.current&&(C.current.scrollTop=C.current.scrollHeight)},children:`Jump to latest`}),m.data.data.conversation.canCreateEntries&&(0,w.jsxs)(`form`,{className:Pm.conversationComposer,onSubmit:e=>{e.preventDefault(),p()},children:[(0,w.jsx)(`textarea`,{ref:d,id:`work-conversation-message`,"aria-label":`Message`,value:o,disabled:f.isPending,onChange:e=>{s(e.target.value),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,192)}px`},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),p())},placeholder:`Add context, answer a question, or direct the current work.`,rows:1}),(0,w.jsxs)(`div`,{className:Pm.conversationComposerActions,children:[(0,w.jsx)(Tm,{type:`submit`,className:Pm.conversationSend,"aria-label":`Send message`,disabled:f.isPending||o.trim()===``,children:(0,w.jsx)(T,{icon:jc,"aria-hidden":`true`})}),(0,w.jsx)(Am,{pending:f.isPending,...f.error===null?{}:{message:f.error?.message}})]})]})]})]}):te===`transcripts`?(0,w.jsxs)(`section`,{id:`work-detail-transcripts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-transcripts-tab`,children:[(0,w.jsx)(`h2`,{id:`work-transcripts`,children:`Transcript conversations`}),ge.length===0?(0,w.jsx)(Om,{children:`No transcript conversations`}):(0,w.jsxs)(`div`,{className:Pm.transcriptLayout,children:[(0,w.jsx)(`ol`,{className:Pm.transcriptGroups,"aria-label":`Transcript groups`,children:ge.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,className:Pm.transcriptGroup,"aria-pressed":be?.groupId===e.groupId,onClick:()=>we(e.groupId),children:[(0,w.jsx)(`span`,{children:e.groupId}),(0,w.jsx)(`span`,{children:e.kind===`session`?`Session`:`Run fallback`}),e.cli!==void 0&&(0,w.jsx)(`span`,{children:e.cli}),(0,w.jsx)(sh,{value:e.latestAt}),(0,w.jsx)(`span`,{children:e.runIds.join(`, `)})]})},e.groupId))}),(0,w.jsxs)(`div`,{className:Pm.transcriptConversation,children:[be!==void 0&&be.runIds.length>1&&(0,w.jsxs)(`div`,{className:Pm.transcriptFilters,children:[(0,w.jsxs)(`label`,{children:[`Run`,(0,w.jsx)(`select`,{value:Se??``,onChange:e=>me(e.target.value),children:be.runIds.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))})]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>fe(e.target.checked)}),`This run only`]})]}),xe.isPending?(0,w.jsx)(Dm,{label:`Loading transcript`}):xe.error?(0,w.jsx)(km,{error:xe.error,retry:()=>void xe.refetch()}):xe.data?.data.available===!1?(0,w.jsx)(Om,{children:`Transcript unavailable`}):Ce.length===0?(0,w.jsx)(Om,{children:`No transcript messages`}):(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript conversation`,children:Ce.map((e,t)=>(0,w.jsxs)(`li`,{children:[t>0&&Ce[t-1]?.runId!==e.runId&&(0,w.jsxs)(`div`,{className:Pm.transcriptRunSeparator,role:`separator`,"aria-label":`Run ${e.runId}`,children:[`Run `,e.runId]}),(0,w.jsxs)(`article`,{className:e.channel===`input`?Pm.transcriptInput:Pm.transcriptAgent,"aria-label":`${e.channel===`input`?`Input`:`Agent`} message from ${e.runId}`,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel===`input`?`Input`:`Agent`}),(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsxs)(`span`,{children:[`Run `,e.runId]}),e.channel===`agent`&&e.durationMs!==void 0&&(0,w.jsx)(`span`,{children:Rm(e.durationMs)})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,style:{whiteSpace:`pre-wrap`},children:e.text})]})]},`${e.occurredAt}-${t}`))})]})]})]}):te===`events`?(0,w.jsxs)(`section`,{id:`work-detail-events-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-events-tab`,children:[(0,w.jsx)(`h2`,{id:`work-events`,children:`Events`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):he.data?.items.length?(0,w.jsx)(`ol`,{className:Pm.eventList,children:[...he.data.items].sort((e,t)=>t.position-e.position).map(e=>(0,w.jsx)(ch,{record:e},e.id))}):(0,w.jsx)(Om,{children:`No events`})]}):(0,w.jsxs)(`div`,{id:`work-detail-overview-panel`,className:Pm.overviewLayout,role:`tabpanel`,"aria-labelledby":`work-detail-overview-tab`,children:[(0,w.jsx)(`div`,{className:Pm.overviewWorkflow,children:h.data?.data.diagrams[0]===void 0?null:(0,w.jsx)(rh,{diagram:h.data.data.diagrams[0]})}),(0,w.jsxs)(`aside`,{className:Pm.overviewSidebar,children:[ye&&ve!==void 0&&(0,w.jsxs)(wm,{labelledBy:`ambiguous-run-resolution`,children:[(0,w.jsx)(`h2`,{id:`ambiguous-run-resolution`,className:Pm.sidebarSectionTitle,children:`Resolve ambiguous run`}),(0,w.jsx)(`p`,{children:`Decide what happened before retrying this work. Wake will record your decision, then retry the work item.`}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Run`}),(0,w.jsx)(`dd`,{children:ve.runId}),(0,w.jsx)(`dt`,{children:`Token usage`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Wm,{usage:ve})}),(0,w.jsx)(`dt`,{children:`Cost`}),(0,w.jsx)(`dd`,{children:Im(ve.totalCostUsd)}),(0,w.jsx)(`dt`,{children:`Pull request`}),(0,w.jsx)(`dd`,{children:m.data.data.activities.pullRequest===void 0?`None recorded`:`Recorded for this work item`})]}),(0,w.jsxs)(`fieldset`,{disabled:ee.isPending,children:[(0,w.jsx)(`legend`,{children:`Actual outcome`}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Failed,onChange:()=>_(ps.Failed)}),`Failed`]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Succeeded,onChange:()=>_(ps.Succeeded)}),`Succeeded`]}),g===ps.Failed?(0,w.jsxs)(`label`,{children:[`Reason`,(0,w.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value)})]}):(0,w.jsxs)(`label`,{children:[`Actual activity outcome (JSON)`,(0,w.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]})]}),(0,w.jsx)(Tm,{type:`button`,disabled:ee.isPending||g===ps.Failed&&v.trim()===``||g===ps.Succeeded&&gh(b)===void 0,onClick:()=>{let e=g===ps.Succeeded?gh(b):void 0;(g!==ps.Succeeded||e!==void 0)&&ee.mutate({runId:ve.runId,outcome:e,status:g})},children:g===ps.Failed?`Resolve and retry`:`Resolve run`}),g===ps.Succeeded&&gh(b)===void 0&&(0,w.jsx)(`p`,{role:`alert`,children:`The actual activity outcome must be an object with a supported outcome kind.`}),(0,w.jsx)(Am,{pending:ee.isPending,...ee.error===null?{}:{message:ee.error.message}})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`work-resources`,children:[(0,w.jsx)(`h2`,{id:`work-resources`,className:Pm.sidebarSectionTitle,children:`Resources`}),m.data.data.resources.length===0?(0,w.jsx)(Om,{children:`No correlated resources`}):(0,w.jsx)(`ul`,{className:Pm.resourceList,"aria-label":`Resources`,children:m.data.data.resources.map(e=>{let t=ine[e.adapter]??nne,n=e.title??e.locatorLabel,r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.resourceCardTop,children:[(0,w.jsx)(t,{className:Pm.resourceCardIcon}),(0,w.jsx)(`span`,{className:Pm.resourceCardTitle,children:n}),e.externalUrl!==void 0&&(0,w.jsx)(rne,{className:Pm.resourceCardExt})]}),(0,w.jsxs)(`div`,{className:Pm.resourceCardMeta,children:[e.title!==void 0&&(0,w.jsx)(`span`,{className:Pm.resourceId,children:e.locatorLabel}),e.capabilities.map(e=>(0,w.jsx)(Fm,{variant:`outline`,children:e},e))]})]});return(0,w.jsx)(`li`,{children:e.externalUrl===void 0?(0,w.jsx)(`div`,{className:Pm.resourceCard,children:r}):(0,w.jsx)(`a`,{className:Pm.resourceCard,href:e.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:r})},e.resourceId)})})]})]}),(0,w.jsxs)(`section`,{className:Pm.overviewMain,"aria-labelledby":`work-activity`,children:[(0,w.jsx)(`h2`,{id:`work-activity`,className:Pm.sidebarSectionTitle,children:`Activity timeline`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading activity`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):hh(m.data.data.execution.runs,he.data?.items??[]).length?(0,w.jsx)(`ol`,{className:Pm.activityTimeline,"aria-label":`Activity timeline`,children:hh(m.data.data.execution.runs,he.data?.items??[]).map(e=>(0,w.jsxs)(`li`,{className:Pm.activityTimelineItem,children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineMarker,"data-kind":e.kind}),(0,w.jsx)(sh,{value:e.occurredAt}),e.kind===`run`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`run`,children:`Run`}),(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.run.runId)}`,children:e.run.activity}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stage: `,e.run.stage??`Not assigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Runner:`,` `,e.run.runnerName??e.run.runnerModel??`Unassigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineOutcome,children:[`Outcome: `,cne(e.run)]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`event`,children:`Event`}),(0,w.jsx)(`span`,{children:e.event.type}),e.event.stream!==void 0&&(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stream: `,e.event.stream.kind]})]})]},e.id))}):(0,w.jsx)(Om,{children:`No activity yet`})]})]})]}):null})}function sne({actorId:e,sourceAdapter:t}){let[n,r]=(0,S.useState)(!1),i=t===`github`&&e.trim()!==``;return(0,w.jsx)(`span`,{className:Pm.conversationAvatar,"aria-label":i?`${e} GitHub avatar`:e,children:i&&!n?(0,w.jsx)(`img`,{src:`https://github.com/${encodeURIComponent(e)}.png?size=64`,alt:``,onError:()=>r(!0)}):e.slice(0,2).toUpperCase()})}function hh(e,t){return[...e.map(e=>({id:`run:${e.runId}`,kind:`run`,occurredAt:e.finishedAt??e.startedAt,run:e})),...t.map(e=>({id:`event:${e.id}`,kind:`event`,occurredAt:e.occurredAt,event:e}))].sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt))}function cne(e){return e.resolution?.sentinel??e.sentinel??e.status}function lne(e){return e!==void 0&&/^run-ambiguous-after-\d+-attempts$/.test(e)}function gh(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t.kind;return typeof n==`string`&&Object.values(gs).includes(n)?t:void 0}catch{return}}function une({client:e=new Tc}){let[t]=(0,S.useState)(()=>new Yr({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchIntervalInBackground:!1}}})),[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=new URLSearchParams(globalThis.location.search).get(`grant`);(async()=>{if(t!==null){let n=await e.auth.redeem(t);if(globalThis.history.replaceState({},``,`${globalThis.location.pathname}${globalThis.location.hash}`),n)return r(!0)}return e.auth.session().then(r).catch(()=>r(!1))})()},[e]),n===void 0?null:n?(0,w.jsx)($r,{client:t,children:(0,w.jsx)(Dc.Provider,{value:e,children:(0,w.jsx)(fne,{})})}):(0,w.jsx)(dne,{client:e,onAuthenticated:()=>r(!0)})}function dne({client:e,onAuthenticated:t}){let[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(!1);async function o(r){r.preventDefault(),await e.auth.redeem(n)?t():a(!0)}return(0,w.jsx)(`main`,{className:`wake-login`,children:(0,w.jsxs)(`div`,{className:`wake-login-panel`,children:[(0,w.jsx)(`section`,{className:`wake-login-brand`,children:(0,w.jsx)(`img`,{className:`wake-login-logo`,src:hi,alt:`Wake logo`})}),(0,w.jsxs)(`section`,{className:`wake-login-card`,children:[(0,w.jsx)(`h1`,{children:`Login`}),(0,w.jsx)(`p`,{children:`Enter a temporary login code, or scan the code from your operator terminal.`}),(0,w.jsxs)(`form`,{onSubmit:o,children:[(0,w.jsx)(`label`,{htmlFor:`access-key`,children:`Temporary login code`}),(0,w.jsx)(`input`,{id:`access-key`,type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!0,required:!0}),(0,w.jsx)(`button`,{className:`wake-login-submit`,type:`submit`,children:`Sign in`}),i&&(0,w.jsx)(`p`,{role:`alert`,children:`Unable to sign in.`})]})]})]})})}function fne(){return(0,w.jsx)(Nm,{children:(0,w.jsxs)(Kt,{children:[(0,w.jsx)(Wt,{path:`/`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})}),(0,w.jsx)(Wt,{path:`/board`,element:(0,w.jsx)(mte,{})}),(0,w.jsx)(Wt,{path:`/work`,element:(0,w.jsx)(ane,{})}),(0,w.jsx)(Wt,{path:`/work/:workItemKey`,element:(0,w.jsx)(mh,{})}),(0,w.jsx)(Wt,{path:`/events`,element:(0,w.jsx)(Rte,{})}),(0,w.jsx)(Wt,{path:`/runs`,element:(0,w.jsx)(Gte,{})}),(0,w.jsx)(Wt,{path:`/runs/:runId`,element:(0,w.jsx)(Jte,{})}),(0,w.jsx)(Wt,{path:`/observability`,element:(0,w.jsx)(Wte,{})}),(0,w.jsx)(Wt,{path:`/health`,element:(0,w.jsx)(Vte,{})}),(0,w.jsx)(Wt,{path:`/configuration`,element:(0,w.jsx)(Lte,{})}),(0,w.jsx)(Wt,{path:`*`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})})]})})}(0,mi.createRoot)(document.getElementById(`root`)).render((0,w.jsx)(S.StrictMode,{children:(0,w.jsx)(Nn,{children:(0,w.jsx)(une,{})})}));
|
|
1118
|
+
}`),ee=pi({mutationFn:async({runId:n,outcome:r,status:i})=>{let a=globalThis.crypto.randomUUID();if(await t.execution.resolveAmbiguousRun(n,i===ps.Failed?{status:ps.Failed,reason:v}:{status:ps.Succeeded,outcome:r},`web:resolve-ambiguous-run:${a}`),i!==ps.Succeeded)return t.work.command(e,`retry`,`web:retry-after-ambiguous-resolution:${globalThis.crypto.randomUUID()}`)},onSuccess:i}),[te,ne]=(0,S.useState)(`overview`),C=(0,S.useRef)(null),re=(0,S.useRef)(!0),[ie,ae]=(0,S.useState)(!1),oe=[...m.data?.data.conversation.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)),se=oe.at(-1),ce=m.data?.data.execution.runs.find(e=>e.active);(0,S.useEffect)(()=>{let e=oe.filter(e=>e.origin===`agent`).length;c&&e>u.current&&l(!1)},[c,oe]),(0,S.useLayoutEffect)(()=>{re.current=!0,ae(!1)},[te]),(0,S.useLayoutEffect)(()=>{te===`conversation`&&re.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[te,se?.entryId,se?.body]);let[le,ue]=(0,S.useState)(),[de,fe]=(0,S.useState)(!1),[pe,me]=(0,S.useState)(),he=fi({queryKey:vm.events.list(``,e),queryFn:({signal:n})=>t.events.list(void 0,e,n),refetchInterval:ym.events,enabled:e!==``}),ge=[...m.data?.data.execution.transcriptGroups??[]].sort((e,t)=>Number(e.kind===`run`)-Number(t.kind===`run`)||t.latestAt.localeCompare(e.latestAt)),_e=m.data?.data.orchestration.primary,ve=[...m.data?.data.execution.runs??[]].filter(e=>e.workflowInstanceId===_e?.workflowInstanceId&&e.status===`ambiguous`).sort((e,t)=>t.startedAt.localeCompare(e.startedAt))[0],ye=_e!=null&&_e.status===`blocked`&&lne(_e.blockReason),be=ge.find(e=>e.groupId===le)??ge[0],xe=fi({queryKey:vm.work.transcript(e,be?.groupId??``),queryFn:({signal:n})=>t.work.transcript(e,be.groupId,n),refetchInterval:ym.historicalRuns,enabled:te===`transcripts`&&e!==``&&be!==void 0}),Se=pe!==void 0&&be?.runIds.includes(pe)?pe:be?.runIds.at(-1),Ce=[...xe.data?.data.entries??[]].sort((e,t)=>e.occurredAt.localeCompare(t.occurredAt)).filter(e=>!de||e.runId===Se),we=e=>{let t=ge.find(t=>t.groupId===e);ue(e),me(t?.runIds.at(-1)),fe(!1)},Te=e=>{let t=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)??[]),n=t.indexOf(e.currentTarget);if(n<0)return;let r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;if(r===void 0)return;e.preventDefault();let i=t[r];if(i===void 0)return;let a=i.dataset.tab;ne(a),i.focus()};return(0,w.jsx)(`div`,{className:`${Pm.detail} ${te===`conversation`?Pm.detailChat:``}`,children:m.isPending?(0,w.jsx)(Dm,{label:`Loading work detail`}):m.error&&!m.data?(0,w.jsx)(km,{error:m.error,retry:()=>void m.refetch()}):m.data?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:Pm.tabs,role:`tablist`,"aria-label":`Work detail sections`,children:[`overview`,`runs`,`artifacts`,`events`,`transcripts`,`conversation`].map(e=>(0,w.jsx)(`button`,{type:`button`,role:`tab`,"data-tab":e,id:`work-detail-${e}-tab`,"aria-controls":`work-detail-${e}-panel`,"aria-selected":te===e,tabIndex:te===e?0:-1,onKeyDown:Te,onClick:()=>ne(e),children:e===`overview`?`Overview`:e[0].toUpperCase()+e.slice(1)},e))}),(0,w.jsxs)(`h1`,{className:Pm.workTitle,children:[m.data.data.work.externalRef&&(0,w.jsx)(`span`,{children:m.data.data.work.externalRef}),m.data.data.work.objective]}),te!==`conversation`&&te!==`transcripts`&&(0,w.jsxs)(`div`,{className:Pm.workSummary,children:[(0,w.jsx)(wm,{children:(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Work identity`}),(0,w.jsx)(`dd`,{children:m.data.data.work.workItemId})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`State`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Fm,{variant:`outline`,children:m.data.data.work.state})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Workflow`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.workflowName??`?`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Stage`}),(0,w.jsx)(`dd`,{children:m.data.data.orchestration.primary?.currentStage??`Not started`})]}),ye&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Blocked because`}),(0,w.jsx)(`dd`,{children:`Ambiguous run requires an operator decision`})]})}),m.data.data.work.lastRunOutcome!==void 0&&(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Last run`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Um,{outcome:m.data.data.work.lastRunOutcome,title:`Outcome of the most recent run`})})]})})]})}),(0,w.jsxs)(`div`,{className:Pm.actionBar,children:[m.data.data.orchestration.primary?.retryEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`retry`),children:`Retry`}),m.data.data.orchestration.primary?.extendEligible===!0&&(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(`extend`),children:`Extend`}),(0,w.jsx)(Tm,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(m.data.data.work.frozen?`unfreeze`:`freeze`),children:m.data.data.work.frozen?`Unfreeze`:`Freeze`}),(0,w.jsx)(Tm,{type:`button`,className:Pm.dangerButton,disabled:a.isPending,onClick:()=>{window.confirm(`Delete this work item from the board and remove its resource correlations?`)&&a.mutate(`delete`)},children:`Delete`}),(0,w.jsx)(Am,{pending:a.isPending,...a.error===null?{}:{message:a.error?.message}})]})]}),te===`runs`?(0,w.jsx)(`section`,{id:`work-detail-runs-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-runs-tab`,children:m.data.data.execution.runs.length===0?(0,w.jsx)(Om,{children:`No runs`}):(0,w.jsx)(uh,{caption:`Runs`,rows:m.data.data.execution.runs,rowKey:e=>e.runId,columns:dh})}):te===`artifacts`?(0,w.jsx)(`section`,{id:`work-detail-artifacts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-artifacts-tab`,children:m.data.data.artifacts.length===0?(0,w.jsx)(Om,{children:`No published artifacts`}):(0,w.jsx)(uh,{caption:`Published artifacts`,rows:m.data.data.artifacts,rowKey:e=>e.revisionId,columns:[{label:`Producer`,render:e=>e.producer},{label:`Path`,render:e=>(0,w.jsx)(`a`,{href:e.href,children:e.path})},{label:`Type`,render:e=>e.mediaType??`binary`},{label:`Bytes`,render:e=>e.byteLength?.toLocaleString()??`?`}]})}):te===`conversation`?(0,w.jsxs)(`section`,{id:`work-detail-conversation-panel`,className:Pm.conversationPanel,role:`tabpanel`,"aria-labelledby":`work-detail-conversation-tab`,children:[(0,w.jsx)(`div`,{ref:C,className:Pm.conversationViewport,role:`region`,"aria-label":`Message history`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;re.current=t.scrollHeight-t.scrollTop-t.clientHeight<64,ae(!re.current)},children:oe.length===0?(0,w.jsx)(Om,{children:`No conversation messages`}):(0,w.jsx)(`ol`,{className:Pm.conversationTimeline,"aria-label":`Conversation`,children:oe.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.sourceResourceId);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`article`,{className:Pm.conversationEntry,"data-origin":e.origin,children:[(0,w.jsx)(sne,{actorId:e.actorId,sourceAdapter:e.sourceAdapter}),(0,w.jsxs)(`header`,{className:Pm.conversationEntryHead,children:[(0,w.jsx)(`strong`,{children:e.actorId}),(0,w.jsxs)(`span`,{className:Pm.conversationSource,children:[`via `,e.sourceAdapter??e.origin]}),(0,w.jsx)(sh,{value:e.occurredAt}),e.runId!==void 0&&(0,w.jsxs)(`span`,{children:[(0,w.jsxs)(Pn,{to:`/runs/${encodeURIComponent(e.runId)}`,children:[`run `,e.runId]}),e.stage===void 0?``:` (${e.stage})`]}),t!==void 0&&(0,w.jsx)(`span`,{children:t.externalUrl===void 0?t.locatorLabel:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:t.locatorLabel})})]}),e.deleted?(0,w.jsx)(`em`,{children:`Message deleted`}):(0,w.jsx)(`div`,{className:Pm.conversationBody,children:e.body}),e.representations.length>0&&(0,w.jsx)(`footer`,{className:Pm.conversationRepresentations,children:e.representations.map(e=>{let t=m.data.data.resources.find(t=>t.resourceId===e.resourceId),n=t?.locatorLabel??e.resourceId;return(0,w.jsxs)(`span`,{children:[`Published to`,` `,t?.externalUrl===void 0?n:(0,w.jsx)(`a`,{href:t.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:n})]},`${e.resourceId}:${e.externalId}`)})})]})},e.entryId)})})}),(0,w.jsxs)(`div`,{className:Pm.conversationFooter,children:[c&&(0,w.jsxs)(`div`,{className:Pm.conversationProgress,role:`status`,"aria-live":`polite`,children:[ce===void 0?(0,w.jsx)(T,{icon:zc,className:Pm.conversationWaitingIcon,"aria-hidden":`true`}):(0,w.jsx)(`span`,{className:Pm.conversationProgressDot,"data-active-run":`true`}),(0,w.jsx)(`span`,{className:Pm.conversationProgressTitle,children:ce===void 0?`Queued for Wake`:ce.activity}),ce!==void 0&&(0,w.jsxs)(`span`,{className:Pm.conversationProgressMeta,children:[ce.stage!==void 0&&`Stage: ${ce.stage}`,ce.stage!==void 0&&(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&` · `,(ce.runnerName!==void 0||ce.runnerModel!==void 0)&&`Runner: ${ce.runnerName??ce.runnerModel}`]})]}),ie&&(0,w.jsx)(Tm,{className:Pm.conversationLatest,onClick:()=>{re.current=!0,ae(!1),C.current&&(C.current.scrollTop=C.current.scrollHeight)},children:`Jump to latest`}),m.data.data.conversation.canCreateEntries&&(0,w.jsxs)(`form`,{className:Pm.conversationComposer,onSubmit:e=>{e.preventDefault(),p()},children:[(0,w.jsx)(`textarea`,{ref:d,id:`work-conversation-message`,"aria-label":`Message`,value:o,disabled:f.isPending,onChange:e=>{s(e.target.value),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,192)}px`},placeholder:`Add context, answer a question, or direct the current work.`,rows:1}),(0,w.jsxs)(`div`,{className:Pm.conversationComposerActions,children:[(0,w.jsx)(Tm,{type:`submit`,className:Pm.conversationSend,"aria-label":`Send message`,disabled:f.isPending||o.trim()===``,children:(0,w.jsx)(T,{icon:jc,"aria-hidden":`true`})}),(0,w.jsx)(Am,{pending:f.isPending,...f.error===null?{}:{message:f.error?.message}})]})]})]})]}):te===`transcripts`?(0,w.jsxs)(`section`,{id:`work-detail-transcripts-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-transcripts-tab`,children:[(0,w.jsx)(`h2`,{id:`work-transcripts`,children:`Transcript conversations`}),ge.length===0?(0,w.jsx)(Om,{children:`No transcript conversations`}):(0,w.jsxs)(`div`,{className:Pm.transcriptLayout,children:[(0,w.jsx)(`ol`,{className:Pm.transcriptGroups,"aria-label":`Transcript groups`,children:ge.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,className:Pm.transcriptGroup,"aria-pressed":be?.groupId===e.groupId,onClick:()=>we(e.groupId),children:[(0,w.jsx)(`span`,{children:e.groupId}),(0,w.jsx)(`span`,{children:e.kind===`session`?`Session`:`Run fallback`}),e.cli!==void 0&&(0,w.jsx)(`span`,{children:e.cli}),(0,w.jsx)(sh,{value:e.latestAt}),(0,w.jsx)(`span`,{children:e.runIds.join(`, `)})]})},e.groupId))}),(0,w.jsxs)(`div`,{className:Pm.transcriptConversation,children:[be!==void 0&&be.runIds.length>1&&(0,w.jsxs)(`div`,{className:Pm.transcriptFilters,children:[(0,w.jsxs)(`label`,{children:[`Run`,(0,w.jsx)(`select`,{value:Se??``,onChange:e=>me(e.target.value),children:be.runIds.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))})]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:de,onChange:e=>fe(e.target.checked)}),`This run only`]})]}),xe.isPending?(0,w.jsx)(Dm,{label:`Loading transcript`}):xe.error?(0,w.jsx)(km,{error:xe.error,retry:()=>void xe.refetch()}):xe.data?.data.available===!1?(0,w.jsx)(Om,{children:`Transcript unavailable`}):Ce.length===0?(0,w.jsx)(Om,{children:`No transcript messages`}):(0,w.jsx)(`ol`,{className:Pm.transcript,"aria-label":`Transcript conversation`,children:Ce.map((e,t)=>(0,w.jsxs)(`li`,{children:[t>0&&Ce[t-1]?.runId!==e.runId&&(0,w.jsxs)(`div`,{className:Pm.transcriptRunSeparator,role:`separator`,"aria-label":`Run ${e.runId}`,children:[`Run `,e.runId]}),(0,w.jsxs)(`article`,{className:e.channel===`input`?Pm.transcriptInput:Pm.transcriptAgent,"aria-label":`${e.channel===`input`?`Input`:`Agent`} message from ${e.runId}`,children:[(0,w.jsxs)(`div`,{className:Pm.transcriptHead,children:[(0,w.jsx)(`span`,{children:e.channel===`input`?`Input`:`Agent`}),(0,w.jsx)(sh,{value:e.occurredAt}),(0,w.jsxs)(`span`,{children:[`Run `,e.runId]}),e.channel===`agent`&&e.durationMs!==void 0&&(0,w.jsx)(`span`,{children:Rm(e.durationMs)})]}),(0,w.jsx)(`pre`,{className:Pm.transcriptText,style:{whiteSpace:`pre-wrap`},children:e.text})]})]},`${e.occurredAt}-${t}`))})]})]})]}):te===`events`?(0,w.jsxs)(`section`,{id:`work-detail-events-panel`,role:`tabpanel`,"aria-labelledby":`work-detail-events-tab`,children:[(0,w.jsx)(`h2`,{id:`work-events`,children:`Events`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading events`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):he.data?.items.length?(0,w.jsx)(`ol`,{className:Pm.eventList,children:[...he.data.items].sort((e,t)=>t.position-e.position).map(e=>(0,w.jsx)(ch,{record:e},e.id))}):(0,w.jsx)(Om,{children:`No events`})]}):(0,w.jsxs)(`div`,{id:`work-detail-overview-panel`,className:Pm.overviewLayout,role:`tabpanel`,"aria-labelledby":`work-detail-overview-tab`,children:[(0,w.jsx)(`div`,{className:Pm.overviewWorkflow,children:h.data?.data.diagrams[0]===void 0?null:(0,w.jsx)(rh,{diagram:h.data.data.diagrams[0]})}),(0,w.jsxs)(`aside`,{className:Pm.overviewSidebar,children:[ye&&ve!==void 0&&(0,w.jsxs)(wm,{labelledBy:`ambiguous-run-resolution`,children:[(0,w.jsx)(`h2`,{id:`ambiguous-run-resolution`,className:Pm.sidebarSectionTitle,children:`Resolve ambiguous run`}),(0,w.jsx)(`p`,{children:`Decide what happened before retrying this work. Wake will record your decision, then retry the work item.`}),(0,w.jsxs)(`dl`,{className:Pm.summary,children:[(0,w.jsx)(`dt`,{children:`Run`}),(0,w.jsx)(`dd`,{children:ve.runId}),(0,w.jsx)(`dt`,{children:`Token usage`}),(0,w.jsx)(`dd`,{children:(0,w.jsx)(Wm,{usage:ve})}),(0,w.jsx)(`dt`,{children:`Cost`}),(0,w.jsx)(`dd`,{children:Im(ve.totalCostUsd)}),(0,w.jsx)(`dt`,{children:`Pull request`}),(0,w.jsx)(`dd`,{children:m.data.data.activities.pullRequest===void 0?`None recorded`:`Recorded for this work item`})]}),(0,w.jsxs)(`fieldset`,{disabled:ee.isPending,children:[(0,w.jsx)(`legend`,{children:`Actual outcome`}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Failed,onChange:()=>_(ps.Failed)}),`Failed`]}),(0,w.jsxs)(`label`,{children:[(0,w.jsx)(`input`,{type:`radio`,name:`ambiguous-run-outcome`,checked:g===ps.Succeeded,onChange:()=>_(ps.Succeeded)}),`Succeeded`]}),g===ps.Failed?(0,w.jsxs)(`label`,{children:[`Reason`,(0,w.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value)})]}):(0,w.jsxs)(`label`,{children:[`Actual activity outcome (JSON)`,(0,w.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value)})]})]}),(0,w.jsx)(Tm,{type:`button`,disabled:ee.isPending||g===ps.Failed&&v.trim()===``||g===ps.Succeeded&&gh(b)===void 0,onClick:()=>{let e=g===ps.Succeeded?gh(b):void 0;(g!==ps.Succeeded||e!==void 0)&&ee.mutate({runId:ve.runId,outcome:e,status:g})},children:g===ps.Failed?`Resolve and retry`:`Resolve run`}),g===ps.Succeeded&&gh(b)===void 0&&(0,w.jsx)(`p`,{role:`alert`,children:`The actual activity outcome must be an object with a supported outcome kind.`}),(0,w.jsx)(Am,{pending:ee.isPending,...ee.error===null?{}:{message:ee.error.message}})]}),(0,w.jsxs)(`section`,{"aria-labelledby":`work-resources`,children:[(0,w.jsx)(`h2`,{id:`work-resources`,className:Pm.sidebarSectionTitle,children:`Resources`}),m.data.data.resources.length===0?(0,w.jsx)(Om,{children:`No correlated resources`}):(0,w.jsx)(`ul`,{className:Pm.resourceList,"aria-label":`Resources`,children:m.data.data.resources.map(e=>{let t=ine[e.adapter]??nne,n=e.title??e.locatorLabel,r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:Pm.resourceCardTop,children:[(0,w.jsx)(t,{className:Pm.resourceCardIcon}),(0,w.jsx)(`span`,{className:Pm.resourceCardTitle,children:n}),e.externalUrl!==void 0&&(0,w.jsx)(rne,{className:Pm.resourceCardExt})]}),(0,w.jsxs)(`div`,{className:Pm.resourceCardMeta,children:[e.title!==void 0&&(0,w.jsx)(`span`,{className:Pm.resourceId,children:e.locatorLabel}),e.capabilities.map(e=>(0,w.jsx)(Fm,{variant:`outline`,children:e},e))]})]});return(0,w.jsx)(`li`,{children:e.externalUrl===void 0?(0,w.jsx)(`div`,{className:Pm.resourceCard,children:r}):(0,w.jsx)(`a`,{className:Pm.resourceCard,href:e.externalUrl,target:`_blank`,rel:`noopener noreferrer`,children:r})},e.resourceId)})})]})]}),(0,w.jsxs)(`section`,{className:Pm.overviewMain,"aria-labelledby":`work-activity`,children:[(0,w.jsx)(`h2`,{id:`work-activity`,className:Pm.sidebarSectionTitle,children:`Activity timeline`}),he.isPending?(0,w.jsx)(Dm,{label:`Loading activity`}):he.error?(0,w.jsx)(km,{error:he.error,retry:()=>void he.refetch()}):hh(m.data.data.execution.runs,he.data?.items??[]).length?(0,w.jsx)(`ol`,{className:Pm.activityTimeline,"aria-label":`Activity timeline`,children:hh(m.data.data.execution.runs,he.data?.items??[]).map(e=>(0,w.jsxs)(`li`,{className:Pm.activityTimelineItem,children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineMarker,"data-kind":e.kind}),(0,w.jsx)(sh,{value:e.occurredAt}),e.kind===`run`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`run`,children:`Run`}),(0,w.jsx)(Pn,{to:`/runs/${encodeURIComponent(e.run.runId)}`,children:e.run.activity}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stage: `,e.run.stage??`Not assigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Runner:`,` `,e.run.runnerName??e.run.runnerModel??`Unassigned`]}),(0,w.jsxs)(`span`,{className:Pm.activityTimelineOutcome,children:[`Outcome: `,cne(e.run)]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:Pm.activityTimelineKind,"data-kind":`event`,children:`Event`}),(0,w.jsx)(`span`,{children:e.event.type}),e.event.stream!==void 0&&(0,w.jsxs)(`span`,{className:Pm.activityTimelineDetail,children:[`Stream: `,e.event.stream.kind]})]})]},e.id))}):(0,w.jsx)(Om,{children:`No activity yet`})]})]})]}):null})}function sne({actorId:e,sourceAdapter:t}){let[n,r]=(0,S.useState)(!1),i=t===`github`&&e.trim()!==``;return(0,w.jsx)(`span`,{className:Pm.conversationAvatar,"aria-label":i?`${e} GitHub avatar`:e,children:i&&!n?(0,w.jsx)(`img`,{src:`https://github.com/${encodeURIComponent(e)}.png?size=64`,alt:``,onError:()=>r(!0)}):e.slice(0,2).toUpperCase()})}function hh(e,t){return[...e.map(e=>({id:`run:${e.runId}`,kind:`run`,occurredAt:e.finishedAt??e.startedAt,run:e})),...t.map(e=>({id:`event:${e.id}`,kind:`event`,occurredAt:e.occurredAt,event:e}))].sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt))}function cne(e){return e.resolution?.sentinel??e.sentinel??e.status}function lne(e){return e!==void 0&&/^run-ambiguous-after-\d+-attempts$/.test(e)}function gh(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t.kind;return typeof n==`string`&&Object.values(gs).includes(n)?t:void 0}catch{return}}function une({client:e=new Tc}){let[t]=(0,S.useState)(()=>new Yr({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchIntervalInBackground:!1}}})),[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=new URLSearchParams(globalThis.location.search).get(`grant`);(async()=>{if(t!==null){let n=await e.auth.redeem(t);if(globalThis.history.replaceState({},``,`${globalThis.location.pathname}${globalThis.location.hash}`),n)return r(!0)}return e.auth.session().then(r).catch(()=>r(!1))})()},[e]),n===void 0?null:n?(0,w.jsx)($r,{client:t,children:(0,w.jsx)(Dc.Provider,{value:e,children:(0,w.jsx)(fne,{})})}):(0,w.jsx)(dne,{client:e,onAuthenticated:()=>r(!0)})}function dne({client:e,onAuthenticated:t}){let[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(!1);async function o(r){r.preventDefault(),await e.auth.redeem(n)?t():a(!0)}return(0,w.jsx)(`main`,{className:`wake-login`,children:(0,w.jsxs)(`div`,{className:`wake-login-panel`,children:[(0,w.jsx)(`section`,{className:`wake-login-brand`,children:(0,w.jsx)(`img`,{className:`wake-login-logo`,src:hi,alt:`Wake logo`})}),(0,w.jsxs)(`section`,{className:`wake-login-card`,children:[(0,w.jsx)(`h1`,{children:`Login`}),(0,w.jsx)(`p`,{children:`Enter a temporary login code, or scan the code from your operator terminal.`}),(0,w.jsxs)(`form`,{onSubmit:o,children:[(0,w.jsx)(`label`,{htmlFor:`access-key`,children:`Temporary login code`}),(0,w.jsx)(`input`,{id:`access-key`,type:`password`,value:n,onChange:e=>r(e.target.value),autoFocus:!0,required:!0}),(0,w.jsx)(`button`,{className:`wake-login-submit`,type:`submit`,children:`Sign in`}),i&&(0,w.jsx)(`p`,{role:`alert`,children:`Unable to sign in.`})]})]})]})})}function fne(){return(0,w.jsx)(Nm,{children:(0,w.jsxs)(Kt,{children:[(0,w.jsx)(Wt,{path:`/`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})}),(0,w.jsx)(Wt,{path:`/board`,element:(0,w.jsx)(mte,{})}),(0,w.jsx)(Wt,{path:`/work`,element:(0,w.jsx)(ane,{})}),(0,w.jsx)(Wt,{path:`/work/:workItemKey`,element:(0,w.jsx)(mh,{})}),(0,w.jsx)(Wt,{path:`/events`,element:(0,w.jsx)(Rte,{})}),(0,w.jsx)(Wt,{path:`/runs`,element:(0,w.jsx)(Gte,{})}),(0,w.jsx)(Wt,{path:`/runs/:runId`,element:(0,w.jsx)(Jte,{})}),(0,w.jsx)(Wt,{path:`/observability`,element:(0,w.jsx)(Wte,{})}),(0,w.jsx)(Wt,{path:`/health`,element:(0,w.jsx)(Vte,{})}),(0,w.jsx)(Wt,{path:`/configuration`,element:(0,w.jsx)(Lte,{})}),(0,w.jsx)(Wt,{path:`*`,element:(0,w.jsx)(Ut,{to:`/board`,replace:!0})})]})})}(0,mi.createRoot)(document.getElementById(`root`)).render((0,w.jsx)(S.StrictMode,{children:(0,w.jsx)(Nn,{children:(0,w.jsx)(une,{})})}));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Wake</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-8cbjygY-.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Be7GB8fP.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|