agentic-qe 2.6.4 → 2.6.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/CHANGELOG.md +43 -0
- package/README.md +26 -1
- package/dist/cli/commands/providers/index.d.ts +20 -0
- package/dist/cli/commands/providers/index.d.ts.map +1 -0
- package/dist/cli/commands/providers/index.js +143 -0
- package/dist/cli/commands/providers/index.js.map +1 -0
- package/dist/cli/commands/providers/status.d.ts +117 -0
- package/dist/cli/commands/providers/status.d.ts.map +1 -0
- package/dist/cli/commands/providers/status.js +368 -0
- package/dist/cli/commands/providers/status.js.map +1 -0
- package/dist/cli/index.js +8 -62
- package/dist/cli/index.js.map +1 -1
- package/dist/core/memory/HNSWVectorMemory.js +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/monitoring/ProviderHealthMonitor.d.ts +195 -0
- package/dist/monitoring/ProviderHealthMonitor.d.ts.map +1 -0
- package/dist/monitoring/ProviderHealthMonitor.js +431 -0
- package/dist/monitoring/ProviderHealthMonitor.js.map +1 -0
- package/dist/monitoring/QuotaManager.d.ts +122 -0
- package/dist/monitoring/QuotaManager.d.ts.map +1 -0
- package/dist/monitoring/QuotaManager.js +351 -0
- package/dist/monitoring/QuotaManager.js.map +1 -0
- package/dist/providers/GitHubModelsProvider.d.ts +117 -0
- package/dist/providers/GitHubModelsProvider.d.ts.map +1 -0
- package/dist/providers/GitHubModelsProvider.js +464 -0
- package/dist/providers/GitHubModelsProvider.js.map +1 -0
- package/dist/providers/GroqProvider.d.ts +115 -0
- package/dist/providers/GroqProvider.d.ts.map +1 -0
- package/dist/providers/GroqProvider.js +443 -0
- package/dist/providers/GroqProvider.js.map +1 -0
- package/dist/providers/HybridRouterHealthIntegration.d.ts +191 -0
- package/dist/providers/HybridRouterHealthIntegration.d.ts.map +1 -0
- package/dist/providers/HybridRouterHealthIntegration.js +439 -0
- package/dist/providers/HybridRouterHealthIntegration.js.map +1 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +12 -1
- package/dist/providers/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli/commands/providers.d.ts +0 -50
- package/dist/cli/commands/providers.d.ts.map +0 -1
- package/dist/cli/commands/providers.js +0 -403
- package/dist/cli/commands/providers.js.map +0 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotaManager = void 0;
|
|
4
|
+
exports.createQuotaManager = createQuotaManager;
|
|
5
|
+
const events_1 = require("events");
|
|
6
|
+
/**
|
|
7
|
+
* Manages quota tracking and enforcement across LLM providers
|
|
8
|
+
*/
|
|
9
|
+
class QuotaManager extends events_1.EventEmitter {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super();
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.quotas = new Map();
|
|
14
|
+
this.usage = new Map();
|
|
15
|
+
this.resetTimers = new Map();
|
|
16
|
+
// Register all providers
|
|
17
|
+
config.providers.forEach(provider => this.registerProvider(provider));
|
|
18
|
+
// Load persisted state if enabled
|
|
19
|
+
if (config.persistState) {
|
|
20
|
+
this.loadState();
|
|
21
|
+
}
|
|
22
|
+
// Start cleanup interval for minute windows
|
|
23
|
+
this.cleanupInterval = setInterval(() => this.cleanupMinuteWindows(), 60000);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register a new provider with quota limits
|
|
27
|
+
*/
|
|
28
|
+
registerProvider(quota) {
|
|
29
|
+
this.quotas.set(quota.providerId, quota);
|
|
30
|
+
if (!this.usage.has(quota.providerId)) {
|
|
31
|
+
this.usage.set(quota.providerId, {
|
|
32
|
+
dailyCount: 0,
|
|
33
|
+
minuteWindow: [],
|
|
34
|
+
lastResetTime: new Date(),
|
|
35
|
+
triggeredThresholds: new Set()
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Update quota configuration for a provider
|
|
41
|
+
*/
|
|
42
|
+
updateQuota(providerId, updates) {
|
|
43
|
+
const existing = this.quotas.get(providerId);
|
|
44
|
+
if (!existing) {
|
|
45
|
+
throw new Error(`Provider ${providerId} not registered`);
|
|
46
|
+
}
|
|
47
|
+
const updated = { ...existing, ...updates };
|
|
48
|
+
this.quotas.set(providerId, updated);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Record a single request for a provider
|
|
52
|
+
*/
|
|
53
|
+
recordRequest(providerId) {
|
|
54
|
+
this.recordRequests(providerId, 1);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Record multiple requests for a provider
|
|
58
|
+
*/
|
|
59
|
+
recordRequests(providerId, count) {
|
|
60
|
+
const quota = this.quotas.get(providerId);
|
|
61
|
+
const record = this.usage.get(providerId);
|
|
62
|
+
if (!quota || !record) {
|
|
63
|
+
throw new Error(`Provider ${providerId} not registered`);
|
|
64
|
+
}
|
|
65
|
+
const now = Date.now();
|
|
66
|
+
// Update daily count
|
|
67
|
+
record.dailyCount += count;
|
|
68
|
+
// Update minute window
|
|
69
|
+
record.minuteWindow.push({ timestamp: now, count });
|
|
70
|
+
this.cleanupOldMinuteEntries(providerId);
|
|
71
|
+
// Check quota status and emit events
|
|
72
|
+
const status = this.getQuotaStatus(providerId);
|
|
73
|
+
if (status) {
|
|
74
|
+
this.checkThresholds(status, record);
|
|
75
|
+
if (this.config.alertCallback) {
|
|
76
|
+
this.config.alertCallback(status);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Persist state if enabled
|
|
80
|
+
if (this.config.persistState) {
|
|
81
|
+
this.saveState();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if a request can be made without exceeding quota
|
|
86
|
+
*/
|
|
87
|
+
canMakeRequest(providerId) {
|
|
88
|
+
const status = this.getQuotaStatus(providerId);
|
|
89
|
+
if (!status) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
const canMake = !status.isExhausted;
|
|
93
|
+
if (!canMake && this.config.enforcementMode === 'block') {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return canMake;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get remaining quota for a provider
|
|
100
|
+
*/
|
|
101
|
+
getRemainingQuota(providerId) {
|
|
102
|
+
const status = this.getQuotaStatus(providerId);
|
|
103
|
+
if (!status) {
|
|
104
|
+
return { daily: 0, minute: 0 };
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
daily: status.dailyRemaining,
|
|
108
|
+
minute: status.minuteRemaining
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get current quota status for a provider
|
|
113
|
+
*/
|
|
114
|
+
getQuotaStatus(providerId) {
|
|
115
|
+
const quota = this.quotas.get(providerId);
|
|
116
|
+
const record = this.usage.get(providerId);
|
|
117
|
+
if (!quota || !record) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const minuteUsed = this.getMinuteUsage(providerId);
|
|
121
|
+
const minuteLimit = quota.minuteLimit || Infinity;
|
|
122
|
+
const percentageUsed = quota.dailyLimit === Infinity
|
|
123
|
+
? 0
|
|
124
|
+
: (record.dailyCount / quota.dailyLimit) * 100;
|
|
125
|
+
const isExhausted = (quota.dailyLimit !== Infinity && record.dailyCount >= quota.dailyLimit) ||
|
|
126
|
+
(quota.minuteLimit !== undefined && minuteUsed >= quota.minuteLimit);
|
|
127
|
+
const warningLevel = this.determineWarningLevel(percentageUsed, isExhausted);
|
|
128
|
+
return {
|
|
129
|
+
providerId,
|
|
130
|
+
dailyUsed: record.dailyCount,
|
|
131
|
+
dailyRemaining: Math.max(0, quota.dailyLimit - record.dailyCount),
|
|
132
|
+
dailyLimit: quota.dailyLimit,
|
|
133
|
+
minuteUsed,
|
|
134
|
+
minuteRemaining: Math.max(0, minuteLimit - minuteUsed),
|
|
135
|
+
minuteLimit,
|
|
136
|
+
percentageUsed,
|
|
137
|
+
nextResetTime: this.calculateNextResetTime(quota.resetTimeUtc),
|
|
138
|
+
isExhausted,
|
|
139
|
+
warningLevel
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get quota status for all providers
|
|
144
|
+
*/
|
|
145
|
+
getAllQuotaStatus() {
|
|
146
|
+
const statusMap = new Map();
|
|
147
|
+
for (const providerId of Array.from(this.quotas.keys())) {
|
|
148
|
+
const status = this.getQuotaStatus(providerId);
|
|
149
|
+
if (status) {
|
|
150
|
+
statusMap.set(providerId, status);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return statusMap;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Reset daily quota for a provider
|
|
157
|
+
*/
|
|
158
|
+
resetDailyQuota(providerId) {
|
|
159
|
+
const record = this.usage.get(providerId);
|
|
160
|
+
if (!record) {
|
|
161
|
+
throw new Error(`Provider ${providerId} not registered`);
|
|
162
|
+
}
|
|
163
|
+
record.dailyCount = 0;
|
|
164
|
+
record.lastResetTime = new Date();
|
|
165
|
+
record.triggeredThresholds.clear();
|
|
166
|
+
const status = this.getQuotaStatus(providerId);
|
|
167
|
+
if (status) {
|
|
168
|
+
this.emit('quota-reset', status);
|
|
169
|
+
}
|
|
170
|
+
if (this.config.persistState) {
|
|
171
|
+
this.saveState();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Reset daily quotas for all providers
|
|
176
|
+
*/
|
|
177
|
+
resetAllDailyQuotas() {
|
|
178
|
+
for (const providerId of Array.from(this.quotas.keys())) {
|
|
179
|
+
this.resetDailyQuota(providerId);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Start automatic quota reset scheduling
|
|
184
|
+
*/
|
|
185
|
+
startAutoReset() {
|
|
186
|
+
// Schedule reset for each provider
|
|
187
|
+
for (const [providerId, quota] of Array.from(this.quotas.entries())) {
|
|
188
|
+
const nextReset = this.calculateNextResetTime(quota.resetTimeUtc);
|
|
189
|
+
const timeUntilReset = nextReset.getTime() - Date.now();
|
|
190
|
+
const timer = setTimeout(() => {
|
|
191
|
+
this.resetDailyQuota(providerId);
|
|
192
|
+
// Schedule next reset
|
|
193
|
+
this.scheduleNextReset(providerId);
|
|
194
|
+
}, timeUntilReset);
|
|
195
|
+
this.resetTimers.set(providerId, timer);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Stop automatic quota reset scheduling
|
|
200
|
+
*/
|
|
201
|
+
stopAutoReset() {
|
|
202
|
+
for (const timer of Array.from(this.resetTimers.values())) {
|
|
203
|
+
clearTimeout(timer);
|
|
204
|
+
}
|
|
205
|
+
this.resetTimers.clear();
|
|
206
|
+
if (this.cleanupInterval) {
|
|
207
|
+
clearInterval(this.cleanupInterval);
|
|
208
|
+
this.cleanupInterval = undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Stop cleanup interval (alias for use in CLI commands)
|
|
213
|
+
*/
|
|
214
|
+
stopCleanup() {
|
|
215
|
+
this.stopAutoReset();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Save current state for persistence
|
|
219
|
+
*/
|
|
220
|
+
saveState() {
|
|
221
|
+
// This is a placeholder - implementation would depend on storage mechanism
|
|
222
|
+
// Could save to file, database, or memory cache
|
|
223
|
+
const state = {
|
|
224
|
+
usage: Array.from(this.usage.entries()).map(([id, record]) => ({
|
|
225
|
+
providerId: id,
|
|
226
|
+
dailyCount: record.dailyCount,
|
|
227
|
+
lastResetTime: record.lastResetTime.toISOString(),
|
|
228
|
+
triggeredThresholds: Array.from(record.triggeredThresholds)
|
|
229
|
+
}))
|
|
230
|
+
};
|
|
231
|
+
// Store state (implementation specific)
|
|
232
|
+
// For now, this is a no-op
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Load persisted state
|
|
236
|
+
*/
|
|
237
|
+
loadState() {
|
|
238
|
+
// This is a placeholder - implementation would depend on storage mechanism
|
|
239
|
+
// Would restore usage counts and reset times from storage
|
|
240
|
+
}
|
|
241
|
+
scheduleNextReset(providerId) {
|
|
242
|
+
const quota = this.quotas.get(providerId);
|
|
243
|
+
if (!quota)
|
|
244
|
+
return;
|
|
245
|
+
const nextReset = this.calculateNextResetTime(quota.resetTimeUtc);
|
|
246
|
+
const timeUntilReset = nextReset.getTime() - Date.now();
|
|
247
|
+
const timer = setTimeout(() => {
|
|
248
|
+
this.resetDailyQuota(providerId);
|
|
249
|
+
this.scheduleNextReset(providerId);
|
|
250
|
+
}, timeUntilReset);
|
|
251
|
+
this.resetTimers.set(providerId, timer);
|
|
252
|
+
}
|
|
253
|
+
getMinuteUsage(providerId) {
|
|
254
|
+
const record = this.usage.get(providerId);
|
|
255
|
+
if (!record)
|
|
256
|
+
return 0;
|
|
257
|
+
const oneMinuteAgo = Date.now() - 60000;
|
|
258
|
+
return record.minuteWindow
|
|
259
|
+
.filter(entry => entry.timestamp > oneMinuteAgo)
|
|
260
|
+
.reduce((sum, entry) => sum + entry.count, 0);
|
|
261
|
+
}
|
|
262
|
+
cleanupOldMinuteEntries(providerId) {
|
|
263
|
+
const record = this.usage.get(providerId);
|
|
264
|
+
if (!record)
|
|
265
|
+
return;
|
|
266
|
+
const oneMinuteAgo = Date.now() - 60000;
|
|
267
|
+
record.minuteWindow = record.minuteWindow.filter(entry => entry.timestamp > oneMinuteAgo);
|
|
268
|
+
}
|
|
269
|
+
cleanupMinuteWindows() {
|
|
270
|
+
for (const providerId of Array.from(this.usage.keys())) {
|
|
271
|
+
this.cleanupOldMinuteEntries(providerId);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
determineWarningLevel(percentageUsed, isExhausted) {
|
|
275
|
+
if (isExhausted)
|
|
276
|
+
return 'exhausted';
|
|
277
|
+
if (percentageUsed >= 90)
|
|
278
|
+
return 'critical';
|
|
279
|
+
if (percentageUsed >= 80)
|
|
280
|
+
return 'warning';
|
|
281
|
+
return 'none';
|
|
282
|
+
}
|
|
283
|
+
checkThresholds(status, record) {
|
|
284
|
+
const quota = this.quotas.get(status.providerId);
|
|
285
|
+
if (!quota)
|
|
286
|
+
return;
|
|
287
|
+
// Check if we've crossed any new thresholds
|
|
288
|
+
for (const threshold of quota.warningThresholds) {
|
|
289
|
+
if (status.percentageUsed >= threshold &&
|
|
290
|
+
!record.triggeredThresholds.has(threshold)) {
|
|
291
|
+
record.triggeredThresholds.add(threshold);
|
|
292
|
+
this.emit('quota-warning', status);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// Check for exhaustion
|
|
296
|
+
if (status.isExhausted && status.warningLevel === 'exhausted') {
|
|
297
|
+
this.emit('quota-exhausted', status);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
calculateNextResetTime(resetTimeUtc) {
|
|
301
|
+
const [hours, minutes] = resetTimeUtc.split(':').map(Number);
|
|
302
|
+
const now = new Date();
|
|
303
|
+
const reset = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), hours, minutes, 0, 0));
|
|
304
|
+
// If reset time has passed today, schedule for tomorrow
|
|
305
|
+
if (reset.getTime() <= now.getTime()) {
|
|
306
|
+
reset.setUTCDate(reset.getUTCDate() + 1);
|
|
307
|
+
}
|
|
308
|
+
return reset;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.QuotaManager = QuotaManager;
|
|
312
|
+
/**
|
|
313
|
+
* Factory function to create QuotaManager with common provider presets
|
|
314
|
+
*/
|
|
315
|
+
function createQuotaManager(config = {}) {
|
|
316
|
+
const defaultProviders = [
|
|
317
|
+
{
|
|
318
|
+
providerId: 'groq',
|
|
319
|
+
dailyLimit: 14400,
|
|
320
|
+
minuteLimit: 10,
|
|
321
|
+
resetTimeUtc: '00:00',
|
|
322
|
+
warningThresholds: [80, 90]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
providerId: 'openrouter',
|
|
326
|
+
dailyLimit: 50,
|
|
327
|
+
resetTimeUtc: '00:00',
|
|
328
|
+
warningThresholds: [80, 90]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
providerId: 'github-models',
|
|
332
|
+
dailyLimit: Infinity,
|
|
333
|
+
resetTimeUtc: '00:00',
|
|
334
|
+
warningThresholds: []
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
providerId: 'ollama',
|
|
338
|
+
dailyLimit: Infinity,
|
|
339
|
+
resetTimeUtc: '00:00',
|
|
340
|
+
warningThresholds: []
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
const fullConfig = {
|
|
344
|
+
providers: defaultProviders,
|
|
345
|
+
enforcementMode: 'warn',
|
|
346
|
+
persistState: false,
|
|
347
|
+
...config
|
|
348
|
+
};
|
|
349
|
+
return new QuotaManager(fullConfig);
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=QuotaManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuotaManager.js","sourceRoot":"","sources":["../../src/monitoring/QuotaManager.ts"],"names":[],"mappings":";;;AAgbA,gDAuCC;AAvdD,mCAAsC;AA+CtC;;GAEG;AACH,MAAa,YAAa,SAAQ,qBAAY;IAO5C,YAAY,MAA0B;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7B,yBAAyB;QACzB,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,C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O,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHubModelsProvider - GitHub Models API Integration
|
|
3
|
+
*
|
|
4
|
+
* Provides LLM capabilities through GitHub Models with support for:
|
|
5
|
+
* - Unlimited free usage in GitHub Codespaces
|
|
6
|
+
* - OpenAI-compatible API format
|
|
7
|
+
* - Multiple model families (GPT-4, Phi, LLaMA)
|
|
8
|
+
* - Streaming responses
|
|
9
|
+
* - Automatic Codespaces detection
|
|
10
|
+
*
|
|
11
|
+
* @module providers/GitHubModelsProvider
|
|
12
|
+
* @version 1.0.0
|
|
13
|
+
*/
|
|
14
|
+
import { ILLMProvider, LLMProviderConfig, LLMCompletionOptions, LLMCompletionResponse, LLMStreamEvent, LLMEmbeddingOptions, LLMEmbeddingResponse, LLMTokenCountOptions, LLMHealthStatus, LLMProviderMetadata } from './ILLMProvider';
|
|
15
|
+
/**
|
|
16
|
+
* GitHub Models-specific configuration
|
|
17
|
+
*/
|
|
18
|
+
export interface GitHubModelsProviderConfig extends LLMProviderConfig {
|
|
19
|
+
/** GitHub token (defaults to process.env.GITHUB_TOKEN) */
|
|
20
|
+
token?: string;
|
|
21
|
+
/** Base URL for GitHub Models API */
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
/** Default model name */
|
|
24
|
+
defaultModel?: string;
|
|
25
|
+
/** Force Codespaces mode (auto-detected if not set) */
|
|
26
|
+
inCodespaces?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* GitHubModelsProvider - GitHub Models API implementation
|
|
30
|
+
*
|
|
31
|
+
* This provider enables access to GitHub Models with unlimited free usage
|
|
32
|
+
* in GitHub Codespaces. Supports OpenAI-compatible API format.
|
|
33
|
+
*/
|
|
34
|
+
export declare class GitHubModelsProvider implements ILLMProvider {
|
|
35
|
+
private readonly logger;
|
|
36
|
+
private config;
|
|
37
|
+
private isInitialized;
|
|
38
|
+
private baseUrl;
|
|
39
|
+
private token;
|
|
40
|
+
private inCodespaces;
|
|
41
|
+
private requestCount;
|
|
42
|
+
private currentModel;
|
|
43
|
+
constructor(config?: GitHubModelsProviderConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Check if running in GitHub Codespaces
|
|
46
|
+
*/
|
|
47
|
+
isInCodespaces(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Initialize the GitHub Models provider
|
|
50
|
+
*/
|
|
51
|
+
initialize(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Complete a prompt using GitHub Models
|
|
54
|
+
*/
|
|
55
|
+
complete(options: LLMCompletionOptions): Promise<LLMCompletionResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Stream a completion using GitHub Models
|
|
58
|
+
*/
|
|
59
|
+
streamComplete(options: LLMCompletionOptions): AsyncIterableIterator<LLMStreamEvent>;
|
|
60
|
+
/**
|
|
61
|
+
* Generate embeddings (not supported by GitHub Models)
|
|
62
|
+
*/
|
|
63
|
+
embed(options: LLMEmbeddingOptions): Promise<LLMEmbeddingResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Count tokens in text (approximate)
|
|
66
|
+
*/
|
|
67
|
+
countTokens(options: LLMTokenCountOptions): Promise<number>;
|
|
68
|
+
/**
|
|
69
|
+
* Health check - verify API access
|
|
70
|
+
*/
|
|
71
|
+
healthCheck(): Promise<LLMHealthStatus>;
|
|
72
|
+
/**
|
|
73
|
+
* Get provider metadata
|
|
74
|
+
*/
|
|
75
|
+
getMetadata(): LLMProviderMetadata;
|
|
76
|
+
/**
|
|
77
|
+
* Shutdown the provider
|
|
78
|
+
*/
|
|
79
|
+
shutdown(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Track cost for a request
|
|
82
|
+
*/
|
|
83
|
+
trackCost(usage: LLMCompletionResponse['usage']): number;
|
|
84
|
+
/**
|
|
85
|
+
* Set the current model for subsequent requests
|
|
86
|
+
*/
|
|
87
|
+
setModel(model: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Get current model
|
|
90
|
+
*/
|
|
91
|
+
getCurrentModel(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Get list of available models
|
|
94
|
+
*/
|
|
95
|
+
getAvailableModels(): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Validate GitHub token
|
|
98
|
+
*/
|
|
99
|
+
private validateToken;
|
|
100
|
+
/**
|
|
101
|
+
* Build messages array from options
|
|
102
|
+
*/
|
|
103
|
+
private buildMessages;
|
|
104
|
+
/**
|
|
105
|
+
* Map OpenAI finish reason to Claude format
|
|
106
|
+
*/
|
|
107
|
+
private mapFinishReason;
|
|
108
|
+
/**
|
|
109
|
+
* Estimate token count (approximate: 1 token ≈ 4 characters)
|
|
110
|
+
*/
|
|
111
|
+
private estimateTokens;
|
|
112
|
+
/**
|
|
113
|
+
* Ensure provider is initialized
|
|
114
|
+
*/
|
|
115
|
+
private ensureInitialized;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=GitHubModelsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubModelsProvider.d.ts","sourceRoot":"","sources":["../../src/providers/GitHubModelsProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB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