Skip to content

Commit 3a1905b

Browse files
devGIT28Copilot
andcommitted
Add shared Windows.UI.Shell.Tasks (Forerunner) integration to SDK crate
Factor the common Rust integration with the experimental Windows.UI.Shell.Tasks ("Forerunner" / taskbar presence) API, previously duplicated between the Copilot desktop app (github/github-app) and the CLI (github/copilot-agent-runtime), into the github-copilot-sdk crate so both products can consume one implementation. New `shell_tasks` module under `rust/src/shell_tasks/`, behind the off-by-default `shell-tasks` Cargo feature: - `contract`: verbatim copy of the CLI `taskbar-contract` crate. Pure-std, FFI-free contract for the hover-card round-trip (named-pipe name, focus sidecar file name, sidecar payload format) with its unit tests. - `bindings`: verbatim copy of the CLI vendored WinRT projection of AppTaskContract, re-exported as `Windows`. Gated on `#[cfg(windows)]`. The `windows`/`windows-core` deps are optional and Windows-only (declared under [target.'cfg(windows)'.dependencies]), activated only by the `shell-tasks` feature, mirroring how `bundled-cli` gates its optional `zip` dep. Non-Windows and feature-off builds pull neither crate. Verified on Windows: default `cargo check` plus `cargo build/test/clippy/doc --features shell-tasks` all green (contract unit tests pass). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67c6593a-bb90-4106-a143-49c19fa32a0d Add shared AppTaskContent builder to shell_tasks module Extract the WinRT AppTaskContent call sequence that the Copilot desktop app and CLI implement identically into a neutral, data-driven builder. The new content module exposes a cross-platform ContentSpec/ContentBody data model plus #[cfg(windows)] build_content/make_uri/make_result_asset helpers that faithfully reproduce both products' WinRT sequences (CreateSequenceOfSteps, CreatePreviewThumbnail, CreateTextSummaryResult, CreateGeneratedAssetsResult, SetQuestion, AddButton, SetTextInput, AppTaskResultAsset::CreateInstance). Product-specific preparation (template dispatch, asset caps, file:// resolution, deep-link building) stays in each adapter, which hands the builder an already-resolved spec. Feature-gated behind shell-tasks; 4 new unit tests (15 total). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67c6593a-bb90-4106-a143-49c19fa32a0d Add shared sparse-package identity registrar to shell_tasks Factor the WinRT sparse (external-location) package registration routine out of the CLI's napi bridge into a napi-free shell_tasks::sparse module so both the CLI and the desktop app can share one implementation. The module exposes plain synchronous, #[cfg(windows)] functions (register_sparse_package, deregister_sparse_package, current_package_family_name) plus the process-lifetime MTA keepalive (ensure_process_mta) that guards windows-rs's cached activation factories against the 0xC0000005 fault. Neutral result types (RegisterOutcome, SparseError) compile on every platform. Each product wraps these in its own async surface (CLI napi AsyncTask; app spawn_blocking/Tauri) and keeps its own AppxManifest and registration trigger. Adds ApplicationModel/Management_Deployment/Win32_System_Com to the Windows-only optional windows dep. Feature-gated behind shell-tasks; 2 new cross-platform tests (19 total). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67c6593a-bb90-4106-a143-49c19fa32a0d Extract shell_tasks into standalone github-copilot-shell-tasks crate Move the shared Windows.UI.Shell.Tasks integration out of the github-copilot-sdk client crate into a standalone, build.rs-free workspace member at rust/crates/github-copilot-shell-tasks so it can be consumed by the CLI's napi addon (and the desktop app's Tauri backend) without dragging in the full SDK client dependency tree or its network-touching build.rs. - New crate github-copilot-shell-tasks (lib github_copilot_shell_tasks) owns contract/content/sparse/bindings; only deps are the Windows-only windows/windows-core crates, gated under cfg(windows). - rust/Cargo.toml becomes the workspace root; the shell-tasks feature now pulls the optional path dep, and the client re-exports it as github_copilot_sdk::shell_tasks. windows/windows-core deps moved to the new crate. Validated on Windows: standalone crate builds with no download and no warnings; 17 tests pass; clippy/doc clean; client builds/docs with --features shell-tasks; default (feature-off) check unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67c6593a-bb90-4106-a143-49c19fa32a0d Re-export windows/windows-core from shell-tasks crate for island consumers Add `pub use ::windows;` and `pub use ::windows_core;` (both `#[cfg(windows)]`) to the `github-copilot-shell-tasks` crate root so a consumer that adopts the crate as an isolated WinRT island (the desktop app's Tauri backend, pinned to an older `windows` via Tauri/wry) can funnel all of its Windows.UI.Shell.Tasks call-sites and the supporting WinRT types (Foundation::Uri, ApplicationModel::Package, Win32::System::Com, HSTRING) through the exact `windows` 0.62 version the projection was generated against, without declaring its own conflicting `windows` dependency. Crate build, clippy, and 17 unit tests pass; the client crate still builds with the `shell-tasks` feature. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67c6593a-bb90-4106-a143-49c19fa32a0d
1 parent f324f72 commit 3a1905b

