@independo/inderun-contracts 0.3.3-rc.2 → 0.4.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 (41) hide show
  1. package/dist/generated/execution-provenance.d.ts +95 -0
  2. package/dist/generated/execution-provenance.d.ts.map +1 -0
  3. package/dist/generated/execution-provenance.js +2 -0
  4. package/dist/generated/inderun-error.d.ts +102 -0
  5. package/dist/generated/inderun-error.d.ts.map +1 -1
  6. package/dist/generated/index.d.ts +1 -0
  7. package/dist/generated/index.d.ts.map +1 -1
  8. package/dist/generated/route-plan.d.ts +5 -3
  9. package/dist/generated/route-plan.d.ts.map +1 -1
  10. package/dist/generated/route-planner-input.d.ts +26 -0
  11. package/dist/generated/route-planner-input.d.ts.map +1 -1
  12. package/dist/generated/schemas.d.ts +169 -2
  13. package/dist/generated/schemas.d.ts.map +1 -1
  14. package/dist/generated/schemas.js +214 -2
  15. package/dist/generated/stream-event.d.ts +109 -0
  16. package/dist/generated/stream-event.d.ts.map +1 -1
  17. package/dist/generated/stream-terminal-outcome.d.ts +108 -0
  18. package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
  19. package/dist/generated/task-request.d.ts +8 -0
  20. package/dist/generated/task-request.d.ts.map +1 -1
  21. package/dist/generated/task-result.d.ts +114 -6
  22. package/dist/generated/task-result.d.ts.map +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/validators.d.ts +3 -0
  27. package/dist/validators.d.ts.map +1 -1
  28. package/dist/validators.js +12 -1
  29. package/package.json +1 -1
  30. package/src/generated/execution-provenance.ts +102 -0
  31. package/src/generated/inderun-error.ts +108 -0
  32. package/src/generated/index.ts +1 -0
  33. package/src/generated/route-plan.ts +5 -3
  34. package/src/generated/route-planner-input.ts +27 -0
  35. package/src/generated/schemas.ts +215 -2
  36. package/src/generated/stream-event.ts +122 -7
  37. package/src/generated/stream-terminal-outcome.ts +114 -0
  38. package/src/generated/task-request.ts +8 -0
  39. package/src/generated/task-result.ts +121 -7
  40. package/src/index.ts +3 -0
  41. package/src/validators.ts +15 -0
@@ -81,6 +81,11 @@ export const taskRequestSchema = {
81
81
  }
82
82
  }
83
83
  },
84
+ "modelProfile": {
85
+ "description": "Name of the model profile to route within, as configured on the engine. Absent or 'auto' means every registered target, ranked by constraints and preferences alone. A profile is an application-defined, ordered allow-list of targets (provider instances bound to one model each); raw model or provider identifiers are never accepted here. An unknown profile name fails request validation.",
86
+ "type": "string",
87
+ "minLength": 1
88
+ },
84
89
  "generation": {
85
90
  "description": "Optional configuration for fine-tuning how the AI model generates its response.",
86
91
  "type": "object",
@@ -283,6 +288,11 @@ export const taskResultSchema = {
283
288
  "type": "string",
284
289
  "minLength": 1
285
290
  },
291
+ "reportedModel": {
292
+ "description": "The model identifier the provider reported in its own response, set by the provider when its backend reports one. The engine carries it into provenance.reportedModel; it is never inferred from configuration.",
293
+ "type": "string",
294
+ "minLength": 1
295
+ },
286
296
  "totalMs": {
287
297
  "description": "Measured execution duration in milliseconds, including route selection and result processing.",
288
298
  "type": "number",
@@ -301,6 +311,10 @@ export const taskResultSchema = {
301
311
  ]
302
312
  }
303
313
  }
314
+ },
315
+ "provenance": {
316
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
317
+ "$ref": "execution-provenance.schema.json"
304
318
  }
305
319
  }
306
320
  } as const;
