Add action logger#773
Conversation
| "spawn_timeout": 30, // num seconds allowed for the bot to spawn before throwing error. Increase when spawning takes a while. | ||
| "block_place_delay": 0, // delay between placing blocks (ms) if using newAction. helps avoid bot being kicked by anti-cheat mechanisms on servers. | ||
| "action_logging": false, // when true, write structured ACTION logs for successful bot block/item actions. | ||
| "action_log_file_prefix": "andy_log", // prefix for action log files in ./bots/<bot>/logs/ |
There was a problem hiding this comment.
This can be hard coded. Or just use log by default. Maybe also with a timestamp.
There was a problem hiding this comment.
i made the log name log__.... instead of andy_log in the new commit.
| **/ | ||
| if (x == null || y == null || z == null) throw new Error('Invalid position to break block at.'); | ||
| let block = bot.blockAt(Vec3(x, y, z)); | ||
| const targetCoord = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z)); |
There was a problem hiding this comment.
i used this function for more consistent block coord displaying inside the log, but yeah, i shouldn't have changed the global block definition. in the new commit i defined the floor function only inside the logging system, so the global bot.blockAt is not changed
There was a problem hiding this comment.
This is not important enough to have its own file. Consider moving to README.
There was a problem hiding this comment.
i removed the actionlogging md in the new commit and merged it more succintly in the readme
|
I think it feels a bit unnecessary though, instead of embedding an action log function call within each action you probably want to implement it using a middleware pattern instead to reduce the verbosity. And maybe make the middleware simply log the function name called and the arguments used. |
|
I notice you still have a lot of seemingly unnecessary helpers in the logging file which are probably already existing elsewhere I'm the codebase, and belong in Also, the middleware implementation is still very repetitive, id have expected you to place the middleware where the actions are called instead of where they are defined. Finally I'm not exactly sure why you even added this in the first place because the terminal logs are decent enough. I guess I'll leave it to the other maintainers to review. |
|
i made the action appear like ACTION function:.. arg:... clicked_block:... yaw:... etc. new function should work through this wrapper. I still want to perserve clicked_block:... yaw:... because they're extermely useful in identifying bugs about placing blocks and especially bucket when the bot is building the nether portal. By the way, I forked the repo to start my own experiment where I used a replay feature to have the bot be able to find a lava cluster and build a lava pool (at least in superflat its consistently able to achieve success given that the lava pool is a rectangle, in real world most of the issue is pathfinding due to mineflayer behavior). I wanted somebody to take a look and give their thought. The link of the repo is below (I stated explicitly experimental functions if you want to check it out): |
I think this is niche enough to stay within your fork and probably doesn't need to be added to the main repository.
Cool, I was also implementing this as a PR in #629. I did run into the same issues as you did but with a completely different implementation -- rather than a replay feature, I manually wrote algorithms to place blocks around the lava pool. |
|
yeah, that's fine, thanks for reviewing. i was just wandering if you're still actively working on this project. it seems like a lot of pushes and pr are just bug fixes, and no new major feature are being prepared. I took a look at your fork and its around september. i knew that emergent garden himself stopped working on this project, so i was just curious about the outlook of the project |
Most of the primary development by the original developers has come to a standstill due to various factors but mostly due to burnout and giving up trying to fight mineflayer which has a lot of quirks and broken mechanics. Me, I am a maintainer so my role is primarily just reviewing PRs and helping to close issues. Although I do contribute my own PRs from time-to-time, it is not as frequent as I used to before I became a maintainer. I think it's mainly due to the difficulties and unpredictability of working with mineflayer which is why we stopped. If you are interested, the @mindcraft-ce team (of which I am a member of) is working on a rewrite in Java as a Minecraft mod, which you can install with any typical mod loader. |
This PR adds an optional action logger for structured bot action logs.
The logger records successful block and item actions when action_logging is enabled in settings.js. It is disabled by default and is intended to help debug bot behavior without changing normal bot execution.
Included changes:
This PR intentionally excludes unrelated experimental features such as neural networks, replay execution, causal DAG logic, and broader agent architecture changes.