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.
@@ -18,7 +18,7 @@ import {
18
18
  systemTimezone,
19
19
  time,
20
20
  tokens
21
- } from "./chunk-5BW4H7WW.js";
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-RL2JDFQY.js");
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);
@@ -8,7 +8,7 @@ import {
8
8
  detectProviders,
9
9
  fetchPeak,
10
10
  resolveTimezone
11
- } from "./chunk-5BW4H7WW.js";
11
+ } from "./chunk-7HJIP4U6.js";
12
12
  import {
13
13
  cacheDir,
14
14
  expandHome,
@@ -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 hasGeminiApiKey() {
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: hasGeminiApiKey() ? "API key auth \u2014 quota needs Google login (run gemini)" : "Not signed in \u2014 run gemini and log in with Google",
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-OBQJO6D4.js");
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-OBQJO6D4.js");
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-AO3QA5BH.js");
71
+ var { bootstrapInk } = await import("./bootstrap-ink-KWHXVQYS.js");
72
72
  await bootstrapInk({ interval, config, daemon, mode });
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  appVersion,
4
4
  startWebServer
5
- } from "./chunk-DZY72PPB.js";
5
+ } from "./chunk-5IHAR2RZ.js";
6
6
  import {
7
7
  flushDisk
8
- } from "./chunk-5BW4H7WW.js";
8
+ } from "./chunk-7HJIP4U6.js";
9
9
  import {
10
10
  cacheDir,
11
11
  loadConfig
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startWebServer
4
- } from "./chunk-DZY72PPB.js";
5
- import "./chunk-5BW4H7WW.js";
4
+ } from "./chunk-5IHAR2RZ.js";
5
+ import "./chunk-7HJIP4U6.js";
6
6
  import "./chunk-XQEJ4WQ5.js";
7
7
  export {
8
8
  startWebServer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Terminal + web dashboard for Claude Code, Codex, Cursor, opencode, pi, Copilot, Gemini & more — usage, limits, and costs",
5
5
  "type": "module",
6
6
  "bin": {