Skip to content

Remove on_list_models constructor option from Client; keep only usingListModels()#34

Merged
kawax merged 2 commits intosdk-sync/2026-03-09-98a9c4c1d5830df5from
copilot/sub-pr-32
Mar 9, 2026
Merged

Remove on_list_models constructor option from Client; keep only usingListModels()#34
kawax merged 2 commits intosdk-sync/2026-03-09-98a9c4c1d5830df5from
copilot/sub-pr-32

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

Client::__construct() accepted an on_list_models option, but there is no forceClient() on CopilotManager to inject a custom-constructed client, making this option unreachable via the public API. The only viable API is the fluent usingListModels() method.

Changes

  • src/Client.php: Remove on_list_models extraction from $options in both the TCP and stdio constructor branches. Update listModels() docblock accordingly.
  • docs/jp/custom-providers.md: Remove the on_list_models / Copilot::forceClient() example entirely; retain only the usingListModels() usage.

Only supported pattern

$models = Copilot::client()->usingListModels(function (): array {
    return [
        ['id' => 'my-model-1', 'name' => 'My Model 1', 'version' => '1.0'],
    ];
})->listModels();

// Remove handler and fall back to CLI server
$models = Copilot::client()->usingListModels(null)->listModels();

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on agent parameter and onListModels handler Remove on_list_models constructor option from Client; keep only usingListModels() Mar 9, 2026
Copilot finished work on behalf of kawax March 9, 2026 09:39
@kawax kawax marked this pull request as ready for review March 9, 2026 09:41
@kawax kawax merged commit 40eb46e into sdk-sync/2026-03-09-98a9c4c1d5830df5 Mar 9, 2026
5 checks passed
@kawax kawax deleted the copilot/sub-pr-32 branch March 9, 2026 09:42
kawax added a commit that referenced this pull request Mar 9, 2026
…s handler (#32)

* Sync with copilot-sdk: add agent param and onListModels handler

- Add `agent` property to SessionConfig and ResumeSessionConfig for
  pre-selecting a custom agent when a session starts or resumes
- Add `on_list_models` callable option to Client for BYOK mode;
  when set, listModels() calls the handler instead of querying CLI
- Pass `agent` in session.create and session.resume RPC requests
- Update submodule pointer to e478657 (396e8b3..e478657)
- Update docs/jp/session-config.md and docs/jp/custom-providers.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add `usingListModels()` fluent method to Client (#33)

* Initial plan

* Add usingListModels() fluent method to Client and update docs

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

* Remove `on_list_models` constructor option from Client; keep only `usingListModels()` (#34)

* Initial plan

* Remove on_list_models constructor option, keep only usingListModels

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

* Add tests for `agent` parameter and `usingListModels()` (#35)

* Initial plan

* Add tests for agent parameter and usingListModels

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>

---------

Co-authored-by: GitHub Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants