streamEventSchema
conststreamEventSchema:object
The JSON Schemas those models were generated from, for runtime use.
Type Declaration
Section titled “Type Declaration”
readonly$id:"https://schemas.inderun.dev/1.0/stream-event.schema.json"
$schema
Section titled “$schema”
readonly$schema:"https://json-schema.org/draft/2020-12/schema"
description
Section titled “description”
readonlydescription:"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)."
readonlyoneOf: readonly [{additionalProperties:true;properties: {payload: {additionalProperties:true;properties: {text: {description:"The incremental text produced since the previous content event.";type:"string"; }; };required: readonly ["text"];type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"content_delta";description:"User-visible content: an incremental text increment since the previous content_delta or content_snapshot event. Mirrors ProviderDescriptor.streamingStyle 'tokens'/'chunks' (packages/inderun-web/src/core/provider.ts) — providers reporting either style normalize to content_delta."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {additionalProperties:true;properties: {text: {description:"The full cumulative text produced by the run so far.";type:"string"; }; };required: readonly ["text"];type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"content_snapshot";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'."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {additionalProperties:true;properties: {phase: {description:"The lifecycle phase reached.";enum: readonly ["provider_selected","started"]; }; };required: readonly ["phase"];type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"lifecycle";description:"Mechanical/diagnostic: a run lifecycle transition (e.g. provider selection, execution start). Not user-visible content; not part of the generated text."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {additionalProperties:true;description:"Event-specific diagnostic metadata. It must not contain prompt payloads or raw secrets, matching the same guardrail as TelemetryEvent.payload.";type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"diagnostic";description:"Mechanical/diagnostic: free-form orchestration or provider diagnostic detail. Not user-visible content."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {additionalProperties:true;properties: {fractionCompleted: {description:"How much of this item is done, from 0 to 1. Absent when the platform reports no fraction.";maximum:1;minimum:0;type:"number"; };providerId: {description:"The provider being prepared.";minLength:1;type:"string"; };task: {description:"The task kind being prepared.";minLength:1;type:"string"; }; };required: readonly ["providerId","task"];type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"preparation_progress";description:"Progress of a prepare() run (ADR 019)."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {description:"Structurally identical to StreamTerminalOutcome (contracts/schemas/stream-terminal-outcome.schema.json), duplicated by value here rather than by $ref, matching this repo's schema convention of no cross-file references. Keep both shapes in sync; a cross-check test asserts a shared fixture validates against both schemas.";oneOf: readonly [{additionalProperties:true;anyOf: readonly […, …];properties: {finalText: {type: …; };finishReason: {enum: …; };outcome: {const: …; };output: {$ref: …; };provenance: {$ref: …;description: …; };runId: {minLength: …;type: …; };schemaVersion: {const: …; };telemetry: {additionalProperties: …;properties: …;required: …;type: …; };usage: {additionalProperties: …;properties: …;type: …; }; };required: readonly […, …, …];type:"object"; }, {additionalProperties:true;properties: {error: {additionalProperties: …;properties: …;required: …;type: …; };outcome: {const: …; };partialText: {type: …; };provenance: {$ref: …;description: …; };runId: {minLength: …;type: …; };schemaVersion: {const: …; }; };required: readonly […, …, …, …];type:"object"; }, {additionalProperties:true;properties: {outcome: {const: …; };output: {$ref: …; };partialText: {type: …; };provenance: {$ref: …;description: …; };reason: {type: …; };runId: {minLength: …;type: …; };schemaVersion: {const: …; }; };required: readonly […, …, …];type:"object"; }]; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. This is always the highest sequence number for the run: the terminal event.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {const:"terminal";description:"Terminal: the last event of the run, carrying the mutually-exclusive completion/error/cancellation outcome. No further StreamEvent is delivered for this runId after this event."; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type","payload"];type:"object"; }, {additionalProperties:true;properties: {payload: {additionalProperties:true;description:"Optional event-specific payload for the unrecognized type. It must not contain prompt payloads or raw secrets.";type:"object"; };runId: {description:"Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";minLength:1;type:"string"; };schemaVersion: {const:"1.0";description:"Contract schema version used to interpret this event payload."; };sequence: {description:"Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";minimum:0;type:"integer"; };timestamp: {description:"Wall-clock event timestamp in Unix epoch milliseconds.";minimum:0;type:"number"; };type: {description:"Forward-compatibility catch-all: any event type not among the known constants above. Exists so a consumer validating against this revision of the schema does not hard-fail when a future additive revision introduces a new known event type; SDKs must ignore or pass through such events for diagnostics rather than treating them as an error.";not: {enum: readonly ["content_delta","content_snapshot","lifecycle","diagnostic","preparation_progress","terminal"]; };type:"string"; }; };required: readonly ["schemaVersion","runId","sequence","timestamp","type"];type:"object"; }]
readonlytitle:"StreamEvent"
IndeRun — open-source AI execution for cross-platform apps. Built and maintained by Independo GmbH (opens in new tab), supported by netidee (opens in new tab).
MIT-licensed SDK · No SDK usage telemetry.
© 2025–2026 Independo GmbH