@@ -362,6 +376,10 @@ export const inderunErrorSchema = {
362
376
  "description": "Optional structured diagnostic details. It must not contain raw secrets.",
363
377
  "type": "object",
364
378
  "additionalProperties": true
379
+ },
380
+ "provenance": {
381
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
382
+ "$ref": "execution-provenance.schema.json"
365
383
  }
366
384
  }
367
385
  } as const;
@@ -575,6 +593,31 @@ export const routePlannerInputSchema = {
575
593
  }
576
594
  }
577
595
  },
596
+ "modelProfile": {
597
+ "description": "The resolved model profile the request routes within. Absent means the built-in 'auto' profile: no allow-list, and ordering by placement and preference alone. When present, providers whose id is not in targetIds are rejected with 'not_in_model_profile', and the position in targetIds ranks the survivors after placement and before preferences. Ids that name no registered provider are ignored.",
598
+ "type": "object",
599
+ "additionalProperties": true,
600
+ "required": [
601
+ "name",
602
+ "targetIds"
603
+ ],
604
+ "properties": {
605
+ "name": {
606
+ "description": "Profile name, carried for explanations.",
607
+ "type": "string",
608
+ "minLength": 1
609
+ },
610
+ "targetIds": {
611
+ "description": "Provider ids in profile order.",
612
+ "type": "array",
613
+ "minItems": 1,
614
+ "items": {
615
+ "type": "string",
616
+ "minLength": 1
617
+ }
618
+ }
619
+ }
620
+ },
578
621
  "providers": {
579
622
  "description": "Static descriptors plus dynamic capability snapshots for planning.",
580
623
  "type": "array",
@@ -770,7 +813,7 @@ export const routePlanSchema = {
770
813
  ],
771
814
  "properties": {
772
815
  "code": {
773
- "description": "Normalized rejection reason. 'streaming_not_supported' means the descriptor does not statically declare Mode-2 streaming; 'streaming_unavailable' means it declares streaming but the dynamic capability snapshot reports it cannot stream in the current host environment.",
816
+ "description": "Normalized rejection reason. 'streaming_not_supported' means the descriptor does not statically declare Mode-2 streaming; 'streaming_unavailable' means it declares streaming but the dynamic capability snapshot reports it cannot stream in the current host environment. 'not_in_model_profile' means the request named a model profile that does not list this provider.",
774
817
  "enum": [
775
818
  "task_not_supported",
776
819
  "run_not_supported",
@@ -779,7 +822,8 @@ export const routePlanSchema = {
779
822
  "privacy_constraint",
780
823
  "cloud_constraint",
781
824
  "offline",
782
- "capability_unavailable"
825
+ "capability_unavailable",
826
+ "not_in_model_profile"
783
827
  ]
784
828
  },
785
829
  "message": {
@@ -1336,6 +1380,10 @@ export const streamEventSchema = {
1336
1380
  "minimum": 0
1337
1381
  }
1338
1382
  }
1383
+ },
1384
+ "provenance": {
1385
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1386
+ "$ref": "execution-provenance.schema.json"
1339
1387
  }
1340
1388
  }
1341
1389
  },
@@ -1400,8 +1448,16 @@ export const streamEventSchema = {
1400
1448
  "details": {
1401
1449
  "type": "object",
1402
1450
  "additionalProperties": true
1451
+ },
1452
+ "provenance": {
1453
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1454
+ "$ref": "execution-provenance.schema.json"
1403
1455
  }
1404
1456
  }
1457
+ },
1458
+ "provenance": {
1459
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1460
+ "$ref": "execution-provenance.schema.json"
1405
1461
  }
1406
1462
  }
1407
1463
  },
@@ -1430,6 +1486,10 @@ export const streamEventSchema = {
1430
1486
  },
1431
1487
  "reason": {
1432
1488
  "type": "string"
1489
+ },
1490
+ "provenance": {
1491
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1492
+ "$ref": "execution-provenance.schema.json"
1433
1493
  }
1434
1494
  }
1435
1495
  }
@@ -1574,6 +1634,10 @@ export const streamTerminalOutcomeSchema = {
1574
1634
  "minimum": 0
1575
1635
  }
