@@ -829,16 +829,19 @@ func (r MessageRole) IsKnown() bool {
829
829
}
830
830
831
831
type Part struct {
832
- ID string `json:"id,required"`
833
- MessageID string `json:"messageID,required"`
834
- SessionID string `json:"sessionID,required"`
835
- Type PartType `json:"type,required"`
836
- CallID string `json:"callID"`
837
- Cost float64 `json:"cost"`
838
- Filename string `json:"filename"`
839
- Mime string `json:"mime"`
840
- Snapshot string `json:"snapshot"`
841
- Source FilePartSource `json:"source"`
832
+ ID string `json:"id,required"`
833
+ MessageID string `json:"messageID,required"`
834
+ SessionID string `json:"sessionID,required"`
835
+ Type PartType `json:"type,required"`
836
+ CallID string `json:"callID"`
837
+ Cost float64 `json:"cost"`
838
+ Filename string `json:"filename"`
839
+ // This field can have the runtime type of [[]string].
840
+ Files interface {} `json:"files"`
841
+ Hash string `json:"hash"`
842
+ Mime string `json:"mime"`
843
+ Snapshot string `json:"snapshot"`
844
+ Source FilePartSource `json:"source"`
842
845
// This field can have the runtime type of [ToolPartState].
843
846
State interface {} `json:"state"`
844
847
Synthetic bool `json:"synthetic"`
@@ -862,6 +865,8 @@ type partJSON struct {
862
865
CallID apijson.Field
863
866
Cost apijson.Field
864
867
Filename apijson.Field
868
+ Files apijson.Field
869
+ Hash apijson.Field
865
870
Mime apijson.Field
866
871
Snapshot apijson.Field
867
872
Source apijson.Field
@@ -893,13 +898,13 @@ func (r *Part) UnmarshalJSON(data []byte) (err error) {
893
898
// for more type safety.
894
899
//
895
900
// Possible runtime types of the union are [TextPart], [FilePart], [ToolPart],
896
- // [StepStartPart], [StepFinishPart], [SnapshotPart].
901
+ // [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart] .
897
902
func (r Part ) AsUnion () PartUnion {
898
903
return r .union
899
904
}
900
905
901
906
// Union satisfied by [TextPart], [FilePart], [ToolPart], [StepStartPart],
902
- // [StepFinishPart] or [SnapshotPart ].
907
+ // [StepFinishPart], [SnapshotPart] or [PartPatchPart ].
903
908
type PartUnion interface {
904
909
implementsPart ()
905
910
}
@@ -938,9 +943,60 @@ func init() {
938
943
Type : reflect .TypeOf (SnapshotPart {}),
939
944
DiscriminatorValue : "snapshot" ,
940
945
},
946
+ apijson.UnionVariant {
947
+ TypeFilter : gjson .JSON ,
948
+ Type : reflect .TypeOf (PartPatchPart {}),
949
+ DiscriminatorValue : "patch" ,
950
+ },
941
951
)
942
952
}
943
953
954
+ type PartPatchPart struct {
955
+ ID string `json:"id,required"`
956
+ Files []string `json:"files,required"`
957
+ Hash string `json:"hash,required"`
958
+ MessageID string `json:"messageID,required"`
959
+ SessionID string `json:"sessionID,required"`
960
+ Type PartPatchPartType `json:"type,required"`
961
+ JSON partPatchPartJSON `json:"-"`
962
+ }
963
+
964
+ // partPatchPartJSON contains the JSON metadata for the struct [PartPatchPart]
965
+ type partPatchPartJSON struct {
966
+ ID apijson.Field
967
+ Files apijson.Field
968
+ Hash apijson.Field
969
+ MessageID apijson.Field
970
+ SessionID apijson.Field
971
+ Type apijson.Field
972
+ raw string
973
+ ExtraFields map [string ]apijson.Field
974
+ }
975
+
976
+ func (r * PartPatchPart ) UnmarshalJSON (data []byte ) (err error ) {
977
+ return apijson .UnmarshalRoot (data , r )
978
+ }
979
+
980
+ func (r partPatchPartJSON ) RawJSON () string {
981
+ return r .raw
982
+ }
983
+
984
+ func (r PartPatchPart ) implementsPart () {}
985
+
986
+ type PartPatchPartType string
987
+
988
+ const (
989
+ PartPatchPartTypePatch PartPatchPartType = "patch"
990
+ )
991
+
992
+ func (r PartPatchPartType ) IsKnown () bool {
993
+ switch r {
994
+ case PartPatchPartTypePatch :
995
+ return true
996
+ }
997
+ return false
998
+ }
999
+
944
1000
type PartType string
945
1001
946
1002
const (
@@ -950,11 +1006,12 @@ const (
950
1006
PartTypeStepStart PartType = "step-start"
951
1007
PartTypeStepFinish PartType = "step-finish"
952
1008
PartTypeSnapshot PartType = "snapshot"
1009
+ PartTypePatch PartType = "patch"
953
1010
)
954
1011
955
1012
func (r PartType ) IsKnown () bool {
956
1013
switch r {
957
- case PartTypeText , PartTypeFile , PartTypeTool , PartTypeStepStart , PartTypeStepFinish , PartTypeSnapshot :
1014
+ case PartTypeText , PartTypeFile , PartTypeTool , PartTypeStepStart , PartTypeStepFinish , PartTypeSnapshot , PartTypePatch :
958
1015
return true
959
1016
}
960
1017
return false
0 commit comments