teapot-coding-agent 0.37.107 → 0.37.109

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.
@@ -5,7 +5,7 @@ import { storeImage, resolveImages } from "../log/image-store.js";
5
5
  import { chat, chatStream } from "./llm.js";
6
6
  import { auditPrompt, parseAuditVerdict } from "./goal-audit.js";
7
7
  import { createCatalog } from "./tool-catalog.js";
8
- import { resetToolCatalog, executeTool, toolSpecs, currentSkills, safeJoin, isContextOverflow, isRequestNodeLimit, hasRunningBgShells, hasRunningBgShellsFor, killBgShells } from "./tools.js";
8
+ import { resetToolCatalog, executeTool, toolSpecs, currentSkills, safeJoin, isContextOverflow, isRequestNodeLimit, hasRunningBgShells, hasRunningBgShellsFor, killBgShells, runningBgShellCount } from "./tools.js";
9
9
  import { effortChoosable } from "./llm.js";
10
10
  import { mcp } from "./mcp-registry.js";
11
11
  import { flattenToolName } from "./mcp-registry.js";
@@ -1085,6 +1085,8 @@ export class Agent {
1085
1085
  live: this.isLive(),
1086
1086
  workspace: this.workspace,
1087
1087
  workspaceMissing: this.isGhost,
1088
+ // live count for the header badge — see runningBgShellCount (#197)
1089
+ bgRunning: runningBgShellCount(this.workspace),
1088
1090
  session: this.currentSession,
1089
1091
  ...(title ? { sessionTitle: title } : {}),
1090
1092
  branch: this.currentBranch,
@@ -376,6 +376,28 @@ export function killBgShell(cwd, id, stateDir) {
376
376
  }
377
377
  return false;
378
378
  }
379
+ /**
380
+ * How many background shells are running in this workspace right now.
381
+ *
382
+ * The header badge used to be fetched only when it was CLICKED, so the count was whatever it had been at the
383
+ * last click — "クリックしないと値更新されなかった" (#197). It now rides on the agent snapshot, which is pushed
384
+ * on every update, so there is nothing to fetch and nothing to go stale.
385
+ */
386
+ export function runningBgShellCount(cwd) {
387
+ const m = bgShellsByWs.get(cwd);
388
+ if (!m)
389
+ return 0;
390
+ let n = 0;
391
+ for (const sh of m.values()) {
392
+ if (sh.exited && Date.now() - sh.startedAt > 30 * 60_000) {
393
+ m.delete(sh.id);
394
+ continue;
395
+ }
396
+ if (!sh.exited)
397
+ n++;
398
+ }
399
+ return n;
400
+ }
379
401
  export function hasRunningBgShells(cwd) {
380
402
  const m = bgShellsByWs.get(cwd);
381
403
  if (!m)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.107",
3
+ "version": "0.37.109",
4
4
  "description": "A lightweight, always-on multi-agent harness for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",