@x-otto/plugin-github-copilot 0.1.0-alpha.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/README.md +29 -0
- package/otto-plugin.json +35 -0
- package/package.json +25 -0
- package/plugin-dist/meta.json +1 -0
- package/plugin-dist/plugin.cjs +53002 -0
- package/plugin-dist/plugin.js +11181 -0
- package/plugin.ts +35 -0
- package/src/provider.test.ts +273 -0
- package/src/provider.ts +150 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @x-otto/plugin-github-copilot
|
|
2
|
+
|
|
3
|
+
> GitHub Copilot subscription provider plugin.
|
|
4
|
+
|
|
5
|
+
Provides access to GitHub Copilot's AI models via a custom chat/completions protocol. Uses device-flow OAuth authentication with Copilot-specific request headers (vision support, copilot-integration-id, editor-version). Previously built-in, now a first-party plugin.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
This is a **code-based provider** — GitHub Copilot uses a custom wire protocol that cannot be expressed through the standard `openai-completions`/`openai-responses`/`anthropic-messages` schemas. The protocol implementation lives in `src/provider.ts`, built on `@x-otto/provider`'s shared `streamChatCompletions` SSE parsing base.
|
|
10
|
+
|
|
11
|
+
OAuth uses device-flow authentication declared in `otto-plugin.json` via `contributes.oauth`, with automatic token refresh through Copilot's internal token endpoint. Custom headers include `Copilot-Vision-Request` for vision-capable requests and `X-Initiator` for message role detection.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
otto extension install plugin-github-copilot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
otto auth login github-copilot
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
- `@x-otto/provider` (workspace)
|
|
28
|
+
- `@x-otto/shared` (workspace)
|
|
29
|
+
- `@x-otto/plugin` (dev, build-time only)
|
package/otto-plugin.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "plugin-github-copilot",
|
|
3
|
+
"name": "GitHub Copilot Provider",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Device-flow OAuth + custom Copilot chat/completions protocol provider (RFC-122 physical migration, provider plugin-ization closure). Previously built-in, now a first-party plugin.",
|
|
6
|
+
"capabilities": ["provider"],
|
|
7
|
+
"codeProviderIds": ["github-copilot"],
|
|
8
|
+
"codeProviderModelsEndpoints": {
|
|
9
|
+
"github-copilot": {
|
|
10
|
+
"url": "https://api.githubcopilot.com/models",
|
|
11
|
+
"responseFormat": "openai-list",
|
|
12
|
+
"authScheme": "bearer",
|
|
13
|
+
"headers": {
|
|
14
|
+
"copilot-integration-id": "vscode-chat",
|
|
15
|
+
"editor-version": "otto-coding"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"contributes": {
|
|
20
|
+
"oauth": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "device-flow",
|
|
23
|
+
"id": "github-copilot",
|
|
24
|
+
"name": "GitHub Copilot",
|
|
25
|
+
"clientId": "Iv1.b507a08c87ecfe98",
|
|
26
|
+
"deviceCodeUrlTemplate": "https://{domain}/login/device/code",
|
|
27
|
+
"tokenUrlTemplate": "https://{domain}/login/oauth/access_token",
|
|
28
|
+
"refreshUrlTemplate": "https://api.{domain}/copilot_internal/v2/token",
|
|
29
|
+
"scope": "read:user",
|
|
30
|
+
"allowCustomDomain": true,
|
|
31
|
+
"userAgent": "GitHubCopilotChat/0.35.0"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-otto/plugin-github-copilot",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@x-otto/provider": "0.1.0-alpha.1",
|
|
7
|
+
"@x-otto/shared": "0.1.0-alpha.1"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@x-otto/plugin": "0.1.0-alpha.1"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"files": [
|
|
14
|
+
"otto-plugin.json",
|
|
15
|
+
"README.md",
|
|
16
|
+
"plugin.ts",
|
|
17
|
+
"src",
|
|
18
|
+
"plugin-dist"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org",
|
|
23
|
+
"tag": "alpha"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apiVersion":1,"compilerVersion":"0.1.0-alpha.1","sourceHash":"04f98d39c2541c81559c0f0a5b9a1ef909be19dcd148dc8e7f8101a37aa20123"}
|