The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 16:00 UTC
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
Feb 27, 2026 at 10:24 UTC
834236931e17e4215000d2b3ce8defce295499ac
1 file changed
+23
-25
packages/contracts/src/providerRuntime.ts
+23
-25
@@ -14,8 +14,6 @@ import {
14
import { ProviderApprovalDecision, ProviderKind, ProviderRequestKind } from "./orchestration";
15
16
const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString;
17
-const RuntimeThreadIdSchema = ProviderThreadId;
18
-const RuntimeTurnIdSchema = ProviderTurnId;
17
18
export const ProviderRuntimeToolKind = Schema.Union([ProviderRequestKind, Schema.Literal("other")]);
19
export type ProviderRuntimeToolKind = typeof ProviderRuntimeToolKind.Type;
@@ -34,7 +32,7 @@ export const ProviderRuntimeSessionStartedEvent = Schema.Struct({
32
provider: ProviderKind,
33
sessionId: ProviderSessionId,
34
createdAt: IsoDateTime,
37
- threadId: Schema.optional(RuntimeThreadIdSchema),
35
+ threadId: Schema.optional(ProviderThreadId),
36
message: Schema.optional(TrimmedNonEmptyStringSchema),
37
});
38
export type ProviderRuntimeSessionStartedEvent = typeof ProviderRuntimeSessionStartedEvent.Type;
@@ -45,7 +43,7 @@ export const ProviderRuntimeSessionExitedEvent = Schema.Struct({
43
provider: ProviderKind,
44
sessionId: ProviderSessionId,
45
createdAt: IsoDateTime,
48
- threadId: Schema.optional(RuntimeThreadIdSchema),
46
+ threadId: Schema.optional(ProviderThreadId),
47
message: Schema.optional(TrimmedNonEmptyStringSchema),
48
});
49
export type ProviderRuntimeSessionExitedEvent = typeof ProviderRuntimeSessionExitedEvent.Type;
@@ -56,7 +54,7 @@ export const ProviderRuntimeThreadStartedEvent = Schema.Struct({
54
provider: ProviderKind,
55
sessionId: ProviderSessionId,
56
createdAt: IsoDateTime,
59
- threadId: RuntimeThreadIdSchema,
57
+ threadId: ProviderThreadId,
58
});
59
export type ProviderRuntimeThreadStartedEvent = typeof ProviderRuntimeThreadStartedEvent.Type;
60
@@ -66,8 +64,8 @@ export const ProviderRuntimeTurnStartedEvent = Schema.Struct({
64
provider: ProviderKind,
65
sessionId: ProviderSessionId,
66
createdAt: IsoDateTime,
69
- threadId: Schema.optional(RuntimeThreadIdSchema),
70
- turnId: RuntimeTurnIdSchema,
67
+ threadId: Schema.optional(ProviderThreadId),
68
+ turnId: ProviderTurnId,
69
});
70
export type ProviderRuntimeTurnStartedEvent = typeof ProviderRuntimeTurnStartedEvent.Type;
71
@@ -77,8 +75,8 @@ export const ProviderRuntimeTurnCompletedEvent = Schema.Struct({
75
provider: ProviderKind,
76
sessionId: ProviderSessionId,
77
createdAt: IsoDateTime,
80
- threadId: Schema.optional(RuntimeThreadIdSchema),
81
- turnId: Schema.optional(RuntimeTurnIdSchema),
78
+ threadId: Schema.optional(ProviderThreadId),
79
+ turnId: Schema.optional(ProviderTurnId),
80
status: Schema.optional(ProviderRuntimeTurnStatus),
81
errorMessage: Schema.optional(TrimmedNonEmptyStringSchema),
82
});
@@ -90,8 +88,8 @@ export const ProviderRuntimeMessageDeltaEvent = Schema.Struct({
88
provider: ProviderKind,
89
sessionId: ProviderSessionId,
90
createdAt: IsoDateTime,
93
- threadId: Schema.optional(RuntimeThreadIdSchema),
94
- turnId: Schema.optional(RuntimeTurnIdSchema),
91
+ threadId: Schema.optional(ProviderThreadId),
92
+ turnId: Schema.optional(ProviderTurnId),
93
itemId: Schema.optional(ProviderItemId),
94
delta: Schema.String,
95
});
@@ -104,8 +102,8 @@ export const ProviderRuntimeMessageCompletedEvent = Schema.Struct({
102
sessionId: ProviderSessionId,
103
createdAt: IsoDateTime,
104
itemId: ProviderItemId,
107
- threadId: Schema.optional(RuntimeThreadIdSchema),
108
- turnId: Schema.optional(RuntimeTurnIdSchema),
105
+ threadId: Schema.optional(ProviderThreadId),
106
+ turnId: Schema.optional(ProviderTurnId),
107
});
108
export type ProviderRuntimeMessageCompletedEvent = typeof ProviderRuntimeMessageCompletedEvent.Type;
109
@@ -115,8 +113,8 @@ export const ProviderRuntimeToolStartedEvent = Schema.Struct({
113
provider: ProviderKind,
114
sessionId: ProviderSessionId,
115
createdAt: IsoDateTime,
118
- threadId: Schema.optional(RuntimeThreadIdSchema),
119
- turnId: Schema.optional(RuntimeTurnIdSchema),
116
+ threadId: Schema.optional(ProviderThreadId),
117
+ turnId: Schema.optional(ProviderTurnId),
118
itemId: Schema.optional(ProviderItemId),
119
toolKind: ProviderRuntimeToolKind,
120
title: TrimmedNonEmptyStringSchema,
@@ -130,8 +128,8 @@ export const ProviderRuntimeToolCompletedEvent = Schema.Struct({
128
provider: ProviderKind,
129
sessionId: ProviderSessionId,
130
createdAt: IsoDateTime,
133
- threadId: Schema.optional(RuntimeThreadIdSchema),
134
- turnId: Schema.optional(RuntimeTurnIdSchema),
131
+ threadId: Schema.optional(ProviderThreadId),
132
+ turnId: Schema.optional(ProviderTurnId),
133
itemId: Schema.optional(ProviderItemId),
134
toolKind: ProviderRuntimeToolKind,
135
title: TrimmedNonEmptyStringSchema,
@@ -145,8 +143,8 @@ export const ProviderRuntimeApprovalRequestedEvent = Schema.Struct({
143
provider: ProviderKind,
144
sessionId: ProviderSessionId,
145
createdAt: IsoDateTime,
148
- threadId: Schema.optional(RuntimeThreadIdSchema),
149
- turnId: Schema.optional(RuntimeTurnIdSchema),
146
+ threadId: Schema.optional(ProviderThreadId),
147
+ turnId: Schema.optional(ProviderTurnId),
148
itemId: Schema.optional(ProviderItemId),
149
requestId: ApprovalRequestId,
150
requestKind: ProviderRequestKind,
@@ -161,8 +159,8 @@ export const ProviderRuntimeApprovalResolvedEvent = Schema.Struct({
159
provider: ProviderKind,
160
sessionId: ProviderSessionId,
161
createdAt: IsoDateTime,
164
- threadId: Schema.optional(RuntimeThreadIdSchema),
165
- turnId: Schema.optional(RuntimeTurnIdSchema),
162
+ threadId: Schema.optional(ProviderThreadId),
163
+ turnId: Schema.optional(ProviderTurnId),
164
itemId: Schema.optional(ProviderItemId),
165
requestId: ApprovalRequestId,
166
requestKind: Schema.optional(ProviderRequestKind),
@@ -176,8 +174,8 @@ export const ProviderRuntimeCheckpointCapturedEvent = Schema.Struct({
174
provider: ProviderKind,
175
sessionId: ProviderSessionId,
176
createdAt: IsoDateTime,
179
- threadId: RuntimeThreadIdSchema,
180
- turnId: Schema.optional(RuntimeTurnIdSchema),
177
+ threadId: ProviderThreadId,
178
+ turnId: Schema.optional(ProviderTurnId),
179
turnCount: NonNegativeInt,
180
status: Schema.optional(ProviderRuntimeTurnStatus),
181
});
@@ -190,8 +188,8 @@ export const ProviderRuntimeErrorEvent = Schema.Struct({
188
provider: ProviderKind,
189
sessionId: ProviderSessionId,
190
createdAt: IsoDateTime,
193
- threadId: Schema.optional(RuntimeThreadIdSchema),
194
- turnId: Schema.optional(RuntimeTurnIdSchema),
191
+ threadId: Schema.optional(ProviderThreadId),
192
+ turnId: Schema.optional(ProviderTurnId),
193
itemId: Schema.optional(ProviderItemId),
194
message: TrimmedNonEmptyStringSchema,
195
});