diffio 0.4.62 → 1.0.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.
Files changed (60) hide show
  1. package/README.md +208 -296
  2. package/dist/Client.d.ts +85 -148
  3. package/dist/Client.js +73 -798
  4. package/dist/api/resources/account.d.ts +38 -0
  5. package/dist/api/resources/account.js +96 -0
  6. package/dist/api/resources/editing.d.ts +54 -0
  7. package/dist/api/resources/editing.js +168 -0
  8. package/dist/api/resources/generations.d.ts +52 -0
  9. package/dist/api/resources/generations.js +145 -0
  10. package/dist/api/resources/index.d.ts +5 -7
  11. package/dist/api/resources/index.js +18 -15
  12. package/dist/api/resources/models.d.ts +9 -0
  13. package/dist/api/resources/models.js +23 -0
  14. package/dist/api/resources/projects.d.ts +51 -0
  15. package/dist/api/resources/projects.js +128 -0
  16. package/dist/api/types.d.ts +423 -222
  17. package/dist/api/types.js +2 -0
  18. package/dist/core/edgeUpload.d.ts +39 -39
  19. package/dist/core/edgeUpload.js +170 -125
  20. package/dist/core/files.d.ts +15 -0
  21. package/dist/core/files.js +121 -0
  22. package/dist/core/node.d.ts +7 -0
  23. package/dist/core/node.js +17 -0
  24. package/dist/core/pagination.d.ts +33 -0
  25. package/dist/core/pagination.js +64 -0
  26. package/dist/core/poll.d.ts +23 -0
  27. package/dist/core/poll.js +30 -0
  28. package/dist/core/retry.d.ts +8 -7
  29. package/dist/core/retry.js +39 -25
  30. package/dist/core/transport.d.ts +75 -0
  31. package/dist/core/transport.js +220 -0
  32. package/dist/core/url.d.ts +10 -0
  33. package/dist/core/url.js +38 -0
  34. package/dist/core/webhookSignature.d.ts +20 -0
  35. package/dist/core/webhookSignature.js +147 -0
  36. package/dist/errors/index.d.ts +60 -18
  37. package/dist/errors/index.js +61 -13
  38. package/dist/index.d.ts +8 -1
  39. package/dist/index.js +9 -1
  40. package/dist/version.d.ts +1 -1
  41. package/dist/version.js +1 -1
  42. package/package.json +2 -7
  43. package/dist/BaseClient.d.ts +0 -26
  44. package/dist/BaseClient.js +0 -17
  45. package/dist/api/resources/account/client/Client.d.ts +0 -15
  46. package/dist/api/resources/account/client/Client.js +0 -15
  47. package/dist/api/resources/apiKeys/client/Client.d.ts +0 -27
  48. package/dist/api/resources/apiKeys/client/Client.js +0 -21
  49. package/dist/api/resources/audioIsolation/client/Client.d.ts +0 -43
  50. package/dist/api/resources/audioIsolation/client/Client.js +0 -33
  51. package/dist/api/resources/generations/client/Client.d.ts +0 -48
  52. package/dist/api/resources/generations/client/Client.js +0 -36
  53. package/dist/api/resources/projects/client/Client.d.ts +0 -21
  54. package/dist/api/resources/projects/client/Client.js +0 -19
  55. package/dist/api/resources/usage/client/Client.d.ts +0 -11
  56. package/dist/api/resources/usage/client/Client.js +0 -12
  57. package/dist/api/resources/webhooks/client/Client.d.ts +0 -29
  58. package/dist/api/resources/webhooks/client/Client.js +0 -76
  59. package/dist/api/serialization.d.ts +0 -21
  60. package/dist/api/serialization.js +0 -274
