@tangle-network/sandbox 0.9.2 → 0.9.3-develop.20260627012805.bf68a85
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-D3FqPlde.d.ts → client-BBb2p7y5.d.ts} +1 -1
- package/dist/client-CjqJUa22.js +2193 -0
- 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-Dy1fHLYz.d.ts → index-BY1_6xI7.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1180 -1
- package/dist/intelligence/index.js +225 -1
- package/dist/openai/index.js +1760 -1
- package/dist/{sandbox-B55j2q9K.d.ts → sandbox-BQQ2jhV3.d.ts} +14 -26
- package/dist/sandbox-FcVsLeUJ.js +4500 -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-DvdKAK94.js +831 -0
- package/package.json +4 -4
- package/dist/client-BBZ7YLmq.js +0 -1
- package/dist/sandbox-joKtQ5y3.js +0 -1
- package/dist/tangle-DM0o66lW.js +0 -1
|
@@ -1 +1,225 @@
|
|
|
1
|
-
function a0_0x37ee(){const _0x41ae2d=['\x43\x32\x4c\x30\x41\x67\x38','\x42\x33\x66\x77\x77\x4b\x38','\x72\x4d\x66\x50\x42\x67\x76\x4b\x69\x68\x72\x56\x69\x67\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71\x47\x44\x67\x38\x47\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x69\x65\x66\x71\x73\x74\x4f\x47','\x42\x4d\x76\x34\x44\x65\x6e\x31\x43\x4e\x6e\x56\x43\x47','\x79\x78\x62\x50\x73\x32\x76\x35','\x7a\x4d\x76\x30\x79\x32\x47','\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a\x6c\x57','\x6c\x33\x6e\x57\x79\x77\x35\x5a\x6c\x4d\x35\x4b\x41\x4e\x6e\x56\x42\x47','\x77\x4d\x44\x6b\x77\x65\x6d','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a','\x6d\x5a\x43\x57\x6d\x74\x75\x58\x76\x75\x76\x75\x76\x4b\x35\x49','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x7a\x4e\x6a\x56\x42\x71','\x77\x65\x6e\x6f\x76\x4e\x4f','\x73\x68\x50\x59\x79\x4d\x65','\x77\x66\x4c\x77\x43\x78\x75','\x71\x4d\x48\x72\x72\x67\x79','\x43\x31\x66\x69\x71\x78\x6d','\x43\x4e\x76\x55\x73\x77\x71','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x72\x30\x76\x75','\x42\x4d\x66\x54\x7a\x71','\x6d\x4a\x69\x31\x72\x67\x35\x68\x43\x66\x66\x70','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x72\x78\x48\x31\x43\x33\x6d','\x75\x30\x44\x65\x45\x78\x61','\x77\x4e\x48\x53\x77\x4e\x47','\x43\x67\x66\x59\x43\x32\x75','\x44\x78\x6e\x4c\x43\x4b\x4c\x4b','\x42\x67\x66\x49\x7a\x77\x57','\x43\x32\x76\x30','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d','\x44\x4d\x39\x76\x74\x66\x61','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d\x56','\x77\x4b\x76\x52\x74\x75\x69','\x44\x67\x76\x34\x44\x61','\x42\x32\x7a\x4d\x43\x32\x76\x30','\x6d\x74\x47\x30\x6d\x5a\x65\x5a\x6e\x67\x35\x59\x75\x33\x7a\x32\x7a\x71','\x71\x77\x6a\x56\x43\x4e\x72\x66\x43\x4e\x6a\x56\x43\x47','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x59\x38','\x6d\x5a\x43\x34\x6d\x74\x72\x72\x75\x4c\x7a\x31\x72\x78\x47','\x43\x32\x4c\x4e\x42\x4d\x66\x53','\x79\x4d\x35\x6b\x77\x77\x53','\x6d\x4a\x43\x31\x6e\x4b\x48\x4b\x77\x4b\x6e\x78\x73\x61','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x71','\x74\x4e\x44\x30\x71\x76\x4f','\x43\x33\x72\x48\x44\x68\x76\x5a','\x43\x32\x4c\x36\x7a\x71','\x73\x32\x39\x6e\x45\x4c\x71','\x7a\x32\x66\x30\x7a\x71','\x7a\x4e\x76\x4a\x76\x75\x75','\x6d\x74\x79\x57\x6d\x4a\x48\x32\x42\x30\x66\x6f\x41\x77\x6d','\x42\x67\x4c\x54\x41\x78\x71','\x42\x65\x39\x5a\x43\x75\x43','\x41\x66\x44\x49\x75\x4e\x47','\x6c\x33\x6e\x57\x79\x77\x35\x5a','\x6f\x64\x69\x30\x41\x78\x7a\x76\x41\x4b\x48\x75','\x7a\x32\x35\x4f\x72\x4e\x43','\x75\x76\x50\x79\x76\x31\x71','\x6f\x74\x6d\x33\x6d\x64\x43\x30\x75\x4d\x35\x4b\x77\x65\x66\x69','\x76\x31\x7a\x35\x71\x4c\x65','\x71\x4d\x76\x48\x43\x4d\x76\x59\x69\x61','\x79\x33\x76\x59\x43\x32\x39\x59','\x42\x77\x39\x4b\x7a\x77\x57','\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','\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','\x79\x77\x6a\x56\x43\x4e\x71','\x73\x32\x50\x70\x77\x4c\x65','\x6d\x5a\x75\x33\x6e\x76\x48\x5a\x73\x68\x72\x41\x75\x61','\x73\x4b\x44\x59\x75\x4b\x71','\x73\x75\x44\x75\x45\x78\x47','\x6d\x74\x47\x34\x6e\x4a\x65\x57\x72\x65\x4c\x35\x72\x65\x50\x4c','\x41\x78\x72\x4c\x42\x78\x6d'];a0_0x37ee=function(){return _0x41ae2d;};return a0_0x37ee();}const a0_0x926790=a0_0x942c;(function(_0x419132,_0x38f3fa){const _0x5793ee=a0_0x942c,_0x1a827=_0x419132();while(!![]){try{const _0x170b59=parseInt(_0x5793ee(0x9b))/0x1+parseInt(_0x5793ee(0x7a))/0x2+-parseInt(_0x5793ee(0x82))/0x3+parseInt(_0x5793ee(0x72))/0x4*(-parseInt(_0x5793ee(0x8b))/0x5)+-parseInt(_0x5793ee(0xb8))/0x6+-parseInt(_0x5793ee(0x6f))/0x7*(-parseInt(_0x5793ee(0x7f))/0x8)+parseInt(_0x5793ee(0xa8))/0x9*(parseInt(_0x5793ee(0x8e))/0xa);if(_0x170b59===_0x38f3fa)break;else _0x1a827['push'](_0x1a827['shift']());}catch(_0x3e9890){_0x1a827['push'](_0x1a827['shift']());}}}(a0_0x37ee,0x47c1a));import{f as a0_0x45dcc3,r as a0_0x3aed45,u as a0_0x360763}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_0x926790(0x88),DEFAULT_TIMEOUT_MS=0x7530;function a0_0x942c(_0x3239f4,_0x2c1c58){_0x3239f4=_0x3239f4-0x6d;const _0x37ee9e=a0_0x37ee();let _0x942cbe=_0x37ee9e[_0x3239f4];if(a0_0x942c['\x48\x47\x63\x55\x44\x4c']===undefined){var _0x561e15=function(_0xb9beee){const _0x26b739='\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 _0x3abbe9='',_0x11ee20='';for(let _0x42593f=0x0,_0x5e5f8f,_0x4e1776,_0x22fcc6=0x0;_0x4e1776=_0xb9beee['\x63\x68\x61\x72\x41\x74'](_0x22fcc6++);~_0x4e1776&&(_0x5e5f8f=_0x42593f%0x4?_0x5e5f8f*0x40+_0x4e1776:_0x4e1776,_0x42593f++%0x4)?_0x3abbe9+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x5e5f8f>>(-0x2*_0x42593f&0x6)):0x0){_0x4e1776=_0x26b739['\x69\x6e\x64\x65\x78\x4f\x66'](_0x4e1776);}for(let _0x5cb9a3=0x0,_0x2a0094=_0x3abbe9['\x6c\x65\x6e\x67\x74\x68'];_0x5cb9a3<_0x2a0094;_0x5cb9a3++){_0x11ee20+='\x25'+('\x30\x30'+_0x3abbe9['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x5cb9a3)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x11ee20);};a0_0x942c['\x47\x79\x58\x58\x65\x66']=_0x561e15,a0_0x942c['\x42\x6c\x4e\x54\x45\x65']={},a0_0x942c['\x48\x47\x63\x55\x44\x4c']=!![];}const _0x8760cf=_0x37ee9e[0x0],_0x51e1cd=_0x3239f4+_0x8760cf,_0x3a3f8f=a0_0x942c['\x42\x6c\x4e\x54\x45\x65'][_0x51e1cd];return!_0x3a3f8f?(_0x942cbe=a0_0x942c['\x47\x79\x58\x58\x65\x66'](_0x942cbe),a0_0x942c['\x42\x6c\x4e\x54\x45\x65'][_0x51e1cd]=_0x942cbe):_0x942cbe=_0x3a3f8f,_0x942cbe;}function appendParam(_0xecbbf3,_0x494bdd,_0x1c27f3){const _0x4d60f1=a0_0x926790,_0x9b5015={'\x45\x78\x75\x73\x73':function(_0x41591e,_0x709792){return _0x41591e===_0x709792;}};if(_0x9b5015[_0x4d60f1(0xaa)](_0x1c27f3,void 0x0))return;_0xecbbf3[_0x4d60f1(0xb0)](_0x494bdd,String(_0x1c27f3));}function createIntelligenceClient(_0x566bdc){const _0x32e36a=a0_0x926790,_0x550c16={'\x67\x6e\x68\x46\x77':function(_0x274bd8,_0xb5657a){return _0x274bd8 instanceof _0xb5657a;},'\x5a\x45\x6b\x4d\x42':_0x32e36a(0x6d),'\x4b\x6f\x4d\x7a\x54':function(_0x458e84,_0x36855f){return _0x458e84 instanceof _0x36855f;},'\x58\x59\x56\x71\x75':function(_0x500365,_0x2519b2){return _0x500365(_0x2519b2);},'\x43\x44\x59\x68\x41':function(_0x2f9ba6,_0x1d18ae){return _0x2f9ba6 instanceof _0x1d18ae;},'\x4b\x6a\x4f\x5a\x51':_0x32e36a(0xa9),'\x6f\x71\x56\x5a\x4f':function(_0x24fe13,_0x1f3666){return _0x24fe13(_0x1f3666);},'\x51\x5a\x58\x57\x54':function(_0x44933c,_0x3b49df,_0x3bf56b,_0x587e8b,_0x4ca110){return _0x44933c(_0x3b49df,_0x3bf56b,_0x587e8b,_0x4ca110);},'\x48\x45\x56\x6a\x56':_0x32e36a(0xa6),'\x58\x43\x4e\x56\x7a':function(_0xc1f0b3,_0x2d7d4b,_0x29ff44,_0x5a7720){return _0xc1f0b3(_0x2d7d4b,_0x29ff44,_0x5a7720);},'\x6c\x4f\x73\x71\x47':function(_0x55cca9,_0x18cf21,_0x464f47,_0x3f9d1e){return _0x55cca9(_0x18cf21,_0x464f47,_0x3f9d1e);},'\x6b\x79\x58\x6f\x49':function(_0x2ad491,_0x565dcd,_0xffcfff,_0xd77df9){return _0x2ad491(_0x565dcd,_0xffcfff,_0xd77df9);},'\x53\x47\x44\x79\x70':_0x32e36a(0x86),'\x42\x68\x51\x44\x66':'\x72\x75\x6e\x49\x64','\x4e\x77\x74\x41\x5a':function(_0x27216e,_0x446b5d){return _0x27216e(_0x446b5d);},'\x6e\x6e\x54\x51\x50':function(_0x2db757,_0x2c128d){return _0x2db757>_0x2c128d;},'\x42\x47\x41\x45\x58':function(_0x5788ce,_0x4daae7,_0x23a579,_0x3b36df){return _0x5788ce(_0x4daae7,_0x23a579,_0x3b36df);},'\x5a\x67\x4a\x58\x43':_0x32e36a(0x85),'\x76\x6f\x55\x4c\x50':_0x32e36a(0x87),'\x49\x47\x54\x79\x78':_0x32e36a(0x7b),'\x5a\x78\x6c\x5a\x78':function(_0x12cbcb,_0x189ac0,_0x25be5c,_0x3718da){return _0x12cbcb(_0x189ac0,_0x25be5c,_0x3718da);},'\x68\x57\x62\x52\x78':'\x66\x72\x6f\x6d','\x62\x6e\x4a\x59\x6b':_0x32e36a(0xaf),'\x57\x56\x79\x42\x51':function(_0x5a4b14,_0x1d7f13){return _0x5a4b14(_0x1d7f13);},'\x48\x7a\x72\x62\x61':function(_0x359258,_0x47b7d5){return _0x359258(_0x47b7d5);},'\x4a\x47\x72\x52\x44':function(_0x2f0ac8,_0x4aff52,_0x45cea8,_0x5ecd6e){return _0x2f0ac8(_0x4aff52,_0x45cea8,_0x5ecd6e);},'\x73\x51\x48\x41\x73':function(_0x28072c,_0x352de5){return _0x28072c>_0x352de5;},'\x66\x75\x63\x55\x45':function(_0x58aef0,_0x4a073c){return _0x58aef0(_0x4a073c);},'\x73\x69\x74\x68\x6f':'\x63\x72\x65\x61\x74\x65\x49\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x43\x6c\x69\x65\x6e\x74\x3a\x20\x61\x70\x69\x4b\x65\x79\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64'};if(!_0x566bdc['\x61\x70\x69\x4b\x65\x79'])throw new Error(_0x550c16[_0x32e36a(0x90)]);const _0x46ebfa=_0x566bdc[_0x32e36a(0x94)],_0x40cd54=(_0x566bdc[_0x32e36a(0x9c)]??_0x32e36a(0x88))[_0x32e36a(0x73)](/\/$/,''),_0x28858d=_0x566bdc[_0x32e36a(0xb3)]??DEFAULT_TIMEOUT_MS;async function _0x440764(_0x3c743c){const _0x6a8815=_0x32e36a,_0x78fd3a=''+_0x40cd54+_0x3c743c,_0x51eeb6=new AbortController(),_0x1c5c69=setTimeout(()=>_0x51eeb6[_0x6a8815(0x89)](),_0x28858d);try{return await globalThis[_0x6a8815(0x95)](_0x78fd3a,{'\x68\x65\x61\x64\x65\x72\x73':{'\x41\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\x6f\x6e':_0x6a8815(0x84)+_0x46ebfa,'\x41\x63\x63\x65\x70\x74':'\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x2f\x6a\x73\x6f\x6e'},'\x73\x69\x67\x6e\x61\x6c':_0x51eeb6[_0x6a8815(0x70)]});}catch(_0x5f2127){if(_0x550c16[_0x6a8815(0x80)](_0x5f2127,Error)&&_0x5f2127[_0x6a8815(0xa7)]===_0x550c16[_0x6a8815(0xb5)])throw new a0_0x360763(_0x28858d);throw new a0_0x3aed45(_0x6a8815(0x92)+(_0x550c16[_0x6a8815(0x77)](_0x5f2127,Error)?_0x5f2127['\x6d\x65\x73\x73\x61\x67\x65']:_0x550c16[_0x6a8815(0xa1)](String,_0x5f2127)),_0x550c16['\x43\x44\x59\x68\x41'](_0x5f2127,Error)?_0x5f2127:void 0x0,{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x3c743c,'\x6f\x72\x69\x67\x69\x6e':_0x550c16[_0x6a8815(0x8a)]});}finally{_0x550c16[_0x6a8815(0xa1)](clearTimeout,_0x1c5c69);}}async function _0x58691d(_0x3567d4){const _0x242378=_0x32e36a,_0x4f4f7d=await _0x550c16['\x6f\x71\x56\x5a\x4f'](_0x440764,_0x3567d4),_0x38dfa5=await _0x4f4f7d[_0x242378(0xb6)]();if(!_0x4f4f7d['\x6f\x6b'])throw _0x550c16[_0x242378(0x81)](a0_0x45dcc3,_0x4f4f7d['\x73\x74\x61\x74\x75\x73'],_0x38dfa5,{'\x6d\x65\x74\x68\x6f\x64':_0x550c16['\x48\x45\x56\x6a\x56'],'\x70\x61\x74\x68':_0x3567d4},_0x4f4f7d['\x68\x65\x61\x64\x65\x72\x73']);return JSON[_0x242378(0xad)](_0x38dfa5);}async function _0x4717ae(_0x4a27c7={}){const _0x1742b6=_0x32e36a,_0x130775=new URLSearchParams();return _0x550c16['\x58\x43\x4e\x56\x7a'](appendParam,_0x130775,_0x1742b6(0x7b),_0x4a27c7['\x6c\x69\x6d\x69\x74']),_0x550c16['\x6c\x4f\x73\x71\x47'](appendParam,_0x130775,_0x1742b6(0x9e),_0x4a27c7[_0x1742b6(0x9e)]),appendParam(_0x130775,'\x74\x6f',_0x4a27c7['\x74\x6f']),_0x550c16[_0x1742b6(0x9f)](appendParam,_0x130775,'\x71',_0x4a27c7['\x71']),_0x550c16['\x6b\x79\x58\x6f\x49'](appendParam,_0x130775,_0x550c16[_0x1742b6(0xab)],_0x4a27c7[_0x1742b6(0x86)]),appendParam(_0x130775,_0x550c16[_0x1742b6(0xa2)],_0x4a27c7[_0x1742b6(0xa4)]),_0x550c16[_0x1742b6(0x7c)](appendParam,_0x130775,_0x1742b6(0x75),_0x4a27c7[_0x1742b6(0x75)]),appendParam(_0x130775,'\x63\x75\x72\x73\x6f\x72',_0x4a27c7[_0x1742b6(0x85)]),_0x550c16['\x4e\x77\x74\x41\x5a'](_0x58691d,_0x1742b6(0x9d)+(_0x550c16['\x6e\x6e\x54\x51\x50'](_0x130775['\x73\x69\x7a\x65'],0x0)?'\x3f'+_0x130775:''));}async function _0x4531a0(_0xdecc93,_0x25659e={}){const _0x11c1db=_0x32e36a,_0x488e82=new URLSearchParams();_0x550c16['\x42\x47\x41\x45\x58'](appendParam,_0x488e82,_0x11c1db(0x7b),_0x25659e[_0x11c1db(0x7b)]),appendParam(_0x488e82,_0x550c16[_0x11c1db(0x99)],_0x25659e[_0x11c1db(0x85)]);const _0x1b7ec0=_0x488e82[_0x11c1db(0x76)]>0x0?'\x3f'+_0x488e82:'';return _0x550c16[_0x11c1db(0x74)](_0x58691d,_0x11c1db(0x6e)+_0x550c16[_0x11c1db(0x91)](encodeURIComponent,_0xdecc93)+_0x11c1db(0x7e)+_0x1b7ec0);}async function _0x1656c9(_0x17facf){const _0x25cf14=_0x32e36a,_0x122b4d='\x2f\x76\x31\x2f\x74\x72\x61\x63\x65\x73\x2f'+encodeURIComponent(_0x17facf)+_0x25cf14(0x98),_0x31348f=await _0x550c16[_0x25cf14(0x74)](_0x440764,_0x122b4d);if(!_0x31348f['\x6f\x6b']){const _0x340558=await _0x31348f['\x74\x65\x78\x74']();throw a0_0x45dcc3(_0x31348f[_0x25cf14(0x75)],_0x340558,{'\x6d\x65\x74\x68\x6f\x64':_0x550c16['\x48\x45\x56\x6a\x56'],'\x70\x61\x74\x68':_0x122b4d},_0x31348f[_0x25cf14(0xa5)]);}if(!_0x31348f['\x62\x6f\x64\x79'])throw new a0_0x3aed45(_0x550c16[_0x25cf14(0xb2)],{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x122b4d,'\x6f\x72\x69\x67\x69\x6e':_0x25cf14(0xa9)});return _0x31348f['\x62\x6f\x64\x79'];}async function _0x5d35a0(_0x5eab2f={}){const _0xa32bfc=_0x32e36a,_0x19f761=new URLSearchParams();return appendParam(_0x19f761,_0x550c16['\x49\x47\x54\x79\x78'],_0x5eab2f['\x6c\x69\x6d\x69\x74']),appendParam(_0x19f761,_0xa32bfc(0xb7),_0x5eab2f[_0xa32bfc(0xb7)]),_0x550c16[_0xa32bfc(0xac)](appendParam,_0x19f761,'\x73\x74\x61\x74\x75\x73',_0x5eab2f[_0xa32bfc(0x75)]),appendParam(_0x19f761,_0xa32bfc(0x78),_0x5eab2f[_0xa32bfc(0x78)]),appendParam(_0x19f761,'\x71',_0x5eab2f['\x71']),appendParam(_0x19f761,_0x550c16[_0xa32bfc(0x7d)],_0x5eab2f[_0xa32bfc(0x9e)]),appendParam(_0x19f761,'\x74\x6f',_0x5eab2f['\x74\x6f']),appendParam(_0x19f761,_0x550c16[_0xa32bfc(0x71)],_0x5eab2f[_0xa32bfc(0xaf)]),_0x550c16[_0xa32bfc(0x9f)](appendParam,_0x19f761,_0xa32bfc(0x85),_0x5eab2f[_0xa32bfc(0x85)]),_0x550c16[_0xa32bfc(0x83)](_0x58691d,_0xa32bfc(0xb1)+(_0x19f761[_0xa32bfc(0x76)]>0x0?'\x3f'+_0x19f761:''));}async function _0x45fd00(_0xedab03){const _0x244934=_0x32e36a;return _0x550c16[_0x244934(0xa0)](_0x58691d,_0x244934(0xb4)+_0x550c16[_0x244934(0x74)](encodeURIComponent,_0xedab03));}async function _0x527e65(_0x260e51){const _0x54606a=_0x32e36a;return _0x58691d(_0x54606a(0xb4)+encodeURIComponent(_0x260e51)+_0x54606a(0x96));}async function _0x2af1d8(_0x3d771c={}){const _0x285d3f=_0x32e36a,_0x1f2914=new URLSearchParams();return appendParam(_0x1f2914,_0x285d3f(0x7b),_0x3d771c['\x6c\x69\x6d\x69\x74']),_0x550c16['\x42\x47\x41\x45\x58'](appendParam,_0x1f2914,_0x285d3f(0x9e),_0x3d771c['\x66\x72\x6f\x6d']),appendParam(_0x1f2914,'\x74\x6f',_0x3d771c['\x74\x6f']),_0x550c16[_0x285d3f(0x8c)](appendParam,_0x1f2914,'\x71',_0x3d771c['\x71']),appendParam(_0x1f2914,'\x75\x73\x65\x72\x49\x64',_0x3d771c[_0x285d3f(0xae)]),_0x550c16[_0x285d3f(0x7c)](appendParam,_0x1f2914,_0x550c16['\x5a\x67\x4a\x58\x43'],_0x3d771c[_0x285d3f(0x85)]),_0x58691d(_0x285d3f(0x9a)+(_0x1f2914[_0x285d3f(0x76)]>0x0?'\x3f'+_0x1f2914:''));}async function _0x29bab9(_0x2c2c05,_0x1683d0={}){const _0x2e4708=_0x32e36a,_0x51b185=new URLSearchParams();appendParam(_0x51b185,_0x550c16[_0x2e4708(0x8d)],_0x1683d0[_0x2e4708(0x7b)]),appendParam(_0x51b185,_0x2e4708(0x85),_0x1683d0['\x63\x75\x72\x73\x6f\x72']);const _0x4612e6=_0x550c16[_0x2e4708(0xa3)](_0x51b185[_0x2e4708(0x76)],0x0)?'\x3f'+_0x51b185:'';return _0x58691d(_0x2e4708(0x97)+_0x550c16[_0x2e4708(0x79)](encodeURIComponent,_0x2c2c05)+'\x2f\x74\x72\x61\x63\x65\x73'+_0x4612e6);}async function*_0x12803e(_0x3c653a,_0x56200f={}){const _0x4da8c4=_0x32e36a;let _0x4b9de3=_0x56200f[_0x4da8c4(0x85)];for(;;){const _0x5f2ab7=await _0x4531a0(_0x3c653a,{..._0x56200f,'\x63\x75\x72\x73\x6f\x72':_0x4b9de3});for(const _0x25c4ad of _0x5f2ab7[_0x4da8c4(0x8f)])yield _0x25c4ad;if(!_0x5f2ab7[_0x4da8c4(0x93)])return;_0x4b9de3=_0x5f2ab7[_0x4da8c4(0x93)];}}async function*_0xd13da0(_0xa3a2d1={}){const _0x381bf5=_0x32e36a;let _0x97bf2a=_0xa3a2d1['\x63\x75\x72\x73\x6f\x72'];for(;;){const _0x4658c0=await _0x550c16[_0x381bf5(0x79)](_0x4717ae,{..._0xa3a2d1,'\x63\x75\x72\x73\x6f\x72':_0x97bf2a});for(const _0x12b0c2 of _0x4658c0[_0x381bf5(0x8f)])yield _0x12b0c2;if(!_0x4658c0[_0x381bf5(0x93)])return;_0x97bf2a=_0x4658c0[_0x381bf5(0x93)];}}async function*_0x303e43(_0x25de9a={}){const _0x5646ed=_0x32e36a;let _0xfa6f6c=_0x25de9a[_0x5646ed(0x85)];for(;;){const _0x3f3bc6=await _0x2af1d8({..._0x25de9a,'\x63\x75\x72\x73\x6f\x72':_0xfa6f6c});for(const _0x53c52b of _0x3f3bc6[_0x5646ed(0x8f)])yield _0x53c52b;if(!_0x3f3bc6[_0x5646ed(0x93)])return;_0xfa6f6c=_0x3f3bc6[_0x5646ed(0x93)];}}return{'\x6c\x69\x73\x74\x54\x72\x61\x63\x65\x73':_0x4717ae,'\x67\x65\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x4531a0,'\x65\x78\x70\x6f\x72\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73\x4e\x64\x6a\x73\x6f\x6e':_0x1656c9,'\x6c\x69\x73\x74\x52\x75\x6e\x73':_0x5d35a0,'\x67\x65\x74\x52\x75\x6e':_0x45fd00,'\x67\x65\x74\x52\x75\x6e\x54\x72\x61\x63\x65\x73':_0x527e65,'\x6c\x69\x73\x74\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x2af1d8,'\x67\x65\x74\x53\x65\x73\x73\x69\x6f\x6e\x54\x72\x61\x63\x65\x73':_0x29bab9,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x12803e,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x73':_0xd13da0,'\x69\x74\x65\x72\x61\x74\x65\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x303e43};}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 };
|