@hashimkarim/usagestat-linux-x64-gnu 2.0.2 → 2.2.0
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 +808 -148
- package/package.json +112 -2
- 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/icon.svg +1 -0
- package/plugins/aixy/plugin.js +5 -0
- package/plugins/aixy/plugin.json +9 -1
- package/plugins/antigravity/plugin.js +19 -10
- package/plugins/antigravity-cli/plugin.js +8 -3
- package/plugins/antigravity-ide/plugin.js +8 -5
- package/plugins/atlascloud/plugin.js +5 -0
- package/plugins/atlascloud/plugin.json +2 -1
- package/plugins/bifrost/icon.svg +3 -0
- package/plugins/bifrost/plugin.js +5 -0
- package/plugins/bifrost/plugin.json +9 -1
- 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 +39 -2
- 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/codex/plugin.js +14 -8
- package/plugins/codex/plugin.json +11 -2
- 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/cursor/plugin.js +27 -8
- package/plugins/cursor-nightly/plugin.json +1 -1
- package/plugins/devpass/icon.svg +3 -0
- package/plugins/devpass/plugin.js +5 -0
- package/plugins/devpass/plugin.json +2 -1
- 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/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/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 +1 -2
- package/plugins/gemini-apps/plugin.js +136 -465
- package/plugins/gemini-apps/plugin.json +13 -7
- package/plugins/gitkraken/icon.svg +2 -0
- package/plugins/gitkraken/plugin.js +5 -0
- package/plugins/gitkraken/plugin.json +9 -1
- 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/helmcode/icon.svg +5 -0
- package/plugins/helmcode/plugin.js +120 -55
- package/plugins/helmcode/plugin.json +10 -2
- package/plugins/huggingface/plugin.js +6 -1
- package/plugins/huggingface/plugin.json +4 -3
- package/plugins/hyper/plugin.js +53 -47
- package/plugins/hyper/plugin.json +3 -2
- 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/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/lithosai/plugin.js +5 -0
- package/plugins/lithosai/plugin.json +2 -1
- package/plugins/llmman/icon.svg +4 -0
- package/plugins/llmman/plugin.js +5 -0
- package/plugins/llmman/plugin.json +9 -1
- 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/icon.svg +3 -0
- package/plugins/muse/plugin.js +5 -0
- package/plugins/muse/plugin.json +9 -1
- package/plugins/museai/plugin.js +10 -3
- package/plugins/museai/plugin.json +3 -2
- package/plugins/nous/plugin.js +5 -0
- package/plugins/nous/plugin.json +9 -1
- package/plugins/ollama/plugin.js +58 -0
- package/plugins/opencode-go/plugin.js +21 -9
- 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/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/qwencloud/LICENSE +21 -0
- package/plugins/qwencloud/plugin.js +197 -0
- package/plugins/qwencloud/plugin.json +17 -0
- package/plugins/raycast/icon.svg +4 -0
- package/plugins/raycast/plugin.js +5 -0
- package/plugins/raycast/plugin.json +9 -1
- package/plugins/replicate/plugin.js +5 -0
- package/plugins/replicate/plugin.json +2 -1
- 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/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/icon.svg +4 -0
- package/plugins/typesafe/plugin.js +85 -129
- package/plugins/typesafe/plugin.json +3 -2
- package/plugins/v0/plugin.js +5 -0
- package/plugins/v0/plugin.json +9 -1
- package/plugins/vercel/plugin.js +147 -0
- package/plugins/vercel/plugin.json +34 -3
- package/plugins/workbuddy/icon.svg +1 -1
- package/plugins/workbuddy/plugin.js +110 -19
- package/plugins/workbuddy/plugin.json +32 -2
- 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/icon.svg +1 -0
- package/plugins/xkiro/plugin.js +5 -0
- package/plugins/xkiro/plugin.json +2 -1
- package/usagestat +0 -0
- package/usagestatd +0 -0
- package/plugins/cursor-nightly/plugin.js +0 -1416
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
2
|
globalThis.__usagestat_bundled_options = {"labels":["Credits","Credits","Additional"],"defaults":{},"autoMode":"web"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/workbuddy.js
|
|
3
5
|
function _nullishCoalesce(lhs, rhsFn) {
|
|
4
6
|
if (lhs != null) {
|
|
5
7
|
return lhs;
|
|
@@ -15,6 +17,8 @@ defineProvider({
|
|
|
15
17
|
{ key: "webTimeoutSeconds", title: "Web timeout", type: "plain" },
|
|
16
18
|
{ key: "resetDeadlineMillis", title: "Reset lookup deadline", type: "plain" },
|
|
17
19
|
{ key: "chromeMajorVersion", title: "Chrome major version", type: "plain" },
|
|
20
|
+
{ key: "manualUserAgent", title: "User-Agent", type: "plain" },
|
|
21
|
+
{ key: "manualUserAgentError", title: "Invalid User-Agent message", type: "plain" },
|
|
18
22
|
],
|
|
19
23
|
capabilities: ["browser-cookies", "http-status"],
|
|
20
24
|
cookieDomains: ["workbuddy.cn", "www.workbuddy.cn"],
|
|
@@ -28,6 +32,16 @@ defineProvider({
|
|
|
28
32
|
const domain = "www.workbuddy.cn";
|
|
29
33
|
const policy = ctx.browser.availability(domain);
|
|
30
34
|
if (policy === "off") throw ctx.fail.missingCredential("WorkBuddy cookies are disabled.");
|
|
35
|
+
const manualUserAgent = policy === "manual" ? _nullishCoalesce(ctx.settings.get("manualUserAgent"), () => "") : "";
|
|
36
|
+
if (/[^\x20-\x7e]/.test(manualUserAgent)) {
|
|
37
|
+
throw ctx.fail.missingCredential(
|
|
38
|
+
_nullishCoalesce(
|
|
39
|
+
ctx.settings.get("manualUserAgentError"),
|
|
40
|
+
() => "Paste the WorkBuddy User-Agent as a single request header value.",
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const override = manualUserAgent.trim();
|
|
31
45
|
const timeoutRaw = Number(_nullishCoalesce(ctx.settings.get("webTimeoutSeconds"), () => "15"));
|
|
32
46
|
const timeoutSeconds = Number.isFinite(timeoutRaw) ? Math.min(30, Math.max(1, Math.round(timeoutRaw))) : 15;
|
|
33
47
|
// WorkBuddy binds the session to the browser User-Agent, and Chrome's reduced UA varies only by major version.
|
|
@@ -35,8 +49,9 @@ defineProvider({
|
|
|
35
49
|
const major = Number(_nullishCoalesce(ctx.settings.get("chromeMajorVersion"), () => ""));
|
|
36
50
|
const userAgent = (version) =>
|
|
37
51
|
`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${version}.0.0.0 Safari/537.36`;
|
|
38
|
-
const
|
|
52
|
+
const chromeUserAgents =
|
|
39
53
|
Number.isSafeInteger(major) && major > 1 ? [userAgent(major), userAgent(major - 1)] : [undefined];
|
|
54
|
+
const userAgents = override ? [override] : chromeUserAgents;
|
|
40
55
|
|
|
41
56
|
const fail = (field) => {
|
|
42
57
|
throw ctx.fail.parseFailure(`Invalid WorkBuddy billing response: ${field}`);
|
|
@@ -93,7 +108,7 @@ defineProvider({
|
|
|
93
108
|
return object(root.data, "data");
|
|
94
109
|
};
|
|
95
110
|
|
|
96
|
-
// Cycle timestamps carry no zone
|
|
111
|
+
// Cycle timestamps carry no zone; WorkBuddy uses China Standard Time.
|
|
97
112
|
const cycleEnd = (value) => {
|
|
98
113
|
const raw = text(value);
|
|
99
114
|
if (!raw) return undefined;
|
|
@@ -103,6 +118,16 @@ defineProvider({
|
|
|
103
118
|
// The dashboard refreshes one second after the inclusive end time.
|
|
104
119
|
return new Date(end.getTime() + 1000);
|
|
105
120
|
};
|
|
121
|
+
// Spent grants stay in the listing until their cycle ends. The dashboard reports the lapse of the
|
|
122
|
+
// grants that still carry credits, so a grant with nothing left must not bound the reward window.
|
|
123
|
+
const creditsLeft = (value) => {
|
|
124
|
+
try {
|
|
125
|
+
return amount(value, "CycleCapacityRemain");
|
|
126
|
+
} catch (error) {
|
|
127
|
+
void error;
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
106
131
|
// Package codes the WorkBuddy client sends for its paid and free listings (WorkBuddy 5.6.2).
|
|
107
132
|
const paidPackageCodes = [
|
|
108
133
|
"TCACA_code_002_AkiJS3ZHF5",
|
|
@@ -128,16 +153,21 @@ defineProvider({
|
|
|
128
153
|
"TCACA_code_029_6wCGEWquYy",
|
|
129
154
|
"TCACA_code_030_BjSt89qTvr",
|
|
130
155
|
];
|
|
131
|
-
//
|
|
132
|
-
|
|
156
|
+
// Platform reward grants are aggregated under one package code in the summary. Only the free listing
|
|
157
|
+
// carries each grant's own cycle, so the reward expiry has to be read from there.
|
|
158
|
+
const benefitPackageCode = "TCACA_code_007_nzdH5h4Nl0";
|
|
159
|
+
// Reset and reward expiry are optional: a failed or unexpected package listing must not discard the balance.
|
|
160
|
+
const listings = async (session, agent, wantsRewards) => {
|
|
133
161
|
const now = ctx.date.now().getTime();
|
|
134
162
|
// Share five seconds across listings, retaining the host's margin for publishing the balance.
|
|
135
163
|
const hostDeadline = Number(ctx.settings.get("resetDeadlineMillis"));
|
|
136
164
|
const deadline = Math.min(Date.now() + 5000, hostDeadline > 0 ? hostDeadline : Infinity);
|
|
137
|
-
let
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
165
|
+
let paidReset;
|
|
166
|
+
let freeReset;
|
|
167
|
+
let rewardExpiry;
|
|
168
|
+
for (const [path, codes, isFree] of [
|
|
169
|
+
["/billing/meter/get-user-resource-paid-packages", paidPackageCodes, false],
|
|
170
|
+
["/billing/meter/get-user-resource-free-packages", freePackageCodes, true],
|
|
141
171
|
]) {
|
|
142
172
|
const budget = (deadline - Date.now()) / 1000;
|
|
143
173
|
if (budget < 1) break;
|
|
@@ -150,20 +180,41 @@ defineProvider({
|
|
|
150
180
|
{ PageNumber: 1, PageSize: 100, PackageCodes: codes, Status: [0, 3] },
|
|
151
181
|
Math.min(timeoutSeconds, budget),
|
|
152
182
|
);
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
183
|
+
if (Array.isArray(page.Accounts)) {
|
|
184
|
+
for (const raw of page.Accounts) {
|
|
185
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
186
|
+
const account = raw;
|
|
187
|
+
if (account.CapacityUnit !== "credits") continue;
|
|
188
|
+
const end = cycleEnd(account.CycleEndTime);
|
|
189
|
+
if (!end || end.getTime() <= now) continue;
|
|
190
|
+
if (isFree) {
|
|
191
|
+
// Reward grants expire piecewise; the earliest grant that still holds credits bounds the window.
|
|
192
|
+
const left = creditsLeft(account.CycleCapacityRemain);
|
|
193
|
+
if (
|
|
194
|
+
account.PackageCode === benefitPackageCode &&
|
|
195
|
+
left !== undefined &&
|
|
196
|
+
left > 0 &&
|
|
197
|
+
(!rewardExpiry || end.getTime() < rewardExpiry.getTime())
|
|
198
|
+
) {
|
|
199
|
+
rewardExpiry = end;
|
|
200
|
+
}
|
|
201
|
+
// Reward grants expire; they never supply the allowance's fallback reset.
|
|
202
|
+
if (account.PackageCode !== benefitPackageCode && (!freeReset || end.getTime() < freeReset.getTime())) {
|
|
203
|
+
freeReset = end;
|
|
204
|
+
}
|
|
205
|
+
} else if (!paidReset || end.getTime() < paidReset.getTime()) {
|
|
206
|
+
paidReset = end;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
160
209
|
}
|
|
161
210
|
} catch (error) {
|
|
162
|
-
|
|
163
|
-
if (failure.transportClass === "cancelled") throw error;
|
|
211
|
+
if (error.transportClass === "cancelled") throw error;
|
|
164
212
|
}
|
|
213
|
+
// Paid cycles refill the allowance; free grants may expire earlier. The free listing is only
|
|
214
|
+
// worth a request when it answers the reset or bounds the reward window.
|
|
215
|
+
if (!isFree && paidReset && !wantsRewards) break;
|
|
165
216
|
}
|
|
166
|
-
return
|
|
217
|
+
return { reset: _nullishCoalesce(paidReset, () => freeReset), rewardExpiry };
|
|
167
218
|
};
|
|
168
219
|
|
|
169
220
|
let rejected = false;
|
|
@@ -199,21 +250,58 @@ defineProvider({
|
|
|
199
250
|
remaining += amount(item.CycleRemainCapacity, "CycleRemainCapacity");
|
|
200
251
|
if (item.CycleFrozenCapacity !== undefined) frozen += amount(item.CycleFrozenCapacity, "CycleFrozenCapacity");
|
|
201
252
|
}
|
|
253
|
+
// Credit groups split the same allowance by origin. Rewards are optional, so an unexpected group
|
|
254
|
+
// shape must not discard the balance the dashboard shows.
|
|
255
|
+
let rewardTotal = 0;
|
|
256
|
+
let rewardRemaining = 0;
|
|
257
|
+
for (const raw of Array.isArray(summary.CreditGroups) ? summary.CreditGroups : []) {
|
|
258
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
259
|
+
const group = raw;
|
|
260
|
+
if (group.Kind !== "benefit" || group.CapacityUnit !== "credits") continue;
|
|
261
|
+
try {
|
|
262
|
+
const groupTotal = amount(group.CycleTotalCapacity, "CycleTotalCapacity");
|
|
263
|
+
const groupRemaining = amount(group.CycleRemainCapacity, "CycleRemainCapacity");
|
|
264
|
+
rewardTotal += groupTotal;
|
|
265
|
+
rewardRemaining += groupRemaining;
|
|
266
|
+
} catch (error) {
|
|
267
|
+
void error;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
202
270
|
const plan = text(summary.SubscriptionPackageName);
|
|
203
271
|
// Frozen credits are listed as reported; the meter uses the remaining amount the dashboard shows.
|
|
204
272
|
const rows = frozen > 0 ? [{ label: "Reserved", value: format(frozen) }] : [];
|
|
205
273
|
if (total <= 0) {
|
|
206
274
|
rows.unshift({ label: "Left", value: format(remaining) }, { label: "Total", value: format(total) });
|
|
207
275
|
}
|
|
276
|
+
const wantsRewards = rewardTotal > 0;
|
|
277
|
+
const cycle = await listings(session, agent, wantsRewards);
|
|
278
|
+
// The window carries the balance; it cannot carry a countdown, because reward credits lapse
|
|
279
|
+
// grant by grant instead of resetting, so the expiry stays a detail row.
|
|
280
|
+
if (wantsRewards && cycle.rewardExpiry) {
|
|
281
|
+
rows.push({ label: "Reward expiry", value: ctx.format.monthDay(cycle.rewardExpiry.getTime()) });
|
|
282
|
+
}
|
|
283
|
+
const extraWindows = wantsRewards
|
|
284
|
+
? [
|
|
285
|
+
{
|
|
286
|
+
id: "rewards",
|
|
287
|
+
title: "Rewards",
|
|
288
|
+
window: {
|
|
289
|
+
usedPercent: ctx.pct(Math.max(0, rewardTotal - rewardRemaining), rewardTotal),
|
|
290
|
+
resetDescription: `${format(rewardRemaining)} / ${format(rewardTotal)} credits left`,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
]
|
|
294
|
+
: [];
|
|
208
295
|
return {
|
|
209
296
|
primary:
|
|
210
297
|
total > 0
|
|
211
298
|
? {
|
|
212
299
|
usedPercent: ctx.pct(Math.max(0, total - remaining), total),
|
|
213
|
-
resetsAt:
|
|
300
|
+
resetsAt: cycle.reset,
|
|
214
301
|
resetDescription: `${format(remaining)} / ${format(total)} credits left`,
|
|
215
302
|
}
|
|
216
303
|
: undefined,
|
|
304
|
+
extraWindows: extraWindows.length ? extraWindows : undefined,
|
|
217
305
|
details: rows.length ? [{ title: "Credits", rows }] : undefined,
|
|
218
306
|
identity: plan ? { loginMethod: plan } : undefined,
|
|
219
307
|
dataConfidence: "exact",
|
|
@@ -225,3 +313,6 @@ defineProvider({
|
|
|
225
313
|
);
|
|
226
314
|
},
|
|
227
315
|
});
|
|
316
|
+
|
|
317
|
+
// END UPSTREAM
|
|
318
|
+
})(globalThis.defineProvider);
|
|
@@ -16,6 +16,36 @@
|
|
|
16
16
|
],
|
|
17
17
|
"setupHelp": "Use a Cookie header from www.workbuddy.cn and the full User-Agent from the same browser. Set Browser User-Agent below. Desktop login files are not imported.",
|
|
18
18
|
"setupFields": [
|
|
19
|
+
{
|
|
20
|
+
"key": "webTimeoutSeconds",
|
|
21
|
+
"title": "Web timeout",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Provider-specific account or source selection."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"key": "resetDeadlineMillis",
|
|
27
|
+
"title": "Reset lookup deadline",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Provider-specific account or source selection."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"key": "chromeMajorVersion",
|
|
33
|
+
"title": "Chrome major version",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Provider-specific account or source selection."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"key": "manualUserAgent",
|
|
39
|
+
"title": "User-Agent",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "Provider-specific account or source selection."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"key": "manualUserAgentError",
|
|
45
|
+
"title": "Invalid User-Agent message",
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Provider-specific account or source selection."
|
|
48
|
+
},
|
|
19
49
|
{
|
|
20
50
|
"key": "browserUserAgent",
|
|
21
51
|
"title": "Browser User-Agent",
|
|
@@ -25,9 +55,9 @@
|
|
|
25
55
|
],
|
|
26
56
|
"upstream": {
|
|
27
57
|
"repository": "https://github.com/steipete/CodexBar",
|
|
28
|
-
"revision": "
|
|
58
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
29
59
|
"path": "Sources/CodexBarCore/Resources/Plugins/workbuddy.js",
|
|
30
|
-
"sha256": "
|
|
60
|
+
"sha256": "4a440637dc7a8ec77592edf5d0fe50181eff9919be08fefa7007bc50476a4301",
|
|
31
61
|
"license": "MIT"
|
|
32
62
|
}
|
|
33
63
|
}
|
package/plugins/xai/plugin.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function env(ctx, name) {
|
|
15
|
+
if (ctx.provider && ctx.provider.instanceId && ctx.provider.instanceId !== 'xai') return null;
|
|
15
16
|
try {
|
|
16
17
|
return clean(ctx.host.env.get(name));
|
|
17
18
|
} catch (_) {
|
|
@@ -135,6 +136,14 @@
|
|
|
135
136
|
});
|
|
136
137
|
var balance = balanceUsd(balanceJson.total && balanceJson.total.val);
|
|
137
138
|
var metrics = [ctx.line.text({ label: "Balance", value: balance < 0 ? "Deficit: $" + (-balance).toFixed(2) : "$" + balance.toFixed(2) })];
|
|
139
|
+
try {
|
|
140
|
+
var preview = ctx.util.requestJson({method:'GET',url:BASE_URL+'/v1/billing/teams/'+encodeURIComponent(id)+'/postpaid/invoice/preview',
|
|
141
|
+
headers:{Authorization:'Bearer '+key,Accept:'application/json'},timeoutMs:5000});
|
|
142
|
+
var cents = preview.json && preview.json.coreInvoice && preview.json.coreInvoice.amountAfterVat;
|
|
143
|
+
if (preview.resp.status>=200 && preview.resp.status<300 && typeof cents==='string' && /^-?\d+$/.test(cents) && Number.isSafeInteger(Number(cents)))
|
|
144
|
+
metrics.push(ctx.line.text({label:'Live remaining (est.)',value:'$'+(balance-Number(cents)/100).toFixed(2),
|
|
145
|
+
subtitle:'Prepaid balance less the current invoice preview; not a settled charge.'}));
|
|
146
|
+
} catch (_) {ctx.host.log.warn('xAI invoice preview unavailable');}
|
|
138
147
|
|
|
139
148
|
var daily = fetchDaily(ctx, key, id);
|
|
140
149
|
if (daily.length) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peter Steinberger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h5.2l5.3 7.1L19.5 3H22l-7.3 8.9L22 21h-5.2l-5.7-7.5L4.7 21H2l7.9-9.3L3 3zm3.4 1.7 11.2 14.6h1.1L7.5 4.7H6.4z"/></svg>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Balance","Additional","Additional"],"defaults":{},"autoMode":"web","balanceOnly":true};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/xapi.js
|
|
5
|
+
defineProvider({
|
|
6
|
+
id: "xapi",
|
|
7
|
+
name: "X API",
|
|
8
|
+
settings: [],
|
|
9
|
+
endpoints: ["https://console.x.com"],
|
|
10
|
+
capabilities: ["browser-cookies", "http-status"],
|
|
11
|
+
cookieDomains: ["x.com", "console.x.com"],
|
|
12
|
+
cookiePolicy: {
|
|
13
|
+
selection: "request-url",
|
|
14
|
+
cache: "nonpersistent",
|
|
15
|
+
imports: "access-gated",
|
|
16
|
+
requiredCookies: ["auth_token", "ct0"],
|
|
17
|
+
headerEcho: { origin: "https://console.x.com", cookie: "ct0", header: "X-CSRF-Token" },
|
|
18
|
+
},
|
|
19
|
+
async fetchUsage(ctx) {
|
|
20
|
+
const domain = "console.x.com";
|
|
21
|
+
if (ctx.browser.availability(domain) === "off") throw ctx.fail.missingCredential("X API cookies are disabled.");
|
|
22
|
+
const invalid = () => {
|
|
23
|
+
throw ctx.fail.parseFailure("X API returned an unrecognized account or dollar balance.");
|
|
24
|
+
};
|
|
25
|
+
const amount = (value) => (typeof value === "number" && Number.isFinite(value) ? value : invalid());
|
|
26
|
+
const expired = ctx.fail.authenticationExpired("X API session expired. Sign in to console.x.com again.");
|
|
27
|
+
let rejected = false;
|
|
28
|
+
for await (const session of ctx.browser.sessions(domain)) {
|
|
29
|
+
const request = async (path) => {
|
|
30
|
+
const response = await ctx.http.get(`https://console.x.com${path}`, {
|
|
31
|
+
cookieSession: session.id,
|
|
32
|
+
headers: { Accept: "application/json" },
|
|
33
|
+
});
|
|
34
|
+
if (response.status === 401) throw expired;
|
|
35
|
+
if (response.status === 403) throw ctx.fail.permissionDenied("X developer console access was denied.");
|
|
36
|
+
if (response.status === 429)
|
|
37
|
+
throw ctx.fail.rateLimited("X API console is rate limited. Wait before refreshing.");
|
|
38
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable("X developer console is unavailable.");
|
|
39
|
+
let json;
|
|
40
|
+
try {
|
|
41
|
+
json = JSON.parse(response.bodyText);
|
|
42
|
+
} catch {
|
|
43
|
+
if (response.status === 200) return invalid();
|
|
44
|
+
}
|
|
45
|
+
// The console also reports expired authentication as HTTP 400 / code 215.
|
|
46
|
+
if (response.status === 400 && Array.isArray(json?.errors) && json.errors.some((error) => error?.code === 215))
|
|
47
|
+
throw expired;
|
|
48
|
+
if (response.status !== 200) throw ctx.fail.apiFailure(`X developer console returned HTTP ${response.status}.`);
|
|
49
|
+
return json;
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const me = await request("/api/me");
|
|
53
|
+
const id = me?.account?.id;
|
|
54
|
+
const account = Number.isSafeInteger(id) && id >= 0 ? String(id) : id;
|
|
55
|
+
if (typeof account !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(account)) return invalid();
|
|
56
|
+
const credits = await request(`/api/accounts/${account}/credits`);
|
|
57
|
+
// The console renders these directly as dollars; its spend endpoint uses different units.
|
|
58
|
+
const paid = amount(credits?.credits?.balance);
|
|
59
|
+
const free = credits?.freeCredits === undefined ? 0 : amount(credits.freeCredits?.balance);
|
|
60
|
+
const balance = amount(paid + free);
|
|
61
|
+
return {
|
|
62
|
+
cost: { used: 0, balance, currency: "USD", period: "Prepaid credits" },
|
|
63
|
+
details: [
|
|
64
|
+
{
|
|
65
|
+
title: "Credits",
|
|
66
|
+
rows: [
|
|
67
|
+
{ label: "Balance", value: ctx.format.currency(balance, "USD"), usageValue: balance },
|
|
68
|
+
{ label: "Purchased credits", value: ctx.format.currency(paid, "USD") },
|
|
69
|
+
{ label: "Free credits", value: ctx.format.currency(free, "USD") },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
identity: { loginMethod: "Browser session" },
|
|
74
|
+
dataConfidence: "exact",
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error !== expired) throw error;
|
|
78
|
+
ctx.browser.rejectCookie(domain, session);
|
|
79
|
+
rejected = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (rejected) throw expired;
|
|
83
|
+
throw ctx.fail.missingCredential(
|
|
84
|
+
`Sign in to console.x.com. Supported browsers: ${ctx.browser.supportedBrowsers}. Or paste its Cookie header.`,
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// END UPSTREAM
|
|
90
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "xapi",
|
|
4
|
+
"name": "X API",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"web"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "web",
|
|
12
|
+
"usageDashboardUrl": "https://console.x.com",
|
|
13
|
+
"webUrl": "https://x.com",
|
|
14
|
+
"envVars": [
|
|
15
|
+
"XAPI_COOKIE"
|
|
16
|
+
],
|
|
17
|
+
"setupFields": [],
|
|
18
|
+
"upstream": {
|
|
19
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
20
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
21
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/xapi.js",
|
|
22
|
+
"sha256": "c8aff7628f2a67a8726486d847747dd8121123da6526b2793b4b7b36ec37930f",
|
|
23
|
+
"license": "MIT"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h5l4 5.5L16 4h5l-6.5 8L21 20h-5l-4-5.5L8 20H3l6.5-8Z"/></svg>
|
package/plugins/xkiro/plugin.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
2
|
globalThis.__usagestat_bundled_options = {"labels":["Daily free tokens","Weekly","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/xkiro.js
|
|
3
5
|
function _nullishCoalesce(lhs, rhsFn) {
|
|
4
6
|
if (lhs != null) {
|
|
5
7
|
return lhs;
|
|
@@ -97,3 +99,6 @@ defineProvider({
|
|
|
97
99
|
};
|
|
98
100
|
},
|
|
99
101
|
});
|
|
102
|
+
|
|
103
|
+
// END UPSTREAM
|
|
104
|
+
})(globalThis.defineProvider);
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
"envVars": [
|
|
14
14
|
"XKIRO_API_KEY"
|
|
15
15
|
],
|
|
16
|
+
"setupFields": [],
|
|
16
17
|
"upstream": {
|
|
17
18
|
"repository": "https://github.com/steipete/CodexBar",
|
|
18
|
-
"revision": "
|
|
19
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
19
20
|
"path": "Sources/CodexBarCore/Resources/Plugins/xkiro.js",
|
|
20
21
|
"sha256": "03bfcb8e518577ee18dd335e4e1e1f7d629d3e5abdf2216b187b1cba8b683853",
|
|
21
22
|
"license": "MIT"
|
package/usagestat
CHANGED
|
Binary file
|
package/usagestatd
CHANGED
|
Binary file
|