@runwayml/sdk 3.15.1 → 3.17.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 (85) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client.d.mts +8 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/index.d.mts +1 -1
  11. package/index.d.mts.map +1 -1
  12. package/index.d.ts +1 -1
  13. package/index.d.ts.map +1 -1
  14. package/index.js +3 -1
  15. package/index.js.map +1 -1
  16. package/index.mjs +1 -1
  17. package/index.mjs.map +1 -1
  18. package/lib/polling.d.mts +22 -0
  19. package/lib/polling.d.mts.map +1 -1
  20. package/lib/polling.d.ts +22 -0
  21. package/lib/polling.d.ts.map +1 -1
  22. package/lib/polling.js +54 -1
  23. package/lib/polling.js.map +1 -1
  24. package/lib/polling.mjs +50 -0
  25. package/lib/polling.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/resources/documents.d.mts +23 -1
  28. package/resources/documents.d.mts.map +1 -1
  29. package/resources/documents.d.ts +23 -1
  30. package/resources/documents.d.ts.map +1 -1
  31. package/resources/documents.js +18 -0
  32. package/resources/documents.js.map +1 -1
  33. package/resources/documents.mjs +18 -0
  34. package/resources/documents.mjs.map +1 -1
  35. package/resources/image-to-video.d.mts +41 -41
  36. package/resources/image-to-video.d.mts.map +1 -1
  37. package/resources/image-to-video.d.ts +41 -41
  38. package/resources/image-to-video.d.ts.map +1 -1
  39. package/resources/index.d.mts +3 -1
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +3 -1
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +5 -1
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +2 -0
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/organization.d.mts +2 -2
  48. package/resources/organization.d.mts.map +1 -1
  49. package/resources/organization.d.ts +2 -2
  50. package/resources/organization.d.ts.map +1 -1
  51. package/resources/realtime-sessions.d.mts +10 -0
  52. package/resources/realtime-sessions.d.mts.map +1 -1
  53. package/resources/realtime-sessions.d.ts +10 -0
  54. package/resources/realtime-sessions.d.ts.map +1 -1
  55. package/resources/workflow-invocations.d.mts +195 -0
  56. package/resources/workflow-invocations.d.mts.map +1 -0
  57. package/resources/workflow-invocations.d.ts +195 -0
  58. package/resources/workflow-invocations.d.ts.map +1 -0
  59. package/resources/workflow-invocations.js +19 -0
  60. package/resources/workflow-invocations.js.map +1 -0
  61. package/resources/workflow-invocations.mjs +15 -0
  62. package/resources/workflow-invocations.mjs.map +1 -0
  63. package/resources/workflows.d.mts +171 -0
  64. package/resources/workflows.d.mts.map +1 -0
  65. package/resources/workflows.d.ts +171 -0
  66. package/resources/workflows.d.ts.map +1 -0
  67. package/resources/workflows.js +31 -0
  68. package/resources/workflows.js.map +1 -0
  69. package/resources/workflows.mjs +27 -0
  70. package/resources/workflows.mjs.map +1 -0
  71. package/src/client.ts +27 -0
  72. package/src/index.ts +3 -0
  73. package/src/lib/polling.ts +81 -0
  74. package/src/resources/documents.ts +36 -0
  75. package/src/resources/image-to-video.ts +48 -48
  76. package/src/resources/index.ts +9 -0
  77. package/src/resources/organization.ts +2 -0
  78. package/src/resources/realtime-sessions.ts +12 -0
  79. package/src/resources/workflow-invocations.ts +236 -0
  80. package/src/resources/workflows.ts +222 -0
  81. package/src/version.ts +1 -1
  82. package/version.d.mts +1 -1
  83. package/version.d.ts +1 -1
  84. package/version.js +1 -1
  85. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -42,6 +42,7 @@ import {
42
42
  DocumentListResponse,
43
43
  DocumentListResponsesCursorPage,
44
44
  DocumentRetrieveResponse,
45
+ DocumentUpdateParams,
45
46
  Documents,
46
47
  } from './resources/documents';
