n8n-nodes-github-copilot 3.35.0 → 3.36.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.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GitHubCopilotTest = void 0;
4
4
  const GitHubCopilotEndpoints_1 = require("../../shared/utils/GitHubCopilotEndpoints");
5
+ const DynamicModelsManager_1 = require("../../shared/utils/DynamicModelsManager");
6
+ const OAuthTokenManager_1 = require("../../shared/utils/OAuthTokenManager");
5
7
  async function listAvailableModels(token, enableRetry = true, maxRetries = 3) {
6
8
  const retryInfo = {
7
9
  attempts: 1,
@@ -85,6 +87,104 @@ async function listAvailableModels(token, enableRetry = true, maxRetries = 3) {
85
87
  },
86
88
  };
87
89
  }
90
+ async function refreshModelsCache(githubToken, enableRetry = true, maxRetries = 3) {
91
+ const startTime = Date.now();
92
+ try {
93
+ console.log("🔄 Starting models cache refresh...");
94
+ console.log("🔑 Generating OAuth token...");
95
+ const oauthToken = await OAuthTokenManager_1.OAuthTokenManager.getValidOAuthToken(githubToken);
96
+ const cacheInfoBefore = DynamicModelsManager_1.DynamicModelsManager.getCacheInfo(oauthToken);
97
+ console.log("🗑️ Clearing existing cache...");
98
+ DynamicModelsManager_1.DynamicModelsManager.clearCache(oauthToken);
99
+ console.log("📥 Fetching fresh models from API...");
100
+ const models = await DynamicModelsManager_1.DynamicModelsManager.getAvailableModels(oauthToken);
101
+ const cacheInfoAfter = DynamicModelsManager_1.DynamicModelsManager.getCacheInfo(oauthToken);
102
+ const executionTime = Date.now() - startTime;
103
+ const modelsByVendor = {};
104
+ const capabilitiesCount = {
105
+ streaming: 0,
106
+ tools: 0,
107
+ vision: 0,
108
+ structured: 0,
109
+ parallel: 0,
110
+ reasoning: 0,
111
+ };
112
+ models.forEach((model) => {
113
+ var _a;
114
+ const vendor = model.vendor || "Unknown";
115
+ modelsByVendor[vendor] = (modelsByVendor[vendor] || 0) + 1;
116
+ if ((_a = model.capabilities) === null || _a === void 0 ? void 0 : _a.supports) {
117
+ const supports = model.capabilities.supports;
118
+ if (supports.streaming)
119
+ capabilitiesCount.streaming++;
120
+ if (supports.tool_calls)
121
+ capabilitiesCount.tools++;
122
+ if (supports.vision)
123
+ capabilitiesCount.vision++;
124
+ if (supports.structured_outputs)
125
+ capabilitiesCount.structured++;
126
+ if (supports.parallel_tool_calls)
127
+ capabilitiesCount.parallel++;
128
+ if (supports.max_thinking_budget)
129
+ capabilitiesCount.reasoning++;
130
+ }
131
+ });
132
+ return {
133
+ success: true,
134
+ operation: "refreshCache",
135
+ timestamp: new Date().toISOString(),
136
+ executionTime: `${executionTime}ms`,
137
+ message: "✅ Models cache refreshed successfully",
138
+ summary: {
139
+ totalModels: models.length,
140
+ modelsByVendor,
141
+ capabilities: capabilitiesCount,
142
+ },
143
+ cache: {
144
+ before: cacheInfoBefore ? {
145
+ cached: true,
146
+ modelsCount: cacheInfoBefore.modelsCount,
147
+ expiresIn: `${Math.round(cacheInfoBefore.expiresIn / 1000)}s`,
148
+ fetchedAt: cacheInfoBefore.fetchedAt,
149
+ } : {
150
+ cached: false,
151
+ message: "No cache existed before refresh",
152
+ },
153
+ after: cacheInfoAfter ? {
154
+ cached: true,
155
+ modelsCount: cacheInfoAfter.modelsCount,
156
+ expiresIn: `${Math.round(cacheInfoAfter.expiresIn / 1000)}s`,
157
+ fetchedAt: cacheInfoAfter.fetchedAt,
158
+ } : {
159
+ cached: false,
160
+ message: "Cache refresh failed",
161
+ },
162
+ },
163
+ models: models.map((model) => {
164
+ var _a;
165
+ return ({
166
+ id: model.id,
167
+ name: model.name || model.id,
168
+ vendor: model.vendor,
169
+ capabilities: ((_a = model.capabilities) === null || _a === void 0 ? void 0 : _a.supports) || {},
170
+ });
171
+ }),
172
+ };
173
+ }
174
+ catch (error) {
175
+ const executionTime = Date.now() - startTime;
176
+ const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
177
+ return {
178
+ success: false,
179
+ operation: "refreshCache",
180
+ timestamp: new Date().toISOString(),
181
+ executionTime: `${executionTime}ms`,
182
+ error: errorMessage,
183
+ message: "❌ Failed to refresh models cache",
184
+ details: error instanceof Error ? error.stack : String(error),
185
+ };
186
+ }
187
+ }
88
188
  async function consolidatedModelTest(token, enableRetry = true, maxRetries = 3, testsPerModel = 5) {
89
189
  const testStartTime = Date.now();
90
190
  const testResults = {};
@@ -341,6 +441,11 @@ class GitHubCopilotTest {
341
441
  value: "listModels",
342
442
  description: "Get all models available for your GitHub Copilot subscription",
343
443
  },
444
+ {
445
+ name: "Refresh Models Cache",
446
+ value: "refreshCache",
447
+ description: "Force refresh the cached models list (clears cache and fetches fresh data from API)",
448
+ },
344
449
  {
345
450
  name: "Consolidated Model Test",
346
451
  value: "consolidatedTest",
@@ -423,6 +528,9 @@ class GitHubCopilotTest {
423
528
  case "listModels":
424
529
  result = await listAvailableModels(token, enableRetry, maxRetries);
425
530
  break;
531
+ case "refreshCache":
532
+ result = await refreshModelsCache(token, enableRetry, maxRetries);
533
+ break;
426
534
  case "consolidatedTest":
427
535
  result = await consolidatedModelTest(token, enableRetry, maxRetries, testsPerModel);
428
536
  break;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.35.0",
3
+ "version": "3.36.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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.35.0",
3
+ "version": "3.36.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",