@polycode-projects/the-mechanical-code-talker 2.7.20 → 2.7.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polycode-projects/the-mechanical-code-talker",
3
- "version": "2.7.20",
3
+ "version": "2.7.21",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The Mechanical Code Talker (tmct) — a tolerant, offline, $0 chat surface that guides you toward precision queries about a software repository. ELIZA/PARRY-style but domain-obsessed with code. No model calls; no codebase index of its own.",
@@ -368,7 +368,7 @@ function mostRecentEaterSpider(state, eatenDeltaBySpider) {
368
368
  export function runEcologyPass({ state, postMovePlacements, postMoveMassByFly, postMoveMassBySpider = new Map(), turn }) {
369
369
  const k = turn;
370
370
  const writes = [];
371
- const events = { eaten: [], starved: [], laid: null, hatched: [], spawned: null };
371
+ const events = { eaten: [], starved: [], laid: null, hatched: [], spawned: null, massAfterEating: new Map() };
372
372
 
373
373
  const spiders = [...postMovePlacements.keys()].filter((id) => /^spider-\d+$/.test(id)).sort();
374
374
  const flies = [...postMovePlacements.keys()].filter((id) => /^fly-\d+$/.test(id)).sort();
@@ -399,6 +399,7 @@ export function runEcologyPass({ state, postMovePlacements, postMoveMassByFly, p
399
399
  const priorSpiderMass = postMoveMassBySpider.get(spiderId) ?? (state.mass.get(spiderId)?.value ?? SPIDER_INITIAL_MASS);
400
400
  const newSpiderMass = priorSpiderMass + (eatenMassBySpider.get(spiderId) ?? 0);
401
401
  writes.push({ subject: `${spiderId}@turn${k}`, predicate: "mgx:mass", object: String(newSpiderMass) });
402
+ events.massAfterEating.set(spiderId, newSpiderMass);
402
403
  }
403
404
 
404
405
  // 2. Starve — mass reached zero, and not already claimed by this turn's
@@ -690,7 +691,10 @@ export async function runSpiderFlyTick(memoryDir, opts = {}) {
690
691
  eatenBySpider.get(spider).push(fly);
691
692
  }
692
693
  for (const [spider, flyIds] of eatenBySpider) {
693
- if (agents[spider]) agents[spider].goal = `just ate ${flyIds.join(" and ")} in the web.`;
694
+ if (agents[spider]) {
695
+ agents[spider].goal = `just ate ${flyIds.join(" and ")} in the web.`;
696
+ agents[spider].mass = ecology.events.massAfterEating.get(spider) ?? agents[spider].mass;
697
+ }
694
698
  }
695
699
  for (const flyId of ecology.events.starved) delete agents[flyId];
696
700
  const writes = [...movementWrites, ...ecology.writes];