remote-codex 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{g as Ce}from"./index-nH6a8Wwn.js";function be(se,le){for(var ee=0;ee<le.length;ee++){const J=le[ee];if(typeof J!="string"&&!Array.isArray(J)){for(const V in J)if(V!=="default"&&!(V in se)){const te=Object.getOwnPropertyDescriptor(J,V);te&&Object.defineProperty(se,V,te.get?te:{enumerable:!0,get:()=>J[V]})}}}return Object.freeze(Object.defineProperty(se,Symbol.toStringTag,{value:"Module"}))}var ve={exports:{}},ge;function ye(){return ge||(ge=1,(function(se,le){(function(ee,J){se.exports=J()})(self,(()=>(()=>{var ee={4567:function(I,r,a){var c=this&&this.__decorate||function(i,o,l,v){var m,h=arguments.length,g=h<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,o,l,v);else for(var b=i.length-1;b>=0;b--)(m=i[b])&&(g=(h<3?m(g):h>3?m(o,l,g):m(o,l))||g);return h>3&&g&&Object.defineProperty(o,l,g),g},_=this&&this.__param||function(i,o){return function(l,v){o(l,v,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),d=a(6114),f=a(9924),p=a(844),u=a(5596),e=a(4725),s=a(3656);let t=r.AccessibilityManager=class extends p.Disposable{constructor(i,o){super(),this._terminal=i,this._renderService=o,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new f.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((l=>this._handleResize(l.rows)))),this.register(this._terminal.onRender((l=>this._refreshRows(l.start,l.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((l=>this._handleChar(l)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
1
+ import{g as Ce}from"./index-Rd2EBQac.js";function be(se,le){for(var ee=0;ee<le.length;ee++){const J=le[ee];if(typeof J!="string"&&!Array.isArray(J)){for(const V in J)if(V!=="default"&&!(V in se)){const te=Object.getOwnPropertyDescriptor(J,V);te&&Object.defineProperty(se,V,te.get?te:{enumerable:!0,get:()=>J[V]})}}}return Object.freeze(Object.defineProperty(se,Symbol.toStringTag,{value:"Module"}))}var ve={exports:{}},ge;function ye(){return ge||(ge=1,(function(se,le){(function(ee,J){se.exports=J()})(self,(()=>(()=>{var ee={4567:function(I,r,a){var c=this&&this.__decorate||function(i,o,l,v){var m,h=arguments.length,g=h<3?o:v===null?v=Object.getOwnPropertyDescriptor(o,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,o,l,v);else for(var b=i.length-1;b>=0;b--)(m=i[b])&&(g=(h<3?m(g):h>3?m(o,l,g):m(o,l))||g);return h>3&&g&&Object.defineProperty(o,l,g),g},_=this&&this.__param||function(i,o){return function(l,v){o(l,v,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=a(9042),d=a(6114),f=a(9924),p=a(844),u=a(5596),e=a(4725),s=a(3656);let t=r.AccessibilityManager=class extends p.Disposable{constructor(i,o){super(),this._terminal=i,this._renderService=o,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new f.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((l=>this._handleResize(l.rows)))),this.register(this._terminal.onRender((l=>this._refreshRows(l.start,l.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((l=>this._handleChar(l)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
2
2
  `)))),this.register(this._terminal.onA11yTab((l=>this._handleTab(l)))),this.register(this._terminal.onKey((l=>this._handleKey(l.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new u.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,s.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,p.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let o=0;o<i;o++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
3
3
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)),d.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,d.isMac&&this._liveRegion.remove()}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,o){this._liveRegionDebouncer.refresh(i,o,this._terminal.rows)}_renderRows(i,o){const l=this._terminal.buffer,v=l.lines.length.toString();for(let m=i;m<=o;m++){const h=l.translateBufferLineToString(l.ydisp+m,!0),g=(l.ydisp+m+1).toString(),b=this._rowElements[m];b&&(h.length===0?b.innerText=" ":b.textContent=h,b.setAttribute("aria-posinset",g),b.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,o){const l=i.target,v=this._rowElements[o===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(o===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==v)return;let m,h;if(o===0?(m=l,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(m=this._rowElements.shift(),h=l,this._rowContainer.removeChild(m)),m.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),o===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(o===0?-1:1),this._rowElements[o===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let o=this._rowContainer.children.length;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=document.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=t=c([_(1,e.IRenderService)],t)},3614:(I,r)=>{function a(d){return d.replace(/\r?\n/g,"\r")}function c(d,f){return f?"\x1B[200~"+d+"\x1B[201~":d}function _(d,f,p,u){d=c(d=a(d),p.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(d,!0),f.value=""}function n(d,f,p){const u=p.getBoundingClientRect(),e=d.clientX-u.left-10,s=d.clientY-u.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${s}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=a,r.bracketTextForPaste=c,r.copyHandler=function(d,f){d.clipboardData&&d.clipboardData.setData("text/plain",f.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,f,p,u){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),f,p,u)},r.paste=_,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,f,p,u,e){n(d,f,p),e&&u.rightClickSelect(d),f.value=u.selectionText,f.select()}},7239:(I,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=a(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(_,n,d){this._css.set(_,n,d)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,d){this._color.set(_,n,d)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(I,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(a,c,_,n){a.addEventListener(c,_,n);let d=!1;return{dispose:()=>{d||(d=!0,a.removeEventListener(c,_,n))}}}},6465:function(I,r,a){var c=this&&this.__decorate||function(e,s,t,i){var o,l=arguments.length,v=l<3?s:i===null?i=Object.getOwnPropertyDescriptor(s,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,t,i);else for(var m=e.length-1;m>=0;m--)(o=e[m])&&(v=(l<3?o(v):l>3?o(s,t,v):o(s,t))||v);return l>3&&v&&Object.defineProperty(s,t,v),v},_=this&&this.__param||function(e,s){return function(t,i){s(t,i,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const n=a(3656),d=a(8460),f=a(844),p=a(2585);let u=r.Linkifier2=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const s=this._linkProviders.indexOf(e);s!==-1&&this._linkProviders.splice(s,1)}}}attachToDom(e,s,t){this._element=e,this._mouseService=s,this._renderService=t,this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const t=e.composedPath();for(let i=0;i<t.length;i++){const o=t[i];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,s){var t,i;this._activeProviderReplies&&s||((t=this._activeProviderReplies)===null||t===void 0||t.forEach((l=>{l==null||l.forEach((v=>{v.link.dispose&&v.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let o=!1;for(const[l,v]of this._linkProviders.entries())s?!((i=this._activeProviderReplies)===null||i===void 0)&&i.get(l)&&(o=this._checkLinkProviderResult(l,e,o)):v.provideLinks(e.y,(m=>{var h,g;if(this._isMouseOut)return;const b=m==null?void 0:m.map((L=>({link:L})));(h=this._activeProviderReplies)===null||h===void 0||h.set(l,b),o=this._checkLinkProviderResult(l,e,o),((g=this._activeProviderReplies)===null||g===void 0?void 0:g.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,s){const t=new Set;for(let i=0;i<s.size;i++){const o=s.get(i);if(o)for(let l=0;l<o.length;l++){const v=o[l],m=v.link.range.start.y<e?0:v.link.range.start.x,h=v.link.range.end.y>e?this._bufferService.cols:v.link.range.end.x;for(let g=m;g<=h;g++){if(t.has(g)){o.splice(l--,1);break}t.add(g)}}}}_checkLinkProviderResult(e,s,t){var i;if(!this._activeProviderReplies)return t;const o=this._activeProviderReplies.get(e);let l=!1;for(let v=0;v<e;v++)this._activeProviderReplies.has(v)&&!this._activeProviderReplies.get(v)||(l=!0);if(!l&&o){const v=o.find((m=>this._linkAtPosition(m.link,s)));v&&(t=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let v=0;v<this._activeProviderReplies.size;v++){const m=(i=this._activeProviderReplies.get(v))===null||i===void 0?void 0:i.find((h=>this._linkAtPosition(h.link,s)));if(m){t=!0,this._handleNewLink(m);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,s){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!s||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(e.link,s)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.pointerCursor},set:t=>{var i,o;!((i=this._currentLink)===null||i===void 0)&&i.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((o=this._element)===null||o===void 0||o.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,i;return(i=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||i===void 0?void 0:i.decorations.underline},set:t=>{var i,o,l;!((i=this._currentLink)===null||i===void 0)&&i.state&&((l=(o=this._currentLink)===null||o===void 0?void 0:o.state)===null||l===void 0?void 0:l.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;const i=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(i,o),this._lastMouseEvent&&this._element)){const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}}))))}_linkHover(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(t,s.text)}_fireUnderlineEvent(e,s){const t=e.range,i=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-i-1,t.end.x,t.end.y-i-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,s,t){var i;!((i=this._currentLink)===null||i===void 0)&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(t,s.text)}_linkAtPosition(e,s){const t=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,o=s.y*this._bufferService.cols+s.x;return t<=o&&o<=i}_positionFromMouseEvent(e,s,t){const i=t.getCoords(e,s,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,s,t,i,o){return{x1:e,y1:s,x2:t,y2:i,cols:this._bufferService.cols,fg:o}}};r.Linkifier2=u=c([_(0,p.IBufferService)],u)},9042:(I,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(I,r,a){var c=this&&this.__decorate||function(u,e,s,t){var i,o=arguments.length,l=o<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(u,e,s,t);else for(var v=u.length-1;v>=0;v--)(i=u[v])&&(l=(o<3?i(l):o>3?i(e,s,l):i(e,s))||l);return o>3&&l&&Object.defineProperty(e,s,l),l},_=this&&this.__param||function(u,e){return function(s,t){e(s,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=a(511),d=a(2585);let f=r.OscLinkProvider=class{constructor(u,e,s){this._bufferService=u,this._optionsService=e,this._oscLinkService=s}provideLinks(u,e){var s;const t=this._bufferService.buffer.lines.get(u-1);if(!t)return void e(void 0);const i=[],o=this._optionsService.rawOptions.linkHandler,l=new n.CellData,v=t.getTrimmedLength();let m=-1,h=-1,g=!1;for(let b=0;b<v;b++)if(h!==-1||t.hasContent(b)){if(t.loadCell(b,l),l.hasExtendedAttrs()&&l.extended.urlId){if(h===-1){h=b,m=l.extended.urlId;continue}g=l.extended.urlId!==m}else h!==-1&&(g=!0);if(g||h!==-1&&b===v-1){const L=(s=this._oscLinkService.getLinkData(m))===null||s===void 0?void 0:s.uri;if(L){const y={start:{x:h+1,y:u},end:{x:b+(g||b!==v-1?0:1),y:u}};let k=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{const x=new URL(L);["http:","https:"].includes(x.protocol)||(k=!0)}catch{k=!0}k||i.push({text:L,range:y,activate:(x,T)=>o?o.activate(x,T,y):p(0,T),hover:(x,T)=>{var O;return(O=o==null?void 0:o.hover)===null||O===void 0?void 0:O.call(o,x,T,y)},leave:(x,T)=>{var O;return(O=o==null?void 0:o.leave)===null||O===void 0?void 0:O.call(o,x,T,y)}})}g=!1,l.hasExtendedAttrs()&&l.extended.urlId?(h=b,m=l.extended.urlId):(h=-1,m=-1)}}e(i)}};function p(u,e){if(confirm(`Do you want to navigate to ${e}?
4
4
 
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Remote Codex Supervisor</title>
7
- <script type="module" crossorigin src="/assets/index-nH6a8Wwn.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-Rd2EBQac.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CbIt0KnL.css">
9
9
  </head>
10
10
  <body class="bg-stone-950">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-codex",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Local web supervisor for Codex workspaces and threads.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -56,7 +56,7 @@ export interface AgentProviderCapabilities {
56
56
  planMode: boolean;
57
57
  permissionRequests: boolean;
58
58
  sandboxMode: boolean;
59
- fastServiceTier: boolean;
59
+ performanceMode: boolean;
60
60
  goals: boolean;
61
61
  };
62
62
  management: {
@@ -129,6 +129,8 @@ export interface AgentRuntimeManagementSchema {
129
129
  hostConfigFiles: AgentRuntimeConfigFileSchema[];
130
130
  toolboxItems: AgentRuntimeToolboxItemSchema[];
131
131
  hookCommandTemplates: AgentRuntimeHookCommandTemplate[];
132
+ providerConfigFormat: 'toml' | 'json' | 'none';
133
+ mcpConfigFormat: 'codex-toml' | 'claude-json' | 'none';
132
134
  configArchives: boolean;
133
135
  buildRestart: boolean;
134
136
  }
@@ -189,7 +191,7 @@ export interface StartAgentSessionInput {
189
191
  model: string;
190
192
  approvalMode: 'yolo' | 'guarded';
191
193
  sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
192
- serviceTier?: 'fast' | 'flex' | null;
194
+ performanceMode?: 'standard' | 'fast' | null;
193
195
  }
194
196
 
195
197
  export interface StartAgentSessionResult {
@@ -206,7 +208,7 @@ export interface ResumeAgentSessionInput {
206
208
  providerSessionId: string;
207
209
  model?: string | null;
208
210
  sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
209
- serviceTier?: 'fast' | 'flex' | null;
211
+ performanceMode?: 'standard' | 'fast' | null;
210
212
  }
211
213
 
212
214
  export interface StartAgentTurnInput {
@@ -215,8 +217,9 @@ export interface StartAgentTurnInput {
215
217
  model?: string | null;
216
218
  reasoningEffort?: string | null;
217
219
  collaborationMode?: 'default' | 'plan' | null;
218
- sandboxPolicy?: unknown;
219
- serviceTier?: 'fast' | 'flex' | null;
220
+ sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
221
+ workspacePath?: string | null;
222
+ performanceMode?: 'standard' | 'fast' | null;
220
223
  }
221
224
 
222
225
  export interface SendAgentInputInput {
@@ -366,6 +366,7 @@ export function deferLargeHistoryItemDetails(
366
366
 
367
367
  export function shouldPersistLiveHistoryItem(item: ThreadHistoryItemDto) {
368
368
  return (
369
+ item.kind === 'agentMessage' ||
369
370
  item.kind === 'commandExecution' ||
370
371
  item.kind === 'fileChange' ||
371
372
  item.kind === 'hook' ||
@@ -429,7 +430,78 @@ function sortTurnItemsByRecordedSequence(items: ThreadHistoryItemDto[]) {
429
430
  index += 1;
430
431
  }
431
432
 
432
- return [...leadingItems, ...sortHistoryItemsBySequence(items.slice(index))];
433
+ const trailingItems = items.slice(index);
434
+ if (!trailingItems.some(hasHistoryItemSequence)) {
435
+ return items;
436
+ }
437
+
438
+ const sequenceValues = trailingItems
439
+ .map((item) => historyItemSequence(item))
440
+ .filter(Number.isFinite);
441
+ const maxSequence = sequenceValues.length > 0 ? Math.max(...sequenceValues) : 0;
442
+ const orderedItems: Array<{
443
+ item: ThreadHistoryItemDto;
444
+ index: number;
445
+ order: number;
446
+ }> = [];
447
+
448
+ let cursor = 0;
449
+ while (cursor < trailingItems.length) {
450
+ const item = trailingItems[cursor]!;
451
+ if (hasHistoryItemSequence(item)) {
452
+ orderedItems.push({ item, index: cursor, order: historyItemSequence(item) });
453
+ cursor += 1;
454
+ continue;
455
+ }
456
+
457
+ const blockStart = cursor;
458
+ while (
459
+ cursor < trailingItems.length &&
460
+ !hasHistoryItemSequence(trailingItems[cursor]!)
461
+ ) {
462
+ cursor += 1;
463
+ }
464
+
465
+ const block = trailingItems.slice(blockStart, cursor);
466
+ const previousSequenced = [...trailingItems.slice(0, blockStart)]
467
+ .reverse()
468
+ .find(hasHistoryItemSequence);
469
+ const nextSequenced = trailingItems.slice(cursor).find(hasHistoryItemSequence);
470
+ const previousSequence = previousSequenced
471
+ ? historyItemSequence(previousSequenced)
472
+ : null;
473
+ const nextSequence = nextSequenced ? historyItemSequence(nextSequenced) : null;
474
+
475
+ block.forEach((blockItem, blockIndex) => {
476
+ let order: number;
477
+ if (previousSequence === null && nextSequence !== null) {
478
+ order = nextSequence - (block.length - blockIndex) / (block.length + 1);
479
+ } else if (
480
+ previousSequence !== null &&
481
+ nextSequence !== null &&
482
+ nextSequence > previousSequence
483
+ ) {
484
+ const span = nextSequence - previousSequence;
485
+ order = previousSequence + ((blockIndex + 1) / (block.length + 1)) * span;
486
+ } else {
487
+ order = maxSequence + 1 + blockIndex / (block.length + 1);
488
+ }
489
+ orderedItems.push({
490
+ item: blockItem,
491
+ index: blockStart + blockIndex,
492
+ order,
493
+ });
494
+ });
495
+ }
496
+
497
+ const sortedTrailingItems = orderedItems
498
+ .sort((left, right) => {
499
+ const orderDelta = left.order - right.order;
500
+ return orderDelta === 0 ? left.index - right.index : orderDelta;
501
+ })
502
+ .map((entry) => entry.item);
503
+
504
+ return [...leadingItems, ...sortedTrailingItems];
433
505
  }
434
506
 
435
507
  function mergeHistoryItemsBySequence(
@@ -437,11 +509,11 @@ function mergeHistoryItemsBySequence(
437
509
  missingItems: ThreadHistoryItemDto[],
438
510
  ) {
439
511
  if (missingItems.length === 0) {
440
- return items;
512
+ return sortTurnItemsByRecordedSequence(items);
441
513
  }
442
514
 
443
515
  if (!missingItems.some(hasHistoryItemSequence)) {
444
- return [...items, ...missingItems];
516
+ return sortTurnItemsByRecordedSequence([...items, ...missingItems]);
445
517
  }
446
518
 
447
519
  const mergedItems = [...items];
@@ -475,7 +547,19 @@ function mergeHistoryItemsBySequence(
475
547
  mergedItems.push(missingItem);
476
548
  }
477
549
 
478
- return mergedItems;
550
+ return sortTurnItemsByRecordedSequence(mergedItems);
551
+ }
552
+
553
+ function copyPersistedSequence(
554
+ item: ThreadHistoryItemDto,
555
+ persistedItem: ThreadHistoryItemDto,
556
+ ) {
557
+ if (!hasHistoryItemSequence(persistedItem)) {
558
+ return item;
559
+ }
560
+
561
+ const sequence = historyItemSequence(persistedItem);
562
+ return item.sequence === sequence ? item : { ...item, sequence };
479
563
  }
480
564
 
481
565
  export function mergePersistedHistoryItemsIntoTurns(
@@ -488,10 +572,6 @@ export function mergePersistedHistoryItemsIntoTurns(
488
572
  }
489
573
 
490
574
  return turns.map((turn) => {
491
- if (turn.status === 'inProgress') {
492
- return turn;
493
- }
494
-
495
575
  const persistedItems = persistedItemsByTurnId.get(turn.id);
496
576
  if (!persistedItems || persistedItems.length === 0) {
497
577
  return turn;
@@ -501,31 +581,39 @@ export function mergePersistedHistoryItemsIntoTurns(
501
581
  const persistedItemsById = new Map(persistedItems.map((item) => [item.id, item]));
502
582
  const nextItems = turn.items.map((item) => {
503
583
  const persistedItem = persistedItemsById.get(item.id);
504
- if (
505
- !persistedItem ||
506
- item.kind !== persistedItem.kind ||
507
- (persistedItem.kind !== 'commandExecution' && persistedItem.kind !== 'toolCall')
508
- ) {
584
+ if (!persistedItem) {
509
585
  return item;
510
586
  }
511
587
 
512
- const existingText = item.detailText?.trim() || item.text.trim();
513
- const persistedText = persistedItem.detailText?.trim() || persistedItem.text.trim();
514
- if (persistedText.length <= existingText.length) {
588
+ persistedItemsById.delete(item.id);
589
+
590
+ if (item.kind !== persistedItem.kind) {
515
591
  return item;
516
592
  }
517
593
 
518
- changed = true;
519
- persistedItemsById.delete(item.id);
520
- return persistedItem.kind === 'commandExecution'
521
- ? deferCommandHistoryItem(
522
- persistedItem as ThreadHistoryItemDto & { kind: 'commandExecution' },
523
- deferredDetails,
524
- )
525
- : deferToolCallHistoryItem(
526
- persistedItem as ThreadHistoryItemDto & { kind: 'toolCall' },
527
- deferredDetails,
528
- );
594
+ const sequencedItem = copyPersistedSequence(item, persistedItem);
595
+ if (sequencedItem !== item) {
596
+ changed = true;
597
+ }
598
+
599
+ if (persistedItem.kind === 'commandExecution' || persistedItem.kind === 'toolCall') {
600
+ const existingText = item.detailText?.trim() || item.text.trim();
601
+ const persistedText = persistedItem.detailText?.trim() || persistedItem.text.trim();
602
+ if (persistedText.length > existingText.length) {
603
+ changed = true;
604
+ return persistedItem.kind === 'commandExecution'
605
+ ? deferCommandHistoryItem(
606
+ persistedItem as ThreadHistoryItemDto & { kind: 'commandExecution' },
607
+ deferredDetails,
608
+ )
609
+ : deferToolCallHistoryItem(
610
+ persistedItem as ThreadHistoryItemDto & { kind: 'toolCall' },
611
+ deferredDetails,
612
+ );
613
+ }
614
+ }
615
+
616
+ return sequencedItem;
529
617
  });
530
618
 
531
619
  const existingItemIds = new Set(nextItems.map((item) => item.id));
@@ -77,7 +77,7 @@ export const codexCapabilities: AgentProviderCapabilities = {
77
77
  planMode: true,
78
78
  permissionRequests: true,
79
79
  sandboxMode: true,
80
- fastServiceTier: true,
80
+ performanceMode: true,
81
81
  goals: true,
82
82
  },
83
83
  management: {
@@ -163,6 +163,51 @@ function mapGoal(goal: CodexThreadGoalRecord): AgentGoal {
163
163
  };
164
164
  }
165
165
 
166
+ function serviceTierForPerformanceMode(
167
+ performanceMode: StartAgentSessionInput['performanceMode'],
168
+ ): 'fast' | null | undefined {
169
+ if (performanceMode === undefined) {
170
+ return undefined;
171
+ }
172
+ return performanceMode === 'fast' ? 'fast' : null;
173
+ }
174
+
175
+ function buildSandboxPolicy(
176
+ sandboxMode: StartAgentTurnInput['sandboxMode'],
177
+ workspacePath: StartAgentTurnInput['workspacePath'],
178
+ ): SandboxPolicy | null | undefined {
179
+ if (sandboxMode === undefined) {
180
+ return undefined;
181
+ }
182
+
183
+ switch (sandboxMode) {
184
+ case 'danger-full-access':
185
+ return {
186
+ type: 'dangerFullAccess',
187
+ };
188
+ case 'read-only':
189
+ return {
190
+ type: 'readOnly',
191
+ access: {
192
+ type: 'fullAccess',
193
+ },
194
+ networkAccess: false,
195
+ };
196
+ case 'workspace-write':
197
+ default:
198
+ return {
199
+ type: 'workspaceWrite',
200
+ writableRoots: workspacePath ? [workspacePath] : [],
201
+ readOnlyAccess: {
202
+ type: 'fullAccess',
203
+ },
204
+ networkAccess: false,
205
+ excludeTmpdirEnvVar: false,
206
+ excludeSlashTmp: false,
207
+ };
208
+ }
209
+ }
210
+
166
211
  function mapSession(thread: CodexThreadRecord): AgentSessionDetail {
167
212
  return {
168
213
  provider: 'codex',
@@ -451,6 +496,8 @@ export class CodexRuntimeAdapter extends EventEmitter implements AgentRuntime {
451
496
  'node -e \'process.stdin.resume(); process.stdin.on("end", () => console.log(JSON.stringify({ systemMessage: "remote-codex hook ran" })))\'',
452
497
  },
453
498
  ],
499
+ providerConfigFormat: 'toml',
500
+ mcpConfigFormat: 'codex-toml',
454
501
  configArchives: true,
455
502
  buildRestart: true,
456
503
  };
@@ -539,8 +586,9 @@ export class CodexRuntimeAdapter extends EventEmitter implements AgentRuntime {
539
586
  if (input.sandboxMode !== undefined) {
540
587
  startInput.sandbox = input.sandboxMode as SandboxMode | null;
541
588
  }
542
- if (input.serviceTier !== undefined) {
543
- startInput.serviceTier = input.serviceTier;
589
+ const serviceTier = serviceTierForPerformanceMode(input.performanceMode);
590
+ if (serviceTier !== undefined) {
591
+ startInput.serviceTier = serviceTier;
544
592
  }
545
593
 
546
594
  const response = await codexRuntimeCall(() => this.manager.startThread(startInput));
@@ -565,8 +613,9 @@ export class CodexRuntimeAdapter extends EventEmitter implements AgentRuntime {
565
613
  if (input.sandboxMode !== undefined) {
566
614
  resumeInput.sandbox = input.sandboxMode as SandboxMode | null;
567
615
  }
568
- if (input.serviceTier !== undefined) {
569
- resumeInput.serviceTier = input.serviceTier;
616
+ const serviceTier = serviceTierForPerformanceMode(input.performanceMode);
617
+ if (serviceTier !== undefined) {
618
+ resumeInput.serviceTier = serviceTier;
570
619
  }
571
620
 
572
621
  const response = await codexRuntimeCall(() => this.manager.resumeThread(resumeInput));
@@ -595,11 +644,13 @@ export class CodexRuntimeAdapter extends EventEmitter implements AgentRuntime {
595
644
  if (input.collaborationMode !== undefined) {
596
645
  turnInput.collaborationMode = input.collaborationMode;
597
646
  }
598
- if (input.sandboxPolicy !== undefined) {
599
- turnInput.sandboxPolicy = input.sandboxPolicy as SandboxPolicy | null;
647
+ const sandboxPolicy = buildSandboxPolicy(input.sandboxMode, input.workspacePath);
648
+ if (sandboxPolicy !== undefined) {
649
+ turnInput.sandboxPolicy = sandboxPolicy;
600
650
  }
601
- if (input.serviceTier !== undefined) {
602
- turnInput.serviceTier = input.serviceTier;
651
+ const serviceTier = serviceTierForPerformanceMode(input.performanceMode);
652
+ if (serviceTier !== undefined) {
653
+ turnInput.serviceTier = serviceTier;
603
654
  }
604
655
 
605
656
  return mapTurn(await codexRuntimeCall(() => this.manager.startTurn(turnInput)));
@@ -109,6 +109,7 @@ export interface UpsertThreadGoalRecordInput {
109
109
  threadId: string;
110
110
  providerSessionId: string;
111
111
  localGoalId?: string | null;
112
+ createNew?: boolean;
112
113
  objective: string;
113
114
  status: string;
114
115
  tokenBudget?: number | null;
@@ -635,6 +636,10 @@ function getThreadGoalRecordForUpsert(
635
636
  db: DatabaseClient,
636
637
  input: UpsertThreadGoalRecordInput,
637
638
  ) {
639
+ if (input.createNew) {
640
+ return null;
641
+ }
642
+
638
643
  if (input.localGoalId) {
639
644
  const byId = db
640
645
  .select()
@@ -647,7 +652,7 @@ function getThreadGoalRecordForUpsert(
647
652
  }
648
653
 
649
654
  const active = getActiveThreadGoalRecord(db, input.threadId);
650
- if (active) {
655
+ if (active && active.objective === input.objective) {
651
656
  return active;
652
657
  }
653
658
 
@@ -2,7 +2,7 @@ export type ApiErrorCode =
2
2
  | 'bad_request'
3
3
  | 'not_found'
4
4
  | 'conflict'
5
- | 'codex_goal_error'
5
+ | 'provider_goal_error'
6
6
  | 'forbidden'
7
7
  | 'goal_feature_disabled'
8
8
  | 'internal_error'
@@ -57,7 +57,7 @@ export interface AgentProviderCapabilitiesDto {
57
57
  planMode: boolean;
58
58
  permissionRequests: boolean;
59
59
  sandboxMode: boolean;
60
- fastServiceTier: boolean;
60
+ performanceMode: boolean;
61
61
  goals: boolean;
62
62
  };
63
63
  management: {
@@ -120,6 +120,8 @@ export interface AgentBackendManagementSchemaDto {
120
120
  hostConfigFiles: AgentBackendConfigFileSchemaDto[];
121
121
  toolboxItems: AgentBackendToolboxItemSchemaDto[];
122
122
  hookCommandTemplates: AgentBackendHookCommandTemplateDto[];
123
+ providerConfigFormat: 'toml' | 'json' | 'none';
124
+ mcpConfigFormat: 'codex-toml' | 'claude-json' | 'none';
123
125
  configArchives: boolean;
124
126
  buildRestart: boolean;
125
127
  }