@tangle-network/tcloud 0.4.13 → 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.
- package/dist/{chunk-THOMQXU5.js → chunk-GDGQQRE3.js} +1 -1
- package/dist/{chunk-U4VOGRVW.js → chunk-H3K3A3EI.js} +46 -35
- package/dist/{chunk-UBUCUSCF.js → chunk-O33Y34UQ.js} +2 -2
- package/dist/chunk-YK2SGW76.js +11 -0
- package/dist/cli.cjs +287 -46
- package/dist/cli.js +11 -13
- package/dist/{client-CaD5Oal0.d.ts → client-CAedbgfN.d.cts} +56 -8
- package/dist/{client-CaD5Oal0.d.cts → client-CAedbgfN.d.ts} +56 -8
- package/dist/index.cjs +48 -33
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/instance.cjs +50 -45
- package/dist/instance.d.cts +1 -1
- package/dist/instance.d.ts +1 -1
- package/dist/instance.js +2 -1
- package/dist/mcp.cjs +248 -0
- package/dist/mcp.d.cts +27 -0
- package/dist/mcp.d.ts +27 -0
- package/dist/mcp.js +207 -0
- package/dist/shielded.cjs +48 -33
- package/dist/shielded.d.cts +1 -1
- package/dist/shielded.d.ts +1 -1
- package/dist/shielded.js +3 -2
- package/package.json +10 -10
|
@@ -186,6 +186,54 @@ interface SearchResponse {
|
|
|
186
186
|
billing_units?: Record<string, unknown>;
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
+
/** Providers served by the router's research API (POST /v1/research). Mirrors
|
|
190
|
+
* SearchProvider minus `brave` (no research API). Each has its own `effort`
|
|
191
|
+
* vocabulary — see ResearchOptions.effort. */
|
|
192
|
+
type ResearchProvider = 'perplexity' | 'exa' | 'you' | 'parallel' | 'tavily';
|
|
193
|
+
interface ResearchOptions {
|
|
194
|
+
query: string;
|
|
195
|
+
provider?: ResearchProvider;
|
|
196
|
+
/** Alias accepted by the Router for provider-compatible clients. */
|
|
197
|
+
model?: ResearchProvider;
|
|
198
|
+
/** Depth/cost dial, provider-specific:
|
|
199
|
+
* perplexity minimal|low|medium|high · you lite|standard|deep|exhaustive ·
|
|
200
|
+
* exa deep-lite|deep|deep-reasoning · tavily mini|pro|auto ·
|
|
201
|
+
* parallel lite|base|core|pro|ultra. Omit for the provider default. */
|
|
202
|
+
effort?: string;
|
|
203
|
+
maxResults?: number;
|
|
204
|
+
searchRecency?: SearchRecency;
|
|
205
|
+
includeDomains?: string[];
|
|
206
|
+
excludeDomains?: string[];
|
|
207
|
+
/** Optional JSON schema requesting structured output from the provider. */
|
|
208
|
+
outputSchema?: unknown;
|
|
209
|
+
}
|
|
210
|
+
interface ResearchHit {
|
|
211
|
+
title: string;
|
|
212
|
+
url: string;
|
|
213
|
+
snippet?: string;
|
|
214
|
+
publishedAt?: string;
|
|
215
|
+
source?: string;
|
|
216
|
+
}
|
|
217
|
+
interface ResearchResponse {
|
|
218
|
+
id: string;
|
|
219
|
+
object: 'research.result' | string;
|
|
220
|
+
provider: ResearchProvider;
|
|
221
|
+
query: string;
|
|
222
|
+
/** The synthesized multi-step research answer. */
|
|
223
|
+
answer: string;
|
|
224
|
+
/** Supporting sources behind the answer. */
|
|
225
|
+
results: ResearchHit[];
|
|
226
|
+
citations: string[];
|
|
227
|
+
/** Present when an outputSchema was requested and the provider honored it. */
|
|
228
|
+
structured?: unknown;
|
|
229
|
+
usage?: {
|
|
230
|
+
upstream_cost?: number;
|
|
231
|
+
billed_cost?: number;
|
|
232
|
+
gross_margin?: number;
|
|
233
|
+
markup?: number;
|
|
234
|
+
billing_units?: Record<string, unknown>;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
189
237
|
interface WebSearchPlugin {
|
|
190
238
|
id: 'web';
|
|
191
239
|
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
@@ -332,15 +380,10 @@ interface AvatarJobStatus {
|
|
|
332
380
|
error?: string;
|
|
333
381
|
}
|
|
334
382
|
interface PrivacyConfig {
|
|
335
|
-
/** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer.
|
|
336
|
-
mode: 'direct' | 'relayer'
|
|
383
|
+
/** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. */
|
|
384
|
+
mode: 'direct' | 'relayer';
|
|
337
385
|
/** Relayer URL for 'relayer' mode (e.g. 'http://localhost:3030') */
|
|
338
386
|
relayerUrl?: string;
|
|
339
|
-
/**
|
|
340
|
-
* SOCKS5 proxy URL for 'socks5' mode (e.g. 'socks5://127.0.0.1:9050' for Tor).
|
|
341
|
-
* Requires `socks-proxy-agent` as an optional peer dependency.
|
|
342
|
-
*/
|
|
343
|
-
socksProxy?: string;
|
|
344
387
|
}
|
|
345
388
|
interface ShieldedConfig {
|
|
346
389
|
/** Pre-existing spending private key (hex). If not set, generates ephemeral. */
|
|
@@ -1039,6 +1082,11 @@ declare class TCloudClient {
|
|
|
1039
1082
|
rerank(options: RerankOptions): Promise<RerankResponse>;
|
|
1040
1083
|
/** Search the web through Tangle Router billing and provider routing. */
|
|
1041
1084
|
search(options: SearchOptions): Promise<SearchResponse>;
|
|
1085
|
+
/** Run a multi-step deep-research task through Tangle Router billing and
|
|
1086
|
+
* provider routing (POST /v1/research). Slower and costlier than `search` —
|
|
1087
|
+
* the provider synthesizes an answer over many fetches. Pick depth with
|
|
1088
|
+
* `effort` (provider-specific vocabulary; see {@link ResearchOptions.effort}). */
|
|
1089
|
+
research(options: ResearchOptions): Promise<ResearchResponse>;
|
|
1042
1090
|
/** Text-to-speech */
|
|
1043
1091
|
speech(options: {
|
|
1044
1092
|
model?: string;
|
|
@@ -1356,4 +1404,4 @@ declare class TCloudError extends Error {
|
|
|
1356
1404
|
constructor(status: number, message: string);
|
|
1357
1405
|
}
|
|
1358
1406
|
|
|
1359
|
-
export { type
|
|
1407
|
+
export { type SearchProvider as $, type ApiKeyInfo as A, type BatchJobResponse as B, type ChatCompletion as C, type RerankOptions as D, type EmbeddingOptions as E, type FineTuningJob as F, type GatewayOptions as G, type RerankResponse as H, type ImageEditAttachment as I, type JobEvent as J, type ResearchHit as K, type ResearchOptions as L, type Model as M, type ResearchProvider as N, type Operator as O, type PricingTier as P, type ResearchResponse as Q, type RotatingClientConfig as R, type RetryConfig as S, type TCloudConfig as T, type RotatingRoutingConfig as U, type RotationStats as V, type RoutingConfig as W, type RoutingStrategy as X, type SandboxChatOptions as Y, type SearchHit as Z, type SearchOptions as _, TCloudClient as a, type SearchRecency as a0, type SearchResponse as a1, type ShieldedConfig as a2, type SpendAuth as a3, type SpendingLimits as a4, TCloudError as a5, type TierConfig as a6, type TranscriptionResponse as a7, type UpdateKeyOptions as a8, type VideoGenerateOptions as a9, type VideoResponse as aa, type WatchJobOptions as ab, type WebSearchPlugin as ac, type AvatarGenerateRequest as b, type AvatarGenerateResponse as c, type AvatarJobStatus as d, type AvatarResult as e, type BatchRequest as f, type BridgeOptions as g, BridgeSession as h, type ChatCompletionChunk as i, type ChatMessage as j, type ChatOptions as k, type ChatPlugin as l, type CompletionOptions as m, type CompletionResponse as n, type CreateKeyOptions as o, type CreatedKey as p, type CreditBalance as q, type EmbeddingResponse as r, type FineTuningJobOptions as s, type ImageEditOptions as t, type ImageGenerateOptions as u, type ImageResponse as v, type OperatorInfo as w, type PrivacyConfig as x, PrivateRouter as y, type PrivateRouterConfig as z };
|
|
@@ -186,6 +186,54 @@ interface SearchResponse {
|
|
|
186
186
|
billing_units?: Record<string, unknown>;
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
+
/** Providers served by the router's research API (POST /v1/research). Mirrors
|
|
190
|
+
* SearchProvider minus `brave` (no research API). Each has its own `effort`
|
|
191
|
+
* vocabulary — see ResearchOptions.effort. */
|
|
192
|
+
type ResearchProvider = 'perplexity' | 'exa' | 'you' | 'parallel' | 'tavily';
|
|
193
|
+
interface ResearchOptions {
|
|
194
|
+
query: string;
|
|
195
|
+
provider?: ResearchProvider;
|
|
196
|
+
/** Alias accepted by the Router for provider-compatible clients. */
|
|
197
|
+
model?: ResearchProvider;
|
|
198
|
+
/** Depth/cost dial, provider-specific:
|
|
199
|
+
* perplexity minimal|low|medium|high · you lite|standard|deep|exhaustive ·
|
|
200
|
+
* exa deep-lite|deep|deep-reasoning · tavily mini|pro|auto ·
|
|
201
|
+
* parallel lite|base|core|pro|ultra. Omit for the provider default. */
|
|
202
|
+
effort?: string;
|
|
203
|
+
maxResults?: number;
|
|
204
|
+
searchRecency?: SearchRecency;
|
|
205
|
+
includeDomains?: string[];
|
|
206
|
+
excludeDomains?: string[];
|
|
207
|
+
/** Optional JSON schema requesting structured output from the provider. */
|
|
208
|
+
outputSchema?: unknown;
|
|
209
|
+
}
|
|
210
|
+
interface ResearchHit {
|
|
211
|
+
title: string;
|
|
212
|
+
url: string;
|
|
213
|
+
snippet?: string;
|
|
214
|
+
publishedAt?: string;
|
|
215
|
+
source?: string;
|
|
216
|
+
}
|
|
217
|
+
interface ResearchResponse {
|
|
218
|
+
id: string;
|
|
219
|
+
object: 'research.result' | string;
|
|
220
|
+
provider: ResearchProvider;
|
|
221
|
+
query: string;
|
|
222
|
+
/** The synthesized multi-step research answer. */
|
|
223
|
+
answer: string;
|
|
224
|
+
/** Supporting sources behind the answer. */
|
|
225
|
+
results: ResearchHit[];
|
|
226
|
+
citations: string[];
|
|
227
|
+
/** Present when an outputSchema was requested and the provider honored it. */
|
|
228
|
+
structured?: unknown;
|
|
229
|
+
usage?: {
|
|
230
|
+
upstream_cost?: number;
|
|
231
|
+
billed_cost?: number;
|
|
232
|
+
gross_margin?: number;
|
|
233
|
+
markup?: number;
|
|
234
|
+
billing_units?: Record<string, unknown>;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
189
237
|
interface WebSearchPlugin {
|
|
190
238
|
id: 'web';
|
|
191
239
|
engine?: 'native' | 'exa' | 'parallel' | 'firecrawl';
|
|
@@ -332,15 +380,10 @@ interface AvatarJobStatus {
|
|
|
332
380
|
error?: string;
|
|
333
381
|
}
|
|
334
382
|
interface PrivacyConfig {
|
|
335
|
-
/** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer.
|
|
336
|
-
mode: 'direct' | 'relayer'
|
|
383
|
+
/** 'direct' — no proxy (default). 'relayer' — route through tcloud-relayer. */
|
|
384
|
+
mode: 'direct' | 'relayer';
|
|
337
385
|
/** Relayer URL for 'relayer' mode (e.g. 'http://localhost:3030') */
|
|
338
386
|
relayerUrl?: string;
|
|
339
|
-
/**
|
|
340
|
-
* SOCKS5 proxy URL for 'socks5' mode (e.g. 'socks5://127.0.0.1:9050' for Tor).
|
|
341
|
-
* Requires `socks-proxy-agent` as an optional peer dependency.
|
|
342
|
-
*/
|
|
343
|
-
socksProxy?: string;
|
|
344
387
|
}
|
|
345
388
|
interface ShieldedConfig {
|
|
346
389
|
/** Pre-existing spending private key (hex). If not set, generates ephemeral. */
|
|
@@ -1039,6 +1082,11 @@ declare class TCloudClient {
|
|
|
1039
1082
|
rerank(options: RerankOptions): Promise<RerankResponse>;
|
|
1040
1083
|
/** Search the web through Tangle Router billing and provider routing. */
|
|
1041
1084
|
search(options: SearchOptions): Promise<SearchResponse>;
|
|
1085
|
+
/** Run a multi-step deep-research task through Tangle Router billing and
|
|
1086
|
+
* provider routing (POST /v1/research). Slower and costlier than `search` —
|
|
1087
|
+
* the provider synthesizes an answer over many fetches. Pick depth with
|
|
1088
|
+
* `effort` (provider-specific vocabulary; see {@link ResearchOptions.effort}). */
|
|
1089
|
+
research(options: ResearchOptions): Promise<ResearchResponse>;
|
|
1042
1090
|
/** Text-to-speech */
|
|
1043
1091
|
speech(options: {
|
|
1044
1092
|
model?: string;
|
|
@@ -1356,4 +1404,4 @@ declare class TCloudError extends Error {
|
|
|
1356
1404
|
constructor(status: number, message: string);
|
|
1357
1405
|
}
|
|
1358
1406
|
|
|
1359
|
-
export { type
|
|
1407
|
+
export { type SearchProvider as $, type ApiKeyInfo as A, type BatchJobResponse as B, type ChatCompletion as C, type RerankOptions as D, type EmbeddingOptions as E, type FineTuningJob as F, type GatewayOptions as G, type RerankResponse as H, type ImageEditAttachment as I, type JobEvent as J, type ResearchHit as K, type ResearchOptions as L, type Model as M, type ResearchProvider as N, type Operator as O, type PricingTier as P, type ResearchResponse as Q, type RotatingClientConfig as R, type RetryConfig as S, type TCloudConfig as T, type RotatingRoutingConfig as U, type RotationStats as V, type RoutingConfig as W, type RoutingStrategy as X, type SandboxChatOptions as Y, type SearchHit as Z, type SearchOptions as _, TCloudClient as a, type SearchRecency as a0, type SearchResponse as a1, type ShieldedConfig as a2, type SpendAuth as a3, type SpendingLimits as a4, TCloudError as a5, type TierConfig as a6, type TranscriptionResponse as a7, type UpdateKeyOptions as a8, type VideoGenerateOptions as a9, type VideoResponse as aa, type WatchJobOptions as ab, type WebSearchPlugin as ac, type AvatarGenerateRequest as b, type AvatarGenerateResponse as c, type AvatarJobStatus as d, type AvatarResult as e, type BatchRequest as f, type BridgeOptions as g, BridgeSession as h, type ChatCompletionChunk as i, type ChatMessage as j, type ChatOptions as k, type ChatPlugin as l, type CompletionOptions as m, type CompletionResponse as n, type CreateKeyOptions as o, type CreatedKey as p, type CreditBalance as q, type EmbeddingResponse as r, type FineTuningJobOptions as s, type ImageEditOptions as t, type ImageGenerateOptions as u, type ImageResponse as v, type OperatorInfo as w, type PrivacyConfig as x, PrivateRouter as y, type PrivateRouterConfig as z };
|
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
|
|
290
|
-
|
|
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.
|
|
310
|
-
|
|
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
|
-
|
|
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/${
|
|
481
|
+
"X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
|
|
487
482
|
};
|
|
488
483
|
if (this.apiKey) {
|
|
489
484
|
this.headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
@@ -1057,6 +1052,26 @@ var TCloudClient = class _TCloudClient {
|
|
|
1057
1052
|
})
|
|
1058
1053
|
});
|
|
1059
1054
|
}
|
|
1055
|
+
/** Run a multi-step deep-research task through Tangle Router billing and
|
|
1056
|
+
* provider routing (POST /v1/research). Slower and costlier than `search` —
|
|
1057
|
+
* the provider synthesizes an answer over many fetches. Pick depth with
|
|
1058
|
+
* `effort` (provider-specific vocabulary; see {@link ResearchOptions.effort}). */
|
|
1059
|
+
async research(options) {
|
|
1060
|
+
return this._request(`${this.baseURL}/research`, {
|
|
1061
|
+
method: "POST",
|
|
1062
|
+
body: JSON.stringify({
|
|
1063
|
+
query: options.query,
|
|
1064
|
+
provider: options.provider,
|
|
1065
|
+
model: options.model,
|
|
1066
|
+
effort: options.effort,
|
|
1067
|
+
maxResults: options.maxResults,
|
|
1068
|
+
searchRecency: options.searchRecency,
|
|
1069
|
+
includeDomains: options.includeDomains,
|
|
1070
|
+
excludeDomains: options.excludeDomains,
|
|
1071
|
+
outputSchema: options.outputSchema
|
|
1072
|
+
})
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1060
1075
|
/** Text-to-speech */
|
|
1061
1076
|
async speech(options) {
|
|
1062
1077
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
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-
|
|
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-
|
|
26
|
+
} from "./chunk-GDGQQRE3.js";
|
|
27
27
|
import {
|
|
28
28
|
BridgeSession,
|
|
29
29
|
PrivateRouter,
|
|
30
30
|
TCloudClient,
|
|
31
31
|
TCloudError
|
|
32
|
-
} from "./chunk-
|
|
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
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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/${
|
|
455
|
+
"X-Tangle-Client": `tcloud-sdk/${packageVersion()}`
|
|
471
456
|
};
|
|
472
457
|
if (this.apiKey) {
|
|
473
458
|
this.headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
@@ -1041,6 +1026,26 @@ var TCloudClient = class _TCloudClient {
|
|
|
1041
1026
|
})
|
|
1042
1027
|
});
|
|
1043
1028
|
}
|
|
1029
|
+
/** Run a multi-step deep-research task through Tangle Router billing and
|
|
1030
|
+
* provider routing (POST /v1/research). Slower and costlier than `search` —
|
|
1031
|
+
* the provider synthesizes an answer over many fetches. Pick depth with
|
|
1032
|
+
* `effort` (provider-specific vocabulary; see {@link ResearchOptions.effort}). */
|
|
1033
|
+
async research(options) {
|
|
1034
|
+
return this._request(`${this.baseURL}/research`, {
|
|
1035
|
+
method: "POST",
|
|
1036
|
+
body: JSON.stringify({
|
|
1037
|
+
query: options.query,
|
|
1038
|
+
provider: options.provider,
|
|
1039
|
+
model: options.model,
|
|
1040
|
+
effort: options.effort,
|
|
1041
|
+
maxResults: options.maxResults,
|
|
1042
|
+
searchRecency: options.searchRecency,
|
|
1043
|
+
includeDomains: options.includeDomains,
|
|
1044
|
+
excludeDomains: options.excludeDomains,
|
|
1045
|
+
outputSchema: options.outputSchema
|
|
1046
|
+
})
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1044
1049
|
/** Text-to-speech */
|
|
1045
1050
|
async speech(options) {
|
|
1046
1051
|
const res = await this._requestRaw(`${this.baseURL}/audio/speech`, {
|
package/dist/instance.d.cts
CHANGED
package/dist/instance.d.ts
CHANGED