Skip to content

Conversation

@SilentDemonSD
Copy link

Overview 

Extended changes from : f902b76

What Changed

File Change
nodejs/src/types.ts Added selection attachment type to MessageOptions.attachments with filePath, displayName, selection?, text? fields
python/copilot/types.py Added SelectionRange, Selection, FileAttachment, DirectoryAttachment, SelectionAttachment TypedDicts; updated Attachment as union type
python/test_session_events.py New unit tests for session event types and attachment parsing (7 tests)

Compatibility

Language File Modified Uses Generated Types
Node.js types.ts No - inline types in MessageOptions
Python types.py No - separate TypedDicts for SDK users
Go None needed Yes - uses []Attachment from generated
.NET None needed Yes - uses List<UserMessageDataAttachmentsItem> from generated

3. Verification

  • Python: pytest test_session_events.py → 7 passed
  • Node.js: tsc --noEmit → No errors

Review & Summary generated via Copilot, Reviewed by myself manually !

Copilot AI review requested due to automatic review settings January 27, 2026 11:11
@SilentDemonSD SilentDemonSD requested a review from a team as a code owner January 27, 2026 11:11
@SilentDemonSD SilentDemonSD changed the title chore: update attachment types to include selection support in ts and py chore: update attachment types to include selection support Jan 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the Node.js and Python SDK attachment type definitions to support a new selection attachment shape consistent with the generated session_events types, and adds Python tests for session event/attachment parsing.

Changes:

  • Node.js: Extend MessageOptions.attachments to support selection attachments with filePath, displayName, optional selection range, and optional text, and tighten file/directory attachment typing.
  • Python: Introduce SelectionRange, Selection, and discriminated FileAttachment/DirectoryAttachment/SelectionAttachment TypedDicts, with Attachment as their union, and wire them into MessageOptions.
  • Python: Add test_session_events.py to validate generated SessionEventType enum values and Attachment.from_dict parsing for file, directory, and selection attachments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
nodejs/src/types.ts Extends MessageOptions.attachments to a discriminated union including selection attachments and makes displayName required for file and directory.
python/copilot/types.py Defines typed selection structures and discriminated attachment TypedDicts, updates Attachment to a union, and connects them to MessageOptions.attachments.
python/test_session_events.py Adds unit tests that exercise generated SessionEventType values and Attachment.from_dict behavior for the new and existing attachment variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

SilentDemonSD and others added 2 commits January 27, 2026 16:52
…ing)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@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.

1 participant