@staff0rd/assist 0.377.0 → 0.379.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/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.377.0",
9
+ version: "0.379.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -22490,7 +22490,10 @@ function toSessionInfo({
22490
22490
  error,
22491
22491
  activity: activity2,
22492
22492
  autoRun,
22493
- autoAdvance
22493
+ autoAdvance,
22494
+ starred,
22495
+ totalIn,
22496
+ totalOut
22494
22497
  }) {
22495
22498
  return {
22496
22499
  id,
@@ -22510,7 +22513,10 @@ function toSessionInfo({
22510
22513
  error,
22511
22514
  activity: activity2,
22512
22515
  autoRun,
22513
- autoAdvance
22516
+ autoAdvance,
22517
+ starred,
22518
+ totalIn,
22519
+ totalOut
22514
22520
  };
22515
22521
  }
22516
22522
 
@@ -22655,29 +22661,6 @@ function createAssistSession(id, assistArgs, cwd, meta) {
22655
22661
  };
22656
22662
  }
22657
22663
 
22658
- // src/commands/sessions/daemon/dismissSession.ts
22659
- function dismissSession(sessions, id) {
22660
- const s = sessions.get(id);
22661
- if (!s) return false;
22662
- if (s.status !== "done") s.pty?.kill();
22663
- s.activityWatcher?.close();
22664
- removeActivity(s.id);
22665
- if (s.activity?.itemId != null) releaseLock(s.activity.itemId);
22666
- sessions.delete(id);
22667
- daemonLog(`session ${id} dismissed (${s.name})`);
22668
- return true;
22669
- }
22670
- function drainSessions(sessions, onDrained) {
22671
- const names = [...sessions.values()].map((s) => s.name);
22672
- const ids = [...sessions.keys()];
22673
- for (const id of ids) dismissSession(sessions, id);
22674
- onDrained();
22675
- daemonLog(
22676
- ids.length > 0 ? `drained ${ids.length} session(s): ${names.join(", ")}` : "drained 0 sessions"
22677
- );
22678
- return ids.length;
22679
- }
22680
-
22681
22664
  // src/commands/sessions/daemon/createSession.ts
22682
22665
  import { randomUUID as randomUUID4 } from "crypto";
22683
22666
 
@@ -22738,6 +22721,29 @@ function createRunSession(id, runName, runArgs, cwd) {
22738
22721
  };
22739
22722
  }
22740
22723
 
22724
+ // src/commands/sessions/daemon/dismissSession.ts
22725
+ function dismissSession(sessions, id) {
22726
+ const s = sessions.get(id);
22727
+ if (!s) return false;
22728
+ if (s.status !== "done") s.pty?.kill();
22729
+ s.activityWatcher?.close();
22730
+ removeActivity(s.id);
22731
+ if (s.activity?.itemId != null) releaseLock(s.activity.itemId);
22732
+ sessions.delete(id);
22733
+ daemonLog(`session ${id} dismissed (${s.name})`);
22734
+ return true;
22735
+ }
22736
+ function drainSessions(sessions, onDrained) {
22737
+ const names = [...sessions.values()].map((s) => s.name);
22738
+ const ids = [...sessions.keys()];
22739
+ for (const id of ids) dismissSession(sessions, id);
22740
+ onDrained();
22741
+ daemonLog(
22742
+ ids.length > 0 ? `drained ${ids.length} session(s): ${names.join(", ")}` : "drained 0 sessions"
22743
+ );
22744
+ return ids.length;
22745
+ }
22746
+
22741
22747
  // src/commands/sessions/daemon/stripReplayQueries.ts
22742
22748
  var ESC2 = "\x1B";
