The best way to control Claude Code, Codex and more from any computer or phone
fix(codex): image items identified by fileId are no longer dropped (#35883)
Julius Marminge committed
Nov 12, 2026 at 23:03 UTC
5f85768394f417f5bd098ca7fe4fc41ef07a7cda
3 files changed
+123
-37
packages/effect-codex-app-server/scripts/generate.ts
+29
-1
@@ -188,6 +188,32 @@ function openStringEnum(schema: Schema.Json): Schema.Json {
188
};
189
}
190
191
+// Newer Codex identifies a generated image by `fileId` and omits the inline `result`.
192
+// Requiring `result` fails the whole notification decode and drops the finished image.
193
+function acceptImageFileIds(schema: Schema.Json): Schema.Json {
194
+ if (!isJsonSchemaNode(schema) || !Array.isArray(schema.oneOf)) return schema;
195
+ return {
196
+ ...schema,
197
+ oneOf: schema.oneOf.map((variant: Schema.Json) => {
198
+ if (
199
+ !isJsonSchemaNode(variant) ||
200
+ !isJsonSchemaNode(variant.properties) ||
201
+ !isJsonSchemaNode(variant.properties.type) ||
202
+ !Array.isArray(variant.properties.type.enum) ||
203
+ !variant.properties.type.enum.includes("imageGeneration") ||
204
+ !Array.isArray(variant.required)
205
+ ) {
206
+ return variant;
207
+ }
208
+ return {
209
+ ...variant,
210
+ properties: { ...variant.properties, fileId: { type: "string" } },
211
+ required: variant.required.filter((key: Schema.Json) => key !== "result"),
212
+ };
213
+ }),
214
+ };
215
+}
216
+
217
const getGeneratedPaths = Effect.fn("getGeneratedPaths")(function* () {
218
const path = yield* Path.Path;
219
const generatedDir = path.join(import.meta.dirname, "..", "src", "_generated");
@@ -684,7 +710,9 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
710
DefinitionOverrides[definitionName] ??
711
(OpenStringEnumDefinitions.has(definitionName)
712
? openStringEnum(definitionSchema)
687
- : definitionSchema),
713
+ : definitionName === "ThreadItem"
714
+ ? acceptImageFileIds(definitionSchema)
715
+ : definitionSchema),
716
localDefinitionNames,
717
file.namespace,
718
exportNameByQualifiedName,
packages/effect-codex-app-server/src/_generated/schema.gen.ts
+72
-36
@@ -32959,12 +32959,13 @@ export type ServerNotification__ThreadItem =
32959
| {
32960
readonly failure?: ServerNotification__ImageGenerationFailure | null;
32961
readonly id: string;
32962
- readonly result: string;
32962
+ readonly result?: string;
32963
readonly revisedPrompt?: string | null;
32964
readonly savedPath?: ServerNotification__AbsolutePathBuf | null;
32965
readonly status: string;
32966
readonly transparentBackground?: boolean | null;
32967
readonly type: "imageGeneration";
32968
+ readonly fileId?: string;
32969
}
32970
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
32971
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -33259,7 +33260,7 @@ export const ServerNotification__ThreadItem = Schema.Union(
33260
Schema.Union([ServerNotification__ImageGenerationFailure, Schema.Null]),
33261
),
33262
id: Schema.String,
33262
- result: Schema.String,
33263
+ result: Schema.optionalKey(Schema.String),
33264
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
33265
savedPath: Schema.optionalKey(
33266
Schema.Union([ServerNotification__AbsolutePathBuf, Schema.Null]),
@@ -33267,6 +33268,7 @@ export const ServerNotification__ThreadItem = Schema.Union(
33268
status: Schema.String,
33269
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
33270
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
33271
+ fileId: Schema.optionalKey(Schema.String),
33272
}).annotate({ title: "ImageGenerationThreadItem" }),
33273
Schema.Struct({
33274
id: Schema.String,
@@ -33537,12 +33539,13 @@ export type V2ItemCompletedNotification__ThreadItem =
33539
| {
33540
readonly failure?: V2ItemCompletedNotification__ImageGenerationFailure | null;
33541
readonly id: string;
33540
- readonly result: string;
33542
+ readonly result?: string;
33543
readonly revisedPrompt?: string | null;
33544
readonly savedPath?: V2ItemCompletedNotification__AbsolutePathBuf | null;
33545
readonly status: string;
33546
readonly transparentBackground?: boolean | null;
33547
readonly type: "imageGeneration";
33548
+ readonly fileId?: string;
33549
}
33550
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
33551
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -33847,7 +33850,7 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union(
33850
Schema.Union([V2ItemCompletedNotification__ImageGenerationFailure, Schema.Null]),
33851
),
33852
id: Schema.String,
33850
- result: Schema.String,
33853
+ result: Schema.optionalKey(Schema.String),
33854
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
33855
savedPath: Schema.optionalKey(
33856
Schema.Union([V2ItemCompletedNotification__AbsolutePathBuf, Schema.Null]),
@@ -33855,6 +33858,7 @@ export const V2ItemCompletedNotification__ThreadItem = Schema.Union(
33858
status: Schema.String,
33859
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
33860
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
33861
+ fileId: Schema.optionalKey(Schema.String),
33862
}).annotate({ title: "ImageGenerationThreadItem" }),
33863
Schema.Struct({
33864
id: Schema.String,
@@ -34022,12 +34026,13 @@ export type V2ItemStartedNotification__ThreadItem =
34026
| {
34027
readonly failure?: V2ItemStartedNotification__ImageGenerationFailure | null;
34028
readonly id: string;
34025
- readonly result: string;
34029
+ readonly result?: string;
34030
readonly revisedPrompt?: string | null;
34031
readonly savedPath?: V2ItemStartedNotification__AbsolutePathBuf | null;
34032
readonly status: string;
34033
readonly transparentBackground?: boolean | null;
34034
readonly type: "imageGeneration";
34035
+ readonly fileId?: string;
34036
}
34037
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
34038
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -34332,7 +34337,7 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union(
34337
Schema.Union([V2ItemStartedNotification__ImageGenerationFailure, Schema.Null]),
34338
),
34339
id: Schema.String,
34335
- result: Schema.String,
34340
+ result: Schema.optionalKey(Schema.String),
34341
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
34342
savedPath: Schema.optionalKey(
34343
Schema.Union([V2ItemStartedNotification__AbsolutePathBuf, Schema.Null]),
@@ -34340,6 +34345,7 @@ export const V2ItemStartedNotification__ThreadItem = Schema.Union(
34345
status: Schema.String,
34346
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
34347
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
34348
+ fileId: Schema.optionalKey(Schema.String),
34349
}).annotate({ title: "ImageGenerationThreadItem" }),
34350
Schema.Struct({
34351
id: Schema.String,
@@ -35241,12 +35247,13 @@ export type V2ReviewStartResponse__ThreadItem =
35247
| {
35248
readonly failure?: V2ReviewStartResponse__ImageGenerationFailure | null;
35249
readonly id: string;
35244
- readonly result: string;
35250
+ readonly result?: string;
35251
readonly revisedPrompt?: string | null;
35252
readonly savedPath?: V2ReviewStartResponse__AbsolutePathBuf | null;
35253
readonly status: string;
35254
readonly transparentBackground?: boolean | null;
35255
readonly type: "imageGeneration";
35256
+ readonly fileId?: string;
35257
}
35258
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
35259
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -35545,7 +35552,7 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union(
35552
Schema.Union([V2ReviewStartResponse__ImageGenerationFailure, Schema.Null]),
35553
),
35554
id: Schema.String,
35548
- result: Schema.String,
35555
+ result: Schema.optionalKey(Schema.String),
35556
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
35557
savedPath: Schema.optionalKey(
35558
Schema.Union([V2ReviewStartResponse__AbsolutePathBuf, Schema.Null]),
@@ -35553,6 +35560,7 @@ export const V2ReviewStartResponse__ThreadItem = Schema.Union(
35560
status: Schema.String,
35561
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
35562
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
35563
+ fileId: Schema.optionalKey(Schema.String),
35564
}).annotate({ title: "ImageGenerationThreadItem" }),
35565
Schema.Struct({
35566
id: Schema.String,
@@ -35707,12 +35715,13 @@ export type V2ThreadForkResponse__ThreadItem =
35715
| {
35716
readonly failure?: V2ThreadForkResponse__ImageGenerationFailure | null;
35717
readonly id: string;
35710
- readonly result: string;
35718
+ readonly result?: string;
35719
readonly revisedPrompt?: string | null;
35720
readonly savedPath?: V2ThreadForkResponse__AbsolutePathBuf | null;
35721
readonly status: string;
35722
readonly transparentBackground?: boolean | null;
35723
readonly type: "imageGeneration";
35724
+ readonly fileId?: string;
35725
}
35726
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
35727
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -36011,7 +36020,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union(
36020
Schema.Union([V2ThreadForkResponse__ImageGenerationFailure, Schema.Null]),
36021
),
36022
id: Schema.String,
36014
- result: Schema.String,
36023
+ result: Schema.optionalKey(Schema.String),
36024
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
36025
savedPath: Schema.optionalKey(
36026
Schema.Union([V2ThreadForkResponse__AbsolutePathBuf, Schema.Null]),
@@ -36019,6 +36028,7 @@ export const V2ThreadForkResponse__ThreadItem = Schema.Union(
36028
status: Schema.String,
36029
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
36030
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
36031
+ fileId: Schema.optionalKey(Schema.String),
36032
}).annotate({ title: "ImageGenerationThreadItem" }),
36033
Schema.Struct({
36034
id: Schema.String,
@@ -36162,12 +36172,13 @@ export type V2ThreadItemsListResponse__ThreadItem =
36172
| {
36173
readonly failure?: V2ThreadItemsListResponse__ImageGenerationFailure | null;
36174
readonly id: string;
36165
- readonly result: string;
36175
+ readonly result?: string;
36176
readonly revisedPrompt?: string | null;
36177
readonly savedPath?: V2ThreadItemsListResponse__AbsolutePathBuf | null;
36178
readonly status: string;
36179
readonly transparentBackground?: boolean | null;
36180
readonly type: "imageGeneration";
36181
+ readonly fileId?: string;
36182
}
36183
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
36184
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -36472,7 +36483,7 @@ export const V2ThreadItemsListResponse__ThreadItem = Schema.Union(
36483
Schema.Union([V2ThreadItemsListResponse__ImageGenerationFailure, Schema.Null]),
36484
),
36485
id: Schema.String,
36475
- result: Schema.String,
36486
+ result: Schema.optionalKey(Schema.String),
36487
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
36488
savedPath: Schema.optionalKey(
36489
Schema.Union([V2ThreadItemsListResponse__AbsolutePathBuf, Schema.Null]),
@@ -36480,6 +36491,7 @@ export const V2ThreadItemsListResponse__ThreadItem = Schema.Union(
36491
status: Schema.String,
36492
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
36493
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
36494
+ fileId: Schema.optionalKey(Schema.String),
36495
}).annotate({ title: "ImageGenerationThreadItem" }),
36496
Schema.Struct({
36497
id: Schema.String,
@@ -36623,12 +36635,13 @@ export type V2ThreadListResponse__ThreadItem =
36635
| {
36636
readonly failure?: V2ThreadListResponse__ImageGenerationFailure | null;
36637
readonly id: string;
36626
- readonly result: string;
36638
+ readonly result?: string;
36639
readonly revisedPrompt?: string | null;
36640
readonly savedPath?: V2ThreadListResponse__AbsolutePathBuf | null;
36641
readonly status: string;
36642
readonly transparentBackground?: boolean | null;
36643
readonly type: "imageGeneration";
36644
+ readonly fileId?: string;
36645
}
36646
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
36647
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -36927,7 +36940,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union(
36940
Schema.Union([V2ThreadListResponse__ImageGenerationFailure, Schema.Null]),
36941
),
36942
id: Schema.String,
36930
- result: Schema.String,
36943
+ result: Schema.optionalKey(Schema.String),
36944
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
36945
savedPath: Schema.optionalKey(
36946
Schema.Union([V2ThreadListResponse__AbsolutePathBuf, Schema.Null]),
@@ -36935,6 +36948,7 @@ export const V2ThreadListResponse__ThreadItem = Schema.Union(
36948
status: Schema.String,
36949
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
36950
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
36951
+ fileId: Schema.optionalKey(Schema.String),
36952
}).annotate({ title: "ImageGenerationThreadItem" }),
36953
Schema.Struct({
36954
id: Schema.String,
@@ -37080,12 +37094,13 @@ export type V2ThreadMetadataUpdateResponse__ThreadItem =
37094
| {
37095
readonly failure?: V2ThreadMetadataUpdateResponse__ImageGenerationFailure | null;
37096
readonly id: string;
37083
- readonly result: string;
37097
+ readonly result?: string;
37098
readonly revisedPrompt?: string | null;
37099
readonly savedPath?: V2ThreadMetadataUpdateResponse__AbsolutePathBuf | null;
37100
readonly status: string;
37101
readonly transparentBackground?: boolean | null;
37102
readonly type: "imageGeneration";
37103
+ readonly fileId?: string;
37104
}
37105
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
37106
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -37390,7 +37405,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union(
37405
Schema.Union([V2ThreadMetadataUpdateResponse__ImageGenerationFailure, Schema.Null]),
37406
),
37407
id: Schema.String,
37393
- result: Schema.String,
37408
+ result: Schema.optionalKey(Schema.String),
37409
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
37410
savedPath: Schema.optionalKey(
37411
Schema.Union([V2ThreadMetadataUpdateResponse__AbsolutePathBuf, Schema.Null]),
@@ -37398,6 +37413,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadItem = Schema.Union(
37413
status: Schema.String,
37414
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
37415
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
37416
+ fileId: Schema.optionalKey(Schema.String),
37417
}).annotate({ title: "ImageGenerationThreadItem" }),
37418
Schema.Struct({
37419
id: Schema.String,
@@ -37541,12 +37557,13 @@ export type V2ThreadReadResponse__ThreadItem =
37557
| {
37558
readonly failure?: V2ThreadReadResponse__ImageGenerationFailure | null;
37559
readonly id: string;
37544
- readonly result: string;
37560
+ readonly result?: string;
37561
readonly revisedPrompt?: string | null;
37562
readonly savedPath?: V2ThreadReadResponse__AbsolutePathBuf | null;
37563
readonly status: string;
37564
readonly transparentBackground?: boolean | null;
37565
readonly type: "imageGeneration";
37566
+ readonly fileId?: string;
37567
}
37568
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
37569
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -37845,7 +37862,7 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union(
37862
Schema.Union([V2ThreadReadResponse__ImageGenerationFailure, Schema.Null]),
37863
),
37864
id: Schema.String,
37848
- result: Schema.String,
37865
+ result: Schema.optionalKey(Schema.String),
37866
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
37867
savedPath: Schema.optionalKey(
37868
Schema.Union([V2ThreadReadResponse__AbsolutePathBuf, Schema.Null]),
@@ -37853,6 +37870,7 @@ export const V2ThreadReadResponse__ThreadItem = Schema.Union(
37870
status: Schema.String,
37871
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
37872
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
37873
+ fileId: Schema.optionalKey(Schema.String),
37874
}).annotate({ title: "ImageGenerationThreadItem" }),
37875
Schema.Struct({
37876
id: Schema.String,
@@ -37996,12 +38014,13 @@ export type V2ThreadResumeResponse__ThreadItem =
38014
| {
38015
readonly failure?: V2ThreadResumeResponse__ImageGenerationFailure | null;
38016
readonly id: string;
37999
- readonly result: string;
38017
+ readonly result?: string;
38018
readonly revisedPrompt?: string | null;
38019
readonly savedPath?: V2ThreadResumeResponse__AbsolutePathBuf | null;
38020
readonly status: string;
38021
readonly transparentBackground?: boolean | null;
38022
readonly type: "imageGeneration";
38023
+ readonly fileId?: string;
38024
}
38025
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
38026
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -38300,7 +38319,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union(
38319
Schema.Union([V2ThreadResumeResponse__ImageGenerationFailure, Schema.Null]),
38320
),
38321
id: Schema.String,
38303
- result: Schema.String,
38322
+ result: Schema.optionalKey(Schema.String),
38323
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
38324
savedPath: Schema.optionalKey(
38325
Schema.Union([V2ThreadResumeResponse__AbsolutePathBuf, Schema.Null]),
@@ -38308,6 +38327,7 @@ export const V2ThreadResumeResponse__ThreadItem = Schema.Union(
38327
status: Schema.String,
38328
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
38329
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
38330
+ fileId: Schema.optionalKey(Schema.String),
38331
}).annotate({ title: "ImageGenerationThreadItem" }),
38332
Schema.Struct({
38333
id: Schema.String,
@@ -38451,12 +38471,13 @@ export type V2ThreadRevertResponse__ThreadItem =
38471
| {
38472
readonly failure?: V2ThreadRevertResponse__ImageGenerationFailure | null;
38473
readonly id: string;
38454
- readonly result: string;
38474
+ readonly result?: string;
38475
readonly revisedPrompt?: string | null;
38476
readonly savedPath?: V2ThreadRevertResponse__AbsolutePathBuf | null;
38477
readonly status: string;
38478
readonly transparentBackground?: boolean | null;
38479
readonly type: "imageGeneration";
38480
+ readonly fileId?: string;
38481
}
38482
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
38483
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -38755,7 +38776,7 @@ export const V2ThreadRevertResponse__ThreadItem = Schema.Union(
38776
Schema.Union([V2ThreadRevertResponse__ImageGenerationFailure, Schema.Null]),
38777
),
38778
id: Schema.String,
38758
- result: Schema.String,
38779
+ result: Schema.optionalKey(Schema.String),
38780
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
38781
savedPath: Schema.optionalKey(
38782
Schema.Union([V2ThreadRevertResponse__AbsolutePathBuf, Schema.Null]),
@@ -38763,6 +38784,7 @@ export const V2ThreadRevertResponse__ThreadItem = Schema.Union(
38784
status: Schema.String,
38785
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
38786
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
38787
+ fileId: Schema.optionalKey(Schema.String),
38788
}).annotate({ title: "ImageGenerationThreadItem" }),
38789
Schema.Struct({
38790
id: Schema.String,
@@ -38955,12 +38977,13 @@ export type V2ThreadStartedNotification__ThreadItem =
38977
| {
38978
readonly failure?: V2ThreadStartedNotification__ImageGenerationFailure | null;
38979
readonly id: string;
38958
- readonly result: string;
38980
+ readonly result?: string;
38981
readonly revisedPrompt?: string | null;
38982
readonly savedPath?: V2ThreadStartedNotification__AbsolutePathBuf | null;
38983
readonly status: string;
38984
readonly transparentBackground?: boolean | null;
38985
readonly type: "imageGeneration";
38986
+ readonly fileId?: string;
38987
}
38988
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
38989
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -39265,7 +39288,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union(
39288
Schema.Union([V2ThreadStartedNotification__ImageGenerationFailure, Schema.Null]),
39289
),
39290
id: Schema.String,
39268
- result: Schema.String,
39291
+ result: Schema.optionalKey(Schema.String),
39292
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
39293
savedPath: Schema.optionalKey(
39294
Schema.Union([V2ThreadStartedNotification__AbsolutePathBuf, Schema.Null]),
@@ -39273,6 +39296,7 @@ export const V2ThreadStartedNotification__ThreadItem = Schema.Union(
39296
status: Schema.String,
39297
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
39298
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
39299
+ fileId: Schema.optionalKey(Schema.String),
39300
}).annotate({ title: "ImageGenerationThreadItem" }),
39301
Schema.Struct({
39302
id: Schema.String,
@@ -39416,12 +39440,13 @@ export type V2ThreadStartResponse__ThreadItem =
39440
| {
39441
readonly failure?: V2ThreadStartResponse__ImageGenerationFailure | null;
39442
readonly id: string;
39419
- readonly result: string;
39443
+ readonly result?: string;
39444
readonly revisedPrompt?: string | null;
39445
readonly savedPath?: V2ThreadStartResponse__AbsolutePathBuf | null;
39446
readonly status: string;
39447
readonly transparentBackground?: boolean | null;
39448
readonly type: "imageGeneration";
39449
+ readonly fileId?: string;
39450
}
39451
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
39452
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -39720,7 +39745,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union(
39745
Schema.Union([V2ThreadStartResponse__ImageGenerationFailure, Schema.Null]),
39746
),
39747
id: Schema.String,
39723
- result: Schema.String,
39748
+ result: Schema.optionalKey(Schema.String),
39749
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
39750
savedPath: Schema.optionalKey(
39751
Schema.Union([V2ThreadStartResponse__AbsolutePathBuf, Schema.Null]),
@@ -39728,6 +39753,7 @@ export const V2ThreadStartResponse__ThreadItem = Schema.Union(
39753
status: Schema.String,
39754
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
39755
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
39756
+ fileId: Schema.optionalKey(Schema.String),
39757
}).annotate({ title: "ImageGenerationThreadItem" }),
39758
Schema.Struct({
39759
id: Schema.String,
@@ -39871,12 +39897,13 @@ export type V2ThreadTurnsListResponse__ThreadItem =
39897
| {
39898
readonly failure?: V2ThreadTurnsListResponse__ImageGenerationFailure | null;
39899
readonly id: string;
39874
- readonly result: string;
39900
+ readonly result?: string;
39901
readonly revisedPrompt?: string | null;
39902
readonly savedPath?: V2ThreadTurnsListResponse__AbsolutePathBuf | null;
39903
readonly status: string;
39904
readonly transparentBackground?: boolean | null;
39905
readonly type: "imageGeneration";
39906
+ readonly fileId?: string;
39907
}
39908
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
39909
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -40181,7 +40208,7 @@ export const V2ThreadTurnsListResponse__ThreadItem = Schema.Union(
40208
Schema.Union([V2ThreadTurnsListResponse__ImageGenerationFailure, Schema.Null]),
40209
),
40210
id: Schema.String,
40184
- result: Schema.String,
40211
+ result: Schema.optionalKey(Schema.String),
40212
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
40213
savedPath: Schema.optionalKey(
40214
Schema.Union([V2ThreadTurnsListResponse__AbsolutePathBuf, Schema.Null]),
@@ -40189,6 +40216,7 @@ export const V2ThreadTurnsListResponse__ThreadItem = Schema.Union(
40216
status: Schema.String,
40217
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
40218
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
40219
+ fileId: Schema.optionalKey(Schema.String),
40220
}).annotate({ title: "ImageGenerationThreadItem" }),
40221
Schema.Struct({
40222
id: Schema.String,
@@ -40332,12 +40360,13 @@ export type V2ThreadUnarchiveResponse__ThreadItem =
40360
| {
40361
readonly failure?: V2ThreadUnarchiveResponse__ImageGenerationFailure | null;
40362
readonly id: string;
40335
- readonly result: string;
40363
+ readonly result?: string;
40364
readonly revisedPrompt?: string | null;
40365
readonly savedPath?: V2ThreadUnarchiveResponse__AbsolutePathBuf | null;
40366
readonly status: string;
40367
readonly transparentBackground?: boolean | null;
40368
readonly type: "imageGeneration";
40369
+ readonly fileId?: string;
40370
}
40371
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
40372
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -40642,7 +40671,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union(
40671
Schema.Union([V2ThreadUnarchiveResponse__ImageGenerationFailure, Schema.Null]),
40672
),
40673
id: Schema.String,
40645
- result: Schema.String,
40674
+ result: Schema.optionalKey(Schema.String),
40675
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
40676
savedPath: Schema.optionalKey(
40677
Schema.Union([V2ThreadUnarchiveResponse__AbsolutePathBuf, Schema.Null]),
@@ -40650,6 +40679,7 @@ export const V2ThreadUnarchiveResponse__ThreadItem = Schema.Union(
40679
status: Schema.String,
40680
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
40681
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
40682
+ fileId: Schema.optionalKey(Schema.String),
40683
}).annotate({ title: "ImageGenerationThreadItem" }),
40684
Schema.Struct({
40685
id: Schema.String,
@@ -40795,12 +40825,13 @@ export type V2TurnCompletedNotification__ThreadItem =
40825
| {
40826
readonly failure?: V2TurnCompletedNotification__ImageGenerationFailure | null;
40827
readonly id: string;
40798
- readonly result: string;
40828
+ readonly result?: string;
40829
readonly revisedPrompt?: string | null;
40830
readonly savedPath?: V2TurnCompletedNotification__AbsolutePathBuf | null;
40831
readonly status: string;
40832
readonly transparentBackground?: boolean | null;
40833
readonly type: "imageGeneration";
40834
+ readonly fileId?: string;
40835
}
40836
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
40837
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -41105,7 +41136,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union(
41136
Schema.Union([V2TurnCompletedNotification__ImageGenerationFailure, Schema.Null]),
41137
),
41138
id: Schema.String,
41108
- result: Schema.String,
41139
+ result: Schema.optionalKey(Schema.String),
41140
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
41141
savedPath: Schema.optionalKey(
41142
Schema.Union([V2TurnCompletedNotification__AbsolutePathBuf, Schema.Null]),
@@ -41113,6 +41144,7 @@ export const V2TurnCompletedNotification__ThreadItem = Schema.Union(
41144
status: Schema.String,
41145
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
41146
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
41147
+ fileId: Schema.optionalKey(Schema.String),
41148
}).annotate({ title: "ImageGenerationThreadItem" }),
41149
Schema.Struct({
41150
id: Schema.String,
@@ -41256,12 +41288,13 @@ export type V2TurnStartedNotification__ThreadItem =
41288
| {
41289
readonly failure?: V2TurnStartedNotification__ImageGenerationFailure | null;
41290
readonly id: string;
41259
- readonly result: string;
41291
+ readonly result?: string;
41292
readonly revisedPrompt?: string | null;
41293
readonly savedPath?: V2TurnStartedNotification__AbsolutePathBuf | null;
41294
readonly status: string;
41295
readonly transparentBackground?: boolean | null;
41296
readonly type: "imageGeneration";
41297
+ readonly fileId?: string;
41298
}
41299
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
41300
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -41566,7 +41599,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union(
41599
Schema.Union([V2TurnStartedNotification__ImageGenerationFailure, Schema.Null]),
41600
),
41601
id: Schema.String,
41569
- result: Schema.String,
41602
+ result: Schema.optionalKey(Schema.String),
41603
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
41604
savedPath: Schema.optionalKey(
41605
Schema.Union([V2TurnStartedNotification__AbsolutePathBuf, Schema.Null]),
@@ -41574,6 +41607,7 @@ export const V2TurnStartedNotification__ThreadItem = Schema.Union(
41607
status: Schema.String,
41608
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
41609
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
41610
+ fileId: Schema.optionalKey(Schema.String),
41611
}).annotate({ title: "ImageGenerationThreadItem" }),
41612
Schema.Struct({
41613
id: Schema.String,
@@ -41728,12 +41762,13 @@ export type V2TurnStartResponse__ThreadItem =
41762
| {
41763
readonly failure?: V2TurnStartResponse__ImageGenerationFailure | null;
41764
readonly id: string;
41731
- readonly result: string;
41765
+ readonly result?: string;
41766
readonly revisedPrompt?: string | null;
41767
readonly savedPath?: V2TurnStartResponse__AbsolutePathBuf | null;
41768
readonly status: string;
41769
readonly transparentBackground?: boolean | null;
41770
readonly type: "imageGeneration";
41771
+ readonly fileId?: string;
41772
}
41773
| { readonly id: string; readonly review: string; readonly type: "enteredReviewMode" }
41774
| { readonly id: string; readonly review: string; readonly type: "exitedReviewMode" }
@@ -42028,7 +42063,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union(
42063
Schema.Union([V2TurnStartResponse__ImageGenerationFailure, Schema.Null]),
42064
),
42065
id: Schema.String,
42031
- result: Schema.String,
42066
+ result: Schema.optionalKey(Schema.String),
42067
revisedPrompt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
42068
savedPath: Schema.optionalKey(
42069
Schema.Union([V2TurnStartResponse__AbsolutePathBuf, Schema.Null]),
@@ -42036,6 +42071,7 @@ export const V2TurnStartResponse__ThreadItem = Schema.Union(
42071
status: Schema.String,
42072
transparentBackground: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
42073
type: Schema.Literal("imageGeneration").annotate({ title: "ImageGenerationThreadItemType" }),
42074
+ fileId: Schema.optionalKey(Schema.String),
42075
}).annotate({ title: "ImageGenerationThreadItem" }),
42076
Schema.Struct({
42077
id: Schema.String,
packages/effect-codex-app-server/src/schema.test.ts
+22
@@ -35,6 +35,28 @@ it("keeps async questions in live notifications and thread history", () => {
35
}
36
});
37
38
+it("accepts generated images identified by fileId without inline result", () => {
39
+ const item = {
40
+ type: "imageGeneration",
41
+ id: "image-1",
42
+ status: "completed",
43
+ fileId: "file-1",
44
+ savedPath: "/tmp/generated.png",
45
+ revisedPrompt: null,
46
+ } as const;
47
+ for (const schema of [
48
+ CodexSchema.ServerNotification__ThreadItem,
49
+ CodexSchema.V2ItemStartedNotification__ThreadItem,
50
+ CodexSchema.V2ItemCompletedNotification__ThreadItem,
51
+ CodexSchema.V2ThreadReadResponse__ThreadItem,
52
+ CodexSchema.V2ThreadResumeResponse__ThreadItem,
53
+ CodexSchema.V2ThreadForkResponse__ThreadItem,
54
+ CodexSchema.V2TurnCompletedNotification__ThreadItem,
55
+ ]) {
56
+ assert.deepEqual(Schema.decodeSync(schema)(item), item);
57
+ }
58
+});
59
+
60
it("keeps partial answers in notifications and persisted thread histories", () => {
61
const item = {
62
type: "agentMessage",