Tags: Pancake28/copilot-sdk
Tags
SDK: Align canvas with codegen pipeline, add e2e tests (github#1413)
SDK: Align canvas with codegen pipeline, add e2e tests (github#1413)
SDK: Align canvas with codegen pipeline, add e2e tests (github#1413)
Add SDK canvas runtime support (github#1401) * Add canvas runtime support to SDK Add Node extension canvas APIs and direct canvas provider callback routing. Add Rust canvas declarations, provider handlers, create/resume wiring, and host session.canvas APIs aligned with the runtime schema. Validation: nodejs typecheck/lint/tests; rust fmt/check/clippy; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add canvas provider RPC tracing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add extension info session option Expose stable extension identity metadata on Node and Rust session create/resume options and forward extensionInfo on the wire for canvas providers. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Expose canvas resume durability fields Add CanvasInstanceAvailability, OpenCanvasInstance availability, and resume openCanvases seeding support to the Rust SDK. Validation: cargo +nightly-2026-04-14 fmt --check; cargo clippy --all-features --all-targets -- -D warnings; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address canvas SDK review feedback Validate canvas provider request payloads before routing, surface Rust canvas serialization and builder errors, and clarify list_open RPC behavior. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Format Rust session imports Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sync canvas tool surface docs Remove stale focus/close/reload canvas agent-tool references and cover custom-tool permission payload passthrough for open_canvas. Validation: nodejs typecheck; cargo test --all-features permission_request_data_extracts_typed_kind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas descriptions Align canvas contribution and discovered canvas descriptions with the runtime schema, update canvas tool-surface docs, and cover open_canvas custom-tool permission payloads. Validation: nodejs typecheck/lint/vitest client+extension; rust fmt/clippy; cargo check --all-features --all-targets; targeted canvas and permission tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas instance availability Align OpenCanvasInstance with the runtime schema by making availability required and updating canvas host/resume tests. Validation: cargo check --all-features --all-targets; cargo test --all-features canvas; targeted session canvas tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Node canvas open handler Rename the Node canvas provider option from onOpen to open and remove lifecycle handler options from the extension canvas API. Validation: nodejs typecheck; vitest client and extension tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas toolbar and focus/reload surface Aligns the SDK canvas contract with copilot-agent-runtime jmoseley/adr-implementation-plan commits 85b23bc264 and acdefc1bc1: - Rename agentActions to actions on CanvasDeclaration and DiscoveredCanvas (Rust + Node). - Drop toolbar from CanvasContribution and CanvasOpenResponse, and remove CanvasToolbarItemDeclaration / CanvasToolbarItem entirely. - Drop SessionCanvas::focus and SessionCanvas::reload host APIs; re-opening with the same instanceId now drives focus via session.canvas.opened { reopen: true }, and reload is renderer-only. - Drop canvas.focus / canvas.reload provider JSON-RPC routes and the matching CanvasHandler::on_focus / on_reload hooks; canvas.close keeps its dedicated dispatch path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore optional onClose handler on Node canvas options Lets extension authors observe canvas instance close events without adding back the dropped onFocus/onReload hooks. Fire-and-forget: the handler's return value is ignored and the provider response is still undefined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Support per-action handlers on Node canvas actions Each entry in createCanvas({ actions }) may now carry its own optional handler, co-located with the action's metadata. The top-level onAction remains as a fallback for actions that don't define their own handler. Dispatch order: 1. Per-action handler when set. 2. Top-level onAction otherwise. 3. canvas_action_no_handler if neither is wired. The handler closure is stripped from the wire CanvasDeclaration sent on session.create / session.resume; only the action's name, description, and inputSchema reach the runtime. A new CanvasAction authoring type sits on top of the existing CanvasAgentActionDeclaration wire type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop top-level onAction fallback on Node canvases Per-action handlers are now the only dispatch path. Declared actions without a handler fall through to canvas_action_no_handler. Keeps the action's metadata and behavior co-located and removes a second indirection that always boiled down to a switch on actionName. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Normalize JSDoc style on CanvasAgentActionDeclaration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop stale wire-rename guards from canvas declaration test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Document canvas action dispatch divergence in Rust SDK Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require handler on canvas actions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Collapse CanvasAgentActionDeclaration into CanvasAction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop debug log for inbound JSON-RPC requests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas debug logs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove canvas tools field Drop CanvasToolDefinition, CanvasToolDefinitionDefer, and the CanvasOpenResponse.tools / OpenCanvasInstance.tools fields from both the Node and Rust SDKs. The CLI side is being removed in lockstep, so the wire contract no longer carries this field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: slim canvas surface to wire types + CanvasHandler Move per-canvas registry, Canvas builder, dispatch helpers, and the SessionCanvas host helper out of the SDK. The Rust canvas surface now matches the other typed extension points (PermissionHandler / UserInputHandler / HookHandler): SessionConfig .with_canvases([CanvasDeclaration, ...]) .with_canvas_handler(Arc::new(MyHandler)) Removed: - canvas::Canvas, CanvasBuilder (declaration+handler bundle) - canvas::CanvasRegistry, build_registry, dispatch_canvas_* - session::SessionCanvas + Session::canvas() accessor (callers move to session.rpc().canvas().*) Kept (the wire boundary + typed extension point): - All wire types (CanvasDeclaration, OpenCanvasInstance, ...) - CanvasHandler trait + on_open/on_action/on_close - SessionConfig/ResumeSessionConfig.canvases (now Vec<CanvasDeclaration>) - SessionConfig/ResumeSessionConfig.canvas_handler handle_request dispatches canvas.open/close/action.invoke directly to the handler; the per-canvas registry now lives in the app layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: drop canvas wire types duplicated by codegen Removed CanvasInstanceAvailability, OpenCanvasInstance, CanvasAgentActionDeclaration (-> CanvasAction), CanvasDiscoverResult, DiscoveredCanvas, CanvasListOpenResult, CanvasOpenRequest, CanvasCloseRequest, CanvasInvokeActionRequest, and CanvasInvokeActionResult from canvas.rs; consumers import these from crate::generated::api_types directly. The remaining hand-written types (CanvasDeclaration, CanvasOpenResponse, handler trait, contexts, CanvasError) are genuinely additive provider-authoring contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix broken intra-doc link to renamed CanvasAction type The canvas wire types were deduplicated against generated/api_types.rs, renaming CanvasAgentActionDeclaration to CanvasAction. A doc comment in canvas.rs still referenced the old name, which broke cargo doc on CI (broken_intra_doc_links is denied). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * go: add canvas runtime support Mirrors the Rust SDK canvas surface in rust/src/canvas.rs: - CanvasDeclaration, CanvasOpenResponse, CanvasHostContext, CanvasOpenContext / CanvasActionContext / CanvasLifecycleContext, CanvasError, CanvasHandler interface + CanvasHandlerDefaults, and ExtensionInfo. - SessionConfig / ResumeSessionConfig: Canvases, RequestCanvasRenderer, RequestExtensions, CanvasHandler, ExtensionInfo. - Inbound JSON-RPC dispatch for canvas.open, canvas.close, and canvas.action.invoke, with a canvas_handler_unset error envelope when no handler is installed and a canvas_handler_error envelope when a handler returns a non-CanvasError error. - Session.OpenCanvases() surfaces the openCanvases snapshot from the session.resume response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * python: add canvas runtime support Mirrors the Rust SDK design: callers declare canvases on session.create / session.resume, install a single CanvasHandler, and the SDK dispatches inbound canvas.open / canvas.close / canvas.action.invoke JSON-RPC requests to that handler. Resume populates session.open_canvases from the response. JSON-RPC dispatch was loosened to allow handlers to return any JSON value (canvas.action.invoke result is arbitrary JSON). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * dotnet: add canvas runtime support Ports the canvas runtime surface from the Rust SDK to the .NET SDK so .NET hosts can declare canvases on session create/resume, advertise an extension identity, and handle inbound canvas.open / canvas.close / canvas.action.invoke RPC calls. * New public Canvas.cs surface (CanvasDeclaration, ExtensionInfo, CanvasOpenResponse, CanvasHostContext, lifecycle/action/open contexts, CanvasError, ICanvasHandler, CanvasHandlerBase). All marked [Experimental(GHCP001)]. * SessionConfigBase gains Canvases, RequestCanvasRenderer, RequestExtensions, ExtensionInfo, CanvasHandler. * CreateSession/ResumeSession requests forward the new fields and surface OpenCanvases on the response. CopilotSession exposes the returned canvases via OpenCanvases. * CopilotClient registers canvas.open / canvas.close / canvas.action.invoke handlers and dispatches them to the session, which invokes the user's ICanvasHandler and returns structured CanvasError data via a new JsonRpc LocalRpcInvocationException path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review: openCanvases parity + Node API divergence note - Node: add openCanvases accessor on CopilotSession and OpenCanvases field on ResumeSessionConfig so callers can both rehydrate from the resume response and pre-populate canvas state on resume. - Node: document why createCanvas/Canvas intentionally diverges from the per-session CanvasHandler pattern used by Rust/Python/Go/.NET. - Go: add ResumeSessionConfig.OpenCanvases, thread through to the resume request wire payload, and add a serialization test. - .NET: add ResumeSessionConfig.OpenCanvases, thread through to the internal ResumeSessionRequest record, and add a serialization test. Mirrors what Rust and Python already do, fixing wire-protocol parity across SDKs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add SDK canvas runtime support (github#1401) * Add canvas runtime support to SDK Add Node extension canvas APIs and direct canvas provider callback routing. Add Rust canvas declarations, provider handlers, create/resume wiring, and host session.canvas APIs aligned with the runtime schema. Validation: nodejs typecheck/lint/tests; rust fmt/check/clippy; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add canvas provider RPC tracing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add extension info session option Expose stable extension identity metadata on Node and Rust session create/resume options and forward extensionInfo on the wire for canvas providers. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Expose canvas resume durability fields Add CanvasInstanceAvailability, OpenCanvasInstance availability, and resume openCanvases seeding support to the Rust SDK. Validation: cargo +nightly-2026-04-14 fmt --check; cargo clippy --all-features --all-targets -- -D warnings; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address canvas SDK review feedback Validate canvas provider request payloads before routing, surface Rust canvas serialization and builder errors, and clarify list_open RPC behavior. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Format Rust session imports Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sync canvas tool surface docs Remove stale focus/close/reload canvas agent-tool references and cover custom-tool permission payload passthrough for open_canvas. Validation: nodejs typecheck; cargo test --all-features permission_request_data_extracts_typed_kind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas descriptions Align canvas contribution and discovered canvas descriptions with the runtime schema, update canvas tool-surface docs, and cover open_canvas custom-tool permission payloads. Validation: nodejs typecheck/lint/vitest client+extension; rust fmt/clippy; cargo check --all-features --all-targets; targeted canvas and permission tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas instance availability Align OpenCanvasInstance with the runtime schema by making availability required and updating canvas host/resume tests. Validation: cargo check --all-features --all-targets; cargo test --all-features canvas; targeted session canvas tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Node canvas open handler Rename the Node canvas provider option from onOpen to open and remove lifecycle handler options from the extension canvas API. Validation: nodejs typecheck; vitest client and extension tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas toolbar and focus/reload surface Aligns the SDK canvas contract with copilot-agent-runtime jmoseley/adr-implementation-plan commits 85b23bc264 and acdefc1bc1: - Rename agentActions to actions on CanvasDeclaration and DiscoveredCanvas (Rust + Node). - Drop toolbar from CanvasContribution and CanvasOpenResponse, and remove CanvasToolbarItemDeclaration / CanvasToolbarItem entirely. - Drop SessionCanvas::focus and SessionCanvas::reload host APIs; re-opening with the same instanceId now drives focus via session.canvas.opened { reopen: true }, and reload is renderer-only. - Drop canvas.focus / canvas.reload provider JSON-RPC routes and the matching CanvasHandler::on_focus / on_reload hooks; canvas.close keeps its dedicated dispatch path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore optional onClose handler on Node canvas options Lets extension authors observe canvas instance close events without adding back the dropped onFocus/onReload hooks. Fire-and-forget: the handler's return value is ignored and the provider response is still undefined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Support per-action handlers on Node canvas actions Each entry in createCanvas({ actions }) may now carry its own optional handler, co-located with the action's metadata. The top-level onAction remains as a fallback for actions that don't define their own handler. Dispatch order: 1. Per-action handler when set. 2. Top-level onAction otherwise. 3. canvas_action_no_handler if neither is wired. The handler closure is stripped from the wire CanvasDeclaration sent on session.create / session.resume; only the action's name, description, and inputSchema reach the runtime. A new CanvasAction authoring type sits on top of the existing CanvasAgentActionDeclaration wire type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop top-level onAction fallback on Node canvases Per-action handlers are now the only dispatch path. Declared actions without a handler fall through to canvas_action_no_handler. Keeps the action's metadata and behavior co-located and removes a second indirection that always boiled down to a switch on actionName. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Normalize JSDoc style on CanvasAgentActionDeclaration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop stale wire-rename guards from canvas declaration test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Document canvas action dispatch divergence in Rust SDK Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require handler on canvas actions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Collapse CanvasAgentActionDeclaration into CanvasAction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop debug log for inbound JSON-RPC requests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas debug logs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove canvas tools field Drop CanvasToolDefinition, CanvasToolDefinitionDefer, and the CanvasOpenResponse.tools / OpenCanvasInstance.tools fields from both the Node and Rust SDKs. The CLI side is being removed in lockstep, so the wire contract no longer carries this field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: slim canvas surface to wire types + CanvasHandler Move per-canvas registry, Canvas builder, dispatch helpers, and the SessionCanvas host helper out of the SDK. The Rust canvas surface now matches the other typed extension points (PermissionHandler / UserInputHandler / HookHandler): SessionConfig .with_canvases([CanvasDeclaration, ...]) .with_canvas_handler(Arc::new(MyHandler)) Removed: - canvas::Canvas, CanvasBuilder (declaration+handler bundle) - canvas::CanvasRegistry, build_registry, dispatch_canvas_* - session::SessionCanvas + Session::canvas() accessor (callers move to session.rpc().canvas().*) Kept (the wire boundary + typed extension point): - All wire types (CanvasDeclaration, OpenCanvasInstance, ...) - CanvasHandler trait + on_open/on_action/on_close - SessionConfig/ResumeSessionConfig.canvases (now Vec<CanvasDeclaration>) - SessionConfig/ResumeSessionConfig.canvas_handler handle_request dispatches canvas.open/close/action.invoke directly to the handler; the per-canvas registry now lives in the app layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: drop canvas wire types duplicated by codegen Removed CanvasInstanceAvailability, OpenCanvasInstance, CanvasAgentActionDeclaration (-> CanvasAction), CanvasDiscoverResult, DiscoveredCanvas, CanvasListOpenResult, CanvasOpenRequest, CanvasCloseRequest, CanvasInvokeActionRequest, and CanvasInvokeActionResult from canvas.rs; consumers import these from crate::generated::api_types directly. The remaining hand-written types (CanvasDeclaration, CanvasOpenResponse, handler trait, contexts, CanvasError) are genuinely additive provider-authoring contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix broken intra-doc link to renamed CanvasAction type The canvas wire types were deduplicated against generated/api_types.rs, renaming CanvasAgentActionDeclaration to CanvasAction. A doc comment in canvas.rs still referenced the old name, which broke cargo doc on CI (broken_intra_doc_links is denied). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * go: add canvas runtime support Mirrors the Rust SDK canvas surface in rust/src/canvas.rs: - CanvasDeclaration, CanvasOpenResponse, CanvasHostContext, CanvasOpenContext / CanvasActionContext / CanvasLifecycleContext, CanvasError, CanvasHandler interface + CanvasHandlerDefaults, and ExtensionInfo. - SessionConfig / ResumeSessionConfig: Canvases, RequestCanvasRenderer, RequestExtensions, CanvasHandler, ExtensionInfo. - Inbound JSON-RPC dispatch for canvas.open, canvas.close, and canvas.action.invoke, with a canvas_handler_unset error envelope when no handler is installed and a canvas_handler_error envelope when a handler returns a non-CanvasError error. - Session.OpenCanvases() surfaces the openCanvases snapshot from the session.resume response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * python: add canvas runtime support Mirrors the Rust SDK design: callers declare canvases on session.create / session.resume, install a single CanvasHandler, and the SDK dispatches inbound canvas.open / canvas.close / canvas.action.invoke JSON-RPC requests to that handler. Resume populates session.open_canvases from the response. JSON-RPC dispatch was loosened to allow handlers to return any JSON value (canvas.action.invoke result is arbitrary JSON). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * dotnet: add canvas runtime support Ports the canvas runtime surface from the Rust SDK to the .NET SDK so .NET hosts can declare canvases on session create/resume, advertise an extension identity, and handle inbound canvas.open / canvas.close / canvas.action.invoke RPC calls. * New public Canvas.cs surface (CanvasDeclaration, ExtensionInfo, CanvasOpenResponse, CanvasHostContext, lifecycle/action/open contexts, CanvasError, ICanvasHandler, CanvasHandlerBase). All marked [Experimental(GHCP001)]. * SessionConfigBase gains Canvases, RequestCanvasRenderer, RequestExtensions, ExtensionInfo, CanvasHandler. * CreateSession/ResumeSession requests forward the new fields and surface OpenCanvases on the response. CopilotSession exposes the returned canvases via OpenCanvases. * CopilotClient registers canvas.open / canvas.close / canvas.action.invoke handlers and dispatches them to the session, which invokes the user's ICanvasHandler and returns structured CanvasError data via a new JsonRpc LocalRpcInvocationException path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review: openCanvases parity + Node API divergence note - Node: add openCanvases accessor on CopilotSession and OpenCanvases field on ResumeSessionConfig so callers can both rehydrate from the resume response and pre-populate canvas state on resume. - Node: document why createCanvas/Canvas intentionally diverges from the per-session CanvasHandler pattern used by Rust/Python/Go/.NET. - Go: add ResumeSessionConfig.OpenCanvases, thread through to the resume request wire payload, and add a serialization test. - .NET: add ResumeSessionConfig.OpenCanvases, thread through to the internal ResumeSessionRequest record, and add a serialization test. Mirrors what Rust and Python already do, fixing wire-protocol parity across SDKs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add SDK canvas runtime support (github#1401) * Add canvas runtime support to SDK Add Node extension canvas APIs and direct canvas provider callback routing. Add Rust canvas declarations, provider handlers, create/resume wiring, and host session.canvas APIs aligned with the runtime schema. Validation: nodejs typecheck/lint/tests; rust fmt/check/clippy; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add canvas provider RPC tracing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add extension info session option Expose stable extension identity metadata on Node and Rust session create/resume options and forward extensionInfo on the wire for canvas providers. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Expose canvas resume durability fields Add CanvasInstanceAvailability, OpenCanvasInstance availability, and resume openCanvases seeding support to the Rust SDK. Validation: cargo +nightly-2026-04-14 fmt --check; cargo clippy --all-features --all-targets -- -D warnings; cargo test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address canvas SDK review feedback Validate canvas provider request payloads before routing, surface Rust canvas serialization and builder errors, and clarify list_open RPC behavior. Validation: nodejs typecheck/lint/vitest; rust fmt/clippy/test --all-features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Format Rust session imports Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sync canvas tool surface docs Remove stale focus/close/reload canvas agent-tool references and cover custom-tool permission payload passthrough for open_canvas. Validation: nodejs typecheck; cargo test --all-features permission_request_data_extracts_typed_kind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas descriptions Align canvas contribution and discovered canvas descriptions with the runtime schema, update canvas tool-surface docs, and cover open_canvas custom-tool permission payloads. Validation: nodejs typecheck/lint/vitest client+extension; rust fmt/clippy; cargo check --all-features --all-targets; targeted canvas and permission tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require canvas instance availability Align OpenCanvasInstance with the runtime schema by making availability required and updating canvas host/resume tests. Validation: cargo check --all-features --all-targets; cargo test --all-features canvas; targeted session canvas tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Node canvas open handler Rename the Node canvas provider option from onOpen to open and remove lifecycle handler options from the extension canvas API. Validation: nodejs typecheck; vitest client and extension tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas toolbar and focus/reload surface Aligns the SDK canvas contract with copilot-agent-runtime jmoseley/adr-implementation-plan commits 85b23bc264 and acdefc1bc1: - Rename agentActions to actions on CanvasDeclaration and DiscoveredCanvas (Rust + Node). - Drop toolbar from CanvasContribution and CanvasOpenResponse, and remove CanvasToolbarItemDeclaration / CanvasToolbarItem entirely. - Drop SessionCanvas::focus and SessionCanvas::reload host APIs; re-opening with the same instanceId now drives focus via session.canvas.opened { reopen: true }, and reload is renderer-only. - Drop canvas.focus / canvas.reload provider JSON-RPC routes and the matching CanvasHandler::on_focus / on_reload hooks; canvas.close keeps its dedicated dispatch path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore optional onClose handler on Node canvas options Lets extension authors observe canvas instance close events without adding back the dropped onFocus/onReload hooks. Fire-and-forget: the handler's return value is ignored and the provider response is still undefined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Support per-action handlers on Node canvas actions Each entry in createCanvas({ actions }) may now carry its own optional handler, co-located with the action's metadata. The top-level onAction remains as a fallback for actions that don't define their own handler. Dispatch order: 1. Per-action handler when set. 2. Top-level onAction otherwise. 3. canvas_action_no_handler if neither is wired. The handler closure is stripped from the wire CanvasDeclaration sent on session.create / session.resume; only the action's name, description, and inputSchema reach the runtime. A new CanvasAction authoring type sits on top of the existing CanvasAgentActionDeclaration wire type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop top-level onAction fallback on Node canvases Per-action handlers are now the only dispatch path. Declared actions without a handler fall through to canvas_action_no_handler. Keeps the action's metadata and behavior co-located and removes a second indirection that always boiled down to a switch on actionName. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Normalize JSDoc style on CanvasAgentActionDeclaration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop stale wire-rename guards from canvas declaration test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Document canvas action dispatch divergence in Rust SDK Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require handler on canvas actions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Collapse CanvasAgentActionDeclaration into CanvasAction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop debug log for inbound JSON-RPC requests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Drop canvas debug logs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove canvas tools field Drop CanvasToolDefinition, CanvasToolDefinitionDefer, and the CanvasOpenResponse.tools / OpenCanvasInstance.tools fields from both the Node and Rust SDKs. The CLI side is being removed in lockstep, so the wire contract no longer carries this field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: slim canvas surface to wire types + CanvasHandler Move per-canvas registry, Canvas builder, dispatch helpers, and the SessionCanvas host helper out of the SDK. The Rust canvas surface now matches the other typed extension points (PermissionHandler / UserInputHandler / HookHandler): SessionConfig .with_canvases([CanvasDeclaration, ...]) .with_canvas_handler(Arc::new(MyHandler)) Removed: - canvas::Canvas, CanvasBuilder (declaration+handler bundle) - canvas::CanvasRegistry, build_registry, dispatch_canvas_* - session::SessionCanvas + Session::canvas() accessor (callers move to session.rpc().canvas().*) Kept (the wire boundary + typed extension point): - All wire types (CanvasDeclaration, OpenCanvasInstance, ...) - CanvasHandler trait + on_open/on_action/on_close - SessionConfig/ResumeSessionConfig.canvases (now Vec<CanvasDeclaration>) - SessionConfig/ResumeSessionConfig.canvas_handler handle_request dispatches canvas.open/close/action.invoke directly to the handler; the per-canvas registry now lives in the app layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rust: drop canvas wire types duplicated by codegen Removed CanvasInstanceAvailability, OpenCanvasInstance, CanvasAgentActionDeclaration (-> CanvasAction), CanvasDiscoverResult, DiscoveredCanvas, CanvasListOpenResult, CanvasOpenRequest, CanvasCloseRequest, CanvasInvokeActionRequest, and CanvasInvokeActionResult from canvas.rs; consumers import these from crate::generated::api_types directly. The remaining hand-written types (CanvasDeclaration, CanvasOpenResponse, handler trait, contexts, CanvasError) are genuinely additive provider-authoring contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix broken intra-doc link to renamed CanvasAction type The canvas wire types were deduplicated against generated/api_types.rs, renaming CanvasAgentActionDeclaration to CanvasAction. A doc comment in canvas.rs still referenced the old name, which broke cargo doc on CI (broken_intra_doc_links is denied). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * go: add canvas runtime support Mirrors the Rust SDK canvas surface in rust/src/canvas.rs: - CanvasDeclaration, CanvasOpenResponse, CanvasHostContext, CanvasOpenContext / CanvasActionContext / CanvasLifecycleContext, CanvasError, CanvasHandler interface + CanvasHandlerDefaults, and ExtensionInfo. - SessionConfig / ResumeSessionConfig: Canvases, RequestCanvasRenderer, RequestExtensions, CanvasHandler, ExtensionInfo. - Inbound JSON-RPC dispatch for canvas.open, canvas.close, and canvas.action.invoke, with a canvas_handler_unset error envelope when no handler is installed and a canvas_handler_error envelope when a handler returns a non-CanvasError error. - Session.OpenCanvases() surfaces the openCanvases snapshot from the session.resume response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * python: add canvas runtime support Mirrors the Rust SDK design: callers declare canvases on session.create / session.resume, install a single CanvasHandler, and the SDK dispatches inbound canvas.open / canvas.close / canvas.action.invoke JSON-RPC requests to that handler. Resume populates session.open_canvases from the response. JSON-RPC dispatch was loosened to allow handlers to return any JSON value (canvas.action.invoke result is arbitrary JSON). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * dotnet: add canvas runtime support Ports the canvas runtime surface from the Rust SDK to the .NET SDK so .NET hosts can declare canvases on session create/resume, advertise an extension identity, and handle inbound canvas.open / canvas.close / canvas.action.invoke RPC calls. * New public Canvas.cs surface (CanvasDeclaration, ExtensionInfo, CanvasOpenResponse, CanvasHostContext, lifecycle/action/open contexts, CanvasError, ICanvasHandler, CanvasHandlerBase). All marked [Experimental(GHCP001)]. * SessionConfigBase gains Canvases, RequestCanvasRenderer, RequestExtensions, ExtensionInfo, CanvasHandler. * CreateSession/ResumeSession requests forward the new fields and surface OpenCanvases on the response. CopilotSession exposes the returned canvases via OpenCanvases. * CopilotClient registers canvas.open / canvas.close / canvas.action.invoke handlers and dispatches them to the session, which invokes the user's ICanvasHandler and returns structured CanvasError data via a new JsonRpc LocalRpcInvocationException path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review: openCanvases parity + Node API divergence note - Node: add openCanvases accessor on CopilotSession and OpenCanvases field on ResumeSessionConfig so callers can both rehydrate from the resume response and pre-populate canvas state on resume. - Node: document why createCanvas/Canvas intentionally diverges from the per-session CanvasHandler pattern used by Rust/Python/Go/.NET. - Go: add ResumeSessionConfig.OpenCanvases, thread through to the resume request wire payload, and add a serialization test. - .NET: add ResumeSessionConfig.OpenCanvases, thread through to the internal ResumeSessionRequest record, and add a serialization test. Mirrors what Rust and Python already do, fixing wire-protocol parity across SDKs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add preMcpToolCall hook support to all SDKs (github#1366) * Add preMcpToolCall hook support to all SDKs Add the preMcpToolCall hook which fires before an MCP tool call is dispatched to an MCP server. This aligns with copilot-agent-runtime 1.0.51 which added support for this hook type. The hook receives serverName, toolName, arguments, optional toolCallId, and optional _meta as input. The output supports a tri-state metaToUse field: absent (preserve existing _meta), null (remove _meta), or object (replace _meta). Changes per SDK: - Node.js: PreMcpToolCallHookInput/Output types, handler, SessionHooks - Python: PreMcpToolCallHookInput/Output TypedDicts, handler, SessionHooks - Go: PreMcpToolCallHookInput/Output structs, handler, helper functions - .NET: PreMcpToolCallHookInput/Output classes, SessionHooks, JsonElement? - Rust: PreMcpToolCallInput/Output structs, HookEvent/Output variants, trait Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add preMcpToolCall hook E2E tests for Node.js, Python, Go, and Rust Port the three preMcpToolCall hook test scenarios (set meta, replace meta, remove meta) from the .NET reference implementation to all four remaining SDK test suites. Each test: - Configures an MCP stdio server (meta-echo) that echoes _meta back - Registers a preMcpToolCall hook that sets/replaces/removes metadata - Verifies the tool result reflects the hook's effect - Asserts hook input fields (serverName, toolName, workingDirectory, timestamp) Snapshot files are reused from test/snapshots/pre_mcp_tool_call_hook/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix code review feedback and add .NET E2E test infrastructure - Add OnPreMcpToolCall to hasHooks checks in .NET Client.cs and Go client.go - Add SerializeHookOutput helper for source-gen serialization - Add .NET PreMcpToolCallHookE2ETests (3 tests: set, replace, remove meta) - Add MCP meta-echo test server and snapshot YAML files - Fix Go mcp_and_agents_e2e_test.go (Cwd -> WorkingDirectory) - Remove stale dead_code lint expectation in Rust support.rs - Add serialization unit tests for hook output Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Java PingResponse timestamp deserialization for ISO-8601 format The Copilot CLI now returns ISO-8601 timestamp strings instead of numeric epoch milliseconds. Update PingResponse.timestamp from long to String and PingResult.timestamp from Long to String. Update corresponding test assertions accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Regenerate Java codegen output Auto-committed by java-codegen-check workflow. * Fix Java test type mismatch: PingResult.timestamp is Long not String The generated PingResult record has timestamp as Long (milliseconds), but tests were passing String values (ISO date format). Update tests to use Long millisecond values instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Rust public API Rename the public `cwd` field to `working_directory` on: - ClientOptions (local-only, not serialized) - McpStdioServerConfig (serialized; add #[serde(rename = "cwd")]) - SessionListFilter (serialized; add #[serde(rename = "cwd")]) The wire format remains unchanged (JSON key stays "cwd"). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Python public API Rename all public API fields named 'cwd' to 'working_directory' and 'initial_cwd' to 'initial_working_directory' in the Python SDK while preserving the wire format (JSON sent to/from the Copilot CLI runtime still uses 'cwd' and 'initialCwd'). Fields renamed: - SubprocessConfig.cwd -> working_directory - MCPStdioServerConfig['cwd'] -> working_directory - SessionContext.cwd -> working_directory - SessionListFilter.cwd -> working_directory - SessionFsConfig['initial_cwd'] -> initial_working_directory Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to workingDirectory in Node.js public API Rename the public-facing 'cwd' field to 'workingDirectory' in: - CopilotClientOptions.cwd - MCPStdioServerConfig.cwd - SessionContext.cwd - SessionListFilter.cwd The wire format (JSON sent to/from the Copilot CLI runtime) is preserved as 'cwd' via transformation layers in client.ts: - Outgoing: workingDirectory -> cwd (mcpServers, customAgents, listSessions filter) - Incoming: cwd -> workingDirectory (session context in toSessionMetadata) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix formatting in Node.js and Python after cwd rename Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Rust E2E test: use working_directory in McpStdioServerConfig Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix flaky tests: increase CLI start timeout and add missing snapshot - Node.js: Increase CLI server start timeout from 10s to 30s to accommodate slow Windows CI runners - Java: Add missing conversation to mcp_and_agents/should_accept_both_mcp_servers_and_custom_agents snapshot (was empty, causing proxy 500 errors) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Java .lastmerge to include snapshot fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Cwd/InitialCwd to WorkingDirectory/InitialWorkingDirectory in Go and .NET Complete the cwd → workingDirectory rename across all SDKs for consistency. Wire format (JSON) is preserved via struct tags and JsonPropertyName attributes. Go: - ClientOptions.Cwd → WorkingDirectory - SessionFsConfig.InitialCwd → InitialWorkingDirectory - SessionContext.Cwd → WorkingDirectory (json:"cwd") - SessionListFilter.Cwd → WorkingDirectory (json:"cwd,omitempty") .NET: - SessionFsConfig.InitialCwd → InitialWorkingDirectory ([JsonPropertyName("initialCwd")]) - SessionContext.Cwd → WorkingDirectory ([JsonPropertyName("cwd")]) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix missed Cwd reference and run go fmt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert Java SDK changes Remove Java preMcpToolCall hook implementation from this PR to be handled separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Node.js Windows CI test failure Split dependent SQL tool calls into separate CAPI turns in the session_fs_sqlite snapshot. The CREATE TABLE and INSERT were previously returned as separate choices in a single response, causing the CLI on Windows to execute them concurrently. Since INSERT depends on CREATE TABLE completing first, this produced a 'no such table: items' error. The fix restructures the snapshot into 3 CAPI turns: first executing report_intent + CREATE TABLE, then INSERT, then the final response. This ensures CREATE TABLE always completes before INSERT is attempted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Add preMcpToolCall hook support to all SDKs (github#1366) * Add preMcpToolCall hook support to all SDKs Add the preMcpToolCall hook which fires before an MCP tool call is dispatched to an MCP server. This aligns with copilot-agent-runtime 1.0.51 which added support for this hook type. The hook receives serverName, toolName, arguments, optional toolCallId, and optional _meta as input. The output supports a tri-state metaToUse field: absent (preserve existing _meta), null (remove _meta), or object (replace _meta). Changes per SDK: - Node.js: PreMcpToolCallHookInput/Output types, handler, SessionHooks - Python: PreMcpToolCallHookInput/Output TypedDicts, handler, SessionHooks - Go: PreMcpToolCallHookInput/Output structs, handler, helper functions - .NET: PreMcpToolCallHookInput/Output classes, SessionHooks, JsonElement? - Rust: PreMcpToolCallInput/Output structs, HookEvent/Output variants, trait Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add preMcpToolCall hook E2E tests for Node.js, Python, Go, and Rust Port the three preMcpToolCall hook test scenarios (set meta, replace meta, remove meta) from the .NET reference implementation to all four remaining SDK test suites. Each test: - Configures an MCP stdio server (meta-echo) that echoes _meta back - Registers a preMcpToolCall hook that sets/replaces/removes metadata - Verifies the tool result reflects the hook's effect - Asserts hook input fields (serverName, toolName, workingDirectory, timestamp) Snapshot files are reused from test/snapshots/pre_mcp_tool_call_hook/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix code review feedback and add .NET E2E test infrastructure - Add OnPreMcpToolCall to hasHooks checks in .NET Client.cs and Go client.go - Add SerializeHookOutput helper for source-gen serialization - Add .NET PreMcpToolCallHookE2ETests (3 tests: set, replace, remove meta) - Add MCP meta-echo test server and snapshot YAML files - Fix Go mcp_and_agents_e2e_test.go (Cwd -> WorkingDirectory) - Remove stale dead_code lint expectation in Rust support.rs - Add serialization unit tests for hook output Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Java PingResponse timestamp deserialization for ISO-8601 format The Copilot CLI now returns ISO-8601 timestamp strings instead of numeric epoch milliseconds. Update PingResponse.timestamp from long to String and PingResult.timestamp from Long to String. Update corresponding test assertions accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Regenerate Java codegen output Auto-committed by java-codegen-check workflow. * Fix Java test type mismatch: PingResult.timestamp is Long not String The generated PingResult record has timestamp as Long (milliseconds), but tests were passing String values (ISO date format). Update tests to use Long millisecond values instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Rust public API Rename the public `cwd` field to `working_directory` on: - ClientOptions (local-only, not serialized) - McpStdioServerConfig (serialized; add #[serde(rename = "cwd")]) - SessionListFilter (serialized; add #[serde(rename = "cwd")]) The wire format remains unchanged (JSON key stays "cwd"). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Python public API Rename all public API fields named 'cwd' to 'working_directory' and 'initial_cwd' to 'initial_working_directory' in the Python SDK while preserving the wire format (JSON sent to/from the Copilot CLI runtime still uses 'cwd' and 'initialCwd'). Fields renamed: - SubprocessConfig.cwd -> working_directory - MCPStdioServerConfig['cwd'] -> working_directory - SessionContext.cwd -> working_directory - SessionListFilter.cwd -> working_directory - SessionFsConfig['initial_cwd'] -> initial_working_directory Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to workingDirectory in Node.js public API Rename the public-facing 'cwd' field to 'workingDirectory' in: - CopilotClientOptions.cwd - MCPStdioServerConfig.cwd - SessionContext.cwd - SessionListFilter.cwd The wire format (JSON sent to/from the Copilot CLI runtime) is preserved as 'cwd' via transformation layers in client.ts: - Outgoing: workingDirectory -> cwd (mcpServers, customAgents, listSessions filter) - Incoming: cwd -> workingDirectory (session context in toSessionMetadata) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix formatting in Node.js and Python after cwd rename Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Rust E2E test: use working_directory in McpStdioServerConfig Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix flaky tests: increase CLI start timeout and add missing snapshot - Node.js: Increase CLI server start timeout from 10s to 30s to accommodate slow Windows CI runners - Java: Add missing conversation to mcp_and_agents/should_accept_both_mcp_servers_and_custom_agents snapshot (was empty, causing proxy 500 errors) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Java .lastmerge to include snapshot fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Cwd/InitialCwd to WorkingDirectory/InitialWorkingDirectory in Go and .NET Complete the cwd → workingDirectory rename across all SDKs for consistency. Wire format (JSON) is preserved via struct tags and JsonPropertyName attributes. Go: - ClientOptions.Cwd → WorkingDirectory - SessionFsConfig.InitialCwd → InitialWorkingDirectory - SessionContext.Cwd → WorkingDirectory (json:"cwd") - SessionListFilter.Cwd → WorkingDirectory (json:"cwd,omitempty") .NET: - SessionFsConfig.InitialCwd → InitialWorkingDirectory ([JsonPropertyName("initialCwd")]) - SessionContext.Cwd → WorkingDirectory ([JsonPropertyName("cwd")]) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix missed Cwd reference and run go fmt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert Java SDK changes Remove Java preMcpToolCall hook implementation from this PR to be handled separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Node.js Windows CI test failure Split dependent SQL tool calls into separate CAPI turns in the session_fs_sqlite snapshot. The CREATE TABLE and INSERT were previously returned as separate choices in a single response, causing the CLI on Windows to execute them concurrently. Since INSERT depends on CREATE TABLE completing first, this produced a 'no such table: items' error. The fix restructures the snapshot into 3 CAPI turns: first executing report_intent + CREATE TABLE, then INSERT, then the final response. This ensures CREATE TABLE always completes before INSERT is attempted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Add preMcpToolCall hook support to all SDKs (github#1366) * Add preMcpToolCall hook support to all SDKs Add the preMcpToolCall hook which fires before an MCP tool call is dispatched to an MCP server. This aligns with copilot-agent-runtime 1.0.51 which added support for this hook type. The hook receives serverName, toolName, arguments, optional toolCallId, and optional _meta as input. The output supports a tri-state metaToUse field: absent (preserve existing _meta), null (remove _meta), or object (replace _meta). Changes per SDK: - Node.js: PreMcpToolCallHookInput/Output types, handler, SessionHooks - Python: PreMcpToolCallHookInput/Output TypedDicts, handler, SessionHooks - Go: PreMcpToolCallHookInput/Output structs, handler, helper functions - .NET: PreMcpToolCallHookInput/Output classes, SessionHooks, JsonElement? - Rust: PreMcpToolCallInput/Output structs, HookEvent/Output variants, trait Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add preMcpToolCall hook E2E tests for Node.js, Python, Go, and Rust Port the three preMcpToolCall hook test scenarios (set meta, replace meta, remove meta) from the .NET reference implementation to all four remaining SDK test suites. Each test: - Configures an MCP stdio server (meta-echo) that echoes _meta back - Registers a preMcpToolCall hook that sets/replaces/removes metadata - Verifies the tool result reflects the hook's effect - Asserts hook input fields (serverName, toolName, workingDirectory, timestamp) Snapshot files are reused from test/snapshots/pre_mcp_tool_call_hook/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix code review feedback and add .NET E2E test infrastructure - Add OnPreMcpToolCall to hasHooks checks in .NET Client.cs and Go client.go - Add SerializeHookOutput helper for source-gen serialization - Add .NET PreMcpToolCallHookE2ETests (3 tests: set, replace, remove meta) - Add MCP meta-echo test server and snapshot YAML files - Fix Go mcp_and_agents_e2e_test.go (Cwd -> WorkingDirectory) - Remove stale dead_code lint expectation in Rust support.rs - Add serialization unit tests for hook output Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Java PingResponse timestamp deserialization for ISO-8601 format The Copilot CLI now returns ISO-8601 timestamp strings instead of numeric epoch milliseconds. Update PingResponse.timestamp from long to String and PingResult.timestamp from Long to String. Update corresponding test assertions accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Regenerate Java codegen output Auto-committed by java-codegen-check workflow. * Fix Java test type mismatch: PingResult.timestamp is Long not String The generated PingResult record has timestamp as Long (milliseconds), but tests were passing String values (ISO date format). Update tests to use Long millisecond values instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Rust public API Rename the public `cwd` field to `working_directory` on: - ClientOptions (local-only, not serialized) - McpStdioServerConfig (serialized; add #[serde(rename = "cwd")]) - SessionListFilter (serialized; add #[serde(rename = "cwd")]) The wire format remains unchanged (JSON key stays "cwd"). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to working_directory in Python public API Rename all public API fields named 'cwd' to 'working_directory' and 'initial_cwd' to 'initial_working_directory' in the Python SDK while preserving the wire format (JSON sent to/from the Copilot CLI runtime still uses 'cwd' and 'initialCwd'). Fields renamed: - SubprocessConfig.cwd -> working_directory - MCPStdioServerConfig['cwd'] -> working_directory - SessionContext.cwd -> working_directory - SessionListFilter.cwd -> working_directory - SessionFsConfig['initial_cwd'] -> initial_working_directory Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename cwd to workingDirectory in Node.js public API Rename the public-facing 'cwd' field to 'workingDirectory' in: - CopilotClientOptions.cwd - MCPStdioServerConfig.cwd - SessionContext.cwd - SessionListFilter.cwd The wire format (JSON sent to/from the Copilot CLI runtime) is preserved as 'cwd' via transformation layers in client.ts: - Outgoing: workingDirectory -> cwd (mcpServers, customAgents, listSessions filter) - Incoming: cwd -> workingDirectory (session context in toSessionMetadata) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix formatting in Node.js and Python after cwd rename Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Rust E2E test: use working_directory in McpStdioServerConfig Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix flaky tests: increase CLI start timeout and add missing snapshot - Node.js: Increase CLI server start timeout from 10s to 30s to accommodate slow Windows CI runners - Java: Add missing conversation to mcp_and_agents/should_accept_both_mcp_servers_and_custom_agents snapshot (was empty, causing proxy 500 errors) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Java .lastmerge to include snapshot fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename Cwd/InitialCwd to WorkingDirectory/InitialWorkingDirectory in Go and .NET Complete the cwd → workingDirectory rename across all SDKs for consistency. Wire format (JSON) is preserved via struct tags and JsonPropertyName attributes. Go: - ClientOptions.Cwd → WorkingDirectory - SessionFsConfig.InitialCwd → InitialWorkingDirectory - SessionContext.Cwd → WorkingDirectory (json:"cwd") - SessionListFilter.Cwd → WorkingDirectory (json:"cwd,omitempty") .NET: - SessionFsConfig.InitialCwd → InitialWorkingDirectory ([JsonPropertyName("initialCwd")]) - SessionContext.Cwd → WorkingDirectory ([JsonPropertyName("cwd")]) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix missed Cwd reference and run go fmt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert Java SDK changes Remove Java preMcpToolCall hook implementation from this PR to be handled separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Node.js Windows CI test failure Split dependent SQL tool calls into separate CAPI turns in the session_fs_sqlite snapshot. The CREATE TABLE and INSERT were previously returned as separate choices in a single response, causing the CLI on Windows to execute them concurrently. Since INSERT depends on CREATE TABLE completing first, this produced a 'no such table: items' error. The fix restructures the snapshot into 3 CAPI turns: first executing report_intent + CREATE TABLE, then INSERT, then the final response. This ensures CREATE TABLE always completes before INSERT is attempted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Restore antrun git-clone mechanism and add missing codegen files Revert pom.xml to preserve the git-clone-based test harness setup (copilot.sdk.clone.dir = target/copilot-sdk/) instead of pointing at the monorepo root. Add scripts/codegen/package-lock.json (pins @github/copilot@1.0.49-3) and .gitignore that were missed in the initial file copy.
PreviousNext