Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Ports changes from github/copilot-sdk#346 which adds TUI+server mode support for managing sessions displayed in the Copilot CLI terminal UI.

New Types

  • SessionLifecycleEventType enum: session.created, session.deleted, session.updated, session.foreground, session.background
  • SessionLifecycleEvent readonly class with type, sessionId, and optional metadata
  • ForegroundSessionInfo readonly class for foreground session data

Client Methods

  • getForegroundSessionId() - Get current TUI-displayed session
  • setForegroundSessionId(string) - Switch TUI to show specific session
  • onLifecycle(callable) - Subscribe to lifecycle events (returns unsubscribe fn)

Other Changes

  • Process flag: --server--headless
  • Added session.snapshot_rewind, session.shutdown, skill.invoked to SessionEventType enum
  • Japanese docs: docs/jp/session-lifecycle.md

Usage

use Revolution\Copilot\Facades\Copilot;
use Revolution\Copilot\Types\SessionLifecycleEvent;

$client = Copilot::client();

// Subscribe to lifecycle events
$unsubscribe = $client->onLifecycle(function (SessionLifecycleEvent $event) {
    info("Session {$event->type->value}: {$event->sessionId}");
});

// Manage foreground session (TUI+server mode)
$sessionId = $client->getForegroundSessionId();
$client->setForegroundSessionId('session-123');

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Copilot AI changed the title [WIP] Update official SDK and session lifecycle documentation Sync with official SDK PR #346: SessionLifecycle events and headless flag Feb 3, 2026
Copilot AI requested a review from kawax February 3, 2026 23:41
@kawax kawax marked this pull request as ready for review February 3, 2026 23:47
@kawax kawax merged commit 5575827 into main Feb 3, 2026
5 checks passed
@kawax kawax deleted the copilot/update-official-sdk branch February 3, 2026 23:48
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