charness 3.12.0 → 3.13.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/.env.example +5 -0
- package/CHANGELOG.md +27 -0
- package/DEVELOPMENT.md +78 -15
- package/README.md +2 -1
- package/SETUP.md +65 -20
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +14 -5
- package/dist/accessControl.d.ts +43 -0
- package/dist/accessControl.d.ts.map +1 -1
- package/dist/accessControl.js +50 -1
- package/dist/accessControl.js.map +1 -1
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +9 -4
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/claudePlatformFlags.d.ts +4 -3
- package/dist/adapters/claudePlatformFlags.d.ts.map +1 -1
- package/dist/adapters/claudePlatformFlags.js +4 -3
- package/dist/adapters/claudePlatformFlags.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +37 -13
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +73 -41
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/adapters/terminalAdapter.d.ts.map +1 -1
- package/dist/adapters/terminalAdapter.js +5 -3
- package/dist/adapters/terminalAdapter.js.map +1 -1
- package/dist/agentLogin/agentLogin.d.ts.map +1 -1
- package/dist/agentLogin/agentLogin.js +2 -14
- package/dist/agentLogin/agentLogin.js.map +1 -1
- package/dist/bot.d.ts +12 -3
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +476 -133
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.js +2 -2
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/connectors/jira/client.js +1 -1
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +7 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +12 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +7 -0
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +20 -3
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +4 -3
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +1 -1
- package/dist/connectors/jira/trustedGroup.d.ts +21 -6
- package/dist/connectors/jira/trustedGroup.d.ts.map +1 -1
- package/dist/connectors/jira/trustedGroup.js +46 -6
- package/dist/connectors/jira/trustedGroup.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +19 -2
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +5 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +9 -6
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/todo.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/todo.js +2 -2
- package/dist/connectors/telegram/commands/todo.js.map +1 -1
- package/dist/connectors/telegram/commands/topicAccess.d.ts +30 -0
- package/dist/connectors/telegram/commands/topicAccess.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/topicAccess.js +399 -0
- package/dist/connectors/telegram/commands/topicAccess.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +44 -7
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +142 -24
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +68 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +68 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +68 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +68 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +68 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +68 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +68 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +68 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +68 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +68 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +68 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +68 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/installManager.d.ts +37 -1
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +205 -14
- package/dist/installManager.js.map +1 -1
- package/dist/platform/commandRouter.d.ts +13 -1
- package/dist/platform/commandRouter.d.ts.map +1 -1
- package/dist/platform/commandRouter.js +14 -2
- package/dist/platform/commandRouter.js.map +1 -1
- package/dist/platform/inbound.d.ts +2 -0
- package/dist/platform/inbound.d.ts.map +1 -1
- package/dist/runners/runnerLock.d.ts +36 -1
- package/dist/runners/runnerLock.d.ts.map +1 -1
- package/dist/runners/runnerLock.js +94 -30
- package/dist/runners/runnerLock.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +0 -2
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +0 -10
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/selfUpdate/bootRollback.d.ts.map +1 -1
- package/dist/selfUpdate/bootRollback.js +3 -2
- package/dist/selfUpdate/bootRollback.js.map +1 -1
- package/dist/selfUpdate/updateRuntime.d.ts.map +1 -1
- package/dist/selfUpdate/updateRuntime.js +6 -3
- package/dist/selfUpdate/updateRuntime.js.map +1 -1
- package/dist/state.d.ts +49 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +112 -0
- package/dist/state.js.map +1 -1
- package/dist/threadContextPreamble.d.ts +15 -1
- package/dist/threadContextPreamble.d.ts.map +1 -1
- package/dist/threadContextPreamble.js +15 -3
- package/dist/threadContextPreamble.js.map +1 -1
- package/dist/threadRouting.d.ts +47 -4
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +31 -4
- package/dist/threadRouting.js.map +1 -1
- package/dist/todos/projects.d.ts +1 -1
- package/dist/todos/projects.d.ts.map +1 -1
- package/dist/todos/projects.js +3 -14
- package/dist/todos/projects.js.map +1 -1
- package/dist/topicTalkerMemory.d.ts +37 -0
- package/dist/topicTalkerMemory.d.ts.map +1 -0
- package/dist/topicTalkerMemory.js +61 -0
- package/dist/topicTalkerMemory.js.map +1 -0
- package/dist/topicTalkers.d.ts +123 -0
- package/dist/topicTalkers.d.ts.map +1 -0
- package/dist/topicTalkers.js +276 -0
- package/dist/topicTalkers.js.map +1 -0
- package/dist/types.d.ts +5 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.d.ts +23 -0
- package/dist/utils/agentEnvironment.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.js +33 -1
- package/dist/utils/agentEnvironment.js.map +1 -1
- package/dist/utils/agentPlugin.d.ts +7 -2
- package/dist/utils/agentPlugin.d.ts.map +1 -1
- package/dist/utils/agentPlugin.js +11 -5
- package/dist/utils/agentPlugin.js.map +1 -1
- package/dist/utils/authorMark.d.ts +59 -0
- package/dist/utils/authorMark.d.ts.map +1 -0
- package/dist/utils/authorMark.js +86 -0
- package/dist/utils/authorMark.js.map +1 -0
- package/dist/utils/claudeLimitSwitch.d.ts +5 -1
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +6 -2
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfileUsageLines.d.ts +1 -1
- package/dist/utils/claudeProfileUsageLines.js +3 -3
- package/dist/utils/claudeProfileUsageLines.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts +7 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +15 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +56 -20
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +81 -38
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +8 -4
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/folderGit.d.ts +9 -0
- package/dist/utils/folderGit.d.ts.map +1 -0
- package/dist/utils/folderGit.js +33 -0
- package/dist/utils/folderGit.js.map +1 -0
- package/dist/utils/forwardedMark.d.ts +8 -0
- package/dist/utils/forwardedMark.d.ts.map +1 -1
- package/dist/utils/forwardedMark.js +2 -0
- package/dist/utils/forwardedMark.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +2 -1
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +4 -2
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/messageContext.d.ts +22 -7
- package/dist/utils/messageContext.d.ts.map +1 -1
- package/dist/utils/messageContext.js +19 -5
- package/dist/utils/messageContext.js.map +1 -1
- package/dist/utils/personLabel.d.ts +13 -0
- package/dist/utils/personLabel.d.ts.map +1 -0
- package/dist/utils/personLabel.js +15 -0
- package/dist/utils/personLabel.js.map +1 -0
- package/dist/utils/replyQuote.d.ts +17 -3
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +25 -2
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/talkerAccess.d.ts +9 -0
- package/dist/utils/talkerAccess.d.ts.map +1 -0
- package/dist/utils/talkerAccess.js +20 -0
- package/dist/utils/talkerAccess.js.map +1 -0
- package/dist/utils/tmuxExec.d.ts +20 -8
- package/dist/utils/tmuxExec.d.ts.map +1 -1
- package/dist/utils/tmuxExec.js +27 -7
- package/dist/utils/tmuxExec.js.map +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts +253 -0
- package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -0
- package/dist/utils/topicAccessScreenPlan.js +287 -0
- package/dist/utils/topicAccessScreenPlan.js.map +1 -0
- package/dist/utils/topicLabel.d.ts +12 -0
- package/dist/utils/topicLabel.d.ts.map +1 -0
- package/dist/utils/topicLabel.js +12 -0
- package/dist/utils/topicLabel.js.map +1 -0
- package/dist/utils/topicRequest.d.ts +8 -5
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +9 -7
- package/dist/utils/topicRequest.js.map +1 -1
- package/npm-shrinkwrap.json +1003 -0
- package/package.json +4 -2
|
@@ -79,11 +79,13 @@ exports.removeClaudeProfileApiKey = removeClaudeProfileApiKey;
|
|
|
79
79
|
exports.readProcessErrorStdout = readProcessErrorStdout;
|
|
80
80
|
exports.getProcessFailureReason = getProcessFailureReason;
|
|
81
81
|
exports.getClaudeAccountKind = getClaudeAccountKind;
|
|
82
|
+
exports.getClaudeAuthCommandEnvironment = getClaudeAuthCommandEnvironment;
|
|
82
83
|
exports.checkIsSameClaudeConfigDir = checkIsSameClaudeConfigDir;
|
|
83
84
|
exports.parseClaudeConfigDirFromCommand = parseClaudeConfigDirFromCommand;
|
|
84
85
|
const fs = __importStar(require("fs"));
|
|
85
86
|
const os = __importStar(require("os"));
|
|
86
87
|
const path = __importStar(require("path"));
|
|
88
|
+
const agentEnvironment_1 = require("./agentEnvironment");
|
|
87
89
|
/** The profile that is `~/.claude` itself (no `CLAUDE_CONFIG_DIR`). */
|
|
88
90
|
exports.defaultClaudeProfileName = 'default';
|
|
89
91
|
/** Subdirectory of `DATA_DIR` that holds every profile's config directory. */
|
|
@@ -428,6 +430,19 @@ function getClaudeAccountKind(subscriptionType) {
|
|
|
428
430
|
}
|
|
429
431
|
// ── the spawn-side variable ──
|
|
430
432
|
exports.claudeConfigDirVariableName = 'CLAUDE_CONFIG_DIR';
|
|
433
|
+
/**
|
|
434
|
+
* @description The environment a `claude auth …` process runs with (a sign-in, an auth-status probe): the bot's own
|
|
435
|
+
* without its secrets and without `ANTHROPIC_API_KEY` (the subscription login, never the metered console path), plus
|
|
436
|
+
* `CLAUDE_CONFIG_DIR` for a profile's directory (`null` = `~/.claude`) — the login must land in THAT directory, and the
|
|
437
|
+
* status probe must read the same one.
|
|
438
|
+
*/
|
|
439
|
+
function getClaudeAuthCommandEnvironment(configDir) {
|
|
440
|
+
const environment = (0, agentEnvironment_1.getChildProcessEnvironment)();
|
|
441
|
+
delete environment.ANTHROPIC_API_KEY;
|
|
442
|
+
if (configDir !== null)
|
|
443
|
+
environment[exports.claudeConfigDirVariableName] = configDir;
|
|
444
|
+
return environment;
|
|
445
|
+
}
|
|
431
446
|
/**
|
|
432
447
|
* @description Whether two `CLAUDE_CONFIG_DIR` values name the same directory: equal strings, or paths that
|
|
433
448
|
* resolve to the same real directory. A process adopted after the data dir was moved to its new name keeps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeProfiles.js","sourceRoot":"","sources":["../../src/utils/claudeProfiles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCH,sEAE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CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACtC,CAAC"}
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
* — the last one IS the Fable window: same utilization and reset instant as the endpoint's scoped limit).
|
|
16
16
|
*
|
|
17
17
|
* Token refresh is the CLI's job: a token past its `expiresAt` is never used (nor refreshed here) — the
|
|
18
|
-
* snapshot is marked stale and the next CLI run renews it
|
|
18
|
+
* snapshot is marked stale and the next CLI run renews it (every poll re-reads the token file, so the poll after that run
|
|
19
|
+
* recovers by itself). An account no CLI runs on keeps that stale snapshot for as long as it sits idle, so every reader reads
|
|
20
|
+
* the used percent of a bucket AGAINST THE CLOCK ({@link getClaudeUsagePercentAsOf}): a window whose reset has passed is over,
|
|
21
|
+
* whatever was read. What the account has used since — through a login on another machine or another host user — is invisible
|
|
22
|
+
* here (nothing can be polled without a live token), and a screen shows no reset for the next period: nothing says when it ends.
|
|
23
|
+
* The token itself is never logged or returned.
|
|
19
24
|
*
|
|
20
25
|
* Pure except {@link readClaudeOAuthToken} (one file read) and {@link fetchClaudeUsage} (one GET through an
|
|
21
26
|
* injectable `fetch`), so the rest is unit-tested without the network.
|
|
@@ -143,12 +148,13 @@ export declare function checkIsScopedWeeklyModel(model: string | null): boolean;
|
|
|
143
148
|
*/
|
|
144
149
|
export declare function getRelevantClaudeUsageKinds(model: string | null): ClaudeUsageBucketKind[];
|
|
145
150
|
/**
|
|
146
|
-
* @description Whether every window a launch of `model` drains is KNOWN and below 100 % — the model is clear of an
|
|
147
|
-
* window: a Fable-only weekly limit does not stop `sonnet`, while an exhausted session or shared weekly window stops
|
|
148
|
-
* model, Fable included. Unknown figures (no snapshot, a window the snapshot lacks) are `false`: a limit nobody can tell
|
|
149
|
-
* scope of is taken to cover the model. A stale snapshot still counts — its last figures are the best there are
|
|
151
|
+
* @description Whether every window a launch of `model` drains is KNOWN and below 100 % at `nowMs` — the model is clear of an
|
|
152
|
+
* exhausted window: a Fable-only weekly limit does not stop `sonnet`, while an exhausted session or shared weekly window stops
|
|
153
|
+
* every model, Fable included. Unknown figures (no snapshot, a window the snapshot lacks) are `false`: a limit nobody can tell
|
|
154
|
+
* the scope of is taken to cover the model. A stale snapshot still counts — its last figures are the best there are — read
|
|
155
|
+
* against the clock ({@link getClaudeUsagePercentAsOf}): a window whose reset has passed counts as empty.
|
|
150
156
|
*/
|
|
151
|
-
export declare function checkHasHeadroomForClaudeModel(usage: ClaudeUsageSnapshot | undefined, model: string | null): boolean;
|
|
157
|
+
export declare function checkHasHeadroomForClaudeModel(usage: ClaudeUsageSnapshot | undefined, model: string | null, nowMs: number): boolean;
|
|
152
158
|
/**
|
|
153
159
|
* @description Whether the usage reading SHOWS a window `model` drains at 100 % NOW (`nowMs`) — the proof an
|
|
154
160
|
* unconfirmed usage-limit wording lacks. Unknown figures prove nothing (`false`), unlike
|
|
@@ -156,15 +162,23 @@ export declare function checkHasHeadroomForClaudeModel(usage: ClaudeUsageSnapsho
|
|
|
156
162
|
* out-of-date reading — a snapshot marked stale, or a 100 % window whose reset has passed since it was read.
|
|
157
163
|
*/
|
|
158
164
|
export declare function checkIsClaudeUsageExhausted(usage: ClaudeUsageSnapshot | undefined, model: string | null, nowMs: number): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* @description Whether every window a launch of `model` drains that the snapshot carries has passed its reset instant by
|
|
167
|
+
* `nowMs` — the clock proves the windows that were read are OVER, whether or not the snapshot could be re-read (an account no
|
|
168
|
+
* CLI runs on keeps an expired token and a stale snapshot for good). It does NOT say what was used since: a login of the same
|
|
169
|
+
* account elsewhere (another machine, another host user) leaves no trace here. `false` for no figures, and for any window
|
|
170
|
+
* that is still running or names no reset.
|
|
171
|
+
*/
|
|
172
|
+
export declare function checkHaveClaudeUsageWindowsReset(usage: ClaudeUsageSnapshot | undefined, model: string | null, nowMs: number): boolean;
|
|
159
173
|
/**
|
|
160
174
|
* @description Whether a pick of `pickedModel`, on the account a usage limit stopped while it ran `limitedModel`, is clear of that
|
|
161
175
|
* limit. The window that stopped the limited model is one of the windows IT drains, so a picked model that drains all of them
|
|
162
176
|
* (the same model, a model on the same windows, or Fable after any other model — Fable drains the shared windows too) is covered
|
|
163
177
|
* by the limit however far the figures lag behind it. Only a model draining FEWER windows — a non-Fable model after Fable, which
|
|
164
|
-
* may have stopped on its own weekly window alone — is judged by {@link checkHasHeadroomForClaudeModel}
|
|
178
|
+
* may have stopped on its own weekly window alone — is judged by {@link checkHasHeadroomForClaudeModel} at `nowMs`. An unknown
|
|
165
179
|
* `limitedModel` leaves it to the figures.
|
|
166
180
|
*/
|
|
167
|
-
export declare function checkIsClaudeModelClearOfLimit(usage: ClaudeUsageSnapshot | undefined, limitedModel: string | null, pickedModel: string): boolean;
|
|
181
|
+
export declare function checkIsClaudeModelClearOfLimit(usage: ClaudeUsageSnapshot | undefined, limitedModel: string | null, pickedModel: string, nowMs: number): boolean;
|
|
168
182
|
/** What the ranking needs to know about one profile (the bot reads it off state, the CLI off state.json). */
|
|
169
183
|
export interface ClaudeProfileUsageView {
|
|
170
184
|
name: string;
|
|
@@ -207,8 +221,10 @@ export interface ClaudeProfileReportEntry {
|
|
|
207
221
|
billing: ClaudeProfileBilling | null;
|
|
208
222
|
/** `null` when never probed. */
|
|
209
223
|
loggedIn: boolean | null;
|
|
224
|
+
/** The windows as read, their used percent against the clock ({@link getClaudeUsagePercentAsOf}): one whose reset has passed since it was read is 0 % — its `resetsAt` stays the instant that passed, no next reset is estimated. */
|
|
210
225
|
buckets: ClaudeUsageBucket[];
|
|
211
226
|
usageFetchedAt: string | null;
|
|
227
|
+
/** The figures were not re-read at the last poll (an expired token, a failed fetch); `buckets` are the last known ones (a passed window shows 0 %). */
|
|
212
228
|
isUsageStale: boolean;
|
|
213
229
|
limitedUntil: string | null;
|
|
214
230
|
/** When its prepaid API credits were found used up (`null`: not marked). */
|
|
@@ -223,11 +239,11 @@ export interface ClaudeProfileReportEntry {
|
|
|
223
239
|
probablyUsedUp: boolean;
|
|
224
240
|
/** When the bot detected the credit was back (the current period starts there); `null` = never or superseded by a newer figure. */
|
|
225
241
|
renewedAt: string | null;
|
|
226
|
-
/** Signed in, not limited, its API credits not used up, not at 100 % on a window the model drains — by the figures AS
|
|
242
|
+
/** Signed in, not limited, its API credits not used up, not at 100 % on a window the model drains — by the figures AS OF NOW (a window whose reset has passed counts as empty) — and not kept off agents by the `/limits` list (`chainExclusion`). */
|
|
227
243
|
isEligible: boolean;
|
|
228
244
|
/** Why the operator's `/limits` list keeps agents off this account ({@link ClaudeChainExclusion}); `null` = no objection (it has an enabled rung there, or the list names no Claude account at all). */
|
|
229
245
|
chainExclusion: ClaudeChainExclusion | null;
|
|
230
|
-
/** `100 − max(relevant percent)
|
|
246
|
+
/** `100 − max(relevant percent)` as of now; `null` when the usage is unknown. Informational: the pick ranks by reset, not by headroom. */
|
|
231
247
|
headroomPercent: number | null;
|
|
232
248
|
/** The profile {@link getClaudeLaunchPick} chose (the figures read as of now). */
|
|
233
249
|
isRecommended: boolean;
|
|
@@ -298,6 +314,21 @@ export declare const claudeChainExclusions: readonly ClaudeChainExclusion[];
|
|
|
298
314
|
export declare const claudeChainExclusionWords: Readonly<Record<ClaudeChainExclusion, string>>;
|
|
299
315
|
/** Why `scope` keeps agents off the account `name`; `null` when it does not (no Claude account listed, or an enabled rung of it). */
|
|
300
316
|
export declare function getClaudeChainExclusion(name: string, scope: ClaudeLaunchChainScope | null | undefined): ClaudeChainExclusion | null;
|
|
317
|
+
/**
|
|
318
|
+
* @description The used percent of a bucket against the clock — THE one rule every screen and every pick reads a figure by:
|
|
319
|
+
* a window whose reset instant has passed since the figure was read is over, so 0 %; a window with a reset ahead, with none or
|
|
320
|
+
* with an unreadable one keeps the figure as read. It says the OLD window ended, nothing about use since (another login of the
|
|
321
|
+
* account, on another machine or host user, is invisible here).
|
|
322
|
+
*/
|
|
323
|
+
export declare function getClaudeUsagePercentAsOf(bucket: ClaudeUsageBucket, nowMs: number): number;
|
|
324
|
+
/**
|
|
325
|
+
* @description A bucket as the RANKING of accounts reads it at `nowMs` ({@link sortClaudeProfilesByLaunchRank}, the soonest-reset
|
|
326
|
+
* pick, `nextAvailable`): a window that has reset is empty ({@link getClaudeUsagePercentAsOf}) and its reset moves one window
|
|
327
|
+
* length per elapsed period ahead. That instant is an ESTIMATE made only so such an account has a place in an order — nothing
|
|
328
|
+
* shows that the next window started then (a five-hour window starts at the account's first use), so no screen, report or
|
|
329
|
+
* message may show it as a reset; they keep the instant that passed.
|
|
330
|
+
*/
|
|
331
|
+
export declare function getClaudeUsageBucketAsOf(bucket: ClaudeUsageBucket, nowMs: number): ClaudeUsageBucket;
|
|
301
332
|
/**
|
|
302
333
|
* @description Whether a NEW agent of `model` may start on the profile now: a subscription account that is eligible by the
|
|
303
334
|
* figures as of `nowMs` and whose five-hour window is below {@link claudeLaunchSessionCeilingPercent}. Switching it off
|
|
@@ -358,10 +389,11 @@ export declare function describeClaudeLaunchOutcome(report: Pick<ClaudeProfilesR
|
|
|
358
389
|
export declare function describeClaudeChainExclusions(report: Pick<ClaudeProfilesReport, 'profiles'>): string | null;
|
|
359
390
|
/**
|
|
360
391
|
* @description The report of every profile for a launch of `model`, with the pick of {@link getClaudeLaunchPick}
|
|
361
|
-
* (`options`: the warm account, the limit stop, the `/limits` list).
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
392
|
+
* (`options`: the warm account, the limit stop, the `/limits` list). The figures of an entry are read as of `nowMs`
|
|
393
|
+
* ({@link getClaudeUsagePercentAsOf}: a window whose reset has passed since it was read counts as empty), its `isUsageStale` says
|
|
394
|
+
* they were not re-read; the pick itself ranks by the estimated next reset of {@link getClaudeUsageBucketAsOf}. `isEligible` is the strict reading — signed in, not marked limited, its API credits not used up, not
|
|
395
|
+
* at 100 % on a relevant window, no five-hour ceiling, not kept off agents by the list (`chainExclusion`) — which the
|
|
396
|
+
* explicit fallback chain's availability reads (it passes no list); `recommended` is the pick. The entries keep the input order.
|
|
365
397
|
*
|
|
366
398
|
* The credit fields of the entries (`spentUsd`, `remainingEstimateUsd`, `expiresOn`, `probablyUsedUp`, `renewedAt`) are left
|
|
367
399
|
* EMPTY here: this module is loaded by the connector guards, which may not reach the credit module. Anything that is shown to
|
|
@@ -389,17 +421,21 @@ export declare const englishRelativeResetWords: ClaudeRelativeResetWords;
|
|
|
389
421
|
/**
|
|
390
422
|
* @description A reset instant as a time from now: `🔄 in 2d 1h`, `🔄 in 2h`, `🔄 in 30m`. The two largest
|
|
391
423
|
* units at most, minutes only under an hour: from a day up it is days + hours (hours dropped when zero), from
|
|
392
|
-
* an hour up whole hours (rounded), below that minutes (at least one
|
|
393
|
-
*
|
|
424
|
+
* an hour up whole hours (rounded), below that minutes (at least one: the last seconds before a reset read `in 1m`).
|
|
425
|
+
* Pass an instant AHEAD — a past one is not a countdown ({@link formatClaudeUsageBucket} shows a window whose reset
|
|
426
|
+
* has passed as a bare percent, so it never passes one). `?` for a missing or unparseable instant.
|
|
394
427
|
*/
|
|
395
428
|
export declare function formatClaudeUsageRelativeReset(resetsAt: string | null, nowMs: number, words?: ClaudeRelativeResetWords): string;
|
|
396
429
|
/**
|
|
397
|
-
* @description `81% 🔄 in 2h` for a bucket, `—` for a missing one. A bucket whose reset
|
|
398
|
-
* `
|
|
399
|
-
*
|
|
430
|
+
* @description `81% 🔄 in 2h` for a bucket, `—` for a missing one. A bucket whose reset has passed since it was read shows a
|
|
431
|
+
* bare `0%` ({@link getClaudeUsagePercentAsOf}) — never the old figure with a reset «in 1m», and no countdown either: nothing
|
|
432
|
+
* says when its next period ends. A snapshot nobody could re-read (an expired token) must not claim a used-up window for ever;
|
|
433
|
+
* its stale mark is the caller's. A bucket whose reset is unknown shows the reset of `fallbackBucket` instead (the session
|
|
434
|
+
* window's reset is often missing while the weekly one is known) while that one is still ahead; with neither it is the bare
|
|
435
|
+
* percent — a «?» after a number would read as a doubt about the number.
|
|
400
436
|
*/
|
|
401
437
|
export declare function formatClaudeUsageBucket(bucket: ClaudeUsageBucket | null, nowMs: number, options?: {
|
|
402
|
-
|
|
438
|
+
fallbackBucket?: ClaudeUsageBucket | null;
|
|
403
439
|
words?: ClaudeRelativeResetWords;
|
|
404
440
|
}): string;
|
|
405
441
|
//# sourceMappingURL=claudeUsage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeUsage.d.ts","sourceRoot":"","sources":["../../src/utils/claudeUsage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claudeUsage.d.ts","sourceRoot":"","sources":["../../src/utils/claudeUsage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAA8C,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACjI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAErF,eAAO,MAAM,mBAAmB,8CAA8C,CAAC;AAK/E,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAKhD,gGAAgG;AAChG,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,YAAY,GAAG,eAAe,CAAC;AAE/E,eAAO,MAAM,sBAAsB,EAAE,SAAS,qBAAqB,EAA+C,CAAC;AAEnH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,4FAA4F;IAC5F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;I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AM,EAAE,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAQ5I;AAID;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAczG;AAED,uHAAuH;AACvH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,EAAE,wBAAwF,CAAC;AAEjI;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,wBAAoD,GAAG,MAAM,CAkB1J;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,wBAAwB,CAAA;CAAO,GAC5F,MAAM,CASR"}
|
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
* — the last one IS the Fable window: same utilization and reset instant as the endpoint's scoped limit).
|
|
17
17
|
*
|
|
18
18
|
* Token refresh is the CLI's job: a token past its `expiresAt` is never used (nor refreshed here) — the
|
|
19
|
-
* snapshot is marked stale and the next CLI run renews it
|
|
19
|
+
* snapshot is marked stale and the next CLI run renews it (every poll re-reads the token file, so the poll after that run
|
|
20
|
+
* recovers by itself). An account no CLI runs on keeps that stale snapshot for as long as it sits idle, so every reader reads
|
|
21
|
+
* the used percent of a bucket AGAINST THE CLOCK ({@link getClaudeUsagePercentAsOf}): a window whose reset has passed is over,
|
|
22
|
+
* whatever was read. What the account has used since — through a login on another machine or another host user — is invisible
|
|
23
|
+
* here (nothing can be polled without a live token), and a screen shows no reset for the next period: nothing says when it ends.
|
|
24
|
+
* The token itself is never logged or returned.
|
|
20
25
|
*
|
|
21
26
|
* Pure except {@link readClaudeOAuthToken} (one file read) and {@link fetchClaudeUsage} (one GET through an
|
|
22
27
|
* injectable `fetch`), so the rest is unit-tested without the network.
|
|
@@ -70,8 +75,11 @@ exports.checkIsScopedWeeklyModel = checkIsScopedWeeklyModel;
|
|
|
70
75
|
exports.getRelevantClaudeUsageKinds = getRelevantClaudeUsageKinds;
|
|
71
76
|
exports.checkHasHeadroomForClaudeModel = checkHasHeadroomForClaudeModel;
|
|
72
77
|
exports.checkIsClaudeUsageExhausted = checkIsClaudeUsageExhausted;
|
|
78
|
+
exports.checkHaveClaudeUsageWindowsReset = checkHaveClaudeUsageWindowsReset;
|
|
73
79
|
exports.checkIsClaudeModelClearOfLimit = checkIsClaudeModelClearOfLimit;
|
|
74
80
|
exports.getClaudeChainExclusion = getClaudeChainExclusion;
|
|
81
|
+
exports.getClaudeUsagePercentAsOf = getClaudeUsagePercentAsOf;
|
|
82
|
+
exports.getClaudeUsageBucketAsOf = getClaudeUsageBucketAsOf;
|
|
75
83
|
exports.checkIsClaudeProfileLaunchable = checkIsClaudeProfileLaunchable;
|
|
76
84
|
exports.sortClaudeProfilesByLaunchRank = sortClaudeProfilesByLaunchRank;
|
|
77
85
|
exports.getClaudeLaunchPick = getClaudeLaunchPick;
|
|
@@ -270,15 +278,16 @@ function getRelevantClaudeUsageKinds(model) {
|
|
|
270
278
|
return checkIsScopedWeeklyModel(model) ? ['session', 'weekly_all', 'weekly_scoped'] : ['session', 'weekly_all'];
|
|
271
279
|
}
|
|
272
280
|
/**
|
|
273
|
-
* @description Whether every window a launch of `model` drains is KNOWN and below 100 % — the model is clear of an
|
|
274
|
-
* window: a Fable-only weekly limit does not stop `sonnet`, while an exhausted session or shared weekly window stops
|
|
275
|
-
* model, Fable included. Unknown figures (no snapshot, a window the snapshot lacks) are `false`: a limit nobody can tell
|
|
276
|
-
* scope of is taken to cover the model. A stale snapshot still counts — its last figures are the best there are
|
|
281
|
+
* @description Whether every window a launch of `model` drains is KNOWN and below 100 % at `nowMs` — the model is clear of an
|
|
282
|
+
* exhausted window: a Fable-only weekly limit does not stop `sonnet`, while an exhausted session or shared weekly window stops
|
|
283
|
+
* every model, Fable included. Unknown figures (no snapshot, a window the snapshot lacks) are `false`: a limit nobody can tell
|
|
284
|
+
* the scope of is taken to cover the model. A stale snapshot still counts — its last figures are the best there are — read
|
|
285
|
+
* against the clock ({@link getClaudeUsagePercentAsOf}): a window whose reset has passed counts as empty.
|
|
277
286
|
*/
|
|
278
|
-
function checkHasHeadroomForClaudeModel(usage, model) {
|
|
287
|
+
function checkHasHeadroomForClaudeModel(usage, model, nowMs) {
|
|
279
288
|
return getRelevantClaudeUsageKinds(model).every((kind) => {
|
|
280
289
|
const bucket = getClaudeUsageBucket(usage, kind);
|
|
281
|
-
return bucket !== null && bucket
|
|
290
|
+
return bucket !== null && getClaudeUsagePercentAsOf(bucket, nowMs) < 100;
|
|
282
291
|
});
|
|
283
292
|
}
|
|
284
293
|
/**
|
|
@@ -292,27 +301,35 @@ function checkIsClaudeUsageExhausted(usage, model, nowMs) {
|
|
|
292
301
|
return false;
|
|
293
302
|
return getRelevantClaudeUsageKinds(model).some((kind) => {
|
|
294
303
|
const bucket = getClaudeUsageBucket(usage, kind);
|
|
295
|
-
|
|
296
|
-
return false;
|
|
297
|
-
const resetsAtMs = bucket.resetsAt === null ? Number.NaN : Date.parse(bucket.resetsAt);
|
|
298
|
-
return !(Number.isFinite(resetsAtMs) && resetsAtMs <= nowMs);
|
|
304
|
+
return bucket !== null && getClaudeUsagePercentAsOf(bucket, nowMs) >= 100;
|
|
299
305
|
});
|
|
300
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* @description Whether every window a launch of `model` drains that the snapshot carries has passed its reset instant by
|
|
309
|
+
* `nowMs` — the clock proves the windows that were read are OVER, whether or not the snapshot could be re-read (an account no
|
|
310
|
+
* CLI runs on keeps an expired token and a stale snapshot for good). It does NOT say what was used since: a login of the same
|
|
311
|
+
* account elsewhere (another machine, another host user) leaves no trace here. `false` for no figures, and for any window
|
|
312
|
+
* that is still running or names no reset.
|
|
313
|
+
*/
|
|
314
|
+
function checkHaveClaudeUsageWindowsReset(usage, model, nowMs) {
|
|
315
|
+
const buckets = getRelevantClaudeUsageBuckets(usage, model);
|
|
316
|
+
return buckets.length > 0 && buckets.every((bucket) => checkIsClaudeBucketResetPassed(bucket, nowMs));
|
|
317
|
+
}
|
|
301
318
|
/**
|
|
302
319
|
* @description Whether a pick of `pickedModel`, on the account a usage limit stopped while it ran `limitedModel`, is clear of that
|
|
303
320
|
* limit. The window that stopped the limited model is one of the windows IT drains, so a picked model that drains all of them
|
|
304
321
|
* (the same model, a model on the same windows, or Fable after any other model — Fable drains the shared windows too) is covered
|
|
305
322
|
* by the limit however far the figures lag behind it. Only a model draining FEWER windows — a non-Fable model after Fable, which
|
|
306
|
-
* may have stopped on its own weekly window alone — is judged by {@link checkHasHeadroomForClaudeModel}
|
|
323
|
+
* may have stopped on its own weekly window alone — is judged by {@link checkHasHeadroomForClaudeModel} at `nowMs`. An unknown
|
|
307
324
|
* `limitedModel` leaves it to the figures.
|
|
308
325
|
*/
|
|
309
|
-
function checkIsClaudeModelClearOfLimit(usage, limitedModel, pickedModel) {
|
|
326
|
+
function checkIsClaudeModelClearOfLimit(usage, limitedModel, pickedModel, nowMs) {
|
|
310
327
|
if (limitedModel !== null) {
|
|
311
328
|
const pickedKinds = getRelevantClaudeUsageKinds(pickedModel);
|
|
312
329
|
if (getRelevantClaudeUsageKinds(limitedModel).every((kind) => pickedKinds.includes(kind)))
|
|
313
330
|
return false;
|
|
314
331
|
}
|
|
315
|
-
return checkHasHeadroomForClaudeModel(usage, pickedModel);
|
|
332
|
+
return checkHasHeadroomForClaudeModel(usage, pickedModel, nowMs);
|
|
316
333
|
}
|
|
317
334
|
// ── the launch pick ──
|
|
318
335
|
/** A new agent never starts on an account whose five-hour window is already this full: it would hit the limit within minutes. */
|
|
@@ -337,7 +354,7 @@ function getClaudeChainExclusion(name, scope) {
|
|
|
337
354
|
/**
|
|
338
355
|
* The account itself can run: signed in, not marked limited, its API credits not used up, and none of the windows
|
|
339
356
|
* the model drains (`relevantBuckets`, read by the caller) at 100 %. The one hard-eligibility rule of the report's
|
|
340
|
-
* `isEligible`
|
|
357
|
+
* `isEligible` and of the launch pick, both on the figures as of now.
|
|
341
358
|
*/
|
|
342
359
|
function checkIsClaudeProfileEligible(profile, relevantBuckets, nowMs) {
|
|
343
360
|
const isLimited = profile.limitedUntil !== null && Date.parse(profile.limitedUntil) > nowMs;
|
|
@@ -352,20 +369,37 @@ function getRelevantClaudeUsageBuckets(usage, model) {
|
|
|
352
369
|
.map((kind) => getClaudeUsageBucket(usage, kind))
|
|
353
370
|
.filter((bucket) => bucket !== null);
|
|
354
371
|
}
|
|
372
|
+
/** Whether the bucket names a reset instant that is no later than `nowMs`. */
|
|
373
|
+
function checkIsClaudeBucketResetPassed(bucket, nowMs) {
|
|
374
|
+
const resetMs = getBucketResetMs(bucket);
|
|
375
|
+
return Number.isFinite(resetMs) && resetMs <= nowMs;
|
|
376
|
+
}
|
|
355
377
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
378
|
+
* @description The used percent of a bucket against the clock — THE one rule every screen and every pick reads a figure by:
|
|
379
|
+
* a window whose reset instant has passed since the figure was read is over, so 0 %; a window with a reset ahead, with none or
|
|
380
|
+
* with an unreadable one keeps the figure as read. It says the OLD window ended, nothing about use since (another login of the
|
|
381
|
+
* account, on another machine or host user, is invisible here).
|
|
358
382
|
*/
|
|
359
|
-
function
|
|
360
|
-
|
|
361
|
-
|
|
383
|
+
function getClaudeUsagePercentAsOf(bucket, nowMs) {
|
|
384
|
+
return checkIsClaudeBucketResetPassed(bucket, nowMs) ? 0 : bucket.percent;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @description A bucket as the RANKING of accounts reads it at `nowMs` ({@link sortClaudeProfilesByLaunchRank}, the soonest-reset
|
|
388
|
+
* pick, `nextAvailable`): a window that has reset is empty ({@link getClaudeUsagePercentAsOf}) and its reset moves one window
|
|
389
|
+
* length per elapsed period ahead. That instant is an ESTIMATE made only so such an account has a place in an order — nothing
|
|
390
|
+
* shows that the next window started then (a five-hour window starts at the account's first use), so no screen, report or
|
|
391
|
+
* message may show it as a reset; they keep the instant that passed.
|
|
392
|
+
*/
|
|
393
|
+
function getClaudeUsageBucketAsOf(bucket, nowMs) {
|
|
394
|
+
if (!checkIsClaudeBucketResetPassed(bucket, nowMs))
|
|
362
395
|
return bucket;
|
|
396
|
+
const resetMs = getBucketResetMs(bucket);
|
|
363
397
|
const windowMs = bucket.kind === 'session' ? exports.claudeSessionWindowMs : exports.claudeWeeklyWindowMs;
|
|
364
398
|
const rolledMs = resetMs + (Math.floor((nowMs - resetMs) / windowMs) + 1) * windowMs;
|
|
365
|
-
return { ...bucket, percent:
|
|
399
|
+
return { ...bucket, percent: getClaudeUsagePercentAsOf(bucket, nowMs), resetsAt: new Date(rolledMs).toISOString() };
|
|
366
400
|
}
|
|
367
401
|
function getRelevantClaudeBucketsAsOf(profile, model, nowMs) {
|
|
368
|
-
return getRelevantClaudeUsageBuckets(profile.usage, model).map((bucket) =>
|
|
402
|
+
return getRelevantClaudeUsageBuckets(profile.usage, model).map((bucket) => getClaudeUsageBucketAsOf(bucket, nowMs));
|
|
369
403
|
}
|
|
370
404
|
/**
|
|
371
405
|
* @description Whether a NEW agent of `model` may start on the profile now: a subscription account that is eligible by the
|
|
@@ -460,7 +494,7 @@ function getClaudeProfileFreeAtMs(profile, model, nowMs) {
|
|
|
460
494
|
/** When the profile's five-hour window resets (as of `nowMs`); `null` when the snapshot has none or names no reset. */
|
|
461
495
|
function getSessionResetMs(profile, nowMs) {
|
|
462
496
|
const session = getClaudeUsageBucket(profile.usage, 'session');
|
|
463
|
-
const resetMs = session === null ? Number.NaN : getBucketResetMs(
|
|
497
|
+
const resetMs = session === null ? Number.NaN : getBucketResetMs(getClaudeUsageBucketAsOf(session, nowMs));
|
|
464
498
|
return Number.isFinite(resetMs) ? resetMs : null;
|
|
465
499
|
}
|
|
466
500
|
/**
|
|
@@ -622,10 +656,11 @@ const emptyClaudeProfileReportCredit = {
|
|
|
622
656
|
};
|
|
623
657
|
/**
|
|
624
658
|
* @description The report of every profile for a launch of `model`, with the pick of {@link getClaudeLaunchPick}
|
|
625
|
-
* (`options`: the warm account, the limit stop, the `/limits` list).
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
659
|
+
* (`options`: the warm account, the limit stop, the `/limits` list). The figures of an entry are read as of `nowMs`
|
|
660
|
+
* ({@link getClaudeUsagePercentAsOf}: a window whose reset has passed since it was read counts as empty), its `isUsageStale` says
|
|
661
|
+
* they were not re-read; the pick itself ranks by the estimated next reset of {@link getClaudeUsageBucketAsOf}. `isEligible` is the strict reading — signed in, not marked limited, its API credits not used up, not
|
|
662
|
+
* at 100 % on a relevant window, no five-hour ceiling, not kept off agents by the list (`chainExclusion`) — which the
|
|
663
|
+
* explicit fallback chain's availability reads (it passes no list); `recommended` is the pick. The entries keep the input order.
|
|
629
664
|
*
|
|
630
665
|
* The credit fields of the entries (`spentUsd`, `remainingEstimateUsd`, `expiresOn`, `probablyUsedUp`, `renewedAt`) are left
|
|
631
666
|
* EMPTY here: this module is loaded by the connector guards, which may not reach the credit module. Anything that is shown to
|
|
@@ -635,7 +670,7 @@ const emptyClaudeProfileReportCredit = {
|
|
|
635
670
|
function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
|
|
636
671
|
const relevantBuckets = getRelevantClaudeUsageKinds(model);
|
|
637
672
|
const entries = profiles.map((profile) => {
|
|
638
|
-
const relevant =
|
|
673
|
+
const relevant = getRelevantClaudeBucketsAsOf(profile, model, nowMs);
|
|
639
674
|
const maxPercent = relevant.length === 0 ? null : Math.max(...relevant.map((bucket) => bucket.percent));
|
|
640
675
|
const chainExclusion = getClaudeChainExclusion(profile.name, options.chainScope);
|
|
641
676
|
return {
|
|
@@ -646,7 +681,7 @@ function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
|
|
|
646
681
|
subscriptionType: profile.subscriptionType,
|
|
647
682
|
billing: profile.billing,
|
|
648
683
|
loggedIn: profile.loggedIn ?? null,
|
|
649
|
-
buckets: profile.usage?.buckets ?? [],
|
|
684
|
+
buckets: (profile.usage?.buckets ?? []).map((bucket) => ({ ...bucket, percent: getClaudeUsagePercentAsOf(bucket, nowMs) })),
|
|
650
685
|
usageFetchedAt: profile.usage?.fetchedAt ?? null,
|
|
651
686
|
isUsageStale: profile.usage?.isStale === true,
|
|
652
687
|
limitedUntil: profile.limitedUntil,
|
|
@@ -704,8 +739,9 @@ exports.englishRelativeResetWords = { pattern: '🔄 in {time}', day: 'd', hour:
|
|
|
704
739
|
/**
|
|
705
740
|
* @description A reset instant as a time from now: `🔄 in 2d 1h`, `🔄 in 2h`, `🔄 in 30m`. The two largest
|
|
706
741
|
* units at most, minutes only under an hour: from a day up it is days + hours (hours dropped when zero), from
|
|
707
|
-
* an hour up whole hours (rounded), below that minutes (at least one
|
|
708
|
-
*
|
|
742
|
+
* an hour up whole hours (rounded), below that minutes (at least one: the last seconds before a reset read `in 1m`).
|
|
743
|
+
* Pass an instant AHEAD — a past one is not a countdown ({@link formatClaudeUsageBucket} shows a window whose reset
|
|
744
|
+
* has passed as a bare percent, so it never passes one). `?` for a missing or unparseable instant.
|
|
709
745
|
*/
|
|
710
746
|
function formatClaudeUsageRelativeReset(resetsAt, nowMs, words = exports.englishRelativeResetWords) {
|
|
711
747
|
if (resetsAt === null)
|
|
@@ -734,18 +770,25 @@ function formatClaudeUsageRelativeReset(resetsAt, nowMs, words = exports.english
|
|
|
734
770
|
return words.pattern.replace('{time}', time);
|
|
735
771
|
}
|
|
736
772
|
/**
|
|
737
|
-
* @description `81% 🔄 in 2h` for a bucket, `—` for a missing one. A bucket whose reset
|
|
738
|
-
* `
|
|
739
|
-
*
|
|
773
|
+
* @description `81% 🔄 in 2h` for a bucket, `—` for a missing one. A bucket whose reset has passed since it was read shows a
|
|
774
|
+
* bare `0%` ({@link getClaudeUsagePercentAsOf}) — never the old figure with a reset «in 1m», and no countdown either: nothing
|
|
775
|
+
* says when its next period ends. A snapshot nobody could re-read (an expired token) must not claim a used-up window for ever;
|
|
776
|
+
* its stale mark is the caller's. A bucket whose reset is unknown shows the reset of `fallbackBucket` instead (the session
|
|
777
|
+
* window's reset is often missing while the weekly one is known) while that one is still ahead; with neither it is the bare
|
|
778
|
+
* percent — a «?» after a number would read as a doubt about the number.
|
|
740
779
|
*/
|
|
741
780
|
function formatClaudeUsageBucket(bucket, nowMs, options = {}) {
|
|
742
781
|
if (bucket === null)
|
|
743
782
|
return '—';
|
|
744
|
-
const
|
|
745
|
-
|
|
783
|
+
const percent = getClaudeUsagePercentAsOf(bucket, nowMs);
|
|
784
|
+
if (checkIsClaudeBucketResetPassed(bucket, nowMs))
|
|
785
|
+
return `${percent}%`;
|
|
786
|
+
const isOwnResetKnown = bucket.resetsAt !== null && !Number.isNaN(Date.parse(bucket.resetsAt));
|
|
787
|
+
const fallbackBucket = options.fallbackBucket && !checkIsClaudeBucketResetPassed(options.fallbackBucket, nowMs) ? options.fallbackBucket : null;
|
|
788
|
+
const resetsAt = isOwnResetKnown ? bucket.resetsAt : fallbackBucket?.resetsAt ?? null;
|
|
746
789
|
if (resetsAt === null || Number.isNaN(Date.parse(resetsAt)))
|
|
747
|
-
return `${
|
|
748
|
-
return `${
|
|
790
|
+
return `${percent}%`;
|
|
791
|
+
return `${percent}% ${formatClaudeUsageRelativeReset(resetsAt, nowMs, options.words)}`;
|
|
749
792
|
}
|
|
750
793
|
// ── small readers ──
|
|
751
794
|
function checkIsRecord(value) {
|