Add session-level canvasProvider field to Rust, Node, .NET, Go, and Python SDKs#1847
Add session-level canvasProvider field to Rust, Node, .NET, Go, and Python SDKs#1847jmoseley wants to merge 3 commits into
Conversation
Hosts can now supply a stable canvas-provider identity { id, name? } on
session.create and session.resume so host-provided canvases restore
across cold resume. Serializes as canvasProvider on the wire, mirroring
the existing extensionInfo field. Implements the runtime contract from
github/copilot-agent-runtime#10519.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new optional session-level canvasProvider identity field to multiple SDKs (Rust, Node.js, .NET) so hosts can provide a stable canvas-provider identity across reconnects/cold resume, aligning SDK request payloads with runtime support for params.canvasProvider on session.create / session.resume.
Changes:
- Rust: Introduces
CanvasProviderIdentityand threads it throughSessionConfig/ResumeSessionConfiginto the explicit wire structs, with coverage in session wire tests. - Node.js: Adds
CanvasProviderIdentity+canvasProvider?to session config types and forwards it in create/resume payloads, with client tests. - .NET: Adds
CanvasProviderIdentity+CanvasProviderto session config base and JSON-RPC request records, with serialization and clone tests.
Show a summary per file
| File | Description |
|---|---|
| rust/tests/session_test.rs | Adds assertions that canvasProvider is present on create/resume wire payloads. |
| rust/src/wire.rs | Extends SessionCreateWire/SessionResumeWire to include canvas_provider serialized as canvasProvider. |
| rust/src/types.rs | Adds CanvasProviderIdentity and adds canvas_provider to session config types + builders + into-wire mapping. |
| nodejs/test/client.test.ts | Verifies canvasProvider is forwarded in session.create and session.resume payloads. |
| nodejs/src/types.ts | Introduces CanvasProviderIdentity and adds canvasProvider? to SessionConfigBase. |
| nodejs/src/index.ts | Re-exports CanvasProviderIdentity from the public Node.js entrypoint. |
| nodejs/src/client.ts | Forwards canvasProvider into JSON-RPC payloads for create/resume. |
| dotnet/test/Unit/CanvasTests.cs | Adds serialization coverage for CanvasProviderIdentity and clone-copy coverage for config fields. |
| dotnet/src/Types.cs | Adds CanvasProvider to SessionConfigBase and includes CanvasProviderIdentity in source-gen serialization context. |
| dotnet/src/Client.cs | Adds CanvasProvider to create/resume request records and forwards from config. |
| dotnet/src/Canvas.cs | Introduces the CanvasProviderIdentity type with JSON property names. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Low
This comment has been minimized.
This comment has been minimized.
Indexing with ["name"] returns Value::Null both when the key is absent and when it is present as null. Since the wire contract omits name when None, assert the key is not present to catch a regression that would serialize name: null. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Extend the session-level canvasProvider field to the Go and Python SDKs
for parity with Rust, Node, and .NET. Hosts can now send a stable
canvas-provider identity ({ id, name? }) on session.create and
session.resume so host-provided canvases restore across cold resume.
Go: add CanvasProviderIdentity, wire it onto SessionConfig,
ResumeSessionConfig, and both request structs, and forward it in
client.go. Also fix a pre-existing gap where ExtensionInfo was declared
but never forwarded on create/resume.
Python: add CanvasProviderIdentity dataclass, export it, and forward a
canvas_provider param on create_session/resume_session.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Good catch — expanded this PR to cover both.
Both mirror the existing `extensionInfo` placement exactly. Java still stays deferred for the reasons noted. PR title/description updated. |
SDK Consistency Review ✅This PR adds Cross-SDK alignment
All five implementations:
Java gap (intentional)Java is correctly deferred. The Java Go
|
What
Adds an optional session-level
canvasProviderfield — a stable canvas-provider identity of shape{ id: string, name?: string }— to the session create and session resume config/request types in the Rust, Node.js, .NET, Go, and Python SDKs.This lets a host/control connection supply a stable canvas-provider
extensionIdso host-provided canvases restore across cold resume.Why
github/copilot-agent-runtime#10519 ("Stable canvas provider identity for the built-in canvas provider") now reads
params.canvasProvideronsession.create/session.resume. Until now the published SDKs had no typed field for hosts to send this.canvasProvideris a manually-registered JSON-RPC field (it is not in the generatedapi.schema.json, same as the existingcanvasesfield), so the recent schema bump (#1828) did not surface it — it has to be hand-added.Contract
CanvasProviderIdentity { id, name? }id(required): opaque, used verbatim as the canvasextensionId(runtime recommendsapp:builtin:<windowId>).name(optional): becomes the canvasextensionName; omitted from the wire when null.canvasProviderwith nestedid/name, mirroring the existingextensionInfofield placement in every location.Changes
Each SDK mirrors the existing
extensionInfowiring exactly, placingcanvasProviderimmediately adjacent.CanvasProviderIdentitystruct +canvas_providerfield onSessionConfigandResumeSessionConfig(types/Debug/Default/into-wire/builder), wire structs inwire.rs, plus wire-assertion tests.CanvasProviderIdentityinterface +canvasProvider?onSessionConfigBase, forwarded in both create/resume payloads, exported fromindex.ts, plus tests.CanvasProviderIdentityclass +CanvasProviderproperty onSessionConfigBase(with copy-ctor +JsonSerializable), wire records inClient.cs, plus unit tests.CanvasProviderIdentitystruct +CanvasProviderfield onSessionConfig,ResumeSessionConfig, and both wire request structs, forwarded inclient.go, plus an end-to-end forwarding test. Also fixes a pre-existing gap:ExtensionInfowas declared on the Go config/wire structs but never actually forwarded inclient.gofor create or resume — it is now wired alongsidecanvasProvider.CanvasProviderIdentitydataclass (exported fromcopilot) +canvas_providerparam forwarded oncreate_session/resume_session, plus serialize + end-to-end forwarding tests.Testing
cargo test --all-features --test session_test,cargo fmt --check,cargo clippyclean.npx vitest run test/client.test.ts,npm run build,npm run lintclean.dotnet test --filter CanvasTests.go test .(full package passes),go vet,gofmtclean.uv run pytest test_canvas.py test_client.py(canvasProvider serialize + forwarding tests pass),ruff check/ruff formatclean.Note
Java is intentionally not included here — the Java SDK currently lacks host-side canvas declaration entirely (no
canvasesfield, noextensionInfo, no canvas handler registration onSessionConfig), so it needs full canvas-API parity first. The Java side of this change is brought in by #1848, which adds the host-side canvas declaration API andcanvasProviderto the Java SDK.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com