@hashimkarim/usagestat-linux-x64-gnu 2.0.1 → 2.1.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 +743 -119
- package/package.json +106 -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 +20 -11
- package/plugins/antigravity-cli/plugin.js +9 -4
- 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 +3 -2
- package/plugins/codex/plugin.json +1 -1
- 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 +33 -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/helmcode/icon.svg +5 -0
- package/plugins/helmcode/plugin.js +49 -41
- 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/kimi/plugin.js +39 -14
- 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/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/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 +98 -129
- package/plugins/muse/plugin.json +10 -2
- package/plugins/museai/LICENSE +21 -0
- package/plugins/museai/icon.svg +3 -0
- package/plugins/museai/plugin.js +159 -0
- package/plugins/museai/plugin.json +26 -0
- 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 +72 -24
- 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/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/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/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 +104 -0
- package/plugins/traecn/plugin.json +25 -0
- package/plugins/typesafe/icon.svg +4 -0
- package/plugins/typesafe/plugin.js +30 -25
- 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/LICENSE +21 -0
- package/plugins/workbuddy/icon.svg +1 -0
- package/plugins/workbuddy/plugin.js +232 -0
- package/plugins/workbuddy/plugin.json +51 -0
- 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
|
@@ -14,9 +14,17 @@
|
|
|
14
14
|
"GITKRAKEN_API_TOKEN",
|
|
15
15
|
"GITKRAKEN_ORG_ID"
|
|
16
16
|
],
|
|
17
|
+
"setupFields": [
|
|
18
|
+
{
|
|
19
|
+
"key": "GITKRAKEN_ORG_ID",
|
|
20
|
+
"title": "API organization ID",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Provider-specific account or source selection."
|
|
23
|
+
}
|
|
24
|
+
],
|
|
17
25
|
"upstream": {
|
|
18
26
|
"repository": "https://github.com/steipete/CodexBar",
|
|
19
|
-
"revision": "
|
|
27
|
+
"revision": "6070b29a1a5d51193a634dc1b0a14a67c39d0ccc",
|
|
20
28
|
"path": "Sources/CodexBarCore/Resources/Plugins/gitkraken.js",
|
|
21
29
|
"sha256": "c583890b74fc4c054cd818e560b30a17dd716c7611b554bd5b559f533a824ca2",
|
|
22
30
|
"license": "MIT"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="132" height="132" viewBox="0 0 132 132" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g transform="translate(8.5)">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M57.5 0C54.9373 0 52.3747 0.6439 50.1323 1.9317L7.20752 26.8829C2.72284 29.4585 0 34.2878 0 39.439V92.561C0 97.712 2.72284 102.541 7.20752 105.117L50.1323 130.068C52.3747 131.356 54.9373 132 57.5 132C60.0627 132 62.6253 131.356 64.8677 130.068L107.792 105.117C112.277 102.541 115 97.712 115 92.561V39.439C115 34.2878 112.277 29.4585 107.792 26.8829L64.8677 1.9317C62.6253 0.6439 60.0627 0 57.5 0ZM57.5 23.8244L20.0055 43.7423L57.4199 64.8294V109.302H57.5L97.6901 86.0459V47.285L57.5 23.8244Z" fill="currentColor"/>
|
|
4
|
+
</g>
|
|
5
|
+
</svg>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
2
|
globalThis.__usagestat_bundled_options = {"labels":["Model quota","Model quota","Additional"],"defaults":{},"autoMode":"web"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/helmcode.js
|
|
3
5
|
function _nullishCoalesce(lhs, rhsFn) {
|
|
4
6
|
if (lhs != null) {
|
|
5
7
|
return lhs;
|
|
@@ -34,13 +36,13 @@ defineProvider({
|
|
|
34
36
|
endpoints: ["https://cloud-api.helmcode.com", "https://cloud-api.nan.builders"],
|
|
35
37
|
settings: [{ key: "TENANT", title: "Manual cookie tenant", type: "plain" }],
|
|
36
38
|
capabilities: ["browser-cookies", "http-status"],
|
|
37
|
-
cookieDomains: ["helmcode.com", "nan.builders"],
|
|
39
|
+
cookieDomains: ["helmcode.com", "cloud-api.helmcode.com", "nan.builders"],
|
|
38
40
|
async fetchUsage(ctx) {
|
|
39
41
|
const tenants = [
|
|
40
|
-
{ domain: "helmcode.com", name: "Helmcode Cloud" },
|
|
41
|
-
{ domain: "nan.builders", name: "NaN Builders" },
|
|
42
|
+
{ domain: "helmcode.com", cookieDomain: "cloud-api.helmcode.com", name: "Helmcode Cloud" },
|
|
43
|
+
{ domain: "nan.builders", cookieDomain: "nan.builders", name: "NaN Builders" },
|
|
42
44
|
];
|
|
43
|
-
const policy = ctx.browser.availability(tenants[0].
|
|
45
|
+
const policy = ctx.browser.availability(tenants[0].cookieDomain);
|
|
44
46
|
if (policy === "off") throw ctx.fail.missingCredential("Helmcode dashboard cookies are disabled.");
|
|
45
47
|
// A pasted header has no origin metadata. Never try it against both tenants.
|
|
46
48
|
const candidates = policy === "manual" ? [tenants[ctx.settings.get("TENANT") === "nanBuilders" ? 1 : 0]] : tenants;
|
|
@@ -61,35 +63,31 @@ defineProvider({
|
|
|
61
63
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) return fail(field);
|
|
62
64
|
return value;
|
|
63
65
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
async function* sessions() {
|
|
67
|
+
for (const tenant of candidates) {
|
|
68
|
+
const domains =
|
|
69
|
+
policy !== "manual" && tenant.domain !== tenant.cookieDomain
|
|
70
|
+
? [tenant.domain, tenant.cookieDomain, tenant.domain]
|
|
71
|
+
: [tenant.cookieDomain];
|
|
72
|
+
// Try the old cache first, then API-host and parent-domain browser sessions.
|
|
73
|
+
for (const [index, domain] of domains.entries()) {
|
|
74
|
+
try {
|
|
75
|
+
for await (const session of ctx.browser.sessions(domain, {
|
|
76
|
+
cachedOnly: domains.length > 1 && index === 0,
|
|
77
|
+
})) {
|
|
78
|
+
yield { tenant, domain, session };
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
void error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
71
84
|
}
|
|
72
|
-
}
|
|
73
|
-
const validate = (response) => {
|
|
74
|
-
const seconds = Number(_nullishCoalesce(response.headers["retry-after"], () => 1));
|
|
75
|
-
const retryAfterSeconds = Number.isFinite(seconds) && seconds >= 0 ? Math.min(10, seconds) : 1;
|
|
76
|
-
if (response.status === 429) throw ctx.fail.rateLimited("Helmcode rate limit reached.", { retryAfterSeconds });
|
|
77
|
-
if (response.status === 408 || response.status >= 500)
|
|
78
|
-
throw ctx.fail.providerUnavailable("Helmcode dashboard is unavailable.", { retryAfterSeconds });
|
|
79
|
-
if (response.status < 200 || response.status >= 300)
|
|
80
|
-
throw ctx.fail.apiFailure(`Helmcode dashboard returned HTTP ${response.status}.`);
|
|
81
|
-
};
|
|
85
|
+
}
|
|
82
86
|
let rejected = false;
|
|
83
|
-
for (const tenant of
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
cookie = await ctx.browser.cookieHeader(tenant.domain);
|
|
87
|
-
} catch (error) {
|
|
88
|
-
void error;
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
87
|
+
for await (const { tenant, domain, session } of sessions()) {
|
|
88
|
+
if (!session.header) continue;
|
|
91
89
|
const headers = {
|
|
92
|
-
Cookie:
|
|
90
|
+
Cookie: session.header,
|
|
93
91
|
Origin: `https://cloud.${tenant.domain}`,
|
|
94
92
|
Referer: `https://cloud.${tenant.domain}/dashboard`,
|
|
95
93
|
};
|
|
@@ -97,11 +95,17 @@ defineProvider({
|
|
|
97
95
|
ctx.http.get(`https://cloud-api.${tenant.domain}${path}`, { headers, timeoutSeconds });
|
|
98
96
|
const response = await get("/api/usage/quota");
|
|
99
97
|
if ((response.status >= 300 && response.status < 400) || response.status === 401 || response.status === 403) {
|
|
100
|
-
ctx.browser.rejectCookie(
|
|
98
|
+
ctx.browser.rejectCookie(domain, session);
|
|
101
99
|
rejected = true;
|
|
102
100
|
continue;
|
|
103
101
|
}
|
|
104
|
-
|
|
102
|
+
const seconds = Number(_nullishCoalesce(response.headers["retry-after"], () => 1));
|
|
103
|
+
const retryAfterSeconds = Number.isFinite(seconds) && seconds >= 0 ? Math.min(10, seconds) : 1;
|
|
104
|
+
if (response.status === 429) throw ctx.fail.rateLimited("Helmcode rate limit reached.", { retryAfterSeconds });
|
|
105
|
+
if (response.status === 408 || response.status >= 500)
|
|
106
|
+
throw ctx.fail.providerUnavailable("Helmcode dashboard is unavailable.", { retryAfterSeconds });
|
|
107
|
+
if (response.status < 200 || response.status >= 300)
|
|
108
|
+
throw ctx.fail.apiFailure(`Helmcode dashboard returned HTTP ${response.status}.`);
|
|
105
109
|
const quota = parse(response.bodyText);
|
|
106
110
|
if (typeof quota.periodStart !== "string" || !Array.isArray(quota.models)) return fail("periodStart or models");
|
|
107
111
|
const optional = async (path) => {
|
|
@@ -136,14 +140,15 @@ defineProvider({
|
|
|
136
140
|
const credit = row.creditTokens == null ? 0 : integer(row.creditTokens, "creditTokens");
|
|
137
141
|
const hours = row.windowHours == null ? undefined : integer(row.windowHours, "windowHours");
|
|
138
142
|
if (hours !== undefined && (hours < 1 || hours > 525600 / 60)) return fail("windowHours");
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
143
|
+
let resetsAt = fallback;
|
|
144
|
+
if (typeof row.periodEnd === "string") {
|
|
145
|
+
try {
|
|
146
|
+
resetsAt = _nullishCoalesce(ctx.date.iso(row.periodEnd), () => fallback);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
void error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return { name: row.model, cap, used, credit, hours, resetsAt };
|
|
147
152
|
})
|
|
148
153
|
.filter((row) => row.cap > 0 && (row.hours === undefined || premium));
|
|
149
154
|
models.sort((a, b) => b.used / b.cap - a.used / a.cap || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
@@ -182,7 +187,10 @@ defineProvider({
|
|
|
182
187
|
}
|
|
183
188
|
if (rejected) throw ctx.fail.authenticationExpired("Helmcode dashboard session expired. Sign in again.");
|
|
184
189
|
throw ctx.fail.missingCredential(
|
|
185
|
-
|
|
190
|
+
`Sign in to cloud.helmcode.com or cloud.nan.builders. Supported browsers: ${ctx.browser.supportedBrowsers}. Or paste a Cookie header.`,
|
|
186
191
|
);
|
|
187
192
|
},
|
|
188
193
|
});
|
|
194
|
+
|
|
195
|
+
// END UPSTREAM
|
|
196
|
+
})(globalThis.defineProvider);
|
|
@@ -14,11 +14,19 @@
|
|
|
14
14
|
"envVars": [
|
|
15
15
|
"HELMCODE_COOKIE"
|
|
16
16
|
],
|
|
17
|
+
"setupFields": [
|
|
18
|
+
{
|
|
19
|
+
"key": "TENANT",
|
|
20
|
+
"title": "Manual cookie tenant",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Provider-specific account or source selection."
|
|
23
|
+
}
|
|
24
|
+
],
|
|
17
25
|
"upstream": {
|
|
18
26
|
"repository": "https://github.com/steipete/CodexBar",
|
|
19
|
-
"revision": "
|
|
27
|
+
"revision": "6070b29a1a5d51193a634dc1b0a14a67c39d0ccc",
|
|
20
28
|
"path": "Sources/CodexBarCore/Resources/Plugins/helmcode.js",
|
|
21
|
-
"sha256": "
|
|
29
|
+
"sha256": "9aa6a515eda5c361f340a6535342ccaba9365a06124eec1501e7744c33765430",
|
|
22
30
|
"license": "MIT"
|
|
23
31
|
}
|
|
24
32
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
-
globalThis.__usagestat_bundled_options = {"labels":["Inference","ZeroGPU","Additional"],"defaults":{},"autoMode":"
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Inference","ZeroGPU","Additional"],"defaults":{},"autoMode":"web"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/huggingface.js
|
|
3
5
|
function _nullishCoalesce(lhs, rhsFn) {
|
|
4
6
|
if (lhs != null) {
|
|
5
7
|
return lhs;
|
|
@@ -291,3 +293,6 @@ defineProvider({
|
|
|
291
293
|
};
|
|
292
294
|
},
|
|
293
295
|
});
|
|
296
|
+
|
|
297
|
+
// END UPSTREAM
|
|
298
|
+
})(globalThis.defineProvider);
|
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
"entry": "plugin.js",
|
|
7
7
|
"enabledByDefault": false,
|
|
8
8
|
"supportedModes": [
|
|
9
|
-
"
|
|
9
|
+
"web"
|
|
10
10
|
],
|
|
11
|
-
"autoMode": "
|
|
11
|
+
"autoMode": "web",
|
|
12
12
|
"usageDashboardUrl": "https://huggingface.co/settings/billing",
|
|
13
13
|
"webUrl": "https://huggingface.co",
|
|
14
14
|
"envVars": [
|
|
15
15
|
"HF_TOKEN",
|
|
16
16
|
"HUGGINGFACE_COOKIE"
|
|
17
17
|
],
|
|
18
|
+
"setupFields": [],
|
|
18
19
|
"upstream": {
|
|
19
20
|
"repository": "https://github.com/steipete/CodexBar",
|
|
20
|
-
"revision": "
|
|
21
|
+
"revision": "6070b29a1a5d51193a634dc1b0a14a67c39d0ccc",
|
|
21
22
|
"path": "Sources/CodexBarCore/Resources/Plugins/huggingface.js",
|
|
22
23
|
"sha256": "78cb1bb09535c71f7cb9d1a6336efb4ead44b36a1d4716602c1f7a1e35821291",
|
|
23
24
|
"license": "MIT"
|
package/plugins/hyper/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":["Balance","Balance","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/hyper.js
|
|
3
5
|
function _optionalChain(ops) {
|
|
4
6
|
let lastAccessLHS = undefined;
|
|
5
7
|
let value = ops[0];
|
|
@@ -34,62 +36,52 @@ defineProvider({
|
|
|
34
36
|
async fetchUsage(ctx) {
|
|
35
37
|
const domain = "hyper.charm.land";
|
|
36
38
|
const key = ctx.settings.getSecret("HYPER_API_KEY");
|
|
37
|
-
const
|
|
39
|
+
const canUseKey = Boolean(key) && ctx.settings.get("SOURCE_MODE") !== "web";
|
|
40
|
+
const cookiePolicy = ctx.browser.availability(domain);
|
|
38
41
|
const missing = () => {
|
|
39
42
|
throw ctx.fail.missingCredential("Sign in to hyper.charm.land or configure a Charm Hyper API key.");
|
|
40
43
|
};
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
// Browser sessions use the dashboard; /v1/credits accepts bearer keys only.
|
|
45
|
+
const request = (headers, session = false) =>
|
|
46
|
+
ctx.http.get(`https://${domain}/${session ? "" : "v1/credits"}`, {
|
|
43
47
|
headers,
|
|
44
|
-
timeoutSeconds,
|
|
48
|
+
timeoutSeconds: session ? 8 : 10,
|
|
45
49
|
});
|
|
46
50
|
let response;
|
|
47
51
|
let session = false;
|
|
48
|
-
if (
|
|
52
|
+
if (cookiePolicy !== "off") {
|
|
49
53
|
try {
|
|
50
54
|
const cookie = await ctx.browser.cookieHeader(domain);
|
|
51
55
|
session = true;
|
|
52
|
-
response = await request({ Cookie: cookie },
|
|
56
|
+
response = await request({ Cookie: cookie, Accept: "text/html" }, true);
|
|
53
57
|
} catch (error) {
|
|
54
58
|
if (error.transportClass === "cancelled") throw error;
|
|
55
|
-
if (
|
|
59
|
+
if (!canUseKey) {
|
|
56
60
|
if (session) throw ctx.fail.networkFailure("Charm Hyper session request failed.");
|
|
57
61
|
return missing();
|
|
58
62
|
}
|
|
59
63
|
}
|
|
64
|
+
const team = /\/teams\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;
|
|
60
65
|
if (
|
|
61
66
|
response &&
|
|
62
67
|
(response.status === 401 ||
|
|
63
68
|
response.status === 403 ||
|
|
64
69
|
(response.status >= 300 && response.status < 400) ||
|
|
65
|
-
(response.status === 200 &&
|
|
66
|
-
_optionalChain([
|
|
67
|
-
response,
|
|
68
|
-
"access",
|
|
69
|
-
(_) => _.headers,
|
|
70
|
-
"access",
|
|
71
|
-
(_2) => _2["content-type"],
|
|
72
|
-
"optionalAccess",
|
|
73
|
-
(_3) => _3.toLowerCase,
|
|
74
|
-
"call",
|
|
75
|
-
(_4) => _4(),
|
|
76
|
-
"access",
|
|
77
|
-
(_5) => _5.includes,
|
|
78
|
-
"call",
|
|
79
|
-
(_6) => _6("text/html"),
|
|
80
|
-
])))
|
|
70
|
+
(response.status === 200 && !team.test(response.url) && !team.test(response.bodyText)))
|
|
81
71
|
) {
|
|
82
72
|
ctx.browser.rejectCookie(domain);
|
|
83
|
-
if (
|
|
73
|
+
if (!canUseKey) {
|
|
84
74
|
throw ctx.fail.authenticationExpired(
|
|
85
|
-
|
|
75
|
+
cookiePolicy === "manual"
|
|
76
|
+
? "Charm Hyper session expired. Paste a fresh Cookie header in Settings."
|
|
77
|
+
: "Charm Hyper session expired. Sign in again at hyper.charm.land.",
|
|
86
78
|
);
|
|
87
79
|
}
|
|
88
80
|
response = undefined;
|
|
89
81
|
}
|
|
90
82
|
}
|
|
91
83
|
if (!response) {
|
|
92
|
-
if (
|
|
84
|
+
if (!canUseKey) return missing();
|
|
93
85
|
response = await request({ Authorization: `Bearer ${key}` });
|
|
94
86
|
session = false;
|
|
95
87
|
}
|
|
@@ -100,32 +92,46 @@ defineProvider({
|
|
|
100
92
|
if (response.status >= 500) throw ctx.fail.providerUnavailable(`Charm Hyper API error: HTTP ${response.status}`);
|
|
101
93
|
if (response.status !== 200) throw ctx.fail.apiFailure(`Charm Hyper API error: HTTP ${response.status}`);
|
|
102
94
|
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
let balance;
|
|
96
|
+
if (session) {
|
|
97
|
+
const match = /Hypercredits Available[\s\S]{0,400}?text-5xl font-bold">\s*([0-9][0-9,]*(?:\.[0-9]+)?)\s*</.exec(
|
|
98
|
+
response.bodyText,
|
|
99
|
+
);
|
|
100
|
+
balance = match ? Number(match[1].replace(/,/g, "")) : NaN;
|
|
101
|
+
} else {
|
|
102
|
+
try {
|
|
103
|
+
balance = _optionalChain([
|
|
104
|
+
JSON,
|
|
105
|
+
"access",
|
|
106
|
+
(_) => _.parse,
|
|
107
|
+
"call",
|
|
108
|
+
(_2) => _2(response.bodyText),
|
|
109
|
+
"optionalAccess",
|
|
110
|
+
(_3) => _3.balance,
|
|
111
|
+
]);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
void error;
|
|
114
|
+
throw ctx.fail.parseFailure("Charm Hyper credits response is not valid JSON.");
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
|
-
const balance = _optionalChain([payload, "optionalAccess", (_7) => _7.balance]);
|
|
111
117
|
if (typeof balance !== "number" || !Number.isFinite(balance) || balance < 0) {
|
|
112
118
|
throw ctx.fail.parseFailure("Charm Hyper balance must be a non-negative number.");
|
|
113
119
|
}
|
|
120
|
+
const row = {
|
|
121
|
+
label: "Balance",
|
|
122
|
+
value: `${ctx.format.number(balance, { maximumFractionDigits: 2 })} HC`,
|
|
123
|
+
usageValue: balance,
|
|
124
|
+
};
|
|
114
125
|
return {
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
value: `${ctx.format.number(balance, { maximumFractionDigits: 2 })} HC`,
|
|
122
|
-
usageValue: balance,
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
identity: { loginMethod: session ? "Browser session" : "API key" },
|
|
128
|
-
dataConfidence: "exact",
|
|
126
|
+
usage: {
|
|
127
|
+
details: [{ title: "Hypercredits", rows: [row] }],
|
|
128
|
+
identity: { loginMethod: session ? "Browser session" : "API key" },
|
|
129
|
+
dataConfidence: "exact",
|
|
130
|
+
},
|
|
131
|
+
sourceLabel: session ? "web" : "api",
|
|
129
132
|
};
|
|
130
133
|
},
|
|
131
134
|
});
|
|
135
|
+
|
|
136
|
+
// END UPSTREAM
|
|
137
|
+
})(globalThis.defineProvider);
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
"HYPER_API_KEY",
|
|
17
17
|
"HYPER_COOKIE"
|
|
18
18
|
],
|
|
19
|
+
"setupFields": [],
|
|
19
20
|
"upstream": {
|
|
20
21
|
"repository": "https://github.com/steipete/CodexBar",
|
|
21
|
-
"revision": "
|
|
22
|
+
"revision": "6070b29a1a5d51193a634dc1b0a14a67c39d0ccc",
|
|
22
23
|
"path": "Sources/CodexBarCore/Resources/Plugins/hyper.js",
|
|
23
|
-
"sha256": "
|
|
24
|
+
"sha256": "a8201abe6997057547d6294882b27c4040ac03e151f7ac4678b7c28844170cd5",
|
|
24
25
|
"license": "MIT"
|
|
25
26
|
}
|
|
26
27
|
}
|
package/plugins/kimi/plugin.js
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function env(ctx, name) {
|
|
46
|
+
if (ctx.provider.instanceId && ctx.provider.instanceId !== 'kimi') return null
|
|
46
47
|
try { return clean(ctx.host.env.get(name)) } catch (_) { return null }
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function cliSession(ctx) {
|
|
55
|
+
if (ctx.provider.instanceId && ctx.provider.instanceId !== 'kimi') return null
|
|
54
56
|
const override = env(ctx, "KIMI_CODE_HOME")
|
|
55
57
|
const homes = override ? [override] : ["~/.kimi-code", "~/.kimi"]
|
|
56
58
|
for (const home of homes) {
|
|
@@ -110,24 +112,36 @@
|
|
|
110
112
|
if (!data) return result
|
|
111
113
|
const pool = data.subscriptionBalance
|
|
112
114
|
const ratio = pool && readNumber(pool.amountUsedRatio)
|
|
113
|
-
if (Number.isFinite(ratio) && pool && (!pool.feature || pool.feature === "FEATURE_OMNI") && (!pool.type || pool.type === "SUBSCRIPTION")) {
|
|
115
|
+
if (Number.isFinite(ratio) && ratio >= 0 && pool && (!pool.feature || pool.feature === "FEATURE_OMNI") && (!pool.type || pool.type === "SUBSCRIPTION")) {
|
|
114
116
|
const reset = ctx.util.toIso(pool.expireTime)
|
|
115
117
|
const monthly = ctx.line.progress({ label: "Monthly", used: Math.max(0, Math.min(100, ratio * 100)), limit: 100,
|
|
116
118
|
format: { kind: "percent" }, resetsAt: reset, periodDurationMs: ctx.util.calendarMonthDuration(reset) })
|
|
117
119
|
// Automatic summaries use the first quota. Reset Code windows cannot
|
|
118
120
|
// make an exhausted membership pool available again.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
const existing = result.lines.findIndex(line => line.label === 'Monthly')
|
|
122
|
+
if (ratio >= 1) {
|
|
123
|
+
if (existing >= 0) result.lines.splice(existing,1)
|
|
124
|
+
result.lines.unshift(monthly)
|
|
125
|
+
} else if (existing < 0) result.lines.push(monthly)
|
|
121
126
|
}
|
|
122
127
|
const weekly = data.ratelimitCode7d
|
|
123
128
|
const weeklyRatio = weekly && readNumber(weekly.ratio)
|
|
124
|
-
if (weekly && weekly.enabled !== false && Number.isFinite(weeklyRatio)) {
|
|
129
|
+
if (weekly && weekly.enabled !== false && Number.isFinite(weeklyRatio) && weeklyRatio >= 0) {
|
|
125
130
|
const reset = ctx.util.toIso(weekly.resetTime)
|
|
126
131
|
const used = Math.max(0, Math.min(100, weeklyRatio * 100))
|
|
127
|
-
if (!result.lines.some((line) => line.label === "Weekly" && Math.abs(line.used - used)
|
|
132
|
+
if (!result.lines.some((line) => line.label === "Weekly" && Math.abs(line.used - used) <= 1 && reset && line.resetsAt && Math.abs(Date.parse(line.resetsAt) - Date.parse(reset)) <= 300000)) {
|
|
128
133
|
result.lines.push(ctx.line.progress({ label: "Code 7-day", used, limit: 100, format: { kind: "percent" }, resetsAt: reset, periodDurationMs: WEEK_MS }))
|
|
129
134
|
}
|
|
130
135
|
}
|
|
136
|
+
for (const gift of Array.isArray(data.giftBalances) ? data.giftBalances : []) {
|
|
137
|
+
if (!gift || gift.feature && gift.feature !== 'FEATURE_OMNI' || gift.type && gift.type !== 'GIFT') continue
|
|
138
|
+
const used = readNumber(gift.amountUsedRatio)
|
|
139
|
+
const expires = gift.expireTime == null ? null : ctx.util.parseDateMs(gift.expireTime)
|
|
140
|
+
if (used === null || used < 0 || gift.expireTime != null && !Number.isFinite(expires) || expires !== null && expires <= Date.parse(ctx.nowIso)) continue
|
|
141
|
+
result.lines.push(ctx.line.text({label:clean(gift.displayName) || 'Bonus credits',
|
|
142
|
+
value: String(Math.round(Math.max(0,1-used)*1000)/10) + '% remaining',
|
|
143
|
+
subtitle:expires !== null ? 'Expires ' + ctx.util.toIso(expires) : undefined}))
|
|
144
|
+
}
|
|
131
145
|
} catch (_) { ctx.host.log.warn("Kimi membership enrichment unavailable") }
|
|
132
146
|
return result
|
|
133
147
|
}
|
|
@@ -265,7 +279,7 @@
|
|
|
265
279
|
let data = ctx.util.tryParseJson(resp.bodyText)
|
|
266
280
|
if (source === "web") {
|
|
267
281
|
const coding = data && Array.isArray(data.usages) && data.usages.find((item) => item.scope === "FEATURE_CODING")
|
|
268
|
-
data = coding ? { usage: coding.detail, limits: coding.limits } : null
|
|
282
|
+
data = coding ? { usage: coding.detail, limits: coding.limits } : data && Array.isArray(data.usages) ? {} : null
|
|
269
283
|
}
|
|
270
284
|
if (!data || typeof data !== "object") {
|
|
271
285
|
throw "Usage response invalid. Try again later."
|
|
@@ -324,15 +338,26 @@
|
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
340
|
|
|
327
|
-
|
|
328
|
-
|
|
341
|
+
// Current Code responses expose ratio pools independently of legacy counters.
|
|
342
|
+
for (const [key,label,period] of [['limit_5h','Session',5*3600000],['limit_7d','Weekly',WEEK_MS],['limit_month_total','Monthly',null]]) {
|
|
343
|
+
const pool = data.usages && !Array.isArray(data.usages) && data.usages[key]
|
|
344
|
+
const ratio = pool && readNumber(pool.used_ratio)
|
|
345
|
+
if (!Number.isFinite(ratio) || ratio < 0) continue
|
|
346
|
+
const reset = ctx.util.toIso(pool.reset_time)
|
|
347
|
+
const previous = lines.findIndex(line => line.label === label)
|
|
348
|
+
if (previous >= 0 && lines[previous].periodDurationMs === period && reset && lines[previous].resetsAt &&
|
|
349
|
+
Math.abs(Date.parse(reset)-Date.parse(lines[previous].resetsAt)) <= 2000 && lines[previous].used > ratio*100) continue
|
|
350
|
+
const line = ctx.line.progress({label,used:Math.min(100,ratio*100),limit:100,format:{kind:'percent'},resetsAt:reset,
|
|
351
|
+
periodDurationMs:period || ctx.util.calendarMonthDuration(reset)})
|
|
352
|
+
if (label === 'Monthly' && ratio >= 1) {
|
|
353
|
+
if (previous >= 0) lines.splice(previous,1)
|
|
354
|
+
lines.unshift(line)
|
|
355
|
+
} else if (previous >= 0) lines[previous] = line
|
|
356
|
+
else lines.push(line)
|
|
329
357
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
plan: parsePlanLabel(data),
|
|
334
|
-
lines,
|
|
335
|
-
}, token)
|
|
358
|
+
const result = enrichMembership(ctx, {source,plan:parsePlanLabel(data),lines}, token)
|
|
359
|
+
if (result.lines.length === 0) throw "Kimi usage response did not contain measurable quota counters."
|
|
360
|
+
return result
|
|
336
361
|
}
|
|
337
362
|
|
|
338
363
|
globalThis.__openusage_plugin = { id: "kimi", probe }
|
|
@@ -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,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="112.9 211.2 30 30" width="512" height="512">
|
|
2
|
+
<!-- Langdock mark from https://langdock.com/brand-kit (brand-dark.svg). -->
|
|
3
|
+
<path d="M135.301 230.862C135.595 230.358 135.593 229.735 135.296 229.234L130.455 221.061L126.41 214.282C125.786 213.235 124.268 213.24 123.649 214.29L120.175 220.187C119.879 220.69 119.879 221.314 120.175 221.816L124.545 229.234C124.84 229.735 124.841 230.358 124.547 230.86L121.105 236.734C120.479 237.803 121.25 239.15 122.49 239.15H129.534C130.105 239.15 130.632 238.847 130.92 238.355L135.301 230.862Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Session","Weekly","Additional"],"defaults":{},"autoMode":"web"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/langdock.js
|
|
5
|
+
defineProvider({
|
|
6
|
+
id: "langdock",
|
|
7
|
+
name: "Langdock",
|
|
8
|
+
endpoints: ["https://app.langdock.com"],
|
|
9
|
+
settings: [],
|
|
10
|
+
capabilities: ["browser-cookies", "http-status"],
|
|
11
|
+
cookieDomains: ["langdock.com", "app.langdock.com"],
|
|
12
|
+
cookiePolicy: {
|
|
13
|
+
selection: "request-url",
|
|
14
|
+
cache: "nonpersistent",
|
|
15
|
+
imports: "access-gated",
|
|
16
|
+
store: "selected-profile",
|
|
17
|
+
requiredCookies: ["auth_token"],
|
|
18
|
+
sessionURL: "https://app.langdock.com/api/trpc/usageSettings.getPersonalUsage",
|
|
19
|
+
},
|
|
20
|
+
snapshotPolicy: { percent: "preserve-overage" },
|
|
21
|
+
async fetchUsage(ctx) {
|
|
22
|
+
const fail = () => {
|
|
23
|
+
throw ctx.fail.parseFailure("Langdock returned an unexpected personal usage response.");
|
|
24
|
+
};
|
|
25
|
+
const object = (value) => (value !== null && typeof value === "object" && !Array.isArray(value) ? value : fail());
|
|
26
|
+
const percent = (value) => (typeof value === "number" && Number.isFinite(value) ? value : fail());
|
|
27
|
+
const reset = (value) => {
|
|
28
|
+
if (value === undefined || value === null) return undefined;
|
|
29
|
+
if (typeof value !== "string") return fail();
|
|
30
|
+
try {
|
|
31
|
+
return ctx.date.iso(value);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
void error;
|
|
34
|
+
return fail();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const denied = (code) => {
|
|
38
|
+
if (code === "UNAUTHORIZED") {
|
|
39
|
+
throw ctx.fail.authenticationExpired("The selected browser profile is no longer signed in to Langdock.");
|
|
40
|
+
}
|
|
41
|
+
if (code === "FORBIDDEN") throw ctx.fail.permissionDenied("Langdock denied access to personal usage.");
|
|
42
|
+
if (code === "TOO_MANY_REQUESTS") throw ctx.fail.rateLimited("Langdock usage requests are rate limited.");
|
|
43
|
+
if (code === "INTERNAL_SERVER_ERROR" || code === "TIMEOUT") {
|
|
44
|
+
throw ctx.fail.providerUnavailable("Langdock personal usage is temporarily unavailable.");
|
|
45
|
+
}
|
|
46
|
+
throw ctx.fail.apiFailure("Langdock rejected the personal usage request.");
|
|
47
|
+
};
|
|
48
|
+
for await (const session of ctx.browser.sessions("app.langdock.com")) {
|
|
49
|
+
const input = encodeURIComponent(JSON.stringify({ 0: { json: null, meta: { values: ["undefined"], v: 1 } } }));
|
|
50
|
+
const response = await ctx.http.get(
|
|
51
|
+
`https://app.langdock.com/api/trpc/usageSettings.getPersonalUsage?batch=1&input=${input}`,
|
|
52
|
+
{
|
|
53
|
+
cookieSession: session.id,
|
|
54
|
+
headers: { Accept: "application/json", Referer: "https://app.langdock.com/settings/account/usage" },
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
if (response.status === 401) return denied("UNAUTHORIZED");
|
|
58
|
+
if (response.status === 403) return denied("FORBIDDEN");
|
|
59
|
+
if (response.status === 429) return denied("TOO_MANY_REQUESTS");
|
|
60
|
+
if (response.status >= 500) return denied("INTERNAL_SERVER_ERROR");
|
|
61
|
+
if (response.status < 200 || response.status >= 300) {
|
|
62
|
+
throw ctx.fail.apiFailure(`Langdock usage request failed with HTTP ${response.status}.`);
|
|
63
|
+
}
|
|
64
|
+
let raw;
|
|
65
|
+
try {
|
|
66
|
+
raw = JSON.parse(response.bodyText);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
void error;
|
|
69
|
+
return fail();
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(raw) || raw.length !== 1) return fail();
|
|
72
|
+
const envelope = object(raw[0]);
|
|
73
|
+
if (envelope.error !== undefined) {
|
|
74
|
+
const code = object(object(object(envelope.error).json).data).code;
|
|
75
|
+
return typeof code === "string" && code.length ? denied(code) : fail();
|
|
76
|
+
}
|
|
77
|
+
const payload = object(object(object(envelope.result).data).json);
|
|
78
|
+
if (payload.hasIncludedUsageLimits !== undefined && typeof payload.hasIncludedUsageLimits !== "boolean") {
|
|
79
|
+
return fail();
|
|
80
|
+
}
|
|
81
|
+
if (payload.hasIncludedUsageLimits === false || payload.planUsage == null) {
|
|
82
|
+
return {
|
|
83
|
+
details: [
|
|
84
|
+
{ title: "Usage", rows: [{ label: "Included limits", value: "No included usage limits available" }] },
|
|
85
|
+
],
|
|
86
|
+
dataConfidence: "percentOnly",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const plan = object(payload.planUsage);
|
|
90
|
+
if (typeof plan.sessionUsageLimitsEnabled !== "boolean") return fail();
|
|
91
|
+
const sessionReset = reset(plan.sessionResetsAt);
|
|
92
|
+
const weeklyReset = reset(plan.weeklyResetsAt);
|
|
93
|
+
return {
|
|
94
|
+
primary: plan.sessionUsageLimitsEnabled
|
|
95
|
+
? { usedPercent: percent(plan.sessionUsagePercent), windowMinutes: 300, resetsAt: sessionReset }
|
|
96
|
+
: undefined,
|
|
97
|
+
secondary: { usedPercent: percent(plan.weeklyUsagePercent), windowMinutes: 10080, resetsAt: weeklyReset },
|
|
98
|
+
dataConfidence: "percentOnly",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
throw ctx.fail.missingCredential("No Langdock session was found in the selected browser profile.");
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// END UPSTREAM
|
|
106
|
+
})(globalThis.defineProvider);
|