feat(coding-agent): flush registerProvider immediately, add unregisterProvider#1669
Closed
aliou wants to merge 1 commit intobadlogic:mainfrom
Closed
feat(coding-agent): flush registerProvider immediately, add unregisterProvider#1669aliou wants to merge 1 commit intobadlogic:mainfrom
aliou wants to merge 1 commit intobadlogic:mainfrom
Conversation
Contributor
|
Hi @aliou, thanks for your interest in contributing! We ask new contributors to open an issue first before submitting a PR. This helps us discuss the approach and avoid wasted effort. Next steps:
This PR will be closed automatically. See https://github.com/badlogic/pi-mono/blob/main/CONTRIBUTING.md for more details. |
Contributor
Author
|
For more context, i noticed when using two extensions together:
Without this, the providers model wouldn't be accessible after the apertures updates it. |
…, add unregisterProvider
975de88 to
2ea1530
Compare
Owner
|
Merged into main with fixes: queue unregister now removes all matching entries (not just first), types/docs aligned, OAuth/API registrations reset on refresh, tests added. Thanks @aliou! |
Contributor
Author
|
Thanks! |
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.
Problem
pi.registerProvider()pushed to apendingProviderRegistrationsqueue that was only flushed once duringbindCore()at startup. Any call after that (e.g. from a command handler following a setup flow) sat dead in the queue until the next/reload.Changes
model-registry.ts— AddedModelRegistry.unregisterProvider(name): removes the provider fromregisteredProviders, clears its API key, then callsrefresh()so built-in models that were overridden are restored.extensions/types.ts— AddedregisterProviderandunregisterProviderfields toExtensionRuntimeStateso the runner can swap them out after bind. Addedpi.unregisterProvider()toExtensionAPI.extensions/loader.ts—createExtensionRuntime()initialisesregisterProvideras a queue-push closure andunregisterProvideras a queue-removal closure.createExtensionAPIdelegates both to the runtime instead of touching the queue directly.extensions/runner.ts— InbindCore(), after flushing the pending queue, both functions are replaced with directModelRegistrycalls. From that point everypi.registerProvider()/pi.unregisterProvider()call takes effect immediately.docs/extensions.md— Updatedpi.registerProvidersection to document the immediate-flush behaviour; addedpi.unregisterProvidersection with example.CHANGELOG.md— AddedAddedandFixedentries under[Unreleased].