feat(sdk): support per-user Vercel Connect subjects - #125
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
Merged
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
GithubConnectParamsnow accepts asubject; the default stays{ type: 'app' }(the project's GitHub App installation), so nothing changes for existing consumers.connect.subjectalso accepts a per-caller resolver called with the tool execution context on every call — e.g.(ctx) => ({ type: 'user', id: ctx.session.auth.current!.principalId }). Multi-user apps where each user connects their own GitHub account can now mint each caller's own connection token instead of routing everyone through the shared app installation. A caller without an active connection getsUserAuthorizationRequiredErrorfrom Connect rather than silently falling back to the app token.ToolContextfromexecuteinto token resolution; the token is minted lazily, per tool call. The durable-callback AST guard still passes — callbacks stay inline and only gain thectxparameter.Docs updated (Vercel Connect guide "Per-user tokens", eve extension page, API reference, published skill, extension README) plus a minor changeset for both packages.
Test plan
pnpm build,pnpm lint,pnpm typecheck,pnpm testall green (91 SDK tests, extension AST guard)getTokeninstead of the app default