Repository navigation
feat(plugin): expose credential.activate to server plugins - #52797
Merged
rekram1-node merged 8 commits intoOct 13, 2026
Merged
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
…vate
Match the HTTP client like the other plugin domains: ctx.credential.activate({ credentialID })
is typed from Client["credential"] and adapted through the credential.activate endpoint,
instead of a positional plugin-only integration.connection.activate(id).
Session: ses_eedc354e4ffevSfxNa6i90GdAS
…nto v2-plugin-connection-activate
Open
1 task done
7 tasks
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.
Issue for this PR
Closes #51410
Type of change
What does this PR do?
Server plugins can list saved accounts (
ctx.integration.get(...).data.connections) but cannot switch the active one. The HTTP API already hasPOST /api/credential/:credentialID/activate(client.credential.activate, used by the TUI andopencode auth switch), but the server-plugin context had nocredentialdomain.This adds
ctx.credential.activate({ credentialID }), following the same convention as the other HTTP-backed plugin methods:Pick<CredentialApi, "activate">, likeplugin: Pick<PluginApi, "list">)adaptApiMethod(CredentialEndpoints["credential.activate"], ...)client.credential.activateOnly
activateis exposed.credential.listreturns secret values, so I left it out.I need it for a rate-limit fallback plugin: in the
retryhook it activates the next account of the same provider, and the retried attempt resolves the new credential.Changes:
client/src/promise/api.ts: exportCredentialApiplugin/src/{promise,effect}/plugin.ts:credential: Pick<CredentialApi, "activate">on the contextplugin/src/promise/adapter.ts: wired through thecredential.activateendpointcore/src/plugin/host.ts: wired tointegration.connection.activateHow did you verify your code works?
core/test/plugin.test.ts: a Promise plugin activates the older of two saved credentials,connection.activereturns itbun test test/pluginin core passes,bun run typecheckandbun run lintpass, pre-pushbun run checkpassesScreenshots / recordings
N/A
Checklist