Files
pepa-pi-bot/package.json
T
2ecadd3bb2 fix(supervisor): pidfile lock prevents two supervisors racing on the nickname (#9)
User report 2026-05-25: launched 'npm run bot' fresh, MC server kicked
every login with "Игрок с данным никнеймом уже играет на сервере" and
the bot fell into a perpetual reconnect-then-kicked loop. Root cause:
a smoke-test supervisor from an earlier shell was still running in the
background, holding the pepa_bot session open. Two supervisors racing
on the same nickname is undefined behaviour from the server's side and
results in this exact failure mode.

Changes:

runtime/supervisor.js — acquires state/<host>/supervisor.pid before
spawning the child. If another supervisor is alive (kill -0 check), the
new one exits with a clear message telling the operator how to recover.
On SIGINT/SIGTERM/exit the lock is released; stale pidfiles are detected
when the recorded PID is no longer alive.

scripts/stop.sh — emergency cleanup helper:
  - kills any supervisor or bot.js processes matching this repo
  - removes pidfile + bot.sock
  - reminds the operator to wait ~30s for the MC server to drop the old
    session before re-launching

package.json — new `npm run stop` script.

Smoke-tested:
  - first 'node runtime/supervisor.js' acquires lock, writes pid
  - second call refuses with diagnostic message
  - first SIGTERM ⇒ pidfile removed automatically

Co-authored-by: Yuriy Mayatnikov <mayatnikov@me.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:47:24 +03:00

49 lines
1.3 KiB
JSON

{
"name": "pepa-pi-bot",
"version": "0.0.1",
"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"
},
"dependencies": {
"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",
"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"
}
}