teapot-coding-agent 0.37.185 → 0.37.186

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.
@@ -122,7 +122,7 @@ export function usageLine(used, budget, window) {
122
122
  * read as "82% used" at 615k and the denominator was a number the model could not see anywhere else. Reported as
123
123
  * "生のサイズじゃなくてcompactボーダーまでにしたのはなぜ? 消費/フルサイズ とcompactまでの残り値にすべきでは?".
124
124
  *
125
- * context 68% used (615k/900k tokens, 135k until compaction)
125
+ * context 68% used (615k/900k tokens, 135k until auto-compaction)
126
126
  *
127
127
  * When the window is unknown the budget is the only denominator available, and the line says so by omitting the
128
128
  * window entirely rather than pretending they are the same thing.
@@ -136,7 +136,9 @@ export function usageLine(used, budget, window) {
136
136
  const size = full ? `${fmt(used)}/${fmt(full)} tokens` : `${fmt(used)}/${fmt(budget)} tokens (compaction threshold; full window unknown)`;
137
137
  return until === null
138
138
  ? `context ${pct}% used (${size})`
139
- : `context ${pct}% used (${size}, ${fmt(until)} until compaction)`;
139
+ // "until auto-compaction" — the mechanism that acts on this number is automatic; plain "compaction" read as
140
+ // something the model had to trigger itself
141
+ : `context ${pct}% used (${size}, ${fmt(until)} until auto-compaction)`;
140
142
  }
141
143
  /**
142
144
  * …and the OTHER thing that gets reported as "context is exhausted": the model has run out of its own ideas.
@@ -1502,10 +1502,34 @@ export const TOOLS = [
1502
1502
  async run(args, ctx) {
1503
1503
  if (args.background === true) {
1504
1504
  const id = startBackgroundShell(str(args.command), ctx);
1505
+ /**
1506
+ * The result has to say two things the model kept getting wrong (#231, #235).
1507
+ *
1508
+ * - "you are woken when it exits" was already there, but models still polled or kept busy-working while a long
1509
+ * build ran ("モデルがバックエンドbashを待つために止まるってことを知らない / ポーリングしたり、余計な作業をし続けたり").
1510
+ * So the WAKE is stated as an instruction: stopping the round is how you wait, and you do not need to poll.
1511
+ * - and it lists the other jobs still running, because a model that starts three builds forgets the first two
1512
+ * ("そうじゃないと起動したこと忘れるモデルがある").
1513
+ */
1514
+ const running = [...bgMapFor(ctx.cwd).values()].filter((j) => !j.exited);
1515
+ const others = running.filter((j) => j.id !== id);
1516
+ const list = running
1517
+ .map((j) => {
1518
+ const secs = Math.round((Date.now() - j.startedAt) / 1000);
1519
+ const when = secs >= 60 ? `${Math.round(secs / 60)}m` : `${secs}s`;
1520
+ const cmd = j.cmd.replace(/\s+/g, " ").slice(0, 90);
1521
+ return ` ${j.id}${j.id === id ? " (just started)" : ""} · ${when} · ${cmd}`;
1522
+ })
1523
+ .join("\n");
1505
1524
  return {
1506
1525
  ok: true,
1507
- result: `started in background (job ${id}) — you are notified when it exits (code + output tail); ` +
1508
- `do NOT poll it. Output: bash_output(job_id="${id}"). Stop: bash_output(job_id="${id}", action="kill").`,
1526
+ result: `started in background (job ${id}). ` +
1527
+ `You are WOKEN when it exits (exit code + output tail), so waiting is not your job: do not poll it, do not ` +
1528
+ `sleep, and do not start another round just to check — end your turn (or do other work) and the harness will ` +
1529
+ `call you when it finishes.\n` +
1530
+ `Output mid-run: bash_output(job_id="${id}"). Stop: bash_output(job_id="${id}", action="kill").\n` +
1531
+ `running background jobs for this workspace (${running.length}):\n${list}` +
1532
+ (others.length ? `\nDo not start a duplicate of a job that is already here.` : ""),
1509
1533
  };
1510
1534
  }
1511
1535
  const explicit = args.timeout_ms !== undefined && args.timeout_ms !== null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.185",
3
+ "version": "0.37.186",
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",