@tangle-network/tcloud 0.4.6 → 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/README.md +6 -5
- package/dist/{chunk-F6OVKJG3.js → chunk-27OTTDMZ.js} +23 -3
- package/dist/{chunk-M5K3EFNP.js → chunk-CVWEKCQ3.js} +150 -15
- package/dist/{chunk-DBIT227N.js → chunk-DRCOPW7D.js} +8 -1
- package/dist/{chunk-4ZUVGKVH.js → chunk-YWN4JOCW.js} +1 -1
- package/dist/cli.cjs +298 -19
- package/dist/cli.js +126 -6
- package/dist/{client-DkQugNHH.d.cts → client-CF-tpVsi.d.cts} +80 -9
- package/dist/{client-DkQugNHH.d.ts → client-CF-tpVsi.d.ts} +80 -9
- package/dist/index.cjs +176 -17
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +4 -4
- package/dist/instance.cjs +150 -15
- package/dist/instance.d.cts +2 -1
- package/dist/instance.d.ts +2 -1
- package/dist/instance.js +1 -1
- package/dist/sandbox.cjs +8 -1
- package/dist/sandbox.d.cts +20 -0
- package/dist/sandbox.d.ts +20 -0
- package/dist/sandbox.js +1 -1
- package/dist/shielded.cjs +150 -15
- package/dist/shielded.d.cts +2 -1
- package/dist/shielded.d.ts +2 -1
- package/dist/shielded.js +2 -2
- package/package.json +17 -11
package/dist/index.cjs
CHANGED
|
@@ -279,6 +279,7 @@ var PrivateRouter = class {
|
|
|
279
279
|
|
|
280
280
|
// src/client.ts
|
|
281
281
|
var ROTATING_MARKER = "__tcloudRotating";
|
|
282
|
+
var DIRECT_CLI_BRIDGE_MARKER = "__tcloudDirectCliBridge";
|
|
282
283
|
var DEFAULT_BASE_URL = "https://router.tangle.tools/v1";
|
|
283
284
|
var SDK_VERSION = "0.4.0";
|
|
284
285
|
async function proxiedFetch(privacy, url, init, streaming) {
|
|
@@ -328,6 +329,43 @@ var DEFAULT_RETRY = {
|
|
|
328
329
|
};
|
|
329
330
|
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
330
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
|
+
}
|
|
331
369
|
var TCloudClient = class _TCloudClient {
|
|
332
370
|
baseURL;
|
|
333
371
|
platformURL;
|
|
@@ -368,13 +406,21 @@ var TCloudClient = class _TCloudClient {
|
|
|
368
406
|
* const reply = await client.ask('explain X', 'claude-code/sonnet')
|
|
369
407
|
* ```
|
|
370
408
|
*
|
|
371
|
-
* For session-resumable agentic dispatches (
|
|
372
|
-
*
|
|
373
|
-
*
|
|
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.
|
|
374
413
|
*/
|
|
375
414
|
static fromCliBridge(opts) {
|
|
376
415
|
const baseURL = opts.url.replace(/\/+$/, "") + "/v1";
|
|
377
|
-
|
|
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;
|
|
378
424
|
}
|
|
379
425
|
/**
|
|
380
426
|
* Build a client that rotates which operator serves each call. Mirrors
|
|
@@ -386,7 +432,7 @@ var TCloudClient = class _TCloudClient {
|
|
|
386
432
|
*
|
|
387
433
|
* ```ts
|
|
388
434
|
* const tcloud = TCloudClient.rotating({
|
|
389
|
-
* apiKey: process.env.
|
|
435
|
+
* apiKey: process.env.TANGLE_API_KEY,
|
|
390
436
|
* routing: { strategy: 'min-exposure' },
|
|
391
437
|
* })
|
|
392
438
|
* await tcloud.ask('hello')
|
|
@@ -427,7 +473,7 @@ var TCloudClient = class _TCloudClient {
|
|
|
427
473
|
constructor(config = {}) {
|
|
428
474
|
this.baseURL = (config.baseURL || DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
429
475
|
this.platformURL = (config.platformURL || DEFAULT_PLATFORM_URL).replace(/\/$/, "");
|
|
430
|
-
this.apiKey = config.apiKey || process.env.TCLOUD_API_KEY;
|
|
476
|
+
this.apiKey = config.apiKey || process.env.TANGLE_API_KEY || process.env.TCLOUD_API_KEY;
|
|
431
477
|
this.model = config.model || "gpt-4o-mini";
|
|
432
478
|
this.privacy = config.privacy;
|
|
433
479
|
this.limits = config.limits;
|
|
@@ -636,8 +682,8 @@ var TCloudClient = class _TCloudClient {
|
|
|
636
682
|
delete headers["Authorization"];
|
|
637
683
|
}
|
|
638
684
|
}
|
|
639
|
-
if (bridge) {
|
|
640
|
-
headers["X-Bridge-Unlock"] = bridge.unlock;
|
|
685
|
+
if (bridge && !this._isDirectCliBridge()) {
|
|
686
|
+
headers["X-Bridge-Unlock"] = bridge.unlock ?? "";
|
|
641
687
|
if (bridge.resume) headers["X-Resume"] = bridge.resume;
|
|
642
688
|
if (bridge.bridgeUrl) headers["X-Bridge-Url"] = bridge.bridgeUrl;
|
|
643
689
|
if (bridge.bridgeBearer) headers["X-Bridge-Bearer"] = bridge.bridgeBearer;
|
|
@@ -650,13 +696,24 @@ var TCloudClient = class _TCloudClient {
|
|
|
650
696
|
*/
|
|
651
697
|
_effectiveModel(options) {
|
|
652
698
|
if (options.bridge) {
|
|
699
|
+
if (this._isDirectCliBridge()) {
|
|
700
|
+
return options.bridge.model ? `${options.bridge.harness}/${options.bridge.model}` : options.bridge.harness;
|
|
701
|
+
}
|
|
653
702
|
return options.bridge.model ? `bridge/${options.bridge.harness}/${options.bridge.model}` : `bridge/${options.bridge.harness}`;
|
|
654
703
|
}
|
|
655
704
|
return options.model || this.model;
|
|
656
705
|
}
|
|
657
706
|
/** Build the chat completions request body */
|
|
658
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
|
+
}
|
|
659
715
|
return JSON.stringify({
|
|
716
|
+
...providerOptions,
|
|
660
717
|
model: this._effectiveModel(options),
|
|
661
718
|
messages: options.messages,
|
|
662
719
|
temperature: options.temperature,
|
|
@@ -670,7 +727,7 @@ var TCloudClient = class _TCloudClient {
|
|
|
670
727
|
tools: options.tools,
|
|
671
728
|
tool_choice: options.toolChoice,
|
|
672
729
|
...options.gateway ? { gateway: options.gateway } : {},
|
|
673
|
-
...
|
|
730
|
+
...sandboxBody
|
|
674
731
|
});
|
|
675
732
|
}
|
|
676
733
|
/** Chat completion (non-streaming) */
|
|
@@ -751,7 +808,13 @@ var TCloudClient = class _TCloudClient {
|
|
|
751
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."
|
|
752
809
|
);
|
|
753
810
|
}
|
|
754
|
-
|
|
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;
|
|
755
818
|
}
|
|
756
819
|
/**
|
|
757
820
|
* Rotation stats — populated only on clients created via
|
|
@@ -917,6 +980,49 @@ var TCloudClient = class _TCloudClient {
|
|
|
917
980
|
})
|
|
918
981
|
});
|
|
919
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
|
+
}
|
|
920
1026
|
/** Rerank documents by relevance to a query */
|
|
921
1027
|
async rerank(options) {
|
|
922
1028
|
return this._request(`${this.baseURL}/rerank`, {
|
|
@@ -1008,7 +1114,7 @@ var TCloudClient = class _TCloudClient {
|
|
|
1008
1114
|
}
|
|
1009
1115
|
/** Get video generation status */
|
|
1010
1116
|
async videoStatus(id) {
|
|
1011
|
-
return this._fetch(`${this.baseURL}/video
|
|
1117
|
+
return this._fetch(`${this.baseURL}/video/${encodeURIComponent(id)}`);
|
|
1012
1118
|
}
|
|
1013
1119
|
/** Generate an avatar video (lip-synced talking head from audio + face image).
|
|
1014
1120
|
* Returns 202 with a job_id for async polling via avatarJobStatus(). */
|
|
@@ -1268,12 +1374,14 @@ var ALL_TIERS = [
|
|
|
1268
1374
|
{ name: "max-gpu-tee", cpu: 64, ramGb: 256, gpu: 4, tee: true }
|
|
1269
1375
|
];
|
|
1270
1376
|
var BridgeSession = class _BridgeSession {
|
|
1271
|
-
constructor(client, cfg) {
|
|
1377
|
+
constructor(client, cfg, direct = false) {
|
|
1272
1378
|
this.client = client;
|
|
1273
1379
|
this.cfg = cfg;
|
|
1380
|
+
this.direct = direct;
|
|
1274
1381
|
}
|
|
1275
1382
|
client;
|
|
1276
1383
|
cfg;
|
|
1384
|
+
direct;
|
|
1277
1385
|
/** Full chat completion (non-streaming). */
|
|
1278
1386
|
async chat(options) {
|
|
1279
1387
|
return this.client.chat({ ...options, bridge: this.cfg });
|
|
@@ -1307,15 +1415,16 @@ var BridgeSession = class _BridgeSession {
|
|
|
1307
1415
|
}
|
|
1308
1416
|
/** Clone with a new resume id — same harness, different logical conversation. */
|
|
1309
1417
|
withResume(resume) {
|
|
1310
|
-
return new _BridgeSession(this.client, { ...this.cfg, resume });
|
|
1418
|
+
return new _BridgeSession(this.client, { ...this.cfg, resume }, this.direct);
|
|
1311
1419
|
}
|
|
1312
1420
|
/** Clone with a different model inside the same harness. */
|
|
1313
1421
|
withModel(model) {
|
|
1314
|
-
return new _BridgeSession(this.client, { ...this.cfg, model });
|
|
1422
|
+
return new _BridgeSession(this.client, { ...this.cfg, model }, this.direct);
|
|
1315
1423
|
}
|
|
1316
1424
|
/** The effective model id that will land on the router (`bridge/<harness>/<model>`). */
|
|
1317
1425
|
get model() {
|
|
1318
|
-
|
|
1426
|
+
const prefix = this.direct ? "" : "bridge/";
|
|
1427
|
+
return this.cfg.model ? `${prefix}${this.cfg.harness}/${this.cfg.model}` : `${prefix}${this.cfg.harness}`;
|
|
1319
1428
|
}
|
|
1320
1429
|
/** The resume id currently bound to this session, if any. */
|
|
1321
1430
|
get resume() {
|
|
@@ -1337,6 +1446,32 @@ function selectTiers(all, n) {
|
|
|
1337
1446
|
function formatPrice(pricePerToken) {
|
|
1338
1447
|
return `$${(pricePerToken * 1e3).toFixed(6)}/1K tokens`;
|
|
1339
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
|
+
}
|
|
1340
1475
|
var TCloudError = class extends Error {
|
|
1341
1476
|
constructor(status, message) {
|
|
1342
1477
|
super(message);
|
|
@@ -1848,7 +1983,14 @@ function buildSandboxCreateOptions(options) {
|
|
|
1848
1983
|
memoryMB: options.memoryMb,
|
|
1849
1984
|
diskGB: options.diskGb
|
|
1850
1985
|
} : void 0,
|
|
1851
|
-
backend:
|
|
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,
|
|
1852
1994
|
confidential: options.tee ? {
|
|
1853
1995
|
tee: options.tee,
|
|
1854
1996
|
sealed: options.sealed || void 0,
|
|
@@ -1948,7 +2090,7 @@ var TCloud = class _TCloud extends TCloudClient {
|
|
|
1948
2090
|
*
|
|
1949
2091
|
* ```ts
|
|
1950
2092
|
* const client = TCloud.rotating({
|
|
1951
|
-
* apiKey: process.env.
|
|
2093
|
+
* apiKey: process.env.TANGLE_API_KEY,
|
|
1952
2094
|
* routing: { strategy: 'min-exposure' },
|
|
1953
2095
|
* })
|
|
1954
2096
|
* const stats = client.getRotationStats()
|
|
@@ -1966,6 +2108,23 @@ var TCloud = class _TCloud extends TCloudClient {
|
|
|
1966
2108
|
* ```
|
|
1967
2109
|
*/
|
|
1968
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
|
+
}
|
|
1969
2128
|
};
|
|
1970
2129
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1971
2130
|
0 && (module.exports = {
|
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-
|
|
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
|
|
5
|
-
|
|
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';
|
|
6
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';
|
|
7
|
-
export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
|
|
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.
|
|
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-
|
|
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
|
|
5
|
-
|
|
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';
|
|
6
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';
|
|
7
|
-
export { AgentProfile, AgentProfileCapabilities, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResources } from '@tangle-network/sandbox';
|
|
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.
|
|
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
|
@@ -11,25 +11,25 @@ import {
|
|
|
11
11
|
toHex,
|
|
12
12
|
verifyAttestation,
|
|
13
13
|
verifyAttestationAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-27OTTDMZ.js";
|
|
15
15
|
import {
|
|
16
16
|
TCloudSandbox,
|
|
17
17
|
createTeeAttestationChallenge,
|
|
18
18
|
generateAttestationNonce,
|
|
19
19
|
startTeeAttestationHeartbeat
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DRCOPW7D.js";
|
|
21
21
|
import {
|
|
22
22
|
createShieldedClient,
|
|
23
23
|
estimateCost,
|
|
24
24
|
generateWallet,
|
|
25
25
|
signSpendAuth
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YWN4JOCW.js";
|
|
27
27
|
import {
|
|
28
28
|
BridgeSession,
|
|
29
29
|
PrivateRouter,
|
|
30
30
|
TCloudClient,
|
|
31
31
|
TCloudError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-CVWEKCQ3.js";
|
|
33
33
|
export {
|
|
34
34
|
BridgeSession,
|
|
35
35
|
PrivateRouter,
|