@tangle-network/tcloud 0.4.14 → 0.5.0

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TCloudClient
3
- } from "./chunk-LUJXMUH5.js";
3
+ } from "./chunk-H3K3A3EI.js";
4
4
 
5
5
  // src/shielded.ts
6
6
  import { privateKeyToAccount } from "viem/accounts";
@@ -1,3 +1,7 @@
1
+ import {
2
+ packageVersion
3
+ } from "./chunk-YK2SGW76.js";
4
+
1
5
  // src/private-router.ts
2
6
  function secureRandom() {
3
7
  const arr = new Uint32Array(1);
@@ -222,44 +226,31 @@ var PrivateRouter = class {
222
226
  var ROTATING_MARKER = "__tcloudRotating";
223
227
  var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
224
228
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
225
- var SDK_VERSION = "0.4.0";
226
229
  async function proxiedFetch(privacy, url, init, streaming) {
227
230
  if (!privacy || privacy.mode === "direct") {
228
231
  return fetch(url, init);
229
232
  }
230
- if (privacy.mode === "relayer") {
231
- if (!privacy.relayerUrl) {
232
- throw new Error('relayerUrl is required when privacy mode is "relayer"');
233
- }
234
- const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
235
- const hdrs = {};
236
- if (init.headers) {
237
- const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
238
- for (const [k, v] of entries) hdrs[k] = v;
239
- }
240
- return fetch(`${privacy.relayerUrl}${proxyPath}`, {
241
- method: "POST",
242
- headers: { "Content-Type": "application/json" },
243
- body: JSON.stringify({
244
- target: url,
245
- body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
246
- headers: hdrs
247
- })
248
- });
249
- }
250
- if (privacy.mode === "socks5") {
251
- if (!privacy.socksProxy) {
252
- throw new Error('socksProxy is required when privacy mode is "socks5"');
253
- }
254
- const { SocksProxyAgent } = await import("socks-proxy-agent");
255
- const agent = new SocksProxyAgent(privacy.socksProxy);
256
- return fetch(url, {
257
- ...init,
258
- // @ts-expect-error agent is supported by Node's undici but not in the standard RequestInit type
259
- agent
260
- });
261
- }
262
- return fetch(url, init);
233
+ if (privacy.mode !== "relayer") {
234
+ throw new Error(`Unsupported privacy mode: ${String(privacy.mode)}`);
235
+ }
236
+ if (!privacy.relayerUrl) {
237
+ throw new Error('relayerUrl is required when privacy mode is "relayer"');
238
+ }
239
+ const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
240
+ const headers = {};
241
+ if (init.headers) {
242
+ const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
243
+ for (const [key, value] of entries) headers[key] = value;
244
+ }
245
+ return fetch(`${privacy.relayerUrl}${proxyPath}`, {
246
+ method: "POST",
247
+ headers: { "Content-Type": "application/json" },
248
+ body: JSON.stringify({
249
+ target: url,
250
+ body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
251
+ headers
252
+ })
253
+ });
263
254
  }
264
255
  var DEFAULT_RETRY = {
265
256
  maxRetries: 3,
@@ -424,7 +415,7 @@ var TCloudClient = class _TCloudClient {
424
415
  this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
425
416
  this.headers = {
426
417
  "Content-Type": "application/json",
427
- "X-Tangle-Client": `tcloud-sdk/${SDK_VERSION}`
418
+ "X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
428
419
  };
429
420
  if (this.apiKey) {
430
421
  this.headers["Authorization"] = `Bearer ${this.apiKey}`;
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  createShieldedClient,
6
6
  generateWallet
7
- } from "./chunk-26M4HGWE.js";
7
+ } from "./chunk-GDGQQRE3.js";
8
8
  import {
9
9
  TCloudClient
10
- } from "./chunk-LUJXMUH5.js";
10
+ } from "./chunk-H3K3A3EI.js";
11
11
 
12
12
  // src/index.ts
13
13
  import {
@@ -0,0 +1,11 @@
1
+ // package.json
2
+ var version = "0.5.0";
3
+
4
+ // src/version.ts
5
+ function packageVersion() {
6
+ return version;
7
+ }
8
+
9
+ export {
10
+ packageVersion
11
+ };
package/dist/cli.cjs CHANGED
@@ -30,23 +30,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
+ // package.json
34
+ var version;
35
+ var init_package = __esm({
36
+ "package.json"() {
37
+ version = "0.5.0";
38
+ }
39
+ });
40
+
33
41
  // src/version.ts
34
42
  function packageVersion() {
35
- try {
36
- const packageJson = JSON.parse(
37
- fs.readFileSync(new URL("../package.json", import_meta.url), "utf-8")
38
- );
39
- if (typeof packageJson.version === "string") return packageJson.version;
40
- } catch {
41
- }
42
- return "0.0.0";
43
+ return version;
43
44
  }
44
- var fs, import_meta;
45
45
  var init_version = __esm({
46
46
  "src/version.ts"() {
47
47
  "use strict";
48
- fs = __toESM(require("fs"), 1);
49
- import_meta = {};
48
+ init_package();
50
49
  }
51
50
  });
52
51
 
@@ -486,47 +485,35 @@ var PrivateRouter = class {
486
485
  };
487
486
 
488
487
  // src/client.ts
488
+ init_version();
489
489
  var ROTATING_MARKER = "__tcloudRotating";
490
490
  var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
491
491
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
492
- var SDK_VERSION = "0.4.0";
493
492
  async function proxiedFetch(privacy, url, init, streaming) {
494
493
  if (!privacy || privacy.mode === "direct") {
495
494
  return fetch(url, init);
496
495
  }
497
- if (privacy.mode === "relayer") {
498
- if (!privacy.relayerUrl) {
499
- throw new Error('relayerUrl is required when privacy mode is "relayer"');
500
- }
501
- const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
502
- const hdrs = {};
503
- if (init.headers) {
504
- const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
505
- for (const [k, v] of entries) hdrs[k] = v;
506
- }
507
- return fetch(`${privacy.relayerUrl}${proxyPath}`, {
508
- method: "POST",
509
- headers: { "Content-Type": "application/json" },
510
- body: JSON.stringify({
511
- target: url,
512
- body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
513
- headers: hdrs
514
- })
515
- });
496
+ if (privacy.mode !== "relayer") {
497
+ throw new Error(`Unsupported privacy mode: ${String(privacy.mode)}`);
516
498
  }
517
- if (privacy.mode === "socks5") {
518
- if (!privacy.socksProxy) {
519
- throw new Error('socksProxy is required when privacy mode is "socks5"');
520
- }
521
- const { SocksProxyAgent } = await import("socks-proxy-agent");
522
- const agent = new SocksProxyAgent(privacy.socksProxy);
523
- return fetch(url, {
524
- ...init,
525
- // @ts-expect-error agent is supported by Node's undici but not in the standard RequestInit type
526
- agent
527
- });
499
+ if (!privacy.relayerUrl) {
500
+ throw new Error('relayerUrl is required when privacy mode is "relayer"');
501
+ }
502
+ const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
503
+ const headers = {};
504
+ if (init.headers) {
505
+ const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
506
+ for (const [key, value] of entries) headers[key] = value;
528
507
  }
529
- return fetch(url, init);
508
+ return fetch(`${privacy.relayerUrl}${proxyPath}`, {
509
+ method: "POST",
510
+ headers: { "Content-Type": "application/json" },
511
+ body: JSON.stringify({
512
+ target: url,
513
+ body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
514
+ headers
515
+ })
516
+ });
530
517
  }
531
518
  var DEFAULT_RETRY = {
532
519
  maxRetries: 3,
@@ -691,7 +678,7 @@ var TCloudClient = class _TCloudClient {
691
678
  this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
692
679
  this.headers = {
693
680
  "Content-Type": "application/json",
694
- "X-Tangle-Client": `tcloud-sdk/${SDK_VERSION}`
681
+ "X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
695
682
  };
696
683
  if (this.apiKey) {
697
684
  this.headers["Authorization"] = `Bearer ${this.apiKey}`;
@@ -2267,7 +2254,7 @@ var TCloud = class _TCloud extends TCloudClient {
2267
2254
 
2268
2255
  // src/cli.ts
2269
2256
  init_version();
2270
- var fs2 = __toESM(require("fs"), 1);
2257
+ var fs = __toESM(require("fs"), 1);
2271
2258
  var path = __toESM(require("path"), 1);
2272
2259
  var readline2 = __toESM(require("readline"), 1);
2273
2260
  var import_child_process = require("child_process");
@@ -2275,11 +2262,11 @@ var CONFIG_DIR = path.join(process.env.HOME || "~", ".tcloud");
2275
2262
  var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
2276
2263
  var WALLETS_FILE = path.join(CONFIG_DIR, "wallets.json");
2277
2264
  function ensureDir() {
2278
- if (!fs2.existsSync(CONFIG_DIR)) fs2.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
2265
+ if (!fs.existsSync(CONFIG_DIR)) fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
2279
2266
  }
2280
2267
  function loadConfig() {
2281
2268
  ensureDir();
2282
- const fileConfig = fs2.existsSync(CONFIG_FILE) ? JSON.parse(fs2.readFileSync(CONFIG_FILE, "utf-8")) : { apiUrl: "https://router.tangle.tools", defaultModel: "gpt-4o-mini", chainId: 3799 };
2269
+ const fileConfig = fs.existsSync(CONFIG_FILE) ? JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8")) : { apiUrl: "https://router.tangle.tools", defaultModel: "gpt-4o-mini", chainId: 3799 };
2283
2270
  return {
2284
2271
  ...fileConfig,
2285
2272
  ...process.env.TANGLE_ROUTER_URL ? { apiUrl: process.env.TANGLE_ROUTER_URL.replace(/\/v1\/?$/, "") } : {},
@@ -2290,16 +2277,16 @@ function loadConfig() {
2290
2277
  }
2291
2278
  function saveConfig(c) {
2292
2279
  ensureDir();
2293
- fs2.writeFileSync(CONFIG_FILE, JSON.stringify(c, null, 2), { mode: 384 });
2280
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(c, null, 2), { mode: 384 });
2294
2281
  }
2295
2282
  function loadWallets() {
2296
2283
  ensureDir();
2297
- if (fs2.existsSync(WALLETS_FILE)) return JSON.parse(fs2.readFileSync(WALLETS_FILE, "utf-8"));
2284
+ if (fs.existsSync(WALLETS_FILE)) return JSON.parse(fs.readFileSync(WALLETS_FILE, "utf-8"));
2298
2285
  return [];
2299
2286
  }
2300
2287
  function saveWallets(w) {
2301
2288
  ensureDir();
2302
- fs2.writeFileSync(WALLETS_FILE, JSON.stringify(w, null, 2), { mode: 384 });
2289
+ fs.writeFileSync(WALLETS_FILE, JSON.stringify(w, null, 2), { mode: 384 });
2303
2290
  }
2304
2291
  function getClient(opts) {
2305
2292
  const config = loadConfig();
@@ -2695,7 +2682,7 @@ program.command("speech").description("Generate speech audio").requiredOption("-
2695
2682
  model: opts.model,
2696
2683
  voice: opts.voice
2697
2684
  });
2698
- fs2.writeFileSync(opts.output, Buffer.from(audio));
2685
+ fs.writeFileSync(opts.output, Buffer.from(audio));
2699
2686
  const result = { output: opts.output, bytes: audio.byteLength };
2700
2687
  if (opts.json) printJson(result);
2701
2688
  else console.log(opts.output);
@@ -2707,7 +2694,7 @@ program.command("speech").description("Generate speech audio").requiredOption("-
2707
2694
  program.command("transcribe").description("Transcribe an audio file").argument("<file>", "Audio file").option("-m, --model <model>", "Transcription model").option("--language <language>", "Language hint").option("--prompt <prompt>", "Prompt hint").option("--json", "Print raw JSON response").action(async (file, opts) => {
2708
2695
  const client = getClient();
2709
2696
  try {
2710
- const data = fs2.readFileSync(file);
2697
+ const data = fs.readFileSync(file);
2711
2698
  const blob = new Blob([data]);
2712
2699
  const resp = await client.transcribe(blob, {
2713
2700
  model: opts.model,
package/dist/cli.js CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TCloud
4
- } from "./chunk-ZJCWJGPM.js";
5
- import {
6
- packageVersion
7
- } from "./chunk-GHMW4RWJ.js";
4
+ } from "./chunk-O33Y34UQ.js";
8
5
  import {
9
6
  TCloudSandbox
10
7
  } from "./chunk-GNACB23W.js";
11
8
  import {
12
9
  generateWallet
13
- } from "./chunk-26M4HGWE.js";
14
- import "./chunk-LUJXMUH5.js";
10
+ } from "./chunk-GDGQQRE3.js";
11
+ import "./chunk-H3K3A3EI.js";
12
+ import {
13
+ packageVersion
14
+ } from "./chunk-YK2SGW76.js";
15
15
 
16
16
  // src/cli.ts
17
17
  import { Command } from "commander";
@@ -380,15 +380,10 @@ interface AvatarJobStatus {
380
380
  error?: string;
381
381
  }
382
382
  interface PrivacyConfig {
383
- /** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. 'socks5' — route through SOCKS5 proxy (e.g. Tor). */
384
- mode: 'direct' | 'relayer' | 'socks5';
383
+ /** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. */
384
+ mode: 'direct' | 'relayer';
385
385
  /** Relayer URL for 'relayer' mode (e.g. 'http://localhost:3030') */
386
386
  relayerUrl?: string;
387
- /**
388
- * SOCKS5 proxy URL for 'socks5' mode (e.g. 'socks5://127.0.0.1:9050' for Tor).
389
- * Requires `socks-proxy-agent` as an optional peer dependency.
390
- */
391
- socksProxy?: string;
392
387
  }
393
388
  interface ShieldedConfig {
394
389
  /** Pre-existing spending private key (hex). If not set, generates ephemeral. */
@@ -380,15 +380,10 @@ interface AvatarJobStatus {
380
380
  error?: string;
381
381
  }
382
382
  interface PrivacyConfig {
383
- /** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. 'socks5' — route through SOCKS5 proxy (e.g. Tor). */
384
- mode: 'direct' | 'relayer' | 'socks5';
383
+ /** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. */
384
+ mode: 'direct' | 'relayer';
385
385
  /** Relayer URL for 'relayer' mode (e.g. 'http://localhost:3030') */
386
386
  relayerUrl?: string;
387
- /**
388
- * SOCKS5 proxy URL for 'socks5' mode (e.g. 'socks5://127.0.0.1:9050' for Tor).
389
- * Requires `socks-proxy-agent` as an optional peer dependency.
390
- */
391
- socksProxy?: string;
392
387
  }
393
388
  interface ShieldedConfig {
394
389
  /** Pre-existing spending private key (hex). If not set, generates ephemeral. */
package/dist/index.cjs CHANGED
@@ -277,48 +277,43 @@ var PrivateRouter = class {
277
277
  }
278
278
  };
279
279
 
280
+ // package.json
281
+ var version = "0.5.0";
282
+
283
+ // src/version.ts
284
+ function packageVersion() {
285
+ return version;
286
+ }
287
+
280
288
  // src/client.ts
281
289
  var ROTATING_MARKER = "__tcloudRotating";
282
290
  var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
283
291
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
284
- var SDK_VERSION = "0.4.0";
285
292
  async function proxiedFetch(privacy, url, init, streaming) {
286
293
  if (!privacy || privacy.mode === "direct") {
287
294
  return fetch(url, init);
288
295
  }
289
- if (privacy.mode === "relayer") {
290
- if (!privacy.relayerUrl) {
291
- throw new Error('relayerUrl is required when privacy mode is "relayer"');
292
- }
293
- const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
294
- const hdrs = {};
295
- if (init.headers) {
296
- const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
297
- for (const [k, v] of entries) hdrs[k] = v;
298
- }
299
- return fetch(`${privacy.relayerUrl}${proxyPath}`, {
300
- method: "POST",
301
- headers: { "Content-Type": "application/json" },
302
- body: JSON.stringify({
303
- target: url,
304
- body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
305
- headers: hdrs
306
- })
307
- });
296
+ if (privacy.mode !== "relayer") {
297
+ throw new Error(`Unsupported privacy mode: ${String(privacy.mode)}`);
308
298
  }
309
- if (privacy.mode === "socks5") {
310
- if (!privacy.socksProxy) {
311
- throw new Error('socksProxy is required when privacy mode is "socks5"');
312
- }
313
- const { SocksProxyAgent } = await import("socks-proxy-agent");
314
- const agent = new SocksProxyAgent(privacy.socksProxy);
315
- return fetch(url, {
316
- ...init,
317
- // @ts-expect-error agent is supported by Node's undici but not in the standard RequestInit type
318
- agent
319
- });
299
+ if (!privacy.relayerUrl) {
300
+ throw new Error('relayerUrl is required when privacy mode is "relayer"');
320
301
  }
321
- return fetch(url, init);
302
+ const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
303
+ const headers = {};
304
+ if (init.headers) {
305
+ const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
306
+ for (const [key, value] of entries) headers[key] = value;
307
+ }
308
+ return fetch(`${privacy.relayerUrl}${proxyPath}`, {
309
+ method: "POST",
310
+ headers: { "Content-Type": "application/json" },
311
+ body: JSON.stringify({
312
+ target: url,
313
+ body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
314
+ headers
315
+ })
316
+ });
322
317
  }
323
318
  var DEFAULT_RETRY = {
324
319
  maxRetries: 3,
@@ -483,7 +478,7 @@ var TCloudClient = class _TCloudClient {
483
478
  this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
484
479
  this.headers = {
485
480
  "Content-Type": "application/json",
486
- "X-Tangle-Client": `tcloud-sdk/${SDK_VERSION}`
481
+ "X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
487
482
  };
488
483
  if (this.apiKey) {
489
484
  this.headers["Authorization"] = `Bearer ${this.apiKey}`;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.cjs';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.cjs';
3
- import { a as TCloudClient, T as TCloudConfig, R as RotatingClientConfig } from './client-CaPP4njg.cjs';
4
- export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as ResearchHit, L as ResearchOptions, N as ResearchProvider, Q as ResearchResponse, S as RetryConfig, U as RotatingRoutingConfig, V as RotationStats, W as RoutingConfig, X as RoutingStrategy, Y as SandboxChatOptions, Z as SearchHit, _ as SearchOptions, $ as SearchProvider, a0 as SearchRecency, a1 as SearchResponse, a2 as ShieldedConfig, a3 as SpendAuth, a4 as SpendingLimits, a5 as TCloudError, a6 as TierConfig, a7 as TranscriptionResponse, a8 as UpdateKeyOptions, a9 as VideoGenerateOptions, aa as VideoResponse, ab as WatchJobOptions, ac as WebSearchPlugin } from './client-CaPP4njg.cjs';
3
+ import { a as TCloudClient, T as TCloudConfig, R as RotatingClientConfig } from './client-CAedbgfN.cjs';
4
+ export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as ResearchHit, L as ResearchOptions, N as ResearchProvider, Q as ResearchResponse, S as RetryConfig, U as RotatingRoutingConfig, V as RotationStats, W as RoutingConfig, X as RoutingStrategy, Y as SandboxChatOptions, Z as SearchHit, _ as SearchOptions, $ as SearchProvider, a0 as SearchRecency, a1 as SearchResponse, a2 as ShieldedConfig, a3 as SpendAuth, a4 as SpendingLimits, a5 as TCloudError, a6 as TierConfig, a7 as TranscriptionResponse, a8 as UpdateKeyOptions, a9 as VideoGenerateOptions, aa as VideoResponse, ab as WatchJobOptions, ac as WebSearchPlugin } from './client-CAedbgfN.cjs';
5
5
  import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.cjs';
6
6
  export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.cjs';
7
7
  export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, NitroAttestationDocument, NitroVerifierOptions, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createNitroHardwareVerifier, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseNitroAttestationDocument, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.js';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.js';
3
- import { a as TCloudClient, T as TCloudConfig, R as RotatingClientConfig } from './client-CaPP4njg.js';
4
- export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as ResearchHit, L as ResearchOptions, N as ResearchProvider, Q as ResearchResponse, S as RetryConfig, U as RotatingRoutingConfig, V as RotationStats, W as RoutingConfig, X as RoutingStrategy, Y as SandboxChatOptions, Z as SearchHit, _ as SearchOptions, $ as SearchProvider, a0 as SearchRecency, a1 as SearchResponse, a2 as ShieldedConfig, a3 as SpendAuth, a4 as SpendingLimits, a5 as TCloudError, a6 as TierConfig, a7 as TranscriptionResponse, a8 as UpdateKeyOptions, a9 as VideoGenerateOptions, aa as VideoResponse, ab as WatchJobOptions, ac as WebSearchPlugin } from './client-CaPP4njg.js';
3
+ import { a as TCloudClient, T as TCloudConfig, R as RotatingClientConfig } from './client-CAedbgfN.js';
4
+ export { A as ApiKeyInfo, b as AvatarGenerateRequest, c as AvatarGenerateResponse, d as AvatarJobStatus, e as AvatarResult, B as BatchJobResponse, f as BatchRequest, g as BridgeOptions, h as BridgeSession, C as ChatCompletion, i as ChatCompletionChunk, j as ChatMessage, k as ChatOptions, l as ChatPlugin, m as CompletionOptions, n as CompletionResponse, o as CreateKeyOptions, p as CreatedKey, q as CreditBalance, E as EmbeddingOptions, r as EmbeddingResponse, F as FineTuningJob, s as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, t as ImageEditOptions, u as ImageGenerateOptions, v as ImageResponse, J as JobEvent, M as Model, O as Operator, w as OperatorInfo, P as PricingTier, x as PrivacyConfig, y as PrivateRouter, z as PrivateRouterConfig, D as RerankOptions, H as RerankResponse, K as ResearchHit, L as ResearchOptions, N as ResearchProvider, Q as ResearchResponse, S as RetryConfig, U as RotatingRoutingConfig, V as RotationStats, W as RoutingConfig, X as RoutingStrategy, Y as SandboxChatOptions, Z as SearchHit, _ as SearchOptions, $ as SearchProvider, a0 as SearchRecency, a1 as SearchResponse, a2 as ShieldedConfig, a3 as SpendAuth, a4 as SpendingLimits, a5 as TCloudError, a6 as TierConfig, a7 as TranscriptionResponse, a8 as UpdateKeyOptions, a9 as VideoGenerateOptions, aa as VideoResponse, ab as WatchJobOptions, ac as WebSearchPlugin } from './client-CAedbgfN.js';
5
5
  import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.js';
6
6
  export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.js';
7
7
  export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, NitroAttestationDocument, NitroVerifierOptions, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createNitroHardwareVerifier, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseNitroAttestationDocument, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  toHex,
12
12
  verifyAttestation,
13
13
  verifyAttestationAsync
14
- } from "./chunk-ZJCWJGPM.js";
14
+ } from "./chunk-O33Y34UQ.js";
15
15
  import {
16
16
  TCloudSandbox,
17
17
  createTeeAttestationChallenge,
@@ -23,13 +23,14 @@ import {
23
23
  estimateCost,
24
24
  generateWallet,
25
25
  signSpendAuth
26
- } from "./chunk-26M4HGWE.js";
26
+ } from "./chunk-GDGQQRE3.js";
27
27
  import {
28
28
  BridgeSession,
29
29
  PrivateRouter,
30
30
  TCloudClient,
31
31
  TCloudError
32
- } from "./chunk-LUJXMUH5.js";
32
+ } from "./chunk-H3K3A3EI.js";
33
+ import "./chunk-YK2SGW76.js";
33
34
  export {
34
35
  BridgeSession,
35
36
  PrivateRouter,
package/dist/instance.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/instance.ts
@@ -261,48 +251,43 @@ var PrivateRouter = class {
261
251
  }
262
252
  };
263
253
 
254
+ // package.json
255
+ var version = "0.5.0";
256
+
257
+ // src/version.ts
258
+ function packageVersion() {
259
+ return version;
260
+ }
261
+
264
262
  // src/client.ts
265
263
  var ROTATING_MARKER = "__tcloudRotating";
266
264
  var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
267
265
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
268
- var SDK_VERSION = "0.4.0";
269
266
  async function proxiedFetch(privacy, url, init, streaming) {
270
267
  if (!privacy || privacy.mode === "direct") {
271
268
  return fetch(url, init);
272
269
  }
273
- if (privacy.mode === "relayer") {
274
- if (!privacy.relayerUrl) {
275
- throw new Error('relayerUrl is required when privacy mode is "relayer"');
276
- }
277
- const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
278
- const hdrs = {};
279
- if (init.headers) {
280
- const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
281
- for (const [k, v] of entries) hdrs[k] = v;
282
- }
283
- return fetch(`${privacy.relayerUrl}${proxyPath}`, {
284
- method: "POST",
285
- headers: { "Content-Type": "application/json" },
286
- body: JSON.stringify({
287
- target: url,
288
- body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
289
- headers: hdrs
290
- })
291
- });
292
- }
293
- if (privacy.mode === "socks5") {
294
- if (!privacy.socksProxy) {
295
- throw new Error('socksProxy is required when privacy mode is "socks5"');
296
- }
297
- const { SocksProxyAgent } = await import("socks-proxy-agent");
298
- const agent = new SocksProxyAgent(privacy.socksProxy);
299
- return fetch(url, {
300
- ...init,
301
- // @ts-expect-error agent is supported by Node's undici but not in the standard RequestInit type
302
- agent
303
- });
304
- }
305
- return fetch(url, init);
270
+ if (privacy.mode !== "relayer") {
271
+ throw new Error(`Unsupported privacy mode: ${String(privacy.mode)}`);
272
+ }
273
+ if (!privacy.relayerUrl) {
274
+ throw new Error('relayerUrl is required when privacy mode is "relayer"');
275
+ }
276
+ const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
277
+ const headers = {};
278
+ if (init.headers) {
279
+ const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
280
+ for (const [key, value] of entries) headers[key] = value;
281
+ }
282
+ return fetch(`${privacy.relayerUrl}${proxyPath}`, {
283
+ method: "POST",
284
+ headers: { "Content-Type": "application/json" },
285
+ body: JSON.stringify({
286
+ target: url,
287
+ body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
288
+ headers
289
+ })
290
+ });
306
291
  }
307
292
  var DEFAULT_RETRY = {
308
293
  maxRetries: 3,
@@ -467,7 +452,7 @@ var TCloudClient = class _TCloudClient {
467
452
  this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
468
453
  this.headers = {
469
454
  "Content-Type": "application/json",
470
- "X-Tangle-Client": `tcloud-sdk/${SDK_VERSION}`
455
+ "X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
471
456
  };
472
457
  if (this.apiKey) {
473
458
  this.headers["Authorization"] = `Bearer ${this.apiKey}`;
@@ -1,4 +1,4 @@
1
- import { T as TCloudConfig, a as TCloudClient } from './client-CaPP4njg.cjs';
1
+ import { T as TCloudConfig, a as TCloudClient } from './client-CAedbgfN.cjs';
2
2
  import '@tangle-network/sandbox';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { T as TCloudConfig, a as TCloudClient } from './client-CaPP4njg.js';
1
+ import { T as TCloudConfig, a as TCloudClient } from './client-CAedbgfN.js';
2
2
  import '@tangle-network/sandbox';
3
3
 
4
4
  /**
package/dist/instance.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  TCloudClient
3
- } from "./chunk-LUJXMUH5.js";
3
+ } from "./chunk-H3K3A3EI.js";
4
+ import "./chunk-YK2SGW76.js";
4
5
 
5
6
  // src/instance.ts
6
7
  import { spawn } from "child_process";
package/dist/mcp.cjs CHANGED
@@ -35,18 +35,12 @@ __export(mcp_exports, {
35
35
  module.exports = __toCommonJS(mcp_exports);
36
36
  var readline = __toESM(require("readline"), 1);
37
37
 
38
+ // package.json
39
+ var version = "0.5.0";
40
+
38
41
  // src/version.ts
39
- var fs = __toESM(require("fs"), 1);
40
- var import_meta = {};
41
42
  function packageVersion() {
42
- try {
43
- const packageJson = JSON.parse(
44
- fs.readFileSync(new URL("../package.json", import_meta.url), "utf-8")
45
- );
46
- if (typeof packageJson.version === "string") return packageJson.version;
47
- } catch {
48
- }
49
- return "0.0.0";
43
+ return version;
50
44
  }
51
45
 
52
46
  // src/mcp.ts
package/dist/mcp.d.cts CHANGED
@@ -2,7 +2,7 @@ import { Readable, Writable } from 'node:stream';
2
2
  import { TCloud } from './index.cjs';
3
3
  import './shielded.cjs';
4
4
  import 'viem';
5
- import './client-CaPP4njg.cjs';
5
+ import './client-CAedbgfN.cjs';
6
6
  import '@tangle-network/sandbox';
7
7
  import './sandbox.cjs';
8
8
  import '@tangle-network/tcloud-attestation';
package/dist/mcp.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Readable, Writable } from 'node:stream';
2
2
  import { TCloud } from './index.js';
3
3
  import './shielded.js';
4
4
  import 'viem';
5
- import './client-CaPP4njg.js';
5
+ import './client-CAedbgfN.js';
6
6
  import '@tangle-network/sandbox';
7
7
  import './sandbox.js';
8
8
  import '@tangle-network/tcloud-attestation';
package/dist/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  packageVersion
3
- } from "./chunk-GHMW4RWJ.js";
3
+ } from "./chunk-YK2SGW76.js";
4
4
 
5
5
  // src/mcp.ts
6
6
  import * as readline from "readline";
package/dist/shielded.cjs CHANGED
@@ -259,48 +259,43 @@ var PrivateRouter = class {
259
259
  }
260
260
  };
261
261
 
262
+ // package.json
263
+ var version = "0.5.0";
264
+
265
+ // src/version.ts
266
+ function packageVersion() {
267
+ return version;
268
+ }
269
+
262
270
  // src/client.ts
263
271
  var ROTATING_MARKER = "__tcloudRotating";
264
272
  var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
265
273
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
266
- var SDK_VERSION = "0.4.0";
267
274
  async function proxiedFetch(privacy, url, init, streaming) {
268
275
  if (!privacy || privacy.mode === "direct") {
269
276
  return fetch(url, init);
270
277
  }
271
- if (privacy.mode === "relayer") {
272
- if (!privacy.relayerUrl) {
273
- throw new Error('relayerUrl is required when privacy mode is "relayer"');
274
- }
275
- const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
276
- const hdrs = {};
277
- if (init.headers) {
278
- const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
279
- for (const [k, v] of entries) hdrs[k] = v;
280
- }
281
- return fetch(`${privacy.relayerUrl}${proxyPath}`, {
282
- method: "POST",
283
- headers: { "Content-Type": "application/json" },
284
- body: JSON.stringify({
285
- target: url,
286
- body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
287
- headers: hdrs
288
- })
289
- });
278
+ if (privacy.mode !== "relayer") {
279
+ throw new Error(`Unsupported privacy mode: ${String(privacy.mode)}`);
290
280
  }
291
- if (privacy.mode === "socks5") {
292
- if (!privacy.socksProxy) {
293
- throw new Error('socksProxy is required when privacy mode is "socks5"');
294
- }
295
- const { SocksProxyAgent } = await import("socks-proxy-agent");
296
- const agent = new SocksProxyAgent(privacy.socksProxy);
297
- return fetch(url, {
298
- ...init,
299
- // @ts-expect-error agent is supported by Node's undici but not in the standard RequestInit type
300
- agent
301
- });
281
+ if (!privacy.relayerUrl) {
282
+ throw new Error('relayerUrl is required when privacy mode is "relayer"');
302
283
  }
303
- return fetch(url, init);
284
+ const proxyPath = streaming ? "/relay/proxy-stream" : "/relay/proxy";
285
+ const headers = {};
286
+ if (init.headers) {
287
+ const entries = init.headers instanceof Headers ? Array.from(init.headers.entries()) : Object.entries(init.headers);
288
+ for (const [key, value] of entries) headers[key] = value;
289
+ }
290
+ return fetch(`${privacy.relayerUrl}${proxyPath}`, {
291
+ method: "POST",
292
+ headers: { "Content-Type": "application/json" },
293
+ body: JSON.stringify({
294
+ target: url,
295
+ body: typeof init.body === "string" ? JSON.parse(init.body) : init.body,
296
+ headers
297
+ })
298
+ });
304
299
  }
305
300
  var DEFAULT_RETRY = {
306
301
  maxRetries: 3,
@@ -465,7 +460,7 @@ var TCloudClient = class _TCloudClient {
465
460
  this.timeoutMs = config.timeout ?? DEFAULT_TIMEOUT_MS;
466
461
  this.headers = {
467
462
  "Content-Type": "application/json",
468
- "X-Tangle-Client": `tcloud-sdk/${SDK_VERSION}`
463
+ "X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
469
464
  };
470
465
  if (this.apiKey) {
471
466
  this.headers["Authorization"] = `Bearer ${this.apiKey}`;
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { T as TCloudConfig, a as TCloudClient, a3 as SpendAuth } from './client-CaPP4njg.cjs';
2
+ import { T as TCloudConfig, a as TCloudClient, a3 as SpendAuth } from './client-CAedbgfN.cjs';
3
3
  import '@tangle-network/sandbox';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { T as TCloudConfig, a as TCloudClient, a3 as SpendAuth } from './client-CaPP4njg.js';
2
+ import { T as TCloudConfig, a as TCloudClient, a3 as SpendAuth } from './client-CAedbgfN.js';
3
3
  import '@tangle-network/sandbox';
4
4
 
5
5
  /**
package/dist/shielded.js CHANGED
@@ -3,8 +3,9 @@ import {
3
3
  estimateCost,
4
4
  generateWallet,
5
5
  signSpendAuth
6
- } from "./chunk-26M4HGWE.js";
7
- import "./chunk-LUJXMUH5.js";
6
+ } from "./chunk-GDGQQRE3.js";
7
+ import "./chunk-H3K3A3EI.js";
8
+ import "./chunk-YK2SGW76.js";
8
9
  export {
9
10
  createShieldedClient,
10
11
  estimateCost,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/tcloud",
3
- "version": "0.4.14",
3
+ "version": "0.5.0",
4
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",
@@ -69,20 +69,20 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@scure/bip32": "^2.2.0",
73
- "@scure/bip39": "^2.2.0",
74
- "@tangle-network/sandbox": "^0.9.5",
72
+ "@scure/bip32": "^2.4.0",
73
+ "@scure/bip39": "^2.4.0",
74
+ "@tangle-network/sandbox": ">=0.34.3 <0.35.0",
75
75
  "commander": "^14.0.3",
76
- "viem": "^2.48.4",
76
+ "viem": "^2.56.0",
77
77
  "@tangle-network/tcloud-attestation": "^0.1.1"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/node": "^22.0.0",
81
81
  "tsup": "^8.5.1",
82
- "tsx": "^4.0.0",
83
- "typedoc": "^0.28.19",
84
- "typescript": "^5.0.0",
85
- "vitest": "^4.1.5"
82
+ "tsx": "^4.23.12",
83
+ "typedoc": "^0.28.20",
84
+ "typescript": "^5.9.3",
85
+ "vitest": "^4.1.11"
86
86
  },
87
87
  "files": [
88
88
  "dist",
@@ -117,7 +117,7 @@
117
117
  "node": ">=18"
118
118
  },
119
119
  "scripts": {
120
- "build": "tsup src/index.ts src/cli.ts src/mcp.ts src/shielded.ts src/instance.ts src/attestation.ts src/sandbox.ts --format esm,cjs --dts --clean --external socks-proxy-agent",
120
+ "build": "tsup src/index.ts src/cli.ts src/mcp.ts src/shielded.ts src/instance.ts src/attestation.ts src/sandbox.ts --format esm,cjs --dts --clean",
121
121
  "docs": "typedoc src/index.ts --out docs --name tcloud --readme README.md",
122
122
  "test": "vitest run",
123
123
  "test:e2e": "vitest run --config vitest.e2e.config.ts",
@@ -1,16 +0,0 @@
1
- // src/version.ts
2
- import * as fs from "fs";
3
- function packageVersion() {
4
- try {
5
- const packageJson = JSON.parse(
6
- fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8")
7
- );
8
- if (typeof packageJson.version === "string") return packageJson.version;
9
- } catch {
10
- }
11
- return "0.0.0";
12
- }
13
-
14
- export {
15
- packageVersion
16
- };