n8n-nodes-github-copilot 3.38.13 → 3.38.15

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.
@@ -108,7 +108,7 @@ class GitHubCopilotOpenAI {
108
108
  role: msg.role,
109
109
  content: msg.content,
110
110
  };
111
- if (msg.type && msg.type !== 'text') {
111
+ if (msg.type && (msg.type === 'text' || msg.type === 'image_url')) {
112
112
  message.type = msg.type;
113
113
  }
114
114
  messages.push(message);
@@ -128,19 +128,31 @@ class GitHubCopilotOpenAI {
128
128
  const tools = advancedOptions.tools;
129
129
  if (tools) {
130
130
  try {
131
- if (typeof tools === 'object' && Array.isArray(tools)) {
131
+ if (typeof tools === 'object' && Array.isArray(tools) && tools.length > 0) {
132
132
  parsedTools = tools;
133
133
  console.log('📥 Received tools as direct array (no parsing needed)');
134
134
  }
135
135
  else if (typeof tools === 'string' && tools.trim()) {
136
- parsedTools = JSON.parse(tools);
137
- console.log('📥 Parsed tools from JSON string');
136
+ const parsed = JSON.parse(tools);
137
+ if (Array.isArray(parsed) && parsed.length > 0) {
138
+ parsedTools = parsed;
139
+ console.log('📥 Parsed tools from JSON string');
140
+ }
141
+ else {
142
+ console.log('📥 Tools string parsed but empty or not an array');
143
+ }
144
+ }
145
+ else {
146
+ console.log('📥 Tools field present but empty or invalid');
138
147
  }
139
148
  }
140
149
  catch (error) {
141
- throw new Error(`Failed to parse tools JSON: ${error instanceof Error ? error.message : "Unknown error"}`);
150
+ console.log('⚠️ Failed to parse tools, ignoring:', error instanceof Error ? error.message : "Unknown error");
142
151
  }
143
152
  }
153
+ else {
154
+ console.log('📥 No tools specified');
155
+ }
144
156
  let max_tokens = advancedOptions.max_tokens || 4096;
145
157
  if (!max_tokens || max_tokens <= 0 || isNaN(max_tokens)) {
146
158
  max_tokens = 4096;
@@ -348,6 +360,16 @@ class GitHubCopilotOpenAI {
348
360
  catch (parseError) {
349
361
  console.error('Failed to parse API error:', parseError);
350
362
  }
363
+ const lowerMessage = cleanMessage.toLowerCase();
364
+ const is400Error = lowerMessage.includes("400") || lowerMessage.includes("bad request") ||
365
+ (apiError && apiError.error && apiError.error.code === "invalid_request_body");
366
+ if (is400Error) {
367
+ console.log('🚫 400 Bad Request detected - throwing non-retryable error');
368
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Bad Request (400): ${cleanMessage}`, {
369
+ itemIndex: i,
370
+ description: 'The request was malformed or contains invalid parameters. Retrying will not help.',
371
+ });
372
+ }
351
373
  let errorType = "invalid_request_error";
352
374
  let errorCode = null;
353
375
  let errorParam = null;
@@ -360,19 +382,7 @@ class GitHubCopilotOpenAI {
360
382
  console.log('✅ Using GitHub Copilot API error details');
361
383
  }
362
384
  else {
363
- const lowerMessage = cleanMessage.toLowerCase();
364
- const is400Error = lowerMessage.includes("400") || lowerMessage.includes("bad request");
365
- if (is400Error) {
366
- errorType = "invalid_request_error";
367
- errorCode = "invalid_request";
368
- finalMessage = cleanMessage;
369
- console.log('🚫 400 Bad Request detected - throwing non-retryable error');
370
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Bad Request (400): ${finalMessage}`, {
371
- itemIndex: i,
372
- description: 'The request was malformed or contains invalid parameters. Retrying will not help.',
373
- });
374
- }
375
- else if (lowerMessage.includes("403") || lowerMessage.includes("forbidden")) {
385
+ if (lowerMessage.includes("403") || lowerMessage.includes("forbidden")) {
376
386
  errorType = "invalid_request_error";
377
387
  errorCode = "insufficient_quota";
378
388
  if (lowerMessage.includes("access") && lowerMessage.includes("forbidden")) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.38.13",
3
+ "version": "3.38.15",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.38.13",
3
+ "version": "3.38.15",
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",