Skip to content

Add on.error handler to AgentClient lifecycle events#22

Merged
willwashburn merged 2 commits into
ts-sdk-improvmentsfrom
copilot/sub-pr-20
Feb 16, 2026
Merged

Add on.error handler to AgentClient lifecycle events#22
willwashburn merged 2 commits into
ts-sdk-improvmentsfrom
copilot/sub-pr-20

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

The WsClient emits error events, but AgentClient.on had no typed handler for them—users could only access errors via the wildcard on.any handler.

Changes

  • Added on.error lifecycle handler to AgentClient.on object, matching the pattern of on.connected and on.disconnected

Usage

const client = new AgentClient({ apiKey: 'your-key' });
client.connect();

// Now available alongside other lifecycle handlers
client.on.error(() => {
  console.log('WebSocket error occurred');
});

client.on.connected(() => { /* ... */ });
client.on.disconnected(() => { /* ... */ });
client.on.reconnecting((attempt) => { /* ... */ });

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: willwashburn <957608+willwashburn@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workspace/agent management APIs and WS events Add on.error handler to AgentClient lifecycle events Feb 16, 2026
Copilot AI requested a review from willwashburn February 16, 2026 19:42
@willwashburn willwashburn marked this pull request as ready for review February 16, 2026 20:04
@willwashburn willwashburn merged commit 02aa270 into ts-sdk-improvments Feb 16, 2026
@willwashburn willwashburn deleted the copilot/sub-pr-20 branch February 16, 2026 20:05
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