feat(provider): add getModels() helper#19
Merged
Conversation
Merged
5 tasks
Resolves package.json version conflict: keep this branch's 0.1.0 bump (main is at 0.0.4; this PR ships new public API). README and provider.ts auto-merged cleanly. Resyncs bun.lock against acpx@0.8.0 — now published with the AcpRuntimeStatus.models surface this PR consumes.
6 tasks
There was a problem hiding this comment.
Pull request overview
Adds a typed AcpxProvider.getModels() convenience API so callers can retrieve the runtime-advertised session model list (currentModelId + availableModelIds) without digging into runtime.getStatus().details, alongside docs/tests and the dependency bump needed to consume the upstream status shape.
Changes:
- Add
AcpxProvider.getModels(opts?)that callsruntime.getStatus({ handle })and returnsstatus.models(orundefinedwhen unsupported/unadvertised). - Re-export
AcpRuntimeSessionModelsandAcpRuntimeStatustypes, and document the new helper in the provider README. - Bump
acpxpeer/dev dependency to>=0.8.0and add unit tests covering the new behavior.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/acpx-ai-provider/src/provider.ts | Adds the getModels() helper that reads status.models via runtime.getStatus. |
| packages/acpx-ai-provider/src/types.ts | Re-exports new runtime status/model types for downstream consumers. |
| packages/acpx-ai-provider/src/index.ts | Exposes the new re-exported types at the package surface. |
| packages/acpx-ai-provider/README.md | Documents “Listing models” usage and expected undefined cases. |
| packages/acpx-ai-provider/test/unit/provider.test.ts | Adds unit tests validating getModels() behavior across supported/unsupported runtimes. |
| packages/acpx-ai-provider/package.json | Bumps version and raises acpx peer/dev dependency to >=0.8.0. |
| bun.lock | Updates lockfile for new dependency range, but currently contains a workspace version mismatch for acpx-ai-provider. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dels # Conflicts: # bun.lock # packages/acpx-ai-provider/README.md # packages/acpx-ai-provider/package.json # packages/acpx-ai-provider/test/unit/provider.test.ts
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
Upstream: openclaw/acpx#300 — the runtime PR this provider change consumes.
Adds
AcpxProvider.getModels()— a typed helper that returns the agent's advertised model list (current + available IDs) with one call instead of reaching into the untypedruntime.getStatus().detailsbag.Unblocks the Gap 1 follow-up from the model-selection research — host UIs that want to render a model picker before the first prompt no longer need to type-cast through
details. Returningundefinedwhen no models were advertised lets callers branch cleanly on agents like Gemini CLI.What changed
package.json0.0.4→0.0.5.acpxpeer-dep + dev-dep raised to>=0.8.0(the upstream version that shipsAcpRuntimeStatus.models+AcpRuntimeSessionModelsvia openclaw/acpx#300).src/types.tsAcpRuntimeSessionModels+AcpRuntimeStatusfromacpx/runtime.src/provider.tsgetModels(opts?)onAcpxProvider— resolves a handle, callsruntime.getStatus, returns the typedmodelsfield (orundefinedwhen omitted / when the runtime has nogetStatusmethod).src/index.tsREADME.md## Listing modelssection after "Tools — via MCP servers".test/unit/provider.test.tsMockAcpRuntime: (1) returns themodelsfield verbatim when present, (2) returnsundefinedwhenstatusomitsmodels, (3) returnsundefinedwhen the runtime implementation has nogetStatusmethod at all.Test plan
bun run lintclean.bun run typecheckclean (passes against the now-publishedacpx@0.8.0).bun run fallowclean.bun test— 266 pass / 24 skip / 0 fail across the monorepo (290 tests, 30 files; the three new tests are part of the 266).bun run buildclean (ESM + .d.ts).Coordination
Ships alongside two sibling provider features that all target
0.0.5:onPermissionRequestcallbacksessionOptionsforwardingWhichever lands first wins
0.0.5; the other two will need a follow-up bump (0.0.5→0.0.6→0.0.7) and a one-linepackage.jsonrebase to resolve the version conflict. All three are independent on the code side.