limitcast 0.17.2 → 0.17.3
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 +1 -1
- package/bin/limitcast.mjs +46 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ Created by **Sam Stull**. The project and its history remain available as a port
|
|
|
111
111
|
|
|
112
112
|
Protection events retain the tier at decision time. Host operation IDs deduplicate retries when supplied; older/unidentified events remain labeled attempts. Forecast history is replayed from readings and does not prove that a notification was delivered. Controls cannot establish how many interruptions were prevented.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
Operational automation, contact lists and internal research are maintained outside this public repository. Reports remain local, and sharing totals is voluntary.
|
|
115
115
|
|
|
116
116
|
## License
|
|
117
117
|
|
package/bin/limitcast.mjs
CHANGED
|
@@ -229,7 +229,12 @@ if (cmd === 'status') {
|
|
|
229
229
|
// Grok spend/forecast stays on the Grok status line. Claude's feed has rate_limits; mixing the two
|
|
230
230
|
// would print grok $ on Claude Code and break "waiting for data" when there are no Claude readings.
|
|
231
231
|
const grokExtra = grokOwn ? grokSamples(now) : [];
|
|
232
|
-
line =
|
|
232
|
+
line = statusLines(
|
|
233
|
+
forecastAll(oneClaudeAccount([...load(now - KEEP_MS), ...grokExtra], sid), now),
|
|
234
|
+
grokOwn ? grokSpendLine(now) : '',
|
|
235
|
+
hints,
|
|
236
|
+
grokOwn ? 'grok' : 'claude',
|
|
237
|
+
).join('\n');
|
|
233
238
|
} catch {
|
|
234
239
|
/* never break the status line */
|
|
235
240
|
}
|
|
@@ -238,11 +243,11 @@ if (cmd === 'status') {
|
|
|
238
243
|
// Your status line stays as it was; limitcast adds its own line under it (status scripts often printf without a newline).
|
|
239
244
|
const yours = r.stdout?.toString() ?? '';
|
|
240
245
|
process.stdout.write(yours && !yours.endsWith('\n') ? `${yours}\n` : yours);
|
|
241
|
-
|
|
246
|
+
emitStatus(line);
|
|
242
247
|
process.exit(r.status ?? 1);
|
|
243
248
|
}
|
|
244
249
|
if (grokOwn) console.log(grokOwn);
|
|
245
|
-
|
|
250
|
+
emitStatus(line);
|
|
246
251
|
} else if (cmd === 'guard') {
|
|
247
252
|
// The installed guard protects all users; LIMITCAST_ALLOW=1 remains the explicit override.
|
|
248
253
|
if (process.env.LIMITCAST_ALLOW === '1') process.exit(0);
|
|
@@ -1056,29 +1061,52 @@ function table(rows) {
|
|
|
1056
1061
|
.join('\n');
|
|
1057
1062
|
}
|
|
1058
1063
|
|
|
1059
|
-
/**
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1064
|
+
/**
|
|
1065
|
+
* One window on a status-line row. Host Grok/Codex windows keep their src prefix;
|
|
1066
|
+
* a labeled `limitcast claude:` / `limitcast grok:` row does not repeat it.
|
|
1067
|
+
* @param {NonNullable<ReturnType<typeof forecastAll>>[number]} f
|
|
1068
|
+
* @param {boolean} labeled
|
|
1069
|
+
*/
|
|
1070
|
+
function windowBit(f, labeled = false) {
|
|
1071
|
+
const name = labeled || f.src === 'claude' ? '' : `${f.src} `;
|
|
1072
|
+
return (
|
|
1073
|
+
`${name}${f.win} ${Math.round(f.pct)}%` +
|
|
1074
|
+
(f.verdict === 'AT_RISK' ? ` ⚠ out ${clock(f.wall)}` : f.verdict === 'NEAR' ? ' ⚠ near limit' : f.verdict === 'HIT' ? ' ⛔' : '') +
|
|
1075
|
+
(f.today && f.verdict !== 'HIT' ? ` · today ${todayLabel(f.today)}` : '')
|
|
1065
1076
|
);
|
|
1066
|
-
return bits.join(' · ') || 'limitcast: waiting for data';
|
|
1067
1077
|
}
|
|
1068
1078
|
|
|
1069
1079
|
/**
|
|
1070
|
-
* Status-line
|
|
1080
|
+
* Status-line rows: one provider per line, Grok spend on the Grok row, then hints on the host row.
|
|
1071
1081
|
* @param {ReturnType<typeof forecastAll>} rows
|
|
1072
1082
|
* @param {string} spend
|
|
1073
1083
|
* @param {string[]} hints
|
|
1084
|
+
* @param {string} host
|
|
1074
1085
|
*/
|
|
1075
|
-
function
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1086
|
+
function statusLines(rows, spend, hints, host = 'claude') {
|
|
1087
|
+
const order = host === 'grok' ? ['grok', 'claude', 'codex'] : ['claude', 'codex', 'grok'];
|
|
1088
|
+
/** @type {string[]} */
|
|
1089
|
+
const lines = [];
|
|
1090
|
+
for (const src of order) {
|
|
1091
|
+
const group = rows.filter((f) => f.src === src);
|
|
1092
|
+
if (!group.length && !(src === 'grok' && spend)) continue;
|
|
1093
|
+
const labeled = src !== host;
|
|
1094
|
+
const bits = group.map((f) => windowBit(f, labeled));
|
|
1095
|
+
if (src === 'grok' && spend) bits.push(spend);
|
|
1096
|
+
if (!bits.length) continue;
|
|
1097
|
+
const tag = src === host ? 'limitcast' : `limitcast ${src}`;
|
|
1098
|
+
lines.push(`${tag}: ${bits.join(' · ')}`);
|
|
1099
|
+
}
|
|
1100
|
+
if (hints.length) {
|
|
1101
|
+
if (lines.length) lines[0] += ` · ${hints.join(' · ')}`;
|
|
1102
|
+
else lines.push(`limitcast: ${hints.join(' · ')}`);
|
|
1103
|
+
}
|
|
1104
|
+
return lines.length ? lines : ['limitcast: waiting for data'];
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/** Print limitcast rows. `limitcast claude:` already has the prefix; `waiting for data` does not. */
|
|
1108
|
+
function emitStatus(line) {
|
|
1109
|
+
console.log(line.startsWith('limitcast') ? line : `limitcast: ${line}`);
|
|
1082
1110
|
}
|
|
1083
1111
|
|
|
1084
1112
|
/** Grok spend line when no dollar cap is set (a cap becomes a forecast row instead). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "limitcast",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3",
|
|
4
4
|
"description": "Stretch your Claude Code plan: measure what every session loads before you type, cut what you never use, and stop runaway subagents before they burn your window.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|