@songsid/agend 2.1.2-beta.11 → 2.1.2-beta.12

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.
@@ -26,7 +26,7 @@ import { processAttachments } from "./channel/attachment-handler.js";
26
26
  import { routeToolCall } from "./channel/tool-router.js";
27
27
  import { Scheduler } from "./scheduler/index.js";
28
28
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
29
- import { TopicCommands, saveCommandForBackend, parseSaveFilename, parsePauseWakeCommand, SAVE_FILENAME_RE, SAVE_UNSUPPORTED_MSG } from "./topic-commands.js";
29
+ import { TopicCommands, saveCommandForBackend, parseSaveFilename, parsePauseWakeCommand, SAVE_FILENAME_RE, SAVE_UNSUPPORTED_MSG, resolveInstanceContext } from "./topic-commands.js";
30
30
  import { DailySummary } from "./daily-summary.js";
31
31
  import { WebhookEmitter } from "./webhook-emitter.js";
32
32
  import { TmuxControlClient } from "./tmux-control.js";
@@ -5449,20 +5449,22 @@ When users create specialized instances, suggest these configurations:
5449
5449
  if (req.method === "GET" && req.url === "/status") {
5450
5450
  const instances = Object.keys(this.fleetConfig?.instances ?? {}).map(name => {
5451
5451
  const statusFile = join(this.getInstanceDir(name), "statusline.json");
5452
- let context_pct = 0;
5453
5452
  let cost = 0;
5454
5453
  try {
5455
5454
  const data = JSON.parse(readFileSync(statusFile, "utf-8"));
5456
- context_pct = data.context_window?.used_percentage ?? 0;
5457
5455
  cost = data.cost?.total_cost_usd ?? 0;
5458
5456
  }
5459
5457
  catch (err) {
5460
5458
  this.logger.debug({ err, name }, "statusline.json read failed (/status)");
5461
5459
  }
5460
+ const backend = this.fleetConfig?.instances[name]?.backend
5461
+ ?? this.fleetConfig?.defaults?.backend
5462
+ ?? "claude-code";
5463
+ const { context } = resolveInstanceContext(this.dataDir, name, backend);
5462
5464
  return {
5463
5465
  name,
5464
5466
  status: this.getInstanceStatus(name),
5465
- context_pct,
5467
+ context_pct: context ?? 0,
5466
5468
  cost,
5467
5469
  };
5468
5470
  });
@@ -5681,18 +5683,24 @@ When users create specialized instances, suggest these configurations:
5681
5683
  getUiStatus() {
5682
5684
  const instances = Object.keys(this.fleetConfig?.instances ?? {}).map(name => {
5683
5685
  const statusFile = join(this.getInstanceDir(name), "statusline.json");
5684
- let context_pct = 0;
5685
5686
  let cost = 0;
5686
5687
  let model = "";
5687
5688
  try {
5688
5689
  const data = JSON.parse(readFileSync(statusFile, "utf-8"));
5689
- context_pct = data.context_window?.used_percentage ?? 0;
5690
5690
  cost = data.cost?.total_cost_usd ?? 0;
5691
5691
  model = data.model?.display_name ?? "";
5692
5692
  }
5693
5693
  catch (err) {
5694
5694
  this.logger.debug({ err, name }, "statusline.json read failed (getUiStatus)");
5695
5695
  }
5696
+ // Align with /ctx: statusline for claude-code, pane scrape for kiro/grok/codex.
5697
+ // Previously only statusline.json was read, so View sidebar ctx% was always 0
5698
+ // for every non-claude backend.
5699
+ const backend = this.fleetConfig?.instances[name]?.backend
5700
+ ?? this.fleetConfig?.defaults?.backend
5701
+ ?? "claude-code";
5702
+ const { context } = resolveInstanceContext(this.dataDir, name, backend);
5703
+ const context_pct = context ?? 0;
5696
5704
  return { name, status: this.getInstanceStatus(name), context_pct, cost, model };
5697
5705
  });
5698
5706
  return {