opencode-minimax-quota 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/tui.js +6 -8
  2. package/package.json +1 -1
package/dist/tui.js CHANGED
@@ -17,18 +17,16 @@ var REFRESH_INTERVAL = 5 * 60 * 1e3;
17
17
  function getAuthPath() {
18
18
  return `${process.env.HOME || "/root"}/.local/share/opencode/auth.json`;
19
19
  }
20
- function loadApiKey() {
20
+ async function loadApiKey() {
21
21
  try {
22
22
  const authPath = getAuthPath();
23
- log("authPath:", authPath, "exists:", Bun?.file(authPath) !== void 0);
24
- const auth = JSON.parse(Bun.file(authPath).text());
25
- log("auth keys:", Object.keys(auth).join(","));
23
+ const text = await Bun.file(authPath).text();
24
+ const auth = JSON.parse(text);
26
25
  const entry = auth["minimax-cn-coding-plan"];
27
- log("entry:", entry ? "found" : "not found");
28
26
  if (!entry) return null;
29
27
  return typeof entry === "string" ? entry : entry.key;
30
28
  } catch (e) {
31
- log("loadApiKey error:", e.message, e.stack);
29
+ log("loadApiKey error:", e.message);
32
30
  return null;
33
31
  }
34
32
  }
@@ -43,7 +41,7 @@ function parseQuota(data) {
43
41
  };
44
42
  }
45
43
  async function fetchQuota() {
46
- const key = loadApiKey();
44
+ const key = await loadApiKey();
47
45
  if (!key) {
48
46
  log("fetchQuota: no API key");
49
47
  return null;
@@ -59,7 +57,7 @@ async function fetchQuota() {
59
57
  }
60
58
  return parseQuota(data);
61
59
  } catch (e) {
62
- log("fetchQuota error:", e.message, e.stack);
60
+ log("fetchQuota error:", e.message);
63
61
  return null;
64
62
  }
65
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-minimax-quota",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "OpenCode TUI plugin to display MiniMax token plan quota (5h + weekly) in the prompt bar",
5
5
  "type": "module",
6
6
  "main": "./dist/tui.js",