Repository navigation
Commit bc14ee3
feat(agent): manage Copilot CLI and VS Code Copilot Chat (#135)
* feat(agent): manage Copilot CLI and VS Code Copilot Chat
Part of #86. Two programs that point Copilot at the local LLM proxy, user
mode only:
- `programs.copilot` writes the Copilot CLI's BYOK provider registry
(`~/.copilot/providers.json`, or `$COPILOT_HOME` / `COPILOT_PROVIDERS_CONFIG`):
providers `agentdesktop` (OpenAI-shaped) and `agentdesktop-anthropic` on the
proxy's `/copilot-cli` route, with the pairing header; the user's own
providers are kept. Discovery reports the CLI and its version from the npm
manifest.
- `programs.vscode` with `copilotChat: ownModels` (default) writes
`chatLanguageModels.json` for Copilot Chat's built-in Custom Endpoint
provider on `/vscode-copilot`; the user's entries are kept.
- `copilotChat: githubModels` keeps GitHub's own models and the user's
Copilot seat: the daemon sets `github.copilot.advanced.debug.overrideCapiUrl`
in the user `settings.json` to the proxy's `/vscode-copilot-capi/<pairing>`
route (pairing in the path, since VS Code cannot add a header), forwards to
`llmGateway.proxyUrl` with the client's Copilot token moved aside, tunnels
the Responses WebSocket for agent mode, forwards `_ping` without a
credential, and keeps the override out of Settings Sync. `settings.json` is
edited in place (JSONC): only the managed keys change, comments, key order
and formatting stay, and removal restores the file byte for byte.
Managed files are written 0600 and carry a sidecar that records what the
daemon added, so removal takes out exactly that. A file the daemon cannot
parse is a conflict and left alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): keep a missing models key out of providers.json; README precision
- Copilot CLI: removing our providers by their pairing header (no sidecar)
no longer adds "models": null to a providers.json that has no models key.
- README: the CAPI WebSocket tunnel closes after 4 to 5 minutes with the
controller's default gatewayJwt.lifetime, also mid-turn; VS Code's
reconnect behaviour is not verified.
- README: the settings.json removal exceptions are listed in full (multi-line
empty object, comment-only file).
- README: the providers.json sidecar holds the user's own apiKey values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agent): an unreadable VS Code settings sidecar fails the apply; sidecar mode repaired
Review on #135.
- `.settings.json.agentdesktop` that is not JSON or not a known settings
state now fails the apply, as the providers.json and chatLanguageModels.json
sidecars already do: like a conflict, every managed file on the device
stays untouched, also while `programs.vscode` is not configured (removal
reads the sidecar too), and the daemon does not start. Before, the sidecar
was ignored and rebuilt from the sidecar-less rules, so a user's own
`overrideCapiUrl` was lost on removal. The error names the sidecar path and,
for a syntax error, the line and column only, never a value. A sidecar
without `version` (the earlier whole-document form) is still upgraded; a
leading byte-order mark is accepted.
- An identical sidecar whose mode is looser than 0600 is written again at
0600, as settings.json is; settings.json and its sidecar use the same
check (a 0700 settings.json is now also tightened). The rewrite of the
sidecar alone is not shown in the plan summary, since settings.json is
unchanged.
- README: the unreadable-sidecar behaviour and the sidecar's mode.
Behaviour change: the test `an_unreadable_sidecar_warns_and_apply_proceeds` is
replaced. Tests: 9 new, 2 of them unix-only. The file-mode tests in this
module (old and new) assume umask 022.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent bd296af commit bc14ee3
36 files changed
Lines changed: 8707 additions & 93 deletions
File tree
- crates
- agent
- src
- provider
- copilot
- testdata
- vscode
- testdata
- reconcile
- tests
- common
- core/src
- frontend
- controller/src
- views
- ui/src
- schema
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
134 | 154 | | |
135 | 155 | | |
136 | 156 | | |
| |||
180 | 200 | | |
181 | 201 | | |
182 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
183 | 211 | | |
184 | 212 | | |
185 | 213 | | |
| |||
250 | 278 | | |
251 | 279 | | |
252 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
253 | 297 | | |
254 | 298 | | |
255 | 299 | | |
| |||
371 | 415 | | |
372 | 416 | | |
373 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
374 | 421 | | |
375 | 422 | | |
376 | 423 | | |
| |||
856 | 903 | | |
857 | 904 | | |
858 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
859 | 916 | | |
860 | 917 | | |
861 | 918 | | |
| |||
886 | 943 | | |
887 | 944 | | |
888 | 945 | | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
889 | 956 | | |
890 | 957 | | |
891 | 958 | | |
| |||
1607 | 1674 | | |
1608 | 1675 | | |
1609 | 1676 | | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
1610 | 1719 | | |
1611 | 1720 | | |
1612 | 1721 | | |
| |||
1660 | 1769 | | |
1661 | 1770 | | |
1662 | 1771 | | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
1663 | 1811 | | |
1664 | 1812 | | |
1665 | 1813 | | |
| |||
0 commit comments