n8n-nodes-github-copilot 3.12.7 → 3.13.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.
|
@@ -30,7 +30,7 @@ class GitHubCopilotApi {
|
|
|
30
30
|
displayName: 'Scope',
|
|
31
31
|
name: 'scope',
|
|
32
32
|
type: 'hidden',
|
|
33
|
-
default: '
|
|
33
|
+
default: 'repo read:org admin:public_key gist',
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
displayName: 'Auth URI Query Parameters',
|
|
@@ -52,9 +52,6 @@ class GitHubCopilotApi {
|
|
|
52
52
|
method: 'GET',
|
|
53
53
|
headers: {
|
|
54
54
|
'Accept': 'application/json',
|
|
55
|
-
'User-Agent': 'vscode-copilot',
|
|
56
|
-
'Editor-Version': 'vscode/1.85.0',
|
|
57
|
-
'Editor-Plugin-Version': 'copilot-chat/0.12.0',
|
|
58
55
|
'Content-Type': 'application/json',
|
|
59
56
|
},
|
|
60
57
|
},
|
|
@@ -7,7 +7,7 @@ exports.getImageMimeTypeFromFilename = getImageMimeTypeFromFilename;
|
|
|
7
7
|
exports.validateFileSize = validateFileSize;
|
|
8
8
|
const GitHubCopilotApiUtils_1 = require("../../../shared/utils/GitHubCopilotApiUtils");
|
|
9
9
|
async function makeApiRequest(context, endpoint, body, hasMedia = false) {
|
|
10
|
-
return await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(context, endpoint, body,
|
|
10
|
+
return await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(context, endpoint, body, hasMedia);
|
|
11
11
|
}
|
|
12
12
|
exports.downloadFileFromUrl = GitHubCopilotApiUtils_1.downloadFileFromUrl;
|
|
13
13
|
exports.getFileFromBinary = GitHubCopilotApiUtils_1.getFileFromBinary;
|
|
@@ -18,7 +18,7 @@ export interface CopilotResponse {
|
|
|
18
18
|
total_tokens: number;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
export declare function makeGitHubCopilotRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>,
|
|
21
|
+
export declare function makeGitHubCopilotRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean): Promise<CopilotResponse>;
|
|
22
22
|
export declare function downloadFileFromUrl(url: string): Promise<Buffer>;
|
|
23
23
|
export declare function getFileFromBinary(context: IExecuteFunctions, itemIndex: number, propertyName: string): Promise<Buffer>;
|
|
24
24
|
export declare function getImageMimeType(filename: string): string;
|
|
@@ -9,44 +9,29 @@ exports.validateFileSize = validateFileSize;
|
|
|
9
9
|
exports.estimateTokens = estimateTokens;
|
|
10
10
|
exports.validateTokenLimit = validateTokenLimit;
|
|
11
11
|
exports.truncateToTokenLimit = truncateToTokenLimit;
|
|
12
|
-
async function makeGitHubCopilotRequest(context, endpoint, body,
|
|
12
|
+
async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = false) {
|
|
13
13
|
var _a;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.error('❌ Full OAuth2 credential object:', JSON.stringify(credentials, null, 2));
|
|
25
|
-
throw new Error('GitHub Copilot: No access token found in OAuth2 credentials. Available properties: ' + Object.keys(credentials).join(', '));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const credentials = await context.getCredentials('githubApiManual');
|
|
30
|
-
console.log('🔍 Manual Credentials Debug:', Object.keys(credentials));
|
|
31
|
-
token = credentials.token || credentials.accessToken;
|
|
32
|
-
if (!token) {
|
|
33
|
-
console.error('❌ Available manual credential properties:', Object.keys(credentials));
|
|
34
|
-
throw new Error('GitHub Copilot: No access token found in manual credentials. Available properties: ' + Object.keys(credentials).join(', '));
|
|
35
|
-
}
|
|
14
|
+
const credentials = await context.getCredentials('githubCopilotApi');
|
|
15
|
+
console.log('🔍 OAuth2 Credentials Debug:', Object.keys(credentials));
|
|
16
|
+
const token = (credentials.accessToken ||
|
|
17
|
+
credentials.access_token ||
|
|
18
|
+
((_a = credentials.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token) ||
|
|
19
|
+
credentials.token);
|
|
20
|
+
if (!token) {
|
|
21
|
+
console.error('❌ Available OAuth2 credential properties:', Object.keys(credentials));
|
|
22
|
+
console.error('❌ Full OAuth2 credential object:', JSON.stringify(credentials, null, 2));
|
|
23
|
+
throw new Error('GitHub Copilot: No access token found in OAuth2 credentials. Available properties: ' + Object.keys(credentials).join(', '));
|
|
36
24
|
}
|
|
37
25
|
const tokenPrefix = token.substring(0, Math.min(4, token.indexOf('_') + 1)) || token.substring(0, 4);
|
|
38
26
|
const tokenSuffix = token.substring(Math.max(0, token.length - 5));
|
|
39
|
-
console.log(`🔍 GitHub Copilot
|
|
27
|
+
console.log(`🔍 GitHub Copilot OAuth2 Debug: Using token ${tokenPrefix}...${tokenSuffix}`);
|
|
40
28
|
if (!token.startsWith('gho_') && !token.startsWith('ghu_') && !token.startsWith('github_pat_')) {
|
|
41
29
|
console.warn(`⚠️ Unexpected token format: ${tokenPrefix}...${tokenSuffix}. Trying API call anyway.`);
|
|
42
30
|
}
|
|
43
31
|
const headers = {
|
|
44
32
|
'Authorization': `Bearer ${token}`,
|
|
45
|
-
'Content-Type': 'application/json',
|
|
46
33
|
'Accept': 'application/json',
|
|
47
|
-
'
|
|
48
|
-
'Editor-Version': 'vscode/1.85.0',
|
|
49
|
-
'Editor-Plugin-Version': 'copilot-chat/0.12.0',
|
|
34
|
+
'Content-Type': 'application/json',
|
|
50
35
|
};
|
|
51
36
|
if (hasMedia) {
|
|
52
37
|
headers['Copilot-Vision-Request'] = 'true';
|
|
@@ -63,7 +48,7 @@ async function makeGitHubCopilotRequest(context, endpoint, body, credentialType
|
|
|
63
48
|
const tokenInfo = token;
|
|
64
49
|
console.error(`❌ GitHub Copilot API Error: ${response.status} ${response.statusText}`);
|
|
65
50
|
console.error(`❌ Error details: ${errorText}`);
|
|
66
|
-
console.error(`❌ Used credential type:
|
|
51
|
+
console.error(`❌ Used credential type: githubCopilotApi`);
|
|
67
52
|
console.error(`❌ Token format used: ${tokenInfo}`);
|
|
68
53
|
const enhancedError = `GitHub Copilot API error: ${response.status} ${response.statusText}. ${errorText} [Token used: ${tokenInfo}]`;
|
|
69
54
|
throw new Error(enhancedError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
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",
|