@hashimkarim/usagestat-darwin-arm64 2.0.0-alpha.3 → 2.3.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/native-manifest.json +1532 -134
- package/package.json +235 -2
- package/plugins/UPSTREAM-LICENSES.md +6 -2
- package/plugins/_provider-icons/LICENSE +21 -0
- package/plugins/_provider-icons/NOTICE +12 -0
- package/plugins/_provider-icons/licenses/CodexBar-MIT.txt +21 -0
- package/plugins/_provider-icons/licenses/LobeHub-MIT.txt +21 -0
- package/plugins/_provider-icons/licenses/UsageStat-Bar-MIT.txt +21 -0
- package/plugins/_provider-icons/manifest.json +1219 -0
- package/plugins/_provider-icons/provenance.json +269 -0
- package/plugins/_provider-icons/source.json +4 -0
- package/plugins/abacus-ai/icon-color.svg +18 -0
- package/plugins/abliteration/LICENSE +21 -0
- package/plugins/abliteration/icon.svg +5 -0
- package/plugins/abliteration/plugin.js +89 -0
- package/plugins/abliteration/plugin.json +24 -0
- package/plugins/aerostack/LICENSE +21 -0
- package/plugins/aerostack/icon.svg +1 -0
- package/plugins/aerostack/plugin.js +94 -0
- package/plugins/aerostack/plugin.json +24 -0
- package/plugins/aixy/LICENSE +21 -0
- package/plugins/aixy/icon.svg +1 -0
- package/plugins/aixy/plugin.js +266 -0
- package/plugins/aixy/plugin.json +32 -0
- package/plugins/antigravity/plugin.js +189 -65
- package/plugins/antigravity-cli/icon-color.svg +1 -0
- package/plugins/antigravity-cli/icon.svg +1 -3
- package/plugins/antigravity-cli/plugin.js +32 -20
- package/plugins/antigravity-ide/icon-color.svg +1 -0
- package/plugins/antigravity-ide/icon.svg +1 -3
- package/plugins/antigravity-ide/plugin.js +19 -7
- package/plugins/atlascloud/LICENSE +21 -0
- package/plugins/atlascloud/icon-color.svg +1 -0
- package/plugins/atlascloud/icon.svg +1 -0
- package/plugins/atlascloud/plugin.js +54 -0
- package/plugins/atlascloud/plugin.json +24 -0
- package/plugins/augment/icon-color.svg +14 -0
- package/plugins/bifrost/LICENSE +21 -0
- package/plugins/bifrost/icon.svg +3 -0
- package/plugins/bifrost/plugin.js +366 -0
- package/plugins/bifrost/plugin.json +31 -0
- package/plugins/chatbox/LICENSE +21 -0
- package/plugins/chatbox/icon.svg +4 -0
- package/plugins/chatbox/plugin.js +208 -0
- package/plugins/chatbox/plugin.json +24 -0
- package/plugins/claude/plugin.js +340 -153
- package/plugins/claude/plugin.json +1 -1
- package/plugins/claudeplatform/LICENSE +21 -0
- package/plugins/claudeplatform/icon.svg +3 -0
- package/plugins/claudeplatform/plugin.js +244 -0
- package/plugins/claudeplatform/plugin.json +25 -0
- package/plugins/clinepass/plugin.js +19 -3
- package/plugins/codebuff/icon-color.svg +92 -0
- package/plugins/coderabbit/plugin.js +25 -0
- package/plugins/coderabbit/plugin.json +12 -0
- package/plugins/codex/plugin.js +15 -8
- package/plugins/codex/plugin.json +11 -2
- package/plugins/command-code/icon-color.svg +3 -0
- package/plugins/command-code/plugin.js +7 -3
- package/plugins/copilot/icon.svg +1 -1
- package/plugins/copilot/plugin.json +1 -0
- package/plugins/cosmic/LICENSE +21 -0
- package/plugins/cosmic/icon.svg +1 -0
- package/plugins/cosmic/plugin.js +134 -0
- package/plugins/cosmic/plugin.json +32 -0
- package/plugins/crof/icon-color.svg +3 -0
- package/plugins/crofai/icon-color.svg +3 -0
- package/plugins/crofai/icon.svg +2 -15
- package/plugins/cursor/icon-color.svg +1 -0
- package/plugins/cursor/plugin.js +51 -14
- package/plugins/cursor-nightly/plugin.json +1 -1
- package/plugins/deepinfra/icon-color.svg +1 -0
- package/plugins/deepinfra/icon.svg +1 -4
- package/plugins/deepseek/plugin.js +150 -59
- package/plugins/deepseek/plugin.json +3 -1
- package/plugins/devin/plugin.js +3 -0
- package/plugins/devpass/LICENSE +21 -0
- package/plugins/devpass/icon.svg +3 -0
- package/plugins/devpass/plugin.js +120 -0
- package/plugins/devpass/plugin.json +24 -0
- package/plugins/elevenlabs/icon-color.svg +4 -0
- package/plugins/exa/LICENSE +21 -0
- package/plugins/exa/icon-color.svg +1 -0
- package/plugins/exa/icon.svg +1 -0
- package/plugins/exa/plugin.js +75 -0
- package/plugins/exa/plugin.json +32 -0
- package/plugins/factory/icon-color.svg +1 -0
- package/plugins/fal/LICENSE +21 -0
- package/plugins/fal/icon-color.svg +1 -0
- package/plugins/fal/icon.svg +1 -0
- package/plugins/fal/plugin.js +74 -0
- package/plugins/fal/plugin.json +24 -0
- package/plugins/fireworks-ai/icon-color.svg +1 -0
- package/plugins/fireworks-ai/icon.svg +1 -6
- package/plugins/flora/LICENSE +21 -0
- package/plugins/flora/icon.svg +4 -0
- package/plugins/flora/plugin.js +93 -0
- package/plugins/flora/plugin.json +32 -0
- package/plugins/futureagi/LICENSE +21 -0
- package/plugins/futureagi/icon.svg +24 -0
- package/plugins/futureagi/plugin.js +139 -0
- package/plugins/futureagi/plugin.json +32 -0
- package/plugins/gemini-apps/LICENSE +21 -0
- package/plugins/gemini-apps/icon-color.svg +1 -0
- package/plugins/gemini-apps/icon.svg +1 -0
- package/plugins/gemini-apps/plugin.js +141 -0
- package/plugins/gemini-apps/plugin.json +25 -0
- package/plugins/gitkraken/LICENSE +21 -0
- package/plugins/gitkraken/icon.svg +2 -0
- package/plugins/gitkraken/plugin.js +158 -0
- package/plugins/gitkraken/plugin.json +32 -0
- package/plugins/googledeveloper/LICENSE +21 -0
- package/plugins/googledeveloper/icon.svg +3 -0
- package/plugins/googledeveloper/plugin.js +204 -0
- package/plugins/googledeveloper/plugin.json +25 -0
- package/plugins/grok/icon-color.svg +1 -0
- package/plugins/groqcloud/icon-color.svg +1 -0
- package/plugins/helmcode/LICENSE +21 -0
- package/plugins/helmcode/icon.svg +5 -0
- package/plugins/helmcode/plugin.js +253 -0
- package/plugins/helmcode/plugin.json +32 -0
- package/plugins/huggingface/LICENSE +21 -0
- package/plugins/huggingface/icon-color.svg +1 -0
- package/plugins/huggingface/icon.svg +1 -0
- package/plugins/huggingface/plugin.js +298 -0
- package/plugins/huggingface/plugin.json +26 -0
- package/plugins/hyper/LICENSE +21 -0
- package/plugins/hyper/plugin.js +137 -0
- package/plugins/hyper/plugin.json +27 -0
- package/plugins/jetbrains-ai-assistant/LICENSE +22 -0
- package/plugins/jetbrains-ai-assistant/plugin.js +502 -16
- package/plugins/jetbrains-ai-assistant/plugin.json +27 -4
- package/plugins/kilo/icon-color.svg +1 -0
- package/plugins/kimi/plugin.js +54 -14
- package/plugins/kimi/plugin.json +46 -6
- package/plugins/langdock/LICENSE +21 -0
- package/plugins/langdock/icon.svg +4 -0
- package/plugins/langdock/plugin.js +106 -0
- package/plugins/langdock/plugin.json +25 -0
- package/plugins/linkup/LICENSE +21 -0
- package/plugins/linkup/icon.svg +10 -0
- package/plugins/linkup/plugin.js +46 -0
- package/plugins/linkup/plugin.json +24 -0
- package/plugins/litellm/plugin.js +54 -3
- package/plugins/lithosai/LICENSE +21 -0
- package/plugins/lithosai/icon.svg +1 -0
- package/plugins/lithosai/plugin.js +130 -0
- package/plugins/lithosai/plugin.json +26 -0
- package/plugins/llmman/LICENSE +21 -0
- package/plugins/llmman/icon.svg +4 -0
- package/plugins/llmman/plugin.js +138 -0
- package/plugins/llmman/plugin.json +31 -0
- package/plugins/longcat/icon-color.svg +1 -0
- package/plugins/longcat/icon.svg +1 -4
- package/plugins/manus/icon-color.svg +6 -0
- package/plugins/mimo/icon-color.svg +4 -0
- package/plugins/mimo/icon.svg +4 -1
- package/plugins/mistral/plugin.js +164 -27
- package/plugins/moonshot/icon-color.svg +1 -0
- package/plugins/munito/LICENSE +21 -0
- package/plugins/munito/icon.svg +7 -0
- package/plugins/munito/plugin.js +171 -0
- package/plugins/munito/plugin.json +24 -0
- package/plugins/muse/LICENSE +21 -0
- package/plugins/muse/icon.svg +3 -0
- package/plugins/muse/plugin.js +288 -0
- package/plugins/muse/plugin.json +34 -0
- package/plugins/museai/LICENSE +21 -0
- package/plugins/museai/icon.svg +3 -0
- package/plugins/museai/plugin.js +161 -0
- package/plugins/museai/plugin.json +26 -0
- package/plugins/nous/LICENSE +21 -0
- package/plugins/nous/icon-color.svg +1 -0
- package/plugins/nous/icon.svg +1 -0
- package/plugins/nous/plugin.js +129 -0
- package/plugins/nous/plugin.json +32 -0
- package/plugins/ollama/icon-color.svg +1 -0
- package/plugins/ollama/plugin.js +58 -0
- package/plugins/openai-api/icon-color.svg +1 -0
- package/plugins/opencode/icon-color.svg +1 -0
- package/plugins/opencode-go/icon-color.svg +1 -0
- package/plugins/opencode-go/plugin.js +104 -37
- package/plugins/opendesign/LICENSE +21 -0
- package/plugins/opendesign/icon.svg +4 -0
- package/plugins/opendesign/plugin.js +108 -0
- package/plugins/opendesign/plugin.json +25 -0
- package/plugins/openrouter/icon-color.svg +1 -0
- package/plugins/parallel/LICENSE +21 -0
- package/plugins/parallel/icon.svg +11 -0
- package/plugins/parallel/plugin.js +97 -0
- package/plugins/parallel/plugin.json +25 -0
- package/plugins/perplexity/LICENSE +22 -0
- package/plugins/perplexity/plugin.js +122 -0
- package/plugins/perplexity/plugin.json +36 -7
- package/plugins/pi/plugin.js +113 -0
- package/plugins/pi/plugin.json +11 -0
- package/plugins/qwencloud/LICENSE +21 -0
- package/plugins/qwencloud/icon-color.svg +1 -0
- package/plugins/qwencloud/icon.svg +1 -4
- package/plugins/qwencloud/plugin.js +197 -0
- package/plugins/qwencloud/plugin.json +17 -0
- package/plugins/raycast/LICENSE +21 -0
- package/plugins/raycast/icon.svg +4 -0
- package/plugins/raycast/plugin.js +179 -0
- package/plugins/raycast/plugin.json +32 -0
- package/plugins/replicate/LICENSE +21 -0
- package/plugins/replicate/icon-color.svg +1 -0
- package/plugins/replicate/icon.svg +1 -0
- package/plugins/replicate/plugin.js +170 -0
- package/plugins/replicate/plugin.json +25 -0
- package/plugins/sailresearch/LICENSE +21 -0
- package/plugins/sailresearch/icon.svg +4 -0
- package/plugins/sailresearch/plugin.js +104 -0
- package/plugins/sailresearch/plugin.json +24 -0
- package/plugins/siliconflow/LICENSE +21 -0
- package/plugins/siliconflow/icon.svg +3 -0
- package/plugins/siliconflow/plugin.js +87 -0
- package/plugins/siliconflow/plugin.json +32 -0
- package/plugins/sofya/LICENSE +21 -0
- package/plugins/sofya/icon.svg +3 -0
- package/plugins/sofya/plugin.js +86 -0
- package/plugins/sofya/plugin.json +24 -0
- package/plugins/soniox/LICENSE +21 -0
- package/plugins/soniox/icon.svg +3 -0
- package/plugins/soniox/plugin.js +103 -0
- package/plugins/soniox/plugin.json +24 -0
- package/plugins/synthetic/icon-color.svg +14 -0
- package/plugins/synthetic/plugin.js +12 -0
- package/plugins/synthetic/plugin.json +51 -9
- package/plugins/tavily/LICENSE +21 -0
- package/plugins/tavily/icon.svg +3 -0
- package/plugins/tavily/plugin.js +61 -0
- package/plugins/tavily/plugin.json +24 -0
- package/plugins/tinyapi/LICENSE +21 -0
- package/plugins/tinyapi/icon.svg +4 -0
- package/plugins/tinyapi/plugin.js +73 -0
- package/plugins/tinyapi/plugin.json +25 -0
- package/plugins/traecn/LICENSE +21 -0
- package/plugins/traecn/icon.svg +3 -0
- package/plugins/traecn/plugin.js +103 -0
- package/plugins/traecn/plugin.json +25 -0
- package/plugins/tripo/LICENSE +21 -0
- package/plugins/tripo/icon.svg +4 -0
- package/plugins/tripo/plugin.js +60 -0
- package/plugins/tripo/plugin.json +24 -0
- package/plugins/typesafe/LICENSE +21 -0
- package/plugins/typesafe/icon.svg +4 -0
- package/plugins/typesafe/plugin.js +181 -0
- package/plugins/typesafe/plugin.json +25 -0
- package/plugins/v0/LICENSE +21 -0
- package/plugins/v0/icon-color.svg +1 -0
- package/plugins/v0/icon.svg +1 -0
- package/plugins/v0/plugin.js +219 -0
- package/plugins/v0/plugin.json +32 -0
- package/plugins/venice/plugin.js +50 -1
- package/plugins/venice/plugin.json +2 -1
- package/plugins/vercel/LICENSE +21 -0
- package/plugins/vercel/icon-color.svg +1 -0
- package/plugins/vercel/icon.svg +1 -0
- package/plugins/vercel/plugin.js +202 -0
- package/plugins/vercel/plugin.json +54 -0
- package/plugins/windsurf/icon-color.svg +1 -0
- package/plugins/workbuddy/LICENSE +21 -0
- package/plugins/workbuddy/icon.svg +1 -0
- package/plugins/workbuddy/plugin.js +318 -0
- package/plugins/workbuddy/plugin.json +63 -0
- package/plugins/xai/icon-color.svg +1 -0
- package/plugins/xai/icon.svg +1 -7
- package/plugins/xai/plugin.js +9 -0
- package/plugins/xapi/LICENSE +21 -0
- package/plugins/xapi/icon.svg +1 -0
- package/plugins/xapi/plugin.js +90 -0
- package/plugins/xapi/plugin.json +25 -0
- package/plugins/xkiro/LICENSE +21 -0
- package/plugins/xkiro/icon.svg +1 -0
- package/plugins/xkiro/plugin.js +104 -0
- package/plugins/xkiro/plugin.json +24 -0
- package/plugins/zai/icon-color.svg +1 -0
- package/plugins/zai/plugin.js +5 -1
- package/plugins/zenmux/icon-color.svg +1 -0
- package/plugins/zenmux/icon.svg +1 -3
- package/usagestat +0 -0
- package/usagestatd +0 -0
- package/plugins/cursor-nightly/plugin.js +0 -1416
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Plan","Top-up credits","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/chatbox.js
|
|
5
|
+
function _nullishCoalesce(lhs, rhsFn) {
|
|
6
|
+
if (lhs != null) {
|
|
7
|
+
return lhs;
|
|
8
|
+
} else {
|
|
9
|
+
return rhsFn();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _optionalChain(ops) {
|
|
13
|
+
let lastAccessLHS = undefined;
|
|
14
|
+
let value = ops[0];
|
|
15
|
+
let i = 1;
|
|
16
|
+
while (i < ops.length) {
|
|
17
|
+
const op = ops[i];
|
|
18
|
+
const fn = ops[i + 1];
|
|
19
|
+
i += 2;
|
|
20
|
+
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
if (op === "access" || op === "optionalAccess") {
|
|
24
|
+
lastAccessLHS = value;
|
|
25
|
+
value = fn(value);
|
|
26
|
+
} else if (op === "call" || op === "optionalCall") {
|
|
27
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
28
|
+
lastAccessLHS = undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
defineProvider({
|
|
34
|
+
id: "chatbox",
|
|
35
|
+
name: "Chatbox AI",
|
|
36
|
+
endpoints: ["https://api.chatboxai.app"],
|
|
37
|
+
auth: { type: "header", header: "Authorization", secret: "CHATBOX_LICENSE_KEY" },
|
|
38
|
+
settings: [
|
|
39
|
+
{ key: "CHATBOX_LICENSE_KEY", title: "API key", type: "secure" },
|
|
40
|
+
{ key: "MESSAGES", title: "Chatbox AI", type: "plain" },
|
|
41
|
+
],
|
|
42
|
+
capabilities: ["http-status"],
|
|
43
|
+
async fetchUsage(ctx) {
|
|
44
|
+
const messages = JSON.parse(ctx.settings.get("MESSAGES") || "{}");
|
|
45
|
+
const message = (key, status) => (messages[key] || key) + (status === undefined ? "" : ` (HTTP ${status})`);
|
|
46
|
+
const key = ctx.settings.getSecret("CHATBOX_LICENSE_KEY");
|
|
47
|
+
if (
|
|
48
|
+
!key ||
|
|
49
|
+
key.length > 4096 ||
|
|
50
|
+
/\s/u.test(key) ||
|
|
51
|
+
Array.from(key).some((character) => {
|
|
52
|
+
const code = character.charCodeAt(0);
|
|
53
|
+
return code < 32 || (code >= 127 && code <= 159);
|
|
54
|
+
})
|
|
55
|
+
) {
|
|
56
|
+
throw ctx.fail.authenticationExpired(message("Chatbox AI license key is invalid. Update it in Settings."));
|
|
57
|
+
}
|
|
58
|
+
const response = await ctx.http.get("https://api.chatboxai.app/api/license/detail/realtime", {
|
|
59
|
+
headers: { "Cache-Control": "no-store" },
|
|
60
|
+
});
|
|
61
|
+
const record = (value) => (value && typeof value === "object" && !Array.isArray(value) ? value : undefined);
|
|
62
|
+
const decode = (body) => {
|
|
63
|
+
try {
|
|
64
|
+
return record(JSON.parse(body));
|
|
65
|
+
} catch (error) {
|
|
66
|
+
void error;
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (response.status === 401) {
|
|
71
|
+
throw ctx.fail.authenticationExpired(
|
|
72
|
+
message("Chatbox AI license key is invalid. Update it in Settings.", response.status),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (response.status === 403) {
|
|
76
|
+
throw ctx.fail.permissionDenied(message("Chatbox AI denied access. Check your license.", response.status));
|
|
77
|
+
}
|
|
78
|
+
if (response.status === 429) {
|
|
79
|
+
const delay = Number(_nullishCoalesce(response.headers["retry-after"], () => 1));
|
|
80
|
+
throw ctx.fail.rateLimited(message("Chatbox AI is rate limiting requests. Try again later.", response.status), {
|
|
81
|
+
retryAfterSeconds: Number.isFinite(delay) && delay >= 0 ? Math.min(delay, 10) : 1,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (response.status >= 500) {
|
|
85
|
+
throw ctx.fail.providerUnavailable(message("Chatbox AI request failed. Try refreshing later.", response.status));
|
|
86
|
+
}
|
|
87
|
+
if (response.status !== 200) {
|
|
88
|
+
throw ctx.fail.apiFailure(message("Chatbox AI request failed. Try refreshing later.", response.status));
|
|
89
|
+
}
|
|
90
|
+
const fail = () => {
|
|
91
|
+
throw ctx.fail.parseFailure(
|
|
92
|
+
message("Chatbox AI returned an unrecognized response. Update CodexBar and try again."),
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
const root = decode(response.bodyText);
|
|
96
|
+
const data = record(_optionalChain([root, "optionalAccess", (_) => _.data]));
|
|
97
|
+
if (!data || _optionalChain([root, "optionalAccess", (_2) => _2.error])) return fail();
|
|
98
|
+
const now = ctx.date.now().getTime();
|
|
99
|
+
const text = (value) =>
|
|
100
|
+
typeof value === "string"
|
|
101
|
+
? Array.from(value, (character) => {
|
|
102
|
+
const code = character.charCodeAt(0);
|
|
103
|
+
return code < 32 || code === 127 ? " " : character;
|
|
104
|
+
})
|
|
105
|
+
.join("")
|
|
106
|
+
.trim()
|
|
107
|
+
.slice(0, 100) || undefined
|
|
108
|
+
: undefined;
|
|
109
|
+
const counter = (value) => {
|
|
110
|
+
if (value === undefined || value === null) return undefined;
|
|
111
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : fail();
|
|
112
|
+
};
|
|
113
|
+
const date = (value) => {
|
|
114
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T/.test(value)) return undefined;
|
|
115
|
+
const parsed = new Date(value);
|
|
116
|
+
return Number.isFinite(parsed.getTime()) && parsed.getUTCFullYear() >= 1970 ? parsed : undefined;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const pool = (object, usedKey, limitKey) => {
|
|
120
|
+
const used = counter(object[usedKey]);
|
|
121
|
+
const limit = counter(object[limitKey]);
|
|
122
|
+
return used !== undefined && limit !== undefined ? { used, limit } : undefined;
|
|
123
|
+
};
|
|
124
|
+
const rows = [];
|
|
125
|
+
const addPool = (label, value) => {
|
|
126
|
+
if (!value || (value.used === 0 && value.limit === 0)) return;
|
|
127
|
+
const remaining = Math.max(value.limit - value.used, 0);
|
|
128
|
+
rows.push({
|
|
129
|
+
label,
|
|
130
|
+
value: `${ctx.format.number(remaining)} / ${ctx.format.number(value.limit)}`,
|
|
131
|
+
usageValue: value.used,
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const details = data.unified_token_usage_details;
|
|
135
|
+
let plan;
|
|
136
|
+
let detailRewards;
|
|
137
|
+
if (details !== undefined && details !== null) {
|
|
138
|
+
if (!Array.isArray(details) || details.length > 100) return fail();
|
|
139
|
+
for (const entry of details) {
|
|
140
|
+
const item = record(entry);
|
|
141
|
+
if (!item || typeof item.type !== "string") return fail();
|
|
142
|
+
const value = pool(item, "token_usage", "token_limit");
|
|
143
|
+
if (item.type === "plan") {
|
|
144
|
+
if (plan) return fail();
|
|
145
|
+
plan = value;
|
|
146
|
+
} else if (value) {
|
|
147
|
+
const expires = date(item.expires_at);
|
|
148
|
+
if (expires && expires.getTime() <= now) continue;
|
|
149
|
+
detailRewards = {
|
|
150
|
+
used:
|
|
151
|
+
_nullishCoalesce(_optionalChain([detailRewards, "optionalAccess", (_3) => _3.used]), () => 0) +
|
|
152
|
+
value.used,
|
|
153
|
+
limit:
|
|
154
|
+
_nullishCoalesce(_optionalChain([detailRewards, "optionalAccess", (_4) => _4.limit]), () => 0) +
|
|
155
|
+
value.limit,
|
|
156
|
+
};
|
|
157
|
+
if (!Number.isSafeInteger(detailRewards.used) || !Number.isSafeInteger(detailRewards.limit)) return fail();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const total = pool(data, "unified_token_usage", "unified_token_limit");
|
|
162
|
+
const rewardRecord = record(data.aggregated_reward_details);
|
|
163
|
+
if (data.aggregated_reward_details != null && !rewardRecord) return fail();
|
|
164
|
+
const rewards = rewardRecord ? pool(rewardRecord, "token_usage", "token_limit") : detailRewards;
|
|
165
|
+
const expansion = pool(data, "expansion_pack_usage", "expansion_pack_limit");
|
|
166
|
+
const images = pool(data, "image_used_count", "image_total_quota");
|
|
167
|
+
if (!plan && !total && !rewards && !expansion && !images) return fail();
|
|
168
|
+
addPool("Plan", plan);
|
|
169
|
+
if (!plan) addPool("Quota", total);
|
|
170
|
+
addPool("Credits", rewards);
|
|
171
|
+
addPool("Top-up credits", expansion);
|
|
172
|
+
addPool("Image Generation", images);
|
|
173
|
+
const name = text(data.name);
|
|
174
|
+
const status = text(data.status);
|
|
175
|
+
const expires = _nullishCoalesce(date(data.token_expire_time), () => date(data.expires_at));
|
|
176
|
+
const next = date(data.token_next_refresh_time);
|
|
177
|
+
const usablePlan = (status === undefined || status === "active") && (!expires || expires.getTime() > now);
|
|
178
|
+
// Trial has no positive plan pool. Rewards and image totals do not share the plan's reset schedule.
|
|
179
|
+
const reset =
|
|
180
|
+
usablePlan &&
|
|
181
|
+
plan &&
|
|
182
|
+
plan.limit > 0 &&
|
|
183
|
+
next &&
|
|
184
|
+
next.getTime() > now &&
|
|
185
|
+
(!expires || next.getTime() < expires.getTime())
|
|
186
|
+
? next
|
|
187
|
+
: undefined;
|
|
188
|
+
if (rows.length === 0) rows.push({ label: "Quota", value: "0 / 0", usageValue: 0 });
|
|
189
|
+
return {
|
|
190
|
+
primary:
|
|
191
|
+
usablePlan && plan && plan.limit > 0
|
|
192
|
+
? {
|
|
193
|
+
usedPercent: ctx.pct(plan.used, plan.limit),
|
|
194
|
+
resetsAt: reset,
|
|
195
|
+
}
|
|
196
|
+
: undefined,
|
|
197
|
+
secondary:
|
|
198
|
+
expansion && expansion.limit > 0 ? { usedPercent: ctx.pct(expansion.used, expansion.limit) } : undefined,
|
|
199
|
+
identity: name ? { loginMethod: name } : undefined,
|
|
200
|
+
details: [{ title: "Remaining", rows }],
|
|
201
|
+
subscriptionExpiresAt: expires,
|
|
202
|
+
dataConfidence: "exact",
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// END UPSTREAM
|
|
208
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "chatbox",
|
|
4
|
+
"name": "Chatbox AI",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"usageDashboardUrl": "https://chatboxai.app",
|
|
13
|
+
"envVars": [
|
|
14
|
+
"CHATBOX_LICENSE_KEY"
|
|
15
|
+
],
|
|
16
|
+
"setupFields": [],
|
|
17
|
+
"upstream": {
|
|
18
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
19
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
20
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/chatbox.js",
|
|
21
|
+
"sha256": "cf0ae84410aa3794635c0df1edf4936ae514a070968a189dc6ef613c5445f957",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
|
24
|
+
}
|