@openhoo/hoopilot 1.3.0 → 2.1.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.
- package/README.md +67 -23
- package/dist/{chunk-JU6F5L34.js → chunk-6ALEIJJM.js} +82 -20
- package/dist/chunk-6ALEIJJM.js.map +1 -0
- package/dist/cli.js +394 -403
- package/dist/cli.js.map +1 -1
- package/dist/codexx.js +1 -1
- package/dist/index.d.ts +20 -6
- package/dist/index.js +410 -354
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-JU6F5L34.js.map +0 -1
- package/dist/index.cjs +0 -4653
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -388
package/dist/index.d.cts
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
/** Content-Type for the Prometheus text exposition format (version 0.0.4). */
|
|
2
|
-
declare const PROMETHEUS_CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
|
|
3
|
-
/**
|
|
4
|
-
* In-process metrics for the running proxy. Counters are monotonic for the life
|
|
5
|
-
* of the process and reset on restart, which Prometheus handles natively. The
|
|
6
|
-
* registry is intentionally allocation-light and synchronous; the single-
|
|
7
|
-
* threaded event loop makes its mutations atomic with respect to each request.
|
|
8
|
-
*/
|
|
9
|
-
declare class MetricsRegistry {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(options?: {
|
|
12
|
-
now?: () => number;
|
|
13
|
-
});
|
|
14
|
-
/** Mark a request as started; pair with exactly one {@link observe}. */
|
|
15
|
-
startRequest(): void;
|
|
16
|
-
/** Record a completed request and clear its in-flight slot. */
|
|
17
|
-
observe(observation: RequestObservation): void;
|
|
18
|
-
/**
|
|
19
|
-
* Record whether one upstream completion reported token usage. `missing`
|
|
20
|
-
* counts responses that carried no usage object — most often streamed Chat
|
|
21
|
-
* Completions sent without `stream_options: {"include_usage": true}` — so a
|
|
22
|
-
* rising miss rate flags clients whose token usage is going unaccounted.
|
|
23
|
-
*/
|
|
24
|
-
recordTokenExtraction(extracted: boolean): void;
|
|
25
|
-
/** Accumulate token counts for a model from one upstream completion. */
|
|
26
|
-
recordTokens(model: string, usage: TokenUsage): void;
|
|
27
|
-
/** Record one upstream Copilot call and whether it succeeded. */
|
|
28
|
-
recordUpstream(path: string, ok: boolean): void;
|
|
29
|
-
/** Store the latest Copilot quota so /metrics can expose it as gauges. */
|
|
30
|
-
recordCopilotQuota(usage: CopilotUsage): void;
|
|
31
|
-
/**
|
|
32
|
-
* Store the latest GitHub REST rate-limit budget, keyed by its resource bucket.
|
|
33
|
-
* A no-op when `rateLimit` is undefined (the response carried no rate-limit
|
|
34
|
-
* headers) so callers can pass {@link parseRateLimitHeaders} output directly.
|
|
35
|
-
*/
|
|
36
|
-
recordGithubRateLimit(rateLimit: GithubRateLimit | undefined): void;
|
|
37
|
-
/** A JSON-friendly view of the current counters. */
|
|
38
|
-
snapshot(now?: () => number): MetricsSnapshot;
|
|
39
|
-
/** Render the Prometheus text exposition format (version 0.0.4). */
|
|
40
|
-
renderPrometheus(now?: () => number): string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Tee `response`'s body so the client receives an unchanged copy while a
|
|
44
|
-
* background reader extracts token usage. Returns a new Response carrying the
|
|
45
|
-
* client-facing branch and the original status/headers. Usage extraction never
|
|
46
|
-
* throws into the client stream: a parse failure or an aborted client simply
|
|
47
|
-
* yields no usage. When the body is absent the response is returned untouched.
|
|
48
|
-
*
|
|
49
|
-
* Pass the request's `signal` so a client disconnect cancels the observer
|
|
50
|
-
* branch; combined with the runtime cancelling the client branch, that releases
|
|
51
|
-
* the shared upstream connection instead of draining it in the background.
|
|
52
|
-
*/
|
|
53
|
-
declare function observeResponseUsage(response: Response, fallbackModel: string, onUsage: (model: string, usage: TokenUsage) => void, signal?: AbortSignal, onOutcome?: (extracted: boolean) => void): Response;
|
|
54
|
-
|
|
55
|
-
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
56
|
-
interface Logger {
|
|
57
|
-
info(message: string): void;
|
|
58
|
-
warn(message: string): void;
|
|
59
|
-
error(message: string): void;
|
|
60
|
-
}
|
|
61
|
-
type LogFields = Record<string, unknown>;
|
|
62
|
-
type LogFormat = "json" | "pretty";
|
|
63
|
-
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent";
|
|
64
|
-
type StreamingProxyMode = "auto" | "buffer" | "live";
|
|
65
|
-
interface LogMethod {
|
|
66
|
-
(message: string): void;
|
|
67
|
-
(fields: LogFields, message: string): void;
|
|
68
|
-
}
|
|
69
|
-
interface HoopilotLogger {
|
|
70
|
-
child(bindings: LogFields): HoopilotLogger;
|
|
71
|
-
debug: LogMethod;
|
|
72
|
-
error: LogMethod;
|
|
73
|
-
fatal: LogMethod;
|
|
74
|
-
info: LogMethod;
|
|
75
|
-
trace: LogMethod;
|
|
76
|
-
warn: LogMethod;
|
|
77
|
-
}
|
|
78
|
-
interface HoopilotLoggerOptions {
|
|
79
|
-
base?: LogFields;
|
|
80
|
-
colorize?: boolean;
|
|
81
|
-
env?: NodeJS.ProcessEnv;
|
|
82
|
-
format?: LogFormat | string;
|
|
83
|
-
level?: LogLevel | string;
|
|
84
|
-
stream?: {
|
|
85
|
-
write(message: string): unknown;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
interface CopilotAuthOptions {
|
|
89
|
-
authStorePath?: string;
|
|
90
|
-
copilotApiBaseUrl?: string;
|
|
91
|
-
env?: NodeJS.ProcessEnv;
|
|
92
|
-
fetch?: FetchLike;
|
|
93
|
-
githubApiBaseUrl?: string;
|
|
94
|
-
}
|
|
95
|
-
interface CopilotAccess {
|
|
96
|
-
apiBaseUrl: string;
|
|
97
|
-
expiresAtMs: number;
|
|
98
|
-
source: "github-copilot-oauth";
|
|
99
|
-
token: string;
|
|
100
|
-
}
|
|
101
|
-
interface HoopilotServerOptions extends CopilotAuthOptions {
|
|
102
|
-
allowUnauthenticated?: boolean;
|
|
103
|
-
apiKey?: string;
|
|
104
|
-
host?: string;
|
|
105
|
-
logger?: HoopilotLogger;
|
|
106
|
-
logFormat?: LogFormat | string;
|
|
107
|
-
logLevel?: LogLevel | string;
|
|
108
|
-
metrics?: MetricsRegistry;
|
|
109
|
-
port?: number;
|
|
110
|
-
streamingProxyMode?: StreamingProxyMode | string;
|
|
111
|
-
}
|
|
112
|
-
interface StartedHoopilotServer {
|
|
113
|
-
server: Bun.Server<undefined>;
|
|
114
|
-
url: string;
|
|
115
|
-
}
|
|
116
|
-
type JsonObject = Record<string, unknown>;
|
|
117
|
-
/** Normalized token usage extracted from an upstream OpenAI/Copilot response. */
|
|
118
|
-
interface TokenUsage {
|
|
119
|
-
cachedTokens?: number;
|
|
120
|
-
completionTokens: number;
|
|
121
|
-
promptTokens: number;
|
|
122
|
-
reasoningTokens?: number;
|
|
123
|
-
totalTokens: number;
|
|
124
|
-
}
|
|
125
|
-
/** Per-model token totals accumulated by the metrics registry. */
|
|
126
|
-
interface ModelTokenTotals {
|
|
127
|
-
cached: number;
|
|
128
|
-
completion: number;
|
|
129
|
-
prompt: number;
|
|
130
|
-
reasoning: number;
|
|
131
|
-
requests: number;
|
|
132
|
-
total: number;
|
|
133
|
-
}
|
|
134
|
-
/** A single completed request's facts, recorded into the metrics registry. */
|
|
135
|
-
interface RequestObservation {
|
|
136
|
-
durationMs: number;
|
|
137
|
-
method: string;
|
|
138
|
-
route: string;
|
|
139
|
-
status: number;
|
|
140
|
-
}
|
|
141
|
-
/** One quota category (chat, completions, or premium_interactions/credits). */
|
|
142
|
-
interface CopilotQuota {
|
|
143
|
-
entitlement?: number;
|
|
144
|
-
hasQuota?: boolean;
|
|
145
|
-
overageCount?: number;
|
|
146
|
-
overageEntitlement?: number;
|
|
147
|
-
overagePermitted?: boolean;
|
|
148
|
-
percentRemaining?: number;
|
|
149
|
-
quotaId?: string;
|
|
150
|
-
quotaResetAt?: string;
|
|
151
|
-
remaining?: number;
|
|
152
|
-
timestampUtc?: string;
|
|
153
|
-
tokenBasedBilling?: boolean;
|
|
154
|
-
unlimited?: boolean;
|
|
155
|
-
used?: number;
|
|
156
|
-
}
|
|
157
|
-
/** A GitHub Copilot account's plan and quota snapshot. */
|
|
158
|
-
interface CopilotUsage {
|
|
159
|
-
accessTypeSku?: string;
|
|
160
|
-
chatEnabled?: boolean;
|
|
161
|
-
plan?: string;
|
|
162
|
-
quotaResetDate?: string;
|
|
163
|
-
quotas: Record<string, CopilotQuota>;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* GitHub REST API rate-limit budget parsed from the `x-ratelimit-*` headers that
|
|
167
|
-
* `api.github.com` returns on every response. Hoopilot reads these off the
|
|
168
|
-
* `copilot_internal/user` quota call it already makes, so the proxy's GitHub API
|
|
169
|
-
* usage is visible without spending an extra request.
|
|
170
|
-
*/
|
|
171
|
-
interface GithubRateLimit {
|
|
172
|
-
/** `x-ratelimit-resource` — the bucket the request counted against (e.g. `core`). */
|
|
173
|
-
resource: string;
|
|
174
|
-
/** `x-ratelimit-limit` — maximum requests allowed in the current window. */
|
|
175
|
-
limit?: number;
|
|
176
|
-
/** `x-ratelimit-remaining` — requests left in the current window. */
|
|
177
|
-
remaining?: number;
|
|
178
|
-
/** `x-ratelimit-used` — requests already spent in the current window. */
|
|
179
|
-
used?: number;
|
|
180
|
-
/** `x-ratelimit-reset` — Unix epoch seconds when the window resets. */
|
|
181
|
-
resetEpochSeconds?: number;
|
|
182
|
-
/** `retry-after` — seconds to wait, present on 429 / secondary-limit responses. */
|
|
183
|
-
retryAfterSeconds?: number;
|
|
184
|
-
/** Wall-clock epoch ms when these values were observed. */
|
|
185
|
-
observedAtMs: number;
|
|
186
|
-
}
|
|
187
|
-
/** JSON view of one GitHub rate-limit resource, as rendered into a snapshot. */
|
|
188
|
-
interface GithubRateLimitSnapshot {
|
|
189
|
-
limit?: number;
|
|
190
|
-
observedAt: string;
|
|
191
|
-
remaining?: number;
|
|
192
|
-
resetAt?: string;
|
|
193
|
-
retryAfterSeconds?: number;
|
|
194
|
-
used?: number;
|
|
195
|
-
}
|
|
196
|
-
/** Request-latency summary for one route, in milliseconds. */
|
|
197
|
-
interface RouteLatency {
|
|
198
|
-
avgMs: number;
|
|
199
|
-
count: number;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Aggregate request-latency summary derived from the duration histogram. `avgMs`
|
|
203
|
-
* is exact; the percentiles are estimated from the histogram buckets (Prometheus-
|
|
204
|
-
* style linear interpolation), so they are approximate.
|
|
205
|
-
*/
|
|
206
|
-
interface LatencySnapshot {
|
|
207
|
-
avgMs: number;
|
|
208
|
-
byRoute: Record<string, RouteLatency>;
|
|
209
|
-
count: number;
|
|
210
|
-
p50Ms: number;
|
|
211
|
-
p95Ms: number;
|
|
212
|
-
}
|
|
213
|
-
/** A point-in-time JSON view of the in-process metrics. */
|
|
214
|
-
interface MetricsSnapshot {
|
|
215
|
-
githubRateLimit: Record<string, GithubRateLimitSnapshot>;
|
|
216
|
-
inFlight: number;
|
|
217
|
-
latency: LatencySnapshot;
|
|
218
|
-
requests: {
|
|
219
|
-
byRoute: Record<string, number>;
|
|
220
|
-
byStatus: Record<string, number>;
|
|
221
|
-
total: number;
|
|
222
|
-
};
|
|
223
|
-
startedAt: string;
|
|
224
|
-
tokens: {
|
|
225
|
-
byModel: Record<string, ModelTokenTotals>;
|
|
226
|
-
cached: number;
|
|
227
|
-
completion: number;
|
|
228
|
-
extraction: {
|
|
229
|
-
extracted: number;
|
|
230
|
-
missing: number;
|
|
231
|
-
};
|
|
232
|
-
prompt: number;
|
|
233
|
-
reasoning: number;
|
|
234
|
-
total: number;
|
|
235
|
-
};
|
|
236
|
-
upstream: {
|
|
237
|
-
errors: number;
|
|
238
|
-
total: number;
|
|
239
|
-
};
|
|
240
|
-
uptimeSeconds: number;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
interface AnthropicStreamOptions {
|
|
244
|
-
model: string;
|
|
245
|
-
messageId?: string;
|
|
246
|
-
}
|
|
247
|
-
declare class AnthropicCompatibilityError extends Error {
|
|
248
|
-
constructor(message: string);
|
|
249
|
-
}
|
|
250
|
-
declare function anthropicMessagesToResponsesRequest(request: JsonObject): JsonObject;
|
|
251
|
-
declare function responsesResponseToAnthropicMessage(response: JsonObject, fallbackModel: string): JsonObject;
|
|
252
|
-
declare function responsesStreamToAnthropicStream(stream: ReadableStream<Uint8Array>, options: AnthropicStreamOptions): ReadableStream<Uint8Array>;
|
|
253
|
-
declare function estimateAnthropicMessageTokens(request: JsonObject): JsonObject;
|
|
254
|
-
|
|
255
|
-
declare class CopilotAuthError extends Error {
|
|
256
|
-
constructor(message: string);
|
|
257
|
-
}
|
|
258
|
-
declare class CopilotAuth {
|
|
259
|
-
#private;
|
|
260
|
-
constructor(options?: CopilotAuthOptions);
|
|
261
|
-
getAccess(): Promise<CopilotAccess>;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
interface StoredCopilotAuth {
|
|
265
|
-
apiBaseUrl?: string;
|
|
266
|
-
createdAt?: string;
|
|
267
|
-
githubDomain?: string;
|
|
268
|
-
source?: string;
|
|
269
|
-
token: string;
|
|
270
|
-
}
|
|
271
|
-
declare function authStorePath(env?: NodeJS.ProcessEnv): string;
|
|
272
|
-
declare function readStoredCopilotAuth(path?: string): StoredCopilotAuth | undefined;
|
|
273
|
-
declare function writeStoredCopilotAuth(auth: StoredCopilotAuth, path?: string): void;
|
|
274
|
-
|
|
275
|
-
/** Default GitHub REST host that serves the `copilot_internal/user` quota route. */
|
|
276
|
-
declare const DEFAULT_GITHUB_API_BASE_URL = "https://api.github.com";
|
|
277
|
-
/**
|
|
278
|
-
* API version sent to the GitHub `copilot_internal` endpoints. This is a
|
|
279
|
-
* different surface from the Copilot completions API (`x-github-api-version`
|
|
280
|
-
* `2026-06-01`), so it is pinned separately and bumped independently.
|
|
281
|
-
*/
|
|
282
|
-
declare const COPILOT_USAGE_API_VERSION = "2025-04-01";
|
|
283
|
-
/**
|
|
284
|
-
* Set the GitHub Copilot API request headers on `headers`, leaving any
|
|
285
|
-
* caller-provided `accept` intact. Single source of truth for the pinned
|
|
286
|
-
* integration id, editor/plugin versions, and API version so the proxy client
|
|
287
|
-
* and the login-time verification call cannot drift apart.
|
|
288
|
-
*/
|
|
289
|
-
declare function applyCopilotHeaders(headers: Headers, token: string): Headers;
|
|
290
|
-
/**
|
|
291
|
-
* Set headers for the GitHub REST `copilot_internal/user` quota call. This host
|
|
292
|
-
* is `api.github.com` (not the Copilot API host) and expects the `token` auth
|
|
293
|
-
* scheme with the raw stored OAuth token — not the `Bearer` scheme used by the
|
|
294
|
-
* Copilot completion endpoints.
|
|
295
|
-
*/
|
|
296
|
-
declare function applyGithubApiHeaders(headers: Headers, token: string): Headers;
|
|
297
|
-
/**
|
|
298
|
-
* Parse the GitHub REST `x-ratelimit-*` headers (plus `retry-after`) off a
|
|
299
|
-
* response into a {@link GithubRateLimit}. `api.github.com` returns these on
|
|
300
|
-
* every reply, so the proxy reads its GitHub API budget from the quota call it
|
|
301
|
-
* already makes — no extra request is spent. Returns undefined when the response
|
|
302
|
-
* carries no rate-limit headers (for example the Copilot completion host, which
|
|
303
|
-
* does not emit them today) so callers record nothing rather than a phantom row.
|
|
304
|
-
*/
|
|
305
|
-
declare function parseRateLimitHeaders(headers: Headers, nowMs?: number): GithubRateLimit | undefined;
|
|
306
|
-
declare class CopilotClient {
|
|
307
|
-
#private;
|
|
308
|
-
constructor(options?: CopilotAuthOptions);
|
|
309
|
-
/**
|
|
310
|
-
* Fetch the Copilot account's quota / premium-request usage from the GitHub
|
|
311
|
-
* REST `copilot_internal/user` endpoint. The stored device-flow OAuth token is
|
|
312
|
-
* accepted directly here — no Copilot token exchange is required to read quota.
|
|
313
|
-
*/
|
|
314
|
-
usage(signal?: AbortSignal): Promise<Response>;
|
|
315
|
-
chatCompletions(body: JsonObject, signal?: AbortSignal): Promise<Response>;
|
|
316
|
-
responses(body: string, signal?: AbortSignal): Promise<Response>;
|
|
317
|
-
models(signal?: AbortSignal): Promise<Response>;
|
|
318
|
-
fetchCopilot(path: string, init: RequestInit): Promise<Response>;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Normalize a `copilot_internal/user` response into {@link CopilotUsage}. Handles
|
|
322
|
-
* both the paid-plan shape (`quota_snapshots.{chat,completions,premium_interactions}`)
|
|
323
|
-
* and the free-plan shape (`limited_user_quotas` remaining + `monthly_quotas`
|
|
324
|
-
* allowance). `remaining` may be fractional and negative under permitted overage,
|
|
325
|
-
* so `used` is derived as `max(0, entitlement - remaining)`.
|
|
326
|
-
*/
|
|
327
|
-
declare function normalizeCopilotUsage(body: unknown): CopilotUsage;
|
|
328
|
-
|
|
329
|
-
interface GithubCopilotDeviceLoginOptions {
|
|
330
|
-
clientId?: string;
|
|
331
|
-
domain?: string;
|
|
332
|
-
env?: NodeJS.ProcessEnv;
|
|
333
|
-
fetch?: FetchLike;
|
|
334
|
-
logger?: Logger;
|
|
335
|
-
openBrowser?: (url: string) => void | Promise<void>;
|
|
336
|
-
sleep?: (ms: number) => Promise<void>;
|
|
337
|
-
}
|
|
338
|
-
interface GithubCopilotDeviceLoginResult {
|
|
339
|
-
domain: string;
|
|
340
|
-
token: string;
|
|
341
|
-
}
|
|
342
|
-
declare function githubCopilotDeviceLogin(options?: GithubCopilotDeviceLoginOptions): Promise<GithubCopilotDeviceLoginResult>;
|
|
343
|
-
|
|
344
|
-
declare const DEFAULT_LOG_FORMAT: LogFormat;
|
|
345
|
-
declare const DEFAULT_LOG_LEVEL: LogLevel;
|
|
346
|
-
declare const noopLogger: HoopilotLogger;
|
|
347
|
-
declare function createHoopilotLogger(options?: HoopilotLoggerOptions): HoopilotLogger;
|
|
348
|
-
declare function parseLogFormat(value: string | undefined): LogFormat;
|
|
349
|
-
declare function parseLogLevel(value: string | undefined): LogLevel;
|
|
350
|
-
|
|
351
|
-
declare const DEFAULT_MODEL = "gpt-4.1";
|
|
352
|
-
interface ResponseStreamOptions {
|
|
353
|
-
model: string;
|
|
354
|
-
responseId?: string;
|
|
355
|
-
}
|
|
356
|
-
declare function responsesRequestToChatCompletion(request: JsonObject): JsonObject;
|
|
357
|
-
declare function normalizeChatCompletionRequest(request: JsonObject): JsonObject;
|
|
358
|
-
declare function completionsRequestToChatCompletion(request: JsonObject): JsonObject;
|
|
359
|
-
declare function normalizeRequestedModel(model: unknown): string;
|
|
360
|
-
declare function chatCompletionToResponse(completion: JsonObject, responseId?: string): JsonObject;
|
|
361
|
-
/**
|
|
362
|
-
* Reduce a Copilot `/responses` result into the `{ output }` document Codex's
|
|
363
|
-
* remote-compaction client (`POST /responses/compact`) deserializes. Codex keeps
|
|
364
|
-
* only assistant/user message items from `output` and discards everything else,
|
|
365
|
-
* so a Responses `output` array passes through verbatim; when the upstream only
|
|
366
|
-
* exposes `output_text` (or, for a stream it did not honor `stream: false` on,
|
|
367
|
-
* `output_text` deltas) a single assistant message is synthesized instead. The
|
|
368
|
-
* input may be a unary JSON body or an SSE stream, so both framings are handled.
|
|
369
|
-
*/
|
|
370
|
-
declare function responsesCompactionResult(upstreamText: string, isSse: boolean): JsonObject;
|
|
371
|
-
declare function chatCompletionToCompletion(completion: JsonObject): JsonObject;
|
|
372
|
-
declare function completionStreamFromChatStream(chatStream: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
|
|
373
|
-
declare function normalizeModelsResponse(upstream: unknown): JsonObject;
|
|
374
|
-
declare function fallbackModels(): Array<JsonObject>;
|
|
375
|
-
declare function responsesStreamFromChatStream(chatStream: ReadableStream<Uint8Array>, options: ResponseStreamOptions): ReadableStream<Uint8Array>;
|
|
376
|
-
/**
|
|
377
|
-
* Normalize an upstream `usage` object into {@link TokenUsage}. Accepts both the
|
|
378
|
-
* Chat Completions shape (`prompt_tokens`/`completion_tokens`) and the Responses
|
|
379
|
-
* shape (`input_tokens`/`output_tokens`), and pulls nested reasoning/cached
|
|
380
|
-
* details when present. Returns undefined when no token counts are available so
|
|
381
|
-
* callers can distinguish "no usage reported" from "zero tokens".
|
|
382
|
-
*/
|
|
383
|
-
declare function extractTokenUsage(usage: unknown): TokenUsage | undefined;
|
|
384
|
-
|
|
385
|
-
declare function createHoopilotHandler(options?: HoopilotServerOptions): (request: Request) => Promise<Response>;
|
|
386
|
-
declare function startHoopilotServer(options?: HoopilotServerOptions): StartedHoopilotServer;
|
|
387
|
-
|
|
388
|
-
export { AnthropicCompatibilityError, COPILOT_USAGE_API_VERSION, type CopilotAccess, CopilotAuth, CopilotAuthError, type CopilotAuthOptions, CopilotClient, type CopilotQuota, type CopilotUsage, DEFAULT_GITHUB_API_BASE_URL, DEFAULT_LOG_FORMAT, DEFAULT_LOG_LEVEL, DEFAULT_MODEL, type FetchLike, type GithubRateLimit, type GithubRateLimitSnapshot, type HoopilotLogger, type HoopilotLoggerOptions, type HoopilotServerOptions, type JsonObject, type LogFields, type LogFormat, type LogLevel, type LogMethod, type Logger, MetricsRegistry, type MetricsSnapshot, type ModelTokenTotals, PROMETHEUS_CONTENT_TYPE, type RequestObservation, type StartedHoopilotServer, type TokenUsage, anthropicMessagesToResponsesRequest, applyCopilotHeaders, applyGithubApiHeaders, authStorePath, chatCompletionToCompletion, chatCompletionToResponse, completionStreamFromChatStream, completionsRequestToChatCompletion, createHoopilotHandler, createHoopilotLogger, estimateAnthropicMessageTokens, extractTokenUsage, fallbackModels, githubCopilotDeviceLogin, noopLogger, normalizeChatCompletionRequest, normalizeCopilotUsage, normalizeModelsResponse, normalizeRequestedModel, observeResponseUsage, parseLogFormat, parseLogLevel, parseRateLimitHeaders, readStoredCopilotAuth, responsesCompactionResult, responsesRequestToChatCompletion, responsesResponseToAnthropicMessage, responsesStreamFromChatStream, responsesStreamToAnthropicStream, startHoopilotServer, writeStoredCopilotAuth };
|