@tangle-network/sandbox 0.9.1-develop.20260624210934.e2730e8 → 0.9.2-develop.20260625093856.35d47c0
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.js +1026 -1
- package/dist/auth/index.js +273 -1
- package/dist/client-BBZ7YLmq.js +2193 -0
- package/dist/collaboration/index.js +2 -1
- package/dist/collaboration-BxlfZ2Uh.js +201 -1
- package/dist/core.js +4 -1
- package/dist/errors-DZsfJUuc.js +262 -1
- package/dist/index.js +1180 -1
- package/dist/intelligence/index.js +225 -1
- package/dist/openai/index.js +1760 -1
- package/dist/sandbox-joKtQ5y3.js +4457 -0
- package/dist/session-gateway/index.js +667 -1
- package/dist/tangle/index.js +2 -1
- package/dist/tangle-DM0o66lW.js +831 -0
- package/package.json +4 -4
- package/dist/client-DFXGfX9s.js +0 -1
- package/dist/sandbox-CPwJYUuQ.js +0 -1
- package/dist/tangle-KvorROxa.js +0 -1
|
@@ -1 +1,225 @@
|
|
|
1
|
-
function a0_0x2f14(){const _0x3bd976=['\x6d\x74\x4b\x33\x6d\x74\x71\x30\x6e\x30\x58\x64\x72\x33\x66\x34\x73\x61','\x41\x68\x72\x30\x43\x68\x6d\x36\x6c\x59\x39\x50\x42\x4e\x72\x4c\x42\x67\x58\x50\x7a\x32\x76\x55\x79\x32\x75\x55\x44\x67\x66\x55\x7a\x32\x58\x4c\x6c\x4e\x72\x56\x42\x32\x58\x5a','\x74\x68\x44\x79\x72\x65\x4f','\x6d\x30\x31\x4b\x45\x68\x62\x6b\x43\x57','\x79\x4d\x39\x4b\x45\x71','\x43\x32\x76\x30','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d\x56','\x42\x4d\x76\x34\x44\x65\x6e\x31\x43\x4e\x6e\x56\x43\x47','\x42\x30\x44\x75\x76\x4e\x79','\x7a\x4e\x6a\x56\x42\x71','\x42\x67\x66\x49\x7a\x77\x57','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d','\x6f\x74\x71\x58\x6e\x67\x44\x4e\x72\x4d\x7a\x6a\x71\x71','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x71\x32\x58\x50\x7a\x77\x35\x30\x6f\x49\x62\x48\x43\x67\x4c\x6c\x7a\x78\x4b\x47\x41\x78\x6d\x47\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\x6d\x74\x71\x31\x45\x4b\x48\x32\x45\x68\x50\x36','\x6e\x74\x7a\x57\x75\x33\x4c\x66\x42\x65\x71','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x75\x77\x4c\x67\x43\x4d\x47','\x6e\x74\x65\x30\x6e\x4a\x71\x35\x6d\x67\x7a\x6b\x75\x67\x7a\x54\x73\x47','\x44\x4e\x6e\x48\x44\x32\x47','\x79\x77\x6a\x56\x43\x4e\x71','\x79\x33\x76\x59\x43\x32\x39\x59','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x59\x38','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x6c\x33\x6e\x57\x79\x77\x35\x5a\x6c\x4d\x35\x4b\x41\x4e\x6e\x56\x42\x47','\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x69\x65\x66\x71\x73\x73\x62\x59\x7a\x78\x72\x31\x43\x4d\x35\x4c\x7a\x63\x62\x48\x42\x49\x62\x6f\x72\x65\x50\x74\x74\x30\x34\x47\x7a\x78\x48\x57\x42\x33\x6a\x30\x69\x68\x44\x50\x44\x67\x47\x47\x42\x4d\x38\x47\x79\x4d\x39\x4b\x45\x73\x62\x5a\x44\x68\x6a\x4c\x79\x77\x30','\x42\x32\x7a\x4d\x43\x32\x76\x30','\x73\x65\x6a\x6c\x44\x65\x75','\x6d\x4a\x47\x31\x6d\x5a\x62\x52\x77\x4b\x31\x30\x79\x31\x61','\x71\x4d\x76\x48\x43\x4d\x76\x59\x69\x61','\x79\x78\x62\x50\x73\x32\x76\x35','\x45\x4d\x50\x50\x73\x32\x69','\x73\x67\x72\x63\x77\x66\x65','\x41\x68\x50\x4c\x71\x4e\x75','\x79\x33\x44\x63\x79\x33\x4b','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x73\x66\x66\x75\x72\x75\x30','\x42\x77\x39\x4b\x7a\x77\x57','\x43\x4e\x76\x55\x73\x77\x71','\x73\x77\x7a\x31\x41\x75\x53','\x43\x33\x72\x48\x44\x68\x76\x5a','\x42\x67\x4c\x54\x41\x78\x71','\x72\x30\x76\x75','\x72\x75\x54\x4a\x79\x32\x30','\x41\x78\x72\x4c\x42\x78\x6d','\x6c\x33\x6e\x57\x79\x77\x35\x5a','\x43\x32\x31\x79\x45\x68\x6d','\x7a\x32\x66\x30\x7a\x71','\x45\x78\x6e\x33\x72\x76\x4f','\x44\x78\x6e\x4c\x43\x4b\x4c\x4b','\x79\x78\x62\x57\x42\x67\x4c\x4a\x79\x78\x72\x50\x42\x32\x34\x56\x41\x4e\x6e\x56\x42\x47','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a','\x75\x33\x7a\x6c\x43\x4d\x75','\x6d\x5a\x65\x59\x6e\x5a\x75\x32\x6f\x66\x6a\x68\x79\x78\x48\x68\x44\x61','\x43\x75\x48\x78\x7a\x78\x6d','\x44\x67\x76\x34\x44\x61','\x6d\x4a\x4b\x32\x6d\x74\x65\x35\x6e\x4d\x48\x59\x71\x78\x44\x77\x42\x61','\x45\x75\x35\x58\x7a\x67\x38','\x41\x67\x48\x79\x44\x67\x43','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x6d\x4a\x75\x59\x6e\x74\x61\x34\x42\x65\x6e\x53\x77\x68\x66\x6d','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a\x6c\x57','\x43\x32\x4c\x36\x7a\x71'];a0_0x2f14=function(){return _0x3bd976;};return a0_0x2f14();}const a0_0x21af2d=a0_0x3735;(function(_0x49a6b8,_0x5ecdd4){const _0x3dbda8=a0_0x3735,_0x5d72a0=_0x49a6b8();while(!![]){try{const _0x313434=-parseInt(_0x3dbda8(0x18d))/0x1*(parseInt(_0x3dbda8(0x187))/0x2)+parseInt(_0x3dbda8(0x18a))/0x3+-parseInt(_0x3dbda8(0x1bf))/0x4+-parseInt(_0x3dbda8(0x198))/0x5*(parseInt(_0x3dbda8(0x196))/0x6)+parseInt(_0x3dbda8(0x1c2))/0x7+parseInt(_0x3dbda8(0x199))/0x8*(parseInt(_0x3dbda8(0x1a6))/0x9)+parseInt(_0x3dbda8(0x19c))/0xa;if(_0x313434===_0x5ecdd4)break;else _0x5d72a0['push'](_0x5d72a0['shift']());}catch(_0xdc80ac){_0x5d72a0['push'](_0x5d72a0['shift']());}}}(a0_0x2f14,0x644ed));import{f as a0_0x2521c4,r as a0_0x57f49b,u as a0_0x67a541}from'\x2e\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x44\x5a\x73\x66\x4a\x55\x75\x63\x2e\x6a\x73';const DEFAULT_INTELLIGENCE_BASE_URL=a0_0x21af2d(0x18b),DEFAULT_TIMEOUT_MS=0x7530;function appendParam(_0x14f120,_0x2925d3,_0x27e151){const _0x2bb6bf=a0_0x21af2d;if(_0x27e151===void 0x0)return;_0x14f120[_0x2bb6bf(0x18f)](_0x2925d3,String(_0x27e151));}function a0_0x3735(_0x3f476e,_0x4a421a){_0x3f476e=_0x3f476e-0x186;const _0x2f14a3=a0_0x2f14();let _0x3735f7=_0x2f14a3[_0x3f476e];if(a0_0x3735['\x41\x50\x52\x53\x77\x49']===undefined){var _0x43ac6d=function(_0x44c62a){const _0x3cb6f5='\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 _0x25f96c='',_0x4cae3e='';for(let _0x39a385=0x0,_0x3277c7,_0x430fe8,_0x13f60c=0x0;_0x430fe8=_0x44c62a['\x63\x68\x61\x72\x41\x74'](_0x13f60c++);~_0x430fe8&&(_0x3277c7=_0x39a385%0x4?_0x3277c7*0x40+_0x430fe8:_0x430fe8,_0x39a385++%0x4)?_0x25f96c+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x3277c7>>(-0x2*_0x39a385&0x6)):0x0){_0x430fe8=_0x3cb6f5['\x69\x6e\x64\x65\x78\x4f\x66'](_0x430fe8);}for(let _0x4e38a6=0x0,_0x4fae15=_0x25f96c['\x6c\x65\x6e\x67\x74\x68'];_0x4e38a6<_0x4fae15;_0x4e38a6++){_0x4cae3e+='\x25'+('\x30\x30'+_0x25f96c['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x4e38a6)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x4cae3e);};a0_0x3735['\x4c\x49\x4d\x43\x6f\x69']=_0x43ac6d,a0_0x3735['\x6e\x6e\x6c\x53\x75\x66']={},a0_0x3735['\x41\x50\x52\x53\x77\x49']=!![];}const _0x2918cf=_0x2f14a3[0x0],_0x4f931d=_0x3f476e+_0x2918cf,_0x19c0c9=a0_0x3735['\x6e\x6e\x6c\x53\x75\x66'][_0x4f931d];return!_0x19c0c9?(_0x3735f7=a0_0x3735['\x4c\x49\x4d\x43\x6f\x69'](_0x3735f7),a0_0x3735['\x6e\x6e\x6c\x53\x75\x66'][_0x4f931d]=_0x3735f7):_0x3735f7=_0x19c0c9,_0x3735f7;}function createIntelligenceClient(_0x69722c){const _0x36bf65=a0_0x21af2d,_0x4ff241={'\x73\x6d\x58\x78\x73':function(_0x538994,_0x22d122){return _0x538994 instanceof _0x22d122;},'\x71\x48\x57\x65\x73':function(_0x1ff8d9,_0xd4083f){return _0x1ff8d9===_0xd4083f;},'\x48\x42\x4b\x74\x45':function(_0x163f56,_0x49cda6){return _0x163f56(_0x49cda6);},'\x7a\x6a\x69\x4b\x62':'\x47\x45\x54','\x4c\x77\x58\x44\x4a':function(_0x31ca91,_0x4a1b53,_0x285eb8,_0x5243c1){return _0x31ca91(_0x4a1b53,_0x285eb8,_0x5243c1);},'\x51\x69\x46\x72\x68':_0x36bf65(0x1b3),'\x45\x4b\x63\x63\x6d':function(_0x5e2cd5,_0x7d3c56,_0x3e8a02,_0x3bc9fe){return _0x5e2cd5(_0x7d3c56,_0x3e8a02,_0x3bc9fe);},'\x49\x66\x75\x69\x4b':function(_0x436401,_0x5124bd,_0x1c1b4d,_0x41c1bb){return _0x436401(_0x5124bd,_0x1c1b4d,_0x41c1bb);},'\x6f\x47\x54\x56\x76':_0x36bf65(0x1b2),'\x53\x76\x4b\x72\x65':function(_0x3d3359,_0x3e4b39){return _0x3d3359>_0x3e4b39;},'\x68\x68\x58\x74\x67':_0x36bf65(0x19f),'\x76\x73\x61\x77\x68':function(_0x4bef18,_0xc9c1d9){return _0x4bef18>_0xc9c1d9;},'\x48\x64\x42\x58\x51':_0x36bf65(0x1ad),'\x79\x4e\x71\x64\x6f':function(_0x311193,_0x22656e,_0x596f9d,_0x5a6b01){return _0x311193(_0x22656e,_0x596f9d,_0x5a6b01);},'\x79\x73\x77\x45\x5a':_0x36bf65(0x1a4),'\x48\x51\x54\x45\x4d':_0x36bf65(0x193),'\x63\x77\x42\x63\x79':function(_0x3d9f92,_0xe6fb12){return _0x3d9f92(_0xe6fb12);},'\x68\x7a\x65\x42\x75':function(_0xaff73c,_0x3bbcec,_0x38ecc2){return _0xaff73c(_0x3bbcec,_0x38ecc2);},'\x57\x7a\x69\x44\x72':_0x36bf65(0x197)};if(!_0x69722c['\x61\x70\x69\x4b\x65\x79'])throw new Error(_0x4ff241['\x57\x7a\x69\x44\x72']);const _0x759da=_0x69722c[_0x36bf65(0x1a8)],_0x373a94=(_0x69722c['\x62\x61\x73\x65\x55\x72\x6c']??'\x68\x74\x74\x70\x73\x3a\x2f\x2f\x69\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x2e\x74\x61\x6e\x67\x6c\x65\x2e\x74\x6f\x6f\x6c\x73')['\x72\x65\x70\x6c\x61\x63\x65'](/\/$/,''),_0x3d2e3a=_0x69722c[_0x36bf65(0x186)]??DEFAULT_TIMEOUT_MS;async function _0x31becb(_0x586daa){const _0x500107=_0x36bf65,_0x430818=''+_0x373a94+_0x586daa,_0xaa455e=new AbortController(),_0x1c0840=setTimeout(()=>_0xaa455e[_0x500107(0x19e)](),_0x3d2e3a);try{return await globalThis['\x66\x65\x74\x63\x68'](_0x430818,{'\x68\x65\x61\x64\x65\x72\x73':{'\x41\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\x6f\x6e':_0x500107(0x1a7)+_0x759da,'\x41\x63\x63\x65\x70\x74':_0x500107(0x1bc)},'\x73\x69\x67\x6e\x61\x6c':_0xaa455e['\x73\x69\x67\x6e\x61\x6c']});}catch(_0x1e1b9){if(_0x4ff241[_0x500107(0x1b8)](_0x1e1b9,Error)&&_0x4ff241[_0x500107(0x1c0)](_0x1e1b9['\x6e\x61\x6d\x65'],'\x41\x62\x6f\x72\x74\x45\x72\x72\x6f\x72'))throw new a0_0x67a541(_0x3d2e3a);throw new a0_0x57f49b('\x46\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x63\x6f\x6e\x6e\x65\x63\x74\x20\x74\x6f\x20\x49\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x20\x41\x50\x49\x3a\x20'+(_0x1e1b9 instanceof Error?_0x1e1b9['\x6d\x65\x73\x73\x61\x67\x65']:_0x4ff241[_0x500107(0x1a5)](String,_0x1e1b9)),_0x1e1b9 instanceof Error?_0x1e1b9:void 0x0,{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x586daa,'\x6f\x72\x69\x67\x69\x6e':'\x73\x61\x6e\x64\x62\x6f\x78\x2d\x61\x70\x69'});}finally{_0x4ff241[_0x500107(0x1a5)](clearTimeout,_0x1c0840);}}async function _0x11ec01(_0xce73bc){const _0x4a4c59=_0x36bf65,_0x338014=await _0x31becb(_0xce73bc),_0x1a10c1=await _0x338014[_0x4a4c59(0x1c1)]();if(!_0x338014['\x6f\x6b'])throw a0_0x2521c4(_0x338014[_0x4a4c59(0x1b2)],_0x1a10c1,{'\x6d\x65\x74\x68\x6f\x64':_0x4ff241[_0x4a4c59(0x1a9)],'\x70\x61\x74\x68':_0xce73bc},_0x338014[_0x4a4c59(0x19a)]);return JSON['\x70\x61\x72\x73\x65'](_0x1a10c1);}async function _0x5f2e7a(_0xa5795b={}){const _0x242e4c=_0x36bf65,_0x3c8202=new URLSearchParams();return _0x4ff241[_0x242e4c(0x18c)](appendParam,_0x3c8202,_0x4ff241[_0x242e4c(0x19b)],_0xa5795b[_0x242e4c(0x1b3)]),appendParam(_0x3c8202,_0x242e4c(0x193),_0xa5795b['\x66\x72\x6f\x6d']),_0x4ff241[_0x242e4c(0x1b5)](appendParam,_0x3c8202,'\x74\x6f',_0xa5795b['\x74\x6f']),_0x4ff241[_0x242e4c(0x1b1)](appendParam,_0x3c8202,'\x71',_0xa5795b['\x71']),appendParam(_0x3c8202,'\x6d\x6f\x64\x65\x6c',_0xa5795b[_0x242e4c(0x1af)]),appendParam(_0x3c8202,_0x242e4c(0x1b0),_0xa5795b[_0x242e4c(0x1b0)]),appendParam(_0x3c8202,_0x4ff241[_0x242e4c(0x192)],_0xa5795b[_0x242e4c(0x1b2)]),_0x4ff241[_0x242e4c(0x1b5)](appendParam,_0x3c8202,_0x242e4c(0x19f),_0xa5795b[_0x242e4c(0x19f)]),_0x4ff241[_0x242e4c(0x1a5)](_0x11ec01,_0x242e4c(0x1a1)+(_0x4ff241[_0x242e4c(0x1be)](_0x3c8202[_0x242e4c(0x189)],0x0)?'\x3f'+_0x3c8202:''));}async function _0xc5b967(_0x54e178,_0x54a7e3={}){const _0x3fb74a=_0x36bf65,_0x1284b=new URLSearchParams();_0x4ff241['\x49\x66\x75\x69\x4b'](appendParam,_0x1284b,'\x6c\x69\x6d\x69\x74',_0x54a7e3[_0x3fb74a(0x1b3)]),appendParam(_0x1284b,_0x4ff241[_0x3fb74a(0x1c4)],_0x54a7e3[_0x3fb74a(0x19f)]);const _0x2d990c=_0x4ff241[_0x3fb74a(0x19d)](_0x1284b[_0x3fb74a(0x189)],0x0)?'\x3f'+_0x1284b:'';return _0x11ec01(_0x3fb74a(0x1a0)+encodeURIComponent(_0x54e178)+_0x3fb74a(0x1b7)+_0x2d990c);}async function _0x590286(_0x57ae5a){const _0x33d3c0=_0x36bf65,_0x2d9b8a=_0x33d3c0(0x1a0)+encodeURIComponent(_0x57ae5a)+_0x33d3c0(0x1a2),_0x1233b3=await _0x31becb(_0x2d9b8a);if(!_0x1233b3['\x6f\x6b']){const _0x4d14d4=await _0x1233b3[_0x33d3c0(0x1c1)]();throw a0_0x2521c4(_0x1233b3[_0x33d3c0(0x1b2)],_0x4d14d4,{'\x6d\x65\x74\x68\x6f\x64':_0x33d3c0(0x1b4),'\x70\x61\x74\x68':_0x2d9b8a},_0x1233b3['\x68\x65\x61\x64\x65\x72\x73']);}if(!_0x1233b3[_0x33d3c0(0x18e)])throw new a0_0x57f49b(_0x33d3c0(0x1a3),{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x2d9b8a,'\x6f\x72\x69\x67\x69\x6e':_0x4ff241[_0x33d3c0(0x1aa)]});return _0x1233b3[_0x33d3c0(0x18e)];}async function _0x12700d(_0x44b7ad={}){const _0xa68c17=_0x36bf65,_0x4031f3=new URLSearchParams();return _0x4ff241[_0xa68c17(0x1b5)](appendParam,_0x4031f3,_0x4ff241['\x51\x69\x46\x72\x68'],_0x44b7ad['\x6c\x69\x6d\x69\x74']),_0x4ff241['\x79\x4e\x71\x64\x6f'](appendParam,_0x4031f3,_0x4ff241[_0xa68c17(0x1ba)],_0x44b7ad[_0xa68c17(0x1a4)]),_0x4ff241[_0xa68c17(0x1b5)](appendParam,_0x4031f3,_0xa68c17(0x1b2),_0x44b7ad[_0xa68c17(0x1b2)]),appendParam(_0x4031f3,_0xa68c17(0x1b9),_0x44b7ad[_0xa68c17(0x1b9)]),_0x4ff241['\x45\x4b\x63\x63\x6d'](appendParam,_0x4031f3,'\x71',_0x44b7ad['\x71']),appendParam(_0x4031f3,_0x4ff241['\x48\x51\x54\x45\x4d'],_0x44b7ad[_0xa68c17(0x193)]),appendParam(_0x4031f3,'\x74\x6f',_0x44b7ad['\x74\x6f']),_0x4ff241['\x4c\x77\x58\x44\x4a'](appendParam,_0x4031f3,_0xa68c17(0x194),_0x44b7ad[_0xa68c17(0x194)]),appendParam(_0x4031f3,_0xa68c17(0x19f),_0x44b7ad[_0xa68c17(0x19f)]),_0x4ff241[_0xa68c17(0x1a5)](_0x11ec01,_0xa68c17(0x195)+(_0x4031f3['\x73\x69\x7a\x65']>0x0?'\x3f'+_0x4031f3:''));}async function _0x5d81a5(_0x5283a5){const _0x3adff5=_0x36bf65;return _0x11ec01(_0x3adff5(0x190)+_0x4ff241[_0x3adff5(0x1a5)](encodeURIComponent,_0x5283a5));}async function _0x2a62ff(_0x413f0b){const _0x18d953=_0x36bf65;return _0x4ff241[_0x18d953(0x1a5)](_0x11ec01,'\x2f\x76\x31\x2f\x72\x75\x6e\x73\x2f'+encodeURIComponent(_0x413f0b)+'\x2f\x74\x72\x61\x63\x65\x73');}async function _0x4d3d76(_0x20e75c={}){const _0x2a00d4=_0x36bf65,_0x1fe52c=new URLSearchParams();return _0x4ff241['\x4c\x77\x58\x44\x4a'](appendParam,_0x1fe52c,_0x2a00d4(0x1b3),_0x20e75c[_0x2a00d4(0x1b3)]),appendParam(_0x1fe52c,_0x4ff241[_0x2a00d4(0x1ae)],_0x20e75c[_0x2a00d4(0x193)]),appendParam(_0x1fe52c,'\x74\x6f',_0x20e75c['\x74\x6f']),_0x4ff241[_0x2a00d4(0x1c3)](appendParam,_0x1fe52c,'\x71',_0x20e75c['\x71']),appendParam(_0x1fe52c,_0x2a00d4(0x1bb),_0x20e75c[_0x2a00d4(0x1bb)]),appendParam(_0x1fe52c,_0x2a00d4(0x19f),_0x20e75c[_0x2a00d4(0x19f)]),_0x11ec01(_0x2a00d4(0x1bd)+(_0x1fe52c['\x73\x69\x7a\x65']>0x0?'\x3f'+_0x1fe52c:''));}async function _0x5f51fc(_0x50901f,_0x1cb6ee={}){const _0x316ee6=_0x36bf65,_0x23d52e=new URLSearchParams();appendParam(_0x23d52e,_0x4ff241['\x51\x69\x46\x72\x68'],_0x1cb6ee[_0x316ee6(0x1b3)]),_0x4ff241['\x79\x4e\x71\x64\x6f'](appendParam,_0x23d52e,_0x316ee6(0x19f),_0x1cb6ee[_0x316ee6(0x19f)]);const _0x3814e7=_0x23d52e[_0x316ee6(0x189)]>0x0?'\x3f'+_0x23d52e:'';return _0x4ff241[_0x316ee6(0x1ac)](_0x11ec01,_0x316ee6(0x188)+encodeURIComponent(_0x50901f)+'\x2f\x74\x72\x61\x63\x65\x73'+_0x3814e7);}async function*_0x4ef7da(_0x1d9eb5,_0x214f15={}){const _0x4ae519=_0x36bf65;let _0x21bd81=_0x214f15[_0x4ae519(0x19f)];for(;;){const _0x2e5980=await _0x4ff241[_0x4ae519(0x1ab)](_0xc5b967,_0x1d9eb5,{..._0x214f15,'\x63\x75\x72\x73\x6f\x72':_0x21bd81});for(const _0x141105 of _0x2e5980[_0x4ae519(0x1b6)])yield _0x141105;if(!_0x2e5980[_0x4ae519(0x191)])return;_0x21bd81=_0x2e5980['\x6e\x65\x78\x74\x43\x75\x72\x73\x6f\x72'];}}async function*_0x49cb22(_0x7d51c3={}){const _0x40126b=_0x36bf65;let _0x4c98b5=_0x7d51c3[_0x40126b(0x19f)];for(;;){const _0x18a96b=await _0x4ff241[_0x40126b(0x1a5)](_0x5f2e7a,{..._0x7d51c3,'\x63\x75\x72\x73\x6f\x72':_0x4c98b5});for(const _0x93d59e of _0x18a96b[_0x40126b(0x1b6)])yield _0x93d59e;if(!_0x18a96b[_0x40126b(0x191)])return;_0x4c98b5=_0x18a96b[_0x40126b(0x191)];}}async function*_0x4df18b(_0x3d8505={}){const _0x8c7f80=_0x36bf65;let _0x238463=_0x3d8505['\x63\x75\x72\x73\x6f\x72'];for(;;){const _0x8e9b9b=await _0x4d3d76({..._0x3d8505,'\x63\x75\x72\x73\x6f\x72':_0x238463});for(const _0x4dc0a8 of _0x8e9b9b[_0x8c7f80(0x1b6)])yield _0x4dc0a8;if(!_0x8e9b9b['\x6e\x65\x78\x74\x43\x75\x72\x73\x6f\x72'])return;_0x238463=_0x8e9b9b[_0x8c7f80(0x191)];}}return{'\x6c\x69\x73\x74\x54\x72\x61\x63\x65\x73':_0x5f2e7a,'\x67\x65\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0xc5b967,'\x65\x78\x70\x6f\x72\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73\x4e\x64\x6a\x73\x6f\x6e':_0x590286,'\x6c\x69\x73\x74\x52\x75\x6e\x73':_0x12700d,'\x67\x65\x74\x52\x75\x6e':_0x5d81a5,'\x67\x65\x74\x52\x75\x6e\x54\x72\x61\x63\x65\x73':_0x2a62ff,'\x6c\x69\x73\x74\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x4d3d76,'\x67\x65\x74\x53\x65\x73\x73\x69\x6f\x6e\x54\x72\x61\x63\x65\x73':_0x5f51fc,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x4ef7da,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x73':_0x49cb22,'\x69\x74\x65\x72\x61\x74\x65\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x4df18b};}export{DEFAULT_INTELLIGENCE_BASE_URL,createIntelligenceClient};
|
|
1
|
+
import { f as parseErrorResponse, r as NetworkError, u as TimeoutError } from "../errors-DZsfJUuc.js";
|
|
2
|
+
//#region src/intelligence/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
|
|
5
|
+
* hosted trace-read surface on Tangle Intelligence
|
|
6
|
+
* (`https://intelligence.tangle.tools`, default port 3030).
|
|
7
|
+
*
|
|
8
|
+
* This is a SEPARATE host from the Sandbox API. The SDK's `IntelligenceClient`
|
|
9
|
+
* (exposed as `client.intelligence`) routes intelligence-*report* calls through
|
|
10
|
+
* `SandboxClient.fetch` against the **sandbox** `baseUrl` — that is the
|
|
11
|
+
* sandbox-api intelligence-report surface, a different service. The trace-read
|
|
12
|
+
* routes (`/v1/traces`, `/v1/runs*`, `/v1/sessions*`) live on intelligence-api
|
|
13
|
+
* and are tenant-scoped by the customer key, so this client does NOT reuse
|
|
14
|
+
* `SandboxClient.fetch`; it carries its own intelligence-host base URL.
|
|
15
|
+
*
|
|
16
|
+
* Auth is the customer key (`sk-tan-*`) sent as `Authorization: Bearer ...`;
|
|
17
|
+
* the platform resolves it to the caller's tenant and filters `tenant_id`
|
|
18
|
+
* first and unconditionally on every route, so a cross-tenant id returns an
|
|
19
|
+
* empty result or 404, never the row.
|
|
20
|
+
*
|
|
21
|
+
* Nothing here uses a Node API — `globalThis.fetch` only — so it runs in the
|
|
22
|
+
* browser, Cloudflare Workers, Deno, and Node 20+ unchanged. The base URL must
|
|
23
|
+
* be supplied by the caller (e.g. from `TANGLE_INTELLIGENCE_BASE_URL`) or it
|
|
24
|
+
* falls back to the production host.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { createIntelligenceClient } from "@tangle-network/sandbox/intelligence";
|
|
29
|
+
*
|
|
30
|
+
* const intel = createIntelligenceClient({
|
|
31
|
+
* apiKey: process.env.TANGLE_API_KEY!,
|
|
32
|
+
* baseUrl: process.env.TANGLE_INTELLIGENCE_BASE_URL,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const { items } = await intel.listTraces({ status: "ERROR", limit: 20 });
|
|
36
|
+
* for await (const span of intel.iterateTraceSpans(items[0].traceId)) {
|
|
37
|
+
* console.log(span.name, span.durationMs);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @packageDocumentation
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Production intelligence-api host. Mirrors the api-side
|
|
45
|
+
* `DEFAULT_INTELLIGENCE_BASE_URL` so the SDK default and the server default
|
|
46
|
+
* never drift.
|
|
47
|
+
*/
|
|
48
|
+
const DEFAULT_INTELLIGENCE_BASE_URL = "https://intelligence.tangle.tools";
|
|
49
|
+
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
50
|
+
function appendParam(search, key, value) {
|
|
51
|
+
if (value === void 0) return;
|
|
52
|
+
search.set(key, String(value));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a browser-safe client for the Tangle Intelligence trace-read surface.
|
|
56
|
+
*
|
|
57
|
+
* @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
|
|
58
|
+
* @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
|
|
59
|
+
*/
|
|
60
|
+
function createIntelligenceClient(config) {
|
|
61
|
+
if (!config.apiKey) throw new Error("createIntelligenceClient: apiKey is required");
|
|
62
|
+
const apiKey = config.apiKey;
|
|
63
|
+
const baseUrl = (config.baseUrl ?? "https://intelligence.tangle.tools").replace(/\/$/, "");
|
|
64
|
+
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
65
|
+
/**
|
|
66
|
+
* One authenticated request. Mirrors `SandboxClient.fetch`: Bearer auth,
|
|
67
|
+
* an `AbortController` timeout that surfaces as `TimeoutError`, and a
|
|
68
|
+
* transport failure wrapped as `NetworkError`. Never reuses the sandbox
|
|
69
|
+
* `baseUrl` — this is the intelligence host.
|
|
70
|
+
*/
|
|
71
|
+
async function request(path) {
|
|
72
|
+
const url = `${baseUrl}${path}`;
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
75
|
+
try {
|
|
76
|
+
return await globalThis.fetch(url, {
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${apiKey}`,
|
|
79
|
+
Accept: "application/json"
|
|
80
|
+
},
|
|
81
|
+
signal: controller.signal
|
|
82
|
+
});
|
|
83
|
+
} catch (err) {
|
|
84
|
+
if (err instanceof Error && err.name === "AbortError") throw new TimeoutError(timeoutMs);
|
|
85
|
+
throw new NetworkError(`Failed to connect to Intelligence API: ${err instanceof Error ? err.message : String(err)}`, err instanceof Error ? err : void 0, {
|
|
86
|
+
endpoint: path,
|
|
87
|
+
origin: "sandbox-api"
|
|
88
|
+
});
|
|
89
|
+
} finally {
|
|
90
|
+
clearTimeout(timeoutId);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** GET a JSON route, raising the SDK's typed error on a non-2xx response. */
|
|
94
|
+
async function getJson(path) {
|
|
95
|
+
const response = await request(path);
|
|
96
|
+
const body = await response.text();
|
|
97
|
+
if (!response.ok) throw parseErrorResponse(response.status, body, {
|
|
98
|
+
method: "GET",
|
|
99
|
+
path
|
|
100
|
+
}, response.headers);
|
|
101
|
+
return JSON.parse(body);
|
|
102
|
+
}
|
|
103
|
+
async function listTraces(params = {}) {
|
|
104
|
+
const search = new URLSearchParams();
|
|
105
|
+
appendParam(search, "limit", params.limit);
|
|
106
|
+
appendParam(search, "from", params.from);
|
|
107
|
+
appendParam(search, "to", params.to);
|
|
108
|
+
appendParam(search, "q", params.q);
|
|
109
|
+
appendParam(search, "model", params.model);
|
|
110
|
+
appendParam(search, "runId", params.runId);
|
|
111
|
+
appendParam(search, "status", params.status);
|
|
112
|
+
appendParam(search, "cursor", params.cursor);
|
|
113
|
+
return getJson(`/v1/traces${search.size > 0 ? `?${search}` : ""}`);
|
|
114
|
+
}
|
|
115
|
+
async function getTraceSpans(traceId, params = {}) {
|
|
116
|
+
const search = new URLSearchParams();
|
|
117
|
+
appendParam(search, "limit", params.limit);
|
|
118
|
+
appendParam(search, "cursor", params.cursor);
|
|
119
|
+
const suffix = search.size > 0 ? `?${search}` : "";
|
|
120
|
+
return getJson(`/v1/traces/${encodeURIComponent(traceId)}/spans${suffix}`);
|
|
121
|
+
}
|
|
122
|
+
async function exportTraceSpansNdjson(traceId) {
|
|
123
|
+
const path = `/v1/traces/${encodeURIComponent(traceId)}/spans.ndjson`;
|
|
124
|
+
const response = await request(path);
|
|
125
|
+
if (!response.ok) {
|
|
126
|
+
const body = await response.text();
|
|
127
|
+
throw parseErrorResponse(response.status, body, {
|
|
128
|
+
method: "GET",
|
|
129
|
+
path
|
|
130
|
+
}, response.headers);
|
|
131
|
+
}
|
|
132
|
+
if (!response.body) throw new NetworkError("Intelligence API returned an NDJSON export with no body stream", {
|
|
133
|
+
endpoint: path,
|
|
134
|
+
origin: "sandbox-api"
|
|
135
|
+
});
|
|
136
|
+
return response.body;
|
|
137
|
+
}
|
|
138
|
+
async function listRuns(params = {}) {
|
|
139
|
+
const search = new URLSearchParams();
|
|
140
|
+
appendParam(search, "limit", params.limit);
|
|
141
|
+
appendParam(search, "offset", params.offset);
|
|
142
|
+
appendParam(search, "status", params.status);
|
|
143
|
+
appendParam(search, "gate", params.gate);
|
|
144
|
+
appendParam(search, "q", params.q);
|
|
145
|
+
appendParam(search, "from", params.from);
|
|
146
|
+
appendParam(search, "to", params.to);
|
|
147
|
+
appendParam(search, "label", params.label);
|
|
148
|
+
appendParam(search, "cursor", params.cursor);
|
|
149
|
+
return getJson(`/v1/runs${search.size > 0 ? `?${search}` : ""}`);
|
|
150
|
+
}
|
|
151
|
+
async function getRun(runId) {
|
|
152
|
+
return getJson(`/v1/runs/${encodeURIComponent(runId)}`);
|
|
153
|
+
}
|
|
154
|
+
async function getRunTraces(runId) {
|
|
155
|
+
return getJson(`/v1/runs/${encodeURIComponent(runId)}/traces`);
|
|
156
|
+
}
|
|
157
|
+
async function listSessions(params = {}) {
|
|
158
|
+
const search = new URLSearchParams();
|
|
159
|
+
appendParam(search, "limit", params.limit);
|
|
160
|
+
appendParam(search, "from", params.from);
|
|
161
|
+
appendParam(search, "to", params.to);
|
|
162
|
+
appendParam(search, "q", params.q);
|
|
163
|
+
appendParam(search, "userId", params.userId);
|
|
164
|
+
appendParam(search, "cursor", params.cursor);
|
|
165
|
+
return getJson(`/v1/sessions${search.size > 0 ? `?${search}` : ""}`);
|
|
166
|
+
}
|
|
167
|
+
async function getSessionTraces(sessionId, params = {}) {
|
|
168
|
+
const search = new URLSearchParams();
|
|
169
|
+
appendParam(search, "limit", params.limit);
|
|
170
|
+
appendParam(search, "cursor", params.cursor);
|
|
171
|
+
const suffix = search.size > 0 ? `?${search}` : "";
|
|
172
|
+
return getJson(`/v1/sessions/${encodeURIComponent(sessionId)}/traces${suffix}`);
|
|
173
|
+
}
|
|
174
|
+
async function* iterateTraceSpans(traceId, params = {}) {
|
|
175
|
+
let cursor = params.cursor;
|
|
176
|
+
for (;;) {
|
|
177
|
+
const page = await getTraceSpans(traceId, {
|
|
178
|
+
...params,
|
|
179
|
+
cursor
|
|
180
|
+
});
|
|
181
|
+
for (const span of page.items) yield span;
|
|
182
|
+
if (!page.nextCursor) return;
|
|
183
|
+
cursor = page.nextCursor;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function* iterateTraces(params = {}) {
|
|
187
|
+
let cursor = params.cursor;
|
|
188
|
+
for (;;) {
|
|
189
|
+
const page = await listTraces({
|
|
190
|
+
...params,
|
|
191
|
+
cursor
|
|
192
|
+
});
|
|
193
|
+
for (const trace of page.items) yield trace;
|
|
194
|
+
if (!page.nextCursor) return;
|
|
195
|
+
cursor = page.nextCursor;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function* iterateSessions(params = {}) {
|
|
199
|
+
let cursor = params.cursor;
|
|
200
|
+
for (;;) {
|
|
201
|
+
const page = await listSessions({
|
|
202
|
+
...params,
|
|
203
|
+
cursor
|
|
204
|
+
});
|
|
205
|
+
for (const session of page.items) yield session;
|
|
206
|
+
if (!page.nextCursor) return;
|
|
207
|
+
cursor = page.nextCursor;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
listTraces,
|
|
212
|
+
getTraceSpans,
|
|
213
|
+
exportTraceSpansNdjson,
|
|
214
|
+
listRuns,
|
|
215
|
+
getRun,
|
|
216
|
+
getRunTraces,
|
|
217
|
+
listSessions,
|
|
218
|
+
getSessionTraces,
|
|
219
|
+
iterateTraceSpans,
|
|
220
|
+
iterateTraces,
|
|
221
|
+
iterateSessions
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
export { DEFAULT_INTELLIGENCE_BASE_URL, createIntelligenceClient };
|