Skip to content

feat: sdk regeneration 2026-05-06 with backward-compat preserved#497

Merged
GregHolmes merged 9 commits into
mainfrom
gh/sdk-gen-2026-05-06
May 12, 2026
Merged

feat: sdk regeneration 2026-05-06 with backward-compat preserved#497
GregHolmes merged 9 commits into
mainfrom
gh/sdk-gen-2026-05-06

Conversation

@GregHolmes

@GregHolmes GregHolmes commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Pulls in the 2026-05-06 Fern regeneration along with the manual patches and backward-compat shims needed to keep the public TypeScript surface stable. No breaking changes for downstream consumers.

What the regen brings (additive)

  • Audio encoding/container values: Mp3, Opus, Flac, Aac added to AgentV1Settings.Audio.Output.Encoding; new Container enum (None, Wav, Ogg) replaces the loose string typing on container? (still includes string, so non-breaking).
  • New types: AgentV1SettingsAgentContextListenProvider (with V2 language_hint support), OpenAiThinkProvider; new fields on Groq, ListProjectMembersV1Response, ListenV2ConfigureSuccess, SpeakV1Metadata.
  • Agent-by-ID: AgentV1Settings.Agent is now {...} | string, so callers may pass an agent ID directly. Mirrors the Python SDK's Union[str, AgentV1SettingsAgentContext].

Manual patches re-applied

  • package.json — restore project devDeps (commitlint, tsx, playwright, vite, terser pinned for the .npmrc minimum-release-age policy) and bump @types/node to ^20.17.57.
  • src/api/resources/manage/.../keys/client/Client.ts — keep the request body optional on manage.v1.projects.keys.create so older callers stay source-compatible.
  • src/api/types/CreateKeyV1Request.ts — preserve the legacy CreateKeyV1RequestOne alias.
  • biome.json — restore vcs.useIgnoreFile = true so generated browser artifacts under examples/ stay out of lint.

Backward-compat shims (new this regen)

The regen restructured AgentV1Settings.Agent from an interface with named sub-types into a union with anonymous shapes, which would have removed AgentV1Settings.Agent.Context, Agent.Listen, Agent.Think, Agent.Speak, and Agent.Context.Messages.Item.

AgentV1Settings.ts is now in .fernignore (temporarily-frozen) with a hand-applied namespace block that uses TypeScript declaration merging to re-publish those sub-types as aliases derived from Exclude<Agent, string>. Mirrors the pattern used by the Python SDK for the same regen. Regression coverage in tests/unit/compat-aliases.test.ts (5 new cases).

The parallel AgentV1SettingsAgentListenProviderAgentV1SettingsAgentContextListenProvider rename gets a one-line type alias (with namespace merge for .V1/.V2) so pinned-name callers (const p: AgentV1SettingsAgentListenProvider = ...) keep compiling without a cast. Purely additive at the type level — the new V2 only adds an optional language_hint. File added to .fernignore; Equals<X, Y> identity assertions in tests/unit/compat-aliases.test.ts.

Repository hygiene

  • One-time biome format --write pass over 91 hand-maintained files that were authored with 2-space indent before the project's biome.json standardised on 4-space. Pure whitespace, no behaviour change. make lint is now clean.

Test plan

  • make build — TypeScript and ESM build pass
  • make test — 533 unit + 132 wire tests pass (compat-aliases now covers Agent namespace, listen-provider alias, and keys.create no-arg)
  • make test-esm — ESM build validation pass
  • make lint — clean (down from 91 format errors)
  • Verify AgentV1Settings.Agent.Context, Agent.Listen, Agent.Context.Messages.Item etc. still resolve via the regression test
  • Confirm AgentV1SettingsAgentListenProvider is type-identical to AgentV1SettingsAgentContextListenProvider via the alias

GregHolmes added 2 commits May 6, 2026 14:40
Empty commit to open the regen PR. Subsequent commit will unfreeze
files for Fern to overwrite.
Swap the three temporarily-frozen .fernignore entries to .bak so Fern
can overwrite the originals while our patched copies stay protected:
- package.json (devDeps + @types/node pin)
- src/api/resources/manage/.../keys/client/Client.ts (optional request)
- src/api/types/CreateKeyV1Request.ts (CreateKeyV1RequestOne alias)

Per AGENTS.md "Prepare repo for regeneration".
@GregHolmes GregHolmes requested a review from lukeocodes as a code owner May 6, 2026 13:41
@GregHolmes GregHolmes changed the title chore: SDK regeneration 2026-05-06 chore: sdk regeneration 2026-05-06 May 6, 2026
fern-api Bot and others added 2 commits May 6, 2026 14:34
All three temporarily-frozen Fern files still need their patches:

