feat(runtime): compatibility hardening (Phase 7) (#18)
Phase 7 of plans/autonomous-survival-bot-prd.md. Five small modules
that close the recurring "shared state" and "version-pinned list"
failure modes the PRD flags in §7 and §5.4.
New:
- runtime/movement-profiles.js: named profiles (GATHER, TRAVEL, FLEE,
BUILD, RETURN_TO_BASE) as pure descriptors via PROFILE_DEFAULTS,
plus applyProfile(profile, bot) that hands a fresh Movements to
pathfinder. Avoids the "flee left canDig=false on the shared
Movements, next chop got stuck in canopy" regression.
- runtime/owned-blocks.js: JSONL ledger of blocks this bot placed/
removed (state/<host>/owned-blocks.jsonl); isOwned({x,y,z}) for
O(1) lookups; ensureDir() makes the parent dir lazily.
- runtime/claim-avoidance.js: classifyArea({blocks, isOwned}) returns
player_build / natural_or_owned / insufficient_data based on
man-made block density vs ownership ratio; shouldAvoid(area) helper.
Designed for gather/place skills to call before touching contested
area.
- runtime/skills/compat.test.js: runs runtime/skills/groups.js against
real minecraft-data registries for 1.18.2, 1.20.4, 1.21.5; spot-
checks that pale_oak_log only appears on 1.21+ etc.
- runtime/compat.test.js: 10 tests covering movement descriptors,
isManMadeBlockName, classifyArea, owned-blocks markPlaced/dedup/
isOwned/markRemoved.
npm test now 79/79.
Co-authored-by: Yuriy Mayatnikov <mayatnikov@me.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #18.
This commit is contained in:
@@ -246,6 +246,28 @@ in-process. The package is **not** a default dep — install it explicitly
|
||||
(`npm i prismarine-viewer`) before enabling. If missing, the runtime
|
||||
logs a warning and continues.
|
||||
|
||||
### Compatibility hardening (Phase 7)
|
||||
|
||||
Several modules now guard against the live regressions PRD §7 Phase 7
|
||||
explicitly calls out:
|
||||
|
||||
- **`runtime/movement-profiles.js`** — named profiles (`GATHER`,
|
||||
`TRAVEL`, `FLEE`, `BUILD`, `RETURN_TO_BASE`) as pure descriptors;
|
||||
`applyProfile(profile, bot)` writes a fresh `Movements` to
|
||||
pathfinder. Stops one skill's `canDig=false` from leaking into the
|
||||
next skill's path.
|
||||
- **`runtime/owned-blocks.js`** — JSONL ledger of blocks this bot
|
||||
placed (and removed). `isOwned({x,y,z})` for O(1) lookups.
|
||||
`ensureDir()` makes the dir lazily so first-write doesn't fail.
|
||||
- **`runtime/claim-avoidance.js`** — `classifyArea({blocks, isOwned})`
|
||||
returns `player_build` / `natural_or_owned` / `insufficient_data`
|
||||
based on man-made block density vs ownership ratio. Designed for
|
||||
the gather/place skills to call before touching a contested area.
|
||||
- **`runtime/skills/compat.test.js`** — runs `groups.js` against real
|
||||
`minecraft-data` registries for 1.18.2, 1.20.4, 1.21.5; verifies
|
||||
that version-sensitive blocks (e.g. `pale_oak_log`) only appear
|
||||
where they should.
|
||||
|
||||
### Self-improvement v2 (Phase 6)
|
||||
|
||||
Two classes of proposals now land in `state/<host>/proposals/`:
|
||||
|
||||
Reference in New Issue
Block a user