@ai-sdk/harness-github-copilot 0.0.0 → 1.0.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/CHANGELOG.md +12 -0
- package/LICENSE +13 -0
- package/README.md +41 -3
- package/dist/index.d.ts +11566 -0
- package/dist/index.js +420 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -11
- package/src/bridge/package.json +9 -0
- package/src/bridge/pnpm-lock.yaml +116 -0
- package/src/bridge/pnpm-workspace.yaml +2 -0
- package/src/github-copilot-harness.ts +467 -0
- package/src/index.ts +15 -0
- package/src/version.ts +5 -0
- package/index.js +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// src/github-copilot-harness.ts
|
|
2
|
+
import {
|
|
3
|
+
commonTool
|
|
4
|
+
} from "@ai-sdk/harness";
|
|
5
|
+
import { createCredentialRequestTransformation } from "@ai-sdk/harness/utils";
|
|
6
|
+
import { createACP } from "@ai-sdk/harness-acp";
|
|
7
|
+
import { tool } from "@ai-sdk/provider-utils";
|
|
8
|
+
import { z } from "zod/v4";
|
|
9
|
+
|
|
10
|
+
// src/version.ts
|
|
11
|
+
var VERSION = true ? "1.0.0" : "0.0.0-test";
|
|
12
|
+
|
|
13
|
+
// src/github-copilot-harness.ts
|
|
14
|
+
var GITHUB_COPILOT_CLIENT_APP = {
|
|
15
|
+
name: "ai-sdk/harness-github-copilot",
|
|
16
|
+
version: VERSION
|
|
17
|
+
};
|
|
18
|
+
var GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON = '{\n "name": "harness-github-copilot-bridge",\n "version": "0.0.0",\n "private": true,\n "type": "module",\n "dependencies": {\n "@github/copilot": "1.0.82"\n }\n}\n';
|
|
19
|
+
var GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK = "lockfileVersion: '9.0'\n\nsettings:\n autoInstallPeers: true\n excludeLinksFromLockfile: false\n\nimporters:\n\n .:\n dependencies:\n '@github/copilot':\n specifier: 1.0.82\n version: 1.0.82\n\npackages:\n\n '@github/copilot-darwin-arm64@1.0.82':\n resolution: {integrity: sha512-UpVSFA0COmlIakAr7/6WJqJlabtKgY8y5en6La3IxGxXsLlbkGoeevSqyfXvqJyHxaGn0YGpOC1oEPL379JfCw==}\n cpu: [arm64]\n os: [darwin]\n hasBin: true\n\n '@github/copilot-darwin-x64@1.0.82':\n resolution: {integrity: sha512-wMKbxK8fpKsbATjn9dE31Pae67H1xu6dmaCuyXpXjXLsNPVjeLFszJZ30MAOwxRWz4dmA8VvEJZmLgJekojo2Q==}\n cpu: [x64]\n os: [darwin]\n hasBin: true\n\n '@github/copilot-linux-arm64@1.0.82':\n resolution: {integrity: sha512-YDQmh0F+GzWORPmNNxQdcjHcXHxcy08dhMhbAhu4cqtMeA2sZWQqhfk9mJhHppMm9U0uR7h0KAB6nsgw/8Bsuw==}\n cpu: [arm64]\n os: [linux]\n libc: [glibc]\n hasBin: true\n\n '@github/copilot-linux-x64@1.0.82':\n resolution: {integrity: sha512-vqmG9665ktgLHAkGKMjp4uVMdHqLxi8uS9zL+g2pMwZUPoM7JxkaSfOoeyYr99caF7J6VIJTWv4LdRNQyG5jrQ==}\n cpu: [x64]\n os: [linux]\n libc: [glibc]\n hasBin: true\n\n '@github/copilot-linuxmusl-arm64@1.0.82':\n resolution: {integrity: sha512-14dWfa4rBME55bKmF+Z8V+WzZNgPQZKFFBQX+EOiAgLVV/arQCnQ1m7wwa5oXjQeCIgkS/L9J8uM8jNm6cZbOA==}\n cpu: [arm64]\n os: [linux]\n libc: [musl]\n hasBin: true\n\n '@github/copilot-linuxmusl-x64@1.0.82':\n resolution: {integrity: sha512-Mauqa2TBjtB8W/1KXF/jJ4MbtwnLvoEQNHYoSyoX+s+nIpttmixmYBJDwKV89ZlQRdjOCuxOgraRLQ9hjjXvNQ==}\n cpu: [x64]\n os: [linux]\n libc: [musl]\n hasBin: true\n\n '@github/copilot-win32-arm64@1.0.82':\n resolution: {integrity: sha512-PaW9s0GTgM+svtDkB583dZRrhLrO4o10y2ozMmQ0Hi5eB11C24UdC5U81nFlvKPED7+GlnBJIFQ+oHaxHrnp3A==}\n cpu: [arm64]\n os: [win32]\n hasBin: true\n\n '@github/copilot-win32-x64@1.0.82':\n resolution: {integrity: sha512-m4iSROOMEPp1yRIQQwbnO0CDfwB4syESyHoeSLLFuynMR4/ApghAdyBrBQQcTKGsUu3R5rOE64RYlVmyKmuA9A==}\n cpu: [x64]\n os: [win32]\n hasBin: true\n\n '@github/copilot@1.0.82':\n resolution: {integrity: sha512-+mDIwBO3dCpL3k2rVLc4+1tFzqcVBTJNA/0co+okEpmCgcHjaz91Cqq7++pJKN5yJQuGC6bKangm7PSoheI1Xw==}\n hasBin: true\n\n detect-libc@2.1.2:\n resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}\n engines: {node: '>=8'}\n\nsnapshots:\n\n '@github/copilot-darwin-arm64@1.0.82':\n optional: true\n\n '@github/copilot-darwin-x64@1.0.82':\n optional: true\n\n '@github/copilot-linux-arm64@1.0.82':\n optional: true\n\n '@github/copilot-linux-x64@1.0.82':\n optional: true\n\n '@github/copilot-linuxmusl-arm64@1.0.82':\n optional: true\n\n '@github/copilot-linuxmusl-x64@1.0.82':\n optional: true\n\n '@github/copilot-win32-arm64@1.0.82':\n optional: true\n\n '@github/copilot-win32-x64@1.0.82':\n optional: true\n\n '@github/copilot@1.0.82':\n dependencies:\n detect-libc: 2.1.2\n optionalDependencies:\n '@github/copilot-darwin-arm64': 1.0.82\n '@github/copilot-darwin-x64': 1.0.82\n '@github/copilot-linux-arm64': 1.0.82\n '@github/copilot-linux-x64': 1.0.82\n '@github/copilot-linuxmusl-arm64': 1.0.82\n '@github/copilot-linuxmusl-x64': 1.0.82\n '@github/copilot-win32-arm64': 1.0.82\n '@github/copilot-win32-x64': 1.0.82\n\n detect-libc@2.1.2: {}\n";
|
|
20
|
+
var GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE = "allowBuilds:\n '@github/copilot@1.0.82': true\n";
|
|
21
|
+
var GITHUB_COPILOT_BUILTIN_TOOLS = {
|
|
22
|
+
bash: {
|
|
23
|
+
...commonTool("bash", {
|
|
24
|
+
nativeName: "bash",
|
|
25
|
+
toolUseKind: "bash",
|
|
26
|
+
inputSchema: z.looseObject({
|
|
27
|
+
command: z.string(),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
shellId: z.string().optional(),
|
|
30
|
+
mode: z.enum(["sync", "async"]).optional(),
|
|
31
|
+
detach: z.boolean().optional(),
|
|
32
|
+
initial_wait: z.number().optional()
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
read_bash: {
|
|
37
|
+
...tool({
|
|
38
|
+
title: "Reading shell output",
|
|
39
|
+
inputSchema: z.looseObject({
|
|
40
|
+
shellId: z.string(),
|
|
41
|
+
delay: z.number()
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
toolUseKind: "readonly"
|
|
45
|
+
},
|
|
46
|
+
stop_bash: {
|
|
47
|
+
...tool({
|
|
48
|
+
title: "Stopping shell session",
|
|
49
|
+
inputSchema: z.looseObject({ shellId: z.string() })
|
|
50
|
+
}),
|
|
51
|
+
toolUseKind: "bash"
|
|
52
|
+
},
|
|
53
|
+
list_bash: {
|
|
54
|
+
...tool({
|
|
55
|
+
title: "list_bash",
|
|
56
|
+
inputSchema: z.looseObject({})
|
|
57
|
+
}),
|
|
58
|
+
toolUseKind: "readonly"
|
|
59
|
+
},
|
|
60
|
+
view: {
|
|
61
|
+
...tool({
|
|
62
|
+
title: "Viewing ",
|
|
63
|
+
inputSchema: z.looseObject({
|
|
64
|
+
path: z.string(),
|
|
65
|
+
view_range: z.array(z.number()).optional(),
|
|
66
|
+
forceReadLargeFiles: z.boolean().optional()
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
toolUseKind: "readonly"
|
|
70
|
+
},
|
|
71
|
+
create: {
|
|
72
|
+
...tool({
|
|
73
|
+
title: "Creating ",
|
|
74
|
+
inputSchema: z.looseObject({
|
|
75
|
+
path: z.string(),
|
|
76
|
+
file_text: z.string()
|
|
77
|
+
})
|
|
78
|
+
}),
|
|
79
|
+
toolUseKind: "edit"
|
|
80
|
+
},
|
|
81
|
+
edit: {
|
|
82
|
+
...tool({
|
|
83
|
+
title: "Editing ",
|
|
84
|
+
inputSchema: z.looseObject({
|
|
85
|
+
path: z.string(),
|
|
86
|
+
old_str: z.string().optional(),
|
|
87
|
+
new_str: z.string()
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
toolUseKind: "edit"
|
|
91
|
+
},
|
|
92
|
+
web_fetch: {
|
|
93
|
+
...tool({
|
|
94
|
+
title: "Fetching ",
|
|
95
|
+
inputSchema: z.looseObject({
|
|
96
|
+
url: z.string(),
|
|
97
|
+
max_length: z.number().optional(),
|
|
98
|
+
start_index: z.number().optional(),
|
|
99
|
+
raw: z.boolean().optional()
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
toolUseKind: "readonly"
|
|
103
|
+
},
|
|
104
|
+
skill: tool({
|
|
105
|
+
title: "Using skill: ",
|
|
106
|
+
inputSchema: z.looseObject({ skill: z.string() })
|
|
107
|
+
}),
|
|
108
|
+
sql: tool({
|
|
109
|
+
inputSchema: z.looseObject({
|
|
110
|
+
description: z.string(),
|
|
111
|
+
query: z.string(),
|
|
112
|
+
database: z.enum(["session", "session_store"]).optional()
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
read_agent: {
|
|
116
|
+
...tool({
|
|
117
|
+
title: "read_agent",
|
|
118
|
+
inputSchema: z.looseObject({
|
|
119
|
+
agent_id: z.string(),
|
|
120
|
+
wait: z.boolean().optional(),
|
|
121
|
+
timeout: z.number().optional(),
|
|
122
|
+
since_turn: z.number().int().nonnegative().optional()
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
toolUseKind: "readonly"
|
|
126
|
+
},
|
|
127
|
+
list_agents: {
|
|
128
|
+
...tool({
|
|
129
|
+
title: "list_agents",
|
|
130
|
+
inputSchema: z.looseObject({
|
|
131
|
+
include_completed: z.boolean().optional(),
|
|
132
|
+
scope: z.enum(["siblings", "children", "all"]).optional()
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
toolUseKind: "readonly"
|
|
136
|
+
},
|
|
137
|
+
write_agent: tool({
|
|
138
|
+
title: "write_agent",
|
|
139
|
+
inputSchema: z.looseObject({
|
|
140
|
+
message: z.string(),
|
|
141
|
+
agent_id: z.string().optional(),
|
|
142
|
+
agent_ids: z.array(z.string()).optional(),
|
|
143
|
+
scope: z.enum(["siblings", "children"]).optional()
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
grep: {
|
|
147
|
+
...commonTool("grep", {
|
|
148
|
+
nativeName: "grep",
|
|
149
|
+
toolUseKind: "readonly",
|
|
150
|
+
inputSchema: z.looseObject({
|
|
151
|
+
pattern: z.string(),
|
|
152
|
+
path: z.string().optional(),
|
|
153
|
+
paths: z.array(z.string()).optional(),
|
|
154
|
+
glob: z.string().optional(),
|
|
155
|
+
output_mode: z.enum(["content", "files_with_matches", "count"]).optional(),
|
|
156
|
+
case_insensitive: z.boolean().optional(),
|
|
157
|
+
multiline: z.boolean().optional(),
|
|
158
|
+
head_limit: z.number().optional(),
|
|
159
|
+
context: z.number().optional(),
|
|
160
|
+
before_context: z.number().optional(),
|
|
161
|
+
after_context: z.number().optional()
|
|
162
|
+
})
|
|
163
|
+
}),
|
|
164
|
+
title: "Searching for "
|
|
165
|
+
},
|
|
166
|
+
glob: {
|
|
167
|
+
...commonTool("glob", {
|
|
168
|
+
nativeName: "glob",
|
|
169
|
+
toolUseKind: "readonly",
|
|
170
|
+
inputSchema: z.looseObject({
|
|
171
|
+
pattern: z.string(),
|
|
172
|
+
paths: z.array(z.string()).optional()
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
title: "Finding files matching "
|
|
176
|
+
},
|
|
177
|
+
task: tool({
|
|
178
|
+
inputSchema: z.looseObject({
|
|
179
|
+
name: z.string(),
|
|
180
|
+
prompt: z.string(),
|
|
181
|
+
agent_type: z.enum([
|
|
182
|
+
"explore",
|
|
183
|
+
"task",
|
|
184
|
+
"general-purpose",
|
|
185
|
+
"code-review",
|
|
186
|
+
"research",
|
|
187
|
+
"security-review"
|
|
188
|
+
]),
|
|
189
|
+
description: z.string(),
|
|
190
|
+
model: z.string().optional(),
|
|
191
|
+
context_tier: z.enum(["default", "long_context"]).optional(),
|
|
192
|
+
mode: z.enum(["sync", "background"]).optional()
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
};
|
|
196
|
+
function createGitHubCopilot(settings = {}) {
|
|
197
|
+
const mcpToolTitlePrefixes = [
|
|
198
|
+
"github-mcp-server-",
|
|
199
|
+
...Object.keys(settings.mcpServers ?? {}).map((name) => `${name}-`)
|
|
200
|
+
];
|
|
201
|
+
return createACP({
|
|
202
|
+
version: "v1",
|
|
203
|
+
harnessId: "github-copilot",
|
|
204
|
+
clientApp: GITHUB_COPILOT_CLIENT_APP,
|
|
205
|
+
source: {
|
|
206
|
+
type: "npm-locked",
|
|
207
|
+
packageJson: GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON,
|
|
208
|
+
pnpmLockYaml: GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK,
|
|
209
|
+
pnpmWorkspaceYaml: GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE
|
|
210
|
+
},
|
|
211
|
+
executable: "copilot",
|
|
212
|
+
args: [
|
|
213
|
+
"--acp",
|
|
214
|
+
"--stdio",
|
|
215
|
+
"--no-auto-update",
|
|
216
|
+
...settings.reasoningEffort == null ? [] : [`--reasoning-effort=${settings.reasoningEffort}`]
|
|
217
|
+
],
|
|
218
|
+
auth: settings.auth,
|
|
219
|
+
/*
|
|
220
|
+
* The Copilot CLI drops every MCP server that a client passes in ACP
|
|
221
|
+
* `session/new` unless it is declared with the `http` or `sse` transport,
|
|
222
|
+
* so host tools must be exposed over the bridge's HTTP MCP endpoint.
|
|
223
|
+
*/
|
|
224
|
+
hostToolMcpTransport: "http",
|
|
225
|
+
forwardEnv: ["COPILOT_GH_HOST", "GH_HOST"],
|
|
226
|
+
credentialEnv: ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"],
|
|
227
|
+
credentialBrokering: ({ env, sandboxEnv, headers }) => {
|
|
228
|
+
const transformations = [];
|
|
229
|
+
const githubHost = normalizeGitHubHost(
|
|
230
|
+
env.COPILOT_GH_HOST ?? env.GH_HOST ?? "github.com"
|
|
231
|
+
);
|
|
232
|
+
const githubHosts = [
|
|
233
|
+
githubHost,
|
|
234
|
+
`*.${githubHost}`,
|
|
235
|
+
...githubHost === "github.com" ? ["githubcopilot.com", "*.githubcopilot.com"] : []
|
|
236
|
+
];
|
|
237
|
+
for (const host of githubHosts) {
|
|
238
|
+
if (env.COPILOT_GITHUB_TOKEN && sandboxEnv?.COPILOT_GITHUB_TOKEN) {
|
|
239
|
+
transformations.push(
|
|
240
|
+
{
|
|
241
|
+
match: {
|
|
242
|
+
host,
|
|
243
|
+
headers: [
|
|
244
|
+
{
|
|
245
|
+
key: { exact: "Authorization" },
|
|
246
|
+
value: {
|
|
247
|
+
exact: `Bearer ${sandboxEnv.COPILOT_GITHUB_TOKEN}`
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
transform: {
|
|
253
|
+
headers: {
|
|
254
|
+
Authorization: `Bearer ${env.COPILOT_GITHUB_TOKEN}`
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
match: {
|
|
260
|
+
host,
|
|
261
|
+
headers: [
|
|
262
|
+
{
|
|
263
|
+
key: { exact: "Authorization" },
|
|
264
|
+
value: {
|
|
265
|
+
exact: `token ${sandboxEnv.COPILOT_GITHUB_TOKEN}`
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
transform: {
|
|
271
|
+
headers: {
|
|
272
|
+
Authorization: `token ${env.COPILOT_GITHUB_TOKEN}`
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
if (env.GH_TOKEN && sandboxEnv?.GH_TOKEN) {
|
|
279
|
+
transformations.push(
|
|
280
|
+
{
|
|
281
|
+
match: {
|
|
282
|
+
host,
|
|
283
|
+
headers: [
|
|
284
|
+
{
|
|
285
|
+
key: { exact: "Authorization" },
|
|
286
|
+
value: { exact: `Bearer ${sandboxEnv.GH_TOKEN}` }
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
transform: {
|
|
291
|
+
headers: { Authorization: `Bearer ${env.GH_TOKEN}` }
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
match: {
|
|
296
|
+
host,
|
|
297
|
+
headers: [
|
|
298
|
+
{
|
|
299
|
+
key: { exact: "Authorization" },
|
|
300
|
+
value: { exact: `token ${sandboxEnv.GH_TOKEN}` }
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
transform: {
|
|
305
|
+
headers: { Authorization: `token ${env.GH_TOKEN}` }
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
if (env.GITHUB_TOKEN && sandboxEnv?.GITHUB_TOKEN) {
|
|
311
|
+
transformations.push(
|
|
312
|
+
{
|
|
313
|
+
match: {
|
|
314
|
+
host,
|
|
315
|
+
headers: [
|
|
316
|
+
{
|
|
317
|
+
key: { exact: "Authorization" },
|
|
318
|
+
value: { exact: `Bearer ${sandboxEnv.GITHUB_TOKEN}` }
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
transform: {
|
|
323
|
+
headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}` }
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
match: {
|
|
328
|
+
host,
|
|
329
|
+
headers: [
|
|
330
|
+
{
|
|
331
|
+
key: { exact: "Authorization" },
|
|
332
|
+
value: { exact: `token ${sandboxEnv.GITHUB_TOKEN}` }
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
transform: {
|
|
337
|
+
headers: { Authorization: `token ${env.GITHUB_TOKEN}` }
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const providerCredential = env.COPILOT_PROVIDER_API_KEY;
|
|
344
|
+
const sandboxProviderCredential = sandboxEnv?.COPILOT_PROVIDER_API_KEY;
|
|
345
|
+
const providerBaseUrl = env.COPILOT_PROVIDER_BASE_URL;
|
|
346
|
+
if (providerCredential && sandboxProviderCredential && providerBaseUrl) {
|
|
347
|
+
transformations.push(
|
|
348
|
+
createCredentialRequestTransformation({
|
|
349
|
+
matchUrl: providerBaseUrl,
|
|
350
|
+
matchHeaders: {
|
|
351
|
+
Authorization: `Bearer ${sandboxProviderCredential}`
|
|
352
|
+
},
|
|
353
|
+
transformHeaders: {
|
|
354
|
+
...headers,
|
|
355
|
+
Authorization: `Bearer ${providerCredential}`
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
} else if (headers != null) {
|
|
360
|
+
const copilotHosts = githubHost === "github.com" ? ["githubcopilot.com", "*.githubcopilot.com"] : [githubHost, `*.${githubHost}`];
|
|
361
|
+
for (const host of copilotHosts) {
|
|
362
|
+
transformations.push({
|
|
363
|
+
match: { host },
|
|
364
|
+
transform: { headers }
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return transformations;
|
|
369
|
+
},
|
|
370
|
+
credentialForwarding: settings.credentialForwarding,
|
|
371
|
+
providerAuthentication: {
|
|
372
|
+
gateway: {
|
|
373
|
+
env: {
|
|
374
|
+
COPILOT_PROVIDER_BASE_URL: {
|
|
375
|
+
$source: "gateway-base-url",
|
|
376
|
+
ensureSuffix: "/v1"
|
|
377
|
+
},
|
|
378
|
+
COPILOT_PROVIDER_TYPE: "openai",
|
|
379
|
+
COPILOT_PROVIDER_API_KEY: {
|
|
380
|
+
$source: "gateway-api-key"
|
|
381
|
+
},
|
|
382
|
+
COPILOT_PROVIDER_WIRE_API: "responses",
|
|
383
|
+
COPILOT_MODEL: "openai/gpt-5.5",
|
|
384
|
+
COPILOT_PROVIDER_HEADERS: {
|
|
385
|
+
$source: "client-app",
|
|
386
|
+
prefix: "x-client-app: "
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
modelMapping: {
|
|
392
|
+
type: "session-config-option",
|
|
393
|
+
path: "model"
|
|
394
|
+
},
|
|
395
|
+
skillsDirectory: ".copilot/skills",
|
|
396
|
+
instructionMapping: {
|
|
397
|
+
type: "filesystem",
|
|
398
|
+
path: ".copilot/copilot-instructions.md"
|
|
399
|
+
},
|
|
400
|
+
builtinTools: GITHUB_COPILOT_BUILTIN_TOOLS,
|
|
401
|
+
mcpServers: settings.mcpServers,
|
|
402
|
+
isMcpToolCall: (toolCall) => mcpToolTitlePrefixes.some((prefix) => toolCall.title.startsWith(prefix)),
|
|
403
|
+
port: settings.port,
|
|
404
|
+
portEndpoint: settings.portEndpoint,
|
|
405
|
+
startupTimeoutMs: settings.startupTimeoutMs,
|
|
406
|
+
mintBridgeToken: settings.mintBridgeToken
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
function normalizeGitHubHost(host) {
|
|
410
|
+
return new URL(host.includes("://") ? host : `https://${host}`).hostname;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/index.ts
|
|
414
|
+
var githubCopilot = createGitHubCopilot();
|
|
415
|
+
export {
|
|
416
|
+
VERSION,
|
|
417
|
+
createGitHubCopilot,
|
|
418
|
+
githubCopilot
|
|
419
|
+
};
|
|
420
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/github-copilot-harness.ts","../src/version.ts","../src/index.ts"],"sourcesContent":["import {\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n type HarnessV1CredentialForwarding,\n type HarnessV1PortEndpoint,\n type HarnessV1RequestTransformation,\n} from '@ai-sdk/harness';\nimport { createCredentialRequestTransformation } from '@ai-sdk/harness/utils';\nimport { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\n\ndeclare const __GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON__: string;\ndeclare const __GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK_YAML__: string;\ndeclare const __GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE_YAML__: string;\n\nconst GITHUB_COPILOT_CLIENT_APP = {\n name: 'ai-sdk/harness-github-copilot',\n version: VERSION,\n} as const;\nconst GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON =\n __GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON__;\nconst GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK =\n __GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK_YAML__;\nconst GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE =\n __GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE_YAML__;\n\nexport type GitHubCopilotAuthenticationMode = ACPAuthenticationMode;\n\nexport type GitHubCopilotHarnessSettings = {\n readonly auth?: GitHubCopilotAuthenticationMode;\n readonly credentialForwarding?: HarnessV1CredentialForwarding;\n readonly reasoningEffort?:\n | 'none'\n | 'minimal'\n | 'low'\n | 'medium'\n | 'high'\n | 'xhigh'\n | 'max';\n readonly mcpServers?: Record<string, unknown>;\n readonly port?: number;\n readonly portEndpoint?: HarnessV1PortEndpoint;\n readonly startupTimeoutMs?: number;\n readonly mintBridgeToken?: (sandboxId: string) => string;\n};\n\n/*\n * This catalog reflects the stable, non-MCP tool surface emitted by GitHub\n * Copilot CLI 1.0.82. Loose object schemas preserve compatibility when the\n * CLI adds fields without changing the established inputs.\n */\nconst GITHUB_COPILOT_BUILTIN_TOOLS = {\n bash: {\n ...commonTool('bash', {\n nativeName: 'bash',\n toolUseKind: 'bash',\n inputSchema: z.looseObject({\n command: z.string(),\n description: z.string().optional(),\n shellId: z.string().optional(),\n mode: z.enum(['sync', 'async']).optional(),\n detach: z.boolean().optional(),\n initial_wait: z.number().optional(),\n }),\n }),\n },\n read_bash: {\n ...tool({\n title: 'Reading shell output',\n inputSchema: z.looseObject({\n shellId: z.string(),\n delay: z.number(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n stop_bash: {\n ...tool({\n title: 'Stopping shell session',\n inputSchema: z.looseObject({ shellId: z.string() }),\n }),\n toolUseKind: 'bash',\n },\n list_bash: {\n ...tool({\n title: 'list_bash',\n inputSchema: z.looseObject({}),\n }),\n toolUseKind: 'readonly',\n },\n view: {\n ...tool({\n title: 'Viewing ',\n inputSchema: z.looseObject({\n path: z.string(),\n view_range: z.array(z.number()).optional(),\n forceReadLargeFiles: z.boolean().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n create: {\n ...tool({\n title: 'Creating ',\n inputSchema: z.looseObject({\n path: z.string(),\n file_text: z.string(),\n }),\n }),\n toolUseKind: 'edit',\n },\n edit: {\n ...tool({\n title: 'Editing ',\n inputSchema: z.looseObject({\n path: z.string(),\n old_str: z.string().optional(),\n new_str: z.string(),\n }),\n }),\n toolUseKind: 'edit',\n },\n web_fetch: {\n ...tool({\n title: 'Fetching ',\n inputSchema: z.looseObject({\n url: z.string(),\n max_length: z.number().optional(),\n start_index: z.number().optional(),\n raw: z.boolean().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n skill: tool({\n title: 'Using skill: ',\n inputSchema: z.looseObject({ skill: z.string() }),\n }),\n sql: tool({\n inputSchema: z.looseObject({\n description: z.string(),\n query: z.string(),\n database: z.enum(['session', 'session_store']).optional(),\n }),\n }),\n read_agent: {\n ...tool({\n title: 'read_agent',\n inputSchema: z.looseObject({\n agent_id: z.string(),\n wait: z.boolean().optional(),\n timeout: z.number().optional(),\n since_turn: z.number().int().nonnegative().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n list_agents: {\n ...tool({\n title: 'list_agents',\n inputSchema: z.looseObject({\n include_completed: z.boolean().optional(),\n scope: z.enum(['siblings', 'children', 'all']).optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n write_agent: tool({\n title: 'write_agent',\n inputSchema: z.looseObject({\n message: z.string(),\n agent_id: z.string().optional(),\n agent_ids: z.array(z.string()).optional(),\n scope: z.enum(['siblings', 'children']).optional(),\n }),\n }),\n grep: {\n ...commonTool('grep', {\n nativeName: 'grep',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n path: z.string().optional(),\n paths: z.array(z.string()).optional(),\n glob: z.string().optional(),\n output_mode: z\n .enum(['content', 'files_with_matches', 'count'])\n .optional(),\n case_insensitive: z.boolean().optional(),\n multiline: z.boolean().optional(),\n head_limit: z.number().optional(),\n context: z.number().optional(),\n before_context: z.number().optional(),\n after_context: z.number().optional(),\n }),\n }),\n title: 'Searching for ',\n },\n glob: {\n ...commonTool('glob', {\n nativeName: 'glob',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n paths: z.array(z.string()).optional(),\n }),\n }),\n title: 'Finding files matching ',\n },\n task: tool({\n inputSchema: z.looseObject({\n name: z.string(),\n prompt: z.string(),\n agent_type: z.enum([\n 'explore',\n 'task',\n 'general-purpose',\n 'code-review',\n 'research',\n 'security-review',\n ]),\n description: z.string(),\n model: z.string().optional(),\n context_tier: z.enum(['default', 'long_context']).optional(),\n mode: z.enum(['sync', 'background']).optional(),\n }),\n }),\n} as const satisfies Record<string, HarnessV1BuiltinTool<any, any>>;\n\nexport type GitHubCopilotBuiltinTools = typeof GITHUB_COPILOT_BUILTIN_TOOLS;\n\nexport function createGitHubCopilot(\n settings: GitHubCopilotHarnessSettings = {},\n): HarnessV1<GitHubCopilotBuiltinTools> {\n const mcpToolTitlePrefixes = [\n 'github-mcp-server-',\n ...Object.keys(settings.mcpServers ?? {}).map(name => `${name}-`),\n ];\n\n return createACP({\n version: 'v1',\n harnessId: 'github-copilot',\n clientApp: GITHUB_COPILOT_CLIENT_APP,\n source: {\n type: 'npm-locked',\n packageJson: GITHUB_COPILOT_IMPLEMENTATION_PACKAGE_JSON,\n pnpmLockYaml: GITHUB_COPILOT_IMPLEMENTATION_PNPM_LOCK,\n pnpmWorkspaceYaml: GITHUB_COPILOT_IMPLEMENTATION_PNPM_WORKSPACE,\n },\n executable: 'copilot',\n args: [\n '--acp',\n '--stdio',\n '--no-auto-update',\n ...(settings.reasoningEffort == null\n ? []\n : [`--reasoning-effort=${settings.reasoningEffort}`]),\n ],\n auth: settings.auth,\n /*\n * The Copilot CLI drops every MCP server that a client passes in ACP\n * `session/new` unless it is declared with the `http` or `sse` transport,\n * so host tools must be exposed over the bridge's HTTP MCP endpoint.\n */\n hostToolMcpTransport: 'http',\n forwardEnv: ['COPILOT_GH_HOST', 'GH_HOST'],\n credentialEnv: ['COPILOT_GITHUB_TOKEN', 'GH_TOKEN', 'GITHUB_TOKEN'],\n credentialBrokering: ({ env, sandboxEnv, headers }) => {\n const transformations: HarnessV1RequestTransformation[] = [];\n const githubHost = normalizeGitHubHost(\n env.COPILOT_GH_HOST ?? env.GH_HOST ?? 'github.com',\n );\n const githubHosts = [\n githubHost,\n `*.${githubHost}`,\n ...(githubHost === 'github.com'\n ? ['githubcopilot.com', '*.githubcopilot.com']\n : []),\n ];\n\n for (const host of githubHosts) {\n if (env.COPILOT_GITHUB_TOKEN && sandboxEnv?.COPILOT_GITHUB_TOKEN) {\n transformations.push(\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: {\n exact: `Bearer ${sandboxEnv.COPILOT_GITHUB_TOKEN}`,\n },\n },\n ],\n },\n transform: {\n headers: {\n Authorization: `Bearer ${env.COPILOT_GITHUB_TOKEN}`,\n },\n },\n },\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: {\n exact: `token ${sandboxEnv.COPILOT_GITHUB_TOKEN}`,\n },\n },\n ],\n },\n transform: {\n headers: {\n Authorization: `token ${env.COPILOT_GITHUB_TOKEN}`,\n },\n },\n },\n );\n }\n\n if (env.GH_TOKEN && sandboxEnv?.GH_TOKEN) {\n transformations.push(\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: { exact: `Bearer ${sandboxEnv.GH_TOKEN}` },\n },\n ],\n },\n transform: {\n headers: { Authorization: `Bearer ${env.GH_TOKEN}` },\n },\n },\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: { exact: `token ${sandboxEnv.GH_TOKEN}` },\n },\n ],\n },\n transform: {\n headers: { Authorization: `token ${env.GH_TOKEN}` },\n },\n },\n );\n }\n\n if (env.GITHUB_TOKEN && sandboxEnv?.GITHUB_TOKEN) {\n transformations.push(\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: { exact: `Bearer ${sandboxEnv.GITHUB_TOKEN}` },\n },\n ],\n },\n transform: {\n headers: { Authorization: `Bearer ${env.GITHUB_TOKEN}` },\n },\n },\n {\n match: {\n host,\n headers: [\n {\n key: { exact: 'Authorization' },\n value: { exact: `token ${sandboxEnv.GITHUB_TOKEN}` },\n },\n ],\n },\n transform: {\n headers: { Authorization: `token ${env.GITHUB_TOKEN}` },\n },\n },\n );\n }\n }\n\n const providerCredential = env.COPILOT_PROVIDER_API_KEY;\n const sandboxProviderCredential = sandboxEnv?.COPILOT_PROVIDER_API_KEY;\n const providerBaseUrl = env.COPILOT_PROVIDER_BASE_URL;\n if (providerCredential && sandboxProviderCredential && providerBaseUrl) {\n transformations.push(\n createCredentialRequestTransformation({\n matchUrl: providerBaseUrl,\n matchHeaders: {\n Authorization: `Bearer ${sandboxProviderCredential}`,\n },\n transformHeaders: {\n ...headers,\n Authorization: `Bearer ${providerCredential}`,\n },\n }),\n );\n } else if (headers != null) {\n const copilotHosts =\n githubHost === 'github.com'\n ? ['githubcopilot.com', '*.githubcopilot.com']\n : [githubHost, `*.${githubHost}`];\n for (const host of copilotHosts) {\n transformations.push({\n match: { host },\n transform: { headers },\n });\n }\n }\n\n return transformations;\n },\n credentialForwarding: settings.credentialForwarding,\n providerAuthentication: {\n gateway: {\n env: {\n COPILOT_PROVIDER_BASE_URL: {\n $source: 'gateway-base-url',\n ensureSuffix: '/v1',\n },\n COPILOT_PROVIDER_TYPE: 'openai',\n COPILOT_PROVIDER_API_KEY: {\n $source: 'gateway-api-key',\n },\n COPILOT_PROVIDER_WIRE_API: 'responses',\n COPILOT_MODEL: 'openai/gpt-5.5',\n COPILOT_PROVIDER_HEADERS: {\n $source: 'client-app',\n prefix: 'x-client-app: ',\n },\n },\n },\n },\n modelMapping: {\n type: 'session-config-option',\n path: 'model',\n },\n skillsDirectory: '.copilot/skills',\n instructionMapping: {\n type: 'filesystem',\n path: '.copilot/copilot-instructions.md',\n },\n builtinTools: GITHUB_COPILOT_BUILTIN_TOOLS,\n mcpServers: settings.mcpServers,\n isMcpToolCall: toolCall =>\n mcpToolTitlePrefixes.some(prefix => toolCall.title.startsWith(prefix)),\n port: settings.port,\n portEndpoint: settings.portEndpoint,\n startupTimeoutMs: settings.startupTimeoutMs,\n mintBridgeToken: settings.mintBridgeToken,\n });\n}\n\nfunction normalizeGitHubHost(host: string): string {\n return new URL(host.includes('://') ? host : `https://${host}`).hostname;\n}\n","declare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import { createGitHubCopilot } from './github-copilot-harness';\n\n/**\n * Default GitHub Copilot harness instance. Equivalent to\n * `createGitHubCopilot()`.\n */\nexport const githubCopilot = createGitHubCopilot();\n\nexport { createGitHubCopilot } from './github-copilot-harness';\nexport type {\n GitHubCopilotAuthenticationMode,\n GitHubCopilotBuiltinTools,\n GitHubCopilotHarnessSettings,\n} from './github-copilot-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAMK;AACP,SAAS,6CAA6C;AACtD,SAAS,iBAA6C;AACtD,SAAS,YAAY;AACrB,SAAS,SAAS;;;ACVX,IAAM,UACX,OACI,UACA;;;ADcN,IAAM,4BAA4B;AAAA,EAChC,MAAM;AAAA,EACN,SAAS;AACX;AACA,IAAM,6CACJ;AACF,IAAM,0CACJ;AACF,IAAM,+CACJ;AA2BF,IAAM,+BAA+B;AAAA,EACnC,MAAM;AAAA,IACJ,GAAG,WAAW,QAAQ;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,aAAa,EAAE,YAAY;AAAA,QACzB,SAAS,EAAE,OAAO;AAAA,QAClB,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,QACjC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,QAC7B,MAAM,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,EAAE,SAAS;AAAA,QACzC,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,QAC7B,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA,MACpC,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EACA,WAAW;AAAA,IACT,GAAG,KAAK;AAAA,MACN,OAAO;AAAA,MACP,aAAa,EAAE,YAAY;AAAA,QACzB,SAAS,EAAE,OAAO;AAAA,QAClB,OAAO,EAAE,OAAO;AAAA,MAClB,CAAC;AAAA,IACH,CAAC;AAAA,IACD,aAAa;AAAA,EACf;AAAA,EACA,WAAW;AAAA,I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2
2
|
"name": "@ai-sdk/harness-github-copilot",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "AI SDK harness for GitHub Copilot",
|
|
5
|
-
"license": "Apache-2.0",
|
|
3
|
+
"version": "1.0.0",
|
|
6
4
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"source": "./src/index.ts",
|
|
11
10
|
"files": [
|
|
12
|
-
"
|
|
11
|
+
"dist/**/*",
|
|
12
|
+
"src",
|
|
13
|
+
"!src/**/*.test.ts",
|
|
14
|
+
"!src/**/*.test-d.ts",
|
|
15
|
+
"!src/**/__snapshots__",
|
|
16
|
+
"!src/**/__fixtures__",
|
|
17
|
+
"CHANGELOG.md",
|
|
13
18
|
"README.md"
|
|
14
19
|
],
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@ai-sdk/harness": "1.0.105",
|
|
30
|
+
"@ai-sdk/harness-acp": "1.0.43",
|
|
31
|
+
"@ai-sdk/provider-utils": "5.0.37"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": "^3.25.76 || ^4.1.8"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@github/copilot": "1.0.82",
|
|
38
|
+
"@types/node": "22.19.19",
|
|
39
|
+
"@vercel/ai-tsconfig": "0.0.0",
|
|
40
|
+
"tsup": "^8.5.1",
|
|
41
|
+
"typescript": "5.8.3",
|
|
42
|
+
"zod": "3.25.76"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22"
|
|
46
|
+
},
|
|
15
47
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
48
|
+
"access": "public",
|
|
49
|
+
"provenance": true
|
|
17
50
|
},
|
|
51
|
+
"homepage": "https://ai-sdk.dev/docs",
|
|
18
52
|
"repository": {
|
|
19
53
|
"type": "git",
|
|
20
|
-
"url": "
|
|
54
|
+
"url": "https://github.com/vercel/ai",
|
|
55
|
+
"directory": "packages/harness-github-copilot"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/vercel/ai/issues"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"ai",
|
|
62
|
+
"harness",
|
|
63
|
+
"acp",
|
|
64
|
+
"github",
|
|
65
|
+
"copilot"
|
|
66
|
+
],
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
69
|
+
"build:watch": "pnpm clean && tsup --watch",
|
|
70
|
+
"clean": "del-cli dist *.tsbuildinfo",
|
|
71
|
+
"type-check": "tsc --build",
|
|
72
|
+
"test": "pnpm test:node",
|
|
73
|
+
"test:watch": "vitest --config vitest.node.config.js",
|
|
74
|
+
"test:node": "vitest --config vitest.node.config.js --run"
|
|
21
75
|
}
|
|
22
|
-
}
|
|
76
|
+
}
|