teapot-coding-agent 0.37.5 → 0.37.7

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/master.js CHANGED
@@ -21,7 +21,7 @@ import { fetchModelList, peekModelList, contextLengthFor, isReasoningEffort, } f
21
21
  /** how deep sub-agent spawning may nest (parent=0, its subs=1, …) */
22
22
  /**
23
23
  * Did the effective data dir come from an ENV OVERRIDE that disagrees with the
24
- * config file's own `dataDir`? (#143)
24
+ * config file's own `dataDir`?
25
25
  *
26
26
  * When it does, the config's session pointers are meaningless: they name
27
27
  * directories under the OLD root, and this process is looking at a different
@@ -55,7 +55,7 @@ function dataDirOverrideMismatch(configFilePath, effective) {
55
55
  }
56
56
  const MAX_SPAWN_DEPTH = 3;
57
57
  /**
58
- * How long boot waits for an endpoint's model catalogue (#143).
58
+ * How long boot waits for an endpoint's model catalogue.
59
59
  *
60
60
  * The window and the reasoning-effort gate both come from `/models`, so a boot
61
61
  * that waits on it is waiting for metadata, not for anything it needs to start.
@@ -116,14 +116,14 @@ function readAppVersion() {
116
116
  * entry like `"workspace": "workspaces/alpha"` (the form shipped in
117
117
  * teapot.config.example.json) silently pointed at whatever directory the
118
118
  * daemon happened to be started from — and the agent's bash tool then ran in
119
- * the wrong directory (#34). Relative workspaces are now anchored to the
119
+ * the wrong directory. Relative workspaces are now anchored to the
120
120
  * config file's own directory, which is what "the workspace" means inside a
121
121
  * config file.
122
122
  *
123
123
  * `~` is expanded for both forms; absolute paths pass through untouched.
124
124
  */
