@agentproto/adapter-copilot-cli 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/COPILOT.md ADDED
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: copilot-cli
3
+ id: copilot-cli
4
+ description: GitHub's official Copilot CLI (`copilot --acp --stdio`) — a terminal coding agent driving GitHub-hosted models over the Agent Client Protocol. Public github.com and GitHub Enterprise (GH_HOST).
5
+ version: 0.1.0
6
+ bin: copilot
7
+ bin_args: ["--acp", "--stdio"]
8
+ install:
9
+ - method: npm
10
+ package: "@github/copilot"
11
+ global: true
12
+ - method: brew
13
+ package: copilot-cli
14
+ - method: curl
15
+ url: "https://gh.io/copilot-install"
16
+ version_check:
17
+ cmd: copilot --version
18
+ parse: "(\\d+\\.\\d+\\.\\d+)"
19
+ range: ">=0.0.410"
20
+ timeout_ms: 15000
21
+ auth:
22
+ ref: ./SECRETS.md
23
+ state:
24
+ env:
25
+ - COPILOT_GITHUB_TOKEN
26
+ - GH_TOKEN
27
+ - GITHUB_TOKEN
28
+ - GH_ENTERPRISE_TOKEN
29
+ - GITHUB_ENTERPRISE_TOKEN
30
+ sandbox: ./SANDBOX.md
31
+ protocol: acp
32
+ acp: ./copilot-acp.ACP.md
33
+ session:
34
+ mode: persistent
35
+ idle_timeout_ms: 1800000
36
+ context_carryover: true
37
+ capabilities:
38
+ streaming: true
39
+ tool_calls: true
40
+ sub_agents: false
41
+ file_io: true
42
+ multimodal: false
43
+ resumable: true
44
+ bidirectional: true
45
+ tags: ["copilot", "github", "acp", "agent-runtime", "coding", "enterprise"]
46
+ ---
47
+
48
+ # GitHub Copilot CLI adapter
49
+
50
+ `@agentproto/adapter-copilot-cli` wraps GitHub's official **Copilot CLI**
51
+ (binary `copilot`, GitHub: `github/copilot-cli`, docs:
52
+ <https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli>)
53
+ as an AIP-45 agent CLI by spawning `copilot --acp --stdio` — the CLI's own
54
+ first-party ACP-over-stdio server.
55
+
56
+ ## Why ACP, not a print bridge
57
+
58
+ GitHub Copilot CLI ships a first-party Agent Client Protocol server
59
+ (`copilot --acp`, stdio by default; `--acp --port N` for TCP). ACP support was
60
+ added in **0.0.397** (2026-01-28) and is in public preview. The server speaks
61
+ NDJSON JSON-RPC 2.0 over stdio, exposes **model** and **reasoning-effort** ACP
62
+ session config options, and supports **loading existing sessions** (0.0.410+).
63
+
64
+ The CLI also has a headless one-shot mode — `copilot -p "<prompt>"
65
+ --output-format json` emits JSONL, with `--model`, `--resume[=ID]`,
66
+ `--allow-all-tools`, and `--stream` — but ACP is the richer, persistent,
67
+ resumable posture, so this adapter drives ACP. It avoids a bespoke print event
68
+ mapper in `@agentproto/driver-agent-cli` (whose `event_schema` enum is closed).
69
+
70
+ ## Install
71
+
72
+ Any of the official channels works; the adapter declares all three:
73
+
74
+ ```bash
75
+ npm install -g @github/copilot # npm
76
+ brew install copilot-cli # Homebrew cask (macOS/Linux)
77
+ curl -fsSL https://gh.io/copilot-install | bash # installer script
78
+ ```
79
+
80
+ ## Auth — public github.com and GitHub Enterprise
81
+
82
+ Copilot CLI checks credentials in this order:
83
+
84
+ 1. `COPILOT_GITHUB_TOKEN`
85
+ 2. `GH_TOKEN`
86
+ 3. `GITHUB_TOKEN`
87
+ 4. OAuth token from the system keychain / `~/.copilot/config.json`
88
+ 5. `gh auth token` fallback
89
+
90
+ Supported token types: OAuth (`gho_`), fine-grained PAT with the **"Copilot
91
+ Requests"** permission (`github_pat_`, owned by a personal account), and GitHub
92
+ App user-to-server (`ghu_`). **Classic PATs (`ghp_`) are not supported.**
93
+
94
+ | Target | How |
95
+ |--------|-----|
96
+ | github.com | `GH_TOKEN` / `GITHUB_TOKEN` (or `copilot login`) |
97
+ | GHEC with data residency | `GH_HOST=example.ghe.com` + a `GH_TOKEN`/`GITHUB_TOKEN`, or `copilot login --host https://example.ghe.com` |
98
+ | GitHub Enterprise Server | `GH_HOST=YOUR-GHES-HOSTNAME` + `GH_ENTERPRISE_TOKEN` (or `GITHUB_ENTERPRISE_TOKEN`); the `COPILOT_PROVIDER_GHES_HOST` / `COPILOT_PROVIDER_GHES_TOKEN` / `COPILOT_OFFLINE=true` triple is the disconnected alternative |
99
+
100
+ The `github_host` option sets `GH_HOST` on the spawn.
101
+
102
+ ### BYOK (no GitHub login)
103
+
104
+ Copilot CLI can run against an OpenAI-compatible / Azure / Anthropic endpoint
105
+ with `COPILOT_PROVIDER_BASE_URL`, `COPILOT_PROVIDER_TYPE`,
106
+ `COPILOT_PROVIDER_API_KEY`, and `COPILOT_MODEL`. Not wired as options here;
107
+ pass them through the spawn `env` if you need it.
108
+
109
+ ## Models
110
+
111
+ The model menu is plan/entitlement-dependent and served under one GitHub
112
+ identity, and the exact `--model` slugs are not published in a stable table, so
113
+ this adapter declares **no fixed `models.allowed`**. Pass any id from the CLI's
114
+ `/model` picker through the free-form `model` option (e.g. `claude-sonnet-4.5`,
115
+ `gpt-5`, `auto`); it is applied via the ACP `model` session config option and
116
+ validated by the CLI against your account.
117
+
118
+ ## What's verified vs. assumed
119
+
120
+ **Verified from the official docs** (2026-10-01): the `copilot` binary name,
121
+ the `--acp --stdio` ACP surface and its stdio/TCP transports, the ACP server's
122
+ model + effort config options and session-load support, the token env
123
+ precedence and token types, the Enterprise host/token variables, and the
124
+ `-p --output-format json` headless surface.
125
+
126
+ **Not live-verified** (the `copilot` binary is not installed in this worktree):
127
+ the exact `copilot --version` stdout shape (the semver parse is conventional),
128
+ the precise ACP config-option ids (`model`/`effort` are assumed from the
129
+ changelog's "ACP model/effort session config options"), and the ACP
130
+ `promptCapabilities` (multimodal declared `false` conservatively).
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,59 @@
1
+ # copilot-cli — ACP wire profile
2
+
3
+ AIP-44 ACP profile for GitHub Copilot CLI's first-party ACP server. The agent
4
+ side is the `copilot` binary itself, spawned as `copilot --acp --stdio`
5
+ (NDJSON JSON-RPC 2.0 over stdio; the same server also runs over TCP via
6
+ `copilot --acp --port N`). Docs:
7
+ <https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server>.
8
+
9
+ ACP support was added in **0.0.397** (2026-01-28) and is in public preview.
10
+
11
+ ## Lifecycle
12
+
13
+ | Method | Behaviour |
14
+ | ----------------- | --------------------------------------------------------------- |
15
+ | `initialize` | Standard ACP handshake; returns `agentCapabilities` / `authMethods`. |
16
+ | `authenticate` | The server requires a Copilot login before `authenticate` returns success (0.0.7x changelog); auth is normally satisfied by the spawn env (see `SECRETS.md`). |
17
+ | `session/new` | Creates a session for the requested `cwd` + `mcpServers`; returns a session id. |
18
+ | `session/load` | Supported (0.0.410+, 2026-02-14) — backs this adapter's `native-resume` continuation. |
19
+ | `session/prompt` | Streams the turn as ACP `session/update` notifications (agent message chunks, tool calls, usage). |
20
+ | `session/cancel` | Cancels the in-flight turn. |
21
+ | `session/close` | Supported (closeSession request). |
22
+
23
+ ## Session config options
24
+
25
+ The server advertises config options via the `configOptions` API, including:
26
+
27
+ - **model** — the active Copilot model; can be changed during a session. This
28
+ adapter applies the `model` option via `session/set_config_option`.
29
+ - **effort** — reasoning effort (`low`/`medium`/`high`/`xhigh`/`max`). Applied
30
+ via `session/set_config_option`; the server also accepts
31
+ `--effort`/`--reasoning-effort` at start.
32
+ - **agent** — custom-agent selection.
33
+ - **allow_all** — unrestricted permissions.
34
+
35
+ ## Server-start options
36
+
37
+ Some settings are fixed when the server starts and inherited by every session
38
+ they create or load, because `session/new` does not carry them:
39
+
40
+ | Flag | Effect |
41
+ | ---- | ------ |
42
+ | `--available-tools=TOOL ...` | Restrict the session to the listed tools. |
43
+ | `--excluded-tools=TOOL ...` | Remove the listed tools. |
44
+ | `--effort=LEVEL` / `--reasoning-effort=LEVEL` | Initial reasoning effort. |
45
+
46
+ ## Permissions
47
+
48
+ Over ACP the server raises `session/request_permission` for tool use; the
49
+ agentproto ACP client auto-answers by default (`permissionHold` off), so tool
50
+ execution proceeds. The interactive CLI's `--allow-all-tools` /
51
+ `--allow-tool` / `--deny-tool` flags are a separate, launch-time surface.
52
+
53
+ ## Not surfaced
54
+
55
+ - **Subagents**: the server reports subagent ids/activity to its client, but
56
+ that is the agent's internal delegation, not an AIP-45 `sub_agents` surface.
57
+ - **Multimodal**: the ACP `promptCapabilities` are not documented; declared
58
+ `false` conservatively. (The interactive CLI accepts pasted images, but that
59
+ is not an ACP content-block channel.)
@@ -0,0 +1,38 @@
1
+ import { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+ export { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
3
+
4
+ /**
5
+ * @agentproto/adapter-copilot-cli — AIP-45 adapter for GitHub Copilot CLI.
6
+ *
7
+ * GitHub Copilot CLI (binary `copilot`, product name "GitHub Copilot CLI") is
8
+ * GitHub's official terminal coding agent — https://github.com/github/copilot-cli,
9
+ * docs at
10
+ * https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli.
11
+ *
12
+ * It ships a FIRST-PARTY ACP server, so — like the `grok-cli` adapter — this is
13
+ * a `protocol: "acp"` arm, not a print/headless one. `copilot --acp --stdio`
14
+ * speaks Agent Client Protocol JSON-RPC 2.0 as NDJSON over stdio (verified
15
+ * against the official docs at
16
+ * https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server;
17
+ * ACP was added in 0.0.397 on 2026-01-28 and is in public preview). The server
18
+ * exposes model and reasoning-effort ACP session config options and supports
19
+ * loading existing sessions.
20
+ *
21
+ * A headless one-shot surface also exists — `copilot -p "<prompt>"
22
+ * --output-format json` emits JSONL — but the ACP arm is the richer, persistent,
23
+ * resumable posture, and it avoids a bespoke print event mapper in the driver.
24
+ *
25
+ * import { copilotCli, copilotCliRuntime } from "@agentproto/adapter-copilot-cli"
26
+ * const session = await copilotCliRuntime().start({
27
+ * env: { GH_TOKEN: "github_pat_..." },
28
+ * })
29
+ * for await (const evt of session.send({ role: "user", content: "..." })) {
30
+ * console.log(evt)
31
+ * }
32
+ * await session.close()
33
+ */
34
+
35
+ declare const copilotCli: AgentCliHandle;
36
+ declare function copilotCliRuntime(): AgentCliRuntime;
37
+
38
+ export { copilotCli, copilotCliRuntime };
package/dist/index.mjs ADDED
@@ -0,0 +1,134 @@
1
+ import { defineAgentCli, createAgentCliRuntime } from '@agentproto/driver-agent-cli';
2
+
3
+ /**
4
+ * @agentproto/adapter-copilot-cli v0.1.0
5
+ * AIP-45 adapter for GitHub's official Copilot CLI in ACP mode (`copilot --acp --stdio`).
6
+ */
7
+
8
+ var copilotCli = defineAgentCli({
9
+ name: "copilot-cli",
10
+ id: "copilot-cli",
11
+ description: "GitHub's official Copilot CLI (`copilot --acp --stdio`) \u2014 a terminal coding agent driving GitHub-hosted models (Claude, GPT, Gemini, Grok, \u2026) over the Agent Client Protocol. Works with github.com and GitHub Enterprise (GH_HOST).",
12
+ version: "0.1.0",
13
+ bin: "copilot",
14
+ // First-party ACP server over stdio (the default transport when `--acp` is
15
+ // set; `--stdio` is passed explicitly to disambiguate from TCP `--port`).
16
+ bin_args: ["--acp", "--stdio"],
17
+ install: [
18
+ { method: "npm", package: "@github/copilot", global: true },
19
+ { method: "brew", package: "copilot-cli" },
20
+ { method: "curl", url: "https://gh.io/copilot-install" }
21
+ ],
22
+ version_check: {
23
+ // `copilot --version` / `-v` prints version information. The ACP server
24
+ // landed in 0.0.397 (2026-01-28); ACP session LOAD — the resume surface
25
+ // this adapter's `native-resume` continuation rides on — landed in 0.0.410
26
+ // (2026-02-14), so that is the floor. The exact stdout shape is UNVERIFIED
27
+ // (the CLI is not installed in this worktree), so the parse is the
28
+ // conventional semver grab.
29
+ cmd: "copilot --version",
30
+ parse: "(\\d+\\.\\d+\\.\\d+)",
31
+ range: ">=0.0.410",
32
+ timeout_ms: 15e3
33
+ },
34
+ auth: {
35
+ ref: "./SECRETS.md",
36
+ // Documented token precedence: COPILOT_GITHUB_TOKEN > GH_TOKEN >
37
+ // GITHUB_TOKEN (github.com and ghe.com subdomains). GitHub Enterprise
38
+ // Server uses GH_ENTERPRISE_TOKEN / GITHUB_ENTERPRISE_TOKEN. Supported
39
+ // token types: OAuth (`gho_`), fine-grained PAT with the "Copilot
40
+ // Requests" permission (`github_pat_`), and GitHub App user-to-server
41
+ // (`ghu_`). Classic PATs (`ghp_`) are NOT supported.
42
+ state: {
43
+ env: [
44
+ "COPILOT_GITHUB_TOKEN",
45
+ "GH_TOKEN",
46
+ "GITHUB_TOKEN",
47
+ "GH_ENTERPRISE_TOKEN",
48
+ "GITHUB_ENTERPRISE_TOKEN"
49
+ ]
50
+ }
51
+ },
52
+ sandbox: "./SANDBOX.md",
53
+ protocol: "acp",
54
+ acp: "./copilot-acp.ACP.md",
55
+ session: {
56
+ mode: "persistent",
57
+ idle_timeout_ms: 18e5,
58
+ context_carryover: true
59
+ },
60
+ // No `models` block by design: the model menu is plan/entitlement-dependent
61
+ // and served under ONE GitHub identity (not a per-provider api-key route the
62
+ // catalog could bill), and the exact `--model` slugs are not documented in a
63
+ // stable table. The honest surface is the free-form `model` option below,
64
+ // which the ACP arm applies via the `model` session config option; the CLI
65
+ // validates explicit ids against the account. `models.apply` therefore
66
+ // defaults to `"config"` (ACP set_config_option), and no catalog `provider`
67
+ // is declared — Copilot bills through the GitHub subscription, not a
68
+ // provider API key.
69
+ capabilities: {
70
+ streaming: true,
71
+ tool_calls: true,
72
+ // The ACP server reports subagent activity to its client, but that is the
73
+ // agent's own internal delegation, not an AIP-45 `sub_agents` surface —
74
+ // declared false, same posture as grok-cli.
75
+ sub_agents: false,
76
+ file_io: true,
77
+ // The ACP `promptCapabilities` for this server are not documented; declared
78
+ // false rather than overclaiming (the interactive CLI does accept pasted
79
+ // images, but that is not an ACP content-block channel).
80
+ multimodal: false,
81
+ // ACP session load (0.0.410+) backs the `native-resume` continuation.
82
+ resumable: true,
83
+ bidirectional: true
84
+ },
85
+ options: [
86
+ {
87
+ id: "model",
88
+ type: "string",
89
+ description: "Copilot model id for this session (e.g. `claude-sonnet-4.5`, `gpt-5`, `auto`). Applied via the ACP `model` session config option; the CLI validates the id against your plan/entitlements and rejects an unknown one."
90
+ },
91
+ {
92
+ id: "effort",
93
+ type: "enum",
94
+ enum: ["low", "medium", "high", "xhigh", "max"],
95
+ description: "Reasoning effort for this session. Applied via the ACP `effort` session config option (the server also accepts `--effort`/`--reasoning-effort` at start)."
96
+ },
97
+ {
98
+ id: "github_host",
99
+ type: "string",
100
+ description: "GitHub hostname for GitHub Enterprise \u2014 GHEC with data residency (e.g. `example.ghe.com`) or a GHES host. Sets `GH_HOST`; pair with `GH_ENTERPRISE_TOKEN` / `GITHUB_ENTERPRISE_TOKEN` for GitHub Enterprise Server.",
101
+ env: { GH_HOST: "{value}" }
102
+ }
103
+ ],
104
+ continuation: {
105
+ default: "native-resume",
106
+ supported: ["native-resume", "pinned-session", "transcript", "none"],
107
+ pinned_session: {
108
+ idle_timeout_ms: 18e5,
109
+ key_scope: ["conversation", "operator"]
110
+ }
111
+ },
112
+ metadata: {
113
+ acp: {
114
+ checked: "2026-10-01",
115
+ result: "GitHub Copilot CLI ships a first-party ACP server: `copilot --acp --stdio` (NDJSON JSON-RPC 2.0 over stdio; TCP via `--acp --port`). Added in 0.0.397 (2026-01-28), public preview. The server exposes model and reasoning-effort ACP session config options and supports loading existing sessions (0.0.410+). This adapter drives ACP, not the print/headless surface."
116
+ },
117
+ print: {
118
+ checked: "2026-10-01",
119
+ result: 'A headless one-shot surface also exists: `copilot -p "<prompt>" --output-format json` emits JSONL, with `--model`, `--resume[=ID]`, `--allow-all-tools`, `--stream`, and `--share-gist`. Not wired here \u2014 ACP is the richer posture and avoids a bespoke print event mapper.'
120
+ },
121
+ auth: {
122
+ checked: "2026-10-01",
123
+ result: "Token env precedence: COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN. GitHub Enterprise Cloud (data residency) uses `copilot login --host` or GH_HOST + a token; GitHub Enterprise Server uses GH_HOST + GH_ENTERPRISE_TOKEN/GITHUB_ENTERPRISE_TOKEN (or the COPILOT_PROVIDER_GHES_* vars). BYOK (COPILOT_PROVIDER_BASE_URL/TYPE/API_KEY/MODEL) can run without a GitHub login \u2014 not wired here."
124
+ }
125
+ },
126
+ tags: ["copilot", "github", "acp", "agent-runtime", "coding", "enterprise"]
127
+ });
128
+ function copilotCliRuntime() {
129
+ return createAgentCliRuntime(copilotCli);
130
+ }
131
+
132
+ export { copilotCli, copilotCliRuntime };
133
+ //# sourceMappingURL=index.mjs.map
134
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"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","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-copilot-cli — AIP-45 adapter for GitHub Copilot CLI.\n *\n * GitHub Copilot CLI (binary `copilot`, product name \"GitHub Copilot CLI\") is\n * GitHub's official terminal coding agent — https://github.com/github/copilot-cli,\n * docs at\n * https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli.\n *\n * It ships a FIRST-PARTY ACP server, so — like the `grok-cli` adapter — this is\n * a `protocol: \"acp\"` arm, not a print/headless one. `copilot --acp --stdio`\n * speaks Agent Client Protocol JSON-RPC 2.0 as NDJSON over stdio (verified\n * against the official docs at\n * https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server;\n * ACP was added in 0.0.397 on 2026-01-28 and is in public preview). The server\n * exposes model and reasoning-effort ACP session config options and supports\n * loading existing sessions.\n *\n * A headless one-shot surface also exists — `copilot -p \"<prompt>\"\n * --output-format json` emits JSONL — but the ACP arm is the richer, persistent,\n * resumable posture, and it avoids a bespoke print event mapper in the driver.\n *\n * import { copilotCli, copilotCliRuntime } from \"@agentproto/adapter-copilot-cli\"\n * const session = await copilotCliRuntime().start({\n * env: { GH_TOKEN: \"github_pat_...\" },\n * })\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const copilotCli: AgentCliHandle = defineAgentCli({\n name: \"copilot-cli\",\n id: \"copilot-cli\",\n description:\n \"GitHub's official Copilot CLI (`copilot --acp --stdio`) — a terminal coding agent driving GitHub-hosted models (Claude, GPT, Gemini, Grok, …) over the Agent Client Protocol. Works with github.com and GitHub Enterprise (GH_HOST).\",\n version: \"0.1.0\",\n bin: \"copilot\",\n // First-party ACP server over stdio (the default transport when `--acp` is\n // set; `--stdio` is passed explicitly to disambiguate from TCP `--port`).\n bin_args: [\"--acp\", \"--stdio\"],\n install: [\n { method: \"npm\", package: \"@github/copilot\", global: true },\n { method: \"brew\", package: \"copilot-cli\" },\n { method: \"curl\", url: \"https://gh.io/copilot-install\" },\n ],\n version_check: {\n // `copilot --version` / `-v` prints version information. The ACP server\n // landed in 0.0.397 (2026-01-28); ACP session LOAD — the resume surface\n // this adapter's `native-resume` continuation rides on — landed in 0.0.410\n // (2026-02-14), so that is the floor. The exact stdout shape is UNVERIFIED\n // (the CLI is not installed in this worktree), so the parse is the\n // conventional semver grab.\n cmd: \"copilot --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.0.410\",\n timeout_ms: 15_000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n // Documented token precedence: COPILOT_GITHUB_TOKEN > GH_TOKEN >\n // GITHUB_TOKEN (github.com and ghe.com subdomains). GitHub Enterprise\n // Server uses GH_ENTERPRISE_TOKEN / GITHUB_ENTERPRISE_TOKEN. Supported\n // token types: OAuth (`gho_`), fine-grained PAT with the \"Copilot\n // Requests\" permission (`github_pat_`), and GitHub App user-to-server\n // (`ghu_`). Classic PATs (`ghp_`) are NOT supported.\n state: {\n env: [\n \"COPILOT_GITHUB_TOKEN\",\n \"GH_TOKEN\",\n \"GITHUB_TOKEN\",\n \"GH_ENTERPRISE_TOKEN\",\n \"GITHUB_ENTERPRISE_TOKEN\",\n ],\n },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"acp\",\n acp: \"./copilot-acp.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n },\n // No `models` block by design: the model menu is plan/entitlement-dependent\n // and served under ONE GitHub identity (not a per-provider api-key route the\n // catalog could bill), and the exact `--model` slugs are not documented in a\n // stable table. The honest surface is the free-form `model` option below,\n // which the ACP arm applies via the `model` session config option; the CLI\n // validates explicit ids against the account. `models.apply` therefore\n // defaults to `\"config\"` (ACP set_config_option), and no catalog `provider`\n // is declared — Copilot bills through the GitHub subscription, not a\n // provider API key.\n capabilities: {\n streaming: true,\n tool_calls: true,\n // The ACP server reports subagent activity to its client, but that is the\n // agent's own internal delegation, not an AIP-45 `sub_agents` surface —\n // declared false, same posture as grok-cli.\n sub_agents: false,\n file_io: true,\n // The ACP `promptCapabilities` for this server are not documented; declared\n // false rather than overclaiming (the interactive CLI does accept pasted\n // images, but that is not an ACP content-block channel).\n multimodal: false,\n // ACP session load (0.0.410+) backs the `native-resume` continuation.\n resumable: true,\n bidirectional: true,\n },\n options: [\n {\n id: \"model\",\n type: \"string\",\n description:\n \"Copilot model id for this session (e.g. `claude-sonnet-4.5`, `gpt-5`, \" +\n \"`auto`). Applied via the ACP `model` session config option; the CLI \" +\n \"validates the id against your plan/entitlements and rejects an unknown one.\",\n },\n {\n id: \"effort\",\n type: \"enum\",\n enum: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n description:\n \"Reasoning effort for this session. Applied via the ACP `effort` session \" +\n \"config option (the server also accepts `--effort`/`--reasoning-effort` at start).\",\n },\n {\n id: \"github_host\",\n type: \"string\",\n description:\n \"GitHub hostname for GitHub Enterprise — GHEC with data residency \" +\n \"(e.g. `example.ghe.com`) or a GHES host. Sets `GH_HOST`; pair with \" +\n \"`GH_ENTERPRISE_TOKEN` / `GITHUB_ENTERPRISE_TOKEN` for GitHub Enterprise Server.\",\n env: { GH_HOST: \"{value}\" },\n },\n ],\n continuation: {\n default: \"native-resume\",\n supported: [\"native-resume\", \"pinned-session\", \"transcript\", \"none\"],\n pinned_session: {\n idle_timeout_ms: 1_800_000,\n key_scope: [\"conversation\", \"operator\"],\n },\n },\n metadata: {\n acp: {\n checked: \"2026-10-01\",\n result:\n \"GitHub Copilot CLI ships a first-party ACP server: `copilot --acp --stdio` \" +\n \"(NDJSON JSON-RPC 2.0 over stdio; TCP via `--acp --port`). Added in 0.0.397 \" +\n \"(2026-01-28), public preview. The server exposes model and reasoning-effort \" +\n \"ACP session config options and supports loading existing sessions (0.0.410+). \" +\n \"This adapter drives ACP, not the print/headless surface.\",\n },\n print: {\n checked: \"2026-10-01\",\n result:\n \"A headless one-shot surface also exists: `copilot -p \\\"<prompt>\\\" \" +\n \"--output-format json` emits JSONL, with `--model`, `--resume[=ID]`, \" +\n \"`--allow-all-tools`, `--stream`, and `--share-gist`. Not wired here — \" +\n \"ACP is the richer posture and avoids a bespoke print event mapper.\",\n },\n auth: {\n checked: \"2026-10-01\",\n result:\n \"Token env precedence: COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN. \" +\n \"GitHub Enterprise Cloud (data residency) uses `copilot login --host` or \" +\n \"GH_HOST + a token; GitHub Enterprise Server uses GH_HOST + \" +\n \"GH_ENTERPRISE_TOKEN/GITHUB_ENTERPRISE_TOKEN (or the COPILOT_PROVIDER_GHES_* \" +\n \"vars). BYOK (COPILOT_PROVIDER_BASE_URL/TYPE/API_KEY/MODEL) can run without \" +\n \"a GitHub login — not wired here.\",\n },\n },\n tags: [\"copilot\", \"github\", \"acp\", \"agent-runtime\", \"coding\", \"enterprise\"],\n})\n\nexport function copilotCliRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(copilotCli)\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@agentproto/adapter-copilot-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "@agentproto/adapter-copilot-cli — AIP-45 AGENT-CLI adapter for GitHub's official Copilot CLI (`copilot --acp --stdio`). Public github.com and GitHub Enterprise (GH_HOST).",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-45",
8
+ "copilot",
9
+ "github",
10
+ "acp",
11
+ "agent-cli",
12
+ "adapter"
13
+ ],
14
+ "homepage": "https://agentproto.sh/docs/aip-45",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/agentproto/ts",
18
+ "directory": "adapters/copilot-cli"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "type": "module",
22
+ "main": "dist/index.mjs",
23
+ "module": "dist/index.mjs",
24
+ "types": "dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.mjs",
29
+ "default": "./dist/index.mjs"
30
+ },
31
+ "./COPILOT.md": "./COPILOT.md",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "COPILOT.md",
37
+ "copilot-acp.ACP.md",
38
+ "README.md",
39
+ "LICENSE"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "@agentproto/driver-agent-cli": "2.6.4"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^25.9.5",
49
+ "tsup": "^8.5.1",
50
+ "typescript": "^5.9.3",
51
+ "vitest": "^3.2.7",
52
+ "@agentproto/tooling": "0.1.0"
53
+ },
54
+ "scripts": {
55
+ "dev": "tsup --watch",
56
+ "build": "tsup",
57
+ "clean": "rm -rf dist",
58
+ "check-types": "tsc --noEmit",
59
+ "test": "vitest run --passWithNoTests",
60
+ "test:watch": "vitest"
61
+ }
6
62
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.