@openhoo/hoopilot 0.7.4 → 0.8.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 +17 -3
- package/dist/cli.js +805 -34
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +2017 -1240
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +2012 -1240
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -126,10 +126,16 @@ interface RequestObservation {
|
|
|
126
126
|
/** One quota category (chat, completions, or premium_interactions/credits). */
|
|
127
127
|
interface CopilotQuota {
|
|
128
128
|
entitlement?: number;
|
|
129
|
+
hasQuota?: boolean;
|
|
129
130
|
overageCount?: number;
|
|
131
|
+
overageEntitlement?: number;
|
|
130
132
|
overagePermitted?: boolean;
|
|
131
133
|
percentRemaining?: number;
|
|
134
|
+
quotaId?: string;
|
|
135
|
+
quotaResetAt?: string;
|
|
132
136
|
remaining?: number;
|
|
137
|
+
timestampUtc?: string;
|
|
138
|
+
tokenBasedBilling?: boolean;
|
|
133
139
|
unlimited?: boolean;
|
|
134
140
|
used?: number;
|
|
135
141
|
}
|
|
@@ -165,6 +171,18 @@ interface MetricsSnapshot {
|
|
|
165
171
|
uptimeSeconds: number;
|
|
166
172
|
}
|
|
167
173
|
|
|
174
|
+
interface AnthropicStreamOptions {
|
|
175
|
+
model: string;
|
|
176
|
+
messageId?: string;
|
|
177
|
+
}
|
|
178
|
+
declare class AnthropicCompatibilityError extends Error {
|
|
179
|
+
constructor(message: string);
|
|
180
|
+
}
|
|
181
|
+
declare function anthropicMessagesToResponsesRequest(request: JsonObject): JsonObject;
|
|
182
|
+
declare function responsesResponseToAnthropicMessage(response: JsonObject, fallbackModel: string): JsonObject;
|
|
183
|
+
declare function responsesStreamToAnthropicStream(stream: ReadableStream<Uint8Array>, options: AnthropicStreamOptions): ReadableStream<Uint8Array>;
|
|
184
|
+
declare function estimateAnthropicMessageTokens(request: JsonObject): JsonObject;
|
|
185
|
+
|
|
168
186
|
declare class CopilotAuthError extends Error {
|
|
169
187
|
constructor(message: string);
|
|
170
188
|
}
|
|
@@ -279,4 +297,4 @@ declare function extractTokenUsage(usage: unknown): TokenUsage | undefined;
|
|
|
279
297
|
declare function createHoopilotHandler(options?: HoopilotServerOptions): (request: Request) => Promise<Response>;
|
|
280
298
|
declare function startHoopilotServer(options?: HoopilotServerOptions): StartedHoopilotServer;
|
|
281
299
|
|
|
282
|
-
export { 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 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, applyCopilotHeaders, applyGithubApiHeaders, authStorePath, chatCompletionToCompletion, chatCompletionToResponse, completionStreamFromChatStream, completionsRequestToChatCompletion, createHoopilotHandler, createHoopilotLogger, extractTokenUsage, fallbackModels, githubCopilotDeviceLogin, noopLogger, normalizeChatCompletionRequest, normalizeCopilotUsage, normalizeModelsResponse, normalizeRequestedModel, observeResponseUsage, parseLogFormat, parseLogLevel, readStoredCopilotAuth, responsesRequestToChatCompletion, responsesStreamFromChatStream, startHoopilotServer, writeStoredCopilotAuth };
|
|
300
|
+
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 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, readStoredCopilotAuth, responsesRequestToChatCompletion, responsesResponseToAnthropicMessage, responsesStreamFromChatStream, responsesStreamToAnthropicStream, startHoopilotServer, writeStoredCopilotAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -126,10 +126,16 @@ interface RequestObservation {
|
|
|
126
126
|
/** One quota category (chat, completions, or premium_interactions/credits). */
|
|
127
127
|
interface CopilotQuota {
|
|
128
128
|
entitlement?: number;
|
|
129
|
+
hasQuota?: boolean;
|
|
129
130
|
overageCount?: number;
|
|
131
|
+
overageEntitlement?: number;
|
|
130
132
|
overagePermitted?: boolean;
|
|
131
133
|
percentRemaining?: number;
|
|
134
|
+
quotaId?: string;
|
|
135
|
+
quotaResetAt?: string;
|
|
132
136
|
remaining?: number;
|
|
137
|
+
timestampUtc?: string;
|
|
138
|
+
tokenBasedBilling?: boolean;
|
|
133
139
|
unlimited?: boolean;
|
|
134
140
|
used?: number;
|
|
135
141
|
}
|
|
@@ -165,6 +171,18 @@ interface MetricsSnapshot {
|
|
|
165
171
|
uptimeSeconds: number;
|
|
166
172
|
}
|
|
167
173
|
|
|
174
|
+
interface AnthropicStreamOptions {
|
|
175
|
+
model: string;
|
|
176
|
+
messageId?: string;
|
|
177
|
+
}
|
|
178
|
+
declare class AnthropicCompatibilityError extends Error {
|
|
179
|
+
constructor(message: string);
|
|
180
|
+
}
|
|
181
|
+
declare function anthropicMessagesToResponsesRequest(request: JsonObject): JsonObject;
|
|
182
|
+
declare function responsesResponseToAnthropicMessage(response: JsonObject, fallbackModel: string): JsonObject;
|
|
183
|
+
declare function responsesStreamToAnthropicStream(stream: ReadableStream<Uint8Array>, options: AnthropicStreamOptions): ReadableStream<Uint8Array>;
|
|
184
|
+
declare function estimateAnthropicMessageTokens(request: JsonObject): JsonObject;
|
|
185
|
+
|
|
168
186
|
declare class CopilotAuthError extends Error {
|
|
169
187
|
constructor(message: string);
|
|
170
188
|
}
|
|
@@ -279,4 +297,4 @@ declare function extractTokenUsage(usage: unknown): TokenUsage | undefined;
|
|
|
279
297
|
declare function createHoopilotHandler(options?: HoopilotServerOptions): (request: Request) => Promise<Response>;
|
|
280
298
|
declare function startHoopilotServer(options?: HoopilotServerOptions): StartedHoopilotServer;
|
|
281
299
|
|
|
282
|
-
export { 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 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, applyCopilotHeaders, applyGithubApiHeaders, authStorePath, chatCompletionToCompletion, chatCompletionToResponse, completionStreamFromChatStream, completionsRequestToChatCompletion, createHoopilotHandler, createHoopilotLogger, extractTokenUsage, fallbackModels, githubCopilotDeviceLogin, noopLogger, normalizeChatCompletionRequest, normalizeCopilotUsage, normalizeModelsResponse, normalizeRequestedModel, observeResponseUsage, parseLogFormat, parseLogLevel, readStoredCopilotAuth, responsesRequestToChatCompletion, responsesStreamFromChatStream, startHoopilotServer, writeStoredCopilotAuth };
|
|
300
|
+
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 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, readStoredCopilotAuth, responsesRequestToChatCompletion, responsesResponseToAnthropicMessage, responsesStreamFromChatStream, responsesStreamToAnthropicStream, startHoopilotServer, writeStoredCopilotAuth };
|