remote-codex 0.1.6 → 0.1.8
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.
- package/apps/supervisor-api/dist/index.js +7515 -6185
- package/apps/supervisor-web/dist/assets/{highlighted-body-OFNGDK62-DvEvXPo5.js → highlighted-body-OFNGDK62-owvlMiML.js} +1 -1
- package/apps/supervisor-web/dist/assets/index-CbIt0KnL.css +32 -0
- package/apps/supervisor-web/dist/assets/index-CrcX157r.js +377 -0
- package/apps/supervisor-web/dist/assets/{xterm-CWQ1ih_R.js → xterm-BQ_J5An_.js} +1 -1
- package/apps/supervisor-web/dist/index.html +2 -2
- package/package.json +5 -1
- package/packages/agent-runtime/src/index.ts +2 -0
- package/packages/agent-runtime/src/registry.ts +44 -0
- package/packages/agent-runtime/src/types.ts +534 -0
- package/packages/codex/src/appServerManager.test.ts +328 -0
- package/packages/codex/src/appServerManager.ts +656 -0
- package/packages/codex/src/historyItems.ts +1256 -0
- package/packages/codex/src/hookHistory.ts +224 -0
- package/packages/codex/src/index.ts +6 -0
- package/packages/codex/src/jsonrpc.test.ts +58 -0
- package/packages/codex/src/jsonrpc.ts +198 -0
- package/packages/codex/src/requestMapper.test.ts +127 -0
- package/packages/codex/src/requestMapper.ts +511 -0
- package/packages/codex/src/runtimeAdapter.ts +743 -0
- package/packages/codex/src/types.ts +403 -0
- package/packages/db/migrations/0015_agent_provider_fields.sql +14 -0
- package/packages/db/migrations/0016_remove_codex_thread_goal_id.sql +46 -0
- package/packages/db/migrations/0017_remove_codex_thread_columns.sql +85 -0
- package/packages/db/src/client.ts +53 -0
- package/packages/db/src/index.ts +5 -0
- package/packages/db/src/migrate.test.ts +36 -0
- package/packages/db/src/migrate.ts +84 -0
- package/packages/db/src/repositories.ts +898 -0
- package/packages/db/src/schema.ts +177 -0
- package/packages/db/src/seed.ts +51 -0
- package/packages/shared/src/index.ts +880 -0
- package/apps/supervisor-web/dist/assets/index-CQu6sRq7.css +0 -32
- package/apps/supervisor-web/dist/assets/index-MELw9ga_.js +0 -377
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ce}from"./index-
|
|
1
|
+
import{g as Ce}from"./index-CrcX157r.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,8 +4,8 @@
|
|
|
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-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CrcX157r.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CbIt0KnL.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="bg-stone-950">
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remote-codex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Local web supervisor for Codex workspaces and threads.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
"apps/supervisor-api/dist/",
|
|
15
15
|
"apps/supervisor-web/dist/",
|
|
16
16
|
"config/codex-model-pricing.json",
|
|
17
|
+
"packages/agent-runtime/src/",
|
|
18
|
+
"packages/codex/src/",
|
|
19
|
+
"packages/db/src/",
|
|
17
20
|
"packages/db/migrations/*.sql",
|
|
21
|
+
"packages/shared/src/",
|
|
18
22
|
"README.md"
|
|
19
23
|
],
|
|
20
24
|
"packageManager": "pnpm@10.11.1",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentProviderId,
|
|
3
|
+
AgentRuntime,
|
|
4
|
+
AgentRuntimeDescriptor,
|
|
5
|
+
} from './types';
|
|
6
|
+
|
|
7
|
+
export class AgentRuntimeRegistry {
|
|
8
|
+
private readonly runtimes = new Map<AgentProviderId, AgentRuntime>();
|
|
9
|
+
|
|
10
|
+
constructor(runtimes: AgentRuntime[]) {
|
|
11
|
+
for (const runtime of runtimes) {
|
|
12
|
+
this.runtimes.set(runtime.provider, runtime);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get(provider: AgentProviderId): AgentRuntime {
|
|
17
|
+
const runtime = this.runtimes.get(provider);
|
|
18
|
+
if (!runtime) {
|
|
19
|
+
throw new Error(`Agent runtime provider is not configured: ${provider}`);
|
|
20
|
+
}
|
|
21
|
+
return runtime;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getOptional(provider: AgentProviderId): AgentRuntime | null {
|
|
25
|
+
return this.runtimes.get(provider) ?? null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
all(): AgentRuntime[] {
|
|
29
|
+
return [...this.runtimes.values()];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
list(): AgentRuntimeDescriptor[] {
|
|
33
|
+
return this.all().map((runtime, index) => ({
|
|
34
|
+
provider: runtime.provider,
|
|
35
|
+
displayName: runtime.displayName,
|
|
36
|
+
description: runtime.description,
|
|
37
|
+
enabled: true,
|
|
38
|
+
isDefault: index === 0,
|
|
39
|
+
status: runtime.getStatus(),
|
|
40
|
+
capabilities: runtime.capabilities,
|
|
41
|
+
managementSchema: runtime.managementSchema,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import type { ThreadHistoryItemDto } from '../../shared/src/index';
|
|
3
|
+
|
|
4
|
+
export type AgentProviderId = 'codex' | 'claude';
|
|
5
|
+
|
|
6
|
+
export type AgentRuntimeErrorCode =
|
|
7
|
+
| 'provider_unavailable'
|
|
8
|
+
| 'request_timeout'
|
|
9
|
+
| 'request_failed'
|
|
10
|
+
| 'remote_error'
|
|
11
|
+
| 'client_closed'
|
|
12
|
+
| 'invalid_response';
|
|
13
|
+
|
|
14
|
+
export class AgentRuntimeError extends Error {
|
|
15
|
+
constructor(
|
|
16
|
+
message: string,
|
|
17
|
+
public readonly provider: AgentProviderId,
|
|
18
|
+
public readonly code: AgentRuntimeErrorCode = 'request_failed',
|
|
19
|
+
public readonly details?: Record<string, unknown>,
|
|
20
|
+
public readonly cause?: unknown,
|
|
21
|
+
) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'AgentRuntimeError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AgentRuntimeStatus {
|
|
28
|
+
state: 'starting' | 'ready' | 'degraded' | 'stopped' | 'failed';
|
|
29
|
+
transport: 'stdio' | 'sdk' | 'none';
|
|
30
|
+
lastStartedAt: string | null;
|
|
31
|
+
lastError: string | null;
|
|
32
|
+
restartCount: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AgentProviderCapabilities {
|
|
36
|
+
sessions: {
|
|
37
|
+
list: boolean;
|
|
38
|
+
read: boolean;
|
|
39
|
+
resume: boolean;
|
|
40
|
+
importLocal: boolean;
|
|
41
|
+
};
|
|
42
|
+
turns: {
|
|
43
|
+
start: boolean;
|
|
44
|
+
streamInput: boolean;
|
|
45
|
+
steer: boolean;
|
|
46
|
+
interrupt: boolean;
|
|
47
|
+
compact: boolean;
|
|
48
|
+
};
|
|
49
|
+
branching: {
|
|
50
|
+
fork: boolean;
|
|
51
|
+
hardRollback: boolean;
|
|
52
|
+
resumeAt: boolean;
|
|
53
|
+
rewindFiles: boolean;
|
|
54
|
+
};
|
|
55
|
+
controls: {
|
|
56
|
+
planMode: boolean;
|
|
57
|
+
permissionRequests: boolean;
|
|
58
|
+
sandboxMode: boolean;
|
|
59
|
+
performanceMode: boolean;
|
|
60
|
+
goals: boolean;
|
|
61
|
+
};
|
|
62
|
+
management: {
|
|
63
|
+
models: boolean;
|
|
64
|
+
mcpStatus: boolean;
|
|
65
|
+
skills: boolean;
|
|
66
|
+
hooks: boolean;
|
|
67
|
+
hookTrust: boolean;
|
|
68
|
+
hostConfigFiles: boolean;
|
|
69
|
+
providerSettings: boolean;
|
|
70
|
+
};
|
|
71
|
+
usage: {
|
|
72
|
+
contextWindow: boolean;
|
|
73
|
+
tokenUsage: boolean;
|
|
74
|
+
costUsd: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface AgentRuntimeDescriptor {
|
|
79
|
+
provider: AgentProviderId;
|
|
80
|
+
displayName: string;
|
|
81
|
+
description: string;
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
isDefault: boolean;
|
|
84
|
+
status: AgentRuntimeStatus;
|
|
85
|
+
capabilities: AgentProviderCapabilities;
|
|
86
|
+
managementSchema: AgentRuntimeManagementSchema;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface AgentRuntimeConfigFileSchema {
|
|
90
|
+
name: string;
|
|
91
|
+
label: string;
|
|
92
|
+
description: string;
|
|
93
|
+
roles?: Array<'runtime' | 'auth' | 'mcp' | 'hooks' | 'providerSettings'>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type AgentRuntimeToolboxAction =
|
|
97
|
+
| 'fast'
|
|
98
|
+
| 'compact'
|
|
99
|
+
| 'goal'
|
|
100
|
+
| 'fork'
|
|
101
|
+
| 'skills'
|
|
102
|
+
| 'mcp'
|
|
103
|
+
| 'hooks';
|
|
104
|
+
|
|
105
|
+
export interface AgentRuntimeToolboxItemSchema {
|
|
106
|
+
action: AgentRuntimeToolboxAction;
|
|
107
|
+
command: string;
|
|
108
|
+
label: string;
|
|
109
|
+
description?: string | null;
|
|
110
|
+
panel?: 'fork' | 'skills' | 'mcp' | 'hooks' | null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type AgentRuntimeHookEventName =
|
|
114
|
+
| 'preToolUse'
|
|
115
|
+
| 'permissionRequest'
|
|
116
|
+
| 'postToolUse'
|
|
117
|
+
| 'preCompact'
|
|
118
|
+
| 'postCompact'
|
|
119
|
+
| 'sessionStart'
|
|
120
|
+
| 'userPromptSubmit'
|
|
121
|
+
| 'stop';
|
|
122
|
+
|
|
123
|
+
export interface AgentRuntimeHookCommandTemplate {
|
|
124
|
+
eventName: AgentRuntimeHookEventName;
|
|
125
|
+
command: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface AgentRuntimeManagementSchema {
|
|
129
|
+
hostConfigFiles: AgentRuntimeConfigFileSchema[];
|
|
130
|
+
toolboxItems: AgentRuntimeToolboxItemSchema[];
|
|
131
|
+
hookCommandTemplates: AgentRuntimeHookCommandTemplate[];
|
|
132
|
+
providerConfigFormat: 'toml' | 'json' | 'none';
|
|
133
|
+
mcpConfigFormat: 'codex-toml' | 'claude-json' | 'none';
|
|
134
|
+
configArchives: boolean;
|
|
135
|
+
buildRestart: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface AgentModel {
|
|
139
|
+
id: string;
|
|
140
|
+
model: string;
|
|
141
|
+
displayName: string;
|
|
142
|
+
description: string;
|
|
143
|
+
isDefault: boolean;
|
|
144
|
+
hidden: boolean;
|
|
145
|
+
supportedReasoningEfforts: Array<{
|
|
146
|
+
reasoningEffort: string;
|
|
147
|
+
description: string;
|
|
148
|
+
}>;
|
|
149
|
+
defaultReasoningEffort: string | null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type AgentSessionStatus =
|
|
153
|
+
| 'idle'
|
|
154
|
+
| 'running'
|
|
155
|
+
| 'interrupted'
|
|
156
|
+
| 'failed'
|
|
157
|
+
| 'not_loaded'
|
|
158
|
+
| 'system_error';
|
|
159
|
+
|
|
160
|
+
export interface AgentSessionSummary {
|
|
161
|
+
provider: AgentProviderId;
|
|
162
|
+
providerSessionId: string;
|
|
163
|
+
cwd: string;
|
|
164
|
+
title: string | null;
|
|
165
|
+
preview: string | null;
|
|
166
|
+
createdAt: string | null;
|
|
167
|
+
updatedAt: string | null;
|
|
168
|
+
status: AgentSessionStatus;
|
|
169
|
+
rawSession?: unknown;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type AgentHistoryItem = ThreadHistoryItemDto;
|
|
173
|
+
|
|
174
|
+
export type AgentTurnItem = AgentHistoryItem;
|
|
175
|
+
|
|
176
|
+
export interface AgentTurn {
|
|
177
|
+
providerTurnId: string;
|
|
178
|
+
rawTurnId?: string;
|
|
179
|
+
status: 'completed' | 'interrupted' | 'failed' | 'inProgress';
|
|
180
|
+
error: { message?: string } | null;
|
|
181
|
+
items: AgentHistoryItem[];
|
|
182
|
+
rawTurn?: unknown;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface AgentSessionDetail extends AgentSessionSummary {
|
|
186
|
+
turns: AgentTurn[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface StartAgentSessionInput {
|
|
190
|
+
cwd: string;
|
|
191
|
+
model: string;
|
|
192
|
+
approvalMode: 'yolo' | 'guarded';
|
|
193
|
+
sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
|
|
194
|
+
performanceMode?: 'standard' | 'fast' | null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface StartAgentSessionResult {
|
|
198
|
+
provider: AgentProviderId;
|
|
199
|
+
providerSessionId: string;
|
|
200
|
+
model: string | null;
|
|
201
|
+
reasoningEffort?: string | null;
|
|
202
|
+
sandboxMode?: string | null;
|
|
203
|
+
session: AgentSessionDetail;
|
|
204
|
+
rawSession?: unknown;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface ResumeAgentSessionInput {
|
|
208
|
+
providerSessionId: string;
|
|
209
|
+
model?: string | null;
|
|
210
|
+
sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
|
|
211
|
+
performanceMode?: 'standard' | 'fast' | null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface StartAgentTurnInput {
|
|
215
|
+
providerSessionId: string;
|
|
216
|
+
prompt: string;
|
|
217
|
+
model?: string | null;
|
|
218
|
+
reasoningEffort?: string | null;
|
|
219
|
+
collaborationMode?: 'default' | 'plan' | null;
|
|
220
|
+
sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access' | null;
|
|
221
|
+
workspacePath?: string | null;
|
|
222
|
+
performanceMode?: 'standard' | 'fast' | null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface SendAgentInputInput {
|
|
226
|
+
providerSessionId: string;
|
|
227
|
+
providerTurnId: string;
|
|
228
|
+
prompt: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface InterruptAgentTurnInput {
|
|
232
|
+
providerSessionId: string;
|
|
233
|
+
providerTurnId: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface AgentGoal {
|
|
237
|
+
providerSessionId: string;
|
|
238
|
+
objective: string;
|
|
239
|
+
status: string;
|
|
240
|
+
tokenBudget: number | null;
|
|
241
|
+
tokensUsed: number;
|
|
242
|
+
timeUsedSeconds: number;
|
|
243
|
+
createdAt: number;
|
|
244
|
+
updatedAt: number;
|
|
245
|
+
rawGoal?: unknown;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface SetAgentGoalInput {
|
|
249
|
+
providerSessionId: string;
|
|
250
|
+
objective?: string | null;
|
|
251
|
+
status?: string | null;
|
|
252
|
+
tokenBudget?: number | null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface AgentSkill {
|
|
256
|
+
name: string;
|
|
257
|
+
description: string;
|
|
258
|
+
shortDescription: string | null;
|
|
259
|
+
interface: {
|
|
260
|
+
displayName: string | null;
|
|
261
|
+
shortDescription: string | null;
|
|
262
|
+
brandColor: string | null;
|
|
263
|
+
defaultPrompt: string | null;
|
|
264
|
+
} | null;
|
|
265
|
+
path: string;
|
|
266
|
+
scope: string;
|
|
267
|
+
enabled: boolean;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface AgentSkillError {
|
|
271
|
+
path: string;
|
|
272
|
+
message: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface AgentSkillsListEntry {
|
|
276
|
+
cwd: string;
|
|
277
|
+
skills: AgentSkill[];
|
|
278
|
+
errors: AgentSkillError[];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface AgentMcpTool {
|
|
282
|
+
name: string;
|
|
283
|
+
title: string | null;
|
|
284
|
+
description: string | null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface AgentMcpServer {
|
|
288
|
+
name: string;
|
|
289
|
+
authStatus: string;
|
|
290
|
+
tools: AgentMcpTool[];
|
|
291
|
+
resourceCount: number;
|
|
292
|
+
resourceTemplateCount: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface AgentHook {
|
|
296
|
+
key: string;
|
|
297
|
+
eventName: string;
|
|
298
|
+
handlerType: string;
|
|
299
|
+
matcher: string | null;
|
|
300
|
+
command: string | null;
|
|
301
|
+
timeoutSec: number;
|
|
302
|
+
statusMessage: string | null;
|
|
303
|
+
sourcePath: string;
|
|
304
|
+
source: string;
|
|
305
|
+
pluginId: string | null;
|
|
306
|
+
displayOrder: number;
|
|
307
|
+
enabled: boolean;
|
|
308
|
+
isManaged: boolean;
|
|
309
|
+
currentHash: string;
|
|
310
|
+
trustStatus: string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface AgentHookError {
|
|
314
|
+
path: string;
|
|
315
|
+
message: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface AgentHooksListEntry {
|
|
319
|
+
cwd: string;
|
|
320
|
+
hooks: AgentHook[];
|
|
321
|
+
warnings: string[];
|
|
322
|
+
errors: AgentHookError[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface AgentProviderNotification {
|
|
326
|
+
provider: AgentProviderId;
|
|
327
|
+
method: string;
|
|
328
|
+
params?: unknown;
|
|
329
|
+
rawNotification?: unknown;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface AgentRuntimeStatusChangedEvent {
|
|
333
|
+
type: 'session.status.changed';
|
|
334
|
+
provider: AgentProviderId;
|
|
335
|
+
providerSessionId: string;
|
|
336
|
+
status: AgentSessionStatus;
|
|
337
|
+
rawStatus?: unknown;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface AgentRuntimeTitleUpdatedEvent {
|
|
341
|
+
type: 'session.title.updated';
|
|
342
|
+
provider: AgentProviderId;
|
|
343
|
+
providerSessionId: string;
|
|
344
|
+
title: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface AgentRuntimeGoalUpdatedEvent {
|
|
348
|
+
type: 'goal.updated';
|
|
349
|
+
provider: AgentProviderId;
|
|
350
|
+
providerSessionId: string;
|
|
351
|
+
providerTurnId: string | null;
|
|
352
|
+
goal: AgentGoal;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface AgentRuntimeGoalClearedEvent {
|
|
356
|
+
type: 'goal.cleared';
|
|
357
|
+
provider: AgentProviderId;
|
|
358
|
+
providerSessionId: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface AgentRuntimeUsageUpdatedEvent {
|
|
362
|
+
type: 'usage.updated';
|
|
363
|
+
provider: AgentProviderId;
|
|
364
|
+
providerSessionId: string;
|
|
365
|
+
providerTurnId: string;
|
|
366
|
+
usage: unknown;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface AgentRuntimeTurnStartedEvent {
|
|
370
|
+
type: 'turn.started';
|
|
371
|
+
provider: AgentProviderId;
|
|
372
|
+
providerSessionId: string;
|
|
373
|
+
turn: AgentTurn;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface AgentRuntimeHookEvent {
|
|
377
|
+
type: 'hook.started' | 'hook.completed';
|
|
378
|
+
provider: AgentProviderId;
|
|
379
|
+
providerSessionId: string;
|
|
380
|
+
providerTurnId: string | null;
|
|
381
|
+
item: AgentHistoryItem;
|
|
382
|
+
rawHookRun?: unknown;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface AgentRuntimeItemEvent {
|
|
386
|
+
type: 'item.started' | 'item.completed';
|
|
387
|
+
provider: AgentProviderId;
|
|
388
|
+
providerSessionId: string;
|
|
389
|
+
providerTurnId: string;
|
|
390
|
+
item: AgentHistoryItem;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface AgentRuntimePlanUpdatedEvent {
|
|
394
|
+
type: 'plan.updated';
|
|
395
|
+
provider: AgentProviderId;
|
|
396
|
+
providerSessionId: string;
|
|
397
|
+
providerTurnId: string;
|
|
398
|
+
explanation: string | null;
|
|
399
|
+
plan: Array<{ step: string; status: string }>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface AgentRuntimeOutputDeltaEvent {
|
|
403
|
+
type: 'output.delta';
|
|
404
|
+
provider: AgentProviderId;
|
|
405
|
+
providerSessionId: string;
|
|
406
|
+
providerTurnId: string;
|
|
407
|
+
itemId: string;
|
|
408
|
+
delta: string;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface AgentRuntimeTurnCompletedEvent {
|
|
412
|
+
type: 'turn.completed';
|
|
413
|
+
provider: AgentProviderId;
|
|
414
|
+
providerSessionId: string;
|
|
415
|
+
turn: AgentTurn;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface AgentRuntimeTurnFailedEvent {
|
|
419
|
+
type: 'turn.failed';
|
|
420
|
+
provider: AgentProviderId;
|
|
421
|
+
providerSessionId: string;
|
|
422
|
+
providerTurnId: string;
|
|
423
|
+
error: string;
|
|
424
|
+
willRetry?: boolean;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export type AgentRuntimeEvent =
|
|
428
|
+
| AgentRuntimeStatusChangedEvent
|
|
429
|
+
| AgentRuntimeTitleUpdatedEvent
|
|
430
|
+
| AgentRuntimeGoalUpdatedEvent
|
|
431
|
+
| AgentRuntimeGoalClearedEvent
|
|
432
|
+
| AgentRuntimeUsageUpdatedEvent
|
|
433
|
+
| AgentRuntimeTurnStartedEvent
|
|
434
|
+
| AgentRuntimeHookEvent
|
|
435
|
+
| AgentRuntimeItemEvent
|
|
436
|
+
| AgentRuntimePlanUpdatedEvent
|
|
437
|
+
| AgentRuntimeOutputDeltaEvent
|
|
438
|
+
| AgentRuntimeTurnCompletedEvent
|
|
439
|
+
| AgentRuntimeTurnFailedEvent;
|
|
440
|
+
|
|
441
|
+
export interface AgentProviderRequest {
|
|
442
|
+
provider: AgentProviderId;
|
|
443
|
+
id: string | number;
|
|
444
|
+
method: string;
|
|
445
|
+
params?: unknown;
|
|
446
|
+
rawRequest?: unknown;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface AgentActionQuestionOption {
|
|
450
|
+
label: string;
|
|
451
|
+
description: string;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export interface AgentActionQuestion {
|
|
455
|
+
id: string;
|
|
456
|
+
header: string;
|
|
457
|
+
question: string;
|
|
458
|
+
isOther: boolean;
|
|
459
|
+
isSecret: boolean;
|
|
460
|
+
options: AgentActionQuestionOption[] | null;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export interface AgentActionRequest {
|
|
464
|
+
id: string;
|
|
465
|
+
kind: 'requestUserInput';
|
|
466
|
+
title: string;
|
|
467
|
+
description: string | null;
|
|
468
|
+
turnId: string | null;
|
|
469
|
+
itemId: string | null;
|
|
470
|
+
createdAt: string;
|
|
471
|
+
questions: AgentActionQuestion[];
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export interface AgentActionRequestResponseInput {
|
|
475
|
+
answers: Record<string, { answers: string[] }>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface AgentPendingProviderRequest {
|
|
479
|
+
providerRequestId: string | number;
|
|
480
|
+
responseKind: string;
|
|
481
|
+
responsePayload?: Record<string, unknown>;
|
|
482
|
+
request: AgentActionRequest;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export interface AgentProviderRequestMapping {
|
|
486
|
+
providerRequestId: string | number;
|
|
487
|
+
providerSessionId: string;
|
|
488
|
+
autoApprovedResult: unknown | null;
|
|
489
|
+
pendingRequest: AgentPendingProviderRequest | null;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export interface AgentRuntime extends EventEmitter {
|
|
493
|
+
readonly provider: AgentProviderId;
|
|
494
|
+
readonly displayName: string;
|
|
495
|
+
readonly description: string;
|
|
496
|
+
readonly capabilities: AgentProviderCapabilities;
|
|
497
|
+
readonly managementSchema: AgentRuntimeManagementSchema;
|
|
498
|
+
|
|
499
|
+
getStatus(): AgentRuntimeStatus;
|
|
500
|
+
start(): Promise<void>;
|
|
501
|
+
stop(): Promise<void>;
|
|
502
|
+
|
|
503
|
+
listModels(): Promise<AgentModel[]>;
|
|
504
|
+
listSessions(): Promise<AgentSessionSummary[]>;
|
|
505
|
+
listLoadedSessions(): Promise<string[]>;
|
|
506
|
+
readSession(providerSessionId: string): Promise<AgentSessionDetail>;
|
|
507
|
+
startSession(input: StartAgentSessionInput): Promise<StartAgentSessionResult>;
|
|
508
|
+
resumeSession(input: ResumeAgentSessionInput): Promise<StartAgentSessionResult>;
|
|
509
|
+
|
|
510
|
+
startTurn(input: StartAgentTurnInput): Promise<AgentTurn>;
|
|
511
|
+
sendInput?(input: SendAgentInputInput): Promise<AgentTurn | null>;
|
|
512
|
+
interruptTurn(input: InterruptAgentTurnInput): Promise<AgentTurn | null>;
|
|
513
|
+
|
|
514
|
+
compactSession?(providerSessionId: string): Promise<void>;
|
|
515
|
+
forkSession?(input: { providerSessionId: string; atTurnId?: string | null }): Promise<AgentSessionDetail>;
|
|
516
|
+
rollbackSession?(input: { providerSessionId: string; count: number }): Promise<AgentSessionDetail>;
|
|
517
|
+
|
|
518
|
+
listMcpServers?(): Promise<AgentMcpServer[]>;
|
|
519
|
+
listSkills?(input?: { cwds?: string[]; forceReload?: boolean }): Promise<AgentSkillsListEntry[]>;
|
|
520
|
+
listHooks?(input?: { cwds?: string[] }): Promise<AgentHooksListEntry[]>;
|
|
521
|
+
setHookTrust?(input: { key: string; trustedHash: string | null }): Promise<unknown>;
|
|
522
|
+
mapProviderRequest?(
|
|
523
|
+
request: AgentProviderRequest,
|
|
524
|
+
options: { approvalMode: 'yolo' | 'guarded' },
|
|
525
|
+
): AgentProviderRequestMapping | null;
|
|
526
|
+
buildProviderRequestResponse?(
|
|
527
|
+
pending: AgentPendingProviderRequest,
|
|
528
|
+
input: AgentActionRequestResponseInput,
|
|
529
|
+
): unknown;
|
|
530
|
+
respondToProviderRequest?(id: string | number, result: unknown): void;
|
|
531
|
+
getGoal?(providerSessionId: string): Promise<AgentGoal | null>;
|
|
532
|
+
setGoal?(input: SetAgentGoalInput): Promise<AgentGoal>;
|
|
533
|
+
clearGoal?(providerSessionId: string): Promise<boolean>;
|
|
534
|
+
}
|