teapot-coding-agent 0.26.10 → 0.26.12

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.
@@ -6,6 +6,7 @@ import { spawn } from "node:child_process";
6
6
  import { existsSync, promises as fs, readlinkSync, realpathSync } from "node:fs";
7
7
  import path from "node:path";
8
8
  import { discoverSkills, isValidSkillName, readSkillFile, saveSkill, SKILL_FILE, } from "./skills.js";
9
+ import { isReasoningEffort } from "../model-meta.js";
9
10
  const str = (v, fallback = "") => (typeof v === "string" ? v : fallback);
10
11
  const num = (v, fallback) => (typeof v === "number" ? v : fallback);
11
12
  function clip(s, max) {
@@ -1532,6 +1533,24 @@ export const TOOLS = [
1532
1533
  task: { type: "string", description: "self-contained instructions for the sub-agent" },
1533
1534
  context: { type: "string", enum: ["none", "fork"], description: "default none" },
1534
1535
  name: { type: "string", description: "optional short name fragment for the id" },
1536
+ // #105: reasoning effort for THIS sub-agent, overriding both the
1537
+ // configured subagent default and the parent's inherited value.
1538
+ //
1539
+ // Precedence mirrors OpenAI Codex (codex-rs/core/src/agent/child_config.rs):
1540
+ // spawn argument -> configured default -> parent's effort. Codex
1541
+ // deliberately does NOT inherit by default — its own test sets a parent at
1542
+ // XHigh and asserts a child spawned with Low runs at Low, because
1543
+ // sub-agents are usually narrow and cheap and inheriting a parent's high
1544
+ // effort across many trivial scouts multiplies cost for no gain.
1545
+ //
1546
+ // Naming it here is what stops the silent loss: previously a spawn could
1547
+ // not express an effort at all, so the parent's value simply vanished.
1548
+ reasoning_effort: {
1549
+ type: "string",
1550
+ enum: ["minimal", "low", "medium", "high", "xhigh"],
1551
+ description: "reasoning effort for this sub-agent. Omit to use the configured default, " +
1552
+ "then the parent's effort. Lower it for cheap, narrow scouts.",
1553
+ },
1535
1554
  },
1536
1555
  required: ["task"],
1537
1556
  },
@@ -1544,10 +1563,20 @@ export const TOOLS = [
1544
1563
  return { ok: false, result: "task required" };
1545
1564
  const context = args.context === "fork" ? "fork" : "none";
1546
1565
  try {
1566
+ // #105: validate like the per-agent setter does, so a typo cannot reach
1567
+ // the provider as an unrecognised effort value.
1568
+ const effort = str(args.reasoning_effort).trim();
1569
+ if (effort && !isReasoningEffort(effort))
1570
+ return {
1571
+ ok: false,
1572
+ result: `reasoning_effort must be minimal|low|medium|high|xhigh (got "${effort}") — ` +
1573
+ "omit it to use the configured default, then the parent's effort",
1574
+ };
1547
1575
  const r = await sa.spawn({
1548
1576
  task,
1549
1577
  context,
1550
1578
  name: str(args.name).trim() || undefined,
1579
+ ...(effort ? { reasoning_effort: effort } : {}),
1551
1580
  });
1552
1581
  return { ok: true, result: `spawned sub-agent ${r.id} — park with wait_children() until it reports (never bash sleep), steer via message_agent, halt via stop_children` };
1553
1582
  }
package/dist/master.js CHANGED
@@ -12,7 +12,7 @@ import { spawn } from "node:child_process";
12
12
  import { Agent } from "./agent/agent.js";
13
13
  import { parseSchedule, matches, nextFireAt } from "./scheduler/cron.js";
14
14
  import { bus } from "./bus.js";
15
- import { fetchModelList, contextLengthFor, isReasoningEffort } from "./model-meta.js";
15
+ import { fetchModelList, contextLengthFor, isReasoningEffort, } from "./model-meta.js";
16
16
  /** how deep sub-agent spawning may nest (parent=0, its subs=1, …) */
17
17
  const MAX_SPAWN_DEPTH = 3;
18
18
  /**
@@ -620,12 +620,34 @@ export class Master {
620
620
  forkTip = parent.log.lastEventId(parent.currentBranch);
621
621
  forkBranch = parent.currentBranch;
622
622
  }
623
+ // #105: reasoning effort for the child.
624
+ //
625
+ // Precedence mirrors OpenAI Codex (codex-rs/core/src/agent/child_config.rs:
626
+ // `requested.or_else(configured_default).or(parent)`):
627
+ //
628
+ // 1. the spawn argument — explicit, per-call
629
+ // 2. `defaultSubagentReasoningEffort` from config — a global backstop
630
+ // 3. the parent's effort — last resort
631
+ //
632
+ // Codex deliberately does NOT inherit by default, and its own test proves the
633
+ // intent: parent at XHigh, spawn requests Low, and the child runs at Low
634
+ // (codex-rs/core/tests/suite/subagent_notifications.rs). Sub-agents are
635
+ // usually narrow and cheap, so inheriting a parent's `high` across twenty
636
+ // trivial scouts multiplies cost and latency for no gain.
637
+ //
638
+ // Before this, `reasoningEffort` was simply omitted here while `provider`,
639
+ // `model` and `contextWindowTokens` two lines below WERE inherited — so a
640
+ // parent's effort vanished silently, with no way for a spawn to express one.
641
+ const childEffort = o.reasoning_effort || this.config.defaultSubagentReasoningEffort || pcfg?.reasoningEffort;
623
642
  const child = await this.addAgent({
624
643
  id,
625
644
  workspace: parent.workspace,
626
645
  provider: pcfg?.provider,
627
646
  model: pcfg?.model,
628
647
  contextWindowTokens: pcfg?.contextWindowTokens,
648
+ // #105: persisted with the child, like every other inherited field, so a
649
+ // restart restores the same effort rather than reverting to the default
650
+ ...(childEffort ? { reasoningEffort: childEffort } : {}),
629
651
  parent: parentId,
630
652
  ...(persona && SUB_PERSONAS[persona]?.readOnly ? { readOnly: true } : {}),
631
653
  }, { persist: true, fresh: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.26.10",
3
+ "version": "0.26.12",
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",