ql-agent-sdk 1.0.2 → 1.1.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/README.md +121 -0
- package/dist/index.cjs +136 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +217 -8
- package/dist/index.d.ts +217 -8
- package/dist/index.js +136 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,11 @@ interface JsonRequestOptions {
|
|
|
4
4
|
signal?: AbortSignal;
|
|
5
5
|
headers?: Record<string, string>;
|
|
6
6
|
}
|
|
7
|
+
interface FormRequestOptions {
|
|
8
|
+
form: FormData;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* Internal transport used by the API namespaces. Keeps the API key inside a
|
|
9
14
|
* closure (never exposed) and normalizes responses/errors for the caller.
|
|
@@ -11,6 +16,8 @@ interface JsonRequestOptions {
|
|
|
11
16
|
interface Transport {
|
|
12
17
|
/** Perform a JSON request and return the unwrapped `data` payload. */
|
|
13
18
|
json<T>(method: string, path: string, opts?: JsonRequestOptions): Promise<T>;
|
|
19
|
+
/** Perform a multipart/form-data request and return the unwrapped `data` payload. */
|
|
20
|
+
form<T>(path: string, opts: FormRequestOptions): Promise<T>;
|
|
14
21
|
/**
|
|
15
22
|
* Perform a request expected to stream SSE. Returns the response body stream
|
|
16
23
|
* after verifying a 2xx + text/event-stream; throws QLError otherwise.
|
|
@@ -359,6 +366,165 @@ interface ImageGenerateResult {
|
|
|
359
366
|
tier: string;
|
|
360
367
|
latencyMs: number;
|
|
361
368
|
}
|
|
369
|
+
type VideoTier = "standard" | "professional" | "advanced";
|
|
370
|
+
/** A single pricing entry for a video model. */
|
|
371
|
+
interface VideoPricingEntry {
|
|
372
|
+
/** What is billed, e.g. "output_video" / "voiceover". */
|
|
373
|
+
billable: string;
|
|
374
|
+
/** Billing unit: per rendered second, or flat per request. */
|
|
375
|
+
unit: "second" | "request";
|
|
376
|
+
costUsd: number;
|
|
377
|
+
}
|
|
378
|
+
/** A tiered video-generation model as returned by `videos.listModels`. */
|
|
379
|
+
interface VideoModelInfo {
|
|
380
|
+
id: string;
|
|
381
|
+
name: string;
|
|
382
|
+
tier: VideoTier;
|
|
383
|
+
description: string;
|
|
384
|
+
/** Short best-use-case label for UI copy. */
|
|
385
|
+
bestFor: string;
|
|
386
|
+
/** Execution engine (e.g. "motion-graphics"). */
|
|
387
|
+
engine: string;
|
|
388
|
+
supportsProductImages: boolean;
|
|
389
|
+
maxReferenceImages: number;
|
|
390
|
+
supportsReferenceVideos: boolean;
|
|
391
|
+
maxReferenceVideos: number;
|
|
392
|
+
supportedAspectRatios: string[];
|
|
393
|
+
supportedResolutions: string[];
|
|
394
|
+
/** Inclusive [min, max] duration in seconds. */
|
|
395
|
+
durationRange: [number, number];
|
|
396
|
+
voiceoverSupport: boolean;
|
|
397
|
+
pricing: {
|
|
398
|
+
summary: string;
|
|
399
|
+
entries: VideoPricingEntry[];
|
|
400
|
+
};
|
|
401
|
+
recommended: boolean;
|
|
402
|
+
enabled: boolean;
|
|
403
|
+
/** Runtime engine availability (render toolchain present). */
|
|
404
|
+
available: boolean;
|
|
405
|
+
}
|
|
406
|
+
/** Result of `videos.listModels`. */
|
|
407
|
+
interface VideoModelsResult {
|
|
408
|
+
models: VideoModelInfo[];
|
|
409
|
+
engine: {
|
|
410
|
+
available: boolean;
|
|
411
|
+
detail: string;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/** Input for `videos.generate`. */
|
|
415
|
+
interface VideoGenerateInput {
|
|
416
|
+
/** The creative brief / script for the video. */
|
|
417
|
+
prompt: string;
|
|
418
|
+
/** Explicit registry model id (wins over `tier`). */
|
|
419
|
+
model?: string;
|
|
420
|
+
/** Tier to resolve a model from (used when `model` is omitted). */
|
|
421
|
+
tier?: VideoTier | string;
|
|
422
|
+
/** Product/reference images — base64 data URLs or https URLs. Order defines IMG_0..N. */
|
|
423
|
+
images_list?: string[];
|
|
424
|
+
/** Reference (style) videos — https URLs only (upload local files via `files.upload`). */
|
|
425
|
+
video_files?: string[];
|
|
426
|
+
/** e.g. "16:9", "9:16", "1:1". Default "16:9". */
|
|
427
|
+
aspect_ratio?: string;
|
|
428
|
+
/** Duration in seconds (must be within the model's durationRange). */
|
|
429
|
+
duration?: number;
|
|
430
|
+
/** e.g. "720p" | "1080p". Default "720p". */
|
|
431
|
+
resolution?: string;
|
|
432
|
+
/** Bake an ElevenLabs voiceover into the render (requires `narration`). */
|
|
433
|
+
generate_audio?: boolean;
|
|
434
|
+
/** Voiceover text (used when `generate_audio` is true). Max 3000 chars. */
|
|
435
|
+
narration?: string;
|
|
436
|
+
}
|
|
437
|
+
/** Returned when a video job is created (HTTP 202). */
|
|
438
|
+
interface VideoTaskCreated {
|
|
439
|
+
taskId: string;
|
|
440
|
+
status: "queued";
|
|
441
|
+
}
|
|
442
|
+
type VideoTaskStatus = "queued" | "rendering" | "completed" | "failed" | "cancelled" | (string & {});
|
|
443
|
+
/** A video job snapshot, as returned by `videos.getTask`. */
|
|
444
|
+
interface VideoTask {
|
|
445
|
+
taskId: string;
|
|
446
|
+
status: VideoTaskStatus;
|
|
447
|
+
progress?: {
|
|
448
|
+
current: number;
|
|
449
|
+
total: number;
|
|
450
|
+
message?: string;
|
|
451
|
+
};
|
|
452
|
+
/** Served media path (e.g. /generated/video-….mp4) once completed. */
|
|
453
|
+
outputUrl?: string;
|
|
454
|
+
mime?: string;
|
|
455
|
+
ext?: string;
|
|
456
|
+
/** Actual rendered duration in seconds. */
|
|
457
|
+
durationSec?: number;
|
|
458
|
+
error?: string;
|
|
459
|
+
model?: string;
|
|
460
|
+
tier?: string;
|
|
461
|
+
latencyMs?: number;
|
|
462
|
+
createdAt: string | Date;
|
|
463
|
+
completedAt: string | Date | null;
|
|
464
|
+
}
|
|
465
|
+
/** Options for polling / waiting on a video job. */
|
|
466
|
+
interface VideoWaitOptions {
|
|
467
|
+
/** Base delay between polls in ms (default 2000). Grows with backoff up to `maxIntervalMs`. */
|
|
468
|
+
intervalMs?: number;
|
|
469
|
+
/** Upper bound for the backoff delay in ms (default 15000). */
|
|
470
|
+
maxIntervalMs?: number;
|
|
471
|
+
/** Stop waiting after this many ms and throw a timeout error. Omit to wait until terminal or abort. */
|
|
472
|
+
timeoutMs?: number;
|
|
473
|
+
/** Abort polling at any time. */
|
|
474
|
+
signal?: AbortSignal;
|
|
475
|
+
/** Called after each poll with the latest job snapshot. */
|
|
476
|
+
onTick?: (task: VideoTask) => void;
|
|
477
|
+
}
|
|
478
|
+
/** Input for `audio.textToSpeech`. */
|
|
479
|
+
interface TtsInput {
|
|
480
|
+
/** Text to synthesize (max 3000 chars). */
|
|
481
|
+
text: string;
|
|
482
|
+
/** ElevenLabs voice id (list via `audio.voices`). Defaults to the platform voice. */
|
|
483
|
+
voiceId?: string;
|
|
484
|
+
/** Voice stability 0..1 (default 0.5). */
|
|
485
|
+
stability?: number;
|
|
486
|
+
/** Similarity boost 0..1 (default 0.75). */
|
|
487
|
+
similarityBoost?: number;
|
|
488
|
+
}
|
|
489
|
+
/** Result of `audio.textToSpeech`. */
|
|
490
|
+
interface TtsResult {
|
|
491
|
+
/** Served audio path (e.g. /generated/tts-….mp3). */
|
|
492
|
+
url: string;
|
|
493
|
+
voiceId: string;
|
|
494
|
+
modelId: string;
|
|
495
|
+
bytes: number;
|
|
496
|
+
latencyMs: number;
|
|
497
|
+
}
|
|
498
|
+
/** A single ElevenLabs voice as returned by `audio.voices`. */
|
|
499
|
+
interface VoiceInfo {
|
|
500
|
+
id: string;
|
|
501
|
+
name: string;
|
|
502
|
+
}
|
|
503
|
+
/** Result of `audio.voices`. */
|
|
504
|
+
interface VoicesResult {
|
|
505
|
+
voices: VoiceInfo[];
|
|
506
|
+
/** "live" = fetched from the provider; "none" = no provider key configured. */
|
|
507
|
+
source: "live" | "none";
|
|
508
|
+
note?: string;
|
|
509
|
+
}
|
|
510
|
+
/** Result of `files.upload`. */
|
|
511
|
+
interface UploadedFile {
|
|
512
|
+
/** Stable served path (e.g. /uploads/<workspace>/<file>) usable as a media input URL. */
|
|
513
|
+
url: string;
|
|
514
|
+
filename: string;
|
|
515
|
+
size: number;
|
|
516
|
+
contentType: string;
|
|
517
|
+
}
|
|
518
|
+
/** Options for `files.upload`. */
|
|
519
|
+
interface FileUploadOptions {
|
|
520
|
+
/** Override the stored display name (extension is kept from the file). */
|
|
521
|
+
filename?: string;
|
|
522
|
+
/**
|
|
523
|
+
* Coarse progress callback. Fetch does not expose upload byte progress, so this
|
|
524
|
+
* reports 0 at start and 100 on completion.
|
|
525
|
+
*/
|
|
526
|
+
onProgress?: (percent: number) => void;
|
|
527
|
+
}
|
|
362
528
|
|
|
363
529
|
declare function isTerminalTaskStatus(status: string): boolean;
|
|
364
530
|
/**
|
|
@@ -377,15 +543,24 @@ declare class TaskHandle {
|
|
|
377
543
|
get(signal?: AbortSignal): Promise<Task>;
|
|
378
544
|
/** Alias of `get()` — perform one poll and return the latest snapshot. */
|
|
379
545
|
poll(signal?: AbortSignal): Promise<Task>;
|
|
380
|
-
/**
|
|
381
|
-
* Poll until the task reaches a terminal status.
|
|
382
|
-
*
|
|
383
|
-
* - Uses exponential-ish backoff from `intervalMs` up to `maxIntervalMs`.
|
|
384
|
-
* - Throws a QLError with code "timeout" if `timeoutMs` elapses first.
|
|
385
|
-
* - Throws a QLError with code "aborted" if `signal` aborts.
|
|
386
|
-
*/
|
|
546
|
+
/** Poll until the task reaches a terminal status (see pollUntilTerminal for semantics). */
|
|
387
547
|
wait(opts?: WaitOptions): Promise<Task>;
|
|
388
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* A handle to a video job created via `videos.generate`.
|
|
551
|
+
* Polls the video-tasks endpoint until the job reaches a terminal status.
|
|
552
|
+
*/
|
|
553
|
+
declare class VideoTaskHandle {
|
|
554
|
+
private readonly transport;
|
|
555
|
+
readonly taskId: string;
|
|
556
|
+
constructor(transport: Transport, taskId: string);
|
|
557
|
+
/** Fetch the current job snapshot (single request). */
|
|
558
|
+
get(signal?: AbortSignal): Promise<VideoTask>;
|
|
559
|
+
/** Alias of `get()` — perform one poll and return the latest snapshot. */
|
|
560
|
+
poll(signal?: AbortSignal): Promise<VideoTask>;
|
|
561
|
+
/** Poll until the job reaches a terminal status (completed/failed/cancelled). */
|
|
562
|
+
wait(opts?: VideoWaitOptions): Promise<VideoTask>;
|
|
563
|
+
}
|
|
389
564
|
|
|
390
565
|
declare const DEFAULT_BASE_URL = "https://app.quantonlabs.com";
|
|
391
566
|
interface QLClientOptions {
|
|
@@ -458,6 +633,37 @@ declare class ImagesApi {
|
|
|
458
633
|
/** POST /api/v1/agents/:agentId/images — generate image(s) via a tiered model. */
|
|
459
634
|
generate(agentId: string, input: ImageGenerateInput): Promise<ImageGenerateResult>;
|
|
460
635
|
}
|
|
636
|
+
/** Videos namespace (tiered video generation: submit → poll). */
|
|
637
|
+
declare class VideosApi {
|
|
638
|
+
private readonly t;
|
|
639
|
+
constructor(t: Transport);
|
|
640
|
+
/** GET /api/v1/videos/models — list tiered video models + engine availability. */
|
|
641
|
+
listModels(): Promise<VideoModelsResult>;
|
|
642
|
+
/** POST /api/v1/agents/:agentId/videos — start a video job (returns the queued task, HTTP 202). */
|
|
643
|
+
generate(agentId: string, input: VideoGenerateInput): Promise<VideoTaskCreated>;
|
|
644
|
+
/** GET /api/v1/video-tasks/:taskId — fetch the current job snapshot. */
|
|
645
|
+
getTask(taskId: string, signal?: AbortSignal): Promise<VideoTask>;
|
|
646
|
+
/** DELETE /api/v1/video-tasks/:taskId — cancel a queued/rendering job (409 if already terminal). */
|
|
647
|
+
cancelTask(taskId: string): Promise<VideoTask>;
|
|
648
|
+
/** Get a handle for polling / waiting on a video job (poll(), wait()). */
|
|
649
|
+
handle(taskId: string): VideoTaskHandle;
|
|
650
|
+
}
|
|
651
|
+
/** Audio namespace (text-to-speech). */
|
|
652
|
+
declare class AudioApi {
|
|
653
|
+
private readonly t;
|
|
654
|
+
constructor(t: Transport);
|
|
655
|
+
/** GET /api/v1/audio/voices — list available TTS voices. */
|
|
656
|
+
voices(): Promise<VoicesResult>;
|
|
657
|
+
/** POST /api/v1/agents/:agentId/tts — synthesize speech (synchronous). */
|
|
658
|
+
textToSpeech(agentId: string, input: TtsInput): Promise<TtsResult>;
|
|
659
|
+
}
|
|
660
|
+
/** Files namespace (media uploads). */
|
|
661
|
+
declare class FilesApi {
|
|
662
|
+
private readonly t;
|
|
663
|
+
constructor(t: Transport);
|
|
664
|
+
/** POST /api/v1/files — upload a media file (multipart field "file"). */
|
|
665
|
+
upload(file: Blob, opts?: FileUploadOptions): Promise<UploadedFile>;
|
|
666
|
+
}
|
|
461
667
|
/**
|
|
462
668
|
* The public client. Example:
|
|
463
669
|
* const ql = new QLClient({ apiKey: process.env.QL_API_KEY });
|
|
@@ -469,6 +675,9 @@ declare class QLClient {
|
|
|
469
675
|
readonly workflows: WorkflowsApi;
|
|
470
676
|
readonly tasks: TasksApi;
|
|
471
677
|
readonly images: ImagesApi;
|
|
678
|
+
readonly videos: VideosApi;
|
|
679
|
+
readonly audio: AudioApi;
|
|
680
|
+
readonly files: FilesApi;
|
|
472
681
|
private readonly transport;
|
|
473
682
|
private readonly base;
|
|
474
683
|
constructor(opts: QLClientOptions);
|
|
@@ -512,4 +721,4 @@ declare class QLError extends Error {
|
|
|
512
721
|
get isNetworkError(): boolean;
|
|
513
722
|
}
|
|
514
723
|
|
|
515
|
-
export { API_ERROR_CODES, type AgentDetail, type AgentListResult, type AgentSummary, AgentsApi, type ApiErrorCode, type CapParamKind, type CapabilitiesResult, type CapabilityInfo, type CapabilityParam, type CapabilityResult, type CapabilityTemplate, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamEvent, DEFAULT_BASE_URL, type GeneratedImage, type HistoryPage, type HistoryParams, type ImageGenerateInput, type ImageGenerateResult, type ImageModelInfo, type ImageModelsResult, type ImagePricingEntry, type ImageReferenceInput, type ImageTier, type ImageUsage, ImagesApi, type MessageItem, QLClient, type QLClientOptions, QLError, type QLErrorContext, type RunCapabilityInput, type RunCapabilityResult, type StreamOptions, type Task, type TaskCreateInput, type TaskCreated, TaskHandle, type TaskPriority, type TaskStatus, TasksApi, type WaitOptions, type WorkflowRun, type WorkflowRunInput, type WorkflowRunStart, type WorkflowRunStatus, WorkflowsApi, type Workspace, WorkspaceApi, isTerminalTaskStatus };
|
|
724
|
+
export { API_ERROR_CODES, type AgentDetail, type AgentListResult, type AgentSummary, AgentsApi, type ApiErrorCode, AudioApi, type CapParamKind, type CapabilitiesResult, type CapabilityInfo, type CapabilityParam, type CapabilityResult, type CapabilityTemplate, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamEvent, DEFAULT_BASE_URL, type FileUploadOptions, FilesApi, type GeneratedImage, type HistoryPage, type HistoryParams, type ImageGenerateInput, type ImageGenerateResult, type ImageModelInfo, type ImageModelsResult, type ImagePricingEntry, type ImageReferenceInput, type ImageTier, type ImageUsage, ImagesApi, type MessageItem, QLClient, type QLClientOptions, QLError, type QLErrorContext, type RunCapabilityInput, type RunCapabilityResult, type StreamOptions, type Task, type TaskCreateInput, type TaskCreated, TaskHandle, type TaskPriority, type TaskStatus, TasksApi, type TtsInput, type TtsResult, type UploadedFile, type VideoGenerateInput, type VideoModelInfo, type VideoModelsResult, type VideoPricingEntry, type VideoTask, type VideoTaskCreated, VideoTaskHandle, type VideoTaskStatus, type VideoTier, type VideoWaitOptions, VideosApi, type VoiceInfo, type VoicesResult, type WaitOptions, type WorkflowRun, type WorkflowRunInput, type WorkflowRunStart, type WorkflowRunStatus, WorkflowsApi, type Workspace, WorkspaceApi, isTerminalTaskStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ interface JsonRequestOptions {
|
|
|
4
4
|
signal?: AbortSignal;
|
|
5
5
|
headers?: Record<string, string>;
|
|
6
6
|
}
|
|
7
|
+
interface FormRequestOptions {
|
|
8
|
+
form: FormData;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* Internal transport used by the API namespaces. Keeps the API key inside a
|
|
9
14
|
* closure (never exposed) and normalizes responses/errors for the caller.
|
|
@@ -11,6 +16,8 @@ interface JsonRequestOptions {
|
|
|
11
16
|
interface Transport {
|
|
12
17
|
/** Perform a JSON request and return the unwrapped `data` payload. */
|
|
13
18
|
json<T>(method: string, path: string, opts?: JsonRequestOptions): Promise<T>;
|
|
19
|
+
/** Perform a multipart/form-data request and return the unwrapped `data` payload. */
|
|
20
|
+
form<T>(path: string, opts: FormRequestOptions): Promise<T>;
|
|
14
21
|
/**
|
|
15
22
|
* Perform a request expected to stream SSE. Returns the response body stream
|
|
16
23
|
* after verifying a 2xx + text/event-stream; throws QLError otherwise.
|
|
@@ -359,6 +366,165 @@ interface ImageGenerateResult {
|
|
|
359
366
|
tier: string;
|
|
360
367
|
latencyMs: number;
|
|
361
368
|
}
|
|
369
|
+
type VideoTier = "standard" | "professional" | "advanced";
|
|
370
|
+
/** A single pricing entry for a video model. */
|
|
371
|
+
interface VideoPricingEntry {
|
|
372
|
+
/** What is billed, e.g. "output_video" / "voiceover". */
|
|
373
|
+
billable: string;
|
|
374
|
+
/** Billing unit: per rendered second, or flat per request. */
|
|
375
|
+
unit: "second" | "request";
|
|
376
|
+
costUsd: number;
|
|
377
|
+
}
|
|
378
|
+
/** A tiered video-generation model as returned by `videos.listModels`. */
|
|
379
|
+
interface VideoModelInfo {
|
|
380
|
+
id: string;
|
|
381
|
+
name: string;
|
|
382
|
+
tier: VideoTier;
|
|
383
|
+
description: string;
|
|
384
|
+
/** Short best-use-case label for UI copy. */
|
|
385
|
+
bestFor: string;
|
|
386
|
+
/** Execution engine (e.g. "motion-graphics"). */
|
|
387
|
+
engine: string;
|
|
388
|
+
supportsProductImages: boolean;
|
|
389
|
+
maxReferenceImages: number;
|
|
390
|
+
supportsReferenceVideos: boolean;
|
|
391
|
+
maxReferenceVideos: number;
|
|
392
|
+
supportedAspectRatios: string[];
|
|
393
|
+
supportedResolutions: string[];
|
|
394
|
+
/** Inclusive [min, max] duration in seconds. */
|
|
395
|
+
durationRange: [number, number];
|
|
396
|
+
voiceoverSupport: boolean;
|
|
397
|
+
pricing: {
|
|
398
|
+
summary: string;
|
|
399
|
+
entries: VideoPricingEntry[];
|
|
400
|
+
};
|
|
401
|
+
recommended: boolean;
|
|
402
|
+
enabled: boolean;
|
|
403
|
+
/** Runtime engine availability (render toolchain present). */
|
|
404
|
+
available: boolean;
|
|
405
|
+
}
|
|
406
|
+
/** Result of `videos.listModels`. */
|
|
407
|
+
interface VideoModelsResult {
|
|
408
|
+
models: VideoModelInfo[];
|
|
409
|
+
engine: {
|
|
410
|
+
available: boolean;
|
|
411
|
+
detail: string;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/** Input for `videos.generate`. */
|
|
415
|
+
interface VideoGenerateInput {
|
|
416
|
+
/** The creative brief / script for the video. */
|
|
417
|
+
prompt: string;
|
|
418
|
+
/** Explicit registry model id (wins over `tier`). */
|
|
419
|
+
model?: string;
|
|
420
|
+
/** Tier to resolve a model from (used when `model` is omitted). */
|
|
421
|
+
tier?: VideoTier | string;
|
|
422
|
+
/** Product/reference images — base64 data URLs or https URLs. Order defines IMG_0..N. */
|
|
423
|
+
images_list?: string[];
|
|
424
|
+
/** Reference (style) videos — https URLs only (upload local files via `files.upload`). */
|
|
425
|
+
video_files?: string[];
|
|
426
|
+
/** e.g. "16:9", "9:16", "1:1". Default "16:9". */
|
|
427
|
+
aspect_ratio?: string;
|
|
428
|
+
/** Duration in seconds (must be within the model's durationRange). */
|
|
429
|
+
duration?: number;
|
|
430
|
+
/** e.g. "720p" | "1080p". Default "720p". */
|
|
431
|
+
resolution?: string;
|
|
432
|
+
/** Bake an ElevenLabs voiceover into the render (requires `narration`). */
|
|
433
|
+
generate_audio?: boolean;
|
|
434
|
+
/** Voiceover text (used when `generate_audio` is true). Max 3000 chars. */
|
|
435
|
+
narration?: string;
|
|
436
|
+
}
|
|
437
|
+
/** Returned when a video job is created (HTTP 202). */
|
|
438
|
+
interface VideoTaskCreated {
|
|
439
|
+
taskId: string;
|
|
440
|
+
status: "queued";
|
|
441
|
+
}
|
|
442
|
+
type VideoTaskStatus = "queued" | "rendering" | "completed" | "failed" | "cancelled" | (string & {});
|
|
443
|
+
/** A video job snapshot, as returned by `videos.getTask`. */
|
|
444
|
+
interface VideoTask {
|
|
445
|
+
taskId: string;
|
|
446
|
+
status: VideoTaskStatus;
|
|
447
|
+
progress?: {
|
|
448
|
+
current: number;
|
|
449
|
+
total: number;
|
|
450
|
+
message?: string;
|
|
451
|
+
};
|
|
452
|
+
/** Served media path (e.g. /generated/video-….mp4) once completed. */
|
|
453
|
+
outputUrl?: string;
|
|
454
|
+
mime?: string;
|
|
455
|
+
ext?: string;
|
|
456
|
+
/** Actual rendered duration in seconds. */
|
|
457
|
+
durationSec?: number;
|
|
458
|
+
error?: string;
|
|
459
|
+
model?: string;
|
|
460
|
+
tier?: string;
|
|
461
|
+
latencyMs?: number;
|
|
462
|
+
createdAt: string | Date;
|
|
463
|
+
completedAt: string | Date | null;
|
|
464
|
+
}
|
|
465
|
+
/** Options for polling / waiting on a video job. */
|
|
466
|
+
interface VideoWaitOptions {
|
|
467
|
+
/** Base delay between polls in ms (default 2000). Grows with backoff up to `maxIntervalMs`. */
|
|
468
|
+
intervalMs?: number;
|
|
469
|
+
/** Upper bound for the backoff delay in ms (default 15000). */
|
|
470
|
+
maxIntervalMs?: number;
|
|
471
|
+
/** Stop waiting after this many ms and throw a timeout error. Omit to wait until terminal or abort. */
|
|
472
|
+
timeoutMs?: number;
|
|
473
|
+
/** Abort polling at any time. */
|
|
474
|
+
signal?: AbortSignal;
|
|
475
|
+
/** Called after each poll with the latest job snapshot. */
|
|
476
|
+
onTick?: (task: VideoTask) => void;
|
|
477
|
+
}
|
|
478
|
+
/** Input for `audio.textToSpeech`. */
|
|
479
|
+
interface TtsInput {
|
|
480
|
+
/** Text to synthesize (max 3000 chars). */
|
|
481
|
+
text: string;
|
|
482
|
+
/** ElevenLabs voice id (list via `audio.voices`). Defaults to the platform voice. */
|
|
483
|
+
voiceId?: string;
|
|
484
|
+
/** Voice stability 0..1 (default 0.5). */
|
|
485
|
+
stability?: number;
|
|
486
|
+
/** Similarity boost 0..1 (default 0.75). */
|
|
487
|
+
similarityBoost?: number;
|
|
488
|
+
}
|
|
489
|
+
/** Result of `audio.textToSpeech`. */
|
|
490
|
+
interface TtsResult {
|
|
491
|
+
/** Served audio path (e.g. /generated/tts-….mp3). */
|
|
492
|
+
url: string;
|
|
493
|
+
voiceId: string;
|
|
494
|
+
modelId: string;
|
|
495
|
+
bytes: number;
|
|
496
|
+
latencyMs: number;
|
|
497
|
+
}
|
|
498
|
+
/** A single ElevenLabs voice as returned by `audio.voices`. */
|
|
499
|
+
interface VoiceInfo {
|
|
500
|
+
id: string;
|
|
501
|
+
name: string;
|
|
502
|
+
}
|
|
503
|
+
/** Result of `audio.voices`. */
|
|
504
|
+
interface VoicesResult {
|
|
505
|
+
voices: VoiceInfo[];
|
|
506
|
+
/** "live" = fetched from the provider; "none" = no provider key configured. */
|
|
507
|
+
source: "live" | "none";
|
|
508
|
+
note?: string;
|
|
509
|
+
}
|
|
510
|
+
/** Result of `files.upload`. */
|
|
511
|
+
interface UploadedFile {
|
|
512
|
+
/** Stable served path (e.g. /uploads/<workspace>/<file>) usable as a media input URL. */
|
|
513
|
+
url: string;
|
|
514
|
+
filename: string;
|
|
515
|
+
size: number;
|
|
516
|
+
contentType: string;
|
|
517
|
+
}
|
|
518
|
+
/** Options for `files.upload`. */
|
|
519
|
+
interface FileUploadOptions {
|
|
520
|
+
/** Override the stored display name (extension is kept from the file). */
|
|
521
|
+
filename?: string;
|
|
522
|
+
/**
|
|
523
|
+
* Coarse progress callback. Fetch does not expose upload byte progress, so this
|
|
524
|
+
* reports 0 at start and 100 on completion.
|
|
525
|
+
*/
|
|
526
|
+
onProgress?: (percent: number) => void;
|
|
527
|
+
}
|
|
362
528
|
|
|
363
529
|
declare function isTerminalTaskStatus(status: string): boolean;
|
|
364
530
|
/**
|
|
@@ -377,15 +543,24 @@ declare class TaskHandle {
|
|
|
377
543
|
get(signal?: AbortSignal): Promise<Task>;
|
|
378
544
|
/** Alias of `get()` — perform one poll and return the latest snapshot. */
|
|
379
545
|
poll(signal?: AbortSignal): Promise<Task>;
|
|
380
|
-
/**
|
|
381
|
-
* Poll until the task reaches a terminal status.
|
|
382
|
-
*
|
|
383
|
-
* - Uses exponential-ish backoff from `intervalMs` up to `maxIntervalMs`.
|
|
384
|
-
* - Throws a QLError with code "timeout" if `timeoutMs` elapses first.
|
|
385
|
-
* - Throws a QLError with code "aborted" if `signal` aborts.
|
|
386
|
-
*/
|
|
546
|
+
/** Poll until the task reaches a terminal status (see pollUntilTerminal for semantics). */
|
|
387
547
|
wait(opts?: WaitOptions): Promise<Task>;
|
|
388
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* A handle to a video job created via `videos.generate`.
|
|
551
|
+
* Polls the video-tasks endpoint until the job reaches a terminal status.
|
|
552
|
+
*/
|
|
553
|
+
declare class VideoTaskHandle {
|
|
554
|
+
private readonly transport;
|
|
555
|
+
readonly taskId: string;
|
|
556
|
+
constructor(transport: Transport, taskId: string);
|
|
557
|
+
/** Fetch the current job snapshot (single request). */
|
|
558
|
+
get(signal?: AbortSignal): Promise<VideoTask>;
|
|
559
|
+
/** Alias of `get()` — perform one poll and return the latest snapshot. */
|
|
560
|
+
poll(signal?: AbortSignal): Promise<VideoTask>;
|
|
561
|
+
/** Poll until the job reaches a terminal status (completed/failed/cancelled). */
|
|
562
|
+
wait(opts?: VideoWaitOptions): Promise<VideoTask>;
|
|
563
|
+
}
|
|
389
564
|
|
|
390
565
|
declare const DEFAULT_BASE_URL = "https://app.quantonlabs.com";
|
|
391
566
|
interface QLClientOptions {
|
|
@@ -458,6 +633,37 @@ declare class ImagesApi {
|
|
|
458
633
|
/** POST /api/v1/agents/:agentId/images — generate image(s) via a tiered model. */
|
|
459
634
|
generate(agentId: string, input: ImageGenerateInput): Promise<ImageGenerateResult>;
|
|
460
635
|
}
|
|
636
|
+
/** Videos namespace (tiered video generation: submit → poll). */
|
|
637
|
+
declare class VideosApi {
|
|
638
|
+
private readonly t;
|
|
639
|
+
constructor(t: Transport);
|
|
640
|
+
/** GET /api/v1/videos/models — list tiered video models + engine availability. */
|
|
641
|
+
listModels(): Promise<VideoModelsResult>;
|
|
642
|
+
/** POST /api/v1/agents/:agentId/videos — start a video job (returns the queued task, HTTP 202). */
|
|
643
|
+
generate(agentId: string, input: VideoGenerateInput): Promise<VideoTaskCreated>;
|
|
644
|
+
/** GET /api/v1/video-tasks/:taskId — fetch the current job snapshot. */
|
|
645
|
+
getTask(taskId: string, signal?: AbortSignal): Promise<VideoTask>;
|
|
646
|
+
/** DELETE /api/v1/video-tasks/:taskId — cancel a queued/rendering job (409 if already terminal). */
|
|
647
|
+
cancelTask(taskId: string): Promise<VideoTask>;
|
|
648
|
+
/** Get a handle for polling / waiting on a video job (poll(), wait()). */
|
|
649
|
+
handle(taskId: string): VideoTaskHandle;
|
|
650
|
+
}
|
|
651
|
+
/** Audio namespace (text-to-speech). */
|
|
652
|
+
declare class AudioApi {
|
|
653
|
+
private readonly t;
|
|
654
|
+
constructor(t: Transport);
|
|
655
|
+
/** GET /api/v1/audio/voices — list available TTS voices. */
|
|
656
|
+
voices(): Promise<VoicesResult>;
|
|
657
|
+
/** POST /api/v1/agents/:agentId/tts — synthesize speech (synchronous). */
|
|
658
|
+
textToSpeech(agentId: string, input: TtsInput): Promise<TtsResult>;
|
|
659
|
+
}
|
|
660
|
+
/** Files namespace (media uploads). */
|
|
661
|
+
declare class FilesApi {
|
|
662
|
+
private readonly t;
|
|
663
|
+
constructor(t: Transport);
|
|
664
|
+
/** POST /api/v1/files — upload a media file (multipart field "file"). */
|
|
665
|
+
upload(file: Blob, opts?: FileUploadOptions): Promise<UploadedFile>;
|
|
666
|
+
}
|
|
461
667
|
/**
|
|
462
668
|
* The public client. Example:
|
|
463
669
|
* const ql = new QLClient({ apiKey: process.env.QL_API_KEY });
|
|
@@ -469,6 +675,9 @@ declare class QLClient {
|
|
|
469
675
|
readonly workflows: WorkflowsApi;
|
|
470
676
|
readonly tasks: TasksApi;
|
|
471
677
|
readonly images: ImagesApi;
|
|
678
|
+
readonly videos: VideosApi;
|
|
679
|
+
readonly audio: AudioApi;
|
|
680
|
+
readonly files: FilesApi;
|
|
472
681
|
private readonly transport;
|
|
473
682
|
private readonly base;
|
|
474
683
|
constructor(opts: QLClientOptions);
|
|
@@ -512,4 +721,4 @@ declare class QLError extends Error {
|
|
|
512
721
|
get isNetworkError(): boolean;
|
|
513
722
|
}
|
|
514
723
|
|
|
515
|
-
export { API_ERROR_CODES, type AgentDetail, type AgentListResult, type AgentSummary, AgentsApi, type ApiErrorCode, type CapParamKind, type CapabilitiesResult, type CapabilityInfo, type CapabilityParam, type CapabilityResult, type CapabilityTemplate, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamEvent, DEFAULT_BASE_URL, type GeneratedImage, type HistoryPage, type HistoryParams, type ImageGenerateInput, type ImageGenerateResult, type ImageModelInfo, type ImageModelsResult, type ImagePricingEntry, type ImageReferenceInput, type ImageTier, type ImageUsage, ImagesApi, type MessageItem, QLClient, type QLClientOptions, QLError, type QLErrorContext, type RunCapabilityInput, type RunCapabilityResult, type StreamOptions, type Task, type TaskCreateInput, type TaskCreated, TaskHandle, type TaskPriority, type TaskStatus, TasksApi, type WaitOptions, type WorkflowRun, type WorkflowRunInput, type WorkflowRunStart, type WorkflowRunStatus, WorkflowsApi, type Workspace, WorkspaceApi, isTerminalTaskStatus };
|
|
724
|
+
export { API_ERROR_CODES, type AgentDetail, type AgentListResult, type AgentSummary, AgentsApi, type ApiErrorCode, AudioApi, type CapParamKind, type CapabilitiesResult, type CapabilityInfo, type CapabilityParam, type CapabilityResult, type CapabilityTemplate, type ChatInput, type ChatMessage, type ChatResult, type ChatStreamEvent, DEFAULT_BASE_URL, type FileUploadOptions, FilesApi, type GeneratedImage, type HistoryPage, type HistoryParams, type ImageGenerateInput, type ImageGenerateResult, type ImageModelInfo, type ImageModelsResult, type ImagePricingEntry, type ImageReferenceInput, type ImageTier, type ImageUsage, ImagesApi, type MessageItem, QLClient, type QLClientOptions, QLError, type QLErrorContext, type RunCapabilityInput, type RunCapabilityResult, type StreamOptions, type Task, type TaskCreateInput, type TaskCreated, TaskHandle, type TaskPriority, type TaskStatus, TasksApi, type TtsInput, type TtsResult, type UploadedFile, type VideoGenerateInput, type VideoModelInfo, type VideoModelsResult, type VideoPricingEntry, type VideoTask, type VideoTaskCreated, VideoTaskHandle, type VideoTaskStatus, type VideoTier, type VideoWaitOptions, VideosApi, type VoiceInfo, type VoicesResult, type WaitOptions, type WorkflowRun, type WorkflowRunInput, type WorkflowRunStart, type WorkflowRunStatus, WorkflowsApi, type Workspace, WorkspaceApi, isTerminalTaskStatus };
|