teapot-coding-agent 0.37.91 → 0.37.92

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
@@ -282,32 +282,52 @@ export class Master {
282
282
  this.configDirty = true;
283
283
  return;
284
284
  }
285
- this.raw.agents = this.config.agents;
286
- this.raw.providers = this.config.providers;
287
- this.raw.defaultProvider = this.config.defaultProvider;
288
- this.raw.tasks = this.config.tasks;
289
- this.raw.mcpServers = this.config.mcpServers;
290
- if (this.config.sessionTitles !== undefined)
291
- this.raw.sessionTitles = this.config.sessionTitles;
292
- else
293
- delete this.raw.sessionTitles;
294
- if (this.config.customThemes !== undefined)
295
- this.raw.customThemes = this.config.customThemes;
296
- if (this.config.password !== undefined)
297
- this.raw.password = this.config.password;
298
- else
299
- delete this.raw.password;
300
- if (this.config.themePrefs !== undefined)
301
- this.raw.themePrefs = this.config.themePrefs;
302
- this.raw.resumeAfterUpdate = this.config.resumeAfterUpdate;
303
- if (this.config.shortContext !== undefined)
304
- this.raw.shortContext = this.config.shortContext;
305
- if (this.config.pluginsDir !== undefined)
306
- this.raw.pluginsDir = this.config.pluginsDir;
307
- if (this.raw.progressIntervalMs === undefined && this.config.progressIntervalMs !== undefined)
308
- this.raw.progressIntervalMs = this.config.progressIntervalMs;
309
- if (this.raw.progressMinChars === undefined && this.config.progressMinChars !== undefined)
310
- this.raw.progressMinChars = this.config.progressMinChars;
285
+ /**
286
+ * ONE list of the fields `config.json` mirrors from `this.config`.
287
+ *
288
+ * This used to be ad-hoc lines, and it was wrong in two ways that both read as "the setting does not
289
+ * work":
290
+ *
291
+ * - `progressIntervalMs` / `progressMinChars` were written only when `raw` did not already have
292
+ * them (`=== undefined`), so the FIRST save persisted and every later change was dropped —
293
+ * reported as "progress interval (min) が機能してなくない? 少なくともconfig.jsonには書き込まれて
294
+ * ない";
295
+ * - `contextTokenBudget`, `contextWindowTokens`, `maxSpawnDepth`, `maxTurnsPerRound`, `onError`
296
+ * and `retryDelayMs` were never written at all, so those runtime controls could not persist
297
+ * either.
298
+ *
299
+ * Undefined DELETES the key rather than leaving the old value lying in the file, so clearing a
300
+ * control in the UI actually clears it on disk.
301
+ */
302
+ const mirrored = [
303
+ "agents",
304
+ "providers",
305
+ "defaultProvider",
306
+ "tasks",
307
+ "mcpServers",
308
+ "sessionTitles",
309
+ "customThemes",
310
+ "password",
311
+ "themePrefs",
312
+ "resumeAfterUpdate",
313
+ "shortContext",
314
+ "pluginsDir",
315
+ "progressIntervalMs",
316
+ "progressMinChars",
317
+ "contextTokenBudget",
318
+ "contextWindowTokens",
319
+ "maxSpawnDepth",
320
+ "maxTurnsPerRound",
321
+ "onError",
322
+ "retryDelayMs",
323
+ ];
324
+ for (const key of mirrored) {
325
+ const value = this.config[key];
326
+ if (value === undefined)
327
+ delete this.raw[key];
328
+ else
329
+ this.raw[key] = value;
330
+ }
311
331
  this.writeConfigAtomic(JSON.stringify(this.raw, null, 2) + "\n");
312
332
  }
313
333
  deferConfigWrites = false;
@@ -421,16 +441,13 @@ export class Master {
421
441
  this.config.contextWindowTokens =
422
442
  (patch.contextWindowTokens ?? 0) > 0 ? patch.contextWindowTokens : undefined;
423
443
  }
424
- for (const k of [
425
- "contextTokenBudget", "contextWindowTokens", "maxSpawnDepth",
426
- "maxTurnsPerRound", "onError", "retryDelayMs",
427
- ]) {
428
- const v = this.config[k];
429
- if (v === undefined)
430
- delete this.raw[k];
431
- else
432
- this.raw[k] = v;
433
- }
444
+ /**
445
+ * No `this.raw[...] = v` loop here — `saveConfig()` owns the mirror now (see its `mirrored` list).
446
+ *
447
+ * There used to be one, covering six of these keys and not the other two, which is exactly how the
448
+ * runtime controls ended up in different states: `contextTokenBudget` persisted, `progressIntervalMs`
449
+ * did not. One owner, one rule — and it runs once, at the end, after `tasks` is updated too.
450
+ */
434
451
  if (patch.tasks) {
435
452
  this.config.tasks = patch.tasks;
436
453
  this.tasks = patch.tasks.map((t) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.91",
3
+ "version": "0.37.92",
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",