agentmux_srv_core/backend/providers/copilot.rs
1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4use super::{Tier, ProviderConfig, ControllerType, InstructionDirScan};
5
6// GitHub Copilot CLI — Microsoft's coding agent. Runs in ACP mode via
7// `--acp` so the existing ACP controller drives it. Non-interactive
8// `-p`/`--prompt` doesn't accept stdin prompts (github/copilot-cli#96,
9// #1046), hence ACP.
10pub(super) static COPILOT: ProviderConfig = ProviderConfig {
11 id: "copilot",
12 tier: Tier::FirstClass,
13 cli_command: "copilot",
14 controller_type: ControllerType::Acp,
15 app_server: None,
16 launch_args: &["--acp"],
17 persistent_launch_args: None,
18 resume_flag: None,
19 session_id_field: "sessionId",
20 styled_output_format: "acp",
21 auth_config_dir_env_var: "COPILOT_HOME",
22 auth_dir_name: "copilot",
23 // ACP-native: no fixed on-disk history
24 // directory to redirect.
25 history_native_subdir: None,
26 auth_extra_env: &[],
27 unset_env: &[],
28 npm_package: "@github/copilot",
29 pinned_version: "1.0.115",
30 base_url_env_var: None,
31 supported_vendors: &["github"],
32 // Confirmed: GitHub Copilot CLI custom-instructions docs — supports
33 // AGENTS.md (root, single-file, no subdirectory needed) alongside
34 // .github/copilot-instructions.md, CLAUDE.md, GEMINI.md. AGENTS.md
35 // chosen as the one canonical target since Copilot has no single
36 // privileged default the way Gemini/Qwen do. See
37 // docs/specs/SPEC_PROVIDER_AWARE_STARTUP_INSTRUCTIONS_2026_08_24.md §2.
38 startup_instructions_filename: Some("AGENTS.md"),
39 // FOUR sources, all four named in the citation above: Copilot reads
40 // .github/copilot-instructions.md, CLAUDE.md and GEMINI.md alongside the
41 // AGENTS.md chosen as the write target. This is the case that proved the
42 // write target alone is the wrong question (Codex, PR #3144).
43 native_instruction_sources: &[
44 "AGENTS.md",
45 ".github/copilot-instructions.md",
46 "CLAUDE.md",
47 "GEMINI.md",
48 ],
49 // Path-scoped instructions: .github/instructions/**/*.instructions.md,
50 // claim 3 of the Copilot verification doc. Recursive, per the `**`.
51 // Not in the list above because it is a pattern, not a path.
52 //
53 // Deliberately NOT represented: $HOME/.copilot/copilot-instructions.md
54 // (claim 4) and $COPILOT_CUSTOM_INSTRUCTIONS_DIRS (claim 6). Both are
55 // real, and both live outside the agent working directory, which is
56 // what these two fields are relative to. Tracking them is a bigger
57 // question — they are machine-global, not project state, so they do
58 // not travel with a bundle — and is out of scope here rather than
59 // forgotten.
60 native_instruction_dirs: &[InstructionDirScan {
61 dir: ".github/instructions",
62 suffix: ".instructions.md",
63 recursive: true,
64 }],
65};