@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
|
@@ -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.";
|
|
@@ -389,7 +389,7 @@ export declare const routePlannerInputSchema: {
|
|
|
389
389
|
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
390
390
|
readonly $id: "https://schemas.inderun.dev/1.0/route-planner-input.schema.json";
|
|
391
391
|
readonly title: "RoutePlannerInput";
|
|
392
|
-
readonly description: "Pure data input contract for deterministic shared-core
|
|
392
|
+
readonly description: "Pure data input contract for deterministic shared-core route planning.";
|
|
393
393
|
readonly type: "object";
|
|
394
394
|
readonly additionalProperties: true;
|
|
395
395
|
readonly required: readonly ["task", "constraints", "preferences", "providers"];
|
|
@@ -406,6 +406,10 @@ export declare const routePlannerInputSchema: {
|
|
|
406
406
|
};
|
|
407
407
|
};
|
|
408
408
|
};
|
|
409
|
+
readonly interactionMode: {
|
|
410
|
+
readonly description: "Interaction mode the caller is requesting. Absent means 'run' (Mode 1), so planner inputs produced before this field existed keep their exact Mode-1 semantics. The mode filters eligible providers; it never changes candidate ordering.";
|
|
411
|
+
readonly enum: readonly ["run", "stream"];
|
|
412
|
+
};
|
|
409
413
|
readonly constraints: {
|
|
410
414
|
readonly description: "Hard routing constraints evaluated before provider selection.";
|
|
411
415
|
readonly type: "object";
|
|
@@ -464,8 +468,16 @@ export declare const routePlannerInputSchema: {
|
|
|
464
468
|
readonly run: {
|
|
465
469
|
readonly type: "boolean";
|
|
466
470
|
};
|
|
471
|
+
readonly streaming: {
|
|
472
|
+
readonly description: "Whether the provider statically declares Mode-2 streaming. Absent is treated as false: a descriptor that predates this field cannot be assumed to stream.";
|
|
473
|
+
readonly type: "boolean";
|
|
474
|
+
};
|
|
467
475
|
};
|
|
468
476
|
};
|
|
477
|
+
readonly cancel: {
|
|
478
|
+
readonly description: "Cancellation guarantee the provider offers. Carried for route explanations and telemetry; the planner does not filter on it.";
|
|
479
|
+
readonly enum: readonly ["hard", "soft", "none"];
|
|
480
|
+
};
|
|
469
481
|
readonly tasks: {
|
|
470
482
|
readonly type: "array";
|
|
471
483
|
readonly items: {
|
|
@@ -505,6 +517,19 @@ export declare const routePlannerInputSchema: {
|
|
|
505
517
|
readonly type: "string";
|
|
506
518
|
readonly minLength: 1;
|
|
507
519
|
};
|
|
520
|
+
readonly streamingAvailable: {
|
|
521
|
+
readonly description: "Whether the provider can stream right now in this host environment. Absent inherits the static descriptor.supports.streaming value.";
|
|
522
|
+
readonly type: "boolean";
|
|
523
|
+
};
|
|
524
|
+
readonly streamingUnavailableReason: {
|
|
525
|
+
readonly description: "Human-readable explanation used when streamingAvailable is false. Absent lets the planner synthesize a default message.";
|
|
526
|
+
readonly type: "string";
|
|
527
|
+
readonly minLength: 1;
|
|
528
|
+
};
|
|
529
|
+
readonly cancellationAvailable: {
|
|
530
|
+
readonly description: "Whether cancellation is honored right now in this host environment. Absent inherits the static descriptor.cancel value (any value other than 'none' means available).";
|
|
531
|
+
readonly type: "boolean";
|
|
532
|
+
};
|
|
508
533
|
};
|
|
509
534
|
};
|
|
510
535
|
};
|
|
@@ -573,7 +598,8 @@ export declare const routePlanSchema: {
|
|
|
573
598
|
readonly required: readonly ["code", "message"];
|
|
574
599
|
readonly properties: {
|
|
575
600
|
readonly code: {
|
|
576
|
-
readonly
|
|
601
|
+
readonly description: "Normalized rejection reason. 'streaming_not_supported' means the descriptor does not statically declare Mode-2 streaming; 'streaming_unavailable' means it declares streaming but the dynamic capability snapshot reports it cannot stream in the current host environment.";
|
|
602
|
+
readonly enum: readonly ["task_not_supported", "run_not_supported", "streaming_not_supported", "streaming_unavailable", "privacy_constraint", "cloud_constraint", "offline", "capability_unavailable"];
|
|
577
603
|
};
|
|
578
604
|
readonly message: {
|
|
579
605
|
readonly type: "string";
|
|
@@ -765,4 +791,550 @@ export declare const modelPackageSchema: {
|
|
|
765
791
|
};
|
|
766
792
|
};
|
|
767
793
|
};
|
|
794
|
+
export declare const streamRunSchema: {
|
|
795
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
796
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-run.schema.json";
|
|
797
|
+
readonly title: "StreamRunHandle";
|
|
798
|
+
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).";
|
|
799
|
+
readonly type: "object";
|
|
800
|
+
readonly additionalProperties: true;
|
|
801
|
+
readonly required: readonly ["schemaVersion", "runId", "startedAt"];
|
|
802
|
+
readonly properties: {
|
|
803
|
+
readonly schemaVersion: {
|
|
804
|
+
readonly description: "Contract schema version used to interpret this handle payload.";
|
|
805
|
+
readonly const: "1.0";
|
|
806
|
+
};
|
|
807
|
+
readonly runId: {
|
|
808
|
+
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.";
|
|
809
|
+
readonly type: "string";
|
|
810
|
+
readonly minLength: 1;
|
|
811
|
+
};
|
|
812
|
+
readonly startedAt: {
|
|
813
|
+
readonly description: "Wall-clock time the stream run was opened, in Unix epoch milliseconds.";
|
|
814
|
+
readonly type: "number";
|
|
815
|
+
readonly minimum: 0;
|
|
816
|
+
};
|
|
817
|
+
readonly providerId: {
|
|
818
|
+
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.";
|
|
819
|
+
readonly type: "string";
|
|
820
|
+
readonly minLength: 1;
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
};
|
|
824
|
+
export declare const streamEventSchema: {
|
|
825
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
826
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-event.schema.json";
|
|
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).";
|
|
829
|
+
readonly oneOf: readonly [{
|
|
830
|
+
readonly type: "object";
|
|
831
|
+
readonly additionalProperties: true;
|
|
832
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
833
|
+
readonly properties: {
|
|
834
|
+
readonly schemaVersion: {
|
|
835
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
836
|
+
readonly const: "1.0";
|
|
837
|
+
};
|
|
838
|
+
readonly runId: {
|
|
839
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
840
|
+
readonly type: "string";
|
|
841
|
+
readonly minLength: 1;
|
|
842
|
+
};
|
|
843
|
+
readonly sequence: {
|
|
844
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
845
|
+
readonly type: "integer";
|
|
846
|
+
readonly minimum: 0;
|
|
847
|
+
};
|
|
848
|
+
readonly timestamp: {
|
|
849
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
850
|
+
readonly type: "number";
|
|
851
|
+
readonly minimum: 0;
|
|
852
|
+
};
|
|
853
|
+
readonly type: {
|
|
854
|
+
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.";
|
|
855
|
+
readonly const: "content_delta";
|
|
856
|
+
};
|
|
857
|
+
readonly payload: {
|
|
858
|
+
readonly type: "object";
|
|
859
|
+
readonly additionalProperties: true;
|
|
860
|
+
readonly required: readonly ["text"];
|
|
861
|
+
readonly properties: {
|
|
862
|
+
readonly text: {
|
|
863
|
+
readonly description: "The incremental text produced since the previous content event.";
|
|
864
|
+
readonly type: "string";
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
}, {
|
|
870
|
+
readonly type: "object";
|
|
871
|
+
readonly additionalProperties: true;
|
|
872
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
873
|
+
readonly properties: {
|
|
874
|
+
readonly schemaVersion: {
|
|
875
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
876
|
+
readonly const: "1.0";
|
|
877
|
+
};
|
|
878
|
+
readonly runId: {
|
|
879
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
880
|
+
readonly type: "string";
|
|
881
|
+
readonly minLength: 1;
|
|
882
|
+
};
|
|
883
|
+
readonly sequence: {
|
|
884
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
885
|
+
readonly type: "integer";
|
|
886
|
+
readonly minimum: 0;
|
|
887
|
+
};
|
|
888
|
+
readonly timestamp: {
|
|
889
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
890
|
+
readonly type: "number";
|
|
891
|
+
readonly minimum: 0;
|
|
892
|
+
};
|
|
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.";
|
|
895
|
+
readonly const: "content_snapshot";
|
|
896
|
+
};
|
|
897
|
+
readonly payload: {
|
|
898
|
+
readonly type: "object";
|
|
899
|
+
readonly additionalProperties: true;
|
|
900
|
+
readonly required: readonly ["text"];
|
|
901
|
+
readonly properties: {
|
|
902
|
+
readonly text: {
|
|
903
|
+
readonly description: "The full cumulative text produced by the run so far.";
|
|
904
|
+
readonly type: "string";
|
|
905
|
+
};
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
}, {
|
|
910
|
+
readonly type: "object";
|
|
911
|
+
readonly additionalProperties: true;
|
|
912
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
913
|
+
readonly properties: {
|
|
914
|
+
readonly schemaVersion: {
|
|
915
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
916
|
+
readonly const: "1.0";
|
|
917
|
+
};
|
|
918
|
+
readonly runId: {
|
|
919
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
920
|
+
readonly type: "string";
|
|
921
|
+
readonly minLength: 1;
|
|
922
|
+
};
|
|
923
|
+
readonly sequence: {
|
|
924
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
925
|
+
readonly type: "integer";
|
|
926
|
+
readonly minimum: 0;
|
|
927
|
+
};
|
|
928
|
+
readonly timestamp: {
|
|
929
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
930
|
+
readonly type: "number";
|
|
931
|
+
readonly minimum: 0;
|
|
932
|
+
};
|
|
933
|
+
readonly type: {
|
|
934
|
+
readonly description: "Mechanical/diagnostic: a run lifecycle transition (e.g. provider selection, execution start). Not user-visible content; not part of the generated text.";
|
|
935
|
+
readonly const: "lifecycle";
|
|
936
|
+
};
|
|
937
|
+
readonly payload: {
|
|
938
|
+
readonly type: "object";
|
|
939
|
+
readonly additionalProperties: true;
|
|
940
|
+
readonly required: readonly ["phase"];
|
|
941
|
+
readonly properties: {
|
|
942
|
+
readonly phase: {
|
|
943
|
+
readonly description: "The lifecycle phase reached.";
|
|
944
|
+
readonly enum: readonly ["provider_selected", "started"];
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
}, {
|
|
950
|
+
readonly type: "object";
|
|
951
|
+
readonly additionalProperties: true;
|
|
952
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
953
|
+
readonly properties: {
|
|
954
|
+
readonly schemaVersion: {
|
|
955
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
956
|
+
readonly const: "1.0";
|
|
957
|
+
};
|
|
958
|
+
readonly runId: {
|
|
959
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
960
|
+
readonly type: "string";
|
|
961
|
+
readonly minLength: 1;
|
|
962
|
+
};
|
|
963
|
+
readonly sequence: {
|
|
964
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
965
|
+
readonly type: "integer";
|
|
966
|
+
readonly minimum: 0;
|
|
967
|
+
};
|
|
968
|
+
readonly timestamp: {
|
|
969
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
970
|
+
readonly type: "number";
|
|
971
|
+
readonly minimum: 0;
|
|
972
|
+
};
|
|
973
|
+
readonly type: {
|
|
974
|
+
readonly description: "Mechanical/diagnostic: free-form orchestration or provider diagnostic detail. Not user-visible content.";
|
|
975
|
+
readonly const: "diagnostic";
|
|
976
|
+
};
|
|
977
|
+
readonly payload: {
|
|
978
|
+
readonly description: "Event-specific diagnostic metadata. It must not contain prompt payloads or raw secrets, matching the same guardrail as TelemetryEvent.payload.";
|
|
979
|
+
readonly type: "object";
|
|
980
|
+
readonly additionalProperties: true;
|
|
981
|
+
};
|
|
982
|
+
};
|
|
983
|
+
}, {
|
|
984
|
+
readonly type: "object";
|
|
985
|
+
readonly additionalProperties: true;
|
|
986
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type", "payload"];
|
|
987
|
+
readonly properties: {
|
|
988
|
+
readonly schemaVersion: {
|
|
989
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
990
|
+
readonly const: "1.0";
|
|
991
|
+
};
|
|
992
|
+
readonly runId: {
|
|
993
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
994
|
+
readonly type: "string";
|
|
995
|
+
readonly minLength: 1;
|
|
996
|
+
};
|
|
997
|
+
readonly sequence: {
|
|
998
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. This is always the highest sequence number for the run: the terminal event.";
|
|
999
|
+
readonly type: "integer";
|
|
1000
|
+
readonly minimum: 0;
|
|
1001
|
+
};
|
|
1002
|
+
readonly timestamp: {
|
|
1003
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
1004
|
+
readonly type: "number";
|
|
1005
|
+
readonly minimum: 0;
|
|
1006
|
+
};
|
|
1007
|
+
readonly type: {
|
|
1008
|
+
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.";
|
|
1009
|
+
readonly const: "terminal";
|
|
1010
|
+
};
|
|
1011
|
+
readonly payload: {
|
|
1012
|
+
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.";
|
|
1013
|
+
readonly oneOf: readonly [{
|
|
1014
|
+
readonly type: "object";
|
|
1015
|
+
readonly additionalProperties: true;
|
|
1016
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "finalText"];
|
|
1017
|
+
readonly properties: {
|
|
1018
|
+
readonly schemaVersion: {
|
|
1019
|
+
readonly const: "1.0";
|
|
1020
|
+
};
|
|
1021
|
+
readonly runId: {
|
|
1022
|
+
readonly type: "string";
|
|
1023
|
+
readonly minLength: 1;
|
|
1024
|
+
};
|
|
1025
|
+
readonly outcome: {
|
|
1026
|
+
readonly const: "completed";
|
|
1027
|
+
};
|
|
1028
|
+
readonly finalText: {
|
|
1029
|
+
readonly type: "string";
|
|
1030
|
+
};
|
|
1031
|
+
readonly finishReason: {
|
|
1032
|
+
readonly enum: readonly ["stop", "length", "cancelled", "error"];
|
|
1033
|
+
};
|
|
1034
|
+
readonly usage: {
|
|
1035
|
+
readonly type: "object";
|
|
1036
|
+
readonly additionalProperties: true;
|
|
1037
|
+
readonly properties: {
|
|
1038
|
+
readonly inputTokens: {
|
|
1039
|
+
readonly type: "integer";
|
|
1040
|
+
readonly minimum: 0;
|
|
1041
|
+
};
|
|
1042
|
+
readonly outputTokens: {
|
|
1043
|
+
readonly type: "integer";
|
|
1044
|
+
readonly minimum: 0;
|
|
1045
|
+
};
|
|
1046
|
+
readonly totalTokens: {
|
|
1047
|
+
readonly type: "integer";
|
|
1048
|
+
readonly minimum: 0;
|
|
1049
|
+
};
|
|
1050
|
+
};
|
|
1051
|
+
};
|
|
1052
|
+
readonly telemetry: {
|
|
1053
|
+
readonly type: "object";
|
|
1054
|
+
readonly additionalProperties: true;
|
|
1055
|
+
readonly required: readonly ["providerUsed", "totalMs"];
|
|
1056
|
+
readonly properties: {
|
|
1057
|
+
readonly providerUsed: {
|
|
1058
|
+
readonly type: "string";
|
|
1059
|
+
readonly minLength: 1;
|
|
1060
|
+
};
|
|
1061
|
+
readonly totalMs: {
|
|
1062
|
+
readonly type: "number";
|
|
1063
|
+
readonly minimum: 0;
|
|
1064
|
+
};
|
|
1065
|
+
};
|
|
1066
|
+
};
|
|
1067
|
+
};
|
|
1068
|
+
}, {
|
|
1069
|
+
readonly type: "object";
|
|
1070
|
+
readonly additionalProperties: true;
|
|
1071
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "error"];
|
|
1072
|
+
readonly properties: {
|
|
1073
|
+
readonly schemaVersion: {
|
|
1074
|
+
readonly const: "1.0";
|
|
1075
|
+
};
|
|
1076
|
+
readonly runId: {
|
|
1077
|
+
readonly type: "string";
|
|
1078
|
+
readonly minLength: 1;
|
|
1079
|
+
};
|
|
1080
|
+
readonly outcome: {
|
|
1081
|
+
readonly const: "error";
|
|
1082
|
+
};
|
|
1083
|
+
readonly error: {
|
|
1084
|
+
readonly type: "object";
|
|
1085
|
+
readonly additionalProperties: true;
|
|
1086
|
+
readonly required: readonly ["schemaVersion", "errorClass", "message"];
|
|
1087
|
+
readonly properties: {
|
|
1088
|
+
readonly schemaVersion: {
|
|
1089
|
+
readonly const: "1.0";
|
|
1090
|
+
};
|
|
1091
|
+
readonly errorClass: {
|
|
1092
|
+
readonly enum: readonly ["CapabilityMismatch", "Offline", "AuthError", "RateLimited", "Timeout", "Unavailable", "Internal"];
|
|
1093
|
+
};
|
|
1094
|
+
readonly message: {
|
|
1095
|
+
readonly type: "string";
|
|
1096
|
+
readonly minLength: 1;
|
|
1097
|
+
};
|
|
1098
|
+
readonly providerId: {
|
|
1099
|
+
readonly type: "string";
|
|
1100
|
+
readonly minLength: 1;
|
|
1101
|
+
};
|
|
1102
|
+
readonly retryable: {
|
|
1103
|
+
readonly type: "boolean";
|
|
1104
|
+
};
|
|
1105
|
+
readonly retryAfterMs: {
|
|
1106
|
+
readonly type: "integer";
|
|
1107
|
+
readonly minimum: 0;
|
|
1108
|
+
};
|
|
1109
|
+
readonly details: {
|
|
1110
|
+
readonly type: "object";
|
|
1111
|
+
readonly additionalProperties: true;
|
|
1112
|
+
};
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
}, {
|
|
1117
|
+
readonly type: "object";
|
|
1118
|
+
readonly additionalProperties: true;
|
|
1119
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "partialText"];
|
|
1120
|
+
readonly properties: {
|
|
1121
|
+
readonly schemaVersion: {
|
|
1122
|
+
readonly const: "1.0";
|
|
1123
|
+
};
|
|
1124
|
+
readonly runId: {
|
|
1125
|
+
readonly type: "string";
|
|
1126
|
+
readonly minLength: 1;
|
|
1127
|
+
};
|
|
1128
|
+
readonly outcome: {
|
|
1129
|
+
readonly const: "cancelled";
|
|
1130
|
+
};
|
|
1131
|
+
readonly partialText: {
|
|
1132
|
+
readonly type: "string";
|
|
1133
|
+
};
|
|
1134
|
+
readonly reason: {
|
|
1135
|
+
readonly type: "string";
|
|
1136
|
+
};
|
|
1137
|
+
};
|
|
1138
|
+
}];
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
}, {
|
|
1142
|
+
readonly type: "object";
|
|
1143
|
+
readonly additionalProperties: true;
|
|
1144
|
+
readonly required: readonly ["schemaVersion", "runId", "sequence", "timestamp", "type"];
|
|
1145
|
+
readonly properties: {
|
|
1146
|
+
readonly schemaVersion: {
|
|
1147
|
+
readonly description: "Contract schema version used to interpret this event payload.";
|
|
1148
|
+
readonly const: "1.0";
|
|
1149
|
+
};
|
|
1150
|
+
readonly runId: {
|
|
1151
|
+
readonly description: "Opaque run identifier this event belongs to, matching StreamRunHandle.runId.";
|
|
1152
|
+
readonly type: "string";
|
|
1153
|
+
readonly minLength: 1;
|
|
1154
|
+
};
|
|
1155
|
+
readonly sequence: {
|
|
1156
|
+
readonly description: "Zero-based, monotonically increasing event index within this run. The ordering authority; do not rely on delivery/arrival order.";
|
|
1157
|
+
readonly type: "integer";
|
|
1158
|
+
readonly minimum: 0;
|
|
1159
|
+
};
|
|
1160
|
+
readonly timestamp: {
|
|
1161
|
+
readonly description: "Wall-clock event timestamp in Unix epoch milliseconds.";
|
|
1162
|
+
readonly type: "number";
|
|
1163
|
+
readonly minimum: 0;
|
|
1164
|
+
};
|
|
1165
|
+
readonly type: {
|
|
1166
|
+
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.";
|
|
1167
|
+
readonly type: "string";
|
|
1168
|
+
readonly not: {
|
|
1169
|
+
readonly enum: readonly ["content_delta", "content_snapshot", "lifecycle", "diagnostic", "terminal"];
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
readonly payload: {
|
|
1173
|
+
readonly description: "Optional event-specific payload for the unrecognized type. It must not contain prompt payloads or raw secrets.";
|
|
1174
|
+
readonly type: "object";
|
|
1175
|
+
readonly additionalProperties: true;
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
}];
|
|
1179
|
+
};
|
|
1180
|
+
export declare const streamTerminalOutcomeSchema: {
|
|
1181
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
1182
|
+
readonly $id: "https://schemas.inderun.dev/1.0/stream-terminal-outcome.schema.json";
|
|
1183
|
+
readonly title: "StreamTerminalOutcome";
|
|
1184
|
+
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.";
|
|
1185
|
+
readonly oneOf: readonly [{
|
|
1186
|
+
readonly type: "object";
|
|
1187
|
+
readonly additionalProperties: true;
|
|
1188
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "finalText"];
|
|
1189
|
+
readonly properties: {
|
|
1190
|
+
readonly schemaVersion: {
|
|
1191
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1192
|
+
readonly const: "1.0";
|
|
1193
|
+
};
|
|
1194
|
+
readonly runId: {
|
|
1195
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1196
|
+
readonly type: "string";
|
|
1197
|
+
readonly minLength: 1;
|
|
1198
|
+
};
|
|
1199
|
+
readonly outcome: {
|
|
1200
|
+
readonly description: "The stream completed normally: every provider-generated event was delivered before this outcome was produced.";
|
|
1201
|
+
readonly const: "completed";
|
|
1202
|
+
};
|
|
1203
|
+
readonly finalText: {
|
|
1204
|
+
readonly description: "The full, cumulative text produced by the run. Equivalent in role to TaskResult.output.text for Mode 1.";
|
|
1205
|
+
readonly type: "string";
|
|
1206
|
+
};
|
|
1207
|
+
readonly finishReason: {
|
|
1208
|
+
readonly description: "How generation ended, mirroring TaskResult.finishReason for Mode 1: 'stop' (natural end), 'length' (hit maxOutputTokens), 'error' (provider reported a non-fatal issue on an otherwise completed run). 'cancelled' is included so this enum stays identical to TaskResult.finishReason, but it is unreachable here: cancellation is its own terminal outcome branch. Optional: providers that do not report a finish reason omit it.";
|
|
1209
|
+
readonly enum: readonly ["stop", "length", "cancelled", "error"];
|
|
1210
|
+
};
|
|
1211
|
+
readonly usage: {
|
|
1212
|
+
readonly description: "Optional metadata regarding the quantity of tokens processed by the provider. Same shape as TaskResult.usage.";
|
|
1213
|
+
readonly type: "object";
|
|
1214
|
+
readonly additionalProperties: true;
|
|
1215
|
+
readonly properties: {
|
|
1216
|
+
readonly inputTokens: {
|
|
1217
|
+
readonly description: "Number of input tokens consumed, as reported by the provider.";
|
|
1218
|
+
readonly type: "integer";
|
|
1219
|
+
readonly minimum: 0;
|
|
1220
|
+
};
|
|
1221
|
+
readonly outputTokens: {
|
|
1222
|
+
readonly description: "Number of output tokens generated, as reported by the provider.";
|
|
1223
|
+
readonly type: "integer";
|
|
1224
|
+
readonly minimum: 0;
|
|
1225
|
+
};
|
|
1226
|
+
readonly totalTokens: {
|
|
1227
|
+
readonly description: "Aggregated token count for this request, as reported by the provider.";
|
|
1228
|
+
readonly type: "integer";
|
|
1229
|
+
readonly minimum: 0;
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
};
|
|
1233
|
+
readonly telemetry: {
|
|
1234
|
+
readonly description: "Required metadata providing an overview of the execution result and performance metrics. Same shape as TaskResult.telemetry.";
|
|
1235
|
+
readonly type: "object";
|
|
1236
|
+
readonly additionalProperties: true;
|
|
1237
|
+
readonly required: readonly ["providerUsed", "totalMs"];
|
|
1238
|
+
readonly properties: {
|
|
1239
|
+
readonly providerUsed: {
|
|
1240
|
+
readonly description: "The identifier for the specific provider that handled the request (e.g., 'openai_compatible_cloud').";
|
|
1241
|
+
readonly type: "string";
|
|
1242
|
+
readonly minLength: 1;
|
|
1243
|
+
};
|
|
1244
|
+
readonly totalMs: {
|
|
1245
|
+
readonly description: "Measured execution duration in milliseconds, including route selection and result processing.";
|
|
1246
|
+
readonly type: "number";
|
|
1247
|
+
readonly minimum: 0;
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
}, {
|
|
1253
|
+
readonly type: "object";
|
|
1254
|
+
readonly additionalProperties: true;
|
|
1255
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "error"];
|
|
1256
|
+
readonly properties: {
|
|
1257
|
+
readonly schemaVersion: {
|
|
1258
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1259
|
+
readonly const: "1.0";
|
|
1260
|
+
};
|
|
1261
|
+
readonly runId: {
|
|
1262
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1263
|
+
readonly type: "string";
|
|
1264
|
+
readonly minLength: 1;
|
|
1265
|
+
};
|
|
1266
|
+
readonly outcome: {
|
|
1267
|
+
readonly description: "The stream ended in failure: validation, routing (no eligible provider), or every attempted provider failing.";
|
|
1268
|
+
readonly const: "error";
|
|
1269
|
+
};
|
|
1270
|
+
readonly error: {
|
|
1271
|
+
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.";
|
|
1272
|
+
readonly type: "object";
|
|
1273
|
+
readonly additionalProperties: true;
|
|
1274
|
+
readonly required: readonly ["schemaVersion", "errorClass", "message"];
|
|
1275
|
+
readonly properties: {
|
|
1276
|
+
readonly schemaVersion: {
|
|
1277
|
+
readonly description: "Contract schema version used to interpret the error payload.";
|
|
1278
|
+
readonly const: "1.0";
|
|
1279
|
+
};
|
|
1280
|
+
readonly errorClass: {
|
|
1281
|
+
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).";
|
|
1282
|
+
readonly enum: readonly ["CapabilityMismatch", "Offline", "AuthError", "RateLimited", "Timeout", "Unavailable", "Internal"];
|
|
1283
|
+
};
|
|
1284
|
+
readonly message: {
|
|
1285
|
+
readonly description: "Human-readable error message suitable for logs and developer diagnostics.";
|
|
1286
|
+
readonly type: "string";
|
|
1287
|
+
readonly minLength: 1;
|
|
1288
|
+
};
|
|
1289
|
+
readonly providerId: {
|
|
1290
|
+
readonly description: "Identifier of the provider associated with the failure, if execution reached a provider.";
|
|
1291
|
+
readonly type: "string";
|
|
1292
|
+
readonly minLength: 1;
|
|
1293
|
+
};
|
|
1294
|
+
readonly retryable: {
|
|
1295
|
+
readonly description: "Whether retrying the same request may succeed.";
|
|
1296
|
+
readonly type: "boolean";
|
|
1297
|
+
};
|
|
1298
|
+
readonly retryAfterMs: {
|
|
1299
|
+
readonly description: "Optional suggested delay before retrying, in milliseconds.";
|
|
1300
|
+
readonly type: "integer";
|
|
1301
|
+
readonly minimum: 0;
|
|
1302
|
+
};
|
|
1303
|
+
readonly details: {
|
|
1304
|
+
readonly description: "Optional structured diagnostic details. It must not contain raw secrets.";
|
|
1305
|
+
readonly type: "object";
|
|
1306
|
+
readonly additionalProperties: true;
|
|
1307
|
+
};
|
|
1308
|
+
};
|
|
1309
|
+
};
|
|
1310
|
+
};
|
|
1311
|
+
}, {
|
|
1312
|
+
readonly type: "object";
|
|
1313
|
+
readonly additionalProperties: true;
|
|
1314
|
+
readonly required: readonly ["schemaVersion", "runId", "outcome", "partialText"];
|
|
1315
|
+
readonly properties: {
|
|
1316
|
+
readonly schemaVersion: {
|
|
1317
|
+
readonly description: "Contract schema version used to interpret this outcome payload.";
|
|
1318
|
+
readonly const: "1.0";
|
|
1319
|
+
};
|
|
1320
|
+
readonly runId: {
|
|
1321
|
+
readonly description: "The stream run this outcome terminates, matching StreamRunHandle.runId and every StreamEvent.runId for the run.";
|
|
1322
|
+
readonly type: "string";
|
|
1323
|
+
readonly minLength: 1;
|
|
1324
|
+
};
|
|
1325
|
+
readonly outcome: {
|
|
1326
|
+
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.";
|
|
1327
|
+
readonly const: "cancelled";
|
|
1328
|
+
};
|
|
1329
|
+
readonly partialText: {
|
|
1330
|
+
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.";
|
|
1331
|
+
readonly type: "string";
|
|
1332
|
+
};
|
|
1333
|
+
readonly reason: {
|
|
1334
|
+
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.";
|
|
1335
|
+
readonly type: "string";
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
}];
|
|
1339
|
+
};
|
|
768
1340
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqM1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HlB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6KrB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClB,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAycpB,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsM9B,CAAC"}
|