feat: make adapter internals protected to enable subclassing#475
Merged
Conversation
Contributor
|
@slmnsh is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
…xtension surface Narrow scope of vercel#475: caches, polling/runtime state, and one-shot warning flags stay private. Methods and shared helpers (logger, formatConverter, chat, config) remain protected as the documented extension surface. Also fixes a typecheck failure where gchat's oauth2Client (now private) no longer requires a portable type for the emitted .d.ts.
Each adapter now has a compile-time test that subclasses can access the documented protected surface. If any of these members revert to private, the test file fails to type-check.
These three protected static cache TTLs are configuration constants, not mutable state. Marking them readonly prevents subclasses (the new extension surface from this PR) from mutating values shared across every instance in-process.
Mirrors the inline comment from the Telegram subclass test across the other nine adapter tests so future readers immediately understand these blocks are type-only sentinels — they fail at typecheck (not vitest) if a member reverts to private.
Adds a "Customizing an adapter via subclassing" section to the Adapters page that walks through extending an official adapter to override a protected hook (using the issue vercel#433 Telegram processUpdate scenario as the canonical example) and clarifies that private members are intentionally off-limits.
The surrounding refreshClientCredentialsToken and ensureValidToken methods are now protected, but accessTokenExpiry was kept private — meaning a subclass overriding either method couldn't read or update the expiry without calling super. Flipping it to protected lets subclasses fully reimplement the token-refresh flow.
This PR adds a new, additive capability — subclassing official adapters to override protected hooks. Per CONTRIBUTING.md, additive backward-compatible features warrant a minor bump rather than a patch.
Contributor
Author
|
Thanks @bensabic, is there anything else left on this? |
Correct the parenthetical describing what stays `private` (credentials are now `protected`) and add a callout warning that the `protected` extension surface is intentionally broader than the public API but not yet fully stable, so subclass authors know to pin versions and prefer overriding the smallest hook.
bensabic
added a commit
that referenced
this pull request
May 11, 2026
…erge The merge of main into konsistent brought in PR #475's `protected` field modifiers on top of the WebAdapterOptions → WebAdapterConfig rename, leaving two stale references to the (un-imported) old name. Switch them to WebAdapterConfig and update a stale JSDoc reference in als.ts to match.
bensabic
added a commit
that referenced
this pull request
May 11, 2026
…pter, and state adapter conventions (#466) * set up konsistent with basic initial config * add konsistent to CI * fix konsistent.json formatting * fix(gchat): move GoogleChatAdapterConfig to ./types for konsistent * fix(slack): move SlackAdapterConfig to ./types and drop Partial wrapper from createSlackAdapter * fix(messenger): name createMessengerAdapter parameter MessengerAdapterConfig * fix(web): rename WebAdapterOptions to WebAdapterConfig and import Adapter type in index.ts * fix(whatsapp): align WhatsAppAdapterConfig and creator with konsistent + map kebab to PascalCase * fix(state-memory): add MemoryStateAdapterOptions type for konsistent * fix(state-ioredis): unify URL and client options under IoRedisStateAdapterOptions * fix(state-redis): unify URL and client options under RedisStateAdapterOptions * fix(state-pg): unify URL and client options under PostgresStateAdapterOptions * chore: changeset for konsistent convention alignment * chore: drop CHANGELOG.md from konsistent's required files list CHANGELOG.md is generated automatically by changesets on each release — it's never hand-authored and doesn't exist for a package until its first release lands. Requiring it as a convention check makes CI fail indefinitely for any newly added package, with no honest fix available (an empty placeholder is just noise that gets overwritten on first release). * docs: document konsistent and package shape conventions * fix(web): use WebAdapterConfig in WebAdapter field types after main merge The merge of main into konsistent brought in PR #475's `protected` field modifiers on top of the WebAdapterOptions → WebAdapterConfig rename, leaving two stale references to the (un-imported) old name. Switch them to WebAdapterConfig and update a stale JSDoc reference in als.ts to match. --------- Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com> Co-authored-by: Ben Sabic <27636870+bensabic@users.noreply.github.com>
This was referenced May 29, 2026
patrick-chinchill
added a commit
to Chinchill-AI/chat-sdk-python
that referenced
this pull request
May 29, 2026
Alpha sync starter for upstream chat@4.29.0 (release commit 6581d31, May 18 2026). Upstream skipped tagging chat@4.27.0 and chat@4.28.0; chat@4.29.0 is the next real tag. - Bumps version → 0.4.29a1 - Bumps UPSTREAM_PARITY → "4.29.0" - Updates README, CLAUDE.md, CHANGELOG with in-flight status and full porting plan Pre-audit (this session's scoping subagents) found two items already done in 0.4.27 — no work needed: - vercel/chat#446 (Telegram MarkdownV2 streaming-chunk safety trim) — PR #89 helpers cover it - vercel/chat#475 (private → protected internals) — Python _underscore convention already provides this Detailed scope, design issues (#109 chat/ai, #110 Messenger), and open questions in CHANGELOG entry. Tracking issue: #98.
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
Fixes #433
Test plan
Checklist
pnpm validatepasses