teapot-coding-agent 0.37.130 → 0.37.131

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.
@@ -2092,6 +2092,15 @@ export class Agent {
2092
2092
  cached: res.usage.cachedInputTokens,
2093
2093
  };
2094
2094
  await this.log.append("usage", this.currentSession, this.currentBranch, res.usage);
2095
+ /**
2096
+ * Push the new usage so the context meter moves while the agent works.
2097
+ *
2098
+ * `ctx.usedTokens` rides on the agent snapshot, which only went out on a session-title write — so the meter sat
2099
+ * still for an entire turn and jumped at the end. Reported as "コンテキストウィンドウ消費がリアルタイムで
2100
+ * 更新されてない? ターンごとにWSに乗せれば良いはず": once per LLM call is exactly that, and it is already the
2101
+ * moment the number changes.
2102
+ */
2103
+ this.emitSnapshotUpdate();
2095
2104
  }
2096
2105
  // `assistantTurn` carries the thinking, which is what `reasoning_content` is sent from (#187)
2097
2106
  const m = assistantTurn(res.message, res.reasoning);
@@ -1,6 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { existsSync, readFileSync, readlinkSync } from "node:fs";
3
3
  import { toolShellFor } from "../agent/tools.js";
4
+ import { bus } from "../bus.js";
4
5
  export function terminalShellFor(platform, env, exists = existsSync) {
5
6
  return toolShellFor(platform, env, exists).file;
6
7
  }
@@ -204,9 +205,23 @@ export function reapIdleTerminals(now = Date.now()) {
204
205
  const attached = (sinks.get(t.id)?.size ?? 0) > 0;
205
206
  if (attached)
206
207
  continue;
207
- if (t.exited || now - t.createdAt > IDLE_REAP_MS) {
208
- if (closeTerminal(t.id))
208
+ const idle = now - t.createdAt > IDLE_REAP_MS;
209
+ if (t.exited || idle) {
210
+ if (closeTerminal(t.id)) {
209
211
  n++;
212
+ /**
213
+ * Tell the UI, so the tab does not dangle.
214
+ *
215
+ * Reported as "長時間放置すると開いてたターミナルが消失する": the pty is reaped when nothing is attached (a
216
+ * sleeping browser drops its socket), and the tab stayed in the strip pointing at an id that no longer
217
+ * exists — the shell "disappeared" with no explanation. The client now removes the tab and says why.
218
+ */
219
+ bus.emit("update", {
220
+ kind: "terminal-closed",
221
+ terminalId: t.id,
222
+ reason: t.exited ? "exited" : "idle",
223
+ });
224
+ }
210
225
  }
211
226
  }
212
227
  return n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.130",
3
+ "version": "0.37.131",
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",