@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.
- package/dist/generated/artifact-read-request.d.ts +24 -0
- package/dist/generated/artifact-read-request.d.ts.map +1 -0
- package/dist/generated/artifact-read-request.js +2 -0
- package/dist/generated/execution-provenance.d.ts +8 -1
- package/dist/generated/execution-provenance.d.ts.map +1 -1
- package/dist/generated/inderun-error.d.ts +8 -1
- package/dist/generated/inderun-error.d.ts.map +1 -1
- package/dist/generated/index.d.ts +6 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/media-artifact.d.ts +53 -0
- package/dist/generated/media-artifact.d.ts.map +1 -0
- package/dist/generated/media-artifact.js +2 -0
- package/dist/generated/provider-capability-snapshot.d.ts +370 -0
- package/dist/generated/provider-capability-snapshot.d.ts.map +1 -0
- package/dist/generated/provider-capability-snapshot.js +2 -0
- package/dist/generated/provider-descriptor.d.ts +264 -0
- package/dist/generated/provider-descriptor.d.ts.map +1 -0
- package/dist/generated/provider-descriptor.js +2 -0
- package/dist/generated/provider-dynamic-capabilities.d.ts +99 -0
- package/dist/generated/provider-dynamic-capabilities.d.ts.map +1 -0
- package/dist/generated/provider-dynamic-capabilities.js +2 -0
- package/dist/generated/route-plan.d.ts +47 -3
- package/dist/generated/route-plan.d.ts.map +1 -1
- package/dist/generated/route-planner-input.d.ts +417 -32
- package/dist/generated/route-planner-input.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +833 -115
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +1038 -160
- package/dist/generated/stream-event.d.ts +136 -1
- package/dist/generated/stream-event.d.ts.map +1 -1
- package/dist/generated/stream-terminal-outcome.d.ts +182 -18
- package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
- package/dist/generated/task-output.d.ts +128 -0
- package/dist/generated/task-output.d.ts.map +1 -0
- package/dist/generated/task-output.js +2 -0
- package/dist/generated/task-request.d.ts +116 -11
- package/dist/generated/task-request.d.ts.map +1 -1
- package/dist/generated/task-result.d.ts +139 -15
- package/dist/generated/task-result.d.ts.map +1 -1
- package/dist/generated/telemetry-event.d.ts +2 -2
- package/dist/generated/telemetry-event.d.ts.map +1 -1
- package/dist/host.d.ts +24 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +46 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/validators.d.ts +18 -0
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +49 -1
- package/package.json +1 -1
- package/src/generated/artifact-read-request.ts +25 -0
- package/src/generated/execution-provenance.ts +8 -1
- package/src/generated/inderun-error.ts +8 -1
- package/src/generated/index.ts +6 -0
- package/src/generated/media-artifact.ts +56 -0
- package/src/generated/provider-capability-snapshot.ts +388 -0
- package/src/generated/provider-descriptor.ts +278 -0
- package/src/generated/provider-dynamic-capabilities.ts +103 -0
- package/src/generated/route-plan.ts +49 -3
- package/src/generated/route-planner-input.ts +437 -36
- package/src/generated/schemas.ts +1044 -160
- package/src/generated/stream-event.ts +145 -1
- package/src/generated/stream-terminal-outcome.ts +191 -18
- package/src/generated/task-output.ts +137 -0
- package/src/generated/task-request.ts +124 -11
- package/src/generated/task-result.ts +147 -15
- package/src/generated/telemetry-event.ts +2 -2
- package/src/host.ts +30 -1
- package/src/index.ts +28 -1
- package/src/types.ts +38 -1
- package/src/validators.ts +76 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The request payload for a
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The request payload for a run() or stream() execution. The common envelope
|
|
5
|
+
* (schemaVersion, requestId, task, modelProfile, constraints, preferences, telemetry,
|
|
6
|
+
* authContextRef) is task-agnostic; each task kind owns its payload (ADR 016).
|
|
7
|
+
* text_to_text: at least one of `prompt` (single-turn) or `messages` (multi-turn) must be
|
|
8
|
+
* present — both may be present together, though callers should typically supply just one —
|
|
9
|
+
* and `speech`/`delivery` are forbidden. text_to_speech: `speech` and `delivery` are
|
|
10
|
+
* required and `prompt`, `messages` and `generation` are forbidden.
|
|
7
11
|
* `constraints`/`preferences` steer routing but never select a provider directly.
|
|
8
12
|
*/
|
|
9
13
|
export type TaskRequest = {
|
|
@@ -16,6 +20,12 @@ export type TaskRequest = {
|
|
|
16
20
|
* Request-level routing constraints used by the planner.
|
|
17
21
|
*/
|
|
18
22
|
constraints?: Constraints;
|
|
23
|
+
/**
|
|
24
|
+
* How the result of a non-text task must reach the application (ADR 016). Required for
|
|
25
|
+
* non-text tasks and forbidden for text_to_text, whose output is implicitly inline. A
|
|
26
|
+
* provider never substitutes playback for an artifact or the reverse.
|
|
27
|
+
*/
|
|
28
|
+
delivery?: OutputDeliveryRequest;
|
|
19
29
|
/**
|
|
20
30
|
* Optional configuration for fine-tuning how the AI model generates its response.
|
|
21
31
|
*/
|
|
@@ -49,8 +59,13 @@ export type TaskRequest = {
|
|
|
49
59
|
*/
|
|
50
60
|
schemaVersion: "1.0";
|
|
51
61
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
62
|
+
* The text_to_speech payload. Required for text_to_speech and forbidden for every other
|
|
63
|
+
* kind.
|
|
64
|
+
*/
|
|
65
|
+
speech?: SpeechInput;
|
|
66
|
+
/**
|
|
67
|
+
* A descriptor specifying the type of work to be performed. The kind selects which payload
|
|
68
|
+
* the request must carry.
|
|
54
69
|
*/
|
|
55
70
|
task: Task;
|
|
56
71
|
/**
|
|
@@ -73,7 +88,10 @@ export type Constraints = {
|
|
|
73
88
|
*/
|
|
74
89
|
privacy?: Privacy;
|
|
75
90
|
/**
|
|
76
|
-
* Optional
|
|
91
|
+
* Optional timeout budget in milliseconds, passed to the planner and to providers. It
|
|
92
|
+
* bounds the time until the run commits to a provider -- its first content, its first
|
|
93
|
+
* possible audible effect, or its artifact handoff -- not the duration of audio it plays.
|
|
94
|
+
* The engines add no timers of their own.
|
|
77
95
|
*/
|
|
78
96
|
timeoutMs?: number;
|
|
79
97
|
[property: string]: unknown;
|
|
@@ -89,6 +107,36 @@ export type Cloud = "forbidden" | "allowed" | "required";
|
|
|
89
107
|
*/
|
|
90
108
|
export type Privacy = "local_required" | "local_preferred" | "cloud_allowed" | "cloud_required";
|
|
91
109
|
|
|
110
|
+
/**
|
|
111
|
+
* How the result of a non-text task must reach the application (ADR 016). Required for
|
|
112
|
+
* non-text tasks and forbidden for text_to_text, whose output is implicitly inline. A
|
|
113
|
+
* provider never substitutes playback for an artifact or the reverse.
|
|
114
|
+
*/
|
|
115
|
+
export type OutputDeliveryRequest = {
|
|
116
|
+
/**
|
|
117
|
+
* Only valid with 'artifact' delivery: an opaque reference to an application destination
|
|
118
|
+
* the engine writes the finished artifact to, resolved by the host's artifact-destination
|
|
119
|
+
* service (ADR 017) -- never a raw path or URL, like authContextRef for credentials. The
|
|
120
|
+
* result's artifact is then application-owned and the engine keeps no copy. A host without
|
|
121
|
+
* the service refuses the request before routing.
|
|
122
|
+
*/
|
|
123
|
+
destinationRef?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Only valid with 'artifact' delivery: the acceptable media types, always a hard
|
|
126
|
+
* requirement. Absent means the provider chooses and the artifact reports what it produced.
|
|
127
|
+
*/
|
|
128
|
+
mediaTypes?: [string, ...string[]];
|
|
129
|
+
mode: OutputDelivery;
|
|
130
|
+
[property: string]: unknown;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* How a task's result reaches the application: 'inline' content in the result (text),
|
|
135
|
+
* 'playback' as a managed, audible effect on the device with no retrievable bytes, or
|
|
136
|
+
* 'artifact' as retrievable media.
|
|
137
|
+
*/
|
|
138
|
+
export type OutputDelivery = "inline" | "playback" | "artifact";
|
|
139
|
+
|
|
92
140
|
/**
|
|
93
141
|
* Optional configuration for fine-tuning how the AI model generates its response.
|
|
94
142
|
*/
|
|
@@ -154,18 +202,83 @@ export type Preferences = {
|
|
|
154
202
|
export type OptimizeFor = "privacy" | "latency" | "cost" | "balanced";
|
|
155
203
|
|
|
156
204
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
205
|
+
* The text_to_speech payload. Required for text_to_speech and forbidden for every other
|
|
206
|
+
* kind.
|
|
207
|
+
*/
|
|
208
|
+
export type SpeechInput = {
|
|
209
|
+
/**
|
|
210
|
+
* BCP 47 tag of the language to speak, e.g. 'de-AT'.
|
|
211
|
+
*/
|
|
212
|
+
locale: string;
|
|
213
|
+
/**
|
|
214
|
+
* 'language' (default): the primary language subtag is a hard requirement and the region is
|
|
215
|
+
* a preference. 'exact': the full tag is a hard requirement.
|
|
216
|
+
*/
|
|
217
|
+
localeMatch?: LocaleMatch;
|
|
218
|
+
/**
|
|
219
|
+
* Plain text to speak. Markup such as SSML is out of scope.
|
|
220
|
+
*/
|
|
221
|
+
text: string;
|
|
222
|
+
/**
|
|
223
|
+
* Provider-neutral voice traits. A 'preferred' voice (default) shapes which voice speaks
|
|
224
|
+
* and is never a reason to fail; a 'required' one takes part in routing and is never
|
|
225
|
+
* relaxed silently. Carries no provider voice identifier.
|
|
226
|
+
*/
|
|
227
|
+
voice?: SpeechVoice;
|
|
228
|
+
[property: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* 'language' (default): the primary language subtag is a hard requirement and the region is
|
|
233
|
+
* a preference. 'exact': the full tag is a hard requirement.
|
|
234
|
+
*/
|
|
235
|
+
export type LocaleMatch = "exact" | "language";
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Provider-neutral voice traits. A 'preferred' voice (default) shapes which voice speaks
|
|
239
|
+
* and is never a reason to fail; a 'required' one takes part in routing and is never
|
|
240
|
+
* relaxed silently. Carries no provider voice identifier.
|
|
241
|
+
*/
|
|
242
|
+
export type SpeechVoice = {
|
|
243
|
+
gender?: VoiceGender;
|
|
244
|
+
/**
|
|
245
|
+
* 'preferred' (default) or 'required'. A required voice must name at least one trait.
|
|
246
|
+
*/
|
|
247
|
+
requirement?: RequirementLevel;
|
|
248
|
+
[property: string]: unknown;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Perceived gender of a voice, as the platform reports it.
|
|
253
|
+
*/
|
|
254
|
+
export type VoiceGender = "female" | "male" | "neutral";
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* 'preferred' (default) or 'required'. A required voice must name at least one trait.
|
|
258
|
+
*/
|
|
259
|
+
export type RequirementLevel = "required" | "preferred";
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* A descriptor specifying the type of work to be performed. The kind selects which payload
|
|
263
|
+
* the request must carry.
|
|
159
264
|
*/
|
|
160
265
|
export type Task = {
|
|
161
266
|
/**
|
|
162
|
-
* The
|
|
163
|
-
*
|
|
267
|
+
* The operation: 'text_to_text' (prompt-based text generation) or 'text_to_speech' (speech
|
|
268
|
+
* synthesis from text). A consumer built against an older revision rejects a kind it does
|
|
269
|
+
* not know through validation.
|
|
164
270
|
*/
|
|
165
|
-
kind:
|
|
271
|
+
kind: TaskKind;
|
|
166
272
|
[property: string]: unknown;
|
|
167
273
|
}
|
|
168
274
|
|
|
275
|
+
/**
|
|
276
|
+
* The operation: 'text_to_text' (prompt-based text generation) or 'text_to_speech' (speech
|
|
277
|
+
* synthesis from text). A consumer built against an older revision rejects a kind it does
|
|
278
|
+
* not know through validation.
|
|
279
|
+
*/
|
|
280
|
+
export type TaskKind = "text_to_text" | "text_to_speech";
|
|
281
|
+
|
|
169
282
|
/**
|
|
170
283
|
* Execution preferences for tracking usage and performance metrics.
|
|
171
284
|
*/
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The response payload for a completed
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* The response payload for a completed run() execution, for every task kind; output.type
|
|
5
|
+
* tells the content representation apart (text, managed playback, retrievable artifact). A
|
|
6
|
+
* full execution failure (validation, routing, or every attempted provider failing) is
|
|
7
|
+
* surfaced by run() throwing an IndeRunError instead of returning a TaskResult;
|
|
8
|
+
* finishReason and telemetry.errorClass are reserved for a provider reporting a non-fatal,
|
|
9
|
+
* degraded outcome on an otherwise-successful result (finishReason 'error' is produced by
|
|
10
|
+
* the Android ML Kit GenAI provider; telemetry.errorClass is not currently set by any
|
|
11
|
+
* provider in this codebase).
|
|
10
12
|
*/
|
|
11
13
|
export type TaskResult = {
|
|
12
14
|
/**
|
|
@@ -18,9 +20,9 @@ export type TaskResult = {
|
|
|
18
20
|
*/
|
|
19
21
|
finishReason: FinishReason;
|
|
20
22
|
/**
|
|
21
|
-
* The normalized
|
|
23
|
+
* The normalized output of the selected provider. See task-output.schema.json.
|
|
22
24
|
*/
|
|
23
|
-
output:
|
|
25
|
+
output: TaskOutput;
|
|
24
26
|
/**
|
|
25
27
|
* Normalized execution provenance: which target ran, its declared locality, the configured
|
|
26
28
|
* and reported model, and how fallback and routing played out. See
|
|
@@ -56,20 +58,143 @@ export type TaskResult = {
|
|
|
56
58
|
export type FinishReason = "stop" | "length" | "cancelled" | "error";
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
|
-
* The normalized
|
|
61
|
+
* The normalized output of the selected provider. See task-output.schema.json.
|
|
62
|
+
*
|
|
63
|
+
* The normalized output of a run, shared by TaskResult and the completed and cancelled
|
|
64
|
+
* stream terminal outcomes (ADR 016). 'type' describes the content representation, not the
|
|
65
|
+
* task: 'text' carries inline text, 'playback' reports a managed, audible effect that has
|
|
66
|
+
* no retrievable bytes, and 'artifact' references retrievable media (ADR 017). A playback
|
|
67
|
+
* output is never an artifact, and an artifact output never implies that anything was
|
|
68
|
+
* played.
|
|
69
|
+
*/
|
|
70
|
+
export type TaskOutput = {
|
|
71
|
+
/**
|
|
72
|
+
* The retrievable media the run produced. Required when type is 'artifact'.
|
|
73
|
+
*/
|
|
74
|
+
artifact?: MediaArtifact;
|
|
75
|
+
/**
|
|
76
|
+
* Completion of managed playback. Required when type is 'playback'. Carries no media.
|
|
77
|
+
*/
|
|
78
|
+
playback?: PlaybackOutput;
|
|
79
|
+
/**
|
|
80
|
+
* The locale and voice traits a text-to-speech run actually used, so an unmet preference is
|
|
81
|
+
* visible without being an error.
|
|
82
|
+
*/
|
|
83
|
+
speech?: SpeechOutput;
|
|
84
|
+
/**
|
|
85
|
+
* The text the run produced. Required when type is 'text'.
|
|
86
|
+
*/
|
|
87
|
+
text?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The content representation: 'text', 'playback' or 'artifact'.
|
|
90
|
+
*/
|
|
91
|
+
type: TaskOutputType;
|
|
92
|
+
[property: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The retrievable media the run produced. Required when type is 'artifact'.
|
|
97
|
+
*
|
|
98
|
+
* A reference to retrievable media a run produced (ADR 017). It carries no bytes and no
|
|
99
|
+
* location: an engine-owned artifact is read through the engine by id, and an
|
|
100
|
+
* application-owned one was written to an application destination. Media-neutral: audio,
|
|
101
|
+
* images and video share this shape and differ only in mediaType.
|
|
102
|
+
*/
|
|
103
|
+
export type MediaArtifact = {
|
|
104
|
+
/**
|
|
105
|
+
* Size of the media in bytes. Always set for an artifact the engine materialized.
|
|
106
|
+
*/
|
|
107
|
+
byteLength?: number;
|
|
108
|
+
/**
|
|
109
|
+
* The request's delivery.destinationRef the bytes were written to. Set exactly when owner
|
|
110
|
+
* is 'application'.
|
|
111
|
+
*/
|
|
112
|
+
destinationRef?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Duration of time-based media in milliseconds, where the producer knows it.
|
|
115
|
+
*/
|
|
116
|
+
durationMs?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Opaque, engine-issued identifier. Never a path, URL or provider identifier.
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* How long the engine keeps the bytes. 'until_disposed': until the application disposes the
|
|
123
|
+
* artifact or the process ends; the artifact outlives the run that produced it.
|
|
124
|
+
*/
|
|
125
|
+
lifetime: "until_disposed";
|
|
126
|
+
/**
|
|
127
|
+
* IANA media type of the bytes, e.g. 'audio/wav'. Encoding parameters ride on the media
|
|
128
|
+
* type (e.g. 'audio/L16;rate=22050').
|
|
129
|
+
*/
|
|
130
|
+
mediaType: string;
|
|
131
|
+
/**
|
|
132
|
+
* 'engine': the engine holds the bytes and the application reads them by id until it
|
|
133
|
+
* disposes the artifact. 'application': the bytes were written to the application
|
|
134
|
+
* destination named by destinationRef and the engine holds nothing.
|
|
135
|
+
*/
|
|
136
|
+
owner: ArtifactOwner;
|
|
137
|
+
[property: string]: unknown;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* How long the engine keeps the bytes. 'until_disposed': until the application disposes the
|
|
142
|
+
* artifact or the process ends; the artifact outlives the run that produced it.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 'engine': the engine holds the bytes and the application reads them by id until it
|
|
147
|
+
* disposes the artifact. 'application': the bytes were written to the application
|
|
148
|
+
* destination named by destinationRef and the engine holds nothing.
|
|
60
149
|
*/
|
|
61
|
-
export type
|
|
150
|
+
export type ArtifactOwner = "engine" | "application";
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Completion of managed playback. Required when type is 'playback'. Carries no media.
|
|
154
|
+
*/
|
|
155
|
+
export type PlaybackOutput = {
|
|
62
156
|
/**
|
|
63
|
-
*
|
|
157
|
+
* How long audible playback lasted, in milliseconds. For a cancelled run, how long it
|
|
158
|
+
* played before it was stopped.
|
|
64
159
|
*/
|
|
65
|
-
|
|
160
|
+
durationMs?: number;
|
|
161
|
+
[property: string]: unknown;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The locale and voice traits a text-to-speech run actually used, so an unmet preference is
|
|
166
|
+
* visible without being an error.
|
|
167
|
+
*/
|
|
168
|
+
export type SpeechOutput = {
|
|
66
169
|
/**
|
|
67
|
-
*
|
|
170
|
+
* BCP 47 tag of the locale that was spoken.
|
|
68
171
|
*/
|
|
69
|
-
|
|
172
|
+
locale: string;
|
|
173
|
+
/**
|
|
174
|
+
* Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
|
|
175
|
+
*/
|
|
176
|
+
voice?: SpeechOutputVoice;
|
|
177
|
+
[property: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Provider-neutral traits of the voice that spoke. Carries no provider voice identifier.
|
|
182
|
+
*/
|
|
183
|
+
export type SpeechOutputVoice = {
|
|
184
|
+
gender?: VoiceGender;
|
|
70
185
|
[property: string]: unknown;
|
|
71
186
|
}
|
|
72
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Perceived gender of a voice, as the platform reports it.
|
|
190
|
+
*/
|
|
191
|
+
export type VoiceGender = "female" | "male" | "neutral";
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The content representation: 'text', 'playback' or 'artifact'.
|
|
195
|
+
*/
|
|
196
|
+
export type TaskOutputType = "text" | "playback" | "artifact";
|
|
197
|
+
|
|
73
198
|
/**
|
|
74
199
|
* Normalized execution provenance: which target ran, its declared locality, the configured
|
|
75
200
|
* and reported model, and how fallback and routing played out. See
|
|
@@ -136,6 +261,13 @@ export type ExecutionProvenance = {
|
|
|
136
261
|
}
|
|
137
262
|
|
|
138
263
|
export type ExecutionProvenanceAttempt = {
|
|
264
|
+
/**
|
|
265
|
+
* Whether the run committed to this provider during the attempt: its first content was
|
|
266
|
+
* delivered, it signalled the first possible audible effect, or it handed over an artifact.
|
|
267
|
+
* After commit a failure ends the run instead of falling back. Absent means the attempt did
|
|
268
|
+
* not commit.
|
|
269
|
+
*/
|
|
270
|
+
committed?: boolean;
|
|
139
271
|
/**
|
|
140
272
|
* Normalized error class of a failed attempt.
|
|
141
273
|
*/
|
|
@@ -177,7 +309,7 @@ export type ExecutionProvenanceRouteRejection = {
|
|
|
177
309
|
[property: string]: unknown;
|
|
178
310
|
}
|
|
179
311
|
|
|
180
|
-
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";
|
|
312
|
+
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";
|
|
181
313
|
|
|
182
314
|
/**
|
|
183
315
|
* Required metadata providing an overview of the execution result and performance metrics.
|
|
@@ -19,11 +19,11 @@ export type TelemetryEvent = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Telemetry event kind emitted by the orchestrator or provider integration.
|
|
21
21
|
*/
|
|
22
|
-
type:
|
|
22
|
+
type: TelemetryEventType;
|
|
23
23
|
[property: string]: unknown;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Telemetry event kind emitted by the orchestrator or provider integration.
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type TelemetryEventType = "route_decided" | "attempt_succeeded" | "attempt_failed" | "stream_attempt_started" | "stream_attempt_succeeded" | "stream_attempt_failed" | "stream_completed" | "stream_failed" | "stream_cancelled";
|
package/src/host.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
HttpRequest,
|
|
3
|
+
HttpResponse,
|
|
4
|
+
MediaArtifact,
|
|
5
|
+
TelemetryEvent
|
|
6
|
+
} from "./generated/index.js";
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* Service to inspect and monitor network connectivity status.
|
|
@@ -168,6 +173,25 @@ export interface TelemetryService {
|
|
|
168
173
|
emit(event: TelemetryEvent): void;
|
|
169
174
|
}
|
|
170
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Resolves the opaque `delivery.destinationRef` of an artifact request to a place the
|
|
178
|
+
* application chose -- a file it will hand to a player, a cache it manages -- and writes the
|
|
179
|
+
* finished artifact there (ADR 017). A request names a reference, never a path, so a request
|
|
180
|
+
* that came from a webview cannot address arbitrary storage.
|
|
181
|
+
*/
|
|
182
|
+
export interface ArtifactDestinationService {
|
|
183
|
+
/**
|
|
184
|
+
* Whether `destinationRef` names a destination this host can write the requested media to.
|
|
185
|
+
* Called before routing; `false` refuses the request.
|
|
186
|
+
*/
|
|
187
|
+
accepts(destinationRef: string, mediaTypes: readonly string[] | undefined): Promise<boolean>;
|
|
188
|
+
/**
|
|
189
|
+
* Writes the finished artifact's bytes to the destination. A failure fails the run: it is
|
|
190
|
+
* committed by then, so it never falls back.
|
|
191
|
+
*/
|
|
192
|
+
write(destinationRef: string, artifact: MediaArtifact, bytes: Uint8Array): Promise<void>;
|
|
193
|
+
}
|
|
194
|
+
|
|
171
195
|
/**
|
|
172
196
|
* Registry of platform-specific host services utilized by the Engine Core.
|
|
173
197
|
* Evaluates execution capabilities and manages OS-level boundaries.
|
|
@@ -202,4 +226,9 @@ export interface HostServices {
|
|
|
202
226
|
* Telemetry service to monitor execution steps, latency, and success rates.
|
|
203
227
|
*/
|
|
204
228
|
telemetry?: TelemetryService;
|
|
229
|
+
/**
|
|
230
|
+
* Application destinations for artifact requests that carry `delivery.destinationRef`.
|
|
231
|
+
* Absent means the host has none, and such a request is refused before routing.
|
|
232
|
+
*/
|
|
233
|
+
artifactDestinations?: ArtifactDestinationService;
|
|
205
234
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,21 +12,27 @@
|
|
|
12
12
|
* themselves or the runtime validators.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/** The generated request/response, streaming, routing, and telemetry models. */
|
|
15
|
+
/** The generated request/response, streaming, routing, provider-capability, and telemetry models. */
|
|
16
16
|
export type * from "./generated/index.js";
|
|
17
17
|
|
|
18
18
|
/** The JSON Schemas those models were generated from, for runtime use. */
|
|
19
19
|
export {
|
|
20
|
+
artifactReadRequestSchema,
|
|
20
21
|
executionProvenanceSchema,
|
|
21
22
|
httpRequestSchema,
|
|
22
23
|
httpResponseSchema,
|
|
23
24
|
inderunErrorSchema,
|
|
25
|
+
mediaArtifactSchema,
|
|
24
26
|
modelPackageSchema,
|
|
27
|
+
providerCapabilitySnapshotSchema,
|
|
28
|
+
providerDescriptorSchema,
|
|
29
|
+
providerDynamicCapabilitiesSchema,
|
|
25
30
|
routePlanSchema,
|
|
26
31
|
routePlannerInputSchema,
|
|
27
32
|
streamEventSchema,
|
|
28
33
|
streamRunSchema,
|
|
29
34
|
streamTerminalOutcomeSchema,
|
|
35
|
+
taskOutputSchema,
|
|
30
36
|
taskRequestSchema,
|
|
31
37
|
taskResultSchema,
|
|
32
38
|
telemetryEventSchema
|
|
@@ -37,16 +43,22 @@ export {
|
|
|
37
43
|
* boolean type guard.
|
|
38
44
|
*/
|
|
39
45
|
export {
|
|
46
|
+
getArtifactReadRequestValidationIssues,
|
|
40
47
|
getExecutionProvenanceValidationIssues,
|
|
41
48
|
getHttpRequestValidationIssues,
|
|
42
49
|
getHttpResponseValidationIssues,
|
|
43
50
|
getIndeRunErrorValidationIssues,
|
|
51
|
+
getMediaArtifactValidationIssues,
|
|
44
52
|
getModelPackageValidationIssues,
|
|
53
|
+
getProviderCapabilitySnapshotValidationIssues,
|
|
54
|
+
getProviderDescriptorValidationIssues,
|
|
55
|
+
getProviderDynamicCapabilitiesValidationIssues,
|
|
45
56
|
getRoutePlanValidationIssues,
|
|
46
57
|
getRoutePlannerInputValidationIssues,
|
|
47
58
|
getStreamEventValidationIssues,
|
|
48
59
|
getStreamRunHandleValidationIssues,
|
|
49
60
|
getStreamTerminalOutcomeValidationIssues,
|
|
61
|
+
getTaskOutputValidationIssues,
|
|
50
62
|
getTaskRequestValidationIssues,
|
|
51
63
|
getTaskResultValidationIssues,
|
|
52
64
|
getTelemetryEventValidationIssues,
|
|
@@ -54,15 +66,21 @@ export {
|
|
|
54
66
|
validateHttpRequest,
|
|
55
67
|
validateHttpResponse,
|
|
56
68
|
validateIndeRunError,
|
|
69
|
+
validateMediaArtifact,
|
|
57
70
|
validateModelPackage,
|
|
71
|
+
validateProviderCapabilitySnapshot,
|
|
72
|
+
validateProviderDescriptor,
|
|
73
|
+
validateProviderDynamicCapabilities,
|
|
58
74
|
validateRoutePlan,
|
|
59
75
|
validateRoutePlannerInput,
|
|
60
76
|
validateStreamEvent,
|
|
61
77
|
validateStreamRunHandle,
|
|
62
78
|
validateStreamTerminalOutcome,
|
|
79
|
+
validateTaskOutput,
|
|
63
80
|
validateTaskRequest,
|
|
64
81
|
validateTaskResult,
|
|
65
82
|
validateTelemetryEvent,
|
|
83
|
+
validateArtifactReadRequest,
|
|
66
84
|
type ValidationIssue
|
|
67
85
|
} from "./validators.js";
|
|
68
86
|
/**
|
|
@@ -70,14 +88,22 @@ export {
|
|
|
70
88
|
* and the routing input/output shapes under the names the engines use.
|
|
71
89
|
*/
|
|
72
90
|
export type {
|
|
91
|
+
CancelSemantics,
|
|
73
92
|
FinishReason,
|
|
74
93
|
IndeRunErrorClass,
|
|
94
|
+
ArtifactTaskOutput,
|
|
75
95
|
ModelPackageFormat,
|
|
76
96
|
ModelSourceType,
|
|
97
|
+
PlaybackTaskOutput,
|
|
98
|
+
ProviderTransport,
|
|
99
|
+
ProviderType,
|
|
77
100
|
SchemaVersion,
|
|
78
101
|
SharedRoutePlan,
|
|
79
102
|
SharedRoutePlannerInput,
|
|
103
|
+
SpeechTaskRequest,
|
|
80
104
|
TaskKind,
|
|
105
|
+
TextTaskOutput,
|
|
106
|
+
TextTaskRequest,
|
|
81
107
|
RoutingConstraints,
|
|
82
108
|
RoutingPreferences
|
|
83
109
|
} from "./types.js";
|
|
@@ -89,6 +115,7 @@ export type {
|
|
|
89
115
|
*/
|
|
90
116
|
export type {
|
|
91
117
|
AbortSignalLike,
|
|
118
|
+
ArtifactDestinationService,
|
|
92
119
|
ConnectivityService,
|
|
93
120
|
ThermalState,
|
|
94
121
|
DeviceConstraintsService,
|
package/src/types.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IndeRunError,
|
|
3
|
+
MediaArtifact,
|
|
3
4
|
ModelPackage,
|
|
5
|
+
ProviderDescriptor,
|
|
4
6
|
RoutePlan,
|
|
5
7
|
RoutePlannerInput,
|
|
8
|
+
TaskOutput,
|
|
6
9
|
TaskRequest,
|
|
7
10
|
TaskResult
|
|
8
11
|
} from "./generated/index.js";
|
|
12
|
+
import type { PlaybackOutput } from "./generated/task-output.js";
|
|
13
|
+
import type { OutputDeliveryRequest, SpeechInput } from "./generated/task-request.js";
|
|
9
14
|
|
|
10
15
|
// Convenience aliases derived from the generated schema types, so consumers can
|
|
11
16
|
// name individual fields without reaching into the generated index signatures.
|
|
12
17
|
|
|
13
18
|
/** Contract schema version (e.g. `"1.0"`) carried by every task request. */
|
|
14
19
|
export type SchemaVersion = TaskRequest["schemaVersion"];
|
|
15
|
-
/** Supported task kinds (
|
|
20
|
+
/** Supported task kinds (`"text_to_text"`, `"text_to_speech"`). */
|
|
16
21
|
export type TaskKind = TaskRequest["task"]["kind"];
|
|
17
22
|
/** Normalized reason a task finished (e.g. `stop`, `length`, `error`). */
|
|
18
23
|
export type FinishReason = TaskResult["finishReason"];
|
|
@@ -30,3 +35,35 @@ export type RoutingPreferences = NonNullable<TaskRequest["preferences"]>;
|
|
|
30
35
|
export type ModelPackageFormat = ModelPackage["format"];
|
|
31
36
|
/** How a model package's files are supplied to a provider (`registry`, `bundled`, ...). */
|
|
32
37
|
export type ModelSourceType = NonNullable<ModelPackage["source"]>["sourceType"];
|
|
38
|
+
/** Execution placement a provider declares (`local`, `edge`, `cloud`). */
|
|
39
|
+
export type ProviderType = ProviderDescriptor["type"];
|
|
40
|
+
/** Cancellation guarantee a provider declares (`hard`, `soft`, `none`). */
|
|
41
|
+
export type CancelSemantics = ProviderDescriptor["cancel"];
|
|
42
|
+
/** How the engine reaches a provider (`in_process`, `system_service`, `http`, ...). */
|
|
43
|
+
export type ProviderTransport = ProviderDescriptor["transport"];
|
|
44
|
+
|
|
45
|
+
// Per-task narrowings (ADR 016). Code generation cannot express the schema's per-kind
|
|
46
|
+
// `if`/`then` requirements, so every task payload is optional on the generated types; these
|
|
47
|
+
// aliases restate them for code that has already established the kind.
|
|
48
|
+
|
|
49
|
+
/** A `text_to_text` request: `prompt` and/or `messages`, never a non-text payload. */
|
|
50
|
+
export type TextTaskRequest = TaskRequest & {
|
|
51
|
+
task: { kind: "text_to_text" };
|
|
52
|
+
speech?: never;
|
|
53
|
+
delivery?: never;
|
|
54
|
+
};
|
|
55
|
+
/** A `text_to_speech` request: the `speech` payload and a playback or artifact delivery. */
|
|
56
|
+
export type SpeechTaskRequest = TaskRequest & {
|
|
57
|
+
task: { kind: "text_to_speech" };
|
|
58
|
+
speech: SpeechInput;
|
|
59
|
+
delivery: OutputDeliveryRequest & { mode: "playback" | "artifact" };
|
|
60
|
+
prompt?: never;
|
|
61
|
+
messages?: never;
|
|
62
|
+
generation?: never;
|
|
63
|
+
};
|
|
64
|
+
/** Inline text output. */
|
|
65
|
+
export type TextTaskOutput = TaskOutput & { type: "text"; text: string };
|
|
66
|
+
/** Completion of managed playback; carries no media. */
|
|
67
|
+
export type PlaybackTaskOutput = TaskOutput & { type: "playback"; playback: PlaybackOutput };
|
|
68
|
+
/** A reference to retrievable media (ADR 017). */
|
|
69
|
+
export type ArtifactTaskOutput = TaskOutput & { type: "artifact"; artifact: MediaArtifact };
|