- package.json: restore extra devDeps (commitlint, tsx, playwright,
  vite, terser pinned for the .npmrc minimum-release-age policy) and
  bump @types/node to ^20.17.57.
- src/api/resources/manage/.../keys/client/Client.ts: keep the
  request body optional on manage.v1.projects.keys.create so older
  callers stay source-compatible.
- src/api/types/CreateKeyV1Request.ts: preserve the legacy
  CreateKeyV1RequestOne alias.

Also re-apply the biome.json vcs.useIgnoreFile=true patch that Fern
resets each regen (same fix as d2b8d62) so generated browser
artifacts under examples/ stay out of lint.

.fernignore entries swapped back from .bak to original paths and the
.bak files removed. pnpm-lock.yaml regenerated against the patched
package.json.
@GregHolmes GregHolmes force-pushed the gh/sdk-gen-2026-05-06 branch from 65c8bd2 to 07beb34 Compare May 6, 2026 14:43
GregHolmes added 2 commits May 6, 2026 16:01
Reformat 91 hand-maintained files to match biome.json's indentWidth: 4.
These files were originally authored with 2-space indent before the
biome config was added; the formatter has been failing on them ever
since. Generated files under src/api/** were already 4-space and
unaffected.

Pure mechanical reformat — no behavior changes. make build/test pass.
The 2026-05-06 regen restructured AgentV1Settings.Agent from an
interface with named sub-types (Context, Listen, Think, Speak,
Context.Messages.Item) into a union with anonymous shapes plus a
string variant for agent-by-ID. Sub-type imports like
AgentV1Settings.Agent.Context.Messages.Item would have broken at
TypeScript level.

Re-publish the old sub-type names via TypeScript declaration merging:
the new \`type Agent = {...} | string\` alias coexists with a
\`namespace Agent { ... }\` block that derives Context, Listen,
Think, Speak, and Context.Messages.Item from Exclude<Agent, string>.
Mirrors the Python SDK's backward-compat shims for the same regen.

Freeze the file in .fernignore (temporarily-frozen, swap to .bak
before next regen) and document in AGENTS.md alongside the other
patched files. Add regression coverage in compat-aliases.test.ts:
five new cases that assert the sub-types resolve and accept the
expected shapes.

Structural typing handles the parallel AgentV1SettingsAgentListenProvider
→ AgentV1SettingsAgentContextListenProvider rename for free; both
types are bidirectionally assignable, so no shim needed there.
@GregHolmes GregHolmes changed the title chore: sdk regeneration 2026-05-06 feat: SDK regeneration 2026-05-06 with backward-compat preserved May 6, 2026
@GregHolmes GregHolmes changed the title feat: SDK regeneration 2026-05-06 with backward-compat preserved feat: sdk regeneration 2026-05-06 with backward-compat preserved May 6, 2026
GregHolmes added 2 commits May 6, 2026 17:06
Strengthens the AgentV1Settings.Agent back-compat shim from "restore
sub-types only" to "fully restore the original interface form".

The 2026-05-06 regen restructured Agent into `{...} | string`. Sub-type
imports (Agent.Context, Agent.Listen, etc.) were already covered by a
namespace-merge shim, but the union widening still broke read-side
patterns: `settings.agent.context?.messages` and `settings.agent.greeting`
required typeof narrowing in TS strict mode where they did not before.

Replace the union+namespace-merge shim with the original interface
declaration plus a sibling namespace for the sub-types. Direct field
reads on `AgentV1Settings.agent` now type-check without narrowing —
matching the pre-regen contract exactly.

The new agent-by-ID-string variant is preserved as the opt-in alias
`AgentV1Settings.AgentReference = Agent | string`. Callers who want to
pass a string agent ID at the type level use that alias (or cast);
callers who keep using object-shaped agent settings see no change.

Add three new compat-aliases test cases:
- direct read-without-narrowing on `settings.agent.{context,greeting}`
- `AgentReference` accepts both an Agent object and a string ID
- bidirectional assignability between AgentV1SettingsAgentListenProvider
  and AgentV1SettingsAgentContextListenProvider (locks in the structural
  compat the previous regen review noted)

Update .fernignore comment and AGENTS.md to describe the stronger
approach. Compat tests now 13 pass (was 9).
…Provider

  The 2026-05-06 regen renamed this type to AgentV1SettingsAgentContextListenProvider
  (the new V2 adds an optional language_hint field). Replace the regenerated
  duplicate with a one-line alias to the new canonical name plus namespace merge
  for .V1/.V2, so pinned-name callers (`const p: AgentV1SettingsAgentListenProvider
  = ...`) keep compiling without a cast. Purely additive at the type level — the
  old V2 is a subset of the new V2.

  - src/api/resources/.../AgentV1SettingsAgentListenProvider.ts: alias body
  - .fernignore + AGENTS.md: track the alias as a temporarily-frozen entry
  - tests/unit/compat-aliases.test.ts: Equals<X, Y> identity assertions for the
    alias (top-level + .V1 + .V2), plus compile-time call-site assertions for the
    pre-existing keys.create(request?) optionality patc
@GregHolmes GregHolmes self-assigned this May 7, 2026
@lukeocodes lukeocodes requested a review from Copilot May 7, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@lukeocodes lukeocodes requested a review from Copilot May 8, 2026 12:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@lukeocodes lukeocodes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly clean regen. all the back-compat shims are intact on the head branch and tests/unit/compat-aliases.test.ts locks the alias names with Equals<X, Y> identity checks that fail at compile time if a future regen drifts them. nothing here breaks an existing caller.

what the shims achieve:

  • AgentV1Settings.Agent would have collapsed from an interface with named sub-types into {...} | string, deleting Agent.Context, Agent.Listen, Agent.Context.Messages.Item, Agent.Think, Agent.Speak. the .fernignore swap restores the interface form so direct reads like settings.agent.context?.messages keep type-checking in strict mode without typeof narrowing.
  • AgentV1SettingsAgentListenProvider was renamed to AgentV1SettingsAgentContextListenProvider. one-line type alias plus namespace declaration-merge republishes .V1 and .V2, both names co-exported from the resource barrel. legacy V2 literals without language_hint still compile (covered by tests/unit/compat-aliases.test.ts:194-203).
  • keys.create(project_id) no-body call site stays valid via the existing request? optionality patch on KeysClient. compat-aliases test exercises both the no-body and with-body forms.

two things worth flagging, neither blocking:

  1. Audio.Output.container tightens from string | undefined to Container | undefined where Container = "none" | "wav" | "ogg" | string. the | string fallback keeps runtime safe and old callers passing arbitrary strings still type-check, but no test pins that fallback. one-line literal-assignment in compat-aliases.test.ts would lock it:

    const _looseContainer: AgentV1Settings.Audio.Output = { container: "flac" };
  2. AgentV1Settings.AgentReference = Agent | string is the right escape hatch for the new agent-by-ID flow, but AgentV1Settings.agent is still typed Agent, not AgentReference. so:

    const settings: AgentV1Settings = { type: "Settings", audio: {...}, agent: "agent_123" }; // TYPE ERROR

    users only discover this when they try. the python sdk exposes the equivalent as Union[str, AgentV1SettingsAgentContext] at the parent level. either add a docstring on AgentReference showing the cast pattern, or queue typing the parent field as AgentReference for v6.

everything else is purely additive: Audio.Output.Encoding (+ Mp3/Opus/Flac/Aac), Audio.Output.Container enum, AgentReference alias, AgentV1ConversationText.languages_hinted/languages, ListenV2ConfigureSuccess.language_hints, SpeakV1Metadata.additional_model_uuids, Groq.reasoning_mode + ReasoningMode enum, new OpenAiThinkProvider, ListProjectMembersV1Response.Members.Item (+ scopes/first_name/last_name, wire-tested in tests/wire/manage/v1/projects/members.test.ts:17-25).

src/CustomClient.ts is 100% biome reformatting despite the 82+60- diff. 91 hand-maintained files reformatted with biome format --write over 2-space → 4-space indent, no behaviour change.

ship it.

@GregHolmes GregHolmes merged commit 2aed53e into main May 12, 2026
8 checks passed
@GregHolmes GregHolmes deleted the gh/sdk-gen-2026-05-06 branch May 12, 2026 10:41
GregHolmes added a commit that referenced this pull request May 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[5.2.0](v5.1.0...v5.2.0)
(2026-05-12)


### Features

* alias AgentV1SettingsAgentListenProvider to
*AgentContextListenProvider
([150e663](150e663))
* preserve AgentV1Settings.Agent sub-types after regen
([2efab2d](2efab2d))
* preserve SDK compatibility after regen
([d2b8d62](d2b8d62))
* restore Agent interface, add AgentReference for string-id flow
([4c72d31](4c72d31))
* sdk regeneration 2026-04-30
([#491](#491))
([a618282](a618282))
* sdk regeneration 2026-05-06 with backward-compat preserved
([#497](#497))
([2aed53e](2aed53e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants