refactor(core): migrate MessageV2 part leaves + ToolPart to Effect Schema#23756
Merged
kitlangton merged 1 commit intodevfrom Apr 22, 2026
Merged
refactor(core): migrate MessageV2 part leaves + ToolPart to Effect Schema#23756kitlangton merged 1 commit intodevfrom
kitlangton merged 1 commit intodevfrom
Conversation
27da9ba to
ec4f641
Compare
…hema
Migrates all 13 part leaf schemas and the FilePartSource union to Effect Schema with derived .zod compatibility. ToolPart also moves, now referencing ToolState directly via Schema.Struct. The Part discriminated union stays Zod in this slice (migrates next). Also exports Schema-backed {Text,File,Agent,Subtask}PartInput with matching identifiers so prompt.ts PromptInput can reference them via .zod without re-inlining the part shapes. CommandInput keeps its (smaller) FilePart shape inlined since the SDK does not name that one with a $ref.
ec4f641 to
f93bc46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third piecemeal slice of the session-domain Effect Schema migration.
.zodcompatibility:SnapshotPart,PatchPart,TextPart,ReasoningPart,FileSource,SymbolSource,ResourceSource,FilePartSource,FilePart,AgentPart,CompactionPart,SubtaskPart,RetryPart,StepStartPart,StepFinishPart,ToolPart.ToolPartnow referencesToolStatedirectly viaSchema.Struct.ToolStateCompleted.attachmentsdrops theZodOverridebridge and usesSchema.Array(FilePart)directly.RetryPart.errorbridges toAPIError.SchemaviaZodOverridesince the error classes are stillNamedError-based Zod.*PartInputschemas inprompt.tssoz.discriminatedUnionkeeps its precise shape inference (the original.omit/.partialhelpers only existed on the raw Zod types).Acceptance check
bun typecheck(package + repo root) clean.bun run test→ 2010 pass / 0 fail.bun dev generatebyte-identical to committedpackages/sdk/openapi.json.packages/sdk/js/src/v2/gen/types.gen.tsunchanged afterbun script/build.ts.Follow-up
Part of the stacked session-schema migration series. The next slice (stacked PR) migrates the message aggregate DTOs (
User,Assistant,Partunion,Info,WithParts).