@runwayml/sdk 3.16.0 → 3.18.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 (66) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/client.d.mts +6 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -0
  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/index.d.mts +2 -0
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +2 -0
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +5 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +2 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/realtime-sessions.d.mts +274 -0
  36. package/resources/realtime-sessions.d.mts.map +1 -1
  37. package/resources/realtime-sessions.d.ts +274 -0
  38. package/resources/realtime-sessions.d.ts.map +1 -1
  39. package/resources/workflow-invocations.d.mts +195 -0
  40. package/resources/workflow-invocations.d.mts.map +1 -0
  41. package/resources/workflow-invocations.d.ts +195 -0
  42. package/resources/workflow-invocations.d.ts.map +1 -0
  43. package/resources/workflow-invocations.js +19 -0
  44. package/resources/workflow-invocations.js.map +1 -0
  45. package/resources/workflow-invocations.mjs +15 -0
  46. package/resources/workflow-invocations.mjs.map +1 -0
  47. package/resources/workflows.d.mts +171 -0
  48. package/resources/workflows.d.mts.map +1 -0
  49. package/resources/workflows.d.ts +171 -0
  50. package/resources/workflows.d.ts.map +1 -0
  51. package/resources/workflows.js +31 -0
  52. package/resources/workflows.js.map +1 -0
  53. package/resources/workflows.mjs +27 -0
  54. package/resources/workflows.mjs.map +1 -0
  55. package/src/client.ts +25 -0
  56. package/src/index.ts +3 -0
  57. package/src/lib/polling.ts +81 -0
  58. package/src/resources/index.ts +8 -0
  59. package/src/resources/realtime-sessions.ts +354 -0
  60. package/src/resources/workflow-invocations.ts +236 -0
  61. package/src/resources/workflows.ts +222 -0
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -217,6 +217,11 @@ export interface RealtimeSessionCreateParams {
217
217
  * avatar default.
218
218
  */
219
219
  startScript?: string;
220
+
221
+ /**
222
+ * Tools available to the avatar during the session.
223
+ */
224
+ tools?: Array<RealtimeSessionCreateParams.ClientEvent | RealtimeSessionCreateParams.BackendRpc>;
220
225
  }
221
226
 
