fix(runtime/skills/chop-logs): skip unsafe log gathering near hostiles

This commit is contained in:
2026-05-27 13:07:40 +03:00
parent fe6961e5f7
commit b5954f193d
2 changed files with 30 additions and 0 deletions
+11
View File
@@ -37,6 +37,17 @@ test("preconditions gate execution", async () => {
}
});
test("gather.logs precondition refuses nearby hostiles", async () => {
const bot = { registry: { blocksByName: { oak_log: { id: 1 } } } };
const res = await runSkill("gather.logs", {
bot,
snapshot: { closestHostile: { name: "drowned", distance: 6.1 } },
});
assert.equal(res.ok, false);
assert.equal(res.code, "no_target");
assert.match(res.detail, /unsafe to gather logs: drowned 6\.1 blocks away/);
});
test("preconditions that throw produce precondition_failed", async () => {
const teardown = _registerForTest({
id: "test.precondition-throw",