Expose local cross-session discovery and delivery - #2616
Conversation
Add a hand-written typed `Session::admit_authenticated_cross_session_input` for the runtime's private direct-host-only `session.lifecycle.admitAuthenticatedCrossSessionInput` method. The public request types carry only caller-variable fields; the wire `version`, `kind`, `origin`, and `integrity` discriminators are stamped by private wire types during request conversion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5b6a7c90-1ad5-47e3-83a3-a87b895fb13c
Add session-bound Node and Rust SDK operations for listing active local peers and sending an exact-ID message through the runtime contract. Preserve typed refused, not-delivered, and ambiguous outcomes without retrying an uncertain delivery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for #2616 · copilot · sonnet50 · 110.6 AIC · ⌖ 13.3 AIC · ⊞ 8.3K
| /// [`Client::call`](crate::Client::call)). If the caller's future is | ||
| /// dropped after the frame is enqueued, the admission still lands and | ||
| /// the runtime processes it normally. | ||
| pub async fn admit_authenticated_cross_session_input( |
There was a problem hiding this comment.
Cross-SDK consistency: admit_authenticated_cross_session_input (backed by session.lifecycle.admitAuthenticatedCrossSessionInput, plus the new CrossSessionInput/CrossSessionPresentation/CrossSessionRecipientContext types) is added only to the Rust SDK. Since this is documented as usable by "a host embedding the SDK in-process (or over the direct local transport)", Node.js hosts embedding the SDK in-process would plausibly want the same capability, but no equivalent was added to nodejs/src/session.ts in this PR. If this omission is intentional (e.g., Node hosts don't embed the runtime the same way), consider noting that in the PR description; otherwise this looks like a parity gap worth tracking for the Node SDK, and eventually Python/Go/.NET/Java if this capability becomes broadly useful.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical code-generation, compatibility, re-export, and API-boundary issues remain.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
rust/src/session.rs — Keep the private admission producer out of the public API |
|
rust/src/types.rs — Preserve the public rpc type import path |
What changed in this PR
Adds local cross-session discovery and exact-target delivery APIs for Node and Rust, with source binding, typed delivery errors, and authenticated admission.
Changes:
- Adds generated and high-level discovery/delivery APIs.
- Adds authenticated admission models and typed terminal errors.
- Updates bindings, exports, code generation, and focused tests.
| File | Summary / review notes |
|---|---|
scripts/codegen/typescript.ts |
Ensures bound source session IDs override caller parameters. |
rust/tests/session_test.rs |
Tests admission, discovery, delivery, and failure outcomes. |
rust/src/types.rs |
Adds admission models and wire conversion. Critical (1 vote): preserve the public github_copilot_sdk::rpc::PermissionDecisionSource facade. Nit (1 vote): use an explicit named conversion instead of From. |
rust/src/session.rs |
Adds Rust discovery, delivery, and admission APIs. Critical (2 votes): keep authenticated admission behind an internal host adapter. Nit (1 vote): add experimental notices to the public methods. |
rust/src/lib.rs |
Preserves structured RPC error data. |
rust/src/generated/session_events.rs |
Adds cross-session event types and fields. Critical (1 vote each): preserve the stable permission-source re-export and apply compatibility protection such as #[non_exhaustive] to extended public event structs. |
rust/src/generated/rpc.rs |
Adds generated Rust RPC methods. |
rust/src/generated/api_types.rs |
Adds generated request and result types. |
rust/src/errors.rs |
Adds typed delivery error variants. |
nodejs/tsconfig.test.json |
Updates test TypeScript configuration. |
nodejs/test/session-send-session-message.test.ts |
Tests delivery and terminal error behavior. |
nodejs/test/session-list-messageable-sessions.test.ts |
Tests discovery and source binding. |
nodejs/src/types.ts |
Exposes cross-session types. |
nodejs/src/session.ts |
Adds Node discovery, delivery, and typed errors. Nit (1 vote): document targetSessionId explicitly. |
nodejs/src/index.ts |
Exports new public Node APIs. |
nodejs/src/generated/session-events.ts |
Adds generated cross-session event types. |
nodejs/src/generated/rpc.ts |
Adds generated cross-session RPC bindings. Critical (1 vote): regenerate all schema-derived language outputs or explicitly change the generation contract, since the shared codegen check currently lacks corresponding Python, Go, and .NET definitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| pub async fn admit_authenticated_cross_session_input( | ||
| &self, | ||
| request: AdmitAuthenticatedCrossSessionInputRequest, | ||
| ) -> Result<(), Error> { |
| PermissionDecisionReject, PermissionDecisionSurface, PermissionDecisionUserNotAvailable, | ||
| PermissionResponseCapability, | ||
| }; | ||
| pub use crate::generated::session_events::PermissionDecisionSource; |
Define unreleased discovery and delivery wire types in the SDK facade while leaving generated bindings reproducible from the pinned CLI schema. Replace unreachable compile assertions with callable type checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ea23a388-a87d-436d-8110-4f7f543141d6
This reverts commit dc77d92.
SDK Consistency ReviewThis PR adds a new cross-session messaging feature (
Naming/casing follows each language's conventions correctly (camelCase in TS, snake_case in Rust), and the error-classification logic ( Cross-SDK gapNo equivalent API was found in Python ( This looks like new, still-experimental (
No other consistency issues were found — the
|

Summary
Runtime dependency
This SDK surface consumes the local transport, provenance, target-claim, and recipient-admission contract in github/copilot-agent-runtime#19586. The runtime owns wire security and recipient admission. The SDK exposes only source-bound discovery and delivery so CLI and App consumers do not implement separate local protocols. Same-computer discovery and delivery do not require remote control or remote export.
The unreleased discovery and delivery wire types live in the hand-written SDK facades until the runtime schema reaches the SDK pinned CLI release. Generated files remain reproducible from that pinned release.
Validation