Skip to content

[sdk-sync] Sync with copilot-sdk: add agent parameter and onListModels handler#32

Merged
kawax merged 4 commits intomainfrom
sdk-sync/2026-03-09-98a9c4c1d5830df5
Mar 9, 2026
Merged

[sdk-sync] Sync with copilot-sdk: add agent parameter and onListModels handler#32
kawax merged 4 commits intomainfrom
sdk-sync/2026-03-09-98a9c4c1d5830df5

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 9, 2026

Official SDK Commit Range

396e8b3..e478657 (compare on GitHub)

Summary of Changes Detected

Two new features from the official SDK (commits 7766b1a and e478657):

  1. agent parameter in SessionConfig / ResumeSessionConfig — lets callers pre-select a custom agent by name when creating or resuming a session, without needing a follow-up session.rpc.agent.select() call.

  2. onListModels handler in CopilotClientOptions — a custom callable for BYOK mode: when set, client.listModels() calls the handler instead of querying the CLI server. Useful when the CLI is not connected but model metadata is still needed.

Laravel Files Modified

File Change
copilot-sdk Submodule pointer updated to e478657
src/Types/SessionConfig.php Added agent?: string property
src/Types/ResumeSessionConfig.php Added agent?: string property
src/Client.php Added $onListModels property; updated constructor to read on_list_models from options; updated listModels() to call custom handler first; added agent to session.create and session.resume RPC payloads
docs/jp/session-config.md Documented the new agent parameter
docs/jp/custom-providers.md Documented the new on_list_models option

Breaking Changes

None. All new fields are optional (?string, ?callable). Existing code continues to work unchanged.

Usage Examples

// Pre-select a custom agent when creating a session
$response = Copilot::run(
    prompt: 'Review this code',
    config: new SessionConfig(
        customAgents: [['name' => 'reviewer', ...]],
        agent: 'reviewer', // activate immediately on session start
    ),
);

// BYOK: provide models without connecting to CLI
$models = Copilot::client()->usingListModels(function (): array {
    return [
        ['id' => 'my-model-1', 'name' => 'My Model 1', 'version' => '1.0'],
        ['id' => 'my-model-2', 'name' => 'My Model 2', 'version' => '2.0'],
    ];
})->listModels(); // no CLI connection required

Generated by SDK Sync ·

- 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>
Copy link
Contributor

Copilot AI commented Mar 9, 2026

@kawax I've opened a new pull request, #33, to work on those changes. Once the pull request is ready, I'll request review from you.

* 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>
Copy link
Contributor

Copilot AI commented Mar 9, 2026

@kawax I've opened a new pull request, #34, to work on those changes. Once the pull request is ready, I'll request review from you.

…ingListModels()` (#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>
@kawax
Copy link
Member

kawax commented Mar 9, 2026

@copilot テストを追加

Copy link
Contributor

Copilot AI commented Mar 9, 2026

@kawax I've opened a new pull request, #35, to work on those changes. Once the pull request is ready, I'll request review from you.

* 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>
@kawax kawax marked this pull request as ready for review March 9, 2026 10:04
@kawax kawax merged commit eb56588 into main Mar 9, 2026
5 checks passed
@kawax kawax deleted the sdk-sync/2026-03-09-98a9c4c1d5830df5 branch March 9, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants