onepipeline-ui 0.76.0 → 0.78.0
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.
|
@@ -109,6 +109,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
109
109
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}]};function a(e,t,n,r){let i=l(e,n,r),a=i[0];if(a){let t=e.align?e.align.length:0,n=-1;if(!t)for(;++n<i.length;)i[n].length>t&&(t=i[n].length);for(;a.length<t;)a.push(``)}return c(i,e.align)}function o(e,t,n,r){let i=c([u(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
110
110
|
`))}function s(e,t,n,r){let a=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:i,after:i});return o(),a(),s}function c(e,i){return qZ(e,{align:i,alignDelimiters:n,fillRows:!1,padding:t,stringLength:r})}function l(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=u(r[i],t,n);return o(),a}function u(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=s(r[i],e,t,n);return o(),a}function d(e,t,n){let r=WQ.inlineCode(e,t,n);if(!n.stack.includes(`tableCell`))return r;let i=[],a=0,o=r.indexOf(`|`);for(;o!==-1;){let e=o;for(;e>a&&r.charCodeAt(e-1)===92;)e--;i.push(r.slice(a,o)),(o-e)%2==0&&i.push(`\\`),a=o,o=r.indexOf(`|`,o+1)}return i.push(r.slice(a)),i.join(``)}}function e$(e,t,n,r){if(e.type===`table`&&n.type===`listItem`&&n.spread===!1&&(t.type===`definition`||t.type===`heading`&&t$(t,r)||t.type===`paragraph`||t.type===`table`))return 1}function t$(e,t){let n=!1;return xb(e,function(e){if(e.type===`break`||`value`in e&&/\r?\n|\r/.test(e.value))return n=!0,!1}),!!((!e.depth||e.depth<3)&&_g(e)&&(t.options.setext||n))}function n$(){return{exit:{taskListCheckValueChecked:i$,taskListCheckValueUnchecked:i$,paragraph:a$}}}function r$(){return{handlers:{paragraph:o$},join:[s$]}}function i$(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function a$(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start={...n.position.start}))}}this.exit(e)}function o$(e,t,n,r){if(!t||t.type!==`listItem`||c$(t)!==e)return WQ.paragraph(e,t,n,r);let i=`[`+(t.checked?`x`:` `)+`] `,a=n.createTracker(r);return a.move(i),i+WQ.paragraph(e.children.length>0?e:{type:`paragraph`,children:[{type:`text`,value:` `}]},t,n,{...r,...a.current()})}function s$(e,t,n){if(!(e.type===`definition`&&n.type===`listItem`))return;let r=c$(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function c$(e){if(typeof e.checked==`boolean`)for(let t of e.children){if(t.type===`paragraph`)return t;if(t.type!==`definition`)return}}function l$(){return[cZ(),PZ(),zZ(),GQ(),n$()]}function u$(e){return{extensions:[lZ(),FZ(e),BZ(),$Q(e),r$()]}}var d$={tokenize:T$,partial:!0},f$={tokenize:E$,partial:!0},p$={tokenize:D$,partial:!0},m$={tokenize:O$,partial:!0},h$={tokenize:k$,partial:!0},g$={name:`wwwAutolink`,tokenize:C$,previous:A$},_$={name:`protocolAutolink`,tokenize:w$,previous:j$},v$={name:`emailAutolink`,tokenize:S$,previous:M$},y$={};function b$(){return{text:y$}}for(var x$=48;x$<123;)y$[x$]=v$,x$++,x$===58?x$=65:x$===91&&(x$=97);y$[43]=v$,y$[45]=v$,y$[46]=v$,y$[95]=v$,y$[72]=[v$,_$],y$[104]=[v$,_$],y$[87]=[v$,g$],y$[119]=[v$,g$];function S$(e,t,n){let r=this,i,a;return o;function o(t){return!N$(t)||!M$.call(r,r.previous)||P$(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return N$(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(h$,u,l)(t):t===45||t===95||Mg(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&jg(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function C$(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!A$.call(r,r.previous)||P$(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(d$,e.attempt(f$,e.attempt(p$,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function w$(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&j$.call(r,r.previous)&&!P$(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(jg(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Pg(t)||Rg(t)||Vg(t)||Bg(t)?n(t):e.attempt(f$,e.attempt(p$,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function T$(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function E$(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(m$,c,s)(t):t===null||Rg(t)||Vg(t)||t!==45&&Bg(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function D$(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(m$,t,a)(o):o===null||Rg(o)||Vg(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function O$(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Rg(o)||Vg(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Rg(e)||Vg(e)?t(e):r(e)}function a(e){return jg(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):jg(t)?(e.consume(t),o):n(t)}}function k$(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Mg(e)?n(e):t(e)}}function A$(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rg(e)}function j$(e){return!jg(e)}function M$(e){return!(e===47||N$(e))}function N$(e){return e===43||e===45||e===46||e===95||Mg(e)}function P$(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var F$={tokenize:U$,partial:!0};function I$(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:B$,continuation:{tokenize:V$},exit:H$}},text:{91:{name:`gfmFootnoteCall`,tokenize:z$},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:L$,resolveTo:R$}}}}function L$(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Ag(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function R$(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function z$(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Rg(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Ag(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Rg(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function B$(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Rg(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Ag(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Rg(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Wg(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function V$(e,t,n){return e.check(a_,t,e.attempt(F$,t,n))}function H$(e){e.exit(`gfmFootnoteDefinition`)}function U$(e,t,n){let r=this;return Wg(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function W$(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Cg(o,o.length,0,Qg(s,e.slice(r+1,n),t)),Cg(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Cg(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Zg(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Zg(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var G$=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){K$(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function K$(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function q$(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function J$(){return{flow:{null:{name:`table`,tokenize:Y$,resolveAll:X$}}}}function Y$(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):G(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):zg(t)?Wg(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Rg(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,zg(t)?Wg(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return zg(t)?Wg(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||G(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return zg(t)?Wg(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||G(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||G(n)?(e.exit(`tableRow`),t(n)):zg(n)?Wg(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Rg(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function X$(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new G$;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(Q$(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=Z$(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=Z$(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=Z$(f,t,o,i,n,d)):(o[0]=o[1],d=Z$(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&Q$(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=q$(t.events,n))}return e}function Z$(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},$$(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=$$(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=$$(t.events,n[2]),a=$$(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},$$(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Q$(e,t,n,r,i){let a=[],o=$$(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function $$(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var e1={name:`tasklistCheck`,tokenize:n1};function t1(){return{text:{91:e1}}}function n1(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Rg(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return G(r)?t(r):zg(r)?e.check({tokenize:r1},t,n)(r):n(r)}}function r1(e,t,n){return Wg(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function i1(e){return Eg([b$(),I$(),W$(e),J$(),t1()])}var a1={};function o1(e){let t=this,n=e||a1,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(i1(n)),a.push(l$()),o.push(u$(n))}var s1=new Set([`http:`,`https:`,`mailto:`]);function c1(e){try{return new URL(e)}catch{return}}function l1(e){let t=e===void 0?void 0:c1(e)?.protocol;return t!==void 0&&s1.has(t)?e:void 0}var u1={target:`_blank`,rel:`noopener noreferrer`},d1=typeof window>`u`?V.useEffect:V.useLayoutEffect;function f1(e,t){let n=(0,V.useRef)(null);return d1(()=>{let t=n.current;if(!t||e===void 0)return;let r=()=>{t.removeAttribute(`data-otg-table-cut`);let e=t.querySelector(`table`);if(!e||t.scrollHeight<=t.clientHeight)return;let n=e.getBoundingClientRect().top-t.getBoundingClientRect().top;t.toggleAttribute(`data-otg-table-cut`,n<t.clientHeight)};r();let i=t.clientWidth,a=new ResizeObserver(()=>{t.clientWidth!==i&&(i=t.clientWidth,r())});a.observe(t);let o=!0;return document.fonts?.ready.then(()=>{o&&r()}),()=>{o=!1,a.disconnect()}},[e,t]),n}function p1(e){return e.tagName===`img`?{type:`text`,value:String(e.properties?.alt||`image`)}:(e.children&&=e.children.map(p1),e)}function m1(){let e=t=>{t.tagName===`a`?p1(t):t.children?.forEach(e)};return e}function h1({href:e,children:t}){let n=l1(e);return(0,U.jsx)(`a`,{href:n,...n===void 0?{}:u1,children:t})}var g1={a:({href:e,children:t})=>(0,U.jsx)(h1,{href:e,children:t}),img:({src:e,alt:t})=>(0,U.jsx)(h1,{href:typeof e==`string`?e:void 0,children:t||`image`})},_1=[o1],v1=[m1];function y1({source:e,clamp:t}){let n=t!==void 0&&Number.isInteger(t)&&t>0?t:void 0,r=f1(n,e),i=n===void 0?void 0:{WebkitLineClamp:n,maxHeight:`calc(${n} * 1lh)`};return(0,U.jsx)(`div`,{className:n===void 0?`otg-markdown`:`otg-markdown otg-markdown--clamped`,ref:r,style:i,children:(0,U.jsx)(yx,{components:g1,rehypePlugins:v1,remarkPlugins:_1,children:e})})}function b1({title:e,body:t,badges:n,meta:r,links:i,actions:a,clamp:o,children:s,className:c,...l}){let u=(0,V.useId)();return(0,U.jsx)(`article`,{...l,"aria-labelledby":u,className:c?`otg-card ${c}`:`otg-card`,children:(0,U.jsxs)(`div`,{className:`otg-card__surface`,children:[(0,U.jsxs)(`div`,{className:`otg-card__header`,children:[n!=null&&(0,U.jsx)(`div`,{className:`otg-card__badges`,children:n}),(0,U.jsx)(`h3`,{className:`otg-card__title`,id:u,children:e}),a!=null&&(0,U.jsx)(`div`,{className:`otg-card__actions`,children:a})]}),r!=null&&(0,U.jsx)(`div`,{className:`otg-card__meta`,children:r}),i!=null&&(0,U.jsx)(`div`,{className:`otg-card__links`,children:i}),t?(0,U.jsx)(y1,{source:t,...o===void 0?{}:{clamp:o}}):null,s]})})}var x1=new Map([[`github.com`,`GitHub`],[`linear.app`,`Linear`]]);function S1(e){return x1.get(c1(e)?.hostname??``)??`tracker`}function C1({url:e,label:t,...n}){let r=l1(e);return(0,U.jsx)(`a`,{"aria-label":`Open ${S1(e)} issue ${t}`,...n,href:r,...u1,className:[`otg-source-link`,n.className].filter(Boolean).join(` `),children:t})}var w1=15e3;function T1(e,t,n){let[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(null),{key:m,phase:h,followUp:g}=e,_=h===`sending`||g?.phase===`failed`||g?.phase===`sending`;return(0,V.useLayoutEffect)(()=>{if(f(!1),_)return;let e=setTimeout(()=>f(!0),w1);return()=>clearTimeout(e)},[`${m}:${h}:${g?.kind??``}:${g?.phase??``}`,_]),(0,V.useEffect)(()=>{c(!1),u(``)},[m]),(0,V.useEffect)(()=>{g?.kind===`note`&&g.phase===`done`&&(c(!1),u(``))},[g]),(0,V.useEffect)(()=>{if(!d||r||s)return;let e=p.current?.contains(document.activeElement)??!1;a&&e||t()},[d,r,a,s,t]),(0,V.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>n(e.getBoundingClientRect().height);t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect(),n(0)}},[n]),{holds:{ref:p,onFocus:()=>o(!0),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||o(!1)},onPointerEnter:()=>i(!0),onPointerLeave:()=>i(!1)},writing:s,setWriting:c,text:l,setText:u}}var E1={complete:`Completed`,dismiss:`Dismissed`},D1={complete:`Completing`,dismiss:`Dismissing`},O1={complete:`Reopened`,dismiss:`Restored`};function k1(e){let{action:t,title:n,phase:r,error:i,followUp:a}=e;if(r===`failed`)return`Not ${E1[t].toLowerCase()}: ${n}. ${i??``}`.trim();let o=O1[t],s=t===`dismiss`?`Reason`:`Comment`;return a?.phase===`failed`?a.kind===`undo`?`Not ${o.toLowerCase()}: ${n}. ${a.error??``}`.trim():`${s} not saved: ${n}. ${a.error??``}`.trim():a?.phase===`done`?a.kind===`undo`?`${o}: ${n}`:`${s} saved: ${n}`:r===`sending`?`${D1[t]}: ${n}…`:`${E1[t]}: ${n}`}function A1({toast:e,onUndo:t,onNote:n,onClose:r,onRoom:i}){let{holds:a,writing:o,setWriting:s,text:c,setText:l}=T1(e,r,i),u=(0,V.useId)(),{action:d,phase:f,followUp:p}=e,m=f===`failed`||p?.phase===`failed`,h=f!==`failed`,g=p?.kind===`undo`&&p.phase===`done`,_=d===`dismiss`?`Add reason`:`Add comment`,v=d===`dismiss`?`Reason`:`Comment`;return(0,U.jsxs)(`section`,{"aria-label":`Action result`,className:`human-items-toast`,"data-phase":p?.phase??f,"data-tone":m?`failure`:`success`,...a,children:[(0,U.jsx)(`p`,{className:`human-items-toast-message`,role:m?`alert`:`status`,children:k1(e)}),h&&!g&&(0,U.jsxs)(`div`,{className:`human-items-toast-actions`,children:[(0,U.jsx)(j1,{label:d===`dismiss`?`Restore`:`Reopen`,onPress:t,reopen:e.reopen,sending:p?.kind===`undo`&&p.phase===`sending`}),!o&&(0,U.jsx)(`button`,{className:`human-items-toast-action`,onClick:()=>s(!0),type:`button`,children:_})]}),h&&!g&&o&&(0,U.jsxs)(`form`,{className:`human-items-toast-note`,onSubmit:e=>{e.preventDefault(),c.trim()!==``&&n(c)},children:[(0,U.jsx)(`label`,{className:`sr-only`,htmlFor:u,children:v}),(0,U.jsx)(`input`,{autoFocus:!0,id:u,onChange:e=>l(e.target.value),placeholder:`${v}, then Enter`,readOnly:p?.kind===`note`&&p.phase===`sending`,value:c}),(0,U.jsx)(`button`,{className:`human-items-toast-action`,type:`submit`,children:p?.kind===`note`&&p.phase===`failed`?`Send again`:`Send`})]}),(0,U.jsx)(`button`,{"aria-label":`Close`,className:`human-items-toast-close`,onClick:r,type:`button`,children:(0,U.jsx)(dn,{"aria-hidden":`true`,size:14})})]})}function j1({label:e,reopen:t,sending:n,onPress:r}){let[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),c=(0,V.useId)();return t?.available===!1?(0,U.jsxs)(`fieldset`,{"aria-label":`${e} (unavailable)`,className:`human-items-toast-action human-items-unavailable`,onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),children:[(0,U.jsx)(`button`,{"aria-describedby":c,disabled:!0,type:`button`,children:e}),(0,U.jsx)(`sup`,{className:`human-items-why-anchor`,children:(0,U.jsx)(`button`,{"aria-controls":c,"aria-expanded":i,"aria-label":`Why ${e} is unavailable`,className:`human-items-why`,onClick:()=>a(e=>!e),type:`button`,children:`?`})}),(0,U.jsx)(`span`,{className:`human-items-why-tip`,hidden:!(i||o),id:c,role:`tooltip`,children:t.reason})]}):(0,U.jsx)(`button`,{"aria-busy":n,className:`human-items-toast-action`,onClick:()=>{n||r()},type:`button`,children:n?`${e}…`:e})}var M1=MA.map(e=>({wire:e,label:NA[e]}));function N1(e){return NA[e.priority]}function P1(e){return e.kind===`task`?`Task`:`Question`}var F1={open:`Open`,answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`},I1=[`open`,`answered`,`completed`,`dismissed`],L1=I1.map(e=>({state:e,label:F1[e]}));function R1(e){return F1[e.state]}function z1(e){return e.state===`open`&&e.block.scope!==`nothing`}function B1(e){return e===1?`1 step`:`${e} steps`}function V1(e){let{item:t,blocked:n}=e;if(!z1(t))return[];switch(t.block.scope){case`host`:return[`blocks all work on this host`];case`plan`:return[`blocks all of ${t.block.plan}`];case`work`:return n.plans.map(({plan:e,count:t})=>`blocks ${B1(t)} in ${e}`);default:return[]}}function H1(e){let t=V1(e);return e.item.block.scope===`work`?e.blocked.plans.map(({count:e,preview:n},r)=>{let i=e-n.length,a=n.map(({node:e})=>e).join(`, `);return`${t[r]}: ${a}${i>0?` +${i} more`:``}`}).join(`; `):t.join(`; `)}function U1(e){if(e.block.scope===`host`)return`host`;let{plan:t,run:n,session:r}=e.owner;return t!==null&&n!==null?`plan ${t} / run ${n}`:t===null?n===null?`session ${r}`:`run ${n}`:`plan ${t}`}function W1(e){let t=V1(e);if(e.item.block.scope!==`work`)return t.map(t=>({phrase:t,nodes:e.nodes}));let n=0;return e.blocked.plans.map(({count:r},i)=>{let a=e.nodes.slice(n,n+r);return n+=r,{phrase:t[i]??``,nodes:a}})}function G1(e){let{item:t}=e,{plan:n,run:r}=t.owner,i=V1(e).join(`; `),a={answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`}[t.state];return[{label:`Priority`,value:N1(t)},{label:`Kind`,value:P1(t)},{label:`State`,value:R1(t)},{label:`Source`,value:U1(t)},...n===null?[]:[{label:`Plan`,value:n}],...r===null?[]:[{label:`Run`,value:r}],{label:`Blocks`,value:i===``?`Nothing`:i},{label:`Raised`,value:iI(t.created_at)},...a===void 0?[]:[{label:a,value:iI(t.updated_at)}]]}function K1(e,t){return e.find(e=>e===t)}var q1=[``,`task`,`question`],J1=[``,`yes`,`no`],Y1=[``,...MA],X1=I1,Z1=[``,`session`,`run`,`plan`,`host`],Q1={kind:``,blocking:``,priority:``,state:`open`,source:``,sourceId:``};function $1(e){let t=e.sourceId.trim();return{...e.kind===``?{}:{kind:e.kind},...e.blocking===``?{}:{blocking:e.blocking===`yes`},...e.priority===``?{}:{priority:e.priority},...e.state===`open`?{}:{state:e.state},...e.source===`host`?{host:!0}:{},...e.source!==``&&e.source!==`host`&&t!==``?{[e.source]:t}:{}}}function e0(e){return Number(e.kind!==Q1.kind)+Number(e.blocking!==Q1.blocking)+Number(e.priority!==Q1.priority)+Number(e.state!==Q1.state)+Number(e.source!==Q1.source)}var t0=[`priority`,`kind`,`source`,`blocking`,`none`],n0=`priority`,r0=[{value:`priority`,label:`Priority`},{value:`kind`,label:`Kind`},{value:`source`,label:`Source`},{value:`blocking`,label:`Blocking`},{value:`none`,label:`None`}];function i0(e,t){let{item:n}=e;switch(t){case`priority`:return{key:n.priority,label:N1(n),rank:MA.indexOf(n.priority)};case`kind`:return{key:n.kind,label:P1(n),rank:n.kind===`task`?0:1};case`blocking`:return z1(n)?{key:`blocking`,label:`Blocking`,rank:0}:{key:`not-blocking`,label:`Not blocking`,rank:1};case`source`:{let e=U1(n);return{key:e,label:`Source: ${e}`,rank:0}}}}function a0(e,t){if(t===`none`)return[{key:`all`,items:e}];let n=new Map;return e.forEach((e,r)=>{let{key:i,label:a,rank:o}=i0(e,t),s=n.get(i);s?s.items.push(e):n.set(i,{label:a,rank:o,first:r,items:[e]})}),[...n.entries()].sort(([,e],[,t])=>e.rank-t.rank||e.first-t.first).map(([e,{label:t,items:n}])=>({key:e,label:t,items:n}))}function o0({answers:e,onRoom:t}){let n=(0,V.useRef)(null),{count:r,remaining:i,sending:a,sendError:o,notices:s}=e,c=r>0||o!==void 0||s.length>0;return(0,V.useEffect)(()=>{let e=n.current;if(e===null)return;let r=()=>t(e.getBoundingClientRect().height);r();let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect(),t(0)}},[t,c]),c?(0,U.jsxs)(`section`,{"aria-label":`Drafted answers`,className:`human-items-send`,ref:n,children:[r>0&&(0,U.jsxs)(`div`,{className:`human-items-send-bar`,children:[(0,U.jsx)(`button`,{className:`human-items-send-action`,"data-primary":`true`,disabled:a,onClick:()=>void e.send(),type:`button`,children:a?`Sending…`:`Send ${r} ${r===1?`answer`:`answers`}`}),(0,U.jsx)(`button`,{className:`human-items-send-action`,disabled:a,onClick:e.discard,type:`button`,children:`Discard`}),i>0&&(0,U.jsxs)(`span`,{className:`human-items-send-more`,children:[i,` more after this`]})]}),o!==void 0&&(0,U.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent, and your drafts are kept: `,o]}),s.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Not sent`,className:`human-items-not-sent`,children:s.map(t=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`p`,{children:[(0,U.jsxs)(`strong`,{children:[`Not sent: `,t.title]}),` (`,t.reason,`)`]}),t.choiceTitle!==void 0&&(0,U.jsxs)(`p`,{children:[`Choice: `,t.choiceTitle]}),t.text!==void 0&&(0,U.jsx)(y1,{source:t.text}),(0,U.jsx)(`button`,{className:`human-items-send-action`,onClick:()=>e.clearNotice(t.key),type:`button`,children:`Clear`})]},t.key))})]}):null}var s0=`onepipeline-ui.human-items.group-by`;function c0(){try{return K1(t0,window.localStorage.getItem(`onepipeline-ui.human-items.group-by`)??``)??`priority`}catch{return n0}}function l0(){let[e,t]=(0,V.useState)(c0);return{groupBy:e,setGroupBy:(0,V.useCallback)(e=>{t(e);try{window.localStorage.setItem(s0,e)}catch{}},[])}}var u0=`answered or dismissed elsewhere`,d0=`onepipeline-ui.human-items.draft.`,f0=/^[^\s/?#]+$/u,p0=X({title:J(),choice:J().optional(),choiceTitle:J().optional(),text:J().optional()});function m0(){try{let e={};for(let t=0;t<window.localStorage.length;t+=1){let n=window.localStorage.key(t);if(n===null||!n.startsWith(d0))continue;let r=n.slice(33),i=h0(window.localStorage.getItem(n));i!==void 0&&f0.test(r)&&(e[r]=i)}return e}catch{return}}function h0(e){if(e!==null)try{let t=p0.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function g0(e,t){try{t===void 0?window.localStorage.removeItem(`${d0}${e}`):window.localStorage.setItem(`${d0}${e}`,JSON.stringify(t))}catch{}}function _0(e){return e!==void 0&&e.trim()!==``}function v0(e){return e.choice!==void 0||_0(e.text)}function y0(e,t){return{id:e,...t.choice===void 0?{}:{choice:t.choice},..._0(t.text)?{text:t.text}:{}}}function b0(e){return e.kind===`conflict`?e.reason:`human items are unavailable on this host`}async function x0(e,t){try{return(await e.getHumanItem(t)).item.state!==`open`}catch(e){return e instanceof ZN&&e.status===404||void 0}}function S0(e,t){return e[t]===void 0?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}function C0(e,t,n,r,i,a){let[o,s]=(0,V.useState)(()=>m0()??{}),[c,l]=(0,V.useState)({}),[u,d]=(0,V.useState)([]),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(),g=(0,V.useRef)(!1),_=(0,V.useRef)(0),v=(0,V.useRef)(o);v.current=o;let y=(0,V.useRef)(new Set),b=(0,V.useRef)(new Set),x=(0,V.useCallback)((e,t)=>{g0(e,t),s(n=>t===void 0?S0(n,e):{...n,[e]:t}),l(t=>S0(t,e)),h(void 0)},[]),S=(0,V.useCallback)((e,t)=>{let n=v.current[e];if(n===void 0)return;g0(e,void 0),s(t=>S0(t,e)),l(t=>S0(t,e)),_.current+=1;let r=_.current;d(e=>[...e,{...n,key:r,reason:t}])},[]),C=(0,V.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{text:i}=v.current[n]??{},a={title:r,...v.current[n]?.choice===t.id?{}:{choice:t.id,choiceTitle:t.title},...i===void 0?{}:{text:i}};x(n,v0(a)?a:void 0)},[x]),w=(0,V.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{choice:i,choiceTitle:a}=v.current[n]??{},o={title:r,...i===void 0?{}:{choice:i},...a===void 0?{}:{choiceTitle:a},...t===``?{}:{text:t}};x(n,o.choice===void 0&&t===``?void 0:o)},[x]),T=Object.entries(o).filter(([,e])=>v0(e)),E=T.slice(0,50),D=(0,V.useCallback)(async(t,n)=>{await x0(e,t)===!0?S(t,n):l(e=>({...e,[t]:n}))},[e,S]),O=(0,V.useCallback)(async()=>{if(g.current)return;let t=m0(),n=E.filter(([e])=>t!==void 0&&t[e]===void 0);for(let[e]of n)s(t=>S0(t,e));let r=E.flatMap(([e,t])=>n.some(([t])=>t===e)?[]:[y0(e,t)]);if(r.length!==0){g.current=!0,p(!0),h(void 0),a(r.map(({id:e})=>e));try{let t=await e.answerHumanItems(r);for(let{item:e}of t.answered)g0(e.item.id,void 0),s(t=>S0(t,e.item.id)),l(t=>S0(t,e.item.id));i(t.answered),await Promise.all(t.refused.map(({id:e,refusal:t})=>D(e,b0(t))))}catch(e){h(e instanceof Error?e.message:String(e))}finally{g.current=!1,p(!1),a([])}}},[E,e,i,a,D]),k=(0,V.useCallback)(()=>{for(let e of Object.keys(v.current))g0(e,void 0);s({}),l({}),h(void 0)},[]),A=(0,V.useCallback)(e=>{d(t=>t.filter(t=>t.key!==e))},[]);return(0,V.useEffect)(()=>{y.current.clear()},[n]),(0,V.useEffect)(()=>{if(!(t===void 0||f))for(let n of Object.keys(o)){if(r(n))continue;let i=t.find(({item:e})=>e.id===n);if(i!==void 0){y.current.delete(n),i.item.state!==`open`&&S(n,u0);continue}y.current.has(n)||b.current.has(n)||(b.current.add(n),x0(e,n).then(e=>{b.current.delete(n),!g.current&&(e===!0?S(n,u0):e===!1&&y.current.add(n))}))}},[e,o,t,S,f,r]),{drafts:o,refusals:c,notices:u,sending:f,sendError:m,count:E.length,remaining:T.length-E.length,pressChoice:C,setText:w,retire:S,send:O,discard:k,clearNotice:A}}function w0(e){let[t,n]=(0,V.useState)(Q1),[r,i]=(0,V.useState)(),a=(0,V.useMemo)(()=>{if(!e)return;let n=$1(t);return{type:`human-items`,...Object.keys(n).length===0?{}:{filter:n},...r===void 0?{}:{item:r}}},[e,JSON.stringify($1(t)),r]);return(0,V.useEffect)(()=>{e||(n(Q1),i(void 0))},[e]),{choice:t,setChoice:n,selectedId:r,setSelectedId:i,view:a}}function T0(e,t,n,r,i=``){let[a,o]=(0,V.useState)({}),[s,c]=(0,V.useState)(),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)({}),[p,m]=(0,V.useState)({}),[h,g]=(0,V.useState)(),_=(0,V.useRef)(new Set),v=(0,V.useRef)(new Map),y=(0,V.useRef)(0),b=(0,V.useRef)(void 0);b.current=s;let x=t.items,S=(0,V.useRef)(i);S.current=i,(0,V.useEffect)(()=>{m(e=>Object.keys(e).length===0?e:{})},[i]);let C=(0,V.useMemo)(()=>{if(x===void 0)return;let e=x.flatMap(e=>{if(d[e.item.id]!==void 0)return[];let t=p[e.item.id]?.view;return t===void 0||!D0(t,e)?[e]:t.item.state===r?[t]:[]}),t=t=>e.some(({item:e})=>e.id===t);for(let{view:n,at:a,filter:o}of Object.values(p))o===i&&n.item.state===r&&!t(n.item.id)&&e.splice(Math.min(a,e.length),0,n);for(let{view:n,at:r}of l)t(n.item.id)||e.splice(Math.min(r,e.length),0,n);return e},[x,l,p,d,r,i]);(0,V.useEffect)(()=>{x!==void 0&&m(e=>{let t=Object.entries(e).filter(([e,{view:t}])=>{let n=x.find(({item:t})=>t.id===e);return n===void 0?t.item.state===r:D0(t,n)});return t.length===Object.keys(e).length?e:Object.fromEntries(t)})},[x,r]);let w=t.error===void 0&&t.item===n?t.detail:void 0,T=n===void 0?void 0:p[n]?.view,E=w&&T!==void 0&&D0(T,{item:w.item})?{...w,item:T.item,reopen:T.reopen}:w,D=(0,V.useRef)(x);D.current=x;let O=C0(e,x,i,(0,V.useCallback)(e=>_.current.has(e),[]),(0,V.useCallback)(e=>{let t=S.current;m(n=>{let r={...n};for(let{item:n}of e){let e=Math.max(0,D.current?.findIndex(({item:e})=>e.id===n.item.id)??0);r[n.item.id]={view:n,at:e,filter:t}}return r});let n=new Set(e.map(({item:e})=>e.item.id));u(e=>e.filter(({view:e})=>!n.has(e.item.id)))},[]),(0,V.useCallback)(e=>{let t=D.current??[];u(e.flatMap(e=>{let n=t.findIndex(({item:t})=>t.id===e),r=t[n];return r===void 0?[]:[{view:r,at:n}]}))},[])),{retire:k}=O,A=(0,V.useCallback)((e,t)=>c(n=>n?.key===e?t(n):n),[]),j=(0,V.useCallback)((t,n)=>{let{id:r,title:i}=t.item;if(_.current.has(r))return;_.current.add(r);let a=++y.current,s=S.current,l=Math.max(0,D.current?.findIndex(({item:e})=>e.id===r)??0);o(e=>({...e,[r]:{}})),f(e=>({...e,[r]:{view:t,at:l}})),c({key:a,id:r,title:i,action:n.action,phase:`sending`});let u=n.action===`complete`?e.completeHumanItem(r):e.dismissHumanItem(r,n.reason);v.current.set(a,u),u.then(e=>{m(t=>({...t,[r]:{view:e.item,at:l,filter:s}})),o(e=>({...e,[r]:{}})),k(r,`dismissed here`),A(a,t=>({...t,phase:`done`,reopen:e.item.reopen}))},e=>{let t=O0(e);o(e=>({...e,[r]:{error:t}})),A(a,e=>({...e,phase:`failed`,error:t})),g({id:r})}).finally(()=>{_.current.delete(r),f(E0(r))})},[e,A,k]),M=(0,V.useCallback)((e,t)=>{let n=b.current;if(n===void 0)return;let r=v.current.get(n.key);if(r===void 0||n.followUp?.phase===`sending`)return;let{key:i,id:a}=n,o=S.current;A(i,t=>({...t,followUp:{kind:e,phase:`sending`}})),r.then(n=>{if(e===`undo`&&!n.item.reopen.available){A(i,e=>({...e,followUp:void 0}));return}t(a).then(t=>{m(e=>({...e,[a]:{view:t.item,at:e[a]?.at??0,filter:o}})),A(i,n=>({...n,reopen:t.item.reopen,followUp:{kind:e,phase:`done`}}))},t=>A(i,n=>({...n,followUp:{kind:e,phase:`failed`,error:O0(t)}})))},()=>A(i,e=>({...e,followUp:void 0})))},[A]),N=(0,V.useCallback)(()=>M(`undo`,t=>e.reopenHumanItem(t)),[e,M]),P=(0,V.useCallback)(t=>M(`note`,n=>e.noteHumanItem(n,t)),[e,M]),ee=(0,V.useCallback)(()=>c(void 0),[]);return{items:C,listError:n===void 0||C===void 0?t.error:void 0,detail:E===null?void 0:E,gone:n!==void 0&&E===null,detailError:n===void 0?void 0:t.error,writes:a,answers:O,write:j,toast:s,undo:N,note:P,closeToast:ee,returned:h}}function E0(e){return t=>t[e]===void 0?t:Object.fromEntries(Object.entries(t).filter(([t])=>t!==e))}function D0(e,t){return Date.parse(e.item.updated_at)>Date.parse(t.item.updated_at)}function O0(e){return e instanceof Error?e.message:String(e)}var k0=`data-card-action`,A0=4;function j0({client:e,live:t,choice:n,setChoice:r,selectedId:i,setSelectedId:a}){let o=T0(e,t,i,n.state,JSON.stringify(n)),{groupBy:s,setGroupBy:c}=l0(),[l,u]=(0,V.useState)(0),[d,f]=(0,V.useState)(0),p=(0,V.useRef)(null),m=o.items?.find(({item:e})=>e.id===i)??o.detail,h=(0,V.useRef)(void 0);m===void 0?h.current?.item.id!==i&&(h.current=void 0):h.current=m;let g=(e,t)=>{e.item.id===i&&a(void 0),o.write(e,t)},_=o.returned;(0,V.useEffect)(()=>{_!==void 0&&p.current?.querySelector(`[data-item-id="${CSS.escape(_.id)}"]`)?.scrollIntoView({block:`nearest`})},[_]);let v=a0(o.items??[],s);return(0,U.jsxs)(`section`,{"aria-label":`Action items`,className:`human-items-page`,"data-detail-open":i!==void 0,style:M0(l,d),children:[(0,U.jsx)(F0,{choice:n,groupBy:s,onChange:r,onGroupBy:c}),(0,U.jsxs)(`div`,{className:`human-items-body`,children:[(0,U.jsxs)(`section`,{"aria-label":`Action item list`,className:`human-items-list`,children:[o.listError&&(0,U.jsx)(`p`,{role:`alert`,children:o.listError}),o.items===void 0&&!o.listError&&(0,U.jsx)(`p`,{role:`status`,children:`Reading action items…`}),o.items?.length===0&&(0,U.jsx)(`p`,{role:`status`,children:`No action items match these filters.`}),(0,U.jsx)(`div`,{className:`human-items-groups`,onKeyDown:e=>P0(e,p.current),ref:p,children:v.map(e=>(0,U.jsx)(N0,{answering:o.answers,group:e,groupBy:s,onSelect:a,onWrite:g,selectedId:i,writes:o.writes},e.key))}),(o.items?.length??0)>0&&(0,U.jsx)(`button`,{className:`card-actions-entry`,onFocus:()=>p.current?.querySelector(`[${k0}]`)?.focus(),type:`button`,children:`Card actions: use the arrow keys`})]}),i!==void 0&&(0,U.jsx)(G0,{answering:o.answers,error:o.detailError,detail:o.detail,gone:o.gone,lastShown:h.current,onClose:()=>a(void 0),onWrite:g,state:o.writes[i],view:m})]}),(0,U.jsx)(o0,{answers:o.answers,onRoom:f}),o.toast&&(0,U.jsx)(A1,{onClose:o.closeToast,onNote:o.note,onRoom:u,onUndo:o.undo,toast:o.toast})]})}function M0(e,t){return{"--toast-room":`${e}px`,"--send-room":`${t}px`}}function N0({group:e,groupBy:t,selectedId:n,writes:r,answering:i,onSelect:a,onWrite:o}){let s=(0,V.useId)(),c=e.items.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(R0,{answering:i,groupBy:t,onSelect:()=>a(e.item.id),onWrite:o,selected:e.item.id===n,state:r[e.item.id],view:e})},e.item.id));return e.label===void 0?(0,U.jsx)(`ul`,{"aria-label":`Action items`,children:c}):(0,U.jsxs)(`section`,{"aria-labelledby":s,className:`human-items-group`,children:[(0,U.jsxs)(`h2`,{className:`human-items-group-heading`,id:s,children:[e.label,` `,(0,U.jsxs)(`span`,{className:`human-items-group-count`,children:[`(`,e.items.length,`)`]})]}),(0,U.jsx)(`ul`,{"aria-labelledby":s,children:c})]})}function P0(e,t){let n=e.target;if(t===null||!(n instanceof HTMLElement)||!n.hasAttribute(k0))return;let r=[...t.querySelectorAll(`[${k0}]`)],i=r.indexOf(n),a=e.key===`ArrowRight`||e.key===`ArrowDown`?r[Math.min(i+1,r.length-1)]:e.key===`ArrowLeft`||e.key===`ArrowUp`?r[Math.max(i-1,0)]:e.key===`Home`?r[0]:e.key===`End`?r.at(-1):void 0;a!==void 0&&(e.preventDefault(),a.focus())}function F0({choice:e,groupBy:t,onChange:n,onGroupBy:r}){let i=(0,V.useId)(),[a,o]=(0,V.useState)(!1),s=(t,r)=>n({...e,[t]:r}),c=e.source!==``&&e.source!==`host`,l=e0(e)+Number(t!==n0);return(0,U.jsxs)(`div`,{className:`human-items-controls`,"data-open":a,children:[(0,U.jsxs)(`button`,{"aria-controls":`${i}-filters`,"aria-expanded":a,"aria-label":l>0?`Filters, ${l} changed`:`Filters`,className:`human-items-filters-toggle`,onClick:()=>o(e=>!e),type:`button`,children:[(0,U.jsx)(rn,{"aria-hidden":`true`,size:14}),`Filters`,l>0&&(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`human-items-filters-count`,children:l})]}),(0,U.jsxs)(`fieldset`,{className:`human-items-filters`,id:`${i}-filters`,children:[(0,U.jsx)(`legend`,{className:`sr-only`,children:`Filter action items`}),(0,U.jsx)(`label`,{htmlFor:`${i}-group`,children:`Group by`}),(0,U.jsx)(`select`,{id:`${i}-group`,onChange:e=>r(K1(t0,e.target.value)??`priority`),value:t,children:r0.map(({value:e,label:t})=>(0,U.jsx)(`option`,{value:e,children:t},e))}),(0,U.jsx)(`label`,{htmlFor:`${i}-kind`,children:`Kind`}),(0,U.jsxs)(`select`,{id:`${i}-kind`,onChange:e=>s(`kind`,K1(q1,e.target.value)??``),value:e.kind,children:[(0,U.jsx)(`option`,{value:``,children:`Any kind`}),(0,U.jsx)(`option`,{value:`task`,children:`Task`}),(0,U.jsx)(`option`,{value:`question`,children:`Question`})]}),(0,U.jsx)(`label`,{htmlFor:`${i}-blocking`,children:`Blocking`}),(0,U.jsxs)(`select`,{id:`${i}-blocking`,onChange:e=>s(`blocking`,K1(J1,e.target.value)??``),value:e.blocking,children:[(0,U.jsx)(`option`,{value:``,children:`Any`}),(0,U.jsx)(`option`,{value:`yes`,children:`Yes`}),(0,U.jsx)(`option`,{value:`no`,children:`No`})]}),(0,U.jsx)(`label`,{htmlFor:`${i}-priority`,children:`Priority`}),(0,U.jsxs)(`select`,{id:`${i}-priority`,onChange:e=>s(`priority`,K1(Y1,e.target.value)??``),value:e.priority,children:[(0,U.jsx)(`option`,{value:``,children:`Any priority`}),M1.map(({wire:e,label:t})=>(0,U.jsx)(`option`,{value:e,children:t},e))]}),(0,U.jsx)(`label`,{htmlFor:`${i}-state`,children:`State`}),(0,U.jsx)(`select`,{id:`${i}-state`,onChange:e=>s(`state`,K1(X1,e.target.value)??`open`),value:e.state,children:L1.map(({state:e,label:t})=>(0,U.jsx)(`option`,{value:e,children:t},e))}),(0,U.jsx)(`label`,{htmlFor:`${i}-source`,children:`Source`}),(0,U.jsxs)(`select`,{id:`${i}-source`,onChange:e=>s(`source`,K1(Z1,e.target.value)??``),value:e.source,children:[(0,U.jsx)(`option`,{value:``,children:`Any source`}),(0,U.jsx)(`option`,{value:`session`,children:`Session`}),(0,U.jsx)(`option`,{value:`run`,children:`Run`}),(0,U.jsx)(`option`,{value:`plan`,children:`Plan`}),(0,U.jsx)(`option`,{value:`host`,children:`Host`})]}),c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`label`,{htmlFor:`${i}-source-id`,children:`Source identifier`}),(0,U.jsx)(`input`,{id:`${i}-source-id`,onChange:e=>s(`sourceId`,e.target.value),placeholder:`${e.source} id`,type:`search`,value:e.sourceId})]})]})]})}function I0(e){return e.target instanceof Element&&e.target.closest(`a, button, textarea, input, select`)===null}function L0({view:e,groupBy:t}){let{item:n}=e;return(0,U.jsxs)(U.Fragment,{children:[t!==`priority`&&(0,U.jsx)(`span`,{className:`human-item-priority`,"data-priority":n.priority,children:N1(n)}),t!==`kind`&&(0,U.jsx)(`span`,{className:`human-item-kind`,children:P1(n)}),t!==`blocking`&&z1(n)&&(0,U.jsx)(`span`,{className:`human-item-blocking`,children:`Blocking`})]})}function R0({view:e,groupBy:t,selected:n,state:r,answering:i,onSelect:a,onWrite:o}){let{item:s}=e,c=s.state===`open`,l=H1(e),u=[...c?[]:[R1(s)],...l?[l]:[],...t===`source`?[]:[`Source: ${U1(s)}`]],d=(s.choices?.length??0)>0;return(0,U.jsxs)(b1,{actions:(0,U.jsx)(z0,{item:e,onSelect:a,onWrite:o}),badges:(0,U.jsx)(L0,{groupBy:t,view:e}),body:s.body,className:`human-item-card`,clamp:A0,"data-blocking":z1(s),"data-item-id":s.id,"data-selected":n,meta:u.length===0?void 0:u.map((e,t)=>(0,U.jsxs)(V.Fragment,{children:[t>0&&` · `,(0,U.jsx)(`span`,{children:e})]},e)),onClick:e=>{I0(e)&&a()},title:s.title,children:[s.kind===`question`&&c&&d&&(0,U.jsxs)(`fieldset`,{className:`human-item-choices`,children:[(0,U.jsxs)(`legend`,{className:`sr-only`,children:[`Choices: `,s.title]}),s.choices?.map(t=>(0,U.jsx)(B0,{answering:i,choice:t,view:e},t.id))]}),s.kind===`question`&&c&&!d&&(0,U.jsx)(V0,{answering:i,label:`Answer: ${s.title}`,view:e}),(0,U.jsx)(H0,{view:e}),(0,U.jsx)(U0,{reason:i.refusals[s.id]}),(0,U.jsx)(W0,{state:r})]})}function z0({item:e,onSelect:t,onWrite:n}){let{item:r}=e,i=r.state===`open`;return(0,U.jsxs)(U.Fragment,{children:[r.tracker&&(0,U.jsx)(C1,{className:`human-item-tracker`,"data-card-action":``,label:r.tracker.task,title:r.tracker.task,onClick:e=>e.stopPropagation(),tabIndex:-1,url:r.tracker.url}),(0,U.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:t,type:`button`,"aria-label":`Details: ${r.title}`,children:`Details`}),i&&r.kind===`task`&&(0,U.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:()=>n(e,{action:`complete`}),type:`button`,"aria-label":`Complete: ${r.title}`,children:`Complete`}),i&&(0,U.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:()=>n(e,{action:`dismiss`}),type:`button`,"aria-label":`Dismiss: ${r.title}`,children:`Dismiss`})]})}function B0({view:e,choice:t,answering:n}){return(0,U.jsx)(`button`,{"aria-pressed":n.drafts[e.item.id]?.choice===t.id,className:`human-item-choice`,disabled:n.sending,onClick:()=>n.pressChoice(e,t),type:`button`,children:t.title})}function V0({view:e,label:t,answering:n}){return(0,U.jsx)(`textarea`,{"aria-busy":n.sending,"aria-label":t,className:`human-item-answer`,onChange:t=>n.setText(e,t.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.preventDefault()},placeholder:`Write an answer`,readOnly:n.sending,rows:1,value:n.drafts[e.item.id]?.text??``})}function H0({view:e}){let{item:t}=e;if(t.state!==`answered`||t.resolution===null)return null;let{choice:n,text:r}=t.resolution,i=t.choices?.find(({id:e})=>e===n);return(0,U.jsxs)(`section`,{"aria-label":`Answer`,className:`human-item-answered`,children:[i&&(0,U.jsx)(`p`,{className:`human-item-answered-choice`,children:i.title}),r!==null&&(0,U.jsx)(y1,{source:r})]})}function U0({reason:e}){return e===void 0?null:(0,U.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent: `,e]})}function W0({state:e}){return e?.error?(0,U.jsx)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:e.error}):null}function G0({view:e,detail:t,gone:n,lastShown:r,error:i,state:a,answering:o,onWrite:s,onClose:c}){if(n&&e===void 0)return(0,U.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,U.jsxs)(`header`,{className:`human-item-detail-head`,children:[r&&(0,U.jsx)(`h2`,{children:r.item.title}),(0,U.jsx)(Fa,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,U.jsx)(dn,{size:14})})]}),(0,U.jsx)(`p`,{role:`status`,children:`Resolved: this item needs nothing more from you.`})]});let l=t??e;if(l===void 0)return(0,U.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,U.jsx)(Fa,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,U.jsx)(dn,{size:14})}),i?(0,U.jsx)(`p`,{role:`alert`,children:i}):(0,U.jsx)(`p`,{role:`status`,children:`Reading…`})]});let{item:u}=l,d=u.state===`open`,f=u.choices??[],p=u.kind===`question`&&d;return(0,U.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,tabIndex:0,children:[(0,U.jsxs)(`header`,{className:`human-item-detail-head`,children:[(0,U.jsx)(`h2`,{children:u.title}),(0,U.jsx)(Fa,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,U.jsx)(dn,{size:14})})]}),i&&(0,U.jsx)(`p`,{role:`alert`,children:i}),(0,U.jsx)(`section`,{"aria-label":`Full body`,className:`human-item-detail-body`,children:(0,U.jsx)(y1,{source:u.body})}),p&&f.length>0&&(0,U.jsxs)(`fieldset`,{className:`human-item-choice-list`,children:[(0,U.jsx)(`legend`,{children:`Choices`}),f.map(e=>(0,U.jsxs)(`div`,{className:`human-item-choice-entry`,children:[(0,U.jsx)(B0,{answering:o,choice:e,view:l}),(0,U.jsx)(`div`,{className:`human-item-choice-description`,children:(0,U.jsx)(y1,{source:e.description})})]},e.id))]}),p&&(0,U.jsx)(V0,{answering:o,label:`Answer in detail: ${u.title}`,view:l}),(0,U.jsx)(H0,{view:l}),(0,U.jsx)(U0,{reason:o.refusals[u.id]}),(0,U.jsxs)(`div`,{className:`human-item-detail-actions`,children:[d&&u.kind===`task`&&(0,U.jsx)(Fa,{onClick:()=>s(l,{action:`complete`}),size:`sm`,type:`button`,children:`Complete`}),d&&(0,U.jsx)(Fa,{onClick:()=>s(l,{action:`dismiss`}),size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`}),(0,U.jsx)(W0,{state:a})]}),(0,U.jsxs)(`dl`,{className:`human-item-metadata`,children:[G1(l).map(({label:e,value:t})=>(0,U.jsxs)(V.Fragment,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e)),t&&t.nodes.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{children:`Blocked steps`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(`section`,{"aria-label":`Blocked steps`,className:`human-item-steps`,children:W1(t).map(({phrase:e,nodes:t})=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:e}),(0,U.jsx)(`ul`,{children:t.map(e=>(0,U.jsxs)(`li`,{children:[e.run,` / `,e.node,`: `,e.title]},`${e.run}/${e.node}`))})]},e))})})]}),u.tracker&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{children:`Tracker`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(C1,{className:`human-item-tracker-full`,label:u.tracker.task,url:u.tracker.url})})]})]})]})}function K0({className:e,state:t}){let n=q0(t);return(0,U.jsxs)(Na,{className:B(`gap-1.5 tracking-[.03em] uppercase`,n&&Y0[n],e),variant:`outline`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:B(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function q0(e){return t2[e]}var J0=e=>{let t=q0(e);return B(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:X0[t])},Y0={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},X0={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},Z0=`success`,Q0=`destructive`,$0=`warning`,e2={blocked:$0,cancelled:Q0,"complete-but-draft":$0,"complete-but-held":$0,done:Z0,failed:Q0,"not-completed":Q0,parked:void 0,pending:void 0,ready:void 0,running:`info`,skipped:$0,unknown:void 0,waiting:void 0},t2={...e2,complete:e2.done,settled:e2.done,active:e2.running},n2=`/human-items`;function r2(e){return e===`/human-items`||e===`/human-items/`}function i2(e){return r2(e)?`/`:e}function a2(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}var o2=()=>window.location.pathname;function s2(){let e=(0,V.useSyncExternalStore)(a2,o2,o2),t=(0,V.useCallback)(()=>{let e=new URLSearchParams;for(let t of new URLSearchParams(window.location.search).getAll(`hide-kind`))e.append(`hide-kind`,t);let t=e.size>0?`?${e}`:``;window.history.pushState(null,``,`${n2}${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{active:r2(e),open:t}}var c2={graph:`graph`,overall:`overall`,channel:`channel`};function l2(e){return e!==null&&Object.hasOwn(c2,e)}var u2={projects:`projects`,runs:`runs`};function d2(e){return e!==null&&Object.hasOwn(u2,e)}var f2={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:fj.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:fj.detailed}};function p2(e){return e!==null&&Object.hasOwn(f2,e)}var m2={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,remote:`Remote`};function h2(e){return e!==null&&Object.hasOwn(m2,e)}function g2(e){let t=[...e].some(e=>e.charCodeAt(0)<32);return e.length>0&&e.length<=512&&!t&&!/[/?#]/u.test(e)}function _2(e,t){let n=e.get(t);return n!==null&&g2(n)?n:void 0}function v2(){let e=(0,V.useSyncExternalStore)(y2,b2,b2),t=new URLSearchParams(e),n=t.get(`list`),r=d2(n)?n:`projects`,i=t.get(`project`),a=i!==null&&(i===`none`||NM(i))?i:void 0,o=_2(t,`run`),s=_2(t,`node`),c=_2(t,`event`),l=t.get(`view`),u=t.get(`tab`),d=t.get(`detail`),f=p2(d)?d:`activity`,p=u===`pr`||u===`checks`?`remote`:h2(u)?u:`timeline`,m=l2(l)?l:s===void 0?`overall`:`graph`,h=(0,V.useCallback)((e,t=!1)=>{let n=new URLSearchParams(window.location.search);e(n);let r=t?window.location.pathname:i2(window.location.pathname);window.history.pushState(null,``,`${r}?${n}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{list:r,host:t.get(`page`)===`host`,hiddenKinds:t.getAll(`hide-kind`),selectHost:()=>h(e=>{e.set(`page`,`host`)}),selectKinds:e=>h(t=>{t.delete(`hide-kind`);for(let n of e)t.append(`hide-kind`,n)},!0),projectKey:a,runId:o,nodeId:s,itemId:c,view:m,detail:f,nodeTab:p,selectList:e=>h(t=>{e===`projects`?t.delete(`list`):t.set(`list`,e),t.delete(`project`)}),selectProject:e=>h(t=>{e===void 0?t.delete(`project`):t.set(`project`,e),t.delete(`list`),t.delete(`run`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectRun:e=>h(t=>{t.set(`run`,e),t.delete(`page`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>h(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>h(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>h(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>h(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>h(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)}),selectView:e=>h(t=>{t.set(`view`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)})}}function y2(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function b2(){return window.location.search}function x2(e){return[...e].sort((e,t)=>{let n=e.started_at,r=t.started_at;return n!==void 0&&r===void 0?-1:n===void 0&&r!==void 0?1:(r===void 0?0:Date.parse(r))-(n===void 0?0:Date.parse(n))||Date.parse(t.updated_at)-Date.parse(e.updated_at)||e.id.localeCompare(t.id)})}function S2(e){let t=new Map;for(let n of e){let e=n.group?.project??`none`,r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t].map(([e,t])=>{let n=x2(t),r=t[0]?.group?.project??null,i=t.map(e=>e.updated_at).reduce((e,t)=>Date.parse(t)>Date.parse(e)?t:e);return{key:e,project:r,label:r===null?`Other runs`:n.find(e=>e.group?.name)?.group?.name??r,rows:n,updatedAt:i}}).sort((e,t)=>Number(e.project===null)-Number(t.project===null)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt)||e.key.localeCompare(t.key))}function C2(e){let{done:t,failed:n,running:r}=e.nodes;return jX({done:t,failed:n,running:r})}function w2(e,t){let n=new Map(e.map(e=>[e.id,JSON.stringify(e)])),r=t.filter(e=>n.get(e.id)!==JSON.stringify(e)).length,i=new Set(t.map(e=>e.id));return r+e.filter(e=>!i.has(e.id)).length}function T2(e,t,n,r){let[i,a]=(0,V.useState)(new Set),o=(0,V.useCallback)(e=>{a(t=>t.has(e)?t:new Set(t).add(e))},[]),s=(0,V.useCallback)(e=>{a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),c=(0,V.useMemo)(()=>S2(e??[]),[e]),l=c.find(e=>e.rows.some(e=>e.id===n))?.key,[u,d]=(0,V.useState)();return l!==u&&(d(l),l!==void 0&&o(l)),(0,V.useMemo)(()=>({kinds:[...new Set(e?.flatMap(e=>e.kind?[e.kind]:[])??[])].sort(),groups:c.map(e=>{let n=e.rows.filter(e=>!e.kind||!t.includes(e.kind)),a=n[0];return{key:e.key,label:e.label,runs:n,expanded:i.has(e.key),toggle:()=>s(e.key),open:()=>{o(e.key),a&&r(a.id)}}})}),[e,c,t,i,o,s,r])}var E2=240,D2=`data-row-key`;function O2(e,t){let n=(0,V.useRef)(new Map);(0,V.useLayoutEffect)(()=>{let t=e.current;if(t===null)return;let r=t.getBoundingClientRect().top,i=[...t.querySelectorAll(`[${D2}]`)],a=new Map(i.map(e=>[e.getAttribute(`data-row-key`)??``,e.getBoundingClientRect().top-r])),o=[...n.current.keys()].filter(e=>a.has(e)),s=[...a.keys()].filter(e=>n.current.has(e));if(o.join(`
|
|
111
111
|
`)!==s.join(`
|
|
112
|
-
`)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of i){let t=n.current.get(e.getAttribute(`data-row-key`)??``),r=a.get(e.getAttribute(`data-row-key`)??``);t===void 0||r===void 0||t===r||e.animate([{transform:`translateY(${t-r}px)`},{transform:`translateY(0)`}],{duration:E2,easing:`ease-out`})}n.current=a},[e,t])}function k2({rows:e,selectedRunId:t,onSelect:n,onOpenProject:r,onHost:i,hostCurrent:a=!1,onActionItems:o,actionItemsCurrent:s=!1,hiddenKinds:c,onKindsChange:l,updates:u,drawerOpen:d=!1,drawerRef:f}){let{kinds:p,groups:m}=T2(e,c,t,r??n),h=(0,V.useRef)(null);return O2(h,m),(0,U.jsx)(`nav`,{"aria-label":`Projects`,className:`run-nav`,"data-open":d,id:`run-navigation`,ref:f,children:(0,U.jsx)(cf,{className:`h-full`,children:(0,U.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,U.jsxs)(`div`,{className:`brand`,children:[(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,U.jsx)(_t,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,U.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,U.jsx)(xf,{className:`my-[22px]`}),(0,U.jsxs)(`div`,{className:`nav-pages`,children:[(0,U.jsx)(Fa,{"aria-current":a?`page`:void 0,onClick:i,variant:`ghost`,children:`Host`}),o&&(0,U.jsx)(Fa,{"aria-current":s?`page`:void 0,onClick:o,variant:`ghost`,children:`Action items`})]}),p.length>0&&(0,U.jsxs)(`details`,{className:`kind-filter`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsxs)(`span`,{children:[`Run kinds:`,` `,p.filter(e=>!c.includes(e)).length,` of`,` `,p.length]}),(0,U.jsx)(Ct,{"aria-hidden":`true`,size:14})]}),(0,U.jsxs)(`fieldset`,{children:[(0,U.jsx)(`legend`,{className:`sr-only`,children:`Run kinds`}),p.map(e=>(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:!c.includes(e),onChange:t=>l(t.target.checked?c.filter(t=>t!==e):[...c,e])}),e]},e))]})]}),u,e===void 0?(0,U.jsx)(`p`,{role:`status`,children:`Loading projects…`}):(0,U.jsx)(`div`,{className:`nav-rows`,ref:h,children:m.map(e=>(0,U.jsxs)(`fieldset`,{"aria-label":`Project ${e.label}`,className:`project-group`,children:[(0,U.jsxs)(`div`,{className:`project-row`,[D2]:`project:${e.key}`,children:[(0,U.jsx)(`button`,{"aria-expanded":e.expanded,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.label}`,className:`project-toggle`,onClick:e.toggle,type:`button`,children:(0,U.jsx)(wt,{"aria-hidden":`true`,"data-open":e.expanded,size:12})}),(0,U.jsxs)(`button`,{className:`project-open`,onClick:e.open,type:`button`,children:[(0,U.jsx)(`span`,{className:`project-name`,children:e.label}),(0,U.jsxs)(`span`,{className:`project-count`,children:[e.runs.length,(0,U.jsx)(`span`,{className:`sr-only`,children:` shown runs`})]})]})]}),e.expanded&&e.runs.length===0&&(0,U.jsx)(`p`,{className:`run-list-status`,role:`status`,children:`No runs of the shown kinds.`}),e.expanded&&e.runs.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Runs of ${e.label}`,className:`run-list`,children:e.runs.map(e=>{let r=t===e.id,i=[e.state,C2(e)].filter(Boolean).join(` · `);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{"aria-current":r?`page`:void 0,className:`run-link`,"data-active":r,onClick:()=>n(e.id),title:i,type:`button`,"data-row-key":`run:${e.id}`,children:[(0,U.jsxs)(pm,{children:[(0,U.jsx)(mm,{asChild:!0,children:(0,U.jsx)(`span`,{role:`img`,"aria-label":e.state,className:B(`run-dot`,J0(e.state))})}),(0,U.jsx)(hm,{children:e.state})]}),(0,U.jsx)(`span`,{className:`run-link-name`,children:e.name}),e.kind&&(0,U.jsx)(`span`,{"aria-label":e.kind,className:`run-link-tag`,role:`note`,children:e.kind}),r&&(0,U.jsx)(`span`,{className:`run-link-counts`,children:i})]})},e.id)})})]},e.key))})]})})})}function A2(){let[e,t]=(0,V.useState)(!1),n=(0,V.useRef)(null),r=(0,V.useRef)(null),i=(0,V.useRef)(!1),a=(0,V.useCallback)(()=>t(!1),[]),o=(0,V.useCallback)(()=>t(e=>!e),[]);return(0,V.useEffect)(()=>{if(!e)return;let r=e=>{e.key===`Escape`&&t(!1)},i=()=>{n.current?.offsetParent===null&&t(!1)};return document.addEventListener(`keydown`,r),window.addEventListener(`resize`,i),()=>{document.removeEventListener(`keydown`,r),window.removeEventListener(`resize`,i)}},[e]),(0,V.useEffect)(()=>{e?r.current?.querySelector(`button`)?.focus():i.current&&n.current?.focus(),i.current=e},[e]),{open:e,close:a,toggle:o,menuButton:n,drawer:r}}function j2(e,t){let[n,r]=(0,V.useState)(0),i=(0,V.useRef)(void 0),a=(0,V.useRef)(t);a.current=t;let o=e===`live`,s=(0,V.useRef)(o);s.current=o;let c=(0,V.useCallback)(e=>{i.current=void 0,r(0),a.current(e)},[]),l=(0,V.useCallback)(()=>{i.current!==void 0&&c(i.current.value)},[c]),u=(0,V.useCallback)((e,t=1)=>{s.current?c(e):(i.current={value:e},r(e=>e+t))},[c]),d=(0,V.useCallback)(()=>{i.current=void 0,r(0)},[]);return(0,V.useEffect)(()=>{o&&l()},[o,l]),(0,V.useEffect)(()=>{if(typeof e!=`number`)return;let t=setInterval(l,e*1e3);return()=>clearInterval(t)},[e,l]),{waiting:n,show:c,take:l,offer:u,drop:d}}function M2(e,t){let[n,r]=(0,V.useState)(),[i,a]=(0,V.useState)({}),o=(0,V.useRef)([]),[s,c]=(0,V.useState)(),[l,u]=(0,V.useState)(),[d,f]=(0,V.useState)(),[p,m]=(0,V.useState)(),[h,g]=(0,V.useState)(),[_,v]=(0,V.useState)(),[y,b]=(0,V.useState)(0),x=t.runId,S=s===void 0||x!==void 0&&s.some(e=>e.id===x)?x:x!==void 0||t.selectFirst?x2(s)[0]?.id:void 0,C=(0,V.useMemo)(()=>t.humanItems??N2(t.host?void 0:S,t.view,t.nodeId,t.filter),[t.humanItems,t.host,S,t.view,t.nodeId,t.filter]),w=(0,V.useRef)(void 0),T=(0,V.useRef)(C);T.current=C;let E=j2(t.navigationUpdates,u),D=j2(t.mainUpdates,(0,V.useCallback)(e=>{r(e.state);let{visible:t}=e.state;if(t.type===`human-items`){let{items:n,detail:r}=t;a({items:n,detail:r,...e.view.type===`human-items`&&e.view.item!==void 0?{item:e.view.item}:{}})}f(new Date().toISOString()),e.reset!==void 0&&v(`The live view was re-sent whole: ${e.reset}.`)},[])),O=t.navigationUpdates!==`off`||t.mainUpdates!==`off`,k=(0,V.useRef)(O);k.current=O,(0,V.useEffect)(()=>{m(void 0);let t=!0,n=e.live({view:T.current,paused:!k.current,onState:(e,r)=>{let i=o.current;o.current=e.sidebar,c(e.sidebar),m(void 0),g(void 0);let a={state:e,view:n.view,...r.kind===`reset`?{reset:r.reason}:{}};if(r.kind===`snapshot`){if(D.show(a),t)E.show(e.sidebar);else if(i!==e.sidebar){let t=w2(i,e.sidebar);t>0&&E.offer(e.sidebar,t)}t=!1;return}if(r.kind===`reset`){E.offer(e.sidebar),D.offer(a);return}let s=r.frame.type===`run.changed`||r.frame.type===`run.removed`;s&&E.offer(e.sidebar),(!s||e.visible.type===`sidebar`)&&D.offer(a)},onError:e=>{if(n.view.type===`human-items`){a(t=>({...t.items===void 0?{}:{items:t.items},error:e.message})),n.change({type:`sidebar`});return}if(e instanceof ZN&&(e.code===`run_not_found`||e.code===`node_not_found`)){n.change({type:`sidebar`});return}m(e)},onDisconnected:()=>g(Error(`Live telemetry stream disconnected`)),onConnected:()=>g(void 0)});return w.current=n,()=>{n.close(),w.current===n&&(w.current=void 0)}},[e,y,D.show,D.offer,E.show,E.offer]),(0,V.useEffect)(()=>{JSON.stringify(w.current?.view)!==JSON.stringify(C)&&D.drop(),w.current?.change(C),C.type!==`human-items`&&a(e=>Object.keys(e).length===0?e:{})},[C,D.drop]),(0,V.useEffect)(()=>{O?w.current?.resume():w.current?.pause()},[O]);let A=(0,V.useCallback)(()=>{E.take(),D.take()},[E.take,D.take]),j=(0,V.useCallback)(()=>{v(void 0),A(),b(e=>e+1)},[A]),M=n?.visible,N=M!==void 0&&M.type!==`sidebar`&&M.type!==`human-items`&&M.run_id===S&&P2(M,C)?M:void 0,P=(0,V.useRef)(void 0),ee=N?.detail??(P.current?.run.run_id===S?P.current:void 0);P.current=ee;let F=(0,V.useMemo)(()=>F2(ee),[ee]),I=p!==void 0&&C.type===`timeline`&&ee!==void 0;return{rows:s,navigationRows:l,navigationWaiting:E.waiting,hostRows:n?.sidebar,mainWaiting:D.waiting,runId:S,detail:ee,timeline:N&&`timeline`in N?N.timeline:void 0,channel:N&&`channel`in N?N.channel:void 0,humanItems:i,timelineError:I?p:void 0,loading:n===void 0&&p===void 0,lastUpdated:d,activity:F,error:I?h:p??h,notice:_,refresh:j}}function N2(e,t,n,r){if(e===void 0)return{type:`sidebar`};let i=r===void 0?{}:{filter:r};switch(t){case`channel`:return{type:`channel`,run_id:e};case`overall`:return{type:`timeline`,run_id:e,scope:`run`,...i};case`node`:return n===void 0?{type:`detail`,run_id:e,...i}:{type:`timeline`,run_id:e,scope:`node`,node:n,...i};case`graph`:return{type:`detail`,run_id:e,...i}}}function P2(e,t){return t.type===e.type?t.type===`timeline`&&e.type===`timeline`?t.scope===e.scope&&(t.scope===`run`||e.scope===`node`&&e.node===t.node):!0:!1}function F2(e){let t=e?.run.live_activity;if(t===void 0)return[];let n=fM.safeParse(t);return n.success?n.data:[]}var I2={minutes:60,seconds:1},L2=e=>Object.hasOwn(I2,e),R2=600%I2.minutes==0?{amount:String(600/I2.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function z2(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*I2[e.unit];return Number.isSafeInteger(n)?n:void 0}function B2(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function V2(e){return e.map(e=>({runId:e.run_id,owner:CX(e.launch)}))}function H2(e,t){return t instanceof ZN&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var U2={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function W2(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(U2);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===U2.hostShutdown?U2.hostShutdown:U2.dispatchStopped}]})}function G2(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}function K2(e){return(0,V.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.owner,(t.get(n.owner)??0)+1);return[...t].map(([e,t])=>({owner:e,count:t}))},[e])}var q2=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function J2({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,V.useId)(),[s,c]=(0,V.useState)(R2),[l,u]=(0,V.useState)(!1),d=z2(s),f=n!==void 0&&r===void 0,p=()=>{c(R2),u(!1),t(!1)};return(0,U.jsx)(_c,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,U.jsxs)(xc,{className:`shutdown-dialog`,children:[(0,U.jsxs)(Sc,{children:[(0,U.jsx)(wc,{children:`Shut down the entire host?`}),(0,U.jsx)(Tc,{children:q2})]}),(0,U.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,U.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,U.jsx)(X2,{caption:`It acts on all ${Y2(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,U.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,U.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,U.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,U.jsx)(`legend`,{children:`Grace`}),(0,U.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,U.jsx)(kc,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,U.jsx)(Ec,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,U.jsx)(kc,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,U.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;L2(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(I2).map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]}),(0,U.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${B2(d)}. The engine's default is ${B2(z2(R2)??0)}.`})]}),(0,U.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,U.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,U.jsx)(kc,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,U.jsxs)(Cc,{children:[(0,U.jsx)(yc,{asChild:!0,children:(0,U.jsx)(Fa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,U.jsx)(Fa,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var Y2=e=>e===1?`1 run`:`${e} runs`;function X2({caption:e,label:t,runs:n,warning:r=!1}){let i=K2(n);return(0,U.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,U.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,U.jsx)(`ul`,{"aria-label":t,children:i.map(({owner:e,count:t})=>(0,U.jsxs)(`li`,{children:[e,` — `,Y2(t)]},e))})]})}function Z2(e,t,n){let[r,i]=(0,V.useState)(),a=Q2(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:V2(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function Q2(e,t,n,r){let i=(0,V.useRef)(new Set),a=t?.next_cursor;return(0,V.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function $2(e,t){let[n,r]=(0,V.useState)({phase:`idle`}),i=(0,V.useRef)(!1);return{state:n,confirm:(0,V.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(H2(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,V.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var e4=[`host`];function t4(e){return{host:$2(`host`,(0,V.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function n4({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=Z2(e,t,n),u=r.host.state.phase===`sending`;return(0,U.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,U.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,U.jsxs)(Fa,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,U.jsx)(Xt,{size:14}),` Shut down the entire host`]})}),e4.map(e=>(0,U.jsx)(J2,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var r4=1e3;function i4(e,t){let[n,r]=(0,V.useState)(()=>Date.now());(0,V.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),r4);return()=>clearInterval(e)},[]);let i=W2(e,(0,V.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===U2.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function a4({label:e,state:t,rows:n,onDismiss:r}){return t.phase===`idle`?null:(0,U.jsxs)(`section`,{"aria-label":e,className:`shutdown-status`,children:[t.phase===`sending`?(0,U.jsx)(s4,{rows:n,sent:t.sent}):t.phase===`lost`?(0,U.jsxs)(ca,{"aria-label":`${e} lost`,variant:`destructive`,children:[(0,U.jsx)(sn,{}),(0,U.jsx)(la,{children:`Shutdown lost: no answer came back`}),(0,U.jsxs)(ua,{children:[(0,U.jsxs)(`p`,{children:[`The request sent at `,G2(t.sent.sentAt),` ended without an answer (`,t.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,U.jsx)(o4,{sent:t.sent})]})]}):t.phase===`refused`?(0,U.jsxs)(ca,{"aria-label":`${e} refused`,variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsxs)(la,{children:[`Shutdown refused · `,t.error.status,` `,t.error.code]}),(0,U.jsxs)(ua,{children:[(0,U.jsx)(`pre`,{className:`verb-text`,children:t.error.message}),(0,U.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,U.jsx)(l4,{label:e,report:t.report}),t.phase!==`sending`&&(0,U.jsx)(`div`,{className:`composer-actions`,children:(0,U.jsx)(Fa,{onClick:r,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function o4({sent:e}){return(0,U.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,G2(e.sentAt),` · scope `,e.scope,` · grace`,` `,B2(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function s4({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=i4(e,t);return(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,U.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,U.jsx)(zt,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,U.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,eI(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,U.jsx)(o4,{sent:e}),(0,U.jsx)(`p`,{children:o?n<a?`Waiting out the ${B2(e.grace)} grace until ${G2(a)} (${eI(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${G2(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,U.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,U.jsxs)(`li`,{children:[e,`:`,` `,t===U2.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function c4(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function l4({label:e,report:t}){return(0,U.jsxs)(ca,{"aria-label":`${e} report`,variant:t.complete?`default`:`destructive`,children:[t.complete?(0,U.jsx)(Et,{}):(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:t.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,U.jsxs)(ua,{className:`shutdown-report`,children:[!t.complete&&(0,U.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,U.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,t.scope,` · grace `,B2(t.grace_seconds),t.forced?` · forced`:``,` · runs root `,t.root]}),t.runs.length===0?(0,U.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):t.runs.map(e=>(0,U.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,U.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,U.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,U.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,U.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,eI(e.waited_ms),(0,U.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,U.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,U.jsx)(`p`,{children:`No branch this run's records name.`}):(0,U.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,U.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,c4(e),(0,U.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),t.not_pushed_unread===null?t.not_pushed.length===0?(0,U.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,t.not_pushed.length,`):`]}),(0,U.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:t.not_pushed.map(({identity:e,branch:t})=>(0,U.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,U.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,t.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`The engine's own report`}),(0,U.jsx)(`pre`,{className:`verb-text`,children:t.rendered})]})]})]})}var u4={crosshair:!0,ticks:{minSpacingPx:80}},d4=2e3;function f4(e){let[t,n]=e;if(n-t>=2e3)return e;let r=(t+n)/2;return[r-d4/2,r+d4/2]}var p4=1e3;function m4({completedAt:e,startedAt:t}){let n=t===void 0?void 0:nI(t),r=e===void 0?void 0:nI(e),i=h4(n!==void 0&&r===void 0);return n===void 0?null:r===void 0?(0,U.jsxs)(U.Fragment,{children:[eI(i-n.getTime()),` · running`]}):(0,U.jsx)(U.Fragment,{children:eI(r.getTime()-n.getTime())})}function h4(e){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),p4);return()=>clearInterval(t)},[e]),t}function g4({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?Wt:Ht;return(0,U.jsxs)(Na,{"aria-label":`${t}: ${n}`,className:B(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,U.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function _4(e){return e.charAt(0).toUpperCase()+e.slice(1)}var v4=[[`recovery`,[`retry`,`retried`,`requeued`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`refused`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`publication`,[`pr`,`publication`,`published`,`release`,`merge`,`merged`,`change`,`drafting`,`landing`,`landed`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`branches`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],y4={"change-retitled":`publication`,"title-unverified":`verification`,"node-restack-started":`repository`,"node-restacked":`repository`,"review-comments-read":`publication`,"review-reply-posted":`publication`,"review-reply-not-drafted":`publication`,"node-absorbed":`publication`,"node-readjusted":`repository`,"completion-requested":`lifecycle`,"command-accepted":`planning`,"body-not-drafted":`publication`,"criterion-checked":`verification`,"pool-maintenance":`lifecycle`,"dispatch-stopped":`lifecycle`,"host-shutdown":`lifecycle`,"scratch-removed":`lifecycle`,"scratch-retained":`lifecycle`,"home-status":`lifecycle`};function b4(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function x4(e){let t=y4[e];if(t!==void 0)return t;let n=b4(e);return v4.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var S4={recovery:Qt,failure:on,human:cn,planning:kt,contention:Ft,verification:nn,publication:Pt,repository:Nt,session:Gt,lifecycle:Kt,activity:Ot};function C4({category:e,className:t=`size-3`}){let n=S4[e];return(0,U.jsx)(n,{"aria-hidden":`true`,className:t})}function w4(e){return e===`human-step`?`human step`:e}function T4(e){return e.style===`human-step`}function E4(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function D4(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function O4(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function k4(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function A4({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:w4(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,D4(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,O4(e.delivery)]].filter(([,e])=>e!==void 0);return(0,U.jsxs)(U.Fragment,{children:[t.length>0&&(0,U.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,U.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,U.jsxs)(`li`,{children:[T4(e)?(0,U.jsxs)(ca,{children:[(0,U.jsx)(cn,{}),(0,U.jsxs)(la,{children:[`Waiting on a person · `,k4(e)]}),(0,U.jsx)(ua,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,U.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,k4(e)]}),(0,U.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:E4(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,U.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function j4({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,U.jsx)(U.Fragment,{children:`Not recorded`});let n=t.identity!==e.task.repo;return(0,U.jsx)(U.Fragment,{children:[t.target,t.style===void 0?void 0:w4(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function M4({artifactId:e,client:t,runId:n}){let r=RI(`${n}/${e}`,()=>t.getArtifact(n,e),0),i=r.value?.turns??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Oneharness conversation`}),r.loading?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`Loading conversation…`}):r.value===void 0?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`The history store holds no readable copy of that conversation.`}):r.value.unavailable===void 0?(0,U.jsx)(Ia,{className:`gap-0 py-3`,children:(0,U.jsx)(La,{className:`px-3`,children:i.map(e=>(0,U.jsx)(Cw,{turn:e},e.id))})}):(0,U.jsxs)(ca,{variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Transcript unavailable`}),(0,U.jsx)(ua,{children:r.value.unavailable})]})]})}function N4({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=P4(e),c=RI(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),l=c.value?.content;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,U.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,U.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l===void 0?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,U.jsxs)(U.Fragment,{children:[c.value?.truncated===!0&&(0,U.jsxs)(`p`,{className:`detail-note`,children:[`The server keeps the end of a `,i,` this long; its beginning is not shown.`]}),(0,U.jsx)(`section`,{"aria-label":n,children:(0,U.jsx)(`pre`,{children:l})})]})]})}function P4(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function F4(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:eI(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`&&e.status===`running`,...e.status?{status:e.status}:{}}}function I4({row:e}){let t=F4(e);return(0,U.jsxs)(`header`,{className:`detail-title`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(Na,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,U.jsx)(`h2`,{children:t.label}),(0,U.jsxs)(`p`,{className:`detail-when`,children:[(0,U.jsx)(sI,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,U.jsx)(Na,{variant:`secondary`,children:t.status})]})}function L4(e){let t=F4(e);return[t.kind,t.label,rI(t.startedAt),_4(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function R4({row:e}){return(0,U.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":L4(e),children:(0,U.jsx)(C4,{category:e.category})})}var z4=`data-timeline-reading`;function B4(e){let t=e.closest(`[${z4}]`)??e.closest(`button`)?.querySelector(`[${z4}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(z4)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var V4={rows:[],total:0},H4={queued:`Queued`,dispatch:`Dispatch`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},U4=`idle`,W4=new Set([...Object.keys(H4),U4]),G4=`member:`;function K4(e){return W4.has(e)?`${G4}${e}`:e}var q4=Object.entries(H4).map(([e,t])=>({id:e,label:t}));function J4(e){let t=e?.spans??[],n=[];for(let e of t){let t=e.agent_role??e.harness_scope;t!==void 0&&!n.includes(t)&&n.push(t)}let r=t.some(e=>_3(e)===`dispatch`),[i,...a]=q4;return[...i===void 0?[]:[i],...n.map(e=>({id:K4(e),label:e})),...a.filter(({id:e})=>r||e!==`dispatch`)]}var Y4={run:null,node:null,step:null,dispatch:`dispatch`,verification:`verification`,publication:`publication`,"pr-drafting":`dispatch`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`};function X4(e){return e===`agent`}function Z4(e,t){return e===void 0?t===void 0?H4.dispatch:Q4(t):F3(t)&&t!==e?`${e} · ${t}`:e}function Q4(e){return e===`llmlint`?`Lint`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}var $4={"lock-wait":`Lock waits`};function e3(e,t=q4){let n=[...e].sort((e,t)=>e.start-t.start),r=n.at(0)?.start??0,i=Math.max(r+1,...n.map(e=>e.end??e.start)),a=new Set([n.at(0),n.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),o=(i-r)*.02,s=[];for(let e of n){let n=Math.max(e.end??e.start,e.start+o),r=s.findLast(t=>{let r=Math.max(t.end??t.start,t.start+o);return e.start<=r&&t.start<=n});r===void 0||a.has(e.id)?s.push(e):n3(e,t)<n3(r,t)?a.has(r.id)?s.push(e):s[s.indexOf(r)]=e:t3(e,r,o)||s.push(e)}return s.sort((e,n)=>n3(n,t)-n3(e,t)||(e.end??e.start)-e.start-((n.end??n.start)-n.start))}function t3(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function n3(e,t){let n=e.laneId??``,r=t.findIndex(({id:e})=>e===n);return r<0?t.length:r}function r3(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function i3(e,t){let n=l3(e,t).rows,r=s3(n),i=s3(n,!1).flatMap(e=>{let t=c3(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),a=r.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,V.createElement)(R4,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:J4(e),rows:r,tree:n}}function a3(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function o3(e,t){return`${e} more ${t} events`}function s3(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function c3(e){return e.rowKind===`event`?null:e.role===void 0?Y4[e.rowKind===`span`?e.span.kind:e.kind]??null:K4(e.role)}function l3(e,t){if(e===void 0)return V4;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=L3(e.spans,new Set,t);return n.length===0?V4:{rows:D3(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=[...o===void 0?[]:m3(o,i),...a.filter(e=>e!==o).map(e=>h3(e,i)),...L3(e.spans,r,t)].sort(z3),c=n.some(e=>e.dispatch_group!==void 0||e.events.some(e=>e.dispatch_group!==void 0))?P3(s):D3(N3(M3(s)));return{span:o,rows:c,total:R3(c)}}function u3(e){return h3(e,new Map)}function d3(e){return E3(e)}function f3(e,t){return p3(e,t).at(-1)}function p3(e,t){let n=(e,r)=>{for(let i of e){if(r?i.rowKind===`event`&&i.event.id===t:i.id===t)return[i];let e=n(i.children,r);if(e.length>0)return[i,...e]}return[]},r=n(e,!1);return r.length>0?r:n(e,!0)}function m3(e,t){return[...(t.get(e.id)??[]).map(e=>h3(e,t)),...e.events.map(E3)].sort(z3)}function h3(e,t){let n=g3(e),r=e.kind===`dispatch`?e.transport_role:void 0;return{rowKind:`span`,span:e,id:e.id,kind:e.kind,...n===void 0?{}:{role:n},...r===void 0?{}:{transport:r},label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??B3(e.started_at,e.ended_at),children:D3(m3(e,t)),displayLabel:j3(e,n,r),displayKind:O3(e,n,r),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function g3(e){return e.kind===`dispatch`?e.agent_role??e.harness_scope:void 0}function _3(e){return e.agent_role===void 0?e.harness_scope===void 0?Y4[e.kind===`rollup`?e.label:e.kind]??null:K4(e.harness_scope):K4(e.agent_role)}function v3(e,t=[]){let n=t.find(({id:t})=>t===e);return n===void 0?H4[e]??(e.startsWith(G4)?e.slice(7):e):n.label}function y3(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var b3=`Redirection`;function x3(e){if(e.surface===void 0)return;let t=[e.surface.kind,e.surface.message].filter(e=>e!==void 0);return t.length===0?void 0:t.join(`: `)}var S3=`Surface`,C3=`Blocking surface`;function w3(e){return e.kind.startsWith(`edit-`)?e.author:void 0}function T3(e,t){let n=w3(t);return n===void 0?e:`${e} · by ${n}`}function E3(e){let t=y3(e),n=x3(e),r=t===void 0?e.surface===void 0?`Event`:e.surface.blocking===!0?C3:S3:b3;return{rowKind:`event`,event:e,id:e.record_id??e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:T3(t??n??(e.kind===`turn-activity`&&e.description!==void 0&&e.description!==``?e.description:void 0)??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),e),displayKind:r,category:x4(e.kind)}}function D3(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&I3(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:B3(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind,...r.role===void 0?{}:{role:r.role},...r.transport===void 0?{}:{transport:r.transport},...r.dispatch!==void 0&&a.every(e=>e.dispatch?.id===r.dispatch?.id)?{dispatch:r.dispatch}:{}}),n=i}return t}function O3(e,t,n){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return $4[e.label]??e.label;if(e.kind===`dispatch`)return Z4(t,n);let r=Y4[e.kind];return r===null?e.kind:v3(r)}function k3(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function A3(e){return e.map(k3).join(` and `)}function j3(e,t,n){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${A3(e.reasons??[])}`.trim();let r=O3(e,t,n);return e.kind===`rollup`?`${r}: ${e.count??0} recorded`:!e.label||e.label===r?r:e.kind===`dispatch`?`${r} (${e.label})`:`${r}: ${e.label}`}function M3(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=M3(e.children);return!X4(e.transport)||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function N3(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(X4(a.transport)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(F3(a.transport)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function P3(e){let t=new Map,n=[];for(let r of s3(e).filter(e=>e.rowKind!==`group`)){let e=r.rowKind===`event`?r.event.dispatch_group:r.span.dispatch_group,i={...r,children:[]};if(e===void 0){n.push(i);continue}let a=t.get(e.id)??{metadata:e,members:[]};a.members.push({...i,dispatch:{id:e.id,label:e.label}}),t.set(e.id,a)}let r=e=>[...D3(e.filter(e=>e.rowKind===`span`&&e.kind===`dispatch`).sort(z3)),...D3(e.filter(e=>e.rowKind!==`span`||e.kind!==`dispatch`).sort(z3))];return[...n.map(e=>({at:e.startedAt,order:e.rowKind===`event`?(e.event.journal_order??0)*3:0,rows:[e]})),...[...t.values()].map(({metadata:e,members:t})=>({at:e.started_at,order:e.order,rows:r(t)}))].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)||e.order-t.order).flatMap(({rows:e})=>e)}function F3(e){return e===`judge`||e===`llmlint`}function I3(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind&&e.role===t.role&&e.transport===t.transport}function L3(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(E3)}function R3(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+R3(t.children),0)}function z3(e,t){let n=Date.parse(e.startedAt)-Date.parse(t.startedAt);return n===0?e.rowKind===`event`&&t.rowKind===`event`?(e.event.journal_order??0)-(t.event.journal_order??0):0:n}function B3(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function V3(e,t,n,r){let[i,a]=(0,V.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,V.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,V.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var H3=32;function U3(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function W3(e,t){let n=(0,V.useRef)(null),r=(0,V.useRef)(!0),i=(0,V.useRef)({key:e,count:t}),a=(0,V.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=H3)},[]),o=(0,V.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=U3(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,V.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var G3=25;function K3({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:p6(r),a=i?.kind===`conversation`?i.value:void 0,o=V3(e,t,a,r===void 0?void 0:c6(r));return(0,U.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,U.jsx)(cf,{className:`h-full`,children:(0,U.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:W3(a,l6(r,o)),children:r===void 0?(0,U.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,U.jsx)(Rt,{size:30}),(0,U.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I4,{row:r}),(0,U.jsx)(xf,{className:`my-4`}),(0,U.jsx)(q3,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function q3({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=u6(n);if(o!==void 0)return(0,U.jsx)(r6,{redirection:o,row:n});let s=d6(n);if(s!==void 0)return(0,U.jsx)(A4,{release:s});let c=f6(n);return c===void 0?i?.kind===`conversation`?(0,U.jsxs)(U.Fragment,{children:[n.rowKind===`event`&&(0,U.jsx)(o6,{row:n,reference:i}),(0,U.jsx)(Q3,{row:n,transcript:a})]}):h6(n)?(0,U.jsx)($3,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&P4(i.value)!==void 0?(0,U.jsx)(e6,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&P4(i.value)!==void 0?(0,U.jsx)(t6,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):g6(n,i)&&r!==void 0?(0,U.jsx)(n6,{node:r,reference:i}):(0,U.jsx)(o6,{reference:i,row:n}):(0,U.jsx)(a6,{row:n,surface:c})}function J3({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,U.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function Y3(e){return e.tool?.turn??e.id}function X3(e,t){if(e.rowKind!==`event`||e.event.tool===void 0)return;let n=Y3(e.event),r=t.find(({id:e})=>e===n);if(r===void 0)return;let{index:i,tool_call_id:a}=e.event.tool;return a!==void 0&&r.tools.some(e=>e.toolCallId===a)?{turnId:r.id,toolCallId:a}:{turnId:r.id,eventIndex:i}}function Z3({turn:e}){let t=[e.unknown.instruction_truncated===!0?`its prompt`:void 0,e.unknown.truncated===!0?`its reply`:void 0,e.tools.some(e=>e.output_truncated===!0)?`a tool's output`:void 0,e.tools.some(e=>e.input_truncated===!0)?`a tool's input`:void 0].filter(e=>e!==void 0);return t.length===0?null:(0,U.jsxs)(ca,{className:`mb-3`,role:`note`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Cut by the recorder`}),(0,U.jsxs)(ua,{children:[`The run's recorder cut `,t.join(`, `),` to its bound, and no whole copy exists: neither the member's report nor a history file this run names holds it.`]})]})}function Q3({row:e,transcript:t}){let[n,r]=(0,V.useState)(G3),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?Y3(e.event):void 0,o=a===void 0?i:i.filter(({id:e})=>e===a),s=Om(o.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,U.jsx)(Sf,{className:`h-2 w-40`}),(0,U.jsx)(Sf,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,U.jsxs)(ca,{variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Transcript unavailable`}),(0,U.jsx)(ua,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:c,attribution:l}=t.conversation,u=_6(l.agentRole,l.transportRole),d=X3(e,o);return(0,U.jsx)(Ia,{className:`gap-0 py-3`,children:(0,U.jsxs)(La,{className:`px-3`,children:[(0,U.jsxs)(`header`,{className:`transcript-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,u,l.persona?` · ${l.persona}`:``]}),(0,U.jsx)(`h4`,{children:c.name})]}),(0,U.jsx)(_m,{state:c.state})]}),(0,U.jsx)(xf,{className:`my-2.5`}),(0,U.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,U.jsx)(Dm,{cursor:s.cursor,...d===void 0?{}:{focus:d},onSelectTurn:s.scrollTo,turns:[...o]})}),o.length===0?(0,U.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:s.containerRef,children:o.slice(0,n).map(e=>(0,U.jsxs)(`div`,{ref:t=>s.register(e.id,t),children:[(0,U.jsx)(Z3,{turn:e}),(0,U.jsx)(Cw,{author:{label:u},...d?.turnId===e.id?{focus:d}:{},turn:e}),(0,U.jsx)(J3,{turn:e})]},e.id))}),o.length>n&&(0,U.jsxs)(Fa,{onClick:()=>r(n+G3),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,o.length,` turns`]})]})]})})}function $3({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,U.jsx)(`dl`,{className:`facts`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Result`}),(0,U.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,U.jsx)(`pre`,{children:i.output_tail})]}),(0,U.jsx)(N4,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,U.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function e6({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(N4,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,U.jsx)(o6,{reference:n,row:r})]})}function t6({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(M4,{artifactId:e,client:t,runId:i}),(0,U.jsx)(o6,{reference:n,row:r})]})}function n6({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,U.jsx)(s6,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,U.jsx)(Mt,{size:13})]})}):r?.branch_url?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,U.jsx)(Mt,{size:13})]})}):!r?.pr_url&&(0,U.jsx)(s6,{fallback:`No publication was recorded.`,reference:t}),(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,U.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,U.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e.name}),(0,U.jsx)(`dd`,{children:e.url?(0,U.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function r6({redirection:e,row:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Delivery`}),(0,U.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Turn`}),(0,U.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Redirected at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Member`}),(0,U.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Note`}),(0,U.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,U.jsx)(i6,{row:t})]}),e.reason!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,U.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function i6({row:e}){let t=e.rowKind===`event`?w3(e.event):void 0;return t===void 0?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Author`}),(0,U.jsx)(`dd`,{children:t})]})}function a6({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,U.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function o6({row:e,reference:t}){if(e.rowKind===`event`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:e.startedAt,relative:!0})})]}),Object.entries(e.event.fields??{}).map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:typeof t==`string`?t:JSON.stringify(t)})]},e))]}),t!==void 0&&(0,U.jsx)(s6,{reference:t,fallback:`No recorded artifact.`})]});let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:e.startedAt,relative:!0})})]}),e.rowKind===`span`&&(e.endedAt!==null||e.status===`running`)&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Ended`}),(0,U.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,U.jsx)(sI,{at:e.endedAt,relative:!0})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Status`}),(0,U.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Duration`}),(0,U.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:eI(e.durationMs)})]}),r!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Aggregated`}),(0,U.jsx)(`dd`,{children:r})]}),i.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Waiting on`}),(0,U.jsx)(`dd`,{children:i.map(k3).join(` and `)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Step`}),(0,U.jsx)(`dd`,{children:m6(n)??`None`})]}),(0,U.jsx)(i6,{row:e})]}),(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,U.jsx)(s6,{fallback:e.rowKind===`span`&&e.span.kind===`dispatch`?`No transcript was recorded for this dispatch.`:`This item points at no recorded artifact.`,reference:t})]})}function s6({reference:e,fallback:t}){return e===void 0?(0,U.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,U.jsx)(Mt,{size:13})]})}):(0,U.jsxs)(`p`,{className:`detail-note`,children:[(0,U.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,U.jsx)(`code`,{children:e.value})]})}function c6(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function l6(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function u6(e){return e.rowKind===`event`?e.event.redirection:void 0}function d6(e){return e.rowKind===`event`?e.event.release:void 0}function f6(e){return e.rowKind===`event`?e.event.surface:void 0}function p6(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function m6(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function h6(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function g6(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function _6(e,t){return Z4(e,t)}function v6({client:e,runId:t,node:n,nodes:r,timeline:i,timelineError:a,selectedItemId:o,onSelectItem:s,onBack:c,selectedTab:l,onSelectTab:u}){let d=(0,V.useMemo)(()=>l3(i,n.id),[i,n.id]);(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(o===void 0?c():s())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,s,o]);let f=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,U.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,U.jsxs)(`header`,{className:`node-view-head`,children:[(0,U.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,U.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,U.jsx)(`li`,{children:(0,U.jsxs)(Fa,{onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:[(0,U.jsx)(yt,{size:14}),` Graph`]})}),(0,U.jsx)(`li`,{"aria-current":`page`,children:(0,U.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,U.jsxs)(`div`,{className:`node-view-facts`,children:[(0,U.jsx)(K0,{className:`node-view-state`,state:n.status}),(0,U.jsx)(g4,{control:n.control}),(0,U.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),f!==void 0&&(0,U.jsxs)(`a`,{className:`node-view-pr`,href:f,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,U.jsx)(Mt,{size:12})]})]})]}),(0,U.jsx)(O6,{node:n,nodes:r}),(0,U.jsx)(D6,{node:n}),(0,U.jsxs)(xp,{className:`node-tabs`,onValueChange:e=>{h2(e)&&u(e)},value:l,children:[(0,U.jsx)(Cp,{"aria-label":`Node details`,variant:`line`,children:Object.entries(m2).map(([e,t])=>(0,U.jsx)(wp,{value:e,children:t},e))}),(0,U.jsxs)(Tp,{className:`node-tab-panel`,value:`task`,children:[(0,U.jsx)(y1,{source:w6(n.task)}),(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Settled as`}),(0,U.jsx)(`dd`,{children:k6(n.result?.outcome)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Outcome`}),(0,U.jsx)(`dd`,{children:k6(n.result?.detail)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Graph overrides`}),(0,U.jsx)(`dd`,{children:(n.task.sets??[]).length===0?`None`:(0,U.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:n.task.sets?.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{children:e})},t))})})]})]})]}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`criteria`,children:(0,U.jsx)(y1,{source:T6(n.task)})}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`dependencies`,children:(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Dependencies`}),(0,U.jsx)(`dd`,{children:(n.task.deps??[]).map(e=>{let t=r.find(t=>t.id===e)?.status;return t===void 0?e:`${e} (${t})`}).join(`, `)||`None`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Unblocks`}),(0,U.jsx)(`dd`,{children:n.dependents.join(`, `)||`None`})]})]})}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`remote`,children:(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Publication`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(E6,{node:n})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Branch`}),(0,U.jsx)(`dd`,{children:n.detail?.publication?.branch??`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Merge`}),(0,U.jsx)(`dd`,{children:n.detail?.publication?n.detail.publication.merged?`Merged`:`Not merged`:`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Release`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(j4,{node:n})})]}),(0,U.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,U.jsx)(`dt`,{children:`Verification coverage`}),(0,U.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,U.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,U.jsx)(`dt`,{children:`Observed checks`}),(0,U.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:(0,U.jsxs)(`table`,{"aria-label":`Remote checks`,className:`remote-checks`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Name`}),(0,U.jsx)(`th`,{children:`Status`}),(0,U.jsx)(`th`,{children:`Conclusion`}),(0,U.jsx)(`th`,{children:`Runtime`}),(0,U.jsx)(`th`,{children:`Required`})]})}),(0,U.jsx)(`tbody`,{children:n.detail?.verification.checks?.map(e=>(0,U.jsxs)(`tr`,{className:e.status===`completed`&&![`success`,`neutral`,`skipped`].includes(e.conclusion??``)?`check-failing`:void 0,children:[(0,U.jsx)(`th`,{scope:`row`,children:e.url?(0,U.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.name}):e.name}),(0,U.jsx)(`td`,{children:e.status??`Not recorded`}),(0,U.jsx)(`td`,{children:e.conclusion??`—`}),(0,U.jsx)(`td`,{children:(0,U.jsx)(m4,{...e.started_at===void 0?{}:{startedAt:e.started_at},...e.completed_at===void 0?{}:{completedAt:e.completed_at}})}),(0,U.jsxs)(`td`,{title:e.requirement,className:e.required?`check-required`:`check-optional`,children:[(0,U.jsx)(`svg`,{role:`img`,"aria-label":e.required?`required`:`not required`,width:`12`,height:`12`,viewBox:`0 0 12 12`,children:e.required?(0,U.jsx)(`path`,{d:`M6 0.5 L11 2.5 V6 C11 9 8.5 11 6 11.5 C3.5 11 1 9 1 6 V2.5 Z`,fill:`currentColor`}):(0,U.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`2 1.5`})}),e.required?`Required`:`Optional`]})]},e.name))})]})})]})]})}),(0,U.jsx)(Tp,{className:`node-timeline-panel`,value:`timeline`,children:a===void 0?i===void 0?(0,U.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):d.rows.length===0?(0,U.jsxs)(Ia,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,U.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,U.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,U.jsx)(y6,{client:e,node:n,onSelectItem:s,runId:t,selectedItemId:o,timeline:i}):(0,U.jsxs)(ca,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Timeline unavailable`}),(0,U.jsx)(ua,{children:a.message})]})})]})]})}function y6({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,V.useMemo)(()=>i3(a,t.id),[a,t.id]),[s,c]=(0,V.useState)(()=>new Set),l=(0,V.useMemo)(()=>{if(i!==void 0)return p3(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,V.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,V.useMemo)(()=>a3(o.tree,u),[o.tree,u]),f=Om((0,V.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(),_=(0,V.useMemo)(()=>e3(o.items,o.lanes),[o.items,o.lanes]),v=(0,V.useMemo)(()=>r3(o.markers,o.items,i),[o.items,o.markers,i]),y=(0,V.useMemo)(()=>b6([...o.items,...o.markers.map(({at:e})=>({start:e}))]),[o.items,o.markers]),b=(0,V.useMemo)(()=>b6([...p?o.items:_,...v.map(({at:e})=>({start:e}))]),[p,o.items,_,v]),x=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,y[0]),y[1]),S=i===void 0?void 0:f3(o.rows,i),C=e=>{n(e),f.scrollTo(e)},{scrollTo:w}=f;return(0,V.useEffect)(()=>{i!==void 0&&w(i)},[i,w]),(0,U.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,U.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,U.jsx)(wn,{...u4,axis:{origin:y[0]},cursor:x,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:_,lanes:o.lanes,markers:v,onExpandedChange:m,onRangeChange:e=>g(e[0]<=b[0]&&e[1]>=b[1]?void 0:f4(e)),onSelect:e=>C(e.id),range:h??b,selectedId:i})}),(0,U.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:x6(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,U.jsx)(C6,{onOpen:C,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,U.jsx)(S6,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.id}`));return e.dispatch===void 0?(0,U.jsx)(V.Fragment,{children:t},e.id):(0,U.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,U.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),S!==void 0&&(0,U.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,U.jsx)(Fa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,U.jsx)(dn,{})}),(0,U.jsx)(K3,{client:e,node:t,row:S,runId:r})]})]})}function b6(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function x6(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function S6({entry:e,onToggle:t}){let n=o3(e.hidden,e.group.kind);return(0,U.jsx)(`p`,{className:`transcript-collapsed`,children:(0,U.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function C6({row:e,selected:t,register:n,onOpen:r}){return(0,U.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-journal-seq":e.rowKind===`event`?e.event.seq:void 0,"data-selected":t,ref:t=>n(e.id,t),children:(0,U.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,U.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,U.jsx)(C4,{category:e.category}),e.displayKind]}),(0,U.jsx)(`strong`,{children:e.displayLabel}),(0,U.jsxs)(`span`,{className:`transcript-facts`,children:[(0,U.jsx)(sI,{at:e.startedAt}),e.durationMs!==null&&` · ${eI(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function w6(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
|
|
112
|
+
`)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of i){let t=n.current.get(e.getAttribute(`data-row-key`)??``),r=a.get(e.getAttribute(`data-row-key`)??``);t===void 0||r===void 0||t===r||e.animate([{transform:`translateY(${t-r}px)`},{transform:`translateY(0)`}],{duration:E2,easing:`ease-out`})}n.current=a},[e,t])}function k2({rows:e,selectedRunId:t,onSelect:n,onOpenProject:r,onHost:i,hostCurrent:a=!1,onActionItems:o,actionItemsCurrent:s=!1,hiddenKinds:c,onKindsChange:l,updates:u,drawerOpen:d=!1,drawerRef:f}){let{kinds:p,groups:m}=T2(e,c,t,r??n),h=(0,V.useRef)(null);return O2(h,m),(0,U.jsx)(`nav`,{"aria-label":`Projects`,className:`run-nav`,"data-open":d,id:`run-navigation`,ref:f,children:(0,U.jsx)(cf,{className:`h-full`,children:(0,U.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,U.jsxs)(`div`,{className:`brand`,children:[(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,U.jsx)(_t,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,U.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,U.jsx)(xf,{className:`my-[22px]`}),(0,U.jsxs)(`div`,{className:`nav-pages`,children:[(0,U.jsx)(Fa,{"aria-current":a?`page`:void 0,onClick:i,variant:`ghost`,children:`Host`}),o&&(0,U.jsx)(Fa,{"aria-current":s?`page`:void 0,onClick:o,variant:`ghost`,children:`Action items`})]}),p.length>0&&(0,U.jsxs)(`details`,{className:`kind-filter`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsxs)(`span`,{children:[`Run kinds:`,` `,p.filter(e=>!c.includes(e)).length,` of`,` `,p.length]}),(0,U.jsx)(Ct,{"aria-hidden":`true`,size:14})]}),(0,U.jsxs)(`fieldset`,{children:[(0,U.jsx)(`legend`,{className:`sr-only`,children:`Run kinds`}),p.map(e=>(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:!c.includes(e),onChange:t=>l(t.target.checked?c.filter(t=>t!==e):[...c,e])}),e]},e))]})]}),u,e===void 0?(0,U.jsx)(`p`,{role:`status`,children:`Loading projects…`}):(0,U.jsx)(`div`,{className:`nav-rows`,ref:h,children:m.map(e=>(0,U.jsxs)(`fieldset`,{"aria-label":`Project ${e.label}`,className:`project-group`,children:[(0,U.jsxs)(`div`,{className:`project-row`,[D2]:`project:${e.key}`,children:[(0,U.jsx)(`button`,{"aria-expanded":e.expanded,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.label}`,className:`project-toggle`,onClick:e.toggle,type:`button`,children:(0,U.jsx)(wt,{"aria-hidden":`true`,"data-open":e.expanded,size:12})}),(0,U.jsxs)(`button`,{className:`project-open`,onClick:e.open,type:`button`,children:[(0,U.jsx)(`span`,{className:`project-name`,children:e.label}),(0,U.jsxs)(`span`,{className:`project-count`,children:[e.runs.length,(0,U.jsx)(`span`,{className:`sr-only`,children:` shown runs`})]})]})]}),e.expanded&&e.runs.length===0&&(0,U.jsx)(`p`,{className:`run-list-status`,role:`status`,children:`No runs of the shown kinds.`}),e.expanded&&e.runs.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Runs of ${e.label}`,className:`run-list`,children:e.runs.map(e=>{let r=t===e.id,i=[e.state,C2(e)].filter(Boolean).join(` · `);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{"aria-current":r?`page`:void 0,className:`run-link`,"data-active":r,onClick:()=>n(e.id),title:i,type:`button`,"data-row-key":`run:${e.id}`,children:[(0,U.jsxs)(pm,{children:[(0,U.jsx)(mm,{asChild:!0,children:(0,U.jsx)(`span`,{role:`img`,"aria-label":e.state,className:B(`run-dot`,J0(e.state))})}),(0,U.jsx)(hm,{children:e.state})]}),(0,U.jsx)(`span`,{className:`run-link-name`,children:e.name}),e.kind&&(0,U.jsx)(`span`,{"aria-label":e.kind,className:`run-link-tag`,role:`note`,children:e.kind}),r&&(0,U.jsx)(`span`,{className:`run-link-counts`,children:i})]})},e.id)})})]},e.key))})]})})})}function A2(){let[e,t]=(0,V.useState)(!1),n=(0,V.useRef)(null),r=(0,V.useRef)(null),i=(0,V.useRef)(!1),a=(0,V.useCallback)(()=>t(!1),[]),o=(0,V.useCallback)(()=>t(e=>!e),[]);return(0,V.useEffect)(()=>{if(!e)return;let r=e=>{e.key===`Escape`&&t(!1)},i=()=>{n.current?.offsetParent===null&&t(!1)};return document.addEventListener(`keydown`,r),window.addEventListener(`resize`,i),()=>{document.removeEventListener(`keydown`,r),window.removeEventListener(`resize`,i)}},[e]),(0,V.useEffect)(()=>{e?r.current?.querySelector(`button`)?.focus():i.current&&n.current?.focus(),i.current=e},[e]),{open:e,close:a,toggle:o,menuButton:n,drawer:r}}function j2(e,t){let[n,r]=(0,V.useState)(0),i=(0,V.useRef)(void 0),a=(0,V.useRef)(t);a.current=t;let o=e===`live`,s=(0,V.useRef)(o);s.current=o;let c=(0,V.useCallback)(e=>{i.current=void 0,r(0),a.current(e)},[]),l=(0,V.useCallback)(()=>{i.current!==void 0&&c(i.current.value)},[c]),u=(0,V.useCallback)((e,t=1)=>{s.current?c(e):(i.current={value:e},r(e=>e+t))},[c]),d=(0,V.useCallback)(()=>{i.current=void 0,r(0)},[]);return(0,V.useEffect)(()=>{o&&l()},[o,l]),(0,V.useEffect)(()=>{if(typeof e!=`number`)return;let t=setInterval(l,e*1e3);return()=>clearInterval(t)},[e,l]),{waiting:n,show:c,take:l,offer:u,drop:d}}function M2(e,t){let[n,r]=(0,V.useState)(),[i,a]=(0,V.useState)({}),o=(0,V.useRef)([]),[s,c]=(0,V.useState)(),[l,u]=(0,V.useState)(),[d,f]=(0,V.useState)(),[p,m]=(0,V.useState)(),[h,g]=(0,V.useState)(),[_,v]=(0,V.useState)(),[y,b]=(0,V.useState)(0),x=t.runId,S=s===void 0||x!==void 0&&s.some(e=>e.id===x)?x:x!==void 0||t.selectFirst?x2(s)[0]?.id:void 0,C=(0,V.useMemo)(()=>t.humanItems??N2(t.host?void 0:S,t.view,t.nodeId,t.filter),[t.humanItems,t.host,S,t.view,t.nodeId,t.filter]),w=(0,V.useRef)(void 0),T=(0,V.useRef)(C);T.current=C;let E=j2(t.navigationUpdates,u),D=j2(t.mainUpdates,(0,V.useCallback)(e=>{r(e.state);let{visible:t}=e.state;if(t.type===`human-items`){let{items:n,detail:r}=t;a({items:n,detail:r,...e.view.type===`human-items`&&e.view.item!==void 0?{item:e.view.item}:{}})}f(new Date().toISOString()),e.reset!==void 0&&v(`The live view was re-sent whole: ${e.reset}.`)},[])),O=t.navigationUpdates!==`off`||t.mainUpdates!==`off`,k=(0,V.useRef)(O);k.current=O,(0,V.useEffect)(()=>{m(void 0);let t=!0,n=e.live({view:T.current,paused:!k.current,onState:(e,r)=>{let i=o.current;o.current=e.sidebar,c(e.sidebar),m(void 0),g(void 0);let a={state:e,view:n.view,...r.kind===`reset`?{reset:r.reason}:{}};if(r.kind===`snapshot`){if(D.show(a),t)E.show(e.sidebar);else if(i!==e.sidebar){let t=w2(i,e.sidebar);t>0&&E.offer(e.sidebar,t)}t=!1;return}if(r.kind===`reset`){E.offer(e.sidebar),D.offer(a);return}let s=r.frame.type===`run.changed`||r.frame.type===`run.removed`;s&&E.offer(e.sidebar),(!s||e.visible.type===`sidebar`)&&D.offer(a)},onError:e=>{if(n.view.type===`human-items`){a(t=>({...t.items===void 0?{}:{items:t.items},error:e.message})),n.change({type:`sidebar`});return}if(e instanceof ZN&&(e.code===`run_not_found`||e.code===`node_not_found`)){n.change({type:`sidebar`});return}m(e)},onDisconnected:()=>g(Error(`Live telemetry stream disconnected`)),onConnected:()=>g(void 0)});return w.current=n,()=>{n.close(),w.current===n&&(w.current=void 0)}},[e,y,D.show,D.offer,E.show,E.offer]),(0,V.useEffect)(()=>{JSON.stringify(w.current?.view)!==JSON.stringify(C)&&D.drop(),w.current?.change(C),C.type!==`human-items`&&a(e=>Object.keys(e).length===0?e:{})},[C,D.drop]),(0,V.useEffect)(()=>{O?w.current?.resume():w.current?.pause()},[O]);let A=(0,V.useCallback)(()=>{E.take(),D.take()},[E.take,D.take]),j=(0,V.useCallback)(()=>{v(void 0),A(),b(e=>e+1)},[A]),M=n?.visible,N=M!==void 0&&M.type!==`sidebar`&&M.type!==`human-items`&&M.run_id===S&&P2(M,C)?M:void 0,P=(0,V.useRef)(void 0),ee=N?.detail??(P.current?.run.run_id===S?P.current:void 0);P.current=ee;let F=(0,V.useMemo)(()=>F2(ee),[ee]),I=p!==void 0&&C.type===`timeline`&&ee!==void 0;return{rows:s,navigationRows:l,navigationWaiting:E.waiting,hostRows:n?.sidebar,mainWaiting:D.waiting,runId:S,detail:ee,timeline:N&&`timeline`in N?N.timeline:void 0,channel:N&&`channel`in N?N.channel:void 0,humanItems:i,timelineError:I?p:void 0,loading:n===void 0&&p===void 0,lastUpdated:d,activity:F,error:I?h:p??h,notice:_,refresh:j}}function N2(e,t,n,r){if(e===void 0)return{type:`sidebar`};let i=r===void 0?{}:{filter:r};switch(t){case`channel`:return{type:`channel`,run_id:e};case`overall`:return{type:`timeline`,run_id:e,scope:`run`,...i};case`node`:return n===void 0?{type:`detail`,run_id:e,...i}:{type:`timeline`,run_id:e,scope:`node`,node:n,...i};case`graph`:return{type:`detail`,run_id:e,...i}}}function P2(e,t){return t.type===e.type?t.type===`timeline`&&e.type===`timeline`?t.scope===e.scope&&(t.scope===`run`||e.scope===`node`&&e.node===t.node):!0:!1}function F2(e){let t=e?.run.live_activity;if(t===void 0)return[];let n=fM.safeParse(t);return n.success?n.data:[]}var I2={minutes:60,seconds:1},L2=e=>Object.hasOwn(I2,e),R2=600%I2.minutes==0?{amount:String(600/I2.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function z2(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*I2[e.unit];return Number.isSafeInteger(n)?n:void 0}function B2(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function V2(e){return e.map(e=>({runId:e.run_id,owner:CX(e.launch)}))}function H2(e,t){return t instanceof ZN&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var U2={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function W2(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(U2);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===U2.hostShutdown?U2.hostShutdown:U2.dispatchStopped}]})}function G2(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}function K2(e){return(0,V.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.owner,(t.get(n.owner)??0)+1);return[...t].map(([e,t])=>({owner:e,count:t}))},[e])}var q2=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function J2({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,V.useId)(),[s,c]=(0,V.useState)(R2),[l,u]=(0,V.useState)(!1),d=z2(s),f=n!==void 0&&r===void 0,p=()=>{c(R2),u(!1),t(!1)};return(0,U.jsx)(_c,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,U.jsxs)(xc,{className:`shutdown-dialog`,children:[(0,U.jsxs)(Sc,{children:[(0,U.jsx)(wc,{children:`Shut down the entire host?`}),(0,U.jsx)(Tc,{children:q2})]}),(0,U.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,U.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,U.jsx)(X2,{caption:`It acts on all ${Y2(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,U.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,U.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,U.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,U.jsx)(`legend`,{children:`Grace`}),(0,U.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,U.jsx)(kc,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,U.jsx)(Ec,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,U.jsx)(kc,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,U.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;L2(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(I2).map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]}),(0,U.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${B2(d)}. The engine's default is ${B2(z2(R2)??0)}.`})]}),(0,U.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,U.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,U.jsx)(kc,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,U.jsxs)(Cc,{children:[(0,U.jsx)(yc,{asChild:!0,children:(0,U.jsx)(Fa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,U.jsx)(Fa,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var Y2=e=>e===1?`1 run`:`${e} runs`;function X2({caption:e,label:t,runs:n,warning:r=!1}){let i=K2(n);return(0,U.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,U.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,U.jsx)(`ul`,{"aria-label":t,children:i.map(({owner:e,count:t})=>(0,U.jsxs)(`li`,{children:[e,` — `,Y2(t)]},e))})]})}function Z2(e,t,n){let[r,i]=(0,V.useState)(),a=Q2(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:V2(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function Q2(e,t,n,r){let i=(0,V.useRef)(new Set),a=t?.next_cursor;return(0,V.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function $2(e,t){let[n,r]=(0,V.useState)({phase:`idle`}),i=(0,V.useRef)(!1);return{state:n,confirm:(0,V.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(H2(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,V.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var e4=[`host`];function t4(e){return{host:$2(`host`,(0,V.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function n4({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=Z2(e,t,n),u=r.host.state.phase===`sending`;return(0,U.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,U.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,U.jsxs)(Fa,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,U.jsx)(Xt,{size:14}),` Shut down the entire host`]})}),e4.map(e=>(0,U.jsx)(J2,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var r4=1e3;function i4(e,t){let[n,r]=(0,V.useState)(()=>Date.now());(0,V.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),r4);return()=>clearInterval(e)},[]);let i=W2(e,(0,V.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===U2.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function a4({label:e,state:t,rows:n,onDismiss:r}){return t.phase===`idle`?null:(0,U.jsxs)(`section`,{"aria-label":e,className:`shutdown-status`,children:[t.phase===`sending`?(0,U.jsx)(s4,{rows:n,sent:t.sent}):t.phase===`lost`?(0,U.jsxs)(ca,{"aria-label":`${e} lost`,variant:`destructive`,children:[(0,U.jsx)(sn,{}),(0,U.jsx)(la,{children:`Shutdown lost: no answer came back`}),(0,U.jsxs)(ua,{children:[(0,U.jsxs)(`p`,{children:[`The request sent at `,G2(t.sent.sentAt),` ended without an answer (`,t.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,U.jsx)(o4,{sent:t.sent})]})]}):t.phase===`refused`?(0,U.jsxs)(ca,{"aria-label":`${e} refused`,variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsxs)(la,{children:[`Shutdown refused · `,t.error.status,` `,t.error.code]}),(0,U.jsxs)(ua,{children:[(0,U.jsx)(`pre`,{className:`verb-text`,children:t.error.message}),(0,U.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,U.jsx)(l4,{label:e,report:t.report}),t.phase!==`sending`&&(0,U.jsx)(`div`,{className:`composer-actions`,children:(0,U.jsx)(Fa,{onClick:r,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function o4({sent:e}){return(0,U.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,G2(e.sentAt),` · scope `,e.scope,` · grace`,` `,B2(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function s4({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=i4(e,t);return(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,U.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,U.jsx)(zt,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,U.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,eI(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,U.jsx)(o4,{sent:e}),(0,U.jsx)(`p`,{children:o?n<a?`Waiting out the ${B2(e.grace)} grace until ${G2(a)} (${eI(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${G2(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,U.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,U.jsxs)(`li`,{children:[e,`:`,` `,t===U2.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function c4(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function l4({label:e,report:t}){return(0,U.jsxs)(ca,{"aria-label":`${e} report`,variant:t.complete?`default`:`destructive`,children:[t.complete?(0,U.jsx)(Et,{}):(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:t.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,U.jsxs)(ua,{className:`shutdown-report`,children:[!t.complete&&(0,U.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,U.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,t.scope,` · grace `,B2(t.grace_seconds),t.forced?` · forced`:``,` · runs root `,t.root]}),t.runs.length===0?(0,U.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):t.runs.map(e=>(0,U.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,U.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,U.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,U.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,U.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,eI(e.waited_ms),(0,U.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,U.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,U.jsx)(`p`,{children:`No branch this run's records name.`}):(0,U.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,U.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,c4(e),(0,U.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),t.not_pushed_unread===null?t.not_pushed.length===0?(0,U.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,t.not_pushed.length,`):`]}),(0,U.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:t.not_pushed.map(({identity:e,branch:t})=>(0,U.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,U.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,t.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{children:`The engine's own report`}),(0,U.jsx)(`pre`,{className:`verb-text`,children:t.rendered})]})]})]})}var u4={crosshair:!0,ticks:{minSpacingPx:80}},d4=2e3;function f4(e){let[t,n]=e;if(n-t>=2e3)return e;let r=(t+n)/2;return[r-d4/2,r+d4/2]}var p4=1e3;function m4({completedAt:e,startedAt:t}){let n=t===void 0?void 0:nI(t),r=e===void 0?void 0:nI(e),i=h4(n!==void 0&&r===void 0);return n===void 0?null:r===void 0?(0,U.jsxs)(U.Fragment,{children:[eI(i-n.getTime()),` · running`]}):(0,U.jsx)(U.Fragment,{children:eI(r.getTime()-n.getTime())})}function h4(e){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),p4);return()=>clearInterval(t)},[e]),t}function g4({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?Wt:Ht;return(0,U.jsxs)(Na,{"aria-label":`${t}: ${n}`,className:B(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,U.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function _4(e){return e.charAt(0).toUpperCase()+e.slice(1)}var v4=[[`recovery`,[`retry`,`retried`,`requeued`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`refused`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`publication`,[`pr`,`publication`,`published`,`release`,`merge`,`merged`,`change`,`drafting`,`landing`,`landed`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`branches`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],y4={"change-retitled":`publication`,"title-unverified":`verification`,"node-restack-started":`repository`,"node-restacked":`repository`,"review-comments-read":`publication`,"review-reply-posted":`publication`,"review-reply-not-drafted":`publication`,"node-absorbed":`publication`,"node-readjusted":`repository`,"completion-requested":`lifecycle`,"command-accepted":`planning`,"command-started":`session`,"command-exited":`session`,"body-not-drafted":`publication`,"criterion-checked":`verification`,"pool-maintenance":`lifecycle`,"dispatch-stopped":`lifecycle`,"host-shutdown":`lifecycle`,"scratch-removed":`lifecycle`,"scratch-retained":`lifecycle`,"home-status":`lifecycle`};function b4(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function x4(e){let t=y4[e];if(t!==void 0)return t;let n=b4(e);return v4.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var S4={recovery:Qt,failure:on,human:cn,planning:kt,contention:Ft,verification:nn,publication:Pt,repository:Nt,session:Gt,lifecycle:Kt,activity:Ot};function C4({category:e,className:t=`size-3`}){let n=S4[e];return(0,U.jsx)(n,{"aria-hidden":`true`,className:t})}function w4(e){return e===`human-step`?`human step`:e}function T4(e){return e.style===`human-step`}function E4(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function D4(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function O4(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function k4(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function A4({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:w4(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,D4(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,O4(e.delivery)]].filter(([,e])=>e!==void 0);return(0,U.jsxs)(U.Fragment,{children:[t.length>0&&(0,U.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,U.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,U.jsxs)(`li`,{children:[T4(e)?(0,U.jsxs)(ca,{children:[(0,U.jsx)(cn,{}),(0,U.jsxs)(la,{children:[`Waiting on a person · `,k4(e)]}),(0,U.jsx)(ua,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,U.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,k4(e)]}),(0,U.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:E4(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,U.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function j4({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,U.jsx)(U.Fragment,{children:`Not recorded`});let n=t.identity!==e.task.repo;return(0,U.jsx)(U.Fragment,{children:[t.target,t.style===void 0?void 0:w4(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function M4({artifactId:e,client:t,runId:n}){let r=RI(`${n}/${e}`,()=>t.getArtifact(n,e),0),i=r.value?.turns??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Oneharness conversation`}),r.loading?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`Loading conversation…`}):r.value===void 0?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`The history store holds no readable copy of that conversation.`}):r.value.unavailable===void 0?(0,U.jsx)(Ia,{className:`gap-0 py-3`,children:(0,U.jsx)(La,{className:`px-3`,children:i.map(e=>(0,U.jsx)(Cw,{turn:e},e.id))})}):(0,U.jsxs)(ca,{variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Transcript unavailable`}),(0,U.jsx)(ua,{children:r.value.unavailable})]})]})}function N4({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=P4(e),c=RI(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),l=c.value?.content;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,U.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,U.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l===void 0?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,U.jsxs)(U.Fragment,{children:[c.value?.truncated===!0&&(0,U.jsxs)(`p`,{className:`detail-note`,children:[`The server keeps the end of a `,i,` this long; its beginning is not shown.`]}),(0,U.jsx)(`section`,{"aria-label":n,children:(0,U.jsx)(`pre`,{children:l})})]})]})}function P4(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function F4(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:eI(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`&&e.status===`running`,...e.status?{status:e.status}:{}}}function I4({row:e}){let t=F4(e);return(0,U.jsxs)(`header`,{className:`detail-title`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(Na,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,U.jsx)(`h2`,{children:t.label}),(0,U.jsxs)(`p`,{className:`detail-when`,children:[(0,U.jsx)(sI,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,U.jsx)(Na,{variant:`secondary`,children:t.status})]})}function L4(e){let t=F4(e);return[t.kind,t.label,rI(t.startedAt),_4(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function R4({row:e}){return(0,U.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":L4(e),children:(0,U.jsx)(C4,{category:e.category})})}var z4=`data-timeline-reading`;function B4(e){let t=e.closest(`[${z4}]`)??e.closest(`button`)?.querySelector(`[${z4}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(z4)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var V4={rows:[],total:0},H4={queued:`Queued`,dispatch:`Dispatch`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},U4=`idle`,W4=new Set([...Object.keys(H4),U4]),G4=`member:`;function K4(e){return W4.has(e)?`${G4}${e}`:e}var q4=Object.entries(H4).map(([e,t])=>({id:e,label:t}));function J4(e){let t=e?.spans??[],n=[];for(let e of t){let t=e.agent_role??e.harness_scope;t!==void 0&&!n.includes(t)&&n.push(t)}let r=t.some(e=>_3(e)===`dispatch`),[i,...a]=q4;return[...i===void 0?[]:[i],...n.map(e=>({id:K4(e),label:e})),...a.filter(({id:e})=>r||e!==`dispatch`)]}var Y4={run:null,node:null,step:null,dispatch:`dispatch`,verification:`verification`,publication:`publication`,"pr-drafting":`dispatch`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`};function X4(e){return e===`agent`}function Z4(e,t){return e===void 0?t===void 0?H4.dispatch:Q4(t):F3(t)&&t!==e?`${e} · ${t}`:e}function Q4(e){return e===`llmlint`?`Lint`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}var $4={"lock-wait":`Lock waits`};function e3(e,t=q4){let n=[...e].sort((e,t)=>e.start-t.start),r=n.at(0)?.start??0,i=Math.max(r+1,...n.map(e=>e.end??e.start)),a=new Set([n.at(0),n.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),o=(i-r)*.02,s=[];for(let e of n){let n=Math.max(e.end??e.start,e.start+o),r=s.findLast(t=>{let r=Math.max(t.end??t.start,t.start+o);return e.start<=r&&t.start<=n});r===void 0||a.has(e.id)?s.push(e):n3(e,t)<n3(r,t)?a.has(r.id)?s.push(e):s[s.indexOf(r)]=e:t3(e,r,o)||s.push(e)}return s.sort((e,n)=>n3(n,t)-n3(e,t)||(e.end??e.start)-e.start-((n.end??n.start)-n.start))}function t3(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function n3(e,t){let n=e.laneId??``,r=t.findIndex(({id:e})=>e===n);return r<0?t.length:r}function r3(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function i3(e,t){let n=l3(e,t).rows,r=s3(n),i=s3(n,!1).flatMap(e=>{let t=c3(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),a=r.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,V.createElement)(R4,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:J4(e),rows:r,tree:n}}function a3(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function o3(e,t){return`${e} more ${t} events`}function s3(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function c3(e){return e.rowKind===`event`?null:e.role===void 0?Y4[e.rowKind===`span`?e.span.kind:e.kind]??null:K4(e.role)}function l3(e,t){if(e===void 0)return V4;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=L3(e.spans,new Set,t);return n.length===0?V4:{rows:D3(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=[...o===void 0?[]:m3(o,i),...a.filter(e=>e!==o).map(e=>h3(e,i)),...L3(e.spans,r,t)].sort(z3),c=n.some(e=>e.dispatch_group!==void 0||e.events.some(e=>e.dispatch_group!==void 0))?P3(s):D3(N3(M3(s)));return{span:o,rows:c,total:R3(c)}}function u3(e){return h3(e,new Map)}function d3(e){return E3(e)}function f3(e,t){return p3(e,t).at(-1)}function p3(e,t){let n=(e,r)=>{for(let i of e){if(r?i.rowKind===`event`&&i.event.id===t:i.id===t)return[i];let e=n(i.children,r);if(e.length>0)return[i,...e]}return[]},r=n(e,!1);return r.length>0?r:n(e,!0)}function m3(e,t){return[...(t.get(e.id)??[]).map(e=>h3(e,t)),...e.events.map(E3)].sort(z3)}function h3(e,t){let n=g3(e),r=e.kind===`dispatch`?e.transport_role:void 0;return{rowKind:`span`,span:e,id:e.id,kind:e.kind,...n===void 0?{}:{role:n},...r===void 0?{}:{transport:r},label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??B3(e.started_at,e.ended_at),children:D3(m3(e,t)),displayLabel:j3(e,n,r),displayKind:O3(e,n,r),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function g3(e){return e.kind===`dispatch`?e.agent_role??e.harness_scope:void 0}function _3(e){return e.agent_role===void 0?e.harness_scope===void 0?Y4[e.kind===`rollup`?e.label:e.kind]??null:K4(e.harness_scope):K4(e.agent_role)}function v3(e,t=[]){let n=t.find(({id:t})=>t===e);return n===void 0?H4[e]??(e.startsWith(G4)?e.slice(7):e):n.label}function y3(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var b3=`Redirection`;function x3(e){if(e.surface===void 0)return;let t=[e.surface.kind,e.surface.message].filter(e=>e!==void 0);return t.length===0?void 0:t.join(`: `)}var S3=`Surface`,C3=`Blocking surface`;function w3(e){return e.kind.startsWith(`edit-`)?e.author:void 0}function T3(e,t){let n=w3(t);return n===void 0?e:`${e} · by ${n}`}function E3(e){let t=y3(e),n=x3(e),r=t===void 0?e.surface===void 0?`Event`:e.surface.blocking===!0?C3:S3:b3;return{rowKind:`event`,event:e,id:e.record_id??e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:T3(t??n??(e.kind===`turn-activity`&&e.description!==void 0&&e.description!==``?e.description:void 0)??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),e),displayKind:r,category:x4(e.kind)}}function D3(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&I3(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:B3(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind,...r.role===void 0?{}:{role:r.role},...r.transport===void 0?{}:{transport:r.transport},...r.dispatch!==void 0&&a.every(e=>e.dispatch?.id===r.dispatch?.id)?{dispatch:r.dispatch}:{}}),n=i}return t}function O3(e,t,n){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return $4[e.label]??e.label;if(e.kind===`dispatch`)return Z4(t,n);let r=Y4[e.kind];return r===null?e.kind:v3(r)}function k3(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function A3(e){return e.map(k3).join(` and `)}function j3(e,t,n){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${A3(e.reasons??[])}`.trim();let r=O3(e,t,n);return e.kind===`rollup`?`${r}: ${e.count??0} recorded`:!e.label||e.label===r?r:e.kind===`dispatch`?`${r} (${e.label})`:`${r}: ${e.label}`}function M3(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=M3(e.children);return!X4(e.transport)||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function N3(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(X4(a.transport)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(F3(a.transport)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function P3(e){let t=new Map,n=[];for(let r of s3(e).filter(e=>e.rowKind!==`group`)){let e=r.rowKind===`event`?r.event.dispatch_group:r.span.dispatch_group,i={...r,children:[]};if(e===void 0){n.push(i);continue}let a=t.get(e.id)??{metadata:e,members:[]};a.members.push({...i,dispatch:{id:e.id,label:e.label}}),t.set(e.id,a)}let r=e=>[...D3(e.filter(e=>e.rowKind===`span`&&e.kind===`dispatch`).sort(z3)),...D3(e.filter(e=>e.rowKind!==`span`||e.kind!==`dispatch`).sort(z3))];return[...n.map(e=>({at:e.startedAt,order:e.rowKind===`event`?(e.event.journal_order??0)*3:0,rows:[e]})),...[...t.values()].map(({metadata:e,members:t})=>({at:e.started_at,order:e.order,rows:r(t)}))].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)||e.order-t.order).flatMap(({rows:e})=>e)}function F3(e){return e===`judge`||e===`llmlint`}function I3(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind&&e.role===t.role&&e.transport===t.transport}function L3(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(E3)}function R3(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+R3(t.children),0)}function z3(e,t){let n=Date.parse(e.startedAt)-Date.parse(t.startedAt);return n===0?e.rowKind===`event`&&t.rowKind===`event`?(e.event.journal_order??0)-(t.event.journal_order??0):0:n}function B3(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function V3(e,t,n,r){let[i,a]=(0,V.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,V.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,V.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var H3=32;function U3(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function W3(e,t){let n=(0,V.useRef)(null),r=(0,V.useRef)(!0),i=(0,V.useRef)({key:e,count:t}),a=(0,V.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=H3)},[]),o=(0,V.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=U3(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,V.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var G3=25;function K3({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:p6(r),a=i?.kind===`conversation`?i.value:void 0,o=V3(e,t,a,r===void 0?void 0:c6(r));return(0,U.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,U.jsx)(cf,{className:`h-full`,children:(0,U.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:W3(a,l6(r,o)),children:r===void 0?(0,U.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,U.jsx)(Rt,{size:30}),(0,U.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I4,{row:r}),(0,U.jsx)(xf,{className:`my-4`}),(0,U.jsx)(q3,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function q3({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=u6(n);if(o!==void 0)return(0,U.jsx)(r6,{redirection:o,row:n});let s=d6(n);if(s!==void 0)return(0,U.jsx)(A4,{release:s});let c=f6(n);return c===void 0?i?.kind===`conversation`?(0,U.jsxs)(U.Fragment,{children:[n.rowKind===`event`&&(0,U.jsx)(o6,{row:n,reference:i}),(0,U.jsx)(Q3,{row:n,transcript:a})]}):h6(n)?(0,U.jsx)($3,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&P4(i.value)!==void 0?(0,U.jsx)(e6,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&P4(i.value)!==void 0?(0,U.jsx)(t6,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):g6(n,i)&&r!==void 0?(0,U.jsx)(n6,{node:r,reference:i}):(0,U.jsx)(o6,{reference:i,row:n}):(0,U.jsx)(a6,{row:n,surface:c})}function J3({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,U.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function Y3(e){return e.tool?.turn??e.id}function X3(e,t){if(e.rowKind!==`event`||e.event.tool===void 0)return;let n=Y3(e.event),r=t.find(({id:e})=>e===n);if(r===void 0)return;let{index:i,tool_call_id:a}=e.event.tool;return a!==void 0&&r.tools.some(e=>e.toolCallId===a)?{turnId:r.id,toolCallId:a}:{turnId:r.id,eventIndex:i}}function Z3({turn:e}){let t=[e.unknown.instruction_truncated===!0?`its prompt`:void 0,e.unknown.truncated===!0?`its reply`:void 0,e.tools.some(e=>e.output_truncated===!0)?`a tool's output`:void 0,e.tools.some(e=>e.input_truncated===!0)?`a tool's input`:void 0].filter(e=>e!==void 0);return t.length===0?null:(0,U.jsxs)(ca,{className:`mb-3`,role:`note`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Cut by the recorder`}),(0,U.jsxs)(ua,{children:[`The run's recorder cut `,t.join(`, `),` to its bound, and no whole copy exists: neither the member's report nor a history file this run names holds it.`]})]})}function Q3({row:e,transcript:t}){let[n,r]=(0,V.useState)(G3),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?Y3(e.event):void 0,o=a===void 0?i:i.filter(({id:e})=>e===a),s=Om(o.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,U.jsx)(Sf,{className:`h-2 w-40`}),(0,U.jsx)(Sf,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,U.jsxs)(ca,{variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Transcript unavailable`}),(0,U.jsx)(ua,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:c,attribution:l}=t.conversation,u=_6(l.agentRole,l.transportRole),d=X3(e,o);return(0,U.jsx)(Ia,{className:`gap-0 py-3`,children:(0,U.jsxs)(La,{className:`px-3`,children:[(0,U.jsxs)(`header`,{className:`transcript-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,u,l.persona?` · ${l.persona}`:``]}),(0,U.jsx)(`h4`,{children:c.name})]}),(0,U.jsx)(_m,{state:c.state})]}),(0,U.jsx)(xf,{className:`my-2.5`}),(0,U.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,U.jsx)(Dm,{cursor:s.cursor,...d===void 0?{}:{focus:d},onSelectTurn:s.scrollTo,turns:[...o]})}),o.length===0?(0,U.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:s.containerRef,children:o.slice(0,n).map(e=>(0,U.jsxs)(`div`,{ref:t=>s.register(e.id,t),children:[(0,U.jsx)(Z3,{turn:e}),(0,U.jsx)(Cw,{author:{label:u},...d?.turnId===e.id?{focus:d}:{},turn:e}),(0,U.jsx)(J3,{turn:e})]},e.id))}),o.length>n&&(0,U.jsxs)(Fa,{onClick:()=>r(n+G3),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,o.length,` turns`]})]})]})})}function $3({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,U.jsx)(`dl`,{className:`facts`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Result`}),(0,U.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,U.jsx)(`pre`,{children:i.output_tail})]}),(0,U.jsx)(N4,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,U.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function e6({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(N4,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,U.jsx)(o6,{reference:n,row:r})]})}function t6({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(M4,{artifactId:e,client:t,runId:i}),(0,U.jsx)(o6,{reference:n,row:r})]})}function n6({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,U.jsx)(s6,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,U.jsx)(Mt,{size:13})]})}):r?.branch_url?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,U.jsx)(Mt,{size:13})]})}):!r?.pr_url&&(0,U.jsx)(s6,{fallback:`No publication was recorded.`,reference:t}),(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,U.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,U.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e.name}),(0,U.jsx)(`dd`,{children:e.url?(0,U.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function r6({redirection:e,row:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Delivery`}),(0,U.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Turn`}),(0,U.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Redirected at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Member`}),(0,U.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Note`}),(0,U.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,U.jsx)(i6,{row:t})]}),e.reason!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,U.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function i6({row:e}){let t=e.rowKind===`event`?w3(e.event):void 0;return t===void 0?null:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Author`}),(0,U.jsx)(`dd`,{children:t})]})}function a6({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,U.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function o6({row:e,reference:t}){if(e.rowKind===`event`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:e.startedAt,relative:!0})})]}),Object.entries(e.event.fields??{}).map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:typeof t==`string`?t:JSON.stringify(t)})]},e))]}),t!==void 0&&(0,U.jsx)(s6,{reference:t,fallback:`No recorded artifact.`})]});let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Recorded at`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(sI,{at:e.startedAt,relative:!0})})]}),e.rowKind===`span`&&(e.endedAt!==null||e.status===`running`)&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Ended`}),(0,U.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,U.jsx)(sI,{at:e.endedAt,relative:!0})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Status`}),(0,U.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Duration`}),(0,U.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:eI(e.durationMs)})]}),r!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Aggregated`}),(0,U.jsx)(`dd`,{children:r})]}),i.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Waiting on`}),(0,U.jsx)(`dd`,{children:i.map(k3).join(` and `)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Step`}),(0,U.jsx)(`dd`,{children:m6(n)??`None`})]}),(0,U.jsx)(i6,{row:e})]}),(0,U.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,U.jsx)(s6,{fallback:e.rowKind===`span`&&e.span.kind===`dispatch`?`No transcript was recorded for this dispatch.`:`This item points at no recorded artifact.`,reference:t})]})}function s6({reference:e,fallback:t}){return e===void 0?(0,U.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,U.jsx)(`p`,{className:`detail-link`,children:(0,U.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,U.jsx)(Mt,{size:13})]})}):(0,U.jsxs)(`p`,{className:`detail-note`,children:[(0,U.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,U.jsx)(`code`,{children:e.value})]})}function c6(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function l6(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function u6(e){return e.rowKind===`event`?e.event.redirection:void 0}function d6(e){return e.rowKind===`event`?e.event.release:void 0}function f6(e){return e.rowKind===`event`?e.event.surface:void 0}function p6(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function m6(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function h6(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function g6(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function _6(e,t){return Z4(e,t)}function v6({client:e,runId:t,node:n,nodes:r,timeline:i,timelineError:a,selectedItemId:o,onSelectItem:s,onBack:c,selectedTab:l,onSelectTab:u}){let d=(0,V.useMemo)(()=>l3(i,n.id),[i,n.id]);(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(o===void 0?c():s())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,s,o]);let f=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,U.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,U.jsxs)(`header`,{className:`node-view-head`,children:[(0,U.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,U.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,U.jsx)(`li`,{children:(0,U.jsxs)(Fa,{onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:[(0,U.jsx)(yt,{size:14}),` Graph`]})}),(0,U.jsx)(`li`,{"aria-current":`page`,children:(0,U.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,U.jsxs)(`div`,{className:`node-view-facts`,children:[(0,U.jsx)(K0,{className:`node-view-state`,state:n.status}),(0,U.jsx)(g4,{control:n.control}),(0,U.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),f!==void 0&&(0,U.jsxs)(`a`,{className:`node-view-pr`,href:f,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,U.jsx)(Mt,{size:12})]})]})]}),(0,U.jsx)(O6,{node:n,nodes:r}),(0,U.jsx)(D6,{node:n}),(0,U.jsxs)(xp,{className:`node-tabs`,onValueChange:e=>{h2(e)&&u(e)},value:l,children:[(0,U.jsx)(Cp,{"aria-label":`Node details`,variant:`line`,children:Object.entries(m2).map(([e,t])=>(0,U.jsx)(wp,{value:e,children:t},e))}),(0,U.jsxs)(Tp,{className:`node-tab-panel`,value:`task`,children:[(0,U.jsx)(y1,{source:w6(n.task)}),(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Settled as`}),(0,U.jsx)(`dd`,{children:k6(n.result?.outcome)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Outcome`}),(0,U.jsx)(`dd`,{children:k6(n.result?.detail)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Graph overrides`}),(0,U.jsx)(`dd`,{children:(n.task.sets??[]).length===0?`None`:(0,U.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:n.task.sets?.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{children:e})},t))})})]})]})]}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`criteria`,children:(0,U.jsx)(y1,{source:T6(n.task)})}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`dependencies`,children:(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Dependencies`}),(0,U.jsx)(`dd`,{children:(n.task.deps??[]).map(e=>{let t=r.find(t=>t.id===e)?.status;return t===void 0?e:`${e} (${t})`}).join(`, `)||`None`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Unblocks`}),(0,U.jsx)(`dd`,{children:n.dependents.join(`, `)||`None`})]})]})}),(0,U.jsx)(Tp,{className:`node-tab-panel`,value:`remote`,children:(0,U.jsxs)(`dl`,{className:`facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Publication`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(E6,{node:n})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Branch`}),(0,U.jsx)(`dd`,{children:n.detail?.publication?.branch??`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Merge`}),(0,U.jsx)(`dd`,{children:n.detail?.publication?n.detail.publication.merged?`Merged`:`Not merged`:`Not recorded`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Release`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(j4,{node:n})})]}),(0,U.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,U.jsx)(`dt`,{children:`Verification coverage`}),(0,U.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,U.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,U.jsx)(`dt`,{children:`Observed checks`}),(0,U.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:(0,U.jsxs)(`table`,{"aria-label":`Remote checks`,className:`remote-checks`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:`Name`}),(0,U.jsx)(`th`,{children:`Status`}),(0,U.jsx)(`th`,{children:`Conclusion`}),(0,U.jsx)(`th`,{children:`Runtime`}),(0,U.jsx)(`th`,{children:`Required`})]})}),(0,U.jsx)(`tbody`,{children:n.detail?.verification.checks?.map(e=>(0,U.jsxs)(`tr`,{className:e.status===`completed`&&![`success`,`neutral`,`skipped`].includes(e.conclusion??``)?`check-failing`:void 0,children:[(0,U.jsx)(`th`,{scope:`row`,children:e.url?(0,U.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.name}):e.name}),(0,U.jsx)(`td`,{children:e.status??`Not recorded`}),(0,U.jsx)(`td`,{children:e.conclusion??`—`}),(0,U.jsx)(`td`,{children:(0,U.jsx)(m4,{...e.started_at===void 0?{}:{startedAt:e.started_at},...e.completed_at===void 0?{}:{completedAt:e.completed_at}})}),(0,U.jsxs)(`td`,{title:e.requirement,className:e.required?`check-required`:`check-optional`,children:[(0,U.jsx)(`svg`,{role:`img`,"aria-label":e.required?`required`:`not required`,width:`12`,height:`12`,viewBox:`0 0 12 12`,children:e.required?(0,U.jsx)(`path`,{d:`M6 0.5 L11 2.5 V6 C11 9 8.5 11 6 11.5 C3.5 11 1 9 1 6 V2.5 Z`,fill:`currentColor`}):(0,U.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`2 1.5`})}),e.required?`Required`:`Optional`]})]},e.name))})]})})]})]})}),(0,U.jsx)(Tp,{className:`node-timeline-panel`,value:`timeline`,children:a===void 0?i===void 0?(0,U.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):d.rows.length===0?(0,U.jsxs)(Ia,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,U.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,U.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,U.jsx)(y6,{client:e,node:n,onSelectItem:s,runId:t,selectedItemId:o,timeline:i}):(0,U.jsxs)(ca,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Timeline unavailable`}),(0,U.jsx)(ua,{children:a.message})]})})]})]})}function y6({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,V.useMemo)(()=>i3(a,t.id),[a,t.id]),[s,c]=(0,V.useState)(()=>new Set),l=(0,V.useMemo)(()=>{if(i!==void 0)return p3(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,V.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,V.useMemo)(()=>a3(o.tree,u),[o.tree,u]),f=Om((0,V.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(),_=(0,V.useMemo)(()=>e3(o.items,o.lanes),[o.items,o.lanes]),v=(0,V.useMemo)(()=>r3(o.markers,o.items,i),[o.items,o.markers,i]),y=(0,V.useMemo)(()=>b6([...o.items,...o.markers.map(({at:e})=>({start:e}))]),[o.items,o.markers]),b=(0,V.useMemo)(()=>b6([...p?o.items:_,...v.map(({at:e})=>({start:e}))]),[p,o.items,_,v]),x=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,y[0]),y[1]),S=i===void 0?void 0:f3(o.rows,i),C=e=>{n(e),f.scrollTo(e)},{scrollTo:w}=f;return(0,V.useEffect)(()=>{i!==void 0&&w(i)},[i,w]),(0,U.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,U.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,U.jsx)(wn,{...u4,axis:{origin:y[0]},cursor:x,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:_,lanes:o.lanes,markers:v,onExpandedChange:m,onRangeChange:e=>g(e[0]<=b[0]&&e[1]>=b[1]?void 0:f4(e)),onSelect:e=>C(e.id),range:h??b,selectedId:i})}),(0,U.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:x6(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,U.jsx)(C6,{onOpen:C,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,U.jsx)(S6,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.id}`));return e.dispatch===void 0?(0,U.jsx)(V.Fragment,{children:t},e.id):(0,U.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,U.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),S!==void 0&&(0,U.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,U.jsx)(Fa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,U.jsx)(dn,{})}),(0,U.jsx)(K3,{client:e,node:t,row:S,runId:r})]})]})}function b6(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function x6(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function S6({entry:e,onToggle:t}){let n=o3(e.hidden,e.group.kind);return(0,U.jsx)(`p`,{className:`transcript-collapsed`,children:(0,U.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function C6({row:e,selected:t,register:n,onOpen:r}){return(0,U.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-journal-seq":e.rowKind===`event`?e.event.seq:void 0,"data-selected":t,ref:t=>n(e.id,t),children:(0,U.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,U.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,U.jsx)(C4,{category:e.category}),e.displayKind]}),(0,U.jsx)(`strong`,{children:e.displayLabel}),(0,U.jsxs)(`span`,{className:`transcript-facts`,children:[(0,U.jsx)(sI,{at:e.startedAt}),e.durationMs!==null&&` · ${eI(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function w6(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
|
|
113
113
|
|
|
114
114
|
`)}function T6(e){let t=w6(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function E6({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,U.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,U.jsx)(Mt,{size:12})]}):(0,U.jsx)(U.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,U.jsx)(U.Fragment,{children:`Not recorded`}):(0,U.jsx)(U.Fragment,{children:n.map(([e,t],n)=>(0,U.jsxs)(`span`,{children:[n>0&&` · `,(0,U.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,U.jsx)(Mt,{size:12})]})]},e))})}function D6({node:e}){let t=EX(e);if(t.length===0)return null;let n=e.result?.detail?.trim()||void 0;return(0,U.jsxs)(`section`,{"aria-label":`Awaited releases`,className:`node-awaiting m-5 rounded-lg border border-warning bg-warning-surface px-4 py-3 text-warning`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,U.jsx)(qt,{size:16}),e.status===`complete-but-held`?`Complete, and held unlanded until its releases arrive`:`Complete, and held as a draft until its releases arrive`]}),(0,U.jsxs)(`dl`,{className:`facts facts-stacked`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:t.length===1?`Awaits`:`Awaits ${t.length}`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(`ul`,{className:`awaited-releases`,children:t.map(e=>(0,U.jsxs)(`li`,{children:[`the `,(0,U.jsx)(`strong`,{children:e.target}),` release of`,` `,(0,U.jsx)(`code`,{children:e.producer})]},`${e.producer} ${e.target}`))})})]}),n!==void 0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Detail`}),(0,U.jsx)(`dd`,{children:n})]})]})]})}function O6({node:e,nodes:t}){if(!NX(e.status))return null;let n=e.status===`blocked`||e.status===`skipped`,r=OX(e),i=e.result?.error||void 0,a=e.result?.exit_code;return(0,U.jsxs)(ca,{className:B(`m-5 w-auto`,n&&`border-warning bg-warning-surface text-warning`),variant:n?`default`:`destructive`,children:[n?(0,U.jsx)(qt,{}):(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:n?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,U.jsx)(ua,{children:(0,U.jsxs)(`dl`,{className:`facts`,children:[n&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,U.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.map(e=>{let n=t.find(t=>t.id===e)?.status;return n===void 0?e:`${e} (${n})`}).join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),e.status===`skipped`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Attempts`}),(0,U.jsx)(`dd`,{children:`Never attempted`})]}),!n&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Detail`}),(0,U.jsx)(`dd`,{children:r??`No reason was recorded for this outcome.`})]}),i!==void 0&&i!==r&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Error`}),(0,U.jsx)(`dd`,{children:i})]}),typeof a==`number`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`Exit code`}),(0,U.jsx)(`dd`,{children:a})]})]})})]})}function k6(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}function A6(e){let[t,n]=(0,V.useState)(!1);return{open:t,onToggle:(0,V.useCallback)(t=>{let r=t.currentTarget.open;n(r),r&&e?.()},[e])}}function j6({label:e,className:t,onOpen:n,children:r}){let i=A6(n);return(0,U.jsxs)(`details`,{"aria-label":e,className:t,open:i.open,onToggle:i.onToggle,children:[(0,U.jsx)(`summary`,{children:e}),i.open&&r]})}var M6=`idle-`,N6=`row:run`,P6=e=>`row:node:${e}`,F6={id:U4,label:`Idle`};function I6(e){return[...J4(e),F6]}var L6=.005;function R6(e,t){let n=e?.spans??[],r=z6(e),i=I6(e),a=[B6({id:N6,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0),lanes:i}),...t.map(e=>B6({id:P6(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id),lanes:i}))],o=a.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`)),s=o.filter(e=>e.payload.countsAsWork!==!1);return{range:r,live:n.some(e=>e.ended_at===null),rows:a,line:{items:[...W6(r,s,void 0),...e3(o,i)],markers:[...r3(a.flatMap(e=>e.markers.filter(e=>e.at<=r[1])),s),...a.flatMap(e=>e.markers.filter(e=>e.at>r[1]))],lanes:i}}}function z6(e){let t=e?.spans??[],n=t.map(e=>Date.parse(e.started_at));if(n.length===0)return[0,1];let r=Math.min(...n),i=t.find(e=>e.kind===`run`);if(i?.ended_at!==void 0&&i.ended_at!==null){let e=Date.parse(i.ended_at);return[r,e>r?e:r+1]}let a=Math.max(...t.map(e=>e.ended_at===null?Date.parse(e.started_at):Date.parse(e.ended_at))),o=Date.parse(e?.observed_at??``),s=t.some(e=>e.ended_at===null)&&Number.isFinite(o)?Math.max(a,o):a;return[r,s>r?s:r+1]}function B6({id:e,kind:t,label:n,nodeId:r,range:i,spans:a,lanes:o}){let s=a.flatMap(t=>{let a=_3(t);if(a===null)return[];let s=Math.max(Date.parse(t.started_at),i[0]);if(s>i[1])return[];let c=Math.min(V6(t,a,s,i),i[1]),l=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${v3(a,o)}${H6(t)}`,laneId:a,start:s,end:c,duration:c-s,status:t.status,payload:{id:t.id,kind:`work`,...t.harness_scope===void 0?{}:{countsAsWork:!1},label:`${n} · ${v3(a,o)}`,rowId:e,...r===void 0?{}:{nodeId:r},...l===void 0?{}:{conversationId:l},startedAt:t.started_at,endedAt:t.ended_at,durationMs:c-s}}]}),c=new Set(a.filter(e=>e.harness_scope!==void 0).map(e=>e.id)),l=s.filter(e=>!c.has(e.id)),u=W6(i,l,{rowId:e,nodeId:r}),d=U6(l).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:o.filter(({id:e})=>[...s,...u].some(t=>t.laneId===e)),items:[...u,...s],line:[...u,...e3(s,o)],markers:a.flatMap(t=>t.events.map(t=>({id:t.record_id??t.id,label:`${n} · ${t.step_id??t.kind}`,at:Date.parse(t.at),status:t.status,payload:{id:t.record_id??t.id,kind:`record`,label:t.kind,rowId:e,...r===void 0?{}:{nodeId:r},startedAt:t.at,endedAt:null,durationMs:0}}))),workedMs:d,idleMs:u.reduce((e,t)=>e+t.payload.durationMs,0)}}function V6(e,t,n,r){return t===`lock-waits`&&e.total_duration_ms!==void 0?n+e.total_duration_ms:e.ended_at===null?r[1]:Date.parse(e.ended_at)}function H6(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function U6(e){let t=e.map(e=>[e.start,Math.max(e.end??e.start,e.start)]).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t)).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function W6(e,t,n){let r=U6(t),i=[],a=e[0];for(let[e,t]of r)e>a&&i.push([a,e]),a=Math.max(a,t);a<e[1]&&i.push([a,e[1]]);let o=Math.max(1,e[1]-e[0]);return i.filter(([e,t],n)=>n===0||n===i.length-1||(t-e)/o>=L6).map(([e,t],r)=>{let i=`${M6}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${eI(t-e)}`,...n===void 0?{}:{rowId:n.rowId},...n?.nodeId===void 0?{}:{nodeId:n.nodeId},startedAt:new Date(e).toISOString(),endedAt:new Date(t).toISOString(),durationMs:t-e};return{id:i,label:a.label,laneId:U4,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function G6({client:e,detail:t,nodes:n,timeline:r,timelineError:i,journalSeq:a,onSelectNode:o,selectedItemId:s,onSelectItem:c}){let l=t.run.run_id,u=(0,V.useMemo)(()=>R6(r,n),[r,n]),d=(r?.spans??[]).filter(e=>e.node_id===void 0),f=d.find(e=>e.id===s),p=d.flatMap(e=>e.events).find(e=>(e.record_id??e.id)===s)??d.flatMap(e=>e.events).find(e=>e.id===s),m=f===void 0?p===void 0?void 0:d3(p):u3(f);return(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&s!==void 0&&c()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,s]),(0,U.jsxs)(`div`,{className:`overall-view`,"data-journal-seq":a,children:[(0,U.jsx)(cf,{className:`h-full`,children:(0,U.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,U.jsxs)(`section`,{className:`overall-hero`,children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,U.jsx)(`h2`,{children:l}),t.graph?.plan.goal?.text&&(0,U.jsx)(`p`,{className:`run-goal`,children:t.graph.plan.goal.text}),(0,U.jsxs)(`p`,{children:[t.run.phase,` ·`,` `,t.run.last_event?`last event ${t.run.last_event}`:`no events recorded yet`]})]}),(0,U.jsxs)(`section`,{"aria-label":`Run records`,children:[(0,U.jsx)(j6,{label:`Timing and usage`,children:(0,U.jsx)(UX,{value:t.telemetry})}),(0,U.jsx)(j6,{label:`Goal and repository identities`,children:(0,U.jsx)(UX,{value:{goal:t.graph?.plan.goal,repositories:[...new Set(t.graph?.plan.tasks.flatMap(e=>e.repo?[e.repo]:[])??[])]}})}),(0,U.jsx)(j6,{label:`Recorded results`,children:(0,U.jsx)(UX,{value:t.graph?.result})}),(0,U.jsx)(j6,{label:`Provider health`,children:(0,U.jsx)(UX,{value:t.provider_health})})]}),(0,U.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,U.jsx)(J6,{icon:(0,U.jsx)(_t,{}),label:`Status`,value:t.run.state}),(0,U.jsx)(J6,{icon:(0,U.jsx)(Lt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,U.jsx)(J6,{icon:(0,U.jsx)(At,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:tI(t.run.timing.wall_seconds)}),(0,U.jsx)(J6,{icon:(0,U.jsx)(jt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,U.jsx)(Ia,{className:`gap-0 py-[15px]`,children:(0,U.jsxs)(La,{className:`px-[15px]`,children:[(0,U.jsxs)(`div`,{className:`section-heading`,children:[(0,U.jsx)(_t,{size:16}),(0,U.jsx)(`h3`,{children:`Graph timeline`})]}),i===void 0?r===void 0?(0,U.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):r.spans.length===0?(0,U.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,U.jsx)(K6,{graph:u,onOpenNode:o,onOpenItem:c,selectedItemId:s}):(0,U.jsxs)(ca,{variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Timeline unavailable`}),(0,U.jsx)(ua,{children:i.message})]})]})})]})}),m!==void 0&&(0,U.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,U.jsx)(Fa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>c(),size:`icon`,variant:`ghost`,children:(0,U.jsx)(dn,{})}),(0,U.jsx)(K3,{client:e,row:m,runId:l})]})]})}function K6({graph:e,onOpenNode:t,onOpenItem:n,selectedItemId:r}){let[i,a]=(0,V.useState)(),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(new Set),u=i??e.range,d=e=>{e.kind===`record`&&e.nodeId===void 0||e.nodeId===void 0?n(e.id):t(e.nodeId)},f=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,U.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":o,children:[(0,U.jsx)(wn,{...u4,axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:f,markers:e.line.markers,onExpandedChange:s,onRangeChange:e=>a(f4(e)),onSelect:e=>d(e.payload),range:u,selectedId:r}),e.line.markers.some(t=>t.at>e.range[1])&&(0,U.jsxs)(`section`,{"aria-label":`Records after execution`,className:`p-3 border-t`,children:[(0,U.jsx)(`h3`,{className:`eyebrow`,children:`After execution ended`}),e.line.markers.filter(t=>t.at>e.range[1]).map(e=>(0,U.jsxs)(Fa,{onClick:()=>d(e.payload),variant:`outline`,size:`sm`,children:[e.payload.label,` ·`,` `,(0,U.jsx)(sI,{at:e.payload.startedAt})]},e.id))]}),o&&(0,U.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(n=>(0,U.jsx)(q6,{onOpen:d,onOpenNode:t,onExpandedChange:e=>l(t=>{let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r}),expanded:c.has(n.id),origin:e.range[0],range:u,onRangeChange:e=>a(f4(e)),row:n,selectedItemId:r},n.id))})]})}function q6({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,U.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,U.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,U.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,U.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,U.jsxs)(`span`,{className:`graph-row-facts`,children:[eI(e.workedMs),` recorded · `,eI(e.idleMs),` `,`idle`]})]}),(0,U.jsx)(wn,{...u4,axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function J6({icon:e,label:t,value:n}){return(0,U.jsxs)(Ia,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{children:t}),(0,U.jsx)(`strong`,{children:n})]})]})}var Y6=6,X6=8,Z6=`[aria-describedby^="timeline-detail-"]`,Q6=e=>{if(!(e instanceof Element))return;let t=B4(e);if(t!==void 0)return t;let n=e.closest(Z6);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},$6=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function e8(){let e=(0,V.useRef)(null),[t,n]=(0,V.useState)(),[r,i]=(0,V.useState)(),a=t??r,o=(0,V.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,V.useEffect)(()=>{let e=e=>n(t=>$6(t,Q6(e.target))),t=e=>i(t=>$6(t,Q6(e.target))),r=e=>i(t=>$6(t,Q6(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,V.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-X6,s=Math.min(Math.max(n.left,X6),Math.max(X6,i)),c=n.bottom+Y6,l=n.top-r.height-Y6,u=Math.max(X6,window.innerHeight-r.height-X6),d=c+r.height<=window.innerHeight-X6?c:l,f=Math.min(Math.max(d,X6),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,V.useLayoutEffect)(s,[s]),(0,V.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,Mr.createPortal)((0,U.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var t8=[{setting:`live`,label:`Live`},{setting:10,label:`Every 10 seconds`},{setting:30,label:`Every 30 seconds`},{setting:60,label:`Every minute`},{setting:300,label:`Every 5 minutes`},{setting:`off`,label:`Off`}],n8=`live`,r8={navigation:`dag-ui.updates.navigation`,main:`dag-ui.updates.main`};function i8(e){return t8.find(({setting:t})=>String(t)===e)?.setting}function a8(e){try{return window.localStorage.getItem(e)}catch{return null}}function o8(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function s8(e,t){let[n,r]=(0,V.useState)(()=>i8(a8(e))??t);return[n,(0,V.useCallback)(t=>{r(t),o8(e,t)},[e])]}function c8(){let[e,t]=s8(r8.navigation,30),[n,r]=s8(r8.main,n8);return{navigation:e,setNavigation:t,main:n,setMain:r}}function l8({name:e,caption:t,setting:n,waiting:r,onChange:i}){return(0,U.jsxs)(`div`,{className:`update-setting`,children:[(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(`select`,{"aria-label":e,onChange:e=>{let t=i8(e.target.value);t!==void 0&&i(t)},value:String(n),children:t8.map(({setting:e,label:t})=>(0,U.jsx)(`option`,{value:String(e),children:t},e))})]}),r>0&&(0,U.jsxs)(`output`,{"aria-label":`${e} waiting`,className:`update-waiting`,children:[r,` waiting`]})]})}var u8=new $N(window.location.origin,{fetch:window.fetch.bind(window)}),d8=Object.entries(f2);function f8(e){let t=(0,V.useRef)({value:e,count:0});return t.current.value!==e&&(t.current={value:e,count:t.current.count+1}),t.current.count}var p8=()=>Promise.resolve();function m8({client:e=u8}){let t=v2(),n=s2(),r=t.host||n.active,i=w0(n.active),a=f2[t.detail].profile,o=c8(),s=A2(),c=M2(e,{runId:t.runId,view:t.view===`overall`?`overall`:t.view===`channel`?`channel`:t.nodeId===void 0?`graph`:`node`,nodeId:t.nodeId,filter:a,selectFirst:!r,host:r,humanItems:i.view,navigationUpdates:o.navigation,mainUpdates:o.main}),l=c.rows,u=c.runId,d=c.activity.at(-1),f=c.detail,p=(0,V.useMemo)(()=>f?bX(f):[],[f]),m=BI(e,u),h=t4(e),[g,_]=(0,V.useState)(0),v=h.host.state.phase===`sending`,y=f8(l),{list:b,error:x}=JX(e,t.host||v,g+(v?y:0)),S=f===void 0?void 0:vX(f),C=p.find(({id:e})=>e===t.nodeId);return(0,V.useEffect)(()=>{if(r||!l)return;let e=S2(l),n=e.find(e=>e.rows.some(e=>e.id===t.runId)),i=n?.rows.find(e=>e.id===t.runId),a=(n?.rows??e.flatMap(e=>e.rows)).filter(e=>!e.kind||!t.hiddenKinds.includes(e.kind));(!t.runId||i?.kind&&t.hiddenKinds.includes(i.kind))&&a[0]&&t.selectRun(a[0].id)},[l,t,r]),(0,V.useEffect)(()=>{if(u&&t.runId&&t.runId!==u){let e=new URLSearchParams(window.location.search);e.set(`run`,u),e.delete(`node`),e.delete(`event`),e.set(`view`,t.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[t.runId,u,t.view]),(0,U.jsxs)(fm,{children:[(0,U.jsx)(e8,{}),(0,U.jsxs)(`div`,{className:`app-shell`,children:[(0,U.jsx)(k2,{rows:c.navigationRows,selectedRunId:u,onSelect:e=>{t.selectRun(e),s.close()},onOpenProject:t.selectRun,onHost:()=>{t.selectHost(),s.close()},hostCurrent:t.host&&!n.active,onActionItems:()=>{n.open(),s.close()},actionItemsCurrent:n.active,hiddenKinds:t.hiddenKinds,onKindsChange:t.selectKinds,drawerOpen:s.open,drawerRef:s.drawer,updates:(0,U.jsx)(l8,{caption:`Navigation`,name:`Navigation updates`,onChange:o.setNavigation,setting:o.navigation,waiting:c.navigationWaiting})}),s.open&&(0,U.jsx)(`button`,{"aria-label":`Close navigation`,className:`nav-scrim`,onClick:s.close,type:`button`}),(0,U.jsxs)(`main`,{className:`workspace`,inert:s.open,children:[(0,U.jsxs)(`section`,{"aria-label":u&&!r?`Run header`:`Workspace header`,className:`topbar${u&&!r?` run-topbar`:``}`,children:[(0,U.jsx)(`button`,{"aria-controls":`run-navigation`,"aria-expanded":s.open,"aria-label":`Open navigation`,className:`nav-menu`,onClick:s.toggle,ref:s.menuButton,type:`button`,children:(0,U.jsx)(Vt,{"aria-hidden":`true`,size:18})}),(0,U.jsx)(`div`,{className:`topbar-title`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,U.jsx)(`h2`,{children:n.active?`Action items`:t.host?`Host`:u??`No DAG selected`})]})}),(0,U.jsxs)(`div`,{className:`topbar-actions`,children:[!r&&u!==void 0&&(0,U.jsx)(II,{control:m,runId:u,ended:f!==void 0&&(f.run.state===`settled`||f.run.state.startsWith(`ended-`))}),(0,U.jsxs)(`span`,{className:`connection`,children:[(0,U.jsx)(en,{size:15}),c.lastUpdated===void 0?`Waiting for first update`:(0,U.jsxs)(U.Fragment,{children:[`Last updated`,` `,(0,U.jsx)(sI,{at:c.lastUpdated,relative:!0})]})]}),!r&&d!==void 0&&(0,U.jsxs)(`button`,{className:`last-activity connection`,type:`button`,title:`${d.node}: ${h8(d)}`,onClick:()=>{t.selectNode(d.node),t.selectItem(d.event_id)},children:[d.node,`: `,h8(d)]})]}),(0,U.jsxs)(`div`,{className:`main-updates`,children:[(0,U.jsx)(l8,{caption:`Updates`,name:`Main area updates`,onChange:o.setMain,setting:o.main,waiting:c.mainWaiting}),(0,U.jsxs)(Fa,{onClick:()=>{_(e=>e+1),c.refresh()},size:`sm`,type:`button`,variant:`outline`,children:[(0,U.jsx)(Zt,{size:14}),` Refresh`]})]})]}),!r&&f&&(0,U.jsxs)(j6,{label:`Run details`,className:`run-header-details`,onOpen:m.reread,children:[(0,U.jsxs)(`p`,{children:[`Launching session: `,CX(f.launch)]}),m.status.error&&(0,U.jsxs)(`p`,{role:`alert`,children:[`Status unavailable: `,m.status.error.message]}),m.status.value&&(0,U.jsxs)(`dl`,{children:[(0,U.jsx)(`dt`,{children:`Summary`}),(0,U.jsx)(`dd`,{children:m.status.value.summary}),(0,U.jsx)(`dt`,{children:`Graph state`}),(0,U.jsx)(`dd`,{children:xX(m.status.value.node_status)}),(0,U.jsx)(`dt`,{children:`Unread surfaces`}),(0,U.jsx)(`dd`,{children:m.status.value.unread_surfaces.count}),(0,U.jsx)(`dt`,{children:`Oldest unread (seconds)`}),(0,U.jsx)(`dd`,{children:m.status.value.unread_surfaces.oldest_seconds??`None`}),(0,U.jsx)(`dt`,{children:`Last progress`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(`output`,{"aria-label":`Last progress`,children:f.run.last_progress_at===void 0?`Not recorded`:(0,U.jsx)(sI,{at:new Date(f.run.last_progress_at*1e3).toISOString(),relative:!0})})})]}),m.status.value&&(0,U.jsx)(`section`,{"aria-label":`Node statuses`,children:(0,U.jsx)(UX,{value:m.status.value.node_status})})]}),c.error&&(0,U.jsxs)(ca,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,U.jsx)(on,{}),(0,U.jsx)(la,{children:`Live telemetry issue`}),(0,U.jsx)(ua,{children:c.error.message})]}),c.notice&&(0,U.jsx)(`p`,{className:`live-notice`,role:`status`,children:c.notice}),(0,U.jsx)(a4,{label:`Shutdown of the entire host`,onDismiss:h.host.dismiss,rows:b?.runs??[],state:h.host.state}),n.active?(0,U.jsx)(j0,{client:e,live:c.humanItems,choice:i.choice,setChoice:i.setChoice,selectedId:i.selectedId,setSelectedId:i.setSelectedId}):t.host?(0,U.jsx)(qX,{client:e,listError:x,onRefresh:()=>_(e=>e+1),list:b,rows:c.hostRows,children:(0,U.jsx)(n4,{list:b,loadMore:p8,loadingMore:!1,shutdowns:h})}):(0,U.jsxs)(xp,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?t.showOverall():e===`graph`?t.selectNode(void 0):l2(e)?t.selectView(e):void 0,value:t.view,children:[(0,U.jsxs)(`div`,{className:`view-tabs`,children:[(0,U.jsxs)(Cp,{"aria-label":`DAG views`,variant:`line`,children:[(0,U.jsxs)(wp,{value:`graph`,children:[(0,U.jsx)(un,{size:15}),` Graph`]}),(0,U.jsxs)(wp,{value:`overall`,children:[(0,U.jsx)($t,{size:15}),` Overall`]}),(0,U.jsxs)(wp,{value:`channel`,children:[(0,U.jsx)(It,{size:15}),` Channel`]})]}),(0,U.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,U.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),d8.map(([e,{label:n,description:r}])=>(0,U.jsx)(Fa,{"aria-pressed":t.detail===e,onClick:()=>t.selectDetail(e),size:`sm`,title:r,type:`button`,variant:t.detail===e?`default`:`outline`,children:n},e))]})]}),(0,U.jsx)(Tp,{className:`min-h-0`,value:t.view,children:!f&&(c.loading||u!==void 0)?(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,U.jsx)(Sf,{className:`h-2 w-48`}),(0,U.jsx)(Sf,{className:`h-2 w-32`}),`Loading execution history…`]}):f&&u?t.view===`channel`?(0,U.jsx)(EI,{channel:c.channel,client:e,decisions:S?.decisions??[],filter:a,journalSeq:S?.last_seq,observedAt:f.observed_at,overrides:S&&yX(S),runId:u}):t.view===`overall`?(0,U.jsx)(G6,{client:e,detail:f,journalSeq:S?.last_seq,nodes:p,timeline:c.timeline,timelineError:c.timelineError,onSelectNode:t.selectNode,onSelectItem:t.selectItem,selectedItemId:t.itemId}):C?(0,U.jsx)(v6,{client:e,node:C,nodes:p,onBack:()=>t.selectNode(void 0),onSelectItem:t.selectItem,runId:u,selectedItemId:t.itemId,selectedTab:t.nodeTab,onSelectTab:t.selectNodeTab,timeline:c.timeline,timelineError:c.timelineError}):(0,U.jsx)(HX,{journalSeq:S?.last_seq,nodes:p,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,U.jsxs)(`div`,{className:`empty-state`,children:[(0,U.jsx)(un,{size:34}),(0,U.jsx)(`h2`,{children:`No DAG runs found`}),(0,U.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]})]})]})}function h8(e){return e.description||e.kind}var g8=class extends V.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,U.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,U.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,U.jsx)(`p`,{children:this.state.error.message}),(0,U.jsx)(Fa,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},_8=document.getElementById(`root`);if(!_8)throw Error(`DAG UI root element is missing`);(0,jA.createRoot)(_8).render((0,U.jsx)(V.StrictMode,{children:(0,U.jsx)(g8,{children:(0,U.jsx)(m8,{})})}));
|
package/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
9
9
|
<meta name="theme-color" content="#111622" />
|
|
10
10
|
<title>DAG Observatory</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-66SyL8Jj.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-CyNd_3Tv.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|