@@ -1,230 +1,431 @@
1
- /** Current models for new generations (api/model_registry.json in diffio-ui); each has its own endpoint. */
2
- export type ModelKey = "diffio-4.7-flash" | "diffio-4.7-pro";
3
- /**
4
- * Older model names the SDK still accepts. Each runs the matching Diffio 4.7 model on its endpoint:
5
- * the `-flash` names run `diffio-4.7-flash` and the `-pro` names run `diffio-4.7-pro`.
6
- *
7
- * @deprecated Use `diffio-4.7-flash` or `diffio-4.7-pro`.
8
- */
9
- export type DeprecatedModelKey = "diffio-4.6-flash" | "diffio-4.6-pro" | "diffio-4.5-flash" | "diffio-4.5-pro";
10
- /** Every value the `model` option accepts: a current {@link ModelKey} or a deprecated alias of one. */
11
- export type AcceptedModelKey = ModelKey | DeprecatedModelKey;
12
- export type DownloadType = "audio" | "video" | "transcript";
13
- export type WebhookMode = "test" | "live";
14
- export type WebhookEventType = "generation.queued" | "generation.processing" | "generation.failed" | "generation.completed";
15
- export type GenerationWebhookStatus = "queued" | "processing" | "error" | "complete";
16
- export type TranscriptionStatus = "pending" | "available" | "unavailable";
17
- export interface GenerationTranscription {
18
- status: TranscriptionStatus;
19
- }
20
- /** Warning codes the SDK knows; warnings with other codes are left out of parsed responses. */
21
- export type GenerationWarningCode = "unsupported_language";
22
- /** Something about a generation's recording to know about; the generation still runs. */
23
- export interface GenerationWarning {
24
- /** `unsupported_language`: the transcript has speech in a language Diffio does not support yet. */
25
- code: GenerationWarningCode;
26
- /** ISO 639-1 base codes such as `ja`, the language with the most words first. */
27
- languages: string[];
28
- /** A readable explanation, for example that the result probably won't be usable. */
1
+ export type { ListResponse } from "../core/pagination";
2
+ /** Shape of a v2 error body. The SDK throws it as DiffioApiError. */
3
+ export interface ErrorBody {
4
+ error: {
5
+ code: string;
6
+ message: string;
7
+ request_id: string | null;
8
+ details?: Record<string, unknown>;
9
+ };
10
+ }
11
+ /** The `error` of a failed project, export or assistant turn. */
12
+ export interface ResourceError {
13
+ code: string;
29
14
  message: string;
30
15
  }
31
- /** The edge upload session create_project opened; the upload token stays inside the SDK. */
32
- export interface ProjectUploadSession {
33
- uploadSessionId: string;
34
- edgeBaseUrl: string;
35
- objectKey: string;
36
- partSizeBytes: number;
37
- maxBytes: number;
38
- expiresAt: string;
39
- }
40
- /** Response of `/v1/complete_project_upload`; repeated calls return the same answer. */
41
- export interface CompleteProjectUploadResponse {
42
- apiProjectId: string;
43
- status: "uploaded" | string;
44
- sizeBytes: number | null;
45
- }
46
- /** A created project whose media `createProject` already uploaded through the edge and confirmed. */
47
- export interface CreateProjectResponse {
48
- apiProjectId: string;
49
- upload: ProjectUploadSession;
50
- objectPath: string;
51
- expiresAt: string;
52
- uploadCompletion: CompleteProjectUploadResponse;
53
- }
54
- export interface ProjectSummary {
55
- apiProjectId: string;
56
- status: string;
57
- originalFileName?: string | null;
58
- contentType?: string | null;
59
- hasVideo: boolean;
60
- generationCount: number;
61
- createdAt?: string | null;
62
- updatedAt?: string | null;
63
- }
64
- export interface ListProjectsResponse {
65
- projects: ProjectSummary[];
66
- }
67
- export interface CreateGenerationResponse {
68
- generationId: string;
69
- apiProjectId: string;
70
- /** A string because generations created before a model was retired keep their original key. */
71
- modelKey: string;
72
- status: string;
73
- idempotentReplay?: boolean;
74
- }
75
- export interface ProjectGenerationSummary {
76
- generationId: string;
77
- status: string;
78
- /** Older generations keep the key of the model that produced them. */
79
- modelKey?: string | null;
80
- progress?: number | null;
81
- createdAt?: string | null;
82
- updatedAt?: string | null;
83
- }
84
- export interface ListProjectGenerationsResponse {
85
- apiProjectId: string;
86
- generations: ProjectGenerationSummary[];
87
- }
88
- export interface GenerationProgressStage {
89
- jobId?: string | null;
90
- jobState?: string | null;
91
- status: string;
92
- progress: number;
93
- statusMessage?: string | null;
94
- error?: string | null;
95
- errorDetails?: string | null;
96
- }
97
- /** The one stage a generation is in, as `get_generation_progress` reports it. */
98
- export type GenerationStage = "pending" | "preparing" | "transcribing" | "queued" | "starting" | "downloading" | "decoding" | "restoring" | "finalizing" | "uploading" | "complete" | "failed";
99
- /** Progress within the current fleet stage; every field is optional and present only when known. */
16
+ /** The `error` of a failed generation. */
17
+ export interface GenerationError extends ResourceError {
18
+ retryable: boolean;
19
+ explanation: string | null;
20
+ }
21
+ export type ModelStatus = "hosted" | "alias" | "retired";
22
+ /** Hosted names and the tier aliases that always mean the current model of a tier. Any string is accepted. */
23
+ export type ModelName = "diffio-flash" | "diffio-pro" | "diffio-4.7-flash" | "diffio-4.7-pro" | (string & {});
24
+ export interface Model {
25
+ id: string;
26
+ object: "model";
27
+ status: ModelStatus;
28
+ label: string | null;
29
+ served_by: string;
30
+ price_per_hour_usd: number;
31
+ }
32
+ export type ProjectStatus = "awaiting_upload" | "preparing" | "ready" | "failed";
33
+ /** `generation` on `POST /projects`: request the first restore now; it starts once the upload is ready. */
34
+ export interface ProjectGenerationCreate {
35
+ model: ModelName;
36
+ label?: string;
37
+ sampling?: Record<string, unknown>;
38
+ }
39
+ export interface ProjectCreateParams {
40
+ /** File name with a media extension (`.mp3`, `.wav`, `.mp4`, ...). */
41
+ file_name: string;
42
+ content_type?: string;
43
+ size_bytes?: number;
44
+ /** Up to 50 string values; keys up to 40 characters, values up to 500. */
45
+ metadata?: Record<string, string>;
46
+ generation?: ProjectGenerationCreate;
47
+ /**
48
+ * Not a body field: the SDK sends it as the `Diffio-End-User` header (same as `options.endUser`).
49
+ */
50
+ end_user?: string;
51
+ }
52
+ export interface UploadRequest {
53
+ method: "POST" | "PUT";
54
+ url: string;
55
+ headers: Record<string, string>;
56
+ body: Record<string, unknown> | null;
57
+ returns: string[];
58
+ description: string;
59
+ }
60
+ /** Where and how to send the media bytes: Diffio's media host, in parts. `projects.upload` does all of it. */
61
+ export interface ProjectUpload {
62
+ upload_session_id: string;
63
+ edge_base_url: string;
64
+ upload_token: string;
65
+ part_size_bytes: number;
66
+ max_bytes: number;
67
+ expires_at: string;
68
+ requests: {
69
+ start: UploadRequest;
70
+ part: UploadRequest;
71
+ complete: UploadRequest;
72
+ abort?: UploadRequest;
73
+ [name: string]: UploadRequest | undefined;
74
+ };
75
+ }
76
+ export interface Project {
77
+ id: string;
78
+ object: "project";
79
+ status: ProjectStatus;
80
+ file_name: string | null;
81
+ content_type: string | null;
82
+ size_bytes: number | null;
83
+ duration_seconds: number | null;
84
+ has_video: boolean;
85
+ end_user: string | null;
86
+ metadata: Record<string, string>;
87
+ generation_count: number;
88
+ video_preview_status: "preparing" | "ready" | "failed" | null;
89
+ latest_generation: Generation | null;
90
+ share_id: string | null;
91
+ created_at: string | null;
92
+ updated_at: string | null;
93
+ error: ResourceError | null;
94
+ }
95
+ /** A project as `POST /projects` and `POST /projects/{id}/upload` answer it. */
96
+ export interface ProjectWithUpload extends Project {
97
+ upload: ProjectUpload | null;
98
+ }
99
+ export interface ProjectDeleted {
100
+ id: string;
101
+ object: "project";
102
+ deleted: true;
103
+ deleted_generations: number;
104
+ deleted_media_objects: number;
105
+ }
106
+ export interface ListParams {
107
+ /** 1 to 100, default 20. */
108
+ limit?: number;
109
+ /** The previous page's `next_cursor`. */
110
+ cursor?: string;
111
+ }
112
+ export type GenerationStatus = "queued" | "processing" | "complete" | "failed";
113
+ export interface GenerationCreateParams {
114
+ model: ModelName;
115
+ label?: string;
116
+ sampling?: Record<string, unknown>;
117
+ }
100
118
  export interface GenerationStageProgress {
101
- overallPercent?: number;
102
- stagePercent?: number;
103
- bytesDone?: number;
104
- bytesTotal?: number;
105
- availableThroughSeconds?: number;
106
- durationSeconds?: number;
107
- }
108
- /** Why a queued generation waits for a Mac fleet worker. */
109
- export interface GenerationQueueStatus {
119
+ overall_percent?: number;
120
+ stage_percent?: number;
121
+ bytes_done?: number;
122
+ bytes_total?: number;
123
+ available_through_seconds?: number;
124
+ duration_seconds?: number;
125
+ [key: string]: unknown;
126
+ }
127
+ export interface GenerationQueue {
110
128
  position: number | null;
111
- connectedWorkers: number | null;
112
- idleWorkers: number | null;
113
- busyWorkers: number | null;
114
- waitReason: "all_busy" | "no_workers" | "next_in_line" | string | null;
129
+ connected_workers: number | null;
130
+ idle_workers: number | null;
131
+ busy_workers: number | null;
132
+ wait_reason: "all_busy" | "no_workers" | "next_in_line" | null;
133
+ message: string | null;
134
+ [key: string]: unknown;
135
+ }
136
+ export interface GenerationWarning {
137
+ code: string;
138
+ languages?: string[];
115
139
  message: string;
140
+ [key: string]: unknown;
141
+ }
142
+ export interface GenerationEdit {
143
+ edit_count: number | null;
144
+ max_windows: number | null;
145
+ windows: number | null;
146
+ windows_done: number | null;
147
+ retry_windows?: number | null;
148
+ ranges: Array<{
149
+ start: number;
150
+ end: number;
151
+ }>;
152
+ billable_seconds: number | null;
153
+ cut_seconds: number | null;
154
+ request_id: string | null;
155
+ language: string | null;
156
+ tighten: {
157
+ close_removed_gaps: boolean;
158
+ max_pause_seconds: number | null;
159
+ } | null;
160
+ [key: string]: unknown;
116
161
  }
117
- export interface GenerationProgressResponse {
118
- generationId: string;
119
- apiProjectId: string;
120
- status: string;
121
- hasVideo: boolean;
122
- preProcessing: GenerationProgressStage;
123
- inference: GenerationProgressStage;
124
- restoredVideo?: GenerationProgressStage | null;
125
- /** Omitted by older API versions. */
126
- stage?: GenerationStage | string;
127
- /** Present while a fleet stage reports progress. */
128
- stageProgress?: GenerationStageProgress;
129
- /** Present while the generation waits in the fleet queue. */
130
- queue?: GenerationQueueStatus;
131
- /** Independent of media completion; omitted by older API versions. */
132
- transcription?: GenerationTranscription;
133
- /** Empty until the transcript is ready, and when older API versions omit it. */
162
+ /** Names `files_available` and `GET .../media` can list. */
163
+ export type GenerationFileName = "original" | "audio" | "audio_mixed" | "video" | "hls_master" | "hls_restored" | "hls_original" | "video_hls" | "waveform_restored" | "waveform_original" | "transcript" | "edited_transcript" | "stems_manifest" | "metadata" | (string & {});
164
+ export interface Generation {
165
+ id: string;
166
+ object: "generation";
167
+ project_id: string;
168
+ status: GenerationStatus;
169
+ model: string | null;
170
+ requested_model: string | null;
171
+ substituted: boolean;
172
+ price_per_hour_usd: number | null;
173
+ stage: string | null;
174
+ stage_progress: GenerationStageProgress | null;
175
+ queue: GenerationQueue | null;
134
176
  warnings: GenerationWarning[];
135
- error?: string | null;
136
- errorDetails?: string | null;
137
- /** Present with `error`; true when a new generation for the same project can retry the failure. */
138
- retryable?: boolean;
139
- }
140
- export interface GenerationDownloadResponse {
141
- generationId: string;
142
- apiProjectId: string;
143
- downloadType: DownloadType | string;
144
- downloadUrl: string;
145
- fileName: string;
146
- storagePath: string;
147
- mimeType: string;
148
- }
149
- export interface AudioIsolationResult {
150
- project: CreateProjectResponse;
151
- generation: CreateGenerationResponse;
152
- }
153
- export interface WebhookTestEventResponse {
154
- svixMessageId: string;
155
- eventId: string;
156
- eventType: WebhookEventType | string;
157
- mode?: WebhookMode | string | null;
158
- apiKeyId?: string | null;
159
- }
160
- export interface AccountSettingsResponse {
161
- apiKeyId?: string | null;
162
- account: Record<string, unknown>;
163
- }
164
- export interface ApiKeyResponse {
165
- key?: string;
166
- keyId: string;
167
- label: string;
168
- status: string;
169
- keyPrefix: string;
170
- role: string;
171
- scopes: string[];
172
- resourceBounds: Record<string, unknown>;
173
- parentKeyId?: string | null;
174
- createdAt?: string | null;
175
- rotatedAt?: string | null;
176
- revokedAt?: string | null;
177
- permissions?: Record<string, unknown>;
178
- }
179
- export interface ApiKeysListResponse {
180
- keys: ApiKeyResponse[];
181
- }
182
- export interface UsageSummaryResponse {
183
- usage: Record<string, unknown>;
184
- billing: Record<string, unknown>;
185
- }
186
- export interface WebhookConfigureResponse {
187
- webhook: Record<string, unknown>;
188
- }
189
- export interface GenerationWebhookEvent {
190
- eventType: WebhookEventType | string;
191
- eventId: string;
192
- createdAt: string;
193
- apiKeyId: string;
194
- apiProjectId?: string | null;
195
- generationId: string;
196
- status: GenerationWebhookStatus | string;
197
- hasVideo?: boolean | null;
198
- /** Older generations keep the key of the model that produced them. */
199
- modelKey?: string | null;
200
- /** A completed generation may still have a pending or unavailable transcript. */
201
- transcription?: GenerationTranscription;
202
- /** Present only when the generation has warnings. */
203
- warnings?: GenerationWarning[];
204
- error?: string | null;
205
- errorDetails?: string | null;
206
- /** On `generation.failed`: true when a new generation for the same project can fix the failure. */
207
- retryable?: boolean;
208
- }
209
- export interface RestoreMetadata {
210
- ok: boolean;
211
- stage: string;
212
- apiProjectId: string | null;
213
- generationId: string | null;
214
- project: CreateProjectResponse | null;
215
- generation: CreateGenerationResponse | null;
216
- progress: GenerationProgressResponse | null;
217
- download: GenerationDownloadResponse | null;
218
- downloadType: DownloadType | string | null;
219
- downloadUrl: string | null;
220
- fileName: string | null;
221
- mimeType: string | null;
222
- status: string | null;
223
- error: string | null;
224
- errorDetails: string | null;
225
- exceptionType: string | null;
226
- exceptionMessage: string | null;
227
- /** HTTP error details retained when a restore helper returns instead of throwing. */
228
- statusCode?: number;
229
- responseBody?: unknown;
177
+ label: string | null;
178
+ kind: "restore" | "edit";
179
+ source_generation_id: string | null;
180
+ edit: GenerationEdit | null;
181
+ transcript_editable: boolean;
182
+ duration_seconds: number | null;
183
+ quality_score: number | null;
184
+ transcription_status: "preparing" | "ready" | "failed" | null;
185
+ files_available: GenerationFileName[];
186
+ error: GenerationError | null;
187
+ stems_status: "preparing" | "ready" | "failed" | null;
188
+ created_at: string | null;
189
+ updated_at: string | null;
190
+ }
191
+ export interface GenerationMediaParams {
192
+ /** 4 to 3600: a preview grant names only playlists and other preview-readable files. */
193
+ preview_seconds?: number;
194
+ }
195
+ export interface GenerationMedia {
196
+ object: "generation_media";
197
+ project_id: string;
198
+ generation_id: string;
199
+ status: GenerationStatus;
200
+ /** File name -> URL. URLs need no API key and stop working at `expires_at` (6 hours). */
201
+ files: Partial<Record<GenerationFileName, string>>;
202
+ base_url: string;
203
+ expires_at: string;
204
+ preview_seconds: number | null;
205
+ }
206
+ export interface TranscriptWordInput {
207
+ id?: string;
208
+ text?: string;
209
+ word?: string;
210
+ start?: number | null;
211
+ end?: number | null;
212
+ probability?: number | null;
213
+ speaker?: string;
214
+ language?: string;
215
+ changed?: boolean;
216
+ regenerate?: boolean;
217
+ [key: string]: unknown;
218
+ }
219
+ export interface TranscriptEditCreateParams {
220
+ /** The whole transcript after editing, in order; `text: ""` removes a word. */
221
+ words?: TranscriptWordInput[];
222
+ tighten?: {
223
+ close_removed_gaps?: boolean;
224
+ max_pause_seconds?: number;
225
+ };
226
+ /** Your own id, echoed as `edit.request_id` (`[A-Za-z0-9_-]{1,64}`). Not an idempotency key. */
227
+ request_id?: string;
228
+ }
229
+ export interface TranscriptEditEstimate {
230
+ object: "transcript_edit_estimate";
231
+ project_id: string;
232
+ generation_id: string;
233
+ edit_count: number | null;
234
+ max_windows: number | null;
235
+ window_seconds: number;
236
+ max_billable_seconds: number;
237
+ }
238
+ export interface GenerationMix {
239
+ object: "generation_mix";
240
+ project_id: string;
241
+ generation_id: string;
242
+ background_gain: number;
243
+ leveling: boolean;
244
+ revision: string;
245
+ stems_revision: string | null;
246
+ }
247
+ export interface GenerationMixSaveParams {
248
+ /** 0 = speech only, 1 = all of the background. */
249
+ background_gain: number;
250
+ leveling?: boolean;
251
+ /** The `revision` you read; a stale one is refused with 409 `revision_conflict`. */
252
+ revision?: string;
253
+ }
254
+ export type ExportArtifact = "speech" | "background" | "mix" | "both" | "original";
255
+ export type ExportFormat = "wav" | "mp3" | "m4a" | "mp4" | "zip";
256
+ export interface GenerationExportCreateParams {
257
+ artifact: ExportArtifact;
258
+ format: ExportFormat;
259
+ inline?: boolean;
260
+ background_gain?: number;
261
+ leveling?: boolean;
262
+ /** Download name without extension, up to 200 characters. */
263
+ file_name?: string;
264
+ }
265
+ export interface GenerationExportGetParams {
266
+ file_name?: string;
267
+ }
268
+ export interface GenerationExport {
269
+ object: "generation_export";
270
+ id: string;
271
+ project_id: string;
272
+ generation_id: string;
273
+ status: "queued" | "processing" | "ready" | "failed";
274
+ artifact: string | null;
275
+ format: string | null;
276
+ background_gain: number | null;
277
+ leveling: boolean;
278
+ inline: boolean;
279
+ url: string | null;
280
+ error: ResourceError | null;
281
+ }
282
+ export interface TranscriptWord {
283
+ id: string;
284
+ text: string;
285
+ start: number | null;
286
+ end: number | null;
287
+ probability: number | null;
288
+ speaker?: string;
289
+ language?: string;
290
+ [key: string]: unknown;
291
+ }
292
+ export interface TranscriptGetParams {
293
+ preview_seconds?: number;
294
+ }
295
+ export interface Transcript {
296
+ object: "transcript";
297
+ project_id: string;
298
+ generation_id: string;
299
+ text: string;
300
+ words: TranscriptWord[];
301
+ preview_seconds: number | null;
302
+ truncated: boolean;
303
+ }
304
+ export interface TranscriptDraft {
305
+ object: "transcript_draft";
306
+ project_id: string;
307
+ generation_id: string;
308
+ revision: string;
309
+ data: Record<string, unknown> | null;
310
+ created_at: string | null;
311
+ updated_at: string | null;
312
+ }
313
+ export interface TranscriptDraftSaveParams {
314
+ data: Record<string, unknown>;
315
+ revision?: string;
316
+ }
317
+ export interface TranscriptDraftDeleteParams {
318
+ revision?: string;
319
+ }
320
+ export interface TranscriptDraftDeleted {
321
+ object: "transcript_draft";
322
+ project_id: string;
323
+ generation_id: string;
324
+ deleted: true;
325
+ revision: string;
326
+ }
327
+ export interface TranscriptAssistantMessage {
328
+ role: "user" | "assistant";
329
+ content: string;
330
+ }
331
+ export interface TranscriptAssistantTurnCreateParams {
332
+ messages: TranscriptAssistantMessage[];
333
+ words?: TranscriptWordInput[];
334
+ selection?: {
335
+ word_ids: string[];
336
+ } | null;
337
+ playhead_seconds?: number | null;
338
+ source?: string;
339
+ }
340
+ export interface TranscriptAssistantTurn {
341
+ object: "transcript_assistant_turn";
342
+ id: string;
343
+ project_id: string;
344
+ generation_id: string;
345
+ status: "processing" | "complete" | "failed";
346
+ created_at: string | null;
347
+ completed_at: string | null;
348
+ error: ResourceError | null;
349
+ reply?: string;
350
+ proposals?: Array<Record<string, unknown>>;
351
+ moments?: Array<Record<string, unknown>>;
352
+ unclear_word_ids?: string[];
353
+ speaker_turns?: Array<Record<string, unknown>>;
354
+ shortening?: Record<string, unknown> | null;
355
+ feedback_offer?: Record<string, unknown> | null;
356
+ notices?: string[];
357
+ windows_total?: number;
358
+ [key: string]: unknown;
359
+ }
360
+ export interface ProjectSharePublishParams {
361
+ /** Pin a finished generation; default is the project's newest finished one. */
362
+ generation_id?: string;
363
+ preview_seconds?: number;
364
+ }
365
+ export interface ProjectShare {
366
+ object: "project_share";
367
+ id: string;
368
+ project_id: string;
369
+ generation_id: string | null;
370
+ file_name: string | null;
371
+ content_type: string | null;
372
+ created_at: string | null;
373
+ has_video: boolean;
374
+ duration_seconds: number | null;
375
+ preview_seconds: number | null;
376
+ files: Partial<Record<GenerationFileName, string>>;
377
+ base_url: string | null;
378
+ }
379
+ export interface ProjectShareRevoked {
380
+ object: "project_share";
381
+ id: string | null;
382
+ project_id: string;
383
+ deleted: true;
384
+ }
385
+ export interface UsageParams {
386
+ /** ISO 8601 date or datetime; default the start of this month (UTC). */
387
+ start?: string;
388
+ /** ISO 8601 date or datetime; default now. At most 366 days after `start`. */
389
+ end?: string;
390
+ }
391
+ export interface UsageByModel {
392
+ model: string;
393
+ generations: number;
394
+ billable_seconds: number;
395
+ list_price_usd: number;
396
+ }
397
+ export interface Usage {
398
+ object: "usage";
399
+ start: string | null;
400
+ end: string | null;
401
+ end_user: string | null;
402
+ generations: number;
403
+ billable_seconds: number;
404
+ list_price_usd: number;
405
+ by_model: UsageByModel[];
406
+ }
407
+ export interface WebhookPortal {
408
+ object: "webhook_portal";
409
+ url: string;
410
+ event_types: WebhookEventType[];
411
+ }
412
+ export type WebhookEventType = "generation.completed" | "generation.failed" | "generation.stems_ready" | "generation.stems_failed" | "export.ready" | "export.failed" | "transcript_assistant_turn.completed" | "transcript_assistant_turn.failed" | "project.ready" | "project.failed";
413
+ export interface WebhookEventData {
414
+ object: "generation" | "generation_export" | "transcript_assistant_turn" | "project" | (string & {});
415
+ id: string;
416
+ project_id?: string;
417
+ generation_id?: string;
418
+ end_user?: string | null;
419
+ status?: string;
420
+ kind?: "restore" | "edit";
421
+ error_code?: string;
422
+ stems_status?: string;
423
+ [key: string]: unknown;
424
+ }
425
+ /** A verified webhook delivery: `{"type", "id", "created_at", "data"}`. De-duplicate on `id`. */
426
+ export interface WebhookEvent {
427
+ type: WebhookEventType | (string & {});
428
+ id: string;
429
+ created_at: string;
430
+ data: WebhookEventData;
230
431
  }
package/dist/api/types.js CHANGED
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ // Request and response shapes of Diffio API v2 (https://api.diffio.ai/v2/openapi.json).
3
+ // Field names are snake_case exactly as on the wire, in both directions.
2
4
  Object.defineProperty(exports, "__esModule", { value: true });