@wular/coder 0.1.13 → 0.1.15

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,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
- var $t=Object.defineProperty;var Tt=(t,u)=>{for(var r in u)$t(t,r,{get:u[r],enumerable:!0,configurable:!0,set:(n)=>u[r]=()=>n})};import m from"node:fs";import At from"node:net";import T from"node:path";import S from"node:process";function p(t,u={}){let r=new Set(u.valueOptions??[]),n=new Set(u.booleanOptions??[]),i=u.aliasMap??{},f={},a=[],x=!1;for(let $=0;$<t.length;$+=1){let y=t[$];if(x){a.push(y);continue}if(y==="--"){x=!0;continue}if(!y.startsWith("-")||y==="-"){a.push(y);continue}if(y.startsWith("--")){let[J,z]=y.slice(2).split("=",2),N=i[J]??J;if(n.has(N)){f[N]=z===void 0?!0:z!=="false";continue}if(r.has(N)){let Q=z??t[$+1];if(Q===void 0)throw Error(`Missing value for --${J}`);if(f[N]=Q,z===void 0)$+=1;continue}throw Error(`Unknown option --${J} (use -- to pass literal text starting with -)`)}let j=y.slice(1),O=i[j]??j;if(n.has(O)){f[O]=!0;continue}if(r.has(O)){let J=t[$+1];if(J===void 0)throw Error(`Missing value for -${j}`);f[O]=J,$+=1;continue}throw Error(`Unknown option -${j} (use -- to pass literal text starting with -)`)}return{options:f,positionals:a}}import Kt from"node:net";import w from"node:process";import{spawn as vt}from"node:child_process";import Lt from"node:readline";import B from"node:path";import bt from"node:process";function lt(t){return String(t??"").replace(/[^A-Za-z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}function F(t,u=bt.platform){if(u==="win32")return`pipe:\\\\.\\pipe\\${lt(`${B.win32.basename(t)}-codex-app-server`)}`;return`unix:${B.join(t,"broker.sock")}`}function R(t){if(typeof t!=="string"||t.length===0)throw Error("Missing broker endpoint.");if(t.startsWith("pipe:")){let u=t.slice(5);if(!u)throw Error("Broker pipe endpoint is missing its path.");return{kind:"pipe",path:u}}if(t.startsWith("unix:")){let u=t.slice(5);if(!u)throw Error("Broker Unix socket endpoint is missing its path.");return{kind:"unix",path:u}}throw Error(`Unsupported broker endpoint: ${t}`)}import l from"node:fs";import Wt from"node:net";import Nt from"node:os";import V from"node:path";import L from"node:process";import{spawn as Rt}from"node:child_process";import{fileURLToPath as zt}from"node:url";import{createHash as jt}from"node:crypto";import{execFileSync as Jt}from"node:child_process";import H from"node:fs";import Ot from"node:os";import M from"node:path";var ot="CODER_HOME";function Mt(){return M.resolve(process.env[ot]||M.join(Ot.homedir(),".coder"))}function Ht(t){try{return Jt("git",["rev-parse","--show-toplevel"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return t}}function Y(t){let u=Ht(t),r=u;try{r=H.realpathSync.native(u)}catch{r=u}let i=(M.basename(u)||"workspace").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"workspace",f=jt("sha256").update(r).digest("hex").slice(0,12);return M.join(Mt(),"state",`${i}-${f}`)}function g(t){return M.join(Y(t),"jobs")}function C(t,u){return M.join(g(t),u)}function uu(){let t=Math.random().toString(36).slice(2,8);return`coder-${Date.now().toString(36)}-${t}`}function ru(t,u,r){let n=C(t,u);H.mkdirSync(n,{recursive:!0});let i=M.join(n,"job.json"),a={...d(t,u)??{id:u,createdAt:new Date().toISOString()},...r,updatedAt:new Date().toISOString()};return H.writeFileSync(i,`${JSON.stringify(a,null,2)}
3
- `,"utf8"),a}function d(t,u){let r=M.join(C(t,u),"job.json");if(!H.existsSync(r))return null;try{return JSON.parse(H.readFileSync(r,"utf8"))}catch{return null}}function St(t){let u=g(t);if(!H.existsSync(u))return[];return H.readdirSync(u).map((r)=>d(t,r)).filter(Boolean).sort((r,n)=>String(n.updatedAt??"").localeCompare(String(r.updatedAt??"")))}function nu(t,u){let r=St(t);if(!u)return r[0]??null;let n=r.find((f)=>f.id===u);if(n)return n;let i=r.filter((f)=>f.id.startsWith(u));if(i.length===1)return i[0];if(i.length>1)throw Error(`Job reference "${u}" is ambiguous. Use a longer id.`);return null}function fu(t,u,r){let n=C(t,u);H.mkdirSync(n,{recursive:!0}),H.appendFileSync(M.join(n,"log.jsonl"),`${JSON.stringify({at:new Date().toISOString(),...r})}
4
- `,"utf8")}function cu(t,u,r=40){let n=M.join(C(t,u),"log.jsonl");if(!H.existsSync(n))return[];return H.readFileSync(n,"utf8").split(/\r?\n/).filter(Boolean).slice(-r).map((f)=>{try{return JSON.parse(f)}catch{return{message:f}}})}var Gt="broker.json";function Vt(t="coder-"){return l.mkdtempSync(V.join(Nt.tmpdir(),t))}function Zt(t){let u=R(t);return Wt.createConnection({path:u.path})}async function s(t,u=2000){let r=Date.now();while(Date.now()-r<u){if(await new Promise((i)=>{let f=Zt(t);f.on("connect",()=>{f.end(),i(!0)}),f.on("error",()=>i(!1))}))return!0;await new Promise((i)=>setTimeout(i,50))}return!1}function mt({scriptPath:t,cwd:u,endpoint:r,pidFile:n,logFile:i,env:f=L.env}){let a=l.openSync(i,"a"),x=Rt(L.execPath,[t,"serve","--endpoint",r,"--cwd",u,"--pid-file",n],{cwd:u,env:f,detached:!0,stdio:["ignore",a,a]});return x.unref(),l.closeSync(a),x}function qt(){let t=[new URL("./lib/broker.js",import.meta.url),new URL("./broker.js",import.meta.url)];for(let u of t){let r=zt(u);if(l.existsSync(r))return r}throw Error("Coder broker script not found next to the runtime. Rebuild with `bun run build`.")}function A(t){return V.join(Y(t),Gt)}function E(t){let u=A(t);if(!l.existsSync(u))return null;try{return JSON.parse(l.readFileSync(u,"utf8"))}catch{return null}}function wt(t,u){let r=Y(t);l.mkdirSync(r,{recursive:!0}),l.writeFileSync(A(t),`${JSON.stringify(u,null,2)}
5
- `,"utf8")}function Qt(t){let u=A(t);if(l.existsSync(u))l.unlinkSync(u)}async function Ut(t){if(!t)return!1;try{return await s(t,150)}catch{return!1}}async function tt(t,u={}){let r=E(t);if(r&&await Ut(r.endpoint))return r;if(r)e({endpoint:r.endpoint??null,pidFile:r.pidFile??null,logFile:r.logFile??null,sessionDir:r.sessionDir??null,pid:r.pid??null,killProcess:u.killProcess??null}),Qt(t);let n=Vt(),f=(u.createBrokerEndpoint??F)(n,u.platform),a=V.join(n,"broker.pid"),x=V.join(n,"broker.log"),$=u.scriptPath??qt(),y=mt({scriptPath:$,cwd:t,endpoint:f,pidFile:a,logFile:x,env:u.env??L.env});if(!await s(f,u.timeoutMs??2000))return e({endpoint:f,pidFile:a,logFile:x,sessionDir:n,pid:y.pid??null,killProcess:u.killProcess??null}),null;let O={endpoint:f,pidFile:a,logFile:x,sessionDir:n,pid:y.pid??null};return wt(t,O),O}function e({endpoint:t=null,pidFile:u,logFile:r,sessionDir:n=null,pid:i=null,killProcess:f=null}){if(Number.isFinite(i)&&f)try{f(i)}catch{}if(u&&l.existsSync(u))l.unlinkSync(u);if(r&&l.existsSync(r))l.unlinkSync(r);if(t)try{let x=R(t);if(x.kind==="unix"&&l.existsSync(x.path))l.unlinkSync(x.path)}catch{}let a=n??(u?V.dirname(u):r?V.dirname(r):null);if(a&&l.existsSync(a))try{l.rmdirSync(a)}catch{}}import{spawnSync as Xt}from"node:child_process";import q from"node:process";function ut(t,u=[],r={}){let n=Xt(t,u,{cwd:r.cwd,env:r.env,encoding:"utf8",input:r.input,maxBuffer:r.maxBuffer,stdio:r.stdio??"pipe",shell:q.platform==="win32"?q.env.SHELL||!0:!1,windowsHide:!0});return{command:t,args:u,status:n.status??0,signal:n.signal??null,stdout:n.stdout??"",stderr:n.stderr??"",error:n.error??null}}function Hu(t,u=["--version"],r={}){let n=ut(t,u,r);if(n.error&&n.error.code==="ENOENT")return{available:!1,detail:"not found"};if(n.error)return{available:!1,detail:n.error.message};if(n.status!==0)return{available:!1,detail:n.stderr.trim()||n.stdout.trim()||`exit ${n.status}`};return{available:!0,detail:n.stdout.trim()||n.stderr.trim()||"ok"}}function Yt(t){return/not found|no running instance|cannot find|does not exist|no such process/i.test(t)}function rt(t,u={}){if(!Number.isFinite(t))return{attempted:!1,delivered:!1,method:null};let r=u.platform??q.platform,n=u.runCommandImpl??ut,i=u.killImpl??q.kill.bind(q);if(r==="win32"){let f=n("taskkill",["/PID",String(t),"/T","/F"],{cwd:u.cwd,env:u.env});if(!f.error&&f.status===0)return{attempted:!0,delivered:!0,method:"taskkill",result:f};let a=`${f.stderr}
6
- ${f.stdout}`.trim();if(!f.error&&Yt(a))return{attempted:!0,delivered:!1,method:"taskkill",result:f};if(f.error?.code==="ENOENT")try{return i(t),{attempted:!0,delivered:!0,method:"kill"}}catch(x){if(x?.code==="ESRCH")return{attempted:!0,delivered:!1,method:"kill"};throw x}if(f.error)throw f.error;throw Error(Ct(f))}try{return i(-t,"SIGTERM"),{attempted:!0,delivered:!0,method:"process-group"}}catch(f){if(f?.code!=="ESRCH")try{return i(t,"SIGTERM"),{attempted:!0,delivered:!0,method:"process"}}catch(a){if(a?.code==="ESRCH")return{attempted:!0,delivered:!1,method:"process"};throw a}return{attempted:!0,delivered:!1,method:"process-group"}}}function Ct(t){let u=[`${t.command} ${t.args.join(" ")}`.trim()];if(t.signal)u.push(`signal=${t.signal}`);else u.push(`exit=${t.status}`);let r=(t.stderr||"").trim(),n=(t.stdout||"").trim();if(r)u.push(r);else if(n)u.push(n);return u.join(": ")}var nt="CODER_APP_SERVER_ENDPOINT",ct=-32001,it={title:"Coder",name:"coder",version:"0.1.0"},ht={experimentalApi:!1,requestAttestation:!1,optOutNotificationMethods:["item/agentMessage/delta","item/reasoning/summaryTextDelta","item/reasoning/summaryPartAdded","item/reasoning/textDelta"]};function ft(t,u,r){return r===void 0?{code:t,message:u}:{code:t,message:u,data:r}}function P(t,u){let r=Error(t);if(r.data=u,u?.code!==void 0)r.rpcCode=u.code;return r}class _{cwd;options;pending;nextId;stderr;closed;exitError;notificationHandler;serverRequestHandler;lineBuffer;transport;exitPromise;exitResolved;resolveExit;handleServerRequest;constructor(t,u={}){this.cwd=t,this.options=u,this.pending=new Map,this.nextId=1,this.stderr="",this.closed=!1,this.exitError=null,this.notificationHandler=null,this.serverRequestHandler=null,this.lineBuffer="",this.transport="unknown",this.handleServerRequest=(r)=>this.defaultHandleServerRequest(r),this.exitPromise=new Promise((r)=>{this.resolveExit=r})}setNotificationHandler(t){this.notificationHandler=t}setServerRequestHandler(t){this.serverRequestHandler=t}request(t,u){if(this.closed)throw Error("codex app-server client is closed.");let r=this.nextId;return this.nextId+=1,new Promise((n,i)=>{this.pending.set(r,{resolve:n,reject:i,method:t}),this.sendMessage({id:r,method:t,params:u})})}notify(t,u={}){if(this.closed)return;this.sendMessage({method:t,params:u})}handleChunk(t){this.lineBuffer+=t;let u=this.lineBuffer.indexOf(`
2
+ var bt=Object.defineProperty;var pt=(t,u)=>{for(var r in u)bt(t,r,{get:u[r],enumerable:!0,configurable:!0,set:(n)=>u[r]=()=>n})};import q from"node:fs";import Ct from"node:net";import k from"node:path";import S from"node:process";function F(t,u={}){let r=new Set(u.valueOptions??[]),n=new Set(u.booleanOptions??[]),c=u.aliasMap??{},f={},y=[],x=!1;for(let $=0;$<t.length;$+=1){let a=t[$];if(x){y.push(a);continue}if(a==="--"){x=!0;continue}if(!a.startsWith("-")||a==="-"){y.push(a);continue}if(a.startsWith("--")){let[J,G]=a.slice(2).split("=",2),z=c[J]??J;if(n.has(z)){f[z]=G===void 0?!0:G!=="false";continue}if(r.has(z)){let Y=G??t[$+1];if(Y===void 0)throw Error(`Missing value for --${J}`);if(f[z]=Y,G===void 0)$+=1;continue}throw Error(`Unknown option --${J} (use -- to pass literal text starting with -)`)}let j=a.slice(1),O=c[j]??j;if(n.has(O)){f[O]=!0;continue}if(r.has(O)){let J=t[$+1];if(J===void 0)throw Error(`Missing value for -${j}`);f[O]=J,$+=1;continue}throw Error(`Unknown option -${j} (use -- to pass literal text starting with -)`)}return{options:f,positionals:y}}import vt from"node:net";import Q from"node:process";import{spawn as Et}from"node:child_process";import At from"node:readline";import g from"node:path";import lt from"node:process";function jt(t){return String(t??"").replace(/[^A-Za-z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}function d(t,u=lt.platform){if(u==="win32")return`pipe:\\\\.\\pipe\\${jt(`${g.win32.basename(t)}-codex-app-server`)}`;return`unix:${g.join(t,"broker.sock")}`}function R(t){if(typeof t!=="string"||t.length===0)throw Error("Missing broker endpoint.");if(t.startsWith("pipe:")){let u=t.slice(5);if(!u)throw Error("Broker pipe endpoint is missing its path.");return{kind:"pipe",path:u}}if(t.startsWith("unix:")){let u=t.slice(5);if(!u)throw Error("Broker Unix socket endpoint is missing its path.");return{kind:"unix",path:u}}throw Error(`Unsupported broker endpoint: ${t}`)}import l from"node:fs";import zt from"node:net";import Rt from"node:os";import Z from"node:path";import A from"node:process";import{spawn as Gt}from"node:child_process";import{fileURLToPath as Ut}from"node:url";import{createHash as Jt}from"node:crypto";import{execFileSync as Ot}from"node:child_process";import N from"node:fs";import Mt from"node:os";import H from"node:path";var Ht="CODER_HOME";function Nt(){return H.resolve(process.env[Ht]||H.join(Mt.homedir(),".coder"))}function St(t){try{return Ot("git",["rev-parse","--show-toplevel"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return t}}function m(t){let u=St(t),r=u;try{r=N.realpathSync.native(u)}catch{r=u}let c=(H.basename(u)||"workspace").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"workspace",f=Jt("sha256").update(r).digest("hex").slice(0,12);return H.join(Nt(),"state",`${c}-${f}`)}function e(t){return H.join(m(t),"jobs")}function L(t,u){return H.join(e(t),u)}function fu(){let t=Math.random().toString(36).slice(2,8);return`coder-${Date.now().toString(36)}-${t}`}function iu(t,u,r){let n=L(t,u);N.mkdirSync(n,{recursive:!0});let c=H.join(n,"job.json"),y={...s(t,u)??{id:u,createdAt:new Date().toISOString()},...r,updatedAt:new Date().toISOString()};return N.writeFileSync(c,`${JSON.stringify(y,null,2)}
3
+ `,"utf8"),y}function s(t,u){let r=H.join(L(t,u),"job.json");if(!N.existsSync(r))return null;try{return JSON.parse(N.readFileSync(r,"utf8"))}catch{return null}}function Wt(t){let u=e(t);if(!N.existsSync(u))return[];return N.readdirSync(u).map((r)=>s(t,r)).filter(Boolean).sort((r,n)=>String(n.updatedAt??"").localeCompare(String(r.updatedAt??"")))}function cu(t,u){let r=Wt(t);if(!u)return r[0]??null;let n=r.find((f)=>f.id===u);if(n)return n;let c=r.filter((f)=>f.id.startsWith(u));if(c.length===1)return c[0];if(c.length>1)throw Error(`Job reference "${u}" is ambiguous. Use a longer id.`);return null}function hu(t,u,r){let n=L(t,u);N.mkdirSync(n,{recursive:!0}),N.appendFileSync(H.join(n,"log.jsonl"),`${JSON.stringify({at:new Date().toISOString(),...r})}
4
+ `,"utf8")}function yu(t,u,r=40){let n=H.join(L(t,u),"log.jsonl");if(!N.existsSync(n))return[];return N.readFileSync(n,"utf8").split(/\r?\n/).filter(Boolean).slice(-r).map((f)=>{try{return JSON.parse(f)}catch{return{message:f}}})}var Zt="broker.json";function ot(t="coder-"){return l.mkdtempSync(Z.join(Rt.tmpdir(),t))}function qt(t){let u=R(t);return zt.createConnection({path:u.path})}async function ut(t,u=2000){let r=Date.now();while(Date.now()-r<u){if(await new Promise((c)=>{let f=qt(t);f.on("connect",()=>{f.end(),c(!0)}),f.on("error",()=>c(!1))}))return!0;await new Promise((c)=>setTimeout(c,50))}return!1}function wt({scriptPath:t,cwd:u,endpoint:r,pidFile:n,logFile:c,env:f=A.env}){let y=l.openSync(c,"a"),x=Gt(A.execPath,[t,"serve","--endpoint",r,"--cwd",u,"--pid-file",n],{cwd:u,env:f,detached:!0,stdio:["ignore",y,y]});return x.unref(),l.closeSync(y),x}function Qt(){let t=[new URL("./lib/broker.js",import.meta.url),new URL("./broker.js",import.meta.url)];for(let u of t){let r=Ut(u);if(l.existsSync(r))return r}throw Error("Coder broker script not found next to the runtime. Rebuild with `bun run build`.")}function T(t){return Z.join(m(t),Zt)}function _(t){let u=T(t);if(!l.existsSync(u))return null;try{return JSON.parse(l.readFileSync(u,"utf8"))}catch{return null}}function Yt(t,u){let r=m(t);l.mkdirSync(r,{recursive:!0}),l.writeFileSync(T(t),`${JSON.stringify(u,null,2)}
5
+ `,"utf8")}function Xt(t){let u=T(t);if(l.existsSync(u))l.unlinkSync(u)}async function Kt(t){if(!t)return!1;try{return await ut(t,150)}catch{return!1}}async function rt(t,u={}){let r=_(t);if(r&&await Kt(r.endpoint))return r;if(r)tt({endpoint:r.endpoint??null,pidFile:r.pidFile??null,logFile:r.logFile??null,sessionDir:r.sessionDir??null,pid:r.pid??null,killProcess:u.killProcess??null}),Xt(t);let n=ot(),f=(u.createBrokerEndpoint??d)(n,u.platform),y=Z.join(n,"broker.pid"),x=Z.join(n,"broker.log"),$=u.scriptPath??Qt(),a=wt({scriptPath:$,cwd:t,endpoint:f,pidFile:y,logFile:x,env:u.env??A.env});if(!await ut(f,u.timeoutMs??2000))return tt({endpoint:f,pidFile:y,logFile:x,sessionDir:n,pid:a.pid??null,killProcess:u.killProcess??null}),null;let O={endpoint:f,pidFile:y,logFile:x,sessionDir:n,pid:a.pid??null};return Yt(t,O),O}function tt({endpoint:t=null,pidFile:u,logFile:r,sessionDir:n=null,pid:c=null,killProcess:f=null}){if(Number.isFinite(c)&&f)try{f(c)}catch{}if(u&&l.existsSync(u))l.unlinkSync(u);if(r&&l.existsSync(r))l.unlinkSync(r);if(t)try{let x=R(t);if(x.kind==="unix"&&l.existsSync(x.path))l.unlinkSync(x.path)}catch{}let y=n??(u?Z.dirname(u):r?Z.dirname(r):null);if(y&&l.existsSync(y))try{l.rmdirSync(y)}catch{}}import{spawnSync as mt}from"node:child_process";import w from"node:process";function V(t,u=[],r={}){let n=mt(t,u,{cwd:r.cwd,env:r.env,encoding:"utf8",input:r.input,maxBuffer:r.maxBuffer,stdio:r.stdio??"pipe",shell:w.platform==="win32"?w.env.SHELL||!0:!1,windowsHide:!0});return{command:t,args:u,status:n.status??0,signal:n.signal??null,stdout:n.stdout??"",stderr:n.stderr??"",error:n.error??null}}function zu(t,u=["--version"],r={}){let n=V(t,u,r);if(n.error&&n.error.code==="ENOENT")return{available:!1,detail:"not found"};if(n.error)return{available:!1,detail:n.error.message};if(n.status!==0)return{available:!1,detail:n.stderr.trim()||n.stdout.trim()||`exit ${n.status}`};return{available:!0,detail:n.stdout.trim()||n.stderr.trim()||"ok"}}function Lt(t){return/not found|no running instance|cannot find|does not exist|no such process/i.test(t)}function nt(t,u={}){if(!Number.isFinite(t))return{attempted:!1,delivered:!1,method:null};let r=u.platform??w.platform,n=u.runCommandImpl??V,c=u.killImpl??w.kill.bind(w);if(r==="win32"){let f=n("taskkill",["/PID",String(t),"/T","/F"],{cwd:u.cwd,env:u.env});if(!f.error&&f.status===0)return{attempted:!0,delivered:!0,method:"taskkill",result:f};let y=`${f.stderr}
6
+ ${f.stdout}`.trim();if(!f.error&&Lt(y))return{attempted:!0,delivered:!1,method:"taskkill",result:f};if(f.error?.code==="ENOENT")try{return c(t),{attempted:!0,delivered:!0,method:"kill"}}catch(x){if(x?.code==="ESRCH")return{attempted:!0,delivered:!1,method:"kill"};throw x}if(f.error)throw f.error;throw Error(Vt(f))}try{return c(-t,"SIGTERM"),{attempted:!0,delivered:!0,method:"process-group"}}catch(f){if(f?.code!=="ESRCH")try{return c(t,"SIGTERM"),{attempted:!0,delivered:!0,method:"process"}}catch(y){if(y?.code==="ESRCH")return{attempted:!0,delivered:!1,method:"process"};throw y}return{attempted:!0,delivered:!1,method:"process-group"}}}function Vt(t){let u=[`${t.command} ${t.args.join(" ")}`.trim()];if(t.signal)u.push(`signal=${t.signal}`);else u.push(`exit=${t.status}`);let r=(t.stderr||"").trim(),n=(t.stdout||"").trim();if(r)u.push(r);else if(n)u.push(n);return u.join(": ")}var ft="CODER_APP_SERVER_ENDPOINT",ct=-32001,Tt="0.144.1",C;function _t(){if(C===void 0){let t=V("codex",["--version"]),u=/(\d+\.\d+\.\d+(?:-[\w.]+)?)/.exec(`${t.stdout} ${t.stderr}`);C=u?u[1]:Tt}return C}function ht(){return{title:"Coder",name:"coder",version:_t()}}var yt={experimentalApi:!1,requestAttestation:!1,optOutNotificationMethods:["item/agentMessage/delta","item/reasoning/summaryTextDelta","item/reasoning/summaryPartAdded","item/reasoning/textDelta"]};function it(t,u,r){return r===void 0?{code:t,message:u}:{code:t,message:u,data:r}}function D(t,u){let r=Error(t);if(r.data=u,u?.code!==void 0)r.rpcCode=u.code;return r}class P{cwd;options;pending;nextId;stderr;closed;exitError;notificationHandler;serverRequestHandler;lineBuffer;transport;exitPromise;exitResolved;resolveExit;handleServerRequest;constructor(t,u={}){this.cwd=t,this.options=u,this.pending=new Map,this.nextId=1,this.stderr="",this.closed=!1,this.exitError=null,this.notificationHandler=null,this.serverRequestHandler=null,this.lineBuffer="",this.transport="unknown",this.handleServerRequest=(r)=>this.defaultHandleServerRequest(r),this.exitPromise=new Promise((r)=>{this.resolveExit=r})}setNotificationHandler(t){this.notificationHandler=t}setServerRequestHandler(t){this.serverRequestHandler=t}request(t,u){if(this.closed)throw Error("codex app-server client is closed.");let r=this.nextId;return this.nextId+=1,new Promise((n,c)=>{this.pending.set(r,{resolve:n,reject:c,method:t}),this.sendMessage({id:r,method:t,params:u})})}notify(t,u={}){if(this.closed)return;this.sendMessage({method:t,params:u})}handleChunk(t){this.lineBuffer+=t;let u=this.lineBuffer.indexOf(`
7
7
  `);while(u!==-1){let r=this.lineBuffer.slice(0,u);this.lineBuffer=this.lineBuffer.slice(u+1),this.handleLine(r),u=this.lineBuffer.indexOf(`
8
- `)}}handleLine(t){if(!t.trim())return;let u;try{u=JSON.parse(t)}catch(r){this.handleExit(P(`Failed to parse codex app-server JSONL: ${r.message}`,{line:t}));return}if(u.id!==void 0&&u.method){this.handleServerRequest(u);return}if(u.id!==void 0){let r=this.pending.get(u.id);if(!r)return;if(this.pending.delete(u.id),u.error)r.reject(P(u.error.message??`codex app-server ${r.method} failed.`,u.error));else r.resolve(u.result??{});return}if(u.method&&this.notificationHandler)this.notificationHandler(u)}defaultHandleServerRequest(t){if(!this.serverRequestHandler){this.sendMessage({id:t.id,error:ft(-32601,`Unsupported server request: ${t.method}`)});return}Promise.resolve().then(()=>this.serverRequestHandler(t.method,t.params??{})).then((u)=>{this.sendMessage({id:t.id,result:u??{}})}).catch((u)=>{this.sendMessage({id:t.id,error:ft(-32000,u instanceof Error?u.message:String(u))})})}handleExit(t){if(this.exitResolved)return;this.exitResolved=!0,this.exitError=t??null;for(let u of this.pending.values())u.reject(this.exitError??Error("codex app-server connection closed."));this.pending.clear(),this.resolveExit(void 0)}sendMessage(t){throw Error("sendMessage must be implemented by subclasses.")}}class at extends _{proc;readline;constructor(t,u={}){super(t,u);this.transport="direct"}async initialize(){this.proc=vt("codex",["app-server"],{cwd:this.cwd,env:this.options.env??w.env,stdio:["pipe","pipe","pipe"],shell:w.platform==="win32"?w.env.SHELL||!0:!1,windowsHide:!0}),this.proc.stdout.setEncoding("utf8"),this.proc.stderr.setEncoding("utf8"),this.proc.stderr.on("data",(t)=>{this.stderr+=t}),this.proc.on("error",(t)=>{this.handleExit(t)}),this.proc.on("exit",(t,u)=>{let r=this.stderr.trim(),n=t===0?null:P(`codex app-server exited unexpectedly (${u?`signal ${u}`:`exit ${t}`}).${r?`
9
- ${r}`:""}`);this.handleExit(n)}),this.readline=Lt.createInterface({input:this.proc.stdout}),this.readline.on("line",(t)=>{this.handleLine(t)}),await this.request("initialize",{clientInfo:this.options.clientInfo??it,capabilities:this.options.capabilities??ht}),this.notify("initialized",{})}async close(){if(this.closed){await this.exitPromise;return}if(this.closed=!0,this.readline)this.readline.close();if(this.proc&&!this.proc.killed)this.proc.stdin.end(),setTimeout(()=>{if(this.proc&&!this.proc.killed&&this.proc.exitCode===null)if(w.platform==="win32")try{rt(this.proc.pid)}catch{}else this.proc.kill("SIGTERM")},50).unref?.();await this.exitPromise}sendMessage(t){let u=`${JSON.stringify(t)}
10
- `,r=this.proc?.stdin;if(!r)throw Error("codex app-server stdin is not available.");r.write(u)}}class xt extends _{endpoint;socket;constructor(t,u={}){super(t,u);this.transport="broker",this.endpoint=u.brokerEndpoint}async initialize(){await new Promise((t,u)=>{let r=R(this.endpoint);this.socket=Kt.createConnection({path:r.path}),this.socket.setEncoding("utf8"),this.socket.on("connect",t),this.socket.on("data",(n)=>{this.handleChunk(n)}),this.socket.on("error",(n)=>{if(!this.exitResolved)u(n);this.handleExit(n)}),this.socket.on("close",()=>{this.handleExit(this.exitError)})}),await this.request("initialize",{clientInfo:this.options.clientInfo??it,capabilities:this.options.capabilities??ht}),this.notify("initialized",{})}async close(){if(this.closed){await this.exitPromise;return}if(this.closed=!0,this.socket)this.socket.end();await this.exitPromise}sendMessage(t){let u=`${JSON.stringify(t)}
11
- `,r=this.socket;if(!r)throw Error("codex app-server broker connection is not connected.");r.write(u)}}class D{static async connect(t,u={}){let r=null;if(!u.disableBroker){if(r=u.brokerEndpoint??u.env?.[nt]??w.env[nt]??null,!r&&u.reuseExistingBroker)r=E(t)?.endpoint??null;if(!r&&!u.reuseExistingBroker)r=(await tt(t,{env:u.env}))?.endpoint??null}let n=r?new xt(t,{...u,brokerEndpoint:r}):new at(t,u);return await n.initialize(),n}}var Et=new Set(["turn/start","review/start","thread/compact/start"]);function yt(t,u,r){let n=new Set;if(u?.threadId)n.add(u.threadId);if(t==="review/start"&&r?.reviewThreadId)n.add(r.reviewThreadId);return n}function Z(t,u,r){return r===void 0?{code:t,message:u}:{code:t,message:u,data:r}}function W(t,u){if(t.destroyed)return;t.write(`${JSON.stringify(u)}
12
- `)}function Pt(t){return t?.method==="turn/interrupt"}function _t(t){if(!t)return;m.mkdirSync(T.dirname(t),{recursive:!0}),m.writeFileSync(t,`${S.pid}
13
- `,"utf8")}async function Dt(){let[t,...u]=S.argv.slice(2);if(t!=="serve")throw Error("Usage: node src/lib/broker.mjs serve --endpoint <value> [--cwd <path>] [--pid-file <path>]");let{options:r}=p(u,{valueOptions:["cwd","pid-file","endpoint"]});if(!r.endpoint)throw Error("Missing required --endpoint.");let n=r.cwd?T.resolve(S.cwd(),r.cwd):S.cwd(),i=String(r.endpoint),f=R(i),a=r["pid-file"]?T.resolve(r["pid-file"]):null;_t(a);let x=await D.connect(n,{disableBroker:!0}),$=null,y=null,j=null,O=new Set,J=new Map;function z(c){for(let[b,G]of J)if(G===c)J.delete(b),x.sendMessage({id:b,error:Z(-32000,"Broker client disconnected before answering the server request.")})}function N(c){if(z(c),$===c)$=null;if(y===c)y=null,j=null}function Q(c){let b=$??y;if(!b)return;if(W(b,c),c.method==="turn/completed"&&y===b){let G=c.params?.threadId??null;if(!G||!j||j.has(G)){if(y=null,j=null,$===b)$=null}}}async function K(c){for(let b of O)b.end();if(await x.close().catch(()=>{}),await new Promise((b)=>c.close(b)),f.kind==="unix"&&m.existsSync(f.path))m.unlinkSync(f.path);if(a&&m.existsSync(a))m.unlinkSync(a)}x.setNotificationHandler(Q),x.handleServerRequest=(c)=>{let b=y??$;if(!b||b.destroyed){x.sendMessage({id:c.id,error:Z(-32601,`No broker client available to answer ${c.method}.`)});return}J.set(c.id,b),W(b,c)};let U=At.createServer((c)=>{O.add(c),c.setEncoding("utf8");let b="";c.on("data",async(G)=>{b+=G;let X=b.indexOf(`
14
- `);while(X!==-1){let I=b.slice(0,X);if(b=b.slice(X+1),X=b.indexOf(`
15
- `),!I.trim())continue;let h;try{h=JSON.parse(I)}catch(o){W(c,{id:null,error:Z(-32700,`Invalid JSON: ${o.message}`)});continue}if(h.id!==void 0&&!h.method&&J.has(h.id)){J.delete(h.id),x.sendMessage(h);continue}if(h.id!==void 0&&h.method==="initialize"){W(c,{id:h.id,result:{userAgent:"coder-broker"}});continue}if(h.method==="initialized"&&h.id===void 0)continue;if(h.id!==void 0&&h.method==="broker/shutdown")W(c,{id:h.id,result:{}}),await K(U),S.exit(0);if(h.id===void 0||!h.method)continue;let k=Pt(h)&&y&&y!==c&&!$;if(($&&$!==c||y&&y!==c)&&!k){W(c,{id:h.id,error:Z(ct,"Shared Codex broker is busy.")});continue}if(k){try{let o=await x.request(h.method,h.params??{});W(c,{id:h.id,result:o})}catch(o){W(c,{id:h.id,error:Z(o.rpcCode??-32000,o.message)})}continue}let v=Et.has(h.method);if($=c,v)y=c,j=yt(h.method,h.params??{},null);try{let o=await x.request(h.method,h.params??{});if(W(c,{id:h.id,result:o}),v)j=yt(h.method,h.params??{},o);if($===c)$=null}catch(o){if(W(c,{id:h.id,error:Z(o.rpcCode??-32000,o.message)}),$===c)$=null;if(y===c&&v)y=null,j=null}}}),c.on("close",()=>{O.delete(c),N(c)}),c.on("error",()=>{O.delete(c),N(c)})});S.on("SIGTERM",async()=>{await K(U),S.exit(0)}),S.on("SIGINT",async()=>{await K(U),S.exit(0)}),U.listen(f.path)}Dt().catch((t)=>{S.stderr.write(`${t instanceof Error?t.message:String(t)}
8
+ `)}}handleLine(t){if(!t.trim())return;let u;try{u=JSON.parse(t)}catch(r){this.handleExit(D(`Failed to parse codex app-server JSONL: ${r.message}`,{line:t}));return}if(u.id!==void 0&&u.method){this.handleServerRequest(u);return}if(u.id!==void 0){let r=this.pending.get(u.id);if(!r)return;if(this.pending.delete(u.id),u.error)r.reject(D(u.error.message??`codex app-server ${r.method} failed.`,u.error));else r.resolve(u.result??{});return}if(u.method&&this.notificationHandler)this.notificationHandler(u)}defaultHandleServerRequest(t){if(!this.serverRequestHandler){this.sendMessage({id:t.id,error:it(-32601,`Unsupported server request: ${t.method}`)});return}Promise.resolve().then(()=>this.serverRequestHandler(t.method,t.params??{})).then((u)=>{this.sendMessage({id:t.id,result:u??{}})}).catch((u)=>{this.sendMessage({id:t.id,error:it(-32000,u instanceof Error?u.message:String(u))})})}handleExit(t){if(this.exitResolved)return;this.exitResolved=!0,this.exitError=t??null;for(let u of this.pending.values())u.reject(this.exitError??Error("codex app-server connection closed."));this.pending.clear(),this.resolveExit(void 0)}sendMessage(t){throw Error("sendMessage must be implemented by subclasses.")}}class xt extends P{proc;readline;constructor(t,u={}){super(t,u);this.transport="direct"}async initialize(){this.proc=Et("codex",["app-server","--disable","plugins"],{cwd:this.cwd,env:this.options.env??Q.env,stdio:["pipe","pipe","pipe"],shell:Q.platform==="win32"?Q.env.SHELL||!0:!1,windowsHide:!0}),this.proc.stdout.setEncoding("utf8"),this.proc.stderr.setEncoding("utf8"),this.proc.stderr.on("data",(t)=>{this.stderr+=t}),this.proc.on("error",(t)=>{this.handleExit(t)}),this.proc.on("exit",(t,u)=>{let r=this.stderr.trim(),n=t===0?null:D(`codex app-server exited unexpectedly (${u?`signal ${u}`:`exit ${t}`}).${r?`
9
+ ${r}`:""}`);this.handleExit(n)}),this.readline=At.createInterface({input:this.proc.stdout}),this.readline.on("line",(t)=>{this.handleLine(t)}),await this.request("initialize",{clientInfo:this.options.clientInfo??ht(),capabilities:this.options.capabilities??yt}),this.notify("initialized",{})}async close(){if(this.closed){await this.exitPromise;return}if(this.closed=!0,this.readline)this.readline.close();if(this.proc&&!this.proc.killed)this.proc.stdin.end(),setTimeout(()=>{if(this.proc&&!this.proc.killed&&this.proc.exitCode===null)if(Q.platform==="win32")try{nt(this.proc.pid)}catch{}else this.proc.kill("SIGTERM")},50).unref?.();await this.exitPromise}sendMessage(t){let u=`${JSON.stringify(t)}
10
+ `,r=this.proc?.stdin;if(!r)throw Error("codex app-server stdin is not available.");r.write(u)}}class at extends P{endpoint;socket;constructor(t,u={}){super(t,u);this.transport="broker",this.endpoint=u.brokerEndpoint}async initialize(){await new Promise((t,u)=>{let r=R(this.endpoint);this.socket=vt.createConnection({path:r.path}),this.socket.setEncoding("utf8"),this.socket.on("connect",t),this.socket.on("data",(n)=>{this.handleChunk(n)}),this.socket.on("error",(n)=>{if(!this.exitResolved)u(n);this.handleExit(n)}),this.socket.on("close",()=>{this.handleExit(this.exitError)})}),await this.request("initialize",{clientInfo:this.options.clientInfo??ht(),capabilities:this.options.capabilities??yt}),this.notify("initialized",{})}async close(){if(this.closed){await this.exitPromise;return}if(this.closed=!0,this.socket)this.socket.end();await this.exitPromise}sendMessage(t){let u=`${JSON.stringify(t)}
11
+ `,r=this.socket;if(!r)throw Error("codex app-server broker connection is not connected.");r.write(u)}}class I{static async connect(t,u={}){let r=null;if(!u.disableBroker){if(r=u.brokerEndpoint??u.env?.[ft]??Q.env[ft]??null,!r&&u.reuseExistingBroker)r=_(t)?.endpoint??null;if(!r&&!u.reuseExistingBroker)r=(await rt(t,{env:u.env}))?.endpoint??null}let n=r?new at(t,{...u,brokerEndpoint:r}):new xt(t,u);return await n.initialize(),n}}var Dt=new Set(["turn/start","review/start","thread/compact/start"]);function $t(t,u,r){let n=new Set;if(u?.threadId)n.add(u.threadId);if(t==="review/start"&&r?.reviewThreadId)n.add(r.reviewThreadId);return n}function o(t,u,r){return r===void 0?{code:t,message:u}:{code:t,message:u,data:r}}function W(t,u){if(t.destroyed)return;t.write(`${JSON.stringify(u)}
12
+ `)}function Pt(t){return t?.method==="turn/interrupt"}function It(t){if(!t)return;q.mkdirSync(k.dirname(t),{recursive:!0}),q.writeFileSync(t,`${S.pid}
13
+ `,"utf8")}async function kt(){let[t,...u]=S.argv.slice(2);if(t!=="serve")throw Error("Usage: node src/lib/broker.mjs serve --endpoint <value> [--cwd <path>] [--pid-file <path>]");let{options:r}=F(u,{valueOptions:["cwd","pid-file","endpoint"]});if(!r.endpoint)throw Error("Missing required --endpoint.");let n=r.cwd?k.resolve(S.cwd(),r.cwd):S.cwd(),c=String(r.endpoint),f=R(c),y=r["pid-file"]?k.resolve(r["pid-file"]):null;It(y);let x=await I.connect(n,{disableBroker:!0}),$=null,a=null,j=null,O=new Set,J=new Map;function G(i){for(let[b,U]of J)if(U===i)J.delete(b),x.sendMessage({id:b,error:o(-32000,"Broker client disconnected before answering the server request.")})}function z(i){if(G(i),$===i)$=null;if(a===i)a=null,j=null}function Y(i){let b=$??a;if(!b)return;if(W(b,i),i.method==="turn/completed"&&a===b){let U=i.params?.threadId??null;if(!U||!j||j.has(U)){if(a=null,j=null,$===b)$=null}}}async function v(i){for(let b of O)b.end();if(await x.close().catch(()=>{}),await new Promise((b)=>i.close(b)),f.kind==="unix"&&q.existsSync(f.path))q.unlinkSync(f.path);if(y&&q.existsSync(y))q.unlinkSync(y)}x.setNotificationHandler(Y),x.handleServerRequest=(i)=>{let b=a??$;if(!b||b.destroyed){x.sendMessage({id:i.id,error:o(-32601,`No broker client available to answer ${i.method}.`)});return}J.set(i.id,b),W(b,i)};let X=Ct.createServer((i)=>{O.add(i),i.setEncoding("utf8");let b="";i.on("data",async(U)=>{b+=U;let K=b.indexOf(`
14
+ `);while(K!==-1){let p=b.slice(0,K);if(b=b.slice(K+1),K=b.indexOf(`
15
+ `),!p.trim())continue;let h;try{h=JSON.parse(p)}catch(M){W(i,{id:null,error:o(-32700,`Invalid JSON: ${M.message}`)});continue}if(h.id!==void 0&&!h.method&&J.has(h.id)){J.delete(h.id),x.sendMessage(h);continue}if(h.id!==void 0&&h.method==="initialize"){W(i,{id:h.id,result:{userAgent:"coder-broker"}});continue}if(h.method==="initialized"&&h.id===void 0)continue;if(h.id!==void 0&&h.method==="broker/shutdown")W(i,{id:h.id,result:{}}),await v(X),S.exit(0);if(h.id===void 0||!h.method)continue;let B=Pt(h)&&a&&a!==i&&!$;if(($&&$!==i||a&&a!==i)&&!B){W(i,{id:h.id,error:o(ct,"Shared Codex broker is busy.")});continue}if(B){try{let M=await x.request(h.method,h.params??{});W(i,{id:h.id,result:M})}catch(M){W(i,{id:h.id,error:o(M.rpcCode??-32000,M.message)})}continue}let E=Dt.has(h.method);if($=i,E)a=i,j=$t(h.method,h.params??{},null);try{let M=await x.request(h.method,h.params??{});if(W(i,{id:h.id,result:M}),E)j=$t(h.method,h.params??{},M);if($===i)$=null}catch(M){if(W(i,{id:h.id,error:o(M.rpcCode??-32000,M.message)}),$===i)$=null;if(a===i&&E)a=null,j=null}}}),i.on("close",()=>{O.delete(i),z(i)}),i.on("error",()=>{O.delete(i),z(i)})});S.on("SIGTERM",async()=>{await v(X),S.exit(0)}),S.on("SIGINT",async()=>{await v(X),S.exit(0)}),X.listen(f.path)}kt().catch((t)=>{S.stderr.write(`${t instanceof Error?t.message:String(t)}
16
16
  `),S.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wular/coder",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Delegating coding-agent runtime",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Delegate coding tasks to a Coder subagent. Codex first, Claude fallback; your main context stays clean.",
5
5
  "author": {
6
6
  "name": "muzam1l"
@@ -12,7 +12,9 @@ needs the user's decision. Use AskUserQuestion for the decision points.
12
12
  `command -v coder >/dev/null || npm install -g @wular/coder; coder setup --json`
13
13
  (codex/claude availability and auth are in the JSON).
14
14
  2. Codex is the recommended primary engine; Claude (opus subagents in Claude Code) is the fallback. Choose the default from what is installed. Do NOT ask about chain ordering:
15
- - **Codex installed** (logged in, or logged out; installed still counts): keep the default `codex → claude` chain. If it is logged out, tell the user to run `codex login` themselves, then re-run `coder setup` to confirm.
15
+ - **Codex installed** (logged in, or logged out; installed still counts): keep the default `codex → claude` chain.
16
+ - **Auto-update if stale**: the default codex model is a GPT-5.6 tier, which needs codex `>= 0.144`. Parse the version from the JSON's `codex.detail` (e.g. `codex-cli 0.143.0`); if it is below `0.144.0`, update it automatically without asking with `codex update` (codex's own updater - it detects the install method and refetches the binary; fall back to `npm install -g @openai/codex@latest` if that fails), then re-run `coder setup --json` to confirm.
17
+ - If it is logged out, tell the user to run `codex login` themselves, then re-run `coder setup` to confirm.
16
18
  - **Codex not installed**: run `coder config set chain claude,codex` so tasks run on Claude opus subagents immediately, tell the user that is the default for now, then ask (AskUserQuestion) whether to install Codex since it is the recommended primary. On yes: `npm install -g @openai/codex`, have them run `codex login`, then `coder config set chain codex,claude`.
17
19
  3. Show the final config (`coder config`) and mention overrides live in `~/.coder/config.json` (machine) and `coder.config.json` (per repo).
18
20
  4. Suggest trying it: "Use Coder to <some small task>".
@@ -12,7 +12,7 @@ If `coder` is not on PATH, install it yourself without asking (`npm install -g @
12
12
  ## Dispatching a task
13
13
 
14
14
  - One coder per focused goal. When the work splits into independent parts, decompose it and dispatch each part as its own background `coder task` - fan out a wide web of coders running in parallel, not one giant dispatch. Give each coder a self-contained goal with all context - overview, file paths, constraints (read-only, git rules). Run independent tasks concurrently; use `steer` to continue a single coder's thread.
15
- - Delegation is a hard gate for anything the engine can do itself: do not read source files, investigate, or write code first - no matter how simple the task. Fold into the task text whatever only you have - conversation context, results from tools the engine lacks.
15
+ - Delegation is a hard gate for anything the engine can do itself: do not read source files, investigate, or write code first - no matter how simple the task. Fold into the task text whatever only you have - conversation context, results from tools the engine lacks. The coder worker runs with plugins disabled (no skills, MCP, or connectors), so include any context only a plugin or MCP tool of yours produced.
16
16
  - Compose one self-contained task text (goal, relevant paths, constraints) and run it as a **background Bash call** so you are notified on completion instead of blocking or polling:
17
17
 
18
18
  ```bash
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "interface": {
5
5
  "displayName": "Coder (plugin)"
6
6
  },
@@ -9,11 +9,13 @@ You dispatch coding tasks through the `coder` runtime instead of implementing th
9
9
 
10
10
  If `coder` is not on PATH, install it yourself without asking: `npm install -g @wular/coder`, then `coder setup --codex`. Only if that fails, show the user the error and those two commands. On first setup, mention the chain is Codex-first with Claude on fallback. The Claude fallback engine needs the claude CLI; if it is not installed, ask the user before installing it (on yes: `npm install -g @anthropic-ai/claude-code`, then have them run `claude` once to log in). If the user prefers Claude engines first, run `coder config set chain claude,codex`.
11
11
 
12
+ When you run setup, also check codex is new enough for the default GPT-5.6 model, which needs codex `>= 0.144` (`codex --version`). If it is older, update it automatically without asking with `codex update` (codex's own updater; fall back to `npm install -g @openai/codex@latest` if it fails), then tell the user to restart their codex session so the update takes effect.
13
+
12
14
  ## Dispatching a task
13
15
 
14
16
  - Run every `coder` command with escalated permissions (outside your sandbox), justification: Coder is a supervisor - it spawns engines, keeps state in `~/.coder`, and enforces its own sandbox and approval policy on the task. Never retry a sandbox-blocked `coder` call sandboxed again or with HOME/state env workarounds.
15
17
  - One coder per focused goal. When the work splits into independent parts, decompose it and dispatch each part as its own `coder task --host codex` call - fan out a wide web of coders, not one giant dispatch. Give each coder a self-contained goal with all context - overview, file paths, constraints (read-only, git rules); use `steer` to continue a single coder's thread.
16
- - Delegation is a hard gate for anything the engine can do itself: do not read source files, investigate, or write code first - no matter how simple the task. Fold into the task text whatever only you have - conversation context, results from tools the engine lacks.
18
+ - Delegation is a hard gate for anything the engine can do itself: do not read source files, investigate, or write code first - no matter how simple the task. Fold into the task text whatever only you have - conversation context, results from tools the engine lacks. The coder worker runs with plugins disabled (no skills, MCP, or connectors), so include any context only a plugin or MCP tool of yours produced.
17
19
  - Compose one self-contained task text (goal, relevant paths, constraints) and run:
18
20
 
19
21
  ```bash