@independo/inderun-contracts 0.4.0 → 0.5.0-rc.2

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 (73) hide show
  1. package/dist/generated/artifact-read-request.d.ts +24 -0
  2. package/dist/generated/artifact-read-request.d.ts.map +1 -0
  3. package/dist/generated/artifact-read-request.js +2 -0
  4. package/dist/generated/execution-provenance.d.ts +8 -1
  5. package/dist/generated/execution-provenance.d.ts.map +1 -1
  6. package/dist/generated/inderun-error.d.ts +8 -1
  7. package/dist/generated/inderun-error.d.ts.map +1 -1
  8. package/dist/generated/index.d.ts +6 -0
  9. package/dist/generated/index.d.ts.map +1 -1
  10. package/dist/generated/media-artifact.d.ts +53 -0
  11. package/dist/generated/media-artifact.d.ts.map +1 -0
  12. package/dist/generated/media-artifact.js +2 -0
  13. package/dist/generated/provider-capability-snapshot.d.ts +370 -0
  14. package/dist/generated/provider-capability-snapshot.d.ts.map +1 -0
  15. package/dist/generated/provider-capability-snapshot.js +2 -0
  16. package/dist/generated/provider-descriptor.d.ts +264 -0
  17. package/dist/generated/provider-descriptor.d.ts.map +1 -0
  18. package/dist/generated/provider-descriptor.js +2 -0
  19. package/dist/generated/provider-dynamic-capabilities.d.ts +99 -0
  20. package/dist/generated/provider-dynamic-capabilities.d.ts.map +1 -0
  21. package/dist/generated/provider-dynamic-capabilities.js +2 -0
  22. package/dist/generated/route-plan.d.ts +47 -3
  23. package/dist/generated/route-plan.d.ts.map +1 -1
  24. package/dist/generated/route-planner-input.d.ts +417 -32
  25. package/dist/generated/route-planner-input.d.ts.map +1 -1
  26. package/dist/generated/schemas.d.ts +833 -115
  27. package/dist/generated/schemas.d.ts.map +1 -1
  28. package/dist/generated/schemas.js +1038 -160
  29. package/dist/generated/stream-event.d.ts +136 -1
  30. package/dist/generated/stream-event.d.ts.map +1 -1
  31. package/dist/generated/stream-terminal-outcome.d.ts +182 -18
  32. package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
  33. package/dist/generated/task-output.d.ts +128 -0
  34. package/dist/generated/task-output.d.ts.map +1 -0
  35. package/dist/generated/task-output.js +2 -0
  36. package/dist/generated/task-request.d.ts +116 -11
  37. package/dist/generated/task-request.d.ts.map +1 -1
  38. package/dist/generated/task-result.d.ts +139 -15
  39. package/dist/generated/task-result.d.ts.map +1 -1
  40. package/dist/generated/telemetry-event.d.ts +2 -2
  41. package/dist/generated/telemetry-event.d.ts.map +1 -1
  42. package/dist/host.d.ts +24 -1
  43. package/dist/host.d.ts.map +1 -1
  44. package/dist/index.d.ts +5 -5
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +2 -2
  47. package/dist/types.d.ts +46 -2
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/validators.d.ts +18 -0
  50. package/dist/validators.d.ts.map +1 -1
  51. package/dist/validators.js +49 -1
  52. package/package.json +1 -1
  53. package/src/generated/artifact-read-request.ts +25 -0
  54. package/src/generated/execution-provenance.ts +8 -1
  55. package/src/generated/inderun-error.ts +8 -1
  56. package/src/generated/index.ts +6 -0
  57. package/src/generated/media-artifact.ts +56 -0
  58. package/src/generated/provider-capability-snapshot.ts +388 -0
  59. package/src/generated/provider-descriptor.ts +278 -0
  60. package/src/generated/provider-dynamic-capabilities.ts +103 -0
  61. package/src/generated/route-plan.ts +49 -3
  62. package/src/generated/route-planner-input.ts +437 -36
  63. package/src/generated/schemas.ts +1044 -160
  64. package/src/generated/stream-event.ts +145 -1
  65. package/src/generated/stream-terminal-outcome.ts +191 -18
  66. package/src/generated/task-output.ts +137 -0
  67. package/src/generated/task-request.ts +124 -11
  68. package/src/generated/task-result.ts +147 -15
  69. package/src/generated/telemetry-event.ts +2 -2
  70. package/src/host.ts +30 -1
  71. package/src/index.ts +28 -1
  72. package/src/types.ts +38 -1
  73. package/src/validators.ts +76 -0
