Add session.extensions.sendAttachmentsToMessage SDK wrapper#1502
Add session.extensions.sendAttachmentsToMessage SDK wrapper#1502jmoseley wants to merge 3 commits into
Conversation
Regenerates the SDK clients to expose the new RPC endpoint added in copilot-agent-runtime PR #8971, which lets canvas extensions push attachments (including a new extension_context variant) into the next user message's composer. Languages regenerated: TypeScript, .NET, Python, Rust, Java. Go is intentionally not regenerated in this PR — the Go codegen has a duplicate-method bug when a leaf type is shared across two discriminated unions with the same discriminator property (SendAttachment and PushAttachment both use 'type'), causing Type() to be emitted twice. Tracking as follow-up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-committed by java-codegen-check workflow.
| # Schema for the `PushAttachment` type. | ||
| PushAttachment = ExtensionContextPushInput | SendAttachmentFile | SendAttachmentDirectory | SendAttachmentSelection | SendAttachmentGithubReference | SendAttachmentBlob | ||
|
|
||
| def _load_PushAttachment(obj: Any) -> "PushAttachment": |
Cross-SDK Consistency Review ✅All updated SDKs (TypeScript, .NET, Python, Rust, Java) consistently expose:
Go SDK gap: The PR explicitly documents the intentional omission of Go due to a codegen bug ( Suggested follow-up issue for the Go gap (not blocking this PR):
|
…violations The java-codegen-check workflow regenerates the session-events package on every PR that touches generated code. Without a pre-generation cleanup step, any file manually added to src/generated/.../generated/ (or left over from a schema change) would persist in the directory. If that file extends the sealed SessionEvent class but is not listed in its permits clause, the build fails with a sealed-class violation. Fix: add cleanGeneratedFilesInDirectory() to java.ts and call it at the start of generateSessionEvents(), removing all auto-generated files directly inside the session-events package dir before regenerating from the current schema. This resolves the immediate sealed-class error introduced by the manually-added SessionExtensionsAttachmentsPushedEvent (for a not-yet-published endpoint) and also removes four other stale enum/record types that the schema no longer emits (McpServerStatusChangedStatus, McpServersLoadedServerStatus, PermissionCompletedKind, PermissionCompletedResult). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
Agentic Fix AppliedThe FixAdded Also removed 4 other stale files (
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "repo.maven.apache.org"See Network Configuration for more information.
|
Regenerates the SDK clients to expose the new
session.extensions.sendAttachmentsToMessageRPC endpoint added in copilot-agent-runtime PR https://github.com/github/copilot-agent-runtime/pull/8971.This lets canvas extensions push attachments — including a new
extension_contextattachment variant — into the next user message's composer.What's in this PR
The extension-facing RPC block now exposes:
Plus the wire types for the new
extension_contextattachment variant on both directions (params +SessionExtensionsAttachmentsPushedEventevent) so the SDK exports typed shapes consumers can rely on.Call path heads-up (JS): the wrapper lives at
session.rpc.extensions.sendAttachmentsToMessage, notsession.extensions.sendAttachmentsToMessage. Sibling methods likesession.sendandsession.getEventsare on the session class directly, so this is an easy mistake — worth flagging for anyone writing docs or examples.Languages regenerated
dotnet buildpassescargo buildpassesGo follow-up
The Go codegen at
scripts/codegen/go.ts(~line 1840–1855,emitGoFlatDiscriminatedUnion) has a duplicate-method bug that surfaces with this schema: when a leaf type is a variant of two discriminated unions with the same discriminator property (here,SendAttachmentand the newPushAttachmentboth use"type"), the generator emitsfunc (X) Type() FirstUnionEnumand thenfunc (X) Type() SecondUnionEnum, which fails to compile.Possible fixes (all non-trivial, out of scope here):
PushAttachmentType())I'd suggest landing this PR to unblock the github-app side and tracking the Go regen as a follow-up.
Approach note
To keep the diff minimal and reviewable, I patched the new method/types into the installed
@github/copilotschemas directly rather than bumping the dependency — the runtime branch carries ~500 lines of other in-flight changes that aren't part of this work. The patch is additive only and uses the SDK's existing naming conventions (SendAttachment*,UserMessageAttachment*) rather than runtime'sAttachment*. When the next@github/copilotrelease ships, a normal dep bump + regen will absorb this cleanly.Coordination
Paired session in
github-apphas verified the new method end-to-end against a hand-patched local runtime build; this PR is the proper replacement for that patch.