What
Running packages/sdk/js/script/build.ts on a clean checkout of main regenerates src/v2/gen/types.gen.ts with a ~12k-line diff (and sdk.gen.ts changes), then fails at its trailing tsc step. The committed v2 gen tree and the output of bun dev generate + codegen have drifted apart.
Why it matters
script/publish.ts runs build.ts inside prepareReleaseFiles() on every release, so what ships in @opencode-ai/sdk/v2 is the regenerated tree — not the reviewed, committed one. Any post-codegen patch (SseFn, and the JSON-parse guard being added in the non-JSON-response PR) is only as reproducible as this tree.
Evidence
Observed while adding a "SDK codegen is reproducible" CI check for the non-JSON-response PR: the patched client/client.gen.ts round-trips byte-for-byte, but types.gen.ts does not, so the check had to be scoped to the patched file. The build's final tsc fails on the regenerated types (e.g. FileSystemEntry no longer exported).
Suggested fix
Regenerate and commit the v2 gen tree from current main, then widen the CI check to git diff --exit-code -- src/v2/gen so it can never drift silently again.
What
Running
packages/sdk/js/script/build.tson a clean checkout ofmainregeneratessrc/v2/gen/types.gen.tswith a ~12k-line diff (andsdk.gen.tschanges), then fails at its trailingtscstep. The committed v2 gen tree and the output ofbun dev generate+ codegen have drifted apart.Why it matters
script/publish.tsrunsbuild.tsinsideprepareReleaseFiles()on every release, so what ships in@opencode-ai/sdk/v2is the regenerated tree — not the reviewed, committed one. Any post-codegen patch (SseFn, and the JSON-parse guard being added in the non-JSON-response PR) is only as reproducible as this tree.Evidence
Observed while adding a "SDK codegen is reproducible" CI check for the non-JSON-response PR: the patched
client/client.gen.tsround-trips byte-for-byte, buttypes.gen.tsdoes not, so the check had to be scoped to the patched file. The build's finaltscfails on the regenerated types (e.g.FileSystemEntryno longer exported).Suggested fix
Regenerate and commit the v2 gen tree from current
main, then widen the CI check togit diff --exit-code -- src/v2/genso it can never drift silently again.