tokmon 0.20.1 → 0.20.2
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/{bootstrap-ink-AO3QA5BH.js → bootstrap-ink-KWHXVQYS.js} +2 -2
- package/dist/{chunk-DZY72PPB.js → chunk-5IHAR2RZ.js} +1 -1
- package/dist/{chunk-5BW4H7WW.js → chunk-7HJIP4U6.js} +44 -2
- package/dist/cli.js +3 -3
- package/dist/{daemon-OBQJO6D4.js → daemon-NVWX3RRK.js} +2 -2
- package/dist/{server-RL2JDFQY.js → server-BXMRN774.js} +2 -2
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
systemTimezone,
|
|
19
19
|
time,
|
|
20
20
|
tokens
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7HJIP4U6.js";
|
|
22
22
|
import {
|
|
23
23
|
COLOR_PALETTE,
|
|
24
24
|
DEFAULTS,
|
|
@@ -3194,7 +3194,7 @@ function App({ interval: cliInterval, initialConfig, baseUrl = null, wsToken = n
|
|
|
3194
3194
|
if (webStartingRef.current) return;
|
|
3195
3195
|
webStartingRef.current = true;
|
|
3196
3196
|
try {
|
|
3197
|
-
const { startWebServer } = await import("./server-
|
|
3197
|
+
const { startWebServer } = await import("./server-BXMRN774.js");
|
|
3198
3198
|
const ctrl = await startWebServer({ config: cfg, log: false });
|
|
3199
3199
|
webRef.current = ctrl;
|
|
3200
3200
|
openUrl(ctrl.url);
|
|
@@ -2560,9 +2560,51 @@ import { homedir as homedir11 } from "os";
|
|
|
2560
2560
|
function geminiCredsPath(homeDir) {
|
|
2561
2561
|
return join13(homeDir ?? homedir11(), ".gemini", "oauth_creds.json");
|
|
2562
2562
|
}
|
|
2563
|
-
function
|
|
2563
|
+
function geminiDir(homeDir) {
|
|
2564
|
+
return join13(homeDir ?? homedir11(), ".gemini");
|
|
2565
|
+
}
|
|
2566
|
+
function authTypeFromSettings(settings) {
|
|
2567
|
+
const raw = settings?.security?.auth?.selectedType ?? settings?.selectedAuthType;
|
|
2568
|
+
if (typeof raw !== "string") return "none";
|
|
2569
|
+
const value = raw.trim().toLowerCase();
|
|
2570
|
+
if (!value) return "none";
|
|
2571
|
+
if (value.includes("vertex") || value.includes("use_vertex_ai")) return "vertex";
|
|
2572
|
+
if (value.includes("gemini-api-key") || value.includes("api-key") || value.includes("use_gemini")) return "api-key";
|
|
2573
|
+
return "none";
|
|
2574
|
+
}
|
|
2575
|
+
async function authMethodFromSettings(homeDir) {
|
|
2576
|
+
try {
|
|
2577
|
+
const raw = await readFile6(join13(geminiDir(homeDir), "settings.json"), "utf8");
|
|
2578
|
+
return authTypeFromSettings(JSON.parse(raw));
|
|
2579
|
+
} catch {
|
|
2580
|
+
return "none";
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
async function hasGeminiApiKeyFile(homeDir) {
|
|
2584
|
+
try {
|
|
2585
|
+
await access8(join13(geminiDir(homeDir), "api_key"));
|
|
2586
|
+
return true;
|
|
2587
|
+
} catch {
|
|
2588
|
+
}
|
|
2589
|
+
try {
|
|
2590
|
+
const env = await readFile6(join13(geminiDir(homeDir), ".env"), "utf8");
|
|
2591
|
+
return /^\s*GEMINI_API_KEY\s*=/m.test(env);
|
|
2592
|
+
} catch {
|
|
2593
|
+
return false;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
function hasGeminiApiKeyEnv() {
|
|
2564
2597
|
return ["GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_GENAI_API_KEY"].some((name) => typeof process.env[name] === "string" && process.env[name].trim() !== "");
|
|
2565
2598
|
}
|
|
2599
|
+
async function noOAuthAuthMessage(homeDir) {
|
|
2600
|
+
const settingsMethod = await authMethodFromSettings(homeDir);
|
|
2601
|
+
if (settingsMethod === "api-key") return "API key auth \u2014 quota needs Google login (run gemini)";
|
|
2602
|
+
if (settingsMethod === "vertex") return "Vertex AI auth \u2014 quota needs Google login (run gemini)";
|
|
2603
|
+
if (await hasGeminiApiKeyFile(homeDir) || hasGeminiApiKeyEnv()) {
|
|
2604
|
+
return "API key auth \u2014 quota needs Google login (run gemini)";
|
|
2605
|
+
}
|
|
2606
|
+
return "Not signed in \u2014 run gemini and log in with Google";
|
|
2607
|
+
}
|
|
2566
2608
|
async function detectGemini(homeDir) {
|
|
2567
2609
|
try {
|
|
2568
2610
|
await access8(geminiCredsPath(homeDir));
|
|
@@ -2603,7 +2645,7 @@ async function geminiBilling(account) {
|
|
|
2603
2645
|
return {
|
|
2604
2646
|
plan: null,
|
|
2605
2647
|
metrics: [],
|
|
2606
|
-
error:
|
|
2648
|
+
error: await noOAuthAuthMessage(account.homeDir),
|
|
2607
2649
|
...identity
|
|
2608
2650
|
};
|
|
2609
2651
|
}
|
package/dist/cli.js
CHANGED
|
@@ -14,12 +14,12 @@ process.emitWarning = ((warning, ...rest) => {
|
|
|
14
14
|
var args = process.argv.slice(2);
|
|
15
15
|
var subcommand = args[0]?.toLowerCase();
|
|
16
16
|
if (subcommand === "__daemon") {
|
|
17
|
-
const { runDaemon } = await import("./daemon-
|
|
17
|
+
const { runDaemon } = await import("./daemon-NVWX3RRK.js");
|
|
18
18
|
await runDaemon(args.slice(1), { foreground: false });
|
|
19
19
|
process.exit(typeof process.exitCode === "number" ? process.exitCode : 0);
|
|
20
20
|
}
|
|
21
21
|
if (subcommand === "serve" || subcommand === "web") {
|
|
22
|
-
const { runDaemon } = await import("./daemon-
|
|
22
|
+
const { runDaemon } = await import("./daemon-NVWX3RRK.js");
|
|
23
23
|
await runDaemon(args.slice(1), { foreground: true });
|
|
24
24
|
process.exit(typeof process.exitCode === "number" ? process.exitCode : 0);
|
|
25
25
|
}
|
|
@@ -68,5 +68,5 @@ setGlyphs(resolveGlyphs({
|
|
|
68
68
|
}));
|
|
69
69
|
var daemon = await attachOrSpawn();
|
|
70
70
|
var mode = daemon.kind === "spawned" ? "connected" : "degraded";
|
|
71
|
-
var { bootstrapInk } = await import("./bootstrap-ink-
|
|
71
|
+
var { bootstrapInk } = await import("./bootstrap-ink-KWHXVQYS.js");
|
|
72
72
|
await bootstrapInk({ interval, config, daemon, mode });
|
package/package.json
CHANGED