47
48
  import {
@@ -102,6 +103,14 @@ import {
102
103
  VoiceRetrieveResponse,
103
104
  Voices,
104
105
  } from './resources/voices';
106
+ import { WorkflowInvocationRetrieveResponse, WorkflowInvocations } from './resources/workflow-invocations';
107
+ import {
108
+ WorkflowListResponse,
109
+ WorkflowRetrieveResponse,
110
+ WorkflowRunParams,
111
+ WorkflowRunResponse,
112
+ Workflows,
113
+ } from './resources/workflows';
105
114
  import { type Fetch } from './internal/builtin-types';
106
115
  import { isRunningInBrowser } from './internal/detect-platform';
107
116
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
@@ -892,6 +901,8 @@ export class RunwayML {
892
901
  realtimeSessions: API.RealtimeSessions = new API.RealtimeSessions(this);
893
902
  voices: API.Voices = new API.Voices(this);
894
903
  uploads: API.Uploads = new API.Uploads(this);
904
+ workflows: API.Workflows = new API.Workflows(this);
905
+ workflowInvocations: API.WorkflowInvocations = new API.WorkflowInvocations(this);
895
906
  }
896
907
 
897
908
  RunwayML.Tasks = Tasks;
@@ -911,6 +922,8 @@ RunwayML.Documents = Documents;
911
922
  RunwayML.RealtimeSessions = RealtimeSessions;
912
923
  RunwayML.Voices = Voices;
913
924
  RunwayML.Uploads = Uploads;
925
+ RunwayML.Workflows = Workflows;
926
+ RunwayML.WorkflowInvocations = WorkflowInvocations;
914
927
 
915
928
  export declare namespace RunwayML {
916
929
  export type RequestOptions = Opts.RequestOptions;
@@ -1006,6 +1019,7 @@ export declare namespace RunwayML {
1006
1019
  type DocumentListResponse as DocumentListResponse,
1007
1020
  type DocumentListResponsesCursorPage as DocumentListResponsesCursorPage,
1008
1021
  type DocumentCreateParams as DocumentCreateParams,
1022
+ type DocumentUpdateParams as DocumentUpdateParams,
1009
1023
  type DocumentListParams as DocumentListParams,
1010
1024
  };
1011
1025
 
@@ -1033,4 +1047,17 @@ export declare namespace RunwayML {
1033
1047
  type UploadCreateEphemeralResponse as UploadCreateEphemeralResponse,
1034
1048
  type UploadsCreateEphemeralParams as UploadsCreateEphemeralParams,
1035
1049
  };
1050
+
1051
+ export {
1052
+ Workflows as Workflows,
1053
+ type WorkflowRetrieveResponse as WorkflowRetrieveResponse,
1054
+ type WorkflowListResponse as WorkflowListResponse,
1055
+ type WorkflowRunResponse as WorkflowRunResponse,
1056
+ type WorkflowRunParams as WorkflowRunParams,
1057
+ };
1058
+
1059
+ export {
1060
+ WorkflowInvocations as WorkflowInvocations,
1061
+ type WorkflowInvocationRetrieveResponse as WorkflowInvocationRetrieveResponse,
1062
+ };
1036
1063
  }
package/src/index.ts CHANGED
@@ -25,7 +25,10 @@ export {
25
25
  export {
26
26
  TaskFailedError,
27
27
  TaskTimedOutError,
28
+ WorkflowInvocationFailedError,
29
+ WorkflowInvocationTimedOutError,
28
30
  WaitForTaskOutputOptions,
29
31
  AbortError,
30
32
  type APIPromiseWithAwaitableTask,
33
+ type APIPromiseWithAwaitableWorkflowInvocation,
31
34
  } from './lib/polling';
@@ -1,6 +1,7 @@
1
1
  import type { RunwayML } from '../client';
2
2
  import { APIPromise } from '../core/api-promise';
3
3
  import { TaskRetrieveResponse } from '../resources/tasks';
4
+ import { WorkflowInvocationRetrieveResponse } from '../resources/workflow-invocations';
4
5
 
5
6
  const POLL_TIME = 6000; // 6 seconds
6
7
  const POLL_JITTER = 3000; // 3 seconds
@@ -52,6 +53,28 @@ export class AbortError extends Error {
52
53
  }
53
54
  }
54
55
 
56
+ export class WorkflowInvocationFailedError extends Error {
57
+ invocationDetails: WorkflowInvocationRetrieveResponse;
58
+ constructor(
59
+ invocationDetails:
60
+ | WorkflowInvocationRetrieveResponse.Failed
61
+ | WorkflowInvocationRetrieveResponse.Cancelled,
62
+ ) {
63
+ super('failure' in invocationDetails ? invocationDetails.failure : 'Workflow invocation cancelled');
64
+ this.invocationDetails = invocationDetails;
65
+ this.name = 'WorkflowInvocationFailedError';
66
+ }
67
+ }
68
+
69
+ export class WorkflowInvocationTimedOutError extends Error {
70
+ invocationDetails: WorkflowInvocationRetrieveResponse;
71
+ constructor(invocationDetails: WorkflowInvocationRetrieveResponse) {
72
+ super('Workflow invocation timed out');
73
+ this.invocationDetails = invocationDetails;
74
+ this.name = 'WorkflowInvocationTimedOutError';
75
+ }
76
+ }
77
+
55
78
  export type APIPromiseWithAwaitableTask<T extends { id: string }> = APIPromise<T> & {
56
79
  /**
57
80
  * When called, this will wait until the task is complete.
@@ -107,3 +130,61 @@ export function wrapAsWaitableResource<T extends { id: string }>(client: RunwayM
107
130
  };
108
131
  };
109
132
  }
133
+
134
+ export type APIPromiseWithAwaitableWorkflowInvocation<T extends { id: string }> = APIPromise<T> & {
135
+ /**
136
+ * When called, this will wait until the workflow invocation is complete.
137
+ *
138
+ * If the invocation fails or is cancelled, a `WorkflowInvocationFailedError` will be thrown.
139
+ */
140
+ waitForTaskOutput: (
141
+ options?: WaitForTaskOutputOptions,
142
+ ) => Promise<WorkflowInvocationRetrieveResponse.Succeeded>;
143
+ };
144
+
145
+ export function wrapAsWaitableWorkflowInvocation<T extends { id: string }>(client: RunwayML) {
146
+ return (
147
+ responsePromise: APIPromise<T>,
148
+ skipInitialWait: boolean = false,
149
+ ): APIPromiseWithAwaitableWorkflowInvocation<T> => {
150
+ return Object.defineProperty(responsePromise, 'waitForTaskOutput', {
151
+ value: async (options?: WaitForTaskOutputOptions) => {
152
+ const wait = () =>
153
+ new Promise<void>((resolve) =>
154
+ setTimeout(resolve, POLL_TIME + Math.random() * POLL_JITTER - POLL_JITTER / 2),
155
+ );
156
+
157
+ if (!skipInitialWait) {
158
+ await wait();
159
+ }
160
+
161
+ const { timeout = 60 * 10 * 1000 } = options ?? {};
162
+ const output = await responsePromise;
163
+ const startTime = Date.now();
164
+ let details: WorkflowInvocationRetrieveResponse;
165
+ do {
166
+ if (options?.abortSignal?.aborted) {
167
+ throw new AbortError();
168
+ }
169
+ details = await client.workflowInvocations.retrieve(output.id);
170
+ if (details.status === 'SUCCEEDED') {
171
+ return details;
172
+ }
173
+ if (details.status === 'FAILED' || details.status === 'CANCELLED') {
174
+ throw new WorkflowInvocationFailedError(details);
175
+ }
176
+ await wait();
177
+ if (timeout != null && Date.now() - startTime > timeout && !options?.abortSignal?.aborted) {
178
+ throw new WorkflowInvocationTimedOutError(details);
179
+ }
180
+ } while (['THROTTLED', 'PENDING', 'RUNNING'].includes(details.status));
181
+ throw new WorkflowInvocationTimedOutError(details);
182
+ },
183
+ writable: false,
184
+ enumerable: false,
185
+ configurable: false,
186
+ }) as APIPromise<T> & {
187
+ waitForTaskOutput: () => Promise<WorkflowInvocationRetrieveResponse.Succeeded>;
188
+ };
189
+ };
190
+ }
@@ -39,6 +39,29 @@ export class Documents extends APIResource {
39
39
  return this._client.get(path`/v1/documents/${id}`, options);
40
40
  }
41
41
 
42
+ /**
43
+ * Update a knowledge document. At least one of `name` or `content` must be
44
+ * provided.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * await client.documents.update(
49
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
50
+ * );
51
+ * ```
52
+ */
53
+ update(
54
+ id: string,
55
+ body: DocumentUpdateParams | null | undefined = {},
56
+ options?: RequestOptions,
57
+ ): APIPromise<void> {
58
+ return this._client.patch(path`/v1/documents/${id}`, {
59
+ body,
60
+ ...options,
61
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
62
+ });
63
+ }
64
+
42
65
  /**
43
66
  * List knowledge documents for the authenticated user with cursor-based
44
67
  * pagination.
@@ -256,6 +279,18 @@ export interface DocumentCreateParams {
256
279
  name: string;
257
280
  }
258
281
 
282
+ export interface DocumentUpdateParams {
283
+ /**
284
+ * New markdown or plain text content for the document.
285
+ */
286
+ content?: string;
287
+
288
+ /**
289
+ * A new name for the document.
290
+ */
291
+ name?: string;
292
+ }
293
+
259
294
  export interface DocumentListParams extends CursorPageParams {}
