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

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 (52) hide show
  1. package/dist/generated/execution-provenance.d.ts +1 -1
  2. package/dist/generated/execution-provenance.d.ts.map +1 -1
  3. package/dist/generated/inderun-error.d.ts +1 -1
  4. package/dist/generated/inderun-error.d.ts.map +1 -1
  5. package/dist/generated/index.d.ts +3 -0
  6. package/dist/generated/index.d.ts.map +1 -1
  7. package/dist/generated/provider-capability-snapshot.d.ts +370 -0
  8. package/dist/generated/provider-capability-snapshot.d.ts.map +1 -0
  9. package/dist/generated/provider-capability-snapshot.js +2 -0
  10. package/dist/generated/provider-descriptor.d.ts +264 -0
  11. package/dist/generated/provider-descriptor.d.ts.map +1 -0
  12. package/dist/generated/provider-descriptor.js +2 -0
  13. package/dist/generated/provider-dynamic-capabilities.d.ts +99 -0
  14. package/dist/generated/provider-dynamic-capabilities.d.ts.map +1 -0
  15. package/dist/generated/provider-dynamic-capabilities.js +2 -0
  16. package/dist/generated/route-plan.d.ts +47 -3
  17. package/dist/generated/route-plan.d.ts.map +1 -1
  18. package/dist/generated/route-planner-input.d.ts +417 -32
  19. package/dist/generated/route-planner-input.d.ts.map +1 -1
  20. package/dist/generated/schemas.d.ts +458 -85
  21. package/dist/generated/schemas.d.ts.map +1 -1
  22. package/dist/generated/schemas.js +549 -104
  23. package/dist/generated/stream-event.d.ts +1 -1
  24. package/dist/generated/stream-event.d.ts.map +1 -1
  25. package/dist/generated/stream-terminal-outcome.d.ts +1 -1
  26. package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
  27. package/dist/generated/task-result.d.ts +1 -1
  28. package/dist/generated/task-result.d.ts.map +1 -1
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -2
  32. package/dist/types.d.ts +7 -1
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/validators.d.ts +9 -0
  35. package/dist/validators.d.ts.map +1 -1
  36. package/dist/validators.js +24 -1
  37. package/package.json +1 -1
  38. package/src/generated/execution-provenance.ts +1 -1
  39. package/src/generated/inderun-error.ts +1 -1
  40. package/src/generated/index.ts +3 -0
  41. package/src/generated/provider-capability-snapshot.ts +388 -0
  42. package/src/generated/provider-descriptor.ts +278 -0
  43. package/src/generated/provider-dynamic-capabilities.ts +103 -0
  44. package/src/generated/route-plan.ts +49 -3
  45. package/src/generated/route-planner-input.ts +437 -36
  46. package/src/generated/schemas.ts +552 -104
  47. package/src/generated/stream-event.ts +1 -1
  48. package/src/generated/stream-terminal-outcome.ts +1 -1
  49. package/src/generated/task-result.ts +1 -1
  50. package/src/index.ts +13 -1
  51. package/src/types.ts +7 -0
  52. package/src/validators.ts +39 -0
