History

Inline provider thread and turn ID schemas in runtime events

- Remove redundant runtime schema aliases for thread and turn IDs - Use `ProviderThreadId` and `ProviderTurnId` directly across runtime event contracts

Julius Marminge committed 8 months ago

Commit 7dab2401 parent d19b2f51 file · +23 −25Browse files

Unified · Split

packages/contracts/src/providerRuntime.ts+23−25
@@ -14,8 +14,6 @@ import { · 13 unmodified lines
1414 import { ProviderApprovalDecision, ProviderKind, ProviderRequestKind } from "./orchestration";
1515
1616 const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString;
17−const RuntimeThreadIdSchema = ProviderThreadId;
18−const RuntimeTurnIdSchema = ProviderTurnId;
1917
2018 export const ProviderRuntimeToolKind = Schema.Union([ProviderRequestKind, Schema.Literal("other")]);
2119 export type ProviderRuntimeToolKind = typeof ProviderRuntimeToolKind.Type;
@@ -34,7 +32,7 @@ export const ProviderRuntimeSessionStartedEvent = Schema.Struct({ · 12 unmodified lines
3432 provider: ProviderKind,
3533 sessionId: ProviderSessionId,
3634 createdAt: IsoDateTime,
37− threadId: Schema.optional(RuntimeThreadIdSchema),
35+ threadId: Schema.optional(ProviderThreadId),
3836 message: Schema.optional(TrimmedNonEmptyStringSchema),
3937 });
4038 export type ProviderRuntimeSessionStartedEvent = typeof ProviderRuntimeSessionStartedEvent.Type;
@@ -45,7 +43,7 @@ export const ProviderRuntimeSessionExitedEvent = Schema.Struct({ · 4 unmodified lines
4543 provider: ProviderKind,
4644 sessionId: ProviderSessionId,
4745 createdAt: IsoDateTime,
48− threadId: Schema.optional(RuntimeThreadIdSchema),
46+ threadId: Schema.optional(ProviderThreadId),
4947 message: Schema.optional(TrimmedNonEmptyStringSchema),
5048 });
5149 export type ProviderRuntimeSessionExitedEvent = typeof ProviderRuntimeSessionExitedEvent.Type;
@@ -56,7 +54,7 @@ export const ProviderRuntimeThreadStartedEvent = Schema.Struct({ · 4 unmodified lines
5654 provider: ProviderKind,
5755 sessionId: ProviderSessionId,
5856 createdAt: IsoDateTime,
59− threadId: RuntimeThreadIdSchema,
57+ threadId: ProviderThreadId,
6058 });
6159 export type ProviderRuntimeThreadStartedEvent = typeof ProviderRuntimeThreadStartedEvent.Type;
6260
@@ -66,8 +64,8 @@ export const ProviderRuntimeTurnStartedEvent = Schema.Struct({ · 3 unmodified lines
6664 provider: ProviderKind,
6765 sessionId: ProviderSessionId,
6866 createdAt: IsoDateTime,
69− threadId: Schema.optional(RuntimeThreadIdSchema),
70− turnId: RuntimeTurnIdSchema,
67+ threadId: Schema.optional(ProviderThreadId),
68+ turnId: ProviderTurnId,
7169 });
7270 export type ProviderRuntimeTurnStartedEvent = typeof ProviderRuntimeTurnStartedEvent.Type;
7371
@@ -77,8 +75,8 @@ export const ProviderRuntimeTurnCompletedEvent = Schema.Struct({ · 3 unmodified lines
7775 provider: ProviderKind,
7876 sessionId: ProviderSessionId,
7977 createdAt: IsoDateTime,
80− threadId: Schema.optional(RuntimeThreadIdSchema),
81− turnId: Schema.optional(RuntimeTurnIdSchema),
78+ threadId: Schema.optional(ProviderThreadId),
79+ turnId: Schema.optional(ProviderTurnId),
8280 status: Schema.optional(ProviderRuntimeTurnStatus),
8381 errorMessage: Schema.optional(TrimmedNonEmptyStringSchema),
8482 });
@@ -90,8 +88,8 @@ export const ProviderRuntimeMessageDeltaEvent = Schema.Struct({ · 5 unmodified lines
9088 provider: ProviderKind,
9189 sessionId: ProviderSessionId,
9290 createdAt: IsoDateTime,
93− threadId: Schema.optional(RuntimeThreadIdSchema),
94− turnId: Schema.optional(RuntimeTurnIdSchema),
91+ threadId: Schema.optional(ProviderThreadId),
92+ turnId: Schema.optional(ProviderTurnId),
9593 itemId: Schema.optional(ProviderItemId),
9694 delta: Schema.String,
9795 });
@@ -104,8 +102,8 @@ export const ProviderRuntimeMessageCompletedEvent = Schema.Struct({ · 6 unmodified lines
104102 sessionId: ProviderSessionId,
105103 createdAt: IsoDateTime,
106104 itemId: ProviderItemId,
107− threadId: Schema.optional(RuntimeThreadIdSchema),
108− turnId: Schema.optional(RuntimeTurnIdSchema),
105+ threadId: Schema.optional(ProviderThreadId),
106+ turnId: Schema.optional(ProviderTurnId),
109107 });
110108 export type ProviderRuntimeMessageCompletedEvent = typeof ProviderRuntimeMessageCompletedEvent.Type;
111109
@@ -115,8 +113,8 @@ export const ProviderRuntimeToolStartedEvent = Schema.Struct({ · 3 unmodified lines
115113 provider: ProviderKind,
116114 sessionId: ProviderSessionId,
117115 createdAt: IsoDateTime,
118− threadId: Schema.optional(RuntimeThreadIdSchema),
119− turnId: Schema.optional(RuntimeTurnIdSchema),
116+ threadId: Schema.optional(ProviderThreadId),
117+ turnId: Schema.optional(ProviderTurnId),
120118 itemId: Schema.optional(ProviderItemId),
121119 toolKind: ProviderRuntimeToolKind,
122120 title: TrimmedNonEmptyStringSchema,
@@ -130,8 +128,8 @@ export const ProviderRuntimeToolCompletedEvent = Schema.Struct({ · 7 unmodified lines
130128 provider: ProviderKind,
131129 sessionId: ProviderSessionId,
132130 createdAt: IsoDateTime,
133− threadId: Schema.optional(RuntimeThreadIdSchema),
134− turnId: Schema.optional(RuntimeTurnIdSchema),
131+ threadId: Schema.optional(ProviderThreadId),
132+ turnId: Schema.optional(ProviderTurnId),
135133 itemId: Schema.optional(ProviderItemId),
136134 toolKind: ProviderRuntimeToolKind,
137135 title: TrimmedNonEmptyStringSchema,
@@ -145,8 +143,8 @@ export const ProviderRuntimeApprovalRequestedEvent = Schema.Struct({ · 7 unmodified lines
145143 provider: ProviderKind,
146144 sessionId: ProviderSessionId,
147145 createdAt: IsoDateTime,
148− threadId: Schema.optional(RuntimeThreadIdSchema),
149− turnId: Schema.optional(RuntimeTurnIdSchema),
146+ threadId: Schema.optional(ProviderThreadId),
147+ turnId: Schema.optional(ProviderTurnId),
150148 itemId: Schema.optional(ProviderItemId),
151149 requestId: ApprovalRequestId,
152150 requestKind: ProviderRequestKind,
@@ -161,8 +159,8 @@ export const ProviderRuntimeApprovalResolvedEvent = Schema.Struct({ · 8 unmodified lines
161159 provider: ProviderKind,
162160 sessionId: ProviderSessionId,
163161 createdAt: IsoDateTime,
164− threadId: Schema.optional(RuntimeThreadIdSchema),
165− turnId: Schema.optional(RuntimeTurnIdSchema),
162+ threadId: Schema.optional(ProviderThreadId),
163+ turnId: Schema.optional(ProviderTurnId),
166164 itemId: Schema.optional(ProviderItemId),
167165 requestId: ApprovalRequestId,
168166 requestKind: Schema.optional(ProviderRequestKind),
@@ -176,8 +174,8 @@ export const ProviderRuntimeCheckpointCapturedEvent = Schema.Struct({ · 7 unmodified lines
176174 provider: ProviderKind,
177175 sessionId: ProviderSessionId,
178176 createdAt: IsoDateTime,
179− threadId: RuntimeThreadIdSchema,
180− turnId: Schema.optional(RuntimeTurnIdSchema),
177+ threadId: ProviderThreadId,
178+ turnId: Schema.optional(ProviderTurnId),
181179 turnCount: NonNegativeInt,
182180 status: Schema.optional(ProviderRuntimeTurnStatus),
183181 });
@@ -190,8 +188,8 @@ export const ProviderRuntimeErrorEvent = Schema.Struct({ · 6 unmodified lines
190188 provider: ProviderKind,
191189 sessionId: ProviderSessionId,
192190 createdAt: IsoDateTime,
193− threadId: Schema.optional(RuntimeThreadIdSchema),
194− turnId: Schema.optional(RuntimeTurnIdSchema),
191+ threadId: Schema.optional(ProviderThreadId),
192+ turnId: Schema.optional(ProviderTurnId),
195193 itemId: Schema.optional(ProviderItemId),
196194 message: TrimmedNonEmptyStringSchema,
197195 });