@myagentroam/agent 0.9.31 → 0.9.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/model/anthropic-messages.js +1 -1
- package/dist/model/catalog-file.d.ts +2 -0
- package/dist/model/configuration.d.ts +7 -0
- package/dist/model/contracts.d.ts +6 -0
- package/dist/model/openai-responses.d.ts +54 -2
- package/dist/model/openai-responses.js +1 -1
- package/dist/model/runtime-credential.d.ts +3 -0
- package/dist/model/runtime-credential.js +2 -0
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/workflow.js +1 -1
- package/dist/sdk/agent.js +1 -1
- package/dist/sdk/types.d.ts +12 -0
- package/dist/session/jsonl-store.d.ts +2 -0
- package/dist/session/jsonl-store.js +1 -1
- package/dist/subagent/scheduler.js +1 -1
- package/dist/tools/codex-image-gen.d.ts +14 -0
- package/dist/tools/codex-image-gen.js +2 -0
- package/dist/tools/exec.js +1 -1
- package/dist/tools/execution-limits.d.ts +5 -2
- package/dist/tools/execution-limits.js +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/tools/runtime-context.d.ts +11 -0
- package/dist/tools/runtime.js +1 -1
- package/dist/tools/task-output.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
const _0x2c4977=_0x1476;(function(_0x2a3a0a,_0x161102){const _0x36c5cc=_0x1476,_0x4a82a1=_0x2a3a0a();while(!![]){try{const _0x52ef80=-parseInt(_0x36c5cc(0x22d))/(-0x1ea6+0x19d*-0x17+0x43c2)*(-parseInt(_0x36c5cc(0x1e7))/(-0xbc*-0x6+0x62b*0x2+-0x10bc))+-parseInt(_0x36c5cc(0x1e0))/(-0x235+0x1*0x1337+-0x10ff)+-parseInt(_0x36c5cc(0x249))/(0x1*0xd75+0xe*-0x241+0x121d*0x1)+parseInt(_0x36c5cc(0x20a))/(0x167d*0x1+-0x60e*-0x1+-0x2*0xe43)*(-parseInt(_0x36c5cc(0x259))/(0x8ea+0x12f5+-0x1*0x1bd9))+parseInt(_0x36c5cc(0x1fa))/(0x235a+-0x10f5*-0x1+-0x3448*0x1)+-parseInt(_0x36c5cc(0x1f7))/(0x1d9b+-0x564+0x97*-0x29)*(-parseInt(_0x36c5cc(0x23e))/(-0x1*-0x13b3+-0x151d+0x35*0x7))+parseInt(_0x36c5cc(0x1f4))/(0x188c+-0x128b+-0x5f7)*(-parseInt(_0x36c5cc(0x204))/(0x1*-0x2431+-0x24e3+0x491f));if(_0x52ef80===_0x161102)break;else _0x4a82a1['push'](_0x4a82a1['shift']());}catch(_0x3a880e){_0x4a82a1['push'](_0x4a82a1['shift']());}}}(_0xa127,-0x6e9b5+-0x4fe8d*-0x1+0xacf7e));import{randomUUID}from'node:crypto';import{mkdir,open,readFile,readdir,rename,rm,stat,writeFile}from'node:fs/promises';function _0x1476(_0x215a27,_0x6f9e30){_0x215a27=_0x215a27-(-0x16f5+-0x2147+0x3a08);const _0x2f893e=_0xa127();let _0x26c0f9=_0x2f893e[_0x215a27];if(_0x1476['LJqhQL']===undefined){var _0x415330=function(_0x47caad){const _0x1cb9b4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xa7ec76='',_0x51a659='';for(let _0x1a56d1=-0x1*-0x68b+-0x39*0x17+-0x16c,_0x555ff1,_0x2c2603,_0x317e67=-0x5c7+-0xf*-0x23+0x1dd*0x2;_0x2c2603=_0x47caad['charAt'](_0x317e67++);~_0x2c2603&&(_0x555ff1=_0x1a56d1%(0x2456+-0x5b*-0x17+-0x2c7f)?_0x555ff1*(0x24ba*0x1+0x1*-0x132d+0x1*-0x114d)+_0x2c2603:_0x2c2603,_0x1a56d1++%(-0xe7c+-0x1d92+0x2c12))?_0xa7ec76+=String['fromCharCode'](-0xe6f+0xe8f*0x1+-0xdf*-0x1&_0x555ff1>>(-(-0x1ab9+-0x6ff*-0x1+0x13bc)*_0x1a56d1&0x1d4d+0x6e9+-0x2430)):-0x14b9+-0xd2*0x2b+0x37ff*0x1){_0x2c2603=_0x1cb9b4['indexOf'](_0x2c2603);}for(let _0x15359a=0x3a9*0x5+0x14d9+-0x2726,_0x2f4b4f=_0xa7ec76['length'];_0x15359a<_0x2f4b4f;_0x15359a++){_0x51a659+='%'+('00'+_0xa7ec76['charCodeAt'](_0x15359a)['toString'](0x1a1a+-0x1abf+0xb5))['slice'](-(0x1*0x246+0xb*-0x119+0x9cf));}return decodeURIComponent(_0x51a659);};_0x1476['TZESvs']=_0x415330,_0x1476['tGARad']={},_0x1476['LJqhQL']=!![];}const _0x1e8c46=_0x2f893e[-0x17d0+-0x37*0xa6+0x3b7a];_0x1476['wrJOtD']!==_0x1e8c46&&(_0x1476['tGARad']={},_0x1476['wrJOtD']=_0x1e8c46);const _0xd344f8=_0x1476['tGARad'][_0x215a27];return _0xd344f8===undefined?(_0x26c0f9=_0x1476['TZESvs'](_0x26c0f9),_0x1476['tGARad'][_0x215a27]=_0x26c0f9):_0x26c0f9=_0xd344f8,_0x26c0f9;}import{join}from'node:path';import{setTimeout as _0x295e02}from'node:timers/promises';import{MarAgentError}from'../error.js';import{todoItemsFromSnapshot}from'../tools/todo.js';const MAX_SEGMENT_BYTES=(-0x1706+-0x1*0xf1+-0x1*-0x1807)*(0xc*0xd2+0x213e+-0x138b*0x2)*(-0x21f3+0x24ba*0x1+0x1*0x139),REVERSE_READ_CHUNK_BYTES=(0x1e44+0x494+-0x2298)*(-0xcfc+-0x1e6b*0x1+0x329*0xf);function _0xa127(){const _0x1331b2=['zMLYC3rtzxf1zw5Jzq','otb3zfriBMS','Aw5KzxGUANnVBG','CgvUzgLUz1nLC3nPB25Z','rvnsq0G','y2XVC2u','yxv0B21HDgLJvgL0Bgvqzw5KAw5N','yxv0B21HDgLJvgL0Bgu','CgfKu3rHCNq','DMvYC2LVBG','zMXVB3i','CMvHzev4zwn1DgLVBLn0yxrL','mJKWmdCYB256tKPm','B2jQzwn0','CMvHza','zMLSDgvY','AgfZrwfYBgLLCG','DhvYBKLK','C3bSAxq','y2f0y2G','ywXSB2nvBNnHzMu','AxnbCNjHEq','yNL0zuXLBMD0Aa','Cgf5Bg9Hza','y29TCgfJDc5JB21WBgv0zwq','Aw5KzxG','CM9VDa','C3bSAwnL','mJrvDKTsAei','zw50CMLLCW','D3jPDgvgAwXL','u2vZC2LVBIbYzxn1BwuGAw5KzxGGAxmGAw52ywXPzc4','C2L6zq','CgLK','y29UDgv4DfjLy29Yzhm','yxv0B21HDgLJ','CMvHzfbHz2u','C2XPy2u','BgvUz3rO','ywnXDwLYzvnLC3nPB25mzwfZzq','D3jPDgu','zgvSzxrL','yM91BMrHCNLuDxjUswq','Dg9ju09tDhjPBMC','DgvZDa','CMvHzenVBNrLEhq','zxHLy3v0Aw9Uswq','DhvYBI51C2vY','CMv2AxnPB24','tufsx0fhru5ux0rju1bpu0ve','zMLUzeLUzgv4','Bg9JAW','lMPZB25S','C3vTBwfYEq','BgfZDefJDgL2Axr5qxq','Dg9KBY51CgrHDgvK','C2vXDwvUy2u','CMvZDw1L','Aw5KzxHeAxj0Eq','DxbKyxrLvgL0Bgu','BwfW','u2vZC2LVBIb0AxrSzsbPCYbYzxf1AxjLzc4','zxzLBNrZlq','y3jLyxrLu2vZC2LVBG','mJaXntKZn2j6EvnWuW','Dg9KB1jLDMLZAw9U','CMfUzg9T','z2v0','yMfZzty0DxjS','y29TCgfJDfnLCxvLBMnL','Dg9tDhjPBMC','mZKWotu2u0Hrv1zK','BNvTyMvY','DgLTzxn0yw1W','ue9tsvrjvKvFsu5gsu5jvfK','zM9YA1nLC3nPB24','CMv2zxjZzq','D29YA3nWywnL','Cg9W','zNjVBq','BMv4DfnLCxvLBMnL','C29YDa','BM93','zw5KC1DPDgG','mZCWBeHuywDP','Dg9KBW','y29Kzq','oti4odqWy3PUEufQ','Bg9JywXLq29TCgfYzq','lM1HCG','nJa0ntC5nxHQtMHmtW','yM9VBgvHBG','u2vZC2LVBIbHBhjLywr5igHHCYbHihDYAxrLCI4','y2XVC2vK','C2vZC2LVBI50AxrSzs51CgrHDgvK','C2v0','C29Tzq','CMvJB3jKCW','AgfZ','C2vNBwvUDhm','mtK5nda4yKXirK9Z','tufsx0fhru5ux1nfu1njt05Fte9ds0ve','y3vYC29Y','z2v0u2vZC2LVBG','C3rHDa','DxrMoa','mtaXmdG0me5UyvfgDW','zMLUzeXHC3rjBMrLEa','y3jLyxrLzef0','C2vZC2LVBNm','A2LSBa','ChvZAa','yxbWzw5K','u2vZC2LVBIbOAxn0B3j5igLZignVCNj1ChqU','yMvMB3jLu2vXDwvUy2u','u2vZC2LVBIbZDg9YzsbPCYbJBg9ZzwqU','tufsx0fhru5ux1nfu1njt05FtK9ux0zpvu5e','zMLUza','y29TCgfJDa','B3bLBG','AxntywzLsw50zwDLCG','C3rYAw5N','u2vZC2LVBIbYzxDPBMqGDgfYz2v0ihDHCYbUB3qGzM91BMqU','q29TCgfJDcbZDw1Tyxj5igLZihjLCxvPCMvKlG','Dg9KB1nLCxvLBMnL','DMfSDwvZ','u2vZC2LVBIbPBMrLEcbPCYbIDxn5lG','C2vZC2LVBI5JCMvHDgvK','tufsx0fhru5ux1jfv0Lorf9uqvjhrvrFsu5wquXjra','BgLTAxq','tufsx0fhru5ux1nfu1njt05Fq09suLvqva','CgfYC2u','C3rYAw5NAwz5','Aw5KzxGUBg9JAW','DhLWzq','ywDLBNq','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','C2vZC2LVBKLK','BgLZDa','zxHLyW','Bwf4','ne1eA3Huqq','BwLU','C3vIyxjYyxK','yNL0zxnszwfK','lNrTCa','DgL0Bgu','DhjPBq','C3LUyW','zMLUzeXHC3q','BgfZDfnLCxvLBMnL','tMv3ihnLC3nPB24','yNL0zxm','y29Uy2f0','u2vZC2LVBIb3yxmGBM90igzVDw5KlG','Dw5ZAgLMDa','CMvMzxjLBMnLCW'];_0xa127=function(){return _0x1331b2;};return _0xa127();}export class JsonlSessionStore{static #instances=new Map();static #opening=new Map();#shared;#leaseClosed=![];constructor(_0x756eec){this.#shared=_0x756eec;}static async[_0x2c4977(0x217)](_0x2b7bd1){const _0x236ea0=_0x2c4977,_0x3f256b=join(_0x2b7bd1,_0x236ea0(0x1f9),_0x236ea0(0x227)),_0x46c396=JsonlSessionStore.#instances[_0x236ea0(0x1e3)](_0x3f256b);if(_0x46c396)return _0x46c396[_0x236ea0(0x23c)]++,new JsonlSessionStore(_0x46c396);const _0x3ec486=JsonlSessionStore.#opening[_0x236ea0(0x1e3)](_0x3f256b);if(_0x3ec486){const _0x247c1b=await _0x3ec486;return _0x247c1b[_0x236ea0(0x23c)]++,new JsonlSessionStore(_0x247c1b);}const _0x5620dc=JsonlSessionStore.#openExclusive(_0x3f256b);JsonlSessionStore.#opening[_0x236ea0(0x1ff)](_0x3f256b,_0x5620dc);try{const _0x1a8b9b=await _0x5620dc;return JsonlSessionStore.#instances[_0x236ea0(0x1ff)](_0x3f256b,_0x1a8b9b),new JsonlSessionStore(_0x1a8b9b);}finally{JsonlSessionStore.#opening[_0x236ea0(0x266)](_0x3f256b);}}static async #openExclusive(_0x438303){const _0x2dafaf=_0x2c4977;await mkdir(join(_0x438303,_0x2dafaf(0x20d)),{'recursive':!![]});let _0x49fbae={'version':0x1,'revision':0x0,'sessions':[]};try{_0x49fbae=JSON[_0x2dafaf(0x223)](await readFile(join(_0x438303,_0x2dafaf(0x20d),_0x2dafaf(0x23f)),_0x2dafaf(0x209)));}catch{}return{'root':_0x438303,'index':_0x49fbae,'pendingSessions':new Map(),'references':0x1,'closed':![],'indexDirty':![],'segments':new Map()};}async #saveIndex(_0x43887d){const _0x273d7b=_0x2c4977,_0x660886=await acquireFileLock(join(this.#shared[_0x273d7b(0x257)],_0x273d7b(0x20d),_0x273d7b(0x225))),_0x450541=join(this.#shared[_0x273d7b(0x257)],_0x273d7b(0x20d),_0x273d7b(0x23f)),_0x411a99=_0x450541+'.'+randomUUID()+_0x273d7b(0x231);try{let _0x11e574={'version':0x1,'revision':0x0,'sessions':[]};try{_0x11e574=JSON[_0x273d7b(0x223)](await readFile(_0x450541,_0x273d7b(0x209)));}catch{}const _0x5bb889=new Map(_0x11e574[_0x273d7b(0x20d)][_0x273d7b(0x1dc)](_0x4f3939=>[_0x4f3939['id'],_0x4f3939]));for(const _0x253111 of this.#shared[_0x273d7b(0x256)][_0x273d7b(0x20d)]){const _0x481fbf=_0x5bb889[_0x273d7b(0x1e3)](_0x253111['id']);if(!_0x481fbf||_0x481fbf[_0x273d7b(0x1d6)]<=_0x253111[_0x273d7b(0x1d6)])_0x5bb889[_0x273d7b(0x1ff)](_0x253111['id'],_0x253111);}if(_0x43887d)_0x5bb889[_0x273d7b(0x266)](_0x43887d);this.#shared[_0x273d7b(0x256)]={'version':0x1,'revision':Math[_0x273d7b(0x22c)](_0x11e574[_0x273d7b(0x1d0)],this.#shared[_0x273d7b(0x256)][_0x273d7b(0x1d0)])+(0x2440+-0xb3*0x1e+-0xf45*0x1),'sessions':[..._0x5bb889[_0x273d7b(0x21d)]()]},await writeFile(_0x411a99,JSON[_0x273d7b(0x224)](this.#shared[_0x273d7b(0x256)]),{'mode':0x180}),await rename(_0x411a99,_0x450541),this.#shared[_0x273d7b(0x1da)]=![];}finally{await rm(_0x411a99,{'force':!![]}),await _0x660886();}}async #refreshIndex(){const _0x4b3b4=_0x2c4977;try{const _0x48abc2=JSON[_0x4b3b4(0x223)](await readFile(join(this.#shared[_0x4b3b4(0x257)],_0x4b3b4(0x20d),_0x4b3b4(0x23f)),_0x4b3b4(0x209)));if(_0x48abc2[_0x4b3b4(0x1d0)]<=this.#shared[_0x4b3b4(0x256)][_0x4b3b4(0x1d0)])return;const _0xfc9122=new Map(this.#shared[_0x4b3b4(0x256)][_0x4b3b4(0x20d)][_0x4b3b4(0x1dc)](_0xde2d21=>[_0xde2d21['id'],_0xde2d21]));for(const _0x2868f0 of _0x48abc2[_0x4b3b4(0x20d)]){const _0x4dc96b=_0xfc9122[_0x4b3b4(0x1e3)](_0x2868f0['id']);if(!_0x4dc96b||_0x4dc96b[_0x4b3b4(0x1d6)]<_0x2868f0[_0x4b3b4(0x1d6)])_0xfc9122[_0x4b3b4(0x1ff)](_0x2868f0['id'],_0x2868f0);}this.#shared[_0x4b3b4(0x256)]={..._0x48abc2,'sessions':[..._0xfc9122[_0x4b3b4(0x21d)]()]};}catch{}}async[_0x2c4977(0x1df)](_0x434bd2){const _0x18f511=_0x2c4977;this.#assertOpen();const _0x4ac105=randomUUID(),_0x3041b1=new Date()[_0x18f511(0x268)](),_0x2aa1ed={'id':_0x4ac105,'title':_0x434bd2[_0x18f511(0x232)]??_0x18f511(0x237),'workspace':_0x434bd2[_0x18f511(0x1ed)],'createdAt':_0x3041b1,'lastActivityAt':_0x3041b1,'nextSequence':0x1,'automaticTitlePending':_0x434bd2[_0x18f511(0x232)]===undefined,'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};return await mkdir(join(this.#shared[_0x18f511(0x257)],_0x18f511(0x20d),_0x4ac105),{'recursive':!![]}),this.#shared[_0x18f511(0x203)][_0x18f511(0x1ff)](_0x4ac105,-0x15*0xf8+0x1d4d+-0x8f4),this.#shared[_0x18f511(0x256)]={'version':0x1,'revision':this.#shared[_0x18f511(0x256)][_0x18f511(0x1d0)]+(-0x14b9+-0xd2*0x2b+0x1c00*0x2),'sessions':[_0x2aa1ed,...this.#shared[_0x18f511(0x256)][_0x18f511(0x20d)]]},await this.#saveIndex(),await this[_0x18f511(0x210)](_0x4ac105,{'type':_0x18f511(0x21f),'payload':{'title':_0x2aa1ed[_0x18f511(0x232)],'workspace':_0x2aa1ed[_0x18f511(0x1ed)],'automaticTitle':_0x434bd2[_0x18f511(0x232)]===undefined}}),_0x2aa1ed;}async[_0x2c4977(0x1eb)](_0x50860d,_0xb572d7){const _0xc6ba1f=_0x2c4977;this.#assertOpen();const _0x280977=await this[_0xc6ba1f(0x264)](_0x50860d);try{const _0xa47ac0=this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x20d)][_0xc6ba1f(0x215)](_0x2462a8=>_0x2462a8['id']===_0x50860d);if(!_0xa47ac0)throw new MarAgentError(_0xc6ba1f(0x214),_0xc6ba1f(0x23a));const _0x6c60f9=await this[_0xc6ba1f(0x24b)](_0x50860d),_0x50bf05=_0xb572d7[_0xc6ba1f(0x267)]===null?-(0x3a9*0x5+0x14d9+-0x2725):_0x6c60f9[_0xc6ba1f(0x20b)](_0x16a1f1=>_0x16a1f1[_0xc6ba1f(0x24e)]===_0xb572d7[_0xc6ba1f(0x267)]);if(_0xb572d7[_0xc6ba1f(0x267)]!==null&&_0x50bf05<0x1a1a+-0x1abf+0xa5)throw new MarAgentError(_0xc6ba1f(0x220),_0xc6ba1f(0x21a));const _0x2ec543=new Date()[_0xc6ba1f(0x268)](),_0x462c16={'id':randomUUID(),'title':_0xb572d7[_0xc6ba1f(0x232)],'workspace':_0xa47ac0[_0xc6ba1f(0x1ed)],'createdAt':_0x2ec543,'lastActivityAt':_0x2ec543,'nextSequence':0x1,'automaticTitlePending':![],'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};await mkdir(join(this.#shared[_0xc6ba1f(0x257)],_0xc6ba1f(0x20d),_0x462c16['id']),{'recursive':!![]}),this.#shared[_0xc6ba1f(0x203)][_0xc6ba1f(0x1ff)](_0x462c16['id'],0x1*0x246+0xb*-0x119+0x9ce),this.#shared[_0xc6ba1f(0x240)][_0xc6ba1f(0x1ff)](_0x462c16['id'],_0x462c16);try{await this[_0xc6ba1f(0x210)](_0x462c16['id'],{'type':_0xc6ba1f(0x21f),'payload':{'title':_0x462c16[_0xc6ba1f(0x232)],'workspace':_0x462c16[_0xc6ba1f(0x1ed)],'automaticTitle':![]}});const _0x2acda0=_0xb572d7[_0xc6ba1f(0x267)]===null?[]:_0x6c60f9[_0xc6ba1f(0x262)](-0x17d0+-0x37*0xa6+0x3b7b,_0x50bf05+(-0xbbf+-0x215b+-0x9*-0x503));for(const _0x579bd0 of _0x2acda0)await this[_0xc6ba1f(0x210)](_0x462c16['id'],{'type':_0x579bd0[_0xc6ba1f(0x226)],'payload':forkedPayload(_0x579bd0[_0xc6ba1f(0x226)],_0x579bd0[_0xc6ba1f(0x254)],_0x50860d,_0x462c16['id'],_0xb572d7[_0xc6ba1f(0x232)]),..._0x579bd0[_0xc6ba1f(0x1ce)]===undefined?{}:{'executionId':_0x579bd0[_0xc6ba1f(0x1ce)]},..._0x579bd0[_0xc6ba1f(0x24e)]===undefined?{}:{'turnId':_0x579bd0[_0xc6ba1f(0x24e)]},'timestamp':_0x579bd0[_0xc6ba1f(0x1e9)]});return _0x462c16[_0xc6ba1f(0x1d6)]=_0x462c16[_0xc6ba1f(0x20c)],this.#shared[_0xc6ba1f(0x240)][_0xc6ba1f(0x266)](_0x462c16['id']),this.#shared[_0xc6ba1f(0x256)]={'version':0x1,'revision':this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x1d0)]+(-0x1c41+0x13c0+-0x21*-0x42),'sessions':[_0x462c16,...this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x20d)]]},this.#shared[_0xc6ba1f(0x1da)]=!![],await this.#saveIndex(),{'id':_0x462c16['id'],'title':_0x462c16[_0xc6ba1f(0x232)],'workspace':_0x462c16[_0xc6ba1f(0x1ed)],'createdAt':_0x462c16[_0xc6ba1f(0x20c)],'lastActivityAt':_0x462c16[_0xc6ba1f(0x20c)]};}catch(_0x3b5a13){this.#shared[_0xc6ba1f(0x240)][_0xc6ba1f(0x266)](_0x462c16['id']);const _0x274c18=this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x20d)][_0xc6ba1f(0x1d2)](_0x2f82ea=>_0x2f82ea['id']===_0x462c16['id']);_0x274c18>=-0x5d*-0x55+-0x2e7+0x1*-0x1bfa&&(this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x20d)][_0xc6ba1f(0x258)](_0x274c18,-0xfff+-0xf4f*0x2+0x1a*0x1cb),this.#shared[_0xc6ba1f(0x256)][_0xc6ba1f(0x1d0)]++,this.#shared[_0xc6ba1f(0x1da)]=!![],await this.#saveIndex(_0x462c16['id'])[_0xc6ba1f(0x250)](()=>undefined));this.#shared[_0xc6ba1f(0x203)][_0xc6ba1f(0x266)](_0x462c16['id']),await rm(join(this.#shared[_0xc6ba1f(0x257)],_0xc6ba1f(0x20d),_0x462c16['id']),{'recursive':!![],'force':!![]})[_0xc6ba1f(0x250)](()=>undefined);throw _0x3b5a13;}}finally{await _0x280977();}}async[_0x2c4977(0x1db)](_0xaff240,_0x5a9fb0,_0x3d773d={}){const _0x396bca=_0x2c4977;this.#assertOpen();const _0x1e63fe=_0x5a9fb0[_0x396bca(0x233)]();if(!_0x1e63fe)throw new MarAgentError(_0x396bca(0x228),_0x396bca(0x1dd));const _0x121ec8=this.#shared[_0x396bca(0x256)][_0x396bca(0x20d)][_0x396bca(0x215)](_0x20e517=>_0x20e517['id']===_0xaff240);if(!_0x121ec8)throw new MarAgentError(_0x396bca(0x214),_0x396bca(0x23a));await this[_0x396bca(0x210)](_0xaff240,{'type':_0x396bca(0x1fe),'payload':{'title':_0x1e63fe,'automatic':!![]},..._0x3d773d[_0x396bca(0x1ce)]?{'executionId':_0x3d773d[_0x396bca(0x1ce)]}:{},..._0x3d773d[_0x396bca(0x24e)]?{'turnId':_0x3d773d[_0x396bca(0x24e)]}:{}}),_0x121ec8[_0x396bca(0x232)]=_0x1e63fe;}async[_0x2c4977(0x207)](_0xd43a37){const _0x596291=_0x2c4977;this.#assertOpen(),await this.#refreshIndex();const _0x570558=this.#shared[_0x596291(0x256)][_0x596291(0x20d)][_0x596291(0x215)](_0x4bad17=>_0x4bad17['id']===_0xd43a37);if(!_0x570558)throw new MarAgentError(_0x596291(0x214),_0x596291(0x23a));return{'id':_0x570558['id'],'title':_0x570558[_0x596291(0x232)],'workspace':_0x570558[_0x596291(0x1ed)],'createdAt':_0x570558[_0x596291(0x20c)],'lastActivityAt':_0x570558[_0x596291(0x1d6)]};}async[_0x2c4977(0x210)](_0x108da6,_0x46b289){const _0x532876=_0x2c4977;this.#assertOpen();const _0x39e6bc=this.#shared[_0x532876(0x256)][_0x532876(0x20d)][_0x532876(0x215)](_0x393960=>_0x393960['id']===_0x108da6)??this.#shared[_0x532876(0x240)][_0x532876(0x1e3)](_0x108da6);if(!_0x39e6bc)throw new MarAgentError(_0x532876(0x214),_0x532876(0x23a));const _0x470498=!this.#shared[_0x532876(0x240)][_0x532876(0x202)](_0x108da6),_0x2c9eb9={'schemaVersion':0x1,'recordId':randomUUID(),'sequence':_0x39e6bc[_0x532876(0x1f0)]++,'timestamp':_0x46b289[_0x532876(0x1e9)]??new Date()[_0x532876(0x268)](),'sessionId':_0x108da6,..._0x46b289[_0x532876(0x1ce)]?{'executionId':_0x46b289[_0x532876(0x1ce)]}:{},..._0x46b289[_0x532876(0x24e)]?{'turnId':_0x46b289[_0x532876(0x24e)]}:{},'type':_0x46b289[_0x532876(0x226)],'payload':_0x46b289[_0x532876(0x254)]},_0x530327=JSON[_0x532876(0x224)](_0x2c9eb9)+'\x0a';let _0x84b206=await this.#currentSegment(_0x108da6),_0x2dd5e8=this.#segmentPath(_0x108da6,_0x84b206);try{const _0x3327a3=await stat(_0x2dd5e8);_0x3327a3[_0x532876(0x25d)]>-0x1c03+-0x51d+0x2120&&_0x3327a3[_0x532876(0x25d)]+Buffer[_0x532876(0x253)](_0x530327)>MAX_SEGMENT_BYTES&&(_0x84b206+=-0x9df+-0xa4*0x2a+0x24c8,this.#shared[_0x532876(0x203)][_0x532876(0x1ff)](_0x108da6,_0x84b206),_0x2dd5e8=this.#segmentPath(_0x108da6,_0x84b206));}catch{}const _0x421aec=await open(_0x2dd5e8,'a',-0x427*0x1+-0x43f*-0x9+-0x2090);try{await _0x421aec[_0x532876(0x265)](_0x530327),await _0x421aec[_0x532876(0x234)]();}finally{await _0x421aec[_0x532876(0x242)]();}const _0x48026b=_0x39e6bc[_0x532876(0x203)]??(_0x39e6bc[_0x532876(0x203)]=[]),_0x380548=_0x48026b[_0x532876(0x215)](_0x470372=>_0x470372[_0x532876(0x1e8)]===_0x84b206);if(_0x380548)_0x380548[_0x532876(0x236)]=_0x2c9eb9[_0x532876(0x1d8)],_0x380548[_0x532876(0x238)]+=Buffer[_0x532876(0x253)](_0x530327);else _0x48026b[_0x532876(0x20f)]({'number':_0x84b206,'firstSequence':_0x2c9eb9[_0x532876(0x1d8)],'lastSequence':_0x2c9eb9[_0x532876(0x1d8)],'bytes':Buffer[_0x532876(0x253)](_0x530327)});return _0x39e6bc[_0x532876(0x1d6)]=_0x2c9eb9[_0x532876(0x1e9)],this.#applyRecordToResumeIndex(_0x39e6bc,_0x2c9eb9),_0x470498&&(this.#shared[_0x532876(0x256)][_0x532876(0x1d0)]++,this.#shared[_0x532876(0x1da)]=!![]),_0x2c9eb9;}async[_0x2c4977(0x24b)](_0x380784){const _0x4c45bf=_0x2c4977;this.#assertOpen();try{const _0x23c1bb=[];for(const _0x4a68b5 of await this.#segmentPaths(_0x380784))_0x23c1bb[_0x4c45bf(0x20f)](...await readRecords(_0x4a68b5));return _0x23c1bb;}catch(_0x34cc65){if(_0x34cc65 instanceof MarAgentError)throw _0x34cc65;throw new MarAgentError(_0x4c45bf(0x214),_0x4c45bf(0x23a),{'cause':_0x34cc65});}}async[_0x2c4977(0x248)](_0x550826){const _0x40335e=_0x2c4977;this.#assertOpen();const _0x59ba7d=this.#shared[_0x40335e(0x256)][_0x40335e(0x20d)][_0x40335e(0x215)](_0x27853a=>_0x27853a['id']===_0x550826);if(!_0x59ba7d)throw new MarAgentError(_0x40335e(0x214),_0x40335e(0x23a));if(_0x59ba7d[_0x40335e(0x1d9)]?.[_0x40335e(0x246)]!==-0xe83+-0x9*0x44f+0x354b||typeof _0x59ba7d[_0x40335e(0x243)]!==_0x40335e(0x1fb)||_0x59ba7d[_0x40335e(0x1d9)][_0x40335e(0x1e5)]===undefined)return this.#rebuildExecutionState(_0x59ba7d);try{const _0x409f41=await this.#readFromSequence(_0x59ba7d,_0x59ba7d[_0x40335e(0x1d9)][_0x40335e(0x1e5)]);if(_0x409f41[0x7ef+-0x564*-0x4+-0x1d7f]?.[_0x40335e(0x1d8)]!==_0x59ba7d[_0x40335e(0x1d9)][_0x40335e(0x1e5)]||!isCompactCheckpoint(_0x409f41[-0x1*-0x1a11+0x1*-0x1807+-0x20a])||_0x409f41[_0x40335e(0x200)]((_0x14c191,_0x3423be)=>_0x3423be>0x1*0x20ad+0x482*-0x7+-0x11f&&isCompactCheckpoint(_0x14c191)))return this.#rebuildExecutionState(_0x59ba7d);const _0x5b0a6f=await this.#readIndexedTodo(_0x59ba7d,_0x409f41);if(!_0x5b0a6f)return this.#rebuildExecutionState(_0x59ba7d);return{'automaticTitlePending':_0x59ba7d[_0x40335e(0x243)],'todo':_0x5b0a6f,'contextRecords':_0x409f41};}catch{return this.#rebuildExecutionState(_0x59ba7d);}}async[_0x2c4977(0x1cd)](_0x3c6484){const _0x4429a3=_0x2c4977;return(await this[_0x4429a3(0x248)](_0x3c6484))[_0x4429a3(0x25f)];}async[_0x2c4977(0x261)](_0xa77bfb,_0x3a8b43={}){const _0x3f41ae=_0x2c4977,_0x4c7bbd=this.#shared[_0x3f41ae(0x256)][_0x3f41ae(0x20d)][_0x3f41ae(0x215)](_0x559b8f=>_0x559b8f['id']===_0xa77bfb);if(!_0x4c7bbd)throw new MarAgentError(_0x3f41ae(0x214),_0x3f41ae(0x23a));const _0x4600c7=_0x3a8b43[_0x3f41ae(0x212)]??Number[_0x3f41ae(0x1ea)],_0x4c88c1=Math[_0x3f41ae(0x22e)](-0xac*-0x4+0x62c+-0x4f4,Math[_0x3f41ae(0x22c)](0x1789+-0x1*-0x21e7+-0x396f,_0x3a8b43[_0x3f41ae(0x221)]??-0xca9+0x729+0x5e4)),_0x4d59dc=[];let _0x51c4aa=![];const _0x3b1cb6=(await this.#segmentPaths(_0xa77bfb))[_0x3f41ae(0x1ec)]();for(const [_0x21e4d6,_0xda37b3]of _0x3b1cb6[_0x3f41ae(0x25a)]()){const _0x3c0c74=segmentNumberFromPath(_0xda37b3),_0x22e8f3=_0x4c7bbd[_0x3f41ae(0x203)]?.[_0x3f41ae(0x215)](_0x35d7fa=>_0x35d7fa[_0x3f41ae(0x1e8)]===_0x3c0c74);if(_0x22e8f3!==undefined&&_0x22e8f3[_0x3f41ae(0x23d)]>=_0x4600c7)continue;const _0x317659=_0x4c88c1-_0x4d59dc[_0x3f41ae(0x263)],_0x4cda99=await readRecordPageFromTail(_0xda37b3,_0x4600c7,_0x317659);_0x4d59dc[_0x3f41ae(0x23b)](..._0x4cda99[_0x3f41ae(0x201)]);if(_0x4cda99[_0x3f41ae(0x24d)]){_0x51c4aa=!![];break;}if(_0x4d59dc[_0x3f41ae(0x263)]>=_0x4c88c1){_0x51c4aa=_0x21e4d6<_0x3b1cb6[_0x3f41ae(0x263)]-(0xc76+-0xab+-0x5e5*0x2);break;}}const _0x47c0c5=_0x51c4aa?_0x4d59dc[0xe7d+-0x1*-0xef+-0xf6c]?.[_0x3f41ae(0x1d8)]:undefined;return{'records':_0x4d59dc,..._0x47c0c5?{'previousBeforeSequence':_0x47c0c5}:{}};}async[_0x2c4977(0x216)](_0x4d00ed,_0x5de94c){const _0x1324f8=_0x2c4977;if(!_0x5de94c[_0x1324f8(0x1d5)][_0x1324f8(0x233)]())throw new MarAgentError(_0x1324f8(0x228),_0x1324f8(0x21b));const _0x2c3389=this.#shared[_0x1324f8(0x256)][_0x1324f8(0x20d)][_0x1324f8(0x215)](_0x62441=>_0x62441['id']===_0x4d00ed);if(!_0x2c3389)throw new MarAgentError(_0x1324f8(0x214),_0x1324f8(0x23a));return this[_0x1324f8(0x210)](_0x4d00ed,{'type':_0x1324f8(0x255),'payload':{'summary':_0x5de94c[_0x1324f8(0x1d5)],'boundarySequence':_0x2c3389[_0x1324f8(0x1f0)]-(0xc*-0x232+0x907+0x1152),'automatic':_0x5de94c[_0x1324f8(0x260)]===!![]},..._0x5de94c[_0x1324f8(0x1ce)]?{'executionId':_0x5de94c[_0x1324f8(0x1ce)]}:{},..._0x5de94c[_0x1324f8(0x24e)]?{'turnId':_0x5de94c[_0x1324f8(0x24e)]}:{}});}async[_0x2c4977(0x264)](_0x4a6319){const _0x141194=_0x2c4977;this.#assertOpen(),await this.#refreshIndex();if(!this.#shared[_0x141194(0x256)][_0x141194(0x20d)][_0x141194(0x200)](_0x1ed848=>_0x1ed848['id']===_0x4a6319))throw new MarAgentError(_0x141194(0x214),_0x141194(0x23a));const _0x4a2a59=join(this.#shared[_0x141194(0x257)],_0x141194(0x20d),_0x4a6319,_0x141194(0x1d3)),_0x1296d1=await acquireFileLock(_0x4a2a59,_0x141194(0x1fc),-0x1c61+0x1eb6+0x1*-0x255);try{await this.#reconcileTail(_0x4a6319);}catch(_0x2b02f0){await _0x1296d1();throw _0x2b02f0;}return async()=>{const _0x348091=_0x141194;try{if(this.#shared[_0x348091(0x1da)])await this.#saveIndex();}finally{await _0x1296d1();}};}async[_0x2c4977(0x22a)](_0x595a53={}){const _0x434819=_0x2c4977;this.#assertOpen(),await this.#refreshIndex();const _0xcfcbe0=_0x595a53[_0x434819(0x206)]?Number(Buffer[_0x434819(0x1ef)](_0x595a53[_0x434819(0x206)],_0x434819(0x1e4))[_0x434819(0x1e6)](_0x434819(0x209))):0x120b+0x2*0x1d1+-0x1*0x15ad,_0x4ef837=Math[_0x434819(0x22e)](-0x1b4e+-0x1429+-0x17*-0x219,Math[_0x434819(0x22c)](-0x1a34+-0x4cd+0x1f02,_0x595a53[_0x434819(0x221)]??0x1dd8+0xce*-0xd+-0x1330)),_0x4af5e1=[...this.#shared[_0x434819(0x256)][_0x434819(0x20d)]][_0x434819(0x1f1)]((_0x42b562,_0x3795f2)=>_0x3795f2[_0x434819(0x1d6)][_0x434819(0x1f8)](_0x42b562[_0x434819(0x1d6)])),_0x1a1946=_0x4af5e1[_0x434819(0x262)](_0xcfcbe0,_0xcfcbe0+_0x4ef837)[_0x434819(0x1dc)](_0x6131e6=>({'id':_0x6131e6['id'],'title':_0x6131e6[_0x434819(0x232)],'workspace':_0x6131e6[_0x434819(0x1ed)],'createdAt':_0x6131e6[_0x434819(0x20c)],'lastActivityAt':_0x6131e6[_0x434819(0x1d6)]})),_0x256463=_0xcfcbe0+_0x4ef837<_0x4af5e1[_0x434819(0x263)]?Buffer[_0x434819(0x1ef)](String(_0xcfcbe0+_0x4ef837))[_0x434819(0x1e6)](_0x434819(0x1e4)):undefined;return{'sessions':_0x1a1946,..._0x256463?{'nextCursor':_0x256463}:{}};}#applyRecordToResumeIndex(_0x1c7a45,_0x5393b9){const _0x4828b1=_0x2c4977;if(_0x5393b9[_0x4828b1(0x226)]===_0x4828b1(0x1cf))_0x1c7a45[_0x4828b1(0x243)]=![];const _0x18034a=_0x1c7a45[_0x4828b1(0x1d9)];if(_0x18034a?.[_0x4828b1(0x246)]!==-0x372+0x2*-0x9d+0x4ad||!Number[_0x4828b1(0x218)](_0x18034a[_0x4828b1(0x1e1)]))return;if(isCompactCheckpoint(_0x5393b9))_0x18034a[_0x4828b1(0x1e5)]=_0x5393b9[_0x4828b1(0x1d8)];if(_0x5393b9[_0x4828b1(0x226)]!==_0x4828b1(0x1d7)||!todoItemsFromSnapshot(_0x5393b9[_0x4828b1(0x254)]))return;_0x18034a[_0x4828b1(0x21c)]=_0x5393b9[_0x4828b1(0x1d8)],_0x18034a[_0x4828b1(0x1e1)]++;}async #readIndexedTodo(_0x3fc453,_0x407454){const _0x106288=_0x2c4977,_0x53ab28=_0x3fc453[_0x106288(0x1d9)];if(_0x53ab28?.[_0x106288(0x246)]!==-0x732+-0x233b+0x2a6e||!Number[_0x106288(0x218)](_0x53ab28[_0x106288(0x1e1)])||_0x53ab28[_0x106288(0x1e1)]<0x2*0xcac+0x11c+-0x1a74)return undefined;const _0xb069d6=_0x407454[_0x106288(0x235)](_0x16e81d=>_0x16e81d[_0x106288(0x226)]===_0x106288(0x1d7)&&todoItemsFromSnapshot(_0x16e81d[_0x106288(0x254)])!==undefined);if(_0xb069d6&&(_0x53ab28[_0x106288(0x21c)]===undefined||_0xb069d6[_0x106288(0x1d8)]!==_0x53ab28[_0x106288(0x21c)]))return undefined;if(_0x53ab28[_0x106288(0x21c)]===undefined)return _0x53ab28[_0x106288(0x1e1)]===0x2*0xf53+0x18f6+-0x379c?{'revision':0x0,'items':[]}:undefined;if(_0x53ab28[_0x106288(0x1e1)]===-0x65b*0x3+-0x2044+0x1*0x3355)return undefined;const _0x284e45=_0x407454[_0x106288(0x215)](_0x5436e7=>_0x5436e7[_0x106288(0x1d8)]===_0x53ab28[_0x106288(0x21c)])??await this.#readRecordAtSequence(_0x3fc453,_0x53ab28[_0x106288(0x21c)]);if(_0x284e45?.[_0x106288(0x226)]!==_0x106288(0x1d7))return undefined;const _0x327af6=todoItemsFromSnapshot(_0x284e45[_0x106288(0x254)]);return _0x327af6?{'revision':_0x53ab28[_0x106288(0x1e1)],'items':_0x327af6}:undefined;}async #readRecordAtSequence(_0x179d98,_0x438188){const _0x28599c=_0x2c4977,_0x49a7c8=_0x179d98[_0x28599c(0x203)]?.[_0x28599c(0x215)](_0x4865ea=>_0x4865ea[_0x28599c(0x23d)]<=_0x438188&&_0x4865ea[_0x28599c(0x236)]>=_0x438188);if(!_0x49a7c8)return undefined;return(await readRecords(this.#segmentPath(_0x179d98['id'],_0x49a7c8[_0x28599c(0x1e8)])))[_0x28599c(0x215)](_0xf44f9a=>_0xf44f9a[_0x28599c(0x1d8)]===_0x438188);}async #readFromSequence(_0x2a8a17,_0x34ae31){const _0x33cb03=_0x2c4977,_0x16d777=(_0x2a8a17[_0x33cb03(0x203)]??[])[_0x33cb03(0x24c)](_0x5ad31f=>_0x5ad31f[_0x33cb03(0x236)]>=_0x34ae31)[_0x33cb03(0x1f1)]((_0x40dc4d,_0x506733)=>_0x40dc4d[_0x33cb03(0x1e8)]-_0x506733[_0x33cb03(0x1e8)]);if(_0x16d777[_0x33cb03(0x263)]===-0x1b04+0x1bb7+0xb3*-0x1)throw new MarAgentError(_0x33cb03(0x222),_0x33cb03(0x25c));const _0x37ac58=[];for(const _0xc88aa1 of _0x16d777)_0x37ac58[_0x33cb03(0x20f)](...(await readRecords(this.#segmentPath(_0x2a8a17['id'],_0xc88aa1[_0x33cb03(0x1e8)])))[_0x33cb03(0x24c)](_0x5cc2ab=>_0x5cc2ab[_0x33cb03(0x1d8)]>=_0x34ae31));return _0x37ac58;}async #rebuildExecutionState(_0x61013e){const _0xa056bc=_0x2c4977,_0x5d588f=deriveExecutionState(await this[_0xa056bc(0x24b)](_0x61013e['id']));return(_0x61013e[_0xa056bc(0x243)]!==_0x5d588f[_0xa056bc(0x243)]||!sameResumeIndex(_0x61013e[_0xa056bc(0x1d9)],_0x5d588f[_0xa056bc(0x1d9)]))&&(_0x61013e[_0xa056bc(0x243)]=_0x5d588f[_0xa056bc(0x243)],_0x61013e[_0xa056bc(0x1d9)]=_0x5d588f[_0xa056bc(0x1d9)],this.#shared[_0xa056bc(0x256)][_0xa056bc(0x1d0)]++,this.#shared[_0xa056bc(0x1da)]=!![]),{'automaticTitlePending':_0x5d588f[_0xa056bc(0x243)],'todo':_0x5d588f[_0xa056bc(0x1f5)],'contextRecords':_0x5d588f[_0xa056bc(0x25f)]};}async[_0x2c4977(0x266)](_0x3b6e94){const _0x5eb3fb=_0x2c4977;this.#assertOpen();const _0x4a8ce7=this.#shared[_0x5eb3fb(0x256)][_0x5eb3fb(0x20d)][_0x5eb3fb(0x1d2)](_0x40d295=>_0x40d295['id']===_0x3b6e94);if(_0x4a8ce7<-0x25cb+-0x2*0x322+0x2c0f)throw new MarAgentError(_0x5eb3fb(0x214),_0x5eb3fb(0x23a));await rm(join(this.#shared[_0x5eb3fb(0x257)],_0x5eb3fb(0x20d),_0x3b6e94),{'recursive':!![]}),this.#shared[_0x5eb3fb(0x203)][_0x5eb3fb(0x266)](_0x3b6e94),this.#shared[_0x5eb3fb(0x256)][_0x5eb3fb(0x20d)][_0x5eb3fb(0x258)](_0x4a8ce7,-0x1057+0x16dd+-0x685),this.#shared[_0x5eb3fb(0x256)][_0x5eb3fb(0x1d0)]++,await this.#saveIndex(_0x3b6e94);}#assertOpen(){const _0x21f2b7=_0x2c4977;if(this.#leaseClosed||this.#shared[_0x21f2b7(0x1fd)])throw new MarAgentError(_0x21f2b7(0x1d1),_0x21f2b7(0x213));}#segmentPath(_0x33d41a,_0x33aa95){const _0x197a36=_0x2c4977;return join(this.#shared[_0x197a36(0x257)],_0x197a36(0x20d),_0x33d41a,_0x197a36(0x1de)+String(_0x33aa95)[_0x197a36(0x245)](-0x1412*-0x1+-0x24b*0x1+-0x11c1,'0')+_0x197a36(0x1d4));}async #segmentPaths(_0x23bc28){const _0x5599c0=_0x2c4977,_0x476ed5=join(this.#shared[_0x5599c0(0x257)],_0x5599c0(0x20d),_0x23bc28),_0x387765=(await readdir(_0x476ed5))[_0x5599c0(0x24c)](_0x546334=>/^events-\d{6}\.jsonl$/[_0x5599c0(0x1cc)](_0x546334))[_0x5599c0(0x1f1)]();if(_0x387765[_0x5599c0(0x263)]===-0x1b61+-0x1b*-0x9f+-0x2*-0x54e)throw new MarAgentError(_0x5599c0(0x214),_0x5599c0(0x23a));return _0x387765[_0x5599c0(0x1dc)](_0x1ba7ee=>join(_0x476ed5,_0x1ba7ee));}async #currentSegment(_0x5e988e){const _0x4ea24e=_0x2c4977,_0x361f5a=this.#shared[_0x4ea24e(0x203)][_0x4ea24e(0x1e3)](_0x5e988e);if(_0x361f5a!==undefined)return _0x361f5a;const _0x1bdbec=this.#shared[_0x4ea24e(0x256)][_0x4ea24e(0x20d)][_0x4ea24e(0x215)](_0x4280a8=>_0x4280a8['id']===_0x5e988e),_0x501188=_0x1bdbec?.[_0x4ea24e(0x203)]?.['at'](-(-0x1aff*0x1+0x1*0xc87+-0x5*-0x2e5))?.[_0x4ea24e(0x1e8)];if(_0x501188!==undefined)return this.#shared[_0x4ea24e(0x203)][_0x4ea24e(0x1ff)](_0x5e988e,_0x501188),_0x501188;const _0x58366b=await this.#segmentPaths(_0x5e988e),_0x361626=/events-(\d{6})\.jsonl$/[_0x4ea24e(0x22b)](_0x58366b['at'](-(0x2061+-0x1*0x1dcc+-0x42*0xa))),_0x168900=Number(_0x361626?.[-0x13e1+-0x59*0x13+0x1a7d*0x1]??0x1bf2+0x1710+-0x3301);return this.#shared[_0x4ea24e(0x203)][_0x4ea24e(0x1ff)](_0x5e988e,_0x168900),_0x168900;}async #reconcileTail(_0x56de4e){const _0x23e317=_0x2c4977,_0x549da8=this.#shared[_0x23e317(0x256)][_0x23e317(0x20d)][_0x23e317(0x215)](_0x5440a0=>_0x5440a0['id']===_0x56de4e),_0x55fd2f=await this.#segmentPaths(_0x56de4e),_0x1ee40a=_0x55fd2f['at'](-(-0x1*0x1046+-0x5ab*0x1+0x15f2)),_0x464301=await readRecords(_0x1ee40a),_0x3299e4=_0x464301['at'](-(0xef*-0x12+-0x1e3e+0x2f0d)),_0x95fe11=/events-(\d{6})\.jsonl$/[_0x23e317(0x22b)](_0x1ee40a),_0x509a28=Number(_0x95fe11?.[-0x24f6+0x2310+0x1*0x1e7]??-0x2*0x35f+-0x192b+0x5f*0x56);this.#shared[_0x23e317(0x203)][_0x23e317(0x1ff)](_0x56de4e,_0x509a28);if(_0x3299e4===undefined)return;const _0x550344=(await stat(_0x1ee40a))[_0x23e317(0x25d)],_0x379b43=_0x464301[-0xa94+-0x442+0xed6][_0x23e317(0x1d8)],_0x42c32e=_0x549da8[_0x23e317(0x203)]?.[_0x23e317(0x215)](_0x4a5af1=>_0x4a5af1[_0x23e317(0x1e8)]===_0x509a28),_0x200e93=_0x464301[_0x23e317(0x235)](_0x11230b=>_0x11230b[_0x23e317(0x226)]===_0x23e317(0x1fe)&&typeof _0x11230b[_0x23e317(0x254)][_0x23e317(0x232)]===_0x23e317(0x219)),_0x5d3a38=_0x200e93?.[_0x23e317(0x254)]?.[_0x23e317(0x232)],_0x4da534=_0x549da8[_0x23e317(0x1f0)]<=_0x3299e4[_0x23e317(0x1d8)]||_0x42c32e?.[_0x23e317(0x238)]!==_0x550344||_0x5d3a38!==undefined&&_0x549da8[_0x23e317(0x232)]!==_0x5d3a38;_0x549da8[_0x23e317(0x1f0)]=Math[_0x23e317(0x22c)](_0x549da8[_0x23e317(0x1f0)],_0x3299e4[_0x23e317(0x1d8)]+(0x1cac+0xa*0x1bd+-0x2e0d));if(_0x5d3a38!==undefined)_0x549da8[_0x23e317(0x232)]=_0x5d3a38;_0x549da8[_0x23e317(0x1d6)]=_0x549da8[_0x23e317(0x1d6)]<_0x3299e4[_0x23e317(0x1e9)]?_0x3299e4[_0x23e317(0x1e9)]:_0x549da8[_0x23e317(0x1d6)];if(!_0x549da8[_0x23e317(0x203)])_0x549da8[_0x23e317(0x203)]=[];if(_0x42c32e)_0x42c32e[_0x23e317(0x23d)]=_0x379b43,_0x42c32e[_0x23e317(0x236)]=_0x3299e4[_0x23e317(0x1d8)],_0x42c32e[_0x23e317(0x238)]=_0x550344;else _0x549da8[_0x23e317(0x203)][_0x23e317(0x20f)]({'number':_0x509a28,'firstSequence':_0x379b43,'lastSequence':_0x3299e4[_0x23e317(0x1d8)],'bytes':_0x550344});_0x4da534&&(delete _0x549da8[_0x23e317(0x243)],delete _0x549da8[_0x23e317(0x1d9)],this.#shared[_0x23e317(0x256)][_0x23e317(0x1d0)]++,this.#shared[_0x23e317(0x1da)]=!![]);}async[_0x2c4977(0x242)](){const _0x4fda37=_0x2c4977;if(this.#leaseClosed)return;this.#leaseClosed=!![],this.#shared[_0x4fda37(0x23c)]--;if(this.#shared[_0x4fda37(0x23c)]>-0x5*0x37a+0x68d+0xad5)return;if(this.#shared[_0x4fda37(0x1da)])await this.#saveIndex();this.#shared[_0x4fda37(0x1fd)]=!![],JsonlSessionStore.#instances[_0x4fda37(0x266)](this.#shared[_0x4fda37(0x257)]);}}function forkedPayload(_0x6801ac,_0x44774f,_0x2c499f,_0x4f768c,_0x50c0ce){const _0x31f168=_0x2c4977;if(_0x44774f===null||typeof _0x44774f!==_0x31f168(0x24a)||Array[_0x31f168(0x252)](_0x44774f))return _0x44774f;const _0x348e2a={..._0x44774f};if(_0x348e2a[_0x31f168(0x229)]===_0x2c499f)_0x348e2a[_0x31f168(0x229)]=_0x4f768c;return _0x6801ac===_0x31f168(0x1fe)&&(_0x348e2a[_0x31f168(0x232)]=_0x50c0ce,_0x348e2a[_0x31f168(0x260)]=![]),_0x348e2a;}function deriveExecutionState(_0x4c4f7a){const _0x52e5a5=_0x2c4977;let _0x52c222=![],_0x5c7b54=![],_0x2441be,_0x1687c2,_0x9f7359=-0xb88+0x4*-0x2f7+0x1764,_0x4c7c33=[];for(const _0x171256 of _0x4c4f7a){if(_0x171256[_0x52e5a5(0x226)]===_0x52e5a5(0x21f))_0x52c222=_0x171256[_0x52e5a5(0x254)]?.[_0x52e5a5(0x244)]===!![];else{if(_0x171256[_0x52e5a5(0x226)]===_0x52e5a5(0x1cf))_0x5c7b54=!![];else{if(isCompactCheckpoint(_0x171256))_0x2441be=_0x171256[_0x52e5a5(0x1d8)];else{if(_0x171256[_0x52e5a5(0x226)]===_0x52e5a5(0x1d7)){const _0x4164b9=todoItemsFromSnapshot(_0x171256[_0x52e5a5(0x254)]);if(!_0x4164b9)continue;_0x1687c2=_0x171256[_0x52e5a5(0x1d8)],_0x9f7359++,_0x4c7c33=_0x4164b9;}}}}}const _0x17f975=_0x4c4f7a[_0x52e5a5(0x20b)](isCompactCheckpoint);return{'automaticTitlePending':_0x52c222&&!_0x5c7b54,'todo':{'revision':_0x9f7359,'items':_0x4c7c33},'contextRecords':_0x17f975<0xf9c+-0x1bb*0x3+-0x1*0xa6b?[..._0x4c4f7a]:_0x4c4f7a[_0x52e5a5(0x262)](_0x17f975),'resume':{'version':0x1,..._0x2441be===undefined?{}:{'compactSequence':_0x2441be},..._0x1687c2===undefined?{}:{'todoSequence':_0x1687c2},'todoRevision':_0x9f7359}};}export function compactSummaryFromCheckpoint(_0xad6ab2){const _0x404865=_0x2c4977;if(_0xad6ab2?.[_0x404865(0x226)]!==_0x404865(0x255))return undefined;const _0x30793b=_0xad6ab2[_0x404865(0x254)];if(_0x30793b===null||typeof _0x30793b!==_0x404865(0x24a)||Array[_0x404865(0x252)](_0x30793b))return undefined;const _0x5b3c15=_0x30793b[_0x404865(0x1d5)];return typeof _0x5b3c15===_0x404865(0x219)&&_0x5b3c15[_0x404865(0x233)]()[_0x404865(0x263)]>0x613*0x1+0x1*-0x303+-0x310?_0x5b3c15:undefined;}function isCompactCheckpoint(_0x115605){return compactSummaryFromCheckpoint(_0x115605)!==undefined;}function sameResumeIndex(_0x346e84,_0x1502c7){const _0x149eec=_0x2c4977;return _0x346e84?.[_0x149eec(0x246)]===_0x1502c7[_0x149eec(0x246)]&&_0x346e84[_0x149eec(0x1e5)]===_0x1502c7[_0x149eec(0x1e5)]&&_0x346e84[_0x149eec(0x21c)]===_0x1502c7[_0x149eec(0x21c)]&&_0x346e84[_0x149eec(0x1e1)]===_0x1502c7[_0x149eec(0x1e1)];}async function readRecords(_0x5a2f99){const _0x47619d=_0x2c4977,_0x32b858=await readFile(_0x5a2f99,_0x47619d(0x209)),_0x57073f=_0x32b858[_0x47619d(0x24f)]('\x0a');if(_0x57073f['at'](-(0x17a9*-0x1+0xa44+0x46*0x31))==='')_0x57073f[_0x47619d(0x1ee)]();const _0x3460b0=[];for(const [_0x2929c3,_0x304119]of _0x57073f[_0x47619d(0x25a)]()){if(!_0x304119)continue;try{_0x3460b0[_0x47619d(0x20f)](JSON[_0x47619d(0x223)](_0x304119));}catch(_0xc333dd){if(_0x2929c3===_0x57073f[_0x47619d(0x263)]-(0x3b9*-0x8+0x111b*-0x1+-0x2ee4*-0x1)&&!_0x32b858[_0x47619d(0x1f3)]('\x0a'))break;throw new MarAgentError(_0x47619d(0x222),_0x47619d(0x211),{'cause':_0xc333dd});}}return _0x3460b0;}async function readRecordPageFromTail(_0x270cc4,_0x7363e,_0x36e71f){const _0x4330ea=_0x2c4977,_0x33ee35=await open(_0x270cc4,'r');try{const _0x3ab377=(await _0x33ee35[_0x4330ea(0x208)]())[_0x4330ea(0x25d)];let _0x3225d6=_0x3ab377,_0x40fe09=[],_0x556dc1=![],_0x29fdc3=![],_0x3468dc=![];const _0x4ecbe6=[],_0x12fad2=(_0x5cc79e,_0x381c30)=>{const _0x5936b6=_0x4330ea;if(_0x5cc79e[_0x5936b6(0x263)]===0x22cf+-0x1f7d*0x1+-0x352)return;let _0x376804;try{_0x376804=JSON[_0x5936b6(0x223)](_0x5cc79e[_0x5936b6(0x1e6)](_0x5936b6(0x209)));}catch(_0x1eaf19){if(_0x381c30)return;throw new MarAgentError(_0x5936b6(0x222),_0x5936b6(0x211),{'cause':_0x1eaf19});}if(_0x376804[_0x5936b6(0x1d8)]<_0x7363e)_0x4ecbe6[_0x5936b6(0x20f)](_0x376804);};while(_0x3225d6>0x1174+0x1794+-0x2908&&_0x4ecbe6[_0x4330ea(0x263)]<=_0x36e71f){const _0x189ee0=Math[_0x4330ea(0x22c)](0x19fd*0x1+0x35*0x35+-0xf9*0x26,_0x3225d6-REVERSE_READ_CHUNK_BYTES),_0x1c7fe0=Buffer[_0x4330ea(0x251)](_0x3225d6-_0x189ee0);let _0x42cdbd=0x47*0x11+-0x25e5+0x212e;while(_0x42cdbd<_0x1c7fe0[_0x4330ea(0x263)]){const _0x5574a0=await _0x33ee35[_0x4330ea(0x24b)](_0x1c7fe0,_0x42cdbd,_0x1c7fe0[_0x4330ea(0x263)]-_0x42cdbd,_0x189ee0+_0x42cdbd);if(_0x5574a0[_0x4330ea(0x230)]===0x1*0x26ca+0x16c2*-0x1+-0x1008)break;_0x42cdbd+=_0x5574a0[_0x4330ea(0x230)];}const _0x249eb8=_0x1c7fe0[_0x4330ea(0x22f)](0x23df+0x4a*-0x83+-0x7*-0x49,_0x42cdbd);!_0x29fdc3&&(_0x29fdc3=!![],_0x556dc1=_0x249eb8['at'](-(0x754+0xfa7+-0x16fa))!==0x2633+0xf20+-0x1*0x3549);let _0xf1f232=_0x249eb8[_0x4330ea(0x263)];for(let _0x25cb19=_0x249eb8[_0x4330ea(0x263)]-(0xaf2*-0x3+-0xd28+0x19*0x1d7);_0x25cb19>=-0x1c*-0x87+0xdf3+-0x1cb7;_0x25cb19--){if(_0x249eb8[_0x25cb19]!==-0x21c5+-0x1ffb*-0x1+0x1d4)continue;const _0x44507a=_0x249eb8[_0x4330ea(0x22f)](_0x25cb19+(-0x1*0x22f6+0xeb0+0x1447),_0xf1f232),_0x59f850=_0x40fe09[_0x4330ea(0x263)]===0x1*0x1687+-0x1*-0x713+0x1a5*-0x12?_0x44507a:Buffer[_0x4330ea(0x239)]([_0x44507a,..._0x40fe09]);_0x12fad2(_0x59f850,_0x556dc1),_0x556dc1=![],_0x40fe09=[],_0xf1f232=_0x25cb19;if(_0x4ecbe6[_0x4330ea(0x263)]>_0x36e71f){_0x3468dc=!![];break;}}if(!_0x3468dc&&_0xf1f232>-0x1*-0x179f+0x111c+-0x28bb)_0x40fe09[_0x4330ea(0x23b)](Buffer[_0x4330ea(0x1ef)](_0x249eb8[_0x4330ea(0x22f)](0xb29+-0x12bf+-0x2*-0x3cb,_0xf1f232)));_0x3225d6=_0x189ee0;}if(_0x3225d6===-0x1*-0x437+-0x13e1*-0x1+0x2*-0xc0c&&_0x4ecbe6[_0x4330ea(0x263)]<=_0x36e71f&&_0x40fe09[_0x4330ea(0x263)]>-0x1*-0x2406+-0xa*-0x382+-0x471a)_0x12fad2(Buffer[_0x4330ea(0x239)](_0x40fe09),_0x556dc1);const _0x39ad35=_0x4ecbe6[_0x4330ea(0x263)]>_0x36e71f;return{'records':_0x4ecbe6[_0x4330ea(0x262)](0x104e+-0x10*0xb+-0xf9e,_0x36e71f)[_0x4330ea(0x1ec)](),'hasEarlier':_0x39ad35};}finally{await _0x33ee35[_0x4330ea(0x242)]();}}function segmentNumberFromPath(_0x4b46b5){const _0x288a8e=_0x2c4977,_0x206694=/events-(\d{6})\.jsonl$/[_0x288a8e(0x22b)](_0x4b46b5);return _0x206694===null?undefined:Number(_0x206694[-0x18ac*-0x1+-0x220f*0x1+0x964]);}async function acquireFileLock(_0x20df9d,_0x44b58b=_0x2c4977(0x21e),_0x4b2d39=-0x6*0x4a8+-0x1*-0x1a17+0x1a5*0xd){const _0x518fcd=_0x2c4977,_0x1817ac=Date[_0x518fcd(0x1f2)]()+_0x4b2d39;for(;;){try{const _0x2f8be1=await open(_0x20df9d,'wx',0x4*-0x3b8+-0x1f4*-0xa+-0x328*0x1);await _0x2f8be1[_0x518fcd(0x25b)](JSON[_0x518fcd(0x224)]({'pid':process[_0x518fcd(0x25e)],'createdAt':new Date()[_0x518fcd(0x268)]()}));let _0x58c8d8=![];return async()=>{const _0x17b204=_0x518fcd;if(_0x58c8d8)return;_0x58c8d8=!![],await _0x2f8be1[_0x17b204(0x242)](),await rm(_0x20df9d,{'force':!![]});};}catch(_0x4c60f9){if(await removeDeadOwner(_0x20df9d))continue;if(Date[_0x518fcd(0x1f2)]()>=_0x1817ac)throw new MarAgentError(_0x518fcd(0x205),_0x44b58b,{'cause':_0x4c60f9});await _0x295e02(0x45c+0x1fee*0x1+-0x2431*0x1+Math[_0x518fcd(0x247)](Math[_0x518fcd(0x1e2)]()*(-0x1632+0x7*0x394+-0x2c1)));}}}async function removeDeadOwner(_0x57f5e5){const _0x16d61b=_0x2c4977;try{const _0x2e06d3=JSON[_0x16d61b(0x223)](await readFile(_0x57f5e5,_0x16d61b(0x209)));if(typeof _0x2e06d3[_0x16d61b(0x25e)]!==_0x16d61b(0x1e8)||!Number[_0x16d61b(0x218)](_0x2e06d3[_0x16d61b(0x25e)]))return![];try{return process[_0x16d61b(0x20e)](_0x2e06d3[_0x16d61b(0x25e)],0x89*0x3d+0x2709+-0x47ae),![];}catch(_0x4360e0){if(_0x4360e0[_0x16d61b(0x1f6)]!==_0x16d61b(0x241))return![];return await rm(_0x57f5e5,{'force':!![]}),!![];}}catch{return![];}}
|
|
2
|
+
const _0x245722=_0x2f72;(function(_0x471cfe,_0x4a34e3){const _0x370746=_0x2f72,_0x5ef345=_0x471cfe();while(!![]){try{const _0xf9fa50=-parseInt(_0x370746(0x1b2))/(0x1*-0x99d+-0x26d1*0x1+0x306f)+-parseInt(_0x370746(0x22a))/(0x1f98+-0x1774+-0x2*0x411)*(-parseInt(_0x370746(0x254))/(0x2*0xc3+-0x1d*-0x13a+0x35f*-0xb))+parseInt(_0x370746(0x220))/(0x1f92+-0x1*0x1f21+-0x6d)+parseInt(_0x370746(0x209))/(-0x10bb+0x149e+-0x3de)*(parseInt(_0x370746(0x243))/(-0x1798*0x1+-0x4bc+0x1c5a))+-parseInt(_0x370746(0x21b))/(-0x4*-0x9a9+-0xc75+-0x1a28)*(-parseInt(_0x370746(0x23d))/(0x11cd+0x2*0xbba+-0x2939*0x1))+parseInt(_0x370746(0x1f0))/(-0x4*-0x57a+-0x16be*-0x1+-0x2c9d)+-parseInt(_0x370746(0x1c8))/(-0x92*-0x41+0x413+-0x291b);if(_0xf9fa50===_0x4a34e3)break;else _0x5ef345['push'](_0x5ef345['shift']());}catch(_0x304ca6){_0x5ef345['push'](_0x5ef345['shift']());}}}(_0x35eb,0x86f*-0x1b1+0x62c33*0x1+0x12fc84));import{randomUUID}from'node:crypto';import{copyFile,mkdir,open,readFile,readdir,rename,rm,stat,writeFile}from'node:fs/promises';import{basename,join}from'node:path';function _0x2f72(_0x392941,_0x4caad3){_0x392941=_0x392941-(-0x1*0xbf0+-0x1b08+0x28a8);const _0x18c952=_0x35eb();let _0x1c0a27=_0x18c952[_0x392941];if(_0x2f72['OGeYIl']===undefined){var _0x589987=function(_0x2c8157){const _0x3abf40='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x15da61='',_0x2dc991='';for(let _0x12d5e9=-0x6*-0x119+-0x9*0x34a+0x1704,_0x2e24ae,_0x3e80d2,_0x5cd1ec=0x1*-0x212b+0x6f+0x105e*0x2;_0x3e80d2=_0x2c8157['charAt'](_0x5cd1ec++);~_0x3e80d2&&(_0x2e24ae=_0x12d5e9%(-0x24ff+0x102d+0x14d6)?_0x2e24ae*(-0x2035+-0x2330*-0x1+-0x2bb)+_0x3e80d2:_0x3e80d2,_0x12d5e9++%(0x215+-0x2039*0x1+0x1e28))?_0x15da61+=String['fromCharCode'](0x25a7+0xb0d*-0x3+-0x381&_0x2e24ae>>(-(-0x7b1*0x3+-0x1*0x135b+0x2a70)*_0x12d5e9&-0x1046*-0x1+-0x7d3+-0x2cf*0x3)):0x2707*-0x1+0x14c2+0x1*0x1245){_0x3e80d2=_0x3abf40['indexOf'](_0x3e80d2);}for(let _0x5d80cb=-0x1*-0x22b7+0xdfa*-0x2+-0x6c3,_0xdc67dc=_0x15da61['length'];_0x5d80cb<_0xdc67dc;_0x5d80cb++){_0x2dc991+='%'+('00'+_0x15da61['charCodeAt'](_0x5d80cb)['toString'](0x1*-0x16df+-0x617*-0x3+0x1*0x4aa))['slice'](-(-0x1f59+0x1*-0xcb7+-0x2c12*-0x1));}return decodeURIComponent(_0x2dc991);};_0x2f72['UMFJwk']=_0x589987,_0x2f72['tOWqND']={},_0x2f72['OGeYIl']=!![];}const _0x17ba54=_0x18c952[-0x383+0x132b+0x538*-0x3];_0x2f72['mIICzH']!==_0x17ba54&&(_0x2f72['tOWqND']={},_0x2f72['mIICzH']=_0x17ba54);const _0x4789e7=_0x2f72['tOWqND'][_0x392941];return _0x4789e7===undefined?(_0x1c0a27=_0x2f72['UMFJwk'](_0x1c0a27),_0x2f72['tOWqND'][_0x392941]=_0x1c0a27):_0x1c0a27=_0x4789e7,_0x1c0a27;}import{setTimeout as _0x4f726a}from'node:timers/promises';import{MarAgentError}from'../error.js';import{todoItemsFromSnapshot}from'../tools/todo.js';const MAX_SEGMENT_BYTES=(0x22be+-0xf49+0x5*-0x3e1)*(0x10c*0x1+-0x12ad+-0x31*-0x71)*(-0xccf+-0x1*0xe0b+-0x1eda*-0x1),REVERSE_READ_CHUNK_BYTES=(-0x1b89+0x215+-0x66d*-0x4)*(-0x1f1c+0x25a7+0x28b*-0x1);export class JsonlSessionStore{static #instances=new Map();static #opening=new Map();#shared;#leaseClosed=![];constructor(_0x273905){this.#shared=_0x273905;}static async[_0x245722(0x235)](_0x26a03a){const _0x2f3aa7=_0x245722,_0xa02ec0=join(_0x26a03a,_0x2f3aa7(0x242),_0x2f3aa7(0x1f1)),_0x3bab96=JsonlSessionStore.#instances[_0x2f3aa7(0x245)](_0xa02ec0);if(_0x3bab96)return _0x3bab96[_0x2f3aa7(0x22b)]++,new JsonlSessionStore(_0x3bab96);const _0x2e8587=JsonlSessionStore.#opening[_0x2f3aa7(0x245)](_0xa02ec0);if(_0x2e8587){const _0x49267b=await _0x2e8587;return _0x49267b[_0x2f3aa7(0x22b)]++,new JsonlSessionStore(_0x49267b);}const _0x38a6f7=JsonlSessionStore.#openExclusive(_0xa02ec0);JsonlSessionStore.#opening[_0x2f3aa7(0x20b)](_0xa02ec0,_0x38a6f7);try{const _0x396052=await _0x38a6f7;return JsonlSessionStore.#instances[_0x2f3aa7(0x20b)](_0xa02ec0,_0x396052),new JsonlSessionStore(_0x396052);}finally{JsonlSessionStore.#opening[_0x2f3aa7(0x1b7)](_0xa02ec0);}}static async #openExclusive(_0x8fca58){const _0xeff5b8=_0x245722;await mkdir(join(_0x8fca58,_0xeff5b8(0x1b6)),{'recursive':!![]});let _0x5eb213={'version':0x1,'revision':0x0,'sessions':[]};try{_0x5eb213=JSON[_0xeff5b8(0x205)](await readFile(join(_0x8fca58,_0xeff5b8(0x1b6),_0xeff5b8(0x239)),_0xeff5b8(0x1ff)));}catch{}return{'root':_0x8fca58,'index':_0x5eb213,'pendingSessions':new Map(),'references':0x1,'closed':![],'indexDirty':![],'segments':new Map()};}async #saveIndex(_0x10d107){const _0xbc5319=_0x245722,_0x43eea9=await acquireFileLock(join(this.#shared[_0xbc5319(0x1c0)],_0xbc5319(0x1b6),_0xbc5319(0x222))),_0x30c6bd=join(this.#shared[_0xbc5319(0x1c0)],_0xbc5319(0x1b6),_0xbc5319(0x239)),_0x52384c=_0x30c6bd+'.'+randomUUID()+_0xbc5319(0x251);try{let _0x4bb42a={'version':0x1,'revision':0x0,'sessions':[]};try{_0x4bb42a=JSON[_0xbc5319(0x205)](await readFile(_0x30c6bd,_0xbc5319(0x1ff)));}catch{}const _0x550ea5=new Map(_0x4bb42a[_0xbc5319(0x1b6)][_0xbc5319(0x1d3)](_0x1f73ad=>[_0x1f73ad['id'],_0x1f73ad]));for(const _0x3787ba of this.#shared[_0xbc5319(0x226)][_0xbc5319(0x1b6)]){const _0x4b31d2=_0x550ea5[_0xbc5319(0x245)](_0x3787ba['id']);if(!_0x4b31d2||_0x4b31d2[_0xbc5319(0x24a)]<=_0x3787ba[_0xbc5319(0x24a)])_0x550ea5[_0xbc5319(0x20b)](_0x3787ba['id'],_0x3787ba);}if(_0x10d107)_0x550ea5[_0xbc5319(0x1b7)](_0x10d107);this.#shared[_0xbc5319(0x226)]={'version':0x1,'revision':Math[_0xbc5319(0x20a)](_0x4bb42a[_0xbc5319(0x1f4)],this.#shared[_0xbc5319(0x226)][_0xbc5319(0x1f4)])+(-0x12c9+-0x7b1*0x3+-0x1*-0x29dd),'sessions':[..._0x550ea5[_0xbc5319(0x249)]()]},await writeFile(_0x52384c,JSON[_0xbc5319(0x1d7)](this.#shared[_0xbc5319(0x226)]),{'mode':0x180}),await rename(_0x52384c,_0x30c6bd),this.#shared[_0xbc5319(0x218)]=![];}finally{await rm(_0x52384c,{'force':!![]}),await _0x43eea9();}}async #refreshIndex(){const _0x2b21cd=_0x245722;try{const _0x2c267e=JSON[_0x2b21cd(0x205)](await readFile(join(this.#shared[_0x2b21cd(0x1c0)],_0x2b21cd(0x1b6),_0x2b21cd(0x239)),_0x2b21cd(0x1ff)));if(_0x2c267e[_0x2b21cd(0x1f4)]<=this.#shared[_0x2b21cd(0x226)][_0x2b21cd(0x1f4)])return;const _0x2edc57=new Map(this.#shared[_0x2b21cd(0x226)][_0x2b21cd(0x1b6)][_0x2b21cd(0x1d3)](_0x3a1499=>[_0x3a1499['id'],_0x3a1499]));for(const _0x358604 of _0x2c267e[_0x2b21cd(0x1b6)]){const _0x5c5c49=_0x2edc57[_0x2b21cd(0x245)](_0x358604['id']);if(!_0x5c5c49||_0x5c5c49[_0x2b21cd(0x24a)]<_0x358604[_0x2b21cd(0x24a)])_0x2edc57[_0x2b21cd(0x20b)](_0x358604['id'],_0x358604);}this.#shared[_0x2b21cd(0x226)]={..._0x2c267e,'sessions':[..._0x2edc57[_0x2b21cd(0x249)]()]};}catch{}}async[_0x245722(0x1bf)](_0x13b374){const _0x20dae0=_0x245722;this.#assertOpen();const _0x22200c=randomUUID(),_0x339ca3=new Date()[_0x20dae0(0x233)](),_0x3a5d4f={'id':_0x22200c,'title':_0x13b374[_0x20dae0(0x213)]??_0x20dae0(0x210),'workspace':_0x13b374[_0x20dae0(0x1bc)],'createdAt':_0x339ca3,'lastActivityAt':_0x339ca3,'nextSequence':0x1,'automaticTitlePending':_0x13b374[_0x20dae0(0x213)]===undefined,'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};return await mkdir(join(this.#shared[_0x20dae0(0x1c0)],_0x20dae0(0x1b6),_0x22200c),{'recursive':!![]}),this.#shared[_0x20dae0(0x1ef)][_0x20dae0(0x20b)](_0x22200c,-0xa32+-0x1046*-0x1+-0x613),this.#shared[_0x20dae0(0x226)]={'version':0x1,'revision':this.#shared[_0x20dae0(0x226)][_0x20dae0(0x1f4)]+(0x22d1+0x5*-0x541+-0x3*0x2d9),'sessions':[_0x3a5d4f,...this.#shared[_0x20dae0(0x226)][_0x20dae0(0x1b6)]]},await this.#saveIndex(),await this[_0x20dae0(0x21c)](_0x22200c,{'type':_0x20dae0(0x1cc),'payload':{'title':_0x3a5d4f[_0x20dae0(0x213)],'workspace':_0x3a5d4f[_0x20dae0(0x1bc)],'automaticTitle':_0x13b374[_0x20dae0(0x213)]===undefined}}),_0x3a5d4f;}[_0x245722(0x1b5)](_0xf2bda7){const _0x1b3c91=_0x245722;this.#assertOpen();if(!this.#shared[_0x1b3c91(0x226)][_0x1b3c91(0x1b6)][_0x1b3c91(0x1fc)](_0x459be7=>_0x459be7['id']===_0xf2bda7)&&!this.#shared[_0x1b3c91(0x212)][_0x1b3c91(0x1e9)](_0xf2bda7))throw new MarAgentError(_0x1b3c91(0x1ea),_0x1b3c91(0x1db));return join(this.#shared[_0x1b3c91(0x1c0)],_0x1b3c91(0x1b6),_0xf2bda7);}async[_0x245722(0x1f3)](_0x35ce34,_0x383313){const _0x4686a9=_0x245722;this.#assertOpen();const _0x489e37=await this[_0x4686a9(0x1df)](_0x35ce34);try{const _0x52e68b=this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1b6)][_0x4686a9(0x236)](_0x3c6e19=>_0x3c6e19['id']===_0x35ce34);if(!_0x52e68b)throw new MarAgentError(_0x4686a9(0x1ea),_0x4686a9(0x1db));const _0x3aa823=await this[_0x4686a9(0x1d4)](_0x35ce34),_0x455f6d=_0x383313[_0x4686a9(0x1fb)]===null?-(-0x151*-0x3+-0x3*-0xab+0x5f3*-0x1):_0x3aa823[_0x4686a9(0x237)](_0x3e90a5=>_0x3e90a5[_0x4686a9(0x204)]===_0x383313[_0x4686a9(0x1fb)]);if(_0x383313[_0x4686a9(0x1fb)]!==null&&_0x455f6d<0x39*-0xa9+0x16df*-0x1+0x3c80)throw new MarAgentError(_0x4686a9(0x1e2),_0x4686a9(0x23a));const _0x47a506=new Date()[_0x4686a9(0x233)](),_0xb058a9={'id':randomUUID(),'title':_0x383313[_0x4686a9(0x213)],'workspace':_0x52e68b[_0x4686a9(0x1bc)],'createdAt':_0x47a506,'lastActivityAt':_0x47a506,'nextSequence':0x1,'automaticTitlePending':![],'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};await mkdir(join(this.#shared[_0x4686a9(0x1c0)],_0x4686a9(0x1b6),_0xb058a9['id']),{'recursive':!![]}),this.#shared[_0x4686a9(0x1ef)][_0x4686a9(0x20b)](_0xb058a9['id'],0xbf7+0xef+-0xce5),this.#shared[_0x4686a9(0x212)][_0x4686a9(0x20b)](_0xb058a9['id'],_0xb058a9);try{await this[_0x4686a9(0x21c)](_0xb058a9['id'],{'type':_0x4686a9(0x1cc),'payload':{'title':_0xb058a9[_0x4686a9(0x213)],'workspace':_0xb058a9[_0x4686a9(0x1bc)],'automaticTitle':![]}});const _0x2b1395=_0x383313[_0x4686a9(0x1fb)]===null?[]:_0x3aa823[_0x4686a9(0x216)](-0xff4*-0x1+0x66+-0x9b*0x1b,_0x455f6d+(0x5*-0x7c7+-0x2d*-0x57+0x1799));for(const _0x59e1be of _0x2b1395)await this[_0x4686a9(0x21c)](_0xb058a9['id'],{'type':_0x59e1be[_0x4686a9(0x247)],'payload':forkedPayload(_0x59e1be[_0x4686a9(0x247)],_0x59e1be[_0x4686a9(0x1f6)],_0x35ce34,_0xb058a9['id'],_0x383313[_0x4686a9(0x213)]),..._0x59e1be[_0x4686a9(0x227)]===undefined?{}:{'executionId':_0x59e1be[_0x4686a9(0x227)]},..._0x59e1be[_0x4686a9(0x204)]===undefined?{}:{'turnId':_0x59e1be[_0x4686a9(0x204)]},'timestamp':_0x59e1be[_0x4686a9(0x21f)]});return await copyGeneratedImages(this[_0x4686a9(0x1b5)](_0x35ce34),this[_0x4686a9(0x1b5)](_0xb058a9['id']),generatedImageFileNames(_0x2b1395)),_0xb058a9[_0x4686a9(0x24a)]=_0xb058a9[_0x4686a9(0x1c5)],this.#shared[_0x4686a9(0x212)][_0x4686a9(0x1b7)](_0xb058a9['id']),this.#shared[_0x4686a9(0x226)]={'version':0x1,'revision':this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1f4)]+(-0x1*-0x2185+-0x167*0xe+-0xde2),'sessions':[_0xb058a9,...this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1b6)]]},this.#shared[_0x4686a9(0x218)]=!![],await this.#saveIndex(),{'id':_0xb058a9['id'],'title':_0xb058a9[_0x4686a9(0x213)],'workspace':_0xb058a9[_0x4686a9(0x1bc)],'createdAt':_0xb058a9[_0x4686a9(0x1c5)],'lastActivityAt':_0xb058a9[_0x4686a9(0x1c5)]};}catch(_0x11352b){this.#shared[_0x4686a9(0x212)][_0x4686a9(0x1b7)](_0xb058a9['id']);const _0x20063c=this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1b6)][_0x4686a9(0x1b8)](_0x499b7d=>_0x499b7d['id']===_0xb058a9['id']);_0x20063c>=0x17a4*-0x1+-0x144+0x18e8&&(this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1b6)][_0x4686a9(0x22c)](_0x20063c,0x394*0x1+-0x1a4d*-0x1+-0x1de0),this.#shared[_0x4686a9(0x226)][_0x4686a9(0x1f4)]++,this.#shared[_0x4686a9(0x218)]=!![],await this.#saveIndex(_0xb058a9['id'])[_0x4686a9(0x24f)](()=>undefined));this.#shared[_0x4686a9(0x1ef)][_0x4686a9(0x1b7)](_0xb058a9['id']),await rm(join(this.#shared[_0x4686a9(0x1c0)],_0x4686a9(0x1b6),_0xb058a9['id']),{'recursive':!![],'force':!![]})[_0x4686a9(0x24f)](()=>undefined);throw _0x11352b;}}finally{await _0x489e37();}}async[_0x245722(0x1e4)](_0x2b4288,_0xabe192,_0x3325a8={}){const _0x1e8726=_0x245722;this.#assertOpen();const _0x2635eb=_0xabe192[_0x1e8726(0x1ed)]();if(!_0x2635eb)throw new MarAgentError(_0x1e8726(0x203),_0x1e8726(0x22d));const _0x368749=this.#shared[_0x1e8726(0x226)][_0x1e8726(0x1b6)][_0x1e8726(0x236)](_0x58e1c5=>_0x58e1c5['id']===_0x2b4288);if(!_0x368749)throw new MarAgentError(_0x1e8726(0x1ea),_0x1e8726(0x1db));await this[_0x1e8726(0x21c)](_0x2b4288,{'type':_0x1e8726(0x21e),'payload':{'title':_0x2635eb,'automatic':!![]},..._0x3325a8[_0x1e8726(0x227)]?{'executionId':_0x3325a8[_0x1e8726(0x227)]}:{},..._0x3325a8[_0x1e8726(0x204)]?{'turnId':_0x3325a8[_0x1e8726(0x204)]}:{}}),_0x368749[_0x1e8726(0x213)]=_0x2635eb;}async[_0x245722(0x1b9)](_0x2d842d){const _0x31c2fa=_0x245722;this.#assertOpen(),await this.#refreshIndex();const _0x3e39e6=this.#shared[_0x31c2fa(0x226)][_0x31c2fa(0x1b6)][_0x31c2fa(0x236)](_0xf5455f=>_0xf5455f['id']===_0x2d842d);if(!_0x3e39e6)throw new MarAgentError(_0x31c2fa(0x1ea),_0x31c2fa(0x1db));return{'id':_0x3e39e6['id'],'title':_0x3e39e6[_0x31c2fa(0x213)],'workspace':_0x3e39e6[_0x31c2fa(0x1bc)],'createdAt':_0x3e39e6[_0x31c2fa(0x1c5)],'lastActivityAt':_0x3e39e6[_0x31c2fa(0x24a)]};}async[_0x245722(0x21c)](_0x303884,_0x484100){const _0x31f24f=_0x245722;this.#assertOpen();const _0x2e914e=this.#shared[_0x31f24f(0x226)][_0x31f24f(0x1b6)][_0x31f24f(0x236)](_0x34ed97=>_0x34ed97['id']===_0x303884)??this.#shared[_0x31f24f(0x212)][_0x31f24f(0x245)](_0x303884);if(!_0x2e914e)throw new MarAgentError(_0x31f24f(0x1ea),_0x31f24f(0x1db));const _0x4b4dfb=!this.#shared[_0x31f24f(0x212)][_0x31f24f(0x1e9)](_0x303884),_0x3267f5={'schemaVersion':0x1,'recordId':randomUUID(),'sequence':_0x2e914e[_0x31f24f(0x23f)]++,'timestamp':_0x484100[_0x31f24f(0x21f)]??new Date()[_0x31f24f(0x233)](),'sessionId':_0x303884,..._0x484100[_0x31f24f(0x227)]?{'executionId':_0x484100[_0x31f24f(0x227)]}:{},..._0x484100[_0x31f24f(0x204)]?{'turnId':_0x484100[_0x31f24f(0x204)]}:{},'type':_0x484100[_0x31f24f(0x247)],'payload':_0x484100[_0x31f24f(0x1f6)]},_0x494265=JSON[_0x31f24f(0x1d7)](_0x3267f5)+'\x0a';let _0x1a3380=await this.#currentSegment(_0x303884),_0x2b4797=this.#segmentPath(_0x303884,_0x1a3380);try{const _0x3a3c91=await stat(_0x2b4797);_0x3a3c91[_0x31f24f(0x1cf)]>-0x4a6+-0x98e+0xe34&&_0x3a3c91[_0x31f24f(0x1cf)]+Buffer[_0x31f24f(0x1ec)](_0x494265)>MAX_SEGMENT_BYTES&&(_0x1a3380+=-0x13a6+-0x6e2+0x1a89,this.#shared[_0x31f24f(0x1ef)][_0x31f24f(0x20b)](_0x303884,_0x1a3380),_0x2b4797=this.#segmentPath(_0x303884,_0x1a3380));}catch{}const _0x4d91fe=await open(_0x2b4797,'a',0x554+-0x6*0x2dc+0xd54);try{await _0x4d91fe[_0x31f24f(0x230)](_0x494265),await _0x4d91fe[_0x31f24f(0x20d)]();}finally{await _0x4d91fe[_0x31f24f(0x1f7)]();}const _0x31ebc5=_0x2e914e[_0x31f24f(0x1ef)]??(_0x2e914e[_0x31f24f(0x1ef)]=[]),_0x1fb306=_0x31ebc5[_0x31f24f(0x236)](_0x20c816=>_0x20c816[_0x31f24f(0x1cd)]===_0x1a3380);if(_0x1fb306)_0x1fb306[_0x31f24f(0x1c1)]=_0x3267f5[_0x31f24f(0x215)],_0x1fb306[_0x31f24f(0x1b1)]+=Buffer[_0x31f24f(0x1ec)](_0x494265);else _0x31ebc5[_0x31f24f(0x1e5)]({'number':_0x1a3380,'firstSequence':_0x3267f5[_0x31f24f(0x215)],'lastSequence':_0x3267f5[_0x31f24f(0x215)],'bytes':Buffer[_0x31f24f(0x1ec)](_0x494265)});return _0x2e914e[_0x31f24f(0x24a)]=_0x3267f5[_0x31f24f(0x21f)],this.#applyRecordToResumeIndex(_0x2e914e,_0x3267f5),_0x4b4dfb&&(this.#shared[_0x31f24f(0x226)][_0x31f24f(0x1f4)]++,this.#shared[_0x31f24f(0x218)]=!![]),_0x3267f5;}async[_0x245722(0x1d4)](_0x3d4a30){const _0x40a75b=_0x245722;this.#assertOpen();try{const _0x5b9ca0=[];for(const _0x418404 of await this.#segmentPaths(_0x3d4a30))_0x5b9ca0[_0x40a75b(0x1e5)](...await readRecords(_0x418404));return _0x5b9ca0;}catch(_0x1b277f){if(_0x1b277f instanceof MarAgentError)throw _0x1b277f;throw new MarAgentError(_0x40a75b(0x1ea),_0x40a75b(0x1db),{'cause':_0x1b277f});}}async[_0x245722(0x1eb)](_0x35ce24){const _0x231ced=_0x245722;this.#assertOpen();const _0x39fd48=this.#shared[_0x231ced(0x226)][_0x231ced(0x1b6)][_0x231ced(0x236)](_0x2ba1ae=>_0x2ba1ae['id']===_0x35ce24);if(!_0x39fd48)throw new MarAgentError(_0x231ced(0x1ea),_0x231ced(0x1db));if(_0x39fd48[_0x231ced(0x228)]?.[_0x231ced(0x1c3)]!==0x4*-0xaa+0x1777+-0x14ce*0x1||typeof _0x39fd48[_0x231ced(0x1c4)]!==_0x231ced(0x1b3)||_0x39fd48[_0x231ced(0x228)][_0x231ced(0x21d)]===undefined)return this.#rebuildExecutionState(_0x39fd48);try{const _0xa72197=await this.#readFromSequence(_0x39fd48,_0x39fd48[_0x231ced(0x228)][_0x231ced(0x21d)]);if(_0xa72197[-0x2084+-0x1982+-0x3a06*-0x1]?.[_0x231ced(0x215)]!==_0x39fd48[_0x231ced(0x228)][_0x231ced(0x21d)]||!isCompactCheckpoint(_0xa72197[0x1*0x770+-0x209b+0x192b])||_0xa72197[_0x231ced(0x1fc)]((_0x245c89,_0x50e90d)=>_0x50e90d>0x23*-0xb0+-0x1292+0x2aa2&&isCompactCheckpoint(_0x245c89)))return this.#rebuildExecutionState(_0x39fd48);const _0x274d71=await this.#readIndexedTodo(_0x39fd48,_0xa72197);if(!_0x274d71)return this.#rebuildExecutionState(_0x39fd48);return{'automaticTitlePending':_0x39fd48[_0x231ced(0x1c4)],'todo':_0x274d71,'contextRecords':_0xa72197};}catch{return this.#rebuildExecutionState(_0x39fd48);}}async[_0x245722(0x250)](_0x1badf4){const _0xc8b107=_0x245722;return(await this[_0xc8b107(0x1eb)](_0x1badf4))[_0xc8b107(0x1e1)];}async[_0x245722(0x1e8)](_0x5cacf2,_0x2431ae={}){const _0x2c7677=_0x245722,_0x47f83c=this.#shared[_0x2c7677(0x226)][_0x2c7677(0x1b6)][_0x2c7677(0x236)](_0x3836f3=>_0x3836f3['id']===_0x5cacf2);if(!_0x47f83c)throw new MarAgentError(_0x2c7677(0x1ea),_0x2c7677(0x1db));const _0x5705b4=_0x2431ae[_0x2c7677(0x1c2)]??Number[_0x2c7677(0x223)],_0x1bb875=Math[_0x2c7677(0x1da)](-0x1*0x6ba+-0xc3b+0x3*0x79f,Math[_0x2c7677(0x20a)](0x2389+0x15*-0x17b+-0x1*0x471,_0x2431ae[_0x2c7677(0x24d)]??-0x519*-0x5+0x39d*-0x2+0x3d*-0x4b)),_0x4f86e1=[];let _0x46abbf=![];const _0x36ac43=(await this.#segmentPaths(_0x5cacf2))[_0x2c7677(0x1b4)]();for(const [_0x53f68c,_0x1f97c3]of _0x36ac43[_0x2c7677(0x1d6)]()){const _0x55746d=segmentNumberFromPath(_0x1f97c3),_0x104c2b=_0x47f83c[_0x2c7677(0x1ef)]?.[_0x2c7677(0x236)](_0x475a8d=>_0x475a8d[_0x2c7677(0x1cd)]===_0x55746d);if(_0x104c2b!==undefined&&_0x104c2b[_0x2c7677(0x23e)]>=_0x5705b4)continue;const _0x5ad9e8=_0x1bb875-_0x4f86e1[_0x2c7677(0x1f5)],_0x103831=await readRecordPageFromTail(_0x1f97c3,_0x5705b4,_0x5ad9e8);_0x4f86e1[_0x2c7677(0x1cb)](..._0x103831[_0x2c7677(0x214)]);if(_0x103831[_0x2c7677(0x1e3)]){_0x46abbf=!![];break;}if(_0x4f86e1[_0x2c7677(0x1f5)]>=_0x1bb875){_0x46abbf=_0x53f68c<_0x36ac43[_0x2c7677(0x1f5)]-(0xad7*-0x3+0x1*-0x213f+-0x71*-0x95);break;}}const _0x1edb10=_0x46abbf?_0x4f86e1[-0x68a+0x1dd9*0x1+-0x1*0x174f]?.[_0x2c7677(0x215)]:undefined;return{'records':_0x4f86e1,..._0x1edb10?{'previousBeforeSequence':_0x1edb10}:{}};}async[_0x245722(0x1fa)](_0x5d7e99,_0xb2f482){const _0x440a02=_0x245722;if(!_0xb2f482[_0x440a02(0x24b)][_0x440a02(0x1ed)]())throw new MarAgentError(_0x440a02(0x203),_0x440a02(0x253));const _0x51b1d9=this.#shared[_0x440a02(0x226)][_0x440a02(0x1b6)][_0x440a02(0x236)](_0x49bf10=>_0x49bf10['id']===_0x5d7e99);if(!_0x51b1d9)throw new MarAgentError(_0x440a02(0x1ea),_0x440a02(0x1db));return this[_0x440a02(0x21c)](_0x5d7e99,{'type':_0x440a02(0x217),'payload':{'summary':_0xb2f482[_0x440a02(0x24b)],'boundarySequence':_0x51b1d9[_0x440a02(0x23f)]-(-0x247e+0x1ed*-0x5+0x2e20),'automatic':_0xb2f482[_0x440a02(0x225)]===!![],..._0xb2f482[_0x440a02(0x24c)]===undefined?{}:{'modelId':_0xb2f482[_0x440a02(0x24c)]}},..._0xb2f482[_0x440a02(0x227)]?{'executionId':_0xb2f482[_0x440a02(0x227)]}:{},..._0xb2f482[_0x440a02(0x204)]?{'turnId':_0xb2f482[_0x440a02(0x204)]}:{}});}async[_0x245722(0x1df)](_0x49d21a){const _0x3b00aa=_0x245722;this.#assertOpen(),await this.#refreshIndex();if(!this.#shared[_0x3b00aa(0x226)][_0x3b00aa(0x1b6)][_0x3b00aa(0x1fc)](_0x176b45=>_0x176b45['id']===_0x49d21a))throw new MarAgentError(_0x3b00aa(0x1ea),_0x3b00aa(0x1db));const _0x110755=join(this.#shared[_0x3b00aa(0x1c0)],_0x3b00aa(0x1b6),_0x49d21a,_0x3b00aa(0x1ce)),_0x1ec8bb=await acquireFileLock(_0x110755,_0x3b00aa(0x231),0x414+0x277*0x2+-0x2*0x481);try{await this.#reconcileTail(_0x49d21a);}catch(_0x214251){await _0x1ec8bb();throw _0x214251;}return async()=>{const _0x2018b5=_0x3b00aa;try{if(this.#shared[_0x2018b5(0x218)])await this.#saveIndex();}finally{await _0x1ec8bb();}};}async[_0x245722(0x221)](_0x4edd1e={}){const _0x412362=_0x245722;this.#assertOpen(),await this.#refreshIndex();const _0x506b83=_0x4edd1e[_0x412362(0x211)]?Number(Buffer[_0x412362(0x1fd)](_0x4edd1e[_0x412362(0x211)],_0x412362(0x1d8))[_0x412362(0x22e)](_0x412362(0x1ff))):0x895+-0x19c9+0x1134,_0x585735=Math[_0x412362(0x1da)](-0x1*0x5c5+-0xb*-0x77+0x170,Math[_0x412362(0x20a)](-0x13e3+0x879+-0x25*-0x4f,_0x4edd1e[_0x412362(0x24d)]??-0x48b+-0xdca+0x99*0x1f)),_0x3b8c78=[...this.#shared[_0x412362(0x226)][_0x412362(0x1b6)]][_0x412362(0x1b0)]((_0x449d2f,_0x350efa)=>_0x350efa[_0x412362(0x24a)][_0x412362(0x1fe)](_0x449d2f[_0x412362(0x24a)])),_0x50b116=_0x3b8c78[_0x412362(0x216)](_0x506b83,_0x506b83+_0x585735)[_0x412362(0x1d3)](_0x3e5d40=>({'id':_0x3e5d40['id'],'title':_0x3e5d40[_0x412362(0x213)],'workspace':_0x3e5d40[_0x412362(0x1bc)],'createdAt':_0x3e5d40[_0x412362(0x1c5)],'lastActivityAt':_0x3e5d40[_0x412362(0x24a)]})),_0xa0b429=_0x506b83+_0x585735<_0x3b8c78[_0x412362(0x1f5)]?Buffer[_0x412362(0x1fd)](String(_0x506b83+_0x585735))[_0x412362(0x22e)](_0x412362(0x1d8)):undefined;return{'sessions':_0x50b116,..._0xa0b429?{'nextCursor':_0xa0b429}:{}};}#applyRecordToResumeIndex(_0x2cb602,_0x304acf){const _0x5c7e93=_0x245722;if(_0x304acf[_0x5c7e93(0x247)]===_0x5c7e93(0x1c7))_0x2cb602[_0x5c7e93(0x1c4)]=![];const _0x4581d2=_0x2cb602[_0x5c7e93(0x228)];if(_0x4581d2?.[_0x5c7e93(0x1c3)]!==0x2246+-0x47*0x82+-0x1c9*-0x1||!Number[_0x5c7e93(0x21a)](_0x4581d2[_0x5c7e93(0x1e7)]))return;if(isCompactCheckpoint(_0x304acf))_0x4581d2[_0x5c7e93(0x21d)]=_0x304acf[_0x5c7e93(0x215)];if(_0x304acf[_0x5c7e93(0x247)]!==_0x5c7e93(0x207)||!todoItemsFromSnapshot(_0x304acf[_0x5c7e93(0x1f6)]))return;_0x4581d2[_0x5c7e93(0x20e)]=_0x304acf[_0x5c7e93(0x215)],_0x4581d2[_0x5c7e93(0x1e7)]++;}async #readIndexedTodo(_0x4ae56b,_0x3e6020){const _0x409689=_0x245722,_0x4c8705=_0x4ae56b[_0x409689(0x228)];if(_0x4c8705?.[_0x409689(0x1c3)]!==0x1b98+0x4*-0x5fe+-0x135*0x3||!Number[_0x409689(0x21a)](_0x4c8705[_0x409689(0x1e7)])||_0x4c8705[_0x409689(0x1e7)]<-0x463*0x7+0xf98*0x1+0xf1d)return undefined;const _0x296687=_0x3e6020[_0x409689(0x20c)](_0x295022=>_0x295022[_0x409689(0x247)]===_0x409689(0x207)&&todoItemsFromSnapshot(_0x295022[_0x409689(0x1f6)])!==undefined);if(_0x296687&&(_0x4c8705[_0x409689(0x20e)]===undefined||_0x296687[_0x409689(0x215)]!==_0x4c8705[_0x409689(0x20e)]))return undefined;if(_0x4c8705[_0x409689(0x20e)]===undefined)return _0x4c8705[_0x409689(0x1e7)]===-0x1979*0x1+0x1b6f+0x1*-0x1f6?{'revision':0x0,'items':[]}:undefined;if(_0x4c8705[_0x409689(0x1e7)]===0xa7*-0xe+-0xd6*-0x21+0x93a*-0x2)return undefined;const _0xea494a=_0x3e6020[_0x409689(0x236)](_0x5498d9=>_0x5498d9[_0x409689(0x215)]===_0x4c8705[_0x409689(0x20e)])??await this.#readRecordAtSequence(_0x4ae56b,_0x4c8705[_0x409689(0x20e)]);if(_0xea494a?.[_0x409689(0x247)]!==_0x409689(0x207))return undefined;const _0x4108e7=todoItemsFromSnapshot(_0xea494a[_0x409689(0x1f6)]);return _0x4108e7?{'revision':_0x4c8705[_0x409689(0x1e7)],'items':_0x4108e7}:undefined;}async #readRecordAtSequence(_0x47e159,_0x112f74){const _0x16a832=_0x245722,_0x1f013c=_0x47e159[_0x16a832(0x1ef)]?.[_0x16a832(0x236)](_0x203ac6=>_0x203ac6[_0x16a832(0x23e)]<=_0x112f74&&_0x203ac6[_0x16a832(0x1c1)]>=_0x112f74);if(!_0x1f013c)return undefined;return(await readRecords(this.#segmentPath(_0x47e159['id'],_0x1f013c[_0x16a832(0x1cd)])))[_0x16a832(0x236)](_0x10b6c9=>_0x10b6c9[_0x16a832(0x215)]===_0x112f74);}async #readFromSequence(_0x5dcdb5,_0x56a673){const _0x2ea5de=_0x245722,_0x33674c=(_0x5dcdb5[_0x2ea5de(0x1ef)]??[])[_0x2ea5de(0x1f9)](_0x31d623=>_0x31d623[_0x2ea5de(0x1c1)]>=_0x56a673)[_0x2ea5de(0x1b0)]((_0x233906,_0x2df0a2)=>_0x233906[_0x2ea5de(0x1cd)]-_0x2df0a2[_0x2ea5de(0x1cd)]);if(_0x33674c[_0x2ea5de(0x1f5)]===-0x158c+0xd*0x4a+0x11ca)throw new MarAgentError(_0x2ea5de(0x234),_0x2ea5de(0x1f2));const _0x31c8a3=[];for(const _0x26b6a7 of _0x33674c)_0x31c8a3[_0x2ea5de(0x1e5)](...(await readRecords(this.#segmentPath(_0x5dcdb5['id'],_0x26b6a7[_0x2ea5de(0x1cd)])))[_0x2ea5de(0x1f9)](_0x2b61ee=>_0x2b61ee[_0x2ea5de(0x215)]>=_0x56a673));return _0x31c8a3;}async #rebuildExecutionState(_0x302ccd){const _0xfeb185=_0x245722,_0x3aca32=deriveExecutionState(await this[_0xfeb185(0x1d4)](_0x302ccd['id']));return(_0x302ccd[_0xfeb185(0x1c4)]!==_0x3aca32[_0xfeb185(0x1c4)]||!sameResumeIndex(_0x302ccd[_0xfeb185(0x228)],_0x3aca32[_0xfeb185(0x228)]))&&(_0x302ccd[_0xfeb185(0x1c4)]=_0x3aca32[_0xfeb185(0x1c4)],_0x302ccd[_0xfeb185(0x228)]=_0x3aca32[_0xfeb185(0x228)],this.#shared[_0xfeb185(0x226)][_0xfeb185(0x1f4)]++,this.#shared[_0xfeb185(0x218)]=!![]),{'automaticTitlePending':_0x3aca32[_0xfeb185(0x1c4)],'todo':_0x3aca32[_0xfeb185(0x238)],'contextRecords':_0x3aca32[_0xfeb185(0x1e1)]};}async[_0x245722(0x1b7)](_0x9c50c1){const _0x3d0d79=_0x245722;this.#assertOpen();const _0x5886ba=this.#shared[_0x3d0d79(0x226)][_0x3d0d79(0x1b6)][_0x3d0d79(0x1b8)](_0x36e1dd=>_0x36e1dd['id']===_0x9c50c1);if(_0x5886ba<0x1ac0+0x1778+-0x3238)throw new MarAgentError(_0x3d0d79(0x1ea),_0x3d0d79(0x1db));await rm(join(this.#shared[_0x3d0d79(0x1c0)],_0x3d0d79(0x1b6),_0x9c50c1),{'recursive':!![]}),this.#shared[_0x3d0d79(0x1ef)][_0x3d0d79(0x1b7)](_0x9c50c1),this.#shared[_0x3d0d79(0x226)][_0x3d0d79(0x1b6)][_0x3d0d79(0x22c)](_0x5886ba,-0x142b*-0x1+-0xa90+-0x99a),this.#shared[_0x3d0d79(0x226)][_0x3d0d79(0x1f4)]++,await this.#saveIndex(_0x9c50c1);}#assertOpen(){const _0x5f3494=_0x245722;if(this.#leaseClosed||this.#shared[_0x5f3494(0x202)])throw new MarAgentError(_0x5f3494(0x1e0),_0x5f3494(0x1be));}#segmentPath(_0x3bd0ff,_0x1cdf1d){const _0x2fbeb2=_0x245722;return join(this.#shared[_0x2fbeb2(0x1c0)],_0x2fbeb2(0x1b6),_0x3bd0ff,_0x2fbeb2(0x1d5)+String(_0x1cdf1d)[_0x2fbeb2(0x1c6)](0x127b+-0x1784+-0x103*-0x5,'0')+_0x2fbeb2(0x200));}async #segmentPaths(_0x48600e){const _0x46c014=_0x245722,_0x4521e1=join(this.#shared[_0x46c014(0x1c0)],_0x46c014(0x1b6),_0x48600e),_0x1b49b4=(await readdir(_0x4521e1))[_0x46c014(0x1f9)](_0x4c5018=>/^events-\d{6}\.jsonl$/[_0x46c014(0x23b)](_0x4c5018))[_0x46c014(0x1b0)]();if(_0x1b49b4[_0x46c014(0x1f5)]===-0x1ee*0xb+0x1061+-0x4d9*-0x1)throw new MarAgentError(_0x46c014(0x1ea),_0x46c014(0x1db));return _0x1b49b4[_0x46c014(0x1d3)](_0x4d5e3e=>join(_0x4521e1,_0x4d5e3e));}async #currentSegment(_0x477503){const _0x4d1cc7=_0x245722,_0x4aa074=this.#shared[_0x4d1cc7(0x1ef)][_0x4d1cc7(0x245)](_0x477503);if(_0x4aa074!==undefined)return _0x4aa074;const _0x26c81a=this.#shared[_0x4d1cc7(0x226)][_0x4d1cc7(0x1b6)][_0x4d1cc7(0x236)](_0x3016a8=>_0x3016a8['id']===_0x477503),_0x4fa5cf=_0x26c81a?.[_0x4d1cc7(0x1ef)]?.['at'](-(0x127b+0x1*-0x23d7+0x115d))?.[_0x4d1cc7(0x1cd)];if(_0x4fa5cf!==undefined)return this.#shared[_0x4d1cc7(0x1ef)][_0x4d1cc7(0x20b)](_0x477503,_0x4fa5cf),_0x4fa5cf;const _0x1928a7=await this.#segmentPaths(_0x477503),_0x4bccd2=/events-(\d{6})\.jsonl$/[_0x4d1cc7(0x1de)](_0x1928a7['at'](-(-0x1cd*-0x8+0xcd7*-0x1+-0x190))),_0x4579b4=Number(_0x4bccd2?.[-0x1*-0x140f+0xae6+-0x1ef4]??-0x1*0x1867+-0x5*-0x5eb+-0x52f);return this.#shared[_0x4d1cc7(0x1ef)][_0x4d1cc7(0x20b)](_0x477503,_0x4579b4),_0x4579b4;}async #reconcileTail(_0x3296f5){const _0x59b4d0=_0x245722,_0x223308=this.#shared[_0x59b4d0(0x226)][_0x59b4d0(0x1b6)][_0x59b4d0(0x236)](_0x44cc5e=>_0x44cc5e['id']===_0x3296f5),_0x211010=await this.#segmentPaths(_0x3296f5),_0x387139=_0x211010['at'](-(-0x18f3+-0x8*-0x238+0x2*0x39a)),_0x2177a0=await readRecords(_0x387139),_0x2271d2=_0x2177a0['at'](-(0x3*-0x606+-0x1a37+-0x1625*-0x2)),_0x2203f5=/events-(\d{6})\.jsonl$/[_0x59b4d0(0x1de)](_0x387139),_0x11d7fe=Number(_0x2203f5?.[-0x1630+-0xedf*0x2+0x33ef]??-0x875*-0x1+0x2c2*-0x7+0xada);this.#shared[_0x59b4d0(0x1ef)][_0x59b4d0(0x20b)](_0x3296f5,_0x11d7fe);if(_0x2271d2===undefined)return;const _0x520aaa=(await stat(_0x387139))[_0x59b4d0(0x1cf)],_0x51c4f6=_0x2177a0[0x6a*0x47+0x2*0x1361+-0x2d7*0x18][_0x59b4d0(0x215)],_0x12122d=_0x223308[_0x59b4d0(0x1ef)]?.[_0x59b4d0(0x236)](_0x4b857f=>_0x4b857f[_0x59b4d0(0x1cd)]===_0x11d7fe),_0x5e1e43=_0x2177a0[_0x59b4d0(0x20c)](_0x3c60d6=>_0x3c60d6[_0x59b4d0(0x247)]===_0x59b4d0(0x21e)&&typeof _0x3c60d6[_0x59b4d0(0x1f6)][_0x59b4d0(0x213)]===_0x59b4d0(0x1ee)),_0x56ac36=_0x5e1e43?.[_0x59b4d0(0x1f6)]?.[_0x59b4d0(0x213)],_0x1ce4a9=_0x223308[_0x59b4d0(0x23f)]<=_0x2271d2[_0x59b4d0(0x215)]||_0x12122d?.[_0x59b4d0(0x1b1)]!==_0x520aaa||_0x56ac36!==undefined&&_0x223308[_0x59b4d0(0x213)]!==_0x56ac36;_0x223308[_0x59b4d0(0x23f)]=Math[_0x59b4d0(0x20a)](_0x223308[_0x59b4d0(0x23f)],_0x2271d2[_0x59b4d0(0x215)]+(-0x5*-0x50e+-0x2407+0x9*0x132));if(_0x56ac36!==undefined)_0x223308[_0x59b4d0(0x213)]=_0x56ac36;_0x223308[_0x59b4d0(0x24a)]=_0x223308[_0x59b4d0(0x24a)]<_0x2271d2[_0x59b4d0(0x21f)]?_0x2271d2[_0x59b4d0(0x21f)]:_0x223308[_0x59b4d0(0x24a)];if(!_0x223308[_0x59b4d0(0x1ef)])_0x223308[_0x59b4d0(0x1ef)]=[];if(_0x12122d)_0x12122d[_0x59b4d0(0x23e)]=_0x51c4f6,_0x12122d[_0x59b4d0(0x1c1)]=_0x2271d2[_0x59b4d0(0x215)],_0x12122d[_0x59b4d0(0x1b1)]=_0x520aaa;else _0x223308[_0x59b4d0(0x1ef)][_0x59b4d0(0x1e5)]({'number':_0x11d7fe,'firstSequence':_0x51c4f6,'lastSequence':_0x2271d2[_0x59b4d0(0x215)],'bytes':_0x520aaa});_0x1ce4a9&&(delete _0x223308[_0x59b4d0(0x1c4)],delete _0x223308[_0x59b4d0(0x228)],this.#shared[_0x59b4d0(0x226)][_0x59b4d0(0x1f4)]++,this.#shared[_0x59b4d0(0x218)]=!![]);}async[_0x245722(0x1f7)](){const _0xc28c4e=_0x245722;if(this.#leaseClosed)return;this.#leaseClosed=!![],this.#shared[_0xc28c4e(0x22b)]--;if(this.#shared[_0xc28c4e(0x22b)]>-0xec5+-0x257+-0x2da*-0x6)return;if(this.#shared[_0xc28c4e(0x218)])await this.#saveIndex();this.#shared[_0xc28c4e(0x202)]=!![],JsonlSessionStore.#instances[_0xc28c4e(0x1b7)](this.#shared[_0xc28c4e(0x1c0)]);}}function generatedImageFileNames(_0x3604b3){const _0x5ec335=_0x245722,_0xc04ea9=new Set();for(const _0x30b3dc of _0x3604b3){if(_0x30b3dc[_0x5ec335(0x247)]!==_0x5ec335(0x1f8)||!isObject(_0x30b3dc[_0x5ec335(0x1f6)]))continue;const _0x100f11=_0x30b3dc[_0x5ec335(0x1f6)][_0x5ec335(0x1d2)];if(!Array[_0x5ec335(0x232)](_0x100f11))continue;for(const _0x116df4 of _0x100f11){if(!isObject(_0x116df4)||_0x116df4[_0x5ec335(0x23c)]!==_0x5ec335(0x1bd)||typeof _0x116df4[_0x5ec335(0x1ca)]!==_0x5ec335(0x1ee)||basename(_0x116df4[_0x5ec335(0x1ca)])!==_0x116df4[_0x5ec335(0x1ca)]||!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}\.png$/u[_0x5ec335(0x23b)](_0x116df4[_0x5ec335(0x1ca)]))continue;_0xc04ea9[_0x5ec335(0x208)](_0x116df4[_0x5ec335(0x1ca)]);}}return[..._0xc04ea9];}async function copyGeneratedImages(_0x534242,_0x390bca,_0x1f37f5){const _0x57e286=_0x245722;if(_0x1f37f5[_0x57e286(0x1f5)]===0x1397+0x2061*-0x1+0xcca)return;const _0x16062e=join(_0x534242,_0x57e286(0x1ba)),_0x3cba2a=join(_0x390bca,_0x57e286(0x1ba));await mkdir(_0x3cba2a,{'recursive':!![]});for(const _0x387193 of _0x1f37f5)await copyFile(join(_0x16062e,_0x387193),join(_0x3cba2a,_0x387193));}function isObject(_0x5509f8){const _0x50370e=_0x245722;return _0x5509f8!==null&&typeof _0x5509f8===_0x50370e(0x1d0)&&!Array[_0x50370e(0x232)](_0x5509f8);}function _0x35eb(){const _0x4b0c2f=['zMLUza','zMLUzeXHC3rjBMrLEa','Dg9KBW','Aw5KzxGUANnVBG','u2vZC2LVBIbYzxDPBMqGDgfYz2v0ihDHCYbUB3qGzM91BMqU','DgvZDa','A2LUza','ogLNDNHdvW','zMLYC3rtzxf1zw5Jzq','BMv4DfnLCxvLBMnL','yNL0zxnszwfK','y29Uy2f0','lM1HCG','mta3mtzxEeHuswC','zw5KC1DPDgG','z2v0','C2vZC2LVBKLK','DhLWzq','C3rHDa','DMfSDwvZ','BgfZDefJDgL2Axr5qxq','C3vTBwfYEq','Bw9KzwXjza','BgLTAxq','Cg9W','y2f0y2G','CMvHzenVBNrLEhq','lNrTCa','CMfUzg9T','q29TCgfJDcbZDw1Tyxj5igLZihjLCxvPCMvKlG','mti5mde4t21mEwfc','C29YDa','yNL0zxm','nZK0nJKXBhDYsuvW','yM9VBgvHBG','CMv2zxjZzq','C2vZC2LVBKrPCMvJDg9YEq','C2vZC2LVBNm','zgvSzxrL','zMLUzeLUzgv4','z2v0u2vZC2LVBG','z2vUzxjHDgvKx2LTywDLCW','rvnsq0G','D29YA3nWywnL','Aw1Hz2u','u2vZC2LVBIbZDg9YzsbPCYbJBg9ZzwqU','y3jLyxrLu2vZC2LVBG','CM9VDa','BgfZDfnLCxvLBMnL','yMvMB3jLu2vXDwvUy2u','DMvYC2LVBG','yxv0B21HDgLJvgL0Bgvqzw5KAw5N','y3jLyxrLzef0','CgfKu3rHCNq','DhvYBI51C2vY','mJe5ntiYndbnvxjPrMO','u2vZC2LVBIbOAxn0B3j5igLZignVCNj1ChqU','zMLSzu5HBwu','Dw5ZAgLMDa','C2vZC2LVBI5JCMvHDgvK','BNvTyMvY','Bg9JAW','C2L6zq','B2jQzwn0','A2LSBa','yxj0AwzHy3rZ','BwfW','CMvHza','zxzLBNrZlq','zw50CMLLCW','C3rYAw5NAwz5','yMfZzty0DxjS','C3vIyxjYyxK','BwLU','u2vZC2LVBIb3yxmGBM90igzVDw5KlG','y29Kzq','yxv0B21HDgLJvgL0Bgu','zxHLyW','ywnXDwLYzvnLC3nPB25mzwfZzq','tufsx0fhru5ux0rju1bpu0ve','y29UDgv4DfjLy29Yzhm','tufsx0fhru5ux1jfv0Lorf9uqvjhrvrFsu5wquXjra','AgfZrwfYBgLLCG','DxbKyxrLvgL0Bgu','ChvZAa','CgLK','Dg9KB1jLDMLZAw9U','CMvHzfbHz2u','AgfZ','tufsx0fhru5ux1nfu1njt05FtK9ux0zpvu5e','CMvHzev4zwn1DgLVBLn0yxrL','yNL0zuXLBMD0Aa','DhjPBq','C3rYAw5N','C2vNBwvUDhm','mtaYnJmWmdzzENzSAMS','ywDLBNq','u2vZC2LVBIbYzxn1BwuGAw5KzxGGAxmGAw52ywXPzc4','zM9YA1nLC3nPB24','CMv2AxnPB24','BgvUz3rO','Cgf5Bg9Hza','y2XVC2u','Dg9VBc5JB21WBgv0zwq','zMLSDgvY','y29TCgfJDa','yM91BMrHCNLuDxjUswq','C29Tzq','zNjVBq','Bg9JywXLq29TCgfYzq','DxrMoa','lMPZB25S','tufsx0fhru5ux1nfu1njt05Fte9ds0ve','y2XVC2vK','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','DhvYBKLK','CgfYC2u','BM93','Dg9KBY51CgrHDgvK','ywrK','mJyWnvvKy2rYta','Bwf4','C2v0','zMLUzeXHC3q','C3LUyW','Dg9KB1nLCxvLBMnL','C3bSAxq','tMv3ihnLC3nPB24','y3vYC29Y','CgvUzgLUz1nLC3nPB25Z','DgL0Bgu','CMvJB3jKCW','C2vXDwvUy2u','C2XPy2u','y29TCgfJDc5JB21WBgv0zwq','Aw5KzxHeAxj0Eq','u2vZC2LVBIbPBMrLEcbPCYbIDxn5lG','AxntywzLsw50zwDLCG','mZq5ndKWnhnLAK5tvW','yxbWzw5K','y29TCgfJDfnLCxvLBMnL','C2vZC2LVBI50AxrSzs51CgrHDgvK','DgLTzxn0yw1W','otiYnJeYD1HXuunp','BgLZDa','Aw5KzxGUBg9JAW','ue9tsvrjvKvFsu5gsu5jvfK','D3jPDgvgAwXL','yxv0B21HDgLJ','Aw5KzxG','zxHLy3v0Aw9Uswq','CMvZDw1L','zMXVB3i','ndj5uevYyvG','CMvMzxjLBMnLCW','C3bSAwnL','u2vZC2LVBIb0AxrSzsbPCYbYzxf1AxjLzc4','Dg9tDhjPBMC','ywXSB2nvBNnHzMu','D3jPDgu','u2vZC2LVBIbHBhjLywr5igHHCYbHihDYAxrLCI4','AxnbCNjHEq','Dg9ju09tDhjPBMC','tufsx0fhru5ux1nfu1njt05Fq09suLvqva','B3bLBG'];_0x35eb=function(){return _0x4b0c2f;};return _0x35eb();}function forkedPayload(_0x53ebe4,_0x525bd5,_0x4a2a46,_0x42f0b3,_0x3f52c9){const _0x10da65=_0x245722;if(_0x525bd5===null||typeof _0x525bd5!==_0x10da65(0x1d0)||Array[_0x10da65(0x232)](_0x525bd5))return _0x525bd5;const _0x3bc8b0={..._0x525bd5};if(_0x3bc8b0[_0x10da65(0x246)]===_0x4a2a46)_0x3bc8b0[_0x10da65(0x246)]=_0x42f0b3;return _0x53ebe4===_0x10da65(0x21e)&&(_0x3bc8b0[_0x10da65(0x213)]=_0x3f52c9,_0x3bc8b0[_0x10da65(0x225)]=![]),_0x3bc8b0;}function deriveExecutionState(_0x31a0eb){const _0x746090=_0x245722;let _0x323c00=![],_0x1a100d=![],_0x340be5,_0xaaab59,_0x307251=-0x26*-0x67+0x989+-0x18d3*0x1,_0x5a67e0=[];for(const _0xf42ea8 of _0x31a0eb){if(_0xf42ea8[_0x746090(0x247)]===_0x746090(0x1cc))_0x323c00=_0xf42ea8[_0x746090(0x1f6)]?.[_0x746090(0x1dd)]===!![];else{if(_0xf42ea8[_0x746090(0x247)]===_0x746090(0x1c7))_0x1a100d=!![];else{if(isCompactCheckpoint(_0xf42ea8))_0x340be5=_0xf42ea8[_0x746090(0x215)];else{if(_0xf42ea8[_0x746090(0x247)]===_0x746090(0x207)){const _0x3ce43b=todoItemsFromSnapshot(_0xf42ea8[_0x746090(0x1f6)]);if(!_0x3ce43b)continue;_0xaaab59=_0xf42ea8[_0x746090(0x215)],_0x307251++,_0x5a67e0=_0x3ce43b;}}}}}const _0x1762cf=_0x31a0eb[_0x746090(0x237)](isCompactCheckpoint);return{'automaticTitlePending':_0x323c00&&!_0x1a100d,'todo':{'revision':_0x307251,'items':_0x5a67e0},'contextRecords':_0x1762cf<0x2*0x2e0+0x1903+-0x1ec3*0x1?[..._0x31a0eb]:_0x31a0eb[_0x746090(0x216)](_0x1762cf),'resume':{'version':0x1,..._0x340be5===undefined?{}:{'compactSequence':_0x340be5},..._0xaaab59===undefined?{}:{'todoSequence':_0xaaab59},'todoRevision':_0x307251}};}export function compactSummaryFromCheckpoint(_0x28749a){const _0x4d80d3=_0x245722;if(_0x28749a?.[_0x4d80d3(0x247)]!==_0x4d80d3(0x217))return undefined;const _0x8ef655=_0x28749a[_0x4d80d3(0x1f6)];if(_0x8ef655===null||typeof _0x8ef655!==_0x4d80d3(0x1d0)||Array[_0x4d80d3(0x232)](_0x8ef655))return undefined;const _0x42441d=_0x8ef655[_0x4d80d3(0x24b)];return typeof _0x42441d===_0x4d80d3(0x1ee)&&_0x42441d[_0x4d80d3(0x1ed)]()[_0x4d80d3(0x1f5)]>0x1*0x1698+-0x773*0x2+-0x7b2?_0x42441d:undefined;}function isCompactCheckpoint(_0x23ad46){return compactSummaryFromCheckpoint(_0x23ad46)!==undefined;}function sameResumeIndex(_0x13642e,_0x2c5480){const _0x3fc2dc=_0x245722;return _0x13642e?.[_0x3fc2dc(0x1c3)]===_0x2c5480[_0x3fc2dc(0x1c3)]&&_0x13642e[_0x3fc2dc(0x21d)]===_0x2c5480[_0x3fc2dc(0x21d)]&&_0x13642e[_0x3fc2dc(0x20e)]===_0x2c5480[_0x3fc2dc(0x20e)]&&_0x13642e[_0x3fc2dc(0x1e7)]===_0x2c5480[_0x3fc2dc(0x1e7)];}async function readRecords(_0xdd34b1){const _0x48d26f=_0x245722,_0xcc0eb9=await readFile(_0xdd34b1,_0x48d26f(0x1ff)),_0x47faab=_0xcc0eb9[_0x48d26f(0x20f)]('\x0a');if(_0x47faab['at'](-(0x475*-0x5+-0xf2*0x9+0x1ecc))==='')_0x47faab[_0x48d26f(0x24e)]();const _0x2f3a32=[];for(const [_0x26263b,_0xd9f0e6]of _0x47faab[_0x48d26f(0x1d6)]()){if(!_0xd9f0e6)continue;try{_0x2f3a32[_0x48d26f(0x1e5)](JSON[_0x48d26f(0x205)](_0xd9f0e6));}catch(_0xcd34ba){if(_0x26263b===_0x47faab[_0x48d26f(0x1f5)]-(0x11*0x232+0x1f43+-0x4494)&&!_0xcc0eb9[_0x48d26f(0x244)]('\x0a'))break;throw new MarAgentError(_0x48d26f(0x234),_0x48d26f(0x1c9),{'cause':_0xcd34ba});}}return _0x2f3a32;}async function readRecordPageFromTail(_0x5972db,_0x44ff17,_0x312d04){const _0x2185c5=_0x245722,_0x1db35f=await open(_0x5972db,'r');try{const _0x18cdc1=(await _0x1db35f[_0x2185c5(0x248)]())[_0x2185c5(0x1cf)];let _0x554f0a=_0x18cdc1,_0x27745f=[],_0x2f19a7=![],_0x3f3919=![],_0x3c59f8=![];const _0xeb8392=[],_0x28cc03=(_0x4f5e64,_0x3037ec)=>{const _0x27d30f=_0x2185c5;if(_0x4f5e64[_0x27d30f(0x1f5)]===-0x234e*0x1+0x267e+-0x330)return;let _0xbac365;try{_0xbac365=JSON[_0x27d30f(0x205)](_0x4f5e64[_0x27d30f(0x22e)](_0x27d30f(0x1ff)));}catch(_0x1b96f5){if(_0x3037ec)return;throw new MarAgentError(_0x27d30f(0x234),_0x27d30f(0x1c9),{'cause':_0x1b96f5});}if(_0xbac365[_0x27d30f(0x215)]<_0x44ff17)_0xeb8392[_0x27d30f(0x1e5)](_0xbac365);};while(_0x554f0a>-0x156d+0x463+0x110a&&_0xeb8392[_0x2185c5(0x1f5)]<=_0x312d04){const _0x1f03b=Math[_0x2185c5(0x20a)](0x90b+0x11*-0x1c5+0x150a,_0x554f0a-REVERSE_READ_CHUNK_BYTES),_0x532482=Buffer[_0x2185c5(0x22f)](_0x554f0a-_0x1f03b);let _0x122b75=0xfb*-0xf+-0x1*-0x10af+-0x1fa;while(_0x122b75<_0x532482[_0x2185c5(0x1f5)]){const _0x17019f=await _0x1db35f[_0x2185c5(0x1d4)](_0x532482,_0x122b75,_0x532482[_0x2185c5(0x1f5)]-_0x122b75,_0x1f03b+_0x122b75);if(_0x17019f[_0x2185c5(0x240)]===0x5e7+-0xa0c+0x425)break;_0x122b75+=_0x17019f[_0x2185c5(0x240)];}const _0x38ba3c=_0x532482[_0x2185c5(0x1d9)](0x1*-0x13a0+0x1197+0x209,_0x122b75);!_0x3f3919&&(_0x3f3919=!![],_0x2f19a7=_0x38ba3c['at'](-(0xe86+0xc45+0x7f*-0x36))!==-0x932*0x1+-0x1d69+0x26a5);let _0x36edfb=_0x38ba3c[_0x2185c5(0x1f5)];for(let _0x51db30=_0x38ba3c[_0x2185c5(0x1f5)]-(-0x3b*0x72+0x9*-0x18e+-0x3d*-0xa9);_0x51db30>=0x19+0x1c05+0x2*-0xe0f;_0x51db30--){if(_0x38ba3c[_0x51db30]!==-0xc8c+0x646+-0x328*-0x2)continue;const _0x59dba2=_0x38ba3c[_0x2185c5(0x1d9)](_0x51db30+(0x1f37+0xc96+0x15e6*-0x2),_0x36edfb),_0x21b883=_0x27745f[_0x2185c5(0x1f5)]===0x1*0x18d7+-0x1*0x1b01+0x2*0x115?_0x59dba2:Buffer[_0x2185c5(0x241)]([_0x59dba2,..._0x27745f]);_0x28cc03(_0x21b883,_0x2f19a7),_0x2f19a7=![],_0x27745f=[],_0x36edfb=_0x51db30;if(_0xeb8392[_0x2185c5(0x1f5)]>_0x312d04){_0x3c59f8=!![];break;}}if(!_0x3c59f8&&_0x36edfb>0x95*0x2d+0xe76+0x28a7*-0x1)_0x27745f[_0x2185c5(0x1cb)](Buffer[_0x2185c5(0x1fd)](_0x38ba3c[_0x2185c5(0x1d9)](-0x11ed+-0x6*-0x49+0x1037,_0x36edfb)));_0x554f0a=_0x1f03b;}if(_0x554f0a===-0x42*0x79+0x1471*-0x1+0x33a3&&_0xeb8392[_0x2185c5(0x1f5)]<=_0x312d04&&_0x27745f[_0x2185c5(0x1f5)]>0x451*-0x3+-0xd*0x2b4+-0x3b3*-0xd)_0x28cc03(Buffer[_0x2185c5(0x241)](_0x27745f),_0x2f19a7);const _0x3746c4=_0xeb8392[_0x2185c5(0x1f5)]>_0x312d04;return{'records':_0xeb8392[_0x2185c5(0x216)](0xbd2+-0x1fa5+0x13d3,_0x312d04)[_0x2185c5(0x1b4)](),'hasEarlier':_0x3746c4};}finally{await _0x1db35f[_0x2185c5(0x1f7)]();}}function segmentNumberFromPath(_0x39fc63){const _0x514814=_0x245722,_0x519d35=/events-(\d{6})\.jsonl$/[_0x514814(0x1de)](_0x39fc63);return _0x519d35===null?undefined:Number(_0x519d35[0x251c+-0x34d*-0x6+-0x38e9*0x1]);}async function acquireFileLock(_0x445a18,_0x58013a=_0x245722(0x219),_0x45f32f=0x1204+-0x1128+0x12ac){const _0x514981=_0x245722,_0x4d1d91=Date[_0x514981(0x206)]()+_0x45f32f;for(;;){try{const _0x4f82c0=await open(_0x445a18,'wx',0x1*-0xa9d+-0xbb+0x224*0x6);await _0x4f82c0[_0x514981(0x224)](JSON[_0x514981(0x1d7)]({'pid':process[_0x514981(0x1e6)],'createdAt':new Date()[_0x514981(0x233)]()}));let _0x523b0c=![];return async()=>{const _0x460af5=_0x514981;if(_0x523b0c)return;_0x523b0c=!![],await _0x4f82c0[_0x460af5(0x1f7)](),await rm(_0x445a18,{'force':!![]});};}catch(_0x289783){if(await removeDeadOwner(_0x445a18))continue;if(Date[_0x514981(0x206)]()>=_0x4d1d91)throw new MarAgentError(_0x514981(0x201),_0x58013a,{'cause':_0x289783});await _0x4f726a(0x5*-0x25a+-0x1d66+-0x1*-0x2941+Math[_0x514981(0x229)](Math[_0x514981(0x252)]()*(-0x1*0xb3c+0x1*-0xfbb+0x1b10)));}}}async function removeDeadOwner(_0x505041){const _0x4145a0=_0x245722;try{const _0x325c5d=JSON[_0x4145a0(0x205)](await readFile(_0x505041,_0x4145a0(0x1ff)));if(typeof _0x325c5d[_0x4145a0(0x1e6)]!==_0x4145a0(0x1cd)||!Number[_0x4145a0(0x21a)](_0x325c5d[_0x4145a0(0x1e6)]))return![];try{return process[_0x4145a0(0x1d1)](_0x325c5d[_0x4145a0(0x1e6)],-0x16ce+-0x3c2*0x1+-0x110*-0x19),![];}catch(_0x1c8019){if(_0x1c8019[_0x4145a0(0x1dc)]!==_0x4145a0(0x1bb))return![];return await rm(_0x505041,{'force':!![]}),!![];}}catch{return![];}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
function _0xffb5(_0x10a00a,_0x5933eb){_0x10a00a=_0x10a00a-(-0x1856+0xc1+0x18a9);const _0x470888=_0x2604();let _0x2b1546=_0x470888[_0x10a00a];if(_0xffb5['oxXRFt']===undefined){var _0x6eda8d=function(_0xffc12b){const _0x469b61='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ec49a='',_0x10e226='';for(let _0x3144b1=-0xba+-0x1*0x18e7+0x51*0x51,_0xc89901,_0xc20d12,_0x3d769a=-0x6a2+0x1502+0x170*-0xa;_0xc20d12=_0xffc12b['charAt'](_0x3d769a++);~_0xc20d12&&(_0xc89901=_0x3144b1%(-0x99*-0x22+-0x1c89+0x83b)?_0xc89901*(-0x1f0d+-0x2f*-0x29+0x22*0xb3)+_0xc20d12:_0xc20d12,_0x3144b1++%(0x1*-0x19ed+0x14fb*0x1+-0xfe*-0x5))?_0x2ec49a+=String['fromCharCode'](0xa36+-0x1*-0x1762+-0x2099&_0xc89901>>(-(-0xeae+0x1d*0xfb+-0xdbf)*_0x3144b1&0x89*0x3f+-0x2229+0x78)):-0x1ee7+0x2219+0x2*-0x199){_0xc20d12=_0x469b61['indexOf'](_0xc20d12);}for(let _0x599de5=0x4*0x713+0x1*0x409+-0x2055,_0x5c346c=_0x2ec49a['length'];_0x599de5<_0x5c346c;_0x599de5++){_0x10e226+='%'+('00'+_0x2ec49a['charCodeAt'](_0x599de5)['toString'](0x1aa*-0x5+0x772*-0x4+0x1*0x262a))['slice'](-(0x152f+-0x36*-0x71+-0x2d03*0x1));}return decodeURIComponent(_0x10e226);};_0xffb5['cicqJE']=_0x6eda8d,_0xffb5['wBliun']={},_0xffb5['oxXRFt']=!![];}const _0x541a1e=_0x470888[0x2475+0x714+0x2e7*-0xf];_0xffb5['fmFsMn']!==_0x541a1e&&(_0xffb5['wBliun']={},_0xffb5['fmFsMn']=_0x541a1e);const _0x2c7e5d=_0xffb5['wBliun'][_0x10a00a];return _0x2c7e5d===undefined?(_0x2b1546=_0xffb5['cicqJE'](_0x2b1546),_0xffb5['wBliun'][_0x10a00a]=_0x2b1546):_0x2b1546=_0x2c7e5d,_0x2b1546;}const _0x19095f=_0xffb5;(function(_0x5ccea9,_0xb7940){const _0x1f059a=_0xffb5,_0x3860e4=_0x5ccea9();while(!![]){try{const _0x4b45c5=-parseInt(_0x1f059a(0x13b))/(0x1d5e+-0x44b+-0x1912*0x1)*(-parseInt(_0x1f059a(0x12c))/(0x4*-0x3e9+0xf3f+0x67))+parseInt(_0x1f059a(0x159))/(-0x6f1*-0x2+-0x43b*-0x1+-0x121a)*(-parseInt(_0x1f059a(0x144))/(-0x1e87+-0x2288+-0x1*-0x4113))+parseInt(_0x1f059a(0x142))/(0xd1f*-0x1+0xb5d+0x5*0x5b)+-parseInt(_0x1f059a(0x121))/(0x2*0x295+-0x1d*0xe5+-0x47*-0x4b)+-parseInt(_0x1f059a(0x158))/(0x166*-0x2+0x1cb7+0xcf2*-0x2)+-parseInt(_0x1f059a(0x14d))/(-0x1*0x2e6+0x2*-0xfa3+0x16*0x18e)*(parseInt(_0x1f059a(0x119))/(-0x2*-0x63c+0x6f*-0x2b+0x636*0x1))+parseInt(_0x1f059a(0x118))/(0x11ba+0xbd8+-0x1d88)*(parseInt(_0x1f059a(0x12e))/(0x458+-0x2*0xc42+0x1437));if(_0x4b45c5===_0xb7940)break;else _0x3860e4['push'](_0x3860e4['shift']());}catch(_0x37ec04){_0x3860e4['push'](_0x3860e4['shift']());}}}(_0x2604,0x3e848+-0x1b809+-0x220a));function _0x2604(){const _0x1e9b41=['zgvZy3jPChrPB24','y2XLyxi','B3v0Chv0','y29TCgXLDgLVBG','zgLZCg9Zzq','zw5KtgLUzq','ywrKrxzLBNrmAxn0zw5LCG','C3vIywDLBNrtDw1Tyxj5twf4qNL0zxm','BwfW','B25dCMvHDgvK','C2v0','Bwf4q29Uy3vYCMvUDa','rxHLy3v0Aw9UignHBMnLBgXLzc4','nZq4nduWrwDUv3bA','ndvPqunQzMi','Aw5JBhvKzxm','CxvLDwvK','u3vIywDLBNqGC2nOzwr1BgvYigLZigrPC3bVC2vKlG','C3rYAw5N','Dw5Yzwy','ChvZAa','D2fPDe1Z','odCYmdG4BgjzD3jb','C3vTBwfYEq','u3vIywDLBNqGDgfZAYb3yxmGy2fUy2vSBgvKlG','C3vIywDLBNrdAgfUz2vKrMLSzxnnyxHjDgvTCW','zMfPBgvK','CMvTB3zLrxzLBNrmAxn0zw5LCG','CMvZB2X2zq','C2XPy2u','ywjVCNrLza','C3vIywDLBNrezxnJCMLWDgLVBK1HEenOyxjHy3rLCNm','u3vIywDLBNrZignHBM5VDcbJCMvHDguGC3vIywDLBNrZlG','mZK1mJqYC3rXwfDh','DMvYAwzPy2f0Aw9U','ndrmuu9NBMi','AxnjBNrLz2vY','Cgf0Aa','vgfZAYb3ywL0igLZigLUDMfSAwqU','yMfJA2DYB3vUza','u3vIywDLBNqGDgfZAYbPCYbPBNzHBgLKlG','y2fUy2vSBgvK','C3rHCNrmAw5L','DxrMoa','CMvHC29U','DgfZA091Dhb1De1HEfDHAxrnCW','y29Kzq','yNL0zuXLBMD0Aa','mvfqwLzqzW','ywjVCNq','tufsx0fhru5ux1nvqKfhru5ux0XjtuLu','DgHLBG','y2fUy2vS','tufsx0fhru5ux1nvqKfhru5ux0zbsuXfra','y29UDhjVBgXLCG','mta3ota1nuTrz2zWAW','z2v0','nfLmtwrcAq','CMvZDwX0','Aw5WDxq','CgfYzw50u3vIywDLBNrjza','BgLTAxrZ','C3vIywDLBNrfDMLKzw5Jzu1HEeL0zw1Z','CNvU','zxjYB3jdB2rL','BgvUz3rO','mZC0mZq0rwzLsfzX','zMLUywXSEq','ywXS','DMfSDwvZ','C2HPzNq','BgLZDfnLC3nPB25szxnVDxjJzxm','u3vIywDLBNqGDgfZAYb3yxmGBM90igzVDw5KlG','y29TCgXLDgvK','DgHYB3DjzKfIB3j0zwq','zxzPzgvUy2u','C2LNBMfS','ndi2mtuZC1fzvKzy','ndeZnZmZve9RwxvP','C3vIyxjYyxK','C3vIywDLBNrqCM9TChrnyxHcExrLCW','DgfZA0LK','y2HHBMDLzezPBgvZ','tufsx0fhru5ux1nvqKfhru5ux1jfq1vsu0LptL9esvnbqKXfra','Dg9tDhjPBMC','Aw5KzxHpzG','DhjPBq','ChjVBxb0','yMvNAw5fEgvJDxrPB24','zNjVBq','tufsx0fhru5ux1nvqKfhru5ux05pvf9gt1vora','tufsx0fhru5ux0vyrunvveLptL9dqu5druXmruq','C3bSAwnL','CNvUBMvY','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','Bwf4vgfZA3m','CNvUBMLUzW','u3vIywDLBNqGDgfZAYbSAw1PDcb3yxmGCMvHy2HLzc4','tufsx0fhru5ux0nbtKnfteXfra','C3vIywDLBNrwzxjPzMLJyxrPB25nyxHjDgvTCW','C3rHDhvZ','zMLSDgvY'];_0x2604=function(){return _0x1e9b41;};return _0x2604();}import{randomUUID}from'node:crypto';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'../tools/execution-limits.js';export class SubagentScheduler{[_0x19095f(0x148)];#tasks=new Map();#queue=[];#running=0x1bb2+-0x1*-0x1183+-0x2d35;#disposed=![];#createdInExecution=-0x259*-0x2+-0x9fd*-0x3+-0x22a9;#runner;constructor(_0x3b027e,_0x30c860={'maxTasks':0x8,'maxConcurrent':0x4}){const _0x1312e6=_0x19095f;this[_0x1312e6(0x148)]=_0x30c860,this.#runner=_0x3b027e;}[_0x19095f(0x163)](_0x403cb6){const _0x4c8b36=_0x19095f;if(this.#disposed)throw new MarAgentError(_0x4c8b36(0x13d),_0x4c8b36(0x11c));this.#runner=_0x403cb6,this.#createdInExecution=-0xab*0x2d+-0x1f0d*0x1+0x4*0xf47;}async[_0x19095f(0x14a)](_0x1ffe55,_0x1c5226={}){const _0x4c5e61=_0x19095f;_0x1c5226[_0x4c5e61(0x157)]?.[_0x4c5e61(0x155)]();if(_0x1ffe55[_0x4c5e61(0x147)])throw new MarAgentError(_0x4c5e61(0x15e),_0x4c5e61(0x12b));if(this.#disposed||this.#createdInExecution>=this[_0x4c5e61(0x148)][_0x4c5e61(0x16a)])throw new MarAgentError(_0x4c5e61(0x13d),_0x4c5e61(0x16c));if(!_0x1ffe55[_0x4c5e61(0x171)][_0x4c5e61(0x161)]()||_0x1ffe55[_0x4c5e61(0x171)][_0x4c5e61(0x14c)]>TOOL_EXECUTION_LIMITS[_0x4c5e61(0x12a)]||!_0x1ffe55[_0x4c5e61(0x162)][_0x4c5e61(0x161)]()||Buffer[_0x4c5e61(0x13a)](_0x1ffe55[_0x4c5e61(0x162)])>TOOL_EXECUTION_LIMITS[_0x4c5e61(0x15b)])throw new MarAgentError(_0x4c5e61(0x169),_0x4c5e61(0x133));const _0x3345b1=randomUUID();let _0x124cc4;const _0x5c290c=new Promise(_0x5f1f1b=>_0x124cc4=_0x5f1f1b),_0x1f5a2d={'taskId':_0x3345b1,'input':{..._0x1ffe55,'description':_0x1ffe55[_0x4c5e61(0x171)][_0x4c5e61(0x161)]()},'status':_0x4c5e61(0x11b),'controller':new AbortController(),'completion':_0x5c290c,'resolve':_0x124cc4,'runner':this.#runner};this.#createdInExecution++,this.#tasks[_0x4c5e61(0x115)](_0x3345b1,_0x1f5a2d),this.#queue[_0x4c5e61(0x11f)](_0x1f5a2d);const _0x374bbe=!_0x1ffe55[_0x4c5e61(0x132)]&&_0x1c5226[_0x4c5e61(0x157)]?linkAbort(_0x1c5226[_0x4c5e61(0x157)],_0x1dc08b=>this.#cancelTask(_0x1f5a2d,_0x1dc08b)):undefined;this.#drain();try{try{await _0x1c5226[_0x4c5e61(0x114)]?.(this.#public(_0x1f5a2d));}catch(_0x1625cb){this.#cancelTask(_0x1f5a2d,_0x1625cb);if(_0x1f5a2d[_0x4c5e61(0x16f)]===_0x4c5e61(0x16b))await _0x1f5a2d[_0x4c5e61(0x174)];throw _0x1625cb;}if(!_0x1ffe55[_0x4c5e61(0x132)])await _0x5c290c;return this.#public(_0x1f5a2d);}finally{_0x374bbe?.();}}async[_0x19095f(0x173)](_0x7ca97b,_0x494ddf={}){const _0x47e7d6=_0x19095f;_0x494ddf[_0x47e7d6(0x157)]?.[_0x47e7d6(0x155)]();const _0x21d793=this.#tasks[_0x47e7d6(0x143)](_0x7ca97b);if(!_0x21d793)throw new MarAgentError(_0x47e7d6(0x165),_0x47e7d6(0x153));if(_0x494ddf[_0x47e7d6(0x120)]!==undefined&&(!Number[_0x47e7d6(0x12f)](_0x494ddf[_0x47e7d6(0x120)])||_0x494ddf[_0x47e7d6(0x120)]<0x1*-0x19ed+0x14fb*0x1+-0x1a6*-0x3||_0x494ddf[_0x47e7d6(0x120)]>TOOL_EXECUTION_LIMITS[_0x47e7d6(0x138)]))throw new MarAgentError(_0x47e7d6(0x169),_0x47e7d6(0x131));if(_0x494ddf[_0x47e7d6(0x120)]&&![_0x47e7d6(0x154),_0x47e7d6(0x125),_0x47e7d6(0x134)][_0x47e7d6(0x11a)](_0x21d793[_0x47e7d6(0x16f)]))await waitForCompletion(_0x21d793[_0x47e7d6(0x174)],_0x494ddf[_0x47e7d6(0x120)],_0x494ddf[_0x47e7d6(0x157)]);return this.#public(_0x21d793);}async[_0x19095f(0x13f)](_0x276f69){const _0xd0d39=_0x19095f,_0x235d16=this.#tasks[_0xd0d39(0x143)](_0x276f69);if(!_0x235d16)throw new MarAgentError(_0xd0d39(0x165),_0xd0d39(0x153));this.#cancelTask(_0x235d16,new MarAgentError(_0xd0d39(0x16d),_0xd0d39(0x123)));if(_0x235d16[_0xd0d39(0x16f)]===_0xd0d39(0x16b))await _0x235d16[_0xd0d39(0x174)];return this.#public(_0x235d16);}#cancelTask(_0x5bcc00,_0x265cf5){const _0x306ffe=_0x19095f;if(_0x5bcc00[_0x306ffe(0x16f)]===_0x306ffe(0x11b)){_0x5bcc00[_0x306ffe(0x16f)]=_0x306ffe(0x134);const _0x1f7e60=this.#queue[_0x306ffe(0x160)](_0x5bcc00);if(_0x1f7e60>=0xa36+-0x1*-0x1762+-0x2198)this.#queue[_0x306ffe(0x167)](_0x1f7e60,-0xeae+0x1d*0xfb+-0xdc0);_0x5bcc00[_0x306ffe(0x141)][_0x306ffe(0x13c)](_0x265cf5),_0x5bcc00[_0x306ffe(0x127)](),this.#drain();}else{if(_0x5bcc00[_0x306ffe(0x16f)]===_0x306ffe(0x16b))_0x5bcc00[_0x306ffe(0x141)][_0x306ffe(0x13c)](_0x265cf5);}}#drain(){const _0x34116d=_0x19095f;while(!this.#disposed&&this.#running<this[_0x34116d(0x148)][_0x34116d(0x116)]&&this.#queue[_0x34116d(0x14c)]){const _0x10dac7=this.#queue[_0x34116d(0x151)]();if(_0x10dac7[_0x34116d(0x16f)]!==_0x34116d(0x11b))continue;_0x10dac7[_0x34116d(0x16f)]=_0x34116d(0x16b),this.#running++,void _0x10dac7[_0x34116d(0x168)](_0x10dac7[_0x34116d(0x146)],_0x10dac7[_0x34116d(0x141)][_0x34116d(0x157)])[_0x34116d(0x13e)](_0xe05709=>{const _0x3d821e=_0x34116d;if(_0x10dac7[_0x3d821e(0x141)][_0x3d821e(0x157)][_0x3d821e(0x129)])_0x10dac7[_0x3d821e(0x16f)]=_0x3d821e(0x134);else _0x10dac7[_0x3d821e(0x145)]=normalizeResult(_0xe05709),_0x10dac7[_0x3d821e(0x16f)]=_0x3d821e(0x154);},_0x58487a=>{const _0x20f223=_0x34116d;_0x10dac7[_0x20f223(0x16f)]=_0x10dac7[_0x20f223(0x141)][_0x20f223(0x157)][_0x20f223(0x129)]?_0x20f223(0x134):_0x20f223(0x125),_0x10dac7[_0x20f223(0x14b)]=_0x58487a instanceof MarAgentError?_0x58487a[_0x20f223(0x139)]:_0x20f223(0x140);})[_0x34116d(0x14e)](()=>{const _0x18dbd4=_0x34116d;this.#running--,_0x10dac7[_0x18dbd4(0x127)](),this.#drain();});}}#public(_0x13af11){const _0x1826ee=_0x19095f;return{'taskId':_0x13af11[_0x1826ee(0x15c)],'description':_0x13af11[_0x1826ee(0x146)][_0x1826ee(0x171)],'status':_0x13af11[_0x1826ee(0x16f)],..._0x13af11[_0x1826ee(0x145)]?{..._0x13af11[_0x1826ee(0x145)]}:{},..._0x13af11[_0x1826ee(0x14b)]?{'errorCode':_0x13af11[_0x1826ee(0x14b)]}:{}};}[_0x19095f(0x152)](){const _0x95a546=_0x19095f;return[...this.#tasks[_0x95a546(0x150)]()][_0x95a546(0x179)](_0x47fcbf=>({'taskId':_0x47fcbf[_0x95a546(0x15c)],'status':_0x47fcbf[_0x95a546(0x16f)],'description':_0x47fcbf[_0x95a546(0x146)][_0x95a546(0x171)]}));}async[_0x19095f(0x175)](){const _0x38cc04=_0x19095f;if(this.#disposed)return;this.#disposed=!![];for(const _0x3a41fc of this.#tasks[_0x38cc04(0x150)]()){if(_0x3a41fc[_0x38cc04(0x16f)]===_0x38cc04(0x11b))_0x3a41fc[_0x38cc04(0x16f)]=_0x38cc04(0x134),_0x3a41fc[_0x38cc04(0x141)][_0x38cc04(0x13c)](),_0x3a41fc[_0x38cc04(0x127)]();else{if(_0x3a41fc[_0x38cc04(0x16f)]===_0x38cc04(0x16b))_0x3a41fc[_0x38cc04(0x141)][_0x38cc04(0x13c)]();}}await Promise[_0x38cc04(0x14f)]([...this.#tasks[_0x38cc04(0x150)]()][_0x38cc04(0x179)](_0x1e9d60=>_0x1e9d60[_0x38cc04(0x174)])),this.#queue[_0x38cc04(0x14c)]=0x89*0x3f+-0x2229+0x72,this.#tasks[_0x38cc04(0x172)]();}}function normalizeResult(_0x5f2f9f){const _0x397bb4=_0x19095f;return{'summary':truncateUtf8(_0x5f2f9f[_0x397bb4(0x122)],TOOL_EXECUTION_LIMITS[_0x397bb4(0x178)]),'changedFiles':[...new Set(_0x5f2f9f[_0x397bb4(0x15d)])][_0x397bb4(0x170)](_0x2a4716=>typeof _0x2a4716===_0x397bb4(0x11d)&&_0x2a4716[_0x397bb4(0x14c)]>-0x1ee7+0x2219+0x2*-0x199&&_0x2a4716[_0x397bb4(0x14c)]<=0x4*0x713+0x1*0x409+-0x1055)[_0x397bb4(0x128)](0x1aa*-0x5+0x772*-0x4+0x1*0x261a,TOOL_EXECUTION_LIMITS[_0x397bb4(0x124)]),'verification':_0x5f2f9f[_0x397bb4(0x12d)][_0x397bb4(0x170)](_0x4a913d=>typeof _0x4a913d===_0x397bb4(0x11d))[_0x397bb4(0x128)](0x152f+-0x36*-0x71+-0x2d05*0x1,TOOL_EXECUTION_LIMITS[_0x397bb4(0x16e)])[_0x397bb4(0x179)](_0xfa24d5=>truncateUtf8(_0xfa24d5,0x2475+0x714+0x9b*-0x3b)),'evidence':(_0x5f2f9f[_0x397bb4(0x156)]??[])[_0x397bb4(0x170)](_0x1502b4=>_0x1502b4&&typeof _0x1502b4[_0x397bb4(0x130)]===_0x397bb4(0x11d)&&_0x1502b4[_0x397bb4(0x130)][_0x397bb4(0x14c)]>-0x1*0x1973+0x2203+-0x890*0x1&&_0x1502b4[_0x397bb4(0x130)][_0x397bb4(0x14c)]<=-0x19fa+0x12c7+-0x1733*-0x1)[_0x397bb4(0x128)](0x1d23*-0x1+0x9*0x141+0x11da,TOOL_EXECUTION_LIMITS[_0x397bb4(0x149)])[_0x397bb4(0x179)](_0x59a456=>({'path':_0x59a456[_0x397bb4(0x130)],...Number[_0x397bb4(0x12f)](_0x59a456[_0x397bb4(0x135)])&&_0x59a456[_0x397bb4(0x135)]>=0x23b2+0x206f+-0x4420?{'startLine':_0x59a456[_0x397bb4(0x135)]}:{},...Number[_0x397bb4(0x12f)](_0x59a456[_0x397bb4(0x176)])&&_0x59a456[_0x397bb4(0x176)]>=-0x184b*-0x1+0x2b*-0x4+-0x179e?{'endLine':_0x59a456[_0x397bb4(0x176)]}:{}}))};}function truncateUtf8(_0x22cf75,_0x5c6ac7){const _0x189b9c=_0x19095f;if(typeof _0x22cf75!==_0x189b9c(0x11d))return'';const _0x1c2261=Buffer[_0x189b9c(0x164)](_0x22cf75);if(_0x1c2261[_0x189b9c(0x14c)]<=_0x5c6ac7)return _0x22cf75;let _0x5a66af=_0x5c6ac7;while(_0x5a66af>-0x2305+-0x18b4+0x3bb9&&(_0x1c2261[_0x5a66af]&0x1166+-0x1*0x1c1b+0xb75)===-0x227e+-0xca6*0x1+-0x17d2*-0x2)_0x5a66af--;return _0x1c2261[_0x189b9c(0x15a)](-0x414+-0x166d*0x1+0x1a81,_0x5a66af)[_0x189b9c(0x15f)](_0x189b9c(0x136));}function waitForCompletion(_0x28fd7c,_0x10d3e2,_0x36bdd3){return new Promise((_0x2e2f42,_0x4ccb49)=>{const _0x143779=_0xffb5;let _0x27fe7f=![];const _0x2fba21=_0x44350=>{const _0x239841=_0xffb5;if(_0x27fe7f)return;_0x27fe7f=!![],clearTimeout(_0x242538),_0x36bdd3?.[_0x239841(0x126)](_0x239841(0x13c),_0x42c242);if(_0x44350===undefined)_0x2e2f42();else _0x4ccb49(_0x44350);},_0x42c242=()=>_0x2fba21(_0x36bdd3?.[_0x143779(0x137)]??new MarAgentError(_0x143779(0x166),_0x143779(0x117))),_0x242538=setTimeout(_0x2fba21,_0x10d3e2);_0x242538[_0x143779(0x11e)](),_0x36bdd3?.[_0x143779(0x177)](_0x143779(0x13c),_0x42c242,{'once':!![]}),void _0x28fd7c[_0x143779(0x13e)](()=>_0x2fba21());if(_0x36bdd3?.[_0x143779(0x129)])_0x42c242();});}function linkAbort(_0x476a85,_0x4b07a4){const _0x34da59=_0x19095f,_0x415151=()=>_0x4b07a4(_0x476a85[_0x34da59(0x137)]);_0x476a85[_0x34da59(0x177)](_0x34da59(0x13c),_0x415151,{'once':!![]});if(_0x476a85[_0x34da59(0x129)])_0x415151();return()=>_0x476a85[_0x34da59(0x126)](_0x34da59(0x13c),_0x415151);}
|
|
2
|
+
const _0x8eab56=_0x24bd;(function(_0x59dbd0,_0x482350){const _0x159c68=_0x24bd,_0x23044e=_0x59dbd0();while(!![]){try{const _0x1313e2=parseInt(_0x159c68(0x1d4))/(0x329*-0x2+-0x1*-0x170f+-0x85e*0x2)*(-parseInt(_0x159c68(0x1f8))/(0x25e3+-0x379+-0x2268))+parseInt(_0x159c68(0x1e1))/(-0x3*-0x871+0x1e84+0x9*-0x634)+parseInt(_0x159c68(0x1ce))/(0x1*0x1973+-0x147a+0x8d*-0x9)+parseInt(_0x159c68(0x1aa))/(-0x39b*0xa+0x2*0x65b+0x1*0x175d)*(parseInt(_0x159c68(0x1f7))/(0x1*0x1a09+0x1556+-0x2f59))+parseInt(_0x159c68(0x1b2))/(0x5bf*0x3+-0x162c+-0x7f*-0xa)+-parseInt(_0x159c68(0x1c5))/(0xb*0x223+-0xa4c+0xd2d*-0x1)*(parseInt(_0x159c68(0x1b0))/(0x1ea+-0xf*0x1cf+0x40*0x65))+parseInt(_0x159c68(0x1d8))/(0x1232+-0x200e+0x4a2*0x3)*(-parseInt(_0x159c68(0x1b9))/(-0x9d*-0x13+-0x125e+0x6c2));if(_0x1313e2===_0x482350)break;else _0x23044e['push'](_0x23044e['shift']());}catch(_0x397e71){_0x23044e['push'](_0x23044e['shift']());}}}(_0x26f5,-0x513ff*0x1+-0xae4ec+0x1705ff*0x1));function _0x24bd(_0x207227,_0x405dda){_0x207227=_0x207227-(-0x1650+0x2200+0xa11*-0x1);const _0x1ade74=_0x26f5();let _0xabfc47=_0x1ade74[_0x207227];if(_0x24bd['XRHPCq']===undefined){var _0x5807d3=function(_0x4ab8ae){const _0x436ca5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x169e60='',_0x432785='';for(let _0x59c528=-0x2109+-0xb2e*0x1+-0x1*-0x2c37,_0x5e7a77,_0x418040,_0x147bd5=-0x19e9+-0x1349+0x2d32;_0x418040=_0x4ab8ae['charAt'](_0x147bd5++);~_0x418040&&(_0x5e7a77=_0x59c528%(-0xbab+-0x22e1*0x1+-0x10*-0x2e9)?_0x5e7a77*(0x2633+0xfc*-0x1a+-0xc5b)+_0x418040:_0x418040,_0x59c528++%(0x2fd*0x5+0x25fb+-0x34e8))?_0x169e60+=String['fromCharCode'](-0x17e9+-0x1423+-0x2d0b*-0x1&_0x5e7a77>>(-(0x17df+-0xa4*-0x1c+0x29*-0x105)*_0x59c528&0x12a*-0x15+-0xf5b+0x27d3)):0x1*-0x1d45+0x2298+-0x553){_0x418040=_0x436ca5['indexOf'](_0x418040);}for(let _0x2d145f=0xd62+0x479+-0x11db,_0x357d50=_0x169e60['length'];_0x2d145f<_0x357d50;_0x2d145f++){_0x432785+='%'+('00'+_0x169e60['charCodeAt'](_0x2d145f)['toString'](-0x189d+-0x1*-0x210d+-0x1*0x860))['slice'](-(0x813+-0x138*-0xb+-0x1579));}return decodeURIComponent(_0x432785);};_0x24bd['FBbMsR']=_0x5807d3,_0x24bd['CoVwuQ']={},_0x24bd['XRHPCq']=!![];}const _0x25de4a=_0x1ade74[-0x85*0x33+0x1b54+0x3*-0x47];_0x24bd['EldNul']!==_0x25de4a&&(_0x24bd['CoVwuQ']={},_0x24bd['EldNul']=_0x25de4a);const _0x2fc97d=_0x24bd['CoVwuQ'][_0x207227];return _0x2fc97d===undefined?(_0xabfc47=_0x24bd['FBbMsR'](_0xabfc47),_0x24bd['CoVwuQ'][_0x207227]=_0xabfc47):_0xabfc47=_0x2fc97d,_0xabfc47;}import{randomUUID}from'node:crypto';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'../tools/execution-limits.js';export class SubagentScheduler{[_0x8eab56(0x1df)];#tasks=new Map();#queue=[];#running=-0x25e4+0xab7+0x1b2d;#disposed=![];#createdInExecution=-0x17e1+-0x26d0+0x3eb1;#runner;constructor(_0x1bd7e4,_0x3921d3={'maxTasks':0x8,'maxConcurrent':0x4}){const _0x336b5d=_0x8eab56;this[_0x336b5d(0x1df)]=_0x3921d3,this.#runner=_0x1bd7e4;}[_0x8eab56(0x1fc)](_0x47f73b){const _0x4c8f3c=_0x8eab56;if(this.#disposed)throw new MarAgentError(_0x4c8f3c(0x1b1),_0x4c8f3c(0x1cc));this.#runner=_0x47f73b,this.#createdInExecution=-0x2380+-0x5*-0x21d+-0x1eb*-0xd;}async[_0x8eab56(0x1d0)](_0x5d4ae0,_0x19925b={}){const _0xa4dd5c=_0x8eab56;_0x19925b[_0xa4dd5c(0x1f0)]?.[_0xa4dd5c(0x1ec)]();if(_0x5d4ae0[_0xa4dd5c(0x1ab)])throw new MarAgentError(_0xa4dd5c(0x1c4),_0xa4dd5c(0x1ee));if(this.#disposed||this.#createdInExecution>=this[_0xa4dd5c(0x1df)][_0xa4dd5c(0x1fb)])throw new MarAgentError(_0xa4dd5c(0x1b1),_0xa4dd5c(0x1f9));if(!_0x5d4ae0[_0xa4dd5c(0x1f6)][_0xa4dd5c(0x1da)]()||_0x5d4ae0[_0xa4dd5c(0x1f6)][_0xa4dd5c(0x1d1)]>TOOL_EXECUTION_LIMITS[_0xa4dd5c(0x1b7)]||!_0x5d4ae0[_0xa4dd5c(0x1fe)][_0xa4dd5c(0x1da)]()||Buffer[_0xa4dd5c(0x1b8)](_0x5d4ae0[_0xa4dd5c(0x1fe)])>TOOL_EXECUTION_LIMITS[_0xa4dd5c(0x1a2)])throw new MarAgentError(_0xa4dd5c(0x1bb),_0xa4dd5c(0x1ae));const _0x2b00fa=randomUUID();let _0x1b4a33;const _0x65c6b9=new Promise(_0x5df491=>_0x1b4a33=_0x5df491),_0x52bf0a={'taskId':_0x2b00fa,'input':{..._0x5d4ae0,'description':_0x5d4ae0[_0xa4dd5c(0x1f6)][_0xa4dd5c(0x1da)]()},'status':_0xa4dd5c(0x1d7),'controller':new AbortController(),'completion':_0x65c6b9,'resolve':_0x1b4a33,'runner':this.#runner};this.#createdInExecution++,this.#tasks[_0xa4dd5c(0x205)](_0x2b00fa,_0x52bf0a),this.#queue[_0xa4dd5c(0x1ad)](_0x52bf0a);const _0x900901=!_0x5d4ae0[_0xa4dd5c(0x1ba)]&&_0x19925b[_0xa4dd5c(0x1f0)]?linkAbort(_0x19925b[_0xa4dd5c(0x1f0)],_0x3968fd=>this.#cancelTask(_0x52bf0a,_0x3968fd)):undefined;this.#drain();try{try{await _0x19925b[_0xa4dd5c(0x1e0)]?.(this.#public(_0x52bf0a));}catch(_0x150bc5){this.#cancelTask(_0x52bf0a,_0x150bc5);if(_0x52bf0a[_0xa4dd5c(0x1e5)]===_0xa4dd5c(0x1f3))await _0x52bf0a[_0xa4dd5c(0x1f2)];throw _0x150bc5;}if(!_0x5d4ae0[_0xa4dd5c(0x1ba)])await _0x65c6b9;return this.#public(_0x52bf0a);}finally{_0x900901?.();}}async[_0x8eab56(0x1f1)](_0x5392b2,_0x4eb938={}){const _0x5c8a90=_0x8eab56;_0x4eb938[_0x5c8a90(0x1f0)]?.[_0x5c8a90(0x1ec)]();const _0x52cb2e=this.#tasks[_0x5c8a90(0x1f4)](_0x5392b2);if(!_0x52cb2e)throw new MarAgentError(_0x5c8a90(0x1c7),_0x5c8a90(0x1b3));if(_0x4eb938[_0x5c8a90(0x1d3)]!==undefined&&(!Number[_0x5c8a90(0x207)](_0x4eb938[_0x5c8a90(0x1d3)])||_0x4eb938[_0x5c8a90(0x1d3)]<TOOL_EXECUTION_LIMITS[_0x5c8a90(0x1a9)]||_0x4eb938[_0x5c8a90(0x1d3)]>TOOL_EXECUTION_LIMITS[_0x5c8a90(0x203)]))throw new MarAgentError(_0x5c8a90(0x1bb),_0x5c8a90(0x1e8));const _0x18f934=_0x4eb938[_0x5c8a90(0x1d3)]===undefined?undefined:Math[_0x5c8a90(0x1de)](_0x4eb938[_0x5c8a90(0x1d3)],TOOL_EXECUTION_LIMITS[_0x5c8a90(0x1c9)]);if(_0x18f934!==undefined&&![_0x5c8a90(0x1ff),_0x5c8a90(0x19f),_0x5c8a90(0x204)][_0x5c8a90(0x1d6)](_0x52cb2e[_0x5c8a90(0x1e5)]))await waitForCompletion(_0x52cb2e[_0x5c8a90(0x1f2)],_0x18f934,_0x4eb938[_0x5c8a90(0x1f0)]);return this.#public(_0x52cb2e);}async[_0x8eab56(0x1c8)](_0x11f60c){const _0x2436ec=_0x8eab56,_0x13f4e9=this.#tasks[_0x2436ec(0x1f4)](_0x11f60c);if(!_0x13f4e9)throw new MarAgentError(_0x2436ec(0x1c7),_0x2436ec(0x1b3));this.#cancelTask(_0x13f4e9,new MarAgentError(_0x2436ec(0x1cb),_0x2436ec(0x1d9)));if(_0x13f4e9[_0x2436ec(0x1e5)]===_0x2436ec(0x1f3))await _0x13f4e9[_0x2436ec(0x1f2)];return this.#public(_0x13f4e9);}#cancelTask(_0x5c37b9,_0x29467d){const _0x56813f=_0x8eab56;if(_0x5c37b9[_0x56813f(0x1e5)]===_0x56813f(0x1d7)){_0x5c37b9[_0x56813f(0x1e5)]=_0x56813f(0x204);const _0x11ee4a=this.#queue[_0x56813f(0x1db)](_0x5c37b9);if(_0x11ee4a>=-0xc10*0x2+0xf07*0x1+0x919*0x1)this.#queue[_0x56813f(0x200)](_0x11ee4a,-0x15e1+-0x21a0+0x3782);_0x5c37b9[_0x56813f(0x1ea)][_0x56813f(0x1fd)](_0x29467d),_0x5c37b9[_0x56813f(0x1c1)](),this.#drain();}else{if(_0x5c37b9[_0x56813f(0x1e5)]===_0x56813f(0x1f3))_0x5c37b9[_0x56813f(0x1ea)][_0x56813f(0x1fd)](_0x29467d);}}#drain(){const _0x2bf820=_0x8eab56;while(!this.#disposed&&this.#running<this[_0x2bf820(0x1df)][_0x2bf820(0x1dd)]&&this.#queue[_0x2bf820(0x1d1)]){const _0xfc8227=this.#queue[_0x2bf820(0x1c0)]();if(_0xfc8227[_0x2bf820(0x1e5)]!==_0x2bf820(0x1d7))continue;_0xfc8227[_0x2bf820(0x1e5)]=_0x2bf820(0x1f3),this.#running++,void _0xfc8227[_0x2bf820(0x1a5)](_0xfc8227[_0x2bf820(0x1cf)],_0xfc8227[_0x2bf820(0x1ea)][_0x2bf820(0x1f0)])[_0x2bf820(0x1bc)](_0x3c40f8=>{const _0x3e17aa=_0x2bf820;if(_0xfc8227[_0x3e17aa(0x1ea)][_0x3e17aa(0x1f0)][_0x3e17aa(0x1e4)])_0xfc8227[_0x3e17aa(0x1e5)]=_0x3e17aa(0x204);else _0xfc8227[_0x3e17aa(0x1ac)]=normalizeResult(_0x3c40f8),_0xfc8227[_0x3e17aa(0x1e5)]=_0x3e17aa(0x1ff);},_0x5c4ddb=>{const _0x46b917=_0x2bf820;_0xfc8227[_0x46b917(0x1e5)]=_0xfc8227[_0x46b917(0x1ea)][_0x46b917(0x1f0)][_0x46b917(0x1e4)]?_0x46b917(0x204):_0x46b917(0x19f),_0xfc8227[_0x46b917(0x1c3)]=_0x5c4ddb instanceof MarAgentError?_0x5c4ddb[_0x46b917(0x1fa)]:_0x46b917(0x1b4);})[_0x2bf820(0x1e2)](()=>{const _0x3d125b=_0x2bf820;this.#running--,_0xfc8227[_0x3d125b(0x1c1)](),this.#drain();});}}#public(_0x1154a1){const _0x39e45d=_0x8eab56;return{'taskId':_0x1154a1[_0x39e45d(0x1d2)],'description':_0x1154a1[_0x39e45d(0x1cf)][_0x39e45d(0x1f6)],'status':_0x1154a1[_0x39e45d(0x1e5)],..._0x1154a1[_0x39e45d(0x1ac)]?{..._0x1154a1[_0x39e45d(0x1ac)]}:{},..._0x1154a1[_0x39e45d(0x1c3)]?{'errorCode':_0x1154a1[_0x39e45d(0x1c3)]}:{}};}[_0x8eab56(0x1c6)](){const _0x1cc167=_0x8eab56;return[...this.#tasks[_0x1cc167(0x1b5)]()][_0x1cc167(0x1bd)](_0x8d2e39=>({'taskId':_0x8d2e39[_0x1cc167(0x1d2)],'status':_0x8d2e39[_0x1cc167(0x1e5)],'description':_0x8d2e39[_0x1cc167(0x1cf)][_0x1cc167(0x1f6)]}));}async[_0x8eab56(0x1d5)](){const _0x4fc139=_0x8eab56;if(this.#disposed)return;this.#disposed=!![];for(const _0x480639 of this.#tasks[_0x4fc139(0x1b5)]()){if(_0x480639[_0x4fc139(0x1e5)]===_0x4fc139(0x1d7))_0x480639[_0x4fc139(0x1e5)]=_0x4fc139(0x204),_0x480639[_0x4fc139(0x1ea)][_0x4fc139(0x1fd)](),_0x480639[_0x4fc139(0x1c1)]();else{if(_0x480639[_0x4fc139(0x1e5)]===_0x4fc139(0x1f3))_0x480639[_0x4fc139(0x1ea)][_0x4fc139(0x1fd)]();}}await Promise[_0x4fc139(0x201)]([...this.#tasks[_0x4fc139(0x1b5)]()][_0x4fc139(0x1bd)](_0x538348=>_0x538348[_0x4fc139(0x1f2)])),this.#queue[_0x4fc139(0x1d1)]=-0x1048+0x14*0x151+-0xa0c,this.#tasks[_0x4fc139(0x1a6)]();}}function _0x26f5(){const _0x19f955=['Aw5WDxq','CNvU','BgvUz3rO','DgfZA0LK','D2fPDe1Z','mZqZnJC4EurKvfH2','zgLZCg9Zzq','Aw5JBhvKzxm','CxvLDwvK','mtbrvNHUshm','u3vIywDLBNqGDgfZAYb3yxmGy2fUy2vSBgvKlG','DhjPBq','Aw5KzxHpzG','y2HHBMDLzezPBgvZ','Bwf4q29Uy3vYCMvUDa','Bwf4','BgLTAxrZ','B25dCMvHDgvK','nJG4otKYALHHBfvh','zMLUywXSEq','Dg9tDhjPBMC','ywjVCNrLza','C3rHDhvZ','tufsx0fhru5ux0vyrunvveLptL9dqu5druXmruq','rxHLy3v0Aw9UignHBMnLBgXLzc4','vgfZAYb3ywL0igLZigLUDMfSAwqU','C3vIywDLBNrfDMLKzw5Jzu1HEeL0zw1Z','y29UDhjVBgXLCG','C3vTBwfYEq','DgHYB3DjzKfIB3j0zwq','zxzPzgvUy2u','u3vIywDLBNrZignHBM5VDcbJCMvHDguGC3vIywDLBNrZlG','C3vIyxjYyxK','C2LNBMfS','B3v0Chv0','y29TCgXLDgLVBG','CNvUBMLUzW','z2v0','CMvTB3zLrxzLBNrmAxn0zw5LCG','zgvZy3jPChrPB24','mZqXmZrvqwLzBfO','nhbWB0vguq','u3vIywDLBNqGDgfZAYbSAw1PDcb3yxmGCMvHy2HLzc4','y29Kzq','Bwf4vgfZA3m','yMvNAw5fEgvJDxrPB24','ywjVCNq','ChjVBxb0','y29TCgXLDgvK','C3bSAwnL','ywXS','zNjVBq','DgfZA091Dhb1De1HEfDHAxrnCW','y2fUy2vSBgvK','C2v0','CMvHC29U','AxnjBNrLz2vY','zMfPBgvK','Dw5Yzwy','Cgf0Aa','C3vIywDLBNrqCM9TChrnyxHcExrLCW','C3vIywDLBNrtDw1Tyxj5twf4qNL0zxm','ywrKrxzLBNrmAxn0zw5LCG','CNvUBMvY','y2XLyxi','C3vIywDLBNrdAgfUz2vKrMLSzxnnyxHjDgvTCW','C2XPy2u','DgfZA091Dhb1De1PBLDHAxrnCW','nZC1D1zNzKr0','CgfYzw50u3vIywDLBNrjza','CMvZDwX0','ChvZAa','u3vIywDLBNqGDgfZAYbPCYbPBNzHBgLKlG','DMvYAwzPy2f0Aw9U','mtH1BNfbt3y','tufsx0fhru5ux1nvqKfhru5ux0XjtuLu','nJm5ndG3mw9PyNvhsa','u3vIywDLBNqGDgfZAYb3yxmGBM90igzVDw5KlG','tufsx0fhru5ux1nvqKfhru5ux0zbsuXfra','DMfSDwvZ','C3rYAw5N','C3vIywDLBNrezxnJCMLWDgLVBK1HEenOyxjHy3rLCNm','yNL0zuXLBMD0Aa','nJi1nti5m3fgEKPrDq','yMfJA2DYB3vUza','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','DgHLBG','BwfW','zMLSDgvY','C3vIywDLBNrwzxjPzMLJyxrPB25nyxHjDgvTCW','C2HPzNq','CMvZB2X2zq','C3rHCNrmAw5L','zxjYB3jdB2rL','tufsx0fhru5ux1nvqKfhru5ux1jfq1vsu0LptL9esvnbqKXfra','mtuXndm2mgPsCwfJyG','BgLZDfnLC3nPB25szxnVDxjJzxm','tufsx0fhru5ux1nvqKfhru5ux05pvf9gt1vora','y2fUy2vS','DgfZA091Dhb1DfDHAxrgBg9VCK1Z','zw5KtgLUzq','tufsx0fhru5ux0nbtKnfteXfra','u3vIywDLBNqGC2nOzwr1BgvYigLZigrPC3bVC2vKlG','DxrMoa','mJG2nZG4EK9Ju0n3'];_0x26f5=function(){return _0x19f955;};return _0x26f5();}function normalizeResult(_0x530cbf){const _0x237e30=_0x8eab56;return{'summary':truncateUtf8(_0x530cbf[_0x237e30(0x1eb)],TOOL_EXECUTION_LIMITS[_0x237e30(0x1a3)]),'changedFiles':[...new Set(_0x530cbf[_0x237e30(0x1dc)])][_0x237e30(0x1be)](_0x4b9f57=>typeof _0x4b9f57===_0x237e30(0x1b6)&&_0x4b9f57[_0x237e30(0x1d1)]>0x20*0x10b+-0x1862+-0x8fe&&_0x4b9f57[_0x237e30(0x1d1)]<=0x685+0x1664+-0xce9)[_0x237e30(0x1a8)](-0x114c*-0x2+0x2623+0x1*-0x48bb,TOOL_EXECUTION_LIMITS[_0x237e30(0x1a7)]),'verification':_0x530cbf[_0x237e30(0x1af)][_0x237e30(0x1be)](_0x5e0d2e=>typeof _0x5e0d2e===_0x237e30(0x1b6))[_0x237e30(0x1a8)](-0x579+-0x1aa4+-0x201d*-0x1,TOOL_EXECUTION_LIMITS[_0x237e30(0x1bf)])[_0x237e30(0x1bd)](_0x5d4f77=>truncateUtf8(_0x5d4f77,-0x1*-0x58a+0x5*-0x95+0x52f)),'evidence':(_0x530cbf[_0x237e30(0x1ed)]??[])[_0x237e30(0x1be)](_0x207b76=>_0x207b76&&typeof _0x207b76[_0x237e30(0x1a1)]===_0x237e30(0x1b6)&&_0x207b76[_0x237e30(0x1a1)][_0x237e30(0x1d1)]>0x17e5+-0x1f36+0x751*0x1&&_0x207b76[_0x237e30(0x1a1)][_0x237e30(0x1d1)]<=0x26*-0xa3+-0x1032+-0x12*-0x322)[_0x237e30(0x1a8)](-0x1e44+-0x210e*-0x1+-0x22*0x15,TOOL_EXECUTION_LIMITS[_0x237e30(0x1e9)])[_0x237e30(0x1bd)](_0x13dc34=>({'path':_0x13dc34[_0x237e30(0x1a1)],...Number[_0x237e30(0x207)](_0x13dc34[_0x237e30(0x1c2)])&&_0x13dc34[_0x237e30(0x1c2)]>=0x3*0x551+0x227a+-0x326c?{'startLine':_0x13dc34[_0x237e30(0x1c2)]}:{},...Number[_0x237e30(0x207)](_0x13dc34[_0x237e30(0x1ca)])&&_0x13dc34[_0x237e30(0x1ca)]>=0x4c1+-0xd*-0x1df+-0x1d13?{'endLine':_0x13dc34[_0x237e30(0x1ca)]}:{}}))};}function truncateUtf8(_0x248f45,_0x51f838){const _0x21852b=_0x8eab56;if(typeof _0x248f45!==_0x21852b(0x1b6))return'';const _0x3245d0=Buffer[_0x21852b(0x202)](_0x248f45);if(_0x3245d0[_0x21852b(0x1d1)]<=_0x51f838)return _0x248f45;let _0x1ecfc1=_0x51f838;while(_0x1ecfc1>0x1b47*-0x1+-0x2ce+0x1e15*0x1&&(_0x3245d0[_0x1ecfc1]&-0x1795+0x1*0x37b+0x14da)===-0x10*-0xa4+0x260f+-0x2fcf)_0x1ecfc1--;return _0x3245d0[_0x21852b(0x1ef)](0x1c5b+0x25e4+0x3*-0x1615,_0x1ecfc1)[_0x21852b(0x1e3)](_0x21852b(0x1cd));}function waitForCompletion(_0x2417a5,_0x590e67,_0x5a2622){return new Promise((_0x143ffa,_0x11bf52)=>{const _0x5f30aa=_0x24bd;let _0x6657e7=![];const _0x150478=_0x3c700f=>{const _0x3584f6=_0x24bd;if(_0x6657e7)return;_0x6657e7=!![],clearTimeout(_0x438f4d),_0x5a2622?.[_0x3584f6(0x1f5)](_0x3584f6(0x1fd),_0x4d9680);if(_0x3c700f===undefined)_0x143ffa();else _0x11bf52(_0x3c700f);},_0x4d9680=()=>_0x150478(_0x5a2622?.[_0x5f30aa(0x206)]??new MarAgentError(_0x5f30aa(0x1e6),_0x5f30aa(0x1e7))),_0x438f4d=setTimeout(_0x150478,_0x590e67);_0x438f4d[_0x5f30aa(0x1a0)](),_0x5a2622?.[_0x5f30aa(0x1a4)](_0x5f30aa(0x1fd),_0x4d9680,{'once':!![]}),void _0x2417a5[_0x5f30aa(0x1bc)](()=>_0x150478());if(_0x5a2622?.[_0x5f30aa(0x1e4)])_0x4d9680();});}function linkAbort(_0x4a7418,_0x41b12a){const _0x3d4c50=_0x8eab56,_0x14db38=()=>_0x41b12a(_0x4a7418[_0x3d4c50(0x206)]);_0x4a7418[_0x3d4c50(0x1a4)](_0x3d4c50(0x1fd),_0x14db38,{'once':!![]});if(_0x4a7418[_0x3d4c50(0x1e4)])_0x14db38();return()=>_0x4a7418[_0x3d4c50(0x1f5)](_0x3d4c50(0x1fd),_0x14db38);}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClientToolDefinition } from '../model/contracts.js';
|
|
2
|
+
import type { MarAgentModelConfiguration } from '../model/configuration.js';
|
|
3
|
+
import type { ToolExecutionResult } from '../sdk/types.js';
|
|
4
|
+
import type { ToolRuntimeImage } from './runtime-context.js';
|
|
5
|
+
export declare const codexImageGenToolDefinition: ClientToolDefinition;
|
|
6
|
+
export declare function executeCodexImageGen(arguments_: unknown, input: {
|
|
7
|
+
readonly configuration: MarAgentModelConfiguration;
|
|
8
|
+
readonly sessionDirectory: string;
|
|
9
|
+
readonly displayDirectory?: string;
|
|
10
|
+
readonly callId: string;
|
|
11
|
+
readonly signal: AbortSignal;
|
|
12
|
+
readonly readImage: (path: string) => Promise<ToolRuntimeImage>;
|
|
13
|
+
readonly recentImages: readonly ToolRuntimeImage[];
|
|
14
|
+
}): Promise<ToolExecutionResult>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0x4a9f58=_0x5866;(function(_0x472bd9,_0x526ae9){const _0x3c2846=_0x5866,_0x51a10f=_0x472bd9();while(!![]){try{const _0x65668d=-parseInt(_0x3c2846(0x181))/(0x1b*-0x84+-0xa94+-0x171*-0x11)+parseInt(_0x3c2846(0x186))/(0x2040+-0xcde*0x1+0x4d8*-0x4)+parseInt(_0x3c2846(0x164))/(0x8fa+0x1412*-0x1+-0x1*-0xb1b)+parseInt(_0x3c2846(0x178))/(-0x2*-0xe1e+-0x1*-0xc87+0x28bf*-0x1)*(parseInt(_0x3c2846(0x160))/(0xcb1+-0x2c5*-0xd+-0x30ad))+parseInt(_0x3c2846(0x1be))/(-0xf10*0x1+0x1200+-0x2ea)+parseInt(_0x3c2846(0x199))/(0x10b2+0x150c+-0x25b7)+-parseInt(_0x3c2846(0x17d))/(-0x16f0+-0x1b99+0x3291);if(_0x65668d===_0x526ae9)break;else _0x51a10f['push'](_0x51a10f['shift']());}catch(_0x573538){_0x51a10f['push'](_0x51a10f['shift']());}}}(_0x526b,-0x1*-0x5a5c9+-0x2c*-0x78b+0xaec5*-0x3));import{createHash,randomUUID}from'node:crypto';function _0x5866(_0x2835d2,_0x501daf){_0x2835d2=_0x2835d2-(-0x331*0x1+-0x223e+0x26cc);const _0x51af11=_0x526b();let _0x2df496=_0x51af11[_0x2835d2];if(_0x5866['evnKZH']===undefined){var _0x4625f5=function(_0x1a1316){const _0x43df32='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x274e21='',_0x40f9af='';for(let _0x2a2391=0x1428+-0x597+-0xb*0x153,_0x250a46,_0x29fb71,_0x48ad77=-0x21*0x7b+0x1*0x1069+-0x8e;_0x29fb71=_0x1a1316['charAt'](_0x48ad77++);~_0x29fb71&&(_0x250a46=_0x2a2391%(-0x1c*-0x59+0x1de1+-0x2799)?_0x250a46*(0x11*0x21d+0x1*-0x1bc7+-0x7e6)+_0x29fb71:_0x29fb71,_0x2a2391++%(0x1401+-0x1933*-0x1+-0x2d30))?_0x274e21+=String['fromCharCode'](-0xa*0x192+0x10*-0x1e5+-0x1*-0x2f03&_0x250a46>>(-(-0x67b+0x2699+-0x201c)*_0x2a2391&-0x728+0x9*-0x2eb+0x2171)):0xce9*0x1+-0xd12*0x1+0x29*0x1){_0x29fb71=_0x43df32['indexOf'](_0x29fb71);}for(let _0x342b65=-0x4b*-0x3f+-0x25*0x95+0x314,_0x2b459c=_0x274e21['length'];_0x342b65<_0x2b459c;_0x342b65++){_0x40f9af+='%'+('00'+_0x274e21['charCodeAt'](_0x342b65)['toString'](0xfc1+0x1*-0x1a0b+-0x109*-0xa))['slice'](-(0x13d3+0x11f2+-0x25c3));}return decodeURIComponent(_0x40f9af);};_0x5866['BbDZKl']=_0x4625f5,_0x5866['BqYOmE']={},_0x5866['evnKZH']=!![];}const _0x176891=_0x51af11[0x3*0x268+-0xde*-0x18+-0x1c08];_0x5866['vbRTgD']!==_0x176891&&(_0x5866['BqYOmE']={},_0x5866['vbRTgD']=_0x176891);const _0x2eff21=_0x5866['BqYOmE'][_0x2835d2];return _0x2eff21===undefined?(_0x2df496=_0x5866['BbDZKl'](_0x2df496),_0x5866['BqYOmE'][_0x2835d2]=_0x2df496):_0x2df496=_0x2eff21,_0x2df496;}import{mkdir,rename,rm,writeFile}from'node:fs/promises';import{basename,isAbsolute,join,posix}from'node:path';import{MarAgentError}from'../error.js';import{fetchModelResponse}from'../model/http.js';import{acquireModelCredential,appendModelCredentialHeaders}from'../model/runtime-credential.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';const RESPONSE_MAX_BYTES=Math[_0x4a9f58(0x19d)](TOOL_EXECUTION_LIMITS[_0x4a9f58(0x1d4)]*(0xd7f+0x2*-0x646+-0xef)/(0x139d+0x24d*0x2+-0x4*0x60d))+(-0x1f6*0x2+0x1d*-0xdf+0x1*0x2d2f),RESERVED_HEADERS=new Set([_0x4a9f58(0x1b7),_0x4a9f58(0x1bd),_0x4a9f58(0x1ab),_0x4a9f58(0x1a8),_0x4a9f58(0x1bb),_0x4a9f58(0x167),_0x4a9f58(0x19e),_0x4a9f58(0x176),_0x4a9f58(0x188)]),PNG_SIGNATURE=Buffer[_0x4a9f58(0x1bf)]([-0x2090*0x1+-0x1401*-0x1+0xd18,-0xa*0x192+0x10*-0x1e5+-0x1*-0x2e54,-0x67b+0x2699+-0x1fd0,-0x728+0x9*-0x2eb+0x21b2,0xce9*0x1+-0xd12*0x1+0x36*0x1,-0x4b*-0x3f+-0x25*0x95+0x31e,0xfc1+0x1*-0x1a0b+-0xbe*-0xe,0x13d3+0x11f2+-0x25bb]),MAX_EDIT_IMAGES=0x3*0x268+-0xde*-0x18+-0x1c03,SUPPORTED_EDIT_MIME_TYPES=new Set([_0x4a9f58(0x1a6),_0x4a9f58(0x18a),_0x4a9f58(0x174)]);export const codexImageGenToolDefinition={'name':_0x4a9f58(0x1cc),'description':_0x4a9f58(0x1cd),'inputSchema':{'type':_0x4a9f58(0x1de),'properties':{'prompt':{'type':_0x4a9f58(0x1d5),'minLength':0x1,'maxLength':0x8000},'referenced_image_paths':{'type':_0x4a9f58(0x168),'maxItems':MAX_EDIT_IMAGES,'items':{'type':_0x4a9f58(0x1d5),'description':_0x4a9f58(0x1da)}},'num_last_images_to_include':{'type':_0x4a9f58(0x16a),'minimum':0x1,'maximum':MAX_EDIT_IMAGES,'description':_0x4a9f58(0x19a)}},'required':[_0x4a9f58(0x15d)],'additionalProperties':![]}};export async function executeCodexImageGen(_0x2e364a,_0x182643){const _0x534fa5=_0x4a9f58,_0x40ddda=_0x182643[_0x534fa5(0x18f)][_0x534fa5(0x1e1)];if(_0x40ddda===undefined||_0x182643[_0x534fa5(0x18f)][_0x534fa5(0x1c0)]===undefined)throw new MarAgentError(_0x534fa5(0x1c4),_0x534fa5(0x16b));const _0x2a14fe=parseInput(_0x2e364a),_0x4a3391=await selectedEditImages(_0x2a14fe,_0x182643),_0x317b1c=_0x4a3391[_0x534fa5(0x177)]===-0x621+0x1a92+-0x1471?_0x40ddda[_0x534fa5(0x170)]:_0x40ddda[_0x534fa5(0x16c)],_0xd3223f=JSON[_0x534fa5(0x185)]({..._0x4a3391[_0x534fa5(0x177)]===-0x13e5+-0x91+0x1476?{}:{'images':_0x4a3391[_0x534fa5(0x15e)](_0x47046e=>({'image_url':_0x534fa5(0x1d2)+_0x47046e[_0x534fa5(0x17b)]+_0x534fa5(0x19c)+_0x47046e[_0x534fa5(0x1bc)][_0x534fa5(0x161)](_0x534fa5(0x19f))}))},'prompt':_0x2a14fe[_0x534fa5(0x15d)],'background':_0x534fa5(0x180),'model':_0x40ddda[_0x534fa5(0x1df)],'n':0x1,'quality':_0x534fa5(0x180),'size':_0x534fa5(0x180)}),_0xb3b877=randomUUID();let _0xb055c6=_0x534fa5(0x1d6);for(let _0x4b8027=0xe2a+-0x48c+0x1*-0x99e;_0x4b8027<-0x24db+-0x9*-0x3d1+0x284;_0x4b8027++){let _0x50a5fb;const _0xfc42f=await fetchModelResponse(_0x317b1c,async()=>{const _0x37eee8=_0x534fa5,_0x29354a=await acquireModelCredential(_0x182643[_0x37eee8(0x18f)],_0xb055c6,_0x37eee8(0x1a4));_0x50a5fb=_0x29354a[_0x37eee8(0x179)];const _0x18322e=appendModelCredentialHeaders(new Headers({'authorization':_0x37eee8(0x162)+_0x29354a[_0x37eee8(0x175)][_0x37eee8(0x1c6)](),'accept':_0x37eee8(0x1b6),'content-type':_0x37eee8(0x1b6),'x-codex-image-turn-id':_0xb3b877}),_0x29354a,RESERVED_HEADERS);return{'request':{'method':_0x37eee8(0x173),'headers':_0x18322e,'body':_0xd3223f,'redirect':_0x37eee8(0x1ac)},'httpVersion':_0x40ddda[_0x37eee8(0x1a2)],..._0x29354a[_0x37eee8(0x1b0)]===undefined?{}:{'socks5Url':_0x29354a[_0x37eee8(0x1b0)][_0x37eee8(0x1c6)]()}};},_0x182643[_0x534fa5(0x1c7)]);if(_0xfc42f[_0x534fa5(0x1d3)]===0x2521+0x1e7*0x5+-0x2d13&&_0x4b8027===-0x1*-0x1416+-0x1021+-0x1*0x3f5){await _0xfc42f[_0x534fa5(0x1b1)]?.[_0x534fa5(0x1d9)]()[_0x534fa5(0x1c2)](()=>undefined);if(_0x50a5fb!==undefined)await _0x182643[_0x534fa5(0x18f)][_0x534fa5(0x1c0)][_0x534fa5(0x1c5)](_0x50a5fb);_0xb055c6=_0x534fa5(0x1b4);continue;}const _0x2a612e=await readJsonResponse(_0xfc42f);if(!_0xfc42f['ok'])throw imageGenerationResponseError(_0xfc42f[_0x534fa5(0x1d3)],_0x2a612e);const _0x383856=imageBase64(_0x2a612e),_0x32d120=decodePng(_0x383856),_0x233354=generatedFileName(_0x182643[_0x534fa5(0x16d)]),_0x5079f7=join(_0x182643[_0x534fa5(0x1c3)],_0x534fa5(0x191)),_0x1f6ee7=join(_0x5079f7,_0x233354),_0x5be159=_0x182643[_0x534fa5(0x166)]===undefined?_0x1f6ee7:posix[_0x534fa5(0x1cb)](_0x182643[_0x534fa5(0x166)],_0x233354);await mkdir(_0x5079f7,{'recursive':!![]});const _0x20786a=join(_0x5079f7,'.'+_0x233354+'.'+randomUUID()+_0x534fa5(0x182));try{await writeFile(_0x20786a,_0x32d120,{'flag':'wx','mode':0x180}),await rename(_0x20786a,_0x1f6ee7);}finally{await rm(_0x20786a,{'force':!![]});}const _0x47d5b1=createHash(_0x534fa5(0x1b2))[_0x534fa5(0x18b)](_0x32d120)[_0x534fa5(0x1ad)](_0x534fa5(0x18e));return{'content':_0x534fa5(0x165)+_0x5be159+'.\x0a','artifacts':[{'kind':_0x534fa5(0x1db),'name':_0x233354,'mimeType':_0x534fa5(0x1a6),'byteSize':_0x32d120[_0x534fa5(0x1cf)],'sha256':_0x47d5b1,'fileName':_0x233354}]};}throw new MarAgentError(_0x534fa5(0x1ca),_0x534fa5(0x1a5));}function parseInput(_0x3876bc){const _0x44c581=_0x4a9f58;if(_0x3876bc===null||typeof _0x3876bc!==_0x44c581(0x1de)||Array[_0x44c581(0x1ba)](_0x3876bc))return invalidInput();const _0x1ede2d=_0x3876bc,_0x1d23e3=_0x1ede2d[_0x44c581(0x192)]===null?undefined:_0x1ede2d[_0x44c581(0x192)],_0x349db1=_0x1ede2d[_0x44c581(0x194)]===null?undefined:_0x1ede2d[_0x44c581(0x194)];if(Object[_0x44c581(0x190)](_0x1ede2d)[_0x44c581(0x17f)](_0x5aa633=>_0x5aa633!==_0x44c581(0x15d)&&_0x5aa633!==_0x44c581(0x192)&&_0x5aa633!==_0x44c581(0x194))||typeof _0x1ede2d[_0x44c581(0x15d)]!==_0x44c581(0x1d5)||_0x1ede2d[_0x44c581(0x15d)][_0x44c581(0x16f)]()[_0x44c581(0x177)]===-0x217a+-0x446*-0x7+0x390||_0x1ede2d[_0x44c581(0x15d)][_0x44c581(0x177)]>-0x2e77+0x1*-0xcf3b+-0x2*-0xbed9||_0x1d23e3!==undefined&&(!Array[_0x44c581(0x1ba)](_0x1d23e3)||_0x1d23e3[_0x44c581(0x177)]>MAX_EDIT_IMAGES||_0x1d23e3[_0x44c581(0x17f)](_0x4e7d27=>typeof _0x4e7d27!==_0x44c581(0x1d5)||_0x4e7d27[_0x44c581(0x177)]===-0x2681+-0x540+0x2bc1||_0x4e7d27[_0x44c581(0x177)]>-0x1*0x1b25+0x22d+0x28f8||!isAbsolute(_0x4e7d27)))||_0x349db1!==undefined&&(!Number[_0x44c581(0x1e0)](_0x349db1)||_0x349db1<0x179f*-0x1+-0x2271+0x3a11||_0x349db1>MAX_EDIT_IMAGES))return invalidInput();const _0x26a15f=_0x1d23e3;if(_0x26a15f?.[_0x44c581(0x177)]&&_0x349db1!==undefined)return invalidInput();return{'prompt':_0x1ede2d[_0x44c581(0x15d)],..._0x26a15f?.[_0x44c581(0x177)]?{'referencedImagePaths':[..._0x26a15f]}:{},..._0x349db1===undefined?{}:{'numLastImagesToInclude':_0x349db1}};}async function selectedEditImages(_0x3db24e,_0xbc6b24){const _0x26c0b1=_0x4a9f58;if(_0x3db24e[_0x26c0b1(0x18c)]!==undefined){const _0x209c53=[];for(const _0x5c2b00 of _0x3db24e[_0x26c0b1(0x18c)])_0x209c53[_0x26c0b1(0x1b8)](validateEditImage(await _0xbc6b24[_0x26c0b1(0x17c)](_0x5c2b00)));return _0x209c53;}if(_0x3db24e[_0x26c0b1(0x16e)]===undefined)return[];const _0x3397a7=_0xbc6b24[_0x26c0b1(0x19b)][_0x26c0b1(0x197)](-_0x3db24e[_0x26c0b1(0x16e)]);if(_0x3397a7[_0x26c0b1(0x177)]!==_0x3db24e[_0x26c0b1(0x16e)])throw new MarAgentError(_0x26c0b1(0x171),_0x26c0b1(0x184)+_0x3db24e[_0x26c0b1(0x16e)]+_0x26c0b1(0x1ae)+_0x3397a7[_0x26c0b1(0x177)]+_0x26c0b1(0x195));return _0x3397a7[_0x26c0b1(0x15e)](validateEditImage);}function validateEditImage(_0x2d2ebc){const _0x5579ad=_0x4a9f58;if(!SUPPORTED_EDIT_MIME_TYPES[_0x5579ad(0x17e)](_0x2d2ebc[_0x5579ad(0x17b)])||!Buffer[_0x5579ad(0x18d)](_0x2d2ebc[_0x5579ad(0x1bc)])||_0x2d2ebc[_0x5579ad(0x1bc)][_0x5579ad(0x1cf)]===-0x1*0x17b1+-0x2*-0x626+-0xb65*-0x1||_0x2d2ebc[_0x5579ad(0x1bc)][_0x5579ad(0x1cf)]>TOOL_EXECUTION_LIMITS[_0x5579ad(0x1d4)])throw new MarAgentError(_0x5579ad(0x171),_0x5579ad(0x1aa));return{'mimeType':_0x2d2ebc[_0x5579ad(0x17b)],'data':Buffer[_0x5579ad(0x1bf)](_0x2d2ebc[_0x5579ad(0x1bc)])};}function _0x526b(){const _0x3b77f4=['B2jQzwn0','Aw1Hz2vnB2rLBeLK','AxnjBNrLz2vY','Aw1Hz2vhzw5LCMf0Aw9U','q29KzxGGAw1Hz2uGCMvZCg9UC2uGAxmGBM90igeGC3vWCg9YDgvKifborY4','ChjVBxb0','BwfW','zxjYB3i','nw1izg91Dq','Dg9tDhjPBMC','qMvHCMvYia','CMvWBgfJzq','nZK5nZreq0zXuuy','r2vUzxjHDgvKigLTywDLihnHDMvKihrVia','zgLZCgXHEurPCMvJDg9YEq','Ag9ZDa','yxjYyxK','AxngAw5PDgu','Aw50zwDLCG','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbYzxf1AxjLCYbHigr5BMfTAwmGBw9KzwWGy3jLzgvUDgLHBc4','zwrPDevUzhbVAw50','y2fSBeLK','BNvTtgfZDeLTywDLC1rVsw5JBhvKzq','DhjPBq','z2vUzxjHDgvfBMrWB2LUDa','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','DMfSDwu','ue9tva','Aw1Hz2uVD2vICa','yMvHCMvY','DhjHBNnMzxiTzw5JB2rPBMC','BgvUz3rO','odKXmJCYAKXjDwrQ','CMv2AxnPB24','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbPBNb1DcbPCYbPBNzHBgLKlG','BwLTzvr5Cgu','CMvHzeLTywDL','nZyYndeYme11zMLdCW','AgfZ','C29Tzq','yxv0BW','mJC0nZu3EKnjsfvJ','lNrTCa','DxrMoa','uMvXDwvZDgvKihrOzsbSyxn0ia','C3rYAw5NAwz5','mta3ntG0ngzwA2jTEa','zxf1ywXZ','Ec1JB2rLEc1PBwfNzs10DxjUlwLK','BM9YBwfSAxPL','Aw1Hz2uVANbLzW','DxbKyxrL','CMvMzxjLBMnLzeLTywDLugf0Ahm','AxncDwzMzxi','Agv4','y29UzMLNDxjHDgLVBG','A2v5CW','z2vUzxjHDgvKx2LTywDLCW','CMvMzxjLBMnLzf9PBwfNzv9WyxrOCW','C3vIyxjYyxK','BNvTx2XHC3rFAw1Hz2vZx3rVx2LUy2X1zgu','ihDLCMuGyxzHAwXHyMXLlG','yJy0x2PZB24','C2XPy2u','CMvHza','mJm0mZy3mej4t2rcva','tNvTyMvYig9Mig1VC3qGCMvJzw50igLUlw1LBw9YEsbJB252zxjZyxrPB24GAw1Hz2vZihrVigvKAxqU','CMvJzw50sw1Hz2vZ','o2jHC2u2ncW','y2vPBa','ChjVEhKTyxv0Ag9YAxPHDgLVBG','yMfZzty0','y29Uy2f0','z2v0uMvHzgvY','Ahr0CfzLCNnPB24','z2v0','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbYzxf1AxjLCYbHig1VzgvSignYzwrLBNrPywWU','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbMywLSzwqU','Aw1Hz2uVCg5N','tKzlqW','y29UDgvUDc1Szw5NDgG','C3rHCNrZv2L0Aa','uMvMzxjLBMnLzcbPBwfNzsbPCYbPBNzHBgLKig9YihvUC3vWCg9YDgvKlG','y29UBMvJDgLVBG','BwfUDwfS','zgLNzxn0','ignVBNzLCNnHDgLVBIbPBwfNzxmSigj1DcbVBMX5ia','q29KzxGGAw1Hz2uGCMvZCg9UC2uGzxHJzwvKzwqGDgHLihnPEMuGBgLTAxqU','C29JA3m1vxjS','yM9KEq','C2HHmJu2','q29KzxGGAw1Hz2uGCMvZCg9UC2uGAxmGAw52ywXPzc4','vu5bvvrit1jjwKve','Aw1Hz2vF','yxbWBgLJyxrPB24VANnVBG','ywnJzxb0','ChvZAa','tufsx0fhru5ux1rpt0XFt1vuufvux0XjtuLu','AxnbCNjHEq','y29UDgvUDc10ExbL','zgf0yq','yxv0Ag9YAxPHDgLVBG','mJu1odu1nLfWu2Dhvq','zNjVBq','y3jLzgvUDgLHBfbYB3zPzgvY','zg9Uzq','y2f0y2G','C2vZC2LVBKrPCMvJDg9YEq','tufsx0fhru5ux01prevmx0nptKzjr19jtLzbteLe','Aw52ywXPzgf0zq','CMv2zwfS','C2LNBMfS','CMvSzwfZzuXVy2S','CgfYC2u','tufsx0fhru5ux0LnquDfx0DftKvsqvrjt05FrKfjteve','AM9PBG','y29KzxHFAw1Hz2vFz2vU','r2vUzxjHDguGysbUzxCGAw1Hz2uGB3iGzwrPDcbLEgLZDgLUzYbPBwfNzxmGD2L0Acb0AguGy29UzMLNDxjLzcbdB2rLEcbjBwfNzxmGqvbjlIbpBwL0igjVDgGGC2vSzwn0B3jZigzVCIbNzw5LCMf0Aw9UlIbgB3iGzwrPDhmSihvZzsbYzwzLCMvUy2vKx2LTywDLx3bHDgHZihDOzw4GzxzLCNKGAw1Hz2uGAgfZigfUigfIC29SDxrLigXVy2fSihbHDgGSig90AgvYD2LZzsb1C2uGBNvTx2XHC3rFAw1Hz2vZx3rVx2LUy2X1zguGzM9YihrOzsbZBwfSBgvZDcbZDwzMAwnPzw50ig51BwjLCIbVzIbYzwnLBNqGy29UDMvYC2f0Aw9UigLTywDLCY4GtMv2zxiGChjVDMLKzsbIB3rOihnLBgvJDg9YCY4GvgHLihjLC3vSDgLUzYbqtKCGAxmGC2f2zwqGAw4GDgHLign1CNjLBNqGu2vZC2LVBIbHBMqGB25SEsbPDhmGBg9JywWGCgf0AcbPCYbYzxr1CM5Lzc4','tufsx0fhru5ux0LnquDfx0DftKvsqvrjt05FuKvtue9ou0vFsu5wquXjra','yNL0zuXLBMD0Aa','BwvZC2fNzq','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbMywLSzwqGD2L0Acbivfrqia','zgf0ytO','C3rHDhvZ','DMLLD0LTywDLtwf4qNL0zxm','C3rYAw5N','uKvrvuvtva','lNbUzW','AgvHzgvYCW','y2fUy2vS','qwjZB2X1DguGBg9JywWGCgf0AcbVzIbHBIbPBwfNzsb0BYbLzgL0lG','Aw1Hz2u','DgvZDa','y29Kzq'];_0x526b=function(){return _0x3b77f4;};return _0x526b();}async function readJsonResponse(_0x44886f){const _0xaca213=_0x4a9f58,_0x2bb157=Number(_0x44886f[_0xaca213(0x1d8)][_0xaca213(0x1a3)](_0xaca213(0x1a8)));if(Number[_0xaca213(0x169)](_0x2bb157)&&_0x2bb157>RESPONSE_MAX_BYTES){await _0x44886f[_0xaca213(0x1b1)]?.[_0xaca213(0x1d9)]()[_0xaca213(0x1c2)](()=>undefined);throw new MarAgentError(_0xaca213(0x1b9),_0xaca213(0x1af));}if(_0x44886f[_0xaca213(0x1b1)]===null)return{};const _0xe8e9fc=_0x44886f[_0xaca213(0x1b1)][_0xaca213(0x1a1)](),_0xcfd8a2=[];let _0x426976=0x21e9+-0xaaf*0x2+0x13*-0xa9;try{for(;;){const _0x47dd33=await _0xe8e9fc[_0xaca213(0x198)]();if(_0x47dd33[_0xaca213(0x1c1)])break;_0x426976+=_0x47dd33[_0xaca213(0x172)][_0xaca213(0x1cf)];if(_0x426976>RESPONSE_MAX_BYTES)throw new MarAgentError(_0xaca213(0x1b9),_0xaca213(0x1af));_0xcfd8a2[_0xaca213(0x1b8)](_0x47dd33[_0xaca213(0x172)]);}}catch(_0x5a4985){await _0xe8e9fc[_0xaca213(0x1d9)]()[_0xaca213(0x1c2)](()=>undefined);throw _0x5a4985;}finally{_0xe8e9fc[_0xaca213(0x1c8)]();}try{return JSON[_0xaca213(0x1c9)](Buffer[_0xaca213(0x1a0)](_0xcfd8a2,_0x426976)[_0xaca213(0x161)](_0xaca213(0x183)));}catch(_0x2811f2){throw new MarAgentError(_0xaca213(0x1ce),_0xaca213(0x1b3),{'cause':_0x2811f2});}}function imageBase64(_0xaf587c){const _0x2625fa=_0x4a9f58,_0x4467b5=_0xaf587c!==null&&typeof _0xaf587c===_0x2625fa(0x1de)&&!Array[_0x2625fa(0x1ba)](_0xaf587c)&&Array[_0x2625fa(0x1ba)](_0xaf587c[_0x2625fa(0x1bc)])?_0xaf587c[_0x2625fa(0x1bc)]:undefined,_0x5e5ee4=_0x4467b5?.[_0x2625fa(0x177)]===-0x2*-0x606+-0x88c+-0x37f&&_0x4467b5[-0x1c7b*-0x1+-0xf9e+0x25*-0x59]!==null&&typeof _0x4467b5[0x1e9a+-0x189*0x19+0x7c7]===_0x2625fa(0x1de)&&!Array[_0x2625fa(0x1ba)](_0x4467b5[0x4*0x502+0xba0+-0xfd4*0x2])?_0x4467b5[0x5*0x5fb+0xb6d+-0x5*0x844][_0x2625fa(0x196)]:undefined;if(typeof _0x5e5ee4!==_0x2625fa(0x1d5)||_0x5e5ee4[_0x2625fa(0x177)]===-0x2*0xff4+-0x5*0x36+0x20f6||_0x5e5ee4[_0x2625fa(0x177)]>RESPONSE_MAX_BYTES)throw new MarAgentError(_0x2625fa(0x1ce),_0x2625fa(0x1b3));return _0x5e5ee4;}function decodePng(_0x1eacc2){const _0x50a2ff=_0x4a9f58;if(_0x1eacc2[_0x50a2ff(0x177)]%(-0x5*0x117+-0x1*0x18ff+0x1e76)!==0x2a5*-0x7+0x9*0x2e0+-0xd*0x91||!/^[A-Za-z0-9+/]+={0,2}$/u[_0x50a2ff(0x1dc)](_0x1eacc2))throw new MarAgentError(_0x50a2ff(0x1ce),_0x50a2ff(0x1b3));const _0x317bb3=Buffer[_0x50a2ff(0x1bf)](_0x1eacc2,_0x50a2ff(0x19f));if(_0x317bb3[_0x50a2ff(0x1cf)]===-0x13*0x49+-0x1a72+-0xa9f*-0x3||_0x317bb3[_0x50a2ff(0x1cf)]>TOOL_EXECUTION_LIMITS[_0x50a2ff(0x1d4)]||_0x317bb3[_0x50a2ff(0x161)](_0x50a2ff(0x19f))!==_0x1eacc2||!_0x317bb3[_0x50a2ff(0x193)](-0xce3+-0x1*0x71+0xd54*0x1,PNG_SIGNATURE[_0x50a2ff(0x177)])[_0x50a2ff(0x187)](PNG_SIGNATURE))throw new MarAgentError(_0x50a2ff(0x1ce),_0x50a2ff(0x1e2));return _0x317bb3;}function generatedFileName(_0x24914d){const _0x2f4f95=_0x4a9f58,_0x10cc49=_0x24914d[_0x2f4f95(0x189)](_0x2f4f95(0x1a7))[_0x2f4f95(0x163)](/[^a-zA-Z0-9._-]+/gu,'_')[_0x2f4f95(0x163)](/^[_\-.]+|[_\-.]+$/gu,'')[_0x2f4f95(0x197)](0x5*-0x15f+0x31*0x1c+0x1*0x17f,-0x1228+-0x6*0xa1+0x164e),_0x3c6eea=_0x10cc49[_0x2f4f95(0x177)]>-0x210c+-0x5*-0x49d+0x9fb?_0x10cc49:createHash(_0x2f4f95(0x1b2))[_0x2f4f95(0x18b)](_0x24914d)[_0x2f4f95(0x1ad)](_0x2f4f95(0x18e)),_0x530b1b=(_0x3c6eea[_0x2f4f95(0x1a9)](_0x2f4f95(0x1b5))?_0x3c6eea:_0x2f4f95(0x1b5)+_0x3c6eea)+_0x2f4f95(0x1d7);return basename(_0x530b1b);}function imageGenerationResponseError(_0x2bfb51,_0x1a16e0){const _0x131431=_0x4a9f58,_0x1b463b=_0x1a16e0!==null&&typeof _0x1a16e0===_0x131431(0x1de)&&!Array[_0x131431(0x1ba)](_0x1a16e0)?_0x1a16e0[_0x131431(0x15f)]:undefined,_0xfb40de=_0x1b463b!==null&&typeof _0x1b463b===_0x131431(0x1de)&&!Array[_0x131431(0x1ba)](_0x1b463b)?_0x1b463b:undefined,_0x2ed6e9=_0x131431(0x1d1)+_0x2bfb51+'.',_0x3c4133=typeof _0xfb40de?.[_0x131431(0x1dd)]===_0x131431(0x1d5)?_0xfb40de[_0x131431(0x1dd)][_0x131431(0x16f)]():'',_0x177fb9=/^[a-zA-Z0-9._-]{1,80}$/u[_0x131431(0x1dc)](_0x3c4133)?_0x3c4133:_0x131431(0x1ca),_0x4cc102=typeof _0xfb40de?.[_0x131431(0x1d0)]===_0x131431(0x1d5)?_0xfb40de[_0x131431(0x1d0)][_0x131431(0x16f)]():'',_0x1a80ea=_0x4cc102[_0x131431(0x177)]>-0x1bfe+-0x1ef0+0x3aee&&_0x4cc102[_0x131431(0x177)]<=0x1*0x1c1e+-0x19ed+-0x1*-0x1b7&&!/\b(?:authorization|bearer|api[_ -]?key|access[_ -]?token|refresh[_ -]?token|password|secret|proxy-authorization|chatgpt-account-id)\b|socks5:\/\//iu[_0x131431(0x1dc)](_0x4cc102)?_0x4cc102:_0x2ed6e9;return new MarAgentError(_0x177fb9,_0x1a80ea,{'details':{'status':_0x2bfb51}});}function invalidInput(){const _0x2bb1b8=_0x4a9f58;throw new MarAgentError(_0x2bb1b8(0x171),_0x2bb1b8(0x17a));}
|
package/dist/tools/exec.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
const _0x2dac1e=_0x5ea2;(function(_0x2ee382,_0x54d606){const _0x208f02=_0x5ea2,_0x1ef499=_0x2ee382();while(!![]){try{const _0x3be28f=parseInt(_0x208f02(0x108))/(-0x34d*0xb+-0xc52+0x30a2)+parseInt(_0x208f02(0x107))/(0x903+-0x5ef*-0x3+0x1*-0x1ace)*(-parseInt(_0x208f02(0x15c))/(-0x2*0x3c2+-0x1370*0x2+0x1*0x2e67))+parseInt(_0x208f02(0x168))/(-0x34d*-0xb+-0x829+-0x1*0x1c22)+parseInt(_0x208f02(0x14d))/(-0x1f59+-0x11f2+0x4*0xc54)+parseInt(_0x208f02(0x124))/(-0x2*0x1385+0x1b27+0xbe9)*(parseInt(_0x208f02(0x14f))/(0x2476+0x8e*-0x3+0x1*-0x22c5))+parseInt(_0x208f02(0x10a))/(0x1cf5+-0x1*-0x4a7+-0x2194)*(-parseInt(_0x208f02(0x159))/(-0x303+-0x14e2+-0x17ee*-0x1))+-parseInt(_0x208f02(0xf9))/(0x1*0xdab+0x9*-0xd6+0x3*-0x209)*(parseInt(_0x208f02(0x165))/(0x1d*0x17+-0x128f*-0x1+-0x151f));if(_0x3be28f===_0x54d606)break;else _0x1ef499['push'](_0x1ef499['shift']());}catch(_0x290846){_0x1ef499['push'](_0x1ef499['shift']());}}}(_0x4fd0,0x3*0x7f3e+-0xfc8a1*-0x1+0x662de*-0x1));import{spawn}from'node:child_process';function _0x4fd0(){const _0x353d1f=['zxHLy0rLzMf1BhrzAwvSze1Z','ywXS','C3rKAw4','y29TBwfUza','Dg9tDhjPBMC','y2fUy2vS','zxHPDa','C2HLBgW','ndCYoduWmgLgtfbcCW','y3DK','mtK2mJHozLjSBgq','rxHLy3v0Aw9UignHBMnLBgXLzc4','tufsx0fhru5ux0vyrunvveLptL9dqu5druXmruq','Dw5Yzwy','B3DUzxjtzxnZAw9Uswq','ywn0Aw9U','DMfSDwvZ','zgvJB2rLCG','y2XVC2u','zxHPDenVzgu','mJmYmdjvrw92yva','CMvTB3zLrxzLBNrmAxn0zw5LCG','zNjVBq','nJe5odG3BLnjCKn5','zgLZCg9ZzvnLC3nPB24','C3vIyxjYyxK','y2HPBgq','CgH5C2LJywXqyxrO','DxrMoa','zw50CMLLCW','CMfJzq','C2vYAwfS','mZm5oxP1A1PywG','uMvXDwLYzwqGzM9YihbVBgWSihDYAxrLigfUzcbJyw5JzwWU','ChjVy2vZC0LK','ndC0mJKYmgjRy1zTEG','DhjPBq','CMvZB2X2zvDPDgHeAxnWBgf5','ywjVCNrLza','zxHLy01HEfLPzwXKtxm','EwLLBgrnCW','zxHLy3v0zq','ywrKrxzLBNrmAxn0zw5LCG','C2vZC2LVBKLK','zxHLyW','A2LSBa','y2fUy2vSBgvK','CMvHC29U','y2H1BMTZ','zgLZCgXHEvbHDgG','DgHLBG','Aw5JBhvKzxm','z2v0','B25Jzq','DMfSDwu','zxHLy01HEfrPBwvVDxrnCW','CgLK','nJiXodb6rfbprha','D3jPDgu','zw5K','rvnsq0G','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','C3rKB3v0','C3rHCNq','tufsx0fhru5ux1bst0nfu1nFtK9ux0zpvu5e','DgfZA2TPBgW','C3rYAw5N','ChjVy2vZC0v4zwn1Dg9Y','rxHLyYbPBNb1DcbPCYbPBNzHBgLKlG','C2v0','Aw50zwDLCG','ngLbBePIuW','ndi1otC3DMPJAe9z','D2LUzg93','mtu5mMXuBgDSrG','B2jQzwn0','zMLSDgvY','uMvXDwLYzwqGB25SEsbMB3iGC3rHCNqU','Cg9SBa','zgf0yq','zgLZCg9Zzq','y2XLyxi','tufsx0fhru5ux1bst0nfu1nFteLnsvq','BgvUz3rO','zxHLy0rLzMf1BhrnyxHpDxrWDxrcExrLCW','BwfW','BgLZDfnLC3nPB25szxnVDxjJzxm','DgvYBwLUyxrL','t3b0Aw9UywWGCMvSyxrPDMuVywjZB2X1DguGC3rHCNqGzgLYzwn0B3j5oYbKzwzHDwX0CYb0BYb3B3jRC3bHy2uU','Bwf4uhjVy2vZC2vZ','Bwf4','y2vPBa','Bwf4t3v0Chv0qNL0zxm','zxHPDgvK','CgXHDgzVCM0','y29TCgXLDgvK','u0Lhs0Lmta','y29Uy2f0','tgLMzwn5y2XLig9WzxjHDgLVBI4','D2LUzg93t2zMC2v0','mJe0oenIELfYDq','BwLU','zgvSzxrL','DgLTzxi','Cgf0Ahm','C3rKzxjY','zxjYB3i','C3rHDhvZ','ChvZAa','zxHLy0rLzMf1BhruAw1LB3v0txm','C3rKAw4Gzgf0ysbYzxf1AxjLzcbMB3iGD3jPDguU','zMXHDe1HCa','u0Lhvevstq','twfUywDLzcbWCM9JzxnZihDHCYbUB3qGzM91BMqU','vgHLig1HBMfNzwqGChjVy2vZCYbSAw1PDcb3yxmGCMvHy2HLzc4','l3bPza','D2fPDgvYCW','DgLTzw91De1Z','CNvUBMLUzW','AxnjBNrLz2vY','Dg90ywXcExrLCW','C3bHD24','ywjVCNq','vw5Yzxn0CMLJDgvKigDLBMvYywWGC3LZDgvTigv4zwn1DgLVBI4GC3rHCNqGCNvUCYbHBNKGCgXHDgzVCM0TBMf0AxzLignVBw1HBMqSihnJCMLWDcWGDgv4Dc9MAwXLihrVB2WSigj1AwXKzxiSigDLBMvYyxrVCIWGBMv0D29YAYbJBgLLBNqSig9YihbYB2DYyw0GAw4GD29YA3nWywnLl2rLzMf1BhqGy3DKigfUzcbTyxKGCMv0DxjUihj1BM5PBMCGD2L0AcbWCM9JzxnZswq7ihbVBgWGD2fPDhmGDxaGDg8GEwLLBgrnCYbMB3iGBMv3ig91Dhb1DcbVCIb0zxjTAw5HDgLVBIbHBMqGCMv0DxjUCYbVBMX5ig91Dhb1DcbWCM9KDwnLzcbZAw5Jzsb0AguGChjPB3iGCMvZDwX0oYb3CML0zsbZzw5KCYbZDgrPBJSGy2fUy2vSihrLCM1PBMf0zxmGDgHLihbYB2nLC3mGDhjLzs4GuMv0DxjUCYbZDgf0DxmSihbYB2nLC3njzcWGAw5JCMvTzw50ywWGC3rKB3v0l3n0zgvYCIWGy3vTDwXHDgL2zsbZDgrVDxrcExrLCY9ZDgrLCNjcExrLCYWGCgvYlxjLC3vSDcbKCM9WCgvKigj5DgvZlcbLEgL0q29KzsWGyw5KihrYDw5JyxrLzdSGysbJB21WBgv0zwqGC3rHDhvZigrVzxmGBM90igLTCgX5igv4AxrdB2rLidaUiefSD2f5CYbPBNnWzwn0ihn0zgvYCI9LEgL0q29KzsbHBMqGy29UC3vTzsb0zxjTAw5HBcbVDxrWDxqGB3iGy2fUy2vSlG','yNL0zxm','zhjVChbLzej5DgvZ','y29Kzq','BwvZC2fNzq','ywrK','AwDUB3jL','D2LUmZi','C2L6zq','zw52AxjVBM1LBNq'];_0x4fd0=function(){return _0x353d1f;};return _0x4fd0();}import{directLocalProcessExecutor}from'../host/local-process-executor.js';import{randomUUID}from'node:crypto';function _0x5ea2(_0x498689,_0x1a8230){_0x498689=_0x498689-(0x60a*0x1+0x225d+-0x2779);const _0x2e6098=_0x4fd0();let _0x404be8=_0x2e6098[_0x498689];if(_0x5ea2['pYVQBf']===undefined){var _0x531d02=function(_0x172867){const _0x472084='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1f997b='',_0x2e1eae='';for(let _0x1d1a44=0x7*0x1e9+0x1*0xd24+-0x269*0xb,_0x185d31,_0x7e4022,_0x24ccc2=-0xbe1*-0x1+0x3b*0x6d+-0x2500;_0x7e4022=_0x172867['charAt'](_0x24ccc2++);~_0x7e4022&&(_0x185d31=_0x1d1a44%(-0x1275+-0x1bd7+-0x13*-0x270)?_0x185d31*(-0x33b+-0xa6b+0xde6)+_0x7e4022:_0x7e4022,_0x1d1a44++%(-0x267a+0x1*0x240c+0x272))?_0x1f997b+=String['fromCharCode'](-0xe53+0x161*-0x17+0x1*0x2f09&_0x185d31>>(-(-0x992+0xa*-0x1eb+0x2*0xe61)*_0x1d1a44&0xad6*-0x2+-0x1*0x13fd+0x29af)):0x1*-0x605+0x1cdd+-0x44*0x56){_0x7e4022=_0x472084['indexOf'](_0x7e4022);}for(let _0x3825dd=0x26d1+-0x1aa0+-0xc31,_0x54ed79=_0x1f997b['length'];_0x3825dd<_0x54ed79;_0x3825dd++){_0x2e1eae+='%'+('00'+_0x1f997b['charCodeAt'](_0x3825dd)['toString'](-0x13e4+0x3*0x7f2+-0x3e2))['slice'](-(0x1*-0x19b1+0xc48*0x2+0x123));}return decodeURIComponent(_0x2e1eae);};_0x5ea2['XCJkpQ']=_0x531d02,_0x5ea2['bWSIlu']={},_0x5ea2['pYVQBf']=!![];}const _0x30376f=_0x2e6098[0x1394+0x6af+-0x1a43];_0x5ea2['fiWhsj']!==_0x30376f&&(_0x5ea2['bWSIlu']={},_0x5ea2['fiWhsj']=_0x30376f);const _0x5137f8=_0x5ea2['bWSIlu'][_0x498689];return _0x5137f8===undefined?(_0x404be8=_0x5ea2['XCJkpQ'](_0x404be8),_0x5ea2['bWSIlu'][_0x498689]=_0x404be8):_0x404be8=_0x5137f8,_0x404be8;}import{StringDecoder}from'node:string_decoder';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';export const execToolDefinition={'name':_0x2dac1e(0x171),'parallelSafety':_0x2dac1e(0x164),'description':_0x2dac1e(0x13b),'inputSchema':{'type':_0x2dac1e(0x10b),'properties':{'action':{'enum':[_0x2dac1e(0xff),_0x2dac1e(0x10e),_0x2dac1e(0xfa),_0x2dac1e(0x14a)],'description':_0x2dac1e(0x122)},'command':{'type':_0x2dac1e(0x102),'description':_0x2dac1e(0x10d)},'cwd':{'type':_0x2dac1e(0x102),'description':_0x2dac1e(0x118)},'timeoutMs':{'type':_0x2dac1e(0x106),'minimum':0x1,'maximum':TOOL_EXECUTION_LIMITS[_0x2dac1e(0xf7)]},'yieldMs':{'type':_0x2dac1e(0x106),'minimum':0x0,'maximum':TOOL_EXECUTION_LIMITS[_0x2dac1e(0x16c)]},'processId':{'type':_0x2dac1e(0x102),'description':_0x2dac1e(0x166)},'data':{'type':_0x2dac1e(0x102),'description':_0x2dac1e(0x12e)}},'required':[_0x2dac1e(0x154)],'additionalProperties':![]}};export class ExecTool{[_0x2dac1e(0x128)];[_0x2dac1e(0x11c)];[_0x2dac1e(0x119)];[_0x2dac1e(0x144)];[_0x2dac1e(0x14c)];[_0x2dac1e(0x103)];#processes=new Map();constructor(_0x45f772,_0x3f591a=TOOL_EXECUTION_LIMITS[_0x2dac1e(0x114)],_0x1c89b3=TOOL_EXECUTION_LIMITS[_0x2dac1e(0x119)],_0x24261c=process.env,_0x4fc759,_0xac6768=directLocalProcessExecutor){const _0x1f2699=_0x2dac1e;this[_0x1f2699(0x128)]=_0x45f772,this[_0x1f2699(0x11c)]=_0x3f591a,this[_0x1f2699(0x119)]=_0x1c89b3,this[_0x1f2699(0x144)]=_0x24261c,this[_0x1f2699(0x14c)]=_0x4fc759,this[_0x1f2699(0x103)]=_0xac6768;}async[_0x2dac1e(0x16e)](_0x497294,_0x5ac6af,_0xbdafe2){const _0x762a91=_0x2dac1e;if(_0x5ac6af?.[_0x762a91(0x16b)])throw executionAbortReason(_0x5ac6af);const _0x4d1766=parseExecInput(_0x497294);if(_0x4d1766[_0x762a91(0x154)]!==_0x762a91(0xff)){const _0x1c6c99=this.#processes[_0x762a91(0xf4)](_0x4d1766[_0x762a91(0x167)]);if(!_0x1c6c99||_0xbdafe2!==undefined&&_0x1c6c99[_0x762a91(0x153)]!==_0xbdafe2[_0x762a91(0x170)])throw new MarAgentError(_0x762a91(0x100),_0x762a91(0x131));if(_0x4d1766[_0x762a91(0x154)]===_0x762a91(0x10e)&&_0x4d1766[_0x762a91(0x16d)])await waitForProcessChange(_0x1c6c99,Math[_0x762a91(0x125)](Math[_0x762a91(0x11a)](_0x4d1766[_0x762a91(0x16d)],-0x137*-0x3+0x34*0xa+-0x5ad*0x1),TOOL_EXECUTION_LIMITS[_0x762a91(0x16c)]),_0x5ac6af);if(_0x4d1766[_0x762a91(0x154)]===_0x762a91(0xfa))_0x1c6c99[_0x762a91(0x15f)][_0x762a91(0x147)][_0x762a91(0xfa)](_0x4d1766[_0x762a91(0x10f)]);if(_0x4d1766[_0x762a91(0x154)]===_0x762a91(0x14a))await this.#terminate(_0x1c6c99);const _0x5be3e8=this.#result(_0x4d1766[_0x762a91(0x167)],_0x1c6c99);if(_0x1c6c99[_0x762a91(0x12b)]!==_0x762a91(0x136))this.#processes[_0x762a91(0x126)](_0x4d1766[_0x762a91(0x167)]);return _0x5be3e8;}if(this.#processes[_0x762a91(0x143)]>=this[_0x762a91(0x119)])throw new MarAgentError(_0x762a91(0x112),_0x762a91(0x132));const _0x2737d3=randomUUID(),_0x5504c7=await this[_0x762a91(0x128)][_0x762a91(0x16a)](_0x4d1766[_0x762a91(0x14e)]??'.'),_0x3606c3=await this[_0x762a91(0x103)][_0x762a91(0x139)]({'command':_0x4d1766[_0x762a91(0x148)],'cwd':_0x5504c7[_0x762a91(0x160)],'shell':this[_0x762a91(0x14c)]??!![],'environment':this[_0x762a91(0x144)],'detached':process[_0x762a91(0x11e)]!==_0x762a91(0x142),..._0xbdafe2===undefined?{}:{'owner':_0xbdafe2},..._0x5ac6af===undefined?{}:{'signal':_0x5ac6af}});let _0x1466d8;const _0x58eed2={'child':_0x3606c3,..._0xbdafe2===undefined?{}:{'ownerSessionId':_0xbdafe2[_0x762a91(0x170)]},'command':_0x4d1766[_0x762a91(0x148)],'cwd':_0x5504c7[_0x762a91(0xf1)],'stdout':createOutputBuffer(),'stderr':createOutputBuffer(),'status':_0x762a91(0x136),'exited':new Promise(_0x3e2749=>_0x1466d8=_0x3e2749),'waiters':new Set()};this.#processes[_0x762a91(0x105)](_0x2737d3,_0x58eed2),_0x3606c3[_0x762a91(0xfe)]['on'](_0x762a91(0x10f),_0x3aabf6=>{const _0x24363a=_0x762a91;appendOutput(_0x58eed2[_0x24363a(0xfe)],Buffer[_0x24363a(0x15b)](_0x58eed2[_0x24363a(0xfe)][_0x24363a(0x156)][_0x24363a(0xfa)](_0x3aabf6)),this[_0x24363a(0x11c)],_0x3aabf6[_0x24363a(0x113)]),notifyProcessChange(_0x58eed2);}),_0x3606c3[_0x762a91(0x129)]['on'](_0x762a91(0x10f),_0x2f37cd=>{const _0x5eb5fe=_0x762a91;appendOutput(_0x58eed2[_0x5eb5fe(0x129)],Buffer[_0x5eb5fe(0x15b)](_0x58eed2[_0x5eb5fe(0x129)][_0x5eb5fe(0x156)][_0x5eb5fe(0xfa)](_0x2f37cd)),this[_0x5eb5fe(0x11c)],_0x2f37cd[_0x5eb5fe(0x113)]),notifyProcessChange(_0x58eed2);}),_0x3606c3[_0x762a91(0xf5)](_0x762a91(0x157),_0x532c86=>{const _0xee923a=_0x762a91;appendOutput(_0x58eed2[_0xee923a(0xfe)],Buffer[_0xee923a(0x15b)](_0x58eed2[_0xee923a(0xfe)][_0xee923a(0x156)][_0xee923a(0xfb)]()),this[_0xee923a(0x11c)]),appendOutput(_0x58eed2[_0xee923a(0x129)],Buffer[_0xee923a(0x15b)](_0x58eed2[_0xee923a(0x129)][_0xee923a(0x156)][_0xee923a(0xfb)]()),this[_0xee923a(0x11c)]),_0x58eed2[_0xee923a(0x12b)]=_0x58eed2[_0xee923a(0x12b)]===_0xee923a(0xee)?_0xee923a(0xee):_0xee923a(0x11f),_0x58eed2[_0xee923a(0x158)]=_0x532c86;if(_0x58eed2[_0xee923a(0x127)])clearTimeout(_0x58eed2[_0xee923a(0x127)]);notifyProcessChange(_0x58eed2),_0x1466d8();}),_0x3606c3[_0x762a91(0xf5)](_0x762a91(0x12a),_0x559ff9=>{const _0x292ce4=_0x762a91;appendOutput(_0x58eed2[_0x292ce4(0x129)],Buffer[_0x292ce4(0x15b)](_0x559ff9[_0x292ce4(0x13f)]),this[_0x292ce4(0x11c)]),notifyProcessChange(_0x58eed2);}),_0x58eed2[_0x762a91(0x127)]=setTimeout(()=>{void this.#terminate(_0x58eed2);},Math[_0x762a91(0x125)](_0x4d1766[_0x762a91(0x135)]??TOOL_EXECUTION_LIMITS[_0x762a91(0x12d)],TOOL_EXECUTION_LIMITS[_0x762a91(0xf7)])),_0x58eed2[_0x762a91(0x127)][_0x762a91(0x152)](),await waitForExitOrDelay(_0x58eed2[_0x762a91(0x11d)],Math[_0x762a91(0x125)](_0x4d1766[_0x762a91(0x16d)]??TOOL_EXECUTION_LIMITS[_0x762a91(0x145)],TOOL_EXECUTION_LIMITS[_0x762a91(0x16c)]),_0x5ac6af);const _0x2d928b=this.#result(_0x2737d3,_0x58eed2);if(_0x58eed2[_0x762a91(0x12b)]!==_0x762a91(0x136))this.#processes[_0x762a91(0x126)](_0x2737d3);return _0x2d928b;}[_0x2dac1e(0x116)](_0xd28bf3){const _0x552b20=_0x2dac1e;return[...this.#processes[_0x552b20(0x162)]()][_0x552b20(0x12f)](([_0x328dcd,_0x12806c])=>_0x12806c[_0x552b20(0x153)]===_0xd28bf3?[{'processId':_0x328dcd,'status':_0x12806c[_0x552b20(0x12b)],'command':_0x12806c[_0x552b20(0x148)],'cwd':_0x12806c[_0x552b20(0x14e)]}]:[]);}async[_0x2dac1e(0x15d)](_0x2d217f){const _0x1d4f97=_0x2dac1e,_0x5c8435=[...this.#processes[_0x1d4f97(0x162)]()][_0x1d4f97(0x10c)](([,_0x596542])=>_0x596542[_0x1d4f97(0x153)]===_0x2d217f);await Promise[_0x1d4f97(0x146)](_0x5c8435[_0x1d4f97(0x115)](([,_0x408ac8])=>_0x408ac8[_0x1d4f97(0x12b)]===_0x1d4f97(0x136)?this.#terminate(_0x408ac8):_0x408ac8[_0x1d4f97(0x11d)]));for(const [_0x35f3a1]of _0x5c8435)this.#processes[_0x1d4f97(0x126)](_0x35f3a1);}async #terminate(_0x487107){const _0x336c3e=_0x2dac1e;if(_0x487107[_0x336c3e(0x117)])return _0x487107[_0x336c3e(0x117)];return _0x487107[_0x336c3e(0x117)]=((async()=>{const _0x5818b6=_0x336c3e;if(_0x487107[_0x5818b6(0x15f)][_0x5818b6(0x158)]!==null){await _0x487107[_0x5818b6(0x11d)];return;}_0x487107[_0x5818b6(0x12b)]=_0x5818b6(0xee);if(_0x487107[_0x5818b6(0x127)])clearTimeout(_0x487107[_0x5818b6(0x127)]);await signalProcessTree(_0x487107[_0x5818b6(0x15f)],_0x5818b6(0x130));const _0x4f8392=await waitForExit(_0x487107[_0x5818b6(0x11d)],0x9de+0xd48+-0x133e);!_0x4f8392&&(await signalProcessTree(_0x487107[_0x5818b6(0x15f)],_0x5818b6(0x120)),await _0x487107[_0x5818b6(0x11d)]);})()),_0x487107[_0x336c3e(0x117)];}#result(_0x440395,_0x3f851f){const _0x1f7ee1=_0x2dac1e,_0x59dda5=consumeOutput(_0x3f851f[_0x1f7ee1(0xfe)]),_0x4f8b7a=consumeOutput(_0x3f851f[_0x1f7ee1(0x129)]);return{'status':_0x3f851f[_0x1f7ee1(0x12b)],..._0x3f851f[_0x1f7ee1(0x12b)]===_0x1f7ee1(0x136)?{'processId':_0x440395}:{},'stdout':_0x59dda5[_0x1f7ee1(0xf6)],'stderr':_0x4f8b7a[_0x1f7ee1(0xf6)],..._0x3f851f[_0x1f7ee1(0x158)]===undefined?{}:{'exitCode':_0x3f851f[_0x1f7ee1(0x158)]},'truncated':_0x59dda5[_0x1f7ee1(0x13d)]>-0x1*0x3c7+-0x2605+0x29cc||_0x4f8b7a[_0x1f7ee1(0x13d)]>-0xb96+-0x63d+-0x3*-0x5f1,'stdoutBytes':_0x3f851f[_0x1f7ee1(0xfe)][_0x1f7ee1(0x138)],'stderrBytes':_0x3f851f[_0x1f7ee1(0x129)][_0x1f7ee1(0x138)],'stdoutDroppedBytes':_0x59dda5[_0x1f7ee1(0x13d)],'stderrDroppedBytes':_0x4f8b7a[_0x1f7ee1(0x13d)]};}async[_0x2dac1e(0x110)](){const _0x8ec565=_0x2dac1e;await Promise[_0x8ec565(0x146)]([...this.#processes[_0x8ec565(0x155)]()][_0x8ec565(0x115)](_0x1b042a=>_0x1b042a[_0x8ec565(0x12b)]===_0x8ec565(0x136)?this.#terminate(_0x1b042a):_0x1b042a[_0x8ec565(0x11d)])),this.#processes[_0x8ec565(0x111)]();}}function createOutputBuffer(){const _0x29d47b=_0x2dac1e;return{'chunks':[],'bytes':0x0,'totalBytes':0x0,'droppedBytes':0x0,'windowOffset':0x0,'decoder':new StringDecoder(_0x29d47b(0x161))};}function appendOutput(_0x54e84a,_0x325728,_0x52ace2,_0x4aa5f1=_0x325728[_0x2dac1e(0x113)]){const _0x129dc0=_0x2dac1e;_0x54e84a[_0x129dc0(0x138)]+=_0x4aa5f1;if(!_0x325728[_0x129dc0(0x113)])return;_0x54e84a[_0x129dc0(0xf0)][_0x129dc0(0x12c)](_0x325728),_0x54e84a[_0x129dc0(0x13c)]+=_0x325728[_0x129dc0(0x113)];const _0xb76f5a=_0x54e84a[_0x129dc0(0x13c)]-_0x52ace2;if(_0xb76f5a<=0x1862+0x108+-0x196a)return;const _0x4d3d6e=Math[_0x129dc0(0x11b)](_0x52ace2/(0x7cc*-0x3+-0x1*-0x185+0x15e1));let _0x36dfd7=_0x54e84a[_0x129dc0(0x109)];(!_0x36dfd7||_0x54e84a[_0x129dc0(0x13c)]!==_0x36dfd7[_0x129dc0(0x113)]-_0x54e84a[_0x129dc0(0x123)])&&(_0x36dfd7=Buffer[_0x129dc0(0x121)](_0x54e84a[_0x129dc0(0xf0)],_0x54e84a[_0x129dc0(0x13c)]),_0x54e84a[_0x129dc0(0x123)]=0x4*-0x665+-0xa5*-0x39+-0xb29);const _0x5f47db=_0x36dfd7[_0x129dc0(0x15e)](_0x54e84a[_0x129dc0(0x123)],_0x54e84a[_0x129dc0(0x123)]+_0x54e84a[_0x129dc0(0x13c)]);_0x54e84a[_0x129dc0(0xf0)]=[],_0x54e84a[_0x129dc0(0x13c)]=-0x1*-0x1b0+0x22c9+-0x2479,_0x54e84a[_0x129dc0(0x13d)]+=_0xb76f5a;const _0x445ce3=(_0xaf8c14,_0x3b62ee)=>{const _0x1e70e7=_0x129dc0;while(_0xaf8c14<_0x3b62ee&&(_0x5f47db[_0xaf8c14]&-0x9*-0x335+-0x10*-0x257+-0xad*0x61)===-0x1f6c+-0xff0+-0x3fd*-0xc)_0xaf8c14++;while(_0x3b62ee>_0xaf8c14&&(_0x5f47db[_0x3b62ee-(0x926+0x559+0xe7e*-0x1)]&-0x5*-0x1e7+0x1*0x1db3+-0x2676)===-0xe*0x167+-0x31c+0x15e*0x11)_0x3b62ee--;if(_0xaf8c14>=_0x3b62ee)return;const _0x57d0fb=_0x5f47db[_0x1e70e7(0x15e)](_0xaf8c14,_0x3b62ee);_0x54e84a[_0x1e70e7(0xf0)][_0x1e70e7(0x12c)](_0x57d0fb),_0x54e84a[_0x1e70e7(0x13c)]+=_0x57d0fb[_0x1e70e7(0x113)];};_0x445ce3(0x6f+-0xd*-0x21d+-0x1be8,Math[_0x129dc0(0x125)](_0x4d3d6e,_0x5f47db[_0x129dc0(0x113)])),_0x445ce3(Math[_0x129dc0(0x125)](_0x4d3d6e+_0xb76f5a,_0x5f47db[_0x129dc0(0x113)]),_0x5f47db[_0x129dc0(0x113)]),_0x54e84a[_0x129dc0(0x109)]=_0x36dfd7;}function consumeOutput(_0x5e713e){const _0x1c23db=_0x2dac1e,_0x569a5c=Buffer[_0x1c23db(0x121)](_0x5e713e[_0x1c23db(0xf0)],_0x5e713e[_0x1c23db(0x13c)])[_0x1c23db(0x149)](_0x1c23db(0x161)),_0x4bfa7c=_0x5e713e[_0x1c23db(0x13d)];return _0x5e713e[_0x1c23db(0xf0)]=[],_0x5e713e[_0x1c23db(0x13c)]=-0xf3a+-0x131c+0x6de*0x5,_0x5e713e[_0x1c23db(0x13d)]=-0x81f+0x229+-0x5f6*-0x1,delete _0x5e713e[_0x1c23db(0x109)],_0x5e713e[_0x1c23db(0x123)]=-0x2543+0x12f3+0x1250,{'value':_0x569a5c,'droppedBytes':_0x4bfa7c};}function parseExecInput(_0x157993){const _0x3d948e=_0x2dac1e;if(!_0x157993||typeof _0x157993!==_0x3d948e(0x10b))return invalidExecInput();const _0x4921ed=_0x157993,_0xccf9a2=_0x4921ed[_0x3d948e(0x154)];if(![_0x3d948e(0xff),_0x3d948e(0x10e),_0x3d948e(0xfa),_0x3d948e(0x14a)][_0x3d948e(0xf3)](String(_0xccf9a2)))return invalidExecInput();const _0x3258d8=optionalBoundedInteger(_0x4921ed[_0x3d948e(0x16d)],0xd*-0x9b+0x56c*0x1+0x1*0x273,TOOL_EXECUTION_LIMITS[_0x3d948e(0x16c)]);if(_0xccf9a2===_0x3d948e(0xff)){if(typeof _0x4921ed[_0x3d948e(0x148)]!==_0x3d948e(0x102)||_0x4921ed[_0x3d948e(0x148)][_0x3d948e(0x169)]()==='')return invalidExecInput();if(_0x4921ed[_0x3d948e(0x14e)]!==undefined&&_0x4921ed[_0x3d948e(0x14e)]!==null&&typeof _0x4921ed[_0x3d948e(0x14e)]!==_0x3d948e(0x102))return invalidExecInput();const _0xc67503=optionalBoundedInteger(_0x4921ed[_0x3d948e(0x135)],-0x1c*-0x2f+0xff*0x10+0x1*-0x1513,TOOL_EXECUTION_LIMITS[_0x3d948e(0xf7)]);return{'action':_0xccf9a2,'command':_0x4921ed[_0x3d948e(0x148)],...typeof _0x4921ed[_0x3d948e(0x14e)]===_0x3d948e(0x102)?{'cwd':_0x4921ed[_0x3d948e(0x14e)]}:{},..._0xc67503===undefined?{}:{'timeoutMs':_0xc67503},..._0x3258d8===undefined?{}:{'yieldMs':_0x3258d8}};}if(typeof _0x4921ed[_0x3d948e(0x167)]!==_0x3d948e(0x102)||_0x4921ed[_0x3d948e(0x167)]==='')return invalidExecInput();if(_0xccf9a2===_0x3d948e(0x10e))return{'action':_0xccf9a2,'processId':_0x4921ed[_0x3d948e(0x167)],..._0x3258d8===undefined?{}:{'yieldMs':_0x3258d8}};if(_0xccf9a2===_0x3d948e(0xfa)){if(typeof _0x4921ed[_0x3d948e(0x10f)]!==_0x3d948e(0x102))return invalidExecInput();return{'action':_0xccf9a2,'processId':_0x4921ed[_0x3d948e(0x167)],'data':_0x4921ed[_0x3d948e(0x10f)]};}return{'action':_0x3d948e(0x14a),'processId':_0x4921ed[_0x3d948e(0x167)]};}function optionalBoundedInteger(_0x567280,_0x3dad78,_0x3eb494){const _0x2d6167=_0x2dac1e;if(_0x567280===undefined||_0x567280===null)return undefined;if(!Number[_0x2d6167(0x137)](_0x567280)||_0x567280<_0x3dad78)invalidExecInput();return Math[_0x2d6167(0x125)](_0x567280,_0x3eb494);}function invalidExecInput(){const _0xbac98b=_0x2dac1e;throw new MarAgentError(_0xbac98b(0xfd),_0xbac98b(0x104));}async function signalProcessTree(_0x708ac8,_0x3c9f11){const _0x3564f7=_0x2dac1e;if(!_0x708ac8[_0x3564f7(0xf8)])return;if(process[_0x3564f7(0x11e)]!==_0x3564f7(0x142)){try{process[_0x3564f7(0x172)](-_0x708ac8[_0x3564f7(0xf8)],_0x3c9f11);}catch(_0x3f4e8c){if(_0x3f4e8c[_0x3564f7(0x13e)]!==_0x3564f7(0xfc))_0x708ac8[_0x3564f7(0x172)](_0x3c9f11);}return;}await new Promise(_0x18131e=>{const _0x4622f0=_0x3564f7,_0x1219b9=spawn(_0x4622f0(0x101),[_0x4622f0(0x133),String(_0x708ac8[_0x4622f0(0xf8)]),'/T','/F'],{'stdio':_0x4622f0(0x141),'windowsHide':!![]});_0x1219b9[_0x4622f0(0xf5)](_0x4622f0(0x12a),()=>{const _0x1ca609=_0x4622f0;_0x708ac8[_0x1ca609(0x172)](),_0x18131e();}),_0x1219b9[_0x4622f0(0xf5)](_0x4622f0(0x14b),()=>_0x18131e());});}async function waitForExitOrDelay(_0x1fb937,_0x990c3e,_0x282da6){const _0x2f5ed0=_0x2dac1e;if(_0x282da6?.[_0x2f5ed0(0x16b)])throw executionAbortReason(_0x282da6);let _0x4416c6,_0x5b794a;const _0x59ecea=new Promise((_0x2a2ab0,_0x23fd60)=>_0x5b794a=_0x23fd60),_0x4ded23=()=>_0x5b794a(executionAbortReason(_0x282da6));_0x282da6?.[_0x2f5ed0(0x16f)](_0x2f5ed0(0x13a),_0x4ded23,{'once':!![]});try{await Promise[_0x2f5ed0(0x163)]([_0x1fb937,_0x59ecea,new Promise(_0x12e977=>{const _0x386cef=_0x2f5ed0;_0x4416c6=setTimeout(_0x12e977,_0x990c3e),_0x4416c6[_0x386cef(0x152)]();})]);}finally{_0x282da6?.[_0x2f5ed0(0x15a)](_0x2f5ed0(0x13a),_0x4ded23);if(_0x4416c6)clearTimeout(_0x4416c6);}}async function waitForExit(_0xc4e5e8,_0x1dd806){const _0x5c43e3=_0x2dac1e;let _0x219259;try{return await Promise[_0x5c43e3(0x163)]([_0xc4e5e8[_0x5c43e3(0xf2)](()=>!![]),new Promise(_0x7340ed=>{const _0x1e78dd=_0x5c43e3;_0x219259=setTimeout(()=>_0x7340ed(![]),_0x1dd806),_0x219259[_0x1e78dd(0x152)]();})]);}finally{if(_0x219259)clearTimeout(_0x219259);}}function notifyProcessChange(_0x20dafc){const _0x14ca2d=_0x2dac1e;for(const _0x1193c2 of _0x20dafc[_0x14ca2d(0x134)])_0x1193c2();_0x20dafc[_0x14ca2d(0x134)][_0x14ca2d(0x111)]();}async function waitForProcessChange(_0x9169e7,_0x1837cc,_0x22b3ca){const _0x455229=_0x2dac1e;if(_0x9169e7[_0x455229(0x12b)]!==_0x455229(0x136)||_0x1837cc===-0x1827+-0xd64+-0x1*-0x258b)return;if(_0x22b3ca?.[_0x455229(0x16b)])throw executionAbortReason(_0x22b3ca);let _0xe19c02,_0x38091e;const _0x27a7d2=new Promise(_0x2ca609=>_0x38091e=_0x2ca609);let _0x5a0fc5;const _0x280d43=new Promise((_0x55c774,_0x4feaac)=>_0x5a0fc5=_0x4feaac),_0x3c94cc=()=>_0x5a0fc5(executionAbortReason(_0x22b3ca));_0x9169e7[_0x455229(0x134)][_0x455229(0x140)](_0x38091e),_0x22b3ca?.[_0x455229(0x16f)](_0x455229(0x13a),_0x3c94cc,{'once':!![]});try{await Promise[_0x455229(0x163)]([_0x27a7d2,_0x280d43,new Promise(_0x1c461e=>{const _0x51ebff=_0x455229;_0xe19c02=setTimeout(_0x1c461e,_0x1837cc),_0xe19c02[_0x51ebff(0x152)]();})]);}finally{_0x9169e7[_0x455229(0x134)][_0x455229(0x126)](_0x38091e),_0x22b3ca?.[_0x455229(0x15a)](_0x455229(0x13a),_0x3c94cc);if(_0xe19c02)clearTimeout(_0xe19c02);}}function executionAbortReason(_0x1a20dd){const _0x217187=_0x2dac1e;return _0x1a20dd?.[_0x217187(0xef)]??new MarAgentError(_0x217187(0x151),_0x217187(0x150));}
|
|
2
|
+
const _0x20c0bc=_0x5e08;function _0x5e08(_0x2e9691,_0x2b299f){_0x2e9691=_0x2e9691-(0x127b*-0x1+0x1*0x10de+0x221);const _0x3a7ce2=_0x43e1();let _0xec4744=_0x3a7ce2[_0x2e9691];if(_0x5e08['fcwblj']===undefined){var _0x162f2a=function(_0x1dadd2){const _0x529195='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x31a41a='',_0x286319='';for(let _0x4b8558=0x50*0xf+-0x2*-0xfb7+-0x241e,_0x31a6de,_0x2f1fd3,_0x5ed797=-0x1*-0x1dc5+0x44*0x10+-0x2205;_0x2f1fd3=_0x1dadd2['charAt'](_0x5ed797++);~_0x2f1fd3&&(_0x31a6de=_0x4b8558%(0x243c+0x1be1+0x10d*-0x3d)?_0x31a6de*(-0x23ea+-0x17*-0x4f+0x1d11)+_0x2f1fd3:_0x2f1fd3,_0x4b8558++%(0x367*0x5+0x4*-0xa6+-0xe67))?_0x31a41a+=String['fromCharCode'](-0x47*-0xd+0x6c8+0x1*-0x964&_0x31a6de>>(-(-0x1ed*-0x5+-0xc7*0x16+-0x1*-0x77b)*_0x4b8558&0xfdb+-0x1919+0x944)):0x253b+0x19c7+-0x2*0x1f81){_0x2f1fd3=_0x529195['indexOf'](_0x2f1fd3);}for(let _0x2489b3=-0xbba+-0x14*0x125+0x229e,_0x5d1341=_0x31a41a['length'];_0x2489b3<_0x5d1341;_0x2489b3++){_0x286319+='%'+('00'+_0x31a41a['charCodeAt'](_0x2489b3)['toString'](0x5*-0x5e6+0x3*-0xc46+0x1d8*0x24))['slice'](-(-0x24b6+0x1*0x4b3+0x2005));}return decodeURIComponent(_0x286319);};_0x5e08['joGsqK']=_0x162f2a,_0x5e08['UEJKqN']={},_0x5e08['fcwblj']=!![];}const _0x3228eb=_0x3a7ce2[0x4e8+-0xf1d+0xa35];_0x5e08['TfwDbe']!==_0x3228eb&&(_0x5e08['UEJKqN']={},_0x5e08['TfwDbe']=_0x3228eb);const _0x31c6e3=_0x5e08['UEJKqN'][_0x2e9691];return _0x31c6e3===undefined?(_0xec4744=_0x5e08['joGsqK'](_0xec4744),_0x5e08['UEJKqN'][_0x2e9691]=_0xec4744):_0xec4744=_0x31c6e3,_0xec4744;}(function(_0x1775b3,_0x249996){const _0x5dd2b8=_0x5e08,_0x81722e=_0x1775b3();while(!![]){try{const _0x453c22=-parseInt(_0x5dd2b8(0xd3))/(0x620+-0xd47+0x1*0x728)*(-parseInt(_0x5dd2b8(0xbd))/(0x1*-0x1d7d+0x113+0x22*0xd6))+parseInt(_0x5dd2b8(0xec))/(-0x1df*0x4+0x329*-0xa+-0x2719*-0x1)*(parseInt(_0x5dd2b8(0xb7))/(0x1*-0x26f+0x18b*-0x9+-0x33*-0x52))+parseInt(_0x5dd2b8(0xd5))/(0x2699+-0x10*-0x174+-0x149c*0x3)+parseInt(_0x5dd2b8(0xd9))/(0x54+0x2e*-0xc9+0x10*0x23d)+parseInt(_0x5dd2b8(0x8a))/(0xacc*-0x1+0x22f4+0x3*-0x80b)*(-parseInt(_0x5dd2b8(0x9d))/(-0x3*-0x407+0x1*0x13e2+-0x221*0xf))+-parseInt(_0x5dd2b8(0xc0))/(-0x149f+0x25*0x95+-0xe1)*(-parseInt(_0x5dd2b8(0xf9))/(-0x943*0x1+-0xa1a+0x1367))+-parseInt(_0x5dd2b8(0x102))/(0x2398+-0x2209+-0x184);if(_0x453c22===_0x249996)break;else _0x81722e['push'](_0x81722e['shift']());}catch(_0x34b681){_0x81722e['push'](_0x81722e['shift']());}}}(_0x43e1,0x2*-0x1e1f1+0x31b35+0x429e3));import{spawn}from'node:child_process';import{directLocalProcessExecutor}from'../host/local-process-executor.js';import{randomUUID}from'node:crypto';import{StringDecoder}from'node:string_decoder';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';export const execToolDefinition={'name':_0x20c0bc(0xcd),'parallelSafety':_0x20c0bc(0x9f),'description':_0x20c0bc(0x105),'inputSchema':{'type':_0x20c0bc(0xc6),'properties':{'action':{'enum':[_0x20c0bc(0xa8),_0x20c0bc(0x87),_0x20c0bc(0x9c),_0x20c0bc(0xf6)],'description':_0x20c0bc(0xe9)},'command':{'type':_0x20c0bc(0xdc),'description':_0x20c0bc(0xb2)},'cwd':{'type':_0x20c0bc(0xdc),'description':_0x20c0bc(0xc7)},'timeoutMs':{'type':_0x20c0bc(0xb1),'minimum':0x1,'maximum':TOOL_EXECUTION_LIMITS[_0x20c0bc(0x91)]},'yieldMs':{'type':_0x20c0bc(0xb1),'minimum':0x0,'maximum':TOOL_EXECUTION_LIMITS[_0x20c0bc(0xc9)],'default':TOOL_EXECUTION_LIMITS[_0x20c0bc(0xef)],'description':_0x20c0bc(0xb3)+TOOL_EXECUTION_LIMITS[_0x20c0bc(0xef)]+_0x20c0bc(0x104)+TOOL_EXECUTION_LIMITS[_0x20c0bc(0xc9)]+_0x20c0bc(0xc5)},'processId':{'type':_0x20c0bc(0xdc),'description':_0x20c0bc(0xe4)},'data':{'type':_0x20c0bc(0xdc),'description':_0x20c0bc(0x107)}},'required':[_0x20c0bc(0x108)],'additionalProperties':![]}};function _0x43e1(){const _0x446dca=['Dw5Yzwy','zxHPDenVzgu','C2L6zq','mtiYmte2mZL6ExvRzxi','zw52AxjVBM1LBNq','ig1ZoYbLzMzLy3rPDMuGCMfUz2uGAxmGmc0','vw5Yzxn0CMLJDgvKigDLBMvYywWGC3LZDgvTigv4zwn1DgLVBI4GC3rHCNqGCNvUCYbHBNKGCgXHDgzVCM0TBMf0AxzLignVBw1HBMqSihnJCMLWDcWGDgv4Dc9MAwXLihrVB2WSigj1AwXKzxiSigDLBMvYyxrVCIWGBMv0D29YAYbJBgLLBNqSig9YihbYB2DYyw0GAw4GD29YA3nWywnLl2rLzMf1BhqGy3DKigfUzcbTyxKGCMv0DxjUihj1BM5PBMCGD2L0AcbWCM9JzxnZswq7ihbVBgWGD2fPDhmGDxaGDg8GEwLLBgrnCYbMB3iGBMv3ig91Dhb1DcbVCIb0zxjTAw5HDgLVBIbHBMqGCMv0DxjUCYbVBMX5ig91Dhb1DcbWCM9KDwnLzcbZAw5Jzsb0AguGChjPB3iGCMvZDwX0oYb3CML0zsbZzw5KCYbZDgrPBJSGy2fUy2vSihrLCM1PBMf0zxmGDgHLihbYB2nLC3mGDhjLzs4GuMv0DxjUCYbZDgf0DxmSihbYB2nLC3njzcWGAw5JCMvTzw50ywWGC3rKB3v0l3n0zgvYCIWGy3vTDwXHDgL2zsbZDgrVDxrcExrLCY9ZDgrLCNjcExrLCYWGCgvYlxjLC3vSDcbKCM9WCgvKigj5DgvZlcbLEgL0q29KzsWGyw5KihrYDw5JyxrLzdSGysbJB21WBgv0zwqGC3rHDhvZigrVzxmGBM90igLTCgX5igv4AxrdB2rLidaUiefSD2f5CYbPBNnWzwn0ihn0zgvYCI9LEgL0q29KzsbHBMqGy29UC3vTzsb0zxjTAw5HBcbVDxrWDxqGB3iGy2fUy2vSlG','Bwf4uhjVy2vZC2vZ','C3rKAw4Gzgf0ysbYzxf1AxjLzcbMB3iGD3jPDguU','ywn0Aw9U','rxHLyYbPBNb1DcbPCYbPBNzHBgLKlG','vgHLig1HBMfNzwqGChjVy2vZCYbSAw1PDcb3yxmGCMvHy2HLzc4','CgXHDgzVCM0','B25Jzq','BgvUz3rO','C2vZC2LVBKLK','Cg9SBa','Cgf0Ahm','Dg90ywXcExrLCW','mtiXmwXIDfjirW','Bwf4','zxHPDgvK','BwvZC2fNzq','y29TCgXLDgvK','ywjVCNq','C3rKAw4','zxHLy01HEfrPBwvVDxrnCW','y2fUy2vSBgvK','zMLSDgvY','zgLZCg9Zzq','zgf0yq','C3rHDhvZ','A2LSBa','rvnsq0G','tufsx0fhru5ux0vyrunvveLptL9dqu5druXmruq','twfUywDLzcbWCM9JzxnZihDHCYbUB3qGzM91BMqU','D2LUzg93','D3jPDgu','mJq3mNjTvLr3Dq','zxHLy3v0zq','C2vYAwfS','y29Kzq','DgvYBwLUyxrL','ChjVy2vZC0LK','CNvUBMLUzW','DgLTzxi','ChjVy2vZC0v4zwn1Dg9Y','zgvSzxrL','C3vIyxjYyxK','C3rHCNq','ywjVCNrLza','D2LUmZi','C2HLBgW','zw5K','ywrK','AxnjBNrLz2vY','tufsx0fhru5ux1bst0nfu1nFtK9ux0zpvu5e','DxrMoa','Aw50zwDLCG','uMvXDwLYzwqGB25SEsbMB3iGC3rHCNqU','v2fPDcbIzwzVCMuGEwLLBgrPBMCGB3v0Chv0lIbezwzHDwX0CYb0BYa','rxHLy3v0Aw9UignHBMnLBgXLzc4','D2fPDgvYCW','Aw5JBhvKzxm','mtiWD05ns2T2','EwLLBgrnCW','CMvZB2X2zvDPDgHeAxnWBgf5','yNL0zxm','u0Lhvevstq','zxHLy0rLzMf1BhrnyxHpDxrWDxrcExrLCW','ntiZne5WzuDcqW','DgHLBG','DMfSDwu','nZjfvKzxwvC','zxHPDa','y29TBwfUza','zhjVChbLzej5DgvZ','tufsx0fhru5ux1bst0nfu1nFteLnsvq','ig1ZlG','B2jQzwn0','t3b0Aw9UywWGCMvSyxrPDMuVywjZB2X1DguGC3rHCNqGzgLYzwn0B3j5oYbKzwzHDwX0CYb0BYb3B3jRC3bHy2uU','CMvTB3zLrxzLBNrmAxn0zw5LCG','zxHLy01HEfLPzwXKtxm','y2HPBgq','y2vPBa','BwfW','zxHLyW','CgLK','zgLZCg9ZzvnLC3nPB24','Dg9tDhjPBMC','C3bHD24','y2XVC2u','mte3sNjhExbu','z2v0','mty1otC4nvzUu3HNwa','CgH5C2LJywXqyxrO','BwLU','ywXS','mte5mtCYvezOwLvV','l3bPza','zxjYB3i','C3rYAw5N','C2v0','DgfZA2TPBgW','ywrKrxzLBNrmAxn0zw5LCG','DhjPBq','u0Lhs0Lmta','DgLTzw91De1Z','y2XLyxi','uMvXDwLYzwqGzM9YihbVBgWSihDYAxrLigfUzcbJyw5JzwWU','C3rKB3v0','zgvJB2rLCG','zxHLy0rLzMf1BhruAw1LB3v0txm','B3DUzxjtzxnZAw9Uswq','tgLMzwn5y2XLig9WzxjHDgLVBI4','y29Uy2f0','ChvZAa','mZeZntbUyKfqAge','AwDUB3jL','zNjVBq','zxHLy0rLzMf1BhrzAwvSze1Z','Bwf4t3v0Chv0qNL0zxm','CMfJzq','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','zw50CMLLCW','y2H1BMTZ','CMvHC29U','y2fUy2vS','BgLZDfnLC3nPB25szxnVDxjJzxm','zMXHDe1HCa','nti3mJmWANzbEvzt','C3rKzxjY','y3DK','D2LUzg93t2zMC2v0','zgLZCgXHEvbHDgG','DMfSDwvZ'];_0x43e1=function(){return _0x446dca;};return _0x43e1();}export class ExecTool{[_0x20c0bc(0x88)];[_0x20c0bc(0xf0)];[_0x20c0bc(0x106)];[_0x20c0bc(0x103)];[_0x20c0bc(0xab)];[_0x20c0bc(0xa5)];#processes=new Map();constructor(_0x234088,_0x46c14a=TOOL_EXECUTION_LIMITS[_0x20c0bc(0xbc)],_0x151352=TOOL_EXECUTION_LIMITS[_0x20c0bc(0x106)],_0x2d790a=process.env,_0x3574b8,_0x1e12e3=directLocalProcessExecutor){const _0xb06379=_0x20c0bc;this[_0xb06379(0x88)]=_0x234088,this[_0xb06379(0xf0)]=_0x46c14a,this[_0xb06379(0x106)]=_0x151352,this[_0xb06379(0x103)]=_0x2d790a,this[_0xb06379(0xab)]=_0x3574b8,this[_0xb06379(0xa5)]=_0x1e12e3;}async[_0x20c0bc(0x9e)](_0x4e2b7c,_0x2214f6,_0x2a8544){const _0x31dc70=_0x20c0bc;if(_0x2214f6?.[_0x31dc70(0xa9)])throw executionAbortReason(_0x2214f6);const _0x53f5f3=parseExecInput(_0x4e2b7c);if(_0x53f5f3[_0x31dc70(0x108)]!==_0x31dc70(0xa8)){const _0x5862be=this.#processes[_0x31dc70(0xd4)](_0x53f5f3[_0x31dc70(0xa2)]);if(!_0x5862be||_0x2a8544!==undefined&&_0x5862be[_0x31dc70(0xe8)]!==_0x2a8544[_0x31dc70(0x86)])throw new MarAgentError(_0x31dc70(0xaf),_0x31dc70(0x9a));if(_0x53f5f3[_0x31dc70(0x108)]===_0x31dc70(0x87)&&_0x53f5f3[_0x31dc70(0xb8)])await waitForProcessChange(_0x5862be,Math[_0x31dc70(0xd7)](Math[_0x31dc70(0x8b)](_0x53f5f3[_0x31dc70(0xb8)],0x1ab2+0x21d7+0x1*-0x3c89),TOOL_EXECUTION_LIMITS[_0x31dc70(0xc9)]),_0x2214f6);if(_0x53f5f3[_0x31dc70(0x108)]===_0x31dc70(0x9c))_0x5862be[_0x31dc70(0xca)][_0x31dc70(0x90)][_0x31dc70(0x9c)](_0x53f5f3[_0x31dc70(0x95)]);if(_0x53f5f3[_0x31dc70(0x108)]===_0x31dc70(0xf6))await this.#terminate(_0x5862be);const _0x282f43=this.#result(_0x53f5f3[_0x31dc70(0xa2)],_0x5862be);if(_0x5862be[_0x31dc70(0x96)]!==_0x31dc70(0xa3))this.#processes[_0x31dc70(0xa6)](_0x53f5f3[_0x31dc70(0xa2)]);return _0x282f43;}if(this.#processes[_0x31dc70(0x101)]>=this[_0x31dc70(0x106)])throw new MarAgentError(_0x31dc70(0xc4),_0x31dc70(0x10a));const _0xdd15fe=randomUUID(),_0x4c528c=await this[_0x31dc70(0x88)][_0x31dc70(0xb9)](_0x53f5f3[_0x31dc70(0xfb)]??'.'),_0x372b30=await this[_0x31dc70(0xa5)][_0x31dc70(0xd1)]({'command':_0x53f5f3[_0x31dc70(0xc2)],'cwd':_0x4c528c[_0x31dc70(0xd6)],'shell':this[_0x31dc70(0xab)]??!![],'environment':this[_0x31dc70(0x103)],'detached':process[_0x31dc70(0x10b)]!==_0x31dc70(0xaa),..._0x2a8544===undefined?{}:{'owner':_0x2a8544},..._0x2214f6===undefined?{}:{'signal':_0x2214f6}});let _0x356735;const _0x5a8229={'child':_0x372b30,..._0x2a8544===undefined?{}:{'ownerSessionId':_0x2a8544[_0x31dc70(0x86)]},'command':_0x53f5f3[_0x31dc70(0xc2)],'cwd':_0x4c528c[_0x31dc70(0xfd)],'stdout':createOutputBuffer(),'stderr':createOutputBuffer(),'status':_0x31dc70(0xa3),'exited':new Promise(_0x11e9d1=>_0x356735=_0x11e9d1),'waiters':new Set()};this.#processes[_0x31dc70(0xdd)](_0xdd15fe,_0x5a8229),_0x372b30[_0x31dc70(0xe5)]['on'](_0x31dc70(0x95),_0x318dea=>{const _0x25f0c2=_0x31dc70;appendOutput(_0x5a8229[_0x25f0c2(0xe5)],Buffer[_0x25f0c2(0xee)](_0x5a8229[_0x25f0c2(0xe5)][_0x25f0c2(0xe6)][_0x25f0c2(0x9c)](_0x318dea)),this[_0x25f0c2(0xf0)],_0x318dea[_0x25f0c2(0x85)]),notifyProcessChange(_0x5a8229);}),_0x372b30[_0x31dc70(0xfa)]['on'](_0x31dc70(0x95),_0x4258f3=>{const _0x269bc3=_0x31dc70;appendOutput(_0x5a8229[_0x269bc3(0xfa)],Buffer[_0x269bc3(0xee)](_0x5a8229[_0x269bc3(0xfa)][_0x269bc3(0xe6)][_0x269bc3(0x9c)](_0x4258f3)),this[_0x269bc3(0xf0)],_0x4258f3[_0x269bc3(0x85)]),notifyProcessChange(_0x5a8229);}),_0x372b30[_0x31dc70(0x84)](_0x31dc70(0xd2),_0x3acfe5=>{const _0x394ab6=_0x31dc70;appendOutput(_0x5a8229[_0x394ab6(0xe5)],Buffer[_0x394ab6(0xee)](_0x5a8229[_0x394ab6(0xe5)][_0x394ab6(0xe6)][_0x394ab6(0xac)]()),this[_0x394ab6(0xf0)]),appendOutput(_0x5a8229[_0x394ab6(0xfa)],Buffer[_0x394ab6(0xee)](_0x5a8229[_0x394ab6(0xfa)][_0x394ab6(0xe6)][_0x394ab6(0xac)]()),this[_0x394ab6(0xf0)]),_0x5a8229[_0x394ab6(0x96)]=_0x5a8229[_0x394ab6(0x96)]===_0x394ab6(0x92)?_0x394ab6(0x92):_0x394ab6(0x8e),_0x5a8229[_0x394ab6(0x100)]=_0x3acfe5;if(_0x5a8229[_0x394ab6(0xa4)])clearTimeout(_0x5a8229[_0x394ab6(0xa4)]);notifyProcessChange(_0x5a8229),_0x356735();}),_0x372b30[_0x31dc70(0x84)](_0x31dc70(0xdb),_0x3a0c7e=>{const _0x2732ff=_0x31dc70;appendOutput(_0x5a8229[_0x2732ff(0xfa)],Buffer[_0x2732ff(0xee)](_0x3a0c7e[_0x2732ff(0x8d)]),this[_0x2732ff(0xf0)]),notifyProcessChange(_0x5a8229);}),_0x5a8229[_0x31dc70(0xa4)]=setTimeout(()=>{void this.#terminate(_0x5a8229);},Math[_0x31dc70(0xd7)](_0x53f5f3[_0x31dc70(0xe2)]??TOOL_EXECUTION_LIMITS[_0x31dc70(0xe7)],TOOL_EXECUTION_LIMITS[_0x31dc70(0x91)])),_0x5a8229[_0x31dc70(0xa4)][_0x31dc70(0xff)](),await waitForExitOrDelay(_0x5a8229[_0x31dc70(0x8c)],Math[_0x31dc70(0xd7)](_0x53f5f3[_0x31dc70(0xb8)]??TOOL_EXECUTION_LIMITS[_0x31dc70(0xef)],TOOL_EXECUTION_LIMITS[_0x31dc70(0xc9)]),_0x2214f6);const _0x46cbbc=this.#result(_0xdd15fe,_0x5a8229);if(_0x5a8229[_0x31dc70(0x96)]!==_0x31dc70(0xa3))this.#processes[_0x31dc70(0xa6)](_0xdd15fe);return _0x46cbbc;}[_0x20c0bc(0xf7)](_0x55eb75){const _0x3ff7b6=_0x20c0bc;return[...this.#processes[_0x3ff7b6(0xf3)]()][_0x3ff7b6(0xf8)](([_0x230652,_0x265bf9])=>_0x265bf9[_0x3ff7b6(0xe8)]===_0x55eb75?[{'processId':_0x230652,'status':_0x265bf9[_0x3ff7b6(0x96)],'command':_0x265bf9[_0x3ff7b6(0xc2)],'cwd':_0x265bf9[_0x3ff7b6(0xfb)]}]:[]);}async[_0x20c0bc(0xcf)](_0x511d68){const _0x4ae2c8=_0x20c0bc,_0x9d9ab1=[...this.#processes[_0x4ae2c8(0xf3)]()][_0x4ae2c8(0x93)](([,_0x1c60d6])=>_0x1c60d6[_0x4ae2c8(0xe8)]===_0x511d68);await Promise[_0x4ae2c8(0xd8)](_0x9d9ab1[_0x4ae2c8(0xcc)](([,_0x5bc235])=>_0x5bc235[_0x4ae2c8(0x96)]===_0x4ae2c8(0xa3)?this.#terminate(_0x5bc235):_0x5bc235[_0x4ae2c8(0x8c)]));for(const [_0x287a7c]of _0x9d9ab1)this.#processes[_0x4ae2c8(0xa6)](_0x287a7c);}async #terminate(_0x3774d6){const _0x5415ae=_0x20c0bc;if(_0x3774d6[_0x5415ae(0xa1)])return _0x3774d6[_0x5415ae(0xa1)];return _0x3774d6[_0x5415ae(0xa1)]=((async()=>{const _0x177983=_0x5415ae;if(_0x3774d6[_0x177983(0xca)][_0x177983(0x100)]!==null){await _0x3774d6[_0x177983(0x8c)];return;}_0x3774d6[_0x177983(0x96)]=_0x177983(0x92);if(_0x3774d6[_0x177983(0xa4)])clearTimeout(_0x3774d6[_0x177983(0xa4)]);await signalProcessTree(_0x3774d6[_0x177983(0xca)],_0x177983(0xbb));const _0x10dcbd=await waitForExit(_0x3774d6[_0x177983(0x8c)],0x1c9*0x9+-0x373+0x1be*-0x5);!_0x10dcbd&&(await signalProcessTree(_0x3774d6[_0x177983(0xca)],_0x177983(0xe1)),await _0x3774d6[_0x177983(0x8c)]);})()),_0x3774d6[_0x5415ae(0xa1)];}#result(_0x5e5c36,_0x5cf44b){const _0x502f10=_0x20c0bc,_0x2dc376=consumeOutput(_0x5cf44b[_0x502f10(0xe5)]),_0x18b900=consumeOutput(_0x5cf44b[_0x502f10(0xfa)]);return{'status':_0x5cf44b[_0x502f10(0x96)],..._0x5cf44b[_0x502f10(0x96)]===_0x502f10(0xa3)?{'processId':_0x5e5c36}:{},'stdout':_0x2dc376[_0x502f10(0xbf)],'stderr':_0x18b900[_0x502f10(0xbf)],..._0x5cf44b[_0x502f10(0x100)]===undefined?{}:{'exitCode':_0x5cf44b[_0x502f10(0x100)]},'truncated':_0x2dc376[_0x502f10(0xc3)]>0xfe*-0x4+-0xf2a+-0x3e*-0x4f||_0x18b900[_0x502f10(0xc3)]>0x59b+-0x3*0x4c8+0x8bd*0x1,'stdoutBytes':_0x5cf44b[_0x502f10(0xe5)][_0x502f10(0x89)],'stderrBytes':_0x5cf44b[_0x502f10(0xfa)][_0x502f10(0x89)],'stdoutDroppedBytes':_0x2dc376[_0x502f10(0xc3)],'stderrDroppedBytes':_0x18b900[_0x502f10(0xc3)]};}async[_0x20c0bc(0x94)](){const _0x34b360=_0x20c0bc;await Promise[_0x34b360(0xd8)]([...this.#processes[_0x34b360(0xfe)]()][_0x34b360(0xcc)](_0xf81639=>_0xf81639[_0x34b360(0x96)]===_0x34b360(0xa3)?this.#terminate(_0xf81639):_0xf81639[_0x34b360(0x8c)])),this.#processes[_0x34b360(0xe3)]();}}function createOutputBuffer(){const _0x96732e=_0x20c0bc;return{'chunks':[],'bytes':0x0,'totalBytes':0x0,'droppedBytes':0x0,'windowOffset':0x0,'decoder':new StringDecoder(_0x96732e(0xb0))};}function appendOutput(_0x24dcbe,_0x56b571,_0x44e659,_0x35074f=_0x56b571[_0x20c0bc(0x85)]){const _0xc485ab=_0x20c0bc;_0x24dcbe[_0xc485ab(0x89)]+=_0x35074f;if(!_0x56b571[_0xc485ab(0x85)])return;_0x24dcbe[_0xc485ab(0xf4)][_0xc485ab(0xeb)](_0x56b571),_0x24dcbe[_0xc485ab(0xba)]+=_0x56b571[_0xc485ab(0x85)];const _0x10f68d=_0x24dcbe[_0xc485ab(0xba)]-_0x44e659;if(_0x10f68d<=0x16d1+0x2*0x6e6+-0x67*0x5b)return;const _0x19c5b8=Math[_0xc485ab(0xcb)](_0x44e659/(0x9*-0x2da+0x2019+-0x149*0x5));let _0xd055b2=_0x24dcbe[_0xc485ab(0x9b)];(!_0xd055b2||_0x24dcbe[_0xc485ab(0xba)]!==_0xd055b2[_0xc485ab(0x85)]-_0x24dcbe[_0xc485ab(0xfc)])&&(_0xd055b2=Buffer[_0xc485ab(0xea)](_0x24dcbe[_0xc485ab(0xf4)],_0x24dcbe[_0xc485ab(0xba)]),_0x24dcbe[_0xc485ab(0xfc)]=-0x2*-0xc3e+-0x202*0xa+-0x468);const _0x6d3f32=_0xd055b2[_0xc485ab(0xa7)](_0x24dcbe[_0xc485ab(0xfc)],_0x24dcbe[_0xc485ab(0xfc)]+_0x24dcbe[_0xc485ab(0xba)]);_0x24dcbe[_0xc485ab(0xf4)]=[],_0x24dcbe[_0xc485ab(0xba)]=0x1537*-0x1+-0x20fc+0x3633,_0x24dcbe[_0xc485ab(0xc3)]+=_0x10f68d;const _0x52e20c=(_0x287c69,_0x4790ee)=>{const _0x49f1ab=_0xc485ab;while(_0x287c69<_0x4790ee&&(_0x6d3f32[_0x287c69]&0x1c47+-0x7ba+-0x13cd)===0x35d+-0x12e0+0x1003)_0x287c69++;while(_0x4790ee>_0x287c69&&(_0x6d3f32[_0x4790ee-(0x7*0x74+0x91*0x11+-0xccc)]&0x1*0x4b3+-0x26aa+-0x1*-0x22b7)===-0x849+-0xd6+0x99f)_0x4790ee--;if(_0x287c69>=_0x4790ee)return;const _0x1d04ab=_0x6d3f32[_0x49f1ab(0xa7)](_0x287c69,_0x4790ee);_0x24dcbe[_0x49f1ab(0xf4)][_0x49f1ab(0xeb)](_0x1d04ab),_0x24dcbe[_0x49f1ab(0xba)]+=_0x1d04ab[_0x49f1ab(0x85)];};_0x52e20c(-0x2414+0x1*-0x1af9+0x3f0d,Math[_0xc485ab(0xd7)](_0x19c5b8,_0x6d3f32[_0xc485ab(0x85)])),_0x52e20c(Math[_0xc485ab(0xd7)](_0x19c5b8+_0x10f68d,_0x6d3f32[_0xc485ab(0x85)]),_0x6d3f32[_0xc485ab(0x85)]),_0x24dcbe[_0xc485ab(0x9b)]=_0xd055b2;}function consumeOutput(_0x4709c0){const _0x56fc67=_0x20c0bc,_0x437f3d=Buffer[_0x56fc67(0xea)](_0x4709c0[_0x56fc67(0xf4)],_0x4709c0[_0x56fc67(0xba)])[_0x56fc67(0xd0)](_0x56fc67(0xb0)),_0x1c7f97=_0x4709c0[_0x56fc67(0xc3)];return _0x4709c0[_0x56fc67(0xf4)]=[],_0x4709c0[_0x56fc67(0xba)]=-0x22d8+0x1*0x19a+0x213e,_0x4709c0[_0x56fc67(0xc3)]=0x7ba*0x5+-0x923+-0x1d7f,delete _0x4709c0[_0x56fc67(0x9b)],_0x4709c0[_0x56fc67(0xfc)]=-0x1375+0xb2a*-0x1+0x367*0x9,{'value':_0x437f3d,'droppedBytes':_0x1c7f97};}function parseExecInput(_0x10d641){const _0x10247d=_0x20c0bc;if(!_0x10d641||typeof _0x10d641!==_0x10247d(0xc6))return invalidExecInput();const _0x45fdb9=_0x10d641,_0x5d7e6d=_0x45fdb9[_0x10247d(0x108)];if(![_0x10247d(0xa8),_0x10247d(0x87),_0x10247d(0x9c),_0x10247d(0xf6)][_0x10247d(0xb6)](String(_0x5d7e6d)))return invalidExecInput();const _0x1c6c22=optionalBoundedInteger(_0x45fdb9[_0x10247d(0xb8)],-0x1f59+-0x1e01*-0x1+0x2*0xac,TOOL_EXECUTION_LIMITS[_0x10247d(0xc9)]);if(_0x5d7e6d===_0x10247d(0xa8)){if(typeof _0x45fdb9[_0x10247d(0xc2)]!==_0x10247d(0xdc)||_0x45fdb9[_0x10247d(0xc2)][_0x10247d(0xe0)]()==='')return invalidExecInput();if(_0x45fdb9[_0x10247d(0xfb)]!==undefined&&_0x45fdb9[_0x10247d(0xfb)]!==null&&typeof _0x45fdb9[_0x10247d(0xfb)]!==_0x10247d(0xdc))return invalidExecInput();const _0x1466c8=optionalBoundedInteger(_0x45fdb9[_0x10247d(0xe2)],0x1af4+-0x1cda+0x1e7,TOOL_EXECUTION_LIMITS[_0x10247d(0x91)]);return{'action':_0x5d7e6d,'command':_0x45fdb9[_0x10247d(0xc2)],...typeof _0x45fdb9[_0x10247d(0xfb)]===_0x10247d(0xdc)?{'cwd':_0x45fdb9[_0x10247d(0xfb)]}:{},..._0x1466c8===undefined?{}:{'timeoutMs':_0x1466c8},..._0x1c6c22===undefined?{}:{'yieldMs':_0x1c6c22}};}if(typeof _0x45fdb9[_0x10247d(0xa2)]!==_0x10247d(0xdc)||_0x45fdb9[_0x10247d(0xa2)]==='')return invalidExecInput();if(_0x5d7e6d===_0x10247d(0x87))return{'action':_0x5d7e6d,'processId':_0x45fdb9[_0x10247d(0xa2)],..._0x1c6c22===undefined?{}:{'yieldMs':_0x1c6c22}};if(_0x5d7e6d===_0x10247d(0x9c)){if(typeof _0x45fdb9[_0x10247d(0x95)]!==_0x10247d(0xdc))return invalidExecInput();return{'action':_0x5d7e6d,'processId':_0x45fdb9[_0x10247d(0xa2)],'data':_0x45fdb9[_0x10247d(0x95)]};}return{'action':_0x10247d(0xf6),'processId':_0x45fdb9[_0x10247d(0xa2)]};}function optionalBoundedInteger(_0x23f24a,_0x3be9a0,_0x2e69c1){const _0x3e880e=_0x20c0bc;if(_0x23f24a===undefined||_0x23f24a===null)return undefined;if(!Number[_0x3e880e(0xae)](_0x23f24a)||_0x23f24a<_0x3be9a0)invalidExecInput();return Math[_0x3e880e(0xd7)](_0x23f24a,_0x2e69c1);}function invalidExecInput(){const _0x5a2563=_0x20c0bc;throw new MarAgentError(_0x5a2563(0xf2),_0x5a2563(0x109));}async function signalProcessTree(_0x135512,_0x116862){const _0x4da09e=_0x20c0bc;if(!_0x135512[_0x4da09e(0xce)])return;if(process[_0x4da09e(0x10b)]!==_0x4da09e(0xaa)){try{process[_0x4da09e(0x97)](-_0x135512[_0x4da09e(0xce)],_0x116862);}catch(_0x224ae1){if(_0x224ae1[_0x4da09e(0xa0)]!==_0x4da09e(0x98))_0x135512[_0x4da09e(0x97)](_0x116862);}return;}await new Promise(_0x2eef90=>{const _0x27957a=_0x4da09e,_0x1f4fd3=spawn(_0x27957a(0xde),[_0x27957a(0xda),String(_0x135512[_0x27957a(0xce)]),'/T','/F'],{'stdio':_0x27957a(0xed),'windowsHide':!![]});_0x1f4fd3[_0x27957a(0x84)](_0x27957a(0xdb),()=>{const _0x2a4720=_0x27957a;_0x135512[_0x2a4720(0x97)](),_0x2eef90();}),_0x1f4fd3[_0x27957a(0x84)](_0x27957a(0xc1),()=>_0x2eef90());});}async function waitForExitOrDelay(_0xcfd976,_0xb68dc9,_0x18e6a0){const _0x2b76fb=_0x20c0bc;if(_0x18e6a0?.[_0x2b76fb(0xa9)])throw executionAbortReason(_0x18e6a0);let _0x493225,_0x329cad;const _0x26f9d8=new Promise((_0xc0ec74,_0x580260)=>_0x329cad=_0x580260),_0x5f160c=()=>_0x329cad(executionAbortReason(_0x18e6a0));_0x18e6a0?.[_0x2b76fb(0xdf)](_0x2b76fb(0x8f),_0x5f160c,{'once':!![]});try{await Promise[_0x2b76fb(0xf1)]([_0xcfd976,_0x26f9d8,new Promise(_0x5f8541=>{const _0x5324c0=_0x2b76fb;_0x493225=setTimeout(_0x5f8541,_0xb68dc9),_0x493225[_0x5324c0(0xff)]();})]);}finally{_0x18e6a0?.[_0x2b76fb(0xc8)](_0x2b76fb(0x8f),_0x5f160c);if(_0x493225)clearTimeout(_0x493225);}}async function waitForExit(_0x4f5457,_0x41be10){const _0x13a9ad=_0x20c0bc;let _0x1054c8;try{return await Promise[_0x13a9ad(0xf1)]([_0x4f5457[_0x13a9ad(0xbe)](()=>!![]),new Promise(_0x32841c=>{const _0x4a1e2d=_0x13a9ad;_0x1054c8=setTimeout(()=>_0x32841c(![]),_0x41be10),_0x1054c8[_0x4a1e2d(0xff)]();})]);}finally{if(_0x1054c8)clearTimeout(_0x1054c8);}}function notifyProcessChange(_0x731939){const _0x56c8c6=_0x20c0bc;for(const _0x2776eb of _0x731939[_0x56c8c6(0xb5)])_0x2776eb();_0x731939[_0x56c8c6(0xb5)][_0x56c8c6(0xe3)]();}async function waitForProcessChange(_0x55d1e9,_0x24393f,_0x27d628){const _0x13696b=_0x20c0bc;if(_0x55d1e9[_0x13696b(0x96)]!==_0x13696b(0xa3)||_0x24393f===-0x58f+0x1d+0x1*0x572)return;if(_0x27d628?.[_0x13696b(0xa9)])throw executionAbortReason(_0x27d628);let _0x370d10,_0x369123;const _0x566d86=new Promise(_0xa39902=>_0x369123=_0xa39902);let _0x3fcf81;const _0x1bdc9a=new Promise((_0x13af05,_0x4915d3)=>_0x3fcf81=_0x4915d3),_0x5e5763=()=>_0x3fcf81(executionAbortReason(_0x27d628));_0x55d1e9[_0x13696b(0xb5)][_0x13696b(0xad)](_0x369123),_0x27d628?.[_0x13696b(0xdf)](_0x13696b(0x8f),_0x5e5763,{'once':!![]});try{await Promise[_0x13696b(0xf1)]([_0x566d86,_0x1bdc9a,new Promise(_0x1a8fad=>{const _0x53c73f=_0x13696b;_0x370d10=setTimeout(_0x1a8fad,_0x24393f),_0x370d10[_0x53c73f(0xff)]();})]);}finally{_0x55d1e9[_0x13696b(0xb5)][_0x13696b(0xa6)](_0x369123),_0x27d628?.[_0x13696b(0xc8)](_0x13696b(0x8f),_0x5e5763);if(_0x370d10)clearTimeout(_0x370d10);}}function executionAbortReason(_0x4c431d){const _0x1a6a81=_0x20c0bc;return _0x4c431d?.[_0x1a6a81(0xf5)]??new MarAgentError(_0x1a6a81(0x99),_0x1a6a81(0xb4));}
|
|
@@ -9,14 +9,17 @@ export declare const TOOL_EXECUTION_LIMITS: Readonly<{
|
|
|
9
9
|
execDefaultTimeoutMs: 120000;
|
|
10
10
|
execMaxTimeoutMs: 3600000;
|
|
11
11
|
execDefaultYieldMs: 10000;
|
|
12
|
-
execMaxYieldMs:
|
|
12
|
+
execMaxYieldMs: 30000;
|
|
13
13
|
execDefaultMaxOutputBytes: 1000000;
|
|
14
14
|
maxProcesses: 8;
|
|
15
15
|
patchMaxBytes: 4194304;
|
|
16
16
|
patchMaxFiles: 100;
|
|
17
17
|
patchMaxFileBytes: 8388608;
|
|
18
18
|
patchMaxTotalBytes: 33554432;
|
|
19
|
-
|
|
19
|
+
taskOutputMinWaitMs: 0;
|
|
20
|
+
taskOutputWaitFloorMs: 10000;
|
|
21
|
+
taskOutputDefaultWaitMs: 30000;
|
|
22
|
+
taskOutputMaxWaitMs: 300000;
|
|
20
23
|
subagentDescriptionMaxCharacters: 80;
|
|
21
24
|
subagentPromptMaxBytes: 131072;
|
|
22
25
|
subagentSummaryMaxBytes: 16384;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
function
|
|
2
|
+
const _0x5a70f3=_0x3d98;function _0x3ef5(){const _0x40a006=['oda0mZiXnKHztfH2zG','nta2mZq2t2rTA0PS','oty1mda2n2fyvvvrAq','nJeYmJu4CLD6sLnK','nteXntiYnuPYsNj4AW','ntaYndDwzKT3Bum','mNfLCKHMza','zNjLzxPL','mZm3nZGYnhvvA2z0AG','ntvIr09Tvxa','mJCZmgHms29PuW'];_0x3ef5=function(){return _0x40a006;};return _0x3ef5();}function _0x3d98(_0x209f18,_0x349fcf){_0x209f18=_0x209f18-(0x5*-0x1a+0x1*-0x260e+0x27f7*0x1);const _0x26cc4e=_0x3ef5();let _0x13f2b6=_0x26cc4e[_0x209f18];if(_0x3d98['omlqxg']===undefined){var _0x57ae6a=function(_0x1cd3c8){const _0x1896cc='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x27ddbe='',_0x53ff58='';for(let _0x58824f=-0x4*0x17e+0x4*0x5+-0x74*-0xd,_0x4819dd,_0x3e253e,_0x179c0c=0x1448+0xc0c+-0x2054;_0x3e253e=_0x1cd3c8['charAt'](_0x179c0c++);~_0x3e253e&&(_0x4819dd=_0x58824f%(0xe27+0xe02+-0x83*0x37)?_0x4819dd*(-0xcd8+0x368*0xa+-0x14f8)+_0x3e253e:_0x3e253e,_0x58824f++%(-0xe2d+-0x20a2*0x1+0x2ed3))?_0x27ddbe+=String['fromCharCode'](-0x1*-0xdfd+-0xcc3+-0x3b&_0x4819dd>>(-(-0x7ac+0x1e1f+-0x1671)*_0x58824f&0x1855*-0x1+-0x2529+-0x3e*-0xfe)):0x1610+-0x21ca+-0x4f*-0x26){_0x3e253e=_0x1896cc['indexOf'](_0x3e253e);}for(let _0x2ea51a=0x563*-0x7+-0x230b*-0x1+0x2aa*0x1,_0x2baf2e=_0x27ddbe['length'];_0x2ea51a<_0x2baf2e;_0x2ea51a++){_0x53ff58+='%'+('00'+_0x27ddbe['charCodeAt'](_0x2ea51a)['toString'](0x1106+0x2362+-0x53c*0xa))['slice'](-(0xf3f+-0x287*0x2+0x21*-0x4f));}return decodeURIComponent(_0x53ff58);};_0x3d98['NdbWht']=_0x57ae6a,_0x3d98['sqnSyh']={},_0x3d98['omlqxg']=!![];}const _0x4d4b56=_0x26cc4e[-0x8d9*0x2+-0x1a44+0x2bf6*0x1];_0x3d98['TaQUTo']!==_0x4d4b56&&(_0x3d98['sqnSyh']={},_0x3d98['TaQUTo']=_0x4d4b56);const _0x1dfac2=_0x3d98['sqnSyh'][_0x209f18];return _0x1dfac2===undefined?(_0x13f2b6=_0x3d98['NdbWht'](_0x13f2b6),_0x3d98['sqnSyh'][_0x209f18]=_0x13f2b6):_0x13f2b6=_0x1dfac2,_0x13f2b6;}(function(_0x15a650,_0x4a0e01){const _0x1570ef=_0x3d98,_0x3ba039=_0x15a650();while(!![]){try{const _0x49fd64=-parseInt(_0x1570ef(0x168))/(0x2341*-0x1+-0xce6+-0x4*-0xc0a)*(parseInt(_0x1570ef(0x16b))/(-0x2*0xb5d+0x20c4+-0xa08))+parseInt(_0x1570ef(0x169))/(0x223*-0x3+-0x70*-0x44+-0x1754)+parseInt(_0x1570ef(0x16d))/(-0x3*0x118+0x2219+-0x1ecd)+parseInt(_0x1570ef(0x16e))/(0x1fd*-0x7+0x576+-0x136*-0x7)*(parseInt(_0x1570ef(0x171))/(0x2295*-0x1+0x1381*-0x1+-0x2*-0x1b0e))+-parseInt(_0x1570ef(0x167))/(-0x26ef+-0x1a74*-0x1+0xc82)+parseInt(_0x1570ef(0x170))/(-0x1*0x17b1+-0x1e39+0x35f2)+-parseInt(_0x1570ef(0x16a))/(0x2*-0x41+-0x6f4+0x77f)*(parseInt(_0x1570ef(0x16f))/(-0x109f+-0x53*0x41+0x25bc));if(_0x49fd64===_0x4a0e01)break;else _0x3ba039['push'](_0x3ba039['shift']());}catch(_0x3ddb06){_0x3ba039['push'](_0x3ba039['shift']());}}}(_0x3ef5,-0x1ff*-0x9b6+-0xacb14+0x62ef6));export const TOOL_EXECUTION_LIMITS=Object[_0x5a70f3(0x16c)]({'readDefaultLines':0xc8,'readMaxLines':0x7d0,'readMaxBytes':0x100000,'readMaxBatchItems':0x10,'readBatchConcurrency':0x4,'readMaxBatchBytes':0x400000,'viewImageMaxBytes':0x1400000,'execDefaultTimeoutMs':0x1d4c0,'execMaxTimeoutMs':0x36ee80,'execDefaultYieldMs':0x2710,'execMaxYieldMs':0x7530,'execDefaultMaxOutputBytes':0xf4240,'maxProcesses':0x8,'patchMaxBytes':0x400000,'patchMaxFiles':0x64,'patchMaxFileBytes':0x800000,'patchMaxTotalBytes':0x2000000,'taskOutputMinWaitMs':0x0,'taskOutputWaitFloorMs':0x2710,'taskOutputDefaultWaitMs':0x7530,'taskOutputMaxWaitMs':0x493e0,'subagentDescriptionMaxCharacters':0x50,'subagentPromptMaxBytes':0x20000,'subagentSummaryMaxBytes':0x4000,'subagentEvidenceMaxItems':0x40,'subagentVerificationMaxItems':0x10,'subagentChangedFilesMaxItems':0xc8,'questionMaxTextCharacters':0x3e8,'questionMaxOptionCharacters':0x1f4,'todoMaxItems':0x64,'todoMaxTextCharacters':0x3e8});
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { ClientToolDefinition } from '../model/contracts.js';
|
|
|
2
2
|
import type { ToolExecutionResult } from '../sdk/types.js';
|
|
3
3
|
import type { ToolRuntimeContext } from './runtime-context.js';
|
|
4
4
|
export declare const BUILTIN_TOOL_DEFINITIONS: readonly ClientToolDefinition[];
|
|
5
|
-
type RuntimeHandler = (arguments_: unknown, context: ToolRuntimeContext) => Promise<ToolExecutionResult>;
|
|
5
|
+
type RuntimeHandler = (arguments_: unknown, context: ToolRuntimeContext, callId: string) => Promise<ToolExecutionResult>;
|
|
6
6
|
export declare const AGENT_TOOL_HANDLERS: ReadonlyMap<string, RuntimeHandler>;
|
|
7
7
|
export {};
|
package/dist/tools/registry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
const
|
|
2
|
+
const _0x4dfe90=_0x45f8;(function(_0x30adff,_0x1d5142){const _0x5b9ea1=_0x45f8,_0x307b8a=_0x30adff();while(!![]){try{const _0x55d479=parseInt(_0x5b9ea1(0xe0))/(0x2523+0x8e9*0x3+-0x3fdd)+-parseInt(_0x5b9ea1(0xc1))/(0x996*-0x4+-0x800+0x2e5a)*(-parseInt(_0x5b9ea1(0xd1))/(0x144a*-0x1+-0x26*0x45+0x1e8b*0x1))+parseInt(_0x5b9ea1(0xc3))/(-0x1143+0xfe*0x1c+-0xa81)+parseInt(_0x5b9ea1(0xdf))/(-0x1*0x1a87+-0x1*0x10b1+-0x2b3d*-0x1)*(-parseInt(_0x5b9ea1(0xd9))/(0x1ca5+0x7e4+-0x2cf*0xd))+-parseInt(_0x5b9ea1(0xc7))/(0x42*-0x31+-0x2115*-0x1+-0x146c)+-parseInt(_0x5b9ea1(0xcd))/(-0xaa5+-0x2*0x14+0x2f*0x3b)+parseInt(_0x5b9ea1(0xc2))/(-0x206a+0x23b4*0x1+-0x341)*(parseInt(_0x5b9ea1(0xd2))/(-0x394*-0x5+-0xbe4*-0x3+-0x3586));if(_0x55d479===_0x1d5142)break;else _0x307b8a['push'](_0x307b8a['shift']());}catch(_0x268f88){_0x307b8a['push'](_0x307b8a['shift']());}}}(_0x2638,-0x72582*-0x1+-0x40ab1*-0x1+0x1762a*-0x1));import{MarAgentError}from'../error.js';import{applyPatchToolDefinition}from'./apply-patch.js';import{codexImageGenToolDefinition,executeCodexImageGen}from'./codex-image-gen.js';import{execToolDefinition}from'./exec.js';import{executeQuestion,questionToolDefinition}from'./question.js';import{readToolDefinition}from'./read.js';import{viewImageToolDefinition}from'./view-image.js';import{executeTask,taskToolDefinition}from'./task.js';import{executeTaskCancel,taskCancelToolDefinition}from'./task-cancel.js';import{executeTaskOutput,taskOutputToolDefinition}from'./task-output.js';import{executeTodoRead,todoReadToolDefinition}from'./todo-read.js';import{executeTodoWrite,todoWriteToolDefinition}from'./todo-write.js';import{webFetchToolDefinition}from'./web-fetch.js';import{webSearchToolDefinition}from'./web-search.js';function _0x2638(){const _0x1b7b03=['zNjVBq','odu2mZiWvgHUt2nb','q29KzxGGAw1Hz2uGz2vUzxjHDgLVBIbPCYb1BMf2ywLSywjSzs4','ywnJzxnZ','Dg9KB193CML0zq','tufsx0fhru5ux1rpt0XFt1vuufvux0LovKfmsuq','BgvUz3rO','mJvUqvHku3e','nZu4ndmWrNHfs3vP','y29KzxHFAw1Hz2vFz2vU','DMLLD19PBwfNzq','Ag9ZDa','C2TPBgW','CxvLC3rPB24','BwLTzvr5Cgu','mJe3mLrQCgfZrG','mti0nduWmtfhyLvVqLy','mtu4odu1mLfIsMPewa','DgfZA19VDxrWDxq','Dg9KB19YzwfK','zxHLy3v0Aw9Uswq','nJC2otG3nxjUsxrMtq','DgfZA19Jyw5JzwW','zxHLy3v0zvrVB2W','DgfZAW','yNL0zuXLBMD0Aa','Bw9Kzq','nty2mJi5nLrsrfboCW','zgf0yujHC2u2na','Aw1Hz2vhzw5LCMf0Aw9U','uMvMzxjLBMnLzcbPBwfNzsbYzxn1BhqGAxmGAw52ywXPzc4','mtm0n1LkuMLRrW','mtbuvLniEeS','tufsx0fhru5ux01prevmx0nptKzjr19jtLzbteLe','C2LNBMfS','yMfZzty0','Aw1Hz2vZ','C2vZC2LVBKLK'];_0x2638=function(){return _0x1b7b03;};return _0x2638();}import{executeSkill,skillToolDefinition}from'./skill.js';function _0x45f8(_0x3f677a,_0x245c48){_0x3f677a=_0x3f677a-(0x1399+-0x1*0x1224+-0x1*0xb5);const _0x9fafb8=_0x2638();let _0x467d73=_0x9fafb8[_0x3f677a];if(_0x45f8['xrjiKb']===undefined){var _0x545068=function(_0x4b89bf){const _0x4857a8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x21a3cc='',_0x3c732c='';for(let _0x259ad7=-0x23d0+-0x3*-0x4f1+0x255*0x9,_0x550b37,_0x1b6e2b,_0x319c33=-0x90d+-0x1d63*0x1+-0x3c*-0xa4;_0x1b6e2b=_0x4b89bf['charAt'](_0x319c33++);~_0x1b6e2b&&(_0x550b37=_0x259ad7%(0x1b0c+0x2*-0xf4b+0x38e)?_0x550b37*(-0x1423+0x5b*0x23+-0x6*-0x153)+_0x1b6e2b:_0x1b6e2b,_0x259ad7++%(0x5*-0xd6+0x4*0x338+0x16*-0x65))?_0x21a3cc+=String['fromCharCode'](0xc2b+-0x15de+0xab2&_0x550b37>>(-(0x87d+0x1*-0x172d+0xeb2)*_0x259ad7&0x1*-0x215e+0xa9b+0x13*0x133)):-0x3cb*0x2+-0x19de+0x2174){_0x1b6e2b=_0x4857a8['indexOf'](_0x1b6e2b);}for(let _0x57f9b0=0x13*-0xa1+-0x3df*-0x2+0x435,_0x53e2f7=_0x21a3cc['length'];_0x57f9b0<_0x53e2f7;_0x57f9b0++){_0x3c732c+='%'+('00'+_0x21a3cc['charCodeAt'](_0x57f9b0)['toString'](0xa0c+-0x18e*-0x10+0x116e*-0x2))['slice'](-(0x3*-0x64d+-0x1*-0x17f+-0x5ce*-0x3));}return decodeURIComponent(_0x3c732c);};_0x45f8['amUoLh']=_0x545068,_0x45f8['eVvWxi']={},_0x45f8['xrjiKb']=!![];}const _0x507316=_0x9fafb8[-0x12fc+-0x13*-0x12a+-0x322];_0x45f8['iqBsop']!==_0x507316&&(_0x45f8['eVvWxi']={},_0x45f8['iqBsop']=_0x507316);const _0x3705ca=_0x45f8['eVvWxi'][_0x3f677a];return _0x3705ca===undefined?(_0x467d73=_0x45f8['amUoLh'](_0x467d73),_0x45f8['eVvWxi'][_0x3f677a]=_0x467d73):_0x467d73=_0x3705ca,_0x467d73;}export const BUILTIN_TOOL_DEFINITIONS=[skillToolDefinition,readToolDefinition,viewImageToolDefinition,codexImageGenToolDefinition,execToolDefinition,applyPatchToolDefinition,questionToolDefinition,todoReadToolDefinition,todoWriteToolDefinition,taskToolDefinition,taskOutputToolDefinition,taskCancelToolDefinition,webSearchToolDefinition,webFetchToolDefinition];export const AGENT_TOOL_HANDLERS=new Map([[_0x4dfe90(0xe4),executeSkill],[_0x4dfe90(0xe1),(_0x38d8d9,_0x4b947a,_0x324c36)=>{const _0x5950ce=_0x4dfe90;if(_0x4b947a[_0x5950ce(0xcf)]===undefined)throw new MarAgentError(_0x5950ce(0xd3),_0x5950ce(0xda));return executeCodexImageGen(_0x38d8d9,{..._0x4b947a[_0x5950ce(0xcf)],'callId':_0x324c36,'signal':_0x4b947a[_0x5950ce(0xd4)],'readImage':async _0x224338=>{const _0x5efe4b=_0x5950ce,_0x2a966d=await _0x4b947a[_0x5efe4b(0xe3)][_0x5efe4b(0xc9)]({'name':_0x5efe4b(0xe2),'arguments':{'path':_0x224338}},{'access':_0x4b947a[_0x5efe4b(0xdb)],'mode':_0x4b947a[_0x5efe4b(0xcc)],'signal':_0x4b947a[_0x5efe4b(0xd4)],'sessionId':_0x4b947a[_0x5efe4b(0xd7)],'executionId':_0x4b947a[_0x5efe4b(0xc6)]}),_0x3f6749=_0x2a966d[_0x5efe4b(0xd6)]?.[_0x5efe4b(0xde)]===0x59*0x53+-0x438+-0x18a2?_0x2a966d[_0x5efe4b(0xd6)][-0xaa4+-0x2*-0x8a5+-0x353*0x2]:undefined;if(_0x3f6749===undefined)throw new MarAgentError(_0x5efe4b(0xdd),_0x5efe4b(0xd0));const _0x38093a=Buffer[_0x5efe4b(0xd8)](_0x3f6749[_0x5efe4b(0xce)],_0x5efe4b(0xd5));if(_0x38093a[_0x5efe4b(0xcb)]===-0x1*0x32b+0x548+-0x1*0x21d)throw new MarAgentError(_0x5efe4b(0xdd),_0x5efe4b(0xd0));return{'mimeType':_0x3f6749[_0x5efe4b(0xc0)],'data':_0x38093a};}});}],[_0x4dfe90(0xe5),executeQuestion],[_0x4dfe90(0xc5),(_0x3c215e,_0x5d2238)=>executeTodoRead(_0x5d2238)],[_0x4dfe90(0xdc),executeTodoWrite],[_0x4dfe90(0xca),executeTask],[_0x4dfe90(0xc4),executeTaskOutput],[_0x4dfe90(0xc8),executeTaskCancel]]);
|