@staff0rd/assist 0.380.0 → 0.381.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +103 -103
- package/dist/index.js +24 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.381.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22494,8 +22494,7 @@ function toSessionInfo({
|
|
|
22494
22494
|
autoRun,
|
|
22495
22495
|
autoAdvance,
|
|
22496
22496
|
starred,
|
|
22497
|
-
|
|
22498
|
-
totalOut
|
|
22497
|
+
usedPct
|
|
22499
22498
|
}) {
|
|
22500
22499
|
return {
|
|
22501
22500
|
id,
|
|
@@ -22517,8 +22516,7 @@ function toSessionInfo({
|
|
|
22517
22516
|
autoRun,
|
|
22518
22517
|
autoAdvance,
|
|
22519
22518
|
starred,
|
|
22520
|
-
|
|
22521
|
-
totalOut
|
|
22519
|
+
usedPct
|
|
22522
22520
|
};
|
|
22523
22521
|
}
|
|
22524
22522
|
|
|
@@ -22956,11 +22954,10 @@ async function persistPhaseTokens(itemId2, phaseIdx, totalIn, totalOut) {
|
|
|
22956
22954
|
}
|
|
22957
22955
|
|
|
22958
22956
|
// src/commands/sessions/daemon/recordSessionUsage.ts
|
|
22959
|
-
function recordSessionUsage(sessions, claudeSessionId, totalIn, totalOut) {
|
|
22957
|
+
function recordSessionUsage(sessions, claudeSessionId, totalIn, totalOut, usedPct) {
|
|
22960
22958
|
for (const session of sessions) {
|
|
22961
22959
|
if (session.claudeSessionId !== claudeSessionId) continue;
|
|
22962
|
-
session.
|
|
22963
|
-
session.totalOut = totalOut;
|
|
22960
|
+
session.usedPct = usedPct;
|
|
22964
22961
|
const phase = sessionBacklogPhase(session);
|
|
22965
22962
|
if (phase)
|
|
22966
22963
|
void persistPhaseTokens(phase.itemId, phase.phaseIdx, totalIn, totalOut);
|
|
@@ -24252,12 +24249,13 @@ var SessionManager = class {
|
|
|
24252
24249
|
}
|
|
24253
24250
|
/* why: the status line relays token totals keyed by Claude's session id; join
|
|
24254
24251
|
* it to the running backlog phase so the spend accumulates against that row. */
|
|
24255
|
-
recordUsage(claudeSessionId, totalIn, totalOut) {
|
|
24252
|
+
recordUsage(claudeSessionId, totalIn, totalOut, usedPct) {
|
|
24256
24253
|
if (recordSessionUsage(
|
|
24257
24254
|
this.sessions.values(),
|
|
24258
24255
|
claudeSessionId,
|
|
24259
24256
|
totalIn,
|
|
24260
|
-
totalOut
|
|
24257
|
+
totalOut,
|
|
24258
|
+
usedPct
|
|
24261
24259
|
))
|
|
24262
24260
|
this.notify();
|
|
24263
24261
|
}
|
|
@@ -24641,7 +24639,8 @@ var messageHandlers = {
|
|
|
24641
24639
|
usage: (_client, m, d) => m.recordUsage(
|
|
24642
24640
|
d.claudeSessionId,
|
|
24643
24641
|
d.totalIn,
|
|
24644
|
-
d.totalOut
|
|
24642
|
+
d.totalOut,
|
|
24643
|
+
d.usedPct
|
|
24645
24644
|
),
|
|
24646
24645
|
input: routed(
|
|
24647
24646
|
(_client, m, d) => m.writeToSession(d.sessionId, d.data)
|
|
@@ -25208,10 +25207,16 @@ async function relayRateLimits(rateLimits) {
|
|
|
25208
25207
|
}
|
|
25209
25208
|
|
|
25210
25209
|
// src/commands/relayUsage.ts
|
|
25211
|
-
async function relayUsage(claudeSessionId, totalIn, totalOut) {
|
|
25210
|
+
async function relayUsage(claudeSessionId, totalIn, totalOut, usedPct) {
|
|
25212
25211
|
if (!claudeSessionId) return;
|
|
25213
25212
|
try {
|
|
25214
|
-
await sendToDaemon({
|
|
25213
|
+
await sendToDaemon({
|
|
25214
|
+
type: "usage",
|
|
25215
|
+
claudeSessionId,
|
|
25216
|
+
totalIn,
|
|
25217
|
+
totalOut,
|
|
25218
|
+
usedPct
|
|
25219
|
+
});
|
|
25215
25220
|
} catch {
|
|
25216
25221
|
}
|
|
25217
25222
|
}
|
|
@@ -25240,7 +25245,12 @@ async function statusLine() {
|
|
|
25240
25245
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
25241
25246
|
);
|
|
25242
25247
|
await relayRateLimits(data.rate_limits);
|
|
25243
|
-
await relayUsage(
|
|
25248
|
+
await relayUsage(
|
|
25249
|
+
data.session_id,
|
|
25250
|
+
totalIn,
|
|
25251
|
+
totalOut,
|
|
25252
|
+
data.context_window.used_percentage
|
|
25253
|
+
);
|
|
25244
25254
|
}
|
|
25245
25255
|
|
|
25246
25256
|
// src/commands/sync.ts
|