@independo/inderun-contracts 0.3.0-dev.12 → 0.3.0-dev.13

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/index.d.ts CHANGED
@@ -1,6 +1,35 @@
1
+ /**
2
+ * Canonical IndeRun contracts for TypeScript (`@independo/inderun-contracts`).
3
+ *
4
+ * Everything here derives from the JSON Schemas in `contracts/schemas/`, which are
5
+ * the single source of truth across all four languages — the TypeScript types
6
+ * below, the Kotlin and Swift contract models, and the Rust route-core model are
7
+ * all generated from them by `pnpm generate`. Do not hand-edit anything under
8
+ * `src/generated/`; change the schema and regenerate.
9
+ *
10
+ * Apps normally do not depend on this package directly: the SDKs re-export the
11
+ * contract types their own signatures use. Reach for it when you need the schemas
12
+ * themselves or the runtime validators.
13
+ */
14
+ /** The generated request/response, streaming, routing, and telemetry models. */
1
15
  export type * from "./generated/index.js";
16
+ /** The JSON Schemas those models were generated from, for runtime use. */
2
17
  export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, streamEventSchema, streamRunSchema, streamTerminalOutcomeSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
18
+ /**
19
+ * Ajv-backed validators for each contract. The `get*ValidationIssues` form returns
20
+ * a list of human-readable issues (empty when valid); the `validate*` form is the
21
+ * boolean type guard.
22
+ */
3
23
  export { getHttpRequestValidationIssues, getHttpResponseValidationIssues, getIndeRunErrorValidationIssues, getModelPackageValidationIssues, getRoutePlanValidationIssues, getRoutePlannerInputValidationIssues, getStreamEventValidationIssues, getStreamRunHandleValidationIssues, getStreamTerminalOutcomeValidationIssues, getTaskRequestValidationIssues, getTaskResultValidationIssues, getTelemetryEventValidationIssues, validateHttpRequest, validateHttpResponse, validateIndeRunError, validateModelPackage, validateRoutePlan, validateRoutePlannerInput, validateStreamEvent, validateStreamRunHandle, validateStreamTerminalOutcome, validateTaskRequest, validateTaskResult, validateTelemetryEvent, type ValidationIssue } from "./validators.js";
24
+ /**
25
+ * Narrowed aliases over the generated models: the closed enums the SDKs switch on,
26
+ * and the routing input/output shapes under the names the engines use.
27
+ */
4
28
  export type { FinishReason, IndeRunErrorClass, ModelPackageFormat, ModelSourceType, SchemaVersion, SharedRoutePlan, SharedRoutePlannerInput, TaskKind, RoutingConstraints, RoutingPreferences } from "./types.js";
29
+ /**
30
+ * The host-services contract: the platform capabilities an SDK reads and calls
31
+ * through. Defined here rather than per-SDK so the three platforms expose the
32
+ * same seams.
33
+ */
5
34
  export type { AbortSignalLike, ConnectivityService, ThermalState, DeviceConstraintsService, SecureStorageService, ClockService, HttpClientService, HttpStreamResponse, HttpStreamingClientService, TelemetryEventType, TelemetryService, HostServices } from "./host.js";
6
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,sBAAsB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,EAC5B,oCAAoC,EACpC,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACb,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,gFAAgF;AAChF,mBAAmB,sBAAsB,CAAC;AAE1C,0EAA0E;AAC1E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B;;;;GAIG;AACH,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,EAC5B,oCAAoC,EACpC,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB;;;GAGG;AACH,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACb,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,21 @@
1
+ /**
2
+ * Canonical IndeRun contracts for TypeScript (`@independo/inderun-contracts`).
3
+ *
4
+ * Everything here derives from the JSON Schemas in `contracts/schemas/`, which are
5
+ * the single source of truth across all four languages — the TypeScript types
6
+ * below, the Kotlin and Swift contract models, and the Rust route-core model are
7
+ * all generated from them by `pnpm generate`. Do not hand-edit anything under
8
+ * `src/generated/`; change the schema and regenerate.
9
+ *
10
+ * Apps normally do not depend on this package directly: the SDKs re-export the
11
+ * contract types their own signatures use. Reach for it when you need the schemas
12
+ * themselves or the runtime validators.
13
+ */
14
+ /** The JSON Schemas those models were generated from, for runtime use. */
1
15
  export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, streamEventSchema, streamRunSchema, streamTerminalOutcomeSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
