evolve-sdk 0.0.52.dev902__tar.gz → 0.0.52.dev903__tar.gz
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.
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/PKG-INFO +1 -1
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/bridge/dist/bridge.bundle.cjs +1 -1
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/__init__.py +1 -1
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/PKG-INFO +1 -1
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/pyproject.toml +1 -1
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/LICENSE +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/MANIFEST.in +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/README.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/bridge/__init__.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/_http.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/agent.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/bridge.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/browser_credentials.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/browser_profiles.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/config.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/hosted.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/integrations.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/managed_secrets.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/pipeline/__init__.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/pipeline/pipeline.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/pipeline/types.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/__init__.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/agent_md/judge.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/agent_md/reduce.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/agent_md/verify.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/user/judge.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/user/retry_feedback.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/prompts/user/verify.md +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/py.typed +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/results.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/retry.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/schema.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/sessions_client.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/storage_client.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/swarm/__init__.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/swarm/results.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/swarm/swarm.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/swarm/types.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve/utils.py +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/SOURCES.txt +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/dependency_links.txt +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/requires.txt +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/top_level.txt +0 -0
- {evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/setup.cfg +0 -0
|
@@ -248,7 +248,7 @@ modal.sandboxes.experimentalList({ appId: app.appId });`);let t=e.tags?Object.en
|
|
|
248
248
|
`));let r=t.pax;if(r)for(let a in r)n+=_X(" "+a+"="+r[a]+`
|
|
249
249
|
`);return An.from(n)};Pw.decodePax=function(t){let n={};for(;t.length;){let r=0;for(;r<t.length&&t[r]!==32;)r++;let a=parseInt(An.toString(t.subarray(0,r)),10);if(!a)return n;let i=An.toString(t.subarray(r+1,a-1)),s=i.indexOf("=");if(s===-1)return n;n[i.slice(0,s)]=i.slice(s+1),t=t.subarray(a)}return n};Pw.encode=function(t){let n=An.alloc(512),r=t.name,a="";if(t.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),An.byteLength(r)!==r.length)return null;for(;An.byteLength(r)>100;){let i=r.indexOf("/");if(i===-1)return null;a+=a?"/"+r.slice(0,i):r.slice(0,i),r=r.slice(i+1)}return An.byteLength(r)>100||An.byteLength(a)>155||t.linkname&&An.byteLength(t.linkname)>100?null:(An.write(n,r),An.write(n,fm(t.mode&R8t,6),100),An.write(n,fm(t.uid,6),108),An.write(n,fm(t.gid,6),116),F8t(t.size,n,124),An.write(n,fm(t.mtime.getTime()/1e3|0,11),136),n[156]=BU+U8t(t.type),t.linkname&&An.write(n,t.linkname,157),An.copy(V9e,n,nO),An.copy(O8t,n,wX),t.uname&&An.write(n,t.uname,265),t.gname&&An.write(n,t.gname,297),An.write(n,fm(t.devmajor||0,6),329),An.write(n,fm(t.devminor||0,6),337),a&&An.write(n,a,345),An.write(n,fm($9e(n),6),148),n)};Pw.decode=function(t,n,r){let a=t[156]===0?0:t[156]-BU,i=Aw(t,0,100,n),s=dm(t,100,8),o=dm(t,108,8),c=dm(t,116,8),l=dm(t,124,12),u=dm(t,136,12),d=D8t(a),f=t[157]===0?null:Aw(t,157,100,n),h=Aw(t,265,32),g=Aw(t,297,32),v=dm(t,329,8),b=dm(t,337,8),y=$9e(t);if(y===8*32)return null;if(y!==dm(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(C8t(t))t[345]&&(i=Aw(t,345,155,n)+"/"+i);else if(!N8t(t)){if(!r)throw new Error("Invalid tar header: unknown format.")}return a===0&&i&&i[i.length-1]==="/"&&(a=5),{name:i,mode:s,uid:o,gid:c,size:l,mtime:new Date(1e3*u),type:d,linkname:f,uname:h,gname:g,devmajor:v,devminor:b,pax:null}};function C8t(e){return An.equals(V9e,e.subarray(nO,nO+6))}function N8t(e){return An.equals(A8t,e.subarray(nO,nO+6))&&An.equals(P8t,e.subarray(wX,wX+2))}function M8t(e,t,n){return typeof e!="number"?n:(e=~~e,e>=t?t:e>=0||(e+=t,e>=0)?e:0)}function D8t(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function U8t(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function q9e(e,t,n,r){for(;n<r;n++)if(e[n]===t)return n;return r}function $9e(e){let t=256;for(let n=0;n<148;n++)t+=e[n];for(let n=156;n<512;n++)t+=e[n];return t}function fm(e,t){return e=e.toString(8),e.length>t?k8t.slice(0,t)+" ":T8t.slice(0,t-e.length)+e+" "}function B8t(e,t,n){t[n]=128;for(let r=11;r>0;r--)t[n+r]=e&255,e=Math.floor(e/256)}function F8t(e,t,n){e.toString(8).length>11?B8t(e,t,n):An.write(t,fm(e,11),n)}function L8t(e){let t;if(e[0]===128)t=!0;else if(e[0]===255)t=!1;else return null;let n=[],r;for(r=e.length-1;r>0;r--){let s=e[r];t?n.push(s):n.push(255-s)}let a=0,i=n.length;for(r=0;r<i;r++)a+=n[r]*Math.pow(256,r);return t?a:-1*a}function dm(e,t,n){if(e=e.subarray(t,t+n),t=0,e[t]&128)return L8t(e);{for(;t<e.length&&e[t]===32;)t++;let r=M8t(q9e(e,32,t,e.length),e.length,e.length);for(;t<r&&e[t]===0;)t++;return r===t?0:parseInt(An.toString(e.subarray(t,r)),8)}}function Aw(e,t,n,r){return An.toString(e.subarray(t,q9e(e,0,t,t+n)),r)}function _X(e){let t=An.byteLength(e),n=Math.floor(Math.log(t)/Math.log(10))+1;return t+n>=Math.pow(10,n)&&n++,t+n+e}});var W9e=S((cEn,H9e)=>{var{Writable:V8t,Readable:q8t,getStreamError:z9e}=SX(),$8t=iX(),G9e=xw(),Rw=IX(),z8t=G9e.alloc(0),EX=class{constructor(){this.buffered=0,this.shifted=0,this.queue=new $8t,this._offset=0}push(t){this.buffered+=t.byteLength,this.queue.push(t)}shiftFirst(t){return this._buffered===0?null:this._next(t)}shift(t){if(t>this.buffered)return null;if(t===0)return z8t;let n=this._next(t);if(t===n.byteLength)return n;let r=[n];for(;(t-=n.byteLength)>0;)n=this._next(t),r.push(n);return G9e.concat(r)}_next(t){let n=this.queue.peek(),r=n.byteLength-this._offset;if(t>=r){let a=this._offset?n.subarray(this._offset,n.byteLength):n;return this.queue.shift(),this._offset=0,this.buffered-=r,this.shifted+=r,a}return this.buffered-=t,this.shifted+=t,n.subarray(this._offset,this._offset+=t)}},TX=class extends q8t{constructor(t,n,r){super(),this.header=n,this.offset=r,this._parent=t}_read(t){this.header.size===0&&this.push(null),this._parent._stream===this&&this._parent._update(),t(null)}_predestroy(){this._parent.destroy(z9e(this))}_detach(){this._parent._stream===this&&(this._parent._stream=null,this._parent._missing=J9e(this.header.size),this._parent._update())}_destroy(t){this._detach(),t(null)}},kX=class extends V8t{constructor(t){super(t),t||(t={}),this._buffer=new EX,this._offset=0,this._header=null,this._stream=null,this._missing=0,this._longHeader=!1,this._callback=xX,this._locked=!1,this._finished=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null,this._filenameEncoding=t.filenameEncoding||"utf-8",this._allowUnknownFormat=!!t.allowUnknownFormat,this._unlockBound=this._unlock.bind(this)}_unlock(t){if(this._locked=!1,t){this.destroy(t),this._continueWrite(t);return}this._update()}_consumeHeader(){if(this._locked)return!1;this._offset=this._buffer.shifted;try{this._header=Rw.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(t){return this._continueWrite(t),!1}if(!this._header)return!0;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":return this._longHeader=!0,this._missing=this._header.size,!0}return this._locked=!0,this._applyLongHeaders(),this._header.size===0||this._header.type==="directory"?(this.emit("entry",this._header,this._createStream(),this._unlockBound),!0):(this._stream=this._createStream(),this._missing=this._header.size,this.emit("entry",this._header,this._stream,this._unlockBound),!0)}_applyLongHeaders(){this._gnuLongPath&&(this._header.name=this._gnuLongPath,this._gnuLongPath=null),this._gnuLongLinkPath&&(this._header.linkname=this._gnuLongLinkPath,this._gnuLongLinkPath=null),this._pax&&(this._pax.path&&(this._header.name=this._pax.path),this._pax.linkpath&&(this._header.linkname=this._pax.linkpath),this._pax.size&&(this._header.size=parseInt(this._pax.size,10)),this._header.pax=this._pax,this._pax=null)}_decodeLongHeader(t){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=Rw.decodeLongPath(t,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=Rw.decodeLongPath(t,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=Rw.decodePax(t);break;case"pax-header":this._pax=this._paxGlobal===null?Rw.decodePax(t):Object.assign({},this._paxGlobal,Rw.decodePax(t));break}}_consumeLongHeader(){this._longHeader=!1,this._missing=J9e(this._header.size);let t=this._buffer.shift(this._header.size);try{this._decodeLongHeader(t)}catch(n){return this._continueWrite(n),!1}return!0}_consumeStream(){let t=this._buffer.shiftFirst(this._missing);if(t===null)return!1;this._missing-=t.byteLength;let n=this._stream.push(t);return this._missing===0?(this._stream.push(null),n&&this._stream._detach(),n&&this._locked===!1):n}_createStream(){return new TX(this,this._header,this._offset)}_update(){for(;this._buffer.buffered>0&&!this.destroying;){if(this._missing>0){if(this._stream!==null){if(this._consumeStream()===!1)return;continue}if(this._longHeader===!0){if(this._missing>this._buffer.buffered)break;if(this._consumeLongHeader()===!1)return!1;continue}let t=this._buffer.shiftFirst(this._missing);t!==null&&(this._missing-=t.byteLength);continue}if(this._buffer.buffered<512)break;if(this._stream!==null||this._consumeHeader()===!1)return}this._continueWrite(null)}_continueWrite(t){let n=this._callback;this._callback=xX,n(t)}_write(t,n){this._callback=n,this._buffer.push(t),this._update()}_final(t){this._finished=this._missing===0&&this._buffer.buffered===0,t(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(t){this._stream&&this._stream.destroy(z9e(this)),t(null)}[Symbol.asyncIterator](){let t=null,n=null,r=null,a=null,i=null,s=this;return this.on("entry",l),this.on("error",f=>{t=f}),this.on("close",u),{[Symbol.asyncIterator](){return this},next(){return new Promise(c)},return(){return d(null)},throw(f){return d(f)}};function o(f){if(!i)return;let h=i;i=null,h(f)}function c(f,h){if(t)return h(t);if(a){f({value:a,done:!1}),a=null;return}n=f,r=h,o(null),s._finished&&n&&(n({value:void 0,done:!0}),n=r=null)}function l(f,h,g){i=g,h.on("error",xX),n?(n({value:h,done:!1}),n=r=null):a=h}function u(){o(t),n&&(t?r(t):n({value:void 0,done:!0}),n=r=null)}function d(f){return s.destroy(f),o(f),new Promise((h,g)=>{if(s.destroyed)return h({value:void 0,done:!0});s.once("close",function(){f?g(f):h({value:void 0,done:!0})})})}}};H9e.exports=function(t){return new kX(t)};function xX(){}function J9e(e){return e&=511,e&&512-e}});var K9e=S((lEn,OX)=>{var Y9e={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{OX.exports=require("fs").constants||Y9e}catch{OX.exports=Y9e}});var eKe=S((uEn,Q9e)=>{var{Readable:G8t,Writable:J8t,getStreamError:j9e}=SX(),pv=xw(),Cw=K9e(),FU=IX(),H8t=493,W8t=420,X9e=pv.alloc(1024),PX=class extends J8t{constructor(t,n,r){super({mapWritable:K8t,eagerOpen:!0}),this.written=0,this.header=n,this._callback=r,this._linkname=null,this._isLinkname=n.type==="symlink"&&!n.linkname,this._isVoid=n.type!=="file"&&n.type!=="contiguous-file",this._finished=!1,this._pack=t,this._openCallback=null,this._pack._stream===null?this._pack._stream=this:this._pack._pending.push(this)}_open(t){this._openCallback=t,this._pack._stream===this&&this._continueOpen()}_continuePack(t){if(this._callback===null)return;let n=this._callback;this._callback=null,n(t)}_continueOpen(){this._pack._stream===null&&(this._pack._stream=this);let t=this._openCallback;if(this._openCallback=null,t!==null){if(this._pack.destroying)return t(new Error("pack stream destroyed"));if(this._pack._finalized)return t(new Error("pack stream is already finalized"));this._pack._stream=this,this._isLinkname||this._pack._encode(this.header),this._isVoid&&(this._finish(),this._continuePack(null)),t(null)}}_write(t,n){if(this._isLinkname)return this._linkname=this._linkname?pv.concat([this._linkname,t]):t,n(null);if(this._isVoid)return t.byteLength>0?n(new Error("No body allowed for this entry")):n();if(this.written+=t.byteLength,this._pack.push(t))return n();this._pack._drain=n}_finish(){this._finished||(this._finished=!0,this._isLinkname&&(this.header.linkname=this._linkname?pv.toString(this._linkname,"utf-8"):"",this._pack._encode(this.header)),Z9e(this._pack,this.header.size),this._pack._done(this))}_final(t){if(this.written!==this.header.size)return t(new Error("Size mismatch"));this._finish(),t(null)}_getError(){return j9e(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(t){this._pack._done(this),this._continuePack(this._finished?null:this._getError()),t()}},RX=class extends G8t{constructor(t){super(t),this._drain=AX,this._finalized=!1,this._finalizing=!1,this._pending=[],this._stream=null}entry(t,n,r){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");typeof n=="function"&&(r=n,n=null),r||(r=AX),(!t.size||t.type==="symlink")&&(t.size=0),t.type||(t.type=Y8t(t.mode)),t.mode||(t.mode=t.type==="directory"?H8t:W8t),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),typeof n=="string"&&(n=pv.from(n));let a=new PX(this,t,r);return pv.isBuffer(n)?(t.size=n.byteLength,a.write(n),a.end(),a):(a._isVoid,a)}finalize(){if(this._stream||this._pending.length>0){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push(X9e),this.push(null))}_done(t){t===this._stream&&(this._stream=null,this._finalizing&&this.finalize(),this._pending.length&&this._pending.shift()._continueOpen())}_encode(t){if(!t.pax){let n=FU.encode(t);if(n){this.push(n);return}}this._encodePax(t)}_encodePax(t){let n=FU.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:n.byteLength,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(FU.encode(r)),this.push(n),Z9e(this,n.byteLength),r.size=t.size,r.type=t.type,this.push(FU.encode(r))}_doDrain(){let t=this._drain;this._drain=AX,t()}_predestroy(){let t=j9e(this);for(this._stream&&this._stream.destroy(t);this._pending.length;){let n=this._pending.shift();n.destroy(t),n._continueOpen()}this._doDrain()}_read(t){this._doDrain(),t()}};Q9e.exports=function(t){return new RX(t)};function Y8t(e){switch(e&Cw.S_IFMT){case Cw.S_IFBLK:return"block-device";case Cw.S_IFCHR:return"character-device";case Cw.S_IFDIR:return"directory";case Cw.S_IFIFO:return"fifo";case Cw.S_IFLNK:return"symlink"}return"file"}function AX(){}function Z9e(e,t){t&=511,t&&e.push(X9e.subarray(0,512-t))}function K8t(e){return pv.isBuffer(e)?e:pv.from(e)}});var NX=S(CX=>{CX.extract=W9e();CX.pack=eKe()});var yKe={};Fu(yKe,{EVOLVE_IMAGE_VERSION:()=>LU,MODAL_MAX_LIFETIME_MS:()=>LX,MODAL_MAX_LIST_SANDBOXES:()=>FX,MODAL_STDIN_CHUNK_BYTES:()=>rO,ModalCommands:()=>hKe,ModalFiles:()=>mKe,ModalIdleTimeoutError:()=>MX,ModalNetworkPolicyError:()=>BX,ModalProvider:()=>$X,ModalResourcesError:()=>UX,ModalSandboxLifetimeError:()=>oKe,_testBuildSandboxInfo:()=>dWt,_testCollectSandboxes:()=>fWt,_testDynamicNetworkPolicyParams:()=>oWt,_testImageMap:()=>aWt,_testMapIdleTimeout:()=>hWt,_testMapNetworkPolicy:()=>sWt,_testMapResources:()=>lWt,_testRequiresDynamicNetwork:()=>cWt,_testResolveImageRegistry:()=>uWt,_testValidateTimeout:()=>pWt,_testWrapCommand:()=>iWt,createModalProvider:()=>qU});async function*j8t(e){let t=e.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n)break;r&&(yield r)}}finally{t.releaseLock()}}function cKe(e){if(e>LX)throw new oKe(e)}function lKe(e){if(e===void 0)return{};if(!Number.isFinite(e)||e<=0)throw new MX(e,"it must be a positive number of milliseconds");if(e>LX)throw new MX(e,"it exceeds Modal's 24h lifetime cap, so the sandbox would always die of the lifetime first");return{idleTimeoutMs:e}}function DX(e,t,n,r){let a="";r&&Object.keys(r).length>0&&(a=Object.entries(r).filter(([,o])=>o!=null).map(([o,c])=>`export ${o}='${String(c).replace(/'/g,"'\\''")}'`).join("; ")+"; ");let i=n?`cd '${n.replace(/'/g,"'\\''")}' && ${a}${e}`:`${a}${e}`;if(t==="root")return["bash","-c",i];let s=Buffer.from(i).toString("base64");return["su",t,"-c",`echo ${s} | base64 -d | bash`]}function uKe(e){if(e?.disk!==void 0)throw new UX(`Modal's JS SDK has no create-time disk-size parameter, so a ${e.disk} GiB disk request cannot be enforced. Drop \`resources.disk\` (containers get Modal's default disk quota) or run on a provider that sizes disk.`);if((e?.gpu===void 0||e.gpu<=0)&&e?.gpuTypes?.length)throw new UX("resources.gpuTypes was set without a positive resources.gpu count \u2014 declare how many GPUs to reserve, or drop gpuTypes.");let t=e?.gpu!==void 0&&e.gpu>0?`${e.gpuTypes?.length?e.gpuTypes[0]:"any"}:${e.gpu}`:void 0;return{cpu:e?.cpu??X8t,memoryMiB:e?.memory!==void 0?Math.ceil(e.memory*1024):Z8t,...t!==void 0?{gpu:t}:{}}}function dKe(e){let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})(?:\/(\d{1,3}))?$/.exec(e);return!(!t||[t[1],t[2],t[3],t[4]].some(n=>Number(n)>255)||t[5]!==void 0&&Number(t[5])>32)}function Q8t(e){return/^\d{1,3}(\.\d{1,3}){3}(\/\d+)?$/.test(e)&&!dKe(e)}function eWt(e){return e.startsWith("[")?!0:(e.match(/:/g)?.length??0)>=2}function tWt(e){return/^[^:]+:\d+$/.test(e)}function VX(e){if(!e||e.outbound==="open"){if(e?.allowedDestinations?.length)throw new Error("network.allowedDestinations is only valid when outbound is blocked");return{}}let t=e.allowedDestinations??[];if(t.length===0)return{blockNetwork:!0};let n=[],r=[];for(let a of t)if(dKe(a))n.push(a.includes("/")?a:`${a}/32`);else{if(Q8t(a))throw new BX("invalid-ipv4",`"${a}" is not a valid IPv4 address or CIDR (octets must be 0-255, prefix 0-32). Fix the address or list a hostname instead.`,a);if(eWt(a))n.push(a.includes("/")?a:`${a}/128`);else{if(tWt(a))throw new BX("port-unsupported",`Modal's network allowlist filters hosts and IPs only and cannot match a port; drop the ":<port>" from "${a}" and list just the host or IP.`,a);r.push(a)}}return{outboundCidrAllowlist:n,outboundDomainAllowlist:r}}function VU(e){if(!e||e.outbound==="open"){if(e?.allowedDestinations?.length)throw new Error("network.allowedDestinations is only valid when outbound is blocked");return{outboundCidrAllowlist:["0.0.0.0/0"],outboundDomainAllowlist:["*"]}}let t=VX(e);return{outboundCidrAllowlist:t.outboundCidrAllowlist??[],outboundDomainAllowlist:rWt(t.outboundDomainAllowlist??[])}}function rWt(e){return e.length>0?e:[nWt]}function fKe(e,t){if(!t||t.length===0)return!1;let n=a=>a===void 0?"open|":`${a.outbound}|${[...new Set(a.allowedDestinations??[])].sort().join(",")}`,r=n(e);return t.some(a=>n(a)!==r)}function pKe(e){let t=e.split("/")[0];return/^\d{12}\.dkr\.ecr\.[a-z0-9-]+\.amazonaws\.com$/.test(t)?"aws-ecr":t==="gcr.io"||t.endsWith(".gcr.io")||t.endsWith("-docker.pkg.dev")?"gcp-artifact-registry":"registry"}function qX(e,t,n){let{[aKe]:r,[sKe]:a,...i}=t;return{sandboxId:e,image:r??n??"",metadata:i,startedAt:a??""}}async function gKe(e,t){let n=[];try{for await(let r of e()){if(t!==void 0&&n.length>=t)return{sandboxes:n,complete:!1,pagesFetched:n.length,stoppedAtLimit:!0,error:`stopped at the requested limit of ${t} with more sandboxes available`};if(n.length>=FX)return{sandboxes:n,complete:!1,pagesFetched:n.length,stoppedAtLimit:!1,error:`sandbox list exceeded ${FX} sandboxes`};let a=await r.getTags();n.push(qX(r.sandboxId,a))}}catch(r){return{sandboxes:n,complete:!1,pagesFetched:n.length,stoppedAtLimit:!1,error:`sandbox list failed: ${r instanceof Error?r.message:String(r)}`}}return{sandboxes:n,complete:!0,pagesFetched:n.length,stoppedAtLimit:!1}}function qU(e={}){let t=e.tokenId??process.env.MODAL_TOKEN_ID,n=e.tokenSecret??process.env.MODAL_TOKEN_SECRET;if(!t||!n)throw new Error("Modal credentials required. Set MODAL_TOKEN_ID and MODAL_TOKEN_SECRET environment variables, or pass tokenId/tokenSecret in config. Get your token at https://modal.com/settings/tokens");return new $X({...e,tokenId:t,tokenSecret:n})}var rKe,LU,iKe,LX,rO,tKe,aKe,sKe,oKe,MX,UX,X8t,Z8t,BX,nWt,FX,hKe,mKe,nKe,$X,iWt,aWt,sWt,oWt,cWt,lWt,uWt,dWt,fWt,pWt,hWt,$U=Q(()=>{"use strict";r9e();rKe=Ve(NX(),1),LU="c-fae503a880ec",iKe={[`evolve-all-${LU}`]:`evolvingmachines/evolve-all:${LU}`,"evolve-all":"evolvingmachines/evolve-all"},LX=1440*60*1e3,rO=8*1024*1024;tKe="user",aKe="evolve.image",sKe="evolve.startedAt",oKe=class extends Error{requestedTimeoutMs;constructor(e){let t=(e/36e5).toFixed(1);super(`Modal sandboxes have a hard 24h lifetime cap; requested timeout was ${t}h. For sessions longer than 24h, persist progress with Evolve checkpoints and resume in a fresh sandbox instead of extending the timeout.`),this.name="ModalSandboxLifetimeError",this.requestedTimeoutMs=e}};MX=class extends Error{requestedIdleTimeoutMs;constructor(e,t){super(`Modal idleTimeoutMs of ${e}ms is invalid: ${t}`),this.name="ModalIdleTimeoutError",this.requestedIdleTimeoutMs=e}};UX=class extends Error{constructor(e){super(e),this.name="ModalResourcesError"}},X8t=4,Z8t=4096;BX=class extends Error{reason;destination;constructor(e,t,n){super(t),this.name="ModalNetworkPolicyError",this.reason=e,this.destination=n}};nWt="sealed.invalid";FX=1e4,hKe=class{constructor(e,t){this.sandbox=e,this.user=t}async run(e,t){let n=DX(e,this.user,t?.cwd,t?.envs),r=await this.sandbox.exec(n,{timeoutMs:t?.timeoutMs}),{stdout:a,stderr:i}=await this.accumulateStreams(r,t?.onStdout,t?.onStderr);return{exitCode:await r.wait(),stdout:a,stderr:i}}async spawn(e,t){let n=DX(e,this.user,t?.cwd,t?.envs),r=await this.sandbox.exec(n,{timeoutMs:t?.timeoutMs}),a="",i="",s=this.accumulateStreams(r,t?.onStdout?o=>{t.onStdout(o)}:void 0,t?.onStderr?o=>{t.onStderr(o)}:void 0).then(({stdout:o,stderr:c})=>{a=o,i=c}).catch(()=>{});return{processId:`modal-${Date.now()}-${Math.random().toString(36).slice(2)}`,wait:async()=>(await s,{exitCode:await r.wait(),stdout:a,stderr:i}),kill:async()=>!1}}async list(){let e=await this.sandbox.exec(["ps","-eo","pid,comm,args"],{timeoutMs:1e4});return await e.wait(),(await e.stdout.readText()).trim().split(`
|
|
250
250
|
`).slice(1).map(t=>{let n=t.trim().split(/\s+/);return{processId:n[0],cmd:n[1]||"",args:n.slice(2),envs:{}}})}async connect(e,t){throw new Error("Modal does not support connecting to existing processes")}async sendStdin(e,t){throw new Error("Modal does not support sendStdin by process ID")}async kill(e){return await(await this.sandbox.exec(["kill","-9",e],{timeoutMs:1e4})).wait()===0}async accumulateStreams(e,t,n){let r="",a="",i=[];return i.push((async()=>{try{for await(let s of e.stdout){let o=typeof s=="string"?s:new TextDecoder().decode(s);r+=o,t?.(o)}}catch{}})()),i.push((async()=>{try{for await(let s of e.stderr){let o=typeof s=="string"?s:new TextDecoder().decode(s);a+=o,n?.(o)}}catch{}})()),await Promise.all(i),{stdout:r,stderr:a}}},mKe=class{constructor(e,t){this.sandbox=e,this.user=t}async chownToUser(e,t=!1){if(this.user==="root")return;let n=t?["chown","-R",`${this.user}:${this.user}`,e]:["chown",`${this.user}:${this.user}`,e];await(await this.sandbox.exec(n,{timeoutMs:t?3e4:1e4})).wait()}async writeStdinChunked(e,t){for(let n=0;n<t.length;n+=rO)await e.writeBytes(t.subarray(n,n+rO))}async writeStdinCoalesced(e,t){let n=[],r=0,a=async()=>{if(r===0)return;let i=n.length===1?n[0]:Buffer.concat(n,r);n=[],r=0,await this.writeStdinChunked(e,i)};for await(let i of t)n.push(i),r+=i.length,r>=rO&&await a();await a()}async read(e){let t=await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"}),n=await t.wait();if(n!==0){let a=await t.stderr.readText();throw new Error(`Failed to read file ${e}: ${a||`exit code ${n}`}`)}let r=await t.stdout.readBytes();if(!r.includes(0))try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(r)}catch{}return r}async write(e,t){let n=this.toBuffer(t),r=e.substring(0,e.lastIndexOf("/"));r&&await this.makeDir(r);let a=e.replace(/'/g,"'\\''"),i=await this.sandbox.exec(["bash","-c",`cat > '${a}'`],{mode:"binary"});await this.writeStdinChunked(i.stdin,new Uint8Array(n)),await i.stdin.getWriter().close(),await i.wait(),await this.chownToUser(e)}async writeBatch(e){let t=(0,rKe.pack)(),n=new Set;for(let a of e){let i=this.toBuffer(a.data),s=a.path.startsWith("/")?a.path.slice(1):a.path;t.entry({name:s},i);let o=a.path.substring(0,a.path.lastIndexOf("/"));o&&n.add(o)}t.finalize();let r=await this.sandbox.exec(["tar","-xf","-","-C","/"],{mode:"binary"});if(await this.writeStdinCoalesced(r.stdin,t),await r.stdin.getWriter().close(),await r.wait(),n.size>0){let a=Array.from(n),i=new Set(a.map(s=>s.split("/").slice(0,4).join("/")));for(let s of i)await this.chownToUser(s,!0)}}async makeDir(e){await(await this.sandbox.exec(["mkdir","-p",e],{timeoutMs:1e4})).wait(),await this.chownToUser(e,!0)}async exists(e){return await(await this.sandbox.exec(["test","-e",e],{timeoutMs:1e4})).wait()===0}async list(e){let t=e.replace(/'/g,"'\\''"),n=await this.sandbox.exec(["bash","-c",`ls -la '${t}' | tail -n +2`],{timeoutMs:3e4});await n.wait();let r=await n.stdout.readText(),a=[];for(let i of r.trim().split(`
|
|
251
|
-
`)){if(!i)continue;let s=i.split(/\s+/);if(s.length<9)continue;let o=s[0],c=s.slice(8).join(" ");c==="."||c===".."||a.push({name:c,path:e.endsWith("/")?`${e}${c}`:`${e}/${c}`,type:o.startsWith("d")?"dir":"file"})}return a}async remove(e){await(await this.sandbox.exec(["rm","-rf",e],{timeoutMs:3e4})).wait()}async rename(e,t){await(await this.sandbox.exec(["mv",e,t],{timeoutMs:3e4})).wait()}async readStream(e){return(await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"})).stdout}async writeStream(e,t){let n=e.substring(0,e.lastIndexOf("/"));n&&await this.makeDir(n);let r=e.replace(/'/g,"'\\''"),a=await this.sandbox.exec(["bash","-c",`cat > '${r}'`],{mode:"binary"});await this.writeStdinCoalesced(a.stdin,j8t(t)),await a.stdin.getWriter().close(),await a.wait(),await this.chownToUser(e)}async writeFromPath(e,t){let{createReadStream:n}=await import("fs"),{Readable:r}=await import("stream"),a=r.toWeb(n(t,{highWaterMark:rO}));await this.writeStream(e,a)}async uploadUrl(e,t){throw new Error("Modal does not support pre-signed upload URLs")}async downloadUrl(e,t){throw new Error("Modal does not support pre-signed download URLs")}async watchDir(e,t,n){throw new Error("Modal does not support watchDir")}toBuffer(e){if(typeof e=="string")return Buffer.from(e,"utf-8");if(e instanceof Buffer)return e;if(e instanceof ArrayBuffer||e instanceof Uint8Array)return Buffer.from(e);throw new Error(`Unsupported data type: ${typeof e}`)}},nKe=class{constructor(e,t,n){this.sandbox=e,this.commands=new hKe(e,n),this.files=new mKe(e,n),this.image=t}commands;files;image;get sandboxId(){return this.sandbox.sandboxId}async getHost(e){let t=(await this.sandbox.tunnels())[e];if(!t)throw new Error(`No tunnel found for port ${e}`);return t.url}async isRunning(){try{return await this.sandbox.poll()===null}catch{return!1}}async getInfo(){let e=await this.sandbox.getTags();return qX(this.sandbox.sandboxId,e,this.image)}async updateNetwork(e){await this.sandbox.updateNetworkPolicy(VU(e))}async kill(){try{await this.sandbox.terminate()}catch{await new Promise(e=>setTimeout(e,500)),await this.sandbox.terminate()}}async pause(){throw new Error("Modal does not support pause/resume. Persist progress with Evolve checkpoints and resume in a fresh sandbox, or use kill() to terminate.")}},$X=class{providerType="modal";name="Modal";client;appName;defaultTimeoutMs;imageName;imageSecretName;_app;sandboxUsers=new Map;constructor(e){!e.endpoint&&process.env.MODAL_SERVER_URL?.startsWith("unix:")?process.env.MODAL_SERVER_URL="https://api.modal.com:443":e.endpoint&&(process.env.MODAL_SERVER_URL=e.endpoint),this.client=new DYe({tokenId:e.tokenId,tokenSecret:e.tokenSecret}),this.appName=e.appName??"evolve-sandbox",this.defaultTimeoutMs=e.defaultTimeoutMs??36e5,this.imageName=e.imageName??`evolve-all-${LU}`,this.imageSecretName=e.imageSecretName}async getApp(){return this._app||(this._app=await this.client.apps.fromName(this.appName,{createIfMissing:!0})),this._app}async resolveImage(e){let t=pKe(e);if(t==="registry"){let r=this.imageSecretName?await this.client.secrets.fromName(this.imageSecretName):void 0;return this.client.images.fromRegistry(e,r)}if(!this.imageSecretName)throw new Error(`Private registry image "${e}" requires config.imageSecretName \u2014 the name of a Modal Secret holding registry credentials (AWS ECR: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION with read-only ECR IAM). Create one at https://modal.com/secrets`);let n=await this.client.secrets.fromName(this.imageSecretName);return t==="aws-ecr"?this.client.images.fromAwsEcr(e,n):this.client.images.fromGcpArtifactRegistry(e,n)}async resolveAndBuildImage(e){let t=await this.getApp(),n=iKe[e]??e,r=await this.resolveImage(n);return{tag:n,image:await r.build(t)}}async prepareImage(e){await this.resolveAndBuildImage(e||this.imageName)}async create(e){let t=e.timeoutMs??this.defaultTimeoutMs;cKe(t);let n=lKe(e.idleTimeoutMs);for(let h of e.phaseNetworkPolicies??[])VU(h);let r=fKe(e.network,e.phaseNetworkPolicies)?VU(e.network):VX(e.network),a=uKe(e.resources),i=e.user??tKe,s=await this.getApp(),{tag:o,image:c}=await this.resolveAndBuildImage(e.image||this.imageName),l=e.envs?Object.fromEntries(Object.entries(e.envs).filter(([,h])=>h!=null)):void 0,u=l&&Object.keys(l).length>0?l:void 0,d={...e.metadata,[aKe]:o,[sKe]:new Date().toISOString()},f=await this.client.sandboxes.create(s,c,{cpu:a.cpu,memoryMiB:a.memoryMiB,...a.gpu!==void 0?{gpu:a.gpu}:{},timeoutMs:t,...n,workdir:e.workingDirectory,env:u,tags:d,...r});return e.workingDirectory&&i!=="root"&&await(await f.exec(["chown","-R",`${i}:${i}`,e.workingDirectory],{timeoutMs:3e4})).wait(),this.sandboxUsers.set(f.sandboxId,i),new nKe(f,o,i)}async connect(e,t){let n=await this.client.sandboxes.fromId(e),r=this.sandboxUsers.get(e)??tKe;return new nKe(n,void 0,r)}async list(e){let t=await this.walk(e);if(t.error&&!t.stoppedAtLimit)throw new Error(t.error);return t.sandboxes}async listAll(e){let{stoppedAtLimit:t,...n}=await this.walk(e);return n}async walk(e){if(e?.state&&!e.state.includes("running"))return{sandboxes:[],complete:!0,pagesFetched:0,stoppedAtLimit:!1};let t;try{t=await this.getApp()}catch(n){return{sandboxes:[],complete:!1,pagesFetched:0,stoppedAtLimit:!1,error:`sandbox list failed: ${n instanceof Error?n.message:String(n)}`}}return gKe(()=>this.client.sandboxes.list({appId:t.appId,tags:e?.metadata}),e?.limit)}async listSandboxIds(){let e=new Set;try{let t=await this.getApp();for await(let n of this.client.sandboxes.list({appId:t.appId}))e.add(n.sandboxId);return{ids:e,complete:!0}}catch{return{ids:new Set,complete:!1}}}};iWt=DX,aWt=iKe,sWt=VX,oWt=VU,cWt=fKe,lWt=uKe,uWt=pKe,dWt=qX,fWt=gKe,pWt=cKe,hWt=lKe});var vKe={};Fu(vKe,{extractTarGz:()=>vWt,tarGzipDirectory:()=>yWt});async function gWt(e){let t=[],n=async r=>{let a=r===""?e:(0,mv.join)(e,r),i=await(0,hv.readdir)(a,{withFileTypes:!0});i.sort((s,o)=>s.name<o.name?-1:s.name>o.name?1:0);for(let s of i){if(mWt.has(s.name))continue;let o=r===""?s.name:`${r}/${s.name}`,c=(0,mv.join)(a,s.name),l=await(0,hv.lstat)(c);l.isSymbolicLink()||(l.isDirectory()?await n(o):l.isFile()&&t.push({rel:o,abs:c,mode:l.mode&73?493:420,size:l.size}))}};return await n(""),t.sort((r,a)=>r.rel<a.rel?-1:r.rel>a.rel?1:0)}async function yWt(e){let t=await gWt(e),n=(0,GU.pack)(),r=(0,zU.createGzip)({level:9}),a=[],i=(async()=>{for await(let o of r)a.push(Buffer.from(o))})(),s=(async()=>{for(let{rel:o,abs:c,mode:l,size:u}of t){let d=n.entry({name:o,size:u,mode:l,mtime:new Date(0),uid:0,gid:0,uname:"",gname:"",type:"file"});await(0,iO.pipeline)((0,aO.createReadStream)(c),d)}n.finalize()})();return await Promise.all([(0,iO.pipeline)(n,r),s,i]),Buffer.concat(a)}async function vWt(e,t,n){let r=(0,GU.extract)(),a=[],i=(async()=>{for await(let s of r){let o=s.header.name,c=o.split("/").filter(u=>u!==""&&u!==".");if(o.startsWith("/")||o.includes("\\")||c.length===0||c.some(u=>u===".."))throw new Error(`refusing to extract "${o}": the path escapes the target directory`);if(c[0]!==n)throw new Error(`refusing to extract "${o}": entry outside ${n}/`);if(s.header.type==="directory"){await(0,hv.mkdir)((0,mv.join)(t,...c),{recursive:!0}),s.resume();continue}if(s.header.type!=="file")throw new Error(`refusing to extract "${o}": unsupported entry type "${s.header.type}"`);let l=(0,mv.join)(t,...c);await(0,hv.mkdir)((0,mv.dirname)(l),{recursive:!0}),await(0,iO.pipeline)(s,(0,aO.createWriteStream)(l)),a.push(c.join("/"))}})();try{await Promise.all([(0,iO.pipeline)((0,aO.createReadStream)(e),(0,zU.createGunzip)(),r),i])}catch(s){throw r.destroy(),s}return a}var zU,aO,hv,mv,iO,GU,mWt,bKe=Q(()=>{"use strict";zU=require("zlib"),aO=require("fs"),hv=require("fs/promises"),mv=require("path"),iO=require("stream/promises"),GU=Ve(NX(),1),mWt=new Set([".git",".DS_Store",".venv"])});var IKe={};Fu(IKe,{ManagedModalProvider:()=>wWt,ManagedModalWriteLimitError:()=>SKe,_testManagedModalSandbox:()=>IWt});function bWt(e){if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof Uint8Array)return new Uint8Array(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new Error(`Unsupported data type: ${typeof e}`)}function wKe(e){return{sandboxId:e.sandboxId,image:e.image??"",metadata:e.metadata??{},startedAt:e.startedAt??""}}var SKe,_Ke,SWt,_Wt,zX,wWt,IWt,xKe=Q(()=>{"use strict";SKe=class extends Error{bytes;constructor(e,t){super(`Managed Modal ${e} body is ${t} bytes; the managed door caps every request at 1048576 bytes (1 MiB) of wire bytes, base64 inflation included. Split the payload into smaller writes.`),this.name="ManagedModalWriteLimitError",this.bytes=t}};_Ke=class{constructor(e){this.config=e}async request(e,t,n){let r=await fetch(`${this.config.baseUrl}${t}`,{...n,headers:{authorization:`Bearer ${this.config.apiKey}`,...n.headers??{}}});if(!r.ok){let a="";try{a=(await r.json())?.error??""}catch{}throw new Error(`Managed Modal ${e} failed (${r.status})${a?`: ${a}`:""}`)}return r}json(e){return{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}}},SWt=class{constructor(e,t){this.door=e,this.sandboxId=t}async run(e,t){let n=await this.door.request("exec",`/sandboxes/${encodeURIComponent(this.sandboxId)}/exec`,this.door.json({command:e,...t?.cwd?{cwd:t.cwd}:{},...t?.envs?{envs:t.envs}:{},...t?.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{}})),r="",a="",i,s=o=>{if(!o.trim())return;let c;try{c=JSON.parse(o)}catch{throw new Error(`Managed Modal exec stream carried a garbled record: ${o}`)}c.stream==="stdout"&&typeof c.data=="string"?(r+=c.data,t?.onStdout?.(c.data)):c.stream==="stderr"&&typeof c.data=="string"?(a+=c.data,t?.onStderr?.(c.data)):i=c};if(n.body){let o=n.body.getReader(),c=new TextDecoder,l="";for(;;){let{done:u,value:d}=await o.read();if(u)break;l+=c.decode(d,{stream:!0});let f;for(;(f=l.indexOf(`
|
|
251
|
+
`)){if(!i)continue;let s=i.split(/\s+/);if(s.length<9)continue;let o=s[0],c=s.slice(8).join(" ");c==="."||c===".."||a.push({name:c,path:e.endsWith("/")?`${e}${c}`:`${e}/${c}`,type:o.startsWith("d")?"dir":"file"})}return a}async remove(e){await(await this.sandbox.exec(["rm","-rf",e],{timeoutMs:3e4})).wait()}async rename(e,t){await(await this.sandbox.exec(["mv",e,t],{timeoutMs:3e4})).wait()}async readStream(e){return(await this.sandbox.exec(["cat",e],{timeoutMs:3e5,mode:"binary"})).stdout}async writeStream(e,t){let n=e.substring(0,e.lastIndexOf("/"));n&&await this.makeDir(n);let r=e.replace(/'/g,"'\\''"),a=await this.sandbox.exec(["bash","-c",`cat > '${r}'`],{mode:"binary"});await this.writeStdinCoalesced(a.stdin,j8t(t)),await a.stdin.getWriter().close(),await a.wait(),await this.chownToUser(e)}async writeFromPath(e,t){let{createReadStream:n}=await import("fs"),{Readable:r}=await import("stream"),a=r.toWeb(n(t,{highWaterMark:rO}));await this.writeStream(e,a)}async uploadUrl(e,t){throw new Error("Modal does not support pre-signed upload URLs")}async downloadUrl(e,t){throw new Error("Modal does not support pre-signed download URLs")}async watchDir(e,t,n){throw new Error("Modal does not support watchDir")}toBuffer(e){if(typeof e=="string")return Buffer.from(e,"utf-8");if(e instanceof Buffer)return e;if(e instanceof ArrayBuffer||e instanceof Uint8Array)return Buffer.from(e);throw new Error(`Unsupported data type: ${typeof e}`)}},nKe=class{constructor(e,t,n){this.sandbox=e,this.commands=new hKe(e,n),this.files=new mKe(e,n),this.image=t}commands;files;image;get sandboxId(){return this.sandbox.sandboxId}async getHost(e){let t=(await this.sandbox.tunnels())[e];if(!t)throw new Error(`No tunnel found for port ${e}`);return t.url}async isRunning(){try{return await this.sandbox.poll()===null}catch{return!1}}async getInfo(){let e=await this.sandbox.getTags();return qX(this.sandbox.sandboxId,e,this.image)}async updateNetwork(e){await this.sandbox.updateNetworkPolicy(VU(e))}async kill(){try{await this.sandbox.terminate()}catch{await new Promise(e=>setTimeout(e,500)),await this.sandbox.terminate()}}async pause(){throw new Error("Modal does not support pause/resume. Persist progress with Evolve checkpoints and resume in a fresh sandbox, or use kill() to terminate.")}},$X=class{providerType="modal";name="Modal";client;appName;defaultTimeoutMs;imageName;imageSecretName;_app;sandboxUsers=new Map;constructor(e){!e.endpoint&&process.env.MODAL_SERVER_URL?.startsWith("unix:")?process.env.MODAL_SERVER_URL="https://api.modal.com:443":e.endpoint&&(process.env.MODAL_SERVER_URL=e.endpoint),this.client=new DYe({tokenId:e.tokenId,tokenSecret:e.tokenSecret}),this.appName=e.appName??"evolve-sandbox",this.defaultTimeoutMs=e.defaultTimeoutMs??36e5,this.imageName=e.imageName??`evolve-all-${LU}`,this.imageSecretName=e.imageSecretName}async getApp(){return this._app||(this._app=await this.client.apps.fromName(this.appName,{createIfMissing:!0})),this._app}async resolveImage(e){let t=pKe(e);if(t==="registry"){let r=this.imageSecretName?await this.client.secrets.fromName(this.imageSecretName):void 0;return this.client.images.fromRegistry(e,r)}if(!this.imageSecretName)throw new Error(`Private registry image "${e}" requires config.imageSecretName \u2014 the name of a Modal Secret holding registry credentials (AWS ECR: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION with read-only ECR IAM). Create one at https://modal.com/secrets`);let n=await this.client.secrets.fromName(this.imageSecretName);return t==="aws-ecr"?this.client.images.fromAwsEcr(e,n):this.client.images.fromGcpArtifactRegistry(e,n)}async resolveAndBuildImage(e){let t=await this.getApp(),n=iKe[e]??e,r=await this.resolveImage(n);return{tag:n,image:await r.build(t)}}async publishImageAs(e,t){if(!e.trim())throw new Error("publishImageAs requires a non-empty alias to publish under");let{image:n}=await this.resolveAndBuildImage(t||this.imageName);return await n.publish(e),e}async prepareImage(e){await this.resolveAndBuildImage(e||this.imageName)}async create(e){let t=e.timeoutMs??this.defaultTimeoutMs;cKe(t);let n=lKe(e.idleTimeoutMs);for(let h of e.phaseNetworkPolicies??[])VU(h);let r=fKe(e.network,e.phaseNetworkPolicies)?VU(e.network):VX(e.network),a=uKe(e.resources),i=e.user??tKe,s=await this.getApp(),{tag:o,image:c}=await this.resolveAndBuildImage(e.image||this.imageName),l=e.envs?Object.fromEntries(Object.entries(e.envs).filter(([,h])=>h!=null)):void 0,u=l&&Object.keys(l).length>0?l:void 0,d={...e.metadata,[aKe]:o,[sKe]:new Date().toISOString()},f=await this.client.sandboxes.create(s,c,{cpu:a.cpu,memoryMiB:a.memoryMiB,...a.gpu!==void 0?{gpu:a.gpu}:{},timeoutMs:t,...n,workdir:e.workingDirectory,env:u,tags:d,...r});return e.workingDirectory&&i!=="root"&&await(await f.exec(["chown","-R",`${i}:${i}`,e.workingDirectory],{timeoutMs:3e4})).wait(),this.sandboxUsers.set(f.sandboxId,i),new nKe(f,o,i)}async connect(e,t){let n=await this.client.sandboxes.fromId(e),r=this.sandboxUsers.get(e)??tKe;return new nKe(n,void 0,r)}async list(e){let t=await this.walk(e);if(t.error&&!t.stoppedAtLimit)throw new Error(t.error);return t.sandboxes}async listAll(e){let{stoppedAtLimit:t,...n}=await this.walk(e);return n}async walk(e){if(e?.state&&!e.state.includes("running"))return{sandboxes:[],complete:!0,pagesFetched:0,stoppedAtLimit:!1};let t;try{t=await this.getApp()}catch(n){return{sandboxes:[],complete:!1,pagesFetched:0,stoppedAtLimit:!1,error:`sandbox list failed: ${n instanceof Error?n.message:String(n)}`}}return gKe(()=>this.client.sandboxes.list({appId:t.appId,tags:e?.metadata}),e?.limit)}async listSandboxIds(){let e=new Set;try{let t=await this.getApp();for await(let n of this.client.sandboxes.list({appId:t.appId}))e.add(n.sandboxId);return{ids:e,complete:!0}}catch{return{ids:new Set,complete:!1}}}};iWt=DX,aWt=iKe,sWt=VX,oWt=VU,cWt=fKe,lWt=uKe,uWt=pKe,dWt=qX,fWt=gKe,pWt=cKe,hWt=lKe});var vKe={};Fu(vKe,{extractTarGz:()=>vWt,tarGzipDirectory:()=>yWt});async function gWt(e){let t=[],n=async r=>{let a=r===""?e:(0,mv.join)(e,r),i=await(0,hv.readdir)(a,{withFileTypes:!0});i.sort((s,o)=>s.name<o.name?-1:s.name>o.name?1:0);for(let s of i){if(mWt.has(s.name))continue;let o=r===""?s.name:`${r}/${s.name}`,c=(0,mv.join)(a,s.name),l=await(0,hv.lstat)(c);l.isSymbolicLink()||(l.isDirectory()?await n(o):l.isFile()&&t.push({rel:o,abs:c,mode:l.mode&73?493:420,size:l.size}))}};return await n(""),t.sort((r,a)=>r.rel<a.rel?-1:r.rel>a.rel?1:0)}async function yWt(e){let t=await gWt(e),n=(0,GU.pack)(),r=(0,zU.createGzip)({level:9}),a=[],i=(async()=>{for await(let o of r)a.push(Buffer.from(o))})(),s=(async()=>{for(let{rel:o,abs:c,mode:l,size:u}of t){let d=n.entry({name:o,size:u,mode:l,mtime:new Date(0),uid:0,gid:0,uname:"",gname:"",type:"file"});await(0,iO.pipeline)((0,aO.createReadStream)(c),d)}n.finalize()})();return await Promise.all([(0,iO.pipeline)(n,r),s,i]),Buffer.concat(a)}async function vWt(e,t,n){let r=(0,GU.extract)(),a=[],i=(async()=>{for await(let s of r){let o=s.header.name,c=o.split("/").filter(u=>u!==""&&u!==".");if(o.startsWith("/")||o.includes("\\")||c.length===0||c.some(u=>u===".."))throw new Error(`refusing to extract "${o}": the path escapes the target directory`);if(c[0]!==n)throw new Error(`refusing to extract "${o}": entry outside ${n}/`);if(s.header.type==="directory"){await(0,hv.mkdir)((0,mv.join)(t,...c),{recursive:!0}),s.resume();continue}if(s.header.type!=="file")throw new Error(`refusing to extract "${o}": unsupported entry type "${s.header.type}"`);let l=(0,mv.join)(t,...c);await(0,hv.mkdir)((0,mv.dirname)(l),{recursive:!0}),await(0,iO.pipeline)(s,(0,aO.createWriteStream)(l)),a.push(c.join("/"))}})();try{await Promise.all([(0,iO.pipeline)((0,aO.createReadStream)(e),(0,zU.createGunzip)(),r),i])}catch(s){throw r.destroy(),s}return a}var zU,aO,hv,mv,iO,GU,mWt,bKe=Q(()=>{"use strict";zU=require("zlib"),aO=require("fs"),hv=require("fs/promises"),mv=require("path"),iO=require("stream/promises"),GU=Ve(NX(),1),mWt=new Set([".git",".DS_Store",".venv"])});var IKe={};Fu(IKe,{ManagedModalProvider:()=>wWt,ManagedModalWriteLimitError:()=>SKe,_testManagedModalSandbox:()=>IWt});function bWt(e){if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof Uint8Array)return new Uint8Array(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new Error(`Unsupported data type: ${typeof e}`)}function wKe(e){return{sandboxId:e.sandboxId,image:e.image??"",metadata:e.metadata??{},startedAt:e.startedAt??""}}var SKe,_Ke,SWt,_Wt,zX,wWt,IWt,xKe=Q(()=>{"use strict";SKe=class extends Error{bytes;constructor(e,t){super(`Managed Modal ${e} body is ${t} bytes; the managed door caps every request at 1048576 bytes (1 MiB) of wire bytes, base64 inflation included. Split the payload into smaller writes.`),this.name="ManagedModalWriteLimitError",this.bytes=t}};_Ke=class{constructor(e){this.config=e}async request(e,t,n){let r=await fetch(`${this.config.baseUrl}${t}`,{...n,headers:{authorization:`Bearer ${this.config.apiKey}`,...n.headers??{}}});if(!r.ok){let a="";try{a=(await r.json())?.error??""}catch{}throw new Error(`Managed Modal ${e} failed (${r.status})${a?`: ${a}`:""}`)}return r}json(e){return{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}}},SWt=class{constructor(e,t){this.door=e,this.sandboxId=t}async run(e,t){let n=await this.door.request("exec",`/sandboxes/${encodeURIComponent(this.sandboxId)}/exec`,this.door.json({command:e,...t?.cwd?{cwd:t.cwd}:{},...t?.envs?{envs:t.envs}:{},...t?.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{}})),r="",a="",i,s=o=>{if(!o.trim())return;let c;try{c=JSON.parse(o)}catch{throw new Error(`Managed Modal exec stream carried a garbled record: ${o}`)}c.stream==="stdout"&&typeof c.data=="string"?(r+=c.data,t?.onStdout?.(c.data)):c.stream==="stderr"&&typeof c.data=="string"?(a+=c.data,t?.onStderr?.(c.data)):i=c};if(n.body){let o=n.body.getReader(),c=new TextDecoder,l="";for(;;){let{done:u,value:d}=await o.read();if(u)break;l+=c.decode(d,{stream:!0});let f;for(;(f=l.indexOf(`
|
|
252
252
|
`))!==-1;)s(l.slice(0,f)),l=l.slice(f+1)}l+=c.decode(),s(l)}else for(let o of(await n.text()).split(`
|
|
253
253
|
`))s(o);if(i?.error!==void 0)throw new Error(`Managed Modal exec failed: ${i.error}`);if(typeof i?.exitCode!="number")throw new Error("Managed Modal exec stream ended without a terminal record \u2014 the connection died mid-run.");return{exitCode:i.exitCode,stdout:r,stderr:a}}async spawn(e,t){let n=this.run(e,t);return n.catch(()=>{}),{processId:`managed-modal-${Date.now()}-${Math.random().toString(36).slice(2)}`,wait:()=>n,kill:async()=>!1}}async list(){return(await this.run("ps -eo pid,comm,args")).stdout.trim().split(`
|
|
254
254
|
`).slice(1).filter(e=>e.trim()).map(e=>{let t=e.trim().split(/\s+/);return{processId:t[0],cmd:t[1]||"",args:t.slice(2),envs:{}}})}async kill(e){return/^\d+$/.test(e)?(await this.run(`kill -9 ${e}`)).exitCode===0:!1}},_Wt=class{constructor(e,t){this.door=e,this.sandboxId=t}filesPath(e){return`/sandboxes/${encodeURIComponent(this.sandboxId)}/files/${e}`}encodeContent(e){return typeof e=="string"?{content:e}:{content:Buffer.from(bWt(e)).toString("base64"),encoding:"base64"}}boundedJson(e,t){let n=this.door.json(t),r=Buffer.byteLength(n.body,"utf8");if(r>1048576)throw new SKe(e,r);return n}async read(e){let t=await(await this.door.request("file read",this.filesPath("read"),this.door.json({path:e}))).json();return t.encoding==="base64"?new Uint8Array(Buffer.from(t.content??"","base64")):t.content??""}async write(e,t){await this.door.request("file write",this.filesPath("write"),this.boundedJson("file write",{path:e,...this.encodeContent(t)}))}async writeBatch(e){e.length!==0&&await this.door.request("file writeBatch",this.filesPath("writeBatch"),this.boundedJson("file writeBatch",{files:e.map(t=>({path:t.path,...this.encodeContent(t.data)}))}))}async makeDir(e){await this.door.request("makeDir",this.filesPath("makeDir"),this.door.json({path:e}))}};zX=class{constructor(e,t){this.door=e,this.sandboxId=t,this.commands=new SWt(e,t),this.files=new _Wt(e,t)}commands;files;async getHost(e){throw new Error("Managed Modal sandboxes expose no tunnels, so getHost() is unavailable through the managed door.")}async kill(){try{await this.door.request("kill",`/sandboxes/${encodeURIComponent(this.sandboxId)}`,{method:"DELETE"})}catch(e){if(e instanceof Error&&e.message.includes("(404)"))return;throw e}}async pause(){throw new Error("Modal does not support pause/resume. Persist progress with Evolve checkpoints and resume in a fresh sandbox, or use kill() to terminate.")}async isRunning(){try{return await this.getInfo(),!0}catch(e){if(e instanceof Error&&e.message.includes("(404)"))return!1;throw e}}async getInfo(){let e=await this.door.request("get",`/sandboxes/${encodeURIComponent(this.sandboxId)}`,{method:"GET"});return wKe(await e.json())}},wWt=class{providerType="modal";name="Managed Modal";door;constructor(e){this.door=new _Ke(e)}async create(e){if(e.resources!==void 0)throw new Error("Managed Modal sandboxes are platform-sized; `resources` cannot be enforced through the managed door.");if(e.network!==void 0)throw new Error("Managed Modal sandboxes run the platform's network policy; `network` cannot be enforced through the managed door.");if(e.user!==void 0)throw new Error("Managed Modal sandboxes run as the platform's sandbox user; `user` cannot be enforced through the managed door.");if(e.idleTimeoutMs!==void 0)throw new Error("The managed Modal door takes no idle timeout; bound the sandbox with `timeoutMs` instead.");let t=await(await this.door.request("create","/sandboxes",this.door.json({...e.image?{image:e.image}:{},...e.timeoutMs!==void 0?{timeoutMs:e.timeoutMs}:{},...e.workingDirectory?{workingDirectory:e.workingDirectory}:{},...e.envs?{envs:e.envs}:{},...e.metadata?{metadata:e.metadata}:{}}))).json();return new zX(this.door,t.sandboxId)}async connect(e,t){let n=new zX(this.door,e);return await n.getInfo(),n}async list(e){if(e?.state&&!e.state.includes("running"))return[];let t=((await(await this.door.request("list","/sandboxes",{method:"GET"})).json()).sandboxes??[]).map(wKe);if(e?.metadata){let n=Object.entries(e.metadata);t=t.filter(r=>n.every(([a,i])=>r.metadata[a]===i))}return e?.limit!==void 0&&(t=t.slice(0,e.limit)),t}async listAll(e){if(e?.state&&!e.state.includes("running"))return{sandboxes:[],complete:!0,pagesFetched:0};let t;try{t=await this.list({...e,limit:void 0})}catch(a){return{sandboxes:[],complete:!1,pagesFetched:0,error:`sandbox list failed: ${a instanceof Error?a.message:String(a)}`}}let n=e?.limit!==void 0?t.slice(0,e.limit):t,r=n.length<t.length;return{sandboxes:n,complete:!r,pagesFetched:1,...r?{error:`stopped at the requested limit of ${e?.limit} with more sandboxes available`}:{}}}},IWt=(e,t)=>new zX(new _Ke(e),t)});function Lu(e=""){let t=process.env.EVOLVE_GATEWAY_URL||"https://swarmkit-gateway-692833842999.us-central1.run.app";if(!e)return t;let n=e.startsWith("/")?e:`/${e}`;return`${t}${n}`}function wO(e=""){let t=process.env.EVOLVE_DASHBOARD_URL||ia;if(!e)return t;let n=e.startsWith("/")?e:`/${e}`;return`${t.replace(/\/$/,"")}${n}`}var IO=["e2b","daytona","modal"];function Vw(e){return wO(`/api/managed/${e}`)}function qZ(){return`${Vw("daytona")}/toolbox`}function lB(){return Vw("e2b")}function $Z(e){return{"browser-use":{type:"http",url:Lu("/browser_use/mcp"),headers:{"x-litellm-api-key":`Bearer ${e}`}}}}var yc="EVOLVE_API_KEY",xO="E2B_API_KEY",EO="DAYTONA_API_KEY",TO="MODAL_TOKEN_ID",uB="MODAL_TOKEN_SECRET",dB="claude",kO=36e5,zZ=4,fB=100,Dp="/home/user";function GZ(e,t){return t?t.replace(/\/+$/,"")||"/":e?e==="root"?"/root":`/home/${e}`:Dp}var ia=process.env.EVOLVE_DASHBOARD_URL||"https://dashboard.evolvingmachines.ai",Vu="x-litellm-customer-id",Up="x-litellm-tags",gm="run:",JZ=".evolve-sdk/observability/sessions",OO=["tag","provider","agent","model","sandboxId","sandbox_id","timestamp","event","events"],HZ=100,WZ=5e3,AO=3,pB=1e3;function hB(e){return e.delivery==="direct"}var PO=18181,ao="/tmp/evolve-managed-secrets",qw=`${ao}/proxy.py`,Iv=`${ao}/config.json`,mm=`${ao}/ca.crt`,_O=`${ao}/ca.key`,_v=`${ao}/ca-bundle.crt`,YZ=["HTTP_PROXY","HTTPS_PROXY","ALL_PROXY","http_proxy","https_proxy","all_proxy","NO_PROXY","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","REQUESTS_CA_BUNDLE","CURL_CA_BUNDLE","GIT_SSL_CAINFO"];function KZ(){return[...YZ]}var jZ=String.raw`#!/usr/bin/env python3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{evolve_sdk-0.0.52.dev902 → evolve_sdk-0.0.52.dev903}/evolve_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|