@tangle-network/sandbox 0.1.2 → 0.2.1
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/README.md +490 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +271 -1
- package/dist/client-Uve6A5C6.js +2280 -0
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +2 -1
- package/dist/collaboration-CRyb5e8F.js +201 -0
- package/dist/core.d.ts +3 -3
- package/dist/core.js +4 -1
- package/dist/errors-BI75IXOM.d.ts +1177 -0
- package/dist/errors-CljiGR__.js +262 -0
- package/dist/{index-BuS8nl3b.d.ts → index-CCsA3S0D.d.ts} +6 -1
- package/dist/{index-t7xkzv0U.d.ts → index-DhNGZ0h4.d.ts} +3 -3
- package/dist/{index-gA-oRjOi.d.ts → index-Dpj1oB5i.d.ts} +35 -4
- package/dist/index.d.ts +109 -62
- package/dist/index.js +825 -1
- package/dist/openai/index.d.ts +642 -0
- package/dist/openai/index.js +1721 -0
- package/dist/platform-integrations.d.ts +2 -0
- package/dist/platform-integrations.js +2 -0
- package/dist/{sandbox-BvZ0-Iv7.d.ts → sandbox-aBpWqler.d.ts} +1528 -41
- package/dist/sandbox-ksXTNlo-.js +3394 -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-DQ05paN7.js +826 -0
- package/package.json +93 -34
- package/LICENSE +0 -11
- package/dist/client-CcRvqt85.js +0 -1
- package/dist/collaboration-CVvhPU8M.js +0 -1
- package/dist/errors-AIT8qikt.d.ts +0 -491
- package/dist/errors-CdMTv7uG.js +0 -1
- package/dist/sandbox-D1JnQIJx.js +0 -1
- package/dist/tangle-CSb9rjAh.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1,825 @@
|
|
|
1
|
-
const a0_0x19904f=a0_0x3230;(function(_0x3648bd,_0x2b8cf0){const _0x32298d=a0_0x3230,_0x42d56a=_0x3648bd();while(!![]){try{const _0x409d73=parseInt(_0x32298d(0x16b))/0x1+parseInt(_0x32298d(0xdf))/0x2+parseInt(_0x32298d(0x128))/0x3+parseInt(_0x32298d(0x13e))/0x4*(parseInt(_0x32298d(0x116))/0x5)+-parseInt(_0x32298d(0xe3))/0x6+-parseInt(_0x32298d(0x12a))/0x7*(-parseInt(_0x32298d(0xd1))/0x8)+-parseInt(_0x32298d(0x12f))/0x9*(parseInt(_0x32298d(0x13c))/0xa);if(_0x409d73===_0x2b8cf0)break;else _0x42d56a['push'](_0x42d56a['shift']());}catch(_0x2044e5){_0x42d56a['push'](_0x42d56a['shift']());}}}(a0_0x1440,0x50f78));import{a as a0_0x3ad4b0,c as a0_0x427603,i as a0_0x365b61,l as a0_0x130e64,n as a0_0x57997c,o as a0_0x362c35,r as a0_0x5cd204,s as a0_0xbbf367,t as a0_0x22b245}from'\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x43\x64\x4d\x54\x76\x37\x75\x47\x2e\x6a\x73';import{r as a0_0x2fc8c1,t as a0_0x5beb7d}from'\x2e\x2f\x73\x61\x6e\x64\x62\x6f\x78\x2d\x44\x31\x4a\x6e\x51\x49\x4a\x78\x2e\x6a\x73';import{t as a0_0x26b452}from'\x2e\x2f\x63\x6c\x69\x65\x6e\x74\x2d\x43\x63\x52\x76\x71\x74\x38\x35\x2e\x6a\x73';import{a as a0_0x36e901,i as a0_0x5366ae,n as a0_0x4b1a97,r as a0_0x2f0422,t as a0_0x576a4f}from'\x2e\x2f\x63\x6f\x6c\x6c\x61\x62\x6f\x72\x61\x74\x69\x6f\x6e\x2d\x43\x56\x76\x68\x50\x55\x38\x4d\x2e\x6a\x73';function a0_0x1440(){const _0x3c956a=['\x6d\x4a\x69\x59\x6f\x67\x66\x49\x42\x31\x76\x68\x71\x47','\x69\x63\x61\x47\x69\x67\x31\x50\x79\x33\x6a\x56\x42\x77\x66\x54\x79\x4d\x65\x47\x43\x32\x48\x4c\x42\x67\x57\x47\x41\x77\x35\x50\x44\x63\x61\x54\x43\x59\x62\x49\x79\x78\x6e\x4f\x69\x63\x31\x57\x69\x63\x39\x56\x43\x68\x71\x56\x79\x32\x39\x55\x7a\x67\x65','\x44\x67\x39\x56\x42\x68\x6d','\x69\x63\x61\x47\x69\x67\x31\x50\x79\x33\x6a\x56\x42\x77\x66\x54\x79\x4d\x65\x47\x79\x32\x58\x4c\x79\x77\x34\x47\x6c\x73\x31\x48\x42\x67\x57\x47\x6c\x73\x31\x35\x7a\x78\x6d','\x69\x63\x61\x47\x69\x67\x66\x57\x44\x63\x31\x4e\x7a\x78\x71\x47\x41\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x61\x54\x45\x73\x61\x54\x6c\x77\x35\x56\x6c\x77\x4c\x55\x43\x33\x72\x48\x42\x67\x57\x54\x43\x4d\x76\x4a\x42\x32\x31\x54\x7a\x77\x35\x4b\x43\x59\x61','\x69\x68\x62\x35\x44\x67\x48\x56\x42\x47','\x69\x63\x61\x47\x69\x67\x31\x32\x69\x67\x6a\x50\x42\x49\x39\x54\x41\x77\x6e\x59\x42\x32\x31\x48\x42\x77\x6a\x48\x69\x63\x39\x31\x43\x33\x69\x56\x42\x67\x39\x4a\x79\x77\x57\x56\x79\x4d\x4c\x55\x6c\x59\x61\x4d\x6a\x49\x62\x43','\x43\x32\x58\x50\x79\x32\x75','\x72\x4d\x66\x74\x41\x77\x4f','\x42\x32\x35\x67\x79\x77\x4c\x53\x44\x78\x6a\x4c','\x44\x67\x76\x4c\x71\x78\x72\x30\x7a\x78\x6e\x30\x79\x78\x72\x50\x42\x32\x35\x6b\x43\x32\x39\x55','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x34','\x71\x4e\x76\x50\x42\x67\x71\x47\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x76\x4b\x69\x67\x6a\x31\x44\x63\x62\x55\x42\x59\x62\x59\x7a\x78\x6e\x31\x42\x68\x71\x47\x43\x4d\x76\x4a\x7a\x77\x4c\x32\x7a\x77\x71','\x7a\x32\x76\x30\x75\x4d\x76\x48\x7a\x67\x76\x59','\x7a\x32\x76\x30','\x43\x32\x48\x48\x6d\x4a\x75\x32','\x79\x32\x39\x55\x44\x67\x4c\x55\x44\x77\x76\x70\x42\x4b\x7a\x48\x41\x77\x58\x31\x43\x4d\x75','\x75\x32\x76\x4a\x44\x78\x6a\x4c\x69\x68\x6a\x48\x42\x4d\x72\x56\x42\x73\x62\x55\x42\x32\x35\x4a\x7a\x73\x62\x4e\x7a\x77\x35\x4c\x43\x4d\x66\x30\x41\x77\x39\x55\x69\x67\x4c\x5a\x69\x67\x35\x56\x44\x63\x62\x48\x44\x4d\x66\x50\x42\x67\x66\x49\x42\x67\x75','\x42\x4d\x58\x4e\x77\x67\x6d','\x79\x77\x72\x4b\x75\x67\x66\x4a\x41\x32\x66\x4e\x7a\x78\x6e\x67\x43\x4d\x39\x54\x72\x4d\x4c\x53\x7a\x71','\x43\x33\x62\x4c\x79\x57','\x42\x67\x76\x54\x74\x78\x65','\x41\x77\x35\x30\x7a\x78\x6a\x32\x79\x77\x58\x6e\x43\x57','\x79\x32\x39\x55\x7a\x67\x65','\x77\x65\x50\x31\x42\x68\x61','\x42\x77\x6a\x67\x74\x4c\x75','\x43\x67\x76\x59\x42\x77\x4c\x5a\x43\x32\x4c\x56\x42\x4e\x6d','\x43\x33\x76\x49\x44\x67\x58\x4c','\x71\x76\x6a\x68\x69\x61','\x6c\x33\x79\x58\x6c\x32\x4c\x54\x79\x77\x44\x4c\x43\x57','\x75\x30\x48\x62\x6c\x74\x69\x31\x6e\x47','\x43\x32\x4c\x4e\x42\x4d\x66\x53','\x43\x67\x66\x59\x43\x32\x75','\x41\x77\x35\x4a\x42\x68\x76\x4b\x7a\x78\x6d','\x79\x78\x72\x30\x7a\x78\x6e\x30\x79\x78\x72\x50\x42\x32\x34','\x77\x4d\x39\x75\x7a\x32\x71','\x7a\x32\x4c\x30\x41\x68\x76\x49','\x72\x4c\x6a\x70\x74\x73\x61','\x44\x78\x62\x4b\x79\x78\x72\x4c','\x6c\x77\x6d\x47','\x44\x67\x39\x74\x44\x68\x6a\x50\x42\x4d\x43','\x79\x32\x39\x54\x42\x77\x66\x55\x7a\x68\x6d','\x42\x67\x66\x49\x7a\x77\x58\x5a','\x79\x75\x4c\x74\x75\x65\x65','\x43\x68\x6a\x56\x42\x78\x62\x30','\x6d\x4a\x61\x35\x6e\x64\x79\x33\x7a\x31\x72\x59\x41\x30\x50\x76','\x43\x67\x4c\x57\x69\x67\x4c\x55\x43\x33\x72\x48\x42\x67\x57\x47\x6c\x78\x69\x47','\x79\x4d\x66\x5a\x7a\x75\x4c\x54\x79\x77\x44\x4c','\x6c\x77\x72\x50\x43\x33\x72\x31\x44\x67\x4c\x53\x43\x59\x61\x4d\x6a\x49\x62\x43','\x43\x32\x48\x48\x6d\x4a\x75\x32\x6f\x47','\x76\x65\x76\x66\x69\x67\x66\x30\x44\x67\x76\x5a\x44\x67\x66\x30\x41\x77\x39\x55\x69\x67\x48\x4c\x79\x78\x6a\x30\x79\x4d\x76\x48\x44\x63\x62\x50\x43\x59\x62\x5a\x44\x67\x39\x57\x43\x67\x76\x4b','\x44\x77\x6a\x31\x42\x4e\x72\x31','\x79\x78\x72\x30\x7a\x78\x6e\x30\x79\x78\x72\x50\x42\x32\x35\x6f\x42\x32\x35\x4a\x7a\x71','\x7a\x32\x76\x30\x76\x67\x76\x4c\x71\x78\x72\x30\x7a\x78\x6e\x30\x79\x78\x72\x50\x42\x32\x34','\x69\x63\x61\x47\x69\x67\x66\x57\x44\x63\x31\x4e\x7a\x78\x71\x47\x79\x32\x58\x4c\x79\x77\x34\x47\x6a\x49\x79\x47\x43\x4d\x30\x47\x6c\x78\x6a\x4d\x69\x63\x39\x32\x79\x78\x69\x56\x42\x67\x4c\x49\x6c\x32\x66\x57\x44\x63\x39\x53\x41\x78\x6e\x30\x43\x59\x38\x51','\x44\x67\x66\x4e','\x44\x67\x76\x34\x44\x63\x39\x4c\x44\x4d\x76\x55\x44\x63\x31\x5a\x44\x68\x6a\x4c\x79\x77\x30','\x41\x4d\x39\x50\x42\x47','\x44\x32\x39\x59\x41\x32\x72\x50\x43\x47','\x6e\x64\x79\x31\x6e\x74\x6d\x32\x6f\x68\x6e\x32\x76\x75\x39\x55\x44\x47','\x42\x4d\x66\x54\x7a\x71','\x79\x78\x76\x30\x42\x57','\x74\x65\x66\x63\x72\x75\x57\x47','\x42\x77\x66\x57','\x43\x32\x39\x59\x44\x61','\x76\x65\x76\x66\x69\x67\x66\x30\x44\x67\x76\x5a\x44\x67\x66\x30\x41\x77\x39\x55\x69\x68\x6a\x4c\x43\x33\x62\x56\x42\x4e\x6e\x4c\x69\x67\x35\x56\x42\x4d\x6e\x4c\x69\x67\x72\x50\x7a\x63\x62\x55\x42\x33\x71\x47\x42\x77\x66\x30\x79\x32\x47\x47\x79\x32\x48\x48\x42\x67\x58\x4c\x42\x4d\x44\x4c','\x43\x33\x76\x49\x79\x77\x44\x4c\x42\x4e\x72\x5a','\x41\x77\x31\x54\x7a\x77\x72\x50\x79\x78\x72\x4c','\x43\x67\x58\x48\x44\x67\x7a\x56\x43\x4d\x30','\x41\x67\x76\x34','\x79\x32\x58\x50\x7a\x77\x35\x30\x71\x32\x39\x55\x7a\x4d\x4c\x4e','\x42\x32\x35\x71\x43\x4d\x39\x4e\x43\x4d\x76\x5a\x43\x57','\x69\x59\x62\x6a\x42\x4e\x6e\x30\x79\x77\x58\x53\x69\x68\x6e\x35\x43\x33\x72\x4c\x42\x73\x62\x57\x79\x77\x6e\x52\x79\x77\x44\x4c\x43\x57','\x6d\x5a\x65\x57\x6e\x5a\x47\x34\x43\x4b\x50\x69\x43\x31\x50\x79','\x79\x32\x48\x48\x42\x4d\x35\x4c\x42\x68\x6d','\x79\x77\x6a\x56\x43\x4e\x72\x4c\x7a\x61','\x43\x67\x66\x4a\x41\x32\x66\x4e\x7a\x78\x6d','\x6d\x5a\x75\x35\x6f\x74\x75\x34\x45\x67\x35\x4d\x7a\x78\x76\x62','\x79\x32\x39\x54\x43\x68\x76\x30\x7a\x75\x4c\x4b','\x44\x68\x4c\x57\x7a\x71','\x43\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x76\x5a','\x79\x77\x6a\x56\x43\x4e\x71','\x7a\x77\x35\x30\x43\x4d\x4c\x4c\x43\x57','\x75\x4c\x76\x6f\x69\x67\x6e\x31\x43\x4d\x57\x47\x6c\x75\x58\x5a\x69\x67\x48\x30\x44\x68\x62\x5a\x6f\x49\x38\x56\x42\x77\x4c\x4a\x43\x4d\x38\x55\x42\x77\x66\x54\x79\x4d\x65\x55\x43\x67\x30\x56\x79\x78\x62\x50\x6c\x32\x31\x50\x79\x33\x6a\x56\x42\x77\x66\x54\x79\x4d\x65\x56\x42\x67\x4c\x55\x44\x78\x47\x54\x6e\x4a\x71\x56\x42\x67\x66\x30\x7a\x78\x6e\x30\x69\x68\x57\x47\x44\x67\x66\x59\x69\x63\x31\x34\x44\x4d\x4f\x47\x79\x4d\x4c\x55\x6c\x32\x31\x50\x79\x33\x6a\x56\x42\x77\x66\x54\x79\x4d\x65\x47\x6a\x49\x79\x47\x78\x61','\x75\x4c\x76\x6f\x69\x61','\x43\x4d\x76\x48\x7a\x61','\x73\x4b\x35\x68\x79\x30\x6d','\x7a\x67\x66\x30\x79\x74\x4f\x47','\x44\x4d\x76\x59\x41\x77\x7a\x35','\x69\x64\x65\x47\x6a\x49\x79\x47\x78\x61','\x69\x63\x61\x47\x69\x67\x66\x57\x44\x63\x31\x4e\x7a\x78\x71\x47\x41\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x61\x54\x45\x73\x62\x5a\x42\x32\x7a\x30\x44\x32\x66\x59\x7a\x73\x31\x57\x43\x4d\x39\x57\x7a\x78\x6a\x30\x41\x77\x76\x5a\x6c\x77\x6e\x56\x42\x77\x31\x56\x42\x49\x61\x4d\x6a\x49\x62\x43','\x7a\x32\x76\x55\x7a\x78\x6a\x48\x44\x67\x76\x65\x42\x32\x6e\x52\x7a\x78\x6a\x4d\x41\x77\x58\x4c','\x79\x33\x6a\x4c\x79\x78\x72\x4c','\x77\x67\x31\x55\x73\x4e\x71','\x75\x4c\x76\x6f\x69\x68\x62\x50\x43\x63\x62\x50\x42\x4e\x6e\x30\x79\x77\x58\x53\x69\x63\x30\x54\x42\x4d\x38\x54\x79\x32\x66\x4a\x41\x67\x75\x54\x7a\x67\x4c\x59\x69\x61','\x7a\x4d\x4c\x53\x7a\x78\x6d','\x75\x67\x66\x52\x44\x67\x4f','\x6c\x78\x7a\x4c\x42\x4e\x79\x47\x43\x68\x4c\x30\x41\x67\x39\x55','\x75\x4c\x76\x6f\x69\x67\x66\x57\x44\x63\x31\x4e\x7a\x78\x71\x47\x44\x78\x62\x4b\x79\x78\x72\x4c\x69\x63\x79\x4d\x69\x66\x57','\x69\x63\x79\x4d\x69\x66\x57','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x7a\x65\x66\x30','\x43\x33\x72\x59\x41\x77\x35\x4e','\x79\x77\x72\x4b\x72\x78\x7a\x4c\x42\x4e\x72\x6d\x41\x78\x6e\x30\x7a\x77\x35\x4c\x43\x47','\x42\x77\x76\x30\x79\x77\x72\x48\x44\x67\x65','\x7a\x32\x76\x30\x75\x4d\x66\x55\x7a\x67\x39\x54\x76\x4d\x66\x53\x44\x77\x76\x5a','\x79\x78\x62\x50\x73\x32\x76\x35','\x7a\x4e\x6a\x56\x42\x75\x4c\x4b','\x76\x30\x39\x73\x73\x30\x72\x6a\x75\x49\x61','\x43\x32\x76\x4a\x43\x4d\x76\x30\x43\x57','\x79\x78\x62\x30\x75\x67\x66\x4a\x41\x32\x66\x4e\x7a\x78\x6d','\x44\x78\x6e\x4c\x43\x47','\x7a\x67\x76\x4a\x42\x32\x72\x4c','\x45\x4b\x6e\x78\x7a\x4b\x34','\x6d\x4e\x57\x30\x46\x64\x66\x38\x6d\x33\x57\x57','\x79\x77\x35\x48\x79\x32\x39\x55\x7a\x67\x65','\x7a\x78\x7a\x4c\x42\x4e\x71','\x42\x77\x6e\x57','\x7a\x67\x4c\x4e\x7a\x78\x6e\x30','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x79\x32\x39\x55\x7a\x4d\x4c\x4b\x7a\x77\x35\x30\x41\x77\x66\x53','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x75\x66\x30\x44\x67\x76\x5a\x44\x67\x66\x30\x41\x77\x39\x55','\x79\x76\x6a\x4b\x73\x4b\x57','\x44\x77\x6a\x31\x42\x4e\x72\x31\x6f\x4a\x69\x59\x6c\x4a\x61\x30','\x69\x59\x62\x6a\x42\x4e\x6e\x30\x79\x77\x58\x53\x69\x66\x62\x35\x44\x67\x48\x56\x42\x49\x62\x57\x79\x77\x6e\x52\x79\x77\x44\x4c\x43\x57','\x69\x59\x62\x6a\x42\x4e\x6e\x30\x79\x77\x58\x53\x69\x66\x62\x35\x44\x67\x48\x56\x42\x49\x61','\x7a\x78\x6a\x59\x42\x33\x69','\x7a\x77\x35\x32','\x41\x32\x76\x35\x43\x57','\x6e\x74\x65\x59\x6e\x76\x44\x67\x7a\x67\x76\x32\x74\x71','\x79\x32\x58\x50\x7a\x77\x35\x30','\x7a\x4e\x6a\x56\x42\x75\x6a\x31\x41\x77\x58\x4b\x75\x4d\x76\x5a\x44\x77\x58\x30','\x44\x32\x4c\x30\x41\x65\x6e\x53\x41\x77\x76\x55\x44\x61','\x75\x65\x39\x74\x76\x61','\x42\x4d\x39\x64\x79\x77\x6e\x4f\x7a\x71','\x43\x68\x4c\x30\x41\x67\x39\x55','\x41\x4e\x6e\x56\x42\x47','\x43\x68\x6a\x56\x7a\x33\x6a\x4c\x43\x33\x6d','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x72\x4e\x6a\x64\x44\x30\x30','\x7a\x4e\x6a\x56\x42\x71','\x79\x32\x39\x54\x43\x67\x58\x4c\x44\x67\x75','\x43\x33\x62\x53\x41\x78\x71','\x69\x63\x61\x47\x69\x67\x66\x57\x44\x63\x31\x4e\x7a\x78\x71\x47\x41\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x61\x54\x45\x73\x62\x57\x45\x78\x72\x4f\x42\x32\x34','\x42\x32\x35\x74\x44\x77\x6e\x4a\x7a\x78\x6e\x5a','\x75\x4c\x76\x6f\x69\x67\x31\x50\x79\x33\x6a\x56\x42\x77\x66\x54\x79\x4d\x65\x47\x41\x77\x35\x5a\x44\x67\x66\x53\x42\x63\x61\x54\x45\x73\x61\x54\x42\x49\x62\x49\x79\x78\x6e\x4c\x69\x61','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x6e\x64\x6d\x59\x6f\x64\x75\x34\x74\x65\x31\x34\x43\x65\x44\x56','\x43\x68\x4c\x30\x41\x67\x39\x55\x76\x4d\x76\x59\x43\x32\x4c\x56\x42\x47','\x6e\x31\x50\x68\x73\x4b\x76\x74\x71\x71','\x76\x65\x58\x65\x44\x65\x79','\x71\x4b\x39\x6f\x41\x76\x43','\x79\x33\x6a\x35\x43\x68\x72\x56','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x63\x31\x30\x45\x78\x62\x4c','\x6e\x4a\x75\x31\x6d\x4b\x31\x67\x41\x75\x4c\x34\x7a\x61','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x41\x77\x35\x5a\x44\x68\x6a\x31\x79\x33\x72\x50\x42\x32\x35\x5a','\x7a\x78\x48\x30\x7a\x77\x35\x5a\x41\x77\x39\x55\x43\x57','\x44\x67\x66\x55\x7a\x32\x58\x4c\x6c\x77\x4c\x54\x79\x77\x44\x4c\x6f\x47','\x43\x68\x76\x5a\x41\x61','\x43\x67\x66\x4b\x75\x33\x72\x48\x43\x4e\x71','\x7a\x4e\x6a\x56\x42\x75\x72\x56\x79\x32\x54\x4c\x43\x4d\x7a\x50\x42\x67\x75','\x41\x65\x58\x7a\x41\x77\x38','\x42\x4d\x39\x4b\x7a\x74\x50\x4a\x43\x4e\x4c\x57\x44\x67\x38','\x79\x4e\x76\x50\x42\x67\x72\x62\x43\x4d\x44\x5a','\x74\x4d\x58\x4c\x43\x4c\x47','\x76\x4c\x7a\x65\x75\x78\x4f','\x6d\x74\x43\x30\x6e\x74\x62\x31\x75\x67\x54\x53\x72\x30\x38','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57'];a0_0x1440=function(){return _0x3c956a;};return a0_0x1440();}import{t as a0_0x337e35}from'\x2e\x2f\x74\x61\x6e\x67\x6c\x65\x2d\x43\x53\x62\x39\x72\x6a\x41\x68\x2e\x6a\x73';function defineInlineResource(_0x4dedb9,_0x17855e){return{'\x6b\x69\x6e\x64':'\x69\x6e\x6c\x69\x6e\x65','\x6e\x61\x6d\x65':_0x4dedb9,'\x63\x6f\x6e\x74\x65\x6e\x74':_0x17855e};}function defineGitHubResource(_0x4ca498,_0x143674={}){const _0x4e2c1c=a0_0x3230;return{'\x6b\x69\x6e\x64':_0x4e2c1c(0x162),'\x70\x61\x74\x68':_0x4ca498,'\x72\x65\x66':_0x143674['\x72\x65\x66'],'\x6e\x61\x6d\x65':_0x143674[_0x4e2c1c(0xd2)]};}function defineAgentProfile(_0x144f8c){return _0x144f8c;}function mergeStringArrays(_0x3705c1,_0xf4509d){if(!_0x3705c1&&!_0xf4509d)return void 0x0;return[..._0x3705c1??[],..._0xf4509d??[]];}function mergeRecord(_0x2d3a4c,_0x1c2c74){if(!_0x2d3a4c&&!_0x1c2c74)return void 0x0;return{..._0x2d3a4c??{},..._0x1c2c74??{}};}function mergeAgentProfiles(_0x339424,_0x30d742){const _0x2fbb10=a0_0x3230,_0x477b9e={'\x46\x72\x43\x77\x4d':function(_0xb619df,_0x723913,_0x4d7c78){return _0xb619df(_0x723913,_0x4d7c78);},'\x68\x4c\x59\x69\x6f':function(_0x20736b,_0x531895){return _0x20736b??_0x531895;},'\x56\x56\x44\x51\x7a':function(_0xdadeb6,_0x387e1a,_0x4321f7){return _0xdadeb6(_0x387e1a,_0x4321f7);}};if(!_0x339424&&!_0x30d742)return void 0x0;const _0x3505f6=_0x339424?.['\x70\x72\x6f\x6d\x70\x74']||_0x30d742?.[_0x2fbb10(0x16a)]?{..._0x339424?.[_0x2fbb10(0x16a)]??{},..._0x30d742?.[_0x2fbb10(0x16a)]??{},'\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73':_0x477b9e[_0x2fbb10(0x120)](mergeStringArrays,_0x339424?.[_0x2fbb10(0x16a)]?.['\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73'],_0x30d742?.[_0x2fbb10(0x16a)]?.[_0x2fbb10(0x131)])}:void 0x0,_0x8b5be=_0x339424?.['\x72\x65\x73\x6f\x75\x72\x63\x65\x73']||_0x30d742?.[_0x2fbb10(0xe6)]?{..._0x339424?.[_0x2fbb10(0xe6)]??{},..._0x30d742?.['\x72\x65\x73\x6f\x75\x72\x63\x65\x73']??{},'\x66\x69\x6c\x65\x73':[..._0x339424?.[_0x2fbb10(0xe6)]?.[_0x2fbb10(0xf5)]??[],..._0x30d742?.[_0x2fbb10(0xe6)]?.[_0x2fbb10(0xf5)]??[]],'\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73':_0x30d742?.[_0x2fbb10(0xe6)]?.[_0x2fbb10(0x131)]??_0x339424?.[_0x2fbb10(0xe6)]?.['\x69\x6e\x73\x74\x72\x75\x63\x74\x69\x6f\x6e\x73']}:void 0x0;return{..._0x339424??{},..._0x477b9e[_0x2fbb10(0x137)](_0x30d742,{}),'\x70\x72\x6f\x6d\x70\x74':_0x3505f6,'\x70\x65\x72\x6d\x69\x73\x73\x69\x6f\x6e\x73':_0x477b9e['\x46\x72\x43\x77\x4d'](mergeRecord,_0x339424?.['\x70\x65\x72\x6d\x69\x73\x73\x69\x6f\x6e\x73'],_0x30d742?.[_0x2fbb10(0x158)]),'\x74\x6f\x6f\x6c\x73':mergeRecord(_0x339424?.['\x74\x6f\x6f\x6c\x73'],_0x30d742?.[_0x2fbb10(0x140)]),'\x6d\x63\x70':_0x477b9e['\x46\x72\x43\x77\x4d'](mergeRecord,_0x339424?.[_0x2fbb10(0x10a)],_0x30d742?.[_0x2fbb10(0x10a)]),'\x73\x75\x62\x61\x67\x65\x6e\x74\x73':mergeRecord(_0x339424?.[_0x2fbb10(0xd8)],_0x30d742?.[_0x2fbb10(0xd8)]),'\x72\x65\x73\x6f\x75\x72\x63\x65\x73':_0x8b5be,'\x6d\x65\x74\x61\x64\x61\x74\x61':mergeRecord(_0x339424?.['\x6d\x65\x74\x61\x64\x61\x74\x61'],_0x30d742?.[_0x2fbb10(0xfd)]),'\x65\x78\x74\x65\x6e\x73\x69\x6f\x6e\x73':_0x477b9e[_0x2fbb10(0x13b)](mergeRecord,_0x339424?.[_0x2fbb10(0x132)],_0x30d742?.[_0x2fbb10(0x132)])};}function generateAttestationNonce(_0x1f1e20=0x20){const _0x1a4111=a0_0x3230,_0x361cb8={'\x6c\x65\x6d\x4d\x71':'\x75\x6e\x64\x65\x66\x69\x6e\x65\x64'},_0x3812ca=new Uint8Array(_0x1f1e20);if(typeof globalThis['\x63\x72\x79\x70\x74\x6f']!==_0x361cb8[_0x1a4111(0x153)]&&typeof globalThis['\x63\x72\x79\x70\x74\x6f'][_0x1a4111(0xfe)]===_0x1a4111(0x149))globalThis[_0x1a4111(0x12d)][_0x1a4111(0xfe)](_0x3812ca);else throw new Error(_0x1a4111(0x14f));return Array[_0x1a4111(0x121)](_0x3812ca)[_0x1a4111(0xd5)](_0x5b4ead=>_0x5b4ead[_0x1a4111(0x166)](0x10)[_0x1a4111(0x135)](0x2,'\x30'))[_0x1a4111(0xcf)]('');}async function createConfidentialSandbox(_0x17e084,_0xed45d){const _0x5929f6=a0_0x3230,_0x4fe7f6={'\x61\x49\x53\x50\x41':_0x5929f6(0xd3),'\x6d\x67\x6c\x47\x49':'\x54\x45\x45\x20\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x20\x77\x61\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64\x20\x62\x75\x74\x20\x6e\x6f\x20\x65\x76\x69\x64\x65\x6e\x63\x65\x20\x77\x61\x73\x20\x72\x65\x74\x75\x72\x6e\x65\x64'},_0x1c8641=_0xed45d[_0x5929f6(0xca)]===_0x4fe7f6[_0x5929f6(0x169)]||_0xed45d[_0x5929f6(0x10e)]&&!_0xed45d[_0x5929f6(0xca)]&&!_0xed45d[_0x5929f6(0x10d)][_0x5929f6(0xca)]?generateAttestationNonce():_0xed45d[_0x5929f6(0xca)]??_0xed45d[_0x5929f6(0x10d)][_0x5929f6(0xca)],_0x373984=await _0x17e084[_0x5929f6(0xf2)]({..._0xed45d,'\x63\x6f\x6e\x66\x69\x64\x65\x6e\x74\x69\x61\x6c':{..._0xed45d['\x63\x6f\x6e\x66\x69\x64\x65\x6e\x74\x69\x61\x6c'],..._0x1c8641?{'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x4e\x6f\x6e\x63\x65':_0x1c8641}:{},'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x52\x65\x66\x72\x65\x73\x68':_0xed45d[_0x5929f6(0x10d)]['\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x52\x65\x66\x72\x65\x73\x68']||Boolean(_0x1c8641)}});let _0x2e4c39=attestationFromMetadata(_0x373984['\x6d\x65\x74\x61\x64\x61\x74\x61']);if(!_0x2e4c39)try{_0x2e4c39=(await _0x373984['\x67\x65\x74\x54\x65\x65\x41\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e'](_0x1c8641?{'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x4e\x6f\x6e\x63\x65':_0x1c8641}:void 0x0))[_0x5929f6(0x160)];}catch(_0x347ed4){if(_0xed45d['\x72\x65\x71\x75\x69\x72\x65\x41\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e'])throw _0x347ed4;}if(_0xed45d[_0x5929f6(0x10e)]&&!_0x2e4c39)throw new Error(_0x4fe7f6['\x6d\x67\x6c\x47\x49']);return{'\x73\x61\x6e\x64\x62\x6f\x78':_0x373984,'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e':_0x2e4c39,'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x4e\x6f\x6e\x63\x65':_0x1c8641};}function attestationFromMetadata(_0x266682){const _0x277464=a0_0x3230,_0x219315=_0x266682?.[_0x277464(0x148)];if(typeof _0x219315!==_0x277464(0xfb)||_0x219315['\x74\x72\x69\x6d']()==='')return void 0x0;try{return JSON[_0x277464(0x15e)](_0x219315);}catch{return;}}function startTeeAttestationHeartbeat(_0x398bd0,_0x4df2e0={}){const _0x321026=a0_0x3230,_0x4e81bf={'\x4a\x52\x41\x56\x72':function(_0x5737e9){return _0x5737e9?.();},'\x58\x6d\x6e\x4a\x74':_0x321026(0x170),'\x6d\x62\x46\x4e\x55':function(_0x2b47e9,_0x21a6f6){return _0x2b47e9!==_0x21a6f6;},'\x50\x61\x6b\x74\x6a':_0x321026(0xd7),'\x58\x4a\x75\x6c\x70':function(_0x2636dc){return _0x2636dc();},'\x5a\x6f\x54\x67\x64':function(_0x2d8591){return _0x2d8591();}},_0x65698=_0x4df2e0[_0x321026(0x154)]??0xea60;let _0x25b653=![],_0x4e32a0=0x0,_0x218d3c=0x0,_0x3b65d2,_0x17f7b1,_0x1d3388;const _0x4706c8=new Promise(_0x10c9f3=>{_0x1d3388=_0x10c9f3;}),_0x132874=()=>{if(_0x25b653)return;_0x25b653=!![];if(_0x17f7b1)clearTimeout(_0x17f7b1);_0x4e81bf['\x4a\x52\x41\x56\x72'](_0x1d3388);},_0x4e24e5=async()=>{const _0x3baf8e=_0x321026;if(_0x25b653||_0x4df2e0[_0x3baf8e(0x15d)]?.[_0x3baf8e(0xe1)])throw new Error(_0x4e81bf[_0x3baf8e(0xf3)]);const _0x448b7a=generateAttestationNonce(),_0x9d9342=await _0x398bd0[_0x3baf8e(0xcb)]({'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x4e\x6f\x6e\x63\x65':_0x448b7a});if(_0x9d9342[_0x3baf8e(0xca)]&&_0x4e81bf[_0x3baf8e(0x157)](_0x9d9342[_0x3baf8e(0xca)],_0x448b7a))throw new Error(_0x4e81bf[_0x3baf8e(0xf6)]);const _0xd6be07={'\x73\x65\x71\x75\x65\x6e\x63\x65':++_0x218d3c,'\x6e\x6f\x6e\x63\x65':_0x448b7a,'\x72\x65\x73\x70\x6f\x6e\x73\x65':{..._0x9d9342,'\x61\x74\x74\x65\x73\x74\x61\x74\x69\x6f\x6e\x4e\x6f\x6e\x63\x65':_0x9d9342[_0x3baf8e(0xca)]??_0x448b7a},'\x63\x68\x65\x63\x6b\x65\x64\x41\x74':new Date()};return await _0x4df2e0[_0x3baf8e(0xee)]?.(_0xd6be07),_0x3b65d2=_0xd6be07,_0x4df2e0[_0x3baf8e(0x125)]?.(_0xd6be07),_0xd6be07;},_0x1a8052=()=>{const _0x46eab5=_0x321026;if(_0x25b653||_0x4df2e0[_0x46eab5(0x15d)]?.[_0x46eab5(0xe1)]){_0x4e81bf[_0x46eab5(0x156)](_0x132874);return;}_0x17f7b1=setTimeout(()=>{_0x57d01b();},_0x65698);},_0x57d01b=async()=>{const _0x4b78d7=_0x321026;try{await _0x4e24e5(),_0x1a8052();}catch(_0xfd64d3){_0x4e32a0+=0x1,_0x4df2e0[_0x4b78d7(0x147)]?.(_0xfd64d3);if(_0x4df2e0[_0x4b78d7(0x14e)])_0x4e81bf[_0x4b78d7(0x161)](_0x1a8052);else _0x132874();}};_0x4df2e0[_0x321026(0x15d)]?.[_0x321026(0xfc)](_0x321026(0xe7),_0x132874,{'\x6f\x6e\x63\x65':!![]});if(_0x4df2e0[_0x321026(0xd9)]===![])_0x4e81bf['\x5a\x6f\x54\x67\x64'](_0x1a8052);else _0x57d01b();return{'\x73\x74\x6f\x70':_0x132874,'\x70\x69\x6e\x67':_0x4e24e5,get '\x73\x74\x6f\x70\x70\x65\x64'(){return _0x25b653;},get '\x66\x61\x69\x6c\x75\x72\x65\x73'(){return _0x4e32a0;},get '\x6c\x61\x74\x65\x73\x74'(){return _0x3b65d2;},'\x64\x6f\x6e\x65':_0x4706c8};}var Image=class Image{constructor(_0x25ea2c,_0x5df9a6,_0x3d49e4,_0x2dde3c){this['\x69\x64']=_0x25ea2c,this['\x74\x61\x67']=_0x5df9a6,this['\x64\x69\x67\x65\x73\x74']=_0x3d49e4,this['\x73\x70\x65\x63']=_0x2dde3c;}static[a0_0x19904f(0xf2)](_0x5b03b0=a0_0x19904f(0x110)){return new ImageBuilder({'\x62\x61\x73\x65\x49\x6d\x61\x67\x65':_0x5b03b0});}static[a0_0x19904f(0x100)](_0x20a1cc){const _0x1bcd5a=a0_0x19904f;return new Image(_0x20a1cc,_0x20a1cc['\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68'](_0x1bcd5a(0x16f))?_0x1bcd5a(0x133)+_0x20a1cc[_0x1bcd5a(0x145)](0x7,0x13):_0x20a1cc,_0x20a1cc);}static[a0_0x19904f(0x136)](_0x2d86b0,_0x515a59){return new ImageBuilder({'\x62\x61\x73\x65\x49\x6d\x61\x67\x65':'\x73\x63\x72\x61\x74\x63\x68','\x64\x6f\x63\x6b\x65\x72\x66\x69\x6c\x65':_0x2d86b0,'\x64\x6f\x63\x6b\x65\x72\x43\x6f\x6e\x74\x65\x78\x74':_0x515a59||'\x2e'});}static[a0_0x19904f(0x118)](_0x28f795){const _0x3ca5aa=a0_0x19904f;return new Image(_0x28f795['\x69\x64'],_0x28f795[_0x3ca5aa(0xcd)],_0x28f795['\x64\x69\x67\x65\x73\x74'],_0x28f795[_0x3ca5aa(0x152)]);}['\x74\x6f\x4a\x53\x4f\x4e'](){const _0xbb0f24=a0_0x19904f;return{'\x69\x64':this['\x69\x64'],'\x74\x61\x67':this[_0xbb0f24(0xcd)],'\x64\x69\x67\x65\x73\x74':this[_0xbb0f24(0x10b)],'\x73\x70\x65\x63':this[_0xbb0f24(0x152)]};}},ImageBuilder=class{[a0_0x19904f(0x152)];['\x63\x6c\x69\x65\x6e\x74\x43\x6f\x6e\x66\x69\x67'];constructor(_0x3753e2){const _0x1154b8=a0_0x19904f,_0x17311f={'\x65\x4c\x50\x6f\x5a':_0x1154b8(0x110)};this[_0x1154b8(0x152)]={'\x62\x61\x73\x65\x49\x6d\x61\x67\x65':_0x3753e2['\x62\x61\x73\x65\x49\x6d\x61\x67\x65']||_0x17311f['\x65\x4c\x50\x6f\x5a'],..._0x3753e2};}[a0_0x19904f(0x11c)](_0x334a70){const _0x26ad4d=a0_0x19904f;return this['\x73\x70\x65\x63'][_0x26ad4d(0x129)]=_0x334a70,this;}['\x61\x64\x64\x50\x61\x63\x6b\x61\x67\x65\x73'](_0xe0b89b){const _0x3f8a7d=a0_0x19904f;return this[_0x3f8a7d(0x152)][_0x3f8a7d(0xe2)]=[...this[_0x3f8a7d(0x152)][_0x3f8a7d(0xe2)]||[],..._0xe0b89b],this;}[a0_0x19904f(0x151)](_0x43efdc){const _0x19d2e9=a0_0x19904f;return this[_0x19d2e9(0x152)][_0x19d2e9(0x167)]=[...this[_0x19d2e9(0x152)][_0x19d2e9(0x167)]||[],_0x19d2e9(0x16c)+_0x43efdc],this;}['\x61\x64\x64\x43\x6f\x6d\x6d\x61\x6e\x64\x73'](_0x230d68){const _0x394cc3=a0_0x19904f;return this['\x73\x70\x65\x63'][_0x394cc3(0x167)]=[...this[_0x394cc3(0x152)][_0x394cc3(0x167)]||[],..._0x230d68],this;}['\x61\x64\x64\x41\x70\x74\x50\x61\x63\x6b\x61\x67\x65\x73'](_0x1e9605){const _0x887bc7=a0_0x19904f;return this[_0x887bc7(0x152)][_0x887bc7(0x103)]=[...this[_0x887bc7(0x152)][_0x887bc7(0x103)]||[],..._0x1e9605],this;}['\x77\x69\x74\x68\x45\x6e\x76'](_0x33930d){const _0x5282b8=a0_0x19904f;return this[_0x5282b8(0x152)][_0x5282b8(0x114)]={...this[_0x5282b8(0x152)]['\x65\x6e\x76'],..._0x33930d},this;}['\x77\x69\x74\x68\x53\x65\x63\x72\x65\x74\x73'](_0x121a2a){const _0x53a62f=a0_0x19904f;return this['\x73\x70\x65\x63'][_0x53a62f(0x102)]=[...this[_0x53a62f(0x152)][_0x53a62f(0x102)]||[],..._0x121a2a],this;}[a0_0x19904f(0x155)](_0x43bb67,_0x17412d){const _0x3a54f8=a0_0x19904f;return this[_0x3a54f8(0x152)][_0x3a54f8(0x155)]={'\x70\x61\x63\x6b\x61\x67\x65\x73':[...this[_0x3a54f8(0x152)][_0x3a54f8(0x155)]?.[_0x3a54f8(0xe2)]||[],..._0x43bb67],'\x63\x68\x61\x6e\x6e\x65\x6c\x73':_0x17412d||this[_0x3a54f8(0x152)][_0x3a54f8(0x155)]?.[_0x3a54f8(0xe0)]||['\x63\x6f\x6e\x64\x61\x2d\x66\x6f\x72\x67\x65']},this;}[a0_0x19904f(0xd0)](_0x54a9cf){const _0x114650=a0_0x19904f;return this['\x73\x70\x65\x63'][_0x114650(0xd0)]=_0x54a9cf,this;}['\x75\x73\x65\x72'](_0x1c6b45){const _0x26bda1=a0_0x19904f;return this[_0x26bda1(0x152)]['\x75\x73\x65\x72']=_0x1c6b45,this;}[a0_0x19904f(0x139)](_0x2f29eb){const _0xbd7d42=a0_0x19904f;return this[_0xbd7d42(0x152)][_0xbd7d42(0x139)]={...this[_0xbd7d42(0x152)][_0xbd7d42(0x139)],..._0x2f29eb},this;}[a0_0x19904f(0x168)](_0x322163){const _0x40a4b7=a0_0x19904f;return this[_0x40a4b7(0x152)][_0x40a4b7(0x168)]={...this[_0x40a4b7(0x152)]['\x6c\x61\x62\x65\x6c\x73'],..._0x322163},this;}['\x74\x6f\x53\x70\x65\x63'](){const _0x5e3ece=a0_0x19904f;return{...this[_0x5e3ece(0x152)]};}async[a0_0x19904f(0xe4)](){const _0x49ef58=a0_0x19904f,_0x4ba154={'\x45\x65\x75\x48\x77':_0x49ef58(0x14d),'\x68\x4f\x50\x49\x79':_0x49ef58(0xdb)},_0x4f5002=JSON['\x73\x74\x72\x69\x6e\x67\x69\x66\x79'](this[_0x49ef58(0x152)],Object[_0x49ef58(0x115)](this['\x73\x70\x65\x63'])[_0x49ef58(0xd6)]()),_0x4e84ce=globalThis[_0x49ef58(0x12d)]?.[_0x49ef58(0x159)];if(_0x4e84ce){const _0x4582a6=await _0x4e84ce[_0x49ef58(0x10b)](_0x49ef58(0x15c),new TextEncoder()['\x65\x6e\x63\x6f\x64\x65'](_0x4f5002));return Array[_0x49ef58(0x121)](new Uint8Array(_0x4582a6))[_0x49ef58(0xd5)](_0x276a21=>_0x276a21[_0x49ef58(0x166)](0x10)[_0x49ef58(0x135)](0x2,'\x30'))['\x6a\x6f\x69\x6e']('');}const {createHash:_0x40f901}=await import(_0x49ef58(0x138));return _0x40f901(_0x4ba154['\x45\x65\x75\x48\x77'])[_0x49ef58(0x164)](_0x4f5002)[_0x49ef58(0x10b)](_0x4ba154['\x68\x4f\x50\x49\x79']);}[a0_0x19904f(0x119)](_0x57ca9e){const _0xcc89a2=a0_0x19904f;return this[_0xcc89a2(0xdc)]=_0x57ca9e,this;}async['\x62\x75\x69\x6c\x64'](_0x587a6b){const _0x5d3325=a0_0x19904f,_0x377713={'\x61\x52\x64\x4a\x4c':'\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x2f\x6a\x73\x6f\x6e','\x6e\x6c\x67\x58\x63':_0x5d3325(0x12e),'\x7a\x43\x57\x66\x4e':_0x5d3325(0x122),'\x4a\x4e\x47\x63\x43':_0x5d3325(0x14a)},_0x2b92a6=_0x587a6b?.[_0x5d3325(0x117)]||this[_0x5d3325(0xdc)];if(!_0x2b92a6)throw new Error('\x43\x6c\x69\x65\x6e\x74\x20\x63\x6f\x6e\x66\x69\x67\x75\x72\x61\x74\x69\x6f\x6e\x20\x72\x65\x71\x75\x69\x72\x65\x64\x2e\x20\x50\x61\x73\x73\x20\x7b\x20\x63\x6c\x69\x65\x6e\x74\x3a\x20\x7b\x20\x62\x61\x73\x65\x55\x72\x6c\x2c\x20\x61\x70\x69\x4b\x65\x79\x20\x7d\x20\x7d\x20\x74\x6f\x20\x62\x75\x69\x6c\x64\x28\x29\x20\x6f\x72\x20\x75\x73\x65\x20\x49\x6d\x61\x67\x65\x42\x75\x69\x6c\x64\x65\x72\x20\x74\x68\x72\x6f\x75\x67\x68\x20\x74\x68\x65\x20\x53\x61\x6e\x64\x62\x6f\x78\x20\x63\x6c\x69\x65\x6e\x74\x2e');const _0xd034e2=await fetch(_0x2b92a6[_0x5d3325(0x10c)]+_0x5d3325(0x15b),{'\x6d\x65\x74\x68\x6f\x64':_0x5d3325(0x11a),'\x68\x65\x61\x64\x65\x72\x73':{'\x43\x6f\x6e\x74\x65\x6e\x74\x2d\x54\x79\x70\x65':_0x377713[_0x5d3325(0x10f)],'\x41\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\x6f\x6e':'\x42\x65\x61\x72\x65\x72\x20'+_0x2b92a6[_0x5d3325(0xff)]},'\x62\x6f\x64\x79':JSON[_0x5d3325(0x127)]({'\x73\x70\x65\x63':this[_0x5d3325(0x152)],'\x6f\x70\x74\x69\x6f\x6e\x73':{'\x6e\x6f\x43\x61\x63\x68\x65':_0x587a6b?.[_0x5d3325(0x11b)],'\x70\x6c\x61\x74\x66\x6f\x72\x6d':_0x587a6b?.[_0x5d3325(0xda)],'\x74\x61\x67':_0x587a6b?.[_0x5d3325(0xcd)],'\x73\x74\x72\x65\x61\x6d':!!_0x587a6b?.[_0x5d3325(0xdd)]}})});if(!_0xd034e2['\x6f\x6b']){const _0x2fdd32=await _0xd034e2['\x74\x65\x78\x74']();throw new Error('\x46\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x62\x75\x69\x6c\x64\x20\x69\x6d\x61\x67\x65\x3a\x20'+_0x2fdd32);}if(_0x587a6b?.['\x6f\x6e\x50\x72\x6f\x67\x72\x65\x73\x73']&&_0xd034e2[_0x5d3325(0x13d)][_0x5d3325(0x14c)](_0x377713[_0x5d3325(0x150)])?.[_0x5d3325(0x15f)](_0x5d3325(0xce))){const _0x1837ae=_0xd034e2['\x62\x6f\x64\x79']?.[_0x5d3325(0x14b)]();if(_0x1837ae){const _0x341bd3=new TextDecoder();let _0x2391de;while(!![]){const {done:_0x2657bf,value:_0x26baa0}=await _0x1837ae[_0x5d3325(0xeb)]();if(_0x2657bf)break;const _0x584803=_0x341bd3[_0x5d3325(0x105)](_0x26baa0)['\x73\x70\x6c\x69\x74']('\x0a')['\x66\x69\x6c\x74\x65\x72'](_0x50629f=>_0x50629f[_0x5d3325(0x130)](_0x5d3325(0xed)));for(const _0x5c58c1 of _0x584803)try{const _0x1e5ac4=JSON[_0x5d3325(0x15e)](_0x5c58c1[_0x5d3325(0x145)](0x6));if(_0x1e5ac4[_0x5d3325(0xe5)]===_0x5d3325(0x11e))_0x587a6b['\x6f\x6e\x50\x72\x6f\x67\x72\x65\x73\x73'](_0x1e5ac4[_0x5d3325(0x109)]);else{if(_0x1e5ac4[_0x5d3325(0xe5)]===_0x377713[_0x5d3325(0x106)])_0x2391de={..._0x1e5ac4['\x72\x65\x73\x75\x6c\x74'],'\x63\x72\x65\x61\x74\x65\x64\x41\x74':new Date(_0x1e5ac4['\x72\x65\x73\x75\x6c\x74'][_0x5d3325(0xfa)])};else{if(_0x1e5ac4[_0x5d3325(0xe5)]===_0x5d3325(0x113))throw new Error(_0x1e5ac4['\x6d\x65\x73\x73\x61\x67\x65']);}}}catch(_0x3da8b8){if(_0x3da8b8 instanceof SyntaxError)continue;throw _0x3da8b8;}}if(!_0x2391de)throw new Error(_0x377713[_0x5d3325(0xec)]);return Image[_0x5d3325(0x118)](_0x2391de);}}const _0x1df7c5=await _0xd034e2[_0x5d3325(0x11d)](),_0x93ba6a={..._0x1df7c5,'\x63\x72\x65\x61\x74\x65\x64\x41\x74':new Date(_0x1df7c5[_0x5d3325(0xfa)])};return Image['\x66\x72\x6f\x6d\x42\x75\x69\x6c\x64\x52\x65\x73\x75\x6c\x74'](_0x93ba6a);}[a0_0x19904f(0xf1)](){return generateDockerfile(this['\x73\x70\x65\x63']);}};function a0_0x3230(_0x2548e9,_0x27d1af){_0x2548e9=_0x2548e9-0xc9;const _0x144074=a0_0x1440();let _0x32306c=_0x144074[_0x2548e9];if(a0_0x3230['\x65\x6f\x49\x65\x4e\x59']===undefined){var _0xdef25=function(_0x30d9f5){const _0xeaf9fc='\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 _0x35709f='',_0x9224e8='';for(let _0x1fd131=0x0,_0x21def9,_0x131fa1,_0x308ff9=0x0;_0x131fa1=_0x30d9f5['\x63\x68\x61\x72\x41\x74'](_0x308ff9++);~_0x131fa1&&(_0x21def9=_0x1fd131%0x4?_0x21def9*0x40+_0x131fa1:_0x131fa1,_0x1fd131++%0x4)?_0x35709f+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x21def9>>(-0x2*_0x1fd131&0x6)):0x0){_0x131fa1=_0xeaf9fc['\x69\x6e\x64\x65\x78\x4f\x66'](_0x131fa1);}for(let _0xb22b9d=0x0,_0x5b2b6f=_0x35709f['\x6c\x65\x6e\x67\x74\x68'];_0xb22b9d<_0x5b2b6f;_0xb22b9d++){_0x9224e8+='\x25'+('\x30\x30'+_0x35709f['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0xb22b9d)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x9224e8);};a0_0x3230['\x5a\x44\x51\x63\x42\x4d']=_0xdef25,a0_0x3230['\x51\x56\x47\x53\x4e\x69']={},a0_0x3230['\x65\x6f\x49\x65\x4e\x59']=!![];}const _0x2110f7=_0x144074[0x0],_0x614bf5=_0x2548e9+_0x2110f7,_0x2a75df=a0_0x3230['\x51\x56\x47\x53\x4e\x69'][_0x614bf5];return!_0x2a75df?(_0x32306c=a0_0x3230['\x5a\x44\x51\x63\x42\x4d'](_0x32306c),a0_0x3230['\x51\x56\x47\x53\x4e\x69'][_0x614bf5]=_0x32306c):_0x32306c=_0x2a75df,_0x32306c;}function generateDockerfile(_0x8821c7){const _0x93b479=a0_0x19904f,_0xaab472={'\x4e\x6c\x65\x72\x58':function(_0x33b971,_0x756732){return _0x33b971>_0x756732;},'\x42\x4f\x4e\x69\x57':_0x93b479(0xcc),'\x46\x61\x53\x69\x6a':_0x93b479(0x144),'\x54\x4c\x44\x74\x46':'\x63\x6f\x6e\x64\x61\x2d\x66\x6f\x72\x67\x65'},_0x5deefd=[];_0x5deefd[_0x93b479(0x134)](_0x93b479(0x163)+_0x8821c7[_0x93b479(0x16d)]),_0x5deefd[_0x93b479(0x134)]('');if(_0x8821c7[_0x93b479(0x168)]&&Object[_0x93b479(0x115)](_0x8821c7[_0x93b479(0x168)])[_0x93b479(0x11f)]>0x0){for(const [_0x4bf447,_0x5341a7]of Object['\x65\x6e\x74\x72\x69\x65\x73'](_0x8821c7['\x6c\x61\x62\x65\x6c\x73']))_0x5deefd[_0x93b479(0x134)](_0x93b479(0xd4)+_0x4bf447+'\x3d\x22'+_0x5341a7+'\x22');_0x5deefd[_0x93b479(0x134)]('');}if(_0x8821c7['\x62\x75\x69\x6c\x64\x41\x72\x67\x73']&&_0xaab472[_0x93b479(0x13a)](Object[_0x93b479(0x115)](_0x8821c7['\x62\x75\x69\x6c\x64\x41\x72\x67\x73'])[_0x93b479(0x11f)],0x0)){for(const [_0x514829,_0x3bd5d1]of Object[_0x93b479(0xe8)](_0x8821c7[_0x93b479(0x139)]))_0x5deefd[_0x93b479(0x134)](_0x93b479(0x15a)+_0x514829+'\x3d'+_0x3bd5d1);_0x5deefd[_0x93b479(0x134)]('');}if(_0x8821c7['\x65\x6e\x76']&&Object[_0x93b479(0x115)](_0x8821c7[_0x93b479(0x114)])[_0x93b479(0x11f)]>0x0){for(const [_0x115aa0,_0x36cc25]of Object[_0x93b479(0xe8)](_0x8821c7[_0x93b479(0x114)]))_0x5deefd['\x70\x75\x73\x68']('\x45\x4e\x56\x20'+_0x115aa0+'\x3d\x22'+_0x36cc25+'\x22');_0x5deefd[_0x93b479(0x134)]('');}_0x8821c7[_0x93b479(0xd0)]&&(_0x5deefd['\x70\x75\x73\x68'](_0x93b479(0x101)+_0x8821c7[_0x93b479(0xd0)]),_0x5deefd[_0x93b479(0x134)](''));if(_0x8821c7[_0x93b479(0x103)]&&_0xaab472[_0x93b479(0x13a)](_0x8821c7[_0x93b479(0x103)][_0x93b479(0x11f)],0x0)){const _0x1013a9=_0x93b479(0x107)[_0x93b479(0x123)]('\x7c');let _0x58e141=0x0;while(!![]){switch(_0x1013a9[_0x58e141++]){case'\x30':_0x5deefd[_0x93b479(0x134)]('');continue;case'\x31':_0x5deefd[_0x93b479(0x134)](_0x93b479(0x142)+_0x8821c7[_0x93b479(0x103)][_0x93b479(0xcf)]('\x20')+_0x93b479(0xf9));continue;case'\x32':_0x5deefd['\x70\x75\x73\x68'](_0x93b479(0xde));continue;case'\x33':_0x5deefd[_0x93b479(0x134)](_0xaab472[_0x93b479(0x12c)]);continue;case'\x34':_0x5deefd['\x70\x75\x73\x68'](_0x93b479(0xf8));continue;}break;}}_0x8821c7[_0x93b479(0x129)]&&(_0x5deefd[_0x93b479(0x134)](_0x93b479(0x112)+_0x8821c7['\x70\x79\x74\x68\x6f\x6e\x56\x65\x72\x73\x69\x6f\x6e']),!(_0x8821c7[_0x93b479(0x16d)][_0x93b479(0x15f)](_0x93b479(0x11c))||_0x8821c7['\x62\x61\x73\x65\x49\x6d\x61\x67\x65']['\x69\x6e\x63\x6c\x75\x64\x65\x73'](_0x93b479(0x108))||_0x8821c7['\x62\x61\x73\x65\x49\x6d\x61\x67\x65'][_0x93b479(0x15f)]('\x6d\x69\x6e\x69\x63\x6f\x6e\x64\x61'))&&_0x8821c7['\x62\x61\x73\x65\x49\x6d\x61\x67\x65']['\x69\x6e\x63\x6c\x75\x64\x65\x73'](_0x93b479(0xc9))&&(_0x5deefd[_0x93b479(0x134)](_0x93b479(0xf8)),_0x5deefd[_0x93b479(0x134)](_0x93b479(0xf0)),_0x5deefd[_0x93b479(0x134)]('\x20\x20\x20\x20\x61\x64\x64\x2d\x61\x70\x74\x2d\x72\x65\x70\x6f\x73\x69\x74\x6f\x72\x79\x20\x2d\x79\x20\x70\x70\x61\x3a\x64\x65\x61\x64\x73\x6e\x61\x6b\x65\x73\x2f\x70\x70\x61\x20\x26\x26\x20\x5c'),_0x5deefd[_0x93b479(0x134)](_0x93b479(0x124)+_0x8821c7[_0x93b479(0x129)]+_0x93b479(0x143)+_0x8821c7[_0x93b479(0x129)]+_0x93b479(0xf7)+_0x8821c7['\x70\x79\x74\x68\x6f\x6e\x56\x65\x72\x73\x69\x6f\x6e']+_0x93b479(0x16e)),_0x5deefd['\x70\x75\x73\x68'](_0xaab472[_0x93b479(0x12c)]),_0x5deefd['\x70\x75\x73\x68'](''),_0x5deefd[_0x93b479(0x134)]('\x52\x55\x4e\x20\x75\x70\x64\x61\x74\x65\x2d\x61\x6c\x74\x65\x72\x6e\x61\x74\x69\x76\x65\x73\x20\x2d\x2d\x69\x6e\x73\x74\x61\x6c\x6c\x20\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x70\x79\x74\x68\x6f\x6e\x20\x70\x79\x74\x68\x6f\x6e\x20\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x70\x79\x74\x68\x6f\x6e'+_0x8821c7[_0x93b479(0x129)]+_0x93b479(0xef)),_0x5deefd[_0x93b479(0x134)]('\x20\x20\x20\x20\x75\x70\x64\x61\x74\x65\x2d\x61\x6c\x74\x65\x72\x6e\x61\x74\x69\x76\x65\x73\x20\x2d\x2d\x69\x6e\x73\x74\x61\x6c\x6c\x20\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x70\x79\x74\x68\x6f\x6e\x33\x20\x70\x79\x74\x68\x6f\x6e\x33\x20\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x70\x79\x74\x68\x6f\x6e'+_0x8821c7['\x70\x79\x74\x68\x6f\x6e\x56\x65\x72\x73\x69\x6f\x6e']+'\x20\x31'),_0x5deefd['\x70\x75\x73\x68'](''),_0x5deefd['\x70\x75\x73\x68']('\x52\x55\x4e\x20\x63\x75\x72\x6c\x20\x2d\x73\x53\x20\x68\x74\x74\x70\x73\x3a\x2f\x2f\x62\x6f\x6f\x74\x73\x74\x72\x61\x70\x2e\x70\x79\x70\x61\x2e\x69\x6f\x2f\x67\x65\x74\x2d\x70\x69\x70\x2e\x70\x79\x20\x7c\x20\x70\x79\x74\x68\x6f\x6e')),_0x5deefd[_0x93b479(0x134)](''));if(_0x8821c7[_0x93b479(0x155)]&&_0xaab472[_0x93b479(0x13a)](_0x8821c7['\x63\x6f\x6e\x64\x61'][_0x93b479(0xe2)]['\x6c\x65\x6e\x67\x74\x68'],0x0)){_0x5deefd[_0x93b479(0x134)]('\x23\x20\x49\x6e\x73\x74\x61\x6c\x6c\x20\x6d\x69\x63\x72\x6f\x6d\x61\x6d\x62\x61\x20\x61\x6e\x64\x20\x63\x6f\x6e\x64\x61\x20\x70\x61\x63\x6b\x61\x67\x65\x73'),_0x5deefd[_0x93b479(0x134)](_0x93b479(0xe9)),_0x5deefd['\x70\x75\x73\x68'](_0xaab472[_0x93b479(0x146)]),_0x5deefd[_0x93b479(0x134)](_0x93b479(0x13f)),_0x5deefd[_0x93b479(0x134)]('');const _0x33f96f=(_0x8821c7[_0x93b479(0x155)]['\x63\x68\x61\x6e\x6e\x65\x6c\x73']||[_0xaab472[_0x93b479(0x12b)]])[_0x93b479(0xd5)](_0x450bc7=>_0x93b479(0x165)+_0x450bc7)[_0x93b479(0xcf)]('\x20');_0x5deefd['\x70\x75\x73\x68'](_0x93b479(0x126)+_0x33f96f+'\x20'+_0x8821c7[_0x93b479(0x155)]['\x70\x61\x63\x6b\x61\x67\x65\x73'][_0x93b479(0xcf)]('\x20')+'\x20\x26\x26\x20\x5c'),_0x5deefd[_0x93b479(0x134)](_0x93b479(0x141)),_0x5deefd['\x70\x75\x73\x68']('\x45\x4e\x56\x20\x50\x41\x54\x48\x3d\x22\x2f\x6f\x70\x74\x2f\x63\x6f\x6e\x64\x61\x2f\x62\x69\x6e\x3a\x24\x50\x41\x54\x48\x22'),_0x5deefd[_0x93b479(0x134)]('');}_0x8821c7[_0x93b479(0xe2)]&&_0x8821c7[_0x93b479(0xe2)][_0x93b479(0x11f)]>0x0&&(_0x5deefd[_0x93b479(0x134)](_0x93b479(0x111)),_0x5deefd[_0x93b479(0x134)](_0x93b479(0xf4)+_0x8821c7[_0x93b479(0xe2)]['\x6a\x6f\x69\x6e']('\x20')),_0x5deefd[_0x93b479(0x134)](''));if(_0x8821c7['\x63\x6f\x6d\x6d\x61\x6e\x64\x73']&&_0x8821c7[_0x93b479(0x167)][_0x93b479(0x11f)]>0x0){_0x5deefd[_0x93b479(0x134)]('\x23\x20\x43\x75\x73\x74\x6f\x6d\x20\x63\x6f\x6d\x6d\x61\x6e\x64\x73');for(const _0xc7c184 of _0x8821c7[_0x93b479(0x167)])_0x5deefd[_0x93b479(0x134)](_0x93b479(0xea)+_0xc7c184);_0x5deefd[_0x93b479(0x134)]('');}if(_0x8821c7[_0x93b479(0x104)])_0x5deefd['\x70\x75\x73\x68']('\x55\x53\x45\x52\x20'+_0x8821c7[_0x93b479(0x104)]);return _0x5deefd['\x6a\x6f\x69\x6e']('\x0a');}export{a0_0x22b245 as AuthError,a0_0x36e901 as CollaborationClient,a0_0x576a4f as CollaborationFileBridge,Image,ImageBuilder,a0_0x57997c as NetworkError,a0_0x5cd204 as NotFoundError,a0_0x365b61 as QuotaError,a0_0x26b452 as Sandbox,a0_0x26b452 as SandboxClient,a0_0x3ad4b0 as SandboxError,a0_0x5beb7d as SandboxInstance,a0_0x362c35 as ServerError,a0_0xbbf367 as StateError,a0_0x337e35 as TangleSandboxClient,a0_0x427603 as TimeoutError,a0_0x130e64 as ValidationError,a0_0x4b1a97 as buildCollaborationDocumentId,createConfidentialSandbox,defineAgentProfile,defineGitHubResource,defineInlineResource,generateAttestationNonce,generateDockerfile,mergeAgentProfiles,a0_0x2f0422 as normalizeCollaborationPath,a0_0x5366ae as parseCollaborationDocumentId,a0_0x2fc8c1 as parseSSEStream,startTeeAttestationHeartbeat};
|
|
1
|
+
import { a as PartialFailureError, c as ServerError, d as ValidationError, i as NotFoundError, l as StateError, n as CapabilityError, o as QuotaError, r as NetworkError, s as SandboxError, t as AuthError, u as TimeoutError } from "./errors-CljiGR__.js";
|
|
2
|
+
import { a as exportTraceBundle, i as buildTraceExportPayload, l as parseSSEStream, n as SandboxSession, o as otelTraceIdForTangleTrace, s as toOtelJson, t as SandboxInstance } from "./sandbox-ksXTNlo-.js";
|
|
3
|
+
import { a as SandboxFleetClient, i as SandboxFleet, n as SandboxClient, r as IntegrationsManager, t as IntelligenceClient } from "./client-Uve6A5C6.js";
|
|
4
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CRyb5e8F.js";
|
|
5
|
+
import { t as TangleSandboxClient } from "./tangle-DQ05paN7.js";
|
|
6
|
+
//#region src/agent-profile.ts
|
|
7
|
+
/**
|
|
8
|
+
* Helper for creating typed inline resource refs.
|
|
9
|
+
*/
|
|
10
|
+
function defineInlineResource(name, content) {
|
|
11
|
+
return {
|
|
12
|
+
kind: "inline",
|
|
13
|
+
name,
|
|
14
|
+
content
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Helper for creating typed GitHub-backed resource refs.
|
|
19
|
+
*/
|
|
20
|
+
function defineGitHubResource(path, options = {}) {
|
|
21
|
+
return {
|
|
22
|
+
kind: "github",
|
|
23
|
+
repository: options.repository,
|
|
24
|
+
path,
|
|
25
|
+
ref: options.ref,
|
|
26
|
+
name: options.name
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper for declaring typed profiles in application code.
|
|
31
|
+
*/
|
|
32
|
+
function defineAgentProfile(profile) {
|
|
33
|
+
return profile;
|
|
34
|
+
}
|
|
35
|
+
function mergeStringArrays(base, overlay) {
|
|
36
|
+
if (!base && !overlay) return void 0;
|
|
37
|
+
return [...base ?? [], ...overlay ?? []];
|
|
38
|
+
}
|
|
39
|
+
function mergeRecord(base, overlay) {
|
|
40
|
+
if (!base && !overlay) return void 0;
|
|
41
|
+
return {
|
|
42
|
+
...base ?? {},
|
|
43
|
+
...overlay ?? {}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Merge two public AgentProfile values.
|
|
48
|
+
*
|
|
49
|
+
* Overlay fields win on conflicts. Array-like instruction sets are appended.
|
|
50
|
+
*/
|
|
51
|
+
function mergeAgentProfiles(base, overlay) {
|
|
52
|
+
if (!base && !overlay) return void 0;
|
|
53
|
+
const mergedPrompt = base?.prompt || overlay?.prompt ? {
|
|
54
|
+
...base?.prompt ?? {},
|
|
55
|
+
...overlay?.prompt ?? {},
|
|
56
|
+
instructions: mergeStringArrays(base?.prompt?.instructions, overlay?.prompt?.instructions)
|
|
57
|
+
} : void 0;
|
|
58
|
+
const mergedResources = base?.resources || overlay?.resources ? {
|
|
59
|
+
...base?.resources ?? {},
|
|
60
|
+
...overlay?.resources ?? {},
|
|
61
|
+
files: [...base?.resources?.files ?? [], ...overlay?.resources?.files ?? []],
|
|
62
|
+
tools: [...base?.resources?.tools ?? [], ...overlay?.resources?.tools ?? []],
|
|
63
|
+
skills: [...base?.resources?.skills ?? [], ...overlay?.resources?.skills ?? []],
|
|
64
|
+
agents: [...base?.resources?.agents ?? [], ...overlay?.resources?.agents ?? []],
|
|
65
|
+
commands: [...base?.resources?.commands ?? [], ...overlay?.resources?.commands ?? []],
|
|
66
|
+
instructions: overlay?.resources?.instructions ?? base?.resources?.instructions
|
|
67
|
+
} : void 0;
|
|
68
|
+
return {
|
|
69
|
+
...base ?? {},
|
|
70
|
+
...overlay ?? {},
|
|
71
|
+
prompt: mergedPrompt,
|
|
72
|
+
permissions: mergeRecord(base?.permissions, overlay?.permissions),
|
|
73
|
+
tools: mergeRecord(base?.tools, overlay?.tools),
|
|
74
|
+
mcp: mergeRecord(base?.mcp, overlay?.mcp),
|
|
75
|
+
subagents: mergeRecord(base?.subagents, overlay?.subagents),
|
|
76
|
+
resources: mergedResources,
|
|
77
|
+
hooks: mergeRecord(base?.hooks, overlay?.hooks),
|
|
78
|
+
modes: mergeRecord(base?.modes, overlay?.modes),
|
|
79
|
+
metadata: mergeRecord(base?.metadata, overlay?.metadata),
|
|
80
|
+
extensions: mergeRecord(base?.extensions, overlay?.extensions)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/confidential.ts
|
|
85
|
+
function generateAttestationNonce(bytes = 32) {
|
|
86
|
+
const buffer = new Uint8Array(bytes);
|
|
87
|
+
if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.getRandomValues === "function") globalThis.crypto.getRandomValues(buffer);
|
|
88
|
+
else throw new Error("Secure random nonce generation is not available");
|
|
89
|
+
return Array.from(buffer).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
90
|
+
}
|
|
91
|
+
async function createConfidentialSandbox(client, options) {
|
|
92
|
+
const attestationNonce = options.attestationNonce === "auto" || options.requireAttestation && !options.attestationNonce && !options.confidential.attestationNonce ? generateAttestationNonce() : options.attestationNonce ?? options.confidential.attestationNonce;
|
|
93
|
+
const sandbox = await client.create({
|
|
94
|
+
...options,
|
|
95
|
+
confidential: {
|
|
96
|
+
...options.confidential,
|
|
97
|
+
...attestationNonce ? { attestationNonce } : {},
|
|
98
|
+
attestationRefresh: options.confidential.attestationRefresh || Boolean(attestationNonce)
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
let attestation = attestationFromMetadata(sandbox.metadata);
|
|
102
|
+
if (!attestation) try {
|
|
103
|
+
attestation = (await sandbox.getTeeAttestation(attestationNonce ? { attestationNonce } : void 0)).attestation;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (options.requireAttestation) throw error;
|
|
106
|
+
}
|
|
107
|
+
if (options.requireAttestation && !attestation) throw new Error("TEE attestation was required but no evidence was returned");
|
|
108
|
+
return {
|
|
109
|
+
sandbox,
|
|
110
|
+
attestation,
|
|
111
|
+
attestationNonce
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function attestationFromMetadata(metadata) {
|
|
115
|
+
const raw = metadata?.teeAttestationJson;
|
|
116
|
+
if (typeof raw !== "string" || raw.trim() === "") return void 0;
|
|
117
|
+
try {
|
|
118
|
+
return JSON.parse(raw);
|
|
119
|
+
} catch {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/attestation-heartbeat.ts
|
|
125
|
+
/**
|
|
126
|
+
* Periodically requests nonce-bound TEE attestations for a running sandbox.
|
|
127
|
+
*
|
|
128
|
+
* This proves freshness/liveness of the attested sandbox endpoint. It does not
|
|
129
|
+
* by itself sign every computation result; callers that need result binding
|
|
130
|
+
* should include a result/session digest in the nonce preimage before asking
|
|
131
|
+
* the runtime for a quote.
|
|
132
|
+
*/
|
|
133
|
+
function startTeeAttestationHeartbeat(sandbox, options = {}) {
|
|
134
|
+
const intervalMs = options.intervalMs ?? 6e4;
|
|
135
|
+
let stopped = false;
|
|
136
|
+
let failures = 0;
|
|
137
|
+
let sequence = 0;
|
|
138
|
+
let latest;
|
|
139
|
+
let timer;
|
|
140
|
+
let resolveDone;
|
|
141
|
+
const done = new Promise((resolve) => {
|
|
142
|
+
resolveDone = resolve;
|
|
143
|
+
});
|
|
144
|
+
const stop = () => {
|
|
145
|
+
if (stopped) return;
|
|
146
|
+
stopped = true;
|
|
147
|
+
if (timer) clearTimeout(timer);
|
|
148
|
+
resolveDone?.();
|
|
149
|
+
};
|
|
150
|
+
const ping = async () => {
|
|
151
|
+
if (stopped || options.signal?.aborted) throw new Error("TEE attestation heartbeat is stopped");
|
|
152
|
+
const nonce = generateAttestationNonce();
|
|
153
|
+
const response = await sandbox.getTeeAttestation({ attestationNonce: nonce });
|
|
154
|
+
if (response.attestationNonce && response.attestationNonce !== nonce) throw new Error("TEE attestation response nonce did not match challenge");
|
|
155
|
+
const sample = {
|
|
156
|
+
sequence: ++sequence,
|
|
157
|
+
nonce,
|
|
158
|
+
response: {
|
|
159
|
+
...response,
|
|
160
|
+
attestationNonce: response.attestationNonce ?? nonce
|
|
161
|
+
},
|
|
162
|
+
checkedAt: /* @__PURE__ */ new Date()
|
|
163
|
+
};
|
|
164
|
+
await options.verify?.(sample);
|
|
165
|
+
latest = sample;
|
|
166
|
+
options.onSuccess?.(sample);
|
|
167
|
+
return sample;
|
|
168
|
+
};
|
|
169
|
+
const schedule = () => {
|
|
170
|
+
if (stopped || options.signal?.aborted) {
|
|
171
|
+
stop();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
timer = setTimeout(() => {
|
|
175
|
+
loop();
|
|
176
|
+
}, intervalMs);
|
|
177
|
+
};
|
|
178
|
+
const loop = async () => {
|
|
179
|
+
try {
|
|
180
|
+
await ping();
|
|
181
|
+
schedule();
|
|
182
|
+
} catch (error) {
|
|
183
|
+
failures += 1;
|
|
184
|
+
options.onFailure?.(error);
|
|
185
|
+
if (options.continueOnFailure) schedule();
|
|
186
|
+
else stop();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
options.signal?.addEventListener("abort", stop, { once: true });
|
|
190
|
+
if (options.immediate === false) schedule();
|
|
191
|
+
else loop();
|
|
192
|
+
return {
|
|
193
|
+
stop,
|
|
194
|
+
ping,
|
|
195
|
+
get stopped() {
|
|
196
|
+
return stopped;
|
|
197
|
+
},
|
|
198
|
+
get failures() {
|
|
199
|
+
return failures;
|
|
200
|
+
},
|
|
201
|
+
get latest() {
|
|
202
|
+
return latest;
|
|
203
|
+
},
|
|
204
|
+
done
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/image.ts
|
|
209
|
+
/**
|
|
210
|
+
* Represents a built or existing container image.
|
|
211
|
+
*/
|
|
212
|
+
var Image = class Image {
|
|
213
|
+
constructor(id, tag, digest, spec) {
|
|
214
|
+
this.id = id;
|
|
215
|
+
this.tag = tag;
|
|
216
|
+
this.digest = digest;
|
|
217
|
+
this.spec = spec;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Start building a new image.
|
|
221
|
+
*
|
|
222
|
+
* @param baseImage Base Docker image (default: "ubuntu:22.04")
|
|
223
|
+
* @returns A new ImageBuilder instance
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const builder = Image.create("python:3.11-slim");
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
static create(baseImage = "ubuntu:22.04") {
|
|
231
|
+
return new ImageBuilder({ baseImage });
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Reference an existing image by ID.
|
|
235
|
+
*
|
|
236
|
+
* @param imageId The image ID
|
|
237
|
+
* @returns An Image instance
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* const image = Image.fromId("sha256:abc123...");
|
|
242
|
+
* const box = await client.create({ image: image.id });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
static fromId(imageId) {
|
|
246
|
+
return new Image(imageId, imageId.startsWith("sha256:") ? `tangle-image:${imageId.slice(7, 19)}` : imageId, imageId);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Create an image builder from a Dockerfile.
|
|
250
|
+
*
|
|
251
|
+
* @param dockerfile Dockerfile path or content
|
|
252
|
+
* @param context Build context directory
|
|
253
|
+
* @returns A new ImageBuilder instance
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const builder = Image.fromDockerfile("./Dockerfile", "./");
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
static fromDockerfile(dockerfile, context) {
|
|
261
|
+
return new ImageBuilder({
|
|
262
|
+
baseImage: "scratch",
|
|
263
|
+
dockerfile,
|
|
264
|
+
dockerContext: context || "."
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Create an Image from a build result.
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
static fromBuildResult(result) {
|
|
272
|
+
return new Image(result.id, result.tag, result.digest, result.spec);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Convert to JSON.
|
|
276
|
+
*/
|
|
277
|
+
toJSON() {
|
|
278
|
+
return {
|
|
279
|
+
id: this.id,
|
|
280
|
+
tag: this.tag,
|
|
281
|
+
digest: this.digest,
|
|
282
|
+
spec: this.spec
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Chainable builder for constructing custom container images.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* const image = await Image.create()
|
|
292
|
+
* .python("3.11")
|
|
293
|
+
* .addPackages(["torch", "transformers"])
|
|
294
|
+
* .addCommands(["apt-get install -y ffmpeg"])
|
|
295
|
+
* .withEnv({ HF_HOME: "/models" })
|
|
296
|
+
* .withSecrets(["HF_TOKEN"])
|
|
297
|
+
* .build({ client });
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
var ImageBuilder = class {
|
|
301
|
+
spec;
|
|
302
|
+
clientConfig;
|
|
303
|
+
/** @internal */
|
|
304
|
+
constructor(initialSpec) {
|
|
305
|
+
this.spec = {
|
|
306
|
+
baseImage: initialSpec.baseImage || "ubuntu:22.04",
|
|
307
|
+
...initialSpec
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Configure Python version.
|
|
312
|
+
*
|
|
313
|
+
* @param version Python version (e.g., "3.11", "3.10")
|
|
314
|
+
*/
|
|
315
|
+
python(version) {
|
|
316
|
+
this.spec.pythonVersion = version;
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Add Python packages via pip.
|
|
321
|
+
*
|
|
322
|
+
* @param packages Package names with optional versions
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* .addPackages(["numpy>=1.21", "pandas", "scikit-learn"])
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
addPackages(packages) {
|
|
330
|
+
this.spec.packages = [...this.spec.packages || [], ...packages];
|
|
331
|
+
return this;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Add packages from requirements file.
|
|
335
|
+
*
|
|
336
|
+
* @param requirementsPath Path to requirements.txt
|
|
337
|
+
*/
|
|
338
|
+
addPackagesFromFile(requirementsPath) {
|
|
339
|
+
this.spec.commands = [...this.spec.commands || [], `pip install -r ${requirementsPath}`];
|
|
340
|
+
return this;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Add shell commands to run during build.
|
|
344
|
+
*
|
|
345
|
+
* @param commands Commands to execute
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* .addCommands([
|
|
350
|
+
* "apt-get update",
|
|
351
|
+
* "apt-get install -y ffmpeg libsm6"
|
|
352
|
+
* ])
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
addCommands(commands) {
|
|
356
|
+
this.spec.commands = [...this.spec.commands || [], ...commands];
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Add system packages via apt-get.
|
|
361
|
+
*
|
|
362
|
+
* @param packages Package names
|
|
363
|
+
*/
|
|
364
|
+
addAptPackages(packages) {
|
|
365
|
+
this.spec.aptPackages = [...this.spec.aptPackages || [], ...packages];
|
|
366
|
+
return this;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Set environment variables.
|
|
370
|
+
*
|
|
371
|
+
* @param env Key-value pairs
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* .withEnv({ HF_HOME: "/models", PYTHONUNBUFFERED: "1" })
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
withEnv(env) {
|
|
379
|
+
this.spec.env = {
|
|
380
|
+
...this.spec.env,
|
|
381
|
+
...env
|
|
382
|
+
};
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Inject secrets during build.
|
|
387
|
+
* Secrets are retrieved from the secret store.
|
|
388
|
+
*
|
|
389
|
+
* @param secretNames Names of secrets to inject
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* .withSecrets(["HF_TOKEN", "AWS_ACCESS_KEY"])
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
withSecrets(secretNames) {
|
|
397
|
+
this.spec.secrets = [...this.spec.secrets || [], ...secretNames];
|
|
398
|
+
return this;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Configure conda environment.
|
|
402
|
+
*
|
|
403
|
+
* @param packages Conda packages
|
|
404
|
+
* @param channels Conda channels (default: ["conda-forge"])
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```typescript
|
|
408
|
+
* .conda(["pytorch", "torchvision"], ["pytorch", "conda-forge"])
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
conda(packages, channels) {
|
|
412
|
+
this.spec.conda = {
|
|
413
|
+
packages: [...this.spec.conda?.packages || [], ...packages],
|
|
414
|
+
channels: channels || this.spec.conda?.channels || ["conda-forge"]
|
|
415
|
+
};
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Set working directory.
|
|
420
|
+
*
|
|
421
|
+
* @param dir Working directory path
|
|
422
|
+
*/
|
|
423
|
+
workdir(dir) {
|
|
424
|
+
this.spec.workdir = dir;
|
|
425
|
+
return this;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Set user to run as.
|
|
429
|
+
*
|
|
430
|
+
* @param user Username or UID
|
|
431
|
+
*/
|
|
432
|
+
user(user) {
|
|
433
|
+
this.spec.user = user;
|
|
434
|
+
return this;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Add build arguments.
|
|
438
|
+
*
|
|
439
|
+
* @param args Build arguments
|
|
440
|
+
*/
|
|
441
|
+
buildArgs(args) {
|
|
442
|
+
this.spec.buildArgs = {
|
|
443
|
+
...this.spec.buildArgs,
|
|
444
|
+
...args
|
|
445
|
+
};
|
|
446
|
+
return this;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Add image labels.
|
|
450
|
+
*
|
|
451
|
+
* @param labels Image labels
|
|
452
|
+
*/
|
|
453
|
+
labels(labels) {
|
|
454
|
+
this.spec.labels = {
|
|
455
|
+
...this.spec.labels,
|
|
456
|
+
...labels
|
|
457
|
+
};
|
|
458
|
+
return this;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Get the image specification without building.
|
|
462
|
+
*
|
|
463
|
+
* @returns The current ImageSpec
|
|
464
|
+
*/
|
|
465
|
+
toSpec() {
|
|
466
|
+
return { ...this.spec };
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Compute the content-addressed ID for this spec.
|
|
470
|
+
*
|
|
471
|
+
* Uses Web Crypto when available (browsers and Node 22+), falling
|
|
472
|
+
* back to a lazy `import("node:crypto")` on older server runtimes.
|
|
473
|
+
* Works in every JavaScript environment the SDK supports.
|
|
474
|
+
*
|
|
475
|
+
* @returns SHA-256 hash of the normalized spec as a hex string.
|
|
476
|
+
*
|
|
477
|
+
* **Breaking change (v0.0.3):** `computeId()` was previously
|
|
478
|
+
* synchronous. Callers must now `await` the result. A Node-only sync
|
|
479
|
+
* variant was considered and dropped: it would have either required
|
|
480
|
+
* Node 22.3+ (breaking Node 18/20 consumers) or re-introduced the
|
|
481
|
+
* top-level `node:crypto` import that blanks every browser page
|
|
482
|
+
* transitively importing the SDK root. If you genuinely need the
|
|
483
|
+
* hash synchronously in a Node-only context, compute it yourself
|
|
484
|
+
* from `builder.toSpec()` with `JSON.stringify(spec, Object.keys(spec).sort())`.
|
|
485
|
+
*/
|
|
486
|
+
async computeId() {
|
|
487
|
+
const normalized = JSON.stringify(this.spec, Object.keys(this.spec).sort());
|
|
488
|
+
const webSubtle = globalThis.crypto?.subtle;
|
|
489
|
+
if (webSubtle) {
|
|
490
|
+
const digest = await webSubtle.digest("SHA-256", new TextEncoder().encode(normalized));
|
|
491
|
+
return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
492
|
+
}
|
|
493
|
+
const { createHash } = await import("node:crypto");
|
|
494
|
+
return createHash("sha256").update(normalized).digest("hex");
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Configure client for API access.
|
|
498
|
+
* @internal
|
|
499
|
+
*/
|
|
500
|
+
withClient(config) {
|
|
501
|
+
this.clientConfig = config;
|
|
502
|
+
return this;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Build the image.
|
|
506
|
+
*
|
|
507
|
+
* @param options Build options including client config
|
|
508
|
+
* @returns The built Image instance
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* const image = await Image.create()
|
|
513
|
+
* .python("3.11")
|
|
514
|
+
* .addPackages(["numpy"])
|
|
515
|
+
* .build({
|
|
516
|
+
* client: { baseUrl, apiKey },
|
|
517
|
+
* onProgress: (e) => console.log(e.message),
|
|
518
|
+
* });
|
|
519
|
+
*
|
|
520
|
+
* const box = await client.create({ image: image.id });
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
async build(options) {
|
|
524
|
+
const client = options?.client || this.clientConfig;
|
|
525
|
+
if (!client) throw new Error("Client configuration required. Pass { client: { baseUrl, apiKey } } to build() or use ImageBuilder through the Sandbox client.");
|
|
526
|
+
const response = await fetch(`${client.baseUrl}/v1/images`, {
|
|
527
|
+
method: "POST",
|
|
528
|
+
headers: {
|
|
529
|
+
"Content-Type": "application/json",
|
|
530
|
+
Authorization: `Bearer ${client.apiKey}`
|
|
531
|
+
},
|
|
532
|
+
body: JSON.stringify({
|
|
533
|
+
spec: this.spec,
|
|
534
|
+
options: {
|
|
535
|
+
noCache: options?.noCache,
|
|
536
|
+
platform: options?.platform,
|
|
537
|
+
tag: options?.tag,
|
|
538
|
+
stream: !!options?.onProgress
|
|
539
|
+
}
|
|
540
|
+
})
|
|
541
|
+
});
|
|
542
|
+
if (!response.ok) {
|
|
543
|
+
const error = await response.text();
|
|
544
|
+
throw new Error(`Failed to build image: ${error}`);
|
|
545
|
+
}
|
|
546
|
+
if (options?.onProgress && response.headers.get("content-type")?.includes("text/event-stream")) {
|
|
547
|
+
const reader = response.body?.getReader();
|
|
548
|
+
if (reader) {
|
|
549
|
+
const decoder = new TextDecoder();
|
|
550
|
+
let result;
|
|
551
|
+
while (true) {
|
|
552
|
+
const { done, value } = await reader.read();
|
|
553
|
+
if (done) break;
|
|
554
|
+
const lines = decoder.decode(value).split("\n").filter((l) => l.startsWith("data: "));
|
|
555
|
+
for (const line of lines) try {
|
|
556
|
+
const data = JSON.parse(line.slice(6));
|
|
557
|
+
if (data.type === "progress") options.onProgress(data.event);
|
|
558
|
+
else if (data.type === "complete") result = {
|
|
559
|
+
...data.result,
|
|
560
|
+
createdAt: new Date(data.result.createdAt)
|
|
561
|
+
};
|
|
562
|
+
else if (data.type === "error") throw new Error(data.message);
|
|
563
|
+
} catch (e) {
|
|
564
|
+
if (e instanceof SyntaxError) continue;
|
|
565
|
+
throw e;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
if (!result) throw new Error("Build completed but no result received");
|
|
569
|
+
return Image.fromBuildResult(result);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
const data = await response.json();
|
|
573
|
+
const result = {
|
|
574
|
+
...data,
|
|
575
|
+
createdAt: new Date(data.createdAt)
|
|
576
|
+
};
|
|
577
|
+
return Image.fromBuildResult(result);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Generate Dockerfile from the current spec.
|
|
581
|
+
* Useful for debugging or manual builds.
|
|
582
|
+
*
|
|
583
|
+
* @returns Dockerfile content
|
|
584
|
+
*/
|
|
585
|
+
generateDockerfile() {
|
|
586
|
+
return generateDockerfile(this.spec);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* Generate a Dockerfile from an ImageSpec.
|
|
591
|
+
*
|
|
592
|
+
* @param spec The image specification
|
|
593
|
+
* @returns Dockerfile content
|
|
594
|
+
*/
|
|
595
|
+
function generateDockerfile(spec) {
|
|
596
|
+
const lines = [];
|
|
597
|
+
lines.push(`FROM ${spec.baseImage}`);
|
|
598
|
+
lines.push("");
|
|
599
|
+
if (spec.labels && Object.keys(spec.labels).length > 0) {
|
|
600
|
+
for (const [key, value] of Object.entries(spec.labels)) lines.push(`LABEL ${key}="${value}"`);
|
|
601
|
+
lines.push("");
|
|
602
|
+
}
|
|
603
|
+
if (spec.buildArgs && Object.keys(spec.buildArgs).length > 0) {
|
|
604
|
+
for (const [key, value] of Object.entries(spec.buildArgs)) lines.push(`ARG ${key}=${value}`);
|
|
605
|
+
lines.push("");
|
|
606
|
+
}
|
|
607
|
+
if (spec.env && Object.keys(spec.env).length > 0) {
|
|
608
|
+
for (const [key, value] of Object.entries(spec.env)) lines.push(`ENV ${key}="${value}"`);
|
|
609
|
+
lines.push("");
|
|
610
|
+
}
|
|
611
|
+
if (spec.workdir) {
|
|
612
|
+
lines.push(`WORKDIR ${spec.workdir}`);
|
|
613
|
+
lines.push("");
|
|
614
|
+
}
|
|
615
|
+
if (spec.aptPackages && spec.aptPackages.length > 0) {
|
|
616
|
+
lines.push("# Install system packages");
|
|
617
|
+
lines.push("RUN apt-get update && \\");
|
|
618
|
+
lines.push(` apt-get install -y --no-install-recommends ${spec.aptPackages.join(" ")} && \\`);
|
|
619
|
+
lines.push(" apt-get clean && rm -rf /var/lib/apt/lists/*");
|
|
620
|
+
lines.push("");
|
|
621
|
+
}
|
|
622
|
+
if (spec.pythonVersion) {
|
|
623
|
+
lines.push(`# Install Python ${spec.pythonVersion}`);
|
|
624
|
+
if (!(spec.baseImage.includes("python") || spec.baseImage.includes("anaconda") || spec.baseImage.includes("miniconda")) && spec.baseImage.includes("ubuntu")) {
|
|
625
|
+
lines.push("RUN apt-get update && \\");
|
|
626
|
+
lines.push(" apt-get install -y software-properties-common && \\");
|
|
627
|
+
lines.push(" add-apt-repository -y ppa:deadsnakes/ppa && \\");
|
|
628
|
+
lines.push(` apt-get install -y python${spec.pythonVersion} python${spec.pythonVersion}-venv python${spec.pythonVersion}-distutils && \\`);
|
|
629
|
+
lines.push(" apt-get clean && rm -rf /var/lib/apt/lists/*");
|
|
630
|
+
lines.push("");
|
|
631
|
+
lines.push(`RUN update-alternatives --install /usr/bin/python python /usr/bin/python${spec.pythonVersion} 1 && \\`);
|
|
632
|
+
lines.push(` update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${spec.pythonVersion} 1`);
|
|
633
|
+
lines.push("");
|
|
634
|
+
lines.push("RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python");
|
|
635
|
+
}
|
|
636
|
+
lines.push("");
|
|
637
|
+
}
|
|
638
|
+
if (spec.conda && spec.conda.packages.length > 0) {
|
|
639
|
+
lines.push("# Install micromamba and conda packages");
|
|
640
|
+
lines.push("RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba && \\");
|
|
641
|
+
lines.push(" mv bin/micromamba /usr/local/bin/ && \\");
|
|
642
|
+
lines.push(" micromamba shell init -s bash -p /opt/conda");
|
|
643
|
+
lines.push("");
|
|
644
|
+
const channelArgs = (spec.conda.channels || ["conda-forge"]).map((c) => `-c ${c}`).join(" ");
|
|
645
|
+
lines.push(`RUN micromamba install -y -n base ${channelArgs} ${spec.conda.packages.join(" ")} && \\`);
|
|
646
|
+
lines.push(" micromamba clean --all --yes");
|
|
647
|
+
lines.push("ENV PATH=\"/opt/conda/bin:$PATH\"");
|
|
648
|
+
lines.push("");
|
|
649
|
+
}
|
|
650
|
+
if (spec.packages && spec.packages.length > 0) {
|
|
651
|
+
lines.push("# Install Python packages");
|
|
652
|
+
lines.push(`RUN pip install --no-cache-dir ${spec.packages.join(" ")}`);
|
|
653
|
+
lines.push("");
|
|
654
|
+
}
|
|
655
|
+
if (spec.commands && spec.commands.length > 0) {
|
|
656
|
+
lines.push("# Custom commands");
|
|
657
|
+
for (const cmd of spec.commands) lines.push(`RUN ${cmd}`);
|
|
658
|
+
lines.push("");
|
|
659
|
+
}
|
|
660
|
+
if (spec.user) lines.push(`USER ${spec.user}`);
|
|
661
|
+
return lines.join("\n");
|
|
662
|
+
}
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/manage-sandboxes.ts
|
|
665
|
+
const MANAGE_SANDBOXES_TOOL_NAME = "manageSandboxes";
|
|
666
|
+
function createManageSandboxesTool(client, options = {}) {
|
|
667
|
+
return {
|
|
668
|
+
name: MANAGE_SANDBOXES_TOOL_NAME,
|
|
669
|
+
description: "Create, inspect, and manage sandbox fleets for parallel agent workloads.",
|
|
670
|
+
parameters: MANAGE_SANDBOXES_PARAMETERS,
|
|
671
|
+
async execute(input) {
|
|
672
|
+
switch (input.action) {
|
|
673
|
+
case "capabilities": return client.fleets.capabilities();
|
|
674
|
+
case "create": return client.fleets.create(applyToolPolicy(requireCreateOptions(input), options.policy));
|
|
675
|
+
case "createWithCoordinator": return client.fleets.createWithCoordinator(applyToolPolicy(requireCreateWithCoordinatorOptions(input), options.policy));
|
|
676
|
+
case "list": return client.fleets.list({ fleetId: requireString(input, "fleetId") });
|
|
677
|
+
case "delete": return client.fleets.delete(requireString(input, "fleetId"));
|
|
678
|
+
case "attachMachine": return client.fleets.attachMachine(requireString(input, "fleetId"), requireMachine(input));
|
|
679
|
+
case "detachMachine": return client.fleets.detachMachine(requireString(input, "fleetId"), requireString(input, "machineId"));
|
|
680
|
+
case "manifest": return client.fleets.manifest(requireString(input, "fleetId"));
|
|
681
|
+
case "usage": return client.fleets.usage(requireString(input, "fleetId"));
|
|
682
|
+
case "trace": return client.fleets.trace(requireString(input, "fleetId"));
|
|
683
|
+
case "intelligence": return client.fleets.intelligence(requireString(input, "fleetId"));
|
|
684
|
+
case "cost": return client.fleets.cost(requireString(input, "fleetId"));
|
|
685
|
+
case "createWorkspaceSnapshot": return client.fleets.createWorkspaceSnapshot(requireString(input, "fleetId"));
|
|
686
|
+
case "restoreWorkspaceSnapshot": return client.fleets.restoreWorkspaceSnapshot(requireString(input, "fleetId"), requireString(input, "snapshotId"));
|
|
687
|
+
case "reconcileWorkspace": return client.fleets.reconcileWorkspace(requireString(input, "fleetId"));
|
|
688
|
+
default: throw new Error(`Unsupported manageSandboxes action: ${String(input.action)}`);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function requireString(input, key) {
|
|
694
|
+
const value = input[key];
|
|
695
|
+
if (typeof value !== "string" || value.length === 0) throw new Error(`manageSandboxes requires ${key}`);
|
|
696
|
+
return value;
|
|
697
|
+
}
|
|
698
|
+
function requireCreateOptions(input) {
|
|
699
|
+
const value = input.options;
|
|
700
|
+
if (!value || typeof value !== "object") throw new Error("manageSandboxes requires options");
|
|
701
|
+
return rejectUserPolicy(value);
|
|
702
|
+
}
|
|
703
|
+
function requireCreateWithCoordinatorOptions(input) {
|
|
704
|
+
const value = input.options;
|
|
705
|
+
if (!value || typeof value !== "object") throw new Error("manageSandboxes requires options");
|
|
706
|
+
return rejectUserPolicy(value);
|
|
707
|
+
}
|
|
708
|
+
function rejectUserPolicy(options) {
|
|
709
|
+
if ("policy" in options && options.policy !== void 0) throw new Error("manageSandboxes policy must be supplied by the tool host");
|
|
710
|
+
return options;
|
|
711
|
+
}
|
|
712
|
+
function applyToolPolicy(options, policy) {
|
|
713
|
+
if (!policy) throw new Error("manageSandboxes create requires a host-owned policy");
|
|
714
|
+
return {
|
|
715
|
+
...options,
|
|
716
|
+
policy
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
function requireMachine(input) {
|
|
720
|
+
const value = input.machine;
|
|
721
|
+
if (!value || typeof value !== "object") throw new Error("manageSandboxes requires machine");
|
|
722
|
+
const machine = value;
|
|
723
|
+
requireString(machine, "machineId");
|
|
724
|
+
requireString(machine, "sandboxId");
|
|
725
|
+
return value;
|
|
726
|
+
}
|
|
727
|
+
const fleetId = {
|
|
728
|
+
type: "string",
|
|
729
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
|
|
730
|
+
};
|
|
731
|
+
const MANAGE_SANDBOXES_PARAMETERS = {
|
|
732
|
+
type: "object",
|
|
733
|
+
additionalProperties: false,
|
|
734
|
+
required: ["action"],
|
|
735
|
+
properties: {
|
|
736
|
+
action: {
|
|
737
|
+
type: "string",
|
|
738
|
+
enum: [
|
|
739
|
+
"capabilities",
|
|
740
|
+
"create",
|
|
741
|
+
"createWithCoordinator",
|
|
742
|
+
"list",
|
|
743
|
+
"delete",
|
|
744
|
+
"attachMachine",
|
|
745
|
+
"detachMachine",
|
|
746
|
+
"manifest",
|
|
747
|
+
"usage",
|
|
748
|
+
"trace",
|
|
749
|
+
"intelligence",
|
|
750
|
+
"cost",
|
|
751
|
+
"createWorkspaceSnapshot",
|
|
752
|
+
"restoreWorkspaceSnapshot",
|
|
753
|
+
"reconcileWorkspace"
|
|
754
|
+
]
|
|
755
|
+
},
|
|
756
|
+
fleetId,
|
|
757
|
+
machineId: fleetId,
|
|
758
|
+
snapshotId: {
|
|
759
|
+
type: "string",
|
|
760
|
+
minLength: 1
|
|
761
|
+
},
|
|
762
|
+
options: { type: "object" },
|
|
763
|
+
machine: {
|
|
764
|
+
type: "object",
|
|
765
|
+
required: ["machineId", "sandboxId"],
|
|
766
|
+
additionalProperties: true,
|
|
767
|
+
properties: {
|
|
768
|
+
machineId: fleetId,
|
|
769
|
+
sandboxId: {
|
|
770
|
+
type: "string",
|
|
771
|
+
minLength: 1,
|
|
772
|
+
maxLength: 128
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/mcp.ts
|
|
780
|
+
/**
|
|
781
|
+
* MCP (Model Context Protocol) helpers for sandbox capabilities.
|
|
782
|
+
*
|
|
783
|
+
* The sandbox exposes capabilities (currently `computer_use`, more
|
|
784
|
+
* later) as MCP tools over Streamable HTTP. Any MCP-capable client —
|
|
785
|
+
* Claude Desktop, Cursor, claude-code, codex, opencode, raw
|
|
786
|
+
* `@modelcontextprotocol/sdk` apps — can consume this surface by
|
|
787
|
+
* pasting the JSON returned from `Sandbox#getMcpEndpoint()` (or
|
|
788
|
+
* `buildSandboxMcpConfig` if you already have the URL + token) into
|
|
789
|
+
* the client's MCP config.
|
|
790
|
+
*
|
|
791
|
+
* Security model:
|
|
792
|
+
* - Tokens are capability-scoped JWTs (claim `cap: ["computer_use"]`).
|
|
793
|
+
* - Full sandbox runtime tokens are rejected on `/mcp`; only
|
|
794
|
+
* capability-scoped tokens work there.
|
|
795
|
+
* - A scoped token cannot pivot to admin endpoints (`/exec`, `/files`,
|
|
796
|
+
* etc.) — those routes reject scoped tokens.
|
|
797
|
+
* - Tokens are short-lived. Rotate via `Sandbox#getMcpEndpoint()`,
|
|
798
|
+
* which mints a fresh token each call.
|
|
799
|
+
*/
|
|
800
|
+
/** Default name of the MCP server entry — surfaces in the host UI. */
|
|
801
|
+
const SANDBOX_MCP_SERVER_NAME = "tangle-sandbox";
|
|
802
|
+
/**
|
|
803
|
+
* Build the canonical `mcpServers` config for a sandbox MCP endpoint.
|
|
804
|
+
* Pure function — no I/O, no crypto. Use this when you already have a
|
|
805
|
+
* `{ url, authToken }` pair from the API and just want the JSON shape
|
|
806
|
+
* to paste into a host. Most callers should use
|
|
807
|
+
* `Sandbox#getMcpEndpoint()` instead, which fetches a freshly-minted
|
|
808
|
+
* token from the API.
|
|
809
|
+
*/
|
|
810
|
+
function buildSandboxMcpConfig(options) {
|
|
811
|
+
if (!options.sandboxUrl) throw new Error("buildSandboxMcpConfig: sandboxUrl is required");
|
|
812
|
+
if (!options.authToken) throw new Error("buildSandboxMcpConfig: authToken is required");
|
|
813
|
+
const serverName = options.serverName ?? "tangle-sandbox";
|
|
814
|
+
const baseUrl = options.sandboxUrl.replace(/\/+$/, "");
|
|
815
|
+
return {
|
|
816
|
+
serverName,
|
|
817
|
+
config: { mcpServers: { [serverName]: {
|
|
818
|
+
type: "http",
|
|
819
|
+
url: `${baseUrl}/mcp`,
|
|
820
|
+
headers: { Authorization: `Bearer ${options.authToken}` }
|
|
821
|
+
} } }
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
//#endregion
|
|
825
|
+
export { AuthError, CapabilityError, CollaborationClient, CollaborationFileBridge, Image, ImageBuilder, IntegrationsManager, IntelligenceClient, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, NetworkError, NotFoundError, PartialFailureError, QuotaError, SANDBOX_MCP_SERVER_NAME, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxFleet, SandboxFleetClient, SandboxInstance, SandboxSession, ServerError, StateError, TangleSandboxClient, TimeoutError, ValidationError, buildCollaborationDocumentId, buildSandboxMcpConfig, buildTraceExportPayload, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, generateAttestationNonce, generateDockerfile, mergeAgentProfiles, normalizeCollaborationPath, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, startTeeAttestationHeartbeat, toOtelJson };
|