@@ -108,6 +108,7 @@ export type Payload = {
108
108
  finalText?: string;
109
109
  finishReason?: FinishReason;
110
110
  outcome?: Outcome;
111
+ output?: TaskOutput;
111
112
  /**
112
113
  * Normalized execution provenance: which target ran, its declared locality, the configured
113
114
  * and reported model, and how fallback and routing played out. See
@@ -212,6 +213,13 @@ export type ExecutionProvenance = {
212
213
  }
213
214
 
214
215
  export type ExecutionProvenanceAttempt = {
216
+ /**
217
+ * Whether the run committed to this provider during the attempt: its first content was
218
+ * delivered, it signalled the first possible audible effect, or it handed over an artifact.
219
+ * After commit a failure ends the run instead of falling back. Absent means the attempt did
220
+ * not commit.
221
+ */
222
+ committed?: boolean;
215
223
  /**
216
224
  * Normalized error class of a failed attempt.
217
225
  */
@@ -244,12 +252,148 @@ export type ExecutionProvenanceRouteRejection = {
244
252
  [property: string]: unknown;
245
253
  }
246
254
 
247
- export type Code = "task_not_supported" | "run_not_supported" | "streaming_not_supported" | "streaming_unavailable" | "privacy_constraint" | "cloud_constraint" | "offline" | "capability_unavailable" | "not_in_model_profile";
255
+ export type Code = "task_not_supported" | "run_not_supported" | "streaming_not_supported" | "streaming_unavailable" | "privacy_constraint" | "cloud_constraint" | "offline" | "capability_unavailable" | "not_in_model_profile" | "input_not_supported" | "output_delivery_not_supported" | "output_format_not_supported" | "locale_not_supported" | "voice_not_available";
248
256
 
249
257
  export type FinishReason = "stop" | "length" | "cancelled" | "error";
250
258
 
251
259
  export type Outcome = "completed" | "error" | "cancelled";
252
260
 
261
+ /**
262
+ * The normalized output of a run, shared by TaskResult and the completed and cancelled
263
+ * stream terminal outcomes (ADR 016). 'type' describes the content representation, not the
264
+ * task: 'text' carries inline text, 'playback' reports a managed, audible effect that has
265
+ * no retrievable bytes, and 'artifact' references retrievable media (ADR 017). A playback
266
+ * output is never an artifact, and an artifact output never implies that anything was
267
+ * played.
268
+ */
269
+ export type TaskOutput = {
270
+ /**
271
+ * The retrievable media the run produced. Required when type is 'artifact'.
272
+ */
273
+ artifact?: MediaArtifact;
274
+ /**
275
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
276
+ */
277
+ playback?: PlaybackOutput;
278
+ /**
279
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
280
+ * visible without being an error.
281
+ */
282
+ speech?: SpeechOutput;
283
+ /**
284
+ * The text the run produced. Required when type is 'text'.
285
+ */
286
+ text?: string;
287
+ /**
288
+ * The content representation: 'text', 'playback' or 'artifact'.
289
+ */
290
+ type: TaskOutputType;
291
+ [property: string]: unknown;
292
+ }
293
+
294
+ /**
295
+ * The retrievable media the run produced. Required when type is 'artifact'.
296
+ *
297
+ * A reference to retrievable media a run produced (ADR 017). It carries no bytes and no
298
+ * location: an engine-owned artifact is read through the engine by id, and an
299
+ * application-owned one was written to an application destination. Media-neutral: audio,
300
+ * images and video share this shape and differ only in mediaType.
301
+ */
302
+ export type MediaArtifact = {
303
+ /**
304
+ * Size of the media in bytes. Always set for an artifact the engine materialized.
305
+ */
306
+ byteLength?: number;
307
+ /**
308
+ * The request's delivery.destinationRef the bytes were written to. Set exactly when owner
309
+ * is 'application'.
310
+ */
311
+ destinationRef?: string;
312
+ /**
313
+ * Duration of time-based media in milliseconds, where the producer knows it.
314
+ */
315
+ durationMs?: number;
316
+ /**
317
+ * Opaque, engine-issued identifier. Never a path, URL or provider identifier.
318
+ */
319
+ id: string;
320
+ /**
321
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
322
+ * artifact or the process ends; the artifact outlives the run that produced it.
323
+ */
324
+ lifetime: "until_disposed";
325
+ /**
326
+ * IANA media type of the bytes, e.g. 'audio/wav'. Encoding parameters ride on the media
327
+ * type (e.g. 'audio/L16;rate=22050').
328
+ */
329
+ mediaType: string;
330
+ /**
331
+ * 'engine': the engine holds the bytes and the application reads them by id until it
332
+ * disposes the artifact. 'application': the bytes were written to the application
333
+ * destination named by destinationRef and the engine holds nothing.
334
+ */
335
+ owner: ArtifactOwner;
336
+ [property: string]: unknown;
337
+ }
338
+
339
+ /**
340
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
341
+ * artifact or the process ends; the artifact outlives the run that produced it.
342
+ */
343
+
344
+ /**
345
+ * 'engine': the engine holds the bytes and the application reads them by id until it
346
+ * disposes the artifact. 'application': the bytes were written to the application
347
+ * destination named by destinationRef and the engine holds nothing.
348
+ */
349
+ export type ArtifactOwner = "engine" | "application";
350
+
351
+ /**
352
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
353
+ */
354
+ export type PlaybackOutput = {
355
+ /**
356
+ * How long audible playback lasted, in milliseconds. For a cancelled run, how long it
357
+ * played before it was stopped.
358
+ */
359
+ durationMs?: number;
360
+ [property: string]: unknown;
361
+ }
362
+
363
+ /**
364
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
365
+ * visible without being an error.
366
+ */
367
+ export type SpeechOutput = {
368
+ /**
369
+ * BCP 47 tag of the locale that was spoken.
370
+ */
371
+ locale: string;
372
+ /**
373
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
374
+ */
375
+ voice?: SpeechOutputVoice;
376
+ [property: string]: unknown;
377
+ }
378
+
379
+ /**
380
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
381
+ */
382
+ export type SpeechOutputVoice = {
383
+ gender?: VoiceGender;
384
+ [property: string]: unknown;
385
+ }
386
+
387
+ /**
388
+ * Perceived gender of a voice, as the platform reports it.
389
+ */
390
+ export type VoiceGender = "female" | "male" | "neutral";
391
+
392
+ /**
393
+ * The content representation: 'text', 'playback' or 'artifact'.
394
+ */
395
+ export type TaskOutputType = "text" | "playback" | "artifact";
396
+
253
397
  /**
254
398
  * The lifecycle phase reached.
255
399
  */
@@ -4,23 +4,25 @@
4
4
  * How a Mode 2 stream run ended. Completion, error, and cancellation are mutually exclusive
5
5
  * terminal outcomes, enforced here as a closed set of three oneOf branches discriminated by
6
6
  * 'outcome' (unlike StreamEvent.type, this set is not open-ended: the three-way terminal
7
- * outcome is a fixed architectural guarantee, not something new outcome kinds get added
8
- * to). Exactly one StreamTerminalOutcome is produced per run, and no further StreamEvent is
9
- * delivered after it (see docs/architecture/architecture.md, 'Cancellation And Fallback').
10
- * This shape is also embedded by value as the payload of the terminal StreamEvent
11
- * (stream-event.schema.json) so it can additionally be exposed standalone, e.g. as a
12
- * completion future/promise a stream handle resolves independently of consuming the full
13
- * event sequence; the two copies must stay structurally identical. Note on
14
- * additionalProperties: per this repo's forward-compatible convention every branch permits
15
- * unknown extra fields, so mutual exclusivity is enforced via the required 'outcome'
16
- * discriminator plus each branch's own required peer field (finalText/error/partialText)
17
- * being present, not by forbidding a payload from also carrying an unrelated stray field
18
- * from another branch's vocabulary.
7
+ * outcome is a fixed architectural guarantee, not something new outcome kinds get added to;
8
+ * the payload of each branch may grow additively). Exactly one StreamTerminalOutcome is
9
+ * produced per run, and no further StreamEvent is delivered after it (see
10
+ * docs/architecture/architecture.md, 'Cancellation And Fallback'). This shape is also
11
+ * embedded by value as the payload of the terminal StreamEvent (stream-event.schema.json)
12
+ * so it can additionally be exposed standalone, e.g. as a completion future/promise a
13
+ * stream handle resolves independently of consuming the full event sequence; the two copies
14
+ * must stay structurally identical. Note on additionalProperties: per this repo's
15
+ * forward-compatible convention every branch permits unknown extra fields, so mutual
16
+ * exclusivity is enforced via the required 'outcome' discriminator plus each branch's own
17
+ * required peer field being present (finalText or output / error), and for 'cancelled' by
18
+ * the discriminator alone, not by forbidding a payload from also carrying an unrelated
19
+ * stray field from another branch's vocabulary.
19
20
  */
