charness 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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/agent-plugin/skills/charness-orchestration/SKILL.md +8 -2
- package/dist/agentLogin/agentLogin.d.ts.map +1 -1
- package/dist/agentLogin/agentLogin.js +6 -5
- package/dist/agentLogin/agentLogin.js.map +1 -1
- package/dist/apiRetryKick.d.ts +15 -5
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +13 -8
- package/dist/apiRetryKick.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +85 -46
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +4 -1
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +6 -2
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +3 -1
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +12 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +253 -89
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/fallbackChain.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/fallbackChain.js +8 -7
- package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
- package/dist/connectors/telegram/commands/limitsBoard.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/limitsBoard.js +3 -1
- package/dist/connectors/telegram/commands/limitsBoard.js.map +1 -1
- package/dist/connectors/telegram/commands/modelPage.d.ts +2 -0
- package/dist/connectors/telegram/commands/modelPage.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/modelPage.js +1 -1
- package/dist/connectors/telegram/commands/modelPage.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +42 -25
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +42 -25
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +42 -25
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +42 -25
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +42 -25
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +42 -25
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +42 -25
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +42 -25
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +42 -25
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +42 -25
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +42 -25
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +42 -25
- package/dist/i18n/zh.js.map +1 -1
- package/dist/i18n.d.ts +0 -12
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -4
- package/dist/i18n.js.map +1 -1
- package/dist/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +30 -6
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/sessionTurnProbe.d.ts +6 -1
- package/dist/requests/sessionTurnProbe.d.ts.map +1 -1
- package/dist/requests/sessionTurnProbe.js +4 -0
- package/dist/requests/sessionTurnProbe.js.map +1 -1
- package/dist/requests/types.d.ts +18 -4
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.d.ts +13 -1
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +69 -8
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/requests/wakeUpRules.d.ts +63 -2
- package/dist/requests/wakeUpRules.d.ts.map +1 -1
- package/dist/requests/wakeUpRules.js +67 -36
- package/dist/requests/wakeUpRules.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +30 -1
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +75 -15
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/shutdown.d.ts +12 -0
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +11 -0
- package/dist/shutdown.js.map +1 -1
- package/dist/state.d.ts +11 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +15 -0
- package/dist/state.js.map +1 -1
- package/dist/utils/backendSwitchPlan.d.ts +4 -1
- package/dist/utils/backendSwitchPlan.d.ts.map +1 -1
- package/dist/utils/backendSwitchPlan.js +6 -2
- package/dist/utils/backendSwitchPlan.js.map +1 -1
- package/dist/utils/claudeAccountAlert.d.ts +6 -3
- package/dist/utils/claudeAccountAlert.d.ts.map +1 -1
- package/dist/utils/claudeAccountAlert.js +13 -7
- package/dist/utils/claudeAccountAlert.js.map +1 -1
- package/dist/utils/claudeAccountPickerPlan.d.ts +17 -3
- package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
- package/dist/utils/claudeAccountPickerPlan.js +19 -4
- package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
- package/dist/utils/claudeProfileLabels.d.ts +160 -0
- package/dist/utils/claudeProfileLabels.d.ts.map +1 -0
- package/dist/utils/claudeProfileLabels.js +283 -0
- package/dist/utils/claudeProfileLabels.js.map +1 -0
- package/dist/utils/claudeProfileUsageViews.d.ts +2 -0
- package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageViews.js +3 -1
- package/dist/utils/claudeProfileUsageViews.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +5 -0
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +1 -0
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts +4 -2
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +4 -3
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/fallbackSwitchNotice.d.ts +1 -1
- package/dist/utils/fallbackSwitchNotice.d.ts.map +1 -1
- package/dist/utils/fallbackSwitchNotice.js +4 -3
- package/dist/utils/fallbackSwitchNotice.js.map +1 -1
- package/dist/utils/limitSwitchPlan.d.ts +51 -14
- package/dist/utils/limitSwitchPlan.d.ts.map +1 -1
- package/dist/utils/limitSwitchPlan.js +33 -15
- package/dist/utils/limitSwitchPlan.js.map +1 -1
- package/dist/utils/limitsBoardPlan.d.ts +6 -4
- package/dist/utils/limitsBoardPlan.d.ts.map +1 -1
- package/dist/utils/limitsBoardPlan.js +11 -5
- package/dist/utils/limitsBoardPlan.js.map +1 -1
- package/dist/utils/threadStatusReport.d.ts +2 -0
- package/dist/utils/threadStatusReport.d.ts.map +1 -1
- package/dist/utils/threadStatusReport.js +4 -3
- package/dist/utils/threadStatusReport.js.map +1 -1
- package/dist/utils/workingSignals.d.ts +10 -0
- package/dist/utils/workingSignals.d.ts.map +1 -1
- package/dist/utils/workingSignals.js +22 -3
- package/dist/utils/workingSignals.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description The pure decision behind «a conversation hit its usage limit — may it move on, and where to»
|
|
3
3
|
* (`bot.ts` `planFallbackSwitch` wires it): the candidates (the operator's fallback chain, or, with none, the ranking of the
|
|
4
|
-
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the
|
|
5
|
-
* wait with nothing to switch to
|
|
4
|
+
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the rung a
|
|
5
|
+
* wait with nothing to switch to is aimed at.
|
|
6
6
|
*
|
|
7
7
|
* WHO it applies to. A Telegram topic takes all of it. A conversation of another platform (a Jira issue; no `checkIsTelegramKey`)
|
|
8
|
-
* takes the AUTOMATIC
|
|
8
|
+
* takes the AUTOMATIC moves between Claude accounts only: the chain's Claude rungs (an OpenCode rung is a cross-backend hand-over
|
|
9
9
|
* that has no surface outside Telegram; a list with no Claude rung restricts no account, as for agents —
|
|
10
|
-
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's)
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's). With no account free it waits for
|
|
11
|
+
* the Claude account whose limit resets EARLIEST and the retry kick moves it there — the same automatic move, made later. With
|
|
12
|
+
* auto-switch OFF it waits for its own account's reset — also when the switch is turned OFF during such a wait
|
|
13
|
+
* (`decideAimedWaitEnd`) — and on OpenCode it has nothing to decide.
|
|
13
14
|
*
|
|
14
15
|
* No I/O, no `Date.now()`: the caller passes the clock and the detection, so every rule is unit-tested.
|
|
15
16
|
*/
|
|
16
17
|
import { type FallbackChainEntry, type FallbackDetection, type FallbackSwitchPlan } from './fallbackChain';
|
|
17
18
|
/**
|
|
18
|
-
* @description Whether
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* @description Whether the rung `rung` can take part in a usage-limit move at all — as the one a conversation runs on when the limit
|
|
20
|
+
* hits (does it lead to a switch decision), or as the one it moves onto, now or when a wait aimed at it ends: in a Telegram topic any
|
|
21
|
+
* rung, elsewhere only a Claude account — a hand-over to OpenCode has no surface outside Telegram. (The caller has already dropped a
|
|
22
|
+
* conversation with no rung to leave — a terminal, no agent, an OpenCode server on its default model.)
|
|
21
23
|
*/
|
|
22
|
-
export declare function checkIsLimitSwitchPossible(isTelegram: boolean,
|
|
24
|
+
export declare function checkIsLimitSwitchPossible(isTelegram: boolean, rung: FallbackChainEntry): boolean;
|
|
25
|
+
/** The rung a usage-limit wait is re-aimed at — the one whose limit resets first — and when that limit ends. */
|
|
26
|
+
export interface LimitWaitTarget {
|
|
27
|
+
entry: FallbackChainEntry;
|
|
28
|
+
untilMs: number;
|
|
29
|
+
}
|
|
23
30
|
export interface LimitSwitchDecision {
|
|
24
31
|
plan: FallbackSwitchPlan;
|
|
25
32
|
/**
|
|
26
|
-
* When `plan` is `none`:
|
|
27
|
-
*
|
|
28
|
-
*
|
|
33
|
+
* When `plan` is `none`: ANOTHER rung whose limit resets EARLIEST (`pickEarliestResetRung`), so the armed wait ends there and the
|
|
34
|
+
* retry kick moves the conversation onto it; `null` when the conversation's own rung resets first (or within a minute of the first)
|
|
35
|
+
* or no other one names a reset. Picked from the operator's chain (outside Telegram its Claude rungs), else the signed-in
|
|
36
|
+
* SUBSCRIPTIONS (an account billed to API credits never ends a wait by itself). Always `null` when the plan is not `none`, and
|
|
37
|
+
* outside Telegram with auto-switch OFF: there the wait's end moves the conversation by itself, which that switch forbids.
|
|
29
38
|
*/
|
|
30
|
-
|
|
39
|
+
waitTarget: LimitWaitTarget | null;
|
|
31
40
|
}
|
|
32
41
|
/**
|
|
33
42
|
* @description What the usage limit of the rung `from` leads to. `chain` is the operator's fallback chain as stored (empty = none);
|
|
@@ -41,4 +50,32 @@ export declare function decideLimitSwitch(input: {
|
|
|
41
50
|
isAutoSwitchEnabled: boolean;
|
|
42
51
|
nowMs: number;
|
|
43
52
|
}): LimitSwitchDecision;
|
|
53
|
+
/** What the end of a usage-limit wait aimed at another rung does ({@link decideAimedWaitEnd}). */
|
|
54
|
+
export type AimedWaitEnd =
|
|
55
|
+
/** Move the conversation onto the rung the wait was aimed at. */
|
|
56
|
+
{
|
|
57
|
+
action: 'move';
|
|
58
|
+
}
|
|
59
|
+
/** Stay, and wait again until the conversation's own account is back (`untilMs`). */
|
|
60
|
+
| {
|
|
61
|
+
action: 'waitOwnReset';
|
|
62
|
+
untilMs: number;
|
|
63
|
+
}
|
|
64
|
+
/** Stay, and resume here now: its own account names no reset still ahead. */
|
|
65
|
+
| {
|
|
66
|
+
action: 'resumeHere';
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @description What the end of a usage-limit wait aimed at another rung (the retry record's `resumeOn`) does. A topic moves there
|
|
70
|
+
* whatever its switch says: its aimed wait is armed with auto-switch OFF too. Outside Telegram only the automatic switch moves a
|
|
71
|
+
* conversation, and the wait was aimed only while it was ON: turned OFF since, the conversation stays on its own account — waiting
|
|
72
|
+
* again until that account is back (`ownLimitedUntilMs`, its limit mark) while that lies ahead, rather than resuming into a limit
|
|
73
|
+
* it is known to hit; resumed now when its account names no reset ahead.
|
|
74
|
+
*/
|
|
75
|
+
export declare function decideAimedWaitEnd(input: {
|
|
76
|
+
isTelegram: boolean;
|
|
77
|
+
isAutoSwitchEnabled: boolean;
|
|
78
|
+
ownLimitedUntilMs: number | null;
|
|
79
|
+
nowMs: number;
|
|
80
|
+
}): AimedWaitEnd;
|
|
44
81
|
//# sourceMappingURL=limitSwitchPlan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitSwitchPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"limitSwitchPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAEjG;AAED,gHAAgH;AAChH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;;;;OAMG;IACH,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,mBAAmB,CAoBtB;AAED,kGAAkG;AAClG,MAAM,MAAM,YAAY;AACtB,iEAAiE;AAC/D;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;AACpB,qFAAqF;GACnF;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAC7C,6EAA6E;GAC3E;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAE7B;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,mBAAmB,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAI9J"}
|
|
@@ -2,30 +2,33 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @description The pure decision behind «a conversation hit its usage limit — may it move on, and where to»
|
|
4
4
|
* (`bot.ts` `planFallbackSwitch` wires it): the candidates (the operator's fallback chain, or, with none, the ranking of the
|
|
5
|
-
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the
|
|
6
|
-
* wait with nothing to switch to
|
|
5
|
+
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the rung a
|
|
6
|
+
* wait with nothing to switch to is aimed at.
|
|
7
7
|
*
|
|
8
8
|
* WHO it applies to. A Telegram topic takes all of it. A conversation of another platform (a Jira issue; no `checkIsTelegramKey`)
|
|
9
|
-
* takes the AUTOMATIC
|
|
9
|
+
* takes the AUTOMATIC moves between Claude accounts only: the chain's Claude rungs (an OpenCode rung is a cross-backend hand-over
|
|
10
10
|
* that has no surface outside Telegram; a list with no Claude rung restricts no account, as for agents —
|
|
11
|
-
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's). With no account free it waits for
|
|
12
|
+
* the Claude account whose limit resets EARLIEST and the retry kick moves it there — the same automatic move, made later. With
|
|
13
|
+
* auto-switch OFF it waits for its own account's reset — also when the switch is turned OFF during such a wait
|
|
14
|
+
* (`decideAimedWaitEnd`) — and on OpenCode it has nothing to decide.
|
|
14
15
|
*
|
|
15
16
|
* No I/O, no `Date.now()`: the caller passes the clock and the detection, so every rule is unit-tested.
|
|
16
17
|
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.checkIsLimitSwitchPossible = checkIsLimitSwitchPossible;
|
|
19
20
|
exports.decideLimitSwitch = decideLimitSwitch;
|
|
21
|
+
exports.decideAimedWaitEnd = decideAimedWaitEnd;
|
|
20
22
|
const claudeLimitSwitch_1 = require("./claudeLimitSwitch");
|
|
21
23
|
const fallbackChain_1 = require("./fallbackChain");
|
|
22
24
|
/**
|
|
23
|
-
* @description Whether
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* @description Whether the rung `rung` can take part in a usage-limit move at all — as the one a conversation runs on when the limit
|
|
26
|
+
* hits (does it lead to a switch decision), or as the one it moves onto, now or when a wait aimed at it ends: in a Telegram topic any
|
|
27
|
+
* rung, elsewhere only a Claude account — a hand-over to OpenCode has no surface outside Telegram. (The caller has already dropped a
|
|
28
|
+
* conversation with no rung to leave — a terminal, no agent, an OpenCode server on its default model.)
|
|
26
29
|
*/
|
|
27
|
-
function checkIsLimitSwitchPossible(isTelegram,
|
|
28
|
-
return isTelegram ||
|
|
30
|
+
function checkIsLimitSwitchPossible(isTelegram, rung) {
|
|
31
|
+
return isTelegram || rung.backend === 'claude';
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* @description What the usage limit of the rung `from` leads to. `chain` is the operator's fallback chain as stored (empty = none);
|
|
@@ -33,7 +36,7 @@ function checkIsLimitSwitchPossible(isTelegram, from) {
|
|
|
33
36
|
*/
|
|
34
37
|
function decideLimitSwitch(input) {
|
|
35
38
|
const { isTelegram, from, detection, nowMs } = input;
|
|
36
|
-
const explicit =
|
|
39
|
+
const explicit = input.chain.filter((entry) => checkIsLimitSwitchPossible(isTelegram, entry));
|
|
37
40
|
// Without a configured chain a Claude conversation falls back to the within-Claude ranking (the soonest weekly reset first).
|
|
38
41
|
const ranked = explicit.length === 0 && from.backend === 'claude'
|
|
39
42
|
? (0, claudeLimitSwitch_1.pickClaudeLimitSwitchCandidates)({ profiles: detection.claudeProfiles, currentName: from.profile, model: from.model, nowMs })
|
|
@@ -42,13 +45,28 @@ function decideLimitSwitch(input) {
|
|
|
42
45
|
const candidates = (0, fallbackChain_1.pickFallbackCandidates)({ chain: ranked, current: from, detection, nowMs });
|
|
43
46
|
const decided = (0, fallbackChain_1.decideFallbackSwitch)({ candidates, isAutoSwitchEnabled: input.isAutoSwitchEnabled });
|
|
44
47
|
const plan = !isTelegram && decided.action === 'offer' ? { action: 'none' } : decided;
|
|
45
|
-
if (plan.action !== 'none' || !isTelegram)
|
|
46
|
-
return { plan,
|
|
48
|
+
if (plan.action !== 'none' || (!isTelegram && !input.isAutoSwitchEnabled))
|
|
49
|
+
return { plan, waitTarget: null };
|
|
47
50
|
const implicit = from.backend === 'claude'
|
|
48
51
|
? detection.claudeProfiles
|
|
49
52
|
.filter((profile) => profile.loggedIn !== false && profile.billing !== 'api')
|
|
50
53
|
.map((profile) => ({ backend: 'claude', profile: profile.name, model: null }))
|
|
51
54
|
: [];
|
|
52
|
-
|
|
55
|
+
const waitRungs = explicit.length > 0 ? explicit : implicit;
|
|
56
|
+
const found = waitRungs.length > 0 ? (0, fallbackChain_1.pickEarliestResetRung)({ chain: waitRungs, current: from, detection, nowMs }) : null;
|
|
57
|
+
return { plan, waitTarget: found && !found.isCurrent ? { entry: found.entry, untilMs: found.untilMs } : null };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @description What the end of a usage-limit wait aimed at another rung (the retry record's `resumeOn`) does. A topic moves there
|
|
61
|
+
* whatever its switch says: its aimed wait is armed with auto-switch OFF too. Outside Telegram only the automatic switch moves a
|
|
62
|
+
* conversation, and the wait was aimed only while it was ON: turned OFF since, the conversation stays on its own account — waiting
|
|
63
|
+
* again until that account is back (`ownLimitedUntilMs`, its limit mark) while that lies ahead, rather than resuming into a limit
|
|
64
|
+
* it is known to hit; resumed now when its account names no reset ahead.
|
|
65
|
+
*/
|
|
66
|
+
function decideAimedWaitEnd(input) {
|
|
67
|
+
if (input.isTelegram || input.isAutoSwitchEnabled)
|
|
68
|
+
return { action: 'move' };
|
|
69
|
+
const untilMs = input.ownLimitedUntilMs;
|
|
70
|
+
return untilMs !== null && Number.isFinite(untilMs) && untilMs > input.nowMs ? { action: 'waitOwnReset', untilMs } : { action: 'resumeHere' };
|
|
53
71
|
}
|
|
54
72
|
//# sourceMappingURL=limitSwitchPlan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitSwitchPlan.js","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"limitSwitchPlan.js","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAkBH,gEAEC;AAwBD,8CA2BC;AAkBD,gDAIC;AA3FD,2DAAsE;AACtE,mDAOyB;AAEzB;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,UAAmB,EAAE,IAAwB;IACtF,OAAO,UAAU,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC;AACjD,CAAC;AAoBD;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAOjC;IACC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9F,6HAA6H;IAC7H,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ;QAC/D,CAAC,CAAC,IAAA,mDAA+B,EAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;aAC3H,GAAG,CAAC,CAAC,OAAO,EAAsB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC,CAAC,QAAQ,CAAC;IACb,MAAM,UAAU,GAAG,IAAA,sCAAsB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE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IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACjH,CAAC;AAWD;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,KAA6G;IAC9I,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,mBAAmB;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC7E,MAAM,OAAO,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACxC,OAAO,OAAO,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAChJ,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @description The `/limits` switch board in two pure pieces:
|
|
3
3
|
*
|
|
4
4
|
* - the ROWS — one per Claude account (in `/accounts` order), then one per connected OpenCode provider (in
|
|
5
|
-
* catalog order), each labelled `[✓ ]<program> · <account or provider>` and nothing else: the buttons carry no usage,
|
|
5
|
+
* catalog order), each labelled `[✓ ]<program> · <account or provider>` (an account by its display name, `utils/claudeProfileLabels.ts`) and nothing else: the buttons carry no usage,
|
|
6
6
|
* no reset and no model (the figures do not fit a phone's button) — only an account billed to API credits ends in
|
|
7
7
|
* ` 💳` (a tap on it spends money). The `✓` marks the active row only — where the
|
|
8
8
|
* topic runs now, in General the default Claude account. An account that CANNOT WORK and that a sign-in mends (signed out, its
|
|
@@ -23,15 +23,17 @@ import { type OpenCodeProviderUsageRecord } from './openCodeUsage';
|
|
|
23
23
|
export interface LimitsBoardRow {
|
|
24
24
|
/** `claudeSignIn`: a Claude account that cannot work and that a sign-in mends — its tap starts the sign-in, it is never a switch target. */
|
|
25
25
|
kind: 'claude' | 'claudeSignIn' | 'opencode';
|
|
26
|
-
/** The Claude account's
|
|
26
|
+
/** The Claude account's fixed id, or the OpenCode provider's id — what a tap acts on. */
|
|
27
27
|
id: string;
|
|
28
|
+
/** What the row is called: a Claude account's display name (`utils/claudeProfileLabels.ts`), a provider's id. */
|
|
29
|
+
name: string;
|
|
28
30
|
label: string;
|
|
29
|
-
/** The topic runs on this account / provider (in General: this is the
|
|
31
|
+
/** The topic runs on this account / provider (in General: this is the Claude account for all topics). */
|
|
30
32
|
isActive: boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface LimitsBoardInput {
|
|
33
35
|
detection: FallbackDetection;
|
|
34
|
-
/** Where the topic runs; in General the
|
|
36
|
+
/** Where the topic runs; in General the Claude account for all topics (no model); `null` for no agent / an unknown OpenCode model. */
|
|
35
37
|
current: FallbackChainEntry | null;
|
|
36
38
|
/** The localised program names (`Claude` / `OpenCode`). */
|
|
37
39
|
words: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitsBoardPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"limitsBoardPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAsBtF,MAAM,WAAW,cAAc;IAC7B,4IAA4I;IAC5I,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,UAAU,CAAC;IAC7C,yFAAyF;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,iHAAiH;IACjH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yGAAyG;IACzG,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,sIAAsI;IACtI,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,2DAA2D;IAC3D,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAaD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,EAAE,CA4B9E;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,6FAA6F;IAC7F,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAiBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAqB3E"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description The `/limits` switch board in two pure pieces:
|
|
4
4
|
*
|
|
5
5
|
* - the ROWS — one per Claude account (in `/accounts` order), then one per connected OpenCode provider (in
|
|
6
|
-
* catalog order), each labelled `[✓ ]<program> · <account or provider>` and nothing else: the buttons carry no usage,
|
|
6
|
+
* catalog order), each labelled `[✓ ]<program> · <account or provider>` (an account by its display name, `utils/claudeProfileLabels.ts`) and nothing else: the buttons carry no usage,
|
|
7
7
|
* no reset and no model (the figures do not fit a phone's button) — only an account billed to API credits ends in
|
|
8
8
|
* ` 💳` (a tap on it spends money). The `✓` marks the active row only — where the
|
|
9
9
|
* topic runs now, in General the default Claude account. An account that CANNOT WORK and that a sign-in mends (signed out, its
|
|
@@ -24,6 +24,7 @@ exports.buildLimitsBoardRows = buildLimitsBoardRows;
|
|
|
24
24
|
exports.formatLimitsUsageBlock = formatLimitsUsageBlock;
|
|
25
25
|
const i18n_1 = require("../i18n");
|
|
26
26
|
const claudeAuthRefusal_1 = require("./claudeAuthRefusal");
|
|
27
|
+
const claudeProfileLabels_1 = require("./claudeProfileLabels");
|
|
27
28
|
const claudeProfileUsageLines_1 = require("./claudeProfileUsageLines");
|
|
28
29
|
const fallbackChain_1 = require("./fallbackChain");
|
|
29
30
|
const openCodeUsage_1 = require("./openCodeUsage");
|
|
@@ -47,10 +48,12 @@ function formatUnusableMark(usability) {
|
|
|
47
48
|
const chatGptBrandName = 'ChatGPT';
|
|
48
49
|
/** The mark after an account billed to API credits: every request on it costs money. */
|
|
49
50
|
const meteredMark = ' 💳';
|
|
51
|
+
/** A row: its label is `[✓ |🔑 ]<program> · <name>[ 💳]`, an account's name cut to fit a phone (the message above shows it whole). */
|
|
50
52
|
function buildRow(row) {
|
|
51
53
|
const { program, isMetered, ...rest } = row;
|
|
52
54
|
const mark = row.kind === 'claudeSignIn' ? signInMark : row.isActive ? activeMark : '';
|
|
53
|
-
|
|
55
|
+
const name = row.kind === 'opencode' ? row.name : (0, claudeProfileLabels_1.shortenClaudeProfileLabel)(row.name);
|
|
56
|
+
return { ...rest, label: `${mark}${program} · ${name}${isMetered ? meteredMark : ''}` };
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* @description The board's rows: the Claude accounts — one that cannot work as a sign-in row where a sign-in mends it (signed out, expired,
|
|
@@ -64,12 +67,13 @@ function buildLimitsBoardRows(input) {
|
|
|
64
67
|
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
65
68
|
if (usability !== 'usable') {
|
|
66
69
|
if ((0, claudeAuthRefusal_1.checkIsClaudeUsabilityMendedBySignIn)(usability))
|
|
67
|
-
rows.push(buildRow({ kind: 'claudeSignIn', id: profile.name, program: input.words.claude, isActive: false }));
|
|
70
|
+
rows.push(buildRow({ kind: 'claudeSignIn', id: profile.name, name: profile.label ?? profile.name, program: input.words.claude, isActive: false }));
|
|
68
71
|
continue;
|
|
69
72
|
}
|
|
70
73
|
rows.push(buildRow({
|
|
71
74
|
kind: 'claude',
|
|
72
75
|
id: profile.name,
|
|
76
|
+
name: profile.label ?? profile.name,
|
|
73
77
|
program: input.words.claude,
|
|
74
78
|
isActive: current?.backend === 'claude' && current.profile === profile.name,
|
|
75
79
|
isMetered: profile.billing === 'api',
|
|
@@ -79,6 +83,7 @@ function buildLimitsBoardRows(input) {
|
|
|
79
83
|
rows.push(buildRow({
|
|
80
84
|
kind: 'opencode',
|
|
81
85
|
id: providerId,
|
|
86
|
+
name: providerId,
|
|
82
87
|
program: input.words.openCode,
|
|
83
88
|
isActive: (0, fallbackChain_1.getRunningModelOfProvider)(current, providerId) !== null,
|
|
84
89
|
}));
|
|
@@ -109,13 +114,14 @@ function formatLimitsUsageBlock(input) {
|
|
|
109
114
|
const entries = [];
|
|
110
115
|
for (const profile of input.detection.claudeProfiles) {
|
|
111
116
|
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
117
|
+
const name = profile.label ?? profile.name;
|
|
112
118
|
if (usability !== 'usable') {
|
|
113
|
-
entries.push(`${
|
|
119
|
+
entries.push(`${name} — ${formatUnusableMark(usability)}`);
|
|
114
120
|
continue;
|
|
115
121
|
}
|
|
116
122
|
const usageLines = (0, claudeProfileUsageLines_1.formatClaudeProfileUsageLines)(profile, input.timezone, input.nowMs);
|
|
117
123
|
// An account billed to API credits has no windows: its entry says how it pays, the used-up mark hangs under it.
|
|
118
|
-
const entry = formatUsageEntry(
|
|
124
|
+
const entry = formatUsageEntry(name, profile.billing === 'api' ? [(0, i18n_1.t)('account.kind.api'), ...usageLines] : usageLines);
|
|
119
125
|
if (entry !== null)
|
|
120
126
|
entries.push(entry);
|
|
121
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;
|
|
1
|
+
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAsEH,oDA4BC;AAgCD,wDAqBC;AArJD,kCAA4B;AAC5B,2DAAmI;AACnI,+DAAkE;AAClE,uEAA0E;AAC1E,mDAKyB;AACzB,mDAAsF;AAEtF,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,wKAAwK;AACxK,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,6GAA6G;AAC7G,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,0JAA0J;AAC1J,MAAM,gBAAgB,GAAwE;IAC5F,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE,qBAAqB;IAC/B,WAAW,EAAE,wBAAwB;CACtC,CAAC;AAEF,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,SAAoD;IAC9E,OAAO,GAAG,IAAA,wDAAoC,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,GAAG,IAAA,QAAC,EAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;AAC1H,CAAC;AACD,qGAAqG;AACrG,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAsBnC,wFAAwF;AACxF,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,sIAAsI;AACtI,SAAS,QAAQ,CAAC,GAA6E;IAC7F,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CA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,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAC,qBAAqB,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -4,6 +4,8 @@ import type { ClaudeApiSpend } from './claudeApiSpend';
|
|
|
4
4
|
/** One Claude account profile as `/status` names it. */
|
|
5
5
|
export interface ThreadStatusAccountSource {
|
|
6
6
|
name: string;
|
|
7
|
+
/** What the account is called (its display name, `utils/claudeProfileLabels.ts`); the id when absent. */
|
|
8
|
+
label?: string;
|
|
7
9
|
/** What the last `claude auth status` read said; `null` when never probed. */
|
|
8
10
|
email: string | null;
|
|
9
11
|
/** That read's sign-in answer; `undefined` when never probed. A signed-out profile may keep an old email. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threadStatusReport.d.ts","sourceRoot":"","sources":["../../src/utils/threadStatusReport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,wDAAwD;AACxD,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6GAA6G;IAC7G,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,sFAAsF;IACtF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qHAAqH;IACrH,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACtC,+GAA+G;IAC/G,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qGAAqG;IACrG,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,oGAAoG;IACpG,OAAO,EAAE,yBAAyB,CAAC;IACnC,4GAA4G;IAC5G,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,iGAAiG;IACjG,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uHAAuH;IACvH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,WAAW,GACZ,EAAE,uBAAuB,GAAG,MAAM,CA+BlC;
|
|
1
|
+
{"version":3,"file":"threadStatusReport.d.ts","sourceRoot":"","sources":["../../src/utils/threadStatusReport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK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mB,GAAG,IAAI,CAAC;IACrC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,WAAW,GACZ,EAAE,uBAAuB,GAAG,MAAM,CA+BlC;AAiBD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAO3H;AAED,MAAM,WAAW,wBAAwB;IACvC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uFAAuF;IACvF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qEAAqE;IACrE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE,wBAAwB,GAAG,MAAM,GAAG,IAAI,CAE1C"}
|
|
@@ -52,11 +52,12 @@ function getThreadStatusReport({ agentLine, subdir, isActive, isSleeping, workDi
|
|
|
52
52
|
return lines.join('\n');
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* @description `name · email` like an `/accounts` row (`name · not signed in` once a probe said so, the name
|
|
55
|
+
* @description `name · email` like an `/accounts` row — the account's display name — (`name · not signed in` once a probe said so, the name
|
|
56
56
|
* alone when never probed), `· 💳 API` for an account billed to the API, `· 💸 credits used up` while that mark holds,
|
|
57
57
|
* plus the `/accounts` limit mark while it lies in the future, reset in the instance zone.
|
|
58
58
|
*/
|
|
59
|
-
function formatAccount({ name, email, loggedIn, limitedUntil, billing, creditExhaustedAt }, timezone, nowMs) {
|
|
59
|
+
function formatAccount({ name: id, label, email, loggedIn, limitedUntil, billing, creditExhaustedAt }, timezone, nowMs) {
|
|
60
|
+
const name = label ?? id;
|
|
60
61
|
const detail = loggedIn === false ? (0, i18n_1.t)('account.row.loggedOut') : email;
|
|
61
62
|
const metered = `${billing === 'api' ? (0, i18n_1.t)('status.thread_account_api') : ''}${creditExhaustedAt ? (0, i18n_1.t)('status.thread_account_exhausted') : ''}`;
|
|
62
63
|
const limited = limitedUntil !== null && Date.parse(limitedUntil) > nowMs
|
|
@@ -71,7 +72,7 @@ function formatAccount({ name, email, loggedIn, limitedUntil, billing, creditExh
|
|
|
71
72
|
function formatThreadStatusAccountLines({ current, pending, nowMs }, timezone) {
|
|
72
73
|
const lines = [(0, i18n_1.t)('status.thread_account', { account: formatAccount(current, timezone, nowMs) })];
|
|
73
74
|
if (current.billing === 'api' && current.apiSpend) {
|
|
74
|
-
lines.push((0, i18n_1.t)('status.thread_api_spend', { name: current.name, ...(0, claudeProfileUsageLines_1.formatClaudeApiSpendWords)(current.apiSpend, timezone, nowMs) }));
|
|
75
|
+
lines.push((0, i18n_1.t)('status.thread_api_spend', { name: current.label ?? current.name, ...(0, claudeProfileUsageLines_1.formatClaudeApiSpendWords)(current.apiSpend, timezone, nowMs) }));
|
|
75
76
|
}
|
|
76
77
|
if (pending !== null)
|
|
77
78
|
lines.push((0, i18n_1.t)('status.thread_account_pending', { account: formatAccount(pending, timezone, nowMs) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threadStatusReport.js","sourceRoot":"","sources":["../../src/utils/threadStatusReport.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"threadStatusReport.js","sourceRoot":"","sources":["../../src/utils/threadStatusReport.ts"],"names":[],"mappings":";;AAsEA,sDA8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AAC,EAAE,CAAC,CAAC,CAAC;IACrJ,CAAC;IACD,IAAI,OAAO,KAAK,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,IAAA,QAAC,EAAC,+BAA+B,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3H,OAAO,KAAK,CAAC;AACf,CAAC;AAWD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,YAAY,EACZ,cAAc,GACW;IACzB,OAAO,YAAY,IAAI,YAAY,IAAI,cAAc,IAAI,IAAI,CAAC;AAChE,CAAC"}
|
|
@@ -37,6 +37,16 @@ export type WorkingSignal = {
|
|
|
37
37
|
export declare function describeWorkingSignal(signal: WorkingSignal): string;
|
|
38
38
|
/** @description The signals in the words of the bot's log, comma-separated (`busy turn, unconsumed input 2`). */
|
|
39
39
|
export declare function describeWorkingSignals(signals: readonly WorkingSignal[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* @description Whether the agent waits on its own pending work — a background command or sub-agent, a session job (a `ScheduleWakeup`,
|
|
42
|
+
* a `CronCreate`), a finished task's turn on its way — whose end starts its next turn by itself.
|
|
43
|
+
*/
|
|
44
|
+
export declare function checkHasOwnPendingWork(signals: readonly WorkingSignal[]): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @description Whether the agent's own work still runs — a background command or sub-agent, a session job — not only the notice of
|
|
47
|
+
* a task that already ended ({@link checkHasOwnPendingWork} counts that too).
|
|
48
|
+
*/
|
|
49
|
+
export declare function checkHasOwnLastingWork(signals: readonly WorkingSignal[]): boolean;
|
|
40
50
|
/** @description The reason the person is told when an idle compaction is skipped because the process was held. */
|
|
41
51
|
export type IdleHeldNoticeReason = 'backgroundWork' | 'unconsumedInput';
|
|
42
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workingSignals.d.ts","sourceRoot":"","sources":["../../src/utils/workingSignals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB;AAC9B,qHAAqH;AACnH;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC5C,mFAAmF;GACjF;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC1C,sHAAsH;GACpH;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE;AAC9B,sHAAsH;GACpH;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC5C,oFAAoF;GAClF;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3B,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,oBAAoB,CAAC;AAEpE,uHAAuH;AACvH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CASnE;AAED,iHAAiH;AACjH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAEhF;AAED,kHAAkH;AAClH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"workingSignals.d.ts","sourceRoot":"","sources":["../../src/utils/workingSignals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB;AAC9B,qHAAqH;AACnH;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC5C,mFAAmF;GACjF;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC1C,sHAAsH;GACpH;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE;AAC9B,sHAAsH;GACpH;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC5C,oFAAoF;GAClF;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3B,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,oBAAoB,CAAC;AAEpE,uHAAuH;AACvH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CASnE;AAED,iHAAiH;AACjH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAEhF;AAKD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAEjF;AAKD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAEjF;AAED,kHAAkH;AAClH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,oBAAoB,GAAG,IAAI,CAItG"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.describeWorkingSignal = describeWorkingSignal;
|
|
10
10
|
exports.describeWorkingSignals = describeWorkingSignals;
|
|
11
|
+
exports.checkHasOwnPendingWork = checkHasOwnPendingWork;
|
|
12
|
+
exports.checkHasOwnLastingWork = checkHasOwnLastingWork;
|
|
11
13
|
exports.getIdleHeldNoticeReason = getIdleHeldNoticeReason;
|
|
12
14
|
/** @description The signal in the words of the bot's log, naming its figure when it has one (`unconsumed input 2`). */
|
|
13
15
|
function describeWorkingSignal(signal) {
|
|
@@ -24,6 +26,24 @@ function describeWorkingSignal(signal) {
|
|
|
24
26
|
function describeWorkingSignals(signals) {
|
|
25
27
|
return signals.map(describeWorkingSignal).join(', ');
|
|
26
28
|
}
|
|
29
|
+
/** The signals of the agent's OWN pending work: each ends by itself and starts the agent's next turn. */
|
|
30
|
+
const ownPendingWorkKinds = new Set(['backgroundTasks', 'scheduledJobs', 'taskTurnOnItsWay']);
|
|
31
|
+
/**
|
|
32
|
+
* @description Whether the agent waits on its own pending work — a background command or sub-agent, a session job (a `ScheduleWakeup`,
|
|
33
|
+
* a `CronCreate`), a finished task's turn on its way — whose end starts its next turn by itself.
|
|
34
|
+
*/
|
|
35
|
+
function checkHasOwnPendingWork(signals) {
|
|
36
|
+
return signals.some((signal) => ownPendingWorkKinds.has(signal.kind));
|
|
37
|
+
}
|
|
38
|
+
/** The signals of the agent's own work that is still RUNNING: a finished task's turn on its way is not — that work is over. */
|
|
39
|
+
const ownLastingWorkKinds = new Set(['backgroundTasks', 'scheduledJobs']);
|
|
40
|
+
/**
|
|
41
|
+
* @description Whether the agent's own work still runs — a background command or sub-agent, a session job — not only the notice of
|
|
42
|
+
* a task that already ended ({@link checkHasOwnPendingWork} counts that too).
|
|
43
|
+
*/
|
|
44
|
+
function checkHasOwnLastingWork(signals) {
|
|
45
|
+
return signals.some((signal) => ownLastingWorkKinds.has(signal.kind));
|
|
46
|
+
}
|
|
27
47
|
/**
|
|
28
48
|
* @description Which reason the topic's notice gives for a process held at the idle mark: the agent's own background work first
|
|
29
49
|
* (it is what survives a quiet topic for hours), then a message it has not taken in. `null` — no line — when only a running turn
|
|
@@ -31,10 +51,9 @@ function describeWorkingSignals(signals) {
|
|
|
31
51
|
* compaction is in flight (it is the very thing the idle mark would have done).
|
|
32
52
|
*/
|
|
33
53
|
function getIdleHeldNoticeReason(signals) {
|
|
34
|
-
|
|
35
|
-
if (kinds.has('backgroundTasks') || kinds.has('scheduledJobs') || kinds.has('taskTurnOnItsWay'))
|
|
54
|
+
if (checkHasOwnPendingWork(signals))
|
|
36
55
|
return 'backgroundWork';
|
|
37
|
-
if (
|
|
56
|
+
if (signals.some((signal) => signal.kind === 'unconsumedInput'))
|
|
38
57
|
return 'unconsumedInput';
|
|
39
58
|
return null;
|
|
40
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workingSignals.js","sourceRoot":"","sources":["../../src/utils/workingSignals.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmBH,sDASC;AAGD,wDAEC;AAWD,
|
|
1
|
+
{"version":3,"file":"workingSignals.js","sourceRoot":"","sources":["../../src/utils/workingSignals.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmBH,sDASC;AAGD,wDAEC;AASD,wDAEC;AASD,wDAEC;AAWD,0DAIC;AApDD,uHAAuH;AACvH,SAAgB,qBAAqB,CAAC,MAAqB;IACzD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,OAAO,WAAW,CAAC;QAChC,KAAK,iBAAiB,CAAC,CAAC,OAAO,oBAAoB,MAAM,CAAC,KAAK,EAAE,CAAC;QAClE,KAAK,eAAe,CAAC,CAAC,OAAO,kBAAkB,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9D,KAAK,kBAAkB,CAAC,CAAC,OAAO,6BAA6B,CAAC;QAC9D,KAAK,iBAAiB,CAAC,CAAC,OAAO,oBAAoB,MAAM,CAAC,KAAK,EAAE,CAAC;QAClE,KAAK,YAAY,CAAC,CAAC,OAAO,sBAAsB,CAAC;IACnD,CAAC;AACH,CAAC;AAED,iHAAiH;AACjH,SAAgB,sBAAsB,CAAC,OAAiC;IACtE,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,yGAAyG;AACzG,MAAM,mBAAmB,GAAuC,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAElI;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAAiC;IACtE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,+HAA+H;AAC/H,MAAM,mBAAmB,GAAuC,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC;AAE9G;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAAiC;IACtE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC;AAKD;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,OAAiC;IACvE,IAAI,sBAAsB,CAAC,OAAO,CAAC;QAAE,OAAO,gBAAgB,CAAC;IAC7D,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,iBAAiB,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAC1F,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charness",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "charness",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.4.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
12
12
|
"abort-controller": "^3.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charness",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Sergei Solo",
|
|
6
6
|
"description": "Harness for running Claude Code / OpenCode agents in the cloud or on your laptop, controlled from Telegram or Jira.",
|