16
+ /**
17
+ * Ajv-backed validators for each contract. The `get*ValidationIssues` form returns
18
+ * a list of human-readable issues (empty when valid); the `validate*` form is the
19
+ * boolean type guard.
20
+ */
2
21
  export { getHttpRequestValidationIssues, getHttpResponseValidationIssues, getIndeRunErrorValidationIssues, getModelPackageValidationIssues, getRoutePlanValidationIssues, getRoutePlannerInputValidationIssues, getStreamEventValidationIssues, getStreamRunHandleValidationIssues, getStreamTerminalOutcomeValidationIssues, getTaskRequestValidationIssues, getTaskResultValidationIssues, getTelemetryEventValidationIssues, validateHttpRequest, validateHttpResponse, validateIndeRunError, validateModelPackage, validateRoutePlan, validateRoutePlannerInput, validateStreamEvent, validateStreamRunHandle, validateStreamTerminalOutcome, validateTaskRequest, validateTaskResult, validateTelemetryEvent } from "./validators.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@independo/inderun-contracts",
3
- "version": "0.3.0-dev.12",
3
+ "version": "0.3.0-dev.13",
4
4
  "description": "Canonical JSON Schemas, generated TypeScript types, and validators for IndeRun contracts.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -11,7 +11,7 @@
11
11
  "bugs": "https://github.com/independo-gmbh/inderun/issues",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/independo-gmbh/inderun.git",
14
+ "url": "git+https://github.com/independo-gmbh/inderun.git",
15
15
  "directory": "packages/contracts"
16
16
  },
17
17
  "publishConfig": {
@@ -39,17 +39,20 @@
39
39
  },
40
40
  "files": [
41
41
  "dist",
42
+ "src",
43
+ "!src/**/*.test.ts",
42
44
  "README.md"
43
45
  ],
44
46
  "dependencies": {
45
47
  "ajv": "^8.20.0"
46
48
  },
47
49
  "devDependencies": {
48
- "@types/node": "^26.4.0",
50
+ "@types/node": "^26.4.1",
49
51
  "vitest": "^4.1.11"
50
52
  },
51
53
  "scripts": {
52
54
  "build": "tsc -p tsconfig.json",
53
- "test": "vitest run"
55
+ "test": "vitest run",
56
+ "verify:packaging": "publint && attw --pack . --profile esm-only"
54
57
  }
55
58
  }
