From a98d08e9f371618671fefd8492b7663e1fa19c26 Mon Sep 17 00:00:00 2001 From: "ark-hand[bot]" Date: Tue, 29 Sep 2026 02:29:03 +0000 Subject: [PATCH] chore: update Messages and Responses with internal runtime helpers Hand-written change from the internal SDK repository. The original commit message is intentionally not mirrored; see the source repository for details. Sync-Source-Commit: 0e1b142f6cc8713005613f0531a64ea98e65d0a5 Hand-Written-Reason: No Ark-APIs provenance marker; treated as a hand-written source commit. Release-Version: 0.9.0 --- arkruntime/internal/ogenjson/time.go | 29 ++ arkruntime/internal/ogenjson/time_test.go | 47 +++ arkruntime/internal/ogenregex/convert.go | 1 - arkruntime/internal/ogenregex/ogenregex.go | 1 - arkruntime/internal/validate/README.md | 29 -- arkruntime/internal/validate/array.go | 1 - .../internal/validate/constraints_errors.go | 1 - arkruntime/internal/validate/float.go | 1 - arkruntime/internal/validate/int.go | 1 - arkruntime/internal/validate/object.go | 62 ++++ arkruntime/internal/validate/object_test.go | 32 ++ arkruntime/internal/validate/string.go | 1 - arkruntime/model/messages/oas_json_gen.go | 117 +++++- arkruntime/model/messages/oas_schemas_gen.go | 94 +++++ arkruntime/model/responses/oas_json_gen.go | 291 ++++++++++++++- arkruntime/model/responses/oas_schemas_gen.go | 350 ++++++++++++++++++ 16 files changed, 1008 insertions(+), 50 deletions(-) create mode 100644 arkruntime/internal/ogenjson/time.go create mode 100644 arkruntime/internal/ogenjson/time_test.go delete mode 100644 arkruntime/internal/validate/README.md create mode 100644 arkruntime/internal/validate/object.go create mode 100644 arkruntime/internal/validate/object_test.go diff --git a/arkruntime/internal/ogenjson/time.go b/arkruntime/internal/ogenjson/time.go new file mode 100644 index 0000000..0a1d042 --- /dev/null +++ b/arkruntime/internal/ogenjson/time.go @@ -0,0 +1,29 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +// Package json provides the ogen date-time codecs used by generated models +// without importing the ogen module (whose Go floor exceeds this SDK's). +package json + +import ( + "time" + + "github.com/go-faster/jx" +) + +// DecodeDateTime decodes an RFC3339 string, preserving fractional seconds and +// offsets accepted by time.Parse, matching ogen v1.20.3. +func DecodeDateTime(d *jx.Decoder) (time.Time, error) { + s, err := d.Str() + if err != nil { + return time.Time{}, err + } + return time.Parse(time.RFC3339, s) +} + +// EncodeDateTime uses RFC3339, intentionally omitting fractional seconds like +// ogen v1.20.3. Use of RFC3339Nano would change the generated wire format. +func EncodeDateTime(e *jx.Encoder, v time.Time) { + var buf [64]byte + e.ByteStr(v.AppendFormat(buf[:0], time.RFC3339)) +} diff --git a/arkruntime/internal/ogenjson/time_test.go b/arkruntime/internal/ogenjson/time_test.go new file mode 100644 index 0000000..83e8ff5 --- /dev/null +++ b/arkruntime/internal/ogenjson/time_test.go @@ -0,0 +1,47 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +package json + +import ( + "testing" + "time" + + "github.com/go-faster/jx" +) + +func TestDateTimeWireFormat(t *testing.T) { + for _, tc := range []struct{ input, output string }{ + {`"2026-09-28T10:20:30Z"`, `"2026-09-28T10:20:30Z"`}, + {`"2026-09-28T10:20:30.123456789+08:00"`, `"2026-09-28T10:20:30+08:00"`}, + {`"2026-09-28T10:20:30-05:30"`, `"2026-09-28T10:20:30-05:30"`}, + {`"0001-01-01T00:00:00Z"`, `"0001-01-01T00:00:00Z"`}, + } { + t.Run(tc.input, func(t *testing.T) { + got, err := DecodeDateTime(jx.DecodeStr(tc.input)) + if err != nil { + t.Fatal(err) + } + want, err := time.Parse(time.RFC3339, tc.input[1:len(tc.input)-1]) + if err != nil || !got.Equal(want) || got.Nanosecond() != want.Nanosecond() { + t.Fatalf("decoded %v, want %v: %v", got, want, err) + } + e := jx.GetEncoder() + defer jx.PutEncoder(e) + EncodeDateTime(e, got) + if e.String() != tc.output { + t.Fatalf("encoded %s, want %s", e.String(), tc.output) + } + }) + } +} + +func TestDateTimeRejectsInvalidValues(t *testing.T) { + for _, input := range []string{`null`, `123`, `{}`, `[]`, `""`, `"2026-09-28"`, `"2026-02-30T10:20:30Z"`, `"2026-09-28T10:20:30"`, `"unterminated`} { + t.Run(input, func(t *testing.T) { + if _, err := DecodeDateTime(jx.DecodeStr(input)); err == nil { + t.Fatal("expected decode error") + } + }) + } +} diff --git a/arkruntime/internal/ogenregex/convert.go b/arkruntime/internal/ogenregex/convert.go index 4f99dc3..0afbf01 100644 --- a/arkruntime/internal/ogenregex/convert.go +++ b/arkruntime/internal/ogenregex/convert.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See ../validate/README.md for provenance. package ogenregex diff --git a/arkruntime/internal/ogenregex/ogenregex.go b/arkruntime/internal/ogenregex/ogenregex.go index 5b39004..3c59283 100644 --- a/arkruntime/internal/ogenregex/ogenregex.go +++ b/arkruntime/internal/ogenregex/ogenregex.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See ../validate/README.md for provenance. // Package ogenregex provides an interface to the regex engine. // diff --git a/arkruntime/internal/validate/README.md b/arkruntime/internal/validate/README.md deleted file mode 100644 index 66493e4..0000000 --- a/arkruntime/internal/validate/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Generated-model validation compatibility - -This package mirrors the validator interfaces emitted by ogen v1.20.3. The -String, Int, Float, Array and constraint error implementations are adapted from -[ogen's Apache-2.0 sources](https://github.com/ogen-go/ogen/tree/v1.20.3/validate). -The original error aggregation and sentinel shim remains in `validate.go`. -Do not replace configured validators with no-op stubs: current schemas set real -bounds, string/array lengths, and patterns. - -`../ogenregex` implements the emitted regex interface using the same regexp2 -ECMAScript/Unicode fallback mode and 15-second timeout as ogen v1.20.3. It also preserves ogen's RE2 conversion fast path, including ECMAScript -Unicode whitespace and line-terminator semantics. The conversion code retains -its goja attribution; the upstream MIT notice is in `../ogenregex/GOJA_LICENSE`. The SDK depends on regexp2 -v1.11.5 and x/text v0.14.0, not the full ogen module, and keeps Go 1.20. - -Ark-apis `vendor-` rewrites both ogen `validate` and `ogenregex` imports to -these internal packages. Their files are outside the generated `model/` -directories and survive sync. Hand-written model codec tests end in -`_shim_test.go` and are also preserved by the vendor rule. Merge the SDK fix so -subsequent sync branches based on main inherit it; an unmerged branch is not the -source for later syncs. - -After any schema/generator/vendor change, run `go build ./...`, `go test ./...` -and `go vet ./...` against the **vendored SDK**, including with Go 1.20. -The package tests cover validator bounds and regex behavior independently of -generated models. Add model-constraint and recursive JSON codec regressions -alongside the corresponding generated-model sync. -Generated `gen/go` tests using the upstream ogen library alone cannot detect -an incomplete shim. New emitted symbols still require a compatibility review. diff --git a/arkruntime/internal/validate/array.go b/arkruntime/internal/validate/array.go index ce75ac8..b7ff8a9 100644 --- a/arkruntime/internal/validate/array.go +++ b/arkruntime/internal/validate/array.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See README.md for provenance and compatibility scope. package validate diff --git a/arkruntime/internal/validate/constraints_errors.go b/arkruntime/internal/validate/constraints_errors.go index d353487..327c16d 100644 --- a/arkruntime/internal/validate/constraints_errors.go +++ b/arkruntime/internal/validate/constraints_errors.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See README.md for provenance and compatibility scope. package validate diff --git a/arkruntime/internal/validate/float.go b/arkruntime/internal/validate/float.go index a1aa0f0..de96301 100644 --- a/arkruntime/internal/validate/float.go +++ b/arkruntime/internal/validate/float.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See README.md for provenance and compatibility scope. package validate diff --git a/arkruntime/internal/validate/int.go b/arkruntime/internal/validate/int.go index bb54f1b..d3e1458 100644 --- a/arkruntime/internal/validate/int.go +++ b/arkruntime/internal/validate/int.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See README.md for provenance and compatibility scope. package validate diff --git a/arkruntime/internal/validate/object.go b/arkruntime/internal/validate/object.go new file mode 100644 index 0000000..51c142f --- /dev/null +++ b/arkruntime/internal/validate/object.go @@ -0,0 +1,62 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 +// +// Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). + +package validate + +import "github.com/go-faster/errors" + +// Object validates map length. +type Object struct { + MinProperties int + MinPropertiesSet bool + MaxProperties int + MaxPropertiesSet bool + // TODO: add validate to gen + MinLength int + MinLengthSet bool + MaxLength int + MaxLengthSet bool +} + +// SetMinProperties sets MinProperties validation. +func (o *Object) SetMinProperties(v int) { + o.MinPropertiesSet = true + o.MinProperties = v +} + +// SetMaxProperties sets MaxProperties validation. +func (o *Object) SetMaxProperties(v int) { + o.MaxPropertiesSet = true + o.MaxProperties = v +} + +// SetMinLength sets MinLength validation. +func (o *Object) SetMinLength(v int) { + o.MinLengthSet = true + o.MinLength = v +} + +// SetMaxLength sets MaxLength validation. +func (o *Object) SetMaxLength(v int) { + o.MaxLengthSet = true + o.MaxLength = v +} + +// Set reports whether any validations are set. +func (o Object) Set() bool { + return o.MaxPropertiesSet || o.MinPropertiesSet +} + +// ValidateProperties returns error if object length (properties number) v is invalid. +func (o Object) ValidateProperties(v int) error { + if o.MaxPropertiesSet && v > o.MaxProperties { + return errors.Errorf("object properties number %d greater than maximum %d", v, o.MaxProperties) + } + if o.MinPropertiesSet && v < o.MinProperties { + return errors.Errorf("object properties number %d less than minimum %d", v, o.MinProperties) + } + + return nil +} diff --git a/arkruntime/internal/validate/object_test.go b/arkruntime/internal/validate/object_test.go new file mode 100644 index 0000000..4991868 --- /dev/null +++ b/arkruntime/internal/validate/object_test.go @@ -0,0 +1,32 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 +package validate + +import "testing" + +func TestObjectPropertyBounds(t *testing.T) { + var v Object + if v.Set() || v.ValidateProperties(100) != nil { + t.Fatal("unset object should be unconstrained") + } + v.SetMinProperties(1) + v.SetMaxProperties(16) + if !v.Set() { + t.Fatal("bounds not set") + } + for _, n := range []int{1, 16} { + if err := v.ValidateProperties(n); err != nil { + t.Fatal(err) + } + } + for _, n := range []int{0, 17} { + if v.ValidateProperties(n) == nil { + t.Fatalf("accepted %d properties", n) + } + } + v.SetMaxProperties(0) + v.MinPropertiesSet = false + if v.ValidateProperties(0) != nil || v.ValidateProperties(1) == nil { + t.Fatal("zero maximum must be enforced") + } +} diff --git a/arkruntime/internal/validate/string.go b/arkruntime/internal/validate/string.go index e164677..e5ce360 100644 --- a/arkruntime/internal/validate/string.go +++ b/arkruntime/internal/validate/string.go @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // // Adapted from github.com/ogen-go/ogen v1.20.3 (Apache-2.0). -// See README.md for provenance and compatibility scope. package validate diff --git a/arkruntime/model/messages/oas_json_gen.go b/arkruntime/model/messages/oas_json_gen.go index 8379e2a..70c807e 100644 --- a/arkruntime/model/messages/oas_json_gen.go +++ b/arkruntime/model/messages/oas_json_gen.go @@ -8,6 +8,7 @@ package messages import ( "math/bits" "strconv" + "strings" "github.com/go-faster/errors" "github.com/go-faster/jx" @@ -439,6 +440,13 @@ func (s ContentBlockStartContentBlockSum) Encode(e *jx.Encoder) { } func (s ContentBlockStartContentBlockSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ContentBlockStartContentBlockTextContentBlockStartContentBlockSum: e.FieldStart("type") @@ -548,6 +556,16 @@ func (s *ContentBlockStartContentBlockSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -578,7 +596,11 @@ func (s *ContentBlockStartContentBlockSum) Decode(d *jx.Decoder) error { s.Type = ContentBlockStartContentBlockWebSearchToolResultContentBlockStartContentBlockSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -587,6 +609,12 @@ func (s *ContentBlockStartContentBlockSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = ContentBlockStartContentBlockSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -8267,6 +8295,13 @@ func (s MessagesResponseContentBlockDeltaSum) Encode(e *jx.Encoder) { } func (s MessagesResponseContentBlockDeltaSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case MessagesResponseContentBlockDeltaTextMessagesResponseContentBlockDeltaSum: e.FieldStart("type") @@ -8320,6 +8355,16 @@ func (s *MessagesResponseContentBlockDeltaSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -8347,7 +8392,11 @@ func (s *MessagesResponseContentBlockDeltaSum) Decode(d *jx.Decoder) error { s.Type = MessagesResponseContentBlockDeltaToolUseMessagesResponseContentBlockDeltaSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -8356,6 +8405,12 @@ func (s *MessagesResponseContentBlockDeltaSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = MessagesResponseContentBlockDeltaSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -9326,6 +9381,13 @@ func (s MessagesResponseContentPartSum) Encode(e *jx.Encoder) { } func (s MessagesResponseContentPartSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case MessagesResponseContentPartTextMessagesResponseContentPartSum: e.FieldStart("type") @@ -9421,6 +9483,16 @@ func (s *MessagesResponseContentPartSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -9451,7 +9523,11 @@ func (s *MessagesResponseContentPartSum) Decode(d *jx.Decoder) error { s.Type = MessagesResponseContentPartWebSearchToolResultMessagesResponseContentPartSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -9460,6 +9536,12 @@ func (s *MessagesResponseContentPartSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = MessagesResponseContentPartSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -11665,6 +11747,13 @@ func (s MessagesStreamEventSum) Encode(e *jx.Encoder) { } func (s MessagesStreamEventSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case MessagesResponseStreamMessageStartMessagesStreamEventSum: e.FieldStart("type") @@ -11753,6 +11842,16 @@ func (s *MessagesStreamEventSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -11789,7 +11888,11 @@ func (s *MessagesStreamEventSum) Decode(d *jx.Decoder) error { s.Type = MessagesErrorResponseMessagesStreamEventSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -11798,6 +11901,12 @@ func (s *MessagesStreamEventSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = MessagesStreamEventSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } diff --git a/arkruntime/model/messages/oas_schemas_gen.go b/arkruntime/model/messages/oas_schemas_gen.go index fa949ea..400c702 100644 --- a/arkruntime/model/messages/oas_schemas_gen.go +++ b/arkruntime/model/messages/oas_schemas_gen.go @@ -157,6 +157,9 @@ func (s *ContentBlockStartContentBlockServerToolUseType) UnmarshalText(data []by // ContentBlockStartContentBlockSum represents sum type. type ContentBlockStartContentBlockSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type ContentBlockStartContentBlockSumType // switch on this field ContentBlockStartContentBlockText ContentBlockStartContentBlockText ContentBlockStartContentBlockThinking ContentBlockStartContentBlockThinking @@ -165,6 +168,16 @@ type ContentBlockStartContentBlockSum struct { ContentBlockStartContentBlockWebSearchToolResult ContentBlockStartContentBlockWebSearchToolResult } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s ContentBlockStartContentBlockSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // ContentBlockStartContentBlockSumType is oneOf type of ContentBlockStartContentBlockSum. type ContentBlockStartContentBlockSumType string @@ -205,6 +218,8 @@ func (s ContentBlockStartContentBlockSum) IsContentBlockStartContentBlockWebSear // SetContentBlockStartContentBlockText sets ContentBlockStartContentBlockSum to ContentBlockStartContentBlockText. func (s *ContentBlockStartContentBlockSum) SetContentBlockStartContentBlockText(v ContentBlockStartContentBlockText) { s.Type = ContentBlockStartContentBlockTextContentBlockStartContentBlockSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStartContentBlockText = v } @@ -226,6 +241,8 @@ func NewContentBlockStartContentBlockTextContentBlockStartContentBlockSum(v Cont // SetContentBlockStartContentBlockThinking sets ContentBlockStartContentBlockSum to ContentBlockStartContentBlockThinking. func (s *ContentBlockStartContentBlockSum) SetContentBlockStartContentBlockThinking(v ContentBlockStartContentBlockThinking) { s.Type = ContentBlockStartContentBlockThinkingContentBlockStartContentBlockSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStartContentBlockThinking = v } @@ -247,6 +264,8 @@ func NewContentBlockStartContentBlockThinkingContentBlockStartContentBlockSum(v // SetContentBlockStartContentBlockToolUse sets ContentBlockStartContentBlockSum to ContentBlockStartContentBlockToolUse. func (s *ContentBlockStartContentBlockSum) SetContentBlockStartContentBlockToolUse(v ContentBlockStartContentBlockToolUse) { s.Type = ContentBlockStartContentBlockToolUseContentBlockStartContentBlockSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStartContentBlockToolUse = v } @@ -268,6 +287,8 @@ func NewContentBlockStartContentBlockToolUseContentBlockStartContentBlockSum(v C // SetContentBlockStartContentBlockServerToolUse sets ContentBlockStartContentBlockSum to ContentBlockStartContentBlockServerToolUse. func (s *ContentBlockStartContentBlockSum) SetContentBlockStartContentBlockServerToolUse(v ContentBlockStartContentBlockServerToolUse) { s.Type = ContentBlockStartContentBlockServerToolUseContentBlockStartContentBlockSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStartContentBlockServerToolUse = v } @@ -289,6 +310,8 @@ func NewContentBlockStartContentBlockServerToolUseContentBlockStartContentBlockS // SetContentBlockStartContentBlockWebSearchToolResult sets ContentBlockStartContentBlockSum to ContentBlockStartContentBlockWebSearchToolResult. func (s *ContentBlockStartContentBlockSum) SetContentBlockStartContentBlockWebSearchToolResult(v ContentBlockStartContentBlockWebSearchToolResult) { s.Type = ContentBlockStartContentBlockWebSearchToolResultContentBlockStartContentBlockSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStartContentBlockWebSearchToolResult = v } @@ -3848,6 +3871,9 @@ func (s *MessagesResponseContentBlockDeltaSignatureType) UnmarshalText(data []by // MessagesResponseContentBlockDeltaSum represents sum type. type MessagesResponseContentBlockDeltaSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type MessagesResponseContentBlockDeltaSumType // switch on this field MessagesResponseContentBlockDeltaText MessagesResponseContentBlockDeltaText MessagesResponseContentBlockDeltaThinking MessagesResponseContentBlockDeltaThinking @@ -3855,6 +3881,16 @@ type MessagesResponseContentBlockDeltaSum struct { MessagesResponseContentBlockDeltaToolUse MessagesResponseContentBlockDeltaToolUse } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s MessagesResponseContentBlockDeltaSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // MessagesResponseContentBlockDeltaSumType is oneOf type of MessagesResponseContentBlockDeltaSum. type MessagesResponseContentBlockDeltaSumType string @@ -3889,6 +3925,8 @@ func (s MessagesResponseContentBlockDeltaSum) IsMessagesResponseContentBlockDelt // SetMessagesResponseContentBlockDeltaText sets MessagesResponseContentBlockDeltaSum to MessagesResponseContentBlockDeltaText. func (s *MessagesResponseContentBlockDeltaSum) SetMessagesResponseContentBlockDeltaText(v MessagesResponseContentBlockDeltaText) { s.Type = MessagesResponseContentBlockDeltaTextMessagesResponseContentBlockDeltaSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlockDeltaText = v } @@ -3910,6 +3948,8 @@ func NewMessagesResponseContentBlockDeltaTextMessagesResponseContentBlockDeltaSu // SetMessagesResponseContentBlockDeltaThinking sets MessagesResponseContentBlockDeltaSum to MessagesResponseContentBlockDeltaThinking. func (s *MessagesResponseContentBlockDeltaSum) SetMessagesResponseContentBlockDeltaThinking(v MessagesResponseContentBlockDeltaThinking) { s.Type = MessagesResponseContentBlockDeltaThinkingMessagesResponseContentBlockDeltaSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlockDeltaThinking = v } @@ -3931,6 +3971,8 @@ func NewMessagesResponseContentBlockDeltaThinkingMessagesResponseContentBlockDel // SetMessagesResponseContentBlockDeltaSignature sets MessagesResponseContentBlockDeltaSum to MessagesResponseContentBlockDeltaSignature. func (s *MessagesResponseContentBlockDeltaSum) SetMessagesResponseContentBlockDeltaSignature(v MessagesResponseContentBlockDeltaSignature) { s.Type = MessagesResponseContentBlockDeltaSignatureMessagesResponseContentBlockDeltaSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlockDeltaSignature = v } @@ -3952,6 +3994,8 @@ func NewMessagesResponseContentBlockDeltaSignatureMessagesResponseContentBlockDe // SetMessagesResponseContentBlockDeltaToolUse sets MessagesResponseContentBlockDeltaSum to MessagesResponseContentBlockDeltaToolUse. func (s *MessagesResponseContentBlockDeltaSum) SetMessagesResponseContentBlockDeltaToolUse(v MessagesResponseContentBlockDeltaToolUse) { s.Type = MessagesResponseContentBlockDeltaToolUseMessagesResponseContentBlockDeltaSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlockDeltaToolUse = v } @@ -4354,6 +4398,9 @@ func (s *MessagesResponseContentPartServerToolUseType) UnmarshalText(data []byte // MessagesResponseContentPartSum represents sum type. type MessagesResponseContentPartSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type MessagesResponseContentPartSumType // switch on this field MessagesResponseContentPartText MessagesResponseContentPartText MessagesResponseContentPartThinking MessagesResponseContentPartThinking @@ -4362,6 +4409,16 @@ type MessagesResponseContentPartSum struct { MessagesResponseContentPartWebSearchToolResult MessagesResponseContentPartWebSearchToolResult } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s MessagesResponseContentPartSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // MessagesResponseContentPartSumType is oneOf type of MessagesResponseContentPartSum. type MessagesResponseContentPartSumType string @@ -4402,6 +4459,8 @@ func (s MessagesResponseContentPartSum) IsMessagesResponseContentPartWebSearchTo // SetMessagesResponseContentPartText sets MessagesResponseContentPartSum to MessagesResponseContentPartText. func (s *MessagesResponseContentPartSum) SetMessagesResponseContentPartText(v MessagesResponseContentPartText) { s.Type = MessagesResponseContentPartTextMessagesResponseContentPartSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentPartText = v } @@ -4423,6 +4482,8 @@ func NewMessagesResponseContentPartTextMessagesResponseContentPartSum(v Messages // SetMessagesResponseContentPartThinking sets MessagesResponseContentPartSum to MessagesResponseContentPartThinking. func (s *MessagesResponseContentPartSum) SetMessagesResponseContentPartThinking(v MessagesResponseContentPartThinking) { s.Type = MessagesResponseContentPartThinkingMessagesResponseContentPartSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentPartThinking = v } @@ -4444,6 +4505,8 @@ func NewMessagesResponseContentPartThinkingMessagesResponseContentPartSum(v Mess // SetMessagesResponseContentPartToolUse sets MessagesResponseContentPartSum to MessagesResponseContentPartToolUse. func (s *MessagesResponseContentPartSum) SetMessagesResponseContentPartToolUse(v MessagesResponseContentPartToolUse) { s.Type = MessagesResponseContentPartToolUseMessagesResponseContentPartSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentPartToolUse = v } @@ -4465,6 +4528,8 @@ func NewMessagesResponseContentPartToolUseMessagesResponseContentPartSum(v Messa // SetMessagesResponseContentPartServerToolUse sets MessagesResponseContentPartSum to MessagesResponseContentPartServerToolUse. func (s *MessagesResponseContentPartSum) SetMessagesResponseContentPartServerToolUse(v MessagesResponseContentPartServerToolUse) { s.Type = MessagesResponseContentPartServerToolUseMessagesResponseContentPartSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentPartServerToolUse = v } @@ -4486,6 +4551,8 @@ func NewMessagesResponseContentPartServerToolUseMessagesResponseContentPartSum(v // SetMessagesResponseContentPartWebSearchToolResult sets MessagesResponseContentPartSum to MessagesResponseContentPartWebSearchToolResult. func (s *MessagesResponseContentPartSum) SetMessagesResponseContentPartWebSearchToolResult(v MessagesResponseContentPartWebSearchToolResult) { s.Type = MessagesResponseContentPartWebSearchToolResultMessagesResponseContentPartSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentPartWebSearchToolResult = v } @@ -5504,6 +5571,9 @@ func (*MessagesStreamEvent) messagesCreateRes() {} // MessagesStreamEventSum represents sum type. type MessagesStreamEventSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type MessagesStreamEventSumType // switch on this field MessagesResponseStreamMessageStart MessagesResponseStreamMessageStart ContentBlockStart ContentBlockStart @@ -5514,6 +5584,16 @@ type MessagesStreamEventSum struct { MessagesErrorResponse MessagesErrorResponse } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s MessagesStreamEventSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // MessagesStreamEventSumType is oneOf type of MessagesStreamEventSum. type MessagesStreamEventSumType string @@ -5566,6 +5646,8 @@ func (s MessagesStreamEventSum) IsMessagesErrorResponse() bool { // SetMessagesResponseStreamMessageStart sets MessagesStreamEventSum to MessagesResponseStreamMessageStart. func (s *MessagesStreamEventSum) SetMessagesResponseStreamMessageStart(v MessagesResponseStreamMessageStart) { s.Type = MessagesResponseStreamMessageStartMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseStreamMessageStart = v } @@ -5587,6 +5669,8 @@ func NewMessagesResponseStreamMessageStartMessagesStreamEventSum(v MessagesRespo // SetContentBlockStart sets MessagesStreamEventSum to ContentBlockStart. func (s *MessagesStreamEventSum) SetContentBlockStart(v ContentBlockStart) { s.Type = ContentBlockStartMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ContentBlockStart = v } @@ -5608,6 +5692,8 @@ func NewContentBlockStartMessagesStreamEventSum(v ContentBlockStart) MessagesStr // SetMessagesResponseContentBlock sets MessagesStreamEventSum to MessagesResponseContentBlock. func (s *MessagesStreamEventSum) SetMessagesResponseContentBlock(v MessagesResponseContentBlock) { s.Type = MessagesResponseContentBlockMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlock = v } @@ -5629,6 +5715,8 @@ func NewMessagesResponseContentBlockMessagesStreamEventSum(v MessagesResponseCon // SetMessagesResponseContentBlockStop sets MessagesStreamEventSum to MessagesResponseContentBlockStop. func (s *MessagesStreamEventSum) SetMessagesResponseContentBlockStop(v MessagesResponseContentBlockStop) { s.Type = MessagesResponseContentBlockStopMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseContentBlockStop = v } @@ -5650,6 +5738,8 @@ func NewMessagesResponseContentBlockStopMessagesStreamEventSum(v MessagesRespons // SetMessagesResponseStreamMessageDelta sets MessagesStreamEventSum to MessagesResponseStreamMessageDelta. func (s *MessagesStreamEventSum) SetMessagesResponseStreamMessageDelta(v MessagesResponseStreamMessageDelta) { s.Type = MessagesResponseStreamMessageDeltaMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseStreamMessageDelta = v } @@ -5671,6 +5761,8 @@ func NewMessagesResponseStreamMessageDeltaMessagesStreamEventSum(v MessagesRespo // SetMessagesResponseStreamMessageStop sets MessagesStreamEventSum to MessagesResponseStreamMessageStop. func (s *MessagesStreamEventSum) SetMessagesResponseStreamMessageStop(v MessagesResponseStreamMessageStop) { s.Type = MessagesResponseStreamMessageStopMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesResponseStreamMessageStop = v } @@ -5692,6 +5784,8 @@ func NewMessagesResponseStreamMessageStopMessagesStreamEventSum(v MessagesRespon // SetMessagesErrorResponse sets MessagesStreamEventSum to MessagesErrorResponse. func (s *MessagesStreamEventSum) SetMessagesErrorResponse(v MessagesErrorResponse) { s.Type = MessagesErrorResponseMessagesStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.MessagesErrorResponse = v } diff --git a/arkruntime/model/responses/oas_json_gen.go b/arkruntime/model/responses/oas_json_gen.go index 7717901..d829496 100644 --- a/arkruntime/model/responses/oas_json_gen.go +++ b/arkruntime/model/responses/oas_json_gen.go @@ -8,6 +8,7 @@ package responses import ( "math/bits" "strconv" + "strings" "github.com/go-faster/errors" "github.com/go-faster/jx" @@ -72,6 +73,13 @@ func (s AnnotationSum) Encode(e *jx.Encoder) { } func (s AnnotationSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case UrlCitationAnnotationSum: e.FieldStart("type") @@ -175,6 +183,16 @@ func (s *AnnotationSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -196,7 +214,11 @@ func (s *AnnotationSum) Decode(d *jx.Decoder) error { s.Type = DocCitationAnnotationSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -205,6 +227,12 @@ func (s *AnnotationSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = AnnotationSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -294,6 +322,13 @@ func (s AppliedEditSum) Encode(e *jx.Encoder) { } func (s AppliedEditSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ClearToolUsesResponseAppliedEditSum: e.FieldStart("type") @@ -327,6 +362,16 @@ func (s *AppliedEditSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -348,7 +393,11 @@ func (s *AppliedEditSum) Decode(d *jx.Decoder) error { s.Type = ClearThinkingResponseAppliedEditSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -357,6 +406,12 @@ func (s *AppliedEditSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = AppliedEditSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -2349,6 +2404,13 @@ func (s ContentItemSum) Encode(e *jx.Encoder) { } func (s ContentItemSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ContentItemTextContentItemSum: e.FieldStart("type") @@ -2522,6 +2584,16 @@ func (s *ContentItemSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -2558,7 +2630,11 @@ func (s *ContentItemSum) Decode(d *jx.Decoder) error { s.Type = OutputContentItemReasoningTextContentItemSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -2567,6 +2643,12 @@ func (s *ContentItemSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = ContentItemSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -4668,6 +4750,13 @@ func (s DoubaoAppCallBlockSum) Encode(e *jx.Encoder) { } func (s DoubaoAppCallBlockSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case DoubaoAppCallBlockOutputTextDoubaoAppCallBlockSum: e.FieldStart("type") @@ -4841,6 +4930,16 @@ func (s *DoubaoAppCallBlockSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -4868,7 +4967,11 @@ func (s *DoubaoAppCallBlockSum) Decode(d *jx.Decoder) error { s.Type = DoubaoAppCallBlockReasoningSearchDoubaoAppCallBlockSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -4877,6 +4980,12 @@ func (s *DoubaoAppCallBlockSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = DoubaoAppCallBlockSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -6511,6 +6620,13 @@ func (s InputItemSum) Encode(e *jx.Encoder) { } func (s InputItemSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ItemEasyMessageInputItemSum: e.FieldStart("type") @@ -6780,6 +6896,16 @@ func (s *InputItemSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -6819,7 +6945,11 @@ func (s *InputItemSum) Decode(d *jx.Decoder) error { s.Type = ItemFunctionMcpCallInputItemSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -6828,6 +6958,12 @@ func (s *InputItemSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = InputItemSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -14290,6 +14426,13 @@ func (s OutputContentItemSum) Encode(e *jx.Encoder) { } func (s OutputContentItemSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case OutputContentItemTextOutputContentItemSum: e.FieldStart("type") @@ -14347,6 +14490,16 @@ func (s *OutputContentItemSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -14368,7 +14521,11 @@ func (s *OutputContentItemSum) Decode(d *jx.Decoder) error { s.Type = OutputContentItemReasoningTextOutputContentItemSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -14377,6 +14534,12 @@ func (s *OutputContentItemSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = OutputContentItemSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -14643,6 +14806,13 @@ func (s OutputItemSum) Encode(e *jx.Encoder) { } func (s OutputItemSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ItemOutputMessageOutputItemSum: e.FieldStart("type") @@ -15022,6 +15192,16 @@ func (s *OutputItemSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -15073,7 +15253,11 @@ func (s *OutputItemSum) Decode(d *jx.Decoder) error { s.Type = ItemAgentToolCallOutputItemSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -15082,6 +15266,12 @@ func (s *OutputItemSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = OutputItemSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -27673,6 +27863,13 @@ func (s ResponseStreamEventSum) Encode(e *jx.Encoder) { } func (s ResponseStreamEventSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ResponseCreatedEventResponseStreamEventSum: e.FieldStart("type") @@ -29208,6 +29405,16 @@ func (s *ResponseStreamEventSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -29412,7 +29619,11 @@ func (s *ResponseStreamEventSum) Decode(d *jx.Decoder) error { s.Type = ResponseErrorEventResponseStreamEventSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -29421,6 +29632,12 @@ func (s *ResponseStreamEventSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = ResponseStreamEventSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -33981,6 +34198,13 @@ func (s ToolSum) Encode(e *jx.Encoder) { } func (s ToolSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case FunctionToolToolSum: e.FieldStart("type") @@ -34180,6 +34404,16 @@ func (s *ToolSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -34213,7 +34447,11 @@ func (s *ToolSum) Decode(d *jx.Decoder) error { s.Type = DoubaoAppToolToolSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -34222,6 +34460,12 @@ func (s *ToolSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = ToolSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } @@ -35262,6 +35506,13 @@ func (s TypedToolChoiceSum) Encode(e *jx.Encoder) { } func (s TypedToolChoiceSum) encodeFields(e *jx.Encoder) { + if s.Type == "" && s.unknownType != "" { + // Decode validated this private object. Replay its fields, including + // when called by an enclosing object with an inline union. + raw := strings.TrimSpace(s.unknownJSON) + e.RawStr(raw[1 : len(raw)-1]) + return + } switch s.Type { case ToolChoiceFunctionTypedToolChoiceSum: e.FieldStart("type") @@ -35307,6 +35558,16 @@ func (s *TypedToolChoiceSum) Decode(d *jx.Decoder) error { if typ := d.Next(); typ != jx.Object { return errors.Errorf("unexpected json type %q", typ) } + // Buffer one complete value before peeking. Capture must not rewind a + // reader-backed decoder after its input buffer has been refilled. + raw, err := d.Raw() + if err != nil { + return err + } + d = jx.DecodeBytes(raw) + s.unknownType = "" + s.unknownJSON = "" + var unknownType string var found bool if err := d.Capture(func(d *jx.Decoder) error { @@ -35334,7 +35595,11 @@ func (s *TypedToolChoiceSum) Decode(d *jx.Decoder) error { s.Type = ToolChoiceKnowledgeSearchTypedToolChoiceSum found = true default: - return errors.Errorf("unknown type %s", typ) + if typ == "" { + return errors.New("empty sum type discriminator") + } + unknownType = typ + found = true } return nil } @@ -35343,6 +35608,12 @@ func (s *TypedToolChoiceSum) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "capture") } + if unknownType != "" { + // Copy bytes: decoder buffers can be reused after this call. + // Reset known members so a reused object cannot expose stale data. + *s = TypedToolChoiceSum{unknownType: unknownType, unknownJSON: string(raw)} + return nil + } if !found { return errors.New("unable to detect sum type variant") } diff --git a/arkruntime/model/responses/oas_schemas_gen.go b/arkruntime/model/responses/oas_schemas_gen.go index 510ff92..aa70935 100644 --- a/arkruntime/model/responses/oas_schemas_gen.go +++ b/arkruntime/model/responses/oas_schemas_gen.go @@ -27,11 +27,24 @@ func (s *Annotation) SetOneOf(val AnnotationSum) { // AnnotationSum represents sum type. type AnnotationSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type AnnotationSumType // switch on this field UrlCitation UrlCitation DocCitation DocCitation } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s AnnotationSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // AnnotationSumType is oneOf type of AnnotationSum. type AnnotationSumType string @@ -50,6 +63,8 @@ func (s AnnotationSum) IsDocCitation() bool { return s.Type == DocCitationAnnota // SetUrlCitation sets AnnotationSum to UrlCitation. func (s *AnnotationSum) SetUrlCitation(v UrlCitation) { s.Type = UrlCitationAnnotationSum + s.unknownType = "" + s.unknownJSON = "" s.UrlCitation = v } @@ -71,6 +86,8 @@ func NewUrlCitationAnnotationSum(v UrlCitation) AnnotationSum { // SetDocCitation sets AnnotationSum to DocCitation. func (s *AnnotationSum) SetDocCitation(v DocCitation) { s.Type = DocCitationAnnotationSum + s.unknownType = "" + s.unknownJSON = "" s.DocCitation = v } @@ -106,11 +123,24 @@ func (s *AppliedEdit) SetOneOf(val AppliedEditSum) { // AppliedEditSum represents sum type. type AppliedEditSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type AppliedEditSumType // switch on this field ClearToolUsesResponse ClearToolUsesResponse ClearThinkingResponse ClearThinkingResponse } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s AppliedEditSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // AppliedEditSumType is oneOf type of AppliedEditSum. type AppliedEditSumType string @@ -133,6 +163,8 @@ func (s AppliedEditSum) IsClearThinkingResponse() bool { // SetClearToolUsesResponse sets AppliedEditSum to ClearToolUsesResponse. func (s *AppliedEditSum) SetClearToolUsesResponse(v ClearToolUsesResponse) { s.Type = ClearToolUsesResponseAppliedEditSum + s.unknownType = "" + s.unknownJSON = "" s.ClearToolUsesResponse = v } @@ -154,6 +186,8 @@ func NewClearToolUsesResponseAppliedEditSum(v ClearToolUsesResponse) AppliedEdit // SetClearThinkingResponse sets AppliedEditSum to ClearThinkingResponse. func (s *AppliedEditSum) SetClearThinkingResponse(v ClearThinkingResponse) { s.Type = ClearThinkingResponseAppliedEditSum + s.unknownType = "" + s.unknownJSON = "" s.ClearThinkingResponse = v } @@ -1003,6 +1037,9 @@ func (s *ContentItemImageType) UnmarshalText(data []byte) error { // ContentItemSum represents sum type. type ContentItemSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type ContentItemSumType // switch on this field ContentItemText ContentItemText ContentItemImage ContentItemImage @@ -1013,6 +1050,16 @@ type ContentItemSum struct { OutputContentItemReasoningText OutputContentItemReasoningText } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s ContentItemSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // ContentItemSumType is oneOf type of ContentItemSum. type ContentItemSumType string @@ -1055,6 +1102,8 @@ func (s ContentItemSum) IsOutputContentItemReasoningText() bool { // SetContentItemText sets ContentItemSum to ContentItemText. func (s *ContentItemSum) SetContentItemText(v ContentItemText) { s.Type = ContentItemTextContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.ContentItemText = v } @@ -1076,6 +1125,8 @@ func NewContentItemTextContentItemSum(v ContentItemText) ContentItemSum { // SetContentItemImage sets ContentItemSum to ContentItemImage. func (s *ContentItemSum) SetContentItemImage(v ContentItemImage) { s.Type = ContentItemImageContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.ContentItemImage = v } @@ -1097,6 +1148,8 @@ func NewContentItemImageContentItemSum(v ContentItemImage) ContentItemSum { // SetContentItemAudio sets ContentItemSum to ContentItemAudio. func (s *ContentItemSum) SetContentItemAudio(v ContentItemAudio) { s.Type = ContentItemAudioContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.ContentItemAudio = v } @@ -1118,6 +1171,8 @@ func NewContentItemAudioContentItemSum(v ContentItemAudio) ContentItemSum { // SetContentItemFile sets ContentItemSum to ContentItemFile. func (s *ContentItemSum) SetContentItemFile(v ContentItemFile) { s.Type = ContentItemFileContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.ContentItemFile = v } @@ -1139,6 +1194,8 @@ func NewContentItemFileContentItemSum(v ContentItemFile) ContentItemSum { // SetContentItemVideo sets ContentItemSum to ContentItemVideo. func (s *ContentItemSum) SetContentItemVideo(v ContentItemVideo) { s.Type = ContentItemVideoContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.ContentItemVideo = v } @@ -1160,6 +1217,8 @@ func NewContentItemVideoContentItemSum(v ContentItemVideo) ContentItemSum { // SetOutputContentItemText sets ContentItemSum to OutputContentItemText. func (s *ContentItemSum) SetOutputContentItemText(v OutputContentItemText) { s.Type = OutputContentItemTextContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.OutputContentItemText = v } @@ -1181,6 +1240,8 @@ func NewOutputContentItemTextContentItemSum(v OutputContentItemText) ContentItem // SetOutputContentItemReasoningText sets ContentItemSum to OutputContentItemReasoningText. func (s *ContentItemSum) SetOutputContentItemReasoningText(v OutputContentItemReasoningText) { s.Type = OutputContentItemReasoningTextContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.OutputContentItemReasoningText = v } @@ -2027,6 +2088,9 @@ func (s *DoubaoAppCallBlockSearchType) UnmarshalText(data []byte) error { // DoubaoAppCallBlockSum represents sum type. type DoubaoAppCallBlockSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type DoubaoAppCallBlockSumType // switch on this field DoubaoAppCallBlockOutputText DoubaoAppCallBlockOutputText DoubaoAppCallBlockReasoningText DoubaoAppCallBlockReasoningText @@ -2034,6 +2098,16 @@ type DoubaoAppCallBlockSum struct { DoubaoAppCallBlockReasoningSearch DoubaoAppCallBlockReasoningSearch } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s DoubaoAppCallBlockSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // DoubaoAppCallBlockSumType is oneOf type of DoubaoAppCallBlockSum. type DoubaoAppCallBlockSumType string @@ -2068,6 +2142,8 @@ func (s DoubaoAppCallBlockSum) IsDoubaoAppCallBlockReasoningSearch() bool { // SetDoubaoAppCallBlockOutputText sets DoubaoAppCallBlockSum to DoubaoAppCallBlockOutputText. func (s *DoubaoAppCallBlockSum) SetDoubaoAppCallBlockOutputText(v DoubaoAppCallBlockOutputText) { s.Type = DoubaoAppCallBlockOutputTextDoubaoAppCallBlockSum + s.unknownType = "" + s.unknownJSON = "" s.DoubaoAppCallBlockOutputText = v } @@ -2089,6 +2165,8 @@ func NewDoubaoAppCallBlockOutputTextDoubaoAppCallBlockSum(v DoubaoAppCallBlockOu // SetDoubaoAppCallBlockReasoningText sets DoubaoAppCallBlockSum to DoubaoAppCallBlockReasoningText. func (s *DoubaoAppCallBlockSum) SetDoubaoAppCallBlockReasoningText(v DoubaoAppCallBlockReasoningText) { s.Type = DoubaoAppCallBlockReasoningTextDoubaoAppCallBlockSum + s.unknownType = "" + s.unknownJSON = "" s.DoubaoAppCallBlockReasoningText = v } @@ -2110,6 +2188,8 @@ func NewDoubaoAppCallBlockReasoningTextDoubaoAppCallBlockSum(v DoubaoAppCallBloc // SetDoubaoAppCallBlockSearch sets DoubaoAppCallBlockSum to DoubaoAppCallBlockSearch. func (s *DoubaoAppCallBlockSum) SetDoubaoAppCallBlockSearch(v DoubaoAppCallBlockSearch) { s.Type = DoubaoAppCallBlockSearchDoubaoAppCallBlockSum + s.unknownType = "" + s.unknownJSON = "" s.DoubaoAppCallBlockSearch = v } @@ -2131,6 +2211,8 @@ func NewDoubaoAppCallBlockSearchDoubaoAppCallBlockSum(v DoubaoAppCallBlockSearch // SetDoubaoAppCallBlockReasoningSearch sets DoubaoAppCallBlockSum to DoubaoAppCallBlockReasoningSearch. func (s *DoubaoAppCallBlockSum) SetDoubaoAppCallBlockReasoningSearch(v DoubaoAppCallBlockReasoningSearch) { s.Type = DoubaoAppCallBlockReasoningSearchDoubaoAppCallBlockSum + s.unknownType = "" + s.unknownJSON = "" s.DoubaoAppCallBlockReasoningSearch = v } @@ -2802,6 +2884,9 @@ func (s *InputItem) SetOneOf(val InputItemSum) { // InputItemSum represents sum type. type InputItemSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type InputItemSumType // switch on this field ItemEasyMessage ItemEasyMessage ItemFunctionToolCall ItemFunctionToolCall @@ -2813,6 +2898,16 @@ type InputItemSum struct { ItemFunctionMcpCall ItemFunctionMcpCall } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s InputItemSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // InputItemSumType is oneOf type of InputItemSum. type InputItemSumType string @@ -2865,6 +2960,8 @@ func (s InputItemSum) IsItemFunctionMcpCall() bool { return s.Type == ItemFuncti // SetItemEasyMessage sets InputItemSum to ItemEasyMessage. func (s *InputItemSum) SetItemEasyMessage(v ItemEasyMessage) { s.Type = ItemEasyMessageInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemEasyMessage = v } @@ -2886,6 +2983,8 @@ func NewItemEasyMessageInputItemSum(v ItemEasyMessage) InputItemSum { // SetItemFunctionToolCall sets InputItemSum to ItemFunctionToolCall. func (s *InputItemSum) SetItemFunctionToolCall(v ItemFunctionToolCall) { s.Type = ItemFunctionToolCallInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionToolCall = v } @@ -2907,6 +3006,8 @@ func NewItemFunctionToolCallInputItemSum(v ItemFunctionToolCall) InputItemSum { // SetItemFunctionToolCallOutput sets InputItemSum to ItemFunctionToolCallOutput. func (s *InputItemSum) SetItemFunctionToolCallOutput(v ItemFunctionToolCallOutput) { s.Type = ItemFunctionToolCallOutputInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionToolCallOutput = v } @@ -2928,6 +3029,8 @@ func NewItemFunctionToolCallOutputInputItemSum(v ItemFunctionToolCallOutput) Inp // SetItemReasoning sets InputItemSum to ItemReasoning. func (s *InputItemSum) SetItemReasoning(v ItemReasoning) { s.Type = ItemReasoningInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemReasoning = v } @@ -2949,6 +3052,8 @@ func NewItemReasoningInputItemSum(v ItemReasoning) InputItemSum { // SetItemFunctionMcpApprovalRequest sets InputItemSum to ItemFunctionMcpApprovalRequest. func (s *InputItemSum) SetItemFunctionMcpApprovalRequest(v ItemFunctionMcpApprovalRequest) { s.Type = ItemFunctionMcpApprovalRequestInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpApprovalRequest = v } @@ -2970,6 +3075,8 @@ func NewItemFunctionMcpApprovalRequestInputItemSum(v ItemFunctionMcpApprovalRequ // SetItemFunctionMcpApprovalResponse sets InputItemSum to ItemFunctionMcpApprovalResponse. func (s *InputItemSum) SetItemFunctionMcpApprovalResponse(v ItemFunctionMcpApprovalResponse) { s.Type = ItemFunctionMcpApprovalResponseInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpApprovalResponse = v } @@ -2991,6 +3098,8 @@ func NewItemFunctionMcpApprovalResponseInputItemSum(v ItemFunctionMcpApprovalRes // SetItemFunctionMcpListTools sets InputItemSum to ItemFunctionMcpListTools. func (s *InputItemSum) SetItemFunctionMcpListTools(v ItemFunctionMcpListTools) { s.Type = ItemFunctionMcpListToolsInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpListTools = v } @@ -3012,6 +3121,8 @@ func NewItemFunctionMcpListToolsInputItemSum(v ItemFunctionMcpListTools) InputIt // SetItemFunctionMcpCall sets InputItemSum to ItemFunctionMcpCall. func (s *InputItemSum) SetItemFunctionMcpCall(v ItemFunctionMcpCall) { s.Type = ItemFunctionMcpCallInputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpCall = v } @@ -8397,11 +8508,24 @@ func (s *OutputContentItemReasoningTextType) UnmarshalText(data []byte) error { // OutputContentItemSum represents sum type. type OutputContentItemSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type OutputContentItemSumType // switch on this field OutputContentItemText OutputContentItemText OutputContentItemReasoningText OutputContentItemReasoningText } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s OutputContentItemSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // OutputContentItemSumType is oneOf type of OutputContentItemSum. type OutputContentItemSumType string @@ -8424,6 +8548,8 @@ func (s OutputContentItemSum) IsOutputContentItemReasoningText() bool { // SetOutputContentItemText sets OutputContentItemSum to OutputContentItemText. func (s *OutputContentItemSum) SetOutputContentItemText(v OutputContentItemText) { s.Type = OutputContentItemTextOutputContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.OutputContentItemText = v } @@ -8445,6 +8571,8 @@ func NewOutputContentItemTextOutputContentItemSum(v OutputContentItemText) Outpu // SetOutputContentItemReasoningText sets OutputContentItemSum to OutputContentItemReasoningText. func (s *OutputContentItemSum) SetOutputContentItemReasoningText(v OutputContentItemReasoningText) { s.Type = OutputContentItemReasoningTextOutputContentItemSum + s.unknownType = "" + s.unknownJSON = "" s.OutputContentItemReasoningText = v } @@ -8551,6 +8679,9 @@ func (s *OutputItem) SetOneOf(val OutputItemSum) { // OutputItemSum represents sum type. type OutputItemSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type OutputItemSumType // switch on this field ItemOutputMessage ItemOutputMessage ItemFunctionToolCall ItemFunctionToolCall @@ -8566,6 +8697,16 @@ type OutputItemSum struct { ItemAgentToolCall ItemAgentToolCall } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s OutputItemSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // OutputItemSumType is oneOf type of OutputItemSum. type OutputItemSumType string @@ -8638,6 +8779,8 @@ func (s OutputItemSum) IsItemAgentToolCall() bool { return s.Type == ItemAgentTo // SetItemOutputMessage sets OutputItemSum to ItemOutputMessage. func (s *OutputItemSum) SetItemOutputMessage(v ItemOutputMessage) { s.Type = ItemOutputMessageOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemOutputMessage = v } @@ -8659,6 +8802,8 @@ func NewItemOutputMessageOutputItemSum(v ItemOutputMessage) OutputItemSum { // SetItemFunctionToolCall sets OutputItemSum to ItemFunctionToolCall. func (s *OutputItemSum) SetItemFunctionToolCall(v ItemFunctionToolCall) { s.Type = ItemFunctionToolCallOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionToolCall = v } @@ -8680,6 +8825,8 @@ func NewItemFunctionToolCallOutputItemSum(v ItemFunctionToolCall) OutputItemSum // SetItemReasoning sets OutputItemSum to ItemReasoning. func (s *OutputItemSum) SetItemReasoning(v ItemReasoning) { s.Type = ItemReasoningOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemReasoning = v } @@ -8701,6 +8848,8 @@ func NewItemReasoningOutputItemSum(v ItemReasoning) OutputItemSum { // SetItemTranscription sets OutputItemSum to ItemTranscription. func (s *OutputItemSum) SetItemTranscription(v ItemTranscription) { s.Type = ItemTranscriptionOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemTranscription = v } @@ -8722,6 +8871,8 @@ func NewItemTranscriptionOutputItemSum(v ItemTranscription) OutputItemSum { // SetItemFunctionWebSearch sets OutputItemSum to ItemFunctionWebSearch. func (s *OutputItemSum) SetItemFunctionWebSearch(v ItemFunctionWebSearch) { s.Type = ItemFunctionWebSearchOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionWebSearch = v } @@ -8743,6 +8894,8 @@ func NewItemFunctionWebSearchOutputItemSum(v ItemFunctionWebSearch) OutputItemSu // SetItemFunctionImageProcess sets OutputItemSum to ItemFunctionImageProcess. func (s *OutputItemSum) SetItemFunctionImageProcess(v ItemFunctionImageProcess) { s.Type = ItemFunctionImageProcessOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionImageProcess = v } @@ -8764,6 +8917,8 @@ func NewItemFunctionImageProcessOutputItemSum(v ItemFunctionImageProcess) Output // SetItemFunctionMcpApprovalRequest sets OutputItemSum to ItemFunctionMcpApprovalRequest. func (s *OutputItemSum) SetItemFunctionMcpApprovalRequest(v ItemFunctionMcpApprovalRequest) { s.Type = ItemFunctionMcpApprovalRequestOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpApprovalRequest = v } @@ -8785,6 +8940,8 @@ func NewItemFunctionMcpApprovalRequestOutputItemSum(v ItemFunctionMcpApprovalReq // SetItemFunctionMcpListTools sets OutputItemSum to ItemFunctionMcpListTools. func (s *OutputItemSum) SetItemFunctionMcpListTools(v ItemFunctionMcpListTools) { s.Type = ItemFunctionMcpListToolsOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpListTools = v } @@ -8806,6 +8963,8 @@ func NewItemFunctionMcpListToolsOutputItemSum(v ItemFunctionMcpListTools) Output // SetItemFunctionMcpCall sets OutputItemSum to ItemFunctionMcpCall. func (s *OutputItemSum) SetItemFunctionMcpCall(v ItemFunctionMcpCall) { s.Type = ItemFunctionMcpCallOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionMcpCall = v } @@ -8827,6 +8986,8 @@ func NewItemFunctionMcpCallOutputItemSum(v ItemFunctionMcpCall) OutputItemSum { // SetItemFunctionKnowledgeSearch sets OutputItemSum to ItemFunctionKnowledgeSearch. func (s *OutputItemSum) SetItemFunctionKnowledgeSearch(v ItemFunctionKnowledgeSearch) { s.Type = ItemFunctionKnowledgeSearchOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemFunctionKnowledgeSearch = v } @@ -8848,6 +9009,8 @@ func NewItemFunctionKnowledgeSearchOutputItemSum(v ItemFunctionKnowledgeSearch) // SetItemDoubaoAppCall sets OutputItemSum to ItemDoubaoAppCall. func (s *OutputItemSum) SetItemDoubaoAppCall(v ItemDoubaoAppCall) { s.Type = ItemDoubaoAppCallOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemDoubaoAppCall = v } @@ -8869,6 +9032,8 @@ func NewItemDoubaoAppCallOutputItemSum(v ItemDoubaoAppCall) OutputItemSum { // SetItemAgentToolCall sets OutputItemSum to ItemAgentToolCall. func (s *OutputItemSum) SetItemAgentToolCall(v ItemAgentToolCall) { s.Type = ItemAgentToolCallOutputItemSum + s.unknownType = "" + s.unknownJSON = "" s.ItemAgentToolCall = v } @@ -14845,6 +15010,9 @@ func (*ResponseStreamEvent) responsesCreateRes() {} // ResponseStreamEventSum represents sum type. type ResponseStreamEventSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type ResponseStreamEventSumType // switch on this field ResponseCreatedEvent ResponseCreatedEvent ResponseInProgressEvent ResponseInProgressEvent @@ -14911,6 +15079,16 @@ type ResponseStreamEventSum struct { ResponseErrorEvent ResponseErrorEvent } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s ResponseStreamEventSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // ResponseStreamEventSumType is oneOf type of ResponseStreamEventSum. type ResponseStreamEventSumType string @@ -15299,6 +15477,8 @@ func (s ResponseStreamEventSum) IsResponseErrorEvent() bool { // SetResponseCreatedEvent sets ResponseStreamEventSum to ResponseCreatedEvent. func (s *ResponseStreamEventSum) SetResponseCreatedEvent(v ResponseCreatedEvent) { s.Type = ResponseCreatedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseCreatedEvent = v } @@ -15320,6 +15500,8 @@ func NewResponseCreatedEventResponseStreamEventSum(v ResponseCreatedEvent) Respo // SetResponseInProgressEvent sets ResponseStreamEventSum to ResponseInProgressEvent. func (s *ResponseStreamEventSum) SetResponseInProgressEvent(v ResponseInProgressEvent) { s.Type = ResponseInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseInProgressEvent = v } @@ -15341,6 +15523,8 @@ func NewResponseInProgressEventResponseStreamEventSum(v ResponseInProgressEvent) // SetResponseCompletedEvent sets ResponseStreamEventSum to ResponseCompletedEvent. func (s *ResponseStreamEventSum) SetResponseCompletedEvent(v ResponseCompletedEvent) { s.Type = ResponseCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseCompletedEvent = v } @@ -15362,6 +15546,8 @@ func NewResponseCompletedEventResponseStreamEventSum(v ResponseCompletedEvent) R // SetResponseFailedEvent sets ResponseStreamEventSum to ResponseFailedEvent. func (s *ResponseStreamEventSum) SetResponseFailedEvent(v ResponseFailedEvent) { s.Type = ResponseFailedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseFailedEvent = v } @@ -15383,6 +15569,8 @@ func NewResponseFailedEventResponseStreamEventSum(v ResponseFailedEvent) Respons // SetResponseIncompleteEvent sets ResponseStreamEventSum to ResponseIncompleteEvent. func (s *ResponseStreamEventSum) SetResponseIncompleteEvent(v ResponseIncompleteEvent) { s.Type = ResponseIncompleteEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseIncompleteEvent = v } @@ -15404,6 +15592,8 @@ func NewResponseIncompleteEventResponseStreamEventSum(v ResponseIncompleteEvent) // SetResponseOutputItemAddedEvent sets ResponseStreamEventSum to ResponseOutputItemAddedEvent. func (s *ResponseStreamEventSum) SetResponseOutputItemAddedEvent(v ResponseOutputItemAddedEvent) { s.Type = ResponseOutputItemAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseOutputItemAddedEvent = v } @@ -15425,6 +15615,8 @@ func NewResponseOutputItemAddedEventResponseStreamEventSum(v ResponseOutputItemA // SetResponseOutputItemDoneEvent sets ResponseStreamEventSum to ResponseOutputItemDoneEvent. func (s *ResponseStreamEventSum) SetResponseOutputItemDoneEvent(v ResponseOutputItemDoneEvent) { s.Type = ResponseOutputItemDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseOutputItemDoneEvent = v } @@ -15446,6 +15638,8 @@ func NewResponseOutputItemDoneEventResponseStreamEventSum(v ResponseOutputItemDo // SetResponseContentPartAddedEvent sets ResponseStreamEventSum to ResponseContentPartAddedEvent. func (s *ResponseStreamEventSum) SetResponseContentPartAddedEvent(v ResponseContentPartAddedEvent) { s.Type = ResponseContentPartAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseContentPartAddedEvent = v } @@ -15467,6 +15661,8 @@ func NewResponseContentPartAddedEventResponseStreamEventSum(v ResponseContentPar // SetResponseContentPartDoneEvent sets ResponseStreamEventSum to ResponseContentPartDoneEvent. func (s *ResponseStreamEventSum) SetResponseContentPartDoneEvent(v ResponseContentPartDoneEvent) { s.Type = ResponseContentPartDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseContentPartDoneEvent = v } @@ -15488,6 +15684,8 @@ func NewResponseContentPartDoneEventResponseStreamEventSum(v ResponseContentPart // SetResponseTextDeltaEvent sets ResponseStreamEventSum to ResponseTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseTextDeltaEvent(v ResponseTextDeltaEvent) { s.Type = ResponseTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTextDeltaEvent = v } @@ -15509,6 +15707,8 @@ func NewResponseTextDeltaEventResponseStreamEventSum(v ResponseTextDeltaEvent) R // SetResponseTextDoneEvent sets ResponseStreamEventSum to ResponseTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseTextDoneEvent(v ResponseTextDoneEvent) { s.Type = ResponseTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTextDoneEvent = v } @@ -15530,6 +15730,8 @@ func NewResponseTextDoneEventResponseStreamEventSum(v ResponseTextDoneEvent) Res // SetResponseOutputTextAnnotationAddedEvent sets ResponseStreamEventSum to ResponseOutputTextAnnotationAddedEvent. func (s *ResponseStreamEventSum) SetResponseOutputTextAnnotationAddedEvent(v ResponseOutputTextAnnotationAddedEvent) { s.Type = ResponseOutputTextAnnotationAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseOutputTextAnnotationAddedEvent = v } @@ -15551,6 +15753,8 @@ func NewResponseOutputTextAnnotationAddedEventResponseStreamEventSum(v ResponseO // SetResponseReasoningSummaryPartAddedEvent sets ResponseStreamEventSum to ResponseReasoningSummaryPartAddedEvent. func (s *ResponseStreamEventSum) SetResponseReasoningSummaryPartAddedEvent(v ResponseReasoningSummaryPartAddedEvent) { s.Type = ResponseReasoningSummaryPartAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningSummaryPartAddedEvent = v } @@ -15572,6 +15776,8 @@ func NewResponseReasoningSummaryPartAddedEventResponseStreamEventSum(v ResponseR // SetResponseReasoningSummaryPartDoneEvent sets ResponseStreamEventSum to ResponseReasoningSummaryPartDoneEvent. func (s *ResponseStreamEventSum) SetResponseReasoningSummaryPartDoneEvent(v ResponseReasoningSummaryPartDoneEvent) { s.Type = ResponseReasoningSummaryPartDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningSummaryPartDoneEvent = v } @@ -15593,6 +15799,8 @@ func NewResponseReasoningSummaryPartDoneEventResponseStreamEventSum(v ResponseRe // SetResponseReasoningSummaryTextDeltaEvent sets ResponseStreamEventSum to ResponseReasoningSummaryTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseReasoningSummaryTextDeltaEvent(v ResponseReasoningSummaryTextDeltaEvent) { s.Type = ResponseReasoningSummaryTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningSummaryTextDeltaEvent = v } @@ -15614,6 +15822,8 @@ func NewResponseReasoningSummaryTextDeltaEventResponseStreamEventSum(v ResponseR // SetResponseReasoningSummaryTextDoneEvent sets ResponseStreamEventSum to ResponseReasoningSummaryTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseReasoningSummaryTextDoneEvent(v ResponseReasoningSummaryTextDoneEvent) { s.Type = ResponseReasoningSummaryTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningSummaryTextDoneEvent = v } @@ -15635,6 +15845,8 @@ func NewResponseReasoningSummaryTextDoneEventResponseStreamEventSum(v ResponseRe // SetResponseReasoningTextDeltaEvent sets ResponseStreamEventSum to ResponseReasoningTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseReasoningTextDeltaEvent(v ResponseReasoningTextDeltaEvent) { s.Type = ResponseReasoningTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningTextDeltaEvent = v } @@ -15656,6 +15868,8 @@ func NewResponseReasoningTextDeltaEventResponseStreamEventSum(v ResponseReasonin // SetResponseReasoningTextDoneEvent sets ResponseStreamEventSum to ResponseReasoningTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseReasoningTextDoneEvent(v ResponseReasoningTextDoneEvent) { s.Type = ResponseReasoningTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningTextDoneEvent = v } @@ -15677,6 +15891,8 @@ func NewResponseReasoningTextDoneEventResponseStreamEventSum(v ResponseReasoning // SetResponseReasoningRawTextDeltaEvent sets ResponseStreamEventSum to ResponseReasoningRawTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseReasoningRawTextDeltaEvent(v ResponseReasoningRawTextDeltaEvent) { s.Type = ResponseReasoningRawTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningRawTextDeltaEvent = v } @@ -15698,6 +15914,8 @@ func NewResponseReasoningRawTextDeltaEventResponseStreamEventSum(v ResponseReaso // SetResponseReasoningRawTextDoneEvent sets ResponseStreamEventSum to ResponseReasoningRawTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseReasoningRawTextDoneEvent(v ResponseReasoningRawTextDoneEvent) { s.Type = ResponseReasoningRawTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseReasoningRawTextDoneEvent = v } @@ -15719,6 +15937,8 @@ func NewResponseReasoningRawTextDoneEventResponseStreamEventSum(v ResponseReason // SetResponseFunctionCallArgumentsDeltaEvent sets ResponseStreamEventSum to ResponseFunctionCallArgumentsDeltaEvent. func (s *ResponseStreamEventSum) SetResponseFunctionCallArgumentsDeltaEvent(v ResponseFunctionCallArgumentsDeltaEvent) { s.Type = ResponseFunctionCallArgumentsDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseFunctionCallArgumentsDeltaEvent = v } @@ -15740,6 +15960,8 @@ func NewResponseFunctionCallArgumentsDeltaEventResponseStreamEventSum(v Response // SetResponseFunctionCallArgumentsDoneEvent sets ResponseStreamEventSum to ResponseFunctionCallArgumentsDoneEvent. func (s *ResponseStreamEventSum) SetResponseFunctionCallArgumentsDoneEvent(v ResponseFunctionCallArgumentsDoneEvent) { s.Type = ResponseFunctionCallArgumentsDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseFunctionCallArgumentsDoneEvent = v } @@ -15761,6 +15983,8 @@ func NewResponseFunctionCallArgumentsDoneEventResponseStreamEventSum(v ResponseF // SetResponseTranscriptionPartAddedEvent sets ResponseStreamEventSum to ResponseTranscriptionPartAddedEvent. func (s *ResponseStreamEventSum) SetResponseTranscriptionPartAddedEvent(v ResponseTranscriptionPartAddedEvent) { s.Type = ResponseTranscriptionPartAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTranscriptionPartAddedEvent = v } @@ -15782,6 +16006,8 @@ func NewResponseTranscriptionPartAddedEventResponseStreamEventSum(v ResponseTran // SetResponseTranscriptionPartDoneEvent sets ResponseStreamEventSum to ResponseTranscriptionPartDoneEvent. func (s *ResponseStreamEventSum) SetResponseTranscriptionPartDoneEvent(v ResponseTranscriptionPartDoneEvent) { s.Type = ResponseTranscriptionPartDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTranscriptionPartDoneEvent = v } @@ -15803,6 +16029,8 @@ func NewResponseTranscriptionPartDoneEventResponseStreamEventSum(v ResponseTrans // SetResponseTranscriptionTextDeltaEvent sets ResponseStreamEventSum to ResponseTranscriptionTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseTranscriptionTextDeltaEvent(v ResponseTranscriptionTextDeltaEvent) { s.Type = ResponseTranscriptionTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTranscriptionTextDeltaEvent = v } @@ -15824,6 +16052,8 @@ func NewResponseTranscriptionTextDeltaEventResponseStreamEventSum(v ResponseTran // SetResponseTranscriptionTextDoneEvent sets ResponseStreamEventSum to ResponseTranscriptionTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseTranscriptionTextDoneEvent(v ResponseTranscriptionTextDoneEvent) { s.Type = ResponseTranscriptionTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseTranscriptionTextDoneEvent = v } @@ -15845,6 +16075,8 @@ func NewResponseTranscriptionTextDoneEventResponseStreamEventSum(v ResponseTrans // SetResponseWebSearchCallInProgressEvent sets ResponseStreamEventSum to ResponseWebSearchCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseWebSearchCallInProgressEvent(v ResponseWebSearchCallInProgressEvent) { s.Type = ResponseWebSearchCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseWebSearchCallInProgressEvent = v } @@ -15866,6 +16098,8 @@ func NewResponseWebSearchCallInProgressEventResponseStreamEventSum(v ResponseWeb // SetResponseWebSearchCallSearchingEvent sets ResponseStreamEventSum to ResponseWebSearchCallSearchingEvent. func (s *ResponseStreamEventSum) SetResponseWebSearchCallSearchingEvent(v ResponseWebSearchCallSearchingEvent) { s.Type = ResponseWebSearchCallSearchingEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseWebSearchCallSearchingEvent = v } @@ -15887,6 +16121,8 @@ func NewResponseWebSearchCallSearchingEventResponseStreamEventSum(v ResponseWebS // SetResponseWebSearchCallCompletedEvent sets ResponseStreamEventSum to ResponseWebSearchCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseWebSearchCallCompletedEvent(v ResponseWebSearchCallCompletedEvent) { s.Type = ResponseWebSearchCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseWebSearchCallCompletedEvent = v } @@ -15908,6 +16144,8 @@ func NewResponseWebSearchCallCompletedEventResponseStreamEventSum(v ResponseWebS // SetResponseImageProcessCallInProgressEvent sets ResponseStreamEventSum to ResponseImageProcessCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseImageProcessCallInProgressEvent(v ResponseImageProcessCallInProgressEvent) { s.Type = ResponseImageProcessCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseImageProcessCallInProgressEvent = v } @@ -15929,6 +16167,8 @@ func NewResponseImageProcessCallInProgressEventResponseStreamEventSum(v Response // SetResponseImageProcessCallProcessingEvent sets ResponseStreamEventSum to ResponseImageProcessCallProcessingEvent. func (s *ResponseStreamEventSum) SetResponseImageProcessCallProcessingEvent(v ResponseImageProcessCallProcessingEvent) { s.Type = ResponseImageProcessCallProcessingEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseImageProcessCallProcessingEvent = v } @@ -15950,6 +16190,8 @@ func NewResponseImageProcessCallProcessingEventResponseStreamEventSum(v Response // SetResponseImageProcessCallCompletedEvent sets ResponseStreamEventSum to ResponseImageProcessCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseImageProcessCallCompletedEvent(v ResponseImageProcessCallCompletedEvent) { s.Type = ResponseImageProcessCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseImageProcessCallCompletedEvent = v } @@ -15971,6 +16213,8 @@ func NewResponseImageProcessCallCompletedEventResponseStreamEventSum(v ResponseI // SetResponseMcpListToolsInProgressEvent sets ResponseStreamEventSum to ResponseMcpListToolsInProgressEvent. func (s *ResponseStreamEventSum) SetResponseMcpListToolsInProgressEvent(v ResponseMcpListToolsInProgressEvent) { s.Type = ResponseMcpListToolsInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpListToolsInProgressEvent = v } @@ -15992,6 +16236,8 @@ func NewResponseMcpListToolsInProgressEventResponseStreamEventSum(v ResponseMcpL // SetResponseMcpListToolsCompletedEvent sets ResponseStreamEventSum to ResponseMcpListToolsCompletedEvent. func (s *ResponseStreamEventSum) SetResponseMcpListToolsCompletedEvent(v ResponseMcpListToolsCompletedEvent) { s.Type = ResponseMcpListToolsCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpListToolsCompletedEvent = v } @@ -16013,6 +16259,8 @@ func NewResponseMcpListToolsCompletedEventResponseStreamEventSum(v ResponseMcpLi // SetResponseMcpListToolsFailedEvent sets ResponseStreamEventSum to ResponseMcpListToolsFailedEvent. func (s *ResponseStreamEventSum) SetResponseMcpListToolsFailedEvent(v ResponseMcpListToolsFailedEvent) { s.Type = ResponseMcpListToolsFailedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpListToolsFailedEvent = v } @@ -16034,6 +16282,8 @@ func NewResponseMcpListToolsFailedEventResponseStreamEventSum(v ResponseMcpListT // SetResponseMcpCallInProgressEvent sets ResponseStreamEventSum to ResponseMcpCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseMcpCallInProgressEvent(v ResponseMcpCallInProgressEvent) { s.Type = ResponseMcpCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpCallInProgressEvent = v } @@ -16055,6 +16305,8 @@ func NewResponseMcpCallInProgressEventResponseStreamEventSum(v ResponseMcpCallIn // SetResponseMcpCallArgumentsDeltaEvent sets ResponseStreamEventSum to ResponseMcpCallArgumentsDeltaEvent. func (s *ResponseStreamEventSum) SetResponseMcpCallArgumentsDeltaEvent(v ResponseMcpCallArgumentsDeltaEvent) { s.Type = ResponseMcpCallArgumentsDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpCallArgumentsDeltaEvent = v } @@ -16076,6 +16328,8 @@ func NewResponseMcpCallArgumentsDeltaEventResponseStreamEventSum(v ResponseMcpCa // SetResponseMcpCallArgumentsDoneEvent sets ResponseStreamEventSum to ResponseMcpCallArgumentsDoneEvent. func (s *ResponseStreamEventSum) SetResponseMcpCallArgumentsDoneEvent(v ResponseMcpCallArgumentsDoneEvent) { s.Type = ResponseMcpCallArgumentsDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpCallArgumentsDoneEvent = v } @@ -16097,6 +16351,8 @@ func NewResponseMcpCallArgumentsDoneEventResponseStreamEventSum(v ResponseMcpCal // SetResponseMcpCallCompletedEvent sets ResponseStreamEventSum to ResponseMcpCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseMcpCallCompletedEvent(v ResponseMcpCallCompletedEvent) { s.Type = ResponseMcpCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpCallCompletedEvent = v } @@ -16118,6 +16374,8 @@ func NewResponseMcpCallCompletedEventResponseStreamEventSum(v ResponseMcpCallCom // SetResponseMcpCallFailedEvent sets ResponseStreamEventSum to ResponseMcpCallFailedEvent. func (s *ResponseStreamEventSum) SetResponseMcpCallFailedEvent(v ResponseMcpCallFailedEvent) { s.Type = ResponseMcpCallFailedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpCallFailedEvent = v } @@ -16139,6 +16397,8 @@ func NewResponseMcpCallFailedEventResponseStreamEventSum(v ResponseMcpCallFailed // SetResponseMcpApprovalRequestEvent sets ResponseStreamEventSum to ResponseMcpApprovalRequestEvent. func (s *ResponseStreamEventSum) SetResponseMcpApprovalRequestEvent(v ResponseMcpApprovalRequestEvent) { s.Type = ResponseMcpApprovalRequestEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseMcpApprovalRequestEvent = v } @@ -16160,6 +16420,8 @@ func NewResponseMcpApprovalRequestEventResponseStreamEventSum(v ResponseMcpAppro // SetResponseKnowledgeSearchCallInProgressEvent sets ResponseStreamEventSum to ResponseKnowledgeSearchCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseKnowledgeSearchCallInProgressEvent(v ResponseKnowledgeSearchCallInProgressEvent) { s.Type = ResponseKnowledgeSearchCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseKnowledgeSearchCallInProgressEvent = v } @@ -16181,6 +16443,8 @@ func NewResponseKnowledgeSearchCallInProgressEventResponseStreamEventSum(v Respo // SetResponseKnowledgeSearchCallSearchingEvent sets ResponseStreamEventSum to ResponseKnowledgeSearchCallSearchingEvent. func (s *ResponseStreamEventSum) SetResponseKnowledgeSearchCallSearchingEvent(v ResponseKnowledgeSearchCallSearchingEvent) { s.Type = ResponseKnowledgeSearchCallSearchingEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseKnowledgeSearchCallSearchingEvent = v } @@ -16202,6 +16466,8 @@ func NewResponseKnowledgeSearchCallSearchingEventResponseStreamEventSum(v Respon // SetResponseKnowledgeSearchCallCompletedEvent sets ResponseStreamEventSum to ResponseKnowledgeSearchCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseKnowledgeSearchCallCompletedEvent(v ResponseKnowledgeSearchCallCompletedEvent) { s.Type = ResponseKnowledgeSearchCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseKnowledgeSearchCallCompletedEvent = v } @@ -16223,6 +16489,8 @@ func NewResponseKnowledgeSearchCallCompletedEventResponseStreamEventSum(v Respon // SetResponseKnowledgeSearchCallFailedEvent sets ResponseStreamEventSum to ResponseKnowledgeSearchCallFailedEvent. func (s *ResponseStreamEventSum) SetResponseKnowledgeSearchCallFailedEvent(v ResponseKnowledgeSearchCallFailedEvent) { s.Type = ResponseKnowledgeSearchCallFailedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseKnowledgeSearchCallFailedEvent = v } @@ -16244,6 +16512,8 @@ func NewResponseKnowledgeSearchCallFailedEventResponseStreamEventSum(v ResponseK // SetResponseDoubaoAppCallInProgressEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallInProgressEvent(v ResponseDoubaoAppCallInProgressEvent) { s.Type = ResponseDoubaoAppCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallInProgressEvent = v } @@ -16265,6 +16535,8 @@ func NewResponseDoubaoAppCallInProgressEventResponseStreamEventSum(v ResponseDou // SetResponseDoubaoAppCallFailedEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallFailedEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallFailedEvent(v ResponseDoubaoAppCallFailedEvent) { s.Type = ResponseDoubaoAppCallFailedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallFailedEvent = v } @@ -16286,6 +16558,8 @@ func NewResponseDoubaoAppCallFailedEventResponseStreamEventSum(v ResponseDoubaoA // SetResponseDoubaoAppCallCompletedEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallCompletedEvent(v ResponseDoubaoAppCallCompletedEvent) { s.Type = ResponseDoubaoAppCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallCompletedEvent = v } @@ -16307,6 +16581,8 @@ func NewResponseDoubaoAppCallCompletedEventResponseStreamEventSum(v ResponseDoub // SetResponseDoubaoAppCallBlockAddedEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallBlockAddedEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallBlockAddedEvent(v ResponseDoubaoAppCallBlockAddedEvent) { s.Type = ResponseDoubaoAppCallBlockAddedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallBlockAddedEvent = v } @@ -16328,6 +16604,8 @@ func NewResponseDoubaoAppCallBlockAddedEventResponseStreamEventSum(v ResponseDou // SetResponseDoubaoAppCallBlockDoneEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallBlockDoneEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallBlockDoneEvent(v ResponseDoubaoAppCallBlockDoneEvent) { s.Type = ResponseDoubaoAppCallBlockDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallBlockDoneEvent = v } @@ -16349,6 +16627,8 @@ func NewResponseDoubaoAppCallBlockDoneEventResponseStreamEventSum(v ResponseDoub // SetResponseDoubaoAppCallReasoningTextDeltaEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallReasoningTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallReasoningTextDeltaEvent(v ResponseDoubaoAppCallReasoningTextDeltaEvent) { s.Type = ResponseDoubaoAppCallReasoningTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallReasoningTextDeltaEvent = v } @@ -16370,6 +16650,8 @@ func NewResponseDoubaoAppCallReasoningTextDeltaEventResponseStreamEventSum(v Res // SetResponseDoubaoAppCallReasoningTextDoneEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallReasoningTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallReasoningTextDoneEvent(v ResponseDoubaoAppCallReasoningTextDoneEvent) { s.Type = ResponseDoubaoAppCallReasoningTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallReasoningTextDoneEvent = v } @@ -16391,6 +16673,8 @@ func NewResponseDoubaoAppCallReasoningTextDoneEventResponseStreamEventSum(v Resp // SetResponseDoubaoAppCallOutputTextDeltaEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallOutputTextDeltaEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallOutputTextDeltaEvent(v ResponseDoubaoAppCallOutputTextDeltaEvent) { s.Type = ResponseDoubaoAppCallOutputTextDeltaEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallOutputTextDeltaEvent = v } @@ -16412,6 +16696,8 @@ func NewResponseDoubaoAppCallOutputTextDeltaEventResponseStreamEventSum(v Respon // SetResponseDoubaoAppCallOutputTextDoneEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallOutputTextDoneEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallOutputTextDoneEvent(v ResponseDoubaoAppCallOutputTextDoneEvent) { s.Type = ResponseDoubaoAppCallOutputTextDoneEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallOutputTextDoneEvent = v } @@ -16433,6 +16719,8 @@ func NewResponseDoubaoAppCallOutputTextDoneEventResponseStreamEventSum(v Respons // SetResponseDoubaoAppCallReasoningSearchInProgressEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallReasoningSearchInProgressEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallReasoningSearchInProgressEvent(v ResponseDoubaoAppCallReasoningSearchInProgressEvent) { s.Type = ResponseDoubaoAppCallReasoningSearchInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallReasoningSearchInProgressEvent = v } @@ -16454,6 +16742,8 @@ func NewResponseDoubaoAppCallReasoningSearchInProgressEventResponseStreamEventSu // SetResponseDoubaoAppCallReasoningSearchSearchingEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallReasoningSearchSearchingEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallReasoningSearchSearchingEvent(v ResponseDoubaoAppCallReasoningSearchSearchingEvent) { s.Type = ResponseDoubaoAppCallReasoningSearchSearchingEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallReasoningSearchSearchingEvent = v } @@ -16475,6 +16765,8 @@ func NewResponseDoubaoAppCallReasoningSearchSearchingEventResponseStreamEventSum // SetResponseDoubaoAppCallReasoningSearchCompletedEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallReasoningSearchCompletedEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallReasoningSearchCompletedEvent(v ResponseDoubaoAppCallReasoningSearchCompletedEvent) { s.Type = ResponseDoubaoAppCallReasoningSearchCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallReasoningSearchCompletedEvent = v } @@ -16496,6 +16788,8 @@ func NewResponseDoubaoAppCallReasoningSearchCompletedEventResponseStreamEventSum // SetResponseDoubaoAppCallSearchInProgressEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallSearchInProgressEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallSearchInProgressEvent(v ResponseDoubaoAppCallSearchInProgressEvent) { s.Type = ResponseDoubaoAppCallSearchInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallSearchInProgressEvent = v } @@ -16517,6 +16811,8 @@ func NewResponseDoubaoAppCallSearchInProgressEventResponseStreamEventSum(v Respo // SetResponseDoubaoAppCallSearchSearchingEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallSearchSearchingEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallSearchSearchingEvent(v ResponseDoubaoAppCallSearchSearchingEvent) { s.Type = ResponseDoubaoAppCallSearchSearchingEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallSearchSearchingEvent = v } @@ -16538,6 +16834,8 @@ func NewResponseDoubaoAppCallSearchSearchingEventResponseStreamEventSum(v Respon // SetResponseDoubaoAppCallSearchCompletedEvent sets ResponseStreamEventSum to ResponseDoubaoAppCallSearchCompletedEvent. func (s *ResponseStreamEventSum) SetResponseDoubaoAppCallSearchCompletedEvent(v ResponseDoubaoAppCallSearchCompletedEvent) { s.Type = ResponseDoubaoAppCallSearchCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseDoubaoAppCallSearchCompletedEvent = v } @@ -16559,6 +16857,8 @@ func NewResponseDoubaoAppCallSearchCompletedEventResponseStreamEventSum(v Respon // SetResponseAgentToolCallInProgressEvent sets ResponseStreamEventSum to ResponseAgentToolCallInProgressEvent. func (s *ResponseStreamEventSum) SetResponseAgentToolCallInProgressEvent(v ResponseAgentToolCallInProgressEvent) { s.Type = ResponseAgentToolCallInProgressEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseAgentToolCallInProgressEvent = v } @@ -16580,6 +16880,8 @@ func NewResponseAgentToolCallInProgressEventResponseStreamEventSum(v ResponseAge // SetResponseAgentToolCallCompletedEvent sets ResponseStreamEventSum to ResponseAgentToolCallCompletedEvent. func (s *ResponseStreamEventSum) SetResponseAgentToolCallCompletedEvent(v ResponseAgentToolCallCompletedEvent) { s.Type = ResponseAgentToolCallCompletedEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseAgentToolCallCompletedEvent = v } @@ -16601,6 +16903,8 @@ func NewResponseAgentToolCallCompletedEventResponseStreamEventSum(v ResponseAgen // SetResponseErrorEvent sets ResponseStreamEventSum to ResponseErrorEvent. func (s *ResponseStreamEventSum) SetResponseErrorEvent(v ResponseErrorEvent) { s.Type = ResponseErrorEventResponseStreamEventSum + s.unknownType = "" + s.unknownJSON = "" s.ResponseErrorEvent = v } @@ -18710,6 +19014,9 @@ func (s *ToolNameList) SetClearToolNames(val []string) { // ToolSum represents sum type. type ToolSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type ToolSumType // switch on this field FunctionTool FunctionTool WebSearchTool WebSearchTool @@ -18719,6 +19026,16 @@ type ToolSum struct { DoubaoAppTool DoubaoAppTool } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s ToolSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // ToolSumType is oneOf type of ToolSum. type ToolSumType string @@ -18753,6 +19070,8 @@ func (s ToolSum) IsDoubaoAppTool() bool { return s.Type == DoubaoAppToolToolSum // SetFunctionTool sets ToolSum to FunctionTool. func (s *ToolSum) SetFunctionTool(v FunctionTool) { s.Type = FunctionToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.FunctionTool = v } @@ -18774,6 +19093,8 @@ func NewFunctionToolToolSum(v FunctionTool) ToolSum { // SetWebSearchTool sets ToolSum to WebSearchTool. func (s *ToolSum) SetWebSearchTool(v WebSearchTool) { s.Type = WebSearchToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.WebSearchTool = v } @@ -18795,6 +19116,8 @@ func NewWebSearchToolToolSum(v WebSearchTool) ToolSum { // SetImageProcessTool sets ToolSum to ImageProcessTool. func (s *ToolSum) SetImageProcessTool(v ImageProcessTool) { s.Type = ImageProcessToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.ImageProcessTool = v } @@ -18816,6 +19139,8 @@ func NewImageProcessToolToolSum(v ImageProcessTool) ToolSum { // SetMcpTool sets ToolSum to McpTool. func (s *ToolSum) SetMcpTool(v McpTool) { s.Type = McpToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.McpTool = v } @@ -18837,6 +19162,8 @@ func NewMcpToolToolSum(v McpTool) ToolSum { // SetKnowledgeSearchTool sets ToolSum to KnowledgeSearchTool. func (s *ToolSum) SetKnowledgeSearchTool(v KnowledgeSearchTool) { s.Type = KnowledgeSearchToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.KnowledgeSearchTool = v } @@ -18858,6 +19185,8 @@ func NewKnowledgeSearchToolToolSum(v KnowledgeSearchTool) ToolSum { // SetDoubaoAppTool sets ToolSum to DoubaoAppTool. func (s *ToolSum) SetDoubaoAppTool(v DoubaoAppTool) { s.Type = DoubaoAppToolToolSum + s.unknownType = "" + s.unknownJSON = "" s.DoubaoAppTool = v } @@ -19235,6 +19564,9 @@ func (s *TypedToolChoice) SetOneOf(val TypedToolChoiceSum) { // TypedToolChoiceSum represents sum type. type TypedToolChoiceSum struct { + // Only populated for unknown wire variants; no known member is selected. + unknownType string + unknownJSON string Type TypedToolChoiceSumType // switch on this field ToolChoiceFunction ToolChoiceFunction ToolChoiceMcp ToolChoiceMcp @@ -19242,6 +19574,16 @@ type TypedToolChoiceSum struct { ToolChoiceKnowledgeSearch ToolChoiceKnowledgeSearch } +// GetUnknown returns the discriminator and original JSON for an unknown variant. +// The bool is false for known variants and zero values. Explicit validation +// remains strict; selecting a known member makes the fallback inactive. +func (s TypedToolChoiceSum) GetUnknown() (string, string, bool) { + if s.Type != "" || s.unknownType == "" { + return "", "", false + } + return s.unknownType, s.unknownJSON, true +} + // TypedToolChoiceSumType is oneOf type of TypedToolChoiceSum. type TypedToolChoiceSumType string @@ -19274,6 +19616,8 @@ func (s TypedToolChoiceSum) IsToolChoiceKnowledgeSearch() bool { // SetToolChoiceFunction sets TypedToolChoiceSum to ToolChoiceFunction. func (s *TypedToolChoiceSum) SetToolChoiceFunction(v ToolChoiceFunction) { s.Type = ToolChoiceFunctionTypedToolChoiceSum + s.unknownType = "" + s.unknownJSON = "" s.ToolChoiceFunction = v } @@ -19295,6 +19639,8 @@ func NewToolChoiceFunctionTypedToolChoiceSum(v ToolChoiceFunction) TypedToolChoi // SetToolChoiceMcp sets TypedToolChoiceSum to ToolChoiceMcp. func (s *TypedToolChoiceSum) SetToolChoiceMcp(v ToolChoiceMcp) { s.Type = ToolChoiceMcpTypedToolChoiceSum + s.unknownType = "" + s.unknownJSON = "" s.ToolChoiceMcp = v } @@ -19316,6 +19662,8 @@ func NewToolChoiceMcpTypedToolChoiceSum(v ToolChoiceMcp) TypedToolChoiceSum { // SetToolChoiceWebSearch sets TypedToolChoiceSum to ToolChoiceWebSearch. func (s *TypedToolChoiceSum) SetToolChoiceWebSearch(v ToolChoiceWebSearch) { s.Type = ToolChoiceWebSearchTypedToolChoiceSum + s.unknownType = "" + s.unknownJSON = "" s.ToolChoiceWebSearch = v } @@ -19337,6 +19685,8 @@ func NewToolChoiceWebSearchTypedToolChoiceSum(v ToolChoiceWebSearch) TypedToolCh // SetToolChoiceKnowledgeSearch sets TypedToolChoiceSum to ToolChoiceKnowledgeSearch. func (s *TypedToolChoiceSum) SetToolChoiceKnowledgeSearch(v ToolChoiceKnowledgeSearch) { s.Type = ToolChoiceKnowledgeSearchTypedToolChoiceSum + s.unknownType = "" + s.unknownJSON = "" s.ToolChoiceKnowledgeSearch = v }