1576
1636
  }
1637
+ },
1638
+ "provenance": {
1639
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1640
+ "$ref": "execution-provenance.schema.json"
1577
1641
  }
1578
1642
  }
1579
1643
  },
@@ -1649,8 +1713,16 @@ export const streamTerminalOutcomeSchema = {
1649
1713
  "description": "Optional structured diagnostic details. It must not contain raw secrets.",
1650
1714
  "type": "object",
1651
1715
  "additionalProperties": true
1716
+ },
1717
+ "provenance": {
1718
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1719
+ "$ref": "execution-provenance.schema.json"
1652
1720
  }
1653
1721
  }
1722
+ },
1723
+ "provenance": {
1724
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1725
+ "$ref": "execution-provenance.schema.json"
1654
1726
  }
1655
1727
  }
1656
1728
  },
@@ -1684,8 +1756,149 @@ export const streamTerminalOutcomeSchema = {
1684
1756
  "reason": {
1685
1757
  "description": "Optional human-readable reason the run was cancelled (e.g. caller-initiated abort). Not a machine-taxonomy field; use errorClass on the 'error' outcome branch for failure classification.",
1686
1758
  "type": "string"
1759
+ },
1760
+ "provenance": {
1761
+ "description": "Normalized execution provenance: which target ran, its declared locality, the configured and reported model, and how fallback and routing played out. See execution-provenance.schema.json.",
1762
+ "$ref": "execution-provenance.schema.json"
1687
1763
  }
1688
1764
  }
1689
1765
  }
1690
1766
  ]
1691
1767
  } as const;
