authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-27 10:24:09-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-27 14:10:34-08:00
log834236931e17e4215000d2b3ce8defce295499ac
treebdd3e3d51b3d678da41a86d7c309507814280954
parent872b90737211f883b73879e3feae5563140a8fbe

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

1 files changed, 23 insertions(+), 25 deletions(-)

packages/contracts/src/providerRuntime.ts+23-25
......@@ -14,8 +14,6 @@ import {
1414import { ProviderApprovalDecision, ProviderKind, ProviderRequestKind } from "./orchestration";
1515
1616const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString;
17const RuntimeThreadIdSchema = ProviderThreadId;
18const RuntimeTurnIdSchema = ProviderTurnId;
1917
2018export const ProviderRuntimeToolKind = Schema.Union([ProviderRequestKind, Schema.Literal("other")]);
2119export type ProviderRuntimeToolKind = typeof ProviderRuntimeToolKind.Type;
......@@ -34,7 +32,7 @@ export const ProviderRuntimeSessionStartedEvent = Schema.Struct({
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});
4038export type ProviderRuntimeSessionStartedEvent = typeof ProviderRuntimeSessionStartedEvent.Type;
......@@ -45,7 +43,7 @@ export const ProviderRuntimeSessionExitedEvent = Schema.Struct({
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});
5149export type ProviderRuntimeSessionExitedEvent = typeof ProviderRuntimeSessionExitedEvent.Type;
......@@ -56,7 +54,7 @@ export const ProviderRuntimeThreadStartedEvent = Schema.Struct({
5654 provider: ProviderKind,
5755 sessionId: ProviderSessionId,
5856 createdAt: IsoDateTime,
59 threadId: RuntimeThreadIdSchema,
57 threadId: ProviderThreadId,
6058});
6159export type ProviderRuntimeThreadStartedEvent = typeof ProviderRuntimeThreadStartedEvent.Type;
6260
......@@ -66,8 +64,8 @@ export const ProviderRuntimeTurnStartedEvent = Schema.Struct({
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});
7270export type ProviderRuntimeTurnStartedEvent = typeof ProviderRuntimeTurnStartedEvent.Type;
7371
......@@ -77,8 +75,8 @@ export const ProviderRuntimeTurnCompletedEvent = Schema.Struct({
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({
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({
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});
110108export type ProviderRuntimeMessageCompletedEvent = typeof ProviderRuntimeMessageCompletedEvent.Type;
111109
......@@ -115,8 +113,8 @@ export const ProviderRuntimeToolStartedEvent = Schema.Struct({
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({
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({
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({
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({
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({
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});