feat(v0.4.1): make the Settlement Contract honest end-to-end
Patches each link of the closed-loop chain (world-truth -> invariant -> dispatch -> worldDelta -> milestone) so the contract can no longer advance on a lie or stall on an unreachable milestone, and surfaces the result on the monitor. - Unblock M6_lighting: add gather.coal producer (mirrors gather.stone, strict expectGain), register it, add the skill-graph node, and make curriculum.shelter.torch two-step (gather coal -> craft torch). craft.torch needed coal but no skill produced it, so the contract pinned on M6 forever and starved M7/M8/M9. One curriculum edit fixes both rails. - M8 no longer falsely satisfied: build-shelter records locations.shelter only on real progress (setLocation moved below the no_progress guard). - M2_bed made monotonic: sleepInBed writes locations.bed when the bot places its own bed, so M2 stays met after the carried bed item is consumed. - Observability: new ink-free tui/format.js helper renders per-tick state / firing rail / active skill / blocked prerequisite / stall reason in the monitor header (fields bot.js already computes but never showed). - Harden the valid-skill-id guardrail: skillRegistryPrompt preserves the "NEVER invent" footer when truncating (a growing registry was dropping it), and fix the stale "tech-tree > autonomous" reflex chain in the escalation prompt. Tests: 494/494 passing; new build-shelter / invariants / format suites plus skill-graph, curriculum, skill-registry cases. lint-patch clean. Deferred audit findings recorded in plans/v0.4.0-vnext.md (local). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ const toolPlugin = toolPkg.plugin ?? toolPkg.default?.plugin ?? toolPkg.default
|
||||
import { info, warn } from "./log.js";
|
||||
import { digEscapeTunnel } from "./skills/recovery-tunnel-out.js";
|
||||
import { findNearestBlockByName } from "./perception.js";
|
||||
import { setLocation } from "./locations.js";
|
||||
|
||||
// Hard timeout wrapper. Mineflayer goals (pathfinder, pvp targeting) can hang
|
||||
// when the goal is unreachable; without a ceiling the whole reflex chain stops.
|
||||
@@ -364,6 +365,17 @@ export async function sleepInBed(bot) {
|
||||
// have shifted to an adjacent slot for the bed's second half).
|
||||
const placed = findNearestBlockByName(bot, BED_NAMES, { maxDistance: 4 });
|
||||
if (!placed) return { ok: false, detail: "placed bed not found after placement" };
|
||||
// M2 monotonicity: the bot just placed its OWN bed and the carried
|
||||
// item is consumed, so bedSecured()'s carried-item branch no longer
|
||||
// holds. Record the placed bed's location (mirrors choose-base /
|
||||
// place-chest / build-shelter) so the locations.bed branch keeps M2_bed
|
||||
// met and the contract stops looping gather.wool->craft.bed for a bed
|
||||
// that already exists. Recorded before sleep — the bed is in the world
|
||||
// regardless of whether sleeping succeeds; guarded so a store-write
|
||||
// hiccup never breaks the sleep path.
|
||||
try {
|
||||
setLocation("bed", { x: placed.position.x, y: placed.position.y, z: placed.position.z, radius: 1, note: "placed bed" });
|
||||
} catch {}
|
||||
await withTimeout(bot.sleep(placed), 10_000, "bot.sleep(placed)");
|
||||
return { ok: true, detail: { bedAt: placed.position, placed: true, name: carried.name } };
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user