Skip to content

Add tests for agent parameter and usingListModels()#35

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

Add tests for agent parameter and usingListModels()#35
kawax merged 2 commits intosdk-sync/2026-03-09-98a9c4c1d5830df5from
copilot/sub-pr-32

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

Tests were missing for two features added in the SDK sync: the agent parameter on session config types and the usingListModels() fluent method on Client.

SessionConfig / ResumeSessionConfigagent field

  • Expanded "all fields" fromArray / toArray tests to include agent
  • Updated "minimal fields" tests to assert agent is null
  • Added dedicated tests: constructor, toArray serialisation, fromArray parsing, null-exclusion from toArray

ClientusingListModels()

  • Fluent interface returns $client (no CLI connection required)
  • listModels() invokes the handler and returns ModelInfo[]
  • usingListModels(null) accepted without error
  • Empty handler returns []
$client = new Client;
$models = $client->usingListModels(fn () => [
    ['id' => 'my-model', 'name' => 'My Model', 'capabilities' => [...]],
])->listModels();

// $models[0] is a ModelInfo instance — no CLI connection needed

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Copilot AI changed the title [WIP] Sync with copilot-sdk: add agent parameter and onListModels handler Add tests for agent parameter and usingListModels() Mar 9, 2026
Copilot finished work on behalf of kawax March 9, 2026 09:56
@kawax kawax marked this pull request as ready for review March 9, 2026 10:00
@kawax kawax merged commit c663b45 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 10:01
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