feat(wrapper-ts): add listAllModels() for aggregate provider discovery#54
Merged
Conversation
Add a new listAllModels() function to expose the engine's aggregate provider discovery mode, which queries all configured providers in parallel and returns per-provider results with auth status. Design choices: - Separate function (not overload) due to structurally different envelope type - Extracted runModelsListSubprocess() and interpretOutcome() helpers for code reuse - Status field intentionally free-form string to permit future engine additions - Existing listModels() behavior unchanged; backward compatible Testing: - 11 new test cases (A1-A11) mirror existing 9 for listModels - All 124 tests pass - Asserts correct argv construction (omits --provider in aggregate mode) Motivates paperclip's amplifier-local adapter to use dynamic model discovery instead of static list or 4 parallel single-provider calls. Requires: engine PR #49+ for amplifier-agent models list aggregate mode support 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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
Add a new
listAllModels()function to the TypeScript wrapper, exposing the engine's aggregate provider discovery mode introduced in #49.Motivation
The paperclip adapter currently uses a static list of models when selecting which provider/model to use. The ideal flow is:
listAllModels()once to get all available models across all configured providersokvscredentials_missingvsmodule_not_installed)With the engine's existing aggregate mode (
amplifier-agent models listwith no--providerflag), this is now efficient and straightforward.Design
Separate function, not overload:
listAllModels()is a distinct exported function returning a different envelope typelistModels(provider)behavior is unchanged and fully backward compatibleStatus is a free-form string:
ok | credentials_missing | module_not_installed | errortoday"ok"rather than exhaustive enumsRefactored helpers for code reuse:
runModelsListSubprocess(args, options)andinterpretOutcome(outcome, validate)listModelsandlistAllModelsshare the same subprocess driver + exit-code interpretationlistModels()callersTesting
results[]field)pnpm test)--providerin aggregate mode, includes it in single-provider)Engine compatibility
Requires engine ≥ #49 (merged into main at commit e48a644). The aggregate CLI endpoint is already live — no engine changes in this PR.
Backward compatibility
Zero breaking changes. Existing
listModels(provider)callers see no change in signature, behavior, or error types.