9 files changed

Lines changed: 1904 additions & 0 deletions

File tree

rust/Cargo.lock

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,25 @@ include = [
2727
[lib]
2828
name = "github_copilot_sdk"
2929

30+
# This manifest is both the root package and the workspace root. The standalone
31+
# `github-copilot-shell-tasks` crate is a member so it builds/tests with the
32+
# workspace and can be depended on by path above.
33+
[workspace]
34+
members = ["crates/github-copilot-shell-tasks"]
35+
resolver = "3"
36+
3037
[features]
3138
default = ["bundled-cli"]
3239
bundled-cli = ["dep:tar", "dep:flate2", "dep:zip"]
3340
bundled-in-process = ["bundled-cli", "dep:libloading"]
3441
derive = ["dep:schemars"]
3542
test-support = []
43+
# Shared `Windows.UI.Shell.Tasks` ("Forerunner" / taskbar presence) integration,
44+
# re-exported as the `shell_tasks` module. Off by default to keep the base SDK
45+
# lean. Enabling it pulls the standalone, build.rs-free
46+
# `github-copilot-shell-tasks` crate (its `windows` / `windows-core` deps only
47+
# activate on Windows), mirroring how `bundled-cli` gates its optional `zip`.
48+
shell-tasks = ["dep:github-copilot-shell-tasks"]
3649

3750
# Build docs.rs documentation with all features so feature-gated APIs
3851
# (e.g. `define_tool`, `schema_for`) appear and intra-doc links resolve.
@@ -59,6 +72,10 @@ getrandom = "0.2"
5972
uuid = { version = "1", default-features = false, features = ["v4"] }
6073
flate2 = { version = "1", optional = true }
6174
tar = { version = "0.4", optional = true }
75+
# Shared Windows.UI.Shell.Tasks integration, re-exported as `shell_tasks` behind
76+
# the `shell-tasks` feature. Standalone + build.rs-free so enabling it does not
77+
# perturb the base SDK; its Windows-only WinRT deps activate only on Windows.
78+
github-copilot-shell-tasks = { version = "0.0.0-dev", path = "crates/github-copilot-shell-tasks", optional = true }
6279
# LLM inference callback transport: idiomatic HTTP/WebSocket forwarding for the
6380
# `CopilotRequestHandler`, plus base64/byte/stream plumbing for the chunk protocol.
6481
base64 = "0.22"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[package]
2+
name = "github-copilot-shell-tasks"
3+
version = "0.0.0-dev"
4+
edition = "2024"
5+
rust-version = "1.94.0"
6+
description = "Shared Windows.UI.Shell.Tasks (Forerunner / taskbar presence) integration for GitHub Copilot, consumable by the desktop app and CLI without the full SDK client."
7+
keywords = ["copilot", "github", "windows", "taskbar", "forerunner"]
8+
categories = ["os::windows-apis", "api-bindings"]
9+
repository = "https://github.com/github/copilot-sdk"
10+
homepage = "https://github.com/github/copilot-sdk"
11+
license = "MIT"
12+
13+
[lib]
14+
name = "github_copilot_shell_tasks"
15+
16+
# Intentionally lightweight: no build.rs, and the only dependencies are the
17+
# Windows-only WinRT crates. This lets a napi addon (CLI) or Tauri backend (app)
18+
# depend on the shared integration without dragging in the `github-copilot-sdk`
19+
# client crate (JSON-RPC, tokio, and its network-touching build.rs).
20+
[dependencies]
21+
22+
# `Foundation` covers the projection's `DateTime`/`IReference`/`Uri`;
23+
# `ApplicationModel` + `Management_Deployment` + `Win32_System_Com` back the
24+
# sparse-identity registrar (`sparse`); `windows-core` provides the WinRT
25+
# runtime. Declared under `cfg(windows)` so non-Windows builds pull neither
26+
# crate and the whole crate compiles as a pure-`std` no-op.
27+
[target.'cfg(windows)'.dependencies]
28+
windows = { version = "0.62", features = [
29+
"Foundation",
30+
"ApplicationModel",
31+
"Management_Deployment",
32+
"Win32_System_Com",
33+
] }
34+
windows-core = "0.62"

0 commit comments

Comments
 (0)