22743
22749
  var REPLAY_QUERY = new RegExp(
@@ -22951,11 +22957,14 @@ async function persistPhaseTokens(itemId2, phaseIdx, totalIn, totalOut) {
22951
22957
  function recordSessionUsage(sessions, claudeSessionId, totalIn, totalOut) {
22952
22958
  for (const session of sessions) {
22953
22959
  if (session.claudeSessionId !== claudeSessionId) continue;
22960
+ session.totalIn = totalIn;
22961
+ session.totalOut = totalOut;
22954
22962
  const phase = sessionBacklogPhase(session);
22955
22963
  if (phase)
22956
22964
  void persistPhaseTokens(phase.itemId, phase.phaseIdx, totalIn, totalOut);
22957
- return;
22965
+ return true;
22958
22966
  }
22967
+ return false;
22959
22968
  }
22960
22969
 
22961
22970
  // src/commands/sessions/daemon/watchActivity.ts
@@ -24118,6 +24127,13 @@ function setAutoRun(sessions, id, enabled) {
24118
24127
  daemonLog(`session ${id} autorun ${enabled ? "on" : "off"}`);
24119
24128
  return true;
24120
24129
  }
24130
+ function setStarred2(sessions, id, starred) {
24131
+ const s = sessions.get(id);
24132
+ if (!s) return false;
24133
+ s.starred = starred;
24134
+ daemonLog(`session ${id} starred ${starred ? "on" : "off"}`);
24135
+ return true;
24136
+ }
24121
24137
  function setAutoAdvance(sessions, id, enabled) {
24122
24138
  const s = sessions.get(id);
24123
24139
  if (!s) return false;
@@ -24218,6 +24234,9 @@ var SessionManager = class {
24218
24234
  setAutoAdvance(id, enabled) {
24219
24235
  if (setAutoAdvance(this.sessions, id, enabled)) this.notify();
24220
24236
  }
24237
+ setStarred(id, starred) {
24238
+ if (setStarred2(this.sessions, id, starred)) this.notify();
24239
+ }
24221
24240
  setStatus(id, status2) {
24222
24241
  const session = this.sessions.get(id);
24223
24242
  if (!session) {
@@ -24231,12 +24250,13 @@ var SessionManager = class {
24231
24250
  /* why: the status line relays token totals keyed by Claude's session id; join
24232
24251
  * it to the running backlog phase so the spend accumulates against that row. */
24233
24252
  recordUsage(claudeSessionId, totalIn, totalOut) {
24234
- recordSessionUsage(
24253
+ if (recordSessionUsage(
24235
24254
  this.sessions.values(),
24236
24255
  claudeSessionId,
24237
24256
  totalIn,
24238
24257
  totalOut
24239
- );
24258
+ ))
24259
+ this.notify();
24240
24260
  }
24241
24261
  listSessions = () => {
24242
24262
  const local = [...this.sessions.values()].map(toSessionInfo);
@@ -24635,6 +24655,9 @@ var messageHandlers = {
24635
24655
  "set-autoadvance": routed(
24636
24656
  (_client, m, d) => m.setAutoAdvance(d.sessionId, d.enabled)
24637
24657
  ),
24658
+ "set-starred": routed(
24659
+ (_client, m, d) => m.setStarred(d.sessionId, d.starred)
24660
+ ),
24638
24661
  "set-active": (_client, m, d) => m.active.set(d.cwd, d.sessionId),
24639
24662
  "set-status": (client, m, d) => {
24640
24663
  daemonLog(`set-status received: id=${d.sessionId} status=${d.status}`);
@@ -25211,7 +25234,7 @@ async function statusLine() {
25211
25234
  const branch2 = dir ? readGitBranch(windowsCwdToWslPath(dir)) : null;
25212
25235
  const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk195.cyan(branch2)} | ` : "";
25213
25236
  console.log(
25214
- `${branchSegment}${model} | Tokens - ${formatNumber(totalOut)} \u2191 : ${formatNumber(totalIn)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
25237
+ `${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
25215
25238
  );
25216
25239
  await relayRateLimits(data.rate_limits);
25217
25240
  await relayUsage(data.session_id, totalIn, totalOut);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.377.0",
3
+ "version": "0.379.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {