@tangle-network/tcloud 0.4.5 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  TCloudError: () => TCloudError,
38
38
  TCloudSandbox: () => TCloudSandbox,
39
39
  assertAttestation: () => import_tcloud_attestation2.assertAttestation,
40
+ createNitroHardwareVerifier: () => import_tcloud_attestation2.createNitroHardwareVerifier,
40
41
  createSevSnpHardwareVerifier: () => import_tcloud_attestation2.createSevSnpHardwareVerifier,
41
42
  createShieldedClient: () => createShieldedClient,
42
43
  createTdxHardwareVerifier: () => import_tcloud_attestation2.createTdxHardwareVerifier,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  generateWallet: () => generateWallet,
47
48
  normalizeTeeType: () => import_tcloud_attestation2.normalizeTeeType,
48
49
  parseAttestation: () => import_tcloud_attestation2.parseAttestation,
50
+ parseNitroAttestationDocument: () => import_tcloud_attestation2.parseNitroAttestationDocument,
49
51
  parseSevSnpReport: () => import_tcloud_attestation2.parseSevSnpReport,
50
52
  signSpendAuth: () => signSpendAuth,
51
53
  startTeeAttestationHeartbeat: () => startTeeAttestationHeartbeat,
@@ -277,6 +279,7 @@ var PrivateRouter = class {
277
279
 
278
280
  // src/client.ts
279
281
  var ROTATING_MARKER = "__tcloudRotating";
282
+ var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
280
283
  var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
281
284
  var SDK_VERSION = "0.4.0";
282
285
  async function proxiedFetch(privacy, url, init, streaming) {
@@ -326,6 +329,43 @@ var DEFAULT_RETRY = {
326
329
  };
327
330
  var DEFAULT_TIMEOUT_MS = 6e4;
328
331
  var DEFAULT_PLATFORM_URL = "https://id.tangle.tools";
332
+ var PROTECTED_PROVIDER_OPTION_KEYS = /* @__PURE__ */ new Set([
333
+ "model",
334
+ "messages",
335
+ "temperature",
336
+ "max_tokens",
337
+ "maxTokens",
338
+ "stream",
339
+ "stop",
340
+ "top_p",
341
+ "topP",
342
+ "frequency_penalty",
343
+ "frequencyPenalty",
344
+ "presence_penalty",
345
+ "presencePenalty",
346
+ "response_format",
347
+ "responseFormat",
348
+ "tools",
349
+ "tool_choice",
350
+ "toolChoice",
351
+ "gateway",
352
+ "bridge",
353
+ "agent_profile",
354
+ "agentProfile",
355
+ "session_id",
356
+ "sessionId"
357
+ ]);
358
+ function sanitizeProviderOptions(providerOptions) {
359
+ if (!providerOptions) return {};
360
+ for (const key of Object.keys(providerOptions)) {
361
+ if (PROTECTED_PROVIDER_OPTION_KEYS.has(key)) {
362
+ throw new Error(
363
+ `providerOptions cannot override protected chat field "${key}"; use the typed ChatOptions field instead`
364
+ );
365
+ }
366
+ }
367
+ return providerOptions;
368
+ }
329
369
  var TCloudClient = class _TCloudClient {
330
370
  baseURL;
331
371
  platformURL;
@@ -366,13 +406,21 @@ var TCloudClient = class _TCloudClient {
366
406
  * const reply = await client.ask('explain X', 'claude-code/sonnet')
367
407
  * ```
368
408
  *
369
- * For session-resumable agentic dispatches (file edits, multi-turn
370
- * coding), use the router-mediated `tcloud.bridge({...})` API instead
371
- * (or POST to cli-bridge directly with `session_id` in the body).
409
+ * For session-resumable agentic dispatches, use `client.bridge(...)` on
410
+ * the returned direct client. `resume` is serialized to cli-bridge's
411
+ * `session_id` body field and the model wire format stays
412
+ * `<harness>/<model>` without the router-only `bridge/` prefix.
372
413
  */
373
414
  static fromCliBridge(opts) {
374
415
  const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
375
- return new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
416
+ const client = new _TCloudClient({ ...opts.config ?? {}, apiKey: opts.bearer, baseURL });
417
+ Object.defineProperty(client, DIRECT_CLI_BRIDGE_MARKER, {
418
+ value: true,
419
+ enumerable: false,
420
+ configurable: false,
421
+ writable: false
422
+ });
423
+ return client;
376
424
  }
377
425
  /**
378
426
  * Build a client that rotates which operator serves each call. Mirrors
@@ -384,7 +432,7 @@ var TCloudClient = class _TCloudClient {
384
432
  *
385
433
  * ```ts
386
434
  * const tcloud = TCloudClient.rotating({
387
- * apiKey: process.env.TCLOUD_API_KEY,
435
+ * apiKey: process.env.TANGLE_API_KEY,
388
436
  * routing: { strategy: 'min-exposure' },
389
437
  * })
390
438
  * await tcloud.ask('hello')
@@ -425,7 +473,7 @@ var TCloudClient = class _TCloudClient {
425
473
  constructor(config = {}) {
426
474
  this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
427
475
  this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
428
- this.apiKey = config.apiKey || process.env.TCLOUD_API_KEY;
476
+ this.apiKey = config.apiKey || process.env.TANGLE_API_KEY || process.env.TCLOUD_API_KEY;
429
477
  this.model = config.model || "gpt-4o-mini";
430
478
  this.privacy = config.privacy;
431
479
  this.limits = config.limits;
@@ -634,8 +682,8 @@ var TCloudClient = class _TCloudClient {
634
682
  delete headers["Authorization"];
635
683
  }
636
684
  }
637
- if (bridge) {
638
- headers["X-Bridge-Unlock"] = bridge.unlock;
685
+ if (bridge && !this._isDirectCliBridge()) {
686
+ headers["X-Bridge-Unlock"] = bridge.unlock ?? "";
639
687
  if (bridge.resume) headers["X-Resume"] = bridge.resume;
640
688
  if (bridge.bridgeUrl) headers["X-Bridge-Url"] = bridge.bridgeUrl;
641
689
  if (bridge.bridgeBearer) headers["X-Bridge-Bearer"] = bridge.bridgeBearer;
@@ -648,13 +696,24 @@ var TCloudClient = class _TCloudClient {
648
696
  */
649
697
  _effectiveModel(options) {
650
698
  if (options.bridge) {
699
+ if (this._isDirectCliBridge()) {
700
+ return options.bridge.model ? `${options.bridge.harness}/${options.bridge.model}` : options.bridge.harness;
701
+ }
651
702
  return options.bridge.model ? `bridge/${options.bridge.harness}/${options.bridge.model}` : `bridge/${options.bridge.harness}`;
652
703
  }
653
704
  return options.model || this.model;
654
705
  }
655
706
  /** Build the chat completions request body */
656
707
  _chatBody(options, stream) {
708
+ const providerOptions = sanitizeProviderOptions(options.providerOptions);
709
+ const sandboxBody = {};
710
+ if (options.sandbox?.agentProfile) sandboxBody.agent_profile = options.sandbox.agentProfile;
711
+ if (options.sandbox?.sessionId) sandboxBody.session_id = options.sandbox.sessionId;
712
+ if (this._isDirectCliBridge() && options.bridge?.resume && !sandboxBody.session_id) {
713
+ sandboxBody.session_id = options.bridge.resume;
714
+ }
657
715
  return JSON.stringify({
716
+ ...providerOptions,
658
717
  model: this._effectiveModel(options),
659
718
  messages: options.messages,
660
719
  temperature: options.temperature,
@@ -668,7 +727,7 @@ var TCloudClient = class _TCloudClient {
668
727
  tools: options.tools,
669
728
  tool_choice: options.toolChoice,
670
729
  ...options.gateway ? { gateway: options.gateway } : {},
671
- ...options.providerOptions
730
+ ...sandboxBody
672
731
  });
673
732
  }
674
733
  /** Chat completion (non-streaming) */
@@ -749,7 +808,13 @@ var TCloudClient = class _TCloudClient {
749
808
  "TCloudClient.rotating() cannot dispatch sandbox-harness sessions.\nSandbox sessions bind to a single operator; rotation is meaningful only for\nstateless calls. Use TCloudClient.shielded() + AgentProfile.confidential.tee\nfor privacy-preserving sandbox execution instead."
750
809
  );
751
810
  }
752
- return new BridgeSession(this, cfg);
811
+ if (!this._isDirectCliBridge() && cfg.unlock == null) {
812
+ throw new Error("Bridge unlock is required for router-mediated bridge sessions");
813
+ }
814
+ return new BridgeSession(this, cfg, this._isDirectCliBridge());
815
+ }
816
+ _isDirectCliBridge() {
817
+ return this[DIRECT_CLI_BRIDGE_MARKER] === true;
753
818
  }
754
819
  /**
755
820
  * Rotation stats — populated only on clients created via
@@ -915,6 +980,49 @@ var TCloudClient = class _TCloudClient {
915
980
  })
916
981
  });
917
982
  }
983
+ /**
984
+ * Edit / inpaint / variate an existing image with a text prompt.
985
+ * Sibling to `imageGenerate`; routes to `/v1/images/edits` via
986
+ * multipart/form-data per the OpenAI spec.
987
+ *
988
+ * Reference image attachments may be passed as `Blob`, `ArrayBuffer`,
989
+ * or `{data: base64, mediaType, filename?}`. Multi-image composition
990
+ * (e.g. gpt-image-2 with two reference frames + a prompt that fuses
991
+ * them) is supported by passing an array; for legacy models only the
992
+ * first image is honored upstream.
993
+ */
994
+ async imagesEdit(options) {
995
+ const formData = new FormData();
996
+ formData.append("prompt", options.prompt);
997
+ formData.append("model", options.model || "gpt-image-2");
998
+ if (options.n != null) formData.append("n", String(options.n));
999
+ if (options.size) formData.append("size", options.size);
1000
+ if (options.quality) formData.append("quality", options.quality);
1001
+ if (options.response_format) formData.append("response_format", options.response_format);
1002
+ if (options.mask) formData.append("mask", toEditBlob(options.mask, "mask.png"), "mask.png");
1003
+ const images = Array.isArray(options.image) ? options.image : [options.image];
1004
+ if (images.length === 0) {
1005
+ throw new TCloudError(400, "imagesEdit requires at least one image attachment");
1006
+ }
1007
+ images.forEach((img, idx) => {
1008
+ const blob = toEditBlob(img, `image-${idx + 1}.png`);
1009
+ formData.append("image[]", blob, blobFilename(img, `image-${idx + 1}.png`));
1010
+ });
1011
+ const headers = { ...this.headers };
1012
+ delete headers["Content-Type"];
1013
+ this.checkLimits();
1014
+ const res = await proxiedFetch(this.privacy, `${this.baseURL}/images/edits`, {
1015
+ method: "POST",
1016
+ headers,
1017
+ body: formData
1018
+ }, false);
1019
+ if (!res.ok) {
1020
+ const err = await res.json().catch(() => ({ error: res.statusText }));
1021
+ throw new TCloudError(res.status, err.error?.message || err.error || err.message || res.statusText);
1022
+ }
1023
+ this._requestCount++;
1024
+ return res.json();
1025
+ }
918
1026
  /** Rerank documents by relevance to a query */
919
1027
  async rerank(options) {
920
1028
  return this._request(`${this.baseURL}/rerank`, {
@@ -1006,7 +1114,7 @@ var TCloudClient = class _TCloudClient {
1006
1114
  }
1007
1115
  /** Get video generation status */
1008
1116
  async videoStatus(id) {
1009
- return this._fetch(`${this.baseURL}/video?id=${id}`);
1117
+ return this._fetch(`${this.baseURL}/video/${encodeURIComponent(id)}`);
1010
1118
  }
1011
1119
  /** Generate an avatar video (lip-synced talking head from audio + face image).
1012
1120
  * Returns 202 with a job_id for async polling via avatarJobStatus(). */
@@ -1266,12 +1374,14 @@ var ALL_TIERS = [
1266
1374
  { name: "max-gpu-tee", cpu: 64, ramGb: 256, gpu: 4, tee: true }
1267
1375
  ];
1268
1376
  var BridgeSession = class _BridgeSession {
1269
- constructor(client, cfg) {
1377
+ constructor(client, cfg, direct = false) {
1270
1378
  this.client = client;
1271
1379
  this.cfg = cfg;
1380
+ this.direct = direct;
1272
1381
  }
1273
1382
  client;
1274
1383
  cfg;
1384
+ direct;
1275
1385
  /** Full chat completion (non-streaming). */
1276
1386
  async chat(options) {
1277
1387
  return this.client.chat({ ...options, bridge: this.cfg });
@@ -1305,15 +1415,16 @@ var BridgeSession = class _BridgeSession {
1305
1415
  }
1306
1416
  /** Clone with a new resume id — same harness, different logical conversation. */
1307
1417
  withResume(resume) {
1308
- return new _BridgeSession(this.client, { ...this.cfg, resume });
1418
+ return new _BridgeSession(this.client, { ...this.cfg, resume }, this.direct);
1309
1419
  }
1310
1420
  /** Clone with a different model inside the same harness. */
1311
1421
  withModel(model) {
1312
- return new _BridgeSession(this.client, { ...this.cfg, model });
1422
+ return new _BridgeSession(this.client, { ...this.cfg, model }, this.direct);
1313
1423
  }
1314
1424
  /** The effective model id that will land on the router (`bridge/<harness>/<model>`). */
1315
1425
  get model() {
1316
- return this.cfg.model ? `bridge/${this.cfg.harness}/${this.cfg.model}` : `bridge/${this.cfg.harness}`;
1426
+ const prefix = this.direct ? "" : "bridge/";
1427
+ return this.cfg.model ? `${prefix}${this.cfg.harness}/${this.cfg.model}` : `${prefix}${this.cfg.harness}`;
1317
1428
  }
1318
1429
  /** The resume id currently bound to this session, if any. */
1319
1430
  get resume() {
@@ -1335,6 +1446,32 @@ function selectTiers(all, n) {
1335
1446
  function formatPrice(pricePerToken) {
1336
1447
  return `$${(pricePerToken * 1e3).toFixed(6)}/1K tokens`;
1337
1448
  }
1449
+ function toEditBlob(input, defaultFilename) {
1450
+ if (input instanceof Blob) return input;
1451
+ if (input instanceof ArrayBuffer) return new Blob([input], { type: "image/png" });
1452
+ const binary = base64ToUint8Array(input.data);
1453
+ const copy = new Uint8Array(binary.byteLength);
1454
+ copy.set(binary);
1455
+ return new Blob([copy.buffer], { type: input.mediaType || "image/png" });
1456
+ void defaultFilename;
1457
+ }
1458
+ function blobFilename(input, fallback) {
1459
+ if (typeof input === "object" && !(input instanceof Blob) && !(input instanceof ArrayBuffer)) {
1460
+ if (input.filename) return input.filename;
1461
+ }
1462
+ return fallback;
1463
+ }
1464
+ function base64ToUint8Array(b64) {
1465
+ const m = /^data:[^;,]*(?:;[^,]*)?,(.+)$/.exec(b64);
1466
+ const raw = m ? m[1] : b64;
1467
+ const bin = typeof atob === "function" ? atob(raw) : (
1468
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1469
+ globalThis.Buffer.from(raw, "base64").toString("binary")
1470
+ );
1471
+ const out = new Uint8Array(bin.length);
1472
+ for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
1473
+ return out;
1474
+ }
1338
1475
  var TCloudError = class extends Error {
1339
1476
  constructor(status, message) {
1340
1477
  super(message);
@@ -1846,7 +1983,14 @@ function buildSandboxCreateOptions(options) {
1846
1983
  memoryMB: options.memoryMb,
1847
1984
  diskGB: options.diskGb
1848
1985
  } : void 0,
1849
- backend: options.backend ? { type: options.backend } : void 0,
1986
+ // backend: merge `backend` (type string) with `agentProfile` (carried
1987
+ // as `backend.profile` on the underlying SDK). Either may be set
1988
+ // independently; setting both produces `{ type, profile }`. Setting
1989
+ // neither leaves `backend` undefined so the SDK applies its default.
1990
+ backend: options.backend || options.agentProfile ? {
1991
+ ...options.backend ? { type: options.backend } : {},
1992
+ ...options.agentProfile ? { profile: options.agentProfile } : {}
1993
+ } : void 0,
1850
1994
  confidential: options.tee ? {
1851
1995
  tee: options.tee,
1852
1996
  sealed: options.sealed || void 0,
@@ -1946,7 +2090,7 @@ var TCloud = class _TCloud extends TCloudClient {
1946
2090
  *
1947
2091
  * ```ts
1948
2092
  * const client = TCloud.rotating({
1949
- * apiKey: process.env.TCLOUD_API_KEY,
2093
+ * apiKey: process.env.TANGLE_API_KEY,
1950
2094
  * routing: { strategy: 'min-exposure' },
1951
2095
  * })
1952
2096
  * const stats = client.getRotationStats()
@@ -1964,6 +2108,23 @@ var TCloud = class _TCloud extends TCloudClient {
1964
2108
  * ```
1965
2109
  */
1966
2110
  static generateWallet = generateWallet;
2111
+ /**
2112
+ * Create a Sandbox SDK client using this TCloud client's API key by default.
2113
+ *
2114
+ * ```ts
2115
+ * const tcloud = new TCloud({ apiKey })
2116
+ * const sandbox = await tcloud.sandbox().create({ name: 'runner' })
2117
+ * ```
2118
+ */
2119
+ sandbox(config = {}) {
2120
+ const apiKey = config.apiKey ?? this.apiKey;
2121
+ if (!apiKey) throw new Error("TCloud.sandbox() requires an apiKey");
2122
+ return new TCloudSandbox({ ...config, apiKey });
2123
+ }
2124
+ /** Create a standalone Sandbox SDK client. */
2125
+ static sandbox(config) {
2126
+ return new TCloudSandbox(config);
2127
+ }
1967
2128
  };
1968
2129
  // Annotate the CommonJS export names for ESM import in node:
1969
2130
  0 && (module.exports = {
@@ -1974,6 +2135,7 @@ var TCloud = class _TCloud extends TCloudClient {
1974
2135
  TCloudError,
1975
2136
  TCloudSandbox,
1976
2137
  assertAttestation,
2138
+ createNitroHardwareVerifier,
1977
2139
  createSevSnpHardwareVerifier,
1978
2140
  createShieldedClient,
1979
2141
  createTdxHardwareVerifier,
@@ -1983,6 +2145,7 @@ var TCloud = class _TCloud extends TCloudClient {
1983
2145
  generateWallet,
1984
2146
  normalizeTeeType,
1985
2147
  parseAttestation,
2148
+ parseNitroAttestationDocument,
1986
2149
  parseSevSnpReport,
1987
2150
  signSpendAuth,
1988
2151
  startTeeAttestationHeartbeat,
package/dist/index.d.cts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.cjs';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.cjs';
3
- import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-DkQugNHH.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 CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, x as RerankOptions, y as RerankResponse, z as RetryConfig, D as RotatingRoutingConfig, H as RotationStats, K as RoutingConfig, L as RoutingStrategy, S as ShieldedConfig, N as SpendAuth, Q as SpendingLimits, U as TCloudError, V as TierConfig, W as TranscriptionResponse, X as UpdateKeyOptions, Y as VideoGenerateOptions, Z as VideoResponse, _ as WatchJobOptions } from './client-DkQugNHH.cjs';
5
- export { TCloudSandbox, TCloudSandboxAttestationStatus, TCloudSandboxConfig, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.cjs';
6
- export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
7
- export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
3
+ import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-CF-tpVsi.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 CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, s as ImageEditOptions, t as ImageGenerateOptions, u as ImageResponse, J as JobEvent, M as Model, O as Operator, v as OperatorInfo, P as PricingTier, w as PrivacyConfig, x as PrivateRouter, y as PrivateRouterConfig, z as RerankOptions, D as RerankResponse, H as RetryConfig, K as RotatingRoutingConfig, L as RotationStats, N as RoutingConfig, Q as RoutingStrategy, S as SandboxChatOptions, U as ShieldedConfig, V as SpendAuth, W as SpendingLimits, X as TCloudError, Y as TierConfig, Z as TranscriptionResponse, _ as UpdateKeyOptions, $ as VideoGenerateOptions, a0 as VideoResponse, a1 as WatchJobOptions } from './client-CF-tpVsi.cjs';
5
+ import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.cjs';
6
+ export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.cjs';
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';
8
+ export { AgentProfile, AgentProfileCapabilities, AgentProfileFileMount, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResourceRef, AgentProfileResources, AgentProfileValidationIssue, AgentProfileValidationResult, AgentSubagentProfile } from '@tangle-network/sandbox';
8
9
  import 'viem';
9
10
 
10
11
  declare class TCloud extends TCloudClient {
@@ -44,7 +45,7 @@ declare class TCloud extends TCloudClient {
44
45
  *
45
46
  * ```ts
46
47
  * const client = TCloud.rotating({
47
- * apiKey: process.env.TCLOUD_API_KEY,
48
+ * apiKey: process.env.TANGLE_API_KEY,
48
49
  * routing: { strategy: 'min-exposure' },
49
50
  * })
50
51
  * const stats = client.getRotationStats()
@@ -60,6 +61,17 @@ declare class TCloud extends TCloudClient {
60
61
  * ```
61
62
  */
62
63
  static generateWallet: typeof generateWallet;
64
+ /**
65
+ * Create a Sandbox SDK client using this TCloud client's API key by default.
66
+ *
67
+ * ```ts
68
+ * const tcloud = new TCloud({ apiKey })
69
+ * const sandbox = await tcloud.sandbox().create({ name: 'runner' })
70
+ * ```
71
+ */
72
+ sandbox(config?: Partial<TCloudSandboxConfig>): TCloudSandbox;
73
+ /** Create a standalone Sandbox SDK client. */
74
+ static sandbox(config: TCloudSandboxConfig): TCloudSandbox;
63
75
  }
64
76
 
65
- export { RotatingClientConfig, ShieldedWallet, TCloud, TCloudClient, TCloudConfig, generateWallet };
77
+ export { RotatingClientConfig, ShieldedWallet, TCloud, TCloudClient, TCloudConfig, TCloudSandbox, TCloudSandboxConfig, generateWallet };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ShieldedWallet, generateWallet } from './shielded.js';
2
2
  export { createShieldedClient, estimateCost, signSpendAuth } from './shielded.js';
3
- import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-DkQugNHH.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 CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageGenerateOptions, s as ImageResponse, J as JobEvent, M as Model, O as Operator, t as OperatorInfo, P as PricingTier, u as PrivacyConfig, v as PrivateRouter, w as PrivateRouterConfig, x as RerankOptions, y as RerankResponse, z as RetryConfig, D as RotatingRoutingConfig, H as RotationStats, K as RoutingConfig, L as RoutingStrategy, S as ShieldedConfig, N as SpendAuth, Q as SpendingLimits, U as TCloudError, V as TierConfig, W as TranscriptionResponse, X as UpdateKeyOptions, Y as VideoGenerateOptions, Z as VideoResponse, _ as WatchJobOptions } from './client-DkQugNHH.js';
5
- export { TCloudSandbox, TCloudSandboxAttestationStatus, TCloudSandboxConfig, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.js';
6
- export { AsyncAttestationPolicy, AsyncHardwareVerifier, AttestationPolicy, AttestationVerificationResult, HardwareVerifier, HardwareVerifierResult, ParsedAttestation, SevSnpReport, SevSnpVerifierOptions, TeeType, assertAttestation, createSevSnpHardwareVerifier, createTdxHardwareVerifier, normalizeTeeType, parseAttestation, parseSevSnpReport, toHex, verifyAttestation, verifyAttestationAsync } from '@tangle-network/tcloud-attestation';
7
- export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
3
+ import { T as TCloudClient, a as TCloudConfig, R as RotatingClientConfig } from './client-CF-tpVsi.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 CompletionOptions, m as CompletionResponse, n as CreateKeyOptions, o as CreatedKey, p as CreditBalance, E as EmbeddingOptions, q as EmbeddingResponse, F as FineTuningJob, r as FineTuningJobOptions, G as GatewayOptions, I as ImageEditAttachment, s as ImageEditOptions, t as ImageGenerateOptions, u as ImageResponse, J as JobEvent, M as Model, O as Operator, v as OperatorInfo, P as PricingTier, w as PrivacyConfig, x as PrivateRouter, y as PrivateRouterConfig, z as RerankOptions, D as RerankResponse, H as RetryConfig, K as RotatingRoutingConfig, L as RotationStats, N as RoutingConfig, Q as RoutingStrategy, S as SandboxChatOptions, U as ShieldedConfig, V as SpendAuth, W as SpendingLimits, X as TCloudError, Y as TierConfig, Z as TranscriptionResponse, _ as UpdateKeyOptions, $ as VideoGenerateOptions, a0 as VideoResponse, a1 as WatchJobOptions } from './client-CF-tpVsi.js';
5
+ import { TCloudSandboxConfig, TCloudSandbox } from './sandbox.js';
6
+ export { TCloudSandboxAttestationStatus, TCloudSandboxCreateOptions, TCloudSandboxCreateResult, TCloudSandboxTee, TCloudTeeAttestationChallenge, TCloudTeeAttestationHeartbeat, TCloudTeeAttestationHeartbeatOptions, TCloudTeeAttestationHeartbeatSample, createTeeAttestationChallenge, generateAttestationNonce, startTeeAttestationHeartbeat } from './sandbox.js';
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';
8
+ export { AgentProfile, AgentProfileCapabilities, AgentProfileFileMount, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResourceRef, AgentProfileResources, AgentProfileValidationIssue, AgentProfileValidationResult, AgentSubagentProfile } from '@tangle-network/sandbox';
8
9
  import 'viem';
9
10
 
10
11
  declare class TCloud extends TCloudClient {
@@ -44,7 +45,7 @@ declare class TCloud extends TCloudClient {
44
45
  *
45
46
  * ```ts
46
47
  * const client = TCloud.rotating({
47
- * apiKey: process.env.TCLOUD_API_KEY,
48
+ * apiKey: process.env.TANGLE_API_KEY,
48
49
  * routing: { strategy: 'min-exposure' },
49
50
  * })
50
51
  * const stats = client.getRotationStats()
@@ -60,6 +61,17 @@ declare class TCloud extends TCloudClient {
60
61
  * ```
61
62
  */
62
63
  static generateWallet: typeof generateWallet;
64
+ /**
65
+ * Create a Sandbox SDK client using this TCloud client's API key by default.
66
+ *
67
+ * ```ts
68
+ * const tcloud = new TCloud({ apiKey })
69
+ * const sandbox = await tcloud.sandbox().create({ name: 'runner' })
70
+ * ```
71
+ */
72
+ sandbox(config?: Partial<TCloudSandboxConfig>): TCloudSandbox;
73
+ /** Create a standalone Sandbox SDK client. */
74
+ static sandbox(config: TCloudSandboxConfig): TCloudSandbox;
63
75
  }
64
76
 
65
- export { RotatingClientConfig, ShieldedWallet, TCloud, TCloudClient, TCloudConfig, generateWallet };
77
+ export { RotatingClientConfig, ShieldedWallet, TCloud, TCloudClient, TCloudConfig, TCloudSandbox, TCloudSandboxConfig, generateWallet };
package/dist/index.js CHANGED
@@ -1,33 +1,35 @@
1
1
  import {
2
2
  TCloud,
3
3
  assertAttestation,
4
+ createNitroHardwareVerifier,
4
5
  createSevSnpHardwareVerifier,
5
6
  createTdxHardwareVerifier,
6
7
  normalizeTeeType,
7
8
  parseAttestation,
9
+ parseNitroAttestationDocument,
8
10
  parseSevSnpReport,
9
11
  toHex,
10
12
  verifyAttestation,
11
13
  verifyAttestationAsync
12
- } from "./chunk-MB4VK4MM.js";
14
+ } from "./chunk-27OTTDMZ.js";
13
15
  import {
14
16
  TCloudSandbox,
15
17
  createTeeAttestationChallenge,
16
18
  generateAttestationNonce,
17
19
  startTeeAttestationHeartbeat
18
- } from "./chunk-DBIT227N.js";
20
+ } from "./chunk-DRCOPW7D.js";
19
21
  import {
20
22
  createShieldedClient,
21
23
  estimateCost,
22
24
  generateWallet,
23
25
  signSpendAuth
24
- } from "./chunk-4ZUVGKVH.js";
26
+ } from "./chunk-YWN4JOCW.js";
25
27
  import {
26
28
  BridgeSession,
27
29
  PrivateRouter,
28
30
  TCloudClient,
29
31
  TCloudError
30
- } from "./chunk-M5K3EFNP.js";
32
+ } from "./chunk-CVWEKCQ3.js";
31
33
  export {
32
34
  BridgeSession,
33
35
  PrivateRouter,
@@ -36,6 +38,7 @@ export {
36
38
  TCloudError,
37
39
  TCloudSandbox,
38
40
  assertAttestation,
41
+ createNitroHardwareVerifier,
39
42
  createSevSnpHardwareVerifier,
40
43
  createShieldedClient,
41
44
  createTdxHardwareVerifier,
@@ -45,6 +48,7 @@ export {
45
48
  generateWallet,
46
49
  normalizeTeeType,
47
50
  parseAttestation,
51
+ parseNitroAttestationDocument,
48
52
  parseSevSnpReport,
49
53
  signSpendAuth,
50
54
  startTeeAttestationHeartbeat,