@byte_fluffy/nexra-sdk 0.1.0-alpha.29 → 0.1.0-alpha.30
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 +59 -0
- package/dist/{assets-dUJMQNJD.d.ts → assets-Cusrjj7_.d.ts} +2 -2
- package/dist/catalog.d.ts +3 -3
- package/dist/catalog.js +2 -2
- package/dist/{chunk-ESV6ODRA.js → chunk-3CF6PDT3.js} +96 -18
- package/dist/chunk-DKQZWIQ7.js +730 -0
- package/dist/index.d.ts +59 -17
- package/dist/index.js +2 -2
- package/dist/{json-Drjj1OKl.d.ts → json-Cz0MkWQn.d.ts} +1 -1
- package/dist/language.d.ts +2 -2
- package/dist/language.js +2 -2
- package/dist/{media-geometry-nJ7I7ohO.d.ts → media-geometry-DAVFGry1.d.ts} +2 -2
- package/dist/media.d.ts +2 -2
- package/dist/media.js +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/{types-B3Xee2AJ.d.ts → voices-Cl4ygZHV.d.ts} +97 -85
- package/package.json +1 -1
- package/dist/chunk-IEBCNRT4.js +0 -399
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { H as HttpTransport,
|
|
3
|
-
export {
|
|
4
|
-
import { C as CursorPage,
|
|
5
|
-
export {
|
|
6
|
-
import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult,
|
|
7
|
-
export { e as CreateTaskOptions, f as CreateTaskRequest, g as
|
|
1
|
+
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, M as MEDIA_KINDS, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-Cusrjj7_.js';
|
|
2
|
+
import { H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, a as TaskModel, b as ModelSchema, c as ModelResourceList, N as NexraClientOptions } from './media-geometry-DAVFGry1.js';
|
|
3
|
+
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, k as ModelResourceOption, l as NexraBillingCurrency, m as NexraCatalogRevision, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-DAVFGry1.js';
|
|
4
|
+
import { C as CursorPage, J as JsonValue } from './json-Cz0MkWQn.js';
|
|
5
|
+
export { a as JsonObject, b as JsonPrimitive } from './json-Cz0MkWQn.js';
|
|
6
|
+
import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, N as NexraError, P as PublicErrorFields, c as TaskResult } from './voices-Cl4ygZHV.js';
|
|
7
|
+
export { d as ApiErrorPayload, e as CreateTaskOptions, f as CreateTaskRequest, g as PublicError, h as PublicErrorContext, i as RequestDetails, j as TASK_STATUSES, k as TaskCost, l as TaskError, m as TaskEvent, n as TaskEventType, o as TaskListParams, p as TaskPage, q as TaskProgress, r as TaskReceipt, s as TaskStatus, t as TaskTiming, u as TaskUsage, v as TaskWebhookConfig, w as TerminalTaskStatus, x as VerifyWebhookOptions, W as WaitTaskOptions, y as WatchTaskOptions, z as isTerminalTaskStatus, B as verifyWebhook } from './voices-Cl4ygZHV.js';
|
|
8
8
|
import { CatalogClient } from './catalog.js';
|
|
9
9
|
export { formatModelDisplayName, getModelSpec, listModelSpecs } from './catalog.js';
|
|
10
10
|
export { ceilDecimal, multiplyDecimal } from './decimal.js';
|
|
@@ -41,23 +41,65 @@ declare class NexraClient {
|
|
|
41
41
|
}
|
|
42
42
|
declare function createNexra(options?: NexraClientOptions): NexraClient;
|
|
43
43
|
|
|
44
|
+
type LegacyTaskInput = TaskResult<unknown> & {
|
|
45
|
+
requestId?: string;
|
|
46
|
+
error?: {
|
|
47
|
+
code?: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
details?: unknown;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
44
52
|
declare class NexraApiError extends Error {
|
|
45
53
|
readonly status: number;
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
|
|
54
|
+
readonly nexraError: NexraError;
|
|
55
|
+
readonly nexraRequestId?: string;
|
|
56
|
+
readonly nexraHttpStatus?: number;
|
|
57
|
+
readonly upstreamHttpStatus?: PublicErrorFields["upstreamHttpStatus"];
|
|
58
|
+
readonly upstreamRequestId?: string;
|
|
59
|
+
readonly upstreamError?: PublicErrorFields["upstreamError"];
|
|
60
|
+
readonly upstreamRedacted?: true;
|
|
61
|
+
readonly upstreamTruncated?: true;
|
|
62
|
+
readonly upstreamUnavailableReason?: PublicErrorFields["upstreamUnavailableReason"];
|
|
63
|
+
readonly upstreamFormat?: PublicErrorFields["upstreamFormat"];
|
|
64
|
+
readonly upstreamEvent?: string;
|
|
65
|
+
constructor(message: string, options: PublicErrorFields & {
|
|
51
66
|
status: number;
|
|
52
67
|
code?: string;
|
|
53
68
|
requestId?: string;
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
details?: unknown;
|
|
70
|
+
upstream?: unknown;
|
|
56
71
|
});
|
|
72
|
+
get code(): string;
|
|
73
|
+
/** @deprecated Use nexraRequestId. */
|
|
74
|
+
get requestId(): string | undefined;
|
|
75
|
+
/** @deprecated Use nexraError.param. */
|
|
76
|
+
get details(): {
|
|
77
|
+
param: string;
|
|
78
|
+
} | undefined;
|
|
57
79
|
}
|
|
58
80
|
declare class NexraTaskError extends Error {
|
|
59
|
-
readonly task:
|
|
60
|
-
constructor(task:
|
|
81
|
+
readonly task: LegacyTaskInput;
|
|
82
|
+
constructor(task: LegacyTaskInput);
|
|
83
|
+
get nexraError(): NexraError | undefined;
|
|
84
|
+
get code(): string | undefined;
|
|
85
|
+
/** @deprecated Use nexraError.param. */
|
|
86
|
+
get details(): {
|
|
87
|
+
param: string;
|
|
88
|
+
} | undefined;
|
|
89
|
+
/** @deprecated Use nexraRequestId. */
|
|
90
|
+
get requestId(): string | undefined;
|
|
91
|
+
get nexraRequestId(): string | undefined;
|
|
92
|
+
get nexraHttpStatus(): number | undefined;
|
|
93
|
+
get upstreamHttpStatus(): PublicErrorFields["upstreamHttpStatus"];
|
|
94
|
+
get upstreamRequestId(): string | undefined;
|
|
95
|
+
get upstreamError(): PublicErrorFields["upstreamError"];
|
|
96
|
+
get upstreamRedacted(): true | undefined;
|
|
97
|
+
get upstreamTruncated(): true | undefined;
|
|
98
|
+
get upstreamUnavailableReason(): PublicErrorFields["upstreamUnavailableReason"];
|
|
99
|
+
get upstreamFormat(): PublicErrorFields["upstreamFormat"];
|
|
100
|
+
get upstreamEvent(): string | undefined;
|
|
101
|
+
private get publicFields();
|
|
102
|
+
get taskId(): string;
|
|
61
103
|
}
|
|
62
104
|
declare class NexraWaitTimeoutError extends Error {
|
|
63
105
|
readonly taskId: string;
|
|
@@ -65,4 +107,4 @@ declare class NexraWaitTimeoutError extends Error {
|
|
|
65
107
|
constructor(taskId: string, timeoutMs: number);
|
|
66
108
|
}
|
|
67
109
|
|
|
68
|
-
export {
|
|
110
|
+
export { AssetsClient, CatalogClient, type CreateVoiceOptions, CreateVoiceRequest, CursorPage, JsonValue, ModelResourceList, ModelSchema, ModelSearchParams, ModelsClient, NexraApiError, NexraClient, NexraClientOptions, NexraError, NexraTaskError, NexraWaitTimeoutError, PublicErrorFields, RunResult, RunTaskOptions, TaskResult as Task, TaskModel, TaskModelSummary, TaskResult, TasksClient, Voice, VoiceCreation, VoicesClient, createNexra };
|
package/dist/index.js
CHANGED
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
projectMediaGeometry,
|
|
21
21
|
queryString,
|
|
22
22
|
sleep
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3CF6PDT3.js";
|
|
24
24
|
import {
|
|
25
25
|
MEDIA_KINDS,
|
|
26
26
|
TASK_STATUSES,
|
|
27
27
|
createTaskRequest,
|
|
28
28
|
isTerminalTaskStatus
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DKQZWIQ7.js";
|
|
30
30
|
|
|
31
31
|
// src/assets.ts
|
|
32
32
|
var AssetsClient = class {
|
package/dist/language.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { NexraLanguageProtocol } from './catalog.js';
|
|
3
3
|
export { NexraLanguageModelBinding } from './catalog.js';
|
|
4
|
-
import { F as FetchLike } from './media-geometry-
|
|
5
|
-
import './json-
|
|
4
|
+
import { F as FetchLike } from './media-geometry-DAVFGry1.js';
|
|
5
|
+
import './json-Cz0MkWQn.js';
|
|
6
6
|
|
|
7
7
|
type NexraLanguageModelOptions = {
|
|
8
8
|
apiKey: string;
|
package/dist/language.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
jsonBody,
|
|
6
6
|
parseServerSentEvents,
|
|
7
7
|
resolveNexraLanguageReasoning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-3CF6PDT3.js";
|
|
9
|
+
import "./chunk-DKQZWIQ7.js";
|
|
10
10
|
|
|
11
11
|
// src/language/index.ts
|
|
12
12
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as JsonPrimitive,
|
|
1
|
+
import { b as JsonPrimitive, a as JsonObject, J as JsonValue } from './json-Cz0MkWQn.js';
|
|
2
2
|
|
|
3
3
|
declare const BILLING_METRICS: readonly ["requests", "input_tokens", "cached_input_tokens", "cache_write_tokens", "cache_creation_5m_input_tokens", "cache_creation_1h_input_tokens", "cache_read_input_tokens", "output_tokens", "input_characters", "input_utf8_bytes", "input_images", "output_images", "input_audio_seconds", "output_audio_seconds", "input_video_seconds", "output_video_seconds", "provider_credits", "web_search_requests"];
|
|
4
4
|
type BillingMetric = (typeof BILLING_METRICS)[number];
|
|
@@ -360,4 +360,4 @@ declare function decodeMediaGeometry(_inputSchema: JsonObject, input: JsonObject
|
|
|
360
360
|
/** Normalize the SDK convenience alias `ratio` without producing Native fields. */
|
|
361
361
|
declare function applyMediaGeometry(inputSchema: JsonObject, input: JsonObject): JsonObject;
|
|
362
362
|
|
|
363
|
-
export { type
|
|
363
|
+
export { type NexraCatalogChangeParams as A, type NexraCatalogChangePage as B, type CreateNexraDisplayQuoteBatchRequest as C, type NexraCatalogModelState as D, type NexraModelEndpointSpec as E, type FetchLike as F, type NexraCatalogModelIdentity as G, HttpTransport as H, type ModelSearchParams as M, type NexraClientOptions as N, type TaskModelSummary as T, type UnifiedMediaGeometry as U, type TaskModel as a, type ModelSchema as b, type ModelResourceList as c, type CreateNexraQuoteRequest as d, type MediaGeometryField as e, type MediaGeometryProjection as f, type ModelCapabilitySummary as g, type ModelDateVersion as h, type ModelEndpointSummary as i, type ModelModality as j, type ModelResourceOption as k, type NexraBillingCurrency as l, type NexraCatalogRevision as m, type NexraDisplayQuoteBatch as n, type NexraDisplayQuoteBatchEntry as o, type NexraModelOperation as p, type NexraModelSpec as q, type NexraModelSpecFilter as r, type NexraQuote as s, type NexraSalePrice as t, type NexraSalePriceList as u, type NexraSettlement as v, applyMediaGeometry as w, decodeMediaGeometry as x, encodeMediaGeometry as y, projectMediaGeometry as z };
|
package/dist/media.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { b as AssetReference } from './assets-Cusrjj7_.js';
|
|
2
|
+
import { a as JsonObject } from './json-Cz0MkWQn.js';
|
|
3
3
|
|
|
4
4
|
declare const NEXRA_MEDIA_API_VERSION: 1;
|
|
5
5
|
/** Catalog-level generation taxonomy. Text keeps its native endpoint protocols. */
|
package/dist/media.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { C as CursorPage,
|
|
4
|
-
export {
|
|
1
|
+
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-Cusrjj7_.js';
|
|
2
|
+
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, c as ModelResourceList, k as ModelResourceOption, b as ModelSchema, M as ModelSearchParams, l as NexraBillingCurrency, m as NexraCatalogRevision, N as NexraClientOptions, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, a as TaskModel, T as TaskModelSummary, U as UnifiedMediaGeometry } from './media-geometry-DAVFGry1.js';
|
|
3
|
+
export { C as CursorPage, a as JsonObject, b as JsonPrimitive, J as JsonValue } from './json-Cz0MkWQn.js';
|
|
4
|
+
export { d as ApiErrorPayload, e as CreateTaskOptions, f as CreateTaskRequest, C as CreateVoiceRequest, N as NexraError, g as PublicError, h as PublicErrorContext, P as PublicErrorFields, i as RequestDetails, b as RunResult, R as RunTaskOptions, c as Task, k as TaskCost, l as TaskError, m as TaskEvent, n as TaskEventType, o as TaskListParams, p as TaskPage, q as TaskProgress, r as TaskReceipt, c as TaskResult, s as TaskStatus, t as TaskTiming, u as TaskUsage, v as TaskWebhookConfig, w as TerminalTaskStatus, x as VerifyWebhookOptions, V as Voice, a as VoiceCreation, W as WaitTaskOptions, y as WatchTaskOptions } from './voices-Cl4ygZHV.js';
|
|
@@ -1,18 +1,93 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { J as
|
|
1
|
+
import { c as AssetUploadOptions, d as MediaAsset, A as AssetImportRequest, g as AssetCertificationRequest, h as AssetCertification, i as AssetCertificationWaitOptions } from './assets-Cusrjj7_.js';
|
|
2
|
+
import { H as HttpTransport, v as NexraSettlement } from './media-geometry-DAVFGry1.js';
|
|
3
|
+
import { J as JsonValue, a as JsonObject, C as CursorPage } from './json-Cz0MkWQn.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
type PublicUpstreamUnavailableReason = "no_response" | "not_retained" | "unsupported_capture" | "error_not_emitted" | "size_limit";
|
|
6
|
+
/** Network errors retain unknown codes from older or newer servers. */
|
|
7
|
+
type NexraError = {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
param?: string;
|
|
11
|
+
};
|
|
12
|
+
type PublicErrorContext = {
|
|
13
|
+
nexraRequestId?: string;
|
|
14
|
+
nexraHttpStatus?: number;
|
|
15
|
+
};
|
|
16
|
+
type PublicErrorFields = PublicErrorContext & {
|
|
17
|
+
nexraError?: NexraError;
|
|
18
|
+
upstreamHttpStatus?: number;
|
|
19
|
+
upstreamRequestId?: string;
|
|
20
|
+
upstreamError?: JsonValue;
|
|
21
|
+
upstreamRedacted?: true;
|
|
22
|
+
upstreamTruncated?: true;
|
|
23
|
+
upstreamUnavailableReason?: PublicUpstreamUnavailableReason;
|
|
24
|
+
upstreamFormat?: "sse" | "decoded";
|
|
25
|
+
upstreamEvent?: string;
|
|
26
|
+
};
|
|
27
|
+
type PublicError = PublicErrorFields & {
|
|
28
|
+
nexraError: NexraError;
|
|
29
|
+
};
|
|
30
|
+
type ApiErrorPayload = PublicError;
|
|
31
|
+
|
|
32
|
+
declare class AssetsClient {
|
|
33
|
+
private readonly transport;
|
|
34
|
+
constructor(transport: HttpTransport);
|
|
35
|
+
upload(file: Blob, options?: AssetUploadOptions): Promise<MediaAsset>;
|
|
36
|
+
import(request: AssetImportRequest, signal?: AbortSignal): Promise<MediaAsset>;
|
|
37
|
+
get(assetId: string, signal?: AbortSignal): Promise<MediaAsset>;
|
|
38
|
+
certifyForSeedance(asset: MediaAsset | string, request?: AssetCertificationRequest, signal?: AbortSignal): Promise<AssetCertification>;
|
|
39
|
+
getSeedanceCertification(asset: MediaAsset | string, signal?: AbortSignal): Promise<AssetCertification>;
|
|
40
|
+
waitForSeedanceCertification(asset: MediaAsset | string, options?: AssetCertificationWaitOptions): Promise<AssetCertification>;
|
|
41
|
+
download(asset: MediaAsset | string, signal?: AbortSignal): Promise<Response>;
|
|
42
|
+
stream(asset: MediaAsset | string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface CreateTaskOptions {
|
|
46
|
+
quoteToken?: string;
|
|
47
|
+
submittedAt?: string;
|
|
48
|
+
metadata?: JsonObject;
|
|
49
|
+
callback_url?: string;
|
|
50
|
+
/** @deprecated Use callback_url; do not supply both. */
|
|
51
|
+
webhook?: TaskWebhookConfig;
|
|
52
|
+
schemaVersion?: number;
|
|
53
|
+
idempotencyKey?: string;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
interface WatchTaskOptions {
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
lastEventId?: string;
|
|
59
|
+
maxReconnects?: number;
|
|
60
|
+
}
|
|
61
|
+
interface WaitTaskOptions extends WatchTaskOptions {
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
pollIntervalMs?: number;
|
|
64
|
+
onEvent?: (event: TaskEvent) => void | Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
interface RunTaskOptions extends CreateTaskOptions, WaitTaskOptions {
|
|
67
|
+
cancelOnAbort?: boolean;
|
|
68
|
+
}
|
|
69
|
+
declare class TasksClient {
|
|
70
|
+
private readonly transport;
|
|
71
|
+
private readonly assets;
|
|
72
|
+
constructor(transport: HttpTransport, assets: AssetsClient);
|
|
73
|
+
create<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, input: TInput, options?: CreateTaskOptions): Promise<TaskReceipt>;
|
|
74
|
+
get<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskResult<TOutput>>;
|
|
75
|
+
list<TOutput = JsonValue>(params?: TaskListParams, signal?: AbortSignal): Promise<CursorPage<TaskResult<TOutput>>>;
|
|
76
|
+
cancel<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskReceipt>;
|
|
77
|
+
watch(taskId: string, options?: WatchTaskOptions): AsyncGenerator<TaskEvent>;
|
|
78
|
+
wait<TOutput = JsonValue>(taskId: string, options?: WaitTaskOptions): Promise<TaskResult<TOutput>>;
|
|
79
|
+
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, input: TInput, options?: RunTaskOptions): Promise<RunResult<TOutput>>;
|
|
14
80
|
}
|
|
15
81
|
|
|
82
|
+
interface VerifyWebhookOptions {
|
|
83
|
+
toleranceSeconds?: number;
|
|
84
|
+
now?: Date;
|
|
85
|
+
}
|
|
86
|
+
/** @deprecated Only verifies legacy signed webhooks, not callback_url notifications. */
|
|
87
|
+
declare function verifyWebhook(request: Request, secret: string, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
88
|
+
|
|
89
|
+
type TaskPage<TOutput = JsonValue> = CursorPage<TaskResult<TOutput>>;
|
|
90
|
+
|
|
16
91
|
declare const TASK_STATUSES: readonly ["queued", "running", "succeeded", "failed", "cancelling", "cancelled"];
|
|
17
92
|
type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
18
93
|
type TerminalTaskStatus = "succeeded" | "failed" | "cancelled";
|
|
@@ -21,13 +96,7 @@ interface TaskProgress {
|
|
|
21
96
|
stage?: string;
|
|
22
97
|
message?: string;
|
|
23
98
|
}
|
|
24
|
-
|
|
25
|
-
code: string;
|
|
26
|
-
message: string;
|
|
27
|
-
category?: string;
|
|
28
|
-
retryable?: boolean;
|
|
29
|
-
details?: JsonObject;
|
|
30
|
-
}
|
|
99
|
+
type TaskError = NexraError;
|
|
31
100
|
interface TaskUsage {
|
|
32
101
|
components: Array<{
|
|
33
102
|
name: string;
|
|
@@ -61,6 +130,8 @@ interface TaskTiming {
|
|
|
61
130
|
generationMs: number | null;
|
|
62
131
|
/** Background: elapsed persistence stage until assets are ready; terminal: measured transfer. Null when unfinished or unavailable. */
|
|
63
132
|
storageMs: number | null;
|
|
133
|
+
/** First-response time outside measured preparation/generation and any pre-response storage; not a separately instrumented stage. */
|
|
134
|
+
responseOverheadMs?: number | null;
|
|
64
135
|
/** Start of in-progress background persistence, when a worker has claimed the output. */
|
|
65
136
|
storageStartedAt?: string;
|
|
66
137
|
/** Background persistence elapsed time from first response to durable asset readiness. */
|
|
@@ -78,7 +149,7 @@ interface TaskTiming {
|
|
|
78
149
|
observedAt?: string;
|
|
79
150
|
}
|
|
80
151
|
/** Repository/console read model. HTTP clients receive TaskReceipt or TaskResult. */
|
|
81
|
-
interface Task<TOutput = JsonValue> {
|
|
152
|
+
interface Task<TOutput = JsonValue> extends PublicErrorFields {
|
|
82
153
|
id: string;
|
|
83
154
|
/** Original platform request ID, shared with request history. */
|
|
84
155
|
requestId?: string;
|
|
@@ -106,7 +177,7 @@ interface Task<TOutput = JsonValue> {
|
|
|
106
177
|
/** Native-managed tasks preserve the final response shape and media URLs; catalog models may normalize model identifiers. */
|
|
107
178
|
output?: TOutput;
|
|
108
179
|
assets: MediaAsset[];
|
|
109
|
-
error?:
|
|
180
|
+
error?: PublicError;
|
|
110
181
|
usage?: TaskUsage;
|
|
111
182
|
cost?: TaskCost;
|
|
112
183
|
/** Customer billing state; absent on older servers. */
|
|
@@ -139,13 +210,13 @@ interface Task<TOutput = JsonValue> {
|
|
|
139
210
|
expiresAt?: string;
|
|
140
211
|
}
|
|
141
212
|
/** POST /tasks returns acceptance only, including for idempotent replays. */
|
|
142
|
-
type TaskReceipt = Pick<Task, "id" | "status"
|
|
213
|
+
type TaskReceipt = Pick<Task, "id" | "status"> & PublicErrorContext;
|
|
143
214
|
/** Public Task result; platform diagnostics and business tags live in RequestDetails. */
|
|
144
|
-
type TaskResult<TOutput = JsonValue> = Pick<Task<TOutput>, "id" | "model" | "status"> & Partial<Pick<Task<TOutput>, "
|
|
215
|
+
type TaskResult<TOutput = JsonValue> = Pick<Task<TOutput>, "id" | "model" | "status"> & Partial<Pick<Task<TOutput>, "output" | "assets" | "persistPolicy" | "deliveryStatus" | "settlement" | "queue">> & PublicErrorFields;
|
|
145
216
|
/** Platform request details, used by both managed Tasks and native proxy requests. */
|
|
146
|
-
interface RequestDetails {
|
|
217
|
+
interface RequestDetails extends PublicErrorFields {
|
|
147
218
|
id: string;
|
|
148
|
-
|
|
219
|
+
nexraRequestId?: string;
|
|
149
220
|
taskId: string | null;
|
|
150
221
|
method: string;
|
|
151
222
|
path: string;
|
|
@@ -158,7 +229,6 @@ interface RequestDetails {
|
|
|
158
229
|
taskStatus?: string | null;
|
|
159
230
|
persistPolicy?: "terminal" | "background";
|
|
160
231
|
deliveryStatus?: Task["deliveryStatus"];
|
|
161
|
-
httpStatus: number | null;
|
|
162
232
|
errorCode: string | null;
|
|
163
233
|
/** HTTP duration, never substituted with asynchronous task duration. */
|
|
164
234
|
durationMs: number | null;
|
|
@@ -233,7 +303,6 @@ interface TaskListParams {
|
|
|
233
303
|
limit?: number;
|
|
234
304
|
cursor?: string;
|
|
235
305
|
}
|
|
236
|
-
type TaskPage<TOutput = JsonValue> = CursorPage<Task<TOutput>>;
|
|
237
306
|
interface RunResult<TOutput = JsonValue> {
|
|
238
307
|
taskId: string;
|
|
239
308
|
output: TOutput;
|
|
@@ -273,61 +342,4 @@ type VoiceCreation = Readonly<{
|
|
|
273
342
|
voice: Voice;
|
|
274
343
|
}>;
|
|
275
344
|
|
|
276
|
-
|
|
277
|
-
private readonly transport;
|
|
278
|
-
constructor(transport: HttpTransport);
|
|
279
|
-
upload(file: Blob, options?: AssetUploadOptions): Promise<MediaAsset>;
|
|
280
|
-
import(request: AssetImportRequest, signal?: AbortSignal): Promise<MediaAsset>;
|
|
281
|
-
get(assetId: string, signal?: AbortSignal): Promise<MediaAsset>;
|
|
282
|
-
certifyForSeedance(asset: MediaAsset | string, request?: AssetCertificationRequest, signal?: AbortSignal): Promise<AssetCertification>;
|
|
283
|
-
getSeedanceCertification(asset: MediaAsset | string, signal?: AbortSignal): Promise<AssetCertification>;
|
|
284
|
-
waitForSeedanceCertification(asset: MediaAsset | string, options?: AssetCertificationWaitOptions): Promise<AssetCertification>;
|
|
285
|
-
download(asset: MediaAsset | string, signal?: AbortSignal): Promise<Response>;
|
|
286
|
-
stream(asset: MediaAsset | string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
interface CreateTaskOptions {
|
|
290
|
-
quoteToken?: string;
|
|
291
|
-
submittedAt?: string;
|
|
292
|
-
metadata?: JsonObject;
|
|
293
|
-
callback_url?: string;
|
|
294
|
-
/** @deprecated Use callback_url; do not supply both. */
|
|
295
|
-
webhook?: TaskWebhookConfig;
|
|
296
|
-
schemaVersion?: number;
|
|
297
|
-
idempotencyKey?: string;
|
|
298
|
-
signal?: AbortSignal;
|
|
299
|
-
}
|
|
300
|
-
interface WatchTaskOptions {
|
|
301
|
-
signal?: AbortSignal;
|
|
302
|
-
lastEventId?: string;
|
|
303
|
-
maxReconnects?: number;
|
|
304
|
-
}
|
|
305
|
-
interface WaitTaskOptions extends WatchTaskOptions {
|
|
306
|
-
timeoutMs?: number;
|
|
307
|
-
pollIntervalMs?: number;
|
|
308
|
-
onEvent?: (event: TaskEvent) => void | Promise<void>;
|
|
309
|
-
}
|
|
310
|
-
interface RunTaskOptions extends CreateTaskOptions, WaitTaskOptions {
|
|
311
|
-
cancelOnAbort?: boolean;
|
|
312
|
-
}
|
|
313
|
-
declare class TasksClient {
|
|
314
|
-
private readonly transport;
|
|
315
|
-
private readonly assets;
|
|
316
|
-
constructor(transport: HttpTransport, assets: AssetsClient);
|
|
317
|
-
create<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, input: TInput, options?: CreateTaskOptions): Promise<TaskReceipt>;
|
|
318
|
-
get<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskResult<TOutput>>;
|
|
319
|
-
list<TOutput = JsonValue>(params?: TaskListParams, signal?: AbortSignal): Promise<CursorPage<TaskResult<TOutput>>>;
|
|
320
|
-
cancel<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskReceipt>;
|
|
321
|
-
watch(taskId: string, options?: WatchTaskOptions): AsyncGenerator<TaskEvent>;
|
|
322
|
-
wait<TOutput = JsonValue>(taskId: string, options?: WaitTaskOptions): Promise<TaskResult<TOutput>>;
|
|
323
|
-
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, input: TInput, options?: RunTaskOptions): Promise<RunResult<TOutput>>;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
interface VerifyWebhookOptions {
|
|
327
|
-
toleranceSeconds?: number;
|
|
328
|
-
now?: Date;
|
|
329
|
-
}
|
|
330
|
-
/** @deprecated Only verifies legacy signed webhooks, not callback_url notifications. */
|
|
331
|
-
declare function verifyWebhook(request: Request, secret: string, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
332
|
-
|
|
333
|
-
export { AssetsClient as A, type CreateVoiceRequest as C, type RunTaskOptions as R, TasksClient as T, type Voice as V, type WaitTaskOptions as W, type VoiceCreation as a, type RunResult as b, type ApiErrorPayload as c, type TaskResult as d, type CreateTaskOptions as e, type CreateTaskRequest as f, type RequestDetails as g, TASK_STATUSES as h, type Task as i, type TaskCost as j, type TaskError as k, type TaskEvent as l, type TaskEventType as m, type TaskListParams as n, type TaskPage as o, type TaskProgress as p, type TaskReceipt as q, type TaskStatus as r, type TaskTiming as s, type TaskUsage as t, type TaskWebhookConfig as u, type TerminalTaskStatus as v, type VerifyWebhookOptions as w, type WatchTaskOptions as x, isTerminalTaskStatus as y, verifyWebhook as z };
|
|
345
|
+
export { AssetsClient as A, verifyWebhook as B, type CreateVoiceRequest as C, type NexraError as N, type PublicErrorFields as P, type RunTaskOptions as R, TasksClient as T, type Voice as V, type WaitTaskOptions as W, type VoiceCreation as a, type RunResult as b, type TaskResult as c, type ApiErrorPayload as d, type CreateTaskOptions as e, type CreateTaskRequest as f, type PublicError as g, type PublicErrorContext as h, type RequestDetails as i, TASK_STATUSES as j, type TaskCost as k, type TaskError as l, type TaskEvent as m, type TaskEventType as n, type TaskListParams as o, type TaskPage as p, type TaskProgress as q, type TaskReceipt as r, type TaskStatus as s, type TaskTiming as t, type TaskUsage as u, type TaskWebhookConfig as v, type TerminalTaskStatus as w, type VerifyWebhookOptions as x, type WatchTaskOptions as y, isTerminalTaskStatus as z };
|