feat(webui): the harness settings page and its setup terminal
A Settings > Runtime page lists every credential binding with the capture state of its OAuth token set (expiry, scopes, time; never the tokens), and offers the setup terminal for the Kit profiles the daemon advertises. The terminal is xterm.js over the WebSocket the harness route upgrades, lazy loaded so xterm stays out of the shell bundle. The page reports the terminal as unavailable when the process cannot open one, rather than offering a control that fails (archie-core-egkf.7). Wire shapes and URL building live in ui/src/harness/harness.ts and are covered by ui/test/harness.test.ts; ui/dist is regenerated.
This commit is contained in:
1 parent
af450d3ea0
commit
b2d66781f7
13 files changed
+518
-4
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
import{A as e,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as ee,f as te,g as ne,h as re,i as ie,j as v,k as y,l as ae,m as oe,n as b,o as se,p as x,r as ce,s as le,t as ue,u as S,v as de,w as fe,x as pe,y as me,z as he}from"./index.js";var C=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,w=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},T=(e,t,n,r)=>{for(var i=r>1?void 0:r?ge(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&C(t,n,i),i},E=(e,t)=>(n,r)=>t(n,r,e),_e=`Terminal input`,ve={get:()=>_e,set:e=>_e=e},ye=`Too much output to announce, navigate to rows manually to read`,be={get:()=>ye,set:e=>ye=e};function xe(e){return e.replace(/\r?\n/g,`\r`)}function Se(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Ce(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function we(e,t,n,r){e.stopPropagation(),e.clipboardData&&Te(e.clipboardData.getData(`text/plain`),t,n,r)}function Te(e,t,n,r){e=xe(e),e=Se(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Ee(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function De(e,t,n,r,i){Ee(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Oe(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ke(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Ae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},je=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Me=``,Ne=` `,Pe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Fe}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isLine truncated
|
||||
|
||||
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Qe=D(`CharSizeService`),$e=D(`CoreBrowserService`),et=D(`MouseService`),tt=D(`RenderService`),nt=D(`SelectionService`),rt=D(`CharacterJoinerService`),it=D(`ThemeService`),at=D(`LinkProviderService`),ot=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ft.isErrorNoTelemetry(e)?new ft(e.message+`
|
||||
|
||||
`+e.stack):Error(e.message+`
|
||||
|
||||
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function st(e){lt(e)||ot.onUnexpectedError(e)}var ct=`Canceled`;function lt(e){return e instanceof ut||e instanceof Error&&e.name===ct&&e.message===ct}var ut=class extends Error{constructor(){super(ct),this.name=this.message}};function dt(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var ft=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},pt=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function mt(e,t=0){return e[e.length-(1+t)]}var ht;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ht||={});var gt=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||ht.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};gt.empty=new gt(e=>{});function _t(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var vt;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function ee(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=ee;async function te(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=te})(vt||={});var yt=null;function bt(e){return yt?.trackDisposable(e),e}function xt(e){yt?.markAsDisposed(e)}function St(e,t){yt?.setParent(e,t)}function Ct(e){return yt?.markAsSingleton(e),e}function wt(e){if(vt.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Tt(...e){return A(()=>wt(e))}function A(e){let t=bt({dispose:_t(()=>{xt(t),e()})});return t}var Et=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,bt(this)}dispose(){this._isDisposed||(xt(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wt(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return St(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),St(e,null))}};Et.DISABLE_DISPOSED_WARNING=!1;var Dt=Et,j=class{constructor(){this._store=new Dt,bt(this),St(this._store,this)}dispose(){xt(th
Line truncated
|
||||
`).slice(2).join(`
|
||||
`))}},Bt=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Vt=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Ht=0,Ut=class{constructor(e){this.value=e,this.id=Ht++}},Wt=2,P=class{constructor(e){this._size=0,this._options=e,this._leakageMon=It>0||this._options?.leakWarningThreshold?new Rt(e?.onListenerError??st,this._options?.leakWarningThreshold??It):void 0,this._perfMon=this._options?._profName?new Ft(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Vt(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||st)(n),j.None}if(this._disposed)return j.None;t&&(e=e.bind(t));let r=new Ut(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=zt.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Ut?(this._deliveryQueue??=new Gt,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=A(()=>{i?.(),this._removeListener(r)});return n instanceof Dt?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Wt<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||st;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof Ut)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},Gt=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Kt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new P,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Kt.INSTANCE=new Kt;var qt=Kt;function Jt(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}qt.INSTANCE.onDidChangeZoomLevel;function Yt(e){return qt.INSTANCE.getZoomFactor(e)}qt.INSTANCE.onDidChangeFullscreen;var Xt=typeof navigator==`object`?navigator.userAgent:``,Zt=Xt.indexOf(`Firefox`)>=0,Qt=Xt.indexOf(`AppleWebKit`)>=0,$t=Xt.indexOf(`Chrome`)>=0,en=!$t&&Xt.indexOf(`Safari`)>=0;Xt.indexOf(`Electron/`),Xt.indexOf(`Android`);var tn=!1;if(typeof kt.matchMedia==`function`){let e=kt.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=kt.matchMedia(`(display-mode: fullscreen)`);tn=e.matches,Jt(kt,e,({matches:e})=>{tn&&t.matches||(tn=e)})}f
Line truncated
|
||||
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};ri=T([E(2,O),E(3,$e),E(4,He),E(5,it),E(6,k),E(7,tt)],ri);var ii=class extends j{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(A(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimLine truncated
|
||||
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(R||={});var ui;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(ui||={});var di;(e=>e.ST=`${R.ESC}\\`)(di||={});var fi=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${R.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};fi=T([E(2,O),E(3,k),E(4,Ue),E(5,tt)],fi);var z=0,B=0,V=0,H=0,pi={css:`#00000000`,rgba:0},U;(e=>{function t(e,t,n,r){return r===void 0?`#${hi(e)}${hi(t)}${hi(n)}`:`#${hi(e)}${hi(t)}${hi(n)}${hi(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(U||={});var W;(e=>{function t(e,t){if(H=(t.rgba&255)/255,H===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return z=a+Math.round((n-a)*H),B=o+Math.round((r-o)*H),V=s+Math.round((i-s)*H),{css:U.toCss(z,B,V),rgba:U.toRgba(z,B,V)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=mi.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return U.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[z,B,V]=mi.toChannels(t),{css:U.toCss(z,B,V),rgba:t}}e.opaque=i;function a(e,t){return H=Math.round(t*255),[z,B,V]=mi.toChannels(e.rgba),{css:U.toCss(z,B,V,H),rgba:U.toRgba(z,B,V,H)}}e.opacity=a;function o(e,t){return H=e.rgba&255,a(e,H*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(W||={});va
Line truncated
|
||||
`:`
|
||||
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),oa&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ka(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Wi(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Aa),Aa),t/=Aa,t/Math.abs(t)+Math.round(t*(ja-1)))}shouldForceSelection(e){return na?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Ma)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(na&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active
Line truncated
|
||||
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(F(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(A(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Es+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
||||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Es+1&&(this._liveRegion.textContent+=be.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let
Line truncated
|
||||
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return ve.get()},set promptLabel(e){ve.set(e)},get tooMuchOutput(){return be.get()},set tooMuchOutput(e){be.set(e)}}}_verifyIntegers(...e){for(zs of e)if(zs===1/0||isNaN(zs)||zs%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(zs of e)if(zs&&(zs===1/0||isNaN(zs)||zs%1!=0||zs<0))throw Error(`This API only accepts positive integers`)}},Vs=2,Hs=1,Us=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Vs,Math.floor(u/e.css.cell.width)),rows:Math.max(Hs,Math.floor(l/e.css.cell.height))}}};function Ws(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function Gs(e,t){let n=t.protocol===`https:`?`wss:`:`ws:`,r=new URLSearchParams({profile:e}).toString();return`${n}//${t.host}/api/harness/terminal?${r}`}var Ks={class:`flex h-full min-h-0 flex-col gap-2`},qs={key:0,class:`text-sm text-muted-foreground`,role:`status`},Js=e({__name:`SetupTerminal`,props:{profile:{}},setup(e){let i=e,a=o(null),u=o(`connecting`),d=null,f=null,p=null,m=null;function h(){try{p?.fit()}catch{}}return s(()=>{let e=a.value;if(!e)return;d=new Bs({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),p=new Us,d.loadAddon(p),d.open(e),h(),d.focus();let t=new WebSocket(Gs(i.profile,window.location));f=t,t.binaryType=`arraybuffer`,t.onopen=()=>{u.value=`open`},t.onmessage=e=>{d&&(typeof e.data==`string`?d.write(e.data):d.write(new Uint8Array(e.data)))},t.onerror=()=>{u.value=`failed`},t.onclose=()=>{u.value=`closed`},d.onData(e=>{t.readyState===WebSocket.OPEN&&t.send(e)}),m=new ResizeObserver(h),m.observe(e)}),v(()=>{m?.disconnect(),m=null,f?.close(),f=null,d?.dispose(),d=null,p=null}),(e,i)=>(c(),n(`div`,Ks,[u.value===`open`?r(``,!0):(c(),n(`p`,qs,[u.value===`connecting`?(c(),n(t,{key:0},[l(`Connecting…`)],64)):u.value===`closed`?(c(),n(t,{key:1},[l(`The terminal session ended.`)],64)):(c(),n(t,{key:2},[l(`Could not open the setup terminal.`)],64))])),fe(`div`,{ref_key:`host`,ref:a,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Ys={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},Xs={key:1,class:`space-y-2`},Zs={class:`flex flex-col gap-1 text-sm`},Qs=[`disabled`],$s={key:0,value:``},ec=[`value`],tc=e({__name:`HarnessPage`,setup(e){let v=o(null),C=o(!0),ge=o(null),w=o(!1),T=o(``),E=o(!1),_e={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};s(ve);async function ve(){C.value=!0,ge.value=null,w.value=!1;try{let e=await pe.harnessBindings();v.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},T.value=v.value.profiles[0]??``}catch(e){let t=e instanceof g?e.status:void 0;t===501||t===503?w.value=!0:ge.value=e instanceof Error?e.message:String(e),v.value=null}finally{C.value=!1}}function ye(){v.value?.terminal&&T.value&&(E.value=!0)}function be(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function xe(e){return e.scopes?.length?e.scopes.join(`, `):`—`}return(e,o)=>(c(),n(`div`,null,[y(de,{title:`Harness`}),ge.value?(c(),n(`p`,Ys,he(ge.value),1)):r(``,!0),C.value?(c(),n(`div`,Xs,[y(d(ue),{class:`h-24 w-full`}),y(d(ue),{class:`h-40 w-full`})])):w.value?(c(),p(d(m),{key:2},{default:i(()=>[y(d(re),null,{default:i(()=>[y(d(oe),null,{default:i(()=>[...o[1]||=[l(`Harness bindings are not configured`,-1)]])
Line truncated
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
||||
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scrollbar-thumb:#0000;--tw-scrollbar-track:#0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--scroll-fade-t:0;--scroll-fade-b:0;--scroll-fade-s:0;--scroll-fade-e:0;--scroll-fade-mask:initial;--shimmer-image:initial;--shimmer-text-fill:initial}}}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-cyrillic-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-cyrillic-wght-normal.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-greek-wght-normal.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-vietnamese-wght-normal.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-latin-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-latin-wght-normal.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-400-normal.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-vietnamese-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-vietnamese-400-normal.woff)fLine truncated
|
||||
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scrollbar-thumb:#0000;--tw-scrollbar-track:#0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--scroll-fade-t:0;--scroll-fade-b:0;--scroll-fade-s:0;--scroll-fade-e:0;--scroll-fade-mask:initial;--shimmer-image:initial;--shimmer-text-fill:initial}}}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-cyrillic-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-cyrillic-wght-normal.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-greek-wght-normal.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-vietnamese-wght-normal.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-latin-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:IBM Plex Sans Variable;font-style:normal;font-display:swap;font-weight:100 700;src:url(/assets/ibm-plex-sans-latin-wght-normal.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff)format("woff");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-cyrillic-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-cyrillic-400-normal.woff)format("woff");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:IBM Plex Mono;font-style:normal;font-display:swap;font-weight:400;src:url(/assets/ibm-plex-mono-vietnamese-400-normal.woff2)format("woff2"),url(/assets/ibm-plex-mono-vietnamese-400-normal.woff)fLine truncated
|
||||
Vendored
+4
-3
@@ -1,8 +1,9 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HarnessPage.js","assets/HarnessPage.css"])))=>i.map(i=>d[i]);
|
||||
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>w(e)===`[object Map]`,h=e=>w(e)===`[object Set]`,g=e=>w(e)===`[object Date]`,_=e=>w(e)===`[object RegExp]`,v=e=>typeof e==`function`,y=e=>typeof e==`string`,b=e=>typeof e==`symbol`,x=e=>typeof e==`object`&&!!e,S=e=>(x(e)||v(e))&&v(e.then)&&v(e.catch),C=Object.prototype.toString,w=e=>C.call(e),ee=e=>w(e).slice(8,-1),te=e=>w(e)===`[object Object]`,ne=e=>y(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,re=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ie=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ae=/-\w/g,oe=ie(e=>e.replace(ae,e=>e.slice(1).toUpperCase())),se=/\B([A-Z])/g,ce=ie(e=>e.replace(se,`-$1`).toLowerCase()),le=ie(e=>e.charAt(0).toUpperCase()+e.slice(1)),ue=ie(e=>e?`on${le(e)}`:``),T=(e,t)=>!Object.is(e,t),de=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},fe=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},pe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},me=e=>{let t=y(e)?Number(e):NaN;return isNaN(t)?e:t},he,ge=()=>he||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},_e=n(`Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol`);function ve(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=y(r)?Se(r):ve(r);if(i)for(let e in i)t[e]=i[e]}return t}if(y(e)||x(e))return e}var ye=/;(?![^(]*\))/g,be=/:([^]+)/,xe=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Se(e){let t={};return e.replace(xe,e=>e.startsWith(`/*`)?``:e).split(ye).forEach(e=>{if(e){let n=e.split(be);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function E(e){let t=``;if(y(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=E(e[n]);r&&(t+=r+` `)}else if(x(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}function Ce(e){if(!e)return null;let{class:t,style:n}=e;return t&&!y(t)&&(e.class=E(t)),n&&(e.style=ve(n)),e}var we=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Te=n(we);we+``;function Ee(e){return!!e||e===``}function De(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=je(e[i],t[i],n);return r}function Oe(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&je(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function ke(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Oe(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!je(e[r],t[r],n))return!1}return String(e)===String(t)}function Ae(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function je(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=b(e),i=b(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?Ae(e,t,n,De):!1:(r=x(e),i=x(t),r||i?!r||!i?!1:Ae(e,t,n,ke):String(e)===String(t))))}function Me(e,t){return e.findIndex(e=>je(e,t))}var Ne=e=>!!(e&&e.__v_isRef===!0),D=e=>y(e)?e:e==null?``:p(e)||x(e)&&(e.toString===C||!v(e.toString))?Ne(e)?D(e.value):JSON.stringify(e,Pe,2):String(e),Pe=(e,t)=>Ne(t)?Pe(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Fe(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Fe(e))}:b(t)?Fe(t):x(t)&&!p(t)&&!te(t)?String(t):t,Fe=(e,t=``)=>b(e)?`Symbol(${e.description??t})`:e;function Ie(e){return e==null?`initial`:tyLine truncated
|
||||
`&&(e.tagName===`PRE`||e.tagName===`TEXTAREA`)&&(n=n.slice(1));let{textContent:r}=e;r!==n&&r!==n.replace(/\r\n|\r/g,`
|
||||
`)&&(ki(e,0)||yi(),e.textContent=t.children)}if(d){if(_||b||!o||f&48){let t=e.tagName.includes(`-`),i=e.namespaceURI.includes(`svg`)?`svg`:e.namespaceURI.includes(`MathML`)?`mathml`:void 0;for(let a in d)if(_&&(a.endsWith(`value`)||a===`indeterminate`)||s(a)&&!re(a)||a[0]===`.`||t&&!re(a)||u&&u.includes(a)){if(Ei(e,a,d[a]))continue;r(e,a,null,d[a],i,n)}}else if(d.onClick)r(e,`onClick`,null,d.onClick,void 0,n);else if(f&4&&cn(d.style))for(let e in d.style)d.style[e]}let x;(x=d&&d.onVnodeBeforeMount)&&Ns(x,n,t),h&&wr(t,null,n,`beforeMount`),((x=d&&d.onVnodeMounted)||h||l)&&ls(()=>{x&&Ns(x,n,t),l&&g.enter(e),h&&wr(t,null,n,`mounted`)},i)}return e.nextSibling},m=(e,t,r,o,s,c,u)=>{u||=!!t.dynamicChildren;let d=t.children,p=d.length,m=!1;for(let t=0;t<p;t++){let h=u?d[t]:d[t]=As(d[t]),g=h.type===fs;e?(g&&!u&&t+1<p&&As(d[t+1]).type===fs&&(l(i(e.data.slice(h.children.length)),r,a(e)),e.data=h.children),e=f(e,h,o,s,c,u)):g&&!h.children?l(h.el=i(``),r):(m||(m=!0,ki(r,1)||yi()),n(null,h,r,null,o,s,Si(r),c))}return e},h=(e,t,n,r,i,s)=>{let{slotScopeIds:c}=t;c&&(i=i?i.concat(c):c);let d=o(e),f=m(a(e),t,d,n,r,i,s);return f&&Ci(f)&&f.data===`]`?a(t.anchor=f):(yi(),l(t.anchor=u(`]`),d,f),f)},g=(e,t,r,i,s,l)=>{if(ji(e,t)||yi(),t.el=null,l){let t=_(e);for(;;){let n=a(e);if(n&&n!==t)c(n);else break}}let u=a(e),d=o(e);return c(e),n(null,t,d,u,r,i,Si(d),s),r&&(r.vnode.el=t.el,So(r,t.el)),u},_=(e,t=`[`,n=`]`)=>{let r=0;for(;e;)if(e=a(e),e&&Ci(e)&&(e.data===t&&r++,e.data===n)){if(r===0)return a(e);r--}return e},v=(e,t,n)=>{let r=t.parentNode;r&&r.replaceChild(e,t);let i=n;for(;i;)i.vnode.el===t&&(i.vnode.el=i.subTree.el=e),i=i.parent},y=e=>e.nodeType===1&&e.tagName===`TEMPLATE`;return[d,f]}var Ti=new Set([`src`,`srcset`,`href`,`poster`]);function Ei(e,t,n){return Ti.has(t)?e.getAttribute(t)===(n==null?null:`${n}`):!1}var Di=`data-allow-mismatch`,Oi={0:`text`,1:`children`,2:`class`,3:`style`,4:`attribute`};function ki(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Di);)e=e.parentElement;return Ai(e&&e.getAttribute(Di),t)}function Ai(e,t){if(e==null)return!1;if(e===``)return!0;{let n=e.split(`,`);return t===0&&n.includes(`children`)?!0:n.includes(Oi[t])}}function ji(e,t){return ki(e.parentElement,1)||Mi(e)||Ni(t)}function Mi(e){return e.nodeType===1&&Ai(e.getAttribute(Di),1)}function Ni({props:e}){let t=e&&e[Di];return typeof t==`string`&&Ai(t,1)}var Pi=ge().requestIdleCallback||(e=>setTimeout(e,1)),Fi=ge().cancelIdleCallback||(e=>clearTimeout(e)),Ii=(e=1e4)=>t=>{let n=Pi(t,{timeout:e});return()=>Fi(n)};function Li(e){let{top:t,left:n,bottom:r,right:i}=e.getBoundingClientRect(),{innerHeight:a,innerWidth:o}=window;return(t>0&&t<a||r>0&&r<a)&&(n>0&&n<o||i>0&&i<o)}var Ri=e=>(t,n)=>{let r=new IntersectionObserver(e=>{for(let n of e)if(n.isIntersecting){r.disconnect(),t();break}},e);return n(e=>{if(e instanceof Element){if(Li(e))return t(),r.disconnect(),!1;r.observe(e)}}),()=>r.disconnect()},zi=e=>t=>{if(e){let n=matchMedia(e);if(n.matches)t();else return n.addEventListener(`change`,t,{once:!0}),()=>n.removeEventListener(`change`,t)}},Bi=(e=[])=>(t,n)=>{y(e)&&(e=[e]);let r=!1,i=e=>{r||(r=!0,a(),t(),e.target.dispatchEvent(new e.constructor(e.type,e)))},a=()=>{n(t=>{for(let n of e)t.removeEventListener(n,i)})};return n(t=>{for(let n of e)t.addEventListener(n,i,{once:!0})}),a};function Vi(e,t){if(Ci(e)&&e.data===`[`){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Ci(r)){if(r.data===`]`){if(--n===0)break}else r.data===`[`&&n++}r=r.nextSibling}}else t(e)}var Hi=e=>!!e.type.__asyncLoader;function Ui(e){v(e)&&(e={loader:e});let{loader:t,loadingComponent:n,errorComponent:r,delay:i=200,hydrate:a,timeout:o,suspensible:s=!0,onError:c}=e,l=null,u,d=0,f=()=>(d++,l=null,p()),p=()=>{let e;return l||(e=l=t().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),c)return new Promise((t,n)=>{c(e,()=>t(f()),()=>n(e),d+1)});throw e}).then(t=>e!==l&&l?l:(t&&(t.__esModule||t[Symbol.toStringTag]===`Module`)&&(t=t.default),u=t,t)))};return M({name:`AsyncComponentWrapper`,__asyncLoader:p,__asyncHydrate(e,t,n){let r=e.isConnected,i=!1;(t.bu||=[]).push(()=>i=!0);let o=()=>{i||!e.parentNode||r&&!e.isConnected||n()},s=a?()=>{let n=a(o,t=>Vi(e,t));n&&(t.bum||=[]).push(n)}:o;u?s():p().then(()=>!t.isUnmounted&&s())},get __asyncResolved(){return u},setup(){let e=Ls;if(fi(e),u)return()=>Wi(u,e);let t=t=>{l=null,Xn(t,e,13,!r)};if(s&&e.suspense||Ws)return p().then(t=>()=>Wi(t,e)).catch(e=>(t(e),()=>r?B(r,{error:e}):null));let a=O(!1),c=O(),d=O(!!i),f,m;return sa(()=>{f!=null&&clearTimeout(f),m!=null&&clearTimeout(m)}),i&&(m=setTimeout(()=>{e.isUnmounted||(d.value=!1)},i)),o!=null&&(f=setTimeout(()=>{if(!e.isUnmounted&&!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);t(e),c.value=e}},o)),p().then(()=>{e.isUnmounted||(a.value=!0,e.parent&&Gi(e.parent.vnode)&&e.parent.update())}).catch(n=>{if(e.isUnmounted){l=null;return}t(n),c.value=n}),()=>{if(a.value&&u)return Wi(u,e);if(c.value&&r)return B(r,{error:c.value});if(n&&
Line truncated
|
||||
`))),e[Gl]=Hl(i);let a=r||i.props&&i.props.type===`number`;ll(e,t?`change`:`input`,t=>{t.target.composing||e[Gl](ql(e.value,n,a))}),(n||a)&&ll(e,`change`,()=>{e.value=ql(e.value,n,a)}),t||(ll(e,`compositionstart`,Ul),ll(e,`compositionend`,Wl),ll(e,`change`,Wl))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Kl];delete e[Kl],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[Gl](ql(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Gl]=Hl(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?pe(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Yl={deep:!0,created(e,t,n){e[Gl]=Hl(n),ll(e,`change`,()=>{let t=e._modelValue,n=tu(e),r=e.checked,i=e[Gl];if(p(t)){let e=Me(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(nu(e,r))})},mounted:Xl,beforeUpdate(e,t,n){e[Gl]=Hl(n),Xl(e,t,n)}};function Xl(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=Me(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=je(t,nu(e,!0))}e.checked!==i&&(e.checked=i)}var Zl={created(e,{value:t},n){e.checked=je(t,n.props.value),e[Gl]=Hl(n),ll(e,`change`,()=>{e[Gl](tu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Gl]=Hl(r),t!==n&&(e.checked=je(t,r.props.value))}},Ql={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,ll(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pe(tu(e)):tu(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[Gl](i)}finally{ar(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Gl]=Hl(r)},mounted(e,{value:t}){eu(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Gl]=Hl(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!$l(t,n[1],n[0]))&&eu(e,t)}};function $l(e,t,n){if(!n||p(e))return je(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function eu(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=tu(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Me(t,o)>-1}else a.selected=t.has(o)}else if(je(tu(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function tu(e){return`_value`in e?e._value:e.value}function nu(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var ru={created(e,t,n){au(e,t,n,null,`created`)},mounted(e,t,n){au(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){au(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){au(e,t,n,r,`updated`)}};function iu(e,t){switch(e){case`SELECT`:return Ql;case`TEXTAREA`:return Jl;default:switch(t){case`checkbox`:return Yl;case`radio`:return Zl;default:return Jl}}}function au(e,t,n,r,i){let a=iu(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function ou(){Jl.getSSRProps=({value:e})=>({value:e}),Zl.getSSRProps=({value:e},t)=>{if(t.props&&je(t.props.value,e))return{checked:!0}},Yl.getSSRProps=({value:e},t)=>{if(p(e)){if(t.props&&Me(e,t.props.value)>-1)return{checked:!0}}else if(h(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},ru.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=iu(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var su=[`ctrl`,`shift`,`alt`,`meta`],cu={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>su.some(n=>e[`${n}Key`]&&!t.includes(n))},lu=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=cu[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},uu={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},du=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ce(n.key);if(t.some(e=>e===r||uu[e]===r))return e(n)}))},fu=l({patchProp:xl},xc),pu,mu=!1;function hu(){return pu||=Ho(fu)}function gu(){return pu=mu?pu:Uo(fu),mu=!0,pu}var _u=((...e)=>{hu().render(...e)}),vu=((...e)=>{gu().hydrate(...e)}),yu=((...e)=>{let t=hu().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Su(e);if(!r)return;let i=t._component;!v(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,xu(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),bu=((
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Kp;function qp(e){Kp=e}var Jp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Yp(e){let t=e instanceof Jp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Xp(e,t){let n=await fetch(e,t);if(Kp?.(n.status===401),!n.ok)throw new Jp(await Gp(n),n.status);return n}async function Zp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Up,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Xp(e,s);return a?await c.json():void 0}var J={health:()=>Zp(`/health/detailed`),summary:()=>Zp(`/api/summary`),tasks:()=>Zp(`/api/tasks`),taskMeta:()=>Zp(`/api/task-meta`),task:e=>Zp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Zp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/changes`+Wp(t)),taskDebug:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/debug`+Wp(t)),taskAction:(e,t,n)=>Zp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Zp(`/api/setup`),capabilities:()=>Zp(`/api/capabilities`),workflows:()=>Zp(`/api/workflows`),workflowEnabled:(e,t)=>Zp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Zp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Zp(`/api/skills`),channels:()=>Zp(`/api/channels`),curators:()=>Zp(`/api/curators`),channelReload:e=>Zp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Zp(`/api/config`),logs:e=>Zp(`/api/logs`+Wp(e)),taskLogs:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/logs`+Wp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Zp(`/api/version`),updateSnapshot:()=>Zp(`/api/chat/update`),updateInstall:e=>Zp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Zp(`/api/captures`+Wp({limit:e})),eventTypes:()=>Zp(`/api/event-types`),eventTypeCreate:e=>Zp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Zp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Zp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Zp(`/api/mappings`),mappingCreate:e=>Zp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Zp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Zp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Zp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Zp(`/api/bindings`),bindingCreate:e=>Zp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Zp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Zp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Zp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),sources:()=>Zp(`/api/sources`),sourceCreate:e=>Zp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Zp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Zp(`/api/sources/${encodeURIComponent(e)}/approve-unsigned`,{method:`POST`}),sourceSecret:e=>Zp(`/api/sources/${encodeURIComponent(e)}/secret`,{method:`POST`}),chatSessions:()=>Zp(`/api/chat/sessions`),chatMessages:e=>Zp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Zp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Zp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Zp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Hp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Zp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Zp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Zp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Zp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Xp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Qp(e,t,n=``,r=!1){let i=new EventSource(Vp(n,r));return i.onopen=()=>t(`live`),i.onerror=()=>t(zp(i.readyState)),i.onmessage=t=>{try{e(JSON.parse(t.data),t.lastEventId)}catch{}},()=>i.close()}var $p=`archie.web.chat.channel`;function em(){let e=localStorage.getItem($p);return e||(e=Hp(),localStorage.setItem($p,e)),e}var tm=/(?:^|\s)
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Kp;function qp(e){Kp=e}var Jp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Yp(e){let t=e instanceof Jp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function Xp(e,t){let n=await fetch(e,t);if(Kp?.(n.status===401),!n.ok)throw new Jp(await Gp(n),n.status);return n}async function Zp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Up,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await Xp(e,s);return a?await c.json():void 0}var J={health:()=>Zp(`/health/detailed`),summary:()=>Zp(`/api/summary`),tasks:()=>Zp(`/api/tasks`),taskMeta:()=>Zp(`/api/task-meta`),task:e=>Zp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Zp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/changes`+Wp(t)),taskDebug:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/debug`+Wp(t)),taskAction:(e,t,n)=>Zp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Zp(`/api/setup`),capabilities:()=>Zp(`/api/capabilities`),workflows:()=>Zp(`/api/workflows`),workflowEnabled:(e,t)=>Zp(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),workRequest:e=>Zp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Zp(`/api/skills`),channels:()=>Zp(`/api/channels`),curators:()=>Zp(`/api/curators`),channelReload:e=>Zp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Zp(`/api/config`),logs:e=>Zp(`/api/logs`+Wp(e)),taskLogs:(e,t)=>Zp(`/api/tasks/${encodeURIComponent(e)}/logs`+Wp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),version:()=>Zp(`/api/version`),updateSnapshot:()=>Zp(`/api/chat/update`),updateInstall:e=>Zp(`/api/chat/update/install`,{method:`POST`,body:{snapshot:e},timeoutMs:9e5}),captures:e=>Zp(`/api/captures`+Wp({limit:e})),eventTypes:()=>Zp(`/api/event-types`),eventTypeCreate:e=>Zp(`/api/event-types`,{method:`POST`,body:e}),eventTypeUpdate:(e,t)=>Zp(`/api/event-types/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),eventTypeDelete:e=>Zp(`/api/event-types/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappings:()=>Zp(`/api/mappings`),mappingCreate:e=>Zp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Zp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Zp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Zp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Zp(`/api/bindings`),bindingCreate:e=>Zp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Zp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Zp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Zp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),harnessBindings:()=>Zp(`/api/harness/bindings`),sources:()=>Zp(`/api/sources`),sourceCreate:e=>Zp(`/api/sources`,{method:`POST`,body:{path:e}}),sourceSigning:(e,t)=>Zp(`/api/sources/${encodeURIComponent(e)}/signing`,{method:`POST`,body:{signed:t}}),sourceApproveUnsigned:e=>Zp(`/api/sources/${encodeURIComponent(e)}/approve-unsigned`,{method:`POST`}),sourceSecret:e=>Zp(`/api/sources/${encodeURIComponent(e)}/secret`,{method:`POST`}),chatSessions:()=>Zp(`/api/chat/sessions`),chatMessages:e=>Zp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Zp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Zp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Zp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Hp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Zp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Zp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Zp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Zp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>Xp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Qp(e,t,n=``,r=!1){let i=new EventSource(Vp(n,r));return i.onopen=()=>t(`live`),i.onerror=()=>t(zp(i.readyState)),i.onmessage=t=>{try{e(JSON.parse(t.data),t.lastEventId)}catch{}},()=>i.close()}var $p=`archie.web.chat.channel`;function em(){let e=localStorage.getItem($p);return e||(e=Hp(
Line truncated
|
||||
|
||||
`);u=r.pop()||``;for(let e of r){let t=e.split(`
|
||||
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(pm.value=n.session_id),n.type===`delta`&&(o+=n.text,vm.value=vm.value?{...vm.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],vm.value=vm.value?{...vm.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);mm.value=[...mm.value,{from:`assistant`,text:o,tool_calls:a}],vm.value=null,gm.value=`Ready`,await Nm()}catch(e){let t=e;t.name===`AbortError`&&!c?(vm.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},gm.value=`Stopped`):(vm.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?cm(r):void 0,isRetry:i},gm.value=`Error — retry available`)}finally{clearTimeout(l),jm=null,_m.value=!1}}function Km(){gm.value=`Stopping…`,pm.value&&J.chatCancel(pm.value).catch(()=>{}),Mm()}function qm(){ra(()=>{Nm().catch(e=>{gm.value=e.message||`Chat unavailable`})}),sa(()=>{Mm()})}var Jm=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Ym=M({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return q(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(I(),L(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":k(um),onClick:i[0]||=e=>n(`toggle`)},[z(`span`,{"aria-hidden":`true`,class:E(r(!e.open))},[B(k(Vd),{size:22})],2),z(`span`,{"aria-hidden":`true`,class:E(r(e.open))},[B(k(uf),{size:22})],2)],8,Jm))}});function Xm(e){return typeof e==`string`?`'${e}'`:new eh().serialize(e)}var Zm=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Qm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Zm.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function $m(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Qm[n]?Qm[n]:n+128,s=a<128&&Qm[a]?Qm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var eh=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?$m(e,t):n===`number`&&r===`number`?e-t:$m(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort($m),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`]
Line truncated
|
||||
@@ -17,7 +18,7 @@ Defaulting to \`null\`.`),null)}function BS(e){return RS(e)&&!Number.isNaN(e)&&e
|
||||
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=JE(c),u=e+1<n.length?JE(n[e+1]):null;if(l&&u&&YE(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=JE(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>KE(e)),rows:r.map(e=>e.map(e=>KE(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:KE(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:KE(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
|
||||
`)}),t}function JE(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function YE(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var XE={class:`[overflow-wrap:anywhere]`},ZE={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},QE={class:`font-mono text-[0.85em]`},$E={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},eD={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},tD={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},nD={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},rD={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},iD={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},aD={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},oD={key:8,class:`mb-2.5 last:mb-0`},sD=M({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=W(()=>qE(t.text));return(e,t)=>(I(),L(`div`,XE,[(I(!0),L(F,null,N(n.value,(e,t)=>(I(),L(F,{key:t},[e.kind===`pre`?(I(),L(`pre`,ZE,[z(`code`,QE,D(e.code),1)])):e.kind===`table`?(I(),L(`table`,$E,[z(`thead`,null,[z(`tr`,null,[(I(!0),L(F,null,N(e.head,(e,t)=>(I(),L(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[B(WE,{inline:e},null,8,[`inline`])]))),128))])]),z(`tbody`,null,[(I(!0),L(F,null,N(e.rows,(e,t)=>(I(),L(`tr`,{key:t},[(I(!0),L(F,null,N(e,(e,t)=>(I(),L(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[B(WE,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),L(`blockquote`,eD,[B(WE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),L(`h1`,tD,[B(WE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),L(`h2`,nD,[B(WE,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),L(`h3`,rD,[B(WE,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),L(`ul`,iD,[(I(!0),L(F,null,N(e.items,(e,t)=>(I(),L(`li`,{key:t},[B(WE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),L(`ol`,aD,[(I(!0),L(F,null,N(e.items,(e,t)=>(I(),L(`li`,{key:t},[B(WE,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),L(`p`,oD,[B(WE,{inline:e.inline},null,8,[`inline`])])):H(``,!0)],64))),128))]))}}),cD={class:`truncate`},lD=M({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ma(`RouterLink`);return I(),R(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:A(()=>[B(k(bd),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),z(`span`,cD,D(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),uD={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},dD={class:`font-semibold text-foreground`},fD={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},pD=M({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=W(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=W(()=>t.tool.parameters||t.tool.Parameters||``),i=W(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=W(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(I(),R(lD,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(I(),L(`div`,uD,[B(k(lf),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),z(`span`,dD,D(n.value),1),r.value?(I(),L(`code`,fD,D(r.value),1)):H(``,!0),z(`span`,{class:E(k(q)(`text-fg-muted`,i.value&&`text-danger`))},D(a.value),3)]))}}),mD={key:0,class:`mb-2 grid gap-0.5 text-xs`},hD={key:1,class:`mb-2 flex flex-wrap gap-1.5`},gD={key:3,class:`whitespace-pre-wrap`},_D=M({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),L(`div`,{class:E([`flex`,e.assistant?`justify-start`:`justify-end`])},[z(`div`,{class:E(k(q)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(I(),L(`div`,mD,[(I(!0),L(F,null,N(e.tools,(t,n)=>(I(),R(pD,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):H(``,!0),e.media.length?(I(),L(`div`,hD,[(I(!0),L(F,null,N(e.media,(e,t)=>(I(),R(LE,{key:t,attachment:e},null,8,[`attachment`]))),128))])):H(``,!0),e.assistant?(I(),R(sD,{key:2,text:e.text},null,8,[`text`])):(I(),L(`div`,gD,D(e.text),1)),P(t.$slots,`default`)],2)],2))}}),vD={class:`w-full self-center justify-self-center py-6 text-center`},yD={class:`grid gap-2`},bD=[`onClick`],xD=M({__name:`ChatEmptyState`,emits:[`proLine truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>HM?`${n.slice(0,HM).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var WM=[`title`],GM=M({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>gM(n.event)),a=W(()=>UM(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=W(()=>n.event.at?Dj(n.event.at):`—`);return(e,t)=>(I(),R(k(zM),{class:E(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[du(lu(o,[`prevent`]),[`enter`]),du(lu(o,[`prevent`]),[`space`])]},{default:A(()=>[B(k($),{class:`font-medium`},{default:A(()=>[V(D(n.event.kind||n.event.type||`event`),1)]),_:1}),B(k($),{class:`font-mono`},{default:A(()=>[V(D(i.value>0?`#${i.value}`:`—`),1)]),_:1}),B(k($),{class:`w-[55%] max-w-0`},{default:A(()=>[z(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},D(a.value.text),9,WM)]),_:1}),B(k($),null,{default:A(()=>[V(D(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),KM=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function qM(e){return(Number(e?.task_id)||0)>0}function JM(e,t){return t===`tasks`?qM(e):t!==`system`||!qM(e)}function YM(e,t){return e.filter(e=>JM(e,t))}function XM(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function ZM(e,t){return`${e}:${t??0}`}function QM(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=ZM(UM(n).text,r),a=t[t.length-1];if(a&&a.key===i){a.count+=1,a.events.push(n);continue}t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var $M={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},eN={class:`max-h-[28rem] overflow-y-auto`},tN=[`aria-expanded`,`aria-label`,`onClick`],nN=[`title`],rN=M({__name:`LiveActivityCard`,setup(e){let t=WD(),{activity:n,streamKind:r,streamState:i}=ad(kA()),a=O(`all`),o=W(()=>YM(n.value,a.value)),s=W(()=>XM(o.value.length,a.value)),c=nn(new Set),l=W(()=>QM(o.value));function u(e){c.has(e)?c.delete(e):c.add(e)}function d(e){return c.has(e.key)}function f(e){return UM(e.representative)}function p(e){return e.representative.at?Dj(e.representative.at):`—`}function m(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(I(),R(k(bj),null,{default:A(()=>[B(k(Tj),null,{default:A(()=>[B(k(Ej),null,{default:A(()=>[...t[1]||=[V(`Live activity`,-1)]]),_:1}),B(k(xj),{class:`flex items-center gap-2`},{default:A(()=>[B(k(tA),{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:`Filter activity`,options:k(KM)},null,8,[`modelValue`,`options`]),B(k(_j),{variant:k(r)},{default:A(()=>[V(D(k(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),B(k(Sj),null,{default:A(()=>[z(`div`,$M,[z(`div`,eN,[B(k(LM),null,{default:A(()=>[B(k(VM),{class:`sticky top-0 z-10 bg-card`},{default:A(()=>[B(k(zM),null,{default:A(()=>[B(k(BM),null,{default:A(()=>[...t[2]||=[V(`Event`,-1)]]),_:1}),B(k(BM),null,{default:A(()=>[...t[3]||=[V(`Task`,-1)]]),_:1}),B(k(BM),null,{default:A(()=>[...t[4]||=[V(`Detail`,-1)]]),_:1}),B(k(BM),null,{default:A(()=>[...t[5]||=[V(`When`,-1)]]),_:1})]),_:1})]),_:1}),B(k(RM),null,{default:A(()=>[o.value.length?H(``,!0):(I(),R(k(zM),{key:0},{default:A(()=>[B(k($),{colspan:`4`},{default:A(()=>[B(k(lj),null,{default:A(()=>[B(k(fj),null,{default:A(()=>[B(k(hj),null,{default:A(()=>[V(D(s.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})),o.value.length?(I(!0),L(F,{key:1},N(l.value,e=>(I(),L(F,{key:e.key},[e.count===1?(I(),R(GM,{key:0,event:e.representative,onOpen:m},null,8,[`event`])):(I(),L(F,{key:1},[B(k(zM),{class:E(e.taskID>0?`cursor-pointer`:``),role:e.taskID>0?`link`:void 0,tabindex:e.taskID>0?0:void 0,title:e.taskID>0?`Open task details`:void 0,onClick:t=>e.taskID>0&&m(e.taskID),onKeydown:[du(lu(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`enter`]),du(lu(t=>e.taskID>0&&m(e.taskID),[`prevent`]),[`space`])]},{default:A(()=>[B(k($),{class:`font-medium`},{default:A(()=>[z(`button`,{type:`button`,class:`inline-flex items-center gap-1 rounded hover:opacity-80`,"aria-expanded":d(e),"aria-label":`${d(e)?`Hide`:`Show`} ${e.count} ${e.label} events`,onClick:lu(t=>u(e.key),[`stop`])},[d(e)?(I(),R(k(wd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`})):(I(),R(k(Td),{key:1,class:`size-3.5 shrink-0 text-fg-subtle`})),V(` `+D(e.label)+` `,1),B(k(_j),{variant:`idle`},{default:A(()=>[V(`×`+D(e.count),1)]),_:2},1024)],8,tN)]),_:2},1024),B(k($),{class:`font-mono`},{default:A(()=>[V(D(e.taskID>0?`#${e.taskID}`:`—`),1)]),_:2},1024),B(k($),{class:`w-[55%] max-w-0`},{default:A(()=>[z(`span`,{class:`block truncate`,title:f(e).truncated?f(e).full:void 0},D(f(e).text),9,nN)]),_:2},1024),B(k($),null,{default:A(()=>[V(D(p(e)),1)]),_:2},1024)]),_:2},1032,[`class`,`role`,`tabindex`,`title`,`onClick`,`onKeydown`]),d(e)?(I(!0),L(F,{key:0},N(e.events,(t,n)=>(I(),R(GM,{key:`${e.key}:${n}`,event:t,onO
Line truncated
|
||||
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function mP(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function hP(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function gP(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function _P(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var vP=O([]),yP=O([]),bP=O(!0),xP=O(null),SP=O(null),CP=O(!1),wP=O(null);async function TP(){try{let e=await J.eventTypes();bP.value=e.enabled!==!1,vP.value=e.event_types||[],yP.value=e.proposals||[],xP.value=null}catch(e){xP.value=e.message||String(e)}}function EP(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function DP(e){wP.value=null,SP.value=e}function OP(e){let t=IP.value.find(t=>String(t.id)===e.sample_id);DP({mode:`proposal`,id:null,source:e.source,name:``,rule:EP(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function kP(e=``){DP({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function AP(e){DP({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:EP(e.rule),headersText:``,body:``,exampleHeaders:{}})}function jP(){SP.value=null}async function MP(){let e=SP.value;if(e){CP.value=!0;try{if(e.mode===`edit`&&e.id)await J.eventTypeUpdate(e.id,{name:e.name,rule:_P(e.rule)});else{let t=e.mode===`paste`?pP(e.headersText):e.exampleHeaders;await J.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:_P(e.rule),example:{headers:t,body:e.body}})}SP.value=null,await TP()}catch(e){wP.value=e.message||String(e)}finally{CP.value=!1}}}var NP=O(null);async function PP(){let e=NP.value;if(NP.value=null,e)try{await J.eventTypeDelete(e.id),await TP()}catch(e){xP.value=e.message||String(e)}}var FP=100,IP=O([]),LP=O(!0),RP=O(null),zP=O(!0),BP=O(null);async function VP(){try{let e=await J.captures(FP);LP.value=e.enabled!==!1,IP.value=e.captures||[],RP.value=null}catch(e){RP.value=e.message||String(e)}finally{zP.value=!1}}function HP(e){let t=IP.value.find(t=>t.id===e);return t&&(BP.value=t),!!t}function UP(){IP.value.length&&(BP.value=IP.value[0])}function WP(){AA(`captures`,()=>{VP(),TP()})}var GP=M({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=bg(Pw(n,`class`),r);return(e,t)=>(I(),R(k(VC),U({"data-slot":`tabs`,"data-orientation":k(i).orientation||`horizontal`},k(i),{class:k(q)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:A(t=>[P(e.$slots,`default`,Ce(Ds(t)))]),_:3},16,[`data-orientation`,`class`]))}}),KP=M({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Pw(t,`class`);return(e,r)=>(I(),R(k(WC),U({"data-slot":`tabs-content`,class:k(q)(`text-sm flex-1 outline-none`,t.class)},k(n)),{default:A(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),qP=M({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Pw(t,`class`,`variant`);return(r,i)=>(I(),R(k(GC),U({"data-slot":`tabs-list`,"data-variant":e.variant},k(n),{class:k(q)(k(YP)({variant:e.variant}),t.class)}),{default:A(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),JP=M({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=yg(Pw(t,`class`));return(e,r)=>(I(),R(k(KC),U({"data-slot":`tabs-trigger`,class:k(q)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabledLine truncated
|
||||
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function mP(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function hP(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function gP(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function _P(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var vP=O([]),yP=O([]),bP=O(!0),xP=O(null),SP=O(null),CP=O(!1),wP=O(null);async function TP(){try{let e=await J.eventTypes();bP.value=e.enabled!==!1,vP.value=e.event_types||[],yP.value=e.proposals||[],xP.value=null}catch(e){xP.value=e.message||String(e)}}function EP(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function DP(e){wP.value=null,SP.value=e}function OP(e){let t=IP.value.find(t=>String(t.id)===e.sample_id);DP({mode:`proposal`,id:null,source:e.source,name:``,rule:EP(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function kP(e=``){DP({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function AP(e){DP({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:EP(e.rule),headersText:``,body:``,exampleHeaders:{}})}function jP(){SP.value=null}async function MP(){let e=SP.value;if(e){CP.value=!0;try{if(e.mode===`edit`&&e.id)await J.eventTypeUpdate(e.id,{name:e.name,rule:_P(e.rule)});else{let t=e.mode===`paste`?pP(e.headersText):e.exampleHeaders;await J.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:_P(e.rule),example:{headers:t,body:e.body}})}SP.value=null,await TP()}catch(e){wP.value=e.message||String(e)}finally{CP.value=!1}}}var NP=O(null);async function PP(){let e=NP.value;if(NP.value=null,e)try{await J.eventTypeDelete(e.id),await TP()}catch(e){xP.value=e.message||String(e)}}var FP=100,IP=O([]),LP=O(!0),RP=O(null),zP=O(!0),BP=O(null);async function VP(){try{let e=await J.captures(FP);LP.value=e.enabled!==!1,IP.value=e.captures||[],RP.value=null}catch(e){RP.value=e.message||String(e)}finally{zP.value=!1}}function HP(e){let t=IP.value.find(t=>t.id===e);return t&&(BP.value=t),!!t}function UP(){IP.value.length&&(BP.value=IP.value[0])}function WP(){AA(`captures`,()=>{VP(),TP()})}var GP=M({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=bg(Pw(n,`class`),r);return(e,t)=>(I(),R(k(VC),U({"data-slot":`tabs`,"data-orientation":k(i).orientation||`horizontal`},k(i),{class:k(q)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:A(t=>[P(e.$slots,`default`,Ce(Ds(t)))]),_:3},16,[`data-orientation`,`class`]))}}),KP=M({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Pw(t,`class`);return(e,r)=>(I(),R(k(WC),U({"data-slot":`tabs-content`,class:k(q)(`text-sm flex-1 outline-none`,t.class)},k(n)),{default:A(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),qP=M({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Pw(t,`class`,`variant`);return(r,i)=>(I(),R(k(GC),U({"data-slot":`tabs-list`,"data-variant":e.variant},k(n),{class:k(q)(k(YP)({variant:e.variant}),t.class)}),{default:A(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),JP=M({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=yg(Pw(t,`class`));return(e,r)=>(I(),R(k(KC),U({"data-slot":`tabs-trigger`,class:k(q)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabledLine truncated
|
||||
`)}};Eq.defaultYaml={explicit:!1,version:`1.2`},Eq.defaultTags={"!!":`tag:yaml.org,2002:`};function Dq(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Oq(e){let t=new Set;return yq(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function kq(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Aq(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Oq(e);let a=kq(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(dq(t.node)||pq(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function jq(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=jq(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=jq(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=jq(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=jq(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Mq(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Mq(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!hq(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Nq=class{constructor(e){Object.defineProperty(this,oq,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!cq(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Mq(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?jq(i,{"":o},``,o):o}},Pq=class extends Nq{constructor(e){super(eq),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],yq(e,{Node:(e,t)=>{(sq(t)||hq(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(Mq(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fq(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Dq(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Fq(e,t,n){if(sq(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(pq(t)){let r=0;for(let i of t.items){let t=Fq(e,i,n);t>r&&(r=t)}return r}if(uq(t)){let r=Fq(e,t.key,n),i=Fq(e,t.value,n);return Math.max(r,i)}return 1}var Iq=e=>!e||typeof e!=`function`&&typeof e!=`object`,Lq=class extends Nq{constructor(e){super(iq),this.value=e}toJSON(e,t){return t?.keep?this.value:Mq(this.value,e,t)}toString(){return String(this.value)}};Lq.BLOCK_FOLDED=`BLOCK_FOLDED`,Lq.BLOCK_LITERAL=`BLOCK_LITERAL`,Lq.PLAIN=`PLAIN`,Lq.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Lq.QUOTE_SINGLE=`QUOTE_SINGLE`;var Rq=`tag:yaml.org,2002:`;function zq(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Bq(e,t,n){if(cq(e)&&(e=e.contents),mq(e))return e;if(uq(e)){let t=n.schema[nq].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Pq(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Rq+t.slice(2));let l=zq(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Lq(e);return c&&(c.node=t),t
Line truncated
|
||||
`)?Gq(n,t):n.includes(`
|
||||
`)?`
|
||||
@@ -123,4 +124,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
||||
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
||||
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=RX(LX(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=RX(LX(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function HX(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new NX||null,prettyErrors:t}}function UX(e,t={}){let{lineCounter:n,prettyErrors:r}=HX(t),i=new VX(n?.addNewLine),a=new yX(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new FY(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(LY(e,n)),o.warnings.forEach(LY(e,n))),o}function WX(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function GX(e){let t=UX(e),n=t.errors[0];if(n)return{ok:!1,message:eZ(n.message),line:n.linePos?.[0]?.line};let r=t.toJS();if(!tZ(r))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let i=typeof r.id==`string`?r.id.trim():``;if(!i)return{ok:!1,message:`workflow id is required`};let a=r.steps;if(a==null||a===``)return{ok:!1,message:`workflow ${i} has no steps`};if(!Array.isArray(a))return{ok:!1,message:`workflow ${i}: steps must be a list`};if(!a.length)return{ok:!1,message:`workflow ${i} has no steps`};let o=[];for(let[e,t]of a.entries()){if(!tZ(t)||!nZ(t.type))return{ok:!1,message:`workflow ${i} step ${e+1} needs a type`};o.push({index:e+1,type:t.type.trim()})}return{ok:!0,id:i,steps:o}}function KX(e){switch(e){case`key`:return`text-fg-muted`;case`string`:return`text-ok`;case`comment`:case`punct`:return`text-fg-subtle`;default:return`text-foreground`}}function qX(e){return e.split(`
|
||||
`).map((e,t)=>({number:t+1,text:e,tokens:XX(e)}))}var JX=/^(\s*)(-\s+)?/,YX=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function XX(e){let{code:t,comment:n}=ZX(e),r=QX(t);return n&&r.push({text:n,kind:`comment`}),r}function ZX(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t){r===t&&(t=``);continue}if(r===`"`||r===`'`){t=r;continue}if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function QX(e){if(!e)return[];let t=[],n=JX.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=YX.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...$X(i[4]??``)]):[...t,...$X(r)]}function $X(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function eZ(e){return e.split(`
|
||||
`)[0]?.trim()||`invalid YAML`}function tZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nZ(e){return typeof e==`string`&&e.trim()!==``}var rZ={class:`space-y-1.5`},iZ={class:`space-y-1.5`},aZ={class:`flex h-9 flex-nowrap items-center gap-1.5 overflow-hidden`,role:`list`,"aria-label":`Steps`},oZ=[`title`],sZ={key:1,class:`text-xs text-fg-subtle`},cZ={class:`space-y-1.5`},lZ={class:`flex items-baseline gap-2`},uZ={class:`relative overflow-hidden rounded-lg border border-input font-mono text-[13px] leading-6 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`},dZ={"aria-hidden":`true`,class:`pointer-events-none absolute inset-y-0 left-0 w-11 select-none overflow-hidden border-r border-border bg-secondary/40 py-3 text-right`},fZ={"aria-hidden":`true`,class:`pointer-events-none absolute inset-0 overflow-hidden py-3 pr-3 pl-14 break-words whitespace-pre-wrap`},pZ={key:0,class:`text-sm text-danger`,role:`alert`},mZ={class:`flex flex-wrap items-center gap-2 border-t border-border pt-4`},hZ={key:0,class:`mr-auto font-mono text-xs text-fg-subtle`},gZ=M({__name:`WorkflowEditor`,props:{selected:{required:!0},selectedModifiers:{}},emits:[`update:selected`],setup(e){let t=ZA(),n=W(()=>t.stateFor(`workflow-definitions`)),r=W(()=>n.value.resource?.value??{definitions:[]}),i=W(()=>t.shippedWorkflows()),a=co(e,`selected`),o=O(``),s=O(``),c=O(``),l=W(()=>i.value.definitions.find(e=>e.id===o.value));function u(e){let t=r.value.definitions.find(t=>t.id===e);o.value=t?.id??e,s.value=t?.yaml??`id: ${e}\nsteps:\n - type: `,c.value=``}j(a,u,{immediate:!0}),j(r,()=>{s.value||u(a.value)});async function d(e){return c.value=``,t.replace(`workflow-definitions`,e)}async function f(){let e=o.value.trim();if(!e){c.value=`Workflow ID is required.`;return}let t=a.value,n=r.value;t&&t!==e&&(n=YA(n,t)),await d(JA(n,{id:e,yaml:s.value}))&&(a.value=e)}async function p(){a.value&&await d(YA(r.value,a.value))&&(a.value=``,o.value=``,s.value=``)}async function m(){l.value&&await d(JA(r.value,KA(l.value)))}let h=W(()=>GX(s.value)),g=W(()=>h.value.ok?h.value.steps:[]),_=W(()=>qX(s.value)),v=O(0);function y(e){v.value=e.target.scrollTop}return(e,t)=>(I(),L(`form`,{class:`space-y-4`,onSubmit:lu(f,[`prevent`])},[z(`div`,rZ,[B(k(gT),{for:`workflow-id`},{default:A(()=>[...t[2]||=[V(`ID`,-1)]]),_:1}),B(k(Q),{id:`workflow-id`,modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,name:`workflow-id`,required:``,autocomplete:`off`,class:`max-w-sm font-mono`},null,8,[`modelValue`])]),z(`div`,iZ,[t[3]||=z(`span`,{class:`text-sm leading-none font-medium`},`Steps`,-1),z(`div`,aZ,[g.value.length?(I(!0),L(F,{key:0},N(g.value,(e,t)=>(I(),L(F,{key:e.index},[z(`span`,{role:`listitem`,class:`shrink-0 rounded border border-border bg-secondary px-2 py-0.5 font-mono text-xs`,title:e.type},D(e.type),9,oZ),t<g.value.length-1?(I(),R(k(yd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":`true`})):H(``,!0)],64))),128)):(I(),L(`span`,sZ,`No steps yet`))])]),z(`div`,cZ,[z(`div`,lZ,[B(k(gT),{for:`workflow-yaml`},{default:A(()=>[...t[4]||=[V(`YAML`,-1)]]),_:1}),z(`span`,{class:E([`ml-auto text-xs`,h.value.ok?`text-ok`:`text-danger`]),role:`status`},D(h.value.ok?`✓`:`✕`)+` `+D(k(WX)(h.value)),3)]),z(`div`,uZ,[z(`div`,dZ,[z(`div`,{style:ve(`transform:translateY(${-v.value}px)`)},[(I(!0),L(F,null,N(_.value,e=>(I(),L(`div`,{key:e.number,class:`min-h-6 pr-2 text-fg-subtle`},D(e.number),1))),128))],4)]),z(`div`,fZ,[z(`div`,{style:ve(`transform:translateY(${-v.value}px)`)},[(I(!0),L(F,null,N(_.value,e=>(I(),L(`div`,{key:e.number,class:`min-h-6`},[(I(!0),L(F,null,N(e.tokens,(e,t)=>(I(),L(`span`,{key:t,class:E(k(KX)(e.kind))},D(e.text),3))),128))]))),128))],4)]),B(k(DT),{id:`workflow-yaml`,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,name:`workflow-yaml`,required:``,class:`relative min-h-96 resize-y rounded-none border-0 bg-transparent py-3 pr-3 pl-14 text-[13px] leading-6 text-transparent caret-foreground shadow-none md:text-[13px] focus-visible:ring-0`,spellcheck:`false`,onScroll:y},null,8,[`modelValue`])])]),c.value||n.value.error?(I(),L(`p`,pZ,D(c.value||n.value.error),1)):H(``,!0),z(`div`,mZ,[n.value.resource?(I(),L(`span`,hZ,`Version `+D(n.value.resource.version),1)):H(``,!0),a.value?(I(),R(k(Z),{key:1,type:`button`,variant:`ghost`,class:`text-danger`,onClick:p},{default:A(()=>[B(k(rf)),t[5]||=V(` Remove`,-1)]),_:1})):H(``,!0),l.value?(I(),R(k(Z),{key:2,type:`button`,variant:`outline`,onClick:m},{default:A(()=>[B(k(Xd)),t[6]||=V(` Restore this workflow`,-1)]),_:1})):H(``,!0),B(k(Z),{type:`submit`,disabled:n.value.saving||!h.value.ok},{default:A(()=>[n.value.saving?(I(),R(k(yF),{key:0,"data-icon":`inline-start`})):H(``,!0),t[7]||=V(` Validate & save`,-1)]),_:1},8,[`disabled`])])],32))}});function _Z(e,t){let n=new Map((e||[]).map(e=>[e.workflow,e])),r=[],i=new Set;for(let e of t||[])i.add(e.id),r.push({...e,...n.get(e.id)||{workflow:e.id,runs:0,merged:0,completed:0}});for(let t of e||[])i.has(t.workflow)||r
Line truncated
|
||||
`)[0]?.trim()||`invalid YAML`}function tZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nZ(e){return typeof e==`string`&&e.trim()!==``}var rZ={class:`space-y-1.5`},iZ={class:`space-y-1.5`},aZ={class:`flex h-9 flex-nowrap items-center gap-1.5 overflow-hidden`,role:`list`,"aria-label":`Steps`},oZ=[`title`],sZ={key:1,class:`text-xs text-fg-subtle`},cZ={class:`space-y-1.5`},lZ={class:`flex items-baseline gap-2`},uZ={class:`relative overflow-hidden rounded-lg border border-input font-mono text-[13px] leading-6 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`},dZ={"aria-hidden":`true`,class:`pointer-events-none absolute inset-y-0 left-0 w-11 select-none overflow-hidden border-r border-border bg-secondary/40 py-3 text-right`},fZ={"aria-hidden":`true`,class:`pointer-events-none absolute inset-0 overflow-hidden py-3 pr-3 pl-14 break-words whitespace-pre-wrap`},pZ={key:0,class:`text-sm text-danger`,role:`alert`},mZ={class:`flex flex-wrap items-center gap-2 border-t border-border pt-4`},hZ={key:0,class:`mr-auto font-mono text-xs text-fg-subtle`},gZ=M({__name:`WorkflowEditor`,props:{selected:{required:!0},selectedModifiers:{}},emits:[`update:selected`],setup(e){let t=ZA(),n=W(()=>t.stateFor(`workflow-definitions`)),r=W(()=>n.value.resource?.value??{definitions:[]}),i=W(()=>t.shippedWorkflows()),a=co(e,`selected`),o=O(``),s=O(``),c=O(``),l=W(()=>i.value.definitions.find(e=>e.id===o.value));function u(e){let t=r.value.definitions.find(t=>t.id===e);o.value=t?.id??e,s.value=t?.yaml??`id: ${e}\nsteps:\n - type: `,c.value=``}j(a,u,{immediate:!0}),j(r,()=>{s.value||u(a.value)});async function d(e){return c.value=``,t.replace(`workflow-definitions`,e)}async function f(){let e=o.value.trim();if(!e){c.value=`Workflow ID is required.`;return}let t=a.value,n=r.value;t&&t!==e&&(n=YA(n,t)),await d(JA(n,{id:e,yaml:s.value}))&&(a.value=e)}async function p(){a.value&&await d(YA(r.value,a.value))&&(a.value=``,o.value=``,s.value=``)}async function m(){l.value&&await d(JA(r.value,KA(l.value)))}let h=W(()=>GX(s.value)),g=W(()=>h.value.ok?h.value.steps:[]),_=W(()=>qX(s.value)),v=O(0);function y(e){v.value=e.target.scrollTop}return(e,t)=>(I(),L(`form`,{class:`space-y-4`,onSubmit:lu(f,[`prevent`])},[z(`div`,rZ,[B(k(gT),{for:`workflow-id`},{default:A(()=>[...t[2]||=[V(`ID`,-1)]]),_:1}),B(k(Q),{id:`workflow-id`,modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,name:`workflow-id`,required:``,autocomplete:`off`,class:`max-w-sm font-mono`},null,8,[`modelValue`])]),z(`div`,iZ,[t[3]||=z(`span`,{class:`text-sm leading-none font-medium`},`Steps`,-1),z(`div`,aZ,[g.value.length?(I(!0),L(F,{key:0},N(g.value,(e,t)=>(I(),L(F,{key:e.index},[z(`span`,{role:`listitem`,class:`shrink-0 rounded border border-border bg-secondary px-2 py-0.5 font-mono text-xs`,title:e.type},D(e.type),9,oZ),t<g.value.length-1?(I(),R(k(yd),{key:0,class:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":`true`})):H(``,!0)],64))),128)):(I(),L(`span`,sZ,`No steps yet`))])]),z(`div`,cZ,[z(`div`,lZ,[B(k(gT),{for:`workflow-yaml`},{default:A(()=>[...t[4]||=[V(`YAML`,-1)]]),_:1}),z(`span`,{class:E([`ml-auto text-xs`,h.value.ok?`text-ok`:`text-danger`]),role:`status`},D(h.value.ok?`✓`:`✕`)+` `+D(k(WX)(h.value)),3)]),z(`div`,uZ,[z(`div`,dZ,[z(`div`,{style:ve(`transform:translateY(${-v.value}px)`)},[(I(!0),L(F,null,N(_.value,e=>(I(),L(`div`,{key:e.number,class:`min-h-6 pr-2 text-fg-subtle`},D(e.number),1))),128))],4)]),z(`div`,fZ,[z(`div`,{style:ve(`transform:translateY(${-v.value}px)`)},[(I(!0),L(F,null,N(_.value,e=>(I(),L(`div`,{key:e.number,class:`min-h-6`},[(I(!0),L(F,null,N(e.tokens,(e,t)=>(I(),L(`span`,{key:t,class:E(k(KX)(e.kind))},D(e.text),3))),128))]))),128))],4)]),B(k(DT),{id:`workflow-yaml`,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,name:`workflow-yaml`,required:``,class:`relative min-h-96 resize-y rounded-none border-0 bg-transparent py-3 pr-3 pl-14 text-[13px] leading-6 text-transparent caret-foreground shadow-none md:text-[13px] focus-visible:ring-0`,spellcheck:`false`,onScroll:y},null,8,[`modelValue`])])]),c.value||n.value.error?(I(),L(`p`,pZ,D(c.value||n.value.error),1)):H(``,!0),z(`div`,mZ,[n.value.resource?(I(),L(`span`,hZ,`Version `+D(n.value.resource.version),1)):H(``,!0),a.value?(I(),R(k(Z),{key:1,type:`button`,variant:`ghost`,class:`text-danger`,onClick:p},{default:A(()=>[B(k(rf)),t[5]||=V(` Remove`,-1)]),_:1})):H(``,!0),l.value?(I(),R(k(Z),{key:2,type:`button`,variant:`outline`,onClick:m},{default:A(()=>[B(k(Xd)),t[6]||=V(` Restore this workflow`,-1)]),_:1})):H(``,!0),B(k(Z),{type:`submit`,disabled:n.value.saving||!h.value.ok},{default:A(()=>[n.value.saving?(I(),R(k(yF),{key:0,"data-icon":`inline-start`})):H(``,!0),t[7]||=V(` Validate & save`,-1)]),_:1},8,[`disabled`])])],32))}});function _Z(e,t){let n=new Map((e||[]).map(e=>[e.workflow,e])),r=[],i=new Set;for(let e of t||[])i.add(e.id),r.push({...e,...n.get(e.id)||{workflow:e.id,runs:0,merged:0,completed:0}});for(let t of e||[])i.has(t.workflow)||r
Line truncated
|
||||
Generated
+17
@@ -13,6 +13,8 @@
|
||||
"@lucide/vue": "^1.48.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vueuse/core": "^15.0.0",
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"pinia": "^4.0.3",
|
||||
@@ -2262,6 +2264,21 @@
|
||||
"vue": "^3.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@xterm/addon-fit": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.11.0.tgz",
|
||||
"integrity": "sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@xterm/xterm": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-6.0.0.tgz",
|
||||
"integrity": "sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"addons/*"
|
||||
]
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
"@lucide/vue": "^1.48.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vueuse/core": "^15.0.0",
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"pinia": "^4.0.3",
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* Harness: the OAuth credential bindings a Kit profile resolves, and the
|
||||
* setup terminal that captures a binding's tokens
|
||||
* (docs/prds/external-agent-harness.md). The binding list is a State Store
|
||||
* read; the terminal is the webui route's WebSocket, and it reports
|
||||
* explicitly when this process cannot open one rather than offering a
|
||||
* control that would fail.
|
||||
*/
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import type { BadgeVariants } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { api, ApiError } from "@/lib/api";
|
||||
import SetupTerminal from "./SetupTerminal.vue";
|
||||
import {
|
||||
bindingStatus,
|
||||
type BindingStatus,
|
||||
type HarnessBinding,
|
||||
type HarnessState,
|
||||
} from "./harness";
|
||||
|
||||
const state = ref<HarnessState | null>(null);
|
||||
const loading = ref(true);
|
||||
const failure = ref<string | null>(null);
|
||||
// "unconfigured" is a process with no control-plane resource or no token
|
||||
// store (501/503) -- the feature is off, which reads differently from a
|
||||
// process that answered badly.
|
||||
const unconfigured = ref(false);
|
||||
const profile = ref("");
|
||||
const terminalOpen = ref(false);
|
||||
|
||||
const statuses: Record<
|
||||
BindingStatus,
|
||||
{ label: string; variant: BadgeVariants["variant"] }
|
||||
> = {
|
||||
ready: { label: "Ready", variant: "ok" },
|
||||
expiring: { label: "Expiring soon", variant: "warn" },
|
||||
expired: { label: "Expired", variant: "danger" },
|
||||
unconfigured: { label: "Not set up", variant: "idle" },
|
||||
};
|
||||
|
||||
onMounted(load);
|
||||
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
failure.value = null;
|
||||
unconfigured.value = false;
|
||||
try {
|
||||
const got = await api.harnessBindings<HarnessState>();
|
||||
state.value = {
|
||||
terminal: got.terminal,
|
||||
bindings: got.bindings ?? [],
|
||||
profiles: got.profiles ?? [],
|
||||
};
|
||||
profile.value = state.value.profiles[0] ?? "";
|
||||
} catch (err) {
|
||||
const status = err instanceof ApiError ? err.status : undefined;
|
||||
if (status === 501 || status === 503) {
|
||||
unconfigured.value = true;
|
||||
} else {
|
||||
failure.value = err instanceof Error ? err.message : String(err);
|
||||
}
|
||||
state.value = null;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openTerminal(): void {
|
||||
if (!state.value?.terminal || !profile.value) return;
|
||||
terminalOpen.value = true;
|
||||
}
|
||||
|
||||
function formatTimestamp(value?: string): string {
|
||||
if (!value) return "—";
|
||||
const at = new Date(value);
|
||||
return Number.isNaN(at.getTime()) ? value : at.toLocaleString();
|
||||
}
|
||||
|
||||
function scopes(binding: HarnessBinding): string {
|
||||
return binding.scopes?.length ? binding.scopes.join(", ") : "—";
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Harness" />
|
||||
|
||||
<p v-if="failure" class="mb-4 text-sm text-danger" role="alert">
|
||||
{{ failure }}
|
||||
</p>
|
||||
|
||||
<div v-if="loading" class="space-y-2">
|
||||
<Skeleton class="h-24 w-full" />
|
||||
<Skeleton class="h-40 w-full" />
|
||||
</div>
|
||||
|
||||
<Empty v-else-if="unconfigured">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Harness bindings are not configured</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
This process cannot read credential bindings or captured OAuth tokens,
|
||||
so there is nothing to set up here.
|
||||
</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
<template v-else-if="state">
|
||||
<Alert v-if="!state.terminal" class="mb-4">
|
||||
<AlertTitle>Setup terminal unavailable</AlertTitle>
|
||||
<AlertDescription>
|
||||
This process cannot open a Kit container. The bindings below are still
|
||||
listed; the setup terminal needs a container-capable process.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<Card v-else class="mb-4">
|
||||
<CardContent class="flex flex-wrap items-end gap-3">
|
||||
<label class="flex flex-col gap-1 text-sm">
|
||||
<span class="text-muted-foreground">Kit profile</span>
|
||||
<select
|
||||
v-model="profile"
|
||||
class="h-9 min-w-48 rounded-md border border-input bg-background px-2 text-sm"
|
||||
:disabled="!state.profiles.length"
|
||||
>
|
||||
<option v-if="!state.profiles.length" value="">
|
||||
No Kit profiles configured
|
||||
</option>
|
||||
<option v-for="name in state.profiles" :key="name" :value="name">
|
||||
{{ name }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<Button :disabled="!profile" @click="openTerminal">
|
||||
Open setup terminal
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card v-if="terminalOpen && profile" class="mb-4">
|
||||
<CardContent class="h-96">
|
||||
<SetupTerminal :profile="profile" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Service</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
<TableHead>Expires</TableHead>
|
||||
<TableHead>Scopes</TableHead>
|
||||
<TableHead>Updated</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-if="!state.bindings.length">
|
||||
<TableCell colspan="5" class="text-muted-foreground">
|
||||
No credential bindings are configured.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow v-for="binding in state.bindings" :key="binding.service">
|
||||
<TableCell class="font-medium">{{ binding.service }}</TableCell>
|
||||
<TableCell>
|
||||
<Badge :variant="statuses[bindingStatus(binding)].variant">
|
||||
{{ statuses[bindingStatus(binding)].label }}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell>{{ formatTimestamp(binding.expires_at) }}</TableCell>
|
||||
<TableCell class="text-muted-foreground">{{ scopes(binding) }}</TableCell>
|
||||
<TableCell class="text-muted-foreground">
|
||||
{{ formatTimestamp(binding.updated_at) }}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,117 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* The setup terminal: an xterm.js surface over the WebSocket the webui route
|
||||
* upgrades to a Kit container's PTY
|
||||
* (docs/prds/external-agent-harness.md, "Setup terminal"). The browser cannot
|
||||
* set headers on a WebSocket, so the shared-token gate reads the same
|
||||
* HttpOnly cookie the SSE stream uses.
|
||||
*
|
||||
* The transport is raw bytes in both directions. Sizing the remote PTY is a
|
||||
* contract detail the daemon side will own with the session, so this
|
||||
* component fits the local surface but does not claim to resize the
|
||||
* container.
|
||||
*/
|
||||
import { onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { Terminal } from "@xterm/xterm";
|
||||
import { FitAddon } from "@xterm/addon-fit";
|
||||
import "@xterm/xterm/css/xterm.css";
|
||||
|
||||
import { setupTerminalURL } from "./harness";
|
||||
|
||||
const props = defineProps<{ profile: string }>();
|
||||
|
||||
const host = ref<HTMLDivElement | null>(null);
|
||||
const status = ref<"connecting" | "open" | "closed" | "failed">("connecting");
|
||||
|
||||
let term: Terminal | null = null;
|
||||
let socket: WebSocket | null = null;
|
||||
let fit: FitAddon | null = null;
|
||||
let observer: ResizeObserver | null = null;
|
||||
|
||||
function fitLocal(): void {
|
||||
try {
|
||||
fit?.fit();
|
||||
} catch {
|
||||
// xterm throws when the host has no measurable box yet; the next resize
|
||||
// (or open) retries. Fitting is cosmetic and must not fail the session.
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const mount = host.value;
|
||||
if (!mount) return;
|
||||
|
||||
term = new Terminal({
|
||||
convertEol: true,
|
||||
cursorBlink: true,
|
||||
fontFamily: "'IBM Plex Mono', ui-monospace, monospace",
|
||||
fontSize: 13,
|
||||
theme: {
|
||||
background: "#0b0f14",
|
||||
foreground: "#e6edf3",
|
||||
cursor: "#e6edf3",
|
||||
selectionBackground: "#264f78",
|
||||
},
|
||||
});
|
||||
fit = new FitAddon();
|
||||
term.loadAddon(fit);
|
||||
term.open(mount);
|
||||
fitLocal();
|
||||
term.focus();
|
||||
|
||||
const ws = new WebSocket(setupTerminalURL(props.profile, window.location));
|
||||
socket = ws;
|
||||
ws.binaryType = "arraybuffer";
|
||||
ws.onopen = () => {
|
||||
status.value = "open";
|
||||
};
|
||||
ws.onmessage = (event: MessageEvent) => {
|
||||
if (!term) return;
|
||||
if (typeof event.data === "string") {
|
||||
term.write(event.data);
|
||||
} else {
|
||||
term.write(new Uint8Array(event.data as ArrayBuffer));
|
||||
}
|
||||
};
|
||||
ws.onerror = () => {
|
||||
status.value = "failed";
|
||||
};
|
||||
ws.onclose = () => {
|
||||
status.value = "closed";
|
||||
};
|
||||
term.onData((data) => {
|
||||
if (ws.readyState === WebSocket.OPEN) ws.send(data);
|
||||
});
|
||||
|
||||
observer = new ResizeObserver(fitLocal);
|
||||
observer.observe(mount);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
observer?.disconnect();
|
||||
observer = null;
|
||||
socket?.close();
|
||||
socket = null;
|
||||
term?.dispose();
|
||||
term = null;
|
||||
fit = null;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full min-h-0 flex-col gap-2">
|
||||
<p
|
||||
v-if="status !== 'open'"
|
||||
class="text-sm text-muted-foreground"
|
||||
role="status"
|
||||
>
|
||||
<template v-if="status === 'connecting'">Connecting…</template>
|
||||
<template v-else-if="status === 'closed'">The terminal session ended.</template>
|
||||
<template v-else>Could not open the setup terminal.</template>
|
||||
</p>
|
||||
<div
|
||||
ref="host"
|
||||
class="min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* The harness page's wire shapes and payload building, kept in a plain
|
||||
* module beside the components so it runs under the dashboard's module test
|
||||
* runner (docs/development/frontend-ui.md, "Testing the dashboard").
|
||||
*
|
||||
* The setup terminal is a WebSocket because the browser cannot set headers on
|
||||
* a terminal connection: the shared-token gate reads the same HttpOnly cookie
|
||||
* the SSE stream uses.
|
||||
*/
|
||||
|
||||
/** One credential binding as GET /api/harness/bindings reports it. */
|
||||
export interface HarnessBinding {
|
||||
service: string;
|
||||
captured: boolean;
|
||||
/** RFC 3339; absent when no token set has been captured. */
|
||||
expires_at?: string;
|
||||
updated_at?: string;
|
||||
scopes?: string[];
|
||||
}
|
||||
|
||||
/** The page's whole read. */
|
||||
export interface HarnessState {
|
||||
/** Whether this process can open a setup terminal at all. */
|
||||
terminal: boolean;
|
||||
bindings: HarnessBinding[];
|
||||
/** The agent profiles that name a Kit, i.e. what a terminal can target. */
|
||||
profiles: string[];
|
||||
}
|
||||
|
||||
/** How a captured token reads on the page. */
|
||||
export type BindingStatus = "unconfigured" | "expired" | "expiring" | "ready";
|
||||
|
||||
/** A captured token this close to expiry reads as "expiring". */
|
||||
export const EXPIRING_WINDOW_MS = 30 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* bindingStatus classifies a binding's capture state. A binding with no
|
||||
* captured set is "unconfigured" whatever else it carries; a captured set
|
||||
* with no parseable expiry counts as ready, because the provider did not tell
|
||||
* archie when it lapses and guessing would be wrong.
|
||||
*/
|
||||
export function bindingStatus(
|
||||
binding: HarnessBinding,
|
||||
now: number = Date.now(),
|
||||
): BindingStatus {
|
||||
if (!binding.captured) return "unconfigured";
|
||||
if (!binding.expires_at) return "ready";
|
||||
const expires = Date.parse(binding.expires_at);
|
||||
if (Number.isNaN(expires)) return "ready";
|
||||
if (expires <= now) return "expired";
|
||||
if (expires - now <= EXPIRING_WINDOW_MS) return "expiring";
|
||||
return "ready";
|
||||
}
|
||||
|
||||
/**
|
||||
* setupTerminalURL builds the WebSocket URL for one Kit profile. The location
|
||||
* is a parameter rather than window so the module stays runnable outside a
|
||||
* browser.
|
||||
*/
|
||||
export function setupTerminalURL(
|
||||
profile: string,
|
||||
location: Pick<Location, "protocol" | "host">,
|
||||
): string {
|
||||
const scheme = location.protocol === "https:" ? "wss:" : "ws:";
|
||||
const query = new URLSearchParams({ profile }).toString();
|
||||
return `${scheme}//${location.host}/api/harness/terminal?${query}`;
|
||||
}
|
||||
@@ -258,6 +258,7 @@ export const api = {
|
||||
request<T>(`/api/bindings/${encodeURIComponent(id)}/approve`, {
|
||||
method: "POST",
|
||||
}),
|
||||
harnessBindings: <T = unknown>() => request<T>("/api/harness/bindings"),
|
||||
sources: <T = unknown>() => request<T>("/api/sources"),
|
||||
sourceCreate: <T = unknown>(path: string) =>
|
||||
request<T>("/api/sources", { method: "POST", body: { path } }),
|
||||
|
||||
@@ -51,6 +51,7 @@ const settings: NavSpec = {
|
||||
paths: [
|
||||
"/settings/task-execution",
|
||||
"/settings/container-runtime",
|
||||
"/settings/harness",
|
||||
"/settings/status",
|
||||
"/settings/advanced",
|
||||
],
|
||||
|
||||
@@ -270,6 +270,19 @@ const routes = [
|
||||
section: "settings",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/settings/harness",
|
||||
name: "settings-harness",
|
||||
// Lazy so xterm.js stays out of the shell every page loads.
|
||||
component: () => import("@/harness/HarnessPage.vue"),
|
||||
meta: {
|
||||
navPath: "/settings",
|
||||
settings: true,
|
||||
label: "Harness",
|
||||
description: "OAuth credential bindings and the Kit setup terminal.",
|
||||
section: "settings",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/settings/advanced",
|
||||
name: "system-advanced",
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
bindingStatus,
|
||||
setupTerminalURL,
|
||||
EXPIRING_WINDOW_MS,
|
||||
} from "../src/harness/harness.ts";
|
||||
|
||||
import type { HarnessBinding } from "../src/harness/harness.ts";
|
||||
|
||||
const now = Date.parse("2026-10-02T12:00:00Z");
|
||||
|
||||
function binding(overrides: Partial<HarnessBinding> = {}): HarnessBinding {
|
||||
return { service: "github", captured: false, ...overrides };
|
||||
}
|
||||
|
||||
test("an uncaptured binding reads as unconfigured", () => {
|
||||
assert.equal(bindingStatus(binding(), now), "unconfigured");
|
||||
});
|
||||
|
||||
test("a captured binding with a future expiry reads as ready", () => {
|
||||
assert.equal(
|
||||
bindingStatus(
|
||||
binding({ captured: true, expires_at: "2026-10-02T13:00:00Z" }),
|
||||
now,
|
||||
),
|
||||
"ready",
|
||||
);
|
||||
});
|
||||
|
||||
test("a captured binding inside the expiring window reads as expiring", () => {
|
||||
const almost = new Date(now + EXPIRING_WINDOW_MS - 1000).toISOString();
|
||||
assert.equal(
|
||||
bindingStatus(binding({ captured: true, expires_at: almost }), now),
|
||||
"expiring",
|
||||
);
|
||||
});
|
||||
|
||||
test("a captured binding past its expiry reads as expired", () => {
|
||||
assert.equal(
|
||||
bindingStatus(
|
||||
binding({ captured: true, expires_at: "2026-10-02T11:00:00Z" }),
|
||||
now,
|
||||
),
|
||||
"expired",
|
||||
);
|
||||
});
|
||||
|
||||
test("a capture with no parseable expiry counts as ready, not expired", () => {
|
||||
// The provider did not tell archie when the token lapses; treating that as
|
||||
// expired would be a guess, and the wrong one.
|
||||
assert.equal(
|
||||
bindingStatus(binding({ captured: true }), now),
|
||||
"ready",
|
||||
);
|
||||
assert.equal(
|
||||
bindingStatus(binding({ captured: true, expires_at: "not-a-date" }), now),
|
||||
"ready",
|
||||
);
|
||||
});
|
||||
|
||||
test("the terminal URL upgrades the scheme and carries the profile", () => {
|
||||
assert.equal(
|
||||
setupTerminalURL("claude-kit", { protocol: "http:", host: "127.0.0.1:8484" }),
|
||||
"ws://127.0.0.1:8484/api/harness/terminal?profile=claude-kit",
|
||||
);
|
||||
});
|
||||
|
||||
test("an https dashboard opens awss terminal", () => {
|
||||
assert.equal(
|
||||
setupTerminalURL("claude kit", { protocol: "https:", host: "archie.example" }),
|
||||
"wss://archie.example/api/harness/terminal?profile=claude+kit",
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user