260
295
 
261
296
  export declare namespace Documents {
@@ -265,6 +300,7 @@ export declare namespace Documents {
265
300
  type DocumentListResponse as DocumentListResponse,
266
301
  type DocumentListResponsesCursorPage as DocumentListResponsesCursorPage,
267
302
  type DocumentCreateParams as DocumentCreateParams,
303
+ type DocumentUpdateParams as DocumentUpdateParams,
268
304
  type DocumentListParams as DocumentListParams,
269
305
  };
270
306
  }
@@ -40,8 +40,8 @@ export interface ImageToVideoCreateResponse {
40
40
  export type ImageToVideoCreateParams =
41
41
  | ImageToVideoCreateParams.Gen4_5
42
42
  | ImageToVideoCreateParams.Gen4Turbo
43
- | ImageToVideoCreateParams.Veo3_1
44
43
  | ImageToVideoCreateParams.Gen3aTurbo
44
+ | ImageToVideoCreateParams.Veo3_1
45
45
  | ImageToVideoCreateParams.Veo3_1Fast
46
46
  | ImageToVideoCreateParams.Veo3;
47
47
 
@@ -173,39 +173,44 @@ export declare namespace ImageToVideoCreateParams {
173
173
  }
174
174
  }
175
175
 
176
- export interface Veo3_1 {
177
- model: 'veo3.1';
176
+ export interface Gen3aTurbo {
177
+ model: 'gen3a_turbo';
178
178
 
179
179
  /**
180
- * You may specify an image to use as the first frame of the output video, or an
181
- * array with a first frame and optionally a last frame. This model does not
182
- * support generating with only a last frame.
180
+ * A HTTPS URL.
183
181
  */
184
- promptImage: string | Array<Veo3_1.PromptImage>;
182
+ promptImage: string | Array<Gen3aTurbo.PromptImage>;
185
183
 
186
184
  /**
187
- * The resolution of the output video.
185
+ * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
186
+ * should describe in detail what should appear in the output.
188
187
  */
189
- ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
188
+ promptText: string;
190
189
 
191
190
  /**
192
- * Whether to generate audio for the video. Audio inclusion affects pricing.
191
+ * Settings that affect the behavior of the content moderation system.
193
192
  */
194
- audio?: boolean;
193
+ contentModeration?: Gen3aTurbo.ContentModeration;
195
194
 
196
195
  /**
197
- * The number of seconds of duration for the output video.
196
+ * The duration of the output video in seconds.
198
197
  */
199
- duration?: 4 | 6 | 8;
198
+ duration?: 5 | 10;
200
199
 
201
200
  /**
202
- * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
203
- * should describe in detail what should appear in the output.
201
+ * The resolution of the output video.
204
202
  */
205
- promptText?: string;
203
+ ratio?: '768:1280' | '1280:768';
204
+
205
+ /**
206
+ * If unspecified, a random number is chosen. Varying the seed integer is a way to
207
+ * get different results for the same other request parameters. Using the same seed
208
+ * integer for an identical request will produce similar results.
209
+ */
210
+ seed?: number;
206
211
  }
207
212
 
208
- export namespace Veo3_1 {
213
+ export namespace Gen3aTurbo {
209
214
  export interface PromptImage {
210
215
  /**
211
216
  * The position of the image in the output video. "first" will use the image as the
@@ -219,46 +224,52 @@ export declare namespace ImageToVideoCreateParams {
219
224
  */
220
225
  uri: string;
221
226
  }
222
- }
223
-
224
- export interface Gen3aTurbo {
225
- model: 'gen3a_turbo';
226
227
 
227
228
  /**
228
- * A HTTPS URL.
229
+ * Settings that affect the behavior of the content moderation system.
229
230
  */
230
- promptImage: string | Array<Gen3aTurbo.PromptImage>;
231
+ export interface ContentModeration {
232
+ /**
233
+ * When set to `low`, the content moderation system will be less strict about
234
+ * preventing generations that include recognizable public figures.
235
+ */
236
+ publicFigureThreshold?: 'auto' | 'low';
237
+ }
238
+ }
239
+
240
+ export interface Veo3_1 {
241
+ model: 'veo3.1';
231
242
 
232
243
  /**
233
- * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
234
- * should describe in detail what should appear in the output.
244
+ * You may specify an image to use as the first frame of the output video, or an
245
+ * array with a first frame and optionally a last frame. This model does not
246
+ * support generating with only a last frame.
235
247
  */
236
- promptText: string;
248
+ promptImage: string | Array<Veo3_1.PromptImage>;
237
249
 
238
250
  /**
239
- * Settings that affect the behavior of the content moderation system.
251
+ * The resolution of the output video.
240
252
  */
241
- contentModeration?: Gen3aTurbo.ContentModeration;
253
+ ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
242
254
 
243
255
  /**
244
- * The duration of the output video in seconds.
256
+ * Whether to generate audio for the video. Audio inclusion affects pricing.
245
257
  */
246
- duration?: 5 | 10;
258
+ audio?: boolean;
247
259
 
248
260
  /**
249
- * The resolution of the output video.
261
+ * The number of seconds of duration for the output video.
250
262
  */
251
- ratio?: '768:1280' | '1280:768';
263
+ duration?: 4 | 6 | 8;
252
264
 
253
265
  /**
254
- * If unspecified, a random number is chosen. Varying the seed integer is a way to
255
- * get different results for the same other request parameters. Using the same seed
256
- * integer for an identical request will produce similar results.
266
+ * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
267
+ * should describe in detail what should appear in the output.
257
268
  */
258
- seed?: number;
269
+ promptText?: string;
259
270
  }
260
271
 
261
- export namespace Gen3aTurbo {
272
+ export namespace Veo3_1 {
262
273
  export interface PromptImage {
263
274
  /**
264
275
  * The position of the image in the output video. "first" will use the image as the
@@ -272,17 +283,6 @@ export declare namespace ImageToVideoCreateParams {
272
283
  */
273
284
  uri: string;
274
285
  }
275
-
276
- /**
277
- * Settings that affect the behavior of the content moderation system.
278
- */
279
- export interface ContentModeration {
280
- /**
281
- * When set to `low`, the content moderation system will be less strict about
282
- * preventing generations that include recognizable public figures.
283
- */
284
- publicFigureThreshold?: 'auto' | 'low';
285
- }
286
286
  }
287
287
 
288
288
  export interface Veo3_1Fast {
@@ -22,6 +22,7 @@ export {
22
22
  type DocumentRetrieveResponse,
23
23
  type DocumentListResponse,
24
24
  type DocumentCreateParams,
25
+ type DocumentUpdateParams,
25
26
  type DocumentListParams,
26
27
  type DocumentListResponsesCursorPage,
27
28
  } from './documents';
@@ -82,4 +83,12 @@ export {
82
83
  type VoicePreviewParams,
83
84
  type VoiceListResponsesCursorPage,
84
85
  } from './voices';
86
+ export { WorkflowInvocations, type WorkflowInvocationRetrieveResponse } from './workflow-invocations';
87
+ export {
88
+ Workflows,
89
+ type WorkflowRetrieveResponse,
90
+ type WorkflowListResponse,
91
+ type WorkflowRunResponse,
92
+ type WorkflowRunParams,
93
+ } from './workflows';
85
94
  export { Uploads, type UploadCreateEphemeralResponse, type UploadsCreateEphemeralParams } from './uploads';
@@ -118,6 +118,7 @@ export interface OrganizationRetrieveUsageResponse {
118
118
  | 'eleven_voice_dubbing'
119
119
  | 'eleven_multilingual_sts_v2'
120
120
  | 'gwm1_avatars'
121
+ | 'gwm1_avatar_async_audio_to_video'
121
122
  | 'voice_processing'
122
123
  >;
123
124
 
@@ -166,6 +167,7 @@ export namespace OrganizationRetrieveUsageResponse {
166
167
  | 'eleven_voice_dubbing'
167
168
  | 'eleven_multilingual_sts_v2'
168
169
  | 'gwm1_avatars'
170
+ | 'gwm1_avatar_async_audio_to_video'
169
171
  | 'voice_processing';
170
172
  }
171
173
  }
@@ -205,6 +205,18 @@ export interface RealtimeSessionCreateParams {
205
205
  * Maximum session duration in seconds.
206
206
  */
207
207
  maxDuration?: number;
208
+
209
+ /**
210
+ * Override the avatar personality for this session. If not provided, uses the
211
+ * avatar default.
212
+ */
213
+ personality?: string;
214
+
215
+ /**
216
+ * Override the avatar start script for this session. If not provided, uses the
217
+ * avatar default.
218
+ */
219
+ startScript?: string;
208
220
  }
209
221
 
210
222
  export namespace RealtimeSessionCreateParams {
@@ -0,0 +1,236 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { RequestOptions } from '../internal/request-options';
5
+ import { path } from '../internal/utils/path';
6
+ import { APIPromiseWithAwaitableWorkflowInvocation, wrapAsWaitableWorkflowInvocation } from '../lib/polling';
7
+
8
+ export class WorkflowInvocations extends APIResource {
9
+ /**
10
+ * Return details about a workflow invocation. Consumers of this API should not
11
+ * expect updates more frequent than once every five seconds for a given workflow
12
+ * invocation.
13
+ */
14
+ retrieve(
15
+ id: string,
16
+ options?: RequestOptions,
17
+ ): APIPromiseWithAwaitableWorkflowInvocation<WorkflowInvocationRetrieveResponse> {
18
+ return wrapAsWaitableWorkflowInvocation<WorkflowInvocationRetrieveResponse>(this._client)(
19
+ this._client.get(path`/v1/workflow_invocations/${id}`, options),
20
+ true,
21
+ );
22
+ }
23
+ }
24
+
25
+ /**
26
+ * A pending workflow invocation
27
+ */
28
+ export type WorkflowInvocationRetrieveResponse =
29
+ | WorkflowInvocationRetrieveResponse.Pending
30
+ | WorkflowInvocationRetrieveResponse.Throttled
31
+ | WorkflowInvocationRetrieveResponse.Cancelled
32
+ | WorkflowInvocationRetrieveResponse.Running
33
+ | WorkflowInvocationRetrieveResponse.Failed
34
+ | WorkflowInvocationRetrieveResponse.Succeeded;
35
+
36
+ export namespace WorkflowInvocationRetrieveResponse {
37
+ /**
38
+ * A pending workflow invocation
39
+ */
40
+ export interface Pending {
41
+ /**
42
+ * The ID of the workflow invocation being returned.
43
+ */
44
+ id: string;
45
+
46
+ /**
47
+ * The timestamp that the workflow invocation was submitted at.
48
+ */
49
+ createdAt: string;
50
+
51
+ status: 'PENDING';
52
+ }
53
+
54
+ /**
55
+ * A throttled workflow invocation
56
+ */
57
+ export interface Throttled {
58
+ /**
59
+ * The ID of the workflow invocation being returned.
60
+ */
61
+ id: string;
62
+
63
+ /**
64
+ * The timestamp that the workflow invocation was submitted at.
65
+ */
66
+ createdAt: string;
67
+
68
+ status: 'THROTTLED';
69
+ }
70
+
71
+ /**
72
+ * A cancelled or deleted workflow invocation
73
+ */
74
+ export interface Cancelled {
75
+ /**
76
+ * The ID of the workflow invocation being returned.
77
+ */
78
+ id: string;
79
+
80
+ /**
81
+ * The timestamp that the workflow invocation was submitted at.
82
+ */
83
+ createdAt: string;
84
+
85
+ status: 'CANCELLED';
86
+ }
87
+
88
+ /**
89
+ * A running workflow invocation
90
+ */
91
+ export interface Running {
92
+ /**
93
+ * The ID of the workflow invocation being returned.
94
+ */
95
+ id: string;
96
+
97
+ /**
98
+ * The timestamp that the workflow invocation was submitted at.
99
+ */
100
+ createdAt: string;
101
+
102
+ /**
103
+ * A record mapping workflow node IDs to arrays of output URLs for nodes that have
104
+ * already completed. This allows streaming partial results while the workflow is
105
+ * still running.
106
+ */
107
+ output: { [key: string]: Array<string> };
108
+
109
+ /**
110
+ * A number between 0 and 1 representing the overall workflow execution progress.
111
+ */
112
+ progress: number;
113
+
114
+ status: 'RUNNING';
115
+
116
+ /**
117
+ * A record mapping workflow node IDs to their error details. Only present when one
118
+ * or more nodes have errored.
119
+ */
120
+ nodeErrors?: { [key: string]: Running.NodeErrors };
121
+ }
122
+
123
+ export namespace Running {
124
+ export interface NodeErrors {
125
+ /**
126
+ * A human-readable description of the node error.
127
+ */
128
+ message: string;
129
+
130
+ /**
131
+ * The human-readable name of the node that errored.
132
+ */
133
+ nodeName?: string;
134
+ }
135
+ }
136
+
137
+ /**
138
+ * A failed workflow invocation
139
+ */
140
+ export interface Failed {
141
+ /**
142
+ * The ID of the workflow invocation being returned.
143
+ */
144
+ id: string;
145
+
146
+ /**
147
+ * The timestamp that the workflow invocation was submitted at.
148
+ */
149
+ createdAt: string;
150
+
151
+ /**
152
+ * A human-friendly reason for the failure. We do not recommend returning this to
153
+ * users directly without adding context.
154
+ */
155
+ failure: string;
156
+
157
+ status: 'FAILED';
158
+
159
+ /**
160
+ * A machine-readable error code for the failure. See
161
+ * https://docs.dev.runwayml.com/errors/task-failures/ for more information.
162
+ */
163
+ failureCode?: string;
164
+
165
+ /**
166
+ * A record mapping workflow node IDs to their error details. Only present when one
167
+ * or more nodes have errored.
168
+ */
169
+ nodeErrors?: { [key: string]: Failed.NodeErrors };
170
+ }
171
+
172
+ export namespace Failed {
173
+ export interface NodeErrors {
174
+ /**
175
+ * A human-readable description of the node error.
176
+ */
177
+ message: string;
178
+
179
+ /**
180
+ * The human-readable name of the node that errored.
181
+ */
182
+ nodeName?: string;
183
+ }
184
+ }
185
+
186
+ /**
187
+ * A succeeded workflow invocation
188
+ */
189
+ export interface Succeeded {
190
+ /**
191
+ * The ID of the workflow invocation being returned.
192
+ */
193
+ id: string;
194
+
195
+ /**
196
+ * The timestamp that the workflow invocation was submitted at.
197
+ */
198
+ createdAt: string;
199
+
200
+ /**
201
+ * A record mapping workflow node IDs to arrays of output URLs. Each key is the
202
+ * UUID of a workflow node that produced output, and each value is an array of URLs
203
+ * for that node's artifacts. These URLs will expire within 24-48 hours; fetch the
204
+ * invocation again to get fresh URLs. It is expected that you download the assets
205
+ * at these URLs and store them in your own storage system.
206
+ */
207
+ output: { [key: string]: Array<string> };
208
+
209
+ status: 'SUCCEEDED';
210
+
211
+ /**
212
+ * A record mapping workflow node IDs to their error details. Even when the overall
213
+ * workflow succeeds, individual nodes may have encountered non-fatal errors. Only
214
+ * present when one or more nodes have errored.
215
+ */
216
+ nodeErrors?: { [key: string]: Succeeded.NodeErrors };
217
+ }
218
+
219
+ export namespace Succeeded {
220
+ export interface NodeErrors {
221
+ /**
222
+ * A human-readable description of the node error.
223
+ */
224
+ message: string;
225
+
226
+ /**
227
+ * The human-readable name of the node that errored.
228
+ */
229
+ nodeName?: string;
230
+ }
231
+ }
232
+ }
233
+
234
+ export declare namespace WorkflowInvocations {
235
+ export { type WorkflowInvocationRetrieveResponse as WorkflowInvocationRetrieveResponse };
236
+ }