claude-usage-limits 1.11.7 → 1.13.1
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +133 -3
- package/bin/cli.js +1 -0
- package/commands/relay.md +50 -0
- package/commands/voice.md +33 -0
- package/hooks/hooks.json +24 -1
- package/package.json +1 -1
- package/skills/usage-limits/SKILL.md +130 -5
- package/skills/usage-limits/scripts/bars.js +56 -0
- package/skills/usage-limits/scripts/brief.js +260 -17
- package/skills/usage-limits/scripts/codex-lowpower.js +135 -0
- package/skills/usage-limits/scripts/codex.js +92 -22
- package/skills/usage-limits/scripts/feed.js +136 -5
- package/skills/usage-limits/scripts/install-codex-hook.js +71 -20
- package/skills/usage-limits/scripts/lowpower.js +10 -2
- package/skills/usage-limits/scripts/panel.js +180 -15
- package/skills/usage-limits/scripts/pulse.js +82 -22
- package/skills/usage-limits/scripts/reading.js +127 -0
- package/skills/usage-limits/scripts/recommend.js +16 -3
- package/skills/usage-limits/scripts/relay.js +957 -0
- package/skills/usage-limits/scripts/statusline.js +8 -7
- package/skills/usage-limits/scripts/tally.js +7 -8
- package/skills/usage-limits/scripts/usage.js +855 -54
- package/skills/usage-limits/scripts/view.js +150 -8
- package/skills/usage-limits/scripts/voice.js +416 -0
- package/skills/usage-limits/scripts/wake.js +316 -0
|
@@ -144,13 +144,14 @@ function planOn(settings, state, options) {
|
|
|
144
144
|
const opts = options || {};
|
|
145
145
|
const launcher = opts.launcher || launcherFile();
|
|
146
146
|
const existing = current.statusLine === undefined ? null : current.statusLine;
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
// What "off" must put back is whatever is in the settings right now that is
|
|
148
|
+
// not ours. A second "on" must not record our own launcher as that thing -
|
|
149
|
+
// but it must not keep an old memory either: a status line the user set
|
|
150
|
+
// between two "on" runs was being overwritten and lost, because the first
|
|
151
|
+
// run's record was trusted over the file in front of us.
|
|
152
|
+
const remembered =
|
|
153
|
+
state && Object.prototype.hasOwnProperty.call(state, 'previous') ? state.previous : null;
|
|
154
|
+
const previous = isOurs(existing, launcher) ? remembered : existing;
|
|
154
155
|
const command = 'node ' + JSON.stringify(launcher);
|
|
155
156
|
const statusLine = { type: 'command', command };
|
|
156
157
|
if (Number.isFinite(opts.refresh) && opts.refresh >= 1) statusLine.refreshInterval = Math.floor(opts.refresh);
|
|
@@ -46,15 +46,14 @@ function readState() {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// Atomic, because this file is read, changed and written back by the Stop hook
|
|
50
|
+
// of every session at once. A torn read here did not just lose one total: the
|
|
51
|
+
// reader parsed nothing, then wrote its own slot back as the whole file, and
|
|
52
|
+
// every other session's tally went with it.
|
|
49
53
|
function writeState(all) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
fs.writeFileSync(file, JSON.stringify(all), 'utf8');
|
|
54
|
-
} catch (err) {
|
|
55
|
-
// Losing the total costs one re-read of the transcript. Failing the hook
|
|
56
|
-
// that runs after every reply is not worth avoiding that.
|
|
57
|
-
}
|
|
54
|
+
// Never throws: losing the total costs one re-read of the transcript, and
|
|
55
|
+
// failing the hook that runs after every reply is not worth avoiding that.
|
|
56
|
+
usage.writeJsonAtomic(stateFile(), all);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
function isSession(value) {
|