teapot-coding-agent 0.35.17 → 0.35.19

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.
@@ -1732,10 +1732,22 @@ export class Agent {
1732
1732
  parts.push(`NOT FOUND in todo.md: ${unmatched.map((s) => `"${s}"`).join(", ")} — check get_todo and retry with the exact wording, or use action:"add" to create it`);
1733
1733
  return parts.join(". ");
1734
1734
  }
1735
- async setGoalStatus(status) {
1735
+ /**
1736
+ * `by` records WHY the status changed, because "active" alone is ambiguous.
1737
+ *
1738
+ * Two very different things produce it: the operator resuming a paused goal, and the auditor
1739
+ * rejecting a `finish(goalComplete=true)`. The timeline rendered the second wording for both, so
1740
+ * pressing ▶ working on a paused goal said "the audit rejected the finish" — reported as
1741
+ * "pausedからの移動はrejectじゃないのでは?".
1742
+ */
1743
+ async setGoalStatus(status, by = "operator") {
1736
1744
  this.goal = { ...this.goal, status, updatedAt: new Date().toISOString() };
1737
1745
  await this.writeGoalFile();
1738
- await this.log.append("goal", this.currentSession, this.currentBranch, { event: "status", status });
1746
+ await this.log.append("goal", this.currentSession, this.currentBranch, {
1747
+ event: "status",
1748
+ status,
1749
+ by,
1750
+ });
1739
1751
  }
1740
1752
  /** Set the goal's verification contract (completion requirements). */
1741
1753
  async setGoalVerify(verify) {
@@ -1755,8 +1767,23 @@ export class Agent {
1755
1767
  };
1756
1768
  if (verdict === "approved")
1757
1769
  this.goal.status = "done";
1758
- else if (this.goal.status === "done")
1759
- this.goal.status = "active"; // reopened
1770
+ /**
1771
+ * A rejection REOPENS the goal, and that is logged as its own status event.
1772
+ *
1773
+ * It used to flip `status` to "active" with no event at all, so the timeline only ever saw a
1774
+ * bare "active" and could not tell this apart from an operator resuming a paused goal — which
1775
+ * is why the `by` field exists. Logged here rather than through `setGoalStatus` because the
1776
+ * audit entry below must be written in the same order the state changed.
1777
+ */
1778
+ const reopened = verdict !== "approved" && this.goal.status === "done";
1779
+ if (reopened) {
1780
+ this.goal.status = "active";
1781
+ await this.log.append("goal", this.currentSession, this.currentBranch, {
1782
+ event: "status",
1783
+ status: "active",
1784
+ by: "auditor",
1785
+ });
1786
+ }
1760
1787
  await this.writeGoalFile();
1761
1788
  await this.log.append("goal", this.currentSession, this.currentBranch, {
1762
1789
  event: "audit",
@@ -560,10 +560,24 @@ export function buildApp(master) {
560
560
  * and returns the subset of names that are gitignored. Never throws — a
561
561
  * non-git workspace simply yields an empty set.
562
562
  */
563
- async function checkIgnoredBatch(workspace, dirAbs, dirents) {
563
+ async function checkIgnoredBatch(dirAbs, dirents) {
564
564
  const out = new Set();
565
565
  try {
566
- const relPaths = dirents.filter((d) => !d.name.startsWith(".")).map((d) => path.relative(workspace, path.join(dirAbs, d.name)));
566
+ /**
567
+ * Run git FROM THE DIRECTORY BEING LISTED, and pass bare names.
568
+ *
569
+ * `git -C <workspace> check-ignore` with workspace-relative paths fails when the workspace
570
+ * itself is not a repository — and a workspace is very often just a PARENT FOLDER holding
571
+ * several checkouts. MEASURED: with `~/work/tyb2` as the workspace, listing
572
+ * `mt6589-emulator/` (its own repo, whose `.gitignore` line 1 is `renode/`) returned nothing
573
+ * ignored, because `git -C ~/work/tyb2` exits with "not a git repository" and the empty
574
+ * result was read as "nothing is ignored".
575
+ *
576
+ * `git -C <dirAbs>` finds the enclosing repo by walking UP, which is exactly the behaviour a
577
+ * file tree wants: each directory reports against whichever repository actually contains it,
578
+ * including a nested `.gitignore`. Bare names keep the parse below simple.
579
+ */
580
+ const relPaths = dirents.filter((d) => !d.name.startsWith(".")).map((d) => d.name);
567
581
  if (relPaths.length === 0)
568
582
  return out;
569
583
  const { execFile } = await import("node:child_process");
@@ -576,7 +590,9 @@ export function buildApp(master) {
576
590
  };
577
591
  const p = execFile("git",
578
592
  // NOTE: no --quiet — it suppresses the stdout we parse
579
- ["-C", workspace, "check-ignore", "--stdin", "-z", "--verbose"], { encoding: "utf8", maxBuffer: 1 << 20 }, (err, stdout) => finished(err || !stdout ? "" : stdout));
593
+ // `-C dirAbs`, not the workspace: git then finds the enclosing repo by walking up, so a
594
+ // workspace that is merely a PARENT of several checkouts still reports each one correctly
595
+ ["-C", dirAbs, "check-ignore", "--stdin", "-z", "--verbose"], { encoding: "utf8", maxBuffer: 1 << 20 }, (err, stdout) => finished(err || !stdout ? "" : stdout));
580
596
  // git can exit before we finish writing (nothing to ignore, or the
581
597
  // cap below killed it). Without this handler the stdin "error"
582
598
  // becomes an UNCAUGHT EXCEPTION that kills the request — seen as
@@ -642,7 +658,7 @@ export function buildApp(master) {
642
658
  const entries = [];
643
659
  // one batched `git check-ignore` for the whole directory (respects
644
660
  // nested .gitignore files); absent repo / no git → nothing is "ignored"
645
- const ignoredNames = await checkIgnoredBatch(a.workspace, abs, dirents);
661
+ const ignoredNames = await checkIgnoredBatch(abs, dirents);
646
662
  for (const d of dirents) {
647
663
  if (d.name.startsWith(".") && !(showHidden && d.name !== "." && d.name !== ".."))
648
664
  continue; // hidden files stay out unless the caller opted in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.35.17",
3
+ "version": "0.35.19",
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",