222
227
  export namespace RealtimeSessionCreateParams {
@@ -252,6 +257,355 @@ export namespace RealtimeSessionCreateParams {
252
257
 
253
258
  type: 'custom';
254
259
  }
260
+
261
+ /**
262
+ * A fire-and-forget tool that sends arguments to the frontend client of the
263
+ * realtime session.
264
+ */
265
+ export interface ClientEvent {
266
+ /**
267
+ * A description of when and how the tool should be used. Be specific so the avatar
268
+ * understands the right context to invoke it.
269
+ */
270
+ description: string;
271
+
272
+ /**
273
+ * The tool name. Must start with a letter or underscore, followed by alphanumeric
274
+ * characters or underscores.
275
+ */
276
+ name: string;
277
+
278
+ type: 'client_event';
279
+
280
+ parameters?: Array<
281
+ | ClientEvent.String
282
+ | ClientEvent.Integer
283
+ | ClientEvent.Number
284
+ | ClientEvent.Boolean
285
+ | ClientEvent.Array_
286
+ | ClientEvent.Object
287
+ >;
288
+ }
289
+
290
+ export namespace ClientEvent {
291
+ export interface String {
292
+ /**
293
+ * A description of the parameter.
294
+ */
295
+ description: string;
296
+
297
+ /**
298
+ * The parameter name.
299
+ */
300
+ name: string;
301
+
302
+ type: 'string';
303
+
304
+ /**
305
+ * Allowed values for the parameter.
306
+ */
307
+ enum?: Array<string>;
308
+
309
+ /**
310
+ * Whether the parameter is required.
311
+ */
312
+ required?: boolean;
313
+ }
314
+
315
+ export interface Integer {
316
+ /**
317
+ * A description of the parameter.
318
+ */
319
+ description: string;
320
+
321
+ /**
322
+ * The parameter name.
323
+ */
324
+ name: string;
325
+
326
+ type: 'integer';
327
+
328
+ /**
329
+ * Whether the parameter is required.
330
+ */
331
+ required?: boolean;
332
+ }
333
+
334
+ export interface Number {
335
+ /**
336
+ * A description of the parameter.
337
+ */
338
+ description: string;
339
+
340
+ /**
341
+ * The parameter name.
342
+ */
343
+ name: string;
344
+
345
+ type: 'number';
346
+
347
+ /**
348
+ * Whether the parameter is required.
349
+ */
350
+ required?: boolean;
351
+ }
352
+
353
+ export interface Boolean {
354
+ /**
355
+ * A description of the parameter.
356
+ */
357
+ description: string;
358
+
359
+ /**
360
+ * The parameter name.
361
+ */
362
+ name: string;
363
+
364
+ type: 'boolean';
365
+
366
+ /**
367
+ * Whether the parameter is required.
368
+ */
369
+ required?: boolean;
370
+ }
371
+
372
+ export interface Array_ {
373
+ /**
374
+ * A description of the parameter.
375
+ */
376
+ description: string;
377
+
378
+ /**
379
+ * Item schema for array elements.
380
+ */
381
+ items: Array_.Items;
382
+
383
+ /**
384
+ * The parameter name.
385
+ */
386
+ name: string;
387
+
388
+ type: 'array';
389
+
390
+ /**
391
+ * Whether the parameter is required.
392
+ */
393
+ required?: boolean;
394
+ }
395
+
396
+ export namespace Array_ {
397
+ /**
398
+ * Item schema for array elements.
399
+ */
400
+ export interface Items {
401
+ /**
402
+ * The type of each element in the array.
403
+ */
404
+ type: 'string' | 'integer' | 'number' | 'boolean';
405
+ }
406
+ }
407
+
408
+ export interface Object {
409
+ /**
410
+ * A description of the parameter.
411
+ */
412
+ description: string;
413
+
414
+ /**
415
+ * The parameter name.
416
+ */
417
+ name: string;
418
+
419
+ /**
420
+ * The properties of the object.
421
+ */
422
+ properties: Array<unknown>;
423
+
424
+ type: 'object';
425
+
426
+ /**
427
+ * Whether the parameter is required.
428
+ */
429
+ required?: boolean;
430
+ }
431
+ }
432
+
433
+ /**
434
+ * A tool that makes a round-trip RPC call to your backend server during the
435
+ * session.
436
+ */
437
+ export interface BackendRpc {
438
+ /**
439
+ * A description of when and how the tool should be used. Be specific so the avatar
440
+ * understands the right context to invoke it.
441
+ */
442
+ description: string;
443
+
444
+ /**
445
+ * The tool name. Must start with a letter or underscore, followed by alphanumeric
446
+ * characters or underscores.
447
+ */
448
+ name: string;
449
+
450
+ type: 'backend_rpc';
451
+
452
+ parameters?: Array<
453
+ | BackendRpc.String
454
+ | BackendRpc.Integer
455
+ | BackendRpc.Number
456
+ | BackendRpc.Boolean
457
+ | BackendRpc.Array_
458
+ | BackendRpc.Object
459
+ >;
460
+
461
+ /**
462
+ * Maximum time to wait for the backend to respond.
463
+ */
464
+ timeoutSeconds?: number;
465
+ }
466
+
467
+ export namespace BackendRpc {
468
+ export interface String {
469
+ /**
470
+ * A description of the parameter.
471
+ */
472
+ description: string;
473
+
474
+ /**
475
+ * The parameter name.
476
+ */
477
+ name: string;
478
+
479
+ type: 'string';
480
+
481
+ /**
482
+ * Allowed values for the parameter.
483
+ */
484
+ enum?: Array<string>;
485
+
486
+ /**
487
+ * Whether the parameter is required.
488
+ */
489
+ required?: boolean;
490
+ }
491
+
492
+ export interface Integer {
493
+ /**
494
+ * A description of the parameter.
495
+ */
496
+ description: string;
497
+
498
+ /**
499
+ * The parameter name.
500
+ */
501
+ name: string;
502
+
503
+ type: 'integer';
504
+
505
+ /**
506
+ * Whether the parameter is required.
507
+ */
508
+ required?: boolean;
509
+ }
510
+
511
+ export interface Number {
512
+ /**
513
+ * A description of the parameter.
514
+ */
515
+ description: string;
516
+
517
+ /**
518
+ * The parameter name.
519
+ */
520
+ name: string;
521
+
522
+ type: 'number';
523
+
524
+ /**
525
+ * Whether the parameter is required.
526
+ */
527
+ required?: boolean;
528
+ }
529
+
530
+ export interface Boolean {
531
+ /**
532
+ * A description of the parameter.
533
+ */
534
+ description: string;
535
+
536
+ /**
537
+ * The parameter name.
538
+ */
539
+ name: string;
540
+
541
+ type: 'boolean';
542
+
543
+ /**
544
+ * Whether the parameter is required.
545
+ */
546
+ required?: boolean;
547
+ }
548
+
549
+ export interface Array_ {
550
+ /**
551
+ * A description of the parameter.
552
+ */
553
+ description: string;
554
+
555
+ /**
556
+ * Item schema for array elements.
557
+ */
558
+ items: Array_.Items;
559
+
560
+ /**
561
+ * The parameter name.
562
+ */
563
+ name: string;
564
+
565
+ type: 'array';
566
+
567
+ /**
568
+ * Whether the parameter is required.
569
+ */
570
+ required?: boolean;
571
+ }
572
+
573
+ export namespace Array_ {
574
+ /**
575
+ * Item schema for array elements.
576
+ */
577
+ export interface Items {
578
+ /**
579
+ * The type of each element in the array.
580
+ */
581
+ type: 'string' | 'integer' | 'number' | 'boolean';
582
+ }
583
+ }
584
+
585
+ export interface Object {
586
+ /**
587
+ * A description of the parameter.
588
+ */
589
+ description: string;
590
+
591
+ /**
592
+ * The parameter name.
593
+ */
594
+ name: string;
595
+
596
+ /**
597
+ * The properties of the object.
598
+ */
599
+ properties: Array<unknown>;
600
+
601
+ type: 'object';
602
+
603
+ /**
604
+ * Whether the parameter is required.
605
+ */
606
+ required?: boolean;
607
+ }
608
+ }
255
609
  }
256
610
 
257
611
  export declare namespace RealtimeSessions {
@@ -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
+ }