@polycode-projects/the-mechanical-code-talker 2.7.15 → 2.7.17
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 +1 -1
- package/src/services/spider-fly.mjs +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polycode-projects/the-mechanical-code-talker",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.17",
|
|
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.",
|
|
@@ -651,6 +651,37 @@ export async function runSpiderFlyTick(memoryDir, opts = {}) {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
const ecology = runEcologyPass({ state, postMovePlacements, postMoveMassByFly, postMoveMassBySpider, turn: k });
|
|
654
|
+
// Every agent's goal was assigned during movement, before this same tick's
|
|
655
|
+
// ecology pass resolves eating/starving — so a THIRD agent's goal can name
|
|
656
|
+
// a subject that dies in this exact tick just as easily as the dying
|
|
657
|
+
// subject's own goal can (a fly's "evading — last saw spider-1 ..." is
|
|
658
|
+
// just as stale as spider-1's own entry once spider-1 starves this tick).
|
|
659
|
+
// Scrub every remaining agent's goal of a died-this-tick reference BEFORE
|
|
660
|
+
// the specific eaten-pair handling below, so that handling's own nicer
|
|
661
|
+
// "just ate X" message (set second) always wins for the eating spider,
|
|
662
|
+
// whose pre-scrub goal also names its prey. `(?!\d)` keeps "fly-1" from
|
|
663
|
+
// false-matching inside "fly-10".
|
|
664
|
+
const diedThisTick = [...ecology.events.eaten.map((e) => e.fly), ...ecology.events.starved];
|
|
665
|
+
for (const id of Object.keys(agents)) {
|
|
666
|
+
for (const deadId of diedThisTick) {
|
|
667
|
+
if (new RegExp(`${deadId}(?!\\d)`).test(agents[id].goal)) {
|
|
668
|
+
agents[id].goal = `${deadId} is gone — re-evaluating.`;
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
// A fly eaten or starved THIS tick was already assigned a pre-ecology
|
|
674
|
+
// goal/position above (movement runs before the ecology pass resolves
|
|
675
|
+
// eating) — left as-is, the same response would both announce "fly-5 was
|
|
676
|
+
// eaten" and still list fly-5's stale "trapped, can't move" goal one clause
|
|
677
|
+
// later, as if it were still on the board. Drop it from `agents` (its own
|
|
678
|
+
// goal is moot) and let the eating spider's line say what actually
|
|
679
|
+
// happened instead of the now-false "co-located with fly-5 in the web".
|
|
680
|
+
for (const { fly, spider } of ecology.events.eaten) {
|
|
681
|
+
delete agents[fly];
|
|
682
|
+
if (agents[spider]) agents[spider].goal = `just ate ${fly} in the web.`;
|
|
683
|
+
}
|
|
684
|
+
for (const flyId of ecology.events.starved) delete agents[flyId];
|
|
654
685
|
const writes = [...movementWrites, ...ecology.writes];
|
|
655
686
|
const provenance = `${worldProvenanceTag(WORLD_NAME)}:turn${k}`;
|
|
656
687
|
await appendFacts(memoryDir, writes.map((f) => ({ ...f, provenance })));
|