@hashimkarim/usagestat-linux-x64-gnu 2.0.0-alpha.1 → 2.0.0-alpha.3
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/LICENSE +0 -0
- package/native-manifest.json +365 -77
- package/package.json +49 -1
- package/plugins/UPSTREAM-LICENSES.md +109 -0
- package/plugins/abacus-ai/icon.svg +0 -0
- package/plugins/abacus-ai/plugin.js +0 -0
- package/plugins/abacus-ai/plugin.json +0 -0
- package/plugins/aiand/icon.svg +6 -0
- package/plugins/aiand/plugin.js +108 -0
- package/plugins/aiand/plugin.json +22 -0
- package/plugins/alibaba/icon-color.svg +0 -0
- package/plugins/alibaba/icon.svg +0 -0
- package/plugins/alibaba/plugin.js +0 -0
- package/plugins/alibaba/plugin.json +0 -0
- package/plugins/alibaba-token-plan/icon-color.svg +0 -0
- package/plugins/alibaba-token-plan/icon.svg +0 -0
- package/plugins/alibaba-token-plan/plugin.js +0 -0
- package/plugins/alibaba-token-plan/plugin.json +0 -0
- package/plugins/amp/icon-color.svg +0 -0
- package/plugins/amp/icon-conflict.svg +0 -0
- package/plugins/amp/icon.svg +0 -0
- package/plugins/amp/plugin.js +0 -0
- package/plugins/amp/plugin.json +0 -0
- package/plugins/antigravity/icon-color.svg +0 -0
- package/plugins/antigravity/icon-conflict.svg +0 -0
- package/plugins/antigravity/icon.svg +0 -0
- package/plugins/antigravity/plugin.js +0 -0
- package/plugins/antigravity/plugin.json +0 -0
- package/plugins/antigravity-cli/icon.svg +0 -0
- package/plugins/antigravity-cli/plugin.js +0 -0
- package/plugins/antigravity-cli/plugin.json +0 -0
- package/plugins/antigravity-ide/icon.svg +0 -0
- package/plugins/antigravity-ide/plugin.js +0 -0
- package/plugins/antigravity-ide/plugin.json +0 -0
- package/plugins/augment/icon.svg +0 -0
- package/plugins/augment/plugin.js +0 -0
- package/plugins/augment/plugin.json +0 -0
- package/plugins/aws-bedrock/icon-color.svg +0 -0
- package/plugins/aws-bedrock/icon.svg +0 -0
- package/plugins/aws-bedrock/plugin.js +0 -0
- package/plugins/aws-bedrock/plugin.json +0 -0
- package/plugins/azure-openai/icon-color.svg +0 -0
- package/plugins/azure-openai/icon.svg +0 -0
- package/plugins/azure-openai/plugin.js +0 -0
- package/plugins/azure-openai/plugin.json +0 -0
- package/plugins/chutes/icon.svg +0 -0
- package/plugins/chutes/plugin.js +0 -0
- package/plugins/chutes/plugin.json +0 -0
- package/plugins/claude/icon-color.svg +0 -0
- package/plugins/claude/icon.svg +0 -0
- package/plugins/claude/plugin.js +70 -23
- package/plugins/claude/plugin.json +0 -0
- package/plugins/clawrouter/icon.svg +7 -0
- package/plugins/clawrouter/plugin.js +45 -0
- package/plugins/clawrouter/plugin.json +22 -0
- package/plugins/clinepass/icon.svg +4 -0
- package/plugins/clinepass/plugin.js +71 -0
- package/plugins/clinepass/plugin.json +23 -0
- package/plugins/codebuddy/plugin.js +331 -0
- package/plugins/codebuddy/plugin.json +30 -0
- package/plugins/codebuff/icon.svg +0 -0
- package/plugins/codebuff/plugin.js +0 -0
- package/plugins/codebuff/plugin.json +0 -0
- package/plugins/codex/icon-color.svg +0 -0
- package/plugins/codex/icon.svg +0 -0
- package/plugins/codex/plugin.js +7 -2
- package/plugins/codex/plugin.json +0 -0
- package/plugins/command-code/icon.svg +0 -0
- package/plugins/command-code/plugin.js +7 -0
- package/plugins/command-code/plugin.json +0 -0
- package/plugins/copilot/icon-color.svg +0 -0
- package/plugins/copilot/icon.svg +0 -0
- package/plugins/copilot/plugin.js +61 -9
- package/plugins/copilot/plugin.json +4 -1
- package/plugins/crof/icon.svg +0 -0
- package/plugins/crof/plugin.js +0 -0
- package/plugins/crof/plugin.json +0 -0
- package/plugins/crofai/icon.svg +0 -0
- package/plugins/crofai/plugin.js +0 -0
- package/plugins/crofai/plugin.json +0 -0
- package/plugins/cursor/icon-conflict.svg +0 -0
- package/plugins/cursor/icon.svg +0 -0
- package/plugins/cursor/plugin.js +46 -9
- package/plugins/cursor/plugin.json +3 -2
- package/plugins/cursor-nightly/icon.png +0 -0
- package/plugins/cursor-nightly/plugin.js +45 -8
- package/plugins/cursor-nightly/plugin.json +3 -2
- package/plugins/deepgram/icon.svg +0 -0
- package/plugins/deepgram/plugin.js +0 -0
- package/plugins/deepgram/plugin.json +0 -0
- package/plugins/deepinfra/icon.svg +4 -0
- package/plugins/deepinfra/plugin.js +97 -0
- package/plugins/deepinfra/plugin.json +28 -0
- package/plugins/deepseek/icon-color.svg +0 -0
- package/plugins/deepseek/icon.svg +0 -0
- package/plugins/deepseek/plugin.js +0 -0
- package/plugins/deepseek/plugin.json +0 -0
- package/plugins/devin/icon.svg +0 -0
- package/plugins/devin/plugin.js +111 -0
- package/plugins/devin/plugin.json +2 -1
- package/plugins/doubao/icon-color.svg +0 -0
- package/plugins/doubao/icon.svg +0 -0
- package/plugins/doubao/plugin.js +0 -0
- package/plugins/doubao/plugin.json +0 -0
- package/plugins/droid/icon.svg +0 -0
- package/plugins/droid/plugin.json +2 -1
- package/plugins/elevenlabs/icon.svg +0 -0
- package/plugins/elevenlabs/plugin.js +17 -2
- package/plugins/elevenlabs/plugin.json +0 -0
- package/plugins/factory/icon-conflict.svg +0 -0
- package/plugins/factory/icon.svg +0 -0
- package/plugins/factory/plugin.js +38 -14
- package/plugins/factory/plugin.json +2 -1
- package/plugins/fireworks-ai/icon.svg +0 -0
- package/plugins/fireworks-ai/plugin.js +0 -0
- package/plugins/fireworks-ai/plugin.json +0 -0
- package/plugins/gemini/icon-color.svg +0 -0
- package/plugins/gemini/icon.svg +0 -0
- package/plugins/gemini/plugin.js +0 -0
- package/plugins/gemini/plugin.json +0 -0
- package/plugins/grok/icon.svg +0 -0
- package/plugins/grok/plugin.js +30 -5
- package/plugins/grok/plugin.json +3 -1
- package/plugins/groqcloud/icon.svg +0 -0
- package/plugins/groqcloud/plugin.js +0 -0
- package/plugins/groqcloud/plugin.json +0 -0
- package/plugins/ibmbob/icon.svg +23 -0
- package/plugins/ibmbob/plugin.js +61 -0
- package/plugins/ibmbob/plugin.json +22 -0
- package/plugins/jetbrains-ai-assistant/icon-color.svg +0 -0
- package/plugins/jetbrains-ai-assistant/icon-conflict.svg +0 -0
- package/plugins/jetbrains-ai-assistant/icon.svg +0 -0
- package/plugins/jetbrains-ai-assistant/plugin.js +0 -0
- package/plugins/jetbrains-ai-assistant/plugin.json +0 -0
- package/plugins/kilo/icon.svg +0 -0
- package/plugins/kilo/plugin.js +0 -0
- package/plugins/kilo/plugin.json +0 -0
- package/plugins/kimi/icon-color.svg +0 -0
- package/plugins/kimi/icon-conflict.svg +0 -0
- package/plugins/kimi/icon.svg +0 -0
- package/plugins/kimi/plugin.js +122 -141
- package/plugins/kimi/plugin.json +5 -2
- package/plugins/kimi-k2/icon-color.svg +0 -0
- package/plugins/kimi-k2/icon.svg +0 -0
- package/plugins/kimi-k2/plugin.js +0 -0
- package/plugins/kimi-k2/plugin.json +0 -0
- package/plugins/kiro/icon-color.svg +0 -0
- package/plugins/kiro/icon-conflict.svg +0 -0
- package/plugins/kiro/icon.svg +0 -0
- package/plugins/kiro/plugin.js +49 -10
- package/plugins/kiro/plugin.json +3 -1
- package/plugins/litellm/icon.svg +0 -0
- package/plugins/litellm/plugin.js +0 -0
- package/plugins/litellm/plugin.json +0 -0
- package/plugins/llm-proxy/icon.svg +0 -0
- package/plugins/llm-proxy/plugin.js +0 -0
- package/plugins/llm-proxy/plugin.json +0 -0
- package/plugins/longcat/icon.svg +4 -0
- package/plugins/longcat/plugin.js +182 -0
- package/plugins/longcat/plugin.json +23 -0
- package/plugins/manus/icon.svg +0 -0
- package/plugins/manus/plugin.js +0 -0
- package/plugins/manus/plugin.json +0 -0
- package/plugins/mimo/icon.svg +0 -0
- package/plugins/mimo/plugin.js +0 -0
- package/plugins/mimo/plugin.json +0 -0
- package/plugins/minimax/icon-color.svg +0 -0
- package/plugins/minimax/icon-conflict.svg +0 -0
- package/plugins/minimax/icon.svg +0 -0
- package/plugins/minimax/plugin.js +25 -31
- package/plugins/minimax/plugin.json +0 -0
- package/plugins/mistral/icon-color.svg +0 -0
- package/plugins/mistral/icon.svg +0 -0
- package/plugins/mistral/plugin.js +0 -0
- package/plugins/mistral/plugin.json +0 -0
- package/plugins/moonshot/icon.svg +0 -0
- package/plugins/moonshot/plugin.js +8 -6
- package/plugins/moonshot/plugin.json +0 -0
- package/plugins/nanogpt/icon-color.svg +0 -0
- package/plugins/nanogpt/icon.svg +0 -0
- package/plugins/nanogpt/plugin.js +0 -0
- package/plugins/nanogpt/plugin.json +0 -0
- package/plugins/neuralwatt/icon.svg +0 -0
- package/plugins/neuralwatt/plugin.js +0 -0
- package/plugins/neuralwatt/plugin.json +0 -0
- package/plugins/notion/icon.svg +1 -0
- package/plugins/notion/plugin.js +282 -0
- package/plugins/notion/plugin.json +29 -0
- package/plugins/ollama/icon.svg +0 -0
- package/plugins/ollama/plugin.js +257 -56
- package/plugins/ollama/plugin.json +6 -3
- package/plugins/openai-api/icon.svg +0 -0
- package/plugins/openai-api/plugin.js +0 -0
- package/plugins/openai-api/plugin.json +0 -0
- package/plugins/opencode/icon.svg +0 -0
- package/plugins/opencode/plugin.js +0 -0
- package/plugins/opencode/plugin.json +0 -0
- package/plugins/opencode-go/icon-conflict.svg +0 -0
- package/plugins/opencode-go/icon.svg +0 -0
- package/plugins/opencode-go/plugin.js +78 -10
- package/plugins/opencode-go/plugin.json +5 -2
- package/plugins/openrouter/icon.svg +0 -0
- package/plugins/openrouter/plugin.js +371 -114
- package/plugins/openrouter/plugin.json +6 -0
- package/plugins/perplexity/icon-color.svg +0 -0
- package/plugins/perplexity/icon-conflict.svg +0 -0
- package/plugins/perplexity/icon.svg +0 -0
- package/plugins/perplexity/plugin.js +0 -0
- package/plugins/perplexity/plugin.json +0 -0
- package/plugins/poe/icon.svg +0 -0
- package/plugins/poe/plugin.js +24 -18
- package/plugins/poe/plugin.json +2 -0
- package/plugins/qoder/icon.svg +3 -0
- package/plugins/qoder/plugin.js +227 -0
- package/plugins/qoder/plugin.json +23 -0
- package/plugins/qwencloud/icon.svg +4 -0
- package/plugins/qwencloud/plugin.js +677 -0
- package/plugins/qwencloud/plugin.json +29 -0
- package/plugins/sakana/icon.svg +5 -0
- package/plugins/sakana/plugin.js +156 -0
- package/plugins/sakana/plugin.json +23 -0
- package/plugins/stepfun/icon-color.svg +0 -0
- package/plugins/stepfun/icon.svg +0 -0
- package/plugins/stepfun/plugin.js +0 -0
- package/plugins/stepfun/plugin.json +0 -0
- package/plugins/sub2api/icon.svg +4 -0
- package/plugins/sub2api/plugin.js +191 -0
- package/plugins/sub2api/plugin.json +16 -0
- package/plugins/synthetic/icon-conflict.svg +0 -0
- package/plugins/synthetic/icon.svg +0 -0
- package/plugins/synthetic/plugin.js +0 -0
- package/plugins/synthetic/plugin.json +0 -0
- package/plugins/t3chat/icon-color.svg +0 -0
- package/plugins/t3chat/icon.svg +0 -0
- package/plugins/t3chat/plugin.js +0 -0
- package/plugins/t3chat/plugin.json +0 -0
- package/plugins/venice/icon-color.svg +0 -0
- package/plugins/venice/icon.svg +0 -0
- package/plugins/venice/plugin.js +0 -0
- package/plugins/venice/plugin.json +0 -0
- package/plugins/vertex-ai/icon-color.svg +0 -0
- package/plugins/vertex-ai/icon.svg +0 -0
- package/plugins/vertex-ai/plugin.js +0 -0
- package/plugins/vertex-ai/plugin.json +0 -0
- package/plugins/warp/icon-color.svg +0 -0
- package/plugins/warp/icon.svg +0 -0
- package/plugins/warp/plugin.js +0 -0
- package/plugins/warp/plugin.json +0 -0
- package/plugins/wayfinder/icon.svg +5 -0
- package/plugins/wayfinder/plugin.js +47 -0
- package/plugins/wayfinder/plugin.json +16 -0
- package/plugins/windsurf/icon-conflict.svg +0 -0
- package/plugins/windsurf/icon.svg +0 -0
- package/plugins/windsurf/plugin.js +0 -0
- package/plugins/windsurf/plugin.json +0 -0
- package/plugins/xai/icon.svg +7 -0
- package/plugins/xai/plugin.js +162 -0
- package/plugins/xai/plugin.json +28 -0
- package/plugins/zai/icon-conflict.svg +0 -0
- package/plugins/zai/icon.svg +0 -0
- package/plugins/zai/plugin.js +111 -161
- package/plugins/zai/plugin.json +4 -1
- package/plugins/zed/icon.svg +0 -0
- package/plugins/zed/plugin.js +0 -0
- package/plugins/zed/plugin.json +0 -0
- package/plugins/zenmux/icon.svg +3 -0
- package/plugins/zenmux/plugin.js +102 -0
- package/plugins/zenmux/plugin.json +23 -0
- package/plugins/zoommate/icon.svg +1 -0
- package/plugins/zoommate/plugin.js +244 -0
- package/plugins/zoommate/plugin.json +29 -0
- package/usagestat +0 -0
- package/usagestatd +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
var HOST = "https://longcat.chat";
|
|
3
|
+
var USER_CURRENT = "/api/v1/user-current";
|
|
4
|
+
var TOKEN_USAGE = "/api/lc-platform/v1/tokenUsage";
|
|
5
|
+
var PENDING_FUEL = "/api/lc-platform/v1/pending-fuel-packages";
|
|
6
|
+
var TOKEN_PACKS_SUMMARY = "/api/pay/quota/metering/token-packs/summary";
|
|
7
|
+
|
|
8
|
+
function trim(value) {
|
|
9
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function env(ctx, name) {
|
|
13
|
+
try {
|
|
14
|
+
return trim(ctx.host.env.get(name));
|
|
15
|
+
} catch (_) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function setting(ctx, names) {
|
|
21
|
+
var settings = ctx.provider && ctx.provider.settings ? ctx.provider.settings : {};
|
|
22
|
+
for (var i = 0; i < names.length; i++) {
|
|
23
|
+
var value = trim(settings[names[i]]);
|
|
24
|
+
if (value) return value;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function normalizeCookie(raw) {
|
|
30
|
+
var header = trim(raw);
|
|
31
|
+
if (!header) return null;
|
|
32
|
+
if (header.slice(0, 7).toLowerCase() === "cookie:") header = header.slice(7).trim();
|
|
33
|
+
return header.indexOf("=") >= 0 ? header : null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function cookieHeader(ctx) {
|
|
37
|
+
return normalizeCookie(ctx.provider && ctx.provider.cookieHeader) ||
|
|
38
|
+
normalizeCookie(setting(ctx, ["cookieHeader", "cookie"])) ||
|
|
39
|
+
normalizeCookie(env(ctx, "LONGCAT_COOKIE"));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function requestJson(ctx, method, path, cookie, optional) {
|
|
43
|
+
var result = ctx.util.requestJson({
|
|
44
|
+
method: method,
|
|
45
|
+
url: HOST + path,
|
|
46
|
+
headers: {
|
|
47
|
+
Cookie: cookie,
|
|
48
|
+
Accept: "application/json",
|
|
49
|
+
"Content-Type": method === "POST" ? "application/json" : undefined,
|
|
50
|
+
},
|
|
51
|
+
bodyText: method === "POST" ? "{}" : undefined,
|
|
52
|
+
timeoutMs: optional ? 2000 : 10000,
|
|
53
|
+
});
|
|
54
|
+
if (ctx.util.isAuthStatus(result.resp.status)) throw "LongCat session expired.";
|
|
55
|
+
if (result.resp.status < 200 || result.resp.status >= 300) {
|
|
56
|
+
if (optional) return null;
|
|
57
|
+
throw "LongCat API " + path + " returned HTTP " + result.resp.status + ".";
|
|
58
|
+
}
|
|
59
|
+
if (!result.json || typeof result.json !== "object") {
|
|
60
|
+
if (optional) return null;
|
|
61
|
+
throw "Failed to parse LongCat " + path + ".";
|
|
62
|
+
}
|
|
63
|
+
var code = result.json.code != null ? Number(result.json.code) : result.json.status != null ? Number(result.json.status) : null;
|
|
64
|
+
if (code === 401 || code === 403) throw "LongCat session expired.";
|
|
65
|
+
return result.json;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function data(value) {
|
|
69
|
+
return value && value.data && typeof value.data === "object" ? value.data : value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function number(obj, key) {
|
|
73
|
+
if (!obj || typeof obj !== "object") return null;
|
|
74
|
+
var value = obj[key];
|
|
75
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
76
|
+
if (typeof value === "string" && value.trim()) {
|
|
77
|
+
var parsed = Number(value.replace(/,/g, ""));
|
|
78
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function string(obj, key) {
|
|
84
|
+
var value = obj && obj[key];
|
|
85
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function activeLot(summary) {
|
|
89
|
+
var lot = data(summary);
|
|
90
|
+
lot = lot && lot.currentLot;
|
|
91
|
+
if (!lot || typeof lot !== "object") return null;
|
|
92
|
+
if (String(string(lot, "status") || "").toUpperCase() !== "ACTIVE") return null;
|
|
93
|
+
var total = number(lot, "totalToken");
|
|
94
|
+
return total && total > 0 ? lot : null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function parseFuel(ctx, fuel) {
|
|
98
|
+
var root = data(fuel);
|
|
99
|
+
var packages = root && Array.isArray(root.packages) ? root.packages : Array.isArray(root) ? root : null;
|
|
100
|
+
if (!packages) return null;
|
|
101
|
+
var total = 0;
|
|
102
|
+
var remaining = 0;
|
|
103
|
+
var sawRemaining = false;
|
|
104
|
+
var nearest = null;
|
|
105
|
+
for (var i = 0; i < packages.length; i++) {
|
|
106
|
+
var pkg = packages[i] || {};
|
|
107
|
+
var capacity = number(pkg, "totalToken");
|
|
108
|
+
if (capacity === null) capacity = number(pkg, "total");
|
|
109
|
+
if (capacity === null) capacity = number(pkg, "amount");
|
|
110
|
+
var rem = number(pkg, "availableToken");
|
|
111
|
+
if (rem === null) rem = number(pkg, "remainingToken");
|
|
112
|
+
if (rem === null) rem = number(pkg, "remaining");
|
|
113
|
+
if (capacity === null || capacity < 0 || rem === null || rem < 0) return null;
|
|
114
|
+
total += capacity;
|
|
115
|
+
remaining += rem;
|
|
116
|
+
sawRemaining = true;
|
|
117
|
+
var raw = string(pkg, "expireTime") || string(pkg, "expireAt") || string(pkg, "expiresAt");
|
|
118
|
+
var iso = raw ? ctx.util.toIso(raw) : null;
|
|
119
|
+
if (iso && (!nearest || iso < nearest)) nearest = iso;
|
|
120
|
+
}
|
|
121
|
+
if (total <= 0 && !sawRemaining) return null;
|
|
122
|
+
if (total <= 0) total = remaining;
|
|
123
|
+
if (!sawRemaining) remaining = total;
|
|
124
|
+
return { total: total, remaining: remaining, resetsAt: nearest };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function progress(ctx, label, used, total, detail, reset) {
|
|
128
|
+
var opts = {
|
|
129
|
+
label: label,
|
|
130
|
+
used: total > 0 ? Math.max(0, Math.min(100, used / total * 100)) : 0,
|
|
131
|
+
limit: 100,
|
|
132
|
+
format: { kind: "percent" },
|
|
133
|
+
detail: detail,
|
|
134
|
+
};
|
|
135
|
+
if (reset) opts.resetsAt = reset;
|
|
136
|
+
return ctx.line.progress(opts);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function accountName(account) {
|
|
140
|
+
var root = data(account);
|
|
141
|
+
return string(root, "name") || string(root, "nickname") || string(root, "userName");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function probe(ctx) {
|
|
145
|
+
var cookie = cookieHeader(ctx);
|
|
146
|
+
if (!cookie) throw "LongCat session not configured. Set LONGCAT_COOKIE or provider cookieHeader.";
|
|
147
|
+
var account = requestJson(ctx, "GET", USER_CURRENT, cookie, false);
|
|
148
|
+
var tokenPacks = requestJson(ctx, "POST", TOKEN_PACKS_SUMMARY, cookie, true);
|
|
149
|
+
var lot = tokenPacks ? activeLot(tokenPacks) : null;
|
|
150
|
+
var total;
|
|
151
|
+
var used;
|
|
152
|
+
var usage;
|
|
153
|
+
if (lot) {
|
|
154
|
+
total = number(lot, "totalToken");
|
|
155
|
+
used = number(lot, "consumedToken");
|
|
156
|
+
if (used === null || used < 0) throw "LongCat token pack was missing consumedToken.";
|
|
157
|
+
} else {
|
|
158
|
+
usage = data(requestJson(ctx, "GET", TOKEN_USAGE, cookie, false));
|
|
159
|
+
var usageObj = usage && usage.usage && typeof usage.usage === "object" ? usage.usage : usage;
|
|
160
|
+
total = number(usageObj, "totalToken");
|
|
161
|
+
var remaining = number(usageObj, "availableToken");
|
|
162
|
+
if (total === null || total <= 0 || remaining === null || remaining < 0) throw "LongCat tokenUsage data was missing usable totalToken or availableToken.";
|
|
163
|
+
used = Math.max(0, total - remaining);
|
|
164
|
+
}
|
|
165
|
+
var lines = [progress(ctx, "Quota", used, total, Math.round(used) + "/" + Math.round(total) + " tokens", null)];
|
|
166
|
+
var fuel = requestJson(ctx, "GET", PENDING_FUEL, cookie, true);
|
|
167
|
+
var fuelTotals = fuel ? parseFuel(ctx, fuel) : null;
|
|
168
|
+
if (fuelTotals && fuelTotals.total > 0) {
|
|
169
|
+
lines.push(progress(
|
|
170
|
+
ctx,
|
|
171
|
+
"Fuel Pack",
|
|
172
|
+
Math.max(0, fuelTotals.total - fuelTotals.remaining),
|
|
173
|
+
fuelTotals.total,
|
|
174
|
+
"Fuel pack: " + Math.round(fuelTotals.remaining) + "/" + Math.round(fuelTotals.total),
|
|
175
|
+
fuelTotals.resetsAt
|
|
176
|
+
));
|
|
177
|
+
}
|
|
178
|
+
return { displayName: "LongCat", source: "web", plan: accountName(account), lines: lines };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
globalThis.__openusage_plugin = { id: "longcat", probe: probe };
|
|
182
|
+
})();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "longcat",
|
|
4
|
+
"name": "LongCat",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"web"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "web",
|
|
12
|
+
"webUrl": "https://longcat.chat",
|
|
13
|
+
"usageDashboardUrl": "https://longcat.chat/platform/",
|
|
14
|
+
"links": [
|
|
15
|
+
{
|
|
16
|
+
"label": "Dashboard",
|
|
17
|
+
"url": "https://longcat.chat/platform/"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"envVars": [
|
|
21
|
+
"LONGCAT_COOKIE"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/plugins/manus/icon.svg
CHANGED
|
File without changes
|
package/plugins/manus/plugin.js
CHANGED
|
File without changes
|
|
File without changes
|
package/plugins/mimo/icon.svg
CHANGED
|
File without changes
|
package/plugins/mimo/plugin.js
CHANGED
|
File without changes
|
package/plugins/mimo/plugin.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/plugins/minimax/icon.svg
CHANGED
|
File without changes
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
(function () {
|
|
2
|
-
const GLOBAL_PRIMARY_USAGE_URL = "https://
|
|
2
|
+
const GLOBAL_PRIMARY_USAGE_URL = "https://platform.minimax.io/v1/api/openplatform/coding_plan/remains"
|
|
3
3
|
const GLOBAL_FALLBACK_USAGE_URLS = [
|
|
4
|
+
"https://www.minimax.io/v1/api/openplatform/coding_plan/remains",
|
|
4
5
|
"https://www.minimax.io/v1/token_plan/remains",
|
|
5
6
|
]
|
|
6
|
-
const CN_PRIMARY_USAGE_URL = "https://
|
|
7
|
-
const CN_FALLBACK_USAGE_URLS = ["https://api.minimaxi.com/v1/token_plan/remains"]
|
|
7
|
+
const CN_PRIMARY_USAGE_URL = "https://platform.minimaxi.com/v1/api/openplatform/coding_plan/remains"
|
|
8
|
+
const CN_FALLBACK_USAGE_URLS = ["https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains", "https://api.minimaxi.com/v1/token_plan/remains"]
|
|
8
9
|
const GLOBAL_API_KEY_ENV_VARS = ["MINIMAX_API_KEY", "MINIMAX_API_TOKEN"]
|
|
9
10
|
const CN_API_KEY_ENV_VARS = ["MINIMAX_CN_API_KEY", "MINIMAX_API_KEY", "MINIMAX_API_TOKEN"]
|
|
10
11
|
const CODING_PLAN_WINDOW_MS = 5 * 60 * 60 * 1000
|
|
@@ -112,6 +113,8 @@
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
function loadApiKey(ctx, endpointSelection) {
|
|
116
|
+
const configured = readString(ctx.provider && ctx.provider.apiKey)
|
|
117
|
+
if (configured) return { value: configured, source: "configuration" }
|
|
115
118
|
const envVars = endpointSelection === "CN" ? CN_API_KEY_ENV_VARS : GLOBAL_API_KEY_ENV_VARS
|
|
116
119
|
for (let i = 0; i < envVars.length; i += 1) {
|
|
117
120
|
const name = envVars[i]
|
|
@@ -138,15 +141,21 @@
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
function endpointAttempts(ctx) {
|
|
141
|
-
|
|
144
|
+
const region = readString(ctx.provider && ctx.provider.region)
|
|
145
|
+
if (region) {
|
|
146
|
+
if (/^(cn|china)$/i.test(region)) return ["CN"]
|
|
147
|
+
if (/^(global|international)$/i.test(region)) return ["GLOBAL"]
|
|
148
|
+
throw "MiniMax region must be global or cn."
|
|
149
|
+
}
|
|
150
|
+
// Keep credentials within the selected region, including failed requests.
|
|
142
151
|
let cnApiKeyValue = null
|
|
143
152
|
try {
|
|
144
153
|
cnApiKeyValue = ctx.host.env.get("MINIMAX_CN_API_KEY")
|
|
145
154
|
} catch (e) {
|
|
146
155
|
ctx.host.log.warn("env read failed for MINIMAX_CN_API_KEY: " + String(e))
|
|
147
156
|
}
|
|
148
|
-
if (readString(cnApiKeyValue)) return ["CN"
|
|
149
|
-
return ["GLOBAL"
|
|
157
|
+
if (readString(cnApiKeyValue)) return ["CN"]
|
|
158
|
+
return ["GLOBAL"]
|
|
150
159
|
}
|
|
151
160
|
|
|
152
161
|
function formatAuthError() {
|
|
@@ -158,11 +167,7 @@
|
|
|
158
167
|
* @returns {object} parsed JSON response
|
|
159
168
|
* @throws {string} error message
|
|
160
169
|
*/
|
|
161
|
-
function tryUrls(ctx, urls, apiKey) {
|
|
162
|
-
let lastStatus = null
|
|
163
|
-
let hadNetworkError = false
|
|
164
|
-
let authStatusCount = 0
|
|
165
|
-
|
|
170
|
+
function tryUrls(ctx, urls, apiKey, endpointSelection) {
|
|
166
171
|
for (let i = 0; i < urls.length; i += 1) {
|
|
167
172
|
const url = urls[i]
|
|
168
173
|
let resp
|
|
@@ -178,20 +183,15 @@
|
|
|
178
183
|
timeoutMs: 15000,
|
|
179
184
|
})
|
|
180
185
|
} catch (e) {
|
|
181
|
-
|
|
182
|
-
ctx.host.log.warn("request failed (" + url + "): " + String(e))
|
|
183
|
-
continue
|
|
186
|
+
throw "MiniMax request failed. Check your connection."
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
if (ctx.util.isAuthStatus(resp.status)) {
|
|
187
|
-
|
|
188
|
-
ctx.host.log.warn("request returned auth status " + resp.status + " (" + url + ")")
|
|
189
|
-
continue
|
|
190
|
+
throw formatAuthError()
|
|
190
191
|
}
|
|
192
|
+
if (resp.status === 404 || resp.status === 405) continue
|
|
191
193
|
if (resp.status < 200 || resp.status >= 300) {
|
|
192
|
-
|
|
193
|
-
ctx.host.log.warn("request returned status " + resp.status + " (" + url + ")")
|
|
194
|
-
continue
|
|
194
|
+
throw "MiniMax request failed (HTTP " + resp.status + "). Try again later."
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
const parsed = ctx.util.tryParseJson(resp.bodyText)
|
|
@@ -200,14 +200,9 @@
|
|
|
200
200
|
continue
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (authStatusCount > 0 && lastStatus === null && !hadNetworkError) {
|
|
207
|
-
throw formatAuthError()
|
|
203
|
+
const usage = parsePayloadShape(ctx, parsed, endpointSelection)
|
|
204
|
+
if (usage) return usage
|
|
208
205
|
}
|
|
209
|
-
if (lastStatus !== null) throw "Request failed (HTTP " + lastStatus + "). Try again later."
|
|
210
|
-
if (hadNetworkError) throw "Request failed. Check your connection."
|
|
211
206
|
throw "Could not parse usage data."
|
|
212
207
|
}
|
|
213
208
|
|
|
@@ -393,7 +388,7 @@
|
|
|
393
388
|
}
|
|
394
389
|
|
|
395
390
|
function fetchUsagePayload(ctx, apiKey, endpointSelection) {
|
|
396
|
-
return tryUrls(ctx, getUsageUrls(endpointSelection), apiKey)
|
|
391
|
+
return tryUrls(ctx, getUsageUrls(endpointSelection), apiKey, endpointSelection)
|
|
397
392
|
}
|
|
398
393
|
|
|
399
394
|
function probe(ctx) {
|
|
@@ -407,8 +402,7 @@
|
|
|
407
402
|
const apiKeyInfo = loadApiKey(ctx, endpoint)
|
|
408
403
|
if (!apiKeyInfo) continue
|
|
409
404
|
try {
|
|
410
|
-
|
|
411
|
-
parsed = parsePayloadShape(ctx, payload, endpoint)
|
|
405
|
+
parsed = fetchUsagePayload(ctx, apiKeyInfo.value, endpoint)
|
|
412
406
|
if (parsed) {
|
|
413
407
|
successfulEndpoint = endpoint
|
|
414
408
|
break
|
|
@@ -441,7 +435,7 @@
|
|
|
441
435
|
if (parsed.resetsAt) line.resetsAt = parsed.resetsAt
|
|
442
436
|
if (parsed.periodDurationMs !== null) line.periodDurationMs = parsed.periodDurationMs
|
|
443
437
|
|
|
444
|
-
const result = { lines: [ctx.line.progress(line)] }
|
|
438
|
+
const result = { source: "api", lines: [ctx.line.progress(line)] }
|
|
445
439
|
if (parsed.planName) {
|
|
446
440
|
const regionLabel = successfulEndpoint === "CN" ? " (CN)" : " (GLOBAL)"
|
|
447
441
|
result.plan = parsed.planName + regionLabel
|
|
File without changes
|
|
File without changes
|
package/plugins/mistral/icon.svg
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
function apiKey(ctx) {
|
|
3
|
-
return ctx.host.env.get("MOONSHOT_API_KEY") || ctx.host.env.get("MOONSHOT_KEY");
|
|
3
|
+
return (ctx.provider && ctx.provider.apiKey) || ctx.host.env.get("MOONSHOT_API_KEY") || ctx.host.env.get("MOONSHOT_KEY");
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
function baseUrl(ctx) {
|
|
7
|
-
var region = String(ctx.host.env.get("MOONSHOT_REGION") || "").toLowerCase();
|
|
7
|
+
var region = String((ctx.provider && ctx.provider.region) || ctx.host.env.get("MOONSHOT_REGION") || "").toLowerCase();
|
|
8
8
|
var explicit = ctx.host.env.get("MOONSHOT_API_URL");
|
|
9
9
|
if (explicit) return explicit.replace(/\/$/, "");
|
|
10
10
|
return region === "cn" || region === "china" ? "https://api.moonshot.cn" : "https://api.moonshot.ai";
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
function pick(obj, names) {
|
|
14
14
|
for (var i = 0; i < names.length; i++) {
|
|
15
15
|
var v = obj && obj[names[i]];
|
|
16
|
-
if (typeof v === "number") return v;
|
|
17
|
-
if (typeof v === "string" && v.trim() !== "" &&
|
|
16
|
+
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
17
|
+
if (typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v))) return Number(v);
|
|
18
18
|
}
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
var key = apiKey(ctx);
|
|
24
24
|
if (!key) throw "Moonshot API key not found. Set MOONSHOT_API_KEY or MOONSHOT_KEY.";
|
|
25
25
|
|
|
26
|
+
var base = baseUrl(ctx);
|
|
26
27
|
var result = ctx.util.requestJson({
|
|
27
28
|
method: "GET",
|
|
28
|
-
url:
|
|
29
|
+
url: base + "/v1/users/me/balance",
|
|
29
30
|
headers: { Authorization: "Bearer " + key, Accept: "application/json" },
|
|
30
31
|
timeoutMs: 15000,
|
|
31
32
|
});
|
|
@@ -36,7 +37,8 @@
|
|
|
36
37
|
var data = json.data || json;
|
|
37
38
|
var available = pick(data, ["available_balance", "availableBalance", "balance", "cash_balance"]);
|
|
38
39
|
if (available === null) throw "Moonshot response did not include a recognizable balance.";
|
|
39
|
-
|
|
40
|
+
var currency = /^https:\/\/api\.moonshot\.cn(?::443)?(?:\/|$)/i.test(base) ? "CNY" : "USD";
|
|
41
|
+
return { source: "api", lines: [ctx.line.text({ label: "Balance", value: currency + " " + available.toFixed(2) })] };
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
globalThis.__openusage_plugin = { id: "moonshot", probe: probe };
|
|
File without changes
|
|
File without changes
|
package/plugins/nanogpt/icon.svg
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" fill-rule="evenodd" height="512" style="flex:none;line-height:1" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><title>Notion</title><path clip-rule="evenodd" d="M15.257.055l-13.31.98C.874 1.128.5 1.83.5 2.667v14.559c0 .654.233 1.213.794 1.96l3.129 4.06c.513.653.98.794 1.962.745l15.457-.932c1.307-.093 1.681-.7 1.681-1.727V4.954c0-.53-.21-.684-.829-1.135l-.106-.078L18.34.755c-1.027-.746-1.45-.84-3.083-.7zm-8.521 4.63c-1.263.086-1.549.105-2.266-.477L2.647 2.76c-.186-.187-.092-.42.375-.466l12.796-.933c1.074-.094 1.634.28 2.054.606l2.195 1.587c.093.047.326.326.047.326l-13.216.794-.162.01zM5.263 21.193V7.287c0-.606.187-.886.748-.933l15.176-.886c.515-.047.748.28.748.886v13.81c0 .609-.093 1.122-.934 1.168l-14.523.84c-.842.047-1.215-.232-1.215-.98zm14.338-13.16c.093.422 0 .842-.422.89l-.699.139v10.264c-.608.327-1.168.513-1.635.513-.747 0-.934-.232-1.495-.932l-4.576-7.185v6.952l1.448.327s0 .84-1.169.84l-3.221.186c-.094-.187 0-.654.327-.747l.84-.232V9.853L7.832 9.76c-.093-.42.14-1.026.794-1.073l3.456-.232 4.763 7.279v-6.44l-1.214-.14c-.094-.513.28-.887.747-.933l3.223-.187z"></path></svg>
|