@@ -0,0 +1,34 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * Normalized HTTP request payload for host-provided cloud transport.
5
+ */
6
+ export type HttpRequest = {
7
+ /**
8
+ * Optional serialized request body. For JSON APIs this should be a JSON string.
9
+ */
10
+ body?: string;
11
+ /**
12
+ * HTTP headers to send after the provider adapter has applied any required transport-level
13
+ * credentials.
14
+ */
15
+ headers?: { [key: string]: string };
16
+ /**
17
+ * HTTP method to use for the request.
18
+ */
19
+ method: Method;
20
+ /**
21
+ * Optional maximum duration for the host transport attempt in milliseconds.
22
+ */
23
+ timeoutMs?: number;
24
+ /**
25
+ * Absolute target URL for the provider transport request.
26
+ */
27
+ url: string;
28
+ [property: string]: unknown;
29
+ }
30
+
31
+ /**
32
+ * HTTP method to use for the request.
33
+ */
34
+ export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
@@ -0,0 +1,24 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * Normalized HTTP response payload returned by host-provided cloud transport.
5
+ */
6
+ export type HttpResponse = {
7
+ /**
8
+ * Serialized response body returned by the provider transport.
9
+ */
10
+ body: string;
11
+ /**
12
+ * HTTP response headers normalized to string key-value pairs.
13
+ */
14
+ headers: { [key: string]: string };
15
+ /**
16
+ * HTTP status code returned by the provider transport.
17
+ */
18
+ status: number;
19
+ /**
20
+ * HTTP status text returned by the provider transport.
21
+ */
22
+ statusText: string;
23
+ [property: string]: unknown;
24
+ }
@@ -0,0 +1,55 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * The error shape thrown by run() (wrapped in an IndeRunException) when execution fails —
5
+ * via validation, routing (no eligible provider), or every attempted provider failing.
6
+ * Never returned as part of a successful TaskResult.
7
+ */
8
+ export type IndeRunError = {
9
+ /**
10
+ * Optional structured diagnostic details. It must not contain raw secrets.
11
+ */
12
+ details?: { [key: string]: unknown };
13
+ /**
14
+ * Normalized error taxonomy, shared with TaskResult.telemetry.errorClass:
15
+ * CapabilityMismatch (request needs something no eligible provider supports),
16
+ * Offline/Unavailable (provider unreachable or not ready), AuthError (credential/auth
17
+ * failure), RateLimited (provider throttled the request), Timeout (provider exceeded its
18
+ * execution budget), Internal (unexpected engine-side failure).
19
+ */
20
+ errorClass: ErrorClass;
21
+ /**
22
+ * Human-readable error message suitable for logs and developer diagnostics.
23
+ */
24
+ message: string;
25
+ /**
26
+ * Identifier of the provider associated with the failure, if execution reached a provider.
27
+ */
28
+ providerId?: string;
29
+ /**
30
+ * Whether retrying the same request may succeed.
31
+ */
32
+ retryable?: boolean;
33
+ /**
34
+ * Optional suggested delay before retrying, in milliseconds.
35
+ */
36
+ retryAfterMs?: number;
37
+ /**
38
+ * Opaque run identifier associated with the failed execution, if available.
39
+ */
40
+ runId?: string;
41
+ /**
42
+ * Contract schema version used to interpret the error payload.
43
+ */
44
+ schemaVersion: "1.0";
45
+ [property: string]: unknown;
46
+ }
47
+
48
+ /**
49
+ * Normalized error taxonomy, shared with TaskResult.telemetry.errorClass:
50
+ * CapabilityMismatch (request needs something no eligible provider supports),
51
+ * Offline/Unavailable (provider unreachable or not ready), AuthError (credential/auth
52
+ * failure), RateLimited (provider throttled the request), Timeout (provider exceeded its
53
+ * execution budget), Internal (unexpected engine-side failure).
54
+ */
55
+ export type ErrorClass = "CapabilityMismatch" | "Offline" | "AuthError" | "RateLimited" | "Timeout" | "Unavailable" | "Internal";
@@ -0,0 +1,15 @@
1
+ /* This file was generated from JSON Schema. Do not edit by hand. */
2
+
3
+ export type { TaskRequest } from "./task-request.js";
4
+ export type { TaskResult } from "./task-result.js";
5
+ export type { IndeRunError } from "./inderun-error.js";
6
+ export type { HttpRequest } from "./http-request.js";
7
+ export type { HttpResponse } from "./http-response.js";
8
+ export type { TelemetryEvent } from "./telemetry-event.js";
9
+ export type { RoutePlannerInput } from "./route-planner-input.js";
10
+ export type { RoutePlan } from "./route-plan.js";
11
+ export type { ModelPackage } from "./model-package.js";
12
+ export type { StreamRunHandle } from "./stream-run.js";
13
+ export type { StreamEvent } from "./stream-event.js";
14
+ export type { StreamTerminalOutcome } from "./stream-terminal-outcome.js";
15
+ export * from "./schemas.js";
@@ -0,0 +1,191 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * Provider-neutral descriptor for a developer-supplied/custom local model made available to
5
+ * an IndeRun local-model provider family (for example, the ONNX Runtime family). It
6
+ * describes model identity, format, task support, source, files, integrity, licensing, and
7
+ * resource expectations. It is bootstrap/configuration metadata resolved before execution;
8
+ * it is not part of the public TaskRequest/TaskResult surface, and it must not carry raw
9
+ * secrets.
10
+ */
11
+ export type ModelPackage = {
12
+ /**
13
+ * Files that make up the model package, expressed as source-relative names/paths. The
14
+ * provider adapter and model source resolve these to concrete bytes per platform.
15
+ */
16
+ files?: Files;
17
+ /**
18
+ * Model packaging format the target runtime family must understand. 'onnx' is a plain ONNX
19
+ * graph, 'ort' is an ONNX Runtime optimized/mobile format, 'genai' is an ONNX Runtime GenAI
20
+ * model package.
21
+ */
22
+ format: Format;
23
+ /**
24
+ * Stable application-scoped identifier for the model package.
25
+ */
26
+ id: string;
27
+ /**
28
+ * Optional integrity metadata used to validate resolved files before load.
29
+ */
30
+ integrity?: Integrity;
31
+ /**
32
+ * Optional license/source metadata for the model, for developer transparency. Free-form.
33
+ */
34
+ license?: License;
35
+ /**
36
+ * Optional known resource expectations, used by capability checks to reject on constrained
37
+ * devices before load.
38
+ */
39
+ limits?: Limits;
40
+ /**
41
+ * Optional runtime compatibility expectations. Fields are advisory hints for capability
42
+ * checks; the provider adapter owns exact enforcement.
43
+ */
44
+ runtime?: Runtime;
45
+ /**
46
+ * Where the model files are obtained from. Availability of each source type is
47
+ * platform-dependent; see the ONNX Runtime provider-family specification for the
48
+ * per-platform support matrix.
49
+ */
50
+ source?: Source;
51
+ /**
52
+ * IndeRun task kinds this model package can serve (for example 'text_to_text'). Used by
53
+ * dynamic capability checks and route matching.
54
+ */
55
+ tasks?: string[];
56
+ /**
57
+ * Optional application-defined version for the model package, used for cache invalidation
58
+ * and compatibility checks.
59
+ */
60
+ version?: string;
61
+ [property: string]: unknown;
62
+ }
63
+
64
+ /**
65
+ * Files that make up the model package, expressed as source-relative names/paths. The
66
+ * provider adapter and model source resolve these to concrete bytes per platform.
67
+ */
68
+ export type Files = {
69
+ /**
70
+ * Optional model/generation config file, where the model requires one.
71
+ */
72
+ config?: string;
73
+ /**
74
+ * Optional external data files referenced by the model graph (for example ONNX external
75
+ * weights).
76
+ */
77
+ external?: string[];
78
+ /**
79
+ * Files that must be present for the package to load (for example the model graph).
80
+ */
81
+ required?: string[];
82
+ /**
83
+ * Optional tokenizer file, where the model requires one.
84
+ */
85
+ tokenizer?: string;
86
+ [property: string]: unknown;
87
+ }
88
+
89
+ /**
90
+ * Model packaging format the target runtime family must understand. 'onnx' is a plain ONNX
91
+ * graph, 'ort' is an ONNX Runtime optimized/mobile format, 'genai' is an ONNX Runtime GenAI
92
+ * model package.
93
+ */
94
+ export type Format = "onnx" | "ort" | "genai";
95
+
96
+ /**
97
+ * Optional integrity metadata used to validate resolved files before load.
98
+ */
99
+ export type Integrity = {
100
+ /**
101
+ * Map of file name to expected checksum (for example 'sha256:...'). Absence means integrity
102
+ * is not verified by IndeRun.
103
+ */
104
+ checksums?: { [key: string]: string };
105
+ [property: string]: unknown;
106
+ }
107
+
108
+ /**
109
+ * Optional license/source metadata for the model, for developer transparency. Free-form.
110
+ */
111
+ export type License = {
112
+ /**
113
+ * SPDX license identifier where known (for example 'Apache-2.0').
114
+ */
115
+ spdx?: string;
116
+ /**
117
+ * License or model card URL where available.
118
+ */
119
+ url?: string;
120
+ [property: string]: unknown;
121
+ }
122
+
123
+ /**
124
+ * Optional known resource expectations, used by capability checks to reject on constrained
125
+ * devices before load.
126
+ */
127
+ export type Limits = {
128
+ /**
129
+ * Approximate on-disk size of the resolved package, where known.
130
+ */
131
+ diskBytes?: number;
132
+ /**
133
+ * Approximate peak memory required to run the model, where known.
134
+ */
135
+ memBytes?: number;
136
+ [property: string]: unknown;
137
+ }
138
+
139
+ /**
140
+ * Optional runtime compatibility expectations. Fields are advisory hints for capability
141
+ * checks; the provider adapter owns exact enforcement.
142
+ */
143
+ export type Runtime = {
144
+ /**
145
+ * Minimum ONNX opset version the model requires, where known.
146
+ */
147
+ minOpset?: number;
148
+ /**
149
+ * Minimum runtime package version required to load the model, where known.
150
+ */
151
+ minRuntimeVersion?: string;
152
+ /**
153
+ * Platforms the package is expected to run on (for example 'web', 'android', 'apple').
154
+ * Absence means unconstrained.
155
+ */
156
+ platforms?: string[];
157
+ [property: string]: unknown;
158
+ }
159
+
160
+ /**
161
+ * Where the model files are obtained from. Availability of each source type is
162
+ * platform-dependent; see the ONNX Runtime provider-family specification for the
163
+ * per-platform support matrix.
164
+ */
165
+ export type Source = {
166
+ /**
167
+ * Optional source-specific reference (for example a registry repo id or a bundled asset
168
+ * base path). Interpretation depends on 'sourceType'. Must not contain credentials: URL
169
+ * userinfo (for example 'https://user:pass@host/...') is rejected, and credentials must be
170
+ * supplied via authContextRef instead.
171
+ */
172
+ ref?: string;
173
+ /**
174
+ * Discriminator for how the host makes model files available. 'registry' is a web
175
+ * repository/registry reference (for example a Hugging Face-style repo), 'bundled' is an
176
+ * app asset/resource, 'programmatic' is supplied directly by application code, 'filesystem'
177
+ * is a local path where the platform allows it, 'app_managed' is an app-managed
178
+ * cache/storage location, 'remote' is a host-managed download.
179
+ */
180
+ sourceType: SourceType;
181
+ [property: string]: unknown;
182
+ }
183
+
184
+ /**
185
+ * Discriminator for how the host makes model files available. 'registry' is a web
186
+ * repository/registry reference (for example a Hugging Face-style repo), 'bundled' is an
187
+ * app asset/resource, 'programmatic' is supplied directly by application code, 'filesystem'
188
+ * is a local path where the platform allows it, 'app_managed' is an app-managed
189
+ * cache/storage location, 'remote' is a host-managed download.
190
+ */
191
+ export type SourceType = "registry" | "bundled" | "programmatic" | "filesystem" | "app_managed" | "remote";
@@ -0,0 +1,78 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * Deterministic shared-core Mode-1 route planning result.
5
+ */
6
+ export type RoutePlan = {
7
+ /**
8
+ * Eligible candidates in deterministic order.
9
+ */
10
+ candidates: Candidate[];
11
+ /**
12
+ * Human-readable selection or failure explanation suitable for telemetry/debugging.
13
+ */
14
+ explanation: Explanation;
15
+ /**
16
+ * Normalized routing failure class when no provider is selected.
17
+ */
18
+ failureCode?: FailureCode;
19
+ /**
20
+ * Fallback provider IDs ordered after the primary selection.
21
+ */
22
+ fallbackProviderIds: string[];
23
+ /**
24
+ * Providers filtered out during planning together with machine-readable reasons.
25
+ */
26
+ rejectedProviders: RejectedProvider[];
27
+ /**
28
+ * Chosen primary provider ID, if any.
29
+ */
30
+ selectedProviderId?: string;
31
+ [property: string]: unknown;
32
+ }
33
+
34
+ export type Candidate = {
35
+ order: number;
36
+ providerId: string;
37
+ [property: string]: unknown;
38
+ }
39
+
40
+ /**
41
+ * Human-readable selection or failure explanation suitable for telemetry/debugging.
42
+ */
43
+ export type Explanation = {
44
+ selectedProviderId?: string;
45
+ summary: string;
46
+ [property: string]: unknown;
47
+ }
48
+
49
+ /**
50
+ * Normalized routing failure class when no provider is selected.
51
+ */
52
+ export type FailureCode = "capability_mismatch" | "offline" | "unavailable";
53
+
54
+ export type RejectedProvider = {
55
+ providerId: string;
56
+ reasons: Reason[];
57
+ [property: string]: unknown;
58
+ }
59
+
60
+ export type Reason = {
61
+ /**
62
+ * Normalized rejection reason. 'streaming_not_supported' means the descriptor does not
63
+ * statically declare Mode-2 streaming; 'streaming_unavailable' means it declares streaming
64
+ * but the dynamic capability snapshot reports it cannot stream in the current host
65
+ * environment.
66
+ */
67
+ code: Code;
68
+ message: string;
69
+ [property: string]: unknown;
70
+ }
71
+
72
+ /**
73
+ * Normalized rejection reason. 'streaming_not_supported' means the descriptor does not
74
+ * statically declare Mode-2 streaming; 'streaming_unavailable' means it declares streaming
75
+ * but the dynamic capability snapshot reports it cannot stream in the current host
76
+ * environment.
77
+ */
78
+ export type Code = "task_not_supported" | "run_not_supported" | "streaming_not_supported" | "streaming_unavailable" | "privacy_constraint" | "cloud_constraint" | "offline" | "capability_unavailable";
@@ -0,0 +1,161 @@
1
+ /* This file was generated from JSON Schema using quicktype. Do not edit by hand. */
2
+
3
+ /**
4
+ * Pure data input contract for deterministic shared-core route planning.
5
+ */
6
+ export type RoutePlannerInput = {
7
+ /**
8
+ * Hard routing constraints evaluated before provider selection.
9
+ */
10
+ constraints: Constraints;
11
+ /**
12
+ * Interaction mode the caller is requesting. Absent means 'run' (Mode 1), so planner inputs
13
+ * produced before this field existed keep their exact Mode-1 semantics. The mode filters
14
+ * eligible providers; it never changes candidate ordering.
15
+ */
16
+ interactionMode?: InteractionMode;
17
+ /**
18
+ * Soft route ordering preferences applied after hard filtering.
19
+ */
20
+ preferences: Preferences;
21
+ /**
22
+ * Static descriptors plus dynamic capability snapshots for planning.
23
+ */
24
+ providers: Provider[];
25
+ /**
26
+ * Minimal task descriptor for provider task matching.
27
+ */
28
+ task: Task;
29
+ [property: string]: unknown;
30
+ }
31
+
32
+ /**
33
+ * Hard routing constraints evaluated before provider selection.
34
+ */
35
+ export type Constraints = {
36
+ /**
37
+ * Cloud execution constraint.
38
+ */
39
+ cloud?: Cloud;
40
+ /**
41
+ * Current connectivity snapshot used for cloud route planning.
42
+ */
43
+ networkOnline?: boolean;
44
+ /**
45
+ * Privacy requirement or preference for execution placement.
46
+ */
47
+ privacy?: PrivacyEnum;
48
+ [property: string]: unknown;
49
+ }
50
+
51
+ /**
52
+ * Cloud execution constraint.
53
+ */
54
+ export type Cloud = "forbidden" | "allowed" | "required";
55
+
56
+ /**
57
+ * Privacy requirement or preference for execution placement.
58
+ */
59
+ export type PrivacyEnum = "local_required" | "local_preferred" | "cloud_allowed" | "cloud_required";
60
+
61
+ /**
62
+ * Interaction mode the caller is requesting. Absent means 'run' (Mode 1), so planner inputs
63
+ * produced before this field existed keep their exact Mode-1 semantics. The mode filters
64
+ * eligible providers; it never changes candidate ordering.
65
+ */
66
+ export type InteractionMode = "run" | "stream";
67
+
68
+ /**
69
+ * Soft route ordering preferences applied after hard filtering.
70
+ */
71
+ export type Preferences = {
72
+ /**
73
+ * Primary optimization goal when multiple providers remain eligible.
74
+ */
75
+ optimizeFor?: OptimizeFor;
76
+ [property: string]: unknown;
77
+ }
78
+
79
+ /**
80
+ * Primary optimization goal when multiple providers remain eligible.
81
+ */
82
+ export type OptimizeFor = "privacy" | "latency" | "cost" | "balanced";
83
+
84
+ export type Provider = {
85
+ capabilities: Capabilities;
86
+ descriptor: Descriptor;
87
+ [property: string]: unknown;
88
+ }
89
+
90
+ export type Capabilities = {
91
+ available: boolean;
92
+ /**
93
+ * Whether cancellation is honored right now in this host environment. Absent inherits the
94
+ * static descriptor.cancel value (any value other than 'none' means available).
95
+ */
96
+ cancellationAvailable?: boolean;
97
+ reason?: string;
98
+ /**
99
+ * Whether the provider can stream right now in this host environment. Absent inherits the
100
+ * static descriptor.supports.streaming value.
101
+ */
102
+ streamingAvailable?: boolean;
103
+ /**
104
+ * Human-readable explanation used when streamingAvailable is false. Absent lets the planner
105
+ * synthesize a default message.
106
+ */
107
+ streamingUnavailableReason?: string;
108
+ [property: string]: unknown;
109
+ }
110
+
111
+ export type Descriptor = {
112
+ /**
113
+ * Cancellation guarantee the provider offers. Carried for route explanations and telemetry;
114
+ * the planner does not filter on it.
115
+ */
116
+ cancel?: Cancel;
117
+ id: string;
118
+ /**
119
+ * Descriptor privacy metadata used to enforce local/cloud routing rules.
120
+ */
121
+ privacy?: PrivacyObject;
122
+ supports: Supports;
123
+ tasks: string[];
124
+ type: Type;
125
+ [property: string]: unknown;
126
+ }
127
+
128
+ /**
129
+ * Cancellation guarantee the provider offers. Carried for route explanations and telemetry;
130
+ * the planner does not filter on it.
131
+ */
132
+ export type Cancel = "hard" | "soft" | "none";
133
+
134
+ /**
135
+ * Descriptor privacy metadata used to enforce local/cloud routing rules.
136
+ */
137
+ export type PrivacyObject = {
138
+ dataLeavesDevice: boolean;
139
+ regions?: string[];
140
+ [property: string]: unknown;
141
+ }
142
+
143
+ export type Supports = {
144
+ run: boolean;
145
+ /**
146
+ * Whether the provider statically declares Mode-2 streaming. Absent is treated as false: a
147
+ * descriptor that predates this field cannot be assumed to stream.
148
+ */
149
+ streaming?: boolean;
150
+ [property: string]: unknown;
151
+ }
152
+
153
+ export type Type = "local" | "edge" | "cloud";
154
+
155
+ /**
156
+ * Minimal task descriptor for provider task matching.
157
+ */
158
+ export type Task = {
159
+ kind: string;
160
+ [property: string]: unknown;
161
+ }