@independo/inderun-contracts 0.2.2 → 0.3.0-dev.10
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/index.d.ts +3 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/route-plan.d.ts +13 -1
- package/dist/generated/route-plan.d.ts.map +1 -1
- package/dist/generated/route-planner-input.d.ts +43 -1
- package/dist/generated/route-planner-input.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +575 -3
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +734 -2
- package/dist/generated/stream-event.d.ts +141 -0
- package/dist/generated/stream-event.d.ts.map +1 -0
- package/dist/generated/stream-event.js +2 -0
- package/dist/generated/stream-run.d.ts +31 -0
- package/dist/generated/stream-run.d.ts.map +1 -0
- package/dist/generated/stream-run.js +2 -0
- package/dist/generated/stream-terminal-outcome.d.ts +181 -0
- package/dist/generated/stream-terminal-outcome.d.ts.map +1 -0
- package/dist/generated/stream-terminal-outcome.js +2 -0
- package/dist/generated/telemetry-event.d.ts +1 -1
- package/dist/generated/telemetry-event.d.ts.map +1 -1
- package/dist/host.d.ts +84 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/validators.d.ts +9 -0
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +26 -1
- package/package.json +2 -2
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical Mode 2 streaming event union, discriminated by 'type'. Every variant shares
|
|
3
|
+
* an envelope of schemaVersion, runId, sequence, timestamp, and type. 'sequence' is the
|
|
4
|
+
* ordering authority for events within a run (a monotonically increasing integer starting
|
|
5
|
+
* at 0 per runId) — consumers must order by 'sequence', not by arrival order, since a
|
|
6
|
+
* bridge hop (e.g. a future Capacitor bridge) could reorder delivery. Known event types are
|
|
7
|
+
* split into user-visible content ('content_delta', 'content_snapshot') and
|
|
8
|
+
* mechanical/diagnostic types ('lifecycle', 'diagnostic', 'terminal') so SDKs can
|
|
9
|
+
* distinguish what belongs in a chat UI from what is orchestration detail. Forward
|
|
10
|
+
* compatibility: this union closes with an open 'unknown_event' branch so a consumer built
|
|
11
|
+
* against an older revision of this schema does not hard-fail when a newer, additive minor
|
|
12
|
+
* revision introduces a new known type; per contracts/README.md's schema evolution policy,
|
|
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
|
|
15
|
+
* docs/architecture/architecture.md).
|
|
16
|
+
*/
|
|
17
|
+
export type StreamEvent = {
|
|
18
|
+
/**
|
|
19
|
+
* Event-specific diagnostic metadata. It must not contain prompt payloads or raw secrets,
|
|
20
|
+
* matching the same guardrail as TelemetryEvent.payload.
|
|
21
|
+
*
|
|
22
|
+
* Structurally identical to StreamTerminalOutcome
|
|
23
|
+
* (contracts/schemas/stream-terminal-outcome.schema.json), duplicated by value here rather
|
|
24
|
+
* than by $ref, matching this repo's schema convention of no cross-file references. Keep
|
|
25
|
+
* both shapes in sync; a cross-check test asserts a shared fixture validates against both
|
|
26
|
+
* schemas.
|
|
27
|
+
*
|
|
28
|
+
* Optional event-specific payload for the unrecognized type. It must not contain prompt
|
|
29
|
+
* payloads or raw secrets.
|
|
30
|
+
*/
|
|
31
|
+
payload?: Payload;
|
|
32
|
+
/**
|
|
33
|
+
* Opaque run identifier this event belongs to, matching StreamRunHandle.runId.
|
|
34
|
+
*/
|
|
35
|
+
runId: string;
|
|
36
|
+
/**
|
|
37
|
+
* Contract schema version used to interpret this event payload.
|
|
38
|
+
*/
|
|
39
|
+
schemaVersion: "1.0";
|
|
40
|
+
/**
|
|
41
|
+
* Zero-based, monotonically increasing event index within this run. The ordering authority;
|
|
42
|
+
* do not rely on delivery/arrival order.
|
|
43
|
+
*
|
|
44
|
+
* Zero-based, monotonically increasing event index within this run. This is always the
|
|
45
|
+
* highest sequence number for the run: the terminal event.
|
|
46
|
+
*/
|
|
47
|
+
sequence: number;
|
|
48
|
+
/**
|
|
49
|
+
* Wall-clock event timestamp in Unix epoch milliseconds.
|
|
50
|
+
*/
|
|
51
|
+
timestamp: number;
|
|
52
|
+
/**
|
|
53
|
+
* User-visible content: an incremental text increment since the previous content_delta or
|
|
54
|
+
* content_snapshot event. Mirrors ProviderDescriptor.streamingStyle 'tokens'/'chunks'
|
|
55
|
+
* (packages/inderun-web/src/core/provider.ts) — providers reporting either style normalize
|
|
56
|
+
* to content_delta.
|
|
57
|
+
*
|
|
58
|
+
* User-visible content: the full cumulative text produced so far. Mirrors
|
|
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.
|
|
62
|
+
*
|
|
63
|
+
* Mechanical/diagnostic: a run lifecycle transition (e.g. provider selection, execution
|
|
64
|
+
* start). Not user-visible content; not part of the generated text.
|
|
65
|
+
*
|
|
66
|
+
* Mechanical/diagnostic: free-form orchestration or provider diagnostic detail. Not
|
|
67
|
+
* user-visible content.
|
|
68
|
+
*
|
|
69
|
+
* Terminal: the last event of the run, carrying the mutually-exclusive
|
|
70
|
+
* completion/error/cancellation outcome. No further StreamEvent is delivered for this runId
|
|
71
|
+
* after this event.
|
|
72
|
+
*
|
|
73
|
+
* Forward-compatibility catch-all: any event type not among the known constants above.
|
|
74
|
+
* Exists so a consumer validating against this revision of the schema does not hard-fail
|
|
75
|
+
* when a future additive revision introduces a new known event type; SDKs must ignore or
|
|
76
|
+
* pass through such events for diagnostics rather than treating them as an error.
|
|
77
|
+
*/
|
|
78
|
+
type: string;
|
|
79
|
+
[property: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Event-specific diagnostic metadata. It must not contain prompt payloads or raw secrets,
|
|
83
|
+
* matching the same guardrail as TelemetryEvent.payload.
|
|
84
|
+
*
|
|
85
|
+
* Optional event-specific payload for the unrecognized type. It must not contain prompt
|
|
86
|
+
* payloads or raw secrets.
|
|
87
|
+
*/
|
|
88
|
+
export type Payload = {
|
|
89
|
+
/**
|
|
90
|
+
* The incremental text produced since the previous content event.
|
|
91
|
+
*
|
|
92
|
+
* The full cumulative text produced by the run so far.
|
|
93
|
+
*/
|
|
94
|
+
text?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The lifecycle phase reached.
|
|
97
|
+
*/
|
|
98
|
+
phase?: Phase;
|
|
99
|
+
finalText?: string;
|
|
100
|
+
finishReason?: FinishReason;
|
|
101
|
+
outcome?: Outcome;
|
|
102
|
+
runId?: string;
|
|
103
|
+
schemaVersion?: "1.0";
|
|
104
|
+
telemetry?: Telemetry;
|
|
105
|
+
usage?: Usage;
|
|
106
|
+
error?: Error;
|
|
107
|
+
partialText?: string;
|
|
108
|
+
reason?: string;
|
|
109
|
+
[property: string]: unknown;
|
|
110
|
+
};
|
|
111
|
+
export type Error = {
|
|
112
|
+
details?: {
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
};
|
|
115
|
+
errorClass: ErrorClass;
|
|
116
|
+
message: string;
|
|
117
|
+
providerId?: string;
|
|
118
|
+
retryable?: boolean;
|
|
119
|
+
retryAfterMs?: number;
|
|
120
|
+
schemaVersion: "1.0";
|
|
121
|
+
[property: string]: unknown;
|
|
122
|
+
};
|
|
123
|
+
export type ErrorClass = "CapabilityMismatch" | "Offline" | "AuthError" | "RateLimited" | "Timeout" | "Unavailable" | "Internal";
|
|
124
|
+
export type FinishReason = "stop" | "length" | "cancelled" | "error";
|
|
125
|
+
export type Outcome = "completed" | "error" | "cancelled";
|
|
126
|
+
/**
|
|
127
|
+
* The lifecycle phase reached.
|
|
128
|
+
*/
|
|
129
|
+
export type Phase = "provider_selected" | "started";
|
|
130
|
+
export type Telemetry = {
|
|
131
|
+
providerUsed: string;
|
|
132
|
+
totalMs: number;
|
|
133
|
+
[property: string]: unknown;
|
|
134
|
+
};
|
|
135
|
+
export type Usage = {
|
|
136
|
+
inputTokens?: number;
|
|
137
|
+
outputTokens?: number;
|
|
138
|
+
totalTokens?: number;
|
|
139
|
+
[property: string]: unknown;
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=stream-event.d.ts.map
|
|
@@ -0,0 +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,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAU,KAAK,CAAC;IACtB,SAAS,CAAC,EAAM,MAAM,CAAC;IACvB,YAAY,CAAC,EAAG,YAAY,CAAC;IAC7B,OAAO,CAAC,EAAQ,OAAO,CAAC;IACxB,KAAK,CAAC,EAAU,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,SAAS,CAAC,EAAM,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAU,KAAK,CAAC;IACtB,KAAK,CAAC,EAAU,KAAK,CAAC;IACtB,WAAW,CAAC,EAAI,MAAM,CAAC;IACvB,MAAM,CAAC,EAAS,MAAM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
|
+
* StreamEvent has arrived. This is the identity/correlation contract only: the live,
|
|
4
|
+
* consumable stream itself is a platform-idiomatic construct (an AsyncIterable<StreamEvent>
|
|
5
|
+
* in TypeScript, a Flow<StreamEvent> in Kotlin, an AsyncThrowingStream<StreamEvent, Error>
|
|
6
|
+
* in Swift) that is never serialized and is out of scope for this schema. Design seam only;
|
|
7
|
+
* no engine or provider implementation exists yet (see docs/architecture/architecture.md).
|
|
8
|
+
*/
|
|
9
|
+
export type StreamRunHandle = {
|
|
10
|
+
/**
|
|
11
|
+
* Identifier of the provider selected to service this stream, if routing has completed by
|
|
12
|
+
* the time the handle is returned. Absent while route selection is still pending.
|
|
13
|
+
*/
|
|
14
|
+
providerId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A unique, opaque identifier assigned by the engine for this stream run. Every StreamEvent
|
|
17
|
+
* and the terminal StreamTerminalOutcome for this run carry the same runId, matching the
|
|
18
|
+
* identity convention used by TaskResult.runId and IndeRunError.runId.
|
|
19
|
+
*/
|
|
20
|
+
runId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Contract schema version used to interpret this handle payload.
|
|
23
|
+
*/
|
|
24
|
+
schemaVersion: "1.0";
|
|
25
|
+
/**
|
|
26
|
+
* Wall-clock time the stream run was opened, in Unix epoch milliseconds.
|
|
27
|
+
*/
|
|
28
|
+
startedAt: number;
|
|
29
|
+
[property: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=stream-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-run.d.ts","sourceRoot":"","sources":["../../src/generated/stream-run.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a Mode 2 stream run ended. Completion, error, and cancellation are mutually exclusive
|
|
3
|
+
* terminal outcomes, enforced here as a closed set of three oneOf branches discriminated by
|
|
4
|
+
* 'outcome' (unlike StreamEvent.type, this set is not open-ended: the three-way terminal
|
|
5
|
+
* outcome is a fixed architectural guarantee, not something new outcome kinds get added
|
|
6
|
+
* to). Exactly one StreamTerminalOutcome is produced per run, and no further StreamEvent is
|
|
7
|
+
* delivered after it (see docs/architecture/architecture.md, 'Cancellation And Fallback').
|
|
8
|
+
* This shape is also embedded by value as the payload of the terminal StreamEvent
|
|
9
|
+
* (stream-event.schema.json) so it can additionally be exposed standalone, e.g. as a
|
|
10
|
+
* completion future/promise a stream handle resolves independently of consuming the full
|
|
11
|
+
* event sequence; the two copies must stay structurally identical. Note on
|
|
12
|
+
* additionalProperties: per this repo's forward-compatible convention every branch permits
|
|
13
|
+
* unknown extra fields, so mutual exclusivity is enforced via the required 'outcome'
|
|
14
|
+
* discriminator plus each branch's own required peer field (finalText/error/partialText)
|
|
15
|
+
* being present, not by forbidding a payload from also carrying an unrelated stray field
|
|
16
|
+
* from another branch's vocabulary.
|
|
17
|
+
*/
|
|
18
|
+
export type StreamTerminalOutcome = {
|
|
19
|
+
/**
|
|
20
|
+
* The full, cumulative text produced by the run. Equivalent in role to
|
|
21
|
+
* TaskResult.output.text for Mode 1.
|
|
22
|
+
*/
|
|
23
|
+
finalText?: string;
|
|
24
|
+
/**
|
|
25
|
+
* How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end),
|
|
26
|
+
* 'length' (hit maxOutputTokens), 'error' (provider reported a non-fatal issue on an
|
|
27
|
+
* otherwise completed run). 'cancelled' is included so this enum stays identical to
|
|
28
|
+
* TaskResult.finishReason, but it is unreachable here: cancellation is its own terminal
|
|
29
|
+
* outcome branch. Optional: providers that do not report a finish reason omit it.
|
|
30
|
+
*/
|
|
31
|
+
finishReason?: FinishReason;
|
|
32
|
+
/**
|
|
33
|
+
* The stream completed normally: every provider-generated event was delivered before this
|
|
34
|
+
* outcome was produced.
|
|
35
|
+
*
|
|
36
|
+
* The stream ended in failure: validation, routing (no eligible provider), or every
|
|
37
|
+
* attempted provider failing.
|
|
38
|
+
*
|
|
39
|
+
* The stream was cancelled. No further StreamEvent is delivered after this outcome, and no
|
|
40
|
+
* further fallback attempt is made, per the engine's cancellation guarantee.
|
|
41
|
+
*/
|
|
42
|
+
outcome: Outcome;
|
|
43
|
+
/**
|
|
44
|
+
* The stream run this outcome terminates, matching StreamRunHandle.runId and every
|
|
45
|
+
* StreamEvent.runId for the run.
|
|
46
|
+
*/
|
|
47
|
+
runId: string;
|
|
48
|
+
/**
|
|
49
|
+
* Contract schema version used to interpret this outcome payload.
|
|
50
|
+
*/
|
|
51
|
+
schemaVersion: "1.0";
|
|
52
|
+
/**
|
|
53
|
+
* Required metadata providing an overview of the execution result and performance metrics.
|
|
54
|
+
* Same shape as TaskResult.telemetry.
|
|
55
|
+
*/
|
|
56
|
+
telemetry?: Telemetry;
|
|
57
|
+
/**
|
|
58
|
+
* Optional metadata regarding the quantity of tokens processed by the provider. Same shape
|
|
59
|
+
* as TaskResult.usage.
|
|
60
|
+
*/
|
|
61
|
+
usage?: Usage;
|
|
62
|
+
/**
|
|
63
|
+
* The normalized error for this failure. Structurally identical to IndeRunError
|
|
64
|
+
* (contracts/schemas/inderun-error.schema.json), duplicated by value here rather than by
|
|
65
|
+
* $ref, matching this repo's schema convention of no cross-file references. Keep both
|
|
66
|
+
* shapes in sync; a cross-check test asserts a shared fixture validates against both
|
|
67
|
+
* schemas.
|
|
68
|
+
*/
|
|
69
|
+
error?: Error;
|
|
70
|
+
/**
|
|
71
|
+
* Whatever cumulative text had already been delivered via content_delta/content_snapshot
|
|
72
|
+
* StreamEvents before the cancellation point. May be empty if cancellation occurred before
|
|
73
|
+
* any content was produced.
|
|
74
|
+
*/
|
|
75
|
+
partialText?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Optional human-readable reason the run was cancelled (e.g. caller-initiated abort). Not a
|
|
78
|
+
* machine-taxonomy field; use errorClass on the 'error' outcome branch for failure
|
|
79
|
+
* classification.
|
|
80
|
+
*/
|
|
81
|
+
reason?: string;
|
|
82
|
+
[property: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The normalized error for this failure. Structurally identical to IndeRunError
|
|
86
|
+
* (contracts/schemas/inderun-error.schema.json), duplicated by value here rather than by
|
|
87
|
+
* $ref, matching this repo's schema convention of no cross-file references. Keep both
|
|
88
|
+
* shapes in sync; a cross-check test asserts a shared fixture validates against both
|
|
89
|
+
* schemas.
|
|
90
|
+
*/
|
|
91
|
+
export type Error = {
|
|
92
|
+
/**
|
|
93
|
+
* Optional structured diagnostic details. It must not contain raw secrets.
|
|
94
|
+
*/
|
|
95
|
+
details?: {
|
|
96
|
+
[key: string]: unknown;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Normalized error taxonomy, identical to IndeRunError.errorClass: CapabilityMismatch
|
|
100
|
+
* (request needs something no eligible provider supports), Offline/Unavailable (provider
|
|
101
|
+
* unreachable or not ready), AuthError (credential/auth failure), RateLimited (provider
|
|
102
|
+
* throttled the request), Timeout (provider exceeded its execution budget), Internal
|
|
103
|
+
* (unexpected engine-side failure).
|
|
104
|
+
*/
|
|
105
|
+
errorClass: ErrorClass;
|
|
106
|
+
/**
|
|
107
|
+
* Human-readable error message suitable for logs and developer diagnostics.
|
|
108
|
+
*/
|
|
109
|
+
message: string;
|
|
110
|
+
/**
|
|
111
|
+
* Identifier of the provider associated with the failure, if execution reached a provider.
|
|
112
|
+
*/
|
|
113
|
+
providerId?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Whether retrying the same request may succeed.
|
|
116
|
+
*/
|
|
117
|
+
retryable?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Optional suggested delay before retrying, in milliseconds.
|
|
120
|
+
*/
|
|
121
|
+
retryAfterMs?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Contract schema version used to interpret the error payload.
|
|
124
|
+
*/
|
|
125
|
+
schemaVersion: "1.0";
|
|
126
|
+
[property: string]: unknown;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Normalized error taxonomy, identical to IndeRunError.errorClass: CapabilityMismatch
|
|
130
|
+
* (request needs something no eligible provider supports), Offline/Unavailable (provider
|
|
131
|
+
* unreachable or not ready), AuthError (credential/auth failure), RateLimited (provider
|
|
132
|
+
* throttled the request), Timeout (provider exceeded its execution budget), Internal
|
|
133
|
+
* (unexpected engine-side failure).
|
|
134
|
+
*/
|
|
135
|
+
export type ErrorClass = "CapabilityMismatch" | "Offline" | "AuthError" | "RateLimited" | "Timeout" | "Unavailable" | "Internal";
|
|
136
|
+
/**
|
|
137
|
+
* How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end),
|
|
138
|
+
* 'length' (hit maxOutputTokens), 'error' (provider reported a non-fatal issue on an
|
|
139
|
+
* otherwise completed run). 'cancelled' is included so this enum stays identical to
|
|
140
|
+
* TaskResult.finishReason, but it is unreachable here: cancellation is its own terminal
|
|
141
|
+
* outcome branch. Optional: providers that do not report a finish reason omit it.
|
|
142
|
+
*/
|
|
143
|
+
export type FinishReason = "stop" | "length" | "cancelled" | "error";
|
|
144
|
+
export type Outcome = "completed" | "error" | "cancelled";
|
|
145
|
+
/**
|
|
146
|
+
* Required metadata providing an overview of the execution result and performance metrics.
|
|
147
|
+
* Same shape as TaskResult.telemetry.
|
|
148
|
+
*/
|
|
149
|
+
export type Telemetry = {
|
|
150
|
+
/**
|
|
151
|
+
* The identifier for the specific provider that handled the request (e.g.,
|
|
152
|
+
* 'openai_compatible_cloud').
|
|
153
|
+
*/
|
|
154
|
+
providerUsed: string;
|
|
155
|
+
/**
|
|
156
|
+
* Measured execution duration in milliseconds, including route selection and result
|
|
157
|
+
* processing.
|
|
158
|
+
*/
|
|
159
|
+
totalMs: number;
|
|
160
|
+
[property: string]: unknown;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Optional metadata regarding the quantity of tokens processed by the provider. Same shape
|
|
164
|
+
* as TaskResult.usage.
|
|
165
|
+
*/
|
|
166
|
+
export type Usage = {
|
|
167
|
+
/**
|
|
168
|
+
* Number of input tokens consumed, as reported by the provider.
|
|
169
|
+
*/
|
|
170
|
+
inputTokens?: number;
|
|
171
|
+
/**
|
|
172
|
+
* Number of output tokens generated, as reported by the provider.
|
|
173
|
+
*/
|
|
174
|
+
outputTokens?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Aggregated token count for this request, as reported by the provider.
|
|
177
|
+
*/
|
|
178
|
+
totalTokens?: number;
|
|
179
|
+
[property: string]: unknown;
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=stream-terminal-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-terminal-outcome.d.ts","sourceRoot":"","sources":["../../src/generated/stream-terminal-outcome.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;;;;;;OASG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAA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AEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA"}
|
|
@@ -25,5 +25,5 @@ export type TelemetryEvent = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Telemetry event kind emitted by the orchestrator or provider integration.
|
|
27
27
|
*/
|
|
28
|
-
export type Type = "route_decided" | "attempt_succeeded" | "attempt_failed";
|
|
28
|
+
export type Type = "route_decided" | "attempt_succeeded" | "attempt_failed" | "stream_attempt_started" | "stream_attempt_succeeded" | "stream_attempt_failed" | "stream_completed" | "stream_failed" | "stream_cancelled";
|
|
29
29
|
//# sourceMappingURL=telemetry-event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-event.d.ts","sourceRoot":"","sources":["../../src/generated/telemetry-event.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,eAAe,GAAG,mBAAmB,GAAG,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"telemetry-event.d.ts","sourceRoot":"","sources":["../../src/generated/telemetry-event.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,eAAe,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,wBAAwB,GAAG,0BAA0B,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,eAAe,GAAG,kBAAkB,CAAC"}
|
package/dist/host.d.ts
CHANGED
|
@@ -67,6 +67,85 @@ export interface HttpClientService {
|
|
|
67
67
|
*/
|
|
68
68
|
send(request: HttpRequest): Promise<HttpResponse>;
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The structural subset of the standard `AbortSignal` that IndeRun relies on.
|
|
72
|
+
*
|
|
73
|
+
* The contracts package targets a platform-neutral library surface and so has
|
|
74
|
+
* no DOM lib; a real `AbortSignal` satisfies this shape, so host implementations
|
|
75
|
+
* and callers can pass one directly.
|
|
76
|
+
*/
|
|
77
|
+
export interface AbortSignalLike {
|
|
78
|
+
/**
|
|
79
|
+
* Whether cancellation has already been requested.
|
|
80
|
+
*/
|
|
81
|
+
readonly aborted: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Registers a cancellation listener.
|
|
84
|
+
*/
|
|
85
|
+
addEventListener(type: "abort", listener: () => void, options?: {
|
|
86
|
+
once?: boolean;
|
|
87
|
+
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* Removes a previously registered cancellation listener.
|
|
90
|
+
*/
|
|
91
|
+
removeEventListener(type: "abort", listener: () => void): void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A streamed HTTP response: the status line and headers are resolved first, and
|
|
95
|
+
* the body is delivered incrementally as raw byte chunks.
|
|
96
|
+
*
|
|
97
|
+
* The head is deliberately separated from the body so a caller can classify a
|
|
98
|
+
* non-2xx response (mapping it through the normal HTTP error taxonomy) before
|
|
99
|
+
* deciding to interpret the body as a protocol stream. Chunk boundaries are
|
|
100
|
+
* transport artifacts and carry no meaning: a chunk may split a protocol frame
|
|
101
|
+
* or even a multi-byte UTF-8 sequence, so consumers must buffer and decode
|
|
102
|
+
* incrementally rather than treating a chunk as a unit.
|
|
103
|
+
*/
|
|
104
|
+
export interface HttpStreamResponse {
|
|
105
|
+
/**
|
|
106
|
+
* HTTP status code.
|
|
107
|
+
*/
|
|
108
|
+
status: number;
|
|
109
|
+
/**
|
|
110
|
+
* HTTP status text.
|
|
111
|
+
*/
|
|
112
|
+
statusText: string;
|
|
113
|
+
/**
|
|
114
|
+
* Response headers, with lower-cased names.
|
|
115
|
+
*/
|
|
116
|
+
headers: Record<string, string>;
|
|
117
|
+
/**
|
|
118
|
+
* The response body as an incremental sequence of raw byte chunks. Iterating
|
|
119
|
+
* it to completion, or abandoning it, releases the underlying connection.
|
|
120
|
+
*/
|
|
121
|
+
body: AsyncIterable<Uint8Array>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Optional host capability for HTTP responses that must be consumed while they
|
|
125
|
+
* are still arriving — the transport requirement behind Mode 2 streaming over
|
|
126
|
+
* the network (for example server-sent events).
|
|
127
|
+
*
|
|
128
|
+
* It is a separate service rather than a method on {@link HttpClientService}
|
|
129
|
+
* because it is genuinely optional: a host that cannot stream simply omits it,
|
|
130
|
+
* and providers report that as `streamingAvailable: false` in their dynamic
|
|
131
|
+
* capabilities, which the route planner turns into an inspectable
|
|
132
|
+
* `streaming_unavailable` rejection.
|
|
133
|
+
*/
|
|
134
|
+
export interface HttpStreamingClientService {
|
|
135
|
+
/**
|
|
136
|
+
* Dispatches a normalized HTTP request and resolves once the response head is
|
|
137
|
+
* available, leaving the body to be consumed incrementally.
|
|
138
|
+
*
|
|
139
|
+
* `HttpRequest.timeoutMs` bounds the wait for the response head only — the
|
|
140
|
+
* time to first byte. It cannot bound total duration, since a stream is
|
|
141
|
+
* open-ended by nature; use `signal` to stop a stream that runs too long.
|
|
142
|
+
*
|
|
143
|
+
* @param request - Normalized HTTP request payload.
|
|
144
|
+
* @param signal - Optional caller-driven cancellation. Aborting it must tear
|
|
145
|
+
* down the underlying connection and cause the body iterator to stop.
|
|
146
|
+
*/
|
|
147
|
+
stream(request: HttpRequest, signal?: AbortSignalLike): Promise<HttpStreamResponse>;
|
|
148
|
+
}
|
|
70
149
|
export type TelemetryEventType = TelemetryEvent["type"];
|
|
71
150
|
/**
|
|
72
151
|
* Telemetry service listener hook interface.
|
|
@@ -103,6 +182,11 @@ export interface HostServices {
|
|
|
103
182
|
* HTTP Client service for performing network requests.
|
|
104
183
|
*/
|
|
105
184
|
httpClient?: HttpClientService;
|
|
185
|
+
/**
|
|
186
|
+
* HTTP client service for responses consumed while still arriving. Absent on
|
|
187
|
+
* hosts that cannot stream a response body.
|
|
188
|
+
*/
|
|
189
|
+
streamingHttpClient?: HttpStreamingClientService;
|
|
106
190
|
/**
|
|
107
191
|
* Telemetry service to monitor execution steps, latency, and success rates.
|
|
108
192
|
*/
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,eAAe,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C;;OAEG;IACH,qBAAqB,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,oBAA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ACjD;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type * from "./generated/index.js";
|
|
2
|
-
export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
3
|
-
export { getHttpRequestValidationIssues, getHttpResponseValidationIssues, getIndeRunErrorValidationIssues, getModelPackageValidationIssues, getRoutePlanValidationIssues, getRoutePlannerInputValidationIssues, getTaskRequestValidationIssues, getTaskResultValidationIssues, getTelemetryEventValidationIssues, validateHttpRequest, validateHttpResponse, validateIndeRunError, validateModelPackage, validateRoutePlan, validateRoutePlannerInput, validateTaskRequest, validateTaskResult, validateTelemetryEvent, type ValidationIssue } from "./validators.js";
|
|
2
|
+
export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, streamEventSchema, streamRunSchema, streamTerminalOutcomeSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
3
|
+
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";
|
|
4
4
|
export type { FinishReason, IndeRunErrorClass, ModelPackageFormat, ModelSourceType, SchemaVersion, SharedRoutePlan, SharedRoutePlannerInput, TaskKind, RoutingConstraints, RoutingPreferences } from "./types.js";
|
|
5
|
-
export type { ConnectivityService, ThermalState, DeviceConstraintsService, SecureStorageService, ClockService, HttpClientService, TelemetryEventType, TelemetryService, HostServices } from "./host.js";
|
|
5
|
+
export type { AbortSignalLike, ConnectivityService, ThermalState, DeviceConstraintsService, SecureStorageService, ClockService, HttpClientService, HttpStreamResponse, HttpStreamingClientService, TelemetryEventType, TelemetryService, HostServices } from "./host.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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,6BAA6B,EAC7B,iCAAiC,EACjC,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,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,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACb,MAAM,WAAW,CAAC"}
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
2
|
-
export { getHttpRequestValidationIssues, getHttpResponseValidationIssues, getIndeRunErrorValidationIssues, getModelPackageValidationIssues, getRoutePlanValidationIssues, getRoutePlannerInputValidationIssues, getTaskRequestValidationIssues, getTaskResultValidationIssues, getTelemetryEventValidationIssues, validateHttpRequest, validateHttpResponse, validateIndeRunError, validateModelPackage, validateRoutePlan, validateRoutePlannerInput, validateTaskRequest, validateTaskResult, validateTelemetryEvent } from "./validators.js";
|
|
1
|
+
export { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, streamEventSchema, streamRunSchema, streamTerminalOutcomeSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
2
|
+
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/dist/validators.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ import type { HttpResponse } from "./generated/http-response.js";
|
|
|
4
4
|
import type { ModelPackage } from "./generated/model-package.js";
|
|
5
5
|
import type { RoutePlan } from "./generated/route-plan.js";
|
|
6
6
|
import type { RoutePlannerInput } from "./generated/route-planner-input.js";
|
|
7
|
+
import type { StreamEvent } from "./generated/stream-event.js";
|
|
8
|
+
import type { StreamRunHandle } from "./generated/stream-run.js";
|
|
9
|
+
import type { StreamTerminalOutcome } from "./generated/stream-terminal-outcome.js";
|
|
7
10
|
import type { TaskRequest } from "./generated/task-request.js";
|
|
8
11
|
import type { TaskResult } from "./generated/task-result.js";
|
|
9
12
|
import type { TelemetryEvent } from "./generated/telemetry-event.js";
|
|
@@ -21,6 +24,9 @@ export declare function validateTelemetryEvent(value: unknown): value is Telemet
|
|
|
21
24
|
export declare function validateRoutePlannerInput(value: unknown): value is RoutePlannerInput;
|
|
22
25
|
export declare function validateRoutePlan(value: unknown): value is RoutePlan;
|
|
23
26
|
export declare function validateModelPackage(value: unknown): value is ModelPackage;
|
|
27
|
+
export declare function validateStreamRunHandle(value: unknown): value is StreamRunHandle;
|
|
28
|
+
export declare function validateStreamEvent(value: unknown): value is StreamEvent;
|
|
29
|
+
export declare function validateStreamTerminalOutcome(value: unknown): value is StreamTerminalOutcome;
|
|
24
30
|
export declare function getTaskRequestValidationIssues(value: unknown): ValidationIssue[];
|
|
25
31
|
export declare function getTaskResultValidationIssues(value: unknown): ValidationIssue[];
|
|
26
32
|
export declare function getIndeRunErrorValidationIssues(value: unknown): ValidationIssue[];
|
|
@@ -30,4 +36,7 @@ export declare function getTelemetryEventValidationIssues(value: unknown): Valid
|
|
|
30
36
|
export declare function getRoutePlannerInputValidationIssues(value: unknown): ValidationIssue[];
|
|
31
37
|
export declare function getRoutePlanValidationIssues(value: unknown): ValidationIssue[];
|
|
32
38
|
export declare function getModelPackageValidationIssues(value: unknown): ValidationIssue[];
|
|
39
|
+
export declare function getStreamRunHandleValidationIssues(value: unknown): ValidationIssue[];
|
|
40
|
+
export declare function getStreamEventValidationIssues(value: unknown): ValidationIssue[];
|
|
41
|
+
export declare function getStreamTerminalOutcomeValidationIssues(value: unknown): ValidationIssue[];
|
|
33
42
|
//# sourceMappingURL=validators.d.ts.map
|
package/dist/validators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,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,GAAG,eAAe,EAAE,CAEjF;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAInF;AAED,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAEtF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAE9E;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAIjF;AAED,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAEpF;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAIhF;AAED,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAI1F"}
|
package/dist/validators.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
2
|
-
import { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
2
|
+
import { httpRequestSchema, httpResponseSchema, inderunErrorSchema, modelPackageSchema, routePlanSchema, routePlannerInputSchema, streamEventSchema, streamRunSchema, streamTerminalOutcomeSchema, taskRequestSchema, taskResultSchema, telemetryEventSchema } from "./generated/index.js";
|
|
3
3
|
const Ajv2020Constructor = Ajv2020;
|
|
4
4
|
const ajv = new Ajv2020Constructor({
|
|
5
5
|
allErrors: true,
|
|
@@ -16,6 +16,9 @@ const validateTelemetryEventSchema = ajv.compile(telemetryEventSchema);
|
|
|
16
16
|
const validateRoutePlannerInputSchema = ajv.compile(routePlannerInputSchema);
|
|
17
17
|
const validateRoutePlanSchema = ajv.compile(routePlanSchema);
|
|
18
18
|
const validateModelPackageSchema = ajv.compile(modelPackageSchema);
|
|
19
|
+
const validateStreamRunHandleSchema = ajv.compile(streamRunSchema);
|
|
20
|
+
const validateStreamEventSchema = ajv.compile(streamEventSchema);
|
|
21
|
+
const validateStreamTerminalOutcomeSchema = ajv.compile(streamTerminalOutcomeSchema);
|
|
19
22
|
export function validateTaskRequest(value) {
|
|
20
23
|
return getTaskRequestValidationIssues(value).length === 0;
|
|
21
24
|
}
|
|
@@ -43,6 +46,15 @@ export function validateRoutePlan(value) {
|
|
|
43
46
|
export function validateModelPackage(value) {
|
|
44
47
|
return getModelPackageValidationIssues(value).length === 0;
|
|
45
48
|
}
|
|
49
|
+
export function validateStreamRunHandle(value) {
|
|
50
|
+
return getStreamRunHandleValidationIssues(value).length === 0;
|
|
51
|
+
}
|
|
52
|
+
export function validateStreamEvent(value) {
|
|
53
|
+
return getStreamEventValidationIssues(value).length === 0;
|
|
54
|
+
}
|
|
55
|
+
export function validateStreamTerminalOutcome(value) {
|
|
56
|
+
return getStreamTerminalOutcomeValidationIssues(value).length === 0;
|
|
57
|
+
}
|
|
46
58
|
export function getTaskRequestValidationIssues(value) {
|
|
47
59
|
const issues = getValidationIssues(validateTaskRequestSchema, value, {
|
|
48
60
|
forbidInlineSecrets: true
|
|
@@ -82,6 +94,19 @@ export function getModelPackageValidationIssues(value) {
|
|
|
82
94
|
forbidInlineSecrets: true
|
|
83
95
|
});
|
|
84
96
|
}
|
|
97
|
+
export function getStreamRunHandleValidationIssues(value) {
|
|
98
|
+
return getValidationIssues(validateStreamRunHandleSchema, value);
|
|
99
|
+
}
|
|
100
|
+
export function getStreamEventValidationIssues(value) {
|
|
101
|
+
return getValidationIssues(validateStreamEventSchema, value, {
|
|
102
|
+
forbidInlineSecrets: true
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function getStreamTerminalOutcomeValidationIssues(value) {
|
|
106
|
+
return getValidationIssues(validateStreamTerminalOutcomeSchema, value, {
|
|
107
|
+
forbidInlineSecrets: true
|
|
108
|
+
});
|
|
109
|
+
}
|
|
85
110
|
function getValidationIssues(validateSchema, value, options = {}) {
|
|
86
111
|
const issues = [];
|
|
87
112
|
if (!validateSchema(value)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@independo/inderun-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-dev.10",
|
|
4
4
|
"description": "Canonical JSON Schemas, generated TypeScript types, and validators for IndeRun contracts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^26.2.0",
|
|
49
|
-
"vitest": "^4.1.
|
|
49
|
+
"vitest": "^4.1.11"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc -p tsconfig.json",
|