@kenkaiiii/gg-core 5.106.1 → 5.107.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/dist/{chunk-757P7L4T.js → chunk-T367MVTP.js} +52 -20
- package/dist/chunk-T367MVTP.js.map +1 -0
- package/dist/index.cjs +53 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +5 -6
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +5 -7
- package/dist/model-registry.d.ts +5 -7
- package/dist/model-registry.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-757P7L4T.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -156,6 +156,7 @@ __export(index_exports, {
|
|
|
156
156
|
resample: () => resample,
|
|
157
157
|
resolveClaudeCodeBinary: () => resolveClaudeCodeBinary,
|
|
158
158
|
revokeChatGPTSignIn: () => revokeChatGPTSignIn,
|
|
159
|
+
savedChatGPTAccounts: () => savedChatGPTAccounts,
|
|
159
160
|
setProgressCallback: () => setProgressCallback,
|
|
160
161
|
setProviderCatalog: () => setProviderCatalog,
|
|
161
162
|
signInWithClaudeCode: () => signInWithClaudeCode,
|
|
@@ -851,21 +852,48 @@ async function getChatGPTHostId(file = defaultHostIdFile()) {
|
|
|
851
852
|
await writePrivateFile(file, `urn:uuid:${import_node_crypto2.default.randomUUID()}`);
|
|
852
853
|
return (await import_promises3.default.readFile(file, "utf-8")).trim();
|
|
853
854
|
}
|
|
854
|
-
|
|
855
|
+
function asRegistration(value) {
|
|
856
|
+
const v = value;
|
|
857
|
+
if (!v || typeof v.clientId !== "string" || typeof v.subject !== "string") return void 0;
|
|
858
|
+
return {
|
|
859
|
+
clientId: v.clientId,
|
|
860
|
+
subject: v.subject,
|
|
861
|
+
...typeof v.email === "string" && v.email ? { email: v.email } : {},
|
|
862
|
+
...typeof v.usedAt === "number" ? { usedAt: v.usedAt } : {}
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
async function readRegistrations(file) {
|
|
855
866
|
try {
|
|
856
867
|
const value = JSON.parse(await import_promises3.default.readFile(file, "utf-8"));
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
868
|
+
const list = Array.isArray(value.registrations) ? value.registrations.map(asRegistration) : [asRegistration(value)];
|
|
869
|
+
return list.filter((r) => r !== void 0).sort((a, b) => (b.usedAt ?? 0) - (a.usedAt ?? 0));
|
|
860
870
|
} catch {
|
|
871
|
+
return [];
|
|
861
872
|
}
|
|
862
|
-
|
|
873
|
+
}
|
|
874
|
+
async function writeRegistrations(file, list) {
|
|
875
|
+
if (list.length === 0) {
|
|
876
|
+
await import_promises3.default.unlink(file).catch(() => {
|
|
877
|
+
});
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
await writePrivateFile(file, JSON.stringify({ registrations: list }));
|
|
881
|
+
}
|
|
882
|
+
async function savedChatGPTAccounts(file = defaultRegistrationFile()) {
|
|
883
|
+
return (await readRegistrations(file)).map((r) => r.email ?? "a ChatGPT account");
|
|
884
|
+
}
|
|
885
|
+
function chooseRegistration(saved, options) {
|
|
886
|
+
if (options.newAccount) return { current: false };
|
|
887
|
+
const own = options.previous?.clientId ? saved.find((r) => r.clientId === options.previous?.clientId) : void 0;
|
|
888
|
+
if (own) return { registration: own, current: true };
|
|
889
|
+
return { registration: saved[0], current: false };
|
|
863
890
|
}
|
|
864
891
|
async function loginChatGPT(callbacks, options = {}) {
|
|
865
892
|
const { signal } = options;
|
|
866
893
|
const hostId = await getChatGPTHostId(options.hostIdFile);
|
|
867
894
|
const registrationFile = options.registrationFile ?? defaultRegistrationFile();
|
|
868
|
-
const
|
|
895
|
+
const saved = await readRegistrations(registrationFile);
|
|
896
|
+
const { registration, current } = chooseRegistration(saved, options);
|
|
869
897
|
let issuedClientId;
|
|
870
898
|
const signIn = async (status) => {
|
|
871
899
|
if (signal?.aborted) throw cancelled();
|
|
@@ -880,9 +908,10 @@ async function loginChatGPT(callbacks, options = {}) {
|
|
|
880
908
|
url.searchParams.set("client_id", knownClientId ?? REGISTRATION_CLIENT_ID);
|
|
881
909
|
if (!knownClientId) url.searchParams.set("agent_name_hint", AGENT_NAME);
|
|
882
910
|
url.searchParams.set("ext_agent_host_id", hostId);
|
|
883
|
-
if (registration && options.previous?.idToken) {
|
|
911
|
+
if (registration && current && options.previous?.idToken) {
|
|
884
912
|
url.searchParams.set("id_token_hint", options.previous.idToken);
|
|
885
913
|
}
|
|
914
|
+
if (registration?.email) url.searchParams.set("login_hint", registration.email);
|
|
886
915
|
url.searchParams.set("response_type", "code");
|
|
887
916
|
url.searchParams.set("redirect_uri", redirectUri);
|
|
888
917
|
url.searchParams.set("scope", SCOPES);
|
|
@@ -928,20 +957,24 @@ async function loginChatGPT(callbacks, options = {}) {
|
|
|
928
957
|
const subject = String(claims.sub ?? "");
|
|
929
958
|
if (!subject) throw new Error("ChatGPT ID token has no subject.");
|
|
930
959
|
if (registration && registration.subject !== subject) {
|
|
931
|
-
await
|
|
932
|
-
|
|
960
|
+
await writeRegistrations(
|
|
961
|
+
registrationFile,
|
|
962
|
+
saved.filter((r) => r.clientId !== registration.clientId)
|
|
963
|
+
);
|
|
933
964
|
await revokeChatGPTSignIn({ refreshToken: tokens.refreshToken, clientId });
|
|
934
965
|
throw new Error(
|
|
935
|
-
"That was a different ChatGPT account.
|
|
966
|
+
"That was a different ChatGPT account. Choose Use a different account or workspace to connect it."
|
|
936
967
|
);
|
|
937
968
|
}
|
|
938
969
|
if (!tokens.scopes.includes(CHATGPT_PLAN_SCOPE)) {
|
|
939
970
|
await revokeChatGPTSignIn({ refreshToken: tokens.refreshToken, clientId });
|
|
940
971
|
throw new ChatGPTPlanNotEnabledError();
|
|
941
972
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
973
|
+
const email = typeof claims.email === "string" ? claims.email : void 0;
|
|
974
|
+
await writeRegistrations(registrationFile, [
|
|
975
|
+
{ clientId, subject, ...email ? { email } : {}, usedAt: Date.now() },
|
|
976
|
+
...saved.filter((r) => r.clientId !== clientId)
|
|
977
|
+
]);
|
|
945
978
|
return {
|
|
946
979
|
accessToken: tokens.accessToken,
|
|
947
980
|
refreshToken: tokens.refreshToken,
|
|
@@ -2342,8 +2375,8 @@ var CLAUDE_FABLE_FAST_BILLING = {
|
|
|
2342
2375
|
standardModel: "claude-fable-5-2"
|
|
2343
2376
|
};
|
|
2344
2377
|
var XIAOMI_ULTRASPEED_BILLING = {
|
|
2345
|
-
label: "
|
|
2346
|
-
detail: "UltraSpeed
|
|
2378
|
+
label: "10x credits",
|
|
2379
|
+
detail: "UltraSpeed uses your Token Plan credits at 10x MiMo-V2.6-Pro's rate (Pro and Max plans only), or bills your API Credits per token at a higher rate.",
|
|
2347
2380
|
paid: true,
|
|
2348
2381
|
standardModel: "mimo-v2.6-pro"
|
|
2349
2382
|
};
|
|
@@ -3054,9 +3087,8 @@ var MODELS = [
|
|
|
3054
3087
|
authStorageKeys: ["xiaomi", XIAOMI_CREDITS_KEY]
|
|
3055
3088
|
},
|
|
3056
3089
|
// UltraSpeed: lower-latency sibling of the Pro flagship, same full-modal
|
|
3057
|
-
// capability surface, premium-priced for the throughput gain.
|
|
3058
|
-
//
|
|
3059
|
-
// distinct API Credits key only (see authStorageKeys doc).
|
|
3090
|
+
// capability surface, premium-priced for the throughput gain. On the Token
|
|
3091
|
+
// Plan (Pro and Max tiers) since 2026-11 at 10x Pro's credit rate.
|
|
3060
3092
|
{
|
|
3061
3093
|
id: "mimo-v2.6-pro-ultraspeed",
|
|
3062
3094
|
name: "MiMo-V2.6-Pro-UltraSpeed",
|
|
@@ -3069,7 +3101,7 @@ var MODELS = [
|
|
|
3069
3101
|
maxVideoBytes: 36 * 1024 * 1024,
|
|
3070
3102
|
costTier: "high",
|
|
3071
3103
|
maxThinkingLevel: "high",
|
|
3072
|
-
authStorageKeys: [XIAOMI_CREDITS_KEY],
|
|
3104
|
+
authStorageKeys: ["xiaomi", XIAOMI_CREDITS_KEY],
|
|
3073
3105
|
billing: XIAOMI_ULTRASPEED_BILLING
|
|
3074
3106
|
},
|
|
3075
3107
|
// ── DeepSeek ───────────────────────────────────────────
|
|
@@ -4280,7 +4312,7 @@ var ALL_AUTH_PROVIDERS = [
|
|
|
4280
4312
|
key: XIAOMI_CREDITS_KEY,
|
|
4281
4313
|
label: "API Credits",
|
|
4282
4314
|
kind: "payg",
|
|
4283
|
-
billing: "Pay-per-token from MiMo API Credits.
|
|
4315
|
+
billing: "Pay-per-token from MiMo API Credits.",
|
|
4284
4316
|
baseUrl: "https://api.xiaomimimo.com/v1"
|
|
4285
4317
|
}
|
|
4286
4318
|
],
|
|
@@ -5160,6 +5192,7 @@ function createAutoUpdater(config) {
|
|
|
5160
5192
|
resample,
|
|
5161
5193
|
resolveClaudeCodeBinary,
|
|
5162
5194
|
revokeChatGPTSignIn,
|
|
5195
|
+
savedChatGPTAccounts,
|
|
5163
5196
|
setProgressCallback,
|
|
5164
5197
|
setProviderCatalog,
|
|
5165
5198
|
signInWithClaudeCode,
|