1768
+
1769
+ export const executionProvenanceSchema = {
1770
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1771
+ "$id": "https://schemas.inderun.dev/1.0/execution-provenance.schema.json",
1772
+ "title": "ExecutionProvenance",
1773
+ "description": "Provider-neutral record of how an execution was carried out: the target the outcome is attributed to, its declared locality, the configured and provider-reported model, every attempt, and why other candidates were rejected. Carried on TaskResult, on every StreamTerminalOutcome branch, and on IndeRunError. It reports what the engine observed and what providers declared or reported; it never infers a model or locality a provider did not state, and it never contains request content, credentials, or provider payloads.",
1774
+ "type": "object",
1775
+ "additionalProperties": true,
1776
+ "required": [
1777
+ "schemaVersion",
1778
+ "modelProfile",
1779
+ "locality",
1780
+ "attemptCount",
1781
+ "fallbackOccurred",
1782
+ "attempts",
1783
+ "routeRejections"
1784
+ ],
1785
+ "properties": {
1786
+ "schemaVersion": {
1787
+ "description": "Contract schema version used to interpret this provenance record.",
1788
+ "const": "1.0"
1789
+ },
1790
+ "modelProfile": {
1791
+ "description": "The model profile the request routed within; 'auto' when the request named none.",
1792
+ "type": "string",
1793
+ "minLength": 1
1794
+ },
1795
+ "providerId": {
1796
+ "description": "The target the outcome is attributed to: the provider that produced the result, the provider a stream had committed to when it ended, or the provider that was running when it was cancelled. Absent when no provider was reached or when every attempted provider failed before one was committed to.",
1797
+ "type": "string",
1798
+ "minLength": 1
1799
+ },
1800
+ "locality": {
1801
+ "description": "Where providerId declares it executes: 'on_device' for a local provider, 'edge', or 'cloud'. A declaration by the provider's descriptor, not a measurement. 'unknown' when providerId is absent.",
1802
+ "enum": [
1803
+ "on_device",
1804
+ "edge",
1805
+ "cloud",
1806
+ "unknown"
1807
+ ]
1808
+ },
1809
+ "configuredModel": {
1810
+ "description": "The model providerId is bound to, as its descriptor declares it. Absent when the provider cannot name its model or no provider is attributed.",
1811
+ "type": "string",
1812
+ "minLength": 1
1813
+ },
1814
+ "reportedModel": {
1815
+ "description": "The model identifier the provider reported in its own response. Absent means the provider did not report one; it is never inferred from configuration.",
1816
+ "type": "string",
1817
+ "minLength": 1
1818
+ },
1819
+ "attemptCount": {
1820
+ "description": "How many providers were attempted. 0 when the request failed validation or routing, or was cancelled before any attempt started.",
1821
+ "type": "integer",
1822
+ "minimum": 0
1823
+ },
1824
+ "fallbackOccurred": {
1825
+ "description": "Whether more than one provider was attempted (attemptCount > 1).",
1826
+ "type": "boolean"
1827
+ },
1828
+ "attempts": {
1829
+ "description": "Every attempted provider, in attempt order, with how its attempt ended.",
1830
+ "type": "array",
1831
+ "items": {
1832
+ "title": "ExecutionProvenanceAttempt",
1833
+ "type": "object",
1834
+ "additionalProperties": true,
1835
+ "required": [
1836
+ "providerId",
1837
+ "outcome"
1838
+ ],
1839
+ "properties": {
1840
+ "providerId": {
1841
+ "type": "string",
1842
+ "minLength": 1
1843
+ },
1844
+ "outcome": {
1845
+ "title": "AttemptOutcome",
1846
+ "description": "'succeeded' (produced the result or was committed to and completed), 'failed', or 'cancelled'.",
1847
+ "enum": [
1848
+ "succeeded",
1849
+ "failed",
1850
+ "cancelled"
1851
+ ]
1852
+ },
1853
+ "errorClass": {
1854
+ "description": "Normalized error class of a failed attempt.",
1855
+ "enum": [
1856
+ "CapabilityMismatch",
1857
+ "Offline",
1858
+ "AuthError",
1859
+ "RateLimited",
1860
+ "Timeout",
1861
+ "Unavailable",
1862
+ "Internal"
1863
+ ]
1864
+ }
1865
+ }
1866
+ }
1867
+ },
1868
+ "routeRejections": {
1869
+ "description": "Providers the route planner rejected before any attempt, with the normalized RoutePlan reason codes. Codes only: no provider-supplied messages.",
1870
+ "type": "array",
1871
+ "items": {
1872
+ "title": "ExecutionProvenanceRouteRejection",
1873
+ "type": "object",
1874
+ "additionalProperties": true,
1875
+ "required": [
1876
+ "providerId",
1877
+ "codes"
1878
+ ],
1879
+ "properties": {
1880
+ "providerId": {
1881
+ "type": "string",
1882
+ "minLength": 1
1883
+ },
1884
+ "codes": {
1885
+ "type": "array",
1886
+ "items": {
1887
+ "enum": [
1888
+ "task_not_supported",
1889
+ "run_not_supported",
1890
+ "streaming_not_supported",
1891
+ "streaming_unavailable",
1892
+ "privacy_constraint",
1893
+ "cloud_constraint",
1894
+ "offline",
1895
+ "capability_unavailable",
1896
+ "not_in_model_profile"
1897
+ ]
1898
+ }
1899
+ }
1900
+ }
1901
+ }
1902
+ }
1903
+ }
1904
+ } as const;
@@ -104,10 +104,16 @@ export type Payload = {
104
104
  /**
105
105
  * The lifecycle phase reached.
106
106
  */
107
- phase?: Phase;
108
- finalText?: string;
109
- finishReason?: FinishReason;
110
- outcome?: Outcome;
107
+ phase?: Phase;
108
+ finalText?: string;
109
+ finishReason?: FinishReason;
110
+ outcome?: Outcome;
111
+ /**
112
+ * Normalized execution provenance: which target ran, its declared locality, the configured
113
+ * and reported model, and how fallback and routing played out. See
114
+ * execution-provenance.schema.json.
115
+ */
116
+ provenance?: ExecutionProvenance;
111
117
  runId?: string;
112
118
  schemaVersion?: "1.0";
113
119
  telemetry?: Telemetry;
@@ -119,9 +125,15 @@ export type Payload = {
119
125
  }
120
126
 
121
127
  export type Error = {
122
- details?: { [key: string]: unknown };
123
- errorClass: ErrorClass;
124
- message: string;
128
+ details?: { [key: string]: unknown };
129
+ errorClass: ErrorClass;
130
+ message: string;
131
+ /**
132
+ * Normalized execution provenance: which target ran, its declared locality, the configured
133
+ * and reported model, and how fallback and routing played out. See
134
+ * execution-provenance.schema.json.
135
+ */
136
+ provenance?: ExecutionProvenance;
125
137
  providerId?: string;
126
138
  retryable?: boolean;
127
139
  retryAfterMs?: number;
@@ -129,8 +141,111 @@ export type Error = {
129
141
  [property: string]: unknown;
130
142
  }
131
143
 
144
+ /**
145
+ * Normalized error class of a failed attempt.
146
+ */
132
147
  export type ErrorClass = "CapabilityMismatch" | "Offline" | "AuthError" | "RateLimited" | "Timeout" | "Unavailable" | "Internal";
133
148
 
149
+ /**
150
+ * Normalized execution provenance: which target ran, its declared locality, the configured
151
+ * and reported model, and how fallback and routing played out. See
152
+ * execution-provenance.schema.json.
153
+ *
154
+ * Provider-neutral record of how an execution was carried out: the target the outcome is
155
+ * attributed to, its declared locality, the configured and provider-reported model, every
156
+ * attempt, and why other candidates were rejected. Carried on TaskResult, on every
157
+ * StreamTerminalOutcome branch, and on IndeRunError. It reports what the engine observed
158
+ * and what providers declared or reported; it never infers a model or locality a provider
159
+ * did not state, and it never contains request content, credentials, or provider payloads.
160
+ */
161
+ export type ExecutionProvenance = {
162
+ /**
163
+ * How many providers were attempted. 0 when the request failed validation or routing, or
164
+ * was cancelled before any attempt started.
165
+ */
166
+ attemptCount: number;
167
+ /**
168
+ * Every attempted provider, in attempt order, with how its attempt ended.
169
+ */
170
+ attempts: ExecutionProvenanceAttempt[];
171
+ /**
172
+ * The model providerId is bound to, as its descriptor declares it. Absent when the provider
173
+ * cannot name its model or no provider is attributed.
174
+ */
175
+ configuredModel?: string;
176
+ /**
177
+ * Whether more than one provider was attempted (attemptCount > 1).
178
+ */
179
+ fallbackOccurred: boolean;
180
+ /**
181
+ * Where providerId declares it executes: 'on_device' for a local provider, 'edge', or
182
+ * 'cloud'. A declaration by the provider's descriptor, not a measurement. 'unknown' when
183
+ * providerId is absent.
184
+ */
185
+ locality: Locality;
186
+ /**
187
+ * The model profile the request routed within; 'auto' when the request named none.
188
+ */
189
+ modelProfile: string;
190
+ /**
191
+ * The target the outcome is attributed to: the provider that produced the result, the
192
+ * provider a stream had committed to when it ended, or the provider that was running when
193
+ * it was cancelled. Absent when no provider was reached or when every attempted provider
194
+ * failed before one was committed to.
195
+ */
196
+ providerId?: string;
197
+ /**
198
+ * The model identifier the provider reported in its own response. Absent means the provider
199
+ * did not report one; it is never inferred from configuration.
200
+ */
201
+ reportedModel?: string;
202
+ /**
203
+ * Providers the route planner rejected before any attempt, with the normalized RoutePlan
204
+ * reason codes. Codes only: no provider-supplied messages.
205
+ */
206
+ routeRejections: ExecutionProvenanceRouteRejection[];
207
+ /**
208
+ * Contract schema version used to interpret this provenance record.
209
+ */
210
+ schemaVersion: "1.0";
211
+ [property: string]: unknown;
212
+ }
213
+
214
+ export type ExecutionProvenanceAttempt = {
215
+ /**
216
+ * Normalized error class of a failed attempt.
217
+ */
218
+ errorClass?: ErrorClass;
219
+ /**
220
+ * 'succeeded' (produced the result or was committed to and completed), 'failed', or
221
+ * 'cancelled'.
222
+ */
223
+ outcome: AttemptOutcome;
224
+ providerId: string;
225
+ [property: string]: unknown;
226
+ }
227
+
228
+ /**
229
+ * 'succeeded' (produced the result or was committed to and completed), 'failed', or
230
+ * 'cancelled'.
231
+ */
232
+ export type AttemptOutcome = "succeeded" | "failed" | "cancelled";
233
+
234
+ /**
235
+ * Where providerId declares it executes: 'on_device' for a local provider, 'edge', or
236
+ * 'cloud'. A declaration by the provider's descriptor, not a measurement. 'unknown' when
237
+ * providerId is absent.
238
+ */
239
+ export type Locality = "on_device" | "edge" | "cloud" | "unknown";
240
+
241
+ export type ExecutionProvenanceRouteRejection = {
242
+ codes: Code[];
243
+ providerId: string;
244
+ [property: string]: unknown;
245
+ }
246
+
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";
248
+
134
249
  export type FinishReason = "stop" | "length" | "cancelled" | "error";
135
250
 
136
251
  export type Outcome = "completed" | "error" | "cancelled";
@@ -42,6 +42,12 @@ export type StreamTerminalOutcome = {
42
42
  * further fallback attempt is made, per the engine's cancellation guarantee.
43
43
  */
44
44
  outcome: Outcome;
45
+ /**
46
+ * Normalized execution provenance: which target ran, its declared locality, the configured
47
+ * and reported model, and how fallback and routing played out. See
48
+ * execution-provenance.schema.json.
49
+ */
50
+ provenance?: ExecutionProvenance;
45
51
  /**
46
52
  * The stream run this outcome terminates, matching StreamRunHandle.runId and every
47
53
  * StreamEvent.runId for the run.
@@ -108,6 +114,12 @@ export type Error = {
108
114
  * Human-readable error message suitable for logs and developer diagnostics.
109
115
  */
110
116
  message: string;
117
+ /**
118
+ * Normalized execution provenance: which target ran, its declared locality, the configured
119
+ * and reported model, and how fallback and routing played out. See
120
+ * execution-provenance.schema.json.
121
+ */
122
+ provenance?: ExecutionProvenance;
111
123
  /**
112
124
  * Identifier of the provider associated with the failure, if execution reached a provider.
113
125
  */
@@ -133,9 +145,111 @@ export type Error = {
133
145
  * unreachable or not ready), AuthError (credential/auth failure), RateLimited (provider
134
146
  * throttled the request), Timeout (provider exceeded its execution budget), Internal
135
147
  * (unexpected engine-side failure).
148
+ *
149
+ * Normalized error class of a failed attempt.
136
150
  */
137
151
  export type ErrorClass = "CapabilityMismatch" | "Offline" | "AuthError" | "RateLimited" | "Timeout" | "Unavailable" | "Internal";
138
152
 
153
+ /**
154
+ * Normalized execution provenance: which target ran, its declared locality, the configured
155
+ * and reported model, and how fallback and routing played out. See
156
+ * execution-provenance.schema.json.
157
+ *
158
+ * Provider-neutral record of how an execution was carried out: the target the outcome is
159
+ * attributed to, its declared locality, the configured and provider-reported model, every
160
+ * attempt, and why other candidates were rejected. Carried on TaskResult, on every
161
+ * StreamTerminalOutcome branch, and on IndeRunError. It reports what the engine observed
162
+ * and what providers declared or reported; it never infers a model or locality a provider
163
+ * did not state, and it never contains request content, credentials, or provider payloads.
164
+ */
165
+ export type ExecutionProvenance = {
166
+ /**
167
+ * How many providers were attempted. 0 when the request failed validation or routing, or
168
+ * was cancelled before any attempt started.
169
+ */
170
+ attemptCount: number;
171
+ /**
172
+ * Every attempted provider, in attempt order, with how its attempt ended.
173
+ */
174
+ attempts: ExecutionProvenanceAttempt[];
175
+ /**
176
+ * The model providerId is bound to, as its descriptor declares it. Absent when the provider
177
+ * cannot name its model or no provider is attributed.
178
+ */
179
+ configuredModel?: string;
180
+ /**
181
+ * Whether more than one provider was attempted (attemptCount > 1).
182
+ */
183
+ fallbackOccurred: boolean;
184
+ /**
185
+ * Where providerId declares it executes: 'on_device' for a local provider, 'edge', or
186
+ * 'cloud'. A declaration by the provider's descriptor, not a measurement. 'unknown' when
187
+ * providerId is absent.
188
+ */
189
+ locality: Locality;
190
+ /**
191
+ * The model profile the request routed within; 'auto' when the request named none.
192
+ */
193
+ modelProfile: string;
194
+ /**
195
+ * The target the outcome is attributed to: the provider that produced the result, the
196
+ * provider a stream had committed to when it ended, or the provider that was running when
197
+ * it was cancelled. Absent when no provider was reached or when every attempted provider
198
+ * failed before one was committed to.
199
+ */
200
+ providerId?: string;
201
+ /**
202
+ * The model identifier the provider reported in its own response. Absent means the provider
203
+ * did not report one; it is never inferred from configuration.
204
+ */
205
+ reportedModel?: string;
206
+ /**
207
+ * Providers the route planner rejected before any attempt, with the normalized RoutePlan
208
+ * reason codes. Codes only: no provider-supplied messages.
209
+ */
210
+ routeRejections: ExecutionProvenanceRouteRejection[];
211
+ /**
212
+ * Contract schema version used to interpret this provenance record.
213
+ */
214
+ schemaVersion: "1.0";
215
+ [property: string]: unknown;
216
+ }
217
+
218
+ export type ExecutionProvenanceAttempt = {
219
+ /**
220
+ * Normalized error class of a failed attempt.
221
+ */
222
+ errorClass?: ErrorClass;
223
+ /**
224
+ * 'succeeded' (produced the result or was committed to and completed), 'failed', or
225
+ * 'cancelled'.
226
+ */
227
+ outcome: AttemptOutcome;
228
+ providerId: string;
229
+ [property: string]: unknown;
230
+ }
231
+
232
+ /**
233
+ * 'succeeded' (produced the result or was committed to and completed), 'failed', or
234
+ * 'cancelled'.
235
+ */
236
+ export type AttemptOutcome = "succeeded" | "failed" | "cancelled";
237
+
238
+ /**
239
+ * Where providerId declares it executes: 'on_device' for a local provider, 'edge', or
240
+ * 'cloud'. A declaration by the provider's descriptor, not a measurement. 'unknown' when
241
+ * providerId is absent.
242
+ */
243
+ export type Locality = "on_device" | "edge" | "cloud" | "unknown";
244
+
245
+ export type ExecutionProvenanceRouteRejection = {
246
+ codes: Code[];
247
+ providerId: string;
248
+ [property: string]: unknown;
249
+ }
250
+
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";
252
+
139
253
  /**
140
254
  * How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end),
141
255
  * 'length' (hit maxOutputTokens), 'error' (provider reported a non-fatal issue on an
@@ -24,6 +24,14 @@ export type TaskRequest = {
24
24
  * A list of interaction messages for multi-turn conversation or chat-style execution.
25
25
  */
26
26
  messages?: [Message, ...Message[]];
27
+ /**
28
+ * Name of the model profile to route within, as configured on the engine. Absent or 'auto'
29
+ * means every registered target, ranked by constraints and preferences alone. A profile is
30
+ * an application-defined, ordered allow-list of targets (provider instances bound to one
31
+ * model each); raw model or provider identifiers are never accepted here. An unknown
32
+ * profile name fails request validation.
33
+ */
34
+ modelProfile?: string;
27
35
  /**
28
36
  * Soft routing preferences used for deterministic provider ordering.
29
37
  */