teapot-coding-agent 0.22.2 → 0.22.4

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
@@ -696,10 +696,32 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
696
696
  return path.join(this.config.dataDir, "sessions");
697
697
  }
698
698
  findLatestSessionDir(agentId) {
699
+ // Directory names are prefix-matched (exact, then "<id>-<suffix>"), which
700
+ // is ambiguous across ids: agent "teapot" also matches "teapot-3-<hash>",
701
+ // and newest-wins then handed agent teapot agent teapot-3's live session
702
+ // — two agents writing one timeline. Exclude directories that belong to
703
+ // ANOTHER configured agent id (or another live agent) before picking.
704
+ const otherIds = new Set();
705
+ for (const a of this.config.agents) {
706
+ if (a.id && a.id !== agentId)
707
+ otherIds.add(a.id);
708
+ }
709
+ for (const [liveId] of this.agents) {
710
+ if (liveId !== agentId)
711
+ otherIds.add(liveId);
712
+ }
713
+ const belongsToOther = (dir) => {
714
+ for (const other of otherIds) {
715
+ if (other === dir || dir.startsWith(`${other}-`))
716
+ return true;
717
+ }
718
+ return false;
719
+ };
699
720
  let dirs = [];
700
721
  try {
701
722
  dirs = readdirSync(this.sessionsRoot())
702
723
  .filter((d) => d === agentId || d.startsWith(`${agentId}-`))
724
+ .filter((d) => !belongsToOther(d))
703
725
  .filter((d) => {
704
726
  // an EMPTY chat.jsonl means the session was never used (created via
705
727
  // web, then abandoned). Reusing it would resurrect another agent's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.22.2",
3
+ "version": "0.22.4",
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",