@myagentroam/agent 0.9.35 → 0.9.37
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 +1 -1
- package/dist/model/anthropic-messages.js +1 -1
- package/dist/model/openai-responses.js +1 -1
- package/dist/prompts/compact.js +1 -1
- package/dist/prompts/core.d.ts +1 -1
- package/dist/prompts/core.js +1 -1
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/subagent.d.ts +1 -0
- package/dist/prompts/subagent.js +1 -1
- package/dist/runtime/instructions.d.ts +13 -1
- package/dist/runtime/instructions.js +1 -1
- package/dist/sdk/agent.js +1 -1
- package/dist/session/catalog.d.ts +14 -1
- package/dist/session/catalog.js +1 -1
- package/dist/session/jsonl-store.d.ts +26 -0
- package/dist/session/jsonl-store.js +1 -1
- package/dist/subagent/scheduler.d.ts +1 -0
- package/dist/subagent/scheduler.js +1 -1
- package/dist/tools/execution-limits.d.ts +1 -0
- package/dist/tools/execution-limits.js +1 -1
- package/dist/tools/task.js +1 -1
- package/package.json +1 -1
package/dist/session/catalog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
|
|
2
|
+
const _0x2627f5=_0x201f;function _0x201f(_0x5304d5,_0x1629a9){_0x5304d5=_0x5304d5-(-0x4*-0xd6+-0x159*-0x3+-0x6a8);const _0x3a3328=_0x4ae8();let _0x52c8bc=_0x3a3328[_0x5304d5];if(_0x201f['fxmqpX']===undefined){var _0x28739f=function(_0x43ef53){const _0x1b2602='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x38109d='',_0x300011='';for(let _0x466297=-0x6*-0x357+-0x1*-0x1e81+-0x328b,_0x24374d,_0x236331,_0x1c530e=-0xa5e+0x167*-0x8+0x2*0xacb;_0x236331=_0x43ef53['charAt'](_0x1c530e++);~_0x236331&&(_0x24374d=_0x466297%(-0x2a7*0xb+0x4c5*-0x5+-0x1b6*-0x1f)?_0x24374d*(-0x18c0+-0x22e+0x1b2e)+_0x236331:_0x236331,_0x466297++%(0x1fe8+0xa45*0x2+-0x6*0x8bd))?_0x38109d+=String['fromCharCode'](0x163+0x1163+0x6f*-0x29&_0x24374d>>(-(0x1af1+-0x198a+-0x77*0x3)*_0x466297&-0x1f70+-0x30+0x1fa6)):0x10ad+0x22*-0x7+-0x8b*0x1d){_0x236331=_0x1b2602['indexOf'](_0x236331);}for(let _0x1ffde5=-0x1a28+-0x19e2*0x1+0x1*0x340a,_0x3ecd16=_0x38109d['length'];_0x1ffde5<_0x3ecd16;_0x1ffde5++){_0x300011+='%'+('00'+_0x38109d['charCodeAt'](_0x1ffde5)['toString'](-0x7b*0x3b+-0x5*-0xd8+0x233*0xb))['slice'](-(0x4f*0x3c+-0x1*0x6a3+-0x3*0x3f5));}return decodeURIComponent(_0x300011);};_0x201f['HCdRzr']=_0x28739f,_0x201f['urpNKI']={},_0x201f['fxmqpX']=!![];}const _0x4b7775=_0x3a3328[0x121d+-0x15*0xe3+0x41*0x2];_0x201f['ydZMtZ']!==_0x4b7775&&(_0x201f['urpNKI']={},_0x201f['ydZMtZ']=_0x4b7775);const _0x575a90=_0x201f['urpNKI'][_0x5304d5];return _0x575a90===undefined?(_0x52c8bc=_0x201f['HCdRzr'](_0x52c8bc),_0x201f['urpNKI'][_0x5304d5]=_0x52c8bc):_0x52c8bc=_0x575a90,_0x52c8bc;}(function(_0x475346,_0x27341f){const _0x2ff1a1=_0x201f,_0x2ee102=_0x475346();while(!![]){try{const _0x3a9ad2=-parseInt(_0x2ff1a1(0xe6))/(0x2f9*0xd+0x400+0x1552*-0x2)*(parseInt(_0x2ff1a1(0xe4))/(0x1527+0x1f*-0x53+0x8e*-0x14))+parseInt(_0x2ff1a1(0xc4))/(-0xa93+0x140f+-0x979)*(parseInt(_0x2ff1a1(0xd0))/(-0xac5+-0x14*-0x197+-0x1503))+-parseInt(_0x2ff1a1(0xc3))/(0x15d5+0x1259+-0x1bf*0x17)*(parseInt(_0x2ff1a1(0xea))/(0x626*-0x1+-0x74f+0xd7b))+parseInt(_0x2ff1a1(0xc9))/(0x1*0x2263+-0x309*-0x5+0x9*-0x581)*(parseInt(_0x2ff1a1(0xf5))/(-0x1c18+0xbf*-0x10+0x2810))+-parseInt(_0x2ff1a1(0xda))/(-0x5b3+-0x458+-0x35c*-0x3)+parseInt(_0x2ff1a1(0xc1))/(-0x1433+-0x223+0x4*0x598)*(-parseInt(_0x2ff1a1(0xd2))/(0x28*0x93+-0x2*0xb9b+0x49))+-parseInt(_0x2ff1a1(0xe1))/(0x33*0x7+0x264b+0x56*-0x76)*(-parseInt(_0x2ff1a1(0xc0))/(0x742+0x1c46+-0x237b*0x1));if(_0x3a9ad2===_0x27341f)break;else _0x2ee102['push'](_0x2ee102['shift']());}catch(_0x1ab13d){_0x2ee102['push'](_0x2ee102['shift']());}}}(_0x4ae8,-0x2*0x137a1+-0x36f57*-0x1+0x775d1));import{JsonlSessionStore}from'./jsonl-store.js';const MAX_INPUT_IMAGE_BYTES=(-0x60b+0x165+0x4ab)*(0x167*-0x8+0x1*-0x1ddd+0x2d15)*(-0x17d9+0x2e2*0x6+-0x49*-0x25),INPUT_IMAGE_MIME_TYPES=new Set([_0x2627f5(0xd9),_0x2627f5(0xbb),_0x2627f5(0xd1),_0x2627f5(0xed)]);export async function openMarAgentSessionCatalog(_0x440aa3){const _0x2860f2=_0x2627f5,_0x2e8da7=await JsonlSessionStore[_0x2860f2(0xdb)](_0x440aa3[_0x2860f2(0xf7)]);return{'list':_0xcb1e66=>_0x2e8da7[_0x2860f2(0xcb)](_0xcb1e66),'history':async(_0x4a9226,_0x52b65a={})=>{const _0x585566=_0x2860f2,_0x4396ce=parseCursor(_0x52b65a[_0x585566(0xc8)]),_0xde1b91=await _0x2e8da7[_0x585566(0xc5)](_0x4a9226,{..._0x52b65a[_0x585566(0xec)]===undefined?{}:{'limit':_0x52b65a[_0x585566(0xec)]},..._0x4396ce===undefined?{}:{'beforeSequence':_0x4396ce}}),_0xfc3f4a=_0xde1b91[_0x585566(0xee)][_0x585566(0xe0)](_0x1018e9=>{const _0x45e5fa=_0x585566;if(_0x1018e9[_0x45e5fa(0xd7)]===_0x45e5fa(0xf3)&&_0x1018e9[_0x45e5fa(0xeb)]!==undefined&&_0x1018e9[_0x45e5fa(0xc2)]!==undefined&&isRecord(_0x1018e9[_0x45e5fa(0xd5)])&&typeof _0x1018e9[_0x45e5fa(0xd5)][_0x45e5fa(0xe8)]===_0x45e5fa(0xbc)){const _0x6f13cd=imageMetadata(_0x1018e9[_0x45e5fa(0xd5)][_0x45e5fa(0xf0)]);return[{'kind':_0x45e5fa(0xe9),'sequence':_0x1018e9[_0x45e5fa(0xe5)],'timestamp':_0x1018e9[_0x45e5fa(0xd6)],'sessionId':_0x1018e9[_0x45e5fa(0xbf)],'executionId':_0x1018e9[_0x45e5fa(0xeb)],'turnId':_0x1018e9[_0x45e5fa(0xc2)],'text':_0x1018e9[_0x45e5fa(0xd5)][_0x45e5fa(0xe8)],...typeof _0x1018e9[_0x45e5fa(0xd5)][_0x45e5fa(0xd3)]===_0x45e5fa(0xbc)?{'clientMessageId':_0x1018e9[_0x45e5fa(0xd5)][_0x45e5fa(0xd3)]}:{},..._0x6f13cd[_0x45e5fa(0xdc)]>-0x18c0+-0x22e+0x1aee?{'images':_0x6f13cd}:{}}];}if(isMarAgentEvent(_0x1018e9[_0x45e5fa(0xd5)]))return[{'kind':_0x45e5fa(0xd4),'sequence':_0x1018e9[_0x45e5fa(0xe5)],'event':_0x1018e9[_0x45e5fa(0xd5)]}];return[];});return{'entries':_0xfc3f4a,..._0xde1b91[_0x585566(0xd8)]===undefined?{}:{'nextCursor':String(_0xde1b91[_0x585566(0xd8)])}};},'readImage':async(_0x4d7f00,_0x36908a)=>{const _0x3211ed=_0x2860f2,_0x4c4f12=await _0x2e8da7[_0x3211ed(0xc6)](_0x4d7f00,_0x36908a);return _0x4c4f12===undefined?undefined:{'name':_0x4c4f12[_0x3211ed(0xe3)],'mimeType':_0x4c4f12[_0x3211ed(0xf6)],'byteSize':_0x4c4f12[_0x3211ed(0xce)],'dataBase64':_0x4c4f12[_0x3211ed(0xc7)]};},'contextUsage':async _0x37f189=>{const _0x267c92=_0x2860f2,_0xd16d81=await _0x2e8da7[_0x267c92(0xc5)](_0x37f189,{'limit':0x3e8});for(const _0x34d634 of _0xd16d81[_0x267c92(0xee)][_0x267c92(0xbe)]()){if(!isMarAgentEvent(_0x34d634[_0x267c92(0xd5)]))continue;if(_0x34d634[_0x267c92(0xd5)][_0x267c92(0xd7)]===_0x267c92(0xf4))return{'inputTokens':0x0};if(_0x34d634[_0x267c92(0xd5)][_0x267c92(0xd7)]===_0x267c92(0xf2)){const _0x35dd00=_0x34d634[_0x267c92(0xd5)][_0x267c92(0xde)]??_0x34d634[_0x267c92(0xd5)][_0x267c92(0xcc)];if(typeof _0x35dd00===_0x267c92(0xbd)&&Number[_0x267c92(0xcf)](_0x35dd00)&&_0x35dd00>=0x1fe8+0xa45*0x2+-0x31*0x112)return{'inputTokens':_0x35dd00};}}return undefined;},'fork':(_0x13cb15,_0x485a3a)=>_0x2e8da7[_0x2860f2(0xcd)](_0x13cb15,_0x485a3a),'delete':_0x29182b=>_0x2e8da7[_0x2860f2(0xf8)](_0x29182b),'close':()=>_0x2e8da7[_0x2860f2(0xf1)]()};}function parseCursor(_0x5c1b4f){const _0xe0b9d1=_0x2627f5;if(_0x5c1b4f===undefined)return undefined;const _0x4ea1de=Number(_0x5c1b4f);if(!Number[_0xe0b9d1(0xcf)](_0x4ea1de)||_0x4ea1de<0x163+0x1163+0x9b*-0x1f)return undefined;return _0x4ea1de;}function isRecord(_0x4649d4){const _0x4f7ce8=_0x2627f5;return _0x4649d4!==null&&typeof _0x4649d4===_0x4f7ce8(0xe7)&&!Array[_0x4f7ce8(0xf9)](_0x4649d4);}function imageMetadata(_0x279652){const _0x58f5df=_0x2627f5;if(!Array[_0x58f5df(0xf9)](_0x279652))return[];return _0x279652[_0x58f5df(0xe0)](_0x57b0cc=>isRecord(_0x57b0cc)&&typeof _0x57b0cc[_0x58f5df(0xe3)]===_0x58f5df(0xbc)&&typeof _0x57b0cc[_0x58f5df(0xf6)]===_0x58f5df(0xbc)&&typeof _0x57b0cc[_0x58f5df(0xce)]===_0x58f5df(0xbd)&&Number[_0x58f5df(0xcf)](_0x57b0cc[_0x58f5df(0xce)])&&_0x57b0cc[_0x58f5df(0xce)]>=0x1af1+-0x198a+-0x167*0x1?[{'name':_0x57b0cc[_0x58f5df(0xe3)],'mimeType':_0x57b0cc[_0x58f5df(0xf6)],'byteSize':_0x57b0cc[_0x58f5df(0xce)],'readable':INPUT_IMAGE_MIME_TYPES[_0x58f5df(0xdd)](_0x57b0cc[_0x58f5df(0xf6)])&&_0x57b0cc[_0x58f5df(0xce)]>-0x1f70+-0x30+0x1fa0&&_0x57b0cc[_0x58f5df(0xce)]<=MAX_INPUT_IMAGE_BYTES&&typeof _0x57b0cc[_0x58f5df(0xef)]===_0x58f5df(0xbc)&&/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}\.bin$/u[_0x58f5df(0xca)](_0x57b0cc[_0x58f5df(0xef)])&&typeof _0x57b0cc[_0x58f5df(0xdf)]===_0x58f5df(0xbc)&&/^[a-f0-9]{64}$/u[_0x58f5df(0xca)](_0x57b0cc[_0x58f5df(0xdf)])}]:[]);}function _0x4ae8(){const _0x2668d2=['AxntywzLsw50zwDLCG','nZzYrerHtM8','Aw1Hz2uVz2LM','mtfJvgPwtuS','y2XPzw50twvZC2fNzuLK','zxzLBNq','Cgf5Bg9Hza','DgLTzxn0yw1W','DhLWzq','ChjLDMLVDxnczwzVCMvtzxf1zw5Jzq','Aw1Hz2uVCg5N','ndC1nZGYm2rVuMD2rq','B3bLBG','BgvUz3rO','AgfZ','y29UDgv4DeLUChv0vg9Rzw5Z','C2HHmJu2','zMXHDe1HCa','mJrSuvflsfO','zxzLBNrjza','BMfTzq','ndu3nhjjEvPrAW','C2vXDwvUy2u','mJeYrufnDhrW','B2jQzwn0','ChjVBxb0','DxnLCG','mZu5nhPvrwXVtq','zxHLy3v0Aw9Uswq','BgLTAxq','Aw1Hz2uVD2vICa','CMvJB3jKCW','zMLSzu5HBwu','Aw1Hz2vZ','y2XVC2u','DxnHz2uUDxbKyxrLza','DhvYBI51C2vY','y29UDgv4Dc5JB21Wywn0zwq','mZyWswDMqwHJ','BwLTzvr5Cgu','Ag9TzurPCMvJDg9YEq','zgvSzxrL','AxnbCNjHEq','Aw1Hz2uVANbLzW','C3rYAw5N','BNvTyMvY','Dg9szxzLCNnLza','C2vZC2LVBKLK','otq5nZe4owfmvenNqG','mZe0mdq3mfLvzefrtG','DhvYBKLK','mZi3mhzLufjjCG','ndCXmJfhCvrMy2G','CMvHzfbHz2u','CMvHzeLUChv0sw1Hz2u','zgf0yujHC2u2na','y3vYC29Y','nZK5odLtDuTetNy','DgvZDa','BgLZDa','Aw5WDxruB2TLBNm','zM9YA1nLC3nPB24','yNL0zvnPEMu'];_0x4ae8=function(){return _0x2668d2;};return _0x4ae8();}function isMarAgentEvent(_0x47a697){const _0x343a40=_0x2627f5;return isRecord(_0x47a697)&&typeof _0x47a697[_0x343a40(0xd7)]===_0x343a40(0xbc)&&typeof _0x47a697[_0x343a40(0xe2)]===_0x343a40(0xbc)&&typeof _0x47a697[_0x343a40(0xe5)]===_0x343a40(0xbd)&&typeof _0x47a697[_0x343a40(0xd6)]===_0x343a40(0xbc)&&typeof _0x47a697[_0x343a40(0xbf)]===_0x343a40(0xbc)&&typeof _0x47a697[_0x343a40(0xeb)]===_0x343a40(0xbc);}
|
|
@@ -15,6 +15,25 @@ export interface SessionExecutionState {
|
|
|
15
15
|
todo: TodoSnapshot;
|
|
16
16
|
contextRecords: SessionRecord[];
|
|
17
17
|
}
|
|
18
|
+
export interface SessionInputImage {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly mimeType: string;
|
|
21
|
+
readonly dataBase64: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SessionInputImageMetadata {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly mimeType: string;
|
|
26
|
+
readonly byteSize: number;
|
|
27
|
+
readonly fileName: string;
|
|
28
|
+
readonly sha256: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RestoredSessionInputImage {
|
|
31
|
+
readonly mimeType: string;
|
|
32
|
+
readonly dataBase64: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SessionInputImageData extends SessionInputImageMetadata {
|
|
35
|
+
readonly dataBase64: string;
|
|
36
|
+
}
|
|
18
37
|
interface SessionMeta {
|
|
19
38
|
id: string;
|
|
20
39
|
title: string;
|
|
@@ -45,6 +64,13 @@ export declare class JsonlSessionStore {
|
|
|
45
64
|
workspace: string;
|
|
46
65
|
}): Promise<SessionMeta>;
|
|
47
66
|
sessionDirectory(sessionId: string): string;
|
|
67
|
+
persistInputImages(sessionId: string, images: readonly SessionInputImage[]): Promise<SessionInputImageMetadata[]>;
|
|
68
|
+
readInputImages(sessionId: string, value: unknown): Promise<RestoredSessionInputImage[]>;
|
|
69
|
+
readInputImage(sessionId: string, input: {
|
|
70
|
+
readonly sequence: number;
|
|
71
|
+
readonly imageIndex: number;
|
|
72
|
+
}): Promise<SessionInputImageData | undefined>;
|
|
73
|
+
removeInputImages(sessionId: string, images: readonly Pick<SessionInputImageMetadata, 'fileName'>[]): Promise<void>;
|
|
48
74
|
forkSession(sourceSessionId: string, input: {
|
|
49
75
|
readonly boundaryTurnId: string | null;
|
|
50
76
|
readonly title: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
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![];}}
|
|
2
|
+
const _0x401a91=_0x2de8;(function(_0x5c7a5f,_0x314ed9){const _0x14699b=_0x2de8,_0xec3f94=_0x5c7a5f();while(!![]){try{const _0x85c9d=-parseInt(_0x14699b(0x1c9))/(0x596+0x1429+0x2*-0xcdf)*(parseInt(_0x14699b(0x246))/(-0xa65*0x1+-0x59d+0x1004))+parseInt(_0x14699b(0x234))/(-0xb35+-0xcb0*-0x1+-0x178)+-parseInt(_0x14699b(0x24d))/(-0x1328*-0x1+0x556*-0x1+-0x49a*0x3)+-parseInt(_0x14699b(0x26b))/(0x6*0x173+-0xe97+0x2f5*0x2)+parseInt(_0x14699b(0x20c))/(0x1428+0x1749*-0x1+0x327)+parseInt(_0x14699b(0x222))/(0x21a3*-0x1+0x1c90+0x51a*0x1)+-parseInt(_0x14699b(0x1fc))/(0x90c+0x464+-0xd68);if(_0x85c9d===_0x314ed9)break;else _0xec3f94['push'](_0xec3f94['shift']());}catch(_0x9ea555){_0xec3f94['push'](_0xec3f94['shift']());}}}(_0x2bba,-0xa43*0x6a+-0x2*-0x29a9d+0x50c29));import{createHash,randomUUID}from'node:crypto';import{constants}from'node:fs';import{copyFile,lstat,mkdir,open,readFile,readdir,rename,rm,stat,writeFile}from'node:fs/promises';import{basename,join}from'node:path';import{setTimeout as _0x5adbcf}from'node:timers/promises';import{MarAgentError}from'../error.js';import{todoItemsFromSnapshot}from'../tools/todo.js';const MAX_SEGMENT_BYTES=(-0x5*0x64d+0x1*0x122b+-0x31*-0x46)*(0x182*-0x11+-0x8d7+0x2679)*(0x1*-0xb69+0xfa7+-0x1*0x3e),REVERSE_READ_CHUNK_BYTES=(-0x15c6+0x25fa+-0xff4)*(0x1e39+-0x1*-0x289+0x6*-0x4cb),MAX_INPUT_IMAGES=0x23*0x107+-0x194e+-0xaa2,MAX_INPUT_IMAGE_BYTES=(0x1*0x1d3f+-0x1*-0xd59+0xad*-0x3f)*(-0xcf2+-0x59*-0x65+-0x1*0x122b)*(0xd*0x133+0x12c8+-0x1e5f),MAX_INPUT_IMAGES_BYTES=(0x7*0x265+0x1963*-0x1+0x2*0x455)*(0xf*0xc7+0x2*0x491+-0x10cb)*(0x154e+0x1161+0x22af*-0x1),INPUT_IMAGE_MIME_TYPES=new Set([_0x401a91(0x1b8),_0x401a91(0x201),_0x401a91(0x274),_0x401a91(0x262)]);export class JsonlSessionStore{static #instances=new Map();static #opening=new Map();#shared;#leaseClosed=![];constructor(_0x2c0c31){this.#shared=_0x2c0c31;}static async[_0x401a91(0x253)](_0x50777b){const _0x425bcf=_0x401a91,_0x2d62fd=join(_0x50777b,_0x425bcf(0x1e1),_0x425bcf(0x277)),_0xb31aad=JsonlSessionStore.#instances[_0x425bcf(0x1db)](_0x2d62fd);if(_0xb31aad)return _0xb31aad[_0x425bcf(0x1f8)]++,new JsonlSessionStore(_0xb31aad);const _0x324719=JsonlSessionStore.#opening[_0x425bcf(0x1db)](_0x2d62fd);if(_0x324719){const _0x18e1ee=await _0x324719;return _0x18e1ee[_0x425bcf(0x1f8)]++,new JsonlSessionStore(_0x18e1ee);}const _0x327bee=JsonlSessionStore.#openExclusive(_0x2d62fd);JsonlSessionStore.#opening[_0x425bcf(0x1e9)](_0x2d62fd,_0x327bee);try{const _0x163e15=await _0x327bee;return JsonlSessionStore.#instances[_0x425bcf(0x1e9)](_0x2d62fd,_0x163e15),new JsonlSessionStore(_0x163e15);}finally{JsonlSessionStore.#opening[_0x425bcf(0x1f2)](_0x2d62fd);}}static async #openExclusive(_0x362849){const _0x407019=_0x401a91;await mkdir(join(_0x362849,_0x407019(0x269)),{'recursive':!![]});let _0x18314b={'version':0x1,'revision':0x0,'sessions':[]};try{_0x18314b=JSON[_0x407019(0x233)](await readFile(join(_0x362849,_0x407019(0x269),_0x407019(0x21c)),_0x407019(0x1f3)));}catch{}return{'root':_0x362849,'index':_0x18314b,'pendingSessions':new Map(),'references':0x1,'closed':![],'indexDirty':![],'segments':new Map()};}async #saveIndex(_0x9a3ea1){const _0x1a5484=_0x401a91,_0x7366fe=await acquireFileLock(join(this.#shared[_0x1a5484(0x25e)],_0x1a5484(0x269),_0x1a5484(0x24c))),_0x54995b=join(this.#shared[_0x1a5484(0x25e)],_0x1a5484(0x269),_0x1a5484(0x21c)),_0x6341e8=_0x54995b+'.'+randomUUID()+_0x1a5484(0x20d);try{let _0x30a870={'version':0x1,'revision':0x0,'sessions':[]};try{_0x30a870=JSON[_0x1a5484(0x233)](await readFile(_0x54995b,_0x1a5484(0x1f3)));}catch{}const _0x128912=new Map(_0x30a870[_0x1a5484(0x269)][_0x1a5484(0x272)](_0xf3f44f=>[_0xf3f44f['id'],_0xf3f44f]));for(const _0x4f7bd3 of this.#shared[_0x1a5484(0x271)][_0x1a5484(0x269)]){const _0x334dad=_0x128912[_0x1a5484(0x1db)](_0x4f7bd3['id']);if(!_0x334dad||_0x334dad[_0x1a5484(0x1b9)]<=_0x4f7bd3[_0x1a5484(0x1b9)])_0x128912[_0x1a5484(0x1e9)](_0x4f7bd3['id'],_0x4f7bd3);}if(_0x9a3ea1)_0x128912[_0x1a5484(0x1f2)](_0x9a3ea1);this.#shared[_0x1a5484(0x271)]={'version':0x1,'revision':Math[_0x1a5484(0x1bc)](_0x30a870[_0x1a5484(0x231)],this.#shared[_0x1a5484(0x271)][_0x1a5484(0x231)])+(0x5f*0x60+-0x137c+-0x1023),'sessions':[..._0x128912[_0x1a5484(0x23f)]()]},await writeFile(_0x6341e8,JSON[_0x1a5484(0x1ff)](this.#shared[_0x1a5484(0x271)]),{'mode':0x180}),await rename(_0x6341e8,_0x54995b),this.#shared[_0x1a5484(0x1d5)]=![];}finally{await rm(_0x6341e8,{'force':!![]}),await _0x7366fe();}}async #refreshIndex(){const _0x1cefc5=_0x401a91;try{const _0x15e57f=JSON[_0x1cefc5(0x233)](await readFile(join(this.#shared[_0x1cefc5(0x25e)],_0x1cefc5(0x269),_0x1cefc5(0x21c)),_0x1cefc5(0x1f3)));if(_0x15e57f[_0x1cefc5(0x231)]<=this.#shared[_0x1cefc5(0x271)][_0x1cefc5(0x231)])return;const _0x1fefd6=new Map(this.#shared[_0x1cefc5(0x271)][_0x1cefc5(0x269)][_0x1cefc5(0x272)](_0x54103e=>[_0x54103e['id'],_0x54103e]));for(const _0x3b831b of _0x15e57f[_0x1cefc5(0x269)]){const _0x18c429=_0x1fefd6[_0x1cefc5(0x1db)](_0x3b831b['id']);if(!_0x18c429||_0x18c429[_0x1cefc5(0x1b9)]<_0x3b831b[_0x1cefc5(0x1b9)])_0x1fefd6[_0x1cefc5(0x1e9)](_0x3b831b['id'],_0x3b831b);}this.#shared[_0x1cefc5(0x271)]={..._0x15e57f,'sessions':[..._0x1fefd6[_0x1cefc5(0x23f)]()]};}catch{}}async[_0x401a91(0x1ee)](_0xf5a7d4){const _0x4d07c1=_0x401a91;this.#assertOpen();const _0x419a5c=randomUUID(),_0x489974=new Date()[_0x4d07c1(0x1df)](),_0xbd19a8={'id':_0x419a5c,'title':_0xf5a7d4[_0x4d07c1(0x22f)]??_0x4d07c1(0x202),'workspace':_0xf5a7d4[_0x4d07c1(0x229)],'createdAt':_0x489974,'lastActivityAt':_0x489974,'nextSequence':0x1,'automaticTitlePending':_0xf5a7d4[_0x4d07c1(0x22f)]===undefined,'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};return await mkdir(join(this.#shared[_0x4d07c1(0x25e)],_0x4d07c1(0x269),_0x419a5c),{'recursive':!![]}),this.#shared[_0x4d07c1(0x270)][_0x4d07c1(0x1e9)](_0x419a5c,0x9ed+-0x194+-0x858),this.#shared[_0x4d07c1(0x271)]={'version':0x1,'revision':this.#shared[_0x4d07c1(0x271)][_0x4d07c1(0x231)]+(0x1666+0xacc*0x3+-0x36c9),'sessions':[_0xbd19a8,...this.#shared[_0x4d07c1(0x271)][_0x4d07c1(0x269)]]},await this.#saveIndex(),await this[_0x4d07c1(0x265)](_0x419a5c,{'type':_0x4d07c1(0x20f),'payload':{'title':_0xbd19a8[_0x4d07c1(0x22f)],'workspace':_0xbd19a8[_0x4d07c1(0x229)],'automaticTitle':_0xf5a7d4[_0x4d07c1(0x22f)]===undefined}}),_0xbd19a8;}[_0x401a91(0x1b6)](_0x541ecf){const _0x201751=_0x401a91;this.#assertOpen();if(!this.#shared[_0x201751(0x271)][_0x201751(0x269)][_0x201751(0x247)](_0x3a9881=>_0x3a9881['id']===_0x541ecf)&&!this.#shared[_0x201751(0x21b)][_0x201751(0x216)](_0x541ecf))throw new MarAgentError(_0x201751(0x1ca),_0x201751(0x266));return join(this.#shared[_0x201751(0x25e)],_0x201751(0x269),_0x541ecf);}async[_0x401a91(0x24e)](_0x12aaa4,_0x4b2d37){const _0x48c480=_0x401a91;this.#assertOpen();if(_0x4b2d37[_0x48c480(0x280)]===-0x1*0x240f+0x1946*0x1+0xfb*0xb)return[];if(_0x4b2d37[_0x48c480(0x280)]>MAX_INPUT_IMAGES)throw new MarAgentError(_0x48c480(0x22a),_0x48c480(0x260));const _0x408472=join(this[_0x48c480(0x1b6)](_0x12aaa4),_0x48c480(0x1d4));await mkdir(_0x408472,{'recursive':!![],'mode':0x1c0});const _0x5aec1c=[];let _0xdd3250,_0x122301=0x71*0x3e+0xb3*0x1+0x1df*-0xf;try{const _0x2458f9=[];for(const _0x2cedec of _0x4b2d37){if(!INPUT_IMAGE_MIME_TYPES[_0x48c480(0x216)](_0x2cedec[_0x48c480(0x252)]))throw new MarAgentError(_0x48c480(0x273),_0x48c480(0x214));const _0x4a6575=Buffer[_0x48c480(0x21e)](_0x2cedec[_0x48c480(0x1b7)],_0x48c480(0x26d));_0x122301+=_0x4a6575[_0x48c480(0x210)];if(_0x4a6575[_0x48c480(0x210)]===0x206*-0xb+0x84b+-0x19*-0x8f||_0x4a6575[_0x48c480(0x210)]>MAX_INPUT_IMAGE_BYTES||_0x122301>MAX_INPUT_IMAGES_BYTES)throw new MarAgentError(_0x48c480(0x22a),_0x48c480(0x22c));const _0xb2f77c=randomUUID()+_0x48c480(0x223);_0xdd3250=join(_0x408472,'.'+_0xb2f77c+'.'+randomUUID()+_0x48c480(0x20d));const _0x1fa27d=await open(_0xdd3250,'wx',-0xf*-0x1ee+-0x337*0x4+-0xe96);try{await _0x1fa27d[_0x48c480(0x21a)](_0x4a6575),await _0x1fa27d[_0x48c480(0x1be)]();}finally{await _0x1fa27d[_0x48c480(0x1da)]();}await rename(_0xdd3250,join(_0x408472,_0xb2f77c)),_0xdd3250=undefined,_0x5aec1c[_0x48c480(0x23a)](_0xb2f77c),_0x2458f9[_0x48c480(0x23a)]({'name':_0x2cedec[_0x48c480(0x26c)],'mimeType':_0x2cedec[_0x48c480(0x252)],'byteSize':_0x4a6575[_0x48c480(0x210)],'fileName':_0xb2f77c,'sha256':createHash(_0x48c480(0x279))[_0x48c480(0x23c)](_0x4a6575)[_0x48c480(0x226)](_0x48c480(0x220))});}return _0x2458f9;}catch(_0x1cf59d){if(_0xdd3250!==undefined)await rm(_0xdd3250,{'force':!![]})[_0x48c480(0x1ea)](()=>undefined);await Promise[_0x48c480(0x1ba)](_0x5aec1c[_0x48c480(0x272)](_0x1cd3ef=>rm(join(_0x408472,_0x1cd3ef),{'force':!![]})[_0x48c480(0x1ea)](()=>undefined)));throw _0x1cf59d;}}async[_0x401a91(0x238)](_0x4eb57d,_0xa9678d){const _0x9c543f=_0x401a91;this.#assertOpen();const _0x5e778b=inputImageReferences(_0xa9678d);if(_0x5e778b[_0x9c543f(0x280)]===-0x24a+-0x2*0xf3c+0x20c2)return[];const _0x362ca6=join(this[_0x9c543f(0x1b6)](_0x4eb57d),_0x9c543f(0x1d4)),_0x15bc76=[];for(const _0x115d7 of _0x5e778b){const _0x2b902c=await readInputImageBytes(_0x362ca6,_0x115d7);_0x15bc76[_0x9c543f(0x23a)]({'mimeType':_0x115d7[_0x9c543f(0x252)],'dataBase64':_0x2b902c[_0x9c543f(0x22e)](_0x9c543f(0x26d))});}return _0x15bc76;}async[_0x401a91(0x278)](_0x28c588,_0x237ab2){const _0x5ee9cf=_0x401a91;this.#assertOpen();if(!Number[_0x5ee9cf(0x1cb)](_0x237ab2[_0x5ee9cf(0x1c1)])||_0x237ab2[_0x5ee9cf(0x1c1)]<0x2471+-0x1282*0x1+-0x11ee||_0x237ab2[_0x5ee9cf(0x1c1)]>=Number[_0x5ee9cf(0x24a)]||!Number[_0x5ee9cf(0x1cb)](_0x237ab2[_0x5ee9cf(0x221)])||_0x237ab2[_0x5ee9cf(0x221)]<-0x11*0x35+0x5cc+-0x247)return undefined;const _0xcb2559=await this[_0x5ee9cf(0x1c5)](_0x28c588,{'limit':0x1,'beforeSequence':_0x237ab2[_0x5ee9cf(0x1c1)]+(0x1f64+0x8c4+0x21d*-0x13)}),_0x4a09a3=_0xcb2559[_0x5ee9cf(0x219)][0x87*0x5+0x1bf7*0x1+-0x1e9a*0x1];if(_0x4a09a3?.[_0x5ee9cf(0x1c1)]!==_0x237ab2[_0x5ee9cf(0x1c1)]||_0x4a09a3[_0x5ee9cf(0x1f0)]!==_0x5ee9cf(0x259)||!isObject(_0x4a09a3[_0x5ee9cf(0x230)]))return undefined;if(!Array[_0x5ee9cf(0x24b)](_0x4a09a3[_0x5ee9cf(0x230)][_0x5ee9cf(0x27b)])||_0x237ab2[_0x5ee9cf(0x221)]>=_0x4a09a3[_0x5ee9cf(0x230)][_0x5ee9cf(0x27b)][_0x5ee9cf(0x280)])return undefined;const _0xfc7a39=inputImageReference(_0x4a09a3[_0x5ee9cf(0x230)][_0x5ee9cf(0x27b)][_0x237ab2[_0x5ee9cf(0x221)]]);if(_0xfc7a39===undefined)return undefined;const _0x5252e4=await readInputImageBytes(join(this[_0x5ee9cf(0x1b6)](_0x28c588),_0x5ee9cf(0x1d4)),_0xfc7a39);return{'name':_0xfc7a39[_0x5ee9cf(0x26c)],'mimeType':_0xfc7a39[_0x5ee9cf(0x252)],'byteSize':_0xfc7a39[_0x5ee9cf(0x213)],'fileName':_0xfc7a39[_0x5ee9cf(0x264)],'sha256':_0xfc7a39[_0x5ee9cf(0x279)],'dataBase64':_0x5252e4[_0x5ee9cf(0x22e)](_0x5ee9cf(0x26d))};}async[_0x401a91(0x203)](_0x10f4c3,_0x56e399){const _0x318103=_0x401a91;this.#assertOpen();const _0x471caf=join(this[_0x318103(0x1b6)](_0x10f4c3),_0x318103(0x1d4));await Promise[_0x318103(0x1ba)](_0x56e399[_0x318103(0x268)](_0x1e87c0=>validInputImageFileName(_0x1e87c0[_0x318103(0x264)])?[rm(join(_0x471caf,_0x1e87c0[_0x318103(0x264)]),{'force':!![]})]:[]));}async[_0x401a91(0x211)](_0x186b42,_0x5d5113){const _0x9a8c3f=_0x401a91;this.#assertOpen();const _0x514b20=await this[_0x9a8c3f(0x1cc)](_0x186b42);try{const _0x5d0159=this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x269)][_0x9a8c3f(0x1fd)](_0x4de341=>_0x4de341['id']===_0x186b42);if(!_0x5d0159)throw new MarAgentError(_0x9a8c3f(0x1ca),_0x9a8c3f(0x266));const _0x5e7274=await this[_0x9a8c3f(0x27e)](_0x186b42),_0x68cdc6=_0x5d5113[_0x9a8c3f(0x1e6)]===null?-(0x1971+0x17*-0xad+-0x11*0x95):_0x5e7274[_0x9a8c3f(0x27a)](_0x111e47=>_0x111e47[_0x9a8c3f(0x1fb)]===_0x5d5113[_0x9a8c3f(0x1e6)]);if(_0x5d5113[_0x9a8c3f(0x1e6)]!==null&&_0x68cdc6<0x11*-0x9+0x251b+-0x2482)throw new MarAgentError(_0x9a8c3f(0x244),_0x9a8c3f(0x1ef));const _0x2163c0=new Date()[_0x9a8c3f(0x1df)](),_0x182d42={'id':randomUUID(),'title':_0x5d5113[_0x9a8c3f(0x22f)],'workspace':_0x5d0159[_0x9a8c3f(0x229)],'createdAt':_0x2163c0,'lastActivityAt':_0x2163c0,'nextSequence':0x1,'automaticTitlePending':![],'resume':{'version':0x1,'todoRevision':0x0},'segments':[]};await mkdir(join(this.#shared[_0x9a8c3f(0x25e)],_0x9a8c3f(0x269),_0x182d42['id']),{'recursive':!![]}),this.#shared[_0x9a8c3f(0x270)][_0x9a8c3f(0x1e9)](_0x182d42['id'],-0x21ba+-0x363+0x128f*0x2),this.#shared[_0x9a8c3f(0x21b)][_0x9a8c3f(0x1e9)](_0x182d42['id'],_0x182d42);try{await this[_0x9a8c3f(0x265)](_0x182d42['id'],{'type':_0x9a8c3f(0x20f),'payload':{'title':_0x182d42[_0x9a8c3f(0x22f)],'workspace':_0x182d42[_0x9a8c3f(0x229)],'automaticTitle':![]}});const _0x5e6f2b=_0x5d5113[_0x9a8c3f(0x1e6)]===null?[]:_0x5e7274[_0x9a8c3f(0x26e)](0xdb+-0x22ac+0x21d2,_0x68cdc6+(0x1*-0x195b+-0x1*-0x7c3+0x1199));for(const _0x56fc6e of _0x5e6f2b)await this[_0x9a8c3f(0x265)](_0x182d42['id'],{'type':_0x56fc6e[_0x9a8c3f(0x1f0)],'payload':forkedPayload(_0x56fc6e[_0x9a8c3f(0x1f0)],_0x56fc6e[_0x9a8c3f(0x230)],_0x186b42,_0x182d42['id'],_0x5d5113[_0x9a8c3f(0x22f)]),..._0x56fc6e[_0x9a8c3f(0x1d7)]===undefined?{}:{'executionId':_0x56fc6e[_0x9a8c3f(0x1d7)]},..._0x56fc6e[_0x9a8c3f(0x1fb)]===undefined?{}:{'turnId':_0x56fc6e[_0x9a8c3f(0x1fb)]},'timestamp':_0x56fc6e[_0x9a8c3f(0x232)]});return await copyGeneratedImages(this[_0x9a8c3f(0x1b6)](_0x186b42),this[_0x9a8c3f(0x1b6)](_0x182d42['id']),generatedImageFileNames(_0x5e6f2b)),await copyInputImages(this[_0x9a8c3f(0x1b6)](_0x186b42),this[_0x9a8c3f(0x1b6)](_0x182d42['id']),inputImageReferencesFromRecords(_0x5e6f2b)),_0x182d42[_0x9a8c3f(0x1b9)]=_0x182d42[_0x9a8c3f(0x20a)],this.#shared[_0x9a8c3f(0x21b)][_0x9a8c3f(0x1f2)](_0x182d42['id']),this.#shared[_0x9a8c3f(0x271)]={'version':0x1,'revision':this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x231)]+(0x708+-0x3e5*0x1+-0x1*0x322),'sessions':[_0x182d42,...this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x269)]]},this.#shared[_0x9a8c3f(0x1d5)]=!![],await this.#saveIndex(),{'id':_0x182d42['id'],'title':_0x182d42[_0x9a8c3f(0x22f)],'workspace':_0x182d42[_0x9a8c3f(0x229)],'createdAt':_0x182d42[_0x9a8c3f(0x20a)],'lastActivityAt':_0x182d42[_0x9a8c3f(0x20a)]};}catch(_0x112acc){this.#shared[_0x9a8c3f(0x21b)][_0x9a8c3f(0x1f2)](_0x182d42['id']);const _0x3e3414=this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x269)][_0x9a8c3f(0x1d2)](_0xe5ff3a=>_0xe5ff3a['id']===_0x182d42['id']);_0x3e3414>=0x350+-0x186a+-0x92*-0x25&&(this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x269)][_0x9a8c3f(0x1dc)](_0x3e3414,-0x1b*-0xb+-0x264+0x1*0x13c),this.#shared[_0x9a8c3f(0x271)][_0x9a8c3f(0x231)]++,this.#shared[_0x9a8c3f(0x1d5)]=!![],await this.#saveIndex(_0x182d42['id'])[_0x9a8c3f(0x1ea)](()=>undefined));this.#shared[_0x9a8c3f(0x270)][_0x9a8c3f(0x1f2)](_0x182d42['id']),await rm(join(this.#shared[_0x9a8c3f(0x25e)],_0x9a8c3f(0x269),_0x182d42['id']),{'recursive':!![],'force':!![]})[_0x9a8c3f(0x1ea)](()=>undefined);throw _0x112acc;}}finally{await _0x514b20();}}async[_0x401a91(0x1d8)](_0x5caaa7,_0x366964,_0x32c943={}){const _0x1942b0=_0x401a91;this.#assertOpen();const _0x2b77cd=_0x366964[_0x1942b0(0x1c6)]();if(!_0x2b77cd)throw new MarAgentError(_0x1942b0(0x240),_0x1942b0(0x205));const _0x47d916=this.#shared[_0x1942b0(0x271)][_0x1942b0(0x269)][_0x1942b0(0x1fd)](_0x53bae8=>_0x53bae8['id']===_0x5caaa7);if(!_0x47d916)throw new MarAgentError(_0x1942b0(0x1ca),_0x1942b0(0x266));await this[_0x1942b0(0x265)](_0x5caaa7,{'type':_0x1942b0(0x224),'payload':{'title':_0x2b77cd,'automatic':!![]},..._0x32c943[_0x1942b0(0x1d7)]?{'executionId':_0x32c943[_0x1942b0(0x1d7)]}:{},..._0x32c943[_0x1942b0(0x1fb)]?{'turnId':_0x32c943[_0x1942b0(0x1fb)]}:{}}),_0x47d916[_0x1942b0(0x22f)]=_0x2b77cd;}async[_0x401a91(0x1d6)](_0x47abe1){const _0x570436=_0x401a91;this.#assertOpen(),await this.#refreshIndex();const _0x17c3dc=this.#shared[_0x570436(0x271)][_0x570436(0x269)][_0x570436(0x1fd)](_0x52c8af=>_0x52c8af['id']===_0x47abe1);if(!_0x17c3dc)throw new MarAgentError(_0x570436(0x1ca),_0x570436(0x266));return{'id':_0x17c3dc['id'],'title':_0x17c3dc[_0x570436(0x22f)],'workspace':_0x17c3dc[_0x570436(0x229)],'createdAt':_0x17c3dc[_0x570436(0x20a)],'lastActivityAt':_0x17c3dc[_0x570436(0x1b9)]};}async[_0x401a91(0x265)](_0x11d76b,_0x14b8e8){const _0x529939=_0x401a91;this.#assertOpen();const _0x2b55e6=this.#shared[_0x529939(0x271)][_0x529939(0x269)][_0x529939(0x1fd)](_0x1f3768=>_0x1f3768['id']===_0x11d76b)??this.#shared[_0x529939(0x21b)][_0x529939(0x1db)](_0x11d76b);if(!_0x2b55e6)throw new MarAgentError(_0x529939(0x1ca),_0x529939(0x266));const _0x1d6573=!this.#shared[_0x529939(0x21b)][_0x529939(0x216)](_0x11d76b),_0x49d7ad={'schemaVersion':0x1,'recordId':randomUUID(),'sequence':_0x2b55e6[_0x529939(0x22d)]++,'timestamp':_0x14b8e8[_0x529939(0x232)]??new Date()[_0x529939(0x1df)](),'sessionId':_0x11d76b,..._0x14b8e8[_0x529939(0x1d7)]?{'executionId':_0x14b8e8[_0x529939(0x1d7)]}:{},..._0x14b8e8[_0x529939(0x1fb)]?{'turnId':_0x14b8e8[_0x529939(0x1fb)]}:{},'type':_0x14b8e8[_0x529939(0x1f0)],'payload':_0x14b8e8[_0x529939(0x230)]},_0x595d9b=JSON[_0x529939(0x1ff)](_0x49d7ad)+'\x0a';let _0x78da38=await this.#currentSegment(_0x11d76b),_0x5e7409=this.#segmentPath(_0x11d76b,_0x78da38);try{const _0x1e5733=await stat(_0x5e7409);_0x1e5733[_0x529939(0x1ec)]>-0x1af2+0x267c+-0xb8a&&_0x1e5733[_0x529939(0x1ec)]+Buffer[_0x529939(0x210)](_0x595d9b)>MAX_SEGMENT_BYTES&&(_0x78da38+=0x2*-0x98e+-0x70b+0x1a28,this.#shared[_0x529939(0x270)][_0x529939(0x1e9)](_0x11d76b,_0x78da38),_0x5e7409=this.#segmentPath(_0x11d76b,_0x78da38));}catch{}const _0x57dbed=await open(_0x5e7409,'a',-0x1*-0x2476+0x749+-0x2a3f);try{await _0x57dbed[_0x529939(0x1e7)](_0x595d9b),await _0x57dbed[_0x529939(0x1be)]();}finally{await _0x57dbed[_0x529939(0x1da)]();}const _0x1436fd=_0x2b55e6[_0x529939(0x270)]??(_0x2b55e6[_0x529939(0x270)]=[]),_0x3d1895=_0x1436fd[_0x529939(0x1fd)](_0x511427=>_0x511427[_0x529939(0x1dd)]===_0x78da38);if(_0x3d1895)_0x3d1895[_0x529939(0x1fa)]=_0x49d7ad[_0x529939(0x1c1)],_0x3d1895[_0x529939(0x1d3)]+=Buffer[_0x529939(0x210)](_0x595d9b);else _0x1436fd[_0x529939(0x23a)]({'number':_0x78da38,'firstSequence':_0x49d7ad[_0x529939(0x1c1)],'lastSequence':_0x49d7ad[_0x529939(0x1c1)],'bytes':Buffer[_0x529939(0x210)](_0x595d9b)});return _0x2b55e6[_0x529939(0x1b9)]=_0x49d7ad[_0x529939(0x232)],this.#applyRecordToResumeIndex(_0x2b55e6,_0x49d7ad),_0x1d6573&&(this.#shared[_0x529939(0x271)][_0x529939(0x231)]++,this.#shared[_0x529939(0x1d5)]=!![]),_0x49d7ad;}async[_0x401a91(0x27e)](_0x4befe9){const _0x4808dd=_0x401a91;this.#assertOpen();try{const _0x3a14d0=[];for(const _0xb53569 of await this.#segmentPaths(_0x4befe9))_0x3a14d0[_0x4808dd(0x23a)](...await readRecords(_0xb53569));return _0x3a14d0;}catch(_0x15ab3b){if(_0x15ab3b instanceof MarAgentError)throw _0x15ab3b;throw new MarAgentError(_0x4808dd(0x1ca),_0x4808dd(0x266),{'cause':_0x15ab3b});}}async[_0x401a91(0x23b)](_0x564a74){const _0x457f56=_0x401a91;this.#assertOpen();const _0x571e96=this.#shared[_0x457f56(0x271)][_0x457f56(0x269)][_0x457f56(0x1fd)](_0x183e6e=>_0x183e6e['id']===_0x564a74);if(!_0x571e96)throw new MarAgentError(_0x457f56(0x1ca),_0x457f56(0x266));if(_0x571e96[_0x457f56(0x20e)]?.[_0x457f56(0x27c)]!==0x109*0x1+-0x250f+-0x191*-0x17||typeof _0x571e96[_0x457f56(0x208)]!==_0x457f56(0x1e0)||_0x571e96[_0x457f56(0x20e)][_0x457f56(0x25f)]===undefined)return this.#rebuildExecutionState(_0x571e96);try{const _0x369291=await this.#readFromSequence(_0x571e96,_0x571e96[_0x457f56(0x20e)][_0x457f56(0x25f)]);if(_0x369291[-0x2*-0x6e3+0x11ef+-0x1*0x1fb5]?.[_0x457f56(0x1c1)]!==_0x571e96[_0x457f56(0x20e)][_0x457f56(0x25f)]||!isCompactCheckpoint(_0x369291[0x1a60+-0xc22+0x71f*-0x2])||_0x369291[_0x457f56(0x247)]((_0x19db98,_0x500bfe)=>_0x500bfe>0x1ecd+-0x4*-0x7c9+-0x1*0x3df1&&isCompactCheckpoint(_0x19db98)))return this.#rebuildExecutionState(_0x571e96);const _0x25359e=await this.#readIndexedTodo(_0x571e96,_0x369291);if(!_0x25359e)return this.#rebuildExecutionState(_0x571e96);return{'automaticTitlePending':_0x571e96[_0x457f56(0x208)],'todo':_0x25359e,'contextRecords':_0x369291};}catch{return this.#rebuildExecutionState(_0x571e96);}}async[_0x401a91(0x1c4)](_0x594e09){const _0x6af384=_0x401a91;return(await this[_0x6af384(0x23b)](_0x594e09))[_0x6af384(0x251)];}async[_0x401a91(0x1c5)](_0xb092e6,_0x2c4031={}){const _0x432b33=_0x401a91,_0x545cb0=this.#shared[_0x432b33(0x271)][_0x432b33(0x269)][_0x432b33(0x1fd)](_0x286361=>_0x286361['id']===_0xb092e6);if(!_0x545cb0)throw new MarAgentError(_0x432b33(0x1ca),_0x432b33(0x266));const _0x12f54d=_0x2c4031[_0x432b33(0x267)]??Number[_0x432b33(0x1cf)],_0x3b5485=Math[_0x432b33(0x1ce)](-0x1271*0x1+0x1ade+-0x485,Math[_0x432b33(0x1bc)](0x4c*-0x79+0x1*0xac1+0xc*0x219,_0x2c4031[_0x432b33(0x206)]??0x266+-0x1*-0x6d+0x59*-0x7)),_0x4734f6=[];let _0x49e90a=![];const _0x3c3714=(await this.#segmentPaths(_0xb092e6))[_0x432b33(0x26a)]();for(const [_0x102f65,_0x8dc462]of _0x3c3714[_0x432b33(0x1e8)]()){const _0x50a403=segmentNumberFromPath(_0x8dc462),_0x24c73f=_0x545cb0[_0x432b33(0x270)]?.[_0x432b33(0x1fd)](_0x2efd8d=>_0x2efd8d[_0x432b33(0x1dd)]===_0x50a403);if(_0x24c73f!==undefined&&_0x24c73f[_0x432b33(0x255)]>=_0x12f54d)continue;const _0x2086c8=_0x3b5485-_0x4734f6[_0x432b33(0x280)],_0x404e46=await readRecordPageFromTail(_0x8dc462,_0x12f54d,_0x2086c8);_0x4734f6[_0x432b33(0x215)](..._0x404e46[_0x432b33(0x219)]);if(_0x404e46[_0x432b33(0x1c7)]){_0x49e90a=!![];break;}if(_0x4734f6[_0x432b33(0x280)]>=_0x3b5485){_0x49e90a=_0x102f65<_0x3c3714[_0x432b33(0x280)]-(-0xf1f+0x25c6+-0x16a6);break;}}const _0x1a32b5=_0x49e90a?_0x4734f6[0x1*-0x1cf1+0xa3*0x31+0x2*-0x121]?.[_0x432b33(0x1c1)]:undefined;return{'records':_0x4734f6,..._0x1a32b5?{'previousBeforeSequence':_0x1a32b5}:{}};}async[_0x401a91(0x218)](_0x552874,_0x222ffa){const _0x18a0dd=_0x401a91;if(!_0x222ffa[_0x18a0dd(0x1e5)][_0x18a0dd(0x1c6)]())throw new MarAgentError(_0x18a0dd(0x240),_0x18a0dd(0x1f5));const _0x37afcd=this.#shared[_0x18a0dd(0x271)][_0x18a0dd(0x269)][_0x18a0dd(0x1fd)](_0xb46e72=>_0xb46e72['id']===_0x552874);if(!_0x37afcd)throw new MarAgentError(_0x18a0dd(0x1ca),_0x18a0dd(0x266));return this[_0x18a0dd(0x265)](_0x552874,{'type':_0x18a0dd(0x27d),'payload':{'summary':_0x222ffa[_0x18a0dd(0x1e5)],'boundarySequence':_0x37afcd[_0x18a0dd(0x22d)]-(-0xc13+0x208b*-0x1+0x1*0x2c9f),'automatic':_0x222ffa[_0x18a0dd(0x1de)]===!![],..._0x222ffa[_0x18a0dd(0x225)]===undefined?{}:{'modelId':_0x222ffa[_0x18a0dd(0x225)]}},..._0x222ffa[_0x18a0dd(0x1d7)]?{'executionId':_0x222ffa[_0x18a0dd(0x1d7)]}:{},..._0x222ffa[_0x18a0dd(0x1fb)]?{'turnId':_0x222ffa[_0x18a0dd(0x1fb)]}:{}});}async[_0x401a91(0x1cc)](_0xbc9b1){const _0xcffe04=_0x401a91;this.#assertOpen(),await this.#refreshIndex();if(!this.#shared[_0xcffe04(0x271)][_0xcffe04(0x269)][_0xcffe04(0x247)](_0x1a8479=>_0x1a8479['id']===_0xbc9b1))throw new MarAgentError(_0xcffe04(0x1ca),_0xcffe04(0x266));const _0x4121bf=join(this.#shared[_0xcffe04(0x25e)],_0xcffe04(0x269),_0xbc9b1,_0xcffe04(0x200)),_0x2f16e8=await acquireFileLock(_0x4121bf,_0xcffe04(0x1bf),-0x1d9f+0xd3+0x1ccc);try{await this.#reconcileTail(_0xbc9b1);}catch(_0x525f03){await _0x2f16e8();throw _0x525f03;}return async()=>{const _0x101ce7=_0xcffe04;try{if(this.#shared[_0x101ce7(0x1d5)])await this.#saveIndex();}finally{await _0x2f16e8();}};}async[_0x401a91(0x239)](_0x26940e={}){const _0x2969fa=_0x401a91;this.#assertOpen(),await this.#refreshIndex();const _0x4322ca=_0x26940e[_0x2969fa(0x1f4)]?Number(Buffer[_0x2969fa(0x21e)](_0x26940e[_0x2969fa(0x1f4)],_0x2969fa(0x204))[_0x2969fa(0x22e)](_0x2969fa(0x1f3))):0x963+-0xc*-0x57+-0xd77,_0x2210bc=Math[_0x2969fa(0x1ce)](0xeed+-0x1a56*-0x1+-0x1*0x287b,Math[_0x2969fa(0x1bc)](0x775*0x1+0x5*0x30a+-0x1be*0xd,_0x26940e[_0x2969fa(0x206)]??0x43*-0x13+0x53+0x4d8)),_0x3d0863=[...this.#shared[_0x2969fa(0x271)][_0x2969fa(0x269)]][_0x2969fa(0x25c)]((_0x2b9527,_0x1fc8c7)=>_0x1fc8c7[_0x2969fa(0x1b9)][_0x2969fa(0x275)](_0x2b9527[_0x2969fa(0x1b9)])),_0x52ccbd=_0x3d0863[_0x2969fa(0x26e)](_0x4322ca,_0x4322ca+_0x2210bc)[_0x2969fa(0x272)](_0x2446db=>({'id':_0x2446db['id'],'title':_0x2446db[_0x2969fa(0x22f)],'workspace':_0x2446db[_0x2969fa(0x229)],'createdAt':_0x2446db[_0x2969fa(0x20a)],'lastActivityAt':_0x2446db[_0x2969fa(0x1b9)]})),_0x4b1e07=_0x4322ca+_0x2210bc<_0x3d0863[_0x2969fa(0x280)]?Buffer[_0x2969fa(0x21e)](String(_0x4322ca+_0x2210bc))[_0x2969fa(0x22e)](_0x2969fa(0x204)):undefined;return{'sessions':_0x52ccbd,..._0x4b1e07?{'nextCursor':_0x4b1e07}:{}};}#applyRecordToResumeIndex(_0x401387,_0x547594){const _0x368f96=_0x401a91;if(_0x547594[_0x368f96(0x1f0)]===_0x368f96(0x259))_0x401387[_0x368f96(0x208)]=![];const _0xe87cdd=_0x401387[_0x368f96(0x20e)];if(_0xe87cdd?.[_0x368f96(0x27c)]!==0x2033+0x23*-0xf1+0x1*0xc1||!Number[_0x368f96(0x1cb)](_0xe87cdd[_0x368f96(0x27f)]))return;if(isCompactCheckpoint(_0x547594))_0xe87cdd[_0x368f96(0x25f)]=_0x547594[_0x368f96(0x1c1)];if(_0x547594[_0x368f96(0x1f0)]!==_0x368f96(0x1f7)||!todoItemsFromSnapshot(_0x547594[_0x368f96(0x230)]))return;_0xe87cdd[_0x368f96(0x257)]=_0x547594[_0x368f96(0x1c1)],_0xe87cdd[_0x368f96(0x27f)]++;}async #readIndexedTodo(_0x151718,_0x1babd8){const _0x167556=_0x401a91,_0x2f1752=_0x151718[_0x167556(0x20e)];if(_0x2f1752?.[_0x167556(0x27c)]!==-0x2116+0x2371+-0x25a||!Number[_0x167556(0x1cb)](_0x2f1752[_0x167556(0x27f)])||_0x2f1752[_0x167556(0x27f)]<0x121f*0x2+0xa*-0x177+-0x1598)return undefined;const _0x35b3f5=_0x1babd8[_0x167556(0x209)](_0x4fdd54=>_0x4fdd54[_0x167556(0x1f0)]===_0x167556(0x1f7)&&todoItemsFromSnapshot(_0x4fdd54[_0x167556(0x230)])!==undefined);if(_0x35b3f5&&(_0x2f1752[_0x167556(0x257)]===undefined||_0x35b3f5[_0x167556(0x1c1)]!==_0x2f1752[_0x167556(0x257)]))return undefined;if(_0x2f1752[_0x167556(0x257)]===undefined)return _0x2f1752[_0x167556(0x27f)]===0x1d15*-0x1+-0x32f*-0x2+-0x5*-0x48b?{'revision':0x0,'items':[]}:undefined;if(_0x2f1752[_0x167556(0x27f)]===0x1bc1+-0x42*-0x2f+0x1*-0x27df)return undefined;const _0x3ffe55=_0x1babd8[_0x167556(0x1fd)](_0x374617=>_0x374617[_0x167556(0x1c1)]===_0x2f1752[_0x167556(0x257)])??await this.#readRecordAtSequence(_0x151718,_0x2f1752[_0x167556(0x257)]);if(_0x3ffe55?.[_0x167556(0x1f0)]!==_0x167556(0x1f7))return undefined;const _0x5e0395=todoItemsFromSnapshot(_0x3ffe55[_0x167556(0x230)]);return _0x5e0395?{'revision':_0x2f1752[_0x167556(0x27f)],'items':_0x5e0395}:undefined;}async #readRecordAtSequence(_0x54e2be,_0x57eb0e){const _0x565b08=_0x401a91,_0x475d03=_0x54e2be[_0x565b08(0x270)]?.[_0x565b08(0x1fd)](_0x5d7110=>_0x5d7110[_0x565b08(0x255)]<=_0x57eb0e&&_0x5d7110[_0x565b08(0x1fa)]>=_0x57eb0e);if(!_0x475d03)return undefined;return(await readRecords(this.#segmentPath(_0x54e2be['id'],_0x475d03[_0x565b08(0x1dd)])))[_0x565b08(0x1fd)](_0x397f2e=>_0x397f2e[_0x565b08(0x1c1)]===_0x57eb0e);}async #readFromSequence(_0x8deb7c,_0xa5caff){const _0x5391f1=_0x401a91,_0x5324a8=(_0x8deb7c[_0x5391f1(0x270)]??[])[_0x5391f1(0x22b)](_0xa6c8f6=>_0xa6c8f6[_0x5391f1(0x1fa)]>=_0xa5caff)[_0x5391f1(0x25c)]((_0x51028e,_0x52e086)=>_0x51028e[_0x5391f1(0x1dd)]-_0x52e086[_0x5391f1(0x1dd)]);if(_0x5324a8[_0x5391f1(0x280)]===-0x16c6+-0x1*0x254f+0x3c15)throw new MarAgentError(_0x5391f1(0x261),_0x5391f1(0x1c2));const _0x586459=[];for(const _0x3da4d3 of _0x5324a8)_0x586459[_0x5391f1(0x23a)](...(await readRecords(this.#segmentPath(_0x8deb7c['id'],_0x3da4d3[_0x5391f1(0x1dd)])))[_0x5391f1(0x22b)](_0x1b5aee=>_0x1b5aee[_0x5391f1(0x1c1)]>=_0xa5caff));return _0x586459;}async #rebuildExecutionState(_0x5a9697){const _0xcf7280=_0x401a91,_0x281f57=deriveExecutionState(await this[_0xcf7280(0x27e)](_0x5a9697['id']));return(_0x5a9697[_0xcf7280(0x208)]!==_0x281f57[_0xcf7280(0x208)]||!sameResumeIndex(_0x5a9697[_0xcf7280(0x20e)],_0x281f57[_0xcf7280(0x20e)]))&&(_0x5a9697[_0xcf7280(0x208)]=_0x281f57[_0xcf7280(0x208)],_0x5a9697[_0xcf7280(0x20e)]=_0x281f57[_0xcf7280(0x20e)],this.#shared[_0xcf7280(0x271)][_0xcf7280(0x231)]++,this.#shared[_0xcf7280(0x1d5)]=!![]),{'automaticTitlePending':_0x281f57[_0xcf7280(0x208)],'todo':_0x281f57[_0xcf7280(0x249)],'contextRecords':_0x281f57[_0xcf7280(0x251)]};}async[_0x401a91(0x1f2)](_0x5435a4){const _0x526f63=_0x401a91;this.#assertOpen();const _0xe05b06=this.#shared[_0x526f63(0x271)][_0x526f63(0x269)][_0x526f63(0x1d2)](_0x46f9b0=>_0x46f9b0['id']===_0x5435a4);if(_0xe05b06<0x15f7+0x5*-0x30b+-0x6c0)throw new MarAgentError(_0x526f63(0x1ca),_0x526f63(0x266));await rm(join(this.#shared[_0x526f63(0x25e)],_0x526f63(0x269),_0x5435a4),{'recursive':!![]}),this.#shared[_0x526f63(0x270)][_0x526f63(0x1f2)](_0x5435a4),this.#shared[_0x526f63(0x271)][_0x526f63(0x269)][_0x526f63(0x1dc)](_0xe05b06,-0x587+0x2e*-0x3a+0xff4),this.#shared[_0x526f63(0x271)][_0x526f63(0x231)]++,await this.#saveIndex(_0x5435a4);}#assertOpen(){const _0x18f24e=_0x401a91;if(this.#leaseClosed||this.#shared[_0x18f24e(0x237)])throw new MarAgentError(_0x18f24e(0x258),_0x18f24e(0x1f9));}#segmentPath(_0x76ffae,_0x1e22a7){const _0x4dcdc9=_0x401a91;return join(this.#shared[_0x4dcdc9(0x25e)],_0x4dcdc9(0x269),_0x76ffae,_0x4dcdc9(0x248)+String(_0x1e22a7)[_0x4dcdc9(0x1bb)](0x1*0x12f0+-0x1aa4+0x7ba,'0')+_0x4dcdc9(0x256));}async #segmentPaths(_0x4c9de5){const _0x35980c=_0x401a91,_0x3aff1f=join(this.#shared[_0x35980c(0x25e)],_0x35980c(0x269),_0x4c9de5),_0x352343=(await readdir(_0x3aff1f))[_0x35980c(0x22b)](_0x4b4057=>/^events-\d{6}\.jsonl$/[_0x35980c(0x25a)](_0x4b4057))[_0x35980c(0x25c)]();if(_0x352343[_0x35980c(0x280)]===-0x14*-0x6b+0x2514+-0x2d70)throw new MarAgentError(_0x35980c(0x1ca),_0x35980c(0x266));return _0x352343[_0x35980c(0x272)](_0x513ce1=>join(_0x3aff1f,_0x513ce1));}async #currentSegment(_0x1f4cd8){const _0x1f9baa=_0x401a91,_0x24a20e=this.#shared[_0x1f9baa(0x270)][_0x1f9baa(0x1db)](_0x1f4cd8);if(_0x24a20e!==undefined)return _0x24a20e;const _0x23e877=this.#shared[_0x1f9baa(0x271)][_0x1f9baa(0x269)][_0x1f9baa(0x1fd)](_0x4aed42=>_0x4aed42['id']===_0x1f4cd8),_0x415ad7=_0x23e877?.[_0x1f9baa(0x270)]?.['at'](-(-0x2*-0x9e+0xa9+0x16*-0x16))?.[_0x1f9baa(0x1dd)];if(_0x415ad7!==undefined)return this.#shared[_0x1f9baa(0x270)][_0x1f9baa(0x1e9)](_0x1f4cd8,_0x415ad7),_0x415ad7;const _0x175cad=await this.#segmentPaths(_0x1f4cd8),_0x52a771=/events-(\d{6})\.jsonl$/[_0x1f9baa(0x1ed)](_0x175cad['at'](-(0x2d3*0x8+-0x3*0xaa8+0x961))),_0x4e28e2=Number(_0x52a771?.[-0x8ef*0x1+-0x890+0x1c*0xa0]??-0x52*0x1f+-0x1f8d*0x1+-0x24*-0x127);return this.#shared[_0x1f9baa(0x270)][_0x1f9baa(0x1e9)](_0x1f4cd8,_0x4e28e2),_0x4e28e2;}async #reconcileTail(_0x2bcae3){const _0x1c223c=_0x401a91,_0x391d51=this.#shared[_0x1c223c(0x271)][_0x1c223c(0x269)][_0x1c223c(0x1fd)](_0xe5dc61=>_0xe5dc61['id']===_0x2bcae3),_0x1cca6f=await this.#segmentPaths(_0x2bcae3),_0x4d196b=_0x1cca6f['at'](-(-0x20f1*-0x1+-0x1*0x1d37+-0x3b9)),_0x1bed01=await readRecords(_0x4d196b),_0x56689d=_0x1bed01['at'](-(-0x1dc1+-0x1dba+-0x2f*-0x144)),_0x811bfb=/events-(\d{6})\.jsonl$/[_0x1c223c(0x1ed)](_0x4d196b),_0x5c7a4a=Number(_0x811bfb?.[0x174d+0x1ff0+0x3f2*-0xe]??0x905*-0x2+-0xc93*-0x3+-0x13ae);this.#shared[_0x1c223c(0x270)][_0x1c223c(0x1e9)](_0x2bcae3,_0x5c7a4a);if(_0x56689d===undefined)return;const _0x5501f9=(await stat(_0x4d196b))[_0x1c223c(0x1ec)],_0x516304=_0x1bed01[-0x36a*0x1+-0x13d4+0x253*0xa][_0x1c223c(0x1c1)],_0x3c4dcc=_0x391d51[_0x1c223c(0x270)]?.[_0x1c223c(0x1fd)](_0x4598af=>_0x4598af[_0x1c223c(0x1dd)]===_0x5c7a4a),_0x1975a1=_0x1bed01[_0x1c223c(0x209)](_0x36f39e=>_0x36f39e[_0x1c223c(0x1f0)]===_0x1c223c(0x224)&&typeof _0x36f39e[_0x1c223c(0x230)][_0x1c223c(0x22f)]===_0x1c223c(0x25d)),_0x55209d=_0x1975a1?.[_0x1c223c(0x230)]?.[_0x1c223c(0x22f)],_0x562d6f=_0x391d51[_0x1c223c(0x22d)]<=_0x56689d[_0x1c223c(0x1c1)]||_0x3c4dcc?.[_0x1c223c(0x1d3)]!==_0x5501f9||_0x55209d!==undefined&&_0x391d51[_0x1c223c(0x22f)]!==_0x55209d;_0x391d51[_0x1c223c(0x22d)]=Math[_0x1c223c(0x1bc)](_0x391d51[_0x1c223c(0x22d)],_0x56689d[_0x1c223c(0x1c1)]+(-0x1*-0x1385+-0x28d+-0x1*0x10f7));if(_0x55209d!==undefined)_0x391d51[_0x1c223c(0x22f)]=_0x55209d;_0x391d51[_0x1c223c(0x1b9)]=_0x391d51[_0x1c223c(0x1b9)]<_0x56689d[_0x1c223c(0x232)]?_0x56689d[_0x1c223c(0x232)]:_0x391d51[_0x1c223c(0x1b9)];if(!_0x391d51[_0x1c223c(0x270)])_0x391d51[_0x1c223c(0x270)]=[];if(_0x3c4dcc)_0x3c4dcc[_0x1c223c(0x255)]=_0x516304,_0x3c4dcc[_0x1c223c(0x1fa)]=_0x56689d[_0x1c223c(0x1c1)],_0x3c4dcc[_0x1c223c(0x1d3)]=_0x5501f9;else _0x391d51[_0x1c223c(0x270)][_0x1c223c(0x23a)]({'number':_0x5c7a4a,'firstSequence':_0x516304,'lastSequence':_0x56689d[_0x1c223c(0x1c1)],'bytes':_0x5501f9});_0x562d6f&&(delete _0x391d51[_0x1c223c(0x208)],delete _0x391d51[_0x1c223c(0x20e)],this.#shared[_0x1c223c(0x271)][_0x1c223c(0x231)]++,this.#shared[_0x1c223c(0x1d5)]=!![]);}async[_0x401a91(0x1da)](){const _0x2507a8=_0x401a91;if(this.#leaseClosed)return;this.#leaseClosed=!![],this.#shared[_0x2507a8(0x1f8)]--;if(this.#shared[_0x2507a8(0x1f8)]>-0x17*0x95+0xba0+0x1c3)return;if(this.#shared[_0x2507a8(0x1d5)])await this.#saveIndex();this.#shared[_0x2507a8(0x237)]=!![],JsonlSessionStore.#instances[_0x2507a8(0x1f2)](this.#shared[_0x2507a8(0x25e)]);}}function _0x2de8(_0x4b7fa9,_0x237736){_0x4b7fa9=_0x4b7fa9-(-0x25f3+-0x2609+0x4db2);const _0x3bce31=_0x2bba();let _0x2dc377=_0x3bce31[_0x4b7fa9];if(_0x2de8['knnrYF']===undefined){var _0x19d93e=function(_0x4b0725){const _0x5738ae='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x15987f='',_0x510cf6='';for(let _0x53e30b=-0x3*-0xafc+-0x781*0x5+0xa7*0x7,_0x2d6038,_0x3ad70d,_0x4e88c0=0xe48*-0x1+0xd6e+0xda;_0x3ad70d=_0x4b0725['charAt'](_0x4e88c0++);~_0x3ad70d&&(_0x2d6038=_0x53e30b%(-0x8d7*0x1+0xce+0x80d)?_0x2d6038*(-0x1*-0xfa7+-0x1*-0x1079+-0x1fe0)+_0x3ad70d:_0x3ad70d,_0x53e30b++%(0x25fa+-0x778+0x1*-0x1e7e))?_0x15987f+=String['fromCharCode'](-0x1d93+0x35*0xad+-0x4f*0x11&_0x2d6038>>(-(0xe09+0xee2+0x3*-0x9a3)*_0x53e30b&-0x1*-0x16c+0x53*0x34+-0x1242)):-0x59*-0x65+-0xb*0x163+0x3e*-0x52){_0x3ad70d=_0x5738ae['indexOf'](_0x3ad70d);}for(let _0x31debb=0x1b78+0xa5c+-0x327*0xc,_0x2c4177=_0x15987f['length'];_0x31debb<_0x2c4177;_0x31debb++){_0x510cf6+='%'+('00'+_0x15987f['charCodeAt'](_0x31debb)['toString'](0x109e*0x2+0x7*0x185+0x1*-0x2bcf))['slice'](-(0x2*0x1088+0x1388+0x6a*-0x7f));}return decodeURIComponent(_0x510cf6);};_0x2de8['SWAiLq']=_0x19d93e,_0x2de8['sLlNfC']={},_0x2de8['knnrYF']=!![];}const _0x579324=_0x3bce31[0x3c1*-0x7+-0x1d*0x1e+0x47*0x6b];_0x2de8['mdqROx']!==_0x579324&&(_0x2de8['sLlNfC']={},_0x2de8['mdqROx']=_0x579324);const _0x612389=_0x2de8['sLlNfC'][_0x4b7fa9];return _0x612389===undefined?(_0x2dc377=_0x2de8['SWAiLq'](_0x2dc377),_0x2de8['sLlNfC'][_0x4b7fa9]=_0x2dc377):_0x2dc377=_0x612389,_0x2dc377;}function generatedImageFileNames(_0x5db904){const _0x441e89=_0x401a91,_0x1b6758=new Set();for(const _0x4cfca5 of _0x5db904){if(_0x4cfca5[_0x441e89(0x1f0)]!==_0x441e89(0x241)||!isObject(_0x4cfca5[_0x441e89(0x230)]))continue;const _0x1bd33a=_0x4cfca5[_0x441e89(0x230)][_0x441e89(0x207)];if(!Array[_0x441e89(0x24b)](_0x1bd33a))continue;for(const _0x59ad7c of _0x1bd33a){if(!isObject(_0x59ad7c)||_0x59ad7c[_0x441e89(0x1e2)]!==_0x441e89(0x24f)||typeof _0x59ad7c[_0x441e89(0x264)]!==_0x441e89(0x25d)||basename(_0x59ad7c[_0x441e89(0x264)])!==_0x59ad7c[_0x441e89(0x264)]||!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}\.png$/u[_0x441e89(0x25a)](_0x59ad7c[_0x441e89(0x264)]))continue;_0x1b6758[_0x441e89(0x217)](_0x59ad7c[_0x441e89(0x264)]);}}return[..._0x1b6758];}async function copyGeneratedImages(_0x35c12d,_0x284d14,_0xc93a65){const _0xd03367=_0x401a91;if(_0xc93a65[_0xd03367(0x280)]===0xaab+0x1*0xdcb+0x1876*-0x1)return;const _0x8189c2=join(_0x35c12d,_0xd03367(0x1d1)),_0x13ce99=join(_0x284d14,_0xd03367(0x1d1));await mkdir(_0x13ce99,{'recursive':!![]});for(const _0x23e2ab of _0xc93a65)await copyFile(join(_0x8189c2,_0x23e2ab),join(_0x13ce99,_0x23e2ab));}function inputImageReferencesFromRecords(_0x15bea4){const _0x4bea4c=_0x401a91,_0x5f061c=new Map();for(const _0x5ac424 of _0x15bea4){if(_0x5ac424[_0x4bea4c(0x1f0)]!==_0x4bea4c(0x259)||!isObject(_0x5ac424[_0x4bea4c(0x230)]))continue;for(const _0x7f3042 of inputImageReferences(_0x5ac424[_0x4bea4c(0x230)][_0x4bea4c(0x27b)])){const _0x9cdb92=_0x5f061c[_0x4bea4c(0x1db)](_0x7f3042[_0x4bea4c(0x264)]);if(_0x9cdb92!==undefined&&(_0x9cdb92[_0x4bea4c(0x252)]!==_0x7f3042[_0x4bea4c(0x252)]||_0x9cdb92[_0x4bea4c(0x213)]!==_0x7f3042[_0x4bea4c(0x213)]||_0x9cdb92[_0x4bea4c(0x279)]!==_0x7f3042[_0x4bea4c(0x279)]))throw corruptInputImageReference();_0x5f061c[_0x4bea4c(0x1e9)](_0x7f3042[_0x4bea4c(0x264)],_0x7f3042);}}return[..._0x5f061c[_0x4bea4c(0x23f)]()];}function inputImageReferences(_0x2aa090){const _0x5c9046=_0x401a91;if(!Array[_0x5c9046(0x24b)](_0x2aa090))return[];const _0x1d7140=[];let _0x3cd7cc=0x17e*0x8+0x1a48+-0x2638;for(const _0x211f2a of _0x2aa090){const _0x164ac3=inputImageReference(_0x211f2a);if(_0x164ac3===undefined)continue;_0x3cd7cc+=_0x164ac3[_0x5c9046(0x213)];if(_0x1d7140[_0x5c9046(0x280)]>=MAX_INPUT_IMAGES||_0x3cd7cc>MAX_INPUT_IMAGES_BYTES)throw corruptInputImageReference();_0x1d7140[_0x5c9046(0x23a)](_0x164ac3);}return _0x1d7140;}function inputImageReference(_0x2afed1){const _0x53fce8=_0x401a91;if(!isObject(_0x2afed1)||!Object[_0x53fce8(0x23d)](_0x2afed1,_0x53fce8(0x264)))return undefined;if(typeof _0x2afed1[_0x53fce8(0x26c)]!==_0x53fce8(0x25d)||typeof _0x2afed1[_0x53fce8(0x252)]!==_0x53fce8(0x25d)||!INPUT_IMAGE_MIME_TYPES[_0x53fce8(0x216)](_0x2afed1[_0x53fce8(0x252)])||typeof _0x2afed1[_0x53fce8(0x213)]!==_0x53fce8(0x1dd)||!Number[_0x53fce8(0x1cb)](_0x2afed1[_0x53fce8(0x213)])||_0x2afed1[_0x53fce8(0x213)]<=-0x255b+0x86f*0x3+0xc0e||_0x2afed1[_0x53fce8(0x213)]>MAX_INPUT_IMAGE_BYTES||typeof _0x2afed1[_0x53fce8(0x264)]!==_0x53fce8(0x25d)||!validInputImageFileName(_0x2afed1[_0x53fce8(0x264)])||typeof _0x2afed1[_0x53fce8(0x279)]!==_0x53fce8(0x25d)||!/^[a-f0-9]{64}$/u[_0x53fce8(0x25a)](_0x2afed1[_0x53fce8(0x279)]))throw corruptInputImageReference();return{'name':_0x2afed1[_0x53fce8(0x26c)],'fileName':_0x2afed1[_0x53fce8(0x264)],'mimeType':_0x2afed1[_0x53fce8(0x252)],'byteSize':_0x2afed1[_0x53fce8(0x213)],'sha256':_0x2afed1[_0x53fce8(0x279)]};}function _0x2bba(){const _0x21eb48=['CgvYC2LZDeLUChv0sw1Hz2vZ','Aw1Hz2u','CgLK','y29UDgv4DfjLy29Yzhm','BwLTzvr5Cgu','B3bLBG','tufsx0fhru5ux1nfu1njt05Fte9ds0ve','zMLYC3rtzxf1zw5Jzq','lMPZB25S','Dg9KB1nLCxvLBMnL','tufsx0fhru5ux0rju1bpu0ve','DhvYBI51C2vY','DgvZDa','zw5KC1DPDgG','C29YDa','C3rYAw5N','CM9VDa','y29TCgfJDfnLCxvLBMnL','vg9Vig1HBNKGAw1Hz2uGAw5WDxrZihDLCMuGChjVDMLKzwqU','tufsx0fhru5ux1nfu1njt05Fq09suLvqva','Aw1Hz2uVD2vICa','rvnsq0G','zMLSzu5HBwu','yxbWzw5K','u2vZC2LVBIb3yxmGBM90igzVDw5KlG','yMvMB3jLu2vXDwvUy2u','zMXHDe1HCa','C2vZC2LVBNm','CMv2zxjZzq','mZq3mtC2nvPTs0LAta','BMfTzq','yMfZzty0','C2XPy2u','zgv2','C2vNBwvUDhm','Aw5KzxG','BwfW','tufsx0fhru5ux0Loufvux0nbuefcsuXjvfLFvu5tvvbqt1juruq','Aw1Hz2uVz2LM','Bg9JywXLq29TCgfYzq','BM93','ywDLBNq','CMvHzeLUChv0sw1Hz2u','C2HHmJu2','zMLUzeXHC3rjBMrLEa','Aw1Hz2vZ','DMvYC2LVBG','y29TCgfJDc5JB21WBgv0zwq','CMvHza','Dg9KB1jLDMLZAw9U','BgvUz3rO','C2vZC2LVBKLK','C2vZC2LVBKrPCMvJDg9YEq','zgf0yujHC2u2na','Aw1Hz2uVCg5N','BgfZDefJDgL2Axr5qxq','ywXS','CgfKu3rHCNq','Bwf4','yNL0zxnszwfK','C3LUyW','u2vZC2LVBIbHBhjLywr5igHHCYbHihDYAxrLCI4','u2vZC2LVBIbOAxn0B3j5igLZignVCNj1ChqU','C2vXDwvUy2u','u2vZC2LVBIbYzxn1BwuGAw5KzxGGAxmGAw52ywXPzc4','CgXHDgzVCM0','CMvHzenVBNrLEhq','CMvHzfbHz2u','DhjPBq','AgfZrwfYBgLLCG','y29Kzq','nJq1nZLNzLfkuhm','tufsx0fhru5ux1nfu1njt05FtK9ux0zpvu5e','AxntywzLsw50zwDLCG','ywnXDwLYzvnLC3nPB25mzwfZzq','C3vIyxjYyxK','BwLU','ue9tsvrjvKvFsu5gsu5jvfK','zMXVB3i','z2vUzxjHDgvKx2LTywDLCW','zMLUzeLUzgv4','yNL0zxm','Aw5WDxrFAw1Hz2vZ','Aw5KzxHeAxj0Eq','z2v0u2vZC2LVBG','zxHLy3v0Aw9Uswq','DxbKyxrLvgL0Bgu','yxv0B21HDgLJvgL0Bgu','y2XVC2u','z2v0','C3bSAwnL','BNvTyMvY','yxv0B21HDgLJ','Dg9ju09tDhjPBMC','yM9VBgvHBG','lM1HCG','A2LUza','u2vZC2LVBIbPBNb1DcbPBwfNzsbPCYbJB3jYDxb0lG','y29Uy2f0','C3vTBwfYEq','yM91BMrHCNLuDxjUswq','D3jPDgu','zw50CMLLCW','C2v0','y2f0y2G','y3rPBwvnCW','C2L6zq','zxHLyW','y3jLyxrLu2vZC2LVBG','u2vZC2LVBIbYzxDPBMqGDgfYz2v0ihDHCYbUB3qGzM91BMqU','DhLWzq','C3rHDa','zgvSzxrL','DxrMoa','y3vYC29Y','q29TCgfJDcbZDw1Tyxj5igLZihjLCxvPCMvKlG','u2vZC2LVBIbPBMrLEcbPCYbIDxn5lG','Dg9KBY51CgrHDgvK','CMvMzxjLBMnLCW','u2vZC2LVBIbZDg9YzsbPCYbJBg9ZzwqU','BgfZDfnLCxvLBMnL','DhvYBKLK','mJC2mdiWofbzBg1gCa','zMLUza','A2LSBa','C3rYAw5NAwz5','Bg9JAW','Aw1Hz2uVANbLzW','tMv3ihnLC3nPB24','CMvTB3zLsw5WDxrjBwfNzxm','yMfZzty0DxjS','u2vZC2LVBIb0AxrSzsbPCYbYzxf1AxjLzc4','BgLTAxq','yxj0AwzHy3rZ','yxv0B21HDgLJvgL0Bgvqzw5KAw5N','zMLUzeXHC3q','y3jLyxrLzef0','D2LUmZi','mJC0odKWmfjvq3vPsq','lNrTCa','CMvZDw1L','C2vZC2LVBI5JCMvHDgvK','yNL0zuXLBMD0Aa','zM9YA1nLC3nPB24','ywXSB2nvBNnHzMu','yNL0zvnPEMu','sw1Hz2uGAw5WDxqGtuLnrsb0ExbLigLZihvUC3vWCg9YDgvKlG','Dw5ZAgLMDa','AgfZ','ywrK','y29TCgfJDa','CMvJB3jKCW','D3jPDgvgAwXL','CgvUzgLUz1nLC3nPB25Z','Aw5KzxGUANnVBG','ywXSB2m','zNjVBq','C3bSAxq','Agv4','Aw1Hz2vjBMrLEa','ndy2mJe0mhDyEvHrwa','lMjPBG','C2vZC2LVBI50AxrSzs51CgrHDgvK','Bw9KzwXjza','zgLNzxn0','B2jQzwn0','t19ot0zpteXpvW','D29YA3nWywnL','tufsx0fhru5ux0Hpu1rFteLnsvrFrvHdruveruq','zMLSDgvY','sw1Hz2uGAw5WDxqGzxHJzwvKCYb0AguGC3vWCg9YDgvKihnPEMuGBgLTAxqU','BMv4DfnLCxvLBMnL','Dg9tDhjPBMC','DgL0Bgu','Cgf5Bg9Hza','CMv2AxnPB24','DgLTzxn0yw1W','CgfYC2u','mJi2mZG1ngrxwgLjBW','BxrPBwvnCW','AxngAwXL','y2XVC2vK','CMvHzeLUChv0sw1Hz2vZ','BgLZDa','ChvZAa','CMvHzev4zwn1DgLVBLn0yxrL','DxbKyxrL','AgfZt3DU','t19sre9otfK','DMfSDwvZ','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','Dg9VBc5JB21WBgv0zwq','Aw5V','Cg9W','tufsx0fhru5ux1jfv0Lorf9uqvjhrvrFsu5wquXjra','CMfUzg9T','mKz6B2rfAG','C29Tzq','zxzLBNrZlq','Dg9KBW','tufyx1nbrKvFsu5uruDfuG','AxnbCNjHEq','Aw5KzxGUBg9JAW','mtuYndC3mKTJqNbHDq'];_0x2bba=function(){return _0x21eb48;};return _0x2bba();}function validInputImageFileName(_0x217510){const _0x53a8b7=_0x401a91;return basename(_0x217510)===_0x217510&&/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}\.bin$/u[_0x53a8b7(0x25a)](_0x217510);}async function readInputImageBytes(_0x5a90b8,_0x2f547d){const _0xab9f21=_0x401a91,_0x51f075=join(_0x5a90b8,_0x2f547d[_0xab9f21(0x264)]);for(let _0x1c49ea=0x5e*-0x12+-0xaa1+0x113d;_0x1c49ea<0x3*-0x16f+0x2*-0x117e+0x274b;_0x1c49ea++){let _0x588f64;try{const _0x619807=await lstat(_0x51f075);if(!_0x619807[_0xab9f21(0x236)]()||_0x619807[_0xab9f21(0x1ec)]!==_0x2f547d[_0xab9f21(0x213)])throw corruptInputImageReference();const _0x3afe61=process[_0xab9f21(0x1c3)]===_0xab9f21(0x20b)?constants[_0xab9f21(0x23e)]:constants[_0xab9f21(0x23e)]|constants[_0xab9f21(0x228)];_0x588f64=await open(_0x51f075,_0x3afe61);const _0xcc88df=await _0x588f64[_0xab9f21(0x1f1)]();if(!_0xcc88df[_0xab9f21(0x236)]()||_0xcc88df[_0xab9f21(0x1ec)]!==_0x2f547d[_0xab9f21(0x213)]||_0xcc88df[_0xab9f21(0x26f)]!==_0x619807[_0xab9f21(0x26f)]||_0xcc88df[_0xab9f21(0x242)]!==_0x619807[_0xab9f21(0x242)])continue;const _0x5067b3=await readExactBytes(_0x588f64,_0x2f547d[_0xab9f21(0x213)]),_0x4b098a=await _0x588f64[_0xab9f21(0x1f1)]();if(_0x4b098a[_0xab9f21(0x1ec)]!==_0xcc88df[_0xab9f21(0x1ec)]||_0x4b098a[_0xab9f21(0x235)]!==_0xcc88df[_0xab9f21(0x235)]||_0x4b098a[_0xab9f21(0x1eb)]!==_0xcc88df[_0xab9f21(0x1eb)])continue;if(createHash(_0xab9f21(0x279))[_0xab9f21(0x23c)](_0x5067b3)[_0xab9f21(0x226)](_0xab9f21(0x220))!==_0x2f547d[_0xab9f21(0x279)])throw corruptInputImageReference();return _0x5067b3;}catch(_0x35de46){if(_0x35de46 instanceof MarAgentError)throw _0x35de46;throw corruptInputImageReference(_0x35de46);}finally{await _0x588f64?.[_0xab9f21(0x1da)]();}}throw corruptInputImageReference();}async function readExactBytes(_0x5cb9af,_0x3b6251){const _0x386824=_0x401a91,_0x3a12c6=Buffer[_0x386824(0x21d)](_0x3b6251);let _0x5110b4=0x182c+-0xe41*-0x1+0x1*-0x266d;while(_0x5110b4<_0x3b6251){const {bytesRead:_0x4e7635}=await _0x5cb9af[_0x386824(0x27e)](_0x3a12c6,_0x5110b4,_0x3b6251-_0x5110b4,_0x5110b4);if(_0x4e7635===0xb15*0x1+-0xf07*-0x2+-0x2923)throw corruptInputImageReference();_0x5110b4+=_0x4e7635;}const _0x119f04=Buffer[_0x386824(0x212)](-0x296*0x1+0x4a9+-0x212);if((await _0x5cb9af[_0x386824(0x27e)](_0x119f04,0x7b2+-0x2484+0x1cd2,0xf2c+-0x352+-0xbd9,_0x3b6251))[_0x386824(0x1bd)]!==0xca0+-0x212*0x1+-0xe*0xc1)throw corruptInputImageReference();return _0x3a12c6;}async function copyInputImages(_0x281eb9,_0x18cf85,_0x2389a6){const _0x1f5301=_0x401a91;if(_0x2389a6[_0x1f5301(0x280)]===-0xe*-0x1b7+-0xc48+0x13*-0x9e)return;const _0x543311=join(_0x281eb9,_0x1f5301(0x1d4)),_0x2fecea=join(_0x18cf85,_0x1f5301(0x1d4));await mkdir(_0x2fecea,{'recursive':!![],'mode':0x1c0});for(const _0xc9e382 of _0x2389a6){const _0x26df10=await readInputImageBytes(_0x543311,_0xc9e382);await writeFile(join(_0x2fecea,_0xc9e382[_0x1f5301(0x264)]),_0x26df10,{'mode':0x180,'flag':'wx'});}}function corruptInputImageReference(_0x3228aa){const _0x492211=_0x401a91;return new MarAgentError(_0x492211(0x261),_0x492211(0x1e3),{..._0x3228aa===undefined?{}:{'cause':_0x3228aa}});}function isObject(_0x55a206){const _0x5b948c=_0x401a91;return _0x55a206!==null&&typeof _0x55a206===_0x5b948c(0x227)&&!Array[_0x5b948c(0x24b)](_0x55a206);}function forkedPayload(_0x26f558,_0x5ca4e9,_0x25dc66,_0x1b1ce9,_0x766a5d){const _0x8a653f=_0x401a91;if(_0x5ca4e9===null||typeof _0x5ca4e9!==_0x8a653f(0x227)||Array[_0x8a653f(0x24b)](_0x5ca4e9))return _0x5ca4e9;const _0x997e00={..._0x5ca4e9};if(_0x997e00[_0x8a653f(0x281)]===_0x25dc66)_0x997e00[_0x8a653f(0x281)]=_0x1b1ce9;return _0x26f558===_0x8a653f(0x224)&&(_0x997e00[_0x8a653f(0x22f)]=_0x766a5d,_0x997e00[_0x8a653f(0x1de)]=![]),_0x997e00;}function deriveExecutionState(_0x22d69f){const _0x54bd0b=_0x401a91;let _0x1d97df=![],_0x3e1d8a=![],_0x48e804,_0x3ade4e,_0x622d83=0x1c1e+0x5e9*-0x4+-0x47a,_0x1c545f=[];for(const _0x3a2fed of _0x22d69f){if(_0x3a2fed[_0x54bd0b(0x1f0)]===_0x54bd0b(0x20f))_0x1d97df=_0x3a2fed[_0x54bd0b(0x230)]?.[_0x54bd0b(0x1d9)]===!![];else{if(_0x3a2fed[_0x54bd0b(0x1f0)]===_0x54bd0b(0x259))_0x3e1d8a=!![];else{if(isCompactCheckpoint(_0x3a2fed))_0x48e804=_0x3a2fed[_0x54bd0b(0x1c1)];else{if(_0x3a2fed[_0x54bd0b(0x1f0)]===_0x54bd0b(0x1f7)){const _0xdb6e4e=todoItemsFromSnapshot(_0x3a2fed[_0x54bd0b(0x230)]);if(!_0xdb6e4e)continue;_0x3ade4e=_0x3a2fed[_0x54bd0b(0x1c1)],_0x622d83++,_0x1c545f=_0xdb6e4e;}}}}}const _0x52d24d=_0x22d69f[_0x54bd0b(0x27a)](isCompactCheckpoint);return{'automaticTitlePending':_0x1d97df&&!_0x3e1d8a,'todo':{'revision':_0x622d83,'items':_0x1c545f},'contextRecords':_0x52d24d<0x562+-0x16b8+0x1156?[..._0x22d69f]:_0x22d69f[_0x54bd0b(0x26e)](_0x52d24d),'resume':{'version':0x1,..._0x48e804===undefined?{}:{'compactSequence':_0x48e804},..._0x3ade4e===undefined?{}:{'todoSequence':_0x3ade4e},'todoRevision':_0x622d83}};}export function compactSummaryFromCheckpoint(_0xbf9fca){const _0x8d8a0d=_0x401a91;if(_0xbf9fca?.[_0x8d8a0d(0x1f0)]!==_0x8d8a0d(0x27d))return undefined;const _0x17067f=_0xbf9fca[_0x8d8a0d(0x230)];if(_0x17067f===null||typeof _0x17067f!==_0x8d8a0d(0x227)||Array[_0x8d8a0d(0x24b)](_0x17067f))return undefined;const _0x2d3e26=_0x17067f[_0x8d8a0d(0x1e5)];return typeof _0x2d3e26===_0x8d8a0d(0x25d)&&_0x2d3e26[_0x8d8a0d(0x1c6)]()[_0x8d8a0d(0x280)]>-0xc7*-0x5+-0x9b*0x21+-0x406*-0x4?_0x2d3e26:undefined;}function isCompactCheckpoint(_0x24998b){return compactSummaryFromCheckpoint(_0x24998b)!==undefined;}function sameResumeIndex(_0x2f6cd7,_0x5e8f5d){const _0x2f85ce=_0x401a91;return _0x2f6cd7?.[_0x2f85ce(0x27c)]===_0x5e8f5d[_0x2f85ce(0x27c)]&&_0x2f6cd7[_0x2f85ce(0x25f)]===_0x5e8f5d[_0x2f85ce(0x25f)]&&_0x2f6cd7[_0x2f85ce(0x257)]===_0x5e8f5d[_0x2f85ce(0x257)]&&_0x2f6cd7[_0x2f85ce(0x27f)]===_0x5e8f5d[_0x2f85ce(0x27f)];}async function readRecords(_0xe794c7){const _0x3f9d7c=_0x401a91,_0x27cbbc=await readFile(_0xe794c7,_0x3f9d7c(0x1f3)),_0x491be2=_0x27cbbc[_0x3f9d7c(0x21f)]('\x0a');if(_0x491be2['at'](-(-0x1c6a+-0x164b+0x195b*0x2))==='')_0x491be2[_0x3f9d7c(0x243)]();const _0x49aab3=[];for(const [_0x1d014f,_0x4633f4]of _0x491be2[_0x3f9d7c(0x1e8)]()){if(!_0x4633f4)continue;try{_0x49aab3[_0x3f9d7c(0x23a)](JSON[_0x3f9d7c(0x233)](_0x4633f4));}catch(_0x21c012){if(_0x1d014f===_0x491be2[_0x3f9d7c(0x280)]-(-0x2403+0x1441+0x1*0xfc3)&&!_0x27cbbc[_0x3f9d7c(0x25b)]('\x0a'))break;throw new MarAgentError(_0x3f9d7c(0x261),_0x3f9d7c(0x1c0),{'cause':_0x21c012});}}return _0x49aab3;}async function readRecordPageFromTail(_0x213eb2,_0x2d2799,_0xed9356){const _0x59f068=_0x401a91,_0x3a0081=await open(_0x213eb2,'r');try{const _0x51535b=(await _0x3a0081[_0x59f068(0x1f1)]())[_0x59f068(0x1ec)];let _0x54d270=_0x51535b,_0x1f2b00=[],_0xb1e929=![],_0x56c1b4=![],_0x4547f7=![];const _0x24c669=[],_0x37e5d5=(_0x37c0ef,_0x825173)=>{const _0x154b17=_0x59f068;if(_0x37c0ef[_0x154b17(0x280)]===-0x1464+-0x2*0x1277+0x1d*0x1fa)return;let _0x1a9169;try{_0x1a9169=JSON[_0x154b17(0x233)](_0x37c0ef[_0x154b17(0x22e)](_0x154b17(0x1f3)));}catch(_0x24b11b){if(_0x825173)return;throw new MarAgentError(_0x154b17(0x261),_0x154b17(0x1c0),{'cause':_0x24b11b});}if(_0x1a9169[_0x154b17(0x1c1)]<_0x2d2799)_0x24c669[_0x154b17(0x23a)](_0x1a9169);};while(_0x54d270>0xdb*0x1b+-0x1baf+-0x24b*-0x2&&_0x24c669[_0x59f068(0x280)]<=_0xed9356){const _0x729de4=Math[_0x59f068(0x1bc)](0x316+0x2b*0x67+-0x1463,_0x54d270-REVERSE_READ_CHUNK_BYTES),_0x558732=Buffer[_0x59f068(0x212)](_0x54d270-_0x729de4);let _0x15d58c=-0x1*-0x1fe4+-0x1349*-0x2+-0x1*0x4676;while(_0x15d58c<_0x558732[_0x59f068(0x280)]){const _0x399409=await _0x3a0081[_0x59f068(0x27e)](_0x558732,_0x15d58c,_0x558732[_0x59f068(0x280)]-_0x15d58c,_0x729de4+_0x15d58c);if(_0x399409[_0x59f068(0x1bd)]===0x10d9*0x1+0x1cdc+-0x2db5)break;_0x15d58c+=_0x399409[_0x59f068(0x1bd)];}const _0x4a81b9=_0x558732[_0x59f068(0x1cd)](0x1a57+0x1833+-0x1945*0x2,_0x15d58c);!_0x56c1b4&&(_0x56c1b4=!![],_0xb1e929=_0x4a81b9['at'](-(0xbe7+0x916*-0x1+0x5a*-0x8))!==0x187f+-0x2366*0x1+0x1*0xaf1);let _0x5c3679=_0x4a81b9[_0x59f068(0x280)];for(let _0x355108=_0x4a81b9[_0x59f068(0x280)]-(0x14dd+-0x1d52+-0x2*-0x43b);_0x355108>=-0x8*0x313+0x2131+-0x899;_0x355108--){if(_0x4a81b9[_0x355108]!==0x152b+0x245d+-0x16*0x29d)continue;const _0xec89e3=_0x4a81b9[_0x59f068(0x1cd)](_0x355108+(-0x23*0xed+0xe20*0x1+0x1248),_0x5c3679),_0x2d6e25=_0x1f2b00[_0x59f068(0x280)]===-0x55*-0x2c+-0x1053+0x1b7?_0xec89e3:Buffer[_0x59f068(0x1e4)]([_0xec89e3,..._0x1f2b00]);_0x37e5d5(_0x2d6e25,_0xb1e929),_0xb1e929=![],_0x1f2b00=[],_0x5c3679=_0x355108;if(_0x24c669[_0x59f068(0x280)]>_0xed9356){_0x4547f7=!![];break;}}if(!_0x4547f7&&_0x5c3679>0x9*0x15a+-0x15*0x17b+0x12ed)_0x1f2b00[_0x59f068(0x215)](Buffer[_0x59f068(0x21e)](_0x4a81b9[_0x59f068(0x1cd)](-0x1035*0x1+-0x2049+0x307e,_0x5c3679)));_0x54d270=_0x729de4;}if(_0x54d270===0x4*0x602+0x4c0+-0x1cc8&&_0x24c669[_0x59f068(0x280)]<=_0xed9356&&_0x1f2b00[_0x59f068(0x280)]>0x1*0x653+0xa94+-0x10e7)_0x37e5d5(Buffer[_0x59f068(0x1e4)](_0x1f2b00),_0xb1e929);const _0x4b2883=_0x24c669[_0x59f068(0x280)]>_0xed9356;return{'records':_0x24c669[_0x59f068(0x26e)](-0x18d*-0x2+0x2c*-0x8a+0x149e,_0xed9356)[_0x59f068(0x26a)](),'hasEarlier':_0x4b2883};}finally{await _0x3a0081[_0x59f068(0x1da)]();}}function segmentNumberFromPath(_0x173c2f){const _0x1deb95=_0x401a91,_0x4ae0ae=/events-(\d{6})\.jsonl$/[_0x1deb95(0x1ed)](_0x173c2f);return _0x4ae0ae===null?undefined:Number(_0x4ae0ae[-0x23b8+-0x1*0xa84+0x2e3d]);}async function acquireFileLock(_0x48b2cc,_0x5300fb=_0x401a91(0x1f6),_0x3ef346=-0x73f*0x5+-0x10ce*-0x2+-0x35*-0x6b){const _0x193ad2=_0x401a91,_0x4a4f6a=Date[_0x193ad2(0x276)]()+_0x3ef346;for(;;){try{const _0xa8648d=await open(_0x48b2cc,'wx',-0x235c+-0xf2f+-0x1159*-0x3);await _0xa8648d[_0x193ad2(0x21a)](JSON[_0x193ad2(0x1ff)]({'pid':process[_0x193ad2(0x250)],'createdAt':new Date()[_0x193ad2(0x1df)]()}));let _0x185177=![];return async()=>{const _0x177737=_0x193ad2;if(_0x185177)return;_0x185177=!![],await _0xa8648d[_0x177737(0x1da)](),await rm(_0x48b2cc,{'force':!![]});};}catch(_0x410056){if(await removeDeadOwner(_0x48b2cc))continue;if(Date[_0x193ad2(0x276)]()>=_0x4a4f6a)throw new MarAgentError(_0x193ad2(0x254),_0x5300fb,{'cause':_0x410056});await _0x5adbcf(-0x1bd9+0xc77+0xf7b+Math[_0x193ad2(0x1d0)](Math[_0x193ad2(0x245)]()*(-0x1*-0x1225+-0xec*0x5+-0xd70)));}}}async function removeDeadOwner(_0xc2c64c){const _0x46d26a=_0x401a91;try{const _0x1d49fd=JSON[_0x46d26a(0x233)](await readFile(_0xc2c64c,_0x46d26a(0x1f3)));if(typeof _0x1d49fd[_0x46d26a(0x250)]!==_0x46d26a(0x1dd)||!Number[_0x46d26a(0x1cb)](_0x1d49fd[_0x46d26a(0x250)]))return![];try{return process[_0x46d26a(0x1fe)](_0x1d49fd[_0x46d26a(0x250)],-0x1cb0+-0x3ba*-0x7+-0x9*-0x4a),![];}catch(_0x3f0846){if(_0x3f0846[_0x46d26a(0x1c8)]!==_0x46d26a(0x263))return![];return await rm(_0xc2c64c,{'force':!![]}),!![];}}catch{return![];}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
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);}
|
|
2
|
+
const _0x39a17e=_0x3a06;(function(_0x3c3296,_0x2f8e7e){const _0x5d1f4c=_0x3a06,_0x4cb23b=_0x3c3296();while(!![]){try{const _0x19937a=parseInt(_0x5d1f4c(0x8b))/(-0x4*0x887+0x1a4f+0x6*0x14d)*(parseInt(_0x5d1f4c(0xb2))/(-0x61*0x65+0x3ab+0x4*0x8a7))+-parseInt(_0x5d1f4c(0xe2))/(-0x189c+0xaa8*0x1+0x19*0x8f)*(-parseInt(_0x5d1f4c(0xa3))/(0x3*-0x401+0x7c4+0x1*0x443))+parseInt(_0x5d1f4c(0xbf))/(0x5*0x60d+-0x1988+-0x4b4)+-parseInt(_0x5d1f4c(0x88))/(0x57e+-0x1cd9+0x39*0x69)*(-parseInt(_0x5d1f4c(0xb3))/(-0xabd+-0x54*-0x3a+0x17*-0x5c))+-parseInt(_0x5d1f4c(0xe1))/(-0x601*-0x6+-0x1ffc*-0x1+0x4db*-0xe)+parseInt(_0x5d1f4c(0xad))/(0xb5c*0x3+-0x1cc7+-0x544)+parseInt(_0x5d1f4c(0x9b))/(0x74b*0x3+0x1*-0x17a5+-0x16*-0x15)*(-parseInt(_0x5d1f4c(0xb7))/(-0xf05*-0x1+-0x1b40+0x2*0x623));if(_0x19937a===_0x2f8e7e)break;else _0x4cb23b['push'](_0x4cb23b['shift']());}catch(_0x5061b8){_0x4cb23b['push'](_0x4cb23b['shift']());}}}(_0x10b5,-0x79186+-0x72057+-0x1*-0x127e46));import{randomUUID}from'node:crypto';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'../tools/execution-limits.js';function _0x3a06(_0x314936,_0x46cc6e){_0x314936=_0x314936-(0x102d+0xee*-0x13+0x1ff);const _0x1e6251=_0x10b5();let _0x5b7df4=_0x1e6251[_0x314936];if(_0x3a06['SVKlBi']===undefined){var _0xfebec8=function(_0x37c35b){const _0x26d2e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x6cb944='',_0x3aa133='';for(let _0x586465=-0x10*0x174+-0x389*0xb+0x3e23,_0x3f29ac,_0x273744,_0x4260c1=0x182b*0x1+0x1a9+0x15c*-0x13;_0x273744=_0x37c35b['charAt'](_0x4260c1++);~_0x273744&&(_0x3f29ac=_0x586465%(-0xa76+-0x1518+0x1c1*0x12)?_0x3f29ac*(-0x1*0xdb9+-0x1a58*-0x1+-0xc5f)+_0x273744:_0x273744,_0x586465++%(-0x22fa+-0xaf+0x1*0x23ad))?_0x6cb944+=String['fromCharCode'](-0x24f2+-0x18d3+0x3ec4&_0x3f29ac>>(-(-0x6d5+-0x65f*-0x4+0x3*-0x637)*_0x586465&-0x77f*0x4+-0x7a1+-0x5*-0x787)):0x2ec*-0x3+-0x3ff+0xcc3){_0x273744=_0x26d2e1['indexOf'](_0x273744);}for(let _0xad553=-0xf0f+-0x1*0x3f4+0x9d*0x1f,_0x342fce=_0x6cb944['length'];_0xad553<_0x342fce;_0xad553++){_0x3aa133+='%'+('00'+_0x6cb944['charCodeAt'](_0xad553)['toString'](-0xdd*-0x12+0x17*0x18e+-0x1114*0x3))['slice'](-(-0x1109+0x18a4+-0x799));}return decodeURIComponent(_0x3aa133);};_0x3a06['dVGuqg']=_0xfebec8,_0x3a06['TbHduA']={},_0x3a06['SVKlBi']=!![];}const _0x250e53=_0x1e6251[0xce*0x4+-0x2*-0xc8c+-0x18*0x12e];_0x3a06['PFMjVg']!==_0x250e53&&(_0x3a06['TbHduA']={},_0x3a06['PFMjVg']=_0x250e53);const _0x354aae=_0x3a06['TbHduA'][_0x314936];return _0x354aae===undefined?(_0x5b7df4=_0x3a06['dVGuqg'](_0x5b7df4),_0x3a06['TbHduA'][_0x314936]=_0x5b7df4):_0x5b7df4=_0x354aae,_0x5b7df4;}export class SubagentScheduler{[_0x39a17e(0x9a)];#tasks=new Map();#queue=[];#running=0x2336+0x1*-0x1bff+0x737*-0x1;#disposed=![];#createdInExecution=-0x7*0xc4+0x1520+-0xfc4;#runner;constructor(_0x2a9b4b,_0x43e76f={'maxTasks':0x8,'maxConcurrent':0x4}){const _0x5356a0=_0x39a17e;this[_0x5356a0(0x9a)]=_0x43e76f,this.#runner=_0x2a9b4b;}[_0x39a17e(0xb8)](_0x49c0e8){const _0x17656c=_0x39a17e;if(this.#disposed)throw new MarAgentError(_0x17656c(0xec),_0x17656c(0xcc));this.#runner=_0x49c0e8,this.#createdInExecution=-0xd*0x91+0x29*0x52+-0x5c5;}async[_0x39a17e(0xb0)](_0x299279,_0x32a344={}){const _0x273149=_0x39a17e;_0x32a344[_0x273149(0xe9)]?.[_0x273149(0xd6)]();const _0x6854fa=_0x299279[_0x273149(0xaa)];if(_0x299279[_0x273149(0xcf)])throw new MarAgentError(_0x273149(0x9e),_0x273149(0x86));if(this.#disposed||this.#createdInExecution>=this[_0x273149(0x9a)][_0x273149(0xa9)])throw new MarAgentError(_0x273149(0xec),_0x273149(0xca));if(!_0x299279[_0x273149(0xc2)][_0x273149(0xa5)]()||_0x299279[_0x273149(0xc2)][_0x273149(0xab)]>TOOL_EXECUTION_LIMITS[_0x273149(0xd9)]||!_0x299279[_0x273149(0x8f)][_0x273149(0xa5)]()||Buffer[_0x273149(0xa8)](_0x299279[_0x273149(0x8f)])>TOOL_EXECUTION_LIMITS[_0x273149(0xc6)]||_0x6854fa!==undefined&&(typeof _0x6854fa!==_0x273149(0xe4)||!_0x6854fa[_0x273149(0xa5)]()||_0x6854fa[_0x273149(0xab)]>TOOL_EXECUTION_LIMITS[_0x273149(0xa1)]))throw new MarAgentError(_0x273149(0xea),_0x273149(0xc5));const _0x47f7f2=randomUUID();let _0x4d18e4;const _0x78d866=new Promise(_0x46ffff=>_0x4d18e4=_0x46ffff),_0x365dcc={'taskId':_0x47f7f2,'input':{..._0x299279,'description':_0x299279[_0x273149(0xc2)][_0x273149(0xa5)](),...typeof _0x6854fa===_0x273149(0xe4)?{'reasoningEffort':_0x6854fa[_0x273149(0xa5)]()}:{}},'status':_0x273149(0xa2),'controller':new AbortController(),'completion':_0x78d866,'resolve':_0x4d18e4,'runner':this.#runner};this.#createdInExecution++,this.#tasks[_0x273149(0x95)](_0x47f7f2,_0x365dcc),this.#queue[_0x273149(0x8d)](_0x365dcc);const _0x4280f3=!_0x299279[_0x273149(0x85)]&&_0x32a344[_0x273149(0xe9)]?linkAbort(_0x32a344[_0x273149(0xe9)],_0x2b6446=>this.#cancelTask(_0x365dcc,_0x2b6446)):undefined;this.#drain();try{try{await _0x32a344[_0x273149(0x94)]?.(this.#public(_0x365dcc));}catch(_0x5cec5e){this.#cancelTask(_0x365dcc,_0x5cec5e);if(_0x365dcc[_0x273149(0xcd)]===_0x273149(0x91))await _0x365dcc[_0x273149(0xe6)];throw _0x5cec5e;}if(!_0x299279[_0x273149(0x85)])await _0x78d866;return this.#public(_0x365dcc);}finally{_0x4280f3?.();}}async[_0x39a17e(0xc3)](_0x41f57b,_0x2845a1={}){const _0x275b3a=_0x39a17e;_0x2845a1[_0x275b3a(0xe9)]?.[_0x275b3a(0xd6)]();const _0x4cbb58=this.#tasks[_0x275b3a(0x8c)](_0x41f57b);if(!_0x4cbb58)throw new MarAgentError(_0x275b3a(0xd3),_0x275b3a(0xe0));if(_0x2845a1[_0x275b3a(0xb9)]!==undefined&&(!Number[_0x275b3a(0xdd)](_0x2845a1[_0x275b3a(0xb9)])||_0x2845a1[_0x275b3a(0xb9)]<TOOL_EXECUTION_LIMITS[_0x275b3a(0x93)]||_0x2845a1[_0x275b3a(0xb9)]>TOOL_EXECUTION_LIMITS[_0x275b3a(0xeb)]))throw new MarAgentError(_0x275b3a(0xea),_0x275b3a(0x98));const _0x12ca01=_0x2845a1[_0x275b3a(0xb9)]===undefined?undefined:Math[_0x275b3a(0xdc)](_0x2845a1[_0x275b3a(0xb9)],TOOL_EXECUTION_LIMITS[_0x275b3a(0xe7)]);if(_0x12ca01!==undefined&&![_0x275b3a(0xe3),_0x275b3a(0x9f),_0x275b3a(0xd0)][_0x275b3a(0xd4)](_0x4cbb58[_0x275b3a(0xcd)]))await waitForCompletion(_0x4cbb58[_0x275b3a(0xe6)],_0x12ca01,_0x2845a1[_0x275b3a(0xe9)]);return this.#public(_0x4cbb58);}async[_0x39a17e(0xaf)](_0x5ea0be){const _0x2a5d91=_0x39a17e,_0x1469ed=this.#tasks[_0x2a5d91(0x8c)](_0x5ea0be);if(!_0x1469ed)throw new MarAgentError(_0x2a5d91(0xd3),_0x2a5d91(0xe0));this.#cancelTask(_0x1469ed,new MarAgentError(_0x2a5d91(0xd2),_0x2a5d91(0xa6)));if(_0x1469ed[_0x2a5d91(0xcd)]===_0x2a5d91(0x91))await _0x1469ed[_0x2a5d91(0xe6)];return this.#public(_0x1469ed);}#cancelTask(_0x5546d8,_0x3087b6){const _0x47cf2f=_0x39a17e;if(_0x5546d8[_0x47cf2f(0xcd)]===_0x47cf2f(0xa2)){_0x5546d8[_0x47cf2f(0xcd)]=_0x47cf2f(0xd0);const _0x562e7a=this.#queue[_0x47cf2f(0xde)](_0x5546d8);if(_0x562e7a>=0x14a6+-0x26a7+0x1201)this.#queue[_0x47cf2f(0x97)](_0x562e7a,0x1*-0x139f+-0x1519+0x28b9);_0x5546d8[_0x47cf2f(0xce)][_0x47cf2f(0xbe)](_0x3087b6),_0x5546d8[_0x47cf2f(0xd1)](),this.#drain();}else{if(_0x5546d8[_0x47cf2f(0xcd)]===_0x47cf2f(0x91))_0x5546d8[_0x47cf2f(0xce)][_0x47cf2f(0xbe)](_0x3087b6);}}#drain(){const _0x12b99b=_0x39a17e;while(!this.#disposed&&this.#running<this[_0x12b99b(0x9a)][_0x12b99b(0xdf)]&&this.#queue[_0x12b99b(0xab)]){const _0x2ae982=this.#queue[_0x12b99b(0xbb)]();if(_0x2ae982[_0x12b99b(0xcd)]!==_0x12b99b(0xa2))continue;_0x2ae982[_0x12b99b(0xcd)]=_0x12b99b(0x91),this.#running++,void _0x2ae982[_0x12b99b(0xb4)](_0x2ae982[_0x12b99b(0x84)],_0x2ae982[_0x12b99b(0xce)][_0x12b99b(0xe9)])[_0x12b99b(0xcb)](_0x20a1dc=>{const _0x57606e=_0x12b99b;if(_0x2ae982[_0x57606e(0xce)][_0x57606e(0xe9)][_0x57606e(0xc4)])_0x2ae982[_0x57606e(0xcd)]=_0x57606e(0xd0);else _0x2ae982[_0x57606e(0xc8)]=normalizeResult(_0x20a1dc),_0x2ae982[_0x57606e(0xcd)]=_0x57606e(0xe3);},_0x2bf2c2=>{const _0x52f122=_0x12b99b;_0x2ae982[_0x52f122(0xcd)]=_0x2ae982[_0x52f122(0xce)][_0x52f122(0xe9)][_0x52f122(0xc4)]?_0x52f122(0xd0):_0x52f122(0x9f),_0x2ae982[_0x52f122(0xc7)]=_0x2bf2c2 instanceof MarAgentError?_0x2bf2c2[_0x52f122(0x96)]:_0x52f122(0xb1);})[_0x12b99b(0x89)](()=>{const _0x264658=_0x12b99b;this.#running--,_0x2ae982[_0x264658(0xd1)](),this.#drain();});}}#public(_0xe42954){const _0x57af81=_0x39a17e;return{'taskId':_0xe42954[_0x57af81(0x99)],'description':_0xe42954[_0x57af81(0x84)][_0x57af81(0xc2)],'status':_0xe42954[_0x57af81(0xcd)],..._0xe42954[_0x57af81(0xc8)]?{..._0xe42954[_0x57af81(0xc8)]}:{},..._0xe42954[_0x57af81(0xc7)]?{'errorCode':_0xe42954[_0x57af81(0xc7)]}:{}};}[_0x39a17e(0xb5)](){const _0x5c6b95=_0x39a17e;return[...this.#tasks[_0x5c6b95(0x92)]()][_0x5c6b95(0xa4)](_0x1afc3f=>({'taskId':_0x1afc3f[_0x5c6b95(0x99)],'status':_0x1afc3f[_0x5c6b95(0xcd)],'description':_0x1afc3f[_0x5c6b95(0x84)][_0x5c6b95(0xc2)]}));}async[_0x39a17e(0xba)](){const _0x40b4fb=_0x39a17e;if(this.#disposed)return;this.#disposed=!![];for(const _0x3d1959 of this.#tasks[_0x40b4fb(0x92)]()){if(_0x3d1959[_0x40b4fb(0xcd)]===_0x40b4fb(0xa2))_0x3d1959[_0x40b4fb(0xcd)]=_0x40b4fb(0xd0),_0x3d1959[_0x40b4fb(0xce)][_0x40b4fb(0xbe)](),_0x3d1959[_0x40b4fb(0xd1)]();else{if(_0x3d1959[_0x40b4fb(0xcd)]===_0x40b4fb(0x91))_0x3d1959[_0x40b4fb(0xce)][_0x40b4fb(0xbe)]();}}await Promise[_0x40b4fb(0xdb)]([...this.#tasks[_0x40b4fb(0x92)]()][_0x40b4fb(0xa4)](_0x24ef5f=>_0x24ef5f[_0x40b4fb(0xe6)])),this.#queue[_0x40b4fb(0xab)]=-0xd+-0x1420+-0x5*-0x409,this.#tasks[_0x40b4fb(0x8a)]();}}function normalizeResult(_0x21b874){const _0x376e71=_0x39a17e;return{'summary':truncateUtf8(_0x21b874[_0x376e71(0x9c)],TOOL_EXECUTION_LIMITS[_0x376e71(0xae)]),'changedFiles':[...new Set(_0x21b874[_0x376e71(0xda)])][_0x376e71(0x8e)](_0x2f50c0=>typeof _0x2f50c0===_0x376e71(0xe4)&&_0x2f50c0[_0x376e71(0xab)]>0xd*0x2c9+-0x1da5+-0x690&&_0x2f50c0[_0x376e71(0xab)]<=0x1c12+-0x1*0x1fc9+0x13b7)[_0x376e71(0xc9)](-0x5d*0xb+0x2569+-0x216a,TOOL_EXECUTION_LIMITS[_0x376e71(0xa0)]),'verification':_0x21b874[_0x376e71(0xd8)][_0x376e71(0x8e)](_0x56de4c=>typeof _0x56de4c===_0x376e71(0xe4))[_0x376e71(0xc9)](-0x1*0x3f4+0x10f*-0x16+0x1b3e*0x1,TOOL_EXECUTION_LIMITS[_0x376e71(0xe5)])[_0x376e71(0xa4)](_0xbb2c8c=>truncateUtf8(_0xbb2c8c,0x13*0xca+-0x919*0x3+0x141d)),'evidence':(_0x21b874[_0x376e71(0xac)]??[])[_0x376e71(0x8e)](_0x7ab3c=>_0x7ab3c&&typeof _0x7ab3c[_0x376e71(0x90)]===_0x376e71(0xe4)&&_0x7ab3c[_0x376e71(0x90)][_0x376e71(0xab)]>0x18a4+-0x16d0+0x27*-0xc&&_0x7ab3c[_0x376e71(0x90)][_0x376e71(0xab)]<=-0x1*-0x1a45+-0x5*-0x5d5+0x62*-0x67)[_0x376e71(0xc9)](-0xe2e+0x23e4+-0x15b6*0x1,TOOL_EXECUTION_LIMITS[_0x376e71(0xd5)])[_0x376e71(0xa4)](_0x16b7ed=>({'path':_0x16b7ed[_0x376e71(0x90)],...Number[_0x376e71(0xdd)](_0x16b7ed[_0x376e71(0xc0)])&&_0x16b7ed[_0x376e71(0xc0)]>=0x743*-0x1+-0x3*0xb2b+-0x28c5*-0x1?{'startLine':_0x16b7ed[_0x376e71(0xc0)]}:{},...Number[_0x376e71(0xdd)](_0x16b7ed[_0x376e71(0x9d)])&&_0x16b7ed[_0x376e71(0x9d)]>=0x3af+-0x20*-0x4b+0xd0e*-0x1?{'endLine':_0x16b7ed[_0x376e71(0x9d)]}:{}}))};}function _0x10b5(){const _0x3ae5a9=['DMfSDwvZ','DgfZA091Dhb1De1PBLDHAxrnCW','B25dCMvHDgvK','C2v0','y29Kzq','C3bSAwnL','vgfZAYb3ywL0igLZigLUDMfSAwqU','DgfZA0LK','BgLTAxrZ','odCWEg9qz2fk','C3vTBwfYEq','zw5KtgLUzq','tufsx0fhru5ux1nvqKfhru5ux1jfq1vsu0LptL9esvnbqKXfra','zMfPBgvK','C3vIywDLBNrdAgfUz2vKrMLSzxnnyxHjDgvTCW','C3vIywDLBNrszwfZB25PBMDfzMzVCNrnyxHdAgfYywn0zxjZ','CxvLDwvK','mZyYmdHXwuD0t2O','BwfW','DhjPBq','u3vIywDLBNqGDgfZAYb3yxmGy2fUy2vSBgvKlG','zNjVBq','yNL0zuXLBMD0Aa','Bwf4vgfZA3m','CMvHC29UAw5NrwzMB3j0','BgvUz3rO','zxzPzgvUy2u','nZa3odu5rvbKDfrA','C3vIywDLBNrtDw1Tyxj5twf4qNL0zxm','y2fUy2vS','CNvU','tufsx0fhru5ux1nvqKfhru5ux0zbsuXfra','mZC0odq2ANDHrNri','mtq3t1rZrejd','CNvUBMvY','BgLZDfnLC3nPB25szxnVDxjJzxm','ywrKrxzLBNrmAxn0zw5LCG','ntyZndjiwhPVtMS','yMvNAw5fEgvJDxrPB24','D2fPDe1Z','zgLZCg9Zzq','C2HPzNq','rxHLy3v0Aw9UignHBMnLBgXLzc4','CMvHC29U','ywjVCNq','otyWndeWEgP6BvfQ','C3rHCNrmAw5L','DxrMoa','zgvZy3jPChrPB24','B3v0Chv0','ywjVCNrLza','u3vIywDLBNqGDgfZAYbPCYbPBNzHBgLKlG','C3vIywDLBNrqCM9TChrnyxHcExrLCW','zxjYB3jdB2rL','CMvZDwX0','C2XPy2u','u3vIywDLBNqGDgfZAYbSAw1PDcb3yxmGCMvHy2HLzc4','DgHLBG','u3vIywDLBNqGC2nOzwr1BgvYigLZigrPC3bVC2vKlG','C3rHDhvZ','y29UDhjVBgXLCG','CgfYzw50u3vIywDLBNrjza','y2fUy2vSBgvK','CMvZB2X2zq','tufsx0fhru5ux0nbtKnfteXfra','tufsx0fhru5ux1nvqKfhru5ux05pvf9gt1vora','Aw5JBhvKzxm','C3vIywDLBNrfDMLKzw5Jzu1HEeL0zw1Z','DgHYB3DjzKfIB3j0zwq','Dw5Yzwy','DMvYAwzPy2f0Aw9U','C3vIywDLBNrezxnJCMLWDgLVBK1HEenOyxjHy3rLCNm','y2HHBMDLzezPBgvZ','ywXS','Bwf4','AxnjBNrLz2vY','Aw5KzxHpzG','Bwf4q29Uy3vYCMvUDa','u3vIywDLBNqGDgfZAYb3yxmGBM90igzVDw5KlG','mtuXoteWnenXyK1Vua','mtHzuxnesva','y29TCgXLDgvK','C3rYAw5N','C3vIywDLBNrwzxjPzMLJyxrPB25nyxHjDgvTCW','y29TCgXLDgLVBG','DgfZA091Dhb1DfDHAxrgBg9VCK1Z','tufsx0fhru5ux0vyrunvveLptL9dqu5druXmruq','C2LNBMfS','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','DgfZA091Dhb1De1HEfDHAxrnCW','tufsx0fhru5ux1nvqKfhru5ux0XjtuLu','C3vIyxjYyxK','CMvTB3zLrxzLBNrmAxn0zw5LCG','Aw5WDxq','yMfJA2DYB3vUza','u3vIywDLBNrZignHBM5VDcbJCMvHDguGC3vIywDLBNrZlG','Dg9tDhjPBMC','nti3mJH3z0f0EwS','zMLUywXSEq','y2XLyxi','mNbTAxD5CW','z2v0','ChvZAa','zMLSDgvY','ChjVBxb0','Cgf0Aa','CNvUBMLUzW'];_0x10b5=function(){return _0x3ae5a9;};return _0x10b5();}function truncateUtf8(_0x23030c,_0x35425a){const _0x442350=_0x39a17e;if(typeof _0x23030c!==_0x442350(0xe4))return'';const _0x99376e=Buffer[_0x442350(0xa7)](_0x23030c);if(_0x99376e[_0x442350(0xab)]<=_0x35425a)return _0x23030c;let _0x2215a6=_0x35425a;while(_0x2215a6>-0x2*0x36d+-0xd*-0x107+-0x681&&(_0x99376e[_0x2215a6]&-0x1dd4+0x1f85*-0x1+-0x2f5*-0x15)===-0x158b+-0x1*-0x7b8+0xe53)_0x2215a6--;return _0x99376e[_0x442350(0x82)](-0x1685+-0x3*-0x1fc+0x1091,_0x2215a6)[_0x442350(0x87)](_0x442350(0xc1));}function waitForCompletion(_0x23104b,_0x3ddc4f,_0x49f80b){return new Promise((_0x32cdff,_0x5d1f99)=>{const _0x1630c8=_0x3a06;let _0x3c7c18=![];const _0x2afdf3=_0x53a5e3=>{const _0x1c7635=_0x3a06;if(_0x3c7c18)return;_0x3c7c18=!![],clearTimeout(_0x109680),_0x49f80b?.[_0x1c7635(0x83)](_0x1c7635(0xbe),_0x4d2dd3);if(_0x53a5e3===undefined)_0x32cdff();else _0x5d1f99(_0x53a5e3);},_0x4d2dd3=()=>_0x2afdf3(_0x49f80b?.[_0x1630c8(0xbd)]??new MarAgentError(_0x1630c8(0xe8),_0x1630c8(0xbc))),_0x109680=setTimeout(_0x2afdf3,_0x3ddc4f);_0x109680[_0x1630c8(0xd7)](),_0x49f80b?.[_0x1630c8(0xb6)](_0x1630c8(0xbe),_0x4d2dd3,{'once':!![]}),void _0x23104b[_0x1630c8(0xcb)](()=>_0x2afdf3());if(_0x49f80b?.[_0x1630c8(0xc4)])_0x4d2dd3();});}function linkAbort(_0x46df15,_0x12aa3f){const _0x27516d=_0x39a17e,_0x11dbc7=()=>_0x12aa3f(_0x46df15[_0x27516d(0xbd)]);_0x46df15[_0x27516d(0xb6)](_0x27516d(0xbe),_0x11dbc7,{'once':!![]});if(_0x46df15[_0x27516d(0xc4)])_0x11dbc7();return()=>_0x46df15[_0x27516d(0x83)](_0x27516d(0xbe),_0x11dbc7);}
|
|
@@ -23,6 +23,7 @@ export declare const TOOL_EXECUTION_LIMITS: Readonly<{
|
|
|
23
23
|
taskOutputMaxWaitMs: 300000;
|
|
24
24
|
subagentDescriptionMaxCharacters: 80;
|
|
25
25
|
subagentPromptMaxBytes: 131072;
|
|
26
|
+
subagentReasoningEffortMaxCharacters: 64;
|
|
26
27
|
subagentSummaryMaxBytes: 16384;
|
|
27
28
|
subagentEvidenceMaxItems: 64;
|
|
28
29
|
subagentVerificationMaxItems: 16;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
const
|
|
2
|
+
const _0x526487=_0x5ec5;(function(_0x14dafa,_0x1837e9){const _0x14cedf=_0x5ec5,_0x49bd04=_0x14dafa();while(!![]){try{const _0x280f96=-parseInt(_0x14cedf(0xdb))/(-0xef9*0x2+-0x17*-0x14e+0xf*-0x1)+-parseInt(_0x14cedf(0xda))/(0x20c0+-0x2641+0x11*0x53)*(parseInt(_0x14cedf(0xe1))/(-0x1*-0x2395+0x1de1*-0x1+0x5b1*-0x1))+-parseInt(_0x14cedf(0xd9))/(-0x1484+-0x149d+0x2925)+-parseInt(_0x14cedf(0xde))/(0x21*0x122+-0x2189+0x46*-0xe)+-parseInt(_0x14cedf(0xd8))/(-0x1*0x640+0x21e4+-0x1b9e)+-parseInt(_0x14cedf(0xdc))/(0x1*0xb9b+-0x1198+0x604)*(-parseInt(_0x14cedf(0xe2))/(-0x20ad+-0x7*0x9d+-0x2500*-0x1))+-parseInt(_0x14cedf(0xdd))/(-0x1*0x1b59+0x166a+-0x35*-0x18)*(-parseInt(_0x14cedf(0xdf))/(0xf40*-0x2+0x5d1+0x18b9*0x1));if(_0x280f96===_0x1837e9)break;else _0x49bd04['push'](_0x49bd04['shift']());}catch(_0x5f3989){_0x49bd04['push'](_0x49bd04['shift']());}}}(_0x225f,0x80dc*0x11+0xd4286+0x1*-0xbf45f));function _0x225f(){const _0x385d4a=['nda3ody0mfjPzhn4Ca','nta5mJK4mgX3v1fgua','ndmWodeZnKLZA1zQsG','nMvWrwH1za','oty0mJu2uMHuuM9v','n0jOz2PdrG','mZy4mty1otDpz1PjELe','ndG1ntm0mefxqMjowq','mtb4B2rHCKm','zNjLzxPL','otmWmZzoAwPvyNK'];_0x225f=function(){return _0x385d4a;};return _0x225f();}function _0x5ec5(_0x406ef1,_0x1f3e6f){_0x406ef1=_0x406ef1-(0x2f2+0x1b62*-0x1+-0x2*-0xca4);const _0x4d5fba=_0x225f();let _0x579021=_0x4d5fba[_0x406ef1];if(_0x5ec5['mRmhvE']===undefined){var _0x57a8b2=function(_0xeeca5b){const _0x46aa5f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x44754d='',_0x5b1e2d='';for(let _0xb37fbd=0x9*0x2eb+-0x1fba+0x577,_0x5d11b3,_0x29c91b,_0x4bbb76=-0x208c+-0x139*0x18+-0x4*-0xf79;_0x29c91b=_0xeeca5b['charAt'](_0x4bbb76++);~_0x29c91b&&(_0x5d11b3=_0xb37fbd%(-0x1972+-0x1*0x1685+-0xad*-0x47)?_0x5d11b3*(0x8f5*0x3+-0x1b78+-0xd9*-0x1)+_0x29c91b:_0x29c91b,_0xb37fbd++%(-0xfaf+0x778+0x83b))?_0x44754d+=String['fromCharCode'](0x14f1+-0x19bd*0x1+0x5cb&_0x5d11b3>>(-(0xd6e+-0xc2*0xf+0x1*-0x20e)*_0xb37fbd&0x2201+0x2a5*0x1+-0x24a0)):0x1*-0x571+0x1*0x21ba+-0x1c49){_0x29c91b=_0x46aa5f['indexOf'](_0x29c91b);}for(let _0x5c6ed9=0x1*-0x1d07+-0x80e*0x3+0x3531,_0x4ed345=_0x44754d['length'];_0x5c6ed9<_0x4ed345;_0x5c6ed9++){_0x5b1e2d+='%'+('00'+_0x44754d['charCodeAt'](_0x5c6ed9)['toString'](-0xb99+-0xc8*0x5+0x5*0x31d))['slice'](-(-0xd5+0x198a+-0x18b3));}return decodeURIComponent(_0x5b1e2d);};_0x5ec5['cfHPmz']=_0x57a8b2,_0x5ec5['TfxVNn']={},_0x5ec5['mRmhvE']=!![];}const _0xffe64=_0x4d5fba[-0x269e*0x1+0x2*-0x65b+0x3354];_0x5ec5['ijhzLy']!==_0xffe64&&(_0x5ec5['TfxVNn']={},_0x5ec5['ijhzLy']=_0xffe64);const _0xf6eae=_0x5ec5['TfxVNn'][_0x406ef1];return _0xf6eae===undefined?(_0x579021=_0x5ec5['cfHPmz'](_0x579021),_0x5ec5['TfxVNn'][_0x406ef1]=_0x579021):_0x579021=_0xf6eae,_0x579021;}export const TOOL_EXECUTION_LIMITS=Object[_0x526487(0xe0)]({'readDefaultLines':0xc8,'readMaxLines':0x7d0,'readMaxBytes':0x100000,'readMaxBatchItems':0x10,'readBatchConcurrency':0x4,'readMaxBatchBytes':0x400000,'viewImageMaxBytes':0x1400000,'execDefaultTimeoutMs':0x1d4c0,'execMaxTimeoutMs':0x36ee80,'execDefaultYieldMs':0x2710,'execMaxYieldMs':0x7530,'execTerminationGraceMs':0x3e8,'execDefaultMaxOutputBytes':0xf4240,'maxProcesses':0x8,'patchMaxBytes':0x400000,'patchMaxFiles':0x64,'patchMaxFileBytes':0x800000,'patchMaxTotalBytes':0x2000000,'taskOutputMinWaitMs':0x0,'taskOutputWaitFloorMs':0x2710,'taskOutputDefaultWaitMs':0x7530,'taskOutputMaxWaitMs':0x493e0,'subagentDescriptionMaxCharacters':0x50,'subagentPromptMaxBytes':0x20000,'subagentReasoningEffortMaxCharacters':0x40,'subagentSummaryMaxBytes':0x4000,'subagentEvidenceMaxItems':0x40,'subagentVerificationMaxItems':0x10,'subagentChangedFilesMaxItems':0xc8,'questionMaxTextCharacters':0x3e8,'questionMaxOptionCharacters':0x1f4,'todoMaxItems':0x64,'todoMaxTextCharacters':0x3e8});
|
package/dist/tools/task.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* mar-release-protected */
|
|
2
|
-
const
|
|
2
|
+
const _0x5de38e=_0x56f8;(function(_0x4a6baa,_0x2f0bd8){const _0x583e34=_0x56f8,_0x79c6d3=_0x4a6baa();while(!![]){try{const _0x9b07d6=-parseInt(_0x583e34(0x18c))/(-0x1489+-0x159d*-0x1+-0x113)+parseInt(_0x583e34(0x19a))/(0x1b73*0x1+0xaea+-0x265b)+-parseInt(_0x583e34(0x18d))/(-0x1188+0xb2f+0x25*0x2c)*(parseInt(_0x583e34(0x171))/(0x1*0x11cc+0x13*-0x139+0x573))+parseInt(_0x583e34(0x16d))/(-0x9*0x165+-0x1*0x1799+0x242b)*(-parseInt(_0x583e34(0x189))/(-0xaa4+0x4*0x198+0x44a))+parseInt(_0x583e34(0x186))/(0x3*-0x6d7+-0x1*-0x1b9d+0xc9*-0x9)*(parseInt(_0x583e34(0x16f))/(0x2319+-0x119c+-0x1175))+-parseInt(_0x583e34(0x18a))/(0x3*0x91d+0x2327+-0x3e75)+parseInt(_0x583e34(0x18b))/(0x1332+-0x2f*-0x79+-0x295f)*(parseInt(_0x583e34(0x16a))/(-0x1986+0x2315*-0x1+0x8aa*0x7));if(_0x9b07d6===_0x2f0bd8)break;else _0x79c6d3['push'](_0x79c6d3['shift']());}catch(_0x55b3cc){_0x79c6d3['push'](_0x79c6d3['shift']());}}}(_0x5b42,0x2d320+-0x61*-0x19b9+-0x5e0f5));import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';function _0x5b42(){const _0x1b56f5=['zxHWBg9Yzq','DhjPBq','C3vIywDLBNrszwfZB25PBMDfzMzVCNrnyxHdAgfYywn0zxjZ','C29Tzq','zgvZy3jPChrPB24','yNL0zuXLBMD0Aa','C3rYAw5NAwz5','A2v5CW','mti5nvbHDfPbBW','yMfJA2DYB3vUza','C3vIywDLBNrezxnJCMLWDgLVBK1HEenOyxjHy3rLCNm','mZzsANrmyuK','nZu4mty3mMrUDhD4wq','mtyZnZb0vhrtteW','ndmYmda3uw9PALPQ','mJqWmtC5n2nwtuPOEq','u3rHCNqGB25LigjVDw5KzwqSig5VBI1Yzwn1CNnPDMuGC3vIywDLBNqGD2L0AcbZzwXMlwnVBNrHAw5LzcbJB250zxH0lIbvC2uGD2HLBIbHBIbPBMrLCgvUzgvUDcbPBNzLC3rPz2f0Aw9UihDVDwXKignVBNn1BwuGC3vIC3rHBNrPywWGBwfPBI1JB250zxH0ihnWywnLig9YihDOzw4GC2fMzsbWyxjHBgXLBcb3B3jRigHHCYbYzwfSihzHBhvLoYbRzwvWihnTywXSig9YihrPz2H0BhKGy291CgXLzcb3B3jRigLUihrOzsbTywLUignVBNrLEhqUiefSBcbHz2vUDhmGC2HHCMuGDgHLigzPBgvZExn0zw0SihnVigf2B2LKignVBMzSAwn0Aw5NihDYAxrLCY4GvgHLig9WDgLVBMfSihjLyxnVBMLUz0vMzM9YDcbVDMvYCMLKzxmGDgHLihbHCMvUDcbLzMzVCNqGyw5Kig11C3qGyMuGC3vWCg9YDgvKigj5ihrOzsbZzwXLy3rLzcbTB2rLBdSGB21PDcbPDcb0BYbPBMHLCML0lIbszxr1CM5ZihrHC2TjzcWGzgvZy3jPChrPB24Sihf1zxvLzc9YDw5UAw5Nl2nVBxbSzxrLzc9MywLSzwqVy2fUy2vSBgvKihn0yxr1CYWGyM91BMrLzcbZDw1Tyxj5lcbJAgfUz2vKrMLSzxmSihzLCMLMAwnHDgLVBIWGyw5KihjLywqGzxzPzgvUy2u7igjHy2TNCM91BMqGCMv0DxjUCYbPBw1LzgLHDgvSEsb3AgLSzsbMB3jLz3jVDw5KihDHAxrZigzVCIbHihrLCM1PBMfSihjLC3vSDc4','C2LNBMfS','DgfZA0LK','CNvU','AxnbCNjHEq','B2jQzwn0','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','CNvUBMLUzW','z2vUzxjHBc1WDxjWB3nL','Bw9KzwXjza','yM9VBgvHBG','C3vIywDLBNqUC3rHCNrLza','nduXmJa2BhHQz0fL','zw1PDa','mteZmZbjAMrWz3u','Aw5JBhvKzxm','uMvHC29UAw5NigvMzM9YDcbVDMvYCMLKzsbMB3iGDgHLihn1yMfNzw50lIbpBwL0ihrVigLUAgvYAxqGDgHLihbHCMvUDcbLzMzVCNqU','mtuWmZKWre1ODNDu','BgvUz3rO','mZm4mZjtyLvVA1y','CMvHC29UAw5NrwzMB3j0','nhvjEKvYva','C3vIywDLBNrqCM9TChrnyxHcExrLCW','C3vIywDLBNqUy29TCgXLDgvK','C3rHDhvZ','C3rYAw5N','ChjVBxb0','C3vIywDLBNrZ','C2vYAwfS','CxvLDwvK','DgfZAW','u2vSzI1JB250ywLUzwqGyM91BMrLzcb0yxnRihbYB21WDc4','CM9Szq','u3vIywDLBNqGDgfZAYbPBNb1DcbPCYbPBNzHBgLKlG'];_0x5b42=function(){return _0x1b56f5;};return _0x5b42();}export const taskToolDefinition={'name':_0x5de38e(0x17a),'parallelSafety':_0x5de38e(0x178),'description':_0x5de38e(0x18e),'inputSchema':{'type':_0x5de38e(0x193),'properties':{'description':{'type':_0x5de38e(0x175),'maxLength':TOOL_EXECUTION_LIMITS[_0x5de38e(0x188)]},'prompt':{'type':_0x5de38e(0x175),'description':_0x5de38e(0x17b)},'role':{'enum':[_0x5de38e(0x196),_0x5de38e(0x17e)]},'modelId':{'type':_0x5de38e(0x175)},'reasoningEffort':{'type':_0x5de38e(0x175),'maxLength':TOOL_EXECUTION_LIMITS[_0x5de38e(0x180)],'description':_0x5de38e(0x16c)},'background':{'type':_0x5de38e(0x198)}},'required':[_0x5de38e(0x182),_0x5de38e(0x176),_0x5de38e(0x17c)],'additionalProperties':![]}};export async function executeTask(_0x3558ed,_0xb07e68){const _0x57eef2=_0x5de38e,_0x1d5b18=parseTaskInput(_0x3558ed),_0x5dde54=await _0xb07e68[_0x57eef2(0x177)][_0x57eef2(0x191)](_0x1d5b18,{'signal':_0xb07e68[_0x57eef2(0x18f)],'onCreated':async _0x2b9fdb=>_0xb07e68[_0x57eef2(0x19b)]({'type':_0x57eef2(0x199),'taskId':_0x2b9fdb[_0x57eef2(0x190)],'description':_0x2b9fdb[_0x57eef2(0x182)]})});if(_0x5dde54[_0x57eef2(0x174)]!==_0x57eef2(0x179)&&_0x5dde54[_0x57eef2(0x174)]!==_0x57eef2(0x195))await _0xb07e68[_0x57eef2(0x19b)]({'type':_0x57eef2(0x173),'taskId':_0x5dde54[_0x57eef2(0x190)],'description':_0x5dde54[_0x57eef2(0x182)],'status':_0x5dde54[_0x57eef2(0x174)]});return{'content':JSON[_0x57eef2(0x184)](_0x5dde54),'data':_0x5dde54};}function _0x56f8(_0x2973b0,_0x537f66){_0x2973b0=_0x2973b0-(0x2a0*0x8+0x1*-0x2493+0x10fd*0x1);const _0x4fcc83=_0x5b42();let _0x111e81=_0x4fcc83[_0x2973b0];if(_0x56f8['yjpevU']===undefined){var _0x24a7a1=function(_0x3e6add){const _0x4c5a73='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1afc5c='',_0x244afa='';for(let _0x5ea5da=-0x6*-0x524+0x93f+-0x21*0x137,_0x3081eb,_0x1a1f17,_0x524c3e=-0xb23+0x2185+-0x1662;_0x1a1f17=_0x3e6add['charAt'](_0x524c3e++);~_0x1a1f17&&(_0x3081eb=_0x5ea5da%(0x4*0x1aa+0x1e3b*-0x1+0x1797)?_0x3081eb*(-0x10b*-0xe+-0x1f49+0x121*0xf)+_0x1a1f17:_0x1a1f17,_0x5ea5da++%(-0x1a3e*-0x1+-0x19ac+-0x1*0x8e))?_0x1afc5c+=String['fromCharCode'](-0xb*-0x15f+-0x317+-0xaff*0x1&_0x3081eb>>(-(-0x809+0x22d7+-0x1acc)*_0x5ea5da&0x106c*0x1+0x7*-0x32b+0x5c7)):-0x3f*-0x8e+0x14f8+-0x37ea){_0x1a1f17=_0x4c5a73['indexOf'](_0x1a1f17);}for(let _0x30665f=0x267e+-0x18ac+-0xdd2,_0x5611b4=_0x1afc5c['length'];_0x30665f<_0x5611b4;_0x30665f++){_0x244afa+='%'+('00'+_0x1afc5c['charCodeAt'](_0x30665f)['toString'](-0x1cc0+0x6a+0xa*0x2d7))['slice'](-(0xe01+-0x1bd1+-0x1*-0xdd2));}return decodeURIComponent(_0x244afa);};_0x56f8['lfexrL']=_0x24a7a1,_0x56f8['kCodty']={},_0x56f8['yjpevU']=!![];}const _0x45a0ea=_0x4fcc83[0x1*0x665+-0x135*0xb+0x6e2];_0x56f8['CduuEp']!==_0x45a0ea&&(_0x56f8['kCodty']={},_0x56f8['CduuEp']=_0x45a0ea);const _0x1a34ed=_0x56f8['kCodty'][_0x2973b0];return _0x1a34ed===undefined?(_0x111e81=_0x56f8['lfexrL'](_0x111e81),_0x56f8['kCodty'][_0x2973b0]=_0x111e81):_0x111e81=_0x1a34ed,_0x111e81;}function parseTaskInput(_0x42192c){const _0x3295e7=_0x5de38e;if(!_0x42192c||typeof _0x42192c!==_0x3295e7(0x193)||Array[_0x3295e7(0x192)](_0x42192c))return invalidTask();const _0x2bea41=_0x42192c;if(Object[_0x3295e7(0x185)](_0x2bea41)[_0x3295e7(0x181)](_0x4bdf54=>![_0x3295e7(0x182),_0x3295e7(0x176),_0x3295e7(0x17c),_0x3295e7(0x197),_0x3295e7(0x170),_0x3295e7(0x187)][_0x3295e7(0x16b)](_0x4bdf54))||typeof _0x2bea41[_0x3295e7(0x182)]!==_0x3295e7(0x175)||_0x2bea41[_0x3295e7(0x182)][_0x3295e7(0x17f)]()[_0x3295e7(0x16e)]===0xb1+-0x26*0x27+0x519||_0x2bea41[_0x3295e7(0x182)][_0x3295e7(0x16e)]>TOOL_EXECUTION_LIMITS[_0x3295e7(0x188)]||typeof _0x2bea41[_0x3295e7(0x176)]!==_0x3295e7(0x175)||_0x2bea41[_0x3295e7(0x176)][_0x3295e7(0x17f)]()[_0x3295e7(0x16e)]===0x2185+-0x2426+-0x2a1*-0x1||Buffer[_0x3295e7(0x183)](_0x2bea41[_0x3295e7(0x176)])>TOOL_EXECUTION_LIMITS[_0x3295e7(0x172)]||![_0x3295e7(0x196),_0x3295e7(0x17e)][_0x3295e7(0x16b)](String(_0x2bea41[_0x3295e7(0x17c)]))||_0x2bea41[_0x3295e7(0x197)]!==undefined&&_0x2bea41[_0x3295e7(0x197)]!==null&&(typeof _0x2bea41[_0x3295e7(0x197)]!==_0x3295e7(0x175)||_0x2bea41[_0x3295e7(0x197)][_0x3295e7(0x17f)]()[_0x3295e7(0x16e)]===0x2d6*0x4+0x9a3+-0x14fb*0x1)||_0x2bea41[_0x3295e7(0x170)]!==undefined&&(typeof _0x2bea41[_0x3295e7(0x170)]!==_0x3295e7(0x175)||_0x2bea41[_0x3295e7(0x170)][_0x3295e7(0x17f)]()[_0x3295e7(0x16e)]===0x22a0+0x118*-0x17+-0x12f*0x8||_0x2bea41[_0x3295e7(0x170)][_0x3295e7(0x16e)]>TOOL_EXECUTION_LIMITS[_0x3295e7(0x180)])||_0x2bea41[_0x3295e7(0x187)]!==undefined&&_0x2bea41[_0x3295e7(0x187)]!==null&&typeof _0x2bea41[_0x3295e7(0x187)]!==_0x3295e7(0x198))return invalidTask();return{'description':_0x2bea41[_0x3295e7(0x182)][_0x3295e7(0x17f)](),'prompt':_0x2bea41[_0x3295e7(0x176)],'role':_0x2bea41[_0x3295e7(0x17c)],...typeof _0x2bea41[_0x3295e7(0x197)]===_0x3295e7(0x175)?{'modelId':_0x2bea41[_0x3295e7(0x197)]}:{},...typeof _0x2bea41[_0x3295e7(0x170)]===_0x3295e7(0x175)?{'reasoningEffort':_0x2bea41[_0x3295e7(0x170)][_0x3295e7(0x17f)]()}:{},...typeof _0x2bea41[_0x3295e7(0x187)]===_0x3295e7(0x198)?{'background':_0x2bea41[_0x3295e7(0x187)]}:{}};}function invalidTask(){const _0xddf986=_0x5de38e;throw new MarAgentError(_0xddf986(0x194),_0xddf986(0x17d));}
|