Adds a reactive layer on top of the polling reflex. The bot now
notices environmental shocks (forced moves, HP plunges, hostile
spawns) within ~100ms instead of waiting for the next DISPATCH tick,
and the in-flight skill is preempted so the next reflex cycle can
re-plan against the current world state.
This is the rc that wires the "rc.1 plumbing + rc.2 manifesto" into
a feedback loop:
- awareness fires preempt → dispatch aborts
- reflex tick re-evaluates → manifesto walks the ladder
- new dispatch picks the right skill for the new world state
Pieces:
- runtime/awareness/events.js (new) — bot.on listeners:
- move: single-tick Δposition ≥ 5 blocks → forced_move flag + preempt
- health: HP drop ≥ 2 → health_plunge flag + preempt
- entitySpawn: hostile mob within 12 blocks → hostile_added + preempt
- blockUpdate: nearby block change → env_changed flag (no preempt,
throttled 800ms; otherwise gather skills would self-preempt
every dig)
- runtime/skills/index.js — RUNNER_CODES.PREEMPTED + raceWithAbort()
wraps every execute() against ctx.abortSignal. Existing skills get
preemption for free; they don't have to check the signal manually.
- runtime/bot.js:
- dispatchAction creates a fresh AbortController per dispatch and
stores it on reflexCtx.currentAbort
- attachAwareness fires controller.abort() when something disrupts
the active skill; runSkill returns code: "preempted" and the
reflex moves on
- reflexCtx.lastPreempt records the most recent shock
Tests: 332 green (was 315 on rc.2, +17 new):
- runtime/awareness/events.test.js — 12 tests (each event type +
thresholds + throttling + passive-mob filter)
- runtime/skills/contract.test.js — 3 abortSignal tests
(mid-flight, pre-armed, clean signal)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
53 lines
2.5 KiB
JSON
53 lines
2.5 KiB
JSON
{
|
|
"name": "pepa-pi-bot",
|
|
"version": "0.3.0-rc.3",
|
|
"private": true,
|
|
"description": "An autonomous, self-extending Minecraft player powered by Pi and Mineflayer.",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"scripts": {
|
|
"agent": "pi",
|
|
"agent:resume": "pi -c",
|
|
"bot": "node runtime/supervisor.js",
|
|
"bot:bare": "node runtime/bot.js",
|
|
"tui": "tsx tui/tui.tsx",
|
|
"propose:apply": "node scripts/propose-apply.js",
|
|
"stop": "bash scripts/stop.sh",
|
|
"test": "node --test runtime/skills/contract.test.js runtime/skills/groups.test.js runtime/skills/compat.test.js runtime/skills/recovery-tunnel-out.test.js runtime/skills/pillar-up.test.js runtime/curriculum.test.js runtime/social/social.test.js runtime/social/conversation.test.js runtime/social/chat-history.test.js runtime/social/reply-pi.test.js runtime/stuck-incident.test.js runtime/compat.test.js runtime/reflex.test.js runtime/base-site.test.js runtime/locations.test.js runtime/watch-filter.test.js runtime/world-journal.test.js runtime/scenario-memory.test.js runtime/critic.test.js runtime/skill-library.test.js runtime/skill-registry.test.js runtime/modes.test.js runtime/pathfinder-watchdog.test.js runtime/manifesto/needs.test.js runtime/manifesto/state.test.js runtime/awareness/events.test.js runtime/knowledge/knowledge.test.js runtime/llm/provider.test.js runtime/coach/postmortem.test.js runtime/coach/advice.test.js runtime/coach/reflect.test.js runtime/coach/fast-advisor.test.js runtime/persona/chatter.test.js scripts/edit-scope.test.js scripts/lint-patch.test.js"
|
|
},
|
|
"dependencies": {
|
|
"better-sqlite3": "^11.10.0",
|
|
"canvas": "^3.2.3",
|
|
"dotenv": "^16.4.5",
|
|
"ink": "^7.0.4",
|
|
"ink-text-input": "^6.0.0",
|
|
"minecraft-data": "^3.110.2",
|
|
"mineflayer": "^4.37.1",
|
|
"mineflayer-armor-manager": "^2.0.1",
|
|
"mineflayer-auto-eat": "^5.0.3",
|
|
"mineflayer-collectblock": "^1.6.0",
|
|
"mineflayer-pathfinder": "^2.4.5",
|
|
"mineflayer-pvp": "^1.3.2",
|
|
"mineflayer-tool": "^1.2.0",
|
|
"prismarine-item": "^1.18.0",
|
|
"prismarine-viewer": "^1.33.0",
|
|
"react": "^19.2.6",
|
|
"vec3": "^0.2.0"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/xmatic-squad/pepa-pi-bot.git"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/xmatic-squad/pepa-pi-bot/issues"
|
|
},
|
|
"homepage": "https://github.com/xmatic-squad/pepa-pi-bot#readme",
|
|
"devDependencies": {
|
|
"@types/react": "^19.2.15",
|
|
"tsx": "^4.22.3"
|
|
}
|
|
}
|