@tangle-network/tcloud 0.4.11 → 0.4.13
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 +13 -11
- package/dist/{chunk-DRCOPW7D.js → chunk-GNACB23W.js} +3 -2
- package/dist/{chunk-IWDE7ZPN.js → chunk-UBUCUSCF.js} +1 -1
- package/dist/cli.cjs +5 -4
- package/dist/cli.js +4 -4
- package/dist/index.cjs +3 -2
- package/dist/index.js +2 -2
- package/dist/sandbox.cjs +3 -2
- package/dist/sandbox.d.cts +23 -1
- package/dist/sandbox.d.ts +23 -1
- package/dist/sandbox.js +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tcloud
|
|
2
2
|
|
|
3
|
-
TypeScript SDK and CLI for [Tangle
|
|
3
|
+
TypeScript SDK and CLI for [Tangle Router](https://router.tangle.tools): model routing, sandbox-backed agent calls, operator routing, and anonymous payments via ShieldedCredits.
|
|
4
4
|
|
|
5
5
|
Zero framework dependencies. Pure `fetch` + SSE. Works in Node.js, Deno, Bun, and edge runtimes.
|
|
6
6
|
|
|
@@ -37,21 +37,23 @@ Zero framework dependencies. Pure `fetch` + SSE. Works in Node.js, Deno, Bun, an
|
|
|
37
37
|
## Installation
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install tcloud
|
|
40
|
+
npm install @tangle-network/tcloud
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Or run the CLI directly:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
npx tcloud chat "What is Tangle?"
|
|
46
|
+
npx @tangle-network/tcloud chat "What is Tangle?"
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
Do not install unscoped `tcloud`. It is unrelated to Tangle.
|
|
50
|
+
|
|
49
51
|
## SDK
|
|
50
52
|
|
|
51
53
|
### Quick Start
|
|
52
54
|
|
|
53
55
|
```ts
|
|
54
|
-
import { TCloud } from 'tcloud'
|
|
56
|
+
import { TCloud } from '@tangle-network/tcloud'
|
|
55
57
|
|
|
56
58
|
// Set model at client creation — explicit and consistent.
|
|
57
59
|
const client = new TCloud({
|
|
@@ -159,7 +161,7 @@ console.log(completion.choices[0].message.content)
|
|
|
159
161
|
Anonymous inference with no API key. Uses EIP-712 SpendAuth signatures — the operator verifies payment without learning your identity.
|
|
160
162
|
|
|
161
163
|
```ts
|
|
162
|
-
import { TCloud } from 'tcloud'
|
|
164
|
+
import { TCloud } from '@tangle-network/tcloud'
|
|
163
165
|
|
|
164
166
|
const client = TCloud.shielded()
|
|
165
167
|
const answer = await client.ask('Hello from the shadows')
|
|
@@ -361,10 +363,10 @@ tcloud auth status # Check current auth
|
|
|
361
363
|
### Chat
|
|
362
364
|
|
|
363
365
|
```bash
|
|
364
|
-
tcloud chat "Explain zero-knowledge proofs"
|
|
365
|
-
tcloud chat -m meta-llama/llama-4-maverick "Hello"
|
|
366
|
-
tcloud chat --private "Anonymous request" # ShieldedCredits mode
|
|
367
|
-
tcloud chat # Interactive mode
|
|
366
|
+
npx @tangle-network/tcloud chat "Explain zero-knowledge proofs"
|
|
367
|
+
npx @tangle-network/tcloud chat -m meta-llama/llama-4-maverick "Hello"
|
|
368
|
+
npx @tangle-network/tcloud chat --private "Anonymous request" # ShieldedCredits mode
|
|
369
|
+
npx @tangle-network/tcloud chat # Interactive mode
|
|
368
370
|
```
|
|
369
371
|
|
|
370
372
|
### Browse
|
|
@@ -409,8 +411,8 @@ tcloud config --model gpt-4o-mini
|
|
|
409
411
|
Environment variables:
|
|
410
412
|
- `TANGLE_API_KEY` — API key (primary). One key for router + sandbox + all Tangle products.
|
|
411
413
|
- `TCLOUD_API_KEY` — Deprecated alias, still honored for backwards compatibility.
|
|
412
|
-
- `
|
|
413
|
-
- `
|
|
414
|
+
- `TANGLE_ROUTER_URL` — Override CLI router URL.
|
|
415
|
+
- `TCLOUD_API_URL` — Deprecated CLI router URL alias.
|
|
414
416
|
|
|
415
417
|
## OpenAI SDK Compatibility
|
|
416
418
|
|
|
@@ -245,10 +245,11 @@ function buildSandboxCreateOptions(options) {
|
|
|
245
245
|
url: options.gitUrl,
|
|
246
246
|
ref: options.gitRef
|
|
247
247
|
} : void 0,
|
|
248
|
-
resources: options.cpu || options.memoryMb || options.diskGb ? {
|
|
248
|
+
resources: options.cpu || options.memoryMb || options.diskGb || options.accelerator ? {
|
|
249
249
|
cpuCores: options.cpu,
|
|
250
250
|
memoryMB: options.memoryMb,
|
|
251
|
-
diskGB: options.diskGb
|
|
251
|
+
diskGB: options.diskGb,
|
|
252
|
+
accelerator: options.accelerator
|
|
252
253
|
} : void 0,
|
|
253
254
|
// backend: merge `backend` (type string) with `agentProfile` (carried
|
|
254
255
|
// as `backend.profile` on the underlying SDK). Either may be set
|
package/dist/cli.cjs
CHANGED
|
@@ -1856,10 +1856,11 @@ function buildSandboxCreateOptions(options) {
|
|
|
1856
1856
|
url: options.gitUrl,
|
|
1857
1857
|
ref: options.gitRef
|
|
1858
1858
|
} : void 0,
|
|
1859
|
-
resources: options.cpu || options.memoryMb || options.diskGb ? {
|
|
1859
|
+
resources: options.cpu || options.memoryMb || options.diskGb || options.accelerator ? {
|
|
1860
1860
|
cpuCores: options.cpu,
|
|
1861
1861
|
memoryMB: options.memoryMb,
|
|
1862
|
-
diskGB: options.diskGb
|
|
1862
|
+
diskGB: options.diskGb,
|
|
1863
|
+
accelerator: options.accelerator
|
|
1863
1864
|
} : void 0,
|
|
1864
1865
|
// backend: merge `backend` (type string) with `agentProfile` (carried
|
|
1865
1866
|
// as `backend.profile` on the underlying SDK). Either may be set
|
|
@@ -2024,8 +2025,8 @@ function loadConfig() {
|
|
|
2024
2025
|
...fileConfig,
|
|
2025
2026
|
...process.env.TANGLE_ROUTER_URL ? { apiUrl: process.env.TANGLE_ROUTER_URL.replace(/\/v1\/?$/, "") } : {},
|
|
2026
2027
|
...process.env.TCLOUD_API_URL ? { apiUrl: process.env.TCLOUD_API_URL.replace(/\/v1\/?$/, "") } : {},
|
|
2027
|
-
...process.env.
|
|
2028
|
-
...process.env.
|
|
2028
|
+
...process.env.TCLOUD_API_KEY ? { apiKey: process.env.TCLOUD_API_KEY } : {},
|
|
2029
|
+
...process.env.TANGLE_API_KEY ? { apiKey: process.env.TANGLE_API_KEY } : {}
|
|
2029
2030
|
};
|
|
2030
2031
|
}
|
|
2031
2032
|
function saveConfig(c) {
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
TCloud
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UBUCUSCF.js";
|
|
5
5
|
import {
|
|
6
6
|
TCloudSandbox
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GNACB23W.js";
|
|
8
8
|
import {
|
|
9
9
|
generateWallet
|
|
10
10
|
} from "./chunk-THOMQXU5.js";
|
|
@@ -29,8 +29,8 @@ function loadConfig() {
|
|
|
29
29
|
...fileConfig,
|
|
30
30
|
...process.env.TANGLE_ROUTER_URL ? { apiUrl: process.env.TANGLE_ROUTER_URL.replace(/\/v1\/?$/, "") } : {},
|
|
31
31
|
...process.env.TCLOUD_API_URL ? { apiUrl: process.env.TCLOUD_API_URL.replace(/\/v1\/?$/, "") } : {},
|
|
32
|
-
...process.env.
|
|
33
|
-
...process.env.
|
|
32
|
+
...process.env.TCLOUD_API_KEY ? { apiKey: process.env.TCLOUD_API_KEY } : {},
|
|
33
|
+
...process.env.TANGLE_API_KEY ? { apiKey: process.env.TANGLE_API_KEY } : {}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function saveConfig(c) {
|
package/dist/index.cjs
CHANGED
|
@@ -2000,10 +2000,11 @@ function buildSandboxCreateOptions(options) {
|
|
|
2000
2000
|
url: options.gitUrl,
|
|
2001
2001
|
ref: options.gitRef
|
|
2002
2002
|
} : void 0,
|
|
2003
|
-
resources: options.cpu || options.memoryMb || options.diskGb ? {
|
|
2003
|
+
resources: options.cpu || options.memoryMb || options.diskGb || options.accelerator ? {
|
|
2004
2004
|
cpuCores: options.cpu,
|
|
2005
2005
|
memoryMB: options.memoryMb,
|
|
2006
|
-
diskGB: options.diskGb
|
|
2006
|
+
diskGB: options.diskGb,
|
|
2007
|
+
accelerator: options.accelerator
|
|
2007
2008
|
} : void 0,
|
|
2008
2009
|
// backend: merge `backend` (type string) with `agentProfile` (carried
|
|
2009
2010
|
// as `backend.profile` on the underlying SDK). Either may be set
|
package/dist/index.js
CHANGED
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
toHex,
|
|
12
12
|
verifyAttestation,
|
|
13
13
|
verifyAttestationAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UBUCUSCF.js";
|
|
15
15
|
import {
|
|
16
16
|
TCloudSandbox,
|
|
17
17
|
createTeeAttestationChallenge,
|
|
18
18
|
generateAttestationNonce,
|
|
19
19
|
startTeeAttestationHeartbeat
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GNACB23W.js";
|
|
21
21
|
import {
|
|
22
22
|
createShieldedClient,
|
|
23
23
|
estimateCost,
|
package/dist/sandbox.cjs
CHANGED
|
@@ -271,10 +271,11 @@ function buildSandboxCreateOptions(options) {
|
|
|
271
271
|
url: options.gitUrl,
|
|
272
272
|
ref: options.gitRef
|
|
273
273
|
} : void 0,
|
|
274
|
-
resources: options.cpu || options.memoryMb || options.diskGb ? {
|
|
274
|
+
resources: options.cpu || options.memoryMb || options.diskGb || options.accelerator ? {
|
|
275
275
|
cpuCores: options.cpu,
|
|
276
276
|
memoryMB: options.memoryMb,
|
|
277
|
-
diskGB: options.diskGb
|
|
277
|
+
diskGB: options.diskGb,
|
|
278
|
+
accelerator: options.accelerator
|
|
278
279
|
} : void 0,
|
|
279
280
|
// backend: merge `backend` (type string) with `agentProfile` (carried
|
|
280
281
|
// as `backend.profile` on the underlying SDK). Either may be set
|
package/dist/sandbox.d.cts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/sandbox';
|
|
2
2
|
import { AsyncAttestationPolicy, AttestationVerificationResult } from '@tangle-network/tcloud-attestation';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* GPU / accelerator request, mirroring `@tangle-network/sandbox`'s
|
|
6
|
+
* `SandboxResources.accelerator` shape (that type is not re-exported from the
|
|
7
|
+
* SDK's public entry, so we declare the structural shape here and forward it
|
|
8
|
+
* verbatim). `kind` is the accelerator class (e.g. 'nvidia-a100'); `count`
|
|
9
|
+
* defaults to 1; `memoryMB` is a minimum device-memory floor when the exact
|
|
10
|
+
* class is flexible.
|
|
11
|
+
*/
|
|
12
|
+
interface SandboxAccelerator {
|
|
13
|
+
kind: string;
|
|
14
|
+
count?: number;
|
|
15
|
+
memoryMB?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
type TCloudSandboxTee = 'any' | 'tdx' | 'nitro' | 'sev-snp' | 'phala-dstack' | 'gcp' | 'azure' | (string & {});
|
|
5
19
|
interface TCloudSandboxCreateOptions {
|
|
6
20
|
name?: string;
|
|
@@ -10,6 +24,14 @@ interface TCloudSandboxCreateOptions {
|
|
|
10
24
|
cpu?: number;
|
|
11
25
|
memoryMb?: number;
|
|
12
26
|
diskGb?: number;
|
|
27
|
+
/**
|
|
28
|
+
* GPU / accelerator request for heavy compute workloads (CFD, FEA, PDE,
|
|
29
|
+
* MD, training). Forwarded verbatim to the underlying `@tangle-network/
|
|
30
|
+
* sandbox` `CreateSandboxOptions.resources.accelerator`, which the fleet
|
|
31
|
+
* autoscaler uses to provision a GPU-class host. `{ kind, count?, memoryMB? }`
|
|
32
|
+
* — e.g. `{ kind: 'nvidia-a100', count: 1 }`. Omit for CPU-only sandboxes.
|
|
33
|
+
*/
|
|
34
|
+
accelerator?: SandboxAccelerator;
|
|
13
35
|
gitUrl?: string;
|
|
14
36
|
gitRef?: string;
|
|
15
37
|
backend?: 'opencode' | 'claude-code' | 'codex' | 'amp' | (string & {});
|
|
@@ -107,4 +129,4 @@ declare function buildSandboxCreateOptions(options: TCloudSandboxCreateOptions):
|
|
|
107
129
|
declare function shouldVerifyAttestation(options: Pick<TCloudSandboxCreateOptions, 'tee' | 'verify'>): boolean;
|
|
108
130
|
declare function generateAttestationNonce(bytes?: number): string;
|
|
109
131
|
|
|
110
|
-
export { TCloudSandbox, type TCloudSandboxAttestationStatus, type TCloudSandboxConfig, type TCloudSandboxCreateOptions, type TCloudSandboxCreateResult, type TCloudSandboxTee, type TCloudTeeAttestationChallenge, type TCloudTeeAttestationHeartbeat, type TCloudTeeAttestationHeartbeatOptions, type TCloudTeeAttestationHeartbeatSample, buildSandboxCreateOptions, createTeeAttestationChallenge, generateAttestationNonce, shouldVerifyAttestation, startTeeAttestationHeartbeat };
|
|
132
|
+
export { type SandboxAccelerator, TCloudSandbox, type TCloudSandboxAttestationStatus, type TCloudSandboxConfig, type TCloudSandboxCreateOptions, type TCloudSandboxCreateResult, type TCloudSandboxTee, type TCloudTeeAttestationChallenge, type TCloudTeeAttestationHeartbeat, type TCloudTeeAttestationHeartbeatOptions, type TCloudTeeAttestationHeartbeatSample, buildSandboxCreateOptions, createTeeAttestationChallenge, generateAttestationNonce, shouldVerifyAttestation, startTeeAttestationHeartbeat };
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/sandbox';
|
|
2
2
|
import { AsyncAttestationPolicy, AttestationVerificationResult } from '@tangle-network/tcloud-attestation';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* GPU / accelerator request, mirroring `@tangle-network/sandbox`'s
|
|
6
|
+
* `SandboxResources.accelerator` shape (that type is not re-exported from the
|
|
7
|
+
* SDK's public entry, so we declare the structural shape here and forward it
|
|
8
|
+
* verbatim). `kind` is the accelerator class (e.g. 'nvidia-a100'); `count`
|
|
9
|
+
* defaults to 1; `memoryMB` is a minimum device-memory floor when the exact
|
|
10
|
+
* class is flexible.
|
|
11
|
+
*/
|
|
12
|
+
interface SandboxAccelerator {
|
|
13
|
+
kind: string;
|
|
14
|
+
count?: number;
|
|
15
|
+
memoryMB?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
type TCloudSandboxTee = 'any' | 'tdx' | 'nitro' | 'sev-snp' | 'phala-dstack' | 'gcp' | 'azure' | (string & {});
|
|
5
19
|
interface TCloudSandboxCreateOptions {
|
|
6
20
|
name?: string;
|
|
@@ -10,6 +24,14 @@ interface TCloudSandboxCreateOptions {
|
|
|
10
24
|
cpu?: number;
|
|
11
25
|
memoryMb?: number;
|
|
12
26
|
diskGb?: number;
|
|
27
|
+
/**
|
|
28
|
+
* GPU / accelerator request for heavy compute workloads (CFD, FEA, PDE,
|
|
29
|
+
* MD, training). Forwarded verbatim to the underlying `@tangle-network/
|
|
30
|
+
* sandbox` `CreateSandboxOptions.resources.accelerator`, which the fleet
|
|
31
|
+
* autoscaler uses to provision a GPU-class host. `{ kind, count?, memoryMB? }`
|
|
32
|
+
* — e.g. `{ kind: 'nvidia-a100', count: 1 }`. Omit for CPU-only sandboxes.
|
|
33
|
+
*/
|
|
34
|
+
accelerator?: SandboxAccelerator;
|
|
13
35
|
gitUrl?: string;
|
|
14
36
|
gitRef?: string;
|
|
15
37
|
backend?: 'opencode' | 'claude-code' | 'codex' | 'amp' | (string & {});
|
|
@@ -107,4 +129,4 @@ declare function buildSandboxCreateOptions(options: TCloudSandboxCreateOptions):
|
|
|
107
129
|
declare function shouldVerifyAttestation(options: Pick<TCloudSandboxCreateOptions, 'tee' | 'verify'>): boolean;
|
|
108
130
|
declare function generateAttestationNonce(bytes?: number): string;
|
|
109
131
|
|
|
110
|
-
export { TCloudSandbox, type TCloudSandboxAttestationStatus, type TCloudSandboxConfig, type TCloudSandboxCreateOptions, type TCloudSandboxCreateResult, type TCloudSandboxTee, type TCloudTeeAttestationChallenge, type TCloudTeeAttestationHeartbeat, type TCloudTeeAttestationHeartbeatOptions, type TCloudTeeAttestationHeartbeatSample, buildSandboxCreateOptions, createTeeAttestationChallenge, generateAttestationNonce, shouldVerifyAttestation, startTeeAttestationHeartbeat };
|
|
132
|
+
export { type SandboxAccelerator, TCloudSandbox, type TCloudSandboxAttestationStatus, type TCloudSandboxConfig, type TCloudSandboxCreateOptions, type TCloudSandboxCreateResult, type TCloudSandboxTee, type TCloudTeeAttestationChallenge, type TCloudTeeAttestationHeartbeat, type TCloudTeeAttestationHeartbeatOptions, type TCloudTeeAttestationHeartbeatSample, buildSandboxCreateOptions, createTeeAttestationChallenge, generateAttestationNonce, shouldVerifyAttestation, startTeeAttestationHeartbeat };
|
package/dist/sandbox.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/tcloud",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "TypeScript SDK and CLI for Tangle
|
|
3
|
+
"version": "0.4.13",
|
|
4
|
+
"description": "TypeScript SDK and CLI for Tangle Router, Sandbox, model routing, and agent service calls",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -95,18 +95,23 @@
|
|
|
95
95
|
"url": "git+https://github.com/tangle-network/tcloud.git",
|
|
96
96
|
"directory": "packages/tcloud"
|
|
97
97
|
},
|
|
98
|
-
"homepage": "https://
|
|
98
|
+
"homepage": "https://router.tangle.tools/docs",
|
|
99
99
|
"keywords": [
|
|
100
100
|
"tangle",
|
|
101
101
|
"ai",
|
|
102
102
|
"llm",
|
|
103
103
|
"inference",
|
|
104
104
|
"decentralized",
|
|
105
|
+
"agent-runtime",
|
|
106
|
+
"sandbox",
|
|
107
|
+
"browser-agent",
|
|
108
|
+
"x402",
|
|
105
109
|
"openai",
|
|
106
110
|
"sdk",
|
|
107
111
|
"cli",
|
|
108
112
|
"privacy",
|
|
109
|
-
"shielded-credits"
|
|
113
|
+
"shielded-credits",
|
|
114
|
+
"tangle-router"
|
|
110
115
|
],
|
|
111
116
|
"engines": {
|
|
112
117
|
"node": ">=18"
|