@@ -27,11 +27,15 @@ export type RoutePlannerInput = {
27
27
  */
28
28
  preferences: Preferences;
29
29
  /**
30
- * Static descriptors plus dynamic capability snapshots for planning.
30
+ * Static descriptors plus dynamic capability checks for planning. Both shapes are the
31
+ * provider schemas themselves, shared by $ref, so the planner reads exactly what
32
+ * checkCapabilities() reports.
31
33
  */
32
34
  providers: Provider[];
33
35
  /**
34
- * Minimal task descriptor for provider task matching.
36
+ * Task descriptor for provider task matching: the kind plus the requirements routing can
37
+ * check against declared capabilities. Absent requirement fields are never checked, so a
38
+ * text request carries the kind alone.
35
39
  */
36
40
  task: Task;
37
41
  [property: string]: unknown;
@@ -52,7 +56,7 @@ export type Constraints = {
52
56
  /**
53
57
  * Privacy requirement or preference for execution placement.
54
58
  */
55
- privacy?: PrivacyEnum;
59
+ privacy?: Privacy;
56
60
  [property: string]: unknown;
57
61
  }
58
62
 
@@ -64,7 +68,7 @@ export type Cloud = "forbidden" | "allowed" | "required";
64
68
  /**
65
69
  * Privacy requirement or preference for execution placement.
66
70
  */
67
- export type PrivacyEnum = "local_required" | "local_preferred" | "cloud_allowed" | "cloud_required";
71
+ export type Privacy = "local_required" | "local_preferred" | "cloud_allowed" | "cloud_required";
68
72
 
69
73
  /**
70
74
  * Interaction mode the caller is requesting. Absent means 'run' (Mode 1), so planner inputs
@@ -109,80 +113,477 @@ export type Preferences = {
109
113
  export type OptimizeFor = "privacy" | "latency" | "cost" | "balanced";
110
114
 
111
115
  export type Provider = {
112
- capabilities: Capabilities;
113
- descriptor: Descriptor;
116
+ /**
117
+ * The provider's live capability check, already folded by the engine (for example,
118
+ * streamingAvailable is false when the provider declares streaming but does not implement
119
+ * it).
120
+ */
121
+ capabilities: ProviderDynamicCapabilities;
122
+ /**
123
+ * The provider's static capability declaration.
124
+ */
125
+ descriptor: ProviderDescriptor;
114
126
  [property: string]: unknown;
115
127
  }
116
128
 
