@polycode-projects/the-mechanical-code-talker 2.8.0 → 2.8.3
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/README.md +30 -16
- package/corpus/tier2/generate.mjs +1 -0
- package/corpus/tier2/human.jsonl +1 -0
- package/corpus/tier2/manifest.json +3 -3
- package/package.json +2 -1
- package/src/adapters/corpus/sprite-large-template-files.mjs +6 -2
- package/src/domain/game-config.mjs +10 -4
- package/src/domain/hanoi-lesson.mjs +53 -0
- package/src/domain/spider-fly-world.mjs +16 -0
- package/src/domain/sprite-expressions.mjs +120 -0
- package/src/domain/sprite-templates.mjs +31 -9
- package/src/services/adventure-editor.mjs +361 -0
- package/src/services/adventure-viz.mjs +422 -51
- package/src/services/chat-page-viz.mjs +398 -0
- package/src/services/plan-pddl.mjs +245 -0
- package/src/services/plan-viz.mjs +324 -67
- package/src/services/spider-fly-turn.mjs +120 -3
- package/src/services/spider-fly-viz.mjs +341 -22
- package/src/services/spider-fly.mjs +337 -143
- package/src/services/sprite-catalog-viz.mjs +395 -0
- package/src/surfaces/web/adventure-browser-entry.mjs +34 -3
- package/src/surfaces/web/memory-ask-browser.bundle.js +10 -4
- package/src/surfaces/web/plan-browser-entry.mjs +114 -0
- package/src/surfaces/web/spider-fly-browser-entry.mjs +33 -1
|
@@ -53,8 +53,10 @@ import {
|
|
|
53
53
|
worldFactRows, WORLD_NAME, WORLD_OPENING, cellId, parseCellId, DIRECTION_DELTA, visibleCells,
|
|
54
54
|
} from "../../domain/spider-fly-world.mjs";
|
|
55
55
|
import { foldSpiderFlyState, runSpiderFlyTick, startSpiderFlyGame, liveWebs, DEFAULT_VISION_RADIUS } from "../../services/spider-fly.mjs";
|
|
56
|
+
import { pillsForSpiderFly, oneStepDirectionBetween } from "../../services/spider-fly-turn.mjs";
|
|
56
57
|
import { resolveSpriteForClass, SPRITE_REGISTRY } from "../../domain/sprite-map.mjs";
|
|
57
58
|
import { resolveSpriteAsset } from "../../domain/sprite-templates.mjs";
|
|
59
|
+
import { DEFAULT_GAME_CONFIG } from "../../domain/game-config.mjs";
|
|
58
60
|
|
|
59
61
|
/** A live in-memory game the page's ticker and chat dock can both drive.
|
|
60
62
|
* Returns { memoryDir, sessionId, opening, initial, taxonomyRows, tick,
|
|
@@ -89,6 +91,14 @@ export async function createSpiderFlySession({ flyCount = 1 } = {}) {
|
|
|
89
91
|
let focus = null;
|
|
90
92
|
let last = null;
|
|
91
93
|
let planState = { spiderFly: { turn: 0 } };
|
|
94
|
+
// The live, in-page-slider-adjustable knobs (mass-loss-rate/spawn-rate/
|
|
95
|
+
// vision-radius per class, and every other spiderFly tunable) — starts at
|
|
96
|
+
// the shipped defaults, mutated only through setConfig() below, and
|
|
97
|
+
// forwarded into every future tick()/turn() call. Never rewinds a value
|
|
98
|
+
// that was already written to a past turn's facts (e.g. a spider already
|
|
99
|
+
// above the OLD lay threshold isn't retroactively un-laid) — a config
|
|
100
|
+
// change only changes what happens FROM HERE ON, same as tmct.toml would.
|
|
101
|
+
let config = { ...DEFAULT_GAME_CONFIG.spiderFly };
|
|
92
102
|
|
|
93
103
|
return {
|
|
94
104
|
memoryDir,
|
|
@@ -100,7 +110,7 @@ export async function createSpiderFlySession({ flyCount = 1 } = {}) {
|
|
|
100
110
|
/** Run one real engine turn directly. Returns spider-fly.mjs's own
|
|
101
111
|
* { turn, agents, ecology } shape unmodified. */
|
|
102
112
|
async tick() {
|
|
103
|
-
const result = await runSpiderFlyTick(memoryDir);
|
|
113
|
+
const result = await runSpiderFlyTick(memoryDir, { config });
|
|
104
114
|
planState = { spiderFly: { turn: result.turn } };
|
|
105
115
|
return result;
|
|
106
116
|
},
|
|
@@ -115,6 +125,7 @@ export async function createSpiderFlySession({ flyCount = 1 } = {}) {
|
|
|
115
125
|
result = await runTurn(line, {
|
|
116
126
|
config: null, source: null, graph, focus, last, memoryDir, sessionId,
|
|
117
127
|
env: {}, lexicon, vocabHint: "", planState,
|
|
128
|
+
gameConfig: { ...DEFAULT_GAME_CONFIG, spiderFly: config },
|
|
118
129
|
});
|
|
119
130
|
} catch (e) {
|
|
120
131
|
const message = e instanceof Error ? e.message : String(e);
|
|
@@ -141,6 +152,23 @@ export async function createSpiderFlySession({ flyCount = 1 } = {}) {
|
|
|
141
152
|
}
|
|
142
153
|
return { turn: state.turnCount, agents, activeWebs: liveWebs(state.webs, state.turnCount) };
|
|
143
154
|
},
|
|
155
|
+
|
|
156
|
+
/** The live spiderFly config this session's future tick()/turn() calls
|
|
157
|
+
* will read — a plain copy, safe for a caller to inspect without
|
|
158
|
+
* risking a shared-reference mutation. */
|
|
159
|
+
getConfig() {
|
|
160
|
+
return { ...config };
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
/** Merge `partial` (any subset of DEFAULT_GAME_CONFIG.spiderFly's own
|
|
164
|
+
* keys, e.g. `{ spiderMassDecrementPerTurn: 0.2 }`) over the live
|
|
165
|
+
* config — the in-page sliders' own write path. Every unset sibling
|
|
166
|
+
* keeps its current value, mirroring resolveGameConfig's own
|
|
167
|
+
* toml-merge shape so a slider and tmct.toml can never disagree about
|
|
168
|
+
* what "partial" means. */
|
|
169
|
+
setConfig(partial) {
|
|
170
|
+
config = { ...config, ...partial };
|
|
171
|
+
},
|
|
144
172
|
};
|
|
145
173
|
}
|
|
146
174
|
|
|
@@ -149,7 +177,11 @@ export async function createSpiderFlySession({ flyCount = 1 } = {}) {
|
|
|
149
177
|
// has to duplicate grid geometry or the vision-radius default: reconstructing
|
|
150
178
|
// a spider's remaining silk-thread path from its returned direction list, and
|
|
151
179
|
// computing the POV overlay's visible-cell mask, both need them.
|
|
180
|
+
// pillsForSpiderFly/oneStepDirectionBetween are re-exported so the same page
|
|
181
|
+
// can build its own dynamic deception-pill container without duplicating
|
|
182
|
+
// spider-fly-turn.mjs's own pill logic.
|
|
152
183
|
globalThis.tmctSpiderFly = {
|
|
153
184
|
createSpiderFlySession, normFactTerm, resolveSpriteForClass, SPRITE_REGISTRY, resolveSpriteAsset,
|
|
154
185
|
cellId, parseCellId, DIRECTION_DELTA, visibleCells, DEFAULT_VISION_RADIUS,
|
|
186
|
+
pillsForSpiderFly, oneStepDirectionBetween, DEFAULT_GAME_CONFIG,
|
|
155
187
|
};
|