@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.
- package/dist/generated/execution-provenance.d.ts +1 -1
- package/dist/generated/execution-provenance.d.ts.map +1 -1
- package/dist/generated/inderun-error.d.ts +1 -1
- package/dist/generated/inderun-error.d.ts.map +1 -1
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.d.ts.map +1 -1
- 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 +458 -85
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +549 -104
- package/dist/generated/stream-event.d.ts +1 -1
- package/dist/generated/stream-event.d.ts.map +1 -1
- package/dist/generated/stream-terminal-outcome.d.ts +1 -1
- package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
- package/dist/generated/task-result.d.ts +1 -1
- package/dist/generated/task-result.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validators.d.ts +9 -0
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +24 -1
- package/package.json +1 -1
- package/src/generated/execution-provenance.ts +1 -1
- package/src/generated/inderun-error.ts +1 -1
- package/src/generated/index.ts +3 -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 +552 -104
- package/src/generated/stream-event.ts +1 -1
- package/src/generated/stream-terminal-outcome.ts +1 -1
- package/src/generated/task-result.ts +1 -1
- package/src/index.ts +13 -1
- package/src/types.ts +7 -0
- package/src/validators.ts +39 -0
|
@@ -244,7 +244,7 @@ export type ExecutionProvenanceRouteRejection = {
|
|
|
244
244
|
[property: string]: unknown;
|
|
245
245
|
}
|
|
246
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";
|
|
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" | "input_not_supported" | "output_delivery_not_supported" | "output_format_not_supported" | "locale_not_supported" | "voice_not_available";
|
|
248
248
|
|
|
249
249
|
export type FinishReason = "stop" | "length" | "cancelled" | "error";
|
|
250
250
|
|
|
@@ -248,7 +248,7 @@ export type ExecutionProvenanceRouteRejection = {
|
|
|
248
248
|
[property: string]: unknown;
|
|
249
249
|
}
|
|
250
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";
|
|
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" | "input_not_supported" | "output_delivery_not_supported" | "output_format_not_supported" | "locale_not_supported" | "voice_not_available";
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
254
|
* How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end),
|
|
@@ -177,7 +177,7 @@ export type ExecutionProvenanceRouteRejection = {
|
|
|
177
177
|
[property: string]: unknown;
|
|
178
178
|
}
|
|
179
179
|
|
|
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";
|
|
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" | "input_not_supported" | "output_delivery_not_supported" | "output_format_not_supported" | "locale_not_supported" | "voice_not_available";
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
183
|
* Required metadata providing an overview of the execution result and performance metrics.
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
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. */
|
|
@@ -22,6 +22,9 @@ export {
|
|
|
22
22
|
httpResponseSchema,
|
|
23
23
|
inderunErrorSchema,
|
|
24
24
|
modelPackageSchema,
|
|
25
|
+
providerCapabilitySnapshotSchema,
|
|
26
|
+
providerDescriptorSchema,
|
|
27
|
+
providerDynamicCapabilitiesSchema,
|
|
25
28
|
routePlanSchema,
|
|
26
29
|
routePlannerInputSchema,
|
|
27
30
|
streamEventSchema,
|
|
@@ -42,6 +45,9 @@ export {
|
|
|
42
45
|
getHttpResponseValidationIssues,
|
|
43
46
|
getIndeRunErrorValidationIssues,
|
|
44
47
|
getModelPackageValidationIssues,
|
|
48
|
+
getProviderCapabilitySnapshotValidationIssues,
|
|
49
|
+
getProviderDescriptorValidationIssues,
|
|
50
|
+
getProviderDynamicCapabilitiesValidationIssues,
|
|
45
51
|
getRoutePlanValidationIssues,
|
|
46
52
|
getRoutePlannerInputValidationIssues,
|
|
47
53
|
getStreamEventValidationIssues,
|
|
@@ -55,6 +61,9 @@ export {
|
|
|
55
61
|
validateHttpResponse,
|
|
56
62
|
validateIndeRunError,
|
|
57
63
|
validateModelPackage,
|
|
64
|
+
validateProviderCapabilitySnapshot,
|
|
65
|
+
validateProviderDescriptor,
|
|
66
|
+
validateProviderDynamicCapabilities,
|
|
58
67
|
validateRoutePlan,
|
|
59
68
|
validateRoutePlannerInput,
|
|
60
69
|
validateStreamEvent,
|
|
@@ -70,10 +79,13 @@ export {
|
|
|
70
79
|
* and the routing input/output shapes under the names the engines use.
|
|
71
80
|
*/
|
|
72
81
|
export type {
|
|
82
|
+
CancelSemantics,
|
|
73
83
|
FinishReason,
|
|
74
84
|
IndeRunErrorClass,
|
|
75
85
|
ModelPackageFormat,
|
|
76
86
|
ModelSourceType,
|
|
87
|
+
ProviderTransport,
|
|
88
|
+
ProviderType,
|
|
77
89
|
SchemaVersion,
|
|
78
90
|
SharedRoutePlan,
|
|
79
91
|
SharedRoutePlannerInput,
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IndeRunError,
|
|
3
3
|
ModelPackage,
|
|
4
|
+
ProviderDescriptor,
|
|
4
5
|
RoutePlan,
|
|
5
6
|
RoutePlannerInput,
|
|
6
7
|
TaskRequest,
|
|
@@ -30,3 +31,9 @@ export type RoutingPreferences = NonNullable<TaskRequest["preferences"]>;
|
|
|
30
31
|
export type ModelPackageFormat = ModelPackage["format"];
|
|
31
32
|
/** How a model package's files are supplied to a provider (`registry`, `bundled`, ...). */
|
|
32
33
|
export type ModelSourceType = NonNullable<ModelPackage["source"]>["sourceType"];
|
|
34
|
+
/** Execution placement a provider declares (`local`, `edge`, `cloud`). */
|
|
35
|
+
export type ProviderType = ProviderDescriptor["type"];
|
|
36
|
+
/** Cancellation guarantee a provider declares (`hard`, `soft`, `none`). */
|
|
37
|
+
export type CancelSemantics = ProviderDescriptor["cancel"];
|
|
38
|
+
/** How the engine reaches a provider (`in_process`, `system_service`, `http`, ...). */
|
|
39
|
+
export type ProviderTransport = ProviderDescriptor["transport"];
|
package/src/validators.ts
CHANGED
|
@@ -6,6 +6,9 @@ import type { IndeRunError } from "./generated/inderun-error.js";
|
|
|
6
6
|
import type { HttpRequest } from "./generated/http-request.js";
|
|
7
7
|
import type { HttpResponse } from "./generated/http-response.js";
|
|
8
8
|
import type { ModelPackage } from "./generated/model-package.js";
|
|
9
|
+
import type { ProviderCapabilitySnapshot } from "./generated/provider-capability-snapshot.js";
|
|
10
|
+
import type { ProviderDescriptor } from "./generated/provider-descriptor.js";
|
|
11
|
+
import type { ProviderDynamicCapabilities } from "./generated/provider-dynamic-capabilities.js";
|
|
9
12
|
import type { RoutePlan } from "./generated/route-plan.js";
|
|
10
13
|
import type { RoutePlannerInput } from "./generated/route-planner-input.js";
|
|
11
14
|
import {
|
|
@@ -14,6 +17,9 @@ import {
|
|
|
14
17
|
httpResponseSchema,
|
|
15
18
|
inderunErrorSchema,
|
|
16
19
|
modelPackageSchema,
|
|
20
|
+
providerCapabilitySnapshotSchema,
|
|
21
|
+
providerDescriptorSchema,
|
|
22
|
+
providerDynamicCapabilitiesSchema,
|
|
17
23
|
routePlanSchema,
|
|
18
24
|
routePlannerInputSchema,
|
|
19
25
|
streamEventSchema,
|
|
@@ -50,6 +56,11 @@ const ajv = new Ajv2020Constructor({
|
|
|
50
56
|
// Referenced by `$ref` from every schema that carries provenance, so it has to be known
|
|
51
57
|
// to Ajv before any of them compiles. Compiling it registers it under its `$id`.
|
|
52
58
|
const validateExecutionProvenanceSchema = ajv.compile(executionProvenanceSchema);
|
|
59
|
+
// Likewise, the provider descriptor and dynamic capabilities are referenced from the
|
|
60
|
+
// capability snapshot and the route-planner input.
|
|
61
|
+
const validateProviderDescriptorSchema = ajv.compile(providerDescriptorSchema);
|
|
62
|
+
const validateProviderDynamicCapabilitiesSchema = ajv.compile(providerDynamicCapabilitiesSchema);
|
|
63
|
+
const validateProviderCapabilitySnapshotSchema = ajv.compile(providerCapabilitySnapshotSchema);
|
|
53
64
|
const validateTaskRequestSchema = ajv.compile(taskRequestSchema);
|
|
54
65
|
const validateTaskResultSchema = ajv.compile(taskResultSchema);
|
|
55
66
|
const validateIndeRunErrorSchema = ajv.compile(inderunErrorSchema);
|
|
@@ -99,6 +110,22 @@ export function validateModelPackage(value: unknown): value is ModelPackage {
|
|
|
99
110
|
return getModelPackageValidationIssues(value).length === 0;
|
|
100
111
|
}
|
|
101
112
|
|
|
113
|
+
export function validateProviderDescriptor(value: unknown): value is ProviderDescriptor {
|
|
114
|
+
return getProviderDescriptorValidationIssues(value).length === 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function validateProviderDynamicCapabilities(
|
|
118
|
+
value: unknown
|
|
119
|
+
): value is ProviderDynamicCapabilities {
|
|
120
|
+
return getProviderDynamicCapabilitiesValidationIssues(value).length === 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function validateProviderCapabilitySnapshot(
|
|
124
|
+
value: unknown
|
|
125
|
+
): value is ProviderCapabilitySnapshot {
|
|
126
|
+
return getProviderCapabilitySnapshotValidationIssues(value).length === 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
102
129
|
export function validateStreamRunHandle(value: unknown): value is StreamRunHandle {
|
|
103
130
|
return getStreamRunHandleValidationIssues(value).length === 0;
|
|
104
131
|
}
|
|
@@ -170,6 +197,18 @@ export function getModelPackageValidationIssues(value: unknown): ValidationIssue
|
|
|
170
197
|
});
|
|
171
198
|
}
|
|
172
199
|
|
|
200
|
+
export function getProviderDescriptorValidationIssues(value: unknown): ValidationIssue[] {
|
|
201
|
+
return getValidationIssues(validateProviderDescriptorSchema, value);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function getProviderDynamicCapabilitiesValidationIssues(value: unknown): ValidationIssue[] {
|
|
205
|
+
return getValidationIssues(validateProviderDynamicCapabilitiesSchema, value);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function getProviderCapabilitySnapshotValidationIssues(value: unknown): ValidationIssue[] {
|
|
209
|
+
return getValidationIssues(validateProviderCapabilitySnapshotSchema, value);
|
|
210
|
+
}
|
|
211
|
+
|
|
173
212
|
export function getStreamRunHandleValidationIssues(value: unknown): ValidationIssue[] {
|
|
174
213
|
return getValidationIssues(validateStreamRunHandleSchema, value);
|
|
175
214
|
}
|