125
125
  export function resolveWorkspace(input, base) {
126
- // #110: `~` must not expand to the LITERAL "~" — that is how a directory named
126
+ // `~` must not expand to the LITERAL "~" — that is how a directory named
127
127
  // `~` got created on Windows, where process.env.HOME is unset. See src/home.ts.
128
128
  const expanded = expandTilde(input.trim());
129
129
  if (path.isAbsolute(expanded))
@@ -165,13 +165,12 @@ const DATA_DIR = process.env.TEAPOT_DATA_DIR ??
165
165
  path.join(os.homedir(), ".local", "share", "teapot-coding-agent");
166
166
  const DEFAULT_CONFIG = {
167
167
  port: Number(process.env.TEAPOT_PORT ?? 7788),
168
- // #140: this was `process.env.TEAPOT_HOST`, i.e. UNDEFINED when unset — and an
168
+ // this was `process.env.TEAPOT_HOST`, i.e. UNDEFINED when unset — and an
169
169
  // undefined hostname makes `@hono/node-server` bind every interface. So the
170
170
  // default was the opposite of the documented one: `--help` says
171
171
  // "127.0.0.1 (default) · 0.0.0.0 exposes the UI to your network", and yet the
172
172
  // default WAS "expose to your network".
173
173
  //
174
- // Measured: with no --host the server answered on the machine's LAN address as
175
174
  // well as loopback.
176
175
  //
177
176
  // Loopback is the right default for something holding API tokens and agent
@@ -210,7 +209,7 @@ export function resolveConfigPath(explicitPath) {
210
209
  }
211
210
  let masterRawConfig = {};
212
211
  /**
213
- * Normalise a provider entry's credentials into `apiKeys` (#170).
212
+ * Normalise a provider entry's credentials into `apiKeys`.
214
213
  *
215
214
  * Both spellings are read, and the result is written back in the shape the UI and
216
215
  * the pool consume. The rules:
@@ -276,7 +275,7 @@ export function loadConfig(configPath) {
276
275
  ...user,
277
276
  dataDir: user.dataDir ? path.resolve(user.dataDir.replace(/^~/, os.homedir())) : DEFAULT_CONFIG.dataDir,
278
277
  llm: { ...DEFAULT_CONFIG.llm, ...user.llm },
279
- // #170: fold a legacy single `apiKey` into `apiKeys` on load, so every consumer
278
+ // fold a legacy single `apiKey` into `apiKeys` on load, so every consumer
280
279
  // below sees one shape. Done here rather than at each use site because the pool,
281
280
  // the UI and the spawn path all need the same answer.
282
281
  providers: Object.fromEntries(Object.entries(user.providers ?? {}).map(([name, p]) => [name, migrateProviderKeys(p)])),
@@ -286,7 +285,7 @@ export function loadConfig(configPath) {
286
285
  /**
287
286
  * Can this path be replaced by an atomic rename?
288
287
  *
289
- * #144: `/dev/null`, a fifo, or a directory are all legitimate values for
288
+ * `/dev/null`, a fifo, or a directory are all legitimate values for
290
289
  * `configPath`, and `rename` over them either fails outright (EACCES for a temp
291
290
  * beside `/dev/null`) or is not what the caller wants. Only a regular file gets
292
291
  * the write-temp-then-rename treatment.
@@ -395,7 +394,7 @@ function printAgentEvent(e) {
395
394
  * Reduce an agent id to a safe single path segment.
396
395
  *
397
396
  * Agent ids become directory names, so anything path-like in one is an escape
398
- * from the sessions root (#72). Kept in step with the per-call-site
397
+ * from the sessions root. Kept in step with the per-call-site
399
398
  * `.replace(/[^\w.-]/g, "-")` calls, and applied in `addAgent` too so the
400
399
  * guarantee holds for every caller.
401
400
  */
@@ -412,7 +411,7 @@ export class Master {
412
411
  /** Agent Plugins loaded at boot (#162); their skill roots are offered to every agent */
413
412
  plugins = [];
414
413
  /**
415
- * ONE key pool per provider name (#170), shared by every agent on it.
414
+ * ONE key pool per provider name, shared by every agent on it.
416
415
  *
417
416
  * Shared on purpose: a 429 is a statement about the CREDENTIAL, not about the
418
417
  * agent that happened to send the request. Per-agent pools would let agent B walk
@@ -427,7 +426,7 @@ export class Master {
427
426
  * pid of the process that replaced us in a live update, or null while we are
428
427
  * still the server. `restartServer()` sets it; `index.ts` reads it to keep
429
428
  * supervising the replacement instead of exiting and dropping the operator
430
- * back at the shell prompt (#35).
429
+ * back at the shell prompt.
431
430
  */
432
431
  replacementPid = null;
433
432
  tasks = [];
@@ -448,7 +447,7 @@ export class Master {
448
447
  constructor(config, configPath) {
449
448
  this.config = config;
450
449
  this.configPath = configPath;
451
- // #143: an env data-dir override that disagrees with the config file means
450
+ // an env data-dir override that disagrees with the config file means
452
451
  // this config describes a DIFFERENT data dir — its session pointers cannot be
453
452
  // valid here, so rewriting them would destroy the real mapping. See
454
453
  // dataDirOverrideMismatch().
@@ -462,7 +461,7 @@ export class Master {
462
461
  /**
463
462
  * Persist current logical config back to disk (lossless via raw user config).
464
463
  *
465
- * #144: this was a bare `writeFileSync`, which TRUNCATES the target before it
464
+ * this was a bare `writeFileSync`, which TRUNCATES the target before it
466
465
  * writes. config.json holds every agent, provider and scheduled task, so any
467
466
  * interruption during the write — SIGINT, a crash, a full disk — left a ZERO-LENGTH
468
467
  * file, and the next boot read `{}` and came up empty.
@@ -478,7 +477,7 @@ export class Master {
478
477
  * the real config untouched.
479
478
  */
480
479
  saveConfig() {
481
- // #144: during boot, mark dirty instead of writing; flushed once at the end
480
+ // during boot, mark dirty instead of writing; flushed once at the end
482
481
  if (this.deferConfigWrites) {
483
482
  this.configDirty = true;
484
483
  return;
@@ -487,7 +486,7 @@ export class Master {
487
486
  this.raw.providers = this.config.providers;
488
487
  this.raw.defaultProvider = this.config.defaultProvider;
489
488
  this.raw.tasks = this.config.tasks;
490
- // #67: `raw` is what gets WRITTEN, and it is a hand-maintained mirror of `config`.
489
+ // `raw` is what gets WRITTEN, and it is a hand-maintained mirror of `config`.
491
490
  // `mcpServers` was added to the config and to the API but never to this list, so the
492
491
  // servers existed in memory and in `GET /api/config` and were STILL lost on restart —
493
492
  // a save→reopen appeared to work while the file never carried them.
@@ -557,7 +556,7 @@ export class Master {
557
556
  deferConfigWrites = false;
558
557
  configDirty = false;
559
558
  /**
560
- * Endpoints whose catalogue boot has already WAITED for (#143).
559
+ * Endpoints whose catalogue boot has already WAITED for.
561
560
  *
562
561
  * The wait must be paid once per endpoint, not once per agent. `Promise.race`
563
562
  * against a timeout is per-CALL: with a dead endpoint every agent on it paid
@@ -567,7 +566,7 @@ export class Master {
567
566
  */
568
567
  metaWaited = new Set();
569
568
  /**
570
- * #143: `TEAPOT_DATA_DIR` points somewhere other than the config's own dataDir,
569
+ * `TEAPOT_DATA_DIR` points somewhere other than the config's own dataDir,
571
570
  * so session pointers must not be written back (see dataDirOverrideMismatch).
572
571
  */
573
572
  sessionsReadOnly = false;
@@ -578,7 +577,7 @@ export class Master {
578
577
  }
579
578
  /** write-and-rename, so config.json is never observed empty or half-written */
580
579
  /**
581
- * The shared pool for a provider, created on first use (#170).
580
+ * The shared pool for a provider, created on first use.
582
581
  *
583
582
  * Cached so the cooldown state survives across agents AND across a provider being
584
583
  * re-read: rebuilding the pool on every spawn would forget that a key is cooling
@@ -624,7 +623,7 @@ export class Master {
624
623
  }
625
624
  }
626
625
  writeConfigAtomic(body) {
627
- // #144: `/dev/null` is a real, intentional value here — many callers (and
626
+ // `/dev/null` is a real, intentional value here — many callers (and
628
627
  // every test that does not care about persistence) pass it as "no config
629
628
  // file". The old `writeFileSync("/dev/null", …)` succeeded and discarded.
630
629
  //
@@ -705,7 +704,7 @@ export class Master {
705
704
  }
706
705
  if (patch.maxSpawnDepth !== undefined)
707
706
  this.config.maxSpawnDepth = patch.maxSpawnDepth;
708
- // #67: the registry is applied by the caller (it also connects); this only
707
+ // the registry is applied by the caller (it also connects); this only
709
708
  // records the list so a restart comes back with the same servers.
710
709
  if (patch.mcpServers !== undefined)
711
710
  this.config.mcpServers = patch.mcpServers;
@@ -756,7 +755,7 @@ export class Master {
756
755
  this.saveConfig();
757
756
  }
758
757
  /**
759
- * Load Agent Plugins (#162) and merge their MCP servers with the configured ones.
758
+ * Load Agent Plugins and merge their MCP servers with the configured ones.
760
759
  *
761
760
  * Separate from `start()` so it can be exercised without booting a server: this is
762
761
  * where plugin servers get QUALIFIED with their plugin name, and a naming collision
@@ -786,7 +785,7 @@ export class Master {
786
785
  }
787
786
  async start() {
788
787
  mkdirSync(this.config.dataDir, { recursive: true });
789
- // #144: ONE config write for the whole boot instead of one per agent.
788
+ // ONE config write for the whole boot instead of one per agent.
790
789
  //
791
790
  // Every agent whose recorded session is gone mints a new one, and minting
792
791
  // calls recordSession → saveConfig. With ~30 configured agents the user's log
@@ -799,7 +798,7 @@ export class Master {
799
798
  // boot, which is its own silent data loss.
800
799
  this.deferConfigWrites = true;
801
800
  this.configDirty = false;
802
- // #143: start every endpoint's model-catalogue lookup NOW, concurrently.
801
+ // start every endpoint's model-catalogue lookup NOW, concurrently.
803
802
  //
804
803
  // `addAgent` awaits this per agent, and the endpoints are shared by many
805
804
  // agents (493 agents over 6 providers here). Fired up front, the requests
@@ -807,11 +806,11 @@ export class Master {
807
806
  // resolved — instead of the requests being serialised behind the agent loop,
808
807
  // where a slow endpoint's timeout is paid again and again.
809
808
  this.prefetchModelLists();
810
- // #67: connect configured MCP servers in the background. Deliberately NOT
809
+ // connect configured MCP servers in the background. Deliberately NOT
811
810
  // awaited: a slow or unreachable server must not delay listening, and its tools
812
811
  // appear as the connection lands (an agent's next turn picks them up because
813
812
  // `allToolSpecs()` reads the registry each call).
814
- // #162: Agent Plugins contribute skill roots and MCP servers. Loaded BEFORE the
813
+ // Agent Plugins contribute skill roots and MCP servers. Loaded BEFORE the
815
814
  // MCP connect below so a plugin's servers connect in the same pass as configured
816
815
  // ones, and before any agent starts so its skills are discoverable on turn one.
817
816
  if (this.config.mcpServers?.length || this.config.pluginsDir !== false) {
@@ -964,7 +963,7 @@ export class Master {
964
963
  add(this.config.llm.baseUrl, this.config.llm.apiKey);
965
964
  }
966
965
  async addAgent(ac, opts = {}) {
967
- // #72: an agent id becomes a DIRECTORY name (sessions/<id>-<hash>), so it
966
+ // an agent id becomes a DIRECTORY name (sessions/<id>-<hash>), so it
968
967
  // must be a safe path segment. Every caller sanitised its own id — the HTTP
969
968
  // route, spawnChildFor's child name — except the ACP adapter, which passed
970
969
  // the raw client string through, so `session/load {"sessionId":"../../x"}`
@@ -987,7 +986,7 @@ export class Master {
987
986
  if (!prov && !ac.baseUrl && !this.config.llm.baseUrl) {
988
987
  throw new Error(`agent ${ac.id}: unknown provider "${provName}" and no fallback`);
989
988
  }
990
- // #170: an INLINE `ac.apiKey` is this agent's own credential, so it must NOT be
989
+ // an INLINE `ac.apiKey` is this agent's own credential, so it must NOT be
991
990
  // joined to the provider's pool — the pool belongs to the named provider, and
992
991
  // folding a one-off override in would rotate an agent onto keys its operator did
993
992
  // not choose for it. Only the named provider gets a pool.
@@ -1011,10 +1010,10 @@ export class Master {
1011
1010
  // registered yet when this runs — spawnChildFor persists AFTER creation)
1012
1011
  const myDepth = ac.parent ? this.depthOf(ac.parent) + 1 : 0;
1013
1012
  // Model metadata: the context window (for the compaction budget) and the
1014
- // catalogue entry that gates reasoning_effort support (#47) come from the
1013
+ // catalogue entry that gates reasoning_effort support come from the
1015
1014
  // SAME `/models` list.
1016
1015
  //
1017
- // #143: boot must not WAIT for this. It only tunes the compaction budget and
1016
+ // boot must not WAIT for this. It only tunes the compaction budget and
1018
1017
  // the effort controls, so a missing list costs nothing that matters; what it
1019
1018
  // cost was boot time — measured at 4.4s of pure idle on 493 agents pointed at
1020
1019
  // one unreachable endpoint, because the `Promise.race` timeout below is
@@ -1059,7 +1058,7 @@ export class Master {
1059
1058
  // here for the same reason as shortContext: a config knob that does nothing is
1060
1059
  // worse than no knob.
1061
1060
  ...(ac.autoCompact === false ? { autoCompact: false } : {}),
1062
- // #161: per-agent choice, else the global default. This mode DISCARDS information
1061
+ // per-agent choice, else the global default. This mode DISCARDS information
1063
1062
  // early by design, so it must never switch on by accident.
1064
1063
  ...((ac.shortContext ?? this.config.shortContext) ? { shortContext: true } : {}),
1065
1064
  ...(this.config.contextTokenBudget ? { contextTokenBudget: this.config.contextTokenBudget } : {}),
@@ -1072,7 +1071,7 @@ export class Master {
1072
1071
  : {}),
1073
1072
  globalSkillsDir: path.join(CONFIG_DIR, "skills"),
1074
1073
  bundledSkillsDir: BUNDLED_SKILLS_DIR,
1075
- // #162: a plugin's own skills/ is a skill root, ranked with the global ones so
1074
+ // a plugin's own skills/ is a skill root, ranked with the global ones so
1076
1075
  // a workspace skill still wins on a name clash
1077
1076
  pluginSkillRoots: this.plugins
1078
1077
  .filter((p) => p.skillsDir)
@@ -1082,13 +1081,13 @@ export class Master {
1082
1081
  ...(ac.readOnly ? { readOnlyTools: true } : {}),
1083
1082
  ...(ac.parent ? { parent: ac.parent } : {}),
1084
1083
  ...(ac.chatFn ? { chatFn: ac.chatFn } : {}),
1085
- // #47: reasoning effort is a per-agent choice; the catalogue decides
1084
+ // reasoning effort is a per-agent choice; the catalogue decides
1086
1085
  // whether it can actually be sent (see effortForRequest)
1087
1086
  ...(ac.reasoningEffort ? { reasoningEffort: ac.reasoningEffort } : {}),
1088
1087
  ...(modelMeta?.supportedParameters
1089
1088
  ? { supportedParameters: modelMeta.supportedParameters }
1090
1089
  : {}),
1091
- // #150: the model's own reasoning levels, so the picker offers exactly those
1090
+ // the model's own reasoning levels, so the picker offers exactly those
1092
1091
  ...(modelMeta?.supportedEfforts?.length ? { supportedEfforts: modelMeta.supportedEfforts } : {}),
1093
1092
  });
1094
1093
  // pricing metadata (USD/token) for the runtime cost estimate — best
@@ -1104,7 +1103,7 @@ export class Master {
1104
1103
  bus.emit("update", { kind: "event", agentId: e.agent, event: e });
1105
1104
  this.onChildEvent(ac, e);
1106
1105
  };
1107
- // #126: the CONTROL PLANE, separate from the event pipeline above.
1106
+ // the CONTROL PLANE, separate from the event pipeline above.
1108
1107
  //
1109
1108
  // `onChildEvent` used to be what woke a parent's `wait_children`, and it runs
1110
1109
  // after the event is persisted. So a failed or slow write left the parent
@@ -1124,13 +1123,13 @@ export class Master {
1124
1123
  // every movement is correct and cheap. ANCESTORS too: a waiter's targets
1125
1124
  // now span the whole subtree, so a grandchild's movement must reach it.
1126
1125
  this.wakeAncestorWaiters(ac.parent);
1127
- // #130: report only a SETTLED child, never its birth. A freshly spawned
1126
+ // report only a SETTLED child, never its birth. A freshly spawned
1128
1127
  // child is `idle` before `start()` runs, so that first idle->running flip
1129
1128
  // would tell the parent "@kid is now idle" the instant it existed.
1130
1129
  // Requiring a prior `running` is what filters it out; the wake above is
1131
1130
  // unconditional, so `wait_children` is unaffected.
1132
1131
  //
1133
- // #135: the wording addresses the CHILD's outcome, not the parent's goal.
1132
+ // the wording addresses the CHILD's outcome, not the parent's goal.
1134
1133
  // "Continue your task, or finish()..." invited the parent to finish its own
1135
1134
  // goal over a child's status; the child's report already states what
1136
1135
  // happened, so this points at it instead.
@@ -1191,7 +1190,7 @@ export class Master {
1191
1190
  this.saveConfig();
1192
1191
  }
1193
1192
  // Remember which session this agent is bound to, so a restart reattaches
1194
- // deterministically instead of re-guessing from directory mtimes (#39).
1193
+ // deterministically instead of re-guessing from directory mtimes.
1195
1194
  // Done for EVERY agent (persisted or spawned): a spawned child is re-created
1196
1195
  // on boot too, and guessing there is the same resurrection bug.
1197
1196
  this.recordSession(ac, path.basename(sessionDir));
@@ -1206,7 +1205,7 @@ export class Master {
1206
1205
  if (!entry)
1207
1206
  return; // not a configured agent — nothing to persist yet
1208
1207
  entry.session = sessionId;
1209
- // #143: never write session pointers into a config that is describing another
1208
+ // never write session pointers into a config that is describing another
1210
1209
  // data dir — every one of them would be wrong, and the correct mapping is
1211
1210
  // destroyed. The in-memory session above still works for this process.
1212
1211
  if (this.sessionsReadOnly)
@@ -1296,7 +1295,7 @@ export class Master {
1296
1295
  forkTip = parent.log.lastEventId(parent.currentBranch);
1297
1296
  forkBranch = parent.currentBranch;
1298
1297
  }
1299
- // #105: reasoning effort for the child.
1298
+ // reasoning effort for the child.
1300
1299
  //
1301
1300
  // Precedence mirrors OpenAI Codex (codex-rs/core/src/agent/child_config.rs:
1302
1301
  // `requested.or_else(configured_default).or(parent)`):
@@ -1321,7 +1320,7 @@ export class Master {
1321
1320
  provider: pcfg?.provider,
1322
1321
  model: pcfg?.model,
1323
1322
  contextWindowTokens: pcfg?.contextWindowTokens,
1324
- // #105: persisted with the child, like every other inherited field, so a
1323
+ // persisted with the child, like every other inherited field, so a
1325
1324
  // restart restores the same effort rather than reverting to the default
1326
1325
  ...(childEffort ? { reasoningEffort: childEffort } : {}),
1327
1326
  parent: parentId,
@@ -1367,7 +1366,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1367
1366
  // `inScope` is true once we are INSIDE a subtree we were asked to stop, and
1368
1367
  // stays true all the way down.
1369
1368
  //
1370
- // #142: the old walk passed `ids` down unchanged, so after matching an
1369
+ // the old walk passed `ids` down unchanged, so after matching an
1371
1370
  // explicit id every DESCENDANT failed `ids.includes(id)` and was skipped —
1372
1371
  // which is why the explicit branch hand-rolled its own one-level loop, and
1373
1372
  // why that loop could not reach a great-grandchild.
@@ -1381,7 +1380,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1381
1380
  }
1382
1381
  agent.stop("stopped by parent agent");
1383
1382
  stopped.push(id);
1384
- // #142: RECURSE for both modes.
1383
+ // RECURSE for both modes.
1385
1384
  //
1386
1385
  // The explicit-id branch used to iterate `childrenOf(id)` exactly once, so
1387
1386
  // a great-grandchild was never reached — stopping a child left its
@@ -1502,7 +1501,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1502
1501
  const owned = this.sessionById(childId);
1503
1502
  if (owned)
1504
1503
  targetId = owned.agentId;
1505
- // #132: a sub-agent must be able to message its OWN PARENT.
1504
+ // a sub-agent must be able to message its OWN PARENT.
1506
1505
  //
1507
1506
  // The rule below only ever permitted parent -> child, so a child asking its
1508
1507
  // parent a question was refused with the actively misleading
@@ -1531,7 +1530,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1531
1530
  // Scoping is correct — only the DIRECT parent may message a child, so a
1532
1531
  // grandchild is rightly refused. But "not your sub-agent: <id>" reads
1533
1532
  // like a bug when the agent simply guessed the wrong level of the tree.
1534
- // Name the real owner so the model can re-address the message (#11).
1533
+ // Name the real owner so the model can re-address the message.
1535
1534
  const actual = cfg?.parent;
1536
1535
  const live = actual ? this.agents.get(actual) : undefined;
1537
1536
  const detail = actual
@@ -1580,7 +1579,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1580
1579
  // silently dropped exactly the details the operator spawned the sub
1581
1580
  // to gather. Context management is compaction's job, not the pipe's.
1582
1581
  `[harness] Sub-agent ${ac.id} finished. Final report:\n${report || "(no summary)"}`, "harness");
1583
- // #123: a parent's report is delivered INTO a live agent — queueing it is
1582
+ // a parent's report is delivered INTO a live agent — queueing it is
1584
1583
  // not enough. If the parent is idle (finished, or parked) the report sat in
1585
1584
  // the queue until something else started the loop, so the operator saw a
1586
1585
  // finished sub-agent and a parent that never reacted.
@@ -1589,13 +1588,13 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1589
1588
  }
1590
1589
  else if (e.type === "error") {
1591
1590
  parent.enqueuePrompt(`[harness] Sub-agent ${ac.id} hit an error: ${String(e.data.message ?? "").slice(0, 500)}`, "harness");
1592
- // #123: same for an error report
1591
+ // same for an error report
1593
1592
  if (parent.status !== "running")
1594
1593
  parent.start(`sub-agent ${ac.id} error`);
1595
1594
  }
1596
- // #63: a child's activity is NOT mirrored into the parent's log. Mirroring
1595
+ // a child's activity is NOT mirrored into the parent's log. Mirroring
1597
1596
  // bought nothing — `sub` rows are display-only (`rebuildMessagesFrom` never
1598
- // read them, so the model never saw them) and once they DID render (#40) the
1597
+ // read them, so the model never saw them) and once they DID render the
1599
1598
  // parent's timeline was flooded with a child's transcript. What the parent
1600
1599
  // needs is the child's report, which already arrives as a harness prompt
1601
1600
  // above. A chat's timeline is its own.
@@ -1663,7 +1662,6 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1663
1662
  * session — REWRITING the agent's pointer in config.json. Nothing warned, and
1664
1663
  * the real history was left on disk, orphaned and unreachable.
1665
1664
  *
1666
- * Measured after an accidental in-place `addAgent()` run had rewritten 813
1667
1665
  * manifests: 493 agents were silently moved to empty sessions, and the
1668
1666
  * mapping back was only recoverable from these `agent` fields.
1669
1667
  */
@@ -1682,7 +1680,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1682
1680
  }
1683
1681
  }
1684
1682
  /**
1685
- * A human title for a session dir, from its first user prompt (#155), or null.
1683
+ * A human title for a session dir, from its first user prompt, or null.
1686
1684
  *
1687
1685
  * Reads in bounded chunks and stops at the FIRST prompt event of any source —
1688
1686
  * see the note in allSessions() for why that early exit is what makes this
@@ -1839,7 +1837,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1839
1837
  // Prefer the recorded session: the config says exactly which timeline this
1840
1838
  // agent was on. Guessing by mtime let a stale-or-deleted dir whose
1841
1839
  // chat.jsonl happened to be newer win, handing the agent a timeline the
1842
- // operator had moved off — the "deleted session comes back" report (#39).
1840
+ // operator had moved off — the "deleted session comes back" report.
1843
1841
  const recorded = this.config.agents.find((a) => a.id === agentId)?.session;
1844
1842
  if (!fresh && recorded) {
1845
1843
  const dir = path.join(root, recorded);
@@ -1925,7 +1923,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1925
1923
  size = st.size;
1926
1924
  }
1927
1925
  catch { /* no log yet — still listable */ }
1928
- // #155: a title derived from the session's FIRST user prompt, so the
1926
+ // a title derived from the session's FIRST user prompt, so the
1929
1927
  // sidebar does not make the operator read `teapot-10-16854917`.
1930
1928
  //
1931
1929
  // Read here rather than from the live agent because boot leaves agents
@@ -2138,7 +2136,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
2138
2136
  const ac = this.config.agents.find((a) => a.id === id);
2139
2137
  effectiveProvider = ac?.provider ?? this.config.defaultProvider ?? "";
2140
2138
  }
2141
- // #47: re-resolve the catalogue for the (possibly new) model so the
2139
+ // re-resolve the catalogue for the (possibly new) model so the
2142
2140
  // effort gate reflects THIS model's advertised capabilities
2143
2141
  const effortList = await fetchModelList(llm.baseUrl, llm.apiKey).catch(() => []);
2144
2142
  const meta = effortList.find((m) => m.id === (model || llm.model));
@@ -2151,7 +2149,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
2151
2149
  if (cfgEntry)
2152
2150
  cfgEntry.reasoningEffort = opts.opts.reasoningEffort || undefined;
2153
2151
  }
2154
- // keep `undefined` for "published nothing" — see the note on the option (#150)
2152
+ // keep `undefined` for "published nothing" — see the note on the option
2155
2153
  opts.opts.supportedParameters = meta?.supportedParameters;
2156
2154
  opts.opts.supportedEfforts = meta?.supportedEfforts;
2157
2155
  if (!llm.model)
@@ -2273,7 +2271,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
2273
2271
  * Read from package.json at runtime rather than via a `"__APP_VERSION__"`
2274
2272
  * literal: `__APP_VERSION__` is substituted by *vite* only, so the tsc-built
2275
2273
  * backend used to ship the raw placeholder and the settings panel rendered
2276
- * "current version: __APP_VERSION__" (#33). A runtime read is correct in the
2274
+ * "current version: __APP_VERSION__". A runtime read is correct in the
2277
2275
  * built app, in `pnpm dev` and under `node --test`, which never run vite.
2278
2276
  */
2279
2277
  static VERSION = readAppVersion();
@@ -2298,7 +2296,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
2298
2296
  // remove from map so a re-spawn after restart doesn't carry state
2299
2297
  this.agents.delete(id);
2300
2298
  });
2301
- // #79: two problems with racing a timeout against the real work.
2299
+ // two problems with racing a timeout against the real work.
2302
2300
  //
2303
2301
  // 1. The timer was never cleared, so it kept the event loop alive for the
2304
2302
  // FULL timeout after a fast, successful stop — a 30s handle on a stop