openlimiter 0.1.0 → 0.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/dist/cli.d.ts +11 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +237 -42
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +112 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +253 -8
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/ingest.d.ts +24 -1
- package/dist/ingest.d.ts.map +1 -1
- package/dist/ingest.js +34 -0
- package/dist/ingest.js.map +1 -1
- package/dist/render.d.ts +138 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +357 -0
- package/dist/render.js.map +1 -0
- package/dist/serve.d.ts +36 -3
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +220 -128
- package/dist/serve.js.map +1 -1
- package/dist/statusline.d.ts +91 -0
- package/dist/statusline.d.ts.map +1 -0
- package/dist/statusline.js +328 -0
- package/dist/statusline.js.map +1 -0
- package/package.json +4 -4
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAI1D,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG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stat, mkdir } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { canonicalJson, resolveStateDirectory, writeFileAtomically } from "@openlimiter/core";
|
|
3
|
+
import { canonicalJson, readJsonFileSafely, resolveStateDirectory, writeFileAtomically } from "@openlimiter/core";
|
|
4
4
|
import { connectors } from "@openlimiter/connectors";
|
|
5
5
|
export const CONFIG_FILE_NAME = "openlimiter-config.json";
|
|
6
|
+
export const STATUSLINE_KEYS = [
|
|
7
|
+
"order",
|
|
8
|
+
"meters",
|
|
9
|
+
"width",
|
|
10
|
+
"rows",
|
|
11
|
+
"bars",
|
|
12
|
+
"color"
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* The narrowest and widest budget a row may be given.
|
|
16
|
+
*
|
|
17
|
+
* Below forty columns not one cell and its header fit, so the setting would
|
|
18
|
+
* only ever produce an empty row. Above four hundred the budget stops
|
|
19
|
+
* describing any real terminal and starts being a way to ask for an unbounded
|
|
20
|
+
* line, which this tool does not print.
|
|
21
|
+
*/
|
|
22
|
+
export const MIN_STATUSLINE_WIDTH = 40;
|
|
23
|
+
export const MAX_STATUSLINE_WIDTH = 400;
|
|
24
|
+
export const DEFAULT_STATUSLINE = {
|
|
25
|
+
order: [],
|
|
26
|
+
meters: "worst",
|
|
27
|
+
width: 140,
|
|
28
|
+
rows: 2,
|
|
29
|
+
bars: true,
|
|
30
|
+
color: "auto"
|
|
31
|
+
};
|
|
32
|
+
const connectorIds = connectors.map((connector) => connector.id);
|
|
33
|
+
/** The list of ids an error message offers back to the reader. */
|
|
34
|
+
const connectorIdList = connectorIds.join(", ");
|
|
35
|
+
function isRecord(value) {
|
|
36
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
function normalizeOrder(value) {
|
|
39
|
+
if (!Array.isArray(value))
|
|
40
|
+
return null;
|
|
41
|
+
if (value.length > connectorIds.length)
|
|
42
|
+
return null;
|
|
43
|
+
const order = [];
|
|
44
|
+
for (const entry of value) {
|
|
45
|
+
if (typeof entry !== "string")
|
|
46
|
+
return null;
|
|
47
|
+
const id = entry.toLowerCase();
|
|
48
|
+
if (!connectorIds.includes(id) || order.includes(id))
|
|
49
|
+
return null;
|
|
50
|
+
order.push(id);
|
|
51
|
+
}
|
|
52
|
+
return order;
|
|
53
|
+
}
|
|
54
|
+
function normalizeWidth(value) {
|
|
55
|
+
if (typeof value !== "number" || !Number.isInteger(value))
|
|
56
|
+
return null;
|
|
57
|
+
if (value < MIN_STATUSLINE_WIDTH || value > MAX_STATUSLINE_WIDTH)
|
|
58
|
+
return null;
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Read a stored statusline section, key by key, keeping what is usable.
|
|
63
|
+
*
|
|
64
|
+
* A key this does not understand falls back to its default rather than
|
|
65
|
+
* rejecting the file. The statusline is drawn inside somebody else's tool and
|
|
66
|
+
* a hand edited typo in one field is not a reason to stop drawing the other
|
|
67
|
+
* five. Everything written through `openlimiter config set` is validated
|
|
68
|
+
* before it lands, so this path only ever repairs a file edited by hand.
|
|
69
|
+
*/
|
|
70
|
+
export function normalizeStatusline(value) {
|
|
71
|
+
if (!isRecord(value))
|
|
72
|
+
return DEFAULT_STATUSLINE;
|
|
73
|
+
const meters = value["meters"];
|
|
74
|
+
const rows = value["rows"];
|
|
75
|
+
const bars = value["bars"];
|
|
76
|
+
const color = value["color"];
|
|
77
|
+
return {
|
|
78
|
+
order: normalizeOrder(value["order"]) ?? DEFAULT_STATUSLINE.order,
|
|
79
|
+
meters: meters === "worst" || meters === "all" ? meters : DEFAULT_STATUSLINE.meters,
|
|
80
|
+
width: normalizeWidth(value["width"]) ?? DEFAULT_STATUSLINE.width,
|
|
81
|
+
rows: rows === 1 || rows === 2 ? rows : DEFAULT_STATUSLINE.rows,
|
|
82
|
+
bars: typeof bars === "boolean" ? bars : DEFAULT_STATUSLINE.bars,
|
|
83
|
+
color: color === "auto" || color === "always" || color === "never"
|
|
84
|
+
? color
|
|
85
|
+
: DEFAULT_STATUSLINE.color
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** One stored key, rendered the way `config get` prints it. */
|
|
89
|
+
export function statuslineValueText(statusline, key) {
|
|
90
|
+
if (key === "order") {
|
|
91
|
+
return statusline.order.length === 0 ? "NONE" : statusline.order.join(",");
|
|
92
|
+
}
|
|
93
|
+
if (key === "meters")
|
|
94
|
+
return statusline.meters;
|
|
95
|
+
if (key === "width")
|
|
96
|
+
return String(statusline.width);
|
|
97
|
+
if (key === "rows")
|
|
98
|
+
return String(statusline.rows);
|
|
99
|
+
if (key === "bars")
|
|
100
|
+
return statusline.bars ? "true" : "false";
|
|
101
|
+
return statusline.color;
|
|
102
|
+
}
|
|
103
|
+
export function isStatuslineKey(key) {
|
|
104
|
+
return STATUSLINE_KEYS.includes(key);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Apply one key from the command line, or say why it cannot be applied.
|
|
108
|
+
*
|
|
109
|
+
* Every rejection names the key and lists what it would have accepted, because
|
|
110
|
+
* a configuration error a person cannot fix from the message is a second
|
|
111
|
+
* problem on top of the first. No value is ever coerced into something near
|
|
112
|
+
* enough: a width of `wide` is refused rather than read as the default.
|
|
113
|
+
*/
|
|
114
|
+
export function setStatuslineValue(statusline, key, value) {
|
|
115
|
+
if (!isStatuslineKey(key)) {
|
|
116
|
+
return {
|
|
117
|
+
ok: false,
|
|
118
|
+
message: "unknown statusline key. Known keys: " + STATUSLINE_KEYS.join(", ") + "."
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (key === "order") {
|
|
122
|
+
if (value === "" || value === "NONE" || value === "none") {
|
|
123
|
+
return { ok: true, statusline: { ...statusline, order: [] } };
|
|
124
|
+
}
|
|
125
|
+
const order = normalizeOrder(value.split(",").map((entry) => entry.trim()));
|
|
126
|
+
return order === null
|
|
127
|
+
? {
|
|
128
|
+
ok: false,
|
|
129
|
+
message: "statusline.order must be a comma separated list of provider " +
|
|
130
|
+
"ids from " + connectorIdList + ", each named once, or NONE for the " +
|
|
131
|
+
"built in order."
|
|
132
|
+
}
|
|
133
|
+
: { ok: true, statusline: { ...statusline, order } };
|
|
134
|
+
}
|
|
135
|
+
if (key === "meters") {
|
|
136
|
+
return value === "worst" || value === "all"
|
|
137
|
+
? { ok: true, statusline: { ...statusline, meters: value } }
|
|
138
|
+
: { ok: false, message: "statusline.meters must be worst or all." };
|
|
139
|
+
}
|
|
140
|
+
if (key === "width") {
|
|
141
|
+
const width = /^\d{1,4}$/u.test(value) ? normalizeWidth(Number(value)) : null;
|
|
142
|
+
return width === null
|
|
143
|
+
? {
|
|
144
|
+
ok: false,
|
|
145
|
+
message: "statusline.width must be a whole number from " +
|
|
146
|
+
String(MIN_STATUSLINE_WIDTH) + " to " + String(MAX_STATUSLINE_WIDTH) + "."
|
|
147
|
+
}
|
|
148
|
+
: { ok: true, statusline: { ...statusline, width } };
|
|
149
|
+
}
|
|
150
|
+
if (key === "rows") {
|
|
151
|
+
return value === "1" || value === "2"
|
|
152
|
+
? { ok: true, statusline: { ...statusline, rows: value === "1" ? 1 : 2 } }
|
|
153
|
+
: { ok: false, message: "statusline.rows must be 1 or 2." };
|
|
154
|
+
}
|
|
155
|
+
if (key === "bars") {
|
|
156
|
+
return value === "true" || value === "false"
|
|
157
|
+
? { ok: true, statusline: { ...statusline, bars: value === "true" } }
|
|
158
|
+
: { ok: false, message: "statusline.bars must be true or false." };
|
|
159
|
+
}
|
|
160
|
+
return value === "auto" || value === "always" || value === "never"
|
|
161
|
+
? { ok: true, statusline: { ...statusline, color: value } }
|
|
162
|
+
: { ok: false, message: "statusline.color must be auto, always, or never." };
|
|
163
|
+
}
|
|
6
164
|
async function rejectSymlink(target) {
|
|
7
165
|
try {
|
|
8
166
|
if ((await lstat(target)).isSymbolicLink())
|
|
@@ -21,21 +179,94 @@ export async function writeConfig(config, directory = resolveStateDirectory()) {
|
|
|
21
179
|
await rejectSymlink(target);
|
|
22
180
|
await writeFileAtomically(target, canonicalJson(config));
|
|
23
181
|
}
|
|
182
|
+
function connectorRows(environment) {
|
|
183
|
+
return connectors.map((connector) => ({
|
|
184
|
+
id: connector.id,
|
|
185
|
+
enabled: true,
|
|
186
|
+
detected: connector.detect(environment)
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
function normalizeConnectors(value) {
|
|
190
|
+
if (!Array.isArray(value))
|
|
191
|
+
return [];
|
|
192
|
+
const rows = [];
|
|
193
|
+
for (const entry of value.slice(0, connectorIds.length)) {
|
|
194
|
+
if (!isRecord(entry))
|
|
195
|
+
continue;
|
|
196
|
+
const id = entry["id"];
|
|
197
|
+
if (typeof id !== "string" || !connectorIds.includes(id))
|
|
198
|
+
continue;
|
|
199
|
+
if (rows.some((row) => row.id === id))
|
|
200
|
+
continue;
|
|
201
|
+
rows.push({ id, enabled: true, detected: entry["detected"] === true });
|
|
202
|
+
}
|
|
203
|
+
return rows;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Read the configuration file.
|
|
207
|
+
*
|
|
208
|
+
* The document is validated the same way the cache is: an unreadable or
|
|
209
|
+
* unsafe file is reported rather than replaced, and a readable file with a
|
|
210
|
+
* field this version does not recognise keeps the fields it does. A file that
|
|
211
|
+
* is simply not there yet is `missing`, which is not a failure.
|
|
212
|
+
*/
|
|
213
|
+
export async function readConfig(directory = resolveStateDirectory()) {
|
|
214
|
+
try {
|
|
215
|
+
await rejectSymlink(directory);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return { ok: false, reason: "unsafe" };
|
|
219
|
+
}
|
|
220
|
+
const document = await readJsonFileSafely(path.join(directory, CONFIG_FILE_NAME));
|
|
221
|
+
if (!document.ok)
|
|
222
|
+
return document;
|
|
223
|
+
if (!isRecord(document.value))
|
|
224
|
+
return { ok: false, reason: "corrupt" };
|
|
225
|
+
return {
|
|
226
|
+
ok: true,
|
|
227
|
+
config: {
|
|
228
|
+
version: 1,
|
|
229
|
+
connectors: normalizeConnectors(document.value["connectors"]),
|
|
230
|
+
statusline: normalizeStatusline(document.value["statusline"])
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The statusline section, or the defaults, and never an exception.
|
|
236
|
+
*
|
|
237
|
+
* The statusline command runs inside another tool's status row on every
|
|
238
|
+
* redraw. It reads its own configuration the way it reads everything else:
|
|
239
|
+
* if the answer is not there, the answer is the default, and the line is still
|
|
240
|
+
* drawn.
|
|
241
|
+
*/
|
|
242
|
+
export async function readStatuslineConfig(directory) {
|
|
243
|
+
try {
|
|
244
|
+
const result = await readConfig(directory);
|
|
245
|
+
return result.ok ? result.config.statusline : DEFAULT_STATUSLINE;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return DEFAULT_STATUSLINE;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
24
251
|
export async function initialize(environment, credentialStore, promptForSecret, directory) {
|
|
252
|
+
/*
|
|
253
|
+
* Re running init re detects the connectors and keeps the statusline the
|
|
254
|
+
* person configured. Detection is a fact about the machine and is meant to
|
|
255
|
+
* be refreshed; the layout is a preference and overwriting it would punish
|
|
256
|
+
* anyone who ran the command twice.
|
|
257
|
+
*/
|
|
258
|
+
const existing = await readConfig(directory ?? resolveStateDirectory()).catch(() => ({ ok: false, reason: "missing" }));
|
|
25
259
|
const config = {
|
|
26
260
|
version: 1,
|
|
27
|
-
connectors:
|
|
28
|
-
|
|
29
|
-
enabled: true,
|
|
30
|
-
detected: connector.detect(environment)
|
|
31
|
-
}))
|
|
261
|
+
connectors: connectorRows(environment),
|
|
262
|
+
statusline: existing.ok ? existing.config.statusline : DEFAULT_STATUSLINE
|
|
32
263
|
};
|
|
33
264
|
let credentialStored = false;
|
|
34
265
|
const openrouter = config.connectors.find((connector) => connector.id === "openrouter");
|
|
35
266
|
if (openrouter?.detected === true) {
|
|
36
267
|
try {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
268
|
+
const existingSecret = await credentialStore.get("openlimiter", "openrouter");
|
|
269
|
+
if (existingSecret === null) {
|
|
39
270
|
const secret = await promptForSecret();
|
|
40
271
|
if (secret.length > 0 && secret.length <= 8_192) {
|
|
41
272
|
await credentialStore.set("openlimiter", "openrouter", secret);
|
|
@@ -50,4 +281,18 @@ export async function initialize(environment, credentialStore, promptForSecret,
|
|
|
50
281
|
await writeConfig(config, directory);
|
|
51
282
|
return { config, credentialStored };
|
|
52
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* The configuration a `config set` writes into when there is no file yet.
|
|
286
|
+
*
|
|
287
|
+
* Connector detection is redone rather than left blank, so a first `config
|
|
288
|
+
* set` produces the same file `init` would have produced with the chosen key
|
|
289
|
+
* changed, instead of a file that claims no connector exists.
|
|
290
|
+
*/
|
|
291
|
+
export function defaultConfig(environment) {
|
|
292
|
+
return {
|
|
293
|
+
version: 1,
|
|
294
|
+
connectors: connectorRows(environment),
|
|
295
|
+
statusline: DEFAULT_STATUSLINE
|
|
296
|
+
};
|
|
297
|
+
}
|
|
53
298
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B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AU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
package/dist/ingest.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CacheMergeResult, type Snapshot } from "@openlimiter/core";
|
|
1
|
+
import { type CacheMergeResult, type RawMeter, type Snapshot, type SnapshotProvenance } from "@openlimiter/core";
|
|
2
2
|
/** Largest document accepted on standard input. */
|
|
3
3
|
export declare const STDIN_BYTE_LIMIT = 262144;
|
|
4
4
|
/** Hard ceiling on how long a command waits for standard input. */
|
|
@@ -22,6 +22,29 @@ export type JsonText = {
|
|
|
22
22
|
export declare function readStandardInputText(stream?: NodeJS.ReadStream, byteLimit?: number, timeoutMilliseconds?: number): Promise<string | null>;
|
|
23
23
|
/** Parse untrusted text as JSON without throwing. */
|
|
24
24
|
export declare function parseJsonText(text: string | null): JsonText;
|
|
25
|
+
/**
|
|
26
|
+
* Where a reading came from, stated by the code that actually knows.
|
|
27
|
+
*
|
|
28
|
+
* A parser is handed a payload and cannot tell whether Claude Code piped it in
|
|
29
|
+
* a moment ago or a person pasted it from a chat window last week, and those
|
|
30
|
+
* two readings deserve different words on a card. Only these boundaries know,
|
|
31
|
+
* so the stamp is applied here and the parsers stay pure functions of their
|
|
32
|
+
* input. Every value below is ours: nothing a provider sends can become one.
|
|
33
|
+
*/
|
|
34
|
+
/** A live Claude Code session payload, arriving on standard input. */
|
|
35
|
+
export declare const STATUSLINE_PROVENANCE: SnapshotProvenance;
|
|
36
|
+
/** A payload a person handed us with `openlimiter ingest`. */
|
|
37
|
+
export declare const INGEST_PROVENANCE: SnapshotProvenance;
|
|
38
|
+
/** The manual quota document, read from the state directory. */
|
|
39
|
+
export declare const MANUAL_PROVENANCE: SnapshotProvenance;
|
|
40
|
+
/**
|
|
41
|
+
* Stamp provenance onto meters a parser just produced.
|
|
42
|
+
*
|
|
43
|
+
* Applied at the boundary, before normalization, so the normalizer validates
|
|
44
|
+
* the stamp the same way it validates everything else and a stamp this code got
|
|
45
|
+
* wrong is caught rather than trusted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function withProvenance(meters: readonly RawMeter[], provenance: SnapshotProvenance): RawMeter[];
|
|
25
48
|
/**
|
|
26
49
|
* Read the manual quota document from the state directory.
|
|
27
50
|
*
|
package/dist/ingest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KA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,CAAC,CAMlB;AAED,uEAAuE;AACvE,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAMvF;AAED;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACzD,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAQ7C;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAK3B"}
|
package/dist/ingest.js
CHANGED
|
@@ -65,6 +65,40 @@ export function parseJsonText(text) {
|
|
|
65
65
|
return { ok: false };
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Where a reading came from, stated by the code that actually knows.
|
|
70
|
+
*
|
|
71
|
+
* A parser is handed a payload and cannot tell whether Claude Code piped it in
|
|
72
|
+
* a moment ago or a person pasted it from a chat window last week, and those
|
|
73
|
+
* two readings deserve different words on a card. Only these boundaries know,
|
|
74
|
+
* so the stamp is applied here and the parsers stay pure functions of their
|
|
75
|
+
* input. Every value below is ours: nothing a provider sends can become one.
|
|
76
|
+
*/
|
|
77
|
+
/** A live Claude Code session payload, arriving on standard input. */
|
|
78
|
+
export const STATUSLINE_PROVENANCE = {
|
|
79
|
+
sourceKind: "statusline_payload",
|
|
80
|
+
observedVia: "claude_code_statusline"
|
|
81
|
+
};
|
|
82
|
+
/** A payload a person handed us with `openlimiter ingest`. */
|
|
83
|
+
export const INGEST_PROVENANCE = {
|
|
84
|
+
sourceKind: "explicit_ingest",
|
|
85
|
+
observedVia: "ingest_command"
|
|
86
|
+
};
|
|
87
|
+
/** The manual quota document, read from the state directory. */
|
|
88
|
+
export const MANUAL_PROVENANCE = {
|
|
89
|
+
sourceKind: "manual_document",
|
|
90
|
+
observedVia: "manual_json"
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Stamp provenance onto meters a parser just produced.
|
|
94
|
+
*
|
|
95
|
+
* Applied at the boundary, before normalization, so the normalizer validates
|
|
96
|
+
* the stamp the same way it validates everything else and a stamp this code got
|
|
97
|
+
* wrong is caught rather than trusted.
|
|
98
|
+
*/
|
|
99
|
+
export function withProvenance(meters, provenance) {
|
|
100
|
+
return meters.map((meter) => ({ ...meter, provenance }));
|
|
101
|
+
}
|
|
68
102
|
function manualFilePath(directory) {
|
|
69
103
|
return path.join(directory ?? resolveStateDirectory(), MANUAL_FILE_NAME);
|
|
70
104
|
}
|
package/dist/ingest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EAKtB,MAAM,mBAAmB,CAAC;AAE3B,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,mEAAmE;AACnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C,iEAAiE;AACjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,MA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AC;QACvC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,WAAW,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAA6B,EAC7B,SAA6B;IAE7B,OAAO,MAAM,kBAAkB,CAC7B,QAAQ,EACR,SAAS,IAAI,qBAAqB,EAAE,CACrC,CAAC;AACJ,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type FailureCategory, type ProviderFailure, type Snapshot, type SnapshotState } from "@openlimiter/core";
|
|
2
|
+
/**
|
|
3
|
+
* How the terminal draws a reading.
|
|
4
|
+
*
|
|
5
|
+
* This is the command line tool's presentation layer and nothing else lives
|
|
6
|
+
* here. Every number arrives already decided by the engine; this module only
|
|
7
|
+
* chooses a colour band, a bar, a source chip, and a form of words.
|
|
8
|
+
*
|
|
9
|
+
* THE PRESSURE BANDS, AND WHY RED IS NOT WHERE THE ENGINE WARNS
|
|
10
|
+
* -------------------------------------------------------------
|
|
11
|
+
* healthy 0 to 59 green
|
|
12
|
+
* watch 60 to 79 yellow
|
|
13
|
+
* urgent 80 to 89 orange, and yellow where there is no orange
|
|
14
|
+
* critical 90 and above red
|
|
15
|
+
*
|
|
16
|
+
* Eighty is not a number this file picked. packages/core/src/policy.ts calls a
|
|
17
|
+
* provider NEAR_CAP at 80 and stops recommending it there, so the orange band
|
|
18
|
+
* opens at exactly the reading where the agent stops routing work to a
|
|
19
|
+
* provider. The human and the agent change their mind about the same number at
|
|
20
|
+
* the same instant, which is the point of the fourth band.
|
|
21
|
+
*
|
|
22
|
+
* The visual red at 90 is deliberately later than that agent warning. The agent
|
|
23
|
+
* is told at 80 so it can route away while there is still room; the person
|
|
24
|
+
* watching the bar sees red at 90, when the situation is actually worth
|
|
25
|
+
* reacting to. Warning the agent earlier than the human sees red is the correct
|
|
26
|
+
* direction, and collapsing the two would either make the display cry wolf or
|
|
27
|
+
* make the routing act too late. Orange is what fills the gap between them.
|
|
28
|
+
*
|
|
29
|
+
* apps/web/app/app/language.ts and apps/desktop/ui/app.js carry their own copy
|
|
30
|
+
* of these two functions, because none of the three can import from the others.
|
|
31
|
+
* Those two still draw the earlier three band scale and have not been moved to
|
|
32
|
+
* this one yet.
|
|
33
|
+
*/
|
|
34
|
+
/** The four bands, plus the band a meter with no reading gets. */
|
|
35
|
+
export type Pressure = "healthy" | "watch" | "urgent" | "critical" | "none";
|
|
36
|
+
export declare function pressureOf(percent: number): Pressure;
|
|
37
|
+
/** How many of the ten blocks a percentage lights, never rounding upward. */
|
|
38
|
+
export declare const BAR_SEGMENTS = 10;
|
|
39
|
+
/**
|
|
40
|
+
* The statusline's own density.
|
|
41
|
+
*
|
|
42
|
+
* Five blocks, not ten. A statusline shares one row with a model name, a
|
|
43
|
+
* branch, a directory and whatever else the host puts there, and six ten block
|
|
44
|
+
* bars would take the row on their own. Half the blocks at twice the price per
|
|
45
|
+
* block reads at a glance and still lands every reading in the right band,
|
|
46
|
+
* which is all a status row is for. The snapshot table keeps all ten, because
|
|
47
|
+
* a table is read deliberately and has the room.
|
|
48
|
+
*/
|
|
49
|
+
export declare const STATUSLINE_BAR_SEGMENTS = 5;
|
|
50
|
+
export declare function filledSegments(percent: number, segments?: number): number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether this run may emit escape codes.
|
|
53
|
+
*
|
|
54
|
+
* Two things veto colour, and either one is enough: the NO_COLOR convention,
|
|
55
|
+
* which any value at all switches on, and standard output not being a
|
|
56
|
+
* terminal, which is what a pipe into a file or another program looks like.
|
|
57
|
+
*/
|
|
58
|
+
export declare function supportsColor(environment: Readonly<Record<string, string | undefined>>, isTty: boolean): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this terminal has more than the eight standard colours.
|
|
61
|
+
*
|
|
62
|
+
* Two signals, either one enough. A `TERM` naming `256color` is the convention
|
|
63
|
+
* terminfo has used for decades, and a `COLORTERM` set to anything at all is
|
|
64
|
+
* what the terminals that went further than 256 announce themselves with. Both
|
|
65
|
+
* are claims the terminal makes about itself, not measurements, so this answers
|
|
66
|
+
* a question about what may safely be emitted and never about what is true.
|
|
67
|
+
*
|
|
68
|
+
* A terminal that says neither is not an error and is not a lesser rendering.
|
|
69
|
+
* It gets the yellow of the band below, so the reading still reads as pressure
|
|
70
|
+
* and only the distinction between 80 and 60 is lost. Information degrades; it
|
|
71
|
+
* never breaks, and no escape code is ever emitted that a terminal would print
|
|
72
|
+
* as literal characters.
|
|
73
|
+
*/
|
|
74
|
+
export declare function supports256Color(environment: Readonly<Record<string, string | undefined>>): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this terminal can draw the eighth block glyphs used for sub character
|
|
77
|
+
* bar resolution.
|
|
78
|
+
*
|
|
79
|
+
* Three things veto it, and any one is enough: the NO_COLOR convention, a
|
|
80
|
+
* stream that is not a terminal, and a platform whose default console draws box
|
|
81
|
+
* characters as empty rectangles. A fallback to plain ASCII blocks keeps the
|
|
82
|
+
* output readable on the platforms that need it.
|
|
83
|
+
*/
|
|
84
|
+
export declare function supportsEighthBlocks(environment: Readonly<Record<string, string | undefined>>, isTty: boolean, platform: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The one place a band becomes a colour.
|
|
87
|
+
*
|
|
88
|
+
* Both the ten block table bar and the five block statusline bar come through
|
|
89
|
+
* here, so a reading is the same colour wherever it is drawn, and the orange
|
|
90
|
+
* fallback is decided once rather than at each call site.
|
|
91
|
+
*/
|
|
92
|
+
export declare function bandCode(band: Pressure, wide: boolean): string;
|
|
93
|
+
/**
|
|
94
|
+
* The segmented bar.
|
|
95
|
+
*
|
|
96
|
+
* Ten blocks by default, the same ten the dashboard and the desktop window
|
|
97
|
+
* draw, and five when the statusline asks for its own density. With colour it
|
|
98
|
+
* is drawn in block characters and painted in the band's colour. Without colour
|
|
99
|
+
* it is the same positions in plain ASCII, because a terminal that reported no
|
|
100
|
+
* colour support may also be a log file, and a log file should carry no escape
|
|
101
|
+
* codes at all.
|
|
102
|
+
*
|
|
103
|
+
* The table bar also gains sub character resolution when the terminal can draw
|
|
104
|
+
* the eighth block glyphs, so readings that differ by a few percent no longer
|
|
105
|
+
* share the same bar. A terminal that cannot draw them falls back to the whole
|
|
106
|
+
* block rendering, exactly as before.
|
|
107
|
+
*
|
|
108
|
+
* The block count is the only thing the caller chooses. The band, and therefore
|
|
109
|
+
* the colour, comes from the reading alone, so the same percentage is the same
|
|
110
|
+
* colour at either density.
|
|
111
|
+
*
|
|
112
|
+
* `wide` is the terminal's own claim about its palette, and it defaults to the
|
|
113
|
+
* answer read off the environment so every caller gets the right one without
|
|
114
|
+
* carrying it. A test passes it explicitly, because a test that asks the
|
|
115
|
+
* machine it happens to be running on what colours it has is not a test.
|
|
116
|
+
*/
|
|
117
|
+
export declare function meterBar(percent: number, state: SnapshotState, color: boolean, segments?: number, wide?: boolean, eighthBlocks?: boolean): string;
|
|
118
|
+
/** A failure, in red, in our own fixed words. */
|
|
119
|
+
export declare function failureLine(provider: string, category: FailureCategory, color: boolean): string;
|
|
120
|
+
export declare function failureLines(failures: readonly ProviderFailure[], color: boolean): readonly string[];
|
|
121
|
+
/**
|
|
122
|
+
* Time left before the window resets, compact enough for a table column.
|
|
123
|
+
*
|
|
124
|
+
* Two units at most and no spaces, so every row stays one space separated
|
|
125
|
+
* record that a script can still split. A window with no reset says so rather
|
|
126
|
+
* than printing a zero.
|
|
127
|
+
*/
|
|
128
|
+
export declare function timeToReset(resetAt: string | null, now: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* Money, when the reading carries it.
|
|
131
|
+
*
|
|
132
|
+
* The three fields travel together out of the normalizer, so checking one is
|
|
133
|
+
* enough, and the currency is a closed literal rather than provider text.
|
|
134
|
+
*/
|
|
135
|
+
export declare function amountField(snapshot: Snapshot): string;
|
|
136
|
+
export declare const TABLE_HEADER: string;
|
|
137
|
+
export declare function renderTable(snapshots: readonly Snapshot[], now: string, color: boolean): string;
|
|
138
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,QAAQ,EAEb,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,kEAAkE;AAClE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAMpD;AAED,6EAA6E;AAC7E,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAe,GAAG,MAAM,CAK/E;AAiCD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACzD,KAAK,EAAE,OAAO,GACb,OAAO,CAGT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACxD,OAAO,CAIT;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACzD,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,GACf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