@hashimkarim/usagestat-linux-x64-gnu 2.0.0-alpha.1
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 +57744 -0
- package/native-manifest.json +1414 -0
- package/package.json +254 -0
- package/plugins/abacus-ai/icon.svg +18 -0
- package/plugins/abacus-ai/plugin.js +121 -0
- package/plugins/abacus-ai/plugin.json +17 -0
- package/plugins/alibaba/icon-color.svg +1 -0
- package/plugins/alibaba/icon.svg +1 -0
- package/plugins/alibaba/plugin.js +322 -0
- package/plugins/alibaba/plugin.json +20 -0
- package/plugins/alibaba-token-plan/icon-color.svg +1 -0
- package/plugins/alibaba-token-plan/icon.svg +1 -0
- package/plugins/alibaba-token-plan/plugin.js +544 -0
- package/plugins/alibaba-token-plan/plugin.json +19 -0
- package/plugins/amp/icon-color.svg +1 -0
- package/plugins/amp/icon-conflict.svg +6 -0
- package/plugins/amp/icon.svg +1 -0
- package/plugins/amp/plugin.js +175 -0
- package/plugins/amp/plugin.json +16 -0
- package/plugins/antigravity/icon-color.svg +1 -0
- package/plugins/antigravity/icon-conflict.svg +3 -0
- package/plugins/antigravity/icon.svg +1 -0
- package/plugins/antigravity/plugin.js +739 -0
- package/plugins/antigravity/plugin.json +31 -0
- package/plugins/antigravity-cli/icon.svg +3 -0
- package/plugins/antigravity-cli/plugin.js +570 -0
- package/plugins/antigravity-cli/plugin.json +16 -0
- package/plugins/antigravity-ide/icon.svg +3 -0
- package/plugins/antigravity-ide/plugin.js +257 -0
- package/plugins/antigravity-ide/plugin.json +29 -0
- package/plugins/augment/icon.svg +14 -0
- package/plugins/augment/plugin.js +59 -0
- package/plugins/augment/plugin.json +18 -0
- package/plugins/aws-bedrock/icon-color.svg +1 -0
- package/plugins/aws-bedrock/icon.svg +1 -0
- package/plugins/aws-bedrock/plugin.js +206 -0
- package/plugins/aws-bedrock/plugin.json +18 -0
- package/plugins/azure-openai/icon-color.svg +1 -0
- package/plugins/azure-openai/icon.svg +1 -0
- package/plugins/azure-openai/plugin.js +145 -0
- package/plugins/azure-openai/plugin.json +17 -0
- package/plugins/chutes/icon.svg +7 -0
- package/plugins/chutes/plugin.js +236 -0
- package/plugins/chutes/plugin.json +19 -0
- package/plugins/claude/icon-color.svg +1 -0
- package/plugins/claude/icon.svg +1 -0
- package/plugins/claude/plugin.js +1723 -0
- package/plugins/claude/plugin.json +30 -0
- package/plugins/codebuff/icon.svg +92 -0
- package/plugins/codebuff/plugin.js +113 -0
- package/plugins/codebuff/plugin.json +17 -0
- package/plugins/codex/icon-color.svg +5 -0
- package/plugins/codex/icon.svg +1 -0
- package/plugins/codex/plugin.js +1009 -0
- package/plugins/codex/plugin.json +82 -0
- package/plugins/command-code/icon.svg +3 -0
- package/plugins/command-code/plugin.js +184 -0
- package/plugins/command-code/plugin.json +20 -0
- package/plugins/copilot/icon-color.svg +1 -0
- package/plugins/copilot/icon.svg +1 -0
- package/plugins/copilot/plugin.js +684 -0
- package/plugins/copilot/plugin.json +21 -0
- package/plugins/crof/icon.svg +3 -0
- package/plugins/crof/plugin.js +53 -0
- package/plugins/crof/plugin.json +17 -0
- package/plugins/crofai/icon.svg +16 -0
- package/plugins/crofai/plugin.js +81 -0
- package/plugins/crofai/plugin.json +18 -0
- package/plugins/cursor/icon-conflict.svg +3 -0
- package/plugins/cursor/icon.svg +1 -0
- package/plugins/cursor/plugin.js +1379 -0
- package/plugins/cursor/plugin.json +23 -0
- package/plugins/cursor-nightly/icon.png +0 -0
- package/plugins/cursor-nightly/plugin.js +1379 -0
- package/plugins/cursor-nightly/plugin.json +23 -0
- package/plugins/deepgram/icon.svg +1 -0
- package/plugins/deepgram/plugin.js +20 -0
- package/plugins/deepgram/plugin.json +17 -0
- package/plugins/deepseek/icon-color.svg +1 -0
- package/plugins/deepseek/icon.svg +1 -0
- package/plugins/deepseek/plugin.js +71 -0
- package/plugins/deepseek/plugin.json +17 -0
- package/plugins/devin/icon.svg +5 -0
- package/plugins/devin/plugin.js +341 -0
- package/plugins/devin/plugin.json +16 -0
- package/plugins/doubao/icon-color.svg +1 -0
- package/plugins/doubao/icon.svg +1 -0
- package/plugins/doubao/plugin.js +92 -0
- package/plugins/doubao/plugin.json +17 -0
- package/plugins/droid/icon.svg +1 -0
- package/plugins/droid/plugin.json +20 -0
- package/plugins/elevenlabs/icon.svg +4 -0
- package/plugins/elevenlabs/plugin.js +48 -0
- package/plugins/elevenlabs/plugin.json +18 -0
- package/plugins/factory/icon-conflict.svg +1 -0
- package/plugins/factory/icon.svg +1 -0
- package/plugins/factory/plugin.js +487 -0
- package/plugins/factory/plugin.json +15 -0
- package/plugins/fireworks-ai/icon.svg +6 -0
- package/plugins/fireworks-ai/plugin.js +370 -0
- package/plugins/fireworks-ai/plugin.json +19 -0
- package/plugins/gemini/icon-color.svg +1 -0
- package/plugins/gemini/icon.svg +1 -0
- package/plugins/gemini/plugin.js +460 -0
- package/plugins/gemini/plugin.json +16 -0
- package/plugins/grok/icon.svg +1 -0
- package/plugins/grok/plugin.js +297 -0
- package/plugins/grok/plugin.json +19 -0
- package/plugins/groqcloud/icon.svg +1 -0
- package/plugins/groqcloud/plugin.js +117 -0
- package/plugins/groqcloud/plugin.json +19 -0
- package/plugins/jetbrains-ai-assistant/icon-color.svg +14 -0
- package/plugins/jetbrains-ai-assistant/icon-conflict.svg +3 -0
- package/plugins/jetbrains-ai-assistant/icon.svg +14 -0
- package/plugins/jetbrains-ai-assistant/plugin.js +313 -0
- package/plugins/jetbrains-ai-assistant/plugin.json +16 -0
- package/plugins/kilo/icon.svg +1 -0
- package/plugins/kilo/plugin.js +111 -0
- package/plugins/kilo/plugin.json +19 -0
- package/plugins/kimi/icon-color.svg +1 -0
- package/plugins/kimi/icon-conflict.svg +3 -0
- package/plugins/kimi/icon.svg +1 -0
- package/plugins/kimi/plugin.js +358 -0
- package/plugins/kimi/plugin.json +15 -0
- package/plugins/kimi-k2/icon-color.svg +1 -0
- package/plugins/kimi-k2/icon.svg +1 -0
- package/plugins/kimi-k2/plugin.js +58 -0
- package/plugins/kimi-k2/plugin.json +18 -0
- package/plugins/kiro/icon-color.svg +5 -0
- package/plugins/kiro/icon-conflict.svg +1 -0
- package/plugins/kiro/icon.svg +4 -0
- package/plugins/kiro/plugin.js +390 -0
- package/plugins/kiro/plugin.json +16 -0
- package/plugins/litellm/icon.svg +16 -0
- package/plugins/litellm/plugin.js +199 -0
- package/plugins/litellm/plugin.json +16 -0
- package/plugins/llm-proxy/icon.svg +1 -0
- package/plugins/llm-proxy/plugin.js +40 -0
- package/plugins/llm-proxy/plugin.json +17 -0
- package/plugins/manus/icon.svg +6 -0
- package/plugins/manus/plugin.js +50 -0
- package/plugins/manus/plugin.json +17 -0
- package/plugins/mimo/icon.svg +1 -0
- package/plugins/mimo/plugin.js +177 -0
- package/plugins/mimo/plugin.json +19 -0
- package/plugins/minimax/icon-color.svg +1 -0
- package/plugins/minimax/icon-conflict.svg +4 -0
- package/plugins/minimax/icon.svg +1 -0
- package/plugins/minimax/plugin.js +453 -0
- package/plugins/minimax/plugin.json +14 -0
- package/plugins/mistral/icon-color.svg +1 -0
- package/plugins/mistral/icon.svg +1 -0
- package/plugins/mistral/plugin.js +152 -0
- package/plugins/mistral/plugin.json +18 -0
- package/plugins/moonshot/icon.svg +1 -0
- package/plugins/moonshot/plugin.js +43 -0
- package/plugins/moonshot/plugin.json +16 -0
- package/plugins/nanogpt/icon-color.svg +17 -0
- package/plugins/nanogpt/icon.svg +10 -0
- package/plugins/nanogpt/plugin.js +80 -0
- package/plugins/nanogpt/plugin.json +17 -0
- package/plugins/neuralwatt/icon.svg +3 -0
- package/plugins/neuralwatt/plugin.js +152 -0
- package/plugins/neuralwatt/plugin.json +17 -0
- package/plugins/ollama/icon.svg +1 -0
- package/plugins/ollama/plugin.js +92 -0
- package/plugins/ollama/plugin.json +20 -0
- package/plugins/openai-api/icon.svg +1 -0
- package/plugins/openai-api/plugin.js +533 -0
- package/plugins/openai-api/plugin.json +26 -0
- package/plugins/opencode/icon.svg +1 -0
- package/plugins/opencode/plugin.js +342 -0
- package/plugins/opencode/plugin.json +19 -0
- package/plugins/opencode-go/icon-conflict.svg +1 -0
- package/plugins/opencode-go/icon.svg +1 -0
- package/plugins/opencode-go/plugin.js +617 -0
- package/plugins/opencode-go/plugin.json +50 -0
- package/plugins/openrouter/icon.svg +1 -0
- package/plugins/openrouter/plugin.js +156 -0
- package/plugins/openrouter/plugin.json +8 -0
- package/plugins/perplexity/icon-color.svg +1 -0
- package/plugins/perplexity/icon-conflict.svg +1 -0
- package/plugins/perplexity/icon.svg +1 -0
- package/plugins/perplexity/plugin.js +425 -0
- package/plugins/perplexity/plugin.json +19 -0
- package/plugins/poe/icon.svg +1 -0
- package/plugins/poe/plugin.js +190 -0
- package/plugins/poe/plugin.json +19 -0
- package/plugins/stepfun/icon-color.svg +1 -0
- package/plugins/stepfun/icon.svg +1 -0
- package/plugins/stepfun/plugin.js +155 -0
- package/plugins/stepfun/plugin.json +18 -0
- package/plugins/synthetic/icon-conflict.svg +12 -0
- package/plugins/synthetic/icon.svg +14 -0
- package/plugins/synthetic/plugin.js +331 -0
- package/plugins/synthetic/plugin.json +23 -0
- package/plugins/t3chat/icon-color.svg +28 -0
- package/plugins/t3chat/icon.svg +4 -0
- package/plugins/t3chat/plugin.js +243 -0
- package/plugins/t3chat/plugin.json +20 -0
- package/plugins/venice/icon-color.svg +1 -0
- package/plugins/venice/icon.svg +1 -0
- package/plugins/venice/plugin.js +69 -0
- package/plugins/venice/plugin.json +16 -0
- package/plugins/vertex-ai/icon-color.svg +1 -0
- package/plugins/vertex-ai/icon.svg +1 -0
- package/plugins/vertex-ai/plugin.js +172 -0
- package/plugins/vertex-ai/plugin.json +18 -0
- package/plugins/warp/icon-color.svg +10 -0
- package/plugins/warp/icon.svg +6 -0
- package/plugins/warp/plugin.js +108 -0
- package/plugins/warp/plugin.json +18 -0
- package/plugins/windsurf/icon-conflict.svg +3 -0
- package/plugins/windsurf/icon.svg +1 -0
- package/plugins/windsurf/plugin.js +208 -0
- package/plugins/windsurf/plugin.json +16 -0
- package/plugins/zai/icon-conflict.svg +5 -0
- package/plugins/zai/icon.svg +1 -0
- package/plugins/zai/plugin.js +188 -0
- package/plugins/zai/plugin.json +16 -0
- package/plugins/zed/icon.svg +4 -0
- package/plugins/zed/plugin.js +270 -0
- package/plugins/zed/plugin.json +19 -0
- package/usagestat +0 -0
- package/usagestatd +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "codex",
|
|
4
|
+
"name": "Codex",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"icon": "icon.svg",
|
|
8
|
+
"brandColor": "#74AA9C",
|
|
9
|
+
"links": [
|
|
10
|
+
{
|
|
11
|
+
"label": "Status",
|
|
12
|
+
"url": "https://status.openai.com/"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"label": "Usage dashboard",
|
|
16
|
+
"url": "https://chatgpt.com/codex/cloud/settings/analytics#usage"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"supportedModes": ["oauth", "local", "web"],
|
|
20
|
+
"autoMode": "oauth",
|
|
21
|
+
"webUrl": "https://chatgpt.com",
|
|
22
|
+
"lines": [
|
|
23
|
+
{
|
|
24
|
+
"type": "progress",
|
|
25
|
+
"label": "Session",
|
|
26
|
+
"scope": "overview",
|
|
27
|
+
"primaryOrder": 1
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "progress",
|
|
31
|
+
"label": "Weekly",
|
|
32
|
+
"scope": "overview",
|
|
33
|
+
"primaryOrder": 2
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "progress",
|
|
37
|
+
"label": "Spark",
|
|
38
|
+
"scope": "detail"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "progress",
|
|
42
|
+
"label": "Spark Weekly",
|
|
43
|
+
"scope": "detail"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "progress",
|
|
47
|
+
"label": "Reviews",
|
|
48
|
+
"scope": "detail",
|
|
49
|
+
"primaryOrder": 3
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "text",
|
|
53
|
+
"label": "Rate Limit Resets",
|
|
54
|
+
"scope": "detail"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "text",
|
|
58
|
+
"label": "Credits",
|
|
59
|
+
"scope": "detail"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "text",
|
|
63
|
+
"label": "Today",
|
|
64
|
+
"scope": "detail"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "text",
|
|
68
|
+
"label": "Yesterday",
|
|
69
|
+
"scope": "detail"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "text",
|
|
73
|
+
"label": "Last 30 Days",
|
|
74
|
+
"scope": "detail"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "barChart",
|
|
78
|
+
"label": "Usage Trend",
|
|
79
|
+
"scope": "detail"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M38 38H27C20.925 38 16 33.075 16 27C16 20.925 20.925 16 27 16C33.075 16 38 20.925 38 27V73C38 79.075 33.075 84 27 84C20.925 84 16 79.075 16 73C16 66.925 20.925 62 27 62H73C79.075 62 84 66.925 84 73C84 79.075 79.075 84 73 84C66.925 84 62 79.075 62 73V27C62 20.925 66.925 16 73 16C79.075 16 84 20.925 84 27C84 33.075 79.075 38 73 38H38V62" stroke="currentColor" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
var AUTH_FILE = "~/.commandcode/auth.json";
|
|
3
|
+
var API_BASE = "https://api.commandcode.ai";
|
|
4
|
+
var ERR_NOT_LOGGED_IN = "Not logged in. Run `cmd login` to authenticate.";
|
|
5
|
+
|
|
6
|
+
var PLAN_LABELS = {
|
|
7
|
+
"individual-go": "Individual Go",
|
|
8
|
+
"individual": "Individual",
|
|
9
|
+
"pro": "Pro",
|
|
10
|
+
"team": "Team",
|
|
11
|
+
"enterprise": "Enterprise",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function readNumber(value) {
|
|
15
|
+
var n = Number(value);
|
|
16
|
+
return Number.isFinite(n) ? n : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function trimString(value) {
|
|
20
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function loadApiKeyFromEnv(ctx) {
|
|
24
|
+
try {
|
|
25
|
+
return trimString(ctx.host.env.get("COMMAND_CODE_API_KEY"));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
ctx.host.log.warn("COMMAND_CODE_API_KEY read failed: " + String(e));
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function loadApiKeyFromSettings(ctx) {
|
|
33
|
+
var settings = ctx.provider && ctx.provider.settings ? ctx.provider.settings : {};
|
|
34
|
+
return trimString(settings.apiKey) ||
|
|
35
|
+
trimString(settings.token) ||
|
|
36
|
+
(ctx.provider && trimString(ctx.provider.apiKey));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function loadApiKeyFromFile(ctx) {
|
|
40
|
+
if (!ctx.host.fs.exists(AUTH_FILE)) return null;
|
|
41
|
+
try {
|
|
42
|
+
var text = ctx.host.fs.readText(AUTH_FILE);
|
|
43
|
+
var parsed = ctx.util.tryParseJson(text);
|
|
44
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
45
|
+
return trimString(parsed.apiKey);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
ctx.host.log.warn("Command Code auth file read failed: " + String(e));
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function loadApiKey(ctx) {
|
|
53
|
+
return loadApiKeyFromSettings(ctx) || loadApiKeyFromEnv(ctx) || loadApiKeyFromFile(ctx);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function apiCall(ctx, url, apiKey) {
|
|
57
|
+
try {
|
|
58
|
+
var resp = ctx.host.http.request({
|
|
59
|
+
method: "GET",
|
|
60
|
+
url: url,
|
|
61
|
+
headers: {
|
|
62
|
+
Authorization: "Bearer " + apiKey,
|
|
63
|
+
"Content-Type": "application/json",
|
|
64
|
+
Accept: "application/json",
|
|
65
|
+
"User-Agent": "OpenUsage",
|
|
66
|
+
},
|
|
67
|
+
timeoutMs: 10000,
|
|
68
|
+
});
|
|
69
|
+
if (resp.status < 200 || resp.status >= 300) {
|
|
70
|
+
ctx.host.log.warn("Command Code API call failed: " + url + " status=" + resp.status);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
var parsed = ctx.util.tryParseJson(resp.bodyText);
|
|
74
|
+
if (!parsed) {
|
|
75
|
+
ctx.host.log.warn("Command Code API response was not valid JSON: " + url);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return parsed;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
ctx.host.log.error("Command Code API call exception: " + url + " " + String(e));
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function fmtTokens(n) {
|
|
86
|
+
var abs = Math.abs(n);
|
|
87
|
+
var sign = n < 0 ? "-" : "";
|
|
88
|
+
var units = [
|
|
89
|
+
{ threshold: 1e9, divisor: 1e9, suffix: "B" },
|
|
90
|
+
{ threshold: 1e6, divisor: 1e6, suffix: "M" },
|
|
91
|
+
{ threshold: 1e3, divisor: 1e3, suffix: "K" },
|
|
92
|
+
];
|
|
93
|
+
for (var i = 0; i < units.length; i++) {
|
|
94
|
+
var unit = units[i];
|
|
95
|
+
if (abs >= unit.threshold) {
|
|
96
|
+
var scaled = abs / unit.divisor;
|
|
97
|
+
var formatted = scaled >= 10 ? Math.round(scaled).toString() : scaled.toFixed(1).replace(/\.0$/, "");
|
|
98
|
+
return sign + formatted + unit.suffix;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return sign + Math.round(abs).toString();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function probe(ctx) {
|
|
105
|
+
var apiKey = loadApiKey(ctx);
|
|
106
|
+
if (!apiKey) {
|
|
107
|
+
throw ERR_NOT_LOGGED_IN;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var whoami = apiCall(ctx, API_BASE + "/alpha/whoami", apiKey);
|
|
111
|
+
if (!whoami) {
|
|
112
|
+
throw "Command Code API unreachable. Check your connection.";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
var creditsResp = apiCall(ctx, API_BASE + "/alpha/billing/credits", apiKey);
|
|
116
|
+
var usageResp = apiCall(ctx, API_BASE + "/alpha/usage/summary", apiKey);
|
|
117
|
+
var subResp = apiCall(ctx, API_BASE + "/alpha/billing/subscriptions", apiKey);
|
|
118
|
+
|
|
119
|
+
var creditsRemaining = null;
|
|
120
|
+
if (creditsResp && creditsResp.credits && typeof creditsResp.credits === "object") {
|
|
121
|
+
creditsRemaining = readNumber(creditsResp.credits.monthlyCredits);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var totalCost = null;
|
|
125
|
+
var monthlyUsed = null;
|
|
126
|
+
var totalTokens = null;
|
|
127
|
+
var models = [];
|
|
128
|
+
if (usageResp && typeof usageResp === "object") {
|
|
129
|
+
totalCost = readNumber(usageResp.totalCost);
|
|
130
|
+
monthlyUsed = readNumber(usageResp.totalMonthlyCredits);
|
|
131
|
+
totalTokens = readNumber(usageResp.totalTokens);
|
|
132
|
+
if (Array.isArray(usageResp.models)) models = usageResp.models;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var planLabel = null;
|
|
136
|
+
if (subResp && subResp.success && subResp.data && typeof subResp.data.planId === "string") {
|
|
137
|
+
var planId = subResp.data.planId;
|
|
138
|
+
planLabel = PLAN_LABELS[planId] || ctx.fmt.planLabel(planId);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var lines = [];
|
|
142
|
+
if (creditsRemaining !== null && monthlyUsed !== null) {
|
|
143
|
+
var totalPlan = monthlyUsed + Math.max(0, creditsRemaining);
|
|
144
|
+
var usedPercent = totalPlan > 0 ? (monthlyUsed / totalPlan) * 100 : 100;
|
|
145
|
+
lines.push(ctx.line.progress({
|
|
146
|
+
label: "Monthly credits",
|
|
147
|
+
used: Math.max(0, Math.min(100, Math.round(usedPercent * 10) / 10)),
|
|
148
|
+
limit: 100,
|
|
149
|
+
format: { kind: "percent" },
|
|
150
|
+
periodDurationMs: 30 * 24 * 60 * 60 * 1000,
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (totalCost !== null && totalCost > 0) {
|
|
155
|
+
lines.push(ctx.line.text({ label: "Total spent", value: "$" + totalCost.toFixed(2) }));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (totalTokens !== null && totalTokens > 0) {
|
|
159
|
+
lines.push(ctx.line.text({ label: "Tokens used", value: fmtTokens(Math.round(totalTokens)) }));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
var modelParts = [];
|
|
163
|
+
for (var i = 0; i < models.length; i++) {
|
|
164
|
+
var m = models[i];
|
|
165
|
+
if (!m || typeof m !== "object") continue;
|
|
166
|
+
var name = m.model || m.name;
|
|
167
|
+
if (typeof name !== "string" || !name.trim()) continue;
|
|
168
|
+
var cost = readNumber(m.totalCost) || 0;
|
|
169
|
+
var count = readNumber(m.count) || 0;
|
|
170
|
+
var shortName = name.indexOf("/") >= 0 ? name.slice(name.indexOf("/") + 1) : name;
|
|
171
|
+
var detail = shortName;
|
|
172
|
+
if (cost > 0) detail += " $" + cost.toFixed(2);
|
|
173
|
+
if (count > 0) detail += " (" + count + " calls)";
|
|
174
|
+
modelParts.push(detail);
|
|
175
|
+
}
|
|
176
|
+
if (modelParts.length > 0) {
|
|
177
|
+
lines.push(ctx.line.text({ label: "Models", value: modelParts.join(" ") }));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return { plan: planLabel, lines: lines };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
globalThis.__openusage_plugin = { id: "command-code", probe: probe };
|
|
184
|
+
})();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "command-code",
|
|
4
|
+
"name": "Command Code",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"brandColor": "#000000",
|
|
8
|
+
"links": [
|
|
9
|
+
{ "label": "Studio", "url": "https://commandcode.ai/studio" }
|
|
10
|
+
],
|
|
11
|
+
"supportedModes": ["web"],
|
|
12
|
+
"autoMode": "web",
|
|
13
|
+
"webUrl": "https://commandcode.ai",
|
|
14
|
+
"lines": [
|
|
15
|
+
{ "type": "progress", "label": "Monthly credits", "scope": "overview", "primaryOrder": 1 },
|
|
16
|
+
{ "type": "text", "label": "Total spent", "scope": "overview" },
|
|
17
|
+
{ "type": "text", "label": "Tokens used", "scope": "detail" },
|
|
18
|
+
{ "type": "text", "label": "Models", "scope": "detail" }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Copilot</title><path d="M17.533 1.829A2.528 2.528 0 0015.11 0h-.737a2.531 2.531 0 00-2.484 2.087l-1.263 6.937.314-1.08a2.528 2.528 0 012.424-1.833h4.284l1.797.706 1.731-.706h-.505a2.528 2.528 0 01-2.423-1.829l-.715-2.453z" fill="url(#lobe-icons-copilot-0-_R_0_)" transform="translate(0 1)"></path><path d="M6.726 20.16A2.528 2.528 0 009.152 22h1.566c1.37 0 2.49-1.1 2.525-2.48l.17-6.69-.357 1.228a2.528 2.528 0 01-2.423 1.83h-4.32l-1.54-.842-1.667.843h.497c1.124 0 2.113.75 2.426 1.84l.697 2.432z" fill="url(#lobe-icons-copilot-1-_R_0_)" transform="translate(0 1)"></path><path d="M15 0H6.252c-2.5 0-4 3.331-5 6.662-1.184 3.947-2.734 9.225 1.75 9.225H6.78c1.13 0 2.12-.753 2.43-1.847.657-2.317 1.809-6.359 2.713-9.436.46-1.563.842-2.906 1.43-3.742A1.97 1.97 0 0115 0" fill="url(#lobe-icons-copilot-2-_R_0_)" transform="translate(0 1)"></path><path d="M15 0H6.252c-2.5 0-4 3.331-5 6.662-1.184 3.947-2.734 9.225 1.75 9.225H6.78c1.13 0 2.12-.753 2.43-1.847.657-2.317 1.809-6.359 2.713-9.436.46-1.563.842-2.906 1.43-3.742A1.97 1.97 0 0115 0" fill="url(#lobe-icons-copilot-3-_R_0_)" transform="translate(0 1)"></path><path d="M9 22h8.749c2.5 0 4-3.332 5-6.663 1.184-3.948 2.734-9.227-1.75-9.227H17.22c-1.129 0-2.12.754-2.43 1.848a1149.2 1149.2 0 01-2.713 9.437c-.46 1.564-.842 2.907-1.43 3.743A1.97 1.97 0 019 22" fill="url(#lobe-icons-copilot-4-_R_0_)" transform="translate(0 1)"></path><path d="M9 22h8.749c2.5 0 4-3.332 5-6.663 1.184-3.948 2.734-9.227-1.75-9.227H17.22c-1.129 0-2.12.754-2.43 1.848a1149.2 1149.2 0 01-2.713 9.437c-.46 1.564-.842 2.907-1.43 3.743A1.97 1.97 0 019 22" fill="url(#lobe-icons-copilot-5-_R_0_)" transform="translate(0 1)"></path><defs><radialGradient cx="85.44%" cy="100.653%" fx="85.44%" fy="100.653%" gradientTransform="scale(-.8553 -1) rotate(50.927 2.041 -1.946)" id="lobe-icons-copilot-0-_R_0_" r="105.116%"><stop offset="9.6%" stop-color="#00AEFF"></stop><stop offset="77.3%" stop-color="#2253CE"></stop><stop offset="100%" stop-color="#0736C4"></stop></radialGradient><radialGradient cx="18.143%" cy="32.928%" fx="18.143%" fy="32.928%" gradientTransform="scale(.8897 1) rotate(52.069 .193 .352)" id="lobe-icons-copilot-1-_R_0_" r="95.612%"><stop offset="0%" stop-color="#FFB657"></stop><stop offset="63.4%" stop-color="#FF5F3D"></stop><stop offset="92.3%" stop-color="#C02B3C"></stop></radialGradient><radialGradient cx="82.987%" cy="-9.792%" fx="82.987%" fy="-9.792%" gradientTransform="scale(-1 -.9441) rotate(-70.872 .142 1.17)" id="lobe-icons-copilot-4-_R_0_" r="140.622%"><stop offset="6.6%" stop-color="#8C48FF"></stop><stop offset="50%" stop-color="#F2598A"></stop><stop offset="89.6%" stop-color="#FFB152"></stop></radialGradient><linearGradient id="lobe-icons-copilot-2-_R_0_" x1="39.465%" x2="46.884%" y1="12.117%" y2="103.774%"><stop offset="15.6%" stop-color="#0D91E1"></stop><stop offset="48.7%" stop-color="#52B471"></stop><stop offset="65.2%" stop-color="#98BD42"></stop><stop offset="93.7%" stop-color="#FFC800"></stop></linearGradient><linearGradient id="lobe-icons-copilot-3-_R_0_" x1="45.949%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#3DCBFF"></stop><stop offset="24.7%" stop-color="#0588F7" stop-opacity="0"></stop></linearGradient><linearGradient id="lobe-icons-copilot-5-_R_0_" x1="83.507%" x2="83.453%" y1="-6.106%" y2="21.131%"><stop offset="5.8%" stop-color="#F8ADFA"></stop><stop offset="70.8%" stop-color="#A86EDD" stop-opacity="0"></stop></linearGradient></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>GithubCopilot</title><path d="M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"></path></svg>
|