@kenkaiiii/gg-core 6.4.0 → 7.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 +20 -9
- package/dist/{chunk-VREIRQMU.js → chunk-BMRRMRUO.js} +19 -14
- package/dist/chunk-BMRRMRUO.js.map +1 -0
- package/dist/{chunk-GXOFTHM5.js → chunk-DNNLWE2F.js} +7 -2
- package/dist/chunk-DNNLWE2F.js.map +1 -0
- package/dist/index.cjs +36 -538
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -182
- package/dist/index.d.ts +6 -182
- package/dist/index.js +6 -510
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +3 -2
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.js +2 -2
- package/dist/paths.cjs +7 -1
- package/dist/paths.cjs.map +1 -1
- package/dist/paths.d.cts +4 -2
- package/dist/paths.d.ts +4 -2
- package/dist/paths.js +3 -1
- package/package.json +5 -6
- package/dist/chunk-GXOFTHM5.js.map +0 -1
- package/dist/chunk-VREIRQMU.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModelInfo } from './model-registry.cjs';
|
|
2
2
|
export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, HIDDEN_PROVIDERS, MODELS, ModelBilling, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getListedModels, getMaxThinkingLevel, getModel, getModelsForProvider, getProviderCatalog, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, isHiddenProvider, isPaidModel, registerRuntimeModels, setProviderCatalog, usesOpenAICodexTransport, withoutPaidTier } from './model-registry.cjs';
|
|
3
3
|
import { ThinkingLevel, Provider } from '@kenkaiiii/gg-ai';
|
|
4
|
-
export { AppPaths, getAppPaths } from './paths.cjs';
|
|
4
|
+
export { AppPaths, configureAppDataDir, getAppPaths } from './paths.cjs';
|
|
5
5
|
|
|
6
6
|
/** gg-ai's OPENROUTER_BASE_URL — where the openrouter transport goes with no override. */
|
|
7
7
|
declare const OPENROUTER_DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
|
|
@@ -867,13 +867,12 @@ declare function generatePKCE(): Promise<{
|
|
|
867
867
|
challenge: string;
|
|
868
868
|
}>;
|
|
869
869
|
|
|
870
|
-
/** The scope that lets
|
|
870
|
+
/** The scope that lets the app use the user's ChatGPT plan. */
|
|
871
871
|
declare const CHATGPT_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
872
872
|
/** Responses API base for ChatGPT plan inference. */
|
|
873
873
|
declare const CHATGPT_PLAN_BASE_URL = "https://api.openai.com/v1";
|
|
874
|
-
/** Where users review and limit what
|
|
874
|
+
/** Where users review and limit what the app may use of their plan. */
|
|
875
875
|
declare const CHATGPT_USAGE_URL = "https://chatgpt.com/settings/usage";
|
|
876
|
-
declare const CHATGPT_PLAN_NOT_ENABLED_MESSAGE = "ChatGPT plan use isn't enabled for GG Coder. Allow Use your ChatGPT plan, or add an OpenAI API key.";
|
|
877
876
|
/** A sign-in that worked but can't be used to bill the user's ChatGPT plan. */
|
|
878
877
|
declare class ChatGPTPlanNotEnabledError extends Error {
|
|
879
878
|
constructor();
|
|
@@ -917,7 +916,7 @@ declare function getChatGPTHostId(file?: string): Promise<string>;
|
|
|
917
916
|
/** Emails of the ChatGPT accounts this machine has signed in with, newest first. */
|
|
918
917
|
declare function savedChatGPTAccounts(file?: string): Promise<string[]>;
|
|
919
918
|
/**
|
|
920
|
-
* Continue with ChatGPT. Registers
|
|
919
|
+
* Continue with ChatGPT. Registers the app for this ChatGPT account on first
|
|
921
920
|
* use (the user names and approves it in the browser), then reuses the issued
|
|
922
921
|
* client ID. Throws {@link ChatGPTPlanNotEnabledError} when the user signed in
|
|
923
922
|
* but didn't allow plan use, and {@link ChatGPTSignInError} when OpenAI refuses
|
|
@@ -952,180 +951,5 @@ declare function verifyIdToken(idToken: string, expected: {
|
|
|
952
951
|
now?: number;
|
|
953
952
|
}): Promise<Record<string, unknown>>;
|
|
954
953
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
* Supports long polling, markdown messages, inline keyboards, and message splitting.
|
|
958
|
-
*/
|
|
959
|
-
interface TelegramConfig {
|
|
960
|
-
botToken: string;
|
|
961
|
-
/** Only accept messages from this Telegram user ID. */
|
|
962
|
-
allowedUserId: number;
|
|
963
|
-
}
|
|
964
|
-
interface TelegramUpdate {
|
|
965
|
-
update_id: number;
|
|
966
|
-
message?: {
|
|
967
|
-
message_id: number;
|
|
968
|
-
from: {
|
|
969
|
-
id: number;
|
|
970
|
-
first_name: string;
|
|
971
|
-
};
|
|
972
|
-
chat: {
|
|
973
|
-
id: number;
|
|
974
|
-
type: string;
|
|
975
|
-
title?: string;
|
|
976
|
-
};
|
|
977
|
-
text?: string;
|
|
978
|
-
voice?: {
|
|
979
|
-
file_id: string;
|
|
980
|
-
duration: number;
|
|
981
|
-
mime_type?: string;
|
|
982
|
-
file_size?: number;
|
|
983
|
-
};
|
|
984
|
-
};
|
|
985
|
-
callback_query?: {
|
|
986
|
-
id: string;
|
|
987
|
-
from: {
|
|
988
|
-
id: number;
|
|
989
|
-
};
|
|
990
|
-
message: {
|
|
991
|
-
chat: {
|
|
992
|
-
id: number;
|
|
993
|
-
};
|
|
994
|
-
};
|
|
995
|
-
data: string;
|
|
996
|
-
};
|
|
997
|
-
my_chat_member?: {
|
|
998
|
-
chat: {
|
|
999
|
-
id: number;
|
|
1000
|
-
type: string;
|
|
1001
|
-
title?: string;
|
|
1002
|
-
};
|
|
1003
|
-
from: {
|
|
1004
|
-
id: number;
|
|
1005
|
-
};
|
|
1006
|
-
new_chat_member: {
|
|
1007
|
-
status: string;
|
|
1008
|
-
};
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
interface InlineButton {
|
|
1012
|
-
text: string;
|
|
1013
|
-
callback_data: string;
|
|
1014
|
-
}
|
|
1015
|
-
/** Incoming message with chat context. */
|
|
1016
|
-
interface TelegramMessage {
|
|
1017
|
-
text: string;
|
|
1018
|
-
chatId: number;
|
|
1019
|
-
chatType: "private" | "group" | "supergroup" | "channel";
|
|
1020
|
-
chatTitle?: string;
|
|
1021
|
-
}
|
|
1022
|
-
/** Incoming voice note with chat context. */
|
|
1023
|
-
interface TelegramVoiceMessage {
|
|
1024
|
-
fileId: string;
|
|
1025
|
-
duration: number;
|
|
1026
|
-
chatId: number;
|
|
1027
|
-
chatType: "private" | "group" | "supergroup" | "channel";
|
|
1028
|
-
chatTitle?: string;
|
|
1029
|
-
}
|
|
1030
|
-
declare class TelegramBot {
|
|
1031
|
-
private token;
|
|
1032
|
-
private allowedUserId;
|
|
1033
|
-
private offset;
|
|
1034
|
-
private running;
|
|
1035
|
-
/** Aborts the in-flight long poll so stop() takes effect immediately. */
|
|
1036
|
-
private pollAbort;
|
|
1037
|
-
private onMessage;
|
|
1038
|
-
private onVoiceMessage;
|
|
1039
|
-
private onCallback;
|
|
1040
|
-
private onBotAdded;
|
|
1041
|
-
private onBotRemoved;
|
|
1042
|
-
constructor(config: TelegramConfig);
|
|
1043
|
-
/** Register handler for incoming text messages. */
|
|
1044
|
-
onText(handler: (msg: TelegramMessage) => void): void;
|
|
1045
|
-
/** Register handler for incoming voice notes. */
|
|
1046
|
-
onVoice(handler: (msg: TelegramVoiceMessage) => void): void;
|
|
1047
|
-
/** Register handler for inline keyboard button presses. */
|
|
1048
|
-
onCallbackQuery(handler: (data: string, chatId: number) => void): void;
|
|
1049
|
-
/** Register handler for when the bot is added to a group. */
|
|
1050
|
-
onAddedToGroup(handler: (chatId: number, chatTitle?: string) => void): void;
|
|
1051
|
-
/** Register handler for when the bot is removed from a group. */
|
|
1052
|
-
onRemovedFromGroup(handler: (chatId: number) => void): void;
|
|
1053
|
-
/** Start long polling. Blocks until stop() is called. */
|
|
1054
|
-
start(): Promise<void>;
|
|
1055
|
-
/** Stop long polling. */
|
|
1056
|
-
stop(): void;
|
|
1057
|
-
/** Send a text message to a specific chat. Converts markdown and splits long messages. */
|
|
1058
|
-
send(chatId: number, text: string, buttons?: InlineButton[][]): Promise<void>;
|
|
1059
|
-
/** Send a plain text message (no markdown parsing) to a specific chat. */
|
|
1060
|
-
sendPlain(chatId: number, text: string): Promise<void>;
|
|
1061
|
-
/** Send a typing indicator to a specific chat. */
|
|
1062
|
-
sendTyping(chatId: number): Promise<void>;
|
|
1063
|
-
/** Get a direct download URL for a Telegram file. */
|
|
1064
|
-
getFileUrl(fileId: string): Promise<string>;
|
|
1065
|
-
private getUpdates;
|
|
1066
|
-
private handleUpdate;
|
|
1067
|
-
private apiCall;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Voice note transcription using local Whisper model.
|
|
1072
|
-
* Uses @huggingface/transformers (pure JS/WASM) — no native deps, no API keys.
|
|
1073
|
-
* Model (~75MB) is downloaded on first use and cached locally.
|
|
1074
|
-
*/
|
|
1075
|
-
/** Optional callback for model download progress. */
|
|
1076
|
-
type ProgressCallback = (info: {
|
|
1077
|
-
status: string;
|
|
1078
|
-
progress?: number;
|
|
1079
|
-
file?: string;
|
|
1080
|
-
}) => void;
|
|
1081
|
-
/** Set a callback to receive model download progress updates. */
|
|
1082
|
-
declare function setProgressCallback(cb: ProgressCallback | null): void;
|
|
1083
|
-
/**
|
|
1084
|
-
* Resample audio from one sample rate to another using linear interpolation.
|
|
1085
|
-
*/
|
|
1086
|
-
declare function resample(audio: Float32Array, fromRate: number, toRate: number): Float32Array;
|
|
1087
|
-
/**
|
|
1088
|
-
* Downmix multi-channel audio to mono by averaging all channels.
|
|
1089
|
-
*/
|
|
1090
|
-
declare function downmixToMono(channelData: Float32Array[]): Float32Array;
|
|
1091
|
-
/**
|
|
1092
|
-
* Decode OGG Opus audio buffer to 16kHz mono PCM Float32Array.
|
|
1093
|
-
*/
|
|
1094
|
-
declare function decodeOggOpus(buffer: Uint8Array): Promise<Float32Array>;
|
|
1095
|
-
/** Whether the model has been loaded already. */
|
|
1096
|
-
declare function isModelLoaded(): boolean;
|
|
1097
|
-
/**
|
|
1098
|
-
* Transcribe a voice message from its Telegram file URL.
|
|
1099
|
-
* Downloads the OGG Opus file, decodes to PCM, and runs Whisper locally.
|
|
1100
|
-
*/
|
|
1101
|
-
declare function transcribeVoice(fileUrl: string): Promise<string>;
|
|
1102
|
-
|
|
1103
|
-
interface AutoUpdateConfig {
|
|
1104
|
-
/** npm package to self-update, e.g. "@kenkaiiii/ggcoder". */
|
|
1105
|
-
packageName: string;
|
|
1106
|
-
/**
|
|
1107
|
-
* Absolute path to this app's update-state.json, or a thunk resolving it.
|
|
1108
|
-
* A thunk keeps path resolution lazy so callers can derive it from
|
|
1109
|
-
* `os.homedir()` without freezing the value at module-load time (which
|
|
1110
|
-
* breaks tests that mock the home directory after import).
|
|
1111
|
-
*/
|
|
1112
|
-
stateFilePath: string | (() => string);
|
|
1113
|
-
/** Builds the in-session "update available" notification. */
|
|
1114
|
-
periodicMessage?: (args: {
|
|
1115
|
-
currentVersion: string;
|
|
1116
|
-
latestVersion: string;
|
|
1117
|
-
updateCommand: string;
|
|
1118
|
-
}) => string;
|
|
1119
|
-
}
|
|
1120
|
-
interface AutoUpdater {
|
|
1121
|
-
checkAndAutoUpdate(currentVersion: string): string | null;
|
|
1122
|
-
getPendingUpdate(currentVersion: string): {
|
|
1123
|
-
latestVersion: string;
|
|
1124
|
-
} | null;
|
|
1125
|
-
startPeriodicUpdateCheck(currentVersion: string, onUpdate: (message: string) => void): void;
|
|
1126
|
-
stopPeriodicUpdateCheck(): void;
|
|
1127
|
-
}
|
|
1128
|
-
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
1129
|
-
|
|
1130
|
-
export { AUTH_PROVIDERS, AuthStorage, CHATGPT_PLAN_BASE_URL, CHATGPT_PLAN_NOT_ENABLED_MESSAGE, CHATGPT_PLAN_SCOPE, CHATGPT_USAGE_URL, CLAUDE_CODE_AUTH_KEY, CLAUDE_CODE_AUTH_MARKER, CLAUDE_CODE_MANIFEST, ChatGPTPlanNotEnabledError, ChatGPTSignInError, DEFAULT_LOCAL_ENDPOINTS, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, GLM_CODING_PLAN_BASE_URL, GLM_CODING_PLAN_KEY, KIMI_CODE_DEFAULT_BASE_URL, KIMI_CODE_KEY, KIMI_CODE_OVERSEAS_BASE_URL, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, MINIMAX_CN_BASE_URL, MINIMAX_GLOBAL_BASE_URL, ModelInfo, NotLoggedInError, OPENAI_CHATGPT_KEY, OPENCODE_CATALOG_URLS, OPENCODE_PROVIDERS, OPENROUTER_DEFAULT_BASE_URL, PLAN_MODE_THINKING_CAP, RETIRED_SIGN_INS, SubscriptionUsageError, TelegramBot, XIAOMI_CREDITS_KEY, XIAOMI_TOKEN_PLAN_BASE_URLS, apiKeyStorageKeys, authPriorityNote, clampThinkingForPlanMode, claudeCodeAuthStatus, claudeCodeBinaryPath, claudeCodeCallbackUrl, claudeCodeConfigDir, claudeCodeEnv, claudeCodeHome, claudeCodePlatformKey, clearClaudeCodeUsage, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, describeAuthMethods, detectKimiCodeBaseUrl, detectMiniMaxBaseUrl, detectXiaomiTokenPlanBaseUrl, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, ensureClaudeCodeBinary, fetchChatGPTPlanModels, fetchSubscriptionUsage, findProbedModel, formatClaudeCodeInstallProgress, formatLocalModelId, formatOpenCodeModelId, generatePKCE, getAuthProvider, getChatGPTHostId, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isClaudeCodeAuthMarker, isKimiCodingEndpoint, isLegacyClaudeOAuth, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, localAuthStorageKey, localModelShortName, log, loginChatGPT, loginClaudeCode, logoutClaudeCode, mergeClaudeCodeRateLimit, oauthStorageKey, ollamaServedContext, openLog, parseCallbackInput, parseLocalModelId, parseOpenCodeCatalog, parseOpenRouterCatalog, pointScale, probeEndpoint, providerStorageKeys, readClaudeCodeUsage, readStoredBaseUrlSync, recordClaudeCodeRateLimit, refreshChatGPTToken, registerLogCleanup, requiredKeyLabel, resample, resolveClaudeCodeBinary, revokeChatGPTSignIn, savedChatGPTAccounts, setProgressCallback, signInWithClaudeCode, signOutOfClaudeCode, storageKeyProvider, toModelInfo, transcribeVoice, verifyIdToken, withFileLock };
|
|
1131
|
-
export type { ApiKeyVariant, AuthMethod, AuthMethodMeta, AuthProviderMeta, AutoUpdateConfig, AutoUpdater, ChatGPTLoginOptions, ClaudeCodeAuthStatus, ClaudeCodeInstallProgress, ClaudeCodeManifest, ClaudeCodePlatformAsset, ClaudeCodeRateLimitInfo, ClaudeCodeRunOptions, ClaudeCodeRuntimeOptions, ClaudeCodeSignInOptions, DiscoverOptions, DiscoveryResult, DualAuthProvider, EnsureClaudeCodeOptions, FetchedSubscriptionUsageProvider, InlineButton, LocalEndpoint, LocalEndpointKind, LocalEndpointProbe, LocalModel, LogLevel, OAuthCredentials, OAuthLoginCallbacks, OpenCodeProvider, ParsedOpenCodeCatalog, ParsedOpenRouterCatalog, PointScale, ProbeOptions, ProgressCallback, RetiredSignIn, SubscriptionUsageProvider, SubscriptionUsageSnapshot, SubscriptionUsageWindow, TelegramConfig, TelegramMessage, TelegramUpdate, TelegramVoiceMessage };
|
|
954
|
+
export { AUTH_PROVIDERS, AuthStorage, CHATGPT_PLAN_BASE_URL, CHATGPT_PLAN_SCOPE, CHATGPT_USAGE_URL, CLAUDE_CODE_AUTH_KEY, CLAUDE_CODE_AUTH_MARKER, CLAUDE_CODE_MANIFEST, ChatGPTPlanNotEnabledError, ChatGPTSignInError, DEFAULT_LOCAL_ENDPOINTS, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, GLM_CODING_PLAN_BASE_URL, GLM_CODING_PLAN_KEY, KIMI_CODE_DEFAULT_BASE_URL, KIMI_CODE_KEY, KIMI_CODE_OVERSEAS_BASE_URL, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, MINIMAX_CN_BASE_URL, MINIMAX_GLOBAL_BASE_URL, ModelInfo, NotLoggedInError, OPENAI_CHATGPT_KEY, OPENCODE_CATALOG_URLS, OPENCODE_PROVIDERS, OPENROUTER_DEFAULT_BASE_URL, PLAN_MODE_THINKING_CAP, RETIRED_SIGN_INS, SubscriptionUsageError, XIAOMI_CREDITS_KEY, XIAOMI_TOKEN_PLAN_BASE_URLS, apiKeyStorageKeys, authPriorityNote, clampThinkingForPlanMode, claudeCodeAuthStatus, claudeCodeBinaryPath, claudeCodeCallbackUrl, claudeCodeConfigDir, claudeCodeEnv, claudeCodeHome, claudeCodePlatformKey, clearClaudeCodeUsage, clearLocalDiscoveryCache, closeLogger, describeAuthMethods, detectKimiCodeBaseUrl, detectMiniMaxBaseUrl, detectXiaomiTokenPlanBaseUrl, discoverLocalModels, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, ensureClaudeCodeBinary, fetchChatGPTPlanModels, fetchSubscriptionUsage, findProbedModel, formatClaudeCodeInstallProgress, formatLocalModelId, formatOpenCodeModelId, generatePKCE, getAuthProvider, getChatGPTHostId, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isClaudeCodeAuthMarker, isKimiCodingEndpoint, isLegacyClaudeOAuth, isLocalModelId, isLoggerOpen, isThinkingLevelSupported, localAuthStorageKey, localModelShortName, log, loginChatGPT, loginClaudeCode, logoutClaudeCode, mergeClaudeCodeRateLimit, oauthStorageKey, ollamaServedContext, openLog, parseCallbackInput, parseLocalModelId, parseOpenCodeCatalog, parseOpenRouterCatalog, pointScale, probeEndpoint, providerStorageKeys, readClaudeCodeUsage, readStoredBaseUrlSync, recordClaudeCodeRateLimit, refreshChatGPTToken, registerLogCleanup, requiredKeyLabel, resolveClaudeCodeBinary, revokeChatGPTSignIn, savedChatGPTAccounts, signInWithClaudeCode, signOutOfClaudeCode, storageKeyProvider, toModelInfo, verifyIdToken, withFileLock };
|
|
955
|
+
export type { ApiKeyVariant, AuthMethod, AuthMethodMeta, AuthProviderMeta, ChatGPTLoginOptions, ClaudeCodeAuthStatus, ClaudeCodeInstallProgress, ClaudeCodeManifest, ClaudeCodePlatformAsset, ClaudeCodeRateLimitInfo, ClaudeCodeRunOptions, ClaudeCodeRuntimeOptions, ClaudeCodeSignInOptions, DiscoverOptions, DiscoveryResult, DualAuthProvider, EnsureClaudeCodeOptions, FetchedSubscriptionUsageProvider, LocalEndpoint, LocalEndpointKind, LocalEndpointProbe, LocalModel, LogLevel, OAuthCredentials, OAuthLoginCallbacks, OpenCodeProvider, ParsedOpenCodeCatalog, ParsedOpenRouterCatalog, PointScale, ProbeOptions, RetiredSignIn, SubscriptionUsageProvider, SubscriptionUsageSnapshot, SubscriptionUsageWindow };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModelInfo } from './model-registry.js';
|
|
2
2
|
export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, HIDDEN_PROVIDERS, MODELS, ModelBilling, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getListedModels, getMaxThinkingLevel, getModel, getModelsForProvider, getProviderCatalog, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, isHiddenProvider, isPaidModel, registerRuntimeModels, setProviderCatalog, usesOpenAICodexTransport, withoutPaidTier } from './model-registry.js';
|
|
3
3
|
import { ThinkingLevel, Provider } from '@kenkaiiii/gg-ai';
|
|
4
|
-
export { AppPaths, getAppPaths } from './paths.js';
|
|
4
|
+
export { AppPaths, configureAppDataDir, getAppPaths } from './paths.js';
|
|
5
5
|
|
|
6
6
|
/** gg-ai's OPENROUTER_BASE_URL — where the openrouter transport goes with no override. */
|
|
7
7
|
declare const OPENROUTER_DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
|
|
@@ -867,13 +867,12 @@ declare function generatePKCE(): Promise<{
|
|
|
867
867
|
challenge: string;
|
|
868
868
|
}>;
|
|
869
869
|
|
|
870
|
-
/** The scope that lets
|
|
870
|
+
/** The scope that lets the app use the user's ChatGPT plan. */
|
|
871
871
|
declare const CHATGPT_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
872
872
|
/** Responses API base for ChatGPT plan inference. */
|
|
873
873
|
declare const CHATGPT_PLAN_BASE_URL = "https://api.openai.com/v1";
|
|
874
|
-
/** Where users review and limit what
|
|
874
|
+
/** Where users review and limit what the app may use of their plan. */
|
|
875
875
|
declare const CHATGPT_USAGE_URL = "https://chatgpt.com/settings/usage";
|
|
876
|
-
declare const CHATGPT_PLAN_NOT_ENABLED_MESSAGE = "ChatGPT plan use isn't enabled for GG Coder. Allow Use your ChatGPT plan, or add an OpenAI API key.";
|
|
877
876
|
/** A sign-in that worked but can't be used to bill the user's ChatGPT plan. */
|
|
878
877
|
declare class ChatGPTPlanNotEnabledError extends Error {
|
|
879
878
|
constructor();
|
|
@@ -917,7 +916,7 @@ declare function getChatGPTHostId(file?: string): Promise<string>;
|
|
|
917
916
|
/** Emails of the ChatGPT accounts this machine has signed in with, newest first. */
|
|
918
917
|
declare function savedChatGPTAccounts(file?: string): Promise<string[]>;
|
|
919
918
|
/**
|
|
920
|
-
* Continue with ChatGPT. Registers
|
|
919
|
+
* Continue with ChatGPT. Registers the app for this ChatGPT account on first
|
|
921
920
|
* use (the user names and approves it in the browser), then reuses the issued
|
|
922
921
|
* client ID. Throws {@link ChatGPTPlanNotEnabledError} when the user signed in
|
|
923
922
|
* but didn't allow plan use, and {@link ChatGPTSignInError} when OpenAI refuses
|
|
@@ -952,180 +951,5 @@ declare function verifyIdToken(idToken: string, expected: {
|
|
|
952
951
|
now?: number;
|
|
953
952
|
}): Promise<Record<string, unknown>>;
|
|
954
953
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
* Supports long polling, markdown messages, inline keyboards, and message splitting.
|
|
958
|
-
*/
|
|
959
|
-
interface TelegramConfig {
|
|
960
|
-
botToken: string;
|
|
961
|
-
/** Only accept messages from this Telegram user ID. */
|
|
962
|
-
allowedUserId: number;
|
|
963
|
-
}
|
|
964
|
-
interface TelegramUpdate {
|
|
965
|
-
update_id: number;
|
|
966
|
-
message?: {
|
|
967
|
-
message_id: number;
|
|
968
|
-
from: {
|
|
969
|
-
id: number;
|
|
970
|
-
first_name: string;
|
|
971
|
-
};
|
|
972
|
-
chat: {
|
|
973
|
-
id: number;
|
|
974
|
-
type: string;
|
|
975
|
-
title?: string;
|
|
976
|
-
};
|
|
977
|
-
text?: string;
|
|
978
|
-
voice?: {
|
|
979
|
-
file_id: string;
|
|
980
|
-
duration: number;
|
|
981
|
-
mime_type?: string;
|
|
982
|
-
file_size?: number;
|
|
983
|
-
};
|
|
984
|
-
};
|
|
985
|
-
callback_query?: {
|
|
986
|
-
id: string;
|
|
987
|
-
from: {
|
|
988
|
-
id: number;
|
|
989
|
-
};
|
|
990
|
-
message: {
|
|
991
|
-
chat: {
|
|
992
|
-
id: number;
|
|
993
|
-
};
|
|
994
|
-
};
|
|
995
|
-
data: string;
|
|
996
|
-
};
|
|
997
|
-
my_chat_member?: {
|
|
998
|
-
chat: {
|
|
999
|
-
id: number;
|
|
1000
|
-
type: string;
|
|
1001
|
-
title?: string;
|
|
1002
|
-
};
|
|
1003
|
-
from: {
|
|
1004
|
-
id: number;
|
|
1005
|
-
};
|
|
1006
|
-
new_chat_member: {
|
|
1007
|
-
status: string;
|
|
1008
|
-
};
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
interface InlineButton {
|
|
1012
|
-
text: string;
|
|
1013
|
-
callback_data: string;
|
|
1014
|
-
}
|
|
1015
|
-
/** Incoming message with chat context. */
|
|
1016
|
-
interface TelegramMessage {
|
|
1017
|
-
text: string;
|
|
1018
|
-
chatId: number;
|
|
1019
|
-
chatType: "private" | "group" | "supergroup" | "channel";
|
|
1020
|
-
chatTitle?: string;
|
|
1021
|
-
}
|
|
1022
|
-
/** Incoming voice note with chat context. */
|
|
1023
|
-
interface TelegramVoiceMessage {
|
|
1024
|
-
fileId: string;
|
|
1025
|
-
duration: number;
|
|
1026
|
-
chatId: number;
|
|
1027
|
-
chatType: "private" | "group" | "supergroup" | "channel";
|
|
1028
|
-
chatTitle?: string;
|
|
1029
|
-
}
|
|
1030
|
-
declare class TelegramBot {
|
|
1031
|
-
private token;
|
|
1032
|
-
private allowedUserId;
|
|
1033
|
-
private offset;
|
|
1034
|
-
private running;
|
|
1035
|
-
/** Aborts the in-flight long poll so stop() takes effect immediately. */
|
|
1036
|
-
private pollAbort;
|
|
1037
|
-
private onMessage;
|
|
1038
|
-
private onVoiceMessage;
|
|
1039
|
-
private onCallback;
|
|
1040
|
-
private onBotAdded;
|
|
1041
|
-
private onBotRemoved;
|
|
1042
|
-
constructor(config: TelegramConfig);
|
|
1043
|
-
/** Register handler for incoming text messages. */
|
|
1044
|
-
onText(handler: (msg: TelegramMessage) => void): void;
|
|
1045
|
-
/** Register handler for incoming voice notes. */
|
|
1046
|
-
onVoice(handler: (msg: TelegramVoiceMessage) => void): void;
|
|
1047
|
-
/** Register handler for inline keyboard button presses. */
|
|
1048
|
-
onCallbackQuery(handler: (data: string, chatId: number) => void): void;
|
|
1049
|
-
/** Register handler for when the bot is added to a group. */
|
|
1050
|
-
onAddedToGroup(handler: (chatId: number, chatTitle?: string) => void): void;
|
|
1051
|
-
/** Register handler for when the bot is removed from a group. */
|
|
1052
|
-
onRemovedFromGroup(handler: (chatId: number) => void): void;
|
|
1053
|
-
/** Start long polling. Blocks until stop() is called. */
|
|
1054
|
-
start(): Promise<void>;
|
|
1055
|
-
/** Stop long polling. */
|
|
1056
|
-
stop(): void;
|
|
1057
|
-
/** Send a text message to a specific chat. Converts markdown and splits long messages. */
|
|
1058
|
-
send(chatId: number, text: string, buttons?: InlineButton[][]): Promise<void>;
|
|
1059
|
-
/** Send a plain text message (no markdown parsing) to a specific chat. */
|
|
1060
|
-
sendPlain(chatId: number, text: string): Promise<void>;
|
|
1061
|
-
/** Send a typing indicator to a specific chat. */
|
|
1062
|
-
sendTyping(chatId: number): Promise<void>;
|
|
1063
|
-
/** Get a direct download URL for a Telegram file. */
|
|
1064
|
-
getFileUrl(fileId: string): Promise<string>;
|
|
1065
|
-
private getUpdates;
|
|
1066
|
-
private handleUpdate;
|
|
1067
|
-
private apiCall;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Voice note transcription using local Whisper model.
|
|
1072
|
-
* Uses @huggingface/transformers (pure JS/WASM) — no native deps, no API keys.
|
|
1073
|
-
* Model (~75MB) is downloaded on first use and cached locally.
|
|
1074
|
-
*/
|
|
1075
|
-
/** Optional callback for model download progress. */
|
|
1076
|
-
type ProgressCallback = (info: {
|
|
1077
|
-
status: string;
|
|
1078
|
-
progress?: number;
|
|
1079
|
-
file?: string;
|
|
1080
|
-
}) => void;
|
|
1081
|
-
/** Set a callback to receive model download progress updates. */
|
|
1082
|
-
declare function setProgressCallback(cb: ProgressCallback | null): void;
|
|
1083
|
-
/**
|
|
1084
|
-
* Resample audio from one sample rate to another using linear interpolation.
|
|
1085
|
-
*/
|
|
1086
|
-
declare function resample(audio: Float32Array, fromRate: number, toRate: number): Float32Array;
|
|
1087
|
-
/**
|
|
1088
|
-
* Downmix multi-channel audio to mono by averaging all channels.
|
|
1089
|
-
*/
|
|
1090
|
-
declare function downmixToMono(channelData: Float32Array[]): Float32Array;
|
|
1091
|
-
/**
|
|
1092
|
-
* Decode OGG Opus audio buffer to 16kHz mono PCM Float32Array.
|
|
1093
|
-
*/
|
|
1094
|
-
declare function decodeOggOpus(buffer: Uint8Array): Promise<Float32Array>;
|
|
1095
|
-
/** Whether the model has been loaded already. */
|
|
1096
|
-
declare function isModelLoaded(): boolean;
|
|
1097
|
-
/**
|
|
1098
|
-
* Transcribe a voice message from its Telegram file URL.
|
|
1099
|
-
* Downloads the OGG Opus file, decodes to PCM, and runs Whisper locally.
|
|
1100
|
-
*/
|
|
1101
|
-
declare function transcribeVoice(fileUrl: string): Promise<string>;
|
|
1102
|
-
|
|
1103
|
-
interface AutoUpdateConfig {
|
|
1104
|
-
/** npm package to self-update, e.g. "@kenkaiiii/ggcoder". */
|
|
1105
|
-
packageName: string;
|
|
1106
|
-
/**
|
|
1107
|
-
* Absolute path to this app's update-state.json, or a thunk resolving it.
|
|
1108
|
-
* A thunk keeps path resolution lazy so callers can derive it from
|
|
1109
|
-
* `os.homedir()` without freezing the value at module-load time (which
|
|
1110
|
-
* breaks tests that mock the home directory after import).
|
|
1111
|
-
*/
|
|
1112
|
-
stateFilePath: string | (() => string);
|
|
1113
|
-
/** Builds the in-session "update available" notification. */
|
|
1114
|
-
periodicMessage?: (args: {
|
|
1115
|
-
currentVersion: string;
|
|
1116
|
-
latestVersion: string;
|
|
1117
|
-
updateCommand: string;
|
|
1118
|
-
}) => string;
|
|
1119
|
-
}
|
|
1120
|
-
interface AutoUpdater {
|
|
1121
|
-
checkAndAutoUpdate(currentVersion: string): string | null;
|
|
1122
|
-
getPendingUpdate(currentVersion: string): {
|
|
1123
|
-
latestVersion: string;
|
|
1124
|
-
} | null;
|
|
1125
|
-
startPeriodicUpdateCheck(currentVersion: string, onUpdate: (message: string) => void): void;
|
|
1126
|
-
stopPeriodicUpdateCheck(): void;
|
|
1127
|
-
}
|
|
1128
|
-
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
1129
|
-
|
|
1130
|
-
export { AUTH_PROVIDERS, AuthStorage, CHATGPT_PLAN_BASE_URL, CHATGPT_PLAN_NOT_ENABLED_MESSAGE, CHATGPT_PLAN_SCOPE, CHATGPT_USAGE_URL, CLAUDE_CODE_AUTH_KEY, CLAUDE_CODE_AUTH_MARKER, CLAUDE_CODE_MANIFEST, ChatGPTPlanNotEnabledError, ChatGPTSignInError, DEFAULT_LOCAL_ENDPOINTS, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, GLM_CODING_PLAN_BASE_URL, GLM_CODING_PLAN_KEY, KIMI_CODE_DEFAULT_BASE_URL, KIMI_CODE_KEY, KIMI_CODE_OVERSEAS_BASE_URL, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, MINIMAX_CN_BASE_URL, MINIMAX_GLOBAL_BASE_URL, ModelInfo, NotLoggedInError, OPENAI_CHATGPT_KEY, OPENCODE_CATALOG_URLS, OPENCODE_PROVIDERS, OPENROUTER_DEFAULT_BASE_URL, PLAN_MODE_THINKING_CAP, RETIRED_SIGN_INS, SubscriptionUsageError, TelegramBot, XIAOMI_CREDITS_KEY, XIAOMI_TOKEN_PLAN_BASE_URLS, apiKeyStorageKeys, authPriorityNote, clampThinkingForPlanMode, claudeCodeAuthStatus, claudeCodeBinaryPath, claudeCodeCallbackUrl, claudeCodeConfigDir, claudeCodeEnv, claudeCodeHome, claudeCodePlatformKey, clearClaudeCodeUsage, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, describeAuthMethods, detectKimiCodeBaseUrl, detectMiniMaxBaseUrl, detectXiaomiTokenPlanBaseUrl, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, ensureClaudeCodeBinary, fetchChatGPTPlanModels, fetchSubscriptionUsage, findProbedModel, formatClaudeCodeInstallProgress, formatLocalModelId, formatOpenCodeModelId, generatePKCE, getAuthProvider, getChatGPTHostId, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isClaudeCodeAuthMarker, isKimiCodingEndpoint, isLegacyClaudeOAuth, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, localAuthStorageKey, localModelShortName, log, loginChatGPT, loginClaudeCode, logoutClaudeCode, mergeClaudeCodeRateLimit, oauthStorageKey, ollamaServedContext, openLog, parseCallbackInput, parseLocalModelId, parseOpenCodeCatalog, parseOpenRouterCatalog, pointScale, probeEndpoint, providerStorageKeys, readClaudeCodeUsage, readStoredBaseUrlSync, recordClaudeCodeRateLimit, refreshChatGPTToken, registerLogCleanup, requiredKeyLabel, resample, resolveClaudeCodeBinary, revokeChatGPTSignIn, savedChatGPTAccounts, setProgressCallback, signInWithClaudeCode, signOutOfClaudeCode, storageKeyProvider, toModelInfo, transcribeVoice, verifyIdToken, withFileLock };
|
|
1131
|
-
export type { ApiKeyVariant, AuthMethod, AuthMethodMeta, AuthProviderMeta, AutoUpdateConfig, AutoUpdater, ChatGPTLoginOptions, ClaudeCodeAuthStatus, ClaudeCodeInstallProgress, ClaudeCodeManifest, ClaudeCodePlatformAsset, ClaudeCodeRateLimitInfo, ClaudeCodeRunOptions, ClaudeCodeRuntimeOptions, ClaudeCodeSignInOptions, DiscoverOptions, DiscoveryResult, DualAuthProvider, EnsureClaudeCodeOptions, FetchedSubscriptionUsageProvider, InlineButton, LocalEndpoint, LocalEndpointKind, LocalEndpointProbe, LocalModel, LogLevel, OAuthCredentials, OAuthLoginCallbacks, OpenCodeProvider, ParsedOpenCodeCatalog, ParsedOpenRouterCatalog, PointScale, ProbeOptions, ProgressCallback, RetiredSignIn, SubscriptionUsageProvider, SubscriptionUsageSnapshot, SubscriptionUsageWindow, TelegramConfig, TelegramMessage, TelegramUpdate, TelegramVoiceMessage };
|
|
954
|
+
export { AUTH_PROVIDERS, AuthStorage, CHATGPT_PLAN_BASE_URL, CHATGPT_PLAN_SCOPE, CHATGPT_USAGE_URL, CLAUDE_CODE_AUTH_KEY, CLAUDE_CODE_AUTH_MARKER, CLAUDE_CODE_MANIFEST, ChatGPTPlanNotEnabledError, ChatGPTSignInError, DEFAULT_LOCAL_ENDPOINTS, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, GLM_CODING_PLAN_BASE_URL, GLM_CODING_PLAN_KEY, KIMI_CODE_DEFAULT_BASE_URL, KIMI_CODE_KEY, KIMI_CODE_OVERSEAS_BASE_URL, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, MINIMAX_CN_BASE_URL, MINIMAX_GLOBAL_BASE_URL, ModelInfo, NotLoggedInError, OPENAI_CHATGPT_KEY, OPENCODE_CATALOG_URLS, OPENCODE_PROVIDERS, OPENROUTER_DEFAULT_BASE_URL, PLAN_MODE_THINKING_CAP, RETIRED_SIGN_INS, SubscriptionUsageError, XIAOMI_CREDITS_KEY, XIAOMI_TOKEN_PLAN_BASE_URLS, apiKeyStorageKeys, authPriorityNote, clampThinkingForPlanMode, claudeCodeAuthStatus, claudeCodeBinaryPath, claudeCodeCallbackUrl, claudeCodeConfigDir, claudeCodeEnv, claudeCodeHome, claudeCodePlatformKey, clearClaudeCodeUsage, clearLocalDiscoveryCache, closeLogger, describeAuthMethods, detectKimiCodeBaseUrl, detectMiniMaxBaseUrl, detectXiaomiTokenPlanBaseUrl, discoverLocalModels, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, ensureClaudeCodeBinary, fetchChatGPTPlanModels, fetchSubscriptionUsage, findProbedModel, formatClaudeCodeInstallProgress, formatLocalModelId, formatOpenCodeModelId, generatePKCE, getAuthProvider, getChatGPTHostId, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isClaudeCodeAuthMarker, isKimiCodingEndpoint, isLegacyClaudeOAuth, isLocalModelId, isLoggerOpen, isThinkingLevelSupported, localAuthStorageKey, localModelShortName, log, loginChatGPT, loginClaudeCode, logoutClaudeCode, mergeClaudeCodeRateLimit, oauthStorageKey, ollamaServedContext, openLog, parseCallbackInput, parseLocalModelId, parseOpenCodeCatalog, parseOpenRouterCatalog, pointScale, probeEndpoint, providerStorageKeys, readClaudeCodeUsage, readStoredBaseUrlSync, recordClaudeCodeRateLimit, refreshChatGPTToken, registerLogCleanup, requiredKeyLabel, resolveClaudeCodeBinary, revokeChatGPTSignIn, savedChatGPTAccounts, signInWithClaudeCode, signOutOfClaudeCode, storageKeyProvider, toModelInfo, verifyIdToken, withFileLock };
|
|
955
|
+
export type { ApiKeyVariant, AuthMethod, AuthMethodMeta, AuthProviderMeta, ChatGPTLoginOptions, ClaudeCodeAuthStatus, ClaudeCodeInstallProgress, ClaudeCodeManifest, ClaudeCodePlatformAsset, ClaudeCodeRateLimitInfo, ClaudeCodeRunOptions, ClaudeCodeRuntimeOptions, ClaudeCodeSignInOptions, DiscoverOptions, DiscoveryResult, DualAuthProvider, EnsureClaudeCodeOptions, FetchedSubscriptionUsageProvider, LocalEndpoint, LocalEndpointKind, LocalEndpointProbe, LocalModel, LogLevel, OAuthCredentials, OAuthLoginCallbacks, OpenCodeProvider, ParsedOpenCodeCatalog, ParsedOpenRouterCatalog, PointScale, ProbeOptions, RetiredSignIn, SubscriptionUsageProvider, SubscriptionUsageSnapshot, SubscriptionUsageWindow };
|