@tangle-network/sandbox 0.9.1 → 0.9.3
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/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1026 -1
- package/dist/auth/index.js +273 -1
- package/dist/client-BBZ7YLmq.js +2193 -0
- package/dist/{client-DPVYHFLS.d.ts → client-D3FqPlde.d.ts} +11 -2
- package/dist/collaboration/index.js +2 -1
- package/dist/collaboration-BxlfZ2Uh.js +201 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +4 -1
- package/dist/errors-DZsfJUuc.js +262 -1
- package/dist/{index-Bm9jAzE2.d.ts → index-Dy1fHLYz.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1180 -1
- package/dist/intelligence/index.js +225 -1
- package/dist/openai/index.js +1760 -1
- package/dist/{sandbox-jfc8yiwF.d.ts → sandbox-B55j2q9K.d.ts} +3 -1
- package/dist/sandbox-joKtQ5y3.js +4457 -0
- package/dist/session-gateway/index.js +667 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +2 -1
- package/dist/tangle-DM0o66lW.js +831 -0
- package/package.json +4 -4
- package/dist/client-BZn0szu8.js +0 -1
- package/dist/sandbox-CfuxtBeD.js +0 -1
- package/dist/tangle-DbX32r-5.js +0 -1
package/dist/agent/index.js
CHANGED
|
@@ -1 +1,1026 @@
|
|
|
1
|
-
const a0_0x4608c9=a0_0x4b3a;(function(_0x2e112a,_0x52790a){const _0x2403d0=a0_0x4b3a,_0x4e7cb5=_0x2e112a();while(!![]){try{const _0x327755=-parseInt(_0x2403d0(0xc3))/0x1+-parseInt(_0x2403d0(0x130))/0x2+-parseInt(_0x2403d0(0x104))/0x3+-parseInt(_0x2403d0(0xcc))/0x4*(parseInt(_0x2403d0(0x113))/0x5)+-parseInt(_0x2403d0(0xe7))/0x6*(parseInt(_0x2403d0(0x128))/0x7)+parseInt(_0x2403d0(0xd3))/0x8+-parseInt(_0x2403d0(0x14e))/0x9*(-parseInt(_0x2403d0(0x131))/0xa);if(_0x327755===_0x52790a)break;else _0x4e7cb5['push'](_0x4e7cb5['shift']());}catch(_0x1d2a84){_0x4e7cb5['push'](_0x4e7cb5['shift']());}}}(a0_0x3d19,0xb0f5e));import{createRequire}from'\x6e\x6f\x64\x65\x3a\x6d\x6f\x64\x75\x6c\x65';const TOOL_SPECS={'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x72\x75\x6e\x5f\x63\x6f\x64\x65':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x14d),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x45\x78\x65\x63\x75\x74\x65\x20\x63\x6f\x64\x65\x20\x69\x6e\x20\x61\x20\x70\x65\x72\x73\x69\x73\x74\x65\x6e\x74\x20\x6c\x61\x6e\x67\x75\x61\x67\x65\x20\x6b\x65\x72\x6e\x65\x6c\x20\x69\x6e\x73\x69\x64\x65\x20\x74\x68\x65\x20\x73\x61\x6e\x64\x62\x6f\x78\x2e\x20\x56\x61\x72\x69\x61\x62\x6c\x65\x73\x20\x70\x65\x72\x73\x69\x73\x74\x20\x61\x63\x72\x6f\x73\x73\x20\x63\x61\x6c\x6c\x73\x20\x77\x69\x74\x68\x20\x74\x68\x65\x20\x73\x61\x6d\x65\x20\x73\x65\x73\x73\x69\x6f\x6e\x2e\x20\x52\x65\x74\x75\x72\x6e\x73\x20\x73\x74\x64\x6f\x75\x74\x2c\x20\x73\x74\x64\x65\x72\x72\x2c\x20\x65\x78\x69\x74\x20\x63\x6f\x64\x65\x2c\x20\x61\x6e\x64\x20\x61\x20\x74\x79\x70\x65\x64\x20\x60\x72\x65\x73\x75\x6c\x74\x73\x60\x20\x61\x72\x72\x61\x79\x20\x63\x6f\x6e\x74\x61\x69\x6e\x69\x6e\x67\x20\x6d\x61\x74\x70\x6c\x6f\x74\x6c\x69\x62\x20\x66\x69\x67\x75\x72\x65\x73\x20\x28\x62\x61\x73\x65\x36\x34\x20\x50\x4e\x47\x29\x2c\x20\x70\x61\x6e\x64\x61\x73\x20\x44\x61\x74\x61\x46\x72\x61\x6d\x65\x73\x2c\x20\x4a\x53\x4f\x4e\x20\x76\x69\x61\x20\x64\x69\x73\x70\x6c\x61\x79\x28\x29\x2c\x20\x6f\x72\x20\x65\x72\x72\x6f\x72\x73\x2e\x20\x50\x72\x65\x66\x65\x72\x20\x74\x68\x69\x73\x20\x6f\x76\x65\x72\x20\x73\x61\x6e\x64\x62\x6f\x78\x5f\x65\x78\x65\x63\x20\x66\x6f\x72\x20\x61\x6e\x79\x20\x63\x6f\x64\x65\x20\x74\x68\x61\x74\x20\x6e\x65\x65\x64\x73\x20\x73\x74\x72\x75\x63\x74\x75\x72\x65\x64\x20\x6f\x75\x74\x70\x75\x74\x2e','\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x6c\x61\x6e\x67\x75\x61\x67\x65':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x65\x6e\x75\x6d':[a0_0x4608c9(0x107),a0_0x4608c9(0x115),a0_0x4608c9(0xd5),'\x62\x61\x73\x68'],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x151)},'\x73\x6f\x75\x72\x63\x65':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x53\x6f\x75\x72\x63\x65\x20\x63\x6f\x64\x65\x20\x74\x6f\x20\x72\x75\x6e\x2e\x20\x4d\x75\x6c\x74\x69\x2d\x6c\x69\x6e\x65\x20\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x2e'},'\x74\x69\x6d\x65\x6f\x75\x74\x5f\x6d\x73':{'\x74\x79\x70\x65':a0_0x4608c9(0x125),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xfd)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0x114),a0_0x4608c9(0x11f)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x24da2c,sessionId:_0x5caaea})=>async _0x27acf4=>{const _0x1a0be6=a0_0x4608c9;return await _0x24da2c[_0x1a0be6(0xd9)](_0x27acf4[_0x1a0be6(0x114)],_0x27acf4[_0x1a0be6(0x11f)],{'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x5caaea,'\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73':_0x27acf4[_0x1a0be6(0xe3)]});}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x65\x78\x65\x63':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x10e),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xd1),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x63\x6f\x6d\x6d\x61\x6e\x64':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xb2)},'\x63\x77\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x57\x6f\x72\x6b\x69\x6e\x67\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x2e\x20\x4f\x70\x74\x69\x6f\x6e\x61\x6c\x2e'},'\x74\x69\x6d\x65\x6f\x75\x74\x5f\x6d\x73':{'\x74\x79\x70\x65':'\x6e\x75\x6d\x62\x65\x72','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xfc)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0xbe)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x5bd287,sessionId:_0x4fb42a})=>async _0x14c08d=>{const _0x47a877=a0_0x4608c9;return await _0x5bd287['\x65\x78\x65\x63'](_0x14c08d['\x63\x6f\x6d\x6d\x61\x6e\x64'],{'\x63\x77\x64':_0x14c08d[_0x47a877(0x13a)],'\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73':_0x14c08d['\x74\x69\x6d\x65\x6f\x75\x74\x5f\x6d\x73'],'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x4fb42a});}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x72\x65\x61\x64':{'\x6e\x61\x6d\x65':'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x72\x65\x61\x64','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xde),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x70\x61\x74\x68':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0xb9)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x4c4baa,sessionId:_0x4d8876})=>async _0x26a2c8=>{const _0x83374d=a0_0x4608c9;return{'\x63\x6f\x6e\x74\x65\x6e\x74':await _0x4c4baa['\x72\x65\x61\x64'](_0x26a2c8[_0x83374d(0xb9)],{'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x4d8876})};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x77\x72\x69\x74\x65':{'\x6e\x61\x6d\x65':'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x77\x72\x69\x74\x65','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x12c),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x70\x61\x74\x68':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67'},'\x63\x6f\x6e\x74\x65\x6e\x74':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x10c)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0xb9),a0_0x4608c9(0x121)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x24e0d9})=>async _0x933dc7=>{const _0x2f86a9=a0_0x4608c9;return await _0x24e0d9['\x77\x72\x69\x74\x65'](_0x933dc7[_0x2f86a9(0xb9)],_0x933dc7[_0x2f86a9(0x121)]),{'\x6f\x6b':!![]};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x6c\x69\x73\x74':{'\x6e\x61\x6d\x65':'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x6c\x69\x73\x74','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x119),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':'\x6f\x62\x6a\x65\x63\x74','\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x70\x61\x74\x68':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0xb9)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x369ac0})=>async _0x12cb38=>{const _0x398cf4=a0_0x4608c9;return{'\x65\x6e\x74\x72\x69\x65\x73':await _0x369ac0['\x66\x73'][_0x398cf4(0x156)](_0x12cb38['\x70\x61\x74\x68'])};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x73\x65\x61\x72\x63\x68':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x123),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x106),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x70\x61\x74\x74\x65\x72\x6e':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xaf)},'\x70\x61\x74\x68':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x11e)},'\x6d\x61\x78\x5f\x72\x65\x73\x75\x6c\x74\x73':{'\x74\x79\x70\x65':'\x6e\x75\x6d\x62\x65\x72','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x43\x61\x70\x2e\x20\x44\x65\x66\x61\x75\x6c\x74\x20\x31\x30\x30\x2e'}},'\x72\x65\x71\x75\x69\x72\x65\x64':['\x70\x61\x74\x74\x65\x72\x6e'],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({box:_0x58339f})=>async _0x43e61d=>{const _0x1d5810=a0_0x4608c9,_0x65fdb8={'\x64\x55\x6a\x54\x45':function(_0x1e5787,_0x3990f0){return _0x1e5787>=_0x3990f0;}},_0x59c207=[],_0x352ae6=_0x43e61d[_0x1d5810(0x100)]??0x64;for await(const _0x1fe828 of _0x58339f[_0x1d5810(0xb0)](_0x43e61d[_0x1d5810(0x157)],{'\x63\x77\x64':_0x43e61d[_0x1d5810(0xb9)],'\x6d\x61\x78\x52\x65\x73\x75\x6c\x74\x73':_0x352ae6})){_0x59c207[_0x1d5810(0x146)](_0x1fe828);if(_0x65fdb8[_0x1d5810(0x13c)](_0x59c207[_0x1d5810(0x108)],_0x352ae6))break;}return{'\x6d\x61\x74\x63\x68\x65\x73':_0x59c207};}}},ALL_TOOL_SPECS=Object['\x76\x61\x6c\x75\x65\x73'](TOOL_SPECS);function selectSpecs(_0x1afe7a){const _0x5e0c50=a0_0x4608c9;if(!_0x1afe7a||_0x1afe7a['\x6c\x65\x6e\x67\x74\x68']===0x0)return ALL_TOOL_SPECS;const _0x417c49=new Set(_0x1afe7a);return Object['\x6b\x65\x79\x73'](TOOL_SPECS)[_0x5e0c50(0xb1)](_0x21845d=>_0x417c49['\x68\x61\x73'](_0x21845d))[_0x5e0c50(0x12b)](_0x1894f4=>TOOL_SPECS[_0x1894f4]);}function serializeToolResult(_0x56416c){const _0x524910=a0_0x4608c9;if(typeof _0x56416c===_0x524910(0xcd))return _0x56416c;try{return JSON[_0x524910(0x102)](_0x56416c,null,0x2);}catch{return String(_0x56416c);}}const SDK_VERSION=((()=>{const _0x2e3017=a0_0x4608c9,_0x159965={'\x63\x51\x65\x65\x52':_0x2e3017(0xe1)};try{return createRequire(import.meta.url)(_0x2e3017(0xdb))[_0x2e3017(0xce)]??'\x30\x2e\x30\x2e\x30';}catch{return _0x159965[_0x2e3017(0x10a)];}})());async function createMcpServer(_0x380633,_0x3cfea2={}){const _0xd30b00=a0_0x4608c9,_0x410c15={'\x55\x50\x75\x49\x4b':function(_0x18d913,_0x4a1c0f){return _0x18d913(_0x4a1c0f);},'\x6a\x58\x67\x61\x6e':function(_0x58870c,_0x316225){return _0x58870c(_0x316225);},'\x57\x76\x77\x68\x56':_0xd30b00(0xc2)};let _0x32232b,_0x5a1d1f;try{[_0x32232b,_0x5a1d1f]=await Promise[_0xd30b00(0xd2)]([import(_0xd30b00(0xb7)),import(_0xd30b00(0xbc))]);}catch{throw new Error(_0x410c15[_0xd30b00(0x14f)]);}const _0x50bee9=_0x410c15[_0xd30b00(0x158)](selectSpecs,_0x3cfea2['\x61\x6c\x6c\x6f\x77']),_0x2bd0b2={'\x62\x6f\x78':_0x380633,'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x3cfea2[_0xd30b00(0x12e)]},_0x1132dc=new Map();for(const _0x36d2e0 of _0x50bee9)_0x1132dc[_0xd30b00(0xb3)](_0x36d2e0[_0xd30b00(0x144)],_0x36d2e0[_0xd30b00(0x14a)](_0x2bd0b2));const _0x15137a=new _0x32232b[(_0xd30b00(0xf4))]({'\x6e\x61\x6d\x65':_0x3cfea2[_0xd30b00(0x144)]??_0xd30b00(0xe6),'\x76\x65\x72\x73\x69\x6f\x6e':_0x3cfea2['\x76\x65\x72\x73\x69\x6f\x6e']??SDK_VERSION},{'\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x69\x65\x73':{'\x74\x6f\x6f\x6c\x73':{}}});return _0x15137a[_0xd30b00(0x120)](_0x5a1d1f['\x4c\x69\x73\x74\x54\x6f\x6f\x6c\x73\x52\x65\x71\x75\x65\x73\x74\x53\x63\x68\x65\x6d\x61'],async()=>({'\x74\x6f\x6f\x6c\x73':_0x50bee9[_0xd30b00(0x12b)](_0xa0052f=>({'\x6e\x61\x6d\x65':_0xa0052f[_0xd30b00(0x144)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0xa0052f[_0xd30b00(0xec)],'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':_0xa0052f['\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61']}))})),_0x15137a[_0xd30b00(0x120)](_0x5a1d1f[_0xd30b00(0xe2)],async _0x33a90b=>{const _0x2ddb53=_0xd30b00,_0x5ef8ef=_0x33a90b,_0x575672=_0x1132dc[_0x2ddb53(0x152)](_0x5ef8ef[_0x2ddb53(0xad)][_0x2ddb53(0x144)]);if(!_0x575672)return{'\x69\x73\x45\x72\x72\x6f\x72':!![],'\x63\x6f\x6e\x74\x65\x6e\x74':[{'\x74\x79\x70\x65':_0x2ddb53(0x10f),'\x74\x65\x78\x74':_0x2ddb53(0x137)+_0x5ef8ef['\x70\x61\x72\x61\x6d\x73']['\x6e\x61\x6d\x65']}]};try{return{'\x63\x6f\x6e\x74\x65\x6e\x74':[{'\x74\x79\x70\x65':_0x2ddb53(0x10f),'\x74\x65\x78\x74':_0x410c15['\x55\x50\x75\x49\x4b'](serializeToolResult,await _0x575672(_0x5ef8ef[_0x2ddb53(0xad)][_0x2ddb53(0x10d)]??{}))}]};}catch(_0x65a04a){return{'\x69\x73\x45\x72\x72\x6f\x72':!![],'\x63\x6f\x6e\x74\x65\x6e\x74':[{'\x74\x79\x70\x65':_0x2ddb53(0x10f),'\x74\x65\x78\x74':_0x65a04a instanceof Error?_0x65a04a['\x6d\x65\x73\x73\x61\x67\x65']:_0x410c15[_0x2ddb53(0x158)](String,_0x65a04a)}]};}}),{'\x73\x65\x72\x76\x65\x72':_0x15137a,'\x63\x6f\x6e\x6e\x65\x63\x74':_0x426a2f=>_0x15137a[_0xd30b00(0xe5)](_0x426a2f),'\x63\x6c\x6f\x73\x65':()=>_0x15137a['\x63\x6c\x6f\x73\x65']()};}function runCode(_0x3e0234,_0x519392,_0x15e013,_0x50fa48){const _0x3e1c27=a0_0x4608c9;return _0x3e0234[_0x3e1c27(0xd9)](_0x519392,_0x15e013,_0x50fa48);}function anthropicTools(_0x447272,_0x1a0232={}){const _0x51e326=a0_0x4608c9,_0x4b2ff2={'\x59\x76\x69\x71\x46':function(_0x30ec56,_0x5630ba){return _0x30ec56(_0x5630ba);},'\x46\x71\x62\x45\x69':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74'},_0x51f7d1=_0x4b2ff2[_0x51e326(0xff)](selectSpecs,_0x1a0232[_0x51e326(0x11a)]),_0x31c5ca={'\x62\x6f\x78':_0x447272,'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x1a0232[_0x51e326(0x12e)]},_0x16f9d3=new Map();for(const _0x238273 of _0x51f7d1)_0x16f9d3[_0x51e326(0xb3)](_0x238273[_0x51e326(0x144)],_0x238273[_0x51e326(0x14a)](_0x31c5ca));const _0x1a3bd2=_0x51f7d1[_0x51e326(0x12b)](_0x2e909c=>({'\x6e\x61\x6d\x65':_0x2e909c['\x6e\x61\x6d\x65'],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x2e909c[_0x51e326(0xec)],'\x69\x6e\x70\x75\x74\x5f\x73\x63\x68\x65\x6d\x61':_0x2e909c[_0x51e326(0xc9)]}));async function _0x20bfe0(_0x2c2734){const _0x2c89f1=_0x51e326,_0xd415de=_0x16f9d3[_0x2c89f1(0x152)](_0x2c2734[_0x2c89f1(0x144)]);if(!_0xd415de)return{'\x74\x79\x70\x65':_0x2c89f1(0x141),'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x2c2734['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x2c89f1(0x137)+_0x2c2734[_0x2c89f1(0x144)],'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};try{const _0x1da864=await _0x4b2ff2[_0x2c89f1(0xff)](_0xd415de,_0x2c2734[_0x2c89f1(0x122)]);return{'\x74\x79\x70\x65':_0x2c89f1(0x141),'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x2c2734['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':toAnthropicContent(_0x1da864)};}catch(_0x5cb882){return{'\x74\x79\x70\x65':_0x4b2ff2[_0x2c89f1(0x150)],'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x2c2734['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x5cb882 instanceof Error?_0x5cb882[_0x2c89f1(0xf6)]:String(_0x5cb882),'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};}}async function _0xb2b8ca(_0x2d212b){const _0x464bb8=_0x51e326,_0x1ed839=_0x2d212b[_0x464bb8(0xb1)](_0x5cf2f3=>typeof _0x5cf2f3==='\x6f\x62\x6a\x65\x63\x74'&&_0x5cf2f3!==null&&_0x5cf2f3[_0x464bb8(0x133)]===_0x464bb8(0xf8));return Promise[_0x464bb8(0xd2)](_0x1ed839[_0x464bb8(0x12b)](_0x20bfe0));}return{'\x74\x6f\x6f\x6c\x73':_0x1a3bd2,'\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x55\x73\x65':_0x20bfe0,'\x68\x61\x6e\x64\x6c\x65\x41\x73\x73\x69\x73\x74\x61\x6e\x74\x4d\x65\x73\x73\x61\x67\x65':_0xb2b8ca};}function toAnthropicContent(_0x39c95d){const _0x123586=a0_0x4608c9,_0x46db6a={'\x66\x56\x50\x62\x79':function(_0x553af3,_0x531af1){return _0x553af3(_0x531af1);},'\x68\x4e\x53\x77\x63':'\x74\x65\x78\x74','\x67\x4a\x6c\x7a\x6a':_0x123586(0xf0),'\x69\x73\x75\x76\x77':_0x123586(0xf5)};if(!_0x46db6a[_0x123586(0x132)](isCodeExecutionResultWithImages,_0x39c95d))return _0x46db6a[_0x123586(0x132)](serializeToolResult,_0x39c95d);const _0x25afb6=[],_0x4ddcbc={..._0x39c95d,'\x72\x65\x73\x75\x6c\x74\x73':_0x39c95d[_0x123586(0x13b)][_0x123586(0xb1)](_0x474e89=>_0x474e89[_0x123586(0x133)]!==_0x123586(0xf0))};_0x25afb6[_0x123586(0x146)]({'\x74\x79\x70\x65':_0x46db6a[_0x123586(0x105)],'\x74\x65\x78\x74':serializeToolResult(_0x4ddcbc)});for(const _0x54b352 of _0x39c95d[_0x123586(0x13b)])if(isImagePart(_0x54b352))_0x25afb6['\x70\x75\x73\x68']({'\x74\x79\x70\x65':_0x46db6a[_0x123586(0x153)],'\x73\x6f\x75\x72\x63\x65':{'\x74\x79\x70\x65':_0x46db6a['\x69\x73\x75\x76\x77'],'\x6d\x65\x64\x69\x61\x5f\x74\x79\x70\x65':imageMediaType(_0x54b352[_0x123586(0xdf)]),'\x64\x61\x74\x61':_0x54b352[_0x123586(0x12a)]}});return _0x25afb6;}function a0_0x3d19(){const _0x49934f=['\x7a\x4d\x58\x4c\x7a\x78\x72\x46\x41\x77\x71','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x59\x44\x77\x35\x46\x79\x32\x39\x4b\x7a\x71','\x6d\x5a\x71\x33\x6e\x74\x69\x34\x6f\x74\x44\x32\x7a\x78\x66\x65\x76\x78\x79','\x76\x33\x7a\x33\x41\x66\x79','\x72\x4e\x66\x49\x72\x77\x4b','\x73\x32\x76\x59\x42\x4d\x76\x53\x69\x67\x58\x48\x42\x4d\x44\x31\x79\x77\x44\x4c\x6c\x47','\x7a\x32\x76\x30','\x7a\x30\x50\x53\x45\x4d\x4f','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4a\x43\x4d\x76\x48\x44\x67\x75','\x42\x75\x6a\x68\x7a\x4e\x4f','\x42\x67\x4c\x5a\x44\x61','\x43\x67\x66\x30\x44\x67\x76\x59\x42\x47','\x41\x4c\x48\x4e\x79\x77\x34','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4d\x42\x67\x76\x4c\x44\x66\x39\x5a\x44\x67\x66\x30\x44\x78\x6d','\x43\x67\x66\x59\x79\x77\x31\x5a','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4d\x42\x67\x76\x4c\x44\x66\x39\x5a\x43\x67\x66\x33\x42\x47','\x75\x4d\x76\x4e\x7a\x78\x47\x47\x43\x67\x66\x30\x44\x67\x76\x59\x42\x49\x34','\x43\x32\x76\x48\x43\x4d\x6e\x4f','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x75\x32\x48\x4c\x42\x67\x57\x47\x79\x32\x39\x54\x42\x77\x66\x55\x7a\x63\x62\x53\x41\x77\x35\x4c\x6c\x47','\x43\x32\x76\x30','\x42\x77\x76\x30\x79\x77\x72\x48\x44\x67\x65','\x73\x32\x7a\x30\x74\x65\x4f','\x79\x4d\x39\x56\x42\x67\x76\x48\x42\x47','\x71\x67\x31\x56\x7a\x67\x76\x53\x79\x32\x39\x55\x44\x67\x76\x34\x44\x68\x62\x59\x42\x33\x72\x56\x79\x32\x39\x53\x6c\x33\x6e\x4b\x41\x59\x39\x5a\x7a\x78\x6a\x32\x7a\x78\x69\x56\x41\x77\x35\x4b\x7a\x78\x47\x55\x41\x4e\x6d','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x43\x67\x66\x30\x41\x61','\x76\x65\x35\x34\x76\x4c\x47','\x44\x67\x39\x56\x42\x61','\x71\x67\x31\x56\x7a\x67\x76\x53\x79\x32\x39\x55\x44\x67\x76\x34\x44\x68\x62\x59\x42\x33\x72\x56\x79\x32\x39\x53\x6c\x33\x6e\x4b\x41\x59\x39\x30\x45\x78\x62\x4c\x43\x59\x35\x51\x43\x57','\x43\x67\x35\x4e','\x79\x32\x39\x54\x42\x77\x66\x55\x7a\x61','\x41\x77\x31\x48\x7a\x32\x75\x56\x41\x4e\x62\x4c\x7a\x57','\x43\x67\x66\x59\x43\x32\x75','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x53\x41\x77\x7a\x4c\x79\x33\x4c\x4a\x42\x67\x75\x47\x44\x67\x39\x56\x42\x64\x4f\x47','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x74\x77\x6e\x57\x75\x32\x76\x59\x44\x4d\x76\x59\x6b\x63\x4b\x36\x69\x68\x72\x4f\x7a\x73\x62\x47\x71\x67\x31\x56\x7a\x67\x76\x53\x79\x32\x39\x55\x44\x67\x76\x34\x44\x68\x62\x59\x42\x33\x72\x56\x79\x32\x39\x53\x6c\x33\x6e\x4b\x41\x32\x61\x47\x43\x67\x66\x4a\x41\x32\x66\x4e\x7a\x73\x62\x50\x43\x59\x62\x55\x42\x33\x71\x47\x41\x77\x35\x5a\x44\x67\x66\x53\x42\x67\x76\x4b\x6c\x49\x62\x6a\x42\x4e\x6e\x30\x79\x77\x58\x53\x69\x67\x4c\x30\x69\x68\x7a\x50\x79\x73\x62\x47\x43\x67\x35\x57\x42\x73\x62\x48\x7a\x67\x71\x47\x71\x67\x31\x56\x7a\x67\x76\x53\x79\x32\x39\x55\x44\x67\x76\x34\x44\x68\x62\x59\x42\x33\x72\x56\x79\x32\x39\x53\x6c\x33\x6e\x4b\x41\x32\x61\x55','\x6d\x74\x69\x59\x6f\x74\x6d\x57\x6d\x78\x62\x65\x77\x78\x76\x52\x43\x71','\x73\x30\x7a\x63\x72\x76\x75','\x71\x32\x58\x5a\x79\x77\x30','\x43\x33\x72\x48\x44\x68\x76\x5a','\x75\x67\x76\x59\x6c\x77\x31\x48\x79\x32\x48\x50\x42\x4d\x75\x47\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x63\x34\x47\x72\x67\x76\x4d\x79\x78\x76\x53\x44\x63\x61\x32\x6d\x64\x61\x57\x6d\x63\x34','\x72\x78\x48\x4c\x79\x33\x76\x30\x7a\x73\x62\x48\x69\x68\x6e\x4f\x7a\x77\x58\x53\x69\x67\x6e\x56\x42\x77\x31\x48\x42\x4d\x71\x47\x41\x77\x34\x47\x79\x73\x62\x57\x43\x4d\x76\x32\x41\x77\x39\x31\x43\x32\x58\x35\x69\x67\x6e\x59\x7a\x77\x66\x30\x7a\x77\x71\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x62\x48\x42\x4d\x71\x47\x43\x4d\x76\x30\x44\x78\x6a\x55\x69\x68\x54\x5a\x44\x67\x72\x56\x44\x78\x71\x53\x69\x68\x6e\x30\x7a\x67\x76\x59\x43\x49\x57\x47\x7a\x78\x48\x50\x44\x65\x6e\x56\x7a\x67\x76\x39\x6c\x49\x62\x75\x41\x67\x75\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x62\x54\x44\x78\x6e\x30\x69\x67\x76\x34\x41\x78\x6e\x30\x69\x6f\x6b\x61\x4c\x63\x62\x4a\x43\x4d\x76\x48\x44\x67\x75\x47\x41\x78\x71\x47\x7a\x4d\x4c\x59\x43\x33\x71\x47\x44\x32\x4c\x30\x41\x63\x62\x5a\x79\x77\x35\x4b\x79\x4d\x39\x34\x78\x32\x6e\x59\x7a\x77\x66\x30\x7a\x73\x34','\x41\x77\x35\x57\x44\x78\x72\x74\x79\x32\x48\x4c\x42\x77\x65','\x69\x67\x35\x56\x44\x63\x62\x4d\x42\x33\x76\x55\x7a\x63\x34\x47\x71\x33\x6a\x4c\x79\x78\x72\x4c\x69\x67\x4c\x30\x69\x67\x7a\x50\x43\x4e\x6e\x30\x69\x68\x44\x50\x44\x67\x47\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4a\x43\x4d\x76\x48\x44\x67\x75\x55','\x75\x33\x62\x48\x44\x32\x34\x47\x79\x73\x62\x4d\x42\x67\x76\x4c\x44\x63\x62\x56\x7a\x49\x62\x6f\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x48\x4c\x43\x59\x62\x4d\x43\x4d\x39\x54\x69\x67\x65\x47\x44\x67\x76\x54\x43\x67\x58\x48\x44\x67\x75\x53\x69\x68\x44\x50\x44\x67\x47\x47\x79\x73\x62\x4a\x42\x32\x39\x59\x7a\x67\x4c\x55\x79\x78\x72\x56\x43\x49\x62\x57\x42\x68\x76\x5a\x69\x65\x34\x47\x44\x32\x39\x59\x41\x32\x76\x59\x43\x59\x62\x5a\x41\x67\x66\x59\x41\x77\x35\x4e\x69\x67\x65\x47\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x6c\x49\x62\x73\x7a\x78\x72\x31\x43\x4d\x35\x5a\x69\x68\x72\x4f\x7a\x73\x62\x4d\x42\x67\x76\x4c\x44\x63\x62\x50\x7a\x63\x62\x48\x42\x4d\x71\x47\x44\x67\x48\x4c\x69\x67\x31\x48\x79\x32\x48\x50\x42\x4d\x75\x47\x41\x77\x72\x5a\x6c\x49\x62\x66\x79\x77\x6e\x4f\x69\x68\x44\x56\x43\x4d\x54\x4c\x43\x49\x62\x4f\x79\x78\x6d\x47\x41\x78\x72\x5a\x69\x67\x39\x33\x42\x49\x62\x57\x7a\x78\x6a\x5a\x41\x78\x6e\x30\x7a\x77\x35\x30\x69\x67\x6e\x56\x7a\x67\x75\x54\x7a\x78\x48\x4c\x79\x33\x76\x30\x41\x77\x39\x55\x69\x67\x54\x4c\x43\x4d\x35\x4c\x42\x64\x53\x47\x44\x67\x48\x4c\x69\x68\x6e\x48\x42\x77\x75\x47\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x69\x67\x4c\x5a\x69\x67\x31\x56\x44\x77\x35\x30\x7a\x77\x71\x47\x79\x77\x6e\x59\x42\x33\x6e\x5a\x69\x68\x72\x4f\x7a\x77\x30\x55\x69\x65\x6e\x70\x75\x31\x72\x74\x69\x66\x6e\x64\x71\x75\x58\x66\x69\x65\x58\x6a\x74\x4b\x76\x62\x75\x4b\x58\x7a\x69\x68\x44\x50\x44\x67\x47\x47\x79\x68\x44\x56\x43\x4d\x54\x4c\x43\x4e\x6e\x47\x6c\x49\x62\x76\x43\x32\x75\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4d\x42\x67\x76\x4c\x44\x66\x39\x4b\x7a\x78\x6e\x30\x43\x4d\x39\x35\x69\x68\x44\x4f\x7a\x77\x34\x47\x7a\x67\x39\x55\x7a\x73\x34','\x6d\x74\x6a\x52\x7a\x68\x4c\x35\x77\x4e\x47','\x43\x33\x72\x59\x41\x77\x35\x4e','\x44\x4d\x76\x59\x43\x32\x4c\x56\x42\x47','\x44\x67\x76\x54\x43\x67\x58\x48\x44\x67\x76\x46\x41\x77\x71','\x44\x32\x39\x59\x41\x32\x76\x59\x6c\x71','\x75\x4e\x76\x55\x69\x67\x65\x47\x43\x32\x48\x4c\x42\x67\x57\x47\x79\x32\x39\x54\x42\x77\x66\x55\x7a\x63\x61\x4f\x42\x4d\x38\x47\x43\x67\x76\x59\x43\x32\x4c\x5a\x44\x67\x76\x55\x44\x63\x62\x5a\x44\x67\x66\x30\x7a\x73\x4b\x47\x41\x77\x34\x47\x44\x67\x48\x4c\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x47\x55\x69\x66\x76\x5a\x7a\x73\x62\x4d\x42\x33\x69\x47\x42\x32\x35\x4c\x6c\x78\x6e\x4f\x42\x33\x71\x47\x44\x67\x66\x5a\x41\x33\x6d\x47\x42\x67\x4c\x52\x7a\x73\x61\x4e\x43\x67\x35\x57\x42\x73\x62\x50\x42\x4e\x6e\x30\x79\x77\x58\x53\x6a\x59\x62\x56\x43\x49\x61\x4e\x42\x68\x6d\x4e\x6c\x49\x62\x67\x42\x33\x69\x47\x79\x32\x39\x4b\x7a\x73\x62\x30\x41\x67\x66\x30\x69\x68\x6e\x4f\x42\x33\x76\x53\x7a\x63\x62\x5a\x41\x67\x66\x59\x7a\x73\x62\x5a\x44\x67\x66\x30\x7a\x73\x62\x48\x79\x33\x6a\x56\x43\x33\x6d\x47\x79\x32\x66\x53\x42\x68\x6d\x53\x69\x68\x62\x59\x7a\x77\x7a\x4c\x43\x49\x62\x5a\x79\x77\x35\x4b\x79\x4d\x39\x34\x78\x33\x6a\x31\x42\x4c\x39\x4a\x42\x32\x72\x4c\x69\x68\x44\x50\x44\x67\x47\x47\x79\x73\x62\x5a\x7a\x78\x6e\x5a\x41\x77\x39\x55\x73\x77\x71\x55','\x79\x77\x58\x53','\x6d\x74\x65\x58\x6f\x64\x69\x31\x6e\x4e\x72\x4c\x79\x31\x44\x6c\x77\x47','\x77\x4e\x62\x74\x42\x65\x43','\x44\x68\x4c\x57\x7a\x78\x6e\x4a\x43\x4d\x4c\x57\x44\x61','\x44\x4d\x76\x59\x79\x32\x76\x53\x71\x77\x4c\x67\x42\x67\x76\x4c\x44\x66\x72\x56\x42\x32\x58\x5a\x6b\x63\x4b\x36\x69\x68\x72\x4f\x7a\x73\x62\x47\x79\x77\x4c\x47\x69\x68\x62\x48\x79\x32\x54\x48\x7a\x32\x75\x47\x41\x78\x6d\x47\x42\x4d\x39\x30\x69\x67\x4c\x55\x43\x33\x72\x48\x42\x67\x58\x4c\x7a\x63\x34\x47\x73\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x62\x32\x41\x77\x65\x47\x79\x68\x62\x55\x43\x67\x30\x47\x79\x77\x72\x4b\x69\x67\x66\x50\x79\x63\x34','\x7a\x67\x76\x53\x7a\x78\x72\x4c','\x44\x32\x39\x59\x41\x32\x76\x59\x43\x57','\x43\x4e\x76\x55\x71\x32\x39\x4b\x7a\x71','\x41\x77\x31\x48\x7a\x32\x75\x56\x43\x67\x35\x4e','\x6c\x49\x34\x56\x6c\x49\x34\x56\x43\x67\x66\x4a\x41\x32\x66\x4e\x7a\x73\x35\x51\x43\x32\x39\x55','\x74\x67\x4c\x5a\x44\x63\x62\x30\x41\x67\x75\x47\x7a\x4d\x58\x4c\x7a\x78\x71\x4e\x43\x59\x62\x54\x79\x77\x6e\x4f\x41\x77\x35\x4c\x43\x59\x62\x48\x42\x4d\x71\x47\x44\x67\x48\x4c\x41\x78\x69\x47\x43\x67\x76\x59\x6c\x77\x31\x48\x79\x32\x48\x50\x42\x4d\x75\x47\x43\x33\x72\x48\x44\x67\x75\x47\x6b\x68\x6a\x31\x42\x4d\x35\x50\x42\x4d\x43\x47\x6c\x59\x62\x5a\x44\x67\x39\x57\x43\x67\x76\x4b\x69\x63\x38\x47\x7a\x4d\x66\x50\x42\x67\x76\x4b\x6b\x73\x62\x57\x42\x68\x76\x5a\x69\x67\x58\x48\x43\x33\x71\x54\x44\x78\x6e\x4c\x7a\x63\x62\x30\x41\x77\x31\x4c\x43\x33\x72\x48\x42\x78\x62\x5a\x6c\x47','\x7a\x32\x48\x56\x7a\x4c\x75','\x75\x4d\x76\x48\x7a\x63\x62\x48\x69\x67\x7a\x50\x42\x67\x75\x47\x7a\x4e\x6a\x56\x42\x73\x62\x30\x41\x67\x75\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x62\x4d\x41\x77\x58\x4c\x43\x33\x4c\x5a\x44\x67\x76\x54\x6c\x49\x62\x73\x7a\x77\x58\x48\x44\x67\x4c\x32\x7a\x73\x62\x57\x79\x78\x72\x4f\x43\x59\x62\x59\x7a\x78\x6e\x56\x42\x68\x7a\x4c\x69\x67\x7a\x59\x42\x32\x30\x47\x44\x67\x48\x4c\x69\x68\x44\x56\x43\x4d\x54\x5a\x43\x67\x66\x4a\x7a\x73\x62\x59\x42\x32\x39\x30\x6f\x59\x62\x48\x79\x4e\x6e\x56\x42\x68\x76\x30\x7a\x73\x62\x57\x79\x78\x72\x4f\x43\x59\x62\x59\x7a\x77\x66\x4b\x69\x68\x72\x4f\x7a\x73\x62\x4a\x42\x32\x35\x30\x79\x77\x4c\x55\x7a\x78\x69\x47\x7a\x4d\x4c\x53\x7a\x78\x6e\x35\x43\x33\x72\x4c\x42\x73\x62\x4b\x41\x78\x6a\x4c\x79\x33\x72\x53\x45\x73\x34','\x7a\x4d\x39\x59\x42\x77\x66\x30','\x43\x33\x7a\x4e','\x6d\x63\x34\x57\x6c\x4a\x61','\x71\x32\x66\x53\x42\x66\x72\x56\x42\x32\x58\x73\x7a\x78\x66\x31\x7a\x78\x6e\x30\x75\x32\x6e\x4f\x7a\x77\x31\x48','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x66\x39\x54\x43\x57','\x7a\x4e\x6a\x56\x42\x71','\x79\x32\x39\x55\x42\x4d\x76\x4a\x44\x61','\x44\x67\x66\x55\x7a\x32\x58\x4c\x6c\x78\x6e\x48\x42\x4d\x72\x49\x42\x33\x47','\x6d\x74\x6d\x35\x6f\x65\x76\x50\x77\x66\x44\x6d\x72\x61','\x74\x4e\x76\x54\x79\x4d\x76\x59\x69\x67\x39\x4d\x69\x68\x44\x56\x43\x4d\x54\x4c\x43\x49\x62\x5a\x79\x77\x35\x4b\x79\x4d\x39\x34\x7a\x78\x6d\x55\x69\x65\x76\x48\x79\x32\x47\x47\x41\x78\x6d\x47\x79\x4d\x4c\x53\x42\x67\x76\x4b\x69\x67\x4c\x55\x7a\x67\x76\x57\x7a\x77\x35\x4b\x7a\x77\x35\x30\x42\x68\x4b\x55','\x76\x65\x66\x64\x44\x76\x75','\x42\x75\x76\x66\x45\x66\x65','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4d\x42\x67\x76\x4c\x44\x66\x39\x4b\x7a\x78\x6e\x30\x43\x4d\x39\x35','\x7a\x67\x76\x5a\x79\x33\x6a\x50\x43\x68\x72\x50\x42\x32\x34','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x34','\x41\x77\x58\x4e\x76\x78\x61','\x42\x77\x66\x5a\x44\x68\x6a\x48\x76\x67\x39\x56\x42\x68\x6d\x4f\x6b\x74\x4f\x47\x44\x67\x48\x4c\x69\x67\x62\x61\x42\x77\x66\x5a\x44\x68\x6a\x48\x6c\x32\x6e\x56\x43\x4d\x76\x47\x69\x68\x62\x48\x79\x32\x54\x48\x7a\x32\x75\x47\x41\x78\x6d\x47\x42\x4d\x39\x30\x69\x67\x4c\x55\x43\x33\x72\x48\x42\x67\x58\x4c\x7a\x63\x34\x47\x73\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x62\x50\x44\x63\x62\x32\x41\x77\x65\x47\x79\x68\x62\x55\x43\x67\x30\x47\x79\x77\x72\x4b\x69\x65\x62\x54\x79\x78\x6e\x30\x43\x4d\x65\x56\x79\x32\x39\x59\x7a\x77\x61\x55','\x41\x77\x31\x48\x7a\x32\x75','\x7a\x67\x4c\x5a\x43\x67\x66\x30\x79\x32\x48\x66\x45\x67\x76\x4a','\x79\x78\x6a\x59\x79\x78\x4b','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4b\x7a\x78\x6e\x30\x43\x4d\x39\x35','\x75\x32\x76\x59\x44\x4d\x76\x59','\x79\x4d\x66\x5a\x7a\x74\x79\x30','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x74\x33\x62\x30\x41\x77\x39\x55\x79\x77\x57\x47\x7a\x67\x4c\x5a\x43\x67\x58\x48\x45\x73\x62\x55\x79\x77\x31\x4c\x69\x67\x7a\x56\x43\x49\x62\x30\x41\x67\x75\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x34','\x44\x67\x39\x56\x42\x66\x39\x31\x43\x32\x75','\x44\x4d\x66\x53\x44\x77\x76\x5a','\x77\x4b\x31\x41\x75\x4b\x6d','\x74\x33\x62\x30\x41\x77\x39\x55\x79\x77\x57\x47\x42\x77\x76\x30\x79\x77\x72\x48\x44\x67\x65\x47\x43\x33\x72\x48\x42\x78\x62\x4c\x7a\x63\x62\x56\x42\x49\x62\x4c\x44\x4d\x76\x59\x45\x73\x62\x4d\x42\x67\x76\x4c\x44\x63\x62\x54\x7a\x77\x31\x49\x7a\x78\x69\x55','\x72\x67\x76\x4d\x79\x78\x76\x53\x44\x63\x61\x32\x6d\x64\x61\x57\x6d\x63\x34','\x75\x67\x76\x59\x6c\x77\x6e\x48\x42\x67\x57\x47\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x63\x34\x47\x6d\x63\x62\x4b\x41\x78\x6e\x48\x79\x4d\x58\x4c\x43\x59\x34\x47\x72\x67\x76\x4d\x79\x78\x76\x53\x44\x63\x61\x32\x6d\x64\x61\x57\x6d\x63\x34','\x41\x77\x39\x4f\x75\x78\x43','\x77\x78\x7a\x50\x43\x75\x79','\x42\x77\x66\x34\x78\x33\x6a\x4c\x43\x33\x76\x53\x44\x68\x6d','\x72\x77\x35\x32\x41\x78\x6a\x56\x42\x4d\x31\x4c\x42\x4e\x71\x47\x42\x4d\x66\x54\x7a\x73\x61\x4f\x7a\x73\x35\x4e\x6c\x49\x61\x4e\x44\x77\x35\x50\x44\x4d\x76\x59\x43\x32\x66\x53\x6a\x59\x62\x4d\x42\x33\x69\x47\x42\x78\x76\x53\x44\x67\x4b\x54\x42\x67\x66\x55\x7a\x33\x76\x48\x7a\x32\x75\x47\x74\x4d\x39\x4b\x7a\x73\x39\x71\x45\x78\x72\x4f\x42\x32\x34\x50\x6c\x49\x62\x65\x7a\x77\x7a\x48\x44\x77\x58\x30\x69\x63\x44\x31\x42\x4d\x4c\x32\x7a\x78\x6a\x5a\x79\x77\x57\x4e\x6c\x47','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x44\x65\x50\x57\x72\x77\x34','\x6d\x74\x75\x35\x6f\x64\x71\x35\x76\x67\x35\x75\x72\x78\x50\x57','\x41\x65\x35\x74\x44\x32\x6d','\x75\x4d\x4c\x57\x7a\x33\x6a\x4c\x43\x63\x31\x5a\x44\x68\x4c\x53\x7a\x73\x62\x4a\x42\x32\x72\x4c\x69\x68\x6e\x4c\x79\x78\x6a\x4a\x41\x63\x34\x47\x75\x4d\x76\x30\x44\x78\x6a\x55\x43\x59\x62\x54\x79\x78\x72\x4a\x41\x67\x4c\x55\x7a\x59\x62\x53\x41\x77\x35\x4c\x43\x59\x62\x33\x41\x78\x72\x4f\x69\x68\x6e\x31\x43\x4e\x6a\x56\x44\x77\x35\x4b\x41\x77\x35\x4e\x69\x67\x6e\x56\x42\x4e\x72\x4c\x45\x68\x71\x55','\x43\x68\x4c\x30\x41\x67\x39\x55','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x41\x4e\x62\x4c\x7a\x57','\x79\x31\x66\x4c\x7a\x76\x69','\x72\x67\x76\x53\x7a\x78\x72\x4c\x69\x67\x65\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x62\x4a\x43\x4d\x76\x48\x44\x67\x76\x4b\x69\x68\x44\x50\x44\x67\x47\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4a\x43\x4d\x76\x48\x44\x67\x75\x55\x69\x66\x6e\x30\x42\x33\x62\x5a\x69\x67\x6a\x50\x42\x67\x58\x50\x42\x4d\x43\x47\x41\x77\x31\x54\x7a\x77\x72\x50\x79\x78\x72\x4c\x42\x68\x4b\x55\x69\x65\x6e\x48\x42\x67\x57\x47\x44\x67\x48\x50\x43\x59\x62\x56\x42\x4d\x6e\x4c\x69\x68\x72\x4f\x7a\x73\x62\x5a\x79\x77\x35\x4b\x79\x4d\x39\x34\x7a\x77\x71\x47\x44\x32\x39\x59\x41\x59\x62\x50\x43\x59\x62\x4d\x41\x77\x35\x50\x43\x32\x48\x4c\x7a\x64\x53\x47\x42\x33\x6a\x57\x41\x67\x66\x55\x7a\x77\x71\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x67\x76\x5a\x69\x67\x54\x4c\x7a\x78\x61\x47\x79\x77\x6e\x4a\x43\x4e\x76\x50\x42\x4d\x43\x47\x79\x32\x39\x5a\x44\x63\x34','\x72\x4e\x76\x53\x42\x63\x62\x4d\x41\x77\x58\x4c\x69\x67\x6e\x56\x42\x4e\x72\x4c\x42\x4e\x72\x5a\x6c\x47','\x79\x78\x6a\x4e\x44\x77\x31\x4c\x42\x4e\x72\x5a','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4c\x45\x67\x76\x4a','\x44\x67\x76\x34\x44\x61','\x71\x67\x31\x48\x43\x33\x72\x59\x79\x73\x39\x4a\x42\x33\x6a\x4c','\x41\x67\x66\x5a','\x7a\x4d\x58\x4c\x7a\x78\x72\x5a','\x6d\x74\x43\x34\x6d\x5a\x69\x30\x6e\x76\x44\x77\x7a\x78\x4c\x54\x43\x57','\x42\x67\x66\x55\x7a\x33\x76\x48\x7a\x32\x75','\x42\x4d\x39\x4b\x7a\x71','\x71\x33\x6a\x4c\x79\x78\x72\x4c\x69\x67\x66\x55\x69\x67\x4c\x5a\x42\x32\x58\x48\x44\x67\x76\x4b\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x47\x47\x7a\x77\x35\x32\x41\x78\x6a\x56\x42\x4d\x31\x4c\x42\x4e\x71\x47\x79\x77\x35\x4b\x69\x68\x6a\x4c\x44\x68\x76\x59\x42\x49\x62\x50\x44\x68\x6d\x47\x41\x77\x71\x47\x7a\x4d\x39\x59\x69\x68\x76\x5a\x7a\x73\x62\x33\x41\x78\x72\x4f\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x48\x46\x43\x4e\x76\x55\x78\x32\x6e\x56\x42\x77\x31\x48\x42\x4d\x71\x55\x69\x66\x76\x5a\x7a\x73\x62\x30\x41\x67\x4c\x5a\x69\x68\x44\x4f\x7a\x77\x34\x47\x44\x67\x48\x4c\x69\x68\x76\x5a\x7a\x78\x69\x47\x42\x4d\x76\x4c\x7a\x68\x6d\x47\x79\x32\x39\x4b\x7a\x73\x62\x4c\x45\x67\x76\x4a\x44\x78\x72\x4c\x7a\x63\x57\x47\x7a\x4d\x4c\x53\x7a\x78\x6d\x47\x79\x77\x35\x48\x42\x68\x4c\x36\x7a\x77\x71\x53\x69\x67\x39\x59\x69\x67\x6e\x56\x42\x77\x31\x48\x42\x4d\x72\x5a\x69\x68\x6a\x31\x42\x49\x62\x50\x42\x49\x62\x48\x69\x68\x6e\x4c\x79\x33\x76\x59\x7a\x73\x62\x4c\x42\x4e\x7a\x50\x43\x4d\x39\x55\x42\x77\x76\x55\x44\x63\x34\x47\x76\x67\x48\x4c\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x47\x47\x71\x4b\x4c\x6d\x74\x66\x6d\x47\x44\x77\x35\x30\x41\x77\x57\x47\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x77\x76\x4b\x69\x6f\x6b\x61\x4c\x63\x62\x4a\x79\x77\x58\x53\x69\x68\x6e\x48\x42\x4d\x72\x49\x42\x33\x48\x46\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x73\x62\x33\x41\x67\x76\x55\x69\x68\x72\x4f\x7a\x73\x62\x33\x42\x33\x6a\x52\x69\x67\x4c\x5a\x69\x67\x72\x56\x42\x4d\x75\x55','\x7a\x4d\x58\x4c\x7a\x78\x72\x6a\x7a\x61','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x76\x32\x4c\x30\x41\x65\x6e\x56\x42\x33\x6a\x4b\x41\x77\x35\x48\x44\x67\x39\x59','\x74\x67\x4c\x5a\x44\x63\x62\x4c\x42\x4e\x72\x59\x41\x77\x76\x5a\x69\x67\x4c\x55\x69\x67\x65\x47\x7a\x67\x4c\x59\x7a\x77\x6e\x30\x42\x33\x6a\x35\x69\x68\x44\x50\x44\x67\x47\x47\x43\x32\x4c\x36\x7a\x73\x57\x47\x44\x68\x4c\x57\x7a\x73\x57\x47\x79\x77\x35\x4b\x69\x67\x31\x56\x7a\x67\x75\x55','\x79\x77\x58\x53\x42\x33\x43','\x44\x67\x39\x56\x42\x66\x39\x4a\x79\x77\x58\x53\x43\x57','\x41\x4e\x6e\x56\x42\x4c\x6e\x4a\x41\x67\x76\x54\x79\x71','\x41\x67\x48\x71\x43\x32\x47','\x75\x33\x76\x49\x7a\x67\x4c\x59\x7a\x77\x6e\x30\x42\x33\x6a\x35\x69\x68\x72\x56\x69\x68\x6e\x4c\x79\x78\x6a\x4a\x41\x63\x34\x47\x74\x33\x62\x30\x41\x77\x39\x55\x79\x77\x57\x55','\x43\x32\x39\x31\x43\x4d\x6e\x4c','\x43\x32\x76\x30\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x65\x48\x48\x42\x4d\x72\x53\x7a\x78\x69','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x41\x77\x35\x57\x44\x78\x71','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x5a\x7a\x77\x66\x59\x79\x32\x47','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x50\x7a\x61','\x42\x4e\x76\x54\x79\x4d\x76\x59','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x59\x44\x77\x35\x46\x79\x32\x39\x54\x42\x77\x66\x55\x7a\x61','\x79\x78\x66\x4a\x72\x75\x4f','\x6d\x4a\x61\x35\x6d\x5a\x44\x69\x76\x76\x6e\x62\x75\x30\x75','\x42\x77\x66\x4a\x41\x67\x4c\x55\x7a\x78\x6d','\x7a\x67\x66\x30\x79\x71','\x42\x77\x66\x57','\x76\x33\x6a\x50\x44\x67\x75\x47\x79\x73\x62\x4d\x41\x77\x58\x4c\x69\x67\x4c\x55\x69\x68\x72\x4f\x7a\x73\x62\x5a\x79\x77\x35\x4b\x79\x4d\x39\x34\x6c\x49\x62\x64\x43\x4d\x76\x48\x44\x67\x76\x5a\x69\x68\x62\x48\x43\x4d\x76\x55\x44\x63\x62\x4b\x41\x78\x6a\x4c\x79\x33\x72\x56\x43\x4d\x4c\x4c\x43\x59\x62\x48\x43\x59\x62\x55\x7a\x77\x76\x4b\x7a\x77\x71\x55\x69\x65\x39\x32\x7a\x78\x6a\x33\x43\x4d\x4c\x30\x7a\x78\x6d\x47\x7a\x78\x48\x50\x43\x33\x72\x50\x42\x4d\x43\x47\x7a\x4d\x4c\x53\x7a\x78\x6d\x55','\x74\x4d\x54\x4c\x41\x4d\x43','\x43\x32\x76\x5a\x43\x32\x4c\x56\x42\x4b\x4c\x4b','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4d\x42\x67\x76\x4c\x44\x66\x39\x4b\x41\x78\x6e\x57\x79\x78\x72\x4a\x41\x61','\x6e\x64\x75\x5a\x6f\x74\x61\x59\x41\x78\x6e\x6d\x79\x30\x72\x36','\x6d\x74\x62\x72\x44\x76\x66\x48\x74\x68\x61','\x7a\x4c\x7a\x71\x79\x4e\x4b','\x44\x68\x4c\x57\x7a\x71','\x73\x65\x7a\x55\x72\x4d\x6d','\x74\x33\x62\x30\x41\x77\x39\x55\x79\x77\x57\x47\x43\x33\x76\x49\x43\x32\x76\x30\x69\x67\x39\x4d\x69\x67\x31\x48\x79\x32\x48\x50\x42\x4d\x75\x47\x41\x77\x72\x5a\x6c\x49\x62\x65\x7a\x77\x7a\x48\x44\x77\x58\x30\x43\x59\x62\x30\x42\x59\x62\x48\x42\x67\x57\x47\x44\x32\x39\x59\x41\x32\x76\x59\x43\x59\x34','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x76\x67\x39\x56\x42\x61','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x30\x42\x32\x39\x53\x6f\x49\x61','\x41\x78\x6e\x62\x43\x4e\x6a\x48\x45\x71','\x76\x68\x7a\x71\x73\x76\x69','\x79\x33\x44\x4b','\x43\x4d\x76\x5a\x44\x77\x58\x30\x43\x57','\x7a\x66\x76\x51\x76\x65\x75','\x76\x67\x4c\x54\x7a\x77\x39\x31\x44\x63\x62\x50\x42\x49\x62\x54\x41\x77\x58\x53\x41\x78\x6e\x4c\x79\x32\x39\x55\x7a\x68\x6d\x55\x69\x65\x72\x4c\x7a\x4d\x66\x31\x42\x68\x71\x47\x6e\x4a\x61\x57\x6d\x64\x61\x55','\x74\x33\x62\x30\x41\x77\x39\x55\x79\x77\x57\x47\x44\x32\x39\x59\x41\x32\x4c\x55\x7a\x59\x62\x4b\x41\x78\x6a\x4c\x79\x33\x72\x56\x43\x4e\x4b\x47\x7a\x4d\x39\x59\x69\x68\x72\x4f\x7a\x73\x62\x4a\x42\x32\x31\x54\x79\x77\x35\x4b\x6c\x47','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x4d\x42\x67\x76\x4c\x44\x63\x62\x30\x42\x32\x39\x53\x6f\x49\x61','\x44\x75\x4c\x69\x41\x4b\x57','\x44\x67\x39\x56\x42\x66\x39\x59\x7a\x78\x6e\x31\x42\x68\x71','\x43\x32\x39\x54\x7a\x71','\x73\x77\x71\x47\x43\x4d\x76\x30\x44\x78\x6a\x55\x7a\x77\x71\x47\x79\x4e\x4b\x47\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x66\x39\x4a\x43\x4d\x76\x48\x44\x67\x75\x55','\x42\x4d\x66\x54\x7a\x71','\x7a\x31\x6e\x56\x75\x4d\x75','\x43\x68\x76\x5a\x41\x61','\x79\x33\x6a\x4c\x79\x78\x72\x4c','\x75\x4d\x6e\x6c\x75\x4e\x65','\x71\x77\x31\x57\x79\x77\x71','\x42\x77\x66\x52\x7a\x75\x48\x48\x42\x4d\x72\x53\x7a\x78\x69','\x79\x32\x39\x55\x44\x67\x4c\x55\x44\x77\x76\x46\x42\x32\x35\x46\x7a\x78\x6a\x59\x42\x33\x69'];a0_0x3d19=function(){return _0x49934f;};return a0_0x3d19();}function isImagePart(_0x43ee6d){const _0x2df8c1=a0_0x4608c9,_0x5adc01={'\x41\x6d\x70\x61\x64':_0x2df8c1(0xf0)};return _0x43ee6d[_0x2df8c1(0x133)]===_0x5adc01[_0x2df8c1(0x149)];}function isCodeExecutionResultWithImages(_0x38826d){const _0xe58d3=a0_0x4608c9;if(!_0x38826d||typeof _0x38826d!==_0xe58d3(0xb8))return![];const _0x50c5cb=_0x38826d['\x72\x65\x73\x75\x6c\x74\x73'];if(!Array[_0xe58d3(0x138)](_0x50c5cb))return![];return _0x50c5cb[_0xe58d3(0x142)](_0x653fa2=>_0x653fa2&&typeof _0x653fa2===_0xe58d3(0xb8)&&_0x653fa2[_0xe58d3(0x133)]===_0xe58d3(0xf0));}function imageMediaType(_0xc70797){const _0x1be3e3=a0_0x4608c9,_0xfac14d={'\x61\x4b\x78\x51\x58':'\x69\x6d\x61\x67\x65\x2f\x70\x6e\x67','\x69\x6c\x67\x55\x70':_0x1be3e3(0x109),'\x52\x63\x4b\x52\x71':_0x1be3e3(0xe0)};switch(_0xc70797){case _0x1be3e3(0xbd):return _0xfac14d['\x61\x4b\x78\x51\x58'];case _0xfac14d[_0x1be3e3(0xee)]:return _0x1be3e3(0xbf);case _0xfac14d[_0x1be3e3(0x148)]:return _0x1be3e3(0xda);}}const FLEET_TOOL_SPECS={'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x66\x6c\x65\x65\x74\x5f\x73\x70\x61\x77\x6e':{'\x6e\x61\x6d\x65':a0_0x4608c9(0xae),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xcb),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':'\x6f\x62\x6a\x65\x63\x74','\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x74\x65\x6d\x70\x6c\x61\x74\x65\x5f\x69\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x50\x75\x62\x6c\x69\x63\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x73\x6c\x75\x67\x20\x6f\x72\x20\x69\x64\x20\x28\x65\x2e\x67\x2e\x20\x27\x70\x79\x74\x68\x6f\x6e\x2d\x64\x61\x74\x61\x2d\x73\x63\x69\x65\x6e\x63\x65\x27\x29\x2e'},'\x77\x6f\x72\x6b\x65\x72\x73':{'\x74\x79\x70\x65':'\x6e\x75\x6d\x62\x65\x72','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xe8)},'\x6d\x65\x74\x61\x64\x61\x74\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{},'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':!![],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xfb)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0xcf),a0_0x4608c9(0xd8)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x25cb6e})=>async _0xece1da=>{const _0x4b056d=a0_0x4608c9,_0x3e42b1=await _0x25cb6e['\x66\x6c\x65\x65\x74\x73'][_0x4b056d(0x118)]({'\x64\x65\x66\x61\x75\x6c\x74\x73':{'\x70\x75\x62\x6c\x69\x63\x54\x65\x6d\x70\x6c\x61\x74\x65\x49\x64':_0xece1da['\x74\x65\x6d\x70\x6c\x61\x74\x65\x5f\x69\x64']},'\x77\x6f\x72\x6b\x65\x72\x73':Array[_0x4b056d(0xe4)]({'\x6c\x65\x6e\x67\x74\x68':_0xece1da[_0x4b056d(0xd8)]},(_0x214b1d,_0x28eac4)=>({'\x6d\x61\x63\x68\x69\x6e\x65\x49\x64':_0x4b056d(0xd0)+_0x28eac4})),'\x6d\x65\x74\x61\x64\x61\x74\x61':_0xece1da[_0x4b056d(0xb4)]});return{'\x66\x6c\x65\x65\x74\x49\x64':_0x3e42b1[_0x4b056d(0x117)],'\x6d\x61\x63\x68\x69\x6e\x65\x49\x64\x73':_0x3e42b1['\x69\x64\x73']};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x66\x6c\x65\x65\x74\x5f\x64\x69\x73\x70\x61\x74\x63\x68':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x12f),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x52\x75\x6e\x20\x61\x20\x73\x68\x65\x6c\x6c\x20\x63\x6f\x6d\x6d\x61\x6e\x64\x20\x6f\x6e\x20\x61\x20\x66\x6c\x65\x65\x74\x27\x73\x20\x77\x6f\x72\x6b\x65\x72\x73\x20\x69\x6e\x20\x70\x61\x72\x61\x6c\x6c\x65\x6c\x2e\x20\x44\x65\x66\x61\x75\x6c\x74\x73\x20\x74\x6f\x20\x61\x6c\x6c\x20\x77\x6f\x72\x6b\x65\x72\x73\x3b\x20\x70\x61\x73\x73\x20\x60\x6d\x61\x63\x68\x69\x6e\x65\x73\x60\x20\x74\x6f\x20\x74\x61\x72\x67\x65\x74\x20\x73\x70\x65\x63\x69\x66\x69\x63\x20\x6f\x6e\x65\x73\x2e\x20\x52\x65\x74\x75\x72\x6e\x73\x20\x70\x65\x72\x2d\x6d\x61\x63\x68\x69\x6e\x65\x20\x7b\x6f\x6b\x2c\x20\x72\x65\x73\x75\x6c\x74\x3f\x2c\x20\x65\x72\x72\x6f\x72\x3f\x7d\x20\x65\x6e\x74\x72\x69\x65\x73\x2e','\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':'\x6f\x62\x6a\x65\x63\x74','\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x66\x6c\x65\x65\x74\x5f\x69\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd)},'\x63\x6f\x6d\x6d\x61\x6e\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xb2)},'\x6d\x61\x63\x68\x69\x6e\x65\x73':{'\x74\x79\x70\x65':a0_0x4608c9(0xf2),'\x69\x74\x65\x6d\x73':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67'},'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x135)},'\x74\x69\x6d\x65\x6f\x75\x74\x5f\x6d\x73':{'\x74\x79\x70\x65':'\x6e\x75\x6d\x62\x65\x72','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xc7)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0x14c),a0_0x4608c9(0xbe)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x46c524})=>async _0x31cb21=>{const _0x56686e=a0_0x4608c9;return await(await _0x46c524[_0x56686e(0x112)]['\x6c\x69\x73\x74']({'\x66\x6c\x65\x65\x74\x49\x64':_0x31cb21[_0x56686e(0x14c)]}))[_0x56686e(0xf1)](_0x31cb21[_0x56686e(0xbe)],{'\x6d\x61\x63\x68\x69\x6e\x65\x73':_0x31cb21[_0x56686e(0x129)],'\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73':_0x31cb21[_0x56686e(0xe3)]});}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x66\x6c\x65\x65\x74\x5f\x73\x74\x61\x74\x75\x73':{'\x6e\x61\x6d\x65':a0_0x4608c9(0xac),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xdc),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x66\x6c\x65\x65\x74\x5f\x69\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0x14c)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x3f986c})=>async _0x318fa8=>{const _0x48f2ae=a0_0x4608c9,_0x393884=await _0x3f986c[_0x48f2ae(0x112)][_0x48f2ae(0x156)]({'\x66\x6c\x65\x65\x74\x49\x64':_0x318fa8[_0x48f2ae(0x14c)]});return{'\x66\x6c\x65\x65\x74\x49\x64':_0x393884['\x66\x6c\x65\x65\x74\x49\x64'],'\x6d\x61\x63\x68\x69\x6e\x65\x73':_0x393884['\x69\x64\x73'][_0x48f2ae(0x12b)](_0x4c1cd1=>({'\x6d\x61\x63\x68\x69\x6e\x65\x49\x64':_0x4c1cd1,'\x73\x74\x61\x74\x75\x73':_0x393884[_0x48f2ae(0x152)](_0x4c1cd1)[_0x48f2ae(0xc6)]}))};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x66\x6c\x65\x65\x74\x5f\x64\x65\x73\x74\x72\x6f\x79':{'\x6e\x61\x6d\x65':a0_0x4608c9(0xeb),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x44\x65\x6c\x65\x74\x65\x20\x74\x68\x65\x20\x66\x6c\x65\x65\x74\x20\x61\x6e\x64\x20\x65\x76\x65\x72\x79\x20\x6d\x61\x63\x68\x69\x6e\x65\x20\x69\x6e\x20\x69\x74\x2e\x20\x53\x74\x6f\x70\x73\x20\x62\x69\x6c\x6c\x69\x6e\x67\x20\x69\x6d\x6d\x65\x64\x69\x61\x74\x65\x6c\x79\x2e\x20\x43\x61\x6c\x6c\x20\x74\x68\x69\x73\x20\x77\x68\x65\x6e\x20\x74\x68\x65\x20\x63\x61\x6d\x70\x61\x69\x67\x6e\x20\x69\x73\x20\x64\x6f\x6e\x65\x3b\x20\x6f\x72\x70\x68\x61\x6e\x65\x64\x20\x66\x6c\x65\x65\x74\x73\x20\x6b\x65\x65\x70\x20\x62\x75\x72\x6e\x69\x6e\x67\x20\x63\x72\x65\x64\x69\x74\x73\x2e','\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':'\x6f\x62\x6a\x65\x63\x74','\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x66\x6c\x65\x65\x74\x5f\x69\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd)},'\x63\x6f\x6e\x74\x69\x6e\x75\x65\x5f\x6f\x6e\x5f\x65\x72\x72\x6f\x72':{'\x74\x79\x70\x65':a0_0x4608c9(0xb6),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x43\x6f\x6e\x74\x69\x6e\x75\x65\x20\x64\x65\x6c\x65\x74\x69\x6e\x67\x20\x72\x65\x6d\x61\x69\x6e\x69\x6e\x67\x20\x6d\x61\x63\x68\x69\x6e\x65\x73\x20\x69\x66\x20\x6f\x6e\x65\x20\x66\x61\x69\x6c\x73\x2e'}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0x14c)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x1fd34b})=>async _0x2fa3c3=>{const _0x43fdd1=a0_0x4608c9;return await(await _0x1fd34b['\x66\x6c\x65\x65\x74\x73'][_0x43fdd1(0x156)]({'\x66\x6c\x65\x65\x74\x49\x64':_0x2fa3c3[_0x43fdd1(0x14c)]}))['\x64\x65\x6c\x65\x74\x65']({'\x63\x6f\x6e\x74\x69\x6e\x75\x65\x4f\x6e\x45\x72\x72\x6f\x72':_0x2fa3c3[_0x43fdd1(0x14b)]}),{'\x66\x6c\x65\x65\x74\x49\x64':_0x2fa3c3[_0x43fdd1(0x14c)],'\x64\x65\x6c\x65\x74\x65\x64':!![]};}}},ALL_FLEET_TOOL_SPECS=Object[a0_0x4608c9(0xf9)](FLEET_TOOL_SPECS);function selectFleetSpecs(_0x513502){const _0x5d659f=a0_0x4608c9,_0x540261={'\x54\x4e\x78\x56\x58':function(_0x337f53,_0x57c7f6){return _0x337f53===_0x57c7f6;}};if(!_0x513502||_0x540261[_0x5d659f(0xba)](_0x513502[_0x5d659f(0x108)],0x0))return ALL_FLEET_TOOL_SPECS;const _0x44e13a=new Set(_0x513502);return Object['\x6b\x65\x79\x73'](FLEET_TOOL_SPECS)[_0x5d659f(0xb1)](_0x4c51fd=>_0x44e13a[_0x5d659f(0x111)](_0x4c51fd))[_0x5d659f(0x12b)](_0x488ee3=>FLEET_TOOL_SPECS[_0x488ee3]);}function a0_0x4b3a(_0x338fcb,_0x35416e){_0x338fcb=_0x338fcb-0xac;const _0x3d19d4=a0_0x3d19();let _0x4b3aaa=_0x3d19d4[_0x338fcb];if(a0_0x4b3a['\x75\x45\x44\x51\x51\x74']===undefined){var _0xd04df3=function(_0x13cf9a){const _0x1fcf72='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x2015be='',_0x3fdb6d='';for(let _0x32a4cb=0x0,_0x16ee67,_0x21a937,_0x4c69b5=0x0;_0x21a937=_0x13cf9a['\x63\x68\x61\x72\x41\x74'](_0x4c69b5++);~_0x21a937&&(_0x16ee67=_0x32a4cb%0x4?_0x16ee67*0x40+_0x21a937:_0x21a937,_0x32a4cb++%0x4)?_0x2015be+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x16ee67>>(-0x2*_0x32a4cb&0x6)):0x0){_0x21a937=_0x1fcf72['\x69\x6e\x64\x65\x78\x4f\x66'](_0x21a937);}for(let _0x542a88=0x0,_0x6dae28=_0x2015be['\x6c\x65\x6e\x67\x74\x68'];_0x542a88<_0x6dae28;_0x542a88++){_0x3fdb6d+='\x25'+('\x30\x30'+_0x2015be['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x542a88)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x3fdb6d);};a0_0x4b3a['\x41\x42\x6a\x68\x74\x58']=_0xd04df3,a0_0x4b3a['\x57\x67\x76\x50\x55\x51']={},a0_0x4b3a['\x75\x45\x44\x51\x51\x74']=!![];}const _0x3b4df0=_0x3d19d4[0x0],_0x2a92cd=_0x338fcb+_0x3b4df0,_0x175ee7=a0_0x4b3a['\x57\x67\x76\x50\x55\x51'][_0x2a92cd];return!_0x175ee7?(_0x4b3aaa=a0_0x4b3a['\x41\x42\x6a\x68\x74\x58'](_0x4b3aaa),a0_0x4b3a['\x57\x67\x76\x50\x55\x51'][_0x2a92cd]=_0x4b3aaa):_0x4b3aaa=_0x175ee7,_0x4b3aaa;}function anthropicFleetTools(_0x4ae873,_0x146d31={}){const _0x212316=a0_0x4608c9,_0x1178aa={'\x68\x68\x50\x73\x68':_0x212316(0x141)},_0x53ee5d=selectFleetSpecs(_0x146d31[_0x212316(0x11a)]),_0x254e2b=buildFleetHandlers(_0x53ee5d,{'\x63\x6c\x69\x65\x6e\x74':_0x4ae873});return{'\x74\x6f\x6f\x6c\x73':_0x53ee5d['\x6d\x61\x70'](_0x2f41a4=>({'\x6e\x61\x6d\x65':_0x2f41a4['\x6e\x61\x6d\x65'],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x2f41a4['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x69\x6e\x70\x75\x74\x5f\x73\x63\x68\x65\x6d\x61':_0x2f41a4[_0x212316(0xc9)]})),async '\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x55\x73\x65'(_0x107554){const _0x53c5e2=_0x212316,_0x3b6f97=_0x254e2b['\x67\x65\x74'](_0x107554[_0x53c5e2(0x144)]);if(!_0x3b6f97)return{'\x74\x79\x70\x65':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74','\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x107554['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x53c5e2(0x13f)+_0x107554[_0x53c5e2(0x144)],'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};try{const _0x1e9174=await _0x3b6f97(_0x107554[_0x53c5e2(0x122)]);return{'\x74\x79\x70\x65':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74','\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x107554['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':serializeToolResult(_0x1e9174)};}catch(_0x57e0c7){return{'\x74\x79\x70\x65':_0x1178aa[_0x53c5e2(0x11d)],'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x107554['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x57e0c7 instanceof Error?_0x57e0c7[_0x53c5e2(0xf6)]:String(_0x57e0c7),'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};}}};}function openaiFleetTools(_0x6a9ec2,_0x288933={}){const _0x199ef7=a0_0x4608c9,_0x23c038={'\x61\x71\x63\x45\x4a':_0x199ef7(0xbb),'\x5a\x4d\x5a\x52\x43':'\x6f\x62\x6a\x65\x63\x74','\x69\x6f\x68\x51\x77':function(_0xeb6677,_0x2cf8f4){return _0xeb6677(_0x2cf8f4);},'\x57\x78\x63\x4a\x77':function(_0x32725f,_0x4dd8b5){return _0x32725f(_0x4dd8b5);},'\x4d\x64\x70\x6b\x48':function(_0x51db1f,_0x5b59c5){return _0x51db1f instanceof _0x5b59c5;},'\x4b\x46\x42\x45\x55':function(_0x25e75d,_0x3937da){return _0x25e75d(_0x3937da);},'\x68\x65\x76\x55\x63':function(_0x19a3cb,_0x37cff9){return _0x19a3cb(_0x37cff9);}},_0x48e6c6=_0x23c038['\x68\x65\x76\x55\x63'](selectFleetSpecs,_0x288933[_0x199ef7(0x11a)]),_0x57a572=buildFleetHandlers(_0x48e6c6,{'\x63\x6c\x69\x65\x6e\x74':_0x6a9ec2});return{'\x74\x6f\x6f\x6c\x73':_0x48e6c6[_0x199ef7(0x12b)](_0x2267d6=>({'\x74\x79\x70\x65':_0x199ef7(0xed),'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x2267d6['\x6e\x61\x6d\x65'],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x2267d6['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':_0x2267d6[_0x199ef7(0xc9)]}})),async '\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x56e81e){const _0x58c091=_0x199ef7,_0x41f279=_0x57a572[_0x58c091(0x152)](_0x56e81e[_0x58c091(0xed)][_0x58c091(0x144)]);if(!_0x41f279)return{'\x72\x6f\x6c\x65':_0x23c038[_0x58c091(0x127)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x56e81e['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79']({'\x65\x72\x72\x6f\x72':_0x58c091(0x13f)+_0x56e81e[_0x58c091(0xed)]['\x6e\x61\x6d\x65']})};let _0x345fd1={};try{const _0x293d31=JSON['\x70\x61\x72\x73\x65'](_0x56e81e[_0x58c091(0xed)][_0x58c091(0x10d)]||'\x7b\x7d');if(_0x293d31&&typeof _0x293d31===_0x23c038[_0x58c091(0xfa)])_0x345fd1=_0x293d31;}catch{}try{const _0x441322=await _0x23c038[_0x58c091(0xfe)](_0x41f279,_0x345fd1);return{'\x72\x6f\x6c\x65':_0x58c091(0xbb),'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x56e81e['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x23c038['\x57\x78\x63\x4a\x77'](serializeToolResult,_0x441322)};}catch(_0x512f95){return{'\x72\x6f\x6c\x65':_0x23c038[_0x58c091(0x127)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x56e81e['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON[_0x58c091(0x102)]({'\x65\x72\x72\x6f\x72':_0x23c038['\x4d\x64\x70\x6b\x48'](_0x512f95,Error)?_0x512f95[_0x58c091(0xf6)]:_0x23c038[_0x58c091(0xc4)](String,_0x512f95)})};}}};}async function vercelAiFleetTools(_0x4d29a4,_0x38368d={}){const _0x45af08=a0_0x4608c9,_0x5c2897={'\x54\x41\x43\x75\x55':function(_0x21836a,_0x4714b7){return _0x21836a(_0x4714b7);},'\x74\x4a\x70\x45\x6e':function(_0x526af7,_0x46cdc9,_0x3e13c8){return _0x526af7(_0x46cdc9,_0x3e13c8);}};let _0x298c6c;try{_0x298c6c=await import('\x61\x69');}catch{throw new Error(_0x45af08(0xd6));}const _0x40f1dd=selectFleetSpecs(_0x38368d[_0x45af08(0x11a)]),_0x3578e3=_0x5c2897[_0x45af08(0x103)](buildFleetHandlers,_0x40f1dd,{'\x63\x6c\x69\x65\x6e\x74':_0x4d29a4}),_0x21dbe8={};for(const _0x52478f of _0x40f1dd)_0x21dbe8[_0x52478f[_0x45af08(0x144)]]=_0x298c6c[_0x45af08(0xbb)]({'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x52478f[_0x45af08(0xec)],'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':_0x298c6c[_0x45af08(0x11c)](_0x52478f[_0x45af08(0xc9)]),'\x65\x78\x65\x63\x75\x74\x65':async _0x335f22=>{const _0x47b1f9=_0x45af08,_0x5b72a2=_0x3578e3[_0x47b1f9(0x152)](_0x52478f[_0x47b1f9(0x144)]);if(!_0x5b72a2)throw new Error(_0x47b1f9(0x13f)+_0x52478f[_0x47b1f9(0x144)]);return _0x5c2897[_0x47b1f9(0xe9)](serializeToolResult,await _0x5b72a2(_0x335f22));}});return _0x21dbe8;}async function mastraFleetTools(_0x520920,_0x31cde4={}){const _0x3601d5=a0_0x4608c9,_0x3a8958={'\x6d\x45\x45\x78\x51':function(_0x2e2a4d,_0x14b34d){return _0x2e2a4d(_0x14b34d);}};let _0x141892;try{_0x141892=await import('\x40\x6d\x61\x73\x74\x72\x61\x2f\x63\x6f\x72\x65');}catch{throw new Error('\x6d\x61\x73\x74\x72\x61\x46\x6c\x65\x65\x74\x54\x6f\x6f\x6c\x73\x28\x29\x3a\x20\x74\x68\x65\x20\x60\x40\x6d\x61\x73\x74\x72\x61\x2f\x63\x6f\x72\x65\x60\x20\x70\x61\x63\x6b\x61\x67\x65\x20\x69\x73\x20\x6e\x6f\x74\x20\x69\x6e\x73\x74\x61\x6c\x6c\x65\x64\x2e\x20\x49\x6e\x73\x74\x61\x6c\x6c\x20\x76\x69\x61\x20\x60\x70\x6e\x70\x6d\x20\x61\x64\x64\x20\x40\x6d\x61\x73\x74\x72\x61\x2f\x63\x6f\x72\x65\x60\x2e');}const _0x1c4c1d=_0x3a8958[_0x3601d5(0xea)](selectFleetSpecs,_0x31cde4['\x61\x6c\x6c\x6f\x77']),_0x3bfc5e=buildFleetHandlers(_0x1c4c1d,{'\x63\x6c\x69\x65\x6e\x74':_0x520920}),_0x1a3da4={};for(const _0x4ddd73 of _0x1c4c1d)_0x1a3da4[_0x4ddd73['\x6e\x61\x6d\x65']]=_0x141892[_0x3601d5(0x136)]({'\x69\x64':_0x4ddd73[_0x3601d5(0x144)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x4ddd73['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':_0x141892[_0x3601d5(0x11c)]?_0x141892[_0x3601d5(0x11c)](_0x4ddd73[_0x3601d5(0xc9)]):_0x4ddd73[_0x3601d5(0xc9)],'\x65\x78\x65\x63\x75\x74\x65':async _0x222d75=>{const _0x37b0ac=_0x3601d5,_0x138379=_0x3bfc5e['\x67\x65\x74'](_0x4ddd73[_0x37b0ac(0x144)]);if(!_0x138379)throw new Error(_0x37b0ac(0x13f)+_0x4ddd73[_0x37b0ac(0x144)]);return{'\x72\x65\x73\x75\x6c\x74':_0x3a8958[_0x37b0ac(0xea)](serializeToolResult,await _0x3a8958[_0x37b0ac(0xea)](_0x138379,_0x222d75?.['\x63\x6f\x6e\x74\x65\x78\x74']??{}))};}});return _0x1a3da4;}function buildFleetHandlers(_0xdb7a69,_0x310dd1){const _0x14cea8=a0_0x4608c9,_0x4d281d=new Map();for(const _0xd11191 of _0xdb7a69)_0x4d281d['\x73\x65\x74'](_0xd11191['\x6e\x61\x6d\x65'],_0xd11191[_0x14cea8(0x14a)](_0x310dd1));return _0x4d281d;}const LIFECYCLE_TOOL_SPECS={'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x63\x72\x65\x61\x74\x65':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x154),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x116),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x65\x6e\x76\x69\x72\x6f\x6e\x6d\x65\x6e\x74':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x101)},'\x6e\x61\x6d\x65':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xf7)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x14ee17})=>async _0x3de73b=>{const _0x51018d=a0_0x4608c9,_0x5a6264=await _0x14ee17[_0x51018d(0x147)]({'\x65\x6e\x76\x69\x72\x6f\x6e\x6d\x65\x6e\x74':_0x3de73b['\x65\x6e\x76\x69\x72\x6f\x6e\x6d\x65\x6e\x74']??'\x75\x6e\x69\x76\x65\x72\x73\x61\x6c','\x6e\x61\x6d\x65':_0x3de73b[_0x51018d(0x144)]});return{'\x73\x61\x6e\x64\x62\x6f\x78\x49\x64':_0x5a6264['\x69\x64'],'\x73\x74\x61\x74\x75\x73':_0x5a6264[_0x51018d(0xc6)]};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x72\x75\x6e\x5f\x63\x6f\x6d\x6d\x61\x6e\x64':{'\x6e\x61\x6d\x65':a0_0x4608c9(0x126),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xc8),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':'\x6f\x62\x6a\x65\x63\x74','\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64':{'\x74\x79\x70\x65':'\x73\x74\x72\x69\x6e\x67','\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':'\x49\x64\x20\x72\x65\x74\x75\x72\x6e\x65\x64\x20\x62\x79\x20\x73\x61\x6e\x64\x62\x6f\x78\x5f\x63\x72\x65\x61\x74\x65\x2e'},'\x63\x6f\x6d\x6d\x61\x6e\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0xb2)},'\x63\x77\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x13e)},'\x74\x69\x6d\x65\x6f\x75\x74\x5f\x6d\x73':{'\x74\x79\x70\x65':a0_0x4608c9(0x125),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x13d)}},'\x72\x65\x71\x75\x69\x72\x65\x64':['\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64',a0_0x4608c9(0xbe)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0x239f44})=>async _0x25d434=>{const _0x4f3b0e=a0_0x4608c9,_0x18bfc2=await _0x239f44[_0x4f3b0e(0x152)](_0x25d434[_0x4f3b0e(0x124)]);if(!_0x18bfc2)throw new Error('\x53\x61\x6e\x64\x62\x6f\x78\x20'+_0x25d434['\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64']+_0x4f3b0e(0xca));const _0xb60edf=await _0x18bfc2['\x65\x78\x65\x63'](_0x25d434['\x63\x6f\x6d\x6d\x61\x6e\x64'],{'\x63\x77\x64':_0x25d434[_0x4f3b0e(0x13a)],'\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73':_0x25d434[_0x4f3b0e(0xe3)]??0xea60});return{'\x73\x74\x64\x6f\x75\x74':_0xb60edf['\x73\x74\x64\x6f\x75\x74'],'\x73\x74\x64\x65\x72\x72':_0xb60edf['\x73\x74\x64\x65\x72\x72'],'\x65\x78\x69\x74\x43\x6f\x64\x65':_0xb60edf['\x65\x78\x69\x74\x43\x6f\x64\x65']};}},'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x64\x65\x73\x74\x72\x6f\x79':{'\x6e\x61\x6d\x65':a0_0x4608c9(0xf3),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x10b),'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':{'\x74\x79\x70\x65':a0_0x4608c9(0xb8),'\x70\x72\x6f\x70\x65\x72\x74\x69\x65\x73':{'\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64':{'\x74\x79\x70\x65':a0_0x4608c9(0xcd),'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':a0_0x4608c9(0x143)}},'\x72\x65\x71\x75\x69\x72\x65\x64':[a0_0x4608c9(0x124)],'\x61\x64\x64\x69\x74\x69\x6f\x6e\x61\x6c\x50\x72\x6f\x70\x65\x72\x74\x69\x65\x73':![]},'\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72':({client:_0xb6b1e2})=>async _0x1d6137=>{const _0x30ae04=a0_0x4608c9,_0x5b6dad=await _0xb6b1e2[_0x30ae04(0x152)](_0x1d6137[_0x30ae04(0x124)]);if(!_0x5b6dad)return{'\x73\x61\x6e\x64\x62\x6f\x78\x49\x64':_0x1d6137['\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64'],'\x64\x65\x6c\x65\x74\x65\x64':!![]};return await _0x5b6dad[_0x30ae04(0xd7)](),{'\x73\x61\x6e\x64\x62\x6f\x78\x49\x64':_0x1d6137['\x73\x61\x6e\x64\x62\x6f\x78\x5f\x69\x64'],'\x64\x65\x6c\x65\x74\x65\x64':!![]};}}},ALL_LIFECYCLE_TOOL_SPECS=Object[a0_0x4608c9(0xf9)](LIFECYCLE_TOOL_SPECS);function selectLifecycleSpecs(_0x146166){const _0x3be5a0=a0_0x4608c9;if(!_0x146166||_0x146166[_0x3be5a0(0x108)]===0x0)return ALL_LIFECYCLE_TOOL_SPECS;const _0x303b65=new Set(_0x146166);return Object['\x6b\x65\x79\x73'](LIFECYCLE_TOOL_SPECS)[_0x3be5a0(0xb1)](_0x5c8020=>_0x303b65['\x68\x61\x73'](_0x5c8020))['\x6d\x61\x70'](_0x2928a1=>LIFECYCLE_TOOL_SPECS[_0x2928a1]);}function anthropicLifecycleTools(_0x5da849,_0x27b843={}){const _0x42f0d2=a0_0x4608c9,_0x25d1ab={'\x4e\x6b\x65\x6a\x67':function(_0x1b2cc8,_0x5ac665){return _0x1b2cc8(_0x5ac665);},'\x4b\x66\x74\x4c\x4a':function(_0x35189f,_0x298512,_0x30282b){return _0x35189f(_0x298512,_0x30282b);}},_0x5a33bf=selectLifecycleSpecs(_0x27b843[_0x42f0d2(0x11a)]),_0x4f155a=_0x25d1ab[_0x42f0d2(0xb5)](buildLifecycleHandlers,_0x5a33bf,{'\x63\x6c\x69\x65\x6e\x74':_0x5da849});return{'\x74\x6f\x6f\x6c\x73':_0x5a33bf[_0x42f0d2(0x12b)](_0x4ce7c0=>({'\x6e\x61\x6d\x65':_0x4ce7c0['\x6e\x61\x6d\x65'],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x4ce7c0[_0x42f0d2(0xec)],'\x69\x6e\x70\x75\x74\x5f\x73\x63\x68\x65\x6d\x61':_0x4ce7c0[_0x42f0d2(0xc9)]})),async '\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x55\x73\x65'(_0x41e446){const _0x31c5fb=_0x42f0d2,_0x145846=_0x4f155a[_0x31c5fb(0x152)](_0x41e446[_0x31c5fb(0x144)]);if(!_0x145846)return{'\x74\x79\x70\x65':_0x31c5fb(0x141),'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x41e446['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x31c5fb(0xc1)+_0x41e446[_0x31c5fb(0x144)],'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};try{const _0x1c47f2=await _0x145846(_0x41e446[_0x31c5fb(0x122)]);return{'\x74\x79\x70\x65':_0x31c5fb(0x141),'\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x41e446['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x25d1ab[_0x31c5fb(0x12d)](serializeToolResult,_0x1c47f2)};}catch(_0x33a81b){return{'\x74\x79\x70\x65':'\x74\x6f\x6f\x6c\x5f\x72\x65\x73\x75\x6c\x74','\x74\x6f\x6f\x6c\x5f\x75\x73\x65\x5f\x69\x64':_0x41e446['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':_0x33a81b instanceof Error?_0x33a81b[_0x31c5fb(0xf6)]:_0x25d1ab[_0x31c5fb(0x12d)](String,_0x33a81b),'\x69\x73\x5f\x65\x72\x72\x6f\x72':!![]};}}};}function openaiLifecycleTools(_0x12b82d,_0x4b61b6={}){const _0x4355eb=a0_0x4608c9,_0x1f4638={'\x6d\x42\x47\x66\x7a':'\x74\x6f\x6f\x6c','\x68\x54\x72\x66\x52':_0x4355eb(0xb8),'\x43\x6c\x73\x61\x6d':function(_0x47c709,_0x345fff){return _0x47c709(_0x345fff);}},_0x463324=_0x1f4638['\x43\x6c\x73\x61\x6d'](selectLifecycleSpecs,_0x4b61b6[_0x4355eb(0x11a)]),_0x350413=buildLifecycleHandlers(_0x463324,{'\x63\x6c\x69\x65\x6e\x74':_0x12b82d});return{'\x74\x6f\x6f\x6c\x73':_0x463324[_0x4355eb(0x12b)](_0x1bfd0f=>({'\x74\x79\x70\x65':_0x4355eb(0xed),'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x1bfd0f[_0x4355eb(0x144)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x1bfd0f['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':_0x1bfd0f['\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61']}})),async '\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c'(_0x1c1db7){const _0x200c86=_0x4355eb,_0x265ad5=_0x350413[_0x200c86(0x152)](_0x1c1db7[_0x200c86(0xed)][_0x200c86(0x144)]);if(!_0x265ad5)return{'\x72\x6f\x6c\x65':_0x1f4638[_0x200c86(0x155)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x1c1db7['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON[_0x200c86(0x102)]({'\x65\x72\x72\x6f\x72':'\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\x6c\x69\x66\x65\x63\x79\x63\x6c\x65\x20\x74\x6f\x6f\x6c\x3a\x20'+_0x1c1db7[_0x200c86(0xed)]['\x6e\x61\x6d\x65']})};let _0x586bba={};try{const _0x163fa3=JSON[_0x200c86(0xc0)](_0x1c1db7[_0x200c86(0xed)][_0x200c86(0x10d)]||'\x7b\x7d');if(_0x163fa3&&typeof _0x163fa3===_0x1f4638['\x68\x54\x72\x66\x52'])_0x586bba=_0x163fa3;}catch{}try{const _0x26ec24=await _0x265ad5(_0x586bba);return{'\x72\x6f\x6c\x65':_0x1f4638[_0x200c86(0x155)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x1c1db7['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':serializeToolResult(_0x26ec24)};}catch(_0x2832b5){return{'\x72\x6f\x6c\x65':_0x200c86(0xbb),'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x1c1db7['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79']({'\x65\x72\x72\x6f\x72':_0x2832b5 instanceof Error?_0x2832b5['\x6d\x65\x73\x73\x61\x67\x65']:_0x1f4638[_0x200c86(0xc5)](String,_0x2832b5)})};}}};}function buildLifecycleHandlers(_0x35ce4d,_0x595019){const _0x4747af=new Map();for(const _0x1bcab8 of _0x35ce4d)_0x4747af['\x73\x65\x74'](_0x1bcab8['\x6e\x61\x6d\x65'],_0x1bcab8['\x6d\x61\x6b\x65\x48\x61\x6e\x64\x6c\x65\x72'](_0x595019));return _0x4747af;}async function mastraTools(_0x2fa40b,_0x1467b0={}){const _0xe4ba3e=a0_0x4608c9,_0x5366ca={'\x5a\x70\x53\x6c\x47':function(_0xee6121,_0xd1c5cc){return _0xee6121(_0xd1c5cc);}};let _0x42c899;try{_0x42c899=await import(_0xe4ba3e(0x110));}catch{throw new Error(_0xe4ba3e(0xef));}const _0x26cd53=selectSpecs(_0x1467b0[_0xe4ba3e(0x11a)]),_0x91e78e={'\x62\x6f\x78':_0x2fa40b,'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x1467b0['\x73\x65\x73\x73\x69\x6f\x6e\x49\x64']},_0x3cd036={};for(const _0x2fde0c of _0x26cd53){const _0x5a040d=_0x2fde0c[_0xe4ba3e(0x14a)](_0x91e78e);_0x3cd036[_0x2fde0c['\x6e\x61\x6d\x65']]=_0x42c899['\x63\x72\x65\x61\x74\x65\x54\x6f\x6f\x6c']({'\x69\x64':_0x2fde0c[_0xe4ba3e(0x144)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x2fde0c['\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e'],'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':_0x42c899['\x6a\x73\x6f\x6e\x53\x63\x68\x65\x6d\x61']?_0x42c899[_0xe4ba3e(0x11c)](_0x2fde0c['\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61']):_0x2fde0c[_0xe4ba3e(0xc9)],'\x65\x78\x65\x63\x75\x74\x65':async _0x36b9d4=>{const _0x3e72c0=_0xe4ba3e;return{'\x72\x65\x73\x75\x6c\x74':_0x5366ca['\x5a\x70\x53\x6c\x47'](serializeToolResult,await _0x5366ca[_0x3e72c0(0xd4)](_0x5a040d,_0x36b9d4?.['\x63\x6f\x6e\x74\x65\x78\x74']??{}))};}});}return _0x3cd036;}function openaiTools(_0x36bd91,_0x5078d9={}){const _0x185c1d=a0_0x4608c9,_0x3e4e33={'\x75\x49\x48\x6a\x4c':_0x185c1d(0xb8),'\x67\x53\x6f\x52\x65':function(_0x2ea7fb,_0x5acabc){return _0x2ea7fb!==_0x5acabc;},'\x48\x46\x6e\x46\x63':_0x185c1d(0xbb),'\x54\x76\x50\x49\x52':function(_0x3ed158,_0x5541e0){return _0x3ed158(_0x5541e0);},'\x67\x68\x6f\x66\x55':function(_0x172fcd,_0x49128c){return _0x172fcd instanceof _0x49128c;}},_0x67cc4d=_0x3e4e33[_0x185c1d(0x139)](selectSpecs,_0x5078d9[_0x185c1d(0x11a)]),_0x298789={'\x62\x6f\x78':_0x36bd91,'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x5078d9[_0x185c1d(0x12e)]},_0x44ddb0=new Map();for(const _0x34fce4 of _0x67cc4d)_0x44ddb0['\x73\x65\x74'](_0x34fce4[_0x185c1d(0x144)],_0x34fce4[_0x185c1d(0x14a)](_0x298789));const _0x3ce6c7=_0x67cc4d[_0x185c1d(0x12b)](_0x477aad=>({'\x74\x79\x70\x65':_0x185c1d(0xed),'\x66\x75\x6e\x63\x74\x69\x6f\x6e':{'\x6e\x61\x6d\x65':_0x477aad[_0x185c1d(0x144)],'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x477aad[_0x185c1d(0xec)],'\x70\x61\x72\x61\x6d\x65\x74\x65\x72\x73':_0x477aad[_0x185c1d(0xc9)]}}));function _0x257aa4(_0xe93e31){const _0x27f372=_0x185c1d;if(!_0xe93e31)return{};try{const _0x36f482=JSON[_0x27f372(0xc0)](_0xe93e31);return typeof _0x36f482===_0x3e4e33[_0x27f372(0x140)]&&_0x3e4e33[_0x27f372(0x145)](_0x36f482,null)?_0x36f482:{};}catch{return{};}}async function _0x1bb88d(_0x3c7fe0){const _0xfa579b=_0x185c1d,_0x1eea04=_0x44ddb0[_0xfa579b(0x152)](_0x3c7fe0[_0xfa579b(0xed)][_0xfa579b(0x144)]);if(!_0x1eea04)return{'\x72\x6f\x6c\x65':_0x3e4e33[_0xfa579b(0x134)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x3c7fe0['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON[_0xfa579b(0x102)]({'\x65\x72\x72\x6f\x72':_0xfa579b(0x137)+_0x3c7fe0[_0xfa579b(0xed)][_0xfa579b(0x144)]})};try{const _0x985b7c=await _0x1eea04(_0x3e4e33['\x54\x76\x50\x49\x52'](_0x257aa4,_0x3c7fe0[_0xfa579b(0xed)][_0xfa579b(0x10d)]));return{'\x72\x6f\x6c\x65':_0x3e4e33[_0xfa579b(0x134)],'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x3c7fe0['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':serializeToolResult(_0x985b7c)};}catch(_0x366ab4){return{'\x72\x6f\x6c\x65':_0xfa579b(0xbb),'\x74\x6f\x6f\x6c\x5f\x63\x61\x6c\x6c\x5f\x69\x64':_0x3c7fe0['\x69\x64'],'\x63\x6f\x6e\x74\x65\x6e\x74':JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79']({'\x65\x72\x72\x6f\x72':_0x3e4e33[_0xfa579b(0xdd)](_0x366ab4,Error)?_0x366ab4[_0xfa579b(0xf6)]:String(_0x366ab4)})};}}async function _0xa6ad37(_0xf6926b){const _0x5f4ff8=_0x185c1d,_0x409310=_0xf6926b[_0x5f4ff8(0x11b)]??[];return Promise['\x61\x6c\x6c'](_0x409310['\x6d\x61\x70'](_0x1bb88d));}return{'\x74\x6f\x6f\x6c\x73':_0x3ce6c7,'\x68\x61\x6e\x64\x6c\x65\x54\x6f\x6f\x6c\x43\x61\x6c\x6c':_0x1bb88d,'\x68\x61\x6e\x64\x6c\x65\x41\x73\x73\x69\x73\x74\x61\x6e\x74\x4d\x65\x73\x73\x61\x67\x65':_0xa6ad37};}async function vercelAiTools(_0x4deb71,_0x163d54={}){const _0x25b0d3=a0_0x4608c9,_0x10896b={'\x68\x6f\x73\x68\x61':function(_0x54652a,_0xbf5568){return _0x54652a(_0xbf5568);}};let _0x1605a1;try{_0x1605a1=await import('\x61\x69');}catch{throw new Error('\x76\x65\x72\x63\x65\x6c\x41\x69\x54\x6f\x6f\x6c\x73\x28\x29\x3a\x20\x74\x68\x65\x20\x60\x61\x69\x60\x20\x70\x61\x63\x6b\x61\x67\x65\x20\x69\x73\x20\x6e\x6f\x74\x20\x69\x6e\x73\x74\x61\x6c\x6c\x65\x64\x2e\x20\x49\x6e\x73\x74\x61\x6c\x6c\x20\x69\x74\x20\x76\x69\x61\x20\x60\x70\x6e\x70\x6d\x20\x61\x64\x64\x20\x61\x69\x60\x20\x28\x61\x6e\x64\x20\x70\x69\x63\x6b\x20\x61\x6e\x20\x60\x40\x61\x69\x2d\x73\x64\x6b\x2f\x2a\x60\x20\x6d\x6f\x64\x65\x6c\x20\x61\x64\x61\x70\x74\x65\x72\x29\x2e');}const _0x54dc14=selectSpecs(_0x163d54[_0x25b0d3(0x11a)]),_0x46835b={'\x62\x6f\x78':_0x4deb71,'\x73\x65\x73\x73\x69\x6f\x6e\x49\x64':_0x163d54[_0x25b0d3(0x12e)]},_0x541ce8={};for(const _0x221dfd of _0x54dc14){const _0x1a4b1a=_0x221dfd[_0x25b0d3(0x14a)](_0x46835b);_0x541ce8[_0x221dfd[_0x25b0d3(0x144)]]=_0x1605a1[_0x25b0d3(0xbb)]({'\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e':_0x221dfd[_0x25b0d3(0xec)],'\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61':_0x1605a1[_0x25b0d3(0x11c)](_0x221dfd['\x69\x6e\x70\x75\x74\x53\x63\x68\x65\x6d\x61']),'\x65\x78\x65\x63\x75\x74\x65':async _0x3a82aa=>{return serializeToolResult(await _0x10896b['\x68\x6f\x73\x68\x61'](_0x1a4b1a,_0x3a82aa));}});}return _0x541ce8;}export{ALL_FLEET_TOOL_SPECS,ALL_LIFECYCLE_TOOL_SPECS,ALL_TOOL_SPECS,FLEET_TOOL_SPECS,LIFECYCLE_TOOL_SPECS,TOOL_SPECS,anthropicFleetTools,anthropicLifecycleTools,anthropicTools,createMcpServer,mastraFleetTools,mastraTools,openaiFleetTools,openaiLifecycleTools,openaiTools,runCode,vercelAiFleetTools,vercelAiTools};
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
/**
|
|
3
|
+
* Keyed registry. `as const` preserves per-tool TArgs/TResult through the
|
|
4
|
+
* type system — `TOOL_SPECS.sandbox_run_code.makeHandler` returns a handler
|
|
5
|
+
* whose args parameter is the runCodeSpec's typed `{language, source, ...}`,
|
|
6
|
+
* not the erased `Record<string, unknown>` that an array-of-ToolSpec loses.
|
|
7
|
+
*
|
|
8
|
+
* Iteration order matches the order entries are declared here (V8 preserves
|
|
9
|
+
* string-key insertion order), so the public surface is stable.
|
|
10
|
+
*/
|
|
11
|
+
const TOOL_SPECS = {
|
|
12
|
+
sandbox_run_code: {
|
|
13
|
+
name: "sandbox_run_code",
|
|
14
|
+
description: "Execute code in a persistent language kernel inside the sandbox. Variables persist across calls with the same session. Returns stdout, stderr, exit code, and a typed `results` array containing matplotlib figures (base64 PNG), pandas DataFrames, JSON via display(), or errors. Prefer this over sandbox_exec for any code that needs structured output.",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
language: {
|
|
19
|
+
type: "string",
|
|
20
|
+
enum: [
|
|
21
|
+
"python",
|
|
22
|
+
"node",
|
|
23
|
+
"typescript",
|
|
24
|
+
"bash"
|
|
25
|
+
],
|
|
26
|
+
description: "Kernel language."
|
|
27
|
+
},
|
|
28
|
+
source: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Source code to run. Multi-line supported."
|
|
31
|
+
},
|
|
32
|
+
timeout_ms: {
|
|
33
|
+
type: "number",
|
|
34
|
+
description: "Per-call timeout. 0 disables. Default 60000."
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
required: ["language", "source"],
|
|
38
|
+
additionalProperties: false
|
|
39
|
+
},
|
|
40
|
+
makeHandler: ({ box, sessionId }) => async (args) => {
|
|
41
|
+
return await box.runCode(args.language, args.source, {
|
|
42
|
+
sessionId,
|
|
43
|
+
timeoutMs: args.timeout_ms
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
sandbox_exec: {
|
|
48
|
+
name: "sandbox_exec",
|
|
49
|
+
description: "Run a shell command (no persistent state) in the sandbox. Use for one-shot tasks like 'pnpm install' or 'ls'. For code that should share state across calls, prefer sandbox_run_code with a sessionId.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
command: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Shell command line."
|
|
56
|
+
},
|
|
57
|
+
cwd: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Working directory. Optional."
|
|
60
|
+
},
|
|
61
|
+
timeout_ms: {
|
|
62
|
+
type: "number",
|
|
63
|
+
description: "Default 60000."
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
required: ["command"],
|
|
67
|
+
additionalProperties: false
|
|
68
|
+
},
|
|
69
|
+
makeHandler: ({ box, sessionId }) => async (args) => {
|
|
70
|
+
return await box.exec(args.command, {
|
|
71
|
+
cwd: args.cwd,
|
|
72
|
+
timeoutMs: args.timeout_ms,
|
|
73
|
+
sessionId
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
sandbox_read: {
|
|
78
|
+
name: "sandbox_read",
|
|
79
|
+
description: "Read a file from the sandbox filesystem. Relative paths resolve from the workspace root; absolute paths read the container filesystem directly.",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: "object",
|
|
82
|
+
properties: { path: { type: "string" } },
|
|
83
|
+
required: ["path"],
|
|
84
|
+
additionalProperties: false
|
|
85
|
+
},
|
|
86
|
+
makeHandler: ({ box, sessionId }) => async (args) => {
|
|
87
|
+
return { content: await box.read(args.path, { sessionId }) };
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
sandbox_write: {
|
|
91
|
+
name: "sandbox_write",
|
|
92
|
+
description: "Write a file in the sandbox. Creates parent directories as needed. Overwrites existing files.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
path: { type: "string" },
|
|
97
|
+
content: {
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "Full file contents."
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
required: ["path", "content"],
|
|
103
|
+
additionalProperties: false
|
|
104
|
+
},
|
|
105
|
+
makeHandler: ({ box }) => async (args) => {
|
|
106
|
+
await box.write(args.path, args.content);
|
|
107
|
+
return { ok: true };
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
sandbox_list: {
|
|
111
|
+
name: "sandbox_list",
|
|
112
|
+
description: "List entries in a directory with size, type, and mode.",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: { path: { type: "string" } },
|
|
116
|
+
required: ["path"],
|
|
117
|
+
additionalProperties: false
|
|
118
|
+
},
|
|
119
|
+
makeHandler: ({ box }) => async (args) => {
|
|
120
|
+
return { entries: await box.fs.list(args.path) };
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
sandbox_search: {
|
|
124
|
+
name: "sandbox_search",
|
|
125
|
+
description: "Ripgrep-style code search. Returns matching lines with surrounding context.",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
pattern: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "Regex pattern."
|
|
132
|
+
},
|
|
133
|
+
path: {
|
|
134
|
+
type: "string",
|
|
135
|
+
description: "Subdirectory to search. Optional."
|
|
136
|
+
},
|
|
137
|
+
max_results: {
|
|
138
|
+
type: "number",
|
|
139
|
+
description: "Cap. Default 100."
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
required: ["pattern"],
|
|
143
|
+
additionalProperties: false
|
|
144
|
+
},
|
|
145
|
+
makeHandler: ({ box }) => async (args) => {
|
|
146
|
+
const matches = [];
|
|
147
|
+
const cap = args.max_results ?? 100;
|
|
148
|
+
for await (const m of box.search(args.pattern, {
|
|
149
|
+
cwd: args.path,
|
|
150
|
+
maxResults: cap
|
|
151
|
+
})) {
|
|
152
|
+
matches.push(m);
|
|
153
|
+
if (matches.length >= cap) break;
|
|
154
|
+
}
|
|
155
|
+
return { matches };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/** Canonical ordered list. Packs use this to emit tools in a stable order. */
|
|
160
|
+
const ALL_TOOL_SPECS = Object.values(TOOL_SPECS);
|
|
161
|
+
/** Pack-side helper: filter the registry by an optional allow-list. */
|
|
162
|
+
function selectSpecs(allow) {
|
|
163
|
+
if (!allow || allow.length === 0) return ALL_TOOL_SPECS;
|
|
164
|
+
const set = new Set(allow);
|
|
165
|
+
return Object.keys(TOOL_SPECS).filter((name) => set.has(name)).map((name) => TOOL_SPECS[name]);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Best-effort serialization of a tool handler's return value into a string
|
|
169
|
+
* tool-result payload. Each pack uses this when its target API expects a
|
|
170
|
+
* string `content` field; packs that support structured content (Anthropic
|
|
171
|
+
* multi-block) can opt out and serialize differently.
|
|
172
|
+
*
|
|
173
|
+
* `CodeExecutionResult` is serialized as JSON because the LLM benefits from
|
|
174
|
+
* seeing the structured results array; images come through as base64 strings
|
|
175
|
+
* which the model can read or hand back to the user.
|
|
176
|
+
*/
|
|
177
|
+
function serializeToolResult(value) {
|
|
178
|
+
if (typeof value === "string") return value;
|
|
179
|
+
try {
|
|
180
|
+
return JSON.stringify(value, null, 2);
|
|
181
|
+
} catch {
|
|
182
|
+
return String(value);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/agent/mcp-local.ts
|
|
187
|
+
/**
|
|
188
|
+
* Local MCP (Model Context Protocol) server bridge.
|
|
189
|
+
*
|
|
190
|
+
* `createMcpServer(box, { allow })` returns an MCP `Server` instance wired
|
|
191
|
+
* with the same tool registry the framework packs use. Pair it with a
|
|
192
|
+
* transport (most commonly stdio) and your sandbox becomes a paste-able
|
|
193
|
+
* MCP source for Claude Desktop, Cursor, Zed, or any other MCP client.
|
|
194
|
+
*
|
|
195
|
+
* Complements `box.getMcpEndpoint()` — that returns a hosted HTTPS+JWT MCP
|
|
196
|
+
* URL for users who can expose one; this gives users a fully local server
|
|
197
|
+
* that runs inside their own process.
|
|
198
|
+
*
|
|
199
|
+
* `@modelcontextprotocol/sdk` is dynamically imported (optional peer dep).
|
|
200
|
+
* Install in your app:
|
|
201
|
+
* pnpm add @modelcontextprotocol/sdk
|
|
202
|
+
*/
|
|
203
|
+
const SDK_VERSION = (() => {
|
|
204
|
+
try {
|
|
205
|
+
return createRequire(import.meta.url)("../../package.json").version ?? "0.0.0";
|
|
206
|
+
} catch {
|
|
207
|
+
return "0.0.0";
|
|
208
|
+
}
|
|
209
|
+
})();
|
|
210
|
+
/**
|
|
211
|
+
* Build an MCP server backed by one sandbox. The server registers
|
|
212
|
+
* `tools/list` and `tools/call` handlers populated from the same registry
|
|
213
|
+
* the framework packs use.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* // tangle-mcp-server.ts — used as the command in your MCP client config.
|
|
218
|
+
* import { Sandbox } from "@tangle-network/sandbox";
|
|
219
|
+
* import { createMcpServer } from "@tangle-network/sandbox/agent";
|
|
220
|
+
* import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
221
|
+
*
|
|
222
|
+
* const client = new Sandbox({ apiKey: process.env.TANGLE_API_KEY });
|
|
223
|
+
* const box = await client.get(process.env.SANDBOX_ID!);
|
|
224
|
+
* const { connect } = await createMcpServer(box, { sessionId: "claude-desktop" });
|
|
225
|
+
* await connect(new StdioServerTransport());
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* Claude Desktop config snippet:
|
|
229
|
+
* ```json
|
|
230
|
+
* {
|
|
231
|
+
* "mcpServers": {
|
|
232
|
+
* "tangle-sandbox": {
|
|
233
|
+
* "command": "node",
|
|
234
|
+
* "args": ["./tangle-mcp-server.js"],
|
|
235
|
+
* "env": { "TANGLE_API_KEY": "...", "SANDBOX_ID": "..." }
|
|
236
|
+
* }
|
|
237
|
+
* }
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
async function createMcpServer(box, options = {}) {
|
|
242
|
+
let serverModule;
|
|
243
|
+
let typesModule;
|
|
244
|
+
try {
|
|
245
|
+
[serverModule, typesModule] = await Promise.all([import("@modelcontextprotocol/sdk/server/index.js"), import("@modelcontextprotocol/sdk/types.js")]);
|
|
246
|
+
} catch {
|
|
247
|
+
throw new Error("createMcpServer(): the `@modelcontextprotocol/sdk` package is not installed. Install it via `pnpm add @modelcontextprotocol/sdk`.");
|
|
248
|
+
}
|
|
249
|
+
const specs = selectSpecs(options.allow);
|
|
250
|
+
const ctx = {
|
|
251
|
+
box,
|
|
252
|
+
sessionId: options.sessionId
|
|
253
|
+
};
|
|
254
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
255
|
+
for (const spec of specs) handlers.set(spec.name, spec.makeHandler(ctx));
|
|
256
|
+
const server = new serverModule.Server({
|
|
257
|
+
name: options.name ?? "tangle-sandbox",
|
|
258
|
+
version: options.version ?? SDK_VERSION
|
|
259
|
+
}, { capabilities: { tools: {} } });
|
|
260
|
+
server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: specs.map((s) => ({
|
|
261
|
+
name: s.name,
|
|
262
|
+
description: s.description,
|
|
263
|
+
inputSchema: s.inputSchema
|
|
264
|
+
})) }));
|
|
265
|
+
server.setRequestHandler(typesModule.CallToolRequestSchema, async (req) => {
|
|
266
|
+
const r = req;
|
|
267
|
+
const handler = handlers.get(r.params.name);
|
|
268
|
+
if (!handler) return {
|
|
269
|
+
isError: true,
|
|
270
|
+
content: [{
|
|
271
|
+
type: "text",
|
|
272
|
+
text: `Unknown tool: ${r.params.name}`
|
|
273
|
+
}]
|
|
274
|
+
};
|
|
275
|
+
try {
|
|
276
|
+
return { content: [{
|
|
277
|
+
type: "text",
|
|
278
|
+
text: serializeToolResult(await handler(r.params.arguments ?? {}))
|
|
279
|
+
}] };
|
|
280
|
+
} catch (err) {
|
|
281
|
+
return {
|
|
282
|
+
isError: true,
|
|
283
|
+
content: [{
|
|
284
|
+
type: "text",
|
|
285
|
+
text: err instanceof Error ? err.message : String(err)
|
|
286
|
+
}]
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
return {
|
|
291
|
+
server,
|
|
292
|
+
connect: (transport) => server.connect(transport),
|
|
293
|
+
close: () => server.close()
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/agent/run-code.ts
|
|
298
|
+
/**
|
|
299
|
+
* Functional form of `box.runCode(...)`. Useful when only the function is in
|
|
300
|
+
* scope (e.g., when wiring into a framework tool definition that captures
|
|
301
|
+
* the callable but not the surrounding instance).
|
|
302
|
+
*
|
|
303
|
+
* Identical semantics to {@link SandboxInstance.runCode}.
|
|
304
|
+
*/
|
|
305
|
+
function runCode(box, language, source, options) {
|
|
306
|
+
return box.runCode(language, source, options);
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/agent/tools/anthropic.ts
|
|
310
|
+
/**
|
|
311
|
+
* Build an Anthropic tool pack bound to one sandbox.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* import Anthropic from "@anthropic-ai/sdk";
|
|
316
|
+
* import { anthropicTools } from "@tangle-network/sandbox/agent";
|
|
317
|
+
*
|
|
318
|
+
* const claude = new Anthropic();
|
|
319
|
+
* const { tools, handleAssistantMessage } = anthropicTools(box, { sessionId: "s1" });
|
|
320
|
+
*
|
|
321
|
+
* const messages = [{ role: "user", content: "Plot sin(x) for x in [0, 2π]." }];
|
|
322
|
+
* for (let i = 0; i < 6; i++) {
|
|
323
|
+
* const r = await claude.messages.create({
|
|
324
|
+
* model: "claude-opus-4-7",
|
|
325
|
+
* max_tokens: 4096,
|
|
326
|
+
* tools,
|
|
327
|
+
* messages,
|
|
328
|
+
* });
|
|
329
|
+
* messages.push({ role: "assistant", content: r.content });
|
|
330
|
+
* if (r.stop_reason !== "tool_use") break;
|
|
331
|
+
* const results = await handleAssistantMessage(r.content);
|
|
332
|
+
* messages.push({ role: "user", content: results });
|
|
333
|
+
* }
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
function anthropicTools(box, options = {}) {
|
|
337
|
+
const specs = selectSpecs(options.allow);
|
|
338
|
+
const ctx = {
|
|
339
|
+
box,
|
|
340
|
+
sessionId: options.sessionId
|
|
341
|
+
};
|
|
342
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
343
|
+
for (const spec of specs) handlers.set(spec.name, spec.makeHandler(ctx));
|
|
344
|
+
const tools = specs.map((s) => ({
|
|
345
|
+
name: s.name,
|
|
346
|
+
description: s.description,
|
|
347
|
+
input_schema: s.inputSchema
|
|
348
|
+
}));
|
|
349
|
+
async function handleToolUse(block) {
|
|
350
|
+
const handler = handlers.get(block.name);
|
|
351
|
+
if (!handler) return {
|
|
352
|
+
type: "tool_result",
|
|
353
|
+
tool_use_id: block.id,
|
|
354
|
+
content: `Unknown tool: ${block.name}`,
|
|
355
|
+
is_error: true
|
|
356
|
+
};
|
|
357
|
+
try {
|
|
358
|
+
const result = await handler(block.input);
|
|
359
|
+
return {
|
|
360
|
+
type: "tool_result",
|
|
361
|
+
tool_use_id: block.id,
|
|
362
|
+
content: toAnthropicContent(result)
|
|
363
|
+
};
|
|
364
|
+
} catch (err) {
|
|
365
|
+
return {
|
|
366
|
+
type: "tool_result",
|
|
367
|
+
tool_use_id: block.id,
|
|
368
|
+
content: err instanceof Error ? err.message : String(err),
|
|
369
|
+
is_error: true
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
async function handleAssistantMessage(content) {
|
|
374
|
+
const calls = content.filter((b) => typeof b === "object" && b !== null && b.type === "tool_use");
|
|
375
|
+
return Promise.all(calls.map(handleToolUse));
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
tools,
|
|
379
|
+
handleToolUse,
|
|
380
|
+
handleAssistantMessage
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Serialize a tool handler's return value into Anthropic content blocks.
|
|
385
|
+
* If the result is a `CodeExecutionResult` carrying image parts, those land
|
|
386
|
+
* as native `image` blocks (base64, no JSON-stringify overhead). Everything
|
|
387
|
+
* else (and the non-image fields of the result) collapses to a single text
|
|
388
|
+
* block via `serializeToolResult` so the model sees a stable shape.
|
|
389
|
+
*/
|
|
390
|
+
function toAnthropicContent(value) {
|
|
391
|
+
if (!isCodeExecutionResultWithImages(value)) return serializeToolResult(value);
|
|
392
|
+
const blocks = [];
|
|
393
|
+
const trimmed = {
|
|
394
|
+
...value,
|
|
395
|
+
results: value.results.filter((p) => p.type !== "image")
|
|
396
|
+
};
|
|
397
|
+
blocks.push({
|
|
398
|
+
type: "text",
|
|
399
|
+
text: serializeToolResult(trimmed)
|
|
400
|
+
});
|
|
401
|
+
for (const p of value.results) if (isImagePart(p)) blocks.push({
|
|
402
|
+
type: "image",
|
|
403
|
+
source: {
|
|
404
|
+
type: "base64",
|
|
405
|
+
media_type: imageMediaType(p.format),
|
|
406
|
+
data: p.data
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
return blocks;
|
|
410
|
+
}
|
|
411
|
+
function isImagePart(p) {
|
|
412
|
+
return p.type === "image";
|
|
413
|
+
}
|
|
414
|
+
function isCodeExecutionResultWithImages(v) {
|
|
415
|
+
if (!v || typeof v !== "object") return false;
|
|
416
|
+
const r = v.results;
|
|
417
|
+
if (!Array.isArray(r)) return false;
|
|
418
|
+
return r.some((p) => p && typeof p === "object" && p.type === "image");
|
|
419
|
+
}
|
|
420
|
+
function imageMediaType(format) {
|
|
421
|
+
switch (format) {
|
|
422
|
+
case "png": return "image/png";
|
|
423
|
+
case "jpeg": return "image/jpeg";
|
|
424
|
+
case "svg": return "image/png";
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const FLEET_TOOL_SPECS = {
|
|
428
|
+
sandbox_fleet_spawn: {
|
|
429
|
+
name: "sandbox_fleet_spawn",
|
|
430
|
+
description: "Spawn a fleet of N sandboxes from a template, with a coordinator plus N workers sharing a workspace. Returns the fleet id and the machine ids. Each worker has its own persistent code-execution kernel; the same workspace is mounted across them. COSTS SCALE LINEARLY with `workers`. Use sandbox_fleet_destroy when done.",
|
|
431
|
+
inputSchema: {
|
|
432
|
+
type: "object",
|
|
433
|
+
properties: {
|
|
434
|
+
template_id: {
|
|
435
|
+
type: "string",
|
|
436
|
+
description: "Public template slug or id (e.g. 'python-data-science')."
|
|
437
|
+
},
|
|
438
|
+
workers: {
|
|
439
|
+
type: "number",
|
|
440
|
+
description: "Number of worker sandboxes. Each is billed independently."
|
|
441
|
+
},
|
|
442
|
+
metadata: {
|
|
443
|
+
type: "object",
|
|
444
|
+
properties: {},
|
|
445
|
+
additionalProperties: true,
|
|
446
|
+
description: "Optional metadata stamped on every fleet member."
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
required: ["template_id", "workers"],
|
|
450
|
+
additionalProperties: false
|
|
451
|
+
},
|
|
452
|
+
makeHandler: ({ client }) => async (args) => {
|
|
453
|
+
const fleet = await client.fleets.createWithCoordinator({
|
|
454
|
+
defaults: { publicTemplateId: args.template_id },
|
|
455
|
+
workers: Array.from({ length: args.workers }, (_, i) => ({ machineId: `worker-${i}` })),
|
|
456
|
+
metadata: args.metadata
|
|
457
|
+
});
|
|
458
|
+
return {
|
|
459
|
+
fleetId: fleet.fleetId,
|
|
460
|
+
machineIds: fleet.ids
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
sandbox_fleet_dispatch: {
|
|
465
|
+
name: "sandbox_fleet_dispatch",
|
|
466
|
+
description: "Run a shell command on a fleet's workers in parallel. Defaults to all workers; pass `machines` to target specific ones. Returns per-machine {ok, result?, error?} entries.",
|
|
467
|
+
inputSchema: {
|
|
468
|
+
type: "object",
|
|
469
|
+
properties: {
|
|
470
|
+
fleet_id: { type: "string" },
|
|
471
|
+
command: {
|
|
472
|
+
type: "string",
|
|
473
|
+
description: "Shell command line."
|
|
474
|
+
},
|
|
475
|
+
machines: {
|
|
476
|
+
type: "array",
|
|
477
|
+
items: { type: "string" },
|
|
478
|
+
description: "Optional subset of machine ids. Defaults to all workers."
|
|
479
|
+
},
|
|
480
|
+
timeout_ms: {
|
|
481
|
+
type: "number",
|
|
482
|
+
description: "Per-machine timeout. Default 60000."
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
required: ["fleet_id", "command"],
|
|
486
|
+
additionalProperties: false
|
|
487
|
+
},
|
|
488
|
+
makeHandler: ({ client }) => async (args) => {
|
|
489
|
+
return await (await client.fleets.list({ fleetId: args.fleet_id })).dispatchExec(args.command, {
|
|
490
|
+
machines: args.machines,
|
|
491
|
+
timeoutMs: args.timeout_ms
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
sandbox_fleet_status: {
|
|
496
|
+
name: "sandbox_fleet_status",
|
|
497
|
+
description: "List the fleet's machines and their per-machine state (running / stopped / failed) plus last-used timestamps.",
|
|
498
|
+
inputSchema: {
|
|
499
|
+
type: "object",
|
|
500
|
+
properties: { fleet_id: { type: "string" } },
|
|
501
|
+
required: ["fleet_id"],
|
|
502
|
+
additionalProperties: false
|
|
503
|
+
},
|
|
504
|
+
makeHandler: ({ client }) => async (args) => {
|
|
505
|
+
const fleet = await client.fleets.list({ fleetId: args.fleet_id });
|
|
506
|
+
return {
|
|
507
|
+
fleetId: fleet.fleetId,
|
|
508
|
+
machines: fleet.ids.map((machineId) => ({
|
|
509
|
+
machineId,
|
|
510
|
+
status: fleet.get(machineId).status
|
|
511
|
+
}))
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
sandbox_fleet_destroy: {
|
|
516
|
+
name: "sandbox_fleet_destroy",
|
|
517
|
+
description: "Delete the fleet and every machine in it. Stops billing immediately. Call this when the campaign is done; orphaned fleets keep burning credits.",
|
|
518
|
+
inputSchema: {
|
|
519
|
+
type: "object",
|
|
520
|
+
properties: {
|
|
521
|
+
fleet_id: { type: "string" },
|
|
522
|
+
continue_on_error: {
|
|
523
|
+
type: "boolean",
|
|
524
|
+
description: "Continue deleting remaining machines if one fails."
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
required: ["fleet_id"],
|
|
528
|
+
additionalProperties: false
|
|
529
|
+
},
|
|
530
|
+
makeHandler: ({ client }) => async (args) => {
|
|
531
|
+
await (await client.fleets.list({ fleetId: args.fleet_id })).delete({ continueOnError: args.continue_on_error });
|
|
532
|
+
return {
|
|
533
|
+
fleetId: args.fleet_id,
|
|
534
|
+
deleted: true
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
const ALL_FLEET_TOOL_SPECS = Object.values(FLEET_TOOL_SPECS);
|
|
540
|
+
function selectFleetSpecs(allow) {
|
|
541
|
+
if (!allow || allow.length === 0) return ALL_FLEET_TOOL_SPECS;
|
|
542
|
+
const set = new Set(allow);
|
|
543
|
+
return Object.keys(FLEET_TOOL_SPECS).filter((name) => set.has(name)).map((name) => FLEET_TOOL_SPECS[name]);
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/agent/tools/fleet/index.ts
|
|
547
|
+
function anthropicFleetTools(client, options = {}) {
|
|
548
|
+
const specs = selectFleetSpecs(options.allow);
|
|
549
|
+
const handlers = buildFleetHandlers(specs, { client });
|
|
550
|
+
return {
|
|
551
|
+
tools: specs.map((s) => ({
|
|
552
|
+
name: s.name,
|
|
553
|
+
description: s.description,
|
|
554
|
+
input_schema: s.inputSchema
|
|
555
|
+
})),
|
|
556
|
+
async handleToolUse(block) {
|
|
557
|
+
const h = handlers.get(block.name);
|
|
558
|
+
if (!h) return {
|
|
559
|
+
type: "tool_result",
|
|
560
|
+
tool_use_id: block.id,
|
|
561
|
+
content: `Unknown fleet tool: ${block.name}`,
|
|
562
|
+
is_error: true
|
|
563
|
+
};
|
|
564
|
+
try {
|
|
565
|
+
const result = await h(block.input);
|
|
566
|
+
return {
|
|
567
|
+
type: "tool_result",
|
|
568
|
+
tool_use_id: block.id,
|
|
569
|
+
content: serializeToolResult(result)
|
|
570
|
+
};
|
|
571
|
+
} catch (err) {
|
|
572
|
+
return {
|
|
573
|
+
type: "tool_result",
|
|
574
|
+
tool_use_id: block.id,
|
|
575
|
+
content: err instanceof Error ? err.message : String(err),
|
|
576
|
+
is_error: true
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function openaiFleetTools(client, options = {}) {
|
|
583
|
+
const specs = selectFleetSpecs(options.allow);
|
|
584
|
+
const handlers = buildFleetHandlers(specs, { client });
|
|
585
|
+
return {
|
|
586
|
+
tools: specs.map((s) => ({
|
|
587
|
+
type: "function",
|
|
588
|
+
function: {
|
|
589
|
+
name: s.name,
|
|
590
|
+
description: s.description,
|
|
591
|
+
parameters: s.inputSchema
|
|
592
|
+
}
|
|
593
|
+
})),
|
|
594
|
+
async handleToolCall(call) {
|
|
595
|
+
const h = handlers.get(call.function.name);
|
|
596
|
+
if (!h) return {
|
|
597
|
+
role: "tool",
|
|
598
|
+
tool_call_id: call.id,
|
|
599
|
+
content: JSON.stringify({ error: `Unknown fleet tool: ${call.function.name}` })
|
|
600
|
+
};
|
|
601
|
+
let args = {};
|
|
602
|
+
try {
|
|
603
|
+
const v = JSON.parse(call.function.arguments || "{}");
|
|
604
|
+
if (v && typeof v === "object") args = v;
|
|
605
|
+
} catch {}
|
|
606
|
+
try {
|
|
607
|
+
const result = await h(args);
|
|
608
|
+
return {
|
|
609
|
+
role: "tool",
|
|
610
|
+
tool_call_id: call.id,
|
|
611
|
+
content: serializeToolResult(result)
|
|
612
|
+
};
|
|
613
|
+
} catch (err) {
|
|
614
|
+
return {
|
|
615
|
+
role: "tool",
|
|
616
|
+
tool_call_id: call.id,
|
|
617
|
+
content: JSON.stringify({ error: err instanceof Error ? err.message : String(err) })
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
async function vercelAiFleetTools(client, options = {}) {
|
|
624
|
+
let ai;
|
|
625
|
+
try {
|
|
626
|
+
ai = await import("ai");
|
|
627
|
+
} catch {
|
|
628
|
+
throw new Error("vercelAiFleetTools(): the `ai` package is not installed. Install via `pnpm add ai`.");
|
|
629
|
+
}
|
|
630
|
+
const specs = selectFleetSpecs(options.allow);
|
|
631
|
+
const handlers = buildFleetHandlers(specs, { client });
|
|
632
|
+
const result = {};
|
|
633
|
+
for (const spec of specs) result[spec.name] = ai.tool({
|
|
634
|
+
description: spec.description,
|
|
635
|
+
inputSchema: ai.jsonSchema(spec.inputSchema),
|
|
636
|
+
execute: async (args) => {
|
|
637
|
+
const h = handlers.get(spec.name);
|
|
638
|
+
if (!h) throw new Error(`Unknown fleet tool: ${spec.name}`);
|
|
639
|
+
return serializeToolResult(await h(args));
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
async function mastraFleetTools(client, options = {}) {
|
|
645
|
+
let mastra;
|
|
646
|
+
try {
|
|
647
|
+
mastra = await import("@mastra/core");
|
|
648
|
+
} catch {
|
|
649
|
+
throw new Error("mastraFleetTools(): the `@mastra/core` package is not installed. Install via `pnpm add @mastra/core`.");
|
|
650
|
+
}
|
|
651
|
+
const specs = selectFleetSpecs(options.allow);
|
|
652
|
+
const handlers = buildFleetHandlers(specs, { client });
|
|
653
|
+
const result = {};
|
|
654
|
+
for (const spec of specs) result[spec.name] = mastra.createTool({
|
|
655
|
+
id: spec.name,
|
|
656
|
+
description: spec.description,
|
|
657
|
+
inputSchema: mastra.jsonSchema ? mastra.jsonSchema(spec.inputSchema) : spec.inputSchema,
|
|
658
|
+
execute: async (input) => {
|
|
659
|
+
const h = handlers.get(spec.name);
|
|
660
|
+
if (!h) throw new Error(`Unknown fleet tool: ${spec.name}`);
|
|
661
|
+
return { result: serializeToolResult(await h(input?.context ?? {})) };
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
return result;
|
|
665
|
+
}
|
|
666
|
+
function buildFleetHandlers(specs, ctx) {
|
|
667
|
+
const m = /* @__PURE__ */ new Map();
|
|
668
|
+
for (const spec of specs) m.set(spec.name, spec.makeHandler(ctx));
|
|
669
|
+
return m;
|
|
670
|
+
}
|
|
671
|
+
const LIFECYCLE_TOOL_SPECS = {
|
|
672
|
+
sandbox_create: {
|
|
673
|
+
name: "sandbox_create",
|
|
674
|
+
description: "Create an isolated sandbox environment and return its id for use with sandbox_run_command. Use this when the user needs code executed, files analyzed, or commands run in a secure environment. The sandbox BILLS until destroyed — call sandbox_destroy when the work is done.",
|
|
675
|
+
inputSchema: {
|
|
676
|
+
type: "object",
|
|
677
|
+
properties: {
|
|
678
|
+
environment: {
|
|
679
|
+
type: "string",
|
|
680
|
+
description: "Environment name (e.g. 'universal' for multi-language Node/Python). Default 'universal'."
|
|
681
|
+
},
|
|
682
|
+
name: {
|
|
683
|
+
type: "string",
|
|
684
|
+
description: "Optional display name for the sandbox."
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
required: [],
|
|
688
|
+
additionalProperties: false
|
|
689
|
+
},
|
|
690
|
+
makeHandler: ({ client }) => async (args) => {
|
|
691
|
+
const box = await client.create({
|
|
692
|
+
environment: args.environment ?? "universal",
|
|
693
|
+
name: args.name
|
|
694
|
+
});
|
|
695
|
+
return {
|
|
696
|
+
sandboxId: box.id,
|
|
697
|
+
status: box.status
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
sandbox_run_command: {
|
|
702
|
+
name: "sandbox_run_command",
|
|
703
|
+
description: "Execute a shell command in a previously created sandbox and return {stdout, stderr, exitCode}. The sandbox must exist — create it first with sandbox_create.",
|
|
704
|
+
inputSchema: {
|
|
705
|
+
type: "object",
|
|
706
|
+
properties: {
|
|
707
|
+
sandbox_id: {
|
|
708
|
+
type: "string",
|
|
709
|
+
description: "Id returned by sandbox_create."
|
|
710
|
+
},
|
|
711
|
+
command: {
|
|
712
|
+
type: "string",
|
|
713
|
+
description: "Shell command line."
|
|
714
|
+
},
|
|
715
|
+
cwd: {
|
|
716
|
+
type: "string",
|
|
717
|
+
description: "Optional working directory for the command."
|
|
718
|
+
},
|
|
719
|
+
timeout_ms: {
|
|
720
|
+
type: "number",
|
|
721
|
+
description: "Timeout in milliseconds. Default 60000."
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
required: ["sandbox_id", "command"],
|
|
725
|
+
additionalProperties: false
|
|
726
|
+
},
|
|
727
|
+
makeHandler: ({ client }) => async (args) => {
|
|
728
|
+
const box = await client.get(args.sandbox_id);
|
|
729
|
+
if (!box) throw new Error(`Sandbox ${args.sandbox_id} not found. Create it first with sandbox_create.`);
|
|
730
|
+
const result = await box.exec(args.command, {
|
|
731
|
+
cwd: args.cwd,
|
|
732
|
+
timeoutMs: args.timeout_ms ?? 6e4
|
|
733
|
+
});
|
|
734
|
+
return {
|
|
735
|
+
stdout: result.stdout,
|
|
736
|
+
stderr: result.stderr,
|
|
737
|
+
exitCode: result.exitCode
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
sandbox_destroy: {
|
|
742
|
+
name: "sandbox_destroy",
|
|
743
|
+
description: "Delete a sandbox created with sandbox_create. Stops billing immediately. Call this once the sandboxed work is finished; orphaned sandboxes keep accruing cost.",
|
|
744
|
+
inputSchema: {
|
|
745
|
+
type: "object",
|
|
746
|
+
properties: { sandbox_id: {
|
|
747
|
+
type: "string",
|
|
748
|
+
description: "Id returned by sandbox_create."
|
|
749
|
+
} },
|
|
750
|
+
required: ["sandbox_id"],
|
|
751
|
+
additionalProperties: false
|
|
752
|
+
},
|
|
753
|
+
makeHandler: ({ client }) => async (args) => {
|
|
754
|
+
const box = await client.get(args.sandbox_id);
|
|
755
|
+
if (!box) return {
|
|
756
|
+
sandboxId: args.sandbox_id,
|
|
757
|
+
deleted: true
|
|
758
|
+
};
|
|
759
|
+
await box.delete();
|
|
760
|
+
return {
|
|
761
|
+
sandboxId: args.sandbox_id,
|
|
762
|
+
deleted: true
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
const ALL_LIFECYCLE_TOOL_SPECS = Object.values(LIFECYCLE_TOOL_SPECS);
|
|
768
|
+
function selectLifecycleSpecs(allow) {
|
|
769
|
+
if (!allow || allow.length === 0) return ALL_LIFECYCLE_TOOL_SPECS;
|
|
770
|
+
const set = new Set(allow);
|
|
771
|
+
return Object.keys(LIFECYCLE_TOOL_SPECS).filter((name) => set.has(name)).map((name) => LIFECYCLE_TOOL_SPECS[name]);
|
|
772
|
+
}
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region src/agent/tools/lifecycle/index.ts
|
|
775
|
+
function anthropicLifecycleTools(client, options = {}) {
|
|
776
|
+
const specs = selectLifecycleSpecs(options.allow);
|
|
777
|
+
const handlers = buildLifecycleHandlers(specs, { client });
|
|
778
|
+
return {
|
|
779
|
+
tools: specs.map((s) => ({
|
|
780
|
+
name: s.name,
|
|
781
|
+
description: s.description,
|
|
782
|
+
input_schema: s.inputSchema
|
|
783
|
+
})),
|
|
784
|
+
async handleToolUse(block) {
|
|
785
|
+
const h = handlers.get(block.name);
|
|
786
|
+
if (!h) return {
|
|
787
|
+
type: "tool_result",
|
|
788
|
+
tool_use_id: block.id,
|
|
789
|
+
content: `Unknown lifecycle tool: ${block.name}`,
|
|
790
|
+
is_error: true
|
|
791
|
+
};
|
|
792
|
+
try {
|
|
793
|
+
const result = await h(block.input);
|
|
794
|
+
return {
|
|
795
|
+
type: "tool_result",
|
|
796
|
+
tool_use_id: block.id,
|
|
797
|
+
content: serializeToolResult(result)
|
|
798
|
+
};
|
|
799
|
+
} catch (err) {
|
|
800
|
+
return {
|
|
801
|
+
type: "tool_result",
|
|
802
|
+
tool_use_id: block.id,
|
|
803
|
+
content: err instanceof Error ? err.message : String(err),
|
|
804
|
+
is_error: true
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function openaiLifecycleTools(client, options = {}) {
|
|
811
|
+
const specs = selectLifecycleSpecs(options.allow);
|
|
812
|
+
const handlers = buildLifecycleHandlers(specs, { client });
|
|
813
|
+
return {
|
|
814
|
+
tools: specs.map((s) => ({
|
|
815
|
+
type: "function",
|
|
816
|
+
function: {
|
|
817
|
+
name: s.name,
|
|
818
|
+
description: s.description,
|
|
819
|
+
parameters: s.inputSchema
|
|
820
|
+
}
|
|
821
|
+
})),
|
|
822
|
+
async handleToolCall(call) {
|
|
823
|
+
const h = handlers.get(call.function.name);
|
|
824
|
+
if (!h) return {
|
|
825
|
+
role: "tool",
|
|
826
|
+
tool_call_id: call.id,
|
|
827
|
+
content: JSON.stringify({ error: `Unknown lifecycle tool: ${call.function.name}` })
|
|
828
|
+
};
|
|
829
|
+
let args = {};
|
|
830
|
+
try {
|
|
831
|
+
const v = JSON.parse(call.function.arguments || "{}");
|
|
832
|
+
if (v && typeof v === "object") args = v;
|
|
833
|
+
} catch {}
|
|
834
|
+
try {
|
|
835
|
+
const result = await h(args);
|
|
836
|
+
return {
|
|
837
|
+
role: "tool",
|
|
838
|
+
tool_call_id: call.id,
|
|
839
|
+
content: serializeToolResult(result)
|
|
840
|
+
};
|
|
841
|
+
} catch (err) {
|
|
842
|
+
return {
|
|
843
|
+
role: "tool",
|
|
844
|
+
tool_call_id: call.id,
|
|
845
|
+
content: JSON.stringify({ error: err instanceof Error ? err.message : String(err) })
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function buildLifecycleHandlers(specs, ctx) {
|
|
852
|
+
const m = /* @__PURE__ */ new Map();
|
|
853
|
+
for (const spec of specs) m.set(spec.name, spec.makeHandler(ctx));
|
|
854
|
+
return m;
|
|
855
|
+
}
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/agent/tools/mastra.ts
|
|
858
|
+
/**
|
|
859
|
+
* Build a Mastra tool pack bound to one sandbox.
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```ts
|
|
863
|
+
* import { Agent } from "@mastra/core/agent";
|
|
864
|
+
* import { mastraTools } from "@tangle-network/sandbox/agent";
|
|
865
|
+
*
|
|
866
|
+
* const tools = await mastraTools(box, { sessionId: "s1" });
|
|
867
|
+
* const agent = new Agent({ name: "coder", instructions: "...", tools });
|
|
868
|
+
* await agent.generate("Plot sin(x).");
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
async function mastraTools(box, options = {}) {
|
|
872
|
+
let mastra;
|
|
873
|
+
try {
|
|
874
|
+
mastra = await import("@mastra/core");
|
|
875
|
+
} catch {
|
|
876
|
+
throw new Error("mastraTools(): the `@mastra/core` package is not installed. Install it via `pnpm add @mastra/core`.");
|
|
877
|
+
}
|
|
878
|
+
const specs = selectSpecs(options.allow);
|
|
879
|
+
const ctx = {
|
|
880
|
+
box,
|
|
881
|
+
sessionId: options.sessionId
|
|
882
|
+
};
|
|
883
|
+
const result = {};
|
|
884
|
+
for (const spec of specs) {
|
|
885
|
+
const handler = spec.makeHandler(ctx);
|
|
886
|
+
result[spec.name] = mastra.createTool({
|
|
887
|
+
id: spec.name,
|
|
888
|
+
description: spec.description,
|
|
889
|
+
inputSchema: mastra.jsonSchema ? mastra.jsonSchema(spec.inputSchema) : spec.inputSchema,
|
|
890
|
+
execute: async (input) => {
|
|
891
|
+
return { result: serializeToolResult(await handler(input?.context ?? {})) };
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
return result;
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/agent/tools/openai.ts
|
|
899
|
+
/**
|
|
900
|
+
* Build an OpenAI tool pack bound to one sandbox.
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```ts
|
|
904
|
+
* import OpenAI from "openai";
|
|
905
|
+
* import { openaiTools } from "@tangle-network/sandbox/agent";
|
|
906
|
+
*
|
|
907
|
+
* const openai = new OpenAI();
|
|
908
|
+
* const { tools, handleAssistantMessage } = openaiTools(box, { sessionId: "s1" });
|
|
909
|
+
*
|
|
910
|
+
* const messages: any[] = [{ role: "user", content: "Plot sin(x) for x in [0, 2π]." }];
|
|
911
|
+
* for (let i = 0; i < 6; i++) {
|
|
912
|
+
* const r = await openai.chat.completions.create({
|
|
913
|
+
* model: "gpt-5.4", tools, messages,
|
|
914
|
+
* });
|
|
915
|
+
* const m = r.choices[0].message;
|
|
916
|
+
* messages.push(m);
|
|
917
|
+
* if (!m.tool_calls?.length) break;
|
|
918
|
+
* messages.push(...(await handleAssistantMessage(m)));
|
|
919
|
+
* }
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
function openaiTools(box, options = {}) {
|
|
923
|
+
const specs = selectSpecs(options.allow);
|
|
924
|
+
const ctx = {
|
|
925
|
+
box,
|
|
926
|
+
sessionId: options.sessionId
|
|
927
|
+
};
|
|
928
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
929
|
+
for (const spec of specs) handlers.set(spec.name, spec.makeHandler(ctx));
|
|
930
|
+
const tools = specs.map((s) => ({
|
|
931
|
+
type: "function",
|
|
932
|
+
function: {
|
|
933
|
+
name: s.name,
|
|
934
|
+
description: s.description,
|
|
935
|
+
parameters: s.inputSchema
|
|
936
|
+
}
|
|
937
|
+
}));
|
|
938
|
+
function parseArgs(raw) {
|
|
939
|
+
if (!raw) return {};
|
|
940
|
+
try {
|
|
941
|
+
const v = JSON.parse(raw);
|
|
942
|
+
return typeof v === "object" && v !== null ? v : {};
|
|
943
|
+
} catch {
|
|
944
|
+
return {};
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
async function handleToolCall(call) {
|
|
948
|
+
const handler = handlers.get(call.function.name);
|
|
949
|
+
if (!handler) return {
|
|
950
|
+
role: "tool",
|
|
951
|
+
tool_call_id: call.id,
|
|
952
|
+
content: JSON.stringify({ error: `Unknown tool: ${call.function.name}` })
|
|
953
|
+
};
|
|
954
|
+
try {
|
|
955
|
+
const result = await handler(parseArgs(call.function.arguments));
|
|
956
|
+
return {
|
|
957
|
+
role: "tool",
|
|
958
|
+
tool_call_id: call.id,
|
|
959
|
+
content: serializeToolResult(result)
|
|
960
|
+
};
|
|
961
|
+
} catch (err) {
|
|
962
|
+
return {
|
|
963
|
+
role: "tool",
|
|
964
|
+
tool_call_id: call.id,
|
|
965
|
+
content: JSON.stringify({ error: err instanceof Error ? err.message : String(err) })
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
async function handleAssistantMessage(message) {
|
|
970
|
+
const calls = message.tool_calls ?? [];
|
|
971
|
+
return Promise.all(calls.map(handleToolCall));
|
|
972
|
+
}
|
|
973
|
+
return {
|
|
974
|
+
tools,
|
|
975
|
+
handleToolCall,
|
|
976
|
+
handleAssistantMessage
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
//#endregion
|
|
980
|
+
//#region src/agent/tools/vercel-ai.ts
|
|
981
|
+
/**
|
|
982
|
+
* Build a Vercel AI SDK tool pack bound to one sandbox. The returned object
|
|
983
|
+
* is a `Record<toolName, ai.Tool>` ready for `generateText({ tools })`.
|
|
984
|
+
*
|
|
985
|
+
* @example
|
|
986
|
+
* ```ts
|
|
987
|
+
* import { generateText } from "ai";
|
|
988
|
+
* import { anthropic } from "@ai-sdk/anthropic";
|
|
989
|
+
* import { vercelAiTools } from "@tangle-network/sandbox/agent";
|
|
990
|
+
*
|
|
991
|
+
* const tools = await vercelAiTools(box, { sessionId: "s1" });
|
|
992
|
+
* const { text } = await generateText({
|
|
993
|
+
* model: anthropic("claude-opus-4-7"),
|
|
994
|
+
* tools,
|
|
995
|
+
* prompt: "Plot sin(x) for x in [0, 2π].",
|
|
996
|
+
* maxSteps: 6,
|
|
997
|
+
* });
|
|
998
|
+
* ```
|
|
999
|
+
*/
|
|
1000
|
+
async function vercelAiTools(box, options = {}) {
|
|
1001
|
+
let ai;
|
|
1002
|
+
try {
|
|
1003
|
+
ai = await import("ai");
|
|
1004
|
+
} catch {
|
|
1005
|
+
throw new Error("vercelAiTools(): the `ai` package is not installed. Install it via `pnpm add ai` (and pick an `@ai-sdk/*` model adapter).");
|
|
1006
|
+
}
|
|
1007
|
+
const specs = selectSpecs(options.allow);
|
|
1008
|
+
const ctx = {
|
|
1009
|
+
box,
|
|
1010
|
+
sessionId: options.sessionId
|
|
1011
|
+
};
|
|
1012
|
+
const result = {};
|
|
1013
|
+
for (const spec of specs) {
|
|
1014
|
+
const handler = spec.makeHandler(ctx);
|
|
1015
|
+
result[spec.name] = ai.tool({
|
|
1016
|
+
description: spec.description,
|
|
1017
|
+
inputSchema: ai.jsonSchema(spec.inputSchema),
|
|
1018
|
+
execute: async (args) => {
|
|
1019
|
+
return serializeToolResult(await handler(args));
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
return result;
|
|
1024
|
+
}
|
|
1025
|
+
//#endregion
|
|
1026
|
+
export { ALL_FLEET_TOOL_SPECS, ALL_LIFECYCLE_TOOL_SPECS, ALL_TOOL_SPECS, FLEET_TOOL_SPECS, LIFECYCLE_TOOL_SPECS, TOOL_SPECS, anthropicFleetTools, anthropicLifecycleTools, anthropicTools, createMcpServer, mastraFleetTools, mastraTools, openaiFleetTools, openaiLifecycleTools, openaiTools, runCode, vercelAiFleetTools, vercelAiTools };
|