@independo/inderun-contracts 0.3.0-dev.8 → 0.3.0

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/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@independo/inderun-contracts?logo=npm)](https://www.npmjs.com/package/@independo/inderun-contracts)
4
4
 
5
- > Part of **[IndeRun](https://github.com/independo-gmbh/inderun)** — an open-source AI execution
6
- > framework that gives applications one unified API for running tasks across on-device, edge, and
7
- > cloud providers. New here? Start with the [IndeRun README](https://github.com/independo-gmbh/inderun#readme).
5
+ > Part of **[IndeRun](https://github.com/independo-gmbh/inderun)** — on-device AI with automatic
6
+ > cloud fallback, for cross-platform apps. New here? Start with the
7
+ > [IndeRun README](https://github.com/independo-gmbh/inderun#readme).
8
8
 
9
9
  Canonical JSON Schema-backed contracts for IndeRun.
10
10
 
@@ -159,7 +159,7 @@ export declare const taskResultSchema: {
159
159
  readonly $schema: "https://json-schema.org/draft/2020-12/schema";
160
160
  readonly $id: "https://schemas.inderun.dev/1.0/task-result.schema.json";
161
161
  readonly title: "TaskResult";
162
- readonly description: "The response payload for a completed text-to-text execution. A full execution failure (validation, routing, or every attempted provider failing) is surfaced by run() throwing an IndeRunError instead of returning a TaskResult; finishReason and telemetry.errorClass are reserved for a provider reporting a non-fatal, degraded outcome on an otherwise-successful result (not currently produced by any provider in this codebase).";
162
+ readonly description: "The response payload for a completed text-to-text execution. A full execution failure (validation, routing, or every attempted provider failing) is surfaced by run() throwing an IndeRunError instead of returning a TaskResult; finishReason and telemetry.errorClass are reserved for a provider reporting a non-fatal, degraded outcome on an otherwise-successful result (finishReason 'error' is produced by the Android ML Kit GenAI provider; telemetry.errorClass is not currently set by any provider in this codebase).";
163
163
  readonly type: "object";
164
164
  readonly additionalProperties: true;
165
165
  readonly required: readonly ["schemaVersion", "runId", "output", "finishReason", "telemetry"];
@@ -190,7 +190,7 @@ export declare const taskResultSchema: {
190
190
  };
191
191
  };
192
192
  readonly finishReason: {
193
- readonly description: "How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an otherwise-returned result — no provider in this codebase currently produces it, since a full execution failure is instead surfaced by run() throwing an IndeRunError.";
193
+ readonly description: "How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an otherwise-returned result — the Android ML Kit GenAI provider produces it when Gemini Nano reports a finish reason that is neither a natural stop nor the token limit. A full execution failure is instead surfaced by run() throwing an IndeRunError.";
194
194
  readonly enum: readonly ["stop", "length", "cancelled", "error"];
195
195
  };
196
196
  readonly usage: {
@@ -825,7 +825,7 @@ export declare const streamEventSchema: {
825
825
  readonly $schema: "https://json-schema.org/draft/2020-12/schema";
826
826
  readonly $id: "https://schemas.inderun.dev/1.0/stream-event.schema.json";
827
827
  readonly title: "StreamEvent";
828
- readonly description: "The canonical Mode 2 streaming event union, discriminated by 'type'. Every variant shares an envelope of schemaVersion, runId, sequence, timestamp, and type. 'sequence' is the ordering authority for events within a run (a monotonically increasing integer starting at 0 per runId) — consumers must order by 'sequence', not by arrival order, since a bridge hop (e.g. a future Capacitor bridge) could reorder delivery. Known event types are split into user-visible content ('content_delta', 'content_snapshot') and mechanical/diagnostic types ('lifecycle', 'diagnostic', 'terminal') so SDKs can distinguish what belongs in a chat UI from what is orchestration detail. Forward compatibility: this union closes with an open 'unknown_event' branch so a consumer built against an older revision of this schema does not hard-fail when a newer, additive minor revision introduces a new known type; per contracts/README.md's schema evolution policy, SDKs must treat an unrecognized 'type' as ignore-or-pass-through-for-diagnostics, never as a hard error. Design seam only; no engine or provider implementation exists yet (see docs/architecture/architecture.md).";
828
+ readonly description: "The canonical Mode 2 streaming event union, discriminated by 'type'. Every variant shares an envelope of schemaVersion, runId, sequence, timestamp, and type. 'sequence' is the ordering authority for events within a run (a monotonically increasing integer starting at 0 per runId) — consumers must order by 'sequence', not by arrival order, since a bridge hop (e.g. a future Capacitor bridge) could reorder delivery. Known event types are split into user-visible content ('content_delta', 'content_snapshot') and mechanical/diagnostic types ('lifecycle', 'diagnostic', 'terminal') so SDKs can distinguish what belongs in a chat UI from what is orchestration detail. Forward compatibility: this union closes with an open 'unknown_event' branch so a consumer built against an older revision of this schema does not hard-fail when a newer, additive minor revision introduces a new known type; per contracts/README.md's schema evolution policy, SDKs must treat an unrecognized 'type' as ignore-or-pass-through-for-diagnostics, never as a hard error. All three engines implement this union (see docs/architecture/architecture.md).";
829
829
  readonly oneOf: readonly [{
830
830
  readonly type: "object";
831
831
  readonly additionalProperties: true;
@@ -891,7 +891,7 @@ export declare const streamEventSchema: {
891
891
  readonly minimum: 0;
892
892
  };
893
893
  readonly type: {
894
- readonly description: "User-visible content: the full cumulative text produced so far. Mirrors ProviderDescriptor.streamingStyle 'snapshots' (packages/inderun-web/src/core/provider.ts) — providers reporting that style normalize to content_snapshot rather than content_delta.";
894
+ readonly description: "User-visible content: the full cumulative text produced so far. Mirrors ProviderDescriptor.streamingStyle 'snapshots' (packages/inderun-web/src/core/provider.ts) — providers reporting that style normalize to content_snapshot rather than content_delta. Retraction: a provider of any streamingStyle may additionally emit a content_snapshot to withdraw content it has already delivered, since a snapshot replaces the run's cumulative text rather than appending to it; an empty one therefore resets that text to nothing. This is how a provider whose backend rejects an in-flight response after partial delivery — an on-device safety/policy check, for example — tells consumers to discard what they have, so a consumer must handle content_snapshot even when the provider's declared style is 'tokens' or 'chunks'.";
895
895
  readonly const: "content_snapshot";
896
896
  };
897
897
  readonly payload: {
@@ -197,7 +197,7 @@ export const taskResultSchema = {
197
197
  "$schema": "https://json-schema.org/draft/2020-12/schema",
198
198
  "$id": "https://schemas.inderun.dev/1.0/task-result.schema.json",
199
199
  "title": "TaskResult",
200
- "description": "The response payload for a completed text-to-text execution. A full execution failure (validation, routing, or every attempted provider failing) is surfaced by run() throwing an IndeRunError instead of returning a TaskResult; finishReason and telemetry.errorClass are reserved for a provider reporting a non-fatal, degraded outcome on an otherwise-successful result (not currently produced by any provider in this codebase).",
200
+ "description": "The response payload for a completed text-to-text execution. A full execution failure (validation, routing, or every attempted provider failing) is surfaced by run() throwing an IndeRunError instead of returning a TaskResult; finishReason and telemetry.errorClass are reserved for a provider reporting a non-fatal, degraded outcome on an otherwise-successful result (finishReason 'error' is produced by the Android ML Kit GenAI provider; telemetry.errorClass is not currently set by any provider in this codebase).",
201
201
  "type": "object",
202
202
  "additionalProperties": true,
203
203
  "required": [
@@ -237,7 +237,7 @@ export const taskResultSchema = {
237
237
  }
238
238
  },
239
239
  "finishReason": {
240
- "description": "How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an otherwise-returned result — no provider in this codebase currently produces it, since a full execution failure is instead surfaced by run() throwing an IndeRunError.",
240
+ "description": "How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an otherwise-returned result — the Android ML Kit GenAI provider produces it when Gemini Nano reports a finish reason that is neither a natural stop nor the token limit. A full execution failure is instead surfaced by run() throwing an IndeRunError.",
241
241
  "enum": [
242
242
  "stop",
243
243
  "length",
@@ -1024,7 +1024,7 @@ export const streamEventSchema = {
1024
1024
  "$schema": "https://json-schema.org/draft/2020-12/schema",
1025
1025
  "$id": "https://schemas.inderun.dev/1.0/stream-event.schema.json",
1026
1026
  "title": "StreamEvent",
1027
- "description": "The canonical Mode 2 streaming event union, discriminated by 'type'. Every variant shares an envelope of schemaVersion, runId, sequence, timestamp, and type. 'sequence' is the ordering authority for events within a run (a monotonically increasing integer starting at 0 per runId) — consumers must order by 'sequence', not by arrival order, since a bridge hop (e.g. a future Capacitor bridge) could reorder delivery. Known event types are split into user-visible content ('content_delta', 'content_snapshot') and mechanical/diagnostic types ('lifecycle', 'diagnostic', 'terminal') so SDKs can distinguish what belongs in a chat UI from what is orchestration detail. Forward compatibility: this union closes with an open 'unknown_event' branch so a consumer built against an older revision of this schema does not hard-fail when a newer, additive minor revision introduces a new known type; per contracts/README.md's schema evolution policy, SDKs must treat an unrecognized 'type' as ignore-or-pass-through-for-diagnostics, never as a hard error. Design seam only; no engine or provider implementation exists yet (see docs/architecture/architecture.md).",
1027
+ "description": "The canonical Mode 2 streaming event union, discriminated by 'type'. Every variant shares an envelope of schemaVersion, runId, sequence, timestamp, and type. 'sequence' is the ordering authority for events within a run (a monotonically increasing integer starting at 0 per runId) — consumers must order by 'sequence', not by arrival order, since a bridge hop (e.g. a future Capacitor bridge) could reorder delivery. Known event types are split into user-visible content ('content_delta', 'content_snapshot') and mechanical/diagnostic types ('lifecycle', 'diagnostic', 'terminal') so SDKs can distinguish what belongs in a chat UI from what is orchestration detail. Forward compatibility: this union closes with an open 'unknown_event' branch so a consumer built against an older revision of this schema does not hard-fail when a newer, additive minor revision introduces a new known type; per contracts/README.md's schema evolution policy, SDKs must treat an unrecognized 'type' as ignore-or-pass-through-for-diagnostics, never as a hard error. All three engines implement this union (see docs/architecture/architecture.md).",
1028
1028
  "oneOf": [
1029
1029
  {
1030
1030
  "type": "object",
@@ -1108,7 +1108,7 @@ export const streamEventSchema = {
1108
1108
  "minimum": 0
1109
1109
  },
1110
1110
  "type": {
1111
- "description": "User-visible content: the full cumulative text produced so far. Mirrors ProviderDescriptor.streamingStyle 'snapshots' (packages/inderun-web/src/core/provider.ts) — providers reporting that style normalize to content_snapshot rather than content_delta.",
1111
+ "description": "User-visible content: the full cumulative text produced so far. Mirrors ProviderDescriptor.streamingStyle 'snapshots' (packages/inderun-web/src/core/provider.ts) — providers reporting that style normalize to content_snapshot rather than content_delta. Retraction: a provider of any streamingStyle may additionally emit a content_snapshot to withdraw content it has already delivered, since a snapshot replaces the run's cumulative text rather than appending to it; an empty one therefore resets that text to nothing. This is how a provider whose backend rejects an in-flight response after partial delivery — an on-device safety/policy check, for example — tells consumers to discard what they have, so a consumer must handle content_snapshot even when the provider's declared style is 'tokens' or 'chunks'.",
1112
1112
  "const": "content_snapshot"
1113
1113
  },
1114
1114
  "payload": {
@@ -11,7 +11,7 @@
11
11
  * against an older revision of this schema does not hard-fail when a newer, additive minor
12
12
  * revision introduces a new known type; per contracts/README.md's schema evolution policy,
13
13
  * SDKs must treat an unrecognized 'type' as ignore-or-pass-through-for-diagnostics, never
14
- * as a hard error. Design seam only; no engine or provider implementation exists yet (see
14
+ * as a hard error. All three engines implement this union (see
15
15
  * docs/architecture/architecture.md).
16
16
  */
17
17
  export type StreamEvent = {
@@ -57,8 +57,14 @@ export type StreamEvent = {
57
57
  *
58
58
  * User-visible content: the full cumulative text produced so far. Mirrors
59
59
  * ProviderDescriptor.streamingStyle 'snapshots' (packages/inderun-web/src/core/provider.ts)
60
- * — providers reporting that style normalize to content_snapshot rather than
61
- * content_delta.
60
+ * — providers reporting that style normalize to content_snapshot rather than content_delta.
61
+ * Retraction: a provider of any streamingStyle may additionally emit a content_snapshot to
62
+ * withdraw content it has already delivered, since a snapshot replaces the run's cumulative
63
+ * text rather than appending to it; an empty one therefore resets that text to nothing.
64
+ * This is how a provider whose backend rejects an in-flight response after partial delivery
65
+ * — an on-device safety/policy check, for example — tells consumers to discard what they
66
+ * have, so a consumer must handle content_snapshot even when the provider's declared style
67
+ * is 'tokens' or 'chunks'.
62
68
  *
63
69
  * Mechanical/diagnostic: a run lifecycle transition (e.g. provider selection, execution
64
70
  * start). Not user-visible content; not part of the generated text.
@@ -1 +1 @@
1
- {"version":3,"file":"stream-event.d.ts","sourceRoot":"","sources":["../../src/generated/stream-event.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,EAAE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,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAChB,WAAW,CAAC,EAAG,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAG,MAAM,CAAC;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA"}
@@ -3,14 +3,16 @@
3
3
  * (validation, routing, or every attempted provider failing) is surfaced by run() throwing
4
4
  * an IndeRunError instead of returning a TaskResult; finishReason and telemetry.errorClass
5
5
  * are reserved for a provider reporting a non-fatal, degraded outcome on an
6
- * otherwise-successful result (not currently produced by any provider in this codebase).
6
+ * otherwise-successful result (finishReason 'error' is produced by the Android ML Kit GenAI
7
+ * provider; telemetry.errorClass is not currently set by any provider in this codebase).
7
8
  */
8
9
  export type TaskResult = {
9
10
  /**
10
11
  * How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or
11
12
  * 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an
12
- * otherwise-returned result — no provider in this codebase currently produces it, since a
13
- * full execution failure is instead surfaced by run() throwing an IndeRunError.
13
+ * otherwise-returned result — the Android ML Kit GenAI provider produces it when Gemini
14
+ * Nano reports a finish reason that is neither a natural stop nor the token limit. A full
15
+ * execution failure is instead surfaced by run() throwing an IndeRunError.
14
16
  */
15
17
  finishReason: FinishReason;
16
18
  /**
@@ -38,8 +40,9 @@ export type TaskResult = {
38
40
  /**
39
41
  * How generation ended: 'stop' (natural end), 'length' (hit maxOutputTokens), or
40
42
  * 'cancelled'. 'error' is reserved for a provider reporting a non-fatal issue on an
41
- * otherwise-returned result — no provider in this codebase currently produces it, since a
42
- * full execution failure is instead surfaced by run() throwing an IndeRunError.
43
+ * otherwise-returned result — the Android ML Kit GenAI provider produces it when Gemini
44
+ * Nano reports a finish reason that is neither a natural stop nor the token limit. A full
45
+ * execution failure is instead surfaced by run() throwing an IndeRunError.
43
46
  */
44
47
  export type FinishReason = "stop" | "length" | "cancelled" | "error";
45
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"task-result.d.ts","sourceRoot":"","sources":["../../src/generated/task-result.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB;;;;;OAKG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAEjI;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA"}
1
+ {"version":3,"file":"task-result.d.ts","sourceRoot":"","sources":["../../src/generated/task-result.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB;;;;;;OAMG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAEjI;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA"}
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@independo/inderun-contracts",
3
- "version": "0.3.0-dev.8",
4
- "description": "Canonical JSON Schemas, generated TypeScript types, and validators for IndeRun contracts.",
3
+ "version": "0.3.0",
4
+ "description": "Canonical JSON Schemas, generated TypeScript types, and validators for the IndeRun task, streaming, error, and routing contracts.",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Independo GmbH",
@@ -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": {
@@ -21,9 +21,12 @@
21
21
  "keywords": [
22
22
  "inderun",
23
23
  "ai",
24
+ "llm",
24
25
  "contracts",
25
26
  "json-schema",
26
- "validation"
27
+ "validation",
28
+ "types",
29
+ "streaming"
27
30
  ],
28
31
  "engines": {
29
32
  "node": ">=24"
@@ -39,17 +42,20 @@
39
42
  },
40
43
  "files": [
41
44
  "dist",
45
+ "src",
46
+ "!src/**/*.test.ts",
42
47
  "README.md"
43
48
  ],
44
49
  "dependencies": {
45
50
  "ajv": "^8.20.0"
46
51
  },
47
52
  "devDependencies": {
48
- "@types/node": "^26.2.0",
53
+ "@types/node": "^26.5.1",
49
54
  "vitest": "^4.1.11"
50
55
  },
51
56
  "scripts": {
52
57
  "build": "tsc -p tsconfig.json",
53
- "test": "vitest run"
58
+ "test": "vitest run",
59
+ "verify:packaging": "publint && attw --pack . --profile esm-only"
54
60
  }
55
61
  }
@@ -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";