20
21
  export type StreamTerminalOutcome = {
21
22
  /**
22
- * The full, cumulative text produced by the run. Equivalent in role to
23
- * TaskResult.output.text for Mode 1.
23
+ * The full, cumulative text produced by a text run. Equivalent in role to
24
+ * TaskResult.output.text for Mode 1. A text run sets it; a non-text run carries output
25
+ * instead.
24
26
  */
25
27
  finalText?: string;
26
28
  /**
@@ -42,6 +44,19 @@ export type StreamTerminalOutcome = {
42
44
  * further fallback attempt is made, per the engine's cancellation guarantee.
43
45
  */
44
46
  outcome: Outcome;
47
+ /**
48
+ * The normalized output of the run, the same shape run() returns in TaskResult.output. Set
49
+ * for every non-text run; a text run may set it alongside finalText. See
50
+ * task-output.schema.json.
51
+ *
52
+ * What a cancelled non-text run had already produced: a playback run that committed (audio
53
+ * may have been heard) carries a playback output, and an artifact run cancelled while the
54
+ * engine was writing its artifact to an application destination carries that
55
+ * application-owned artifact, whose bytes the write left at the destination. Absent when
56
+ * nothing was produced, e.g. an artifact run cancelled before its artifact was handed over,
57
+ * whose partial media the engine discards. See task-output.schema.json.
58
+ */
59
+ output?: TaskOutput;
45
60
  /**
46
61
  * Normalized execution provenance: which target ran, its declared locality, the configured
47
62
  * and reported model, and how fallback and routing played out. See
@@ -76,9 +91,13 @@ export type StreamTerminalOutcome = {
76
91
  */
77
92
  error?: Error;
78
93
  /**
79
- * Whatever cumulative text had already been delivered via content_delta/content_snapshot
80
- * StreamEvents before the cancellation point. May be empty if cancellation occurred before
81
- * any content was produced.
94
+ * Whatever cumulative text a text run had already delivered before it failed after
95
+ * committing to its provider. Absent when nothing was delivered.
96
+ *
97
+ * Whatever cumulative text a text run had already delivered via
98
+ * content_delta/content_snapshot StreamEvents before the cancellation point. Always set for
99
+ * a text run, and empty if cancellation occurred before any content was produced. A
100
+ * non-text run never sets it.
82
101
  */
83
102
  partialText?: string;
84
103
  /**
@@ -216,6 +235,13 @@ export type ExecutionProvenance = {
216
235
  }
217
236
 
218
237
  export type ExecutionProvenanceAttempt = {
238
+ /**
239
+ * Whether the run committed to this provider during the attempt: its first content was
240
+ * delivered, it signalled the first possible audible effect, or it handed over an artifact.
241
+ * After commit a failure ends the run instead of falling back. Absent means the attempt did
242
+ * not commit.
243
+ */
244
+ committed?: boolean;
219
245
  /**
220
246
  * Normalized error class of a failed attempt.
221
247
  */
@@ -248,7 +274,7 @@ export type ExecutionProvenanceRouteRejection = {
248
274
  [property: string]: unknown;
249
275
  }
250
276
 
251
- export type Code = "task_not_supported" | "run_not_supported" | "streaming_not_supported" | "streaming_unavailable" | "privacy_constraint" | "cloud_constraint" | "offline" | "capability_unavailable" | "not_in_model_profile";
277
+ export type Code = "task_not_supported" | "run_not_supported" | "streaming_not_supported" | "streaming_unavailable" | "privacy_constraint" | "cloud_constraint" | "offline" | "capability_unavailable" | "not_in_model_profile" | "input_not_supported" | "output_delivery_not_supported" | "output_format_not_supported" | "locale_not_supported" | "voice_not_available";
252
278
 
253
279
  /**
254
280
  * How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end),
@@ -261,6 +287,153 @@ export type FinishReason = "stop" | "length" | "cancelled" | "error";
261
287
 
262
288
  export type Outcome = "completed" | "error" | "cancelled";
263
289
 
290
+ /**
291
+ * The normalized output of the run, the same shape run() returns in TaskResult.output. Set
292
+ * for every non-text run; a text run may set it alongside finalText. See
293
+ * task-output.schema.json.
294
+ *
295
+ * The normalized output of a run, shared by TaskResult and the completed and cancelled
296
+ * stream terminal outcomes (ADR 016). 'type' describes the content representation, not the
297
+ * task: 'text' carries inline text, 'playback' reports a managed, audible effect that has
298
+ * no retrievable bytes, and 'artifact' references retrievable media (ADR 017). A playback
299
+ * output is never an artifact, and an artifact output never implies that anything was
300
+ * played.
301
+ *
302
+ * What a cancelled non-text run had already produced: a playback run that committed (audio
303
+ * may have been heard) carries a playback output, and an artifact run cancelled while the
304
+ * engine was writing its artifact to an application destination carries that
305
+ * application-owned artifact, whose bytes the write left at the destination. Absent when
306
+ * nothing was produced, e.g. an artifact run cancelled before its artifact was handed over,
307
+ * whose partial media the engine discards. See task-output.schema.json.
308
+ */
309
+ export type TaskOutput = {
310
+ /**
311
+ * The retrievable media the run produced. Required when type is 'artifact'.
312
+ */
313
+ artifact?: MediaArtifact;
314
+ /**
315
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
316
+ */
317
+ playback?: PlaybackOutput;
318
+ /**
319
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
320
+ * visible without being an error.
321
+ */
322
+ speech?: SpeechOutput;
323
+ /**
324
+ * The text the run produced. Required when type is 'text'.
325
+ */
326
+ text?: string;
327
+ /**
328
+ * The content representation: 'text', 'playback' or 'artifact'.
329
+ */
330
+ type: TaskOutputType;
331
+ [property: string]: unknown;
332
+ }
333
+
334
+ /**
335
+ * The retrievable media the run produced. Required when type is 'artifact'.
336
+ *
337
+ * A reference to retrievable media a run produced (ADR 017). It carries no bytes and no
338
+ * location: an engine-owned artifact is read through the engine by id, and an
339
+ * application-owned one was written to an application destination. Media-neutral: audio,
340
+ * images and video share this shape and differ only in mediaType.
341
+ */
342
+ export type MediaArtifact = {
343
+ /**
344
+ * Size of the media in bytes. Always set for an artifact the engine materialized.
345
+ */
346
+ byteLength?: number;
347
+ /**
348
+ * The request's delivery.destinationRef the bytes were written to. Set exactly when owner
349
+ * is 'application'.
350
+ */
351
+ destinationRef?: string;
352
+ /**
353
+ * Duration of time-based media in milliseconds, where the producer knows it.
354
+ */
355
+ durationMs?: number;
356
+ /**
357
+ * Opaque, engine-issued identifier. Never a path, URL or provider identifier.
358
+ */
359
+ id: string;
360
+ /**
361
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
362
+ * artifact or the process ends; the artifact outlives the run that produced it.
363
+ */
364
+ lifetime: "until_disposed";
365
+ /**
366
+ * IANA media type of the bytes, e.g. 'audio/wav'. Encoding parameters ride on the media
367
+ * type (e.g. 'audio/L16;rate=22050').
368
+ */
369
+ mediaType: string;
370
+ /**
371
+ * 'engine': the engine holds the bytes and the application reads them by id until it
372
+ * disposes the artifact. 'application': the bytes were written to the application
373
+ * destination named by destinationRef and the engine holds nothing.
374
+ */
375
+ owner: ArtifactOwner;
376
+ [property: string]: unknown;
377
+ }
378
+
379
+ /**
380
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
381
+ * artifact or the process ends; the artifact outlives the run that produced it.
382
+ */
383
+
384
+ /**
385
+ * 'engine': the engine holds the bytes and the application reads them by id until it
386
+ * disposes the artifact. 'application': the bytes were written to the application
387
+ * destination named by destinationRef and the engine holds nothing.
388
+ */
389
+ export type ArtifactOwner = "engine" | "application";
390
+
391
+ /**
392
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
393
+ */
394
+ export type PlaybackOutput = {
395
+ /**
396
+ * How long audible playback lasted, in milliseconds. For a cancelled run, how long it
397
+ * played before it was stopped.
398
+ */
399
+ durationMs?: number;
400
+ [property: string]: unknown;
401
+ }
402
+
403
+ /**
404
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
405
+ * visible without being an error.
406
+ */
407
+ export type SpeechOutput = {
408
+ /**
409
+ * BCP 47 tag of the locale that was spoken.
410
+ */
411
+ locale: string;
412
+ /**
413
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
414
+ */
415
+ voice?: SpeechOutputVoice;
416
+ [property: string]: unknown;
417
+ }
418
+
419
+ /**
420
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
421
+ */
422
+ export type SpeechOutputVoice = {
423
+ gender?: VoiceGender;
424
+ [property: string]: unknown;
425
+ }
426
+
427
+ /**
428
+ * Perceived gender of a voice, as the platform reports it.
429
+ */
430
+ export type VoiceGender = "female" | "male" | "neutral";
431
+
432
+ /**
433
+ * The content representation: 'text', 'playback' or 'artifact'.
434
+ */
435
+ export type TaskOutputType = "text" | "playback" | "artifact";
436
+
264
437
  /**
265
438
  * Required metadata providing an overview of the execution result and performance metrics.
266
439
  * Same shape as TaskResult.telemetry.
@@ -0,0 +1,137 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * The normalized output of a run, shared by TaskResult and the completed and cancelled
5
+ * stream terminal outcomes (ADR 016). 'type' describes the content representation, not the
6
+ * task: 'text' carries inline text, 'playback' reports a managed, audible effect that has
7
+ * no retrievable bytes, and 'artifact' references retrievable media (ADR 017). A playback
8
+ * output is never an artifact, and an artifact output never implies that anything was
9
+ * played.
10
+ */
11
+ export type TaskOutput = {
12
+ /**
13
+ * The retrievable media the run produced. Required when type is 'artifact'.
14
+ */
15
+ artifact?: MediaArtifact;
16
+ /**
17
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
18
+ */
19
+ playback?: PlaybackOutput;
20
+ /**
21
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
22
+ * visible without being an error.
23
+ */
24
+ speech?: SpeechOutput;
25
+ /**
26
+ * The text the run produced. Required when type is 'text'.
27
+ */
28
+ text?: string;
29
+ /**
30
+ * The content representation: 'text', 'playback' or 'artifact'.
31
+ */
32
+ type: TaskOutputType;
33
+ [property: string]: unknown;
34
+ }
35
+
36
+ /**
37
+ * The retrievable media the run produced. Required when type is 'artifact'.
38
+ *
39
+ * A reference to retrievable media a run produced (ADR 017). It carries no bytes and no
40
+ * location: an engine-owned artifact is read through the engine by id, and an
41
+ * application-owned one was written to an application destination. Media-neutral: audio,
42
+ * images and video share this shape and differ only in mediaType.
43
+ */
44
+ export type MediaArtifact = {
45
+ /**
46
+ * Size of the media in bytes. Always set for an artifact the engine materialized.
47
+ */
48
+ byteLength?: number;
49
+ /**
50
+ * The request's delivery.destinationRef the bytes were written to. Set exactly when owner
51
+ * is 'application'.
52
+ */
53
+ destinationRef?: string;
54
+ /**
55
+ * Duration of time-based media in milliseconds, where the producer knows it.
56
+ */
57
+ durationMs?: number;
58
+ /**
59
+ * Opaque, engine-issued identifier. Never a path, URL or provider identifier.
60
+ */
61
+ id: string;
62
+ /**
63
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
64
+ * artifact or the process ends; the artifact outlives the run that produced it.
65
+ */
66
+ lifetime: "until_disposed";
67
+ /**
68
+ * IANA media type of the bytes, e.g. 'audio/wav'. Encoding parameters ride on the media
69
+ * type (e.g. 'audio/L16;rate=22050').
70
+ */
71
+ mediaType: string;
72
+ /**
73
+ * 'engine': the engine holds the bytes and the application reads them by id until it
74
+ * disposes the artifact. 'application': the bytes were written to the application
75
+ * destination named by destinationRef and the engine holds nothing.
76
+ */
77
+ owner: ArtifactOwner;
78
+ [property: string]: unknown;
79
+ }
80
+
81
+ /**
82
+ * How long the engine keeps the bytes. 'until_disposed': until the application disposes the
83
+ * artifact or the process ends; the artifact outlives the run that produced it.
84
+ */
85
+
86
+ /**
87
+ * 'engine': the engine holds the bytes and the application reads them by id until it
88
+ * disposes the artifact. 'application': the bytes were written to the application
89
+ * destination named by destinationRef and the engine holds nothing.
90
+ */
91
+ export type ArtifactOwner = "engine" | "application";
92
+
93
+ /**
94
+ * Completion of managed playback. Required when type is 'playback'. Carries no media.
95
+ */
96
+ export type PlaybackOutput = {
97
+ /**
98
+ * How long audible playback lasted, in milliseconds. For a cancelled run, how long it
99
+ * played before it was stopped.
100
+ */
101
+ durationMs?: number;
102
+ [property: string]: unknown;
103
+ }
104
+
105
+ /**
106
+ * The locale and voice traits a text-to-speech run actually used, so an unmet preference is
107
+ * visible without being an error.
108
+ */
109
+ export type SpeechOutput = {
110
+ /**
111
+ * BCP 47 tag of the locale that was spoken.
112
+ */
113
+ locale: string;
114
+ /**
115
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
116
+ */
117
+ voice?: SpeechOutputVoice;
118
+ [property: string]: unknown;
119
+ }
120
+
121
+ /**
122
+ * Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
123
+ */
124
+ export type SpeechOutputVoice = {
125
+ gender?: VoiceGender;
126
+ [property: string]: unknown;
127
+ }
128
+
129
+ /**
130
+ * Perceived gender of a voice, as the platform reports it.
131
+ */
132
+ export type VoiceGender = "female" | "male" | "neutral";
133
+
134
+ /**
135
+ * The content representation: 'text', 'playback' or 'artifact'.
136
+ */
137
+ export type TaskOutputType = "text" | "playback" | "artifact";