@nomomon/ai-sdk-provider-github-copilot 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # AI SDK Provider for GitHub Copilot
2
+
3
+ Vercel AI SDK community provider for GitHub Copilot - use `streamText`, `generateText`, and related AI SDK APIs with GitHub Copilot as the backend model.
4
+
5
+ ## Installation
6
+
7
+ ### 1. Install and authenticate the Copilot CLI
8
+
9
+ Follow the [Copilot CLI installation guide](https://github.com/github/copilot-sdk) to install the CLI and ensure `copilot` is available in your PATH.
10
+
11
+ ### 2. Add the provider
12
+
13
+ ```bash
14
+ npm install @nomomon/ai-sdk-provider-github-copilot ai@^6.0.0
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ### Non-streaming (generateText)
20
+
21
+ ```typescript
22
+ import { generateText } from "ai";
23
+ import { githubCopilot } from "@nomomon/ai-sdk-provider-github-copilot";
24
+
25
+ const { text } = await generateText({
26
+ model: githubCopilot("gpt-5"),
27
+ prompt: "Hello, Copilot!",
28
+ });
29
+
30
+ console.log(text);
31
+ ```
32
+
33
+ ### Streaming (streamText)
34
+
35
+ ```typescript
36
+ import { streamText } from "ai";
37
+ import { githubCopilot } from "@nomomon/ai-sdk-provider-github-copilot";
38
+
39
+ const result = streamText({
40
+ model: githubCopilot("gpt-5"),
41
+ prompt: "Tell me a short story",
42
+ });
43
+
44
+ for await (const chunk of result.textStream) {
45
+ process.stdout.write(chunk);
46
+ }
47
+ ```
48
+
49
+ ## Models
50
+
51
+ Use model IDs available via Copilot CLI, for example:
52
+
53
+ - `gpt-5` - GPT-5 (when available)
54
+ - `claude-sonnet-4.5` - Claude Sonnet
55
+ - `claude-opus-4` - Claude Opus
56
+
57
+ Run `copilot models` to list available models in your environment.
58
+
59
+ ## Configuration
60
+
61
+ ### Provider settings
62
+
63
+ ```typescript
64
+ import { githubCopilot } from "@nomomon/ai-sdk-provider-github-copilot";
65
+
66
+ const model = githubCopilot("gpt-5", {
67
+ model: "claude-sonnet-4.5", // Override model
68
+ systemMessage: {
69
+ content: "You are a helpful assistant specialized in code review.",
70
+ },
71
+ workingDirectory: "/path/to/project",
72
+ provider: {
73
+ type: "openai",
74
+ baseUrl: "https://my-api.example.com/v1",
75
+ apiKey: process.env.MY_API_KEY,
76
+ },
77
+ });
78
+ ```
79
+
80
+ ### Custom tools
81
+
82
+ Pass tools via provider settings using Copilot's `defineTool`:
83
+
84
+ ```typescript
85
+ import { defineTool } from "@github/copilot-sdk";
86
+ import { z } from "zod";
87
+ import { githubCopilot } from "@nomomon/ai-sdk-provider-github-copilot";
88
+
89
+ const model = githubCopilot("gpt-5", {
90
+ tools: [
91
+ defineTool("lookup_issue", {
92
+ description: "Fetch issue details from our tracker",
93
+ parameters: z.object({
94
+ id: z.string().describe("Issue identifier"),
95
+ }),
96
+ handler: async ({ id }) => {
97
+ return await fetchIssue(id);
98
+ },
99
+ }),
100
+ ],
101
+ });
102
+ ```
103
+
104
+ ## Limitations
105
+
106
+ - **Requires Copilot CLI** - Must be installed and authenticated
107
+ - **Node.js >= 18** - Required runtime
108
+ - **Image inputs** - Copilot uses file path attachments; base64/data URLs may require temp files
109
+ - **Unsupported parameters** - `temperature`, `maxTokens`, `topP`, etc. are not supported by the Copilot CLI and will be ignored (warnings emitted)
110
+ - **Structured outputs** - Native JSON schema support may be limited; consider prompt engineering for structured responses
111
+ - **Session-based** - Each generate/stream creates a new session; no built-in multi-session continuity across separate AI SDK calls
112
+
113
+ ## Disclaimer
114
+
115
+ **This is an unofficial community provider** and is not affiliated with or endorsed by GitHub or Vercel. By using this provider:
116
+
117
+ - You understand that your data will be sent to GitHub's servers through the Copilot CLI
118
+ - You agree to comply with GitHub's Terms of Service
119
+ - You acknowledge this software is provided "as is" without warranties of any kind
120
+
121
+ ## License
122
+
123
+ MIT