117
- export type Capabilities = {
129
+ /**
130
+ * The provider's live capability check, already folded by the engine (for example,
131
+ * streamingAvailable is false when the provider declares streaming but does not implement
132
+ * it).
133
+ *
134
+ * A provider's live capability check, evaluated on the current host when routing or when
135
+ * checkCapabilities() is called. Unlike the descriptor it can change between calls.
136
+ */
137
+ export type ProviderDynamicCapabilities = {
138
+ /**
139
+ * Whether the provider is available and functional on this host right now.
140
+ */
118
141
  available: boolean;
119
142
  /**
120
- * Whether cancellation is honored right now in this host environment. Absent inherits the
121
- * static descriptor.cancel value (any value other than 'none' means available).
143
+ * Whether cancellation is honored on this host right now. Absent inherits the static
144
+ * descriptor.cancel value: any value other than 'none' means available. Never null.
145
+ */
146
+ cancellationAvailable?: boolean;
147
+ /**
148
+ * Why the provider is unavailable, when available is false.
149
+ */
150
+ reason?: string;
151
+ /**
152
+ * Whether the provider can stream (Mode 2) on this host right now. Absent inherits the
153
+ * static descriptor.supports.streaming value; only set it when the host takes streaming
154
+ * away from a provider that otherwise declares it. Never null.
155
+ */
156
+ streamingAvailable?: boolean;
157
+ /**
158
+ * Why streaming is unavailable, when streamingAvailable is false. Absent lets the route
159
+ * planner synthesize a default message.
160
+ */
161
+ streamingUnavailableReason?: string;
162
+ /**
163
+ * Per-task overrides of the provider-level check, for tasks whose availability differs on
164
+ * this host, e.g. a voice that is not installed. Every field of an entry is optional and
165
+ * absent inherits the provider-level value; a false at either level wins.
166
+ */
167
+ taskCapabilities?: ProviderTaskAvailability[];
168
+ [property: string]: unknown;
169
+ }
170
+
171
+ /**
172
+ * The live check for one task kind.
173
+ */
174
+ export type ProviderTaskAvailability = {
175
+ /**
176
+ * Whether the task can run on this host right now. Absent inherits the provider-level
177
+ * available. Never null.
178
+ */
179
+ available?: boolean;
180
+ /**
181
+ * Whether cancellation is honored for this task right now. Absent inherits. Never null.
122
182
  */
123
183
  cancellationAvailable?: boolean;
124
- reason?: string;
125
184
  /**
126
- * Whether the provider can stream right now in this host environment. Absent inherits the
127
- * static descriptor.supports.streaming value.
185
+ * The task kind this entry describes.
186
+ */
187
+ kind: string;
188
+ /**
189
+ * BCP 47 locales available for this task right now. Absent means the provider cannot
190
+ * enumerate them.
191
+ */
192
+ locales?: string[];
193
+ /**
194
+ * Why the task is unavailable, when available is false.
195
+ */
196
+ reason?: string;
197
+ /**
198
+ * Whether the task can stream on this host right now. Absent inherits. Never null.
128
199
  */
129
200
  streamingAvailable?: boolean;
130
201
  /**
131
- * Human-readable explanation used when streamingAvailable is false. Absent lets the planner
132
- * synthesize a default message.
202
+ * Why streaming is unavailable for this task, when streamingAvailable is false.
133
203
  */
134
204
  streamingUnavailableReason?: string;
205
+ /**
206
+ * Voices available for this task right now. Absent means the provider cannot enumerate
207
+ * them; a request that requires a voice then never routes to it.
208
+ */
209
+ voices?: ProviderVoice[];
135
210
  [property: string]: unknown;
136
211
  }
137
212
 
138
- export type Descriptor = {
213
+ /**
214
+ * Provider-neutral traits of one available voice. Carries no provider voice identifier.
215
+ */
216
+ export type ProviderVoice = {
217
+ gender?: VoiceGender;
139
218
  /**
140
- * Cancellation guarantee the provider offers. Carried for route explanations and telemetry;
141
- * the planner does not filter on it.
219
+ * BCP 47 locale the voice speaks.
142
220
  */
143
- cancel?: Cancel;
144
- id: string;
221
+ locale: string;
145
222
  /**
146
- * Descriptor privacy metadata used to enforce local/cloud routing rules.
223
+ * Whether using the voice sends data off the device. Absent inherits the task's privacy
224
+ * posture.
147
225
  */
148
- privacy?: PrivacyObject;
149
- supports: Supports;
150
- tasks: string[];
151
- type: Type;
226
+ networkRequired?: boolean;
152
227
  [property: string]: unknown;
153
228
  }
154
229
 
155
230
  /**
156
- * Cancellation guarantee the provider offers. Carried for route explanations and telemetry;
157
- * the planner does not filter on it.
231
+ * Perceived gender of a voice, as the platform reports it.
158
232
  */
159
- export type Cancel = "hard" | "soft" | "none";
233
+ export type VoiceGender = "female" | "male" | "neutral";
160
234
 
161
235
  /**
162
- * Descriptor privacy metadata used to enforce local/cloud routing rules.
236
+ * The provider's static capability declaration.
237
+ *
238
+ * A provider's static capability declaration: identity, placement, transport, supported
239
+ * interaction modes and tasks, cancellation guarantee, resource limits and privacy posture.
240
+ * It does not change while the provider is registered. The route planner,
241
+ * checkCapabilities() and execution provenance all read this one shape.
163
242
  */
164
- export type PrivacyObject = {
243
+ export type ProviderDescriptor = {
244
+ /**
245
+ * Cancellation guarantee: 'hard' stops processing including remote work, 'soft' stops
246
+ * reading locally while remote work may continue, 'none' means cancellation is unsupported.
247
+ * Independently of this value, the engine delivers no event after a cancel.
248
+ */
249
+ cancel: CancelSemantics;
250
+ /**
251
+ * Unique identifier of the provider instance (a target), e.g. 'apple_foundation_models' or
252
+ * 'openai_compatible_cloud:gpt-5-mini'. Model profiles list targets by this id.
253
+ */
254
+ id: string;
255
+ /**
256
+ * Optional input and output resource limits.
257
+ */
258
+ limits?: ProviderLimits;
259
+ /**
260
+ * The model this provider instance is bound to, when it can name one. Cloud providers
261
+ * report the model id they send; platform-managed models report an opaque platform alias
262
+ * rather than a guessed weight name. Absent means the provider cannot name its model.
263
+ */
264
+ model?: string;
265
+ /**
266
+ * Data-egress posture, used to enforce local and cloud routing rules. Absent means a local
267
+ * or edge provider is treated as keeping data on the device and a cloud provider as sending
268
+ * it off.
269
+ */
270
+ privacy?: ProviderPrivacy;
271
+ /**
272
+ * How a streaming provider delivers incremental output: individual tokens, larger chunks,
273
+ * or whole snapshots. Absent for providers that do not stream.
274
+ */
275
+ streamingStyle?: StreamingStyle;
276
+ /**
277
+ * Interaction modes and features the provider statically declares.
278
+ */
279
+ supports: ProviderSupports;
280
+ /**
281
+ * What the provider can do for each task: accepted inputs, interaction modes, output
282
+ * deliveries and formats, cancellation, locales and privacy. When present it is
283
+ * authoritative for routing and must list every task the provider serves. When absent (a
284
+ * legacy descriptor), routing infers exactly one entry — 'text_to_text' with text input,
285
+ * inline output, run/stream from supports and cancel from cancel — if tasks contains
286
+ * 'text_to_text', and nothing for any other task: a legacy descriptor is never treated as
287
+ * capable of a non-text task.
288
+ */
289
+ taskCapabilities?: ProviderTaskCapability[];
290
+ /**
291
+ * Task kinds the provider supports, e.g. 'text_to_text'. When taskCapabilities is present
292
+ * it must describe the same kinds and is what routing reads; without it, routing infers
293
+ * capabilities for 'text_to_text' alone (see taskCapabilities).
294
+ */
295
+ tasks: string[];
296
+ /**
297
+ * How the engine reaches the provider: in-process runtime, operating-system service,
298
+ * buffered HTTP, server-sent events, or a realtime connection.
299
+ */
300
+ transport: ProviderTransport;
301
+ /**
302
+ * Execution placement: 'local' (on the device), 'edge', or 'cloud'.
303
+ */
304
+ type: ProviderType;
305
+ [property: string]: unknown;
306
+ }
307
+
308
+ /**
309
+ * Cancellation guarantee: 'hard' stops processing including remote work, 'soft' stops
310
+ * reading locally while remote work may continue, 'none' means cancellation is unsupported.
311
+ * Independently of this value, the engine delivers no event after a cancel.
312
+ *
313
+ * Cancellation guarantee for this task. It may differ from the provider-level cancel, e.g.
314
+ * when stopping playback is immediate but a synthesis request cannot be aborted.
315
+ */
316
+ export type CancelSemantics = "hard" | "soft" | "none";
317
+
318
+ /**
319
+ * Optional input and output resource limits.
320
+ */
321
+ export type ProviderLimits = {
322
+ /**
323
+ * Longest accepted or produced audio, in seconds.
324
+ */
325
+ maxAudioSeconds?: number;
326
+ /**
327
+ * Largest accepted image, in bytes.
328
+ */
329
+ maxImageBytes?: number;
330
+ /**
331
+ * Largest accepted input, in tokens.
332
+ */
333
+ maxInputTokens?: number;
334
+ /**
335
+ * Largest output the provider produces, in tokens.
336
+ */
337
+ maxOutputTokens?: number;
338
+ [property: string]: unknown;
339
+ }
340
+
341
+ /**
342
+ * Data-egress posture, used to enforce local and cloud routing rules. Absent means a local
343
+ * or edge provider is treated as keeping data on the device and a cloud provider as sending
344
+ * it off.
345
+ *
346
+ * Data-egress posture for this task when it differs from the provider-level privacy, e.g. a
347
+ * provider whose speech synthesis uses a network service. Absent inherits
348
+ * descriptor.privacy.
349
+ */
350
+ export type ProviderPrivacy = {
351
+ /**
352
+ * Whether request content leaves the device.
353
+ */
165
354
  dataLeavesDevice: boolean;
166
- regions?: string[];
355
+ /**
356
+ * Geographic regions where a cloud provider processes data.
357
+ */
358
+ regions?: string[];
359
+ [property: string]: unknown;
360
+ }
361
+
362
+ /**
363
+ * How a streaming provider delivers incremental output: individual tokens, larger chunks,
364
+ * or whole snapshots. Absent for providers that do not stream.
365
+ */
366
+ export type StreamingStyle = "tokens" | "chunks" | "snapshots";
367
+
368
+ /**
369
+ * Interaction modes and features the provider statically declares.
370
+ */
371
+ export type ProviderSupports = {
372
+ /**
373
+ * Whether the provider accepts non-text inputs such as images or audio.
374
+ */
375
+ multimodal: boolean;
376
+ /**
377
+ * Whether the provider supports Mode 3 realtime sessions. Reserved; no engine implements
378
+ * Mode 3 yet.
379
+ */
380
+ realtime: boolean;
381
+ /**
382
+ * Whether the provider emits reasoning events alongside content.
383
+ */
384
+ reasoningEvents: boolean;
385
+ /**
386
+ * Whether the provider supports Mode 1 run (request/response).
387
+ */
388
+ run: boolean;
389
+ /**
390
+ * Whether the provider supports Mode 2 stream. A provider that declares it must also
391
+ * implement the streaming adapter; the engines report it as unavailable otherwise.
392
+ */
393
+ streaming: boolean;
394
+ /**
395
+ * Whether the provider supports structured output constrained by a JSON schema.
396
+ */
397
+ structuredOutput: boolean;
398
+ /**
399
+ * Whether the provider supports tool calling.
400
+ */
401
+ tools: boolean;
402
+ [property: string]: unknown;
403
+ }
404
+
405
+ /**
406
+ * The provider's static capabilities for one task kind.
407
+ */
408
+ export type ProviderTaskCapability = {
409
+ /**
410
+ * Cancellation guarantee for this task. It may differ from the provider-level cancel, e.g.
411
+ * when stopping playback is immediate but a synthesis request cannot be aborted.
412
+ */
413
+ cancel: CancelSemantics;
414
+ /**
415
+ * Input media kinds the provider accepts for this task.
416
+ */
417
+ inputs: [TaskInputKind, ...TaskInputKind[]];
418
+ /**
419
+ * Interaction modes the provider supports for this task.
420
+ */
421
+ interaction: ProviderTaskInteraction;
422
+ /**
423
+ * The task kind this entry describes, e.g. 'text_to_speech'.
424
+ */
425
+ kind: string;
426
+ /**
427
+ * BCP 47 locales the provider can serve for this task, when it knows them statically.
428
+ * Absent means unknown; the dynamic check may report them instead.
429
+ */
430
+ locales?: string[];
431
+ /**
432
+ * How results of this task can be delivered. A provider lists only what it really produces:
433
+ * a provider that can only play audio lists 'playback' and never 'artifact'.
434
+ */
435
+ outputs: [ProviderTaskOutput, ...ProviderTaskOutput[]];
436
+ /**
437
+ * Data-egress posture for this task when it differs from the provider-level privacy, e.g. a
438
+ * provider whose speech synthesis uses a network service. Absent inherits
439
+ * descriptor.privacy.
440
+ */
441
+ privacy?: ProviderPrivacy;
167
442
  [property: string]: unknown;
168
443
  }
169
444
 
170
- export type Supports = {
445
+ /**
446
+ * A kind of input medium a task consumes.
447
+ */
448
+ export type TaskInputKind = "text" | "image" | "audio";
449
+
450
+ /**
451
+ * Interaction modes the provider supports for this task.
452
+ */
453
+ export type ProviderTaskInteraction = {
454
+ /**
455
+ * Whether the provider supports Mode 1 run for this task.
456
+ */
171
457
  run: boolean;
172
458
  /**
173
- * Whether the provider statically declares Mode-2 streaming. Absent is treated as false: a
174
- * descriptor that predates this field cannot be assumed to stream.
459
+ * Whether the provider supports Mode 2 stream for this task.
175
460
  */
176
- streaming?: boolean;
461
+ stream: boolean;
177
462
  [property: string]: unknown;
178
463
  }
179
464
 
180
- export type Type = "local" | "edge" | "cloud";
465
+ /**
466
+ * One way the provider can deliver a task's result.
467
+ */
468
+ export type ProviderTaskOutput = {
469
+ delivery: OutputDelivery;
470
+ /**
471
+ * Media types the provider can produce with this delivery, e.g. 'audio/wav'. Absent means
472
+ * the provider does not declare them; a request that requires specific media types never
473
+ * routes to such an output.
474
+ */
475
+ mediaTypes?: string[];
476
+ [property: string]: unknown;
477
+ }
181
478
 
182
479
  /**
183
- * Minimal task descriptor for provider task matching.
480
+ * How a task's result reaches the application: 'inline' content in the result (text),
481
+ * 'playback' as a managed, audible effect on the device with no retrievable bytes, or
482
+ * 'artifact' as retrievable media.
483
+ */
484
+ export type OutputDelivery = "inline" | "playback" | "artifact";
485
+
486
+ /**
487
+ * How the engine reaches the provider: in-process runtime, operating-system service,
488
+ * buffered HTTP, server-sent events, or a realtime connection.
489
+ */
490
+ export type ProviderTransport = "in_process" | "system_service" | "http" | "sse" | "realtime";
491
+
492
+ /**
493
+ * Execution placement: 'local' (on the device), 'edge', or 'cloud'.
494
+ */
495
+ export type ProviderType = "local" | "edge" | "cloud";
496
+
497
+ /**
498
+ * Task descriptor for provider task matching: the kind plus the requirements routing can
499
+ * check against declared capabilities. Absent requirement fields are never checked, so a
500
+ * text request carries the kind alone.
184
501
  */
185
502
  export type Task = {
503
+ /**
504
+ * The output delivery the request requires. Absent for text, whose delivery is implicitly
505
+ * inline.
506
+ */
507
+ delivery?: DeliveryRequirement;
508
+ /**
509
+ * Input media kinds the request carries. Every one must be accepted by the provider's task
510
+ * capability. The SDKs send ['text'] for text_to_text.
511
+ */
512
+ inputs?: TaskInputKind[];
513
+ /**
514
+ * The task kind, matched against the providers' task capabilities.
515
+ */
186
516
  kind: string;
517
+ /**
518
+ * The locale the request requires. Under 'language' matching the region is a preference: a
519
+ * provider known to offer the exact tag ranks ahead of an otherwise equal one. A provider
520
+ * that cannot enumerate its locales is not rejected on this basis; it must fail before
521
+ * committing instead.
522
+ */
523
+ locale?: LocaleRequirement;
524
+ /**
525
+ * Voice traits the request asks for. Only a 'required' voice can reject a provider; a
526
+ * 'preferred' one shapes which listed voice the plan binds a candidate to, always within
527
+ * the request's privacy policy.
528
+ */
529
+ voice?: VoiceRequirement;
187
530
  [property: string]: unknown;
188
531
  }
532
+
533
+ /**
534
+ * The output delivery the request requires. Absent for text, whose delivery is implicitly
535
+ * inline.
536
+ */
537
+ export type DeliveryRequirement = {
538
+ /**
539
+ * Acceptable media types; the provider must declare at least one for the requested
540
+ * delivery. Absent means any.
541
+ */
542
+ mediaTypes?: string[];
543
+ mode: OutputDelivery;
544
+ [property: string]: unknown;
545
+ }
546
+
547
+ /**
548
+ * The locale the request requires. Under 'language' matching the region is a preference: a
549
+ * provider known to offer the exact tag ranks ahead of an otherwise equal one. A provider
550
+ * that cannot enumerate its locales is not rejected on this basis; it must fail before
551
+ * committing instead.
552
+ */
553
+ export type LocaleRequirement = {
554
+ /**
555
+ * 'exact' requires the full tag; 'language' requires only the primary language subtag and
556
+ * treats the region as a preference.
557
+ */
558
+ match: LocaleMatch;
559
+ /**
560
+ * BCP 47 tag.
561
+ */
562
+ tag: string;
563
+ [property: string]: unknown;
564
+ }
565
+
566
+ /**
567
+ * 'exact' requires the full tag; 'language' requires only the primary language subtag and
568
+ * treats the region as a preference.
569
+ */
570
+ export type LocaleMatch = "exact" | "language";
571
+
572
+ /**
573
+ * Voice traits the request asks for. Only a 'required' voice can reject a provider; a
574
+ * 'preferred' one shapes which listed voice the plan binds a candidate to, always within
575
+ * the request's privacy policy.
576
+ */
577
+ export type VoiceRequirement = {
578
+ gender?: VoiceGender;
579
+ /**
580
+ * 'required' takes part in routing; 'preferred' does not.
581
+ */
582
+ requirement: RequirementLevel;
583
+ [property: string]: unknown;
584
+ }
585
+
586
+ /**
587
+ * 'required' takes part in routing; 'preferred' does not.
588
+ */
589
+ export type RequirementLevel = "required" | "preferred";