@independo/inderun-contracts 0.2.2 → 0.3.0-dev.2
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/schemas.d.ts +540 -1
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +681 -1
- package/dist/generated/stream-event.d.ts +139 -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 +165 -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/index.d.ts +2 -2
- 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 +1 -1
|
@@ -7,5 +7,8 @@ export type { TelemetryEvent } from "./telemetry-event.js";
|
|
|
7
7
|
export type { RoutePlannerInput } from "./route-planner-input.js";
|
|
8
8
|
export type { RoutePlan } from "./route-plan.js";
|
|
9
9
|
export type { ModelPackage } from "./model-package.js";
|
|
10
|
+
export type { StreamRunHandle } from "./stream-run.js";
|
|
11
|
+
export type { StreamEvent } from "./stream-event.js";
|
|
12
|
+
export type { StreamTerminalOutcome } from "./stream-terminal-outcome.js";
|
|
10
13
|
export * from "./schemas.js";
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,cAAc,cAAc,CAAC"}
|
|
@@ -366,7 +366,7 @@ export declare const telemetryEventSchema: {
|
|
|
366
366
|
readonly properties: {
|
|
367
367
|
readonly type: {
|
|
368
368
|
readonly description: "Telemetry event kind emitted by the orchestrator or provider integration.";
|
|
369
|
-
readonly enum: readonly ["route_decided", "attempt_succeeded", "attempt_failed"];
|
|
369
|
+
readonly enum: readonly ["route_decided", "attempt_succeeded", "attempt_failed", "stream_attempt_started", "stream_attempt_succeeded", "stream_attempt_failed", "stream_completed", "stream_failed", "stream_cancelled"];
|
|
370
370
|
};
|
|
371
371
|
readonly runId: {
|
|
372
372
|
readonly description: "Opaque run identifier associated with this execution event.";
|
|
@@ -765,4 +765,543 @@ export declare const modelPackageSchema: {
|
|
|
765
765
|
};
|
|
766
766
|
};
|
|
767
767
|
};
|
|
768
|
+
export declare const streamRunSchema: {
|
|
769
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
770
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-run.schema.json";
|
|
771
|
+
readonly title: "StreamRunHandle";
|
|
772
|
+
readonly description: "The serializable acknowledgment returned when a Mode 2 stream is opened, before any StreamEvent has arrived. This is the identity/correlation contract only: the live, consumable stream itself is a platform-idiomatic construct (an AsyncIterable<StreamEvent> in TypeScript, a Flow<StreamEvent> in Kotlin, an AsyncThrowingStream<StreamEvent, Error> in Swift) that is never serialized and is out of scope for this schema. Design seam only; no engine or provider implementation exists yet (see docs/architecture/architecture.md).";
|
|
773
|
+
readonly type: "object";
|
|
774
|
+
readonly additionalProperties: true;
|
|
775
|
+
readonly required: readonly ["schemaVersion", "runId", "startedAt"];
|
|
776
|
+
readonly properties: {
|
|
777
|
+
readonly schemaVersion: {
|
|
778
|
+
readonly description: "Contract schema version used to interpret this handle payload.";
|
|
779
|
+
readonly const: "1.0";
|
|
780
|
+
};
|
|
781
|
+
readonly runId: {
|
|
782
|
+
readonly description: "A unique, opaque identifier assigned by the engine for this stream run. Every StreamEvent and the terminal StreamTerminalOutcome for this run carry the same runId, matching the identity convention used by TaskResult.runId and IndeRunError.runId.";
|
|
783
|
+
readonly type: "string";
|
|
784
|
+
readonly minLength: 1;
|
|
785
|
+
};
|
|
786
|
+
readonly startedAt: {
|
|
787
|
+
readonly description: "Wall-clock time the stream run was opened, in Unix epoch milliseconds.";
|
|
788
|
+
readonly type: "number";
|
|
789
|
+
readonly minimum: 0;
|
|
790
|
+
};
|
|
791
|
+
readonly providerId: {
|
|
792
|
+
readonly description: "Identifier of the provider selected to service this stream, if routing has completed by the time the handle is returned. Absent while route selection is still pending.";
|
|
793
|
+
readonly type: "string";
|
|
794
|
+
readonly minLength: 1;
|
|
795
|
+
};
|
|
796
|
+
};
|
|
797
|
+
};
|
|
798
|
+
export declare const streamEventSchema: {
|
|
799
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
800
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-event.schema.json";
|
|
801
|
+
readonly title: "StreamEvent";
|
|
802
|
+
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).";
|
|
803
|
+
readonly oneOf: readonly [{
|
|
804
|
+
readonly type: "object";
|
|
805
|
+
readonly additionalProperties: true;
|
|
806
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
807
|
+
readonly properties: {
|
|
808
|
+
readonly schemaVersion: {
|
|
809
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
810
|
+
readonly const: "1.0";
|
|
811
|
+
};
|
|
812
|
+
readonly runId: {
|
|
813
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
814
|
+
readonly type: "string";
|
|
815
|
+
readonly minLength: 1;
|
|
816
|
+
};
|
|
817
|
+
readonly sequence: {
|
|
818
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
819
|
+
readonly type: "integer";
|
|
820
|
+
readonly minimum: 0;
|
|
821
|
+
};
|
|
822
|
+
readonly timestamp: {
|
|
823
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
824
|
+
readonly type: "number";
|
|
825
|
+
readonly minimum: 0;
|
|
826
|
+
};
|
|
827
|
+
readonly type: {
|
|
828
|
+
readonly 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.";
|
|
829
|
+
readonly const: "content_delta";
|
|
830
|
+
};
|
|
831
|
+
readonly payload: {
|
|
832
|
+
readonly type: "object";
|
|
833
|
+
readonly additionalProperties: true;
|
|
834
|
+
readonly required: readonly ["text"];
|
|
835
|
+
readonly properties: {
|
|
836
|
+
readonly text: {
|
|
837
|
+
readonly description: "The incremental text produced since the previous content event.";
|
|
838
|
+
readonly type: "string";
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
};
|
|
843
|
+
}, {
|
|
844
|
+
readonly type: "object";
|
|
845
|
+
readonly additionalProperties: true;
|
|
846
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
847
|
+
readonly properties: {
|
|
848
|
+
readonly schemaVersion: {
|
|
849
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
850
|
+
readonly const: "1.0";
|
|
851
|
+
};
|
|
852
|
+
readonly runId: {
|
|
853
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
854
|
+
readonly type: "string";
|
|
855
|
+
readonly minLength: 1;
|
|
856
|
+
};
|
|
857
|
+
readonly sequence: {
|
|
858
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
859
|
+
readonly type: "integer";
|
|
860
|
+
readonly minimum: 0;
|
|
861
|
+
};
|
|
862
|
+
readonly timestamp: {
|
|
863
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
864
|
+
readonly type: "number";
|
|
865
|
+
readonly minimum: 0;
|
|
866
|
+
};
|
|
867
|
+
readonly type: {
|
|
868
|
+
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.";
|
|
869
|
+
readonly const: "content_snapshot";
|
|
870
|
+
};
|
|
871
|
+
readonly payload: {
|
|
872
|
+
readonly type: "object";
|
|
873
|
+
readonly additionalProperties: true;
|
|
874
|
+
readonly required: readonly ["text"];
|
|
875
|
+
readonly properties: {
|
|
876
|
+
readonly text: {
|
|
877
|
+
readonly description: "The full cumulative text produced by the run so far.";
|
|
878
|
+
readonly type: "string";
|
|
879
|
+
};
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
};
|
|
883
|
+
}, {
|
|
884
|
+
readonly type: "object";
|
|
885
|
+
readonly additionalProperties: true;
|
|
886
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
887
|
+
readonly properties: {
|
|
888
|
+
readonly schemaVersion: {
|
|
889
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
890
|
+
readonly const: "1.0";
|
|
891
|
+
};
|
|
892
|
+
readonly runId: {
|
|
893
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
894
|
+
readonly type: "string";
|
|
895
|
+
readonly minLength: 1;
|
|
896
|
+
};
|
|
897
|
+
readonly sequence: {
|
|
898
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
899
|
+
readonly type: "integer";
|
|
900
|
+
readonly minimum: 0;
|
|
901
|
+
};
|
|
902
|
+
readonly timestamp: {
|
|
903
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
904
|
+
readonly type: "number";
|
|
905
|
+
readonly minimum: 0;
|
|
906
|
+
};
|
|
907
|
+
readonly type: {
|
|
908
|
+
readonly description: "Mechanical/diagnostic: a run lifecycle transition (e.g. provider selection, execution start). Not user-visible content; not part of the generated text.";
|
|
909
|
+
readonly const: "lifecycle";
|
|
910
|
+
};
|
|
911
|
+
readonly payload: {
|
|
912
|
+
readonly type: "object";
|
|
913
|
+
readonly additionalProperties: true;
|
|
914
|
+
readonly required: readonly ["phase"];
|
|
915
|
+
readonly properties: {
|
|
916
|
+
readonly phase: {
|
|
917
|
+
readonly description: "The lifecycle phase reached.";
|
|
918
|
+
readonly enum: readonly ["provider_selected", "started"];
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
}, {
|
|
924
|
+
readonly type: "object";
|
|
925
|
+
readonly additionalProperties: true;
|
|
926
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
927
|
+
readonly properties: {
|
|
928
|
+
readonly schemaVersion: {
|
|
929
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
930
|
+
readonly const: "1.0";
|
|
931
|
+
};
|
|
932
|
+
readonly runId: {
|
|
933
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
934
|
+
readonly type: "string";
|
|
935
|
+
readonly minLength: 1;
|
|
936
|
+
};
|
|
937
|
+
readonly sequence: {
|
|
938
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
939
|
+
readonly type: "integer";
|
|
940
|
+
readonly minimum: 0;
|
|
941
|
+
};
|
|
942
|
+
readonly timestamp: {
|
|
943
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
944
|
+
readonly type: "number";
|
|
945
|
+
readonly minimum: 0;
|
|
946
|
+
};
|
|
947
|
+
readonly type: {
|
|
948
|
+
readonly description: "Mechanical/diagnostic: free-form orchestration or provider diagnostic detail. Not user-visible content.";
|
|
949
|
+
readonly const: "diagnostic";
|
|
950
|
+
};
|
|
951
|
+
readonly payload: {
|
|
952
|
+
readonly description: "Event-specific diagnostic metadata. It must not contain prompt payloads or raw secrets, matching the same guardrail as TelemetryEvent.payload.";
|
|
953
|
+
readonly type: "object";
|
|
954
|
+
readonly additionalProperties: true;
|
|
955
|
+
};
|
|
956
|
+
};
|
|
957
|
+
}, {
|
|
958
|
+
readonly type: "object";
|
|
959
|
+
readonly additionalProperties: true;
|
|
960
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
961
|
+
readonly properties: {
|
|
962
|
+
readonly schemaVersion: {
|
|
963
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
964
|
+
readonly const: "1.0";
|
|
965
|
+
};
|
|
966
|
+
readonly runId: {
|
|
967
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
968
|
+
readonly type: "string";
|
|
969
|
+
readonly minLength: 1;
|
|
970
|
+
};
|
|
971
|
+
readonly sequence: {
|
|
972
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. This is always the highest sequence number for the run: the terminal event.";
|
|
973
|
+
readonly type: "integer";
|
|
974
|
+
readonly minimum: 0;
|
|
975
|
+
};
|
|
976
|
+
readonly timestamp: {
|
|
977
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
978
|
+
readonly type: "number";
|
|
979
|
+
readonly minimum: 0;
|
|
980
|
+
};
|
|
981
|
+
readonly type: {
|
|
982
|
+
readonly 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.";
|
|
983
|
+
readonly const: "terminal";
|
|
984
|
+
};
|
|
985
|
+
readonly payload: {
|
|
986
|
+
readonly 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.";
|
|
987
|
+
readonly oneOf: readonly [{
|
|
988
|
+
readonly type: "object";
|
|
989
|
+
readonly additionalProperties: true;
|
|
990
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "finalText"];
|
|
991
|
+
readonly properties: {
|
|
992
|
+
readonly schemaVersion: {
|
|
993
|
+
readonly const: "1.0";
|
|
994
|
+
};
|
|
995
|
+
readonly runId: {
|
|
996
|
+
readonly type: "string";
|
|
997
|
+
readonly minLength: 1;
|
|
998
|
+
};
|
|
999
|
+
readonly outcome: {
|
|
1000
|
+
readonly const: "completed";
|
|
1001
|
+
};
|
|
1002
|
+
readonly finalText: {
|
|
1003
|
+
readonly type: "string";
|
|
1004
|
+
};
|
|
1005
|
+
readonly usage: {
|
|
1006
|
+
readonly type: "object";
|
|
1007
|
+
readonly additionalProperties: true;
|
|
1008
|
+
readonly properties: {
|
|
1009
|
+
readonly inputTokens: {
|
|
1010
|
+
readonly type: "integer";
|
|
1011
|
+
readonly minimum: 0;
|
|
1012
|
+
};
|
|
1013
|
+
readonly outputTokens: {
|
|
1014
|
+
readonly type: "integer";
|
|
1015
|
+
readonly minimum: 0;
|
|
1016
|
+
};
|
|
1017
|
+
readonly totalTokens: {
|
|
1018
|
+
readonly type: "integer";
|
|
1019
|
+
readonly minimum: 0;
|
|
1020
|
+
};
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1023
|
+
readonly telemetry: {
|
|
1024
|
+
readonly type: "object";
|
|
1025
|
+
readonly additionalProperties: true;
|
|
1026
|
+
readonly required: readonly ["providerUsed", "totalMs"];
|
|
1027
|
+
readonly properties: {
|
|
1028
|
+
readonly providerUsed: {
|
|
1029
|
+
readonly type: "string";
|
|
1030
|
+
readonly minLength: 1;
|
|
1031
|
+
};
|
|
1032
|
+
readonly totalMs: {
|
|
1033
|
+
readonly type: "number";
|
|
1034
|
+
readonly minimum: 0;
|
|
1035
|
+
};
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
}, {
|
|
1040
|
+
readonly type: "object";
|
|
1041
|
+
readonly additionalProperties: true;
|
|
1042
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "error"];
|
|
1043
|
+
readonly properties: {
|
|
1044
|
+
readonly schemaVersion: {
|
|
1045
|
+
readonly const: "1.0";
|
|
1046
|
+
};
|
|
1047
|
+
readonly runId: {
|
|
1048
|
+
readonly type: "string";
|
|
1049
|
+
readonly minLength: 1;
|
|
1050
|
+
};
|
|
1051
|
+
readonly outcome: {
|
|
1052
|
+
readonly const: "error";
|
|
1053
|
+
};
|
|
1054
|
+
readonly error: {
|
|
1055
|
+
readonly type: "object";
|
|
1056
|
+
readonly additionalProperties: true;
|
|
1057
|
+
readonly required: readonly ["schemaVersion", "errorClass", "message"];
|
|
1058
|
+
readonly properties: {
|
|
1059
|
+
readonly schemaVersion: {
|
|
1060
|
+
readonly const: "1.0";
|
|
1061
|
+
};
|
|
1062
|
+
readonly errorClass: {
|
|
1063
|
+
readonly enum: readonly ["CapabilityMismatch", "Offline", "AuthError", "RateLimited", "Timeout", "Unavailable", "Internal"];
|
|
1064
|
+
};
|
|
1065
|
+
readonly message: {
|
|
1066
|
+
readonly type: "string";
|
|
1067
|
+
readonly minLength: 1;
|
|
1068
|
+
};
|
|
1069
|
+
readonly providerId: {
|
|
1070
|
+
readonly type: "string";
|
|
1071
|
+
readonly minLength: 1;
|
|
1072
|
+
};
|
|
1073
|
+
readonly retryable: {
|
|
1074
|
+
readonly type: "boolean";
|
|
1075
|
+
};
|
|
1076
|
+
readonly retryAfterMs: {
|
|
1077
|
+
readonly type: "integer";
|
|
1078
|
+
readonly minimum: 0;
|
|
1079
|
+
};
|
|
1080
|
+
readonly details: {
|
|
1081
|
+
readonly type: "object";
|
|
1082
|
+
readonly additionalProperties: true;
|
|
1083
|
+
};
|
|
1084
|
+
};
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
}, {
|
|
1088
|
+
readonly type: "object";
|
|
1089
|
+
readonly additionalProperties: true;
|
|
1090
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "partialText"];
|
|
1091
|
+
readonly properties: {
|
|
1092
|
+
readonly schemaVersion: {
|
|
1093
|
+
readonly const: "1.0";
|
|
1094
|
+
};
|
|
1095
|
+
readonly runId: {
|
|
1096
|
+
readonly type: "string";
|
|
1097
|
+
readonly minLength: 1;
|
|
1098
|
+
};
|
|
1099
|
+
readonly outcome: {
|
|
1100
|
+
readonly const: "cancelled";
|
|
1101
|
+
};
|
|
1102
|
+
readonly partialText: {
|
|
1103
|
+
readonly type: "string";
|
|
1104
|
+
};
|
|
1105
|
+
readonly reason: {
|
|
1106
|
+
readonly type: "string";
|
|
1107
|
+
};
|
|
1108
|
+
};
|
|
1109
|
+
}];
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
}, {
|
|
1113
|
+
readonly type: "object";
|
|
1114
|
+
readonly additionalProperties: true;
|
|
1115
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type"];
|
|
1116
|
+
readonly properties: {
|
|
1117
|
+
readonly schemaVersion: {
|
|
1118
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
1119
|
+
readonly const: "1.0";
|
|
1120
|
+
};
|
|
1121
|
+
readonly runId: {
|
|
1122
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
1123
|
+
readonly type: "string";
|
|
1124
|
+
readonly minLength: 1;
|
|
1125
|
+
};
|
|
1126
|
+
readonly sequence: {
|
|
1127
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
1128
|
+
readonly type: "integer";
|
|
1129
|
+
readonly minimum: 0;
|
|
1130
|
+
};
|
|
1131
|
+
readonly timestamp: {
|
|
1132
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
1133
|
+
readonly type: "number";
|
|
1134
|
+
readonly minimum: 0;
|
|
1135
|
+
};
|
|
1136
|
+
readonly type: {
|
|
1137
|
+
readonly 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.";
|
|
1138
|
+
readonly type: "string";
|
|
1139
|
+
readonly not: {
|
|
1140
|
+
readonly enum: readonly ["content_delta", "content_snapshot", "lifecycle", "diagnostic", "terminal"];
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
readonly payload: {
|
|
1144
|
+
readonly description: "Optional event-specific payload for the unrecognized type. It must not contain prompt payloads or raw secrets.";
|
|
1145
|
+
readonly type: "object";
|
|
1146
|
+
readonly additionalProperties: true;
|
|
1147
|
+
};
|
|
1148
|
+
};
|
|
1149
|
+
}];
|
|
1150
|
+
};
|
|
1151
|
+
export declare const streamTerminalOutcomeSchema: {
|
|
1152
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
1153
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-terminal-outcome.schema.json";
|
|
1154
|
+
readonly title: "StreamTerminalOutcome";
|
|
1155
|
+
readonly description: "How a Mode 2 stream run ended. Completion, error, and cancellation are mutually exclusive terminal outcomes, enforced here as a closed set of three oneOf branches discriminated by 'outcome' (unlike StreamEvent.type, this set is not open-ended: the three-way terminal outcome is a fixed architectural guarantee, not something new outcome kinds get added to). Exactly one StreamTerminalOutcome is produced per run, and no further StreamEvent is delivered after it (see docs/architecture/architecture.md, 'Cancellation And Fallback'). This shape is also embedded by value as the payload of the terminal StreamEvent (stream-event.schema.json) so it can additionally be exposed standalone, e.g. as a completion future/promise a stream handle resolves independently of consuming the full event sequence; the two copies must stay structurally identical. Note on additionalProperties: per this repo's forward-compatible convention every branch permits unknown extra fields, so mutual exclusivity is enforced via the required 'outcome' discriminator plus each branch's own required peer field (finalText/error/partialText) being present, not by forbidding a payload from also carrying an unrelated stray field from another branch's vocabulary.";
|
|
1156
|
+
readonly oneOf: readonly [{
|
|
1157
|
+
readonly type: "object";
|
|
1158
|
+
readonly additionalProperties: true;
|
|
1159
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "finalText"];
|
|
1160
|
+
readonly properties: {
|
|
1161
|
+
readonly schemaVersion: {
|
|
1162
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1163
|
+
readonly const: "1.0";
|
|
1164
|
+
};
|
|
1165
|
+
readonly runId: {
|
|
1166
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1167
|
+
readonly type: "string";
|
|
1168
|
+
readonly minLength: 1;
|
|
1169
|
+
};
|
|
1170
|
+
readonly outcome: {
|
|
1171
|
+
readonly description: "The stream completed normally: every provider-generated event was delivered before this outcome was produced.";
|
|
1172
|
+
readonly const: "completed";
|
|
1173
|
+
};
|
|
1174
|
+
readonly finalText: {
|
|
1175
|
+
readonly description: "The full, cumulative text produced by the run. Equivalent in role to TaskResult.output.text for Mode 1.";
|
|
1176
|
+
readonly type: "string";
|
|
1177
|
+
};
|
|
1178
|
+
readonly usage: {
|
|
1179
|
+
readonly description: "Optional metadata regarding the quantity of tokens processed by the provider. Same shape as TaskResult.usage.";
|
|
1180
|
+
readonly type: "object";
|
|
1181
|
+
readonly additionalProperties: true;
|
|
1182
|
+
readonly properties: {
|
|
1183
|
+
readonly inputTokens: {
|
|
1184
|
+
readonly description: "Number of input tokens consumed, as reported by the provider.";
|
|
1185
|
+
readonly type: "integer";
|
|
1186
|
+
readonly minimum: 0;
|
|
1187
|
+
};
|
|
1188
|
+
readonly outputTokens: {
|
|
1189
|
+
readonly description: "Number of output tokens generated, as reported by the provider.";
|
|
1190
|
+
readonly type: "integer";
|
|
1191
|
+
readonly minimum: 0;
|
|
1192
|
+
};
|
|
1193
|
+
readonly totalTokens: {
|
|
1194
|
+
readonly description: "Aggregated token count for this request, as reported by the provider.";
|
|
1195
|
+
readonly type: "integer";
|
|
1196
|
+
readonly minimum: 0;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
};
|
|
1200
|
+
readonly telemetry: {
|
|
1201
|
+
readonly description: "Required metadata providing an overview of the execution result and performance metrics. Same shape as TaskResult.telemetry.";
|
|
1202
|
+
readonly type: "object";
|
|
1203
|
+
readonly additionalProperties: true;
|
|
1204
|
+
readonly required: readonly ["providerUsed", "totalMs"];
|
|
1205
|
+
readonly properties: {
|
|
1206
|
+
readonly providerUsed: {
|
|
1207
|
+
readonly description: "The identifier for the specific provider that handled the request (e.g., 'openai_compatible_cloud').";
|
|
1208
|
+
readonly type: "string";
|
|
1209
|
+
readonly minLength: 1;
|
|
1210
|
+
};
|
|
1211
|
+
readonly totalMs: {
|
|
1212
|
+
readonly description: "Measured execution duration in milliseconds, including route selection and result processing.";
|
|
1213
|
+
readonly type: "number";
|
|
1214
|
+
readonly minimum: 0;
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
}, {
|
|
1220
|
+
readonly type: "object";
|
|
1221
|
+
readonly additionalProperties: true;
|
|
1222
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "error"];
|
|
1223
|
+
readonly properties: {
|
|
1224
|
+
readonly schemaVersion: {
|
|
1225
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1226
|
+
readonly const: "1.0";
|
|
1227
|
+
};
|
|
1228
|
+
readonly runId: {
|
|
1229
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1230
|
+
readonly type: "string";
|
|
1231
|
+
readonly minLength: 1;
|
|
1232
|
+
};
|
|
1233
|
+
readonly outcome: {
|
|
1234
|
+
readonly description: "The stream ended in failure: validation, routing (no eligible provider), or every attempted provider failing.";
|
|
1235
|
+
readonly const: "error";
|
|
1236
|
+
};
|
|
1237
|
+
readonly error: {
|
|
1238
|
+
readonly description: "The normalized error for this failure. Structurally identical to IndeRunError (contracts/schemas/inderun-error.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.";
|
|
1239
|
+
readonly type: "object";
|
|
1240
|
+
readonly additionalProperties: true;
|
|
1241
|
+
readonly required: readonly ["schemaVersion", "errorClass", "message"];
|
|
1242
|
+
readonly properties: {
|
|
1243
|
+
readonly schemaVersion: {
|
|
1244
|
+
readonly description: "Contract schema version used to interpret the error payload.";
|
|
1245
|
+
readonly const: "1.0";
|
|
1246
|
+
};
|
|
1247
|
+
readonly errorClass: {
|
|
1248
|
+
readonly description: "Normalized error taxonomy, identical to IndeRunError.errorClass: CapabilityMismatch (request needs something no eligible provider supports), Offline/Unavailable (provider unreachable or not ready), AuthError (credential/auth failure), RateLimited (provider throttled the request), Timeout (provider exceeded its execution budget), Internal (unexpected engine-side failure).";
|
|
1249
|
+
readonly enum: readonly ["CapabilityMismatch", "Offline", "AuthError", "RateLimited", "Timeout", "Unavailable", "Internal"];
|
|
1250
|
+
};
|
|
1251
|
+
readonly message: {
|
|
1252
|
+
readonly description: "Human-readable error message suitable for logs and developer diagnostics.";
|
|
1253
|
+
readonly type: "string";
|
|
1254
|
+
readonly minLength: 1;
|
|
1255
|
+
};
|
|
1256
|
+
readonly providerId: {
|
|
1257
|
+
readonly description: "Identifier of the provider associated with the failure, if execution reached a provider.";
|
|
1258
|
+
readonly type: "string";
|
|
1259
|
+
readonly minLength: 1;
|
|
1260
|
+
};
|
|
1261
|
+
readonly retryable: {
|
|
1262
|
+
readonly description: "Whether retrying the same request may succeed.";
|
|
1263
|
+
readonly type: "boolean";
|
|
1264
|
+
};
|
|
1265
|
+
readonly retryAfterMs: {
|
|
1266
|
+
readonly description: "Optional suggested delay before retrying, in milliseconds.";
|
|
1267
|
+
readonly type: "integer";
|
|
1268
|
+
readonly minimum: 0;
|
|
1269
|
+
};
|
|
1270
|
+
readonly details: {
|
|
1271
|
+
readonly description: "Optional structured diagnostic details. It must not contain raw secrets.";
|
|
1272
|
+
readonly type: "object";
|
|
1273
|
+
readonly additionalProperties: true;
|
|
1274
|
+
};
|
|
1275
|
+
};
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
}, {
|
|
1279
|
+
readonly type: "object";
|
|
1280
|
+
readonly additionalProperties: true;
|
|
1281
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "partialText"];
|
|
1282
|
+
readonly properties: {
|
|
1283
|
+
readonly schemaVersion: {
|
|
1284
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1285
|
+
readonly const: "1.0";
|
|
1286
|
+
};
|
|
1287
|
+
readonly runId: {
|
|
1288
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1289
|
+
readonly type: "string";
|
|
1290
|
+
readonly minLength: 1;
|
|
1291
|
+
};
|
|
1292
|
+
readonly outcome: {
|
|
1293
|
+
readonly description: "The stream was cancelled. No further StreamEvent is delivered after this outcome, and no further fallback attempt is made, per the engine's cancellation guarantee.";
|
|
1294
|
+
readonly const: "cancelled";
|
|
1295
|
+
};
|
|
1296
|
+
readonly partialText: {
|
|
1297
|
+
readonly description: "Whatever cumulative text had already been delivered via content_delta/content_snapshot StreamEvents before the cancellation point. May be empty if cancellation occurred before any content was produced.";
|
|
1298
|
+
readonly type: "string";
|
|
1299
|
+
};
|
|
1300
|
+
readonly reason: {
|
|
1301
|
+
readonly description: "Optional human-readable reason the run was cancelled (e.g. caller-initiated abort). Not a machine-taxonomy field; use errorClass on the 'error' outcome branch for failure classification.";
|
|
1302
|
+
readonly type: "string";
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1305
|
+
}];
|
|
1306
|
+
};
|
|
768
1307
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/generated/schemas.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiMpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GnB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DrB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CpB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCrB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/generated/schemas.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiMpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GnB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DrB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CpB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCrB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CvB,CAAC;AAEX,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqK1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHlB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6KrB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAicpB,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6L9B,CAAC"}
|