@slkiser/opencode-quota 4.3.0 → 4.4.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/README.md +48 -49
- package/dist/lib/entries.d.ts +3 -1
- package/dist/lib/entries.d.ts.map +1 -1
- package/dist/lib/entries.js.map +1 -1
- package/dist/lib/grouped-entry-normalization.js +1 -1
- package/dist/lib/grouped-entry-normalization.js.map +1 -1
- package/dist/lib/jsonc.d.ts +8 -6
- package/dist/lib/jsonc.d.ts.map +1 -1
- package/dist/lib/jsonc.js +9 -52
- package/dist/lib/jsonc.js.map +1 -1
- package/dist/lib/kilo-config.d.ts +15 -0
- package/dist/lib/kilo-config.d.ts.map +1 -0
- package/dist/lib/kilo-config.js +26 -0
- package/dist/lib/kilo-config.js.map +1 -0
- package/dist/lib/kilo.d.ts +19 -0
- package/dist/lib/kilo.d.ts.map +1 -0
- package/dist/lib/kilo.js +75 -0
- package/dist/lib/kilo.js.map +1 -0
- package/dist/lib/ollama-cloud-config.d.ts +12 -34
- package/dist/lib/ollama-cloud-config.d.ts.map +1 -1
- package/dist/lib/ollama-cloud-config.js +24 -146
- package/dist/lib/ollama-cloud-config.js.map +1 -1
- package/dist/lib/ollama-cloud.d.ts +6 -10
- package/dist/lib/ollama-cloud.d.ts.map +1 -1
- package/dist/lib/ollama-cloud.js +142 -116
- package/dist/lib/ollama-cloud.js.map +1 -1
- package/dist/lib/provider-metadata.d.ts +16 -3
- package/dist/lib/provider-metadata.d.ts.map +1 -1
- package/dist/lib/provider-metadata.js +16 -3
- package/dist/lib/provider-metadata.js.map +1 -1
- package/dist/lib/quota-command-format.d.ts.map +1 -1
- package/dist/lib/quota-command-format.js +11 -9
- package/dist/lib/quota-command-format.js.map +1 -1
- package/dist/lib/quota-render-data.js +1 -1
- package/dist/lib/quota-render-data.js.map +1 -1
- package/dist/lib/quota-state.d.ts.map +1 -1
- package/dist/lib/quota-state.js +2 -1
- package/dist/lib/quota-state.js.map +1 -1
- package/dist/lib/quota-stats-format.d.ts.map +1 -1
- package/dist/lib/quota-stats-format.js +5 -3
- package/dist/lib/quota-stats-format.js.map +1 -1
- package/dist/lib/quota-status.js +2 -2
- package/dist/lib/quota-status.js.map +1 -1
- package/dist/lib/toast-format-grouped.js +3 -3
- package/dist/lib/toast-format-grouped.js.map +1 -1
- package/dist/lib/tui-compact-format.d.ts.map +1 -1
- package/dist/lib/tui-compact-format.js +16 -7
- package/dist/lib/tui-compact-format.js.map +1 -1
- package/dist/lib/types.d.ts +13 -6
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/providers/copilot.js +1 -1
- package/dist/providers/google-account-format.d.ts +3 -2
- package/dist/providers/google-account-format.d.ts.map +1 -1
- package/dist/providers/google-account-format.js +41 -10
- package/dist/providers/google-account-format.js.map +1 -1
- package/dist/providers/google-agy.d.ts.map +1 -1
- package/dist/providers/google-agy.js +11 -6
- package/dist/providers/google-agy.js.map +1 -1
- package/dist/providers/google-antigravity.d.ts.map +1 -1
- package/dist/providers/google-antigravity.js +17 -5
- package/dist/providers/google-antigravity.js.map +1 -1
- package/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/dist/providers/google-gemini-cli.js +12 -4
- package/dist/providers/google-gemini-cli.js.map +1 -1
- package/dist/providers/kilo.d.ts +6 -0
- package/dist/providers/kilo.d.ts.map +1 -0
- package/dist/providers/kilo.js +52 -0
- package/dist/providers/kilo.js.map +1 -0
- package/dist/providers/mimo.js +1 -1
- package/dist/providers/mimo.js.map +1 -1
- package/dist/providers/minimax-coding-plan.js +1 -1
- package/dist/providers/minimax-coding-plan.js.map +1 -1
- package/dist/providers/ollama-cloud.d.ts +2 -2
- package/dist/providers/ollama-cloud.d.ts.map +1 -1
- package/dist/providers/ollama-cloud.js +68 -47
- package/dist/providers/ollama-cloud.js.map +1 -1
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +2 -0
- package/dist/providers/registry.js.map +1 -1
- package/package.json +3 -9
|
@@ -1,148 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { getAuthPaths, readAuthFile } from "./opencode-auth.js";
|
|
2
|
+
import { createProviderApiKeyResolver, getGlobalOpencodeConfigCandidatePaths, } from "./api-key-resolver.js";
|
|
3
|
+
export { getGlobalOpencodeConfigCandidatePaths as getOpencodeConfigCandidatePaths } from "./api-key-resolver.js";
|
|
4
|
+
const ollamaCloudApiKeyResolver = createProviderApiKeyResolver({
|
|
5
|
+
envVars: [{ name: "OLLAMA_API_KEY", source: "env:OLLAMA_API_KEY" }],
|
|
6
|
+
providerKeys: ["ollama-cloud"],
|
|
7
|
+
allowedEnvVars: ["OLLAMA_API_KEY"],
|
|
8
|
+
configJsonSource: "opencode.json",
|
|
9
|
+
configJsoncSource: "opencode.jsonc",
|
|
10
|
+
getConfigCandidates: getGlobalOpencodeConfigCandidatePaths,
|
|
11
|
+
auth: {
|
|
12
|
+
readAuth: readAuthFile,
|
|
13
|
+
getAuthPaths,
|
|
14
|
+
authSource: "auth.json",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export async function resolveOllamaCloudApiKey() {
|
|
18
|
+
return ollamaCloudApiKeyResolver.resolve();
|
|
19
|
+
}
|
|
20
|
+
export async function hasOllamaCloudApiKey() {
|
|
21
|
+
return ollamaCloudApiKeyResolver.has();
|
|
22
|
+
}
|
|
23
|
+
export async function getOllamaCloudKeyDiagnostics() {
|
|
24
|
+
return ollamaCloudApiKeyResolver.diagnostics();
|
|
14
25
|
}
|
|
15
|
-
function getOllamaUsageConfigPath() {
|
|
16
|
-
const xdgConfigDir = xdgConfig || join(homedir(), ".config");
|
|
17
|
-
return join(xdgConfigDir, "ollama-usage", "config.yaml");
|
|
18
|
-
}
|
|
19
|
-
function getOllamaUsageLegacyPath() {
|
|
20
|
-
return join(homedir(), ".ollama-usage", "config.yaml");
|
|
21
|
-
}
|
|
22
|
-
function getConfigFileError(error) {
|
|
23
|
-
if (error instanceof SyntaxError) {
|
|
24
|
-
return `Failed to parse config: ${error.message}`;
|
|
25
|
-
}
|
|
26
|
-
if (error instanceof Error && error.message) {
|
|
27
|
-
return `Failed to read config file: ${error.message}`;
|
|
28
|
-
}
|
|
29
|
-
return `Failed to read config file: ${String(error)}`;
|
|
30
|
-
}
|
|
31
|
-
async function readJsonConfigFile(path) {
|
|
32
|
-
try {
|
|
33
|
-
const data = await readFile(path, "utf-8");
|
|
34
|
-
const parsed = JSON.parse(data);
|
|
35
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
36
|
-
return { state: "invalid", error: "Config file must contain a JSON object" };
|
|
37
|
-
}
|
|
38
|
-
return { state: "loaded", config: parsed };
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (error?.code === "ENOENT") {
|
|
42
|
-
return { state: "missing" };
|
|
43
|
-
}
|
|
44
|
-
return { state: "invalid", error: getConfigFileError(error) };
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function readYamlConfigFile(path) {
|
|
48
|
-
try {
|
|
49
|
-
const data = await readFile(path, "utf-8");
|
|
50
|
-
const cookieMatch = data.match(/(?:^|\n)\s*cookie\s*:\s*["']?\s*(.+?)\s*["']?\s*(?:\n|$)/);
|
|
51
|
-
if (cookieMatch && cookieMatch[1]) {
|
|
52
|
-
return { state: "loaded", config: { cookie: cookieMatch[1].trim() } };
|
|
53
|
-
}
|
|
54
|
-
return { state: "missing" };
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
if (error?.code === "ENOENT") {
|
|
58
|
-
return { state: "missing" };
|
|
59
|
-
}
|
|
60
|
-
return { state: "invalid", error: getConfigFileError(error) };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export function resolveOllamaCloudConfigFromEnv(env = process.env) {
|
|
64
|
-
const cookie = env.OLLAMA_USAGE_COOKIE?.trim();
|
|
65
|
-
if (!cookie)
|
|
66
|
-
return null;
|
|
67
|
-
return {
|
|
68
|
-
state: "configured",
|
|
69
|
-
config: { cookie },
|
|
70
|
-
source: "env",
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export async function resolveOllamaCloudConfig() {
|
|
74
|
-
const envResult = resolveOllamaCloudConfigFromEnv();
|
|
75
|
-
if (envResult)
|
|
76
|
-
return envResult;
|
|
77
|
-
const candidates = getConfigCandidatePaths();
|
|
78
|
-
for (const path of candidates) {
|
|
79
|
-
const isYaml = path.endsWith(".yaml");
|
|
80
|
-
const fileResult = isYaml
|
|
81
|
-
? await readYamlConfigFile(path)
|
|
82
|
-
: await readJsonConfigFile(path);
|
|
83
|
-
if (fileResult.state === "missing")
|
|
84
|
-
continue;
|
|
85
|
-
if (fileResult.state === "invalid") {
|
|
86
|
-
return { state: "invalid", source: path, error: fileResult.error };
|
|
87
|
-
}
|
|
88
|
-
const config = fileResult.config;
|
|
89
|
-
const cookie = typeof config.cookie === "string" ? config.cookie.trim() : "";
|
|
90
|
-
if (cookie) {
|
|
91
|
-
return {
|
|
92
|
-
state: "configured",
|
|
93
|
-
config: { cookie },
|
|
94
|
-
source: path,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return { state: "incomplete", source: path, missing: "cookie" };
|
|
98
|
-
}
|
|
99
|
-
return { state: "none" };
|
|
100
|
-
}
|
|
101
|
-
let cachedConfig = null;
|
|
102
|
-
let cachedAt = 0;
|
|
103
|
-
const DEFAULT_CACHE_MAX_AGE_MS = 30_000;
|
|
104
|
-
export { DEFAULT_CACHE_MAX_AGE_MS as DEFAULT_OLLAMA_CLOUD_CONFIG_CACHE_MAX_AGE_MS };
|
|
105
|
-
export async function resolveOllamaCloudConfigCached(params) {
|
|
106
|
-
const maxAgeMs = Math.max(0, params?.maxAgeMs ?? DEFAULT_CACHE_MAX_AGE_MS);
|
|
107
|
-
const now = Date.now();
|
|
108
|
-
if (cachedConfig && now - cachedAt < maxAgeMs) {
|
|
109
|
-
return cachedConfig;
|
|
110
|
-
}
|
|
111
|
-
cachedConfig = await resolveOllamaCloudConfig();
|
|
112
|
-
cachedAt = now;
|
|
113
|
-
return cachedConfig;
|
|
114
|
-
}
|
|
115
|
-
export async function getOllamaCloudConfigDiagnostics() {
|
|
116
|
-
const resolved = await resolveOllamaCloudConfig();
|
|
117
|
-
const checkedPaths = getConfigCandidatePaths();
|
|
118
|
-
if (resolved.state === "none") {
|
|
119
|
-
return { state: "none", source: null, missing: null, error: null, checkedPaths };
|
|
120
|
-
}
|
|
121
|
-
if (resolved.state === "incomplete") {
|
|
122
|
-
return {
|
|
123
|
-
state: "incomplete",
|
|
124
|
-
source: resolved.source,
|
|
125
|
-
missing: resolved.missing,
|
|
126
|
-
error: null,
|
|
127
|
-
checkedPaths,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if (resolved.state === "invalid") {
|
|
131
|
-
return {
|
|
132
|
-
state: "invalid",
|
|
133
|
-
source: resolved.source,
|
|
134
|
-
missing: null,
|
|
135
|
-
error: resolved.error,
|
|
136
|
-
checkedPaths,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
state: "configured",
|
|
141
|
-
source: resolved.source,
|
|
142
|
-
missing: null,
|
|
143
|
-
error: null,
|
|
144
|
-
checkedPaths,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export { getOllamaUsageConfigPath, getOllamaUsageLegacyPath };
|
|
148
26
|
//# sourceMappingURL=ollama-cloud-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama-cloud-config.js","sourceRoot":"","sources":["../../src/lib/ollama-cloud-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ollama-cloud-config.js","sourceRoot":"","sources":["../../src/lib/ollama-cloud-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,4BAA4B,EAC5B,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAa/B,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAEjH,MAAM,yBAAyB,GAAG,4BAA4B,CAAuB;IACnF,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACnE,YAAY,EAAE,CAAC,cAAc,CAAC;IAC9B,cAAc,EAAE,CAAC,gBAAgB,CAAC;IAClC,gBAAgB,EAAE,eAAe;IACjC,iBAAiB,EAAE,gBAAgB;IACnC,mBAAmB,EAAE,qCAAqC;IAC1D,IAAI,EAAE;QACJ,QAAQ,EAAE,YAAY;QACtB,YAAY;QACZ,UAAU,EAAE,WAAW;KACxB;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,OAAO,yBAAyB,CAAC,OAAO,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,yBAAyB,CAAC,GAAG,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAMhD,OAAO,yBAAyB,CAAC,WAAW,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ollama Cloud
|
|
2
|
+
* Ollama Cloud usage API client.
|
|
3
3
|
*
|
|
4
|
-
* Fetches
|
|
5
|
-
*
|
|
6
|
-
* `data-usage-track` aria-labels, `usage-meter__fill` style attributes,
|
|
7
|
-
* and `.local-time` data-time attributes.
|
|
4
|
+
* Fetches session and weekly usage fractions plus per-model request counts
|
|
5
|
+
* from the authenticated Ollama Cloud usage endpoint.
|
|
8
6
|
*/
|
|
9
7
|
import type { OllamaCloudResult } from "./types.js";
|
|
10
|
-
declare function
|
|
11
|
-
declare function
|
|
12
|
-
declare function extractPlanTier(html: string): string | null;
|
|
13
|
-
export declare function queryOllamaCloudQuota(cookie: string, options?: {
|
|
8
|
+
declare function parseOllamaCloudUsage(payload: unknown): OllamaCloudResult;
|
|
9
|
+
export declare function queryOllamaCloudQuota(options?: {
|
|
14
10
|
requestTimeoutMs?: number;
|
|
15
11
|
}): Promise<OllamaCloudResult>;
|
|
16
|
-
export {
|
|
12
|
+
export { parseOllamaCloudUsage as _parseOllamaCloudUsage };
|
|
17
13
|
//# sourceMappingURL=ollama-cloud.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama-cloud.d.ts","sourceRoot":"","sources":["../../src/lib/ollama-cloud.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ollama-cloud.d.ts","sourceRoot":"","sources":["../../src/lib/ollama-cloud.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAyB,iBAAiB,EAAqB,MAAM,YAAY,CAAC;AAkH9F,iBAAS,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CA6ClE;AAED,wBAAsB,qBAAqB,CACzC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1C,OAAO,CAAC,iBAAiB,CAAC,CAkC5B;AAED,OAAO,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,CAAC"}
|
package/dist/lib/ollama-cloud.js
CHANGED
|
@@ -1,155 +1,181 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ollama Cloud
|
|
2
|
+
* Ollama Cloud usage API client.
|
|
3
3
|
*
|
|
4
|
-
* Fetches
|
|
5
|
-
*
|
|
6
|
-
* `data-usage-track` aria-labels, `usage-meter__fill` style attributes,
|
|
7
|
-
* and `.local-time` data-time attributes.
|
|
4
|
+
* Fetches session and weekly usage fractions plus per-model request counts
|
|
5
|
+
* from the authenticated Ollama Cloud usage endpoint.
|
|
8
6
|
*/
|
|
9
|
-
import { fetchWithTimeout } from "./http.js";
|
|
10
7
|
import { sanitizeSingleLineDisplayText } from "./display-sanitize.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
import { fetchWithTimeout } from "./http.js";
|
|
9
|
+
import { resolveOllamaCloudApiKey } from "./ollama-cloud-config.js";
|
|
10
|
+
const OLLAMA_CLOUD_USAGE_URL = "https://ollama.com/api/usage";
|
|
11
|
+
const MAX_RESPONSE_BYTES = 256 * 1024;
|
|
12
|
+
const MAX_MODEL_ROWS = 100;
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
function sanitizeRemoteSingleLineText(text) {
|
|
17
|
+
return sanitizeSingleLineDisplayText(text).replace(/\p{Cf}/gu, "");
|
|
18
|
+
}
|
|
19
|
+
function sanitizeMessage(text, secret, maxLength = 200) {
|
|
20
|
+
const redacted = secret ? text.split(secret).join("[redacted]") : text;
|
|
21
|
+
const sanitized = sanitizeRemoteSingleLineText(redacted);
|
|
22
|
+
return (sanitized || "unknown").slice(0, maxLength);
|
|
23
|
+
}
|
|
24
|
+
async function readBoundedText(response, maxBytes) {
|
|
25
|
+
if (!response.body) {
|
|
26
|
+
const text = await response.text();
|
|
27
|
+
if (new TextEncoder().encode(text).byteLength > maxBytes) {
|
|
28
|
+
throw new Error(`Ollama Cloud usage API response exceeded ${maxBytes} bytes`);
|
|
25
29
|
}
|
|
30
|
+
return text;
|
|
26
31
|
}
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const reader = response.body.getReader();
|
|
33
|
+
const decoder = new TextDecoder();
|
|
34
|
+
let text = "";
|
|
35
|
+
let byteLength = 0;
|
|
36
|
+
try {
|
|
37
|
+
while (true) {
|
|
38
|
+
const { done, value } = await reader.read();
|
|
39
|
+
if (done)
|
|
40
|
+
break;
|
|
41
|
+
byteLength += value.byteLength;
|
|
42
|
+
if (byteLength > maxBytes) {
|
|
43
|
+
await reader.cancel();
|
|
44
|
+
throw new Error(`Ollama Cloud usage API response exceeded ${maxBytes} bytes`);
|
|
34
45
|
}
|
|
46
|
+
text += decoder.decode(value, { stream: true });
|
|
35
47
|
}
|
|
48
|
+
return text + decoder.decode();
|
|
36
49
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function extractResetTimes(html) {
|
|
40
|
-
const times = [];
|
|
41
|
-
let match;
|
|
42
|
-
const re = new RegExp(LOCAL_TIME_RE.source, LOCAL_TIME_RE.flags);
|
|
43
|
-
while ((match = re.exec(html)) !== null) {
|
|
44
|
-
times.push(match[1]);
|
|
50
|
+
finally {
|
|
51
|
+
reader.releaseLock();
|
|
45
52
|
}
|
|
46
|
-
return times;
|
|
47
|
-
}
|
|
48
|
-
function extractPlanTier(html) {
|
|
49
|
-
const match = html.match(PLAN_TIER_RE);
|
|
50
|
-
return match ? match[1].trim() : null;
|
|
51
53
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
function parseWindow(value) {
|
|
55
|
+
if (!isRecord(value))
|
|
56
|
+
return undefined;
|
|
57
|
+
const usageFraction = value.usage;
|
|
58
|
+
if (typeof usageFraction !== "number" ||
|
|
59
|
+
!Number.isFinite(usageFraction) ||
|
|
60
|
+
usageFraction < 0 ||
|
|
61
|
+
usageFraction > 1) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const usagePercent = usageFraction * 100;
|
|
65
|
+
return {
|
|
66
|
+
usageFraction,
|
|
67
|
+
usagePercent,
|
|
68
|
+
percentRemaining: 100 - usagePercent,
|
|
69
|
+
};
|
|
55
70
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
function parseModels(value, rowErrors) {
|
|
72
|
+
if (!Array.isArray(value)) {
|
|
73
|
+
rowErrors.push("Models: expected an array");
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const models = [];
|
|
77
|
+
const seenModels = new Set();
|
|
78
|
+
for (const candidate of value) {
|
|
79
|
+
if (!isRecord(candidate)) {
|
|
80
|
+
rowErrors.push("Models: ignored an invalid row");
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const model = typeof candidate.model === "string"
|
|
84
|
+
? sanitizeRemoteSingleLineText(candidate.model).slice(0, 160)
|
|
85
|
+
: "";
|
|
86
|
+
const requests = candidate.requests;
|
|
87
|
+
if (!model) {
|
|
88
|
+
rowErrors.push("Models: ignored a row without a model name");
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (typeof requests !== "number" || !Number.isSafeInteger(requests) || requests < 0) {
|
|
92
|
+
rowErrors.push(`Models: ignored invalid request count for ${model}`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (seenModels.has(model)) {
|
|
96
|
+
rowErrors.push(`Models: ignored duplicate model ${model}`);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
seenModels.add(model);
|
|
100
|
+
models.push({ model, requests });
|
|
101
|
+
}
|
|
102
|
+
return models.sort((left, right) => left.model.localeCompare(right.model));
|
|
62
103
|
}
|
|
63
|
-
|
|
64
|
-
if (
|
|
104
|
+
function parseOllamaCloudUsage(payload) {
|
|
105
|
+
if (!isRecord(payload)) {
|
|
106
|
+
return {
|
|
107
|
+
success: false,
|
|
108
|
+
error: "Ollama Cloud usage API returned an unexpected response shape",
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(payload.models) && payload.models.length > MAX_MODEL_ROWS) {
|
|
65
112
|
return {
|
|
66
113
|
success: false,
|
|
67
|
-
error:
|
|
114
|
+
error: `Ollama Cloud usage API returned more than ${MAX_MODEL_ROWS} model rows`,
|
|
68
115
|
};
|
|
69
116
|
}
|
|
117
|
+
const rowErrors = [];
|
|
118
|
+
const limits = isRecord(payload.limits) ? payload.limits : undefined;
|
|
119
|
+
const session = parseWindow(limits?.session);
|
|
120
|
+
const weekly = parseWindow(limits?.weekly);
|
|
121
|
+
if (limits?.session !== undefined && !session) {
|
|
122
|
+
rowErrors.push("Session: ignored invalid usage fraction");
|
|
123
|
+
}
|
|
124
|
+
if (limits?.weekly !== undefined && !weekly) {
|
|
125
|
+
rowErrors.push("Weekly: ignored invalid usage fraction");
|
|
126
|
+
}
|
|
127
|
+
if (!limits) {
|
|
128
|
+
rowErrors.push("Limits: expected an object");
|
|
129
|
+
}
|
|
130
|
+
const models = parseModels(payload.models, rowErrors);
|
|
131
|
+
if (!session && !weekly && models.length === 0) {
|
|
132
|
+
return {
|
|
133
|
+
success: false,
|
|
134
|
+
error: "Ollama Cloud usage API returned no usable usage data",
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
...(session ? { session } : {}),
|
|
140
|
+
...(weekly ? { weekly } : {}),
|
|
141
|
+
models,
|
|
142
|
+
...(rowErrors.length > 0 ? { rowErrors } : {}),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export async function queryOllamaCloudQuota(options = {}) {
|
|
146
|
+
const resolved = await resolveOllamaCloudApiKey();
|
|
147
|
+
if (!resolved)
|
|
148
|
+
return null;
|
|
70
149
|
try {
|
|
71
|
-
return await fetchWithTimeout(
|
|
150
|
+
return await fetchWithTimeout(OLLAMA_CLOUD_USAGE_URL, {
|
|
72
151
|
request: {
|
|
73
152
|
method: "GET",
|
|
74
153
|
headers: {
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
Cookie: `${COOKIE_NAME_PREFIX}${normalizeCookie(cookie)}`,
|
|
154
|
+
Accept: "application/json",
|
|
155
|
+
Authorization: resolved.key,
|
|
78
156
|
},
|
|
79
157
|
redirect: "manual",
|
|
80
158
|
},
|
|
81
|
-
timeoutMs: options.requestTimeoutMs
|
|
159
|
+
timeoutMs: options.requestTimeoutMs,
|
|
82
160
|
consume: async (response) => {
|
|
83
|
-
|
|
84
|
-
const location = response.headers.get("location") || "";
|
|
85
|
-
return {
|
|
86
|
-
success: false,
|
|
87
|
-
error: `Authentication error: redirected to ${sanitizeMessage(location, 80)} — cookie may be expired`,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
161
|
+
const text = await readBoundedText(response, MAX_RESPONSE_BYTES);
|
|
90
162
|
if (!response.ok) {
|
|
91
|
-
const
|
|
92
|
-
return {
|
|
93
|
-
success: false,
|
|
94
|
-
error: `Ollama Cloud settings error ${response.status}: ${sanitizeMessage(text)}`,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const html = await response.text();
|
|
98
|
-
const planTier = extractPlanTier(html);
|
|
99
|
-
const tracks = [];
|
|
100
|
-
let trackMatch;
|
|
101
|
-
const trackRe = new RegExp(DATA_USAGE_TRACK_RE.source, DATA_USAGE_TRACK_RE.flags);
|
|
102
|
-
while ((trackMatch = trackRe.exec(html)) !== null) {
|
|
103
|
-
tracks.push(trackMatch[0]);
|
|
104
|
-
}
|
|
105
|
-
if (tracks.length === 0) {
|
|
106
|
-
return {
|
|
107
|
-
success: false,
|
|
108
|
-
error: "Could not parse usage tracks from Ollama Cloud settings page (found 0)",
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
const sessionPercent = tracks[0] ? extractUsagePercentFromTrack(tracks[0]) : null;
|
|
112
|
-
const weeklyPercent = tracks[1] ? extractUsagePercentFromTrack(tracks[1]) : null;
|
|
113
|
-
if (sessionPercent === null && weeklyPercent === null) {
|
|
163
|
+
const snippet = sanitizeMessage(text, resolved.key);
|
|
114
164
|
return {
|
|
115
165
|
success: false,
|
|
116
|
-
error:
|
|
166
|
+
error: `Ollama Cloud usage API error ${response.status}: ${snippet}`,
|
|
117
167
|
};
|
|
118
168
|
}
|
|
119
|
-
|
|
120
|
-
const sessionResetsAt = resetTimes[0] || undefined;
|
|
121
|
-
const weeklyResetsAt = resetTimes[1] || undefined;
|
|
122
|
-
return {
|
|
123
|
-
success: true,
|
|
124
|
-
...(sessionPercent !== null
|
|
125
|
-
? {
|
|
126
|
-
session: {
|
|
127
|
-
usagePercent: sessionPercent,
|
|
128
|
-
percentRemaining: 100 - sessionPercent,
|
|
129
|
-
resetTimeIso: sessionResetsAt,
|
|
130
|
-
},
|
|
131
|
-
}
|
|
132
|
-
: {}),
|
|
133
|
-
...(weeklyPercent !== null
|
|
134
|
-
? {
|
|
135
|
-
weekly: {
|
|
136
|
-
usagePercent: weeklyPercent,
|
|
137
|
-
percentRemaining: 100 - weeklyPercent,
|
|
138
|
-
resetTimeIso: weeklyResetsAt,
|
|
139
|
-
},
|
|
140
|
-
}
|
|
141
|
-
: {}),
|
|
142
|
-
...(planTier ? { planTier } : {}),
|
|
143
|
-
};
|
|
169
|
+
return parseOllamaCloudUsage(JSON.parse(text));
|
|
144
170
|
},
|
|
145
171
|
});
|
|
146
172
|
}
|
|
147
|
-
catch (
|
|
173
|
+
catch (error) {
|
|
148
174
|
return {
|
|
149
175
|
success: false,
|
|
150
|
-
error: sanitizeMessage(
|
|
176
|
+
error: sanitizeMessage(error instanceof Error ? error.message : String(error), resolved.key),
|
|
151
177
|
};
|
|
152
178
|
}
|
|
153
179
|
}
|
|
154
|
-
export {
|
|
180
|
+
export { parseOllamaCloudUsage as _parseOllamaCloudUsage };
|
|
155
181
|
//# sourceMappingURL=ollama-cloud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama-cloud.js","sourceRoot":"","sources":["../../src/lib/ollama-cloud.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{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AQ,CAAC,GAAG;iBAC5B;gBACD,QAAQ,EAAE,QAAQ;aACnB;YACD,SAAS,EAAE,OAAO,CAAC,gBAAgB;YACnC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAC1B,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;gBACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;oBACpD,OAAO;wBACL,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,gCAAgC,QAAQ,CAAC,MAAM,KAAK,OAAO,EAAE;qBACrE,CAAC;gBACJ,CAAC;gBAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC,CAAC;YAC5D,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,eAAe,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC;SAC7F,CAAC;IACJ,CAAC;AACH,CAAC;AAED,OAAO,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,CAAC"}
|
|
@@ -46,6 +46,18 @@ declare const PROVIDER_CATALOG_SOURCE: {
|
|
|
46
46
|
readonly quota: "remote_api";
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
+
readonly kilo: {
|
|
50
|
+
readonly label: "Kilo Gateway";
|
|
51
|
+
readonly runtimeIds: readonly ["kilo"];
|
|
52
|
+
readonly synonyms: readonly [];
|
|
53
|
+
readonly shape: {
|
|
54
|
+
readonly autoSetup: "usually";
|
|
55
|
+
readonly authentication: "opencode_auth_api_key";
|
|
56
|
+
readonly authFallbacks: readonly ["env_api_key", "global_opencode_config"];
|
|
57
|
+
readonly quota: "remote_api";
|
|
58
|
+
readonly notes: "Queries the documented Kilo profile balance API; reports personal USD balance only";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
49
61
|
readonly cursor: {
|
|
50
62
|
readonly label: "Cursor";
|
|
51
63
|
readonly runtimeIds: readonly ["cursor", "cursor-acp"];
|
|
@@ -271,10 +283,11 @@ declare const PROVIDER_CATALOG_SOURCE: {
|
|
|
271
283
|
readonly runtimeIds: readonly ["ollama-cloud"];
|
|
272
284
|
readonly synonyms: readonly [];
|
|
273
285
|
readonly shape: {
|
|
274
|
-
readonly autoSetup: "
|
|
275
|
-
readonly authentication: "
|
|
286
|
+
readonly autoSetup: "usually";
|
|
287
|
+
readonly authentication: "opencode_auth_api_key";
|
|
288
|
+
readonly authFallbacks: readonly ["env_api_key", "global_opencode_config"];
|
|
276
289
|
readonly quota: "remote_api";
|
|
277
|
-
readonly notes: "
|
|
290
|
+
readonly notes: "Queries the Ollama Cloud usage API; reports session and weekly quota plus model request counts";
|
|
278
291
|
};
|
|
279
292
|
};
|
|
280
293
|
readonly "quota-providers": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-metadata.d.ts","sourceRoot":"","sources":["../../src/lib/provider-metadata.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,SAAS,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEnG,MAAM,MAAM,2BAA2B,GACnC,2BAA2B,GAC3B,uBAAuB,GACvB,4BAA4B,GAC5B,gBAAgB,GAChB,qBAAqB,GACrB,kBAAkB,GAClB,YAAY,CAAC;AAEjB,MAAM,MAAM,yBAAyB,GAAG,aAAa,GAAG,wBAAwB,CAAC;AAEjF,MAAM,MAAM,wBAAwB,GAChC,YAAY,GACZ,kBAAkB,GAClB,0BAA0B,GAC1B,kBAAkB,CAAC;AAsBvB,QAAA,MAAM,uBA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