n8n-nodes-github-copilot 3.29.4 → 3.29.5
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/dist/package.json +3 -3
- package/dist/shared/models/GitHubCopilotModels.d.ts +6 -6
- package/dist/shared/models/GitHubCopilotModels.js +98 -98
- package/dist/shared/utils/GitHubCopilotApiUtils.d.ts +1 -1
- package/dist/shared/utils/GitHubCopilotApiUtils.js +39 -39
- package/dist/shared/utils/GitHubCopilotEndpoints.d.ts +4 -4
- package/dist/shared/utils/GitHubCopilotEndpoints.js +19 -19
- package/package.json +3 -3
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.29.
|
|
3
|
+
"version": "3.29.5",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "tsc && gulp build:icons",
|
|
18
18
|
"dev": "tsc --watch",
|
|
19
19
|
"format": "prettier nodes credentials --write",
|
|
20
|
-
"lint": "eslint nodes credentials --ext .ts",
|
|
21
|
-
"lintfix": "eslint nodes credentials --ext .ts --fix",
|
|
20
|
+
"lint": "eslint nodes credentials shared --ext .ts",
|
|
21
|
+
"lintfix": "eslint nodes credentials shared --ext .ts --fix",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
@@ -5,8 +5,8 @@ export interface ModelCapability {
|
|
|
5
5
|
maxContextTokens: number;
|
|
6
6
|
maxOutputTokens: number;
|
|
7
7
|
streaming: boolean;
|
|
8
|
-
provider:
|
|
9
|
-
category:
|
|
8
|
+
provider: "OpenAI" | "Anthropic" | "Google" | "Microsoft";
|
|
9
|
+
category: "chat" | "reasoning" | "coding" | "vision" | "multimodal";
|
|
10
10
|
}
|
|
11
11
|
export interface GitHubCopilotModel {
|
|
12
12
|
value: string;
|
|
@@ -14,15 +14,15 @@ export interface GitHubCopilotModel {
|
|
|
14
14
|
description: string;
|
|
15
15
|
capabilities: ModelCapability;
|
|
16
16
|
recommended: boolean;
|
|
17
|
-
status:
|
|
17
|
+
status: "stable" | "preview" | "experimental";
|
|
18
18
|
}
|
|
19
19
|
export declare const GITHUB_COPILOT_MODELS: GitHubCopilotModel[];
|
|
20
20
|
export declare class GitHubCopilotModelsManager {
|
|
21
21
|
static getAllModels(): GitHubCopilotModel[];
|
|
22
22
|
static getToolsCapableModels(): GitHubCopilotModel[];
|
|
23
23
|
static getVisionCapableModels(): GitHubCopilotModel[];
|
|
24
|
-
static getModelsByProvider(provider:
|
|
25
|
-
static getModelsByCategory(category:
|
|
24
|
+
static getModelsByProvider(provider: "OpenAI" | "Anthropic" | "Google" | "Microsoft"): GitHubCopilotModel[];
|
|
25
|
+
static getModelsByCategory(category: "chat" | "reasoning" | "coding" | "vision" | "multimodal"): GitHubCopilotModel[];
|
|
26
26
|
static getRecommendedModels(): GitHubCopilotModel[];
|
|
27
27
|
static getStableModels(): GitHubCopilotModel[];
|
|
28
28
|
static getModelByValue(value: string): GitHubCopilotModel | undefined;
|
|
@@ -31,7 +31,7 @@ export declare class GitHubCopilotModelsManager {
|
|
|
31
31
|
value: string;
|
|
32
32
|
description: string;
|
|
33
33
|
}>;
|
|
34
|
-
static getModelsForUseCase(useCase:
|
|
34
|
+
static getModelsForUseCase(useCase: "general" | "coding" | "vision" | "reasoning" | "tools"): GitHubCopilotModel[];
|
|
35
35
|
}
|
|
36
36
|
export declare const DEFAULT_MODELS: {
|
|
37
37
|
readonly GENERAL: "gpt-4o-mini";
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DEFAULT_MODELS = exports.GitHubCopilotModelsManager = exports.GITHUB_COPILOT_MODELS = void 0;
|
|
4
4
|
exports.GITHUB_COPILOT_MODELS = [
|
|
5
5
|
{
|
|
6
|
-
value:
|
|
7
|
-
name:
|
|
8
|
-
description:
|
|
6
|
+
value: "auto",
|
|
7
|
+
name: "Auto (Recommended)",
|
|
8
|
+
description: "Automatically selects the best model for your task",
|
|
9
9
|
capabilities: {
|
|
10
10
|
toolsCalling: true,
|
|
11
11
|
vision: true,
|
|
@@ -13,16 +13,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
13
13
|
maxContextTokens: 128000,
|
|
14
14
|
maxOutputTokens: 16384,
|
|
15
15
|
streaming: true,
|
|
16
|
-
provider:
|
|
17
|
-
category:
|
|
16
|
+
provider: "OpenAI",
|
|
17
|
+
category: "chat"
|
|
18
18
|
},
|
|
19
19
|
recommended: true,
|
|
20
|
-
status:
|
|
20
|
+
status: "stable"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
value:
|
|
24
|
-
name:
|
|
25
|
-
description:
|
|
23
|
+
value: "gpt-5",
|
|
24
|
+
name: "GPT-5",
|
|
25
|
+
description: "Latest generation GPT model with enhanced capabilities",
|
|
26
26
|
capabilities: {
|
|
27
27
|
toolsCalling: true,
|
|
28
28
|
vision: true,
|
|
@@ -30,16 +30,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
30
30
|
maxContextTokens: 128000,
|
|
31
31
|
maxOutputTokens: 64000,
|
|
32
32
|
streaming: true,
|
|
33
|
-
provider:
|
|
34
|
-
category:
|
|
33
|
+
provider: "OpenAI",
|
|
34
|
+
category: "chat"
|
|
35
35
|
},
|
|
36
36
|
recommended: true,
|
|
37
|
-
status:
|
|
37
|
+
status: "stable"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
value:
|
|
41
|
-
name:
|
|
42
|
-
description:
|
|
40
|
+
value: "gpt-5-mini",
|
|
41
|
+
name: "GPT-5 Mini",
|
|
42
|
+
description: "Faster and more efficient GPT-5 model",
|
|
43
43
|
capabilities: {
|
|
44
44
|
toolsCalling: true,
|
|
45
45
|
vision: true,
|
|
@@ -47,16 +47,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
47
47
|
maxContextTokens: 128000,
|
|
48
48
|
maxOutputTokens: 64000,
|
|
49
49
|
streaming: true,
|
|
50
|
-
provider:
|
|
51
|
-
category:
|
|
50
|
+
provider: "OpenAI",
|
|
51
|
+
category: "chat"
|
|
52
52
|
},
|
|
53
53
|
recommended: true,
|
|
54
|
-
status:
|
|
54
|
+
status: "stable"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
value:
|
|
58
|
-
name:
|
|
59
|
-
description:
|
|
57
|
+
value: "gpt-4.1",
|
|
58
|
+
name: "GPT-4.1",
|
|
59
|
+
description: "Enhanced GPT-4 model with improved capabilities",
|
|
60
60
|
capabilities: {
|
|
61
61
|
toolsCalling: true,
|
|
62
62
|
vision: true,
|
|
@@ -64,16 +64,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
64
64
|
maxContextTokens: 128000,
|
|
65
65
|
maxOutputTokens: 16384,
|
|
66
66
|
streaming: true,
|
|
67
|
-
provider:
|
|
68
|
-
category:
|
|
67
|
+
provider: "OpenAI",
|
|
68
|
+
category: "chat"
|
|
69
69
|
},
|
|
70
70
|
recommended: true,
|
|
71
|
-
status:
|
|
71
|
+
status: "stable"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
|
-
value:
|
|
75
|
-
name:
|
|
76
|
-
description:
|
|
74
|
+
value: "gpt-4o",
|
|
75
|
+
name: "GPT-4o",
|
|
76
|
+
description: "Most capable GPT-4 model with vision, optimized for chat and complex reasoning",
|
|
77
77
|
capabilities: {
|
|
78
78
|
toolsCalling: true,
|
|
79
79
|
vision: true,
|
|
@@ -81,16 +81,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
81
81
|
maxContextTokens: 128000,
|
|
82
82
|
maxOutputTokens: 4096,
|
|
83
83
|
streaming: true,
|
|
84
|
-
provider:
|
|
85
|
-
category:
|
|
84
|
+
provider: "OpenAI",
|
|
85
|
+
category: "multimodal"
|
|
86
86
|
},
|
|
87
87
|
recommended: true,
|
|
88
|
-
status:
|
|
88
|
+
status: "stable"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
value:
|
|
92
|
-
name:
|
|
93
|
-
description:
|
|
91
|
+
value: "gpt-4o-mini",
|
|
92
|
+
name: "GPT-4o Mini",
|
|
93
|
+
description: "Faster and more cost-effective GPT-4o - VERIFIED WORKING",
|
|
94
94
|
capabilities: {
|
|
95
95
|
toolsCalling: true,
|
|
96
96
|
vision: false,
|
|
@@ -98,16 +98,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
98
98
|
maxContextTokens: 128000,
|
|
99
99
|
maxOutputTokens: 4096,
|
|
100
100
|
streaming: true,
|
|
101
|
-
provider:
|
|
102
|
-
category:
|
|
101
|
+
provider: "OpenAI",
|
|
102
|
+
category: "chat"
|
|
103
103
|
},
|
|
104
104
|
recommended: true,
|
|
105
|
-
status:
|
|
105
|
+
status: "stable"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
|
-
value:
|
|
109
|
-
name:
|
|
110
|
-
description:
|
|
108
|
+
value: "o3-mini",
|
|
109
|
+
name: "o3 Mini",
|
|
110
|
+
description: "New reasoning model optimized for coding and complex tasks",
|
|
111
111
|
capabilities: {
|
|
112
112
|
toolsCalling: true,
|
|
113
113
|
vision: false,
|
|
@@ -115,16 +115,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
115
115
|
maxContextTokens: 200000,
|
|
116
116
|
maxOutputTokens: 100000,
|
|
117
117
|
streaming: true,
|
|
118
|
-
provider:
|
|
119
|
-
category:
|
|
118
|
+
provider: "OpenAI",
|
|
119
|
+
category: "reasoning"
|
|
120
120
|
},
|
|
121
121
|
recommended: true,
|
|
122
|
-
status:
|
|
122
|
+
status: "stable"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
|
-
value:
|
|
126
|
-
name:
|
|
127
|
-
description:
|
|
125
|
+
value: "claude-sonnet-4",
|
|
126
|
+
name: "Claude Sonnet 4",
|
|
127
|
+
description: "Latest Claude model with advanced reasoning capabilities",
|
|
128
128
|
capabilities: {
|
|
129
129
|
toolsCalling: true,
|
|
130
130
|
vision: true,
|
|
@@ -132,16 +132,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
132
132
|
maxContextTokens: 128000,
|
|
133
133
|
maxOutputTokens: 16000,
|
|
134
134
|
streaming: true,
|
|
135
|
-
provider:
|
|
136
|
-
category:
|
|
135
|
+
provider: "Anthropic",
|
|
136
|
+
category: "chat"
|
|
137
137
|
},
|
|
138
138
|
recommended: true,
|
|
139
|
-
status:
|
|
139
|
+
status: "stable"
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
|
-
value:
|
|
143
|
-
name:
|
|
144
|
-
description:
|
|
142
|
+
value: "claude-opus-4",
|
|
143
|
+
name: "Claude Opus 4",
|
|
144
|
+
description: "Most powerful Claude model for complex reasoning (may have performance issues)",
|
|
145
145
|
capabilities: {
|
|
146
146
|
toolsCalling: false,
|
|
147
147
|
vision: true,
|
|
@@ -149,16 +149,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
149
149
|
maxContextTokens: 80000,
|
|
150
150
|
maxOutputTokens: 16000,
|
|
151
151
|
streaming: true,
|
|
152
|
-
provider:
|
|
153
|
-
category:
|
|
152
|
+
provider: "Anthropic",
|
|
153
|
+
category: "reasoning"
|
|
154
154
|
},
|
|
155
155
|
recommended: false,
|
|
156
|
-
status:
|
|
156
|
+
status: "stable"
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
value:
|
|
160
|
-
name:
|
|
161
|
-
description:
|
|
159
|
+
value: "claude-3.7-sonnet",
|
|
160
|
+
name: "Claude 3.7 Sonnet",
|
|
161
|
+
description: "Enhanced Claude 3.5 with improved capabilities",
|
|
162
162
|
capabilities: {
|
|
163
163
|
toolsCalling: true,
|
|
164
164
|
vision: true,
|
|
@@ -166,16 +166,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
166
166
|
maxContextTokens: 200000,
|
|
167
167
|
maxOutputTokens: 16384,
|
|
168
168
|
streaming: true,
|
|
169
|
-
provider:
|
|
170
|
-
category:
|
|
169
|
+
provider: "Anthropic",
|
|
170
|
+
category: "chat"
|
|
171
171
|
},
|
|
172
172
|
recommended: true,
|
|
173
|
-
status:
|
|
173
|
+
status: "stable"
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
|
-
value:
|
|
177
|
-
name:
|
|
178
|
-
description:
|
|
176
|
+
value: "claude-3.7-sonnet-thought",
|
|
177
|
+
name: "Claude 3.7 Sonnet Thinking",
|
|
178
|
+
description: "Claude with visible reasoning process",
|
|
179
179
|
capabilities: {
|
|
180
180
|
toolsCalling: false,
|
|
181
181
|
vision: true,
|
|
@@ -183,16 +183,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
183
183
|
maxContextTokens: 200000,
|
|
184
184
|
maxOutputTokens: 16384,
|
|
185
185
|
streaming: true,
|
|
186
|
-
provider:
|
|
187
|
-
category:
|
|
186
|
+
provider: "Anthropic",
|
|
187
|
+
category: "reasoning"
|
|
188
188
|
},
|
|
189
189
|
recommended: false,
|
|
190
|
-
status:
|
|
190
|
+
status: "stable"
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
|
-
value:
|
|
194
|
-
name:
|
|
195
|
-
description:
|
|
193
|
+
value: "claude-3.5-sonnet",
|
|
194
|
+
name: "Claude 3.5 Sonnet",
|
|
195
|
+
description: "Anthropic's balanced model with excellent reasoning and creativity",
|
|
196
196
|
capabilities: {
|
|
197
197
|
toolsCalling: true,
|
|
198
198
|
vision: true,
|
|
@@ -200,16 +200,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
200
200
|
maxContextTokens: 90000,
|
|
201
201
|
maxOutputTokens: 8192,
|
|
202
202
|
streaming: true,
|
|
203
|
-
provider:
|
|
204
|
-
category:
|
|
203
|
+
provider: "Anthropic",
|
|
204
|
+
category: "chat"
|
|
205
205
|
},
|
|
206
206
|
recommended: true,
|
|
207
|
-
status:
|
|
207
|
+
status: "stable"
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
value:
|
|
211
|
-
name:
|
|
212
|
-
description:
|
|
210
|
+
value: "gemini-2.5-pro",
|
|
211
|
+
name: "Gemini 2.5 Pro",
|
|
212
|
+
description: "Most advanced Gemini model with reasoning capabilities",
|
|
213
213
|
capabilities: {
|
|
214
214
|
toolsCalling: true,
|
|
215
215
|
vision: true,
|
|
@@ -217,16 +217,16 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
217
217
|
maxContextTokens: 128000,
|
|
218
218
|
maxOutputTokens: 64000,
|
|
219
219
|
streaming: true,
|
|
220
|
-
provider:
|
|
221
|
-
category:
|
|
220
|
+
provider: "Google",
|
|
221
|
+
category: "reasoning"
|
|
222
222
|
},
|
|
223
223
|
recommended: true,
|
|
224
|
-
status:
|
|
224
|
+
status: "stable"
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
|
-
value:
|
|
228
|
-
name:
|
|
229
|
-
description:
|
|
227
|
+
value: "gemini-2.0-flash-001",
|
|
228
|
+
name: "Gemini 2.0 Flash",
|
|
229
|
+
description: "Fast and efficient Gemini model with large context window",
|
|
230
230
|
capabilities: {
|
|
231
231
|
toolsCalling: true,
|
|
232
232
|
vision: true,
|
|
@@ -234,11 +234,11 @@ exports.GITHUB_COPILOT_MODELS = [
|
|
|
234
234
|
maxContextTokens: 1000000,
|
|
235
235
|
maxOutputTokens: 8192,
|
|
236
236
|
streaming: true,
|
|
237
|
-
provider:
|
|
238
|
-
category:
|
|
237
|
+
provider: "Google",
|
|
238
|
+
category: "chat"
|
|
239
239
|
},
|
|
240
240
|
recommended: true,
|
|
241
|
-
status:
|
|
241
|
+
status: "stable"
|
|
242
242
|
}
|
|
243
243
|
];
|
|
244
244
|
class GitHubCopilotModelsManager {
|
|
@@ -261,7 +261,7 @@ class GitHubCopilotModelsManager {
|
|
|
261
261
|
return exports.GITHUB_COPILOT_MODELS.filter(model => model.recommended);
|
|
262
262
|
}
|
|
263
263
|
static getStableModels() {
|
|
264
|
-
return exports.GITHUB_COPILOT_MODELS.filter(model => model.status ===
|
|
264
|
+
return exports.GITHUB_COPILOT_MODELS.filter(model => model.status === "stable");
|
|
265
265
|
}
|
|
266
266
|
static getModelByValue(value) {
|
|
267
267
|
return exports.GITHUB_COPILOT_MODELS.find(model => model.value === value);
|
|
@@ -276,16 +276,16 @@ class GitHubCopilotModelsManager {
|
|
|
276
276
|
}
|
|
277
277
|
static getModelsForUseCase(useCase) {
|
|
278
278
|
switch (useCase) {
|
|
279
|
-
case
|
|
279
|
+
case "general":
|
|
280
280
|
return this.getRecommendedModels();
|
|
281
|
-
case
|
|
282
|
-
return exports.GITHUB_COPILOT_MODELS.filter(model => model.capabilities.category ===
|
|
281
|
+
case "coding":
|
|
282
|
+
return exports.GITHUB_COPILOT_MODELS.filter(model => model.capabilities.category === "coding" ||
|
|
283
283
|
model.capabilities.toolsCalling);
|
|
284
|
-
case
|
|
284
|
+
case "vision":
|
|
285
285
|
return this.getVisionCapableModels();
|
|
286
|
-
case
|
|
287
|
-
return exports.GITHUB_COPILOT_MODELS.filter(model => model.capabilities.category ===
|
|
288
|
-
case
|
|
286
|
+
case "reasoning":
|
|
287
|
+
return exports.GITHUB_COPILOT_MODELS.filter(model => model.capabilities.category === "reasoning");
|
|
288
|
+
case "tools":
|
|
289
289
|
return this.getToolsCapableModels();
|
|
290
290
|
default:
|
|
291
291
|
return this.getAllModels();
|
|
@@ -294,10 +294,10 @@ class GitHubCopilotModelsManager {
|
|
|
294
294
|
}
|
|
295
295
|
exports.GitHubCopilotModelsManager = GitHubCopilotModelsManager;
|
|
296
296
|
exports.DEFAULT_MODELS = {
|
|
297
|
-
GENERAL:
|
|
298
|
-
CODING:
|
|
299
|
-
VISION:
|
|
300
|
-
REASONING:
|
|
301
|
-
TOOLS:
|
|
302
|
-
MULTIMODAL:
|
|
297
|
+
GENERAL: "gpt-4o-mini",
|
|
298
|
+
CODING: "o3-mini",
|
|
299
|
+
VISION: "gpt-4o",
|
|
300
|
+
REASONING: "claude-sonnet-4",
|
|
301
|
+
TOOLS: "gpt-5",
|
|
302
|
+
MULTIMODAL: "gemini-2.5-pro"
|
|
303
303
|
};
|
|
@@ -12,12 +12,12 @@ exports.truncateToTokenLimit = truncateToTokenLimit;
|
|
|
12
12
|
const GitHubCopilotEndpoints_1 = require("./GitHubCopilotEndpoints");
|
|
13
13
|
async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = false) {
|
|
14
14
|
var _a;
|
|
15
|
-
let credentialType =
|
|
15
|
+
let credentialType = "githubCopilotApi";
|
|
16
16
|
try {
|
|
17
|
-
credentialType = context.getNodeParameter(
|
|
17
|
+
credentialType = context.getNodeParameter("credentialType", 0, "githubCopilotApi");
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
|
-
console.log(
|
|
20
|
+
console.log("🔍 No credentialType parameter found, using default: githubCopilotApi");
|
|
21
21
|
}
|
|
22
22
|
const credentials = await context.getCredentials(credentialType);
|
|
23
23
|
console.log(`🔍 ${credentialType} Credentials Debug:`, Object.keys(credentials));
|
|
@@ -28,25 +28,25 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
|
|
|
28
28
|
if (!token) {
|
|
29
29
|
console.error(`❌ Available ${credentialType} credential properties:`, Object.keys(credentials));
|
|
30
30
|
console.error(`❌ Full ${credentialType} credential object:`, JSON.stringify(credentials, null, 2));
|
|
31
|
-
throw new Error(`GitHub Copilot: No access token found in ${credentialType} credentials. Available properties: ` + Object.keys(credentials).join(
|
|
31
|
+
throw new Error(`GitHub Copilot: No access token found in ${credentialType} credentials. Available properties: ` + Object.keys(credentials).join(", "));
|
|
32
32
|
}
|
|
33
|
-
const tokenPrefix = token.substring(0, Math.min(4, token.indexOf(
|
|
33
|
+
const tokenPrefix = token.substring(0, Math.min(4, token.indexOf("_") + 1)) || token.substring(0, 4);
|
|
34
34
|
const tokenSuffix = token.substring(Math.max(0, token.length - 5));
|
|
35
35
|
console.log(`🔍 GitHub Copilot ${credentialType} Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
|
|
36
|
-
if (!token.startsWith(
|
|
36
|
+
if (!token.startsWith("gho_") && !token.startsWith("ghu_") && !token.startsWith("github_pat_")) {
|
|
37
37
|
console.warn(`⚠️ Unexpected token format: ${tokenPrefix}...${tokenSuffix}. Trying API call anyway.`);
|
|
38
38
|
}
|
|
39
39
|
const headers = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
"Authorization": `Bearer ${token}`,
|
|
41
|
+
"Accept": "application/json",
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
43
|
};
|
|
44
44
|
if (hasMedia) {
|
|
45
|
-
headers[
|
|
46
|
-
headers[
|
|
45
|
+
headers["Copilot-Vision-Request"] = "true";
|
|
46
|
+
headers["Copilot-Media-Request"] = "true";
|
|
47
47
|
}
|
|
48
48
|
const options = {
|
|
49
|
-
method:
|
|
49
|
+
method: "POST",
|
|
50
50
|
headers,
|
|
51
51
|
body: JSON.stringify(body),
|
|
52
52
|
};
|
|
@@ -80,7 +80,7 @@ async function getFileFromBinary(context, itemIndex, propertyName) {
|
|
|
80
80
|
}
|
|
81
81
|
const binaryData = item.binary[propertyName];
|
|
82
82
|
if (binaryData.data) {
|
|
83
|
-
return Buffer.from(binaryData.data,
|
|
83
|
+
return Buffer.from(binaryData.data, "base64");
|
|
84
84
|
}
|
|
85
85
|
else if (binaryData.id) {
|
|
86
86
|
return await context.helpers.getBinaryDataBuffer(itemIndex, propertyName);
|
|
@@ -90,38 +90,38 @@ async function getFileFromBinary(context, itemIndex, propertyName) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
function getImageMimeType(filename) {
|
|
93
|
-
const ext = filename.toLowerCase().split(
|
|
93
|
+
const ext = filename.toLowerCase().split(".").pop();
|
|
94
94
|
switch (ext) {
|
|
95
|
-
case
|
|
96
|
-
case
|
|
97
|
-
return
|
|
98
|
-
case
|
|
99
|
-
return
|
|
100
|
-
case
|
|
101
|
-
return
|
|
102
|
-
case
|
|
103
|
-
return
|
|
95
|
+
case "jpg":
|
|
96
|
+
case "jpeg":
|
|
97
|
+
return "image/jpeg";
|
|
98
|
+
case "png":
|
|
99
|
+
return "image/png";
|
|
100
|
+
case "webp":
|
|
101
|
+
return "image/webp";
|
|
102
|
+
case "gif":
|
|
103
|
+
return "image/gif";
|
|
104
104
|
default:
|
|
105
|
-
return
|
|
105
|
+
return "image/jpeg";
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
function getAudioMimeType(filename) {
|
|
109
|
-
const ext = filename.toLowerCase().split(
|
|
109
|
+
const ext = filename.toLowerCase().split(".").pop();
|
|
110
110
|
switch (ext) {
|
|
111
|
-
case
|
|
112
|
-
return
|
|
113
|
-
case
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
return
|
|
117
|
-
case
|
|
118
|
-
return
|
|
119
|
-
case
|
|
120
|
-
return
|
|
121
|
-
case
|
|
122
|
-
return
|
|
111
|
+
case "mp3":
|
|
112
|
+
return "audio/mpeg";
|
|
113
|
+
case "wav":
|
|
114
|
+
return "audio/wav";
|
|
115
|
+
case "m4a":
|
|
116
|
+
return "audio/mp4";
|
|
117
|
+
case "flac":
|
|
118
|
+
return "audio/flac";
|
|
119
|
+
case "ogg":
|
|
120
|
+
return "audio/ogg";
|
|
121
|
+
case "aac":
|
|
122
|
+
return "audio/aac";
|
|
123
123
|
default:
|
|
124
|
-
return
|
|
124
|
+
return "audio/mpeg";
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
function validateFileSize(buffer, maxSizeKB = 1024) {
|
|
@@ -153,7 +153,7 @@ function truncateToTokenLimit(content, maxTokens = 100000) {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
const targetLength = Math.floor(content.length * (maxTokens / originalTokens));
|
|
156
|
-
const truncatedContent = content.slice(0, targetLength) +
|
|
156
|
+
const truncatedContent = content.slice(0, targetLength) + "...[truncated]";
|
|
157
157
|
return {
|
|
158
158
|
content: truncatedContent,
|
|
159
159
|
truncated: true,
|
|
@@ -18,16 +18,16 @@ export declare const GITHUB_COPILOT_API: {
|
|
|
18
18
|
readonly HEADERS: {
|
|
19
19
|
readonly DEFAULT: {
|
|
20
20
|
readonly Accept: "application/json";
|
|
21
|
-
readonly
|
|
21
|
+
readonly "Content-Type": "application/json";
|
|
22
22
|
};
|
|
23
23
|
readonly WITH_AUTH: (token: string) => {
|
|
24
24
|
Authorization: string;
|
|
25
25
|
Accept: string;
|
|
26
|
-
|
|
26
|
+
"Content-Type": string;
|
|
27
27
|
};
|
|
28
28
|
readonly VSCODE_CLIENT: {
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
29
|
+
readonly "User-Agent": "VSCode-Copilot";
|
|
30
|
+
readonly "X-GitHub-Api-Version": "2022-11-28";
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
readonly RATE_LIMITS: {
|
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GitHubCopilotEndpoints = exports.GITHUB_COPILOT_API = void 0;
|
|
4
4
|
exports.GITHUB_COPILOT_API = {
|
|
5
|
-
BASE_URL:
|
|
6
|
-
GITHUB_BASE_URL:
|
|
5
|
+
BASE_URL: "https://api.githubcopilot.com",
|
|
6
|
+
GITHUB_BASE_URL: "https://api.github.com",
|
|
7
7
|
ENDPOINTS: {
|
|
8
|
-
MODELS:
|
|
9
|
-
CHAT_COMPLETIONS:
|
|
8
|
+
MODELS: "/models",
|
|
9
|
+
CHAT_COMPLETIONS: "/chat/completions",
|
|
10
10
|
ORG_BILLING: (org) => `/orgs/${org}/copilot/billing`,
|
|
11
11
|
ORG_SEATS: (org) => `/orgs/${org}/copilot/billing/seats`,
|
|
12
|
-
USER_COPILOT:
|
|
12
|
+
USER_COPILOT: "/user/copilot_access",
|
|
13
13
|
},
|
|
14
14
|
URLS: {
|
|
15
|
-
MODELS:
|
|
16
|
-
CHAT_COMPLETIONS:
|
|
15
|
+
MODELS: "https://api.githubcopilot.com/models",
|
|
16
|
+
CHAT_COMPLETIONS: "https://api.githubcopilot.com/chat/completions",
|
|
17
17
|
ORG_BILLING: (org) => `https://api.github.com/orgs/${org}/copilot/billing`,
|
|
18
18
|
ORG_SEATS: (org) => `https://api.github.com/orgs/${org}/copilot/billing/seats`,
|
|
19
|
-
USER_COPILOT:
|
|
19
|
+
USER_COPILOT: "https://api.github.com/user/copilot_access",
|
|
20
20
|
},
|
|
21
21
|
HEADERS: {
|
|
22
22
|
DEFAULT: {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
"Accept": "application/json",
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
25
|
},
|
|
26
26
|
WITH_AUTH: (token) => ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
"Authorization": `Bearer ${token}`,
|
|
28
|
+
"Accept": "application/json",
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
30
|
}),
|
|
31
31
|
VSCODE_CLIENT: {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
"User-Agent": "VSCode-Copilot",
|
|
33
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
RATE_LIMITS: {
|
|
@@ -48,9 +48,9 @@ exports.GITHUB_COPILOT_API = {
|
|
|
48
48
|
INTERNAL_SERVER_ERROR: 500,
|
|
49
49
|
},
|
|
50
50
|
ERRORS: {
|
|
51
|
-
INVALID_TOKEN:
|
|
52
|
-
CREDENTIALS_REQUIRED:
|
|
53
|
-
TPM_QUOTA_EXCEEDED:
|
|
51
|
+
INVALID_TOKEN: "Invalid token format. GitHub Copilot API requires tokens starting with \"gho_\"",
|
|
52
|
+
CREDENTIALS_REQUIRED: "GitHub Copilot API credentials are required",
|
|
53
|
+
TPM_QUOTA_EXCEEDED: "TPM (Transactions Per Minute) quota exceeded",
|
|
54
54
|
API_ERROR: (status, message) => `API Error ${status}: ${message}`,
|
|
55
55
|
},
|
|
56
56
|
};
|
|
@@ -89,7 +89,7 @@ class GitHubCopilotEndpoints {
|
|
|
89
89
|
return statusCode === exports.GITHUB_COPILOT_API.STATUS_CODES.FORBIDDEN;
|
|
90
90
|
}
|
|
91
91
|
static validateToken(token) {
|
|
92
|
-
return typeof token ===
|
|
92
|
+
return typeof token === "string" && token.startsWith("gho_");
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
exports.GitHubCopilotEndpoints = GitHubCopilotEndpoints;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.29.
|
|
3
|
+
"version": "3.29.5",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "tsc && gulp build:icons",
|
|
18
18
|
"dev": "tsc --watch",
|
|
19
19
|
"format": "prettier nodes credentials --write",
|
|
20
|
-
"lint": "eslint nodes credentials --ext .ts",
|
|
21
|
-
"lintfix": "eslint nodes credentials --ext .ts --fix",
|
|
20
|
+
"lint": "eslint nodes credentials shared --ext .ts",
|
|
21
|
+
"lintfix": "eslint nodes credentials shared --ext .ts --fix",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|